Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Advanced Micro Devices, Inc. |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included in |
| 12 | * all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | * |
| 22 | */ |
| 23 | #include <linux/firmware.h> |
| 24 | #include <linux/slab.h> |
| 25 | #include <linux/module.h> |
Alex Deucher | e9eea90 | 2019-07-31 10:39:40 -0500 | [diff] [blame] | 26 | #include <linux/pci.h> |
| 27 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 28 | #include "amdgpu.h" |
| 29 | #include "amdgpu_atombios.h" |
| 30 | #include "amdgpu_ih.h" |
| 31 | #include "amdgpu_uvd.h" |
| 32 | #include "amdgpu_vce.h" |
| 33 | #include "amdgpu_ucode.h" |
| 34 | #include "amdgpu_psp.h" |
Kevin Wang | 767acab | 2019-07-05 15:58:46 -0500 | [diff] [blame] | 35 | #include "amdgpu_smu.h" |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 36 | #include "atom.h" |
| 37 | #include "amd_pcie.h" |
| 38 | |
| 39 | #include "gc/gc_10_1_0_offset.h" |
| 40 | #include "gc/gc_10_1_0_sh_mask.h" |
| 41 | #include "hdp/hdp_5_0_0_offset.h" |
| 42 | #include "hdp/hdp_5_0_0_sh_mask.h" |
Alex Deucher | 29bc37b | 2019-11-13 14:27:54 -0500 | [diff] [blame] | 43 | #include "smuio/smuio_11_0_0_offset.h" |
Alex Deucher | 3967ae6 | 2020-05-28 17:28:17 -0400 | [diff] [blame] | 44 | #include "mp/mp_11_0_offset.h" |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 45 | |
| 46 | #include "soc15.h" |
| 47 | #include "soc15_common.h" |
| 48 | #include "gmc_v10_0.h" |
| 49 | #include "gfxhub_v2_0.h" |
| 50 | #include "mmhub_v2_0.h" |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 51 | #include "nbio_v2_3.h" |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 52 | #include "nv.h" |
| 53 | #include "navi10_ih.h" |
| 54 | #include "gfx_v10_0.h" |
| 55 | #include "sdma_v5_0.h" |
Likun Gao | 157e72e | 2019-06-17 13:38:29 +0800 | [diff] [blame] | 56 | #include "sdma_v5_2.h" |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 57 | #include "vcn_v2_0.h" |
Leo Liu | 5be45a2 | 2019-11-08 15:01:42 -0500 | [diff] [blame] | 58 | #include "jpeg_v2_0.h" |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 59 | #include "dce_virtual.h" |
| 60 | #include "mes_v10_1.h" |
Jiange Zhao | b05b690 | 2019-09-11 17:29:07 +0800 | [diff] [blame] | 61 | #include "mxgpu_nv.h" |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 62 | |
| 63 | static const struct amd_ip_funcs nv_common_ip_funcs; |
| 64 | |
| 65 | /* |
| 66 | * Indirect registers accessor |
| 67 | */ |
| 68 | static u32 nv_pcie_rreg(struct amdgpu_device *adev, u32 reg) |
| 69 | { |
| 70 | unsigned long flags, address, data; |
| 71 | u32 r; |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 72 | address = adev->nbio.funcs->get_pcie_index_offset(adev); |
| 73 | data = adev->nbio.funcs->get_pcie_data_offset(adev); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 74 | |
| 75 | spin_lock_irqsave(&adev->pcie_idx_lock, flags); |
| 76 | WREG32(address, reg); |
| 77 | (void)RREG32(address); |
| 78 | r = RREG32(data); |
| 79 | spin_unlock_irqrestore(&adev->pcie_idx_lock, flags); |
| 80 | return r; |
| 81 | } |
| 82 | |
| 83 | static void nv_pcie_wreg(struct amdgpu_device *adev, u32 reg, u32 v) |
| 84 | { |
| 85 | unsigned long flags, address, data; |
| 86 | |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 87 | address = adev->nbio.funcs->get_pcie_index_offset(adev); |
| 88 | data = adev->nbio.funcs->get_pcie_data_offset(adev); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 89 | |
| 90 | spin_lock_irqsave(&adev->pcie_idx_lock, flags); |
| 91 | WREG32(address, reg); |
| 92 | (void)RREG32(address); |
| 93 | WREG32(data, v); |
| 94 | (void)RREG32(data); |
| 95 | spin_unlock_irqrestore(&adev->pcie_idx_lock, flags); |
| 96 | } |
| 97 | |
| 98 | static u32 nv_didt_rreg(struct amdgpu_device *adev, u32 reg) |
| 99 | { |
| 100 | unsigned long flags, address, data; |
| 101 | u32 r; |
| 102 | |
| 103 | address = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_INDEX); |
| 104 | data = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_DATA); |
| 105 | |
| 106 | spin_lock_irqsave(&adev->didt_idx_lock, flags); |
| 107 | WREG32(address, (reg)); |
| 108 | r = RREG32(data); |
| 109 | spin_unlock_irqrestore(&adev->didt_idx_lock, flags); |
| 110 | return r; |
| 111 | } |
| 112 | |
| 113 | static void nv_didt_wreg(struct amdgpu_device *adev, u32 reg, u32 v) |
| 114 | { |
| 115 | unsigned long flags, address, data; |
| 116 | |
| 117 | address = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_INDEX); |
| 118 | data = SOC15_REG_OFFSET(GC, 0, mmDIDT_IND_DATA); |
| 119 | |
| 120 | spin_lock_irqsave(&adev->didt_idx_lock, flags); |
| 121 | WREG32(address, (reg)); |
| 122 | WREG32(data, (v)); |
| 123 | spin_unlock_irqrestore(&adev->didt_idx_lock, flags); |
| 124 | } |
| 125 | |
| 126 | static u32 nv_get_config_memsize(struct amdgpu_device *adev) |
| 127 | { |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 128 | return adev->nbio.funcs->get_memsize(adev); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | static u32 nv_get_xclk(struct amdgpu_device *adev) |
| 132 | { |
Tao Zhou | 462a70d | 2019-05-14 11:37:32 +0800 | [diff] [blame] | 133 | return adev->clock.spll.reference_freq; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | |
| 137 | void nv_grbm_select(struct amdgpu_device *adev, |
| 138 | u32 me, u32 pipe, u32 queue, u32 vmid) |
| 139 | { |
| 140 | u32 grbm_gfx_cntl = 0; |
| 141 | grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, PIPEID, pipe); |
| 142 | grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, MEID, me); |
| 143 | grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, VMID, vmid); |
| 144 | grbm_gfx_cntl = REG_SET_FIELD(grbm_gfx_cntl, GRBM_GFX_CNTL, QUEUEID, queue); |
| 145 | |
| 146 | WREG32(SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_CNTL), grbm_gfx_cntl); |
| 147 | } |
| 148 | |
| 149 | static void nv_vga_set_state(struct amdgpu_device *adev, bool state) |
| 150 | { |
| 151 | /* todo */ |
| 152 | } |
| 153 | |
| 154 | static bool nv_read_disabled_bios(struct amdgpu_device *adev) |
| 155 | { |
| 156 | /* todo */ |
| 157 | return false; |
| 158 | } |
| 159 | |
| 160 | static bool nv_read_bios_from_rom(struct amdgpu_device *adev, |
| 161 | u8 *bios, u32 length_bytes) |
| 162 | { |
Alex Deucher | 29bc37b | 2019-11-13 14:27:54 -0500 | [diff] [blame] | 163 | u32 *dw_ptr; |
| 164 | u32 i, length_dw; |
| 165 | |
| 166 | if (bios == NULL) |
| 167 | return false; |
| 168 | if (length_bytes == 0) |
| 169 | return false; |
| 170 | /* APU vbios image is part of sbios image */ |
| 171 | if (adev->flags & AMD_IS_APU) |
| 172 | return false; |
| 173 | |
| 174 | dw_ptr = (u32 *)bios; |
| 175 | length_dw = ALIGN(length_bytes, 4) / 4; |
| 176 | |
| 177 | /* set rom index to 0 */ |
| 178 | WREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX), 0); |
| 179 | /* read out the rom data */ |
| 180 | for (i = 0; i < length_dw; i++) |
| 181 | dw_ptr[i] = RREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA)); |
| 182 | |
| 183 | return true; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | static struct soc15_allowed_register_entry nv_allowed_read_registers[] = { |
| 187 | { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS)}, |
| 188 | { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS2)}, |
| 189 | { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS_SE0)}, |
| 190 | { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS_SE1)}, |
| 191 | { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS_SE2)}, |
| 192 | { SOC15_REG_ENTRY(GC, 0, mmGRBM_STATUS_SE3)}, |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 193 | { SOC15_REG_ENTRY(SDMA0, 0, mmSDMA0_STATUS_REG)}, |
| 194 | { SOC15_REG_ENTRY(SDMA1, 0, mmSDMA1_STATUS_REG)}, |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 195 | { SOC15_REG_ENTRY(GC, 0, mmCP_STAT)}, |
| 196 | { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT1)}, |
| 197 | { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT2)}, |
| 198 | { SOC15_REG_ENTRY(GC, 0, mmCP_STALLED_STAT3)}, |
| 199 | { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_BUSY_STAT)}, |
| 200 | { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STALLED_STAT1)}, |
| 201 | { SOC15_REG_ENTRY(GC, 0, mmCP_CPF_STATUS)}, |
Marek Olšák | 664fe85 | 2019-10-22 17:22:38 -0400 | [diff] [blame] | 202 | { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_BUSY_STAT)}, |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 203 | { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STALLED_STAT1)}, |
| 204 | { SOC15_REG_ENTRY(GC, 0, mmCP_CPC_STATUS)}, |
| 205 | { SOC15_REG_ENTRY(GC, 0, mmGB_ADDR_CONFIG)}, |
| 206 | }; |
| 207 | |
| 208 | static uint32_t nv_read_indexed_register(struct amdgpu_device *adev, u32 se_num, |
| 209 | u32 sh_num, u32 reg_offset) |
| 210 | { |
| 211 | uint32_t val; |
| 212 | |
| 213 | mutex_lock(&adev->grbm_idx_mutex); |
| 214 | if (se_num != 0xffffffff || sh_num != 0xffffffff) |
| 215 | amdgpu_gfx_select_se_sh(adev, se_num, sh_num, 0xffffffff); |
| 216 | |
| 217 | val = RREG32(reg_offset); |
| 218 | |
| 219 | if (se_num != 0xffffffff || sh_num != 0xffffffff) |
| 220 | amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); |
| 221 | mutex_unlock(&adev->grbm_idx_mutex); |
| 222 | return val; |
| 223 | } |
| 224 | |
| 225 | static uint32_t nv_get_register_value(struct amdgpu_device *adev, |
| 226 | bool indexed, u32 se_num, |
| 227 | u32 sh_num, u32 reg_offset) |
| 228 | { |
| 229 | if (indexed) { |
| 230 | return nv_read_indexed_register(adev, se_num, sh_num, reg_offset); |
| 231 | } else { |
| 232 | if (reg_offset == SOC15_REG_OFFSET(GC, 0, mmGB_ADDR_CONFIG)) |
| 233 | return adev->gfx.config.gb_addr_config; |
| 234 | return RREG32(reg_offset); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | static int nv_read_register(struct amdgpu_device *adev, u32 se_num, |
| 239 | u32 sh_num, u32 reg_offset, u32 *value) |
| 240 | { |
| 241 | uint32_t i; |
| 242 | struct soc15_allowed_register_entry *en; |
| 243 | |
| 244 | *value = 0; |
| 245 | for (i = 0; i < ARRAY_SIZE(nv_allowed_read_registers); i++) { |
| 246 | en = &nv_allowed_read_registers[i]; |
| 247 | if (reg_offset != |
| 248 | (adev->reg_offset[en->hwip][en->inst][en->seg] + en->reg_offset)) |
| 249 | continue; |
| 250 | |
| 251 | *value = nv_get_register_value(adev, |
| 252 | nv_allowed_read_registers[i].grbm_indexed, |
| 253 | se_num, sh_num, reg_offset); |
| 254 | return 0; |
| 255 | } |
| 256 | return -EINVAL; |
| 257 | } |
| 258 | |
Kevin Wang | 3e2bb60 | 2019-07-05 12:51:45 +0800 | [diff] [blame] | 259 | static int nv_asic_mode1_reset(struct amdgpu_device *adev) |
| 260 | { |
| 261 | u32 i; |
| 262 | int ret = 0; |
| 263 | |
| 264 | amdgpu_atombios_scratch_regs_engine_hung(adev, true); |
| 265 | |
| 266 | dev_info(adev->dev, "GPU mode1 reset\n"); |
| 267 | |
| 268 | /* disable BM */ |
| 269 | pci_clear_master(adev->pdev); |
| 270 | |
| 271 | pci_save_state(adev->pdev); |
| 272 | |
| 273 | ret = psp_gpu_reset(adev); |
| 274 | if (ret) |
| 275 | dev_err(adev->dev, "GPU mode1 reset failed\n"); |
| 276 | |
| 277 | pci_restore_state(adev->pdev); |
| 278 | |
| 279 | /* wait for asic to come out of reset */ |
| 280 | for (i = 0; i < adev->usec_timeout; i++) { |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 281 | u32 memsize = adev->nbio.funcs->get_memsize(adev); |
Kevin Wang | 3e2bb60 | 2019-07-05 12:51:45 +0800 | [diff] [blame] | 282 | |
| 283 | if (memsize != 0xffffffff) |
| 284 | break; |
| 285 | udelay(1); |
| 286 | } |
| 287 | |
| 288 | amdgpu_atombios_scratch_regs_engine_hung(adev, false); |
| 289 | |
| 290 | return ret; |
| 291 | } |
Alex Deucher | 2ddc6c3 | 2019-07-23 23:48:21 -0500 | [diff] [blame] | 292 | |
Alex Deucher | ac74261 | 2019-11-07 18:12:17 -0500 | [diff] [blame] | 293 | static bool nv_asic_supports_baco(struct amdgpu_device *adev) |
| 294 | { |
| 295 | struct smu_context *smu = &adev->smu; |
| 296 | |
| 297 | if (smu_baco_is_support(smu)) |
| 298 | return true; |
| 299 | else |
| 300 | return false; |
| 301 | } |
| 302 | |
Alex Deucher | 2ddc6c3 | 2019-07-23 23:48:21 -0500 | [diff] [blame] | 303 | static enum amd_reset_method |
| 304 | nv_asic_reset_method(struct amdgpu_device *adev) |
| 305 | { |
| 306 | struct smu_context *smu = &adev->smu; |
| 307 | |
Jiange Zhao | b4def37 | 2019-10-28 18:04:14 +0800 | [diff] [blame] | 308 | if (!amdgpu_sriov_vf(adev) && smu_baco_is_support(smu)) |
Alex Deucher | 2ddc6c3 | 2019-07-23 23:48:21 -0500 | [diff] [blame] | 309 | return AMD_RESET_METHOD_BACO; |
| 310 | else |
| 311 | return AMD_RESET_METHOD_MODE1; |
| 312 | } |
| 313 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 314 | static int nv_asic_reset(struct amdgpu_device *adev) |
| 315 | { |
Kevin Wang | 767acab | 2019-07-05 15:58:46 -0500 | [diff] [blame] | 316 | int ret = 0; |
| 317 | struct smu_context *smu = &adev->smu; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 318 | |
Monk Liu | e352625 | 2019-08-27 16:32:55 +0800 | [diff] [blame] | 319 | if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) { |
Alex Deucher | 11520f2 | 2019-10-28 15:20:03 -0400 | [diff] [blame] | 320 | ret = smu_baco_enter(smu); |
| 321 | if (ret) |
| 322 | return ret; |
| 323 | ret = smu_baco_exit(smu); |
| 324 | if (ret) |
| 325 | return ret; |
Monk Liu | e352625 | 2019-08-27 16:32:55 +0800 | [diff] [blame] | 326 | } else { |
Kevin Wang | 3e2bb60 | 2019-07-05 12:51:45 +0800 | [diff] [blame] | 327 | ret = nv_asic_mode1_reset(adev); |
Monk Liu | e352625 | 2019-08-27 16:32:55 +0800 | [diff] [blame] | 328 | } |
Kevin Wang | 767acab | 2019-07-05 15:58:46 -0500 | [diff] [blame] | 329 | |
| 330 | return ret; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | static int nv_set_uvd_clocks(struct amdgpu_device *adev, u32 vclk, u32 dclk) |
| 334 | { |
| 335 | /* todo */ |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk) |
| 340 | { |
| 341 | /* todo */ |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | static void nv_pcie_gen3_enable(struct amdgpu_device *adev) |
| 346 | { |
| 347 | if (pci_is_root_bus(adev->pdev->bus)) |
| 348 | return; |
| 349 | |
| 350 | if (amdgpu_pcie_gen2 == 0) |
| 351 | return; |
| 352 | |
| 353 | if (!(adev->pm.pcie_gen_mask & (CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 | |
| 354 | CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3))) |
| 355 | return; |
| 356 | |
| 357 | /* todo */ |
| 358 | } |
| 359 | |
| 360 | static void nv_program_aspm(struct amdgpu_device *adev) |
| 361 | { |
| 362 | |
| 363 | if (amdgpu_aspm == 0) |
| 364 | return; |
| 365 | |
| 366 | /* todo */ |
| 367 | } |
| 368 | |
| 369 | static void nv_enable_doorbell_aperture(struct amdgpu_device *adev, |
| 370 | bool enable) |
| 371 | { |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 372 | adev->nbio.funcs->enable_doorbell_aperture(adev, enable); |
| 373 | adev->nbio.funcs->enable_doorbell_selfring_aperture(adev, enable); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 374 | } |
| 375 | |
| 376 | static const struct amdgpu_ip_block_version nv_common_ip_block = |
| 377 | { |
| 378 | .type = AMD_IP_BLOCK_TYPE_COMMON, |
| 379 | .major = 1, |
| 380 | .minor = 0, |
| 381 | .rev = 0, |
| 382 | .funcs = &nv_common_ip_funcs, |
| 383 | }; |
| 384 | |
Xiaojie Yuan | b5c7385 | 2019-08-05 16:19:45 +0800 | [diff] [blame] | 385 | static int nv_reg_base_init(struct amdgpu_device *adev) |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 386 | { |
Xiaojie Yuan | b5c7385 | 2019-08-05 16:19:45 +0800 | [diff] [blame] | 387 | int r; |
| 388 | |
| 389 | if (amdgpu_discovery) { |
| 390 | r = amdgpu_discovery_reg_base_init(adev); |
| 391 | if (r) { |
| 392 | DRM_WARN("failed to init reg base from ip discovery table, " |
| 393 | "fallback to legacy init method\n"); |
| 394 | goto legacy_init; |
| 395 | } |
| 396 | |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | legacy_init: |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 401 | switch (adev->asic_type) { |
| 402 | case CHIP_NAVI10: |
| 403 | navi10_reg_base_init(adev); |
| 404 | break; |
Xiaojie Yuan | a0f6d926 | 2018-12-17 18:24:03 +0800 | [diff] [blame] | 405 | case CHIP_NAVI14: |
| 406 | navi14_reg_base_init(adev); |
| 407 | break; |
Xiaojie Yuan | 03d0a07 | 2019-05-14 15:22:53 +0800 | [diff] [blame] | 408 | case CHIP_NAVI12: |
| 409 | navi12_reg_base_init(adev); |
| 410 | break; |
Likun Gao | dccdbf3 | 2019-11-07 16:28:14 +0800 | [diff] [blame] | 411 | case CHIP_SIENNA_CICHLID: |
| 412 | sienna_cichlid_reg_base_init(adev); |
| 413 | break; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 414 | default: |
| 415 | return -EINVAL; |
| 416 | } |
| 417 | |
Xiaojie Yuan | b5c7385 | 2019-08-05 16:19:45 +0800 | [diff] [blame] | 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | int nv_set_ip_blocks(struct amdgpu_device *adev) |
| 422 | { |
| 423 | int r; |
| 424 | |
Monk Liu | 122078d | 2020-03-04 23:51:51 +0800 | [diff] [blame] | 425 | adev->nbio.funcs = &nbio_v2_3_funcs; |
| 426 | adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg; |
| 427 | |
| 428 | if (amdgpu_sriov_vf(adev)) { |
| 429 | adev->virt.ops = &xgpu_nv_virt_ops; |
| 430 | /* try send GPU_INIT_DATA request to host */ |
| 431 | amdgpu_virt_request_init_data(adev); |
| 432 | } |
| 433 | |
Xiaojie Yuan | b5c7385 | 2019-08-05 16:19:45 +0800 | [diff] [blame] | 434 | /* Set IP register base before any HW register access */ |
| 435 | r = nv_reg_base_init(adev); |
| 436 | if (r) |
| 437 | return r; |
| 438 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 439 | switch (adev->asic_type) { |
| 440 | case CHIP_NAVI10: |
Alex Deucher | d1daf85 | 2019-07-02 14:42:25 -0500 | [diff] [blame] | 441 | case CHIP_NAVI14: |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 442 | amdgpu_device_ip_block_add(adev, &nv_common_ip_block); |
| 443 | amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block); |
| 444 | amdgpu_device_ip_block_add(adev, &navi10_ih_ip_block); |
| 445 | amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block); |
| 446 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP && |
Evan Quan | 9530273 | 2020-01-07 16:57:39 +0800 | [diff] [blame] | 447 | !amdgpu_sriov_vf(adev)) |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 448 | amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); |
| 449 | if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) |
| 450 | amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block); |
Alex Deucher | f8a7976 | 2019-07-05 15:39:39 -0500 | [diff] [blame] | 451 | #if defined(CONFIG_DRM_AMD_DC) |
Harry Wentland | b4f199c | 2019-02-26 16:25:27 -0500 | [diff] [blame] | 452 | else if (amdgpu_device_has_dc_support(adev)) |
| 453 | amdgpu_device_ip_block_add(adev, &dm_ip_block); |
Alex Deucher | f8a7976 | 2019-07-05 15:39:39 -0500 | [diff] [blame] | 454 | #endif |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 455 | amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block); |
| 456 | amdgpu_device_ip_block_add(adev, &sdma_v5_0_ip_block); |
| 457 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT && |
Evan Quan | 9530273 | 2020-01-07 16:57:39 +0800 | [diff] [blame] | 458 | !amdgpu_sriov_vf(adev)) |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 459 | amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); |
| 460 | amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); |
Leo Liu | 5be45a2 | 2019-11-08 15:01:42 -0500 | [diff] [blame] | 461 | amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 462 | if (adev->enable_mes) |
| 463 | amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block); |
| 464 | break; |
Xiaojie Yuan | 44e9e7c | 2019-05-16 19:58:19 +0800 | [diff] [blame] | 465 | case CHIP_NAVI12: |
| 466 | amdgpu_device_ip_block_add(adev, &nv_common_ip_block); |
| 467 | amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block); |
| 468 | amdgpu_device_ip_block_add(adev, &navi10_ih_ip_block); |
Xiaojie Yuan | 6b66ae2 | 2019-07-18 02:54:29 +0800 | [diff] [blame] | 469 | amdgpu_device_ip_block_add(adev, &psp_v11_0_ip_block); |
Monk Liu | 79bebab | 2020-04-22 12:09:16 +0800 | [diff] [blame] | 470 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) |
Xiaojie Yuan | 7f47efe | 2019-07-16 03:26:49 +0800 | [diff] [blame] | 471 | amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); |
Xiaojie Yuan | 7990202 | 2019-06-26 19:19:57 +0800 | [diff] [blame] | 472 | if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) |
| 473 | amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block); |
Petr Cvek | 20c14ee | 2019-08-30 16:31:58 +0200 | [diff] [blame] | 474 | #if defined(CONFIG_DRM_AMD_DC) |
Leo Li | 078655d9 | 2019-07-16 18:12:13 -0400 | [diff] [blame] | 475 | else if (amdgpu_device_has_dc_support(adev)) |
| 476 | amdgpu_device_ip_block_add(adev, &dm_ip_block); |
Petr Cvek | 20c14ee | 2019-08-30 16:31:58 +0200 | [diff] [blame] | 477 | #endif |
Xiaojie Yuan | 44e9e7c | 2019-05-16 19:58:19 +0800 | [diff] [blame] | 478 | amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block); |
| 479 | amdgpu_device_ip_block_add(adev, &sdma_v5_0_ip_block); |
Xiaojie Yuan | 7f47efe | 2019-07-16 03:26:49 +0800 | [diff] [blame] | 480 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT && |
Evan Quan | 9530273 | 2020-01-07 16:57:39 +0800 | [diff] [blame] | 481 | !amdgpu_sriov_vf(adev)) |
Xiaojie Yuan | 7f47efe | 2019-07-16 03:26:49 +0800 | [diff] [blame] | 482 | amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); |
Boyuan Zhang | 1fbed28 | 2019-07-18 10:13:23 -0400 | [diff] [blame] | 483 | amdgpu_device_ip_block_add(adev, &vcn_v2_0_ip_block); |
Monk Liu | fe44249 | 2020-03-05 21:10:03 +0800 | [diff] [blame] | 484 | if (!amdgpu_sriov_vf(adev)) |
| 485 | amdgpu_device_ip_block_add(adev, &jpeg_v2_0_ip_block); |
Xiaojie Yuan | 44e9e7c | 2019-05-16 19:58:19 +0800 | [diff] [blame] | 486 | break; |
Likun Gao | 2e1ba10 | 2019-04-18 13:49:07 +0800 | [diff] [blame] | 487 | case CHIP_SIENNA_CICHLID: |
| 488 | amdgpu_device_ip_block_add(adev, &nv_common_ip_block); |
Likun Gao | 0b3df16 | 2019-06-16 22:34:59 +0800 | [diff] [blame] | 489 | amdgpu_device_ip_block_add(adev, &gmc_v10_0_ip_block); |
Likun Gao | 757b3af | 2019-06-16 22:37:56 +0800 | [diff] [blame] | 490 | amdgpu_device_ip_block_add(adev, &navi10_ih_ip_block); |
Likun Gao | b07e5c6 | 2020-03-24 16:24:44 -0400 | [diff] [blame^] | 491 | if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP && |
| 492 | is_support_sw_smu(adev)) |
| 493 | amdgpu_device_ip_block_add(adev, &smu_v11_0_ip_block); |
Likun Gao | 9a98676 | 2019-08-14 17:39:03 +0800 | [diff] [blame] | 494 | if (adev->enable_virtual_display || amdgpu_sriov_vf(adev)) |
| 495 | amdgpu_device_ip_block_add(adev, &dce_virtual_ip_block); |
Likun Gao | 933c8a9 | 2020-05-01 10:21:23 -0400 | [diff] [blame] | 496 | amdgpu_device_ip_block_add(adev, &gfx_v10_0_ip_block); |
Likun Gao | 157e72e | 2019-06-17 13:38:29 +0800 | [diff] [blame] | 497 | amdgpu_device_ip_block_add(adev, &sdma_v5_2_ip_block); |
Likun Gao | 2e1ba10 | 2019-04-18 13:49:07 +0800 | [diff] [blame] | 498 | break; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 499 | default: |
| 500 | return -EINVAL; |
| 501 | } |
| 502 | |
| 503 | return 0; |
| 504 | } |
| 505 | |
| 506 | static uint32_t nv_get_rev_id(struct amdgpu_device *adev) |
| 507 | { |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 508 | return adev->nbio.funcs->get_rev_id(adev); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 509 | } |
| 510 | |
| 511 | static void nv_flush_hdp(struct amdgpu_device *adev, struct amdgpu_ring *ring) |
| 512 | { |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 513 | adev->nbio.funcs->hdp_flush(adev, ring); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | static void nv_invalidate_hdp(struct amdgpu_device *adev, |
| 517 | struct amdgpu_ring *ring) |
| 518 | { |
| 519 | if (!ring || !ring->funcs->emit_wreg) { |
| 520 | WREG32_SOC15_NO_KIQ(NBIO, 0, mmHDP_READ_CACHE_INVALIDATE, 1); |
| 521 | } else { |
| 522 | amdgpu_ring_emit_wreg(ring, SOC15_REG_OFFSET( |
| 523 | HDP, 0, mmHDP_READ_CACHE_INVALIDATE), 1); |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | static bool nv_need_full_reset(struct amdgpu_device *adev) |
| 528 | { |
| 529 | return true; |
| 530 | } |
| 531 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 532 | static bool nv_need_reset_on_init(struct amdgpu_device *adev) |
| 533 | { |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 534 | u32 sol_reg; |
| 535 | |
| 536 | if (adev->flags & AMD_IS_APU) |
| 537 | return false; |
| 538 | |
| 539 | /* Check sOS sign of life register to confirm sys driver and sOS |
| 540 | * are already been loaded. |
| 541 | */ |
| 542 | sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); |
| 543 | if (sol_reg) |
| 544 | return true; |
Alex Deucher | 3967ae6 | 2020-05-28 17:28:17 -0400 | [diff] [blame] | 545 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 546 | return false; |
| 547 | } |
| 548 | |
Kevin Wang | 2af81531 | 2019-11-05 18:53:30 +0800 | [diff] [blame] | 549 | static uint64_t nv_get_pcie_replay_count(struct amdgpu_device *adev) |
| 550 | { |
| 551 | |
| 552 | /* TODO |
| 553 | * dummy implement for pcie_replay_count sysfs interface |
| 554 | * */ |
| 555 | |
| 556 | return 0; |
| 557 | } |
| 558 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 559 | static void nv_init_doorbell_index(struct amdgpu_device *adev) |
| 560 | { |
| 561 | adev->doorbell_index.kiq = AMDGPU_NAVI10_DOORBELL_KIQ; |
| 562 | adev->doorbell_index.mec_ring0 = AMDGPU_NAVI10_DOORBELL_MEC_RING0; |
| 563 | adev->doorbell_index.mec_ring1 = AMDGPU_NAVI10_DOORBELL_MEC_RING1; |
| 564 | adev->doorbell_index.mec_ring2 = AMDGPU_NAVI10_DOORBELL_MEC_RING2; |
| 565 | adev->doorbell_index.mec_ring3 = AMDGPU_NAVI10_DOORBELL_MEC_RING3; |
| 566 | adev->doorbell_index.mec_ring4 = AMDGPU_NAVI10_DOORBELL_MEC_RING4; |
| 567 | adev->doorbell_index.mec_ring5 = AMDGPU_NAVI10_DOORBELL_MEC_RING5; |
| 568 | adev->doorbell_index.mec_ring6 = AMDGPU_NAVI10_DOORBELL_MEC_RING6; |
| 569 | adev->doorbell_index.mec_ring7 = AMDGPU_NAVI10_DOORBELL_MEC_RING7; |
| 570 | adev->doorbell_index.userqueue_start = AMDGPU_NAVI10_DOORBELL_USERQUEUE_START; |
| 571 | adev->doorbell_index.userqueue_end = AMDGPU_NAVI10_DOORBELL_USERQUEUE_END; |
| 572 | adev->doorbell_index.gfx_ring0 = AMDGPU_NAVI10_DOORBELL_GFX_RING0; |
| 573 | adev->doorbell_index.gfx_ring1 = AMDGPU_NAVI10_DOORBELL_GFX_RING1; |
| 574 | adev->doorbell_index.sdma_engine[0] = AMDGPU_NAVI10_DOORBELL_sDMA_ENGINE0; |
| 575 | adev->doorbell_index.sdma_engine[1] = AMDGPU_NAVI10_DOORBELL_sDMA_ENGINE1; |
Likun Gao | 157e72e | 2019-06-17 13:38:29 +0800 | [diff] [blame] | 576 | adev->doorbell_index.sdma_engine[2] = AMDGPU_NAVI10_DOORBELL_sDMA_ENGINE2; |
| 577 | adev->doorbell_index.sdma_engine[3] = AMDGPU_NAVI10_DOORBELL_sDMA_ENGINE3; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 578 | adev->doorbell_index.ih = AMDGPU_NAVI10_DOORBELL_IH; |
| 579 | adev->doorbell_index.vcn.vcn_ring0_1 = AMDGPU_NAVI10_DOORBELL64_VCN0_1; |
| 580 | adev->doorbell_index.vcn.vcn_ring2_3 = AMDGPU_NAVI10_DOORBELL64_VCN2_3; |
| 581 | adev->doorbell_index.vcn.vcn_ring4_5 = AMDGPU_NAVI10_DOORBELL64_VCN4_5; |
| 582 | adev->doorbell_index.vcn.vcn_ring6_7 = AMDGPU_NAVI10_DOORBELL64_VCN6_7; |
| 583 | adev->doorbell_index.first_non_cp = AMDGPU_NAVI10_DOORBELL64_FIRST_NON_CP; |
| 584 | adev->doorbell_index.last_non_cp = AMDGPU_NAVI10_DOORBELL64_LAST_NON_CP; |
| 585 | |
| 586 | adev->doorbell_index.max_assignment = AMDGPU_NAVI10_DOORBELL_MAX_ASSIGNMENT << 1; |
| 587 | adev->doorbell_index.sdma_doorbell_range = 20; |
| 588 | } |
| 589 | |
| 590 | static const struct amdgpu_asic_funcs nv_asic_funcs = |
| 591 | { |
| 592 | .read_disabled_bios = &nv_read_disabled_bios, |
| 593 | .read_bios_from_rom = &nv_read_bios_from_rom, |
| 594 | .read_register = &nv_read_register, |
| 595 | .reset = &nv_asic_reset, |
Alex Deucher | 2ddc6c3 | 2019-07-23 23:48:21 -0500 | [diff] [blame] | 596 | .reset_method = &nv_asic_reset_method, |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 597 | .set_vga_state = &nv_vga_set_state, |
| 598 | .get_xclk = &nv_get_xclk, |
| 599 | .set_uvd_clocks = &nv_set_uvd_clocks, |
| 600 | .set_vce_clocks = &nv_set_vce_clocks, |
| 601 | .get_config_memsize = &nv_get_config_memsize, |
| 602 | .flush_hdp = &nv_flush_hdp, |
| 603 | .invalidate_hdp = &nv_invalidate_hdp, |
| 604 | .init_doorbell_index = &nv_init_doorbell_index, |
| 605 | .need_full_reset = &nv_need_full_reset, |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 606 | .need_reset_on_init = &nv_need_reset_on_init, |
Kevin Wang | 2af81531 | 2019-11-05 18:53:30 +0800 | [diff] [blame] | 607 | .get_pcie_replay_count = &nv_get_pcie_replay_count, |
Alex Deucher | ac74261 | 2019-11-07 18:12:17 -0500 | [diff] [blame] | 608 | .supports_baco = &nv_asic_supports_baco, |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 609 | }; |
| 610 | |
| 611 | static int nv_common_early_init(void *handle) |
| 612 | { |
Yong Zhao | 923c087 | 2019-09-27 23:30:05 -0400 | [diff] [blame] | 613 | #define MMIO_REG_HOLE_OFFSET (0x80000 - PAGE_SIZE) |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 614 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 615 | |
Yong Zhao | 923c087 | 2019-09-27 23:30:05 -0400 | [diff] [blame] | 616 | adev->rmmio_remap.reg_offset = MMIO_REG_HOLE_OFFSET; |
| 617 | adev->rmmio_remap.bus_addr = adev->rmmio_base + MMIO_REG_HOLE_OFFSET; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 618 | adev->smc_rreg = NULL; |
| 619 | adev->smc_wreg = NULL; |
| 620 | adev->pcie_rreg = &nv_pcie_rreg; |
| 621 | adev->pcie_wreg = &nv_pcie_wreg; |
| 622 | |
| 623 | /* TODO: will add them during VCN v2 implementation */ |
| 624 | adev->uvd_ctx_rreg = NULL; |
| 625 | adev->uvd_ctx_wreg = NULL; |
| 626 | |
| 627 | adev->didt_rreg = &nv_didt_rreg; |
| 628 | adev->didt_wreg = &nv_didt_wreg; |
| 629 | |
| 630 | adev->asic_funcs = &nv_asic_funcs; |
| 631 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 632 | adev->rev_id = nv_get_rev_id(adev); |
| 633 | adev->external_rev_id = 0xff; |
| 634 | switch (adev->asic_type) { |
| 635 | case CHIP_NAVI10: |
| 636 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 637 | AMD_CG_SUPPORT_GFX_CGCG | |
| 638 | AMD_CG_SUPPORT_IH_CG | |
| 639 | AMD_CG_SUPPORT_HDP_MGCG | |
| 640 | AMD_CG_SUPPORT_HDP_LS | |
| 641 | AMD_CG_SUPPORT_SDMA_MGCG | |
| 642 | AMD_CG_SUPPORT_SDMA_LS | |
| 643 | AMD_CG_SUPPORT_MC_MGCG | |
| 644 | AMD_CG_SUPPORT_MC_LS | |
| 645 | AMD_CG_SUPPORT_ATHUB_MGCG | |
| 646 | AMD_CG_SUPPORT_ATHUB_LS | |
| 647 | AMD_CG_SUPPORT_VCN_MGCG | |
Leo Liu | 099d66e | 2019-11-11 15:09:25 -0500 | [diff] [blame] | 648 | AMD_CG_SUPPORT_JPEG_MGCG | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 649 | AMD_CG_SUPPORT_BIF_MGCG | |
| 650 | AMD_CG_SUPPORT_BIF_LS; |
Leo Liu | 157710e | 2019-05-15 13:58:20 -0400 | [diff] [blame] | 651 | adev->pg_flags = AMD_PG_SUPPORT_VCN | |
Huang Rui | c12d410 | 2019-06-14 16:12:51 +0800 | [diff] [blame] | 652 | AMD_PG_SUPPORT_VCN_DPG | |
Leo Liu | 099d66e | 2019-11-11 15:09:25 -0500 | [diff] [blame] | 653 | AMD_PG_SUPPORT_JPEG | |
Huang Rui | a201b6a | 2019-06-14 16:19:36 +0800 | [diff] [blame] | 654 | AMD_PG_SUPPORT_ATHUB; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 655 | adev->external_rev_id = adev->rev_id + 0x1; |
| 656 | break; |
Xiaojie Yuan | 5e71e01 | 2018-12-17 18:23:27 +0800 | [diff] [blame] | 657 | case CHIP_NAVI14: |
Xiaojie Yuan | d0c39f8 | 2019-03-20 16:12:54 +0800 | [diff] [blame] | 658 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
| 659 | AMD_CG_SUPPORT_GFX_CGCG | |
| 660 | AMD_CG_SUPPORT_IH_CG | |
| 661 | AMD_CG_SUPPORT_HDP_MGCG | |
| 662 | AMD_CG_SUPPORT_HDP_LS | |
| 663 | AMD_CG_SUPPORT_SDMA_MGCG | |
| 664 | AMD_CG_SUPPORT_SDMA_LS | |
| 665 | AMD_CG_SUPPORT_MC_MGCG | |
| 666 | AMD_CG_SUPPORT_MC_LS | |
| 667 | AMD_CG_SUPPORT_ATHUB_MGCG | |
| 668 | AMD_CG_SUPPORT_ATHUB_LS | |
| 669 | AMD_CG_SUPPORT_VCN_MGCG | |
Leo Liu | 099d66e | 2019-11-11 15:09:25 -0500 | [diff] [blame] | 670 | AMD_CG_SUPPORT_JPEG_MGCG | |
Xiaojie Yuan | d0c39f8 | 2019-03-20 16:12:54 +0800 | [diff] [blame] | 671 | AMD_CG_SUPPORT_BIF_MGCG | |
| 672 | AMD_CG_SUPPORT_BIF_LS; |
Xiaojie Yuan | 0377b08 | 2019-07-02 12:52:52 -0500 | [diff] [blame] | 673 | adev->pg_flags = AMD_PG_SUPPORT_VCN | |
Leo Liu | 099d66e | 2019-11-11 15:09:25 -0500 | [diff] [blame] | 674 | AMD_PG_SUPPORT_JPEG | |
Xiaojie Yuan | 0377b08 | 2019-07-02 12:52:52 -0500 | [diff] [blame] | 675 | AMD_PG_SUPPORT_VCN_DPG; |
tiancyin | 35ef88f | 2019-08-05 17:32:45 +0800 | [diff] [blame] | 676 | adev->external_rev_id = adev->rev_id + 20; |
Xiaojie Yuan | 5e71e01 | 2018-12-17 18:23:27 +0800 | [diff] [blame] | 677 | break; |
Xiaojie Yuan | 74b5e50 | 2019-05-16 19:47:33 +0800 | [diff] [blame] | 678 | case CHIP_NAVI12: |
Xiaojie Yuan | dca009e | 2019-07-30 11:28:20 +0800 | [diff] [blame] | 679 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
| 680 | AMD_CG_SUPPORT_GFX_MGLS | |
| 681 | AMD_CG_SUPPORT_GFX_CGCG | |
| 682 | AMD_CG_SUPPORT_GFX_CP_LS | |
Xiaojie Yuan | 5211c37 | 2019-08-01 15:00:28 +0800 | [diff] [blame] | 683 | AMD_CG_SUPPORT_GFX_RLC_LS | |
Xiaojie Yuan | fbe0bc5 | 2019-08-01 15:01:23 +0800 | [diff] [blame] | 684 | AMD_CG_SUPPORT_IH_CG | |
Xiaojie Yuan | 5211c37 | 2019-08-01 15:00:28 +0800 | [diff] [blame] | 685 | AMD_CG_SUPPORT_HDP_MGCG | |
Xiaojie Yuan | 358ab97 | 2019-07-30 12:18:55 +0800 | [diff] [blame] | 686 | AMD_CG_SUPPORT_HDP_LS | |
| 687 | AMD_CG_SUPPORT_SDMA_MGCG | |
Xiaojie Yuan | 8b797b3 | 2019-08-01 15:39:59 +0800 | [diff] [blame] | 688 | AMD_CG_SUPPORT_SDMA_LS | |
| 689 | AMD_CG_SUPPORT_MC_MGCG | |
Xiaojie Yuan | ca51678 | 2019-08-01 15:19:10 +0800 | [diff] [blame] | 690 | AMD_CG_SUPPORT_MC_LS | |
| 691 | AMD_CG_SUPPORT_ATHUB_MGCG | |
Xiaojie Yuan | 65872e5 | 2019-08-01 15:22:59 +0800 | [diff] [blame] | 692 | AMD_CG_SUPPORT_ATHUB_LS | |
Leo Liu | 099d66e | 2019-11-11 15:09:25 -0500 | [diff] [blame] | 693 | AMD_CG_SUPPORT_VCN_MGCG | |
| 694 | AMD_CG_SUPPORT_JPEG_MGCG; |
Xiaojie Yuan | c1653ea | 2019-08-27 11:05:23 +0800 | [diff] [blame] | 695 | adev->pg_flags = AMD_PG_SUPPORT_VCN | |
Xiaojie Yuan | 5ef3b8a | 2019-08-27 11:06:13 +0800 | [diff] [blame] | 696 | AMD_PG_SUPPORT_VCN_DPG | |
Leo Liu | 099d66e | 2019-11-11 15:09:25 -0500 | [diff] [blame] | 697 | AMD_PG_SUPPORT_JPEG | |
Xiaojie Yuan | 5ef3b8a | 2019-08-27 11:06:13 +0800 | [diff] [blame] | 698 | AMD_PG_SUPPORT_ATHUB; |
Tiecheng Zhou | df5e984 | 2020-01-08 13:44:29 +0800 | [diff] [blame] | 699 | /* guest vm gets 0xffffffff when reading RCC_DEV0_EPF0_STRAP0, |
| 700 | * as a consequence, the rev_id and external_rev_id are wrong. |
| 701 | * workaround it by hardcoding rev_id to 0 (default value). |
| 702 | */ |
| 703 | if (amdgpu_sriov_vf(adev)) |
| 704 | adev->rev_id = 0; |
Xiaojie Yuan | 74b5e50 | 2019-05-16 19:47:33 +0800 | [diff] [blame] | 705 | adev->external_rev_id = adev->rev_id + 0xa; |
| 706 | break; |
Likun Gao | 117910e | 2019-03-19 11:04:03 +0800 | [diff] [blame] | 707 | case CHIP_SIENNA_CICHLID: |
| 708 | adev->cg_flags = 0; |
| 709 | adev->pg_flags = 0; |
| 710 | adev->external_rev_id = adev->rev_id + 0x28; |
| 711 | break; |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 712 | default: |
| 713 | /* FIXME: not supported yet */ |
| 714 | return -EINVAL; |
| 715 | } |
| 716 | |
Jiange Zhao | b05b690 | 2019-09-11 17:29:07 +0800 | [diff] [blame] | 717 | if (amdgpu_sriov_vf(adev)) { |
| 718 | amdgpu_virt_init_setting(adev); |
| 719 | xgpu_nv_mailbox_set_irq_funcs(adev); |
| 720 | } |
| 721 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 722 | return 0; |
| 723 | } |
| 724 | |
| 725 | static int nv_common_late_init(void *handle) |
| 726 | { |
Jiange Zhao | b05b690 | 2019-09-11 17:29:07 +0800 | [diff] [blame] | 727 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 728 | |
| 729 | if (amdgpu_sriov_vf(adev)) |
| 730 | xgpu_nv_mailbox_get_irq(adev); |
| 731 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 732 | return 0; |
| 733 | } |
| 734 | |
| 735 | static int nv_common_sw_init(void *handle) |
| 736 | { |
Jiange Zhao | b05b690 | 2019-09-11 17:29:07 +0800 | [diff] [blame] | 737 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 738 | |
| 739 | if (amdgpu_sriov_vf(adev)) |
| 740 | xgpu_nv_mailbox_add_irq_id(adev); |
| 741 | |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 742 | return 0; |
| 743 | } |
| 744 | |
| 745 | static int nv_common_sw_fini(void *handle) |
| 746 | { |
| 747 | return 0; |
| 748 | } |
| 749 | |
| 750 | static int nv_common_hw_init(void *handle) |
| 751 | { |
| 752 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 753 | |
| 754 | /* enable pcie gen2/3 link */ |
| 755 | nv_pcie_gen3_enable(adev); |
| 756 | /* enable aspm */ |
| 757 | nv_program_aspm(adev); |
| 758 | /* setup nbio registers */ |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 759 | adev->nbio.funcs->init_registers(adev); |
Yong Zhao | 923c087 | 2019-09-27 23:30:05 -0400 | [diff] [blame] | 760 | /* remap HDP registers to a hole in mmio space, |
| 761 | * for the purpose of expose those registers |
| 762 | * to process space |
| 763 | */ |
| 764 | if (adev->nbio.funcs->remap_hdp_registers) |
| 765 | adev->nbio.funcs->remap_hdp_registers(adev); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 766 | /* enable the doorbell aperture */ |
| 767 | nv_enable_doorbell_aperture(adev, true); |
| 768 | |
| 769 | return 0; |
| 770 | } |
| 771 | |
| 772 | static int nv_common_hw_fini(void *handle) |
| 773 | { |
| 774 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 775 | |
| 776 | /* disable the doorbell aperture */ |
| 777 | nv_enable_doorbell_aperture(adev, false); |
| 778 | |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | static int nv_common_suspend(void *handle) |
| 783 | { |
| 784 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 785 | |
| 786 | return nv_common_hw_fini(adev); |
| 787 | } |
| 788 | |
| 789 | static int nv_common_resume(void *handle) |
| 790 | { |
| 791 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 792 | |
| 793 | return nv_common_hw_init(adev); |
| 794 | } |
| 795 | |
| 796 | static bool nv_common_is_idle(void *handle) |
| 797 | { |
| 798 | return true; |
| 799 | } |
| 800 | |
| 801 | static int nv_common_wait_for_idle(void *handle) |
| 802 | { |
| 803 | return 0; |
| 804 | } |
| 805 | |
| 806 | static int nv_common_soft_reset(void *handle) |
| 807 | { |
| 808 | return 0; |
| 809 | } |
| 810 | |
| 811 | static void nv_update_hdp_mem_power_gating(struct amdgpu_device *adev, |
| 812 | bool enable) |
| 813 | { |
| 814 | uint32_t hdp_clk_cntl, hdp_clk_cntl1; |
| 815 | uint32_t hdp_mem_pwr_cntl; |
| 816 | |
| 817 | if (!(adev->cg_flags & (AMD_CG_SUPPORT_HDP_LS | |
| 818 | AMD_CG_SUPPORT_HDP_DS | |
| 819 | AMD_CG_SUPPORT_HDP_SD))) |
| 820 | return; |
| 821 | |
| 822 | hdp_clk_cntl = hdp_clk_cntl1 = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL); |
| 823 | hdp_mem_pwr_cntl = RREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL); |
| 824 | |
| 825 | /* Before doing clock/power mode switch, |
| 826 | * forced on IPH & RC clock */ |
| 827 | hdp_clk_cntl = REG_SET_FIELD(hdp_clk_cntl, HDP_CLK_CNTL, |
| 828 | IPH_MEM_CLK_SOFT_OVERRIDE, 1); |
| 829 | hdp_clk_cntl = REG_SET_FIELD(hdp_clk_cntl, HDP_CLK_CNTL, |
| 830 | RC_MEM_CLK_SOFT_OVERRIDE, 1); |
| 831 | WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl); |
| 832 | |
| 833 | /* HDP 5.0 doesn't support dynamic power mode switch, |
| 834 | * disable clock and power gating before any changing */ |
| 835 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 836 | IPH_MEM_POWER_CTRL_EN, 0); |
| 837 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 838 | IPH_MEM_POWER_LS_EN, 0); |
| 839 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 840 | IPH_MEM_POWER_DS_EN, 0); |
| 841 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 842 | IPH_MEM_POWER_SD_EN, 0); |
| 843 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 844 | RC_MEM_POWER_CTRL_EN, 0); |
| 845 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 846 | RC_MEM_POWER_LS_EN, 0); |
| 847 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 848 | RC_MEM_POWER_DS_EN, 0); |
| 849 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, HDP_MEM_POWER_CTRL, |
| 850 | RC_MEM_POWER_SD_EN, 0); |
| 851 | WREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); |
| 852 | |
| 853 | /* only one clock gating mode (LS/DS/SD) can be enabled */ |
| 854 | if (adev->cg_flags & AMD_CG_SUPPORT_HDP_LS) { |
| 855 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, |
| 856 | HDP_MEM_POWER_CTRL, |
| 857 | IPH_MEM_POWER_LS_EN, enable); |
| 858 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, |
| 859 | HDP_MEM_POWER_CTRL, |
| 860 | RC_MEM_POWER_LS_EN, enable); |
| 861 | } else if (adev->cg_flags & AMD_CG_SUPPORT_HDP_DS) { |
| 862 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, |
| 863 | HDP_MEM_POWER_CTRL, |
| 864 | IPH_MEM_POWER_DS_EN, enable); |
| 865 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, |
| 866 | HDP_MEM_POWER_CTRL, |
| 867 | RC_MEM_POWER_DS_EN, enable); |
| 868 | } else if (adev->cg_flags & AMD_CG_SUPPORT_HDP_SD) { |
| 869 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, |
| 870 | HDP_MEM_POWER_CTRL, |
| 871 | IPH_MEM_POWER_SD_EN, enable); |
| 872 | /* RC should not use shut down mode, fallback to ds */ |
| 873 | hdp_mem_pwr_cntl = REG_SET_FIELD(hdp_mem_pwr_cntl, |
| 874 | HDP_MEM_POWER_CTRL, |
| 875 | RC_MEM_POWER_DS_EN, enable); |
| 876 | } |
| 877 | |
| 878 | WREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL, hdp_mem_pwr_cntl); |
| 879 | |
| 880 | /* restore IPH & RC clock override after clock/power mode changing */ |
| 881 | WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl1); |
| 882 | } |
| 883 | |
| 884 | static void nv_update_hdp_clock_gating(struct amdgpu_device *adev, |
| 885 | bool enable) |
| 886 | { |
| 887 | uint32_t hdp_clk_cntl; |
| 888 | |
| 889 | if (!(adev->cg_flags & AMD_CG_SUPPORT_HDP_MGCG)) |
| 890 | return; |
| 891 | |
| 892 | hdp_clk_cntl = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL); |
| 893 | |
| 894 | if (enable) { |
| 895 | hdp_clk_cntl &= |
| 896 | ~(uint32_t) |
| 897 | (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK | |
| 898 | HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | |
| 899 | HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | |
| 900 | HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | |
| 901 | HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | |
| 902 | HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK); |
| 903 | } else { |
| 904 | hdp_clk_cntl |= HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK | |
| 905 | HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | |
| 906 | HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | |
| 907 | HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | |
| 908 | HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | |
| 909 | HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK; |
| 910 | } |
| 911 | |
| 912 | WREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL, hdp_clk_cntl); |
| 913 | } |
| 914 | |
| 915 | static int nv_common_set_clockgating_state(void *handle, |
| 916 | enum amd_clockgating_state state) |
| 917 | { |
| 918 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 919 | |
| 920 | if (amdgpu_sriov_vf(adev)) |
| 921 | return 0; |
| 922 | |
| 923 | switch (adev->asic_type) { |
| 924 | case CHIP_NAVI10: |
Xiaojie Yuan | 5e71e01 | 2018-12-17 18:23:27 +0800 | [diff] [blame] | 925 | case CHIP_NAVI14: |
Xiaojie Yuan | 7e17e58 | 2019-05-16 19:51:12 +0800 | [diff] [blame] | 926 | case CHIP_NAVI12: |
Likun Gao | 117910e | 2019-03-19 11:04:03 +0800 | [diff] [blame] | 927 | case CHIP_SIENNA_CICHLID: |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 928 | adev->nbio.funcs->update_medium_grain_clock_gating(adev, |
Nirmoy Das | a9d4fe2 | 2020-01-20 13:54:30 +0100 | [diff] [blame] | 929 | state == AMD_CG_STATE_GATE); |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 930 | adev->nbio.funcs->update_medium_grain_light_sleep(adev, |
Nirmoy Das | a9d4fe2 | 2020-01-20 13:54:30 +0100 | [diff] [blame] | 931 | state == AMD_CG_STATE_GATE); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 932 | nv_update_hdp_mem_power_gating(adev, |
Nirmoy Das | a9d4fe2 | 2020-01-20 13:54:30 +0100 | [diff] [blame] | 933 | state == AMD_CG_STATE_GATE); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 934 | nv_update_hdp_clock_gating(adev, |
Nirmoy Das | a9d4fe2 | 2020-01-20 13:54:30 +0100 | [diff] [blame] | 935 | state == AMD_CG_STATE_GATE); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 936 | break; |
| 937 | default: |
| 938 | break; |
| 939 | } |
| 940 | return 0; |
| 941 | } |
| 942 | |
| 943 | static int nv_common_set_powergating_state(void *handle, |
| 944 | enum amd_powergating_state state) |
| 945 | { |
| 946 | /* TODO */ |
| 947 | return 0; |
| 948 | } |
| 949 | |
| 950 | static void nv_common_get_clockgating_state(void *handle, u32 *flags) |
| 951 | { |
| 952 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 953 | uint32_t tmp; |
| 954 | |
| 955 | if (amdgpu_sriov_vf(adev)) |
| 956 | *flags = 0; |
| 957 | |
Hawking Zhang | bebc076 | 2019-08-23 19:39:18 +0800 | [diff] [blame] | 958 | adev->nbio.funcs->get_clockgating_state(adev, flags); |
Hawking Zhang | c6b6a42 | 2019-03-04 14:07:37 +0800 | [diff] [blame] | 959 | |
| 960 | /* AMD_CG_SUPPORT_HDP_MGCG */ |
| 961 | tmp = RREG32_SOC15(HDP, 0, mmHDP_CLK_CNTL); |
| 962 | if (!(tmp & (HDP_CLK_CNTL__IPH_MEM_CLK_SOFT_OVERRIDE_MASK | |
| 963 | HDP_CLK_CNTL__RC_MEM_CLK_SOFT_OVERRIDE_MASK | |
| 964 | HDP_CLK_CNTL__DBUS_CLK_SOFT_OVERRIDE_MASK | |
| 965 | HDP_CLK_CNTL__DYN_CLK_SOFT_OVERRIDE_MASK | |
| 966 | HDP_CLK_CNTL__XDP_REG_CLK_SOFT_OVERRIDE_MASK | |
| 967 | HDP_CLK_CNTL__HDP_REG_CLK_SOFT_OVERRIDE_MASK))) |
| 968 | *flags |= AMD_CG_SUPPORT_HDP_MGCG; |
| 969 | |
| 970 | /* AMD_CG_SUPPORT_HDP_LS/DS/SD */ |
| 971 | tmp = RREG32_SOC15(HDP, 0, mmHDP_MEM_POWER_CTRL); |
| 972 | if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_LS_EN_MASK) |
| 973 | *flags |= AMD_CG_SUPPORT_HDP_LS; |
| 974 | else if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_DS_EN_MASK) |
| 975 | *flags |= AMD_CG_SUPPORT_HDP_DS; |
| 976 | else if (tmp & HDP_MEM_POWER_CTRL__IPH_MEM_POWER_SD_EN_MASK) |
| 977 | *flags |= AMD_CG_SUPPORT_HDP_SD; |
| 978 | |
| 979 | return; |
| 980 | } |
| 981 | |
| 982 | static const struct amd_ip_funcs nv_common_ip_funcs = { |
| 983 | .name = "nv_common", |
| 984 | .early_init = nv_common_early_init, |
| 985 | .late_init = nv_common_late_init, |
| 986 | .sw_init = nv_common_sw_init, |
| 987 | .sw_fini = nv_common_sw_fini, |
| 988 | .hw_init = nv_common_hw_init, |
| 989 | .hw_fini = nv_common_hw_fini, |
| 990 | .suspend = nv_common_suspend, |
| 991 | .resume = nv_common_resume, |
| 992 | .is_idle = nv_common_is_idle, |
| 993 | .wait_for_idle = nv_common_wait_for_idle, |
| 994 | .soft_reset = nv_common_soft_reset, |
| 995 | .set_clockgating_state = nv_common_set_clockgating_state, |
| 996 | .set_powergating_state = nv_common_set_powergating_state, |
| 997 | .get_clockgating_state = nv_common_get_clockgating_state, |
| 998 | }; |