From patchwork Thu Feb 8 08:32:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10206679 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 5EF1C602D8 for ; Thu, 8 Feb 2018 08:32:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E7052881D for ; Thu, 8 Feb 2018 08:32:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 407C328872; Thu, 8 Feb 2018 08:32:51 +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 BE3BF2881D for ; Thu, 8 Feb 2018 08:32:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 34C706E15D; Thu, 8 Feb 2018 08:32:49 +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-sn1nam01on0088.outbound.protection.outlook.com [104.47.32.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0FD3F6E154; Thu, 8 Feb 2018 08:32:47 +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=/E9Jg90WftiEDkGRfyYDfyCxt8zwcCUpz8s4A43xHxg=; b=v1xzSSOMNlaziiX9T7CDvl83AHVT23XyAc4WIeAnvO29BEpLoWYzJrfNTWSYBwUhYFc54/T+Pwk/z+yQCUOP0KOtiJ9L9aZsUruxfsOv2VSS3S2rrbGV2sCdmgF3+CIYUpVkDi9I+VRCPEnOAoyokFLPRF3Amfbdro8DtEpimlY= Received: from BN4PR12CA0019.namprd12.prod.outlook.com (10.164.241.29) by BN6SPR00MB03.namprd12.prod.outlook.com (10.172.112.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.11; Thu, 8 Feb 2018 08:32:44 +0000 Received: from CO1NAM03FT033.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::200) by BN4PR12CA0019.outlook.office365.com (2603:10b6:403:2::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 08:32:44 +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.485.12 via Frontend Transport; Thu, 8 Feb 2018 08:32:43 +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 02:32:35 -0600 From: Chunming Zhou To: , Subject: [PATCH 1/3] drm: add func to get max iomem address Date: Thu, 8 Feb 2018 16:32:36 +0800 Message-ID: <20180208083238.8291-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)(346002)(39380400002)(39860400002)(376002)(396003)(2980300002)(428003)(189003)(199004)(2906002)(106466001)(81166006)(50226002)(81156014)(8676002)(97736004)(8936002)(305945005)(51416003)(356003)(575784001)(86362001)(7696005)(5660300001)(47776003)(48376002)(104016004)(50466002)(186003)(336011)(53416004)(110136005)(54906003)(16586007)(316002)(26005)(77096007)(105586002)(1076002)(53936002)(478600001)(68736007)(4326008)(36756003)(450100002)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6SPR00MB03; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT033; 1:9AVXS5gX+l+LaOeINKmR7E0pE8iUkgEWT3B8SzG6jHFIW9mueO49Xqwwbct3ZurlFe/bbFW3FpENRtNjY8isN6PtwB/lrGnvtHyXxk6FUVxrJL9Rgkw/sb0bws+qjpzG X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf95135c-8dde-4962-3e37-08d56ece8675 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BN6SPR00MB03; X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB03; 3:bmcDXM5eQtDfssVjL3MB/fZUNHt72KJRLjh7VbGA0g/lTieqoAWuhSBK6tIYZ631qTbpKPywUz7nl2Swu/sX9AnTHTDHXhMmDtQr9uPyP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3zYchKhKhEGPnNdDe9s9hvv2VgzZCcX0TcTlUE16cuqibDOAcwMXumtHTw3nAsftLa3A4F1gAVEF/bHv/gqeEJffWO3UdJYPeiWRo5GpmMz/vQS4KParOR5IZtdytRwrWXRbkyJ3usE35TUrHl2LKIyolEX8d7rhHOcNLiKXgyGeE83PFlr40WQXDEjavzlIlwEvM0J5iwc5Lbg9y27/FpWcZjKKR3fFM7bjz1y7fnUKFi5rG8TDEaUzWD3Hk75tkDCeTQaS6v+EGcBeyJPU2/ffzYNO9sqzgfiuCGbLzUMK+pAkWc5biHdTrWgqzVSdSlMQrZIPrkHXADs/dz8ree7OEEb/nId5v44PUMwK1tOxj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231101)(2400082)(944501161)(10201501046)(3002001)(93006095)(93003095)(6055026)(6041288)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BN6SPR00MB03; BCL:0; PCL:0; RULEID:; SRVR:BN6SPR00MB03; X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB03; 4:PA/TI/WQoamNkbUh3aHpKTkvfMo4tu3hUeHtAee9AEpolcJz8BmywGKKy8BiXH0NcFO8L7hnJ+IM/sdkbueD0qCdcY/yW2tei1L3JKNoAQ6Z+e0UD6Q0xOmOIoliNanqJNYr4zcKsP5ccVpHXPC8vBwKkHQl1EjyblRq5Oq1oG2VKQA3/3YfvtdEJ/FlkN9nGSA2YsICH7ZF/cVNeHUeYg4Bxgw9dl31N7RhlNP8ppuZXHJM3fRaS9pZRL8ba7mb+pXTdJHN5/i4V0lT7rIX+HFSd/zSvDGdP31QcXZMMQ0U6Y2nmc8gYHU36eyYZudw X-Forefront-PRVS: 0577AD41D6 X-Microsoft-Exchange-Diagnostics: =?us-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M2L3hIBl4GEzbV6sEI8RFYZmOvb22+RtCNBUBtjhTefFu41D1GJ/7Wd0wRGGYUpyYxYOI+lUoJvPZVfMWcpZ+LYBKv1/mgkT4nh9SmRyVKhO/MMZfbL9h1Gvpw8kOsk9Hugn413QezGwmFtg7K SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6SPR00MB03; 20:9nGJMJX0gLjIri+9L0b34FuLMvRJ2AbeyaqBylQmhGEP7DjweOo0tfVdxMbspi5gLWPONEWvpafy7PvHdCgy+Hu/gpLNAJpODLV+XOcyCotRctUP4dSaZwunHbxwZ51g+ctTG8hA2WsozkD6ooyrRJTgZJD3FYJZHZhXVEmlVvrXHLYcHQzQdCmwDwnEbWOz25RN3TF4tqWMHmYcW3KVsjCo3lCq8v02tJ9JEErJJ36AWJvgvM29rJCH72RfMCId X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2018 08:32:43.8910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf95135c-8dde-4962-3e37-08d56ece8675 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: BN6SPR00MB03 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 Reviewed-by: Monk Liu Reviewed-by: Christian König for the whole --- 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)