Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5685852yba; Mon, 13 May 2019 15:33:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwW4p98pumkGn52IvpZQ9J+LYoAvvaUbg8H9cezIJde/AWsYu3qx0taU/2+TLZeOFIBKB5J X-Received: by 2002:a63:c02:: with SMTP id b2mr17925666pgl.5.1557786817584; Mon, 13 May 2019 15:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557786817; cv=none; d=google.com; s=arc-20160816; b=a9BQWAikLKQhtaX0VotPjZ8NfcngnNMLE68rZKQwJ/vHcUK44/z6FO0bFXqmFwIN87 Iau5H6hGEzGLRljR7cvqAjdosFqgsA/0qwLHFCKpWHRtJUAR0Hy+8w6iOSl1Y6ugWjsc BcJecLs4n8EBMsp6RXk9BULCOoBQ6aS2Z9oGHKrr3EAhXc1asMfY5viNTm9gZsEsWAxR VDw4lADjkL8qFDA3xf8/bbj+l4sCGlYCtJJMDZihaxSxNu3ksLFidAN+SfYSW2KE6YSk uFq40Us3XxlfEGAF1Ka9xP5JTl2j9PCopsYAJGHt+UhaIxqzv7UVI51+8TafIVAja4mp U1tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=ZTesufEDxec+5sA8PoolbYSfD3zUTYkwZ95SB2LoCtU=; b=AKisu770jqeE4Hctcm7fnBGXyZT5jebIgu/Jv3u9sRUF4IowZX+AN/OoIGCTEXLQ/l I7hzo7bWrZxz0ej9DTrusylAgV3GEgiNI8P0AW56DSXu4bTNsCeF6gh+gJdeCskbTXkW nb58576BjU83RvbvKxC2hOrsIuSO7yh3dOX4+60lDdmKlO7vJEMAIVA9MmEkRndMA5nL vaPSmgH/riyzlHF+U8v2bl3xoH2y6hW6nTC1uun2Cm9pz7kplwDD2Cu/He/D0Bhb5kqd FIYLhkk+mJ+qiqC2thQb7qrU/nDNOer+s2lOKjrIS9ZyQiPLz7OcGnvjTIBldVV5pw8i WuTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="mG/THQWe"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si17719929pgl.299.2019.05.13.15.33.16; Mon, 13 May 2019 15:33:37 -0700 (PDT) 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=@sifive.com header.s=google header.b="mG/THQWe"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726547AbfEMWbS (ORCPT + 99 others); Mon, 13 May 2019 18:31:18 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:44728 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726407AbfEMWbS (ORCPT ); Mon, 13 May 2019 18:31:18 -0400 Received: by mail-io1-f67.google.com with SMTP id f22so11224200iol.11 for ; Mon, 13 May 2019 15:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ZTesufEDxec+5sA8PoolbYSfD3zUTYkwZ95SB2LoCtU=; b=mG/THQWen8d9t08ReVXM/a4ba8YySpitPWAsXt/KNMLaALTtLfL2x+XjbBwHg6/dDT jnYtVVRVZiYOeoCmL38LjdVXrHpbjVlR2mhfGp2mqAUlpw0/xYDUOhVJtk4U/HWSZQOi s7kjzCf7KUV3xOayKwlKeYEMsMakNSWOX5xBAJto1mbmlTvsR0xZZwvojS5J3nkPvsDI ZDLU2mAFOFKZNjd0kf8RCrCmHUgxoeC3XRa3ftrzRQot4vTvpKbK/WGUszS8qCEub6XR WOJB4DHsMpVUJVqmuCCLG4FrfjPWqgt2mjRii/pYhZrPlSf3bKrUCgEZ75J3ns1zVyD+ TMlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=ZTesufEDxec+5sA8PoolbYSfD3zUTYkwZ95SB2LoCtU=; b=NlXK2At3exAPjc1OBGfLsnpewZTvrrtY1iawssvt1Fry1rLglX1qADuKozyd8IgCHW JP9/dQYW1km49gN/LhJP4t+BmT4grThlvivdd1nFE2AZbddyMrPzhXRPwXDyQi+wOSvL XG0bNHOVvP2l5jf3AMfiLeH6XP1gEoxruYE9ccJMvVSDkNFtEmSfwC8DYByXzqPMA4CZ 8VXlGOfTJGaRV6m7IwdMZgS904YFXtR0xGnynSZd0jGk8rQXwLNA65LghBs4S5y1OuOb +xCuF+zT8d2UTD0bFNz925uv996ckuII12Q6G4cy5yUjPw368HPiVJTuEzxzAZofpyBK 8hGw== X-Gm-Message-State: APjAAAURcnKVBs1qO22rO1lxB3HsUf6vVdb+ZKCUSnLaihaJi0SI15W/ /PScxO3LGgntSOVUFh1weV1meg== X-Received: by 2002:a5d:9948:: with SMTP id v8mr4043411ios.190.1557786677263; Mon, 13 May 2019 15:31:17 -0700 (PDT) Received: from localhost (c-73-95-159-87.hsd1.co.comcast.net. [73.95.159.87]) by smtp.gmail.com with ESMTPSA id c62sm368695itd.17.2019.05.13.15.31.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2019 15:31:16 -0700 (PDT) Date: Mon, 13 May 2019 15:31:16 -0700 (PDT) From: Paul Walmsley X-X-Sender: paulw@viisi.sifive.com To: Atish Patra cc: linux-kernel@vger.kernel.org, mark.rutland@arm.com, Albert Ou , Anup Patel , Palmer Dabbelt , Zong Li , merker@debian.org, linux-riscv@lists.infradead.org Subject: Re: [v2 PATCH] RISC-V: Add a PE/COFF compliant Image header. In-Reply-To: <20190501195607.32553-1-atish.patra@wdc.com> Message-ID: References: <20190501195607.32553-1-atish.patra@wdc.com> User-Agent: Alpine 2.21.9999 (DEB 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 May 2019, Atish Patra wrote: > Currently, last stage boot loaders such as U-Boot can accept only > uImage which is an unnecessary additional step in automating boot flows. > > Add a PE/COFF compliant image header that boot loaders can parse and > directly load kernel flat Image. The existing booting methods will continue > to work as it is. > > Another goal of this header is to support EFI stub for RISC-V in future. > EFI specification needs PE/COFF image header in the beginning of the kernel > image in order to load it as an EFI application. In order to support > EFI stub, code0 should be replaced with "MZ" magic string and res5(at > offset 0x3c) should point to the rest of the PE/COFF header (which will > be added during EFI support). > > Tested on both QEMU and HiFive Unleashed using OpenSBI + U-Boot + Linux. > > Signed-off-by: Atish Patra Seems like we're stuck with this basic format for EFI, etc. Even though we may be stuck with it, I think we should take the opportunity to add the possibility to extending this header format by adding fields after the basic PE/COFF header ends. In particular, at the very least, I'd suggest adding a u32 after the PE/COFF header ends, to represent a "RISC-V header format version number". Then if we add more fields that follow the PE/COFF header -- for example, to represent the RISC-V instruction set extensions that are required to run this binary -- we can just bump that RISC-V-specific version number field to indicate to bootloaders that there's more there. One other observation - if what's here was copied from some other architecture, like ARM, please acknowledge the source in the patch description. thanks - Paul