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

[RFC PATCH 11/12] xue: prevent dom0 (or other domain) from using the device



Mark config space of the device as read-only, to prevent dom0 (or
others) re-configuring the USB controller while it's used as a debug
console.

This isn't strictly necessary, as the xhci and xhci-dbc drivers can
co-exists, but that's a simpler option.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 xen/drivers/char/xue.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/char/xue.c b/xen/drivers/char/xue.c
index 8863b996c619..ff62b868e906 100644
--- a/xen/drivers/char/xue.c
+++ b/xen/drivers/char/xue.c
@@ -70,6 +70,13 @@ static void __init cf_check xue_uart_init_postirq(struct 
serial_port *port)
     serial_async_transmit(port);
     init_timer(&uart->timer, xue_uart_poll, port, 0);
     set_timer(&uart->timer, NOW() + MILLISECS(1));
+
+    if ( pci_ro_device(0, (uart->xue.xhc_cf8 >> 16) & 0xff,
+                          (uart->xue.xhc_cf8 >> 8) & 0xff) )
+            printk(XENLOG_INFO "Could not mark config space of %02x:%02x.%u 
read-only.\n",
+                   (uart->xue.xhc_cf8 >> 16) & 0xff,
+                   (uart->xue.xhc_cf8 >> 11) & 0x1f,
+                   (uart->xue.xhc_cf8 >> 8) & 0x0f);
 }
 
 static int cf_check xue_uart_tx_ready(struct serial_port *port)
-- 
git-series 0.9.1



 


Rackspace

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