From patchwork Sat Dec 30 01:08:37 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: 122986 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5325285qgn; Fri, 29 Dec 2017 17:26:03 -0800 (PST) X-Google-Smtp-Source: ACJfBovOQmnysUkVVpHydeSDQc1FUJJd0U+cQi0o6aZpHvTQeh6+jHDfM8NxMFJzb41fas3vC8kZ X-Received: by 10.80.184.52 with SMTP id j49mr6035101ede.160.1514597163116; Fri, 29 Dec 2017 17:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514597163; cv=none; d=google.com; s=arc-20160816; b=A7LTNmtM5da8vqG1gJW6iO1RcumWik81YXkUKV4OuK//AtvscwigRCFaoOw0mwK8fp sqMa5y4YYAbY/GbNLvNoHbo980ezI8SsfymHbiB5W9/Qtb9Bph8OTdVlfbjL8EwEYlce 6t3hiGS0fKo8CXnIPG40MWyF1R5CupWni/ON6KI20W0u47XBox5zlMs1mf7lLu78MNwF iz0D0mEr7ERqYfumOw3Ex1csqaoqoOfViSzoQPIV0a3uj/GFAqMgcbveE2XZMHsR2VHo rwlXR8/JG/NMLOVV8z1g+2sScHv31qrc6Q2jzrqPSUPBS4vXuctibyy4lW4Z3Ck/8HlH JbsA== 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=tNC59i4YulZ0PI7ZhDGlF5oIiqba+AmbVqFHxjaYHCDQV1A4/poZvVrMYIE1+ulADV 8zn7C3TAH4ePtKkcvIl/pcj1sjzuT4W2p3lmZPZB/c0/jyu4JR0ZkUcdMj2g3Elo5Rrr L7rmE10cTIWpnZ4vngSsF9nLAQ3kd9o69tZKs2z9WZB2Oz8Sq8nH/OZE9WAMzuVoe8Io G9JtY8qUjeWAVfwl+ftb1h8es9eCz/G/YzWi6beFqvTChwEGtcocpZhfr8i22rXrT54e y0d6cpW05K97+kyXNJBVfjDaG7aK9bA0pDqA2M1Y3YjTroIqSeoclwiLx23O7enV3BKj qCEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PNipkj1H; 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 w1si1913518edk.223.2017.12.29.17.26.02; Fri, 29 Dec 2017 17:26:03 -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=PNipkj1H; 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 89D94C21DCA; Sat, 30 Dec 2017 01:11:56 +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 556F4C21E0A; Sat, 30 Dec 2017 01:09:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 642C5C21DF4; Sat, 30 Dec 2017 01:09:17 +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 A069AC21DA9 for ; Sat, 30 Dec 2017 01:09:13 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id y82so6987272wmg.1 for ; Fri, 29 Dec 2017 17:09:13 -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=PNipkj1H0IE8Xhzlq+8TFAlR4UzPEEqesxjUXh6SKPncqEauFzsakaZafv5j5uXBkB Nq1APxy0LCiqOu9ktPCT4wG1KKLsN0zVByR4Wzla5EVTEwLnkNEbGz9wclFK258iqnN/ Z/Vy39bfA46Sw/um0Bsxym7pNq86I/uIDglIY= 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=t84+vmfd6ilsJD0E0zfBCdPzAzOJpRBF6kH0oPdKAVq5GqefpBYfT61x5nYO2JFWNP HRqT8XAYkS6q4F6StxtINsVy+zsE4X3nrrqLMsyGyHkrxrRAMw5bSBdyK5kCkhjS3iQt GMWZ5aDHymvWzQivIlB6FEAiJbZghf9hWwC1C0+yLV/soGxQj827zACXay2sQPy7klzK dZ5ffEpaZ6NnLgebIcf3he6LQHpT1wcmCpL9L/vjW4LO40dY/q6LbLNRZDIMrdEn31v0 pe9HOTLTYdcP/yN/7aIIuc5qugK51HM07aGzgcQabj9Iunw1/d6BtN8yUtj2Iiwd44Jw W45Q== X-Gm-Message-State: AKGB3mKaLn+L4aYDRqBnN+l3atc3fjtBfXZddCFyip8GPnzT9+Jl9NYu VD+X9SS/PfFTHTTQRg7Hs+HBEUx3uhs= X-Received: by 10.80.241.72 with SMTP id z8mr47866841edl.35.1514596153053; Fri, 29 Dec 2017 17:09:13 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f9sm26484148edm.83.2017.12.29.17.09.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 17:09:12 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, brenomatheus@gmail.com Date: Sat, 30 Dec 2017 01:08:37 +0000 Message-Id: <1514596142-22050-9-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> References: <1514596142-22050-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Fabio Estevam Subject: [U-Boot] [PATCH v3 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;