Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp883757rwi; Thu, 13 Oct 2022 06:31:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74YTsEYtK7mKThpq/QR3BzlSJ+ZxgAq38/0HtUTQOPVpOegrq5Js/Z0HiXowlhnGipUscJ X-Received: by 2002:a17:90b:1b08:b0:20d:7bbf:4701 with SMTP id nu8-20020a17090b1b0800b0020d7bbf4701mr11362403pjb.87.1665667899585; Thu, 13 Oct 2022 06:31:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665667899; cv=pass; d=google.com; s=arc-20160816; b=KEzNrdJPL1/U91QBzO5nb/KziF89ITkKLFZ55BUTHuXUQxWDAqoJ3WRdEE6VrsBVFu SXZHgCihbzh/y+8XRsOA4KXKjGzD6oy653gucb5Tn4znYK3rY43bzvxIRj05XsoQ5KE9 e+ITutc7kE3EBjSbys0sdm7EJI62+yjqcWkKaDw4tCKKt6ycE6gihNkJA9MoRORTV1ab agCQmynsuxCDFpCoxTMq22rZqg/bNT9olu916LXhVh+xqBKy0LBonG/OuRtZH6TsJUFQ CeTX6CeJc4fCrWsF19oaS8OCndJfOWc8S762168rrEszcrkHZlNufvFRCuqvkmaDKjoX Lhtg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=A04tgZRSpnd1mH5f2USd/p6h1t+1aPPOR8Tr31i5lAk=; b=WSZhR/AL03vvjcXZEmBubyjZ4Ys+bcPw2ENfjkXP/4litHKnWTuNd78SR6tqSOkgba sHgjGGMW6NPLP01iBrx6QLnb8m6Kj7mIUsrD7UUVNcp2SBEY4reSuGACL2V7aqRglFW1 bQaL8tTXEJhL5syJpUgR9iS3xyCstlQ0mQRwzia+HVrFWn3tpjabnCsBVcoay08iKfxQ 2Ri4MEtEsT6+iI9JikaYuoUlZzfB52+8YbGxXiJpDFRR0cznqERbkgxOlHBS9vlybmwN l66CSdMaxu0hlCNvgFMta9V3Cg8de2kZC514v8tUiiRh5KJwEf/vR8WOHLI27kR270B0 bLIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lPg5yNnx; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p16-20020a637410000000b0045b00922ba5si23359341pgc.871.2022.10.13.06.31.24; Thu, 13 Oct 2022 06:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lPg5yNnx; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229792AbiJMNLG (ORCPT + 99 others); Thu, 13 Oct 2022 09:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbiJMNLE (ORCPT ); Thu, 13 Oct 2022 09:11:04 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2089.outbound.protection.outlook.com [40.107.105.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B028BDD88F; Thu, 13 Oct 2022 06:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mrouMMhMJtCubbHbdCHn5lxWGvaD3wHM7dVmOGIXEa24tJtwfwzOuFLD/k1QN84bdUD9iYwrhRriJqvV7lWnJz4IUM35ieDzQny165KbLits9HkjiFtqrG/zdxp+3YzmaPJ2l4pxbvWRICqNiJXkrpbmvs6Y1gAFUNjOUDEezoT6uRSz1HdclZ7eJXAima5GTjshBBBNN8UbfbE4c+hlUBTKzO3KyhC1it70XLWyX2j9i5KobnXA8KunWjJ2EUoZlE2uPy2W8BoJECAQE03BazoFaLvP4K4W6+ou3VZc//9EnojDlGKRduaSNJ56x+zPURsLSu+gVdg8TaudGnuSmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A04tgZRSpnd1mH5f2USd/p6h1t+1aPPOR8Tr31i5lAk=; b=OdLti3VPDYL6kayFaiPvkjedntHvXIqlnfvMM/r+SUMiHKBgWighvqDPMdNBxWT/8C6HMJfwa/7jjyXTJGk+aM3ovNUMJkqDuFheUeRnhb5pZMg4ElYaEGc8iRaspOm/qHsWBmmWC0OMgwQyM6LIwolXdRx1IR9sUefe2R8I4+LtoDITx09qwxRlNn6Vv6DFzkDKPpIilU3A7g1cYGal7OjnD1Uv3+V6AyUXM2ZDzPGHo8kBJn8Mb/613X6n4coTfRgiT0at47sd5NAbNNbc/tiJVZvPL/y78/uJpmNbODa6LzxZZLIZFy2EyXbpwYVys+ZryaoEdrqGV8b29bkZag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A04tgZRSpnd1mH5f2USd/p6h1t+1aPPOR8Tr31i5lAk=; b=lPg5yNnxqYxJjrLyuIW/wV58YWZh4RBPf0GBopqf6s5utIqF6jjC6SFFZ6czWAFl8Zn4cGstHQodKB5n9kk/UHjlJGas+AgN8+DH7RwGqhBZA56s19oT7pfWRRqs6kURXmQmQ5DMxOPmEwbWR6hNbpYQc8av4LSPggoQ2ZOyWXA= Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PA4PR04MB7918.eurprd04.prod.outlook.com (2603:10a6:102:c7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Thu, 13 Oct 2022 13:11:00 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::ba6:d7ae:a7c9:7a3a]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::ba6:d7ae:a7c9:7a3a%4]) with mapi id 15.20.5676.028; Thu, 13 Oct 2022 13:11:00 +0000 From: Peng Fan To: Mathieu Poirier , "Peng Fan (OSS)" CC: "andersson@kernel.org" , "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , dl-linux-imx , "linux-remoteproc@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH V6 7/7] remoteproc: imx_rproc: Enable attach recovery for i.MX8QM/QXP Thread-Topic: [PATCH V6 7/7] remoteproc: imx_rproc: Enable attach recovery for i.MX8QM/QXP Thread-Index: AQHY08r2gmnMju/tqkuS6OOPEOGgs64LbWAAgAD0beA= Date: Thu, 13 Oct 2022 13:11:00 +0000 Message-ID: References: <20220929061704.1571746-1-peng.fan@oss.nxp.com> <20220929061704.1571746-8-peng.fan@oss.nxp.com> <20221012223216.GE1196937@p14s> In-Reply-To: <20221012223216.GE1196937@p14s> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DU0PR04MB9417:EE_|PA4PR04MB7918:EE_ x-ms-office365-filtering-correlation-id: 4486ae67-57d6-4d95-4904-08daad1c5fb4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2tv5TEUwyh28Qq4nKuxc1zju0R+a8SDRwZHLkfevB8UZEUZwe2Y+EOaTtGQk6isVlWQSqmUJX1oB3uygRQfdIbWr7DVRN3DlkdGEiL0SyjH8EaZx9RkiPHIPrTUmFPSDlzNVnY8NAXfNoePG3UOQwF/VWLOEumjCMzw3WwJHRCc2N4nj7/TXOnBDlyvvOoFzF13dyjcxQd0yqHaNw18j7CV8T55rnAKZwIOzeRUD1ypUrTcqLodqquIcQma1nBzvfAzZukXpks1H1Ql6whppIQ4GxfDIZS3J55kv8ZFIid+27Qx7gUTp3O2M239qRMpIJ7iWTDcEKXVwAhFFoHOC21F5bVVif0vFVTIWMA9/N23YkhpFRbWK1Jc/krZ8a3xlTzjmoK/njNmQYKRki+pv/DgqAuLz4rsyEhbCIZ6/Et5cQWI7r95XxjIUZFmPWDJhgNa4Xye7/+a9GM9zmrJ7xpAba7mBbiLbJoP+3QVfe/EC8+Rm4hGeBwlrTpPIdRsqIAIwB6Sj4KapymdhhEZIGa2t7NTxk6KSOFGJJ+3XLAjDqaSOrPR6EjXX/2FkztAxPDydurzCHzCwFliJ1bfVOtxslCXQqyYlAIwhwrA9s6UwkSrxMLrRdi82NiT3tkOpD91E+JM/8vlk/B+eb0ErAWmZLvZlS7K5LhlGGntBIuviSYAC2u6h5l6/GqO7wIvlw5gcLmf8uOBwTRw0KjOKXPbUbD7c9cPwfYlYcXX9Hl3W4w3yFBVUHdUnjKXlJ/xhrJL6o8EOhi00NaxBm1HBow== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(136003)(39860400002)(396003)(376002)(451199015)(38070700005)(122000001)(38100700002)(8936002)(33656002)(55016003)(478600001)(316002)(110136005)(6506007)(86362001)(54906003)(7696005)(71200400001)(52536014)(76116006)(5660300002)(2906002)(64756008)(8676002)(66556008)(66476007)(4326008)(66946007)(41300700001)(186003)(83380400001)(44832011)(66446008)(7416002)(26005)(9686003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?o/0/alIwuku1glJpk3l15OqteJ+LxosktfQ+RwMcBN49bouxHPYi6V2Oz6U3?= =?us-ascii?Q?Qd4P7M1Q5LUfMzIr0f87bNKMwSsi6DpTkNn8muiAaplmsjFK842ict7unJW/?= =?us-ascii?Q?IXAI71FOSStJLoJxo0Ga5iLXxaDiKp38iFpmRWI8oEHFznONwgpZ7G9BguZZ?= =?us-ascii?Q?/cCitGDVfzLWmZKJzpPXQIIA4Qvf9Do7fHGoPRNmfCDoGzjI8fZurSOb17fe?= =?us-ascii?Q?ah7XQt5oPbHURz0zuX7Q6admaD+EkgbP9xC8z0z+SMevWQ8IwP7mBJjuZfn3?= =?us-ascii?Q?VfoHWrOY/kABaswaESSqn8+p5BIQAlrJ8xUXUs3vJlrGJ8xp4G/3SLhJCUn1?= =?us-ascii?Q?T9bURXUonrDLnttBxDTkmFQugLlVICY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6/CNiaQqFNEw4imU6jTZXhIR9A3nMoGQF3NsW8Qbi9pTpqcE1EOor?= =?us-ascii?Q?CQhNvzRymNSc4z9DpnW0pJ7/0EWQL8fUFCx5OK9IWyTaASMiNU4JTlfJfZYU?= =?us-ascii?Q?83W87SX+pZIWkoy6FB5oM60rUOSxhgXJwffzUPSJz0aqjMDb+pJ/1JTToWAp?= =?us-ascii?Q?6dXBYIync9ZeTTijNS+4pigxz+IK2GE4RGCx4KPrSkp4esoXwoO5A48ihTwE?= =?us-ascii?Q?glf1WWy8X8tCkonf+8gGxeJxtKYoMSlzFMDSmnhYz6TNXTwDfZY97s7Zwm9/?= =?us-ascii?Q?FOLpQZfCcpKpiBiZjfnL0sW6ybZnw4X3VmYpU8Ha?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4486ae67-57d6-4d95-4904-08daad1c5fb4 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Oct 2022 13:11:00.2374 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QLVSuxbhCaimDEJ4GI27msMXuUXQ67V34FpWUPUtGLpv5RqI+3zFTDhxJMfcr8M1Z3UbWAXuJW+MfaiZ/PqiNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7918 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu, > Subject: Re: [PATCH V6 7/7] remoteproc: imx_rproc: Enable attach recovery > for i.MX8QM/QXP >=20 > On Thu, Sep 29, 2022 at 02:17:04PM +0800, Peng Fan (OSS) wrote: > > From: Peng Fan > > > > i.MX8QM/QXP M4 could recover without help from Linux, so to support it: > > - enable feature RPROC_FEAT_ATTACH_ON_RECOVERY > > - add detach hook > > - Since we have detach callback, we could move the free mbox > > operation from partition reset notify to detach callback. > > > > Signed-off-by: Peng Fan > > --- > > drivers/remoteproc/imx_rproc.c | 22 +++++++++++++++++++--- > > 1 file changed, 19 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/remoteproc/imx_rproc.c > > b/drivers/remoteproc/imx_rproc.c index bece44b46719..4057d6f33813 > > 100644 > > --- a/drivers/remoteproc/imx_rproc.c > > +++ b/drivers/remoteproc/imx_rproc.c > > @@ -603,6 +603,22 @@ static int imx_rproc_attach(struct rproc *rproc) > > return imx_rproc_xtr_mbox_init(rproc); } > > > > +static int imx_rproc_detach(struct rproc *rproc) { > > + struct imx_rproc *priv =3D rproc->priv; > > + const struct imx_rproc_dcfg *dcfg =3D priv->dcfg; > > + > > + if (dcfg->method !=3D IMX_RPROC_SCU_API) > > + return -EOPNOTSUPP; > > + > > + if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) > > + return -EOPNOTSUPP; > > + > > + imx_rproc_free_mbox(rproc); >=20 > Which is exactly what you did here. >=20 > I really don't understand what you did in patch 6/7... Anyways, I sugges= t to > add support for the detached scenario and then fix the mailbox corruption > problem. When CM4 doing attach recovery, the mbox channel needs to be released, then attach function will request the mbox channel again. So the flow is=20 CM4(attach->request mbox)->CM4 crash notify Linux[1]->Linux got notificatio= n ->Linux detach(release mbox)[2]->Linux re-attach(request mbox) Since patch 7/7 is to support attach recovery, so I move mbox free from [1] to [2]. >=20 > I am done reviewing this set. Thanks for your time. Thanks, Peng. >=20 > > + > > + return 0; > > +} > > + > > static struct resource_table *imx_rproc_get_loaded_rsc_table(struct > > rproc *rproc, size_t *table_sz) { > > struct imx_rproc *priv =3D rproc->priv; @@ -618,6 +634,7 @@ static > > struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc > > *rproc static const struct rproc_ops imx_rproc_ops =3D { > > .prepare =3D imx_rproc_prepare, > > .attach =3D imx_rproc_attach, > > + .detach =3D imx_rproc_detach, > > .start =3D imx_rproc_start, > > .stop =3D imx_rproc_stop, > > .kick =3D imx_rproc_kick, > > @@ -797,8 +814,6 @@ static int imx_rproc_partition_notify(struct > notifier_block *nb, > > if (!((event & BIT(priv->rproc_pt)) && (*(u8 *)group =3D=3D > IMX_SC_IRQ_GROUP_REBOOTED))) > > return 0; > > > > - imx_rproc_free_mbox(priv->rproc); > > - > > rproc_report_crash(priv->rproc, RPROC_WATCHDOG); > > > > pr_info("Partition%d reset!\n", priv->rproc_pt); @@ -916,7 +931,8 > @@ > > static int imx_rproc_detect_mode(struct imx_rproc *priv) > > } > > > > priv->rproc->state =3D RPROC_DETACHED; > > - priv->rproc->recovery_disabled =3D true; > > + priv->rproc->recovery_disabled =3D false; > > + rproc_set_feature(priv->rproc, > RPROC_FEAT_ATTACH_ON_RECOVERY); > > > > /* Get partition id and enable irq in SCFW */ > > ret =3D imx_sc_rm_get_resource_owner(priv->ipc_handle, > priv->rsrc_id, > > &pt); > > -- > > 2.37.1 > >