File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 18
18
#include <asm/hyperv-tlfs.h>
19
19
#include <asm/mshyperv.h>
20
20
#include <asm/idtentry.h>
21
+ #include <asm/set_memory.h>
21
22
#include <linux/kexec.h>
22
23
#include <linux/version.h>
23
24
#include <linux/vmalloc.h>
@@ -106,8 +107,21 @@ static int hv_cpu_init(unsigned int cpu)
106
107
* in hv_cpu_die(), otherwise a CPU may not be stopped in the
107
108
* case of CPU offlining and the VM will hang.
108
109
*/
109
- if (!* hvp )
110
+ if (!* hvp ) {
110
111
* hvp = __vmalloc (PAGE_SIZE , GFP_KERNEL | __GFP_ZERO );
112
+
113
+ /*
114
+ * Hyper-V should never specify a VM that is a Confidential
115
+ * VM and also running in the root partition. Root partition
116
+ * is blocked to run in Confidential VM. So only decrypt assist
117
+ * page in non-root partition here.
118
+ */
119
+ if (* hvp && hv_isolation_type_en_snp ()) {
120
+ WARN_ON_ONCE (set_memory_decrypted ((unsigned long )(* hvp ), 1 ));
121
+ memset (* hvp , 0 , PAGE_SIZE );
122
+ }
123
+ }
124
+
111
125
if (* hvp )
112
126
msr .pfn = vmalloc_to_pfn (* hvp );
113
127
You can’t perform that action at this time.
0 commit comments