Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2127660pxb; Mon, 12 Apr 2021 15:22:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1GRYqHskuyiA3Y7rX5sCskK/VfGjt1V99YXhTIJQqHywDZybXL2q9tgUnKSMlQaqCJr/s X-Received: by 2002:a63:6c83:: with SMTP id h125mr20595159pgc.50.1618266146220; Mon, 12 Apr 2021 15:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618266146; cv=none; d=google.com; s=arc-20160816; b=wRD9xhr5Bxv69MbS1gSGPEE7QdMkXuW4FhKM29exJhckmG2MudZLBaDpfnIQpgdbam zNq0IziqaToP8dnYJ6L5pZUp4Gn9Zc0qNK9WaaI4Vx2uUjXyxMo9A3zGObJrGUQIjng8 UnkNyybAZcLVZkTWmJfI7vhDxhw8+lWJYIZJQf1sZd+EJSI5iEKs87oMy/2GrBQnSVHT DDuQACJ/gwT57ZY5D5HBsAGyAX849cMB6jTsnV5xUBUb0wn4Xe6aIX4hh2AO2Yi8lGkI alVQAE5QCRaCC8scp+3l/wvLENuLAmR/dWL3kCoAyP9+js8G0NdXbaBqaAfJZ/HlUb9e RxsQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6GG+SiWMlnUCVmqffvgPu+7njh+503FgTjxNVb7Gs/g=; b=YjKkhHSMeWslg6UbJm5yiE6gzEWs60NI5DuRafbRhff9N8VnYTyzRUTjUiz3/MVWPy HDuOW0quJNJvuyUB41w+C6oEAcudcwygrYzsiESJ+Do1Cfq+r4kyFP7mxfDaQdm/jNS+ 1yDhuS9cP9ljnF6caU72EN/6AKHJKrt905DVdnu4Eu6g9SkOv748sCgMJGhfljdsy97N BuuUGx98MNn0WD6NYml8TxgiOdrKrucetQL5ymkQfSCg6gxAHwLucrtHqAa8h7RyLd1Y xdpnasoqfViMbawmxD8NXR3HZLGs1FITBhsPd27x48uMCyDzT3cO01JEujX5SsDA8sZC foeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hw0JQDLW; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si15999664pgr.207.2021.04.12.15.22.12; Mon, 12 Apr 2021 15:22:26 -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=@linuxfoundation.org header.s=korg header.b=Hw0JQDLW; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240179AbhDLJaX (ORCPT + 99 others); Mon, 12 Apr 2021 05:30:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:33550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238998AbhDLJG1 (ORCPT ); Mon, 12 Apr 2021 05:06:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9727461394; Mon, 12 Apr 2021 09:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218202; bh=mu82aaxhUSCv4teRdVd5Z/xs1BukO8EHJhQNZSEeNn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hw0JQDLWpYJH1xNxadEC1GEgTlsywVKY29nD0wfUjjiO0hZEqnfvhXw0uhTujvUYS LbHcYNR+w5GOA7pjbPN9FuyzKDQMf+iL/LkIxFfVrDPOq5Ma2RPFx40oAfAmtKHbbs sKAhfGZIg4D30H2S49dsp/az+AL3Qa9n12T3THcs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suman Anna , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.11 109/210] remoteproc: pru: Fix firmware loading crashes on K3 SoCs Date: Mon, 12 Apr 2021 10:40:14 +0200 Message-Id: <20210412084019.642767947@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suman Anna [ Upstream commit 9afeefcf06fc7b4bdab06a6e2cb06745bded34dd ] 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 Link: https://lore.kernel.org/r/20210315205859.19590-1-s-anna@ti.com Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- 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.2