From patchwork Wed Apr 11 06:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10334869 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 163916053B for ; Wed, 11 Apr 2018 06:21:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0216028717 for ; Wed, 11 Apr 2018 06:21:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EACB828736; Wed, 11 Apr 2018 06:21:36 +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=BAD_ENC_HEADER,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 C0D7528734 for ; Wed, 11 Apr 2018 06:21:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4DE336E0BE; Wed, 11 Apr 2018 06:21:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0081.outbound.protection.outlook.com [104.47.32.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 020456E0BE; Wed, 11 Apr 2018 06:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9735BA6Jwi7iYRcPQgouGAwk7TqT7gYF0ANivkEI2+M=; b=YtfK/V+esx0ObnF4k3x3YbjkdGfPa4RplpWqXbrBVUb818ou+KWezviSnJ68J4/idayMJs0mA/qX7KT04OOYtBEg582X1Zm1NTyrOd8e3+JjiB6hEhHk9aPlCr57s1OKd/M/2LOVkk8YZeFS0KD7Unnd/kcLIpSJH4W3FZMKMQQ= Received: from CY4PR12CA0029.namprd12.prod.outlook.com (2603:10b6:903:129::15) by SN1PR12MB0765.namprd12.prod.outlook.com (2a01:111:e400:c45b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Wed, 11 Apr 2018 06:21:27 +0000 Received: from CO1NAM03FT049.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by CY4PR12CA0029.outlook.office365.com (2603:10b6:903:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.675.10 via Frontend Transport; Wed, 11 Apr 2018 06:21:27 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; linux.ie; dkim=none (message not signed) header.d=none; linux.ie; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT049.mail.protection.outlook.com (10.152.81.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.8 via Frontend Transport; Wed, 11 Apr 2018 06:21:27 +0000 Received: from hr-amur2 (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server (TLS) id 14.3.382.0; Wed, 11 Apr 2018 01:21:25 -0500 Date: Wed, 11 Apr 2018 14:26:03 +0800 From: Huang Rui To: Sinan Kaya Subject: Re: [PATCH V2] drm/amdgpu: limit DMA size to PAGE_SIZE for scatter-gather buffers Message-ID: <20180411062602.GA29109@hr-amur2> References: <1523394001-4615-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1523394001-4615-1-git-send-email-okaya@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(39380400002)(346002)(2980300002)(428003)(199004)(189003)(6916009)(104016004)(229853002)(77096007)(26005)(97756001)(4326008)(478600001)(76176011)(106466001)(33896004)(105586002)(486006)(54906003)(97736004)(50466002)(23726003)(316002)(58126008)(305945005)(86362001)(16586007)(6666003)(1076002)(33716001)(126002)(476003)(11346002)(426003)(446003)(81156014)(81166006)(2906002)(68736007)(186003)(8676002)(336012)(6246003)(33656002)(5660300001)(356003)(46406003)(47776003)(55016002)(9686003)(8936002)(53936002)(72206003)(18370500001)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0765; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT049; 1:VpXfnNz2h3Z+0bbDZ3Mker7DmQEGRnfMnuryxjEGkJNvc9lWYioJysiR8Vr8sIgv8uoeqjM+uknSqsEPvbTV+ieLrTfZhHtA5L/Y/UcKJEV4CTciG8b6Kx/ii//eTrsV X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:SN1PR12MB0765; X-Microsoft-Exchange-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1k1NUe+A6c3RnvJvNm6lEmQDt6MV1mJYCaNnHyB+VuEqBS/K67mYMzoIvBkgxfr3v5d0yhnCoeWKoX4XVSPe1ozov8eZCppVry6Yewu7zxCzZX7E2hehekYtmRKWR3FrCYss9rMq4Bu98Z9rPELx5/W8gqBEwJTJtnyie7IJpJmAUSjGuQZeIKX+g18iB6rqrK3OwqFX20dEoT7UMCs8xzms/UF5UajMDG7BGtoAB9QgzpppN2bdXRLHc7j7VxmHxYBPrTPARierSICCzyof+HMUp3wKZVZazh2vWbWu5ZIIbcyqWC2tZrFbJUl6bbl7sIsaDNLD9F416tAMGMEET9gJNOBpb2+y28sc5tW/xHXjV6t0e19Td74F32gzVp+fLWvWivsmpZDQnj6vBpUCe5I+JBnOUReXmIoj7wfy0bQ2KY2QUE/buLWoqLIrK77sESqkvDe9HFaavMhqKHVDHQDFy72E9ElHng9nAsCuSkfIJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(190756311086443); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93003095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:SN1PR12MB0765; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0765; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0765; 4:WxlOsIpxuy3PQuqq2eoBawXPBWA0KBi6WQzCkk1DF1t4FHWQF7ntyPsLu3FGHVOgM6iRV7KJvQpsevJwelllAHsnr0kbXmP95rybcsouEAlImdQeTOuzwyXX/8D+kd9DmnxkzK1m8YOW0U3PH2fqoeFSTm/KfH+0GtM55AgQ4LwLx2hJXQh74MAGxFzRPnMdW31s41dwoOg78VnVbljC/WjxxX3jdXsDEn8o9JvK5OYM8ETHmJ0jqAMuukwzstX9CRNScEYPETJeovT/o2MIPc718EdSGGZILiL5HZLRfxOcpA9t7ADKd8D3NZxcfLch X-Forefront-PRVS: 0639027A9E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0765; 23:pZ+Svx17BjtjKrDBK1XJTW+fkbl2hS0VhQKe309iR?= =?us-ascii?Q?hfrU2QxmzmIs/RSgVA8Un5J/UO9lhQU6mcMdfR3nao+rCMDR7M2qrMfsj7mh?= =?us-ascii?Q?nFDfc+b8382U4I0/bBvz6oxW/rnsEELMMdO1JYvBY7+4g75LtC4m1nabPFTg?= =?us-ascii?Q?W1rVYr2INb6lkLpK3bMH7uNYWxLqL5RscsGVt8n0+SX9I2Z/zxxKSQJjiuF9?= =?us-ascii?Q?x3HoJzWXG7aIvvEQSAjgcBi+o13y3M9YOxoexyG0tIdatcQSJZlEShkprlt1?= =?us-ascii?Q?TlFV61V2bHw7SXV5Bejx2BrgL0dI47WAn2MHMrAcQ/rwHrbM6pRy9xz1XdD2?= =?us-ascii?Q?cCLC6d8S3yMFwaJGRpe+NtfYjXdLyyGncqpXRpnKzaR5T3tEHFy4dqHKhb2r?= =?us-ascii?Q?teYz56YH1yI2kf9zlaGTfJY+09fhVE+FO35dcMeLYwF9Y0xCGuDcUONBHcU/?= =?us-ascii?Q?2nt9hJXIkos0c9wTmwt0M+GUuHMll6ansOFOrNq1SBFWcbW8Z77hzsCrCVV/?= =?us-ascii?Q?vDmJQK0TAllqdr5HHyxFCBHhrYIhCDGx7komN+6u9Z1Q4QtC8/aKjN5uQsbd?= =?us-ascii?Q?KwAeQRf67qjOV6jhDRmXlqnAaPMtr8hrx33p/1xj8hwPacRFfV42EG5hXYcJ?= =?us-ascii?Q?Hnxaoc9uSbwNO4TEghadHLpYQHOs1M6jOAmsG39pmA2qbB52IcZiF9Eaec/m?= =?us-ascii?Q?IYmMWOdaCH+YdkTM5LNVwL3DFt5HD9zqu9Q7Cg97zFcsqMeR5KidjCE35hME?= =?us-ascii?Q?4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244e92OGBkN6ULsOX/e1kFR/zx2NxyKQFZfYEJxH7iFQs6Izbxjjd9+3GgJq+GXyoTEeA3tLd/rmLmhnPCLsHcp67SAbHeovc8Uub73AFY2uNIBqoV1qT1VAwJ14PUnaovbLjiojIkiTVGtRuCMI13uRv X-MS-Office365-Filtering-Correlation-Id: c84f4ce5-b559-4100-5c5a-08d59f747539 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2018 06:21:27.0446 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c84f4ce5-b559-4100-5c5a-08d59f747539 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0765 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: Tom St Denis , sulrich@codeaurora.org, "open list:DRM DRIVERS" , Emily Deng , David Airlie , linux-arm-msm@vger.kernel.org, timur@codeaurora.org, open list , amd-gfx@lists.freedesktop.org, David Panariti , Jim Qu , Roger He , Monk Liu , Feifei Xu , Alex Deucher , Felix Kuehling , Christian =?iso-8859-1?Q?K=F6nig?= , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Apr 10, 2018 at 04:59:55PM -0400, Sinan Kaya wrote: > 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. > > IOMMU driver tries to combine buffers into a single DMA address as much > as it can. The right thing is to tell the DMA layer how much combining > IOMMU can do. > > Signed-off-by: Sinan Kaya Sinan, I guess Christian's suggestion is to add amdgpu_device_init function like here: 8<------- 8<------- After that, we don't do it in each generation. Thanks, Ray diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 0e798b3..9b96771 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2339,6 +2339,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, /* init the mode config */ drm_mode_config_init(adev->ddev); + dma_set_max_seg_size(adev->dev, PAGE_SIZE); + r = amdgpu_device_ip_init(adev); if (r) { /* failed in exclusive mode due to timeout */