drm/panfrost: Misc. fixes and cleanups
Subsystems (5)
cover drm/panfrost: Misc. fixes and cleanups
Hi,
These are a few trivial fixes and cleanups from playing with the panfrost kernel driver on an Arm Juno board. Not that anyone has ever cared much about the built-in GPU on Juno, but it's at least a somewhat interesting platform from the kernel driver perspective for having I/O coherency, RAM above 4GB, and DVFS abstracted behind a firmware interface.
Robin.
Robin Murphy (4):
drm/panfrost: Set DMA masks earlier
drm/panfrost: Disable PM on probe failure
drm/panfrost: Don't scream about deferred probe
drm/panfrost: Show stored feature registers
drivers/gpu/drm/panfrost/panfrost_drv.c | 12 +++++------- drivers/gpu/drm/panfrost/panfrost_gpu.c | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 14 deletions(-)
Signature · 1 line
2.21.0.dirty
PATCH 1/4 drm/panfrost: Set DMA masks earlier
The DMA masks need to be set correctly before any DMA API activity kicks off, and the current point in panfrost_probe() is way too late in that regard. since panfrost_mmu_init() has already set up a live address space and DMA-mapped MMU pagetables. We can't set masks until we've queried the appropriate value from MMU_FEATURES, but as soon as reasonably possible after that should suffice.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 5 ----- drivers/gpu/drm/panfrost/panfrost_gpu.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/panfrost/panfrost_drv.c +0 -5
@@ -3,8 +3,6 @@/* Copyright 2019 Linaro, Ltd., Rob Herring <[email protected]> */ /* Copyright 2019 Collabora ltd. */ -#include <linux/bitfield.h> -#include <linux/dma-mapping.h> #include <linux/module.h> #include <linux/of_platform.h> #include <linux/pagemap.h>
@@ -388,9 +386,6 @@ static int panfrost_probe(struct platform_device *pdev) goto err_out0; } -dma_set_mask_and_coherent (pfdev->dev, -DMA_BIT_MASK (FIELD_GET (0xff00 , pfdev->features.mmu_features))); - err =panfrost_devfreq_init (pfdev);if (err) {dev_err (&pdev->dev,"Fatal error during devfreq init\n" );
drivers/gpu/drm/panfrost/panfrost_gpu.c +5 -0
@@ -2,8 +2,10 @@/* Copyright 2018 Marty E. Plummer <[email protected]> */ /* Copyright 2019 Linaro, Ltd., Rob Herring <[email protected]> */ /* Copyright 2019 Collabora ltd. */ +#include <linux/bitfield.h> #include <linux/bitmap.h> #include <linux/delay.h> +#include <linux/dma-mapping.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/iopoll.h>
@@ -332,6 +334,9 @@ int panfrost_gpu_init(struct panfrost_device *pfdev)panfrost_gpu_init_features (pfdev); +dma_set_mask_and_coherent (pfdev->dev, +DMA_BIT_MASK (FIELD_GET (0xff00 , pfdev->features.mmu_features))); + irq =platform_get_irq_byname (to_platform_device (pfdev->dev),"gpu" );if (irq <=0 )return -ENODEV ;
Signature · 1 line
2.21.0.dirty
PATCH 2/4 drm/panfrost: Disable PM on probe failure
In reply to Robin MurphyMake sure to disable runtime PM again if probe fails after we've enabled it. Otherwise, any subsequent attempt to re-probe starts triggering "Unbalanced pm_runtime_enable!" assertions from the driver core.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +1 -0
@@ -405,6 +405,7 @@ static int panfrost_probe(struct platform_device *pdev) err_out1:panfrost_device_fini (pfdev); err_out0: +pm_runtime_disable (pfdev->dev);drm_dev_put (ddev);return err; }
Signature · 1 line
2.21.0.dirty
PATCH 3/4 drm/panfrost: Don't scream about deferred probe
In reply to Robin MurphyProbe deferral is far from "fatal".
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/panfrost/panfrost_drv.c +4 -2
@@ -382,13 +382,15 @@ static int panfrost_probe(struct platform_device *pdev) err =panfrost_device_init (pfdev);if (err) { -dev_err (&pdev->dev,"Fatal error during GPU init\n" ); +if (err != -EPROBE_DEFER ) +dev_err (&pdev->dev,"Fatal error during GPU init\n" ); goto err_out0; } err =panfrost_devfreq_init (pfdev);if (err) { -dev_err (&pdev->dev,"Fatal error during devfreq init\n" ); +if (err != -EPROBE_DEFER ) +dev_err (&pdev->dev,"Fatal error during devfreq init\n" ); goto err_out1; }
Signature · 1 line
2.21.0.dirty
PATCH 4/4 drm/panfrost: Show stored feature registers
In reply to Robin MurphyRe-reading the feature registers for the sake of displaying the raw values seems pointless, and in fact showing the copies that we've already read and stored is arguably more useful in terms of giving exposure to any potential bugs in that part of the process.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/panfrost/panfrost_gpu.c +7 -7
@@ -278,13 +278,13 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev) pfdev->features.hw_issues);dev_info (pfdev->dev,"Features: L2:0x%08x Shader:0x%08x Tiler:0x%08x Mem:0x%0x MMU:0x%08x AS:0x%x JS:0x%x" , -gpu_read (pfdev,GPU_L2_FEATURES ), -gpu_read (pfdev,GPU_CORE_FEATURES ), -gpu_read (pfdev,GPU_TILER_FEATURES ), -gpu_read (pfdev,GPU_MEM_FEATURES ), -gpu_read (pfdev,GPU_MMU_FEATURES ), -gpu_read (pfdev,GPU_AS_PRESENT ), -gpu_read (pfdev,GPU_JS_PRESENT )); + pfdev->features.l2_features, + pfdev->features.core_features, + pfdev->features.tiler_features, + pfdev->features.mem_features, + pfdev->features.mmu_features, + pfdev->features.as_present, + pfdev->features.js_present);dev_info (pfdev->dev,"shader_present=0x%0llx l2_present=0x%0llx" , pfdev->features.shader_present, pfdev->features.l2_present);
Signature · 1 line
2.21.0.dirty
[RFC 5/4] arm64: dts: juno: add GPU subsystem
In reply to Robin MurphySince we now have bindings for Mali Midgard GPUs, let's use them to describe Juno's GPU subsystem, if only because we can. Juno sports a Mali-T624 integrated behind an MMU-400 (as a gesture towards virtualisation), in their own dedicated power domain with DVFS controlled by the SCP.
---
Just in case anyone else is interested. Note that I've not been using this exact patch, since my Juno is running the new SCMI-based firmware which needs not-yet-upstream MHU changes, but this should in theory be the equivalent change for the upstream SCPI-based DT.
.../bindings/gpu/arm,mali-midgard.txt | 1 + arch/arm64/boot/dts/arm/juno-base.dtsi | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+)
Documentation/devicetree/bindings/gpu/arm,mali-midgard.txt +1 -0
@@ -16,6 +16,7 @@ Required properties: + "arm,mali-t880" * which must be preceded by one of the following vendor specifics: + "amlogic,meson-gxm-mali" + + "arm,juno-mali" + "rockchip,rk3288-mali" + "rockchip,rk3399-mali"
arch/arm64/boot/dts/arm/juno-base.dtsi +25 -0
@@ -35,6 +35,18 @@ clock-names = "apb_pclk"; }; + smmu_gpu: iommu@2b400000 { + compatible = "arm,mmu-400", "arm,smmu-v1"; + reg = <0x0 0x2b400000 0x0 0x10000>; + interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>; + #iommu-cells = <1>; + #global-interrupts = <1>; + power-domains = <&scpi_devpd 3>; + dma-coherent; + status = "disabled"; + }; + smmu_pcie: iommu@2b500000 { compatible = "arm,mmu-401", "arm,smmu-v1"; reg = <0x0 0x2b500000 0x0 0x10000>;
@@ -487,6 +499,19 @@ }; }; + gpu: gpu@2d000000 { + compatible = "arm,juno-mali", "arm,mali-t624"; + reg = <0 0x2d000000 0 0x10000>; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "gpu", "job", "mmu"; + clocks = <&scpi_dvfs 2>; + power-domains = <&scpi_devpd 3>; + dma-coherent; + status = "disabled"; + }; + sram: sram@2e000000 { compatible = "arm,juno-sram-ns", "mmio-sram"; reg = <0x0 0x2e000000 0x0 0x8000>;
Signature · 1 line
2.21.0.dirty
Rob Herring
maintainerQuoted 19 lines · Robin Murphy
Hi,
These are a few trivial fixes and cleanups from playing with the panfrost kernel driver on an Arm Juno board. Not that anyone has ever cared much about the built-in GPU on Juno, but it's at least a somewhat interesting platform from the kernel driver perspective for having I/O coherency, RAM above 4GB, and DVFS abstracted behind a firmware interface.
Robin.
Robin Murphy (4):
drm/panfrost: Set DMA masks earlier
drm/panfrost: Disable PM on probe failure
drm/panfrost: Don't scream about deferred probe
drm/panfrost: Show stored feature registers
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_drv.c | 12 +++++------- drivers/gpu/drm/panfrost/panfrost_gpu.c | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 14 deletions(-)
Series applied to drm-misc-next-fixes.
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel