From patchwork Fri Feb 9 02:44:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10208211 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 B1A1760134 for ; Fri, 9 Feb 2018 02:44:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97F87295B8 for ; Fri, 9 Feb 2018 02:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A5C9295DF; Fri, 9 Feb 2018 02:44:34 +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=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 997CA295B8 for ; Fri, 9 Feb 2018 02:44:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECE206E6FC; Fri, 9 Feb 2018 02:44:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0065.outbound.protection.outlook.com [104.47.42.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E8D06E6FC; Fri, 9 Feb 2018 02:44:29 +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=Mw7U0QFuOHKrrVcot27TCV/wUWK2H3jW4ea5dhIW5qQ=; b=Pt6UoxUpb7SR9xOrF+XZ/tpSlFvs+UbyLrG1b+b8otLlIAALMcwCoQp2gwKa37OlnqGpOxfjJLRBDU6WG5cZTm2jgLYW5zcw4Ty6n1zhWI8AgeaPjR9Zp8McN8VQkZkTNZ5dVi1aHnzgtnGjc2scxFDGnQgeMGk/2mIszsAypm8= Received: from BN6PR12CA0039.namprd12.prod.outlook.com (10.160.47.25) by BY2PR1201MB0917.namprd12.prod.outlook.com (10.164.167.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Fri, 9 Feb 2018 02:44:26 +0000 Received: from DM3NAM03FT010.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by BN6PR12CA0039.outlook.office365.com (2603:10b6:405:70::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.485.10 via Frontend Transport; Fri, 9 Feb 2018 02:44:25 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; daenzer.net; dkim=none (message not signed) header.d=none; daenzer.net; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.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_P256) id 15.20.485.12 via Frontend Transport; Fri, 9 Feb 2018 02:44:24 +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 20:44:15 -0600 From: Chunming Zhou To: , Subject: [PATCH 1/3] drm: add func to get max iomem address v2 Date: Fri, 9 Feb 2018 10:44:08 +0800 Message-ID: <20180209024410.1469-1-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 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)(39860400002)(396003)(346002)(39380400002)(2980300002)(428003)(199004)(189003)(105586002)(81166006)(1076002)(104016004)(81156014)(26005)(50226002)(77096007)(110136005)(50466002)(5660300001)(336011)(8676002)(2870700001)(53936002)(8936002)(2906002)(4326008)(54906003)(68736007)(53416004)(186003)(47776003)(305945005)(106466001)(23676004)(478600001)(316002)(5820100001)(6666003)(97736004)(36756003)(575784001)(356003)(7696005)(86362001)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR1201MB0917; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT010; 1:ipnXp8F1ftTo2EgNoEEaubGhzOqc1g3b6Al5R8w+dddSzjQGNB+nQrCzwOQLkquiMB7SwdhXFOjomAy7Cl5Nd5Khy06sf5YPdSFAmG8DJaHQWcL1LX5//RfZEBnyNdsX X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93c91cfc-6158-4ca5-ccd0-08d56f670819 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR1201MB0917; X-Microsoft-Exchange-Diagnostics: 1; BY2PR1201MB0917; 3:FXKh47ZLt2yyDkoRt2HcFnZL1qJwDHB6dWGQ25e7dng35KCT2UbcP+8E2/lrrMbvsYtb1cMNa6ROIcEVMMy9NZY9zscic5g1GZAwWz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CbWDb5pIXOmZuOWzxLY6hAiKxq6/aQz66EQCzCsub294WZ+UhvTNHbC4xAdAAN9hbEsf2+9VTfyLEes+nWPaNFXrmo25IFGA9EQ6Tkp98GNvuHyAjBIocmZYc+cv++hTByGEgbRqJ8bb0zPJtVsYdfRYekC74ddFhKAyFTyh4z5G1ccYCFCr6vP1iU5ndCLZ+vVdsBGvsGP78FUKGTLS54seVQlgdLXNW8CmXIEeO3hSiqHtXkkw1t32UD5AJ8X6+yLJANe/AqHGb3rZY/bpWX1cS3GyGD0LKoGhLjPz/3xz/J5zQ+tdMQYTNOr5FgW41pYZYsdWE5yqwTnfCfCnE4Lf1bxyp6dij X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(2400082)(944501161)(93006095)(93003095)(10201501046)(3002001)(6055026)(6041288)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:BY2PR1201MB0917; BCL:0; PCL:0; RULEID:; SRVR:BY2PR1201MB0917; X-Microsoft-Exchange-Diagnostics: 1; BY2PR1201MB0917; 4:LHq59ixnqNrKyMkahQ/UsakIkSi6NTGS2Pe5UhaE935d9kBR7wdfIZn/1PM/JM2Lf9eVbmxz7xajpZlV6ivev1+cXV/iV099mjuPaFBHZb+n36UZFwqTMWGQs/4FdMFZnfUswcX/MF6zl/8fo5s6NktNoeV/jPdKouQ0KwfRF6Cs9T5L5T1JfgunTh53uhjlwJeCAx/vCa/6DtE8esPxN4wLjaC6kbhKf2lTSxYOVKUv/OBLFBLt6H6Rtn3F0Jgd5FebwPZkabZiusz4x1tjBB7FNf7PuwPAZZCznMvieOwCBbSkVxOD9mRcO6sY1II4 X-Forefront-PRVS: 057859F9C5 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQU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; 5:M80hMEBdvtDZQkqRSnSTbNB3PFKo1VV3LLAfI313jxIGlgIeJTX+L01LBeYlPHpd/THAo5vBfQ1mSBm7IOOaGXf1+zhYXDdeQ9Q1W2FGGLmYSIjmGluYfphwObFab1wcmuzFZ1SYmuBVmmVHqxmX92Mr9vWSlf3yo9ZfiVDcDPU=; 24:jylHaVC9A2TgR3O4MWXl0thUF13sz/B2gRrZyfZOQU8P9KhLb7nWD9qV0U8bUc/JmTJekF9vA6uJapGKIy6RVXrvQx0C2ThCVnSXzD1XX0A=; 7:6wAdLxkumsaiRU++rA+fzEVZfKQdC8tEnnUmHPTQcpJ8q6AwXWXXgvXkE5k/ZJmPgQA+40q1W4aSJrDTOug8yKRVpBdjcipjOP2rWGyD8dOAWj84osbvy7gIgp635tAuQ1YcjXeKDlTKrT/gX8O+Pediq9uh5w5jsjBLnBYgh3EsUcCwhw/NJrRQvXto7CLSXdFxy8JW4YWlZ7kOAsuPsme9Enu7b9I5ic2/Y681HTbejVhc515uysJFL4pEi40N SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR1201MB0917; 20:nTHEBoLUJwvwqAUDxgNu7HW6GOInLn/syQuvQkiWLVYfL7ggO3DeLdMSNJAzb2PNNp7HVsBm4QNUKJTunaOloBjk9BWk2BubcTk77DqH7BXx3BQBQFr3BWBCyqhC9BvRWQU/k5ezMDJRBEZPGzgZoQfHBtN+uF8zBwLg+qbw9muGrDZ+bNpuRX81U+Xj1hEz5r+BxyBbhE/qGyE5Z04SrJb2DFvv2WA2mgU/PLfRWJOBcpm7JUx2kc0MaHK+u/+/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2018 02:44:24.8828 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93c91cfc-6158-4ca5-ccd0-08d56f670819 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: BY2PR1201MB0917 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: michel@daenzer.net, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP it will be used to check if the driver needs swiotlb v2: Don't use inline, instead, move function to drm_memory.c (Mechel Daenzer ) Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 Signed-off-by: Chunming Zhou Reviewed-by: Monk Liu Reviewed-by: Christian König Reviewed-by: Michel Dänzer --- drivers/gpu/drm/drm_memory.c | 13 +++++++++++++ include/drm/drm_cache.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c index fc0ebd273ef8..7ca500b8c399 100644 --- a/drivers/gpu/drm/drm_memory.c +++ b/drivers/gpu/drm/drm_memory.c @@ -149,3 +149,16 @@ void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev) iounmap(map->handle); } EXPORT_SYMBOL(drm_legacy_ioremapfree); + +u64 drm_get_max_iomem(void) +{ + struct resource *tmp; + u64 max_iomem = 0; + + for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) { + max_iomem = max(max_iomem, tmp->end); + } + + return max_iomem; +} +EXPORT_SYMBOL(drm_get_max_iomem); diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h index beab0f0d0cfb..bfe1639df02d 100644 --- a/include/drm/drm_cache.h +++ b/include/drm/drm_cache.h @@ -38,6 +38,8 @@ void drm_clflush_pages(struct page *pages[], unsigned long num_pages); void drm_clflush_sg(struct sg_table *st); void drm_clflush_virt_range(void *addr, unsigned long length); +u64 drm_get_max_iomem(void); + static inline bool drm_arch_can_wc_memory(void) {