|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 8/9] vpci/header: Reset the command register when adding devices
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
Reset the command register when passing through a PCI device:
it is possible that when passing through a PCI device its memory
decoding bits in the command register are already set. Thus, a
guest OS may not write to the command register to update memory
decoding, so guest mappings (guest's view of the BARs) are
left not updated.
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
---
xen/drivers/vpci/header.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 7416ef1e1e06..dac973368b1e 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -811,6 +811,16 @@ int vpci_bar_add_handlers(const struct domain *d, struct
pci_dev *pdev)
gprintk(XENLOG_ERR,
"%pp: failed to add BAR handlers for dom%d\n", &pdev->sbdf,
d->domain_id);
+
+ /*
+ * Reset the command register: it is possible that when passing
+ * through a PCI device its memory decoding bits in the command
+ * register are already set. Thus, a guest OS may not write to the
+ * command register to update memory decoding, so guest mappings
+ * (guest's view of the BARs) are left not updated.
+ */
+ pci_conf_write16(pdev->sbdf, PCI_COMMAND, 0);
+
return rc;
}
--
2.25.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |