From 370d26e10538d9c8d1a171d439c48ca6493c3d03 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 27 Jan 2022 23:12:15 +0000 Subject: [PATCH] amdgpu/pm: Make sysfs pm attributes as read-only for VFs 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/pci/drm/amd/pm/amdgpu_pm.c b/sys/dev/pci/drm/amd/pm/amdgpu_pm.c index fc350a2557b..50e7874c6e5 100644 --- a/sys/dev/pci/drm/amd/pm/amdgpu_pm.c +++ b/sys/dev/pci/drm/amd/pm/amdgpu_pm.c @@ -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; -- 2.20.1