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 34416C982DA for ; Fri, 18 Sep 2026 13:18:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DEB2310F3AB; Fri, 18 Sep 2026 13:18:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mX0uBn+y"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id E02C210E8C9 for ; Fri, 18 Sep 2026 13:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1789737487; x=1821273487; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=nvhshhgh9teX1zbE36DwwnBJBpg0/RZJQ4DMrNztzyo=; b=mX0uBn+yTgrf3gZzO/iU7tbrv+QkUZvax7uCaPP2/GH97nI9sY40x3gK pZk7E2dXDJGnvfvuvWKaA9QhniXhxSPIomjXj0bSzj6OwNmmjm5JbvXJZ +vmT+WRMmmX4Nt48OWUyirU1aZ2QDYCEO7U3ECNdNYOlgTRNDqVJ6eJd8 0LT3D+dXe8qlIZtIujD7qK5c6Q0l0oQpQpwNjex4sSJsZrHd9BpGvQpzo /uFnbpnUvbXJL9Lua9pclLxW4SfCak/DB2+9Yn/2IcPxWNcyJ9LLB/B08 wPSp+qy6GZWCWMP/fKdLr34lHqrwh4Q/6lQeSdUAH52lDKdk0KoTjVIcy g==; X-CSE-ConnectionGUID: SAErHctlT3GKXPbojQ3RRQ== X-CSE-MsgGUID: QsgdPZCeT+GgqWUeEydmaw== X-IronPort-AV: E=McAfee;i="6800,10657,11908"; a="89378265" X-IronPort-AV: E=Sophos;i="6.27,109,1787036400"; d="scan'208";a="89378265" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2026 06:18:03 -0700 X-CSE-ConnectionGUID: uFcYCu/3QEuUUXUZfvgelA== X-CSE-MsgGUID: b36lqkk+R/2Xw0Agito1fw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,109,1787036400"; d="scan'208";a="270095346" Received: from mjruhl-vm.amr.corp.intel.com ([10.11.186.166]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2026 06:18:02 -0700 From: "Michael J. Ruhl" 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, anoop.c.vijay@intel.com, badal.nilawar@intel.com, matthew.d.roper@intel.com, james.ausmus@intel.com, karthik.poosa@intel.com Subject: [PATCH v10 13/20] drm/xe/vsec: Add base_offset to allow for more flexibilty Date: Fri, 18 Sep 2026 06:18:04 -0700 Message-ID: <20260918131751.2408883-35-michael.j.ruhl@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260918131751.2408883-22-michael.j.ruhl@intel.com> References: <20260918131751.2408883-22-michael.j.ruhl@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" Current pmt_telem_read() usage is a fixed (for BMG) offset. In order to support other devices this must be settable. Add a base offset for more flexibility. Add a check to verify that it has been set before allowing device access. Reviewed-by: Rodrigo Vivi Signed-off-by: Michael J. Ruhl --- drivers/gpu/drm/xe/xe_device_types.h | 2 ++ drivers/gpu/drm/xe/xe_vsec.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h index bb4234f00453..e08348a95b28 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -486,6 +486,8 @@ struct xe_device { struct { /** @pmt.lock: protect access for telemetry data */ struct mutex lock; + /** @pmt.base_offset: device specific base offset */ + u64 base_offset; } pmt; /** @soc_remapper: SoC remapper object */ diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c index 1e1428313bd8..6f312ca3aa4c 100644 --- a/drivers/gpu/drm/xe/xe_vsec.c +++ b/drivers/gpu/drm/xe/xe_vsec.c @@ -172,6 +172,7 @@ static int xe_guid_decode(u32 guid, int *index, u32 *offset) * * Return: * * -ENODEV device is not available (hotplug) + * * -EAGAIN base_offset has not been set, so init path has not yet been done. * * -ENODATA for incorrect power state * * -EINVAL for unsupported PMT feature * * count number of bytes read on success @@ -180,8 +181,8 @@ int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offse u32 count) { struct xe_device *xe = kdev_to_xe_device(dev); - void __iomem *telem_addr = xe->mmio.regs + BMG_TELEMETRY_OFFSET; u32 cap_type = FIELD_GET(GUID_CAP_TYPE, guid); + void __iomem *telem_addr = xe->mmio.regs + xe->pmt.base_offset; u32 mem_region; u32 offset; int ret = 0; @@ -192,6 +193,11 @@ int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offse if (!drm_dev_enter(&xe->drm, &idx)) return -ENODEV; + if (!xe->pmt.base_offset) { + ret = -EAGAIN; + goto dev_exit; + } + ret = xe_guid_decode(guid, &mem_region, &offset); if (ret) goto dev_exit; @@ -269,6 +275,7 @@ void xe_vsec_init(struct xe_device *xe) switch (platform) { case XE_VSEC_BMG: + xe->pmt.base_offset = BMG_TELEMETRY_OFFSET; info->priv_data = &xe_pmt_cb; break; default: -- 2.43.0