Re: [PATCH v13 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

From: Lu Baolu
Date: Thu Jun 17 2021 - 21:53:23 EST


Hi Robin,

On 6/18/21 2:56 AM, Robin Murphy wrote:
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 60b1ec42e73b..ff221d3ddcbc 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -349,10 +349,9 @@ static int __init iommu_dma_setup(char *str)
  }
  early_param("iommu.strict", iommu_dma_setup);
-void iommu_set_dma_strict(bool strict)
+void iommu_set_dma_strict(void)
  {
-    if (strict || !(iommu_cmd_line & IOMMU_CMD_LINE_STRICT))
-        iommu_dma_strict = strict;
+    iommu_dma_strict = true;

Sorry, I still can't get how iommu.strict kernel option works.

static int __init iommu_dma_setup(char *str)
{
         int ret = kstrtobool(str, &iommu_dma_strict);

Note that this is the bit that does the real work - if the argument parses OK then iommu_dma_strict is reassigned with the appropriate value. The iommu_cmd_line stuff is a bit of additional bookkeeping, basically just so we can see whether default values have been overridden.

Ah, get it. Thanks a lot. I missed this part and naively thought it just
converts a string to integer.

Best regards,
baolu