Skip to contentSkip to conversation

iommu/arm-smmu-v3: Implement shutdown method

PATCH In review Nate Watterson 2 participants 3 messages Jun 29, 2017 – Jun 30, 2017 IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iommu/arm-smmu-v3: Implement shutdown method

The shutdown method disables the SMMU to avoid corrupting a new kernel started with kexec.

---
 drivers/iommu/arm-smmu-v3.c | 7 +++++++
 drivers/iommu/arm-smmu.c    | 6 ++++++
 2 files changed, 13 insertions(+)
drivers/iommu/arm-smmu-v3.c +7 -0
index 380969a..3d8ac29 100644
@@ -2765,9 +2765,15 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 	struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
 
 	arm_smmu_device_disable(smmu);
+
 	return 0;
 }
 
+static void arm_smmu_device_shutdown(struct platform_device *pdev)
+{
+	arm_smmu_device_remove(pdev);
+}
+
 static struct of_device_id arm_smmu_of_match[] = {
 	{ .compatible = "arm,smmu-v3", },
 	{ },
@@ -2781,6 +2787,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 	},
 	.probe	= arm_smmu_device_probe,
 	.remove	= arm_smmu_device_remove,
+	.shutdown = arm_smmu_device_shutdown,
 };
 module_platform_driver(arm_smmu_driver);
 
drivers/iommu/arm-smmu.c +6 -0
index 7ec30b0..af50bab 100644
@@ -2319,6 +2319,11 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void arm_smmu_device_shutdown(struct platform_device *pdev)
+{
+	arm_smmu_device_remove(pdev);
+}
+
 static struct platform_driver arm_smmu_driver = {
 	.driver	= {
 		.name		= "arm-smmu",
@@ -2326,6 +2331,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
 	},
 	.probe	= arm_smmu_device_probe,
 	.remove	= arm_smmu_device_remove,
+	.shutdown = arm_smmu_device_shutdown,
 };
 module_platform_driver(arm_smmu_driver);
 
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. on behalf of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux
Foundation Collaborative Project.
#1 lore raw

I should have removed the '-v3' since this revision of the patch adds shutdown to arm-smmu.c as well. I'll fix that in a subsequent version after waiting to see if there are additional changes that need to be made.

Quoted 62 lines · Nate Watterson

The shutdown method disables the SMMU to avoid corrupting a new kernel started with kexec.

---
  drivers/iommu/arm-smmu-v3.c | 7 +++++++
  drivers/iommu/arm-smmu.c    | 6 ++++++
  2 files changed, 13 insertions(+)
drivers/iommu/arm-smmu-v3.c +7 -0
index 380969a..3d8ac29 100644
@@ -2765,9 +2765,15 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
  	struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
 
  	arm_smmu_device_disable(smmu);
+
  	return 0;
  }
 
+static void arm_smmu_device_shutdown(struct platform_device *pdev)
+{
+	arm_smmu_device_remove(pdev);
+}
+
  static struct of_device_id arm_smmu_of_match[] = {
  	{ .compatible = "arm,smmu-v3", },
  	{ },
@@ -2781,6 +2787,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
  	},
  	.probe	= arm_smmu_device_probe,
  	.remove	= arm_smmu_device_remove,
+	.shutdown = arm_smmu_device_shutdown,
  };
  module_platform_driver(arm_smmu_driver);
 
drivers/iommu/arm-smmu.c +6 -0
index 7ec30b0..af50bab 100644
@@ -2319,6 +2319,11 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
  	return 0;
  }
 
+static void arm_smmu_device_shutdown(struct platform_device *pdev)
+{
+	arm_smmu_device_remove(pdev);
+}
+
  static struct platform_driver arm_smmu_driver = {
  	.driver	= {
  		.name		= "arm-smmu",
@@ -2326,6 +2331,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
  	},
  	.probe	= arm_smmu_device_probe,
  	.remove	= arm_smmu_device_remove,
+	.shutdown = arm_smmu_device_shutdown,
  };
  module_platform_driver(arm_smmu_driver);
 
Signature · 2 lines
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
#2 lore raw
In reply to Nate Watterson
Quoted 8 lines · Nate Watterson

The shutdown method disables the SMMU to avoid corrupting a new kernel started with kexec.

---
 drivers/iommu/arm-smmu-v3.c | 7 +++++++
 drivers/iommu/arm-smmu.c    | 6 ++++++
 2 files changed, 13 insertions(+)

Aha, I didn't see you'd dropped the IRQ changes here :)

In which case, this looks fine to me, thanks!

Will