From patchwork Fri Feb 9 02:44:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10208213 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 B12EE60134 for ; Fri, 9 Feb 2018 02:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98BA0295B8 for ; Fri, 9 Feb 2018 02:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B03B295DF; Fri, 9 Feb 2018 02:44:54 +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=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 D843C295B8 for ; Fri, 9 Feb 2018 02:44:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E5556E709; Fri, 9 Feb 2018 02:44:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0058.outbound.protection.outlook.com [104.47.40.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC7B96E703; Fri, 9 Feb 2018 02:44:49 +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=M3QOeGmZ+6rF/K+Geas2WT0VRQJMHSma7Fm1dAkOVQI=; b=DGsVLRerl/vrZp2RhNn2joXlry32ZmHo5LNRiO1tVUltwgZh6JaxzdimXlNUq0s96tdDS2OtKMPfbwz/E65H1guBrPYbma1S1JEbpx3tu65t7UIDYfGO4DT2naqhyOVgTyUS/my5UBi5VryRr9B2a0h8kyNBkhBRoV3tKUBOg8U= Received: from DM3PR12CA0090.namprd12.prod.outlook.com (10.161.151.162) by BN6PR1201MB0211.namprd12.prod.outlook.com (10.174.115.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Fri, 9 Feb 2018 02:44:47 +0000 Received: from DM3NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::203) by DM3PR12CA0090.outlook.office365.com (2603:10b6:0:57::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.485.10 via Frontend Transport; Fri, 9 Feb 2018 02:44:47 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; daenzer.net; dkim=none (message not signed) header.d=none; daenzer.net; 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 DM3NAM03FT027.mail.protection.outlook.com (10.152.82.190) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.12 via Frontend Transport; Fri, 9 Feb 2018 02:44:46 +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 20:44:45 -0600 From: Chunming Zhou To: , Subject: [PATCH 2/3] drm/amdgpu: only enable swiotlb alloc when need v2 Date: Fri, 9 Feb 2018 10:44:09 +0800 Message-ID: <20180209024410.1469-2-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180209024410.1469-1-david1.zhou@amd.com> References: <20180209024410.1469-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)(346002)(39380400002)(376002)(39860400002)(2980300002)(428003)(189003)(199004)(104016004)(336011)(186003)(36756003)(2870700001)(53936002)(106466001)(8676002)(5820100001)(81156014)(53416004)(72206003)(81166006)(50466002)(1076002)(356003)(4326008)(478600001)(54906003)(305945005)(110136005)(47776003)(5660300001)(68736007)(50226002)(86362001)(97736004)(316002)(77096007)(7696005)(105586002)(26005)(23676004)(2950100002)(2906002)(8936002)(6666003)(59450400001)(76176011)(358055004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0211; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT027; 1:eW3J2c1kpaxF6SBodqxtsNDr7+I3+2jAFnretDg4AgAeOi5/iRa32PfqNeRS5RuXCtEnqEjtvfz2C+eKKeSvwN0K5e5lu4C1dRbrB5UOApfgp5NmC6kEAc7mhRQNmmaC X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07838a8b-6920-4c97-5e7d-08d56f671521 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BN6PR1201MB0211; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0211; 3:wngHUryMFRpVTbLoEPI3nZTz7qamjHWQZpO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+/nztqvBCt6vyNJhT3KXKoqMbMFRyuBDw/01BXIcZy2YzHPWv9szHCCVHBhk52KPLcLcHvxj3qQcWodhnOphfztzQVz/zomX6IZr7WgWgsN4iOsOKe/u4RyM6by9uWOa8IGDtP8axJf9uFOEheV6dwcBGwrm7s9A4ivNzsI0+op1MmvQDCJhDzTD2GIYtUMZlw4ii+LpMhoAQPgy9iiAyCKMOQpyyZmsHgQbj/rkZIn1xGfedGFtB/QVMvtr8g6oTKGa7GLniA4XNFqds9PnUvuXQUr2BK1S0puHonTCZEX30c+wOxQ5bZ+d2wCYSlwesPH3rLh37klpjP1xAoElYe1nxqJ5zPpuJX9AchovrQW6CyywtZCR2DOB3EjkedWQGCeXPnvhtL8rEloxAK64ALM9zak2Yk2Us5cF7zUkDDC X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93003095)(3002001)(3231101)(2400082)(944501161)(6055026)(6041288)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:BN6PR1201MB0211; BCL:0; PCL:0; RULEID:; SRVR:BN6PR1201MB0211; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0211; 4:VG8/dy2JlnA+3PQhZuIFmlMJgwKwXCIalZQMRs+zHlazq8yj2G35JhowJrqSesdxCDMDTQHf8uVdGW9rxjVUN5paFC/lv37I8L/zWmq1eGLAg/jdD+Iaht7gAzO7FzQMIWmeJ5Lm7Elez3kLyLQbRJEgTqnA0/bA5URl259DynbU3Ar94+2PfRHrO3l1DcoRvTE9CYZbN1FdFN2XITtL0XAHvugd5BnEl01y/QrvFy66cMnb0TwjUsxA9FU+mKnRoEm/Lm4qUO7mpMR2RnYpN8BpicxWDjOdBEhPgkjq8jXs1eDdvb3nn6npll3D7O87 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WfeJXQutR/n9FWqt73sOsx+mYy+AahiaE/QRgEcZ+hx+WuFThjhuL8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2018 02:44:46.7428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07838a8b-6920-4c97-5e7d-08d56f671521 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: BN6PR1201MB0211 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: michel@daenzer.net, 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 Reviewed-by: Christian König --- 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)