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=1773976707; cv=none; d=zohomail.com; s=zohoarc; b=ZTr37sa1Kjb7OFPpHxP6zImS3A/fD1xNlc3P4ixOQb81MMJqZDZqwUa92rAiveBZ86CYeXHHC1G+xjFMMhrUxtX9n3CNBv3/b5WA4qQmMbhmbQzmliOcAwKxyJcDLUIc0n5fn+9deFu9WIUVW+Z8GF1T1EChIiZ1NalscWNCX/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773976707; 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=BAu9Jx0jggsoB9DdjhBMDzv6GW2fgZQZhQIfabnTV1w=; b=GjeUqXgKg1nb4w7yMVbtN68WlPwgh1Sw1JyejpsWSIGvHIRVTdy9mdTBOShLsCkUuwXC2LrIdwTDNqOLnO+dDTC8RS5cim0XyEztgwZdRdNMIrYwYOBPaVpeXWLo0F0DxWRushRKDIbsnjHvs0xVJxK5kpS8K1lHaIx2wWXeJRI= 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 1773976707009408.4791542020304; Thu, 19 Mar 2026 20:18:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1257683.1551971 (Exim 4.92) (envelope-from ) id 1w3QN1-0004AA-DO; Fri, 20 Mar 2026 03:17:55 +0000 Received: by outflank-mailman (output) from mailman id 1257683.1551971; Fri, 20 Mar 2026 03:17:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w3QN1-00049y-9y; Fri, 20 Mar 2026 03:17:55 +0000 Received: by outflank-mailman (input) for mailman id 1257683; Fri, 20 Mar 2026 03:17:54 +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 1w3QMz-00049n-Km for xen-devel@lists.xenproject.org; Fri, 20 Mar 2026 03:17:54 +0000 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5f630e5d-240b-11f1-b164-2bf370ae4941; Fri, 20 Mar 2026 04:17:52 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.214]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4fcSK00QGxz1K96X; Fri, 20 Mar 2026 11:11:48 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id 1E5564056C; Fri, 20 Mar 2026 11:17:48 +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, 20 Mar 2026 11:17:46 +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: 5f630e5d-240b-11f1-b164-2bf370ae4941 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=BAu9Jx0jggsoB9DdjhBMDzv6GW2fgZQZhQIfabnTV1w=; b=0iNno9KssbzJIwOx46kM6OnZNBBxZqavG7rHHC5bdLxsRgIt4sx/XNjUZTTVDZXEoVFcegx0c Yif2aSgMI7B+vjuMbgqzpMuvUrJW1SQ8yRstGcNtfNLWFUMM/xjzPhZAjZffDLNoeTFLUbEByDb +8fyvzP5gn6CQVDmf4awY48= From: Chengwen Feng To: Bjorn Helgaas , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" CC: Jonathan Corbet , Palmer Dabbelt , Borislav Petkov , "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 v10 2/8] LoongArch: Add acpi_get_cpu_uid() for unified ACPI CPU UID retrieval Date: Fri, 20 Mar 2026 11:17:31 +0800 Message-ID: <20260320031737.35048-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260320031737.35048-1-fengchengwen@huawei.com> References: <20260320031737.35048-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemk500009.china.huawei.com (7.202.194.94) X-ZohoMail-DKIM: pass (identity @huawei.com) X-ZM-MESSAGEID: 1773976709270158500 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As a step towards unifying the interface for retrieving ACPI CPU UID across architectures, introduce a new function acpi_get_cpu_uid() for loongarch. While at it, add input validation to make the code more robust. Cc: stable@vger.kernel.org Signed-off-by: Chengwen Feng Reviewed-by: Jonathan Cameron --- arch/loongarch/include/asm/acpi.h | 1 + arch/loongarch/kernel/acpi.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm= /acpi.h index 7376840fa9f7..8bb101b4557e 100644 --- a/arch/loongarch/include/asm/acpi.h +++ b/arch/loongarch/include/asm/acpi.h @@ -44,6 +44,7 @@ static inline u32 get_acpi_id_for_cpu(unsigned int cpu) { return acpi_core_pic[cpu_logical_map(cpu)].processor_id; } +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid); =20 #endif /* !CONFIG_ACPI */ =20 diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c index 1367ca759468..058f0dbe8e8f 100644 --- a/arch/loongarch/kernel/acpi.c +++ b/arch/loongarch/kernel/acpi.c @@ -385,3 +385,12 @@ int acpi_unmap_cpu(int cpu) EXPORT_SYMBOL(acpi_unmap_cpu); =20 #endif /* CONFIG_ACPI_HOTPLUG_CPU */ + +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid) +{ + if (cpu >=3D nr_cpu_ids) + return -EINVAL; + *uid =3D acpi_core_pic[cpu_logical_map(cpu)].processor_id; + return 0; +} +EXPORT_SYMBOL_GPL(acpi_get_cpu_uid); --=20 2.17.1