Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4576647ybv; Tue, 25 Feb 2020 23:09:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyJvG1ljmUjRox/hgb6kgvoQURVefKvK/729VbjV926d1ogqS3dk8+/KLgG7yZvAEozVs1F X-Received: by 2002:aca:6749:: with SMTP id b9mr1891472oiy.13.1582700992468; Tue, 25 Feb 2020 23:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582700992; cv=none; d=google.com; s=arc-20160816; b=fKGC5TEDtW6/YamVc4uZGTZhv04GkjoiAv35GCJGURg3AFe5iapJ3R3cwJb7DzpsQW o9OJ5v1LFZ601S7cQ/bUrN9U+JC0L3H7IQCBS42etFAsXJ49FUoFdNWxF4mpmfHNHlMA tEk2RHvlgSKP2Jr/25OEoAZMWH6V7TtaIbFpedGxLCZK9QJRsZuUeSVMepfv7dVIAnNv sQAVbEMb/WBvLM+QEkgf/fIj2xv0pmiKrDVxW0DmwnWqNyHV62+ZCq4hQzckJdarULyK +K1fIyf3dOPH0cTY6yAWlA5rQJX1ApOBhiGzAt+lyv6zEWrPsFgDsgyRiEsvDV8pXICe KbFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bFY18KMGRElgr/hdP4Y9wzX+1S5s4NU+3wRIGSgae9U=; b=XMT2dg1HME/9cDxgcbQ8Fo2SOUCPy2+secjMo51n9lSPZzl5KXiZ+qGwPb8FzQUQr3 7KE+CgE3/owJvKBHtFecnHTJrLYoOVsXdKd8TUJaieiD5N4PkwtKZJpoSQ0QObtYdZ1H VJWYgcxX4rwBpU70SstFR0ZmI8HmjpfwbI+kKWxpqpHeNfLb8FYsx7zYtOmCFEZ7xZHC 8n2ADOK8gzlxU4w0sL6NSj6I+Cw6A0YHS3JA/Q1YeOglehMnyVMZKPJ2AVnQGvmmMRlc cmsTpXydycjXqXOQlaIpYhMTfvJ/2g7mqhiIj/N01manJFO9lzA5hqBBAgrNUz/XKCmA cDaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aLXV00WG; 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 c14si757488otn.118.2020.02.25.23.09.39; Tue, 25 Feb 2020 23:09:52 -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=aLXV00WG; 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 S1727105AbgBZHJE (ORCPT + 99 others); Wed, 26 Feb 2020 02:09:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:42490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbgBZHJD (ORCPT ); Wed, 26 Feb 2020 02:09:03 -0500 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 CBC32222C2 for ; Wed, 26 Feb 2020 07:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582700943; bh=BdvukjoB3WBnGxQuMkXsAyznS/yxxSlgLx6C/Lh+O5s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aLXV00WGNbPLHXgt1q6/H3/GVzQFXdwh6tHYzbPOgypdiAlt3vP/fGyZQrHx8mSxE /Xrq/zq1RkklN4cocFA1Hae36qAzR3g6ChMWulwQWOy2JQcTCIidyU6lZztqBrS3os 1MvQ7Rex4Tm3nmfMV9H1IR8j8w0hYofJf/Tvxxpg= Received: by mail-wm1-f41.google.com with SMTP id a9so1775669wmj.3 for ; Tue, 25 Feb 2020 23:09:02 -0800 (PST) X-Gm-Message-State: APjAAAVO+7VxIbthB5BWBCWMFfRZXCCl5IWkY8vdJAUW3Z/PClIQ//xI Pqrykx4jOpMj72bvJ/+mlTauvY+B+bQC325W9JkPCw== X-Received: by 2002:a7b:cb93:: with SMTP id m19mr72538wmi.133.1582700941221; Tue, 25 Feb 2020 23:09:01 -0800 (PST) MIME-Version: 1.0 References: <20200226011037.7179-1-atish.patra@wdc.com> <20200226011037.7179-4-atish.patra@wdc.com> In-Reply-To: <20200226011037.7179-4-atish.patra@wdc.com> From: Ard Biesheuvel Date: Wed, 26 Feb 2020 08:08:50 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 3/5] RISC-V: Define fixmap bindings for generic early ioremap support To: Atish Patra Cc: Linux Kernel Mailing List , Albert Ou , Alexios Zavras , Allison Randal , Andrew Morton , Anup Patel , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Greentime Hu , Greg Kroah-Hartman , Ingo Molnar , Kate Stewart , Kees Cook , Linus Walleij , linux-efi , linux-riscv@lists.infradead.org, Mao Han , Mauro Carvalho Chehab , Michal Simek , Mike Rapoport , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Russell King , Thomas Gleixner , Will Deacon , Alexander Graf , "leif@nuviainc.com" , "Chang, Abner (HPS SW/FW Technologist)" , "Schaefer, Daniel (DualStudy)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Feb 2020 at 02:10, Atish Patra wrote: > > 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 Looks reasonable to me, Acked-by: Ard Biesheuvel although I wonder why it is part of this series? > --- > arch/riscv/Kconfig | 1 + > arch/riscv/include/asm/Kbuild | 1 + > arch/riscv/include/asm/fixmap.h | 21 ++++++++++++++++++++- > arch/riscv/include/asm/io.h | 1 + > 4 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index 27bfc7947e44..42c122170cfd 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -65,6 +65,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 ec0ca8c6ab64..517394390106 100644 > --- a/arch/riscv/include/asm/Kbuild > +++ b/arch/riscv/include/asm/Kbuild > @@ -4,6 +4,7 @@ generic-y += checksum.h > generic-y += compat.h > generic-y += device.h > generic-y += div64.h > +generic-y += early_ioremap.h > generic-y += extable.h > generic-y += flat.h > generic-y += dma.h > diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h > index 42d2c42f3cc9..7a4beb7e29a3 100644 > --- a/arch/riscv/include/asm/fixmap.h > +++ b/arch/riscv/include/asm/fixmap.h > @@ -25,9 +25,28 @@ enum fixed_addresses { > #define FIX_FDT_SIZE SZ_1M > FIX_FDT_END, > FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1, > + FIX_EARLYCON_MEM_BASE, > + > FIX_PTE, > FIX_PMD, > - 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 > -- > 2.24.0 >