From nobody Mon Mar 23 21:28:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1773903514; cv=none; d=zohomail.com; s=zohoarc; b=Fub6swbJBwL3jxs3TZJ4hxt/w5XQNSoi7yew6Erz2XEIlE38BJggquDCW0Y9AwV6mZ/uTfNIdHI4Z39BhQySgJPOeZFoc+ek6XnMVAsFnd5K92vfm8WHu51QMLgbdgNW+bg05Kj4ZAewd+SM8nF8/hcsB1wcABSXt36ziJ32oS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773903514; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=deqvN/mz2FJFsKRgusCQZVunNs0GKMrytgWIJYyKC38=; b=LWFn/MuTzDnCXMOpEVDpcbXG0CvFsZr8FzsD1bfC6tgHGdP1LGGJpQbVPrRnaFj1aSsn+EN8/h0JrCzQYjpMkDTqiME6I6VO67QoR8dLD4lhgxHH5ghCW08Ro+vO9babBa7nq+YlewqrHLkn2SECNdErS6kc1CVJT5CAHw9g8A8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 177390351475020.899207888904584; Wed, 18 Mar 2026 23:58:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1256666.1551209 (Exim 4.92) (envelope-from ) id 1w37KU-0004qH-AX; Thu, 19 Mar 2026 06:58:02 +0000 Received: by outflank-mailman (output) from mailman id 1256666.1551209; Thu, 19 Mar 2026 06:58:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w37KU-0004oJ-4a; Thu, 19 Mar 2026 06:58:02 +0000 Received: by outflank-mailman (input) for mailman id 1256666; Thu, 19 Mar 2026 06:58:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w37KT-0003m8-39 for xen-devel@lists.xenproject.org; Thu, 19 Mar 2026 06:58:01 +0000 Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f570148a-2360-11f1-9ccf-f158ae23cfc8; Thu, 19 Mar 2026 07:57:58 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4fbxGY46TBz1prKM; Thu, 19 Mar 2026 14:52:53 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id DA7944056A; Thu, 19 Mar 2026 14:57:55 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by kwepemk500009.china.huawei.com (7.202.194.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Mar 2026 14:57:53 +0800 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f570148a-2360-11f1-9ccf-f158ae23cfc8 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=deqvN/mz2FJFsKRgusCQZVunNs0GKMrytgWIJYyKC38=; b=Q+InHx0t+fgSQtVLerCqnbpWuqjH25g8rq1c9ZrVB+5OCCEDVGxoUto5wjyaX4/Bl04WMbtaJ D5pQTQF9XcjGForLBwmJbjk2yPwBl1ETh0zu94i3cxgLe/S/32diWFN4CZVJMw0StBVGyVJ58gg PF0KAlLv+2qVOoGAxpaIJP4= From: Chengwen Feng To: Bjorn Helgaas , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" CC: Jonathan Corbet , Shuah Khan , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H . Peter Anvin" , Juergen Gross , Boris Ostrovsky , Len Brown , Sunil V L , Mark Rutland , Jonathan Cameron , Kees Cook , Yanteng Si , Sean Christopherson , Kai Huang , Tom Lendacky , Thomas Huth , Thorsten Blum , Kevin Loughlin , Zheyun Shen , Peter Zijlstra , Pawan Gupta , Xin Li , "Ahmed S . Darwish" , Sohil Mehta , Ilkka Koskinen , Robin Murphy , James Clark , Besar Wicaksono , Ma Ke , Wei Huang , Andy Gospodarek , Somnath Kotur , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 6/7] ACPI: PPTT: Use acpi_get_cpu_uid() and remove get_acpi_id_for_cpu() Date: Thu, 19 Mar 2026 14:57:34 +0800 Message-ID: <20260319065735.45954-7-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260319065735.45954-1-fengchengwen@huawei.com> References: <20260319065735.45954-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk500009.china.huawei.com (7.202.194.94) X-ZohoMail-DKIM: pass (identity @huawei.com) X-ZM-MESSAGEID: 1773903517473154100 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" - Convert acpi/pptt.c to use acpi_get_cpu_uid() instead of get_acpi_id_for_cpu() - Remove unused get_acpi_id_for_cpu() implementations from arm64/loongarch/riscv This completes the migration to the unified ACPI CPU UID interface for PPTT code, and cleans up legacy unused functions to reduce technical debt. Cc: stable@vger.kernel.org Signed-off-by: Chengwen Feng Reviewed-by: Jonathan Cameron --- arch/arm64/include/asm/acpi.h | 4 --- arch/loongarch/include/asm/acpi.h | 5 ---- arch/riscv/include/asm/acpi.h | 4 --- drivers/acpi/pptt.c | 50 +++++++++++++++++++++++-------- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index bdb0ecf95b5c..8a54ca6ba602 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -114,10 +114,6 @@ static inline bool acpi_has_cpu_in_madt(void) } =20 struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu); -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) -{ - return acpi_cpu_get_madt_gicc(cpu)->uid; -} int get_cpu_for_acpi_id(u32 uid); =20 static inline void arch_fix_phys_package_id(int num, u32 slot) { } diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm= /acpi.h index 7376840fa9f7..eda9d4d0a493 100644 --- a/arch/loongarch/include/asm/acpi.h +++ b/arch/loongarch/include/asm/acpi.h @@ -40,11 +40,6 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_= PIC]; =20 extern int __init parse_acpi_topology(void); =20 -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) -{ - return acpi_core_pic[cpu_logical_map(cpu)].processor_id; -} - #endif /* !CONFIG_ACPI */ =20 #define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 6e13695120bc..26ab37c171bc 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -61,10 +61,6 @@ static inline void arch_fix_phys_package_id(int num, u32= slot) { } =20 void acpi_init_rintc_map(void); struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); -static inline u32 get_acpi_id_for_cpu(int cpu) -{ - return acpi_cpu_get_madt_rintc(cpu)->uid; -} =20 int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa); diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index de5f8c018333..7bd5bc1f225a 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -459,11 +459,14 @@ static void cache_setup_acpi_cpu(struct acpi_table_he= ader *table, { struct acpi_pptt_cache *found_cache; struct cpu_cacheinfo *this_cpu_ci =3D get_cpu_cacheinfo(cpu); - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id; struct cacheinfo *this_leaf; unsigned int index =3D 0; struct acpi_pptt_processor *cpu_node =3D NULL; =20 + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) !=3D 0) + return; + while (index < get_cpu_cacheinfo(cpu)->num_leaves) { this_leaf =3D this_cpu_ci->info_list + index; found_cache =3D acpi_find_cache_node(table, acpi_cpu_id, @@ -546,7 +549,10 @@ static int topology_get_acpi_cpu_tag(struct acpi_table= _header *table, unsigned int cpu, int level, int flag) { struct acpi_pptt_processor *cpu_node; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id; + + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) !=3D 0) + return -ENOENT; =20 cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); if (cpu_node) { @@ -614,18 +620,22 @@ static int find_acpi_cpu_topology_tag(unsigned int cp= u, int level, int flag) * * Check the node representing a CPU for a given flag. * - * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or - * the table revision isn't new enough. + * Return: -ENOENT if can't get CPU's ACPI Processor UID, the PPTT doesn't + * exist, the CPU cannot be found or the table revision isn't new + * enough. * 1, any passed flag set * 0, flag unset */ static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) { struct acpi_table_header *table; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id; struct acpi_pptt_processor *cpu_node =3D NULL; int ret =3D -ENOENT; =20 + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) !=3D 0) + return -ENOENT; + table =3D acpi_get_pptt(); if (!table) return -ENOENT; @@ -651,7 +661,8 @@ static int check_acpi_cpu_flag(unsigned int cpu, int re= v, u32 flag) * in the PPTT. Errors caused by lack of a PPTT table, or otherwise, retur= n 0 * indicating we didn't find any cache levels. * - * Return: -ENOENT if no PPTT table or no PPTT processor struct found. + * Return: -ENOENT if no PPTT table, can't get CPU's ACPI Process UID or n= o PPTT + * processor struct found. * 0 on success. */ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels, @@ -671,7 +682,9 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int = *levels, =20 pr_debug("Cache Setup: find cache levels for CPU=3D%d\n", cpu); =20 - acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id)) + return -ENOENT; + cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node) return -ENOENT; @@ -780,8 +793,9 @@ int find_acpi_cpu_topology_package(unsigned int cpu) * It may not exist in single CPU systems. In simple multi-CPU systems, * it may be equal to the package topology level. * - * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found - * or there is no toplogy level above the CPU.. + * Return: -ENOENT if the PPTT doesn't exist, can't get CPU's ACPI + * Processor UID, the CPU cannot be found or there is no toplogy level + * above the CPU. * Otherwise returns a value which represents the package for this CPU. */ =20 @@ -797,7 +811,9 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu) if (!table) return -ENOENT; =20 - acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) !=3D 0) + return -ENOENT; + cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node || !cpu_node->parent) return -ENOENT; @@ -872,7 +888,9 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_= header *table_hdr, cpumask_clear(cpus); =20 for_each_possible_cpu(cpu) { - acpi_id =3D get_acpi_id_for_cpu(cpu); + if (acpi_get_cpu_uid(cpu, &acpi_id) !=3D 0) + continue; + cpu_node =3D acpi_find_processor_node(table_hdr, acpi_id); =20 while (cpu_node) { @@ -966,10 +984,13 @@ int find_acpi_cache_level_from_id(u32 cache_id) for_each_possible_cpu(cpu) { bool empty; int level =3D 1; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id; struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; =20 + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) !=3D 0) + continue; + cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node) continue; @@ -1030,10 +1051,13 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_i= d, cpumask_t *cpus) for_each_possible_cpu(cpu) { bool empty; int level =3D 1; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id; struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; =20 + if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) !=3D 0) + continue; + cpu_node =3D acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node) continue; --=20 2.17.1