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: 10337519 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 E831F60134 for ; Wed, 11 Apr 2018 22:11:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D75BF28179 for ; Wed, 11 Apr 2018 22:11:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB5B4283BD; Wed, 11 Apr 2018 22:11:48 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5EDD228179 for ; Wed, 11 Apr 2018 22:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=k9WrTK4gDMov+5pxLOhHb2BfFYFseYVK8o26O6yJI7g=; b=i4dN88a09SvSES axv+42iLZaTakCYqCQcelWeflbtDzmtkuTZgxp7exD1W83rfc2eauqRHHWpHFJcwQ56wlYsrSaqx+ cVda1RlzGn3p4pLtvIZKnXbegiWhe977RdFHVmrC6N9LyIEsxtV64HEZBEkjtjPmcKm9FWUuT4Lea s4jdyk1RDqJETjSNYLaRbOj8oQ/4tjXeGk8mFLfL+xnkeisBNdSG4vS6VL+sk5XgcSrZISlE/41jS qK+V3ML9yO3h/siQ67jOia8mPY7bLxnpgd4VmuUbPD/r/TxrRwUsRCRJLdGSbU/2MhQlk+7iGSxBv hzkhz+4NXJfht8siUWIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6Nxw-0006fj-JN; Wed, 11 Apr 2018 22:11:44 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6Nxu-0006dN-88 for linux-arm-kernel@lists.infradead.org; Wed, 11 Apr 2018 22:11:43 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 530F960386; 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180411_151142_312581_E7FD94E2 X-CRM114-Status: GOOD ( 11.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "David \(ChunMing\) Zhou" , David Airlie , linux-arm-msm@vger.kernel.org, Horace Chen , open list , "open list:DRM DRIVERS" , Sinan Kaya , Pixel Ding , Monk Liu , Alex Deucher , Harry Wentland , =?UTF-8?q?Christian=20K=C3=B6nig?= , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 */