iommu/arm-smmu-qcom: Move implementation data into match data
In preparation to rework of the implementation and configuration details, make qcom_smmu_create() accept new qcom_smmu_match_data structure pointer. Make implementation a field in this struct. Reviewed-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> Tested-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20221114170635.1406534-6-dmitry.baryshkov@linaro.org Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
6c84bbd103
commit
4c1d0ad153
|
@ -405,10 +405,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
|
|||
};
|
||||
|
||||
static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
|
||||
const struct arm_smmu_impl *impl)
|
||||
const struct qcom_smmu_match_data *data)
|
||||
{
|
||||
const struct arm_smmu_impl *impl;
|
||||
struct qcom_smmu *qsmmu;
|
||||
|
||||
if (!data)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
impl = data->impl;
|
||||
if (!impl)
|
||||
return smmu;
|
||||
|
||||
/* Check to make sure qcom_scm has finished probing */
|
||||
if (!qcom_scm_is_available())
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
|
@ -423,24 +431,32 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
|
|||
return &qsmmu->smmu;
|
||||
}
|
||||
|
||||
static const struct qcom_smmu_match_data qcom_smmu_data = {
|
||||
.impl = &qcom_smmu_impl,
|
||||
};
|
||||
|
||||
static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
|
||||
.impl = &qcom_adreno_smmu_impl,
|
||||
};
|
||||
|
||||
static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
|
||||
{ .compatible = "qcom,msm8998-smmu-v2" },
|
||||
{ .compatible = "qcom,qcm2290-smmu-500" },
|
||||
{ .compatible = "qcom,qdu1000-smmu-500" },
|
||||
{ .compatible = "qcom,sc7180-smmu-500" },
|
||||
{ .compatible = "qcom,sc7280-smmu-500" },
|
||||
{ .compatible = "qcom,sc8180x-smmu-500" },
|
||||
{ .compatible = "qcom,sc8280xp-smmu-500" },
|
||||
{ .compatible = "qcom,sdm630-smmu-v2" },
|
||||
{ .compatible = "qcom,sdm845-smmu-500" },
|
||||
{ .compatible = "qcom,sm6115-smmu-500" },
|
||||
{ .compatible = "qcom,sm6125-smmu-500" },
|
||||
{ .compatible = "qcom,sm6350-smmu-500" },
|
||||
{ .compatible = "qcom,sm6375-smmu-500" },
|
||||
{ .compatible = "qcom,sm8150-smmu-500" },
|
||||
{ .compatible = "qcom,sm8250-smmu-500" },
|
||||
{ .compatible = "qcom,sm8350-smmu-500" },
|
||||
{ .compatible = "qcom,sm8450-smmu-500" },
|
||||
{ .compatible = "qcom,msm8998-smmu-v2", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,qdu1000-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sc7180-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sc7280-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm6115-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm6350-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm6375-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm8150-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm8250-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm8350-smmu-500", .data = &qcom_smmu_data },
|
||||
{ .compatible = "qcom,sm8450-smmu-500", .data = &qcom_smmu_data },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -455,12 +471,13 @@ static struct acpi_platform_list qcom_acpi_platlist[] = {
|
|||
struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
|
||||
{
|
||||
const struct device_node *np = smmu->dev->of_node;
|
||||
const struct of_device_id *match;
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
if (np == NULL) {
|
||||
/* Match platform for ACPI boot */
|
||||
if (acpi_match_platform_list(qcom_acpi_platlist) >= 0)
|
||||
return qcom_smmu_create(smmu, &qcom_smmu_impl);
|
||||
return qcom_smmu_create(smmu, &qcom_smmu_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -471,10 +488,11 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
|
|||
* features if the order is changed.
|
||||
*/
|
||||
if (of_device_is_compatible(np, "qcom,adreno-smmu"))
|
||||
return qcom_smmu_create(smmu, &qcom_adreno_smmu_impl);
|
||||
return qcom_smmu_create(smmu, &qcom_adreno_smmu_data);
|
||||
|
||||
if (of_match_node(qcom_smmu_impl_of_match, np))
|
||||
return qcom_smmu_create(smmu, &qcom_smmu_impl);
|
||||
match = of_match_node(qcom_smmu_impl_of_match, np);
|
||||
if (match)
|
||||
return qcom_smmu_create(smmu, match->data);
|
||||
|
||||
return smmu;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ struct qcom_smmu {
|
|||
u32 stall_enabled;
|
||||
};
|
||||
|
||||
struct qcom_smmu_match_data {
|
||||
const struct arm_smmu_impl *impl;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARM_SMMU_QCOM_DEBUG
|
||||
void qcom_smmu_tlb_sync_debug(struct arm_smmu_device *smmu);
|
||||
const void *qcom_smmu_impl_data(struct arm_smmu_device *smmu);
|
||||
|
|
Loading…
Reference in New Issue