Skip to content

Commit 7b6dc07

Browse files
Marina Nikolicgregkh
authored andcommitted
amdgpu/pm: Make sysfs pm attributes as read-only for VFs
[ Upstream commit 11c9cc9 ] == 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>
1 parent 516e332 commit 7b6dc07

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎drivers/gpu/drm/amd/pm/amdgpu_pm.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,12 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
20982098
}
20992099
}
21002100

2101+
/* setting should not be allowed from VF */
2102+
if (amdgpu_sriov_vf(adev)) {
2103+
dev_attr->attr.mode &= ~S_IWUGO;
2104+
dev_attr->store = NULL;
2105+
}
2106+
21012107
#undef DEVICE_ATTR_IS
21022108

21032109
return 0;

0 commit comments

Comments
 (0)