* [PATCH v3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform [not found] <20260303003625.39035-1-fengchengwen@huawei.com> @ 2026-03-06 2:19 ` Chengwen Feng 2026-03-06 10:01 ` Jonathan Cameron [not found] ` <20260309041659.18815-1-fengchengwen@huawei.com> 1 sibling, 1 reply; 7+ messages in thread From: Chengwen Feng @ 2026-03-06 2:19 UTC (permalink / raw) To: linux-pci, bhelgaas, 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, x86, H. Peter Anvin, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland, Eric Van Tassell, Wei Huang, Ajit Khaparde, Andy Gospodarek Cc: linux-acpi, jonathan.cameron, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, Chengwen Feng, Somnath Kotur, linux-doc, linux-kernel, linux-arm-kernel, loongarch, linux-riscv, linux-perf-users 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 <fengchengwen@huawei.com> --- Changes in v3: - Rename existing get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() other than add one new API. 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(-) diff --git a/Documentation/PCI/tph.rst b/Documentation/PCI/tph.rst index e8993be64fd6..b6cf22b9bd90 100644 --- a/Documentation/PCI/tph.rst +++ b/Documentation/PCI/tph.rst @@ -79,10 +79,10 @@ To retrieve a Steering Tag for a target memory associated with a specific CPU, use the following function:: int pcie_tph_get_cpu_st(struct pci_dev *pdev, enum tph_mem_type type, - unsigned int cpu_uid, u16 *tag); + unsigned int cpu, u16 *tag); The `type` argument is used to specify the memory type, either volatile -or persistent, of the target memory. The `cpu_uid` argument specifies the +or persistent, of the target memory. The `cpu` argument specifies the CPU where the memory is associated to. After the ST value is retrieved, the device driver can use the following diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c07a58b96329..202107aeb05b 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -114,7 +114,7 @@ static inline bool acpi_has_cpu_in_madt(void) } struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu); -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) { return acpi_cpu_get_madt_gicc(cpu)->uid; } @@ -125,7 +125,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) for (cpu = 0; cpu < nr_cpu_ids; cpu++) if (acpi_cpu_get_madt_gicc(cpu) && - uid == get_acpi_id_for_cpu(cpu)) + uid == acpi_get_cpu_acpi_id(cpu)) return cpu; return -EINVAL; diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h index 7376840fa9f7..89c6c8f52cc3 100644 --- a/arch/loongarch/include/asm/acpi.h +++ b/arch/loongarch/include/asm/acpi.h @@ -40,7 +40,7 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC]; extern int __init parse_acpi_topology(void); -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) { return acpi_core_pic[cpu_logical_map(cpu)].processor_id; } diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 6e13695120bc..1d23681b61b5 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -61,7 +61,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } void acpi_init_rintc_map(void); struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); -static inline u32 get_acpi_id_for_cpu(int cpu) +static inline u32 acpi_get_cpu_acpi_id(int cpu) { return acpi_cpu_get_madt_rintc(cpu)->uid; } diff --git a/arch/riscv/kernel/acpi_numa.c b/arch/riscv/kernel/acpi_numa.c index 130769e3a99c..c2eb4824d0f7 100644 --- a/arch/riscv/kernel/acpi_numa.c +++ b/arch/riscv/kernel/acpi_numa.c @@ -40,7 +40,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) int cpu; for (cpu = 0; cpu < nr_cpu_ids; cpu++) - if (uid == get_acpi_id_for_cpu(cpu)) + if (uid == acpi_get_cpu_acpi_id(cpu)) return cpu; return -EINVAL; diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index a03aa6f999d1..b968369715c1 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -157,6 +157,8 @@ static inline bool acpi_has_cpu_in_madt(void) return !!acpi_lapic; } +u32 acpi_get_cpu_acpi_id(unsigned int cpu); + #define ACPI_HAVE_ARCH_SET_ROOT_POINTER static __always_inline void acpi_arch_set_root_pointer(u64 addr) { diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 1c3261cae40c..1c7aa7a4faa0 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -29,6 +29,7 @@ #include <linux/utsname.h> #include <linux/efi.h> +#include <asm/acpi.h> #include <asm/alternative.h> #include <asm/cmdline.h> #include <asm/cpuid/api.h> @@ -57,6 +58,7 @@ #include <asm/asm.h> #include <asm/bugs.h> #include <asm/cpu.h> +#include <asm/smp.h> #include <asm/mce.h> #include <asm/msr.h> #include <asm/cacheinfo.h> @@ -2643,3 +2645,9 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +u32 acpi_get_cpu_acpi_id(unsigned int cpu) +{ + return cpu_acpi_id(cpu); +} +EXPORT_SYMBOL_GPL(acpi_get_cpu_acpi_id); diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index de5f8c018333..c1a8fba4c2b2 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -459,7 +459,7 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table, { struct acpi_pptt_cache *found_cache; struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct cacheinfo *this_leaf; unsigned int index = 0; struct acpi_pptt_processor *cpu_node = NULL; @@ -546,7 +546,7 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, unsigned int cpu, int level, int flag) { struct acpi_pptt_processor *cpu_node; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (cpu_node) { @@ -622,7 +622,7 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) { struct acpi_table_header *table; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_processor *cpu_node = NULL; int ret = -ENOENT; @@ -671,7 +671,7 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels, pr_debug("Cache Setup: find cache levels for CPU=%d\n", cpu); - acpi_cpu_id = get_acpi_id_for_cpu(cpu); + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node) return -ENOENT; @@ -797,7 +797,7 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu) if (!table) return -ENOENT; - acpi_cpu_id = get_acpi_id_for_cpu(cpu); + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node || !cpu_node->parent) return -ENOENT; @@ -872,7 +872,7 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_header *table_hdr, cpumask_clear(cpus); for_each_possible_cpu(cpu) { - acpi_id = get_acpi_id_for_cpu(cpu); + acpi_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table_hdr, acpi_id); while (cpu_node) { @@ -966,7 +966,7 @@ int find_acpi_cache_level_from_id(u32 cache_id) for_each_possible_cpu(cpu) { bool empty; int level = 1; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; @@ -1030,7 +1030,7 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus) for_each_possible_cpu(cpu) { bool empty; int level = 1; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; diff --git a/drivers/acpi/riscv/rhct.c b/drivers/acpi/riscv/rhct.c index caa2c16e1697..c15ce8c13136 100644 --- a/drivers/acpi/riscv/rhct.c +++ b/drivers/acpi/riscv/rhct.c @@ -44,7 +44,7 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const struct acpi_rhct_isa_string *isa_node; struct acpi_table_rhct *rhct; u32 *hart_info_node_offset; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); BUG_ON(acpi_disabled); diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c index ca4f97be7538..c1bd60637b5a 100644 --- a/drivers/pci/tph.c +++ b/drivers/pci/tph.c @@ -236,18 +236,19 @@ static int write_tag_to_st_table(struct pci_dev *pdev, int index, u16 tag) * with a specific CPU * @pdev: PCI device * @mem_type: target memory type (volatile or persistent RAM) - * @cpu_uid: associated CPU id + * @cpu: associated CPU id * @tag: Steering Tag to be returned * * Return the Steering Tag for a target memory that is associated with a - * specific CPU as indicated by cpu_uid. + * specific CPU as indicated by cpu. * * Return: 0 if success, otherwise negative value (-errno) */ int pcie_tph_get_cpu_st(struct pci_dev *pdev, enum tph_mem_type mem_type, - unsigned int cpu_uid, u16 *tag) + unsigned int cpu, u16 *tag) { #ifdef CONFIG_ACPI + u32 cpu_uid = acpi_get_cpu_acpi_id(cpu); struct pci_dev *rp; acpi_handle rp_acpi_handle; union st_info info; @@ -265,9 +266,9 @@ int pcie_tph_get_cpu_st(struct pci_dev *pdev, enum tph_mem_type mem_type, *tag = tph_extract_tag(mem_type, pdev->tph_req_type, &info); - pci_dbg(pdev, "get steering tag: mem_type=%s, cpu_uid=%d, tag=%#04x\n", + pci_dbg(pdev, "get steering tag: mem_type=%s, cpu=%d, tag=%#04x\n", (mem_type == TPH_MEM_TYPE_VM) ? "volatile" : "persistent", - cpu_uid, *tag); + cpu, *tag); return 0; #else diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 34430b68f602..506b661c60fd 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -1115,7 +1115,7 @@ static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu) if (affinity_flag == ACPI_APMT_FLAGS_AFFINITY_PROC) { for_each_possible_cpu(cpu) { if (apmt_node->proc_affinity == - get_acpi_id_for_cpu(cpu)) { + acpi_get_cpu_acpi_id(cpu)) { cpumask_set_cpu(cpu, &cspmu->associated_cpus); break; } diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h index ba28140ce670..be68cd17f2f8 100644 --- a/include/linux/pci-tph.h +++ b/include/linux/pci-tph.h @@ -25,7 +25,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag); int pcie_tph_get_cpu_st(struct pci_dev *dev, enum tph_mem_type mem_type, - unsigned int cpu_uid, u16 *tag); + unsigned int cpu, u16 *tag); void pcie_disable_tph(struct pci_dev *pdev); int pcie_enable_tph(struct pci_dev *pdev, int mode); u16 pcie_tph_get_st_table_size(struct pci_dev *pdev); @@ -36,7 +36,7 @@ static inline int pcie_tph_set_st_entry(struct pci_dev *pdev, { return -EINVAL; } static inline int pcie_tph_get_cpu_st(struct pci_dev *dev, enum tph_mem_type mem_type, - unsigned int cpu_uid, u16 *tag) + unsigned int cpu, u16 *tag) { return -EINVAL; } static inline void pcie_disable_tph(struct pci_dev *pdev) { } static inline int pcie_enable_tph(struct pci_dev *pdev, int mode) -- 2.17.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform 2026-03-06 2:19 ` [PATCH v3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform Chengwen Feng @ 2026-03-06 10:01 ` Jonathan Cameron 2026-03-09 4:18 ` fengchengwen 0 siblings, 1 reply; 7+ messages in thread From: Jonathan Cameron @ 2026-03-06 10:01 UTC (permalink / raw) To: Chengwen Feng Cc: linux-pci, bhelgaas, 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, x86, H. Peter Anvin, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland, Eric Van Tassell, Wei Huang, Ajit Khaparde, Andy Gospodarek, linux-acpi, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, Somnath Kotur, linux-doc, linux-kernel, linux-arm-kernel, loongarch, linux-riscv, linux-perf-users On Fri, 6 Mar 2026 10:19:17 +0800 Chengwen Feng <fengchengwen@huawei.com> 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 <fengchengwen@huawei.com> > > --- > 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(-) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform 2026-03-06 10:01 ` Jonathan Cameron @ 2026-03-09 4:18 ` fengchengwen 0 siblings, 0 replies; 7+ messages in thread From: fengchengwen @ 2026-03-09 4:18 UTC (permalink / raw) To: Jonathan Cameron Cc: linux-pci, bhelgaas, 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, x86, H. Peter Anvin, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland, Eric Van Tassell, Wei Huang, Ajit Khaparde, Andy Gospodarek, linux-acpi, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, Somnath Kotur, linux-doc, linux-kernel, linux-arm-kernel, loongarch, linux-riscv, linux-perf-users On 3/6/2026 6:01 PM, Jonathan Cameron wrote: > On Fri, 6 Mar 2026 10:19:17 +0800 > Chengwen Feng <fengchengwen@huawei.com> 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 <fengchengwen@huawei.com> >> >> --- >> 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. Hi Jonathan, All fixes are applied in v4. Please review. Thanks. > >> >> 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(-) > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20260309041659.18815-1-fengchengwen@huawei.com>]
* [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 [not found] ` <20260309041659.18815-1-fengchengwen@huawei.com> @ 2026-03-09 4:16 ` Chengwen Feng 2026-03-09 10:30 ` Jonathan Cameron 2026-03-09 13:29 ` Huacai Chen 0 siblings, 2 replies; 7+ messages in thread From: Chengwen Feng @ 2026-03-09 4:16 UTC (permalink / raw) To: linux-pci, bhelgaas, Catalin Marinas, Will Deacon, Huacai Chen, WANG Xuerui, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland Cc: linux-acpi, wei.huang2, Eric.VanTassell, jonathan.cameron, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, Chengwen Feng, linux-arm-kernel, linux-kernel, loongarch, linux-riscv, linux-perf-users To unify the CPU ACPI ID retrieval interface across architectures, rename the existing get_acpi_id_for_cpu() function to acpi_get_cpu_acpi_id() on arm64/riscv/loongarch platforms. This is a pure rename with no functional change, preparing for a consistent ACPI Processor UID retrieval interface across all ACPI-enabled platforms. Cc: stable@vger.kernel.org Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> --- 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 +- drivers/acpi/pptt.c | 16 ++++++++-------- drivers/acpi/riscv/rhct.c | 2 +- drivers/perf/arm_cspmu/arm_cspmu.c | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index c07a58b96329..202107aeb05b 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -114,7 +114,7 @@ static inline bool acpi_has_cpu_in_madt(void) } struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu); -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) { return acpi_cpu_get_madt_gicc(cpu)->uid; } @@ -125,7 +125,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) for (cpu = 0; cpu < nr_cpu_ids; cpu++) if (acpi_cpu_get_madt_gicc(cpu) && - uid == get_acpi_id_for_cpu(cpu)) + uid == acpi_get_cpu_acpi_id(cpu)) return cpu; return -EINVAL; diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h index 7376840fa9f7..89c6c8f52cc3 100644 --- a/arch/loongarch/include/asm/acpi.h +++ b/arch/loongarch/include/asm/acpi.h @@ -40,7 +40,7 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC]; extern int __init parse_acpi_topology(void); -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) { return acpi_core_pic[cpu_logical_map(cpu)].processor_id; } diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 6e13695120bc..1d23681b61b5 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -61,7 +61,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } void acpi_init_rintc_map(void); struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); -static inline u32 get_acpi_id_for_cpu(int cpu) +static inline u32 acpi_get_cpu_acpi_id(int cpu) { return acpi_cpu_get_madt_rintc(cpu)->uid; } diff --git a/arch/riscv/kernel/acpi_numa.c b/arch/riscv/kernel/acpi_numa.c index 130769e3a99c..c2eb4824d0f7 100644 --- a/arch/riscv/kernel/acpi_numa.c +++ b/arch/riscv/kernel/acpi_numa.c @@ -40,7 +40,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) int cpu; for (cpu = 0; cpu < nr_cpu_ids; cpu++) - if (uid == get_acpi_id_for_cpu(cpu)) + if (uid == acpi_get_cpu_acpi_id(cpu)) return cpu; return -EINVAL; diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index de5f8c018333..c1a8fba4c2b2 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -459,7 +459,7 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table, { struct acpi_pptt_cache *found_cache; struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct cacheinfo *this_leaf; unsigned int index = 0; struct acpi_pptt_processor *cpu_node = NULL; @@ -546,7 +546,7 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, unsigned int cpu, int level, int flag) { struct acpi_pptt_processor *cpu_node; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (cpu_node) { @@ -622,7 +622,7 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) { struct acpi_table_header *table; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_processor *cpu_node = NULL; int ret = -ENOENT; @@ -671,7 +671,7 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels, pr_debug("Cache Setup: find cache levels for CPU=%d\n", cpu); - acpi_cpu_id = get_acpi_id_for_cpu(cpu); + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node) return -ENOENT; @@ -797,7 +797,7 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu) if (!table) return -ENOENT; - acpi_cpu_id = get_acpi_id_for_cpu(cpu); + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table, acpi_cpu_id); if (!cpu_node || !cpu_node->parent) return -ENOENT; @@ -872,7 +872,7 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_header *table_hdr, cpumask_clear(cpus); for_each_possible_cpu(cpu) { - acpi_id = get_acpi_id_for_cpu(cpu); + acpi_id = acpi_get_cpu_acpi_id(cpu); cpu_node = acpi_find_processor_node(table_hdr, acpi_id); while (cpu_node) { @@ -966,7 +966,7 @@ int find_acpi_cache_level_from_id(u32 cache_id) for_each_possible_cpu(cpu) { bool empty; int level = 1; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; @@ -1030,7 +1030,7 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus) for_each_possible_cpu(cpu) { bool empty; int level = 1; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; diff --git a/drivers/acpi/riscv/rhct.c b/drivers/acpi/riscv/rhct.c index caa2c16e1697..c15ce8c13136 100644 --- a/drivers/acpi/riscv/rhct.c +++ b/drivers/acpi/riscv/rhct.c @@ -44,7 +44,7 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const struct acpi_rhct_isa_string *isa_node; struct acpi_table_rhct *rhct; u32 *hart_info_node_offset; - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); BUG_ON(acpi_disabled); diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index 34430b68f602..506b661c60fd 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -1115,7 +1115,7 @@ static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu) if (affinity_flag == ACPI_APMT_FLAGS_AFFINITY_PROC) { for_each_possible_cpu(cpu) { if (apmt_node->proc_affinity == - get_acpi_id_for_cpu(cpu)) { + acpi_get_cpu_acpi_id(cpu)) { cpumask_set_cpu(cpu, &cspmu->associated_cpus); break; } -- 2.17.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 2026-03-09 4:16 ` [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 Chengwen Feng @ 2026-03-09 10:30 ` Jonathan Cameron 2026-03-09 13:29 ` Huacai Chen 1 sibling, 0 replies; 7+ messages in thread From: Jonathan Cameron @ 2026-03-09 10:30 UTC (permalink / raw) To: Chengwen Feng Cc: linux-pci, bhelgaas, Catalin Marinas, Will Deacon, Huacai Chen, WANG Xuerui, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland, linux-acpi, wei.huang2, Eric.VanTassell, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, linux-arm-kernel, linux-kernel, loongarch, linux-riscv, linux-perf-users On Mon, 9 Mar 2026 12:16:57 +0800 Chengwen Feng <fengchengwen@huawei.com> wrote: > To unify the CPU ACPI ID retrieval interface across architectures, > rename the existing get_acpi_id_for_cpu() function to > acpi_get_cpu_acpi_id() on arm64/riscv/loongarch platforms. > > This is a pure rename with no functional change, preparing for a > consistent ACPI Processor UID retrieval interface across all ACPI-enabled > platforms. > > Cc: stable@vger.kernel.org > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 2026-03-09 4:16 ` [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 Chengwen Feng 2026-03-09 10:30 ` Jonathan Cameron @ 2026-03-09 13:29 ` Huacai Chen 2026-03-10 3:29 ` fengchengwen 1 sibling, 1 reply; 7+ messages in thread From: Huacai Chen @ 2026-03-09 13:29 UTC (permalink / raw) To: Chengwen Feng Cc: linux-pci, bhelgaas, Catalin Marinas, Will Deacon, WANG Xuerui, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland, linux-acpi, wei.huang2, Eric.VanTassell, jonathan.cameron, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, linux-arm-kernel, linux-kernel, loongarch, linux-riscv, linux-perf-users Hi, Chengwen, On Mon, Mar 9, 2026 at 12:17 PM Chengwen Feng <fengchengwen@huawei.com> wrote: > > To unify the CPU ACPI ID retrieval interface across architectures, > rename the existing get_acpi_id_for_cpu() function to > acpi_get_cpu_acpi_id() on arm64/riscv/loongarch platforms. Can we also rename cpu_acpi_id() to acpi_get_cpu_acpi_id() for x86? Huacai > > This is a pure rename with no functional change, preparing for a > consistent ACPI Processor UID retrieval interface across all ACPI-enabled > platforms. > > Cc: stable@vger.kernel.org > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> > --- > 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 +- > drivers/acpi/pptt.c | 16 ++++++++-------- > drivers/acpi/riscv/rhct.c | 2 +- > drivers/perf/arm_cspmu/arm_cspmu.c | 2 +- > 7 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h > index c07a58b96329..202107aeb05b 100644 > --- a/arch/arm64/include/asm/acpi.h > +++ b/arch/arm64/include/asm/acpi.h > @@ -114,7 +114,7 @@ static inline bool acpi_has_cpu_in_madt(void) > } > > struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu); > -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) > +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) > { > return acpi_cpu_get_madt_gicc(cpu)->uid; > } > @@ -125,7 +125,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) > > for (cpu = 0; cpu < nr_cpu_ids; cpu++) > if (acpi_cpu_get_madt_gicc(cpu) && > - uid == get_acpi_id_for_cpu(cpu)) > + uid == acpi_get_cpu_acpi_id(cpu)) > return cpu; > > return -EINVAL; > diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h > index 7376840fa9f7..89c6c8f52cc3 100644 > --- a/arch/loongarch/include/asm/acpi.h > +++ b/arch/loongarch/include/asm/acpi.h > @@ -40,7 +40,7 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC]; > > extern int __init parse_acpi_topology(void); > > -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) > +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) > { > return acpi_core_pic[cpu_logical_map(cpu)].processor_id; > } > diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h > index 6e13695120bc..1d23681b61b5 100644 > --- a/arch/riscv/include/asm/acpi.h > +++ b/arch/riscv/include/asm/acpi.h > @@ -61,7 +61,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } > > void acpi_init_rintc_map(void); > struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); > -static inline u32 get_acpi_id_for_cpu(int cpu) > +static inline u32 acpi_get_cpu_acpi_id(int cpu) > { > return acpi_cpu_get_madt_rintc(cpu)->uid; > } > diff --git a/arch/riscv/kernel/acpi_numa.c b/arch/riscv/kernel/acpi_numa.c > index 130769e3a99c..c2eb4824d0f7 100644 > --- a/arch/riscv/kernel/acpi_numa.c > +++ b/arch/riscv/kernel/acpi_numa.c > @@ -40,7 +40,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) > int cpu; > > for (cpu = 0; cpu < nr_cpu_ids; cpu++) > - if (uid == get_acpi_id_for_cpu(cpu)) > + if (uid == acpi_get_cpu_acpi_id(cpu)) > return cpu; > > return -EINVAL; > diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c > index de5f8c018333..c1a8fba4c2b2 100644 > --- a/drivers/acpi/pptt.c > +++ b/drivers/acpi/pptt.c > @@ -459,7 +459,7 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table, > { > struct acpi_pptt_cache *found_cache; > struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); > - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > struct cacheinfo *this_leaf; > unsigned int index = 0; > struct acpi_pptt_processor *cpu_node = NULL; > @@ -546,7 +546,7 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, > unsigned int cpu, int level, int flag) > { > struct acpi_pptt_processor *cpu_node; > - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > > cpu_node = acpi_find_processor_node(table, acpi_cpu_id); > if (cpu_node) { > @@ -622,7 +622,7 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) > static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) > { > struct acpi_table_header *table; > - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > struct acpi_pptt_processor *cpu_node = NULL; > int ret = -ENOENT; > > @@ -671,7 +671,7 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels, > > pr_debug("Cache Setup: find cache levels for CPU=%d\n", cpu); > > - acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > cpu_node = acpi_find_processor_node(table, acpi_cpu_id); > if (!cpu_node) > return -ENOENT; > @@ -797,7 +797,7 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu) > if (!table) > return -ENOENT; > > - acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > cpu_node = acpi_find_processor_node(table, acpi_cpu_id); > if (!cpu_node || !cpu_node->parent) > return -ENOENT; > @@ -872,7 +872,7 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_header *table_hdr, > cpumask_clear(cpus); > > for_each_possible_cpu(cpu) { > - acpi_id = get_acpi_id_for_cpu(cpu); > + acpi_id = acpi_get_cpu_acpi_id(cpu); > cpu_node = acpi_find_processor_node(table_hdr, acpi_id); > > while (cpu_node) { > @@ -966,7 +966,7 @@ int find_acpi_cache_level_from_id(u32 cache_id) > for_each_possible_cpu(cpu) { > bool empty; > int level = 1; > - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > struct acpi_pptt_cache *cache; > struct acpi_pptt_processor *cpu_node; > > @@ -1030,7 +1030,7 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus) > for_each_possible_cpu(cpu) { > bool empty; > int level = 1; > - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > struct acpi_pptt_cache *cache; > struct acpi_pptt_processor *cpu_node; > > diff --git a/drivers/acpi/riscv/rhct.c b/drivers/acpi/riscv/rhct.c > index caa2c16e1697..c15ce8c13136 100644 > --- a/drivers/acpi/riscv/rhct.c > +++ b/drivers/acpi/riscv/rhct.c > @@ -44,7 +44,7 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const > struct acpi_rhct_isa_string *isa_node; > struct acpi_table_rhct *rhct; > u32 *hart_info_node_offset; > - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); > > BUG_ON(acpi_disabled); > > diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c > index 34430b68f602..506b661c60fd 100644 > --- a/drivers/perf/arm_cspmu/arm_cspmu.c > +++ b/drivers/perf/arm_cspmu/arm_cspmu.c > @@ -1115,7 +1115,7 @@ static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu) > if (affinity_flag == ACPI_APMT_FLAGS_AFFINITY_PROC) { > for_each_possible_cpu(cpu) { > if (apmt_node->proc_affinity == > - get_acpi_id_for_cpu(cpu)) { > + acpi_get_cpu_acpi_id(cpu)) { > cpumask_set_cpu(cpu, &cspmu->associated_cpus); > break; > } > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 2026-03-09 13:29 ` Huacai Chen @ 2026-03-10 3:29 ` fengchengwen 0 siblings, 0 replies; 7+ messages in thread From: fengchengwen @ 2026-03-10 3:29 UTC (permalink / raw) To: Huacai Chen Cc: linux-pci, bhelgaas, Catalin Marinas, Will Deacon, WANG Xuerui, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Rafael J. Wysocki, Len Brown, Sunil V L, Mark Rutland, linux-acpi, wei.huang2, Eric.VanTassell, jonathan.cameron, wangzhou1, wanghuiqiang, liuyonglong, stable, jeremy.linton, sunilvl, chenhuacai, wangliupu, linux-arm-kernel, linux-kernel, loongarch, linux-riscv, linux-perf-users Hi Huacai, On 3/9/2026 9:29 PM, Huacai Chen wrote: > Hi, Chengwen, > > On Mon, Mar 9, 2026 at 12:17 PM Chengwen Feng <fengchengwen@huawei.com> wrote: >> >> To unify the CPU ACPI ID retrieval interface across architectures, >> rename the existing get_acpi_id_for_cpu() function to >> acpi_get_cpu_acpi_id() on arm64/riscv/loongarch platforms. > Can we also rename cpu_acpi_id() to acpi_get_cpu_acpi_id() for x86? Remove cpu_acpi_id() would make it look more concise, this was done in v5, thanks. > > Huacai > >> >> This is a pure rename with no functional change, preparing for a >> consistent ACPI Processor UID retrieval interface across all ACPI-enabled >> platforms. >> >> Cc: stable@vger.kernel.org >> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> >> --- >> 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 +- >> drivers/acpi/pptt.c | 16 ++++++++-------- >> drivers/acpi/riscv/rhct.c | 2 +- >> drivers/perf/arm_cspmu/arm_cspmu.c | 2 +- >> 7 files changed, 15 insertions(+), 15 deletions(-) >> >> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h >> index c07a58b96329..202107aeb05b 100644 >> --- a/arch/arm64/include/asm/acpi.h >> +++ b/arch/arm64/include/asm/acpi.h >> @@ -114,7 +114,7 @@ static inline bool acpi_has_cpu_in_madt(void) >> } >> >> struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu); >> -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) >> +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) >> { >> return acpi_cpu_get_madt_gicc(cpu)->uid; >> } >> @@ -125,7 +125,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) >> >> for (cpu = 0; cpu < nr_cpu_ids; cpu++) >> if (acpi_cpu_get_madt_gicc(cpu) && >> - uid == get_acpi_id_for_cpu(cpu)) >> + uid == acpi_get_cpu_acpi_id(cpu)) >> return cpu; >> >> return -EINVAL; >> diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h >> index 7376840fa9f7..89c6c8f52cc3 100644 >> --- a/arch/loongarch/include/asm/acpi.h >> +++ b/arch/loongarch/include/asm/acpi.h >> @@ -40,7 +40,7 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC]; >> >> extern int __init parse_acpi_topology(void); >> >> -static inline u32 get_acpi_id_for_cpu(unsigned int cpu) >> +static inline u32 acpi_get_cpu_acpi_id(unsigned int cpu) >> { >> return acpi_core_pic[cpu_logical_map(cpu)].processor_id; >> } >> diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h >> index 6e13695120bc..1d23681b61b5 100644 >> --- a/arch/riscv/include/asm/acpi.h >> +++ b/arch/riscv/include/asm/acpi.h >> @@ -61,7 +61,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } >> >> void acpi_init_rintc_map(void); >> struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); >> -static inline u32 get_acpi_id_for_cpu(int cpu) >> +static inline u32 acpi_get_cpu_acpi_id(int cpu) >> { >> return acpi_cpu_get_madt_rintc(cpu)->uid; >> } >> diff --git a/arch/riscv/kernel/acpi_numa.c b/arch/riscv/kernel/acpi_numa.c >> index 130769e3a99c..c2eb4824d0f7 100644 >> --- a/arch/riscv/kernel/acpi_numa.c >> +++ b/arch/riscv/kernel/acpi_numa.c >> @@ -40,7 +40,7 @@ static inline int get_cpu_for_acpi_id(u32 uid) >> int cpu; >> >> for (cpu = 0; cpu < nr_cpu_ids; cpu++) >> - if (uid == get_acpi_id_for_cpu(cpu)) >> + if (uid == acpi_get_cpu_acpi_id(cpu)) >> return cpu; >> >> return -EINVAL; >> diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c >> index de5f8c018333..c1a8fba4c2b2 100644 >> --- a/drivers/acpi/pptt.c >> +++ b/drivers/acpi/pptt.c >> @@ -459,7 +459,7 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table, >> { >> struct acpi_pptt_cache *found_cache; >> struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); >> - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> struct cacheinfo *this_leaf; >> unsigned int index = 0; >> struct acpi_pptt_processor *cpu_node = NULL; >> @@ -546,7 +546,7 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table, >> unsigned int cpu, int level, int flag) >> { >> struct acpi_pptt_processor *cpu_node; >> - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> >> cpu_node = acpi_find_processor_node(table, acpi_cpu_id); >> if (cpu_node) { >> @@ -622,7 +622,7 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) >> static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) >> { >> struct acpi_table_header *table; >> - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> struct acpi_pptt_processor *cpu_node = NULL; >> int ret = -ENOENT; >> >> @@ -671,7 +671,7 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels, >> >> pr_debug("Cache Setup: find cache levels for CPU=%d\n", cpu); >> >> - acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> cpu_node = acpi_find_processor_node(table, acpi_cpu_id); >> if (!cpu_node) >> return -ENOENT; >> @@ -797,7 +797,7 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu) >> if (!table) >> return -ENOENT; >> >> - acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> cpu_node = acpi_find_processor_node(table, acpi_cpu_id); >> if (!cpu_node || !cpu_node->parent) >> return -ENOENT; >> @@ -872,7 +872,7 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_header *table_hdr, >> cpumask_clear(cpus); >> >> for_each_possible_cpu(cpu) { >> - acpi_id = get_acpi_id_for_cpu(cpu); >> + acpi_id = acpi_get_cpu_acpi_id(cpu); >> cpu_node = acpi_find_processor_node(table_hdr, acpi_id); >> >> while (cpu_node) { >> @@ -966,7 +966,7 @@ int find_acpi_cache_level_from_id(u32 cache_id) >> for_each_possible_cpu(cpu) { >> bool empty; >> int level = 1; >> - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> struct acpi_pptt_cache *cache; >> struct acpi_pptt_processor *cpu_node; >> >> @@ -1030,7 +1030,7 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus) >> for_each_possible_cpu(cpu) { >> bool empty; >> int level = 1; >> - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> struct acpi_pptt_cache *cache; >> struct acpi_pptt_processor *cpu_node; >> >> diff --git a/drivers/acpi/riscv/rhct.c b/drivers/acpi/riscv/rhct.c >> index caa2c16e1697..c15ce8c13136 100644 >> --- a/drivers/acpi/riscv/rhct.c >> +++ b/drivers/acpi/riscv/rhct.c >> @@ -44,7 +44,7 @@ int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const >> struct acpi_rhct_isa_string *isa_node; >> struct acpi_table_rhct *rhct; >> u32 *hart_info_node_offset; >> - u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); >> + u32 acpi_cpu_id = acpi_get_cpu_acpi_id(cpu); >> >> BUG_ON(acpi_disabled); >> >> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c >> index 34430b68f602..506b661c60fd 100644 >> --- a/drivers/perf/arm_cspmu/arm_cspmu.c >> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c >> @@ -1115,7 +1115,7 @@ static int arm_cspmu_acpi_get_cpus(struct arm_cspmu *cspmu) >> if (affinity_flag == ACPI_APMT_FLAGS_AFFINITY_PROC) { >> for_each_possible_cpu(cpu) { >> if (apmt_node->proc_affinity == >> - get_acpi_id_for_cpu(cpu)) { >> + acpi_get_cpu_acpi_id(cpu)) { >> cpumask_set_cpu(cpu, &cspmu->associated_cpus); >> break; >> } >> -- >> 2.17.1 >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-10 3:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260303003625.39035-1-fengchengwen@huawei.com>
2026-03-06 2:19 ` [PATCH v3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform Chengwen Feng
2026-03-06 10:01 ` Jonathan Cameron
2026-03-09 4:18 ` fengchengwen
[not found] ` <20260309041659.18815-1-fengchengwen@huawei.com>
2026-03-09 4:16 ` [PATCH v4 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 Chengwen Feng
2026-03-09 10:30 ` Jonathan Cameron
2026-03-09 13:29 ` Huacai Chen
2026-03-10 3:29 ` fengchengwen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox