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 BA109C433F5 for ; Thu, 6 Oct 2022 08:53:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 702D184A35; Thu, 6 Oct 2022 10:53:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9476384B22; Thu, 6 Oct 2022 10:53:00 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 0457284567 for ; Thu, 6 Oct 2022 10:52:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A09452B; Thu, 6 Oct 2022 01:53:03 -0700 (PDT) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BA0FE3F73B; Thu, 6 Oct 2022 01:52:56 -0700 (PDT) Date: Thu, 6 Oct 2022 09:52:53 +0100 From: Andre Przywara To: Sean Anderson Cc: Tom Rini , u-boot@lists.denx.de, Kautuk Consul Subject: Re: [PATCH 0/3] arm: smh: Fix and improve semihosting traps Message-ID: <20221006095253.2b4f86ed@donnerap.cambridge.arm.com> In-Reply-To: <8a4cd979-b23f-d2bb-1012-bfdc25094e89@seco.com> References: <20221005163849.3205046-1-andre.przywara@arm.com> <8a4cd979-b23f-d2bb-1012-bfdc25094e89@seco.com> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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.6 at phobos.denx.de X-Virus-Status: Clean On Wed, 5 Oct 2022 19:41:01 -0400 Sean Anderson wrote: Hi Sean, > On 10/5/22 12:38, Andre Przywara wrote: > > While playing around with QEMU's semihosting implementation, I stared at > > our semihosting trap code, and found some issues, that this mini-series > > fixes. > > > > Please have a look! > > > > Cheers, > > Andre > > > > Andre Przywara (3): > > arm: smh: specify Thumb trap instruction > > arm: smh: Make semihosting trap calls more robust > > arm: smh: Allow semihosting trap calls to be inlined > > > > arch/arm/lib/semihosting.c | 44 +++++++++++++++++++++++++++----------- > > 1 file changed, 31 insertions(+), 13 deletions(-) > > > > This all LGTM > > Although I wonder if we should just move smh_trap into an assembly file. > I think that would apply most of these optimization barriers. I was already thinking about that, since it's indeed the most clean and robust solution. But then I didn't want to throw away the hours of research I put into this, and be it for future reference in the mailing list archive ;-) And I really like how the compiler just puts the "hlt" directly into the generated code. But since it's not performance critical, a function is just fine. > Your series will also confict with Kautuk's series [1]. I think the bugs > you described above will apply to RISC-V as well. Ah, this now makes the case for an assembly file even bigger, since we now have only the trap function in a separate file anyway. I will send something on top of Kautuk's series. Many thanks for the heads up! Cheers, Andre > > --Sean > > [1] https://lore.kernel.org/all/20220923070320.617623-1-kconsul@ventanamicro.com/