From: Marcel Apfelbaum <marcel@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcel@redhat.com, mst@redhat.com, imammedo@redhat.com,
lersek@redhat.com, ehabkost@redhat.com
Subject: [Qemu-devel] [PATCH 2/4] pci: reserve 64 bit MMIO range for PCI hotplug
Date: Mon, 2 May 2016 18:37:10 +0300 [thread overview]
Message-ID: <1462203432-18100-3-git-send-email-marcel@redhat.com> (raw)
In-Reply-To: <1462203432-18100-1-git-send-email-marcel@redhat.com>
Using the firmware assigned MMIO ranges for 64-bit PCI window
leads to zero space for hot-plugging PCI devices over 4G.
PC machines can use the whole CPU addressable range after
the space reserved for memory-hotplug.
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
hw/pci/pci.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index bb605ef..44dd949 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -41,6 +41,7 @@
#include "hw/hotplug.h"
#include "hw/boards.h"
#include "qemu/cutils.h"
+#include "hw/i386/pc.h"
//#define DEBUG_PCI
#ifdef DEBUG_PCI
@@ -2467,8 +2468,19 @@ static void pci_dev_get_w64(PCIBus *b, PCIDevice *dev, void *opaque)
void pci_bus_get_w64_range(PCIBus *bus, Range *range)
{
- range->begin = range->end = 0;
- pci_for_each_device_under_bus(bus, pci_dev_get_w64, range);
+ Object *machine = qdev_get_machine();
+ if (object_dynamic_cast(machine, TYPE_PC_MACHINE)) {
+ PCMachineState *pcms = PC_MACHINE(machine);
+ range->begin = pc_machine_get_reserved_memory_end(pcms);
+ if (!range->begin) {
+ range->begin = ROUND_UP(0x100000000ULL + pcms->above_4g_mem_size,
+ 1ULL << 30);
+ }
+ range->end = 1ULL << 40; /* 40 bits physical */
+ } else {
+ range->begin = range->end = 0;
+ pci_for_each_device_under_bus(bus, pci_dev_get_w64, range);
+ }
}
static bool pcie_has_upstream_port(PCIDevice *dev)
--
2.4.3
next prev parent reply other threads:[~2016-05-02 15:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 15:37 [Qemu-devel] [PATCH 0/4] pci: better support for 64-bit MMIO allocation Marcel Apfelbaum
2016-05-02 15:37 ` [Qemu-devel] [PATCH 1/4] hw/pc: extract reserved memory end computation to a standalone function Marcel Apfelbaum
2016-05-02 15:37 ` Marcel Apfelbaum [this message]
2016-05-02 15:37 ` [Qemu-devel] [PATCH 3/4] acpi: refactor pxb crs computation Marcel Apfelbaum
2016-05-02 15:37 ` [Qemu-devel] [PATCH 4/4] hw/apci: handle 64-bit MMIO regions correctly Marcel Apfelbaum
2016-05-09 16:54 ` Laszlo Ersek
2016-05-09 17:49 ` Marcel Apfelbaum
2016-05-09 16:50 ` [Qemu-devel] [PATCH 0/4] pci: better support for 64-bit MMIO allocation Laszlo Ersek
2016-05-09 18:16 ` Marcel Apfelbaum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462203432-18100-3-git-send-email-marcel@redhat.com \
--to=marcel@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).