Mask Expansion ROM Enable bit
PATCH 1/1 Mask Expansion ROM Enable bit
Hi,
I got the following unnecessary warning in qemu log, when I created a guest with pass-through device.
Overlapped to device[00:05.0][Region:0][Address:f2060000h][Size:
00020000h]pt_bar_mapping_one: Warning: ptdev[00:04.0][Region:6][Address:f2040001h] [Size:00020000h] is overlapped.
It is a Expansion ROM Base Address Register, so the last one bits doesn't mean the address space. If we check overlap address space of all devices, we shoud avoid the bit.
This patch masks non-address-bits of BAR.
Signed-off-by Akio Takebe <[email protected]>
Best Regards,
Akio Takebe
hw/pass-through.c +2 -1
@@ -2031,7 +2031,8 @@ static void pt_bar_mapping_one(struct pt_dev *ptdev, int bar, int io_enable,/* check overlapped address */ ret =pt_chk_bar_overlap (dev->bus, dev->devfn, - r_addr, r_size, r->type); + r_addr, r_size, r->type, bar); +if (ret >0 ) PT_LOG("Warning: ptdev[%02x:%02x.%x][Region:%d][Address:%08xh]" "[Size:%08xh] is overlapped.\n", pci_bus_num(dev->bus),
hw/pci.c +15 -2
@@ -919,13 +919,17 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,return s->bus; } +#define MEMORYSPACE_BAR_MASK 0xFFFFFC00 +#define IOSPACE_BAR_MASK 0xFFFFFFFC +#define EXPANSION_ROM_BAR_MASK 0xFFFFFFFEint pt_chk_bar_overlap (PCIBus *bus,int devfn,uint32_t addr, -uint32_t size,uint8_t type) +uint32_t size,uint8_t type,int index) {PCIDevice *devices =NULL ;PCIIORegion *r;int ret =0 ;int i, j; +uint32_t mask=0xFFFFFFFF ;/* check Overlapped to Base Address */ for (i=0 ; i<256 ; i++)
@@ -951,7 +955,16 @@ int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr,continue ; } -if ((addr < (r->addr + r->size)) && ((addr + size) > r->addr)) +if (index ==PCI_ROM_SLOT ) + mask =EXPANSION_ROM_BAR_MASK ; +else if (type ==PCI_ADDRESS_SPACE_IO ) + mask =IOSPACE_BAR_MASK ; +else if (type ==PCI_ADDRESS_SPACE_MEM || + type ==PCI_ADDRESS_SPACE_MEM_PREFETCH ) + mask =MEMORYSPACE_BAR_MASK ; + +if (((addr&mask) < (r->addr + r->size)) && + (((addr&mask) + size) > r->addr)) { printf("Overlapped to device[%02x:%02x.%x][Region:%d]" "[Address:%08xh][Size:%08xh]\n", bus->bus_num,
hw/pci.h +1 -1
@@ -225,7 +225,7 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, PCIMapIORegionFunc *map_func);int pt_chk_bar_overlap (PCIBus *bus,int devfn,uint32_t addr, -uint32_t size,uint8_t type); +uint32_t size,uint8_t type,int index);uint32_t pci_default_read_config (PCIDevice *d,uint32_t address,int len);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel