[PATCH 055/109] drm/amdgpu: Add bad page preloading and pre-reservation support
Alex Deucher <[email protected]>
| Newsgroups | org.freedesktop.lists.amd-gfx |
|---|---|
| Message-ID | <[email protected]> |
From: YiPeng Chai <[email protected]> Add bad page preloading and pre-reservation support. v2: Add modification to ensure amdgpu_sw_init does not fail and remove deferred ras instance release. Signed-off-by: YiPeng Chai <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 ++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++++ drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 8 ++------ drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h | 2 ++ 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c index a404d8aa13eee..c03d3c40b4587 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c @@ -2840,6 +2840,7 @@ static int amdgpu_discovery_set_ras_ip_blocks(struct amdgpu_device *adev) case IP_VERSION(13, 0, 6): case IP_VERSION(13, 0, 12): case IP_VERSION(13, 0, 14): + case IP_VERSION(15, 0, 8): amdgpu_device_ip_block_add(adev, &ras_v1_0_ip_block); break; default: diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 1cd12eeee12b6..d3872e4787460 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -3590,7 +3590,10 @@ int amdgpu_ras_init(struct amdgpu_device *adev) amdgpu_ras_check_supported(adev); - if (!adev->ras_enabled || adev->asic_type == CHIP_VEGA10) { + amdgpu_ras_mgr_sw_init(adev); + + if (!con->uniras_enabled && + (!adev->ras_enabled || adev->asic_type == CHIP_VEGA10)) { /* set gfx block ras context feature for VEGA20 Gaming * send ras disable cmd to ras ta during ras late init. */ @@ -3980,6 +3983,8 @@ int amdgpu_ras_fini(struct amdgpu_device *adev) struct amdgpu_ras_block_object *obj = NULL; struct amdgpu_ras *con = amdgpu_ras_get_context(adev); + amdgpu_ras_mgr_sw_fini(adev); + if (!adev->ras_enabled || !con) return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 5bcb6a966941d..8edf1791fa4db 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -56,6 +56,7 @@ #include "amdgpu_amdkfd.h" #include "amdgpu_sdma.h" #include "amdgpu_ras.h" +#include "amdgpu_ras_mgr.h" #include "amdgpu_hmm.h" #include "amdgpu_atomfirmware.h" #include "amdgpu_res_cursor.h" @@ -2158,6 +2159,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) if (r) return r; + /* RAS loads and reserves bad pages */ + amdgpu_ras_mgr_early_init_service(adev); + if (adev->mman.resv_region[AMDGPU_RESV_MEM_TRAIN].size) { struct psp_memory_training_context *ctx = &adev->psp.mem_train_ctx; diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c index 128a9bc1f2f09..525abb7e05474 100644 --- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c @@ -277,9 +277,8 @@ static struct ras_core_context *amdgpu_ras_mgr_create_ras_core(struct amdgpu_dev return ras_core_create(&init_config); } -static int amdgpu_ras_mgr_sw_init(struct amdgpu_ip_block *ip_block) +int amdgpu_ras_mgr_sw_init(struct amdgpu_device *adev) { - struct amdgpu_device *adev = ip_block->adev; struct amdgpu_ras *con = amdgpu_ras_get_context(adev); struct amdgpu_ras_mgr *ras_mgr; int ret = 0; @@ -346,9 +345,8 @@ static int amdgpu_ras_mgr_sw_init(struct amdgpu_ip_block *ip_block) return ret; } -static int amdgpu_ras_mgr_sw_fini(struct amdgpu_ip_block *ip_block) +int amdgpu_ras_mgr_sw_fini(struct amdgpu_device *adev) { - struct amdgpu_device *adev = ip_block->adev; struct amdgpu_ras *con = amdgpu_ras_get_context(adev); struct amdgpu_ras_mgr *ras_mgr; @@ -464,8 +462,6 @@ struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context(struct amdgpu_device *adev) static const struct amd_ip_funcs __maybe_unused ras_v1_0_ip_funcs = { .name = "ras_v1_0", - .sw_init = amdgpu_ras_mgr_sw_init, - .sw_fini = amdgpu_ras_mgr_sw_fini, .hw_init = amdgpu_ras_mgr_hw_init, .hw_fini = amdgpu_ras_mgr_hw_fini, }; diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h index cb98606306932..32416c9d6086e 100644 --- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h +++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.h @@ -61,6 +61,8 @@ struct amdgpu_ras_mgr { extern const struct amdgpu_ip_block_version ras_v1_0_ip_block; +int amdgpu_ras_mgr_sw_init(struct amdgpu_device *adev); +int amdgpu_ras_mgr_sw_fini(struct amdgpu_device *adev); int amdgpu_ras_mgr_early_init_service(struct amdgpu_device *adev); struct amdgpu_ras_mgr *amdgpu_ras_mgr_get_context( struct amdgpu_device *adev); -- 2.55.0