From patchwork Thu Aug 31 13:14:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 111391 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp2530062qge; Thu, 31 Aug 2017 06:14:24 -0700 (PDT) X-Google-Smtp-Source: ADKCNb7N57cfqsP4AT0mBDI65306lhMrp18MY8Z6cz0kBtjEvGt/dp1k5VaEGSVeGuUYlqU5zTn0 X-Received: by 10.99.117.88 with SMTP id f24mr2421638pgn.9.1504185264321; Thu, 31 Aug 2017 06:14:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504185264; cv=none; d=google.com; s=arc-20160816; b=Br463abcQbupIT4pljv5ITt0oSNXGnSUUjM/Bn9fmWq7evzVMQ5D534yhuRJA7uO8S /yp2XcCoPpfkyVs97+NE3jbHFC975qBptnkxImOYjx+2jjcKzwzRLdNZt+T7EHAxhXw4 9VdXNJYtw4MFrkxNBiGqnCvEcte4/xMVDqpkHFscoZfZFK7PuBXcy+fGNIHODEhHkZGM QNFVuOTvb3o8pfs1m2rr5etBuH83qp2ftBSz6kac6nlezUCJ3XUpolu20ior6EqVD/dT omA6/hZ2iiuD9EU/egiGxTegtuGM+lES+mQQ9QrgB6Pl8Ifl2+cod4C5lUUJ0V446+ZV TgcQ== 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:dkim-signature :arc-authentication-results; bh=97W6n0qxziX02ibpr4LaR4fKq13rDjYbr3y3DryeWEE=; b=McaChUvREgPOdIdwgDgKq5tvYpg6zUBu7LpNvhyV0nDsx65zk74P03O1RiySSTxpBH z3lCM1h2Hgr7YAnpZeZ+8kVcSeV1B+i/SL/S8mhTCQI4WuWlvGUY+i+stea1qb8Cc1kR m4ZqabTb3fJP6mCihpH5+MVRbPj9OK0XSk50j9YVuaclb9TWjbFCbrccmH7UGasYykRe 90fuPoJsQH2dUn/iqOu5idi0zH9lFYv54arA4dAy0pcEpHXMYtFaUgeaQPpt09oZQil9 luo4vLHOnWdqYV2UYlaVoOjLRWm5gXouCmeNNySqs0emWZb0nJAPexW/Abaw2D2pPvZv MT7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=zHOQEwaF; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si6634707plj.776.2017.08.31.06.14.24; Thu, 31 Aug 2017 06:14:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=zHOQEwaF; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751717AbdHaNOV (ORCPT + 3 others); Thu, 31 Aug 2017 09:14:21 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:58903 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbdHaNOT (ORCPT ); Thu, 31 Aug 2017 09:14:19 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7VDE6hO026182; Thu, 31 Aug 2017 08:14:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1504185246; bh=thnVLcHC0AZ6r7EQYNSu73yikUXKStH8oxrlIUvx1DM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=zHOQEwaFTWKDD5mTGrCeC61PpbqS0HXZuOUxrMuKPglsEON7UOazACqzMeTFuNMU6 mqlhKwmclMaUi78gSjBTOkSbHVr7nCYVlJIZJ5WRsHMyZ3+3FQTL50rs7NEju0V4ff UeYDsUqPhVJxEwr0QXae6JCfekha/ZpkblA1t8GE= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7VDE5dE021974; Thu, 31 Aug 2017 08:14:06 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Thu, 31 Aug 2017 08:14:04 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Thu, 31 Aug 2017 08:14:04 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7VDE4iL001200; Thu, 31 Aug 2017 08:14:04 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v7VDE4303317; Thu, 31 Aug 2017 08:14:04 -0500 (CDT) From: Suman Anna To: Joerg Roedel CC: , Tony Lindgren , Tero Kristo , Laurent Pinchart , , , Suman Anna Subject: [PATCH 1/2] iommu/omap: Change the attach detection logic Date: Thu, 31 Aug 2017 08:14:01 -0500 Message-ID: <20170831131402.29502-2-s-anna@ti.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170831131402.29502-1-s-anna@ti.com> References: <20170831131402.29502-1-s-anna@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The OMAP IOMMU driver allows only a single device (eg: a rproc device) to be attached per domain. The current attach detection logic relies on a check for an attached iommu for the respective client device. Change this logic to use the client device pointer instead in preparation for supporting multiple iommu devices to be bound to a single iommu domain, and thereby to a client device. Signed-off-by: Suman Anna --- drivers/iommu/omap-iommu.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) -- 2.13.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index bd67e1b2c64e..81ef729994ce 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -805,7 +805,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data) struct iommu_domain *domain = obj->domain; struct omap_iommu_domain *omap_domain = to_omap_domain(domain); - if (!omap_domain->iommu_dev) + if (!omap_domain->dev) return IRQ_NONE; errs = iommu_report_fault(obj, &da); @@ -1118,8 +1118,8 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) spin_lock(&omap_domain->lock); - /* only a single device is supported per domain for now */ - if (omap_domain->iommu_dev) { + /* only a single client device can be attached to a domain */ + if (omap_domain->dev) { dev_err(dev, "iommu domain is already attached\n"); ret = -EBUSY; goto out; @@ -1148,9 +1148,14 @@ static void _omap_iommu_detach_dev(struct omap_iommu_domain *omap_domain, { struct omap_iommu *oiommu = dev_to_omap_iommu(dev); + if (!omap_domain->dev) { + dev_err(dev, "domain has no attached device\n"); + return; + } + /* only a single device is supported per domain for now */ - if (omap_domain->iommu_dev != oiommu) { - dev_err(dev, "invalid iommu device\n"); + if (omap_domain->dev != dev) { + dev_err(dev, "invalid attached device\n"); return; } @@ -1219,7 +1224,7 @@ static void omap_iommu_domain_free(struct iommu_domain *domain) * An iommu device is still attached * (currently, only one device can be attached) ? */ - if (omap_domain->iommu_dev) + if (omap_domain->dev) _omap_iommu_detach_dev(omap_domain, omap_domain->dev); kfree(omap_domain->pgtable);