From patchwork Wed Oct 12 16:00:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic PALLARDY X-Patchwork-Id: 9373591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA66A60839 for ; Wed, 12 Oct 2016 16:54:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA752296FA for ; Wed, 12 Oct 2016 16:54:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF51429703; Wed, 12 Oct 2016 16:54:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2709C296FA for ; Wed, 12 Oct 2016 16:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755791AbcJLQyk (ORCPT ); Wed, 12 Oct 2016 12:54:40 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:28536 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755622AbcJLQyj (ORCPT ); Wed, 12 Oct 2016 12:54:39 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u9CFuQq4028941; Wed, 12 Oct 2016 18:01:20 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-.pphosted.com with ESMTP id 2615cgwhx8-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 12 Oct 2016 18:01:19 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5B88D31; Wed, 12 Oct 2016 16:01:19 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4453C2AB4; Wed, 12 Oct 2016 16:01:19 +0000 (GMT) Received: from localhost (10.201.23.23) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.279.2; Wed, 12 Oct 2016 18:01:18 +0200 From: Loic Pallardy To: , , CC: , , , Subject: [PATCH v3 14/20] remoteproc: core: Add force mode to resource amending function Date: Wed, 12 Oct 2016 18:00:32 +0200 Message-ID: <1476288038-24909-15-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476288038-24909-1-git-send-email-loic.pallardy@st.com> References: <1476288038-24909-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.23] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-12_09:, , signatures=0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds force mode to rproc_update_resource_table_entry function. When force is unset, resource will be updated only if no specific addresses are requested by firmware. When force is set, resource is directly overwritten. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 26fc647..3847fd4 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -980,7 +980,8 @@ static int rproc_verify_resource_table_entry(struct rproc *rproc, static int rproc_update_resource_table_entry(struct rproc *rproc, struct rproc_request_resource *request, - struct resource_table *table, int size) + struct resource_table *table, int size, + bool force) { struct fw_rsc_carveout *tblc, *newc; struct fw_rsc_devmem *tbld, *newd; @@ -1005,7 +1006,8 @@ static int rproc_update_resource_table_entry(struct rproc *rproc, if (strncmp(newc->name, tblc->name, 32)) break; - memcpy(tblc, newc, request->size); + if (tblc->pa == FW_RSC_ADDR_ANY || force) + memcpy(tblc, newc, request->size); return updated; case RSC_DEVMEM: @@ -1143,7 +1145,7 @@ rproc_apply_resource_overrides(struct rproc *rproc, /* If we already have a table, update it with the new values. */ updated = rproc_update_resource_table_entry(rproc, resource, - table, size); + table, size, false); if (updated < 0) { table = ERR_PTR(updated); goto out;