Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.20 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795208183; b=NDPINjHgDGtZx9IJLFMHmcrV+Y0ZKj7mLbsFJ2ie/452PUC0rxX1rJfSHncn1aUm4eAH aDOSE2kSgHfvmtAUT7Bq0Eob67U+xdN+kDaMUQ+f1lyzzT81nw32s8zBokgqMjrM8ugLq bqbZznC5hSy8nwgL5qtETS8LX93uDWMJOQR/EDf7yH9VGSgKRPQHL1XW74AduP5AUzpDL iGmR4GGcHm31KoIlmKxOCPDZ5tl9JtwDsDdmoY8xe4j9EPBYzblUfgSOZDuCd2q1R7hA3 aWcKP+kKbqD2Lpw3vuUSfVYMUCYGZZp8KF9A/lbNAl5cOG9RzKcPWwyFooFeGQHApXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795208183; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=UrZbvoAFJwoa0i6t6y0LTycCeyrMMzWnUZgvfQkou2o=; b=aeFVUgonQ0j8N6GqfrWvhFrRTgV/3rbVBlCjcCofGIBBgHIm6/3cHRfM95LT5CwEICSg q3Kem8SGPk/wABFtfiMJYzufqU8iMRrpX2oO3SGZ8zY1kj2mcvhoGtpdUy7Z+J58/cvxG OUN8LmwDNFGVaOwGxvrNRMQiI7wA1AIAvk2tXgIf3ywJOuvFdYwBZpXqz9upmVWPfX4FV gISQCAR3cwUFrnGSaOOzNyxOSgGQfwwBS/n+EoEeYGUjZ626ENzp0Gyp/xSJIBmhJCtMQ pp2e1hY9ePijeSve0w/uuw5Vhzf4efBQF3/KpxPFuQTkuDEOGP/dheSWHjvmdMV1S9A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=evOxoTvY; arc=none smtp.remote-ip=198.175.65.20 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6232606A6A4 for ; Fri, 20 Nov 2026 20:56:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D6232606A6A4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=evOxoTvY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795208178; x=1826744178; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=oSGYNqOC1mFfgS+KeULfGVQeu0cTpI0kmdZMiAU38js=; b=evOxoTvYJzBpDSlV2Y7+VkXz7O8QljGqc83iNnQP9+uhUyv5D3OApnRb P147J0Ui98sSSCoZs7mcphW8uVdmXemwumxK2o18wJOOS9/RSZ6EUhAJq 5hv0Pti3IcYFcnH/lW8EBE9Kk7V+tvu5e4jNiNxF3ETpLqFrMVKP4yhI6 ZcSXduolO/Ko233dAagkhkepLfSnHz7YIsqyNhmQa+dSUfl1w4jjVYCqY tgHRFLI8gqpi1akKZ9Kge/45c3u61ag+rdrhY/IYdhlFOt0c+aV/AlQfq Aj3va7Z4L04uG4Tk/texU60LoW+HY//S5xQfG3e/rIeGmc2atgM5j9M34 w==; X-CSE-ConnectionGUID: 0OSDGQlJRSCJ1bp/qVzlIw== X-CSE-MsgGUID: 0zRVT2c3QviAHUQdtYZXrQ== X-IronPort-AV: E=McAfee;i="6800,10657,11972"; a="4136427" X-IronPort-AV: E=Sophos;i="6.27,223,1787036400"; d="scan'208";a="4136427" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2026 12:55:51 -0800 X-CSE-ConnectionGUID: tryUI/89RpeGigB5jc0/4A== X-CSE-MsgGUID: 9YnsRMQwThO61FixGbrlQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,223,1787036400"; d="scan'208";a="10908740" Received: from mjruhl-vm.amr.corp.intel.com ([10.11.186.166]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2026 12:55:49 -0800 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 Subject: [PATCH v21 17/19] drm/xe/vsec: Update PMT internal access Date: Fri, 20 Nov 2026 12:55:57 -0800 Message-ID: <20261120205540.1220643-38-michael.j.ruhl@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261120205540.1220643-21-michael.j.ruhl@intel.com> References: <20261120205540.1220643-21-michael.j.ruhl@intel.com> X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Current PMT internal access assumes BMG devices. Use the new PMT GUID API to read the device specific guid. Minor cleanup for a newly unused parameter (mmio). Reviewed-by: Karthik Poosa Signed-off-by: Michael J. Ruhl --- drivers/gpu/drm/xe/xe_debugfs.c | 26 ++++++++++++++------------ drivers/gpu/drm/xe/xe_hwmon.c | 10 ++++++++-- drivers/gpu/drm/xe/xe_pcode.c | 10 ++++++++-- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c index 342182d5ecda..578ee973d159 100644 --- a/drivers/gpu/drm/xe/xe_debugfs.c +++ b/drivers/gpu/drm/xe/xe_debugfs.c @@ -5,6 +5,7 @@ #include "xe_debugfs.h" +#include #include #include #include @@ -21,7 +22,6 @@ #include "xe_gt.h" #include "xe_gt_debugfs.h" #include "xe_hw_engine.h" -#include "xe_mmio.h" #include "xe_pagefault.h" #include "xe_pcode.h" #include "xe_pm.h" @@ -149,15 +149,20 @@ static void xe_fault_inject_debugfs_register(struct xe_device *xe, } } -static void read_residency_counter(struct xe_device *xe, struct xe_mmio *mmio, - u32 offset, const char *name, struct drm_printer *p) +static void read_residency_counter(struct xe_device *xe, u32 offset, const char *name, + struct drm_printer *p) { u64 residency = 0; + u32 guid; int ret; - ret = xe_pmt_telem_read(xe->drm.dev, - xe_mmio_read32(mmio, BMG_PUNIT_TELEMETRY_GUID), - &residency, offset, sizeof(residency)); + ret = xe_vsec_get_guid(xe, &guid); + if (ret) { + drm_warn(&xe->drm, "PMT device is not available: %d\n", ret); + return; + } + + ret = xe_pmt_telem_read(xe->drm.dev, guid, &residency, offset, sizeof(residency)); if (ret != sizeof(residency)) { drm_warn(&xe->drm, "%s counter failed to read, ret %d\n", name, ret); return; @@ -296,13 +301,12 @@ static int pcode_info(struct seq_file *m, void *data) static int dgfx_pkg_residencies_show(struct seq_file *m, void *data) { struct xe_device *xe; - struct xe_mmio *mmio; struct drm_printer p; xe = node_to_xe(m->private); p = drm_seq_file_printer(m); guard(xe_pm_runtime)(xe); - mmio = xe_root_tile_mmio(xe); + static const struct { u32 offset; const char *name; @@ -316,7 +320,7 @@ static int dgfx_pkg_residencies_show(struct seq_file *m, void *data) }; for (int i = 0; i < ARRAY_SIZE(residencies); i++) - read_residency_counter(xe, mmio, residencies[i].offset, residencies[i].name, &p); + read_residency_counter(xe, residencies[i].offset, residencies[i].name, &p); return 0; } @@ -324,13 +328,11 @@ static int dgfx_pkg_residencies_show(struct seq_file *m, void *data) static int dgfx_pcie_link_residencies_show(struct seq_file *m, void *data) { struct xe_device *xe; - struct xe_mmio *mmio; struct drm_printer p; xe = node_to_xe(m->private); p = drm_seq_file_printer(m); guard(xe_pm_runtime)(xe); - mmio = xe_root_tile_mmio(xe); static const struct { u32 offset; @@ -342,7 +344,7 @@ static int dgfx_pcie_link_residencies_show(struct seq_file *m, void *data) }; for (int i = 0; i < ARRAY_SIZE(residencies); i++) - read_residency_counter(xe, mmio, residencies[i].offset, residencies[i].name, &p); + read_residency_counter(xe, residencies[i].offset, residencies[i].name, &p); return 0; } diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c index 55ff56a39599..171990602f53 100644 --- a/drivers/gpu/drm/xe/xe_hwmon.c +++ b/drivers/gpu/drm/xe/xe_hwmon.c @@ -603,9 +603,15 @@ xe_hwmon_energy_get(struct xe_hwmon *hwmon, int channel, long *energy) if (hwmon->xe->info.platform == XE_BATTLEMAGE) { u64 pmt_val; + u32 guid; - ret = xe_pmt_telem_read(hwmon->xe->drm.dev, - xe_mmio_read32(mmio, BMG_PUNIT_TELEMETRY_GUID), + ret = xe_vsec_get_guid(hwmon->xe, &guid); + if (ret) { + drm_warn(&hwmon->xe->drm, "PMT device is not available: %d\n", ret); + *energy = 0; + return ret; + } + ret = xe_pmt_telem_read(hwmon->xe->drm.dev, guid, &pmt_val, BMG_ENERGY_STATUS_PMT_OFFSET, sizeof(pmt_val)); if (ret != sizeof(pmt_val)) { drm_warn(&hwmon->xe->drm, "energy read from pmt failed, ret %d\n", ret); diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c index 8c901e54f384..fa9f45d565cb 100644 --- a/drivers/gpu/drm/xe/xe_pcode.c +++ b/drivers/gpu/drm/xe/xe_pcode.c @@ -365,11 +365,17 @@ ALLOW_ERROR_INJECTION(xe_pcode_probe_early, ERRNO); /* See xe_pci_probe */ int xe_get_pcode_version(struct xe_device *xe, struct xe_pcode_version *version) { int ret = 0; + u32 guid; guard(xe_pm_runtime)(xe); - ret = xe_pmt_telem_read(xe->drm.dev, - xe_mmio_read32(xe_root_tile_mmio(xe), BMG_PUNIT_TELEMETRY_GUID), + ret = xe_vsec_get_guid(xe, &guid); + if (ret) { + xe_warn(xe, "PMT device is not available: %d\n", ret); + return ret; + } + + ret = xe_pmt_telem_read(xe->drm.dev, guid, (u64 *)version, PUNIT_VERSION_OFFSET, sizeof(*version)); if (ret != sizeof(*version)) { xe_warn(xe, "pcode version read from PMT failed, ret %pe\n", ERR_PTR(ret)); -- 2.43.0