[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1478611764-6473-5-git-send-email-m.szyprowski@samsung.com>
Date: Tue, 08 Nov 2016 14:29:21 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org,
linux-samsung-soc@...r.kernel.org, Joerg Roedel <joro@...tes.org>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
Inki Dae <inki.dae@...sung.com>, Kukjin Kim <kgene@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Mark Brown <broonie@...nel.org>,
"Luis R. Rodriguez" <mcgrof@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Lukas Wunner <lukas@...ner.de>,
Kevin Hilman <khilman@...nel.org>,
Tobias Jakobi <tjakobi@...h.uni-bielefeld.de>,
Tomasz Figa <tomasz.figa@...il.com>
Subject: [PATCH v6 4/7] iommu/exynos: Set master device once on boot
To avoid possible races, set master device pointer in each SYSMMU
controller once on boot. Suspend/resume callbacks now properly relies on
the configured iommu domain to enable or disable SYSMMU controller.
While changing the code, also update the sleep debug messages and make
them conditional.
Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
---
drivers/iommu/exynos-iommu.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index f45b274..28e570b 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -600,10 +600,12 @@ static int exynos_sysmmu_suspend(struct device *dev)
struct sysmmu_drvdata *data = dev_get_drvdata(dev);
struct device *master = data->master;
- dev_dbg(dev, "suspend\n");
if (master) {
- __sysmmu_disable(data);
pm_runtime_put(dev);
+ if (data->domain) {
+ dev_dbg(data->sysmmu, "saving state\n");
+ __sysmmu_disable(data);
+ }
}
return 0;
}
@@ -613,10 +615,12 @@ static int exynos_sysmmu_resume(struct device *dev)
struct sysmmu_drvdata *data = dev_get_drvdata(dev);
struct device *master = data->master;
- dev_dbg(dev, "resume\n");
if (master) {
pm_runtime_get_sync(dev);
- __sysmmu_enable(data);
+ if (data->domain) {
+ dev_dbg(data->sysmmu, "restoring state\n");
+ __sysmmu_enable(data);
+ }
}
return 0;
}
@@ -730,7 +734,6 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
__sysmmu_disable(data);
data->pgtable = 0;
data->domain = NULL;
- data->master = NULL;
list_del_init(&data->domain_node);
}
@@ -772,7 +775,6 @@ static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain,
spin_lock_irqsave(&domain->lock, flags);
list_for_each_entry_safe(data, next, &domain->clients, domain_node) {
__sysmmu_disable(data);
- data->master = NULL;
data->pgtable = 0;
data->domain = NULL;
list_del_init(&data->domain_node);
@@ -806,7 +808,6 @@ static int exynos_iommu_attach_device(struct iommu_domain *iommu_domain,
data->domain = domain;
pm_runtime_get_sync(data->sysmmu);
__sysmmu_enable(data);
- data->master = dev;
spin_lock_irqsave(&domain->lock, flags);
list_add_tail(&data->domain_node, &domain->clients);
@@ -1192,6 +1193,7 @@ static int exynos_iommu_of_xlate(struct device *dev,
}
list_add_tail(&data->owner_node, &owner->controllers);
+ data->master = dev;
return 0;
}
--
1.9.1
Powered by blists - more mailing lists