Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3390685pxb; Mon, 17 Jan 2022 19:25:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJ4mRWsLZ66tq/NxTzZN9++vJ9IAveL89Yl22vQDiAUzrj/Qhizns5MPebaDaIlNKjutv6 X-Received: by 2002:a17:902:be18:b0:14a:aef3:af2a with SMTP id r24-20020a170902be1800b0014aaef3af2amr10155567pls.25.1642476247968; Mon, 17 Jan 2022 19:24:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642476247; cv=none; d=google.com; s=arc-20160816; b=h2RmKtUKc0lrK2aExlPcNhH7dgzEFrpxi1i4TJGWgcFf0vtQxcSP0mKGO2r2VpVHcN KoNmJHaF5ZZqgMl4NWBKk5YQFejb26WKQ65sIYqZEYS7pTF7MZ26tUTQZTtBi8mior5z /QFZMbesix7YTGQOmOkGqJXgsrSjR+D9xhiXOyIBW+6nY90941sll4eY3XHVytrJxt8J 1/u//CUMrSfy5qzXpDqlZ3KxXuhHMbk0t2eCmxtH0utm2FSJ966KLQeRXd7tHhdAK95C mwHPJXQ++ekYKqGlsgyttiGDFn+je2ij6SP1S58ZddtTSyP96+7DMHhp9FgyVlBOKFQT Ugqg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vSFonyLm65D/hBGeoDVJBrO2u2JCsvFfQ6Ld4R7ZB9U=; b=ykqTIybznUHQUq59Y+0xx8z044xhetdHaWo8OLf0WGY4859DRYlYbzMaw7T8Nr752K pPC+QCKBHUNCPifOeZf+AyRlDU/iq45hc/ze/iYtLBMManxzvPat3XLjlrRnLehZyLzd 22qbkcersCKPeHG4bEJPooeLwBbdqMpol0ysTrJtTllw3DuMJ98NZVqSJrk2rQ0WlHAA LhRA+UpYVfnpDI2gp853/Q1xcUiS7GZAd/8ECWVVZx3xqG4YQ4FbRAisj3Lve/rdwfeG DyA6EvwY2bTg5uQVqj1mo62RjQVZ3ZFVTdEkQ4jUvuZBSlSotM8+Seo44cYov5owqdDV cPRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MkdzJxjb; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lp13si1555121pjb.181.2022.01.17.19.23.56; Mon, 17 Jan 2022 19:24:07 -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=@kernel.org header.s=k20201202 header.b=MkdzJxjb; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345444AbiARCfo (ORCPT + 99 others); Mon, 17 Jan 2022 21:35:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42390 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344315AbiARC3n (ORCPT ); Mon, 17 Jan 2022 21:29:43 -0500 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 E8F96B81244; Tue, 18 Jan 2022 02:29:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 606A6C36AE3; Tue, 18 Jan 2022 02:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472980; bh=o+qYG+ML9wHDSqQvfw0/Rdn3tY3nA8lbroLnq/hiesA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkdzJxjbGu4pDkLYjH8nvC07Ei5kuKHFfWOoUhYfsYa4sVbv2HLNPhCijROJnc2wN w3alVI4upquEH9K9WlWiR4LmhYmPB1fDjvRmWaOjwNd1CXZRWb0BmFzh1YYh2582eF 7Te4Xdt6ci55sGiEJd87M/+nqA+9tCP4P6unSIp7UhxnYpY1fXeLSgO97cYUmTCcW5 E7KxEcNTxI1z+895k/e/BQN/9gQ4oSjpC8asrtSRrcUq/N6XVL7fsgiI9WZFP6i0w4 TgGZbRqYqp3J+ezMeC+Ur5Ltc1xu0z4ra1WOe4fQ5/aacxXpHgAR3by3hYAJC2W69Y Ldh7f1JFoKchw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Marina Nikolic , Evan Quan , Lijo Lazar , Alex Deucher , Sasha Levin , christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.16 188/217] amdgpu/pm: Make sysfs pm attributes as read-only for VFs Date: Mon, 17 Jan 2022 21:19:11 -0500 Message-Id: <20220118021940.1942199-188-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 41472ed992530..f8370d54100e8 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -2123,6 +2123,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