drm/v3d: Update top-level kerneldoc for the addition of TFU.
Subsystems (3)
PATCH 1/4 drm/v3d: Update top-level kerneldoc for the addition of TFU.
--- drivers/gpu/drm/v3d/v3d_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +3 -3
@@ -7,9 +7,9 @@* This driver supports the Broadcom V3D 3.3 and 4.1 OpenGL ES GPUs. * For V3D 2.x support, see the VC4 driver. * -* Currently only single-core rendering using the binner and renderer -* is supported. The TFU (texture formatting unit) and V3D 4.x's CSD -* (compute shader dispatch) are not yet supported. +* Currently only single-core rendering using the binner and renderer, +* along with TFU (texture formatting unit) rendering is supported. +* V3D 4.x's CSD (compute shader dispatch) is not yet supported. */ #include <linux/clk.h>
Signature · 1 line
2.20.0.rc1
PATCH 2/4 drm/v3d: Add support for V3D v4.2.
No compatible string for it yet, just the version-dependent changes. They've now tied the hub and the core interrupt lines into a single interrupt line coming out of the block. It also turns out I made a mistake in modeling the V3D v3.3 and v4.1 bridge as a part of V3D itself -- the bridge is going away in favor of an external reset controller in a larger HW module.
--- drivers/gpu/drm/v3d/v3d_drv.c | 18 ++++++++++++++---- drivers/gpu/drm/v3d/v3d_drv.h | 1 + drivers/gpu/drm/v3d/v3d_gem.c | 12 +++++++++++- drivers/gpu/drm/v3d/v3d_irq.c | 27 +++++++++++++++++++++------ 4 files changed, 47 insertions(+), 11 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +14 -4
@@ -19,6 +19,7 @@#include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h>
@@ -496,10 +497,6 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) v3d->pdev = pdev; drm = &v3d->drm; - ret =map_regs (v3d, &v3d->bridge_regs,"bridge" ); -if (ret) - goto dev_free; - ret =map_regs (v3d, &v3d->hub_regs,"hub" );if (ret) goto dev_free;
@@ -514,6 +511,19 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) v3d->cores =V3D_GET_FIELD (ident1,V3D_HUB_IDENT1_NCORES );WARN_ON (v3d->cores >1 );/* multicore not yet implemented */ +if (v3d->ver <42 ) { + ret =map_regs (v3d, &v3d->bridge_regs,"bridge" ); +if (ret) + goto dev_free; + }else { + v3d->reset =devm_reset_control_get_exclusive (dev,NULL ); +if (IS_ERR (v3d->reset)) { +dev_err (dev,"Failed to get reset control: %ld\n" , +PTR_ERR (v3d->reset)); +return PTR_ERR (v3d->reset); + } + } +if (v3d->ver <41 ) { ret =map_regs (v3d, &v3d->gca_regs,"gca" );if (ret)
drivers/gpu/drm/v3d/v3d_drv.h +1 -0
@@ -48,6 +48,7 @@ struct v3d_dev {void __iomem *bridge_regs;void __iomem *gca_regs;struct clk *clk; +struct reset_control *reset;/* Virtual and DMA addresses of the single shared page table. */ volatile u32 *pt;
drivers/gpu/drm/v3d/v3d_gem.c +11 -1
@@ -6,6 +6,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <linux/device.h> #include <linux/io.h> #include <linux/sched/signal.h>
@@ -69,7 +70,7 @@ v3d_idle_gca(struct v3d_dev *v3d) }static void -v3d_reset_v3d (struct v3d_dev *v3d) +v3d_reset_by_bridge (struct v3d_dev *v3d) {int version =V3D_BRIDGE_READ (V3D_TOP_GR_BRIDGE_REVISION );
@@ -89,6 +90,15 @@ v3d_reset_v3d(struct v3d_dev *v3d) V3D_TOP_GR_BRIDGE_SW_INIT_1_V3D_CLK_108_SW_INIT);V3D_BRIDGE_WRITE (V3D_TOP_GR_BRIDGE_SW_INIT_1 ,0 ); } +} + +static void +v3d_reset_v3d (struct v3d_dev *v3d) +{ +if (v3d->reset) +reset_control_reset (v3d->reset); +else +v3d_reset_by_bridge (v3d);v3d_init_hw_state (v3d); }
drivers/gpu/drm/v3d/v3d_irq.c +21 -6
@@ -27,6 +27,9 @@ V3D_HUB_INT_MMU_CAP | \ V3D_HUB_INT_TFUC)) +static irqreturn_t +v3d_hub_irq (int irq,void *arg); +static void v3d_overflow_mem_work (struct work_struct *work) {
@@ -112,6 +115,12 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_GMPV )dev_err (v3d->dev,"GMP violation\n" ); +/* V3D 4.2 wires the hub and core IRQs together, so if we & +* didn't see the common one then check hub for MMU IRQs. +*/ +if (v3d->ver >=42 && status ==IRQ_NONE ) +return v3d_hub_irq (irq, arg); +return status; }
@@ -170,12 +179,18 @@ v3d_irq_init(struct v3d_dev *v3d)V3D_CORE_WRITE (core,V3D_CTL_INT_CLR ,V3D_CORE_IRQS );V3D_WRITE (V3D_HUB_INT_CLR ,V3D_HUB_IRQS ); - ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,0 ), - v3d_hub_irq,IRQF_SHARED , -"v3d_hub" , v3d); - ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,1 ), - v3d_irq,IRQF_SHARED , -"v3d_core0" , v3d); +if (v3d->ver <=41 ) { + ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,0 ), + v3d_hub_irq,IRQF_SHARED , +"v3d_hub" , v3d); + ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,1 ), + v3d_irq,IRQF_SHARED , +"v3d_core0" , v3d); + }else { + ret =devm_request_irq (v3d->dev,platform_get_irq (v3d->pdev,0 ), + v3d_irq,IRQF_SHARED , +"v3d" , v3d); + }if (ret)dev_err (v3d->dev,"IRQ setup failed: %d\n" , ret);
Signature · 1 line
2.20.0.rc1
PATCH 3/4 drm/v3d: Don't change other values in V3D_CTL_MISCCFG.
In reply to Eric AnholtThe register now has another field, QRMAXCNT for how many TMU requests get serviced before thread switch. We were accidentally reducing it from its default of 0x3 (4 requests) to 0x0 (1).
--- drivers/gpu/drm/v3d/v3d_gem.c | 4 +++- drivers/gpu/drm/v3d/v3d_regs.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/v3d/v3d_gem.c +3 -1
@@ -25,7 +25,9 @@ v3d_init_core(struct v3d_dev *v3d, int core)* type. If you want the default behavior, you can still put * "2" in the indirect texture state's output_type field. */ -V3D_CORE_WRITE (core,V3D_CTL_MISCCFG ,V3D_MISCCFG_OVRTMUOUT ); +V3D_CORE_WRITE (core,V3D_CTL_MISCCFG , +V3D_CORE_READ (core,V3D_CTL_MISCCFG ) | +V3D_MISCCFG_OVRTMUOUT );/* Whenever we flush the L2T cache, we always want to flush * the whole thing.
drivers/gpu/drm/v3d/v3d_regs.h +2 -0
@@ -216,6 +216,8 @@# define V3D_IDENT2_BCG_INT BIT(28)#define V3D_CTL_MISCCFG 0x00018 +# define V3D_CTL_MISCCFG_QRMAXCNT_MASK V3D_MASK(3, 1) +# define V3D_CTL_MISCCFG_QRMAXCNT_SHIFT 1# define V3D_MISCCFG_OVRTMUOUT BIT(0)#define V3D_CTL_L2CACTL 0x00020
Signature · 6 lines
2.20.0.rc1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/4 drm/v3d: Make sure the GPU is on when measuring clocks.
In reply to Eric AnholtYou'll get garbage measurements if the registers always read back 0xdeadbeef
--- drivers/gpu/drm/v3d/v3d_debugfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/v3d/v3d_debugfs.c +8 -0
@@ -187,6 +187,11 @@ static int v3d_measure_clock(struct seq_file *m, void *unused)uint32_t cycles;int core =0 ;int measure_ms =1000 ; +int ret; + + ret =pm_runtime_get_sync (v3d->dev); +if (ret <0 ) +return ret;if (v3d->ver >=40 ) { V3D_CORE_WRITE(core, V3D_V4_PCTR_0_SRC_0_3,
@@ -210,6 +215,9 @@ static int v3d_measure_clock(struct seq_file *m, void *unused) cycles / (measure_ms *1000 ), (cycles / (measure_ms * 100)) % 10); +pm_runtime_mark_last_busy (v3d->dev); +pm_runtime_put_autosuspend (v3d->dev); +return 0 ; }
Signature · 1 line
2.20.0.rc1
Quoted 2 lines · Eric Anholt
Signed-off-by Eric Anholt <[email protected]>
Quoted 24 lines
--- drivers/gpu/drm/v3d/v3d_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/v3d/v3d_drv.c +3
-4@@ -7,9 +7,9 @@* This driver supports the Broadcom V3D 3.3 and 4.1 OpenGL ES GPUs. * For V3D 2.x support, see the VC4 driver. * -* Currently only single-core rendering using the binner and renderer -* is supported. The TFU (texture formatting unit) and V3D 4.x's CSD -* (compute shader dispatch) are not yet supported. +* Currently only single-core rendering using the binner and renderer, +* along with TFU (texture formatting unit) rendering is supported. +* V3D 4.x's CSD (compute shader dispatch) is not yet supported. */ #include <linux/clk.h> --2.20.0.rc1
Signature · 1 line
Thomas Spurden
Quoted 5 lines · Thomas Spurden
Quoted 2 lines · Eric Anholt
Signed-off-by Eric Anholt <[email protected]>Reviewed-by Thomas Spurden <[email protected]>
Merged this one, will send out respins of the others.