xen/arm: vpl011: Handle correctly TXFE when backend in Xen

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@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
Tested-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
Michal Orzel authored and Stefano Stabellini committed 2023-04-17 13:01:05 -07:00
1 parent 005e84e695
commit d3784f16bb
1 file changed
+7 -1
+7 -1
View File
@@ -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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.