2023-07-18 00:08:04

by Thomas Gleixner

[permalink] [raw]
Subject: [patch 53/58] 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.

Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/x86/hyperv/hv_apic.c | 20 ++++++++++----------
arch/x86/kernel/kvm.c | 4 ++--
arch/x86/kernel/sev.c | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)

--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -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);
}
}
}
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -624,8 +624,8 @@ late_initcall(setup_efi_kvm_sev_migratio
*/
static 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");
}

--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -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)



2023-07-21 18:20:31

by Michael Kelley (LINUX)

[permalink] [raw]
Subject: RE: [patch 53/58] x86/apic: Convert other overrides to apic_update_callback()

From: Thomas Gleixner <[email protected]> Sent: Monday, July 17, 2023 4:16 PM
>
> 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.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> arch/x86/hyperv/hv_apic.c | 20 ++++++++++----------
> arch/x86/kernel/kvm.c | 4 ++--
> arch/x86/kernel/sev.c | 2 +-
> 3 files changed, 13 insertions(+), 13 deletions(-)
>
> --- a/arch/x86/hyperv/hv_apic.c
> +++ b/arch/x86/hyperv/hv_apic.c
> @@ -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);
> }
> }
> }
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -624,8 +624,8 @@ late_initcall(setup_efi_kvm_sev_migratio
> */
> static 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");
> }
>
> --- a/arch/x86/kernel/sev.c
> +++ b/arch/x86/kernel/sev.c
> @@ -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);

I'm getting a build warning from the above:

section mismatch in reference: snp_set_wakeup_secondary_cpu+0x35 (section: .text) -> __x86_apic_override (section: .init.data)

Michael

2023-07-23 13:22:24

by Thomas Gleixner

[permalink] [raw]
Subject: RE: [patch 53/58] x86/apic: Convert other overrides to apic_update_callback()

On Fri, Jul 21 2023 at 17:49, Michael Kelley wrote:
>> --- a/arch/x86/kernel/kvm.c
>> +++ b/arch/x86/kernel/kvm.c
>> @@ -624,8 +624,8 @@ late_initcall(setup_efi_kvm_sev_migratio
>> */
>> static 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");
>> }
>>
>> --- a/arch/x86/kernel/sev.c
>> +++ b/arch/x86/kernel/sev.c
>> @@ -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);
>
> I'm getting a build warning from the above:
>
> section mismatch in reference: snp_set_wakeup_secondary_cpu+0x35 (section: .text) -> __x86_apic_override (section: .init.data)

snp_set_wakeup_secondary_cpu() wants to be __init. So does
kvm_setup_pv_ipi(). Sigh.