Re: [PATCH] Map in physical addresses in efi_map_region_fixed

From: Dave Young
Date: Thu Aug 18 2016 - 02:11:30 EST


On 08/17/16 at 11:00am, Alex Thorlton wrote:
> On Wed, Aug 17, 2016 at 03:01:51PM +0800, Dave Young wrote:
> > > > Why do you guys need the physical mapping all of a sudden?
> > >
> > > It's not that we need it all of the sudden, necessarily, it's just that
> > > we've had to make other changes to make things work with the new,
> > > (almost) completely isolated, EFI page tables. We ended up choosing the
> > > lesser of two evils, and have decided to temporarily rely on the
> > > physical address of our runtime code, instead of continuing to rely on
> > > EFI_OLD_MEMMAP.
> >
> > In efi_map_region, there is already mapped md->phys_addr for broken
> > firmware. SGI still need EFI_OLD_MEMMAP? I means in 1st kernel instead
> > of kexec kernel.
>
> We're actually in the middle of trying to move *away* from
> EFI_OLD_MEMMAP, which is why we're just starting to uncover some of
> these things. efi_map_region covers us on the primary kernel, because
> it maps in the physical address of each md (as you note here), but that
> little piece is missing in the kexec'd kernel. So, our primary kernel
> works without efi=old_map, but the second kernel won't, without this
> change (supplying "noefi" on the kexec command line also works, but then
> we don't have any of our runtime stuff available).
>
> As noted in a previous message, we're aware that our code needs a little
> more work to be "perfect," but this small change buys us most of (all
> of?) the stuff we'd get by implementing the other changes that we're
> aware we need to make, i.e. update our runtime function pointer to its
> efi_va during SetVirtualAddressMap, at least from a kexec perspective.

Thanks for explanation, I still do not get why the original ioremap way
works if SetVirtualAddressMapdo does not update runtime function
pointer.

But if it fixes the problem in primary kernel, it should be fine to do
same in kexec kernel.

Thanks
Dave