iommu/omap: Add system suspend/resume support
authorSuman Anna <s-anna@ti.com>
Wed, 7 Aug 2019 08:26:49 +0000 (11:26 +0300)
committerJoerg Roedel <jroedel@suse.de>
Fri, 9 Aug 2019 15:37:10 +0000 (17:37 +0200)
commitc4206c4e190bd272e4e86389613f2cded4609ba1
treec4e7c5e2ca3b922d04eacf40899def6a86b6f6fe
parentc3b44a063d3b4d9b5afabaf5ab2e3fc11518dc84
iommu/omap: Add system suspend/resume support

The MMU registers for the remote processors lose their context
in Open Switch Retention (OSWR) or device OFF modes. Hence, the
context of the IOMMU needs to be saved before it is put into any
of these lower power state (OSWR/OFF) and restored before it is
powered up to ON again. The IOMMUs need to be active as long as
the client devices that are present behind the IOMMU are active.

This patch adds the dev_pm_ops callbacks to provide the system
suspend/resume functionality through the appropriate runtime
PM callbacks. The PM runtime_resume and runtime_suspend callbacks
are already used to enable, configure and disable the IOMMUs during
the attaching and detaching of the client devices to the IOMMUs,
and the new PM callbacks reuse the same code by invoking the
pm_runtime_force_suspend() and pm_runtime_force_resume() API. The
functionality in dev_pm_ops .prepare() checks if the IOMMU device
was already runtime suspended, and skips invoking the suspend/resume
PM callbacks. The suspend/resume PM callbacks are plugged in through
the 'late' pm ops to ensure that the IOMMU devices will be suspended
only after its master devices (remoteproc devices) are suspended and
restored before them.

NOTE:
There are two other existing API, omap_iommu_save_ctx() and
omap_iommu_restore_ctx(). These are left as is to support
suspend/resume of devices on legacy OMAP3 SoC.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/omap-iommu.c