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

drm/amdgpu: Add compatible NPS mode info

Populate the compatible NPS modes also for providing partition
configuration details through sysfs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
e5ad7177 81db4eab

+12
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.h
··· 77 77 u8 num_res; 78 78 struct amdgpu_xcp_mgr *xcp_mgr; 79 79 struct kobject kobj; 80 + u16 compatible_nps_modes; 80 81 }; 81 82 82 83 struct amdgpu_xcp_ip_funcs {
+11
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
··· 455 455 int max_res[AMDGPU_XCP_RES_MAX] = {}; 456 456 bool res_lt_xcp; 457 457 int num_xcp, i; 458 + u16 nps_modes; 458 459 459 460 if (!(xcp_mgr->supp_xcp_modes & BIT(mode))) 460 461 return -EINVAL; ··· 468 467 switch (mode) { 469 468 case AMDGPU_SPX_PARTITION_MODE: 470 469 num_xcp = 1; 470 + nps_modes = BIT(AMDGPU_NPS1_PARTITION_MODE); 471 471 break; 472 472 case AMDGPU_DPX_PARTITION_MODE: 473 473 num_xcp = 2; 474 + nps_modes = BIT(AMDGPU_NPS1_PARTITION_MODE); 474 475 break; 475 476 case AMDGPU_TPX_PARTITION_MODE: 476 477 num_xcp = 3; 478 + nps_modes = BIT(AMDGPU_NPS1_PARTITION_MODE) | 479 + BIT(AMDGPU_NPS4_PARTITION_MODE); 477 480 break; 478 481 case AMDGPU_QPX_PARTITION_MODE: 479 482 num_xcp = 4; 483 + nps_modes = BIT(AMDGPU_NPS1_PARTITION_MODE) | 484 + BIT(AMDGPU_NPS4_PARTITION_MODE); 480 485 break; 481 486 case AMDGPU_CPX_PARTITION_MODE: 482 487 num_xcp = NUM_XCC(adev->gfx.xcc_mask); 488 + nps_modes = BIT(AMDGPU_NPS1_PARTITION_MODE) | 489 + BIT(AMDGPU_NPS4_PARTITION_MODE); 483 490 break; 484 491 default: 485 492 return -EINVAL; 486 493 } 487 494 495 + xcp_cfg->compatible_nps_modes = 496 + (adev->gmc.supported_nps_modes & nps_modes); 488 497 xcp_cfg->num_res = ARRAY_SIZE(max_res); 489 498 490 499 for (i = 0; i < xcp_cfg->num_res; i++) {