]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/apic: Convert other overrides to apic_update_callback()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 8 Aug 2023 22:04:20 +0000 (15:04 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 9 Aug 2023 19:00:46 +0000 (12:00 -0700)
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)
arch/x86/hyperv/hv_apic.c
arch/x86/kernel/kvm.c
arch/x86/kernel/sev.c

index bfb02f68c0f1a5977cb8b82ea6f35bd94b756e73..72d9931da3a27776766061fb72a843efd2f55a32 100644 (file)
@@ -288,12 +288,12 @@ void __init hv_apic_init(void)
                 */
                orig_apic = *apic;
 
-               apic->send_IPI = hv_send_ipi;
-               apic->send_IPI_mask = hv_send_ipi_mask;
-               apic->send_IPI_mask_allbutself = hv_send_ipi_mask_allbutself;
-               apic->send_IPI_allbutself = hv_send_ipi_allbutself;
-               apic->send_IPI_all = hv_send_ipi_all;
-               apic->send_IPI_self = hv_send_ipi_self;
+               apic_update_callback(send_IPI, hv_send_ipi);
+               apic_update_callback(send_IPI_mask, hv_send_ipi_mask);
+               apic_update_callback(send_IPI_mask_allbutself, hv_send_ipi_mask_allbutself);
+               apic_update_callback(send_IPI_allbutself, hv_send_ipi_allbutself);
+               apic_update_callback(send_IPI_all, hv_send_ipi_all);
+               apic_update_callback(send_IPI_self, hv_send_ipi_self);
        }
 
        if (ms_hyperv.hints & HV_X64_APIC_ACCESS_RECOMMENDED) {
@@ -312,10 +312,10 @@ void __init hv_apic_init(void)
                 */
                apic_update_callback(eoi, hv_apic_eoi_write);
                if (!x2apic_enabled()) {
-                       apic->read      = hv_apic_read;
-                       apic->write     = hv_apic_write;
-                       apic->icr_write = hv_apic_icr_write;
-                       apic->icr_read  = hv_apic_icr_read;
+                       apic_update_callback(read, hv_apic_read);
+                       apic_update_callback(write, hv_apic_write);
+                       apic_update_callback(icr_write, hv_apic_icr_write);
+                       apic_update_callback(icr_read, hv_apic_icr_read);
                }
        }
 }
index c86cedbb0bd55e1a96b7046547e0c38b9d59877d..6a36db4f79fd750c08b131577fa0b7f71956c680 100644 (file)
@@ -622,10 +622,10 @@ late_initcall(setup_efi_kvm_sev_migration);
 /*
  * Set the IPI entry points
  */
-static void kvm_setup_pv_ipi(void)
+static __init void kvm_setup_pv_ipi(void)
 {
-       apic->send_IPI_mask = kvm_send_ipi_mask;
-       apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself;
+       apic_update_callback(send_IPI_mask, kvm_send_ipi_mask);
+       apic_update_callback(send_IPI_mask_allbutself, kvm_send_ipi_mask_allbutself);
        pr_info("setup PV IPIs\n");
 }
 
index 1ee7bed453ded5df0d50469b6f75fbd7ca1ed189..a2b50ae61b7219a4a044f4ce4d7cda95550019fc 100644 (file)
@@ -1089,7 +1089,7 @@ static int wakeup_cpu_via_vmgexit(int apic_id, unsigned long start_ip)
        return ret;
 }
 
-void snp_set_wakeup_secondary_cpu(void)
+void __init snp_set_wakeup_secondary_cpu(void)
 {
        if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
                return;
@@ -1099,7 +1099,7 @@ void snp_set_wakeup_secondary_cpu(void)
         * required method to start APs under SNP. If the hypervisor does
         * not support AP creation, then no APs will be started.
         */
-       apic->wakeup_secondary_cpu = wakeup_cpu_via_vmgexit;
+       apic_update_callback(wakeup_secondary_cpu, wakeup_cpu_via_vmgexit);
 }
 
 int __init sev_es_setup_ap_jump_table(struct real_mode_header *rmh)