Skip to contentSkip to conversation

drm/amdgpu: Default disable GDS for compute+gfx

PATCH Superseded Greathouse, Joseph 5 participants 10 messages Jul 19, 2019 – Aug 29, 2019 9 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Default disable GDS for compute+gfx

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks. The driver will handle enabling access on-demand for graphics VMIDs.

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 22 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 21 ++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 21 ++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 21 ++++++++++++++-------
 4 files changed, 57 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +15 -7
index 73dcb632a3ce..615838a55e8f 100644
@@ -1516,17 +1516,24 @@ static void gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	nv_grbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
 	}
 }
 
+
 static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
 {
 	int i, j, k;
@@ -1629,6 +1636,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v10_0_init_compute_vmid(adev);
+	gfx_v10_0_init_gds_vmid(adev);
 
 }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +14 -7
index 3f98624772a4..04e52f7e04ae 100644
@@ -1877,14 +1877,20 @@ static void gfx_v7_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	cik_srbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
 	}
 }
 
@@ -1966,6 +1972,7 @@ static void gfx_v7_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v7_0_init_compute_vmid(adev);
+	gfx_v7_0_init_gds_vmid(adev);
 
 	WREG32(mmSX_DEBUG_1, 0x20);
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +14 -7
index e4028d54f8f7..8dc03df48e04 100644
@@ -3702,14 +3702,20 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	vi_srbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+                WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+                WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+                WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+                WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
 	}
 }
 
@@ -3779,6 +3785,7 @@ static void gfx_v8_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v8_0_init_compute_vmid(adev);
+	gfx_v8_0_init_gds_vmid(adev);
 
 	mutex_lock(&adev->grbm_idx_mutex);
 	/*
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +14 -7
index 259a35395fec..e0f145ffd597 100644
@@ -2025,14 +2025,20 @@ static void gfx_v9_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	soc15_grbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
 	}
 }
 
@@ -2080,6 +2086,7 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v9_0_init_compute_vmid(adev);
+	gfx_v9_0_init_gds_vmid(adev);
 }
 
 static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)
Signature · 6 lines
2.19.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190719234612.8198-1-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 20.07.19 um 01:46 schrieb Greathouse, Joseph:

Quoted 33 lines

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks. The driver will handle enabling access on-demand for graphics VMIDs.

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 22 +++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 21 ++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 21 ++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 21 ++++++++++++++-------
  4 files changed, 57 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -4
index 73dcb632a3ce..615838a55e8f 100644
@@ -1516,17 +1516,24 @@ static void gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	nv_grbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev) · line 1527

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -3
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */

Please double check the coding style here and all other similar locations.

There should be a blank line between declaration and code (or in this case comments). And multi line comments have a specific format.

When you run checkpatch.pl it should complain about that as well.

Apart from that the patch looks good to me,
Christian.

Quoted 133 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -0
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
  	}
  }
 
+
  static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
  {
  	int i, j, k;
@@ -1629,6 +1636,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v10_0_init_compute_vmid(adev);
+	gfx_v10_0_init_gds_vmid(adev);
 
  }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +14 -7
index 3f98624772a4..04e52f7e04ae 100644
@@ -1877,14 +1877,20 @@ static void gfx_v7_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	cik_srbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
  	}
  }
 
@@ -1966,6 +1972,7 @@ static void gfx_v7_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v7_0_init_compute_vmid(adev);
+	gfx_v7_0_init_gds_vmid(adev);
 
  	WREG32(mmSX_DEBUG_1, 0x20);
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +14 -7
index e4028d54f8f7..8dc03df48e04 100644
@@ -3702,14 +3702,20 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	vi_srbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+                WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+                WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+                WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+                WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
  	}
  }
 
@@ -3779,6 +3785,7 @@ static void gfx_v8_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v8_0_init_compute_vmid(adev);
+	gfx_v8_0_init_gds_vmid(adev);
 
  	mutex_lock(&adev->grbm_idx_mutex);
  	/*
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +13 -7
index 259a35395fec..e0f145ffd597 100644
@@ -2025,14 +2025,20 @@ static void gfx_v9_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	soc15_grbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+	/* Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	   acccess. Compute VMIDs should be enabled by FW for target VMIDs,
+	   the driver can enable them for graphics. VMID0 should maintain
+	   access so that HWS firmware can save/restore entries. */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
  	}
  }
 

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_constants_init(struct amdgpu_device *adev) · line 2092

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
@@ -2080,6 +2086,7 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v9_0_init_compute_vmid(adev);
+	gfx_v9_0_init_gds_vmid(adev);
  }
 
  static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 7002f783-2223-a524-2c60-03447377bd28-5C7GfCeVMHo@public.gmane.org

#4 lore raw

PATCH v2 1/1 drm/amdgpu: Default disable GDS for compute+gfx

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks.
The driver will handle enabling access on-demand for graphics VMIDs.

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

v2: Fixed code and comment styling.

Change-Id I3d768a96935d2ed1dff09b02c995090f4fbfa539
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25 ++++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24 +++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24 +++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24 +++++++++++++++++-------
 4 files changed, 69 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +18 -7
index 73dcb632a3ce..2a9692bc34b4 100644
@@ -1516,17 +1516,27 @@ static void gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	nv_grbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
 	}
 }
 
+
 static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
 {
 	int i, j, k;
@@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v10_0_init_compute_vmid(adev);
+	gfx_v10_0_init_gds_vmid(adev);
 
 }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +17 -7
index 3f98624772a4..48796b6824cf 100644
@@ -1877,14 +1877,23 @@ static void gfx_v7_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	cik_srbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
 	}
 }
 
@@ -1966,6 +1975,7 @@ static void gfx_v7_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v7_0_init_compute_vmid(adev);
+	gfx_v7_0_init_gds_vmid(adev);
 
 	WREG32(mmSX_DEBUG_1, 0x20);
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +17 -7
index e4028d54f8f7..d2907186bb24 100644
@@ -3702,14 +3702,23 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	vi_srbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
 	}
 }
 
@@ -3779,6 +3788,7 @@ static void gfx_v8_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v8_0_init_compute_vmid(adev);
+	gfx_v8_0_init_gds_vmid(adev);
 
 	mutex_lock(&adev->grbm_idx_mutex);
 	/*
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +17 -7
index 259a35395fec..bd7f431a24d9 100644
@@ -2025,14 +2025,23 @@ static void gfx_v9_0_init_compute_vmid(struct amdgpu_device *adev)
 	}
 	soc15_grbm_select(adev, 0, 0, 0, 0);
 	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
 	}
 }
 
@@ -2080,6 +2089,7 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 
 	gfx_v9_0_init_compute_vmid(adev);
+	gfx_v9_0_init_gds_vmid(adev);
 }
 
 static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)
Signature · 6 lines
2.19.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190722153350.29339-1-Joseph.Greathouse-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#6 lore raw

Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:

Quoted 7 lines

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks.
The driver will handle enabling access on-demand for graphics VMIDs.

Quoted 7 lines

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

v2: Fixed code and comment styling.

Change-Id I3d768a96935d2ed1dff09b02c995090f4fbfa539
Quoted 176 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25 ++++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24 +++++++++++++++++-------
  4 files changed, 69 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +18 -7
index 73dcb632a3ce..2a9692bc34b4 100644
@@ -1516,17 +1516,27 @@ static void gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	nv_grbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
  	}
  }
 
+
  static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
  {
  	int i, j, k;
@@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v10_0_init_compute_vmid(adev);
+	gfx_v10_0_init_gds_vmid(adev);
 
  }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +17 -7
index 3f98624772a4..48796b6824cf 100644
@@ -1877,14 +1877,23 @@ static void gfx_v7_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	cik_srbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
  	}
  }
 
@@ -1966,6 +1975,7 @@ static void gfx_v7_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v7_0_init_compute_vmid(adev);
+	gfx_v7_0_init_gds_vmid(adev);
 
  	WREG32(mmSX_DEBUG_1, 0x20);
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +17 -7
index e4028d54f8f7..d2907186bb24 100644
@@ -3702,14 +3702,23 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	vi_srbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-		WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-		WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-		WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+		WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
  	}
  }
 
@@ -3779,6 +3788,7 @@ static void gfx_v8_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v8_0_init_compute_vmid(adev);
+	gfx_v8_0_init_gds_vmid(adev);
 
  	mutex_lock(&adev->grbm_idx_mutex);
  	/*
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +16 -7
index 259a35395fec..bd7f431a24d9 100644
@@ -2025,14 +2025,23 @@ static void gfx_v9_0_init_compute_vmid(struct amdgpu_device *adev)
  	}
  	soc15_grbm_select(adev, 0, 0, 0, 0);
  	mutex_unlock(&adev->srbm_mutex);
+}
 
-	/* Initialize all compute VMIDs to have no GDS, GWS, or OA
-	   acccess. These should be enabled by FW for target VMIDs. */
-	for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+	int vmid;
+
+	/*
+	 * Initialize all compute and user-gfx VMIDs to have no GDS, GWS, or OA
+	 * access. Compute VMIDs should be enabled by FW for target VMIDs,
+	 * the driver can enable them for graphics. VMID0 should maintain
+	 * access so that HWS firmware can save/restore entries.
+	 */
+	for (vmid = 1; vmid < 16; vmid++) {
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+		WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
  	}
  }
 

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_constants_init(struct amdgpu_device *adev) · line 2095

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
@@ -2080,6 +2089,7 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
 
  	gfx_v9_0_init_compute_vmid(adev);
+	gfx_v9_0_init_gds_vmid(adev);
  }
 
  static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c4856ea0-3cd3-1628-54e9-9660be334054-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#8 lore raw
Quoted 7 lines · Christian König

Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:

Quoted 6 lines

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks.
The driver will handle enabling access on-demand for graphics VMIDs.

gds_switch is depending on job->gds/gws/oa/_base/size.

"[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation", the default allocations in kernel were removed. If some UMD stacks don't pass gds/gws/oa allocation to bo_list, then kernel will not enable access of them, that will break previous driver.

do we need revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation" ?

-David

Quoted 182 lines
Quoted 8 lines

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

v2: Fixed code and comment styling.

Change-Id I3d768a96935d2ed1dff09b02c995090f4fbfa539
Quoted 171 lines

---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25 ++++++++++++++++++-------

  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24 +++++++++++++++++-------
  4 files changed, 69 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -0
index 73dcb632a3ce..2a9692bc34b4 100644
@@ -1516,17 +1516,27 @@ static void 
 gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
       }
       nv_grbm_select(adev, 0, 0, 0, 0);
       mutex_unlock(&adev->srbm_mutex);
+}

  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA -       acccess. These should be enabled by FW for target VMIDs. */ -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) { -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0); -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0); -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0); -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +6 -0
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS, 

GWS, or OA
+     * access. Compute VMIDs should be enabled by FW for target VMIDs, +     * the driver can enable them for graphics. VMID0 should maintain +     * access so that HWS firmware can save/restore entries. +     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0); +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0); +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0); +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0); }
  }
  +
  static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev) {
      int i, j, k;

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -0
@@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct 
 amdgpu_device *adev)
       mutex_unlock(&adev->srbm_mutex);
         gfx_v10_0_init_compute_vmid(adev);
+    gfx_v10_0_init_gds_vmid(adev);
     }

  diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 3f98624772a4..48796b6824cf 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -0
@@ -1877,14 +1877,23 @@ static void gfx_v7_0_init_compute_vmid(struct 
 amdgpu_device *adev)
       }
       cik_srbm_select(adev, 0, 0, 0, 0);
       mutex_unlock(&adev->srbm_mutex);
+}

  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA -       acccess. These should be enabled by FW for target VMIDs. */ -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) { -        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-        WREG32(amdgpu_gds_reg_offset[i].oa, 0);

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS, 

GWS, or OA
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
      }
  }
  @@ -1966,6 +1975,7 @@ static void gfx_v7_0_constants_init(struct amdgpu_device *adev) mutex_unlock(&adev->srbm_mutex);
        gfx_v7_0_init_compute_vmid(adev);
+    gfx_v7_0_init_gds_vmid(adev);
        WREG32(mmSX_DEBUG_1, 0x20);
  diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index e4028d54f8f7..d2907186bb24 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
@@ -3702,14 +3702,23 @@ static void gfx_v8_0_init_compute_vmid(struct 
 amdgpu_device *adev)
       }
       vi_srbm_select(adev, 0, 0, 0, 0);
       mutex_unlock(&adev->srbm_mutex);
+}

  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA -       acccess. These should be enabled by FW for target VMIDs. */ -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) { -        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-        WREG32(amdgpu_gds_reg_offset[i].oa, 0);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS, 

GWS, or OA
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
      }
  }
  @@ -3779,6 +3788,7 @@ static void gfx_v8_0_constants_init(struct amdgpu_device *adev) mutex_unlock(&adev->srbm_mutex);
        gfx_v8_0_init_compute_vmid(adev);
+    gfx_v8_0_init_gds_vmid(adev);
        mutex_lock(&adev->grbm_idx_mutex);
      /*

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
index 259a35395fec..bd7f431a24d9 100644
@@ -2025,14 +2025,23 @@ static void gfx_v9_0_init_compute_vmid(struct 
 amdgpu_device *adev)
       }
       soc15_grbm_select(adev, 0, 0, 0, 0);
       mutex_unlock(&adev->srbm_mutex);
+}

  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA -       acccess. These should be enabled by FW for target VMIDs. */ -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) { -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0); -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0); -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0); -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -0
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS, 

GWS, or OA
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
      }
  }
  @@ -2080,6 +2089,7 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev) mutex_unlock(&adev->srbm_mutex);
        gfx_v9_0_init_compute_vmid(adev);

Quoted 8 lines
Quoted 3 lines

+    gfx_v9_0_init_gds_vmid(adev);
  }
    static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 36885047-8915-fb90-fcaa-04f98b4519b1-5C7GfCeVMHo@public.gmane.org

#10 lore raw

It can't break an older driver, because there is no older driver that requires the static allocation.

Note that closed source drivers don't count, because they don't need backward compatibility.

Marek

Quoted 219 lines · On Wed, Aug 28, 2019 at 2:44 AM zhoucm1 <[email protected]>…
Quoted 7 lines · Christian König

Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:

Quoted 6 lines

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks.
The driver will handle enabling access on-demand for graphics VMIDs.

gds_switch is depending on job->gds/gws/oa/_base/size.

"[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation", the default allocations in kernel were removed. If some UMD stacks don't pass gds/gws/oa allocation to bo_list, then kernel will not enable access of them, that will break previous driver.

do we need revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation" ?

-David

Quoted 189 lines
Quoted 8 lines

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

v2: Fixed code and comment styling.

Change-Id I3d768a96935d2ed1dff09b02c995090f4fbfa539
Quoted 178 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25 ++++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24 +++++++++++++++++-------
  4 files changed, 69 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -6
index 73dcb632a3ce..2a9692bc34b4 100644
@@ -1516,17 +1516,27 @@ static void
 gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
      }
      nv_grbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
      }
  }
  +
  static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
  {
      int i, j, k;
@@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct
 amdgpu_device *adev)
      mutex_unlock(&adev->srbm_mutex);
        gfx_v10_0_init_compute_vmid(adev);
+    gfx_v10_0_init_gds_vmid(adev);
    }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 3f98624772a4..48796b6824cf 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +7 -6
@@ -1877,14 +1877,23 @@ static void gfx_v7_0_init_compute_vmid(struct
 amdgpu_device *adev)
      }
      cik_srbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +9 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
      }
  }
  @@ -1966,6 +1975,7 @@ static void gfx_v7_0_constants_init(struct

amdgpu_device *adev)

      mutex_unlock(&adev->srbm_mutex);
        gfx_v7_0_init_compute_vmid(adev);
+    gfx_v7_0_init_gds_vmid(adev);
        WREG32(mmSX_DEBUG_1, 0x20);

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index e4028d54f8f7..d2907186bb24 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -6
@@ -3702,14 +3702,23 @@ static void gfx_v8_0_init_compute_vmid(struct
 amdgpu_device *adev)
      }
      vi_srbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +9 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
      }
  }
  @@ -3779,6 +3788,7 @@ static void gfx_v8_0_constants_init(struct

amdgpu_device *adev)

      mutex_unlock(&adev->srbm_mutex);
        gfx_v8_0_init_compute_vmid(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+    gfx_v8_0_init_gds_vmid(adev);
        mutex_lock(&adev->grbm_idx_mutex);
      /*
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -6
index 259a35395fec..bd7f431a24d9 100644
@@ -2025,14 +2025,23 @@ static void gfx_v9_0_init_compute_vmid(struct
 amdgpu_device *adev)
      }
      soc15_grbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
      }
  }
  @@ -2080,6 +2089,7 @@ static void gfx_v9_0_constants_init(struct

amdgpu_device *adev)

      mutex_unlock(&adev->srbm_mutex);
        gfx_v9_0_init_compute_vmid(adev);
Quoted 8 lines
Quoted 3 lines

+ gfx_v9_0_init_gds_vmid(adev);
}
static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CAAxE2A5MgKswdeHg1YrDs_G7hCuoZAVFuPyoHoA+DbUjA32eHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#12 lore raw
Quoted 3 lines · Marek Olšák

It can't break an older driver, because there is no older driver that requires the static allocation.

Note that closed source drivers don't count, because they don't need backward compatibility.

Yes, I agree, we don't need take care of closed source stack.

But AMDVLK is indeed an open source stack, many fans are using it, we need keep its compatibility, don't we?

-David

Quoted 241 lines

Marek

On Wed, Aug 28, 2019 at 2:44 AM zhoucm1 <[email protected] <mailto:[email protected]>> wrote:

    On 2019/7/23 上午3:08, Christian König wrote:
    > Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:
    >> Units in the GDS block default to allowing all VMIDs access to all
    >> entries. Disable shader access to the GDS, GWS, and OA blocks
    from all
    >> compute and gfx VMIDs by default. For compute, HWS firmware
    will set
    >> up the access bits for the appropriate VMID when a compute queue
    >> requires access to these blocks.
    >> The driver will handle enabling access on-demand for graphics
    VMIDs.

    gds_switch is depending on job->gds/gws/oa/_base/size.

    "[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation", the
    default allocations in kernel were removed. If some UMD stacks don't
    pass gds/gws/oa allocation to bo_list, then kernel will not enable
    access of them, that will break previous driver.

    do we need revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA
    allocation" ?

    -David

    >>
    >> Leaving VMID0 with full access because otherwise HWS cannot save or
    >> restore values during task switch.
    >>
    >> v2: Fixed code and comment styling.
    >>
    >> Change-Id: I3d768a96935d2ed1dff09b02c995090f4fbfa539
    >> Signed-off-by: Joseph Greathouse <[email protected]
    <mailto:[email protected]>>
    >
    > Reviewed-by: Christian König <[email protected]
    <mailto:[email protected]>>
    >
    >> ---
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25
    ++++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24
    +++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24
    +++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24
    +++++++++++++++++-------
    >>   4 files changed, 69 insertions(+), 28 deletions(-)
    >>
    >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> index 73dcb632a3ce..2a9692bc34b4 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> @@ -1516,17 +1516,27 @@ static void
    >> gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
    >>       }
    >>       nv_grbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
    >> +static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
    >>       }
    >>   }
    >>   +
    >>   static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
    >>   {
    >>       int i, j, k;
    >> @@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v10_0_init_compute_vmid(adev);
    >> +    gfx_v10_0_init_gds_vmid(adev);
    >>     }
    >>   diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> index 3f98624772a4..48796b6824cf 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> @@ -1877,14 +1877,23 @@ static void
    gfx_v7_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       cik_srbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
    >> +static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
    >>       }
    >>   }
    >>   @@ -1966,6 +1975,7 @@ static void gfx_v7_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v7_0_init_compute_vmid(adev);
    >> +    gfx_v7_0_init_gds_vmid(adev);
    >>         WREG32(mmSX_DEBUG_1, 0x20);
    >>   diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> index e4028d54f8f7..d2907186bb24 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> @@ -3702,14 +3702,23 @@ static void
    gfx_v8_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       vi_srbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
    >> +static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
    >>       }
    >>   }
    >>   @@ -3779,6 +3788,7 @@ static void gfx_v8_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v8_0_init_compute_vmid(adev);
    >> +    gfx_v8_0_init_gds_vmid(adev);
    >>         mutex_lock(&adev->grbm_idx_mutex);
    >>       /*
    >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> index 259a35395fec..bd7f431a24d9 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> @@ -2025,14 +2025,23 @@ static void
    gfx_v9_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       soc15_grbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
    >> +static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
    >>       }
    >>   }
    >>   @@ -2080,6 +2089,7 @@ static void gfx_v9_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v9_0_init_compute_vmid(adev);
    >> +    gfx_v9_0_init_gds_vmid(adev);
    >>   }
    >>     static void gfx_v9_0_wait_for_rlc_serdes(struct
    amdgpu_device *adev)
    >
Quoted 9 lines
    > _______________________________________________
    > amd-gfx mailing list
    > [email protected] <mailto:[email protected]>
    > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
    _______________________________________________
    amd-gfx mailing list
    [email protected] <mailto:[email protected]>
    https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): bdb61ac5-e1ab-725c-56cf-475d7b41ebc2-5C7GfCeVMHo@public.gmane.org

#14 lore raw

Am 29.08.19 um 07:55 schrieb zhoucm1:

Quoted 11 lines · Marek Olšák
Quoted 3 lines

It can't break an older driver, because there is no older driver that requires the static allocation.

Note that closed source drivers don't count, because they don't need backward compatibility.

Yes, I agree, we don't need take care of closed source stack.

But AMDVLK is indeed an open source stack, many fans are using it, we need keep its compatibility, don't we?

Actually that is still under discussion.

But AMDVLK should have never ever used the static GDS space in the first place. We only added that for a transition time for old OpenGL and it shouldn't have leaked into the upstream driver.

Not sure what's the best approach here. We could revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA", but that would break KFD. So we can only choose between two evils here.

Only alternative I can see which would work for both would be to still allocate the static GDS, GWS and OA space, but make it somehow dynamic so that the KFD can swap it out again.

Christian.

Quoted 266 lines

-David

Quoted 254 lines

Marek

On Wed, Aug 28, 2019 at 2:44 AM zhoucm1 <[email protected] <mailto:[email protected]>> wrote:

    On 2019/7/23 上午3:08, Christian König wrote:
    > Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:
    >> Units in the GDS block default to allowing all VMIDs access to all
    >> entries. Disable shader access to the GDS, GWS, and OA blocks
    from all
    >> compute and gfx VMIDs by default. For compute, HWS firmware
    will set
    >> up the access bits for the appropriate VMID when a compute queue
    >> requires access to these blocks.
    >> The driver will handle enabling access on-demand for graphics
    VMIDs.

    gds_switch is depending on job->gds/gws/oa/_base/size.

    "[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation", the
    default allocations in kernel were removed. If some UMD stacks don't
    pass gds/gws/oa allocation to bo_list, then kernel will not enable
    access of them, that will break previous driver.

    do we need revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA
    allocation" ?

    -David

    >>
    >> Leaving VMID0 with full access because otherwise HWS cannot
    save or
    >> restore values during task switch.
    >>
    >> v2: Fixed code and comment styling.
    >>
    >> Change-Id: I3d768a96935d2ed1dff09b02c995090f4fbfa539
    >> Signed-off-by: Joseph Greathouse <[email protected]
    <mailto:[email protected]>>
    >
    > Reviewed-by: Christian König <[email protected]
    <mailto:[email protected]>>
    >
    >> ---
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25
    ++++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24
    +++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24
    +++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24
    +++++++++++++++++-------
    >>   4 files changed, 69 insertions(+), 28 deletions(-)
    >>
    >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> index 73dcb632a3ce..2a9692bc34b4 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> @@ -1516,17 +1516,27 @@ static void
    >> gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
    >>       }
    >>       nv_grbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
    >> +static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
    >>       }
    >>   }
    >>   +
    >>   static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
    >>   {
    >>       int i, j, k;
    >> @@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v10_0_init_compute_vmid(adev);
    >> +    gfx_v10_0_init_gds_vmid(adev);
    >>     }
    >>   diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> index 3f98624772a4..48796b6824cf 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> @@ -1877,14 +1877,23 @@ static void
    gfx_v7_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       cik_srbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
    >> +static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
    >>       }
    >>   }
    >>   @@ -1966,6 +1975,7 @@ static void
    gfx_v7_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v7_0_init_compute_vmid(adev);
    >> +    gfx_v7_0_init_gds_vmid(adev);
    >>         WREG32(mmSX_DEBUG_1, 0x20);
    >>   diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> index e4028d54f8f7..d2907186bb24 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> @@ -3702,14 +3702,23 @@ static void
    gfx_v8_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       vi_srbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
    >> +static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
    >>       }
    >>   }
    >>   @@ -3779,6 +3788,7 @@ static void
    gfx_v8_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v8_0_init_compute_vmid(adev);
    >> +    gfx_v8_0_init_gds_vmid(adev);
    >>         mutex_lock(&adev->grbm_idx_mutex);
    >>       /*
    >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> index 259a35395fec..bd7f431a24d9 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> @@ -2025,14 +2025,23 @@ static void
    gfx_v9_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       soc15_grbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
    >> +static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
    >>       }
    >>   }
    >>   @@ -2080,6 +2089,7 @@ static void
    gfx_v9_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v9_0_init_compute_vmid(adev);
    >> +    gfx_v9_0_init_gds_vmid(adev);
    >>   }
    >>     static void gfx_v9_0_wait_for_rlc_serdes(struct
    amdgpu_device *adev)
    >
    > _______________________________________________
Quoted 9 lines
    > amd-gfx mailing list
    > [email protected]
    <mailto:[email protected]>
    > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
    _______________________________________________
    amd-gfx mailing list
    [email protected] <mailto:[email protected]>
    https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 293feae7-bda5-d8af-2dca-6f2025dc3fba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#16 lore raw
Quoted 13 lines · Christian König

Am 29.08.19 um 07:55 schrieb zhoucm1:

Quoted 11 lines · Marek Olšák
Quoted 3 lines

It can't break an older driver, because there is no older driver that requires the static allocation.

Note that closed source drivers don't count, because they don't need backward compatibility.

Yes, I agree, we don't need take care of closed source stack.

But AMDVLK is indeed an open source stack, many fans are using it, we need keep its compatibility, don't we?

Quoted 7 lines

Actually that is still under discussion.

But AMDVLK should have never ever used the static GDS space in the first place. We only added that for a transition time for old OpenGL and it shouldn't have leaked into the upstream driver.

Not sure what's the best approach here. We could revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA", but that would break KFD. So we can only choose between two evils here.

Only alternative I can see which would work for both would be to still allocate the static GDS, GWS and OA space, but make it somehow dynamic so that the KFD can swap it out again.

Agree with you.

-David

Quoted 282 lines

Christian.

Quoted 278 lines

-David

Quoted 262 lines

Marek

On Wed, Aug 28, 2019 at 2:44 AM zhoucm1 <[email protected] <mailto:[email protected]>> wrote:

    On 2019/7/23 上午3:08, Christian König wrote:
    > Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:
    >> Units in the GDS block default to allowing all VMIDs access
    to all
    >> entries. Disable shader access to the GDS, GWS, and OA blocks
    from all
    >> compute and gfx VMIDs by default. For compute, HWS firmware
    will set
    >> up the access bits for the appropriate VMID when a compute queue
    >> requires access to these blocks.
    >> The driver will handle enabling access on-demand for graphics
    VMIDs.

    gds_switch is depending on job->gds/gws/oa/_base/size.

    "[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation", the
    default allocations in kernel were removed. If some UMD stacks
    don't
    pass gds/gws/oa allocation to bo_list, then kernel will not enable
    access of them, that will break previous driver.

    do we need revert "[PATCH] drm/amdgpu: remove static GDS, GWS
    and OA
    allocation" ?

    -David

    >>
    >> Leaving VMID0 with full access because otherwise HWS cannot
    save or
    >> restore values during task switch.
    >>
    >> v2: Fixed code and comment styling.
    >>
    >> Change-Id: I3d768a96935d2ed1dff09b02c995090f4fbfa539
    >> Signed-off-by: Joseph Greathouse <[email protected]
    <mailto:[email protected]>>
    >
    > Reviewed-by: Christian König <[email protected]
    <mailto:[email protected]>>
    >
    >> ---
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25
    ++++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24
    +++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24
    +++++++++++++++++-------
    >>   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24
    +++++++++++++++++-------
    >>   4 files changed, 69 insertions(+), 28 deletions(-)
    >>
    >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> index 73dcb632a3ce..2a9692bc34b4 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
    >> @@ -1516,17 +1516,27 @@ static void
    >> gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
    >>       }
    >>       nv_grbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
    >> +static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no
    GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
    >>       }
    >>   }
    >>   +
    >>   static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
    >>   {
    >>       int i, j, k;
    >> @@ -1629,6 +1639,7 @@ static void
    gfx_v10_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v10_0_init_compute_vmid(adev);
    >> +    gfx_v10_0_init_gds_vmid(adev);
    >>     }
    >>   diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> index 3f98624772a4..48796b6824cf 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
    >> @@ -1877,14 +1877,23 @@ static void
    gfx_v7_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       cik_srbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> - WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
    >> - WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
    >> +static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no
    GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
    >>       }
    >>   }
    >>   @@ -1966,6 +1975,7 @@ static void
    gfx_v7_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v7_0_init_compute_vmid(adev);
    >> +    gfx_v7_0_init_gds_vmid(adev);
    >>         WREG32(mmSX_DEBUG_1, 0x20);
    >>   diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> index e4028d54f8f7..d2907186bb24 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
    >> @@ -3702,14 +3702,23 @@ static void
    gfx_v8_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       vi_srbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> - WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
    >> - WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
    >> -        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
    >> +static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no
    GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
    >> + WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
    >> +        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
    >>       }
    >>   }
    >>   @@ -3779,6 +3788,7 @@ static void
    gfx_v8_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v8_0_init_compute_vmid(adev);
    >> +    gfx_v8_0_init_gds_vmid(adev);
    >>         mutex_lock(&adev->grbm_idx_mutex);
    >>       /*
    >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> index 259a35395fec..bd7f431a24d9 100644
    >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
    >> @@ -2025,14 +2025,23 @@ static void
    gfx_v9_0_init_compute_vmid(struct
    >> amdgpu_device *adev)
    >>       }
    >>       soc15_grbm_select(adev, 0, 0, 0, 0);
    >>       mutex_unlock(&adev->srbm_mutex);
    >> +}
    >>   -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
    >> -       acccess. These should be enabled by FW for target
    VMIDs. */
    >> -    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
    >> -        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
    >> +static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
    >> +{
    >> +    int vmid;
    >> +
    >> +    /*
    >> +     * Initialize all compute and user-gfx VMIDs to have no
    GDS,
    >> GWS, or OA
    >> +     * access. Compute VMIDs should be enabled by FW for
    target VMIDs,
    >> +     * the driver can enable them for graphics. VMID0 should
    maintain
    >> +     * access so that HWS firmware can save/restore entries.
    >> +     */
    >> +    for (vmid = 1; vmid < 16; vmid++) {
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 *
    vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
    >> +        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
    >>       }
    >>   }
    >>   @@ -2080,6 +2089,7 @@ static void
    gfx_v9_0_constants_init(struct
    >> amdgpu_device *adev)
    >>       mutex_unlock(&adev->srbm_mutex);
    >>         gfx_v9_0_init_compute_vmid(adev);
    >> +    gfx_v9_0_init_gds_vmid(adev);
    >>   }
    >>     static void gfx_v9_0_wait_for_rlc_serdes(struct
    amdgpu_device *adev)
    >
    > _______________________________________________
Quoted 9 lines
    > amd-gfx mailing list
    > [email protected]
    <mailto:[email protected]>
    > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
    _______________________________________________
    amd-gfx mailing list
    [email protected] <mailto:[email protected]>
    https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 148e2050-558c-eee6-bb74-3f7f9a341f98-5C7GfCeVMHo@public.gmane.org

#18 lore raw

If you decide to add it back, use this instead, it's simpler:
https://patchwork.freedesktop.org/patch/318391/?series=63775&rev=1

Maybe remove OA reservation if you don't need it.

Marek

Quoted 268 lines · On Thu, Aug 29, 2019 at 5:06 AM zhoucm1 <[email protected]>…

On 2019/8/29 下午3:22, Christian König wrote:

Am 29.08.19 um 07:55 schrieb zhoucm1:

On 2019/8/29 上午1:08, Marek Olšák wrote:

It can't break an older driver, because there is no older driver that requires the static allocation.

Note that closed source drivers don't count, because they don't need backward compatibility.

Yes, I agree, we don't need take care of closed source stack.

But AMDVLK is indeed an open source stack, many fans are using it, we need keep its compatibility, don't we?

Actually that is still under discussion.

But AMDVLK should have never ever used the static GDS space in the first place. We only added that for a transition time for old OpenGL and it shouldn't have leaked into the upstream driver.

Not sure what's the best approach here. We could revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA", but that would break KFD. So we can only choose between two evils here.

Only alternative I can see which would work for both would be to still allocate the static GDS, GWS and OA space, but make it somehow dynamic so that the KFD can swap it out again.

Agree with you.

-David

Christian.

-David

Marek

Quoted 220 lines · On Wed, Aug 28, 2019 at 2:44 AM zhoucm1 <[email protected]>…
Quoted 7 lines · Christian König

Am 22.07.19 um 17:34 schrieb Greathouse, Joseph:

Quoted 6 lines

Units in the GDS block default to allowing all VMIDs access to all entries. Disable shader access to the GDS, GWS, and OA blocks from all compute and gfx VMIDs by default. For compute, HWS firmware will set up the access bits for the appropriate VMID when a compute queue requires access to these blocks.
The driver will handle enabling access on-demand for graphics VMIDs.

gds_switch is depending on job->gds/gws/oa/_base/size.

"[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation", the default allocations in kernel were removed. If some UMD stacks don't pass gds/gws/oa allocation to bo_list, then kernel will not enable access of them, that will break previous driver.

do we need revert "[PATCH] drm/amdgpu: remove static GDS, GWS and OA allocation" ?

-David

Quoted 184 lines
Quoted 8 lines

Leaving VMID0 with full access because otherwise HWS cannot save or restore values during task switch.

v2: Fixed code and comment styling.

Change-Id I3d768a96935d2ed1dff09b02c995090f4fbfa539
Quoted 173 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 25 ++++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 24 +++++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 24 +++++++++++++++++-------
  4 files changed, 69 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +7 -6
index 73dcb632a3ce..2a9692bc34b4 100644
@@ -1516,17 +1516,27 @@ static void
 gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
      }
      nv_grbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v10_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
      }
  }
  +
  static void gfx_v10_0_tcp_harvest(struct amdgpu_device *adev)
  {
      int i, j, k;
@@ -1629,6 +1639,7 @@ static void gfx_v10_0_constants_init(struct
 amdgpu_device *adev)
      mutex_unlock(&adev->srbm_mutex);
        gfx_v10_0_init_compute_vmid(adev);
+    gfx_v10_0_init_gds_vmid(adev);
    }
  diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 3f98624772a4..48796b6824cf 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +7 -6
@@ -1877,14 +1877,23 @@ static void gfx_v7_0_init_compute_vmid(struct
 amdgpu_device *adev)
      }
      cik_srbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +9 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
      }
  }
  @@ -1966,6 +1975,7 @@ static void gfx_v7_0_constants_init(struct

amdgpu_device *adev)

      mutex_unlock(&adev->srbm_mutex);
        gfx_v7_0_init_compute_vmid(adev);
+    gfx_v7_0_init_gds_vmid(adev);
        WREG32(mmSX_DEBUG_1, 0x20);

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index e4028d54f8f7..d2907186bb24 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -6
@@ -3702,14 +3702,23 @@ static void gfx_v8_0_init_compute_vmid(struct
 amdgpu_device *adev)
      }
      vi_srbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32(amdgpu_gds_reg_offset[i].mem_base, 0);
-        WREG32(amdgpu_gds_reg_offset[i].mem_size, 0);
-        WREG32(amdgpu_gds_reg_offset[i].gws, 0);
-        WREG32(amdgpu_gds_reg_offset[i].oa, 0);
+static void gfx_v8_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +9 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_base, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].mem_size, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].gws, 0);
+        WREG32(amdgpu_gds_reg_offset[vmid].oa, 0);
      }
  }
  @@ -3779,6 +3788,7 @@ static void gfx_v8_0_constants_init(struct

amdgpu_device *adev)

      mutex_unlock(&adev->srbm_mutex);
        gfx_v8_0_init_compute_vmid(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+    gfx_v8_0_init_gds_vmid(adev);
        mutex_lock(&adev->grbm_idx_mutex);
      /*
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +7 -6
index 259a35395fec..bd7f431a24d9 100644
@@ -2025,14 +2025,23 @@ static void gfx_v9_0_init_compute_vmid(struct
 amdgpu_device *adev)
      }
      soc15_grbm_select(adev, 0, 0, 0, 0);
      mutex_unlock(&adev->srbm_mutex);
+}
  -    /* Initialize all compute VMIDs to have no GDS, GWS, or OA
-       acccess. These should be enabled by FW for target VMIDs. */
-    for (i = FIRST_COMPUTE_VMID; i < LAST_COMPUTE_VMID; i++) {
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, i, 0);
-        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, i, 0);
+static void gfx_v9_0_init_gds_vmid(struct amdgpu_device *adev)
+{
+    int vmid;
+
+    /*
+     * Initialize all compute and user-gfx VMIDs to have no GDS,

GWS, or OA

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -0
+     * access. Compute VMIDs should be enabled by FW for target VMIDs,
+     * the driver can enable them for graphics. VMID0 should maintain
+     * access so that HWS firmware can save/restore entries.
+     */
+    for (vmid = 1; vmid < 16; vmid++) {
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_GWS_VMID0, vmid, 0);
+        WREG32_SOC15_OFFSET(GC, 0, mmGDS_OA_VMID0, vmid, 0);
      }
Quoted 8 lines
Quoted 8 lines

}
@@ -2080,6 +2089,7 @@ static void gfx_v9_0_constants_init(struct
amdgpu_device *adev)

      mutex_unlock(&adev->srbm_mutex);
        gfx_v9_0_init_compute_vmid(adev);

+ gfx_v9_0_init_gds_vmid(adev);
}
static void gfx_v9_0_wait_for_rlc_serdes(struct amdgpu_device

*adev)

Quoted 5 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 11 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing listamd-gfx-PD4FTy7X32lNgt0PjOBp934avgP/[email protected]://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx