All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>, xen-devel@lists.xen.org
Cc: Keir Fraser <keir@xen.org>, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH 1/2] x86/efi: Reserve SMBIOS table region when EFI booting
Date: Thu, 2 Apr 2015 10:43:48 +0100	[thread overview]
Message-ID: <551D0F54.7090806@citrix.com> (raw)
In-Reply-To: <1427963042-2278-1-git-send-email-ross.lagerwall@citrix.com>

On 02/04/15 09:24, Ross Lagerwall wrote:
> Some EFI firmware implementations may place the SMBIOS table in RAM
> marked as BootServicesData, which Xen does not consider as reserved.
> When dom0 tries to access the SMBIOS, the region is not contained in the
> initial P2M and it crashes with a page fault. To fix this, reserve the
> SMBIOS region.
>
> Also, fix the memcmp check for existence of the SMBIOS and the DMI
> checksum calculation.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

(Personally, I would either have folded the two patches together, or put
the memcmp() one first, fixing both occurrences.  However, as both of
these are candidates for backports, this probably turns more into a
bikeshed activity.)

> ---
>  xen/arch/x86/dmi_scan.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
> index 187c01e..ec411e6 100644
> --- a/xen/arch/x86/dmi_scan.c
> +++ b/xen/arch/x86/dmi_scan.c
> @@ -189,6 +189,8 @@ static inline bool_t __init dmi_checksum(const void __iomem *buf,
>  
>  static u32 __initdata efi_dmi_address;
>  static u32 __initdata efi_dmi_size;
> +static u32 __initdata efi_smbios_address;
> +static u32 __initdata efi_smbios_size;
>  static u64 __initdata efi_smbios3_address;
>  static u32 __initdata efi_smbios3_size;
>  
> @@ -209,13 +211,18 @@ void __init dmi_efi_get_table(const void *smbios, const void *smbios3)
>  		return;
>  	}
>  
> -	if (eps && memcmp(eps->anchor, "_SM_", 4) &&
> +	if (eps && memcmp(eps->anchor, "_SM_", 4) == 0 &&
>  	    eps->length >= sizeof(*eps) &&
> -	    dmi_checksum(eps, eps->length) &&
> -	    memcmp(eps->dmi.anchor, "_DMI_", 5) == 0 &&
> -	    dmi_checksum(&eps->dmi, sizeof(eps->dmi))) {
> -		efi_dmi_address = eps->dmi.address;
> -		efi_dmi_size = eps->dmi.size;
> +	    dmi_checksum(eps, eps->length)) {
> +		efi_smbios_address = (u32)(long)smbios;
> +		efi_smbios_size = eps->length;
> +
> +		if ( memcmp(eps->dmi.anchor, "_DMI_", 5) == 0 &&
> +		     dmi_checksum(&eps->dmi,
> +				  eps->length - offsetof(struct smbios_eps, dmi)) ) {
> +			efi_dmi_address = eps->dmi.address;
> +			efi_dmi_size = eps->dmi.size;
> +		}
>  	}
>  }
>  
> @@ -236,6 +243,12 @@ const char *__init dmi_get_table(paddr_t *base, u32 *len)
>  			instance |= 2;
>  			return "DMI";
>  		}
> +		if (efi_smbios_size && !(instance & 4)) {
> +			*base = efi_smbios_address;
> +			*len = efi_smbios_size;
> +			instance |= 4;
> +			return "SMBIOS";
> +		}
>  	} else {
>  		char __iomem *p = maddr_to_virt(0xF0000), *q;
>  		union {

  parent reply	other threads:[~2015-04-02  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02  8:24 [PATCH 1/2] x86/efi: Reserve SMBIOS table region when EFI booting Ross Lagerwall
2015-04-02  8:24 ` [PATCH 2/2] x86/efi: Fix memcmp check Ross Lagerwall
2015-04-02  9:36   ` Andrew Cooper
2015-04-02  9:43 ` Andrew Cooper [this message]
2015-04-13 14:40 ` [PATCH 1/2] x86/efi: Reserve SMBIOS table region when EFI booting Jan Beulich

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=551D0F54.7090806@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=ross.lagerwall@citrix.com \
    --cc=xen-devel@lists.xen.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.