Skip to content

Commit d6f361e

Browse files
KAGA-KOKOhansendc
authored andcommitted
x86/apic: Convert other overrides to apic_update_callback()
Convert all places which just assign a new function directly to the apic callback to use apic_update_callback() which prepares for using static calls. Mark snp_set_wakeup_secondary_cpu() and kvm_setup_pv_ipi() __init, as they are only invoked from init code and otherwise trigger a section mismatch as they are now invoking a __init function. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> 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 2744a7c commit d6f361e

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

arch/x86/hyperv/hv_apic.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ void __init hv_apic_init(void)
288288
*/
289289
orig_apic = *apic;
290290

291-
apic->send_IPI = hv_send_ipi;
292-
apic->send_IPI_mask = hv_send_ipi_mask;
293-
apic->send_IPI_mask_allbutself = hv_send_ipi_mask_allbutself;
294-
apic->send_IPI_allbutself = hv_send_ipi_allbutself;
295-
apic->send_IPI_all = hv_send_ipi_all;
296-
apic->send_IPI_self = hv_send_ipi_self;
291+
apic_update_callback(send_IPI, hv_send_ipi);
292+
apic_update_callback(send_IPI_mask, hv_send_ipi_mask);
293+
apic_update_callback(send_IPI_mask_allbutself, hv_send_ipi_mask_allbutself);
294+
apic_update_callback(send_IPI_allbutself, hv_send_ipi_allbutself);
295+
apic_update_callback(send_IPI_all, hv_send_ipi_all);
296+
apic_update_callback(send_IPI_self, hv_send_ipi_self);
297297
}
298298

299299
if (ms_hyperv.hints & HV_X64_APIC_ACCESS_RECOMMENDED) {
@@ -312,10 +312,10 @@ void __init hv_apic_init(void)
312312
*/
313313
apic_update_callback(eoi, hv_apic_eoi_write);
314314
if (!x2apic_enabled()) {
315-
apic->read = hv_apic_read;
316-
apic->write = hv_apic_write;
317-
apic->icr_write = hv_apic_icr_write;
318-
apic->icr_read = hv_apic_icr_read;
315+
apic_update_callback(read, hv_apic_read);
316+
apic_update_callback(write, hv_apic_write);
317+
apic_update_callback(icr_write, hv_apic_icr_write);
318+
apic_update_callback(icr_read, hv_apic_icr_read);
319319
}
320320
}
321321
}

arch/x86/kernel/kvm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,10 @@ late_initcall(setup_efi_kvm_sev_migration);
622622
/*
623623
* Set the IPI entry points
624624
*/
625-
static void kvm_setup_pv_ipi(void)
625+
static __init void kvm_setup_pv_ipi(void)
626626
{
627-
apic->send_IPI_mask = kvm_send_ipi_mask;
628-
apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself;
627+
apic_update_callback(send_IPI_mask, kvm_send_ipi_mask);
628+
apic_update_callback(send_IPI_mask_allbutself, kvm_send_ipi_mask_allbutself);
629629
pr_info("setup PV IPIs\n");
630630
}
631631

arch/x86/kernel/sev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ static int wakeup_cpu_via_vmgexit(int apic_id, unsigned long start_ip)
10891089
return ret;
10901090
}
10911091

1092-
void snp_set_wakeup_secondary_cpu(void)
1092+
void __init snp_set_wakeup_secondary_cpu(void)
10931093
{
10941094
if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
10951095
return;
@@ -1099,7 +1099,7 @@ void snp_set_wakeup_secondary_cpu(void)
10991099
* required method to start APs under SNP. If the hypervisor does
11001100
* not support AP creation, then no APs will be started.
11011101
*/
1102-
apic->wakeup_secondary_cpu = wakeup_cpu_via_vmgexit;
1102+
apic_update_callback(wakeup_secondary_cpu, wakeup_cpu_via_vmgexit);
11031103
}
11041104

11051105
int __init sev_es_setup_ap_jump_table(struct real_mode_header *rmh)

0 commit comments

Comments
 (0)