Introduce the cpuid bit for the SVM vNMI feature support for the x86\AMD platforms. The feature support is indicated by the CPUID Fn8000_000A_EDX[25] = 1.
Add defines for the three SVM's Virtual NMI (vNMI) managements bits in the VMCB structure's vintr_t: vintr_t(11) - Virtual NMI is pending. vintr_t(12) - Virtual NMI is masked. vintr_t(26) - Enable NMI virtualization. Signed-off-by: Abdelkareem Abdelsaamad <[email protected]> --- xen/arch/x86/hvm/svm/svm.c | 1 + xen/arch/x86/hvm/svm/vmcb.h | 8 ++++++-- xen/arch/x86/include/asm/hvm/hvm.h | 4 +++- xen/arch/x86/include/asm/hvm/svm.h | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 18ba837738..6e380890bd 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -2533,6 +2533,7 @@ const struct hvm_function_table * __init start_svm(void) svm_function_table.caps.hap = cpu_has_svm_npt; svm_function_table.caps.hap_superpage_2mb = true; svm_function_table.caps.hap_superpage_1gb = cpu_has_page1gb; + svm_function_table.caps.vNMI = cpu_has_svm_vnmi; return &svm_function_table; } diff --git a/xen/arch/x86/hvm/svm/vmcb.h b/xen/arch/x86/hvm/svm/vmcb.h index 69f6047394..047483db9a 100644 --- a/xen/arch/x86/hvm/svm/vmcb.h +++ b/xen/arch/x86/hvm/svm/vmcb.h @@ -336,13 +336,17 @@ typedef union u64 tpr: 8; u64 irq: 1; u64 vgif: 1; - u64 rsvd0: 6; + u64 rsvd0: 1; + u64 vnmi_pending: 1; + u64 vnmi_blocking:1; + u64: 3; u64 prio: 4; u64 ign_tpr: 1; u64 rsvd1: 3; u64 intr_masking: 1; u64 vgif_enable: 1; - u64 rsvd2: 6; + u64 vnmi_enable: 1; + u64 rsvd2: 5; u64 vector: 8; u64 rsvd3: 24; } fields; diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h index 7d9774df59..ad17ea73e9 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -115,7 +115,9 @@ struct hvm_function_table { virtual_intr_delivery:1, /* Nested virt capabilities */ - nested_virt:1; + nested_virt:1, + /* virtual NMI support */ + vNMI:1; } caps; /* diff --git a/xen/arch/x86/include/asm/hvm/svm.h b/xen/arch/x86/include/asm/hvm/svm.h index 15f0268be7..a35a61273b 100644 --- a/xen/arch/x86/include/asm/hvm/svm.h +++ b/xen/arch/x86/include/asm/hvm/svm.h @@ -37,6 +37,7 @@ extern u32 svm_feature_flags; #define SVM_FEATURE_VGIF 16 /* Virtual GIF */ #define SVM_FEATURE_SSS 19 /* NPT Supervisor Shadow Stacks */ #define SVM_FEATURE_SPEC_CTRL 20 /* MSR_SPEC_CTRL virtualisation */ +#define SVM_FEATURE_VNMI 25 /* Virtual NMI */ #define SVM_FEATURE_BUS_LOCK 29 /* Bus Lock Threshold */ static inline bool cpu_has_svm_feature(unsigned int feat) @@ -57,6 +58,7 @@ static inline bool cpu_has_svm_feature(unsigned int feat) #define cpu_has_svm_vloadsave cpu_has_svm_feature(SVM_FEATURE_VLOADSAVE) #define cpu_has_svm_sss cpu_has_svm_feature(SVM_FEATURE_SSS) #define cpu_has_svm_spec_ctrl cpu_has_svm_feature(SVM_FEATURE_SPEC_CTRL) +#define cpu_has_svm_vnmi cpu_has_svm_feature(SVM_FEATURE_VNMI) #define cpu_has_svm_bus_lock cpu_has_svm_feature(SVM_FEATURE_BUS_LOCK) #define MSR_INTERCEPT_NONE 0 -- 2.52.0
