Skip to content

Commit a16be36

Browse files
committed
x86/entry: Convert various hypervisor vectors to IDTENTRY_SYSVEC
Convert various hypervisor vectors 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 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> Reviewed-by: Wei Liu <wei.liu@kernel.org> Link: https://lore.kernel.org/r/20200521202119.647997594@linutronix.de
1 parent 9c3b1f4 commit a16be36

9 files changed

Lines changed: 27 additions & 98 deletions

File tree

‎arch/x86/entry/entry_32.S‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,20 +1345,6 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
13451345
xen_evtchn_do_upcall)
13461346
#endif
13471347

1348-
1349-
#if IS_ENABLED(CONFIG_HYPERV)
1350-
1351-
BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
1352-
hyperv_vector_handler)
1353-
1354-
BUILD_INTERRUPT3(hyperv_reenlightenment_vector, HYPERV_REENLIGHTENMENT_VECTOR,
1355-
hyperv_reenlightenment_intr)
1356-
1357-
BUILD_INTERRUPT3(hv_stimer0_callback_vector, HYPERV_STIMER0_VECTOR,
1358-
hv_stimer0_vector_handler)
1359-
1360-
#endif /* CONFIG_HYPERV */
1361-
13621348
SYM_CODE_START_LOCAL_NOALIGN(handle_exception)
13631349
/* the function address is in %gs's slot on the stack */
13641350
SAVE_ALL switch_stacks=1 skip_gs=1 unwind_espfix=1

‎arch/x86/entry/entry_64.S‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,23 +1116,6 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
11161116
xen_hvm_callback_vector xen_evtchn_do_upcall
11171117
#endif
11181118

1119-
1120-
#if IS_ENABLED(CONFIG_HYPERV)
1121-
apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1122-
hyperv_callback_vector hyperv_vector_handler
1123-
1124-
apicinterrupt3 HYPERV_REENLIGHTENMENT_VECTOR \
1125-
hyperv_reenlightenment_vector hyperv_reenlightenment_intr
1126-
1127-
apicinterrupt3 HYPERV_STIMER0_VECTOR \
1128-
hv_stimer0_callback_vector hv_stimer0_vector_handler
1129-
#endif /* CONFIG_HYPERV */
1130-
1131-
#if IS_ENABLED(CONFIG_ACRN_GUEST)
1132-
apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1133-
acrn_hv_callback_vector acrn_hv_vector_handler
1134-
#endif
1135-
11361119
/*
11371120
* Save all registers in pt_regs, and switch gs if needed.
11381121
* Use slow, but surefire "are we in kernel?" check.

‎arch/x86/hyperv/hv_init.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <asm/hypervisor.h>
1616
#include <asm/hyperv-tlfs.h>
1717
#include <asm/mshyperv.h>
18+
#include <asm/idtentry.h>
1819
#include <linux/version.h>
1920
#include <linux/vmalloc.h>
2021
#include <linux/mm.h>
@@ -152,15 +153,11 @@ static inline bool hv_reenlightenment_available(void)
152153
ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT;
153154
}
154155

155-
__visible void __irq_entry hyperv_reenlightenment_intr(struct pt_regs *regs)
156+
DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_reenlightenment)
156157
{
157-
entering_ack_irq();
158-
158+
ack_APIC_irq();
159159
inc_irq_stat(irq_hv_reenlightenment_count);
160-
161160
schedule_delayed_work(&hv_reenlightenment_work, HZ/10);
162-
163-
exiting_irq();
164161
}
165162

166163
void set_hv_tscchange_cb(void (*cb)(void))

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

Lines changed: 0 additions & 11 deletions
This file was deleted.

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -519,26 +519,6 @@ static inline bool apic_id_is_primary_thread(unsigned int id) { return false; }
519519
static inline void apic_smt_update(void) { }
520520
#endif
521521

522-
extern void irq_enter(void);
523-
extern void irq_exit(void);
524-
525-
static inline void entering_irq(void)
526-
{
527-
irq_enter();
528-
kvm_set_cpu_l1tf_flush_l1d();
529-
}
530-
531-
static inline void entering_ack_irq(void)
532-
{
533-
entering_irq();
534-
ack_APIC_irq();
535-
}
536-
537-
static inline void exiting_irq(void)
538-
{
539-
irq_exit();
540-
}
541-
542522
extern void ioapic_zap_locks(void);
543523

544524
#endif /* _ASM_X86_APIC_H */

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,16 @@ DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR, sysvec_kvm_posted_intr_wakeup
634634
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR, sysvec_kvm_posted_intr_nested_ipi);
635635
#endif
636636

637+
#if IS_ENABLED(CONFIG_HYPERV)
638+
DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_hyperv_callback);
639+
DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_REENLIGHTENMENT_VECTOR, sysvec_hyperv_reenlightenment);
640+
DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_STIMER0_VECTOR, sysvec_hyperv_stimer0);
641+
#endif
642+
643+
#if IS_ENABLED(CONFIG_ACRN_GUEST)
644+
DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR, sysvec_acrn_hv_callback);
645+
#endif
646+
637647
#undef X86_TRAP_OTHER
638648

639649
#endif

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,8 @@ typedef int (*hyperv_fill_flush_list_func)(
5454
vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK);
5555
#define hv_get_raw_timer() rdtsc_ordered()
5656

57-
void hyperv_callback_vector(void);
58-
void hyperv_reenlightenment_vector(void);
59-
#ifdef CONFIG_TRACING
60-
#define trace_hyperv_callback_vector hyperv_callback_vector
61-
#endif
6257
void hyperv_vector_handler(struct pt_regs *regs);
6358

64-
/*
65-
* Routines for stimer0 Direct Mode handling.
66-
* On x86/x64, there are no percpu actions to take.
67-
*/
68-
void hv_stimer0_vector_handler(struct pt_regs *regs);
69-
void hv_stimer0_callback_vector(void);
70-
7159
static inline void hv_enable_stimer0_percpu_irq(int irq) {}
7260
static inline void hv_disable_stimer0_percpu_irq(int irq) {}
7361

@@ -226,7 +214,6 @@ void hyperv_setup_mmu_ops(void);
226214
void *hv_alloc_hyperv_page(void);
227215
void *hv_alloc_hyperv_zeroed_page(void);
228216
void hv_free_hyperv_page(unsigned long addr);
229-
void hyperv_reenlightenment_intr(struct pt_regs *regs);
230217
void set_hv_tscchange_cb(void (*cb)(void));
231218
void clear_hv_tscchange_cb(void);
232219
void hyperv_stop_tsc_emulation(void);

‎arch/x86/kernel/cpu/acrn.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
*/
1111

1212
#include <linux/interrupt.h>
13-
#include <asm/acrn.h>
1413
#include <asm/apic.h>
1514
#include <asm/desc.h>
1615
#include <asm/hypervisor.h>
16+
#include <asm/idtentry.h>
1717
#include <asm/irq_regs.h>
1818

1919
static uint32_t __init acrn_detect(void)
@@ -24,7 +24,7 @@ static uint32_t __init acrn_detect(void)
2424
static void __init acrn_init_platform(void)
2525
{
2626
/* Setup the IDT for ACRN hypervisor callback */
27-
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, acrn_hv_callback_vector);
27+
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, asm_sysvec_acrn_hv_callback);
2828
}
2929

3030
static bool acrn_x2apic_available(void)
@@ -39,7 +39,7 @@ static bool acrn_x2apic_available(void)
3939

4040
static void (*acrn_intr_handler)(void);
4141

42-
__visible void __irq_entry acrn_hv_vector_handler(struct pt_regs *regs)
42+
DEFINE_IDTENTRY_SYSVEC(sysvec_acrn_hv_callback)
4343
{
4444
struct pt_regs *old_regs = set_irq_regs(regs);
4545

@@ -50,13 +50,12 @@ __visible void __irq_entry acrn_hv_vector_handler(struct pt_regs *regs)
5050
* will block the interrupt whose vector is lower than
5151
* HYPERVISOR_CALLBACK_VECTOR.
5252
*/
53-
entering_ack_irq();
53+
ack_APIC_irq();
5454
inc_irq_stat(irq_hv_callback_count);
5555

5656
if (acrn_intr_handler)
5757
acrn_intr_handler();
5858

59-
exiting_irq();
6059
set_irq_regs(old_regs);
6160
}
6261

‎arch/x86/kernel/cpu/mshyperv.c‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <asm/hyperv-tlfs.h>
2424
#include <asm/mshyperv.h>
2525
#include <asm/desc.h>
26+
#include <asm/idtentry.h>
2627
#include <asm/irq_regs.h>
2728
#include <asm/i8259.h>
2829
#include <asm/apic.h>
@@ -40,19 +41,17 @@ static void (*hv_stimer0_handler)(void);
4041
static void (*hv_kexec_handler)(void);
4142
static void (*hv_crash_handler)(struct pt_regs *regs);
4243

43-
__visible void __irq_entry hyperv_vector_handler(struct pt_regs *regs)
44+
DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback)
4445
{
4546
struct pt_regs *old_regs = set_irq_regs(regs);
4647

47-
entering_irq();
4848
inc_irq_stat(irq_hv_callback_count);
4949
if (vmbus_handler)
5050
vmbus_handler();
5151

5252
if (ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED)
5353
ack_APIC_irq();
5454

55-
exiting_irq();
5655
set_irq_regs(old_regs);
5756
}
5857

@@ -73,19 +72,16 @@ EXPORT_SYMBOL_GPL(hv_remove_vmbus_irq);
7372
* Routines to do per-architecture handling of stimer0
7473
* interrupts when in Direct Mode
7574
*/
76-
77-
__visible void __irq_entry hv_stimer0_vector_handler(struct pt_regs *regs)
75+
DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_stimer0)
7876
{
7977
struct pt_regs *old_regs = set_irq_regs(regs);
8078

81-
entering_irq();
8279
inc_irq_stat(hyperv_stimer0_count);
8380
if (hv_stimer0_handler)
8481
hv_stimer0_handler();
8582
add_interrupt_randomness(HYPERV_STIMER0_VECTOR, 0);
8683
ack_APIC_irq();
8784

88-
exiting_irq();
8985
set_irq_regs(old_regs);
9086
}
9187

@@ -331,17 +327,19 @@ static void __init ms_hyperv_init_platform(void)
331327
x86_platform.apic_post_init = hyperv_init;
332328
hyperv_setup_mmu_ops();
333329
/* Setup the IDT for hypervisor callback */
334-
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
330+
alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, asm_sysvec_hyperv_callback);
335331

336332
/* Setup the IDT for reenlightenment notifications */
337-
if (ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT)
333+
if (ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT) {
338334
alloc_intr_gate(HYPERV_REENLIGHTENMENT_VECTOR,
339-
hyperv_reenlightenment_vector);
335+
asm_sysvec_hyperv_reenlightenment);
336+
}
340337

341338
/* Setup the IDT for stimer0 */
342-
if (ms_hyperv.misc_features & HV_STIMER_DIRECT_MODE_AVAILABLE)
339+
if (ms_hyperv.misc_features & HV_STIMER_DIRECT_MODE_AVAILABLE) {
343340
alloc_intr_gate(HYPERV_STIMER0_VECTOR,
344-
hv_stimer0_callback_vector);
341+
asm_sysvec_hyperv_stimer0);
342+
}
345343

346344
# ifdef CONFIG_SMP
347345
smp_ops.smp_prepare_boot_cpu = hv_smp_prepare_boot_cpu;

0 commit comments

Comments
 (0)