From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, afaerber@suse.de, aliguori@amazon.com,
mst@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] pc: add 'etc/pcimem64-minimum-address' fw_cfg interface to SeaBIOS
Date: Tue, 29 Oct 2013 13:57:35 +0100 [thread overview]
Message-ID: <1383051455-28188-3-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1383051455-28188-1-git-send-email-imammedo@redhat.com>
'etc/pcimem64-minimum-address' will allow QEMU to tell BIOS
where PCI memory address space mapping could start in high memory.
Allowing BIOS to start mapping 64-bit PCI BARs at address where it
wouldn't conflict with other mappings QEMU might place before it.
That permits QEMU to reserve extra address space before
64-bit PCI hole for memory hotplug.
Related SeaBIOS patch: http://patchwork.ozlabs.org/patch/283623/
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
hw/i386/pc.c | 14 +++++++++++++-
hw/pci-host/piix.c | 3 ++-
hw/pci-host/q35.c | 3 ++-
include/hw/i386/pc.h | 3 ++-
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 340c696..53d07a4 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1055,11 +1055,23 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
/* setup pci memory address space mapping into system address space */
void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
- MemoryRegion *pci_address_space)
+ MemoryRegion *pci_address_space,
+ uint64_t pcimem64_min_addr)
{
+ uint64_t *val;
+ FWCfgState *fw_cfg = fw_cfg_find();
+
/* Set to lower priority than RAM */
memory_region_add_subregion_overlap(system_memory, 0x0,
pci_address_space, -1);
+ g_assert(fw_cfg);
+ /*
+ * Align address at 1G, this makes sure it can be exactly covered
+ * with a PAT entry even when using huge pages.
+ */
+ val = g_malloc(sizeof(*val));
+ *val = cpu_to_le64(ROUND_UP(pcimem64_min_addr, 0x1ULL << 30));
+ fw_cfg_add_file(fw_cfg, "etc/pcimem64-minimum-address", val, sizeof(*val));
}
void pc_acpi_init(const char *default_dsdt)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index d34d20b..fcebe9a 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -351,7 +351,8 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state,
/* setup pci memory mapping */
pc_pci_as_mapping_init(OBJECT(f), f->system_memory,
- f->pci_address_space);
+ f->pci_address_space,
+ 0x100000000ULL + above_4g_mem_size);
memory_region_init_alias(&f->smram_region, OBJECT(d), "smram-region",
f->pci_address_space, 0xa0000, 0x20000);
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 3e82caf..0f3aabc 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -339,7 +339,8 @@ static int mch_init(PCIDevice *d)
/* setup pci memory mapping */
pc_pci_as_mapping_init(OBJECT(mch), mch->system_memory,
- mch->pci_address_space);
+ mch->pci_address_space,
+ 0x100000000ULL + mch->above_4g_mem_size);
/* smram */
cpu_smm_register(&mch_set_smm, mch);
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index de5a347..9b9bcf0 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -110,7 +110,8 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
- MemoryRegion *pci_address_space);
+ MemoryRegion *pci_address_space,
+ uint64_t pcimem64_min_addr);
FWCfgState *pc_memory_init(MemoryRegion *system_memory,
const char *kernel_filename,
--
1.7.1
next prev parent reply other threads:[~2013-10-29 12:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 12:57 [Qemu-devel] [PATCH 0/2 v2] pc: inform SeaBIOS where 64-bit PCI hole begins Igor Mammedov
2013-10-29 12:57 ` [Qemu-devel] [PATCH 1/2] pc: map PCI address space as catchall region for not mapped addresses Igor Mammedov
2013-10-29 12:57 ` Igor Mammedov [this message]
2013-10-29 15:10 ` [Qemu-devel] [PATCH 0/2 v2] pc: inform SeaBIOS where 64-bit PCI hole begins Michael S. Tsirkin
2013-10-29 15:28 ` Igor Mammedov
2013-10-29 18:52 ` Michael S. Tsirkin
2013-10-30 12:57 ` Gerd Hoffmann
2013-10-30 13:24 ` Igor Mammedov
2013-10-30 13:48 ` Michael S. Tsirkin
2013-10-30 14:33 ` Gerd Hoffmann
2013-10-30 15:38 ` Igor Mammedov
2013-11-04 12:48 ` Gerd Hoffmann
2013-11-04 14:35 ` Igor Mammedov
2013-11-04 15:18 ` Gerd Hoffmann
2013-10-30 13:29 ` Igor Mammedov
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=1383051455-28188-3-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=mst@redhat.com \
--cc=pbonzini@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).