Commit 6f3f9ff4 authored by Nicolin Chen's avatar Nicolin Chen Committed by Will Deacon

iommu/arm-smmu-v3: Add acpi_smmu_iort_probe_model for impl

For model-specific implementation, repurpose the acpi_smmu_get_options()
to a wider acpi_smmu_acpi_probe_model(). A new model can add to the list
in this new function.
Suggested-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/r/79716299829aeab2e55b8c7932f2634b209bb4d5.1724970714.git.nicolinc@nvidia.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent b935a5b1
...@@ -4341,18 +4341,25 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) ...@@ -4341,18 +4341,25 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
} }
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static void acpi_smmu_get_options(u32 model, struct arm_smmu_device *smmu) static int acpi_smmu_iort_probe_model(struct acpi_iort_node *node,
struct arm_smmu_device *smmu)
{ {
switch (model) { struct acpi_iort_smmu_v3 *iort_smmu =
(struct acpi_iort_smmu_v3 *)node->node_data;
switch (iort_smmu->model) {
case ACPI_IORT_SMMU_V3_CAVIUM_CN99XX: case ACPI_IORT_SMMU_V3_CAVIUM_CN99XX:
smmu->options |= ARM_SMMU_OPT_PAGE0_REGS_ONLY; smmu->options |= ARM_SMMU_OPT_PAGE0_REGS_ONLY;
break; break;
case ACPI_IORT_SMMU_V3_HISILICON_HI161X: case ACPI_IORT_SMMU_V3_HISILICON_HI161X:
smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH; smmu->options |= ARM_SMMU_OPT_SKIP_PREFETCH;
break; break;
case ACPI_IORT_SMMU_V3_GENERIC:
break;
} }
dev_notice(smmu->dev, "option mask 0x%x\n", smmu->options); dev_notice(smmu->dev, "option mask 0x%x\n", smmu->options);
return 0;
} }
static int arm_smmu_device_acpi_probe(struct platform_device *pdev, static int arm_smmu_device_acpi_probe(struct platform_device *pdev,
...@@ -4367,8 +4374,6 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev, ...@@ -4367,8 +4374,6 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev,
/* Retrieve SMMUv3 specific data */ /* Retrieve SMMUv3 specific data */
iort_smmu = (struct acpi_iort_smmu_v3 *)node->node_data; iort_smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
acpi_smmu_get_options(iort_smmu->model, smmu);
if (iort_smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE) if (iort_smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE)
smmu->features |= ARM_SMMU_FEAT_COHERENCY; smmu->features |= ARM_SMMU_FEAT_COHERENCY;
...@@ -4380,7 +4385,7 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev, ...@@ -4380,7 +4385,7 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev,
smmu->features |= ARM_SMMU_FEAT_HA; smmu->features |= ARM_SMMU_FEAT_HA;
} }
return 0; return acpi_smmu_iort_probe_model(node, smmu);
} }
#else #else
static inline int arm_smmu_device_acpi_probe(struct platform_device *pdev, static inline int arm_smmu_device_acpi_probe(struct platform_device *pdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment