Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3713007pxb; Mon, 24 Jan 2022 16:05:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJymjTZGVDszr7CEgYVFuPo4zKjAN8uBZAo4HlU3uambpeAxefHMQ9tQKnDxLOvkB5MLFjRY X-Received: by 2002:a17:90b:33ca:: with SMTP id lk10mr762634pjb.108.1643069155296; Mon, 24 Jan 2022 16:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069155; cv=none; d=google.com; s=arc-20160816; b=H7hSwEzk/ivmqyj26XNkTQOIkHQ3k7/JWzMzFQuDPU/0H7WogWsebfyP/inAL9wdyo Huf4zXddtq2ayCDA3HtO+EuZp3FLMZjJuZ3QJeyn7IgYX6mt/MFq/IX9q2dN9GjUkKH9 gbODuebG650Pz5cr+qUe1KAWVvECa1OGxbttQcTE/q/yJ3jAsP0WkLLKqw2pv8OK3SS6 DhVWCv92LiGcPNBPmTUWvUqMJalhlbAiW0AsdXFl+UQr57PR8S966fgFc/cS5onMCqM4 SUT3YnBwc341RqyRiqd4jb9Vn9IUwJbvIBoONqmP9AkW0sWk9IXNC169NnlM+78W83gN bweA== 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=vSFonyLm65D/hBGeoDVJBrO2u2JCsvFfQ6Ld4R7ZB9U=; b=EwBOEtR6hN05kVnxDJhuLkrCbtd3+s4KvhJYxwk8zx+jwLwhLMFrXsiywRk87wjQsx /dkegM40FkIfO4WUblbu6wxjtVAgbDlW2DAYIBZlSq9kJnWONclOcQPJzTK59hmZIwlC rCmsTo1ZztvxU+fKA1AX5w8XcDjPH9d4ESKaG9FdihFkU5HKE54C7YyNg7KeBK6lJHOw OG3f4tpyXqZvGgCFsxtdMyxCymE0unEb1DSeW8k3FWkqHpZANb5BGnsAFyEGVBlTVtNd 8eJ1Bif1P0d7tJwQl0Z10WmtvapLW5vs/mhC8dZTZaRDO0VE5cPcvfSJZ2+QSFj99ZG5 Di/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2BHq/qo/"; 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 ch22si696385pjb.169.2022.01.24.16.05.23; Mon, 24 Jan 2022 16:05:55 -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="2BHq/qo/"; 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 S2368745AbiAXX76 (ORCPT + 99 others); Mon, 24 Jan 2022 18:59:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1847663AbiAXXUQ (ORCPT ); Mon, 24 Jan 2022 18:20:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BBEC028C2E; Mon, 24 Jan 2022 13:28:22 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9467E614CB; Mon, 24 Jan 2022 21:28:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B6A1C340E4; Mon, 24 Jan 2022 21:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059701; bh=o+qYG+ML9wHDSqQvfw0/Rdn3tY3nA8lbroLnq/hiesA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2BHq/qo/ro3EQOt/boZpPTtwPkT4CBYLkreqnoMnKroei294uHGSrQOGiEF40kxFn 0vJaCQI9TGLyEZDzn9EmuGJk3jUuCiQi6FsriyEm79ODoer0+gVRhvJFBo+JbfwfVd uYSyJY8tyigxSG74mavcy6VrwgdoGmPOy7mS5rxY= 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.16 0705/1039] amdgpu/pm: Make sysfs pm attributes as read-only for VFs Date: Mon, 24 Jan 2022 19:41:34 +0100 Message-Id: <20220124184149.031663994@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 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