From patchwork Tue Oct 24 15:18:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 157585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2018479vqx; Tue, 24 Oct 2023 08:23:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvSvzseeAeymzxB5YVhSVQb+gQDnPv+O+vk8dmVaW+W0eg4hVgDiT1OFkJ1BRi6KUxkWhB X-Received: by 2002:a05:6a20:1591:b0:16b:8067:23a7 with SMTP id h17-20020a056a20159100b0016b806723a7mr3411285pzj.24.1698160981454; Tue, 24 Oct 2023 08:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160981; cv=none; d=google.com; s=arc-20160816; b=Gqa/PyPf++CM5EzkDJ7PobeFQGxG+wPtBLqfQoJs8mubuap5cTB0+RWlgel8uON5y1 3jhrno0WxQ45Uu50NtXDR/jfV/ZTKwbdE9s5lH5sqxoQsYO/WZppyrn9aVZ6ugu74znE 6DcLe9ThKXgo5TncZzZ2WP8XKFKQw7PONAosmn1+0N8uSZpC0ATSWOylUVA0anazHKy5 u8R1qMPhDp38HjgETQcxyXud2rRHsUrruPgme2dd/ZQ4nDMUkwa6atyHJJRKyNiMKg0L /W5Jgi07UiWgcHPxHkhu1d6pPoIZrZaVPfWJJfYn8PymRiBaxl3d4IecqWgwRi1jduAT SgNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=Ze2TRVkRqR4drLEJGzW55W0BbOj7xe/gYvcpwrw1jmo=; fh=OOsQZLs/UfNFDib7SKUVR2B3lY2xia9nwULNuSH4Lqk=; b=VSM08CY4EMuXMU2E50WnVWiYWxrSmYWWJsvgUsZh+8VRtmbw4tLetK6/AYfHYBb8ic VaKHXMCs31q+J0MM5RXVjdB6MV2JnVkLC2ctkJE9U6rwNhugIfns95XJNFACooGz8S/z GX9QO0kdbnFgyRCaQv96l50JJMppeKRjP27OjB7kBgB1m9d2GxfSX2IGaFna/K2CUD2H 79hsgRasGROaUMSjgsvm3hBHrqvU/9wb+HRMHmM38RwdJPVweUPClXPAXJ+FtUfCqPbT z8SDK7PPDtQnuw5R/xcAQ3XzI9HJDduRm8LKHbkKQ//+7HaG8/Jsl81B6L+X00zzAP0l /8hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=1BmU+vUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id h10-20020a056a00218a00b0068fcf6fe22csi8678915pfi.304.2023.10.24.08.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=1BmU+vUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8B2D78028902; Tue, 24 Oct 2023 08:22:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343809AbjJXPWu (ORCPT + 27 others); Tue, 24 Oct 2023 11:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbjJXPVi (ORCPT ); Tue, 24 Oct 2023 11:21:38 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1A2F2736; Tue, 24 Oct 2023 08:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ze2TRVkRqR4drLEJGzW55W0BbOj7xe/gYvcpwrw1jmo=; b=1BmU+vUn4GikmkewZzDHoWl5+Y sptyk9FERjGoMsJAO6GSWaifU/ae1beO70C0qhMz/nh1TlRlNjHQGNfzuVFnpgQc8SNI3lVPnHrzc 62hKZW4Tsh4Vz1e1hdlkXksXJFqHADvVc26xFsLFrPR1P1OGFaFvTA/4YJHMAOLcEBlOqk0b7e9Ll iG+Eq0iGfk5quCF6eH3dEmD5LSs8+y1u8epmvD+DHvWN+7tZrLt0FaOaSA7WDXeyIIovHpeAbhPZ7 za3T13nIB8VMDBLdyXJ1FN7n4bHMjDRWiRrupoRHFDuES2TMrfKpry5bGdvFd1vc/PPuKBInWP6Z6 EsOp6ZPA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:47602 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qvJB4-0004V1-0d; Tue, 24 Oct 2023 16:18:42 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJB5-00AqRk-M6; Tue, 24 Oct 2023 16:18:43 +0100 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse , Catalin Marinas , Will Deacon Subject: [PATCH 30/39] arm64: acpi: Move get_cpu_for_acpi_id() to a header MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 24 Oct 2023 16:18:43 +0100 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:22:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780650848962494178 X-GMAIL-MSGID: 1780650848962494178 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 Signed-off-by: Russell King (Oracle) --- 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) {