public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, jon@solid-run.com
Subject: Re: [edk2-devel] Conflicting virtual addresses causing Runtime Services issues
Date: Wed, 10 Mar 2021 15:52:12 +0100	[thread overview]
Message-ID: <5363bdf0-afac-73bf-d001-77949916f511@redhat.com> (raw)
In-Reply-To: <CABdtJHvjZwqzQvcZJsF4w==6NW6m_vtM8sDpz=C9M=HC-CokoA@mail.gmail.com>

On 03/10/21 09:04, Jon Nettleton wrote:
> I am debugging a failure that I am seeing while using the HoneyComb's
> spi-nor flash for runtime variable storage.  I am hoping someone on
> the list can give me some insight as what may be the problem.
> 
> The problem showed up when we switched the MMIO region for the fspi
> flash device to be marked as non executable.  reading variables is
> fine, however writes began throwing an error.
> 
> [  556.709828] Unable to handle kernel execute from non-executable
> memory at virtual address 00000000206a3968
> 
> I have patched the kernel and removed the X86 requirement and enabled
> the sysfs runtime mappings kernel config so I can get an easy view of
> the mappings the kernel carries for runtime services.  I then track
> that virtual address to the MMIO region of nor flash, which makes
> sense that region is marked as non executable.  The question is why is
> code being executed from this address range
> 
> attribute
> ::::::::::::::
> 0x8000000000000001
> ::::::::::::::
> num_pages
> ::::::::::::::
> 0x40
> ::::::::::::::
> phys_addr
> ::::::::::::::
> 0x20500000
> ::::::::::::::
> type
> ::::::::::::::
> 0xb
> ::::::::::::::
> virt_addr
> ::::::::::::::
> 0x20680000
> 
> So then I patched the PL011 serial driver to be able to log to the
> console in runtime and I track down the access to Status =
> Fvb->GetPhysicalAddress(Fvb, &FvVolHdr); in UpdateVariableStore().
> What I don't understand is why EfiConvertPointer is mapping that
> pointer into the Virtual address space occupied by the runtime mmio of
> the flash.  The pointer is being properly remapped.  Here are the
> pointer addresses in EFI and Kernel Runtime
> 
> EFI:
> UpdateVariableStore:156 ECE33968
> FvbGetPhysicalAddress(BaseAddress=0x20000000)
> 
> KERNEL:
> UpdateVariableStore:156 206A3968
> [  556.709828] Unable to handle kernel execute from non-executable
> memory at virtual address 00000000206a3968
> 
> Any insight that anyone could provide would be much appreciated.

Your platform appears misconfigured -- the flash MMIO range appears to
overlap runtime services code even before SetVirtualAddressMap. The
virtual address conflict is likely the result of the original physical
address conflict.

After the virtual address updates, the EfiMemoryMappedIO (0xb) type
range is mapped at virtual address range [0x20680000, 0x206C0000). The
GetPhysicalAddress function seems to be located at offset 0x23968 in
that range (with 0x1C698 bytes to go in the range). That's inexplicable.

What is the physical base address of the flash? What are the PCDs used
in "ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c"?

Laszlo


  reply	other threads:[~2021-03-10 14:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  8:04 Conflicting virtual addresses causing Runtime Services issues Jon Nettleton
2021-03-10 14:52 ` Laszlo Ersek [this message]
2021-03-11  6:53   ` [edk2-devel] " Jon Nettleton
     [not found]   ` <166B374585A9D8FC.18699@groups.io>
2021-03-11  9:48     ` Jon Nettleton
2021-03-11 14:50       ` Laszlo Ersek
2021-03-11 15:49         ` Jon Nettleton
2021-03-11 22:25         ` Laszlo Ersek
2021-03-11 22:39           ` Ard Biesheuvel
2021-03-12  3:01             ` Jon Nettleton
     [not found]             ` <166B792D1514133B.31346@groups.io>
2021-03-12  5:59               ` Jon Nettleton
2021-03-12 19:30                 ` Laszlo Ersek
2021-03-12 19:52                 ` Ard Biesheuvel
2021-03-12 19:17             ` Laszlo Ersek

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-list 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=5363bdf0-afac-73bf-d001-77949916f511@redhat.com \
    --to=devel@edk2.groups.io \
    /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