From patchwork Fri Nov 18 01:16:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9435619 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 0967460471 for ; Fri, 18 Nov 2016 01:20:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED99028DAD for ; Fri, 18 Nov 2016 01:19:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2474296E5; Fri, 18 Nov 2016 01:19:59 +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 62D4428DAD for ; Fri, 18 Nov 2016 01:19:59 +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 1c7Xoo-0007tU-JQ; Fri, 18 Nov 2016 01:18:18 +0000 Received: from mail-it0-f48.google.com ([209.85.214.48]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c7Xny-0007Uv-VW for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2016 01:17:28 +0000 Received: by mail-it0-f48.google.com with SMTP id y23so7173426itc.0 for ; Thu, 17 Nov 2016 17:17:06 -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=JPTPyvj4+hkEHwBTKci9TcExtsQs/uj5MlyoKOR1leg=; b=LaKJDv7vZa1hEx7ejJx3UR4VS6+NG0caKNeioFCmSVHas9VGekmdC2Gsrq4X7fP/SB OOJcYrvO0fM+Pty85xT+Yo/tt5sSrscez5zx7q23aUGKkjqGwGrC6oT2D5bFfpufBJqX v6jeNKg4ZrZRHSr7LqaTs/N+CN7TiGS1cIlYiVGBgmw8KH6wwAFdvHxV31CIjy9mA4Iv mTFYk8g74bhDeaynHOECbGuiOWjwmvMP2iHQ8xn3nBWM8Tn5OYgugYDBL/X465fifPG0 r6r5EAAa+Y+giNrmjIKP7Oi+Z/tYKJlMg7rOnnDcbwY36p5OxftP9HrZ5iYgemWVO4Tc 6psQ== X-Gm-Message-State: ABUngvcbQVgZ0TLWcjR18agvSUUb+TDhJK4qyXE0GAQu8nb+vO4dxsjheMBexr2z+OqKZ7vU X-Received: by 10.36.39.85 with SMTP id g82mr6577135ita.52.1479431825759; Thu, 17 Nov 2016 17:17:05 -0800 (PST) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::df9b]) by smtp.gmail.com with ESMTPSA id i8sm254953itc.11.2016.11.17.17.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 17:17:04 -0800 (PST) From: Laura Abbott To: Marek Szyprowski , Joonsoo Kim , Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas Subject: [PATCHv3 2/6] mm/cma: Cleanup highmem check Date: Thu, 17 Nov 2016 17:16:52 -0800 Message-Id: <1479431816-5028-3-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479431816-5028-1-git-send-email-labbott@redhat.com> References: <1479431816-5028-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161117_171727_272936_3CEE19B1 X-CRM114-Status: GOOD ( 14.27 ) 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. Signed-off-by: Laura Abbott --- v3: No change, mm maintainers please ack if you are okay with this. --- 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);