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

[Xen-devel] [PATCH 27/27 v8] xen/arm: vpl011: Fix the slow early console SBSA UART output



The early console output uses pl011_early_write() to write data. This
function waits for BUSY bit to get cleared before writing the next byte.

In the SBSA UART emulation logic, the BUSY bit was set as soon a one
byte was written in the FIFO and it remained set until the FIFO was
emptied. This meant that the output was delayed as each character needed
the BUSY to get cleared.

Since the SBSA UART is getting emulated in Xen using ring buffers, it
ensures that once the data is enqueued in the FIFO, it will be received
by xenconsole so it is safe to set the BUSY bit only when FIFO becomes
full. This will ensure that pl011_early_write() is not delayed unduly
to write the data.

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@xxxxxxxxxx>
---
CC: Julien Grall <julien.grall@xxxxxxx>
CC: Andre Przywara <andre.przywara@xxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>

 xen/arch/arm/vpl011.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 1e72fca..375581d 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -165,9 +165,17 @@ static void vpl011_write_data(struct domain *d, uint8_t 
data)
               sizeof (intf->out) )
         vpl011->uartris &= ~TXI;
     else
+    {
         vpl011->uartfr |= TXFF;
 
-    vpl011->uartfr |= BUSY;
+        /*
+         * This bit is set only when FIFO becomes full. This ensures that
+         * the SBSA UART driver can write the early console data as fast as
+         * possible, without waiting for the BUSY bit to get cleared before
+         * writing each byte.
+         */
+        vpl011->uartfr |= BUSY;
+    }
 
     vpl011->uartfr &= ~TXFE;
 
@@ -378,6 +386,13 @@ static void vpl011_data_avail(struct domain *d)
         vpl011->uartfr &= ~TXFF;
 
         /*
+         * Clear the BUSY bit as soon as space becomes avaliable
+         * so that the SBSA UART driver can start writing more data
+         * without any further delay.
+         */
+        vpl011->uartfr &= ~BUSY;
+
+        /*
          * Ensure that there is space for atleast 16 bytes before asserting the
          * TXI interrupt status bit because the SBSA UART driver may write upto
          * 16 bytes (i.e. half the SBSA UART fifo size of 32) on getting
@@ -388,7 +403,6 @@ static void vpl011_data_avail(struct domain *d)
 
         if ( out_ring_qsize == 0 )
         {
-            vpl011->uartfr &= ~BUSY;
             vpl011->uartfr |= TXFE;
         }
     }
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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