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: Mon, 1 Dec 2008 16:59:13 +0900
Cc: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
Delivery-date: Sun, 30 Nov 2008 23:59:51 -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>
References: <20081128150942.9F66.SHIMADA-YXB@xxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

This is the revised patch with Shimada-san's suggestions.

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]

Thanks,
Kouya

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

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 77ab759..2aebf0c 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -1403,6 +1403,15 @@ static int pt_register_regions(struct pt_dev 
*assigned_device)
     /* Register expansion ROM address */
     if ( pci_dev->rom_base_addr && pci_dev->rom_size )
     {
+
+        /* Re-set BAR reported by OS, otherwise ROM can't be read. */
+        bar_data = pci_read_long(pci_dev, PCI_ROM_ADDRESS);
+        if ( (bar_data & PCI_ROM_ADDRESS_MASK) == 0 )
+        {
+            bar_data |= (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK);
+            pci_write_long(pci_dev, PCI_ROM_ADDRESS, bar_data);
+        }
+
         assigned_device->bases[PCI_ROM_SLOT].e_physbase =
             pci_dev->rom_base_addr;
         assigned_device->bases[PCI_ROM_SLOT].access.maddr =
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>