Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2368476pxb; Mon, 20 Sep 2021 20:21:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmskeRgHH3HZDd53Tcw94XuRoA3yCDcuXdlv2a223vXYcAf4ulAP0xCzn8piI/wqLVMzVr X-Received: by 2002:a17:906:e216:: with SMTP id gf22mr31903261ejb.357.1632194485702; Mon, 20 Sep 2021 20:21:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632194485; cv=none; d=google.com; s=arc-20160816; b=cxlgQxqByxfOKlhQUrktob2sCxN3hCGcoIcwwijQHBBsmtRpdfPk5YchGA5GBmCUOY aU9bqmTVwEO/gXizxO2BkPHZVoYIyTtZxlwXfgJQdEa5ROfKSIR/O9UEuaNLGOrJ3UX0 OVsPbML9tqXxAKgbTQCHqFiqfXhpFtuqYYNBxBlm3+tPBzn3GnqS5/2lN3Pqf5amX6Ii wh3rIGliBFT45o6QwDWeM75OAw1jhkXSF9N6pwzGEVmCw8nksvwH5X2jy3oOQtYkj96Q Kxm+n1GCBPiiKWbqeaG2S7y2lN5qm/JWm7MVEqoKChsCoUHkOCRhIL8z8xUFJ4DJEkKq j/Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Znx150GeQHqCUDq1R5d3pbprQ1CNmBnhDQEfjRdzInA=; b=lbTLPd9WTQHOQ5YaS51LWtsAnhGOXLRH+IZ2/j3tPqxbNoqr2DmT9dxGyO51kFqg1K UOYMD8AjHEBW+vHIHYkOm3It7ScpceJnkHnkAkkSsieFCKIla3RHJMGKgwaPtETB9Ena c4nDQICa/S5ABLj6mLUMRLiYUDg7/vqxJ+siuAnywD9B2GBnk9Ip+QmG/CAK4AiThbgQ r5qY/2xPqyxsEnZpq3tvqRwcqP3Q3OQKXirYAut0wmP1RWrrIaT4xZbhdfCxz2H3KeT2 PE32F7a+V707TQNROuZN/x227Dj7sftrZ9pC0GCyfJBW+MK0QC9Gaccb5MnNHdY3Qyzh +XAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pLmoJql/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id bi23si18628429ejb.186.2021.09.20.20.21.01; Mon, 20 Sep 2021 20:21:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pLmoJql/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1377669AbhITSWe (ORCPT + 99 others); Mon, 20 Sep 2021 14:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376689AbhITSOP (ORCPT ); Mon, 20 Sep 2021 14:14:15 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 344F5C08EC02 for ; Mon, 20 Sep 2021 09:59:24 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id t1so18026656pgv.3 for ; Mon, 20 Sep 2021 09:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Znx150GeQHqCUDq1R5d3pbprQ1CNmBnhDQEfjRdzInA=; b=pLmoJql/uGd9y5YWMAaw23mJ/vvCcu2k97DZKvIRYqbFMrYUm4dT4kQ4Q/XPnZvNC+ oOxZBB/3kgNwkvpjvXgXm+QwBLSStHjRTqnRkp8ZZfgsuCGqwjUPVMZaG+iKm/Kb5qlR 0SaSi98FfWbkAWnKUagCCoqsQASzkdigyscJfhv3hy32ZIy/g2QTMISwJIuPxPlPqdRO nMEQDXZzD6hM6bjCSbyVXTUD1XHKnbU96X5PfWR3h5b8/rjdqqbSa1nKZ5rwbbYGz2gp bu9qaDDjmkiOXJx4LNxm1JOGQ9ZZ0WRGz+i02B8nuhAbIEoGhDCH+w0XHwBR90Ac9jZj L9rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Znx150GeQHqCUDq1R5d3pbprQ1CNmBnhDQEfjRdzInA=; b=TA6TLVZrE51WH5FBy8oheug8WWOG4h+pN/pqlFqt3YD61xhQIrd83woxJpYXIEzXRI 8dPRk4WxzFS9VeFUHHMZf73zdENofU3GE7E1TOrJ6zjaC5ufgglcY3Gdlk/N5SAPKksD dn2lHGTlJMQiCT1JIquAjDz6k/IWBdxIOCqxIkTewPjVADUSW0HEcmkNC3OsggkLQkzB EqEVxHfy/tmBwW6qyVXL5s9feoCAF6OGNcxcWm0R0zxk5qI2GJHQAG5OXCAkdGAM04qO 8ECgi3IGa52dyStf5d7fcbXU+ihbwLqe82Ygc442InlxWiO6HkOiunZeDCTPDSEdIxYi hbOw== X-Gm-Message-State: AOAM5336F1XQGcaPr7dFvFCizVcOZ2gornOZs6UcZhyvtHLq5B/lVlg7 vpR1dZ/1zkZYwFJB3aT4PXA93A== X-Received: by 2002:a05:6a00:22d5:b0:440:3750:f5f4 with SMTP id f21-20020a056a0022d500b004403750f5f4mr26496924pfj.64.1632157163696; Mon, 20 Sep 2021 09:59:23 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id k127sm15590110pfd.1.2021.09.20.09.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 09:59:22 -0700 (PDT) Date: Mon, 20 Sep 2021 10:59:20 -0600 From: Mathieu Poirier To: "Peng Fan (OSS)" Cc: ohad@wizery.com, bjorn.andersson@linaro.org, o.rempel@pengutronix.de, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, aisheng.dong@nxp.com, Peng Fan Subject: Re: [PATCH V4 3/6] remoteproc: imx_rproc: fix TCM io memory type Message-ID: <20210920165920.GC2023964@p14s> References: <20210910090621.3073540-1-peng.fan@oss.nxp.com> <20210910090621.3073540-4-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210910090621.3073540-4-peng.fan@oss.nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 05:06:18PM +0800, Peng Fan (OSS) wrote: > From: Dong Aisheng > > is_iomem was introduced in the commit 40df0a91b2a5 ("remoteproc: add > is_iomem to da_to_va"), but the driver seemed missed to provide the io > type correctly. > This patch updates remoteproc driver to indicate the TCM on IMX are io > memories. Without the change, remoteproc kick will fail. If the kick fails on all these platforms, why was patch 40df0a91b2a5 ever submitted at all? To me this is a serious problem that should have been caught before it got sent to the mailing list. I have applied this patch but based on the blatant problems this patchset underscores, how can I trust future patches coming from NXP? > > Cc: Bjorn Andersson > Cc: Mathieu Poirier > Cc: Peng Fan > Reviewed-and-tested-by: Peng Fan > Fixes: 79806d32d5aa ("remoteproc: imx_rproc: support i.MX8MN/P") > Signed-off-by: Dong Aisheng > Signed-off-by: Peng Fan > --- > drivers/remoteproc/imx_rproc.c | 35 ++++++++++++++++++++-------------- > 1 file changed, 21 insertions(+), 14 deletions(-) > > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c > index d88f76f5305eb..71dcc6dd32e40 100644 > --- a/drivers/remoteproc/imx_rproc.c > +++ b/drivers/remoteproc/imx_rproc.c > @@ -71,6 +71,7 @@ struct imx_rproc_mem { > /* att flags */ > /* M4 own area. Can be mapped at probe */ > #define ATT_OWN BIT(1) > +#define ATT_IOMEM BIT(2) > > /* address translation table */ > struct imx_rproc_att { > @@ -117,7 +118,7 @@ struct imx_rproc { > static const struct imx_rproc_att imx_rproc_att_imx8mn[] = { > /* dev addr , sys addr , size , flags */ > /* ITCM */ > - { 0x00000000, 0x007E0000, 0x00020000, ATT_OWN }, > + { 0x00000000, 0x007E0000, 0x00020000, ATT_OWN | ATT_IOMEM }, > /* OCRAM_S */ > { 0x00180000, 0x00180000, 0x00009000, 0 }, > /* OCRAM */ > @@ -131,7 +132,7 @@ static const struct imx_rproc_att imx_rproc_att_imx8mn[] = { > /* DDR (Code) - alias */ > { 0x10000000, 0x40000000, 0x0FFE0000, 0 }, > /* DTCM */ > - { 0x20000000, 0x00800000, 0x00020000, ATT_OWN }, > + { 0x20000000, 0x00800000, 0x00020000, ATT_OWN | ATT_IOMEM }, > /* OCRAM_S - alias */ > { 0x20180000, 0x00180000, 0x00008000, ATT_OWN }, > /* OCRAM */ > @@ -147,7 +148,7 @@ static const struct imx_rproc_att imx_rproc_att_imx8mn[] = { > static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { > /* dev addr , sys addr , size , flags */ > /* TCML - alias */ > - { 0x00000000, 0x007e0000, 0x00020000, 0 }, > + { 0x00000000, 0x007e0000, 0x00020000, ATT_IOMEM}, > /* OCRAM_S */ > { 0x00180000, 0x00180000, 0x00008000, 0 }, > /* OCRAM */ > @@ -159,9 +160,9 @@ static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { > /* DDR (Code) - alias */ > { 0x10000000, 0x80000000, 0x0FFE0000, 0 }, > /* TCML */ > - { 0x1FFE0000, 0x007E0000, 0x00020000, ATT_OWN }, > + { 0x1FFE0000, 0x007E0000, 0x00020000, ATT_OWN | ATT_IOMEM}, > /* TCMU */ > - { 0x20000000, 0x00800000, 0x00020000, ATT_OWN }, > + { 0x20000000, 0x00800000, 0x00020000, ATT_OWN | ATT_IOMEM}, > /* OCRAM_S */ > { 0x20180000, 0x00180000, 0x00008000, ATT_OWN }, > /* OCRAM */ > @@ -199,12 +200,12 @@ static const struct imx_rproc_att imx_rproc_att_imx7d[] = { > /* OCRAM_PXP (Code) - alias */ > { 0x00940000, 0x00940000, 0x00008000, 0 }, > /* TCML (Code) */ > - { 0x1FFF8000, 0x007F8000, 0x00008000, ATT_OWN }, > + { 0x1FFF8000, 0x007F8000, 0x00008000, ATT_OWN | ATT_IOMEM }, > /* DDR (Code) - alias, first part of DDR (Data) */ > { 0x10000000, 0x80000000, 0x0FFF0000, 0 }, > > /* TCMU (Data) */ > - { 0x20000000, 0x00800000, 0x00008000, ATT_OWN }, > + { 0x20000000, 0x00800000, 0x00008000, ATT_OWN | ATT_IOMEM }, > /* OCRAM (Data) */ > { 0x20200000, 0x00900000, 0x00020000, 0 }, > /* OCRAM_EPDC (Data) */ > @@ -218,18 +219,18 @@ static const struct imx_rproc_att imx_rproc_att_imx7d[] = { > static const struct imx_rproc_att imx_rproc_att_imx6sx[] = { > /* dev addr , sys addr , size , flags */ > /* TCML (M4 Boot Code) - alias */ > - { 0x00000000, 0x007F8000, 0x00008000, 0 }, > + { 0x00000000, 0x007F8000, 0x00008000, ATT_IOMEM }, > /* OCRAM_S (Code) */ > { 0x00180000, 0x008F8000, 0x00004000, 0 }, > /* OCRAM_S (Code) - alias */ > { 0x00180000, 0x008FC000, 0x00004000, 0 }, > /* TCML (Code) */ > - { 0x1FFF8000, 0x007F8000, 0x00008000, ATT_OWN }, > + { 0x1FFF8000, 0x007F8000, 0x00008000, ATT_OWN | ATT_IOMEM }, > /* DDR (Code) - alias, first part of DDR (Data) */ > { 0x10000000, 0x80000000, 0x0FFF8000, 0 }, > > /* TCMU (Data) */ > - { 0x20000000, 0x00800000, 0x00008000, ATT_OWN }, > + { 0x20000000, 0x00800000, 0x00008000, ATT_OWN | ATT_IOMEM }, > /* OCRAM_S (Data) - alias? */ > { 0x208F8000, 0x008F8000, 0x00004000, 0 }, > /* DDR (Data) */ > @@ -341,7 +342,7 @@ static int imx_rproc_stop(struct rproc *rproc) > } > > static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 da, > - size_t len, u64 *sys) > + size_t len, u64 *sys, bool *is_iomem) > { > const struct imx_rproc_dcfg *dcfg = priv->dcfg; > int i; > @@ -354,6 +355,8 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 da, > unsigned int offset = da - att->da; > > *sys = att->sa + offset; > + if (is_iomem) > + *is_iomem = att->flags & ATT_IOMEM; > return 0; > } > } > @@ -377,7 +380,7 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *i > * On device side we have many aliases, so we need to convert device > * address (M4) to system bus address first. > */ > - if (imx_rproc_da_to_sys(priv, da, len, &sys)) > + if (imx_rproc_da_to_sys(priv, da, len, &sys, is_iomem)) > return NULL; > > for (i = 0; i < IMX_RPROC_MEM_MAX; i++) { > @@ -553,8 +556,12 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, > if (b >= IMX_RPROC_MEM_MAX) > break; > > - priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, > - att->sa, att->size); > + if (att->flags & ATT_IOMEM) > + priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, > + att->sa, att->size); > + else > + priv->mem[b].cpu_addr = devm_ioremap_wc(&pdev->dev, > + att->sa, att->size); > if (!priv->mem[b].cpu_addr) { > dev_err(dev, "failed to remap %#x bytes from %#x\n", att->size, att->sa); > return -ENOMEM; > -- > 2.25.1 >