Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp755932pxf; Thu, 25 Mar 2021 13:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3Vl2k0ynAGcHUMkVvLlZxA37lWRaDuoDcRgcEmfhaOi2JndaoNl+Bkn3awglZ7dBGZ0ng X-Received: by 2002:a17:907:3f96:: with SMTP id hr22mr11228950ejc.427.1616703669984; Thu, 25 Mar 2021 13:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616703669; cv=none; d=google.com; s=arc-20160816; b=bcg5awdNJUw2bYfD0Ai3/TE+MafxFUwLUc8KYeLwg3/FGIClTg1s0tUl6NbK65MaKG GibnuBHNHA1gO3Buw/FD/FCaAsxE9EkAcDvLoryVI+bXh9eqVysBsO1ii536B0E8ZhUd Ebvt1Zqc/nltl2EmAV6D4uq8MPBAlMhr97M8jrNBwzpaPy30084R57TqzxFFsYruGrLn jcV46Wk/hgcnOPUcnEFw81i7zM6QtUQAJ0UROJRwiKSJWeYiDLSV6HmpzXNVIaECSu2A 5ic3DUfKb6dxH5Asr86qdEYPXd0ZWVhzzS7+/ygWc4UHYMHypKrWfqeZ76solytneQrY /5gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dkim-signature; bh=KJuR5o9jImcczuGWZKeZZQslt0l/R8oIMFWCY3BFEXk=; b=xcx3irc5eBH5233XWVAzNC4k4HKenicqFYWmj1HHWuHvto+vr7cj5LgN5HgNK2qCFr IJ2EHhvP6P8faAILZyAh0N/P00bYPwPkN0Oh27jt+JfAJcw62GPGl2bqKetQVXoHO9Ti IMAJ1P38ulECn+C5/S6hFlHrGh/jHcEUHxdfaiFmf1m0u3wvnmrk71Mo3rL3Bcyrugp0 GiRcvKD9UpgGoihkIsuF5DKA1A4IBvTX68M4LMMvylE95mAeqDpyQJCz7xm0N2FNw9ms jyYfwi4lvTtRKXDWtKaRFEUFGIWioS8dIfXZlH8theL+RKkBspSwSiHXwl9pmCapsNQH S2JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ldH6kROW; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si4901791edx.253.2021.03.25.13.20.47; Thu, 25 Mar 2021 13:21:09 -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=@ti.com header.s=ti-com-17Q1 header.b=ldH6kROW; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbhCYUTw (ORCPT + 99 others); Thu, 25 Mar 2021 16:19:52 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:57740 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhCYUTm (ORCPT ); Thu, 25 Mar 2021 16:19:42 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12PKJYuD097527; Thu, 25 Mar 2021 15:19:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1616703574; bh=KJuR5o9jImcczuGWZKeZZQslt0l/R8oIMFWCY3BFEXk=; h=Subject:From:To:CC:References:Date:In-Reply-To; b=ldH6kROWnb/k4wIZ45z+D3SUXvQ5abynuNadg6cqv7PqgPHpMxaEH7sZm6NeN1rKr FMBu9d7D/5nVEraG6VQ53CpdN+pIJ0HIpKkPmLllWAlFvOOVYDKY0Ug3/LqM9kCV3R 1M/hdWJkBY83IYITdsyP0ctTbm72vuRj8/FwNZqg= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12PKJYDM015438 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Mar 2021 15:19:34 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 25 Mar 2021 15:18:22 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Thu, 25 Mar 2021 15:18:21 -0500 Received: from [10.250.33.213] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 12PKILUr130709; Thu, 25 Mar 2021 15:18:21 -0500 Subject: Re: [PATCH] remoteproc: pru: Fix firmware loading crashes on K3 SoCs From: Suman Anna To: Mathieu Poirier CC: Bjorn Andersson , Grzegorz Jaszczyk , Jan Kiszka , Lokesh Vutla , Vignesh Raghavendra , linux-remoteproc , , linux-arm-kernel , Linux Kernel Mailing List References: <20210315205859.19590-1-s-anna@ti.com> <20210323232014.GA1782475@xps15> <2f8bfc4f-e43d-5e38-fc6d-7045c69af364@ti.com> Message-ID: Date: Thu, 25 Mar 2021 15:18:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/25/21 3:09 PM, Suman Anna wrote: > On 3/25/21 12:36 PM, Mathieu Poirier wrote: >> On Wed, 24 Mar 2021 at 11:09, Suman Anna wrote: >>> >>> On 3/23/21 6:20 PM, Mathieu Poirier wrote: >>>> On Mon, Mar 15, 2021 at 03:58:59PM -0500, Suman Anna wrote: >>>>> The K3 PRUs are 32-bit processors and in general have some limitations >>>>> in using the standard ARMv8 memcpy function for loading firmware segments, >>>>> so the driver already uses a custom memcpy implementation. This added >>>>> logic however is limited to only IRAMs at the moment, but the loading >>>>> into Data RAMs is not completely ok either and does generate a kernel >>>>> crash for unaligned accesses. >>>>> >>>>> Fix these crashes by removing the existing IRAM logic limitation and >>>>> extending the custom memcpy usage to Data RAMs as well for all K3 SoCs. >>>>> >>>>> Fixes: 1d39f4d19921 ("remoteproc: pru: Add support for various PRU cores on K3 AM65x SoCs") >>>>> Signed-off-by: Suman Anna >>>> >>>> Probably a good idea to CC stable as well... >>>> >>>> Reviewed-by: Mathieu Poirier >>> >>> Thanks Mathieu. This patch is already staged on Bjorn's rproc-fixes branch >>> though and part of linux-next since next-20210319. I have posted an additional >>> 3-patch series for some more PRU fixes. Do you want me to post a v2 for those >>> with stable Cc'd? >> >> I didn't notice Bjorn had already picked it up. Since the object is >> now public there is no need to send a V2 for this one. I haven't >> looked at your other 3-patch series but if you think it is stable >> material then yes, please send a new revision that CC stable. > > Alright, will do. On a second thought, we don't have any dts nodes in-kernel yet (5.13-rc1 would be the first kernel with PRU nodes), so those are not critical for v5.11 kernel. As long as they get fixed in either the current v5.12-rc's or by v5.13-rc1, we will be fine. regards Suman > > regards > Suman > >> >> Mathieu >> >>> >>> regards >>> Suman >>> >>>> >>>>> --- >>>>> drivers/remoteproc/pru_rproc.c | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c >>>>> index 2667919d76b3..16979c1cd2f4 100644 >>>>> --- a/drivers/remoteproc/pru_rproc.c >>>>> +++ b/drivers/remoteproc/pru_rproc.c >>>>> @@ -585,7 +585,7 @@ pru_rproc_load_elf_segments(struct rproc *rproc, const struct firmware *fw) >>>>> break; >>>>> } >>>>> >>>>> - if (pru->data->is_k3 && is_iram) { >>>>> + if (pru->data->is_k3) { >>>>> ret = pru_rproc_memcpy(ptr, elf_data + phdr->p_offset, >>>>> filesz); >>>>> if (ret) { >>>>> -- >>>>> 2.30.1 >>>>> >>> >