Skip to contentSkip to conversation

mps2: Implement FPGAIO counters and dual-timer

PATCH In review Peter Maydell 3 participants 10 messages Jul 30, 2018 – Aug 16, 2018 Arm/versatile express platform

lore
Share & tools
lore
#0 lore raw

cover mps2: Implement FPGAIO counters and dual-timer

This patchset adds some missing timer and counter devices to the MPS2 boards:

* the MPS2 "fpgaio" register bank includes some registers which provide various kinds of free-running counter
* the boards have an instance fo the CMSDK "dual timer module"

Together these are sufficient for QEMU's mps2-an505 emulation to pass the "timer test" subsection of the self-test program which can be found (behind a clickthrough EULA) in the Cortex-M33_IoT_kit_2_0.zip at:
https://developer.arm.com/products/system-design/development-boards/fpga-prototyping-boards/download-fpga-images

The dual-timer patch ended up a bit big; I can try to split that up if people would prefer that for review.

thanks
-- PMM

Peter Maydell (5):
hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module hw/arm/iotkit: Wire up the dualtimer
hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511

 hw/timer/Makefile.objs                 |   1 +
 include/hw/arm/iotkit.h                |   3 +-
 include/hw/misc/mps2-fpgaio.h          |  10 +
 include/hw/timer/cmsdk-apb-dualtimer.h |  72 ++++
 hw/arm/iotkit.c                        |   8 +-
 hw/arm/mps2.c                          |  11 +
 hw/misc/mps2-fpgaio.c                  | 146 ++++++-
 hw/timer/cmsdk-apb-dualtimer.c         | 515 +++++++++++++++++++++++++
 MAINTAINERS                            |   2 +
 default-configs/arm-softmmu.mak        |   1 +
 hw/timer/trace-events                  |   5 +
 11 files changed, 767 insertions(+), 7 deletions(-)
 create mode 100644 include/hw/timer/cmsdk-apb-dualtimer.h
 create mode 100644 hw/timer/cmsdk-apb-dualtimer.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters

The MPS2 FPGAIO block includes some simple free-running counters. Implement these.

---
 include/hw/misc/mps2-fpgaio.h |  4 +++
 hw/misc/mps2-fpgaio.c         | 53 ++++++++++++++++++++++++++++++++++-
 2 files changed, 56 insertions(+), 1 deletion(-)
include/hw/misc/mps2-fpgaio.h +4 -0
index eedf17ebc6d..ec057d38c76 100644
@@ -38,6 +38,10 @@ typedef struct {
     uint32_t misc;
 
     uint32_t prescale_clk;
+
+    /* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */
+    int64_t clk1hz_tick_offset;
+    int64_t clk100hz_tick_offset;
 } MPS2FPGAIO;
 
 #endif
hw/misc/mps2-fpgaio.c +52 -1

113 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/5 hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER

In reply to Peter Maydell

In the MPS2 FPGAIO, PSCNTR is a free-running downcounter with a reload value configured via the PRESCALE register, and COUNTER counts up by 1 every time PSCNTR reaches zero. Implement these counters.

We can just increment the counters migration subsection's version ID because we only added it in the previous commit, so no released QEMU versions will be using it.

---
 include/hw/misc/mps2-fpgaio.h |  6 +++
 hw/misc/mps2-fpgaio.c         | 97 +++++++++++++++++++++++++++++++++--
 2 files changed, 99 insertions(+), 4 deletions(-)
include/hw/misc/mps2-fpgaio.h +6 -0
index ec057d38c76..69e265cd4b2 100644
@@ -37,6 +37,12 @@ typedef struct {
     uint32_t prescale;
     uint32_t misc;
 
+    /* QEMU_CLOCK_VIRTUAL time at which counter and pscntr were last synced */
+    int64_t pscntr_sync_ticks;
+    /* Values of COUNTER and PSCNTR at time pscntr_sync_ticks */
+    uint32_t counter;
+    uint32_t pscntr;
+
     uint32_t prescale_clk;
 
     /* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */
hw/misc/mps2-fpgaio.c +93 -4

138 lines not on this page · raw message

Signature · 1 line
2.17.1
Reviewed-by on v1 2/5
#3 lore raw

Re: [Qemu-arm] [Qemu-devel] [PATCH 2/5] hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER

Quoted 10 lines · Peter Maydell

In the MPS2 FPGAIO, PSCNTR is a free-running downcounter with a reload value configured via the PRESCALE register, and COUNTER counts up by 1 every time PSCNTR reaches zero. Implement these counters.

We can just increment the counters migration subsection's version ID because we only added it in the previous commit, so no released QEMU versions will be using it.

Alistair

Quoted 174 lines
---
 include/hw/misc/mps2-fpgaio.h |  6 +++
 hw/misc/mps2-fpgaio.c         | 97 +++++++++++++++++++++++++++++++++--
 2 files changed, 99 insertions(+), 4 deletions(-)
include/hw/misc/mps2-fpgaio.h +6 -0
index ec057d38c76..69e265cd4b2 100644
@@ -37,6 +37,12 @@ typedef struct {
     uint32_t prescale;
     uint32_t misc;
 
+    /* QEMU_CLOCK_VIRTUAL time at which counter and pscntr were last synced */
+    int64_t pscntr_sync_ticks;
+    /* Values of COUNTER and PSCNTR at time pscntr_sync_ticks */
+    uint32_t counter;
+    uint32_t pscntr;
+
     uint32_t prescale_clk;
 
     /* These hold the CLOCK_VIRTUAL ns tick when the CLK1HZ/CLK100HZ was zero */
hw/misc/mps2-fpgaio.c +93 -5
index bbc28f641f0..5cf10ebd66a 100644
@@ -43,6 +43,77 @@ static int64_t tickoff_from_counter(int64_t now, uint32_t count, int frq)
     return now - muldiv64(count, NANOSECONDS_PER_SECOND, frq);
 }
 
+static void resync_counter(MPS2FPGAIO *s)
+{
+    /*
+     * Update s->counter and s->pscntr to their true current values
+     * by calculating how many times PSCNTR has ticked since the
+     * last time we did a resync.
+     */
+    int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+    int64_t elapsed = now - s->pscntr_sync_ticks;
+
+    /*
+     * Round elapsed down to a whole number of PSCNTR ticks, so we don't
+     * lose time if we do multiple resyncs in a single tick.
+     */
+    uint64_t ticks = muldiv64(elapsed, s->prescale_clk, NANOSECONDS_PER_SECOND);
+
+    /*
+     * Work out what PSCNTR and COUNTER have moved to. We assume that
+     * PSCNTR reloads from PRESCALE one tick-period after it hits zero,
+     * and that COUNTER increments at the same moment.
+     */
+    if (ticks == 0) {
+        /* We haven't ticked since the last time we were asked */
+        return;
+    } else if (ticks < s->pscntr) {
+        /* We haven't yet reached zero, just reduce the PSCNTR */
+        s->pscntr -= ticks;
+    } else {
+        if (s->prescale == 0) {
+            /*
+             * If the reload value is zero then the PSCNTR will stick
+             * at zero once it reaches it, and so we will increment
+             * COUNTER every tick after that.
+             */
+            s->counter += ticks - s->pscntr;
+            s->pscntr = 0;
+        } else {
+            /*
+             * This is the complicated bit. This ASCII art diagram gives an
+             * example with PRESCALE==5 PSCNTR==7:
+             *
+             * ticks  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
+             * PSCNTR 7  6  5  4  3  2  1  0  5  4  3  2  1  0  5
+             * cinc                           1                 2
+             * y            0  1  2  3  4  5  6  7  8  9 10 11 12
+             * x            0  1  2  3  4  5  0  1  2  3  4  5  0
+             *
+             * where x = y % (s->prescale + 1)
+             * and so PSCNTR = s->prescale - x
+             * and COUNTER is incremented by y / (s->prescale + 1)
+             *
+             * The case where PSCNTR < PRESCALE works out the same,
+             * though we must be careful to calculate y as 64-bit unsigned
+             * for all parts of the expression.
+             * y < 0 is not possible because that implies ticks < s->pscntr.
+             */
+            uint64_t y = ticks - s->pscntr + s->prescale;
+            s->pscntr = s->prescale - (y % (s->prescale + 1));
+            s->counter += y / (s->prescale + 1);
+        }
+    }
+
+    /*
+     * Only advance the sync time to the timestamp of the last PSCNTR tick,
+     * not all the way to 'now', so we don't lose time if we do multiple
+     * resyncs in a single tick.
+     */
+    s->pscntr_sync_ticks += muldiv64(ticks, NANOSECONDS_PER_SECOND,
+                                     s->prescale_clk);
+}
+
 static uint64_t mps2_fpgaio_read(void *opaque, hwaddr offset, unsigned size)
 {
     MPS2FPGAIO *s = MPS2_FPGAIO(opaque);
@@ -74,9 +145,12 @@ static uint64_t mps2_fpgaio_read(void *opaque, hwaddr offset, unsigned size)
         r = counter_from_tickoff(now, s->clk100hz_tick_offset, 100);
         break;
     case A_COUNTER:
+        resync_counter(s);
+        r = s->counter;
+        break;
     case A_PSCNTR:
-        qemu_log_mask(LOG_UNIMP, "MPS2 FPGAIO: counters unimplemented\n");
-        r = 0;
+        resync_counter(s);
+        r = s->pscntr;
         break;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
@@ -107,6 +181,7 @@ static void mps2_fpgaio_write(void *opaque, hwaddr offset, uint64_t value,
         s->led0 = value & 0x3;
         break;
     case A_PRESCALE:
+        resync_counter(s);
         s->prescale = value;
         break;
     case A_MISC:
@@ -126,6 +201,14 @@ static void mps2_fpgaio_write(void *opaque, hwaddr offset, uint64_t value,
         now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
         s->clk100hz_tick_offset = tickoff_from_counter(now, value, 100);
         break;
+    case A_COUNTER:
+        resync_counter(s);
+        s->counter = value;
+        break;
+    case A_PSCNTR:
+        resync_counter(s);
+        s->pscntr = value;
+        break;
     default:
         qemu_log_mask(LOG_GUEST_ERROR,
                       "MPS2 FPGAIO write: bad offset 0x%x\n", (int) offset);
@@ -150,6 +233,9 @@ static void mps2_fpgaio_reset(DeviceState *dev)
     s->misc = 0;
     s->clk1hz_tick_offset = tickoff_from_counter(now, 0, 1);
     s->clk100hz_tick_offset = tickoff_from_counter(now, 0, 100);
+    s->counter = 0;
+    s->pscntr = 0;
+    s->pscntr_sync_ticks = now;
 }
 
 static void mps2_fpgaio_init(Object *obj)
@@ -170,12 +256,15 @@ static bool mps2_fpgaio_counters_needed(void *opaque)
 
 static const VMStateDescription mps2_fpgaio_counters_vmstate = {
     .name = "mps2-fpgaio/counters",
-    .version_id = 1,
-    .minimum_version_id = 1,
+    .version_id = 2,
+    .minimum_version_id = 2,
     .needed = mps2_fpgaio_counters_needed,
     .fields = (VMStateField[]) {
         VMSTATE_INT64(clk1hz_tick_offset, MPS2FPGAIO),
         VMSTATE_INT64(clk100hz_tick_offset, MPS2FPGAIO),
+        VMSTATE_UINT32(counter, MPS2FPGAIO),
+        VMSTATE_UINT32(pscntr, MPS2FPGAIO),
+        VMSTATE_INT64(pscntr_sync_ticks, MPS2FPGAIO),
         VMSTATE_END_OF_LIST()
     }
 };
--

2.17.1

#4 lore raw

PATCH 3/5 hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module

In reply to Peter Maydell

The Arm Cortex-M System Design Kit includes a "dual-input timer module" which combines two programmable down-counters. Implement a model of this device.

---
 hw/timer/Makefile.objs                 |   1 +
 include/hw/timer/cmsdk-apb-dualtimer.h |  72 ++++
 hw/timer/cmsdk-apb-dualtimer.c         | 515 +++++++++++++++++++++++++
 MAINTAINERS                            |   2 +
 default-configs/arm-softmmu.mak        |   1 +
 hw/timer/trace-events                  |   5 +
 6 files changed, 596 insertions(+)
 create mode 100644 include/hw/timer/cmsdk-apb-dualtimer.h
 create mode 100644 hw/timer/cmsdk-apb-dualtimer.c
hw/timer/Makefile.objs +1 -0
index e16b2b913ce..b32194d153d 100644
@@ -44,4 +44,5 @@ common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o
 
 common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o
 common-obj-$(CONFIG_CMSDK_APB_TIMER) += cmsdk-apb-timer.o
+common-obj-$(CONFIG_CMSDK_APB_DUALTIMER) += cmsdk-apb-dualtimer.o
 common-obj-$(CONFIG_MSF2) += mss-timer.o
include/hw/timer/cmsdk-apb-dualtimer.h new file +72 -0

72 lines not on this page · raw message

hw/timer/cmsdk-apb-dualtimer.c new file +515 -0

515 lines not on this page · raw message

MAINTAINERS +2 -0
index 666e9368126..2c1a55ca207 100644
@@ -453,6 +453,8 @@ F: hw/timer/pl031.c
 F: include/hw/arm/primecell.h
 F: hw/timer/cmsdk-apb-timer.c
 F: include/hw/timer/cmsdk-apb-timer.h
+F: hw/timer/cmsdk-apb-dualtimer.c
+F: include/hw/timer/cmsdk-apb-dualtimer.h
 F: hw/char/cmsdk-apb-uart.c
 F: include/hw/char/cmsdk-apb-uart.h
 F: hw/misc/tz-ppc.c
default-configs/arm-softmmu.mak +1 -0
index 834d45cfaf9..046e8903839 100644
@@ -103,6 +103,7 @@ CONFIG_STM32F2XX_SPI=y
 CONFIG_STM32F205_SOC=y
 
 CONFIG_CMSDK_APB_TIMER=y
+CONFIG_CMSDK_APB_DUALTIMER=y
 CONFIG_CMSDK_APB_UART=y
 
 CONFIG_MPS2_FPGAIO=y
hw/timer/trace-events +5 -0
index e6e042fddb7..fa4213df5be 100644
@@ -61,5 +61,10 @@ cmsdk_apb_timer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB t
 cmsdk_apb_timer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB timer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
 cmsdk_apb_timer_reset(void) "CMSDK APB timer: reset"
 
+# hw/timer/cmsdk_apb_dualtimer.c
+cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
+cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
+cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset"
+
 # hw/timer/xlnx-zynqmp-rtc.c
 xlnx_zynqmp_rtc_gettime(int year, int month, int day, int hour, int min, int sec) "Get time from host: %d-%d-%d %2d:%02d:%02d"
Signature · 1 line
2.17.1
#5 lore raw

PATCH 4/5 hw/arm/iotkit: Wire up the dualtimer

In reply to Peter Maydell

Now we have a model of the CMSDK dual timer, we can wire it up in the IoTKit.

---
 include/hw/arm/iotkit.h | 3 ++-
 hw/arm/iotkit.c         | 8 +++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
include/hw/arm/iotkit.h +2 -1
index 2cddde55dd1..3e6d806e352 100644
@@ -56,6 +56,7 @@
 #include "hw/misc/tz-ppc.h"
 #include "hw/misc/tz-mpc.h"
 #include "hw/timer/cmsdk-apb-timer.h"
+#include "hw/timer/cmsdk-apb-dualtimer.h"
 #include "hw/misc/unimp.h"
 #include "hw/or-irq.h"
 #include "hw/core/split-irq.h"
@@ -87,7 +88,7 @@ typedef struct IoTKit {
     SplitIRQ mpc_irq_splitter[IOTS_NUM_EXP_MPC + IOTS_NUM_MPC];
     qemu_or_irq mpc_irq_orgate;
 
-    UnimplementedDeviceState dualtimer;
+    CMSDKAPBDualTimer dualtimer;
     UnimplementedDeviceState s32ktimer;
 
     MemoryRegion container;
hw/arm/iotkit.c +5 -3
index 8cadc8b1608..130d013909e 100644
@@ -139,7 +139,7 @@ static void iotkit_init(Object *obj)
     sysbus_init_child_obj(obj, "timer1", &s->timer1, sizeof(s->timer1),
                           TYPE_CMSDK_APB_TIMER);
     sysbus_init_child_obj(obj, "dualtimer", &s->dualtimer, sizeof(s->dualtimer),
-                          TYPE_UNIMPLEMENTED_DEVICE);
+                          TYPE_CMSDK_APB_DUALTIMER);
     object_initialize_child(obj, "ppc-irq-orgate", &s->ppc_irq_orgate,
                             sizeof(s->ppc_irq_orgate), TYPE_OR_IRQ,
                             &error_abort, NULL);
@@ -390,13 +390,15 @@ static void iotkit_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    qdev_prop_set_string(DEVICE(&s->dualtimer), "name", "Dual timer");
-    qdev_prop_set_uint64(DEVICE(&s->dualtimer), "size", 0x1000);
+
+    qdev_prop_set_uint32(DEVICE(&s->dualtimer), "pclk-frq", s->mainclk_frq);
     object_property_set_bool(OBJECT(&s->dualtimer), true, "realized", &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->dualtimer), 0,
+                       qdev_get_gpio_in(DEVICE(&s->armv7m), 5));
     mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->dualtimer), 0);
     object_property_set_link(OBJECT(&s->apb_ppc0), OBJECT(mr), "port[2]", &err);
     if (err) {
Signature · 1 line
2.17.1
#6 lore raw

PATCH 5/5 hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511

In reply to Peter Maydell

The MPS2 FPGA images for the Cortex-M3 (mps2-an385 and mps2-511) both include a CMSDK dual-timer module. Wire this up.

---
 hw/arm/mps2.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
hw/arm/mps2.c +11 -0
index c3946da3173..b0125ca0ebf 100644
@@ -34,6 +34,7 @@
 #include "hw/misc/unimp.h"
 #include "hw/char/cmsdk-apb-uart.h"
 #include "hw/timer/cmsdk-apb-timer.h"
+#include "hw/timer/cmsdk-apb-dualtimer.h"
 #include "hw/misc/mps2-scc.h"
 #include "hw/devices.h"
 #include "net/net.h"
@@ -64,6 +65,7 @@ typedef struct {
     MemoryRegion blockram_m3;
     MemoryRegion sram;
     MPS2SCC scc;
+    CMSDKAPBDualTimer dualtimer;
 } MPS2MachineState;
 
 #define TYPE_MPS2_MACHINE "mps2"
@@ -296,6 +298,15 @@ static void mps2_common_init(MachineState *machine)
     cmsdk_apb_timer_create(0x40000000, qdev_get_gpio_in(armv7m, 8), SYSCLK_FRQ);
     cmsdk_apb_timer_create(0x40001000, qdev_get_gpio_in(armv7m, 9), SYSCLK_FRQ);
 
+    sysbus_init_child_obj(OBJECT(mms), "dualtimer", &mms->dualtimer,
+                          sizeof(mms->dualtimer), TYPE_CMSDK_APB_DUALTIMER);
+    qdev_prop_set_uint32(DEVICE(&mms->dualtimer), "pclk-frq", SYSCLK_FRQ);
+    object_property_set_bool(OBJECT(&mms->dualtimer), true, "realized",
+                             &error_fatal);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0,
+                       qdev_get_gpio_in(armv7m, 10));
+    sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000);
+
     object_initialize(&mms->scc, sizeof(mms->scc), TYPE_MPS2_SCC);
     sccdev = DEVICE(&mms->scc);
     qdev_set_parent_bus(sccdev, sysbus_get_default());
Signature · 1 line
2.17.1
#7 lore raw
In reply to Peter Maydell
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH 0/5] mps2: Implement FPGAIO counters and dual-timer

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
72316845d2 hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511 1e40b97496 hw/arm/iotkit: Wire up the dualtimer
b4970bc615 hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module 222de88154 hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER 201fa0eef0 hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters

=== OUTPUT BEGIN ===
Checking PATCH 1/5: hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters...
ERROR: spaces required around that '*' (ctx:VxV)
#131: FILE: hw/misc/mps2-fpgaio.c:193:

+    .subsections = (const VMStateDescription*[]) {
                                             ^

total: 1 errors, 0 warnings, 123 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 2/5: hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER... Checking PATCH 3/5: hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644

total: 0 errors, 1 warnings, 617 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 4/5: hw/arm/iotkit: Wire up the dualtimer...
Checking PATCH 5/5: hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#8 lore raw
In reply to Peter Maydell
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH 0/5] mps2: Implement FPGAIO counters and dual-timer

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
ddb70544a8 hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511 bdb50460f4 hw/arm/iotkit: Wire up the dualtimer
008a768e12 hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module 5a008a3545 hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER 752c65591e hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters

=== OUTPUT BEGIN ===
Checking PATCH 1/5: hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters...
ERROR: spaces required around that '*' (ctx:VxV)
#131: FILE: hw/misc/mps2-fpgaio.c:193:

+    .subsections = (const VMStateDescription*[]) {
                                             ^

total: 1 errors, 0 warnings, 123 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 2/5: hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER... Checking PATCH 3/5: hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644

total: 0 errors, 1 warnings, 617 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 4/5: hw/arm/iotkit: Wire up the dualtimer...
Checking PATCH 5/5: hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#9 lore raw
In reply to Peter Maydell

Ping? Patch 2 has been reviewed but the rest are still waiting.

thanks
-- PMM

Quoted 40 lines · Peter Maydell

This patchset adds some missing timer and counter devices to the MPS2 boards:

* the MPS2 "fpgaio" register bank includes some registers which provide various kinds of free-running counter
* the boards have an instance fo the CMSDK "dual timer module"

Together these are sufficient for QEMU's mps2-an505 emulation to pass the "timer test" subsection of the self-test program which can be found (behind a clickthrough EULA) in the Cortex-M33_IoT_kit_2_0.zip at:
https://developer.arm.com/products/system-design/development-boards/fpga-prototyping-boards/download-fpga-images

The dual-timer patch ended up a bit big; I can try to split that up if people would prefer that for review.

thanks
-- PMM

Peter Maydell (5):
hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module hw/arm/iotkit: Wire up the dualtimer
hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511

 hw/timer/Makefile.objs                 |   1 +
 include/hw/arm/iotkit.h                |   3 +-
 include/hw/misc/mps2-fpgaio.h          |  10 +
 include/hw/timer/cmsdk-apb-dualtimer.h |  72 ++++
 hw/arm/iotkit.c                        |   8 +-
 hw/arm/mps2.c                          |  11 +
 hw/misc/mps2-fpgaio.c                  | 146 ++++++-
 hw/timer/cmsdk-apb-dualtimer.c         | 515 +++++++++++++++++++++++++
 MAINTAINERS                            |   2 +
 default-configs/arm-softmmu.mak        |   1 +
 hw/timer/trace-events                  |   5 +
 11 files changed, 767 insertions(+), 7 deletions(-)
 create mode 100644 include/hw/timer/cmsdk-apb-dualtimer.h
 create mode 100644 hw/timer/cmsdk-apb-dualtimer.c