x86/apic: Use u32 for check_apicid_used()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 14 Aug 2023 08:18:41 +0000 (10:18 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 10 Oct 2023 12:38:18 +0000 (14:38 +0200)
APIC IDs are used with random data types u16, u32, int, unsigned int,
unsigned long.

Make it all consistently use u32 because that reflects the hardware
register width and move the default implementation to local.h as there are
no users outside the apic directory.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Juergen Gross <jgross@suse.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230814085112.981956102@linutronix.de
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_common.c
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/bigsmp_32.c
arch/x86/kernel/apic/local.h

index a7ac05ce9ac5ee85605028fe80ffb178b6325895..e9706972d49773b6151cabfa3e800e585e62dc53 100644 (file)
@@ -292,7 +292,7 @@ struct apic {
        int     (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
        bool    (*apic_id_registered)(void);
 
-       bool    (*check_apicid_used)(physid_mask_t *map, int apicid);
+       bool    (*check_apicid_used)(physid_mask_t *map, u32 apicid);
        void    (*init_apic_ldr)(void);
        void    (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap);
        int     (*cpu_present_to_apicid)(int mps_cpu);
@@ -538,7 +538,6 @@ extern int default_apic_id_valid(u32 apicid);
 extern u32 apic_default_calc_apicid(unsigned int cpu);
 extern u32 apic_flat_calc_apicid(unsigned int cpu);
 
-extern bool default_check_apicid_used(physid_mask_t *map, int apicid);
 extern void default_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask_t *retmap);
 extern int default_cpu_present_to_apicid(int mps_cpu);
 
index 7bc5d9bf59cd191a7b85c24eb3db7e8c6ee08f53..ca73c3a8cb3cc339e56238de093fdee398189524 100644 (file)
@@ -18,7 +18,7 @@ u32 apic_flat_calc_apicid(unsigned int cpu)
        return 1U << cpu;
 }
 
-bool default_check_apicid_used(physid_mask_t *map, int apicid)
+bool default_check_apicid_used(physid_mask_t *map, u32 apicid)
 {
        return physid_isset(apicid, *map);
 }
index 032a84e2c3ccc7e345ed0c05193965549989510f..a5364a4265907dcb0ea0bf5886d63b5f423b3492 100644 (file)
@@ -158,8 +158,6 @@ static struct apic apic_physflat __ro_after_init = {
 
        .disable_esr                    = 0,
 
-       .check_apicid_used              = NULL,
-       .ioapic_phys_id_map             = NULL,
        .cpu_present_to_apicid          = default_cpu_present_to_apicid,
        .phys_pkg_id                    = flat_phys_pkg_id,
 
index 966d7cf10b958dbfee557346ab6484237ffb4d2d..f834a2064d736aafdb2c9641ad1a2dcd7dbdab41 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <asm/apic.h>
 
+#include "local.h"
+
 static void noop_send_IPI(int cpu, int vector) { }
 static void noop_send_IPI_mask(const struct cpumask *cpumask, int vector) { }
 static void noop_send_IPI_mask_allbutself(const struct cpumask *cpumask, int vector) { }
index 0e5535add4b5f1e0e941b34a107cfc5f04b72c9b..52ac447b568e0130db22c87bf66feeaaa1d2ae5f 100644 (file)
@@ -18,7 +18,7 @@ static unsigned bigsmp_get_apic_id(unsigned long x)
        return (x >> 24) & 0xFF;
 }
 
-static bool bigsmp_check_apicid_used(physid_mask_t *map, int apicid)
+static bool bigsmp_check_apicid_used(physid_mask_t *map, u32 apicid)
 {
        return false;
 }
index ec219c659c7ddf496b782388c5df9ba5506812e0..860d90b6bd5064d60633a37937e7dcabcb16fe39 100644 (file)
@@ -64,6 +64,7 @@ void default_send_IPI_all(int vector);
 void default_send_IPI_self(int vector);
 
 bool default_apic_id_registered(void);
+bool default_check_apicid_used(physid_mask_t *map, u32 apicid);
 
 #ifdef CONFIG_X86_32
 void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, int vector);