Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp640830lqb; Wed, 29 May 2024 06:40:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsPLCYNdBZvjVxMCJPc/PJlhMoq/zPSIru1MmDQYRQx42UD0Pa77mnhRU+FPANjVooejJ066CV13X1QTfxTWCZWBlEE6Mm8TYNc7TNJQ== X-Google-Smtp-Source: AGHT+IF09wPgPsKvY2/Ys9ZQ0ti+SFanvPNv4GhNLNxg6p4Fn3YO+aRoW3hzwHNrYVspRR6gJLZ2 X-Received: by 2002:a05:622a:607:b0:43a:6055:5547 with SMTP id d75a77b69052e-43fe1273064mr34198071cf.23.1716990052879; Wed, 29 May 2024 06:40:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716990052; cv=pass; d=google.com; s=arc-20160816; b=aRaO4oj0Pi9EKx0syz4mTgp/zvE03rwgQ0sjEpG2BZBBehO8BnmzUKZ4Z9SiqE2Me2 nN0bHSjDsEFT8wJEtYF1HjLgEv7J5VioEOyyj85lKsBAUrkjk+qIwhnzK4onDLfKEjio o+DGewnNt74dPcElbLbeg/BBxDomfFJeT3uTQviCRRLuyWBgkrCmFFmAscDdaaAZMnJi a8Eh39rZHZETpifySWdJt6bQ7LU0ZsEtaTWUH1RNZtUWcx+GpZd2WE6Wjf+fGCG1wU7j fFtHqVGCh+E9pCna92I+lG9ReWrWdKnlvGGwq3d+DGVcD2vhXH3G/q0t+FtFL8fupJfk 7gXQ== 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=JCZcQJdCjwngTqzXImwAGTftcd2Y4MuBFI3ekNqOgFw=; fh=NxmCHexitX7P6x/7ARv3vZBmyAUGQGWkF2RSnxwWsIo=; b=WIiZjHaDkIOFZB+xRGvaUMDMDUbB38drrSChr36j0BjNSYYxSh82S7IaQ3vVGc7L/l KORA7WsU3Ut3xWqmFz9hmqelE0NBlh/659ziF5/r5/1TR+XGXTwfm6tfK9s77LgKizDO 0KX2oK9VKtHPUd9YgpcKHVha4LiwDZaYrd8RzcW+4eWcUTDfkxZ3jjhUuKk5OOitdqDT gZmUIngG0JmoZu67JLzmthStkKGZLXpOaKxqhTbR+AWGIYNBsZbsgv++z5lW1Td3H0HO bx5GOz6iaJ5ei/O4cyAKvVJU7VhdiuTJ8bAxYiZ0QRqwYeHASXIb1/QeYSLnu0DUD2FS ygPg==; 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-194180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194180-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fd8a76df0si47848571cf.407.2024.05.29.06.40.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 06:40:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::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-194180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194180-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 97C911C20DA0 for ; Wed, 29 May 2024 13:40:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0AF171C2A3; Wed, 29 May 2024 13:40:33 +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 1DF9417BB4; Wed, 29 May 2024 13:40:29 +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=1716990032; cv=none; b=eeD/dQa8TVhjCAcErtRvlCmnxhPBXVndqbmGnZu/CaF5k+v/RA7A/FvuCUsu8QYU1X5a/HoV0AeSiN31MdjMYPbFvIFuAmCBciFejJ2jb4OkxzzfWdx8i0GYQ1OzEsIldqc8XKeFDPoZNBmu2EOvi9jv12muc/sg8l0k/QW01zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716990032; c=relaxed/simple; bh=JllpABJeZauT2Ev5CZQeaaQQ5/N45QSKqaKtc8ieJa8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gJSxezvqkv1AH8Pn3SLE3Xbmp5cJZtFDPSBfD74zt/ygmi1G5dTU5DIj/vOSLMpqWEImr070nIGBquMVnZ3xSn2dgNUIBuZs7soQyKQtS2x0L6TlGv9HwRXp/o5xWiyxkEngWfnlhlz4YlkmHRXPKJgIUtWVJyoQdhe2x+8MRc8= 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 4Vq9QN5mxRz6JBFg; Wed, 29 May 2024 21:36:28 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id EC02514065B; Wed, 29 May 2024 21:40:27 +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.39; Wed, 29 May 2024 14:40:27 +0100 From: Jonathan Cameron To: Marc Zyngier , Will Deacon , Catalin Marinas , , , , , CC: Mark Rutland , Thomas Gleixner , Peter Zijlstra , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Hanjun Guo , Gavin Shan , Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v10 11/19] arm64: acpi: Move get_cpu_for_acpi_id() to a header Date: Wed, 29 May 2024 14:34:38 +0100 Message-ID: <20240529133446.28446-12-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240529133446.28446-1-Jonathan.Cameron@huawei.com> References: <20240529133446.28446-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: lhrpeml100001.china.huawei.com (7.191.160.183) 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 --- 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