* [PATCH v2 0/3] Add debugfs to expose G2, G6, G8, G10 and ModS residency
@ 2025-05-29 17:57 Soham Purkait
2025-05-29 17:57 ` [PATCH v2 1/3] Utility function and macro for telemetry reading Soham Purkait
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Soham Purkait @ 2025-05-29 17:57 UTC (permalink / raw)
To: intel-xe, anshuman.gupta, badal.nilawar, karthik.poosa,
riana.tauro, jani.nikula
Cc: lucas.demarchi, soham.purkait, ashutosh.dixit
The changes in the first patch is taken from
https://patchwork.freedesktop.org/series/149026/
Thay are added only for compilation and does not
require review.
This patch exposes G2, G6, G8, G10 and ModS residency counter value through
debugfs.
Soham Purkait (3):
Utility function and macro for telemetry reading
drm/xe/xe_debugfs: Exposure of G-State residency counter through
debugfs
drm/xe/regs/xe_pmt: Macros for G-State residency offset
drivers/gpu/drm/xe/regs/xe_pmt.h | 11 ++++++
drivers/gpu/drm/xe/xe_debugfs.c | 61 ++++++++++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_vsec.c | 2 +-
drivers/gpu/drm/xe/xe_vsec.h | 5 +++
4 files changed, 78 insertions(+), 1 deletion(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/3] Utility function and macro for telemetry reading
2025-05-29 17:57 [PATCH v2 0/3] Add debugfs to expose G2, G6, G8, G10 and ModS residency Soham Purkait
@ 2025-05-29 17:57 ` Soham Purkait
2025-05-30 16:10 ` Poosa, Karthik
2025-05-29 17:57 ` [PATCH v2 2/3] drm/xe/xe_debugfs: Exposure of G-State residency counter through debugfs Soham Purkait
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Soham Purkait @ 2025-05-29 17:57 UTC (permalink / raw)
To: intel-xe, anshuman.gupta, badal.nilawar, karthik.poosa,
riana.tauro, jani.nikula
Cc: lucas.demarchi, soham.purkait, ashutosh.dixit
The changes in this patch is taken from
https://patchwork.freedesktop.org/series/149026/
Thay are added only for compilation and does not
require review.
---
drivers/gpu/drm/xe/regs/xe_pmt.h | 5 +++++
drivers/gpu/drm/xe/xe_vsec.c | 2 +-
drivers/gpu/drm/xe/xe_vsec.h | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/regs/xe_pmt.h b/drivers/gpu/drm/xe/regs/xe_pmt.h
index f45abcd96ba8..b1d4504e4adc 100644
--- a/drivers/gpu/drm/xe/regs/xe_pmt.h
+++ b/drivers/gpu/drm/xe/regs/xe_pmt.h
@@ -10,6 +10,11 @@
#define BMG_PMT_BASE_OFFSET 0xDB000
#define BMG_DISCOVERY_OFFSET (SOC_BASE + BMG_PMT_BASE_OFFSET)
+#define PUNIT_TELEMETRY_GUID XE_REG(BMG_DISCOVERY_OFFSET + 0x4)
+#define BMG_ENERGY_STATUS_PMT_OFFSET (0x30)
+#define ENERGY_PKG REG_GENMASK64(31, 0)
+#define ENERGY_CARD REG_GENMASK64(63, 32)
+
#define BMG_TELEMETRY_BASE_OFFSET 0xE0000
#define BMG_TELEMETRY_OFFSET (SOC_BASE + BMG_TELEMETRY_BASE_OFFSET)
diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c
index b378848d3b7b..a46e9580b1f4 100644
--- a/drivers/gpu/drm/xe/xe_vsec.c
+++ b/drivers/gpu/drm/xe/xe_vsec.c
@@ -149,7 +149,7 @@ static int xe_guid_decode(u32 guid, int *index, u32 *offset)
return 0;
}
-static int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
+int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
u32 count)
{
struct xe_device *xe = pdev_to_xe_device(pdev);
diff --git a/drivers/gpu/drm/xe/xe_vsec.h b/drivers/gpu/drm/xe/xe_vsec.h
index 5777c53faec2..6184b875e4b1 100644
--- a/drivers/gpu/drm/xe/xe_vsec.h
+++ b/drivers/gpu/drm/xe/xe_vsec.h
@@ -4,8 +4,13 @@
#ifndef _XE_VSEC_H_
#define _XE_VSEC_H_
+#include "linux/types.h"
+#include "linux/pci.h"
+
struct xe_device;
void xe_vsec_init(struct xe_device *xe);
+int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
+ u32 count);
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] drm/xe/xe_debugfs: Exposure of G-State residency counter through debugfs
2025-05-29 17:57 [PATCH v2 0/3] Add debugfs to expose G2, G6, G8, G10 and ModS residency Soham Purkait
2025-05-29 17:57 ` [PATCH v2 1/3] Utility function and macro for telemetry reading Soham Purkait
@ 2025-05-29 17:57 ` Soham Purkait
2025-05-29 17:57 ` [PATCH v2 3/3] drm/xe/regs/xe_pmt: Macros for G-State residency offset Soham Purkait
2025-05-29 20:26 ` ✗ CI.Patch_applied: failure for Add debugfs to expose G2, G6, G8, G10 and ModS residency (rev2) Patchwork
3 siblings, 0 replies; 6+ messages in thread
From: Soham Purkait @ 2025-05-29 17:57 UTC (permalink / raw)
To: intel-xe, anshuman.gupta, badal.nilawar, karthik.poosa,
riana.tauro, jani.nikula
Cc: lucas.demarchi, soham.purkait, ashutosh.dixit
Add a debugfs node named dgfx_pkg_residencies in order to obtain the
G-State residency counter values for G2, G6, G8, G10 & ModS.
Signed-off-by: Soham Purkait <soham.purkait@intel.com>
---
drivers/gpu/drm/xe/xe_debugfs.c | 61 +++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c
index d0503959a8ed..98e9f3ab6c5e 100644
--- a/drivers/gpu/drm/xe/xe_debugfs.c
+++ b/drivers/gpu/drm/xe/xe_debugfs.c
@@ -11,16 +11,19 @@
#include <drm/drm_debugfs.h>
+#include "regs/xe_pmt.h"
#include "xe_bo.h"
#include "xe_device.h"
#include "xe_force_wake.h"
#include "xe_gt_debugfs.h"
#include "xe_gt_printk.h"
#include "xe_guc_ads.h"
+#include "xe_mmio.h"
#include "xe_pm.h"
#include "xe_pxp_debugfs.h"
#include "xe_sriov.h"
#include "xe_step.h"
+#include "xe_vsec.h"
#ifdef CONFIG_DRM_XE_DEBUG
#include "xe_bo_evict.h"
@@ -185,12 +188,67 @@ static ssize_t wedged_mode_set(struct file *f, const char __user *ubuf,
return size;
}
+static int read_residency_counter(struct xe_device *xe, struct xe_mmio *mmio,
+ u64 *dst, u32 offset, char *name)
+{
+ int ret = xe_pmt_telem_read(to_pci_dev(xe->drm.dev),
+ xe_mmio_read32(mmio, PUNIT_TELEMETRY_GUID),
+ dst, offset, sizeof(u64));
+ if (ret != sizeof(u64)) {
+ drm_warn(&xe->drm, "%s residency counter failed to read, ret %d\n", name, ret);
+ }
+ return 0;
+}
+
+
+static ssize_t dgfx_pkg_residencies_show(struct file *f, char __user *ubuf,
+ size_t size, loff_t *pos)
+{
+ u64 g_states;
+ char buf[256];
+ int len = 0;
+ struct xe_device *xe;
+ struct xe_mmio *mmio;
+
+ xe = file_inode(f)->i_private;
+ xe_pm_runtime_get(xe);
+ mmio = xe_root_tile_mmio(xe);
+
+ g_states = 0;
+ read_residency_counter(xe, mmio, &g_states, BMG_G2_RESIDENCY_OFFSET, "G2");
+ len = scnprintf(buf, sizeof(buf), "Package G2: %llu\n", g_states);
+
+ g_states = 0;
+ read_residency_counter(xe, mmio, &g_states, BMG_G6_RESIDENCY_OFFSET, "G6");
+ len += scnprintf(buf + len, sizeof(buf) - len, "Package G6: %llu\n", g_states);
+
+ g_states = 0;
+ read_residency_counter(xe, mmio, &g_states, BMG_G8_RESIDENCY_OFFSET, "G8");
+ len += scnprintf(buf + len, sizeof(buf) - len, "Package G8: %llu\n", g_states);
+
+ g_states = 0;
+ read_residency_counter(xe, mmio, &g_states, BMG_G10_RESIDENCY_OFFSET, "G10");
+ len += scnprintf(buf + len, sizeof(buf) - len, "Package G10: %llu\n", g_states);
+
+ g_states = 0;
+ read_residency_counter(xe, mmio, &g_states, BMG_MODS_RESIDENCY_OFFSET, "ModS");
+ len += scnprintf(buf + len, sizeof(buf) - len, "Package ModS: %llu\n", g_states);
+
+ xe_pm_runtime_put(xe);
+ return simple_read_from_buffer(ubuf, size, pos, buf, len);
+}
+
static const struct file_operations wedged_mode_fops = {
.owner = THIS_MODULE,
.read = wedged_mode_show,
.write = wedged_mode_set,
};
+static const struct file_operations dgfx_pkg_residencies_fops = {
+ .owner = THIS_MODULE,
+ .read = dgfx_pkg_residencies_show,
+};
+
void xe_debugfs_register(struct xe_device *xe)
{
struct ttm_device *bdev = &xe->ttm;
@@ -211,6 +269,9 @@ void xe_debugfs_register(struct xe_device *xe)
debugfs_create_file("wedged_mode", 0600, root, xe,
&wedged_mode_fops);
+ debugfs_create_file("dgfx_pkg_residencies", 0444, root, xe,
+ &dgfx_pkg_residencies_fops);
+
for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1; ++mem_type) {
man = ttm_manager_type(bdev, mem_type);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] drm/xe/regs/xe_pmt: Macros for G-State residency offset
2025-05-29 17:57 [PATCH v2 0/3] Add debugfs to expose G2, G6, G8, G10 and ModS residency Soham Purkait
2025-05-29 17:57 ` [PATCH v2 1/3] Utility function and macro for telemetry reading Soham Purkait
2025-05-29 17:57 ` [PATCH v2 2/3] drm/xe/xe_debugfs: Exposure of G-State residency counter through debugfs Soham Purkait
@ 2025-05-29 17:57 ` Soham Purkait
2025-05-29 20:26 ` ✗ CI.Patch_applied: failure for Add debugfs to expose G2, G6, G8, G10 and ModS residency (rev2) Patchwork
3 siblings, 0 replies; 6+ messages in thread
From: Soham Purkait @ 2025-05-29 17:57 UTC (permalink / raw)
To: intel-xe, anshuman.gupta, badal.nilawar, karthik.poosa,
riana.tauro, jani.nikula
Cc: lucas.demarchi, soham.purkait, ashutosh.dixit
Add G-State residency offset macros for G2, G6, G8, G10
and ModS.
Signed-off-by: Soham Purkait <soham.purkait@intel.com>
---
drivers/gpu/drm/xe/regs/xe_pmt.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/xe/regs/xe_pmt.h b/drivers/gpu/drm/xe/regs/xe_pmt.h
index b1d4504e4adc..23995835a583 100644
--- a/drivers/gpu/drm/xe/regs/xe_pmt.h
+++ b/drivers/gpu/drm/xe/regs/xe_pmt.h
@@ -21,4 +21,10 @@
#define SG_REMAP_INDEX1 XE_REG(SOC_BASE + 0x08)
#define SG_REMAP_BITS REG_GENMASK(31, 24)
+#define BMG_G2_RESIDENCY_OFFSET (0x530)
+#define BMG_G6_RESIDENCY_OFFSET (0x538)
+#define BMG_G8_RESIDENCY_OFFSET (0x540)
+#define BMG_G10_RESIDENCY_OFFSET (0x548)
+#define BMG_MODS_RESIDENCY_OFFSET (0x4D0)
+
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* ✗ CI.Patch_applied: failure for Add debugfs to expose G2, G6, G8, G10 and ModS residency (rev2)
2025-05-29 17:57 [PATCH v2 0/3] Add debugfs to expose G2, G6, G8, G10 and ModS residency Soham Purkait
` (2 preceding siblings ...)
2025-05-29 17:57 ` [PATCH v2 3/3] drm/xe/regs/xe_pmt: Macros for G-State residency offset Soham Purkait
@ 2025-05-29 20:26 ` Patchwork
3 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2025-05-29 20:26 UTC (permalink / raw)
To: Soham Purkait; +Cc: intel-xe
== Series Details ==
Series: Add debugfs to expose G2, G6, G8, G10 and ModS residency (rev2)
URL : https://patchwork.freedesktop.org/series/149406/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 901190a06230 drm-tip: 2025y-05m-29d-16h-22m-38s UTC integration manifest
=== git am output follows ===
.git/rebase-apply/patch:35: trailing whitespace.
{
.git/rebase-apply/patch:57: trailing whitespace.
mmio = xe_root_tile_mmio(xe);
.git/rebase-apply/patch:103: trailing whitespace.
error: patch failed: drivers/gpu/drm/xe/xe_debugfs.c:185
error: drivers/gpu/drm/xe/xe_debugfs.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: Utility function and macro for telemetry reading
Applying: drm/xe/xe_debugfs: Exposure of G-State residency counter through debugfs
Patch failed at 0002 drm/xe/xe_debugfs: Exposure of G-State residency counter through debugfs
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] Utility function and macro for telemetry reading
2025-05-29 17:57 ` [PATCH v2 1/3] Utility function and macro for telemetry reading Soham Purkait
@ 2025-05-30 16:10 ` Poosa, Karthik
0 siblings, 0 replies; 6+ messages in thread
From: Poosa, Karthik @ 2025-05-30 16:10 UTC (permalink / raw)
To: Soham Purkait, intel-xe, anshuman.gupta, badal.nilawar,
riana.tauro, jani.nikula
Cc: lucas.demarchi, ashutosh.dixit
On 29-05-2025 23:27, Soham Purkait wrote:
> The changes in this patch is taken from
> https://patchwork.freedesktop.org/series/149026/
> Thay are added only for compilation and does not
> require review.
> ---
> drivers/gpu/drm/xe/regs/xe_pmt.h | 5 +++++
> drivers/gpu/drm/xe/xe_vsec.c | 2 +-
> drivers/gpu/drm/xe/xe_vsec.h | 5 +++++
> 3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/regs/xe_pmt.h b/drivers/gpu/drm/xe/regs/xe_pmt.h
> index f45abcd96ba8..b1d4504e4adc 100644
> --- a/drivers/gpu/drm/xe/regs/xe_pmt.h
> +++ b/drivers/gpu/drm/xe/regs/xe_pmt.h
> @@ -10,6 +10,11 @@
> #define BMG_PMT_BASE_OFFSET 0xDB000
> #define BMG_DISCOVERY_OFFSET (SOC_BASE + BMG_PMT_BASE_OFFSET)
>
> +#define PUNIT_TELEMETRY_GUID XE_REG(BMG_DISCOVERY_OFFSET + 0x4)
> +#define BMG_ENERGY_STATUS_PMT_OFFSET (0x30)
> +#define ENERGY_PKG REG_GENMASK64(31, 0)
> +#define ENERGY_CARD REG_GENMASK64(63, 32)
> +
> #define BMG_TELEMETRY_BASE_OFFSET 0xE0000
> #define BMG_TELEMETRY_OFFSET (SOC_BASE + BMG_TELEMETRY_BASE_OFFSET)
>
> diff --git a/drivers/gpu/drm/xe/xe_vsec.c b/drivers/gpu/drm/xe/xe_vsec.c
> index b378848d3b7b..a46e9580b1f4 100644
> --- a/drivers/gpu/drm/xe/xe_vsec.c
> +++ b/drivers/gpu/drm/xe/xe_vsec.c
> @@ -149,7 +149,7 @@ static int xe_guid_decode(u32 guid, int *index, u32 *offset)
> return 0;
> }
>
> -static int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
> +int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
> u32 count)
> {
> struct xe_device *xe = pdev_to_xe_device(pdev);
> diff --git a/drivers/gpu/drm/xe/xe_vsec.h b/drivers/gpu/drm/xe/xe_vsec.h
> index 5777c53faec2..6184b875e4b1 100644
> --- a/drivers/gpu/drm/xe/xe_vsec.h
> +++ b/drivers/gpu/drm/xe/xe_vsec.h
> @@ -4,8 +4,13 @@
> #ifndef _XE_VSEC_H_
> #define _XE_VSEC_H_
>
> +#include "linux/types.h"
> +#include "linux/pci.h"
> +
> struct xe_device;
>
> void xe_vsec_init(struct xe_device *xe);
> +int xe_pmt_telem_read(struct pci_dev *pdev, u32 guid, u64 *data, loff_t user_offset,
> + u32 count);
>
> #endif
These are merged now
https://lore.kernel.org/all/20250529163458.2354509-6-karthik.poosa@intel.com/
, you can rebase on top of it.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-30 16:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-29 17:57 [PATCH v2 0/3] Add debugfs to expose G2, G6, G8, G10 and ModS residency Soham Purkait
2025-05-29 17:57 ` [PATCH v2 1/3] Utility function and macro for telemetry reading Soham Purkait
2025-05-30 16:10 ` Poosa, Karthik
2025-05-29 17:57 ` [PATCH v2 2/3] drm/xe/xe_debugfs: Exposure of G-State residency counter through debugfs Soham Purkait
2025-05-29 17:57 ` [PATCH v2 3/3] drm/xe/regs/xe_pmt: Macros for G-State residency offset Soham Purkait
2025-05-29 20:26 ` ✗ CI.Patch_applied: failure for Add debugfs to expose G2, G6, G8, G10 and ModS residency (rev2) Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox