dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] amdgpu's drm_driver becomes const
@ 2020-11-04  3:11 Luben Tuikov
  2020-11-04  3:11 ` [PATCH 1/2] drm/amdgpu/virt: fix handling of the atomic flag Luben Tuikov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Luben Tuikov @ 2020-11-04  3:11 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alexander Deucher, Daniel Vetter, Luben Tuikov

Hi Daniel,

These two patches follow up your latest
DRM work to make definitions of struct drm_driver
in DRM low-level drivers, constant, in amdgpu.

This set doesn't descend from my previous patch
"drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)",
since our branch doesn't have it, and I can see
that your const patches aren't in drm-next yet,
but they are based on my conversion patch.
Perhaps you can graft these two patches locally
and dispatch them via drm-next. (There'll be
a one-line conflict, namely the devm_drm_dev_alloc().)

Thanks and Regards,
Luben

Alex Deucher (1):
  drm/amdgpu/virt: fix handling of the atomic flag

Luben Tuikov (1):
  drm/amdgpu: Make struct drm_driver const

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 32 +++++++++++++++++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c  | 25 +-----------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c |  4 ++-
 3 files changed, 32 insertions(+), 29 deletions(-)

-- 
2.29.2.154.g7f7ebe054a

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] drm/amdgpu/virt: fix handling of the atomic flag
  2020-11-04  3:11 [PATCH 0/2] amdgpu's drm_driver becomes const Luben Tuikov
@ 2020-11-04  3:11 ` Luben Tuikov
  2020-11-04  3:11 ` [PATCH 2/2] drm/amdgpu: Make struct drm_driver const Luben Tuikov
  2020-11-04  9:43 ` [PATCH 0/2] amdgpu's drm_driver becomes const Daniel Vetter
  2 siblings, 0 replies; 6+ messages in thread
From: Luben Tuikov @ 2020-11-04  3:11 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alex Deucher, Daniel Vetter, Luben Tuikov

From: Alex Deucher <alexdeucher@gmail.com>

Use the per device drm driver feature flags rather than the
global one.  This way we can make the drm driver struct const.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index d0aea5e39531..8aff6ef50f91 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -47,11 +47,13 @@ bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev)
 
 void amdgpu_virt_init_setting(struct amdgpu_device *adev)
 {
+	struct drm_device *ddev = adev_to_drm(adev);
+
 	/* enable virtual display */
 	if (adev->mode_info.num_crtc == 0)
 		adev->mode_info.num_crtc = 1;
 	adev->enable_virtual_display = true;
-	adev_to_drm(adev)->driver->driver_features &= ~DRIVER_ATOMIC;
+	ddev->driver_features &= ~DRIVER_ATOMIC;
 	adev->cg_flags = 0;
 	adev->pg_flags = 0;
 }
-- 
2.29.2.154.g7f7ebe054a

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] drm/amdgpu: Make struct drm_driver const
  2020-11-04  3:11 [PATCH 0/2] amdgpu's drm_driver becomes const Luben Tuikov
  2020-11-04  3:11 ` [PATCH 1/2] drm/amdgpu/virt: fix handling of the atomic flag Luben Tuikov
@ 2020-11-04  3:11 ` Luben Tuikov
  2020-11-04 10:00   ` Daniel Vetter
  2020-11-04  9:43 ` [PATCH 0/2] amdgpu's drm_driver becomes const Daniel Vetter
  2 siblings, 1 reply; 6+ messages in thread
From: Luben Tuikov @ 2020-11-04  3:11 UTC (permalink / raw)
  To: amd-gfx, dri-devel; +Cc: Alexander Deucher, Daniel Vetter, Luben Tuikov

Make the definition of struct drm_driver
a constant, to follow the latest developments
in the DRM layer.

Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 32 +++++++++++++++++++++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 25 +------------------
 2 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index e5bee56e06d1..be304df7a8c2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -40,6 +40,7 @@
 #include "amdgpu.h"
 #include "amdgpu_irq.h"
 #include "amdgpu_dma_buf.h"
+#include "amdgpu_sched.h"
 
 #include "amdgpu_amdkfd.h"
 
@@ -1105,7 +1106,7 @@ static const struct pci_device_id pciidlist[] = {
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
-static struct drm_driver kms_driver;
+static const struct drm_driver amdgpu_kms_driver;
 
 static int amdgpu_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
@@ -1183,7 +1184,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 	adev->dev  = &pdev->dev;
 	adev->pdev = pdev;
 	ddev = adev_to_drm(adev);
-	ret = drm_dev_init(ddev, &kms_driver, &pdev->dev);
+	ret = drm_dev_init(ddev, &amdgpu_kms_driver, &pdev->dev);
 	if (ret)
 		goto err_free;
 
@@ -1528,7 +1529,30 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
 	return 0;
 }
 
-static struct drm_driver kms_driver = {
+int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
+
+const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_VM, amdgpu_vm_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_SCHED, amdgpu_sched_ioctl, DRM_MASTER),
+	DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_FENCE_TO_HANDLE, amdgpu_cs_fence_to_handle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	/* KMS */
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF_DRV(AMDGPU_FREESYNC, amdgpu_display_freesync_ioctl, DRM_MASTER)
+};
+
+static const struct drm_driver amdgpu_kms_driver = {
 	.driver_features =
 	    DRIVER_ATOMIC |
 	    DRIVER_GEM |
@@ -1539,6 +1563,7 @@ static struct drm_driver kms_driver = {
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.irq_handler = amdgpu_irq_handler,
 	.ioctls = amdgpu_ioctls_kms,
+	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.gem_free_object_unlocked = amdgpu_gem_object_free,
 	.gem_open_object = amdgpu_gem_object_open,
 	.gem_close_object = amdgpu_gem_object_close,
@@ -1597,7 +1622,6 @@ static int __init amdgpu_init(void)
 		goto error_fence;
 
 	DRM_INFO("amdgpu kernel modesetting enabled.\n");
-	kms_driver.num_ioctls = amdgpu_max_kms_ioctl;
 	amdgpu_register_atpx_handler();
 
 	/* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index bf01744a38f8..4f72c096b3c8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -29,7 +29,6 @@
 #include "amdgpu.h"
 #include <drm/drm_debugfs.h>
 #include <drm/amdgpu_drm.h>
-#include "amdgpu_sched.h"
 #include "amdgpu_uvd.h"
 #include "amdgpu_vce.h"
 #include "atom.h"
@@ -484,7 +483,7 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
  * etc. (all asics).
  * Returns 0 on success, -EINVAL on failure.
  */
-static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
+int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 {
 	struct amdgpu_device *adev = drm_to_adev(dev);
 	struct drm_amdgpu_info *info = data;
@@ -1247,28 +1246,6 @@ void amdgpu_disable_vblank_kms(struct drm_crtc *crtc)
 	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
 }
 
-const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_VM, amdgpu_vm_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_SCHED, amdgpu_sched_ioctl, DRM_MASTER),
-	DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_FENCE_TO_HANDLE, amdgpu_cs_fence_to_handle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	/* KMS */
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-	DRM_IOCTL_DEF_DRV(AMDGPU_FREESYNC, amdgpu_display_freesync_ioctl, DRM_MASTER)
-};
-const int amdgpu_max_kms_ioctl = ARRAY_SIZE(amdgpu_ioctls_kms);
-
 /*
  * Debugfs info
  */
-- 
2.29.2.154.g7f7ebe054a

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] amdgpu's drm_driver becomes const
  2020-11-04  3:11 [PATCH 0/2] amdgpu's drm_driver becomes const Luben Tuikov
  2020-11-04  3:11 ` [PATCH 1/2] drm/amdgpu/virt: fix handling of the atomic flag Luben Tuikov
  2020-11-04  3:11 ` [PATCH 2/2] drm/amdgpu: Make struct drm_driver const Luben Tuikov
@ 2020-11-04  9:43 ` Daniel Vetter
  2020-11-04 16:24   ` Luben Tuikov
  2 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2020-11-04  9:43 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: Alexander Deucher, Daniel Vetter, dri-devel, amd-gfx

On Tue, Nov 03, 2020 at 10:11:27PM -0500, Luben Tuikov wrote:
> Hi Daniel,
> 
> These two patches follow up your latest
> DRM work to make definitions of struct drm_driver
> in DRM low-level drivers, constant, in amdgpu.
> 
> This set doesn't descend from my previous patch
> "drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)",
> since our branch doesn't have it, and I can see
> that your const patches aren't in drm-next yet,
> but they are based on my conversion patch.
> Perhaps you can graft these two patches locally
> and dispatch them via drm-next. (There'll be
> a one-line conflict, namely the devm_drm_dev_alloc().)

Ah cool, thanks for doing this. I'll take your series here and include it
in mine and resend the entire pile.
-Daniel
> 
> Thanks and Regards,
> Luben
> 
> Alex Deucher (1):
>   drm/amdgpu/virt: fix handling of the atomic flag
> 
> Luben Tuikov (1):
>   drm/amdgpu: Make struct drm_driver const
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 32 +++++++++++++++++++++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c  | 25 +-----------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c |  4 ++-
>  3 files changed, 32 insertions(+), 29 deletions(-)
> 
> -- 
> 2.29.2.154.g7f7ebe054a
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] drm/amdgpu: Make struct drm_driver const
  2020-11-04  3:11 ` [PATCH 2/2] drm/amdgpu: Make struct drm_driver const Luben Tuikov
@ 2020-11-04 10:00   ` Daniel Vetter
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2020-11-04 10:00 UTC (permalink / raw)
  To: Luben Tuikov; +Cc: Alexander Deucher, Daniel Vetter, dri-devel, amd-gfx

On Tue, Nov 03, 2020 at 10:11:29PM -0500, Luben Tuikov wrote:
> Make the definition of struct drm_driver
> a constant, to follow the latest developments
> in the DRM layer.
> 
> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 32 +++++++++++++++++++++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 25 +------------------
>  2 files changed, 29 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index e5bee56e06d1..be304df7a8c2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -40,6 +40,7 @@
>  #include "amdgpu.h"
>  #include "amdgpu_irq.h"
>  #include "amdgpu_dma_buf.h"
> +#include "amdgpu_sched.h"
>  
>  #include "amdgpu_amdkfd.h"
>  
> @@ -1105,7 +1106,7 @@ static const struct pci_device_id pciidlist[] = {
>  
>  MODULE_DEVICE_TABLE(pci, pciidlist);
>  
> -static struct drm_driver kms_driver;
> +static const struct drm_driver amdgpu_kms_driver;
>  
>  static int amdgpu_pci_probe(struct pci_dev *pdev,
>  			    const struct pci_device_id *ent)
> @@ -1183,7 +1184,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>  	adev->dev  = &pdev->dev;
>  	adev->pdev = pdev;
>  	ddev = adev_to_drm(adev);
> -	ret = drm_dev_init(ddev, &kms_driver, &pdev->dev);
> +	ret = drm_dev_init(ddev, &amdgpu_kms_driver, &pdev->dev);
>  	if (ret)
>  		goto err_free;
>  
> @@ -1528,7 +1529,30 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
>  	return 0;
>  }
>  
> -static struct drm_driver kms_driver = {
> +int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
> +
> +const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_VM, amdgpu_vm_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_SCHED, amdgpu_sched_ioctl, DRM_MASTER),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_FENCE_TO_HANDLE, amdgpu_cs_fence_to_handle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	/* KMS */
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> +	DRM_IOCTL_DEF_DRV(AMDGPU_FREESYNC, amdgpu_display_freesync_ioctl, DRM_MASTER)

freesync escaped from your internal tree, I dropped that when applying.
Plus I solved the conflict with drm_dev_alloc (it should be in drm-next
now sinc this morning, maybe good time to resync the internal tree to
avoid conflicts like this).

Otherwise looks a lot less work than I feared (after having wrangled
radeon to work), thanks for doing this.
-Daniel

> +};
> +
> +static const struct drm_driver amdgpu_kms_driver = {
>  	.driver_features =
>  	    DRIVER_ATOMIC |
>  	    DRIVER_GEM |
> @@ -1539,6 +1563,7 @@ static struct drm_driver kms_driver = {
>  	.lastclose = amdgpu_driver_lastclose_kms,
>  	.irq_handler = amdgpu_irq_handler,
>  	.ioctls = amdgpu_ioctls_kms,
> +	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>  	.gem_free_object_unlocked = amdgpu_gem_object_free,
>  	.gem_open_object = amdgpu_gem_object_open,
>  	.gem_close_object = amdgpu_gem_object_close,
> @@ -1597,7 +1622,6 @@ static int __init amdgpu_init(void)
>  		goto error_fence;
>  
>  	DRM_INFO("amdgpu kernel modesetting enabled.\n");
> -	kms_driver.num_ioctls = amdgpu_max_kms_ioctl;
>  	amdgpu_register_atpx_handler();
>  
>  	/* Ignore KFD init failures. Normal when CONFIG_HSA_AMD is not set. */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index bf01744a38f8..4f72c096b3c8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -29,7 +29,6 @@
>  #include "amdgpu.h"
>  #include <drm/drm_debugfs.h>
>  #include <drm/amdgpu_drm.h>
> -#include "amdgpu_sched.h"
>  #include "amdgpu_uvd.h"
>  #include "amdgpu_vce.h"
>  #include "atom.h"
> @@ -484,7 +483,7 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
>   * etc. (all asics).
>   * Returns 0 on success, -EINVAL on failure.
>   */
> -static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> +int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>  {
>  	struct amdgpu_device *adev = drm_to_adev(dev);
>  	struct drm_amdgpu_info *info = data;
> @@ -1247,28 +1246,6 @@ void amdgpu_disable_vblank_kms(struct drm_crtc *crtc)
>  	amdgpu_irq_put(adev, &adev->crtc_irq, idx);
>  }
>  
> -const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_VM, amdgpu_vm_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_SCHED, amdgpu_sched_ioctl, DRM_MASTER),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_FENCE_TO_HANDLE, amdgpu_cs_fence_to_handle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	/* KMS */
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_FENCES, amdgpu_cs_wait_fences_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> -	DRM_IOCTL_DEF_DRV(AMDGPU_FREESYNC, amdgpu_display_freesync_ioctl, DRM_MASTER)
> -};
> -const int amdgpu_max_kms_ioctl = ARRAY_SIZE(amdgpu_ioctls_kms);
> -
>  /*
>   * Debugfs info
>   */
> -- 
> 2.29.2.154.g7f7ebe054a
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] amdgpu's drm_driver becomes const
  2020-11-04  9:43 ` [PATCH 0/2] amdgpu's drm_driver becomes const Daniel Vetter
@ 2020-11-04 16:24   ` Luben Tuikov
  0 siblings, 0 replies; 6+ messages in thread
From: Luben Tuikov @ 2020-11-04 16:24 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Alexander Deucher, Daniel Vetter, dri-devel, amd-gfx

On 2020-11-04 04:43, Daniel Vetter wrote:
> On Tue, Nov 03, 2020 at 10:11:27PM -0500, Luben Tuikov wrote:
>> Hi Daniel,
>>
>> These two patches follow up your latest
>> DRM work to make definitions of struct drm_driver
>> in DRM low-level drivers, constant, in amdgpu.
>>
>> This set doesn't descend from my previous patch
>> "drm/amdgpu: Convert to using devm_drm_dev_alloc() (v2)",
>> since our branch doesn't have it, and I can see
>> that your const patches aren't in drm-next yet,
>> but they are based on my conversion patch.
>> Perhaps you can graft these two patches locally
>> and dispatch them via drm-next. (There'll be
>> a one-line conflict, namely the devm_drm_dev_alloc().)
> 
> Ah cool, thanks for doing this. I'll take your series here and include it
> in mine and resend the entire pile.
> -Daniel

Yeah, no problem, my pleasure.
Thanks for picking this up.

Regards,
Luben

>>
>> Thanks and Regards,
>> Luben
>>
>> Alex Deucher (1):
>>   drm/amdgpu/virt: fix handling of the atomic flag
>>
>> Luben Tuikov (1):
>>   drm/amdgpu: Make struct drm_driver const
>>
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 32 +++++++++++++++++++++---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c  | 25 +-----------------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c |  4 ++-
>>  3 files changed, 32 insertions(+), 29 deletions(-)
>>
>> -- 
>> 2.29.2.154.g7f7ebe054a
>>
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-04 16:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04  3:11 [PATCH 0/2] amdgpu's drm_driver becomes const Luben Tuikov
2020-11-04  3:11 ` [PATCH 1/2] drm/amdgpu/virt: fix handling of the atomic flag Luben Tuikov
2020-11-04  3:11 ` [PATCH 2/2] drm/amdgpu: Make struct drm_driver const Luben Tuikov
2020-11-04 10:00   ` Daniel Vetter
2020-11-04  9:43 ` [PATCH 0/2] amdgpu's drm_driver becomes const Daniel Vetter
2020-11-04 16:24   ` Luben Tuikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).