| .. | .. |
|---|
| 27 | 27 | #include "nbio/nbio_6_1_default.h" |
|---|
| 28 | 28 | #include "nbio/nbio_6_1_offset.h" |
|---|
| 29 | 29 | #include "nbio/nbio_6_1_sh_mask.h" |
|---|
| 30 | +#include "nbio/nbio_6_1_smn.h" |
|---|
| 30 | 31 | #include "vega10_enum.h" |
|---|
| 31 | | - |
|---|
| 32 | | -#define smnCPM_CONTROL 0x11180460 |
|---|
| 33 | | -#define smnPCIE_CNTL2 0x11180070 |
|---|
| 34 | | -#define smnPCIE_CONFIG_CNTL 0x11180044 |
|---|
| 35 | 32 | |
|---|
| 36 | 33 | static u32 nbio_v6_1_get_rev_id(struct amdgpu_device *adev) |
|---|
| 37 | 34 | { |
|---|
| .. | .. |
|---|
| 71 | 68 | } |
|---|
| 72 | 69 | |
|---|
| 73 | 70 | 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) |
|---|
| 75 | 72 | { |
|---|
| 76 | 73 | u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) : |
|---|
| 77 | 74 | SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE); |
|---|
| .. | .. |
|---|
| 80 | 77 | |
|---|
| 81 | 78 | if (use_doorbell) { |
|---|
| 82 | 79 | 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); |
|---|
| 84 | 81 | } else |
|---|
| 85 | 82 | doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0); |
|---|
| 86 | 83 | |
|---|
| .. | .. |
|---|
| 121 | 118 | |
|---|
| 122 | 119 | if (use_doorbell) { |
|---|
| 123 | 120 | 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); |
|---|
| 125 | 123 | } else |
|---|
| 126 | 124 | ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 0); |
|---|
| 127 | 125 | |
|---|
| .. | .. |
|---|
| 228 | 226 | return SOC15_REG_OFFSET(NBIO, 0, mmPCIE_DATA2); |
|---|
| 229 | 227 | } |
|---|
| 230 | 228 | |
|---|
| 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 = { |
|---|
| 232 | 230 | .ref_and_mask_cp0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP0_MASK, |
|---|
| 233 | 231 | .ref_and_mask_cp1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP1_MASK, |
|---|
| 234 | 232 | .ref_and_mask_cp2 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP2_MASK, |
|---|
| .. | .. |
|---|
| 243 | 241 | .ref_and_mask_sdma1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA1_MASK |
|---|
| 244 | 242 | }; |
|---|
| 245 | 243 | |
|---|
| 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 | | - |
|---|
| 263 | 244 | static void nbio_v6_1_init_registers(struct amdgpu_device *adev) |
|---|
| 264 | 245 | { |
|---|
| 265 | 246 | uint32_t def, data; |
|---|
| .. | .. |
|---|
| 270 | 251 | |
|---|
| 271 | 252 | if (def != data) |
|---|
| 272 | 253 | 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); |
|---|
| 273 | 260 | } |
|---|
| 274 | 261 | |
|---|
| 275 | 262 | const struct amdgpu_nbio_funcs nbio_v6_1_funcs = { |
|---|
| 276 | | - .hdp_flush_reg = &nbio_v6_1_hdp_flush_reg, |
|---|
| 277 | 263 | .get_hdp_flush_req_offset = nbio_v6_1_get_hdp_flush_req_offset, |
|---|
| 278 | 264 | .get_hdp_flush_done_offset = nbio_v6_1_get_hdp_flush_done_offset, |
|---|
| 279 | 265 | .get_pcie_index_offset = nbio_v6_1_get_pcie_index_offset, |
|---|
| .. | .. |
|---|
| 291 | 277 | .get_clockgating_state = nbio_v6_1_get_clockgating_state, |
|---|
| 292 | 278 | .ih_control = nbio_v6_1_ih_control, |
|---|
| 293 | 279 | .init_registers = nbio_v6_1_init_registers, |
|---|
| 294 | | - .detect_hw_virt = nbio_v6_1_detect_hw_virt, |
|---|
| 295 | 280 | }; |
|---|