|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 23/28] x86/hvm: avic: enable vLAPIC mode switch hook
From: Denis Mukhin <dmukhin@xxxxxxxx>
xAVIC does not support x2APIC operation (yet).
Until x2APIC mode is supported, ensure that AVIC gets disabled
if guest OS attempts to switch vLAPIC to x2APIC mode.
Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
xen/arch/x86/hvm/svm/avic.c | 17 +++++++++++++++++
xen/arch/x86/hvm/svm/avic.h | 1 +
xen/arch/x86/hvm/svm/svm.c | 1 +
3 files changed, 19 insertions(+)
diff --git a/xen/arch/x86/hvm/svm/avic.c b/xen/arch/x86/hvm/svm/avic.c
index ca779be22eea..37a857f28d14 100644
--- a/xen/arch/x86/hvm/svm/avic.c
+++ b/xen/arch/x86/hvm/svm/avic.c
@@ -827,6 +827,23 @@ void cf_check svm_avic_hvm_dump_posted_intr(const struct
vcpu *v)
sv->avic_cnt_kick);
}
+void cf_check svm_avic_hvm_update_vlapic_mode(struct vcpu *v)
+{
+ const struct vlapic *vlapic = vcpu_vlapic(v);
+
+ if ( !svm_avic_vcpu_enabled(v) )
+ return;
+
+ if ( !vlapic_x2apic_mode(vlapic) )
+ return;
+
+ avic_domain_disable(v->domain);
+
+ gprintk(XENLOG_WARNING,
+ "%pv: AVIC: x2APIC mode is not supported; AVIC disabled\n",
+ v);
+}
+
static void avic_domain_dump_stats(struct domain *d)
{
struct vcpu *v;
diff --git a/xen/arch/x86/hvm/svm/avic.h b/xen/arch/x86/hvm/svm/avic.h
index e40aa77264ad..61bfca7a9239 100644
--- a/xen/arch/x86/hvm/svm/avic.h
+++ b/xen/arch/x86/hvm/svm/avic.h
@@ -36,5 +36,6 @@ void cf_check svm_avic_hvm_deliver_posted_intr(struct vcpu
*v, uint8_t vector);
void cf_check svm_avic_hvm_dump_posted_intr(const struct vcpu *v);
void cf_check svm_avic_hvm_debug_posted_intr(struct domain *d,
unsigned int arg);
+void cf_check svm_avic_hvm_update_vlapic_mode(struct vcpu *v);
#endif /* __SVM_AVIC_H__ */
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 667e8b05eecc..77f8278c598b 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2525,6 +2525,7 @@ static void __init svm_avic_start(void)
svm_function_table.deliver_posted_intr = svm_avic_hvm_deliver_posted_intr;
svm_function_table.dump_posted_intr = svm_avic_hvm_dump_posted_intr;
svm_function_table.debug_posted_intr = svm_avic_hvm_debug_posted_intr;
+ svm_function_table.update_vlapic_mode = svm_avic_hvm_update_vlapic_mode;
svm_function_table.caps.virtual_intr_delivery = true;
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |