mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-06-21 15:43:21 +02:00
abdd2a8653
pcie_tph_get_cpu_st() uses the Query Cache Locality Features _DSM [1]
to retrieve the TPH Steering Tag for memory associated with the CPU
identified by its "cpu_uid" parameter, a Linux logical CPU ID.
The _DSM requires an ACPI Processor UID, which pcie_tph_get_cpu_st()
previously assumed was the same as the Linux logical CPU ID. This is
true on x86 but not on arm64, so pcie_tph_get_cpu_st() returned the
wrong Steering Tag, resulting in incorrect TPH functionality on arm64.
Convert the Linux logical CPU ID to the ACPI Processor UID with
acpi_get_cpu_uid() before passing it to the _DSM. Additionally, rename
the pcie_tph_get_cpu_st() parameter from "cpu_uid" to "cpu" to reflect
that it represents a logical CPU ID (not an ACPI Processor 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."
Fixes: d2e8a34876 ("PCI/TPH: Add Steering Tag support")
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260401081640.26875-9-fengchengwen@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* TPH (TLP Processing Hints)
|
|
*
|
|
* Copyright (C) 2024 Advanced Micro Devices, Inc.
|
|
* Eric Van Tassell <Eric.VanTassell@amd.com>
|
|
* Wei Huang <wei.huang2@amd.com>
|
|
*/
|
|
#ifndef LINUX_PCI_TPH_H
|
|
#define LINUX_PCI_TPH_H
|
|
|
|
/*
|
|
* According to the ECN for PCI Firmware Spec, Steering Tag can be different
|
|
* depending on the memory type: Volatile Memory or Persistent Memory. When a
|
|
* caller query about a target's Steering Tag, it must provide the target's
|
|
* tph_mem_type. ECN link: https://members.pcisig.com/wg/PCI-SIG/document/15470.
|
|
*/
|
|
enum tph_mem_type {
|
|
TPH_MEM_TYPE_VM, /* volatile memory */
|
|
TPH_MEM_TYPE_PM /* persistent memory */
|
|
};
|
|
|
|
#ifdef CONFIG_PCIE_TPH
|
|
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, 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);
|
|
u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
|
|
#else
|
|
static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
|
|
unsigned int index, u16 tag)
|
|
{ return -EINVAL; }
|
|
static inline int pcie_tph_get_cpu_st(struct pci_dev *dev,
|
|
enum tph_mem_type mem_type,
|
|
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)
|
|
{ return -EINVAL; }
|
|
#endif
|
|
|
|
#endif /* LINUX_PCI_TPH_H */
|