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 5DB8DF0181F for ; Fri, 6 Mar 2026 10:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:CC:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VsmeqtSm7mke7KS0Z1wWxaKBE2jgtwzcdpHn7/HgkiI=; b=JIdZzeRi6e3/Q/WAmTFDDmyigc 8ke1eCqA7y7NfJ4lHiz1TDvV9kfdHDuy9/y0j4L3eTtggD2Dft5AKwZgI63NIZosTXRjImmQsXA/y +9xAw5Zl/SdR0+9ixZIAwW6FlGoieHx+4R46XlFFDi3pDJukuIc2ioaCHG6ObIxWJvLyqQPNHNEko EFb1ArhpF7d56YhdyrX5s6DpahEpM2sP4J4EY3jqUJZNMDQIPg7JN2Dq0ZEk4Fy2/t4P5QJFuw+V9 jzghuj9nVCPEiC6EJu12RftdOhHdReFzi8SuA31T7vSfTIk9O0n1url6/CpjDuFyBwPa76l6PApqv nhTgnZdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vyS0x-00000003P99-2R9H; Fri, 06 Mar 2026 10:02:35 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vyS0u-00000003P8c-1cgK; Fri, 06 Mar 2026 10:02:34 +0000 Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fS2454tK9zHnH5p; Fri, 6 Mar 2026 18:01:25 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id 214B440086; Fri, 6 Mar 2026 18:02:25 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 6 Mar 2026 10:02:23 +0000 Date: Fri, 6 Mar 2026 10:01:50 +0000 From: Jonathan Cameron To: Chengwen Feng CC: , , Jonathan Corbet , Shuah Khan , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Sunil V L , Mark Rutland , "Eric Van Tassell" , Wei Huang , "Ajit Khaparde" , Andy Gospodarek , , , , , , , , , , Somnath Kotur , , , , , , Subject: Re: [PATCH v3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform Message-ID: <20260306100150.00003f38@huawei.com> In-Reply-To: <20260306021920.23233-1-fengchengwen@huawei.com> References: <20260303003625.39035-1-fengchengwen@huawei.com> <20260306021920.23233-1-fengchengwen@huawei.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.15] X-ClientProxiedBy: lhrpeml500012.china.huawei.com (7.191.174.4) To dubpeml500005.china.huawei.com (7.214.145.207) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260306_020232_759509_EEEEAAF7 X-CRM114-Status: GOOD ( 22.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 6 Mar 2026 10:19:17 +0800 Chengwen Feng wrote: > Currently the pcie_tph_get_cpu_st() has an issue on ARM64 platform: > 1. The pcie_tph_get_cpu_st() function directly uses cpu_uid as the input > parameter to call the PCI ACPI DSM method. According to the DSM > definition, the input value should be the ACPI Processor UID (see [1] > for details). > 2. In the Broadcom driver implementation [2] (which invokes > pcie_tph_get_cpu_st()), cpu_uid is obtained via > cpumask_first(irq->cpu_mask) - this is the logical CPU ID of a CPU > core, generated and managed by kernel (e.g., [0,255] for a system > with 256 logical CPU cores). > 3. On ARM64 platforms, ACPI assigns Processor UID to cores listed in the > MADT table, and this UID may not match the kernel's logical CPU ID. > As a result, the current implementation fails to retrieve the correct > CPU steer-tag in such cases. > 4. The function works on AMD x86 platforms only because the logical CPU > ID is identical to the ACPI Processor UID on those systems. > > This commit fixes it by: > 1. For ACPI-enabled platforms, unify the CPU ACPI ID retrieval > interface: > - On arm64/riscv/loongarch: Rename existing get_acpi_id_for_cpu() to > acpi_get_cpu_acpi_id(). > - On x86: Add new acpi_get_cpu_acpi_id() implementation that wraps > cpu_acpi_id(). > 2. Update pcie_tph_get_cpu_st() to use acpi_get_cpu_acpi_id(cpu) to get > valid ACPI Processor UID for DSM calls. > 3. Renaming pcie_tph_get_cpu_st()'s input parameter cpu_uid to cpu for > clarity, as the parameter now represents a logical CPU ID (not a > UID). > > [1] According to ECN_TPH-ST_Revision_20200924 > (https://members.pcisig.com/wg/PCI-SIG/document/15470), the input > is defined as: "If the target is a processor, then this field > represents the ACPI Processor UID of the processor as specified in > the MADT. If the target is a processor container, then this field > represents the ACPI Processor UID of the processor container as > specified in the PPTT." > [2] commit c214410c47d6e ("bnxt_en: Add TPH support in BNXT driver") > > Fixes: d2e8a34876ce ("PCI/TPH: Add Steering Tag support") > Cc: stable@vger.kernel.org > Signed-off-by: Chengwen Feng > > --- > Changes in v3: > - Rename existing get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() other > than add one new API. Ah. I wasn't clear around that rename suggestion. Split this into two patches. 1) Rename 2) The new stuff plus x86 implementation. > > Changes in v2: > - Add ECN _DSM reference doc name and its URL. > - Separate implement acpi_get_cpu_acpi_id() in each arch which supports > ACPI. > - Refine commit-log. > > --- > Documentation/PCI/tph.rst | 4 ++-- > arch/arm64/include/asm/acpi.h | 4 ++-- > arch/loongarch/include/asm/acpi.h | 2 +- > arch/riscv/include/asm/acpi.h | 2 +- > arch/riscv/kernel/acpi_numa.c | 2 +- > arch/x86/include/asm/acpi.h | 2 ++ > arch/x86/kernel/cpu/common.c | 8 ++++++++ > drivers/acpi/pptt.c | 16 ++++++++-------- > drivers/acpi/riscv/rhct.c | 2 +- > drivers/pci/tph.c | 11 ++++++----- > drivers/perf/arm_cspmu/arm_cspmu.c | 2 +- > include/linux/pci-tph.h | 4 ++-- > 12 files changed, 35 insertions(+), 24 deletions(-)