Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2730145pxj; Mon, 31 May 2021 09:16:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpoVpoRraBw97r6ScDfUXpRjrmqbbOZbjHZajKf51hJ5AmjmhouZpjImK4/pqs2Yi74BxC X-Received: by 2002:a05:6e02:810:: with SMTP id u16mr3291285ilm.235.1622477813180; Mon, 31 May 2021 09:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622477813; cv=none; d=google.com; s=arc-20160816; b=bn/lnaCmLy+/o9TcaY7t4Fs/w/dt0zVHcvEZUajHbEIgMZxGB8ZoYaUUXBEPmXsHmz phQm8RzcKb9CYPIX1exMiDyXHn/v2nL7ecB0S/kZIWeHzIOvUJb3AATcZnqrfLSRzkQs T/SQVkVeWB3y8k7UfpOu13i9tca/R7phLi6XFhJO0bzt5IreQ5BXwdH3aK9Q7yQS4JY7 5pFu5ZCQbgZaOpO4ZY0DLdnwvyGo1Btwm+RgoSxjXYCmg2H/IZ+fYwAlw6c9ngCVVZZJ wGM0N1Eg9PqmPa09ifeqzNKGbjNg0EbskKFfoEEB0FgPDJmuMmB9bvB5sFTcfsFjAyMd nFDw== 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=FZinmMKdXvumf8QGPE9cLiV284shIQBDSvEvdo1jF54=; b=lW66QD8rX5BxMk7zvFn0UNOP+4+7uUaH+ycbgBdiHh4bc2UfgI+n7fcbYjOvF5x+wV hT/7RJtDXbPndCyiMQW5+G7IMumOOdLJNf6S/7wBbserdSv//XAaq1A1alYSEL7w7/j+ nUhawitImMyj0abcTR8N5iirPhMT5c17/zhpz1gFNFi/d1b826VJaclbQMLx1fd2JSI6 czlsDJ+ZymzUp39MLrtnIwCEFTP5ac2nT7CEZBh/6LmFGIseCv6o4u3Nm3L/amGNWB3s SpHy7e0qBuSyzsidMLPlBFhGYpPe1eIiKuWN1Ua5fx8cAmN7BMpLSL/Tt+QySai/1HE+ DX2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M88rAJ+X; 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 p12si13551925ilq.5.2021.05.31.09.16.40; Mon, 31 May 2021 09:16:53 -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=M88rAJ+X; 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 S234163AbhEaQRr (ORCPT + 99 others); Mon, 31 May 2021 12:17:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:37024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233403AbhEaOkK (ORCPT ); Mon, 31 May 2021 10:40:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C348161C66; Mon, 31 May 2021 13:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469185; bh=skyXthRAFHGWeqbr96iafRJJWIWT+wiUOEKkchWlxys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M88rAJ+XPgAi0EmDo46W+W8K45oawKkj467NRrH9YL7Qw0+NAao7uR/OgqwTKEesH zhPzJOV3MbOKS9diNVJ2a3JuR8ODwGFRxq2XDRoFHqWyFrLfhsHN1b8KY8znOQmkkL acG2lqJmxYKEg1bgris/qcmjaCZJ7wX76VjpEAx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Zhu , Leo Liu , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher Subject: [PATCH 5.12 056/296] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate Date: Mon, 31 May 2021 15:11:51 +0200 Message-Id: <20210531130705.715305079@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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: James Zhu commit b95f045ea35673572ef46d6483ad8bd6d353d63c upstream. Add cancel_delayed_work_sync before set power gating state to avoid race condition issue when power gating. Signed-off-by: James Zhu Reviewed-by: Leo Liu Acked-by: Christian König Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c @@ -231,9 +231,13 @@ static int vcn_v1_0_hw_fini(void *handle { struct amdgpu_device *adev = (struct amdgpu_device *)handle; + cancel_delayed_work_sync(&adev->vcn.idle_work); + if ((adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) || - RREG32_SOC15(VCN, 0, mmUVD_STATUS)) + (adev->vcn.cur_state != AMD_PG_STATE_GATE && + RREG32_SOC15(VCN, 0, mmUVD_STATUS))) { vcn_v1_0_set_powergating_state(adev, AMD_PG_STATE_GATE); + } return 0; }