[UPSTREAM PENDING] iommu/arm-smmu-v3: add suspend/resume support
Add suspend/resume support for arm-smmu-v3. Move irq initialization to probe and re-use the reset function for restoring registers in resume. Bug 4267541 Change-Id: I7bf410f0b69b56f1e1c138e9802449bcd3634a1e Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-stable/+/3112738 Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/canonical/linux-noble/+/3447965 Tested-by: Ashish Mhetre <amhetre@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
Ashish Mhetre
parent
a0eab0226d
commit
09c630f285
@@ -3434,12 +3434,6 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
|
||||
}
|
||||
}
|
||||
|
||||
ret = arm_smmu_setup_irqs(smmu);
|
||||
if (ret) {
|
||||
dev_err(smmu->dev, "failed to setup irqs\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (is_kdump_kernel())
|
||||
enables &= ~(CR0_EVTQEN | CR0_PRIQEN);
|
||||
|
||||
@@ -3907,7 +3901,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
|
||||
resource_size_t ioaddr;
|
||||
struct arm_smmu_device *smmu;
|
||||
struct device *dev = &pdev->dev;
|
||||
bool bypass;
|
||||
|
||||
smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL);
|
||||
if (!smmu)
|
||||
@@ -3922,7 +3915,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
/* Set bypass mode according to firmware probing result */
|
||||
bypass = !!ret;
|
||||
smmu->bypass = !!ret;
|
||||
|
||||
smmu = arm_smmu_impl_probe(smmu);
|
||||
if (IS_ERR(smmu))
|
||||
@@ -3990,10 +3983,16 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
|
||||
arm_smmu_rmr_install_bypass_ste(smmu);
|
||||
|
||||
/* Reset the device */
|
||||
ret = arm_smmu_device_reset(smmu, bypass);
|
||||
ret = arm_smmu_device_reset(smmu, smmu->bypass);
|
||||
if (ret)
|
||||
goto err_disable;
|
||||
|
||||
ret = arm_smmu_setup_irqs(smmu);
|
||||
if (ret) {
|
||||
dev_err(smmu->dev, "failed to setup irqs\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* And we're up. Go go go! */
|
||||
ret = iommu_device_sysfs_add(&smmu->iommu, dev, NULL,
|
||||
"smmu3.%pa", &ioaddr);
|
||||
@@ -4055,10 +4054,24 @@ static void arm_smmu_driver_unregister(struct platform_driver *drv)
|
||||
platform_driver_unregister(drv);
|
||||
}
|
||||
|
||||
static int __maybe_unused arm_smmu_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct arm_smmu_device *smmu = dev_get_drvdata(dev);
|
||||
|
||||
arm_smmu_device_reset(smmu, smmu->bypass);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops arm_smmu_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(NULL, arm_smmu_runtime_resume)
|
||||
};
|
||||
|
||||
static struct platform_driver arm_smmu_driver = {
|
||||
.driver = {
|
||||
.name = "arm-smmu-v3",
|
||||
.of_match_table = arm_smmu_of_match,
|
||||
.pm = &arm_smmu_pm_ops,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
.probe = arm_smmu_device_probe,
|
||||
|
||||
@@ -707,6 +707,8 @@ struct arm_smmu_device {
|
||||
|
||||
struct rb_root streams;
|
||||
struct mutex streams_mutex;
|
||||
|
||||
bool bypass;
|
||||
};
|
||||
|
||||
struct arm_smmu_stream {
|
||||
|
||||
Reference in New Issue
Block a user