drm/amdgpu: Add sysfs interfaces for NPS mode
authorLijo Lazar <lijo.lazar@amd.com>
Thu, 19 Sep 2024 14:06:19 +0000 (19:36 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Oct 2024 18:32:23 +0000 (14:32 -0400)
commit012be6f22c01e25c995c30f1f178ac11820dfb65
treef9ed8d6deb0a6145fcb2fc036883df4cb9a3b883
parentbbc160084edad8db569f6af0291e0ff9a8f41c0c
drm/amdgpu: Add sysfs interfaces for NPS mode

Add a sysfs interface to see available NPS modes to switch to -

cat /sys/bus/pci/devices/../available_memory_paritition

Make the current_memory_partition sysfs node read/write for requesting a
new NPS mode. The request is only cached and at a later point a driver
unload/reload is required to switch to the new NPS mode.

Ex:
echo NPS1 > /sys/bus/pci/devices/../current_memory_paritition
echo NPS4 > /sys/bus/pci/devices/../current_memory_paritition

The above interfaces will be available only if the SOC supports more than
one NPS mode.

Also modify the current memory partition sysfs logic to be more
generic.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h