Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: define RAS query poison mode function

1. no need to query poison mode on SRIOV guest side, host can handle it.
2. define the function to simplify code.

v2: rename amdgpu_ras_poison_mode_query to amdgpu_ras_query_poison_mode.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Tao Zhou and committed by
Alex Deucher
2dd9032b 3189501e

+33 -21
+33 -21
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
··· 2411 2411 pm_runtime_put_autosuspend(dev->dev); 2412 2412 } 2413 2413 2414 + static void amdgpu_ras_query_poison_mode(struct amdgpu_device *adev) 2415 + { 2416 + struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 2417 + bool df_poison, umc_poison; 2418 + 2419 + /* poison setting is useless on SRIOV guest */ 2420 + if (amdgpu_sriov_vf(adev) || !con) 2421 + return; 2422 + 2423 + /* Init poison supported flag, the default value is false */ 2424 + if (adev->gmc.xgmi.connected_to_cpu) { 2425 + /* enabled by default when GPU is connected to CPU */ 2426 + con->poison_supported = true; 2427 + } else if (adev->df.funcs && 2428 + adev->df.funcs->query_ras_poison_mode && 2429 + adev->umc.ras && 2430 + adev->umc.ras->query_ras_poison_mode) { 2431 + df_poison = 2432 + adev->df.funcs->query_ras_poison_mode(adev); 2433 + umc_poison = 2434 + adev->umc.ras->query_ras_poison_mode(adev); 2435 + 2436 + /* Only poison is set in both DF and UMC, we can support it */ 2437 + if (df_poison && umc_poison) 2438 + con->poison_supported = true; 2439 + else if (df_poison != umc_poison) 2440 + dev_warn(adev->dev, 2441 + "Poison setting is inconsistent in DF/UMC(%d:%d)!\n", 2442 + df_poison, umc_poison); 2443 + } 2444 + } 2445 + 2414 2446 int amdgpu_ras_init(struct amdgpu_device *adev) 2415 2447 { 2416 2448 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 2417 2449 int r; 2418 - bool df_poison, umc_poison; 2419 2450 2420 2451 if (con) 2421 2452 return 0; ··· 2521 2490 goto release_con; 2522 2491 } 2523 2492 2524 - /* Init poison supported flag, the default value is false */ 2525 - if (adev->gmc.xgmi.connected_to_cpu) { 2526 - /* enabled by default when GPU is connected to CPU */ 2527 - con->poison_supported = true; 2528 - } 2529 - else if (adev->df.funcs && 2530 - adev->df.funcs->query_ras_poison_mode && 2531 - adev->umc.ras && 2532 - adev->umc.ras->query_ras_poison_mode) { 2533 - df_poison = 2534 - adev->df.funcs->query_ras_poison_mode(adev); 2535 - umc_poison = 2536 - adev->umc.ras->query_ras_poison_mode(adev); 2537 - /* Only poison is set in both DF and UMC, we can support it */ 2538 - if (df_poison && umc_poison) 2539 - con->poison_supported = true; 2540 - else if (df_poison != umc_poison) 2541 - dev_warn(adev->dev, "Poison setting is inconsistent in DF/UMC(%d:%d)!\n", 2542 - df_poison, umc_poison); 2543 - } 2493 + amdgpu_ras_query_poison_mode(adev); 2544 2494 2545 2495 if (amdgpu_ras_fs_init(adev)) { 2546 2496 r = -EINVAL;