Lines Matching full:vmsa
102 * across the APs VMSA fields (TSC_SCALE and TSC_OFFSET).
1121 * If the kernel runs at VMPL0, it can change the VMSA in snp_set_vmsa()
1150 * Allocate VMSA page to work around the SNP erratum where the CPU will in snp_alloc_vmsa_page()
1152 * collides with the RMP entry of VMSA page. The recommended workaround in snp_alloc_vmsa_page()
1169 static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa, int apic_id) in snp_cleanup_vmsa() argument
1173 err = snp_set_vmsa(vmsa, NULL, apic_id, false); in snp_cleanup_vmsa()
1175 pr_err("clear VMSA page failed (%u), leaking page\n", err); in snp_cleanup_vmsa()
1177 free_page((unsigned long)vmsa); in snp_cleanup_vmsa()
1182 struct sev_es_save_area *cur_vmsa, *vmsa; in wakeup_cpu_via_vmgexit() local
1221 * A new VMSA is created each time because there is no guarantee that in wakeup_cpu_via_vmgexit()
1222 * the current VMSA is the kernels or that the vCPU is not running. If in wakeup_cpu_via_vmgexit()
1223 * an attempt was done to use the current VMSA with a running vCPU, a in wakeup_cpu_via_vmgexit()
1227 vmsa = (struct sev_es_save_area *)snp_alloc_vmsa_page(cpu); in wakeup_cpu_via_vmgexit()
1228 if (!vmsa) in wakeup_cpu_via_vmgexit()
1239 vmsa->cs.base = sipi_vector << 12; in wakeup_cpu_via_vmgexit()
1240 vmsa->cs.limit = AP_INIT_CS_LIMIT; in wakeup_cpu_via_vmgexit()
1241 vmsa->cs.attrib = INIT_CS_ATTRIBS; in wakeup_cpu_via_vmgexit()
1242 vmsa->cs.selector = sipi_vector << 8; in wakeup_cpu_via_vmgexit()
1245 vmsa->rip = start_ip & 0xfff; in wakeup_cpu_via_vmgexit()
1248 vmsa->ds.limit = AP_INIT_DS_LIMIT; in wakeup_cpu_via_vmgexit()
1249 vmsa->ds.attrib = INIT_DS_ATTRIBS; in wakeup_cpu_via_vmgexit()
1250 vmsa->es = vmsa->ds; in wakeup_cpu_via_vmgexit()
1251 vmsa->fs = vmsa->ds; in wakeup_cpu_via_vmgexit()
1252 vmsa->gs = vmsa->ds; in wakeup_cpu_via_vmgexit()
1253 vmsa->ss = vmsa->ds; in wakeup_cpu_via_vmgexit()
1255 vmsa->gdtr.limit = AP_INIT_GDTR_LIMIT; in wakeup_cpu_via_vmgexit()
1256 vmsa->ldtr.limit = AP_INIT_LDTR_LIMIT; in wakeup_cpu_via_vmgexit()
1257 vmsa->ldtr.attrib = INIT_LDTR_ATTRIBS; in wakeup_cpu_via_vmgexit()
1258 vmsa->idtr.limit = AP_INIT_IDTR_LIMIT; in wakeup_cpu_via_vmgexit()
1259 vmsa->tr.limit = AP_INIT_TR_LIMIT; in wakeup_cpu_via_vmgexit()
1260 vmsa->tr.attrib = INIT_TR_ATTRIBS; in wakeup_cpu_via_vmgexit()
1262 vmsa->cr4 = cr4; in wakeup_cpu_via_vmgexit()
1263 vmsa->cr0 = AP_INIT_CR0_DEFAULT; in wakeup_cpu_via_vmgexit()
1264 vmsa->dr7 = DR7_RESET_VALUE; in wakeup_cpu_via_vmgexit()
1265 vmsa->dr6 = AP_INIT_DR6_DEFAULT; in wakeup_cpu_via_vmgexit()
1266 vmsa->rflags = AP_INIT_RFLAGS_DEFAULT; in wakeup_cpu_via_vmgexit()
1267 vmsa->g_pat = AP_INIT_GPAT_DEFAULT; in wakeup_cpu_via_vmgexit()
1268 vmsa->xcr0 = AP_INIT_XCR0_DEFAULT; in wakeup_cpu_via_vmgexit()
1269 vmsa->mxcsr = AP_INIT_MXCSR_DEFAULT; in wakeup_cpu_via_vmgexit()
1270 vmsa->x87_ftw = AP_INIT_X87_FTW_DEFAULT; in wakeup_cpu_via_vmgexit()
1271 vmsa->x87_fcw = AP_INIT_X87_FCW_DEFAULT; in wakeup_cpu_via_vmgexit()
1274 vmsa->efer = EFER_SVME; in wakeup_cpu_via_vmgexit()
1277 * Set the SNP-specific fields for this VMSA: in wakeup_cpu_via_vmgexit()
1281 vmsa->vmpl = snp_vmpl; in wakeup_cpu_via_vmgexit()
1282 vmsa->sev_features = sev_status >> 2; in wakeup_cpu_via_vmgexit()
1286 vmsa->tsc_scale = snp_tsc_scale; in wakeup_cpu_via_vmgexit()
1287 vmsa->tsc_offset = snp_tsc_offset; in wakeup_cpu_via_vmgexit()
1290 /* Switch the page over to a VMSA page now that it is initialized */ in wakeup_cpu_via_vmgexit()
1291 ret = snp_set_vmsa(vmsa, caa, apic_id, true); in wakeup_cpu_via_vmgexit()
1293 pr_err("set VMSA page failed (%u)\n", ret); in wakeup_cpu_via_vmgexit()
1294 free_page((unsigned long)vmsa); in wakeup_cpu_via_vmgexit()
1305 ghcb_set_rax(ghcb, vmsa->sev_features); in wakeup_cpu_via_vmgexit()
1311 ghcb_set_sw_exit_info_2(ghcb, __pa(vmsa)); in wakeup_cpu_via_vmgexit()
1328 snp_cleanup_vmsa(vmsa, apic_id); in wakeup_cpu_via_vmgexit()
1329 vmsa = NULL; in wakeup_cpu_via_vmgexit()
1332 /* Free up any previous VMSA page */ in wakeup_cpu_via_vmgexit()
1336 /* Record the current VMSA page */ in wakeup_cpu_via_vmgexit()
1337 per_cpu(sev_vmsa, cpu) = vmsa; in wakeup_cpu_via_vmgexit()