Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3064910pxf; Mon, 5 Apr 2021 02:09:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp4Rj6nKpQh7Z0isidr4zXxOTCGCwjIIChmy/w9NObhODBk+hf0kEvF37D3HSm75SbQyT2 X-Received: by 2002:a92:db50:: with SMTP id w16mr17832943ilq.287.1617613757297; Mon, 05 Apr 2021 02:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617613757; cv=none; d=google.com; s=arc-20160816; b=yvZQXBZHLeMLib39NxfRGRatlbio+qW9YRnamsJitxLaPOXRGyszTO2Dplz5DNRjCY pjZhb4lJbD3LIZsw4yaJQ62eGZBAJdyxB/PxllG35Pp+mlMcve4C+Ja5dSTGUXIZU4OH YmHlYhs1vujaXg7p3+2lAou+8NfuQvvQcajMXgRZU+nPprwLgOYgBl68vze9JKFpIYr8 UbMPGrpXWY9Xoxmp1/849r5F8Q/hp65ceAC/MAMHs5ihAw/HKtTF57UcgQnmLh/21grq fY6sslwN1v0XVLBI/Pak4BDVDkqzvtH2Z5mKDs+dipaRrSGqbuD1xmFVEJqd4cGJdLdl eAqA== 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=eEfY8MrLxfUlg6Ms7DHC7Rzm+vT269sDchC4Q3GfWRg=; b=P72OmtfP+BJYDQKj7zG+rkPHvFD5YEz6hwm3mhFb240q84dGPdQsahi13vaW/A8yhs TAW2yngJyvKIyQgRdjXaL+4ckmHctcTa3JJLz4ziW//IgDysAm3TVj2wRIdKY2LzPvIC 08jjyqryTD4VX/UPHJHwa3kCgMlB6PIDirCY3jQN9YZWkO3DXmy7oaYxJhWKRX6chycb 6sd4NK2WEjOObFFSPDJt4JloqMEa7J5b0lvE5dT1PGbEdk2T+PaIfT17jGHJobBfGQSP iwiE4jp6OW8t1hyX7WTI1s/RlGJ0+qcDJvi6PpwN24hLmnGdc4e1CSEOjtXT2MImOrNM UD3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OIa1iXbc; 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 a12si4284724iln.40.2021.04.05.02.09.05; Mon, 05 Apr 2021 02:09:17 -0700 (PDT) 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=OIa1iXbc; 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 S238527AbhDEJH7 (ORCPT + 99 others); Mon, 5 Apr 2021 05:07:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:50344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237887AbhDEJF6 (ORCPT ); Mon, 5 Apr 2021 05:05:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 15A0161394; Mon, 5 Apr 2021 09:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617613551; bh=35/dROHV2ANHJel4dRyq7Yb8FcwXvHaen4nqbCzvkjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OIa1iXbcC7ylqArAFak56/RqhIvA+IKadVgEioBV3fU8Fz5DVTVg8rrKmazcrS8ew 9Rd89g2GlokBLvZX5HTM9zBy9ON7blx055arvcmzy9sHy+CzIKJZwSuunWIIfzIZOy YwAjGddTHlyK7jEMNsLphmdO3CIqJdbDki9ZNigU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Hunter , Thierry Reding Subject: [PATCH 5.4 54/74] drm/tegra: sor: Grab runtime PM reference across reset Date: Mon, 5 Apr 2021 10:54:18 +0200 Message-Id: <20210405085026.492199861@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405085024.703004126@linuxfoundation.org> References: <20210405085024.703004126@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: Thierry Reding commit ac097aecfef0bb289ca53d2fe0b73fc7e1612a05 upstream. The SOR resets are exclusively shared with the SOR power domain. This means that exclusive access can only be granted temporarily and in order for that to work, a rigorous sequence must be observed. To ensure that a single consumer gets exclusive access to a reset, each consumer must implement a rigorous protocol using the reset_control_acquire() and reset_control_release() functions. However, these functions alone don't provide any guarantees at the system level. Drivers need to ensure that the only a single consumer has access to the reset at the same time. In order for the SOR to be able to exclusively access its reset, it must therefore ensure that the SOR power domain is not powered off by holding on to a runtime PM reference to that power domain across the reset assert/deassert operation. This used to work fine by accident, but was revealed when recently more devices started to rely on the SOR power domain. Fixes: 11c632e1cfd3 ("drm/tegra: sor: Implement acquire/release for reset") Reported-by: Jonathan Hunter Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/tegra/sor.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -2871,6 +2871,12 @@ static int tegra_sor_init(struct host1x_ * kernel is possible. */ if (sor->rst) { + err = pm_runtime_resume_and_get(sor->dev); + if (err < 0) { + dev_err(sor->dev, "failed to get runtime PM: %d\n", err); + return err; + } + err = reset_control_acquire(sor->rst); if (err < 0) { dev_err(sor->dev, "failed to acquire SOR reset: %d\n", @@ -2904,6 +2910,7 @@ static int tegra_sor_init(struct host1x_ } reset_control_release(sor->rst); + pm_runtime_put(sor->dev); } err = clk_prepare_enable(sor->clk_safe);