From patchwork Wed Aug 26 18:52:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 7079551 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56D1C9F41A for ; Wed, 26 Aug 2015 18:52:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8355E20947 for ; Wed, 26 Aug 2015 18:52:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 88AE120942 for ; Wed, 26 Aug 2015 18:52:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4AAB6E554; Wed, 26 Aug 2015 11:52:18 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 91D966E554 for ; Wed, 26 Aug 2015 11:52:16 -0700 (PDT) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 3614C8E760; Wed, 26 Aug 2015 18:52:16 +0000 (UTC) Received: from localhost.localdomain.com (vpn-56-15.rdu2.redhat.com [10.10.56.15]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7QIq9ue004771; Wed, 26 Aug 2015 14:52:15 -0400 From: jglisse@redhat.com To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/6] drm/amdgpu: Use swiotlb_in_use() to know if swiotlb is enabled. Date: Wed, 26 Aug 2015 14:52:07 -0400 Message-Id: <1440615127-25834-7-git-send-email-jglisse@redhat.com> In-Reply-To: <1440615127-25834-1-git-send-email-jglisse@redhat.com> References: <1440615127-25834-1-git-send-email-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Cc: lkml@vger.kernel.org, Konrad Rzeszutek Wilk , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Ben Skeggs , Daniel Vetter , Alex Deucher , Dave Airlie X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse We can not rely on swiotlb_nr_tbl() to know if swiotlb is in use or not for our device. Use the new helper to determine that. Signed-off-by: Jérôme Glisse Cc: Konrad Rzeszutek Wilk Cc: Alex Deucher Cc: Ben Skeggs Cc: Dave Airlie Cc: lkml@vger.kernel.org Cc: Daniel Vetter --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index dd3415d..bb48fc5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -692,11 +691,9 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm) adev = amdgpu_get_adev(ttm->bdev); -#ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (swiotlb_in_use(adev->dev)) { return ttm_dma_populate(>t->ttm, adev->dev); } -#endif r = ttm_pool_populate(ttm); if (r) { @@ -738,12 +735,10 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm) adev = amdgpu_get_adev(ttm->bdev); -#ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (swiotlb_in_use(adev->dev)) { ttm_dma_unpopulate(>t->ttm, adev->dev); return; } -#endif for (i = 0; i < ttm->num_pages; i++) { if (gtt->ttm.dma_address[i]) { @@ -1190,10 +1185,8 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) count = ARRAY_SIZE(amdgpu_ttm_debugfs_list); -#ifdef CONFIG_SWIOTLB - if (!swiotlb_nr_tbl()) + if (!swiotlb_in_use(adev->dev)) --count; -#endif return amdgpu_debugfs_add_files(adev, amdgpu_ttm_debugfs_list, count); #else