From patchwork Tue Jan 3 17:21:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9495253 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 F3A80606A7 for ; Tue, 3 Jan 2017 17:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 079FB27BFF for ; Tue, 3 Jan 2017 17:24:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F06CD27C2D; Tue, 3 Jan 2017 17:24:23 +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 AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AFBD227BFF for ; Tue, 3 Jan 2017 17:24:23 +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 1cOSng-0004RT-QX; Tue, 03 Jan 2017 17:23:04 +0000 Received: from mail-qt0-f181.google.com ([209.85.216.181]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOSn8-0004EX-Ca for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2017 17:22:31 +0000 Received: by mail-qt0-f181.google.com with SMTP id c47so468474189qtc.2 for ; Tue, 03 Jan 2017 09:22:10 -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=pJP46fpr2iphJboBN6AG/WshoUZ0a+r4ozT6Q0GpwXokxqha1LeIJpHUdZLhVp4WH4 FxGJuHML4Zx0b2RQIUSdswZITqwFwNwaeQ1zmnYLHh6Umqz/s1TBFNLTuHWqufJH46bR 9TuewHw9CxKf3k4Gar78d4S0lWBhleQDWyuuxO/0afycspvtooNmjx6pX5tI+hNvp5m0 Ly3HODMy6jcGFrL7TP2WlAVIdFceeb8fXYF322qDhErJK2wSzuDKNwgS9PTTj2TVJ5BY 07u0R/f41Gt5GY1IhnffABrIQqvD2GfzW/uEun8R5JltsX99jRhsCPgc5ES6C/Qfv3LC AcIg== X-Gm-Message-State: AIkVDXJjn65BwbEbA9ywjZ486o/NhoClN4cPR3f68uzBfcyM0q5paZekOqYTBtYGdZiXTJMj X-Received: by 10.237.58.138 with SMTP id o10mr57657829qte.76.1483464129186; Tue, 03 Jan 2017 09:22:09 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9802:a8dc::6b06]) by smtp.gmail.com with ESMTPSA id 53sm44034313qtm.5.2017.01.03.09.22.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jan 2017 09:22:08 -0800 (PST) From: Laura Abbott To: Marek Szyprowski , Joonsoo Kim , Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas Subject: [PATCHv6 02/11] mm/cma: Cleanup highmem check Date: Tue, 3 Jan 2017 09:21:44 -0800 Message-Id: <1483464113-1587-3-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483464113-1587-1-git-send-email-labbott@redhat.com> References: <1483464113-1587-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170103_092230_607004_3B78D966 X-CRM114-Status: GOOD ( 13.72 ) 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 --- 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);