Skip to contentSkip to conversation

drm/amdgpu: add new asic callbacks for HDP flush/invalidation

PATCH In review Alex Deucher 3 participants 7 messages Jan 5, 2018 1 message not in the archive

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

PATCH 1/5 drm/amdgpu: add new asic callbacks for HDP flush/invalidation

Needed to properly flush the HDP cache with the CPU from rather than the GPU.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 ++++++
 1 file changed, 6 insertions(+)

I keep needing to resurrect these patches to test things periodically so I'd like to get them merged even if we don't have a pressing use case at the moment.

drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
index 642bea2c9b3a..88f41c41c70a 100644
@@ -1287,6 +1287,10 @@ struct amdgpu_asic_funcs {
 	void (*set_pcie_lanes)(struct amdgpu_device *adev, int lanes);
 	/* get config memsize register */
 	u32 (*get_config_memsize)(struct amdgpu_device *adev);
+	/* flush hdp write queue */
+	void (*flush_hdp)(struct amdgpu_device *adev);
+	/* invalidate hdp read cache */
+	void (*invalidate_hdp)(struct amdgpu_device *adev);
 };
 
 /*
@@ -1836,6 +1840,8 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
 #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))
 #define amdgpu_asic_get_config_memsize(adev) (adev)->asic_funcs->get_config_memsize((adev))
+#define amdgpu_asic_flush_hdp(adev) (adev)->asic_funcs->flush_hdp((adev))
+#define amdgpu_asic_invalidate_hdp(adev) (adev)->asic_funcs->invalidate_hdp((adev))
 #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid))
 #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags))
 #define amdgpu_gart_get_vm_pde(adev, level, dst, flags) (adev)->gart.gart_funcs->get_vm_pde((adev), (level), (dst), (flags))
Signature · 6 lines
2.13.6

_______________________________________________
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): 20180105041906.31320-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/5 drm/amdgpu: add HDP asic callbacks for SI

Needed to flush and invalidate the HDP block using the CPU.

---
 drivers/gpu/drm/amd/amdgpu/si.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/si.c +14 -0
index 543101d5a5ed..f61a431b9553 100644
@@ -1230,6 +1230,18 @@ static void si_detect_hw_virtualization(struct amdgpu_device *adev)
 		adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
 }
 
+static void si_flush_hdp(struct amdgpu_device *adev)
+{
+	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 1);
+	RREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL);
+}
+
+static void si_invalidate_hdp(struct amdgpu_device *adev)
+{
+	WREG32(mmHDP_DEBUG0, 1);
+	RREG32(mmHDP_DEBUG0);
+}
+
 static const struct amdgpu_asic_funcs si_asic_funcs =
 {
 	.read_disabled_bios = &si_read_disabled_bios,
@@ -1241,6 +1253,8 @@ static const struct amdgpu_asic_funcs si_asic_funcs =
 	.set_uvd_clocks = &si_set_uvd_clocks,
 	.set_vce_clocks = NULL,
 	.get_config_memsize = &si_get_config_memsize,
+	.flush_hdp = &si_flush_hdp,
+	.invalidate_hdp = &si_invalidate_hdp,
 };
 
 static uint32_t si_get_rev_id(struct amdgpu_device *adev)
Signature · 6 lines
2.13.6

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

PATCH 3/5 drm/amdgpu: add HDP asic callbacks for CIK

In reply to a message not in the archive

Needed to flush and invalidate the HDP block using the CPU.

---
 drivers/gpu/drm/amd/amdgpu/cik.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/cik.c +14 -0
index 8e59e65efd44..204ce807372c 100644
@@ -1715,6 +1715,18 @@ static void cik_detect_hw_virtualization(struct amdgpu_device *adev)
 		adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
 }
 
+static void cik_flush_hdp(struct amdgpu_device *adev)
+{
+	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 1);
+	RREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL);
+}
+
+static void cik_invalidate_hdp(struct amdgpu_device *adev)
+{
+	WREG32(mmHDP_DEBUG0, 1);
+	RREG32(mmHDP_DEBUG0);
+}
+
 static const struct amdgpu_asic_funcs cik_asic_funcs =
 {
 	.read_disabled_bios = &cik_read_disabled_bios,
@@ -1726,6 +1738,8 @@ static const struct amdgpu_asic_funcs cik_asic_funcs =
 	.set_uvd_clocks = &cik_set_uvd_clocks,
 	.set_vce_clocks = &cik_set_vce_clocks,
 	.get_config_memsize = &cik_get_config_memsize,
+	.flush_hdp = &cik_flush_hdp,
+	.invalidate_hdp = &cik_invalidate_hdp,
 };
 
 static int cik_common_early_init(void *handle)
Signature · 6 lines
2.13.6

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

PATCH 4/5 drm/amdgpu: add HDP asic callbacks for VI

In reply to a message not in the archive

Needed to flush and invalidate the HDP block using the CPU.

---
 drivers/gpu/drm/amd/amdgpu/vi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/vi.c +14 -0
index da2b99c2d95f..9dd5350d9504 100644
@@ -856,6 +856,18 @@ static uint32_t vi_get_rev_id(struct amdgpu_device *adev)
 			>> PCIE_EFUSE4__STRAP_BIF_ATI_REV_ID__SHIFT;
 }
 
+static void vi_flush_hdp(struct amdgpu_device *adev)
+{
+	WREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL, 1);
+	RREG32(mmHDP_MEM_COHERENCY_FLUSH_CNTL);
+}
+
+static void vi_invalidate_hdp(struct amdgpu_device *adev)
+{
+	WREG32(mmHDP_DEBUG0, 1);
+	RREG32(mmHDP_DEBUG0);
+}
+
 static const struct amdgpu_asic_funcs vi_asic_funcs =
 {
 	.read_disabled_bios = &vi_read_disabled_bios,
@@ -867,6 +879,8 @@ static const struct amdgpu_asic_funcs vi_asic_funcs =
 	.set_uvd_clocks = &vi_set_uvd_clocks,
 	.set_vce_clocks = &vi_set_vce_clocks,
 	.get_config_memsize = &vi_get_config_memsize,
+	.flush_hdp = &vi_flush_hdp,
+	.invalidate_hdp = &vi_invalidate_hdp,
 };
 
 #define CZ_REV_BRISTOL(rev)	 \
Signature · 6 lines
2.13.6

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

PATCH 5/5 drm/amdgpu: add HDP asic callbacks for SOC15 (v2)

In reply to a message not in the archive

Needed to flush and invalidate the HDP block using the CPU.

v2: use preferred register on soc15.

---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +12 -0
index 8f2cff7b7e0c..717bec98e279 100644
@@ -583,6 +583,16 @@ static uint32_t soc15_get_rev_id(struct amdgpu_device *adev)
 	return adev->nbio_funcs->get_rev_id(adev);
 }
 
+static void soc15_flush_hdp(struct amdgpu_device *adev)
+{
+	adev->nbio_funcs->hdp_flush(adev);
+}
+
+static void soc15_invalidate_hdp(struct amdgpu_device *adev)
+{
+	WREG32_SOC15_NO_KIQ(NBIO, 0, mmHDP_READ_CACHE_INVALIDATE, 1);
+}
+
 static const struct amdgpu_asic_funcs soc15_asic_funcs =
 {
 	.read_disabled_bios = &soc15_read_disabled_bios,
@@ -594,6 +604,8 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs =
 	.set_uvd_clocks = &soc15_set_uvd_clocks,
 	.set_vce_clocks = &soc15_set_vce_clocks,
 	.get_config_memsize = &soc15_get_config_memsize,
+	.flush_hdp = &soc15_flush_hdp,
+	.invalidate_hdp = &soc15_invalidate_hdp,
 };
 
 static int soc15_common_early_init(void *handle)
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw
In reply to a message not in the archive

Seems amdgpu_asic_invalidate_hdp() isn't used any more in following patch.

Regards,
David Zhou

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Alex Deucher
Sent: Friday, January 05, 2018 12:19 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Li, Samuel <[email protected]>
Subject: [PATCH 1/5] drm/amdgpu: add new asic callbacks for HDP flush/invalidation

Needed to properly flush the HDP cache with the CPU from rather than the GPU.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 ++++++
 1 file changed, 6 insertions(+)

I keep needing to resurrect these patches to test things periodically so I'd like to get them merged even if we don't have a pressing use case at the moment.

drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -1
index 642bea2c9b3a..88f41c41c70a 100644
@@ -1287,6 +1287,10 @@ struct amdgpu_asic_funcs {
 	void (*set_pcie_lanes)(struct amdgpu_device *adev, int lanes);
 	/* get config memsize register */
 	u32 (*get_config_memsize)(struct amdgpu_device *adev);
+	/* flush hdp write queue */
+	void (*flush_hdp)(struct amdgpu_device *adev);
+	/* invalidate hdp read cache */
+	void (*invalidate_hdp)(struct amdgpu_device *adev);
 };
 
 /*
@@ -1836,6 +1840,8 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)  #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))  #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))  #define amdgpu_asic_get_config_memsize(adev) (adev)->asic_funcs->get_config_memsize((adev))
+#define amdgpu_asic_flush_hdp(adev) 
+(adev)->asic_funcs->flush_hdp((adev))
+#define amdgpu_asic_invalidate_hdp(adev) 
+(adev)->asic_funcs->invalidate_hdp((adev))
 #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid))  #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags))  #define amdgpu_gart_get_vm_pde(adev, level, dst, flags) (adev)->gart.gart_funcs->get_vm_pde((adev), (level), (dst), (flags))
--

2.13.6

_______________________________________________
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

#7 lore raw
In reply to a message not in the archive

Am 05.01.2018 um 05:19 schrieb Alex Deucher:

Quoted 5 lines

Needed to properly flush the HDP cache with the CPU from rather than the GPU.

Whole series is Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 24 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 ++++++
  1 file changed, 6 insertions(+)

I keep needing to resurrect these patches to test things periodically so I'd like to get them merged even if we don't have a pressing use case at the moment.

drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
index 642bea2c9b3a..88f41c41c70a 100644
@@ -1287,6 +1287,10 @@ struct amdgpu_asic_funcs {
  	void (*set_pcie_lanes)(struct amdgpu_device *adev, int lanes);
  	/* get config memsize register */
  	u32 (*get_config_memsize)(struct amdgpu_device *adev);
+	/* flush hdp write queue */
+	void (*flush_hdp)(struct amdgpu_device *adev);
+	/* invalidate hdp read cache */
+	void (*invalidate_hdp)(struct amdgpu_device *adev);
  };
 
  /*

drivers/gpu/drm/amd/amdgpu/amdgpu.h amdgpu_get_sdma_instance(struct amdgpu_ring *ring) · line 1847

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -1836,6 +1840,8 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
  #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
  #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v)))
  #define amdgpu_asic_get_config_memsize(adev) (adev)->asic_funcs->get_config_memsize((adev))
+#define amdgpu_asic_flush_hdp(adev) (adev)->asic_funcs->flush_hdp((adev))
+#define amdgpu_asic_invalidate_hdp(adev) (adev)->asic_funcs->invalidate_hdp((adev))
  #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid))
  #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags))
  #define amdgpu_gart_get_vm_pde(adev, level, dst, flags) (adev)->gart.gart_funcs->get_vm_pde((adev), (level), (dst), (flags))

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