Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3443554ybc; Thu, 21 Nov 2019 08:24:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyxhpc3mnxhh60vzUdcyxudXC6gMa4DueHlIp6uUvs3LE5CMjl20UBmKwoEk8hivIp8qp58 X-Received: by 2002:a5d:4ec2:: with SMTP id s2mr11429094wrv.291.1574353462238; Thu, 21 Nov 2019 08:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574353462; cv=none; d=google.com; s=arc-20160816; b=UHNcybDn1aUzEIlsW6E8hJns9bFs+HhG72IJlZPt5NpM5h0plgImk2Y80uGtXY4ZtZ r9irWplwxtPUYBfRKeS7y5EAAuEiyEZ5UMU8uLoTFJLRtINhKHvzmf2lAIWjaDdBILf+ hPtmsifwC8AKju78epdo6w+j002kZbqS+ANgXpgzQk8aHG6gntklMc0HrhjEnrbsw7VO fsFCzvL3VWjrFlh04qLmNPpM92rAVlJu/P3eOdHRv8FXaFZ3iMM7OFLldpqUuij5NG57 gemjd8E3T46yYXiQiNUOcDvMBXUf1nFKuMX8kLogzpZ+nVN57nV2tm/CdhI2NDA6S0QQ wb9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EGXklbS0WtbWpqvJ/qD5iBdWOQDn+/B3PNr6iNfy6Jo=; b=PV5oHxYEoyVnQuqHnnP9vZKMA6S7h/quvVFcGLjzylJGF31QYKpG48oBcFNXkbTuR1 EMLT3S4dWc28wp3WvqLhB3FGF7rmssBiTcSdjoSkA633Y8nx3PtfgpimIv5VwJBBk1gd MMt9MiQZJ+TdwFw2/15pF3KE/zrNmDDK/kJcVSwOawc1tga343KBlGxrYGzzfiusvWaw UCKHznLHw5d8VeZ2Q6QF3Ish9bDM8wrI2TC0wWxxqUzVrULLReH3ENV81DvKVhlXT3JA EHtkAFAwZPjQUYjw6P+ycJPvPuadU5lEY5B0g9uw4w7CPgRX696Ptwcf7Zy4xqyf6eZ+ Ozyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pXHrARQD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si2871249eda.167.2019.11.21.08.23.56; Thu, 21 Nov 2019 08:24:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pXHrARQD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727182AbfKUQVo (ORCPT + 99 others); Thu, 21 Nov 2019 11:21:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:35458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbfKUQVn (ORCPT ); Thu, 21 Nov 2019 11:21:43 -0500 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FBF3206CC; Thu, 21 Nov 2019 16:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574353302; bh=RnEFBHDdwEGFihJ8AzIy/xCeEYZct7GFoZ5Z9u+a4aI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXHrARQDRu46esN1ekKRe4ytslAfURJlMOQ/+BshoqNvXxnAGzBc/D1wphvjRXmHR nbL3K/rjOf9ydRBjxnnfw1jb6kbzWeSNZ3sz02AgER46nW5udYYtRyLgQdXY1y121D WPxpstnDFphwMctEVNsP5nMLkLvV4j1/0v3FYZcc= From: Mike Rapoport To: Ralf Baechle , Paul Burton , James Hogan Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Mike Rapoport Subject: [PATCH 1/3] mips: fix build when "48 bits virtual memory" is enabled Date: Thu, 21 Nov 2019 18:21:31 +0200 Message-Id: <20191121162133.15833-2-rppt@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191121162133.15833-1-rppt@kernel.org> References: <20191121162133.15833-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport With CONFIG_MIPS_VA_BITS_48=y the build fails miserably: CC arch/mips/kernel/asm-offsets.s In file included from arch/mips/include/asm/pgtable.h:644, from include/linux/mm.h:99, from arch/mips/kernel/asm-offsets.c:15: include/asm-generic/pgtable.h:16:2: error: #error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED #error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED ^~~~~ include/asm-generic/pgtable.h:390:28: error: unknown type name 'p4d_t'; did you mean 'pmd_t'? static inline int p4d_same(p4d_t p4d_a, p4d_t p4d_b) ^~~~~ pmd_t [ ... more such errors ... ] scripts/Makefile.build:99: recipe for target 'arch/mips/kernel/asm-offsets.s' failed make[2]: *** [arch/mips/kernel/asm-offsets.s] Error 1 This happens because when CONFIG_MIPS_VA_BITS_48 enables 4th level of the page tables, but neither pgtable-nop4d.h nor 5level-fixup.h are included to cope with the 5th level. Replace #ifdef conditions around includes of the pgtable-nop{m,u}d.h with explicit CONFIG_PGTABLE_LEVELS and add include of 5level-fixup.h for the case when CONFIG_PGTABLE_LEVELS==4 Signed-off-by: Mike Rapoport --- arch/mips/include/asm/pgtable-64.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 93a9dce31f25..813dfe5f45a5 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -18,10 +18,12 @@ #include #define __ARCH_USE_5LEVEL_HACK -#if defined(CONFIG_PAGE_SIZE_64KB) && !defined(CONFIG_MIPS_VA_BITS_48) +#if CONFIG_PGTABLE_LEVELS == 2 #include -#elif !(defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_MIPS_VA_BITS_48)) +#elif CONFIG_PGTABLE_LEVELS == 3 #include +#else +#include #endif /* @@ -216,6 +218,9 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd) return pgd_val(pgd); } +#define pgd_phys(pgd) virt_to_phys((void *)pgd_val(pgd)) +#define pgd_page(pgd) (pfn_to_page(pgd_phys(pgd) >> PAGE_SHIFT)) + static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) { return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address); -- 2.24.0