[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] xen/arm: vpl011: Handle correctly TXFE when backend in Xen


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 5 Apr 2023 13:17:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=faFuTvjumdAB2CRmAM9G85/4bLPNgqkuwbkGeX5rngE=; b=kjcKQVGukCECjqOvmwnNyPf0gBTADZsQJvmNCJaJdAlX8+ngV4qh8nmRmOiZ+RrnbRVTaAZn99vRWxz32iEejmTqhncYyTuOVMjFxOobagQ6GYp4LAxlAIuiBWrPLsEVUz3rLkhDQL1dkvxLNAc7jg9jJCfEKGKd2U0QZJaQDR4LhhIlFOmtlSb/SsssxgGPaFGHSDywdTiiSSXpGEXJpzAyiElsoXVg5p0rvQTlfHljVnIgZI1DFINedb4OuUeH73wSC+5GPumTRTOaqK5rze63t0/LDz3leVeapXIgCWZi3cTurBab/D4huHCQa9FsT33fbwhyC7dR7KD96VHH2A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kaV+HV0ycyoxTc4dkHTLNG3K/5Lf8Nrp6RWQmY7xY/RCfHl5wjPN6xLzuACwqAB8LXSj4+l4lQu+ZdOJJYzgJBYwTIIqBWlAiTO5set3uLlIWptzeYAYbTcNr9ET4OSqAR/NTYXftoAqHkOxCUfr497FQLyTir1c3cNidabbBUg1MgoQklCzmc9bEVCTl0izAjlUBALj1p6Ri8Q41wegJoVSjVrcF68eIfuQFavsZUx9cMSVrwHLPvtkAhzf0y/2hYX5pA2Io3pskB+in6gnGQQFsrM4ux17AFxeqmr+bX7dItVsciPcSCjzJmvL5AL5zQHeh/yauswQAikgVCAiKw==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 05 Apr 2023 11:18:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When backend is in Xen, the handling of data written to DR register is a
bit special because we want to tell guest that we are always ready for new
data to be written (i.e. no real FIFO, TXFF/BUSY never set and TXI always
set). This conflicts with the current handling of TXFE bit, which we
always clear and never set on a write path (we happen to set it when we
receive char from serial input due to use of vpl011_data_avail() but this
might never be called). This can lead to issues if a guest driver makes
use of TXFE bit to check for TX transmission completion (such guest could
then wait endlessly). Fix it by keeping TXFE always set to match the
current emulation logic.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
We don't have to look far for an example of a PL011/SBSA driver relying on TXFE.
If a guest had a driver like we have in Xen, we would end up with no messages
being printed.
---
 xen/arch/arm/vpl011.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 0186d8a31834..ff06deeb645c 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -112,8 +112,14 @@ static void vpl011_write_data_xen(struct domain *d, 
uint8_t data)
         }
     }
 
+    /*
+     * When backend is in Xen, we tell guest we are always ready for new data
+     * to be written. This is fulfilled by having:
+     * - TXI/TXFE -> always set,
+     * - TXFF/BUSY -> never set.
+     */
     vpl011->uartris |= TXI;
-    vpl011->uartfr &= ~TXFE;
+    vpl011->uartfr |= TXFE;
     vpl011_update_interrupt_status(d);
 
     VPL011_UNLOCK(d, flags);
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.