<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
+Mario</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
<br>
</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
I guess that means the functionality needs to be present in amdgpu for APUs also. Presently, this is taken care by PMC driver for APUs.<span></span></div>
<div id="ms-outlook-mobile-signature" dir="auto">
<div><br>
</div>
Thanks,<br>
Lijo</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Andrey Grodzovsky <andrey.grodzovsky@amd.com><br>
<b>Sent:</b> Tuesday, March 8, 2022 9:55:03 PM<br>
<b>To:</b> Shashank Sharma <contactshashanksharma@gmail.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Sharma, Shashank <Shashank.Sharma@amd.com><br>
<b>Subject:</b> Re: [PATCH 1/2] drm: Add GPU reset sysfs event</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText"><br>
On 2022-03-07 11:26, Shashank Sharma wrote:<br>
> From: Shashank Sharma <shashank.sharma@amd.com><br>
><br>
> This patch adds a new sysfs event, which will indicate<br>
> the userland about a GPU reset, and can also provide<br>
> some information like:<br>
> - which PID was involved in the GPU reset<br>
> - what was the GPU status (using flags)<br>
><br>
> This patch also introduces the first flag of the flags<br>
> bitmap, which can be appended as and when required.<br>
<br>
<br>
I am reminding again about another important piece of info which you can add<br>
here and that is Smart Trace Buffer dump [1]. The buffer size is HW <br>
specific but<br>
from what I see there is no problem to just amend it as part of envp[] <br>
initialization.<br>
bellow.<br>
<br>
The interface to get the buffer is smu_stb_collect_info and usage can be <br>
seen from<br>
frebugfs interface in smu_stb_debugfs_open<br>
<br>
[1] - <a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Famd-gfx%2Fmsg70751.html&data=04%7C01%7Clijo.lazar%40amd.com%7C80bc3f07e2d0441d44a108da012036dc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637823535167679490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=53l7KlTf%2BICKkZkLVwFh6nRTjkAh%2FDpOat5DRoyKIx0%3D&reserved=0">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Famd-gfx%2Fmsg70751.html&data=04%7C01%7Clijo.lazar%40amd.com%7C80bc3f07e2d0441d44a108da012036dc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637823535167679490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=53l7KlTf%2BICKkZkLVwFh6nRTjkAh%2FDpOat5DRoyKIx0%3D&reserved=0</a><br>
<br>
Andrey<br>
<br>
<br>
><br>
> Cc: Alexandar Deucher <alexander.deucher@amd.com><br>
> Cc: Christian Koenig <christian.koenig@amd.com><br>
> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com><br>
> ---<br>
> drivers/gpu/drm/drm_sysfs.c | 24 ++++++++++++++++++++++++<br>
> include/drm/drm_sysfs.h | 3 +++<br>
> 2 files changed, 27 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c<br>
> index 430e00b16eec..52a015161431 100644<br>
> --- a/drivers/gpu/drm/drm_sysfs.c<br>
> +++ b/drivers/gpu/drm/drm_sysfs.c<br>
> @@ -409,6 +409,30 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)<br>
> }<br>
> EXPORT_SYMBOL(drm_sysfs_hotplug_event);<br>
> <br>
> +/**<br>
> + * drm_sysfs_reset_event - generate a DRM uevent to indicate GPU reset<br>
> + * @dev: DRM device<br>
> + * @pid: The process ID involve with the reset<br>
> + * @flags: Any other information about the GPU status<br>
> + *<br>
> + * Send a uevent for the DRM device specified by @dev. This indicates<br>
> + * user that a GPU reset has occurred, so that the interested client<br>
> + * can take any recovery or profiling measure, when required.<br>
> + */<br>
> +void drm_sysfs_reset_event(struct drm_device *dev, uint64_t pid, uint32_t flags)<br>
> +{<br>
> + unsigned char pid_str[21], flags_str[15];<br>
> + unsigned char reset_str[] = "RESET=1";<br>
> + char *envp[] = { reset_str, pid_str, flags_str, NULL };<br>
> +<br>
> + DRM_DEBUG("generating reset event\n");<br>
> +<br>
> + snprintf(pid_str, ARRAY_SIZE(pid_str), "PID=%lu", pid);<br>
> + snprintf(flags_str, ARRAY_SIZE(flags_str), "FLAGS=%u", flags);<br>
> + kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);<br>
> +}<br>
> +EXPORT_SYMBOL(drm_sysfs_reset_event);<br>
> +<br>
> /**<br>
> * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any connector<br>
> * change<br>
> diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h<br>
> index 6273cac44e47..63f00fe8054c 100644<br>
> --- a/include/drm/drm_sysfs.h<br>
> +++ b/include/drm/drm_sysfs.h<br>
> @@ -2,6 +2,8 @@<br>
> #ifndef _DRM_SYSFS_H_<br>
> #define _DRM_SYSFS_H_<br>
> <br>
> +#define DRM_GPU_RESET_FLAG_VRAM_VALID (1 << 0)<br>
> +<br>
> struct drm_device;<br>
> struct device;<br>
> struct drm_connector;<br>
> @@ -11,6 +13,7 @@ int drm_class_device_register(struct device *dev);<br>
> void drm_class_device_unregister(struct device *dev);<br>
> <br>
> void drm_sysfs_hotplug_event(struct drm_device *dev);<br>
> +void drm_sysfs_reset_event(struct drm_device *dev, uint64_t pid, uint32_t reset_flags);<br>
> void drm_sysfs_connector_hotplug_event(struct drm_connector *connector);<br>
> void drm_sysfs_connector_status_event(struct drm_connector *connector,<br>
> struct drm_property *property);<br>
</div>
</span></font></div>
</div>
</body>
</html>