Skip to contentSkip to conversation

add gfx capability by gpu info

PATCH Superseded Junwei Zhang 3 participants 10 messages Feb 16, 2017 – Feb 17, 2017 8 messages not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1487213588-26299-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/1 drm/amdgpu: export gfx capability by gpu info

Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  1 +
 6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
index 1ad3f08..cdc2b2a 100644
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
 	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);
 };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
 struct amdgpu_gfx {
 	struct mutex			gpu_clock_mutex;
 	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
 	/* reset mask */
 	uint32_t                        grbm_soft_reset;
 	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
 };
 
 int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
 			cap.direct_gma_size = amdgpu_direct_gma_size;
 		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
 		return copy_to_user(out, &cap,
 				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +6 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct amdgpu_device *adev,
 	mutex_unlock(&adev->grbm_idx_mutex);
 }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev)
+{
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+}
+
 static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
 {
 	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
 		     adev->gfx.config.max_cu_per_sh);
 
 	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
 	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 << CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |
 				       (0x2b << CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev)
+{
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+}
+
 /**
  * gfx_v7_0_gpu_init - setup the 3D engine
  *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct amdgpu_device *adev)
 
 	gfx_v7_0_setup_rb(adev);
 	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
 	/* set HW defaults for 3D engine */
 	WREG32(mmCP_MEQ_THRESHOLDS,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +14 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev)
+{
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
 static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
 {
 	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
 	gfx_v8_0_tiling_mode_table_init(adev);
 	gfx_v8_0_setup_rb(adev);
 	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
 	/* XXX SH_MEM regs */
 	/* where to put LDS, scratch, GPUVM in FSA64 space */
include/uapi/drm/amdgpu_drm.h +1 -0
index 04daab3..7064fdc 100644
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
 struct drm_amdgpu_capability {
 	__u32 flag;
 	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
 };
 
 /*
Signature · 6 lines
1.9.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): 1487213588-26299-2-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Hi,

Question, is this a bit premature to have a new function and struct for this, could it just be put in amdgpu_gfx for now or are we expecting amdgpu_gfx_cap to start growing quickly with far more cap state info?

Kind Regards,
Edward.

Quoted 134 lines · Junwei Zhang
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  1 +
 6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
index 1ad3f08..cdc2b2a 100644
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
 	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);
 };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
 struct amdgpu_gfx {
 	struct mutex			gpu_clock_mutex;
 	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
 	/* reset mask */
 	uint32_t                        grbm_soft_reset;
 	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
 };
 
 int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
 			cap.direct_gma_size = amdgpu_direct_gma_size;
 		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
 		return copy_to_user(out, &cap,
 				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +6 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct amdgpu_device *adev,
 	mutex_unlock(&adev->grbm_idx_mutex);
 }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev)
+{
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+}
+
 static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
 {
 	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
 		     adev->gfx.config.max_cu_per_sh);
 
 	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
 	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 << CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |
 				       (0x2b << CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev)
+{
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+}
+
 /**
  * gfx_v7_0_gpu_init - setup the 3D engine
  *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct amdgpu_device *adev)
 
 	gfx_v7_0_setup_rb(adev);
 	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
 	/* set HW defaults for 3D engine */
 	WREG32(mmCP_MEQ_THRESHOLDS,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +14 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev)
+{
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
 static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
 {
 	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
 	gfx_v8_0_tiling_mode_table_init(adev);
 	gfx_v8_0_setup_rb(adev);
 	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
 	/* XXX SH_MEM regs */
 	/* where to put LDS, scratch, GPUVM in FSA64 space */
include/uapi/drm/amdgpu_drm.h +0 -0
index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { · line 859

Quoted 7 lines
include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
 struct drm_amdgpu_capability {
 	__u32 flag;
 	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
 };
 
 /*

_______________________________________________
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): 2ee3024b-cd44-9fd6-62f7-fb8117dd2e74-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org

#6 lore raw

RE: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Hi Edward,

Quoted 3 lines

Question, is this a bit premature to have a new function and struct for this, could it just be put in amdgpu_gfx for now or are we expecting amdgpu_gfx_cap to start growing quickly with far more cap state info?

Yes, we will add more in the future.

Ideally we'd like to add a feature structure to export all supported by current amdgpu_device. Now it's only one for gfx, so I insert a structure in amdgpu_gfx, which was verified by vulkan carrizo. Then I send it out for guys review whether to add in the amdgpu_device directly
or keep current style till we have other features besides gfx.

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 162 lines

-----Original Message-----
From: Edward O'Callaghan [mailto:[email protected]]
Sent: Thursday, February 16, 2017 12:38
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Hi,

Question, is this a bit premature to have a new function and struct for this, could it just be put in amdgpu_gfx for now or are we expecting amdgpu_gfx_cap to start growing quickly with far more cap state info?

Kind Regards,
Edward.

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device *dev,

Quoted 42 lines · Junwei Zhang
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  1 +
 6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
index 1ad3f08..cdc2b2a 100644
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
 	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd,
 uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);  };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
 struct amdgpu_gfx {
 	struct mutex			gpu_clock_mutex;
 	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
 	/* reset mask */
 	uint32_t                        grbm_soft_reset;
 	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
 };
 
 int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev,

void *data, struct drm_file

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_setup_spi(struct

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
 			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
 			cap.direct_gma_size = amdgpu_direct_gma_size;
 		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
 		return copy_to_user(out, &cap,
 				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
 	mutex_unlock(&adev->grbm_idx_mutex);
 }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
 static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)  {
 	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
 		     adev->gfx.config.max_cu_per_sh);
 
 	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
 	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 <<

CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device · line 1703

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
 				       (0x2b <<

CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gmc_v7_0_init_compute_vmid(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_compute_vmid(struct

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
 /**
  * gfx_v7_0_gpu_init - setup the 3D engine
  *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct
 amdgpu_device *adev)
 
 	gfx_v7_0_setup_rb(adev);
 	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
 	/* set HW defaults for 3D engine */
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
 	WREG32(mmCP_MEQ_THRESHOLDS,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_gpu_init(struct amdgpu_device

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12 -0
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
 static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)  {
 	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device

*adev)

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
 	gfx_v8_0_tiling_mode_table_init(adev);
 	gfx_v8_0_setup_rb(adev);
 	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
 	/* XXX SH_MEM regs */
 	/* where to put LDS, scratch, GPUVM in FSA64 space */ diff --git

a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {  struct
 drm_amdgpu_capability {
 	__u32 flag;
 	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
 };
 
Quoted 2 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { struct · line 859

Quoted 2 lines
include/uapi/drm/amdgpu_drm.h +0 -0
 /*

_______________________________________________
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): BN6PR12MB1809B9E0ECE9A87C21C92A41FF5A0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by
#8 lore raw

Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Quoted 11 lines · Jerry

Hi Edward,

Quoted 3 lines

Question, is this a bit premature to have a new function and struct for this, could it just be put in amdgpu_gfx for now or are we expecting amdgpu_gfx_cap to start growing quickly with far more cap state info?

Yes, we will add more in the future.

Ideally we'd like to add a feature structure to export all supported by current amdgpu_device. Now it's only one for gfx, so I insert a structure in amdgpu_gfx, which was verified by vulkan carrizo. Then I send it out for guys review whether to add in the amdgpu_device directly
or keep current style till we have other features besides gfx.

Hmmk, its nothing to stress about I was just more curious about it.

Kindly,
Edward.

Quoted 171 lines

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 162 lines

-----Original Message-----
From: Edward O'Callaghan [mailto:[email protected]]
Sent: Thursday, February 16, 2017 12:38
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Hi,

Question, is this a bit premature to have a new function and struct for this, could it just be put in amdgpu_gfx for now or are we expecting amdgpu_gfx_cap to start growing quickly with far more cap state info?

Kind Regards,
Edward.

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device *dev,

Quoted 42 lines · Junwei Zhang
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  1 +
 6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
index 1ad3f08..cdc2b2a 100644
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
 	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd,
 uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);  };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
 struct amdgpu_gfx {
 	struct mutex			gpu_clock_mutex;
 	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
 	/* reset mask */
 	uint32_t                        grbm_soft_reset;
 	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
 };
 
 int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev,

void *data, struct drm_file

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_setup_spi(struct

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
 			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
 			cap.direct_gma_size = amdgpu_direct_gma_size;
 		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
 		return copy_to_user(out, &cap,
 				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
 	mutex_unlock(&adev->grbm_idx_mutex);
 }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
 static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)  {
 	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
 		     adev->gfx.config.max_cu_per_sh);
 
 	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
 	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 <<

CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device · line 1703

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
 				       (0x2b <<

CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gmc_v7_0_init_compute_vmid(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_compute_vmid(struct

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
 /**
  * gfx_v7_0_gpu_init - setup the 3D engine
  *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct
 amdgpu_device *adev)
 
 	gfx_v7_0_setup_rb(adev);
 	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
 	/* set HW defaults for 3D engine */
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
 	WREG32(mmCP_MEQ_THRESHOLDS,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_gpu_init(struct amdgpu_device

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12 -0
 	mutex_unlock(&adev->srbm_mutex);
 }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
 static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)  {
 	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device

*adev)

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
 	gfx_v8_0_tiling_mode_table_init(adev);
 	gfx_v8_0_setup_rb(adev);
 	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
 	/* XXX SH_MEM regs */
 	/* where to put LDS, scratch, GPUVM in FSA64 space */ diff --git

a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {  struct
 drm_amdgpu_capability {
 	__u32 flag;
 	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
 };
 
Quoted 3 lines
Quoted 2 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { struct · line 859

Quoted 2 lines
include/uapi/drm/amdgpu_drm.h +0 -0
 /*

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

#9 lore raw

Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

In reply to a message not in the archive

Am 16.02.2017 um 03:53 schrieb Junwei Zhang:

Quoted 2 lines
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a

Complete NAK on this. The drm_amdgpu_capability structure is specific to the pro driver.

The Vulkan stack on the other hand is supposed to work on the open stack as well.

So please but that into the drm_amdgpu_info_device structure and the new field in the amdgpu_gca_config structure (you might as well want to rename the amdgpu_gca_config structure).

Regards,
Christian.

Quoted 131 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
  include/uapi/drm/amdgpu_drm.h           |  1 +
  6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
index 1ad3f08..cdc2b2a 100644
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
  	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);
  };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
  struct amdgpu_gfx {
  	struct mutex			gpu_clock_mutex;
  	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
  	/* reset mask */
  	uint32_t                        grbm_soft_reset;
  	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
  };
 
  int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
  			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
  			cap.direct_gma_size = amdgpu_direct_gma_size;
  		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
  		return copy_to_user(out, &cap,
  				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
  	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +6 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct amdgpu_device *adev,
  	mutex_unlock(&adev->grbm_idx_mutex);
  }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev)
+{
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+}
+
  static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
  {
  	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
  		     adev->gfx.config.max_cu_per_sh);
 
  	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
  	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 << CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |
  				       (0x2b << CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
  }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev)
+{
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+}
+
  /**
   * gfx_v7_0_gpu_init - setup the 3D engine
   *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct amdgpu_device *adev)
 
  	gfx_v7_0_setup_rb(adev);
  	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
  	/* set HW defaults for 3D engine */
  	WREG32(mmCP_MEQ_THRESHOLDS,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +14 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
  	mutex_unlock(&adev->srbm_mutex);
  }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev)
+{
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
  static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
  {
  	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
  	gfx_v8_0_tiling_mode_table_init(adev);
  	gfx_v8_0_setup_rb(adev);
  	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
  	/* XXX SH_MEM regs */
  	/* where to put LDS, scratch, GPUVM in FSA64 space */
include/uapi/drm/amdgpu_drm.h +0 -0
index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { · line 859

Quoted 7 lines
include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
  struct drm_amdgpu_capability {
  	__u32 flag;
  	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
  };
 
  /*

_______________________________________________
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): 2bae755f-f1e2-57de-257c-e1d155723122-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#11 lore raw

RE: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Quoted 6 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, February 16, 2017 17:12
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Quoted 6 lines

Am 16.02.2017 um 03:53 schrieb Junwei Zhang:

Quoted 2 lines
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a

Complete NAK on this. The drm_amdgpu_capability structure is specific to the pro driver.

Thanks to reminder it.
I neglect it.

Quoted 7 lines

The Vulkan stack on the other hand is supposed to work on the open stack as well.

So please but that into the drm_amdgpu_info_device structure and the new field in the amdgpu_gca_config structure (you might as well want to rename the amdgpu_gca_config structure).

So you mean add the feature or config structure in amdgpu_device directly from now on. Right?

Could you explain the meaning about gca?

BTW,
1) in the future we may add more feature/config in the same structure, but may not for gfx.
2) Shall we add a version to control these features? UMD could know the features status according to the version.

Quoted 151 lines

Regards,
Christian.

Quoted 15 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
  include/uapi/drm/amdgpu_drm.h           |  1 +
  6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 1ad3f08..cdc2b2a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_gfx_funcs { · line 869

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
  	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd,

uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device *dev,

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
  };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
  struct amdgpu_gfx {
  	struct mutex			gpu_clock_mutex;
  	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
  	/* reset mask */
  	uint32_t                        grbm_soft_reset;
  	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
  };
 
  int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev,

void *data, struct drm_file

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_setup_spi(struct

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
  			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
  			cap.direct_gma_size = amdgpu_direct_gma_size;
  		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
  		return copy_to_user(out, &cap,
  				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
  	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
  	mutex_unlock(&adev->grbm_idx_mutex);
  }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
  static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
  {
  	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
  		     adev->gfx.config.max_cu_per_sh);
 
  	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
  	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 <<

CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device · line 1703

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
  				       (0x2b <<

CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gmc_v7_0_init_compute_vmid(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_compute_vmid(struct

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
  	mutex_unlock(&adev->srbm_mutex);
  }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
  /**
   * gfx_v7_0_gpu_init - setup the 3D engine
   *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct
 amdgpu_device *adev)
 
  	gfx_v7_0_setup_rb(adev);
  	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
  	/* set HW defaults for 3D engine */

WREG32(mmCP_MEQ_THRESHOLDS,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_gpu_init(struct amdgpu_device

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12 -0
  	mutex_unlock(&adev->srbm_mutex);
  }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
  static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
  {
  	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device

*adev)

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
  	gfx_v8_0_tiling_mode_table_init(adev);
  	gfx_v8_0_setup_rb(adev);
  	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
  	/* XXX SH_MEM regs */
  	/* where to put LDS, scratch, GPUVM in FSA64 space */ diff --git

a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
  struct drm_amdgpu_capability {
  	__u32 flag;
  	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
  };
 
Quoted 2 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { · line 859

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
  /*

_______________________________________________
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): BN6PR12MB18098E6B408580D7847D84EBFF5A0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#13 lore raw

Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Am 16.02.2017 um 10:24 schrieb Zhang, Jerry:

Quoted 14 lines
Quoted 11 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, February 16, 2017 17:12
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Am 16.02.2017 um 03:53 schrieb Junwei Zhang:

Quoted 2 lines
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a

Complete NAK on this. The drm_amdgpu_capability structure is specific to the pro driver.

Thanks to reminder it.
I neglect it.

Quoted 8 lines
Quoted 6 lines

The Vulkan stack on the other hand is supposed to work on the open stack as well.

So please but that into the drm_amdgpu_info_device structure and the new field in the amdgpu_gca_config structure (you might as well want to rename the amdgpu_gca_config structure).

So you mean add the feature or config structure in amdgpu_device directly from now on. Right?

No, just forget about the config or feature structure. Add gfx features to amdgpu_gca_config.

Quoted 1 line

Could you explain the meaning about gca?

I just think that the naming isn't the best, something like amdgpu_gfx_config would probably be better.

Quoted 3 lines

BTW,
1) in the future we may add more feature/config in the same structure, but may not for gfx.

Stop, that is really bad design. The features/config should be kept on a per IP basis.

So gfx config/features should only be grouped together with gfx features. Don't mix features from different block inside the kernel module.

The IOCTL interface is a different story, here we have the drm_amdgpu_info_device structure for information about the whole GPU as well as individual structures about each IP block (like firmware versions etc...).

For the current case adding that to drm_amdgpu_info_device sounds like the right approach to me.

Quoted 1 line

2) Shall we add a version to control these features? UMD could know the features status according to the version.

No, the size of the drm_amdgpu_info_device structure is already version controlled.

Just make sure that the default value is zero, this way you keep backward compatible with older kernel interfaces.

Regards,
Christian.

Quoted 151 lines
Quoted 151 lines

Regards,
Christian.

Quoted 15 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
   drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
   include/uapi/drm/amdgpu_drm.h           |  1 +
   6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 1ad3f08..cdc2b2a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_gfx_funcs { · line 869

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
   	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd,

uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device *dev,

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
   };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf;
+};
+
   struct amdgpu_gfx {
   	struct mutex			gpu_clock_mutex;
   	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
   	/* reset mask */
   	uint32_t                        grbm_soft_reset;
   	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
   };
 
   int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 7f59608..e7aa382 100644
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev,

void *data, struct drm_file

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_setup_spi(struct

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
   			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
   			cap.direct_gma_size = amdgpu_direct_gma_size;
   		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
   		return copy_to_user(out, &cap,
   				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
   	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
   	mutex_unlock(&adev->grbm_idx_mutex);
   }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
   static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
   {
   	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
   		     adev->gfx.config.max_cu_per_sh);
 
   	gfx_v6_0_get_cu_info(adev);
+	gfx_v6_0_cap_init(adev);
 
   	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 <<

CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_gpu_init(struct amdgpu_device · line 1703

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
   				       (0x2b <<

CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gmc_v7_0_init_compute_vmid(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_compute_vmid(struct

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
   	mutex_unlock(&adev->srbm_mutex);
   }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
   /**
    * gfx_v7_0_gpu_init - setup the 3D engine
    *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct
 amdgpu_device *adev)
 
   	gfx_v7_0_setup_rb(adev);
   	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
   	/* set HW defaults for 3D engine */

WREG32(mmCP_MEQ_THRESHOLDS,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_gpu_init(struct amdgpu_device

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12 -0
   	mutex_unlock(&adev->srbm_mutex);
   }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
   static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
   {
   	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device

*adev)

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
   	gfx_v8_0_tiling_mode_table_init(adev);
   	gfx_v8_0_setup_rb(adev);
   	gfx_v8_0_get_cu_info(adev);
+	gfx_v8_0_cap_init(adev);
 
   	/* XXX SH_MEM regs */
   	/* where to put LDS, scratch, GPUVM in FSA64 space */ diff --git

a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
   struct drm_amdgpu_capability {
   	__u32 flag;
   	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
   };
 
Quoted 5 lines
Quoted 1 line

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { · line 859

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
   /*

_______________________________________________
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): ea0dbd80-8ebf-908f-3d7f-78501b06fc53-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#15 lore raw

RE: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Hi Christian,

Thanks for specifying it.

Please check my update in another mail if getting the correct info as you mentioned.

Quoted 2 lines

Just make sure that the default value is zero, this way you keep backward compatible with older kernel interfaces.

I have checked all gfx from 6 to 8. By default they are 1. Just 2 APUs(gfxv8) are 0.

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 61 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, February 16, 2017 17:37
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Am 16.02.2017 um 10:24 schrieb Zhang, Jerry:

Quoted 15 lines
Quoted 7 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, February 16, 2017 17:12
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Quoted 5 lines

Am 16.02.2017 um 03:53 schrieb Junwei Zhang:

Quoted 2 lines
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a

Complete NAK on this. The drm_amdgpu_capability structure is specific to the pro driver.

Thanks to reminder it.
I neglect it.

Quoted 7 lines
Quoted 6 lines

The Vulkan stack on the other hand is supposed to work on the open stack as well.

So please but that into the drm_amdgpu_info_device structure and the new field in the amdgpu_gca_config structure (you might as well want to rename the amdgpu_gca_config structure).

So you mean add the feature or config structure in amdgpu_device directly

from now on.

Quoted 1 line

Right?

No, just forget about the config or feature structure. Add gfx features to amdgpu_gca_config.

Quoted 1 line

Could you explain the meaning about gca?

I just think that the naming isn't the best, something like amdgpu_gfx_config would probably be better.

Quoted 3 lines

BTW,
1) in the future we may add more feature/config in the same structure, but

may not for gfx.

Stop, that is really bad design. The features/config should be kept on a per IP basis.

So gfx config/features should only be grouped together with gfx features. Don't mix features from different block inside the kernel module.

The IOCTL interface is a different story, here we have the drm_amdgpu_info_device structure for information about the whole GPU as well as individual structures about each IP block (like firmware versions etc...).

For the current case adding that to drm_amdgpu_info_device sounds like the right approach to me.

Quoted 1 line

2) Shall we add a version to control these features? UMD could know the

features status according to the version.

Quoted 169 lines

No, the size of the drm_amdgpu_info_device structure is already version controlled.

Just make sure that the default value is zero, this way you keep backward compatible with older kernel interfaces.

Regards,
Christian.

Quoted 159 lines
Quoted 154 lines

Regards,
Christian.

Quoted 15 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
   drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
   include/uapi/drm/amdgpu_drm.h           |  1 +
   6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 1ad3f08..cdc2b2a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_gfx_funcs { · line 870

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
   	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t
 simd,

uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
   };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf; };
+
   struct amdgpu_gfx {
   	struct mutex			gpu_clock_mutex;
   	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
   	/* reset mask */
   	uint32_t                        grbm_soft_reset;
   	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
   };
 
   int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm

*vm, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 7f59608..e7aa382 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device · line 618

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device
 *dev,

void *data, struct drm_file

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_setup_spi(struct

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
   			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
   			cap.direct_gma_size = amdgpu_direct_gma_size;
   		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
   		return copy_to_user(out, &cap,
   				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
   	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct

amdgpu_device *adev,

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
   	mutex_unlock(&adev->grbm_idx_mutex);
   }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
   static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
   {
   	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct

amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c

Quoted 6 lines
   		     adev->gfx.config.max_cu_per_sh);

   	gfx_v6_0_get_cu_info(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
+	gfx_v6_0_cap_init(adev);
 
   	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 <<

CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |

Quoted 1 line
   				       (0x2b <<

CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gmc_v7_0_init_compute_vmid(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_compute_vmid(struct

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
   	mutex_unlock(&adev->srbm_mutex);
   }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
   /**
    * gfx_v7_0_gpu_init - setup the 3D engine
    *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct
 amdgpu_device *adev)
 
   	gfx_v7_0_setup_rb(adev);
   	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
   	/* set HW defaults for 3D engine */

WREG32(mmCP_MEQ_THRESHOLDS,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct

amdgpu_device *adev)

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12 -0
   	mutex_unlock(&adev->srbm_mutex);
   }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
   static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
   {
   	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct
Quoted 1 line

amdgpu_device

*adev)

Quoted 18 lines
   	gfx_v8_0_tiling_mode_table_init(adev);
   	gfx_v8_0_setup_rb(adev);
   	gfx_v8_0_get_cu_info(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+	gfx_v8_0_cap_init(adev);
 
   	/* XXX SH_MEM regs */
   	/* where to put LDS, scratch, GPUVM in FSA64 space */ diff --git

a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
   struct drm_amdgpu_capability {
   	__u32 flag;
   	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
   };
 
Quoted 1 line

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { · line 859

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
   /*

_______________________________________________
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): BN6PR12MB180905873C26301AFC42915DFF5D0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#17 lore raw

Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Am 17.02.2017 um 06:02 schrieb Zhang, Jerry:

Quoted 9 lines

Hi Christian,

Thanks for specifying it.

Please check my update in another mail if getting the correct info as you mentioned.

Quoted 2 lines

Just make sure that the default value is zero, this way you keep backward compatible with older kernel interfaces.

I have checked all gfx from 6 to 8. By default they are 1. Just 2 APUs(gfxv8) are 0.

In this case you might want to bump the driver minor number as well to indicate validity of that field.

See we can extend the structures by adding new fields to the end, but old kernels will not set those fields (so they stay zero cleared).

Not sure what the UMD is expecting here.

Regards,
Christian.

Quoted 234 lines

Regards,
Jerry (Junwei Zhang)

Linux Base Graphics
SRDC Software Development
_____________________________________

Quoted 225 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, February 16, 2017 17:37
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Am 16.02.2017 um 10:24 schrieb Zhang, Jerry:

Quoted 15 lines
Quoted 7 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, February 16, 2017 17:12
To: Zhang, Jerry; [email protected]
Subject: Re: [PATCH 1/1] drm/amdgpu: export gfx capability by gpu info

Quoted 5 lines

Am 16.02.2017 um 03:53 schrieb Junwei Zhang:

Quoted 2 lines
Change-Id Ibf3e4dbb7deb83271adabc275c9b7a0e0652541a

Complete NAK on this. The drm_amdgpu_capability structure is specific to the pro driver.

Thanks to reminder it.
I neglect it.

Quoted 7 lines
Quoted 6 lines

The Vulkan stack on the other hand is supposed to work on the open stack as well.

So please but that into the drm_amdgpu_info_device structure and the new field in the amdgpu_gca_config structure (you might as well want to rename the amdgpu_gca_config structure).

So you mean add the feature or config structure in amdgpu_device directly

from now on.

Quoted 1 line

Right?

No, just forget about the config or feature structure. Add gfx features to amdgpu_gca_config.

Quoted 1 line

Could you explain the meaning about gca?

I just think that the naming isn't the best, something like amdgpu_gfx_config would probably be better.

Quoted 2 lines

BTW,
1) in the future we may add more feature/config in the same structure, but

may not for gfx.

Stop, that is really bad design. The features/config should be kept on a per IP basis.

So gfx config/features should only be grouped together with gfx features. Don't mix features from different block inside the kernel module.

The IOCTL interface is a different story, here we have the drm_amdgpu_info_device structure for information about the whole GPU as well as individual structures about each IP block (like firmware versions etc...).

For the current case adding that to drm_amdgpu_info_device sounds like the right approach to me.

Quoted 1 line

2) Shall we add a version to control these features? UMD could know the

features status according to the version.

No, the size of the drm_amdgpu_info_device structure is already version controlled.

Just make sure that the default value is zero, this way you keep backward compatible with older kernel interfaces.

Regards,
Christian.

Quoted 158 lines
Quoted 153 lines

Regards,
Christian.

Quoted 15 lines
---
    drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 ++
    drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   |  6 ++++++
    drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 14 ++++++++++++++
    include/uapi/drm/amdgpu_drm.h           |  1 +
    6 files changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 1ad3f08..cdc2b2a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_gfx_funcs { · line 870

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
@@ -869,6 +869,10 @@ struct amdgpu_gfx_funcs {
    	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t
 simd,

uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);

Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -0
    };
 
+struct amdgpu_gfx_cap {
+	uint32_t gc_double_offchip_lds_buf; };
+
    struct amdgpu_gfx {
    	struct mutex			gpu_clock_mutex;
    	struct amdgpu_gca_config	config;
@@ -911,6 +915,8 @@ struct amdgpu_gfx {
    	/* reset mask */
    	uint32_t                        grbm_soft_reset;
    	uint32_t                        srbm_soft_reset;
+
+	struct amdgpu_gfx_cap		cap;
    };
 
    int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm

*vm, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 7f59608..e7aa382 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device · line 618

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
@@ -618,6 +618,8 @@ static int amdgpu_info_ioctl(struct drm_device
 *dev,

void *data, struct drm_file

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_setup_spi(struct

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
    			cap.flag |= AMDGPU_CAPABILITY_DIRECT_GMA_FLAG;
    			cap.direct_gma_size = amdgpu_direct_gma_size;
    		}
+		cap.gc_double_offchip_lds_buf =
+			adev->gfx.cap.gc_double_offchip_lds_buf;
    		return copy_to_user(out, &cap,
    				    min((size_t)size, sizeof(cap))) ? -EFAULT : 0;
    	}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
index ce75d46..a1e221b 100644
@@ -1534,6 +1534,11 @@ static void gfx_v6_0_setup_spi(struct

amdgpu_device *adev,

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
    	mutex_unlock(&adev->grbm_idx_mutex);
    }
 
+static void gfx_v6_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
    static void gfx_v6_0_gpu_init(struct amdgpu_device *adev)
    {
    	u32 gb_addr_config = 0;
@@ -1692,6 +1697,7 @@ static void gfx_v6_0_gpu_init(struct

amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c

Quoted 6 lines
    		     adev->gfx.config.max_cu_per_sh);

    	gfx_v6_0_get_cu_info(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -0
+	gfx_v6_0_cap_init(adev);
 
    	WREG32(mmCP_QUEUE_THRESHOLDS, ((0x16 <<

CP_QUEUE_THRESHOLDS__ROQ_IB1_START__SHIFT) |

Quoted 1 line
    				       (0x2b <<

CP_QUEUE_THRESHOLDS__ROQ_IB2_START__SHIFT)));

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gmc_v7_0_init_compute_vmid(struct

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
index aaf66fe..e1e97ae 100644
@@ -1876,6 +1876,11 @@ static void gmc_v7_0_init_compute_vmid(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_compute_vmid(struct

Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -0
    	mutex_unlock(&adev->srbm_mutex);
    }
 
+static void gfx_v7_0_cap_init(struct amdgpu_device *adev) {
+	adev->gfx.cap.gc_double_offchip_lds_buf = 1; }
+
    /**
     * gfx_v7_0_gpu_init - setup the 3D engine
     *
@@ -1900,6 +1905,7 @@ static void gfx_v7_0_gpu_init(struct
 amdgpu_device *adev)
 
    	gfx_v7_0_setup_rb(adev);
    	gfx_v7_0_get_cu_info(adev);
+	gfx_v7_0_cap_init(adev);
 
    	/* set HW defaults for 3D engine */

WREG32(mmCP_MEQ_THRESHOLDS,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index ce05e38..934fc71 100644
@@ -3826,6 +3826,19 @@ static void gfx_v8_0_init_compute_vmid(struct

amdgpu_device *adev)

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12 -0
    	mutex_unlock(&adev->srbm_mutex);
    }
 
+static void gfx_v8_0_cap_init(struct amdgpu_device *adev) {
+	switch (adev->asic_type) {
+	default:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 1;
+		break;
+	case CHIP_CARRIZO:
+	case CHIP_STONEY:
+		adev->gfx.cap.gc_double_offchip_lds_buf = 0;
+		break;
+	}
+}
+
    static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
    {
    	u32 tmp, sh_static_mem_cfg;
@@ -3839,6 +3852,7 @@ static void gfx_v8_0_gpu_init(struct
Quoted 1 line

amdgpu_device

*adev)

Quoted 18 lines
    	gfx_v8_0_tiling_mode_table_init(adev);
    	gfx_v8_0_setup_rb(adev);
    	gfx_v8_0_get_cu_info(adev);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+	gfx_v8_0_cap_init(adev);
 
    	/* XXX SH_MEM regs */
    	/* where to put LDS, scratch, GPUVM in FSA64 space */ diff --git

a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 04daab3..7064fdc 100644

include/uapi/drm/amdgpu_drm.h +1 -0
@@ -853,6 +853,7 @@ struct drm_amdgpu_virtual_range {
    struct drm_amdgpu_capability {
    	__u32 flag;
    	__u32 direct_gma_size;
+	__u32 gc_double_offchip_lds_buf;
    };
 
Quoted 1 line

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_virtual_range { · line 859

Quoted 1 line
include/uapi/drm/amdgpu_drm.h +0 -0
    /*

_______________________________________________
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