mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iommu: dart: DART_T8110_ERROR range should be 0 to 5
@ 2023-01-30 16:53 Eric Curtin
  2023-01-30 18:16 ` Sven Peter
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Curtin @ 2023-01-30 16:53 UTC (permalink / raw)
  To: asahi
  Cc: Eric Curtin, Dan Carpenter, Hector Martin, Sven Peter,
	Alyssa Rosenzweig, Joerg Roedel, Will Deacon, Robin Murphy,
	moderated list:ARM/APPLE MACHINE SUPPORT,
	open list:IOMMU SUBSYSTEM, open list

This was detected by smatch as one "else if" statement could never be
reached. Confirmed bit order by comparing with python implementation [1].

drivers/iommu/apple-dart.c:991 apple_dart_t8110_irq()
warn: duplicate check 'error_code == ((((1))) << (3))'
  (previous on line 989)

Link: https://github.com/AsahiLinux/m1n1/commit/96b2d584feec1e3f7bfa [1]

Fixes: d8bcc870d99d ("iommu: dart: Add t8110 DART support")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
---
 drivers/iommu/apple-dart.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index efe877842f72..3adacf4094d7 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -112,15 +112,15 @@
 
 #define DART_T8110_ERROR_MASK 0x104
 
-#define DART_T8110_ERROR_READ_FAULT BIT(4)
-#define DART_T8110_ERROR_WRITE_FAULT BIT(3)
+#define DART_T8110_ERROR_READ_FAULT BIT(5)
+#define DART_T8110_ERROR_WRITE_FAULT BIT(4)
 #define DART_T8110_ERROR_NO_PTE BIT(3)
 #define DART_T8110_ERROR_NO_PMD BIT(2)
 #define DART_T8110_ERROR_NO_PGD BIT(1)
 #define DART_T8110_ERROR_NO_TTBR BIT(0)
 
 #define DART_T8110_ERROR_ADDR_LO 0x170
-#define DART_T8110_ERROR_ADDR_HI 0x174
+#define DART_T8110_ERROR_ADDR_HI 0x175
 
 #define DART_T8110_PROTECT 0x200
 #define DART_T8110_UNPROTECT 0x204
-- 
2.39.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iommu: dart: DART_T8110_ERROR range should be 0 to 5
  2023-01-30 16:53 [PATCH] iommu: dart: DART_T8110_ERROR range should be 0 to 5 Eric Curtin
@ 2023-01-30 18:16 ` Sven Peter
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Peter @ 2023-01-30 18:16 UTC (permalink / raw)
  To: Eric Curtin, asahi
  Cc: Dan Carpenter, Hector Martin, Alyssa Rosenzweig, Joerg Roedel,
	Will Deacon, Robin Murphy,
	moderated list:ARM/APPLE MACHINE SUPPORT,
	open list:IOMMU SUBSYSTEM, open list

Hi,


On Mon, Jan 30, 2023, at 17:53, Eric Curtin wrote:
> This was detected by smatch as one "else if" statement could never be
> reached. Confirmed bit order by comparing with python implementation [1].
>
> drivers/iommu/apple-dart.c:991 apple_dart_t8110_irq()
> warn: duplicate check 'error_code == ((((1))) << (3))'
>   (previous on line 989)
>
> Link: https://github.com/AsahiLinux/m1n1/commit/96b2d584feec1e3f7bfa [1]
>
> Fixes: d8bcc870d99d ("iommu: dart: Add t8110 DART support")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Eric Curtin <ecurtin@redhat.com>
> ---
>  drivers/iommu/apple-dart.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index efe877842f72..3adacf4094d7 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -112,15 +112,15 @@
> 
>  #define DART_T8110_ERROR_MASK 0x104
> 
> -#define DART_T8110_ERROR_READ_FAULT BIT(4)
> -#define DART_T8110_ERROR_WRITE_FAULT BIT(3)
> +#define DART_T8110_ERROR_READ_FAULT BIT(5)
> +#define DART_T8110_ERROR_WRITE_FAULT BIT(4)

this looks good!

>  #define DART_T8110_ERROR_NO_PTE BIT(3)
>  #define DART_T8110_ERROR_NO_PMD BIT(2)
>  #define DART_T8110_ERROR_NO_PGD BIT(1)
>  #define DART_T8110_ERROR_NO_TTBR BIT(0)
> 
>  #define DART_T8110_ERROR_ADDR_LO 0x170
> -#define DART_T8110_ERROR_ADDR_HI 0x174
> +#define DART_T8110_ERROR_ADDR_HI 0x175

this doesn't. 0x174 already is the correct offset.


Thanks,


Sven


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-30 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 16:53 [PATCH] iommu: dart: DART_T8110_ERROR range should be 0 to 5 Eric Curtin
2023-01-30 18:16 ` Sven Peter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®