From patchwork Thu Jul 26 11:52:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10545655 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 00CAF14E0 for ; Thu, 26 Jul 2018 11:52:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E392425E97 for ; Thu, 26 Jul 2018 11:52:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D769A28517; Thu, 26 Jul 2018 11:52:46 +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 68DB228305 for ; Thu, 26 Jul 2018 11:52:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C73BD6E719; Thu, 26 Jul 2018 11:52:44 +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-bn3nam01on060b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe41::60b]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3FF76E718; Thu, 26 Jul 2018 11:52:42 +0000 (UTC) Received: from BN4PR12CA0017.namprd12.prod.outlook.com (2603:10b6:403:2::27) by SN1PR12MB2400.namprd12.prod.outlook.com (2603:10b6:802:26::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Thu, 26 Jul 2018 11:52:40 +0000 Received: from DM3NAM03FT010.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by BN4PR12CA0017.outlook.office365.com (2603:10b6:403:2::27) 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:52:40 +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 DM3NAM03FT010.mail.protection.outlook.com (10.152.82.65) 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:52:39 +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:38 -0500 From: Huang Rui To: , Subject: [PATCH v2 1/4] drm/ttm: add ttm_set_memory header (v2) Date: Thu, 26 Jul 2018 19:52:10 +0800 Message-ID: <1532605933-26209-2-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)(346002)(39860400002)(136003)(396003)(2980300002)(428003)(189003)(199004)(356003)(81156014)(426003)(104016004)(446003)(97736004)(316002)(14444005)(53416004)(486006)(5820100001)(11346002)(47776003)(106466001)(105586002)(2906002)(2616005)(126002)(8676002)(476003)(110136005)(54906003)(81166006)(68736007)(50226002)(53936002)(50466002)(5660300001)(23676004)(7696005)(336012)(72206003)(76176011)(77096007)(36756003)(478600001)(4326008)(186003)(86362001)(6666003)(305945005)(26005)(2870700001)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2400; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT010; 1:T9CBL2bMlIlMjcTtuiPzW5AvygWrpqmpZTfkic8VZQw+Wlavj3ISzWHRUImWyvwvMyQWJtx3BKcdJTR+ZTLnhAGTgk7KkPAvtb50YDFzVaU1RiUSUwMuVZVFyNniC1o3 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ec0af33-ad55-49da-7358-08d5f2ee49fa X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060); SRVR:SN1PR12MB2400; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2400; 3:8gaoDaA4rSaQtruhtijPA1C93/oT0D0oZ2F4dPiGcJmAzL7/XoVt5ugrj2e4p97JnLifthmQfvWVdOFylrPJ6scNka9zHpBoePKai0f5TEHX+en7eZ9pcjNf2WaLS78SvNWC98PFsHAKxAI1YSaNola6TKYOp1U/etnx+6qBLzncnGahHYDhqndbuL2sr8wKlWWCVzJEURCNeXC573FKmYsVkiDLrQsI6IasHITSXAujp5cSXGzF5KxIBGweByV0iRHS9xrz4t9LoAYw8YNlJ09B0jqq9GC1skvj0Sxs8ZEK5CDX4J2bCuUSMqLRqN8oJQ/dfoRfAoxuBl98L7VagnB1ghAvBRTmPSBLxlWwtlU=; 25:bGFKUgGIPuwG+3ND2drnsIXMO3pRl+GkXgQB5jN6j3dqQazee5TalaRRet8W35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7wowIPSxWwzNdtoJGtIb7MeiwJn31G 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:SN1PR12MB2400; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2400; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2400; 4:PonWYOwWA2Xakuh3Zc5lTHYeczDi0OcONI0cmZc0TV0yBCmy7ZA/cmgkilG06G2nCG+oZuLWbpU8q7Lgk17MXuFBmaleDZ06ZVTXerdxqnXLqgjmDK7sO8/Yxw/S7NXnkA4e4OqdbLsKz9Yf5UszVFpXtZB8bbMVxND/S3molrZCalq93aEt88uzJ40RhU6Iw8sspl0RFO91H0Hy9CpRPdux1eMqQVVRu9mIz093QDNDoVzkqKUnH2GTYNCXE4G63ocCOEzu8l76NdwUgansaWBm6P16Y9iH7ttswEf+8wFnFChLNvZy3JB0F+DnEh8O X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN1PR12MB2400=3B23=3AgEV5QUb?= =?utf-8?q?Y7hAyzI9USo9OR42syRTi1uPME7+kMa5UxdAZbfdcOXkfIhr0PAs+urShAit6Ua1o?= =?utf-8?q?9rSSkGufiKX2KADE21CXfHZPWGLCQgMtd4eEqIdIvl7Lg47w2MI9G/vi74PkYVzgu?= =?utf-8?q?sivkD0P6KQiywqLP1dVRPmH6GHplwilUt+8EtxX1QzrAP9TP7o0qNgCp17RB27Xkq?= =?utf-8?q?NIeiFHMtbJ0ycBrcXq0JUkKvDFWdnH/vQFc6rQ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5WC/RFyFFVNtx8Oy+GrMFSio9UfMKK+PlXABEAfQjrzrSP0FA8fZun676aMWeRK9qJmp87rQ=; 7:3Bp6FKSkKlR5Xwsy6pFAxsVKtJVLjlviCfCX7xIXtCGLnG2jIs/a9+hehsWZSLYyDRnf/FK9tsQ+MBIlk8aXQSdw3w2M+VaTgCT5j/eC8IXlZ9a7mznKPFx0tjraBBut3twlaEznmgEG3M9d0iJ8Vw52f3yQbtcfRyduolwpZsW8xV8CQwynEyP+7MUQzb4Y9KF+ISFyPbY6poUcj3NqQ+d7MXCXCl06Mn2HUYxZ+y2JjRRjab8ZwFnPhLsRJXgl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2400; 20:UTSj9J0nPrDQGsUMqPtQOg2gEzn3sX8U7w1c+UzCImTI/lhUnUxme2r2NuF/TWURQCAHUvMiqcXfA9xGjSPCqtz7u2A1BhUadQTfacmqlR0/NmOoYAkhryCv9jx2WS5dOYZFB5az3v4IgtinWACw14+dZLI2V35XAF4kIwZSHUhgeFJm/zCxQHv+pQFZfMT74iMA5VzIWOe92Na8GxP1MZOM90twYw37eJbkCzutjfYnqq+oM4nCbsQjCz1+Yb3j X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 11:52:39.7737 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ec0af33-ad55-49da-7358-08d5f2ee49fa 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: SN1PR12MB2400 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 This patch moves all non-x86 abstraction to the ttm_set_memory header. It is to make function calling more clearly. (v2): add ttm_ prefix. Suggested-by: Christian König Signed-off-by: Huang Rui --- include/drm/ttm/ttm_set_memory.h | 128 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 include/drm/ttm/ttm_set_memory.h diff --git a/include/drm/ttm/ttm_set_memory.h b/include/drm/ttm/ttm_set_memory.h new file mode 100644 index 0000000..a70723c --- /dev/null +++ b/include/drm/ttm/ttm_set_memory.h @@ -0,0 +1,128 @@ +/************************************************************************** + * + * Copyright (c) 2018 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ +/* + * Authors: Huang Rui + */ + +#ifndef TTM_SET_MEMORY +#define TTM_SET_MEMORY + +#include + +#ifdef CONFIG_X86 + +#include + +static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray) +{ + return set_pages_array_wb(pages, addrinarray); +} + +static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray) +{ + return set_pages_array_wc(pages, addrinarray); +} + +static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray) +{ + return set_pages_array_uc(pages, addrinarray); +} + +static inline int ttm_set_pages_wb(struct page *page, int numpages) +{ + return set_pages_wb(page, numpages); +} + +#else /* for CONFIG_X86 */ + +#if IS_ENABLED(CONFIG_AGP) + +#include + +static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray) +{ + int i; + + for (i = 0; i < addrinarray; i++) + unmap_page_from_agp(pages[i]); + return 0; +} + +static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray) +{ + int i; + + for (i = 0; i < addrinarray; i++) + map_page_into_agp(pages[i]); + return 0; +} + +static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray) +{ + int i; + + for (i = 0; i < addrinarray; i++) + map_page_into_agp(pages[i]); + return 0; +} + +static inline int ttm_set_pages_wb(struct page *page, int numpages) +{ + int i; + + for (i = 0; i < numpages; i++) + unmap_page_from_agp(page++); + return 0; +} + +#else /* for CONFIG_AGP */ + +static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray) +{ + return 0; +} + +static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray) +{ + return 0; +} + +static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray) +{ + return 0; +} + +static inline int ttm_set_pages_wb(struct page *page, int numpages) +{ + return 0; +} + +#endif /* for CONFIG_AGP */ + +#endif /* for CONFIG_X86 */ + +#endif 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:OKJo3exZwXBLc44kX4RCNO0cNxNnlU4fl0Rzurx91GM67HZUhchr3ZCKFnG5xTDAk1dgH5XPUTFzX/R4F3qdIu/7l4fh+Qm7hdXHgTWsoWwkAedvTPIkiFRtehzix6A1mFyYWkdFvZpbuu/l2Dsa/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451399110); 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?j3HJJkQThgUBHq1LYlEXnmpwYxkXM3INYJ7R1PxWDzUnQTuQzLcUSFohXBAOvrQHR?= =?utf-8?q?yNt9I5YuAyh77nDJuyIiJzYTORXB3AE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+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); 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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B6ToQ1YeeUN8Va77VyRrruV4sZkHeYNoCGWOGc3sPY43JdiTx2NsAJEgACiI++P5qF901YxIeJe/eVVwBiqWD3J9vX/GqesSqtNvv5hQTuHEbshO8hQzcaIf/79CnaSXX0ZKC/s6glA5f8XP6LHQEJTd950Ve3bIk2sE05jaIOy+QQ/BnCGrcS4Xhq0woGiph40vH1oNVVVU7bw18qD4hArGIE/P2Wqs1yERvxfXlZqrir+KCEJV/SX6LmlIkaPwMwIeiYoNljPELV9pveauoCgz45wb8vAXJQq2l68OjKvMPNeGExuIFIn9XXJCFxZZoJtpU2/6ZbM3JZ2Zna7BOLRLwSYsX6FEEmCPOQk9Rouca0FQnyhEvKgIKFjZ076PWjtrr1Wx36/LNOHbXWf/VsCmh7EwEuQo8LlK0qWUBKFzseV390U1D6ukLjQrf8qMHVs19w/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+o3C5legMYX6KuOn8v1eyuUZXNfe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iHpbtl2/V633ja7jSiVbnBBTOZ6YR9qids?= =?utf-8?q?gruQ/gSZ8QW4JHkEOiYtQn+KIr/i/M+XZe8psxLsCJPyG44nAJWyqGhz588ndHZ1f?= =?utf-8?q?qOWyafaHjiSIrMQ+ohloMU1ylgDVaE5koxX5EOBwCwvtVzhT+KuLgfyJovDxurGiU?= =?utf-8?q?dobCPt3S+cJ8NmEisDjlWJPbJd2PrTY/20rmIYBjGfHogC4MIz86iH+ycoT81U372?= =?utf-8?q?ErkUo9xRUaiSbN6yQz+rkYEshSUrPPaVB5wVFqSO/8M416y8nFPLhZeBrChVQphGW?= =?utf-8?q?0Tzq83Xqs7lzcUKbYRWxVCTkZqe8pXJs538grYAMu/v5G//Oo95DmQqfLKlEQBKA0?= =?utf-8?q?ejSt79xIbzv44APiBBfa11W0QxiEjcOo/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; From patchwork Thu Jul 26 11:52:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10545661 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 82EA214E0 for ; Thu, 26 Jul 2018 11:53:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B77F25E97 for ; Thu, 26 Jul 2018 11:53:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58A5D28979; Thu, 26 Jul 2018 11:53:31 +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=BAD_ENC_HEADER,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 EE8FB25E97 for ; Thu, 26 Jul 2018 11:53:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E2E986E722; Thu, 26 Jul 2018 11:53:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710054.outbound.protection.outlook.com [40.107.71.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id D05666E71E; Thu, 26 Jul 2018 11:53:28 +0000 (UTC) Received: from MWHPR12CA0059.namprd12.prod.outlook.com (2603:10b6:300:103::21) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:1e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Thu, 26 Jul 2018 11:53:27 +0000 Received: from DM3NAM03FT056.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by MWHPR12CA0059.outlook.office365.com (2603:10b6:300:103::21) 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:27 +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 DM3NAM03FT056.mail.protection.outlook.com (10.152.83.158) 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:26 +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:24 -0500 From: Huang Rui To: , Subject: [PATCH v2 4/4] drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2) Date: Thu, 26 Jul 2018 19:52:13 +0800 Message-ID: <1532605933-26209-5-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)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(428003)(199004)(189003)(356003)(7696005)(72206003)(2906002)(104016004)(14444005)(336012)(77096007)(26005)(106466001)(81166006)(186003)(81156014)(478600001)(8676002)(51416003)(76176011)(305945005)(86362001)(68736007)(110136005)(97736004)(48376002)(47776003)(16586007)(50466002)(316002)(4326008)(53416004)(426003)(8936002)(50226002)(105586002)(446003)(476003)(6666003)(5660300001)(486006)(11346002)(126002)(36756003)(2616005)(54906003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0232; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT056; 1:YABKVInKNAcMXL9LQDzEGnMGvH2wJUG8hDFbHESKJtzbruAbKPy3rMHaEIMHBlEDnydBgH7fsGSKD3TNvLZ3+0VyB+QEhJih2uCnyhoqxDyq4csxScOia7XS3lBbDTeg X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0845e83-ac95-41c7-ca2c-08d5f2ee65c8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060); SRVR:CY4PR1201MB0232; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 3:5m+LR528ClXcH2yREiiQYKJFsLx7Er3ZgHRvS9jAJ3IyVwIOt2zmzuSXJ8QeG7r7wniVer0DrLE2VdqfJNC2TD6oeWt0tJuWKQ7M383xAe7XicnBy3x0Jt1/XUpJkiRgFeW7z51x2GOHQ/g2H2hgPhtZSdjd4RXOhlfIUxKgWsrbLaojzFvnJOj211yoVWWLNVPl6wPq7j0SKFNZd0JXBZqLq+JN3UhZ75E3l6F0ktgxT3+lK4eSoqEghXhuIHuhawmeMmlEcDn6SzYVd6Rd3nXNP8bWFSo/8vVQkXrXmVf+08mtpOdSxswq4Bv7ULW69GmMzoyj7Qj39GXyefWNm8g30qyZZHMcYSIsACNSFQM=; 25:52lKBh8dYfLzJ2nK97ZdTT19XrNhnw4AIAzF3LSoL9osBuD9pZoY8ig+FrR521jd0/gFhokVaTyat9AvZiiPPcMhxIeWEcQPFam1r0JOs4yl/DOszdOo5xaa4gVQDqGLKZ6Z/QhF6rxVKa9JHNE2bu2fSloTnjx5BzuN5opi0PwWTCGW9vck7fk1meY6QSs6/IfMpoKd7gyDi+rjuHft8WM0Hin4Weq9riQADmdzW8QvLuRXEUlsv7B1fi1aczthDhbhWVQc2Ioj9LYnCNEqjCzW7sZWJ9C9Mlr1kv+9Am5YTumzVB4DrB3WKu0VuONz6X47cpVOcso1/3SRsaXR/g== X-MS-TrafficTypeDiagnostic: CY4PR1201MB0232: X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 31:aq0vpnm6VTHxGjmaCyrnozqmXxa7RArPK6qDNu2iG5xufscFs8S8FvN7vhL7zsunZC1dopkHRIJlQu8Ej7kh+WZ2uA39c9Wj46jSvT1wMAapRxlRyfPq4kqoWUpERu+T9+iQdb3L/l9nSq0ZVxX/RS8x/vD50PG5UnU/4KAHTaBwyZEbIeZCtdgdGCq16wDrNbzK3NnbQZxEAGnMiagYnvacAWPopHofqBAxXQ6drjk=; 20:UNjgmz+gfmS0F1P0xrgn4SStaQIQB0Fzh6Vp/SAgelzbYlrYgQxWh2RitNncvHVj77MxRaVtsGZmYG6U5ZQ7cxAznqW3/cbHoCw5VWQm2S4266ZCUylmqfVxeOo/b8Zoef6RzMgrJ4GDEazOWroEWD33Vujlrp+uT19oRPYErC7Y0L317gfzvVTXjQC/1wsKtFEhrQEKga481rUaaDRPWM3VrOcPQAyxU6LUurDfzbrWh1fri+5mR6jhKM5bRHXCrX9O6hX098FJnwQE20xbnjHbGax2bSf9SO1Sqx+nr55SmhNZ6sn8/vlQmigIzlV+SgP7kZueH9ZoI/XqYqS+vGOtvTWazdqqRoHZcXb6cEMvUZhozmkTDsYbk+1pUSvpucdNU9aFPbyy2dNUuXBTcNf9B1ZN87FbxiR92FtMX/7pp6rnNomUnNHf0kmJgVgBzeTVDpzrgsby8lILIK2DF0gzy6myTwgVCYrJwOnp8XOz/i+moK71/2Q7UVwrRrdp 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:CY4PR1201MB0232; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1201MB0232; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 4:rLp0syOLbCPqeE5SrhV2iGpy26aIEAGa7DUk5g2kweB115T5t784bVhPD9iiPFqH0zj8O9cl0NWJQi75yOe1ITOegHIYKbeUAsLbNc5nH9lxF2eMGME3RFnQq//WvdnGUepNiJJwgRcvlpMupkVzJFiVMek2QdKi3/Xgt5fRDFiaWge8jA64CbHll7jfqM+UyOkTvg6zC21xNG0kmihLRsD7FfSDVPMUysRMTuYeX2S78eMMfE/V8ryCIy8fuSdh/qRo8TlN75RO50ogbQdkD+KUXP/J0IkUv/fvH/8c72vCtQzLLwT+3RdxNI8TLeg3 X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0232; 23:8jD/6un6fKglXFK/zqABBwqTAYH2kp00PXWi6VF?= ZcVf/QpUZd1xUwuFACfQjxgjjfEGw4SrPiUmPFn3vvRcdcAYfd6WWvjxfIuM4eMAn5X8HHbr7AZ67OLfH2fM0OkZt4txUpweTr6ke9eCH/Vj5ANQw8JYkDeDb4QC615GuI/ZKylMIAzANBkqC8IFw8KY5mL6FR2k928TY77BWn/dudIktXkYCPMehRuBMi6Yj6usU+3jvowhlfyRpBO6VUYklicEiIthbEzb3hJ3YIeQHLhGPjZegJcHYqHDLa5g1ZG/xVGg7cB4PqCSQL2sPHejLwUvTzA05YoXcQwpHpFyii30OMaJXuRB/ThHSXh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agnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 20:DagHTWOBz8/M4k90fjXasm8OtfXxMtMqm87wLnDgXlOETzLy7FM9/AvFHGbF56oIJjltsYjBczBDLE6Z7iZSmsXJ8+/FvCGWQHT45QjgohxyUnXIouORFozc2LpXFvQSQrqJLSc3WV8SOL/QYcDlNOwSij9QITRTYgCNYSP5/SADhSAtzsXQtAgI4dpHvZl/LCfe4HW/b+fKNexccjgOFTWqhdWzfW45rYUYhW1lF5zEEKO+3DX+8pZH6ybizrVU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 11:53:26.4557 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0845e83-ac95-41c7-ca2c-08d5f2ee65c8 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: CY4PR1201MB0232 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 From: Bas Nieuwenhuizen Every set_pages_array_wb call resulted in cross-core interrupts and TLB flushes. Merge more of them for less overhead. This reduces the time needed to free a 1.6 GiB GTT WC buffer as part of Vulkan CTS from ~2 sec to < 0.25 sec. (Allocation still takes more than 2 sec though) (v2): use set_pages_wb instead of set_memory_wb. Signed-off-by: Bas Nieuwenhuizen Signed-off-by: Huang Rui --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index f31148a..8304917 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -349,17 +349,14 @@ static void ttm_pool_update_free_locked(struct dma_pool *pool, static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page) { struct page *page = d_page->p; - unsigned i, num_pages; + unsigned num_pages; /* Don't set WB on WB page pool. */ if (!(pool->type & IS_CACHED)) { num_pages = pool->size / PAGE_SIZE; - for (i = 0; i < num_pages; ++i, ++page) { - if (ttm_set_pages_array_wb(&page, 1)) { - pr_err("%s: Failed to set %d pages to wb!\n", - pool->dev_name, 1); - } - } + if (ttm_set_pages_wb(page, num_pages)) + pr_err("%s: Failed to set %d pages to wb!\n", + pool->dev_name, num_pages); } list_del(&d_page->page_list);