From: Zhu Lingshan <lingshan.zhu@amd.com>
To: <Alexander.Deucher@amd.com>, <felix.kuehling@amd.com>
Cc: <Ray.Huang@amd.com>, <amd-gfx@lists.freedesktop.org>,
Zhu Lingshan <lingshan.zhu@amd.com>
Subject: [RFC 06/10] drm/amdgpu: GFX11: set mqd->perfcount from mqd_prop
Date: Tue, 22 Sep 2026 17:34:32 +0800 [thread overview]
Message-ID: <20260922093436.596947-7-lingshan.zhu@amd.com> (raw)
In-Reply-To: <20260922093436.596947-1-lingshan.zhu@amd.com>
This commit implements a new callback set_mqd_perfcount
in struct amdgpu_mqd. This callback helps setting
mqd->compute_perfcount_enable from amdgpu_mqd_prop->perfcount_enable.
This is a per-IP callback and it is NULL if an IP does not
support PMC.
This commit also implements set_mqd_perfcount for GFX11.
Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h | 6 ++++++
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 11 +++++++++++
2 files changed, 17 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
index 7a5499ec1171..f7ae3d5484da 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.h
@@ -479,12 +479,18 @@ struct amdgpu_mqd_prop {
uint64_t ctx_save_area_addr;
uint32_t ctx_save_area_size;
uint32_t ctl_stack_size;
+ /* PMC compute_perfcount_enable that programmed into this queue's MQD */
+ bool perfcount_enable;
};
struct amdgpu_mqd {
unsigned mqd_size;
int (*init_mqd)(struct amdgpu_device *adev, void *mqd,
struct amdgpu_mqd_prop *p);
+ /* Per-IP callback to set compute_perfcount_enable,
+ * NULL when this IP's MQD has no perfcount_enable field.
+ */
+ void (*set_mqd_perfcount)(void *mqd, struct amdgpu_mqd_prop *p);
};
/*
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 254a72f26ec5..252a1096b4a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -4323,6 +4323,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
mqd->header = 0xC0310800;
mqd->compute_pipelinestat_enable = 0x00000001;
+ mqd->compute_perfcount_enable = prop->perfcount_enable;
mqd->compute_static_thread_mgmt_se0 = 0xffffffff;
mqd->compute_static_thread_mgmt_se1 = 0xffffffff;
mqd->compute_static_thread_mgmt_se2 = 0xffffffff;
@@ -4459,6 +4460,14 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m,
return 0;
}
+static void gfx_v11_0_compute_mqd_set_perfcount(void *m,
+ struct amdgpu_mqd_prop *prop)
+{
+ struct v11_compute_mqd *mqd = m;
+
+ mqd->compute_perfcount_enable = prop->perfcount_enable;
+}
+
static int gfx_v11_0_kiq_init_register(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
@@ -7263,6 +7272,8 @@ static void gfx_v11_0_set_mqd_funcs(struct amdgpu_device *adev)
sizeof(struct v11_compute_mqd);
adev->mqds[AMDGPU_HW_IP_COMPUTE].init_mqd =
gfx_v11_0_compute_mqd_init;
+ adev->mqds[AMDGPU_HW_IP_COMPUTE].set_mqd_perfcount =
+ gfx_v11_0_compute_mqd_set_perfcount;
}
static void gfx_v11_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device *adev,
--
2.55.0
next prev parent reply other threads:[~2026-09-22 9:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 9:34 [RFC 00/10] amdgpu: implement Performance Monitor Counter support Zhu Lingshan
2026-09-22 9:34 ` [RFC 01/10] drm/amdgpu: implement PMC ioctl framework Zhu Lingshan
2026-09-23 14:17 ` James Zhu
2026-09-24 3:38 ` Zhu, Lingshan
2026-09-24 15:49 ` James Zhu
2026-10-08 7:59 ` Zhu, Lingshan
2026-09-22 9:34 ` [RFC 02/10] drm/amdgpu: add device-wide PMC config Zhu Lingshan
2026-09-23 14:13 ` James Zhu
2026-09-24 3:23 ` Zhu, Lingshan
2026-09-24 15:40 ` James Zhu
2026-10-08 7:50 ` Zhu, Lingshan
2026-09-22 9:34 ` [RFC 03/10] drm/amdgpu: introduce PMC ioctl handler Zhu Lingshan
2026-09-22 9:34 ` [RFC 04/10] drm/amdgpu: implement reservation mechanism for PMC Zhu Lingshan
2026-09-22 9:34 ` [RFC 05/10] drm/amdgpu: set device-wide PMC enablement indicator Zhu Lingshan
2026-09-22 9:34 ` Zhu Lingshan [this message]
2026-09-22 9:34 ` [RFC 07/10] drm/amdgpu: GFX12: set mqd->perfcount from mqd_prop Zhu Lingshan
2026-09-22 9:34 ` [RFC 08/10] drm/amdgpu: GFX12.1: " Zhu Lingshan
2026-09-22 9:34 ` [RFC 09/10] drm/amdgpu: implement device PMC handler Zhu Lingshan
2026-09-22 9:34 ` [RFC 10/10] drm/amdgpu: set userq perf state before publish it Zhu Lingshan
2026-09-23 14:02 ` [RFC 00/10] amdgpu: implement Performance Monitor Counter support James Zhu
2026-09-23 15:02 ` Welton, Benjamin
2026-09-23 15:11 ` James Zhu
2026-09-24 3:40 ` Zhu, Lingshan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260922093436.596947-7-lingshan.zhu@amd.com \
--to=lingshan.zhu@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Ray.Huang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox