From patchwork Fri Dec 27 05:32:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 182472 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp2565343ild; Thu, 26 Dec 2019 21:32:55 -0800 (PST) X-Google-Smtp-Source: APXvYqzjvQq/GxUbaBQC9NP8+FFg2GQhI3iexqgeSBxUZIr0F2ZBNK9o03PYriUN3JD6uiFWO6VB X-Received: by 2002:a05:6830:4c2:: with SMTP id s2mr56836419otd.144.1577424775564; Thu, 26 Dec 2019 21:32:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577424775; cv=none; d=google.com; s=arc-20160816; b=sD5epHFyxqKfImTJDw6SQvV1LyiDUpDLeaKQw+xHbVJ6SCeILWXe0LdNiSZfZbZb1w IOVxBFtbn+6fTWhylSluJ2bi/woQBv9T+X9goYEwZh4DCaFZ1UVUCu2VBKZPjXsZ6TNy 4DxJDMd8deHo/xSKH8GTHruCIh2janpUnYuXBal9H8gtL6T29xzc8ZcDmGggAwHuZocR PKxDPGnHJov1Ep2m8HoT8C2hZ0xK3l+Lj8cnIQi9ZvIE6unlxOjAWh0TkcuRiYC+9/tg FpV9Emv5LQJQxRGHT+SAuPfVSR3s9TFyz3sCrbK8mH8ono6ys21sebhewFwBgkqiD3wr AEPg== 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=KhIB3J48uWNcyBCDKSxDbyte5ZCMNiiAYIqCxmaTVF8=; b=HE1vyEPolmsh2dOGi4OyAVnEAJsq2BCcO7+82WVupMFYqQx5JqRwzpnB0I7bRFRvJN zQUWeG5hRXtyI/A0VVODVRwphjK6WZNAb3jgW92eW2mfSD9aoileCi6Z8IAPXaYZBL6l fX9XG4mByZlLGIKIG/p/Vw7beyejFZFtMKWluBTnN3+22or7nszX4Xf+5PvQaobdMIrO vGffSTajpNXMUEvkkbDeELN1U+AMoXose08SXLYfsK+byxxk6VTEVpzydZGkymeuGjFE 74bipTPznVLNon5qXMeuf7FpYheslKuw/U1x2lRLTDoN2nvT8RxkqTmVxxH6kZQRdb/5 5pYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D9TRMYLR; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 s20si13499435otq.28.2019.12.26.21.32.55; Thu, 26 Dec 2019 21:32:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=D9TRMYLR; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726509AbfL0Fcy (ORCPT + 15 others); Fri, 27 Dec 2019 00:32:54 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:34625 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfL0Fcx (ORCPT ); Fri, 27 Dec 2019 00:32:53 -0500 Received: by mail-pj1-f65.google.com with SMTP id s94so2757476pjc.1 for ; Thu, 26 Dec 2019 21:32:52 -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=KhIB3J48uWNcyBCDKSxDbyte5ZCMNiiAYIqCxmaTVF8=; b=D9TRMYLRO0qmQ6tzR+00FFi922Pf7WqH7oQS//ctW8vn+qc3XIO3rLm0lB7tNoyqCi krg1l9HwON48ELklqViMesQEmrckOA2OXC6n3ZEW/hR4AUVQCqbb37Vz9nKeSsPsleSB rkOggHA20LBrijMn+F4xV28LeXWK6aQ9VRXk8LQV/26RnVSHApcm5a1ea9M9d9okkqTJ cipzvRT4XPWhvzsuhQ5C7Rg/dasMWro3SODOBKj+hFhVPl4uXMGgQXw5H7YiPTo4fQ1Z pD7OmuBKX2TibrC5sY/zZZrQSPItOFbu6q1Aa3gYAr+693rAja2eroa9jdHxaQIzL2e9 LCCA== 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=KhIB3J48uWNcyBCDKSxDbyte5ZCMNiiAYIqCxmaTVF8=; b=ukmR0WJNFWBaNuP8aK184ES9FlosujqMjQ4yTjtCqpKoUVsU3smwRcnGq2FP+6kahK p2Wp4DGyq2CVIPFmW3Bq+rjVS1wYj6PQPKqQO8Cgsk9b3aLOordBFpKIHV0nGEOmCWaa USLT2vfhg3oaSUV1ba83moD6iPUKdUiGZhvIz0kN7IYn0W8UxZR44MwRLO6bwuxO9lkR Vs5ZLQGSy6PQu1xiFDffDRMu/jYPO7K59OApnN0sWP2RChsAibQ6YOygFXluAC4GDD/Q /nEoJmLRXagigjzx9kAgwOJO1mA21/j5kLgolJn5EBktVBLlyzj7gKw/oL2S8HlL2SsC FHCA== X-Gm-Message-State: APjAAAVQ8HyZInoOrBj6u6BgtFi3QkPgQKC8IHpYj6QLqHTYrq6KPzyI z/+qNs3M4J9w3JjgzoiAMbiqDg== X-Received: by 2002:a17:90b:1110:: with SMTP id gi16mr23080226pjb.110.1577424772331; Thu, 26 Dec 2019 21:32:52 -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 c22sm16789196pfo.50.2019.12.26.21.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:32:51 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 1/8] dt-bindings: remoteproc: Add Qualcomm PIL info binding Date: Thu, 26 Dec 2019 21:32:08 -0800 Message-Id: <20191227053215.423811-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a devicetree binding for the Qualcomm periperal image loader relocation info region found in the IMEM. Signed-off-by: Bjorn Andersson --- Changes since v1: - New patch .../bindings/remoteproc/qcom,pil-info.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml -- 2.24.0 diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml new file mode 100644 index 000000000000..715945c683ed --- /dev/null +++ b/Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/remoteproc/qcom,pil-info.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm peripheral image loader relocation info binding + +description: + This document defines the binding for describing the Qualcomm peripheral + image loader relocation memory region, in IMEM, which is used for post mortem + debugging of remoteprocs. + +maintainers: + - Bjorn Andersson + +properties: + compatible: + const: qcom,pil-reloc-info + + offset: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Offset in the register map for the memory region + +examples: + - | + imem@146bf000 { + compatible = "syscon", "simple-mfd"; + reg = <0 0x146bf000 0 0x1000>; + + pil-reloc { + compatible ="qcom,pil-reloc-info"; + offset = <0x94c>; + }; + }; From patchwork Fri Dec 27 05:32:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 190845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7577DC2D0C3 for ; Fri, 27 Dec 2019 05:33:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40B7D20828 for ; Fri, 27 Dec 2019 05:33:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ys4E5Ao0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726197AbfL0Fda (ORCPT ); Fri, 27 Dec 2019 00:33:30 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35378 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbfL0Fcy (ORCPT ); Fri, 27 Dec 2019 00:32:54 -0500 Received: by mail-pg1-f196.google.com with SMTP id l24so13936327pgk.2 for ; Thu, 26 Dec 2019 21:32: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 :mime-version:content-transfer-encoding; bh=akm4NfbJgAiIEKZHJ9zU6ThCpH8qtZ85+rrJ2Ji+w5w=; b=Ys4E5Ao0K33XCaNhJOZNGG9eB1LVmFEVbNik0eOadjtEdYVBg6XfirjuF26rOWP7wJ selaNF1Ku4vVNw3OPr/T4qBYMpvnbsD/vACg2AoSzOqhD3Eql1k/x84vD8Z7NaaXpOso twlspk/MZzFumGdwATJ+bq6wfL+RC/8BUi3ofUp6SMVYBwL3kHF3fNXw9lTzE+sPOfg1 687E6VVlhERlRsvlslt/q+aG7LpxIK3ZR2gf+h2HUe9uaH5s9tkVTSEwa8AFSC08nziy 9tosGaNqpkLQ5fKQ4AvHf2m2vgwGPZZQJanxHaVxlJ/85qMML5RMWtHxqtQ6uSGaYtU4 iQIg== 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=akm4NfbJgAiIEKZHJ9zU6ThCpH8qtZ85+rrJ2Ji+w5w=; b=P2wix5X8Ogh8w6gQFYJeGf5ceAyigpHmwudCZmaCijENg6RY2B03hkOYuBIvNXAzlS ID/q3b9NGNRhbGA47Bt14/ZOeZJ4w+Qd7Y0d0EA0YFbWV5w1hsActtU6iXSdRuXuU9aF Lj2zYmIqVc2P3GBG5Y5DCmevjJ0n3fmSnQ66yEo/EkXD2lrhKvRFzR/jgzB6ww00EHkv 0zEQ5LuifUOVtOsRriJK2+G5YFZZY73AOQCSkwsOUx+sjUJYMN79dOmsj1qLA/O52Egz REozEvSugOXbsyr0a9tj8yyhyjLjFK3SZPfsHD/+HotKqVs2tmI8NwDChrWqNBYNN2v4 aiyA== X-Gm-Message-State: APjAAAVZPGbsZiJMQmTEO249e5GUCrbM4pafHknLnF8Wbz1d3oE5bdDI jARY6TGJ052lFwZyFIG7oZMsxQ== X-Google-Smtp-Source: APXvYqx+CMgYDl2dX4FUqA6dWXrSXTak++ViDH+hxj2wzDWUo0+9QhqR8sb9VKaph1DKqH2BCOwxLg== X-Received: by 2002:a63:5809:: with SMTP id m9mr51181799pgb.26.1577424773541; Thu, 26 Dec 2019 21:32:53 -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 c22sm16789196pfo.50.2019.12.26.21.32.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:32:53 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 2/8] remoteproc: qcom: Introduce driver to store pil info in IMEM Date: Thu, 26 Dec 2019 21:32:09 -0800 Message-Id: <20191227053215.423811-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org A region in IMEM is used to communicate load addresses of remoteproc to post mortem debug tools. Implement a driver that can be used to store this information in order to enable these tools to process collected ramdumps. Signed-off-by: Bjorn Andersson --- Changes since v1: - Added helper to probe defer clients - Fixed logical bug in slot scan - Added SPDX header in header file drivers/remoteproc/Kconfig | 3 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_pil_info.c | 150 +++++++++++++++++++++++++++++ drivers/remoteproc/qcom_pil_info.h | 8 ++ 4 files changed, 162 insertions(+) create mode 100644 drivers/remoteproc/qcom_pil_info.c create mode 100644 drivers/remoteproc/qcom_pil_info.h diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 94afdde4bc9f..0798602e355a 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -85,6 +85,9 @@ config KEYSTONE_REMOTEPROC It's safe to say N here if you're not interested in the Keystone DSPs or just want to use a bare minimum kernel. +config QCOM_PIL_INFO + tristate + config QCOM_RPROC_COMMON tristate diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile index 00f09e658cb3..c1b46e9033cb 100644 --- a/drivers/remoteproc/Makefile +++ b/drivers/remoteproc/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o obj-$(CONFIG_WKUP_M3_RPROC) += wkup_m3_rproc.o obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o obj-$(CONFIG_KEYSTONE_REMOTEPROC) += keystone_remoteproc.o +obj-$(CONFIG_QCOM_PIL_INFO) += qcom_pil_info.o obj-$(CONFIG_QCOM_RPROC_COMMON) += qcom_common.o obj-$(CONFIG_QCOM_Q6V5_COMMON) += qcom_q6v5.o obj-$(CONFIG_QCOM_Q6V5_ADSP) += qcom_q6v5_adsp.o diff --git a/drivers/remoteproc/qcom_pil_info.c b/drivers/remoteproc/qcom_pil_info.c new file mode 100644 index 000000000000..b0897ae9eae5 --- /dev/null +++ b/drivers/remoteproc/qcom_pil_info.c @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2019 Linaro Ltd. + */ +#include +#include +#include +#include +#include +#include +#include +#include + +struct pil_reloc_entry { + char name[8]; + __le64 base; + __le32 size; +} __packed; + +#define PIL_INFO_SIZE 200 +#define PIL_INFO_ENTRIES (PIL_INFO_SIZE / sizeof(struct pil_reloc_entry)) + +struct pil_reloc { + struct device *dev; + struct regmap *map; + u32 offset; + int val_bytes; + + struct pil_reloc_entry entries[PIL_INFO_ENTRIES]; +}; + +static struct pil_reloc *_reloc; +static DEFINE_MUTEX(reloc_mutex); + +/** + * qcom_pil_info_store() - store PIL information of image in IMEM + * @image: name of the image + * @base: base address of the loaded image + * @size: size of the loaded image + */ +void qcom_pil_info_store(const char *image, phys_addr_t base, size_t size) +{ + struct pil_reloc_entry *entry; + int idx = -1; + int i; + + mutex_lock(&reloc_mutex); + if (!_reloc) + goto unlock; + + for (i = 0; i < PIL_INFO_ENTRIES; i++) { + if (!_reloc->entries[i].name[0]) { + if (idx == -1) + idx = i; + continue; + } + + if (!strncmp(_reloc->entries[i].name, image, 8)) { + idx = i; + goto found; + } + } + + if (idx == -1) { + dev_warn(_reloc->dev, "insufficient PIL info slots\n"); + goto unlock; + } + +found: + entry = &_reloc->entries[idx]; + stracpy(entry->name, image); + entry->base = base; + entry->size = size; + + regmap_bulk_write(_reloc->map, _reloc->offset + idx * sizeof(*entry), + entry, sizeof(*entry) / _reloc->val_bytes); + +unlock: + mutex_unlock(&reloc_mutex); +} +EXPORT_SYMBOL_GPL(qcom_pil_info_store); + +/** + * qcom_pil_info_available() - query if the pil info is probed + * + * Return: boolean indicating if the pil info device is probed + */ +bool qcom_pil_info_available(void) +{ + return !!_reloc; +} +EXPORT_SYMBOL_GPL(qcom_pil_info_available); + +static int pil_reloc_probe(struct platform_device *pdev) +{ + struct pil_reloc *reloc; + + reloc = devm_kzalloc(&pdev->dev, sizeof(*reloc), GFP_KERNEL); + if (!reloc) + return -ENOMEM; + + reloc->dev = &pdev->dev; + reloc->map = syscon_node_to_regmap(pdev->dev.parent->of_node); + if (IS_ERR(reloc->map)) + return PTR_ERR(reloc->map); + + if (of_property_read_u32(pdev->dev.of_node, "offset", &reloc->offset)) + return -EINVAL; + + reloc->val_bytes = regmap_get_val_bytes(reloc->map); + if (reloc->val_bytes < 0) + return -EINVAL; + + regmap_bulk_write(reloc->map, reloc->offset, reloc->entries, + sizeof(reloc->entries) / reloc->val_bytes); + + mutex_lock(&reloc_mutex); + _reloc = reloc; + mutex_unlock(&reloc_mutex); + + return 0; +} + +static int pil_reloc_remove(struct platform_device *pdev) +{ + mutex_lock(&reloc_mutex); + _reloc = NULL; + mutex_unlock(&reloc_mutex); + + return 0; +} + +static const struct of_device_id pil_reloc_of_match[] = { + { .compatible = "qcom,pil-reloc-info" }, + {} +}; +MODULE_DEVICE_TABLE(of, pil_reloc_of_match); + +static struct platform_driver pil_reloc_driver = { + .probe = pil_reloc_probe, + .remove = pil_reloc_remove, + .driver = { + .name = "qcom-pil-reloc-info", + .of_match_table = pil_reloc_of_match, + }, +}; +module_platform_driver(pil_reloc_driver); + +MODULE_DESCRIPTION("Qualcomm PIL relocation info"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/remoteproc/qcom_pil_info.h b/drivers/remoteproc/qcom_pil_info.h new file mode 100644 index 000000000000..0372602fae1d --- /dev/null +++ b/drivers/remoteproc/qcom_pil_info.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __QCOM_PIL_INFO_H__ +#define __QCOM_PIL_INFO_H__ + +void qcom_pil_info_store(const char *image, phys_addr_t base, size_t size); +bool qcom_pil_info_available(void); + +#endif From patchwork Fri Dec 27 05:32:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 182473 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp2565368ild; Thu, 26 Dec 2019 21:32:58 -0800 (PST) X-Google-Smtp-Source: APXvYqw30r7hbQXvC8sl0kZq08s8B3jS5dGSb+umAUOARyi54wH7XTu5XOGd5ez8yLTABzaEG4HR X-Received: by 2002:a9d:198b:: with SMTP id k11mr24718682otk.295.1577424778038; Thu, 26 Dec 2019 21:32:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577424778; cv=none; d=google.com; s=arc-20160816; b=xTbGnDF6u90CNSpEh3fTHWMZc/J/5QpHUz9Y4ciaG1sDUTIIujs1lK/XdWRZtLCYO0 imKBV3VfpDzw8NZVelBBClKfj4kzARz2S4GMmelnP9o95kXQI3F22lhGPyHaQmW5N0Yd +WFrTTF3b4z7GcU9LtJ/40YaYHmOnC5dopdwaKHjFEqf5/wiN4SnTosBRY+3ZVDjsb3n veT+LKjJcvvVyRVNhUDqKkVeT8DmouG5c5YTuuXUAr8F4O/FGbQDgZliHWm71/hZVpjq YYMfTISxcPCbHemYD4fABVNN2hJnbMqJBKhePyRZcm2KUX65k831vgYvsQHOpVRZtQAB cSHA== 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=jKMF6uBNrPyaDHjt3Kcmux54cHtpMt403dvEuafKDBE=; b=OhZnuOnsTFbH335qxWGaC9XCR/da+lqWcH/w7i+XOuwu9J5u3rhlbgvLzCta9b5TT4 JQIDoHV40c5LCCFeuVThPvGn+FrTv2nrfzd4eYI1FH17ab3Y/hJh3H6Ixih7DBW5f98S DBcQuaRRy1E0pUg7J7BnlEAzElteBkgbVtoPb1bJ1OFqkb5Svl/59sxli9ZLusWoP0ow u07sPGXXkiCqr6BBBHBomJI/swpWSQXiCpP4iROSkuRo7pC2bioJhcEVFnaZKrSp7SyY JftT3lnQBzWGFD0DR9WEL/dFyis8wf125JdM/i7ThdQrDie5m257/rLsoxTUmpP2ayf8 cDOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tifjye4W; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 l11si8065416oie.231.2019.12.26.21.32.57; Thu, 26 Dec 2019 21:32:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=Tifjye4W; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726720AbfL0Fc4 (ORCPT + 15 others); Fri, 27 Dec 2019 00:32:56 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:36831 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726658AbfL0Fcz (ORCPT ); Fri, 27 Dec 2019 00:32:55 -0500 Received: by mail-pj1-f66.google.com with SMTP id n59so4446041pjb.1 for ; Thu, 26 Dec 2019 21:32:55 -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=jKMF6uBNrPyaDHjt3Kcmux54cHtpMt403dvEuafKDBE=; b=Tifjye4WiU0ZIbMPPtgEI8rkJueLJxiDPxnJBraxFLK9XjeukMxMWo2ioIfHTvSPLt qCUKoi966MNpsb6XfoB9hJJDo0cmD+dk9uYUd8usMC2Ac/eBKlacEfZx5xH5lOWHrORJ s8hlozamOj9hQX5drLkwqPkkIv7yG3KwPQWUsLYtwn3izYotZYSOYABfvGJv7VQ80nzs +yUwlAmJeaEJTdFl6JWJnxEZbrK1vmjhXI70BdsTqUqbSpIOZH8wOby7yOq78piiDAqM DF4WiOXrZXGgVRpnsDw7/x79jzlNTMVCK6HO+nisv9veKKC6Jh9NffSrWXjLYSQ8l1rc DAmA== 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=jKMF6uBNrPyaDHjt3Kcmux54cHtpMt403dvEuafKDBE=; b=JJmtOoXuPpVdMV5y2qqULvKzcJ1JlkpYkpQ7Yu7E3sEh8JZqa2hACsiBS0o4k860tz BcfGBBmbswsBdGgwc2Fo/ISj1K9y5XjGUg9dWtEWCOdUXmKm6ANvGnJhVMfelpTQQpRD IuGToKejZJ277VIlwGduSDhqhgxiF1L2k/1RhRNBrWikWqP7NBHPSU4tKK2MYHrVHHWB /c/C3BJnOvmyj9BUkwN28E2p9ACP+5wryUAPfLMQztbNlBEsiCIBP8nWG/5CrHA5VPT1 9LgQ7px/f1Frw8423Sglgtt/+hXurL7XNQKjBA4KN4iUDYRQtq3z/bL3T8wCK8pi6MsE G2gQ== X-Gm-Message-State: APjAAAVRW/9rwWPYZg46QtVT6t+zAX9iqpkiiPLHxqz9wF2AtBQKcYEd VAlU0K0IdyPz9Jb4tsq1Hrnl7g== X-Received: by 2002:a17:90a:8043:: with SMTP id e3mr23415453pjw.24.1577424774898; Thu, 26 Dec 2019 21:32:54 -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 c22sm16789196pfo.50.2019.12.26.21.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:32:54 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 3/8] remoteproc: qcom: Update IMEM PIL info on load Date: Thu, 26 Dec 2019 21:32:10 -0800 Message-Id: <20191227053215.423811-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Update the PIL info region structure in IMEM with information about where the firmware for various remoteprocs are loaded. Signed-off-by: Bjorn Andersson --- Changes since v1: - Squashed patches for the individual drivers into one - Probe defer on qcom_pil_info_available() drivers/remoteproc/Kconfig | 3 +++ drivers/remoteproc/qcom_q6v5_adsp.c | 19 ++++++++++++++++--- drivers/remoteproc/qcom_q6v5_mss.c | 6 ++++++ drivers/remoteproc/qcom_q6v5_pas.c | 18 +++++++++++++++--- drivers/remoteproc/qcom_wcnss.c | 17 ++++++++++++++--- 5 files changed, 54 insertions(+), 9 deletions(-) -- 2.24.0 diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 0798602e355a..84922bb922e0 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -135,6 +135,7 @@ config QCOM_Q6V5_PAS depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n depends on QCOM_SYSMON || QCOM_SYSMON=n select MFD_SYSCON + select QCOM_PIL_INFO select QCOM_MDT_LOADER select QCOM_Q6V5_COMMON select QCOM_RPROC_COMMON @@ -152,6 +153,7 @@ config QCOM_Q6V5_WCSS depends on RPMSG_QCOM_GLINK_SMEM || RPMSG_QCOM_GLINK_SMEM=n depends on QCOM_SYSMON || QCOM_SYSMON=n select MFD_SYSCON + select QCOM_PIL_INFO select QCOM_MDT_LOADER select QCOM_Q6V5_COMMON select QCOM_RPROC_COMMON @@ -183,6 +185,7 @@ config QCOM_WCNSS_PIL depends on QCOM_SMEM depends on QCOM_SYSMON || QCOM_SYSMON=n select QCOM_MDT_LOADER + select QCOM_PIL_INFO select QCOM_RPROC_COMMON select QCOM_SCM help diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index e953886b2eb7..1a942c92d974 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -26,6 +26,7 @@ #include #include "qcom_common.h" +#include "qcom_pil_info.h" #include "qcom_q6v5.h" #include "remoteproc_internal.h" @@ -82,6 +83,7 @@ struct qcom_adsp { unsigned int halt_lpass; int crash_reason_smem; + const char *info_name; struct completion start_done; struct completion stop_done; @@ -164,10 +166,17 @@ static int qcom_adsp_shutdown(struct qcom_adsp *adsp) static int adsp_load(struct rproc *rproc, const struct firmware *fw) { struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + int ret; + + ret = qcom_mdt_load_no_init(adsp->dev, fw, rproc->firmware, 0, + adsp->mem_region, adsp->mem_phys, adsp->mem_size, + &adsp->mem_reloc); + if (ret) + return ret; - return qcom_mdt_load_no_init(adsp->dev, fw, rproc->firmware, 0, - adsp->mem_region, adsp->mem_phys, adsp->mem_size, - &adsp->mem_reloc); + qcom_pil_info_store(adsp->info_name, adsp->mem_reloc, adsp->mem_size); + + return 0; } static int adsp_start(struct rproc *rproc) @@ -413,6 +422,9 @@ static int adsp_probe(struct platform_device *pdev) struct rproc *rproc; int ret; + if (!qcom_pil_info_available()) + return -EPROBE_DEFER; + desc = of_device_get_match_data(&pdev->dev); if (!desc) return -EINVAL; @@ -427,6 +439,7 @@ static int adsp_probe(struct platform_device *pdev) adsp = (struct qcom_adsp *)rproc->priv; adsp->dev = &pdev->dev; adsp->rproc = rproc; + adsp->info_name = desc->sysmon_name; platform_set_drvdata(pdev, adsp); ret = adsp_alloc_memory_region(adsp); diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 471128a2e723..6360e69b54e4 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -28,6 +28,7 @@ #include "remoteproc_internal.h" #include "qcom_common.h" +#include "qcom_pil_info.h" #include "qcom_q6v5.h" #include @@ -1052,6 +1053,8 @@ static int q6v5_mpss_load(struct q6v5 *qproc) else if (ret < 0) dev_err(qproc->dev, "MPSS authentication failed: %d\n", ret); + qcom_pil_info_store("modem", mpss_reloc, qproc->mpss_size); + release_firmware: release_firmware(fw); out: @@ -1400,6 +1403,9 @@ static int q6v5_probe(struct platform_device *pdev) if (desc->need_mem_protection && !qcom_scm_is_available()) return -EPROBE_DEFER; + if (!qcom_pil_info_available()) + return -EPROBE_DEFER; + mba_image = desc->hexagon_mba_image; ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name", 0, &mba_image); diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index b890e6e305f3..4dcdf1301e50 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -25,6 +25,7 @@ #include #include "qcom_common.h" +#include "qcom_pil_info.h" #include "qcom_q6v5.h" #include "remoteproc_internal.h" @@ -64,6 +65,7 @@ struct qcom_adsp { int pas_id; int crash_reason_smem; bool has_aggre2_clk; + const char *info_name; struct completion start_done; struct completion stop_done; @@ -117,11 +119,17 @@ static void adsp_pds_disable(struct qcom_adsp *adsp, struct device **pds, static int adsp_load(struct rproc *rproc, const struct firmware *fw) { struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + int ret; + + ret = qcom_mdt_load(adsp->dev, fw, rproc->firmware, adsp->pas_id, + adsp->mem_region, adsp->mem_phys, adsp->mem_size, + &adsp->mem_reloc); + if (ret) + return ret; - return qcom_mdt_load(adsp->dev, fw, rproc->firmware, adsp->pas_id, - adsp->mem_region, adsp->mem_phys, adsp->mem_size, - &adsp->mem_reloc); + qcom_pil_info_store(adsp->info_name, adsp->mem_reloc, adsp->mem_size); + return 0; } static int adsp_start(struct rproc *rproc) @@ -376,6 +384,9 @@ static int adsp_probe(struct platform_device *pdev) if (!qcom_scm_is_available()) return -EPROBE_DEFER; + if (!qcom_pil_info_available()) + return -EPROBE_DEFER; + fw_name = desc->firmware_name; ret = of_property_read_string(pdev->dev.of_node, "firmware-name", &fw_name); @@ -396,6 +407,7 @@ static int adsp_probe(struct platform_device *pdev) adsp->rproc = rproc; adsp->pas_id = desc->pas_id; adsp->has_aggre2_clk = desc->has_aggre2_clk; + adsp->info_name = desc->sysmon_name; platform_set_drvdata(pdev, adsp); ret = adsp_alloc_memory_region(adsp); diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index dc135754bb9c..2c1cefeacf97 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -27,6 +27,7 @@ #include "qcom_common.h" #include "remoteproc_internal.h" +#include "qcom_pil_info.h" #include "qcom_wcnss.h" #define WCNSS_CRASH_REASON_SMEM 422 @@ -145,10 +146,17 @@ void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss, static int wcnss_load(struct rproc *rproc, const struct firmware *fw) { struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv; + int ret; + + ret = qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID, + wcnss->mem_region, wcnss->mem_phys, + wcnss->mem_size, &wcnss->mem_reloc); + if (ret) + return ret; - return qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID, - wcnss->mem_region, wcnss->mem_phys, - wcnss->mem_size, &wcnss->mem_reloc); + qcom_pil_info_store("wcnss", wcnss->mem_reloc, wcnss->mem_size); + + return 0; } static void wcnss_indicate_nv_download(struct qcom_wcnss *wcnss) @@ -469,6 +477,9 @@ static int wcnss_probe(struct platform_device *pdev) if (!qcom_scm_is_available()) return -EPROBE_DEFER; + if (!qcom_pil_info_available()) + return -EPROBE_DEFER; + if (!qcom_scm_pas_supported(WCNSS_PAS_ID)) { dev_err(&pdev->dev, "PAS is not available for WCNSS\n"); return -ENXIO; From patchwork Fri Dec 27 05:32:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 190846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEF2AC2D0C3 for ; Fri, 27 Dec 2019 05:33:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A60F7208C4 for ; Fri, 27 Dec 2019 05:33:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ylrRXdCY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727126AbfL0FdN (ORCPT ); Fri, 27 Dec 2019 00:33:13 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37350 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727047AbfL0Fc6 (ORCPT ); Fri, 27 Dec 2019 00:32:58 -0500 Received: by mail-pl1-f196.google.com with SMTP id c23so11306568plz.4 for ; Thu, 26 Dec 2019 21:32:57 -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=CACSvkGQXTdbudbrDCr3GVf27K5HI0XInZ9uwni3MXE=; b=ylrRXdCYJxPFdRcRwT43YU9htEJXb3RZq6jzea19OthZoBfBd4m9/gGbj4femDTUv9 KuHvQ1v0+LGkzmPlgXvWU7wHnTpPl0y44bxs+RtiWMm9fZ1ZzxaCPIC+3ueLS5NsksXo lExY7XfeYQ1d4pHEXWPRCzBhgaFLJ0FYq/24nd33ipvfzcmOmxessAFWP8ki5PzrQi+z wvJ8T//luOhE3WHswVoW8CxcF3xrwCvJRWWm5/6FwIdkW4qzkPTNIZm/IOoAu0ll8/4F CNZprkIcdhzbDBj0VccAJpBfZc/0WSl0tCd5Jnp9ljcIrqoX7W0Ujo+pL3dADh5IOv0M gfew== 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=CACSvkGQXTdbudbrDCr3GVf27K5HI0XInZ9uwni3MXE=; b=AHxU5rXwlhKlE2ppk/mdeFysUDevjNSkPr5TAqHFQHbtcmhdM2sOiQQH7wkfzJW9Gq UDu7oIEzHBhajsVZUCifLdF9NIInEuH/HRATKJDvArWrXXLg5f6A9+23tGanEdFfSa6S eq9zepR/khUvuTRdBm5AF4JQ+RLcmkKG5FNBCZa7Bx7WNG2pJZW+UE8BzL7mTs/TAR0a UoKnX7aVGsxiQRAaMQod3Gjozauq7mfcHyH+pIInfyktQU9rnE1HB0rzccIun9RcaA8y 0zsrYEs4FsiGQHSJup4AfeO0/hyp/gwbzsEDW4nA43Mc4t+91+1ujAW5ZZDU4VTUYPjg CZ8A== X-Gm-Message-State: APjAAAW2db7mMtwv32UpMD7Ip+85wHdKAM0A6nmods+j+GAFv04CwMg8 1vQHDzNWKoz/3t5A8HLbuFlMeQ== X-Google-Smtp-Source: APXvYqwDC4IXipZ7ZUqmtRfUXBo5/Wl/A9WtrtL7RUaMcfUiAMm6gLsuotO/cQTVmLuhTHt1j7S+SQ== X-Received: by 2002:a17:90a:8912:: with SMTP id u18mr23852528pjn.64.1577424777538; Thu, 26 Dec 2019 21:32:57 -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 c22sm16789196pfo.50.2019.12.26.21.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:32:56 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 5/8] arm64: dts: qcom: sdm845: Add IMEM and PIL info region Date: Thu, 26 Dec 2019 21:32:12 -0800 Message-Id: <20191227053215.423811-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a simple-mfd representing IMEM on SDM845 and define the PIL relocation info region, so that post mortem tools will be able to locate the loaded remoteprocs. Signed-off-by: Bjorn Andersson --- Changes since v1: - None arch/arm64/boot/dts/qcom/sdm845.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index 407d26e92fcc..e1e13d5bfeb3 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -3020,6 +3020,16 @@ spmi_bus: spmi@c440000 { cell-index = <0>; }; + imem@146bf000 { + compatible = "syscon", "simple-mfd"; + reg = <0 0x146bf000 0 0x1000>; + + pil-reloc { + compatible ="qcom,pil-reloc-info"; + offset = <0x94c>; + }; + }; + apps_smmu: iommu@15000000 { compatible = "qcom,sdm845-smmu-500", "arm,mmu-500"; reg = <0 0x15000000 0 0x80000>; From patchwork Fri Dec 27 05:32:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 182476 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp2565467ild; Thu, 26 Dec 2019 21:33:04 -0800 (PST) X-Google-Smtp-Source: APXvYqy9Hf6fyJZTpoWSRdw4IAZn7y13uFqJe2c8+4HdMW9SZ7txaMxA39+fz5NVyCGgHrsRvrO0 X-Received: by 2002:a9d:5888:: with SMTP id x8mr52454486otg.361.1577424784569; Thu, 26 Dec 2019 21:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577424784; cv=none; d=google.com; s=arc-20160816; b=CusXqiDRrt8JivCOtYZ+WK3NtZx6dQs2rDVuQBux/Dza6r06jfDHLTHTx+iU2+6MHA j/KqDxR2SoUmSTNiUXiBBMLh8UGLzDrkk4IkpLmWvd335EGS7aO8FTGJLjWAC83VVoyq 2O4gf8IMjHcCPJPisfICIOzZDZwaU/aE/auUiH/161vehI4PJPlTMPjYB0vRtb0qNyXi zjn3meVgXRycfHh3NF3uhfqAMRJFS+bIqwOuCg5mIcvjv9WRW2Hqw0PVyKU3qFGoERM6 JjuLXBX3weI33u/okbfLotO/BUCnfq8h41nxHZ02+ezeFvk6EC+ivtJgq23Pws22+aI4 4rhg== 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=F+FUx/nQYrrbDRHZLQaTu/i+aQlt0vK55dtnLQtWHsk=; b=tvOIjrjfryEKTyv5h/DPDTwM7w7L30g0fkF9Z1fVmqn2NnSa1Pu3MOzrwYxdV/UTUg I8bzrw/2OhgxBi7GwF2jrN7bYlMdW69u24d/PIPOX/pf41yCnve1V6JhMwoueUnrtJIe ddVtJLFSVbEtaQZZgh0vbGpkw9S3XSt2tp8Gs5rhX1C1ZU0MdKrnyalQhm1Sw8MTr5V3 uNorCBB0DGKOtngFT20PEg/rYtLNbjwangSlc/bFDmZOUm6TlCBKHibs9MwQcNiaZhlC ThaSrXfCWamHCTdHJcAsfRjYhzAM66NYdOw7U96R1IW3JQnM1RqCFsxDT/uHWhEzefDL VkKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s6aKJcPR; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 s22si15711792oij.35.2019.12.26.21.33.04; Thu, 26 Dec 2019 21:33:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=s6aKJcPR; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727102AbfL0FdD (ORCPT + 15 others); Fri, 27 Dec 2019 00:33:03 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:42092 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727074AbfL0Fc7 (ORCPT ); Fri, 27 Dec 2019 00:32:59 -0500 Received: by mail-pf1-f193.google.com with SMTP id 4so14223191pfz.9 for ; Thu, 26 Dec 2019 21:32:59 -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=F+FUx/nQYrrbDRHZLQaTu/i+aQlt0vK55dtnLQtWHsk=; b=s6aKJcPRJJGJbAml1ppgcXP7+X6cEcYvzbj5ZikmJLvE3xgaWOn8GBSNOF5+7cHUCD rSnvHuQMXXh06FEmihaYw24TBbiL0golafHaL3KOQ9wDhVG4YnBl+qrQ9uqgI4oiO2Oy nlzmQYHupUoiGCbMJ6PVO3PGj8HbG7meLWVw4Tc3YaQPIpnRJabfQpPSVIVGhr+lp2Xf cZjlsOodS5bv8pzEbU2KYJ5EkiAFF6PZxddVspdtnTqd+jhfb73q462eNxfySeHeBkh4 mvYoXfWG1tLYdvXEt1TIQtIapnW/dZfC5d7wdyA3nZm5muq+Qi4AoqBEApa1SnAdcMdq 0GsA== 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=F+FUx/nQYrrbDRHZLQaTu/i+aQlt0vK55dtnLQtWHsk=; b=nC/Q+F6+eZppcK2/vCiWAI7lpcIYJSOjkfO83pIHl5vQ63z59yUJ9G9DvPnFJwMvbB joNbesQ/odvjBgtL7FRZ807Luig6058txpFKCHJ+AZOXDbeZMdlgfkCVeFu1tMPAx8HD BaRrh1t3vkln6CSkrDvHqF4CAFzTjaFQ52avzOazkytGheNPYCWRiUYcrkPKfnX5vDU3 qmI2xojLgqCP2pQq/x6XI+ryD8S1MIHgMrF6rb9VACdJV4eNFfa3AuAjnM1Z1PSL7Psu 3KMVbkTx+M/9ot4VM4CpDE0j2JAlHFtb3aGUpqIG7dRIc0qoEtNfFUKGt4/VATTZQx1F qCjw== X-Gm-Message-State: APjAAAWY50b4P+nEuOLRoFVyRI/p/BKxVJ0401fT7Upr6ngcpnbRMJrV BO0TdanImjsxwcSIDFYgfAaJyg== X-Received: by 2002:a63:d906:: with SMTP id r6mr52775727pgg.440.1577424778722; Thu, 26 Dec 2019 21:32:58 -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 c22sm16789196pfo.50.2019.12.26.21.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:32:58 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 6/8] remoteproc: Introduce "panic" callback in ops Date: Thu, 26 Dec 2019 21:32:13 -0800 Message-Id: <20191227053215.423811-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce a "panic" function in the remoteproc ops table, to allow remoteproc instances to perform operations needed in order to aid in post mortem system debugging, such as flushing caches etc, when the kernel panics. Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/remoteproc/remoteproc_core.c | 17 +++++++++++++++++ include/linux/remoteproc.h | 4 ++++ 2 files changed, 21 insertions(+) -- 2.24.0 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 307df98347ba..779f19d6d8e7 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1832,6 +1832,17 @@ void rproc_shutdown(struct rproc *rproc) } EXPORT_SYMBOL(rproc_shutdown); +static int rproc_panic_handler(struct notifier_block *nb, unsigned long event, + void *ptr) +{ + struct rproc *rproc = container_of(nb, struct rproc, panic_nb); + + if (rproc->state == RPROC_RUNNING) + rproc->ops->panic(rproc); + + return NOTIFY_DONE; +} + /** * rproc_get_by_phandle() - find a remote processor by phandle * @phandle: phandle to the rproc @@ -2057,6 +2068,12 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, rproc->ops->get_boot_addr = rproc_elf_get_boot_addr; } + /* Register panic notifier for remoteprocs with "panic" callback */ + if (rproc->ops->panic) { + rproc->panic_nb.notifier_call = rproc_panic_handler; + atomic_notifier_chain_register(&panic_notifier_list, &rproc->panic_nb); + } + mutex_init(&rproc->lock); idr_init(&rproc->notifyids); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 16ad66683ad0..7836c528d309 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -369,6 +369,7 @@ enum rsc_handling_status { * expects to find it * @sanity_check: sanity check the fw image * @get_boot_addr: get boot address to entry point specified in firmware + * @panic: optional callback to react to system panic */ struct rproc_ops { int (*start)(struct rproc *rproc); @@ -383,6 +384,7 @@ struct rproc_ops { int (*load)(struct rproc *rproc, const struct firmware *fw); int (*sanity_check)(struct rproc *rproc, const struct firmware *fw); u32 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw); + void (*panic)(struct rproc *rproc); }; /** @@ -481,6 +483,7 @@ struct rproc_dump_segment { * @auto_boot: flag to indicate if remote processor should be auto-started * @dump_segments: list of segments in the firmware * @nb_vdev: number of vdev currently handled by rproc + * @panic_nb: notifier_block for remoteproc's panic handler */ struct rproc { struct list_head node; @@ -514,6 +517,7 @@ struct rproc { bool auto_boot; struct list_head dump_segments; int nb_vdev; + struct notifier_block panic_nb; }; /** From patchwork Fri Dec 27 05:32:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 182477 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp2565521ild; Thu, 26 Dec 2019 21:33:08 -0800 (PST) X-Google-Smtp-Source: APXvYqzfscbmbRfjXox/Z+y433l7kumNlOggfWR+l/KRtfwA35KicdzGH/UlKv6YajgTgUOPbJpY X-Received: by 2002:a9d:1d02:: with SMTP id m2mr51360992otm.45.1577424788644; Thu, 26 Dec 2019 21:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577424788; cv=none; d=google.com; s=arc-20160816; b=B2Z+u6H+zIohi2zZRf+qXqIAheqfweWpXst1JWAWxx3wJonua6m2pPnZ7D8VlBnl6r SJwAcv3LM+yMg0sUIQzsZLb/QxNZrkPyznTTlSX1HTS4rvyRJJIo8JTWPL9iLulAn0Ms qGkQHc4Cez+W+Owf8P42LM6Zm/77g0KLyRvZodmb13QGK0Lv+HjyrrhvELr30dm24/Cy N30oa9dtGWaOiS1fQAZ7Jzt/0zysslm5RxdrYvCKXMkmjxIVrmYvdfiBSxZmMudcRU/Z +ZVpU5XAv9HPVRHZ/LeKKmTCiIM+e6nYLXd7ZipKaYoDkyKd5uISkYUrD/AWI+ovZD9/ h8mA== 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=2t+7hHUDAIU6/kyzomS9lXUD4GOc2eozdJ6K0tO6DWM=; b=kpZWamLJKpCuC8TSUfNTCbmh1lfF7zwQlWFHNQROkQYuH56ShtB+/rdhxGsV/wRZSx Rd2VYx4Gq+IRFAU7Rdpovv2wFwdYPpEQtqmA7eX7FKrlrgHkcVzCXTe2ADjODzi5igOB NbWO3AsrHJfvSdO53NUY6tg+q4/s3z50CcNDnFlpzGDZ2Cy2KU0rSw316ELncB58oThS RWzRqNYYZDnY1FKRLeKGQVp0jP/Ltk1GUbJQ0+cZV0nTGGtlgJ+wfg0r7pzBd1AJ7qvs zs0MYOsMRdquVHrUvazAd0RDUhWWLpInZCdPYieJVu/P0Cj3c6kCQjJ5AV1QpidiU11G t3AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bhk+hAze; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 w16si15866089oih.154.2019.12.26.21.33.08; Thu, 26 Dec 2019 21:33:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=bhk+hAze; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1725994AbfL0FdH (ORCPT + 15 others); Fri, 27 Dec 2019 00:33:07 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45993 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbfL0FdC (ORCPT ); Fri, 27 Dec 2019 00:33:02 -0500 Received: by mail-pg1-f193.google.com with SMTP id b9so13907955pgk.12 for ; Thu, 26 Dec 2019 21:33:01 -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=2t+7hHUDAIU6/kyzomS9lXUD4GOc2eozdJ6K0tO6DWM=; b=bhk+hAzeEOHKNO2859YUefgWnGGBXpUyN4CwlLzABkWSCsX8q3qDA7MoR6Ms5A5F7G vXvdmYgbJkkKbGwOKbq3gtmK8Nw/1yuS9ZbUVdpzHcaVWvdtn5awQoyalQ93l69wmIc/ m5eHsN0l1ItVxKNS6aNfmkoJ0ID31OYow4zXRxnC0VO2V0SD1ZpHEQmfPvdLXoOB2zU2 P0AnIxEHr8jvGlAgfVv0lCaptgUMCp42oN0uh6nR0NkhZR6G2n+9QxIgzo34MVYrHhB4 3kbEU6MKw5DKwE6whoObsx00RNvgQpqFHnFKlzcXP4iNCTjQWI8sqPc1MJjw+0M+HHTj 8Cvg== 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=2t+7hHUDAIU6/kyzomS9lXUD4GOc2eozdJ6K0tO6DWM=; b=m2InrUaKtHkgtJL7UKHP5URxhV7hknGTb7vIHKgUsh0SXCzXQNJL6wYEuKETh1dkYQ enVlYWKjBISJeFzhhQHy3yNtFLITqtJA60uC1P1p3qnBbFu+8N6SJgy/uVNO2HboYzMT RO97pXrZijvLXqXTnhiN+Gn+mM0h2WIP2OPn6PxbI4wp2owNA7rf/M3tiGJtDoOy0OS7 9oc4f1R4gVoj+5BQW9ZubStvpQq0G14+n3EBNrZUmSnEjduqYc3TxuWSBg1O62jEx4Xd NlcEqtWbLt30Eo4x2nhYEl6f4N7Pp9Io3MGJBoG5Jw1L1lBBDZRT0G7x4LeGn2SEThc8 3zqQ== X-Gm-Message-State: APjAAAWOQ5U5my3B3dOFE/xbAeMYZyEp0AzwRknpno9zrftul30xNq9q qMlBOA5UAgQomNylF0TTsd93wQ== X-Received: by 2002:a63:6c03:: with SMTP id h3mr49662731pgc.19.1577424781257; Thu, 26 Dec 2019 21:33:01 -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 c22sm16789196pfo.50.2019.12.26.21.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 21:33:00 -0800 (PST) From: Bjorn Andersson To: Rob Herring , Mark Rutland , Ohad Ben-Cohen Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v2 8/8] remoteproc: qcom: Introduce panic handler for PAS and ADSP Date: Thu, 26 Dec 2019 21:32:15 -0800 Message-Id: <20191227053215.423811-9-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191227053215.423811-1-bjorn.andersson@linaro.org> References: <20191227053215.423811-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make the PAS and ADSP/CDSP remoteproc drivers implement the panic handler that will invoke a stop to prepare the remoteprocs for post mortem debugging. Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/remoteproc/qcom_q6v5_adsp.c | 8 ++++++++ drivers/remoteproc/qcom_q6v5_pas.c | 8 ++++++++ 2 files changed, 16 insertions(+) -- 2.24.0 diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 1a942c92d974..4189d22531f4 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -291,12 +291,20 @@ static void *adsp_da_to_va(struct rproc *rproc, u64 da, int len) return adsp->mem_region + offset; } +static void adsp_panic(struct rproc *rproc) +{ + struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + + qcom_q6v5_panic(&adsp->q6v5); +} + static const struct rproc_ops adsp_ops = { .start = adsp_start, .stop = adsp_stop, .da_to_va = adsp_da_to_va, .parse_fw = qcom_register_dump_segments, .load = adsp_load, + .panic = adsp_panic, }; static int adsp_init_clock(struct qcom_adsp *adsp, const char **clk_ids) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 4dcdf1301e50..547d012cf2db 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -242,12 +242,20 @@ static void *adsp_da_to_va(struct rproc *rproc, u64 da, int len) return adsp->mem_region + offset; } +static void adsp_panic(struct rproc *rproc) +{ + struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + + qcom_q6v5_panic(&adsp->q6v5); +} + static const struct rproc_ops adsp_ops = { .start = adsp_start, .stop = adsp_stop, .da_to_va = adsp_da_to_va, .parse_fw = qcom_register_dump_segments, .load = adsp_load, + .panic = adsp_panic, }; static int adsp_init_clock(struct qcom_adsp *adsp)