From patchwork Sat Mar 27 19:48:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Wool X-Patchwork-Id: 12168625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C92AEC433C1 for ; Sat, 27 Mar 2021 19:49:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 480DB61981 for ; Sat, 27 Mar 2021 19:49:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 480DB61981 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A46F46B0072; Sat, 27 Mar 2021 15:49:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F5D26B0073; Sat, 27 Mar 2021 15:49:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 895ED6B0074; Sat, 27 Mar 2021 15:49:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 695056B0072 for ; Sat, 27 Mar 2021 15:49:44 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 238E51802E63A for ; Sat, 27 Mar 2021 19:49:44 +0000 (UTC) X-FDA: 77966694288.32.2D0FA2F Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by imf02.hostedemail.com (Postfix) with ESMTP id 8F94640002C5 for ; Sat, 27 Mar 2021 19:49:38 +0000 (UTC) Received: by mail-wr1-f51.google.com with SMTP id o16so8923964wrn.0 for ; Sat, 27 Mar 2021 12:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H97BsKqR23hJqrIfD56EXndKt8w/9T/UAs7wjOz5pxo=; b=pcwSshlSPC6XkTRT6YGjiWxwTF5UXe6Au8j4KZp3+sAvhcqqcKNT/qzsjl4w8DwYqO 09EERJr4ohxE6coa3FfH2LDA+fbXA20/kY4F0Zho2kXXsMnWnrjunvO1iFaLeLofPtPB P9/Hz1ZNN9hWoyPy6ctQEey1LjTMnioDHzCr8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H97BsKqR23hJqrIfD56EXndKt8w/9T/UAs7wjOz5pxo=; b=tH0cpwJjQcC5bL4Fr+BwMOLCXgPPQxVBn6srHwCuEb6xiNCgRgWnenpoG2BKMqCOb0 fz10WxK6lqY5eqOJoXQYBIgxj/W1RF53EFjTP1NzebY1bIXg6wD7mcEixTeVDWRMSNO4 GD47NQgfO7lg+VcOB+YYqd/dqYvR+P5hhymlVmUGxV8HzX2/HKE3vHBjfvuh5vnb8OBf 2akTB/wm3whpDLiEDBkyp8j5LTHYP3WKEdWT9andPt2kNIvhND4sQU0n77B0Bjcma8gf j4g2iOq6sIDEU24bmDIooOoluDKKhNov2m7t4j4ndu5EFqrnAKF+XixvL0nLeDaJzaXa nXyw== X-Gm-Message-State: AOAM531+QGHPer91+5q9xwNcgHwTw/jiINBptjwcK3bmjhn39cF4ZXOo wZCwbh6/PN4ORWhXlJ4dvGUKfg== X-Google-Smtp-Source: ABdhPJweHQ6okCQBrxq52NokylJeoCMpMHHUl8ucAl8Olj3qSRGGFdvGNgGsOtm5QERq3r9t1959hw== X-Received: by 2002:adf:ee0a:: with SMTP id y10mr19809748wrn.177.1616874582438; Sat, 27 Mar 2021 12:49:42 -0700 (PDT) Received: from lootbox.konsulko.bg (lan.nucleusys.com. [92.247.61.126]) by smtp.gmail.com with ESMTPSA id s83sm18410151wms.16.2021.03.27.12.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Mar 2021 12:49:42 -0700 (PDT) From: Vitaly Wool To: linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Palmer Dabbelt , Vitaly Wool , kernel test robot Subject: [PATCH] riscv: XIP: fix build for rv32 Date: Sat, 27 Mar 2021 21:48:01 +0200 Message-Id: <20210327194800.23622-1-vitaly.wool@konsulko.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8F94640002C5 X-Stat-Signature: 9y8o55yi457qqwi6hxd6dpuozdnau8e8 Received-SPF: none (konsulko.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=mail-wr1-f51.google.com; client-ip=209.85.221.51 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616874578-704219 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 32-bit RISC-V uses folded page tables by default, so we should follow that in the XIP-specific part of init too. Signed-off-by: Vitaly Wool Reported-by: kernel test robot --- arch/riscv/mm/init.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index fe583c2aa5a2..8c0eeaae67a3 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -481,6 +481,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) #endif #ifdef CONFIG_XIP_KERNEL +#ifndef __PAGETABLE_PMD_FOLDED create_pgd_mapping(trampoline_pg_dir, XIP_VIRT_ADDR_START, (uintptr_t)xip_pmd, PGDIR_SIZE, PAGE_TABLE); for (va = XIP_VIRT_ADDR_START; @@ -493,7 +494,16 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) create_pgd_mapping(early_pg_dir, XIP_VIRT_ADDR_START, (uintptr_t)xip_pmd, PGDIR_SIZE, PAGE_TABLE); -#endif +#else + for (va = XIP_VIRT_ADDR_START; + va < XIP_VIRT_ADDR_START + xiprom_sz; + va += map_size) { + create_pgd_mapping(early_pg_dir, va, + xiprom + (va - XIP_VIRT_ADDR_START), + map_size, PAGE_KERNEL_EXEC); + } +#endif /* __PAGETABLE_PMD_FOLDED */ +#endif /* CONFIG_XIP_KERNEL */ /* * Setup early PGD covering entire kernel which will allows