[PATCH 1/4] drm/amdgpu: Add defines for CSA buffer

Rex Zhu Rex.Zhu at amd.com
Mon Dec 10 05:30:20 UTC 2018


divide the reserve 128k CSA into four parts
1. first 4k for gfx CE/DE metadata
2. next 64K for GDS backup storage
3. next 28K reserved
4. last 32K for SDMA

Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h | 11 +++++++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   |  2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h
index 524b443..cca108e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.h
@@ -25,7 +25,18 @@
 #ifndef AMDGPU_CSA_MANAGER_H
 #define AMDGPU_CSA_MANAGER_H
 
+/* Reserve 128k CSA for MCBP feature
+ * first 4k for gfx CE/DE metadata
+ * next 64K for GDS backup storage.
+ * 28K reserved
+ * last 32K for SDMA
+ */
+
 #define AMDGPU_CSA_SIZE		(128 * 1024)
+#define AMDGPU_CSA_SDMA_OFFSET	(96 * 1024)
+#define AMDGPU_CSA_CE_DE_SIZE	(4 * 1024)
+#define AMDGPU_CSA_GDS_SIZE	(64 * 1024)
+#define AMDGPU_CSA_SDMA_SIZE	(1024)
 
 uint32_t amdgpu_get_total_csa_size(struct amdgpu_device *adev);
 uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index a9c853a..52d6a5f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -7139,7 +7139,7 @@ static void gfx_v8_0_ring_emit_de_meta(struct amdgpu_ring *ring)
 	} de_payload = {};
 
 	csa_addr = amdgpu_csa_vaddr(ring->adev);
-	gds_addr = csa_addr + 4096;
+	gds_addr = csa_addr + AMDGPU_CSA_CE_DE_SIZE;
 	if (ring->adev->virt.chained_ib_support) {
 		de_payload.chained.gds_backup_addrlo = lower_32_bits(gds_addr);
 		de_payload.chained.gds_backup_addrhi = upper_32_bits(gds_addr);
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 7556716..ae47110 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -4263,7 +4263,7 @@ static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring)
 	int cnt;
 
 	csa_addr = amdgpu_csa_vaddr(ring->adev);
-	gds_addr = csa_addr + 4096;
+	gds_addr = csa_addr + AMDGPU_CSA_CE_DE_SIZE;
 	de_payload.gds_backup_addrlo = lower_32_bits(gds_addr);
 	de_payload.gds_backup_addrhi = upper_32_bits(gds_addr);
 
-- 
1.9.1



More information about the amd-gfx mailing list