[PATCH] drm/amdgpu: add missing nbio_v7_11_5 callbacks

Shubhankar Milind Sardeshpande <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
Wire up get_clockgating_state, update_medium_grain_clock_gating,
update_medium_grain_light_sleep and get_rom_offset. The missing
get_clockgating_state caused a NULL pointer dereference when reading
the amdgpu_pm_info debugfs node.

Fixes: 0453ccd3237a ("drm/amdgpu: Add NBIO 7.11.5 support")

Signed-off-by: Shubhankar Milind Sardeshpande <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_11_5.c | 32 +++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_11_5.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_11_5.c
index 9bb998a47ef6..558511dd25aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_11_5.c
+++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_11_5.c
@@ -249,6 +249,24 @@ static void nbio_v7_11_5_ih_control(struct amdgpu_device *adev)
 		WREG32_SOC15(NBIO, 0, regBIF_BX1_INTERRUPT_CNTL, interrupt_cntl);
 }
 
+static void
+nbio_v7_11_5_update_medium_grain_clock_gating(struct amdgpu_device *adev,
+					     bool enable)
+{
+}
+
+static void
+nbio_v7_11_5_update_medium_grain_light_sleep(struct amdgpu_device *adev,
+					    bool enable)
+{
+}
+
+static void
+nbio_v7_11_5_get_clockgating_state(struct amdgpu_device *adev,
+				  u64 *flags)
+{
+}
+
 static u32 nbio_v7_11_5_get_hdp_flush_req_offset(struct amdgpu_device *adev)
 {
 	u32 offset;
@@ -309,6 +327,16 @@ static void nbio_v7_11_5_init_registers(struct amdgpu_device *adev)
 	WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data);
 }
 
+static u32 nbio_v7_11_5_get_rom_offset(struct amdgpu_device *adev)
+{
+	u32 data, rom_offset;
+
+	data = RREG32_SOC15(NBIO, 0, regREGS_ROM_OFFSET_CTRL);
+	rom_offset = REG_GET_FIELD(data, REGS_ROM_OFFSET_CTRL, ROM_OFFSET);
+
+	return rom_offset;
+}
+
 #define MMIO_REG_HOLE_OFFSET (0x80000 - PAGE_SIZE)
 
 static void nbio_v7_11_5_set_reg_remap(struct amdgpu_device *adev)
@@ -337,8 +365,12 @@ const struct amdgpu_nbio_funcs nbio_v7_11_5_funcs = {
 	.enable_doorbell_aperture = nbio_v7_11_5_enable_doorbell_aperture,
 	.enable_doorbell_selfring_aperture = nbio_v7_11_5_enable_doorbell_selfring_aperture,
 	.ih_doorbell_range = nbio_v7_11_5_ih_doorbell_range,
+	.update_medium_grain_clock_gating = nbio_v7_11_5_update_medium_grain_clock_gating,
+	.update_medium_grain_light_sleep = nbio_v7_11_5_update_medium_grain_light_sleep,
+	.get_clockgating_state = nbio_v7_11_5_get_clockgating_state,
 	.ih_control = nbio_v7_11_5_ih_control,
 	.init_registers = nbio_v7_11_5_init_registers,
 	.remap_hdp_registers = nbio_v7_11_5_remap_hdp_registers,
+	.get_rom_offset = nbio_v7_11_5_get_rom_offset,
 	.set_reg_remap = nbio_v7_11_5_set_reg_remap,
 };
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.