Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2655255pxj; Mon, 31 May 2021 07:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcCb03RoCHwkO5HRJmNPmYDPiN0Tqjebkl/K4dF9LQDEzMT9BDYdXDQ74gUTYQKkrRTPK/ X-Received: by 2002:a5d:960b:: with SMTP id w11mr17671395iol.138.1622471466266; Mon, 31 May 2021 07:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471466; cv=none; d=google.com; s=arc-20160816; b=Dz5o0GVJTjKBAMgz+dEU6hBgDZsuoB2k+IljMtfQuWqdFN0TthHyCpE962X5NGos7l 5DqMSDMjQ34E10zfOe8IpRaOi+lwRt2TMj2O4y6dXPF6a9JI+f9RDfB2arIIhh0zGixE yOXcl9EBJj+BrNMpwkcoTTejosY4rR82TmfUl2ar2LY9IceL1j/hGfGV6pQ4VKi86/sZ EQT8TRK4eVZA+4UxrMA1feg/kz3YoJ85XOPKBAcF6fLSqe467TmYKvZfpR8KD1PDmf5W Yf9/ewKQJkRxHhSfrd46InkX0K2n7wrcYFw3PZrDjNboTm98N9fifePQY0gz4g6Rl3w7 3ecQ== 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=2Eqraz+UPUvAwVjLJkEAwXTWNnqEZ3XrrbPIXtv9hkM=; b=0jUMsdOAId8aR4pUNWxRcZbRBho6Z41nSE76TblSH9i+dfs3WK2xCWmgS09xjJ8CZe KVhigQpJqQF2Jm5EPoyEZbD53bTFcO8w4nXcfHgFpNOUMjyJpmHLWWogsR39mNW02hRg 8KLmhsvlVheJ7Ame+Rx24CX0i3S6ekU4c/+NBn/u0ENyP1CFCMWSC+n9GGBfdIKQrik+ zzlQjL/L4zsnmAUmfcMkZnHGWhZC4MtJ+HwaUzUZsR/uLKiqQH0ut1cM8anOLUAzYNkJ acVbRj5K/BApGq4tJd9GSbAI+pxunvtZRRbkHONodqB464EahPE/UqnUiZ9r3tiJkJ21 Cy2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m+a2z28h; 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 s8si5746850jam.110.2021.05.31.07.30.53; Mon, 31 May 2021 07:31:06 -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=m+a2z28h; 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 S234118AbhEaOaX (ORCPT + 99 others); Mon, 31 May 2021 10:30:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbhEaNxT (ORCPT ); Mon, 31 May 2021 09:53:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8CC9F61919; Mon, 31 May 2021 13:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467995; bh=TZ+BvSzQSQQ6Wj2maDP4Z+N3numtIi8t8pOOLudM5YA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+a2z28hq8ZCfxU8VIo31WFplbZPBHESpwbk7axoqUU3H6zcLaMFaeMcmoAPLEoS8 TkqRjJS+yM8AeD7B+SbSDeGx2r3jxGmxsJLK6tFK8vcSXkt4FsZ6Xz/n2ju8ljmOt2 OqAGKARr7mZEwvprMa+ipt2qj/KzUvf3rRejRk3w= 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.10 042/252] drm/amdgpu/vcn1: add cancel_delayed_work_sync before power gate Date: Mon, 31 May 2021 15:11:47 +0200 Message-Id: <20210531130659.421154909@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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 @@ -232,9 +232,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; }