The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B
SoCs needs a quirk in the PWR registers at the GPU reset time.
This serie adds the necessary quirks for the Amlogic integrated GPUs only.
Changes since v1 at [1]:
- removed the BROKEN_SH quirk after [2] was sent by robin
- rebased on top of [3] by steven and moved the vendor quirk in the proper quirk function
- added PWR_KEY unlock definition, and cleaned definition
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]
Neil Armstrong (3):
drm/panfrost: add support for vendor quirk
drm/panfrost: add amlogic reset quirk callback
drm/panfrost: add Amlogic GPU integration quirks
drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++++
drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++
drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++
5 files changed, 35 insertions(+)
--
2.22.0
The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B
SoCs needs a quirk in the PWR registers at the GPU reset time.
Since the Amlogic's integration of the GPU cores with the SoC is not
publicly documented we do not know what does these
values, but they permit having a fully functional GPU running with Panfrost.
Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++
drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++
drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++
3 files changed, 17 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index a6de78bc1fa8..e1b2a3376624 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -76,6 +76,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)
return 0;
}
+void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev)
+{
+ /*
+ * The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs
+ * these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order
+ * to operate correctly.
+ */
+ gpu_write(pfdev, GPU_PWR_KEY, GPU_PWR_KEY_UNLOCK);
+ gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16));
+}
+
static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)
{
u32 quirks = 0;
diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.h b/drivers/gpu/drm/panfrost/panfrost_gpu.h
index 4112412087b2..468c51e7e46d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.h
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.h
@@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);
void panfrost_gpu_power_on(struct panfrost_device *pfdev);
void panfrost_gpu_power_off(struct panfrost_device *pfdev);
+void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev);
+
#endif
diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h
index ea38ac60581c..eddaa62ad8b0 100644
--- a/drivers/gpu/drm/panfrost/panfrost_regs.h
+++ b/drivers/gpu/drm/panfrost/panfrost_regs.h
@@ -51,6 +51,10 @@
#define GPU_STATUS 0x34
#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)
#define GPU_LATEST_FLUSH_ID 0x38
+#define GPU_PWR_KEY 0x50 /* (WO) Power manager key register */
+#define GPU_PWR_KEY_UNLOCK 0x2968A819
+#define GPU_PWR_OVERRIDE0 0x54 /* (RW) Power manager override settings */
+#define GPU_PWR_OVERRIDE1 0x58 /* (RW) Power manager override settings */
#define GPU_FAULT_STATUS 0x3C
#define GPU_FAULT_ADDRESS_LO 0x40
#define GPU_FAULT_ADDRESS_HI 0x44
--
2.22.0
series r-b, nice!
On Wed, Sep 16, 2020 at 05:01:44PM +0200, Neil Armstrong wrote:
> The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B
> SoCs needs a quirk in the PWR registers at the GPU reset time.
>
> This serie adds the necessary quirks for the Amlogic integrated GPUs only.
>
> Changes since v1 at [1]:
> - removed the BROKEN_SH quirk after [2] was sent by robin
> - rebased on top of [3] by steven and moved the vendor quirk in the proper quirk function
> - added PWR_KEY unlock definition, and cleaned definition
>
> [1] https://lkml.kernel.org/r/[email protected]
> [2] https://lkml.kernel.org/r/[email protected]
> [3] https://lkml.kernel.org/r/[email protected]
>
> Neil Armstrong (3):
> drm/panfrost: add support for vendor quirk
> drm/panfrost: add amlogic reset quirk callback
> drm/panfrost: add Amlogic GPU integration quirks
>
> drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++
> drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++
> drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++
> 5 files changed, 35 insertions(+)
>
> --
> 2.22.0
>
The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B
SoCs needs a quirk in the PWR registers after each reset.
This adds a callback in the device compatible struct of permit this.
Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++
drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
index abfc78db193a..140e004a3790 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.h
+++ b/drivers/gpu/drm/panfrost/panfrost_device.h
@@ -70,6 +70,9 @@ struct panfrost_compatible {
int num_pm_domains;
/* Only required if num_pm_domains > 1. */
const char * const *pm_domain_names;
+
+ /* Vendor implementation quirks callback */
+ void (*vendor_quirk)(struct panfrost_device *pfdev);
};
struct panfrost_device {
diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index c7c5da5a31d4..a6de78bc1fa8 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -136,6 +136,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)
if (quirks)
gpu_write(pfdev, GPU_JM_CONFIG, quirks);
+
+ /* Here goes platform specific quirks */
+ if (pfdev->comp->vendor_quirk)
+ pfdev->comp->vendor_quirk(pfdev);
}
#define MAX_HW_REVS 6
--
2.22.0
This adds the required GPU quirks, including the quirk in the PWR registers at the GPU
reset time and the IOMMU quirk for shareability issues observed on G52 in Amlogic G12B SoCs.
Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 7c8a87d164c3..6e5dedacb777 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -658,7 +658,18 @@ static const struct panfrost_compatible default_data = {
.pm_domain_names = NULL,
};
+static const struct panfrost_compatible amlogic_data = {
+ .num_supplies = ARRAY_SIZE(default_supplies),
+ .supply_names = default_supplies,
+ .vendor_quirk = panfrost_gpu_amlogic_quirk,
+};
+
static const struct of_device_id dt_match[] = {
+ /* Set first to probe before the generic compatibles */
+ { .compatible = "amlogic,meson-gxm-mali",
+ .data = &amlogic_data, },
+ { .compatible = "amlogic,meson-g12a-mali",
+ .data = &amlogic_data, },
{ .compatible = "arm,mali-t604", .data = &default_data, },
{ .compatible = "arm,mali-t624", .data = &default_data, },
{ .compatible = "arm,mali-t628", .data = &default_data, },
--
2.22.0
On 16/09/2020 16:01, Neil Armstrong wrote:
> The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B
NIT: s/integratewd/integrated/
> SoCs needs a quirk in the PWR registers after each reset.
>
> This adds a callback in the device compatible struct of permit this.
>
> Signed-off-by: Neil Armstrong <[email protected]>
Reviewed-by: Steven Price <[email protected]>
> ---
> drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
> index abfc78db193a..140e004a3790 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.h
> @@ -70,6 +70,9 @@ struct panfrost_compatible {
> int num_pm_domains;
> /* Only required if num_pm_domains > 1. */
> const char * const *pm_domain_names;
> +
> + /* Vendor implementation quirks callback */
> + void (*vendor_quirk)(struct panfrost_device *pfdev);
> };
>
> struct panfrost_device {
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index c7c5da5a31d4..a6de78bc1fa8 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -136,6 +136,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)
>
> if (quirks)
> gpu_write(pfdev, GPU_JM_CONFIG, quirks);
> +
> + /* Here goes platform specific quirks */
> + if (pfdev->comp->vendor_quirk)
> + pfdev->comp->vendor_quirk(pfdev);
> }
>
> #define MAX_HW_REVS 6
>
On 16/09/2020 16:01, Neil Armstrong wrote:
> This adds the required GPU quirks, including the quirk in the PWR registers at the GPU
> reset time and the IOMMU quirk for shareability issues observed on G52 in Amlogic G12B SoCs.
>
> Signed-off-by: Neil Armstrong <[email protected]>
Reviewed-by: Steven Price <[email protected]>
> ---
> drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 7c8a87d164c3..6e5dedacb777 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -658,7 +658,18 @@ static const struct panfrost_compatible default_data = {
> .pm_domain_names = NULL,
> };
>
> +static const struct panfrost_compatible amlogic_data = {
> + .num_supplies = ARRAY_SIZE(default_supplies),
> + .supply_names = default_supplies,
> + .vendor_quirk = panfrost_gpu_amlogic_quirk,
> +};
> +
> static const struct of_device_id dt_match[] = {
> + /* Set first to probe before the generic compatibles */
> + { .compatible = "amlogic,meson-gxm-mali",
> + .data = &amlogic_data, },
> + { .compatible = "amlogic,meson-g12a-mali",
> + .data = &amlogic_data, },
> { .compatible = "arm,mali-t604", .data = &default_data, },
> { .compatible = "arm,mali-t624", .data = &default_data, },
> { .compatible = "arm,mali-t628", .data = &default_data, },
>
On 16/09/2020 16:01, Neil Armstrong wrote:
> The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B
NIT: s/integratewd/integrated/
> SoCs needs a quirk in the PWR registers at the GPU reset time.
>
> Since the Amlogic's integration of the GPU cores with the SoC is not
> publicly documented we do not know what does these
> values, but they permit having a fully functional GPU running with Panfrost.
>
> Signed-off-by: Neil Armstrong <[email protected]>
Reviewed-by: Steven Price <[email protected]>
> ---
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++
> drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++
> 3 files changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index a6de78bc1fa8..e1b2a3376624 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -76,6 +76,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)
> return 0;
> }
>
> +void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev)
> +{
> + /*
> + * The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs
> + * these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order
> + * to operate correctly.
> + */
> + gpu_write(pfdev, GPU_PWR_KEY, GPU_PWR_KEY_UNLOCK);
> + gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16));
> +}
> +
> static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)
> {
> u32 quirks = 0;
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.h b/drivers/gpu/drm/panfrost/panfrost_gpu.h
> index 4112412087b2..468c51e7e46d 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.h
> @@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);
> void panfrost_gpu_power_on(struct panfrost_device *pfdev);
> void panfrost_gpu_power_off(struct panfrost_device *pfdev);
>
> +void panfrost_gpu_amlogic_quirk(struct panfrost_device *pfdev);
> +
> #endif
> diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h
> index ea38ac60581c..eddaa62ad8b0 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_regs.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_regs.h
> @@ -51,6 +51,10 @@
> #define GPU_STATUS 0x34
> #define GPU_STATUS_PRFCNT_ACTIVE BIT(2)
> #define GPU_LATEST_FLUSH_ID 0x38
> +#define GPU_PWR_KEY 0x50 /* (WO) Power manager key register */
> +#define GPU_PWR_KEY_UNLOCK 0x2968A819
> +#define GPU_PWR_OVERRIDE0 0x54 /* (RW) Power manager override settings */
> +#define GPU_PWR_OVERRIDE1 0x58 /* (RW) Power manager override settings */
> #define GPU_FAULT_STATUS 0x3C
> #define GPU_FAULT_ADDRESS_LO 0x40
> #define GPU_FAULT_ADDRESS_HI 0x44
>
Hi Steven, Rob,
Should I send a v3 with the commit log fixes ?
Neil
On 16/09/2020 17:01, Neil Armstrong wrote:
> The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B
> SoCs needs a quirk in the PWR registers at the GPU reset time.
>
> This serie adds the necessary quirks for the Amlogic integrated GPUs only.
>
> Changes since v1 at [1]:
> - removed the BROKEN_SH quirk after [2] was sent by robin
> - rebased on top of [3] by steven and moved the vendor quirk in the proper quirk function
> - added PWR_KEY unlock definition, and cleaned definition
>
> [1] https://lkml.kernel.org/r/[email protected]
> [2] https://lkml.kernel.org/r/[email protected]
> [3] https://lkml.kernel.org/r/[email protected]
>
> Neil Armstrong (3):
> drm/panfrost: add support for vendor quirk
> drm/panfrost: add amlogic reset quirk callback
> drm/panfrost: add Amlogic GPU integration quirks
>
> drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++
> drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++++
> drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++
> drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++
> 5 files changed, 35 insertions(+)
>
On 21/09/2020 08:52, Neil Armstrong wrote:
> Hi Steven, Rob,
>
> Should I send a v3 with the commit log fixes ?
No need, I've fixed it up and pushed to drm-misc-next.
Thanks,
Steve