From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: "Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"David E Box" <david.e.box@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v3 00/20] Decouple PCI and auxbus details from Intel TPMI driver
Date: Wed, 30 Sep 2026 10:28:57 -0700 [thread overview]
Message-ID: <20260930172918.743656-1-sathyanarayanan.kuppuswamy@linux.intel.com> (raw)
Hi All,
This series is a no functional change refactor of the TPMI driver
(vsec_tpmi.c). It separates the code that does not care how TPMI was
discovered from the code that does.
TPMI is discovered today through a PCIe VSEC capability, with the PFS
table address computed relative to a PCI BAR. BARs are relocatable at
runtime by resource rebalancing, hot plug or error recovery, which ties
a platform wide register window to the lifecycle of one PCI function
and to an address an untrusted VMM can influence. That is a concern in
secure VM environments like TDX.
Newer Intel platforms will support ACPI table based TPMI enumeration.
The related ACPI spec is not public yet, so this series prepares the
driver ahead of it. Several places in vsec_tpmi.c assume the
enumerating device is a PCI device, or reach through a struct
intel_vsec_device just to get at a struct device, and neither holds
for an ACPI backend.
The series comes in four parts.
Patch 1 is a standalone cleanup. The feature device name was built in an
on-stack buffer and handed to the auxiliary bus, which stores the
pointer without copying the string.
Patches 2 to 8 each remove one PCI or intel_vsec_device dependency and
leave the code in place, so they are small and can be read on their own.
Patches 9 and 10 do the split. tpmi_probe() and tpmi_remove() become
intel_tpmi_init() and intel_tpmi_deinit(), which is the interface an
enumeration backend implements against, and the enumeration independent
code moves to a new intel-tpmi_common module. That leaves vsec_tpmi.c
with just the auxiliary driver binding to the "intel_vsec.tpmi" device
created by the Intel VSEC driver.
Patches 11 to 20 are code improvements to tpmi_common.c. Some of them
come from Ilpo's review of v1. Others were suggested by Andy in an
internal review of this series, and since they touch the same code I
have included them here as well. Each patch carries a Suggested-by tag
for whoever suggested it.
They are separate patches on top of the move in patch 10, as Ilpo asked,
so that patch 10 stays a pure code move and can still be reviewed with a
diff-of-diffs against the original vsec_tpmi.c. Each of them does one
thing to tpmi_common.c and nothing else.
Tested on a GNR platform. TPMI feature enumeration, the debugfs
interface and the client drivers behave as before.
Changes since v2:
- Collected Reviewed-by tags from Andy on patches 11, 13, 15, 16 and 20.
- New patch 18: use DEFINE_RES_MEM() for the feature resources in
tpmi_create_device(), as Andy asked in his review of v2 patch 18.
- Patch 19 (v2 patch 18): rebased on top of the new patch 18, so the
resource loop now assigns res[i] = DEFINE_RES_MEM(...).
- Patch 20 is v2 patch 19, unchanged.
- v2: https://lore.kernel.org/all/20260924182342.212709-1-sathyanarayanan.kuppuswamy@linux.intel.com/
Changes since v1:
- Added patches 11 to 19, from Ilpo's review of v1 and Andy's internal
review. Patches 1 to 10 are unchanged and carry the Reviewed-by tags
they collected.
- Patch 11: include the headers tpmi_common.c uses directly instead of
relying on other headers to pull them in, drop the redundant io.h and
sort the block.
- Patch 12: turn TPMI_GET_SINGLE_ENTRY_SIZE() into a function, so the
u32 to byte conversion reads as a multiply by sizeof(u32), the
statement expression goes away and the argument is evaluated once.
- Patch 13: take tpmi_dev_lock with guard() in
tpmi_read_feature_status() and drop the unlock label.
- Patch 14: use __free(kfree) and guard() in tpmi_mem_dump_show() so the
ioremap() failure can return from the loop.
- Patch 15: build each TPMI control mailbox word in one expression.
- Patch 16: use DEFINE_SHOW_STORE_ATTRIBUTE() for the mem_write debugfs
file.
- Patch 17: scnprintf() instead of snprintf().
- Patch 18: declare the loop counters in their loops.
- Patch 19: make the device creation policy a comment on
tpmi_create_devices() and split the condition it described.
This series is based on v7.3-rc1.
Kuppuswamy Sathyanarayanan (20):
platform/x86/intel/tpmi: Use static strings for the feature device
names
platform/x86/intel/vsec: Pass a struct device to
intel_vsec_set_mapping()
platform/x86/intel/tpmi: Remove unused vsec_dev from
intel_tpmi_pm_feature
platform/x86/intel/tpmi: Get tpmi_info directly from the parent device
platform/x86/intel/tpmi: Keep the feature resources in intel_tpmi_info
platform/x86/intel/tpmi: Describe a TPMI instance by its two devices
platform/x86/intel/tpmi: Drop unused arg from tpmi_set_control_base()
platform/x86/intel/tpmi: Do not assume TPMI is enumerated from PCI
platform/x86/intel/tpmi: Split out enumeration independent init and
exit
platform/x86/intel/tpmi: Split off the PCI VSEC enumeration
platform/x86/intel/tpmi: Include the headers tpmi_common.c relies on
platform/x86/intel/tpmi: Turn TPMI_GET_SINGLE_ENTRY_SIZE() into a
function
platform/x86/intel/tpmi: Use guard() for tpmi_dev_lock in the status
read
platform/x86/intel/tpmi: Use scope based cleanup in the memory dump
platform/x86/intel/tpmi: Build the TPMI control words in one
expression
platform/x86/intel/tpmi: Use DEFINE_SHOW_STORE_ATTRIBUTE() for
mem_write
platform/x86/intel/tpmi: Use scnprintf() to build the debugfs names
platform/x86/intel/tpmi: Use DEFINE_RES_MEM() for the feature
resources
platform/x86/intel/tpmi: Declare the loop counters in their loops
platform/x86/intel/tpmi: Describe the device creation policy on the
function
MAINTAINERS | 1 +
drivers/platform/x86/intel/Kconfig | 4 +
drivers/platform/x86/intel/Makefile | 1 +
drivers/platform/x86/intel/tpmi_common.c | 822 +++++++++++++++++++++++
drivers/platform/x86/intel/tpmi_common.h | 52 ++
drivers/platform/x86/intel/vsec.c | 7 +-
drivers/platform/x86/intel/vsec_tpmi.c | 822 +----------------------
include/linux/intel_vsec.h | 5 +-
8 files changed, 898 insertions(+), 816 deletions(-)
create mode 100644 drivers/platform/x86/intel/tpmi_common.c
create mode 100644 drivers/platform/x86/intel/tpmi_common.h
--
2.43.0
next reply other threads:[~2026-09-30 17:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 17:28 Kuppuswamy Sathyanarayanan [this message]
2026-09-30 17:28 ` [PATCH v3 01/20] platform/x86/intel/tpmi: Use static strings for the feature device names Kuppuswamy Sathyanarayanan
2026-09-30 17:28 ` [PATCH v3 02/20] platform/x86/intel/vsec: Pass a struct device to intel_vsec_set_mapping() Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 03/20] platform/x86/intel/tpmi: Remove unused vsec_dev from intel_tpmi_pm_feature Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 04/20] platform/x86/intel/tpmi: Get tpmi_info directly from the parent device Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 05/20] platform/x86/intel/tpmi: Keep the feature resources in intel_tpmi_info Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 06/20] platform/x86/intel/tpmi: Describe a TPMI instance by its two devices Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 07/20] platform/x86/intel/tpmi: Drop unused arg from tpmi_set_control_base() Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 08/20] platform/x86/intel/tpmi: Do not assume TPMI is enumerated from PCI Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 09/20] platform/x86/intel/tpmi: Split out enumeration independent init and exit Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 10/20] platform/x86/intel/tpmi: Split off the PCI VSEC enumeration Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 11/20] platform/x86/intel/tpmi: Include the headers tpmi_common.c relies on Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 12/20] platform/x86/intel/tpmi: Turn TPMI_GET_SINGLE_ENTRY_SIZE() into a function Kuppuswamy Sathyanarayanan
2026-10-01 18:04 ` Andy Shevchenko
2026-09-30 17:29 ` [PATCH v3 13/20] platform/x86/intel/tpmi: Use guard() for tpmi_dev_lock in the status read Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 14/20] platform/x86/intel/tpmi: Use scope based cleanup in the memory dump Kuppuswamy Sathyanarayanan
2026-10-01 18:06 ` Andy Shevchenko
2026-10-01 18:18 ` Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 15/20] platform/x86/intel/tpmi: Build the TPMI control words in one expression Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 16/20] platform/x86/intel/tpmi: Use DEFINE_SHOW_STORE_ATTRIBUTE() for mem_write Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 17/20] platform/x86/intel/tpmi: Use scnprintf() to build the debugfs names Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 18/20] platform/x86/intel/tpmi: Use DEFINE_RES_MEM() for the feature resources Kuppuswamy Sathyanarayanan
2026-10-01 18:09 ` Andy Shevchenko
2026-09-30 17:29 ` [PATCH v3 19/20] platform/x86/intel/tpmi: Declare the loop counters in their loops Kuppuswamy Sathyanarayanan
2026-10-01 18:12 ` Andy Shevchenko
2026-10-01 21:02 ` Kuppuswamy Sathyanarayanan
2026-09-30 17:29 ` [PATCH v3 20/20] platform/x86/intel/tpmi: Describe the device creation policy on the function Kuppuswamy Sathyanarayanan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930172918.743656-1-sathyanarayanan.kuppuswamy@linux.intel.com \
--to=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=david.e.box@linux.intel.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®