From patchwork Sat Nov 9 00:40:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 179007 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3509321ilf; Fri, 8 Nov 2019 16:40:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzruCe5E/+xWE0ytPfgaYzDqe7H79Zqre5QgZoQ2baIWGS19uluLe0v+QSfVKCMKhhL9zXz X-Received: by 2002:a50:a2e5:: with SMTP id 92mr7656230edm.195.1573260048727; Fri, 08 Nov 2019 16:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573260048; cv=none; d=google.com; s=arc-20160816; b=D3dZ+qOF924qRGm140D3+ZhZ4YlmrEAyAfd2txuaSB8gVMb7ubpfTi/v9sQ4yVD3Ei 760IIBlJ14cWNOrjzuLh3UBXPJQSGOQfiww8HH58ebgtugZn33bes09CtjeuglfCtRao BKPiRgF6Wx/HPuV2HDD7RECQ+l1nd5aPXRu3zEwgCp4XNFcXGI/GSGt2a9DUvxhKNhsC YtHz+s18WmC4mCHh76R6PoSu6JZg3p78fnI3nnXgH7xU1YKKuZKtlyA/Ql5KKO60EpmZ lRwYYygLCwRIZ2EdC5PyfNYBDPrsIxe9u3VOWIJ9rGmKNVEr7vZ3PsA89vTusq6b9HUx JUkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4W4ty972DPX71Iw49mefl5BsapRNw/bFopLDHz4kFy0=; b=CLnp+TzZCIYzkClvqFpGDfOL00CQS9iasR5kP9fTEch28w2bo1ppp2Bsno0bzNqlIj kyOIAkJCTD5aL2AXMs1JsawWK7FHqYd9bq29F7qaf3EijY49AUPwoRL9x1kNXJCcwdD2 eYdtqEgjbz8W2OoVzb+LHfDSIxqZBo+lNMy5KHNVRyvdOyCxyqGvDBzAQfsxiO3U348v kI0X0qUuGSrafCdokjauIBge82WpHII5D7EuKnciuzZ8BvOiVluJ0NmJ6xYxXfMLYpoe MN6VgyvZcjtlakS3C9kF1spctMUZeM0Coj93MWvKqPJ9nUBv8iuWmvoFPd3PNuv1eaL8 luUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFZtI7nA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si5378008eds.63.2019.11.08.16.40.48; Fri, 08 Nov 2019 16:40:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFZtI7nA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730110AbfKIAkk (ORCPT + 26 others); Fri, 8 Nov 2019 19:40:40 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38261 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729623AbfKIAkj (ORCPT ); Fri, 8 Nov 2019 19:40:39 -0500 Received: by mail-pf1-f195.google.com with SMTP id c13so6147743pfp.5 for ; Fri, 08 Nov 2019 16:40:39 -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 :mime-version:content-transfer-encoding; bh=4W4ty972DPX71Iw49mefl5BsapRNw/bFopLDHz4kFy0=; b=CFZtI7nAK1OzKUd0yQ8Ucz4zhcGHsvZXBa7pbCuF3Iw5ce+GN2RnxFaThLYdKjRr4N VUOWWPrciOcC6LB7ds6ZMWBV41BBKZCFw/huTrjo8WUNmqrA3hb8h+mdz9ssZnetIUJM W4TiVcCV5GVpmG2UJyCQhCOjLVGjLURU/WRYkl/Rf3eKyi0FcppC8jK7UFj4WqgslSPZ yvIKApcRA0PtNPP6198Oph7PibWznozNKCdeQWC/BD6ZgH3SRSH1RIKKudkonFZyP3gr N3zFICoIEtiVzPwzU8ablbXLkEPWGFrH05XlWnxra9TmzATq5qEUzYh5zABljevOW8mW uOMw== 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:mime-version:content-transfer-encoding; bh=4W4ty972DPX71Iw49mefl5BsapRNw/bFopLDHz4kFy0=; b=Igod96IkbyVdgDhZ0eJC9Nt11IVCsxG0dqMK/3Nwt7WMiOMev+Q6jMx0BJ3kuz03Uq h5mtMTSFJeTUPZv8MvDAaNTlRUKVAp5iBk9rFef2YahaLuaEcMyjoTTplrKY9CljFuQS +GqR66xJDG9jcA6yfOdjZjt9WLRdt5y5OfgiRAgBhdswcPTv9Wkky81Vt0AGBAA7ai3h XBF13uGuLOZwer6QxAdFZ/aMczILdplTX6d2cJ1alDnDJqzyMbVSpUT5Pz/S6d1Pw1U8 JF1207Qb3zIrqnNm89+cHZl5eLEG6UUsAjOpu4ORlr9Nae38LEm9CjDiGvmKEUYl+C8g Cckg== X-Gm-Message-State: APjAAAU0zZhIr1kMQ76IdIBHF4oT5PE28P+esv6EbDHq7vJFEuOn3JRb /bO6S/JH7yFZsSOKEfF5+JXezA== X-Received: by 2002:a63:5511:: with SMTP id j17mr4827052pgb.70.1573260038698; Fri, 08 Nov 2019 16:40:38 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id y36sm6681461pgk.66.2019.11.08.16.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2019 16:40:38 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson , Avaneesh Kumar Dwivedi Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Jeffrey Hugo , stable@vger.kernel.org Subject: [PATCH v2 1/2] remoteproc: qcom_q6v5_mss: Don't reassign mpss region on shutdown Date: Fri, 8 Nov 2019 16:40:32 -0800 Message-Id: <20191109004033.1496871-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191109004033.1496871-1-bjorn.andersson@linaro.org> References: <20191109004033.1496871-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Trying to reclaim mpss memory while the mba is not running causes the system to crash on devices with security fuses blown, so leave it assigned to the remote on shutdown and recover it on a subsequent boot. Fixes: 6c5a9dc2481b ("remoteproc: qcom: Make secure world call for mem ownership switch") Cc: stable@vger.kernel.org Signed-off-by: Bjorn Andersson --- Changes since v1: - Assign memory back to Linux in coredump case drivers/remoteproc/qcom_q6v5_mss.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.23.0 Reviewed-by: Jeffrey Hugo Tested-by: Jeffrey Hugo diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index de919f2e8b94..efab574b2e12 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -875,11 +875,6 @@ static void q6v5_mba_reclaim(struct q6v5 *qproc) writel(val, qproc->reg_base + QDSP6SS_PWR_CTL_REG); } - ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, - false, qproc->mpss_phys, - qproc->mpss_size); - WARN_ON(ret); - q6v5_reset_assert(qproc); q6v5_clk_disable(qproc->dev, qproc->reset_clks, @@ -969,6 +964,10 @@ static int q6v5_mpss_load(struct q6v5 *qproc) max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K); } + /* Try to reset ownership back to Linux */ + q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, false, + qproc->mpss_phys, qproc->mpss_size); + mpss_reloc = relocate ? min_addr : qproc->mpss_phys; qproc->mpss_reloc = mpss_reloc; /* Load firmware segments */ @@ -1058,9 +1057,14 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc, void *ptr = rproc_da_to_va(rproc, segment->da, segment->size); /* Unlock mba before copying segments */ - if (!qproc->dump_mba_loaded) + if (!qproc->dump_mba_loaded) { ret = q6v5_mba_load(qproc); + /* Try to reset ownership back to Linux */ + q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, false, + qproc->mpss_phys, qproc->mpss_size); + } + if (!ptr || ret) memset(dest, 0xff, segment->size); else @@ -1111,10 +1115,6 @@ static int q6v5_start(struct rproc *rproc) return 0; reclaim_mpss: - xfermemop_ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm, - false, qproc->mpss_phys, - qproc->mpss_size); - WARN_ON(xfermemop_ret); q6v5_mba_reclaim(qproc); return ret;