WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH][IOEMU] fix invisibility of PCI Option ROM
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Fri, 28 Nov 2008 14:29:28 +0900
Delivery-date: Thu, 27 Nov 2008 21:30:01 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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
<Prev in Thread] Current Thread [Next in Thread>