From patchwork Thu Feb 8 06:00:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10206623 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 E870060327 for ; Thu, 8 Feb 2018 06:01:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D89DA293A1 for ; Thu, 8 Feb 2018 06:01:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD25C293B6; Thu, 8 Feb 2018 06:01:38 +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 66AB7293A1 for ; Thu, 8 Feb 2018 06:01:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B0D46E231; Thu, 8 Feb 2018 06:01:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0060.outbound.protection.outlook.com [104.47.33.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 763176E231 for ; Thu, 8 Feb 2018 06:01:36 +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=WSaEejX8FaZtNDQzP/BtugppJm0qc/pE+7sVviqMrMI=; b=ysd4rEM9UsCnf/sK3bHSyxbwQUd8afvwviaHUnJWCerbdIL92vezWnad6izVbTWNSn+s0hLWn2oc4/RL6oVThJloiiCaz7JUfS0kjvmYKhorjIalEX3X9fea2SP44hgZFB0Pc8YMFZ11owQYxFSTfFK/C8B6Fb1qBAuvNAC/sRQ= Received: from DM3PR12CA0066.namprd12.prod.outlook.com (2603:10b6:0:56::34) by DM2PR12MB0363.namprd12.prod.outlook.com (2a01:111:e400:50d2::16) 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 06:01:34 +0000 Received: from DM3NAM03FT062.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::209) by DM3PR12CA0066.outlook.office365.com (2603:10b6:0:56::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; Thu, 8 Feb 2018 06:01:34 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT062.mail.protection.outlook.com (10.152.83.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.464.13 via Frontend Transport; Thu, 8 Feb 2018 06:01:34 +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 00:01:25 -0600 From: Chunming Zhou To: Subject: [PATCH 3/3] drm/radeon: only enable swiotlb path when need Date: Thu, 8 Feb 2018 14:00:17 +0800 Message-ID: <20180208060017.30780-3-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180208060017.30780-1-david1.zhou@amd.com> References: <20180208060017.30780-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)(39380400002)(39860400002)(396003)(2980300002)(428003)(189003)(199004)(50466002)(81166006)(50226002)(81156014)(6666003)(105586002)(2950100002)(6916009)(104016004)(305945005)(53936002)(356003)(186003)(36756003)(8936002)(5660300001)(7696005)(86362001)(51416003)(76176011)(2906002)(575784001)(68736007)(8676002)(77096007)(4326008)(6346003)(26005)(1076002)(336011)(478600001)(53416004)(72206003)(47776003)(16586007)(97736004)(54906003)(48376002)(316002)(2351001)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0363; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT062; 1:hnV9T3ESpiNZ9yHhaOMveNiLaXWHRt+u3xOtVOZNMgnop5UHLojDK2A/Mh4j/ScP310aDW2QhKl3FAUVN9t6rvK7Af0pwxXXaWkjk1MXNioTCmhcA47COJLDWlpH3QEh X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ad85424-c8ad-4f98-64e8-08d56eb9686c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:DM2PR12MB0363; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0363; 3:8q2fAdPcTn0j+gOzxH7ikFrUOztFuLdpSGn5iFxTWBnb/gq8tAz8NjEDuK6b2y9+6gZbRAPnI/r8ixkjbazmCIyKGukeY0bZoA206ikzcbAWBE/Ap0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IUz/AIQ5+ThEA7Bqx8suYo84wZRkWLcvzWMLheh3emlFhqa7VvTcwoFsiI626QdTs8G6qKRReulUISxEv3ZwLX171bBxrVGhFzq5OWcI2Y4RaK9jZ/55u+hlUNzDwk2n2owji5n/Mb+ACg/UB47tsYCR+OlST3seMlDIYUpm+Ysmsxxwb4iljoEXThUtC8B53cqarlbRrLyH1vh0m+WLJXkY2JBUFtAC8ZvXAEbjB+gYsiUlV46pVEBc9vKXIakflws92ITeXQZFVFVHJlVa+NuuEDRN0ctaxGw7o5OhECTwiB+OmpEwvvymPBvkY9k6lWSRGZQUivTqPu66uCQiai9j+ 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)(3231101)(2400082)(944501161)(10201501046)(3002001)(93006095)(93003095)(6055026)(6041288)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0363; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0363; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0363; 4:XmxuynH4H9BALGKeJO61jVfTptGhqWtoPvOslva0ADAb4uqyY6h6GrjVfBIDH+9ZEJyjPDldsagD7iRlv12g9g2fFp+LEmK9NPoin0GU4x5SJ9aLB3gP5R3qQypWGUwM3E4lWnG5kTgQ9/ZFnhZTrA3luuOmWb4yf1ty0eoRah4NX/Z/HvCFCB1Xben50slHU/NAUwzGCBWCLBBad3tbVM4weH6Vw3+8HeGh6d3gWcTKClbxokoZGpWfkS8IHnynEacbAmNuEnK4RQ/HPRuEmwkzb+ZpfPgXPudFVTPxjM6roQJ+hl1Up7MA2Di4FpoG X-Forefront-PRVS: 0577AD41D6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0363; 23:w9isEtLlXYu5BQ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E05DKrWGxJfxPJkrfgBldPr6qHrNfpNt6Wk6pNtGF/iVMkw5ALzIbZ5+ni03NqleFNp+3m2EuSrZBsx2Cikh2PNFfUKO/57mQqR58VuS0JzOeZ4YDrgF297mq9kYv0dpTW7EAattHPwjL5UA4y4+2Nx/tttLVvg05dV2MEGMYpIsjb6jO88axp8V3IKYNhNUqsu0TCz0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0363; 20:RjMO0JdtsnXphKtWasrAlSVEg9cvsO8jLV8xHssx6SkDtuDYfGavIhfL6Tm1zEmSfAGCQM0vkagGb65h35rV6I1+zrUEg5eyCJE9/FUJPxYg/pFoqo7+8zfgJP+711mtO4yk/9hRQPnk70MUo6N09FJ4YSj1IMSwzajZ00DFIPM51OicTfHVXncwbAqu1U6lCxbLfMmXpTjQhkZ5J22HHVitJQFshqLOqPRqzTWSixw7kjwgDIHkDZacWDfL4BKY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2018 06:01:34.0232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ad85424-c8ad-4f98-64e8-08d56eb9686c 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: DM2PR12MB0363 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. Change-Id: I1802645833155a9cd808913f863981173a82145f Signed-off-by: Chunming Zhou --- 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..62d8626e1fe8 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 @@ -1367,6 +1368,7 @@ int radeon_device_init(struct radeon_device *rdev, rdev->need_dma32 = true; dma_bits = rdev->need_dma32 ? 32 : 40; + rdev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits); r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits)); if (r) { rdev->need_dma32 = true; 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