From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6036AC678D5 for ; Tue, 7 Mar 2023 17:52:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D0CF85C31; Tue, 7 Mar 2023 18:52:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="ROo4z58Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BAC4C85C0F; Tue, 7 Mar 2023 18:52:24 +0100 (CET) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 01F5085BFA for ; Tue, 7 Mar 2023 18:52:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x833.google.com with SMTP id s12so15231890qtq.11 for ; Tue, 07 Mar 2023 09:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1678211540; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=37XZNC47eZUACq+QGolbI+WuAchUEqb1SJVHaWiCe/w=; b=ROo4z58ZKNwvni0pmvNCKrSugC23+hachxDViAG1iVSTnWOfDPa5qRWlDB8pBOR7vu 2InEJKgsXMJSZRuGx3H6R3wkjlJ3PeMNJZFJjclbF17qufdpJ5xpS3LdDCo2oFQiKo4p 7q80EvpyRyNiDfuUgtadfZ8t2+lEFqs3WOJ2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678211540; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=37XZNC47eZUACq+QGolbI+WuAchUEqb1SJVHaWiCe/w=; b=Vm7vX/ewEfEWj7KLpd5plTtAqY7kEsWEGO6afUtilLB7Zf4vpLkCcc234clv9FmdzN oHHZgI7yDy63iyLp9nSneRQB24w8CSF7/s60R+raGV9t9pF20s1Uzgpb5NL4O3DGxePP lSE1g+Jxqoov4jRyyrF2FvYBy22FZt/Mr3I0QJrEBPf5pIzkwU/T30OYRdsNQwGJdYrS pnFkwPHt6GmeCts/z582lrT89JIsrw50S7GLGaNKm0Ih/oPCb2s0IRIlorOrNgER0hUL 5ZiZWiIPN+3+D1OMlfwDxczxWX1YQXRyp1gbdT2wke84ajm8mRMVGfT8AzN50zumaXhg Jvsw== X-Gm-Message-State: AO0yUKXieXk4swYEMZDsK3rzxyZcwQMrEHS+MqcST28ay0d3M7pE2Xb8 WwS7FhFsSYmxoW1VpmFFKs8q8VjZqmh8tuy25+3IOw== X-Google-Smtp-Source: AK7set+KvPEZdPkwnKB+OQEpBLbFE7Vv7IEHXRLAsYWSs9PzheYDqxy9Uxd9g6C1HXC/4oRWCSy0BA== X-Received: by 2002:a05:622a:5c6:b0:3b5:5234:e895 with SMTP id d6-20020a05622a05c600b003b55234e895mr19067844qtb.15.1678211540637; Tue, 07 Mar 2023 09:52:20 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-0000-0000-0000-036b.res6.spectrum.com. [2603:6081:7b00:6400::36b]) by smtp.gmail.com with ESMTPSA id o2-20020a375a02000000b0074357a6529asm1280764qkb.105.2023.03.07.09.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 09:52:20 -0800 (PST) Date: Tue, 7 Mar 2023 12:52:18 -0500 From: Tom Rini To: Andre Przywara Cc: Sean Anderson , Kautuk Consul , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH 2/2] riscv: semihosting: replace inline assembly with assembly file Message-ID: <20230307175218.GL968799@bill-the-cat> References: <20230207152105.2167641-1-andre.przywara@arm.com> <20230207152105.2167641-3-andre.przywara@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uUPpZaCZKTnIyJ/U" Content-Disposition: inline In-Reply-To: <20230207152105.2167641-3-andre.przywara@arm.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean --uUPpZaCZKTnIyJ/U Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 07, 2023 at 03:21:05PM +0000, Andre Przywara wrote: > So far we used inline assembly to inject the actual instruction that > triggers the semihosting service. While this sounds elegant, as it's > really only about a few instructions, it has some serious downsides: > - We need some barriers in place to force the compiler to issue writes > to a data structure before issuing the trap instruction. > - We need to convince the compiler to actually fill the structures that > we use pointers to. > - We need a memory clobber to avoid the compiler caching the data in > those structures, when semihosting writes data back. > - We need register arguments to make sure the function ID and the > pointer land in the right registers. >=20 > This is all doable, but fragile and somewhat cumbersome. Since we now > have a separate function in an extra file anyway, we can do away with > all the magic and just write that in an actual assembler. > This is much more readable and robust. >=20 > Signed-off-by: Andre Przywara > Reviewed-by: Sean Anderson After correcting the style on the SPDX header of the new .S file, applied to u-boot/next, thanks! --=20 Tom --uUPpZaCZKTnIyJ/U Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmQHedIACgkQFHw5/5Y0 tyxamAv/TqPqZQGNHolts9Haz3ZVe6fWUVa9N1C6dgGmAfjGpHO1lDpRpb0V4OaH S+IWtPLrv8TW3fsXcXS7HAy6giGV7bbLmxA+u9lcAYIrw7hSvw8BY3Hiho5KUudP sAh7OJ1UipIzNK6ar+ZjVkTsh8iQZvYQ/U0VEH54RgywvmjLm2Ookwa9ony701vY GCbdySiujcVKtRurRXUNgR11AP4+8L81aXnxfH8DVju/rPhWRmXQYYroA77l55yd PS2++IKR5R1XDHSjB5H94Kua1Zptr+FlSIbIPa4K1dsr6Oc72p1CQvA9heZjEhE4 jvcL/48D2CQKpmdWhYIX09kptYklXlT9P2f4Nm9VsahTS+UZ8qnN2+XvdrGlUKRp fYPqDzm+HhnBbQ1F39YAcGdrDE1915oh3k4Yf1zNrFsvQIWbB1Q6lTGT4OJuY8id EppDzHy0EfPxnLSQ9MF8Elw9TckTWIkmdt8t+/zHuPubRlT1f/fXud9UYMKYNXpU X6vmcTyE =MTy/ -----END PGP SIGNATURE----- --uUPpZaCZKTnIyJ/U--