* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 14:05 ` John Keeping
0 siblings, 0 replies; 18+ messages in thread
From: John Keeping @ 2016-04-05 14:05 UTC (permalink / raw)
To: Joerg Roedel
Cc: Heiko Stuebner, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, John Keeping,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
slaves") rk_iommu_is_stall_active() always returns false because the
bitwise AND operates on the boolean flag promoted to an integer and a
value that is either zero or BIT(2).
Explicitly convert the right-hand value to a boolean so that both sides
are guaranteed to be either zero or one.
rk_iommu_is_paging_enabled() does not suffer from the same problem since
RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
for consistency and to make it clear that it's correct without needing
to lookup the value.
Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi slaves")
Signed-off-by: John Keeping <john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
---
drivers/iommu/rockchip-iommu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index a6f593a0a29e..5710a06c3049 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
- active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
- RK_MMU_STATUS_STALL_ACTIVE;
+ active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+ RK_MMU_STATUS_STALL_ACTIVE);
return active;
}
@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
- enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
- RK_MMU_STATUS_PAGING_ENABLED;
+ enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+ RK_MMU_STATUS_PAGING_ENABLED);
return enable;
}
--
2.8.0.rc4.238.g874082a
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 14:05 ` John Keeping
0 siblings, 0 replies; 18+ messages in thread
From: John Keeping @ 2016-04-05 14:05 UTC (permalink / raw)
To: linux-arm-kernel
Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
slaves") rk_iommu_is_stall_active() always returns false because the
bitwise AND operates on the boolean flag promoted to an integer and a
value that is either zero or BIT(2).
Explicitly convert the right-hand value to a boolean so that both sides
are guaranteed to be either zero or one.
rk_iommu_is_paging_enabled() does not suffer from the same problem since
RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
for consistency and to make it clear that it's correct without needing
to lookup the value.
Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi slaves")
Signed-off-by: John Keeping <john@metanate.com>
---
drivers/iommu/rockchip-iommu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index a6f593a0a29e..5710a06c3049 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
- active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
- RK_MMU_STATUS_STALL_ACTIVE;
+ active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+ RK_MMU_STATUS_STALL_ACTIVE);
return active;
}
@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
- enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
- RK_MMU_STATUS_PAGING_ENABLED;
+ enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+ RK_MMU_STATUS_PAGING_ENABLED);
return enable;
}
--
2.8.0.rc4.238.g874082a
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 14:05 ` John Keeping
0 siblings, 0 replies; 18+ messages in thread
From: John Keeping @ 2016-04-05 14:05 UTC (permalink / raw)
To: Joerg Roedel
Cc: Heiko Stuebner, iommu, linux-arm-kernel, linux-rockchip,
linux-kernel, John Keeping
Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
slaves") rk_iommu_is_stall_active() always returns false because the
bitwise AND operates on the boolean flag promoted to an integer and a
value that is either zero or BIT(2).
Explicitly convert the right-hand value to a boolean so that both sides
are guaranteed to be either zero or one.
rk_iommu_is_paging_enabled() does not suffer from the same problem since
RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
for consistency and to make it clear that it's correct without needing
to lookup the value.
Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi slaves")
Signed-off-by: John Keeping <john@metanate.com>
---
drivers/iommu/rockchip-iommu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index a6f593a0a29e..5710a06c3049 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
- active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
- RK_MMU_STATUS_STALL_ACTIVE;
+ active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+ RK_MMU_STATUS_STALL_ACTIVE);
return active;
}
@@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu *iommu)
int i;
for (i = 0; i < iommu->num_mmu; i++)
- enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
- RK_MMU_STATUS_PAGING_ENABLED;
+ enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
+ RK_MMU_STATUS_PAGING_ENABLED);
return enable;
}
--
2.8.0.rc4.238.g874082a
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
2016-04-05 14:05 ` John Keeping
(?)
@ 2016-04-05 17:21 ` Heiko Stuebner
-1 siblings, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-04-05 17:21 UTC (permalink / raw)
To: John Keeping
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> slaves") rk_iommu_is_stall_active() always returns false because the
> bitwise AND operates on the boolean flag promoted to an integer and a
> value that is either zero or BIT(2).
>
> Explicitly convert the right-hand value to a boolean so that both sides
> are guaranteed to be either zero or one.
>
> rk_iommu_is_paging_enabled() does not suffer from the same problem since
> RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
> for consistency and to make it clear that it's correct without needing
> to lookup the value.
>
> Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> slaves") Signed-off-by: John Keeping <john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
Nice catch, thanks.
Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
John, out of curiosity, how did you find that problem? Excess stall error
messages or something else?
Thanks
Heiko
> ---
> drivers/iommu/rockchip-iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c
> b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu
> *iommu) int i;
>
> for (i = 0; i < iommu->num_mmu; i++)
> - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> - RK_MMU_STATUS_STALL_ACTIVE;
> + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> + RK_MMU_STATUS_STALL_ACTIVE);
>
> return active;
> }
> @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu
> *iommu) int i;
>
> for (i = 0; i < iommu->num_mmu; i++)
> - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> - RK_MMU_STATUS_PAGING_ENABLED;
> + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> + RK_MMU_STATUS_PAGING_ENABLED);
>
> return enable;
> }
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 17:21 ` Heiko Stuebner
0 siblings, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-04-05 17:21 UTC (permalink / raw)
To: linux-arm-kernel
Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> slaves") rk_iommu_is_stall_active() always returns false because the
> bitwise AND operates on the boolean flag promoted to an integer and a
> value that is either zero or BIT(2).
>
> Explicitly convert the right-hand value to a boolean so that both sides
> are guaranteed to be either zero or one.
>
> rk_iommu_is_paging_enabled() does not suffer from the same problem since
> RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
> for consistency and to make it clear that it's correct without needing
> to lookup the value.
>
> Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> slaves") Signed-off-by: John Keeping <john@metanate.com>
Nice catch, thanks.
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
John, out of curiosity, how did you find that problem? Excess stall error
messages or something else?
Thanks
Heiko
> ---
> drivers/iommu/rockchip-iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c
> b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu
> *iommu) int i;
>
> for (i = 0; i < iommu->num_mmu; i++)
> - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> - RK_MMU_STATUS_STALL_ACTIVE;
> + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> + RK_MMU_STATUS_STALL_ACTIVE);
>
> return active;
> }
> @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu
> *iommu) int i;
>
> for (i = 0; i < iommu->num_mmu; i++)
> - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> - RK_MMU_STATUS_PAGING_ENABLED;
> + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> + RK_MMU_STATUS_PAGING_ENABLED);
>
> return enable;
> }
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 17:21 ` Heiko Stuebner
0 siblings, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-04-05 17:21 UTC (permalink / raw)
To: John Keeping
Cc: Joerg Roedel, iommu, linux-arm-kernel, linux-rockchip,
linux-kernel
Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> slaves") rk_iommu_is_stall_active() always returns false because the
> bitwise AND operates on the boolean flag promoted to an integer and a
> value that is either zero or BIT(2).
>
> Explicitly convert the right-hand value to a boolean so that both sides
> are guaranteed to be either zero or one.
>
> rk_iommu_is_paging_enabled() does not suffer from the same problem since
> RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
> for consistency and to make it clear that it's correct without needing
> to lookup the value.
>
> Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> slaves") Signed-off-by: John Keeping <john@metanate.com>
Nice catch, thanks.
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
John, out of curiosity, how did you find that problem? Excess stall error
messages or something else?
Thanks
Heiko
> ---
> drivers/iommu/rockchip-iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c
> b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu
> *iommu) int i;
>
> for (i = 0; i < iommu->num_mmu; i++)
> - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> - RK_MMU_STATUS_STALL_ACTIVE;
> + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> + RK_MMU_STATUS_STALL_ACTIVE);
>
> return active;
> }
> @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu
> *iommu) int i;
>
> for (i = 0; i < iommu->num_mmu; i++)
> - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> - RK_MMU_STATUS_PAGING_ENABLED;
> + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> + RK_MMU_STATUS_PAGING_ENABLED);
>
> return enable;
> }
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
2016-04-05 17:21 ` Heiko Stuebner
(?)
@ 2016-04-05 17:28 ` John Keeping
-1 siblings, 0 replies; 18+ messages in thread
From: John Keeping @ 2016-04-05 17:28 UTC (permalink / raw)
To: Heiko Stuebner
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
> Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > slaves") rk_iommu_is_stall_active() always returns false because the
> > bitwise AND operates on the boolean flag promoted to an integer and a
> > value that is either zero or BIT(2).
> >
> > Explicitly convert the right-hand value to a boolean so that both sides
> > are guaranteed to be either zero or one.
> >
> > rk_iommu_is_paging_enabled() does not suffer from the same problem since
> > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
> > for consistency and to make it clear that it's correct without needing
> > to lookup the value.
> >
> > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > slaves") Signed-off-by: John Keeping <john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
>
> Nice catch, thanks.
>
> Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
>
> John, out of curiosity, how did you find that problem? Excess stall error
> messages or something else?
I was testing the drm iommu patches I posted today [1] and noticed an
"Enable stall request timed out" error when unbinding the
display-subsystem, but the RK_MMU_STATUS value printed in the error
message indicated that stall active was set.
[1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
> > ---
> > drivers/iommu/rockchip-iommu.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iommu/rockchip-iommu.c
> > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644
> > --- a/drivers/iommu/rockchip-iommu.c
> > +++ b/drivers/iommu/rockchip-iommu.c
> > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu
> > *iommu) int i;
> >
> > for (i = 0; i < iommu->num_mmu; i++)
> > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > - RK_MMU_STATUS_STALL_ACTIVE;
> > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > + RK_MMU_STATUS_STALL_ACTIVE);
> >
> > return active;
> > }
> > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu
> > *iommu) int i;
> >
> > for (i = 0; i < iommu->num_mmu; i++)
> > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > - RK_MMU_STATUS_PAGING_ENABLED;
> > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > + RK_MMU_STATUS_PAGING_ENABLED);
> >
> > return enable;
> > }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 17:28 ` John Keeping
0 siblings, 0 replies; 18+ messages in thread
From: John Keeping @ 2016-04-05 17:28 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
> Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > slaves") rk_iommu_is_stall_active() always returns false because the
> > bitwise AND operates on the boolean flag promoted to an integer and a
> > value that is either zero or BIT(2).
> >
> > Explicitly convert the right-hand value to a boolean so that both sides
> > are guaranteed to be either zero or one.
> >
> > rk_iommu_is_paging_enabled() does not suffer from the same problem since
> > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
> > for consistency and to make it clear that it's correct without needing
> > to lookup the value.
> >
> > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > slaves") Signed-off-by: John Keeping <john@metanate.com>
>
> Nice catch, thanks.
>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
>
> John, out of curiosity, how did you find that problem? Excess stall error
> messages or something else?
I was testing the drm iommu patches I posted today [1] and noticed an
"Enable stall request timed out" error when unbinding the
display-subsystem, but the RK_MMU_STATUS value printed in the error
message indicated that stall active was set.
[1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
> > ---
> > drivers/iommu/rockchip-iommu.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iommu/rockchip-iommu.c
> > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644
> > --- a/drivers/iommu/rockchip-iommu.c
> > +++ b/drivers/iommu/rockchip-iommu.c
> > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu
> > *iommu) int i;
> >
> > for (i = 0; i < iommu->num_mmu; i++)
> > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > - RK_MMU_STATUS_STALL_ACTIVE;
> > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > + RK_MMU_STATUS_STALL_ACTIVE);
> >
> > return active;
> > }
> > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu
> > *iommu) int i;
> >
> > for (i = 0; i < iommu->num_mmu; i++)
> > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > - RK_MMU_STATUS_PAGING_ENABLED;
> > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > + RK_MMU_STATUS_PAGING_ENABLED);
> >
> > return enable;
> > }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 17:28 ` John Keeping
0 siblings, 0 replies; 18+ messages in thread
From: John Keeping @ 2016-04-05 17:28 UTC (permalink / raw)
To: Heiko Stuebner
Cc: Joerg Roedel, iommu, linux-arm-kernel, linux-rockchip,
linux-kernel
On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
> Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > slaves") rk_iommu_is_stall_active() always returns false because the
> > bitwise AND operates on the boolean flag promoted to an integer and a
> > value that is either zero or BIT(2).
> >
> > Explicitly convert the right-hand value to a boolean so that both sides
> > are guaranteed to be either zero or one.
> >
> > rk_iommu_is_paging_enabled() does not suffer from the same problem since
> > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same change
> > for consistency and to make it clear that it's correct without needing
> > to lookup the value.
> >
> > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > slaves") Signed-off-by: John Keeping <john@metanate.com>
>
> Nice catch, thanks.
>
> Reviewed-by: Heiko Stuebner <heiko@sntech.de>
>
> John, out of curiosity, how did you find that problem? Excess stall error
> messages or something else?
I was testing the drm iommu patches I posted today [1] and noticed an
"Enable stall request timed out" error when unbinding the
display-subsystem, but the RK_MMU_STATUS value printed in the error
message indicated that stall active was set.
[1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
> > ---
> > drivers/iommu/rockchip-iommu.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iommu/rockchip-iommu.c
> > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049 100644
> > --- a/drivers/iommu/rockchip-iommu.c
> > +++ b/drivers/iommu/rockchip-iommu.c
> > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct rk_iommu
> > *iommu) int i;
> >
> > for (i = 0; i < iommu->num_mmu; i++)
> > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > - RK_MMU_STATUS_STALL_ACTIVE;
> > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > + RK_MMU_STATUS_STALL_ACTIVE);
> >
> > return active;
> > }
> > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct rk_iommu
> > *iommu) int i;
> >
> > for (i = 0; i < iommu->num_mmu; i++)
> > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > - RK_MMU_STATUS_PAGING_ENABLED;
> > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > + RK_MMU_STATUS_PAGING_ENABLED);
> >
> > return enable;
> > }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
2016-04-05 17:28 ` John Keeping
(?)
@ 2016-04-05 19:10 ` Heiko Stuebner
-1 siblings, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-04-05 19:10 UTC (permalink / raw)
To: John Keeping
Cc: Tomeu Vizoso, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
> > > multi
> > > slaves") rk_iommu_is_stall_active() always returns false because the
> > > bitwise AND operates on the boolean flag promoted to an integer and a
> > > value that is either zero or BIT(2).
> > >
> > > Explicitly convert the right-hand value to a boolean so that both
> > > sides
> > > are guaranteed to be either zero or one.
> > >
> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
> > > since
> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
> > > change
> > > for consistency and to make it clear that it's correct without needing
> > > to lookup the value.
> > >
> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > > slaves") Signed-off-by: John Keeping <john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
> >
> > Nice catch, thanks.
> >
> > Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> >
> > John, out of curiosity, how did you find that problem? Excess stall
> > error
> > messages or something else?
>
> I was testing the drm iommu patches I posted today [1] and noticed an
> "Enable stall request timed out" error when unbinding the
> display-subsystem, but the RK_MMU_STATUS value printed in the error
> message indicated that stall active was set.
>
> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
So it seems both you and Tomeu were working to resolve the same issue [2].
And John's patch seems to actually fix the underlying problem.
[2] https://lkml.org/lkml/2016/3/22/493
> > > ---
> > >
> > > drivers/iommu/rockchip-iommu.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/iommu/rockchip-iommu.c
> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
> > > 100644
> > > --- a/drivers/iommu/rockchip-iommu.c
> > > +++ b/drivers/iommu/rockchip-iommu.c
> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
> > > rk_iommu
> > > *iommu) int i;
> > >
> > > for (i = 0; i < iommu->num_mmu; i++)
> > >
> > > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > - RK_MMU_STATUS_STALL_ACTIVE;
> > > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > + RK_MMU_STATUS_STALL_ACTIVE);
> > >
> > > return active;
> > >
> > > }
> > >
> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
> > > rk_iommu *iommu) int i;
> > >
> > > for (i = 0; i < iommu->num_mmu; i++)
> > >
> > > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > - RK_MMU_STATUS_PAGING_ENABLED;
> > > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > + RK_MMU_STATUS_PAGING_ENABLED);
> > >
> > > return enable;
> > >
> > > }
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 19:10 ` Heiko Stuebner
0 siblings, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-04-05 19:10 UTC (permalink / raw)
To: linux-arm-kernel
Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
> > > multi
> > > slaves") rk_iommu_is_stall_active() always returns false because the
> > > bitwise AND operates on the boolean flag promoted to an integer and a
> > > value that is either zero or BIT(2).
> > >
> > > Explicitly convert the right-hand value to a boolean so that both
> > > sides
> > > are guaranteed to be either zero or one.
> > >
> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
> > > since
> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
> > > change
> > > for consistency and to make it clear that it's correct without needing
> > > to lookup the value.
> > >
> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > > slaves") Signed-off-by: John Keeping <john@metanate.com>
> >
> > Nice catch, thanks.
> >
> > Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> >
> > John, out of curiosity, how did you find that problem? Excess stall
> > error
> > messages or something else?
>
> I was testing the drm iommu patches I posted today [1] and noticed an
> "Enable stall request timed out" error when unbinding the
> display-subsystem, but the RK_MMU_STATUS value printed in the error
> message indicated that stall active was set.
>
> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
So it seems both you and Tomeu were working to resolve the same issue [2].
And John's patch seems to actually fix the underlying problem.
[2] https://lkml.org/lkml/2016/3/22/493
> > > ---
> > >
> > > drivers/iommu/rockchip-iommu.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/iommu/rockchip-iommu.c
> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
> > > 100644
> > > --- a/drivers/iommu/rockchip-iommu.c
> > > +++ b/drivers/iommu/rockchip-iommu.c
> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
> > > rk_iommu
> > > *iommu) int i;
> > >
> > > for (i = 0; i < iommu->num_mmu; i++)
> > >
> > > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > - RK_MMU_STATUS_STALL_ACTIVE;
> > > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > + RK_MMU_STATUS_STALL_ACTIVE);
> > >
> > > return active;
> > >
> > > }
> > >
> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
> > > rk_iommu *iommu) int i;
> > >
> > > for (i = 0; i < iommu->num_mmu; i++)
> > >
> > > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > - RK_MMU_STATUS_PAGING_ENABLED;
> > > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > + RK_MMU_STATUS_PAGING_ENABLED);
> > >
> > > return enable;
> > >
> > > }
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-05 19:10 ` Heiko Stuebner
0 siblings, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-04-05 19:10 UTC (permalink / raw)
To: John Keeping
Cc: Joerg Roedel, iommu, linux-arm-kernel, linux-rockchip,
linux-kernel, Tomeu Vizoso
Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
> > > multi
> > > slaves") rk_iommu_is_stall_active() always returns false because the
> > > bitwise AND operates on the boolean flag promoted to an integer and a
> > > value that is either zero or BIT(2).
> > >
> > > Explicitly convert the right-hand value to a boolean so that both
> > > sides
> > > are guaranteed to be either zero or one.
> > >
> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
> > > since
> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
> > > change
> > > for consistency and to make it clear that it's correct without needing
> > > to lookup the value.
> > >
> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
> > > slaves") Signed-off-by: John Keeping <john@metanate.com>
> >
> > Nice catch, thanks.
> >
> > Reviewed-by: Heiko Stuebner <heiko@sntech.de>
> >
> > John, out of curiosity, how did you find that problem? Excess stall
> > error
> > messages or something else?
>
> I was testing the drm iommu patches I posted today [1] and noticed an
> "Enable stall request timed out" error when unbinding the
> display-subsystem, but the RK_MMU_STATUS value printed in the error
> message indicated that stall active was set.
>
> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
So it seems both you and Tomeu were working to resolve the same issue [2].
And John's patch seems to actually fix the underlying problem.
[2] https://lkml.org/lkml/2016/3/22/493
> > > ---
> > >
> > > drivers/iommu/rockchip-iommu.c | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/iommu/rockchip-iommu.c
> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
> > > 100644
> > > --- a/drivers/iommu/rockchip-iommu.c
> > > +++ b/drivers/iommu/rockchip-iommu.c
> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
> > > rk_iommu
> > > *iommu) int i;
> > >
> > > for (i = 0; i < iommu->num_mmu; i++)
> > >
> > > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > - RK_MMU_STATUS_STALL_ACTIVE;
> > > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > + RK_MMU_STATUS_STALL_ACTIVE);
> > >
> > > return active;
> > >
> > > }
> > >
> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
> > > rk_iommu *iommu) int i;
> > >
> > > for (i = 0; i < iommu->num_mmu; i++)
> > >
> > > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > - RK_MMU_STATUS_PAGING_ENABLED;
> > > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
> > > + RK_MMU_STATUS_PAGING_ENABLED);
> > >
> > > return enable;
> > >
> > > }
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
2016-04-05 19:10 ` Heiko Stuebner
(?)
@ 2016-04-06 7:45 ` Tomeu Vizoso
-1 siblings, 0 replies; 18+ messages in thread
From: Tomeu Vizoso @ 2016-04-06 7:45 UTC (permalink / raw)
To: Heiko Stuebner
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
open list:ARM/Rockchip SoC...,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, John Keeping,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
On 5 April 2016 at 21:10, Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> wrote:
> Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
>> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
>> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
>> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
>> > > multi
>> > > slaves") rk_iommu_is_stall_active() always returns false because the
>> > > bitwise AND operates on the boolean flag promoted to an integer and a
>> > > value that is either zero or BIT(2).
>> > >
>> > > Explicitly convert the right-hand value to a boolean so that both
>> > > sides
>> > > are guaranteed to be either zero or one.
>> > >
>> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
>> > > since
>> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
>> > > change
>> > > for consistency and to make it clear that it's correct without needing
>> > > to lookup the value.
>> > >
>> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
>> > > slaves") Signed-off-by: John Keeping <john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
>> >
>> > Nice catch, thanks.
>> >
>> > Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
>> >
>> > John, out of curiosity, how did you find that problem? Excess stall
>> > error
>> > messages or something else?
>>
>> I was testing the drm iommu patches I posted today [1] and noticed an
>> "Enable stall request timed out" error when unbinding the
>> display-subsystem, but the RK_MMU_STATUS value printed in the error
>> message indicated that stall active was set.
>>
>> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
>
> So it seems both you and Tomeu were working to resolve the same issue [2].
>
> And John's patch seems to actually fix the underlying problem.
Indeed, I don't get spurious messages any more with this patch.
Tested-by: Tomeu Vizoso <tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Thanks,
Tomeu
>
> [2] https://lkml.org/lkml/2016/3/22/493
>
>
>> > > ---
>> > >
>> > > drivers/iommu/rockchip-iommu.c | 8 ++++----
>> > > 1 file changed, 4 insertions(+), 4 deletions(-)
>> > >
>> > > diff --git a/drivers/iommu/rockchip-iommu.c
>> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
>> > > 100644
>> > > --- a/drivers/iommu/rockchip-iommu.c
>> > > +++ b/drivers/iommu/rockchip-iommu.c
>> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
>> > > rk_iommu
>> > > *iommu) int i;
>> > >
>> > > for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > - RK_MMU_STATUS_STALL_ACTIVE;
>> > > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > + RK_MMU_STATUS_STALL_ACTIVE);
>> > >
>> > > return active;
>> > >
>> > > }
>> > >
>> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
>> > > rk_iommu *iommu) int i;
>> > >
>> > > for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > - RK_MMU_STATUS_PAGING_ENABLED;
>> > > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > + RK_MMU_STATUS_PAGING_ENABLED);
>> > >
>> > > return enable;
>> > >
>> > > }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-06 7:45 ` Tomeu Vizoso
0 siblings, 0 replies; 18+ messages in thread
From: Tomeu Vizoso @ 2016-04-06 7:45 UTC (permalink / raw)
To: linux-arm-kernel
On 5 April 2016 at 21:10, Heiko Stuebner <heiko@sntech.de> wrote:
> Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
>> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
>> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
>> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
>> > > multi
>> > > slaves") rk_iommu_is_stall_active() always returns false because the
>> > > bitwise AND operates on the boolean flag promoted to an integer and a
>> > > value that is either zero or BIT(2).
>> > >
>> > > Explicitly convert the right-hand value to a boolean so that both
>> > > sides
>> > > are guaranteed to be either zero or one.
>> > >
>> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
>> > > since
>> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
>> > > change
>> > > for consistency and to make it clear that it's correct without needing
>> > > to lookup the value.
>> > >
>> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
>> > > slaves") Signed-off-by: John Keeping <john@metanate.com>
>> >
>> > Nice catch, thanks.
>> >
>> > Reviewed-by: Heiko Stuebner <heiko@sntech.de>
>> >
>> > John, out of curiosity, how did you find that problem? Excess stall
>> > error
>> > messages or something else?
>>
>> I was testing the drm iommu patches I posted today [1] and noticed an
>> "Enable stall request timed out" error when unbinding the
>> display-subsystem, but the RK_MMU_STATUS value printed in the error
>> message indicated that stall active was set.
>>
>> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
>
> So it seems both you and Tomeu were working to resolve the same issue [2].
>
> And John's patch seems to actually fix the underlying problem.
Indeed, I don't get spurious messages any more with this patch.
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Thanks,
Tomeu
>
> [2] https://lkml.org/lkml/2016/3/22/493
>
>
>> > > ---
>> > >
>> > > drivers/iommu/rockchip-iommu.c | 8 ++++----
>> > > 1 file changed, 4 insertions(+), 4 deletions(-)
>> > >
>> > > diff --git a/drivers/iommu/rockchip-iommu.c
>> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
>> > > 100644
>> > > --- a/drivers/iommu/rockchip-iommu.c
>> > > +++ b/drivers/iommu/rockchip-iommu.c
>> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
>> > > rk_iommu
>> > > *iommu) int i;
>> > >
>> > > for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > - RK_MMU_STATUS_STALL_ACTIVE;
>> > > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > + RK_MMU_STATUS_STALL_ACTIVE);
>> > >
>> > > return active;
>> > >
>> > > }
>> > >
>> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
>> > > rk_iommu *iommu) int i;
>> > >
>> > > for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > - RK_MMU_STATUS_PAGING_ENABLED;
>> > > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > + RK_MMU_STATUS_PAGING_ENABLED);
>> > >
>> > > return enable;
>> > >
>> > > }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-06 7:45 ` Tomeu Vizoso
0 siblings, 0 replies; 18+ messages in thread
From: Tomeu Vizoso @ 2016-04-06 7:45 UTC (permalink / raw)
To: Heiko Stuebner
Cc: John Keeping, Joerg Roedel, iommu,
linux-arm-kernel@lists.infradead.org,
open list:ARM/Rockchip SoC..., linux-kernel@vger.kernel.org
On 5 April 2016 at 21:10, Heiko Stuebner <heiko@sntech.de> wrote:
> Am Dienstag, 5. April 2016, 18:28:58 schrieb John Keeping:
>> On Tue, 05 Apr 2016 10:21:27 -0700, Heiko Stuebner wrote:
>> > Am Dienstag, 5. April 2016, 15:05:46 schrieb John Keeping:
>> > > Since commit cd6438c5f844 ("iommu/rockchip: Reconstruct to support
>> > > multi
>> > > slaves") rk_iommu_is_stall_active() always returns false because the
>> > > bitwise AND operates on the boolean flag promoted to an integer and a
>> > > value that is either zero or BIT(2).
>> > >
>> > > Explicitly convert the right-hand value to a boolean so that both
>> > > sides
>> > > are guaranteed to be either zero or one.
>> > >
>> > > rk_iommu_is_paging_enabled() does not suffer from the same problem
>> > > since
>> > > RK_MMU_STATUS_PAGING_ENABLED is BIT(0), but let's apply the same
>> > > change
>> > > for consistency and to make it clear that it's correct without needing
>> > > to lookup the value.
>> > >
>> > > Fixes: cd6438c5f844 ("iommu/rockchip: Reconstruct to support multi
>> > > slaves") Signed-off-by: John Keeping <john@metanate.com>
>> >
>> > Nice catch, thanks.
>> >
>> > Reviewed-by: Heiko Stuebner <heiko@sntech.de>
>> >
>> > John, out of curiosity, how did you find that problem? Excess stall
>> > error
>> > messages or something else?
>>
>> I was testing the drm iommu patches I posted today [1] and noticed an
>> "Enable stall request timed out" error when unbinding the
>> display-subsystem, but the RK_MMU_STATUS value printed in the error
>> message indicated that stall active was set.
>>
>> [1] http://article.gmane.org/gmane.comp.video.dri.devel/150721
>
> So it seems both you and Tomeu were working to resolve the same issue [2].
>
> And John's patch seems to actually fix the underlying problem.
Indeed, I don't get spurious messages any more with this patch.
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Thanks,
Tomeu
>
> [2] https://lkml.org/lkml/2016/3/22/493
>
>
>> > > ---
>> > >
>> > > drivers/iommu/rockchip-iommu.c | 8 ++++----
>> > > 1 file changed, 4 insertions(+), 4 deletions(-)
>> > >
>> > > diff --git a/drivers/iommu/rockchip-iommu.c
>> > > b/drivers/iommu/rockchip-iommu.c index a6f593a0a29e..5710a06c3049
>> > > 100644
>> > > --- a/drivers/iommu/rockchip-iommu.c
>> > > +++ b/drivers/iommu/rockchip-iommu.c
>> > > @@ -315,8 +315,8 @@ static bool rk_iommu_is_stall_active(struct
>> > > rk_iommu
>> > > *iommu) int i;
>> > >
>> > > for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > - active &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > - RK_MMU_STATUS_STALL_ACTIVE;
>> > > + active &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > + RK_MMU_STATUS_STALL_ACTIVE);
>> > >
>> > > return active;
>> > >
>> > > }
>> > >
>> > > @@ -327,8 +327,8 @@ static bool rk_iommu_is_paging_enabled(struct
>> > > rk_iommu *iommu) int i;
>> > >
>> > > for (i = 0; i < iommu->num_mmu; i++)
>> > >
>> > > - enable &= rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > - RK_MMU_STATUS_PAGING_ENABLED;
>> > > + enable &= !!(rk_iommu_read(iommu->bases[i], RK_MMU_STATUS) &
>> > > + RK_MMU_STATUS_PAGING_ENABLED);
>> > >
>> > > return enable;
>> > >
>> > > }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
2016-04-05 14:05 ` John Keeping
(?)
@ 2016-04-07 12:50 ` Joerg Roedel
-1 siblings, 0 replies; 18+ messages in thread
From: Joerg Roedel @ 2016-04-07 12:50 UTC (permalink / raw)
To: John Keeping
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Heiko Stuebner,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Tue, Apr 05, 2016 at 03:05:46PM +0100, John Keeping wrote:
> drivers/iommu/rockchip-iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied to iommu/fixes. Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-07 12:50 ` Joerg Roedel
0 siblings, 0 replies; 18+ messages in thread
From: Joerg Roedel @ 2016-04-07 12:50 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 05, 2016 at 03:05:46PM +0100, John Keeping wrote:
> drivers/iommu/rockchip-iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied to iommu/fixes. Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] iommu/rockchip: Fix "is stall active" check
@ 2016-04-07 12:50 ` Joerg Roedel
0 siblings, 0 replies; 18+ messages in thread
From: Joerg Roedel @ 2016-04-07 12:50 UTC (permalink / raw)
To: John Keeping
Cc: Heiko Stuebner, iommu, linux-arm-kernel, linux-rockchip,
linux-kernel
On Tue, Apr 05, 2016 at 03:05:46PM +0100, John Keeping wrote:
> drivers/iommu/rockchip-iommu.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied to iommu/fixes. Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2016-04-07 12:50 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 14:05 [PATCH] iommu/rockchip: Fix "is stall active" check John Keeping
2016-04-05 14:05 ` John Keeping
2016-04-05 14:05 ` John Keeping
[not found] ` <1459865146-25308-1-git-send-email-john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
2016-04-05 17:21 ` Heiko Stuebner
2016-04-05 17:21 ` Heiko Stuebner
2016-04-05 17:21 ` Heiko Stuebner
2016-04-05 17:28 ` John Keeping
2016-04-05 17:28 ` John Keeping
2016-04-05 17:28 ` John Keeping
[not found] ` <20160405182858.382ea465.john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
2016-04-05 19:10 ` Heiko Stuebner
2016-04-05 19:10 ` Heiko Stuebner
2016-04-05 19:10 ` Heiko Stuebner
2016-04-06 7:45 ` Tomeu Vizoso
2016-04-06 7:45 ` Tomeu Vizoso
2016-04-06 7:45 ` Tomeu Vizoso
2016-04-07 12:50 ` Joerg Roedel
2016-04-07 12:50 ` Joerg Roedel
2016-04-07 12:50 ` Joerg Roedel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.