lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Aug 2023 15:14:49 -0500
From:   Steve Wahl <steve.wahl@....com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
        Tom Lendacky <thomas.lendacky@....com>,
        Andrew Cooper <andrew.cooper3@...rix.com>,
        Arjan van de Ven <arjan@...ux.intel.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        Dick Kennedy <dick.kennedy@...adcom.com>,
        James Smart <james.smart@...adcom.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org, Guenter Roeck <linux@...ck-us.net>,
        linux-hwmon@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
        Huang Rui <ray.huang@....com>, Juergen Gross <jgross@...e.com>,
        Steve Wahl <steve.wahl@....com>,
        Dimitri Sivanich <dimitri.sivanich@....com>,
        Russ Anderson <russ.anderson@....com>
Subject: Re: [patch v2 15/38] x86/apic: Use u32 for phys_pkg_id()

Reviewed-by: Steve Wahl <steve.wahl@....com>

On Fri, Jul 28, 2023 at 02:13:01PM +0200, Thomas Gleixner wrote:
> 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 even if that callback going to be removed soonish.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
>  arch/x86/include/asm/apic.h          |    2 +-
>  arch/x86/kernel/apic/apic_flat_64.c  |    2 +-
>  arch/x86/kernel/apic/apic_noop.c     |    2 +-
>  arch/x86/kernel/apic/apic_numachip.c |    2 +-
>  arch/x86/kernel/apic/bigsmp_32.c     |    2 +-
>  arch/x86/kernel/apic/local.h         |    2 +-
>  arch/x86/kernel/apic/probe_32.c      |    2 +-
>  arch/x86/kernel/apic/x2apic_phys.c   |    2 +-
>  arch/x86/kernel/apic/x2apic_uv_x.c   |    2 +-
>  arch/x86/kernel/vsmp_64.c            |    2 +-
>  arch/x86/xen/apic.c                  |    2 +-
>  11 files changed, 11 insertions(+), 11 deletions(-)
> 
> --- a/arch/x86/include/asm/apic.h
> +++ b/arch/x86/include/asm/apic.h
> @@ -296,7 +296,7 @@ struct apic {
>  	void	(*init_apic_ldr)(void);
>  	void	(*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap);
>  	u32	(*cpu_present_to_apicid)(int mps_cpu);
> -	int	(*phys_pkg_id)(int cpuid_apic, int index_msb);
> +	u32	(*phys_pkg_id)(u32 cpuid_apic, int index_msb);
>  
>  	u32	(*get_apic_id)(unsigned long x);
>  	u32	(*set_apic_id)(unsigned int id);
> --- a/arch/x86/kernel/apic/apic_flat_64.c
> +++ b/arch/x86/kernel/apic/apic_flat_64.c
> @@ -66,7 +66,7 @@ static u32 set_apic_id(unsigned int id)
>  	return (id & 0xFF) << 24;
>  }
>  
> -static int flat_phys_pkg_id(int initial_apic_id, int index_msb)
> +static u32 flat_phys_pkg_id(u32 initial_apic_id, int index_msb)
>  {
>  	return initial_apic_id >> index_msb;
>  }
> --- a/arch/x86/kernel/apic/apic_noop.c
> +++ b/arch/x86/kernel/apic/apic_noop.c
> @@ -29,7 +29,7 @@ static void noop_send_IPI_self(int vecto
>  static void noop_apic_icr_write(u32 low, u32 id) { }
>  static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) { return -1; }
>  static u64 noop_apic_icr_read(void) { return 0; }
> -static int noop_phys_pkg_id(int cpuid_apic, int index_msb) { return 0; }
> +static u32 noop_phys_pkg_id(u32 cpuid_apic, int index_msb) { return 0; }
>  static unsigned int noop_get_apic_id(unsigned long x) { return 0; }
>  static void noop_apic_eoi(void) { }
>  
> --- a/arch/x86/kernel/apic/apic_numachip.c
> +++ b/arch/x86/kernel/apic/apic_numachip.c
> @@ -56,7 +56,7 @@ static u32 numachip2_set_apic_id(unsigne
>  	return id << 24;
>  }
>  
> -static int numachip_phys_pkg_id(int initial_apic_id, int index_msb)
> +static u32 numachip_phys_pkg_id(u32 initial_apic_id, int index_msb)
>  {
>  	return initial_apic_id >> index_msb;
>  }
> --- a/arch/x86/kernel/apic/bigsmp_32.c
> +++ b/arch/x86/kernel/apic/bigsmp_32.c
> @@ -29,7 +29,7 @@ static void bigsmp_ioapic_phys_id_map(ph
>  	physids_promote(0xFFL, retmap);
>  }
>  
> -static int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb)
> +static u32 bigsmp_phys_pkg_id(u32 cpuid_apic, int index_msb)
>  {
>  	return cpuid_apic >> index_msb;
>  }
> --- a/arch/x86/kernel/apic/local.h
> +++ b/arch/x86/kernel/apic/local.h
> @@ -17,7 +17,7 @@
>  void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest);
>  unsigned int x2apic_get_apic_id(unsigned long id);
>  u32 x2apic_set_apic_id(unsigned int id);
> -int x2apic_phys_pkg_id(int initial_apicid, int index_msb);
> +u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb);
>  
>  void x2apic_send_IPI_all(int vector);
>  void x2apic_send_IPI_allbutself(int vector);
> --- a/arch/x86/kernel/apic/probe_32.c
> +++ b/arch/x86/kernel/apic/probe_32.c
> @@ -18,7 +18,7 @@
>  
>  #include "local.h"
>  
> -static int default_phys_pkg_id(int cpuid_apic, int index_msb)
> +static u32 default_phys_pkg_id(u32 cpuid_apic, int index_msb)
>  {
>  	return cpuid_apic >> index_msb;
>  }
> --- a/arch/x86/kernel/apic/x2apic_phys.c
> +++ b/arch/x86/kernel/apic/x2apic_phys.c
> @@ -134,7 +134,7 @@ u32 x2apic_set_apic_id(unsigned int id)
>  	return id;
>  }
>  
> -int x2apic_phys_pkg_id(int initial_apicid, int index_msb)
> +u32 x2apic_phys_pkg_id(u32 initial_apicid, int index_msb)
>  {
>  	return initial_apicid >> index_msb;
>  }
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -790,7 +790,7 @@ static unsigned int uv_read_apic_id(void
>  	return x2apic_get_apic_id(apic_read(APIC_ID));
>  }
>  
> -static int uv_phys_pkg_id(int initial_apicid, int index_msb)
> +static u32 uv_phys_pkg_id(u32 initial_apicid, int index_msb)
>  {
>  	return uv_read_apic_id() >> index_msb;
>  }
> --- a/arch/x86/kernel/vsmp_64.c
> +++ b/arch/x86/kernel/vsmp_64.c
> @@ -127,7 +127,7 @@ static void __init vsmp_cap_cpus(void)
>  #endif
>  }
>  
> -static int apicid_phys_pkg_id(int initial_apic_id, int index_msb)
> +static u32 apicid_phys_pkg_id(u32 initial_apic_id, int index_msb)
>  {
>  	return read_apic_id() >> index_msb;
>  }
> --- a/arch/x86/xen/apic.c
> +++ b/arch/x86/xen/apic.c
> @@ -110,7 +110,7 @@ static int xen_madt_oem_check(char *oem_
>  	return xen_pv_domain();
>  }
>  
> -static int xen_phys_pkg_id(int initial_apic_id, int index_msb)
> +static u32 xen_phys_pkg_id(u32 initial_apic_id, int index_msb)
>  {
>  	return initial_apic_id >> index_msb;
>  }
> 

-- 
Steve Wahl, Hewlett Packard Enterprise

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ