Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEFB5606CDE2 for ; Fri, 13 Nov 2026 16:52:12 +0000 (UTC) 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=OOWQ59dI Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7471E10EC5B; Fri, 13 Nov 2026 16:52:07 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CF3A10EC5B for ; Fri, 13 Nov 2026 16:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1794588720; x=1826124720; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=M2VH82PNqECCSA4dQAU8LDdzQhQ4LtFD8TBOugfxa9M=; b=OOWQ59dIERPdkAcVI1TetfQMNhl1U2SGz60zPR+zsr6DY+EkLGHPhTMI 2Hohct8yXHrvjOlCwvCzlCxMV56Bdvcwd0LHxjNCYFHQga69J6UmqyJmf imWPVbasl/81pC/kqwCuQvmPrvytW6fW+zVro66VoNWwR0B2ULLm3YMMY +WKGiRohAJunFfdI0TBuDPKoQ7fh/zPP253eHs8tZB9X10ZOqEDLinGEa 8i/sCEzYGhnR3CNV5Ur6t9+ZWawjfp0N8J9/prphYK1GWsch4dNMvpi1k dbUQ3olTWIVInWzPGSGOL/0Cf9/kKuEGR2vqNVfgODBgj6IIs5fNu/ubM A==; X-CSE-ConnectionGUID: o3lhqPqJR+qKFot4VNo6pA== X-CSE-MsgGUID: vZBv8cDBROyNYdrt8lYoGw== X-IronPort-AV: E=McAfee;i="6800,10657,11965"; a="3392154" X-IronPort-AV: E=Sophos;i="6.27,212,1787036400"; d="scan'208";a="3392154" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2026 08:51:37 -0800 X-CSE-ConnectionGUID: nyBT59c+Sl23RqU8ku9rGg== X-CSE-MsgGUID: GKj+CzvxQnOm0lQI6pnwIw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,212,1787036400"; d="scan'208";a="9230819" Received: from mjruhl-vm.amr.corp.intel.com ([10.11.186.166]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2026 08:51:37 -0800 From: "Michael J. Ruhl" To: intel-xe@lists.freedesktop.org, 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 v15 12/17] drm/xe/vsec: Crescent Island PMT callbacks Date: Fri, 13 Nov 2026 08:51:38 -0800 Message-ID: <20261113165127.1989471-31-michael.j.ruhl@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261113165127.1989471-19-michael.j.ruhl@intel.com> References: <20261113165127.1989471-19-michael.j.ruhl@intel.com> X-Archived-By: 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-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 CRI PMT support requires callbacks to access the discovery status and control areas. Access is a common MMIO area that requires an index to be set before access is allowed. Introduce the necessary callbacks to get the status and control information for CRI PMT usage. Add the glue logic to register the CRI PMT functionality. Reviewed-by: Rodrigo Vivi Signed-off-by: Michael J. Ruhl --- drivers/gpu/drm/xe/xe_vsec.c | 114 +++++++++++++++++++++++++++++++++-- 1 file changed, 110 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c index a814d7151eea..4ca41a5ef502 100644 --- a/drivers/gpu/drm/xe/xe_vsec.c +++ b/drivers/gpu/drm/xe/xe_vsec.c @@ -344,10 +344,15 @@ int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offse } scoped_guard(mutex, &xe->pmt.lock) { + u32 device_id = FIELD_GET(GUID_DEVICE_ID, guid); + /* set SoC re-mapper index register based on GUID memory region */ xe->soc_remapper.set_telem_region(xe, mem_region); memcpy_fromio(data, telem_addr, count); + + if (device_id == CRI_DEVICE_ID) + xe->soc_remapper.set_telem_region(xe, CRI_IDX_TELEM_DISCOVERY); } xe_pm_runtime_put(xe); @@ -358,20 +363,114 @@ int xe_pmt_telem_read(struct device *dev, u32 guid, u64 *data, loff_t user_offse return ret == 0 ? count : ret; } -static struct pmt_callbacks xe_pmt_cb = { +/** + * xe_pmt_read_reg() - read a crashlog register + * @dev: the xe device that registered the callback + * @guid: PMT guid of the crashlog instance + * @reg: data read from the PMT data structure + * @offset: which data to read from the PMT data structure + * + * Read the requested PMT register based on the pcie device and guid. The + * supported struct is the Crashlog Type1 Version2. + * + * Currently this is for CRI only. + * + * Return: + * * -ENODEV device is not available (hotplug) + * * -EINVAL invalid guid + * * 0 success + */ +static int xe_pmt_read_reg(struct device *dev, u32 guid, u32 *reg, u32 offset) +{ + struct xe_device *xe = kdev_to_xe_device(dev); + void __iomem *disc_addr = xe->mmio.regs + xe->pmt.base_offset; + int ret = 0; + u32 inst; + int idx; + + if (FIELD_GET(GUID_DEVICE_ID, guid) != CRI_DEVICE_ID || + FIELD_GET(GUID_CAP_TYPE, guid) != CRASHLOG) + return -EINVAL; + + if (!drm_dev_enter(&xe->drm, &idx)) + return -ENODEV; + + inst = FIELD_GET(GUID_RECORD_ID, guid) == PUNIT ? + CRI_CRASHLOG_PUNIT_DISC_OFFSET : CRI_CRASHLOG_OOBMSM_DISC_OFFSET; + disc_addr += inst + offset; + + xe_pm_runtime_get(xe); + + scoped_guard(mutex, &xe->pmt.lock) { + xe->soc_remapper.set_telem_region(xe, CRI_IDX_TELEM_DISCOVERY); + + *reg = readl(disc_addr); + } + + xe_pm_runtime_put(xe); + + drm_dev_exit(idx); + + return ret; +} + +static int xe_pmt_write_reg(struct device *dev, u32 guid, u32 reg, u32 offset) +{ + struct xe_device *xe = kdev_to_xe_device(dev); + void __iomem *disc_addr = xe->mmio.regs + xe->pmt.base_offset; + int ret = 0; + u32 inst; + int idx; + + if (FIELD_GET(GUID_DEVICE_ID, guid) != CRI_DEVICE_ID || + FIELD_GET(GUID_CAP_TYPE, guid) != CRASHLOG) + return -EINVAL; + + if (!drm_dev_enter(&xe->drm, &idx)) + return -ENODEV; + + inst = FIELD_GET(GUID_RECORD_ID, guid) == PUNIT ? + CRI_CRASHLOG_PUNIT_DISC_OFFSET : CRI_CRASHLOG_OOBMSM_DISC_OFFSET; + disc_addr += inst + offset; + + xe_pm_runtime_get(xe); + + scoped_guard(mutex, &xe->pmt.lock) { + xe->soc_remapper.set_telem_region(xe, CRI_IDX_TELEM_DISCOVERY); + + writel(reg, disc_addr); + } + + xe_pm_runtime_put(xe); + + drm_dev_exit(idx); + + return ret; +} + +static struct pmt_callbacks xe_bmg_pmt_cb = { + .read_telem = xe_pmt_telem_read, +}; + +static struct pmt_callbacks xe_cri_pmt_cb = { .read_telem = xe_pmt_telem_read, + .read_reg = xe_pmt_read_reg, + .write_reg = xe_pmt_write_reg, }; static const int vsec_platforms[] = { [XE_BATTLEMAGE] = XE_VSEC_BMG, + [XE_CRESCENTISLAND] = XE_VSEC_CRI, }; static enum xe_vsec get_platform_info(struct xe_device *xe) { - if (xe->info.platform > XE_BATTLEMAGE) + if (xe->info.platform > XE_CRESCENTISLAND) return XE_VSEC_UNKNOWN; - if (IS_SRIOV_VF(xe) && xe->info.platform == XE_BATTLEMAGE) + if (IS_SRIOV_VF(xe) && + (xe->info.platform == XE_BATTLEMAGE || + xe->info.platform == XE_CRESCENTISLAND)) return XE_VSEC_UNKNOWN; return vsec_platforms[xe->info.platform]; @@ -399,8 +498,15 @@ 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; + info->priv_data = &xe_bmg_pmt_cb; break; + + case XE_VSEC_CRI: + xe->pmt.base_offset = CRI_PMT_OFFSET; + info->priv_data = &xe_cri_pmt_cb; + xe->soc_remapper.set_telem_region(xe, CRI_IDX_TELEM_DISCOVERY); + break; + default: break; } -- 2.43.0