commit 71324566f3b95bb88105659439adaef1d5bd155c
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date: Tue Oct 13 18:16:42 2009 +0100
passthrough: support passthrough in stubdoms
Few changes are needed in qemu to enable pci passthrough in stubdoms:
- we need to explicitely ask for PCI_FILL_IDENT and PCI_FILL_CLASS to
pcilib, otherwise it won't return them by default;
- we need to postpone pcilib initialization otherwise it will fail
because the pci backend is not configured yet in the pci hotplug case;
- we have to read the pci related nodes on xenstore from the guest's
path.
[PATCH 7 of 7] qemu: passthrough support in stubdoms
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
hw/pass-through.c | 29 +++++++++++++++--------------
xenstore.c | 4 ++++
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/hw/pass-through.c b/hw/pass-through.c
index a97368a..a207b2c 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -4188,7 +4188,7 @@ static struct pt_dev * register_real_device(PCIBus *e_bus,
PT_LOG("Error: couldn't locate device in libpci structures\n");
return NULL;
}
- pci_fill_info(pci_dev, PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE |
PCI_FILL_SIZES);
+ pci_fill_info(pci_dev, PCI_FILL_IRQ | PCI_FILL_BASES | PCI_FILL_ROM_BASE |
PCI_FILL_SIZES | PCI_FILL_IDENT | PCI_FILL_CLASS);
pt_libpci_fixup(pci_dev);
msi_translate = direct_pci_msitranslate;
@@ -4431,6 +4431,20 @@ int power_on_php_devfn(int devfn)
{
struct php_dev *php_dev = &dpci_infos.php_devs[devfn];
struct pt_dev *pt_dev;
+ struct pci_access *pci_access;
+
+ if (!dpci_infos.pci_access) {
+ /* Initialize libpci */
+ pci_access = pci_alloc();
+ if ( pci_access == NULL ) {
+ PT_LOG("Error: pci_access is NULL\n");
+ return -1;
+ }
+ pci_init(pci_access);
+ pci_scan_bus(pci_access);
+ dpci_infos.pci_access = pci_access;
+ }
+
pt_dev =
register_real_device(dpci_infos.e_bus,
"DIRECT PCI",
@@ -4455,20 +4469,7 @@ int power_off_php_devfn(int php_devfn)
int pt_init(PCIBus *e_bus)
{
- struct pci_access *pci_access;
-
- /* Initialize libpci */
- pci_access = pci_alloc();
- if ( pci_access == NULL )
- {
- PT_LOG("Error: pci_access is NULL\n");
- return -1;
- }
- pci_init(pci_access);
- pci_scan_bus(pci_access);
-
memset(&dpci_infos, 0, sizeof(struct dpci_infos));
- dpci_infos.pci_access = pci_access;
dpci_infos.e_bus = e_bus;
return 0;
diff --git a/xenstore.c b/xenstore.c
index 4dcc4d1..da278f4 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -604,6 +604,10 @@ void xenstore_parse_domain_config(int hvm_domid)
fprintf(logfile, "Watching %s\n", buf);
}
+ /* no need for ifdef CONFIG_STUBDOM, since in the qemu case
+ * hvm_domid is always equal to domid */
+ hvm_domid = domid;
+
/* get the pci pass-through parameter */
if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/num_devs",
hvm_domid, pci_devid) == -1)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|