Skip to contentSkip to conversation

watchdog: sbsa: only use 32-bit accessors

PATCH In review Jamie Iles 3 participants 3 messages Sep 3, 2021 – Sep 6, 2021 Watchdog device drivers

lore
Share & tools
lore

Jamie Iles

author
#0 lore raw

PATCH 1/1 watchdog: sbsa: only use 32-bit accessors

SBSA says of the generic watchdog:

All registers are 32 bits in size and should be accessed using 32-bit reads and writes. If an access size other than 32 bits is used then the results are IMPLEMENTATION DEFINED.

and for qemu, the implementation will only allow 32-bit accesses resulting in a synchronous external abort when configuring the watchdog. Use lo_hi_* accessors rather than a readq/writeq.

Fixes abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
---
 drivers/watchdog/sbsa_gwdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/sbsa_gwdt.c +2 -2
index ee9ff38929eb..6f4319bdbc50 100644
@@ -130,7 +130,7 @@ static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt)
 	if (gwdt->version == 0)
 		return readl(gwdt->control_base + SBSA_GWDT_WOR);
 	else
-		return readq(gwdt->control_base + SBSA_GWDT_WOR);
+		return lo_hi_readq(gwdt->control_base + SBSA_GWDT_WOR);
 }
 
 static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
@@ -138,7 +138,7 @@ static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
 	if (gwdt->version == 0)
 		writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR);
 	else
-		writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
+		lo_hi_writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
 }
 
 /*
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jamie Iles

SBSA says of the generic watchdog:

All registers are 32 bits in size and should be accessed using 32-bit reads and writes. If an access size other than 32 bits is used then the results are IMPLEMENTATION DEFINED.

Quoted 6 lines

and for qemu, the implementation will only allow 32-bit accesses resulting in a synchronous external abort when configuring the watchdog. Use lo_hi_* accessors rather than a readq/writeq.

Fixes abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
Quoted 27 lines
---
  drivers/watchdog/sbsa_gwdt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/sbsa_gwdt.c +2 -2
index ee9ff38929eb..6f4319bdbc50 100644
@@ -130,7 +130,7 @@ static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt)
  	if (gwdt->version == 0)
  		return readl(gwdt->control_base + SBSA_GWDT_WOR);
  	else
-		return readq(gwdt->control_base + SBSA_GWDT_WOR);
+		return lo_hi_readq(gwdt->control_base + SBSA_GWDT_WOR);
  }
 
  static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
@@ -138,7 +138,7 @@ static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
  	if (gwdt->version == 0)
  		writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR);
  	else
-		writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
+		lo_hi_writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
  }
 
  /*
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jamie Iles

Hi Jamie,

Quoted 21 lines · Jamie Iles

SBSA says of the generic watchdog:

All registers are 32 bits in size and should be accessed using 32-bit reads and writes. If an access size other than 32 bits is used then the results are IMPLEMENTATION DEFINED.

and for qemu, the implementation will only allow 32-bit accesses resulting in a synchronous external abort when configuring the watchdog. Use lo_hi_* accessors rather than a readq/writeq.

Fixes abd3ac7902fb ("watchdog: sbsa: Support architecture version 1")
---
 drivers/watchdog/sbsa_gwdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/sbsa_gwdt.c +0 -0
index ee9ff38929eb..6f4319bdbc50 100644

drivers/watchdog/sbsa_gwdt.c static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt) · line 133

Quoted 5 lines
drivers/watchdog/sbsa_gwdt.c +1 -1
@@ -130,7 +130,7 @@ static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt)
 	if (gwdt->version == 0)
 		return readl(gwdt->control_base + SBSA_GWDT_WOR);
 	else
-		return readq(gwdt->control_base + SBSA_GWDT_WOR);
+		return lo_hi_readq(gwdt->control_base + SBSA_GWDT_WOR);

My bad, I didn't check this carefully. Please feel free to add:

Thanks,
Shaokun

Quoted 13 lines
drivers/watchdog/sbsa_gwdt.c +1 -1
 }
 
 static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
@@ -138,7 +138,7 @@ static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt)
 	if (gwdt->version == 0)
 		writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR);
 	else
-		writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
+		lo_hi_writeq(val, gwdt->control_base + SBSA_GWDT_WOR);
 }
 
 /*