|
|
9ae3a8 |
From 1cf1fcaf322e07354e830f2562db856ecbb1bf4c Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <1cf1fcaf322e07354e830f2562db856ecbb1bf4c.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:45 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 22/56] pc: fix regression for 64 bit PCI memory
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1387293161-4085-23-git-send-email-mst@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56328
|
|
|
9ae3a8 |
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 22/57] pc: fix regression for 64 bit PCI memory
|
|
|
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 |
commit 398489018183d613306ab022653552247d93919f
|
|
|
9ae3a8 |
pc: limit 64 bit hole to 2G by default
|
|
|
9ae3a8 |
introduced a way for management to control
|
|
|
9ae3a8 |
the window allocated to the 64 bit PCI hole.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This is useful, but existing management tools do not know how to set
|
|
|
9ae3a8 |
this property. As a result, e.g. specifying a large ivshmem device with
|
|
|
9ae3a8 |
size > 4G is broken by default. For example this configuration no
|
|
|
9ae3a8 |
longer works:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-device ivshmem,size=4294967296,chardev=cfoo
|
|
|
9ae3a8 |
-chardev socket,path=/tmp/sock,id=cfoo,server,nowait
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Fix this by detecting that hole size was not specified
|
|
|
9ae3a8 |
and defaulting to the backwards-compatible value of 1 << 62.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: qemu-stable@nongnu.org
|
|
|
9ae3a8 |
Cc: Igor Mammedov <imammedo@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 1466cef32dd5e7ef3c6477e96d85d92302ad02e3)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
hw/pci-host/piix.c
|
|
|
9ae3a8 |
hw/pci-host/q35.c
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/hw/i386/pc.h | 11 ++++++++++-
|
|
|
9ae3a8 |
hw/pci-host/piix.c | 9 ++++++---
|
|
|
9ae3a8 |
hw/pci-host/q35.c | 8 +++++---
|
|
|
9ae3a8 |
3 files changed, 21 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/pci-host/piix.c | 9 ++++++---
|
|
|
9ae3a8 |
hw/pci-host/q35.c | 8 +++++---
|
|
|
9ae3a8 |
include/hw/i386/pc.h | 11 ++++++++++-
|
|
|
9ae3a8 |
3 files changed, 21 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
|
|
|
9ae3a8 |
index 0c26835..6502d1c 100644
|
|
|
9ae3a8 |
--- a/hw/pci-host/piix.c
|
|
|
9ae3a8 |
+++ b/hw/pci-host/piix.c
|
|
|
9ae3a8 |
@@ -319,6 +319,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
|
|
|
9ae3a8 |
PCII440FXState *f;
|
|
|
9ae3a8 |
unsigned i;
|
|
|
9ae3a8 |
I440FXState *i440fx;
|
|
|
9ae3a8 |
+ uint64_t pci_hole64_size;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
dev = qdev_create(NULL, TYPE_I440FX_PCI_HOST_BRIDGE);
|
|
|
9ae3a8 |
s = PCI_HOST_BRIDGE(dev);
|
|
|
9ae3a8 |
@@ -350,13 +351,15 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
|
|
|
9ae3a8 |
pci_hole_start, pci_hole_size);
|
|
|
9ae3a8 |
memory_region_add_subregion(f->system_memory, pci_hole_start, &f->pci_hole);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ pci_hole64_size = pci_host_get_hole64_size(i440fx->pci_hole64_size);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
pc_init_pci64_hole(&i440fx->pci_info, 0x100000000ULL + above_4g_mem_size,
|
|
|
9ae3a8 |
- i440fx->pci_hole64_size);
|
|
|
9ae3a8 |
+ pci_hole64_size);
|
|
|
9ae3a8 |
memory_region_init_alias(&f->pci_hole_64bit, "pci-hole64",
|
|
|
9ae3a8 |
f->pci_address_space,
|
|
|
9ae3a8 |
i440fx->pci_info.w64.begin,
|
|
|
9ae3a8 |
- i440fx->pci_hole64_size);
|
|
|
9ae3a8 |
- if (i440fx->pci_hole64_size) {
|
|
|
9ae3a8 |
+ pci_hole64_size);
|
|
|
9ae3a8 |
+ if (pci_hole64_size) {
|
|
|
9ae3a8 |
memory_region_add_subregion(f->system_memory,
|
|
|
9ae3a8 |
i440fx->pci_info.w64.begin,
|
|
|
9ae3a8 |
&f->pci_hole_64bit);
|
|
|
9ae3a8 |
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
|
|
|
9ae3a8 |
index 943e55f..05779b8 100644
|
|
|
9ae3a8 |
--- a/hw/pci-host/q35.c
|
|
|
9ae3a8 |
+++ b/hw/pci-host/q35.c
|
|
|
9ae3a8 |
@@ -325,6 +325,7 @@ static int mch_init(PCIDevice *d)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
MCHPCIState *mch = MCH_PCI_DEVICE(d);
|
|
|
9ae3a8 |
+ uint64_t pci_hole64_size;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* setup pci memory regions */
|
|
|
9ae3a8 |
memory_region_init_alias(&mch->pci_hole, "pci-hole",
|
|
|
9ae3a8 |
@@ -334,13 +335,14 @@ static int mch_init(PCIDevice *d)
|
|
|
9ae3a8 |
memory_region_add_subregion(mch->system_memory, mch->below_4g_mem_size,
|
|
|
9ae3a8 |
&mch->pci_hole);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ pci_hole64_size = pci_host_get_hole64_size(mch->pci_hole64_size);
|
|
|
9ae3a8 |
pc_init_pci64_hole(&mch->pci_info, 0x100000000ULL + mch->above_4g_mem_size,
|
|
|
9ae3a8 |
- mch->pci_hole64_size);
|
|
|
9ae3a8 |
+ pci_hole64_size);
|
|
|
9ae3a8 |
memory_region_init_alias(&mch->pci_hole_64bit, "pci-hole64",
|
|
|
9ae3a8 |
mch->pci_address_space,
|
|
|
9ae3a8 |
mch->pci_info.w64.begin,
|
|
|
9ae3a8 |
- mch->pci_hole64_size);
|
|
|
9ae3a8 |
- if (mch->pci_hole64_size) {
|
|
|
9ae3a8 |
+ pci_hole64_size);
|
|
|
9ae3a8 |
+ if (pci_hole64_size) {
|
|
|
9ae3a8 |
memory_region_add_subregion(mch->system_memory,
|
|
|
9ae3a8 |
mch->pci_info.w64.begin,
|
|
|
9ae3a8 |
&mch->pci_hole_64bit);
|
|
|
9ae3a8 |
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
|
|
|
9ae3a8 |
index fe21bc3..abaaf93 100644
|
|
|
9ae3a8 |
--- a/include/hw/i386/pc.h
|
|
|
9ae3a8 |
+++ b/include/hw/i386/pc.h
|
|
|
9ae3a8 |
@@ -105,7 +105,16 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
|
|
|
9ae3a8 |
#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
|
|
|
9ae3a8 |
#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end"
|
|
|
9ae3a8 |
#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size"
|
|
|
9ae3a8 |
-#define DEFAULT_PCI_HOLE64_SIZE (1ULL << 31)
|
|
|
9ae3a8 |
+#define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL)
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static inline uint64_t pci_host_get_hole64_size(uint64_t pci_hole64_size)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ if (pci_hole64_size == DEFAULT_PCI_HOLE64_SIZE) {
|
|
|
9ae3a8 |
+ return 1ULL << 62;
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ return pci_hole64_size;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void pc_init_pci64_hole(PcPciInfo *pci_info, uint64_t pci_hole64_start,
|
|
|
9ae3a8 |
uint64_t pci_hole64_size);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|