diff options
| author | Xu Lu <luxu.kernel@bytedance.com> | 2025-01-03 17:32:20 +0800 |
|---|---|---|
| committer | Joerg Roedel <jroedel@suse.de> | 2025-01-06 12:38:11 +0100 |
| commit | 77a44196abfb39e183be554003e9ee76d95edab1 (patch) | |
| tree | 27f5f831f7122393505027ef007f0982a28728e0 /drivers/iommu/riscv/iommu-platform.c | |
| parent | 8d8d3752c0a4f7fb072352837cbdbf57c02df239 (diff) | |
iommu/riscv: Add shutdown function for iommu driver
This commit supplies shutdown callback for iommu driver. The shutdown
callback resets necessary registers so that newly booted kernel can pass
riscv_iommu_init_check() after kexec. Also, the shutdown callback resets
iommu mode to bare instead of off so that new kernel can still use PCIE
devices even when CONFIG_RISCV_IOMMU is not enabled.
Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
Link: https://lore.kernel.org/r/20250103093220.38106-3-luxu.kernel@bytedance.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/riscv/iommu-platform.c')
| -rw-r--r-- | drivers/iommu/riscv/iommu-platform.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iommu-platform.c index c722eebcdd9b..725e919b97ef 100644 --- a/drivers/iommu/riscv/iommu-platform.c +++ b/drivers/iommu/riscv/iommu-platform.c @@ -140,6 +140,11 @@ static void riscv_iommu_platform_remove(struct platform_device *pdev) platform_device_msi_free_irqs_all(&pdev->dev); }; +static void riscv_iommu_platform_shutdown(struct platform_device *pdev) +{ + riscv_iommu_disable(dev_get_drvdata(&pdev->dev)); +}; + static const struct of_device_id riscv_iommu_of_match[] = { {.compatible = "riscv,iommu",}, {}, @@ -148,6 +153,7 @@ static const struct of_device_id riscv_iommu_of_match[] = { static struct platform_driver riscv_iommu_platform_driver = { .probe = riscv_iommu_platform_probe, .remove = riscv_iommu_platform_remove, + .shutdown = riscv_iommu_platform_shutdown, .driver = { .name = "riscv,iommu", .of_match_table = riscv_iommu_of_match, |