drm/panfrost: add Amlogic integration quirks
Subsystems (6)
cover drm/panfrost: add Amlogic integration quirks
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.
The coherency integration of the IOMMU in the Mali-G52 found in the Amlogic G12B SoCs is broken and leads to constant and random faults from the IOMMU.
This serie adds the necessary quirks for the Amlogic integrated GPUs only.
Neil Armstrong (5):
iommu/io-pgtable-arm: Add BROKEN_NS quirk to disable shareability on
ARM LPAE
drm/panfrost: add support specifying pgtbl quirks drm/panfrost: add support for reset quirk
drm/panfrost: add amlogic reset quirk callback drm/panfrost: add Amlogic GPU integration quirks
drivers/gpu/drm/panfrost/panfrost_device.h | 6 ++++++ drivers/gpu/drm/panfrost/panfrost_drv.c | 18 ++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 17 +++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_mmu.c | 1 + drivers/gpu/drm/panfrost/panfrost_regs.h | 3 +++ drivers/iommu/io-pgtable-arm.c | 7 ++++--- include/linux/io-pgtable.h | 4 ++++ 8 files changed, 55 insertions(+), 3 deletions(-)
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 iommu/io-pgtable-arm: Add BROKEN_NS quirk to disable shareability on ARM LPAE
The coherency integration of the IOMMU in the Mali-G52 found in the Amlogic G12B SoCs is broken and leads to constant and random faults from the IOMMU.
Disabling shareability completely fixes the issue.
--- drivers/iommu/io-pgtable-arm.c | 7 ++++--- include/linux/io-pgtable.h | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/iommu/io-pgtable-arm.c +4 -3
@@ -440,7 +440,9 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data, << ARM_LPAE_PTE_ATTRINDX_SHIFT); } -if (prot &IOMMU_CACHE ) +if (data->iop.cfg.quirks &IO_PGTABLE_QUIRK_ARM_BROKEN_SH ) + pte |=ARM_LPAE_PTE_SH_NS ; +else if (prot &IOMMU_CACHE ) pte |=ARM_LPAE_PTE_SH_IS ;else pte |=ARM_LPAE_PTE_SH_OS ;
@@ -1005,8 +1007,7 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) {struct arm_lpae_io_pgtable *data; -/* No quirks for Mali (hopefully) */ -if (cfg->quirks) +if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_BROKEN_SH ))return NULL ;if (cfg->ias >48 || cfg->oas >40 )
include/linux/io-pgtable.h +4 -0
@@ -86,6 +86,9 @@ struct io_pgtable_cfg {* * IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table * for use in the upper half of a split address space. +* +* IO_PGTABLE_QUIRK_ARM_BROKEN_SH: (ARM LPAE format) Disables shareability +* when coherency integration is broken. */ #define IO_PGTABLE_QUIRK_ARM_NS BIT(0)#define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)
@@ -93,6 +96,7 @@ struct io_pgtable_cfg {#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3)#define IO_PGTABLE_QUIRK_NON_STRICT BIT(4)#define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) +#define IO_PGTABLE_QUIRK_ARM_BROKEN_SH BIT(6)unsigned long quirks;unsigned long pgsize_bitmap;unsigned int ias;
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Steven Price
maintainerRe: [PATCH 1/5] iommu/io-pgtable-arm: Add BROKEN_NS quirk to disable shareability on ARM LPAE
Subject: s/BROKEN_NS/BROKEN_SH/
Steve
Quoted 52 lines · Neil Armstrong
The coherency integration of the IOMMU in the Mali-G52 found in the Amlogic G12B SoCs is broken and leads to constant and random faults from the IOMMU.
Disabling shareability completely fixes the issue.
Signed-off-by Neil Armstrong <[email protected]>--- drivers/iommu/io-pgtable-arm.c | 7 ++++--- include/linux/io-pgtable.h | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-)drivers/iommu/io-pgtable-arm.c +4
-3@@ -440,7 +440,9 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data, << ARM_LPAE_PTE_ATTRINDX_SHIFT); } -if (prot &IOMMU_CACHE ) +if (data->iop.cfg.quirks &IO_PGTABLE_QUIRK_ARM_BROKEN_SH ) + pte |=ARM_LPAE_PTE_SH_NS ; +else if (prot &IOMMU_CACHE ) pte |=ARM_LPAE_PTE_SH_IS ;else pte |=ARM_LPAE_PTE_SH_OS ;@@ -1005,8 +1007,7 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) {struct arm_lpae_io_pgtable *data; -/* No quirks for Mali (hopefully) */ -if (cfg->quirks) +if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_BROKEN_SH ))return NULL ;if (cfg->ias >48 || cfg->oas >40 )include/linux/io-pgtable.h +3
-0@@ -86,6 +86,9 @@ struct io_pgtable_cfg {* * IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table * for use in the upper half of a split address space. +* +* IO_PGTABLE_QUIRK_ARM_BROKEN_SH: (ARM LPAE format) Disables shareability +* when coherency integration is broken. */ #define IO_PGTABLE_QUIRK_ARM_NS BIT(0)#define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)
include/linux/io-pgtable.h struct io_pgtable_cfg { · line 102
Quoted 7 lines
include/linux/io-pgtable.h +1
-0@@ -93,6 +96,7 @@ struct io_pgtable_cfg {#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3)#define IO_PGTABLE_QUIRK_NON_STRICT BIT(4)#define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) +#define IO_PGTABLE_QUIRK_ARM_BROKEN_SH BIT(6)unsigned long quirks;unsigned long pgsize_bitmap;unsigned int ias;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/5] iommu/io-pgtable-arm: Add BROKEN_NS quirk to disable shareability on ARM LPAE
Quoted 1 line · Steven Price
Subject: s/BROKEN_NS/BROKEN_SH/
Thanks,
Neil
Quoted 52 lines
Steve
Quoted 48 lines · Neil Armstrong
The coherency integration of the IOMMU in the Mali-G52 found in the Amlogic G12B SoCs is broken and leads to constant and random faults from the IOMMU.
Disabling shareability completely fixes the issue.
Signed-off-by Neil Armstrong <[email protected]>---
drivers/iommu/io-pgtable-arm.c| 7 ++++---
include/linux/io-pgtable.h | 4 ++++2 files changed, 8 insertions(+), 3 deletions(-)drivers/iommu/io-pgtable-arm.c +3
-0@@ -440,7 +440,9 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data, << ARM_LPAE_PTE_ATTRINDX_SHIFT); } - if (prot & IOMMU_CACHE) + if (data->iop.cfg.quirks & IO_PGTABLE_QUIRK_ARM_BROKEN_SH) + pte |= ARM_LPAE_PTE_SH_NS; + else if (prot & IOMMU_CACHE) pte |= ARM_LPAE_PTE_SH_IS;else
pte |=ARM_LPAE_PTE_SH_OS;drivers/iommu/io-pgtable-arm.c +0
-0@@ -1005,8 +1007,7 @@ arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) { struct arm_lpae_io_pgtable *data;- /* No quirks for Mali (hopefully) */
- if (cfg->quirks)
+ if (cfg->quirks& ~(IO_PGTABLE_QUIRK_ARM_BROKEN_SH)) return NULL;
if (cfg->ias> 48 ||cfg->oas> 40)include/linux/io-pgtable.h +3
-0@@ -86,6 +86,9 @@ struct io_pgtable_cfg {* * IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table * for use in the upper half of a split address space. +* +* IO_PGTABLE_QUIRK_ARM_BROKEN_SH: (ARM LPAE format) Disables shareability +* when coherency integration is broken. */ #define IO_PGTABLE_QUIRK_ARM_NS BIT(0) #define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)@@ -93,6 +96,7 @@ struct io_pgtable_cfg {
Quoted 9 lines
include/linux/io-pgtable.h struct io_pgtable_cfg { · line 102
Quoted 8 lines
include/linux/io-pgtable.h +1
-0#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3) #define IO_PGTABLE_QUIRK_NON_STRICT BIT(4) #define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5) + #define IO_PGTABLE_QUIRK_ARM_BROKEN_SH BIT(6) unsigned long quirks; unsigned long pgsize_bitmap; unsigned int ias;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm/panfrost: add support specifying pgtbl quirks
In reply to Neil ArmstrongAdd a pgtbl_quirks entry in the compatible specific table to permit specyfying IOMMU quirks for platforms.
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_mmu.c | 1 + 2 files changed, 4 insertions(+)
drivers/gpu/drm/panfrost/panfrost_device.h +3 -0
@@ -70,6 +70,9 @@ struct panfrost_compatible {int num_pm_domains;/* Only required if num_pm_domains > 1. */ const char *const *pm_domain_names; + +/* IOMMU quirks flags */ +unsigned long pgtbl_quirks; };struct panfrost_device {
drivers/gpu/drm/panfrost/panfrost_mmu.c +1 -0
@@ -368,6 +368,7 @@ int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv) mmu->as =-1 ; mmu->pgtbl_cfg = (struct io_pgtable_cfg ) { + .quirks = pfdev->comp ? pfdev->comp->pgtbl_quirks :0 , .pgsize_bitmap =SZ_4K |SZ_2M , .ias =FIELD_GET (0xff , pfdev->features.mmu_features), .oas =FIELD_GET (0xff00 , pfdev->features.mmu_features),
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/5] drm/panfrost: add support specifying pgtbl quirks
Quoted 4 lines · Neil Armstrong
Add a
pgtbl_quirksentry in the compatible specific table to permit specyfying IOMMU quirks for platforms.Signed-off-by Neil Armstrong <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_mmu.c | 1 + 2 files changed, 4 insertions(+)drivers/gpu/drm/panfrost/panfrost_device.h +3
-0@@ -70,6 +70,9 @@ struct panfrost_compatible {int num_pm_domains;/* Only required if num_pm_domains > 1. */ const char *const *pm_domain_names; + +/* IOMMU quirks flags */ +unsigned long pgtbl_quirks; };struct panfrost_device {drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-0
drivers/gpu/drm/panfrost/panfrost_mmu.c int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv) · line 374
Quoted 7 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +1
-0@@ -368,6 +368,7 @@ int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv) mmu->as =-1 ; mmu->pgtbl_cfg = (struct io_pgtable_cfg ) { + .quirks = pfdev->comp ? pfdev->comp->pgtbl_quirks :0 , .pgsize_bitmap =SZ_4K |SZ_2M , .ias =FIELD_GET (0xff , pfdev->features.mmu_features), .oas =FIELD_GET (0xff00 , pfdev->features.mmu_features),
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 drm/panfrost: add support for reset quirk
In reply to Neil ArmstrongThe 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.
This adds a callback in the device compatible struct of permit this.
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/panfrost/panfrost_device.h +3 -0
@@ -73,6 +73,9 @@ struct panfrost_compatible {/* IOMMU quirks flags */ unsigned long pgtbl_quirks; + +/* Vendor implementation quirks at reset time callback */ +void (*vendor_reset_quirk)(struct panfrost_device *pfdev); };struct panfrost_device {
drivers/gpu/drm/panfrost/panfrost_gpu.c +4 -0
@@ -62,6 +62,10 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)gpu_write (pfdev,GPU_INT_CLEAR ,GPU_IRQ_RESET_COMPLETED );gpu_write (pfdev,GPU_CMD ,GPU_CMD_SOFT_RESET ); +/* The Amlogic GPU integration needs quirks at this stage */ +if (pfdev->comp->vendor_reset_quirk) + pfdev->comp->vendor_reset_quirk (pfdev); + ret =readl_relaxed_poll_timeout (pfdev->iomem +GPU_INT_RAWSTAT , val, val &GPU_IRQ_RESET_COMPLETED ,100 ,10000 );
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Steven Price
maintainerRe: [PATCH 3/5] drm/panfrost: add support for reset quirk
Quoted 30 lines · Neil Armstrong
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.
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(+)drivers/gpu/drm/panfrost/panfrost_device.h +3
-0@@ -73,6 +73,9 @@ struct panfrost_compatible {/* IOMMU quirks flags */ unsigned long pgtbl_quirks; + +/* Vendor implementation quirks at reset time callback */ +void (*vendor_reset_quirk)(struct panfrost_device *pfdev); };struct panfrost_device {drivers/gpu/drm/panfrost/panfrost_gpu.c +0
-0
drivers/gpu/drm/panfrost/panfrost_gpu.c int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) · line 70
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +4
-0@@ -62,6 +62,10 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)gpu_write (pfdev,GPU_INT_CLEAR ,GPU_IRQ_RESET_COMPLETED );gpu_write (pfdev,GPU_CMD ,GPU_CMD_SOFT_RESET ); +/* The Amlogic GPU integration needs quirks at this stage */ +if (pfdev->comp->vendor_reset_quirk) + pfdev->comp->vendor_reset_quirk (pfdev); + ret =readl_relaxed_poll_timeout (pfdev->iomem +GPU_INT_RAWSTAT , val, val &GPU_IRQ_RESET_COMPLETED ,100 ,10000 );
Placing the quirk before the reset has completed is dodgy. Can this be ordered after the GPU_IRQ_RESET_COMPLETED signal has been seen? The problem is the reset could (in theory) cause a power transition (e.g. if the GPU is reset while a core is powered) and changing the PWR_OVERRIDEx registers during a transition is undefined. But I don't know the details of how the hardware is broken so it is possible the override is needed for the reset to complete so this would need testing.
I also wonder if this could live in panfrost_gpu_init_quirks() instead? Although that is mostly about quirks common to all Mali GPU implementations rather than a specific implementation. Although now I've looked I've noticed we have a bug as we don't appear to reapply those quirks after a reset - I'll send a patch!
Steve
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/5] drm/panfrost: add support for reset quirk
Quoted 40 lines · Steven Price
Quoted 30 lines · Neil Armstrong
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.
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(+)drivers/gpu/drm/panfrost/panfrost_device.h +3
-0@@ -73,6 +73,9 @@ struct panfrost_compatible { /* IOMMU quirks flags */ unsigned long pgtbl_quirks; + + /* Vendor implementation quirks at reset time callback */ + void (*vendor_reset_quirk)(struct panfrost_device *pfdev); }; struct panfrost_device {drivers/gpu/drm/panfrost/panfrost_gpu.c +0
-0@@ -62,6 +62,10 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) gpu_write(pfdev, GPU_INT_CLEAR, GPU_IRQ_RESET_COMPLETED); gpu_write(pfdev, GPU_CMD, GPU_CMD_SOFT_RESET);Quoted 6 lines
+ /* The Amlogic GPU integration needs quirks at this stage */ + if (
pfdev->comp->vendor_reset_quirk)
+pfdev->comp->vendor_reset_quirk(pfdev);
+
ret =readl_relaxed_poll_timeout(pfdev->iomem + GPU_INT_RAWSTAT, val, val & GPU_IRQ_RESET_COMPLETED, 100, 10000);Placing the quirk before the reset has completed is dodgy. Can this be ordered after the
GPU_IRQ_RESET_COMPLETEDsignal has been seen? The problem is the reset could (in theory) cause a power transition (e.g. if the GPU is reset while a core is powered) and changing thePWR_OVERRIDExregisters during a transition is undefined. But I don't know the details of how the hardware is broken so it is possible the override is needed for the reset to complete so this would need testing.
Quoted 1 line
I also wonder if this could live in
panfrost_gpu_init_quirks()instead? Although that is mostly about quirks common to all Mali GPU implementations rather than a specific implementation. Although now I've looked I've noticed we have a bug as we don't appear to reapply those quirks after a reset - I'll send a patch!
Indeed, it needs to be applied after each reset, so if you send a patch for this pretty sure it could live in panfrost_gpu_init_quirks().
Neil
Quoted 2 lines
Steve
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/panfrost: add amlogic reset quirk callback
In reply to Neil ArmstrongThe 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 documentation of the GPU cores are not public, we do not know what does these values, but they permit having a fully functional GPU running with Panfrost.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 13 +++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 3 +++ 3 files changed, 18 insertions(+)
drivers/gpu/drm/panfrost/panfrost_gpu.c +13 -0
@@ -80,6 +80,19 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)return 0 ; } +void panfrost_gpu_amlogic_quirks (struct panfrost_device *pfdev) +{ +/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits to be set in order to operate +* correctly. +* These GPU_PWR registers contains: +* "device-specific power control value" +*/ +gpu_write (pfdev,GPU_PWR_KEY ,0x2968A819 ); +gpu_write (pfdev,GPU_PWR_OVERRIDE1 ,0xfff | (0x20 <<16 )); +} +static void panfrost_gpu_init_quirks (struct panfrost_device *pfdev) {u32 quirks =0 ;
drivers/gpu/drm/panfrost/panfrost_gpu.h +2 -0
@@ -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_reset_quirk (struct panfrost_device *pfdev); +#endif
drivers/gpu/drm/panfrost/panfrost_regs.h +3 -0
@@ -51,6 +51,9 @@#define GPU_STATUS 0x34#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x050/* (WO) Power manager key register */ +#define GPU_PWR_OVERRIDE0 0x054/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x058/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C#define GPU_FAULT_ADDRESS_LO 0x40#define GPU_FAULT_ADDRESS_HI 0x44
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/5] drm/panfrost: add amlogic reset quirk callback
Quoted 2 lines
Since the documentation of the GPU cores are not public, we do not know what does these values, but they permit having a fully functional GPU running with Panfrost.
Since this is Amlogic magic, not specifically GPU, I'd rephrase this as "Since the Amlogic's integration of the GPU cores with the SoC is not publicly documented..."
drivers/gpu/drm/panfrost/panfrost_gpu.c int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) · line 91
Quoted 7 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +7
-0+/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits to be set in order to operate +* correctly. +* These GPU_PWR registers contains: +* "device-specific power control value" +*/
PWR_OVERRIDE1 is the Amlogic specific value.
Per the name, for PWR_KEY, I'd do add "#define GPU_PWR_KEY_UNLOCK 0x2968A819" in panfrost-gpu.h so it's clear which value is which.
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
kernel test robot
build botRe: [PATCH 4/5] drm/panfrost: add amlogic reset quirk callback
In reply to Neil ArmstrongI love your patch! Perhaps something to improve:
Hi Neil,
I love your patch! Perhaps something to improve:
[auto build test WARNING on iommu/next]
[also build test WARNING on soc/for-next linus/master v5.9-rc4 next-20200908] [cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Neil-Armstrong/drm-panfrost-add-Amlogic-integration-quirks/20200908-232205 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: arm-randconfig-r014-20200908 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project df63eedef64d715ce1f31843f7de9c11fe1e597f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/panfrost/panfrost_gpu.c:82:6: warning: no previous prototype for function 'panfrost_gpu_amlogic_quirks' [-Wmissing-prototypes]
void panfrost_gpu_amlogic_quirks(struct panfrost_device *pfdev)
^ drivers/gpu/drm/panfrost/panfrost_gpu.c:82:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void panfrost_gpu_amlogic_quirks(struct panfrost_device *pfdev)
^
static
1 warning generated.
# https://github.com/0day-ci/linux/commit/10c9c1e2d5b129f4936ea0b84cb489da43364d8c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Neil-Armstrong/drm-panfrost-add-Amlogic-integration-quirks/20200908-232205 git checkout 10c9c1e2d5b129f4936ea0b84cb489da43364d8c
vim +/panfrost_gpu_amlogic_quirks +82 drivers/gpu/drm/panfrost/panfrost_gpu.c
81
> 82 void panfrost_gpu_amlogic_quirks(struct panfrost_device *pfdev)
83 {
84 /*
85 * The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs
86 * these undocumented bits to be set in order to operate
87 * correctly.
88 * These GPU_PWR registers contains:
89 * "device-specific power control value"
90 */
91 gpu_write(pfdev, GPU_PWR_KEY, 0x2968A819);
92 gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16));
93 }
94 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Steven Price
maintainerRe: [PATCH 4/5] drm/panfrost: add amlogic reset quirk callback
In reply to Neil ArmstrongQuoted 21 lines · Neil Armstrong
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 documentation of the GPU cores are not public, 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 | 13 +++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 3 +++ 3 files changed, 18 insertions(+)drivers/gpu/drm/panfrost/panfrost_gpu.c +0
-0@@ -80,6 +80,19 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)return 0 ; }
drivers/gpu/drm/panfrost/panfrost_gpu.c int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) · line 92
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +10
-0+void panfrost_gpu_amlogic_quirks (struct panfrost_device *pfdev) +{ +/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits to be set in order to operate +* correctly. +* These GPU_PWR registers contains: +* "device-specific power control value" +*/ +gpu_write (pfdev,GPU_PWR_KEY ,0x2968A819 );
As Alyssa has mentioned this magic value is not Amlogic specific, but is just the unlock key value, so please add the define in panfrost-gpu.h
drivers/gpu/drm/panfrost/panfrost_gpu.c int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) · line 93
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_gpu.c +1
-0+gpu_write (pfdev,GPU_PWR_OVERRIDE1 ,0xfff | (0x20 <<16 ));
But PWR_OVERRIDE1 is indeed device specific so I can't offer an insight here.
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +2
-0+} +static void panfrost_gpu_init_quirks (struct panfrost_device *pfdev) {u32 quirks =0 ;drivers/gpu/drm/panfrost/panfrost_gpu.h +0
-0
drivers/gpu/drm/panfrost/panfrost_gpu.h int panfrost_gpu_soft_reset(struct panfrost_device *pfdev); · line 19
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_gpu.h +1
-0@@ -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_reset_quirk (struct panfrost_device *pfdev);
You need to be consistent about the name - this has _reset_, the above function doesn't.
Steve
Quoted 8 lines
drivers/gpu/drm/panfrost/panfrost_gpu.h +1
-0+#endif drivers/gpu/drm/panfrost/panfrost_regs.h +0
-0
drivers/gpu/drm/panfrost/panfrost_regs.h line 59
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_regs.h +3
-0@@ -51,6 +51,9 @@#define GPU_STATUS 0x34#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x050/* (WO) Power manager key register */ +#define GPU_PWR_OVERRIDE0 0x054/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x058/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C#define GPU_FAULT_ADDRESS_LO 0x40#define GPU_FAULT_ADDRESS_HI 0x44
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/5] drm/panfrost: add amlogic reset quirk callback
Hi,
Quoted 25 lines · Steven Price
Quoted 24 lines · Neil Armstrong
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 documentation of the GPU cores are not public, 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 | 13 +++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++drivers/gpu/drm/panfrost/panfrost_regs.h| 3 +++3 files changed, 18 insertions(+)drivers/gpu/drm/panfrost/panfrost_gpu.c +3
-0@@ -80,6 +80,19 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) return 0; } +void panfrost_gpu_amlogic_quirks(struct panfrost_device *pfdev) +{ + /* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs
Quoted 8 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) · line 92
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +6
-0+* these undocumented bits to be set in order to operate +* correctly. +* These GPU_PWR registers contains: +* "device-specific power control value" +*/ + gpu_write(pfdev, GPU_PWR_KEY, 0x2968A819);As Alyssa has mentioned this magic value is not Amlogic specific, but is just the unlock key value, so please add the define in
panfrost-gpu.h
Acked
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) · line 93
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +1
-0+ gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16));But
PWR_OVERRIDE1is indeed device specific so I can't offer an insight here.
Yep.
Quoted 16 lines
Quoted 11 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +2
-0+} + static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev) { u32 quirks = 0;drivers/gpu/drm/panfrost/panfrost_gpu.h +0
-0drivers/gpu/drm/panfrost/panfrost_gpu.h int panfrost_gpu_soft_reset(struct panfrost_device *pfdev); · line 18
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_gpu.h +0
-0@@ -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_reset_quirk(struct panfrost_device *pfdev);You need to be consistent about the name - this has _reset_, the above function doesn't.
Yep, will be fixed in next version.
Thanks for the review,
Neil
Quoted 12 lines
Steve
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_gpu.h +1
-0+ #endifdrivers/gpu/drm/panfrost/panfrost_regs.h +0
-0@@ -51,6 +51,9 @@ #define GPU_STATUS 0x34 #define GPU_STATUS_PRFCNT_ACTIVE BIT(2)
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_regs.h line 59
Quoted 8 lines
drivers/gpu/drm/panfrost/panfrost_regs.h +3
-0#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x050/* (WO) Power manager key register */ +#define GPU_PWR_OVERRIDE0 0x054/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x058/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C #define GPU_FAULT_ADDRESS_LO 0x40 #define GPU_FAULT_ADDRESS_HI 0x44
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/panfrost: add Amlogic GPU integration quirks
In reply to Neil ArmstrongThis 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.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +18 -0
@@ -656,7 +656,25 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +static const struct panfrost_compatible amlogic_gxm_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_reset_quirk = panfrost_gpu_amlogic_reset_quirk, +}; + +static const struct panfrost_compatible amlogic_g12a_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_reset_quirk = panfrost_gpu_amlogic_reset_quirk, + .pgtbl_quirks =IO_PGTABLE_QUIRK_ARM_BROKEN_SH , +}; +static const struct of_device_id dt_match[] = { +/* Set first to probe before the generic compatibles */ + { .compatible ="amlogic,meson-gxm-mali" , + .data = &amlogic_gxm_data, }, + { .compatible ="amlogic,meson-g12a-mali" , + .data = &amlogic_g12a_data, }, { .compatible ="arm,mali-t604" , .data = &default_data, }, { .compatible ="arm,mali-t624" , .data = &default_data, }, { .compatible ="arm,mali-t628" , .data = &default_data, },
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/panfrost: add Amlogic GPU integration quirks
Quoted 41 lines
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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/gpu/drm/panfrost/panfrost_drv.c +18
-0@@ -656,7 +656,25 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +static const struct panfrost_compatible amlogic_gxm_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_reset_quirk = panfrost_gpu_amlogic_reset_quirk, +}; + +static const struct panfrost_compatible amlogic_g12a_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_reset_quirk = panfrost_gpu_amlogic_reset_quirk, + .pgtbl_quirks =IO_PGTABLE_QUIRK_ARM_BROKEN_SH , +}; +static const struct of_device_id dt_match[] = { +/* Set first to probe before the generic compatibles */ + { .compatible ="amlogic,meson-gxm-mali" , + .data = &amlogic_gxm_data, }, + { .compatible ="amlogic,meson-g12a-mali" , + .data = &amlogic_g12a_data, }, { .compatible ="arm,mali-t604" , .data = &default_data, }, { .compatible ="arm,mali-t624" , .data = &default_data, }, { .compatible ="arm,mali-t628" , .data = &default_data, },Signature · 1 line
2.22.0
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
kernel test robot
build botRe: [PATCH 5/5] drm/panfrost: add Amlogic GPU integration quirks
In reply to Neil ArmstrongI love your patch! Yet something to improve:
Hi Neil,
I love your patch! Yet something to improve:
[auto build test ERROR on iommu/next]
[also build test ERROR on soc/for-next linus/master v5.9-rc4 next-20200908] [cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Neil-Armstrong/drm-panfrost-add-Amlogic-integration-quirks/20200908-232205 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: arm64-defconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "panfrost_gpu_amlogic_reset_quirk" [drivers/gpu/drm/panfrost/panfrost.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org