Re: [RFC PATCH v1 10/18] x86/efi: Access EFI related tables in the clear

From: Matt Fleming
Date: Mon Jun 13 2016 - 08:35:15 EST


On Mon, 13 Jun, at 01:03:22PM, Matt Fleming wrote:
>
> Would we need a new function? Couldn't we just have a new
> FIXMAP_PAGE_* constant? e.g. would something like this work?
>
> ---
>
> enum memremap_owner {
> KERNEL_DATA = 0,
> BOOT_DATA,
> };
>
> void __init *
> early_memremap(resource_size_t phys_addr, unsigned long size,
> enum memremap_owner owner)
> {
> pgprot_t prot;
>
> switch (owner) {
> case BOOT_DATA:
> prot = FIXMAP_PAGE_BOOT;
> break;
> case KERNEL_DATA: /* FALLTHROUGH */
> default:
> prot = FIXMAP_PAGE_NORMAL;
>
> }
>
> return (__force void *)__early_ioremap(phys_addr, size, prot);
> }

Although it occurs to me that if there's a trivial 1:1 mapping between
memremap_owner and FIXMAP_PAGE_* we might as well just add a new
early_memremap_boot() that uses the correct FIXMAP_PAGE_* constant,
akin to early_memremap_ro().