Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3674773pxb; Mon, 24 Jan 2022 15:04:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxi6oVADt4jOt/LpD5jXl+sYaCdYkOCfw8ewfq15kVU5T+P1Y0oBTbCwq9r8NoW8Esg15Pp X-Received: by 2002:a63:e70b:: with SMTP id b11mr13516508pgi.203.1643065460816; Mon, 24 Jan 2022 15:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065460; cv=none; d=google.com; s=arc-20160816; b=B0mhpUaA2CuchJoLb2Ni+QcvFrO3bAIwTzL5vrge8o4g2kM/ddn+nuHUaEMXtAfnFD DfwKdefso0Lc1T6anl5GiBLD5BvnVZJiLCXDcwxnDNIxNFOOZOTnkyR1JT7bibhMAKr8 2OwsRZsyiaycJMjr8aLJENaVSsAKrjQ5pdngSCUCesUyw2ix4aNpz6o6gS+GL2RLUVMp eNmN7DjansAWnc5izrCPw+6sZN+IuIXanBAU+O+3S6sihjRZ/CZwabdF+nfQzQj4SpkF fHwgXppSoMfys1plxbdBN4AC+IFh/9RbgR6IDkZtNBugOHkgT2NG8auipsdyBPHmH6hj 1h0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CY/E5OKRPxK3L2be3VyDtswHElu3cTYSnjajQ3e4v2s=; b=cBhS1QwLrqvxiB8jklbnqKOBbpvqj0Sjsz74voWgwiDxBOhg5giSl2iKbZ+n/BESb1 bLM9GzeaEpFO5TfMU+IxvbA24sJic+eWPGSEyeEmNUfA0XWNzJkjzsYnvAjZurjuRYV2 gwVOwyIckfWbXLgyI0sJ5CN98hyayCZMzFkey69TsV1GuMKFDB/kSOgDJJRUdyAuluur M7N+mxuMySpmaG+oN56RmV06F8/VZ4nrUPUaQyy57grfiBvivCGHoz9e/lt+aB/T5YGK dZeOdEYqokDYvdPwVBDqGNjDlO9l+TsG/HWvpYUjMuy8v6MW9Q1NCG7mpipdZpXquD55 mtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uCWOjcgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si7818139pfi.361.2022.01.24.15.04.08; Mon, 24 Jan 2022 15:04:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uCWOjcgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382159AbiAXW6F (ORCPT + 99 others); Mon, 24 Jan 2022 17:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380481AbiAXV7S (ORCPT ); Mon, 24 Jan 2022 16:59:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8C0AC0C0925; Mon, 24 Jan 2022 12:39:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D8F4B80FA3; Mon, 24 Jan 2022 20:39:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51D12C340E5; Mon, 24 Jan 2022 20:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056778; bh=62gaORYSPJT9CczU4qMGP9Eyq2uaRncI4NxIrYxJHVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uCWOjcgDDLeY3rg2LC2vIPikXcKBEy+bSg79fyzXl3oESAUoWEveiFvRwBtlLs1Fo jaQ+1T9E5jzF6kF3Ncy24Jp3uojt7Krpi4FGoWyHvO7JW3b42CRLEMm1xKmjvlhc8C LLqJ3AFZNgBAPf6tTZThyRhXo16BLzGm0x3nKP6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marina Nikolic , Evan Quan , Lijo Lazar , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 597/846] amdgpu/pm: Make sysfs pm attributes as read-only for VFs Date: Mon, 24 Jan 2022 19:41:54 +0100 Message-Id: <20220124184121.631507396@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marina Nikolic [ Upstream commit 11c9cc95f818f0f187e9b579a7f136f532b42445 ] == 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 Acked-by: Evan Quan Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 249cb0aeb5ae4..32a0fd5e84b73 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -2117,6 +2117,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.34.1