Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3838737pxf; Mon, 15 Mar 2021 21:51:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkr19L8ipJMuNiaTOD3X4Ljk24kO5xNBuSoEaFKNEaDB6jHUQRYewqWquVWrZ331cYoDnG X-Received: by 2002:a17:906:8308:: with SMTP id j8mr26708378ejx.339.1615870285589; Mon, 15 Mar 2021 21:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615870285; cv=none; d=google.com; s=arc-20160816; b=bSL6bnZTp8LpCZV07cjxromOrZFg3MaA72la2iock08FRGk4MG4our2PDzeOaYFs9T 4G55V1meAAm36y8Qd+jPNOvpIBT6riDWsTPUekHg0Fv7fKcSBF4fi776RU2myQGLuF9D x/nOoV4he2Ou9HmXas+q3BsKKa5/jEeNX720LAjO48oUykFOlReJvniZ15T4nL5V+3fn 4FZdwzYXnTJOln6Lgb7LEEXH5y5YjSNIIy35Ojmbbv1p7790a2eB/7KkWHUyr06LhUD+ nV977Fj6uilwx2As6ZeUq9Xm1EwoqmlAoPHGBEHSinbLZ8tiFMWRBoWCBTSHTtKhx2v7 cVsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UoF3cldJyikro6utsBYNtr1jTBmig21JZkMN3IlKsys=; b=vr6ysXsSyAp57pgdOVG11qU/nQfUmyIEJ0heclFi+4jg7OHWfYZ0p5lvXlHj7IZbGK uJTFjtv7lYPvloKkhZ5vSVupCzsipkLFwVuxs7Y5Sc0KkvD2yw6BsXGAI35SoaUWAyxq sO3hlBxMBLYYI3WWenF99aJdWQQD3+LxOPQamItBKXdJPi5qtYPXYe4FBLnJX4PJj/l8 jYnoet9ox9cRMq/vwG2kl56rbx/S2RO4/HaMI5pfODdZ3BMxJBcH5n5rEbpjI0cM7BVb xedP/vaxZaRzjyWON6lQCyWZIAmX0pXYbB18s/YYqTwkd1NS5RCo5dR4blKHAVMrc1Fu N9Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=hK+xJkiU; 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 a10si12957977edv.308.2021.03.15.21.51.01; Mon, 15 Mar 2021 21:51: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=@ti.com header.s=ti-com-17Q1 header.b=hK+xJkiU; 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 S232705AbhCOU7n (ORCPT + 99 others); Mon, 15 Mar 2021 16:59:43 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:42438 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232240AbhCOU7O (ORCPT ); Mon, 15 Mar 2021 16:59:14 -0400 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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