amdgpu/pm: Make sysfs pm attributes as read-only for VFs
authorMarina Nikolic <Marina.Nikolic@amd.com>
Tue, 14 Dec 2021 12:57:53 +0000 (20:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:04:51 +0000 (11:04 +0100)
commite4066c05d3327b530bb00d11d3492bac1e69982d
treed0df91577981944d600d64a465ed7c532ae5478c
parent493b87970061f044c5cf795cfd1d679d114844ed
amdgpu/pm: Make sysfs pm attributes as read-only for VFs

[ Upstream commit 11c9cc95f818f0f187e9b579a7f136f532b42445 ]

== Description ==
Setting values of pm attributes through sysfs
should not be allowed in SRIOV mode.
These calls will not be processed by FW anyway,
but error handling on sysfs level should be improved.

== Changes ==
This patch prohibits performing of all set commands
in SRIOV mode on sysfs level.
It offers better error handling as calls that are
not allowed will not be propagated further.

== Test ==
Writing to any sysfs file in passthrough mode will succeed.
Writing to any sysfs file in ONEVF mode will yield error:
"calling process does not have sufficient permission to execute a command".

Signed-off-by: Marina Nikolic <Marina.Nikolic@amd.com>
Acked-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/pm/amdgpu_pm.c