From: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
To: platform-driver-x86@vger.kernel.org,
intel-xe@lists.freedesktop.org, hansg@kernel.org,
ilpo.jarvinen@linux.intel.com, matthew.brost@intel.com,
rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com,
airlied@gmail.com, simona@ffwll.ch, david.e.box@linux.intel.com
Cc: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
Subject: [PATCH v2 1/5] pmt: Add register access callbacks
Date: Fri, 30 Jan 2026 08:36:41 -0500 [thread overview]
Message-ID: <20260130133639.765378-8-michael.j.ruhl@intel.com> (raw)
In-Reply-To: <20260130133639.765378-7-michael.j.ruhl@intel.com>
Some HW does not have direct MMIO access to PMT control and data
features.
Augment the current callback infrastructure (data access) to allow
a registered driver to customize read/write access to the control
paths for PMT usage.
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
drivers/platform/x86/intel/pmt/crashlog.c | 39 +++++++++++++++++++++--
include/linux/intel_vsec.h | 26 +++++++++++----
2 files changed, 55 insertions(+), 10 deletions(-)
diff --git a/drivers/platform/x86/intel/pmt/crashlog.c b/drivers/platform/x86/intel/pmt/crashlog.c
index b0393c9c5b4b..e4778068b068 100644
--- a/drivers/platform/x86/intel/pmt/crashlog.c
+++ b/drivers/platform/x86/intel/pmt/crashlog.c
@@ -129,7 +129,19 @@ static void pmt_crashlog_rmw(struct crashlog_entry *crashlog, u32 bit, bool set)
{
const struct crashlog_control *control = &crashlog->info->control;
struct intel_pmt_entry *entry = &crashlog->entry;
- u32 reg = readl(entry->disc_table + control->offset);
+ u32 guid = entry->header.guid;
+ u32 reg;
+ int err;
+
+ if (entry->cb->read_reg) {
+ err = entry->cb->read_reg(entry->pcidev, guid, ®, control->offset);
+ if (err) {
+ pr_err("failed to read reg: %d\n", err);
+ return;
+ }
+ } else {
+ reg = readl(entry->disc_table + control->offset);
+ }
reg &= ~control->trigger_mask;
@@ -138,14 +150,35 @@ static void pmt_crashlog_rmw(struct crashlog_entry *crashlog, u32 bit, bool set)
else
reg &= ~bit;
- writel(reg, entry->disc_table + control->offset);
+ if (entry->cb->write_reg) {
+ err = entry->cb->write_reg(entry->pcidev, guid, reg, control->offset);
+ if (err) {
+ pr_err("failed to write reg: %d\n", err);
+ return;
+ }
+ } else {
+ writel(reg, entry->disc_table + control->offset);
+ }
}
/* Read the status register and see if the specified @bit is set */
static bool pmt_crashlog_rc(struct crashlog_entry *crashlog, u32 bit)
{
const struct crashlog_status *status = &crashlog->info->status;
- u32 reg = readl(crashlog->entry.disc_table + status->offset);
+ struct intel_pmt_entry *entry = &crashlog->entry;
+ u32 guid = entry->header.guid;
+ u32 reg;
+ int err;
+
+ if (entry->cb->read_reg) {
+ err = entry->cb->read_reg(entry->pcidev, guid, ®, status->offset);
+ if (err) {
+ pr_err("failed to read reg: %d\n", err);
+ return false;
+ }
+ } else {
+ reg = readl(crashlog->entry.disc_table + status->offset);
+ }
return !!(reg & bit);
}
diff --git a/include/linux/intel_vsec.h b/include/linux/intel_vsec.h
index 1a0f357c2427..c9b7aa860d0b 100644
--- a/include/linux/intel_vsec.h
+++ b/include/linux/intel_vsec.h
@@ -80,16 +80,28 @@ enum intel_vsec_quirks {
/**
* struct pmt_callbacks - Callback infrastructure for PMT devices
- * @read_telem: when specified, called by client driver to access PMT
- * data (instead of direct copy).
- * * pdev: PCI device reference for the callback's use
- * * guid: ID of data to acccss
- * * data: buffer for the data to be copied
- * * off: offset into the requested buffer
- * * count: size of buffer
+ * @read_telem: when specified, called by client driver to access PMT data (instead
+ * of direct copy).
+ * @pdev: PCI device reference for the callback's use
+ * @guid: ID of data to access
+ * @data: buffer for the data to be copied
+ * @off: offset into the requested buffer
+ * @count: size of buffer
+ * @read_reg: when specified called by client driver to read PMT state
+ * @pdev: PCI device reference for the callback's use
+ * @guid: ID of data to access
+ * @data: buffer for the register data to be read
+ * @offset: offset of control register to access
+ * @write_reg: when specified called by client driver to write PMT state
+ * @pdev: PCI device reference for the callback's use
+ * @guid: ID of data to access
+ * @data: buffer data to be written to the register
+ * @offset: offset of control register to access
*/
struct pmt_callbacks {
int (*read_telem)(struct pci_dev *pdev, u32 guid, u64 *data, loff_t off, u32 count);
+ int (*read_reg)(struct pci_dev *pdev, u32 guid, u32 *data, u32 offset);
+ int (*write_reg)(struct pci_dev *pdev, u32 guid, u32 data, u32 offset);
};
struct vsec_feature_dependency {
--
2.52.0
next prev parent reply other threads:[~2026-01-30 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 13:36 [PATCH v2 0/5] Crescent Island PMT support Michael J. Ruhl
2026-01-30 13:36 ` Michael J. Ruhl [this message]
2026-01-30 13:36 ` [PATCH v2 2/5] drm/xe/vsec: Use correct pm state get Michael J. Ruhl
2026-01-30 13:36 ` [PATCH v2 3/5] drm/xe/vsec: Support Crescent Island PMT Michael J. Ruhl
2026-01-30 13:36 ` [PATCH v2 4/5] drm/xe/vsec: Crescent Island PMT decode Michael J. Ruhl
2026-01-30 13:36 ` [PATCH v2 5/5] drm/xe/vsec: Crescent Island PMT callbacks Michael J. Ruhl
2026-01-30 13:48 ` ✓ CI.KUnit: success for Crescent Island PMT support (rev2) Patchwork
2026-01-30 14:24 ` ✓ Xe.CI.BAT: " 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=20260130133639.765378-8-michael.j.ruhl@intel.com \
--to=michael.j.ruhl@intel.com \
--cc=airlied@gmail.com \
--cc=david.e.box@linux.intel.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@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