[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 15/39] pci: fix up w64 size calculation helper
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 15/39] pci: fix up w64 size calculation helper |
Date: |
Tue, 15 Oct 2013 09:31:03 +0300 |
BAR base was calculated incorrectly.
Use existing pci_bar_address to get it right.
Tested-by: Igor Mammedov <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/pci/pci.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index ae23c58..a98c8a0 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2306,7 +2306,7 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev,
void *opaque)
Range *range = opaque;
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
uint16_t cmd = pci_get_word(dev->config + PCI_COMMAND);
- int r;
+ int i;
if (!(cmd & PCI_COMMAND_MEMORY)) {
return;
@@ -2325,17 +2325,21 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev,
void *opaque)
range_extend(range, &pref_range);
}
}
- for (r = 0; r < PCI_NUM_REGIONS; ++r) {
- PCIIORegion *region = &dev->io_regions[r];
+ for (i = 0; i < PCI_NUM_REGIONS; ++i) {
+ PCIIORegion *r = &dev->io_regions[i];
Range region_range;
- if (!region->size ||
- (region->type & PCI_BASE_ADDRESS_SPACE_IO) ||
- !(region->type & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
+ if (!r->size ||
+ (r->type & PCI_BASE_ADDRESS_SPACE_IO) ||
+ !(r->type & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
+ continue;
+ }
+ region_range.begin = pci_bar_address(dev, i, r->type, r->size);
+ region_range.end = region_range.begin + r->size;
+
+ if (region_range.begin == PCI_BAR_UNMAPPED) {
continue;
}
- region_range.begin = pci_get_quad(dev->config + pci_bar(dev, r));
- region_range.end = region_range.begin + region->size;
region_range.begin = MAX(region_range.begin, 0x1ULL << 32);
--
MST
- [Qemu-devel] [PULL v2 05/39] hw/pci: add pci wrappers for allocating and asserting irqs, (continued)
- [Qemu-devel] [PULL v2 05/39] hw/pci: add pci wrappers for allocating and asserting irqs, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 06/39] hw/pci-bridge: set PCI_INTERRUPT_PIN register before shpc init, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 07/39] hw/vmxnet3: set interrupts using pci irq wrappers, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 08/39] hw/vfio: set interrupts using pci irq wrappers, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 10/39] hw/pcie: AER and hot-plug events must use device's interrupt, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 11/39] hw/pci: removed irq field from PCIDevice, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 09/39] hw: set interrupts using pci irq wrappers, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 12/39] cleanup object.h: include error.h directly, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 13/39] qom: cleanup struct Error references, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 14/39] qom: add pointer to int property helpers, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 15/39] pci: fix up w64 size calculation helper,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 16/39] fw_cfg: interface to trigger callback on read, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 17/39] loader: support for unmapped ROM blobs, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 18/39] pcie_host: expose UNMAPPED macro, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 19/39] pcie_host: expose address format, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 20/39] q35: use macro for MCFG property name, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 21/39] q35: expose mmcfg size as a property, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 23/39] acpi: add rules to compile ASL source, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 22/39] i386: add ACPI table files from seabios, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 25/39] acpi: ssdt pcihp: updat generated file, Michael S. Tsirkin, 2013/10/15
- [Qemu-devel] [PULL v2 26/39] loader: use file path size from fw_cfg.h, Michael S. Tsirkin, 2013/10/15