2020-01-06 15:18:01

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 0/6] update hwdw for gc400

This patch series extends the hwdb for an entry for the gc400 found
in the ST STM32 SoC. With this patches we report the same limits and
features for this GPU as the galcore kernel driver does.

Christian Gmeiner (6):
drm/etnaviv: update hardware headers from rnndb
drm/etnaviv: determine product, customer and eco id
drm/etnaviv: show identity information in debugfs
drm/etnaviv: update gc7000 chip identity entry
drm/etnaviv: update hwdb selection logic
drm/etnaviv: add hwdb entry for gc400 found in STM32

drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 18 ++++++++++-
drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 6 ++--
drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 42 +++++++++++++++++++++++++-
drivers/gpu/drm/etnaviv/state_hi.xml.h | 29 +++++++++++-------
4 files changed, 79 insertions(+), 16 deletions(-)

--
2.24.1


2020-01-06 15:18:04

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 1/6] drm/etnaviv: update hardware headers from rnndb

Update the state HI header from rnndb commit
7f1ce75 ("rnndb: document some GPU identity register")

Signed-off-by: Christian Gmeiner <[email protected]>
---
drivers/gpu/drm/etnaviv/state_hi.xml.h | 29 ++++++++++++++++----------
1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/state_hi.xml.h b/drivers/gpu/drm/etnaviv/state_hi.xml.h
index 41d8da2b6f4f..004d8ddacf6a 100644
--- a/drivers/gpu/drm/etnaviv/state_hi.xml.h
+++ b/drivers/gpu/drm/etnaviv/state_hi.xml.h
@@ -8,17 +8,17 @@ This file was generated by the rules-ng-ng headergen tool in this git repository
git clone git://0x04.net/rules-ng-ng

The rules-ng-ng source files this header was generated from are:
-- state.xml ( 26087 bytes, from 2017-12-18 16:51:59)
-- common.xml ( 35468 bytes, from 2018-01-22 13:48:54)
-- common_3d.xml ( 14615 bytes, from 2017-12-18 16:51:59)
-- state_hi.xml ( 30232 bytes, from 2018-02-15 15:48:01)
-- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
-- state_2d.xml ( 51552 bytes, from 2016-12-08 16:37:56)
-- state_3d.xml ( 79992 bytes, from 2017-12-18 16:51:59)
-- state_blt.xml ( 13405 bytes, from 2017-12-18 16:51:59)
-- state_vg.xml ( 5975 bytes, from 2016-12-08 16:37:56)
-
-Copyright (C) 2012-2018 by the following authors:
+- state.xml ( 26666 bytes, from 2019-12-20 21:20:35)
+- common.xml ( 35468 bytes, from 2018-02-10 13:09:26)
+- common_3d.xml ( 15058 bytes, from 2019-12-28 20:02:03)
+- state_hi.xml ( 30552 bytes, from 2019-12-28 20:02:48)
+- copyright.xml ( 1597 bytes, from 2018-02-10 13:09:26)
+- state_2d.xml ( 51552 bytes, from 2018-02-10 13:09:26)
+- state_3d.xml ( 83098 bytes, from 2019-12-28 20:02:03)
+- state_blt.xml ( 14252 bytes, from 2019-10-20 19:59:15)
+- state_vg.xml ( 5975 bytes, from 2018-02-10 13:09:26)
+
+Copyright (C) 2012-2019 by the following authors:
- Wladimir J. van der Laan <[email protected]>
- Christian Gmeiner <[email protected]>
- Lucas Stach <[email protected]>
@@ -48,6 +48,9 @@ DEALINGS IN THE SOFTWARE.
#define MMU_EXCEPTION_SLAVE_NOT_PRESENT 0x00000001
#define MMU_EXCEPTION_PAGE_NOT_PRESENT 0x00000002
#define MMU_EXCEPTION_WRITE_VIOLATION 0x00000003
+#define MMU_EXCEPTION_OUT_OF_BOUND 0x00000004
+#define MMU_EXCEPTION_READ_SECURITY_VIOLATION 0x00000005
+#define MMU_EXCEPTION_WRITE_SECURITY_VIOLATION 0x00000006
#define VIVS_HI 0x00000000

#define VIVS_HI_CLOCK_CONTROL 0x00000000
@@ -140,6 +143,8 @@ DEALINGS IN THE SOFTWARE.

#define VIVS_HI_CHIP_TIME 0x0000002c

+#define VIVS_HI_CHIP_CUSTOMER_ID 0x00000030
+
#define VIVS_HI_CHIP_MINOR_FEATURE_0 0x00000034

#define VIVS_HI_CACHE_CONTROL 0x00000038
@@ -237,6 +242,8 @@ DEALINGS IN THE SOFTWARE.

#define VIVS_HI_BLT_INTR 0x000000d4

+#define VIVS_HI_CHIP_ECO_ID 0x000000e8
+
#define VIVS_HI_AUXBIT 0x000000ec

#define VIVS_PM 0x00000000
--
2.24.1

2020-01-06 15:18:11

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 2/6] drm/etnaviv: determine product, customer and eco id

They will be used for extended HWDB support.

Signed-off-by: Christian Gmeiner <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 11 ++++++++++-
drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 6 +++---
2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index d47d1a8e0219..7ee67e12141d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -333,9 +333,13 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
gpu->identity.revision = etnaviv_field(chipIdentity,
VIVS_HI_CHIP_IDENTITY_REVISION);
} else {
+ u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE);

gpu->identity.model = gpu_read(gpu, VIVS_HI_CHIP_MODEL);
gpu->identity.revision = gpu_read(gpu, VIVS_HI_CHIP_REV);
+ gpu->identity.product_id = gpu_read(gpu, VIVS_HI_CHIP_PRODUCT_ID);
+ gpu->identity.customer_id = gpu_read(gpu, VIVS_HI_CHIP_CUSTOMER_ID);
+ gpu->identity.eco_id = gpu_read(gpu, VIVS_HI_CHIP_ECO_ID);

/*
* !!!! HACK ALERT !!!!
@@ -350,7 +354,6 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)

/* Another special case */
if (etnaviv_is_model_rev(gpu, GC300, 0x2201)) {
- u32 chipDate = gpu_read(gpu, VIVS_HI_CHIP_DATE);
u32 chipTime = gpu_read(gpu, VIVS_HI_CHIP_TIME);

if (chipDate == 0x20080814 && chipTime == 0x12051100) {
@@ -373,6 +376,12 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
gpu->identity.model = chipModel_GC3000;
gpu->identity.revision &= 0xffff;
}
+
+ if (etnaviv_is_model_rev(gpu, GC1000, 0x5037) && (chipDate == 0x20120617))
+ gpu->identity.eco_id = 1;
+
+ if (etnaviv_is_model_rev(gpu, GC320, 0x5303) && (chipDate == 0x20140511))
+ gpu->identity.eco_id = 1;
}

dev_info(gpu->dev, "model: GC%x, revision: %x\n",
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
index 8f9bd4edc96a..68bd966e3916 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
@@ -15,11 +15,11 @@ struct etnaviv_gem_submit;
struct etnaviv_vram_mapping;

struct etnaviv_chip_identity {
- /* Chip model. */
u32 model;
-
- /* Revision value.*/
u32 revision;
+ u32 product_id;
+ u32 customer_id;
+ u32 eco_id;

/* Supported feature fields. */
u32 features;
--
2.24.1

2020-01-06 15:18:19

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 3/6] drm/etnaviv: show identity information in debugfs

Signed-off-by: Christian Gmeiner <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 7ee67e12141d..151033d58bfb 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -860,6 +860,13 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)

verify_dma(gpu, &debug);

+ seq_puts(m, "\tidentity\n");
+ seq_printf(m, "\t model: 0x%x\n", gpu->identity.model);
+ seq_printf(m, "\t revision: 0x%x\n", gpu->identity.revision);
+ seq_printf(m, "\t product_id: 0x%x\n", gpu->identity.product_id);
+ seq_printf(m, "\t customer_id: 0x%x\n", gpu->identity.customer_id);
+ seq_printf(m, "\t eco_id: 0x%x\n", gpu->identity.eco_id);
+
seq_puts(m, "\tfeatures\n");
seq_printf(m, "\t major_features: 0x%08x\n",
gpu->identity.features);
--
2.24.1

2020-01-06 15:18:29

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 5/6] drm/etnaviv: update hwdb selection logic

Take product id, customer id and eco id into account. If that
delivers no match try a search for model and revision.

Signed-off-by: Christian Gmeiner <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
index eb0f3eb87ced..cf3bb26e2e43 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
@@ -46,7 +46,13 @@ bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)

for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
if (etnaviv_chip_identities[i].model == ident->model &&
- etnaviv_chip_identities[i].revision == ident->revision) {
+ etnaviv_chip_identities[i].revision == ident->revision &&
+ (etnaviv_chip_identities[i].product_id == ident->product_id ||
+ etnaviv_chip_identities[i].product_id == ~0U) &&
+ (etnaviv_chip_identities[i].customer_id == ident->customer_id ||
+ etnaviv_chip_identities[i].customer_id == ~0U) &&
+ (etnaviv_chip_identities[i].eco_id == ident->eco_id ||
+ etnaviv_chip_identities[i].eco_id == ~0U)) {
memcpy(ident, &etnaviv_chip_identities[i],
sizeof(*ident));
return true;
--
2.24.1

2020-01-06 15:19:34

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 6/6] drm/etnaviv: add hwdb entry for gc400 found in STM32

The information was taken from STM32 glacore driver hw database.
The entry is named as gc7000nano_0x4652.

Signed-off-by: Christian Gmeiner <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 31 ++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
index cf3bb26e2e43..167971a09be7 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
@@ -6,6 +6,37 @@
#include "etnaviv_gpu.h"

static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
+ {
+ .model = 0x400,
+ .revision = 0x4652,
+ .product_id = 0x70001,
+ .customer_id = 0x100,
+ .eco_id = 0,
+ .stream_count = 4,
+ .register_max = 64,
+ .thread_count = 128,
+ .shader_core_count = 1,
+ .vertex_cache_size = 8,
+ .vertex_output_buffer_size = 1024,
+ .pixel_pipes = 1,
+ .instruction_count = 256,
+ .num_constants = 320,
+ .buffer_size = 0,
+ .varyings_count = 8,
+ .features = 0xa0e9e004,
+ .minor_features0 = 0xe1299fff,
+ .minor_features1 = 0xbe13b219,
+ .minor_features2 = 0xce110010,
+ .minor_features3 = 0x8000001,
+ .minor_features4 = 0x20102,
+ .minor_features5 = 0x120000,
+ .minor_features6 = 0x0,
+ .minor_features7 = 0x0,
+ .minor_features8 = 0x0,
+ .minor_features9 = 0x0,
+ .minor_features10 = 0x0,
+ .minor_features11 = 0x0,
+ },
{
.model = 0x7000,
.revision = 0x6214,
--
2.24.1

2020-01-06 15:19:55

by Christian Gmeiner

[permalink] [raw]
Subject: [PATCH v2 4/6] drm/etnaviv: update gc7000 chip identity entry

Use ~0U as marker for 'I do not care'. I am not sure what
GC7000 based devices are in the wild and I do not want to
break them. In the near future we should extend the hwdb.

Signed-off-by: Christian Gmeiner <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
index 39b463db76c9..eb0f3eb87ced 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
@@ -9,6 +9,9 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
{
.model = 0x7000,
.revision = 0x6214,
+ .product_id = ~0U,
+ .customer_id = ~0U,
+ .eco_id = ~0U,
.stream_count = 16,
.register_max = 64,
.thread_count = 1024,
--
2.24.1

2020-01-06 15:38:10

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v2 0/6] update hwdw for gc400

Hi Christian

On Mon, Jan 06, 2020 at 04:16:45PM +0100, Christian Gmeiner wrote:
> This patch series extends the hwdb for an entry for the gc400 found
> in the ST STM32 SoC. With this patches we report the same limits and
> features for this GPU as the galcore kernel driver does.

For future patches can you please incldue a small changelog
within each patch.

Something like

v2:
- Drop redundant newlines (Lucas)

This serves several purposes:
- It explains what was changed since last version
- It allow the reader to focus on changed parts
- It attributes who requested a specific change
- It gives a good idea of the history of a patch

In the DRM sub-subsystem the idea is that if it is written it
should be visible in git too. So include the changelog part in the
normal commit-message.

Sam

>
> Christian Gmeiner (6):
> drm/etnaviv: update hardware headers from rnndb
> drm/etnaviv: determine product, customer and eco id
> drm/etnaviv: show identity information in debugfs
> drm/etnaviv: update gc7000 chip identity entry
> drm/etnaviv: update hwdb selection logic
> drm/etnaviv: add hwdb entry for gc400 found in STM32
>
> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 18 ++++++++++-
> drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 6 ++--
> drivers/gpu/drm/etnaviv/etnaviv_hwdb.c | 42 +++++++++++++++++++++++++-
> drivers/gpu/drm/etnaviv/state_hi.xml.h | 29 +++++++++++-------
> 4 files changed, 79 insertions(+), 16 deletions(-)
>
> --
> 2.24.1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

2020-01-06 16:02:30

by Christian Gmeiner

[permalink] [raw]
Subject: Re: [PATCH v2 0/6] update hwdw for gc400

Hi Sam,

> For future patches can you please incldue a small changelog
> within each patch.
>
> Something like
>
> v2:
> - Drop redundant newlines (Lucas)
>
> This serves several purposes:
> - It explains what was changed since last version
> - It allow the reader to focus on changed parts
> - It attributes who requested a specific change
> - It gives a good idea of the history of a patch
>
> In the DRM sub-subsystem the idea is that if it is written it
> should be visible in git too. So include the changelog part in the
> normal commit-message.
>

To be honest.. I forgot the change log thing this time - sorry. So the rule
is to have the change log in the normal commit message?
Funny - Lucas told me something different:

"Please move those changelogs below the 3 dashes, so they don't end up
in the commit message. They don't really add any value to the
persistent kernel history."
https://lkml.org/lkml/2019/9/13/107

--
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

2020-01-06 16:29:05

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v2 0/6] update hwdw for gc400

Hi Christian.

> To be honest.. I forgot the change log thing this time - sorry.
It was small changes - so no worries.

> So the rule
> is to have the change log in the normal commit message?
This is what Danial Vetter tell people - but it is not documented as
far as I can tell.

> Funny - Lucas told me something different:
>
> "Please move those changelogs below the 3 dashes, so they don't end up
> in the commit message. They don't really add any value to the
> persistent kernel history."
> https://lkml.org/lkml/2019/9/13/107
Lucas is maintainer of etnaviv driver - so do as he says.

Keep up the good work on etnaviv in mesa too!

Sam

2020-02-24 13:17:09

by Christian Gmeiner

[permalink] [raw]
Subject: Re: [PATCH v2 0/6] update hwdw for gc400

gentle ping

--
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy

2020-02-26 15:25:39

by Lucas Stach

[permalink] [raw]
Subject: Re: [PATCH v2 1/6] drm/etnaviv: update hardware headers from rnndb

Hi Christian,

series applied to etnaviv/next.

Regards,
Lucas

On Mo, 2020-01-06 at 16:16 +0100, Christian Gmeiner wrote:
> Update the state HI header from rnndb commit
> 7f1ce75 ("rnndb: document some GPU identity register")
>
> Signed-off-by: Christian Gmeiner <[email protected]>
> ---
> drivers/gpu/drm/etnaviv/state_hi.xml.h | 29 ++++++++++++++++------
> ----
> 1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/state_hi.xml.h
> b/drivers/gpu/drm/etnaviv/state_hi.xml.h
> index 41d8da2b6f4f..004d8ddacf6a 100644
> --- a/drivers/gpu/drm/etnaviv/state_hi.xml.h
> +++ b/drivers/gpu/drm/etnaviv/state_hi.xml.h
> @@ -8,17 +8,17 @@ This file was generated by the rules-ng-ng
> headergen tool in this git repository
> git clone git://0x04.net/rules-ng-ng
>
> The rules-ng-ng source files this header was generated from are:
> -- state.xml ( 26087 bytes, from 2017-12-18 16:51:59)
> -- common.xml ( 35468 bytes, from 2018-01-22 13:48:54)
> -- common_3d.xml ( 14615 bytes, from 2017-12-18 16:51:59)
> -- state_hi.xml ( 30232 bytes, from 2018-02-15 15:48:01)
> -- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
> -- state_2d.xml ( 51552 bytes, from 2016-12-08 16:37:56)
> -- state_3d.xml ( 79992 bytes, from 2017-12-18 16:51:59)
> -- state_blt.xml ( 13405 bytes, from 2017-12-18 16:51:59)
> -- state_vg.xml ( 5975 bytes, from 2016-12-08 16:37:56)
> -
> -Copyright (C) 2012-2018 by the following authors:
> +- state.xml ( 26666 bytes, from 2019-12-20 21:20:35)
> +- common.xml ( 35468 bytes, from 2018-02-10 13:09:26)
> +- common_3d.xml ( 15058 bytes, from 2019-12-28 20:02:03)
> +- state_hi.xml ( 30552 bytes, from 2019-12-28 20:02:48)
> +- copyright.xml ( 1597 bytes, from 2018-02-10 13:09:26)
> +- state_2d.xml ( 51552 bytes, from 2018-02-10 13:09:26)
> +- state_3d.xml ( 83098 bytes, from 2019-12-28 20:02:03)
> +- state_blt.xml ( 14252 bytes, from 2019-10-20 19:59:15)
> +- state_vg.xml ( 5975 bytes, from 2018-02-10 13:09:26)
> +
> +Copyright (C) 2012-2019 by the following authors:
> - Wladimir J. van der Laan <[email protected]>
> - Christian Gmeiner <[email protected]>
> - Lucas Stach <[email protected]>
> @@ -48,6 +48,9 @@ DEALINGS IN THE SOFTWARE.
> #define MMU_EXCEPTION_SLAVE_NOT_PRESENT
> 0x00000001
> #define MMU_EXCEPTION_PAGE_NOT_PRESENT
> 0x00000002
> #define MMU_EXCEPTION_WRITE_VIOLATION
> 0x00000003
> +#define MMU_EXCEPTION_OUT_OF_BOUND 0x00000
> 004
> +#define MMU_EXCEPTION_READ_SECURITY_VIOLATION
> 0x00000005
> +#define MMU_EXCEPTION_WRITE_SECURITY_VIOLATION
> 0x00000006
> #define VIVS_HI
> 0x00000000
>
> #define VIVS_HI_CLOCK_CONTROL
> 0x00000000
> @@ -140,6 +143,8 @@ DEALINGS IN THE SOFTWARE.
>
> #define VIVS_HI_CHIP_TIME 0x00000
> 02c
>
> +#define VIVS_HI_CHIP_CUSTOMER_ID 0x00000
> 030
> +
> #define VIVS_HI_CHIP_MINOR_FEATURE_0 0x00000
> 034
>
> #define VIVS_HI_CACHE_CONTROL
> 0x00000038
> @@ -237,6 +242,8 @@ DEALINGS IN THE SOFTWARE.
>
> #define VIVS_HI_BLT_INTR 0x00000
> 0d4
>
> +#define VIVS_HI_CHIP_ECO_ID 0x00000
> 0e8
> +
> #define VIVS_HI_AUXBIT
> 0x000000ec
>
> #define VIVS_PM
> 0x00000000