amdgpu/pm: Make sysfs pm attributes as read-only for VFs
authorjsg <jsg@openbsd.org>
Thu, 27 Jan 2022 23:12:15 +0000 (23:12 +0000)
committerjsg <jsg@openbsd.org>
Thu, 27 Jan 2022 23:12:15 +0000 (23:12 +0000)
From Marina Nikolic
e4066c05d3327b530bb00d11d3492bac1e69982d in linux 5.15.y/5.15.17
11c9cc95f818f0f187e9b579a7f136f532b42445 in mainline linux

sys/dev/pci/drm/amd/pm/amdgpu_pm.c

index fc350a2..50e7874 100644 (file)
@@ -2119,6 +2119,12 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
                }
        }
 
+       /* setting should not be allowed from VF */
+       if (amdgpu_sriov_vf(adev)) {
+               dev_attr->attr.mode &= ~S_IWUGO;
+               dev_attr->store = NULL;
+       }
+
 #undef DEVICE_ATTR_IS
 
        return 0;