kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units
Subsystems (2)
PATCH 1/1 kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units
From: Tu Dinh <[email protected]>
mem_lower and mem_upper are measured in kilobytes.
--- kexec/arch/i386/kexec-mb2-x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kexec/arch/i386/kexec-mb2-x86.c +2 -2
@@ -256,8 +256,8 @@ static uint64_t multiboot2_make_mbi(struct kexec_info *info, char *cmdline, int tag->type =MULTIBOOT_TAG_TYPE_BASIC_MEMINFO ; tag->size =sizeof (struct multiboot_tag_basic_meminfo ); - tag->mem_lower = mem_lower; - tag->mem_upper = mem_upper; + tag->mem_lower = mem_lower >>10 ; + tag->mem_upper = mem_upper >>10 ; ptrorig +=ALIGN_UP (tag->size,MULTIBOOT_TAG_ALIGN ) /sizeof (*ptrorig); }
Signature · 7 lines
2.25.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 3 lines · On Fri, Sep 24, 2021 at 07:03:27PM +0200, [email protected] wrote:
From: Tu Dinh <[email protected]>
mem_lowerandmem_upperare measured in kilobytes.
Thanks,
I'm curious to know how the current code could have worked. Do we have some testing to verify this change?
Quoted 28 lines
--- kexec/arch/i386/kexec-mb2-x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kexec/arch/i386/kexec-mb2-x86.c +2
-2@@ -256,8 +256,8 @@ static uint64_t multiboot2_make_mbi(struct kexec_info *info, char *cmdline, int tag->type =MULTIBOOT_TAG_TYPE_BASIC_MEMINFO ; tag->size =sizeof (struct multiboot_tag_basic_meminfo ); - tag->mem_lower = mem_lower; - tag->mem_upper = mem_upper; + tag->mem_lower = mem_lower >>10 ; + tag->mem_upper = mem_upper >>10 ; ptrorig +=ALIGN_UP (tag->size,MULTIBOOT_TAG_ALIGN ) /sizeof (*ptrorig); }Signature · 7 lines
2.25.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 4 lines
Thanks,
I'm curious to know how the current code could have worked. Do we have some testing to verify this change?
Hi,
The current code is not actually used very often when loading Xen (which is one of the few things that actually support Multiboot2), as Xen uses the EBDA instead of the MB2 memory information on the MB2 boot path. However this blows up on EFI systems without CSM (as EBDA is no longer available).
I tested the loading of KVM->Xen and Xen->Xen with this patch and a patched version of Xen that trusts the MB2 information, on a laptop and a server.
The Multiboot2 documentation at
https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html#Basic-mem
ory-information also supports the change.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 13 lines · On Tue, Oct 05, 2021 at 11:13:45AM +0200, [email protected] wrote:
Quoted 4 lines
Thanks,
I'm curious to know how the current code could have worked. Do we have some testing to verify this change?
Hi,
The current code is not actually used very often when loading Xen (which is one of the few things that actually support Multiboot2), as Xen uses the EBDA instead of the MB2 memory information on the MB2 boot path. However this blows up on EFI systems without CSM (as EBDA is no longer available).
Quoted 6 lines
I tested the loading of
KVM->XenandXen->Xenwith this patch and a patched version of Xen that trusts the MB2 information, on a laptop and a server.The Multiboot2 documentation at
https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html#Basic-mem
ory-information also supports the change.
Thanks, and sorry for the delay.
Applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec