Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1412580

Re: [PATCH 2/3] Update uv_bios_call to use efi_call_virt_generic

From Alex Thorlton <athorlton@sgi.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] Update uv_bios_call to use efi_call_virt_generic
Date 2016-06-03 00:00 +0200
Message-ID <rFIOK-305-7@gated-at.bofh.it> (permalink)
References <rAfaF-6av-5@gated-at.bofh.it> <rAfaF-6av-3@gated-at.bofh.it> <rFGMW-1P0-29@gated-at.bofh.it> <rFIc2-2Ni-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 02, 2016 at 04:14:03PM -0500, Alex Thorlton wrote:
> On Thu, Jun 02, 2016 at 08:45:47PM +0100, Matt Fleming wrote:
> > Unless I've missed it, I didn't see an explanation in the changelog of
> > why it's OK to switch from using __va(tab->function) to tab->function
> > directly, which presumably is a physical address.
> > 
> > Was that intended?
> 
> It was intended.  The motivation is so that we can use the same
> "dereference the pointer inside the macro" stuff that we do with the
> efi.systab->runtime pointer.  IINM, the reason it works is because we do
> 
> /*
>  * Make sure the 1:1 mappings are present as a catch-all for b0rked
>  * firmware which doesn't update all internal pointers after switching
>  * to virtual mode and would otherwise crap on us.
>  */
> __map_region(md, md->phys_addr);
> 
> Inside of efi_map_region, so we know we'll have that physical address
> mapped into the EFI page table.
> 
> Upon review, I'm wondering if the correct thing to do  here is to
> update that pointer during the switch to virtual mode, to avoid the
> b0rkage mentioned in the above comment.

Realizing after I typed this that the b0rkage in question is firmware
b0rkage, so the comment there doesn't really apply to this situation.

> Either way, the straigh tab->function dereference should work while
> using the EFI page table, but I do wonder if that tab->function address
> should have been updated to the __va() version of itself before we reach
> this point.

I played with this some and it's not working the way I expected.  In
thinking about it, I believe the reason is fairly obvious.  We have
already switched to the EFI page table when we try to dereference the
pointer, so if we have some ffff88.... address, it won't be mapped
(this is somewhat related to the situation that got us here in the first
place).

I think, in order for this to work, tab->function has to be either the
physical address, or the address in the ffffffef....  range that also
gets mapped in during efi_map_region.

My brain is getting close to fried for the day, so this might be utter
nonsense, but it's sounding pretty reasonable to me right now.  We'll
see how I feel about it tomorrow :)

Let me know what you think!

- Alex

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/3] Update uv_bios_call to use efi_call_virt_generic Matt Fleming <matt@codeblueprint.co.uk> - 2016-06-02 21:50 +0200
  Re: [PATCH 2/3] Update uv_bios_call to use efi_call_virt_generic Alex Thorlton <athorlton@sgi.com> - 2016-06-02 23:20 +0200
    Re: [PATCH 2/3] Update uv_bios_call to use efi_call_virt_generic Alex Thorlton <athorlton@sgi.com> - 2016-06-03 00:00 +0200

csiph-web