Skip to content

Commit 30b912a

Browse files
lumagwilldeacon
authored andcommitted
iommu/arm-smmu-qcom: Move the qcom,adreno-smmu check into qcom_smmu_create
Move special handling of qcom,adreno-smmu into qcom_smmu_create() function. This allows us to further customize the Adreno SMMU implementation. Note, this also adds two entries to the qcom_smmu_impl_of_match table. They were used with the qcom,adreno-smmu compat and were handled by the removed clause. Reviewed-by: Sai Prakash Ranjan <[email protected]> Tested-by: Sai Prakash Ranjan <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 4c1d0ad commit 30b912a

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
407407
static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
408408
const struct qcom_smmu_match_data *data)
409409
{
410+
const struct device_node *np = smmu->dev->of_node;
410411
const struct arm_smmu_impl *impl;
411412
struct qcom_smmu *qsmmu;
412413

413414
if (!data)
414415
return ERR_PTR(-EINVAL);
415416

416-
impl = data->impl;
417+
if (np && of_device_is_compatible(np, "qcom,adreno-smmu"))
418+
impl = data->adreno_impl;
419+
else
420+
impl = data->impl;
421+
417422
if (!impl)
418423
return smmu;
419424

@@ -431,15 +436,22 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
431436
return &qsmmu->smmu;
432437
}
433438

434-
static const struct qcom_smmu_match_data qcom_smmu_data = {
435-
.impl = &qcom_smmu_impl,
439+
/*
440+
* It is not yet possible to use MDP SMMU with the bypass quirk on the msm8996,
441+
* there are not enough context banks.
442+
*/
443+
static const struct qcom_smmu_match_data msm8996_smmu_data = {
444+
.impl = NULL,
445+
.adreno_impl = &qcom_adreno_smmu_impl,
436446
};
437447

438-
static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
439-
.impl = &qcom_adreno_smmu_impl,
448+
static const struct qcom_smmu_match_data qcom_smmu_data = {
449+
.impl = &qcom_smmu_impl,
450+
.adreno_impl = &qcom_adreno_smmu_impl,
440451
};
441452

442453
static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
454+
{ .compatible = "qcom,msm8996-smmu-v2", .data = &msm8996_smmu_data },
443455
{ .compatible = "qcom,msm8998-smmu-v2", .data = &qcom_smmu_data },
444456
{ .compatible = "qcom,qcm2290-smmu-500", .data = &qcom_smmu_data },
445457
{ .compatible = "qcom,qdu1000-smmu-500", .data = &qcom_smmu_data },
@@ -448,6 +460,7 @@ static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
448460
{ .compatible = "qcom,sc8180x-smmu-500", .data = &qcom_smmu_data },
449461
{ .compatible = "qcom,sc8280xp-smmu-500", .data = &qcom_smmu_data },
450462
{ .compatible = "qcom,sdm630-smmu-v2", .data = &qcom_smmu_data },
463+
{ .compatible = "qcom,sdm845-smmu-v2", .data = &qcom_smmu_data },
451464
{ .compatible = "qcom,sdm845-smmu-500", .data = &qcom_smmu_data },
452465
{ .compatible = "qcom,sm6115-smmu-500", .data = &qcom_smmu_data },
453466
{ .compatible = "qcom,sm6125-smmu-500", .data = &qcom_smmu_data },
@@ -481,15 +494,6 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
481494
}
482495
#endif
483496

484-
/*
485-
* Do not change this order of implementation, i.e., first adreno
486-
* smmu impl and then apss smmu since we can have both implementing
487-
* arm,mmu-500 in which case we will miss setting adreno smmu specific
488-
* features if the order is changed.
489-
*/
490-
if (of_device_is_compatible(np, "qcom,adreno-smmu"))
491-
return qcom_smmu_create(smmu, &qcom_adreno_smmu_data);
492-
493497
match = of_match_node(qcom_smmu_impl_of_match, np);
494498
if (match)
495499
return qcom_smmu_create(smmu, match->data);

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct qcom_smmu {
1616

1717
struct qcom_smmu_match_data {
1818
const struct arm_smmu_impl *impl;
19+
const struct arm_smmu_impl *adreno_impl;
1920
};
2021

2122
#ifdef CONFIG_ARM_SMMU_QCOM_DEBUG

0 commit comments

Comments
 (0)