Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/apic/savic: Do not use snp_abort()

This function is going away so replace the callsites with the equivalent
functionality. Add a new SAVIC-specific termination reason. If more
granularity is needed there, it will be revisited in the future.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>

+6 -5
+2 -2
arch/x86/coco/sev/core.c
··· 1129 1129 if (res != ES_OK) { 1130 1130 pr_err("Secure AVIC MSR (0x%llx) read returned error (%d)\n", msr, res); 1131 1131 /* MSR read failures are treated as fatal errors */ 1132 - snp_abort(); 1132 + sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SAVIC_FAIL); 1133 1133 } 1134 1134 1135 1135 __sev_put_ghcb(&state); ··· 1159 1159 if (res != ES_OK) { 1160 1160 pr_err("Secure AVIC MSR (0x%llx) write returned error (%d)\n", msr, res); 1161 1161 /* MSR writes should never fail. Any failure is fatal error for SNP guest */ 1162 - snp_abort(); 1162 + sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SAVIC_FAIL); 1163 1163 } 1164 1164 1165 1165 __sev_put_ghcb(&state);
+1
arch/x86/include/asm/sev-common.h
··· 208 208 #define GHCB_TERM_SVSM_CAA 9 /* SVSM is present but CAA is not page aligned */ 209 209 #define GHCB_TERM_SECURE_TSC 10 /* Secure TSC initialization failed */ 210 210 #define GHCB_TERM_SVSM_CA_REMAP_FAIL 11 /* SVSM is present but CA could not be remapped */ 211 + #define GHCB_TERM_SAVIC_FAIL 12 /* Secure AVIC-specific failure */ 211 212 212 213 #define GHCB_RESP_CODE(v) ((v) & GHCB_MSR_INFO_MASK) 213 214
+3 -3
arch/x86/kernel/apic/x2apic_savic.c
··· 363 363 */ 364 364 res = savic_register_gpa(gpa); 365 365 if (res != ES_OK) 366 - snp_abort(); 366 + sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SAVIC_FAIL); 367 367 368 368 native_wrmsrq(MSR_AMD64_SAVIC_CONTROL, 369 369 gpa | MSR_AMD64_SAVIC_EN | MSR_AMD64_SAVIC_ALLOWEDNMI); ··· 376 376 377 377 if (!x2apic_mode) { 378 378 pr_err("Secure AVIC enabled in non x2APIC mode\n"); 379 - snp_abort(); 379 + sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SAVIC_FAIL); 380 380 /* unreachable */ 381 381 } 382 382 383 383 savic_page = alloc_percpu(struct secure_avic_page); 384 384 if (!savic_page) 385 - snp_abort(); 385 + sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SAVIC_FAIL); 386 386 387 387 return 1; 388 388 }