Commit a0bb51f2 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Thomas Gleixner

x86/xen: Split HVM vector callback setup and interrupt gate allocation

As a preparatory change for making alloc_intr_gate() __init split
xen_callback_vector() into callback vector setup via hypercall
(xen_setup_callback_vector()) and interrupt gate allocation
(xen_alloc_callback_vector()).

xen_setup_callback_vector() is being called twice: on init and upon
system resume from xen_hvm_post_suspend(). alloc_intr_gate() only
needs to be called once.
Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200428093824.1451532-2-vkuznets@redhat.com
parent fbaed278
...@@ -13,6 +13,6 @@ void xen_hvm_post_suspend(int suspend_cancelled) ...@@ -13,6 +13,6 @@ void xen_hvm_post_suspend(int suspend_cancelled)
xen_hvm_init_shared_info(); xen_hvm_init_shared_info();
xen_vcpu_restore(); xen_vcpu_restore();
} }
xen_callback_vector(); xen_setup_callback_vector();
xen_unplug_emulated_devices(); xen_unplug_emulated_devices();
} }
...@@ -55,7 +55,7 @@ void xen_enable_sysenter(void); ...@@ -55,7 +55,7 @@ void xen_enable_sysenter(void);
void xen_enable_syscall(void); void xen_enable_syscall(void);
void xen_vcpu_restore(void); void xen_vcpu_restore(void);
void xen_callback_vector(void); void xen_setup_callback_vector(void);
void xen_hvm_init_shared_info(void); void xen_hvm_init_shared_info(void);
void xen_unplug_emulated_devices(void); void xen_unplug_emulated_devices(void);
......
...@@ -1639,26 +1639,30 @@ EXPORT_SYMBOL_GPL(xen_set_callback_via); ...@@ -1639,26 +1639,30 @@ EXPORT_SYMBOL_GPL(xen_set_callback_via);
/* Vector callbacks are better than PCI interrupts to receive event /* Vector callbacks are better than PCI interrupts to receive event
* channel notifications because we can receive vector callbacks on any * channel notifications because we can receive vector callbacks on any
* vcpu and we don't need PCI support or APIC interactions. */ * vcpu and we don't need PCI support or APIC interactions. */
void xen_callback_vector(void) void xen_setup_callback_vector(void)
{ {
int rc;
uint64_t callback_via; uint64_t callback_via;
if (xen_have_vector_callback) { if (xen_have_vector_callback) {
callback_via = HVM_CALLBACK_VECTOR(HYPERVISOR_CALLBACK_VECTOR); callback_via = HVM_CALLBACK_VECTOR(HYPERVISOR_CALLBACK_VECTOR);
rc = xen_set_callback_via(callback_via); if (xen_set_callback_via(callback_via)) {
if (rc) {
pr_err("Request for Xen HVM callback vector failed\n"); pr_err("Request for Xen HVM callback vector failed\n");
xen_have_vector_callback = 0; xen_have_vector_callback = 0;
return;
} }
pr_info_once("Xen HVM callback vector for event delivery is enabled\n");
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
xen_hvm_callback_vector);
} }
} }
static __init void xen_alloc_callback_vector(void)
{
if (!xen_have_vector_callback)
return;
pr_info("Xen HVM callback vector for event delivery is enabled\n");
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, xen_hvm_callback_vector);
}
#else #else
void xen_callback_vector(void) {} void xen_setup_callback_vector(void) {}
static inline void xen_alloc_callback_vector(void) {}
#endif #endif
#undef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX
...@@ -1692,8 +1696,10 @@ void __init xen_init_IRQ(void) ...@@ -1692,8 +1696,10 @@ void __init xen_init_IRQ(void)
if (xen_initial_domain()) if (xen_initial_domain())
pci_xen_initial_domain(); pci_xen_initial_domain();
} }
if (xen_feature(XENFEAT_hvm_callback_vector)) if (xen_feature(XENFEAT_hvm_callback_vector)) {
xen_callback_vector(); xen_setup_callback_vector();
xen_alloc_callback_vector();
}
if (xen_hvm_domain()) { if (xen_hvm_domain()) {
native_init_IRQ(); native_init_IRQ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment