cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

nbio_v6_1.c (15113B)


      1/*
      2 * Copyright 2016 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 "amdgpu.h"
     24#include "amdgpu_atombios.h"
     25#include "nbio_v6_1.h"
     26
     27#include "nbio/nbio_6_1_default.h"
     28#include "nbio/nbio_6_1_offset.h"
     29#include "nbio/nbio_6_1_sh_mask.h"
     30#include "nbio/nbio_6_1_smn.h"
     31#include "vega10_enum.h"
     32#include <uapi/linux/kfd_ioctl.h>
     33
     34#define smnPCIE_LC_CNTL		0x11140280
     35#define smnPCIE_LC_CNTL3	0x111402d4
     36#define smnPCIE_LC_CNTL6	0x111402ec
     37#define smnPCIE_LC_CNTL7	0x111402f0
     38#define smnNBIF_MGCG_CTRL_LCLK	0x1013a05c
     39#define NBIF_MGCG_CTRL_LCLK__NBIF_MGCG_REG_DIS_LCLK_MASK	0x00001000L
     40#define RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER_MASK	0x0000FFFFL
     41#define RCC_BIF_STRAP3__STRAP_VLINK_PM_L1_ENTRY_TIMER_MASK	0xFFFF0000L
     42#define smnRCC_EP_DEV0_0_EP_PCIE_TX_LTR_CNTL	0x10123530
     43#define smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2	0x1014008c
     44#define smnBIF_CFG_DEV0_EPF0_PCIE_LTR_CAP	0x10140324
     45#define smnPSWUSP0_PCIE_LC_CNTL2		0x111402c4
     46#define smnRCC_BIF_STRAP2	0x10123488
     47#define smnRCC_BIF_STRAP3	0x1012348c
     48#define smnRCC_BIF_STRAP5	0x10123494
     49#define BIF_CFG_DEV0_EPF0_DEVICE_CNTL2__LTR_EN_MASK			0x0400L
     50#define RCC_BIF_STRAP5__STRAP_VLINK_LDN_ENTRY_TIMER_MASK	0x0000FFFFL
     51#define RCC_BIF_STRAP2__STRAP_LTR_IN_ASPML1_DIS_MASK	0x00004000L
     52#define RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT	0x0
     53#define RCC_BIF_STRAP3__STRAP_VLINK_PM_L1_ENTRY_TIMER__SHIFT	0x10
     54#define RCC_BIF_STRAP5__STRAP_VLINK_LDN_ENTRY_TIMER__SHIFT	0x0
     55
     56static void nbio_v6_1_remap_hdp_registers(struct amdgpu_device *adev)
     57{
     58	WREG32_SOC15(NBIO, 0, mmREMAP_HDP_MEM_FLUSH_CNTL,
     59		adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL);
     60	WREG32_SOC15(NBIO, 0, mmREMAP_HDP_REG_FLUSH_CNTL,
     61		adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL);
     62}
     63
     64static u32 nbio_v6_1_get_rev_id(struct amdgpu_device *adev)
     65{
     66	u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
     67
     68	tmp &= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK;
     69	tmp >>= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT;
     70
     71	return tmp;
     72}
     73
     74static void nbio_v6_1_mc_access_enable(struct amdgpu_device *adev, bool enable)
     75{
     76	if (enable)
     77		WREG32_SOC15(NBIO, 0, mmBIF_FB_EN,
     78			     BIF_FB_EN__FB_READ_EN_MASK |
     79			     BIF_FB_EN__FB_WRITE_EN_MASK);
     80	else
     81		WREG32_SOC15(NBIO, 0, mmBIF_FB_EN, 0);
     82}
     83
     84static u32 nbio_v6_1_get_memsize(struct amdgpu_device *adev)
     85{
     86	return RREG32_SOC15(NBIO, 0, mmRCC_PF_0_0_RCC_CONFIG_MEMSIZE);
     87}
     88
     89static void nbio_v6_1_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
     90			bool use_doorbell, int doorbell_index, int doorbell_size)
     91{
     92	u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :
     93			SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);
     94
     95	u32 doorbell_range = RREG32(reg);
     96
     97	if (use_doorbell) {
     98		doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);
     99		doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);
    100	} else
    101		doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);
    102
    103	WREG32(reg, doorbell_range);
    104
    105}
    106
    107static void nbio_v6_1_enable_doorbell_aperture(struct amdgpu_device *adev,
    108					       bool enable)
    109{
    110	WREG32_FIELD15(NBIO, 0, RCC_PF_0_0_RCC_DOORBELL_APER_EN, BIF_DOORBELL_APER_EN, enable ? 1 : 0);
    111}
    112
    113static void nbio_v6_1_enable_doorbell_selfring_aperture(struct amdgpu_device *adev,
    114							bool enable)
    115{
    116	u32 tmp = 0;
    117
    118	if (enable) {
    119		tmp = REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_EN, 1) |
    120		      REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_MODE, 1) |
    121		      REG_SET_FIELD(tmp, BIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL, DOORBELL_SELFRING_GPA_APER_SIZE, 0);
    122
    123		WREG32_SOC15(NBIO, 0, mmBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_BASE_LOW,
    124			     lower_32_bits(adev->doorbell.base));
    125		WREG32_SOC15(NBIO, 0, mmBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_BASE_HIGH,
    126			     upper_32_bits(adev->doorbell.base));
    127	}
    128
    129	WREG32_SOC15(NBIO, 0, mmBIF_BX_PF0_DOORBELL_SELFRING_GPA_APER_CNTL, tmp);
    130}
    131
    132
    133static void nbio_v6_1_ih_doorbell_range(struct amdgpu_device *adev,
    134					bool use_doorbell, int doorbell_index)
    135{
    136	u32 ih_doorbell_range = RREG32_SOC15(NBIO, 0, mmBIF_IH_DOORBELL_RANGE);
    137
    138	if (use_doorbell) {
    139		ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, OFFSET, doorbell_index);
    140		ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range,
    141						  BIF_IH_DOORBELL_RANGE, SIZE, 6);
    142	} else
    143		ih_doorbell_range = REG_SET_FIELD(ih_doorbell_range, BIF_IH_DOORBELL_RANGE, SIZE, 0);
    144
    145	WREG32_SOC15(NBIO, 0, mmBIF_IH_DOORBELL_RANGE, ih_doorbell_range);
    146}
    147
    148static void nbio_v6_1_ih_control(struct amdgpu_device *adev)
    149{
    150	u32 interrupt_cntl;
    151
    152	/* setup interrupt control */
    153	WREG32_SOC15(NBIO, 0, mmINTERRUPT_CNTL2, adev->dummy_page_addr >> 8);
    154	interrupt_cntl = RREG32_SOC15(NBIO, 0, mmINTERRUPT_CNTL);
    155	/* INTERRUPT_CNTL__IH_DUMMY_RD_OVERRIDE_MASK=0 - dummy read disabled with msi, enabled without msi
    156	 * INTERRUPT_CNTL__IH_DUMMY_RD_OVERRIDE_MASK=1 - dummy read controlled by IH_DUMMY_RD_EN
    157	 */
    158	interrupt_cntl = REG_SET_FIELD(interrupt_cntl, INTERRUPT_CNTL, IH_DUMMY_RD_OVERRIDE, 0);
    159	/* INTERRUPT_CNTL__IH_REQ_NONSNOOP_EN_MASK=1 if ring is in non-cacheable memory, e.g., vram */
    160	interrupt_cntl = REG_SET_FIELD(interrupt_cntl, INTERRUPT_CNTL, IH_REQ_NONSNOOP_EN, 0);
    161	WREG32_SOC15(NBIO, 0, mmINTERRUPT_CNTL, interrupt_cntl);
    162}
    163
    164static void nbio_v6_1_update_medium_grain_clock_gating(struct amdgpu_device *adev,
    165						       bool enable)
    166{
    167	uint32_t def, data;
    168
    169	def = data = RREG32_PCIE(smnCPM_CONTROL);
    170	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_BIF_MGCG)) {
    171		data |= (CPM_CONTROL__LCLK_DYN_GATE_ENABLE_MASK |
    172			 CPM_CONTROL__TXCLK_DYN_GATE_ENABLE_MASK |
    173			 CPM_CONTROL__TXCLK_PERM_GATE_ENABLE_MASK |
    174			 CPM_CONTROL__TXCLK_LCNT_GATE_ENABLE_MASK |
    175			 CPM_CONTROL__TXCLK_REGS_GATE_ENABLE_MASK |
    176			 CPM_CONTROL__TXCLK_PRBS_GATE_ENABLE_MASK |
    177			 CPM_CONTROL__REFCLK_REGS_GATE_ENABLE_MASK);
    178	} else {
    179		data &= ~(CPM_CONTROL__LCLK_DYN_GATE_ENABLE_MASK |
    180			  CPM_CONTROL__TXCLK_DYN_GATE_ENABLE_MASK |
    181			  CPM_CONTROL__TXCLK_PERM_GATE_ENABLE_MASK |
    182			  CPM_CONTROL__TXCLK_LCNT_GATE_ENABLE_MASK |
    183			  CPM_CONTROL__TXCLK_REGS_GATE_ENABLE_MASK |
    184			  CPM_CONTROL__TXCLK_PRBS_GATE_ENABLE_MASK |
    185			  CPM_CONTROL__REFCLK_REGS_GATE_ENABLE_MASK);
    186	}
    187
    188	if (def != data)
    189		WREG32_PCIE(smnCPM_CONTROL, data);
    190}
    191
    192static void nbio_v6_1_update_medium_grain_light_sleep(struct amdgpu_device *adev,
    193						      bool enable)
    194{
    195	uint32_t def, data;
    196
    197	def = data = RREG32_PCIE(smnPCIE_CNTL2);
    198	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_BIF_LS)) {
    199		data |= (PCIE_CNTL2__SLV_MEM_LS_EN_MASK |
    200			 PCIE_CNTL2__MST_MEM_LS_EN_MASK |
    201			 PCIE_CNTL2__REPLAY_MEM_LS_EN_MASK);
    202	} else {
    203		data &= ~(PCIE_CNTL2__SLV_MEM_LS_EN_MASK |
    204			  PCIE_CNTL2__MST_MEM_LS_EN_MASK |
    205			  PCIE_CNTL2__REPLAY_MEM_LS_EN_MASK);
    206	}
    207
    208	if (def != data)
    209		WREG32_PCIE(smnPCIE_CNTL2, data);
    210}
    211
    212static void nbio_v6_1_get_clockgating_state(struct amdgpu_device *adev,
    213					    u64 *flags)
    214{
    215	int data;
    216
    217	/* AMD_CG_SUPPORT_BIF_MGCG */
    218	data = RREG32_PCIE(smnCPM_CONTROL);
    219	if (data & CPM_CONTROL__LCLK_DYN_GATE_ENABLE_MASK)
    220		*flags |= AMD_CG_SUPPORT_BIF_MGCG;
    221
    222	/* AMD_CG_SUPPORT_BIF_LS */
    223	data = RREG32_PCIE(smnPCIE_CNTL2);
    224	if (data & PCIE_CNTL2__SLV_MEM_LS_EN_MASK)
    225		*flags |= AMD_CG_SUPPORT_BIF_LS;
    226}
    227
    228static u32 nbio_v6_1_get_hdp_flush_req_offset(struct amdgpu_device *adev)
    229{
    230	return SOC15_REG_OFFSET(NBIO, 0, mmBIF_BX_PF0_GPU_HDP_FLUSH_REQ);
    231}
    232
    233static u32 nbio_v6_1_get_hdp_flush_done_offset(struct amdgpu_device *adev)
    234{
    235	return SOC15_REG_OFFSET(NBIO, 0, mmBIF_BX_PF0_GPU_HDP_FLUSH_DONE);
    236}
    237
    238static u32 nbio_v6_1_get_pcie_index_offset(struct amdgpu_device *adev)
    239{
    240	return SOC15_REG_OFFSET(NBIO, 0, mmPCIE_INDEX2);
    241}
    242
    243static u32 nbio_v6_1_get_pcie_data_offset(struct amdgpu_device *adev)
    244{
    245	return SOC15_REG_OFFSET(NBIO, 0, mmPCIE_DATA2);
    246}
    247
    248const struct nbio_hdp_flush_reg nbio_v6_1_hdp_flush_reg = {
    249	.ref_and_mask_cp0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP0_MASK,
    250	.ref_and_mask_cp1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP1_MASK,
    251	.ref_and_mask_cp2 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP2_MASK,
    252	.ref_and_mask_cp3 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP3_MASK,
    253	.ref_and_mask_cp4 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP4_MASK,
    254	.ref_and_mask_cp5 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP5_MASK,
    255	.ref_and_mask_cp6 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP6_MASK,
    256	.ref_and_mask_cp7 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP7_MASK,
    257	.ref_and_mask_cp8 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP8_MASK,
    258	.ref_and_mask_cp9 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__CP9_MASK,
    259	.ref_and_mask_sdma0 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA0_MASK,
    260	.ref_and_mask_sdma1 = BIF_BX_PF0_GPU_HDP_FLUSH_DONE__SDMA1_MASK
    261};
    262
    263static void nbio_v6_1_init_registers(struct amdgpu_device *adev)
    264{
    265	uint32_t def, data;
    266
    267	def = data = RREG32_PCIE(smnPCIE_CONFIG_CNTL);
    268	data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL, CI_SWUS_MAX_READ_REQUEST_SIZE_MODE, 1);
    269	data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL, CI_SWUS_MAX_READ_REQUEST_SIZE_PRIV, 1);
    270
    271	if (def != data)
    272		WREG32_PCIE(smnPCIE_CONFIG_CNTL, data);
    273
    274	def = data = RREG32_PCIE(smnPCIE_CI_CNTL);
    275	data = REG_SET_FIELD(data, PCIE_CI_CNTL, CI_SLV_ORDERING_DIS, 1);
    276
    277	if (def != data)
    278		WREG32_PCIE(smnPCIE_CI_CNTL, data);
    279
    280	if (amdgpu_sriov_vf(adev))
    281		adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
    282			mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
    283}
    284
    285static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
    286{
    287	uint32_t def, data;
    288
    289	WREG32_PCIE(smnRCC_EP_DEV0_0_EP_PCIE_TX_LTR_CNTL, 0x75EB);
    290
    291	def = data = RREG32_PCIE(smnRCC_BIF_STRAP2);
    292	data &= ~RCC_BIF_STRAP2__STRAP_LTR_IN_ASPML1_DIS_MASK;
    293	if (def != data)
    294		WREG32_PCIE(smnRCC_BIF_STRAP2, data);
    295
    296	def = data = RREG32_PCIE(smnRCC_EP_DEV0_0_EP_PCIE_TX_LTR_CNTL);
    297	data &= ~EP_PCIE_TX_LTR_CNTL__LTR_PRIV_MSG_DIS_IN_PM_NON_D0_MASK;
    298	if (def != data)
    299		WREG32_PCIE(smnRCC_EP_DEV0_0_EP_PCIE_TX_LTR_CNTL, data);
    300
    301	def = data = RREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2);
    302	data |= BIF_CFG_DEV0_EPF0_DEVICE_CNTL2__LTR_EN_MASK;
    303	if (def != data)
    304		WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
    305}
    306
    307static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
    308{
    309	uint32_t def, data;
    310
    311	def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
    312	data &= ~PCIE_LC_CNTL__LC_L1_INACTIVITY_MASK;
    313	data &= ~PCIE_LC_CNTL__LC_L0S_INACTIVITY_MASK;
    314	data |= PCIE_LC_CNTL__LC_PMI_TO_L1_DIS_MASK;
    315	if (def != data)
    316		WREG32_PCIE(smnPCIE_LC_CNTL, data);
    317
    318	def = data = RREG32_PCIE(smnPCIE_LC_CNTL7);
    319	data |= PCIE_LC_CNTL7__LC_NBIF_ASPM_INPUT_EN_MASK;
    320	if (def != data)
    321		WREG32_PCIE(smnPCIE_LC_CNTL7, data);
    322
    323	def = data = RREG32_PCIE(smnNBIF_MGCG_CTRL_LCLK);
    324	data |= NBIF_MGCG_CTRL_LCLK__NBIF_MGCG_REG_DIS_LCLK_MASK;
    325	if (def != data)
    326		WREG32_PCIE(smnNBIF_MGCG_CTRL_LCLK, data);
    327
    328	def = data = RREG32_PCIE(smnPCIE_LC_CNTL3);
    329	data |= PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
    330	if (def != data)
    331		WREG32_PCIE(smnPCIE_LC_CNTL3, data);
    332
    333	def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
    334	data &= ~RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER_MASK;
    335	data &= ~RCC_BIF_STRAP3__STRAP_VLINK_PM_L1_ENTRY_TIMER_MASK;
    336	if (def != data)
    337		WREG32_PCIE(smnRCC_BIF_STRAP3, data);
    338
    339	def = data = RREG32_PCIE(smnRCC_BIF_STRAP5);
    340	data &= ~RCC_BIF_STRAP5__STRAP_VLINK_LDN_ENTRY_TIMER_MASK;
    341	if (def != data)
    342		WREG32_PCIE(smnRCC_BIF_STRAP5, data);
    343
    344	def = data = RREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2);
    345	data &= ~BIF_CFG_DEV0_EPF0_DEVICE_CNTL2__LTR_EN_MASK;
    346	if (def != data)
    347		WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
    348
    349	WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_PCIE_LTR_CAP, 0x10011001);
    350
    351	def = data = RREG32_PCIE(smnPSWUSP0_PCIE_LC_CNTL2);
    352	data |= PSWUSP0_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L1_MASK |
    353		PSWUSP0_PCIE_LC_CNTL2__LC_ALLOW_PDWN_IN_L23_MASK;
    354	data &= ~PSWUSP0_PCIE_LC_CNTL2__LC_RCV_L0_TO_RCV_L0S_DIS_MASK;
    355	if (def != data)
    356		WREG32_PCIE(smnPSWUSP0_PCIE_LC_CNTL2, data);
    357
    358	def = data = RREG32_PCIE(smnPCIE_LC_CNTL6);
    359	data |= PCIE_LC_CNTL6__LC_L1_POWERDOWN_MASK |
    360		PCIE_LC_CNTL6__LC_RX_L0S_STANDBY_EN_MASK;
    361	if (def != data)
    362		WREG32_PCIE(smnPCIE_LC_CNTL6, data);
    363
    364	nbio_v6_1_program_ltr(adev);
    365
    366	def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
    367	data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
    368	data |= 0x0010 << RCC_BIF_STRAP3__STRAP_VLINK_PM_L1_ENTRY_TIMER__SHIFT;
    369	if (def != data)
    370		WREG32_PCIE(smnRCC_BIF_STRAP3, data);
    371
    372	def = data = RREG32_PCIE(smnRCC_BIF_STRAP5);
    373	data |= 0x0010 << RCC_BIF_STRAP5__STRAP_VLINK_LDN_ENTRY_TIMER__SHIFT;
    374	if (def != data)
    375		WREG32_PCIE(smnRCC_BIF_STRAP5, data);
    376
    377	def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
    378	data &= ~PCIE_LC_CNTL__LC_L0S_INACTIVITY_MASK;
    379	data |= 0x9 << PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT;
    380	data |= 0x1 << PCIE_LC_CNTL__LC_PMI_TO_L1_DIS__SHIFT;
    381	if (def != data)
    382		WREG32_PCIE(smnPCIE_LC_CNTL, data);
    383
    384	def = data = RREG32_PCIE(smnPCIE_LC_CNTL3);
    385	data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
    386	if (def != data)
    387		WREG32_PCIE(smnPCIE_LC_CNTL3, data);
    388}
    389
    390const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
    391	.get_hdp_flush_req_offset = nbio_v6_1_get_hdp_flush_req_offset,
    392	.get_hdp_flush_done_offset = nbio_v6_1_get_hdp_flush_done_offset,
    393	.get_pcie_index_offset = nbio_v6_1_get_pcie_index_offset,
    394	.get_pcie_data_offset = nbio_v6_1_get_pcie_data_offset,
    395	.get_rev_id = nbio_v6_1_get_rev_id,
    396	.mc_access_enable = nbio_v6_1_mc_access_enable,
    397	.get_memsize = nbio_v6_1_get_memsize,
    398	.sdma_doorbell_range = nbio_v6_1_sdma_doorbell_range,
    399	.enable_doorbell_aperture = nbio_v6_1_enable_doorbell_aperture,
    400	.enable_doorbell_selfring_aperture = nbio_v6_1_enable_doorbell_selfring_aperture,
    401	.ih_doorbell_range = nbio_v6_1_ih_doorbell_range,
    402	.update_medium_grain_clock_gating = nbio_v6_1_update_medium_grain_clock_gating,
    403	.update_medium_grain_light_sleep = nbio_v6_1_update_medium_grain_light_sleep,
    404	.get_clockgating_state = nbio_v6_1_get_clockgating_state,
    405	.ih_control = nbio_v6_1_ih_control,
    406	.init_registers = nbio_v6_1_init_registers,
    407	.remap_hdp_registers = nbio_v6_1_remap_hdp_registers,
    408	.program_aspm =  nbio_v6_1_program_aspm,
    409};