Skip to content

Commit 30eb41f

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amdgpu: Use firmware supported NPS modes
If firmware supported NPS modes are available through CAP register, use those values for supported NPS modes. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent b2a9e56 commit 30eb41f

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

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

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,23 +1594,39 @@ static void gmc_v9_0_set_xgmi_ras_funcs(struct amdgpu_device *adev)
15941594

15951595
static void gmc_v9_0_init_nps_details(struct amdgpu_device *adev)
15961596
{
1597+
enum amdgpu_memory_partition mode;
1598+
uint32_t supp_modes;
1599+
int i;
1600+
15971601
adev->gmc.supported_nps_modes = 0;
15981602

15991603
if (amdgpu_sriov_vf(adev) || (adev->flags & AMD_IS_APU))
16001604
return;
16011605

1602-
/*TODO: Check PSP version also which supports NPS switch. Otherwise keep
1606+
mode = gmc_v9_0_get_memory_partition(adev, &supp_modes);
1607+
1608+
/* Mode detected by hardware and supported modes available */
1609+
if ((mode != UNKNOWN_MEMORY_PARTITION_MODE) && supp_modes) {
1610+
for (i = AMDGPU_NPS1_PARTITION_MODE;
1611+
supp_modes && i <= AMDGPU_NPS8_PARTITION_MODE; i++) {
1612+
if (supp_modes & BIT(i - 1))
1613+
adev->gmc.supported_nps_modes |= BIT(i);
1614+
supp_modes &= supp_modes - 1;
1615+
}
1616+
} else {
1617+
/*TODO: Check PSP version also which supports NPS switch. Otherwise keep
16031618
* supported modes as 0.
16041619
*/
1605-
switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
1606-
case IP_VERSION(9, 4, 3):
1607-
case IP_VERSION(9, 4, 4):
1608-
adev->gmc.supported_nps_modes =
1609-
BIT(AMDGPU_NPS1_PARTITION_MODE) |
1610-
BIT(AMDGPU_NPS4_PARTITION_MODE);
1611-
break;
1612-
default:
1613-
break;
1620+
switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
1621+
case IP_VERSION(9, 4, 3):
1622+
case IP_VERSION(9, 4, 4):
1623+
adev->gmc.supported_nps_modes =
1624+
BIT(AMDGPU_NPS1_PARTITION_MODE) |
1625+
BIT(AMDGPU_NPS4_PARTITION_MODE);
1626+
break;
1627+
default:
1628+
break;
1629+
}
16141630
}
16151631
}
16161632

0 commit comments

Comments
 (0)