Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1490708ybf; Thu, 27 Feb 2020 12:01:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwDIb/ghHvhtILMXLMkqiOt7QGXVR++ZAFr1ZaQgQ4pgMfubyrPocZ1yCkPM0KzaH3Wzdxl X-Received: by 2002:a05:6830:18e7:: with SMTP id d7mr476107otf.370.1582833698198; Thu, 27 Feb 2020 12:01:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582833698; cv=none; d=google.com; s=arc-20160816; b=LbKR4ut3wwV452vxseEdYIc74B/+gYlnNFMtOCW111xUVDPtEK6pBfiAzeg8wrcfnn 3cJtqcHLp6SNL8LPsb5vrFLH7j3ocaZcZWRK32d5pmKYWD1WeG0v6yll4XMzv9XQesAH 5UJiKgkfkCPAdEm/2uHxDzAQSOjoQhDfrjTelAa1ArGXumE+y7Q7fAuBWUCWVizVH1iG Dggf7JuExwkuOHT9v+RwsOZ5JknFpZrnJvjyeiN+BwnGMAbNJZEOQKRldglEqHoEzPKF f61OSsjVWr0TpOYoeWkjhstCLsskkZsBxwZo1f52yKqjAt03YpFvD24gH03Y6FFoleW8 2Dvg== 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=Z4KWmiqNVRxnEByLvvCd/G8SEN+IO5s9A6dC+iMy+FE=; b=rUO1jtXQZ0w4D1FIzneanQmJSZ97g/k4xXQyQtFYuNoZSKGAuzkmm4mLn7O8XE9Aox eciLRzJQkcqB8jKPY6r8rqJMfxP5ViWJrd9ldnwrKu1lDgCY8b0B/X6d8GVU9PaJaS1Z Bw3Wjz5bgDFFyOOUqQv3ERdRY6InmOaEhnzH1mHD6zLMv55I01/+QIPtgGnSspmPaQtK o2p5CtMf+rAwTu4elmMAiz8lxMsoKwYVYP4gxTqx40SW3gpz37cUqPHCvd1TGqPtYmo8 U4GJAQLbBWfjDB5FZrJu95tEW8A9XcRafAsV2U6csCFPStS59U6W1hyib+/yNRwR8mY9 i67Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Af4+Ycw0; 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 n18si151771otf.231.2020.02.27.12.01.26; Thu, 27 Feb 2020 12:01:38 -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=Af4+Ycw0; 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 S1730771AbgB0UBI (ORCPT + 99 others); Thu, 27 Feb 2020 15:01:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:56978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbgB0UBH (ORCPT ); Thu, 27 Feb 2020 15:01:07 -0500 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 85C102469C for ; Thu, 27 Feb 2020 20:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582833666; bh=i92tSJsBqBk3CzP62C3QM9Ge7+B8VLDLy8QK6K05kzY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Af4+Ycw0mp762ZvtUz3b1inyyPqDhnONpKiGtbRNgUnGODZiiRX+jKpuvneJqCMK2 yt0KHWD/L0+VcRVkZmE8NyS9VNtXCJ7+ABqNAkVHWpqpVBZlB5Tqz2KB4ffrbqgbkG Rei/ImwXN38VutUjRo2TSMXYrUSmbEnjBMpMScyM= Received: by mail-wr1-f44.google.com with SMTP id y17so306401wrn.6 for ; Thu, 27 Feb 2020 12:01:06 -0800 (PST) X-Gm-Message-State: APjAAAVaWo5WU4K90kJjHHUWn7VjbCMojR0X8eCZvG5TnH8k0rMxw7tG m7tLFvul6cD3KqrpK0B9ZBG+PE3PVr0PV3bDg4EmbA== X-Received: by 2002:adf:f84a:: with SMTP id d10mr551741wrq.208.1582833665009; Thu, 27 Feb 2020 12:01:05 -0800 (PST) MIME-Version: 1.0 References: <20200226011037.7179-1-atish.patra@wdc.com> <20200226011037.7179-4-atish.patra@wdc.com> <08322b0eeb26b564954a14273baf18db72e2f1e9.camel@wdc.com> In-Reply-To: <08322b0eeb26b564954a14273baf18db72e2f1e9.camel@wdc.com> From: Ard Biesheuvel Date: Thu, 27 Feb 2020 21:00:54 +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: "alexios.zavras@intel.com" , "tglx@linutronix.de" , "mchehab+samsung@kernel.org" , "pbonzini@redhat.com" , "michal.simek@xilinx.com" , "linux@armlinux.org.uk" , "abner.chang@hpe.com" , "linux-riscv@lists.infradead.org" , "catalin.marinas@arm.com" , "linux-kernel@vger.kernel.org" , "daniel.schaefer@hpe.com" , Anup Patel , "kstewart@linuxfoundation.org" , "palmer@dabbelt.com" , "aou@eecs.berkeley.edu" , "arnd@arndb.de" , "rppt@linux.ibm.com" , "linux-efi@vger.kernel.org" , "bp@suse.de" , "greentime.hu@sifive.com" , "keescook@chromium.org" , "agraf@csgraf.de" , "will@kernel.org" , "gregkh@linuxfoundation.org" , "mingo@kernel.org" , "allison@lohutok.net" , "paul.walmsley@sifive.com" , "linus.walleij@linaro.org" , "leif@nuviainc.com" , "akpm@linux-foundation.org" 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 Thu, 27 Feb 2020 at 20:58, Atish Patra wrote: > > On Wed, 2020-02-26 at 08:08 +0100, Ard Biesheuvel wrote: > > 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? > > > > because of CONFIG_EFI. With CONFIG_EFI enabled, all the run time > service memory mapping code is compiled for RISC-V. I could have > createa a separate config for only boot time services or used EFI_STUB > at places where CONFI_EFI. But it seems redundant as we will support > runtime services soon. Let me know if that's a wrong approach. > No that's fine > > > --- > > > 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 > > > > > -- > Regards, > Atish