From patchwork Thu Feb 8 08:32:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10206681 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 7A0D5602D8 for ; Thu, 8 Feb 2018 08:33:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A870283FE for ; Thu, 8 Feb 2018 08:33:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EF572903A; Thu, 8 Feb 2018 08:33:11 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 A674928403 for ; Thu, 8 Feb 2018 08:33:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E129F6E194; Thu, 8 Feb 2018 08:33:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0084.outbound.protection.outlook.com [104.47.34.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id F00DD6E194; Thu, 8 Feb 2018 08:33:08 +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=Bs+tGV70iR5lFdycvoBbCi04FLHQLN6Unwq0bBHeilg=; b=eZahqlq0k+gDcVmNc5LtXZHk6PYpYNPjdfjXWMyn33jdQSfMaFVFTGtjTtHmABYFlEburIf7ZBP4I2ZALdZf3udfEfbnoZ4Q5F5VAv0fw4IaYdx3TOX5BQcZD5nXX038wYBZVXXgpdhGKOMHbPkjezoFdOleVeltQLqX90EjA4k= Received: from CY4PR1201CA0017.namprd12.prod.outlook.com (10.172.75.27) by MWHPR1201MB2479.namprd12.prod.outlook.com (10.172.95.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Thu, 8 Feb 2018 08:33:07 +0000 Received: from CO1NAM03FT045.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::202) by CY4PR1201CA0017.outlook.office365.com (2603:10b6:910:16::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.485.10 via Frontend Transport; Thu, 8 Feb 2018 08:33:07 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT045.mail.protection.outlook.com (10.152.81.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.485.12 via Frontend Transport; Thu, 8 Feb 2018 08:33:06 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.361.1; Thu, 8 Feb 2018 02:32:58 -0600 From: Chunming Zhou To: , Subject: [PATCH 2/3] drm/amdgpu: only enable swiotlb alloc when need v2 Date: Thu, 8 Feb 2018 16:32:37 +0800 Message-ID: <20180208083238.8291-2-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180208083238.8291-1-david1.zhou@amd.com> References: <20180208083238.8291-1-david1.zhou@amd.com> MIME-Version: 1.0 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)(39380400002)(39860400002)(346002)(376002)(2980300002)(428003)(199004)(189003)(316002)(16586007)(47776003)(5660300001)(1076002)(2906002)(97736004)(478600001)(81166006)(81156014)(72206003)(2950100002)(86362001)(6666003)(8676002)(53416004)(106466001)(76176011)(8936002)(36756003)(48376002)(50226002)(59450400001)(51416003)(7696005)(105586002)(186003)(50466002)(104016004)(336011)(77096007)(54906003)(68736007)(26005)(356003)(110136005)(53936002)(305945005)(4326008)(450100002)(358055004); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB2479; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT045; 1:WpOfYLxyGYWOeuAosnzfrnp2VwDFclguAFPCPraI9ztcAqEjveY/klNR/JtCxpuIngSuXM3ucXIGnpaxUqF1T9SWUGv2oXxiw9LvljiN1noWkfhPXZbMPvPyZ7eASKL4 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 333df85d-edff-440a-3995-08d56ece93f2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR1201MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2479; 3:DEY9XoC1iZnkL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r0uzphbN2HovXV/YRNsWPdfgY5WefB+Jq7bW0dkJ6trl9kH3Vv6YoyJIgiimBs9BMpR673RuhFUwNJHIt1s42rszYfxH/yQ5fsE1UfHJcQBJr4lalz8urnEwTYfTb3g/ibhlYQ8ywV2z3oduD1QvaP6UrOT3CMrU36wRRbqLtCmbLUkECBo1vP8OxHrIC0JKhTCjczi6eiIdCHm8BH8adUI4lDikHO6/ccnQY7nlM4G/0cbDXZUM263oPbzYYbujjpghRKDRrDsRo1G93Y+X8iCkHi6bmJ7EEZHbQMTtbB90ceT6xoD5miaxO9763A3q6j1+9TWddHNZuQ4ojONVKItDNSfaoYLNZFcKpoPn24eXL26rROHxv29yX2VQkfJ5EaSPd+EdCsQlApiuVoRnhAQ9chXpkPR5L9O+Lxbkvpk10pE+MVs/mM5yLrRKym5qAUrr9 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231101)(2400082)(944501161)(93006095)(93003095)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR1201MB2479; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2479; 4:blxi0b8RpAlwVjh0qGONtQEHINKc5KRAOT2fK0RkIz92uPPA2VoWbKbx3HRfO5xxsPbXAgNKs1PhHCLgqsr2gv973LPUWQLNcVMTHCI/xfsj/pbN3TN51QUrInHcSeOIp7u5dQw1l436H24MJaYjIv82LK/thnVwiZhxo8jFudjmdLhRlpx7IyNd2gAlgfziZ9IKPufwcSreYoRwPsQdy+MoGZIdWcyvElo1WPRfou23l6OhNSqj6+atuIcTJbxFvnI8am53BbOvL7AZ2MynwCMzOekYKmYZrjBdY87A7Mlq9VPYamZTH6J99uEDJ3ZR X-Forefront-PRVS: 0577AD41D6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR1201MB2479; 23:EqSRV2o9pTYrKk6K1X7UFnE0ppmnVc2vSMImTYD?= =?us-ascii?Q?wH7lwpo6TCeeS+gQeicakEvYH3pU0bNLTK9miRdYqAGEexU2DAupm5drDf4a?= =?us-ascii?Q?3Oz6Wq4GI9iNJVvqsdygeSsm2RvSniJDyLjZwv0aC99Cdod9B7VFYl18tvdz?= =?us-ascii?Q?CbP9s44WcJJDYsSNt1T3tq4Ayeh+QsizOgG7vthnAyCnrTQ+gUOb47pQL5jh?= =?us-ascii?Q?0nJLShVr92RlSUihzEnF35oVXHaqu3biiktkjq2dsuHQOFteD7V7S2B7X3+8?= =?us-ascii?Q?lLIW60enSkG9L84hujloMQXXNpmL3/a56xDJPf0g+ecqCyzu6B+u/Oytz3j1?= =?us-ascii?Q?bdYt6XAWvhn9teuplQlFVAvj2pb/BbgwqCfqHnvsctC2b8CjgO92LrtoCwit?= =?us-ascii?Q?84Hl1tOexo+wiNKbVX3QXZX5cADviZnYdE6GG8mzvvD2un03U1LybLF9AGBV?= =?us-ascii?Q?LtX1etBShxMaEgxnOxzUZ4Y3Zni+Khz804wJdOROy2B0Ro4kPjg/Gq5PJkNn?= =?us-ascii?Q?xfP5G9mic/BLFb3SMYHxq4S1D/mzJeh84ETrcffMwVUtv9BZsa7OfgS16SxX?= =?us-ascii?Q?b3D8SLWNdE0Z5vHNERpIkcGuUPvy9qzC/T+nx5CxuOasKtINpYhXcs7wHaVJ?= =?us-ascii?Q?FZsCf3mMPhIrQVA/eWKspG7BzkE27sKnm3HSg6ZQhV1tmEStEnIetxwvMrIJ?= =?us-ascii?Q?BphzGva7z6S5wrUqB+LFiGA9JghjsQFUu8cRxm8Pvs1fm1WuFZPBXQxbVIUB?= =?us-ascii?Q?HIzZc/dQ2cJoICc7TfRL14y7B7yTzNDkcL36Gyd7KXOqMd01plKLcRC36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xMZuGehp8JdUXRxr073M4ZZwBaTMLSou5BY32Naha/E9d4WmswRMsglG/wjKzE=; 7:dv4TpJBFdCokuseXyiwHcFovwIpQx0XOaTc5yCMaCtNLsp6lMO6r1Ec0czHP83dOfdGc2lkY7bjVByuLIbUblE9wLUf4O132V4at0x7clMwV+QUAB4Jm3p7z8WsYRP8CY8kMIhaV7hqTmkprzpUQ3Wamyr2BAPQiwuvAsNCH/FwuYWAjuufYJuLKLoEY04wR+irvY9QPzDjmGhowKlXRof+zHIacp7oG5uPi4KYi2P84+AH6zxVcxajB3vc28ilb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB2479; 20:oC34y378wt27qLeucrmJ4/nisM/by9ZlyThJR61VGwk2JaieNRK2Wr00BlqMdDrcXty9Cf+L+UvAc0aQPcfH8hzldPugl7cj1a+a0cPNeov3GrlWScIRN7K5Gzy8S6f96lTtWLA7ld4m+T/js+9VhZtnD+xc/+0T2VY5n47ncGmdbVcvKTNTzTbGs1wZ2qzYW8kzVxtxYQvD4lA/8FdawrnegGEkeI+ytCDUnO9xwE33rOL3rkKe7QTKOZsW9v6N X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2018 08:33:06.5205 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 333df85d-edff-440a-3995-08d56ece93f2 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2479 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: christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP get the max io mapping address of system memory to see if it is over our card accessing range. v2: move checking later Change-Id: Ibc38dbd34a20af5b4a4b1ed154c14e1c58aa4c55 Signed-off-by: Chunming Zhou Reviewed-by: Monk Liu --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 3 +++ drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 ++ 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 257424dd8a52..627a06185368 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1437,6 +1437,7 @@ struct amdgpu_device { const struct amdgpu_asic_funcs *asic_funcs; bool shutdown; bool need_dma32; + bool need_swiotlb; bool accel_working; struct work_struct reset_work; struct notifier_block acpi_nb; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 95f990140f2a..a021de9629ad 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1018,7 +1018,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm, } #ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (adev->need_swiotlb && swiotlb_nr_tbl()) { return ttm_dma_populate(>t->ttm, adev->dev, ctx); } #endif @@ -1045,7 +1045,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_tt *ttm) adev = amdgpu_ttm_adev(ttm->bdev); #ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (adev->need_swiotlb && swiotlb_nr_tbl()) { ttm_dma_unpopulate(>t->ttm, adev->dev); return; } @@ -2007,7 +2007,7 @@ 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 (!(adev->need_swiotlb && swiotlb_nr_tbl())) --count; #endif diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c index 5eacc0819b66..1945fe842188 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c @@ -22,6 +22,7 @@ */ #include #include +#include #include "amdgpu.h" #include "gmc_v6_0.h" #include "amdgpu_ucode.h" @@ -866,6 +867,7 @@ static int gmc_v6_0_sw_init(void *handle) pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32)); dev_warn(adev->dev, "amdgpu: No coherent DMA available.\n"); } + adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); r = gmc_v6_0_init_microcode(adev); if (r) { diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index ce7f484f86f9..761def04f93f 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c @@ -22,6 +22,7 @@ */ #include #include +#include #include "amdgpu.h" #include "cikd.h" #include "cik.h" @@ -1014,6 +1015,7 @@ static int gmc_v7_0_sw_init(void *handle) pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32)); pr_warn("amdgpu: No coherent DMA available\n"); } + adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); r = gmc_v7_0_init_microcode(adev); if (r) { diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index f53f3936fd4f..2489be7ad62b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -22,6 +22,7 @@ */ #include #include +#include #include "amdgpu.h" #include "gmc_v8_0.h" #include "amdgpu_ucode.h" @@ -1101,6 +1102,7 @@ static int gmc_v8_0_sw_init(void *handle) */ adev->need_dma32 = false; dma_bits = adev->need_dma32 ? 32 : 40; + adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); r = pci_set_dma_mask(adev->pdev, DMA_BIT_MASK(dma_bits)); if (r) { adev->need_dma32 = true; @@ -1112,6 +1114,7 @@ static int gmc_v8_0_sw_init(void *handle) pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32)); pr_warn("amdgpu: No coherent DMA available\n"); } + adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); r = gmc_v8_0_init_microcode(adev); if (r) { diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 2c60981d2eec..0f4a9a8575a4 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -21,6 +21,7 @@ * */ #include +#include #include "amdgpu.h" #include "gmc_v9_0.h" #include "amdgpu_atomfirmware.h" @@ -890,6 +891,7 @@ static int gmc_v9_0_sw_init(void *handle) pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32)); printk(KERN_WARNING "amdgpu: No coherent DMA available.\n"); } + adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); r = gmc_v9_0_mc_init(adev); if (r)