From patchwork Wed Sep 9 05:29:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 11764889 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68968746 for ; Wed, 9 Sep 2020 05:29:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F14D621D40 for ; Wed, 9 Sep 2020 05:29:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a3j7TQgv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F14D621D40 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lemote.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F4F76E96E; Wed, 9 Sep 2020 05:29:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3D736E96E; Wed, 9 Sep 2020 05:29:13 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id n14so1142093pff.6; Tue, 08 Sep 2020 22:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=1G9PTO00jnlOb0OdBNoipBU+IjJp1bIlfQXTQBpTt3o=; b=a3j7TQgvH8Ny6QPtjUfvhBi8Be1DcH/wJ5Dayhyb14jfwUxwaAs6qo5GgAVlOxl/sJ +jmZqmHz9/+JMpI/AgAGTXnkgpRJOgt+eJphy5+oAVXUnBgRp5K2s6KxJnEeaWvFFUmD 7Ca61ybt3AJAq8GSEn5jzuytePq6ByU4Is7EUyQAlIzCZ0qOaf18GNr4bNTpzFGUvtMM HLLumR5s4bIyMlu4L36sZhOyQy/4tpxfuccZxjFY0IAUFUbR43kdp9Lxh6D1drDH2oxr /QakfOnsG3om2Y7Kg/NCprYiQxi1a2Mz4EpQsZI5/SVs0184Umr/EdQ/GM6aw0+WqEKf E1Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=1G9PTO00jnlOb0OdBNoipBU+IjJp1bIlfQXTQBpTt3o=; b=I5/9gj3nZg3ZNic/I1my2+yrKujyP8kfqcPU9rK32UJyAmz/44AzIHsHYzQbYae9bU JsZxm3xiIFOv8AsoXvZyQNj70el4tCM6w9svvvPqXM0ilyvivVWCRWfBph7tJzeFV8wv WkQOCAto12hsAXMWfRQDSbjvA0aXWUG8u6ZJpR5Q+rbr5CeuzQHZVECaVvv/8QZ/zH17 bYYJeKVMJI9sWK9q4NeefySBUj7bLKaxr8Rkc+PISrStVpv9YLWkYXrsJFm9bLmIvj2E lLqN9EZ901sqonbONUfg9Owouukds4Eoeiy2wSAgjswADhEkP0Wnj16nVzztigsxo+IM Yx+A== X-Gm-Message-State: AOAM532vQzS2RtqFXKPlJ8CdlQn3KUqpET5esho3/lctjxEUAvTQTm/O /lORD2BXVvyXLeUp2jDlIXW9/fyecgPkIw== X-Google-Smtp-Source: ABdhPJxDNxMq6Cak3QiwwG0r8Bu3ou6YWB02N5u0VMz6qkv74PYgKMyiNSE0Xxz0oUqEBStauC+kOQ== X-Received: by 2002:a62:3007:0:b029:13c:1611:6526 with SMTP id w7-20020a6230070000b029013c16116526mr2325805pfw.6.1599629353402; Tue, 08 Sep 2020 22:29:13 -0700 (PDT) Received: from software.domain.org ([45.77.13.216]) by smtp.gmail.com with ESMTPSA id mt8sm790024pjb.17.2020.09.08.22.29.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 22:29:12 -0700 (PDT) From: Huacai Chen To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie Subject: [PATCH 1/2] drm/radeon: Don't use WC for VRAM if !RADEON_GEM_GTT_WC Date: Wed, 9 Sep 2020 13:29:10 +0800 Message-Id: <1599629351-17937-1-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Though RADEON_GEM_GTT_WC is initially used for GTT, but this flag is bound to drm_arch_can_wc_memory(), and if arch doesn't support WC, then VRAM should not use WC. Signed-off-by: Huacai Chen --- drivers/gpu/drm/radeon/radeon_object.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index f3dee01..07b82d9 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -117,10 +117,16 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) 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 (rbo->flags & RADEON_GEM_GTT_WC) { + rbo->placements[c].fpfn = 0; + rbo->placements[c++].flags = TTM_PL_FLAG_WC | + TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; + } else { + rbo->placements[c].fpfn = 0; + rbo->placements[c++].flags = TTM_PL_FLAG_UNCACHED | + TTM_PL_FLAG_VRAM; + } } if (domain & RADEON_GEM_DOMAIN_GTT) { From patchwork Wed Sep 9 05:29:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 11764891 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64F2459D for ; Wed, 9 Sep 2020 05:29:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31CB821D43 for ; Wed, 9 Sep 2020 05:29:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uZWg2yvB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31CB821D43 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lemote.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50FDC6E970; Wed, 9 Sep 2020 05:29:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2FE696E970; Wed, 9 Sep 2020 05:29:21 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id j34so1228462pgi.7; Tue, 08 Sep 2020 22:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IhJZzsST3gRwdDdOyZSCwbfCQK/u9uNH5w2yjyQDKJM=; b=uZWg2yvBmywVfO4I5BDBCJw5AfEMqL1A+McWPALyquTIhyk2CJ1uYwk7gZJBtTNgqW 4FuoCoQ/oHxlFAZfrUQRdoPxBtGnK1q68Ki5wXNXu/JtLHryCGinviZtLc37UvxUOxTR 0dSv6j+L9MkGkBQ2wn/tZAF0ElerAtwoStgI09SOw/ZYoDl6yT/SCXY8XxN7n8uR7J+h qndq0F+QU7VB6Z7DTbI4ybY37rTWXOZ5AjQf+qAmuQQBVrza+322CS/hr07w7cf5X12s gXCeyINPploxN0mzPWT6BqUn89kTrL/Qh01Pp1RK9WeLeYrtwY9DLBzanIlrzQjUUw0t IMmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=IhJZzsST3gRwdDdOyZSCwbfCQK/u9uNH5w2yjyQDKJM=; b=joHpsGHInu4x7uBQK3MUPJCyGm5hxSY6rTYq3ZyvVhX6UR46vi3Hr8eC771SU8H0N1 pp0B4IVy6hNqFhjEGRyDaqZ+qqarTxbOBsvWY1KadpHi+MkmKKPVCX/koTK0PYwvymZe eAbkrP6FDQ7pwdkU26aV3ugVSm6MiOYzbj7fTwUj5T9S7xhGFwvcLYqQGmF/MZco8vbz kntplkd+RX718/rBPmzqXQLuZMD7+aCepZVcTrvkHjeo1fU9Nith6Mku6N90TOvWKLl0 Iui8yz66ufix0c9xM/6JN0slTJ4tZ5Q+NslHb9Y2Y0PBkvIz8l55kT2yirXF2A0YJzzs gNcA== X-Gm-Message-State: AOAM533CZ4B0dWl8E1Nj0DUrf6dPp3dlVtC9c4v7Qr3G+z1iMnrcBwmA UmirG+ZIpfQiucWJU/PUtqA= X-Google-Smtp-Source: ABdhPJxvDXIhW8TYQZjk8ZGxA8N6i1u7r9Owl06QIWUsh9Kn/KTszz9p4awVXKktuiJfp71iZlIC1A== X-Received: by 2002:a62:26c5:: with SMTP id m188mr2105865pfm.156.1599629360855; Tue, 08 Sep 2020 22:29:20 -0700 (PDT) Received: from software.domain.org ([45.77.13.216]) by smtp.gmail.com with ESMTPSA id mt8sm790024pjb.17.2020.09.08.22.29.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 22:29:20 -0700 (PDT) From: Huacai Chen To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie Subject: [PATCH 2/2] drm/amdgpu: Don't use WC for VRAM if !AMDGPU_GEM_CREATE_CPU_GTT_USWC Date: Wed, 9 Sep 2020 13:29:11 +0800 Message-Id: <1599629351-17937-2-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1599629351-17937-1-git-send-email-chenhc@lemote.com> References: <1599629351-17937-1-git-send-email-chenhc@lemote.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Though AMDGPU_GEM_CREATE_CPU_GTT_USWC is initially used for GTT, but this flag is bound to drm_arch_can_wc_memory(), and if arch doesn't support WC, then VRAM should not use WC. Signed-off-by: Huacai Chen --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 5ac7b55..04299f5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -136,8 +136,10 @@ 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; + places[c].flags = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; + + if (flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) + places[c].flags |= TTM_PL_FLAG_WC; if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) places[c].lpfn = visible_pfn;