* [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl"
@ 2026-12-03 17:51 Shahyan Soltani
2026-12-03 17:52 ` [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list Shahyan Soltani
2026-12-03 18:40 ` [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" sashiko-bot
0 siblings, 2 replies; 5+ messages in thread
From: Shahyan Soltani @ 2026-12-03 17:51 UTC (permalink / raw)
To: amd-gfx; +Cc: christian.koenig, alexander.deucher
Commit 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl") is
broken as it forgot to account for non amdgpu IOCTLs that required the
GPU to be active. Without the wrapper, these IOCTLs can no longer resume
the device, so they can run while the GPU is suspended.
Revert commit 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl")
to allow the GPU to resume on all IOCTLs.
Fixes: 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl")
Signed-off-by: Shahyan Soltani <shahyan.soltani@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/amdgpu/Makefile | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 23 +++++++++++-
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h | 6 +++
drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c | 45 +++++++++++++++++++++++
4 files changed, 73 insertions(+), 2 deletions(-)
create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c
diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
index 6a5ce2b89378..c1ef2e0af033 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -340,6 +340,7 @@ include $(FULL_AMD_PATH)/acp/Makefile
amdgpu-y += $(AMD_ACP_FILES)
endif
+amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o
amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
amdgpu-$(CONFIG_HMM_MIRROR) += amdgpu_hmm.o
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 11fcf068b0a7..57bbb057108f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -3019,6 +3019,25 @@ static int amdgpu_drm_release(struct inode *inode, struct file *filp)
return drm_release(inode, filp);
}
+long amdgpu_drm_ioctl(struct file *filp,
+ unsigned int cmd, unsigned long arg)
+{
+ struct drm_file *file_priv = filp->private_data;
+ struct drm_device *dev;
+ long ret;
+
+ dev = file_priv->minor->dev;
+ ret = pm_runtime_get_sync(dev->dev);
+ if (ret < 0)
+ goto out;
+
+ ret = drm_ioctl(filp, cmd, arg);
+
+out:
+ pm_runtime_put_autosuspend(dev->dev);
+ return ret;
+}
+
static const struct dev_pm_ops amdgpu_pm_ops = {
.prepare = pm_sleep_ptr(amdgpu_pmops_prepare),
.complete = pm_sleep_ptr(amdgpu_pmops_complete),
@@ -3051,12 +3070,12 @@ static const struct file_operations amdgpu_driver_kms_fops = {
.open = drm_open,
.flush = amdgpu_flush,
.release = amdgpu_drm_release,
- .unlocked_ioctl = drm_ioctl,
+ .unlocked_ioctl = amdgpu_drm_ioctl,
.mmap = drm_gem_mmap,
.poll = drm_poll,
.read = drm_read,
#ifdef CONFIG_COMPAT
- .compat_ioctl = drm_compat_ioctl,
+ .compat_ioctl = amdgpu_kms_compat_ioctl,
#endif
#ifdef CONFIG_PROC_FS
.show_fdinfo = drm_show_fdinfo,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h
index 6b06c0956e48..2d86cc6f7f4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h
@@ -43,4 +43,10 @@
extern const struct drm_driver amdgpu_partition_driver;
+long amdgpu_drm_ioctl(struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
+long amdgpu_kms_compat_ioctl(struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c
new file mode 100644
index 000000000000..a1cbd7c3deb2
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c
@@ -0,0 +1,45 @@
+/*
+ * \file amdgpu_ioc32.c
+ *
+ * 32-bit ioctl compatibility routines for the AMDGPU DRM.
+ *
+ * \author Paul Mackerras <paulus@samba.org>
+ *
+ * Copyright (C) Paul Mackerras 2005
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#include <linux/compat.h>
+
+#include <drm/amdgpu_drm.h>
+#include <drm/drm_ioctl.h>
+
+#include "amdgpu_drv.h"
+
+long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+ unsigned int nr = DRM_IOCTL_NR(cmd);
+
+ if (nr < DRM_COMMAND_BASE)
+ return drm_compat_ioctl(filp, cmd, arg);
+
+ return amdgpu_drm_ioctl(filp, cmd, arg);
+}
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list 2026-12-03 17:51 [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" Shahyan Soltani @ 2026-12-03 17:52 ` Shahyan Soltani 2026-12-03 18:09 ` Alex Deucher 2026-12-03 19:05 ` sashiko-bot 2026-12-03 18:40 ` [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" sashiko-bot 1 sibling, 2 replies; 5+ messages in thread From: Shahyan Soltani @ 2026-12-03 17:52 UTC (permalink / raw) To: amd-gfx; +Cc: christian.koenig, alexander.deucher Following the revert of Commit 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl"), every IOCTL resumes the device from BACO/BOCO on entry, including the IOCTLs which never required hardware access. Introduce a new amdgpu_ioctls_skip_resume[] list which specifies which IOCTLs the driver should not take a runtime reference for upon entry. Any IOCTL not on this list will automatically resume the GPU as the default behaviour. Edit the behaviour of the amdgpu_drm_ioctl wrappers to conditionally resume the GPU in regards to the new list. Move the 32bit compat wrapper into amdgpu_drv.c, so that it can share the list. Suggested-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Shahyan Soltani <shahyan.soltani@amd.com> --- drivers/gpu/drm/amd/amdgpu/Makefile | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 90 +++++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c | 45 ------------ 4 files changed, 87 insertions(+), 54 deletions(-) delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index c1ef2e0af033..6a5ce2b89378 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -340,7 +340,6 @@ include $(FULL_AMD_PATH)/acp/Makefile amdgpu-y += $(AMD_ACP_FILES) endif -amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o amdgpu-$(CONFIG_HMM_MIRROR) += amdgpu_hmm.o diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 57bbb057108f..9e6d6292a6b5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -3019,25 +3019,105 @@ static int amdgpu_drm_release(struct inode *inode, struct file *filp) return drm_release(inode, filp); } +/** + * amdgpu_ioctls_skip_resume[] - List of IOCTLs that do not require hardware access. + * + * This list needs to be maintained against the most recent DRM IOCTLs. + * + * If an IOCTL is specified within this list, a runtime reference will not be + * held for the IOCTL, preventing the GPU from being resumed upon entry. + * + * TODO: Add the remaining DRM IOCTLs which don't require hardware access. + */ +static const bool amdgpu_ioctls_skip_resume[] = { + /* DRM IOCTLs */ + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_VERSION), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_GET_CLIENT), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPROPERTY), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETRESOURCES), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_LIST_LESSEES), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPLANE), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_OBJ_GETPROPERTIES), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPROPBLOB), + /* AMDGPU IOCTLs */ + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_CREATE), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_CTX), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_VM), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_SCHED), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_BO_LIST), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_MMAP), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_CS), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_INFO), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_WAIT_CS), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_WAIT_FENCES), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_METADATA), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_VA), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_OP), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_USERPTR), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_USERQ), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_USERQ_SIGNAL), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_USERQ_WAIT), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_LIST_HANDLES), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_PROC_OPTIONS), + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_UALINK_HANDLE), +}; + long amdgpu_drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct drm_file *file_priv = filp->private_data; struct drm_device *dev; + unsigned int nr = DRM_IOCTL_NR(cmd); + bool pm_ref = nr >= ARRAY_SIZE(amdgpu_ioctls_skip_resume) ? + true : !amdgpu_ioctls_skip_resume[nr]; long ret; - dev = file_priv->minor->dev; - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) - goto out; + if (pm_ref) { + dev = file_priv->minor->dev; + ret = pm_runtime_resume_and_get(dev->dev); + if (ret < 0) + goto out; + } ret = drm_ioctl(filp, cmd, arg); + if (pm_ref) + pm_runtime_put_autosuspend(dev->dev); out: - pm_runtime_put_autosuspend(dev->dev); return ret; } +#ifdef CONFIG_COMPAT +static long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + struct drm_file *file_priv = filp->private_data; + struct drm_device *dev; + unsigned int nr = DRM_IOCTL_NR(cmd); + bool pm_ref = nr >= ARRAY_SIZE(amdgpu_ioctls_skip_resume) ? + true : !amdgpu_ioctls_skip_resume[nr]; + long ret; + + if (nr < DRM_COMMAND_BASE) { + if (pm_ref) { + dev = file_priv->minor->dev; + ret = pm_runtime_resume_and_get(dev->dev); + if (ret < 0) + goto out; + } + + ret = drm_compat_ioctl(filp, cmd, arg); + if (pm_ref) + pm_runtime_put_autosuspend(dev->dev); + } else { + ret = amdgpu_drm_ioctl(filp, cmd, arg); + } +out: + return ret; +} +#endif + static const struct dev_pm_ops amdgpu_pm_ops = { .prepare = pm_sleep_ptr(amdgpu_pmops_prepare), .complete = pm_sleep_ptr(amdgpu_pmops_complete), diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h index 2d86cc6f7f4d..434bb3bf1c94 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h @@ -43,10 +43,9 @@ extern const struct drm_driver amdgpu_partition_driver; +#define AMDGPU_IOCTL_SKIP_RESUME(ioctl) [DRM_IOCTL_NR(ioctl)] = true + long amdgpu_drm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); -long amdgpu_kms_compat_ioctl(struct file *filp, - unsigned int cmd, unsigned long arg); - #endif diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c deleted file mode 100644 index a1cbd7c3deb2..000000000000 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * \file amdgpu_ioc32.c - * - * 32-bit ioctl compatibility routines for the AMDGPU DRM. - * - * \author Paul Mackerras <paulus@samba.org> - * - * Copyright (C) Paul Mackerras 2005 - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -#include <linux/compat.h> - -#include <drm/amdgpu_drm.h> -#include <drm/drm_ioctl.h> - -#include "amdgpu_drv.h" - -long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - unsigned int nr = DRM_IOCTL_NR(cmd); - - if (nr < DRM_COMMAND_BASE) - return drm_compat_ioctl(filp, cmd, arg); - - return amdgpu_drm_ioctl(filp, cmd, arg); -} -- 2.56.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list 2026-12-03 17:52 ` [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list Shahyan Soltani @ 2026-12-03 18:09 ` Alex Deucher 2026-12-03 19:05 ` sashiko-bot 1 sibling, 0 replies; 5+ messages in thread From: Alex Deucher @ 2026-12-03 18:09 UTC (permalink / raw) To: Shahyan Soltani; +Cc: amd-gfx, christian.koenig, alexander.deucher On Thu, Dec 3, 2026 at 1:01 PM Shahyan Soltani <shahyan.soltani@amd.com> wrote: > > Following the revert of Commit 726d9fa92d8b ("drm/amdgpu: get rid of > amdgpu_drm_ioctl"), every IOCTL resumes the device from BACO/BOCO on > entry, including the IOCTLs which never required hardware access. > > Introduce a new amdgpu_ioctls_skip_resume[] list which specifies which > IOCTLs the driver should not take a runtime reference for upon entry. > Any IOCTL not on this list will automatically resume the GPU as the > default behaviour. > > Edit the behaviour of the amdgpu_drm_ioctl wrappers to conditionally > resume the GPU in regards to the new list. > > Move the 32bit compat wrapper into amdgpu_drv.c, so that it can share > the list. > > Suggested-by: Alex Deucher <alexander.deucher@amd.com> > Signed-off-by: Shahyan Soltani <shahyan.soltani@amd.com> Series is: Reviewed-by: Alex Deucher <alexander.deucher@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/Makefile | 1 - > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 90 +++++++++++++++++++++-- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h | 5 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c | 45 ------------ > 4 files changed, 87 insertions(+), 54 deletions(-) > delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile > index c1ef2e0af033..6a5ce2b89378 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -340,7 +340,6 @@ include $(FULL_AMD_PATH)/acp/Makefile > amdgpu-y += $(AMD_ACP_FILES) > endif > > -amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o > amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o > amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o > amdgpu-$(CONFIG_HMM_MIRROR) += amdgpu_hmm.o > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index 57bbb057108f..9e6d6292a6b5 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -3019,25 +3019,105 @@ static int amdgpu_drm_release(struct inode *inode, struct file *filp) > return drm_release(inode, filp); > } > > +/** > + * amdgpu_ioctls_skip_resume[] - List of IOCTLs that do not require hardware access. > + * > + * This list needs to be maintained against the most recent DRM IOCTLs. > + * > + * If an IOCTL is specified within this list, a runtime reference will not be > + * held for the IOCTL, preventing the GPU from being resumed upon entry. > + * > + * TODO: Add the remaining DRM IOCTLs which don't require hardware access. > + */ > +static const bool amdgpu_ioctls_skip_resume[] = { > + /* DRM IOCTLs */ > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_VERSION), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_GET_CLIENT), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPROPERTY), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETRESOURCES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_LIST_LESSEES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPLANE), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_OBJ_GETPROPERTIES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPROPBLOB), > + /* AMDGPU IOCTLs */ > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_CREATE), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_CTX), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_VM), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_SCHED), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_BO_LIST), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_MMAP), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_CS), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_INFO), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_WAIT_CS), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_WAIT_FENCES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_METADATA), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_VA), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_OP), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_USERPTR), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_USERQ), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_USERQ_SIGNAL), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_USERQ_WAIT), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_LIST_HANDLES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_PROC_OPTIONS), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_UALINK_HANDLE), > +}; > + > long amdgpu_drm_ioctl(struct file *filp, > unsigned int cmd, unsigned long arg) > { > struct drm_file *file_priv = filp->private_data; > struct drm_device *dev; > + unsigned int nr = DRM_IOCTL_NR(cmd); > + bool pm_ref = nr >= ARRAY_SIZE(amdgpu_ioctls_skip_resume) ? > + true : !amdgpu_ioctls_skip_resume[nr]; > long ret; > > - dev = file_priv->minor->dev; > - ret = pm_runtime_get_sync(dev->dev); > - if (ret < 0) > - goto out; > + if (pm_ref) { > + dev = file_priv->minor->dev; > + ret = pm_runtime_resume_and_get(dev->dev); > + if (ret < 0) > + goto out; > + } > > ret = drm_ioctl(filp, cmd, arg); > > + if (pm_ref) > + pm_runtime_put_autosuspend(dev->dev); > out: > - pm_runtime_put_autosuspend(dev->dev); > return ret; > } > > +#ifdef CONFIG_COMPAT > +static long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > +{ > + struct drm_file *file_priv = filp->private_data; > + struct drm_device *dev; > + unsigned int nr = DRM_IOCTL_NR(cmd); > + bool pm_ref = nr >= ARRAY_SIZE(amdgpu_ioctls_skip_resume) ? > + true : !amdgpu_ioctls_skip_resume[nr]; > + long ret; > + > + if (nr < DRM_COMMAND_BASE) { > + if (pm_ref) { > + dev = file_priv->minor->dev; > + ret = pm_runtime_resume_and_get(dev->dev); > + if (ret < 0) > + goto out; > + } > + > + ret = drm_compat_ioctl(filp, cmd, arg); > + if (pm_ref) > + pm_runtime_put_autosuspend(dev->dev); > + } else { > + ret = amdgpu_drm_ioctl(filp, cmd, arg); > + } > +out: > + return ret; > +} > +#endif > + > static const struct dev_pm_ops amdgpu_pm_ops = { > .prepare = pm_sleep_ptr(amdgpu_pmops_prepare), > .complete = pm_sleep_ptr(amdgpu_pmops_complete), > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h > index 2d86cc6f7f4d..434bb3bf1c94 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h > @@ -43,10 +43,9 @@ > > extern const struct drm_driver amdgpu_partition_driver; > > +#define AMDGPU_IOCTL_SKIP_RESUME(ioctl) [DRM_IOCTL_NR(ioctl)] = true > + > long amdgpu_drm_ioctl(struct file *filp, > unsigned int cmd, unsigned long arg); > > -long amdgpu_kms_compat_ioctl(struct file *filp, > - unsigned int cmd, unsigned long arg); > - > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c > deleted file mode 100644 > index a1cbd7c3deb2..000000000000 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c > +++ /dev/null > @@ -1,45 +0,0 @@ > -/* > - * \file amdgpu_ioc32.c > - * > - * 32-bit ioctl compatibility routines for the AMDGPU DRM. > - * > - * \author Paul Mackerras <paulus@samba.org> > - * > - * Copyright (C) Paul Mackerras 2005 > - * All Rights Reserved. > - * > - * Permission is hereby granted, free of charge, to any person obtaining a > - * copy of this software and associated documentation files (the "Software"), > - * to deal in the Software without restriction, including without limitation > - * the rights to use, copy, modify, merge, publish, distribute, sublicense, > - * and/or sell copies of the Software, and to permit persons to whom the > - * Software is furnished to do so, subject to the following conditions: > - * > - * The above copyright notice and this permission notice (including the next > - * paragraph) shall be included in all copies or substantial portions of the > - * Software. > - * > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > - * THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, > - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS > - * IN THE SOFTWARE. > - */ > -#include <linux/compat.h> > - > -#include <drm/amdgpu_drm.h> > -#include <drm/drm_ioctl.h> > - > -#include "amdgpu_drv.h" > - > -long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > -{ > - unsigned int nr = DRM_IOCTL_NR(cmd); > - > - if (nr < DRM_COMMAND_BASE) > - return drm_compat_ioctl(filp, cmd, arg); > - > - return amdgpu_drm_ioctl(filp, cmd, arg); > -} > -- > 2.56.0 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list 2026-12-03 17:52 ` [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list Shahyan Soltani 2026-12-03 18:09 ` Alex Deucher @ 2026-12-03 19:05 ` sashiko-bot 1 sibling, 0 replies; 5+ messages in thread From: sashiko-bot @ 2026-12-03 19:05 UTC (permalink / raw) To: Shahyan Soltani, amd-gfx Thank you for your contribution! Sashiko AI review found 9 potential issues to consider: - [High] drm/amdgpu: missing runtime PM resume for DRM_IOCTL_AMDGPU_VM - [High] drm/amdgpu: missing runtime PM resume for DRM_IOCTL_AMDGPU_CTX free path - [High] drm/amdgpu: amdgpu_kms_compat_ioctl() breaks 32-bit x86 DRM_IOCTL_MODE_ADDFB2 - [Medium] drm/amdgpu: spurious runtime resume on non-DRM ioctls and unplugged devices - [Medium] drm/amdgpu: DRM_IOCTL_AMDGPU_UALINK_HANDLE skips runtime PM resume - [Medium] drm/amdgpu: amdgpu_ioctls_skip_resume[] omits syncobj and cap IOCTLs - [Low] drm/amdgpu: invalid kernel-doc syntax on amdgpu_ioctls_skip_resume[] - [Low] drm/amdgpu: unnecessary external linkage for amdgpu_drm_ioctl() and macro - [Low] drm/amdgpu: missing array_index_nospec() in amdgpu_ioctls_skip_resume[] lookup -- commit d5dc7cf8e3ca9fa610a736900cd13686834c705d Author: Shahyan Soltani <shahyan.soltani@amd.com> drm/amdgpu: implement IOCTL specific skip resume list This patch introduces amdgpu_ioctls_skip_resume[] so amdgpu_drm_ioctl() and amdgpu_kms_compat_ioctl() only acquire a runtime PM reference for ioctls not on the list, and moves amdgpu_kms_compat_ioctl() into amdgpu_drv.c. > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index 11c782a4914ed..0b1359c5125df 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -3041,25 +3041,105 @@ static int amdgpu_drm_release(struct inode *inode, struct file *filp) > return drm_release(inode, filp); > } > > +/** > + * amdgpu_ioctls_skip_resume[] - List of IOCTLs that do not require hardware access. [Severity: Low] Will this /** comment trigger a kernel-doc warning during make htmldocs and W=1 builds? Documentation/gpu/amdgpu/module-parameters.rst runs kernel-doc over amdgpu_drv.c, and the trailing [] without a kernel-doc keyword is rejected. Since amdgpu_ioctls_skip_resume[] is a static table, a regular /* comment avoids the warning. [ ... ] > +static const bool amdgpu_ioctls_skip_resume[] = { > + /* DRM IOCTLs */ > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_VERSION), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_GET_CLIENT), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPROPERTY), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETRESOURCES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_LIST_LESSEES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPLANE), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_OBJ_GETPROPERTIES), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_MODE_GETPROPBLOB), [Severity: Medium] Should the software-only DRM_IOCTL_SYNCOBJ_* ioctls along with DRM_IOCTL_GET_CAP, DRM_IOCTL_SET_CLIENT_CAP, and DRM_IOCTL_SET_CLIENT_NAME also be on this list? Leaving them out means every syncobj ioctl takes dev->power.lock in __pm_runtime_resume() and wakes a suspended GPU, while blocking waits in drm_syncobj_array_wait_timeout() hold a runtime PM reference for the entire wait and prevent autosuspend. Similarly, DRM_IOCTL_GET_CAP during client probing wakes a suspended GPU even though drm_getcap() only reads in-memory state. > + /* AMDGPU IOCTLs */ > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_GEM_CREATE), > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_CTX), [Severity: High] Can skipping runtime resume for DRM_IOCTL_AMDGPU_CTX cause amdgpu_ctx_fini() to access SMU and CG/PG hardware while the GPU is suspended? amdgpu_ctx_stable_pstate() drops its runtime PM reference immediately after assigning adev->pm.stable_pstate_ctx = ctx, so the GPU can autosuspend while that context is still alive. A subsequent AMDGPU_CTX_OP_FREE_CTX then runs amdgpu_ctx_fini() -> __amdgpu_ctx_set_stable_pstate() -> amdgpu_dpm_force_performance_level() without holding a runtime PM reference, risking SMU timeouts or GPU hangs. > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_VM), [Severity: High] Does skipping runtime resume for DRM_IOCTL_AMDGPU_VM allow direct GFXHUB MMIO writes and TLB flushes against a suspended GPU? Neither amdgpu_vm_ioctl() nor its callees take a runtime PM reference, yet AMDGPU_VM_OP_RESERVE_VMID and AMDGPU_VM_OP_UNRESERVE_VMID call amdgpu_gmc_bind_vmid(), which programs VM page-table base registers via setup_vm_pt_regs() and flushes the GPU TLB via amdgpu_gmc_flush_gpu_tlb(). Running them while runtime-suspended risks PCIe bus errors or GPU hangs. [ ... ] > + AMDGPU_IOCTL_SKIP_RESUME(DRM_IOCTL_AMDGPU_UALINK_HANDLE), > +}; [Severity: Medium] Can DRM_IOCTL_AMDGPU_UALINK_HANDLE issue LSDMA MMIO transfers or submit SDMA jobs while the GPU is runtime-suspended? ualink_v1_0_ip_funcs has no .suspend callback, so accel_state stays AMDGPU_UALINK_ACCEL_STATE_ACTIVE across runtime suspend. When DRM_AMDGPU_UALINK_HANDLE_OP_IMPORT runs without a runtime PM reference, amdgpu_ualink_import_handle() reaches amdgpu_ualink_send_command() and calls amdgpu_lsdma_copy_mem() or amdgpu_job_submit() against a powered-down device, causing LSDMA errors or SDMA fence timeouts. > long amdgpu_drm_ioctl(struct file *filp, > unsigned int cmd, unsigned long arg) > { > struct drm_file *file_priv = filp->private_data; > struct drm_device *dev; > + unsigned int nr = DRM_IOCTL_NR(cmd); > + bool pm_ref = nr >= ARRAY_SIZE(amdgpu_ioctls_skip_resume) ? > + true : !amdgpu_ioctls_skip_resume[nr]; [Severity: Low] Should this lookup (and the copy in amdgpu_kms_compat_ioctl()) use array_index_nospec() or size amdgpu_ioctls_skip_resume[] to [_IOC_NRMASK + 1]? Since nr is a user-controlled 8-bit value and the table has 200 entries, speculative execution past the bounds check can read out of bounds in .rodata. > long ret; > > - dev = file_priv->minor->dev; > - ret = pm_runtime_get_sync(dev->dev); > - if (ret < 0) > - goto out; > + if (pm_ref) { > + dev = file_priv->minor->dev; > + ret = pm_runtime_resume_and_get(dev->dev); > + if (ret < 0) > + goto out; > + } [Severity: Medium] Can non-DRM ioctls or calls on an unplugged device spuriously invoke pm_runtime_resume_and_get() before drm_ioctl() rejects them? Both amdgpu_drm_ioctl() and amdgpu_kms_compat_ioctl() check only DRM_IOCTL_NR(cmd), not DRM_IOCTL_TYPE(cmd) == DRM_IOCTL_BASE or drm_dev_is_unplugged(dev). A routine probe such as TCGETS from isatty() will wake a suspended GPU only for drm_ioctl() to return -ENOTTY, and calls on a hot-unplugged device will attempt a runtime resume instead of immediately returning -ENODEV. [ ... ] > +#ifdef CONFIG_COMPAT > +static long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > +{ > + struct drm_file *file_priv = filp->private_data; > + struct drm_device *dev; > + unsigned int nr = DRM_IOCTL_NR(cmd); > + bool pm_ref = nr >= ARRAY_SIZE(amdgpu_ioctls_skip_resume) ? > + true : !amdgpu_ioctls_skip_resume[nr]; > + long ret; > + > + if (nr < DRM_COMMAND_BASE) { > + if (pm_ref) { > + dev = file_priv->minor->dev; > + ret = pm_runtime_resume_and_get(dev->dev); > + if (ret < 0) > + goto out; > + } > + > + ret = drm_compat_ioctl(filp, cmd, arg); > + if (pm_ref) > + pm_runtime_put_autosuspend(dev->dev); > + } else { > + ret = amdgpu_drm_ioctl(filp, cmd, arg); > + } > +out: > + return ret; > +} > +#endif [Severity: High] Does routing nr >= DRM_COMMAND_BASE to amdgpu_drm_ioctl() break 32-bit x86 DRM_IOCTL_MODE_ADDFB2 calls? Core KMS ioctls live in 0xA0..0xFF, and drm_compat_ioctls[] registers compat_drm_mode_addfb2() at 0xB8 on CONFIG_X86. Bypassing drm_compat_ioctl() copies the packed 32-bit struct directly into the 64-bit struct drm_mode_fb_cmd2 without the alignment padding before modifier[4], corrupting the framebuffer modifiers. Since drm_compat_ioctl() already falls through to drm_ioctl() for ioctls without a compat handler, this wrapper can call drm_compat_ioctl() directly for all ioctls and share the runtime PM helper with amdgpu_drm_ioctl(). > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h > index 2d86cc6f7f4dd..434bb3bf1c946 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.h > @@ -43,10 +43,9 @@ > > extern const struct drm_driver amdgpu_partition_driver; > > +#define AMDGPU_IOCTL_SKIP_RESUME(ioctl) [DRM_IOCTL_NR(ioctl)] = true > + > long amdgpu_drm_ioctl(struct file *filp, > unsigned int cmd, unsigned long arg); [Severity: Low] Now that amdgpu_ioc32.c is gone, can amdgpu_drm_ioctl() be made static and both its prototype and AMDGPU_IOCTL_SKIP_RESUME() be moved out of amdgpu_drv.h? Neither is used outside amdgpu_drv.c, and amdgpu_drv.h does not include drm/drm_ioctl.h for DRM_IOCTL_NR(). -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203175200.1774878-1-shahyan.soltani@amd.com?part=2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" 2026-12-03 17:51 [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" Shahyan Soltani 2026-12-03 17:52 ` [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list Shahyan Soltani @ 2026-12-03 18:40 ` sashiko-bot 1 sibling, 0 replies; 5+ messages in thread From: sashiko-bot @ 2026-12-03 18:40 UTC (permalink / raw) To: Shahyan Soltani, amd-gfx Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/amdgpu: amdgpu_kms_compat_ioctl() breaks 32-bit x86 DRM_IOCTL_MODE_ADDFB2 - [Low] drm/amdgpu: Fixes tag cites non-ancestor commit 726d9fa92d8b -- commit 3b9f83db39db8a3806aa0b6d95b926ad913db516 Author: Shahyan Soltani <shahyan.soltani@amd.com> > Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" > > Commit 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl") is > broken as it forgot to account for non amdgpu IOCTLs that required the > GPU to be active. Without the wrapper, these IOCTLs can no longer resume > the device, so they can run while the GPU is suspended. > > Revert commit 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl") > to allow the GPU to resume on all IOCTLs. > > Fixes: 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl") > Signed-off-by: Shahyan Soltani <shahyan.soltani@amd.com> > Acked-by: Christian König <christian.koenig@amd.com> > Acked-by: Alex Deucher <alexander.deucher@amd.com> [Severity: Low] Commit 726d9fa92d8b ("drm/amdgpu: get rid of amdgpu_drm_ioctl") is not an ancestor in this tree. Should the commit message and Fixes tag reference the merged commit instead? Fixes: 3d3140b5b0d0 ("drm/amdgpu: get rid of amdgpu_drm_ioctl") [ ... ] > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c > new file mode 100644 > index 0000000000000..a1cbd7c3deb2c > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ioc32.c [ ... ] > +long amdgpu_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > +{ > + unsigned int nr = DRM_IOCTL_NR(cmd); > + > + if (nr < DRM_COMMAND_BASE) > + return drm_compat_ioctl(filp, cmd, arg); > + > + return amdgpu_drm_ioctl(filp, cmd, arg); > +} [Severity: High] Does this break 32-bit x86 DRM_IOCTL_MODE_ADDFB2 by bypassing drm_compat_ioctl()? Core DRM KMS ioctls resume at DRM_COMMAND_END (0xa0), including DRM_IOCTL_MODE_ADDFB2 (0xb8). Since only nr < DRM_COMMAND_BASE (0x40) goes to drm_compat_ioctl(), DRM_IOCTL_MODE_ADDFB2 goes through amdgpu_drm_ioctl() -> drm_ioctl(), skipping compat_drm_mode_addfb2(). On x86_64, struct drm_mode_fb_cmd2 has 4 bytes of padding between offsets[4] and modifier[4] that 32-bit x86 omits. Copying the 32-bit struct directly shifts all four modifier[] entries by 4 bytes, corrupting framebuffer modifiers when a 32-bit x86 client uses DRM_MODE_FB_MODIFIERS. Since amdgpu has no driver-private compat ioctl handlers, wrapping drm_compat_ioctl() directly with runtime PM handling would avoid bypassing compat_drm_mode_addfb2(). -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203175200.1774878-1-shahyan.soltani@amd.com?part=1 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-03 19:05 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-03 17:51 [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" Shahyan Soltani 2026-12-03 17:52 ` [PATCH 2/2] drm/amdgpu: implement IOCTL specific skip resume list Shahyan Soltani 2026-12-03 18:09 ` Alex Deucher 2026-12-03 19:05 ` sashiko-bot 2026-12-03 18:40 ` [PATCH 1/2] Revert "drm/amdgpu: get rid of amdgpu_drm_ioctl" sashiko-bot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.