Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: david.e.box@linux.intel.com,
	"Michael J. Ruhl" <michael.j.ruhl@intel.com>
Subject: [PATCH 4/6] platform/x86/intel/pmt: Add quirk for BAR0 offset adjustment
Date: Fri, 10 May 2024 16:59:36 -0400	[thread overview]
Message-ID: <20240510205948.904409-5-michael.j.ruhl@intel.com> (raw)
In-Reply-To: <20240510205948.904409-1-michael.j.ruhl@intel.com>

The offset for the discovery table is based on the P2SB bar.
If this bar is not available, the parent driver may need to
adjust the offset,

Add a quirk to allow for this adjustment.

Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 drivers/platform/x86/intel/pmt/class.c     | 3 +++
 drivers/platform/x86/intel/pmt/telemetry.c | 2 +-
 drivers/platform/x86/intel/vsec.c          | 2 +-
 include/linux/intel_vsec.h                 | 3 +++
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c
index 62e36dd89137..957cf74234da 100644
--- a/drivers/platform/x86/intel/pmt/class.c
+++ b/drivers/platform/x86/intel/pmt/class.c
@@ -349,6 +349,9 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
 	if (IS_ERR(entry->disc_table))
 		return PTR_ERR(entry->disc_table);
 
+	if (intel_vsec_dev->quirks & VSEC_QUIRK_P2SB_OFFSET)
+		entry->base_addr = intel_vsec_dev->base_addr;
+
 	ret = ns->pmt_header_decode(entry, dev);
 	if (ret)
 		return ret;
diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
index c9feac859e57..7be9f9746363 100644
--- a/drivers/platform/x86/intel/pmt/telemetry.c
+++ b/drivers/platform/x86/intel/pmt/telemetry.c
@@ -77,7 +77,7 @@ static int pmt_telem_header_decode(struct intel_pmt_entry *entry,
 
 	header->access_type = TELEM_ACCESS(readl(disc_table));
 	header->guid = readl(disc_table + TELEM_GUID_OFFSET);
-	header->base_offset = readl(disc_table + TELEM_BASE_OFFSET);
+	header->base_offset = readl(disc_table + TELEM_BASE_OFFSET) + entry->base_addr;
 
 	/* Size is measured in DWORDS, but accessor returns bytes */
 	header->size = TELEM_SIZE(readl(disc_table));
diff --git a/drivers/platform/x86/intel/vsec.c b/drivers/platform/x86/intel/vsec.c
index 5378da9354b6..5a0dfc21eb0f 100644
--- a/drivers/platform/x86/intel/vsec.c
+++ b/drivers/platform/x86/intel/vsec.c
@@ -185,7 +185,7 @@ static int intel_vsec_add_dev(struct pci_dev *pdev, struct intel_vsec_header *he
 	if (quirks & VSEC_QUIRK_TABLE_SHIFT)
 		header->offset >>= TABLE_OFFSET_SHIFT;
 
-	if (info->base_addr)
+	if (!(quirks & VSEC_QUIRK_P2SB_OFFSET) && info->base_addr)
 		base_addr = info->base_addr;
 	else
 		base_addr = pdev->resource[header->tbir].start;
diff --git a/include/linux/intel_vsec.h b/include/linux/intel_vsec.h
index 04f915a1ba0b..68e3a42040e8 100644
--- a/include/linux/intel_vsec.h
+++ b/include/linux/intel_vsec.h
@@ -65,6 +65,9 @@ enum intel_vsec_quirks {
 
 	/* Platforms requiring quirk in the auxiliary driver */
 	VSEC_QUIRK_EARLY_HW     = BIT(4),
+
+	/* Broken P2SB access work around */
+	VSEC_QUIRK_P2SB_OFFSET  = BIT(5),
 };
 
 struct pmt_callbacks {
-- 
2.44.0


  parent reply	other threads:[~2024-05-10 21:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 20:59 [PATCH 0/6] Support PMT features in Xe Michael J. Ruhl
2024-05-10 20:59 ` [PATCH 1/6] platform/x86/intel/vsec.h: Move to include/linux Michael J. Ruhl
2024-05-28 15:43   ` Ruhl, Michael J
2024-05-30 21:07     ` David E. Box
2024-05-10 20:59 ` [PATCH 2/6] platform/x86/intel/vsec: Add PMT read callbacks Michael J. Ruhl
2024-05-10 20:59 ` [PATCH 3/6] platform/x86/intel/pmt: Add support to use provided " Michael J. Ruhl
2024-05-13 17:15   ` Rodrigo Vivi
2024-05-10 20:59 ` Michael J. Ruhl [this message]
2024-05-30 20:59   ` [PATCH 4/6] platform/x86/intel/pmt: Add quirk for BAR0 offset adjustment David E. Box
2024-05-31 15:40     ` Ruhl, Michael J
2024-05-10 20:59 ` [PATCH 5/6] drm/xe/vsec: Add support for DG2 Michael J. Ruhl
2024-05-10 20:59 ` [PATCH 6/6] drm/xe/vsec: Support BMG devices Michael J. Ruhl
2024-05-30 21:06   ` David E. Box
2024-05-31 15:42     ` Ruhl, Michael J
2024-05-10 21:48 ` ✓ CI.Patch_applied: success for Support PMT features in Xe Patchwork
2024-05-10 21:48 ` ✗ CI.checkpatch: warning " Patchwork
2024-05-10 21:49 ` ✗ CI.KUnit: failure " Patchwork

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=20240510205948.904409-5-michael.j.ruhl@intel.com \
    --to=michael.j.ruhl@intel.com \
    --cc=david.e.box@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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