@@ -6,12 +6,14 @@
#include <uapi/asm/pvm_para.h>
#ifndef __ASSEMBLY__
+typedef void (*idtentry_t)(struct pt_regs *regs);
#ifdef CONFIG_PVM_GUEST
#include <asm/irqflags.h>
#include <uapi/asm/kvm_para.h>
void __init pvm_early_setup(void);
+void __init pvm_install_sysvec(unsigned int sysvec, idtentry_t handler);
bool __init pvm_kernel_layout_relocate(void);
static inline void pvm_cpuid(unsigned int *eax, unsigned int *ebx,
@@ -68,6 +70,10 @@ static inline void pvm_early_setup(void)
{
}
+static inline void pvm_install_sysvec(unsigned int sysvec, idtentry_t handler)
+{
+}
+
static inline bool pvm_kernel_layout_relocate(void)
{
return false;
@@ -43,6 +43,7 @@
#include <asm/reboot.h>
#include <asm/svm.h>
#include <asm/e820/api.h>
+#include <asm/pvm_para.h>
DEFINE_STATIC_KEY_FALSE(kvm_async_pf_enabled);
@@ -843,6 +844,7 @@ static void __init kvm_guest_init(void)
if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) {
static_branch_enable(&kvm_async_pf_enabled);
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, asm_sysvec_kvm_asyncpf_interrupt);
+ pvm_install_sysvec(HYPERVISOR_CALLBACK_VECTOR, sysvec_kvm_asyncpf_interrupt);
}
#ifdef CONFIG_SMP
@@ -128,8 +128,6 @@ static noinstr void pvm_handle_INT80_compat(struct pt_regs *regs)
exc_general_protection(regs, 0);
}
-typedef void (*idtentry_t)(struct pt_regs *regs);
-
#define SYSVEC(_vector, _function) [_vector - FIRST_SYSTEM_VECTOR] = sysvec_##_function
#define pvm_handle_spurious_interrupt ((idtentry_t)(void *)spurious_interrupt)
@@ -167,6 +165,15 @@ static idtentry_t pvm_sysvec_table[NR_SYSTEM_VECTORS] __ro_after_init = {
#endif
};
+void __init pvm_install_sysvec(unsigned int sysvec, idtentry_t handler)
+{
+ if (WARN_ON_ONCE(sysvec < FIRST_SYSTEM_VECTOR))
+ return;
+ if (!WARN_ON_ONCE(pvm_sysvec_table[sysvec - FIRST_SYSTEM_VECTOR] !=
+ pvm_handle_spurious_interrupt))
+ pvm_sysvec_table[sysvec - FIRST_SYSTEM_VECTOR] = handler;
+}
+
/*
* some pointers in pvm_sysvec_table are actual spurious_interrupt() who
* expects the second argument to be the vector.