From patchwork Wed Apr 22 17:24:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 206398 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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 97DE7C55185 for ; Wed, 22 Apr 2020 17:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 776DE2098B for ; Wed, 22 Apr 2020 17:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587576289; bh=yCfBU7DlgJ4PXCrD3E5XVImGIkPu+1+GrA1TORmOPlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vN9pL27ZwW6oFL2GN7B1KiCg/1l5oE+mt4TYsyjeFOlYhTyNw24qvqftKZFBn9Des 1lMcqpQTsIq7PQIh0MT2InK7sT2a+dIH+A2sGronjjmYHrgpW4Jn/yeZOKMaT8mWUK XJmjGPk9A1wUWml9iwvK50pN74tfYlavJH/fYcBo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgDVRYt (ORCPT ); Wed, 22 Apr 2020 13:24:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbgDVRYt (ORCPT ); Wed, 22 Apr 2020 13:24:49 -0400 Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F15A12082E; Wed, 22 Apr 2020 17:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587576288; bh=yCfBU7DlgJ4PXCrD3E5XVImGIkPu+1+GrA1TORmOPlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RY2VwPELZzk/Nmp+JHJfjh5ehp0MIfvolSmcFQPP53kDm5lilLt4EZNJ0Jl7cJEGC pYH6hTDuqXETI/BI9Kld3g9j6yWG58ZEQqDrjyI2XYJXCIKpK3V/q+rr7hJyI0Z7FA Lv9vB1ieOfb+D9PoUm1jLjUKLiXa+t81q9dIO2cE= From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Atish Patra , Palmer Dabbelt , Paul Walmsley , Albert Ou , linux-riscv@lists.infradead.org Subject: [PATCH v5 5/7] RISC-V: Define fixmap bindings for generic early ioremap support Date: Wed, 22 Apr 2020 19:24:12 +0200 Message-Id: <20200422172414.6662-6-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200422172414.6662-1-ardb@kernel.org> References: <20200422172414.6662-1-ardb@kernel.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Atish Patra UEFI uses early IO or memory mappings for runtime services before normal ioremap() is usable. This patch only adds minimum necessary fixmap bindings and headers for generic ioremap support to work. Signed-off-by: Atish Patra Acked-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20200421033336.9663-2-atish.patra@wdc.com Signed-off-by: Ard Biesheuvel --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/fixmap.h | 18 ++++++++++++++++++ arch/riscv/include/asm/io.h | 1 + 4 files changed, 21 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 62f7bfeb709e..f05dd09acd48 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -68,6 +68,7 @@ config RISCV select ARCH_HAS_GCOV_PROFILE_ALL select HAVE_COPY_THREAD_TLS select HAVE_ARCH_KASAN if MMU && 64BIT + select GENERIC_EARLY_IOREMAP config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild index 3d9410bb4de0..59dd7be55005 100644 --- a/arch/riscv/include/asm/Kbuild +++ b/arch/riscv/include/asm/Kbuild @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +generic-y += early_ioremap.h generic-y += extable.h generic-y += flat.h generic-y += kvm_para.h diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h index 2368d49eb4ef..ba5096d65fb0 100644 --- a/arch/riscv/include/asm/fixmap.h +++ b/arch/riscv/include/asm/fixmap.h @@ -30,6 +30,24 @@ enum fixed_addresses { FIX_TEXT_POKE1, FIX_TEXT_POKE0, FIX_EARLYCON_MEM_BASE, + /* + * Make sure that it is 2MB aligned. + */ +#define NR_FIX_SZ_2M (SZ_2M / PAGE_SIZE) + FIX_THOLE = NR_FIX_SZ_2M - FIX_PMD - 1, + + __end_of_permanent_fixed_addresses, + /* + * Temporary boot-time mappings, used by early_ioremap(), + * before ioremap() is functional. + */ +#define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE) +#define FIX_BTMAPS_SLOTS 7 +#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) + + FIX_BTMAP_END = __end_of_permanent_fixed_addresses, + FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, + __end_of_fixed_addresses }; diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h index 0f477206a4ed..047f414b6948 100644 --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -14,6 +14,7 @@ #include #include #include +#include /* * MMIO access functions are separated out to break dependency cycles