gpu: nvgpu: remove sudo restrictions on gpu nodes.

When SMC modes are enabled, devices are created with sudo-only
access permissions. Those permissions are relaxed to allow non-sudo
processes to allow job submission.

Also, allow only root users to poweroff explicitely via the device
power node.

Bug 3374078

Change-Id: Ieb869399c3ada3588708cf2bc99a580414023cb7
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2590584
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Debarshi Dutta
2021-09-07 18:18:39 +05:30
committed by mobile promotions
parent f3164a4672
commit 79ab0ba6c4
3 changed files with 6 additions and 17 deletions

View File

@@ -1832,6 +1832,11 @@ int gk20a_driver_force_power_off(struct gk20a *g)
struct gk20a_platform *platform = gk20a_get_platform(dev);
int err = 0;
if (!capable(CAP_SYS_NICE)) {
nvgpu_err(g, "User doesn't have the permission for this operation");
return -EPERM;
}
#ifdef CONFIG_NVGPU_DGPU
if (g->pci_class) {
nvgpu_err(g, "Poweroff is not supported for device yet.");