|
|
9ae3a8 |
From 2059082c26d40f083807ae81476fedd0c22c613f Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <2059082c26d40f083807ae81476fedd0c22c613f.1387298827.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 17 Dec 2013 15:17:08 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 08/56] pci: fix up w64 size calculation helper
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1387293161-4085-9-git-send-email-mst@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56313
|
|
|
9ae3a8 |
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 08/57] pci: fix up w64 size calculation helper
|
|
|
9ae3a8 |
Bugzilla: 1034876
|
|
|
9ae3a8 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BAR base was calculated incorrectly.
|
|
|
9ae3a8 |
Use existing pci_bar_address to get it right.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Tested-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 77d6f4ea7608fe7f47c9d7beddd19191b2e852b2)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/pci/pci.c | 20 ++++++++++++--------
|
|
|
9ae3a8 |
1 file changed, 12 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/pci/pci.c | 20 ++++++++++++--------
|
|
|
9ae3a8 |
1 file changed, 12 insertions(+), 8 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
|
|
|
9ae3a8 |
index d550851..598d288 100644
|
|
|
9ae3a8 |
--- a/hw/pci/pci.c
|
|
|
9ae3a8 |
+++ b/hw/pci/pci.c
|
|
|
9ae3a8 |
@@ -2249,7 +2249,7 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
|
|
|
9ae3a8 |
Range *range = opaque;
|
|
|
9ae3a8 |
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
|
|
|
9ae3a8 |
uint16_t cmd = pci_get_word(dev->config + PCI_COMMAND);
|
|
|
9ae3a8 |
- int r;
|
|
|
9ae3a8 |
+ int i;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!(cmd & PCI_COMMAND_MEMORY)) {
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
@@ -2268,17 +2268,21 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
|
|
|
9ae3a8 |
range_extend(range, &pref_range);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- for (r = 0; r < PCI_NUM_REGIONS; ++r) {
|
|
|
9ae3a8 |
- PCIIORegion *region = &dev->io_regions[r];
|
|
|
9ae3a8 |
+ for (i = 0; i < PCI_NUM_REGIONS; ++i) {
|
|
|
9ae3a8 |
+ PCIIORegion *r = &dev->io_regions[i];
|
|
|
9ae3a8 |
Range region_range;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (!region->size ||
|
|
|
9ae3a8 |
- (region->type & PCI_BASE_ADDRESS_SPACE_IO) ||
|
|
|
9ae3a8 |
- !(region->type & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
|
|
|
9ae3a8 |
+ if (!r->size ||
|
|
|
9ae3a8 |
+ (r->type & PCI_BASE_ADDRESS_SPACE_IO) ||
|
|
|
9ae3a8 |
+ !(r->type & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
|
|
|
9ae3a8 |
+ continue;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ region_range.begin = pci_bar_address(dev, i, r->type, r->size);
|
|
|
9ae3a8 |
+ region_range.end = region_range.begin + r->size;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (region_range.begin == PCI_BAR_UNMAPPED) {
|
|
|
9ae3a8 |
continue;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- region_range.begin = pci_get_quad(dev->config + pci_bar(dev, r));
|
|
|
9ae3a8 |
- region_range.end = region_range.begin + region->size;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
region_range.begin = MAX(region_range.begin, 0x1ULL << 32);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|