Skip to content

Commit 11c9cc9

Browse files
Marina Nikolicalexdeucher
authored andcommitted
amdgpu/pm: Make sysfs pm attributes as read-only for VFs
== 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 <[email protected]> Acked-by: Evan Quan <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent fec8c52 commit 11c9cc9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,12 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
21342134
}
21352135
}
21362136

2137+
/* setting should not be allowed from VF */
2138+
if (amdgpu_sriov_vf(adev)) {
2139+
dev_attr->attr.mode &= ~S_IWUGO;
2140+
dev_attr->store = NULL;
2141+
}
2142+
21372143
#undef DEVICE_ATTR_IS
21382144

21392145
return 0;

0 commit comments

Comments
 (0)