All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units
@ 2021-09-24 17:03 dinhngoc.tu
  2021-10-05  8:18 ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: dinhngoc.tu @ 2021-09-24 17:03 UTC (permalink / raw)
  To: kexec; +Cc: Tu Dinh

From: Tu Dinh <dinhngoc.tu@irit.fr>

mem_lower and mem_upper are measured in kilobytes.
---
 kexec/arch/i386/kexec-mb2-x86.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/i386/kexec-mb2-x86.c b/kexec/arch/i386/kexec-mb2-x86.c
index 36fef20..0d2e93b 100644
--- a/kexec/arch/i386/kexec-mb2-x86.c
+++ b/kexec/arch/i386/kexec-mb2-x86.c
@@ -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);
 	}
 
-- 
2.25.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units
  2021-09-24 17:03 [PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units dinhngoc.tu
@ 2021-10-05  8:18 ` Simon Horman
  2021-10-05  9:13   ` dinhngoc.tu
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2021-10-05  8:18 UTC (permalink / raw)
  To: dinhngoc.tu; +Cc: kexec

On Fri, Sep 24, 2021 at 07:03:27PM +0200, dinhngoc.tu@irit.fr wrote:
> From: Tu Dinh <dinhngoc.tu@irit.fr>
> 
> mem_lower and mem_upper are 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?

> ---
>  kexec/arch/i386/kexec-mb2-x86.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kexec/arch/i386/kexec-mb2-x86.c b/kexec/arch/i386/kexec-mb2-x86.c
> index 36fef20..0d2e93b 100644
> --- a/kexec/arch/i386/kexec-mb2-x86.c
> +++ b/kexec/arch/i386/kexec-mb2-x86.c
> @@ -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);
>  	}
>  
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units
  2021-10-05  8:18 ` Simon Horman
@ 2021-10-05  9:13   ` dinhngoc.tu
  2021-10-20 10:01     ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: dinhngoc.tu @ 2021-10-05  9:13 UTC (permalink / raw)
  To: 'Simon Horman'; +Cc: kexec

> 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
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units
  2021-10-05  9:13   ` dinhngoc.tu
@ 2021-10-20 10:01     ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2021-10-20 10:01 UTC (permalink / raw)
  To: dinhngoc.tu; +Cc: kexec

On Tue, Oct 05, 2021 at 11:13:45AM +0200, dinhngoc.tu@irit.fr wrote:
> > 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.

Thanks, and sorry for the delay.

Applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-20 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 17:03 [PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units dinhngoc.tu
2021-10-05  8:18 ` Simon Horman
2021-10-05  9:13   ` dinhngoc.tu
2021-10-20 10:01     ` Simon Horman

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.