From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0D78109023F for ; Thu, 19 Mar 2026 15:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GfdPSA3r6hD/sOd7m1yVnYhn0ji4aChoCLlW6UmYM7s=; b=ODSNZkw6lXzwrU kCAnBYyMsf1r9LrgoyrGPZbZ9VWxOX6hq4jZBbtDwNSw1xoDWDgOnb1aJaavMu+2MARSIdhmu80b4 F+cvjKXJ3yvCFrlyuImUzHh6RVFehtZmgs8a9TPlpU6mZ4P965onC4JmmssV8GIkvTUjqKbuxc030 Y9QnO1IjL/6nnmQ2mGzp616degLBUX5z9lGqvBh0VeikGxbGDg7bPwBy3r3C1jzRhLKB5qlWal7xc GWmmxa/eAbhSlZEMprkF4bMzNvhFZdUDaf7FBogNraf4LgnwZ9dGRUKaJ/7F1FQWxljKC/o3sOxeN YUhXKqhUUQXiMpZuC9rA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w3FZn-0000000AwAA-3iJU; Thu, 19 Mar 2026 15:46:23 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w3FZk-0000000Aw97-4BKm for linux-riscv@lists.infradead.org; Thu, 19 Mar 2026 15:46:22 +0000 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62JEJOTI4156100 for ; Thu, 19 Mar 2026 15:46:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=DvNqP241qE8dFBqHq5L6qVz4 ghSD7knOgVJYfSQ1B58=; b=Yld7gZy2Vwg7aTwn9M0NrrFrVWWy2GG/gLK7dKB6 3Xxqr/TDd+CZGMnsnJPz/K3Qa/xinQn4bBim6e/SIY2lxHC59LsOg3Ir/Bzop+FN nXALqgBdEtgGwTx4hrDwAIgi3E++GbgchA/Tb9JqtNNJE0lGCxQFp70ZN7dnnhpb gA2H4CjR3pEBLlK1y3IKFMLVtPdf3IqARQSJUG53twBLZifGbwlK4ijMhGb9hsol oPtOLe3EiflHII4K6ErRMacybeKHiy5UDD1BRgXKQBSo5+2t7g6sdf7GTIUnXg7/ 1fuSHqndq50QugXJHsDKcZ6CqP2RsEPQJBrTEF2i7yH6vg== Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d0jt90ab8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 19 Mar 2026 15:46:19 +0000 (GMT) Received: by mail-vs1-f69.google.com with SMTP id ada2fe7eead31-6028957144bso1618012137.2 for ; Thu, 19 Mar 2026 08:46:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773935177; x=1774539977; darn=lists.infradead.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=DvNqP241qE8dFBqHq5L6qVz4ghSD7knOgVJYfSQ1B58=; b=Fu21YFnDGogecPCrSv+Bu8lcy5ftUPu4Doi1x8+68+S8Fk/9YJzVy7rpBopM691FRI Z0jmhOr2K2/LRwPRrlO8hl6afa/jHUqNemIZ+fWnaj1YJgIXr3rJS2qHGV559ZWOpA3s p6LYtzlhK9paFrHYoVojyVzWSYfOfja/3b394AJu6LGQMZSq3E2R9UZA4hdLOZLtBHXV 7dzGkHoGPPASjhFkaYUHh9fb5ucG7tcC7vb4g0F5yiocpeOA5Ksqn3dQ0Z2DzA7TJBmD yJVcnNPn0ANSsOey9HHTRf3v3YCFdV6OSWO4ooYQZG+jABMDLTImvMJJv+FRDo671EV7 JozA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773935177; x=1774539977; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=DvNqP241qE8dFBqHq5L6qVz4ghSD7knOgVJYfSQ1B58=; b=gbirp65AzyRtljqgFR8S1T9iCjgU9PdM25dsi9SlfF2PWZbyCbRAJdltohgw6YAuHT 7lxXVEJnowDTGPIaSPl5jpX+vhoWjvNAy372iTZrRm10UE6eZWj9lY5xxVCiqStCsNZ0 6qylEnAk4aZni6CTQawgGdFH58SSCR29BNWKdqi3dLjBrj5by2d7K/D6yhwtVbjpO1y2 kaut5nzEEWheikuxv/ZTWUxsKnD+lTwHo7hBwSQOPjEo1pkUUs42rCE2d3TUXw4PK3R6 szbVfsqr1BpGb4e3htDaSIx5TgKVf/iY0L9nx/7ybRnjYTsBwsCLo6joUNtKO8ONIypi U4YA== X-Forwarded-Encrypted: i=1; AJvYcCU16IVDRx+dOe9OI9C3hT/3wFkTQE9L+GC2FVkytm52nq3P22eVXdiFeo5ldpbEHPLPFKF+GuWpgDiinA==@lists.infradead.org X-Gm-Message-State: AOJu0Ywa7u6ZOsoFxCrZCFOs5p0Od0pNdlKpScRVFPSG0CoMwC2eEERt 0Hl74O/SsGjamHArWd1yLf2HKm4OBhONEfvf9EJOi3KQav1nhhRVh4EWVotAjZ2Dp9ILa00GOFL gXQRentKcBdRlQYd9B+7vP5H7mYBcAKf5g9XeMBZJOvgB264KUUn2BImmU6gs51cLZpMQqlg= X-Gm-Gg: ATEYQzymcglH8AcXhCWTmekcuxCIc+6icQS+sgCa7tAsavDNqacWEqvyleGr4iyI2/p xYELyUiycrNUCcEm183teqenhmiPk3HAhcHIdF2l4rpXancV3KCHQ0jfFc94OTF7J3XMR2CpGtO ZpmAGjESSmB1tLOButCXlssftPzy+7+CJtY0dFIoI5OYqgEQUq/t7adoQ3wUajQjoxGEl7zuNiy 0ijZ9x7RrGoGot4Z5Fyp5GmQKWV8y3ADD4fkyuCVX7/DNoo3cREEhXad9Y0So4D5Q9/DL06KnJJ RAZEYF4+uEpGybVdNAsMhj2swyxWebVTHkq6LNB6oVgy7ewvnIDVTBIjqsFfIoNIvF4L0sZWK/K 6I2MOY5CFMTyAVnTNe5nRMKuPmZFnJBk/P6r+qA== X-Received: by 2002:a05:6102:d89:b0:5ff:9d74:967b with SMTP id ada2fe7eead31-6027d330b13mr3043074137.20.1773935177064; Thu, 19 Mar 2026 08:46:17 -0700 (PDT) X-Received: by 2002:a05:6102:d89:b0:5ff:9d74:967b with SMTP id ada2fe7eead31-6027d330b13mr3042963137.20.1773935176396; Thu, 19 Mar 2026 08:46:16 -0700 (PDT) Received: from localhost ([2a01:4b00:b703:c200:1ac0:4dff:fe39:5426]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486f8c40ccbsm129162465e9.9.2026.03.19.08.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2026 08:46:15 -0700 (PDT) From: Punit Agrawal To: Chengwen Feng Subject: Re: [PATCH v9 1/7] arm64/acpi: Add acpi_get_cpu_uid() and switch arm_cspmu to use it In-Reply-To: <20260319065735.45954-2-fengchengwen@huawei.com> (Chengwen Feng's message of "Thu, 19 Mar 2026 14:57:29 +0800") References: <20260319065735.45954-1-fengchengwen@huawei.com> <20260319065735.45954-2-fengchengwen@huawei.com> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Thu, 19 Mar 2026 15:46:14 +0000 Message-ID: <87341vq0u1.fsf@stealth> MIME-Version: 1.0 X-Proofpoint-GUID: aJa8V9pXwNLKWBB1tBLM-AQvlLXZYjYE X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzE5MDEyNCBTYWx0ZWRfX4QEsWkl70A41 X+4PqZmLIQBLJd9x6ZY/1rgaX07XQ0QKxq46+oQGulwbz6GdpAceZi9BI9/vIhkzgBZGUjkADK0 O/uFLhJnLxZ5m7oP6WJlBf6mbGgobFoyOOmhDJC/tOMH+AF5VulGu5giR/z0YVqD7Xa5TmM0iYk m/AYV3Za38umHwXD13feTIKuX01gGhV1q0wi6PWnOD2IDsb8t5FfUKSRh5JC01NmMv95lwpI1SR ZuupTvYxxgpJgXb9ECI1bYkalA7tekXctQ951fajmBr/Xn53PrjpAz5toQPUYGDiL5GrCeeQIAs Jml2OoxeqEDaHkq77jOsmG1FCUQZLcLcBJYhsvmMl6ikZRbqaErwjc6zGYsVInLTMqSOBp619xe OILWJ3Ap8ccAb11gz3Krk5WwLqL+6JkN0nOyI5S+Re6WNX8Vuk3hfXZu8ZgqNX9tYETWUPO83s6 pGggqIY/TriUvs51ugg== X-Proofpoint-ORIG-GUID: aJa8V9pXwNLKWBB1tBLM-AQvlLXZYjYE X-Authority-Analysis: v=2.4 cv=FKMWBuos c=1 sm=1 tr=0 ts=69bc1a4b cx=c_pps a=5HAIKLe1ejAbszaTRHs9Ug==:117 a=xqWC_Br6kY4A:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=i0EeH86SAAAA:8 a=VwQbUJbxAAAA:8 a=Gl9ZV0r3yxOOH3mhj0oA:9 a=gYDTvv6II1OnSo0itH1n:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-19_02,2026-03-19_05,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1011 adultscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603190124 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260319_084621_065263_518167A9 X-CRM114-Status: GOOD ( 31.51 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , x86@kernel.org, heinrich.schuchardt@canonical.com, liuyonglong@huawei.com, anshuman.khandual@arm.com, "Rafael J . Wysocki" , Kees Cook , Catalin Marinas , Dave Hansen , Eric.VanTassell@amd.com, Somnath Kotur , Sohil Mehta , Kai Huang , Kevin Loughlin , punit.agrawal@oss.qualcomm.com, "H . Peter Anvin" , Ilkka Koskinen , WANG Xuerui , Will Deacon , Thorsten Blum , linux-acpi@vger.kernel.org, Alexandre Ghiti , Jonathan Corbet , masahiroy@kernel.org, Huacai Chen , linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, Peter Zijlstra , Pawan Gupta , Yanteng Si , linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Zheyun Shen , Len Brown , Tom Lendacky , Thomas Huth , Albert Ou , ryan.roberts@arm.com, "Ahmed S . Darwish" , Ma Ke , suzuki.poulose@arm.com, James Clark , Wei Huang , Besar Wicaksono , Borislav Petkov , loongarch@lists.linux.dev, Shuah Khan , Bjorn Helgaas , Boris Ostrovsky , Xin Li , Andy Gospodarek , Ingo Molnar , wanghuiqiang@huawei.com, Juergen Gross , wangyuquan1236@phytium.com.cn, Sean Christopherson , guohanjun@huawei.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux-perf-users@vger.kernel.org, wangzhou1@hisilicon.com, Palmer Dabbelt , Thomas Gleixner , Jonathan Cameron , chenl311@chinatelecom.cn, Paul Walmsley , Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Chengwen Feng writes: > Add arch-specific acpi_get_cpu_uid() for arm64, and update dependent > code: > - Declare acpi_get_cpu_uid() in arch/arm64/include/asm/acpi.h > - Implement acpi_get_cpu_uid() with input parameter validation > - Replace get_acpi_id_for_cpu() with acpi_get_cpu_uid() in > drivers/perf/arm_cspmu/arm_cspmu.c > - Reimplement get_cpu_for_acpi_id() based on acpi_get_cpu_uid() (to > align with new interface) and move its implementation next to > acpi_get_cpu_uid() There is no benefit in describing the code changes like this in the commit log. It makes it hard to follow the intent of the patch. > This is the first step towards unifying ACPI CPU UID retrieval interface > across architectures, while adding input validation for robustness. I would simplify the commit log to something along the lines of - As a step towards unifying the interface for retrieving ACPI CPU uid across architectures, introduce a new function acpi_get_cpu_uid(). While at it, also add input validation to make the code more robust. Just my 2c. The code changes looks fine. > Cc: stable@vger.kernel.org > Signed-off-by: Chengwen Feng > Reviewed-by: Jonathan Cameron > --- > arch/arm64/include/asm/acpi.h | 14 ++------------ > arch/arm64/kernel/acpi.c | 30 ++++++++++++++++++++++++++++++ > drivers/perf/arm_cspmu/arm_cspmu.c | 6 ++++-- > 3 files changed, 36 insertions(+), 14 deletions(-) > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h > index c07a58b96329..2219a3301e72 100644 > --- a/arch/arm64/include/asm/acpi.h > +++ b/arch/arm64/include/asm/acpi.h > @@ -118,18 +118,8 @@ static inline u32 get_acpi_id_for_cpu(unsigned int cpu) > { > return acpi_cpu_get_madt_gicc(cpu)->uid; > } > - > -static inline int get_cpu_for_acpi_id(u32 uid) > -{ > - int cpu; > - > - for (cpu = 0; cpu < nr_cpu_ids; cpu++) > - if (acpi_cpu_get_madt_gicc(cpu) && > - uid == get_acpi_id_for_cpu(cpu)) > - return cpu; > - > - return -EINVAL; > -} > +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid); > +int get_cpu_for_acpi_id(u32 uid); > > static inline void arch_fix_phys_package_id(int num, u32 slot) { } > void __init acpi_init_cpus(void); > diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c > index af90128cfed5..24b9d934be54 100644 > --- a/arch/arm64/kernel/acpi.c > +++ b/arch/arm64/kernel/acpi.c > @@ -458,3 +458,33 @@ int acpi_unmap_cpu(int cpu) > } > EXPORT_SYMBOL(acpi_unmap_cpu); > #endif /* CONFIG_ACPI_HOTPLUG_CPU */ > + > +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid) > +{ > + struct acpi_madt_generic_interrupt *gicc; > + > + if (cpu >= nr_cpu_ids) > + return -EINVAL; > + > + gicc = acpi_cpu_get_madt_gicc(cpu); > + if (!gicc) > + return -ENODEV; > + > + *uid = gicc->uid; > + return 0; > +} > +EXPORT_SYMBOL_GPL(acpi_get_cpu_uid); > + > +int get_cpu_for_acpi_id(u32 uid) > +{ > + u32 cpu_uid; > + int ret; > + > + for (int cpu = 0; cpu < nr_cpu_ids; cpu++) { > + ret = acpi_get_cpu_uid(cpu, &cpu_uid); > + if (ret == 0 && uid == cpu_uid) > + return cpu; > + } > + > + return -EINVAL; > +} > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c > index 34430b68f602..ed72c3d1f796 100644 > --- a/drivers/perf/arm_cspmu/arm_cspmu.c > +++ b/drivers/perf/arm_cspmu/arm_cspmu.c > @@ -1107,15 +1107,17 @@ static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu) > { > struct acpi_apmt_node *apmt_node; > int affinity_flag; > + u32 cpu_uid; > int cpu; > + int ret; > > apmt_node = arm_cspmu_apmt_node(cspmu->dev); > affinity_flag = apmt_node->flags & ACPI_APMT_FLAGS_AFFINITY; > > if (affinity_flag == ACPI_APMT_FLAGS_AFFINITY_PROC) { > for_each_possible_cpu(cpu) { > - if (apmt_node->proc_affinity == > - get_acpi_id_for_cpu(cpu)) { > + ret = acpi_get_cpu_uid(cpu, &cpu_uid); > + if (ret == 0 && apmt_node->proc_affinity == cpu_uid) { > cpumask_set_cpu(cpu, &cspmu->associated_cpus); > break; > } I think cspmu changes go via a separate pull request. You might have to split this change into a separate commit. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv