drm/amdgpu: create PTL sysfs after XGMI reset-on-init restore

Create PTL sysfs in xgmi_reset_on_init restore path for MINIMAL_XGMI

Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Perry Yuan
2026-03-03 16:37:11 +08:00
committed by Alex Deucher
parent 1da21802df
commit e16d0d1672
3 changed files with 21 additions and 3 deletions

View File

@@ -1543,18 +1543,34 @@ static umode_t amdgpu_ptl_is_visible(struct kobject *kobj, struct attribute *att
int amdgpu_ptl_sysfs_init(struct amdgpu_device *adev)
{
if (!adev->psp.ptl.hw_supported)
struct amdgpu_ptl *ptl = &adev->psp.ptl;
int ret;
if (!ptl->hw_supported)
return 0;
return sysfs_create_group(&adev->dev->kobj, &amdgpu_ptl_attr_group);
if (ptl->ptl_sysfs_created)
return 0;
ret = sysfs_create_group(&adev->dev->kobj, &amdgpu_ptl_attr_group);
if (!ret)
ptl->ptl_sysfs_created = true;
return ret;
}
void amdgpu_ptl_sysfs_fini(struct amdgpu_device *adev)
{
if (!adev->psp.ptl.hw_supported)
struct amdgpu_ptl *ptl = &adev->psp.ptl;
if (!ptl->hw_supported)
return;
if (!ptl->ptl_sysfs_created)
return;
sysfs_remove_group(&adev->dev->kobj, &amdgpu_ptl_attr_group);
ptl->ptl_sysfs_created = false;
}
int psp_spatial_partition(struct psp_context *psp, int mode)

View File

@@ -90,6 +90,7 @@ static int amdgpu_reset_xgmi_reset_on_init_restore_hwctxt(
kgd2kfd_init_zone_device(tmp_adev);
amdgpu_amdkfd_device_init(tmp_adev);
amdgpu_amdkfd_drm_client_create(tmp_adev);
amdgpu_ptl_sysfs_init(tmp_adev);
}
}

View File

@@ -49,6 +49,7 @@ struct amdgpu_ptl {
atomic_t disable_ref;
struct mutex mutex;
DECLARE_BITMAP(disable_bitmap, AMDGPU_PTL_DISABLE_MAX);
bool ptl_sysfs_created;
};
int amdgpu_ptl_perf_monitor_ctrl(struct amdgpu_device *adev, u32 req_code,