From nobody Thu Apr 9 08:11:00 2026 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (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 C0ECF399007; Tue, 10 Mar 2026 03:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112863; cv=none; b=F+37/i1RrW2rugoO2M3lBHVh9jNEF1kFuJfPI7i8TAzefRJ3ln9dQdyTXHrYTl80wBlvIsB2x2jG3pUkPKAoAqxNKFGEz/AIxOOUkX9L5OWxloJi8Zs4wdbv+zDO1L2kWpz0+b4ryoJiabnABOlit716DQEDXBdisReg2x/VCb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112863; c=relaxed/simple; bh=qc4RJXO3yacqiDJfF1+tyIfAi+YHvoeMGIIaKNByv3s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cWgpleF7z8zEX68QHpAO1kHcKkfVeERX2SjQPqNMAUjqRjC3hTnFi7kxfGFBm0yhv4NhHkPkAIpb22AB6VN8T+lp5qHpQnWuP0KMbw6Ekx/js1smXKuNn14p2OxUdbda3uYNLk8jSie1zl62iDa0uhNg89gQRaQjOvLgy4vcExY= 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=Wcm0KY75; arc=none smtp.client-ip=113.46.200.220 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="Wcm0KY75" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=A0FMIWNr2Dx+OlfZSA1sGW6DfHKLq8qTyrKRNs7QJ7U=; b=Wcm0KY75ufjFNPJyc4zSdiHPUv18HrWLJez1cr9p/yPEHO6W6HDMoMpkYk8j28awyuVeBv3xd Jy3fYOyOLPQ1eo5HCwj2w3Z/yn9Vx8hUTFCorNL3HFqAMJeEV7VRD5qvGecAhYJA/D9L4lA0g07 Dk0fwR1m0uotQ11p7R5z7Yo= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4fVJsl23JTz12LCw; Tue, 10 Mar 2026 11:15:23 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id 6E06320104; Tue, 10 Mar 2026 11:20:59 +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; Tue, 10 Mar 2026 11:20:57 +0800 From: Chengwen Feng To: Bjorn Helgaas , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" CC: Jonathan Corbet , Shuah Khan , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H . Peter Anvin" , Juergen Gross , Boris Ostrovsky , Len Brown , Sunil V L , Mark Rutland , Chengwen Feng , 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 , Ajit Khaparde , Wei Huang , Andy Gospodarek , Somnath Kotur , , , , , , , , , , , , , Subject: [PATCH v5 1/2] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_acpi_id() on non-x86 Date: Tue, 10 Mar 2026 11:20:48 +0800 Message-ID: <20260310032049.25387-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260310032049.25387-1-fengchengwen@huawei.com> References: <20260310032049.25387-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: kwepems200002.china.huawei.com (7.221.188.68) To kwepemk500009.china.huawei.com (7.202.194.94) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Jonathan Cameron --- 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) } =20 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) =20 for (cpu =3D 0; cpu < nr_cpu_ids; cpu++) if (acpi_cpu_get_madt_gicc(cpu) && - uid =3D=3D get_acpi_id_for_cpu(cpu)) + uid =3D=3D acpi_get_cpu_acpi_id(cpu)) return cpu; =20 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_P= IC]; =20 extern int __init parse_acpi_topology(void); =20 -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) { } =20 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; =20 for (cpu =3D 0; cpu < nr_cpu_ids; cpu++) - if (uid =3D=3D get_acpi_id_for_cpu(cpu)) + if (uid =3D=3D acpi_get_cpu_acpi_id(cpu)) return cpu; =20 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_head= er *table, { struct acpi_pptt_cache *found_cache; struct cpu_cacheinfo *this_cpu_ci =3D get_cpu_cacheinfo(cpu); - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); struct cacheinfo *this_leaf; unsigned int index =3D 0; struct acpi_pptt_processor *cpu_node =3D 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 =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); =20 cpu_node =3D 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 =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_processor *cpu_node =3D NULL; int ret =3D -ENOENT; =20 @@ -671,7 +671,7 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int = *levels, =20 pr_debug("Cache Setup: find cache levels for CPU=3D%d\n", cpu); =20 - acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); cpu_node =3D 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; =20 - acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); cpu_node =3D 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); =20 for_each_possible_cpu(cpu) { - acpi_id =3D get_acpi_id_for_cpu(cpu); + acpi_id =3D acpi_get_cpu_acpi_id(cpu); cpu_node =3D acpi_find_processor_node(table_hdr, acpi_id); =20 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 =3D 1; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; =20 @@ -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 =3D 1; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); struct acpi_pptt_cache *cache; struct acpi_pptt_processor *cpu_node; =20 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, u= nsigned int cpu, const struct acpi_rhct_isa_string *isa_node; struct acpi_table_rhct *rhct; u32 *hart_info_node_offset; - u32 acpi_cpu_id =3D get_acpi_id_for_cpu(cpu); + u32 acpi_cpu_id =3D acpi_get_cpu_acpi_id(cpu); =20 BUG_ON(acpi_disabled); =20 diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/ar= m_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 =3D=3D ACPI_APMT_FLAGS_AFFINITY_PROC) { for_each_possible_cpu(cpu) { if (apmt_node->proc_affinity =3D=3D - get_acpi_id_for_cpu(cpu)) { + acpi_get_cpu_acpi_id(cpu)) { cpumask_set_cpu(cpu, &cspmu->associated_cpus); break; } --=20 2.17.1 From nobody Thu Apr 9 08:11:00 2026 Received: from canpmsgout08.his.huawei.com (canpmsgout08.his.huawei.com [113.46.200.223]) (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 A9843399007; Tue, 10 Mar 2026 03:21:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112876; cv=none; b=DYlNnMU5v9JGzsr0TWlKkdtIT/C2WNNQ3MkXY/WPdY1dnLFArFPva+W+zjPNMfb1iOAfF6O4P3Py2QgnKWfsDWlZlBoG2wTp7thUL3DP9Y9Ib76RqzRoq9t4VdIcAGer0/+q5k+mFiWJj2eSQfGQSn6GPKdbr6r2XLvzfzjT/DQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773112876; c=relaxed/simple; bh=FKWCa7KvkqcFm/L3Gue8UPFLyQnFbaSJbPinN6lpzBA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Juw683owuZUqtLivln38qINdqsCrTx7P9OpN7lUe+scl4SEFq99fCdG4ZPp1tHtT6yJwMxb/4TqMXo26pe4UPfRgGuf+l7BpYG6vgpaCVCxrGPZBGxJTIn4QER0zDXyH2d3opL/snVzHTkU3DwcMsCuZvMy+CoqR4l6KTnGVSuk= 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=ixI1woUG; arc=none smtp.client-ip=113.46.200.223 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="ixI1woUG" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=TT+M/HNYlJSQX27HOtuYm2otltrl3F+s0X9BiZbUIzc=; b=ixI1woUGB7ctC3EgDtiIAVXDQtMwKnAm6gqjEcu7Ioth6mixa7zzjeYU4cmcrR0mR18bNy8h5 5nViuN/Xfbli6I4fMQTda7HIJzjMdDsiCUSXnOVb/xk+/dR+/rXDufXhWuvtusN+MT0rkLw8hMj lKjtF9p/nZ4Uip8uiGMHUyY= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout08.his.huawei.com (SkyGuard) with ESMTPS id 4fVJtY2xXbzmV8y; Tue, 10 Mar 2026 11:16:05 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id E197640565; Tue, 10 Mar 2026 11:21:00 +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; Tue, 10 Mar 2026 11:20:59 +0800 From: Chengwen Feng To: Bjorn Helgaas , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" CC: Jonathan Corbet , Shuah Khan , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H . Peter Anvin" , Juergen Gross , Boris Ostrovsky , Len Brown , Sunil V L , Mark Rutland , Chengwen Feng , 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 , Ajit Khaparde , Wei Huang , Andy Gospodarek , Somnath Kotur , , , , , , , , , , , , , Subject: [PATCH v5 2/2] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform Date: Tue, 10 Mar 2026 11:20:49 +0800 Message-ID: <20260310032049.25387-3-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260310032049.25387-1-fengchengwen@huawei.com> References: <20260310032049.25387-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: kwepems200002.china.huawei.com (7.221.188.68) To kwepemk500009.china.huawei.com (7.202.194.94) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pcie_tph_get_cpu_st() is broken on ARM64: 1. pcie_tph_get_cpu_st() passes cpu_uid to the PCI ACPI DSM method. cpu_uid should be the ACPI Processor UID [1]. 2. In BNXT, pcie_tph_get_cpu_st() is passed a cpu_uid obtained via cpumask_first(irq->cpu_mask) - 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. When this occurs, the mismatch results in the wrong CPU steer-tag. 4. On AMD x86 the logical CPU ID is identical to the ACPI Processor UID so the mismatch is not seen. Resolution: 1. Implement acpi_get_cpu_acpi_id() for x86, which replaces cpu_acpi_id(). All ACPI platforms now have an implementation. 2. Use acpi_get_cpu_acpi_id() in pcie_tph_get_cpu_st() to translate from logical CPU ID to ACPI Processor UID needed for the DSM call. 3. Rename pcie_tpu_get_cpu_st() parameter from cpu_uid to cpu to reflect that it is a logical CPU_ID. [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." Fixes: d2e8a34876ce ("PCI/TPH: Add Steering Tag support") Cc: stable@vger.kernel.org Signed-off-by: Chengwen Feng Reviewed-by: Jonathan Cameron --- Documentation/PCI/tph.rst | 4 ++-- arch/x86/include/asm/acpi.h | 2 ++ arch/x86/include/asm/cpu.h | 1 - arch/x86/include/asm/smp.h | 1 - arch/x86/kernel/cpu/common.c | 12 ++++++++++++ arch/x86/xen/enlighten_hvm.c | 4 ++-- drivers/pci/tph.c | 11 ++++++----- include/linux/pci-tph.h | 4 ++-- 8 files changed, 26 insertions(+), 13 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 associat= ed with a specific CPU, use the following function:: =20 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); =20 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. =20 After the ST value is retrieved, the device driver can use the following 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; } =20 +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/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/cpu/common.c b/arch/x86/kernel/cpu/common.c index 1c3261cae40c..93f4f3283c81 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -29,6 +29,7 @@ #include #include =20 +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -2643,3 +2645,13 @@ void __init arch_cpu_finalize_init(void) */ mem_encrypt_init(); } + +u32 acpi_get_cpu_acpi_id(unsigned int cpu) +{ +#ifndef CONFIG_SMP + return 0; +#else + return per_cpu(x86_cpu_to_acpiid, cpu); +#endif +} +EXPORT_SYMBOL_GPL(acpi_get_cpu_acpi_id); diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index fe57ff85d004..0a5cde7865b2 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -161,8 +161,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_acpi_id(cpu) !=3D CPU_ACPIID_INVALID) + per_cpu(xen_vcpu_id, cpu) =3D acpi_get_cpu_acpi_id(cpu); else per_cpu(xen_vcpu_id, cpu) =3D cpu; xen_vcpu_setup(cpu); 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 =3D 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, =20 *tag =3D tph_extract_tag(mem_type, pdev->tph_req_type, &info); =20 - pci_dbg(pdev, "get steering tag: mem_type=3D%s, cpu_uid=3D%d, tag=3D%#04x= \n", + pci_dbg(pdev, "get steering tag: mem_type=3D%s, cpu=3D%d, tag=3D%#04x\n", (mem_type =3D=3D TPH_MEM_TYPE_VM) ? "volatile" : "persistent", - cpu_uid, *tag); + cpu, *tag); =20 return 0; #else 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 *p= dev, { 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) --=20 2.17.1