From nobody Mon Mar 23 21:25:53 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=1773368555; cv=none; d=zohomail.com; s=zohoarc; b=e+T8l0pXnKG0k+eH9k6H5vHqEhUwNCWkEVIqllx+OetSgMnLjsUDXHXjbjZPf1mdlu977jvGlpg+Uzr/mjjG5cRyRKy6AMb7l+42K/GYpZSt/DIVq5LBq0BG93Yrb1SMjHg80VV5xGVSafQ609jsipJe0YwvQGr7pqeaCVF/8ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773368555; 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=JidVbBwVWveb8Q2cCRvXnGJEce6/x2QeOrZ9sxuCXM4=; b=lvoVbQhkWMnZfEQt65jJrSUi+Ybacduz0IQPDUId40OdM4hZ5Q8s55SpmIOPEzjCBPmdv2ZN8UqysoGqNmVCu96RdLk+2RbSHw4K1/+cXDs9IS0UlUc2HUFeXfDpbIFj1WvhybB7pYf6x+vi3Ho9ndiZWeZCMYMEH4sdLzYnv90= 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 1773368555323248.49315569147984; Thu, 12 Mar 2026 19:22:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1253180.1549513 (Exim 4.92) (envelope-from ) id 1w0sAF-0000wP-GH; Fri, 13 Mar 2026 02:22:11 +0000 Received: by outflank-mailman (output) from mailman id 1253180.1549513; Fri, 13 Mar 2026 02:22:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0sAF-0000wC-Dh; Fri, 13 Mar 2026 02:22:11 +0000 Received: by outflank-mailman (input) for mailman id 1253180; Fri, 13 Mar 2026 02:22:09 +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 1w0sAD-0000ET-Sl for xen-devel@lists.xenproject.org; Fri, 13 Mar 2026 02:22:09 +0000 Received: from canpmsgout12.his.huawei.com (canpmsgout12.his.huawei.com [113.46.200.227]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 66cd214d-1e83-11f1-9ccf-f158ae23cfc8; Fri, 13 Mar 2026 03:21:55 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.127]) by canpmsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4fX7Q96jr8znTWy; Fri, 13 Mar 2026 10:16:17 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id AE6D540363; Fri, 13 Mar 2026 10:21:52 +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; Fri, 13 Mar 2026 10:21:51 +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: 66cd214d-1e83-11f1-9ccf-f158ae23cfc8 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=JidVbBwVWveb8Q2cCRvXnGJEce6/x2QeOrZ9sxuCXM4=; b=DpIEqq/CrkmJmL6LwCkEqHToQvDHHqUkv8mgheeY48ustZyxQm4BMOWiV2XfvPN2Dd8om+p9b BEJfQQ0MewxBLdkRV249slzpfq+sdlXsm0e88Er/IjZQ59ICTIEb+b40XL6ZKBJufecu6Y2mK9R FZhvGCrURkH6S3xH8txS9qA= 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 , Sohil Mehta , Ilkka Koskinen , Robin Murphy , James Clark , Besar Wicaksono , Ma Ke , Wei Huang , Andy Gospodarek , Somnath Kotur , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v7 2/3] x86: Implement acpi_get_cpu_uid() Date: Fri, 13 Mar 2026 10:21:43 +0800 Message-ID: <20260313022144.40942-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260313022144.40942-1-fengchengwen@huawei.com> References: <20260313022144.40942-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: 1773368573019158500 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add acpi_get_cpu_uid() implementation for x86, replacing the existing cpu_acpi_id() function. This completes the unified ACPI Processor UID retrieval interface across all ACPI-enabled architectures. Cc: stable@vger.kernel.org Signed-off-by: Chengwen Feng Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/cpu.h | 1 - arch/x86/include/asm/smp.h | 1 - arch/x86/kernel/acpi/boot.c | 20 ++++++++++++++++++++ arch/x86/xen/enlighten_hvm.c | 5 +++-- include/linux/acpi.h | 2 -- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index ad235dda1ded..57a0786dfd75 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -11,7 +11,6 @@ =20 #ifndef CONFIG_SMP #define cpu_physical_id(cpu) boot_cpu_physical_apicid -#define cpu_acpi_id(cpu) 0 #endif /* CONFIG_SMP */ =20 #ifdef CONFIG_HOTPLUG_CPU diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 84951572ab81..05d1d479b4cf 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -130,7 +130,6 @@ __visible void smp_call_function_interrupt(struct pt_re= gs *regs); __visible void smp_call_function_single_interrupt(struct pt_regs *r); =20 #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) -#define cpu_acpi_id(cpu) per_cpu(x86_cpu_to_acpiid, cpu) =20 /* * This function is needed by all SMP systems. It must _always_ be valid diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index a3f2fb1fea1b..ceba24f65ae3 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1848,3 +1848,23 @@ void __iomem * (*acpi_os_ioremap)(acpi_physical_addr= ess phys, acpi_size size) =3D x86_acpi_os_ioremap; EXPORT_SYMBOL_GPL(acpi_os_ioremap); #endif + +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid) +{ + u32 acpi_id; + + if (cpu >=3D nr_cpu_ids) + return -EINVAL; + +#ifdef CONFIG_SMP + acpi_id =3D per_cpu(x86_cpu_to_acpiid, cpu); + if (acpi_id =3D=3D CPU_ACPIID_INVALID) + return -ENODEV; +#else + acpi_id =3D 0; +#endif + + *uid =3D acpi_id; + return 0; +} +EXPORT_SYMBOL_GPL(acpi_get_cpu_uid); diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index fe57ff85d004..2f9fa27e5a3c 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -151,6 +151,7 @@ static void xen_hvm_crash_shutdown(struct pt_regs *regs) =20 static int xen_cpu_up_prepare_hvm(unsigned int cpu) { + u32 cpu_uid; int rc =3D 0; =20 /* @@ -161,8 +162,8 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu) */ xen_uninit_lock_cpu(cpu); =20 - if (cpu_acpi_id(cpu) !=3D CPU_ACPIID_INVALID) - per_cpu(xen_vcpu_id, cpu) =3D cpu_acpi_id(cpu); + if (acpi_get_cpu_uid(cpu, &cpu_uid) =3D=3D 0) + per_cpu(xen_vcpu_id, cpu) =3D cpu_uid; else per_cpu(xen_vcpu_id, cpu) =3D cpu; xen_vcpu_setup(cpu); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 035094a55f18..90a1fdcb7eb9 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -324,7 +324,6 @@ int acpi_unmap_cpu(int cpu); =20 acpi_handle acpi_get_processor_handle(int cpu); =20 -#ifndef CONFIG_X86 /* * acpi_get_cpu_uid() - Get ACPI Processor UID of a specified CPU from MAD= T table * @cpu: Logical CPU number (0-based) @@ -335,7 +334,6 @@ acpi_handle acpi_get_processor_handle(int cpu); * -ENODEV if the ACPI Processor UID for the specified CPU is not = found. */ int acpi_get_cpu_uid(unsigned int cpu, u32 *uid); -#endif =20 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr); --=20 2.17.1