[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 9/9][SeaBIOS] enable memory devices if e820 entr
From: |
Vasilis Liaskovitis |
Subject: |
[Qemu-devel] [RFC PATCH 9/9][SeaBIOS] enable memory devices if e820 entry is present |
Date: |
Thu, 19 Apr 2012 16:08:47 +0200 |
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 <address@hidden>
---
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
- [Qemu-devel] [RFC PATCH 0/9] ACPI memory hotplug, Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 2/9][SeaBIOS] Implement acpi-dsdt functions for memory hotplug., Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 3/9][SeaBIOS] acpi: generate hotplug memory devices., Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 1/9][SeaBIOS] Add SSDT memory device support, Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 4/9] Implement memslot device abstraction, Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 5/9] acpi_piix4: Implement memory device hotplug registers, Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 9/9][SeaBIOS] enable memory devices if e820 entry is present,
Vasilis Liaskovitis <=
- [Qemu-devel] [RFC PATCH 8/9] pc: adjust e820 map on hot-add and hot-remove, Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 6/9] pc: pass paravirt info for hotplug memory slots to BIOS, Vasilis Liaskovitis, 2012/04/19
- [Qemu-devel] [RFC PATCH 7/9] Implement memslot command-line option and memslot hmp command, Vasilis Liaskovitis, 2012/04/19