From patchwork Thu Jun 25 23:45:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 11627163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A21E92A for ; Fri, 26 Jun 2020 10:54:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01C6D206DD for ; Fri, 26 Jun 2020 10:54:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uoavPJdR"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="d0yaUiyV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01C6D206DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=zfVVuOFcTskvcp9jMeZAswimROPoRTszbQEkZ2b/jFU=; b=uoavPJdRk2cbDglQh9nI812x1P s/P7zn5uXlP61ipuYi1KQH+T3UWEPqkbx+5gQw1huSFl/+RbiPtcWSVM7JqcMks9grnONev0v15cn Xs58wemj4QsAppZCS4LyWUgeM/DUX9DxrrKOTGBdLU3LdlvrboGp+7SMdMffGAFymnEYtFgFxsKlQ Zj/C4CkXwlwDVXi1Vufe+bPnQvVdlJWwR4fVnBCVtgOqy9aTX9fW5UUJmdhZA3BwIIh1+IzVvftiv fvZ59CMaxtN/P4Wnr/vOOmJDZIKfanLX+aTQFnbXvSQSyoT47yK5inphiuhl8XKXHIWPGUkH1QY0g iBAP2ZSA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jolxu-0006MJ-M7; Fri, 26 Jun 2020 10:52:14 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jojkd-0002Se-E4; Fri, 26 Jun 2020 08:30:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1593160265; x=1624696265; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Actmweta7JvIwPn5FyNaOGyF4xBrvFSmD2/FxpPF7ts=; b=d0yaUiyVx106YIKkAaIVnpy3j2lbuXweiQ+rHZGeOyHW7+wl7ycc9ywd 35+xDuoWpVimWqpyem8yYnD/6Q+L9t99IK1BmDPGO2Saev2P6zFUvmOTb VyogezJ7QDCgTJA11p4pXbshuqzxQntGZu2MbQuFpEG9qV1JX6MJ9mae/ KpQrK47KYOleR2tAYwnAU0psASO46Jt3E7KfO3cbcSBF/Y5YHN3UVmzyt UVXYF8U+oMirY/An5pVurVsMx4Vuw1xHMKcZ27cfDDwtavC6WJB19Vt5h /KEX1dwNO5aNJ0oGhpOYZxEt/9+9z1hFFeRnDtG1T3xWhoXPNzi0FrLNm g==; IronPort-SDR: N9VAyhvUegOeDXJv3Gnv5tKdMXQTppy/GSOTioT/KJCduhpNP6+4t5DTbDelGx6y7bZGj8hURx oaRT32UqttYPdIARY+5dFlTmk4Lj33zGL2iAiEe8/ZkyvPUV7B1X1INXG652nOXa2wU+pTFNKD CslZjxSN6R+j78IW0gPnXGNFRZ43mwcdzLG+lHdQUVUvw7gD5i1Wsn/X3VlC8IxaUWtb8gmQPZ W3gUJ/Jvp+EBbUW39UZyeJKiBtZKZ37qjYFHBqLVukXR7bM/NciAXRHLju2Qv82//gZk75acz3 aFY= X-IronPort-AV: E=Sophos;i="5.75,280,1589212800"; d="scan'208";a="243966110" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jun 2020 07:45:54 +0800 IronPort-SDR: k4cEHXcNdLshOfBpj3E8qCmjaJPv2AcCZ+TeZjDAxjFrsH9n+9D7T3M5jfh8ZxiSGItYIZuIC0 r8IrgVCCUsANPpeaVcLvBRN77t4cbSz3w= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2020 16:34:23 -0700 IronPort-SDR: FXpnazvcnQ8cmE9w2UPNHENcSiBq+pwdMl3n1nIRzHJWRPIAQ/SqZrnrr12Upi1JF6ROlOt85K Cly+SYaDK0nw== WDCIronportException: Internal Received: from 2349pbt5e4f.ad.shared (HELO jedi-01.hgst.com) ([10.86.58.78]) by uls-op-cesaip01.wdc.com with ESMTP; 25 Jun 2020 16:45:23 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Subject: [RFC PATCH 00/11] Add UEFI support for RISC-V Date: Thu, 25 Jun 2020 16:45:05 -0700 Message-Id: <20200625234516.31406-1-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-efi@vger.kernel.org, Heinrich Schuchardt , Masahiro Yamada , Atish Patra , Palmer Dabbelt , linux-riscv@lists.infradead.org, Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This series adds UEFI support for RISC-V. Linux kernel: 5.8-rc2 U-Boot: master OpenSBI: master Patch 1-6 are preparatory patches that fixes some of the geric efi and riscv issues. Patch 7-9 adds the efi stub support for RISC-V which was reviewed few months back. http://lists.infradead.org/pipermail/linux-riscv/2020-April/009586.html Patch 10 just renames arm-init code so that it can be used across different architectures. Patch 11 adds the runtime services for RISC-V. The patches can also be found in following git repo. https://github.com/atishp04/linux/tree/uefi_riscv_5.9_v1 The patches have been verified on Qemu using bootefi command in U-Boot for both RV32 and RV64. For RV32, maximum allocated memory should be 1G as RISC-V kernel can not map beyond 1G of physical memory for RV32. EDK2 can boot quite far into Linux with current series. Currently, we are seeing some traps from drivers (spi/network). At first glance, they don't seem to be caused by efi. I thought it is better to get some early feedback on the series while EDK2 issue is being debugged. That's why uefi runtime services are not actually well tested in RISC-V. Any suggestions to test the efi run time services are appreciated. Changes from previous version: 1. Added full ioremap support. 2. Added efi runtime services support. 3. Fixes mm issues Anup Patel (1): RISC-V: Move DT mapping outof fixmap Atish Patra (10): efi: Fix gcc error around __umoddi3 for 32 bit builds RISC-V: Setup exception vector early RISC-V: Add early ioremap support RISC-V: Set maximum number of mapped pages correctly riscv: Parse all memory blocks to remove unusable memory include: pe.h: Add RISC-V related PE definition RISC-V: Add PE/COFF header for EFI stub RISC-V: Add EFI stub support. efi: Rename arm-init to efi-init common for all arch RISC-V: Add EFI runtime services arch/riscv/Kconfig | 25 ++++ arch/riscv/Makefile | 1 + arch/riscv/configs/defconfig | 1 + arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/efi.h | 56 +++++++ arch/riscv/include/asm/fixmap.h | 16 +- arch/riscv/include/asm/io.h | 1 + arch/riscv/include/asm/mmu.h | 2 + arch/riscv/include/asm/pgalloc.h | 12 ++ arch/riscv/include/asm/pgtable.h | 4 + arch/riscv/include/asm/sections.h | 13 ++ arch/riscv/kernel/Makefile | 5 + arch/riscv/kernel/efi-header.S | 104 +++++++++++++ arch/riscv/kernel/efi.c | 106 +++++++++++++ arch/riscv/kernel/head.S | 27 +++- arch/riscv/kernel/head.h | 2 - arch/riscv/kernel/image-vars.h | 51 +++++++ arch/riscv/kernel/setup.c | 16 +- arch/riscv/kernel/smpboot.c | 1 - arch/riscv/kernel/traps.c | 8 +- arch/riscv/kernel/vmlinux.lds.S | 22 ++- arch/riscv/mm/init.c | 104 ++++++++----- drivers/firmware/efi/Kconfig | 3 +- drivers/firmware/efi/Makefile | 4 +- .../firmware/efi/{arm-init.c => efi-init.c} | 0 drivers/firmware/efi/libstub/Makefile | 10 ++ drivers/firmware/efi/libstub/alignedmem.c | 2 +- drivers/firmware/efi/libstub/efi-stub.c | 11 +- drivers/firmware/efi/libstub/riscv-stub.c | 110 ++++++++++++++ drivers/firmware/efi/riscv-runtime.c | 141 ++++++++++++++++++ include/linux/pe.h | 3 + 31 files changed, 796 insertions(+), 66 deletions(-) create mode 100644 arch/riscv/include/asm/efi.h create mode 100644 arch/riscv/include/asm/sections.h create mode 100644 arch/riscv/kernel/efi-header.S create mode 100644 arch/riscv/kernel/efi.c create mode 100644 arch/riscv/kernel/image-vars.h rename drivers/firmware/efi/{arm-init.c => efi-init.c} (100%) create mode 100644 drivers/firmware/efi/libstub/riscv-stub.c create mode 100644 drivers/firmware/efi/riscv-runtime.c --- 2.24.0