From patchwork Thu Dec 28 18:49:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 122855 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3803647qgn; Thu, 28 Dec 2017 10:58:51 -0800 (PST) X-Google-Smtp-Source: ACJfBovNQq7Kov9AKyB5Wy4vEUDJmoeYNz6k7C//qvLZERPqMNbZq6Hs8ecXBzHsOE1sH+Fbi5Vl X-Received: by 10.80.172.226 with SMTP id x89mr42687221edc.43.1514487531561; Thu, 28 Dec 2017 10:58:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514487531; cv=none; d=google.com; s=arc-20160816; b=KVWQvnqCtqCEbqfOi/XqQclNP0FGjrcgNBRb3ngoXx71Y+QNsBvdqW8tg+GVKcXntz 99e8BV8VGr1QKCZrWRKa3ux/L78D6utyCO4yPethnVeSr+R3BwpcE2k4uavXazJ0TL2E rEEKtglKivOZW0N/lYSX1ltKslSQbHnrGVhdCkROn6sK+YtTBzkd4qyb25a12/nr2CCG MJqYRKJs9fr23XKdFJyQtdzNe1UFWVzrt+v4HsvwzvCcsK8kHUuDnYWBSq+94UTPpi7G S+huGwTRWfDXGGAa9cM4Nf39QJeS95npccDlbuCfN1QzNbk+t9BB/N3e3tvochHV6Rht ySag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=N9cjxq1JSXJ8z95cc24viTXrcEeJuNQ7EWQtfvf+sFU=; b=UnF49RT8BNdT4ThxOEFr0k1EXzGqM9ItQTzrCgNJQXljRALlm3Okow+KfwJL3y+aV2 fIVfp7d3MfsDPTvVjB0uJHEviV9u4WaPf1XGe1pzIOD3ycQb6YudnLu1vHJebGV89RY5 CkK16o7VKpz1DOOJ6GsG2j8125bHtnN1wIJ3hkOEt1Ql5rpUEE1vzBpA7KIUS3znoWIo fMc4WI/Q3tK2UcU/L0r2lea93CZt4v5cdzEsgpmCakde51xkH9X+RAsIFIsGsR/XLl23 tRIclDhBGijr9RyHOKLLH5G28wSYq338Csd8hSVz69G8uRUuiZmwbZGd0/x40nhA1ziB bPBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VJrP+1v4; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id q12si785782edj.449.2017.12.28.10.58.51; Thu, 28 Dec 2017 10:58:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VJrP+1v4; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 0DCE3C21D9F; Thu, 28 Dec 2017 18:51:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C6C3EC21E10; Thu, 28 Dec 2017 18:50:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B5D0BC21DA6; Thu, 28 Dec 2017 18:49:57 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 2508AC21C59 for ; Thu, 28 Dec 2017 18:49:54 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id y82so2846947wmg.1 for ; Thu, 28 Dec 2017 10:49:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uTnjN80vRz9KsccagZjGfzkJcvaXHUA7tSlukwiRk1s=; b=VJrP+1v4fKBs7/JPBrQL7J5P5a8mTU64d8PaKz0PzmiU72ktPdNxTo7dugSkInN56B ASGnmUWcY+AxPZAOIgaBMkEf8wIB/T1afvtCF+RYdbmtjPMVllsFx002yRioY1UU2KvN 2DU7GpAscWQQAl16OqcJH7dzsEUOnXI/fFnB4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uTnjN80vRz9KsccagZjGfzkJcvaXHUA7tSlukwiRk1s=; b=Cne5VBOIzWL0EAcK88tu93uXqmXDcN22+Vd/dUmxdYgeP2s6KdLl8jSl9adVP2MN4U 4OwHXhRGJ7ft9KuuoSC8QSPaQOSoVYAsTRV3lwYB37BqHEAsnL6+J6V8D8yO3IFdOUAW X6u99ANOVDvz/KG1rXpCvBm48tplFOdMSxLhPLn36sVxG3Q6JyXKZjxa4UR1AEoLJfFV hZfiwd9wtPYtRpX5/fXyk/AkIPVVOLQGq60kTR1eifjyugvKPiKlJaVo29e/azL19kvu y+pzAqULEMQAO2tSzcO+GmAYnvbcgB1vAkwmAuR8jLV5Idc7CHbvBuSqYp9aS6vjb9PG QzoQ== X-Gm-Message-State: AKGB3mI9b/hOYb8IiFpq944nc4ZRdpq168Jg7x2wNrqRH6C2ylKLsKs3 3xrK9DDH66D+sMqbGMUm9JpmYhj1nK4= X-Received: by 10.80.221.130 with SMTP id w2mr40937880edk.226.1514486993541; Thu, 28 Dec 2017 10:49:53 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x28sm35246579edd.0.2017.12.28.10.49.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Dec 2017 10:49:52 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Thu, 28 Dec 2017 18:49:27 +0000 Message-Id: <1514486982-19059-9-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514486982-19059-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v2 08/23] arm: imx: hab: Fix authenticate image lockup on MX7 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The i.MX6 has some pretty explicit code associated with informing the IROM about flushing caches during authenticate_image(). Looking at various pieces of documentation its pretty clear the i.MX6 IROM registers are not documented and absent similar documentation on the i.MX7 the next-best fix is to disabled the dcache while making an authenticate_image() callback. This patch therefore disables dcache temporarily while doing an IROM authenticate_image() callback, thus resolving a lockup encountered in a complex set of authenticate-image calls observed. Note there is no appreciable performance impact with dcache switched off so this fix is relatively pain-free. Signed-off-by: Bryan O'Donoghue Cc: Stefano Babic Cc: Fabio Estevam Cc: Peng Fan Cc: Albert Aribaud Cc: Sven Ebenfeld Cc: George McCollister Cc: Breno Matheus Lima --- arch/arm/mach-imx/hab.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 2a40d06..1d7b069 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -466,10 +466,25 @@ int authenticate_image(uint32_t ddr_start, uint32_t image_size, } } + /* + * FIXME: Need to disable dcache on MX7 is there an IROM + * register like on MX6 above ? Certain images called in certain + * orders with the dcache switched on will cause + * authenticate_image() to lockup. Switching off the dcache + * resolves the issue. + * https://community.nxp.com/message/953261 + */ + if (is_soc_type(MXC_SOC_MX7)) + dcache_disable(); + load_addr = (uint32_t)hab_rvt_authenticate_image( HAB_CID_UBOOT, ivt_offset, (void **)&start, (size_t *)&bytes, NULL); + + if (is_soc_type(MXC_SOC_MX7)) + dcache_enable(); + if (hab_rvt_exit() != HAB_SUCCESS) { puts("hab exit function fail\n"); load_addr = 0;