Thread (114 messages) 114 messages, 6 authors, 2022-02-09

Re: [PATCH v9 36/43] x86/compressed/64: Add identity mapping for Confidential Computing blob

From: Borislav Petkov <bp@alien8.de>
Date: 2022-02-06 19:21:19
Also in: kvm, linux-efi, lkml, platform-driver-x86
Subsystem: the rest, x86 architecture (32-bit and 64-bit) · Maintainers: Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen

On Fri, Jan 28, 2022 at 11:17:57AM -0600, Brijesh Singh wrote:
From: Michael Roth <redacted>

The run-time kernel will need to access the Confidential Computing
blob very early in boot to access the CPUID table it points to. At
that stage of boot it will be relying on the identity-mapped page table
set up by boot/compressed kernel, so make sure the blob and the CPUID
table it points to are mapped in advance.

Signed-off-by: Michael Roth <redacted>
Signed-off-by: Brijesh Singh <redacted>
---
 arch/x86/boot/compressed/ident_map_64.c |  3 ++-
 arch/x86/boot/compressed/misc.h         |  2 ++
 arch/x86/boot/compressed/sev.c          | 22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
Do this ontop:

---
diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
index faf432684870..a5a9210d73b6 100644
--- a/arch/x86/boot/compressed/sev.c
+++ b/arch/x86/boot/compressed/sev.c
@@ -500,7 +500,7 @@ bool snp_init(struct boot_params *bp)
 void sev_prep_identity_maps(unsigned long top_level_pgt)
 {
 	/*
-	 * The ConfidentialComputing blob is used very early in uncompressed
+	 * The Confidential Computing blob is used very early in uncompressed
 	 * kernel to find the in-memory cpuid table to handle cpuid
 	 * instructions. Make sure an identity-mapping exists so it can be
 	 * accessed after switchover.
@@ -509,11 +509,10 @@ void sev_prep_identity_maps(unsigned long top_level_pgt)
 		unsigned long cc_info_pa = boot_params->cc_blob_address;
 		struct cc_blob_sev_info *cc_info;
 
-		kernel_add_identity_map(cc_info_pa,
-					cc_info_pa + sizeof(*cc_info));
+		kernel_add_identity_map(cc_info_pa, cc_info_pa + sizeof(*cc_info));
+
 		cc_info = (struct cc_blob_sev_info *)cc_info_pa;
-		kernel_add_identity_map((unsigned long)cc_info->cpuid_phys,
-					(unsigned long)cc_info->cpuid_phys + cc_info->cpuid_len);
+		kernel_add_identity_map(cc_info->cpuid_phys, cc_info->cpuid_phys + cc_info->cpuid_len);
 	}
 
 	sev_verify_cbit(top_level_pgt);
-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help