From patchwork Wed Nov 2 21:00:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9409877 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 6B6F660585 for ; Wed, 2 Nov 2016 21:03:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A9C62A5BC for ; Wed, 2 Nov 2016 21:03:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E3552A5C1; Wed, 2 Nov 2016 21:03:31 +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 D9D112A5BC for ; Wed, 2 Nov 2016 21:03:30 +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 1c22fb-0008Nz-Tu; Wed, 02 Nov 2016 21:02:03 +0000 Received: from mail-qt0-f172.google.com ([209.85.216.172]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c22ey-0007pE-EG for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2016 21:01:26 +0000 Received: by mail-qt0-f172.google.com with SMTP id c47so16709974qtc.2 for ; Wed, 02 Nov 2016 14:01:04 -0700 (PDT) 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=fR2uGX0RpHNq/NXPKpWmnhe6EsJs5PRyB3b8CSmBu6c=; b=f7zp53Ub4w/jO0C5q8wu+eXAapc56GePMyOLcxdT1/aQw89wHaotBF1lTkvQRAXJui BNUb6Xo41BnjY3tOkw3j7ZzPZ7QpqJhRH/VfWYy8WAd3qCxGr6vqQUn7GqmoR54rZ5ZR EkbFLFwhoM6d5EzYj7p5Qhz/UXPM3bv9f5Wx7wEEC4HR1EWaPm1PDqfzp/kfb2ZsVLz5 f7hv25YK7u30sBTZLazk6Spyo0viLXULeOJPBwMrSX1+CCtoOrtVOPbHs6HlMomXXI0p l8sldk1uSjpyTL4+p6QKPR9rbUM0s//5tXeVMw9OfMcpQppwB1HtH6jjuPiOInrHBpUT dRvw== X-Gm-Message-State: ABUngvcT4dVJ2wNE3EhLi03kP0WlHjYnxvGqJoiSZWg2Re1p5jho1+KTFsfgQHgLSSj4euRh X-Received: by 10.237.36.235 with SMTP id u40mr4647133qtc.110.1478120463082; Wed, 02 Nov 2016 14:01:03 -0700 (PDT) Received: from X1-Carbon.redhat.com ([198.233.217.214]) by smtp.gmail.com with ESMTPSA id a54sm2193376qta.49.2016.11.02.14.01.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Nov 2016 14:01:02 -0700 (PDT) From: Laura Abbott To: Marek Szyprowski , Joonsoo Kim , Mark Rutland , Ard Biesheuvel , Will Deacon , Catalin Marinas Subject: [PATCHv2 2/6] mm/cma: Cleanup highmem check Date: Wed, 2 Nov 2016 15:00:50 -0600 Message-Id: <20161102210054.16621-3-labbott@redhat.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161102210054.16621-1-labbott@redhat.com> References: <20161102210054.16621-1-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161102_140124_626706_E3EC6DB6 X-CRM114-Status: GOOD ( 14.08 ) 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 --- mm/cma.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mm/cma.c b/mm/cma.c index 384c2cb..71a2ec1 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);