mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
x86/hyperv: Mark Hyper-V vp assist page unencrypted in SEV-SNP enlightened guest
hv vp assist page needs to be shared between SEV-SNP guest and Hyper-V. So mark the page unencrypted in the SEV-SNP guest. Reviewed-by: Dexuan Cui <decui@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Tianyu Lan <tiala@microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org> Link: https://lore.kernel.org/r/20230818102919.1318039-4-ltykernel@gmail.com
This commit is contained in:
parent
8387ce06d7
commit
b13103559d
|
|
@ -18,6 +18,7 @@
|
||||||
#include <asm/hyperv-tlfs.h>
|
#include <asm/hyperv-tlfs.h>
|
||||||
#include <asm/mshyperv.h>
|
#include <asm/mshyperv.h>
|
||||||
#include <asm/idtentry.h>
|
#include <asm/idtentry.h>
|
||||||
|
#include <asm/set_memory.h>
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
|
|
@ -106,8 +107,21 @@ static int hv_cpu_init(unsigned int cpu)
|
||||||
* in hv_cpu_die(), otherwise a CPU may not be stopped in the
|
* in hv_cpu_die(), otherwise a CPU may not be stopped in the
|
||||||
* case of CPU offlining and the VM will hang.
|
* case of CPU offlining and the VM will hang.
|
||||||
*/
|
*/
|
||||||
if (!*hvp)
|
if (!*hvp) {
|
||||||
*hvp = __vmalloc(PAGE_SIZE, GFP_KERNEL | __GFP_ZERO);
|
*hvp = __vmalloc(PAGE_SIZE, GFP_KERNEL | __GFP_ZERO);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hyper-V should never specify a VM that is a Confidential
|
||||||
|
* VM and also running in the root partition. Root partition
|
||||||
|
* is blocked to run in Confidential VM. So only decrypt assist
|
||||||
|
* page in non-root partition here.
|
||||||
|
*/
|
||||||
|
if (*hvp && hv_isolation_type_en_snp()) {
|
||||||
|
WARN_ON_ONCE(set_memory_decrypted((unsigned long)(*hvp), 1));
|
||||||
|
memset(*hvp, 0, PAGE_SIZE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (*hvp)
|
if (*hvp)
|
||||||
msr.pfn = vmalloc_to_pfn(*hvp);
|
msr.pfn = vmalloc_to_pfn(*hvp);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user