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 pt_chk_bar_overlap

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] ioemu: fix pt_chk_bar_overlap
From: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
Date: Fri, 13 Mar 2009 13:58:55 +0900
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 12 Mar 2009 21:59:38 -0700
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
This patch fixes pt_chk_bar_overlap.

Current pt_chk_bar_overlap does not distinguish memory resources and
io resources. They are placed in different address space. So
pt_chk_bar_overlap should distinguish them.

Thanks,
--
Yuji Shimada


Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>

diff --git a/hw/pass-through.c b/hw/pass-through.c
index 487b08d..ee52960 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -1753,7 +1753,8 @@ static void pt_bar_mapping(struct pt_dev *ptdev, int 
io_enable, int mem_enable)
         PT_GET_EMUL_SIZE(base->bar_flag, r_size);
 
         /* check overlapped address */
-        ret = pt_chk_bar_overlap(dev->bus, dev->devfn, r_addr, r_size);
+        ret = pt_chk_bar_overlap(dev->bus, dev->devfn,
+                        r_addr, r_size, r->type);
         if (ret > 0)
             PT_LOG("Warning: ptdev[%02x:%02x.%x][Region:%d][Address:%08xh]"
                 "[Size:%08xh] is overlapped.\n", pci_bus_num(dev->bus),
diff --git a/hw/pci.c b/hw/pci.c
index e72c669..df75ef5 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -739,7 +739,8 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint32_t id,
     return s->bus;
 }
 
-int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr, uint32_t size)
+int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr,
+                        uint32_t size, uint8_t type)
 {
     PCIDevice *devices = NULL;
     PCIIORegion *r;
@@ -759,6 +760,17 @@ int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t 
addr, uint32_t size)
         for (j=0; j<PCI_NUM_REGIONS; j++)
         {
             r = &devices->io_regions[j];
+
+            /* skip different resource type, but don't skip when
+             * prefetch and non-prefetch memory are compared.
+             */
+            if (type != r->type)
+            {
+                if (type == PCI_ADDRESS_SPACE_IO ||
+                    r->type == PCI_ADDRESS_SPACE_IO)
+                    continue;
+            }
+
             if ((addr < (r->addr + r->size)) && ((addr + size) > r->addr))
             {
                 printf("Overlapped to device[%02x:%02x.%x][Region:%d]"
diff --git a/hw/pci.h b/hw/pci.h
index 2800499..e7fcf97 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -77,7 +77,8 @@ void pci_register_io_region(PCIDevice *pci_dev, int 
region_num,
                             uint32_t size, int type,
                             PCIMapIORegionFunc *map_func);
 
-int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr, uint32_t size);
+int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr,
+                       uint32_t size, uint8_t type);
 
 uint32_t pci_default_read_config(PCIDevice *d,
                                  uint32_t address, int len);


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] ioemu: fix pt_chk_bar_overlap, Yuji Shimada <=