Skip to contentSkip to conversation

drm/amdgpu: add vcn_doorbell_range callback for nbio 7.11

PATCH In review Alex Deucher 2 participants 3 messages Sep 11, 2023 – Sep 12, 2023

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/2 drm/amdgpu: add vcn_doorbell_range callback for nbio 7.11

Implement support for setting up the VCN doorbell range for NBIO 7.11.

---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c +22 -0
index a32d9b8ec51b..bcf5fb420fda 100644
@@ -100,6 +100,27 @@ static void nbio_v7_11_vpe_doorbell_range(struct amdgpu_device *adev, int instan
 	WREG32_PCIE_PORT(reg, doorbell_range);
 }
 
+static void nbio_v7_11_vcn_doorbell_range(struct amdgpu_device *adev,
+					  bool use_doorbell,
+					  int doorbell_index, int instance)
+{
+	u32 reg = SOC15_REG_OFFSET(NBIO, 0, regGDC0_BIF_VCN0_DOORBELL_RANGE);
+	u32 doorbell_range = RREG32_PCIE_PORT(reg);
+
+	if (use_doorbell) {
+		doorbell_range = REG_SET_FIELD(doorbell_range,
+					       GDC0_BIF_VCN0_DOORBELL_RANGE, OFFSET,
+					       doorbell_index);
+		doorbell_range = REG_SET_FIELD(doorbell_range,
+					       GDC0_BIF_VCN0_DOORBELL_RANGE, SIZE, 8);
+	} else {
+		doorbell_range = REG_SET_FIELD(doorbell_range,
+					       GDC0_BIF_VCN0_DOORBELL_RANGE, SIZE, 0);
+	}
+
+	WREG32_PCIE_PORT(reg, doorbell_range);
+}
+
 static void nbio_v7_11_enable_doorbell_aperture(struct amdgpu_device *adev,
 					       bool enable)
 {
@@ -256,6 +277,7 @@ const struct amdgpu_nbio_funcs nbio_v7_11_funcs = {
 	.mc_access_enable = nbio_v7_11_mc_access_enable,
 	.get_memsize = nbio_v7_11_get_memsize,
 	.sdma_doorbell_range = nbio_v7_11_sdma_doorbell_range,
+	.vcn_doorbell_range = nbio_v7_11_vcn_doorbell_range,
 	.vpe_doorbell_range = nbio_v7_11_vpe_doorbell_range,
 	.enable_doorbell_aperture = nbio_v7_11_enable_doorbell_aperture,
 	.enable_doorbell_selfring_aperture = nbio_v7_11_enable_doorbell_selfring_aperture,
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 2/2 drm/amdgpu: add remap_hdp_registers callback for nbio 7.11

Implement support for remapping the HDP aperture registers for NBIO 7.11.

---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c +9 -0
index bcf5fb420fda..6873eead1e19 100644
@@ -28,6 +28,14 @@
 #include "nbio/nbio_7_11_0_sh_mask.h"
 #include <uapi/linux/kfd_ioctl.h>
 
+static void nbio_v7_11_remap_hdp_registers(struct amdgpu_device *adev)
+{
+	WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL,
+		     adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL);
+	WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL,
+		     adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL);
+}
+
 static u32 nbio_v7_11_get_rev_id(struct amdgpu_device *adev)
 {
 	u32 tmp;
@@ -284,4 +292,5 @@ const struct amdgpu_nbio_funcs nbio_v7_11_funcs = {
 	.ih_doorbell_range = nbio_v7_11_ih_doorbell_range,
 	.ih_control = nbio_v7_11_ih_control,
 	.init_registers = nbio_v7_11_init_registers,
+	.remap_hdp_registers = nbio_v7_11_remap_hdp_registers,
 };
Signature · 1 line
2.41.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: add remap_hdp_registers callback for nbio 7.11

Quoted 4 lines · Alex Deucher

Implement support for remapping the HDP aperture registers for NBIO 7.11.

The series is.

Quoted 32 lines
---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c +9 -0
index bcf5fb420fda..6873eead1e19 100644
@@ -28,6 +28,14 @@
 #include "nbio/nbio_7_11_0_sh_mask.h"
 #include <uapi/linux/kfd_ioctl.h>
 
+static void nbio_v7_11_remap_hdp_registers(struct amdgpu_device *adev)
+{
+	WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL,
+		     adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL);
+	WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL,
+		     adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL);
+}
+
 static u32 nbio_v7_11_get_rev_id(struct amdgpu_device *adev)
 {
 	u32 tmp;
@@ -284,4 +292,5 @@ const struct amdgpu_nbio_funcs nbio_v7_11_funcs = {
 	.ih_doorbell_range = nbio_v7_11_ih_doorbell_range,
 	.ih_control = nbio_v7_11_ih_control,
 	.init_registers = nbio_v7_11_init_registers,
+	.remap_hdp_registers = nbio_v7_11_remap_hdp_registers,
 };
Signature · 1 line
2.41.0