1e60f8db5SAlex Xie /*
2e60f8db5SAlex Xie * Copyright 2016 Advanced Micro Devices, Inc.
3e60f8db5SAlex Xie *
4e60f8db5SAlex Xie * Permission is hereby granted, free of charge, to any person obtaining a
5e60f8db5SAlex Xie * copy of this software and associated documentation files (the "Software"),
6e60f8db5SAlex Xie * to deal in the Software without restriction, including without limitation
7e60f8db5SAlex Xie * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8e60f8db5SAlex Xie * and/or sell copies of the Software, and to permit persons to whom the
9e60f8db5SAlex Xie * Software is furnished to do so, subject to the following conditions:
10e60f8db5SAlex Xie *
11e60f8db5SAlex Xie * The above copyright notice and this permission notice shall be included in
12e60f8db5SAlex Xie * all copies or substantial portions of the Software.
13e60f8db5SAlex Xie *
14e60f8db5SAlex Xie * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15e60f8db5SAlex Xie * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16e60f8db5SAlex Xie * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17e60f8db5SAlex Xie * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18e60f8db5SAlex Xie * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19e60f8db5SAlex Xie * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20e60f8db5SAlex Xie * OTHER DEALINGS IN THE SOFTWARE.
21e60f8db5SAlex Xie *
22e60f8db5SAlex Xie */
23e60f8db5SAlex Xie #include "amdgpu.h"
24d6e0cbb1STao Zhou #include "amdgpu_ras.h"
25e60f8db5SAlex Xie #include "mmhub_v1_0.h"
26e60f8db5SAlex Xie
2765417d9fSFeifei Xu #include "mmhub/mmhub_1_0_offset.h"
2865417d9fSFeifei Xu #include "mmhub/mmhub_1_0_sh_mask.h"
2965417d9fSFeifei Xu #include "mmhub/mmhub_1_0_default.h"
30fb960bd2SFeifei Xu #include "vega10_enum.h"
318781e5dfSDennis Li #include "soc15.h"
32e60f8db5SAlex Xie #include "soc15_common.h"
33e60f8db5SAlex Xie
342547a7aaSHuang Rui #define mmDAGB0_CNTL_MISC2_RV 0x008f
352547a7aaSHuang Rui #define mmDAGB0_CNTL_MISC2_RV_BASE_IDX 0
362547a7aaSHuang Rui
mmhub_v1_0_get_fb_location(struct amdgpu_device * adev)379fb1506eSOak Zeng static u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev)
38e60f8db5SAlex Xie {
392a419183SHuang Rui u64 base = RREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_BASE);
406fdd68b1SAlex Deucher u64 top = RREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_TOP);
41e60f8db5SAlex Xie
42e60f8db5SAlex Xie base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK;
43e60f8db5SAlex Xie base <<= 24;
44e60f8db5SAlex Xie
456fdd68b1SAlex Deucher top &= MC_VM_FB_LOCATION_TOP__FB_TOP_MASK;
466fdd68b1SAlex Deucher top <<= 24;
476fdd68b1SAlex Deucher
486fdd68b1SAlex Deucher adev->gmc.fb_start = base;
496fdd68b1SAlex Deucher adev->gmc.fb_end = top;
506fdd68b1SAlex Deucher
51e60f8db5SAlex Xie return base;
52e60f8db5SAlex Xie }
53e60f8db5SAlex Xie
mmhub_v1_0_setup_vm_pt_regs(struct amdgpu_device * adev,uint32_t vmid,uint64_t page_table_base)549fb1506eSOak Zeng static void mmhub_v1_0_setup_vm_pt_regs(struct amdgpu_device *adev, uint32_t vmid,
55c7ff7be6SYong Zhao uint64_t page_table_base)
56a51dca4fSHuang Rui {
57f4caf584SHawking Zhang struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
58a51dca4fSHuang Rui
59c7ff7be6SYong Zhao WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
601a99460fSHuang Rui hub->ctx_addr_distance * vmid,
611a99460fSHuang Rui lower_32_bits(page_table_base));
62a51dca4fSHuang Rui
63c7ff7be6SYong Zhao WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32,
641a99460fSHuang Rui hub->ctx_addr_distance * vmid,
651a99460fSHuang Rui upper_32_bits(page_table_base));
66a51dca4fSHuang Rui }
67a51dca4fSHuang Rui
mmhub_v1_0_init_gart_aperture_regs(struct amdgpu_device * adev)689bbad6fdSHuang Rui static void mmhub_v1_0_init_gart_aperture_regs(struct amdgpu_device *adev)
699bbad6fdSHuang Rui {
70c7ff7be6SYong Zhao uint64_t pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
71c7ff7be6SYong Zhao
72c7ff7be6SYong Zhao mmhub_v1_0_setup_vm_pt_regs(adev, 0, pt_base);
739bbad6fdSHuang Rui
742a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32,
75770d13b1SChristian König (u32)(adev->gmc.gart_start >> 12));
762a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32,
77770d13b1SChristian König (u32)(adev->gmc.gart_start >> 44));
789bbad6fdSHuang Rui
792a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
80770d13b1SChristian König (u32)(adev->gmc.gart_end >> 12));
812a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32,
82770d13b1SChristian König (u32)(adev->gmc.gart_end >> 44));
839bbad6fdSHuang Rui }
849bbad6fdSHuang Rui
mmhub_v1_0_init_system_aperture_regs(struct amdgpu_device * adev)85fc4b884bSHuang Rui static void mmhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
86e60f8db5SAlex Xie {
87fc4b884bSHuang Rui uint64_t value;
88fc4b884bSHuang Rui uint32_t tmp;
89e60f8db5SAlex Xie
90c3e1b43cSChristian König /* Program the AGP BAR */
912a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BASE, 0);
92c3e1b43cSChristian König WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
93c3e1b43cSChristian König WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
94a51dca4fSHuang Rui
95fc4b884bSHuang Rui /* Program the system aperture low logical page number. */
962a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
975581c670Sshaoyunl min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
9876006776SHuang Rui
99*16783d8eSAlex Deucher if (adev->apu_flags & (AMD_APU_IS_RAVEN2 |
100*16783d8eSAlex Deucher AMD_APU_IS_RENOIR |
101*16783d8eSAlex Deucher AMD_APU_IS_GREEN_SARDINE))
10276006776SHuang Rui /*
10376006776SHuang Rui * Raven2 has a HW issue that it is unable to use the vram which
10476006776SHuang Rui * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
10576006776SHuang Rui * workaround that increase system aperture high address (add 1)
10676006776SHuang Rui * to get rid of the VM fault and hardware hang.
10776006776SHuang Rui */
10876006776SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
1095581c670Sshaoyunl max((adev->gmc.fb_end >> 18) + 0x1,
11075986276SHuang Rui adev->gmc.agp_end >> 18));
11176006776SHuang Rui else
1122a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
1135581c670Sshaoyunl max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18);
114fc4b884bSHuang Rui
1154cd4c5c0SMonk Liu if (amdgpu_sriov_vf(adev))
11698cad2deSTrigger Huang return;
11798cad2deSTrigger Huang
118fc4b884bSHuang Rui /* Set default page address. */
1197ccfd79fSChristian König value = amdgpu_gmc_vram_mc2pa(adev, adev->mem_scratch.gpu_addr);
1202a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB,
121e60f8db5SAlex Xie (u32)(value >> 12));
1222a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,
123e60f8db5SAlex Xie (u32)(value >> 44));
124e60f8db5SAlex Xie
125fc4b884bSHuang Rui /* Program "protection fault". */
1262a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32,
12792e71b06SChristian König (u32)(adev->dummy_page_addr >> 12));
1282a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_HI32,
12992e71b06SChristian König (u32)((u64)adev->dummy_page_addr >> 44));
130fc4b884bSHuang Rui
1312a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_CNTL2);
132fc4b884bSHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL2,
133fc4b884bSHuang Rui ACTIVE_PAGE_MIGRATION_PTE_READ_RETRY, 1);
1342a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_CNTL2, tmp);
135fc4b884bSHuang Rui }
136fc4b884bSHuang Rui
mmhub_v1_0_init_tlb_regs(struct amdgpu_device * adev)13734269839SHuang Rui static void mmhub_v1_0_init_tlb_regs(struct amdgpu_device *adev)
13834269839SHuang Rui {
13934269839SHuang Rui uint32_t tmp;
14034269839SHuang Rui
14134269839SHuang Rui /* Setup TLB control */
1422a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmMC_VM_MX_L1_TLB_CNTL);
14334269839SHuang Rui
14434269839SHuang Rui tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 1);
14534269839SHuang Rui tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, SYSTEM_ACCESS_MODE, 3);
14634269839SHuang Rui tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
14734269839SHuang Rui ENABLE_ADVANCED_DRIVER_MODEL, 1);
14834269839SHuang Rui tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
14934269839SHuang Rui SYSTEM_APERTURE_UNMAPPED_ACCESS, 0);
15034269839SHuang Rui tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL,
15134269839SHuang Rui MTYPE, MTYPE_UC);/* XXX for emulation. */
15234269839SHuang Rui tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ATC_EN, 1);
15334269839SHuang Rui
1542a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_MX_L1_TLB_CNTL, tmp);
15534269839SHuang Rui }
15634269839SHuang Rui
mmhub_v1_0_init_cache_regs(struct amdgpu_device * adev)15741f6f311SHuang Rui static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev)
15841f6f311SHuang Rui {
159a3ce3645SRoger He uint32_t tmp;
16041f6f311SHuang Rui
1614cd4c5c0SMonk Liu if (amdgpu_sriov_vf(adev))
16298cad2deSTrigger Huang return;
16398cad2deSTrigger Huang
16441f6f311SHuang Rui /* Setup L2 cache */
1652a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL);
16641f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 1);
1676be7adb3SChristian König tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_FRAGMENT_PROCESSING, 1);
16841f6f311SHuang Rui /* XXX for emulation, Refer to closed source code.*/
16941f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, L2_PDE0_CACHE_TAG_GENERATION_MODE,
17041f6f311SHuang Rui 0);
1710cd57eecSYong Zhao tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, PDE_FAULT_CLASSIFICATION, 0);
17241f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, CONTEXT1_IDENTITY_ACCESS_MODE, 1);
17341f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, IDENTITY_MODE_FRAGMENT_SIZE, 0);
1742a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL, tmp);
17541f6f311SHuang Rui
1762a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL2);
17741f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_ALL_L1_TLBS, 1);
17841f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL2, INVALIDATE_L2_CACHE, 1);
1792a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL2, tmp);
18041f6f311SHuang Rui
181b8983d42SQu Huang tmp = mmVM_L2_CNTL3_DEFAULT;
182770d13b1SChristian König if (adev->gmc.translate_further) {
1836a42fd6fSChristian König tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 12);
1846a42fd6fSChristian König tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
1856a42fd6fSChristian König L2_CACHE_BIGK_FRAGMENT_SIZE, 9);
1866a42fd6fSChristian König } else {
187a3ce3645SRoger He tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, BANK_SELECT, 9);
1886a42fd6fSChristian König tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
1896a42fd6fSChristian König L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
1906a42fd6fSChristian König }
1911925e7d3SAlex Deucher WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp);
19241f6f311SHuang Rui
19341f6f311SHuang Rui tmp = mmVM_L2_CNTL4_DEFAULT;
19441f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
19541f6f311SHuang Rui tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
1962a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL4, tmp);
19741f6f311SHuang Rui }
19841f6f311SHuang Rui
mmhub_v1_0_enable_system_domain(struct amdgpu_device * adev)19902c4704bSHuang Rui static void mmhub_v1_0_enable_system_domain(struct amdgpu_device *adev)
20002c4704bSHuang Rui {
20102c4704bSHuang Rui uint32_t tmp;
20202c4704bSHuang Rui
2032a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_CNTL);
20402c4704bSHuang Rui tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, ENABLE_CONTEXT, 1);
20502c4704bSHuang Rui tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL, PAGE_TABLE_DEPTH, 0);
2067cae7061SFelix Kuehling tmp = REG_SET_FIELD(tmp, VM_CONTEXT0_CNTL,
2077cae7061SFelix Kuehling RETRY_PERMISSION_OR_INVALID_PAGE_FAULT, 0);
2082a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_CNTL, tmp);
20902c4704bSHuang Rui }
21002c4704bSHuang Rui
mmhub_v1_0_disable_identity_aperture(struct amdgpu_device * adev)211d5c87390SHuang Rui static void mmhub_v1_0_disable_identity_aperture(struct amdgpu_device *adev)
212d5c87390SHuang Rui {
2134cd4c5c0SMonk Liu if (amdgpu_sriov_vf(adev))
21498cad2deSTrigger Huang return;
21598cad2deSTrigger Huang
2162a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_LO32,
217d5c87390SHuang Rui 0XFFFFFFFF);
2182a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CONTEXT1_IDENTITY_APERTURE_LOW_ADDR_HI32,
2192a419183SHuang Rui 0x0000000F);
220d5c87390SHuang Rui
2212a419183SHuang Rui WREG32_SOC15(MMHUB, 0,
2222a419183SHuang Rui mmVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_LO32, 0);
2232a419183SHuang Rui WREG32_SOC15(MMHUB, 0,
2242a419183SHuang Rui mmVM_L2_CONTEXT1_IDENTITY_APERTURE_HIGH_ADDR_HI32, 0);
225d5c87390SHuang Rui
2262a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_LO32,
2272a419183SHuang Rui 0);
2282a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CONTEXT_IDENTITY_PHYSICAL_OFFSET_HI32,
2292a419183SHuang Rui 0);
230d5c87390SHuang Rui }
231d5c87390SHuang Rui
mmhub_v1_0_setup_vmid_config(struct amdgpu_device * adev)2323dff4cc4SHuang Rui static void mmhub_v1_0_setup_vmid_config(struct amdgpu_device *adev)
233fc4b884bSHuang Rui {
234f4caf584SHawking Zhang struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
2356a42fd6fSChristian König unsigned num_level, block_size;
2363dff4cc4SHuang Rui uint32_t tmp;
2376a42fd6fSChristian König int i;
2386a42fd6fSChristian König
2396a42fd6fSChristian König num_level = adev->vm_manager.num_level;
2406a42fd6fSChristian König block_size = adev->vm_manager.block_size;
241770d13b1SChristian König if (adev->gmc.translate_further)
2426a42fd6fSChristian König num_level -= 1;
2436a42fd6fSChristian König else
2446a42fd6fSChristian König block_size -= 9;
245e60f8db5SAlex Xie
246e60f8db5SAlex Xie for (i = 0; i <= 14; i++) {
247061863e5SYifan Zhang tmp = RREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT1_CNTL, i * hub->ctx_distance);
2486a42fd6fSChristian König tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1);
2496a42fd6fSChristian König tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH,
2506a42fd6fSChristian König num_level);
251e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
252e60f8db5SAlex Xie RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
253e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
2546a42fd6fSChristian König DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT,
2556a42fd6fSChristian König 1);
256e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
257e60f8db5SAlex Xie PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
258e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
259e60f8db5SAlex Xie VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
260e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
261e60f8db5SAlex Xie READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
262e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
263e60f8db5SAlex Xie WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
264e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
265e60f8db5SAlex Xie EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
266e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
267e60f8db5SAlex Xie PAGE_TABLE_BLOCK_SIZE,
2686a42fd6fSChristian König block_size);
2699f57f7b4SJay Cornwall /* Send no-retry XNACK on fault to suppress VM fault storm. */
2709f57f7b4SJay Cornwall tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL,
27175ee6487SFelix Kuehling RETRY_PERMISSION_OR_INVALID_PAGE_FAULT,
2729b498efaSAlex Deucher !adev->gmc.noretry);
2731a99460fSHuang Rui WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT1_CNTL,
2741a99460fSHuang Rui i * hub->ctx_distance, tmp);
2751a99460fSHuang Rui WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_LO32,
2761a99460fSHuang Rui i * hub->ctx_addr_distance, 0);
2771a99460fSHuang Rui WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_START_ADDR_HI32,
2781a99460fSHuang Rui i * hub->ctx_addr_distance, 0);
2791a99460fSHuang Rui WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_END_ADDR_LO32,
2801a99460fSHuang Rui i * hub->ctx_addr_distance,
28122770e5aSFelix Kuehling lower_32_bits(adev->vm_manager.max_pfn - 1));
2821a99460fSHuang Rui WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT1_PAGE_TABLE_END_ADDR_HI32,
2831a99460fSHuang Rui i * hub->ctx_addr_distance,
28422770e5aSFelix Kuehling upper_32_bits(adev->vm_manager.max_pfn - 1));
285e60f8db5SAlex Xie }
2863dff4cc4SHuang Rui }
2873dff4cc4SHuang Rui
mmhub_v1_0_program_invalidation(struct amdgpu_device * adev)2881e4eccdaSHuang Rui static void mmhub_v1_0_program_invalidation(struct amdgpu_device *adev)
2891e4eccdaSHuang Rui {
290f4caf584SHawking Zhang struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
2911e4eccdaSHuang Rui unsigned i;
2921e4eccdaSHuang Rui
2931e4eccdaSHuang Rui for (i = 0; i < 18; ++i) {
294deca8322STom St Denis WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
2951a99460fSHuang Rui i * hub->eng_addr_distance, 0xffffffff);
296deca8322STom St Denis WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_INVALIDATE_ENG0_ADDR_RANGE_HI32,
2971a99460fSHuang Rui i * hub->eng_addr_distance, 0x1f);
2981e4eccdaSHuang Rui }
2991e4eccdaSHuang Rui }
3001e4eccdaSHuang Rui
mmhub_v1_0_update_power_gating(struct amdgpu_device * adev,bool enable)3019fb1506eSOak Zeng static void mmhub_v1_0_update_power_gating(struct amdgpu_device *adev,
302a95890b4SHawking Zhang bool enable)
303a95890b4SHawking Zhang {
304a95890b4SHawking Zhang if (amdgpu_sriov_vf(adev))
305a95890b4SHawking Zhang return;
306a95890b4SHawking Zhang
30717252701SEvan Quan if (adev->pg_flags & AMD_PG_SUPPORT_MMHUB)
30817252701SEvan Quan amdgpu_dpm_set_powergating_by_smu(adev,
30917252701SEvan Quan AMD_IP_BLOCK_TYPE_GMC,
31017252701SEvan Quan enable);
311a95890b4SHawking Zhang }
312a95890b4SHawking Zhang
mmhub_v1_0_gart_enable(struct amdgpu_device * adev)3139fb1506eSOak Zeng static int mmhub_v1_0_gart_enable(struct amdgpu_device *adev)
3143dff4cc4SHuang Rui {
3153dff4cc4SHuang Rui if (amdgpu_sriov_vf(adev)) {
3163dff4cc4SHuang Rui /*
3173dff4cc4SHuang Rui * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are
3183dff4cc4SHuang Rui * VF copy registers so vbios post doesn't program them, for
3193dff4cc4SHuang Rui * SRIOV driver need to program them
3203dff4cc4SHuang Rui */
3212a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_BASE,
322770d13b1SChristian König adev->gmc.vram_start >> 24);
3232a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_TOP,
324770d13b1SChristian König adev->gmc.vram_end >> 24);
3253dff4cc4SHuang Rui }
3263dff4cc4SHuang Rui
3273dff4cc4SHuang Rui /* GART Enable. */
3283dff4cc4SHuang Rui mmhub_v1_0_init_gart_aperture_regs(adev);
3293dff4cc4SHuang Rui mmhub_v1_0_init_system_aperture_regs(adev);
3303dff4cc4SHuang Rui mmhub_v1_0_init_tlb_regs(adev);
3313dff4cc4SHuang Rui mmhub_v1_0_init_cache_regs(adev);
3323dff4cc4SHuang Rui
3333dff4cc4SHuang Rui mmhub_v1_0_enable_system_domain(adev);
3343dff4cc4SHuang Rui mmhub_v1_0_disable_identity_aperture(adev);
3353dff4cc4SHuang Rui mmhub_v1_0_setup_vmid_config(adev);
3361e4eccdaSHuang Rui mmhub_v1_0_program_invalidation(adev);
337e60f8db5SAlex Xie
338e60f8db5SAlex Xie return 0;
339e60f8db5SAlex Xie }
340e60f8db5SAlex Xie
mmhub_v1_0_gart_disable(struct amdgpu_device * adev)3419fb1506eSOak Zeng static void mmhub_v1_0_gart_disable(struct amdgpu_device *adev)
342e60f8db5SAlex Xie {
343f4caf584SHawking Zhang struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
344e60f8db5SAlex Xie u32 tmp;
345e60f8db5SAlex Xie u32 i;
346e60f8db5SAlex Xie
347e60f8db5SAlex Xie /* Disable all tables */
34868fce5f0SNirmoy Das for (i = 0; i < AMDGPU_NUM_VMID; i++)
3491a99460fSHuang Rui WREG32_SOC15_OFFSET(MMHUB, 0, mmVM_CONTEXT0_CNTL,
3501a99460fSHuang Rui i * hub->ctx_distance, 0);
351e60f8db5SAlex Xie
352e60f8db5SAlex Xie /* Setup TLB control */
3532a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmMC_VM_MX_L1_TLB_CNTL);
354e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, MC_VM_MX_L1_TLB_CNTL, ENABLE_L1_TLB, 0);
355e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp,
356e60f8db5SAlex Xie MC_VM_MX_L1_TLB_CNTL,
357e60f8db5SAlex Xie ENABLE_ADVANCED_DRIVER_MODEL,
358e60f8db5SAlex Xie 0);
3592a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmMC_VM_MX_L1_TLB_CNTL, tmp);
360e60f8db5SAlex Xie
3614cd4c5c0SMonk Liu if (!amdgpu_sriov_vf(adev)) {
362e60f8db5SAlex Xie /* Setup L2 cache */
3632a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL);
364e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_CNTL, ENABLE_L2_CACHE, 0);
3652a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL, tmp);
3662a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, 0);
367e60f8db5SAlex Xie }
36898cad2deSTrigger Huang }
369e60f8db5SAlex Xie
370e60f8db5SAlex Xie /**
371e60f8db5SAlex Xie * mmhub_v1_0_set_fault_enable_default - update GART/VM fault handling
372e60f8db5SAlex Xie *
373e60f8db5SAlex Xie * @adev: amdgpu_device pointer
374e60f8db5SAlex Xie * @value: true redirects VM faults to the default page
375e60f8db5SAlex Xie */
mmhub_v1_0_set_fault_enable_default(struct amdgpu_device * adev,bool value)3769fb1506eSOak Zeng static void mmhub_v1_0_set_fault_enable_default(struct amdgpu_device *adev, bool value)
377e60f8db5SAlex Xie {
378e60f8db5SAlex Xie u32 tmp;
37998cad2deSTrigger Huang
3804cd4c5c0SMonk Liu if (amdgpu_sriov_vf(adev))
38198cad2deSTrigger Huang return;
38298cad2deSTrigger Huang
3832a419183SHuang Rui tmp = RREG32_SOC15(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_CNTL);
384e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
385e60f8db5SAlex Xie RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
386e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
387e60f8db5SAlex Xie PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, value);
388e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
389e60f8db5SAlex Xie PDE1_PROTECTION_FAULT_ENABLE_DEFAULT, value);
390e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
391e60f8db5SAlex Xie PDE2_PROTECTION_FAULT_ENABLE_DEFAULT, value);
392e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp,
393e60f8db5SAlex Xie VM_L2_PROTECTION_FAULT_CNTL,
394e60f8db5SAlex Xie TRANSLATE_FURTHER_PROTECTION_FAULT_ENABLE_DEFAULT,
395e60f8db5SAlex Xie value);
396e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
397e60f8db5SAlex Xie NACK_PROTECTION_FAULT_ENABLE_DEFAULT, value);
398e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
399e60f8db5SAlex Xie DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
400e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
401e60f8db5SAlex Xie VALID_PROTECTION_FAULT_ENABLE_DEFAULT, value);
402e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
403e60f8db5SAlex Xie READ_PROTECTION_FAULT_ENABLE_DEFAULT, value);
404e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
405e60f8db5SAlex Xie WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
406e60f8db5SAlex Xie tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
407e60f8db5SAlex Xie EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
4084bd9a67eSMonk Liu if (!value) {
4094bd9a67eSMonk Liu tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
4104bd9a67eSMonk Liu CRASH_ON_NO_RETRY_FAULT, 1);
4114bd9a67eSMonk Liu tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
4124bd9a67eSMonk Liu CRASH_ON_RETRY_FAULT, 1);
4134bd9a67eSMonk Liu }
4144bd9a67eSMonk Liu
4152a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_CNTL, tmp);
416e60f8db5SAlex Xie }
417e60f8db5SAlex Xie
mmhub_v1_0_init(struct amdgpu_device * adev)4189fb1506eSOak Zeng static void mmhub_v1_0_init(struct amdgpu_device *adev)
419e60f8db5SAlex Xie {
420f4caf584SHawking Zhang struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0(0)];
421e60f8db5SAlex Xie
422e60f8db5SAlex Xie hub->ctx0_ptb_addr_lo32 =
423e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0,
424e60f8db5SAlex Xie mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32);
425e60f8db5SAlex Xie hub->ctx0_ptb_addr_hi32 =
426e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0,
427e60f8db5SAlex Xie mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32);
428dab5ef27Schangzhu hub->vm_inv_eng0_sem =
429dab5ef27Schangzhu SOC15_REG_OFFSET(MMHUB, 0, mmVM_INVALIDATE_ENG0_SEM);
430e60f8db5SAlex Xie hub->vm_inv_eng0_req =
431e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0, mmVM_INVALIDATE_ENG0_REQ);
432e60f8db5SAlex Xie hub->vm_inv_eng0_ack =
433e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0, mmVM_INVALIDATE_ENG0_ACK);
434e60f8db5SAlex Xie hub->vm_context0_cntl =
435e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0, mmVM_CONTEXT0_CNTL);
436e60f8db5SAlex Xie hub->vm_l2_pro_fault_status =
437e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_STATUS);
438e60f8db5SAlex Xie hub->vm_l2_pro_fault_cntl =
439e60f8db5SAlex Xie SOC15_REG_OFFSET(MMHUB, 0, mmVM_L2_PROTECTION_FAULT_CNTL);
440e60f8db5SAlex Xie
4411f9d56c3SHuang Rui hub->ctx_distance = mmVM_CONTEXT1_CNTL - mmVM_CONTEXT0_CNTL;
4421f9d56c3SHuang Rui hub->ctx_addr_distance = mmVM_CONTEXT1_PAGE_TABLE_BASE_ADDR_LO32 -
4431f9d56c3SHuang Rui mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32;
4441f9d56c3SHuang Rui hub->eng_distance = mmVM_INVALIDATE_ENG1_REQ - mmVM_INVALIDATE_ENG0_REQ;
4451f9d56c3SHuang Rui hub->eng_addr_distance = mmVM_INVALIDATE_ENG1_ADDR_RANGE_LO32 -
4461f9d56c3SHuang Rui mmVM_INVALIDATE_ENG0_ADDR_RANGE_LO32;
44777f6c763SHuang Rui }
44877f6c763SHuang Rui
mmhub_v1_0_update_medium_grain_clock_gating(struct amdgpu_device * adev,bool enable)449e60f8db5SAlex Xie static void mmhub_v1_0_update_medium_grain_clock_gating(struct amdgpu_device *adev,
450e60f8db5SAlex Xie bool enable)
451e60f8db5SAlex Xie {
4522547a7aaSHuang Rui uint32_t def, data, def1, data1, def2 = 0, data2 = 0;
453e60f8db5SAlex Xie
4542a419183SHuang Rui def = data = RREG32_SOC15(MMHUB, 0, mmATC_L2_MISC_CG);
4552547a7aaSHuang Rui
456741deadeSAlex Deucher if (adev->asic_type != CHIP_RAVEN) {
4572a419183SHuang Rui def1 = data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2);
4582a419183SHuang Rui def2 = data2 = RREG32_SOC15(MMHUB, 0, mmDAGB1_CNTL_MISC2);
4592547a7aaSHuang Rui } else
4602a419183SHuang Rui def1 = data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_RV);
461e60f8db5SAlex Xie
462e60f8db5SAlex Xie if (enable && (adev->cg_flags & AMD_CG_SUPPORT_MC_MGCG)) {
463e60f8db5SAlex Xie data |= ATC_L2_MISC_CG__ENABLE_MASK;
464e60f8db5SAlex Xie
465e60f8db5SAlex Xie data1 &= ~(DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK |
466e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_WRRET_CG_MASK |
467e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_RDREQ_CG_MASK |
468e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_RDRET_CG_MASK |
469e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_TLBWR_CG_MASK |
470e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK);
471e60f8db5SAlex Xie
472741deadeSAlex Deucher if (adev->asic_type != CHIP_RAVEN)
473e60f8db5SAlex Xie data2 &= ~(DAGB1_CNTL_MISC2__DISABLE_WRREQ_CG_MASK |
474e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_WRRET_CG_MASK |
475e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_RDREQ_CG_MASK |
476e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_RDRET_CG_MASK |
477e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_TLBWR_CG_MASK |
478e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_TLBRD_CG_MASK);
479e60f8db5SAlex Xie } else {
480e60f8db5SAlex Xie data &= ~ATC_L2_MISC_CG__ENABLE_MASK;
481e60f8db5SAlex Xie
482e60f8db5SAlex Xie data1 |= (DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK |
483e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_WRRET_CG_MASK |
484e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_RDREQ_CG_MASK |
485e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_RDRET_CG_MASK |
486e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_TLBWR_CG_MASK |
487e60f8db5SAlex Xie DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK);
488e60f8db5SAlex Xie
489741deadeSAlex Deucher if (adev->asic_type != CHIP_RAVEN)
490e60f8db5SAlex Xie data2 |= (DAGB1_CNTL_MISC2__DISABLE_WRREQ_CG_MASK |
491e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_WRRET_CG_MASK |
492e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_RDREQ_CG_MASK |
493e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_RDRET_CG_MASK |
494e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_TLBWR_CG_MASK |
495e60f8db5SAlex Xie DAGB1_CNTL_MISC2__DISABLE_TLBRD_CG_MASK);
496e60f8db5SAlex Xie }
497e60f8db5SAlex Xie
498e60f8db5SAlex Xie if (def != data)
4992a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmATC_L2_MISC_CG, data);
500e60f8db5SAlex Xie
5012547a7aaSHuang Rui if (def1 != data1) {
502741deadeSAlex Deucher if (adev->asic_type != CHIP_RAVEN)
5032a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2, data1);
5042547a7aaSHuang Rui else
5052a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_RV, data1);
5062547a7aaSHuang Rui }
507e60f8db5SAlex Xie
508741deadeSAlex Deucher if (adev->asic_type != CHIP_RAVEN && def2 != data2)
5092a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmDAGB1_CNTL_MISC2, data2);
510e60f8db5SAlex Xie }
511e60f8db5SAlex Xie
mmhub_v1_0_update_medium_grain_light_sleep(struct amdgpu_device * adev,bool enable)512e60f8db5SAlex Xie static void mmhub_v1_0_update_medium_grain_light_sleep(struct amdgpu_device *adev,
513e60f8db5SAlex Xie bool enable)
514e60f8db5SAlex Xie {
515e60f8db5SAlex Xie uint32_t def, data;
516e60f8db5SAlex Xie
5172a419183SHuang Rui def = data = RREG32_SOC15(MMHUB, 0, mmATC_L2_MISC_CG);
518e60f8db5SAlex Xie
519e60f8db5SAlex Xie if (enable && (adev->cg_flags & AMD_CG_SUPPORT_MC_LS))
520e60f8db5SAlex Xie data |= ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK;
521e60f8db5SAlex Xie else
522e60f8db5SAlex Xie data &= ~ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK;
523e60f8db5SAlex Xie
524e60f8db5SAlex Xie if (def != data)
5252a419183SHuang Rui WREG32_SOC15(MMHUB, 0, mmATC_L2_MISC_CG, data);
526e60f8db5SAlex Xie }
527e60f8db5SAlex Xie
mmhub_v1_0_set_clockgating(struct amdgpu_device * adev,enum amd_clockgating_state state)5289fb1506eSOak Zeng static int mmhub_v1_0_set_clockgating(struct amdgpu_device *adev,
529e60f8db5SAlex Xie enum amd_clockgating_state state)
530e60f8db5SAlex Xie {
53198c24b24SXiangliang Yu if (amdgpu_sriov_vf(adev))
53298c24b24SXiangliang Yu return 0;
53398c24b24SXiangliang Yu
534e60f8db5SAlex Xie switch (adev->asic_type) {
535e60f8db5SAlex Xie case CHIP_VEGA10:
536f8d27677SAlex Deucher case CHIP_VEGA12:
537c2d7fd2bSFeifei Xu case CHIP_VEGA20:
5382547a7aaSHuang Rui case CHIP_RAVEN:
5392f47d649SPrike Liang case CHIP_RENOIR:
540e60f8db5SAlex Xie mmhub_v1_0_update_medium_grain_clock_gating(adev,
541a9d4fe2fSNirmoy Das state == AMD_CG_STATE_GATE);
542e60f8db5SAlex Xie mmhub_v1_0_update_medium_grain_light_sleep(adev,
543a9d4fe2fSNirmoy Das state == AMD_CG_STATE_GATE);
544e60f8db5SAlex Xie break;
545e60f8db5SAlex Xie default:
546e60f8db5SAlex Xie break;
547e60f8db5SAlex Xie }
548e60f8db5SAlex Xie
549e60f8db5SAlex Xie return 0;
550e60f8db5SAlex Xie }
551e60f8db5SAlex Xie
mmhub_v1_0_get_clockgating(struct amdgpu_device * adev,u64 * flags)55225faeddcSEvan Quan static void mmhub_v1_0_get_clockgating(struct amdgpu_device *adev, u64 *flags)
553e2a4cd69SHuang Rui {
554bee7b51aSLe Ma int data, data1;
555e2a4cd69SHuang Rui
556e2a4cd69SHuang Rui if (amdgpu_sriov_vf(adev))
557e2a4cd69SHuang Rui *flags = 0;
558e2a4cd69SHuang Rui
559bee7b51aSLe Ma data = RREG32_SOC15(MMHUB, 0, mmATC_L2_MISC_CG);
560bee7b51aSLe Ma
561bee7b51aSLe Ma data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2);
562bee7b51aSLe Ma
563e2a4cd69SHuang Rui /* AMD_CG_SUPPORT_MC_MGCG */
564bee7b51aSLe Ma if ((data & ATC_L2_MISC_CG__ENABLE_MASK) &&
565bee7b51aSLe Ma !(data1 & (DAGB0_CNTL_MISC2__DISABLE_WRREQ_CG_MASK |
566bee7b51aSLe Ma DAGB0_CNTL_MISC2__DISABLE_WRRET_CG_MASK |
567bee7b51aSLe Ma DAGB0_CNTL_MISC2__DISABLE_RDREQ_CG_MASK |
568bee7b51aSLe Ma DAGB0_CNTL_MISC2__DISABLE_RDRET_CG_MASK |
569bee7b51aSLe Ma DAGB0_CNTL_MISC2__DISABLE_TLBWR_CG_MASK |
570bee7b51aSLe Ma DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK)))
571e2a4cd69SHuang Rui *flags |= AMD_CG_SUPPORT_MC_MGCG;
572e2a4cd69SHuang Rui
573e2a4cd69SHuang Rui /* AMD_CG_SUPPORT_MC_LS */
574e2a4cd69SHuang Rui if (data & ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK)
575e2a4cd69SHuang Rui *flags |= AMD_CG_SUPPORT_MC_LS;
576e2a4cd69SHuang Rui }
5773d093da0STao Zhou
5788781e5dfSDennis Li static const struct soc15_ras_field_entry mmhub_v1_0_ras_fields[] = {
5798781e5dfSDennis Li { "MMEA0_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
5808781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMRD_CMDMEM_SEC_COUNT),
5818781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMRD_CMDMEM_DED_COUNT),
5828781e5dfSDennis Li },
5838781e5dfSDennis Li { "MMEA0_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
5848781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMWR_CMDMEM_SEC_COUNT),
5858781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMWR_CMDMEM_DED_COUNT),
5868781e5dfSDennis Li },
5878781e5dfSDennis Li { "MMEA0_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
5888781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMWR_DATAMEM_SEC_COUNT),
5898781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMWR_DATAMEM_DED_COUNT),
5908781e5dfSDennis Li },
5918781e5dfSDennis Li { "MMEA0_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
5928781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, RRET_TAGMEM_SEC_COUNT),
5938781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, RRET_TAGMEM_DED_COUNT),
5948781e5dfSDennis Li },
5958781e5dfSDennis Li { "MMEA0_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
5968781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, WRET_TAGMEM_SEC_COUNT),
5978781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, WRET_TAGMEM_DED_COUNT),
5988781e5dfSDennis Li },
5998781e5dfSDennis Li { "MMEA0_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
6008781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMRD_PAGEMEM_SED_COUNT),
6018781e5dfSDennis Li 0, 0,
6028781e5dfSDennis Li },
6038781e5dfSDennis Li { "MMEA0_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
6048781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, DRAMWR_PAGEMEM_SED_COUNT),
6058781e5dfSDennis Li 0, 0,
6068781e5dfSDennis Li },
6078781e5dfSDennis Li { "MMEA0_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
6088781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, IORD_CMDMEM_SED_COUNT),
6098781e5dfSDennis Li 0, 0,
6108781e5dfSDennis Li },
6118781e5dfSDennis Li { "MMEA0_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
6128781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, IOWR_CMDMEM_SED_COUNT),
6138781e5dfSDennis Li 0, 0,
6148781e5dfSDennis Li },
6158781e5dfSDennis Li { "MMEA0_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20),
6168781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT_VG20, IOWR_DATAMEM_SED_COUNT),
6178781e5dfSDennis Li 0, 0,
6188781e5dfSDennis Li },
6198781e5dfSDennis Li { "MMEA0_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT2_VG20),
6208781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIRD_CMDMEM_SEC_COUNT),
6218781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIRD_CMDMEM_DED_COUNT),
6228781e5dfSDennis Li },
6238781e5dfSDennis Li { "MMEA0_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT2_VG20),
6248781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIWR_CMDMEM_SEC_COUNT),
6258781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIWR_CMDMEM_DED_COUNT),
6268781e5dfSDennis Li },
6278781e5dfSDennis Li { "MMEA0_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT2_VG20),
6288781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIWR_DATAMEM_SEC_COUNT),
6298781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIWR_DATAMEM_DED_COUNT),
6308781e5dfSDennis Li },
6318781e5dfSDennis Li { "MMEA0_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT2_VG20),
6328781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIRD_PAGEMEM_SED_COUNT),
6338781e5dfSDennis Li 0, 0,
6348781e5dfSDennis Li },
6358781e5dfSDennis Li { "MMEA0_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT2_VG20),
6368781e5dfSDennis Li SOC15_REG_FIELD(MMEA0_EDC_CNT2_VG20, GMIWR_PAGEMEM_SED_COUNT),
6378781e5dfSDennis Li 0, 0,
6388781e5dfSDennis Li },
6398781e5dfSDennis Li { "MMEA1_DRAMRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6408781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMRD_CMDMEM_SEC_COUNT),
6418781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMRD_CMDMEM_DED_COUNT),
6428781e5dfSDennis Li },
6438781e5dfSDennis Li { "MMEA1_DRAMWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6448781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMWR_CMDMEM_SEC_COUNT),
6458781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMWR_CMDMEM_DED_COUNT),
6468781e5dfSDennis Li },
6478781e5dfSDennis Li { "MMEA1_DRAMWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6488781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMWR_DATAMEM_SEC_COUNT),
6498781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMWR_DATAMEM_DED_COUNT),
6508781e5dfSDennis Li },
6518781e5dfSDennis Li { "MMEA1_RRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6528781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, RRET_TAGMEM_SEC_COUNT),
6538781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, RRET_TAGMEM_DED_COUNT),
6548781e5dfSDennis Li },
6558781e5dfSDennis Li { "MMEA1_WRET_TAGMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6568781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, WRET_TAGMEM_SEC_COUNT),
6578781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, WRET_TAGMEM_DED_COUNT),
6588781e5dfSDennis Li },
6598781e5dfSDennis Li { "MMEA1_DRAMRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6608781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMRD_PAGEMEM_SED_COUNT),
6618781e5dfSDennis Li 0, 0,
6628781e5dfSDennis Li },
6638781e5dfSDennis Li { "MMEA1_DRAMWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6648781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, DRAMWR_PAGEMEM_SED_COUNT),
6658781e5dfSDennis Li 0, 0,
6668781e5dfSDennis Li },
6678781e5dfSDennis Li { "MMEA1_IORD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6688781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, IORD_CMDMEM_SED_COUNT),
6698781e5dfSDennis Li 0, 0,
6708781e5dfSDennis Li },
6718781e5dfSDennis Li { "MMEA1_IOWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6728781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, IOWR_CMDMEM_SED_COUNT),
6738781e5dfSDennis Li 0, 0,
6748781e5dfSDennis Li },
6758781e5dfSDennis Li { "MMEA1_IOWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20),
6768781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT_VG20, IOWR_DATAMEM_SED_COUNT),
6778781e5dfSDennis Li 0, 0,
6788781e5dfSDennis Li },
6798781e5dfSDennis Li { "MMEA1_GMIRD_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT2_VG20),
6808781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIRD_CMDMEM_SEC_COUNT),
6818781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIRD_CMDMEM_DED_COUNT),
6828781e5dfSDennis Li },
6838781e5dfSDennis Li { "MMEA1_GMIWR_CMDMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT2_VG20),
6848781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIWR_CMDMEM_SEC_COUNT),
6858781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIWR_CMDMEM_DED_COUNT),
6868781e5dfSDennis Li },
6878781e5dfSDennis Li { "MMEA1_GMIWR_DATAMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT2_VG20),
6888781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIWR_DATAMEM_SEC_COUNT),
6898781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIWR_DATAMEM_DED_COUNT),
6908781e5dfSDennis Li },
6918781e5dfSDennis Li { "MMEA1_GMIRD_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT2_VG20),
6928781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIRD_PAGEMEM_SED_COUNT),
6938781e5dfSDennis Li 0, 0,
6948781e5dfSDennis Li },
6958781e5dfSDennis Li { "MMEA1_GMIWR_PAGEMEM", SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT2_VG20),
6968781e5dfSDennis Li SOC15_REG_FIELD(MMEA1_EDC_CNT2_VG20, GMIWR_PAGEMEM_SED_COUNT),
6978781e5dfSDennis Li 0, 0,
6988781e5dfSDennis Li }
6998781e5dfSDennis Li };
7008781e5dfSDennis Li
7018781e5dfSDennis Li static const struct soc15_reg_entry mmhub_v1_0_edc_cnt_regs[] = {
7028781e5dfSDennis Li { SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT_VG20), 0, 0, 0},
7038781e5dfSDennis Li { SOC15_REG_ENTRY(MMHUB, 0, mmMMEA0_EDC_CNT2_VG20), 0, 0, 0},
7048781e5dfSDennis Li { SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT_VG20), 0, 0, 0},
7058781e5dfSDennis Li { SOC15_REG_ENTRY(MMHUB, 0, mmMMEA1_EDC_CNT2_VG20), 0, 0, 0},
7068781e5dfSDennis Li };
7078781e5dfSDennis Li
mmhub_v1_0_get_ras_error_count(struct amdgpu_device * adev,const struct soc15_reg_entry * reg,uint32_t value,uint32_t * sec_count,uint32_t * ded_count)7084cc1178eSDennis Li static int mmhub_v1_0_get_ras_error_count(struct amdgpu_device *adev,
7094cc1178eSDennis Li const struct soc15_reg_entry *reg,
7108781e5dfSDennis Li uint32_t value, uint32_t *sec_count, uint32_t *ded_count)
7118781e5dfSDennis Li {
7128781e5dfSDennis Li uint32_t i;
7138781e5dfSDennis Li uint32_t sec_cnt, ded_cnt;
7148781e5dfSDennis Li
7158781e5dfSDennis Li for (i = 0; i < ARRAY_SIZE(mmhub_v1_0_ras_fields); i++) {
7168781e5dfSDennis Li if (mmhub_v1_0_ras_fields[i].reg_offset != reg->reg_offset)
7178781e5dfSDennis Li continue;
7188781e5dfSDennis Li
7198781e5dfSDennis Li sec_cnt = (value &
7208781e5dfSDennis Li mmhub_v1_0_ras_fields[i].sec_count_mask) >>
7218781e5dfSDennis Li mmhub_v1_0_ras_fields[i].sec_count_shift;
7228781e5dfSDennis Li if (sec_cnt) {
7234cc1178eSDennis Li dev_info(adev->dev,
7244cc1178eSDennis Li "MMHUB SubBlock %s, SEC %d\n",
7258781e5dfSDennis Li mmhub_v1_0_ras_fields[i].name,
7268781e5dfSDennis Li sec_cnt);
7278781e5dfSDennis Li *sec_count += sec_cnt;
7288781e5dfSDennis Li }
7298781e5dfSDennis Li
7308781e5dfSDennis Li ded_cnt = (value &
7318781e5dfSDennis Li mmhub_v1_0_ras_fields[i].ded_count_mask) >>
7328781e5dfSDennis Li mmhub_v1_0_ras_fields[i].ded_count_shift;
7338781e5dfSDennis Li if (ded_cnt) {
7344cc1178eSDennis Li dev_info(adev->dev,
7354cc1178eSDennis Li "MMHUB SubBlock %s, DED %d\n",
7368781e5dfSDennis Li mmhub_v1_0_ras_fields[i].name,
7378781e5dfSDennis Li ded_cnt);
7388781e5dfSDennis Li *ded_count += ded_cnt;
7398781e5dfSDennis Li }
7408781e5dfSDennis Li }
7418781e5dfSDennis Li
7428781e5dfSDennis Li return 0;
7438781e5dfSDennis Li }
7448781e5dfSDennis Li
mmhub_v1_0_query_ras_error_count(struct amdgpu_device * adev,void * ras_error_status)7453d093da0STao Zhou static void mmhub_v1_0_query_ras_error_count(struct amdgpu_device *adev,
7463d093da0STao Zhou void *ras_error_status)
7473d093da0STao Zhou {
748d6e0cbb1STao Zhou struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status;
7498781e5dfSDennis Li uint32_t sec_count = 0, ded_count = 0;
7508781e5dfSDennis Li uint32_t i;
7518781e5dfSDennis Li uint32_t reg_value;
752d6e0cbb1STao Zhou
7538781e5dfSDennis Li err_data->ue_count = 0;
7548781e5dfSDennis Li err_data->ce_count = 0;
755d6e0cbb1STao Zhou
7568781e5dfSDennis Li for (i = 0; i < ARRAY_SIZE(mmhub_v1_0_edc_cnt_regs); i++) {
7578781e5dfSDennis Li reg_value =
7588781e5dfSDennis Li RREG32(SOC15_REG_ENTRY_OFFSET(mmhub_v1_0_edc_cnt_regs[i]));
7598781e5dfSDennis Li if (reg_value)
7604cc1178eSDennis Li mmhub_v1_0_get_ras_error_count(adev,
7614cc1178eSDennis Li &mmhub_v1_0_edc_cnt_regs[i],
7628781e5dfSDennis Li reg_value, &sec_count, &ded_count);
763d6e0cbb1STao Zhou }
764d6e0cbb1STao Zhou
7658781e5dfSDennis Li err_data->ce_count += sec_count;
7668781e5dfSDennis Li err_data->ue_count += ded_count;
7673d093da0STao Zhou }
7683d093da0STao Zhou
mmhub_v1_0_reset_ras_error_count(struct amdgpu_device * adev)769fe5211f1SHawking Zhang static void mmhub_v1_0_reset_ras_error_count(struct amdgpu_device *adev)
770fe5211f1SHawking Zhang {
771fe5211f1SHawking Zhang uint32_t i;
772fe5211f1SHawking Zhang
773fe5211f1SHawking Zhang /* read back edc counter registers to reset the counters to 0 */
774fe5211f1SHawking Zhang if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__MMHUB)) {
775fe5211f1SHawking Zhang for (i = 0; i < ARRAY_SIZE(mmhub_v1_0_edc_cnt_regs); i++)
776fe5211f1SHawking Zhang RREG32(SOC15_REG_ENTRY_OFFSET(mmhub_v1_0_edc_cnt_regs[i]));
777fe5211f1SHawking Zhang }
778fe5211f1SHawking Zhang }
779fe5211f1SHawking Zhang
7805e67bba3Syipechai struct amdgpu_ras_block_hw_ops mmhub_v1_0_ras_hw_ops = {
7813d093da0STao Zhou .query_ras_error_count = mmhub_v1_0_query_ras_error_count,
782fe5211f1SHawking Zhang .reset_ras_error_count = mmhub_v1_0_reset_ras_error_count,
7838bc7b360SHawking Zhang };
7848bc7b360SHawking Zhang
7855e67bba3Syipechai struct amdgpu_mmhub_ras mmhub_v1_0_ras = {
7865e67bba3Syipechai .ras_block = {
7875e67bba3Syipechai .hw_ops = &mmhub_v1_0_ras_hw_ops,
7885e67bba3Syipechai },
7895e67bba3Syipechai };
7905e67bba3Syipechai
7918bc7b360SHawking Zhang const struct amdgpu_mmhub_funcs mmhub_v1_0_funcs = {
7929fb1506eSOak Zeng .get_fb_location = mmhub_v1_0_get_fb_location,
7939fb1506eSOak Zeng .init = mmhub_v1_0_init,
7949fb1506eSOak Zeng .gart_enable = mmhub_v1_0_gart_enable,
7959fb1506eSOak Zeng .set_fault_enable_default = mmhub_v1_0_set_fault_enable_default,
7969fb1506eSOak Zeng .gart_disable = mmhub_v1_0_gart_disable,
7979fb1506eSOak Zeng .set_clockgating = mmhub_v1_0_set_clockgating,
7989fb1506eSOak Zeng .get_clockgating = mmhub_v1_0_get_clockgating,
7999fb1506eSOak Zeng .setup_vm_pt_regs = mmhub_v1_0_setup_vm_pt_regs,
8009fb1506eSOak Zeng .update_power_gating = mmhub_v1_0_update_power_gating,
8013d093da0STao Zhou };
802