From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5E2EC433E1 for ; Tue, 21 Jul 2020 20:44:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CF8520717 for ; Tue, 21 Jul 2020 20:44:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T2Aa1qTz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aplCMKmL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CF8520717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OZ5e+C0cEEOJQiZVe0/dBcSd3rQLrs/LtQI2uKzBqPk=; b=T2Aa1qTzbWh2qJrLKgwkRkEbE Gtcu63l1IRZDaa+Olw/v0EBQ7+/C3WjKEp4ub5B3/4MYx8igSWdnG75W2sUZVbIxolvRXYeopCJRS PUi4oavuTtLr43ojngbVfLvzR7GUwoOvSmsqmGy9PmS1q7ZJxgNo6061/07rGeJBF06Lv8TR+Yeij ogMYErtvu4asUPjj/yY6ZUYzRas/+O9QzFF1AdkAYcD34RBydNUKu/f9BV5/NfJlXMMpekIj6tzNs Uyy5Dihnu6chUu+Jc8GiJXzC1rpkISntHi3GrIceo7DnpP13SH8dzjnI70/WjBlPiekE/EbjJgS+F Sis3Ddvvg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxz6z-0006uN-Vu; Tue, 21 Jul 2020 20:43:42 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxz6v-0006sE-BL for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2020 20:43:38 +0000 Received: by mail-pf1-x444.google.com with SMTP id a24so7797pfc.10 for ; Tue, 21 Jul 2020 13:43:36 -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=6b3oA4UL1L2pl7xC9XCpGfPbFXbX6ZR3mQ/aH6nN3aM=; b=aplCMKmLtk1FND72f9eTw2pW0XV235w2d7abx0+nAqdK+5QHFUZUtqiXP3Y/5NfWwQ OP0koBCszYM3OjbRoWGb9J2n5jEHmqZ6iZvMjrdhubqs08gi7J2ZJm0AvaheIAChdgVe 7MEKxT+pv82gNj/QbYrQIrC+ws3wQQ1yxdP7oGdDW+0Vgl/fKppwh3+V150QjFW7B0sR pfuiSebY5wKyIuGmulwut1717V7STCbyNn4pXsUhj1rO3Uw2IJGLCqE9RK2xBIl74F49 isMNRqNjvPF38ITyYEMgKk4pMSMMY5Hw3R+VLWqG+e65UZgP/9R7FHaVotrNczHhVufX vhew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6b3oA4UL1L2pl7xC9XCpGfPbFXbX6ZR3mQ/aH6nN3aM=; b=H3MAsHHvdW1LxftBy55pYn2k46p0gVCF6OYqD5RzxyjExTXXjhCVbuSJVdV2/RDuIH d8VrkF9LMx7efuytduy3vzZxmhAhHYKH1rRFNKq2n18fG6Xeb1h62bT25r+B2W6aGciw YKYGC2VBCabk+qrcFpRHa/OSdQDPQ8375caeZ1kqurLqaYWIEVMwmIvlWl5d68FzMnmc j/Qs16y0q4O3MgZDsGjP+yQoHOAxSrY+URchMUM3qoXrZ2Ec8F8Rlp5KW6gIq550kI+s BI7jtrTQgqGYxnJks6YBDiFLvHFBzSN6TKHPUEKfMMGrEs2y5P3hZwJBEuCi63J6kDy2 VI3g== X-Gm-Message-State: AOAM533WU09VKEmIkSOu30jjksxlmYzxtaOLNHJE3ueFn0YS3ceLm+o0 E6CILiFBbO7EVc1Jrxge1w4U8A== X-Google-Smtp-Source: ABdhPJwuyrOyVT4KOawwJEajBAoNJgJsEKfBbYSabaXT83Sv4Y4Gqw+HTJiZ3dzR4rMofwR9hrMHZA== X-Received: by 2002:aa7:9906:: with SMTP id z6mr26338877pff.60.1595364215284; Tue, 21 Jul 2020 13:43:35 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id z10sm21858949pfr.90.2020.07.21.13.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 13:43:34 -0700 (PDT) Date: Tue, 21 Jul 2020 14:43:32 -0600 From: Mathieu Poirier To: Alexandre Bailon Subject: Re: [PATCH 5/6] remoteproc: mtk_apu: Don't try to use the APU local RAM Message-ID: <20200721204332.GC1227776@xps15> References: <20200713132927.24925-1-abailon@baylibre.com> <20200713132927.24925-6-abailon@baylibre.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200713132927.24925-6-abailon@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_164337_454510_F99763DD X-CRM114-Status: GOOD ( 24.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ohad@wizery.com, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, robh+dt@kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 13, 2020 at 03:29:26PM +0200, Alexandre Bailon wrote: > Currently, this local RAM is not accessible from the CPU. > If the CPU tries to access it, then the CPU will hang. > > Remoteproc may try to use it when it load a firmware > that has some sections in the local RAM. > This workarounds the issue by skiping this section. > > Signed-off-by: Alexandre Bailon > --- > drivers/remoteproc/mtk_apu_rproc.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/remoteproc/mtk_apu_rproc.c b/drivers/remoteproc/mtk_apu_rproc.c > index 565b3adca5de..e16d3258a785 100644 > --- a/drivers/remoteproc/mtk_apu_rproc.c > +++ b/drivers/remoteproc/mtk_apu_rproc.c > @@ -57,6 +57,9 @@ > #define CORE_DEFAULT2_SPIDEN BIT(0) > #define CORE_XTENSA_ALTRESETVEC (0x000001F8) > > +#define DRAM0_START (0x7ff00000) > +#define IRAM0_END (0x7ff80000) > + > struct mtk_vpu_rproc { > struct device *dev; > struct rproc *rproc; > @@ -139,6 +142,7 @@ static void mtk_vpu_rproc_kick(struct rproc *rproc, int vqid) > > int mtk_vpu_elf_sanity_check(struct rproc *rproc, const struct firmware *fw) > { > + struct mtk_vpu_rproc *vpu_rproc = rproc->priv; > const u8 *elf_data = fw->data; > struct elf32_hdr *ehdr; > struct elf32_phdr *phdr; > @@ -156,6 +160,16 @@ int mtk_vpu_elf_sanity_check(struct rproc *rproc, const struct firmware *fw) > /* Remove empty PT_LOAD section */ > if (phdr->p_type == PT_LOAD && !phdr->p_paddr) > phdr->p_type = PT_NULL; > + /* > + * Workaround: Currently, the CPU can't access to the APU > + * local RAM. This removes the local RAM section from the > + * firmware. Please note that may cause some issues. > + */ > + if (phdr->p_paddr >= DRAM0_START && phdr->p_paddr < IRAM0_END) { > + dev_warn_once(vpu_rproc->dev, > + "Skipping the APU local RAM section\n"); > + phdr->p_type = PT_NULL; We can't selectively decide to not load sections of a program due to a platform driver shortcoming. Either a real solution is found or booting the remote processor is interrupted, with a strong incline toward the former. I guess you're dealing with tightly coupled memory or on-chip RAM areas - both are accessed on other platform using ioremap_wc() or devm_ioremap_wc(). You might want to try doing what Suman has done in this patchset [1], with specific attention to TCMs and SRAM. Thanks, Mathieu [1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=310325 > + } > } > > return 0; > -- > 2.26.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel