From patchwork Thu Jul 26 11:52:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10545659 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 D15BA14E2 for ; Thu, 26 Jul 2018 11:53:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF40E28305 for ; Thu, 26 Jul 2018 11:53:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B34B92B0C1; Thu, 26 Jul 2018 11:53:19 +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 56D5728305 for ; Thu, 26 Jul 2018 11:53:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5BAE46E71C; Thu, 26 Jul 2018 11:53:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730060.outbound.protection.outlook.com [40.107.73.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 008156E71C; Thu, 26 Jul 2018 11:53:16 +0000 (UTC) Received: from MWHPR12CA0042.namprd12.prod.outlook.com (2603:10b6:301:2::28) by SN1PR12MB0829.namprd12.prod.outlook.com (2a01:111:e400:c45c::23) 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:15 +0000 Received: from DM3NAM03FT018.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by MWHPR12CA0042.outlook.office365.com (2603:10b6:301:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.16 via Frontend Transport; Thu, 26 Jul 2018 11:53:14 +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 DM3NAM03FT018.mail.protection.outlook.com (10.152.82.200) 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:14 +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:53:12 -0500 From: Huang Rui To: , Subject: [PATCH v2 3/4] drm/ttm: clean up non-x86 definitions on ttm_page_alloc Date: Thu, 26 Jul 2018 19:52:12 +0800 Message-ID: <1532605933-26209-4-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)(376002)(136003)(346002)(396003)(39860400002)(2980300002)(428003)(189003)(199004)(316002)(105586002)(68736007)(50226002)(110136005)(54906003)(4326008)(47776003)(106466001)(2870700001)(305945005)(478600001)(2906002)(53936002)(5820100001)(50466002)(72206003)(356003)(476003)(2616005)(336012)(486006)(53416004)(11346002)(446003)(126002)(426003)(26005)(77096007)(186003)(104016004)(14444005)(5660300001)(36756003)(97736004)(81166006)(81156014)(8936002)(7696005)(86362001)(23676004)(8676002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0829; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT018; 1:LO5cVgq8/K+ieL11QioLWM+KprZdewsiD63UWEcnLfuGsoSOkRRZYtCK8JN9LTk56Dbz4Xo98DUiIkJmFApKl8dCNPY4SJ11d2JHEUhTfJrmknzlu762iXf7U/+HnLwP X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 603a22f5-c071-4922-ba1f-08d5f2ee5e73 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060); SRVR:SN1PR12MB0829; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0829; 3:RtuWEX0X+ikLXUK2TqwRprLcfiGJhC+zlLuRsMgMhrhv1QHGQGRKs7AtWfLCOXZrQ4mOqKB/o+o9R197HiRA1qc/9H6tRd1IqIjcPK1rWi9qpkAJ6D9M2pHjraV/rJw0OSbRkqod4WAg5jgdPm366tydf0vW6f/lp4hMVwSlmeMUIgROdmk9EDqRJ4OyEA3fia7ZFUdAUw42vvYtS/l5UHfzqjqS1FEPoiM1DhL6187eNXuSjEJZxFhtQ6hsQTTyF65Vda2m79nrv635Vh1L8q1Pjbo1+xRpEVG9H4Xcw/yJyPiJFte4+fINi4zQAF7mc8cDy5cbYaai0Du+C7G1U3GpQs37kHVJh71WWcC8PkQ=; 25:urewg2N/GBA2Twv4ByC58fBB5hZHtWyDZ/9FYAQx9c/bcDS4uRihKmu/Djks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19w/4hZiV3Je9MC573gYm5ocyTlwU0YUzjbe1efDJiG 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)(5005006)(8121501046)(10201501046)(93006095)(93003095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:SN1PR12MB0829; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0829; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0829; 4:JWHUHOD5EeXmHaVqarCsvM70MM2Ii9UerDBB9w+G1HJM6Q/bMgKHH63xcM7xkaA8JesmgjrEG1ePco6AG5qdZNeEA1clT8ufZzsLUlrLbNokLzZzhJhPCK4Lzfzox718z5AjUNUU2f/UYcYaY/Dyxk5hNJPZVxDmKCZUhF0EHHYr2B5W2cjoc0wvz+o3C5legMYX6KuOn8v1eyuUZXNfe3ELGcpIcFAnNg2E1IxxSWuhl4WAAOsG14Fmq0NuK3dNlTQJi7P5J7kM33LJe0qyz6cbudxIEaSi1uov5eS5UXR2q3t0Zi0flrI3R0U8tYKm X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN1PR12MB0829=3B23=3AY1NECz/?= =?utf-8?q?K4aiCrZPetMuMUcD+cX/0fI9xbri990jHqvOBxUeZwHCIknOHTbd2CdVf1IkLzwWk?= =?utf-8?q?ODa8Ct8FDIQWoSrHucrdfq/smJZV6kOg3QteHya+biCAGSC6JU+BajZ+chf4kMgk8?= =?utf-8?q?GMD4dVMQC2zCQ1zk8tCrbyXLCZege1qr0YsYDJIv5E2apbEELwBjt4VKDT2/KhDzD?= =?utf-8?q?HfjGa2i2YQqaR/qaEziyfiS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cOo/gZvrrOZx1DdcJcPvKdtinvEj6hgZw=3D?= =?utf-8?q?=3D?= X-Microsoft-Antispam-Message-Info: hLFT3O6nihIqhp5+WJzoYlSz7OGMGsTID+gFn1c+hcNttMZL3wCkWCOuh3KNrphzHocc4b37a09NJoQRKyLo/1XqISOTgiDWyS19ccH9Do68/sj/CfZe+NKbxx8ojEuKAnn2o7alsMJwF75/1MyzXA3MZD5WtCobijE+8Z0NQavHAQv9OH1kmQmTcWYfMJPFQdeQGfbpD2s58c3WMZVnlbIB1BPvB/WLjMXwJPb9XJWSE1li6fViN+9/YFNSR9IPJWy0H08GwRMROEcYNAmsojw8n7udk4rI0EPw1kPmdeiW0cgsZxm/RrZi0R9KD/xZdnEr+rgWx37b2ONx2hANZ2Ir7OhdLYXcnqwCu5QTets= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0829; 6:6L0iYwqVjza6u4MuEPi8S6RYr1uWE0wOL3w8074Tt+W46zVRUQizGmjqaBqgwb74r+fpreT/S6u0eoqo0Pzok0PYoUzLB+EqbAlcP7gTShCPS1ijNzRRB+a6KyxWkgpjzZ40+MvdGxOFnus3bpfmZiyrK+k2IMGiEG27KF9P2SzCYTrFhs0jnbfz9UPvKsAqfAytwqdNPhXEmzRmpThsHEoUBB/bi/n6tMF4BXyCBgOpFHomLcThycUNrv5vpNRVR/54cux+xd4CCixMz3T+gqcziPU+LOLbvayVhtXo0r86nhxMs+yFVxa3AZl4jSgcQNPrGXYelYKa6/UqEZu8xzq8j+YzmgW0qkPPdALxFF8wK/lPhtYULUS8FJ/B8zrTlarKjUgVmoKKGVrzHSoBwNJ+zzdHvIH0PodrMoKKuruYd1w31tZThdRrkUNB0cR84wjdlKSsehJKbxQP8Ocmeg==; 5:v23qg5KzSmnx18i44vRK2lSwO49pBr8277SFJIhFHNIqDba3AOQ9NeD/l6u728UQMFnU9qUL22m91r51rjKK6M70c+Qyig0pD1X4tZ+PdtQTznkNuqmS2ybBYTmgXdwN5TASG1B8BebdoxbBFm5AgHANPe6/DPLqKYvs/Bjg2Ik=; 7:0I+8N2hx4BSmzvpqFczZvOuargUWTinCRTNQ2jL7Hugfumvk6u/1YX44+QCczlRRstl/ffS7sKQr/OGw3XEKlxtIBIga6FtJRFnXQi6JHCDUg39lWrMWqNtWOG9NOkyqdQA+7wqXbF9W3p0HWrIfuROSsuAFdoysxaJhiHUzHJcQsVn1eoZrau1dUI71dTvRK4//ICOW4ED2MJfQMHJVKEORMvxzan6MBJuTUSXTg7mcIOJv9sLC7agPhB6yWtUE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0829; 20:q8uxSLEiuIL7EbguyiXFMiN1Aox6V+IN3KtTRt0t56XT95mwLLKhk9x9ehIFC7NuQGc0wisUGgGRApBI36ZCIQNgl5HQTRsQQcA4IVDgWpRkZmis1px1g9M/7t+1O7iJYGIKciVjwik+lNLesyr0bMwdO4v3gyBvScVll4DIIS2rmGM7OuYmuc09yZDr+JS9rwAqUKsA1FothUG401sz8towRZUtmfMfizHsyBkFUgeaQbEBKsXmxUDxeRV6Y4nX X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 11:53:14.1698 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 603a22f5-c071-4922-ba1f-08d5f2ee5e73 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: SN1PR12MB0829 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.c. Suggested-by: Christian König Signed-off-by: Huang Rui --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 62 +++--------------------------------- 1 file changed, 5 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 6e2d130..f841acc 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -47,13 +47,7 @@ #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 16 @@ -222,52 +216,6 @@ static struct kobj_type ttm_pool_kobj_type = { static struct ttm_pool_manager *_manager; -#ifndef CONFIG_X86 -static int set_pages_wb(struct page *page, int numpages) -{ -#if IS_ENABLED(CONFIG_AGP) - int i; - - for (i = 0; i < numpages; i++) - unmap_page_from_agp(page++); -#endif - return 0; -} - -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 - /** * Select the right pool or requested caching state and ttm flags. */ static struct ttm_page_pool *ttm_get_pool(int flags, bool huge, @@ -302,13 +250,13 @@ static void ttm_pages_put(struct page *pages[], unsigned npages, unsigned int i, pages_nr = (1 << order); if (order == 0) { - if (set_pages_array_wb(pages, npages)) + if (ttm_set_pages_array_wb(pages, npages)) pr_err("Failed to set %d pages to wb!\n", npages); } for (i = 0; i < npages; ++i) { if (order > 0) { - if (set_pages_wb(pages[i], pages_nr)) + if (ttm_set_pages_wb(pages[i], pages_nr)) pr_err("Failed to set %d pages to wb!\n", pages_nr); } __free_pages(pages[i], order); @@ -498,12 +446,12 @@ static int ttm_set_pages_caching(struct page **pages, /* Set page caching */ switch (cstate) { case tt_uncached: - r = set_pages_array_uc(pages, cpages); + r = ttm_set_pages_array_uc(pages, cpages); if (r) pr_err("Failed to set %d pages to uc!\n", cpages); break; case tt_wc: - r = set_pages_array_wc(pages, cpages); + r = ttm_set_pages_array_wc(pages, cpages); if (r) pr_err("Failed to set %d pages to wc!\n", cpages); break;