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