From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
To: Prarit Bhargava <prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Lenny Szubowicz
<lszubowi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: ESRT failures ... was Re: [PATCH 04/11] efi: Add efi_memmap_init_late() for permanent EFI memmap
Date: Thu, 21 Jul 2016 13:11:36 +0100 [thread overview]
Message-ID: <20160721121136.GF26504@codeblueprint.co.uk> (raw)
In-Reply-To: <57867F32.8040001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Wed, 13 Jul, at 01:49:38PM, Prarit Bhargava wrote:
> [I am not subscribed to linux-efi. Sorry for the bad threading. Please include
> me on the cc on any replies.]
>
> Matt, I grabbed your patches which are similar to a change that I wanted to make
> to the kernel. There is one issue though that I want to bring up.
>
> With or without your changeset, I see the following issue on Dell system with a
> valid ESRT table.
>
>
> [ 0.000000] efi: SMBIOS=0x8ce95000 ACPI=0x8d2fe000 ACPI 2.0=0x8d2fe014
> ESRT=0x8d0f5000 MPS=0x8d0dd000
> [ 0.000000] efi: requested map not found.
> [ 0.000000] esrt: ESRT header is not in the memory map.
> [ 0.000000] SMBIOS 2.8 present.
>
> This occurs AFAICT (with or without your changes) because of this check in
> efi_mem_desc_lookup():
>
> if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
> md->type != EFI_BOOT_SERVICES_DATA &&
> md->type != EFI_RUNTIME_SERVICES_DATA) {
> continue;
> }
>
> which then results in skipping the appropriate region. IIUC (and that's part of
> my question ;)) the above check means that the region has already been
> permanently mapped. That is,
No, the above check is intended to skip any regions that are not
required at runtime and so won't be found in the EFI memmap.
The question is, what does the EFI memmap descriptor look like that
describes your ESRT table?
> rc = efi_mem_desc_lookup(efi.esrt, &md);
> if (rc < 0) {
> pr_err("ESRT header is not in the memory map.\n");
> return;
> }
> ...
> va = early_memremap(efi.esrt, size);
> if (!va) {
>
> and rc is -ENOENT because a matching region couldn't be found. As can be seen
> the existing ESRT code will attempt to remap the region if not mapped.
>
> I think that perhaps the function should be changed to do
>
> for_each_efi_memory_desc(md) {
> u64 size;
> u64 end;
>
> size = md->num_pages << EFI_PAGE_SHIFT;
> end = md->phys_addr + size;
> if (phys_addr >= md->phys_addr && phys_addr < end) {
> memcpy(out_md, md, sizeof(*out_md));
>
> if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
> md->type != EFI_BOOT_SERVICES_DATA &&
> md->type != EFI_RUNTIME_SERVICES_DATA) {
> return UNMAPPED;
> }
>
> return MAPPED;
> }
> }
>
> so that individual callers (like the ESRT code) can then make a decision on
> whether or not the area needs to be mapped.
>
> Thoughts/concerns?
efi_mem_desc_lookup() should just return the correct EFI memory
descriptor now that we have efi_mem_reserve() coming in v4.9.
What does the EFI memmap (as printed with efi=debug) look like on your
machine?
next prev parent reply other threads:[~2016-07-21 12:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-13 17:49 ESRT failures ... was Re: [PATCH 04/11] efi: Add efi_memmap_init_late() for permanent EFI memmap Prarit Bhargava
[not found] ` <57867F32.8040001-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-21 12:11 ` Matt Fleming [this message]
[not found] ` <20160721121136.GF26504-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-07-21 14:44 ` Prarit Bhargava
[not found] ` <5790DFD0.4020806-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-22 13:11 ` Matt Fleming
[not found] ` <20160722131101.GJ26504-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-07-22 13:31 ` Prarit Bhargava
[not found] ` <57922028.7070103-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-25 14:44 ` Matt Fleming
[not found] ` <20160725144431.GA31759-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-07-25 15:11 ` Prarit Bhargava
[not found] ` <57962C23.5090705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-25 15:13 ` Matt Fleming
[not found] ` <20160725151344.GB31759-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-07-25 15:38 ` Prarit Bhargava
[not found] ` <57963289.2090805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-26 11:33 ` Prarit Bhargava
[not found] ` <57974AA4.7090907-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-26 14:26 ` Matt Fleming
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=20160721121136.GF26504@codeblueprint.co.uk \
--to=matt-mf/unelci9gs6ibeejttw/xrex20p6io@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lszubowi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).