Reduce the number of GPU resumes
cover Reduce the number of GPU resumes
The goal I'm aiming for is to be able to open a dri node and use amdgpu_device_initialize without waking up the GPU. One visible outcome is that it would become possible to call vkEnumeratePhysicalDevices without having to resume all the GPUs in the system.
This series implements some of the changes required to achieve this goal with a focus on not waking up the GPU for ioctls that don't need the GPU to be active.
The output of AMD_DEBUG=info doesn't change with these patches applied.
The other changes required are found in following patchset:
https://lists.freedesktop.org/archives/amd-gfx/2024-June/109796.html
Pierre-Eric Pelloux-Prayer (6):
drm/amdgpu: allow ioctls to opt-out of runtime pm drm/amdgpu: skip runtime pm for selected ioctls drm/amdgpu: refactor amdgpu_info_ioctl to allow finer pm drm/amdgpu: add AMDGPU_INFO_GB_ADDR_CONFIG query drm/amdgpu: cache mclk/sclk min/max values drm/amdgpu: resume the device from amdgpu_gem_fault
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 +- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 8 +- .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 69 ++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 116 +++++++++++++----- drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 8 +- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 12 +- include/uapi/drm/amdgpu_drm.h | 2 + 10 files changed, 198 insertions(+), 57 deletions(-)
Signature · 1 line
2.40.1
PATCH 1/6 drm/amdgpu: allow ioctls to opt-out of runtime pm
Waking up a device can take multiple seconds, so if it's not going to be used we might as well not resume it.
The safest default behavior for all ioctls is to resume the GPU, so this change allows specific ioctls to opt-out of generic runtime pm.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +20 -5
@@ -2855,18 +2855,33 @@ long amdgpu_drm_ioctl(struct file *filp, {struct drm_file *file_priv = filp->private_data;struct drm_device *dev; +bool needs_device;long ret; dev = file_priv->minor->dev; - ret =pm_runtime_get_sync (dev->dev); -if (ret <0 ) - goto out; + +/* Some ioctl can opt-out of powermanagement handling +* if they don't require the device to be resumed. +*/ +switch (cmd) { +default : + needs_device = true; + } + +if (needs_device) { + ret =pm_runtime_get_sync (dev->dev); +if (ret <0 ) + goto out; + } ret =drm_ioctl (filp, cmd, arg); -pm_runtime_mark_last_busy (dev->dev); out: -pm_runtime_put_autosuspend (dev->dev); +if (needs_device) { +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); + } +return ret; }
Signature · 1 line
2.40.1
Christian König
maintainerRe: [PATCH 1/6] drm/amdgpu: allow ioctls to opt-out of runtime pm
Am 18.06.24 um 17:23 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 6 lines
Waking up a device can take multiple seconds, so if it's not going to be used we might as well not resume it.
The safest default behavior for all ioctls is to resume the GPU, so this change allows specific ioctls to opt-out of generic runtime pm.
I'm really wondering if we shouldn't put that into the IOCTL description.
See amdgpu_ioctls_kms and DRM_IOCTL_DEF_DRV() for what I mean.
Regards,
Christian.
Quoted 49 lines
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +20
-5@@ -2855,18 +2855,33 @@ long amdgpu_drm_ioctl(struct file *filp, {struct drm_file *file_priv = filp->private_data;struct drm_device *dev; +bool needs_device;long ret; dev = file_priv->minor->dev; - ret =pm_runtime_get_sync (dev->dev); -if (ret <0 ) - goto out; + +/* Some ioctl can opt-out of powermanagement handling +* if they don't require the device to be resumed. +*/ +switch (cmd) { +default : + needs_device = true; + } + +if (needs_device) { + ret =pm_runtime_get_sync (dev->dev); +if (ret <0 ) + goto out; + } ret =drm_ioctl (filp, cmd, arg); -pm_runtime_mark_last_busy (dev->dev); out: -pm_runtime_put_autosuspend (dev->dev); +if (needs_device) { +pm_runtime_mark_last_busy (dev->dev); +pm_runtime_put_autosuspend (dev->dev); + } +return ret; }
Re: [PATCH 1/6] drm/amdgpu: allow ioctls to opt-out of runtime pm
Le 19/06/2024 à 11:26, Christian König a écrit :
Quoted 11 lines
Am 18.06.24 um 17:23 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 6 lines
Waking up a device can take multiple seconds, so if it's not going to be used we might as well not resume it.
The safest default behavior for all ioctls is to resume the GPU, so this change allows specific ioctls to opt-out of generic runtime pm.
I'm really wondering if we shouldn't put that into the IOCTL description.
See
amdgpu_ioctls_kmsandDRM_IOCTL_DEF_DRV()for what I mean.
Are you suggesting to add a new entry in enum drm_ioctl_flags to indicate ioctls which need the device to be awake?
Something like: "DRM_NO_DEVICE = BIT(6)" and then use it for both core and amdgpu ioctls?
Pierre-Eric
Quoted 49 lines
Regards,
Christian.Quoted 45 lines
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 25 ++++++++++++++++++++-----1 file changed, 20 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15
-4@@ -2855,18 +2855,33 @@ long amdgpu_drm_ioctl(struct file *filp, { struct drm_file *file_priv = filp->private_data; struct drm_device *dev; + bool needs_device; long ret; dev = file_priv->minor->dev; - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) - goto out; + + /* Some ioctl can opt-out of powermanagement handling + * if they don't require the device to be resumed. + */ + switch (cmd) { + default: + needs_device = true; + } + + if (needs_device) { + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0) + goto out; + } ret = drm_ioctl(filp, cmd, arg); - pm_runtime_mark_last_busy(dev->dev);out:
-pm_runtime_put_autosuspend(dev->dev);
+ if (needs_device) {
+pm_runtime_mark_last_busy(dev->dev);
+pm_runtime_put_autosuspend(dev->dev);
+ }
+
return ret;
}
Christian König
maintainerRe: [PATCH 1/6] drm/amdgpu: allow ioctls to opt-out of runtime pm
Am 20.06.24 um 15:06 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 9 lines
Le 19/06/2024 à 11:26, Christian König a écrit :
Quoted 8 lines
Am 18.06.24 um 17:23 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 6 lines
Waking up a device can take multiple seconds, so if it's not going to be used we might as well not resume it.
The safest default behavior for all ioctls is to resume the GPU, so this change allows specific ioctls to opt-out of generic runtime pm.
Quoted 8 lines
Quoted 3 lines
I'm really wondering if we shouldn't put that into the IOCTL description.
See
amdgpu_ioctls_kmsandDRM_IOCTL_DEF_DRV()for what I mean.Are you suggesting to add a new entry in enum
drm_ioctl_flagsto indicate ioctls which need the device to be awake?Something like: "
DRM_NO_DEVICE= BIT(6)" and then use it for both core and amdgpu ioctls?
Yeah something like that. Maybe name that DRM_SW_ONLY or something like that.
Christian.
Quoted 56 lines
Pierre-Eric
Quoted 50 lines
Regards,
Christian.Quoted 46 lines
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 25
++++++++++++++++++++-----1 file changed, 20 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15
-4@@ -2855,18 +2855,33 @@ long amdgpu_drm_ioctl(struct file *filp, { struct drm_file *file_priv = filp->private_data; struct drm_device *dev; + bool needs_device; long ret; dev = file_priv->minor->dev; - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) - goto out; + + /* Some ioctl can opt-out of powermanagement handling + * if they don't require the device to be resumed. + */ + switch (cmd) { + default: + needs_device = true; + } + + if (needs_device) { + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0) + goto out; + } ret = drm_ioctl(filp, cmd, arg); - pm_runtime_mark_last_busy(dev->dev);out:
-pm_runtime_put_autosuspend(dev->dev);
+ if (needs_device) {
+pm_runtime_mark_last_busy(dev->dev);
+pm_runtime_put_autosuspend(dev->dev);
+ }
+
return ret;
}
Re: [PATCH 1/6] drm/amdgpu: allow ioctls to opt-out of runtime pm
Le 20/06/2024 à 15:36, Christian König a écrit :
Quoted 12 lines
Am 20.06.24 um 15:06 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 11 lines
Le 19/06/2024 à 11:26, Christian König a écrit :
Quoted 10 lines
Am 18.06.24 um 17:23 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 6 lines
Waking up a device can take multiple seconds, so if it's not going to be used we might as well not resume it.
The safest default behavior for all ioctls is to resume the GPU, so this change allows specific ioctls to opt-out of generic runtime pm.
I'm really wondering if we shouldn't put that into the IOCTL description.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
See
amdgpu_ioctls_kmsandDRM_IOCTL_DEF_DRV()for what I mean.Are you suggesting to add a new entry in enum
drm_ioctl_flagsto indicate ioctls which need the device to be awake?Something like: "
DRM_NO_DEVICE= BIT(6)" and then use it for both core and amdgpu ioctls?Yeah something like that. Maybe name that
DRM_SW_ONLYor something like that.
+ dri-devel to gauge interest in adding such a flag in shared code.
Pierre-Eric
Quoted 59 lines
Christian.
Quoted 56 lines
Pierre-Eric
Quoted 50 lines
Regards,
Christian.Quoted 46 lines
Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 25
++++++++++++++++++++-----1 file changed, 20 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15
-4@@ -2855,18 +2855,33 @@ long amdgpu_drm_ioctl(struct file *filp, { struct drm_file *file_priv = filp->private_data; struct drm_device *dev; + bool needs_device; long ret; dev = file_priv->minor->dev; - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) - goto out; + + /* Some ioctl can opt-out of powermanagement handling + * if they don't require the device to be resumed. + */ + switch (cmd) { + default: + needs_device = true; + } + + if (needs_device) { + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0) + goto out; + } ret = drm_ioctl(filp, cmd, arg); - pm_runtime_mark_last_busy(dev->dev);out:
-pm_runtime_put_autosuspend(dev->dev);
+ if (needs_device) {
+pm_runtime_mark_last_busy(dev->dev);
+pm_runtime_put_autosuspend(dev->dev);
+ }
+
return ret;
}
Re: [PATCH 1/6] drm/amdgpu: allow ioctls to opt-out of runtime pm
Quoted 20 lines · Pierre-Eric Pelloux-Prayer
Le 20/06/2024 à 15:36, Christian König a écrit :
Quoted 18 lines
Am 20.06.24 um 15:06 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 17 lines
Le 19/06/2024 à 11:26, Christian König a écrit :
Quoted 4 lines
Am 18.06.24 um 17:23 schrieb Pierre-Eric Pelloux-Prayer:
Quoted 3 lines
Waking up a device can take multiple seconds, so if it's not going to be used we might as well not resume it.
Quoted 8 lines
Quoted 3 lines
The safest default behavior for all ioctls is to resume the GPU, so this change allows specific ioctls to opt-out of generic runtime pm.
I'm really wondering if we shouldn't put that into the IOCTL description.
See
amdgpu_ioctls_kmsandDRM_IOCTL_DEF_DRV()for what I mean.Are you suggesting to add a new entry in enum
drm_ioctl_flagsto indicate ioctls which need the device to be awake?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Something like: "
DRM_NO_DEVICE= BIT(6)" and then use it for both core and amdgpu ioctls?Yeah something like that. Maybe name that
DRM_SW_ONLYor something like that.+ dri-devel to gauge interest in adding such a flag in shared code.
Eh please no. That's just fundamentally the wrong way round to do runtime pm, but amdgpu goes way, way back in desing in that record to the vga switcheroo, where the simple hack was to just add runtime pm handling at the entry points and call it done.
If you look at any other drm driver, the runtime pm handling is done way down when touching the actual relevant hardware blocks. Because especially on arm it's actually a pile of runtime pm domains.
So essentially this is like pushing a big driver lock down the callchain until it's actually at the right level. First step would be to push it into each of the amdgpu ioctl callbacks, so that you can drop amdgpu_drm_ioctl and use drm_ioctl again directly. And then push it further until you can remove it from all the places where it's not needed.
DRM_SW_ONLY otoh is pure midlayer mistake design.
Cheers, Sima
Quoted 66 lines
Pierre-Eric
Quoted 61 lines
Christian.
Quoted 58 lines
Pierre-Eric
Quoted 52 lines
Regards,
Christian.Quoted 48 lines
Signed-off-by: Pierre-Eric Pelloux-Prayer
<[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 25
++++++++++++++++++++-----1 file changed, 20 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15
-4@@ -2855,18 +2855,33 @@ long amdgpu_drm_ioctl(struct file *filp, { struct drm_file *file_priv = filp->private_data; struct drm_device *dev; + bool needs_device; long ret; dev = file_priv->minor->dev; - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) - goto out; + + /* Some ioctl can opt-out of powermanagement handling + * if they don't require the device to be resumed. + */ + switch (cmd) { + default: + needs_device = true; + } + + if (needs_device) { + ret = pm_runtime_get_sync(dev->dev); + if (ret < 0) + goto out; + } ret = drm_ioctl(filp, cmd, arg); - pm_runtime_mark_last_busy(dev->dev);out:
-pm_runtime_put_autosuspend(dev->dev);
+ if (needs_device) {
+pm_runtime_mark_last_busy(dev->dev);
+pm_runtime_put_autosuspend(dev->dev);
+ }
+
return ret;
}
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
PATCH 2/6 drm/amdgpu: skip runtime pm for selected ioctls
In reply to Pierre-Eric Pelloux-PrayerThese ioctls don't need to GPU, so don't resume it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 45 +++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +42 -3
@@ -2855,7 +2855,9 @@ long amdgpu_drm_ioctl(struct file *filp, {struct drm_file *file_priv = filp->private_data;struct drm_device *dev; +bool is_driver_ioctl;bool needs_device; +unsigned int nr;long ret; dev = file_priv->minor->dev;
@@ -2863,9 +2865,46 @@ long amdgpu_drm_ioctl(struct file *filp,/* Some ioctl can opt-out of powermanagement handling * if they don't require the device to be resumed. */ -switch (cmd) { -default : - needs_device = true; + nr =DRM_IOCTL_NR (cmd); + + is_driver_ioctl = nr >=DRM_COMMAND_BASE && nr <DRM_COMMAND_END ; + +if (is_driver_ioctl) { +switch (nr -DRM_COMMAND_BASE ) { +/* These 4 only operate on kernel data structure. */ +case DRM_AMDGPU_VM : +case DRM_AMDGPU_SCHED : +case DRM_AMDGPU_BO_LIST : +case DRM_AMDGPU_FENCE_TO_HANDLE : +/* All the waits don't need to resume up the device. If there are +* jobs in progress, the device can't be in suspended state. And if +* there's nothing no in-flight jobs, then the waits are no-op. +*/ +case DRM_AMDGPU_GEM_WAIT_IDLE : +case DRM_AMDGPU_WAIT_CS : +case DRM_AMDGPU_WAIT_FENCES : + needs_device = false; +break ; +default : + needs_device = true; + } + }else { +/* Most drm core ioctls don't need the device, but to avoid missing one +* that requires it, implement the "can skip pm" logic as an allow list. +*/ +switch (nr) { +case DRM_IOCTL_NR (DRM_IOCTL_VERSION ): +case DRM_IOCTL_NR (DRM_IOCTL_AUTH_MAGIC ): +case DRM_IOCTL_NR (DRM_IOCTL_GET_CAP ): +case DRM_IOCTL_NR (DRM_IOCTL_SYNCOBJ_CREATE ): +/* Same logic as DRM_AMDGPU_WAIT_* */ +case DRM_IOCTL_NR (DRM_IOCTL_SYNCOBJ_WAIT ): +case DRM_IOCTL_NR (DRM_IOCTL_SYNCOBJ_DESTROY ): + needs_device = false; +break ; +default : + needs_device = true; + } }if (needs_device) {
Signature · 1 line
2.40.1
PATCH 3/6 drm/amdgpu: refactor amdgpu_info_ioctl to allow finer pm
In reply to Pierre-Eric Pelloux-PrayerAMDGPU_INFO_xxx has lots of different queries, and only a small number of them actually reaches out to the GPU.
This commit extract the amdgpu_info_ioctl implementation to a helper function, and then wrap it with the runtime pm logic each query type needs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 94 ++++++++++++++++++++----- 2 files changed, 80 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -2871,6 +2871,8 @@ long amdgpu_drm_ioctl(struct file *filp,if (is_driver_ioctl) {switch (nr -DRM_COMMAND_BASE ) { +/* amdgpu_info_ioctl will resume the device if it needs to. */ +case DRM_AMDGPU_INFO :/* These 4 only operate on kernel data structure. */ case DRM_AMDGPU_VM :case DRM_AMDGPU_SCHED :
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +78 -16
106 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH 4/6 drm/amdgpu: add AMDGPU_INFO_GB_ADDR_CONFIG query
In reply to Pierre-Eric Pelloux-Prayerlibdrm_amdgpu uses AMDGPU_INFO_READ_MMR_REG to fill the dev->info.gb_addr_cfg value.
Since this value is already known by the kernel, this commit implements a new query to return it.
The libdrm MR to use this query is:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/368
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++ include/uapi/drm/amdgpu_drm.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -117,9 +117,10 @@* - 3.56.0 - Update IB start address and size alignment for decode and encode * - 3.57.0 - Compute tunneling on GFX10+ * - 3.58.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT +* - 3.59.0 - Add AMDGPU_INFO_GB_ADDR_CONFIG support */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 58 +#define KMS_DRIVER_MINOR 59#define KMS_DRIVER_PATCHLEVEL 0/*
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -0
@@ -1256,6 +1256,10 @@ static int amdgpu_info(struct drm_device *dev, void *data, struct drm_file *filpreturn copy_to_user (out, &gpuvm_fault,min ((size_t )size,sizeof (gpuvm_fault))) ? -EFAULT :0 ; } +case AMDGPU_INFO_GB_ADDR_CONFIG : { + ui32 = adev->gfx.config.gb_addr_config; +return copy_to_user (out, &ui32,min (size,4u )) ? -EFAULT :0 ; + }default :DRM_DEBUG_KMS ("Invalid request %d\n" , info->query);return -EINVAL ;
@@ -1310,6 +1314,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)case AMDGPU_INFO_VIDEO_CAPS :case AMDGPU_INFO_MAX_IBS :case AMDGPU_INFO_GPUVM_FAULT : +case AMDGPU_INFO_GB_ADDR_CONFIG : need_runtime_pm = false;break ;
include/uapi/drm/amdgpu_drm.h +2 -0
@@ -933,6 +933,8 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {#define AMDGPU_INFO_MAX_IBS 0x22/* query last page fault info */ #define AMDGPU_INFO_GPUVM_FAULT 0x23 +/* Query GB_ADDR_CONFIG */ +#define AMDGPU_INFO_GB_ADDR_CONFIG 0x24#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
Signature · 1 line
2.40.1
Re: [PATCH 4/6] drm/amdgpu: add AMDGPU_INFO_GB_ADDR_CONFIG query
I would put this into drm_amdgpu_info_device. That structure can grow in size.
Marek
Quoted 71 lines · Pierre-Eric Pelloux-Prayer
libdrm_amdgpuusesAMDGPU_INFO_READ_MMR_REGto fill thedev->info.gb_addr_cfgvalue.
Since this value is already known by the kernel, this commit implements a new query to return it.The libdrm MR to use this query is:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/368Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++ include/uapi/drm/amdgpu_drm.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-1@@ -117,9 +117,10 @@* - 3.56.0 - Update IB start address and size alignment for decode and encode * - 3.57.0 - Compute tunneling on GFX10+ * - 3.58.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT +* - 3.59.0 - Add AMDGPU_INFO_GB_ADDR_CONFIG support */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 58 +#define KMS_DRIVER_MINOR 59#define KMS_DRIVER_PATCHLEVEL 0/* drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5
-0@@ -1256,6 +1256,10 @@ static int amdgpu_info(struct drm_device *dev, void *data, struct drm_file *filpreturn copy_to_user (out, &gpuvm_fault,min ((size_t )size,sizeof (gpuvm_fault))) ? -EFAULT :0 ; } +case AMDGPU_INFO_GB_ADDR_CONFIG : { + ui32 = adev->gfx.config.gb_addr_config; +return copy_to_user (out, &ui32,min (size,4u )) ? -EFAULT :0 ; + }default :DRM_DEBUG_KMS ("Invalid request %d\n" , info->query);return -EINVAL ;@@ -1310,6 +1314,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)case AMDGPU_INFO_VIDEO_CAPS :case AMDGPU_INFO_MAX_IBS :case AMDGPU_INFO_GPUVM_FAULT : +case AMDGPU_INFO_GB_ADDR_CONFIG : need_runtime_pm = false;break ;include/uapi/drm/amdgpu_drm.h +2
-1@@ -933,6 +933,8 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {#define AMDGPU_INFO_MAX_IBS 0x22/* query last page fault info */ #define AMDGPU_INFO_GPUVM_FAULT 0x23 +/* Query GB_ADDR_CONFIG */ +#define AMDGPU_INFO_GB_ADDR_CONFIG 0x24#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff --2.40.1
Christian König
maintainerRe: [PATCH 4/6] drm/amdgpu: add AMDGPU_INFO_GB_ADDR_CONFIG query
I would try to avoid that.
Putting everything into amdgpu_info_device was a mistake only done because people assumed that IOCTLs on Linux are to expensive to query all information separately.
We should rather have distinct IOCTLs for each value because that is way more flexible and we won't find later that we have to deprecate fields and work around issues because of legacy hw.
Regards,
Christian.
Am 19.06.24 um 02:34 schrieb Marek Olšák:
Quoted 76 lines
I would put this into
drm_amdgpu_info_device. That structure can grow in size.Marek
Quoted 70 lines · Pierre-Eric Pelloux-Prayer
libdrm_amdgpuusesAMDGPU_INFO_READ_MMR_REGto fill thedev->info.gb_addr_cfgvalue.
Since this value is already known by the kernel, this commit implements a new query to return it.The libdrm MR to use this query is:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/368Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++ include/uapi/drm/amdgpu_drm.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-1@@ -117,9 +117,10 @@* - 3.56.0 - Update IB start address and size alignment for decode and encode * - 3.57.0 - Compute tunneling on GFX10+ * - 3.58.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT +* - 3.59.0 - Add AMDGPU_INFO_GB_ADDR_CONFIG support */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 58 +#define KMS_DRIVER_MINOR 59#define KMS_DRIVER_PATCHLEVEL 0/* drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5
-0@@ -1256,6 +1256,10 @@ static int amdgpu_info(struct drm_device *dev, void *data, struct drm_file *filpreturn copy_to_user (out, &gpuvm_fault,min ((size_t )size,sizeof (gpuvm_fault))) ? -EFAULT :0 ; } +case AMDGPU_INFO_GB_ADDR_CONFIG : { + ui32 = adev->gfx.config.gb_addr_config; +return copy_to_user (out, &ui32,min (size,4u )) ? -EFAULT :0 ; + }default :DRM_DEBUG_KMS ("Invalid request %d\n" , info->query);return -EINVAL ;@@ -1310,6 +1314,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)case AMDGPU_INFO_VIDEO_CAPS :case AMDGPU_INFO_MAX_IBS :case AMDGPU_INFO_GPUVM_FAULT : +case AMDGPU_INFO_GB_ADDR_CONFIG : need_runtime_pm = false;break ;include/uapi/drm/amdgpu_drm.h +2
-1@@ -933,6 +933,8 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {#define AMDGPU_INFO_MAX_IBS 0x22/* query last page fault info */ #define AMDGPU_INFO_GPUVM_FAULT 0x23 +/* Query GB_ADDR_CONFIG */ +#define AMDGPU_INFO_GB_ADDR_CONFIG 0x24#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff --2.40.1
Re: [PATCH 4/6] drm/amdgpu: add AMDGPU_INFO_GB_ADDR_CONFIG query
The INFO ioctl was designed to allow increasing the sizes of all info structures. GB_ADDR_CONFIG isn't that special to justify a separate query.
Marek
Quoted 92 lines · Christian König
I would try to avoid that.
Putting everything into
amdgpu_info_devicewas a mistake only done because people assumed that IOCTLs on Linux are to expensive to query all information separately.We should rather have distinct IOCTLs for each value because that is way more flexible and we won't find later that we have to deprecate fields and work around issues because of legacy hw.
Regards,
Christian.Am 19.06.24 um 02:34 schrieb Marek Olšák:
Quoted 76 lines
I would put this into
drm_amdgpu_info_device. That structure can grow in size.Marek
Quoted 70 lines · Pierre-Eric Pelloux-Prayer
libdrm_amdgpuusesAMDGPU_INFO_READ_MMR_REGto fill thedev->info.gb_addr_cfgvalue.
Since this value is already known by the kernel, this commit implements a new query to return it.The libdrm MR to use this query is:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/368Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++ include/uapi/drm/amdgpu_drm.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-1@@ -117,9 +117,10 @@* - 3.56.0 - Update IB start address and size alignment for decode and encode * - 3.57.0 - Compute tunneling on GFX10+ * - 3.58.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT +* - 3.59.0 - Add AMDGPU_INFO_GB_ADDR_CONFIG support */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 58 +#define KMS_DRIVER_MINOR 59#define KMS_DRIVER_PATCHLEVEL 0/* drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5
-0@@ -1256,6 +1256,10 @@ static int amdgpu_info(struct drm_device *dev, void *data, struct drm_file *filpreturn copy_to_user (out, &gpuvm_fault,min ((size_t )size,sizeof (gpuvm_fault))) ? -EFAULT :0 ; } +case AMDGPU_INFO_GB_ADDR_CONFIG : { + ui32 = adev->gfx.config.gb_addr_config; +return copy_to_user (out, &ui32,min (size,4u )) ? -EFAULT :0 ; + }default :DRM_DEBUG_KMS ("Invalid request %d\n" , info->query);return -EINVAL ;@@ -1310,6 +1314,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)case AMDGPU_INFO_VIDEO_CAPS :case AMDGPU_INFO_MAX_IBS :case AMDGPU_INFO_GPUVM_FAULT : +case AMDGPU_INFO_GB_ADDR_CONFIG : need_runtime_pm = false;break ;include/uapi/drm/amdgpu_drm.h +2
-1@@ -933,6 +933,8 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {#define AMDGPU_INFO_MAX_IBS 0x22/* query last page fault info */ #define AMDGPU_INFO_GPUVM_FAULT 0x23 +/* Query GB_ADDR_CONFIG */ +#define AMDGPU_INFO_GB_ADDR_CONFIG 0x24#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff --2.40.1
Re: [PATCH 4/6] drm/amdgpu: add AMDGPU_INFO_GB_ADDR_CONFIG query
Both versions are fine by me, so I'll update the code to match whatever you agree on.
Pierre-Eric
Le 19/06/2024 à 20:44, Marek Olšák a écrit :
Quoted 100 lines
The INFO ioctl was designed to allow increasing the sizes of all info structures.
GB_ADDR_CONFIGisn't that special to justify a separate query.Marek
Quoted 92 lines · Christian König
I would try to avoid that.
Putting everything into
amdgpu_info_devicewas a mistake only done because people assumed that IOCTLs on Linux are to expensive to query all information separately.We should rather have distinct IOCTLs for each value because that is way more flexible and we won't find later that we have to deprecate fields and work around issues because of legacy hw.
Regards,
Christian.Am 19.06.24 um 02:34 schrieb Marek Olšák:
Quoted 76 lines
I would put this into
drm_amdgpu_info_device. That structure can grow in size.Marek
Quoted 70 lines · Pierre-Eric Pelloux-Prayer
libdrm_amdgpuusesAMDGPU_INFO_READ_MMR_REGto fill thedev->info.gb_addr_cfgvalue.
Since this value is already known by the kernel, this commit implements a new query to return it.The libdrm MR to use this query is:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/368Signed-off-by Pierre-Eric Pelloux-Prayer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++++ include/uapi/drm/amdgpu_drm.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-1@@ -117,9 +117,10 @@* - 3.56.0 - Update IB start address and size alignment for decode and encode * - 3.57.0 - Compute tunneling on GFX10+ * - 3.58.0 - Add AMDGPU_IDS_FLAGS_MODE_PF, AMDGPU_IDS_FLAGS_MODE_VF & AMDGPU_IDS_FLAGS_MODE_PT +* - 3.59.0 - Add AMDGPU_INFO_GB_ADDR_CONFIG support */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 58 +#define KMS_DRIVER_MINOR 59#define KMS_DRIVER_PATCHLEVEL 0/* drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5
-0@@ -1256,6 +1256,10 @@ static int amdgpu_info(struct drm_device *dev, void *data, struct drm_file *filpreturn copy_to_user (out, &gpuvm_fault,min ((size_t )size,sizeof (gpuvm_fault))) ? -EFAULT :0 ; } +case AMDGPU_INFO_GB_ADDR_CONFIG : { + ui32 = adev->gfx.config.gb_addr_config; +return copy_to_user (out, &ui32,min (size,4u )) ? -EFAULT :0 ; + }default :DRM_DEBUG_KMS ("Invalid request %d\n" , info->query);return -EINVAL ;@@ -1310,6 +1314,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)case AMDGPU_INFO_VIDEO_CAPS :case AMDGPU_INFO_MAX_IBS :case AMDGPU_INFO_GPUVM_FAULT : +case AMDGPU_INFO_GB_ADDR_CONFIG : need_runtime_pm = false;break ;include/uapi/drm/amdgpu_drm.h +2
-1@@ -933,6 +933,8 @@ struct drm_amdgpu_cs_chunk_cp_gfx_shadow {#define AMDGPU_INFO_MAX_IBS 0x22/* query last page fault info */ #define AMDGPU_INFO_GPUVM_FAULT 0x23 +/* Query GB_ADDR_CONFIG */ +#define AMDGPU_INFO_GB_ADDR_CONFIG 0x24#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff --2.40.1
PATCH 5/6 drm/amdgpu: cache mclk/sclk min/max values
In reply to Pierre-Eric Pelloux-PrayerThis way these values can be returned directly when using AMDGPU_INFO_DEV_INFO, without waking up the GPU.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 ++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 8 ++++---- .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 19 +++++-------------- drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 8 ++++---- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 12 ++++++------ 7 files changed, 40 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +10 -2
@@ -418,8 +418,16 @@ struct amdgpu_clock {struct amdgpu_pll spll;struct amdgpu_pll mpll;/* 10 Khz units */ -uint32_t default_mclk; -uint32_t default_sclk; +struct { +uint32_t min; +uint32_t max; +uint32_t def; + } mclk; +struct { +uint32_t min; +uint32_t max; +uint32_t def; + } sclk;uint32_t default_dispclk;uint32_t current_dispclk;uint32_t dp_extclk;
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +4 -4
@@ -658,9 +658,9 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev) mpll->pll_in_max =le16_to_cpu (firmware_info->info.usMaxMemoryClockPLL_Input); - adev->clock.default_sclk = + adev->clock.sclk.def = adev->clock.sclk.min = adev->clock.sclk.max =le32_to_cpu (firmware_info->info.ulDefaultEngineClock); - adev->clock.default_mclk = + adev->clock.mclk.def = adev->clock.mclk.min = adev->clock.mclk.max =le32_to_cpu (firmware_info->info.ulDefaultMemoryClock); mpll->min_post_div =1 ;
@@ -699,8 +699,8 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev) ret =0 ; } - adev->pm.current_sclk = adev->clock.default_sclk; - adev->pm.current_mclk = adev->clock.default_mclk; + adev->pm.current_sclk = adev->clock.sclk.def; + adev->pm.current_mclk = adev->clock.mclk.def;return ret; }
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +4 -4
@@ -719,13 +719,13 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev) (union firmware_info *)(mode_info->atom_context->bios + data_offset); - adev->clock.default_sclk = + adev->clock.sclk.def = adev->clock.sclk.min = adev->clock.sclk.max =le32_to_cpu (firmware_info->v31.bootup_sclk_in10khz); - adev->clock.default_mclk = + adev->clock.mclk.def = adev->clock.mclk.min = adev->clock.mclk.max =le32_to_cpu (firmware_info->v31.bootup_mclk_in10khz); - adev->pm.current_sclk = adev->clock.default_sclk; - adev->pm.current_mclk = adev->clock.default_mclk; + adev->pm.current_sclk = adev->clock.sclk.def; + adev->pm.current_mclk = adev->clock.mclk.def; ret =0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -0
@@ -4422,6 +4422,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,amdgpu_device_check_iommu_direct_map (adev); +if (adev->pm.dpm_enabled) { + adev->clock.sclk.min =amdgpu_dpm_get_sclk (adev, true); + adev->clock.sclk.max =amdgpu_dpm_get_sclk (adev, false); + adev->clock.mclk.min =amdgpu_dpm_get_mclk (adev, true); + adev->clock.mclk.max =amdgpu_dpm_get_mclk (adev, false); + } +return 0 ; release_ras_con:
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -14
@@ -827,19 +827,10 @@ static int amdgpu_info(struct drm_device *dev, void *data, struct drm_file *filp dev_info->num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;/* return all clocks in KHz */ dev_info->gpu_counter_freq =amdgpu_asic_get_xclk (adev) *10 ; -if (adev->pm.dpm_enabled) { - dev_info->max_engine_clock =amdgpu_dpm_get_sclk (adev, false) *10 ; - dev_info->max_memory_clock =amdgpu_dpm_get_mclk (adev, false) *10 ; - dev_info->min_engine_clock =amdgpu_dpm_get_sclk (adev, true) *10 ; - dev_info->min_memory_clock =amdgpu_dpm_get_mclk (adev, true) *10 ; - }else { - dev_info->max_engine_clock = - dev_info->min_engine_clock = - adev->clock.default_sclk *10 ; - dev_info->max_memory_clock = - dev_info->min_memory_clock = - adev->clock.default_mclk *10 ; - } + dev_info->min_engine_clock = adev->clock.sclk.min *10 ; + dev_info->max_engine_clock = adev->clock.sclk.max *10 ; + dev_info->min_memory_clock = adev->clock.mclk.min *10 ; + dev_info->max_memory_clock = adev->clock.mclk.max *10 ; dev_info->enabled_rb_pipes_mask = adev->gfx.config.backend_enable_mask; dev_info->num_rb_pipes = adev->gfx.config.max_backends_per_se * adev->gfx.config.max_shader_engines;
@@ -1315,12 +1306,12 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)case AMDGPU_INFO_MAX_IBS :case AMDGPU_INFO_GPUVM_FAULT :case AMDGPU_INFO_GB_ADDR_CONFIG : +case AMDGPU_INFO_DEV_INFO : need_runtime_pm = false;break ;case AMDGPU_INFO_TIMESTAMP :case AMDGPU_INFO_READ_MMR_REG : -case AMDGPU_INFO_DEV_INFO :case AMDGPU_INFO_SENSOR : need_runtime_pm = true;break ;
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +4 -4
@@ -2996,10 +2996,10 @@ static int kv_dpm_sw_init(void *handle) adev->pm.dpm.state =POWER_STATE_TYPE_BALANCED ; adev->pm.dpm.user_state =POWER_STATE_TYPE_BALANCED ; adev->pm.dpm.forced_level =AMD_DPM_FORCED_LEVEL_AUTO ; - adev->pm.default_sclk = adev->clock.default_sclk; - adev->pm.default_mclk = adev->clock.default_mclk; - adev->pm.current_sclk = adev->clock.default_sclk; - adev->pm.current_mclk = adev->clock.default_mclk; + adev->pm.default_sclk = adev->clock.sclk.def; + adev->pm.default_mclk = adev->clock.mclk.def; + adev->pm.current_sclk = adev->clock.sclk.def; + adev->pm.current_mclk = adev->clock.mclk.def; adev->pm.int_thermal_type =THERMAL_TYPE_NONE ;if (amdgpu_dpm ==0 )
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +6 -6
@@ -7232,8 +7232,8 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev,if (rps->class &ATOM_PPLIB_CLASSIFICATION_BOOT ) {u16 vddc, vddci, mvdd;amdgpu_atombios_get_default_voltages (adev, &vddc, &vddci, &mvdd); - pl->mclk = adev->clock.default_mclk; - pl->sclk = adev->clock.default_sclk; + pl->mclk = adev->clock.mclk.def; + pl->sclk = adev->clock.sclk.def; pl->vddc = vddc; pl->vddci = vddci; si_pi->mvdd_bootup_value = mvdd;
@@ -7733,10 +7733,10 @@ static int si_dpm_sw_init(void *handle) adev->pm.dpm.state =POWER_STATE_TYPE_BALANCED ; adev->pm.dpm.user_state =POWER_STATE_TYPE_BALANCED ; adev->pm.dpm.forced_level =AMD_DPM_FORCED_LEVEL_AUTO ; - adev->pm.default_sclk = adev->clock.default_sclk; - adev->pm.default_mclk = adev->clock.default_mclk; - adev->pm.current_sclk = adev->clock.default_sclk; - adev->pm.current_mclk = adev->clock.default_mclk; + adev->pm.default_sclk = adev->clock.sclk.def; + adev->pm.default_mclk = adev->clock.mclk.def; + adev->pm.current_sclk = adev->clock.sclk.def; + adev->pm.current_mclk = adev->clock.mclk.def; adev->pm.int_thermal_type =THERMAL_TYPE_NONE ;if (amdgpu_dpm ==0 )
Signature · 1 line
2.40.1
PATCH 6/6 drm/amdgpu: resume the device from amdgpu_gem_fault
In reply to Pierre-Eric Pelloux-PrayerThe fault handler may push some work to the GPU through amdgpu_bo_move so use the pm_runtime functions before that.
Since we're in an interrupt context, we can't use the sync version, so pm_runtime_get is called.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +11 -2
@@ -30,6 +30,7 @@#include <linux/pagemap.h> #include <linux/pci.h> #include <linux/dma-buf.h> +#include <linux/pm_runtime.h> #include <drm/amdgpu_drm.h> #include <drm/drm_drv.h>
@@ -52,9 +53,13 @@ static vm_fault_t amdgpu_gem_fault(struct vm_fault *vmf)vm_fault_t ret;int idx; + ret =pm_runtime_get (ddev->dev); +if (ret <0 ) +return ret; + ret =ttm_bo_vm_reserve (bo, vmf);if (ret) -return ret; + goto put_pm;if (drm_dev_enter (ddev, &idx)) { ret =amdgpu_bo_fault_reserve_notify (bo);
@@ -71,10 +76,14 @@ static vm_fault_t amdgpu_gem_fault(struct vm_fault *vmf) ret =ttm_bo_vm_dummy_page (vmf, vmf->vma->vm_page_prot); }if (ret ==VM_FAULT_RETRY && !(vmf->flags &FAULT_FLAG_RETRY_NOWAIT )) -return ret; + goto put_pm; unlock:dma_resv_unlock (bo->base.resv); +put_pm: +pm_runtime_mark_last_busy (ddev->dev); +pm_runtime_put_autosuspend (ddev->dev); +return ret; }
Signature · 1 line
2.40.1