All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Tu Dinh Ngoc <dinhngoc.tu@irit.fr>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2] x86: Use low memory size directly from Multiboot
Date: Wed, 9 Feb 2022 15:25:55 +0100	[thread overview]
Message-ID: <ad339015-c5e7-d776-17a3-2dbd337fcd4a@suse.com> (raw)
In-Reply-To: <20220209131251.387-1-dinhngoc.tu@irit.fr>

On 09.02.2022 14:12, Tu Dinh Ngoc wrote:
> Previously, Xen used information from the BDA to detect the amount of
> available low memory. This does not work on some scenarios such as
> Coreboot, or when booting from Kexec on a UEFI system without CSM.
> 
> Use the information directly supplied by Multiboot boot information
> instead.
> ---

Btw - please summarize here briefly what has changed from the earlier
version. As it stands your adjustment looks to take care of one third
of what I did say in reply to your v1. That's not enough for a v2, or
else you should have taken care of the remaining aspects verbally.

Jan

> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -524,33 +524,23 @@ trampoline_bios_setup:
>          mov     %ecx,%fs
>          mov     %ecx,%gs
>  
> -        /* Set up trampoline segment 64k below EBDA */
> -        movzwl  0x40e,%ecx          /* EBDA segment */
> -        cmp     $0xa000,%ecx        /* sanity check (high) */
> -        jae     0f
> -        cmp     $0x4000,%ecx        /* sanity check (low) */
> -        jae     1f
> -0:
> -        movzwl  0x413,%ecx          /* use base memory size on failure */
> -        shl     $10-4,%ecx
> -1:
> +        /* Use lower memory size directly from Multiboot */
> +        mov     %edx,%ecx
>          /*
> -         * Compare the value in the BDA with the information from the
> -         * multiboot structure (if available) and use the smallest.
> +         * Old Kexec used to report the value in bytes instead of kilobytes
> +         * like it's supposed to, so fix that if detected.
>           */
> -        cmp     $0x100,%edx         /* is the multiboot value too small? */
> -        jb      2f                  /* if so, do not use it */
> -        shl     $10-4,%edx
> -        cmp     %ecx,%edx           /* compare with BDA value */
> -        cmovb   %edx,%ecx           /* and use the smaller */
> +        cmpl    $640,%ecx
> +        jbe     1f
> +        shr     $10,%ecx
> +1:
> +        /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */
> +        shr     $2,%ecx
>  
> -2:
>          /* Reserve memory for the trampoline and the low-memory stack. */
> -        sub     $((TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE)>>4),%ecx
> +        sub     $((TRAMPOLINE_SPACE+TRAMPOLINE_STACK_SPACE)>>12),%ecx
>  
> -        /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */
> -        xor     %cl, %cl
> -        shl     $4, %ecx
> +        shl     $12,%ecx
>          mov     %ecx,sym_esi(trampoline_phys)
>  
>  trampoline_setup:



  reply	other threads:[~2022-02-09 14:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 11:00 [PATCH] x86: Use low memory size directly from Multiboot dinhngoc.tu
2022-02-09 11:25 ` Jan Beulich
2022-02-09 11:46   ` dinhngoc.tu
2022-02-09 13:12   ` [PATCH v2] " Tu Dinh Ngoc
2022-02-09 14:25     ` Jan Beulich [this message]
2022-02-09 15:20       ` dinhngoc.tu
2022-02-09 15:22         ` Jan Beulich
2022-02-09 15:36           ` dinhngoc.tu
2022-02-09 15:56     ` Roger Pau Monné

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=ad339015-c5e7-d776-17a3-2dbd337fcd4a@suse.com \
    --to=jbeulich@suse.com \
    --cc=dinhngoc.tu@irit.fr \
    --cc=xen-devel@lists.xenproject.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.