Skip to content

Commit 7169e70

Browse files
YiPeng Chaialexdeucher
authored andcommitted
drm/amdgpu: Add ras module ip block to amdgpu discovery
Add ras module ip block to amdgpu discovery. Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 036f18d commit 7169e70

5 files changed

Lines changed: 32 additions & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
380380

381381
int amdgpu_ip_block_resume(struct amdgpu_ip_block *ip_block);
382382

383-
#define AMDGPU_MAX_IP_NUM 16
383+
#define AMDGPU_MAX_IP_NUM AMD_IP_BLOCK_TYPE_NUM
384384

385385
struct amdgpu_ip_block_status {
386386
bool valid;

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
#include "vcn_v5_0_1.h"
108108
#include "jpeg_v5_0_0.h"
109109
#include "jpeg_v5_0_1.h"
110+
#include "amdgpu_ras_mgr.h"
110111

111112
#include "amdgpu_vpe.h"
112113
#if defined(CONFIG_DRM_AMD_ISP)
@@ -2393,6 +2394,21 @@ static int amdgpu_discovery_set_sdma_ip_blocks(struct amdgpu_device *adev)
23932394
amdgpu_ip_version(adev, SDMA0_HWIP, 0));
23942395
return -EINVAL;
23952396
}
2397+
2398+
return 0;
2399+
}
2400+
2401+
static int amdgpu_discovery_set_ras_ip_blocks(struct amdgpu_device *adev)
2402+
{
2403+
switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) {
2404+
case IP_VERSION(13, 0, 6):
2405+
case IP_VERSION(13, 0, 12):
2406+
case IP_VERSION(13, 0, 14):
2407+
amdgpu_device_ip_block_add(adev, &ras_v1_0_ip_block);
2408+
break;
2409+
default:
2410+
break;
2411+
}
23962412
return 0;
23972413
}
23982414

@@ -3173,6 +3189,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
31733189
if (r)
31743190
return r;
31753191

3192+
r = amdgpu_discovery_set_ras_ip_blocks(adev);
3193+
if (r)
3194+
return r;
3195+
31763196
if ((adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT &&
31773197
!amdgpu_sriov_vf(adev)) ||
31783198
(adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO && amdgpu_dpm == 1)) {

drivers/gpu/drm/amd/include/amd_shared.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ enum amd_ip_block_type {
109109
AMD_IP_BLOCK_TYPE_VPE,
110110
AMD_IP_BLOCK_TYPE_UMSCH_MM,
111111
AMD_IP_BLOCK_TYPE_ISP,
112+
AMD_IP_BLOCK_TYPE_RAS,
112113
AMD_IP_BLOCK_TYPE_NUM,
113114
};
114115

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = {
381381
.hw_fini = amdgpu_ras_mgr_hw_fini,
382382
};
383383

384+
const struct amdgpu_ip_block_version ras_v1_0_ip_block = {
385+
.type = AMD_IP_BLOCK_TYPE_RAS,
386+
.major = 1,
387+
.minor = 0,
388+
.rev = 0,
389+
.funcs = &ras_v1_0_ip_funcs,
390+
};
391+
384392
int amdgpu_enable_uniras(struct amdgpu_device *adev, bool enable)
385393
{
386394
struct amdgpu_ras_mgr *ras_mgr = amdgpu_ras_mgr_get_context(adev);

drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ struct amdgpu_ras_mgr {
5454
bool ras_is_ready;
5555
};
5656

57+
extern const struct amdgpu_ip_block_version ras_v1_0_ip_block;
58+
5759
struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(
5860
struct amdgpu_device *adev);
5961
int amdgpu_enable_uniras(struct amdgpu_device *adev, bool enable);

0 commit comments

Comments
 (0)