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 EA06EC433EF for ; Sat, 11 Jun 2022 03:02:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D9A4E8441A; Sat, 11 Jun 2022 05:01:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ysoft.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=ysoft.com header.i=@ysoft.com header.b="Fv0+4eYC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DE288843E7; Fri, 10 Jun 2022 12:02:35 +0200 (CEST) Received: from uho.ysoft.cz (uho.ysoft.cz [81.19.3.130]) (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 9507F843FD for ; Fri, 10 Jun 2022 12:02:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ysoft.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michal.vokac@ysoft.com Received: from [10.1.8.213] (unknown [10.1.8.213]) by uho.ysoft.cz (Postfix) with ESMTP id 0CA7BA02A1; Fri, 10 Jun 2022 12:02:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1654855352; bh=+otRkMaVPcn3BuBfIWWUh3Ne3JpPnarKESI07YNFXxQ=; h=Date:In-Reply-To:To:Cc:From:Subject:From; b=Fv0+4eYC32+qmKVg3eqdn3aoyUiK60PKvz0VO1O37+n9WF9UTwYNEtrn6W1f/1I7O 465BipEJahjrQffrdnpScdagO56Qdn9BorY/qOVjtKWsZrum3JXPkKNO+6VDJ1N5Wt 1zCA4zXFj5Bv046/zYeW1zpBv6YhOXFbSjg4npx0= Message-ID: Date: Fri, 10 Jun 2022 12:02:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US In-Reply-To: To: Fabio Estevam Cc: Stefan Roese , U-Boot-Denx , Gaurav Jain , dullfire@yahoo.com, Rasmus Villemoes , Schrempf Frieder , Heiko Thiery , ZHIZHIKIN Andrey , Horia Geanta Neag From: =?UTF-8?B?TWljaGFsIFZva8OhxI0=?= Subject: Re: [PATCH] crypto: fsl_hash: Remove unnecessary alignment check in, caam_hash() Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sat, 11 Jun 2022 05:01:08 +0200 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.5 at phobos.denx.de X-Virus-Status: Clean > On Fri, Apr 29, 2022 at 10:35 AM Stefan Roese wrote: >> >> While working on an LX2160 based board and updating to latest mainline >> I noticed problems using the HW accelerated hash functions on this >> platform, when trying to boot a FIT Kernel image. Here the resulting >> error message: >> >> Using 'conf-freescale_lx2160a.dtb' configuration >> Trying 'kernel-1' kernel subimage >> Verifying Hash Integrity ... sha256Error: Address arguments are not aligned >> CAAM was not setup properly or it is faulty >> error! >> Bad hash value for 'hash-1' hash node in 'kernel-1' image node >> Bad Data Hash >> ERROR: can't get kernel image! >> >> Testing and checking with Gaurav Jain from NXP has revealed, that this >> alignment check is not necessary here at all. So let's remove this >> check completely. >> >> Signed-off-by: Stefan Roese >> Cc: Gaurav Jain >> Cc: dullfire@yahoo.com > > I applied this patch against top of tree U-Boot, but I am still > getting the following > error on a kontron-sl-mx8mm board with the options below selected: > > CONFIG_IMX_HAB=y > CONFIG_SPL_DRIVERS_MISC=y > > ### Loading kernel from FIT Image at 42000000 ... > Using 'conf-freescale_imx8mm-kontron-n801x-s.dtb' configuration > Trying 'kernel-1' kernel subimage > Description: Linux kernel > Created: 2022-06-07 1:58:57 UTC > Type: Kernel Image > Compression: gzip compressed > Data Start: 0x42000100 > Data Size: 7609360 Bytes = 7.3 MiB > Architecture: AArch64 > OS: Linux > Load Address: 0x40480000 > Entry Point: 0x40480000 > Hash algo: sha256 > Hash value: > d20b5d533e123096edb05a6433d850c0fafb4b39a6e6d47e9bade3f6fa7c26ce > Verifying Hash Integrity ... sha256dev_get_priv: null device Hi Fabio, I had the very same problem/error on i.MX6 and figured out that CONFIG_ARCH_MISC_INIT=y must be enabled otherwise the caam_jr driver is not initialized. I also tried this patch. Now the caam_hash() returns OK and I can boot the board but I am still seeing a warning regarding wrong alignment from cache lib: => bootm 12000000#conf-4 ## Loading kernel from FIT Image at 12000000 ... Using 'conf-4' configuration Verifying Hash Integrity ... OK Trying 'kernel' kernel subimage Description: Kernel Type: Kernel Image Compression: uncompressed Data Start: 0x120000dc Data Size: 2901024 Bytes = 2.8 MiB Architecture: ARM OS: Linux Load Address: 0x10800000 Entry Point: 0x10800000 Hash algo: sha256 Hash value: a3343f1df615f14677176ea4966644fcaa25b31bd3808682567b7fedf704cfb8 Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [120000dc, 122c451c] + OK ## Loading fdt from FIT Image at 12000000 ... Using 'conf-4' configuration Verifying Hash Integrity ... OK Trying 'fdt-4' fdt subimage Description: Orion Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x122c4604 Data Size: 41038 Bytes = 40.1 KiB Architecture: ARM Load Address: 0x18000000 Hash algo: sha256 Hash value: 13e0b23bd49f9e86a0425080fc788db67bf318d6f103f217d5705a455737e91c Verifying Hash Integrity ... sha256CACHE: Misaligned operation at range [122c4604, 122ce684] + OK Loading fdt from 0x122c4604 to 0x18000000 Booting using the fdt blob at 0x18000000 Loading Kernel Image Using Device Tree in place at 18000000, end 1800d04d Starting kernel ... Michal