From patchwork Tue Jan 2 16:43:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 123170 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp9177744qgn; Tue, 2 Jan 2018 08:54:22 -0800 (PST) X-Google-Smtp-Source: ACJfBosH93PLkm7LaBNv5mwlIDAPtk4iNLeAI2jMHkaPKQK+u+R/SRc7jsXd+xTbp0kSLwkpi98f X-Received: by 10.80.134.108 with SMTP id 41mr64373609edt.69.1514912062377; Tue, 02 Jan 2018 08:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514912062; cv=none; d=google.com; s=arc-20160816; b=ImE9uZkudXHZb1I4/hgvG1CC/weeqe/HtHcN7PbfTTayNjc+3o1jautIAJpTtwkcKV 0/VrnCIdsHe6ko7X7hj4Tlv2nY/RvUI2Yfl6yie+/0FRrp6aiHggi+f5tRt0LYLNZxYJ SRc2B0Kv6qJknLI71YFSLaHgAt83Zv2+g6cdTqrzL6KlMKafYIEPK4rnszM2KEIR8PhW T+iPkLcMuUgmo3w3MrycMCgnfWQkFcNo+R4+O0Jg5/2gsSgCzKYKYsNoKKQ573rJEOQL 8NJKB9giZkGnA3CR5ibhaGVzx5rCnJUGBwc807+c50LcEzxDg70rlZwz8jGVpYxeniyx e7Pg== 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=djXGts0/hXbKsYbmoGIe/lV+tYIbkMtg6+C4fucUz3BPWG38JJZ5q/C0XZHJPWprDJ 0J9f48RX6PZZqr75yx9jcQpFoBLmLbNUE8CW+O5TLayoTAVznprGlR29SLdDUEg9PXJb 6TPxDcIKhRdmqiv7PJ04wLR/X21BxYMfcG1FAa06sHZMBixtxRrKYr4gNiLWaRLWDYBs z1yMkRg6KYZetfF7HHKaEnL95MWmm+WNnJy7Nc9yDOJcYkikgu/aTi6WXM8zEaLzsGAI ub/XTBWOh5ttGDm0RK4nJCjHPfCjKm+/Dglpc2JzJavZ+SZ8Pzhfw+byShjHPB96NM9/ gAfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SG+QcS/S; 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 5si523705edm.313.2018.01.02.08.54.22; Tue, 02 Jan 2018 08:54:22 -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=SG+QcS/S; 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 F0E7DC21C34; Tue, 2 Jan 2018 16:46:52 +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_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 7A8B7C21E14; Tue, 2 Jan 2018 16:44:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AD798C21CB6; Tue, 2 Jan 2018 16:44:38 +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 4693FC21DAB for ; Tue, 2 Jan 2018 16:44:34 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id y82so16940536wmg.1 for ; Tue, 02 Jan 2018 08:44:34 -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=SG+QcS/SrMV6C7AOn0kgpKVOh8VlrlJFeLFBnAZFWKisK/4bA2O9XjGTpO/QIKuqD/ zzttlQTX9x1smQo83X9xNRzklqUs3cRH5D3GQzat6SnVl/nb3KvBTETtHtOjcJggAh2t nHaC+WbzLaJqEDeZvcvXXSmsLgU2DG2kTPZZ8= 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=RInDWyr024wbiDuHP8eAyaw3WcedqxEBc8rDVU/gcLAJ54cLF/KZ5bpV5JBnNc/vIU flOrqhd4e9nx9j64TrWJ0lfQlb7g3U7kqEB33T6Malh3Kaq95jr6AP6CMZTHKS9uLBWA y92TSCZyBdIPmnTESx5ayB4cDH7PZzereigsKHMR37U7heK508Cxj0QeFbm0LlYX/Szb ndA4ifVr1Mx9KTLQ42wifdfdRJ8LnTZ+0ead/NHCtlcLeR2Zt+g1GzCBnU28YjUVRP+v SCfwJ6DD2UJp9DjYNatQ7/SW3Y6XZ5qBPgfElpOfisgsjtmL/l4VhGz9zJD0R7ynfc1T maDA== X-Gm-Message-State: AKGB3mI1aTgOnnmFOYPbDYbSdoZbhINOVSXOjkt0av/ZvFyzPza9Br9f Y2Zy71nm7cfvxJCca5j88XNK0D9Oaq0= X-Received: by 10.80.165.139 with SMTP id a11mr63786561edc.95.1514911473610; Tue, 02 Jan 2018 08:44:33 -0800 (PST) Received: from localhost.localdomain (D4CCACC7.cm-2.dynamic.ziggo.nl. [212.204.172.199]) by smtp.gmail.com with ESMTPSA id z5sm29850584edh.76.2018.01.02.08.44.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 08:44:32 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Tue, 2 Jan 2018 16:43:54 +0000 Message-Id: <1514911451-4520-9-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514911451-4520-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v4 08/25] 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;