[RFC PATCH kernel 03/17] tsm/core: Store range_id in pci_tsm_mmio_entry

From: Alexey Kardashevskiy

Date: Wed Sep 16 2026 - 08:06:56 EST


The pci_tsm_mmio struct represent a parsed TDI report which platform
TSM driver will apply at the TDI accept step.

On top of what the existing structure stores already, the AMD TSM driver
is going to need a range ID for the PSP communication.

Instead of calculating it in the platform TSM driver, just pass it along.

While at this, set the flag as resource_contains() checks for the type
when pci_tsm_mmio_setup() inserts the range.

Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxx>
---

Not quite sure if IORESOURCE_MEM deserves a separate fix;
also if it is just me who hit this.
---
include/linux/pci-tsm.h | 2 ++
drivers/pci/tsm/core.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/include/linux/pci-tsm.h b/include/linux/pci-tsm.h
index 6d5fadd79360..9b34304d9a1f 100644
--- a/include/linux/pci-tsm.h
+++ b/include/linux/pci-tsm.h
@@ -161,10 +161,12 @@ struct pci_tsm_pf0 {
* @res: MMIO address range (typically Guest Physical Address, GPA)
* @tsm_offset: Host Physical Address, HPA obfuscation offset added by the TSM.
* Translates report addresses to GPA.
+ * @range_id: PCI BAR index for this range
*/
struct pci_tsm_mmio_entry {
struct resource res;
u64 tsm_offset;
+ unsigned char range_id;
};

struct pci_tsm_mmio {
diff --git a/drivers/pci/tsm/core.c b/drivers/pci/tsm/core.c
index 2a18be5be56e..a197d56edbfb 100644
--- a/drivers/pci/tsm/core.c
+++ b/drivers/pci/tsm/core.c
@@ -746,6 +746,8 @@ struct pci_tsm_mmio *pci_tsm_mmio_alloc(struct pci_dev *pdev)

entry->res.start = range.start;
entry->res.end = range.end;
+ entry->res.flags = IORESOURCE_MEM;
+ entry->range_id = bar;
entry->tsm_offset = tsm_offset;
mmio->nr++;
}
--
2.55.0