summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2c8fa88)
raw | patch | inline | side by side (parent: 2c8fa88)
author | Venkateswara Rao Mandela <venkat.mandela@ti.com> | |
Thu, 22 Jan 2015 11:48:01 +0000 (17:18 +0530) | ||
committer | Gerrit Code Review <gerrit2@DLEZVX23.itg.ti.com> | |
Wed, 27 May 2015 14:15:03 +0000 (09:15 -0500) |
The remoteproc module has a concept of "late attach" whereby a remote
core is loaded externally to remoteproc, for which remoteproc must
attach to the core without disrupting its existing state. Introduce an
iommu-based "late attach" model for the same use case.
In the "late attach" model, the iommu subsystem is mostly unused since
the external loader will have programmed the remote core's mmu, but
certain "attach" functionality must be performed so that subsequent
"detach" functionality can complete.
This logic is detected in the driver through a "ti,late-attach" property
set on the IOMMU node in the device tree. The IOMMU node should also have
the "ti,no-init-on-reset" and "ti,no-init-on-idle" so that the omap_hwmod
and omap_device layers do not reset and idle/disable the device during
the initial kernel boot. This "ti,late-attach" is therefore removed from
the device tree on the first probe so that further probes or remoteproc
recovery boots treat the IOMMU device normally.
Change-Id: Id288932641a99378f7ca4b0addc3edbcc3d29ed4
Signed-off-by: Venkateswara Rao Mandela <venkat.mandela@ti.com>
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
core is loaded externally to remoteproc, for which remoteproc must
attach to the core without disrupting its existing state. Introduce an
iommu-based "late attach" model for the same use case.
In the "late attach" model, the iommu subsystem is mostly unused since
the external loader will have programmed the remote core's mmu, but
certain "attach" functionality must be performed so that subsequent
"detach" functionality can complete.
This logic is detected in the driver through a "ti,late-attach" property
set on the IOMMU node in the device tree. The IOMMU node should also have
the "ti,no-init-on-reset" and "ti,no-init-on-idle" so that the omap_hwmod
and omap_device layers do not reset and idle/disable the device during
the initial kernel boot. This "ti,late-attach" is therefore removed from
the device tree on the first probe so that further probes or remoteproc
recovery boots treat the IOMMU device normally.
Change-Id: Id288932641a99378f7ca4b0addc3edbcc3d29ed4
Signed-off-by: Venkateswara Rao Mandela <venkat.mandela@ti.com>
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt | patch | blob | history | |
drivers/iommu/omap-iommu.c | patch | blob | history | |
drivers/iommu/omap-iommu.h | patch | blob | history |
diff --git a/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt b/Documentation/devicetree/bindings/iommu/ti,omap-iommu.txt
index eb66dda650c31d020e3654ecfed07d3dcb6d5917..9f6d1c0e52475b268bd13847234a065bd437414e 100644 (file)
This property is mandatory for DSP IOMMU instances on DRA7xx
SoCs, and is optional on other SoCs.
+The following optional properties are _required_ only during "late attach":
+- ti,late-attach : Flag to indicate IOMMU has already been configured by
+ bootloader. This property is only relevant for initial
+ boot, so is removed by the driver during the first
+ probe.
+- ti,no-reset-on-init : Flag to let the hwmod layer not reset the IOMMU at init
+- ti,no-idle-on-init : Flag to let the hwmod layer not idle and disable IOMMU
+ at init
+
Example:
/* OMAP3 ISP MMU */
mmu_isp: mmu@480bd400 {
index 17b7890616b2ce105eacdaea0fb84f72591bb8ce..11d5d44676df1250685bc0e2e7429349b4793508 100644 (file)
if (!arch_iommu)
return -ENODEV;
+ /*
+ * now that the threat of idling has passed, decrement the
+ * device usage count to balance the increment done in probe,
+ * the pm runtime device usage count will be managed normally
+ * from here on
+ */
+ if (obj->late_attach)
+ pm_runtime_put_noidle(obj->dev);
+
ret = pm_runtime_get_sync(obj->dev);
if (ret < 0)
pm_runtime_put_noidle(obj->dev);
obj = to_iommu(dev);
+ if (obj->late_attach) {
+ u32 val;
+
+ val = iommu_read_reg(obj, MMU_TTB);
+ iopgd = phys_to_virt(val);
+ if (!iopgd)
+ return ERR_PTR(-ENOMEM);
+ }
+
spin_lock(&obj->iommu_lock);
obj->iopgd = iopgd;
obj->iopgd = NULL;
iommu_disable(obj);
+ obj->late_attach = 0;
spin_unlock(&obj->iommu_lock);
struct omap_iommu *obj = to_iommu(dev);
int ret = 0;
- if (pdata && pdata->deassert_reset) {
+ /* do not deassert reset only during initial boot for late attach */
+ if ((!obj->late_attach || obj->domain) &&
+ pdata && pdata->deassert_reset) {
ret = pdata->deassert_reset(pdev, pdata->reset_name);
if (ret) {
dev_err(dev, "deassert_reset failed: %d\n", ret);
struct resource *res;
struct iommu_platform_data *pdata = pdev->dev.platform_data;
struct device_node *of = pdev->dev.of_node;
+ struct property *prop;
obj = devm_kzalloc(&pdev->dev, sizeof(*obj) + MMU_REG_SIZE, GFP_KERNEL);
if (!obj)
obj->da_end = 0xfffff000;
if (of_find_property(of, "ti,iommu-bus-err-back", NULL))
obj->has_bus_err_back = MMU_GP_REG_BUS_ERR_BACK_EN;
+
+ prop = of_find_property(of, "ti,late-attach", NULL);
+ if (prop) {
+ obj->late_attach = 1;
+ /*
+ * Clear the late attach property in device tree for
+ * subsequent probes.
+ */
+ err = of_remove_property(of, prop);
+ if (err < 0)
+ dev_err(&pdev->dev, "Unable to remove late-attach property\n");
+ }
} else {
obj->nr_tlb_entries = pdata->nr_tlb_entries;
obj->name = pdata->name;
platform_set_drvdata(pdev, obj);
pm_runtime_irq_safe(obj->dev);
+
+ /*
+ * increment the device usage count so that runtime_suspend is not
+ * invoked immediately after the probe (due to the ti,no-idle-on-init)
+ * and before any remoteproc has attached to the iommu
+ */
+ if (obj->late_attach)
+ pm_runtime_get_noresume(obj->dev);
+
pm_runtime_enable(obj->dev);
dev_info(&pdev->dev, "%s registered\n", obj->name);
iommu = odomain->iommus;
for (i = 0; i < odomain->num_iommus; i++, iommu++) {
+ /*
+ * Not necessary for late attach. The page table would be setup
+ * by the boot loader. Leaving the below code in place it does
+ * not have any side effects during late attach.
+ */
iommu->pgtable = kzalloc(IOPGD_TABLE_SIZE, GFP_ATOMIC);
if (!iommu->pgtable)
return -ENOMEM;
arch_data += (omap_domain->num_iommus - 1);
for (i = 0; i < omap_domain->num_iommus; i++, iommu--, arch_data--) {
oiommu = iommu->iommu_dev;
- iopgtable_clear_entry_all(oiommu);
+ if (!oiommu->late_attach)
+ iopgtable_clear_entry_all(oiommu);
omap_iommu_detach(oiommu);
iommu->iommu_dev = NULL;
index 4278aa36b77065ac726f2b1892426cc9b6ff89c7..2d9b41c0d494842c82528d241fd0c809ddca96a2 100644 (file)
int has_bus_err_back;
u32 id;
+
+ u32 late_attach;
};
struct cr_regs {