Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp193027lql; Fri, 12 Apr 2024 07:43:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdTkBVRUkZiCni8R88GB2RGGiZuhD38p2L/HH2G9qff2wpSm5OuJWtK/kDv4er+WAjTea8d3PBM2jl1cLqB0yo73CXvLT8ZqEQnmVohw== X-Google-Smtp-Source: AGHT+IFQ26pqI5GDyCbUalDaapbIk2W5IWfVaRzoB/1Zu7CJkaHY/5csiEycOk40WMiyxLCvpkMP X-Received: by 2002:ac8:5ed2:0:b0:436:8475:3f79 with SMTP id s18-20020ac85ed2000000b0043684753f79mr3461164qtx.31.1712932989625; Fri, 12 Apr 2024 07:43:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712932989; cv=pass; d=google.com; s=arc-20160816; b=If84xrFnCkd6rhUXEJb07XkAlS8xCI1JBASMk9r0TEPCaPefxjzS8GxI3F8l5kb7Yu p0fFU6IGXeIFIR3WMzct1PgMWtPltl0ioPLTNNrT94GvNBQYprGwMYha5rFttqa6mz7P Qa76M/9ghkRKReO5p4YWQPaJ7b3iKstb44USmEG95IqTY1Lc80hRXYhBFNWT8duymGAb RmsgZi6lv8X1LoPyDzxTzu36+grwLuwl6nsyLWCiOHp/xvSxQTDX9bxT/RfmstshxI5Q JizDdb7CD2gTTg2HtCFNFScTGZEkecn4ONewM906y8CQ8Gzfl+fBbSCdv+K/FhgapV1N 4YGg== 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=5hDyGAl9TpFnAY55CzvcHKnxCugP52b+L8FX0D5SWwo=; fh=8XQHdFtte3XOHSEIytMgmfctfSZlTmw2q6RqB5HTTCI=; b=wI0uObZ/8E0zYhVMnmUGkNxSu6OMvKArQXDmS/FX9gcWvTx751H4CvSLIc+ikdix1l Q/8Y2VVxmwSTbmagSV5m2Ix1yT4beqfHDD5rdCVKvN36VfL5VZ+VU10cU+Og/v2lY1tM WVQbAwSxK1y/fEz5kCzU2mjTFg4vR+Ys94rbkscH671c1lwcJ4iyRjuQ8xJJ37MC0AMb 9L6QhsqQ4iVPlH7zR72qzqwO2eTu/dJ0SNyjNymSJw+oqW6KBURRk1Sr/k7gmTM+GfXh 8KRgpkzeDYGvowjiQMacQxNcPyPSfOHTYaSt1lEjnZ80xovikvFemwj6bFFDjQby+uNp HkJA==; 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-142864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142864-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 21-20020ac85755000000b004346fe9f336si3636229qtx.808.2024.04.12.07.43.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:43:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142864-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-142864-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142864-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 599781C20DB0 for ; Fri, 12 Apr 2024 14:43:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C5AA14386C; Fri, 12 Apr 2024 14:43:00 +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 38D1C86252; Fri, 12 Apr 2024 14:42:57 +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=1712932979; cv=none; b=f1BMClvEvmp4Cu3QvvjGl/Lw5M7OlmzKNh9Dcsvfa7Lh9PfVAz2tXhyAlSf+anlrUo43uOT07MXNCzRs3EZcXNyY1Gj3+saRPHIGMwbhPItENzl+kkznxp0MYCqRdEK9Oh4ensZSuM0NG32HMkPjRkEWkjERMKmgSktB4SZcXJs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712932979; c=relaxed/simple; bh=79hbwtJD4/XXrhjGo4Fh0oSQCXnzo5qxqRI9JeV+GUI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qhLWDZZZf+2qVyVmNUD1+COR9yPrHzcmcjYC7+wCtBpUfa4JHjfTN8hetNowiiL7bFjm3U/l/BMYYklKcvWvFzN84O/hm1hEEzr1RngIXZq4dxHqU5Bic5kR1DA3+ByU8NSzosxXiAL5cseLFJdQpqzIa/5CWEyVvHPwcCswQg0= 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 4VGK4h5JBxz6JB3D; Fri, 12 Apr 2024 22:41:08 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 7BDB01400D4; Fri, 12 Apr 2024 22:42:54 +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; Fri, 12 Apr 2024 15:42:53 +0100 From: Jonathan Cameron To: , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon CC: , , Subject: [PATCH v5 11/18] arm64: acpi: Move get_cpu_for_acpi_id() to a header Date: Fri, 12 Apr 2024 15:37:12 +0100 Message-ID: <20240412143719.11398-12-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412143719.11398-1-Jonathan.Cameron@huawei.com> References: <20240412143719.11398-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: lhrpeml500006.china.huawei.com (7.191.161.198) 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