|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 22/28] x86/hvm: avic: ensure SVM AVIC supports xAPIC operation only
From: Denis Mukhin <dmukhin@xxxxxxxx>
xAVIC does not support x2APIC operation (yet).
Until x2APIC mode is supported, don't advertise x2APIC to HVM
guests when SVM AVIC is enabled.
Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
xen/arch/x86/cpu-policy.c | 3 ++-
xen/arch/x86/hvm/svm/svm.c | 12 ++++++++++++
xen/arch/x86/hvm/vmx/vmx.c | 4 ++++
xen/arch/x86/include/asm/hvm/hvm.h | 15 ++++++++++++++-
4 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 48a3185eed8d..ca9b1a523570 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -764,7 +764,8 @@ static void __init calculate_hvm_max_policy(void)
* (x2)APIC isn't enabled.
*/
__set_bit(X86_FEATURE_APIC, fs);
- __set_bit(X86_FEATURE_X2APIC, fs);
+ if ( hvm_x2apic_supported() )
+ __set_bit(X86_FEATURE_X2APIC, fs);
/*
* We don't support EFER.LMSLE at all. AMD has dropped the feature from
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index f2eb01799c63..667e8b05eecc 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2478,6 +2478,10 @@ static struct hvm_function_table __initdata_cf_clobber
svm_function_table = {
.tsc_scaling = {
.max_ratio = ~TSC_RATIO_RSVD_BITS,
},
+
+ .caps = {
+ .x2apic = true,
+ },
};
static void __init print_svm_features(void)
@@ -2523,6 +2527,14 @@ static void __init svm_avic_start(void)
svm_function_table.debug_posted_intr = svm_avic_hvm_debug_posted_intr;
svm_function_table.caps.virtual_intr_delivery = true;
+
+ /*
+ * xAVIC does not support x2APIC operation.
+ *
+ * Until x2AVIC/hybrid AVIC support is implemented, don't expose
+ * x2APIC to guests when SVM AVIC is enabled.
+ */
+ svm_function_table.caps.x2apic = false;
}
const struct hvm_function_table * __init start_svm(void)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3c7374a9ff42..bad43b38efea 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2916,6 +2916,10 @@ static struct hvm_function_table __initdata_cf_clobber
vmx_function_table = {
.tsc_scaling = {
.max_ratio = VMX_TSC_MULTIPLIER_MAX,
},
+
+ .caps = {
+ .x2apic = true,
+ },
};
/* Handle VT-d posted-interrupt when VCPU is blocked. */
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h
b/xen/arch/x86/include/asm/hvm/hvm.h
index d44f136fae8f..b701fc003ced 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -119,7 +119,9 @@ struct hvm_function_table {
virtual_intr_delivery:1,
/* Nested virt capabilities */
- nested_virt:1;
+ nested_virt:1,
+
+ x2apic:1;
} caps;
/*
@@ -716,6 +718,11 @@ static inline bool hvm_nested_virt_supported(void)
return hvm_funcs.caps.nested_virt;
}
+static inline bool hvm_x2apic_supported(void)
+{
+ return hvm_funcs.caps.x2apic;
+}
+
#ifdef CONFIG_ALTP2M
/* updates the current hardware p2m */
static inline void altp2m_vcpu_update_p2m(struct vcpu *v)
@@ -905,6 +912,12 @@ static inline bool hvm_nested_virt_supported(void)
return false;
}
+static inline bool hvm_x2apic_supported(void)
+{
+ ASSERT_UNREACHABLE();
+ return false;
+}
+
static inline bool nhvm_vmcx_hap_enabled(const struct vcpu *v)
{
ASSERT_UNREACHABLE();
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |