From patchwork Tue Jan 10 21:35:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9508557 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 E8E4D60231 for ; Tue, 10 Jan 2017 21:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA5CA285C3 for ; Tue, 10 Jan 2017 21:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEDE8285C7; Tue, 10 Jan 2017 21:36: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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6E336285C3 for ; Tue, 10 Jan 2017 21:36:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cR465-000378-ND; Tue, 10 Jan 2017 21:36:49 +0000 Received: from mail-qt0-f175.google.com ([209.85.216.175]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cR45h-0002Ev-5p for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2017 21:36:27 +0000 Received: by mail-qt0-f175.google.com with SMTP id l7so129472963qtd.1 for ; Tue, 10 Jan 2017 13:36:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S1QkNUR5L/EbVXW0g07FSco1JHr1oZzIXN6lt0htiQg=; b=IueTw9zYfgukohFUprW+lKkxKSupTFBTdKafUyqkSuQJLKs36ndIjzmQEWLzP1Wdnz Kw8DW9K9INHGgs49Wg8+e43w6dL0XoPh1nTQTgn2bKqNk+l9rRCLK4wk0dSi/CVtzGo+ GnK79jodSHTt+DoxFkotyzyIJ1hgv4M4BfmQDYxMs78iaTd3dUmcUlVUoyL6HzwGmPBZ VCMaoYQS44HILpaaOL098BDO5oR32Ex0OWD7yuj9AWAY73gcK0XjzyxSVH94v12o4ZsV hisEA85CNgIuXMI5vHzotkIw7Fuocgu6heVrQuA3YBFnQIeM4yUM6DdBz/DfPyWmwRvh Gm7g== X-Gm-Message-State: AIkVDXJoPCgbaZObh6jz85f/VAiLT1BNUycbKRf6emyIYMjjIAuVW/W8oww+OMkwetAhYy1h X-Received: by 10.237.39.148 with SMTP id a20mr5090981qtd.65.1484084163944; Tue, 10 Jan 2017 13:36:03 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc::6b06]) by smtp.gmail.com with ESMTPSA id n188sm2406857qkc.30.2017.01.10.13.36.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jan 2017 13:36:02 -0800 (PST) From: Laura Abbott To: Marek Szyprowski , Joonsoo Kim , Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas , Florian Fainelli Subject: [PATCHv7 02/11] mm/cma: Cleanup highmem check Date: Tue, 10 Jan 2017 13:35:41 -0800 Message-Id: <1484084150-1523-3-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484084150-1523-1-git-send-email-labbott@redhat.com> References: <1484084150-1523-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170110_133625_346167_8AEF3E04 X-CRM114-Status: GOOD ( 14.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 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 --- 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);