lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1355678760-27357-15-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
Date:	Sun, 16 Dec 2012 18:26:00 +0100
From:	Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
To:	Hideki EIRAKU <hdk@...l.co.jp>
Cc:	Paul Mundt <lethal@...ux-sh.org>,
	Magnus Damm <magnus.damm@...il.com>,
	Simon Horman <horms@...ge.net.au>, linux-sh@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Katsuya MATSUBARA <matsu@...l.co.jp>,
	Damian Hobson-Garcia <dhobsong@...l.co.jp>
Subject: [PATCH/WIP/RFC 14/14] shmobile-ipmmu: Store iommu_mapping in struct shmobile_ipmmu

And remove the global iommu_mapping variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
---
 drivers/iommu/shmobile-iommu.c |   14 ++++++++------
 drivers/iommu/shmobile-ipmmu.h |    4 ++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/shmobile-iommu.c b/drivers/iommu/shmobile-iommu.c
index 2592d25..8cf45df 100644
--- a/drivers/iommu/shmobile-iommu.c
+++ b/drivers/iommu/shmobile-iommu.c
@@ -47,7 +47,6 @@ struct shmobile_iommu_domain {
 	atomic_t active;
 };
 
-static struct dma_iommu_mapping *iommu_mapping;
 static struct device *ipmmu_devices;
 static struct dma_pool *l1pool, *l2pool;
 static spinlock_t lock;
@@ -311,19 +310,22 @@ static struct iommu_ops shmobile_iommu_ops = {
 
 static int shmobile_iommu_attach_all_devices(struct shmobile_ipmmu *ipmmu)
 {
+	struct dma_iommu_mapping *mapping;
 	struct device *dev;
 
-	iommu_mapping = arm_iommu_create_mapping(&platform_bus_type, 0x0,
-						 L1_LEN << 20, 0);
-	if (IS_ERR_OR_NULL(iommu_mapping))
-		return PTR_ERR(iommu_mapping);
+	mapping = arm_iommu_create_mapping(&platform_bus_type, 0,
+					   L1_LEN << 20, 0);
+	if (IS_ERR(mapping))
+		return PTR_ERR(mapping);
+
+	ipmmu->iommu_mapping = mapping;
 
 	for (dev = ipmmu_devices; dev; ) {
 		struct shmobile_iommu_arch_data *data = dev->archdata.iommu;
 
 		data->ipmmu = ipmmu;
 
-		if (arm_iommu_attach_device(dev, iommu_mapping))
+		if (arm_iommu_attach_device(dev, mapping))
 			pr_err("arm_iommu_attach_device failed\n");
 
 		dev = data->next;
diff --git a/drivers/iommu/shmobile-ipmmu.h b/drivers/iommu/shmobile-ipmmu.h
index 1458a97..f8f0f57 100644
--- a/drivers/iommu/shmobile-ipmmu.h
+++ b/drivers/iommu/shmobile-ipmmu.h
@@ -1,11 +1,15 @@
 #ifndef __SHMOBILE_IPMMU_H__
 #define __SHMOBILE_IPMMU_H__
 
+struct dma_iommu_mapping;
+
 struct shmobile_ipmmu {
 	struct device *dev;
 	void __iomem *ipmmu_base;
 	int tlb_enabled;
 	struct mutex flush_lock;
+
+	struct dma_iommu_mapping *iommu_mapping;
 };
 
 #ifdef CONFIG_SHMOBILE_IPMMU_TLB
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ