From patchwork Thu Jul 26 11:52:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10545657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED2FB14E2 for ; Thu, 26 Jul 2018 11:53:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB7FA28305 for ; Thu, 26 Jul 2018 11:53:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF71828824; Thu, 26 Jul 2018 11:53:05 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 6D35628305 for ; Thu, 26 Jul 2018 11:53:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6578A6E70F; Thu, 26 Jul 2018 11:53:04 +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-bl2nam02on0057.outbound.protection.outlook.com [104.47.38.57]) by gabe.freedesktop.org (Postfix) with ESMTPS id 43DCE6E70F; Thu, 26 Jul 2018 11:53:03 +0000 (UTC) Received: from DM5PR12CA0055.namprd12.prod.outlook.com (2603:10b6:3:103::17) by MWHPR1201MB0239.namprd12.prod.outlook.com (2603:10b6:301:57::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Thu, 26 Jul 2018 11:53:00 +0000 Received: from DM3NAM03FT039.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by DM5PR12CA0055.outlook.office365.com (2603:10b6:3:103::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.17 via Frontend Transport; Thu, 26 Jul 2018 11:53:00 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT039.mail.protection.outlook.com (10.152.83.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.995.12 via Frontend Transport; Thu, 26 Jul 2018 11:53:00 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Thu, 26 Jul 2018 06:52:59 -0500 From: Huang Rui To: , Subject: [PATCH v2 2/4] drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma Date: Thu, 26 Jul 2018 19:52:11 +0800 Message-ID: <1532605933-26209-3-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532605933-26209-1-git-send-email-ray.huang@amd.com> References: <1532605933-26209-1-git-send-email-ray.huang@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)(136003)(39860400002)(376002)(346002)(396003)(2980300002)(428003)(199004)(189003)(426003)(336012)(81166006)(8676002)(81156014)(36756003)(2906002)(4326008)(68736007)(54906003)(8936002)(110136005)(86362001)(356003)(5820100001)(50466002)(316002)(47776003)(106466001)(305945005)(186003)(11346002)(486006)(476003)(446003)(126002)(77096007)(2870700001)(2616005)(50226002)(105586002)(76176011)(23676004)(478600001)(26005)(53416004)(7696005)(53936002)(5660300001)(72206003)(104016004)(6666003)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0239; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT039; 1:3N2yYez1LMvpvunqFupUzPELMsN6RP2N4nr5TXgPLxif/KBat+mibrTnSZfqEK5eHevL+V204Kvb+2IvOwq7wcT9lWJq5Ma6xfZHg5s6MHflB2YG2ruQpWQa2J2gnV0W X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0fa9485-7075-41eb-10d9-08d5f2ee564d X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060); SRVR:MWHPR1201MB0239; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0239; 3:IZbEGmHLExLuEvJG576Cjd1MngGjPwKhDs+Tl5nX0dt6MWcv4xYeNkA6QadvZSgil4j6e5NamYbmQRHgzOliLGo8GxFQtl7V8eaIEoq7Ya7SLaIsxkkfm0r+NYsGhM5E4eVUpOCy4+xs2pDNyjwUTHffVCC+mzWwHmqfmnuyHJb75804AXsI8vgIGOQrLRw2GD7PqWEZjJu/PFhSHxQJafNn2TRGWTZU+JzIH4yKW2mzaLYFxaYlNbpS8xuf3mLmg+DupLMmL6StxvqXJ1qW5+yWctIVnag9kMqh9uR7gpErAHSDGlwhhLNzZ9rOOz4A6GuDBhJBBEijol6q+sIZk+oFIOeuAp4S5Lw6d4bwG4c=; 25:OKJo3exZwXBLc44kX4RCNO0cNxNnlU4fl0Rzurx91GM67HZUhchr3ZC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NZhMsfL5Syt7uOZrsBfSEkDuzfo+SzKG3n5SMP4IVV6HIKqAluk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93003095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:MWHPR1201MB0239; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB0239; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0239; 4:ZyFBFOWsNSqRE8HLclRrqiKKKg1DWEcNycWMSFK0Oc4vbeoTLq9TLp6oRTSuGpWOZXMbaemkS6DltWzIL0thl+ECmz8jMeYIJEa6NYKRUFzgSBOvVdR6ghDzC0+UnSKpmW9JhDJey+e8olV0Jeh2dh1s7t2ox41tsbrepd8ca5gkcdkVAFPabX23mh8k/BRtH2nsfk/GETU+V87y+b5nQlbJfjjyI/S34hr7jLh1LRDOQvtXMPQT7OW/VOxwLwon3dVFOF1ywwVPdKr2vHYdcyOAJ91nEdcVaPJCD67qTugU/789tp1LdqRElxTMUkmE X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BMWHPR1201MB0239=3B23=3AtoCGH?= =?utf-8?q?Su9RH9VRPxJ+1mnG77Eit1gx1igYfq0DoVflOjWrTw87PyNbs+IY2QKFh2YlKw6jo?= =?utf-8?q?n7E3F+Acrgp2OexYtQSPNSFhMeFPn5a0Dd3BixMpxU6IzmX5RufdbAfYrP0xuZ+Yl?= =?utf-8?q?9bB+5q7CSc6AYXBRyTv6rZnJDci6+nDLonioqyVvcz334mwVF/tvRLU+2GylXyscM?= =?utf-8?q?j3HJJkQThgU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4CFGV5jW8cjf/o195wLEUWQbvLRhrgP9J25wgeEkl11ZUWK5Xm5LyT5G+wOl4WfrwsQ9Ho=; 7:OtaYvfpYdrcYynfpjERU+B65L0y8jyUsJhg0tY+gHaRk6bGbO04yVcSpe3eViiHDDtWIeuZBbK+jwct3BojmDynTOOWw3m6rxc0ctOOcgRfvZ7ZLTXwaXqcyVkMbsZQA+V7bH/XHzG4hVvqm8NSjCn9sB0AX/Ss+7IGb2PrwoO/5iCm2/yDRYhzDFTc0jFautd2zm18SKLN5dk/aoSC14DjCSaZtrhP0LLUYw25P2VeybP0ZHHWlz12j7epLcLuc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0239; 20:/ZBnAS4K5CsKd8bEyCkgi4N0dsq0N0dhJe+cGumrD56PvG4MqzU/6Ru2dIkjcKYCa/eXOyKik6ohmAg3kkd+j64idMRhTWyuii3+MfJ+lBEOFpKtK8jwuW8W7NnURRpbdUjazaMNIFOVXxCCWnVXyLD5sv4ai/f63jQQccBtvandXeGAhHJbNeQOWLopgYQUfdX3HX7e2zxGcMHUV9kff707POWccOAQfwJ7r4pv6aa/cD69wKZCiSxmzNKXcibe X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 11:53:00.4947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0fa9485-7075-41eb-10d9-08d5f2ee564d 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0239 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: Bas Nieuwenhuizen , Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP All non-x86 definitions are moved to ttm_set_memory header, so remove it from ttm_page_alloc_dma.c. Suggested-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 48 +++----------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 3f14c1c..f31148a 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -50,12 +50,7 @@ #include #include #include -#if IS_ENABLED(CONFIG_AGP) -#include -#endif -#ifdef CONFIG_X86 -#include -#endif +#include #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *)) #define SMALL_ALLOCATION 4 @@ -268,41 +263,6 @@ static struct kobj_type ttm_pool_kobj_type = { .default_attrs = ttm_pool_attrs, }; -#ifndef CONFIG_X86 -static int set_pages_array_wb(struct page **pages, int addrinarray) -{ -#if IS_ENABLED(CONFIG_AGP) - int i; - - for (i = 0; i < addrinarray; i++) - unmap_page_from_agp(pages[i]); -#endif - return 0; -} - -static int set_pages_array_wc(struct page **pages, int addrinarray) -{ -#if IS_ENABLED(CONFIG_AGP) - int i; - - for (i = 0; i < addrinarray; i++) - map_page_into_agp(pages[i]); -#endif - return 0; -} - -static int set_pages_array_uc(struct page **pages, int addrinarray) -{ -#if IS_ENABLED(CONFIG_AGP) - int i; - - for (i = 0; i < addrinarray; i++) - map_page_into_agp(pages[i]); -#endif - return 0; -} -#endif /* for !CONFIG_X86 */ - static int ttm_set_pages_caching(struct dma_pool *pool, struct page **pages, unsigned cpages) { @@ -315,7 +275,7 @@ static int ttm_set_pages_caching(struct dma_pool *pool, pool->dev_name, cpages); } if (pool->type & IS_WC) { - r = set_pages_array_wc(pages, cpages); + r = ttm_set_pages_array_wc(pages, cpages); if (r) pr_err("%s: Failed to set %d pages to wc!\n", pool->dev_name, cpages); @@ -395,7 +355,7 @@ static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page) if (!(pool->type & IS_CACHED)) { num_pages = pool->size / PAGE_SIZE; for (i = 0; i < num_pages; ++i, ++page) { - if (set_pages_array_wb(&page, 1)) { + if (ttm_set_pages_array_wb(&page, 1)) { pr_err("%s: Failed to set %d pages to wb!\n", pool->dev_name, 1); } @@ -420,7 +380,7 @@ static void ttm_dma_pages_put(struct dma_pool *pool, struct list_head *d_pages, /* Don't set WB on WB page pool. */ if (npages && !(pool->type & IS_CACHED) && - set_pages_array_wb(pages, npages)) + ttm_set_pages_array_wb(pages, npages)) pr_err("%s: Failed to set %d pages to wb!\n", pool->dev_name, npages);