Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp626093pxv; Thu, 15 Jul 2021 11:52:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj4bbAef3QlT3F/IEOP0ZKJMpAj/sYbcCJB0YcmE2tFT+2MbHBoW7SMKkCXSrICVx5y4VQ X-Received: by 2002:a05:6638:348c:: with SMTP id t12mr5302832jal.1.1626375178816; Thu, 15 Jul 2021 11:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375178; cv=none; d=google.com; s=arc-20160816; b=L/WCZ6g3uxegqctF71e14FyGYArFT0aLH3Fm2ePYCnAlhuvAo3mB0YNWwY4rrdjqhw 5sppy8LqtA6BMImfvECWnwuWRgzSZLDEG/ZnE3OWzwf+p4nlHMQu0j1Z9AIWUoK2vtbJ ReDiZpf6jF1dnJ/43aozAKFpZWfwcMg5iRvC5UrL85dgDJ/x48VdEWKFBnM2xM6KvNWx lp/OUSavMch2hm1NQsOYEVbFzmaaUnuWDDFTrXjMTXPmPu69O6CM6VIn8Dw80q1t4gv7 Jf+BrwfKVooeqjzJZNiv3Wkn99DOnN1bM4gK1f+nJ4KzYSR1AS2qDI9tsagF/nDeDmY2 nGgA== 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=XwHMDAa/afe9yRBy4W2JZWq9kQMVQQTgodtMIVZSIKE=; b=Zl9K39ftw6Rm6d7PbfTESowAd2lmTl4SwhOWWXskdxNQcCoOiMXMAr2JQe+v4Upf4k NerbC1yuk3SQYO2lN59Cxpyk8Uwn4G0Dty5HLVRKTdySsuAXOTtUTr70DVobKhLNqSJY woeBdtu5KUJIq/HPsqbpbtlWj2T2cjFyNXBMBHBzgFgO6nwvl8koEqMyyB7e0tP5N++C uA3kO0LGK71zEZU7+esvlLfsAAdg3F8pjqNkKS9XbDG4FiGOSBk4MaoU2rV1qS7rpwgQ rUGKeKhHoVXC85AG5rvH47kr2awA8J0XT3UXFuU1uj1tHwiDXJ4TUOs4g5RAeV5AvnHA xh/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="E/+Uk6sr"; 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 z15si157913ilh.22.2021.07.15.11.52.46; Thu, 15 Jul 2021 11:52:58 -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="E/+Uk6sr"; 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 S238569AbhGOSx7 (ORCPT + 99 others); Thu, 15 Jul 2021 14:53:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:53086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240432AbhGOSuV (ORCPT ); Thu, 15 Jul 2021 14:50:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4AAE6613D6; Thu, 15 Jul 2021 18:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374842; bh=RsiBvBu2PyDliwGlIUaelQ+D+RBFtAp5elbXc7441XY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/+Uk6sr4HwbUqdfCS9396YzmH72AYoApCTdUq4xQVIoWIpL5JS1Ht/HKmjtEEh2u BcOoO9UKF6mODAMhaVPayEOYZom1zTVeOLN6r0rBv0I5c6O1CKJD8a2N+KKs7Q34+B QuBMS26vw2GDrh29R4ftahe3PxV+yO3afgCyXw9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiansong Chen , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 048/215] drm/amdgpu: remove unsafe optimization to drop preamble ib Date: Thu, 15 Jul 2021 20:37:00 +0200 Message-Id: <20210715182607.889760131@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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: Jiansong Chen [ Upstream commit 7d9c70d23550eb86a1bec1954ccaa8d6ec3a3328 ] Take the situation with gfxoff, the optimization may cause corrupt CE ram contents. In addition emit_cntxcntl callback has similar optimization which firmware can handle properly even for power feature. Signed-off-by: Jiansong Chen Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 28f20f0b722f..163188ce02bd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c @@ -128,7 +128,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, struct amdgpu_device *adev = ring->adev; struct amdgpu_ib *ib = &ibs[0]; struct dma_fence *tmp = NULL; - bool skip_preamble, need_ctx_switch; + bool need_ctx_switch; unsigned patch_offset = ~0; struct amdgpu_vm *vm; uint64_t fence_ctx; @@ -221,7 +221,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, if (need_ctx_switch) status |= AMDGPU_HAVE_CTX_SWITCH; - skip_preamble = ring->current_ctx == fence_ctx; if (job && ring->funcs->emit_cntxcntl) { status |= job->preamble_status; status |= job->preemption_status; @@ -239,14 +238,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, for (i = 0; i < num_ibs; ++i) { ib = &ibs[i]; - /* drop preamble IBs if we don't have a context switch */ - if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && - skip_preamble && - !(status & AMDGPU_PREAMBLE_IB_PRESENT_FIRST) && - !amdgpu_mcbp && - !amdgpu_sriov_vf(adev)) /* for SRIOV preemption, Preamble CE ib must be inserted anyway */ - continue; - if (job && ring->funcs->emit_frame_cntl) { if (secure != !!(ib->flags & AMDGPU_IB_FLAGS_SECURE)) { amdgpu_ring_emit_frame_cntl(ring, false, secure); -- 2.30.2