Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1497038imu; Sat, 5 Jan 2019 00:05:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN7cxaJzdaraBG7veloTzu6a8VLnBrPC5O3EWbyeum9cQjSIi9WMKQh8uH+dE74JLG6fOW3D X-Received: by 2002:a63:e84c:: with SMTP id a12mr4154280pgk.241.1546675510398; Sat, 05 Jan 2019 00:05:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546675510; cv=none; d=google.com; s=arc-20160816; b=UAiPofCvJBfzYZEw/ggOW/xJMS/uKI5yz3nbOjK+04eUH8U0nPX8Y0p3NUtGEVl9cV PqjTpmWWQIke/S+TVtOz5odSVQ3YB2iv30vPUwNhUOtSpIsBaFRTAi5hEYGPcnVmF+c8 jQlKcfDBPFV+iy9XaMWL0yKe4cqzrusBBsasWGTmpyGSZwdbFZs0xhRhhSdBYci5qI2S G8Ac0nG36kkVP+I09VFhVC5qKkuWQfxekQ3a36HDOKVnZBtC8+BKHAYy2O4eEv4yradM lB6AF8jSqtacQrqhtYo5hca8tDqVTJMl2TsHtQhbU7oYBncfu6pb6YXofldytihcNpuI IPBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z+dLqQnDzg6pSFWK9vinzCeDwTmAztAiAzF/q1mSZ1I=; b=TL2va4+hlK2JS145/41h8y7dw5npNUZgcPwCO0jjgWN1ExXum3+DiE0H72WrryRKho cCnZUjOFeDmofQ4PRZsUbEjNQYr1Q2YH2Y6zB8DXOT/tY7RODW04fgGHTF84q53rnTLZ uvjZbwCgtUJoOSmeWBBdAG6rIPhZL+TayktAze6dDHrNCDoddp7WXJPw7hTPnxUeSa8R 6OSfpiF5XL4kyBvSQjrW2AT+5gXntUG86XyLYPimr+flkT5WK9oNnekS6cqAwZp9YO75 E98GxZFeeVxj883HVEQ4h2JMRGRpm3SMNXLRVucHez8milJLwpVrAOh8SqpxyNqQ0MLb s5nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OIBdm2x6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si56910258pgc.448.2019.01.05.00.04.55; Sat, 05 Jan 2019 00:05:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OIBdm2x6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726301AbfAEIBY (ORCPT + 99 others); Sat, 5 Jan 2019 03:01:24 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48842 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfAEIBW (ORCPT ); Sat, 5 Jan 2019 03:01:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Z+dLqQnDzg6pSFWK9vinzCeDwTmAztAiAzF/q1mSZ1I=; b=OIBdm2x6r/i8+DQChQidTW9iWB BupcQoFn6o0UwyH4JVnJMq/Ew/KLQW0QQvWlXHOVwhRmwXSlo6UfPSBFsveNCr7WYTIqc7EM1OrHD PIsWKHiOeo09lOVzv+KBTKYpNvVDBb7CQPf3aCt4evnTWcUjIZcAxht1ESAn1AYIe4sLwmKnvb7+N IlJdaGM2LTENkzwoMHwo5LAeZgM05a19LhYISaubEUNfz9vyAwGOVMMClKrQY++HqPcYkqjz/YK/H XjdWDyEUJRaksUOpi2YdQVSjzaC/nk558Jb45locJ16e6hN9fc0IijwOBJrthhzj2hp1SC9N0CE1E JoJjXMoA==; Received: from 089144213048.atnat0022.highway.a1.net ([89.144.213.48] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfgtU-0000JS-Ok; Sat, 05 Jan 2019 08:01:21 +0000 From: Christoph Hellwig To: thellstrom@vmware.com Cc: linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] drm/vmwgfx: fix the check when to use dma_alloc_coherent Date: Sat, 5 Jan 2019 09:01:07 +0100 Message-Id: <20190105080108.14837-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190105080108.14837-1-hch@lst.de> References: <20190105080108.14837-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since Linux 4.21 we merged the swiotlb ops into the DMA direct ops, so they would always have a the sync_single methods. But late in the cicle we also removed the direct ops entirely, so we'd see NULL DMA ops. Switch vmw_dma_select_mode to only detect swiotlb presence using swiotlb_nr_tbl() instead. Fixes: 55897af630 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code") Fixes: 356da6d0cd ("dma-mapping: bypass indirect calls for dma-direct") Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 236052ad233c..c2060f6cc9e8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -565,7 +565,6 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) [vmw_dma_alloc_coherent] = "Using coherent TTM pages.", [vmw_dma_map_populate] = "Keeping DMA mappings.", [vmw_dma_map_bind] = "Giving up DMA mappings early."}; - const struct dma_map_ops *dma_ops = get_dma_ops(dev_priv->dev->dev); if (intel_iommu_enabled) { dev_priv->map_mode = vmw_dma_map_populate; @@ -578,14 +577,12 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) return 0; } - dev_priv->map_mode = vmw_dma_map_populate; - - if (dma_ops && dma_ops->sync_single_for_cpu) - dev_priv->map_mode = vmw_dma_alloc_coherent; #ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl() == 0) - dev_priv->map_mode = vmw_dma_map_populate; + if (swiotlb_nr_tbl()) + dev_priv->map_mode = vmw_dma_alloc_coherent; + else #endif + dev_priv->map_mode = vmw_dma_map_populate; out_fixup: if (dev_priv->map_mode == vmw_dma_map_populate && -- 2.20.1