watchdog: sbsa: Update the W_IIDR Implementer bit mask to 0xFFF
RFC PATCH 1/1 watchdog: sbsa: Update the W_IIDR Implementer bit mask to 0xFFF
We noticed that the implementer mask defined in the driver [1] captures bits 0-10, whereas section C.4.2 of BSA specification [2] indicates that bits 0-11 of the W_IIDR register represent the implementer JEP106 code.
We were hoping to understand if there is a specific reason for using 11-bits in the driver implementation.
Looking forward to your insights.
[1] #define SBSA_GWDT_IMPL_MASK 0x7FF
[2] Implementer, bits [11:0]
Contains the JEP106 code of the company that implemented the Generic Watchdog:
Bits[11:8] The JEP106 continuation code of the implementer. Bit[7] Always 0
Bits [6:0] The JEP106 identity code of the implementer.
--- drivers/watchdog/sbsa_gwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sbsa_gwdt.c +1 -1
@@ -75,7 +75,7 @@#define SBSA_GWDT_VERSION_MASK 0xF#define SBSA_GWDT_VERSION_SHIFT 16 -#define SBSA_GWDT_IMPL_MASK 0x7FF +#define SBSA_GWDT_IMPL_MASK 0xFFF#define SBSA_GWDT_IMPL_SHIFT 0#define SBSA_GWDT_IMPL_MEDIATEK 0x426
Signature · 1 line
2.34.1
Hi,
Quoted 8 lines · Naina Mehta
We noticed that the implementer mask defined in the driver [1] captures bits 0-10, whereas section C.4.2 of BSA specification [2] indicates that bits 0-11 of the
W_IIDRregister represent the implementer JEP106 code.We were hoping to understand if there is a specific reason for using 11-bits in the driver implementation.
Looking forward to your insights.
Well, looks like a simple off-by-one bug, doesn't it? And nobody noticed because it only affects vendors in the later JEP banks, and the only user so far is comparing with 0x426, so it's not affected.
Quoted 20 lines
[1] #define
SBSA_GWDT_IMPL_MASK0x7FF[2] Implementer, bits [11:0]
Contains the JEP106 code of the company that implemented the Generic Watchdog:
Bits[11:8] The JEP106 continuation code of the implementer. Bit[7] Always 0
Bits [6:0] The JEP106 identity code of the implementer.Signed-off-by Naina Mehta <[email protected]>--- drivers/watchdog/sbsa_gwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/watchdog/sbsa_gwdt.c +0
-0
drivers/watchdog/sbsa_gwdt.c line 78
Quoted 5 lines
drivers/watchdog/sbsa_gwdt.c +1
-1@@ -75,7 +75,7 @@#define SBSA_GWDT_VERSION_MASK 0xF#define SBSA_GWDT_VERSION_SHIFT 16 -#define SBSA_GWDT_IMPL_MASK 0x7FF +#define SBSA_GWDT_IMPL_MASK 0xFFF
Can we please use GENMASK here? This probably would have avoided the problem in the first place.
Cheers,
Andre
Quoted 3 lines
drivers/watchdog/sbsa_gwdt.c +0
-0#define SBSA_GWDT_IMPL_SHIFT 0#define SBSA_GWDT_IMPL_MEDIATEK 0x426
Aaron Plattner
Acked-byQuoted 7 lines · Andre Przywara
Hi,
Quoted 4 lines · Naina Mehta
We noticed that the implementer mask defined in the driver [1] captures bits 0-10, whereas section C.4.2 of BSA specification [2] indicates that bits 0-11 of the
W_IIDRregister represent the implementer JEP106 code.
Quoted 6 lines
Quoted 4 lines
We were hoping to understand if there is a specific reason for using 11-bits in the driver implementation.
Looking forward to your insights.
Well, looks like a simple off-by-one bug, doesn't it? And nobody noticed because it only affects vendors in the later JEP banks, and the only user so far is comparing with
0x426, so it's not affected.
Yes, I think you're right. Sorry about that.
As far as I know, there isn't a 0xc26 assigned so I doubt anyone will run into this. And if they do, the workaround it applies has very low impact.
Quoted 16 lines
Quoted 16 lines
[1] #define SBSA_GWDT_IMPL_MASK
0x7FF[2] Implementer, bits [11:0]
Contains the JEP106 code of the company that implemented the Generic Watchdog:
Bits[11:8] The JEP106 continuation code of the implementer. Bit[7] Always 0
Bits [6:0] The JEP106 identity code of the implementer.Signed-off-by Naina Mehta <[email protected]>---
drivers/watchdog/sbsa_gwdt.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines
Quoted 9 lines
drivers/watchdog/sbsa_gwdt.c +0
-0@@ -75,7 +75,7 @@ #define SBSA_GWDT_VERSION_MASK 0xF #define SBSA_GWDT_VERSION_SHIFT 16-#define SBSA_GWDT_IMPL_MASK
0x7FF
+#define SBSA_GWDT_IMPL_MASK0xFFFCan we please use GENMASK here? This probably would have avoided the problem in the first place.
I'll leave that up to the maintainers, but assuming they're okay with this quick fix,
-- Aaron
Quoted 9 lines
Cheers,
AndreQuoted 2 lines
#define SBSA_GWDT_IMPL_SHIFT 0
#define SBSA_GWDT_IMPL_MEDIATEK0x426
Aaron Plattner
Acked-byQuoted 7 lines · Andre Przywara
Hi,
Quoted 4 lines · Naina Mehta
We noticed that the implementer mask defined in the driver [1] captures bits 0-10, whereas section C.4.2 of BSA specification [2] indicates that bits 0-11 of the
W_IIDRregister represent the implementer JEP106 code.
Quoted 6 lines
Quoted 4 lines
We were hoping to understand if there is a specific reason for using 11-bits in the driver implementation.
Looking forward to your insights.
Well, looks like a simple off-by-one bug, doesn't it? And nobody noticed because it only affects vendors in the later JEP banks, and the only user so far is comparing with
0x426, so it's not affected.
Yes, I think you're right. Sorry about that.
As far as I know, there isn't a 0xc26 assigned so I doubt anyone will run into this. And if they do, the workaround it applies has very low impact.
Quoted 15 lines
Quoted 15 lines
[1] #define SBSA_GWDT_IMPL_MASK
0x7FF[2] Implementer, bits [11:0]
Contains the JEP106 code of the company that implemented the Generic Watchdog:
Bits[11:8] The JEP106 continuation code of the implementer. Bit[7] Always 0
Bits [6:0] The JEP106 identity code of the implementer.Signed-off-by Naina Mehta <[email protected]>---
drivers/watchdog/sbsa_gwdt.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines
drivers/watchdog/sbsa_gwdt.c line 77
Quoted 9 lines
drivers/watchdog/sbsa_gwdt.c +1
-1@@ -75,7 +75,7 @@ #define SBSA_GWDT_VERSION_MASK 0xF #define SBSA_GWDT_VERSION_SHIFT 16 -#define SBSA_GWDT_IMPL_MASK 0x7FF +#define SBSA_GWDT_IMPL_MASK 0xFFFCan we please use GENMASK here? This probably would have avoided the problem in the first place.
I'll leave that up to the maintainers, but assuming they're okay with this quick fix,
-- Aaron
Quoted 8 lines
Cheers,
AndreQuoted 2 lines
drivers/watchdog/sbsa_gwdt.c +0
-0#define SBSA_GWDT_IMPL_SHIFT 0 #define SBSA_GWDT_IMPL_MEDIATEK 0x426