Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5290063rdb; Wed, 13 Dec 2023 04:51:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHq5YhxQmqHjTrVxpNKxrVXMhXbxWrZvPlF0ItmBrV7BjszE5i1AZPUKbvslzLY7WjCNLtD X-Received: by 2002:a05:6870:d189:b0:1ff:8a1:3a80 with SMTP id a9-20020a056870d18900b001ff08a13a80mr10136887oac.86.1702471890543; Wed, 13 Dec 2023 04:51:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702471890; cv=none; d=google.com; s=arc-20160816; b=kGDUHQr2MznoS3uhKAuC3kxfvM1bcY7oEX2gSHfT/a4AzMTE8zJTzP48Zt59FN7cfG 2VyIk4ARn5PplMo1Bp8ZibzVzHEcRW7jAYWakH7YKAOqq9P//O32iUN0n4WL/wY6Wah0 HXiugFkKpInCC9mAMoDL1tq+oJgvvst9ezHrUIlg1w70Jv/McN+K07xynhSiniNxPKrb gBAx1ooYsDycpHLjQJVqnw1Lvffijq0gVepfy+OQ12i2pInb5wOBMKfNFij2yaldi6nU ExGFkTrbSXYaAoF/x3kOjIUIFJ6s+RklglWnohtKePxxxSejquM/48kc4I/3EIKx8/lh 79yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=VN1zuZPFpZjLLP0E5DaIC2d1rUW/6DV9Td+xG3o2+qg=; fh=YWIBRcP8cdLYR894sEToaan3lN1VSUITe+B678IO0WY=; b=WTb7aou3EiO9yqOcB2QWTtubr6BvK/qQz5+1TPe/01Bx5pqaxRNRJ1eYRfQT41lyHe z+sXdSs3i/Lldkg8067/ZhzcKW2bxUJAJRTEsBIVdTcyLO/dKV/MDM4hqss4vPNKC0nS i2pSKlwwC+n8XIw8xld23MyKrKK/N/R7JedOlcqA4uaoODCsEN2m5oKf/FhAwmpaD3tm J+i9yL+L8BcWqvh0gHE6Tb1Qaasrc3gBdGtMEy/RymE82hiEyj3Z6XrWrsJJFEcd7+cg K2P3t7+ezGBZOLOiZ1R2n7J7xQX8XbGo655VYuVP58VFRAgeq1fgzHE6VL01aZ23WHYS GvYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="D1oe/wUW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id 23-20020a630017000000b005c668dc2426si9542877pga.176.2023.12.13.04.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:51:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="D1oe/wUW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id BD689809A80B; Wed, 13 Dec 2023 04:51:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378927AbjLMMuw (ORCPT + 99 others); Wed, 13 Dec 2023 07:50:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379021AbjLMMuW (ORCPT ); Wed, 13 Dec 2023 07:50:22 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E886124; Wed, 13 Dec 2023 04:50:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VN1zuZPFpZjLLP0E5DaIC2d1rUW/6DV9Td+xG3o2+qg=; b=D1oe/wUW347yc1kOtGSkPh+NwF pSCntHs+gy+no5ciu7dgJn8Dwp7ORYjROsmBGp2LxhmqGuGHNBP1aZV4OFlEC9LS/kkNb5k/WLv0D mh8mN34J76pSZrqKTu/t/Yy4YAK2i6WxDzVJVCIEvI90776a9cz/NI1sAPKu3ritagRuRdxGFqiRV EFDmKmn1xkbQg+qk0w/J584QQZcCvychU5lpTdyK4uDeS0SBGUzA+NMnOOnzXzgm4BLxaVVcBbXvT RRU7paUGEeifLGjZXvZ7Z68W8gZPslrofMMxzTl+WLoI4SZHMi25yNHGhFi/ON2jM6106rGDwHUeH GzKOJ5ww==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:57410 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rDOgk-0008Ff-2y; Wed, 13 Dec 2023 12:50:11 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rDOgn-00Dvki-2N; Wed, 13 Dec 2023 12:50:13 +0000 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, acpica-devel@lists.linuxfoundation.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Subject: [PATCH RFC v3 12/21] arm64: acpi: Move get_cpu_for_acpi_id() to a header MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Wed, 13 Dec 2023 12:50:13 +0000 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Dec 2023 04:51:17 -0800 (PST) From: James Morse ACPI identifies CPUs by UID. get_cpu_for_acpi_id() maps the ACPI UID to the linux CPU number. The helper to retrieve this mapping is only available in arm64's numa code. Move it to live next to get_acpi_id_for_cpu(). Signed-off-by: James Morse Reviewed-by: Jonathan Cameron Reviewed-by: Gavin Shan Tested-by: Miguel Luis Tested-by: Vishnu Pajjuri Tested-by: Jianyong Wu Signed-off-by: Russell King (Oracle) --- arch/arm64/include/asm/acpi.h | 11 +++++++++++ arch/arm64/kernel/acpi_numa.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index 6792a1f83f2a..bc9a6656fc0c 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -119,6 +119,17 @@ static inline u32 get_acpi_id_for_cpu(unsigned int cpu) return acpi_cpu_get_madt_gicc(cpu)->uid; } +static inline int get_cpu_for_acpi_id(u32 uid) +{ + int cpu; + + for (cpu = 0; cpu < nr_cpu_ids; cpu++) + if (uid == get_acpi_id_for_cpu(cpu)) + return cpu; + + return -EINVAL; +} + static inline void arch_fix_phys_package_id(int num, u32 slot) { } void __init acpi_init_cpus(void); int apei_claim_sea(struct pt_regs *regs); diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c index e51535a5f939..0c036a9a3c33 100644 --- a/arch/arm64/kernel/acpi_numa.c +++ b/arch/arm64/kernel/acpi_numa.c @@ -34,17 +34,6 @@ int __init acpi_numa_get_nid(unsigned int cpu) return acpi_early_node_map[cpu]; } -static inline int get_cpu_for_acpi_id(u32 uid) -{ - int cpu; - - for (cpu = 0; cpu < nr_cpu_ids; cpu++) - if (uid == get_acpi_id_for_cpu(cpu)) - return cpu; - - return -EINVAL; -} - static int __init acpi_parse_gicc_pxm(union acpi_subtable_headers *header, const unsigned long end) { -- 2.30.2