From patchwork Thu Feb 8 06:00:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10206619 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 4E443600F6 for ; Thu, 8 Feb 2018 06:00:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 326E7293A1 for ; Thu, 8 Feb 2018 06:00:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2749C293B6; Thu, 8 Feb 2018 06:00:41 +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=BAD_ENC_HEADER,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 55D3D293A1 for ; Thu, 8 Feb 2018 06:00:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 22A936E114; Thu, 8 Feb 2018 06:00:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0074.outbound.protection.outlook.com [104.47.32.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 08CE96E114 for ; Thu, 8 Feb 2018 06:00:35 +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=3s6ZaCyi0bN71+sD7n/0m4gErx+oGBXT19hU8DRLfHQ=; b=X76tpbN0Qp191RWJgqg4qeCSO36qesxH2PuaKcxxMAIQF6uDo66bKE72at7LzRPIvgT8343xISm4q/hwvEGaKQVcCACGGbiqrqwKfHVWIiE5Bfy1MPYDd5Yjo83eCah0nQ27AnTCZEIb+sPp+NCR/jcXunKNw+Je5mswpwioCQU= Received: from DM5PR12CA0019.namprd12.prod.outlook.com (10.172.32.157) by BN6PR12MB1619.namprd12.prod.outlook.com (10.172.23.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Thu, 8 Feb 2018 06:00:33 +0000 Received: from CO1NAM03FT033.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by DM5PR12CA0019.outlook.office365.com (2603:10b6:4:1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.485.10 via Frontend Transport; Thu, 8 Feb 2018 06:00:33 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; 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 CO1NAM03FT033.mail.protection.outlook.com (10.152.80.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.464.13 via Frontend Transport; Thu, 8 Feb 2018 06:00:32 +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 00:00:21 -0600 From: Chunming Zhou To: Subject: [PATCH 1/3] drm: add func to get max iomem address Date: Thu, 8 Feb 2018 14:00:15 +0800 Message-ID: <20180208060017.30780-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)(39860400002)(376002)(346002)(39380400002)(396003)(2980300002)(428003)(199004)(189003)(54906003)(106466001)(72206003)(50466002)(316002)(26005)(104016004)(1076002)(48376002)(336011)(6916009)(77096007)(8936002)(105586002)(53416004)(478600001)(16586007)(2906002)(36756003)(2351001)(53936002)(186003)(5660300001)(47776003)(81166006)(81156014)(68736007)(356003)(6666003)(4326008)(97736004)(305945005)(51416003)(8676002)(575784001)(50226002)(86362001)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1619; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT033; 1:rg/JBlgZIrVdu1/7aq6fgZ4Lu5BRuceQ04Uygalh77awP37+71mtFPXsfjluYobka5pFO5y9t9bhS4JCCNcawRQF+e+LcYUIMUIZVx5rDIHDV7+mYUp8FWsonPMUQbGA X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e427337-7b90-4aae-9567-08d56eb943ba X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:BN6PR12MB1619; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1619; 3:EFb7TC6FOxAxW6N13SZlZpxJ0l0+FlA9gQePx27D/4KLtxYGA8HshUqnLuDb8YZEVAnYY+j7yjdUuXLO/lgYbPL9CX9fhkYAlOLLUE2Aq21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hPkhDx0NBKF326qItKwDcKkDjJeQMRLd3ns/+keGqGdQZCzh3gWl3Li1jpYz2wADRL4Up/L7qzUdTA9D34yoFCiqxIhGqbiguU04BCPzK793l6TtauCtebBVzblsFWrtAMNZqG63bjKbw1Upay5/ir1SCiQVP5BUpPJwBXAjXoYYvdLgEeaH5geJ6Nx70vP90yfRmaTNQHDLr/ggjlZWJyIL+gBkcEmlv29ICZVoxG+3ZAL/vkWK9iRWy7OK5xcx8AubqcplWdffKB0lzsJYHWqoyi9uw2tKI1ZXJFd4oKC/rcsCBfROI3CtNOGsmL4fd0kDfIVa8/UjEEHNDGcUBUp8igxpS3aLr 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)(93006095)(93003095)(3231101)(2400082)(944501161)(10201501046)(3002001)(6055026)(6041288)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:BN6PR12MB1619; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1619; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1619; 4:yNfECl7TjHwt07ouIE4Y7deAZWsTwEOvkh/mishtFqFGUfGrqfyuE5Z2QDxvgrUfWM2Pb+64pnJVAluiC5G57XOJyDGOP1lm4Svwox6Rzl/wo+wWkljw2zMx7COdatacQgRC3Q4d7VmUNvZwOuxyYtSuZ3A6mwccEvJXiEPCwIGUmUgBhhZJ3f3bPeMcJxckuLYoZZYweq/E7u30RP5ZWVkIcr2vH0elwXzulMIk8/qVgTESx/3/bXN3zqJ/PHlKkVRZzfvJJRHWUB01JzekUuaVSh2CgrKFR342O5ElWRZdxjwFBSQiuW0GqH3pvS0M X-Forefront-PRVS: 0577AD41D6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1619; 23:5PA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P7Kd/dfjmeZxnnP/il9fQ7IuF3vlWvfuX3wGMJCZI0vnT1laLoEMH810Tld8r1dmEqTjYFThxkaUhMPaugWwoIJCNt9LkIqvhBajQg1BnqmF1tfdyIVHxsfd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1619; 20:vgcTxZJB578K2hgmrrR54BJmmV/kV3vKQBkBSuRd6Yc/wBRLajO1SztqBiwA05668qqAWdpSClY7eZgX2Y9a+nQUFk6puoBodCRRANApCMfCV9TATrahaKp8w7f8n+3oGWXMjE3GofWv0ck9ARj6jTeRGYdFbonctjmCZhxxxKTuvTXawqUDAUqQxOxgQPS1FKbx9kYHK9bBXkeZnTbHgWLbWfrleHor+KRxL4NRREQOQPMxIQ/SZ7H8GITvDyf8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2018 06:00:32.3662 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e427337-7b90-4aae-9567-08d56eb943ba 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: BN6PR12MB1619 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: 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 Change-Id: Idbe47af8f12032d4803bb3d47273e807f19169c3 Signed-off-by: Chunming Zhou --- include/drm/drm_cache.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h index beab0f0d0cfb..442c9ba63d03 100644 --- a/include/drm/drm_cache.h +++ b/include/drm/drm_cache.h @@ -39,6 +39,19 @@ 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); +static inline 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; +} + + static inline bool drm_arch_can_wc_memory(void) { #if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)