Received: by 2002:ac8:6714:0:b0:405:464a:c27a with SMTP id e20csp392201qtp; Fri, 28 Jul 2023 05:17:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdfzL6IxIfsyVJiSn5JuiFP1fNSD9get9JlVJa7CG9RfxmMcixv5CVDrQsuCfROQqsgN/w X-Received: by 2002:a05:6402:2048:b0:522:3d36:ff26 with SMTP id bc8-20020a056402204800b005223d36ff26mr1623106edb.38.1690546665627; Fri, 28 Jul 2023 05:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690546665; cv=none; d=google.com; s=arc-20160816; b=K5pVCZen93ecyKyA5PBcPQb+vHJNXnx4a/RHgXm7p6YVcD9DCBWEFyDQI24Dn0ConZ ZuGO1Cg60AgMaVJDdW2oF3uJmjBfF5ro9zRobxgijkV0yBi2MCFAPPF2P6aPaSbFRKyP 0iViYtlNFuwcvhChKb0HmcNRdFAgsi0TrGG3sr2C5mzOZf+B8MqrKLRzvE5ThFqWU76D Zp8zC6S/ah7Zjg3cO3NWP96LsfDYKfZqXQheGdOzwp9Q7BzYug5DTCzdaoLszOyFs58X 3Bxw2Uud9wG0CQP3ELzKK1I+1QaXeLjF9TX6AV/gLFwvyTvQBYnAusiA0raKGstup653 1bZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=bDtvqTv62bVKXWY5/pM9aukhZJLaTDTi9tslIEVsSDg=; fh=y/slnYrqOPbByUK75sFPvq3cYp2SbZKM1q7UWSqjNrY=; b=yiobUrADW144V3oTttWFT10Z7lTMnHiDykydFY1eCLXEy3SezTWRXauAKHVx1+P8Fs mecU64cSWECh8gDgE5MsM2mZ8fpnmc4wszP5sXzorKJx4aBKJ9SPGFefbNqe6+Xw2ksP 1HNLFISfwRQIQ0haEdV3cJWASkQbplff1NfJ4g6H7Hgh+X/ZbLHrJrsKvmij3VuaEQTn IV1BnI1XjDNbuJGRmjOwZLMuHz3NpPy56vMRjfWzodJ9TraUyUztsXpi5htdefTaf56c XIp7Yo9/vU6gKwiAXjvBKTTLCdNtD1ih/4D3C4V0i6J16wgqeLiOQN6IGvF6xO/BPt+N /oZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2CajffM9; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020aa7d950000000b00522270c5923si2420901eds.528.2023.07.28.05.17.20; Fri, 28 Jul 2023 05:17:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2CajffM9; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236466AbjG1MNu (ORCPT + 99 others); Fri, 28 Jul 2023 08:13:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235193AbjG1MNE (ORCPT ); Fri, 28 Jul 2023 08:13:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AFCB30F7; Fri, 28 Jul 2023 05:13:01 -0700 (PDT) Message-ID: <20230728120930.450147524@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690546380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=bDtvqTv62bVKXWY5/pM9aukhZJLaTDTi9tslIEVsSDg=; b=2CajffM9SENGzZhMNSYX6kkRu6yzEQ2F4BHD1gC/NvYnBJzFslLV7fuINmE60RQOjmrSEU QTpWEAhuAIZkil7THXBjVUPw91DaIRGGXJLg8JY0VQMJOka717pHYUbJNaj4M3RV/AaNsm zRsPpJPvny7abdNqlkfKOl/JrBCDnwSdF1tv6m4nFjI+XXkrFa9FejfAP7XcuwRy0VvDgu rA8rBtiqAJWspRJAJgWaOFbHz24vuncP9Cxl3L+RMyXODKRtTDZBU9drEL7X+p0v9CQCFh lj2USUYi9y4lR8+7vgmdYxRAByU79+sY5cjJ15nNjDiOq/pRFaNEEDCei0roYg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690546380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=bDtvqTv62bVKXWY5/pM9aukhZJLaTDTi9tslIEVsSDg=; b=ggSyxMBKI2zaSM1/Vxwpad0Cn+kW/eehXKJO3Fwx4ARr3j5J/ZG5nIwDA+J60rM2kWU5tt RjQbP3L7cikX/oAQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , "James E.J. Bottomley" , Dick Kennedy , James Smart , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Guenter Roeck , linux-hwmon@vger.kernel.org, Jean Delvare , Huang Rui , Juergen Gross , Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson Subject: [patch v2 14/38] x86/apic: Use u32 for cpu_present_to_apicid() References: <20230728105650.565799744@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 28 Jul 2023 14:13:00 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 fixup a few related usage sites for consistency sake. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/apic.h | 4 ++-- arch/x86/kernel/apic/apic_common.c | 2 +- arch/x86/kernel/cpu/common.c | 3 ++- arch/x86/kernel/smpboot.c | 10 +++++----- arch/x86/xen/apic.c | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -295,7 +295,7 @@ struct apic { 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); + u32 (*cpu_present_to_apicid)(int mps_cpu); int (*phys_pkg_id)(int cpuid_apic, int index_msb); u32 (*get_apic_id)(unsigned long x); @@ -539,7 +539,7 @@ extern u32 apic_default_calc_apicid(unsi extern u32 apic_flat_calc_apicid(unsigned int cpu); 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); +extern u32 default_cpu_present_to_apicid(int mps_cpu); #else /* CONFIG_X86_LOCAL_APIC */ --- a/arch/x86/kernel/apic/apic_common.c +++ b/arch/x86/kernel/apic/apic_common.c @@ -28,7 +28,7 @@ void default_ioapic_phys_id_map(physid_m *retmap = *phys_map; } -int default_cpu_present_to_apicid(int mps_cpu) +u32 default_cpu_present_to_apicid(int mps_cpu) { if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) return (int)per_cpu(x86_cpu_to_apicid, mps_cpu); --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1747,7 +1747,8 @@ static void generic_identify(struct cpui static void validate_apic_and_package_id(struct cpuinfo_x86 *c) { #ifdef CONFIG_SMP - unsigned int apicid, cpu = smp_processor_id(); + unsigned int cpu = smp_processor_id(); + u32 apicid; apicid = apic->cpu_present_to_apicid(cpu); --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -816,7 +816,7 @@ static void __init smp_quirk_init_udelay /* * Wake up AP by INIT, INIT, STARTUP sequence. */ -static void send_init_sequence(int phys_apicid) +static void send_init_sequence(u32 phys_apicid) { int maxlvt = lapic_get_maxlvt(); @@ -842,7 +842,7 @@ static void send_init_sequence(int phys_ /* * Wake up AP by INIT, INIT, STARTUP sequence. */ -static int wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) +static int wakeup_secondary_cpu_via_init(u32 phys_apicid, unsigned long start_eip) { unsigned long send_status = 0, accept_status = 0; int num_starts, j, maxlvt; @@ -989,7 +989,7 @@ int common_cpu_up(unsigned int cpu, stru * Returns zero if startup was successfully sent, else error code from * ->wakeup_secondary_cpu. */ -static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle) +static int do_boot_cpu(u32 apicid, int cpu, struct task_struct *idle) { unsigned long start_ip = real_mode_header->trampoline_start; int ret; @@ -1057,7 +1057,7 @@ static int do_boot_cpu(int apicid, int c int native_kick_ap(unsigned int cpu, struct task_struct *tidle) { - int apicid = apic->cpu_present_to_apicid(cpu); + u32 apicid = apic->cpu_present_to_apicid(cpu); int err; lockdep_assert_irqs_enabled(); @@ -1250,7 +1250,7 @@ void arch_thaw_secondary_cpus_end(void) bool smp_park_other_cpus_in_init(void) { unsigned int cpu, this_cpu = smp_processor_id(); - unsigned int apicid; + u32 apicid; if (apic->wakeup_secondary_cpu_64 || apic->wakeup_secondary_cpu) return false; --- a/arch/x86/xen/apic.c +++ b/arch/x86/xen/apic.c @@ -115,7 +115,7 @@ static int xen_phys_pkg_id(int initial_a return initial_apic_id >> index_msb; } -static int xen_cpu_present_to_apicid(int cpu) +static u32 xen_cpu_present_to_apicid(int cpu) { if (cpu_present(cpu)) return cpu_data(cpu).topo.apicid;