From patchwork Thu Feb 8 08:32:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10206683 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 9E329602D8 for ; Thu, 8 Feb 2018 08:33:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FAC82907F for ; Thu, 8 Feb 2018 08:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82D862910A; Thu, 8 Feb 2018 08:33:32 +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 0D1642907F for ; Thu, 8 Feb 2018 08:33:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F35F56E13E; Thu, 8 Feb 2018 08:33:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0059.outbound.protection.outlook.com [104.47.38.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE0006E04B; Thu, 8 Feb 2018 08:33:29 +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=j8vgK1pD+OZEvLI8IvlqtoFipimazOfSMg3wnGt6pl8=; b=0lyz2Wdow55sioUh1EqhfGW86pu1X8N+czM2dVBeEAA/uXxgJ+f7+5SK4E6Gn/ysVDNSBEuaxy0TxcfN3mD084RdWn8MIZHhSXCVHNcQqqSz/jM+oBhkQX9lkTysMM6A5DGHP0t9ErdXOauXogs3xcwdeT9YmKeZ3Gi20kiu+uI= Received: from CY4PR12CA0032.namprd12.prod.outlook.com (2603:10b6:903:129::18) by CY4PR1201MB2468.namprd12.prod.outlook.com (2603:10b6:903:d0::7) 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:26 +0000 Received: from CO1NAM03FT022.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by CY4PR12CA0032.outlook.office365.com (2603:10b6:903:129::18) 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:26 +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 CO1NAM03FT022.mail.protection.outlook.com (10.152.80.182) 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:26 +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:33:17 -0600 From: Chunming Zhou To: , Subject: [PATCH 3/3] drm/radeon: only enable swiotlb path when need v2 Date: Thu, 8 Feb 2018 16:32:38 +0800 Message-ID: <20180208083238.8291-3-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)(39860400002)(396003)(346002)(376002)(39380400002)(2980300002)(428003)(199004)(189003)(97736004)(86362001)(356003)(575784001)(2950100002)(110136005)(51416003)(2906002)(7696005)(316002)(36756003)(105586002)(50226002)(1076002)(53416004)(106466001)(68736007)(76176011)(8936002)(81166006)(186003)(26005)(336011)(48376002)(450100002)(5660300001)(50466002)(77096007)(478600001)(47776003)(4326008)(81156014)(6666003)(8676002)(305945005)(53936002)(54906003)(16586007)(104016004)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB2468; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT022; 1:PtpJKohmmtsF+Pwt17XaM5+BAHQo1qFDbbIldt5unX07K+LuRt+2iyNDEP7Egdik2DVZg0AnXpPMQhR1ydCHu6Xa79GGR76YXRFk9Nj/FGv6rJ7xqd/0fwUP4vQWpeG4 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14450f16-4b0d-4206-e6b2-08d56ece9f99 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:CY4PR1201MB2468; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2468; 3: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BmH6Ik74temQqpugIsZ93lYQZAe5iO3aVItqjvvf7T+NGKOEq8q9CvhDiiDtpLj5KD1/PVNXYkGmLrS3b8U4qOIRJm5j3UOcwOZdCkmOClFNb2nFF7Nk6z9N4m5cs6DskrUd92l7Rwltm5sRges4rk2kU9kN5lNHOR4PlLqvZ78N+xcfpoBFwrxN4MqLGGG5o3K8iHmmiXcdQ7qrIfBEeJt2WeuuE0CkU7Y4i1KeeewV0bLAFlrv6UImF5EbRH/1xEktjBzIV5pE6ipxDnEnkyTl07zbjcdlireqWag7k8RdpWW6YJZ8yu6ifoHhe9IHveQz9leniSl0qq+y8UY6ksgQWFX8dXcr2RS5AqgZ3SmOqBFCvGTCgtT4Ues/iD5IryzxR3av39ZnBTa9e1xjG8agVKPEClD49fa7ZZMV1C4ohTNZw6vo4bHrEW5hBAz1mYmUoEKc 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)(3231101)(2400082)(944501161)(10201501046)(93006095)(93003095)(3002001)(6055026)(6041288)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:CY4PR1201MB2468; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1201MB2468; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2468; 4:mIT0n9fcuwjKPRPrpvrxzdZvltlzMSXwruW8AlvkBETQEQ0X46fQ8659x2k4LwrZvpYMWWOZVG6rPkLBKbbElqsZ+IRjMkFtjrmGbv2HFmKxCwC749pZZWpWfCjAMQXQowDhB1OPP/bbQOGYd4VLtnGoBNGEChUHWxb5jdLUnpvekZsaFn9NxeWAP7ZP6kyW3LMzmKQHL4TixUO2kvnmpeDcZj6WjrFIM5WrcMV5qqaXkp5N8OqjQZn82kJxQf7A9z6HKULoNSMHM4vIFG3kMlJ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ldejZtf2TWIi8pzIyKc1v7xIbaiMNgLyqlUyBIUT9RLxi/Fn73EHT3TByZSsJeQPlBbNh+6w=; 7:2d0lI+K+X3WEf93pqesuWBirF2thuz5qZVqFI1rXBM8mI9ylkN0vttMwqItEIx3xCNm6i52jDr+nocuEVUpdDniyAGPsp2UkknGUb67BFKz8XxCiqcJlPHLCVHgqphRXGJL3iwsz0PX4PokcC684NLM3Ao20j3Fy4XWXwMczpcewqBKaEb60E0EJUYV1S4tJnxuWjjbUFck2L3NSl2DNZwf+3B5yX0UBL1UIJJ61R8AXKs9mazkLwyl2tXOYYcrk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB2468; 20:2xapjayTCqIukW3Rl8+5NmoPNPTwblYtLlbvji49hS+rYWg8m7aS8E5/BWYQvRfoawMsYiYBT5WqoGryKNV8SKWgp7dbfBNTVPVy6VU41/EMCnoulIBTdREMotLemh6kKRiBvHKY/2N9ZZpzyPceWWcKVqn2JRPkaaUadeQSYli/HAHY8i8iEf3U61o64jU2iinypfcyi7T/xfEPlHM6ZoX5rtT5MQi98QIKEt3q36dyW5U2Fg/jKNiSQ8BMkWQE X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2018 08:33:26.0743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14450f16-4b0d-4206-e6b2-08d56ece9f99 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: CY4PR1201MB2468 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 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 --- 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