Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2823945pxa; Sat, 8 Aug 2020 00:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSKvCy7yrA92CCbeadcYUP529GUnw2uqkMSsGUNx8j7uumBPSxBYnK0GHR+TyCYDzfXIgR X-Received: by 2002:a17:906:e46:: with SMTP id q6mr12885480eji.234.1596871571248; Sat, 08 Aug 2020 00:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596871571; cv=none; d=google.com; s=arc-20160816; b=gLLTcGR9QCsYDqf5roqjSdG7CHmzVZaQcU/sS6A1T7v7W12n52E/lot+28NJ5ty2mb 7YnS8t1CZubD5Cz8NsE4VU3h+8VLlF+UJZ4I9kUrX/x6UkA/EYcPJSMa4p0Z0mFUZlUE YZhI1BYVzMJ44Hw41JPjUk2eFgMKt81HYlv1FUTeDRLuhb6mEK49CsxAPb/hX5PPV8nn p6E9lNqUtp3WnLYiGzzfSSW8sLGpDibgCJ+BTC+nEYTW+YKQnbxdrqMwoF4wzZ7NseeU 3bYN/LBVc3ee3Yh966YFPdW/8z0bsMY2xB2fNR7m7DagykZB9zd9H1h8hhPLN94PzWVt NVBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=c9NB68PdhuRtpGy5DkftQyMO/rkJTdRqeTdi9qWSRZU=; b=UxTuRnZISCsZmZ1UvSQuXyTcSfm30Lj15Ekbcf5HfICp36QHA28w9TWVO0nHzHU1h4 Y0buGUPv6eyAclJNSvF4NS7hpnO+1D/2u/2a9tt5E56pwsXHvfmiooAv9BTdsEatD8Ed WF9FCOlFIA9KRJuanfhS9tPzYdPJ4pu1QGU8uvBqJY41eJu2fwYVxWFJkJJsDyt5XKHI 7hV1jru7tTYENXsAOXI07GQNk52h9ltdibPnzKxUK9wWapxqvfQuAwgFm58dB8Oa4kHE f4idhcEWNzR3XVqXx0blYttc69xEEXLzVf/L5siuiKLjJ8ZQoXVf6dvpDntxXCTBFeUr rK4Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si6739029eds.169.2020.08.08.00.25.46; Sat, 08 Aug 2020 00:26:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726128AbgHHHZS (ORCPT + 99 others); Sat, 8 Aug 2020 03:25:18 -0400 Received: from mail.loongson.cn ([114.242.206.163]:50506 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725764AbgHHHZS (ORCPT ); Sat, 8 Aug 2020 03:25:18 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxmMVPUy5fb_4FAA--.2028S2; Sat, 08 Aug 2020 15:25:05 +0800 (CST) From: Tiezhu Yang To: Alex Deucher , christian.koenig@amd.com Cc: Huacai Chen , Jiaxun Yang , linux-mips@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpu/drm: Remove TTM_PL_FLAG_WC of VRAM to fix writecombine issue for Loongson64 Date: Sat, 8 Aug 2020 15:25:02 +0800 Message-Id: <1596871502-3432-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9DxmMVPUy5fb_4FAA--.2028S2 X-Coremail-Antispam: 1UD129KBjvJX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Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Loongson processors have a writecombine issue that maybe failed to write back framebuffer used with ATI Radeon or AMD GPU at times, after commit 8a08e50cee66 ("drm: Permit video-buffers writecombine mapping for MIPS"), there exists some errors such as blurred screen and lockup, and so on. Remove the flag TTM_PL_FLAG_WC of VRAM to fix writecombine issue for Loongson64 to work well with ATI Radeon or AMD GPU, and it has no any influence on the other platforms. [ 60.958721] radeon 0000:03:00.0: ring 0 stalled for more than 10079msec [ 60.965315] radeon 0000:03:00.0: GPU lockup (current fence id 0x0000000000000112 last fence id 0x000000000000011d on ring 0) [ 60.976525] radeon 0000:03:00.0: ring 3 stalled for more than 10086msec [ 60.983156] radeon 0000:03:00.0: GPU lockup (current fence id 0x0000000000000374 last fence id 0x00000000000003a8 on ring 3) Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 7 +++++-- drivers/gpu/drm/radeon/radeon_object.c | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 5ac7b55..9f785f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -136,8 +136,11 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) places[c].fpfn = 0; places[c].lpfn = 0; - places[c].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | - TTM_PL_FLAG_VRAM; + if (IS_ENABLED(CONFIG_MACH_LOONGSON64)) + places[c].flags = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; + else + places[c].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) places[c].lpfn = visible_pfn; diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index f3dee01..c6cede6 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -112,15 +112,23 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) rbo->rdev->mc.visible_vram_size < rbo->rdev->mc.real_vram_size) { rbo->placements[c].fpfn = rbo->rdev->mc.visible_vram_size >> PAGE_SHIFT; - rbo->placements[c++].flags = TTM_PL_FLAG_WC | - TTM_PL_FLAG_UNCACHED | - TTM_PL_FLAG_VRAM; + if (IS_ENABLED(CONFIG_MACH_LOONGSON64)) + rbo->placements[c++].flags = TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; + else + rbo->placements[c++].flags = TTM_PL_FLAG_WC | + TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; } rbo->placements[c].fpfn = 0; - rbo->placements[c++].flags = TTM_PL_FLAG_WC | - TTM_PL_FLAG_UNCACHED | - TTM_PL_FLAG_VRAM; + if (IS_ENABLED(CONFIG_MACH_LOONGSON64)) + rbo->placements[c++].flags = TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; + else + rbo->placements[c++].flags = TTM_PL_FLAG_WC | + TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; } if (domain & RADEON_GEM_DOMAIN_GTT) { -- 2.1.0