#include <asm/debugreg.h>
#include <asm/kvm_para.h>
#include <asm/irq_remapping.h>
+#include <asm/nospec-branch.h>
#include <asm/virtext.h>
#include "trace.h"
local_irq_enable();
- if (ibrs_inuse && (svm->spec_ctrl != FEATURE_ENABLE_IBRS))
- wrmsrl(MSR_IA32_SPEC_CTRL, svm->spec_ctrl);
+ /* SMB: Don't care about ibrs_inuse but rely on guest value */
+ x86_spec_ctrl_set_guest(svm->spec_ctrl);
asm volatile (
"push %%" _ASM_BP "; \n\t"
#endif
);
- if (ibrs_inuse) {
- rdmsrl(MSR_IA32_SPEC_CTRL, svm->spec_ctrl);
- if (svm->spec_ctrl != FEATURE_ENABLE_IBRS)
- wrmsrl(MSR_IA32_SPEC_CTRL, FEATURE_ENABLE_IBRS);
- }
+ /* Eliminate branch target predictions from guest mode */
+ vmexit_fill_RSB();
- stuff_RSB();
+ x86_spec_ctrl_restore_host(svm->spec_ctrl);
#ifdef CONFIG_X86_64
wrmsrl(MSR_GS_BASE, svm->host.gs_base);