From patchwork Wed Apr 11 22:11:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10337959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8765260329 for ; Thu, 12 Apr 2018 07:29:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7129C286A8 for ; Thu, 12 Apr 2018 07:29:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65B1F286AC; Thu, 12 Apr 2018 07:29:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 033AE286A8 for ; Thu, 12 Apr 2018 07:29:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C9D76E779; Thu, 12 Apr 2018 07:29:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D38C6E235; Wed, 11 Apr 2018 22:11:31 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 35A2C60F6D; Wed, 11 Apr 2018 22:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523484691; bh=l0zxObLyq3YAsL45jMFX0t9REcqCtnJt3C0zjTM6SBQ=; h=From:To:Cc:Subject:Date:From; b=kDVLSbaI6xFuOzvaDTUBmGmDDuryJCHW+iQ1MyZJEioVN7sAUZZnbSUPA/6NhfK7D aUWLKWswWgpNxcWMBQF6sXy1PZy0/gO8dAwlwIXP+RTuwro43tnWt27fz8v0lSZ+I4 iajP6KWDRInzgacL+VfZyPRltmXUL3xYKNJ9AFBI= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1CE3660386; Wed, 11 Apr 2018 22:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523484690; bh=l0zxObLyq3YAsL45jMFX0t9REcqCtnJt3C0zjTM6SBQ=; h=From:To:Cc:Subject:Date:From; b=UqFajLt4O47uGZ0TeNthasuAEIrcDbPHB2dG2AjsldqzVDsuDzbY0SCBZ+5PDuJVF m+cXG+DkF2fnyU8ht1pSmVXAAD705f2ADIop1A8S0pb3hDm/VslLt2I9HfU8BLY+ka 9eGCT2WCm3UM40SzAEUEY/qk2576D9NQ4xQiKOSA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1CE3660386 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: amd-gfx@lists.freedesktop.org, sulrich@codeaurora.org, timur@codeaurora.org Subject: [PATCH V3] drm/amdgpu: limit DMA size to PAGE_SIZE for scatter-gather buffers Date: Wed, 11 Apr 2018 18:11:22 -0400 Message-Id: <1523484684-10426-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 12 Apr 2018 07:29:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, Horace Chen , open list , "open list:DRM DRIVERS" , Sinan Kaya , Pixel Ding , Monk Liu , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Code is expecing to observe the same number of buffers returned from dma_map_sg() function compared to sg_alloc_table_from_pages(). This doesn't hold true universally especially for systems with IOMMU. The hardware actually needs the dma_address on a page by page basis. Joining multiple consecutive pages into one entry is just additional overhead which we don't need. Signed-off-by: Sinan Kaya --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index af1b879..91abe1a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1948,6 +1948,9 @@ int amdgpu_device_init(struct amdgpu_device *adev, /* init the mode config */ drm_mode_config_init(adev->ddev); + /* limit scatter-gather buffer size to PAGE_SIZE */ + dma_set_max_seg_size(adev->dev, PAGE_SIZE); + r = amdgpu_device_ip_init(adev); if (r) { /* failed in exclusive mode due to timeout */