From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB85AC88E72 for ; Mon, 14 Sep 2026 16:03:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7EB8310EFD5; Mon, 14 Sep 2026 16:03:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TgxUkUVg"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id C76D110E1D9 for ; Mon, 14 Sep 2026 16:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1789401806; x=1820937806; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=NyKdLkyxF+XUGpw6/rz1GWewWH7/w66WeL8Mra4/AYc=; b=TgxUkUVg9gAHAuZQw9frxbaA7VLfwpSr8hjnsEW29jf5ATQPEQVL40b0 cmhxLM3LOI5lhe9FzNq2gWBdbTREu+PCnojokEVHtpsBBN0PzmOUtdUOg YgDPDYgu0fN6n+bGJ5cemUwgvVycvNjsSQOFEPcq0qPUT69UwC7pjJQZn EKYw3sD6ctLR5chQ3I50wDoHbWF1ouXX7QSIa/nfIkCyIWrHjceEez8OS vtbE3OOD4JTVVlZ4GXLCgKQCuekEIH5b6j+pehl7J+JVh61/1ht0+rG+i Mh2sVijLNHoY8JXTHiprFSFq3LD8eaj2dBm1wCB9YShhNf6YXH+QZbrz+ g==; X-CSE-ConnectionGUID: qs/mcOV0Q1uSU0Vw/BjArA== X-CSE-MsgGUID: 5dU1SszYRNOsBGAX49kfHg== X-IronPort-AV: E=McAfee;i="6800,10657,11905"; a="93453500" X-IronPort-AV: E=Sophos;i="6.27,103,1787036400"; d="scan'208";a="93453500" Received: from fmviesa013.fm.intel.com ([10.60.135.153]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2026 09:03:26 -0700 X-CSE-ConnectionGUID: rbEtVWs7SnK5IG+YSzB6xQ== X-CSE-MsgGUID: L6aGqlaLQ0yMg6a9iQqJow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,103,1787036400"; d="scan'208";a="1075506" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by fmviesa013.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2026 09:03:26 -0700 Received: from FMSMSX903.amr.corp.intel.com (10.18.126.92) by fmsmsx903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Mon, 14 Sep 2026 09:03:24 -0700 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) by FMSMSX903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46 via Frontend Transport; Mon, 14 Sep 2026 09:03:24 -0700 Received: from CY3PR05CU001.outbound.protection.outlook.com (40.93.201.23) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Mon, 14 Sep 2026 09:03:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CSASZUC1LBHLyI3vhCi8ghGLQ2YHJMQROOE8iMf+ii1YKHASIvssZe8Z2OYu1XlD1RlGS8+KPLbA6vuKQF6KM0eJ6sdJDsVnBUdmEk/OOymQTghohlEXDvOHqdr+BlCprAMgo3qDfgU/QYgzTVZfULipWL5H9tI3M8kJfP/ovGS+GcvOnO9A8nKBXDQ01RuQZUbdn5SMiaZabWUy8HvSPoriRVPIByyuutSjMGSX3xk6pK933g1CKiF8MIkmXrs7fhXKwjk6QhX0dba55CebwP0rrmXfhHzJq84B8jMRk6Ub66CeZISOrgvESIuDFMBctaL8FqoIHhMPng+F2NhElw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vg3DopwNtUeyx7WYnHJwPov/Zos4DdnKBSlHodb+Obg=; b=T0ddc3jBVf0zvX+g8AXsCeuzkFPtdIJgiYYwi6sWPscZy3ZsGDOt866/IJ1Zv+tluedkXn9loNAtGjO+9s2L+zoATXcFTa4YSw5zqlaUzpuhlK9Oo59DWg6N8+Dti2/ug+8v+XNitsDrYiCAg8i4kxWY2X8RnuZ0gnWMC44HD3Fff/pZuxiP1IqKHoaH2g5qEKiyqrgYBm+nlRYJQZZn+zch3juSeJC67EaAuViZWkMx+JK4uEmNrKla8WNohBfhofCmJIaiBQPXx7F5+0ce9/dJUxmrWRKtQ3cm2BQixWQ8xr5nzOxaPAfIa9ZyqDjZI2dlUB8EKmsThQQXJuvHdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from IA0PR11MB7187.namprd11.prod.outlook.com (2603:10b6:208:441::12) by SJ0PR11MB5038.namprd11.prod.outlook.com (2603:10b6:a03:2d8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.12; Mon, 14 Sep 2026 16:03:16 +0000 Received: from IA0PR11MB7187.namprd11.prod.outlook.com ([fe80::be96:3f58:953d:6565]) by IA0PR11MB7187.namprd11.prod.outlook.com ([fe80::be96:3f58:953d:6565%4]) with mapi id 15.21.0406.007; Mon, 14 Sep 2026 16:03:16 +0000 Date: Mon, 14 Sep 2026 12:03:11 -0400 From: Rodrigo Vivi To: "Michael J. Ruhl" CC: , , , , , , , , , , , , , Subject: Re: [PATCH v8 04/20] platform/x86/intel/pmt: Add register access callbacks Message-ID: References: <20260911201148.1610547-22-michael.j.ruhl@intel.com> <20260911201148.1610547-26-michael.j.ruhl@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20260911201148.1610547-26-michael.j.ruhl@intel.com> X-ClientProxiedBy: SJ0PR05CA0128.namprd05.prod.outlook.com (2603:10b6:a03:33d::13) To IA0PR11MB7187.namprd11.prod.outlook.com (2603:10b6:208:441::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA0PR11MB7187:EE_|SJ0PR11MB5038:EE_ X-MS-Office365-Filtering-Correlation-Id: 291ead35-e3e3-4adf-f5df-08df1279afb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|23010399003|1800799024|376014|56012099006|11063799006|4143699003|10067099003|22082099003|18002099003|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: os/+C2215pp16up/zF+G2OzlT6wNN2z3ksW68sIMPVwT8F/ghyA+7GFoaXgSmo+d70SLFYX6sDZnPbGG2yF8su7NMIp41fTLrp829zKKT80PaJTGgPOy+6EswaKgrD6eFV/M5SKgWPI9czInKW4okot9yptxJZzowargGOj7ZXtFrMrn3MtRiolD98skzQRvMmdm7P7W/udp1SkIqlhuq4m/vECV/M4dPJcHtxWKP7COBvqDFFPpUZHp28GFqW1RiP2boM/B+iA3d9XsdJN/qFFQEtBg0D8je94M4ADuAecPyQNSHN6WRBdEIbDxhbE2yGif/HUwt32HNxhO8thZRTU40nNymIs4dTGmHgScr2ShejpYpYIBlVdQUeAd/u42QodMzcInElbHeUoZbnhpDmTC+DrNXr3KEl4aajWebIAHC9tp2NalLApl8zNtPLULN3zmbxwYPnv1j5affsklsmFX0z1K5Za9fci2xCz7uYWrAz3WzaLg5w0SC+rAUdvhoE4LIrllqoVNTnonLC9B3ddIGx/XjowrktIFqK9VVEnyTEpP+jesWOvJzG9sIWPqi1IyG1BG7ft9TLfw4U+a7W95KHsO8Y7A/JDg1ZhQtPym0jC/UFdMnxJtB7NGHYj+vRj5yuWX8mp4MbTolR4kNiLtkcjyaRDM4ZOWNkDA8Zw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:IA0PR11MB7187.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(23010399003)(1800799024)(376014)(56012099006)(11063799006)(4143699003)(10067099003)(22082099003)(18002099003)(6133799003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xyrw2A3lQekZUuEQ4kvYBIlzI2kQ6AIeCJadtbpA61Ov9CSRe48djQqkwqk6?= =?us-ascii?Q?jJkpsw8okhFj182+ADPILPjw/TgI96xpgKWxR7JfXOqJWdyiCwXfhYHJ0RaC?= =?us-ascii?Q?WADnHrCdV9mbkG6cv0+z+xvBTQLIYqPp2ZGGf/yB+x5j5frDZP+sfGgHxTbw?= =?us-ascii?Q?rrmPusaBMfeHcReqvfwNd6zDQ4Vbi0KRV1hAedImyQH77PxgUQ41RSgpGd1L?= =?us-ascii?Q?0GvoVISjhKEBOZb1ygUXcE7ZFFu59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qLL4O9n/9T4akooi8+XdDuauFsg== X-MS-Exchange-CrossTenant-Network-Message-Id: 291ead35-e3e3-4adf-f5df-08df1279afb2 X-MS-Exchange-CrossTenant-AuthSource: IA0PR11MB7187.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2026 16:03:16.0755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SvkfntGK1M4ofGTDQlT/ekOuQz0ii1hLaNObvRd+dPIPjtZlpCHacPxokEYiQdIaR6CGawGRinHNb0izFJQLoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5038 X-OriginatorOrg: intel.com X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Fri, Sep 11, 2026 at 01:11:52PM -0700, Michael J. Ruhl wrote: > 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 > --- > drivers/platform/x86/intel/pmt/crashlog.c | 46 +++++++++++++++++++++-- > include/linux/intel_vsec.h | 14 ++++++- > 2 files changed, 56 insertions(+), 4 deletions(-) > > diff --git a/drivers/platform/x86/intel/pmt/crashlog.c b/drivers/platform/x86/intel/pmt/crashlog.c > index b6540f3a9a17..912b61c334a6 100644 > --- a/drivers/platform/x86/intel/pmt/crashlog.c > +++ b/drivers/platform/x86/intel/pmt/crashlog.c > @@ -11,10 +11,12 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -124,12 +126,36 @@ struct pmt_crashlog_priv { > * I/O > */ > > +static int pmt_crashlog_read_reg(struct intel_pmt_entry *entry, u32 *reg, u32 offset) > +{ > + int ret; > + > + *reg = 0; > + > + if (entry->cb && entry->cb->read_reg) { > + ret = entry->cb->read_reg(entry->dev, entry->header.guid, reg, offset); > + if (ret) { > + pr_err_ratelimited("failed to read reg: %d\n", ret); I believe we should use dev_err_ratelimited no?! since patch 1 we have the right dev handle anyway now > + return ret; > + } > + } else { > + *reg = readl(entry->disc_table + offset); > + } > + > + return 0; > +} > + > /* Read, modify, write the control register, setting or clearing @bit based on @set */ > static int 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 reg; > + int ret; > + > + ret = pmt_crashlog_read_reg(entry, ®, control->offset); > + if (ret) > + return ret; > > reg &= ~control->trigger_mask; > > @@ -138,7 +164,15 @@ static int pmt_crashlog_rmw(struct crashlog_entry *crashlog, u32 bit, bool set) > else > reg &= ~bit; > > - writel(reg, entry->disc_table + control->offset); > + if (entry->cb && entry->cb->write_reg) { > + ret = entry->cb->write_reg(entry->dev, entry->header.guid, reg, control->offset); > + if (ret) { > + pr_err_ratelimited("failed to write reg: %d\n", ret); > + return ret; > + } > + } else { > + writel(reg, entry->disc_table + control->offset); > + } > > return 0; > } > @@ -147,7 +181,13 @@ static int pmt_crashlog_rmw(struct crashlog_entry *crashlog, u32 bit, bool set) > static int pmt_crashlog_rc(struct crashlog_entry *crashlog, u32 bit, bool *state) > { > 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 reg; > + int ret; > + > + ret = pmt_crashlog_read_reg(entry, ®, status->offset); > + if (ret) > + return ret; > > *state = !!(reg & bit); > > diff --git a/include/linux/intel_vsec.h b/include/linux/intel_vsec.h > index 843cda8f8644..917d9397a993 100644 > --- a/include/linux/intel_vsec.h > +++ b/include/linux/intel_vsec.h > @@ -90,13 +90,25 @@ enum intel_vsec_quirks { > * @read_telem: when specified, called by client driver to access PMT > * data (instead of direct copy). > * * dev: device reference for the callback's use > - * * guid: ID of data to acccss > + * * 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 > + * * dev: device reference for the callback's use > + * * guid: ID of data to access > + * * reg_data: register data > + * * offset: offset of register to read > + * @write_reg: when specified called by client driver to write PMT state > + * * dev: device reference for the callback's use > + * * guid: ID of data to access > + * * reg_data: register data > + * * offset: offset of register to write > */ > struct pmt_callbacks { > int (*read_telem)(struct device *dev, u32 guid, u64 *data, loff_t off, u32 count); > + int (*read_reg)(struct device *dev, u32 guid, u32 *reg_data, u32 offset); > + int (*write_reg)(struct device *dev, u32 guid, u32 reg_data, u32 offset); > }; > > struct vsec_feature_dependency { > -- > 2.43.0 >