qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes
@ 2019-11-12  6:40 Joel Stanley
  2019-11-12  6:40 ` [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G Joel Stanley
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Joel Stanley @ 2019-11-12  6:40 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

Three of these are fixes for ast2600 models that I found when testing
master. The forth is a usability improvement that is helpful when
diagnosing why a watchdog is biting.

Joel Stanley (4):
  aspeed/sdmc: Make ast2600 default 1G
  aspeed/scu: Fix W1C behavior
  watchdog/aspeed: Improve watchdog timeout message
  watchdog/aspeed: Fix AST2600 frequency behaviour

 hw/misc/aspeed_scu.c             | 11 ++++++++---
 hw/misc/aspeed_sdmc.c            |  6 +++---
 hw/watchdog/wdt_aspeed.c         | 24 +++++++++++++++++++-----
 include/hw/watchdog/wdt_aspeed.h |  1 +
 4 files changed, 31 insertions(+), 11 deletions(-)

-- 
2.24.0



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

* [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G
  2019-11-12  6:40 [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes Joel Stanley
@ 2019-11-12  6:40 ` Joel Stanley
  2019-11-12  7:45   ` Cédric Le Goater
  2019-11-12  6:40 ` [PATCH 2/4] aspeed/scu: Fix W1C behavior Joel Stanley
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Joel Stanley @ 2019-11-12  6:40 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

Most boards have this much.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/misc/aspeed_sdmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c
index f3a63a2e01db..2df3244b53c8 100644
--- a/hw/misc/aspeed_sdmc.c
+++ b/hw/misc/aspeed_sdmc.c
@@ -208,10 +208,10 @@ static int ast2600_rambits(AspeedSDMCState *s)
     }
 
     /* use a common default */
-    warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 512M",
+    warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 1024M",
                 s->ram_size);
-    s->ram_size = 512 << 20;
-    return ASPEED_SDMC_AST2600_512MB;
+    s->ram_size = 1024 << 20;
+    return ASPEED_SDMC_AST2600_1024MB;
 }
 
 static void aspeed_sdmc_reset(DeviceState *dev)
-- 
2.24.0



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

* [PATCH 2/4] aspeed/scu: Fix W1C behavior
  2019-11-12  6:40 [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes Joel Stanley
  2019-11-12  6:40 ` [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G Joel Stanley
@ 2019-11-12  6:40 ` Joel Stanley
  2019-11-12  7:45   ` Cédric Le Goater
  2019-11-12  6:40 ` [PATCH 3/4] watchdog/aspeed: Improve watchdog timeout message Joel Stanley
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Joel Stanley @ 2019-11-12  6:40 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

This models the clock write one to clear registers, and fixes up some
incorrect behavior in all of the write to clear registers.

There was also a typo in one of the register definitions.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/misc/aspeed_scu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index 717509bc5460..aac4645f8c3c 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -98,7 +98,7 @@
 #define AST2600_CLK_STOP_CTRL     TO_REG(0x80)
 #define AST2600_CLK_STOP_CTRL_CLR TO_REG(0x84)
 #define AST2600_CLK_STOP_CTRL2     TO_REG(0x90)
-#define AST2600_CLK_STOP_CTR2L_CLR TO_REG(0x94)
+#define AST2600_CLK_STOP_CTRL2_CLR TO_REG(0x94)
 #define AST2600_SDRAM_HANDSHAKE   TO_REG(0x100)
 #define AST2600_HPLL_PARAM        TO_REG(0x200)
 #define AST2600_HPLL_EXT          TO_REG(0x204)
@@ -532,11 +532,12 @@ static uint64_t aspeed_ast2600_scu_read(void *opaque, hwaddr offset,
     return s->regs[reg];
 }
 
-static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data,
+static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data64,
                                      unsigned size)
 {
     AspeedSCUState *s = ASPEED_SCU(opaque);
     int reg = TO_REG(offset);
+    uint32_t data = data64;
 
     if (reg >= ASPEED_AST2600_SCU_NR_REGS) {
         qemu_log_mask(LOG_GUEST_ERROR,
@@ -563,15 +564,19 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data,
         /* fall through */
     case AST2600_SYS_RST_CTRL:
     case AST2600_SYS_RST_CTRL2:
+    case AST2600_CLK_STOP_CTRL:
+    case AST2600_CLK_STOP_CTRL2:
         /* W1S (Write 1 to set) registers */
         s->regs[reg] |= data;
         return;
     case AST2600_SYS_RST_CTRL_CLR:
     case AST2600_SYS_RST_CTRL2_CLR:
+    case AST2600_CLK_STOP_CTRL_CLR:
+    case AST2600_CLK_STOP_CTRL2_CLR:
     case AST2600_HW_STRAP1_CLR:
     case AST2600_HW_STRAP2_CLR:
         /* W1C (Write 1 to clear) registers */
-        s->regs[reg] &= ~data;
+        s->regs[reg - 1] &= ~data;
         return;
 
     case AST2600_RNG_DATA:
-- 
2.24.0



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

* [PATCH 3/4] watchdog/aspeed: Improve watchdog timeout message
  2019-11-12  6:40 [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes Joel Stanley
  2019-11-12  6:40 ` [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G Joel Stanley
  2019-11-12  6:40 ` [PATCH 2/4] aspeed/scu: Fix W1C behavior Joel Stanley
@ 2019-11-12  6:40 ` Joel Stanley
  2019-11-12  7:52   ` Cédric Le Goater
  2019-11-12  6:40 ` [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour Joel Stanley
  2019-11-12 15:05 ` [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes no-reply
  4 siblings, 1 reply; 11+ messages in thread
From: Joel Stanley @ 2019-11-12  6:40 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

Users benefit from knowing which watchdog timer has expired. The address
of the watchdog's registers unambiguously indicates which has expired,
so log that.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/watchdog/wdt_aspeed.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
index 145be6f99ce2..5697ed83325a 100644
--- a/hw/watchdog/wdt_aspeed.c
+++ b/hw/watchdog/wdt_aspeed.c
@@ -219,7 +219,8 @@ static void aspeed_wdt_timer_expired(void *dev)
         return;
     }
 
-    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");
+    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer %08lx expired.\n",
+            s->iomem.addr);
     watchdog_perform_action();
     timer_del(s->timer);
 }
-- 
2.24.0



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

* [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour
  2019-11-12  6:40 [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes Joel Stanley
                   ` (2 preceding siblings ...)
  2019-11-12  6:40 ` [PATCH 3/4] watchdog/aspeed: Improve watchdog timeout message Joel Stanley
@ 2019-11-12  6:40 ` Joel Stanley
  2019-11-12  7:56   ` Cédric Le Goater
  2019-11-12 15:05 ` [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes no-reply
  4 siblings, 1 reply; 11+ messages in thread
From: Joel Stanley @ 2019-11-12  6:40 UTC (permalink / raw)
  To: Cédric Le Goater, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

The AST2600 control register sneakily changed the meaning of bit 4
without anyone noticing. It no longer controls the 1MHz vs APB clock
select, and instead always runs at 1MHz.

The AST2500 was always 1MHz too, but it retained bit 4, making it read
only. We can model both using the same fixed 1MHz calculation.

Fixes: ea29711f467f ("watchdog/aspeed: Fix AST2600 control reg behaviour")
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/watchdog/wdt_aspeed.c         | 21 +++++++++++++++++----
 include/hw/watchdog/wdt_aspeed.h |  1 +
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
index 5697ed83325a..f43a3bc88976 100644
--- a/hw/watchdog/wdt_aspeed.c
+++ b/hw/watchdog/wdt_aspeed.c
@@ -93,11 +93,11 @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size)
 
 }
 
-static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk)
+static void aspeed_wdt_reload(AspeedWDTState *s)
 {
     uint64_t reload;
 
-    if (pclk) {
+    if (!(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK)) {
         reload = muldiv64(s->regs[WDT_RELOAD_VALUE], NANOSECONDS_PER_SECOND,
                           s->pclk_freq);
     } else {
@@ -109,6 +109,16 @@ static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk)
     }
 }
 
+static void aspeed_wdt_reload_1mhz(AspeedWDTState *s)
+{
+    uint64_t reload = s->regs[WDT_RELOAD_VALUE] * 1000ULL;
+
+    if (aspeed_wdt_is_enabled(s)) {
+        timer_mod(s->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + reload);
+    }
+}
+
+
 static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
                              unsigned size)
 {
@@ -130,13 +140,13 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
     case WDT_RESTART:
         if ((data & 0xFFFF) == WDT_RESTART_MAGIC) {
             s->regs[WDT_STATUS] = s->regs[WDT_RELOAD_VALUE];
-            aspeed_wdt_reload(s, !(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK));
+            awc->wdt_reload(s);
         }
         break;
     case WDT_CTRL:
         if (enable && !aspeed_wdt_is_enabled(s)) {
             s->regs[WDT_CTRL] = data;
-            aspeed_wdt_reload(s, !(data & WDT_CTRL_1MHZ_CLK));
+            awc->wdt_reload(s);
         } else if (!enable && aspeed_wdt_is_enabled(s)) {
             s->regs[WDT_CTRL] = data;
             timer_del(s->timer);
@@ -283,6 +293,7 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data)
     awc->offset = 0x20;
     awc->ext_pulse_width_mask = 0xff;
     awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
+    awc->wdt_reload = aspeed_wdt_reload;
 }
 
 static const TypeInfo aspeed_2400_wdt_info = {
@@ -317,6 +328,7 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data)
     awc->ext_pulse_width_mask = 0xfffff;
     awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
     awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
+    awc->wdt_reload = aspeed_wdt_reload_1mhz;
 }
 
 static const TypeInfo aspeed_2500_wdt_info = {
@@ -336,6 +348,7 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data)
     awc->ext_pulse_width_mask = 0xfffff; /* TODO */
     awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1;
     awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
+    awc->wdt_reload = aspeed_wdt_reload_1mhz;
 }
 
 static const TypeInfo aspeed_2600_wdt_info = {
diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
index dfedd7662dd1..819c22993a6e 100644
--- a/include/hw/watchdog/wdt_aspeed.h
+++ b/include/hw/watchdog/wdt_aspeed.h
@@ -47,6 +47,7 @@ typedef struct AspeedWDTClass {
     uint32_t ext_pulse_width_mask;
     uint32_t reset_ctrl_reg;
     void (*reset_pulse)(AspeedWDTState *s, uint32_t property);
+    void (*wdt_reload)(AspeedWDTState *s);
 }  AspeedWDTClass;
 
 #endif /* WDT_ASPEED_H */
-- 
2.24.0



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

* Re: [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G
  2019-11-12  6:40 ` [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G Joel Stanley
@ 2019-11-12  7:45   ` Cédric Le Goater
  0 siblings, 0 replies; 11+ messages in thread
From: Cédric Le Goater @ 2019-11-12  7:45 UTC (permalink / raw)
  To: Joel Stanley, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

On 12/11/2019 07:40, Joel Stanley wrote:
> Most boards have this much.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>


Reviewed-by: Cédric Le Goater <clg@kaod.org>


> ---
>  hw/misc/aspeed_sdmc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c
> index f3a63a2e01db..2df3244b53c8 100644
> --- a/hw/misc/aspeed_sdmc.c
> +++ b/hw/misc/aspeed_sdmc.c
> @@ -208,10 +208,10 @@ static int ast2600_rambits(AspeedSDMCState *s)
>      }
>  
>      /* use a common default */
> -    warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 512M",
> +    warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 1024M",
>                  s->ram_size);
> -    s->ram_size = 512 << 20;
> -    return ASPEED_SDMC_AST2600_512MB;
> +    s->ram_size = 1024 << 20;
> +    return ASPEED_SDMC_AST2600_1024MB;
>  }
>  
>  static void aspeed_sdmc_reset(DeviceState *dev)
> 



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

* Re: [PATCH 2/4] aspeed/scu: Fix W1C behavior
  2019-11-12  6:40 ` [PATCH 2/4] aspeed/scu: Fix W1C behavior Joel Stanley
@ 2019-11-12  7:45   ` Cédric Le Goater
  0 siblings, 0 replies; 11+ messages in thread
From: Cédric Le Goater @ 2019-11-12  7:45 UTC (permalink / raw)
  To: Joel Stanley, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

On 12/11/2019 07:40, Joel Stanley wrote:
> This models the clock write one to clear registers, and fixes up some
> incorrect behavior in all of the write to clear registers.
> 
> There was also a typo in one of the register definitions.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

> ---
>  hw/misc/aspeed_scu.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
> index 717509bc5460..aac4645f8c3c 100644
> --- a/hw/misc/aspeed_scu.c
> +++ b/hw/misc/aspeed_scu.c
> @@ -98,7 +98,7 @@
>  #define AST2600_CLK_STOP_CTRL     TO_REG(0x80)
>  #define AST2600_CLK_STOP_CTRL_CLR TO_REG(0x84)
>  #define AST2600_CLK_STOP_CTRL2     TO_REG(0x90)
> -#define AST2600_CLK_STOP_CTR2L_CLR TO_REG(0x94)
> +#define AST2600_CLK_STOP_CTRL2_CLR TO_REG(0x94)
>  #define AST2600_SDRAM_HANDSHAKE   TO_REG(0x100)
>  #define AST2600_HPLL_PARAM        TO_REG(0x200)
>  #define AST2600_HPLL_EXT          TO_REG(0x204)
> @@ -532,11 +532,12 @@ static uint64_t aspeed_ast2600_scu_read(void *opaque, hwaddr offset,
>      return s->regs[reg];
>  }
>  
> -static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data,
> +static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data64,
>                                       unsigned size)
>  {
>      AspeedSCUState *s = ASPEED_SCU(opaque);
>      int reg = TO_REG(offset);
> +    uint32_t data = data64;
>  
>      if (reg >= ASPEED_AST2600_SCU_NR_REGS) {
>          qemu_log_mask(LOG_GUEST_ERROR,
> @@ -563,15 +564,19 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data,
>          /* fall through */
>      case AST2600_SYS_RST_CTRL:
>      case AST2600_SYS_RST_CTRL2:
> +    case AST2600_CLK_STOP_CTRL:
> +    case AST2600_CLK_STOP_CTRL2:
>          /* W1S (Write 1 to set) registers */
>          s->regs[reg] |= data;
>          return;
>      case AST2600_SYS_RST_CTRL_CLR:
>      case AST2600_SYS_RST_CTRL2_CLR:
> +    case AST2600_CLK_STOP_CTRL_CLR:
> +    case AST2600_CLK_STOP_CTRL2_CLR:
>      case AST2600_HW_STRAP1_CLR:
>      case AST2600_HW_STRAP2_CLR:
>          /* W1C (Write 1 to clear) registers */
> -        s->regs[reg] &= ~data;
> +        s->regs[reg - 1] &= ~data;
>          return;
>  
>      case AST2600_RNG_DATA:
> 



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

* Re: [PATCH 3/4] watchdog/aspeed: Improve watchdog timeout message
  2019-11-12  6:40 ` [PATCH 3/4] watchdog/aspeed: Improve watchdog timeout message Joel Stanley
@ 2019-11-12  7:52   ` Cédric Le Goater
  0 siblings, 0 replies; 11+ messages in thread
From: Cédric Le Goater @ 2019-11-12  7:52 UTC (permalink / raw)
  To: Joel Stanley, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

On 12/11/2019 07:40, Joel Stanley wrote:
> Users benefit from knowing which watchdog timer has expired. The address
> of the watchdog's registers unambiguously indicates which has expired,
> so log that.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>


The format below should be using HWADDR_PRIx. No need to resend. 
I will fix it. 

Reviewed-by: Cédric Le Goater <clg@kaod.org>

C. 

> ---
>  hw/watchdog/wdt_aspeed.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
> index 145be6f99ce2..5697ed83325a 100644
> --- a/hw/watchdog/wdt_aspeed.c
> +++ b/hw/watchdog/wdt_aspeed.c
> @@ -219,7 +219,8 @@ static void aspeed_wdt_timer_expired(void *dev)
>          return;
>      }
>  
> -    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");
> +    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer %08lx expired.\n",
> +            s->iomem.addr);
>      watchdog_perform_action();
>      timer_del(s->timer);
>  }
> 



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

* Re: [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour
  2019-11-12  6:40 ` [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour Joel Stanley
@ 2019-11-12  7:56   ` Cédric Le Goater
  2019-11-13  0:48     ` Joel Stanley
  0 siblings, 1 reply; 11+ messages in thread
From: Cédric Le Goater @ 2019-11-12  7:56 UTC (permalink / raw)
  To: Joel Stanley, Peter Maydell, Andrew Jeffery; +Cc: qemu-arm, qemu-devel

On 12/11/2019 07:40, Joel Stanley wrote:
> The AST2600 control register sneakily changed the meaning of bit 4
> without anyone noticing. It no longer controls the 1MHz vs APB clock
> select, and instead always runs at 1MHz.
> 
> The AST2500 was always 1MHz too, but it retained bit 4, making it read
> only. We can model both using the same fixed 1MHz calculation.
> 
> Fixes: ea29711f467f ("watchdog/aspeed: Fix AST2600 control reg behaviour")

which commit is that ^ ? Did you mean :

Fixes: 6b2b2a703cad ("hw: wdt_aspeed: Add AST2600 support")

> Signed-off-by: Joel Stanley <joel@jms.id.au>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

C.

> ---
>  hw/watchdog/wdt_aspeed.c         | 21 +++++++++++++++++----
>  include/hw/watchdog/wdt_aspeed.h |  1 +
>  2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
> index 5697ed83325a..f43a3bc88976 100644
> --- a/hw/watchdog/wdt_aspeed.c
> +++ b/hw/watchdog/wdt_aspeed.c
> @@ -93,11 +93,11 @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size)
>  
>  }
>  
> -static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk)
> +static void aspeed_wdt_reload(AspeedWDTState *s)
>  {
>      uint64_t reload;
>  
> -    if (pclk) {
> +    if (!(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK)) {
>          reload = muldiv64(s->regs[WDT_RELOAD_VALUE], NANOSECONDS_PER_SECOND,
>                            s->pclk_freq);
>      } else {
> @@ -109,6 +109,16 @@ static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk)
>      }
>  }
>  
> +static void aspeed_wdt_reload_1mhz(AspeedWDTState *s)
> +{
> +    uint64_t reload = s->regs[WDT_RELOAD_VALUE] * 1000ULL;
> +
> +    if (aspeed_wdt_is_enabled(s)) {
> +        timer_mod(s->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + reload);
> +    }
> +}
> +
> +
>  static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
>                               unsigned size)
>  {
> @@ -130,13 +140,13 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
>      case WDT_RESTART:
>          if ((data & 0xFFFF) == WDT_RESTART_MAGIC) {
>              s->regs[WDT_STATUS] = s->regs[WDT_RELOAD_VALUE];
> -            aspeed_wdt_reload(s, !(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK));
> +            awc->wdt_reload(s);
>          }
>          break;
>      case WDT_CTRL:
>          if (enable && !aspeed_wdt_is_enabled(s)) {
>              s->regs[WDT_CTRL] = data;
> -            aspeed_wdt_reload(s, !(data & WDT_CTRL_1MHZ_CLK));
> +            awc->wdt_reload(s);
>          } else if (!enable && aspeed_wdt_is_enabled(s)) {
>              s->regs[WDT_CTRL] = data;
>              timer_del(s->timer);
> @@ -283,6 +293,7 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data)
>      awc->offset = 0x20;
>      awc->ext_pulse_width_mask = 0xff;
>      awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
> +    awc->wdt_reload = aspeed_wdt_reload;
>  }
>  
>  static const TypeInfo aspeed_2400_wdt_info = {
> @@ -317,6 +328,7 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data)
>      awc->ext_pulse_width_mask = 0xfffff;
>      awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
>      awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
> +    awc->wdt_reload = aspeed_wdt_reload_1mhz;
>  }
>  
>  static const TypeInfo aspeed_2500_wdt_info = {
> @@ -336,6 +348,7 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data)
>      awc->ext_pulse_width_mask = 0xfffff; /* TODO */
>      awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1;
>      awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
> +    awc->wdt_reload = aspeed_wdt_reload_1mhz;
>  }
>  
>  static const TypeInfo aspeed_2600_wdt_info = {
> diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
> index dfedd7662dd1..819c22993a6e 100644
> --- a/include/hw/watchdog/wdt_aspeed.h
> +++ b/include/hw/watchdog/wdt_aspeed.h
> @@ -47,6 +47,7 @@ typedef struct AspeedWDTClass {
>      uint32_t ext_pulse_width_mask;
>      uint32_t reset_ctrl_reg;
>      void (*reset_pulse)(AspeedWDTState *s, uint32_t property);
> +    void (*wdt_reload)(AspeedWDTState *s);
>  }  AspeedWDTClass;
>  
>  #endif /* WDT_ASPEED_H */
> 



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

* Re: [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes
  2019-11-12  6:40 [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes Joel Stanley
                   ` (3 preceding siblings ...)
  2019-11-12  6:40 ` [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour Joel Stanley
@ 2019-11-12 15:05 ` no-reply
  4 siblings, 0 replies; 11+ messages in thread
From: no-reply @ 2019-11-12 15:05 UTC (permalink / raw)
  To: joel; +Cc: andrew, peter.maydell, qemu-arm, clg, qemu-devel

Patchew URL: https://patchew.org/QEMU/20191112064058.13275-1-joel@jms.id.au/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

  CC      qga/guest-agent-command-state.o
In file included from /tmp/qemu-test/src/hw/watchdog/wdt_aspeed.c:13:
/tmp/qemu-test/src/hw/watchdog/wdt_aspeed.c: In function 'aspeed_wdt_timer_expired':
/tmp/qemu-test/src/hw/watchdog/wdt_aspeed.c:232:34: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'hwaddr' {aka 'long long unsigned int'} [-Werror=format=]
     qemu_log_mask(CPU_LOG_RESET, "Watchdog timer %08lx expired.\n",
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             s->iomem.addr);
---
                      ^~~
cc1: all warnings being treated as errors
  BUILD   pc-bios/optionrom/multiboot.img
make: *** [/tmp/qemu-test/src/rules.mak:69: hw/watchdog/wdt_aspeed.o] Error 1
make: *** Waiting for unfinished jobs....
  CC      qga/main.o
  BUILD   pc-bios/optionrom/linuxboot.img
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=f52d432b2dd64b048a6f416466c0033d', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-k6_g3bqv/src/docker-src.2019-11-12-10.02.49.13016:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=f52d432b2dd64b048a6f416466c0033d
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-k6_g3bqv/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real    2m42.914s
user    0m7.862s


The full log is available at
http://patchew.org/logs/20191112064058.13275-1-joel@jms.id.au/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour
  2019-11-12  7:56   ` Cédric Le Goater
@ 2019-11-13  0:48     ` Joel Stanley
  0 siblings, 0 replies; 11+ messages in thread
From: Joel Stanley @ 2019-11-13  0:48 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Andrew Jeffery, Peter Maydell, qemu-arm, QEMU Developers

On Tue, 12 Nov 2019 at 07:56, Cédric Le Goater <clg@kaod.org> wrote:
>
> On 12/11/2019 07:40, Joel Stanley wrote:
> > The AST2600 control register sneakily changed the meaning of bit 4
> > without anyone noticing. It no longer controls the 1MHz vs APB clock
> > select, and instead always runs at 1MHz.
> >
> > The AST2500 was always 1MHz too, but it retained bit 4, making it read
> > only. We can model both using the same fixed 1MHz calculation.
> >
> > Fixes: ea29711f467f ("watchdog/aspeed: Fix AST2600 control reg behaviour")
>
> which commit is that ^ ? Did you mean :
>
> Fixes: 6b2b2a703cad ("hw: wdt_aspeed: Add AST2600 support")

Yes. Thanks for catching that.


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

end of thread, other threads:[~2019-11-13  0:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12  6:40 [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes Joel Stanley
2019-11-12  6:40 ` [PATCH 1/4] aspeed/sdmc: Make ast2600 default 1G Joel Stanley
2019-11-12  7:45   ` Cédric Le Goater
2019-11-12  6:40 ` [PATCH 2/4] aspeed/scu: Fix W1C behavior Joel Stanley
2019-11-12  7:45   ` Cédric Le Goater
2019-11-12  6:40 ` [PATCH 3/4] watchdog/aspeed: Improve watchdog timeout message Joel Stanley
2019-11-12  7:52   ` Cédric Le Goater
2019-11-12  6:40 ` [PATCH 4/4] watchdog/aspeed: Fix AST2600 frequency behaviour Joel Stanley
2019-11-12  7:56   ` Cédric Le Goater
2019-11-13  0:48     ` Joel Stanley
2019-11-12 15:05 ` [PATCH 0/4] arm/aspeed: Watchdog and SDRAM fixes no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).