Commit f90a5770 authored by Xin Jiang's avatar Xin Jiang Committed by hanliyang
Browse files

x86/kernel: Set bss decrypted memory as shared in CSV3 guest

hygon inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAYGKY


CVE: NA

---------------------------

Guest kernel declares bss decrypted memory section to share data with
host. In CSV3 guest, the decrypted memory must be set as shared.

Signed-off-by: default avatarXin Jiang <jiangxin@hygon.cn>
Signed-off-by: default avatarhanliyang <hanliyang@hygon.cn>
parent ce19f236
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include <asm/sev.h>
#include <asm/tdx.h>
#include <asm/init.h>
#include <asm/csv.h>

/*
 * Manage page tables very early on.
@@ -160,6 +161,14 @@ static unsigned long __head sme_postprocess_startup(struct boot_params *bp, pmdv
			i = pmd_index(vaddr);
			pmd[i] -= sme_get_me_mask();
		}

		/* On CSV3, move the shared pages out of isolated memory region. */
		if (csv3_active()) {
			vaddr = (unsigned long)__start_bss_decrypted;
			csv_early_reset_memory(bp);
			csv_early_update_memory_dec((unsigned long)vaddr,
						    (vaddr_end - vaddr) >> PAGE_SHIFT);
		}
	}

	/*