From patchwork Tue Feb 11 00:50:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374417 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA4E7921 for ; Tue, 11 Feb 2020 00:52:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A8F92082F for ; Tue, 11 Feb 2020 00:52:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mhpZK9Re" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727609AbgBKAwL (ORCPT ); Mon, 10 Feb 2020 19:52:11 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45524 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727594AbgBKAwK (ORCPT ); Mon, 10 Feb 2020 19:52:10 -0500 Received: by mail-pl1-f195.google.com with SMTP id b22so3512326pls.12 for ; Mon, 10 Feb 2020 16:52:10 -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=IhizcQrNZHXbgWrj4mKBKUeank5/j0aTe0/Ly1U0jwc=; b=mhpZK9ReyC64uuztvB4v7YaBTqMJAe6TRYWjAodSBc/5XTN1Ilado6v2YZPycAQxl3 0GbVg6arqhwfH/YL/u4kwISo5kJyu3cp4ent7GxbNQxq1HTOX/VV2W3ItRp9h+MGPRgH aLobregRui7wcZ3+jwYzs6uw+Ow5mmtvX8ndSodWujw7dgCq4IPnz+iTF+sX+gM/Z+ty NuIdZCXW114xgLNbZQMAUSap6aB4yxHDrURLAFiERE2ITS49TauTO13dzFtasIJlKvpi DcN5N0larLZ5O4NASnuCamLOShDDwEGKGhTh7TPB1YkF1G1dYWjhw3uVJ5IEaIQ96xsH 04pg== 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=IhizcQrNZHXbgWrj4mKBKUeank5/j0aTe0/Ly1U0jwc=; b=TA/G79nJ5npaiiYEsIlnzupyFgVpNajGo4glztN5aYfQpgVSAunHowEAF8f9W7MrsD hISprJakMfgMD6f4szAsJjONToMzpMfUFDwEq3Q0kM05roSqgeu74ui8BBo5wyUAMI/a 64eOur7CtaCVMa+ecDuma+qsC6NFgLszIBJOMAf3IXiR6tSWRT1HW4iq36/djpj7wow9 O78tyEy3VbeoMdi3c1c4vrXeA5m1zwgQeekoyBdaUR3k+uXP14x/ZewKt6QMNcaysAkp 5HUiLwanCec+cylswN0zus3agW/+WBKP5vAf2/rBJJjPbUGr3XI9+EoZkwNRKiya6Tpb cmPw== X-Gm-Message-State: APjAAAVVt/M1C6JRMWToa3bOAqSnoOBRHqlnxhlqLIsECZ7VSNyVf8XP /lWIvu1VztZ7a0ToYIPefVSCRw== X-Google-Smtp-Source: APXvYqxcoMxw31IIUUXxZP96/pN8wPjnmV1c/wvB8rNFxyk6baM5maVAEa1ii5AJl89QxhN29phprQ== X-Received: by 2002:a17:902:9a8c:: with SMTP id w12mr615147plp.149.1581382330138; Mon, 10 Feb 2020 16:52:10 -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 q21sm1538480pff.105.2020.02.10.16.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:09 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen , Rob Herring , Mark Rutland Cc: Andy Gross , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 1/8] dt-bindings: remoteproc: Add Qualcomm PIL info binding Date: Mon, 10 Feb 2020 16:50:52 -0800 Message-Id: <20200211005059.1377279-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 v2: - Replaced offset with reg to describe the region of IMEM used for the entries .../bindings/remoteproc/qcom,pil-info.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml 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..8386a4da6030 --- /dev/null +++ b/Documentation/devicetree/bindings/remoteproc/qcom,pil-info.yaml @@ -0,0 +1,42 @@ +# 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 + +maintainers: + - Bjorn Andersson + +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. + +properties: + compatible: + const: qcom,pil-reloc-info + + reg: + maxItems: 1 + +required: + - compatible + - reg + +examples: + - | + imem@146bf000 { + compatible = "syscon", "simple-mfd"; + reg = <0 0x146bf000 0 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + + pil-reloc { + compatible ="qcom,pil-reloc-info"; + reg = <0x94c 200>; + }; + }; +... From patchwork Tue Feb 11 00:50:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374421 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A1B8186E for ; Tue, 11 Feb 2020 00:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFD652082F for ; Tue, 11 Feb 2020 00:52:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PZDbyeYw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727686AbgBKAwO (ORCPT ); Mon, 10 Feb 2020 19:52:14 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46643 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbgBKAwN (ORCPT ); Mon, 10 Feb 2020 19:52:13 -0500 Received: by mail-pl1-f194.google.com with SMTP id y8so3506537pll.13 for ; Mon, 10 Feb 2020 16:52:12 -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=ydVhHnWQ0HLgMTFUIhwtCaw9X4iLwegWCzrRdrC4PNM=; b=PZDbyeYwSRrVYyQgLk9W66oGcfWhJofwkWszGstL1FDQWe9K2WvtQxQZeNsaoTkS7i WwrjzIyFdnpbxs0XidqutKEGXBIDo+6h4LkGXVGgrOUiTs/3qhNEA7V/j5IpGmsjzQF2 iOd5uESII0B+orQiQToYaFkSU6a4UtelaUpp82xUCG27bQJaL0LpJ5slk/Tleg5+MyqU 9UEDYLQ8C5TcQG+k3Dr4EwZHXVfmy9nmLqjDKVhxsXMeh+7zE6rPj5CdB6QWqSirWwe2 faV0P8cOt+8qa22hTe8pai+iSR7hIrRURWEwRi2a66vPCYNmMg6tIXZTz2yu3V/1CF11 piqg== 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=ydVhHnWQ0HLgMTFUIhwtCaw9X4iLwegWCzrRdrC4PNM=; b=MjMslSHbKczZ1scboSuF2m0IkxMdYw/afi3jrtjwIEbQKEyCcMtEzDEBPLSUC7WGWd +s6iP2tUSoa2donQiMVsarbLZB05a1enExyIAI3i+VQVo7hTZ09PBYZ0LbfbII0r8aCJ u/nQpTqmExiHSzfVlPENxi0TXTidxbgKk8Ue4jQVL6sL+ZnqLAHXlNzhHMaMXO4pgNnh Do/24gi4gCEg//1WmQhYygIEGvQMuCz7OaLLwKsP/Ktt0vV49YRDXjHGU1yuXwccREyz Jb2D+f3tHYyvsIH6ojx9/IOLnJCVMBLcTY/hxLKO8KrSx/t/4/Al8uzMq/KldjOKIAkH f/Gw== X-Gm-Message-State: APjAAAVnDQdrs2cs6KPZaHs0jNtFPxR4CH5ypvW4INiDvwf+7KpgkMBq n3MC8uRzCf8zSlAQLYA/SoUlsg== X-Google-Smtp-Source: APXvYqyc/Wm2ayFujRaoGE0dqwxi+qHtT6AuZTye4NzuVOryX+KpHk0XmuPp6EsMK+2lrCdXnJGwtg== X-Received: by 2002:a17:902:b682:: with SMTP id c2mr625237pls.127.1581382331559; Mon, 10 Feb 2020 16:52:11 -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 q21sm1538480pff.105.2020.02.10.16.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:10 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen Cc: Andy Gross , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 2/8] remoteproc: qcom: Introduce driver to store pil info in IMEM Date: Mon, 10 Feb 2020 16:50:53 -0800 Message-Id: <20200211005059.1377279-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 v2: - Sorted includes - Replace use of stracpy (still not landed upstream) - Fixed error handling in probe - Return error from store, to allow clients to decide action - Replace hard coded size with value read from reg property drivers/remoteproc/Kconfig | 3 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_pil_info.c | 168 +++++++++++++++++++++++++++++ drivers/remoteproc/qcom_pil_info.h | 8 ++ 4 files changed, 180 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 de3862c15fcc..20c8194e610e 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -95,6 +95,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 e30a1b15fbac..2ab32bd41b44 100644 --- a/drivers/remoteproc/Makefile +++ b/drivers/remoteproc/Makefile @@ -15,6 +15,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..398aeb957f3c --- /dev/null +++ b/drivers/remoteproc/qcom_pil_info.c @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2019-2020 Linaro Ltd. + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#define PIL_RELOC_NAME_LEN 8 + +struct pil_reloc_entry { + char name[PIL_RELOC_NAME_LEN]; + __le64 base; + __le32 size; +} __packed; + +struct pil_reloc { + struct device *dev; + struct regmap *map; + size_t offset; + size_t num_entries; + int val_bytes; + + struct pil_reloc_entry 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 + * + * Return: 0 on success, negative errno on failure + */ +int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size) +{ + struct pil_reloc_entry *entry; + int idx = -1; + int ret; + int i; + + mutex_lock(&reloc_mutex); + for (i = 0; i < _reloc->num_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"); + ret = -ENOMEM; + goto unlock; + } + +found: + entry = &_reloc->entries[idx]; + strscpy(entry->name, image, ARRAY_SIZE(entry->name)); + entry->base = base; + entry->size = size; + + ret = regmap_bulk_write(_reloc->map, + _reloc->offset + idx * sizeof(*entry), + entry, sizeof(*entry) / _reloc->val_bytes); +unlock: + mutex_unlock(&reloc_mutex); + + return ret; +} +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) +{ + unsigned int num_entries; + struct pil_reloc *reloc; + struct resource *res; + int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + + num_entries = resource_size(res) / sizeof(struct pil_reloc_entry); + + reloc = devm_kzalloc(&pdev->dev, + struct_size(reloc, entries, num_entries), + 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); + + reloc->offset = res->start; + reloc->num_entries = num_entries; + + reloc->val_bytes = regmap_get_val_bytes(reloc->map); + if (reloc->val_bytes < 0) + return -EINVAL; + + ret = regmap_bulk_write(reloc->map, reloc->offset, reloc->entries, + reloc->num_entries * + sizeof(struct pil_reloc_entry) / + reloc->val_bytes); + if (ret < 0) + return ret; + + 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..93aaaca8aed2 --- /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__ + +int qcom_pil_info_store(const char *image, phys_addr_t base, size_t size); +bool qcom_pil_info_available(void); + +#endif From patchwork Tue Feb 11 00:50:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78057921 for ; Tue, 11 Feb 2020 00:52:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 503682080C for ; Tue, 11 Feb 2020 00:52:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FS9SQCcU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727720AbgBKAwl (ORCPT ); Mon, 10 Feb 2020 19:52:41 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40690 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727636AbgBKAwO (ORCPT ); Mon, 10 Feb 2020 19:52:14 -0500 Received: by mail-pl1-f193.google.com with SMTP id y1so3523594plp.7 for ; Mon, 10 Feb 2020 16:52: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 :mime-version:content-transfer-encoding; bh=oxAAk0R22IM81nachEV7uLIIgcESZ111r/417hPADp4=; b=FS9SQCcUwhRF76ZZTJ+7VOq9qQglqeJNMReMgR8pKHZuA6ivzxzx2yyZoBqY8ET0iG mgpL9/8bneZrw0J2GKmszK4jmAgX1PglxvTwe9fQSzGBfRanL2itNh2yGHV034WenHZ/ 9zIfk83WRBGUvPG6bDNHoqaBIrx/SgiN/NZpArqWXZ1mE51D13xCzArVj9DQUK6ekRfT gpX9oGQsuCVnBBGcAEHha5aGcCiOxPhklNM8CX3xetvZF6RvoQIO5x2eoroyW4BQps8e tb1jZaOX+cxdEDzkIACZAB75/6jwFncbhpIVW2kOQqcSjceEROKRSc9iGNKM7nqQvkqg F5UA== 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=oxAAk0R22IM81nachEV7uLIIgcESZ111r/417hPADp4=; b=GR2VkhNp2QLciNtcQJmq4kQOPdDOTlQ8KWJQ4HFLb+VIRMSilw4mjjWtbOf9uud0gr PDPy+Yq4o1HbQHiUErWth0Wq1mNXFbpZtfp/OzKcqmA5HG0so5kq7EcjZocjoK3fb8oC Bq3kAk3er9LEMvAfng6uY+It3aUvPVuEGqVS48Q9IHIgZGu8/yFtuwT4ZmdWCMDShnTL pucV0iQ0N7/B842HkYFUqy7yxdZGuYBDfEHEEbWQSCZnKImgc5z1ge4/b0GKkZA+7OQy K4nAlbOyZ1fTTXHYj92dPHMd71PGT2AFWfNOaWN/+qUq2dPdR6e1SAWpxbw2n398ToLY dPEw== X-Gm-Message-State: APjAAAWjs69q09SOu3hXorKpaVS6AmP+9eN9+BhpFpApOHYmRUpdXgmf 0eC2foLdHT4TIfXsALnz8J3Sjw== X-Google-Smtp-Source: APXvYqyk3Mhnvz+ITrxD609cvQP8O57nNHCW7AC6mHtk+lTZuJToVYUaaqw9r19K4jaiCs1Gy17zhw== X-Received: by 2002:a17:902:8498:: with SMTP id c24mr608660plo.233.1581382332976; Mon, 10 Feb 2020 16:52:12 -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 q21sm1538480pff.105.2020.02.10.16.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:12 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen Cc: Andy Gross , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 3/8] remoteproc: qcom: Update IMEM PIL info on load Date: Mon, 10 Feb 2020 16:50:54 -0800 Message-Id: <20200211005059.1377279-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 v2: - Wrapped a long line 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(-) diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 20c8194e610e..7f4834ab06c2 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -129,6 +129,7 @@ config QCOM_Q6V5_MSS 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 @@ -145,6 +146,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 @@ -193,6 +195,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..19f784adf91c 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 a1cc9cbe038f..66ed4600db78 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 @@ -1166,6 +1167,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: @@ -1555,6 +1558,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 edf9d0e1a235..d20ce3c62256 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 Tue Feb 11 00:50:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A31BA921 for ; Tue, 11 Feb 2020 00:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83F5520870 for ; Tue, 11 Feb 2020 00:52:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="x8yLEeAJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727594AbgBKAwP (ORCPT ); Mon, 10 Feb 2020 19:52:15 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:56308 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727697AbgBKAwP (ORCPT ); Mon, 10 Feb 2020 19:52:15 -0500 Received: by mail-pj1-f65.google.com with SMTP id d5so522836pjz.5 for ; Mon, 10 Feb 2020 16:52:14 -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=usB5IoDyLwWY36+AuSkvkbrGcg49AWldfTwBCrrtmpU=; b=x8yLEeAJm5pg44gCh19Xinxc52LnzVmwZBRkJFm2t+blF3Kx8ux8OLeeQTKtqyZJh7 v43NbY/nF8f4JoFBX+I+mlu8+VJnZem3CbyjRUNAJpJecBPJXslIhd5FHYtVk5Hmkt2J e01TAgFVetot9Jeq4x2df5WUV5Jv4S8cBsHbPCKxrio8pvWw1vFrD6DLB2Mwk57nmry1 AaMId8w0OC3YuuzcHw5wo4C0BCABvmzadCE98WJ4GoVysMT+pRKhL1slWvJzduJpnrVL 82tyDGYgnXlUv7I5Jsorp7bwjFlD58W8D8tcrpiQ+7/t3/G7V+fIH9IN2UNgUCRQxmdB 5FQQ== 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=usB5IoDyLwWY36+AuSkvkbrGcg49AWldfTwBCrrtmpU=; b=SHWhWsCgEV6Uu2fC1mDcba8gpy2FhWV9n+P6NvwZguZg1b9S5p04DtbIp0AB05Haoc l3ISTrSzFc6RKO3SwaLg2M18ufpqUHa4cDD62XCTqPRP9GGtOZBOx/Yq2iTpSVK9+gUP 8ONS+H70BU4+5ntE91MKfcRaNueFpqGJfgHjyKaWUb0sBIpVwSSpKiCbiyEsoIgz9EMu N2O8CbEpo9GBzuNU96Zadj1Ns58UaF8vRjxemFACDppt0mPInS1n+sLexkBl2TiRPnme 5GIvO7ZttDpG2B1iDT8ib13wNpXNgOPc5dTjbEbGe7+Ye1vTBRwUTetkWIcSQ7xF6snM 88lg== X-Gm-Message-State: APjAAAVv/pXI8Ya3EdSkxSwJiiMWvgAFAMmI2grF3IF1tD2WP+5Tinc4 C33ibzFUbL6tCQT+EuKOEgEzWg== X-Google-Smtp-Source: APXvYqzBLJhl4yfx6CRhp1php6TZrHLUEmZeDDuor9FiyoO4g8yRWY7V1J8l3ohfRc3nP4NIgJzOWQ== X-Received: by 2002:a17:90a:b010:: with SMTP id x16mr669765pjq.130.1581382334401; Mon, 10 Feb 2020 16:52:14 -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 q21sm1538480pff.105.2020.02.10.16.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:13 -0800 (PST) From: Bjorn Andersson To: Andy Gross , Bjorn Andersson , Ohad Ben-Cohen Cc: Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 4/8] arm64: dts: qcom: qcs404: Add IMEM and PIL info region Date: Mon, 10 Feb 2020 16:50:55 -0800 Message-Id: <20200211005059.1377279-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 QCS404 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 v2: - Replace offset with reg arch/arm64/boot/dts/qcom/qcs404.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi index 4ee1e3d5f123..f539293b875c 100644 --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi @@ -997,6 +997,19 @@ blsp2_spi0: spi@7af5000 { status = "disabled"; }; + imem@8600000 { + compatible = "syscon", "simple-mfd"; + reg = <0x08600000 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + + pil-reloc@94c { + compatible ="qcom,pil-reloc-info"; + reg = <0x94c 200>; + }; + }; + intc: interrupt-controller@b000000 { compatible = "qcom,msm-qgic2"; interrupt-controller; From patchwork Tue Feb 11 00:50:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B40A17F0 for ; Tue, 11 Feb 2020 00:52:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C8A120873 for ; Tue, 11 Feb 2020 00:52:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="krxFBIuL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbgBKAwj (ORCPT ); Mon, 10 Feb 2020 19:52:39 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44618 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727577AbgBKAwS (ORCPT ); Mon, 10 Feb 2020 19:52:18 -0500 Received: by mail-pf1-f193.google.com with SMTP id y5so4551102pfb.11 for ; Mon, 10 Feb 2020 16:52:16 -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=M8+iy7pVN4WE3jutHz5qWVqRqdhsfXVc/4DMY70bYKQ=; b=krxFBIuL7oKSbZcqFj1jVnlp3lrMP84d2IGovq34cVVYAhbvsdfo2xtjVTuHRHzcHW Ul+m25Diga040b2BWpWkTKMuejH24MHC0kNpWlKeJwBi3MP+dMUEqF3MEl8/CBnBC3zW j2n+5n9RHv5Sb0Q0QX0XqOn9Y0AajR7nTvj4/oy0ApKii9/kxslgo6ryTuzKttiA3Zly Ymv+snierXvMsL+GsvI2XTVOIn0mV9aJoFfJJBlB1XaUMnagRi/2QabexTPgGnBmVCga lgoOfBo9Mz7BvDwu9YUlpEfdRWYuyYnkOqex7849I5GyGINClDwrfnkM8So0t/cIYNro Limg== 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=M8+iy7pVN4WE3jutHz5qWVqRqdhsfXVc/4DMY70bYKQ=; b=BRD1FAhCiKlWVLXavbIZ4Gn3M83PEiA6JlkoOK8Sq1tG9f3egi+kOyCK1ozpMJNyd0 TqOCIJTMsy31evWFq7i56Cw3e+DmLoNda3b2O7uKusAoCoRzMtP/+VmRjZN7nIAmE+bx jDJb70+mngV8SMaOrzp6IB63RJvmgPJVu2wo4EqVArqPARpL29jyulW0StnRYV+XQxzi +EW56IpBCBqTDJq2d1O+Cio/oUkD7KzZgK9s/Eb498MpIieswwfhkShNf1QUHbnz9oI9 FQT9M8UcWfEZ24ZuL1sWlGspBbZGOLOqeUFmwLxbsy6qBJ/jz6sz9tnGXc4veVMPmZJM KCVw== X-Gm-Message-State: APjAAAUUTFDkM0dDlBqnbiN+kJXG8fb+c3LUH+3TOs+k4K6AJu18p8pT 3fRDk4YzXfA+B9TgdpbLUpxWkA== X-Google-Smtp-Source: APXvYqwzEs01mneR4MjC/kY7F3XwSiwiWb6bslc15hzLTqaoTFJRvKVCPb8EQ9uh+djJtwD3r9r7kQ== X-Received: by 2002:a63:2f46:: with SMTP id v67mr4526056pgv.220.1581382335751; Mon, 10 Feb 2020 16:52:15 -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 q21sm1538480pff.105.2020.02.10.16.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:15 -0800 (PST) From: Bjorn Andersson To: Andy Gross , Bjorn Andersson , Ohad Ben-Cohen Cc: Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 5/8] arm64: dts: qcom: sdm845: Add IMEM and PIL info region Date: Mon, 10 Feb 2020 16:50:56 -0800 Message-Id: <20200211005059.1377279-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 v2: - Replace offset with reg arch/arm64/boot/dts/qcom/sdm845.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index d42302b8889b..3443d989976c 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -3018,6 +3018,19 @@ spmi_bus: spmi@c440000 { cell-index = <0>; }; + imem@146bf000 { + compatible = "syscon", "simple-mfd"; + reg = <0 0x146bf000 0 0x1000>; + + #address-cells = <1>; + #size-cells = <1>; + + pil-reloc@94c { + compatible ="qcom,pil-reloc-info"; + reg = <0x94c 200>; + }; + }; + apps_smmu: iommu@15000000 { compatible = "qcom,sdm845-smmu-500", "arm,mmu-500"; reg = <0 0x15000000 0 0x80000>; From patchwork Tue Feb 11 00:50:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E788D921 for ; Tue, 11 Feb 2020 00:52:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C81BC2080C for ; Tue, 11 Feb 2020 00:52:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="I5gXZGhI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727577AbgBKAwj (ORCPT ); Mon, 10 Feb 2020 19:52:39 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:34162 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727720AbgBKAwS (ORCPT ); Mon, 10 Feb 2020 19:52:18 -0500 Received: by mail-pf1-f196.google.com with SMTP id i6so4579484pfc.1 for ; Mon, 10 Feb 2020 16:52:17 -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=rX0PBzoSiXMileVxtobQ0Y36WCYvZwaGtCft9G1Vwrs=; b=I5gXZGhIMfZbDhsF8nl8dGoCFMj9JkKDACq1y5Q7Zk/PYvXrGPnbQJ32y9WYMU1yY9 p8RnNvMt4npKsAT6wRHlSt1dZBpnFsy+7EDuyXx6VFv69fEY3FoUBWxCpFq8UTAkAuEm uk1FoynnVK9V0fyLaiQzruIQN/b9z1QU+WPNiTbhCREc1dbzekA/mpv39DEkgw3tqXRv FO3eSZDh/yBG0/A78FA4xhBJaeqpJIlCYP8MWms5gpvto46GgJihe5/JGKf35cCpToyN KLxLpAU1RJ2vEddOd0niS4qWMMf1Y9V/4eQJGHQzls4aetpg5Qatf3VzPa4tTwKCMRM/ iVXQ== 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=rX0PBzoSiXMileVxtobQ0Y36WCYvZwaGtCft9G1Vwrs=; b=c1y60kEtfjQ60oSGVvduEjIYuXnQoru3IjbQq6dPRmyADhKwYq5qZ3aHkHPRhh/c/L TWFGnBEAP4ElGTb6oszyyoKbKVD2ybcnavUR4Zb5CbUbiKAqUFGvj0m1GgoYaLgRUg+A LKOoDGJiuO2PVzxDIoWX5zILTo/GawffnR7H8n1XTxuJrSduVPU7q+2aSrDLjiz0Xgcp mWYkzJt6cYRcrwo8ZwNZqJFZiKwxAdihF0+XQpuN8yGQJgJOlc0cLyFe7xqf0A6pAqeK 0Dab4ewQFws8Dp9kDzkVQb1Hy4SgwT2y1JZ3MY5j/LipAntSNEXfYoQ/cuReOd4g8N64 sKzA== X-Gm-Message-State: APjAAAUFHpRbf21SJ7KsefZsayGqY9od/Q5HCOYaabPnmbpgRuQn+eJu FwQL32eqsKKPDR/86yuBD1McSQ== X-Google-Smtp-Source: APXvYqw8GRFeXo/k+HHUZZ4/EDdvNNPIehWjHGcgeUJJNTuZuFBNV1WNgjtwlbYQl77+7Jhmn3L58A== X-Received: by 2002:a63:e011:: with SMTP id e17mr4423860pgh.49.1581382337169; Mon, 10 Feb 2020 16:52:17 -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 q21sm1538480pff.105.2020.02.10.16.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:16 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen Cc: Andy Gross , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 6/8] remoteproc: Introduce "panic" callback in ops Date: Mon, 10 Feb 2020 16:50:57 -0800 Message-Id: <20200211005059.1377279-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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. The function can return a number of milliseconds needed by the remote to "settle" and the core will wait the longest returned duration before returning from the panic handler. Signed-off-by: Bjorn Andersson --- Changes since v2: - Replace per-rproc notifier callback with one generic - Move the mdelay() from the individual drivers to the core and sleep the longest returned duration. Drivers that doesn't need a delay can return 0. - Unregister the notifier on exit drivers/remoteproc/remoteproc_core.c | 46 ++++++++++++++++++++++++++++ include/linux/remoteproc.h | 3 ++ 2 files changed, 49 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 097f33e4f1f3..8b6932027d36 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -16,6 +16,7 @@ #define pr_fmt(fmt) "%s: " fmt, __func__ +#include #include #include #include @@ -43,6 +44,7 @@ static DEFINE_MUTEX(rproc_list_mutex); static LIST_HEAD(rproc_list); +static struct notifier_block rproc_panic_nb; typedef int (*rproc_handle_resource_t)(struct rproc *rproc, void *, int offset, int avail); @@ -2216,10 +2218,53 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type) } EXPORT_SYMBOL(rproc_report_crash); +static int rproc_panic_handler(struct notifier_block *nb, unsigned long event, + void *ptr) +{ + unsigned int longest = 0; + struct rproc *rproc; + unsigned int d; + int locked; + + locked = mutex_trylock(&rproc_list_mutex); + if (!locked) { + pr_err("Failed to acquire rproc list lock, won't call panic functions\n"); + return NOTIFY_DONE; + } + + list_for_each_entry(rproc, &rproc_list, node) { + if (!rproc->ops->panic || rproc->state != RPROC_RUNNING) + continue; + + d = rproc->ops->panic(rproc); + if (d > longest) + longest = d; + } + + mutex_unlock(&rproc_list_mutex); + + /* Delay panic for the longest requested duration */ + mdelay(longest); + + return NOTIFY_DONE; +} + +static void __init rproc_init_panic(void) +{ + rproc_panic_nb.notifier_call = rproc_panic_handler; + atomic_notifier_chain_register(&panic_notifier_list, &rproc_panic_nb); +} + +static void __exit rproc_exit_panic(void) +{ + atomic_notifier_chain_unregister(&panic_notifier_list, &rproc_panic_nb); +} + static int __init remoteproc_init(void) { rproc_init_sysfs(); rproc_init_debugfs(); + rproc_init_panic(); return 0; } @@ -2229,6 +2274,7 @@ static void __exit remoteproc_exit(void) { ida_destroy(&rproc_dev_index); + rproc_exit_panic(); rproc_exit_debugfs(); rproc_exit_sysfs(); } diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 16ad66683ad0..14f05f26cbcd 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -369,6 +369,8 @@ 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, core will delay + * panic at least the returned number of milliseconds */ struct rproc_ops { int (*start)(struct rproc *rproc); @@ -383,6 +385,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); + unsigned int (*panic)(struct rproc *rproc); }; /** From patchwork Tue Feb 11 00:50:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46B4F109A for ; Tue, 11 Feb 2020 00:52:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27D8C2080C for ; Tue, 11 Feb 2020 00:52:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JsdDKXZg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727729AbgBKAwe (ORCPT ); Mon, 10 Feb 2020 19:52:34 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40241 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbgBKAwT (ORCPT ); Mon, 10 Feb 2020 19:52:19 -0500 Received: by mail-pg1-f194.google.com with SMTP id z7so4790827pgk.7 for ; Mon, 10 Feb 2020 16:52:19 -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=VL9nzl13JbFlFI5aOpKHBIlRNrHP5XdfNTObBCxAwmM=; b=JsdDKXZg83El14Y+KO7R4dJ8Ux+zLngwyOQ9E8Xr/vgF278O/o+YOUlMivVMSxSyz6 KdjF1kVdkSV/s78/LaHLL8i9pcK98CVtiaftdmgQD0OW2nB1DjSfT7Q4+ehI+VgxPazv wTEUd/05phFW0T0/V2uhM8oVi+rKJkYl2UIcv1RAgHxZbjaVssmGEPiuouiQBK8Ri3xB Vu8nQLRF7GAMalbw3I4lenhvjXMvRw7IEYTy+tBGZwzjwejo9JtIMpQdpyCP/5ybLmRT MwPovBVu4PJBO6EtHFf9S5YG2yrJ+ZKqtA7lBxRBg9B6P0YHEutD2AImaJLqtiY9GBs4 2NKg== 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=VL9nzl13JbFlFI5aOpKHBIlRNrHP5XdfNTObBCxAwmM=; b=PJaDoHmywY0xWSV9/FyqgzUnkqLMzg5T/XE4J8gBEsdrelWbflXAvVCpiKflsPP8NI 5CBl2H4VYraAUlrC/8j1XHF831aC/lhMirVkYIi1p+mdpni2/tpurK4NBNQdBWlxIxCl lJ/d8AmS7aFYet/7kJWvRRnoz6Wi223GWFsHp+26buL8JVTeDrpkJWUlelu0hAuIei33 lFFz7uOvTEjTHE6QAQlKIVPw6TAGuzQmOaHRAYMdIWCh+HPrQvVu0pocZxcHmSWsfzKZ iAjG8v2rBPoGWdpsAm8+/a9lY151kVZ2Id+DGT9/ebYy/rN9PCbPUq/0ZW039r+y2mMG LSgg== X-Gm-Message-State: APjAAAV1p8b7fEYUcozKioxTVoHrVy/5OMe0Vdvmb1vImS0HTiTtNdN/ m9VDOgWJpsGIDU0xnbX0pGLm8Q== X-Google-Smtp-Source: APXvYqxcdRYNV1rhar6shgYZDBGKPcIBa/X2p9rsfFfoCjyYkYM1zFHNbn0J6xNiVUAwIbwl77k/vQ== X-Received: by 2002:a63:615:: with SMTP id 21mr4301621pgg.440.1581382338561; Mon, 10 Feb 2020 16:52:18 -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 q21sm1538480pff.105.2020.02.10.16.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:18 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen Cc: Andy Gross , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 7/8] remoteproc: qcom: q6v5: Add common panic handler Date: Mon, 10 Feb 2020 16:50:58 -0800 Message-Id: <20200211005059.1377279-8-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 common panic handler that invokes a stop request and sleep enough to let the remoteproc flush it's caches etc in order to aid post mortem debugging. For now a hard coded 200ms is returned to the remoteproc core, this value is taken from the downstream kernel. Signed-off-by: Bjorn Andersson --- Changes since v2: - Update return type and return the delay drivers/remoteproc/qcom_q6v5.c | 20 ++++++++++++++++++++ drivers/remoteproc/qcom_q6v5.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c index cb0f4a0be032..6bf660ad889c 100644 --- a/drivers/remoteproc/qcom_q6v5.c +++ b/drivers/remoteproc/qcom_q6v5.c @@ -15,6 +15,8 @@ #include #include "qcom_q6v5.h" +#define Q6V5_PANIC_DELAY_MS 200 + /** * qcom_q6v5_prepare() - reinitialize the qcom_q6v5 context before start * @q6v5: reference to qcom_q6v5 context to be reinitialized @@ -162,6 +164,24 @@ int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5) } EXPORT_SYMBOL_GPL(qcom_q6v5_request_stop); +/** + * qcom_q6v5_panic() - panic handler to invoke a stop on the remote + * @q6v5: reference to qcom_q6v5 context + * + * Set the stop bit and sleep in order to allow the remote processor to flush + * its caches etc for post mortem debugging. + * + * Return: 200ms + */ +unsigned int qcom_q6v5_panic(struct qcom_q6v5 *q6v5) +{ + qcom_smem_state_update_bits(q6v5->state, + BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); + + return Q6V5_PANIC_DELAY_MS; +} +EXPORT_SYMBOL_GPL(qcom_q6v5_panic); + /** * qcom_q6v5_init() - initializer of the q6v5 common struct * @q6v5: handle to be initialized diff --git a/drivers/remoteproc/qcom_q6v5.h b/drivers/remoteproc/qcom_q6v5.h index 7ac92c1e0f49..3bef8243b33b 100644 --- a/drivers/remoteproc/qcom_q6v5.h +++ b/drivers/remoteproc/qcom_q6v5.h @@ -42,5 +42,6 @@ int qcom_q6v5_prepare(struct qcom_q6v5 *q6v5); int qcom_q6v5_unprepare(struct qcom_q6v5 *q6v5); int qcom_q6v5_request_stop(struct qcom_q6v5 *q6v5); int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout); +unsigned int qcom_q6v5_panic(struct qcom_q6v5 *q6v5); #endif From patchwork Tue Feb 11 00:50:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 11374433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75366921 for ; Tue, 11 Feb 2020 00:52:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 570C52080C for ; Tue, 11 Feb 2020 00:52:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SjRakv+7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbgBKAwb (ORCPT ); Mon, 10 Feb 2020 19:52:31 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:50525 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727763AbgBKAwV (ORCPT ); Mon, 10 Feb 2020 19:52:21 -0500 Received: by mail-pj1-f67.google.com with SMTP id r67so533421pjb.0 for ; Mon, 10 Feb 2020 16:52:20 -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=GYcfh7fMvYAlIR4aXXQzSt3C06chntR52at8wJa3tek=; b=SjRakv+7HKKrp8NEOCX6VIPeMG11xHX8mJW3D+GViIV7v/rUbknzfoWGD0potFL2Ya TrH3x9E6SmsvIRYJXb+wZzcUZG74z3A4hCT1zGy6vaWGkoo29WuZG/Juz1fNPwu3dZ9i zJVy0AN1d12ARHC111yN0xNgL1xmfRiN/v6oLaG1sYZw9+rYZVpLxti/3vV7gUCpyk6n sjzITxfb819yxQs05nd58woWMNZmuSyJJguUK+OjN1cRYKgRCi9yZJmDvp7nY/m9XBuw 5cOnSiqNgDHn1viFutg6GcTlXZeQH0PxU1/DoDSkcmnMkKmMDcjYWiOLw5bpZmlNo3UA OI6w== 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=GYcfh7fMvYAlIR4aXXQzSt3C06chntR52at8wJa3tek=; b=O4GuVmu35FzFYlbmFniWMwbxXQf91Z4cQRK4Uf2SDEsWgUOsU2SUieEKAVEme72Bbp L/UmaCjw+0OG3FzLA41OadPRI3J0z/x+c3u0u6Ywi5aOqfd/wnm3bL1TLkxcDUxCpFNt +30ENUsdgly7BUodfPKxnOY0eU+QO0HlZnsh6w8bmXqrRhMwhco0XVxiEY3BIh6Zr1Z6 uxZM3ap339jOVJEge65TJFfRQquFfCVkByp4ktpxE/xZ3IeUEFhic31bcgL2vgfNRipS 01tLL0zoNRWWI2zan+TDIb9b1x45OaLY3SjLKbgIGo9uwrYxfK/qlJOBRUrBI8/G5aBG Wq2w== X-Gm-Message-State: APjAAAU42j0heVy3qi7Ud2fhDNJ6uyclSfFNTr+KKeKXBzT3UClvGpuR BPe0f6kwD1cAxVAOyVSIjU2SWA== X-Google-Smtp-Source: APXvYqy3iW4pbURn69ZVNZ5cxr/DdFPKQ0xbucqlfM3QXmYD5SG1FCE8u5y7dSubB0s6uoRDoGzQFg== X-Received: by 2002:a17:902:760e:: with SMTP id k14mr590560pll.119.1581382339888; Mon, 10 Feb 2020 16:52:19 -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 q21sm1538480pff.105.2020.02.10.16.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 16:52:19 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Ohad Ben-Cohen Cc: Andy Gross , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , Rishabh Bhatnagar Subject: [PATCH v3 8/8] remoteproc: qcom: Introduce panic handler for PAS and ADSP Date: Mon, 10 Feb 2020 16:50:59 -0800 Message-Id: <20200211005059.1377279-9-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200211005059.1377279-1-bjorn.andersson@linaro.org> References: <20200211005059.1377279-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 v2: - Update return type and pass the return value through drivers/remoteproc/qcom_q6v5_adsp.c | 8 ++++++++ drivers/remoteproc/qcom_q6v5_pas.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 19f784adf91c..822881534d37 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 unsigned int adsp_panic(struct rproc *rproc) +{ + struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + + return 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 d20ce3c62256..ac38624fb14d 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 unsigned int adsp_panic(struct rproc *rproc) +{ + struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + + return 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)