Commit 73048bda authored by David Belanger's avatar David Belanger Committed by Alex Deucher

drm/amdgpu: Fix atomics on GFX12

If PCIe supports atomics, configure register to prevent DF from
breaking atomics in separate load/store operations.
Signed-off-by: default avatarDavid Belanger <david.belanger@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 666f14ca)
parent a03ebf11
...@@ -106,7 +106,8 @@ amdgpu-y += \ ...@@ -106,7 +106,8 @@ amdgpu-y += \
df_v1_7.o \ df_v1_7.o \
df_v3_6.o \ df_v3_6.o \
df_v4_3.o \ df_v4_3.o \
df_v4_6_2.o df_v4_6_2.o \
df_v4_15.o
# add GMC block # add GMC block
amdgpu-y += \ amdgpu-y += \
......
...@@ -33,6 +33,7 @@ struct amdgpu_df_hash_status { ...@@ -33,6 +33,7 @@ struct amdgpu_df_hash_status {
struct amdgpu_df_funcs { struct amdgpu_df_funcs {
void (*sw_init)(struct amdgpu_device *adev); void (*sw_init)(struct amdgpu_device *adev);
void (*sw_fini)(struct amdgpu_device *adev); void (*sw_fini)(struct amdgpu_device *adev);
void (*hw_init)(struct amdgpu_device *adev);
void (*enable_broadcast_mode)(struct amdgpu_device *adev, void (*enable_broadcast_mode)(struct amdgpu_device *adev,
bool enable); bool enable);
u32 (*get_fb_channel_number)(struct amdgpu_device *adev); u32 (*get_fb_channel_number)(struct amdgpu_device *adev);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "df_v3_6.h" #include "df_v3_6.h"
#include "df_v4_3.h" #include "df_v4_3.h"
#include "df_v4_6_2.h" #include "df_v4_6_2.h"
#include "df_v4_15.h"
#include "nbio_v6_1.h" #include "nbio_v6_1.h"
#include "nbio_v7_0.h" #include "nbio_v7_0.h"
#include "nbio_v7_4.h" #include "nbio_v7_4.h"
...@@ -2803,6 +2804,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev) ...@@ -2803,6 +2804,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
case IP_VERSION(4, 6, 2): case IP_VERSION(4, 6, 2):
adev->df.funcs = &df_v4_6_2_funcs; adev->df.funcs = &df_v4_6_2_funcs;
break; break;
case IP_VERSION(4, 15, 0):
case IP_VERSION(4, 15, 1):
adev->df.funcs = &df_v4_15_funcs;
break;
default: default:
break; break;
} }
......
/*
* Copyright 2024 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include "amdgpu.h"
#include "df_v4_15.h"
#include "df/df_4_15_offset.h"
#include "df/df_4_15_sh_mask.h"
static void df_v4_15_hw_init(struct amdgpu_device *adev)
{
if (adev->have_atomics_support) {
uint32_t tmp;
uint32_t dis_lcl_proc = (1 << 1 |
1 << 2 |
1 << 13);
tmp = RREG32_SOC15(DF, 0, regNCSConfigurationRegister1);
tmp |= (dis_lcl_proc << NCSConfigurationRegister1__DisIntAtomicsLclProcessing__SHIFT);
WREG32_SOC15(DF, 0, regNCSConfigurationRegister1, tmp);
}
}
const struct amdgpu_df_funcs df_v4_15_funcs = {
.hw_init = df_v4_15_hw_init
};
/*
* Copyright 2024 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __DF_V4_15_H__
#define __DF_V4_15_H__
extern const struct amdgpu_df_funcs df_v4_15_funcs;
#endif /* __DF_V4_15_H__ */
...@@ -484,6 +484,10 @@ static int soc24_common_hw_init(void *handle) ...@@ -484,6 +484,10 @@ static int soc24_common_hw_init(void *handle)
*/ */
if (adev->nbio.funcs->remap_hdp_registers) if (adev->nbio.funcs->remap_hdp_registers)
adev->nbio.funcs->remap_hdp_registers(adev); adev->nbio.funcs->remap_hdp_registers(adev);
if (adev->df.funcs->hw_init)
adev->df.funcs->hw_init(adev);
/* enable the doorbell aperture */ /* enable the doorbell aperture */
soc24_enable_doorbell_aperture(adev, true); soc24_enable_doorbell_aperture(adev, true);
......
/*
* Copyright (C) 2024 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _df_4_15_OFFSET_HEADER
#define _df_4_15_OFFSET_HEADER
#define regNCSConfigurationRegister1 0x0901
#define regNCSConfigurationRegister1_BASE_IDX 4
#endif
/*
* Copyright (C) 2024 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _df_4_15_SH_MASK_HEADER
#define _df_4_15_SH_MASK_HEADER
#define NCSConfigurationRegister1__DisIntAtomicsLclProcessing__SHIFT 0x3
#define NCSConfigurationRegister1__DisIntAtomicsLclProcessing_MASK 0x0003FFF8L
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment