Re: [PATCH v8 13/40] x86/kernel: Make the bss.decrypted section shared in RMP table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/4/22 11:56 AM, Venu Busireddy wrote:
On 2021-12-10 09:43:05 -0600, Brijesh Singh wrote:
The encryption attribute for the bss.decrypted region is cleared in the
initial page table build. This is because the section contains the data
that need to be shared between the guest and the hypervisor.

When SEV-SNP is active, just clearing the encryption attribute in the
page table is not enough. The page state need to be updated in the RMP
table.

Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx>
---
  arch/x86/kernel/head64.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index fa02402dcb9b..72c5082a3ba4 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -143,7 +143,14 @@ static unsigned long sme_postprocess_startup(struct boot_params *bp, pmdval_t *p
  	if (sme_get_me_mask()) {
  		vaddr = (unsigned long)__start_bss_decrypted;
  		vaddr_end = (unsigned long)__end_bss_decrypted;
+
  		for (; vaddr < vaddr_end; vaddr += PMD_SIZE) {
+			/*
+			 * When SEV-SNP is active then transition the page to shared in the RMP
+			 * table so that it is consistent with the page table attribute change.
+			 */
+			early_snp_set_memory_shared(__pa(vaddr), __pa(vaddr), PTRS_PER_PMD);

Shouldn't the first argument be vaddr as below?


Nope, sme_postprocess_startup() is called while we are fixing the initial page table and running with identity mapping (so va == pa).

thanks

    			early_snp_set_memory_shared(vaddr, __pa(vaddr), PTRS_PER_PMD);

Venu




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux