[PATCH 09/11] drm/amdgpu: move amdgpu_sysvm_location into amdgpu_sysvm.c as well

Christian König deathsimple at vodafone.de
Mon Jul 3 09:44:34 UTC 2017


From: Christian König <christian.koenig at amd.com>

No intended functional change.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 36 ----------------------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.c  | 38 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.h  |  2 ++
 4 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index a2c0eac..1ed6b7a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1862,7 +1862,6 @@ bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm);
 uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,
 				 struct ttm_mem_reg *mem);
 void amdgpu_vram_location(struct amdgpu_device *adev, struct amdgpu_mc *mc, u64 base);
-void amdgpu_sysvm_location(struct amdgpu_device *adev, struct amdgpu_mc *mc);
 void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size);
 int amdgpu_ttm_init(struct amdgpu_device *adev);
 void amdgpu_ttm_fini(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 46a82d3..228b262 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -666,42 +666,6 @@ void amdgpu_vram_location(struct amdgpu_device *adev, struct amdgpu_mc *mc, u64
 			mc->vram_end, mc->real_vram_size >> 20);
 }
 
-/**
- * amdgpu_sysvm_location - try to find SYSVM location
- * @adev: amdgpu device structure holding all necessary informations
- * @mc: memory controller structure holding memory informations
- *
- * Function will place try to place SYSVM before or after VRAM.
- *
- * If SYSVM size is bigger than space left then we ajust SYSVM size.
- * Thus function will never fails.
- *
- * FIXME: when reducing SYSVM size align new size on power of 2.
- */
-void amdgpu_sysvm_location(struct amdgpu_device *adev, struct amdgpu_mc *mc)
-{
-	u64 size_af, size_bf;
-
-	size_af = ((adev->mc.mc_mask - mc->vram_end) + mc->sysvm_base_align) & ~mc->sysvm_base_align;
-	size_bf = mc->vram_start & ~mc->sysvm_base_align;
-	if (size_bf > size_af) {
-		if (mc->sysvm_size > size_bf) {
-			dev_warn(adev->dev, "limiting SYSVM\n");
-			mc->sysvm_size = size_bf;
-		}
-		mc->sysvm_start = 0;
-	} else {
-		if (mc->sysvm_size > size_af) {
-			dev_warn(adev->dev, "limiting SYSVM\n");
-			mc->sysvm_size = size_af;
-		}
-		mc->sysvm_start = (mc->vram_end + 1 + mc->sysvm_base_align) & ~mc->sysvm_base_align;
-	}
-	mc->sysvm_end = mc->sysvm_start + mc->sysvm_size - 1;
-	dev_info(adev->dev, "SYSVM: %lluM 0x%016llX - 0x%016llX\n",
-			mc->sysvm_size >> 20, mc->sysvm_start, mc->sysvm_end);
-}
-
 /*
  * GPU helpers function.
  */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.c
index 50fc8d7..ff436ad 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.c
@@ -73,6 +73,44 @@ void amdgpu_sysvm_set_defaults(struct amdgpu_device *adev)
 }
 
 /**
+ * amdgpu_sysvm_location - try to find SYSVM location
+ * @adev: amdgpu device structure holding all necessary informations
+ * @mc: memory controller structure holding memory informations
+ *
+ * Function will place try to place SYSVM before or after VRAM.
+ *
+ * If SYSVM size is bigger than space left then we ajust SYSVM size.
+ * Thus function will never fails.
+ *
+ * FIXME: when reducing SYSVM size align new size on power of 2.
+ */
+void amdgpu_sysvm_location(struct amdgpu_device *adev, struct amdgpu_mc *mc)
+{
+	u64 size_af, size_bf;
+
+	size_af = ((adev->mc.mc_mask - mc->vram_end) + mc->sysvm_base_align) &
+		~mc->sysvm_base_align;
+	size_bf = mc->vram_start & ~mc->sysvm_base_align;
+	if (size_bf > size_af) {
+		if (mc->sysvm_size > size_bf) {
+			dev_warn(adev->dev, "limiting SYSVM\n");
+			mc->sysvm_size = size_bf;
+		}
+		mc->sysvm_start = 0;
+	} else {
+		if (mc->sysvm_size > size_af) {
+			dev_warn(adev->dev, "limiting SYSVM\n");
+			mc->sysvm_size = size_af;
+		}
+		mc->sysvm_start = (mc->vram_end + 1 + mc->sysvm_base_align) &
+			~mc->sysvm_base_align;
+	}
+	mc->sysvm_end = mc->sysvm_start + mc->sysvm_size - 1;
+	dev_info(adev->dev, "SYSVM: %lluM 0x%016llX - 0x%016llX\n",
+			mc->sysvm_size >> 20, mc->sysvm_start, mc->sysvm_end);
+}
+
+/**
  * amdgpu_sysvm_table_ram_alloc - allocate system ram for gart page table
  *
  * @adev: amdgpu_device pointer
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.h
index 7846765..2336ece 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sysvm.h
@@ -32,6 +32,7 @@
 struct amdgpu_device;
 struct amdgpu_bo;
 struct amdgpu_sysvm_funcs;
+struct amdgpu_mc;
 
 #define AMDGPU_GPU_PAGE_SIZE 4096
 #define AMDGPU_GPU_PAGE_MASK (AMDGPU_GPU_PAGE_SIZE - 1)
@@ -57,6 +58,7 @@ struct amdgpu_sysvm {
 };
 
 void amdgpu_sysvm_set_defaults(struct amdgpu_device *adev);
+void amdgpu_sysvm_location(struct amdgpu_device *adev, struct amdgpu_mc *mc);
 int amdgpu_sysvm_table_ram_alloc(struct amdgpu_device *adev);
 void amdgpu_sysvm_table_ram_free(struct amdgpu_device *adev);
 int amdgpu_sysvm_table_vram_alloc(struct amdgpu_device *adev);
-- 
2.7.4



More information about the amd-gfx mailing list