Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp623402lqb; Wed, 17 Apr 2024 06:37:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtpsS2okG46RuoKFCV2a2D16owq7tSKDKngHQRPZRzUhSLyYt4atgwf2BbsmYx1TnNVzL1ZzI4s19SzBVgjicDARsFXk1EU+jA10EkvA== X-Google-Smtp-Source: AGHT+IFqgqFS1cARzwhWAFB58Cb1YfkErtzLiT6UMNf4hJ4edGrM+TG6RW1P/mbLk/UVhleTh74C X-Received: by 2002:a17:903:3308:b0:1e0:1a1f:5e4 with SMTP id jk8-20020a170903330800b001e01a1f05e4mr12437483plb.55.1713361023254; Wed, 17 Apr 2024 06:37:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713361023; cv=pass; d=google.com; s=arc-20160816; b=n3XGIl7BoFx2CyKh0l87dTzl/NI9PzUxpAg7nVJjpezvMY0JvhALwL+V64s16SctvB at5l2twcCVmxColIRgS4J2eNlDM4C8t1/HWlAnoPA5HuMe7LsWGzs1Wz0UY9RQTxry/4 TZqGZLfeNSnLVK2n/jvLnbKdhSs9DmQ6IdzK9kbFvlYRVJ/cmi0XfxNmqkJs81y6Yz+n 6VrLmrTm4OMnR+V9uqr3eioBXb518UwXnZnUmJjaJkhjm50fFzjNm03IDNeE/oWuD4Zb rUuvv+VPr7Uz0yzheDdI6IubWYC9e4kpFvbxxOv4W+qo3s2uWwf53Izdg2FpJtHpIrbX 5uXA== 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=QCqwXTdAKlvQvXT4wX8ddSmgj97FoqeVcqeBMD4wRhw=; fh=wmH6eZgtoFCyes/zVTYi+VaxxdPmNW9hqdNd8ZTZ4XU=; b=jgyZ5cRFPP/NM0TL5Ff3/TiI89M3QYeKNXijBOU+1p/O5XPHcl77LeQAMPxlsvoQwa yar5LdPqLpdcDw7dcyo4uw5njSq5tDPsKlSrud8jRjnQzXoOQRTHtqx7vv4NCUmTVfeU z2nkBbXs4TNNj6AMTW3iWaVygap3MSflXsVWUhuPWMrE9e1+/QBdtRwuExjBuW0deDy5 zjr98ftQK5iJn1JxLfKfTWPdo9doUfeW40SelSi4IHdx3ksuTc5V9D7wOwXmrcCHjEQF kTr7rjP6zSPtNvFgrIONP1viwRwkOL5pO9x59bZmZhWb55el2TbfJry+KvnGQGlM3WMY piJw==; 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-148557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148557-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. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l16-20020a170902f69000b001e197cea248si11666697plg.607.2024.04.17.06.37.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 06:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-148557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148557-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 8065AB25A69 for ; Wed, 17 Apr 2024 13:24:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68E1A13F43D; Wed, 17 Apr 2024 13:23:52 +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 0399913E043; Wed, 17 Apr 2024 13:23:48 +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=1713360231; cv=none; b=maJQRWJiZHVQ6OA7mknvNoXRWpI4dXpgVizcTlBOyEb/Ic3YShLoCAwKd6RHd1TFE7iEz5vmzzDZj6r0cJGhLzu83M5c9wUpRM24PNvtNi08G+yqrO+FUqwEPQNAN5eYOq+FbmFism5zHOmF7oaznLSdBV0KpxXTtzjbMlwX55M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713360231; c=relaxed/simple; bh=9mGJNdyfuwjTBks5shFKIm3vZg8DUGFCba/ALWdO2Rw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iWOs9dRKHziEaOB5df3+A0hKUWoiT9BQbnThUq4+u7C3OVnyevEyPiLGMPkczeegRiaBz78juoVocI9L9ooC2feeNcnQQt9BxyprR5Iw4ybuRJPEuJ9mSKSTWUWR36h2xDMKk5LU8Td/AVuzXdfSbFovmkf/6lgecgB8WoZtMtw= 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.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VKM1P1JlCz6K8qw; Wed, 17 Apr 2024 21:18:49 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id C226E140A08; Wed, 17 Apr 2024 21:23:46 +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; Wed, 17 Apr 2024 14:23:46 +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 CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v6 09/16] arm64: acpi: Move get_cpu_for_acpi_id() to a header Date: Wed, 17 Apr 2024 14:19:02 +0100 Message-ID: <20240417131909.7925-10-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240417131909.7925-1-Jonathan.Cameron@huawei.com> References: <20240417131909.7925-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: lhrpeml500001.china.huawei.com (7.191.163.213) 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) Signed-off-by: Jonathan Cameron --- v5: 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