From patchwork Thu Mar 1 16:23:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Pallardy X-Patchwork-Id: 130321 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3004109edc; Thu, 1 Mar 2018 08:24:17 -0800 (PST) X-Google-Smtp-Source: AG47ELv+pv2CTp+WEsddutpn9oZvdP2lAZ/dqsMr8VqluNL0qXT9Vf4fbmxdEbNiYHdr9iz5aznk X-Received: by 10.98.194.87 with SMTP id l84mr2516442pfg.6.1519921457805; Thu, 01 Mar 2018 08:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519921457; cv=none; d=google.com; s=arc-20160816; b=mH0aFX6PjHH0Y4qqlaFypQ4g0AtSHtgD7vBDTpFPPD4yUv+W2gEqp816NCUaBDTY1X 9Abto+U910QM29V3kk5rCVq3TQguw8xNlySMnFBh/7NLB8b39buqaaPhRWlZvcNu9Qp1 Zw3L0BEKmEOlY/F6n6W45zhWoOeI4sZy527cDJO6vu2ZdtyEhmC2tNr05CWNMRJlxJSn LcmKvItDTmv210L65BOgLTBEeanF6nDeiyITQJWr328op8CDiiOxgMiGhuHQZf/UAwyN O1RXqH3TYqp2qTAZfzN06cGXj4X3AQUv6DO4dSbsXb/JnHyHozm9N7KRk90h2JqtU42K Ll5Q== 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=9UiL+0x0iUTxyTQNP9WDZJgttFahGETNTD85JAxdG3w=; b=mygdlJ+ZhLpCkozC+O9wR/D1eLTu3NqNZ080wXArtqc+hQytJ+LThwSG+Budbk3EJc qBMC+St65q/VJTPTTdHaVmwxrLCERDZELTS1pdJJgBJnVdf5Db0EYDaDG1EPY+tx7kiB JAdzcqiC9NYBPMGPzrmnOAIUw2mOEOlqYUjlKZxJIDtpgwd8mticeHoobgAi814EHSDF 2vvyk6thRQcYLffsF0+V0MHmWBo+5YOfWz6GFh0+nuGN+sB9sJRcHjd+KNTBjmQ1/npz hLdaEZyp0k01Y9uX7PYtVh+4lhnpOf8jHO/4lIGlpwUa6s3fst3UHtZFGvR4aMGehLBw dfgw== 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 x2-v6si3206173plv.672.2018.03.01.08.24.17; Thu, 01 Mar 2018 08:24:17 -0800 (PST) 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 S1032971AbeCAQYP (ORCPT + 28 others); Thu, 1 Mar 2018 11:24:15 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:61627 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032698AbeCAQYN (ORCPT ); Thu, 1 Mar 2018 11:24:13 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w21GJQYX025446; Thu, 1 Mar 2018 17:24:11 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2gax28ujkc-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 01 Mar 2018 17:24:11 +0100 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 A998E31; Thu, 1 Mar 2018 16:24:10 +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 8F1ED51FD; Thu, 1 Mar 2018 16:24:10 +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; Thu, 1 Mar 2018 17:24:09 +0100 From: Loic Pallardy To: , CC: , , , , Loic Pallardy Subject: [PATCH v3 01/13] remoteproc: configure IOMMU only if device address requested Date: Thu, 1 Mar 2018 17:23:48 +0100 Message-ID: <1519921440-21356-2-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG7NODE2.st.com (10.75.127.20) To SFHDAG7NODE2.st.com (10.75.127.20) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-01_08:, , 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 4170dfb..56b33e4 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -654,7 +654,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;