Received: by 2002:ab2:68d2:0:b0:1f5:ff5f:8f32 with SMTP id e18csp115316lqp; Thu, 18 Apr 2024 06:59:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8NNhKoxdG2/l6olvZPgUDCrKJWWQiWexY/AgmsV4C2++sZzWpRUTalaSNC6g5LdPPNPYZujSml3OAXPTM9ZzBMiobzhRAkV1AXoyxUw== X-Google-Smtp-Source: AGHT+IHysNh/dtT7MQTuMsUmlHf3N+Fm8pok92r2n/OQMcAh4rUjy0PlRaAmg3ym8+FM6kAh7jFH X-Received: by 2002:a05:620a:40c3:b0:78d:68f2:11af with SMTP id g3-20020a05620a40c300b0078d68f211afmr4076263qko.23.1713448754805; Thu, 18 Apr 2024 06:59:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713448754; cv=pass; d=google.com; s=arc-20160816; b=lfCdV/K9OrbWIxvr52jxoWRLV206u3whEvTVFU0kJRdulS/T7SpApk585ko0+x6jQl DM9fWekr4+l3pBUteiEwogeGULOPRafLL8hZR7eOWc3lwouyNlwj0jifczHIV0p9YRl+ VgudR0x5NtIzoOKO47dC77LyBYwmZbN/MgZqoTLTCICnzG804xyalTxb0mKxnM433LuK g+l6G4YAnb4REN2XEMJj97oa3cjd1x2kQB+eef5XmzH+G0PVI5Cv2LuA7gCu5W5SFC0W vD4SkuUFA3Q/pCEINfWHAiuqJ0DeU0cdiW0wxOzevg5kauG2vAhlQuTvc05hrsZUiCct VB4A== 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=IEjKoIvvFaC/dHw/BcWoay2crx0Jjq7764dk2bldxyk=; fh=wmH6eZgtoFCyes/zVTYi+VaxxdPmNW9hqdNd8ZTZ4XU=; b=KbWLHBgmDX8Fn+cyHYgcXEHpGHfXtO6rc7PBvJZFC3omNYRWKoqEuu46XskrRVRdO9 DK1sfbBbMyYXDC2j1/vIOOWKSpY9PeYAQd1fx3xcKvwfeB8JaeSzKTF/fYgR7ijLvYRf c+v8ay9hSEwew4AcnYKv5ThIIlaPnk2ipm6SWzsmYYOz2RymwOvKYVKZj/QHQkuU62mw CTUC5NPBUefaUw7EvV0mu/+35PakGaybrwa0udtkRKfRHPJ1Dmo6GC99olmHwFUTHNMN HkDWwviuJDZJRcql8Vx4ZdbrQpkS37bg6rRvK3HjMJEdNitsheL58vSLOwBHRUVgsD8p r01A==; 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-150224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y23-20020a05620a09d700b0078ee852d752si1459128qky.404.2024.04.18.06.59.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 06:59:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-150224-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150224-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5FA311C21B46 for ; Thu, 18 Apr 2024 13:59:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A183165FAE; Thu, 18 Apr 2024 13:58:55 +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 1B96315FCFC; Thu, 18 Apr 2024 13:58:53 +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=1713448734; cv=none; b=Fz7ONJFDIQ4qc/M/nFZekKP/sngRG06/Lx2SWzLSyamxm+p7uaXMt3VFI7jBf6AVQHZ4Dz9uau77SVgda1fJrkR6J3FOIL9+CBprrwvIoUmkFwrI9dBJHPIt36qpZgTDFqEWGPICcwu6b95J2MwJ3Hv93YeevLBHEzGg+i6wvv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713448734; c=relaxed/simple; bh=LMOtMDsVNJpeHpfVlq19OUSm2SdXirDuYt2br/Fd5YU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gRJlRSkfIWge1rnGM+QFq7MvuV5ZC6gANVS2EW/tmReYCDjU91n4LP+IgOsmLILv2O6R+ROOFc+A8HSm16WMMB2uaLiE1lt9Ai62yoCcGIa0ghT2o6Jv4c0DJWdX7JhSPk9LIHIBkJT3g4PJ3HYfsFdsbBHZDORPfiqw5QjoREE= 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 4VKzpl6JBHz6K69w; Thu, 18 Apr 2024 21:56:47 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 38E4D1400CD; Thu, 18 Apr 2024 21:58:51 +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; Thu, 18 Apr 2024 14:58:50 +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 v7 09/16] arm64: acpi: Move get_cpu_for_acpi_id() to a header Date: Thu, 18 Apr 2024 14:54:05 +0100 Message-ID: <20240418135412.14730-10-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240418135412.14730-1-Jonathan.Cameron@huawei.com> References: <20240418135412.14730-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: lhrpeml100002.china.huawei.com (7.191.160.241) 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 --- v7: 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