From patchwork Thu Jan 18 19:13:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristina_Mart=C5=A1enko?= X-Patchwork-Id: 10173951 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 6673E603B5 for ; Thu, 18 Jan 2018 19:13:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5547828474 for ; Thu, 18 Jan 2018 19:13:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49B8328478; Thu, 18 Jan 2018 19:13: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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA15428474 for ; Thu, 18 Jan 2018 19:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=QmzBsSneUjx9ZdYqFW6J9IAGXsVEh9idDEzd4kcHlsg=; b=LqE +LUh3ASnIlXS25jaKsWZOTRyiU9ep5Sp6N1q894Lyb10q5YhWWmPh4isfrkNMO/ThH6bAyY5Aox5V OtKpaIIkBu0rr0puJ3gX21chSe08cS05Nf7oqE2FX5hLmWfbkgJCEOTGPZxd4PbVHinlOPYLP4BaI HptiV969W3Dmc8JcU/1XJmiLBL2bUL0FPgmR1t18pQL3YeWCwRk9ldoAY0QpYsn371PkHgLShOC0a UGCqoH/T376uy6Sw65mwFBx5dybNpHIi+zgqF6nsa6G/OWGWIRGSbT2JkVVxMcDkkmlbTg0d1X5/p ZxiQfFwA/u3m9dXWuI3sai102CNNByg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ecFdM-0000Av-5l; Thu, 18 Jan 2018 19:13:56 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ecFdJ-00006e-Jy for linux-arm-kernel@lists.infradead.org; Thu, 18 Jan 2018 19:13:55 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E1C31435; Thu, 18 Jan 2018 11:13:41 -0800 (PST) Received: from moonbear.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D58AD3F557; Thu, 18 Jan 2018 11:13:39 -0800 (PST) From: Kristina Martsenko To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64: mm: ignore memory above supported physical address size Date: Thu, 18 Jan 2018 19:13:11 +0000 Message-Id: <1516302791-7692-1-git-send-email-kristina.martsenko@arm.com> X-Mailer: git-send-email 2.1.4 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: Marc Zyngier , Steve Capper , linux-arm-kernel@lists.infradead.org, "Suzuki K. Poulose" 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 When booting a kernel without 52-bit PA support (e.g. a kernel with 4k pages) on a system with 52-bit memory, the kernel will currently try to use the 52-bit memory and crash. Fix this by ignoring any memory higher than what the kernel supports. Fixes: f77d281713d4 ("arm64: enable 52-bit physical address support") Signed-off-by: Kristina Martsenko --- arch/arm64/mm/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 672094ed7e07..285745b2ca38 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -366,6 +366,9 @@ void __init arm64_memblock_init(void) /* Handle linux,usable-memory-range property */ fdt_enforce_memory_region(); + /* Remove memory above our supported physical address size */ + memblock_remove(1ULL << PHYS_MASK_SHIFT, ULLONG_MAX); + /* * Ensure that the linear region takes up exactly half of the kernel * virtual address space. This way, we can distinguish a linear address