Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2086945lqa; Tue, 30 Apr 2024 07:53:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVnFc8boVxJPEHZR0RSMwaZ8/BWh0k0qem0StB9qJX3JdLsAFHq+VcRyXlxxWSKtKbXJzIGNwErjC/7BS/aYlgokAEs3OZTfo8ab4RVzw== X-Google-Smtp-Source: AGHT+IFoFjSEfRRiQx+WvRu/e4GBKrj4rY55buxgE/3yhUJbW7B9AD0KcFmssXQBZdFPRFzr9yGI X-Received: by 2002:a17:903:189:b0:1e8:c994:b55b with SMTP id z9-20020a170903018900b001e8c994b55bmr2916672plg.7.1714488809951; Tue, 30 Apr 2024 07:53:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714488809; cv=pass; d=google.com; s=arc-20160816; b=gW7ziTJZVl079ehPPbLyL8OObxZU+RSzR3f4fF5J7JBquc0IANla0MVEeXMNIwo3Ve jN3o4GeeuK9wKUt7re4Ipzd+YxbdsfqT3MsPFVeH/mRDp1HXEISfyaSlwuYWAizrD3xW fPSq7ctdeyrQxvP31UMQZfqME5gZVK1Eb07TH5ebutbQbsCn/doLPvbRl4THQv27O8PX 6z3vxuEKBEHOV27biXUn3EI/GEfMp5F73aQueuDVZqsLdJf7ZMtFDgkSMQ/wOx57n/ld qEsO2wWFak9dVMYI1CDSiKB8jOb/i7iSvUsHrpJllJR3n2AVk1TXnmilc8am/Ob+1GWl hhhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=079/d3DyPOH/vENpVU4N2v59WrCfo443PzcK0q+uPAo=; fh=25IklNjpQtm3+ZI4w1ifckV22BkO2b6a/wyTwiBBJrk=; b=I4bpeytM4lV4gpdzjVFu35W7Z1rn7RbcWAOYSmQUAN6TZP3YSK5onaYsupXLPrbizu gBfRYNl/Nkg1y5rIt0IuPoohs/+rGlDsWpp6PQ6dwmLUilUw6xergnsjIjcZSbzAtHhe nu7LiywY+PYu+mbu2KR9wAucrsa6mBnZDumqZom+mQDzjyaymwImDOxnUJ75eiPi7JkB kAE6hbQKS9hJ8EUapJ+RfVLURMUyDIwnKCO5eRyPQolFSO0OMbZFwqFPa5/UK4XwyKm7 q29O4rmhkJi9nuDIN85efa6ltLGawhHJyug8pbQoxwDBzN214MUZIUfAH8kAvlkP49hX njkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-164145-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s16-20020a170902ea1000b001e5024ac226si22323565plg.45.2024.04.30.07.53.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 07:53:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164145-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-164145-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B11A3B26DF5 for ; Tue, 30 Apr 2024 14:34:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCC03174EC8; Tue, 30 Apr 2024 14:30:20 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D844413D275; Tue, 30 Apr 2024 14:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714487420; cv=none; b=XzeB6Jrt8b9uXJU6OY4J71SAisdYWbeoHIY16waz272LN/yZZqXtm7p/XYG6Q3AvdNXyCmODGkCNyYmKPLyN4tlP8uPXz3dZfNSyuJ+tifaf6/AHXTKbUhc5a2eGZy27fY0zhNqWZSRh7PByxvRLMoHk3lWrmrbrXSP4nghI51U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714487420; c=relaxed/simple; bh=8SaJFDYv/vpzKtyInkQ8vXt4vZPfQ7uO1UwH3mS+YQ8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W7HRQcEheNP8htMjUDg1PUf/83O37iS3ROcqCSufsmcOpKPm/T01FSCLpuGbWLvA1dNVLJ2LalOvuS9Tm+QIh9kC1JanBooGxJdZlNJ505M3YeU/l9+9YzpvzSlU9hiutccRoaHvv5uTCwcHAIisVjJxR8PSraLe/bEaXxixWxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VTMzS4wT0z6D9dD; Tue, 30 Apr 2024 22:29:56 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id B93E31400DC; Tue, 30 Apr 2024 22:30:14 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 30 Apr 2024 15:30:13 +0100 From: Jonathan Cameron To: Thomas Gleixner , Peter Zijlstra , , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , Marc Zyngier , Hanjun Guo , Gavin Shan CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v9 11/19] arm64: acpi: Move get_cpu_for_acpi_id() to a header Date: Tue, 30 Apr 2024 15:24:26 +0100 Message-ID: <20240430142434.10471-12-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240430142434.10471-1-Jonathan.Cameron@huawei.com> References: <20240430142434.10471-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) 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) Acked-by: Hanjun Guo Signed-off-by: Jonathan Cameron --- v9: No change --- 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.39.2