forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
....@@ -27,11 +27,8 @@
2727 #include "nbio/nbio_6_1_default.h"
2828 #include "nbio/nbio_6_1_offset.h"
2929 #include "nbio/nbio_6_1_sh_mask.h"
30
+#include "nbio/nbio_6_1_smn.h"
3031 #include "vega10_enum.h"
31
-
32
-#define smnCPM_CONTROL 0x11180460
33
-#define smnPCIE_CNTL2 0x11180070
34
-#define smnPCIE_CONFIG_CNTL 0x11180044
3532
3633 static u32 nbio_v6_1_get_rev_id(struct amdgpu_device *adev)
3734 {
....@@ -71,7 +68,7 @@
7168 }
7269
7370 static void nbio_v6_1_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
74
- bool use_doorbell, int doorbell_index)
71
+ bool use_doorbell, int doorbell_index, int doorbell_size)
7572 {
7673 u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :
7774 SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);
....@@ -80,7 +77,7 @@
8077
8178 if (use_doorbell) {
8279 doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);
83
- doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 2);
80
+ doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);
8481 } else
8582 doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);
8683
....@@ -121,7 +118,8 @@
121118
122119 if (use_doorbell) {
123120 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);
124
- ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 2);
121
+ ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range,
122
+ BIF_IH_DOORBELL_RANGE, SIZE, 6);
125123 } else
126124 ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 0);
127125
....@@ -228,7 +226,7 @@
228226 return SOC15_REG_OFFSET(NBIO, 0, mmPCIE_DATA2);
229227 }
230228
231
-static const struct nbio_hdp_flush_reg nbio_v6_1_hdp_flush_reg = {
229
+const struct nbio_hdp_flush_reg nbio_v6_1_hdp_flush_reg = {
232230 .ref_and_mask_cp0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP0_MASK,
233231 .ref_and_mask_cp1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP1_MASK,
234232 .ref_and_mask_cp2 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP2_MASK,
....@@ -243,23 +241,6 @@
243241 .ref_and_mask_sdma1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA1_MASK
244242 };
245243
246
-static void nbio_v6_1_detect_hw_virt(struct amdgpu_device *adev)
247
-{
248
- uint32_t reg;
249
-
250
- reg = RREG32_SOC15(NBIO, 0, mmRCC_PF_0_0_RCC_IOV_FUNC_IDENTIFIER);
251
- if (reg & 1)
252
- adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
253
-
254
- if (reg & 0x80000000)
255
- adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
256
-
257
- if (!reg) {
258
- if (is_virtual_machine()) /* passthrough mode exclus sriov mod */
259
- adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
260
- }
261
-}
262
-
263244 static void nbio_v6_1_init_registers(struct amdgpu_device *adev)
264245 {
265246 uint32_t def, data;
....@@ -270,10 +251,15 @@
270251
271252 if (def != data)
272253 WREG32_PCIE(smnPCIE_CONFIG_CNTL, data);
254
+
255
+ def = data = RREG32_PCIE(smnPCIE_CI_CNTL);
256
+ data = REG_SET_FIELD(data, PCIE_CI_CNTL, CI_SLV_ORDERING_DIS, 1);
257
+
258
+ if (def != data)
259
+ WREG32_PCIE(smnPCIE_CI_CNTL, data);
273260 }
274261
275262 const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
276
- .hdp_flush_reg = &nbio_v6_1_hdp_flush_reg,
277263 .get_hdp_flush_req_offset = nbio_v6_1_get_hdp_flush_req_offset,
278264 .get_hdp_flush_done_offset = nbio_v6_1_get_hdp_flush_done_offset,
279265 .get_pcie_index_offset = nbio_v6_1_get_pcie_index_offset,
....@@ -291,5 +277,4 @@
291277 .get_clockgating_state = nbio_v6_1_get_clockgating_state,
292278 .ih_control = nbio_v6_1_ih_control,
293279 .init_registers = nbio_v6_1_init_registers,
294
- .detect_hw_virt = nbio_v6_1_detect_hw_virt,
295280 };