On Aug 22, 2016 6:53 PM, "Tom Lendacky" <thomas.lendacky@xxxxxxx> wrote: > > BOOT data (such as EFI related data) is not encyrpted when the system is > booted and needs to be accessed as non-encrypted. Add support to the > early_memremap API to identify the type of data being accessed so that > the proper encryption attribute can be applied. Currently, two types > of data are defined, KERNEL_DATA and BOOT_DATA. What happens when you memremap boot services data outside of early boot? Matt just added code that does this. IMO this API is not so great. It scatters a specialized consideration all over the place. Could early_memremap not look up the PA to figure out what to do? --Andy [leaving the rest here for Matt's benefit] > unsigned long size, > + enum memremap_owner owner, > + pgprot_t prot) > +{ > + return prot; > +} > + > void __init early_ioremap_reset(void) > { > early_ioremap_shutdown(); > @@ -213,16 +221,23 @@ early_ioremap(resource_size_t phys_addr, unsigned long size) > > /* Remap memory */ > void __init * > -early_memremap(resource_size_t phys_addr, unsigned long size) > +early_memremap(resource_size_t phys_addr, unsigned long size, > + enum memremap_owner owner) > { > - return (__force void *)__early_ioremap(phys_addr, size, > - FIXMAP_PAGE_NORMAL); > + pgprot_t prot = early_memremap_pgprot_adjust(phys_addr, size, owner, > + FIXMAP_PAGE_NORMAL); > + > + return (__force void *)__early_ioremap(phys_addr, size, prot); > } > #ifdef FIXMAP_PAGE_RO > void __init * > -early_memremap_ro(resource_size_t phys_addr, unsigned long size) > +early_memremap_ro(resource_size_t phys_addr, unsigned long size, > + enum memremap_owner owner) > { > - return (__force void *)__early_ioremap(phys_addr, size, FIXMAP_PAGE_RO); > + pgprot_t prot = early_memremap_pgprot_adjust(phys_addr, size, owner, > + FIXMAP_PAGE_RO); > + > + return (__force void *)__early_ioremap(phys_addr, size, prot); > } > #endif > > @@ -236,7 +251,8 @@ early_memremap_prot(resource_size_t phys_addr, unsigned long size, > > #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) > > -void __init copy_from_early_mem(void *dest, phys_addr_t src, unsigned long size) > +void __init copy_from_early_mem(void *dest, phys_addr_t src, unsigned long size, > + enum memremap_owner owner) > { > unsigned long slop, clen; > char *p; > @@ -246,7 +262,7 @@ void __init copy_from_early_mem(void *dest, phys_addr_t src, unsigned long size) > clen = size; > if (clen > MAX_MAP_CHUNK - slop) > clen = MAX_MAP_CHUNK - slop; > - p = early_memremap(src & PAGE_MASK, clen + slop); > + p = early_memremap(src & PAGE_MASK, clen + slop, owner); > memcpy(dest, p + slop, clen); > early_memunmap(p, clen + slop); > dest += clen; > @@ -265,12 +281,14 @@ early_ioremap(resource_size_t phys_addr, unsigned long size) > > /* Remap memory */ > void __init * > -early_memremap(resource_size_t phys_addr, unsigned long size) > +early_memremap(resource_size_t phys_addr, unsigned long size, > + enum memremap_owner owner) > { > return (void *)phys_addr; > } > void __init * > -early_memremap_ro(resource_size_t phys_addr, unsigned long size) > +early_memremap_ro(resource_size_t phys_addr, unsigned long size, > + enum memremap_owner owner) > { > return (void *)phys_addr; > } > -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html