All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panfrost: Export all GPU feature registers
@ 2019-07-24 10:56 Steven Price
  2019-07-24 16:27 ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Price @ 2019-07-24 10:56 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Rob Herring, Tomeu Vizoso
  Cc: dri-devel, linux-kernel, Alyssa Rosenzweig, Steven Price

Midgard/Bifrost GPUs have a bunch of feature registers providing details
of what the hardware supports. Panfrost already reads these, this patch
exports them all to user space so that the jobs created by the user space
driver can be tuned for the particular hardware implementation.

Signed-off-by: Steven Price <steven.price@arm.com>
---
 drivers/gpu/drm/panfrost/panfrost_device.h |  1 +
 drivers/gpu/drm/panfrost/panfrost_drv.c    | 38 +++++++++++++++++++--
 drivers/gpu/drm/panfrost/panfrost_gpu.c    |  2 ++
 include/uapi/drm/panfrost_drm.h            | 39 ++++++++++++++++++++++
 4 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
index 83cc01cafde1..ea5948ff3647 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.h
+++ b/drivers/gpu/drm/panfrost/panfrost_device.h
@@ -43,6 +43,7 @@ struct panfrost_features {
 	u32 js_features[16];
 
 	u32 nr_core_groups;
+	u32 thread_tls_alloc;
 
 	unsigned long hw_features[64 / BITS_PER_LONG];
 	unsigned long hw_issues[64 / BITS_PER_LONG];
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 85b4b51b6a0d..4b554c8d56da 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -32,10 +32,42 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct
 	if (param->pad != 0)
 		return -EINVAL;
 
+#define PANFROST_FEATURE(name, member)			\
+	case DRM_PANFROST_PARAM_ ## name:		\
+		param->value = pfdev->features.member;	\
+		break
+#define PANFROST_FEATURE_ARRAY(name, member, max)			\
+	case DRM_PANFROST_PARAM_ ## name ## 0 ...			\
+		DRM_PANFROST_PARAM_ ## name ## max:			\
+		param->value = pfdev->features.member[param->param -	\
+			DRM_PANFROST_PARAM_ ## name ## 0];		\
+		break
+
 	switch (param->param) {
-	case DRM_PANFROST_PARAM_GPU_PROD_ID:
-		param->value = pfdev->features.id;
-		break;
+		PANFROST_FEATURE(GPU_PROD_ID, id);
+		PANFROST_FEATURE(GPU_REVISION, revision);
+		PANFROST_FEATURE(SHADER_PRESENT, shader_present);
+		PANFROST_FEATURE(TILER_PRESENT, tiler_present);
+		PANFROST_FEATURE(L2_PRESENT, l2_present);
+		PANFROST_FEATURE(STACK_PRESENT, stack_present);
+		PANFROST_FEATURE(AS_PRESENT, as_present);
+		PANFROST_FEATURE(JS_PRESENT, js_present);
+		PANFROST_FEATURE(L2_FEATURES, l2_features);
+		PANFROST_FEATURE(CORE_FEATURES, core_features);
+		PANFROST_FEATURE(TILER_FEATURES, tiler_features);
+		PANFROST_FEATURE(MEM_FEATURES, mem_features);
+		PANFROST_FEATURE(MMU_FEATURES, mmu_features);
+		PANFROST_FEATURE(THREAD_FEATURES, thread_features);
+		PANFROST_FEATURE(MAX_THREADS, max_threads);
+		PANFROST_FEATURE(THREAD_MAX_WORKGROUP_SZ,
+				thread_max_workgroup_sz);
+		PANFROST_FEATURE(THREAD_MAX_BARRIER_SZ,
+				thread_max_barrier_sz);
+		PANFROST_FEATURE(COHERENCY_FEATURES, coherency_features);
+		PANFROST_FEATURE_ARRAY(TEXTURE_FEATURES, texture_features, 3);
+		PANFROST_FEATURE_ARRAY(JS_FEATURES, js_features, 15);
+		PANFROST_FEATURE(NR_CORE_GROUPS, nr_core_groups);
+		PANFROST_FEATURE(THREAD_TLS_ALLOC, thread_tls_alloc);
 	default:
 		return -EINVAL;
 	}
diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index 20ab333fc925..f67ed925c0ef 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -232,6 +232,8 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev)
 	pfdev->features.stack_present = gpu_read(pfdev, GPU_STACK_PRESENT_LO);
 	pfdev->features.stack_present |= (u64)gpu_read(pfdev, GPU_STACK_PRESENT_HI) << 32;
 
+	pfdev->features.thread_tls_alloc = gpu_read(pfdev, GPU_THREAD_TLS_ALLOC);
+
 	gpu_id = gpu_read(pfdev, GPU_ID);
 	pfdev->features.revision = gpu_id & 0xffff;
 	pfdev->features.id = gpu_id >> 16;
diff --git a/include/uapi/drm/panfrost_drm.h b/include/uapi/drm/panfrost_drm.h
index b5d370638846..cb577fb96b38 100644
--- a/include/uapi/drm/panfrost_drm.h
+++ b/include/uapi/drm/panfrost_drm.h
@@ -127,6 +127,45 @@ struct drm_panfrost_mmap_bo {
 
 enum drm_panfrost_param {
 	DRM_PANFROST_PARAM_GPU_PROD_ID,
+	DRM_PANFROST_PARAM_GPU_REVISION,
+	DRM_PANFROST_PARAM_SHADER_PRESENT,
+	DRM_PANFROST_PARAM_TILER_PRESENT,
+	DRM_PANFROST_PARAM_L2_PRESENT,
+	DRM_PANFROST_PARAM_STACK_PRESENT,
+	DRM_PANFROST_PARAM_AS_PRESENT,
+	DRM_PANFROST_PARAM_JS_PRESENT,
+	DRM_PANFROST_PARAM_L2_FEATURES,
+	DRM_PANFROST_PARAM_CORE_FEATURES,
+	DRM_PANFROST_PARAM_TILER_FEATURES,
+	DRM_PANFROST_PARAM_MEM_FEATURES,
+	DRM_PANFROST_PARAM_MMU_FEATURES,
+	DRM_PANFROST_PARAM_THREAD_FEATURES,
+	DRM_PANFROST_PARAM_MAX_THREADS,
+	DRM_PANFROST_PARAM_THREAD_MAX_WORKGROUP_SZ,
+	DRM_PANFROST_PARAM_THREAD_MAX_BARRIER_SZ,
+	DRM_PANFROST_PARAM_COHERENCY_FEATURES,
+	DRM_PANFROST_PARAM_TEXTURE_FEATURES0,
+	DRM_PANFROST_PARAM_TEXTURE_FEATURES1,
+	DRM_PANFROST_PARAM_TEXTURE_FEATURES2,
+	DRM_PANFROST_PARAM_TEXTURE_FEATURES3,
+	DRM_PANFROST_PARAM_JS_FEATURES0,
+	DRM_PANFROST_PARAM_JS_FEATURES1,
+	DRM_PANFROST_PARAM_JS_FEATURES2,
+	DRM_PANFROST_PARAM_JS_FEATURES3,
+	DRM_PANFROST_PARAM_JS_FEATURES4,
+	DRM_PANFROST_PARAM_JS_FEATURES5,
+	DRM_PANFROST_PARAM_JS_FEATURES6,
+	DRM_PANFROST_PARAM_JS_FEATURES7,
+	DRM_PANFROST_PARAM_JS_FEATURES8,
+	DRM_PANFROST_PARAM_JS_FEATURES9,
+	DRM_PANFROST_PARAM_JS_FEATURES10,
+	DRM_PANFROST_PARAM_JS_FEATURES11,
+	DRM_PANFROST_PARAM_JS_FEATURES12,
+	DRM_PANFROST_PARAM_JS_FEATURES13,
+	DRM_PANFROST_PARAM_JS_FEATURES14,
+	DRM_PANFROST_PARAM_JS_FEATURES15,
+	DRM_PANFROST_PARAM_NR_CORE_GROUPS,
+	DRM_PANFROST_PARAM_THREAD_TLS_ALLOC,
 };
 
 struct drm_panfrost_get_param {
-- 
2.20.1


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

* Re: [PATCH] drm/panfrost: Export all GPU feature registers
  2019-07-24 10:56 [PATCH] drm/panfrost: Export all GPU feature registers Steven Price
@ 2019-07-24 16:27 ` Rob Herring
  2019-07-24 16:40   ` Alyssa Rosenzweig
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2019-07-24 16:27 UTC (permalink / raw)
  To: Steven Price, Alyssa Rosenzweig
  Cc: Daniel Vetter, David Airlie, Tomeu Vizoso, dri-devel,
	linux-kernel, Alyssa Rosenzweig

Adding Alyssa's Collabora email.

On Wed, Jul 24, 2019 at 4:56 AM Steven Price <steven.price@arm.com> wrote:
>
> Midgard/Bifrost GPUs have a bunch of feature registers providing details
> of what the hardware supports. Panfrost already reads these, this patch
> exports them all to user space so that the jobs created by the user space
> driver can be tuned for the particular hardware implementation.
>
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_device.h |  1 +
>  drivers/gpu/drm/panfrost/panfrost_drv.c    | 38 +++++++++++++++++++--
>  drivers/gpu/drm/panfrost/panfrost_gpu.c    |  2 ++
>  include/uapi/drm/panfrost_drm.h            | 39 ++++++++++++++++++++++
>  4 files changed, 77 insertions(+), 3 deletions(-)

LGTM. I'll give it a bit more time to see if there are any comments
before I apply it.

Rob

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

* Re: [PATCH] drm/panfrost: Export all GPU feature registers
  2019-07-24 16:27 ` Rob Herring
@ 2019-07-24 16:40   ` Alyssa Rosenzweig
  2019-07-24 16:45       ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Alyssa Rosenzweig @ 2019-07-24 16:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: Steven Price, Daniel Vetter, David Airlie, Tomeu Vizoso,
	dri-devel, linux-kernel, Alyssa Rosenzweig

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

This is definitely helpful!

My one concern is, supposing userspace really does need all of this
information, is it wasteful to have to do 30+ ioctls just to get this?
kbase had a single ioctl to grab all of the properties, whether
userspace wanted them or not. I'm not sure if that's better -- the two
approaches are rather polar opposites.

Granted this would be on driver init so not a critical path.

On Wed, Jul 24, 2019 at 10:27:03AM -0600, Rob Herring wrote:
> Adding Alyssa's Collabora email.
> 
> On Wed, Jul 24, 2019 at 4:56 AM Steven Price <steven.price@arm.com> wrote:
> >
> > Midgard/Bifrost GPUs have a bunch of feature registers providing details
> > of what the hardware supports. Panfrost already reads these, this patch
> > exports them all to user space so that the jobs created by the user space
> > driver can be tuned for the particular hardware implementation.
> >
> > Signed-off-by: Steven Price <steven.price@arm.com>
> > ---
> >  drivers/gpu/drm/panfrost/panfrost_device.h |  1 +
> >  drivers/gpu/drm/panfrost/panfrost_drv.c    | 38 +++++++++++++++++++--
> >  drivers/gpu/drm/panfrost/panfrost_gpu.c    |  2 ++
> >  include/uapi/drm/panfrost_drm.h            | 39 ++++++++++++++++++++++
> >  4 files changed, 77 insertions(+), 3 deletions(-)
> 
> LGTM. I'll give it a bit more time to see if there are any comments
> before I apply it.
> 
> Rob

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] drm/panfrost: Export all GPU feature registers
  2019-07-24 16:40   ` Alyssa Rosenzweig
@ 2019-07-24 16:45       ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-07-24 16:45 UTC (permalink / raw)
  To: Alyssa Rosenzweig
  Cc: Steven Price, Daniel Vetter, David Airlie, Tomeu Vizoso,
	dri-devel, linux-kernel, Alyssa Rosenzweig

On Wed, Jul 24, 2019 at 10:40 AM Alyssa Rosenzweig
<alyssa.rosenzweig@collabora.com> wrote:
>
> This is definitely helpful!
>
> My one concern is, supposing userspace really does need all of this
> information, is it wasteful to have to do 30+ ioctls just to get this?
> kbase had a single ioctl to grab all of the properties, whether
> userspace wanted them or not. I'm not sure if that's better -- the two
> approaches are rather polar opposites.

I think this ship already sailed when we added the first one with
GPU_ID. Also, at least etnaviv works the same way.

>
> Granted this would be on driver init so not a critical path.

Exactly.

>
> On Wed, Jul 24, 2019 at 10:27:03AM -0600, Rob Herring wrote:
> > Adding Alyssa's Collabora email.
> >
> > On Wed, Jul 24, 2019 at 4:56 AM Steven Price <steven.price@arm.com> wrote:
> > >
> > > Midgard/Bifrost GPUs have a bunch of feature registers providing details
> > > of what the hardware supports. Panfrost already reads these, this patch
> > > exports them all to user space so that the jobs created by the user space
> > > driver can be tuned for the particular hardware implementation.
> > >
> > > Signed-off-by: Steven Price <steven.price@arm.com>
> > > ---
> > >  drivers/gpu/drm/panfrost/panfrost_device.h |  1 +
> > >  drivers/gpu/drm/panfrost/panfrost_drv.c    | 38 +++++++++++++++++++--
> > >  drivers/gpu/drm/panfrost/panfrost_gpu.c    |  2 ++
> > >  include/uapi/drm/panfrost_drm.h            | 39 ++++++++++++++++++++++
> > >  4 files changed, 77 insertions(+), 3 deletions(-)
> >
> > LGTM. I'll give it a bit more time to see if there are any comments
> > before I apply it.
> >
> > Rob

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

* Re: [PATCH] drm/panfrost: Export all GPU feature registers
@ 2019-07-24 16:45       ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-07-24 16:45 UTC (permalink / raw)
  To: Alyssa Rosenzweig
  Cc: Tomeu Vizoso, David Airlie, linux-kernel, dri-devel,
	Steven Price, Alyssa Rosenzweig

On Wed, Jul 24, 2019 at 10:40 AM Alyssa Rosenzweig
<alyssa.rosenzweig@collabora.com> wrote:
>
> This is definitely helpful!
>
> My one concern is, supposing userspace really does need all of this
> information, is it wasteful to have to do 30+ ioctls just to get this?
> kbase had a single ioctl to grab all of the properties, whether
> userspace wanted them or not. I'm not sure if that's better -- the two
> approaches are rather polar opposites.

I think this ship already sailed when we added the first one with
GPU_ID. Also, at least etnaviv works the same way.

>
> Granted this would be on driver init so not a critical path.

Exactly.

>
> On Wed, Jul 24, 2019 at 10:27:03AM -0600, Rob Herring wrote:
> > Adding Alyssa's Collabora email.
> >
> > On Wed, Jul 24, 2019 at 4:56 AM Steven Price <steven.price@arm.com> wrote:
> > >
> > > Midgard/Bifrost GPUs have a bunch of feature registers providing details
> > > of what the hardware supports. Panfrost already reads these, this patch
> > > exports them all to user space so that the jobs created by the user space
> > > driver can be tuned for the particular hardware implementation.
> > >
> > > Signed-off-by: Steven Price <steven.price@arm.com>
> > > ---
> > >  drivers/gpu/drm/panfrost/panfrost_device.h |  1 +
> > >  drivers/gpu/drm/panfrost/panfrost_drv.c    | 38 +++++++++++++++++++--
> > >  drivers/gpu/drm/panfrost/panfrost_gpu.c    |  2 ++
> > >  include/uapi/drm/panfrost_drm.h            | 39 ++++++++++++++++++++++
> > >  4 files changed, 77 insertions(+), 3 deletions(-)
> >
> > LGTM. I'll give it a bit more time to see if there are any comments
> > before I apply it.
> >
> > Rob
_______________________________________________
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] drm/panfrost: Export all GPU feature registers
  2019-07-24 16:45       ` Rob Herring
  (?)
@ 2019-07-24 17:47       ` Alyssa Rosenzweig
  -1 siblings, 0 replies; 6+ messages in thread
From: Alyssa Rosenzweig @ 2019-07-24 17:47 UTC (permalink / raw)
  To: Rob Herring
  Cc: Steven Price, Daniel Vetter, David Airlie, Tomeu Vizoso,
	dri-devel, linux-kernel, Alyssa Rosenzweig

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

> I think this ship already sailed when we added the first one with
> GPU_ID. Also, at least etnaviv works the same way.

Fair enough then!

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-07-24 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 10:56 [PATCH] drm/panfrost: Export all GPU feature registers Steven Price
2019-07-24 16:27 ` Rob Herring
2019-07-24 16:40   ` Alyssa Rosenzweig
2019-07-24 16:45     ` Rob Herring
2019-07-24 16:45       ` Rob Herring
2019-07-24 17:47       ` Alyssa Rosenzweig

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.