linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David E. Box" <david.e.box@linux.intel.com>
To: linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, david.e.box@linux.intel.com,
	srinivas.pandruvada@linux.intel.com,
	andriy.shevchenko@linux.intel.com, ilpo.jarvinen@linux.intel.com,
	tony.luck@intel.com, xi.pardee@linux.intel.com
Cc: hdegoede@redhat.com
Subject: [PATCH 05/15] platform/x86/intel/vsec: Skip absent features during initialization
Date: Wed, 30 Apr 2025 14:20:54 -0700	[thread overview]
Message-ID: <20250430212106.369208-6-david.e.box@linux.intel.com> (raw)
In-Reply-To: <20250430212106.369208-1-david.e.box@linux.intel.com>

Some VSEC features depend on the presence of supplier features that may not
always be present. To prevent unnecessary retries and device linking during
initialization, introduce logic to skip attempts to link consumers to
missing suppliers.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 drivers/platform/x86/intel/vsec.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c
index 8700ed7656df..dc3f36afcd09 100644
--- a/drivers/platform/x86/intel/vsec.c
+++ b/drivers/platform/x86/intel/vsec.c
@@ -564,12 +564,31 @@ static void intel_vsec_feature_walk(struct pci_dev *pdev, bool *have_devices,
 		*have_devices = true;
 }
 
+static void intel_vsec_skip_missing_dependencies(struct pci_dev *pdev)
+{
+	struct vsec_priv *priv = pci_get_drvdata(pdev);
+	const struct vsec_feature_dependency *deps = priv->info->deps;
+	int consumer_id = priv->info->num_deps;
+
+	while (consumer_id--) {
+		int supplier_id;
+
+		deps = &priv->info->deps[consumer_id];
+
+		for_each_set_bit(supplier_id, &deps->supplier_bitmap, VSEC_FEATURE_COUNT) {
+			if (!(BIT(supplier_id) & priv->found_caps))
+				priv->state[supplier_id] = STATE_SKIP;
+		}
+	}
+}
+
 static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	struct intel_vsec_platform_info *info;
 	struct vsec_priv *priv;
 	bool have_devices = false;
 	int num_caps, ret;
+	int run_once = 0;
 
 	ret = pcim_enable_device(pdev);
 	if (ret)
@@ -593,6 +612,11 @@ static int intel_vsec_pci_probe(struct pci_dev *pdev, const struct pci_device_id
 
 		if (priv->found_caps == priv->info->caps)
 			break;
+
+		if (!run_once) {
+			intel_vsec_skip_missing_dependencies(pdev);
+			run_once = 1;
+		}
 	}
 
 	if (!have_devices)
-- 
2.43.0


  parent reply	other threads:[~2025-04-30 21:21 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 21:20 [PATCH 00/15] Intel VSEC/PMT: Introduce Discovery Driver David E. Box
2025-04-30 21:20 ` [PATCH 01/15] MAINTAINERS: Add link to documentation of Intel PMT ABI David E. Box
2025-04-30 21:20 ` [PATCH 02/15] platform/x86/intel/vsec: Add private data for per-device data David E. Box
2025-04-30 21:20 ` [PATCH 03/15] platform/x86/intel/vsec: Create wrapper to walk PCI config space David E. Box
2025-04-30 21:20 ` [PATCH 04/15] platform/x86/intel/vsec: Add device links to enforce dependencies David E. Box
2025-05-20 13:51   ` Ilpo Järvinen
2025-06-16 16:04     ` David E. Box
2025-04-30 21:20 ` David E. Box [this message]
2025-04-30 21:20 ` [PATCH 06/15] platform/x86/intel/vsec: Skip driverless features David E. Box
2025-04-30 21:20 ` [PATCH 07/15] platform/x86/intel/vsec: Add new Discovery feature David E. Box
2025-05-20 14:01   ` Ilpo Järvinen
2025-04-30 21:20 ` [PATCH 08/15] platform/x86/intel/pmt: Add PMT Discovery driver David E. Box
2025-05-20 14:32   ` Ilpo Järvinen
2025-05-20 20:59     ` David E. Box
2025-04-30 21:20 ` [PATCH 09/15] docs: Add ABI documentation for intel_pmt feature directories David E. Box
2025-05-20 14:51   ` Ilpo Järvinen
2025-04-30 21:20 ` [PATCH 10/15] platform/x86/intel/tpmi: Relocate platform info to intel_vsec.h David E. Box
2025-05-20 14:54   ` Ilpo Järvinen
2025-04-30 21:21 ` [PATCH 11/15] platform/x86/intel/vsec: Set OOBMSM to CPU mapping David E. Box
2025-04-30 21:21 ` [PATCH 12/15] platform/x86/intel/tpmi: Get OOBMSM CPU mapping from TPMI David E. Box
2025-04-30 21:21 ` [PATCH 13/15] platform/x86/intel/pmt/discovery: Get telemetry attributes David E. Box
2025-04-30 21:21 ` [PATCH 14/15] platform/x86/intel/pmt/telemetry: Add API to retrieve telemetry regions by feature David E. Box
2025-05-20 15:05   ` Ilpo Järvinen
2025-04-30 21:21 ` [PATCH 15/15] platform/x86/intel/pmt: KUNIT test for PMT Enhanced Discovery API David E. Box
2025-05-16 15:30 ` [PATCH 00/15] Intel VSEC/PMT: Introduce Discovery Driver Luck, Tony
2025-05-19 17:22   ` Luck, Tony
2025-05-19 17:32     ` Ilpo Järvinen

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=20250430212106.369208-6-david.e.box@linux.intel.com \
    --to=david.e.box@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --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 \
    --cc=tony.luck@intel.com \
    --cc=xi.pardee@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;
as well as URLs for NNTP newsgroup(s).