From patchwork Wed Aug 7 05:39:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 170711 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6660805ile; Tue, 6 Aug 2019 22:40:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv/QsNUYbXrbRmMwQUiViA8HAyVuOVfWxazmD9aZaVnltI4u/7yTWbeSXJZoBygazSBHsv X-Received: by 2002:a17:902:aa03:: with SMTP id be3mr6601046plb.240.1565156418336; Tue, 06 Aug 2019 22:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565156418; cv=none; d=google.com; s=arc-20160816; b=BFd/MGeLvckKPrpBevsR1UROjg9MkW2uF3ut571nyZ4Mi7Xoyo76o+qbRAEr9aFRiu MdB8xp20JkFLzU0m6NzDvPl0YSMVqRNhOGac4LC1zMKhBPaLwfvCBCxOlHmh3Va+KR0T nm/2GgUiFctpVuXorohgIT9zK242OU5aDvAmUqVNCX4zibFEHbl+C+Wavf1A2GmFgcnW bKZjvL1q/9nB8GzPnv/qZfL2qtEgAXqA+Ho68IqjWZwpl/X26BmzE3aBZFyPqxvu4xkY fwSV2V2LEf7EC1jn5Avwd+UydVh457/u616RJgZ0mHmAAsobI1l1xdzmgWLmXSqtakrk TGLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=VrnrHGkgnpRnail7FR0yXmhVfImCqH1AKJenb0HTXUk=; b=iYDomEG+1lvsl0+P+ueia1g7QG0uNWZajcDWSGdqGOSH7c+145/DGUuGxNfPtyk7zw uGzdi++xWwZZmLC8G0XTMK0kO1ty2q4CO65xcbg1vGwKgRVhbCACcZEHX6JaUhmMUpuv Jp0RbJ71Cabxrdgc6wIHpjLHDznRbQ0Rc0TVcgO1+8XdOeHy4BxPAxZ3cnSE3REh/TYx oUnKs1o1/SPv8apoR1j3qZ2lCHzBed6Hqzfz7OJPngofUx+JLMJo0v0COqE+HK3qGf89 C82AdecfJRG8KmwfCxga4tBT2voZ0xQzOI2ywg7BSp8T1XdbOv+UoWikxZE1pIzFRdF0 pyNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ev0gn7hc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j70si47513183pgd.500.2019.08.06.22.40.17; Tue, 06 Aug 2019 22:40:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ev0gn7hc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727143AbfHGFju (ORCPT + 28 others); Wed, 7 Aug 2019 01:39:50 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33222 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbfHGFjs (ORCPT ); Wed, 7 Aug 2019 01:39:48 -0400 Received: by mail-pl1-f193.google.com with SMTP id c14so38853575plo.0 for ; Tue, 06 Aug 2019 22:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VrnrHGkgnpRnail7FR0yXmhVfImCqH1AKJenb0HTXUk=; b=Ev0gn7hc6T6RQfu0MYvWNGkczGBxYOX2l3keLxAhbp/IkAeape8SKPwzf++pPc4NyO rNbfA/E67xIWJq8YxTaHEvFumAA2Zue/KgD2T3bxbYFTdhJZtMo63qeRVb4A+MDJlgWj l+OVYBfA70JtOtHPeXefuSTdZQda/vkdrgqv6JPHwi/u6OTkkQr8Rw0Cx33GlLybvr7Z ql44GsVlcF3Mmcwl4Fc96CRAIpLUDuXAML9DupedbLEDWaBcfKmbolVtfPSWnTjP5cLN zeYa0KZT2zmv/3Re3I97tweFQ/GPYgGBXGBb4UJtZEIpNbms0dFDhU9IwUHHJTH6g6Bv ATDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VrnrHGkgnpRnail7FR0yXmhVfImCqH1AKJenb0HTXUk=; b=FMaGc+zFCVxNNf0wL1Osaxh/qSZVmbCsU7TBQffhK8idvKGwKxt/H1P7mjGpsIqkk8 S764GZ8lCyKhVHKoHEQE48DCc1cbeTC6DMfgkdbJu7kyjjkQqE7d7Zx60TcuLCbJ5kjR CcC2xaRVvcKUQ9IifBpBdiZjwfT+A66KdmmYD2sj4EkrjsGI5Kug/hV2HMjpDrZmxStt HmuSnpasO+v7bSlkgFXDMCyBOmCjtsznNo9EAHECR50XFwipha2lfP7n3YMtZdhF2iyo zU0BEy+l3coE0mtAxvHBEVasnMi7Kd2KXuuaoOP3Z3ZHvl615cU8dDBoZD4n/yODRSmX T1/g== X-Gm-Message-State: APjAAAVL7Dg5sOA7LZrI16MjMpsRN+V+K3xQczuraJ2X0mo0EbOde6Cd uAgxXQSivXyAQK/kP9ScZbztlQ== X-Received: by 2002:a17:902:d890:: with SMTP id b16mr6445015plz.315.1565156387325; Tue, 06 Aug 2019 22:39:47 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u7sm86070777pfm.96.2019.08.06.22.39.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 22:39:46 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Andy Gross , Sibi Sankar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH 1/9] remoteproc: qcom: Introduce driver to store pil info in IMEM Date: Tue, 6 Aug 2019 22:39:34 -0700 Message-Id: <20190807053942.9836-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190807053942.9836-1-bjorn.andersson@linaro.org> References: <20190807053942.9836-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- drivers/remoteproc/Kconfig | 3 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/qcom_pil_info.c | 139 +++++++++++++++++++++++++++++ drivers/remoteproc/qcom_pil_info.h | 6 ++ 4 files changed, 149 insertions(+) create mode 100644 drivers/remoteproc/qcom_pil_info.c create mode 100644 drivers/remoteproc/qcom_pil_info.h -- 2.18.0 diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 28ed306982f7..3984bd16e670 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..aa42732016f3 --- /dev/null +++ b/drivers/remoteproc/qcom_pil_info.c @@ -0,0 +1,139 @@ +// 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) { + 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); + +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..c30c186b665d --- /dev/null +++ b/drivers/remoteproc/qcom_pil_info.h @@ -0,0 +1,6 @@ +#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); + +#endif From patchwork Wed Aug 7 05:39:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 170703 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6660408ile; Tue, 6 Aug 2019 22:39:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/VxPoqEaOiih2S1OBj7uSL9+x64PXLBxmISME8VIMOfQ12l8mhHMuKK/aeZLG7TDVfxZ+ X-Received: by 2002:a63:b20f:: with SMTP id x15mr6403546pge.453.1565156392099; Tue, 06 Aug 2019 22:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565156392; cv=none; d=google.com; s=arc-20160816; b=qDYPZo/xToylNaLI1UAdSbbdx1Z/UP1/Pd0TNQRAaMtQ1jXZmiLdNSYUyWsOi7yMu+ sh1kbkwp0GwImbaPmRyjbOuE6r2wUZgbaKIvgrukkcop20qrUuWTGUlQUsQTZRaAJb+/ Wj5UvgjbHh1cdODbA20LO4Z1hno5kdBgLbIHn2PGVOSPnyTGlKmDz3Qej3M0kq6H5tbq D0NbioXRn6ftSBjrNkml5yK75O0JHejoWgOAlMTxz96X62M6VMpJzdAjabnZwY4yj018 J2PeF8DVhBOaDRcrl7e4+pyzV8+ejTbxbCIXLzF2DOh6DuVd1xRh/B5mZP6B7I2h/Lr3 Wt3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Azf6n5aesLfo8ksF3UKgIcdUJWEiOJj+3CTvEIIBQEU=; b=vhNw7SQFQsIvo0Rlhf/1XHEbvEWqowGw0f/69eyj35gTeVPjW3VFx224oB3/wI4Yt6 J5mIL/Td/GDo9o4xkiS379zYxpboIET+MNcim+Pyl1miPjx14dtxvOKTZvcFrltPgbvs SalUnK/bLrJYecSAbzLQMh+4IlOZEHNqU1nsPOwZTY3R5rCLs/41ZUV1/DgXNMlCw2kM L1q10ojL0wKzYlKcb6OXwiRz9AYuBRzUGYw65ao04iQ+wrwwN2HKC3UiK4oRQUEk9soL KMc2faixGjl6LwdWAb5ukeHwz5cMrbRG+bMJX6BLo64qlhuDjEvdntI63tPUazYumkNn wuNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r+ko+PGS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c62si53135984pga.441.2019.08.06.22.39.51; Tue, 06 Aug 2019 22:39:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r+ko+PGS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbfHGFju (ORCPT + 28 others); Wed, 7 Aug 2019 01:39:50 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44370 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726858AbfHGFjt (ORCPT ); Wed, 7 Aug 2019 01:39:49 -0400 Received: by mail-pl1-f193.google.com with SMTP id t14so38912735plr.11 for ; Tue, 06 Aug 2019 22:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Azf6n5aesLfo8ksF3UKgIcdUJWEiOJj+3CTvEIIBQEU=; b=r+ko+PGSH4q8aK6qnYsbCZwtAtGxCRoBAu0UqNc0v5qIAR1lC/J8nryL8EDZyoEMDG 4r9EpEmt/97cLz8NEBISJRXL0rMq9YX93YRnbATgXoVc+oMZ1CZ1KAW97mWoeS8T5i63 7Z+e8Rx1mPZHgYWigWROV/kgUgBJuSuSKQZGQdQ/S77mJodtmalmc0ov7gSKpf59tQu8 +vhcxV3mwTeFx2YGPSEWzCuRVr1+uEoIGHp7XA4AbYpIboXOzCKseekx1AViw+avyrUS E+Z91JLny9fG6QnGJS3wocoAWRaJ7DUWgZ83p/mpnLRMxyWKseQMJ55WUSUsyQQoBKA0 Ebgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Azf6n5aesLfo8ksF3UKgIcdUJWEiOJj+3CTvEIIBQEU=; b=r0XXJbXW7g/WQx6LnPHt+U/lRqpUXdlgnSjMeGptzarycxIwtruwj3AhYER3YLH0VO m5kZZd+GAfLYvV2wPKux2yHSq+7+dGtBhgomXE4/jQ53hsaAtrMDCHH0yIjAKiLls9GL 9yb+iK9TLCpxS9IQ3Hvor6xQL9cGy7d3hBRm1AoDPyL/qfq2wK2ftyhrI9Lr2nsmB5cc obouhbS1UpA0rvS97dmfMmxhrWSWKe3VI6Ue4dq1BVONuwaHIX5LAU4BdiArfxlfu+s7 nK8QfxG8m8fg4+/EvCXBdhb72loY9zXEE1N0QQ9beF079WEKb18L66XtEZ/v0/DcaFT5 3Wyw== X-Gm-Message-State: APjAAAV/+BewdXUrybUL9U34bI9Wi81vm3X+M9iTxjmP3zB2nJ/DZSpr g1xQFa5TkuLaSrgNLfsodYkhDw== X-Received: by 2002:a17:902:788f:: with SMTP id q15mr6697292pll.236.1565156388456; Tue, 06 Aug 2019 22:39:48 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u7sm86070777pfm.96.2019.08.06.22.39.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 22:39:47 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Andy Gross , Sibi Sankar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH 2/9] remoteproc: qcom: mss: Update IMEM PIL info on load Date: Tue, 6 Aug 2019 22:39:35 -0700 Message-Id: <20190807053942.9836-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190807053942.9836-1-bjorn.andersson@linaro.org> References: <20190807053942.9836-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As the MPSS address is calculated during load store it, and the size, in the PIL info region structure in IMEM. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/Kconfig | 1 + drivers/remoteproc/qcom_q6v5_mss.c | 3 +++ 2 files changed, 4 insertions(+) -- 2.18.0 diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 3984bd16e670..b88d74632d39 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -119,6 +119,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 diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 8fcf9d28dd73..d9192fa40e05 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 @@ -1040,6 +1041,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: From patchwork Wed Aug 7 05:39:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 170704 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6660460ile; Tue, 6 Aug 2019 22:39:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgFtbrDtfWcGa7quiS/k+nJZXwCIqizM32ibyVw2jVBhOxh6Ra4v8dvqUfFiLXbEQtnrAp X-Received: by 2002:a63:755e:: with SMTP id f30mr6272974pgn.246.1565156394941; Tue, 06 Aug 2019 22:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565156394; cv=none; d=google.com; s=arc-20160816; b=JL888tTl/9ztk9Rk115Y3TQwQ2J3YSz8FqHfwbp5zsmVN5LLcx+Tp/DmjFnbFZH1rH 0nEfz7LrOOJT9rgtd/BFMJj06z8t9dENe2xAbiEpHdiu6F/4UOWrSoiydxJ162xPGKl4 3rtraa3gCc0f7ku0nCzDvmZ4Ee2Ip3WP97rqGiMUp4hCZ8wmsnt41suTD+tALk3z96pi /3SO06k0LskwXeMhrEDRYIVwbnWssaK8wjAdB95bnIVm6ffE8PM7vQDylgCHNZNYn4To ZwFfPk/nk41ijRDWX1e6KKYa6BtlxjJoNaKfNRrTLrgnCvIWwZsKulv2y8F3NnKwS86i ZqoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DHLSpNf1LsuJ1wDDF5wISNJL3XiKw5OPuws/j+9mEZ4=; b=W1TTT/01GNr9b5TfIEQbWAF4gfIQofkCGovsZp/toeBesXzf+QGShBmzjQjSDegNGu ds36N2AyrG1oBjswKI1g2jwrkepWyEsMu3IaWnF2KSnvib7yfLGoV5aWkeutEpXWluDU 0K8X715YsoVpjLUHrSWrpMJ9SI2LfDBuZ/hm4+4YYo1cKofEAAadBqOoI8NhOCXIFKHI JLuknDfuG5SjHfFsXqDyWMxCNr+yARwhcv8DBi1DZ8j0drnFSuDW4c2hECxm4vSNbeKE RzVKF+ObE4BvInFVYgTEUR7GxndtSJGjTyg/enxNBjukm0w6FxFewDSuYpDMBwsXHlyy ci2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oKH3tIkL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c62si53135984pga.441.2019.08.06.22.39.54; Tue, 06 Aug 2019 22:39:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oKH3tIkL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727191AbfHGFjx (ORCPT + 28 others); Wed, 7 Aug 2019 01:39:53 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39850 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726858AbfHGFjv (ORCPT ); Wed, 7 Aug 2019 01:39:51 -0400 Received: by mail-pl1-f196.google.com with SMTP id b7so38991469pls.6 for ; Tue, 06 Aug 2019 22:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DHLSpNf1LsuJ1wDDF5wISNJL3XiKw5OPuws/j+9mEZ4=; b=oKH3tIkLcOj5q28FdagPOcCl8w1CPiQNdCAVUaqi/AaD/hNMH2zdiCwbcoQ03uypze IaOOoFZXCjw3UyiXTHidDRMzG62oDDK4nU4GhB07Yl/+8300sDfaDJ0vAmpHO2kMFpg5 Y9V0Vi+ARHOiGQqL0Q0GRpkLQNXFykRRKoD8H2lMZ29hPJrqx5VD/RGdyMhd2BP0YrKl upPN/mSJxWgdE3Z2eoaHAelNrz8Gu8oiDPfrgCUHOc1Rwx2W/+++AD9nIae/fJKRMIM3 +kHiSMB4w/q3t45uQlUAzjnmg2/36p8PklnCYc4H68lwnZvqy4b8113aaezP2AjdwBIf VHXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DHLSpNf1LsuJ1wDDF5wISNJL3XiKw5OPuws/j+9mEZ4=; b=PHtQEukegZyPy/IaLrsUdfbYfqb6xQTdfwkTyAqLEyy4T9La91xVyDcIY5ONolvrBX 3o06yfaiFhjied0Up6JOPEV7XzyJ7v/TEWzuInJvNon3WjYVyaPB5Ih+WhSOZ4jgQAdF 67HNpDRGahafMiHFLe4cxdJ4MUWsXjiHc6vrf/PmrK33kN6PrbuWwVcETUoCT5xWNeoi SJxwZ0VTEEIX9g3qufixpcyuyLXjh6rFsWZxdv0QipBVqTGYZCenz+RNbSdoAzYGJQ8N M2+Br2esaJSq/1svAolqx82Bfp7bflXLsYHQhFCwstUTK/IwP0rY9eoEdFNjCFy1Ug95 fwvg== X-Gm-Message-State: APjAAAUWE3x+pg6ShIeyA0ADJC/ny1voW9yxdgqpMACu0sYzwphGjCQA m6iGCsrKAeYQU3ki34FwnDCF8A== X-Received: by 2002:a63:4522:: with SMTP id s34mr6167748pga.362.1565156390665; Tue, 06 Aug 2019 22:39:50 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u7sm86070777pfm.96.2019.08.06.22.39.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 22:39:50 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Andy Gross , Sibi Sankar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH 4/9] remoteproc: qcom: wcnss: Update IMEM PIL info on load Date: Tue, 6 Aug 2019 22:39:37 -0700 Message-Id: <20190807053942.9836-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190807053942.9836-1-bjorn.andersson@linaro.org> References: <20190807053942.9836-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Store the relocated base address and size in the PIL relocation info structure in IMEM. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/Kconfig | 1 + drivers/remoteproc/qcom_wcnss.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) -- 2.18.0 diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 2aa0743fc05b..3f976ce3df3c 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -185,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_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index dc135754bb9c..9db9a3d25af4 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; + + qcom_pil_info_store("wcnss", wcnss->mem_reloc, wcnss->mem_size); - return qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID, - wcnss->mem_region, wcnss->mem_phys, - wcnss->mem_size, &wcnss->mem_reloc); + return 0; } static void wcnss_indicate_nv_download(struct qcom_wcnss *wcnss) From patchwork Wed Aug 7 05:39:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 170705 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6660475ile; Tue, 6 Aug 2019 22:39:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqymquUqoJhZRzu13NPw8xe5f5k5In+KeCMb1BBLnCKO8f8PG987g6pI/x79XdXFzd3au21d X-Received: by 2002:a63:b346:: with SMTP id x6mr6279150pgt.218.1565156396289; Tue, 06 Aug 2019 22:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565156396; cv=none; d=google.com; s=arc-20160816; b=YVZ7cpEolnnxNf26ZAPqnYX5SpQXlOO3fTodNNmSTqaduu0Efcgxfh1Q5Jh0FaCqzY LDIQDUvuEGBg5D/Ojy34uNrQOYc8kXrkvs6bxoqvOapfJbHU+yCLKtfHJ0RDXuzAQKzs bsB7dqUejKH4VmOctezFJK0Z4FPxJjfF7KIyWS5RTB0ET7nK8DGy1ezhmlfmGfgUSLGU TbAQCSHdNwaf01gTzlPqr2fXNWThOIkyqJMHWNDEOCUQuYWW9Xrj7vaW0ItsrMPGXSsl ZVOly65lJHOFnmA+KqkXfL/pAmC9Eoq/BVv4wvVa0HwYEhje6MlRDQBxhuGzr2y5MsAG AWOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=PtD4kVuMP62M8z8TfrTANyGVjPACMbwaEsr3rVieEXs=; b=SmsGg+ZqwSSlt3lac9wdFlZqdwr8uvMhwB5x/kYpL0/U8Q7RYFPnhIGG9rU+Jb4GhJ aTpMnuY0mTgSNkJ/t05UoBCa0tw9tYqFkHVbRk1pu4M/E/EhvMQOvoslDS76dAu9Yt+g hdjjOTWEScTuuOdl0dUWu6Pq1PT2D84/LAhglFOYj2+NNqz9X1SauOk6COrphnAKtpSB fs204q/dc3V9KchNpkz9Ns69cbaR/G5tByX9OXYkiZpdRHv5y1eUGzHM4qzynQU8RrU0 2bidEs08ovMYGRF5eIOW5fxE1+8YYkNfVny7Vtiizcl7SdiHvnkCu11igMNDkGdNgXr7 AcYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t0ISAbXe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c62si53135984pga.441.2019.08.06.22.39.55; Tue, 06 Aug 2019 22:39:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t0ISAbXe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727245AbfHGFjy (ORCPT + 28 others); Wed, 7 Aug 2019 01:39:54 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42194 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727185AbfHGFjx (ORCPT ); Wed, 7 Aug 2019 01:39:53 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so38986667plb.9 for ; Tue, 06 Aug 2019 22:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PtD4kVuMP62M8z8TfrTANyGVjPACMbwaEsr3rVieEXs=; b=t0ISAbXeSaPvfdlidC94DFCEL+uR6mZHC8q7ZvIX58dgbq8WgM8xBaCIE4XaxFya6z 8nEKRwo9q+R6sN0sV7dwExFSNd7k3yIRS8RTsfKOIwv4vvQeX1wOHQvydZO/G1nE5HJu gRLfzzYLc8hMpSchbKxO+aooyzRCIeDt9+m//fO6V2OL3Kta58cFxLfOajfTJcth1i1V IRHuh8VkJf+JyXvNaJTeK6i47vqB3+YRuZEW3giFTe/eJXdColYu7dF7GrMYJYMHmus4 NUoNMYbJpjnZTwHmv0tt82p081flHa4WPZ/PEYvyNI6kHE1dhkWGoCUQTtMM7jzcdHZ8 RSXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PtD4kVuMP62M8z8TfrTANyGVjPACMbwaEsr3rVieEXs=; b=UNieeZ8EVHCo9qu2v0jS6TTZ7Na1DX07U6qFB+CuHAZFWbD7npOla+k6LYtB5gelzv 8DXZihAe6ifu0xoXpTNCIFmSwUOuLHAo0BZPoBvOwOi3h6wOY2Xa8QfZuBmNyblG1MWR PAWmZLITdAWGcJBN1vs3sQ8nFhQAcgDAGmSuw1NcDq1V9InciynMwwOvQzKNNhn6RHuy idTHkh6lq9nt2l4ppBG99wfWR/GYfA3PRVW4aab+EFdTuV948xEf9HhsFhAUrZuMAmSD P/yxpMZ983U/DOFeizejrmeRklQtgJ1Azqn1PMv2PDJwEaW6TTUfLx3LSH7EPzSKLqnC X6cw== X-Gm-Message-State: APjAAAXtAd4qUYte1euY4SI1IVOg4nLwtg/UZdfnSz0xP8kK7vs+gtdD yFYpZQx4YegHGnStfdzTho+/cE62+oI= X-Received: by 2002:a63:dd16:: with SMTP id t22mr6263088pgg.140.1565156392905; Tue, 06 Aug 2019 22:39:52 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u7sm86070777pfm.96.2019.08.06.22.39.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 22:39:52 -0700 (PDT) From: Bjorn Andersson To: Andy Gross Cc: Ohad Ben-Cohen , Sibi Sankar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH 6/9] arm64: dts: qcom: sdm845: Add IMEM and PIL info region Date: Tue, 6 Aug 2019 22:39:39 -0700 Message-Id: <20190807053942.9836-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190807053942.9836-1-bjorn.andersson@linaro.org> References: <20190807053942.9836-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- arch/arm64/boot/dts/qcom/sdm845.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.18.0 diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index c8ebe21f7673..38a6b304dba3 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -2456,6 +2456,16 @@ 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 Wed Aug 7 05:39:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 170706 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6660505ile; Tue, 6 Aug 2019 22:39:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJ/wU++Cy7IMqASw9xc2V4v94maNiNUWSkZZEEC5k8VGcixl3dl8et5LeT5tvJf6XH9ghO X-Received: by 2002:a62:2b81:: with SMTP id r123mr7332712pfr.108.1565156398973; Tue, 06 Aug 2019 22:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565156398; cv=none; d=google.com; s=arc-20160816; b=P57oz/EgFvun1t/J3r7HHgm9whLK/f4iueeA4Q+xKeH/HUC2IQQDuRa4EFGL76oFfv XzARhZANEH+hQB1QtFOFBtGGf7kKldR9Y6Ok6UEz4UTOnTBzIFgelxxy4dn2oFEt64q3 hQ5VawHPijFq60AaKc15ZDM/Y15vCDFJ4/CB7IgjO3zOyg49D1xHHFfCyPotz4KcKFph SFCepqPYHok67XcpZPnREHKtbZPXgFLLBKnGBveY5T8wtfgJG1fljfITAWpiYGPWbcok oTvP6M8levUvF1AS4KiH7Lu/DOlhirNgdp3j+A4FayV3tUgumiz7bPPrA8poGtrOJQZx RYCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=hV2OpNDlf9B8X2Y4BzyxalclcI5O3SjBzPMCmfPooZQ=; b=OupR0PDYxvSHl69ozqfTFIviDCjOZANNe9i2imRA6RiIJ2/ryQu7bDJZbyeso0fjNH JWmSdbZhW+o4WV8qYafW1/U9oJ47E1xnIIWY6XK9Fwn/VbS7s5TsFwY7tASdspPK0Gwx AIMd6xIkKD44aHPXXQ+swiHxK6eE+ItBLxGhR0zovbsQ2yKiCiz0M8UoMYKW65Lrp9zB CVrxOyP60PogdjSBEVcFrbZpMhK8iDWJcw9803vN1EfAEFhammCYXLYzJT5A8UGfG2LZ dUTwE9cgL+5rY+GmMuf0rAYV+DRVNjBeHZ7SQ7qdBBpXqD0dcQg4lLRzk7XtIKFzDPLk SzFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cIXhIats; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si45335499plf.250.2019.08.06.22.39.58; Tue, 06 Aug 2019 22:39:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cIXhIats; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727325AbfHGFj5 (ORCPT + 28 others); Wed, 7 Aug 2019 01:39:57 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43393 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbfHGFjz (ORCPT ); Wed, 7 Aug 2019 01:39:55 -0400 Received: by mail-pl1-f193.google.com with SMTP id 4so31939846pld.10 for ; Tue, 06 Aug 2019 22:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hV2OpNDlf9B8X2Y4BzyxalclcI5O3SjBzPMCmfPooZQ=; b=cIXhIatsOcPuqn1+MgSm/QQB00cmGPVG8EbiRAPHUblko3fhn/9Pkpx/65QgW82eNH M0NEPAUTZxkplleu9px9+XRjuwTitLxz1ocIySnkyfqIvPgUWfLOZP4JvFXaeDAGHuZf gfb+cgF+zUNZJoCL70yvlLUa1ZzUuJXe6Wkujgon5BgiOZruSI4mqq+7l2Az18BLZMJa hIgU/T237Nrn1TzV5hATl8jhLt3m7srfJmdcAEm+yU+ToxZ8gJi1xu1FnqOX2Dhnktp+ 6+Crb6NnrQKI5jNDt6RGfuKMOiXcj/jhR316UzF1+SlE5hhasDGbjw0nzwq6pkPCkU0g oWaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hV2OpNDlf9B8X2Y4BzyxalclcI5O3SjBzPMCmfPooZQ=; b=eBbkhKjtLuN+tUZdIbsZlKp5THVMvPX18efdTMSeGA9jh2RqjD7AR7q1nmQb4X5TIV dGQMLer0mva0bePmOrmtuw5hW90yvzUJDtmYr3uNHsmRMtJuSR/5pdRJx4HY+6Gt0iJJ EHzRst4bhMx/iC5Vv0q6sr94RiJbrtNBYwysPb5o2b/BPeEk/I34WirHKcRq8+p+jp3R NL5+zKAlnmmSPqQUT/ap8QcLUdXqTsbw/fQvNeq+VXGptCVH+nO99iSp9Xg9AgRJBceM g86n6vLZMDcB1LUvn7veHOaRQX0uuQavt8dWzbAB1qbb1YQmXmWmMEQAbvSQAofiqD1F IpJw== X-Gm-Message-State: APjAAAXAlSSjKfn3taHgjkyhxSBQASnVbHs1NwZkswDJcamKYHngYJ5N jH3Yb2dGsrxpDvruXacd2jVlGhKi5IA= X-Received: by 2002:a62:2ccc:: with SMTP id s195mr7503689pfs.256.1565156394058; Tue, 06 Aug 2019 22:39:54 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u7sm86070777pfm.96.2019.08.06.22.39.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 22:39:53 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Andy Gross , Sibi Sankar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH 7/9] remoteproc: Introduce "panic" callback in ops Date: Tue, 6 Aug 2019 22:39:40 -0700 Message-Id: <20190807053942.9836-8-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190807053942.9836-1-bjorn.andersson@linaro.org> References: <20190807053942.9836-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- drivers/remoteproc/remoteproc_core.c | 16 ++++++++++++++++ include/linux/remoteproc.h | 3 +++ 2 files changed, 19 insertions(+) -- 2.18.0 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 3c5fbbbfb0f1..cc47797c6496 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1833,6 +1833,16 @@ 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); + + rproc->ops->panic(rproc); + + return NOTIFY_DONE; +} + /** * rproc_get_by_phandle() - find a remote processor by phandle * @phandle: phandle to the rproc @@ -2058,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..33553f6d8ff0 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -383,6 +383,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 +482,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 +516,7 @@ struct rproc { bool auto_boot; struct list_head dump_segments; int nb_vdev; + struct notifier_block panic_nb; }; /** From patchwork Wed Aug 7 05:39:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 170708 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6660607ile; Tue, 6 Aug 2019 22:40:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxj57ExwajfNWA3NC8hOQBcju0zx09ZhBPapSt62y+pnl8VPoqUcrPOUogAua+nv8A36R44 X-Received: by 2002:a17:90a:9905:: with SMTP id b5mr6932231pjp.70.1565156405742; Tue, 06 Aug 2019 22:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565156405; cv=none; d=google.com; s=arc-20160816; b=k9mBN6x3XfR3X3s2BfmjTsQfnMkWaghYzlgegyEZELSwL60fxXHO0/JssJoN9nWwvF AFapBhDBqTxxM6AuM+w5YidtLKUfCjrhhs/ILGPFlZAqNvqB+DknNKO3AplK3GNs8NAS c9l4i33P8mk2QTW5RKf3oxoZJ704d2bBoOAQcAiGyVIA2Rzcz+HeCL8UVpFvpFwfgeyx CKVYvxAO5k6izJ1WtYGVXda0p0lkJZgfZ8r5FVoCPxoo0YqdFM80IwDGkG8hTC9KJ28Z JMf3YNn+2ApkEAOOyAJSUx0N+OCIgftt/iGUjHaie93hVwIWgz55JNBp9qFPH5ZFVncG bGUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=fsAZ/nMaAQwkSV7ok0DKoJTylqdRDHaUnbG8Kv9af6Y=; b=Unbo0FrBnvwoUYgde7TXy2DSbQJ5WPgKAhI+YIezni6Fbg4dtUU7zQO2gwgb8+gn9n QuRgNrQMfsRvVLwFyPZB9yASXpW5ozg0PPfWvLTbu2p1Sc62YlwGgjMGSJbMukSXlakP cApPeZuCGkSEqNVJvNw5Y5tp1VqYwXVFfKtg7KvuJkdEHMUBpyT6/4DpNJ7YSAiHH3BW dH0s0YMJN3IpJAXpheANmXGIH/YNlb2YdT9VmWtfNcygcu3IuatuMuE+3VjVqhC4FPQG mkehGQwJAEQyIi/l0RQ5pLlfLg6Tyl9KXlRkUZY2OKOXelHPDfJYAz1/onDVTQ6CRRqO KUQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o7CDKF6Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b73si16522077pjc.53.2019.08.06.22.40.05; Tue, 06 Aug 2019 22:40:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o7CDKF6Q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbfHGFkE (ORCPT + 28 others); Wed, 7 Aug 2019 01:40:04 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40085 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727258AbfHGFjz (ORCPT ); Wed, 7 Aug 2019 01:39:55 -0400 Received: by mail-pl1-f195.google.com with SMTP id a93so38877683pla.7 for ; Tue, 06 Aug 2019 22:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fsAZ/nMaAQwkSV7ok0DKoJTylqdRDHaUnbG8Kv9af6Y=; b=o7CDKF6Q9zJTqEn21bYLJqPajiZGXPc5Y9e/zNWTyKu0+rkskbOrSSsGUkphqHIUHC L4OHacF4qz/6w8cQ32lfzrB1nkoknbDFJxBpQiIYgvrd88hm7N8DOaHYJb3Tah3UL39o t83/EM7kkNOm1uCsLc/QzL7k1O0ncR/5mxsy9z5vIslOVkpGjT63wF7ZjwgNvZ4UAjr/ ljBgWOJYrDHfa2DfV7GeuAnipqrKg99clqucGsPDtJ0t79TgUtVilCHfVXmeE6bTTU/a 2UjvkV3Pjiy5/OfMi72US0LbfusZ5Hd2hdKpVi+UsbQWJZMhxWKYWLonDywV2YhG8l5o N8pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fsAZ/nMaAQwkSV7ok0DKoJTylqdRDHaUnbG8Kv9af6Y=; b=m9xNHMBPNX0natIGWpVk+TduOO7/3WImhaI3BJGgCO0T3UpLX7ZjWh/NxbvWXOTX6H lwfGrH9fbURXEG+gnDsbd/T1GAkPHPfrwCorrTq0MHRzhX6hQvA7+5j/B+RbVn0fdrD3 AUuTWlsdKf3br45X63uIqhQh7rB806rOZ0+GNPjQFEQTHpS8UKIeASc6NSQiilzgQNCy ra//ydUWXSAUkYnmJwU5N8Kb1SERiYUkqdxgkivouBd82DoK+6hm8YtfbcCaKdMK9Biz oiFPDIvMnTJxw2ZC4V3BinsTCFcHfqKfHmLLzVeM14UIJvLAMFPCgNBllyescEPAXBlF /pxA== X-Gm-Message-State: APjAAAVNxBle166ohS2nK38BiyNC30KNeArFJV0arDmxHFon7yE8fXL4 x4xKyCfheRJEVU1gpsTNRJSZfg== X-Received: by 2002:a62:198d:: with SMTP id 135mr7484409pfz.169.1565156395121; Tue, 06 Aug 2019 22:39:55 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id u7sm86070777pfm.96.2019.08.06.22.39.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 22:39:54 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: Andy Gross , Sibi Sankar , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [PATCH 8/9] remoteproc: qcom: q6v5: Add common panic handler Date: Tue, 6 Aug 2019 22:39:41 -0700 Message-Id: <20190807053942.9836-9-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190807053942.9836-1-bjorn.andersson@linaro.org> References: <20190807053942.9836-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_q6v5.c | 19 +++++++++++++++++++ drivers/remoteproc/qcom_q6v5.h | 1 + 2 files changed, 20 insertions(+) -- 2.18.0 diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c index 0d33e3079f0d..0aebae893362 100644 --- a/drivers/remoteproc/qcom_q6v5.c +++ b/drivers/remoteproc/qcom_q6v5.c @@ -6,6 +6,7 @@ * Copyright (C) 2014 Sony Mobile Communications AB * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. */ +#include #include #include #include @@ -15,6 +16,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 +165,22 @@ 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. + */ +void qcom_q6v5_panic(struct qcom_q6v5 *q6v5) +{ + qcom_smem_state_update_bits(q6v5->state, + BIT(q6v5->stop_bit), BIT(q6v5->stop_bit)); + + mdelay(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..c37e6fd063e4 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); +void qcom_q6v5_panic(struct qcom_q6v5 *q6v5); #endif