From nobody Tue Apr 7 19:41:03 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=1773300236; cv=none; d=zohomail.com; s=zohoarc; b=mNjAJR0GOZcD2H58nDCKosC4pYMk0mA02ou57uwW308IlYVWnAXPsAKTBaSnkdq4tuoU1L1ohqftVyYPPbz8spdZ2H2HNSbfdf7IiVnf8mBqUK6u9Unuiaof7vwvOzE7h2VYlHGv5QrwUhRqvbqdEXI/OWrrVybAJcCaxyR/tYc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773300236; 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=jAGDg23Jh/R/fMlBCmfhZTnUH5xG89AkPnX8VI3PuSc=; b=XfJMugnLRNuBa37UXUJwljA2qJdTDMKtORUzKmgfWL305LIam9FWQiKgZVbj1zM7QuFbzOeP1K+Z8WpLVsqkDfxQMjlP+xJg4w2T/Ebw8PQEJulJN+D0nR0mzEG/A3yzEzyFWltHpe/40kX2k2LMWtPGJ/hFEnqOug2TTaBAxGI= 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 1773300236285657.1382194911452; Thu, 12 Mar 2026 00:23:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1251725.1548612 (Exim 4.92) (envelope-from ) id 1w0aON-0006Mc-W4; Thu, 12 Mar 2026 07:23:35 +0000 Received: by outflank-mailman (output) from mailman id 1251725.1548612; Thu, 12 Mar 2026 07:23:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0aON-0006LO-QX; Thu, 12 Mar 2026 07:23:35 +0000 Received: by outflank-mailman (input) for mailman id 1251725; Thu, 12 Mar 2026 07:23:34 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w0aOM-0006Jf-LN for xen-devel@lists.xenproject.org; Thu, 12 Mar 2026 07:23:34 +0000 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5e0c6a8d-1de4-11f1-b164-2bf370ae4941; Thu, 12 Mar 2026 08:23:32 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4fWf8m0KGKzcb2t; Thu, 12 Mar 2026 15:18:00 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id 059382025F; Thu, 12 Mar 2026 15:23:28 +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, 12 Mar 2026 15:23:26 +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: 5e0c6a8d-1de4-11f1-b164-2bf370ae4941 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=jAGDg23Jh/R/fMlBCmfhZTnUH5xG89AkPnX8VI3PuSc=; b=RZuHUqv6BgF0qFidhU7XyV96mfaXB8HmU+gF/dxnCky1vEzSjWha4fDbKoycbuQDQvVxDdSvD F3ZRjdtTrzq0aMjyOfLURpFQuaD9wO3MVCZ6p1jSi4feVktW9fyKpxdOUQJLnFp1kyELp/UmvPE wMvodw5e+OYblCFU1fhzvXk= 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 v6 2/3] x86: Implement acpi_get_cpu_uid() Date: Thu, 12 Mar 2026 15:23:15 +0800 Message-ID: <20260312072316.4806-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260312072316.4806-1-fengchengwen@huawei.com> References: <20260312072316.4806-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk500009.china.huawei.com (7.202.194.94) X-ZohoMail-DKIM: pass (identity @huawei.com) X-ZM-MESSAGEID: 1773300238421154100 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/cpu/common.c | 15 +++++++++++++++ arch/x86/xen/enlighten_hvm.c | 5 +++-- include/linux/acpi.h | 2 -- 5 files changed, 18 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/cpu/common.c b/arch/x86/kernel/cpu/common.c index 1c3261cae40c..3081557542c7 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -2643,3 +2645,16 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid) +{ + if (cpu >=3D nr_cpu_ids) + return -EINVAL; +#ifndef CONFIG_SMP + *uid =3D 0; +#else + *uid =3D per_cpu(x86_cpu_to_acpiid, cpu); +#endif + 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