From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Kevin O'Connor <kevin@koconnor.net>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
kvm@vger.kernel.org, seabios@seabios.org,
Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [PATCH] Seabios - read e820 table from qemu_cfg
Date: Tue, 26 Jan 2010 22:52:12 +0100 [thread overview]
Message-ID: <4B5F640C.2030907@redhat.com> (raw)
In-Reply-To: <20100126002447.GA8800@morn.localdomain>
[-- Attachment #1: Type: text/plain, Size: 458 bytes --]
Hi,
Based on the feedback I received over the e820 reserve patch, I have
changed it to have QEMU pass in a list of entries that can cover more
than just the TSS/EPT range. This should provide the flexibility that
people were asking for.
The Seabios portion should allow for unlimited sized tables in theory,
whereas for QEMU I have set a fixed limit for now, but it can easily
be extended.
Please let me know what you think of this version!
Cheers,
Jes
[-- Attachment #2: 0005-seabios-e820-table.patch --]
[-- Type: text/plain, Size: 3359 bytes --]
Read optional table of e820 entries from qemu_cfg
Read optional table of e820 entries through qemu_cfg, allowing QEMU to
provide the location of KVM's switch area etc. rather than rely on
hard coded values.
For now, fall back to the old hard coded values for the TSS and EPT
switch page for compatibility reasons. Compatibility code could
possibly be removed in the future.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
src/paravirt.c | 17 +++++++++++++++++
src/paravirt.h | 9 +++++++++
src/post.c | 23 +++++++++++++++++++----
3 files changed, 45 insertions(+), 4 deletions(-)
Index: seabios/src/paravirt.c
===================================================================
--- seabios.orig/src/paravirt.c
+++ seabios/src/paravirt.c
@@ -132,6 +132,23 @@ u16 qemu_cfg_smbios_entries(void)
return cnt;
}
+u32 qemu_cfg_e820_entries(void)
+{
+ u32 cnt;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&cnt, QEMU_CFG_E820_TABLE, sizeof(cnt));
+ return cnt;
+}
+
+void* qemu_cfg_e820_load_next(void *addr)
+{
+ qemu_cfg_read(addr, sizeof(struct e820_entry));
+ return addr;
+}
+
struct smbios_header {
u16 length;
u8 type;
Index: seabios/src/paravirt.h
===================================================================
--- seabios.orig/src/paravirt.h
+++ seabios/src/paravirt.h
@@ -36,6 +36,7 @@ static inline int kvm_para_available(voi
#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
#define QEMU_CFG_IRQ0_OVERRIDE (QEMU_CFG_ARCH_LOCAL + 2)
+#define QEMU_CFG_E820_TABLE (QEMU_CFG_ARCH_LOCAL + 3)
extern int qemu_cfg_present;
@@ -61,8 +62,16 @@ typedef struct QemuCfgFile {
char name[56];
} QemuCfgFile;
+struct e820_entry {
+ u64 address;
+ u64 length;
+ u32 type;
+};
+
u16 qemu_cfg_first_file(QemuCfgFile *entry);
u16 qemu_cfg_next_file(QemuCfgFile *entry);
u32 qemu_cfg_read_file(QemuCfgFile *entry, void *dst, u32 maxlen);
+u32 qemu_cfg_e820_entries(void);
+void* qemu_cfg_e820_load_next(void *addr);
#endif
Index: seabios/src/post.c
===================================================================
--- seabios.orig/src/post.c
+++ seabios/src/post.c
@@ -135,10 +135,25 @@ ram_probe(void)
, E820_RESERVED);
add_e820(BUILD_BIOS_ADDR, BUILD_BIOS_SIZE, E820_RESERVED);
- if (kvm_para_available())
- // 4 pages before the bios, 3 pages for vmx tss pages, the
- // other page for EPT real mode pagetable
- add_e820(0xfffbc000, 4*4096, E820_RESERVED);
+ if (kvm_para_available()) {
+ u32 count;
+
+ count = qemu_cfg_e820_entries();
+ if (count) {
+ struct e820_entry entry;
+ int i;
+
+ for (i = 0; i < count; i++) {
+ qemu_cfg_e820_load_next(&entry);
+ add_e820(entry.address, entry.length, entry.type);
+ }
+ } else {
+ // Backwards compatibility - provide hard coded range.
+ // 4 pages before the bios, 3 pages for vmx tss pages, the
+ // other page for EPT real mode pagetable
+ add_e820(0xfffbc000, 4*4096, E820_RESERVED);
+ }
+ }
dprintf(1, "Ram Size=0x%08x (0x%08x%08x high)\n"
, RamSize, (u32)(RamSizeOver4G >> 32), (u32)RamSizeOver4G);
next prev parent reply other threads:[~2010-01-26 21:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-25 16:46 [Qemu-devel] [PATCH] Seabios - read e820 reserve from qemu_cfg Jes Sorensen
2010-01-25 16:49 ` [Qemu-devel] [PATCH] QEMU-KVM - provide e820 reserve through qemu_cfg Jes Sorensen
2010-01-25 16:52 ` [Qemu-devel] [PATCH] QEMU " Jes Sorensen
2010-01-25 16:58 ` [Qemu-devel] " Alexander Graf
2010-01-25 17:13 ` Jes Sorensen
2010-01-25 17:28 ` Alexander Graf
2010-01-25 17:46 ` Jes Sorensen
2010-01-25 20:04 ` Alexander Graf
2010-01-25 20:14 ` Anthony Liguori
2010-01-25 21:05 ` Jes Sorensen
2010-01-25 21:08 ` Alexander Graf
2010-01-25 21:24 ` Jes Sorensen
2010-01-26 6:46 ` Gleb Natapov
2010-01-26 8:36 ` Jes Sorensen
2010-01-26 0:24 ` [Qemu-devel] Re: [PATCH] Seabios - read e820 reserve from qemu_cfg Kevin O'Connor
2010-01-26 21:52 ` Jes Sorensen [this message]
2010-01-26 21:53 ` [Qemu-devel] [PATCH] QEMU-KVM - provide e820 table via fw_cfg Jes Sorensen
2010-01-26 21:55 ` [Qemu-devel] " Alexander Graf
2010-01-28 4:39 ` [Qemu-devel] Re: [PATCH] Seabios - read e820 table from qemu_cfg Kevin O'Connor
2010-01-29 9:03 ` Jes Sorensen
2010-01-29 16:08 ` Gleb Natapov
2010-01-30 3:35 ` Kevin O'Connor
2010-02-08 10:31 ` Jes Sorensen
2010-02-14 3:16 ` Kevin O'Connor
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=4B5F640C.2030907@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=kevin@koconnor.net \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.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).