Skip to content

Commit cb09ea2

Browse files
committed
x86/entry: Convert XEN hypercall vector to IDTENTRY_SYSVEC
Convert the last oldstyle defined vector to IDTENTRY_SYSVEC: - Implement the C entry point with DEFINE_IDTENTRY_SYSVEC - Emit the ASM stub with DECLARE_IDTENTRY_SYSVEC - Remove the ASM idtentries in 64-bit - Remove the BUILD_INTERRUPT entries in 32-bit - Remove the old prototypes Fixup the related XEN code by providing the primary C entry point in x86 to avoid cluttering the generic code with X86'isms. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Andy Lutomirski <luto@kernel.org> Link: https://lore.kernel.org/r/20200521202119.741950104@linutronix.de
1 parent a16be36 commit cb09ea2

6 files changed

Lines changed: 18 additions & 21 deletions

File tree

‎arch/x86/entry/entry_32.S‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,11 +1340,6 @@ SYM_FUNC_START(xen_failsafe_callback)
13401340
SYM_FUNC_END(xen_failsafe_callback)
13411341
#endif /* CONFIG_XEN_PV */
13421342

1343-
#ifdef CONFIG_XEN_PVHVM
1344-
BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
1345-
xen_evtchn_do_upcall)
1346-
#endif
1347-
13481343
SYM_CODE_START_LOCAL_NOALIGN(handle_exception)
13491344
/* the function address is in %gs's slot on the stack */
13501345
SAVE_ALL switch_stacks=1 skip_gs=1 unwind_espfix=1

‎arch/x86/entry/entry_64.S‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,6 @@ SYM_CODE_START(xen_failsafe_callback)
11111111
SYM_CODE_END(xen_failsafe_callback)
11121112
#endif /* CONFIG_XEN_PV */
11131113

1114-
#ifdef CONFIG_XEN_PVHVM
1115-
apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1116-
xen_hvm_callback_vector xen_evtchn_do_upcall
1117-
#endif
1118-
11191114
/*
11201115
* Save all registers in pt_regs, and switch gs if needed.
11211116
* Use slow, but surefire "are we in kernel?" check.

‎arch/x86/include/asm/idtentry.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_STIMER0_VECTOR, sysvec_hyperv_stimer0);
644644
DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_acrn_hv_callback);
645645
#endif
646646

647+
#ifdef CONFIG_XEN_PVHVM
648+
DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_xen_hvm_callback);
649+
#endif
650+
647651
#undef X86_TRAP_OTHER
648652

649653
#endif

‎arch/x86/xen/enlighten_hvm.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <asm/smp.h>
1414
#include <asm/reboot.h>
1515
#include <asm/setup.h>
16+
#include <asm/idtentry.h>
1617
#include <asm/hypervisor.h>
1718
#include <asm/e820/api.h>
1819
#include <asm/early_ioremap.h>
@@ -118,6 +119,17 @@ static void __init init_hvm_pv_info(void)
118119
this_cpu_write(xen_vcpu_id, smp_processor_id());
119120
}
120121

122+
DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback)
123+
{
124+
struct pt_regs *old_regs = set_irq_regs(regs);
125+
126+
inc_irq_stat(irq_hv_callback_count);
127+
128+
xen_hvm_evtchn_do_upcall();
129+
130+
set_irq_regs(old_regs);
131+
}
132+
121133
#ifdef CONFIG_KEXEC_CORE
122134
static void xen_hvm_shutdown(void)
123135
{

‎drivers/xen/events/events_base.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#ifdef CONFIG_X86
3838
#include <asm/desc.h>
3939
#include <asm/ptrace.h>
40+
#include <asm/idtentry.h>
4041
#include <asm/irq.h>
4142
#include <asm/io_apic.h>
4243
#include <asm/i8259.h>
@@ -1236,9 +1237,6 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
12361237
struct pt_regs *old_regs = set_irq_regs(regs);
12371238

12381239
irq_enter();
1239-
#ifdef CONFIG_X86
1240-
inc_irq_stat(irq_hv_callback_count);
1241-
#endif
12421240

12431241
__xen_evtchn_do_upcall();
12441242

@@ -1658,7 +1656,7 @@ static __init void xen_alloc_callback_vector(void)
16581656
return;
16591657

16601658
pr_info("Xen HVM callback vector for event delivery is enabled\n");
1661-
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, xen_hvm_callback_vector);
1659+
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, asm_sysvec_xen_hvm_callback);
16621660
}
16631661
#else
16641662
void xen_setup_callback_vector(void) {}

‎include/xen/events.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,6 @@ unsigned int irq_from_evtchn(evtchn_port_t evtchn);
9090
int irq_from_virq(unsigned int cpu, unsigned int virq);
9191
evtchn_port_t evtchn_from_irq(unsigned irq);
9292

93-
#ifdef CONFIG_XEN_PVHVM
94-
/* Xen HVM evtchn vector callback */
95-
void xen_hvm_callback_vector(void);
96-
#ifdef CONFIG_TRACING
97-
#define trace_xen_hvm_callback_vector xen_hvm_callback_vector
98-
#endif
99-
#endif
10093
int xen_set_callback_via(uint64_t via);
10194
void xen_evtchn_do_upcall(struct pt_regs *regs);
10295
void xen_hvm_evtchn_do_upcall(void);

0 commit comments

Comments
 (0)