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

[Xen-devel] [PATCH][IOEMU] fix invisibility of PCI Option ROM



If 'lspci -v' command on Dom0 shows '[virtual]' as follows, 
the option ROM can't be read by the guest.

$ lspci -v -s 0:1
...
        [virtual] Expansion ROM at fdb00000 [disabled] [size=256K]

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 77ab759..c5d2ead 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -1088,6 +1088,13 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t 
address, uint32_t val,
         break;
     case 4:
         read_val = pci_read_long(pci_dev, address);
+
+        /* use the address reported by OS but not by the device */
+        if ((address == PCI_ROM_ADDRESS) && 
+            (read_val & PCI_ROM_ADDRESS_MASK) == 0 &&
+            (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) != 0)
+            read_val = (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) |
+                (read_val & (~PCI_ROM_ADDRESS_MASK));
         break;
     }
 
@@ -1265,6 +1272,13 @@ static uint32_t pt_pci_read_config(PCIDevice *d, 
uint32_t address, int len)
         break;
     case 4:
         val = pci_read_long(pci_dev, address);
+
+        /* use the address reported by OS but not by the device */
+        if ((address == PCI_ROM_ADDRESS) && 
+            (val & PCI_ROM_ADDRESS_MASK) == 0 &&
+            (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) != 0)
+            val = (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) |
+                (val & (~PCI_ROM_ADDRESS_MASK));
         break;
     }
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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