Lines Matching refs:vmsa
263 static int snp_set_vmsa(void *va, bool vmsa) in snp_set_vmsa() argument
275 if (vmsa) in snp_set_vmsa()
281 static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa) in snp_cleanup_vmsa() argument
285 err = snp_set_vmsa(vmsa, false); in snp_cleanup_vmsa()
289 free_page((unsigned long)vmsa); in snp_cleanup_vmsa()
294 struct sev_es_save_area *vmsa = (struct sev_es_save_area *) in hv_snp_boot_ap() local
302 if (!vmsa) in hv_snp_boot_ap()
307 vmsa->gdtr.base = gdtr.address; in hv_snp_boot_ap()
308 vmsa->gdtr.limit = gdtr.size; in hv_snp_boot_ap()
310 asm volatile("movl %%es, %%eax;" : "=a" (vmsa->es.selector)); in hv_snp_boot_ap()
311 hv_populate_vmcb_seg(vmsa->es, vmsa->gdtr.base); in hv_snp_boot_ap()
313 asm volatile("movl %%cs, %%eax;" : "=a" (vmsa->cs.selector)); in hv_snp_boot_ap()
314 hv_populate_vmcb_seg(vmsa->cs, vmsa->gdtr.base); in hv_snp_boot_ap()
316 asm volatile("movl %%ss, %%eax;" : "=a" (vmsa->ss.selector)); in hv_snp_boot_ap()
317 hv_populate_vmcb_seg(vmsa->ss, vmsa->gdtr.base); in hv_snp_boot_ap()
319 asm volatile("movl %%ds, %%eax;" : "=a" (vmsa->ds.selector)); in hv_snp_boot_ap()
320 hv_populate_vmcb_seg(vmsa->ds, vmsa->gdtr.base); in hv_snp_boot_ap()
322 vmsa->efer = native_read_msr(MSR_EFER); in hv_snp_boot_ap()
324 vmsa->cr4 = native_read_cr4(); in hv_snp_boot_ap()
325 vmsa->cr3 = __native_read_cr3(); in hv_snp_boot_ap()
326 vmsa->cr0 = native_read_cr0(); in hv_snp_boot_ap()
328 vmsa->xcr0 = 1; in hv_snp_boot_ap()
329 vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT; in hv_snp_boot_ap()
330 vmsa->rip = (u64)secondary_startup_64_no_verify; in hv_snp_boot_ap()
331 vmsa->rsp = (u64)&ap_start_stack[PAGE_SIZE]; in hv_snp_boot_ap()
338 vmsa->vmpl = 0; in hv_snp_boot_ap()
339 vmsa->sev_features = sev_status >> 2; in hv_snp_boot_ap()
341 ret = snp_set_vmsa(vmsa, true); in hv_snp_boot_ap()
343 pr_err("RMPADJUST(%llx) failed: %llx\n", (u64)vmsa, ret); in hv_snp_boot_ap()
344 free_page((u64)vmsa); in hv_snp_boot_ap()
354 *(u64 *)&start_vp_input->vp_context = __pa(vmsa) | 1; in hv_snp_boot_ap()
365 snp_cleanup_vmsa(vmsa); in hv_snp_boot_ap()
366 vmsa = NULL; in hv_snp_boot_ap()
375 per_cpu(hv_sev_vmsa, cpu) = vmsa; in hv_snp_boot_ap()