Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp229663pxx; Wed, 28 Oct 2020 03:29:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwat1ESsuBY98HI535F9r8btClKa4tEoGCDe+Tk61kuPCRpAgRLgB3eE+UJfynC31yZiJkn X-Received: by 2002:a17:906:11d6:: with SMTP id o22mr7028974eja.171.1603880998522; Wed, 28 Oct 2020 03:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603880998; cv=none; d=google.com; s=arc-20160816; b=PmGowZauNpuAZIUNPagz9EcHRSSepzcAvbJwmwzbcHqX7NlblRGidYTJRAmx+9hTcv RjMJnKZjsgzZbj04UxZOUUl8LPxdiPXL7hah9vePvjfWGEbge1+vrRqdvKwr8LVEnwkJ cNVksV1IOOulXS1IlqDk2vNPqi5slVLjxom3kmdSZQ5wxyYNtN/fFOBBDF1NgBzM02Bv YUqRonOyOsDtaFCSpR/l1ayXK3aOzHqciuTuxzOce1p+Wd3VLE6FV9NargCyqs8iz0IJ MXgrrYbNUt+RRZF2VkNrjA1xLMRK0JgGXjptf95m3JvHDWkLuA4ptogTd0orNkbZxeIX Y6Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gf+coWOEwqr+b68Vncv4vkLbtyrrPXYrGIQTQbzDi6M=; b=dVMMImirQ2tRKmMkXDpZS+r+0cYgEKn58q/+7SOj7eQfFSMx+Vo3GSxzx/S4rcRa6V z1vmfoKNWzDaC0GcyM5poZk442J2+veiGnUcSMseQwnAjv1wEMy9ozgI4MAqqjC6eLhw vrJN1SAKRxkSTvfMoIytJMre7BqYTHoSMZy2bWE7cc3l4AUI7dqqm8WI93glB1WGJ/3M nws2ufr4y0PhfjsXnX6+4pACN5X+/ezByC7N6g8pP0w9nk54xoYBnxkNDP4BbB97Ysmz H46w+wc9cRUxQhfB394ZzVuXK5KPxZ2hIgGtAJhSVNBbl2xrlIqHGZfwRd8gB8deOmEw s65g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zEXaTHX9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lg14si2653130ejb.82.2020.10.28.03.29.36; Wed, 28 Oct 2020 03:29:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zEXaTHX9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762262AbgJ0Olk (ORCPT + 99 others); Tue, 27 Oct 2020 10:41:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:39170 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761466AbgJ0Ojz (ORCPT ); Tue, 27 Oct 2020 10:39:55 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E25D2206B2; Tue, 27 Oct 2020 14:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809594; bh=1BcVye8HRxyDPFVEqpme3Hjykoavb1YY5uMUVusMe8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEXaTHX9R2SujslLq0fkYzZmc9/QtYYQT82u/DbFNuQzL/bTCg+Wg7SRrIg2FiOxW IAjbdefD8zRn0uvLS/hZcxYA7SToEIwf40Lwf3mhZ7bsdo7o8CP2uQx05COPRtdLx3 x7jVAZxWU64OXQtMFecCgSox3dGOA7+UP/aijg/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Berkenpas , "Aneesh Kumar K.V" , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 222/408] powerpc/book3s64/hash/4k: Support large linear mapping range with 4K Date: Tue, 27 Oct 2020 14:52:40 +0100 Message-Id: <20201027135505.379479621@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aneesh Kumar K.V [ Upstream commit 7746406baa3bc9e23fdd7b7da2f04d86e25ab837 ] With commit: 0034d395f89d ("powerpc/mm/hash64: Map all the kernel regions in the same 0xc range"), we now split the 64TB address range into 4 contexts each of 16TB. That implies we can do only 16TB linear mapping. On some systems, eg. Power9, memory attached to nodes > 0 will appear above 16TB in the linear mapping. This resulted in kernel crash when we boot such systems in hash translation mode with 4K PAGE_SIZE. This patch updates the kernel mapping such that we now start supporting upto 61TB of memory with 4K. The kernel mapping now looks like below 4K PAGE_SIZE and hash translation. vmalloc start = 0xc0003d0000000000 IO start = 0xc0003e0000000000 vmemmap start = 0xc0003f0000000000 Our MAX_PHYSMEM_BITS for 4K is still 64TB even though we can only map 61TB. We prevent bolt mapping anything outside 61TB range by checking against H_VMALLOC_START. Fixes: 0034d395f89d ("powerpc/mm/hash64: Map all the kernel regions in the same 0xc range") Reported-by: Cameron Berkenpas Signed-off-by: Aneesh Kumar K.V Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20200608070904.387440-3-aneesh.kumar@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/book3s/64/hash-4k.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h index 3f9ae3585ab98..80c9534148821 100644 --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h @@ -13,20 +13,19 @@ */ #define MAX_EA_BITS_PER_CONTEXT 46 -#define REGION_SHIFT (MAX_EA_BITS_PER_CONTEXT - 2) /* - * Our page table limit us to 64TB. Hence for the kernel mapping, - * each MAP area is limited to 16 TB. - * The four map areas are: linear mapping, vmap, IO and vmemmap + * Our page table limit us to 64TB. For 64TB physical memory, we only need 64GB + * of vmemmap space. To better support sparse memory layout, we use 61TB + * linear map range, 1TB of vmalloc, 1TB of I/O and 1TB of vmememmap. */ +#define REGION_SHIFT (40) #define H_KERN_MAP_SIZE (ASM_CONST(1) << REGION_SHIFT) /* - * Define the address range of the kernel non-linear virtual area - * 16TB + * Define the address range of the kernel non-linear virtual area (61TB) */ -#define H_KERN_VIRT_START ASM_CONST(0xc000100000000000) +#define H_KERN_VIRT_START ASM_CONST(0xc0003d0000000000) #ifndef __ASSEMBLY__ #define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE) -- 2.25.1