Skip to content

Commit 2744a7c

Browse files
KAGA-KOKOhansendc
authored andcommitted
x86/apic: Replace acpi_wake_cpu_handler_update() and apic_set_eoi_cb()
Switch them over to apic_update_callback() and remove the code. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Wei Liu <wei.liu@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Sohil Mehta <sohil.mehta@intel.com> Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
1 parent bef4f37 commit 2744a7c

File tree

6 files changed

+5
-35
lines changed

6 files changed

+5
-35
lines changed

arch/x86/hyperv/hv_apic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ void __init hv_apic_init(void)
310310
* lazy EOI when available, but the same accessor works for
311311
* both xapic and x2apic because the field layout is the same.
312312
*/
313-
apic_set_eoi_cb(hv_apic_eoi_write);
313+
apic_update_callback(eoi, hv_apic_eoi_write);
314314
if (!x2apic_enabled()) {
315315
apic->read = hv_apic_read;
316316
apic->write = hv_apic_write;

arch/x86/hyperv/hv_vtl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static int __init hv_vtl_early_init(void)
222222
"Please add 'noxsave' to the kernel command line.\n");
223223

224224
real_mode_header = &hv_vtl_real_mode_header;
225-
apic->wakeup_secondary_cpu_64 = hv_vtl_wakeup_secondary_cpu;
225+
apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu);
226226

227227
return 0;
228228
}

arch/x86/include/asm/apic.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ static inline bool apic_id_valid(u32 apic_id)
417417
return apic_id <= apic->max_apic_id;
418418
}
419419

420-
extern void __init apic_set_eoi_cb(void (*eoi)(void));
421-
422420
#else /* CONFIG_X86_LOCAL_APIC */
423421

424422
static inline u32 apic_read(u32 reg) { return 0; }
@@ -478,7 +476,6 @@ static inline unsigned int read_apic_id(void)
478476

479477
#ifdef CONFIG_X86_64
480478
typedef int (*wakeup_cpu_handler)(int apicid, unsigned long start_eip);
481-
extern void acpi_wake_cpu_handler_update(wakeup_cpu_handler handler);
482479
extern int default_acpi_madt_oem_check(char *, char *);
483480
extern void x86_64_probe_apic(void);
484481
#else

arch/x86/kernel/acpi/boot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ static int __init acpi_parse_mp_wake(union acpi_subtable_headers *header,
11741174

11751175
acpi_mp_wake_mailbox_paddr = mp_wake->base_address;
11761176

1177-
acpi_wake_cpu_handler_update(acpi_wakeup_cpu);
1177+
apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu);
11781178

11791179
return 0;
11801180
}

arch/x86/kernel/apic/init.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,3 @@ void __init apic_install_driver(struct apic *driver)
5555

5656
pr_info("Switched APIC routing to: %s\n", driver->name);
5757
}
58-
59-
#ifdef CONFIG_X86_64
60-
void __init acpi_wake_cpu_handler_update(wakeup_cpu_handler handler)
61-
{
62-
struct apic **drv;
63-
64-
for (drv = __apicdrivers; drv < __apicdrivers_end; drv++)
65-
(*drv)->wakeup_secondary_cpu_64 = handler;
66-
}
67-
#endif
68-
69-
/*
70-
* Override the generic EOI implementation with an optimized version.
71-
* Only called during early boot when only one CPU is active and with
72-
* interrupts disabled, so we know this does not race with actual APIC driver
73-
* use.
74-
*/
75-
void __init apic_set_eoi_cb(void (*eoi)(void))
76-
{
77-
struct apic **drv;
78-
79-
for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
80-
/* Should happen once for each apic */
81-
WARN_ON((*drv)->eoi == eoi);
82-
(*drv)->eoi = eoi;
83-
}
84-
}

arch/x86/kernel/kvm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void kvm_register_steal_time(void)
332332

333333
static DEFINE_PER_CPU_DECRYPTED(unsigned long, kvm_apic_eoi) = KVM_PV_EOI_DISABLED;
334334

335-
static notrace void kvm_guest_apic_eoi_write(void)
335+
static notrace __maybe_unused void kvm_guest_apic_eoi_write(void)
336336
{
337337
/**
338338
* This relies on __test_and_clear_bit to modify the memory
@@ -825,7 +825,7 @@ static void __init kvm_guest_init(void)
825825
}
826826

827827
if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
828-
apic_set_eoi_cb(kvm_guest_apic_eoi_write);
828+
apic_update_callback(eoi, kvm_guest_apic_eoi_write);
829829

830830
if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) {
831831
static_branch_enable(&kvm_async_pf_enabled);

0 commit comments

Comments
 (0)