From nobody Mon Mar 23 21:25:53 2026 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (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 DE4AD3624D3; Wed, 18 Mar 2026 06:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.216 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773813732; cv=none; b=jrRzfakl61ocy8UsID1SWvZTUpHZLyEmtIOT2J5iHAGMWP9xTCHYGTjpQ0SH0XOEri/pP6IDhFKYeQhb6PWxeAT8UGmNfXBjhnF6z398VckHb6rpkY+0WOC6hfZEzzSLS2BbtkosRQtYYJZBCznwe+gt2V2LShkppbxtQYhwv1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773813732; c=relaxed/simple; bh=WRCCUwmTChYlrdA5NgBAWHNHs7HBwksCQY9PXLu3poo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KNhicCWAT+IjsrkAuvqlOkkVVPVmP+J5APCI9LSBqCvDuTzt0Vg1+UTG/2KoVqd1gKPm5XI2wFT+QQ6zCP5Sw/ARmE25UHTcOaIaKIiDSLe/+e+NS5KgySTaL2gOtwmYKwLk1Ev88AQKxdWMD2JN9fxrZ3FSV0yZcvMxBafeLFs= 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; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=DpIEqq/C; arc=none smtp.client-ip=113.46.200.216 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="DpIEqq/C" 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= Received: from mail.maildlp.com (unknown [172.19.162.223]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4fbJ480tSwz1T4g5; Wed, 18 Mar 2026 13:56:40 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id 2521240569; Wed, 18 Mar 2026 14:02:01 +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; Wed, 18 Mar 2026 14:01:59 +0800 From: Chengwen Feng To: Bjorn Helgaas , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" CC: Jonathan Corbet , Ingo Molnar , 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 v8 2/3] x86: Implement acpi_get_cpu_uid() Date: Wed, 18 Mar 2026 14:01:50 +0800 Message-ID: <20260318060151.29438-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260318060151.29438-1-fengchengwen@huawei.com> References: <20260318060151.29438-1-fengchengwen@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemk500009.china.huawei.com (7.202.194.94) 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