From patchwork Tue Dec 6 23:50:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9463473 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 7562D60231 for ; Tue, 6 Dec 2016 23:53:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 655DD284D4 for ; Tue, 6 Dec 2016 23:53:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55960284EE; Tue, 6 Dec 2016 23:53:22 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B56A284D4 for ; Tue, 6 Dec 2016 23:53:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEPWT-00047l-Mv; Tue, 06 Dec 2016 23:51:45 +0000 Received: from mail-qk0-f172.google.com ([209.85.220.172]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEPW9-0003qG-PM for linux-arm-kernel@lists.infradead.org; Tue, 06 Dec 2016 23:51:27 +0000 Received: by mail-qk0-f172.google.com with SMTP id n21so397662395qka.3 for ; Tue, 06 Dec 2016 15:51:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=igbgKV6MKSUn01RQ7z0kY1XfXG+F7WeZQh2pmOGR2/0=; b=aPCvRL1/2jIm3yXAkQeIUHNw7KN3t5MlH1KiAivYEd8qXtT+aSA9hBt/NWZaaIt89j Xgzyb61ecXi7A9wGTlwjS3bcXL7z7ViODZoj/MCDizLRQvIxQiCiSN46MEw6Gm+ppVx4 w/jJerlaa8tRQOykwP5BSg16ZYXKHlrPOBMLMeOZ1mgr+umKyvFttUHV6Q14Ms0hIncY 1wfnBD2dNzYjVlf0EDfq3Qta5ivTUrw4s7PJyFs9n/Sf1oOpf3rE80u//ODbJPlgo991 J0uYQFxoRkO4LrGCEsQhsxEB8Fb4qYUCqBbuQwrpgfm9YOsMBIYD0mtxliMjCIhneJwy p2uw== X-Gm-Message-State: AKaTC02GihM/dpLfK/2OOTbw287CrkZu2a3IRWBNh2LBrgTjisQLmsw5a7IlhD1xcLdLLk3M X-Received: by 10.55.7.132 with SMTP id 126mr54361306qkh.224.1481068269439; Tue, 06 Dec 2016 15:51:09 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::df9b]) by smtp.gmail.com with ESMTPSA id o190sm2739212qke.5.2016.12.06.15.51.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 15:51:08 -0800 (PST) From: Laura Abbott To: Marek Szyprowski , Joonsoo Kim , Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas Subject: [PATCHv5 02/11] mm/cma: Cleanup highmem check Date: Tue, 6 Dec 2016 15:50:48 -0800 Message-Id: <1481068257-6367-3-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481068257-6367-1-git-send-email-labbott@redhat.com> References: <1481068257-6367-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161206_155126_172029_2439629E X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Laura Abbott , Andrew Morton , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 6b101e2a3ce4 ("mm/CMA: fix boot regression due to physical address of high_memory") added checks to use __pa_nodebug on x86 since CONFIG_DEBUG_VIRTUAL complains about high_memory not being linearlly mapped. arm64 is now getting support for CONFIG_DEBUG_VIRTUAL as well. Rather than add an explosion of arches to the #ifdef, switch to an alternate method to calculate the physical start of highmem using the page before highmem starts. This avoids the need for the #ifdef and extra __pa_nodebug calls. Reviewed-by: Mark Rutland Tested-by: Mark Rutland Signed-off-by: Laura Abbott --- v5: No changes --- mm/cma.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mm/cma.c b/mm/cma.c index c960459..94b3460 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -235,18 +235,13 @@ int __init cma_declare_contiguous(phys_addr_t base, phys_addr_t highmem_start; int ret = 0; -#ifdef CONFIG_X86 /* - * high_memory isn't direct mapped memory so retrieving its physical - * address isn't appropriate. But it would be useful to check the - * physical address of the highmem boundary so it's justifiable to get - * the physical address from it. On x86 there is a validation check for - * this case, so the following workaround is needed to avoid it. + * We can't use __pa(high_memory) directly, since high_memory + * isn't a valid direct map VA, and DEBUG_VIRTUAL will (validly) + * complain. Find the boundary by adding one to the last valid + * address. */ - highmem_start = __pa_nodebug(high_memory); -#else - highmem_start = __pa(high_memory); -#endif + highmem_start = __pa(high_memory - 1) + 1; pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n", __func__, &size, &base, &limit, &alignment);