Re: [PATCH 05/15] iommu/arm-smmu: Split arm_smmu_tlb_inv_range_nosync()

2019-08-15 Thread Robin Murphy

On 15/08/2019 11:56, Will Deacon wrote:

On Fri, Aug 09, 2019 at 06:07:42PM +0100, Robin Murphy wrote:

Since we now use separate iommu_gather_ops for stage 1 and stage 2
contexts, we may as well divide up the monolithic callback into its
respective stage 1 and stage 2 parts.

Signed-off-by: Robin Murphy 
---
  drivers/iommu/arm-smmu.c | 66 ++--
  1 file changed, 37 insertions(+), 29 deletions(-)


This will conflict with my iommu API batching stuff, but I can sort that
out if/when it gets queued by Joerg.


-   if (cfg->fmt != ARM_SMMU_CTX_FMT_AARCH64) {
-   iova &= ~12UL;
-   iova |= cfg->asid;
-   do {
-   writel_relaxed(iova, reg);
-   iova += granule;
-   } while (size -= granule);
-   } else {
-   iova >>= 12;
-   iova |= (u64)cfg->asid << 48;
-   do {
-   writeq_relaxed(iova, reg);
-   iova += granule >> 12;
-   } while (size -= granule);
-   }
-   } else {
-   reg += leaf ? ARM_SMMU_CB_S2_TLBIIPAS2L :
- ARM_SMMU_CB_S2_TLBIIPAS2;
-   iova >>= 12;
+   if (cfg->fmt != ARM_SMMU_CTX_FMT_AARCH64) {
+   iova &= ~12UL;


Oh baby. You should move code around more often, so I'm forced to take a
second look!


Oh dear lord... The worst part is that I do now remember seeing this and 
having a similar moment of disbelief, but apparently I was easily 
distracted with rebasing and forgot about it too quickly :(



Can you cook a fix for this that we can route separately, please? I see
it also made its way into qcom_iommu.c...


Sure, I'll split it out to the front of the series for the moment.

Robin.
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH 05/15] iommu/arm-smmu: Split arm_smmu_tlb_inv_range_nosync()

2019-08-15 Thread Will Deacon
On Fri, Aug 09, 2019 at 06:07:42PM +0100, Robin Murphy wrote:
> Since we now use separate iommu_gather_ops for stage 1 and stage 2
> contexts, we may as well divide up the monolithic callback into its
> respective stage 1 and stage 2 parts.
> 
> Signed-off-by: Robin Murphy 
> ---
>  drivers/iommu/arm-smmu.c | 66 ++--
>  1 file changed, 37 insertions(+), 29 deletions(-)

This will conflict with my iommu API batching stuff, but I can sort that
out if/when it gets queued by Joerg.

> - if (cfg->fmt != ARM_SMMU_CTX_FMT_AARCH64) {
> - iova &= ~12UL;
> - iova |= cfg->asid;
> - do {
> - writel_relaxed(iova, reg);
> - iova += granule;
> - } while (size -= granule);
> - } else {
> - iova >>= 12;
> - iova |= (u64)cfg->asid << 48;
> - do {
> - writeq_relaxed(iova, reg);
> - iova += granule >> 12;
> - } while (size -= granule);
> - }
> - } else {
> - reg += leaf ? ARM_SMMU_CB_S2_TLBIIPAS2L :
> -   ARM_SMMU_CB_S2_TLBIIPAS2;
> - iova >>= 12;
> + if (cfg->fmt != ARM_SMMU_CTX_FMT_AARCH64) {
> + iova &= ~12UL;

Oh baby. You should move code around more often, so I'm forced to take a
second look!

Can you cook a fix for this that we can route separately, please? I see
it also made its way into qcom_iommu.c...

Will
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu