Skip to contentSkip to conversation

V3D module changes for Pi5

PATCH Superseded Iago Toral Quiroga 4 participants 15 messages Oct 30, 2023

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover V3D module changes for Pi5

This series includes patches to update the V3D kernel module that drives the VideoCore VI GPU in Raspberry Pi 4 to also support the Video Core VII iteration present in Raspberry Pi 5.

The first patch in the series adds a small uAPI update required for TFU jobs, the second patch addresses the bulk of the work and involves mostly updates to register addresses, the third and fourth patches match the 'brcm,2712-v3d' device string from Pi5 with the V3D driver.

The changes for the user-space driver can be found in the corresponding Mesa MR here:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450

Iago Toral Quiroga (4):
drm/v3d: update UAPI to match user-space for V3D 7.x drm/v3d: fix up register addresses for V3D 7.x
dt-bindings: gpu: v3d: Add BCM2712's compatible drm/v3d: add brcm,2712-v3d as a compatible V3D device

 .../devicetree/bindings/gpu/brcm,bcm-v3d.yaml |   1 +
 drivers/gpu/drm/v3d/v3d_debugfs.c             | 178 ++++++++++--------
 drivers/gpu/drm/v3d/v3d_drv.c                 |   1 +
 drivers/gpu/drm/v3d/v3d_gem.c                 |   4 +-
 drivers/gpu/drm/v3d/v3d_irq.c                 |  46 +++--
 drivers/gpu/drm/v3d/v3d_regs.h                |  94 +++++----
 drivers/gpu/drm/v3d/v3d_sched.c               |  38 ++--
 include/uapi/drm/v3d_drm.h                    |   5 +
 8 files changed, 211 insertions(+), 156 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 1/4 drm/v3d: update UAPI to match user-space for V3D 7.x

V3D 7.x takes a new parameter to configure TFU jobs that needs to be provided by user space.

v2: added s-o-b, fixed typo in commit message (Maíra Canal)

---
 include/uapi/drm/v3d_drm.h | 5 +++++
 1 file changed, 5 insertions(+)
include/uapi/drm/v3d_drm.h +5 -0
index 3dfc0af8756a..1a7d7a689de3 100644
@@ -319,6 +319,11 @@ struct drm_v3d_submit_tfu {
 
 	/* Pointer to an array of ioctl extensions*/
 	__u64 extensions;
+
+	struct {
+		__u32 ioc;
+		__u32 pad;
+	} v71;
 };
 
 /* Submits a compute shader for dispatch.  This job will block on any
Signature · 1 line
2.39.2
#2 lore raw

PATCH v2 2/4 drm/v3d: fix up register addresses for V3D 7.x

In reply to Iago Toral Quiroga

This patch updates a number of register addresses that have been changed in Raspberry Pi 5 (V3D 7.1) and updates the code to use the corresponding registers and addresses based on the actual V3D version.

v2:
- added s-o-b and commit message. (Maíra Canal)
- Used macro that takes version as argument and returns appropriate values instead of two different definitions for post-v71 and pre-v71 hardware when possible. (Maíra Canal)
- fixed style warnings from checkpatch.pl. (Maíra Canal)

---
 drivers/gpu/drm/v3d/v3d_debugfs.c | 178 +++++++++++++++++-------------
 drivers/gpu/drm/v3d/v3d_gem.c     |   4 +-
 drivers/gpu/drm/v3d/v3d_irq.c     |  46 ++++----
 drivers/gpu/drm/v3d/v3d_regs.h    |  94 +++++++++-------
 drivers/gpu/drm/v3d/v3d_sched.c   |  38 ++++---
 5 files changed, 204 insertions(+), 156 deletions(-)
drivers/gpu/drm/v3d/v3d_debugfs.c +101 -77
index 330669f51fa7..f843a50d5dce 100644
@@ -12,69 +12,83 @@
 #include "v3d_drv.h"
 #include "v3d_regs.h"
 
-#define REGDEF(reg) { reg, #reg }
+#define REGDEF(min_ver, max_ver, reg) { min_ver, max_ver, reg, #reg }
 struct v3d_reg_def {
+	u32 min_ver;
+	u32 max_ver;
 	u32 reg;
 	const char *name;
 };
 
 static const struct v3d_reg_def v3d_hub_reg_defs[] = {
-	REGDEF(V3D_HUB_AXICFG),
-	REGDEF(V3D_HUB_UIFCFG),
-	REGDEF(V3D_HUB_IDENT0),
-	REGDEF(V3D_HUB_IDENT1),
-	REGDEF(V3D_HUB_IDENT2),
-	REGDEF(V3D_HUB_IDENT3),
-	REGDEF(V3D_HUB_INT_STS),
-	REGDEF(V3D_HUB_INT_MSK_STS),
-
-	REGDEF(V3D_MMU_CTL),
-	REGDEF(V3D_MMU_VIO_ADDR),
-	REGDEF(V3D_MMU_VIO_ID),
-	REGDEF(V3D_MMU_DEBUG_INFO),
+	REGDEF(33, 42, V3D_HUB_AXICFG),
+	REGDEF(33, 71, V3D_HUB_UIFCFG),
+	REGDEF(33, 71, V3D_HUB_IDENT0),
+	REGDEF(33, 71, V3D_HUB_IDENT1),
+	REGDEF(33, 71, V3D_HUB_IDENT2),
+	REGDEF(33, 71, V3D_HUB_IDENT3),
+	REGDEF(33, 71, V3D_HUB_INT_STS),
+	REGDEF(33, 71, V3D_HUB_INT_MSK_STS),
+
+	REGDEF(33, 71, V3D_MMU_CTL),
+	REGDEF(33, 71, V3D_MMU_VIO_ADDR),
+	REGDEF(33, 71, V3D_MMU_VIO_ID),
+	REGDEF(33, 71, V3D_MMU_DEBUG_INFO),
+
+	REGDEF(71, 71, V3D_GMP_STATUS(71)),
+	REGDEF(71, 71, V3D_GMP_CFG(71)),
+	REGDEF(71, 71, V3D_GMP_VIO_ADDR(71)),
 };
 
 static const struct v3d_reg_def v3d_gca_reg_defs[] = {
-	REGDEF(V3D_GCA_SAFE_SHUTDOWN),
-	REGDEF(V3D_GCA_SAFE_SHUTDOWN_ACK),
+	REGDEF(33, 33, V3D_GCA_SAFE_SHUTDOWN),
+	REGDEF(33, 33, V3D_GCA_SAFE_SHUTDOWN_ACK),
 };
 
 static const struct v3d_reg_def v3d_core_reg_defs[] = {
-	REGDEF(V3D_CTL_IDENT0),
-	REGDEF(V3D_CTL_IDENT1),
-	REGDEF(V3D_CTL_IDENT2),
-	REGDEF(V3D_CTL_MISCCFG),
-	REGDEF(V3D_CTL_INT_STS),
-	REGDEF(V3D_CTL_INT_MSK_STS),
-	REGDEF(V3D_CLE_CT0CS),
-	REGDEF(V3D_CLE_CT0CA),
-	REGDEF(V3D_CLE_CT0EA),
-	REGDEF(V3D_CLE_CT1CS),
-	REGDEF(V3D_CLE_CT1CA),
-	REGDEF(V3D_CLE_CT1EA),
-
-	REGDEF(V3D_PTB_BPCA),
-	REGDEF(V3D_PTB_BPCS),
-
-	REGDEF(V3D_GMP_STATUS),
-	REGDEF(V3D_GMP_CFG),
-	REGDEF(V3D_GMP_VIO_ADDR),
-
-	REGDEF(V3D_ERR_FDBGO),
-	REGDEF(V3D_ERR_FDBGB),
-	REGDEF(V3D_ERR_FDBGS),
-	REGDEF(V3D_ERR_STAT),
+	REGDEF(33, 71, V3D_CTL_IDENT0),
+	REGDEF(33, 71, V3D_CTL_IDENT1),
+	REGDEF(33, 71, V3D_CTL_IDENT2),
+	REGDEF(33, 71, V3D_CTL_MISCCFG),
+	REGDEF(33, 71, V3D_CTL_INT_STS),
+	REGDEF(33, 71, V3D_CTL_INT_MSK_STS),
+	REGDEF(33, 71, V3D_CLE_CT0CS),
+	REGDEF(33, 71, V3D_CLE_CT0CA),
+	REGDEF(33, 71, V3D_CLE_CT0EA),
+	REGDEF(33, 71, V3D_CLE_CT1CS),
+	REGDEF(33, 71, V3D_CLE_CT1CA),
+	REGDEF(33, 71, V3D_CLE_CT1EA),
+
+	REGDEF(33, 71, V3D_PTB_BPCA),
+	REGDEF(33, 71, V3D_PTB_BPCS),
+
+	REGDEF(33, 41, V3D_GMP_STATUS(33)),
+	REGDEF(33, 41, V3D_GMP_CFG(33)),
+	REGDEF(33, 41, V3D_GMP_VIO_ADDR(33)),
+
+	REGDEF(33, 71, V3D_ERR_FDBGO),
+	REGDEF(33, 71, V3D_ERR_FDBGB),
+	REGDEF(33, 71, V3D_ERR_FDBGS),
+	REGDEF(33, 71, V3D_ERR_STAT),
 };
 
 static const struct v3d_reg_def v3d_csd_reg_defs[] = {
-	REGDEF(V3D_CSD_STATUS),
-	REGDEF(V3D_CSD_CURRENT_CFG0),
-	REGDEF(V3D_CSD_CURRENT_CFG1),
-	REGDEF(V3D_CSD_CURRENT_CFG2),
-	REGDEF(V3D_CSD_CURRENT_CFG3),
-	REGDEF(V3D_CSD_CURRENT_CFG4),
-	REGDEF(V3D_CSD_CURRENT_CFG5),
-	REGDEF(V3D_CSD_CURRENT_CFG6),
+	REGDEF(41, 71, V3D_CSD_STATUS),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG0(41)),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG1(41)),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG2(41)),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG3(41)),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG4(41)),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG5(41)),
+	REGDEF(41, 41, V3D_CSD_CURRENT_CFG6(41)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG0(71)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG1(71)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG2(71)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG3(71)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG4(71)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG5(71)),
+	REGDEF(71, 71, V3D_CSD_CURRENT_CFG6(71)),
+	REGDEF(71, 71, V3D_V7_CSD_CURRENT_CFG7),
 };
 
 static int v3d_v3d_debugfs_regs(struct seq_file *m, void *unused)
@@ -85,38 +99,41 @@ static int v3d_v3d_debugfs_regs(struct seq_file *m, void *unused)
 	int i, core;
 
 	for (i = 0; i < ARRAY_SIZE(v3d_hub_reg_defs); i++) {
-		seq_printf(m, "%s (0x%04x): 0x%08x\n",
-			   v3d_hub_reg_defs[i].name, v3d_hub_reg_defs[i].reg,
-			   V3D_READ(v3d_hub_reg_defs[i].reg));
+		const struct v3d_reg_def *def = &v3d_hub_reg_defs[i];
+
+		if (v3d->ver >= def->min_ver && v3d->ver <= def->max_ver) {
+			seq_printf(m, "%s (0x%04x): 0x%08x\n",
+				   def->name, def->reg, V3D_READ(def->reg));
+		}
 	}
 
-	if (v3d->ver < 41) {
-		for (i = 0; i < ARRAY_SIZE(v3d_gca_reg_defs); i++) {
+	for (i = 0; i < ARRAY_SIZE(v3d_gca_reg_defs); i++) {
+		const struct v3d_reg_def *def = &v3d_gca_reg_defs[i];
+
+		if (v3d->ver >= def->min_ver && v3d->ver <= def->max_ver) {
 			seq_printf(m, "%s (0x%04x): 0x%08x\n",
-				   v3d_gca_reg_defs[i].name,
-				   v3d_gca_reg_defs[i].reg,
-				   V3D_GCA_READ(v3d_gca_reg_defs[i].reg));
+				   def->name, def->reg, V3D_GCA_READ(def->reg));
 		}
 	}
 
 	for (core = 0; core < v3d->cores; core++) {
 		for (i = 0; i < ARRAY_SIZE(v3d_core_reg_defs); i++) {
-			seq_printf(m, "core %d %s (0x%04x): 0x%08x\n",
-				   core,
-				   v3d_core_reg_defs[i].name,
-				   v3d_core_reg_defs[i].reg,
-				   V3D_CORE_READ(core,
-						 v3d_core_reg_defs[i].reg));
+			const struct v3d_reg_def *def = &v3d_core_reg_defs[i];
+
+			if (v3d->ver >= def->min_ver && v3d->ver <= def->max_ver) {
+				seq_printf(m, "core %d %s (0x%04x): 0x%08x\n",
+					   core, def->name, def->reg,
+					   V3D_CORE_READ(core, def->reg));
+			}
 		}
 
-		if (v3d_has_csd(v3d)) {
-			for (i = 0; i < ARRAY_SIZE(v3d_csd_reg_defs); i++) {
+		for (i = 0; i < ARRAY_SIZE(v3d_csd_reg_defs); i++) {
+			const struct v3d_reg_def *def = &v3d_csd_reg_defs[i];
+
+			if (v3d->ver >= def->min_ver && v3d->ver <= def->max_ver) {
 				seq_printf(m, "core %d %s (0x%04x): 0x%08x\n",
-					   core,
-					   v3d_csd_reg_defs[i].name,
-					   v3d_csd_reg_defs[i].reg,
-					   V3D_CORE_READ(core,
-							 v3d_csd_reg_defs[i].reg));
+					   core, def->name, def->reg,
+					   V3D_CORE_READ(core, def->reg));
 			}
 		}
 	}
@@ -147,8 +164,10 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		   str_yes_no(ident2 & V3D_HUB_IDENT2_WITH_MMU));
 	seq_printf(m, "TFU:        %s\n",
 		   str_yes_no(ident1 & V3D_HUB_IDENT1_WITH_TFU));
-	seq_printf(m, "TSY:        %s\n",
-		   str_yes_no(ident1 & V3D_HUB_IDENT1_WITH_TSY));
+	if (v3d->ver <= 42) {
+		seq_printf(m, "TSY:        %s\n",
+			   str_yes_no(ident1 & V3D_HUB_IDENT1_WITH_TSY));
+	}
 	seq_printf(m, "MSO:        %s\n",
 		   str_yes_no(ident1 & V3D_HUB_IDENT1_WITH_MSO));
 	seq_printf(m, "L3C:        %s (%dkb)\n",
@@ -177,10 +196,14 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
 		seq_printf(m, "  QPUs:         %d\n", nslc * qups);
 		seq_printf(m, "  Semaphores:   %d\n",
 			   V3D_GET_FIELD(ident1, V3D_IDENT1_NSEM));
-		seq_printf(m, "  BCG int:      %d\n",
-			   (ident2 & V3D_IDENT2_BCG_INT) != 0);
-		seq_printf(m, "  Override TMU: %d\n",
-			   (misccfg & V3D_MISCCFG_OVRTMUOUT) != 0);
+		if (v3d->ver <= 42) {
+			seq_printf(m, "  BCG int:      %d\n",
+				   (ident2 & V3D_IDENT2_BCG_INT) != 0);
+		}
+		if (v3d->ver < 40) {
+			seq_printf(m, "  Override TMU: %d\n",
+				   (misccfg & V3D_MISCCFG_OVRTMUOUT) != 0);
+		}
 	}
 
 	return 0;
@@ -212,14 +235,15 @@ static int v3d_measure_clock(struct seq_file *m, void *unused)
 	int measure_ms = 1000;
 
 	if (v3d->ver >= 40) {
+		int cycle_count_reg = V3D_PCTR_CYCLE_COUNT(v3d->ver);
 		V3D_CORE_WRITE(core, V3D_V4_PCTR_0_SRC_0_3,
-			       V3D_SET_FIELD(V3D_PCTR_CYCLE_COUNT,
+			       V3D_SET_FIELD(cycle_count_reg,
 					     V3D_PCTR_S0));
 		V3D_CORE_WRITE(core, V3D_V4_PCTR_0_CLR, 1);
 		V3D_CORE_WRITE(core, V3D_V4_PCTR_0_EN, 1);
 	} else {
 		V3D_CORE_WRITE(core, V3D_V3_PCTR_0_PCTRS0,
-			       V3D_PCTR_CYCLE_COUNT);
+			       V3D_PCTR_CYCLE_COUNT(v3d->ver));
 		V3D_CORE_WRITE(core, V3D_V3_PCTR_0_CLR, 1);
 		V3D_CORE_WRITE(core, V3D_V3_PCTR_0_EN,
 			       V3D_V3_PCTR_0_EN_ENABLE |
drivers/gpu/drm/v3d/v3d_gem.c +2 -2
index 2e94ce788c71..4c2711932b2d 100644
@@ -47,9 +47,9 @@ v3d_init_hw_state(struct v3d_dev *v3d)
 static void
 v3d_idle_axi(struct v3d_dev *v3d, int core)
 {
-	V3D_CORE_WRITE(core, V3D_GMP_CFG, V3D_GMP_CFG_STOP_REQ);
+	V3D_CORE_WRITE(core, V3D_GMP_CFG(v3d->ver), V3D_GMP_CFG_STOP_REQ);
 
-	if (wait_for((V3D_CORE_READ(core, V3D_GMP_STATUS) &
+	if (wait_for((V3D_CORE_READ(core, V3D_GMP_STATUS(v3d->ver)) &
 		      (V3D_GMP_STATUS_RD_COUNT_MASK |
 		       V3D_GMP_STATUS_WR_COUNT_MASK |
 		       V3D_GMP_STATUS_CFG_BUSY)) == 0, 100)) {
drivers/gpu/drm/v3d/v3d_irq.c +26 -20

90 lines not on this page · raw message

drivers/gpu/drm/v3d/v3d_regs.h +54 -40

223 lines not on this page · raw message

drivers/gpu/drm/v3d/v3d_sched.c +21 -17
index 038e1ae589c7..ff893f02698f 100644
@@ -190,20 +190,22 @@ v3d_tfu_job_run(struct drm_sched_job *sched_job)
 
 	trace_v3d_submit_tfu(dev, to_v3d_fence(fence)->seqno);
 
-	V3D_WRITE(V3D_TFU_IIA, job->args.iia);
-	V3D_WRITE(V3D_TFU_IIS, job->args.iis);
-	V3D_WRITE(V3D_TFU_ICA, job->args.ica);
-	V3D_WRITE(V3D_TFU_IUA, job->args.iua);
-	V3D_WRITE(V3D_TFU_IOA, job->args.ioa);
-	V3D_WRITE(V3D_TFU_IOS, job->args.ios);
-	V3D_WRITE(V3D_TFU_COEF0, job->args.coef[0]);
-	if (job->args.coef[0] & V3D_TFU_COEF0_USECOEF) {
-		V3D_WRITE(V3D_TFU_COEF1, job->args.coef[1]);
-		V3D_WRITE(V3D_TFU_COEF2, job->args.coef[2]);
-		V3D_WRITE(V3D_TFU_COEF3, job->args.coef[3]);
+	V3D_WRITE(V3D_TFU_IIA(v3d->ver), job->args.iia);
+	V3D_WRITE(V3D_TFU_IIS(v3d->ver), job->args.iis);
+	V3D_WRITE(V3D_TFU_ICA(v3d->ver), job->args.ica);
+	V3D_WRITE(V3D_TFU_IUA(v3d->ver), job->args.iua);
+	V3D_WRITE(V3D_TFU_IOA(v3d->ver), job->args.ioa);
+	if (v3d->ver >= 71)
+		V3D_WRITE(V3D_V7_TFU_IOC, job->args.v71.ioc);
+	V3D_WRITE(V3D_TFU_IOS(v3d->ver), job->args.ios);
+	V3D_WRITE(V3D_TFU_COEF0(v3d->ver), job->args.coef[0]);
+	if (v3d->ver >= 71 || (job->args.coef[0] & V3D_TFU_COEF0_USECOEF)) {
+		V3D_WRITE(V3D_TFU_COEF1(v3d->ver), job->args.coef[1]);
+		V3D_WRITE(V3D_TFU_COEF2(v3d->ver), job->args.coef[2]);
+		V3D_WRITE(V3D_TFU_COEF3(v3d->ver), job->args.coef[3]);
 	}
 	/* ICFG kicks off the job. */
-	V3D_WRITE(V3D_TFU_ICFG, job->args.icfg | V3D_TFU_ICFG_IOC);
+	V3D_WRITE(V3D_TFU_ICFG(v3d->ver), job->args.icfg | V3D_TFU_ICFG_IOC);
 
 	return fence;
 }
@@ -215,7 +217,7 @@ v3d_csd_job_run(struct drm_sched_job *sched_job)
 	struct v3d_dev *v3d = job->base.v3d;
 	struct drm_device *dev = &v3d->drm;
 	struct dma_fence *fence;
-	int i;
+	int i, csd_cfg0_reg, csd_cfg_reg_count;
 
 	v3d->csd_job = job;
 
@@ -233,10 +235,12 @@ v3d_csd_job_run(struct drm_sched_job *sched_job)
 
 	v3d_switch_perfmon(v3d, &job->base);
 
-	for (i = 1; i <= 6; i++)
-		V3D_CORE_WRITE(0, V3D_CSD_QUEUED_CFG0 + 4 * i, job->args.cfg[i]);
+	csd_cfg0_reg = V3D_CSD_QUEUED_CFG0(v3d->ver);
+	csd_cfg_reg_count = v3d->ver < 71 ? 6 : 7;
+	for (i = 1; i <= csd_cfg_reg_count; i++)
+		V3D_CORE_WRITE(0, csd_cfg0_reg + 4 * i, job->args.cfg[i]);
 	/* CFG0 write kicks off the job. */
-	V3D_CORE_WRITE(0, V3D_CSD_QUEUED_CFG0, job->args.cfg[0]);
+	V3D_CORE_WRITE(0, csd_cfg0_reg, job->args.cfg[0]);
 
 	return fence;
 }
@@ -336,7 +340,7 @@ v3d_csd_job_timedout(struct drm_sched_job *sched_job)
 {
 	struct v3d_csd_job *job = to_csd_job(sched_job);
 	struct v3d_dev *v3d = job->base.v3d;
-	u32 batches = V3D_CORE_READ(0, V3D_CSD_CURRENT_CFG4);
+	u32 batches = V3D_CORE_READ(0, V3D_CSD_CURRENT_CFG4(v3d->ver));
 
 	/* If we've made progress, skip reset and let the timer get
 	 * rearmed.
Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH v2 2/4] drm/v3d: fix up register addresses for V3D 7.x

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 26 lines

This patch updates a number of register addresses that have been changed in Raspberry Pi 5 (V3D 7.1) and updates the code to use the corresponding registers and addresses based on the actual V3D version.

v2:
- added s-o-b and commit message. (Maíra Canal)
- Used macro that takes version as argument and returns appropriate values instead of two different definitions for post-v71 and pre-v71 hardware when possible. (Maíra Canal)
- fixed style warnings from checkpatch.pl. (Maíra Canal)

---
  drivers/gpu/drm/v3d/v3d_debugfs.c | 178 +++++++++++++++++-------------
  drivers/gpu/drm/v3d/v3d_gem.c     |   4 +-
  drivers/gpu/drm/v3d/v3d_irq.c     |  46 ++++----
  drivers/gpu/drm/v3d/v3d_regs.h    |  94 +++++++++-------
  drivers/gpu/drm/v3d/v3d_sched.c   |  38 ++++---
  5 files changed, 204 insertions(+), 156 deletions(-)
drivers/gpu/drm/v3d/v3d_debugfs.c +0 -0
index 330669f51fa7..f843a50d5dce 100644

drivers/gpu/drm/v3d/v3d_debugfs.c line 18

Quoted 8 lines
drivers/gpu/drm/v3d/v3d_debugfs.c +3 -1
@@ -12,69 +12,83 @@
  #include "v3d_drv.h"
  #include "v3d_regs.h"
 
-#define REGDEF(reg) { reg, #reg }
+#define REGDEF(min_ver, max_ver, reg) { min_ver, max_ver, reg, #reg }
  struct v3d_reg_def {
+	u32 min_ver;
+	u32 max_ver;

Is this documented some where which SoC has which V3D version?

author
#4 lore raw

Re: [PATCH v2 2/4] drm/v3d: fix up register addresses for V3D 7.x

Hi Stefan,

Quoted 34 lines · Stefan Wahren

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 31 lines

This patch updates a number of register addresses that have been changed in Raspberry Pi 5 (V3D 7.1) and updates the code to use the corresponding registers and addresses based on the actual V3D version.

v2:
  - added s-o-b and commit message. (Maíra Canal)
  - Used macro that takes version as argument and returns appropriate values instead of two different definitions for post-v71 and pre-v71 hardware when possible. (Maíra Canal)
  - fixed style warnings from checkpatch.pl. (Maíra Canal)

---
  drivers/gpu/drm/v3d/v3d_debugfs.c | 178 +++++++++++++++++--------
-----
  drivers/gpu/drm/v3d/v3d_gem.c     |   4 +- drivers/gpu/drm/v3d/v3d_irq.c     |  46 ++++---- drivers/gpu/drm/v3d/v3d_regs.h    |  94 +++++++++------- drivers/gpu/drm/v3d/v3d_sched.c   |  38 ++++---

  5 files changed, 204 insertions(+), 156 deletions(-)
drivers/gpu/drm/v3d/v3d_debugfs.c +0 -0
index 330669f51fa7..f843a50d5dce 100644
@@ -12,69 +12,83 @@
   #include "v3d_drv.h"
   #include "v3d_regs.h"
 
Quoted 8 lines

drivers/gpu/drm/v3d/v3d_debugfs.c line 18

Quoted 6 lines
drivers/gpu/drm/v3d/v3d_debugfs.c +3 -1
-#define REGDEF(reg) { reg, #reg }
+#define REGDEF(min_ver, max_ver, reg) { min_ver, max_ver, reg,
 #reg }
   struct v3d_reg_def {
+       u32 min_ver;
+       u32 max_ver;

Is this documented some where which SoC has which V3D version?

Not that I am aware of.

There are really only two Raspberry Pi SoCs supported by v3d: bcm2711 is Raspberry Pi 4 which is V3D 4.2 (compatible with 4.1), and bcm2712 is Raspberry Pi 5 which is V3D 7.1.

I don't know what SoCs are supported by versions of V3D before 4.1, I think those were targetting set-top-box hardware that Emma used while setting up the driver before the SoC for Raspberry Pi 4 was available.

Iago

#5 lore raw

Re: [PATCH v2 2/4] drm/v3d: fix up register addresses for V3D 7.x

Hi Iago,

Am 30.10.23 um 11:14 schrieb Iago Toral:

Quoted 45 lines

Hi Stefan,

Quoted 34 lines · Stefan Wahren

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 31 lines

This patch updates a number of register addresses that have been changed in Raspberry Pi 5 (V3D 7.1) and updates the code to use the corresponding registers and addresses based on the actual V3D version.

v2:
  - added s-o-b and commit message. (Maíra Canal)
  - Used macro that takes version as argument and returns appropriate values instead of two different definitions for post-v71 and pre-v71 hardware when possible. (Maíra Canal)
  - fixed style warnings from checkpatch.pl. (Maíra Canal)

---
   drivers/gpu/drm/v3d/v3d_debugfs.c | 178 +++++++++++++++++--------
-----
   drivers/gpu/drm/v3d/v3d_gem.c     |   4 +-
   drivers/gpu/drm/v3d/v3d_irq.c     |  46 ++++----
   drivers/gpu/drm/v3d/v3d_regs.h    |  94 +++++++++-------
   drivers/gpu/drm/v3d/v3d_sched.c   |  38 ++++---
   5 files changed, 204 insertions(+), 156 deletions(-)
drivers/gpu/drm/v3d/v3d_debugfs.c +0 -0
index 330669f51fa7..f843a50d5dce 100644
@@ -12,69 +12,83 @@
   #include "v3d_drv.h"
   #include "v3d_regs.h"
 
Quoted 8 lines

drivers/gpu/drm/v3d/v3d_debugfs.c line 18

Quoted 6 lines
drivers/gpu/drm/v3d/v3d_debugfs.c +3 -1
-#define REGDEF(reg) { reg, #reg }
+#define REGDEF(min_ver, max_ver, reg) { min_ver, max_ver, reg,
 #reg }
   struct v3d_reg_def {
+       u32 min_ver;
+       u32 max_ver;

Is this documented some where which SoC has which V3D version?

Quoted 5 lines

Not that I am aware of.

There are really only two Raspberry Pi SoCs supported by v3d: bcm2711 is Raspberry Pi 4 which is V3D 4.2 (compatible with 4.1), and bcm2712 is Raspberry Pi 5 which is V3D 7.1.

okay, in this case the best source would be Emma's wiki [1]. Maybe these should be added as well to the wiki.

[1] - https://github.com/anholt/linux/wiki/Devices-with-Videocore-graphics

Quoted 6 lines

I don't know what SoCs are supported by versions of V3D before 4.1, I think those were targetting set-top-box hardware that Emma used while setting up the driver before the SoC for Raspberry Pi 4 was available.

Iago

author
#6 lore raw

Re: [PATCH v2 2/4] drm/v3d: fix up register addresses for V3D 7.x

Quoted 52 lines · Stefan Wahren

Hi Iago,

Am 30.10.23 um 11:14 schrieb Iago Toral:

Quoted 49 lines

Hi Stefan,

Quoted 36 lines · Stefan Wahren

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 33 lines

This patch updates a number of register addresses that have been changed in Raspberry Pi 5 (V3D 7.1) and updates the code to use the corresponding registers and addresses based on the actual V3D version.

v2:
   - added s-o-b and commit message. (Maíra Canal)
   - Used macro that takes version as argument and returns appropriate values instead of two different definitions for post-v71 and pre-v71 hardware when possible. (Maíra Canal)
   - fixed style warnings from checkpatch.pl. (Maíra Canal)

---
   drivers/gpu/drm/v3d/v3d_debugfs.c | 178 +++++++++++++++++---
-----
-----
   drivers/gpu/drm/v3d/v3d_gem.c     |   4 +- drivers/gpu/drm/v3d/v3d_irq.c     |  46 ++++---- drivers/gpu/drm/v3d/v3d_regs.h    |  94 +++++++++------- drivers/gpu/drm/v3d/v3d_sched.c   |  38 ++++---

   5 files changed, 204 insertions(+), 156 deletions(-)
drivers/gpu/drm/v3d/v3d_debugfs.c +0 -0
index 330669f51fa7..f843a50d5dce 100644
@@ -12,69 +12,83 @@
    #include "v3d_drv.h"
    #include "v3d_regs.h"
 
Quoted 8 lines

drivers/gpu/drm/v3d/v3d_debugfs.c line 18

Quoted 6 lines
drivers/gpu/drm/v3d/v3d_debugfs.c +3 -1
-#define REGDEF(reg) { reg, #reg }
+#define REGDEF(min_ver, max_ver, reg) { min_ver, max_ver, reg,
 #reg }
    struct v3d_reg_def {
+       u32 min_ver;
+       u32 max_ver;

Is this documented some where which SoC has which V3D version?

Not that I am aware of.

Quoted 8 lines
Quoted 5 lines

There are really only two Raspberry Pi SoCs supported by v3d:
bcm2711
is Raspberry Pi 4 which is V3D 4.2 (compatible with 4.1), and bcm2712
is Raspberry Pi 5 which is V3D 7.1.

okay, in this case the best source would be Emma's wiki [1]. Maybe these
should be added as well to the wiki.

Sure, will do that, thanks!

Iago

Quoted 14 lines

[1] -
https://github.com/anholt/linux/wiki/Devices-with-Videocore-graphics

Quoted 9 lines

I don't know what SoCs are supported by versions of V3D before 4.1, I
think those were targetting set-top-box hardware that Emma used while
setting up the driver before the SoC for Raspberry Pi 4 was available.

Iago

#7 lore raw

PATCH v2 3/4 dt-bindings: gpu: v3d: Add BCM2712's compatible

In reply to Iago Toral Quiroga

BCM2712, Raspberry Pi 5's SoC, contains a V3D core. So add its specific compatible to the bindings.

v2: new, requested by Stefan Wahren.

---
 Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml +1 -0
index dae55b8a267b..dc078ceeca9a 100644
@@ -17,6 +17,7 @@ properties:
   compatible:
     enum:
       - brcm,2711-v3d
+      - brcm,2712-v3d
       - brcm,7268-v3d
       - brcm,7278-v3d
 
Signature · 1 line
2.39.2
#8 lore raw

Re: [PATCH v2 3/4] dt-bindings: gpu: v3d: Add BCM2712's compatible

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 4 lines

BCM2712, Raspberry Pi 5's SoC, contains a V3D core. So add its specific compatible to the bindings.

v2: new, requested by Stefan Wahren.

Thanks for sending this but the line above belongs below --- since it's not relevant after the patch has been applied.

Quoted 2 lines

Unfortunately this patch will be ignored because the relevant devicetree people are missing to give their Ack.

Please use scripts/get_maintainers.pl

Best regards

Quoted 16 lines
---
  Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +
  1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml +1 -0
index dae55b8a267b..dc078ceeca9a 100644
@@ -17,6 +17,7 @@ properties:
    compatible:
      enum:
        - brcm,2711-v3d
+      - brcm,2712-v3d
        - brcm,7268-v3d
        - brcm,7278-v3d
 
author
#9 lore raw

Re: [PATCH v2 3/4] dt-bindings: gpu: v3d: Add BCM2712's compatible

Quoted 12 lines · Stefan Wahren

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 5 lines

BCM2712, Raspberry Pi 5's SoC, contains a V3D core. So add its specific
compatible to the bindings.

v2: new, requested by Stefan Wahren.

Thanks for sending this but the line above belongs below --- since it's
not relevant after the patch has been applied.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Unfortunately this patch will be ignored because the relevant devicetree
people are missing to give their Ack.

Please use scripts/get_maintainers.pl

Sorry about that, my bad, should I resend the patch (as part of a v3) or is it enough to add the relevant maintainers in a reply to the original v2 patch?

Iago

Quoted 20 lines

Best regards

Quoted 17 lines

---
  Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +

  1 file changed, 1 insertion(+)
(quoted diff) +0 -0

v3d.yaml b/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml index dae55b8a267b..dc078ceeca9a 100644

Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml +0 -0
@@ -17,6 +17,7 @@ properties:

    compatible:
      enum:
        - brcm,2711-v3d
+      - brcm,2712-v3d
        - brcm,7268-v3d
        - brcm,7278-v3d

#10 lore raw

Re: [PATCH v2 3/4] dt-bindings: gpu: v3d: Add BCM2712's compatible

Hi Iago,

Am 30.10.23 um 11:18 schrieb Iago Toral:

Quoted 17 lines · Stefan Wahren
Quoted 16 lines

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 5 lines

BCM2712, Raspberry Pi 5's SoC, contains a V3D core. So add its specific
compatible to the bindings.

v2: new, requested by Stefan Wahren.

Thanks for sending this but the line above belongs below --- since it's
not relevant after the patch has been applied.

Quoted 1 line

Unfortunately this patch will be ignored because the relevant devicetree
people are missing to give their Ack.

Quoted 5 lines
Quoted 2 lines

Please use scripts/get_maintainers.pl

Sorry about that, my bad, should I resend the patch (as part of a v3) or is it enough to add the relevant maintainers in a reply to the original v2 patch?

since the merge window for 6.7 is open, please resent as part of v3.

Quoted 22 lines

Iago

Quoted 19 lines

Best regards

Quoted 17 lines
---
   Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml | 1 +
   1 file changed, 1 insertion(+)
(quoted diff) +0 -0

v3d.yaml b/Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml index dae55b8a267b..dc078ceeca9a 100644

Documentation/devicetree/bindings/gpu/brcm,bcm-v3d.yaml +1 -0
@@ -17,6 +17,7 @@ properties:
     compatible:
       enum:
         - brcm,2711-v3d
+      - brcm,2712-v3d
         - brcm,7268-v3d
         - brcm,7278-v3d
 
#11 lore raw

Re: [PATCH v2 3/4] dt-bindings: gpu: v3d: Add BCM2712's compatible

In reply to Iago Toral Quiroga
Quoted 6 lines · Iago Toral Quiroga

BCM2712, Raspberry Pi 5's SoC, contains a V3D core. So add its specific compatible to the bindings.

v2: new, requested by Stefan Wahren.

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.

Please kindly resend and include all necessary To/Cc entries.

Best regards,
Krzysztof

#12 lore raw

PATCH v2 4/4 drm/v3d: add brcm,2712-v3d as a compatible V3D device

In reply to Iago Toral Quiroga

This is required to get the V3D module to load with Raspberry Pi 5.

v2:
- added s-o-b and commit message. (Maíra)
- keep order of compatible strings. (Stefan Wahren)

---
 drivers/gpu/drm/v3d/v3d_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/v3d/v3d_drv.c +1 -0
index ffbbe9d527d3..1ab46bdf8ad7 100644
@@ -187,6 +187,7 @@ static const struct drm_driver v3d_drm_driver = {
 
 static const struct of_device_id v3d_of_match[] = {
 	{ .compatible = "brcm,2711-v3d" },
+	{ .compatible = "brcm,2712-v3d" },
 	{ .compatible = "brcm,7268-v3d" },
 	{ .compatible = "brcm,7278-v3d" },
 	{},
Signature · 1 line
2.39.2
Reviewed-by on v2 4/4
#13 lore raw

Re: [PATCH v2 4/4] drm/v3d: add brcm,2712-v3d as a compatible V3D device

Hi Iago,

Am 30.10.23 um 09:28 schrieb Iago Toral Quiroga:

Quoted 5 lines

This is required to get the V3D module to load with Raspberry Pi 5.

v2:
- added s-o-b and commit message. (Maíra)
- keep order of compatible strings. (Stefan Wahren)

as in the other patch, please move the changelog below --- or in the cover letter.

Except of this:

Quoted 18 lines
---
  drivers/gpu/drm/v3d/v3d_drv.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/v3d/v3d_drv.c +1 -0
index ffbbe9d527d3..1ab46bdf8ad7 100644
@@ -187,6 +187,7 @@ static const struct drm_driver v3d_drm_driver = {
 
  static const struct of_device_id v3d_of_match[] = {
  	{ .compatible = "brcm,2711-v3d" },
+	{ .compatible = "brcm,2712-v3d" },
  	{ .compatible = "brcm,7268-v3d" },
  	{ .compatible = "brcm,7278-v3d" },
  	{},
maintainer Reviewed-by on the v2 series
#14 lore raw
In reply to Iago Toral Quiroga

Hi Iago,

The whole series is:

You can add my r-b in the next version (adding the DTS maintainers in CC).

Best Regards,
- Maíra

Quoted 30 lines · Iago Toral Quiroga

This series includes patches to update the V3D kernel module that drives the VideoCore VI GPU in Raspberry Pi 4 to also support the Video Core VII iteration present in Raspberry Pi 5.

The first patch in the series adds a small uAPI update required for TFU jobs, the second patch addresses the bulk of the work and involves mostly updates to register addresses, the third and fourth patches match the 'brcm,2712-v3d' device string from Pi5 with the V3D driver.

The changes for the user-space driver can be found in the corresponding Mesa MR here:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450

Iago Toral Quiroga (4):
drm/v3d: update UAPI to match user-space for V3D 7.x drm/v3d: fix up register addresses for V3D 7.x
dt-bindings: gpu: v3d: Add BCM2712's compatible drm/v3d: add brcm,2712-v3d as a compatible V3D device

  .../devicetree/bindings/gpu/brcm,bcm-v3d.yaml |   1 +
  drivers/gpu/drm/v3d/v3d_debugfs.c             | 178 ++++++++++--------
  drivers/gpu/drm/v3d/v3d_drv.c                 |   1 +
  drivers/gpu/drm/v3d/v3d_gem.c                 |   4 +-
  drivers/gpu/drm/v3d/v3d_irq.c                 |  46 +++--
  drivers/gpu/drm/v3d/v3d_regs.h                |  94 +++++----
  drivers/gpu/drm/v3d/v3d_sched.c               |  38 ++--
  include/uapi/drm/v3d_drm.h                    |   5 +
  8 files changed, 211 insertions(+), 156 deletions(-)