From patchwork Mon Mar 15 20:58:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 12140673 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 A4B75C433DB for ; Mon, 15 Mar 2021 21:01:27 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 3A71464F37 for ; Mon, 15 Mar 2021 21:01:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A71464F37 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=eHFtB2eq/7+WNEe5K8v5FP9mt9KiUikR2vb+A3FfqWI=; b=Y7MabdNyFHil/dL24wFsmtT3GJ 9xfxdYwnY1UqE6lmjlpX2LX6foS0h/+CI/EvmYCexlNPP57WX+V066yxEhlNKUrf8HdYX4stacPAY GWvW+Mk+IWIw/Pnf+zs9hQbAXrNCgVGb+GcsgmAkcxgvm4CjcpgT9kyN1vPOfXmeeagKoqITACi9V DtDHyCk45J8q559pQqVSUl3vyFWNIW6TkNPa3fboefek+DwCwdKCqXz+ZD+HTCf7DQUpdVWBEwIiv cQCn8Ykxds2mwfPA4XSDzQZIm9V4fiq3hXnxbd9D5ikIyD1pMJ2cYJ7wMRFoIXS//wQymJbft0Z01 xHVrElGQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lLuIz-00Gt3q-SR; Mon, 15 Mar 2021 20:59:14 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lLuIu-00Gt2v-Tu for linux-arm-kernel@lists.infradead.org; Mon, 15 Mar 2021 20:59:11 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12FKx5F3115937; Mon, 15 Mar 2021 15:59:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615841945; bh=UoF3cldJyikro6utsBYNtr1jTBmig21JZkMN3IlKsys=; h=From:To:CC:Subject:Date; b=hK+xJkiURaN2Fv5+HlpWoMqYp6FagUS0NmqR82+0z1jMWDMZYApr9+hU8V6CwtwLK U0XRIHgilJ0TjG5C0HPSx2kwulF8pJfu5uPODoqZzIzcqMF0gm4RofGnYwwiOJ7XiH 1nGJMleUmySctvvScF7ht/tnNE0+MXlSPRmTy7yg= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12FKx4b7118738 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Mar 2021 15:59:04 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 15 Mar 2021 15:59:04 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE100.ent.ti.com (10.64.6.21) 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; Mon, 15 Mar 2021 15:59:04 -0500 Received: from fllv0103.dal.design.ti.com (fllv0103.dal.design.ti.com [10.247.120.73]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 12FKx4dR098491; Mon, 15 Mar 2021 15:59:04 -0500 Received: from localhost ([10.250.34.48]) by fllv0103.dal.design.ti.com (8.14.7/8.14.7) with ESMTP id 12FKx42r064830; Mon, 15 Mar 2021 15:59:04 -0500 From: Suman Anna To: Bjorn Andersson , Mathieu Poirier CC: Grzegorz Jaszczyk , Jan Kiszka , Lokesh Vutla , Vignesh Raghavendra , , , , Subject: [PATCH] remoteproc: pru: Fix firmware loading crashes on K3 SoCs Date: Mon, 15 Mar 2021 15:58:59 -0500 Message-ID: <20210315205859.19590-1-s-anna@ti.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210315_205909_432014_9D63EF8F X-CRM114-Status: GOOD ( 14.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Mathieu Poirier --- 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) {