Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp457985ybz; Tue, 21 Apr 2020 12:22:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8RmFVuUJKHGGwBOB5KQSO5htS2WFo04xwTg7nULq7mmK84uedMSuAdnYg3a+qI8L3EfZL X-Received: by 2002:a05:6402:711:: with SMTP id w17mr13058567edx.228.1587496952683; Tue, 21 Apr 2020 12:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587496952; cv=none; d=google.com; s=arc-20160816; b=iVcdD+LiadGtP40DWmhu6nX3HVxjNcJ7j9Lg0PHJRbIuHexExEtpC9/0FcjZ8HgZpr ZiCOHn1sIm8Haw768z/zbDQ2tyxCQb0JfOjA1ri7bWJZQ8E3lHFGgtWzBTooyJwh9D7z FWKGNGGy3njAqfPxzYAg9C/CfSyDZjkP57nwnJ/FpvMrsy+onzu9N5nin1dUqRSSR9Ua AYoy+N45EAa0ABiV5fJ8m7ddxyujp5ZCjwB3V5MrX70K1zCE6dttALmb9IDrs2IkrCP5 tNI3dyet2EHvXJ8vjzsXIyeBXM9ExWEsLtTwrzys56V4KS+hZO+nKnEHfd6htC394bmj azmA== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=hPVhiHCru66F7M87+182p9Tvtpc85gfkzQRDqIRO1ko=; b=UCIygjzF5PKHDIeIg/NIjEW3Ar4ztif+nrR5sJXfScCkiaN0oZxK6eqwjttfDjfYa+ gsZ9J9NHXx3yIOI7ey6Y1GZXS6RxqxDT/rkoEgyiAqv41Cedlk5VxjywuzXvGIJAaO02 HM9ML1pQ84MO7GbjR8D7riWvcDbKX9OO3awpFH1H80vofSEIesYD5d40j6hQM4EEOQdQ i9N/dFyCDikgN3MIlrsNSeSsh3IuAaof+uc4+144uybGaOr618zqul8pXVng7FmtkIUV cSLNmpDlELoLT8j1YzH3JUUdbeZS9LFJIgzk53ptUbnNTHnTVxZETVxo4bbyu9mCWtVU X3bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=r3C7ZPWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si1942621edy.347.2020.04.21.12.22.09; Tue, 21 Apr 2020 12:22:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=r3C7ZPWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726565AbgDUTTl (ORCPT + 99 others); Tue, 21 Apr 2020 15:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726551AbgDUTTk (ORCPT ); Tue, 21 Apr 2020 15:19:40 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E1D7C0610D6 for ; Tue, 21 Apr 2020 12:19:40 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id w3so5630054plz.5 for ; Tue, 21 Apr 2020 12:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=hPVhiHCru66F7M87+182p9Tvtpc85gfkzQRDqIRO1ko=; b=r3C7ZPWnB+/BSMYac/cFV6GVQaCwnWAzI9frvjDJLQJR9jPwOhTonM3kEUjmpl4L+j a3b25Q+Me2vR+TR33Cc9mp0t9k9AFV03JP9k6k2XYvuWbYyCHCZOWQGB3RYjMjGPpdsp pr/Br9+xNw0bAaHb5zRMaYp0pSBSk3qkO7dyjVI54G40sbnt7iz3w1dHKBtMKl8Pqn0k 0rkFqLQ3FwTIn86ZUeObV+i+tZgjpGexmA5F+2PaDHBsF126dAzWbuh2xb6KYqkJKrGl NVkZWpY0UrIl5iMLGM7D1P8IU6mGulUTyns47YhRZWP2kGD/vnVFoDzu9sXDhTS0X4vQ W2Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=hPVhiHCru66F7M87+182p9Tvtpc85gfkzQRDqIRO1ko=; b=Jqgk5dsFRxAZEQ8m9kdQXjXjpzdB2HLFrYXuUdnSwOpi3Gzmom5MJ6nl6yFvPhuR/G JGfQzl0uNxtA+sYsnx/WnnpXcirGO07NlyQPeNL4FOJcEhAMLDtUafm8pBDzHnRrf1sa 9jksb3wJcuOWBpUw/KbGo2Ae2z6T6OMq3JRkVIR46F+g/pPxBwFPoABIGjLkuYItXmxv NafLX7WGBNdNn6BXHoCcJMgyn7WFS5togsITOxhrAMuv7lY6zG1JHdJqL+NKOYclTTPC zTMoP9YvCtfecyNdmb5Jh9UVwvatoIfeEjWm841/eK/NZb+3dyK40oIFAMJNlODYYvh+ JpHA== X-Gm-Message-State: AGi0PuYT8I/Ut31yz7xIjLNOX3RoO3qVPzusJfFP60vyHbhJpGHIOyfz vfLrgYd61KUup7wcwQEZjrxo/1/N6zKENg== X-Received: by 2002:a17:902:aa94:: with SMTP id d20mr22883245plr.313.1587496779466; Tue, 21 Apr 2020 12:19:39 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id b11sm2934507pgj.92.2020.04.21.12.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 12:19:38 -0700 (PDT) Date: Tue, 21 Apr 2020 12:19:38 -0700 (PDT) X-Google-Original-Date: Tue, 21 Apr 2020 12:19:13 PDT (-0700) Subject: Re: [v2 PATCH 3/5] RISC-V: Define fixmap bindings for generic early ioremap support In-Reply-To: <20200413212907.29244-4-atish.patra@wdc.com> CC: linux-kernel@vger.kernel.org, Atish Patra , ardb@kernel.org, Arnd Bergmann , catalin.marinas@arm.com, Greg KH , mingo@kernel.org, linux-efi@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, masahiroy@kernel.org, linux@armlinux.org.uk, will@kernel.org From: Palmer Dabbelt To: Atish Patra Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Apr 2020 14:29:05 PDT (-0700), 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 > Acked-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 a197258595ef..f39e326a7a42 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 Reviewed-by: Palmer Dabbelt