Skip to contentSkip to conversation

drm/amdgpu: don't allow userspace to create a doorbell BO

PATCH In review Alex Deucher 3 participants 5 messages Aug 9, 2023 – Aug 11, 2023

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: don't allow userspace to create a doorbell BO

We need the domains in amdgpu_drm.h for the kernel driver to manage the pool, but we don't want userspace using it until the code is ready. So reject for now.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
index 693b1fd1191a..ca4d2d430e28 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 	uint32_t handle, initial_domain;
 	int r;
 
+	/* reject DOORBELLs until userspace code to use it is available */
+	if (args->in.domains & AMDGPU_GEM_DOMAIN_DOORBELL)
+		return -EINVAL;
+
 	/* reject invalid gem flags */
 	if (flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
 		      AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 1/1 Revert "drm/amd/pm: resolve reboot exception for si oland"

This reverts commit e490d60a2f76bff636c68ce4fe34c1b6c34bbd86.

This causes hangs on SI when DC is enabled.

---
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +29 -0
index 02e69ccff3ba..d6d9e3b1b2c0 100644
@@ -6925,6 +6925,23 @@ static int si_dpm_enable(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int si_set_temperature_range(struct amdgpu_device *adev)
+{
+	int ret;
+
+	ret = si_thermal_enable_alert(adev, false);
+	if (ret)
+		return ret;
+	ret = si_thermal_set_temperature_range(adev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
+	if (ret)
+		return ret;
+	ret = si_thermal_enable_alert(adev, true);
+	if (ret)
+		return ret;
+
+	return ret;
+}
+
 static void si_dpm_disable(struct amdgpu_device *adev)
 {
 	struct rv7xx_power_info *pi = rv770_get_pi(adev);
@@ -7609,6 +7626,18 @@ static int si_dpm_process_interrupt(struct amdgpu_device *adev,
 
 static int si_dpm_late_init(void *handle)
 {
+	int ret;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+	if (!adev->pm.dpm_enabled)
+		return 0;
+
+	ret = si_set_temperature_range(adev);
+	if (ret)
+		return ret;
+#if 0 //TODO ?
+	si_dpm_powergate_uvd(adev, true);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.41.0
#2 lore raw
In reply to Alex Deucher

Ping?

Quoted 28 lines · Alex Deucher

We need the domains in amdgpu_drm.h for the kernel driver to manage the pool, but we don't want userspace using it until the code is ready. So reject for now.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -1
index 693b1fd1191a..ca4d2d430e28 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
        uint32_t handle, initial_domain;
        int r;
 
+       /* reject DOORBELLs until userspace code to use it is available */
+       if (args->in.domains & AMDGPU_GEM_DOMAIN_DOORBELL)
+               return -EINVAL;
+
        /* reject invalid gem flags */
        if (flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
                      AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
--

2.41.0

#3 lore raw

Ping?

Quoted 32 lines · Alex Deucher

Ping?

Quoted 28 lines · Alex Deucher

We need the domains in amdgpu_drm.h for the kernel driver to manage the pool, but we don't want userspace using it until the code is ready. So reject for now.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -1
index 693b1fd1191a..ca4d2d430e28 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
        uint32_t handle, initial_domain;
        int r;
 
+       /* reject DOORBELLs until userspace code to use it is available */
+       if (args->in.domains & AMDGPU_GEM_DOMAIN_DOORBELL)
+               return -EINVAL;
+
        /* reject invalid gem flags */
        if (flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
                      AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
--

2.41.0

Acked-by on v1 1/1
#4 lore raw
In reply to Alex Deucher

Am 2023-08-09 um 15:09 schrieb Alex Deucher:

Quoted 5 lines

We need the domains in amdgpu_drm.h for the kernel driver to manage the pool, but we don't want userspace using it until the code is ready. So reject for now.

Quoted 19 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +4 -0
index 693b1fd1191a..ca4d2d430e28 100644
@@ -289,6 +289,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
  	uint32_t handle, initial_domain;
  	int r;
 
+	/* reject DOORBELLs until userspace code to use it is available */
+	if (args->in.domains & AMDGPU_GEM_DOMAIN_DOORBELL)
+		return -EINVAL;
+
  	/* reject invalid gem flags */
  	if (flags & ~(AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
  		      AMDGPU_GEM_CREATE_NO_CPU_ACCESS |