[PATCH][Bionic][SRU Artful] watchdog: sbsa: use 32-bit read for WCV

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH][Bionic][SRU Artful] watchdog: sbsa: use 32-bit read for WCV

dann frazier-4
From: Jayachandran C <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1755595

According to SBSA spec v3.1 section 5.3:
  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.
  [...]
  The Generic Watchdog is little-endian

The current code uses readq to read the watchdog compare register
which does a 64-bit access. This fails on ThunderX2 which does not
implement 64-bit access to this register.

Fix this by using lo_hi_readq() that does two 32-bit reads.

Signed-off-by: Jayachandran C <[hidden email]>
Reviewed-by: Guenter Roeck <[hidden email]>
Signed-off-by: Guenter Roeck <[hidden email]>
Signed-off-by: Wim Van Sebroeck <[hidden email]>
(cherry picked from commit 93ac3deb7c220cbcec032a967220a1f109d58431)
Signed-off-by: dann frazier <[hidden email]>
---
 drivers/watchdog/sbsa_gwdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index 316c2eb122d2..e8bd9887c566 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -50,6 +50,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timeleft(struct watchdog_device *wdd)
     !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0))
  timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR);
 
- timeleft += readq(gwdt->control_base + SBSA_GWDT_WCV) -
+ timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) -
     arch_counter_get_cntvct();
 
  do_div(timeleft, gwdt->clk);
--
2.16.2


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK / APPLIED[bionic]: [PATCH][Bionic][SRU Artful] watchdog: sbsa: use 32-bit read for WCV

Seth Forshee
On Tue, Mar 13, 2018 at 04:51:31PM -0600, dann frazier wrote:

> From: Jayachandran C <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1755595
>
> According to SBSA spec v3.1 section 5.3:
>   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.
>   [...]
>   The Generic Watchdog is little-endian
>
> The current code uses readq to read the watchdog compare register
> which does a 64-bit access. This fails on ThunderX2 which does not
> implement 64-bit access to this register.
>
> Fix this by using lo_hi_readq() that does two 32-bit reads.
>
> Signed-off-by: Jayachandran C <[hidden email]>
> Reviewed-by: Guenter Roeck <[hidden email]>
> Signed-off-by: Guenter Roeck <[hidden email]>
> Signed-off-by: Wim Van Sebroeck <[hidden email]>
> (cherry picked from commit 93ac3deb7c220cbcec032a967220a1f109d58431)
> Signed-off-by: dann frazier <[hidden email]>

Acked-by: Seth Forshee <[hidden email]>

Applied to bionic/master-next, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH][Bionic][SRU Artful] watchdog: sbsa: use 32-bit read for WCV

Stefan Bader-2
In reply to this post by dann frazier-4
On 13.03.2018 23:51, dann frazier wrote:

> From: Jayachandran C <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1755595
>
> According to SBSA spec v3.1 section 5.3:
>   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.
>   [...]
>   The Generic Watchdog is little-endian
>
> The current code uses readq to read the watchdog compare register
> which does a 64-bit access. This fails on ThunderX2 which does not
> implement 64-bit access to this register.
>
> Fix this by using lo_hi_readq() that does two 32-bit reads.
>
> Signed-off-by: Jayachandran C <[hidden email]>
> Reviewed-by: Guenter Roeck <[hidden email]>
> Signed-off-by: Guenter Roeck <[hidden email]>
> Signed-off-by: Wim Van Sebroeck <[hidden email]>
> (cherry picked from commit 93ac3deb7c220cbcec032a967220a1f109d58431)
> Signed-off-by: dann frazier <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

> ---
>  drivers/watchdog/sbsa_gwdt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
> index 316c2eb122d2..e8bd9887c566 100644
> --- a/drivers/watchdog/sbsa_gwdt.c
> +++ b/drivers/watchdog/sbsa_gwdt.c
> @@ -50,6 +50,7 @@
>   */
>  
>  #include <linux/io.h>
> +#include <linux/io-64-nonatomic-lo-hi.h>
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/moduleparam.h>
> @@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timeleft(struct watchdog_device *wdd)
>      !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0))
>   timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR);
>  
> - timeleft += readq(gwdt->control_base + SBSA_GWDT_WCV) -
> + timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) -
>      arch_counter_get_cntvct();
>  
>   do_div(timeleft, gwdt->clk);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

APPLIED: [PATCH][SRU Artful] watchdog: sbsa: use 32-bit read for WCV

Stefan Bader-2
In reply to this post by dann frazier-4
On 13.03.2018 23:51, dann frazier wrote:

> From: Jayachandran C <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1755595
>
> According to SBSA spec v3.1 section 5.3:
>   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.
>   [...]
>   The Generic Watchdog is little-endian
>
> The current code uses readq to read the watchdog compare register
> which does a 64-bit access. This fails on ThunderX2 which does not
> implement 64-bit access to this register.
>
> Fix this by using lo_hi_readq() that does two 32-bit reads.
>
> Signed-off-by: Jayachandran C <[hidden email]>
> Reviewed-by: Guenter Roeck <[hidden email]>
> Signed-off-by: Guenter Roeck <[hidden email]>
> Signed-off-by: Wim Van Sebroeck <[hidden email]>
> (cherry picked from commit 93ac3deb7c220cbcec032a967220a1f109d58431)
> Signed-off-by: dann frazier <[hidden email]>
> ---
>  drivers/watchdog/sbsa_gwdt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
> index 316c2eb122d2..e8bd9887c566 100644
> --- a/drivers/watchdog/sbsa_gwdt.c
> +++ b/drivers/watchdog/sbsa_gwdt.c
> @@ -50,6 +50,7 @@
>   */
>  
>  #include <linux/io.h>
> +#include <linux/io-64-nonatomic-lo-hi.h>
>  #include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/moduleparam.h>
> @@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timeleft(struct watchdog_device *wdd)
>      !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0))
>   timeleft += readl(gwdt->control_base + SBSA_GWDT_WOR);
>  
> - timeleft += readq(gwdt->control_base + SBSA_GWDT_WCV) -
> + timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) -
>      arch_counter_get_cntvct();
>  
>   do_div(timeleft, gwdt->clk);
>
Applied to artful master-next


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment