<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Hey,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Due to mode-1 reset (pending_reset), the amdgpu_amdkfd_device_init will not be called
and hence adev->kfd.init_complete will not be set. The function </span><span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">amdgpu_amdkfd_drm_client_create</span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"> has
condition:</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">if (!adev->kfd.init_complete)</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"> return 0;</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">So, in probe function, when we return from device_init the KFD is not initialized and
</span><span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">amdgpu_amdkfd_drm_client_create</span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"> returns
without doing anything.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Thanks,</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">Ahmad</span></div>
<div id="appendonsend"></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> Kuehling, Felix <Felix.Kuehling@amd.com><br>
<b>Sent:</b> Monday, March 4, 2024 6:39 PM<br>
<b>To:</b> Rehman, Ahmad <Ahmad.Rehman@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Wan, Gavin <Gavin.Wan@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Init zone device and drm client after mode-1 reset on reload</span>
<div> </div>
</div>
<div><span style="font-size: 11pt;"><br>
On 2024-03-04 17:05, Ahmad Rehman wrote:<br>
> In passthrough environment, when amdgpu is reloaded after unload, mode-1<br>
> is triggered after initializing the necessary IPs, That init does not<br>
> include KFD, and KFD init waits until the reset is completed. KFD init<br>
> is called in the reset handler, but in this case, the zone device and<br>
> drm client is not initialized, causing app to create kernel panic.<br>
><br>
> Signed-off-by: Ahmad Rehman <Ahmad.Rehman@amd.com><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++++-<br>
> 1 file changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
> index 15b188aaf681..80b9642f2bc4 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
> @@ -2479,8 +2479,11 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)<br>
> }<br>
> for (i = 0; i < mgpu_info.num_dgpu; i++) {<br>
> adev = mgpu_info.gpu_ins[i].adev;<br>
> - if (!adev->kfd.init_complete)<br>
> + if (!adev->kfd.init_complete) {<br>
> + kgd2kfd_init_zone_device(adev);<br>
> amdgpu_amdkfd_device_init(adev);<br>
> + amdgpu_amdkfd_drm_client_create(adev);<br>
I don't see what's preventing the DRM client initialization in the<br>
reset-on-driver-load case. It only needs to be created once and that<br>
happens in amdgpu_pci_probe. Am I missing anything?<br>
<br>
Regards,<br>
Felix<br>
<br>
<br>
> + }<br>
> amdgpu_ttm_set_buffer_funcs_status(adev, true);<br>
> }<br>
> }</span></div>
</div>
</body>
</html>