x86/mm: Add support to access boot related data in the clear
Boot data (such as EFI related data) is not encrypted when the system is booted because UEFI/BIOS does not run with SME active. In order to access this data properly it needs to be mapped decrypted. Update early_memremap() to provide an arch specific routine to modify the pagetable protection attributes before they are applied to the new mapping. This is used to remove the encryption mask for boot related data. Update memremap() to provide an arch specific routine to determine if RAM remapping is allowed. RAM remapping will cause an encrypted mapping to be generated. By preventing RAM remapping, ioremap_cache() will be used instead, which will provide a decrypted mapping of the boot related data. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk> Reviewed-by: Borislav Petkov <bp@suse.de> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Dave Young <dyoung@redhat.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Larry Woodman <lwoodman@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Radim Krčmář <rkrcmar@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Toshimitsu Kani <toshi.kani@hpe.com> Cc: kasan-dev@googlegroups.com Cc: kvm@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/81fb6b4117a5df6b9f2eda342f81bbef4b23d2e5.1500319216.git.thomas.lendacky@amd.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
38eecccdf4
commit
8f716c9b5f
@@ -30,6 +30,13 @@ early_param("early_ioremap_debug", early_ioremap_debug_setup);
|
||||
|
||||
static int after_paging_init __initdata;
|
||||
|
||||
pgprot_t __init __weak early_memremap_pgprot_adjust(resource_size_t phys_addr,
|
||||
unsigned long size,
|
||||
pgprot_t prot)
|
||||
{
|
||||
return prot;
|
||||
}
|
||||
|
||||
void __init __weak early_ioremap_shutdown(void)
|
||||
{
|
||||
}
|
||||
@@ -215,14 +222,19 @@ early_ioremap(resource_size_t phys_addr, unsigned long size)
|
||||
void __init *
|
||||
early_memremap(resource_size_t phys_addr, unsigned long size)
|
||||
{
|
||||
return (__force void *)__early_ioremap(phys_addr, size,
|
||||
FIXMAP_PAGE_NORMAL);
|
||||
pgprot_t prot = early_memremap_pgprot_adjust(phys_addr, size,
|
||||
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)
|
||||
{
|
||||
return (__force void *)__early_ioremap(phys_addr, size, FIXMAP_PAGE_RO);
|
||||
pgprot_t prot = early_memremap_pgprot_adjust(phys_addr, size,
|
||||
FIXMAP_PAGE_RO);
|
||||
|
||||
return (__force void *)__early_ioremap(phys_addr, size, prot);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user