From patchwork Fri Jul 27 13:14:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 143048 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp806662ljj; Fri, 27 Jul 2018 06:15:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd3o/mcAp+pWshN5DYHVlxKJjQJGi2QZVPjHFqAkWOMUNk+K3KosNIgQSRPUQnuKPlXTLMr X-Received: by 2002:a17:902:bd97:: with SMTP id q23-v6mr6059314pls.311.1532697325855; Fri, 27 Jul 2018 06:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532697325; cv=none; d=google.com; s=arc-20160816; b=wxOmtyRwwrZka0BcqPlDOqwvjzr++MkmoPrh5urfH5Z054kbBWPc/055S+g/TPdAAT IYcBjM55xR5BlpDV+1QGXvTHssXWhH1tYnKcR7LgBV3luvWrO1pJs+U/lJ1zmY1Df3b8 UE2QAST1VjsMvCYS93k66BOplMVdjKg7CH2R9faJtSJ5+KJyUCZSOOVEhAscaltCh2AR U0oL50mLsHE7RjBh8R2sga+9nYvTAiVbJ9GLq7YIsRAwk+7RZcNwefYSb/3L57JscFXF hrlh/WlVrk7HVeEfJ1kq540pOpj4jP7dU7Qb2QHxfThmDlce8qh5p6XyXDscD1ffmjn7 /4Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=61HX4v53lFjf1VRtWI8OhT8O5R/DU69bxHb7w5OJaSI=; b=S3HrlzDUy75zKF9zDd3sJgee0gHTNJZRAxcG8KmUoukGlvracOi32/QU5mgmLk/tzV XKfSZrKzIsmyOdVJGnJ5D5Ffz88AVxrBHqYSSq7AWkNwmfKZw4pR7pZ5RraogIvc3Uhd 8GnGqfCxXH1PgyWKd8BJYKfZAVGu7cNSWx8z29Dk9328AjS4r+yG4FknvtuO/Dm5QIWz fD+ThT7mvshxSsk936bnhiUxXgGD1xH+S1AkRWpPk5Nl1lFW7uZS87wcoJ3NNf4nBIgz ZHCG4XCV61QuoQEC1D9N5LxHck4t+oMpk0kw1ilksdiDuNvadYkKroO0JwlQAD6xtt8s ovLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 184-v6si3992936pgj.421.2018.07.27.06.15.25; Fri, 27 Jul 2018 06:15:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388141AbeG0OhQ (ORCPT + 31 others); Fri, 27 Jul 2018 10:37:16 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:39841 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730395AbeG0OhQ (ORCPT ); Fri, 27 Jul 2018 10:37:16 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w6RDE18o014480; Fri, 27 Jul 2018 15:15:18 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2kg1tj8psw-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 27 Jul 2018 15:15:18 +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 D4FF431; Fri, 27 Jul 2018 13:15:17 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag7node2.st.com [10.75.127.20]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B1138577A; Fri, 27 Jul 2018 13:15:17 +0000 (GMT) Received: from localhost (10.75.127.48) by SFHDAG7NODE2.st.com (10.75.127.20) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 27 Jul 2018 15:15:17 +0200 From: Loic Pallardy To: , CC: , , , , , Loic Pallardy Subject: [PATCH v4 01/17] remoteproc: configure IOMMU only if device address requested Date: Fri, 27 Jul 2018 15:14:36 +0200 Message-ID: <1532697292-14272-2-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532697292-14272-1-git-send-email-loic.pallardy@st.com> References: <1532697292-14272-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG6NODE1.st.com (10.75.127.16) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-27_06:, , signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If there is no IOMMU associate to remote processor device, remoteproc_core won't be able to satisfy device address requested in firmware resource table. Return an error as configuration won't be coherent. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 4cd1a8e..437fabf 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -657,7 +657,15 @@ static int rproc_handle_carveout(struct rproc *rproc, * to use the iommu-based DMA API: we expect 'dma' to contain the * physical address in this case. */ - if (rproc->domain) { + + if (rsc->da != FW_RSC_ADDR_ANY && !rproc->domain) { + dev_err(dev->parent, + "Bad carveout rsc configuration\n"); + ret = -ENOMEM; + goto dma_free; + } + + if (rsc->da != FW_RSC_ADDR_ANY && rproc->domain) { mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); if (!mapping) { ret = -ENOMEM;