From patchwork Fri Feb 9 02:44:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10208215 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 A1DB560134 for ; Fri, 9 Feb 2018 02:45:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89124295B8 for ; Fri, 9 Feb 2018 02:45:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CC55295DF; Fri, 9 Feb 2018 02:45:26 +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 CA597295B8 for ; Fri, 9 Feb 2018 02:45:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8E886E703; Fri, 9 Feb 2018 02:45:24 +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-sn1nam01on0068.outbound.protection.outlook.com [104.47.32.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id C10D36E6FF; Fri, 9 Feb 2018 02:45:22 +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=Om+gBFDJiygguSsVgQxFi3yFGQcKpjEP15zVnfSUY8Y=; b=hx+Ynm5nW3xQnZ29Yn/hX5KX+Q5rICcQzjkvP5QF2RDbZBczg/0QCWtLXFtFOf6BfPz6Ynp/JK2ovptvxppYfIjq/KnpyeuHYJXle7Ry8QhlSl+l3smnFbzQU7qBiUXE1xq53sc/LXOMlTTr9b2MgAKsxFZD72F5piAVSIzJIZw= Received: from DM3PR12CA0072.namprd12.prod.outlook.com (10.161.151.144) by CY1PR1201MB0921.namprd12.prod.outlook.com (10.169.18.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Fri, 9 Feb 2018 02:45:20 +0000 Received: from DM3NAM03FT027.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by DM3PR12CA0072.outlook.office365.com (2603:10b6:0:57::16) 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:45:20 +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:45:19 +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:45:14 -0600 From: Chunming Zhou To: , Subject: [PATCH 3/3] drm/radeon: only enable swiotlb path when need v2 Date: Fri, 9 Feb 2018 10:44:10 +0800 Message-ID: <20180209024410.1469-3-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)(376002)(346002)(39860400002)(39380400002)(396003)(2980300002)(428003)(189003)(199004)(53416004)(86362001)(72206003)(8676002)(50466002)(104016004)(5820100001)(5660300001)(2950100002)(77096007)(305945005)(53936002)(26005)(336011)(6666003)(106466001)(186003)(23676004)(36756003)(2870700001)(8936002)(110136005)(50226002)(1076002)(81166006)(81156014)(47776003)(478600001)(4326008)(105586002)(68736007)(76176011)(97736004)(575784001)(54906003)(316002)(2906002)(7696005)(356003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR1201MB0921; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT027; 1:Vs6CkXKQPUgIM3hmtb/miOlKAZ3lTEmyDgn5iVHb4P7g3e+crpZ/HJlH/cToFj8hiYZI0uLhxCcGHBn/KAwNdD5vDosvTBCdu9rJ13mKuFX8zuytxXrMXXKXh7vuJ2FN X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a8a60f9-b5bb-449d-02c0-08d56f6728e0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:CY1PR1201MB0921; X-Microsoft-Exchange-Diagnostics: 1; CY1PR1201MB0921; 3:l2uHL6HRwGBUc1yICuTM6jztx1cSZ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kxWULnqCKNJUYDsmiPYigeF+YHvNpicg+E87DWBgkFHfwurBvBoI3W4UWxO2r2/gdEnbAoG7H3i+DXuVXDUb2L1MSbXF+1NVQWREAInWPa5grcfv06CNVQIVJgzUobCWwMwzeu6Wpkcv2lTXvblY3nZX6kd+8HP6pJYmQYbboM5VnzcSuLnZRhI131bI7Ur4OnT1D8PbBGK+JZdth/V3ck2KLLqPTTHV+11alCXUxUIw/z3ixAbdupvIwbgXjSb2tYeVMyoc1/RKjgSLCdrq0MKI0VyDdBN1AoTAAm8uVSvqpHE2dKsX7BxipfmzZX5+z4Db0wa9PQ74mG8kBZbR89H4ULfmo93HuqOYRWhih8OFfVk7L/tr9eycJXXMOlXG/HPB0DuRo1dqy4WUdVHKWsqkUZ4A84XRK0k 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)(93006095)(93003095)(10201501046)(3231101)(2400082)(944501161)(3002001)(6055026)(6041288)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:CY1PR1201MB0921; BCL:0; PCL:0; RULEID:; SRVR:CY1PR1201MB0921; X-Microsoft-Exchange-Diagnostics: 1; CY1PR1201MB0921; 4:CDfz2KJ+qoU7H6stLgRYUsH5jmD4xsk3mCTMFq9tgmbW/OSnMS/ySYfKtvKpdJ8WWrab+rQrJMOBS9/dNIuo7GcygLStUqXSyw+4VFdo6cXCH1bky4Da490EpvHhGaOXhCxmaYt2iGWKL1Qqp+KhbOSxT4BdAPoVBoiRozLSFY2egvdLA05GxnMZwFbT43oRVOkkS0f0PXh9mWVHSVQdaVwunfNKoBe73F3blFybQfg3dnKm5FBwu+aLjVr/WLi4FZKdF1lt/0brWeRA/wsmwEfpadObvYDe3mNp2baphr2Vcp0CGXESIt8xQFhQN5WE X-Foref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EyFAO/pNAFampr4WFsMkHGqE5GNUPum5YibGd5p2pF+PtclVL78nBF3vvJBpU75EePWIG5nn2hU06y+7Q0Zc3ItWLdgpMt/wNvngfaTxx7TCsXsEruT+Y9if2n2yKf3DkhM2G8AqTE4BhRJtJhto=; 5:m3hPl7bO4joxYyAO/gNfaYQWIHdVnlNlTWI2sDR07lngMaRblgDli7C2yBXqVkIyq/pl3Mvhn4kiw1kZeK/vHmwREnN16zIif7o9gnzVt0JafjgefJI3I8uImDaWLsN43gBnNBM3zhpW0G9h2Z/BMyLbGymXKL8F7IO6Rzgm2yU=; 24:ic0yVmL2YSrA0Pc4xtRlQIHZW2Gq4Jvsk8aKhWsSdNRO/iJlIpb5r4Xj/cqj+F27zwtWhIsMhFPJsu5oOPBrDEqDM4s9OROPFCPXHDBfTsI=; 7:XCmA0oqCCyrynQjC99So5f5mf7V/zJP2I0OvsItaKtJfv3Evc6wiETs44HyMt0bqp52TeUQ82GEHCI5yisfl2Ap0pGXNeV+c1gfqfy48z50uXFsPJ7tWcgp4WH3Lnw1M941cxN9Gf0kMl5kpHf/8o0JkPUDN7wrJ2AUXbEpttmPGMlJ3jlYZc34Mk2iUatU57lfuHsQFlZyFVjRhtObRhg6VolMMq9QO426ujj1VuJrgN6HGXruY9BGykWerowsE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR1201MB0921; 20:a0g1F4HsjKDgK6oqEw+isd2Q6tNUt68F7lnTpENsHqvfl9FQzoJXSBpTeeeY3navyqp/tEIdAIE2drNUTu6+qdwEg04Sf/dKFGT0EB2nttPj1btFvFjbnBMaekzxzBcvrOgxNUiImzOBEHD2VnQvlHvu+ttEha4q03g4E6hpFg8d20RP1C0Q8TSn9ssPWzfMoKh4N/vPHsTGkfmQ07AOgEYZJawuS+fqZWwwTerQIG5EHbqIhxT8uTWKIUEsf31l X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2018 02:45:19.8689 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a8a60f9-b5bb-449d-02c0-08d56f6728e0 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: CY1PR1201MB0921 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 swiotlb expands our card accessing range, but its path always is slower than ttm pool allocation. So add condition to use it. v2: move a bit later Change-Id: I1802645833155a9cd808913f863981173a82145f Signed-off-by: Chunming Zhou Reviewed-by: Monk Liu Reviewed-by: Christian König --- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_device.c | 2 ++ drivers/gpu/drm/radeon/radeon_ttm.c | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index d34887873dea..4a2eb409aacc 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -2387,6 +2387,7 @@ struct radeon_device { struct radeon_dummy_page dummy_page; bool shutdown; bool need_dma32; + bool need_swiotlb; bool accel_working; bool fastfb_working; /* IGP feature*/ bool needs_reset, in_reset; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 8d3e3d2e0090..7f40c6f7c4dd 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1378,6 +1379,7 @@ int radeon_device_init(struct radeon_device *rdev, pci_set_consistent_dma_mask(rdev->pdev, DMA_BIT_MASK(32)); pr_warn("radeon: No coherent DMA available\n"); } + rdev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); /* Registers mapping */ /* TODO: block userspace mapping of io register */ diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index a0a839bc39bf..c1e3862a48a4 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -756,7 +756,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm, #endif #ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (rdev->need_swiotlb && swiotlb_nr_tbl()) { return ttm_dma_populate(>t->ttm, rdev->dev, ctx); } #endif @@ -788,7 +788,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_tt *ttm) #endif #ifdef CONFIG_SWIOTLB - if (swiotlb_nr_tbl()) { + if (rdev->need_swiotlb && swiotlb_nr_tbl()) { ttm_dma_unpopulate(>t->ttm, rdev->dev); return; } @@ -1155,7 +1155,7 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev) count = ARRAY_SIZE(radeon_ttm_debugfs_list); #ifdef CONFIG_SWIOTLB - if (!swiotlb_nr_tbl()) + if (!(rdev->need_swiotlb && swiotlb_nr_tbl())) --count; #endif