From: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org, seabios@seabios.org
Cc: gleb@redhat.com, avi@redhat.com,
Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Subject: [RFC PATCH 9/9][SeaBIOS] enable memory devices if e820 entry is present
Date: Thu, 19 Apr 2012 16:08:47 +0200 [thread overview]
Message-ID: <1334844527-18869-10-git-send-email-vasilis.liaskovitis@profitbricks.com> (raw)
In-Reply-To: <1334844527-18869-1-git-send-email-vasilis.liaskovitis@profitbricks.com>
On a reboot, seabios regenerates srat/ssdt objects. If a valid e820 entry is
found spanning the whole address range of a hotplug memory device, the device
will be enabled. This ensures persistency of hotplugged memory slots across VM
reboots.
Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
---
src/acpi.c | 6 +++++-
src/memmap.c | 15 +++++++++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c
index 5580099..2ebed2e 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -601,7 +601,11 @@ build_memssdt(void)
for (i = 0; i < nb_memdevs; i++) {
mem_base = (((u64)(entry->base_addr_high) << 32 )| entry->base_addr_low);
mem_len = (((u64)(entry->length_high) << 32 )| entry->length_low);
- *(ssdt_ptr++) = 0x00;
+ if (find_e820(mem_base, mem_len, E820_RAM)) {
+ *(ssdt_ptr++) = 0x01;
+ }
+ else
+ *(ssdt_ptr++) = 0x00;
entry++;
}
build_header((void*)ssdt, SSDT_SIGNATURE, ssdt_ptr - ssdt, 1);
diff --git a/src/memmap.c b/src/memmap.c
index 56865b4..9790da1 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -131,6 +131,21 @@ add_e820(u64 start, u64 size, u32 type)
//dump_map();
}
+// Check if an e820 entry exists that covers the memory range
+// [start, start+size) with same type as type.
+int
+find_e820(u64 start, u64 size, u32 type)
+{
+ int i;
+ for (i=0; i<e820_count; i++) {
+ struct e820entry *e = &e820_list[i];
+ if ((e->start <= start) && (e->size >= (size + start - e->start)) &&
+ (e->type == type))
+ return 1;
+ }
+ return 0;
+}
+
// Report on final memory locations.
void
memmap_finalize(void)
--
1.7.9
next prev parent reply other threads:[~2012-04-19 14:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 14:08 [RFC PATCH 0/9] ACPI memory hotplug Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 1/9][SeaBIOS] Add SSDT memory device support Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 2/9][SeaBIOS] Implement acpi-dsdt functions for memory hotplug Vasilis Liaskovitis
2012-04-20 10:55 ` Igor Mammedov
2012-04-20 14:11 ` [Qemu-devel] " Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 3/9][SeaBIOS] acpi: generate hotplug memory devices Vasilis Liaskovitis
2012-04-23 23:37 ` Kevin O'Connor
2012-04-24 8:27 ` Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 4/9] Implement memslot device abstraction Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 5/9] acpi_piix4: Implement memory device hotplug registers Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 6/9] pc: pass paravirt info for hotplug memory slots to BIOS Vasilis Liaskovitis
2012-04-19 14:21 ` Avi Kivity
2012-04-20 10:33 ` Igor Mammedov
2012-04-20 16:35 ` [Qemu-devel] " Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 7/9] Implement memslot command-line option and memslot hmp command Vasilis Liaskovitis
2012-04-19 14:22 ` Avi Kivity
2012-04-19 18:10 ` Vasilis Liaskovitis
2012-04-19 14:08 ` [RFC PATCH 8/9] pc: adjust e820 map on hot-add and hot-remove Vasilis Liaskovitis
2012-04-22 13:58 ` Gleb Natapov
2012-04-23 11:27 ` Vasilis Liaskovitis
2012-04-23 11:30 ` Gleb Natapov
2012-04-19 14:08 ` Vasilis Liaskovitis [this message]
2012-04-26 0:58 ` [SeaBIOS] [RFC PATCH 9/9] enable memory devices if e820 entry is present Wen Congyang
2012-04-19 14:49 ` [Qemu-devel] [RFC PATCH 0/9] ACPI memory hotplug Anthony Liguori
2012-04-19 18:09 ` Vasilis Liaskovitis
2012-04-20 14:20 ` Vasilis Liaskovitis
2012-04-22 13:56 ` Gleb Natapov
2012-04-22 14:06 ` Avi Kivity
2012-04-22 14:09 ` Gleb Natapov
2012-04-22 14:13 ` Avi Kivity
2012-04-22 14:20 ` Gleb Natapov
2012-04-23 12:31 ` Vasilis Liaskovitis
2012-04-24 7:52 ` Gleb Natapov
2012-04-24 8:24 ` Vasilis Liaskovitis
2012-04-24 8:34 ` Gleb Natapov
2012-04-23 13:31 ` Avi Kivity
2012-04-24 7:21 ` Gleb Natapov
2012-04-24 9:09 ` Avi Kivity
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=1334844527-18869-10-git-send-email-vasilis.liaskovitis@profitbricks.com \
--to=vasilis.liaskovitis@profitbricks.com \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.