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 v1 08/10] platform/x86/intel/tpmi: Do not assume TPMI is enumerated from PCI
Date: Tue, 22 Sep 2026 11:33:09 -0700 [thread overview]
Message-ID: <20260922183311.3783010-9-sathyanarayanan.kuppuswamy@linux.intel.com> (raw)
In-Reply-To: <20260922183311.3783010-1-sathyanarayanan.kuppuswamy@linux.intel.com>
The init path converts the enumerating device into a pci_dev without
checking and always registers the OOBMSM package to PCI device mapping.
That works today because TPMI is only enumerated from a PCI VSEC
capability, but ACPI based enumeration is being worked on and the device
it enumerates from is not a PCI device.
Do both only for a PCI device. The bus number read from the pci_dev is a
fallback that tpmi_process_info() overwrites with the value reported by
the TPMI_INFO feature, so there is nothing to do without a pci_dev. The
mapping stored by intel_vsec_set_mapping() is looked up by pci_dev and
cannot be consumed by another enumeration method, and calling it anyway
would fail the probe with -ENODEV.
While here, stop describing intel_tpmi_info as holding the TPMI devices
of one PCI device.
No functional change for PCI enumerated TPMI.
Co-developed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
drivers/platform/x86/intel/vsec_tpmi.c | 28 +++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/intel/vsec_tpmi.c b/drivers/platform/x86/intel/vsec_tpmi.c
index f1dfe2b23c9c..f96b94ba29f8 100644
--- a/drivers/platform/x86/intel/vsec_tpmi.c
+++ b/drivers/platform/x86/intel/vsec_tpmi.c
@@ -119,7 +119,7 @@ struct intel_tpmi_pm_feature {
* can find them again, for example during PCI error
* recovery.
*
- * Stores the information for all TPMI devices enumerated from a single PCI device.
+ * Stores the information for all TPMI devices of one TPMI instance.
*/
struct intel_tpmi_info {
struct intel_tpmi_pm_feature *tpmi_features;
@@ -742,7 +742,8 @@ static int tpmi_fetch_pfs_header(struct intel_tpmi_pm_feature *pfs, u64 start, i
static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
{
struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev);
- struct pci_dev *pci_dev = to_pci_dev(vsec_dev->dev);
+ struct pci_dev *pci_dev = dev_is_pci(vsec_dev->dev) ?
+ to_pci_dev(vsec_dev->dev) : NULL;
struct intel_tpmi_info *tpmi_info;
u64 pfs_start = 0;
int ret, i;
@@ -755,7 +756,14 @@ static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
tpmi_info->parent = vsec_dev->dev;
tpmi_info->feature_count = vsec_dev->num_resources;
tpmi_info->resource = vsec_dev->resource;
- tpmi_info->plat_info.bus_number = pci_dev->bus->number;
+
+ /*
+ * Seed the bus number from the enumerating device. It is only a
+ * fallback, tpmi_process_info() replaces it with the value the
+ * TPMI_INFO feature reports.
+ */
+ if (pci_dev)
+ tpmi_info->plat_info.bus_number = pci_dev->bus->number;
tpmi_info->tpmi_features = devm_kcalloc(&auxdev->dev, tpmi_info->feature_count,
sizeof(*tpmi_info->tpmi_features),
@@ -801,10 +809,16 @@ static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
if (ret)
return ret;
- ret = intel_vsec_set_mapping(&tpmi_info->plat_info,
- tpmi_info->parent);
- if (ret)
- return ret;
+ /*
+ * The mapping is looked up by pci_dev, so it is only
+ * meaningful for PCI enumerated TPMI instances.
+ */
+ if (pci_dev) {
+ ret = intel_vsec_set_mapping(&tpmi_info->plat_info,
+ &pci_dev->dev);
+ if (ret)
+ return ret;
+ }
}
if (pfs->pfs_header.tpmi_id == TPMI_CONTROL_ID)
--
2.43.0
next prev parent reply other threads:[~2026-09-22 18:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 18:33 [PATCH v1 00/10] Decouple PCI and auxbus details from Intel TPMI driver Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 01/10] platform/x86/intel/tpmi: Use static strings for the feature device names Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 02/10] platform/x86/intel/vsec: Pass a struct device to intel_vsec_set_mapping() Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 03/10] platform/x86/intel/tpmi: Remove unused vsec_dev from intel_tpmi_pm_feature Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 04/10] platform/x86/intel/tpmi: Get tpmi_info directly from the parent device Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 05/10] platform/x86/intel/tpmi: Keep the feature resources in intel_tpmi_info Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 06/10] platform/x86/intel/tpmi: Describe a TPMI instance by its two devices Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 07/10] platform/x86/intel/tpmi: Drop unused arg from tpmi_set_control_base() Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` Kuppuswamy Sathyanarayanan [this message]
2026-09-22 18:33 ` [PATCH v1 09/10] platform/x86/intel/tpmi: Split out enumeration independent init and exit Kuppuswamy Sathyanarayanan
2026-09-22 18:33 ` [PATCH v1 10/10] platform/x86/intel/tpmi: Split off the PCI VSEC enumeration Kuppuswamy Sathyanarayanan
2026-09-22 20:19 ` Ilpo Järvinen
2026-09-23 17:37 ` 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=20260922183311.3783010-9-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®