Skip to contentSkip to conversation

x86_64/efi: Use all 64 bit of efi_memmap in setup_e820()

PATCH Superseded Dmitry Skorodumov 2 participants 3 messages Jul 22, 2015 1 message not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86_64/efi: Use all 64 bit of efi_memmap in setup_e820()

The efi_info structure stores low 32 bits of memory map in efi_memmap and high 32 bits in efi_memmap_hi.

While constructing pointer in the setup_e820(), need to take into account all 64 bit of the pointer.

It is because on 64bit machine the function efi_get_memory_map() may return full 64bit pointer and before the patch that pointer was truncated.

tested in Parallles virtual machine, kernel 3.10.0

---
 arch/x86/boot/compressed/eboot.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
arch/x86/boot/compressed/eboot.c +6 -1
index 2c82bd1..908a81f 100644
@@ -1184,6 +1184,12 @@ static efi_status_t setup_e820(struct boot_params *params,
 	u32 nr_entries;
 	u32 nr_desc;
 	int i;
+	unsigned long m
+
+	m = efi->efi_memmap;
+#ifdef CONFIG_X86_64
+	m |= (u64)efi->efi_memmap_hi << 32;
+#endif
 
 	nr_entries = 0;
 	nr_desc = efi->efi_memmap_size / efi->efi_memdesc_size;
@@ -1191,7 +1197,6 @@ static efi_status_t setup_e820(struct boot_params *params,
 	for (i = 0; i < nr_desc; i++) {
 		efi_memory_desc_t *d;
 		unsigned int e820_type = 0;
-		unsigned long m = efi->efi_memmap;
 
 		d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));
 		switch (d->type) {
Signature · 1 line
1.7.9.1

A message that is not in the archive (sent off-list or not yet received): 1437577570-13038-1-git-send-email-sdmitry-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org

#2 lore raw
Quoted 23 lines · Dmitry Skorodumov

The efi_info structure stores low 32 bits of memory map in efi_memmap and high 32 bits in efi_memmap_hi.

While constructing pointer in the setup_e820(), need to take into account all 64 bit of the pointer.

It is because on 64bit machine the function efi_get_memory_map() may return full 64bit pointer and before the patch that pointer was truncated.

tested in Parallles virtual machine, kernel 3.10.0

---
 arch/x86/boot/compressed/eboot.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
arch/x86/boot/compressed/eboot.c +0 -0
index 2c82bd1..908a81f 100644

arch/x86/boot/compressed/eboot.c static efi_status_t setup_e820(struct boot_params *params, · line 1187

Quoted 4 lines
arch/x86/boot/compressed/eboot.c +1 -0
@@ -1184,6 +1184,12 @@ static efi_status_t setup_e820(struct boot_params *params,
 	u32 nr_entries;
 	u32 nr_desc;
 	int i;
+	unsigned long m

Did you even build-test it before sending?

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#3 lore raw
Quoted 3 lines · Borislav Petkov

arch/x86/boot/compressed/eboot.c static efi_status_t setup_e820(struct boot_params *params, · line 1187

Quoted 1 line
arch/x86/boot/compressed/eboot.c +1 -0
+	unsigned long m

Did you even build-test it before sending?

Sorry for inaccuracy, somehow lost the semicolon during final editing..