From patchwork Mon Feb 24 22:19:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1243596 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=Tm9+cZ71; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48RGjr2tCtz9sQt for ; Tue, 25 Feb 2020 09:21:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0CAA81281; Mon, 24 Feb 2020 23:20:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="Tm9+cZ71"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF3D781269; Mon, 24 Feb 2020 23:20:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6E73A81260 for ; Mon, 24 Feb 2020 23:20:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=31631e744=atish.patra@wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1582582837; x=1614118837; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Uj4jEUSIWane+3+VuhG/aCVar4PZnIqYv4G59iL/zSw=; b=Tm9+cZ71mM3brKYXAc9mKzApVBPaStYA1PkFvmb/93rmAlxcCpe3Y9vi V3scseeNST9LC2UhjXyaTR6mHc4Pgjp1cA8jnK4zK4Jdb4RU0hFwe0dRq BO0zId8XphrBJHJQm+irlhafuXuNxxvQ/DVhzUml0d3tHEyPFTcOy/MNc IDhUHTaWFf7IoKauTzREnMGWv7W174lDt5+NNOBxaJvMQ0X9+TnowziI8 jHmxEVYv6o7IJHhZ43h+dgymM6IoO+sz0RvixQWkUyG1MeWhcGqnE1LWy wX6KF/Uk/Ih6K5kylM1yx+CVzNc7gUqhABqi4OVqaDtMAIHtK/txX80Sl w==; IronPort-SDR: zPIzDUnOZwlZegPVVK72gexLmE4ZQEbrqNO32fCLYN/0Y1Z8MSEy4XONPVbDmxYyjetCD+Jx0e tpSxx0lUj79bbLhXnP3XC9HFT840Xs03KylyVtEfbW/JVaMszXmgTNjD/f+aetdwsczdzEWuIw SQLMhxYgJTaWWddc40PrQqilAv8fIQJQiOiGbf9qQmhXNYkTCLuEk2oQlDYdGN92ekn7aUuaTc QGgwqi68F+oEynOLREtyol5KHSL0QnTWt2TxKMdeyafQb580naiRfvF/N6zUjf3zlq7/HANhkK o+I= X-IronPort-AV: E=Sophos;i="5.70,481,1574092800"; d="scan'208";a="131143524" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2020 06:20:30 +0800 IronPort-SDR: QRVHEiyjIVDuAopf6XnkNeu4+joQFkvLWnJuc5kulnH+YN1KG4676FLpd2a8EgNpiuby28jMoh fjcT9xv/1tkiieXZlJ8rZMKfV2d8kTolAm1UHNLIV2u/nt0c8DiAQetctke4g0dWXDa9MTHApC CnL19jZUdVZp/fYQFWlO5BYiAy7Oe8P3d32t7VRV0jjxRLIE2lwP+AIJ27cJgX697xgQ9uGU/s TNRKbAuV1FlOlojcL4tFPKhl8tAL7qD99R5RAcZqad+piMk5R+iUkfSU3xmh97niWXD9Qmepoj YUl5IUQIJG+iP2kRV3D374GX Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2020 14:12:57 -0800 IronPort-SDR: 8VAehSIINEtE36JIIMKmE1UWVh+xtih/DvzqZewMOTviMNzoyPlxCoC6zo8x1bqzsTpuzHDaq9 QqLa2E0t55LEz8VlGszke3lkPLMpXis8BknonfLihQcZwJqIMK6QkZzpakm9xcvusLJ/6/R9nM 0uv0tffOV183VMD6QF1u0Wq4tHdaj6Txh3t1PCHNTIH3dXjq/9Az+zdD7mY4nwjL44xXnqeiqC zbVEFWW/eAxwZm8VLGDDYOkhUul+5Bpr6c2otq5UCu8TklFEKF5fe0t5KQ4+B0IaGWirvtaHYw DRg= WDCIronportException: Internal Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 24 Feb 2020 14:20:28 -0800 From: Atish Patra To: u-boot@lists.denx.de Cc: Atish Patra , Alexander Graf , Anup Patel , Bin Meng , Joe Hershberger , Loic Pallardy , Lukas Auer , =?utf-8?q?Marek_Beh?= =?utf-8?b?w7pu?= , Marek Vasut , Patrick Delaunay , Peng Fan , Philippe Reynes , Simon Glass , Simon Goldschmidt , Stefano Babic , Thierry Reding , trini@konsulko.com, Heinrich Schuchardt , Ard Biesheuvel , "leif@nuviainc.com" , abner.chang@hpe.com, daniel.schaefer@hpe.com Subject: [RFC PATCH 1/1] riscv: Add boot hartid to Device tree Date: Mon, 24 Feb 2020 14:19:49 -0800 Message-Id: <20200224221949.28826-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200224221949.28826-1-atish.patra@wdc.com> References: <20200224221949.28826-1-atish.patra@wdc.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Linux booting protocol mandates that register "a0" contains the hartid. However, U-boot can not pass the hartid via a0 during EFI boot without breaking the UEFI specification. Add a DT node under chosen node to indicate the boot hartid. EFI stub in Linux kernel will parse this node and pass it to the real kernel in "a0" before jumping to it. Signed-off-by: Atish Patra --- arch/riscv/lib/bootm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index fad16901c5f2..b84cc2db2016 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -28,6 +28,19 @@ __weak void board_quiesce_devices(void) int arch_fixup_fdt(void *blob) { + u32 size; + int chosen_offset, err; + + size = fdt_totalsize(blob); + err = fdt_open_into(blob, blob, size + 32); + if (err < 0) { + printf("Device Tree can't be expanded to accmodate new node"); + return -1; + } + chosen_offset = fdt_path_offset(blob, "/chosen"); + fdt_setprop_u64(blob, chosen_offset, "efi-boot-hartid", + gd->arch.boot_hart); + return 0; }