diff mbox series

[2/5] iommu/tegra-smmu: Use non-secure register for flushing

Message ID 1547671814-30088-2-git-send-email-navneetk@nvidia.com
State Deferred
Headers show
Series [1/5] iommu/tegra-smmu: Fix domain_alloc | expand

Commit Message

navneet kumar Jan. 16, 2019, 8:50 p.m. UTC
Use PTB_ASID instead of SMMU_CONFIG to flush smmu.
PTB_ASID can be accessed from non-secure mode, SMMU_CONFIG cannot be.
Using SMMU_CONFIG could pose a problem when kernel doesn't have secure
mode access enabled from boot.

Signed-off-by: Navneet Kumar <navneetk@nvidia.com>
---
 drivers/iommu/tegra-smmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Osipenko Jan. 17, 2019, 3:25 p.m. UTC | #1
16.01.2019 23:50, Navneet Kumar пишет:
> Use PTB_ASID instead of SMMU_CONFIG to flush smmu.
> PTB_ASID can be accessed from non-secure mode, SMMU_CONFIG cannot be.
> Using SMMU_CONFIG could pose a problem when kernel doesn't have secure
> mode access enabled from boot.
> 
> Signed-off-by: Navneet Kumar <navneetk@nvidia.com>
> ---
>  drivers/iommu/tegra-smmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
> index ee4d8a8..fa175d9 100644
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> @@ -235,7 +235,7 @@ static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu,
>  
>  static inline void smmu_flush(struct tegra_smmu *smmu)
>  {
> -	smmu_readl(smmu, SMMU_CONFIG);
> +	smmu_readl(smmu, SMMU_PTB_ASID);
>  }
>  
>  static int tegra_smmu_alloc_asid(struct tegra_smmu *smmu, unsigned int *idp)
> 

Driver writes to SMMU_CONFIG during of the probing. Looks like it's better to drop this patch for now and make it part of a complete solution that will add proper support for a stricter insecure-mode platforms.
navneet kumar Jan. 24, 2019, 6:29 p.m. UTC | #2
On 1/17/19 7:25 AM, Dmitry Osipenko wrote:
> 16.01.2019 23:50, Navneet Kumar пишет:
>> Use PTB_ASID instead of SMMU_CONFIG to flush smmu.
>> PTB_ASID can be accessed from non-secure mode, SMMU_CONFIG cannot be.
>> Using SMMU_CONFIG could pose a problem when kernel doesn't have secure
>> mode access enabled from boot.
>>
>> Signed-off-by: Navneet Kumar <navneetk@nvidia.com>
>> ---
>>  drivers/iommu/tegra-smmu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
>> index ee4d8a8..fa175d9 100644
>> --- a/drivers/iommu/tegra-smmu.c
>> +++ b/drivers/iommu/tegra-smmu.c
>> @@ -235,7 +235,7 @@ static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu,
>>  
>>  static inline void smmu_flush(struct tegra_smmu *smmu)
>>  {
>> -	smmu_readl(smmu, SMMU_CONFIG);
>> +	smmu_readl(smmu, SMMU_PTB_ASID);
>>  }
>>  
>>  static int tegra_smmu_alloc_asid(struct tegra_smmu *smmu, unsigned int *idp)
>>
> 
> Driver writes to SMMU_CONFIG during of the probing. Looks like it's better to drop this patch for now and make it part of a complete solution that will add proper support for a stricter insecure-mode platforms.
> 
Thanks for the comment Dmitry. On secure platforms, writing to SMMU_CONFIG will be a no-op and
will pose no harm. Having this patch is important because it fixes the flushing behavior on
such platforms, which is critical.

I propose to keep this patch as is, however, i can add more explanation to the commit message,
stating the case of probe and how it will not have any ill effects. Pls ACK/NACK, and i shall post
a V2.
Dmitry Osipenko Jan. 24, 2019, 9:27 p.m. UTC | #3
24.01.2019 21:29, navneet kumar пишет:
> On 1/17/19 7:25 AM, Dmitry Osipenko wrote:
>> 16.01.2019 23:50, Navneet Kumar пишет:
>>> Use PTB_ASID instead of SMMU_CONFIG to flush smmu.
>>> PTB_ASID can be accessed from non-secure mode, SMMU_CONFIG cannot be.
>>> Using SMMU_CONFIG could pose a problem when kernel doesn't have secure
>>> mode access enabled from boot.
>>>
>>> Signed-off-by: Navneet Kumar <navneetk@nvidia.com>
>>> ---
>>>  drivers/iommu/tegra-smmu.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
>>> index ee4d8a8..fa175d9 100644
>>> --- a/drivers/iommu/tegra-smmu.c
>>> +++ b/drivers/iommu/tegra-smmu.c
>>> @@ -235,7 +235,7 @@ static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu,
>>>  
>>>  static inline void smmu_flush(struct tegra_smmu *smmu)
>>>  {
>>> -	smmu_readl(smmu, SMMU_CONFIG);
>>> +	smmu_readl(smmu, SMMU_PTB_ASID);
>>>  }
>>>  
>>>  static int tegra_smmu_alloc_asid(struct tegra_smmu *smmu, unsigned int *idp)
>>>
>>
>> Driver writes to SMMU_CONFIG during of the probing. Looks like it's better to drop this patch for now and make it part of a complete solution that will add proper support for a stricter insecure-mode platforms.
>>
> Thanks for the comment Dmitry. On secure platforms, writing to SMMU_CONFIG will be a no-op and
> will pose no harm. Having this patch is important because it fixes the flushing behavior on
> such platforms, which is critical.
> 
> I propose to keep this patch as is, however, i can add more explanation to the commit message,
> stating the case of probe and how it will not have any ill effects. Pls ACK/NACK, and i shall post
> a V2.
> 

Nothing breaks with this change at least for T30. Please extend the commit message and add a clarifying comment to the code, thanks.

With the clarifying message being addressed:

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
diff mbox series

Patch

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index ee4d8a8..fa175d9 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -235,7 +235,7 @@  static inline void smmu_flush_tlb_group(struct tegra_smmu *smmu,
 
 static inline void smmu_flush(struct tegra_smmu *smmu)
 {
-	smmu_readl(smmu, SMMU_CONFIG);
+	smmu_readl(smmu, SMMU_PTB_ASID);
 }
 
 static int tegra_smmu_alloc_asid(struct tegra_smmu *smmu, unsigned int *idp)