<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>As long as PMC driver provides clear interface to retrieve the
info there should be no issue to call either amdgpu interface or
PMC interface using IS_APU (or something alike in the code)<br>
We probably should add a wrapper function around this logic in
amdgpu.<br>
</p>
<p>Andrey<br>
</p>
<div class="moz-cite-prefix">On 2022-03-08 11:36, Lazar, Lijo wrote:<br>
</div>
<blockquote type="cite" cite="mid:BYAPR12MB461498EFB1E9A3A76A38735497099@BYAPR12MB4614.namprd12.prod.outlook.com">
<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 style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> on
behalf of Andrey Grodzovsky
<a class="moz-txt-link-rfc2396E" href="mailto:andrey.grodzovsky@amd.com"><andrey.grodzovsky@amd.com></a><br>
<b>Sent:</b> Tuesday, March 8, 2022 9:55:03 PM<br>
<b>To:</b> Shashank Sharma
<a class="moz-txt-link-rfc2396E" href="mailto:contactshashanksharma@gmail.com"><contactshashanksharma@gmail.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a><br>
<b>Cc:</b> Deucher, Alexander
<a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a>; Somalapuram, Amaranath
<a class="moz-txt-link-rfc2396E" href="mailto:Amaranath.Somalapuram@amd.com"><Amaranath.Somalapuram@amd.com></a>; Koenig, Christian
<a class="moz-txt-link-rfc2396E" href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a>; Sharma, Shashank
<a class="moz-txt-link-rfc2396E" href="mailto:Shashank.Sharma@amd.com"><Shashank.Sharma@amd.com></a><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
<a class="moz-txt-link-rfc2396E" href="mailto:shashank.sharma@amd.com"><shashank.sharma@amd.com></a><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" moz-do-not-send="true">
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
<a class="moz-txt-link-rfc2396E" href="mailto:alexander.deucher@amd.com"><alexander.deucher@amd.com></a><br>
> Cc: Christian Koenig
<a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a><br>
> Signed-off-by: Shashank Sharma
<a class="moz-txt-link-rfc2396E" href="mailto:shashank.sharma@amd.com"><shashank.sharma@amd.com></a><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>
</blockquote>
</body>
</html>