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 34F14C433EF for ; Sun, 9 Jan 2022 18:43:42 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F2E3805F9; Sun, 9 Jan 2022 19:43:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="KtzRcHMy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E77EC811BA; Sun, 9 Jan 2022 19:43:39 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 12E1B80335 for ; Sun, 9 Jan 2022 19:43:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 4936640019 for ; Sun, 9 Jan 2022 18:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1641753812; bh=TdLcfVlUCAdaVwyDr+BApOIXZ3MbUBYk/VDwEjJ0UZM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KtzRcHMys8YKQF9Ig5fA3xTsVGsCDtj2ODg6YHrmZyUl6khgrrsYsqRCeGtQs69xK uGKyod51aSvY4xEkjfwk03vsiZna9Jqp8le2XU1gjq4niL2uKSZzAinHbmwlr/UBjG wcxgDUFRPNgtCHH0wOjQ2iutoL14nDq8lKZO9cft1jqEdgLLUlK5z7NKfR0qefT2wN WmIYnduIZsoTYa9n9ZVYsuyqGhGHxOWQejcq0EBU96S13hZ1CEtWMOlUtAv9JYbt8b TBb1ncNi4hxKUFqJsoqKUuQIomOJM37LpkfbFB+P0+4v6HNkZcyLQ8myHA5giylU4S fEXCSdT/Zgrvg== Received: by mail-wm1-f72.google.com with SMTP id j8-20020a05600c1c0800b00346504f5743so7472958wms.6 for ; Sun, 09 Jan 2022 10:43:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=TdLcfVlUCAdaVwyDr+BApOIXZ3MbUBYk/VDwEjJ0UZM=; b=TqTJnvrgm5+gwdRM9Eew4063H8kT7hHuDFi4vvmBo8lkOAX29k0I7yvmva5C+BVIAN XrU+IXeMCgi0fwMsooWzFRb54z4lTeCbHPvN4j7VdRmNS+Ge3OgN7uao/KwMSEc4G7uE dKRKj48+iJR5ajCF9j6UpMQbpX6gZozDdSfsRFirfQB8cx3CGxGV821PKwpvHimF/BTI KKV+Xjcxi4Mg/8j6J3Tt23NscLNvcXQJwdOc1oG7vkWgewevz1C9ekeMH1Cs92WQCBRK lTG4bcFFhcwYyaT7FVQP4nBlA2356eVjWZODG48snuqq05glWj03ASSjm5d6wO8VXLlW 3kiw== X-Gm-Message-State: AOAM5326I244Pr99AMTOhbXXTzCxS9lOmf2aFVq2HBr07ZgO8DOQieoI QqED1niirDkQ1P8h4ew0ICvhwnmXiS9vV9yFMkS+p92o5YoKYL448fH7pfc+zAGA1AhCr1MY9Zb 3fuIj++s4gRFVchZVBfZ4HaOJr3czVJ0= X-Received: by 2002:a5d:5849:: with SMTP id i9mr61127012wrf.148.1641753811819; Sun, 09 Jan 2022 10:43:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN2T3IjMFrN6+3xo9Tgiiy+P1jr+jXnUmDFmoctBLz1twbhbxM19MuVLKPuG/9E6aSnpKyvQ== X-Received: by 2002:a5d:5849:: with SMTP id i9mr61126992wrf.148.1641753811585; Sun, 09 Jan 2022 10:43:31 -0800 (PST) Received: from [192.168.123.94] (ip-88-152-144-157.hsi03.unitymediagroup.de. [88.152.144.157]) by smtp.gmail.com with ESMTPSA id bk17sm4567741wrb.105.2022.01.09.10.43.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Jan 2022 10:43:31 -0800 (PST) Message-ID: <5c444fe0-4ee5-e780-bd91-c3d0dd34a82e@canonical.com> Date: Sun, 9 Jan 2022 19:43:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH 1/6] cmd: exception: arm64: fix undefined, add faults Content-Language: en-US To: Andre Przywara , Tom Rini Cc: Simon Glass , Alison Wang , Michael Walle , Nishanth Menon , Priyanka Singh , Peter Hoyes , Marek Vasut , u-boot@lists.denx.de References: <20220109173009.25522-1-andre.przywara@arm.com> <20220109173009.25522-2-andre.przywara@arm.com> From: Heinrich Schuchardt In-Reply-To: <20220109173009.25522-2-andre.przywara@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean On 1/9/22 18:30, Andre Przywara wrote: > The arm64 version of the exception command was just defining the > undefined exception, but actually copied the AArch32 instruction. > > Replace that with an encoding that is guaranteed to be and stay > undefined. Also add instructions to trigger unaligned access faults and > a breakpoint. > This brings ARM64 on par with ARM(32) for the exception command. > > Signed-off-by: Andre Przywara > --- > cmd/arm/exception64.c | 42 ++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 38 insertions(+), 4 deletions(-) > > diff --git a/cmd/arm/exception64.c b/cmd/arm/exception64.c > index d5de50a0803..1a9730e6aec 100644 > --- a/cmd/arm/exception64.c > +++ b/cmd/arm/exception64.c > @@ -12,14 +12,46 @@ static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc, > char *const argv[]) > { > /* > - * 0xe7f...f. is undefined in ARM mode > - * 0xde.. is undefined in Thumb mode > + * Instructions starting with the upper 16 bits all 0 are permanently > + * undefined. The lower 16 bits can be used for some kind of immediate. > + * --- ARMv8 ARM (ARM DDI 0487G.a C6.2.339: "UDF") What is the title and URL of the document? I could not find it. It would be good to add this information in the comments. Best regards Heinrich > */ > - asm volatile (".word 0xe7f7defb\n"); > + asm volatile (".word 0x00001234\n"); > + > + return CMD_RET_FAILURE; > +} > + > +static int do_unaligned(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + /* > + * The load acquire instruction requires the data source to be > + * naturally aligned, and will fault even if strict alignment fault > + * checking is disabled. > + * --- ARMv8 ARM (ARM DDI 0487G.a B2.5.2: "Alignment of data accesses") > + */ > + asm volatile ( > + "mov x1, sp\n\t" > + "orr x1, x1, #3\n\t" > + "ldar x0, [x1]\n" > + ::: "x0", "x1" ); > + > + return CMD_RET_FAILURE; > +} > + > +static int do_breakpoint(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + asm volatile ("brk #123\n"); > + > return CMD_RET_FAILURE; > } > > static struct cmd_tbl cmd_sub[] = { > + U_BOOT_CMD_MKENT(breakpoint, CONFIG_SYS_MAXARGS, 1, do_breakpoint, > + "", ""), > + U_BOOT_CMD_MKENT(unaligned, CONFIG_SYS_MAXARGS, 1, do_unaligned, > + "", ""), > U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined, > "", ""), > }; > @@ -27,7 +59,9 @@ static struct cmd_tbl cmd_sub[] = { > static char exception_help_text[] = > "\n" > " The following exceptions are available:\n" > - " undefined - undefined instruction\n" > + " breakpoint - breakpoint instruction exception\n" > + " unaligned - unaligned LDAR data abort\n" > + " undefined - undefined instruction exception\n" > ; > > #include