target-arm queue
First arm pullreq of the 5.1 cycle; mostly bugfixes and some cleanup patches. The new clock modelling framework is the big thing here.
-- PMM
The following changes since commit 648db19685b7030aa558a4ddbd3a8e53d8c9a062:
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2020-04-29' into staging (2020-04-29 15:07:33 +0100)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200430
for you to fetch changes up to 1267437e593e85498f9105b3bdab796630d2e83f:
hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes (2020-04-30 11:52:29 +0100)
----------------------------------------------------------------
target-arm queue:
* xlnx-zdma: Fix endianness handling of descriptor loading
* nrf51: Fix last GPIO CNF address
* gicv3: Use gicr_typer in arm_gicv3_icc_reset
* msf2: Add EMAC block to SmartFusion2 SoC
* New clock modelling framework
* hw/arm: versal: Setup the ADMA with 128bit bus-width
* Cadence: gem: fix wraparound in 64bit descriptors
* cadence_gem: clear RX control descriptor
* target/arm: Vectorize integer comparison vs zero
* hw/arm/virt: dt: add kaslr-seed property
* hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes
----------------------------------------------------------------
Cameron Esfahani (1):
nrf51: Fix last GPIO CNF address
Damien Hedde (7):
hw/core/clock-vmstate: define a vmstate entry for clock state
qdev: add clock input&output support to devices.
qdev-clock: introduce an init array to ease the device construction hw/misc/zynq_slcr: add clock generation for uarts hw/char/cadence_uart: add clock support hw/arm/xilinx_zynq: connect uart clocks to slcr
qdev-monitor: print the device's clock with info qtree
Edgar E. Iglesias (7):
dma/xlnx-zdma: Fix descriptor loading (MEM) wrt endianness dma/xlnx-zdma: Fix descriptor loading (REG) wrt endianness hw/arm: versal: Setup the ADMA with 128bit bus-width
device_tree: Allow name wildcards in qemu_fdt_node_path()
device_tree: Constify compat in qemu_fdt_node_path() hw/arm: xlnx-zcu102: Move arm_boot_info into XlnxZCU102 hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes
Jerome Forissier (2):
hw/arm/virt: dt: move creation of /secure-chosen to create_fdt() hw/arm/virt: dt: add kaslr-seed property
Keqian Zhu (2):
bugfix: Use gicr_typer in arm_gicv3_icc_reset
Typo: Correct the name of CPU hotplug memory region
Peter Maydell (2):
hw/core/clock: introduce clock object docs/clocks: add device's clock documentation
Philippe Mathieu-Daudé (3):
target/arm: Restrict the Address Translate write operation to TCG accel target/arm/cpu: Use ARRAY_SIZE() to iterate over ARMCPUInfo[] target/arm/cpu: Update coding style to make checkpatch.pl happy
Ramon Fried (2):
Cadence: gem: fix wraparound in 64bit descriptors
net: cadence_gem: clear RX control descriptor
Richard Henderson (1):
target/arm: Vectorize integer comparison vs zero
Subbaraya Sundeep (3):
hw/net: Add Smartfusion2 emac block
msf2: Add EMAC block to SmartFusion2 SoC tests/boot_linux_console: Add ethernet test to SmartFusion2
Thomas Huth (1):
target/arm: Make cpu_register() available for other files
hw/core/Makefile.objs | 2 + hw/net/Makefile.objs | 1 + tests/Makefile.include | 1 + include/hw/arm/msf2-soc.h | 2 + include/hw/char/cadence_uart.h | 1 + include/hw/clock.h | 225 +++++++++++++ include/hw/gpio/nrf51_gpio.h | 2 +- include/hw/net/msf2-emac.h | 53 +++ include/hw/qdev-clock.h | 159 +++++++++ include/hw/qdev-core.h | 12 + include/sysemu/device_tree.h | 5 +- target/arm/cpu-qom.h | 9 +- target/arm/helper.h | 27 +- target/arm/translate.h | 5 + device_tree.c | 4 +- hw/acpi/cpu.c | 2 +- hw/arm/msf2-soc.c | 26 +- hw/arm/virt.c | 20 +- hw/arm/xilinx_zynq.c | 57 +++- hw/arm/xlnx-versal.c | 2 + hw/arm/xlnx-zcu102.c | 39 ++- hw/char/cadence_uart.c | 73 +++- hw/core/clock-vmstate.c | 25 ++ hw/core/clock.c | 130 ++++++++ hw/core/qdev-clock.c | 185 +++++++++++ hw/core/qdev.c | 12 + hw/dma/xlnx-zdma.c | 25 +- hw/intc/arm_gicv3_kvm.c | 4 +- hw/misc/zynq_slcr.c | 172 +++++++++- hw/net/cadence_gem.c | 16 +- hw/net/msf2-emac.c | 589 +++++++++++++++++++++++++++++++++ qdev-monitor.c | 9 + target/arm/cpu.c | 25 +- target/arm/cpu64.c | 16 +- target/arm/helper.c | 17 + target/arm/neon_helper.c | 24 -- target/arm/translate-a64.c | 64 +--- target/arm/translate.c | 256 ++++++++++++-- target/arm/vec_helper.c | 25 ++ MAINTAINERS | 2 + docs/devel/clocks.rst | 391 ++++++++++++++++++++++ docs/devel/index.rst | 1 + hw/char/trace-events | 3 + hw/core/trace-events | 7 + tests/acceptance/boot_linux_console.py | 15 +- 45 files changed, 2538 insertions(+), 202 deletions(-) create mode 100644 include/hw/clock.h create mode 100644 include/hw/net/msf2-emac.h create mode 100644 include/hw/qdev-clock.h create mode 100644 hw/core/clock-vmstate.c create mode 100644 hw/core/clock.c create mode 100644 hw/core/qdev-clock.c create mode 100644 hw/net/msf2-emac.c create mode 100644 docs/devel/clocks.rst
[PULL 02/31] dma/xlnx-zdma: Fix descriptor loading (REG) wrt endianness
From: "Edgar E. Iglesias" <[email protected]>
Fix descriptor loading from registers wrt host endianness.
Message-id: [email protected]
--- hw/dma/xlnx-zdma.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
hw/dma/xlnx-zdma.c +10 -4
@@ -299,6 +299,14 @@ static void zdma_put_regaddr64(XlnxZDMA *s, unsigned int basereg, uint64_t addr) s->regs[basereg +1 ] = addr >>32 ; } +static void zdma_load_descriptor_reg (XlnxZDMA *s,unsigned int reg, +XlnxZDMADescr *descr) +{ + descr->addr =zdma_get_regaddr64 (s, reg); + descr->size = s->regs[reg +2 ]; + descr->attr = s->regs[reg +3 ]; +} +static bool zdma_load_descriptor (XlnxZDMA *s,uint64_t addr,XlnxZDMADescr *descr) {
@@ -324,8 +332,7 @@ static void zdma_load_src_descriptor(XlnxZDMA *s)unsigned int ptype =ARRAY_FIELD_EX32 (s->regs,ZDMA_CH_CTRL0 ,POINT_TYPE );if (ptype ==PT_REG ) { -memcpy (&s->dsc_src, &s->regs[R_ZDMA_CH_SRC_DSCR_WORD0 ], -sizeof (s->dsc_src)); +zdma_load_descriptor_reg (s,R_ZDMA_CH_SRC_DSCR_WORD0 , &s->dsc_src);return ; }
@@ -360,8 +367,7 @@ static void zdma_load_dst_descriptor(XlnxZDMA *s)bool dst_type;if (ptype ==PT_REG ) { -memcpy (&s->dsc_dst, &s->regs[R_ZDMA_CH_DST_DSCR_WORD0 ], -sizeof (s->dsc_dst)); +zdma_load_descriptor_reg (s,R_ZDMA_CH_DST_DSCR_WORD0 , &s->dsc_dst);return ; }
Signature · 1 line
2.20.1
[PULL 05/31] Typo: Correct the name of CPU hotplug memory region
In reply to Peter MaydellFrom: Keqian Zhu <[email protected]>
Replace "acpi-mem-hotplug" with "acpi-cpu-hotplug"
Message-id: [email protected]
--- hw/acpi/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/acpi/cpu.c +1 -1
@@ -222,7 +222,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, state->devs[i].arch_id = id_list->cpus[i].arch_id; }memory_region_init_io (&state->ctrl_reg, owner, &cpu_hotplug_ops, state, -"acpi-mem-hotplug" ,ACPI_CPU_HOTPLUG_REG_LEN ); +"acpi-cpu-hotplug" ,ACPI_CPU_HOTPLUG_REG_LEN );memory_region_add_subregion (as, base_addr, &state->ctrl_reg); }
Signature · 1 line
2.20.1
[PULL 01/31] dma/xlnx-zdma: Fix descriptor loading (MEM) wrt endianness
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
Fix descriptor loading from memory wrt host endianness.
Message-id: [email protected]
--- hw/dma/xlnx-zdma.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
hw/dma/xlnx-zdma.c +7 -4
@@ -299,19 +299,22 @@ static void zdma_put_regaddr64(XlnxZDMA *s, unsigned int basereg, uint64_t addr) s->regs[basereg +1 ] = addr >>32 ; } -static bool zdma_load_descriptor (XlnxZDMA *s,uint64_t addr,void *buf) +static bool zdma_load_descriptor (XlnxZDMA *s,uint64_t addr, +XlnxZDMADescr *descr) {/* ZDMA descriptors must be aligned to their own size. */ if (addr %sizeof (XlnxZDMADescr)) {qemu_log_mask (LOG_GUEST_ERROR ,"zdma: unaligned descriptor at %" PRIx64, addr); -memset (buf,0x0 ,sizeof (XlnxZDMADescr)); +memset (descr,0x0 ,sizeof (XlnxZDMADescr)); s->error = true;return false; } -address_space_read (s->dma_as, addr, s->attr, buf,sizeof (XlnxZDMADescr)); + descr->addr =address_space_ldq_le (s->dma_as, addr, s->attr,NULL ); + descr->size =address_space_ldl_le (s->dma_as, addr +8 , s->attr,NULL ); + descr->attr =address_space_ldl_le (s->dma_as, addr +12 , s->attr,NULL );return true; }
@@ -344,7 +347,7 @@ static void zdma_update_descr_addr(XlnxZDMA *s, bool type, }else { addr =zdma_get_regaddr64 (s, basereg); addr +=sizeof (s->dsc_dst); -address_space_read (s->dma_as, addr, s->attr, (void *) &next,8 ); + next =address_space_ldq_le (s->dma_as, addr, s->attr,NULL ); }zdma_put_regaddr64 (s, basereg, next);
Signature · 1 line
2.20.1
[PULL 03/31] nrf51: Fix last GPIO CNF address
In reply to Peter MaydellFrom: Cameron Esfahani <[email protected]>
NRF51_GPIO_REG_CNF_END doesn't actually refer to the start of the last valid CNF register: it's referring to the last byte of the last valid CNF register.
This hasn't been a problem up to now, as current implementation in memory.c turns an unaligned 4-byte read from 0x77f to a single byte read and the qtest only looks at the least-significant byte of the register.
But when running with patches which fix unaligned accesses in memory.c, the qtest breaks.
Considering NRF51 doesn't support unaligned accesses, the simplest fix is to actually set NRF51_GPIO_REG_CNF_END to the start of the last valid CNF register: 0x77c.
Now, qtests work with or without the unaligned access patches.
Message-id: 51b427f06838622da783d38ba56e3630d6d85c60.1586925392.git.dirty@apple.com
--- include/hw/gpio/nrf51_gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/gpio/nrf51_gpio.h +1 -1
@@ -42,7 +42,7 @@#define NRF51_GPIO_REG_DIRSET 0x518#define NRF51_GPIO_REG_DIRCLR 0x51C#define NRF51_GPIO_REG_CNF_START 0x700 -#define NRF51_GPIO_REG_CNF_END 0x77F +#define NRF51_GPIO_REG_CNF_END 0x77C#define NRF51_GPIO_PULLDOWN 1#define NRF51_GPIO_PULLUP 3
Signature · 1 line
2.20.1
[PULL 09/31] hw/core/clock: introduce clock object
In reply to Peter MaydellThis object may be used to represent a clock inside a clock tree.
A clock may be connected to another clock so that it receives update, through a callback, whenever the source/parent clock is updated.
Although only the root clock of a clock tree controls the values (represented as periods) of all clocks in tree, each clock holds a local state containing the current value so that it can be fetched independently. It will allows us to fullfill migration requirements by migrating each clock independently of others.
This is based on the original work of Frederic Konrad.
Message-id: [email protected] [PMM: Use uint64_t rather than unsigned long long in trace events;
the dtrace backend can't handle the latter]
--- hw/core/Makefile.objs | 1 + include/hw/clock.h | 216 ++++++++++++++++++++++++++++++++++++++++++ hw/core/clock.c | 130 +++++++++++++++++++++++++ hw/core/trace-events | 7 ++ 4 files changed, 354 insertions(+) create mode 100644 include/hw/clock.h create mode 100644 hw/core/clock.c
hw/core/Makefile.objs +1 -0
@@ -7,6 +7,7 @@ common-obj-y += hotplug.o common-obj-y += vmstate-if.o # irq.o needed for qdev GPIO handling: common-obj-y += irq.o +common-obj-y += clock.o common-obj-$(CONFIG_SOFTMMU) += reset.o common-obj-$(CONFIG_SOFTMMU) += qdev-fw.o
include/hw/clock.h new file +216 -0
216 lines not on this page · raw message
hw/core/clock.c new file +130 -0
130 lines not on this page · raw message
hw/core/trace-events +7 -0
@@ -27,3 +27,10 @@ resettable_phase_exit_begin(void *obj, const char *objtype, unsigned count, int resettable_phase_exit_exec(void *obj, const char *objtype, int has_method) "obj=%p(%s) method=%d" resettable_phase_exit_end(void *obj, const char *objtype, unsigned count) "obj=%p(%s) count=%d" resettable_transitional_function(void *obj, const char *objtype) "obj=%p(%s)" + +# clock.c +clock_set_source(const char *clk, const char *src) "'%s', src='%s'" +clock_disconnect(const char *clk) "'%s'" +clock_set(const char *clk, uint64_t old, uint64_t new) "'%s', ns=%"PRIu64"->%"PRIu64 +clock_propagate(const char *clk) "'%s'" +clock_update(const char *clk, const char *src, uint64_t val, int cb) "'%s', src='%s', ns=%"PRIu64", cb=%d"
Signature · 1 line
2.20.1
Re: [PULL 09/31] hw/core/clock: introduce clock object
Quoted 6 lines · Peter Maydell
This object may be used to represent a clock inside a clock tree.
A clock may be connected to another clock so that it receives update, through a callback, whenever the source/parent clock is updated.
Quoted 7 lines
Although only the root clock of a clock tree controls the values (represented as periods) of all clocks in tree, each clock holds a local state containing the current value so that it can be fetched independently. It will allows us to fullfill migration requirements by migrating each clock independently of others.
+#define
CLOCK_SECOND(1000000000llu << 32)
It turns out that FreeBSD's time.h defines a CLOCK_SECOND macro, which means this doesn't compile on that platform. I'm going to rename it CLOCK_PERIOD_1SEC; it's only used in include/hw/clock.h so not a big change:
include/hw/clock.h +5 -5
@@ -32,15 +32,15 @@ typedef void ClockCallback(void *opaque);* + at 1Ghz, resolution is ~0.2Hz * + at 10Ghz, resolution is ~20Hz */ -#define CLOCK_SECOND (1000000000llu << 32) +#define CLOCK_PERIOD_1SEC (1000000000llu << 32)/* * macro helpers to convert to hertz / nanosecond */ -#define CLOCK_PERIOD_FROM_NS (ns) ((ns) * (CLOCK_SECOND / 1000000000llu)) -#define CLOCK_PERIOD_TO_NS (per) ((per) / (CLOCK_SECOND / 1000000000llu)) -#define CLOCK_PERIOD_FROM_HZ (hz) (((hz) != 0) ? CLOCK_SECOND / (hz) : 0u) -#define CLOCK_PERIOD_TO_HZ (per) (((per) != 0) ? CLOCK_SECOND / (per) : 0u) +#define CLOCK_PERIOD_FROM_NS (ns) ((ns) * (CLOCK_PERIOD_1SEC / 1000000000llu)) +#define CLOCK_PERIOD_TO_NS (per) ((per) / (CLOCK_PERIOD_1SEC / 1000000000llu)) +#define CLOCK_PERIOD_FROM_HZ (hz) (((hz) != 0) ? CLOCK_PERIOD_1SEC / (hz) : 0u) +#define CLOCK_PERIOD_TO_HZ (per) (((per) != 0) ? CLOCK_PERIOD_1SEC / (per) : 0u)/** * Clock:
thanks
-- PMM
Re: [PULL 09/31] hw/core/clock: introduce clock object
In reply to Peter MaydellHi Damien, Peter,
Quoted 79 lines · Peter Maydell
This object may be used to represent a clock inside a clock tree.
A clock may be connected to another clock so that it receives update, through a callback, whenever the source/parent clock is updated.
Although only the root clock of a clock tree controls the values (represented as periods) of all clocks in tree, each clock holds a local state containing the current value so that it can be fetched independently. It will allows us to fullfill migration requirements by migrating each clock independently of others.
This is based on the original work of Frederic Konrad.
Signed-off-by Damien Hedde <[email protected]>Reviewed-by Alistair Francis <[email protected]>Reviewed-by Edgar E. Iglesias <[email protected]>Message-id: [email protected] [PMM: Use
uint64_trather than unsigned long long in trace events;
the dtrace backend can't handle the latter]Signed-off-by Peter Maydell <[email protected]>--- hw/core/Makefile.objs | 1 + include/hw/clock.h | 216 ++++++++++++++++++++++++++++++++++++++++++ hw/core/clock.c | 130 +++++++++++++++++++++++++ hw/core/trace-events | 7 ++ 4 files changed, 354 insertions(+)create mode 100644
include/hw/clock.h
create mode 100644hw/core/clock.chw/core/Makefile.objs +1
-0@@ -7,6 +7,7 @@ common-obj-y += hotplug.o common-obj-y += vmstate-if.o # irq.o needed for qdev GPIO handling: common-obj-y += irq.o +common-obj-y += clock.o common-obj-$(CONFIG_SOFTMMU) += reset.o common-obj-$(CONFIG_SOFTMMU) += qdev-fw.oinclude/hw/clock.h new file +32
-0@@ -0,0 +1,216 @@ +/* +* Hardware Clocks +* +* Copyright GreenSocs 2016-2020 +* +* Authors: +* Frederic Konrad +* Damien Hedde +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#ifndef QEMU_HW_CLOCK_H +#define QEMU_HW_CLOCK_H + +#include "qom/object.h" +#include "qemu/queue.h" + +#define TYPE_CLOCK "clock" +#define CLOCK (obj) OBJECT_CHECK(Clock, (obj), TYPE_CLOCK) + +typedef void ClockCallback (void *opaque); + +/* +* clock store a value representing the clock's period in 2^-32ns unit. +* It can represent: +* + periods from 2^-32ns up to 4seconds +* + frequency from ~0.25Hz 2e10Ghz +* Resolution of frequency representation decreases with frequency: +* + at 100MHz, resolution is ~2mHz +* + at 1Ghz, resolution is ~0.2Hz
include/hw/clock.h line 42
Quoted 10 lines
include/hw/clock.h new file +10
-0+* + at 10Ghz, resolution is ~20Hz +*/ +#define CLOCK_SECOND (1000000000llu << 32) + +/* +* macro helpers to convert to hertz / nanosecond +*/ +#define CLOCK_PERIOD_FROM_NS (ns) ((ns) * (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_TO_NS (per) ((per) / (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_FROM_HZ (hz) (((hz) != 0) ? CLOCK_SECOND / (hz) : 0u)
I'm having Floating Point Exception using a frequency of 1GHz.
Using frequency >=1GHz we have CLOCK_PERIOD_FROM_HZ(hz) > 0x100000000.
Then CLOCK_PERIOD_TO_NS(0x100000000) = 0.
So for frequency >=1GHz clock_get_ns() returns 0.
Quoted 2 lines
include/hw/clock.h new file +2
-0+#define CLOCK_PERIOD_TO_HZ (per) (((per) != 0) ? CLOCK_SECOND / (per) : 0u) +
[...]
Re: [PULL 09/31] hw/core/clock: introduce clock object
Quoted 96 lines · Philippe Mathieu-Daudé
Hi Damien, Peter,
Quoted 89 lines · Peter Maydell
This object may be used to represent a clock inside a clock tree.
A clock may be connected to another clock so that it receives update, through a callback, whenever the source/parent clock is updated.
Although only the root clock of a clock tree controls the values (represented as periods) of all clocks in tree, each clock holds a local state containing the current value so that it can be fetched independently. It will allows us to fullfill migration requirements by migrating each clock independently of others.
This is based on the original work of Frederic Konrad.
Signed-off-by Damien Hedde <[email protected]>Reviewed-by Alistair Francis <[email protected]>Reviewed-by Edgar E. Iglesias <[email protected]>Message-id: [email protected] [PMM: Use
uint64_trather than unsigned long long in trace events; the dtrace backend can't handle the latter]Signed-off-by Peter Maydell <[email protected]>---
hw/core/Makefile.objs | 1 +
include/hw/clock.h | 216 ++++++++++++++++++++++++++++++++++++++++++ hw/core/clock.c | 130 +++++++++++++++++++++++++ hw/core/trace-events | 7 ++4 files changed, 354 insertions(+)create mode 100644
include/hw/clock.h
create mode 100644hw/core/clock.chw/core/Makefile.objs +0
-0@@ -7,6 +7,7 @@ common-obj-y += hotplug.ocommon-obj-y += vmstate-if.o
# irq.o needed for qdev GPIO handling: common-obj-y += irq.o +common-obj-y += clock.o common-obj-$(CONFIG_SOFTMMU) += reset.o common-obj-$(CONFIG_SOFTMMU) += qdev-fw.oinclude/hw/clock.h new file +10
-0@@ -0,0 +1,216 @@ +/* +* Hardware Clocks +* +* Copyright GreenSocs 2016-2020 +* +* Authors: +* Frederic Konrad +* Damien Hedde +* +* This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */include/hw/clock.h new file +30
-0+ +#ifndef QEMU_HW_CLOCK_H +#define QEMU_HW_CLOCK_H + +#include "qom/object.h" +#include "qemu/queue.h" + +#define TYPE_CLOCK "clock" +#define CLOCK (obj) OBJECT_CHECK(Clock, (obj), TYPE_CLOCK) + +typedef void ClockCallback (void *opaque); + +/* +* clock store a value representing the clock's period in 2^-32ns unit. +* It can represent: +* + periods from 2^-32ns up to 4seconds +* + frequency from ~0.25Hz 2e10Ghz +* Resolution of frequency representation decreases with frequency: +* + at 100MHz, resolution is ~2mHz +* + at 1Ghz, resolution is ~0.2Hz +* + at 10Ghz, resolution is ~20Hz +*/ +#define CLOCK_SECOND (1000000000llu << 32) + +/* +* macro helpers to convert to hertz / nanosecond +*/ +#define CLOCK_PERIOD_FROM_NS (ns) ((ns) * (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_TO_NS (per) ((per) / (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_FROM_HZ (hz) (((hz) != 0) ? CLOCK_SECOND / (hz) :Quoted 1 line
0u)
I'm having Floating Point Exception using a frequency of 1GHz.
Quoted 5 lines
Using frequency >=1GHz we have
CLOCK_PERIOD_FROM_HZ(hz)>0x100000000.Then
CLOCK_PERIOD_TO_NS(0x100000000)= 0.So for frequency >=1GHz
clock_get_ns()returns 0.
So Peter suggested on IRC to rewrite the code consuming this API to avoid reaching this limit :)
Still some assert would help other developers triggering the same issue to quicker figure how to bypass the problem.
Quoted 6 lines
Quoted 4 lines
+#define
CLOCK_PERIOD_TO_HZ(per)(((per) != 0) ?CLOCK_SECOND/ (per) : 0u)
+[...]
Re: [PULL 09/31] hw/core/clock: introduce clock object
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé
Hi Damien, Peter,
Quoted 7 lines
include/hw/clock.h new file +6
-0+/* +* macro helpers to convert to hertz / nanosecond +*/ +#define CLOCK_PERIOD_FROM_NS (ns) ((ns) * (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_TO_NS (per) ((per) / (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_FROM_HZ (hz) (((hz) != 0) ? CLOCK_SECOND / (hz) :0u)
I'm having Floating Point Exception using a frequency of 1GHz.
Using frequency >=1GHz we have
CLOCK_PERIOD_FROM_HZ(hz)>0x100000000.Then
CLOCK_PERIOD_TO_NS(0x100000000)= 0.
Quoted 7 lines
Quoted 1 line
So for frequency >=1GHz
clock_get_ns()returns 0.So Peter suggested on IRC to rewrite the code consuming this API to avoid reaching this limit :)
Still some assert would help other developers triggering the same issue to quicker figure how to bypass the problem.
The fundamental problem here is that if you have a 2GHz clock then it is just not possible to have an API which says "give me the period of this clock in nanoseconds as an integer".
Even for clocks which have lower frequencies, there is still a rounding/accuracy problem when converting to a nanoseconds count. I think these macros and the functions that wrap them are in retrospect a mistake, and we should replace them with other APIs that allow calculations which can avoid the rounding problem (eg if what you need is "how many nanoseconds is it until 5000 ticks have expired" we would need an API for that, rather than trying to calculate it as 5000 * nanoseconds_per_tick).
It looks like currently the only uses of CLOCK_PERIOD_TO_NS() and clock_get_ns() are:
* some tracepoints in the clock code itself
* mips_cp0_period_set(), which does:
env->cp0_count_ns = cpu->cp0_count_rate
* clock_get_ns(MIPS_CPU(cpu)->clock);
so I think it is trying to calculate "nanoseconds for X ticks of the clock".
CLOCK_PERIOD_TO_HZ() and clock_get_hz() are used by:
* the qdev_print() code that prints a human-readable description of the clock
* hw/char/cadence_uart.c and hw/char/ibex_uart.c code that calculates a baud rate given the input clock
CLOCK_PERIOD_FROM_HZ and CLOCK_PERIOD_FROM_NS are used only in the clock_update*() and clock_set*() functions. I think those should all be OK, because they're just setting the period of the clock (possibly propagating it to connected clocks), and we can assume the caller uses whatever unit they naturally have available as the accurate way to set the clock.
So that suggests to me that we should look at designing APIs for:
* "give me the time in nanoseconds for X ticks of this clock"
* "give me a human-readable string describing this clock" for the qdev_print() monitor output
and we should adjust the clock_set and clock_update tracepoints to trace the raw period values (perhaps with an extra "approx %"PRIu64" ns" for the benefit of humans reading traces). Then we can delete CLOCK_PERIOD_TO_NS() and clock_get_ns().
Not sure about what the UART code should be doing. Given that it's basically calculating baud rates it does eventually want to get a frequency in hz but maybe we should arrange for the frequency-division part to happen before we convert from clock-period to hz rather than after.
thanks
-- PMM
Re: [PULL 09/31] hw/core/clock: introduce clock object
Quoted 66 lines · Peter Maydell
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé
Hi Damien, Peter,
Quoted 7 lines
include/hw/clock.h new file +6
-0+/* +* macro helpers to convert to hertz / nanosecond +*/ +#define CLOCK_PERIOD_FROM_NS (ns) ((ns) * (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_TO_NS (per) ((per) / (CLOCK_SECOND / 1000000000llu)) +#define CLOCK_PERIOD_FROM_HZ (hz) (((hz) != 0) ? CLOCK_SECOND / (hz) :0u)
I'm having Floating Point Exception using a frequency of 1GHz.
Using frequency >=1GHz we have
CLOCK_PERIOD_FROM_HZ(hz)>0x100000000.Then
CLOCK_PERIOD_TO_NS(0x100000000)= 0.Quoted 7 lines
Quoted 1 line
So for frequency >=1GHz
clock_get_ns()returns 0.So Peter suggested on IRC to rewrite the code consuming this API to avoid reaching this limit :)
Still some assert would help other developers triggering the same issue to quicker figure how to bypass the problem.
The fundamental problem here is that if you have a 2GHz clock then it is just not possible to have an API which says "give me the period of this clock in nanoseconds as an integer".
Even for clocks which have lower frequencies, there is still a rounding/accuracy problem when converting to a nanoseconds count. I think these macros and the functions that wrap them are in retrospect a mistake, and we should replace them with other APIs that allow calculations which can avoid the rounding problem (eg if what you need is "how many nanoseconds is it until 5000 ticks have expired" we would need an API for that, rather than trying to calculate it as 5000 *
nanoseconds_per_tick).It looks like currently the only uses of
CLOCK_PERIOD_TO_NS()andclock_get_ns()are:
* some tracepoints in the clock code itself
*mips_cp0_period_set(), which does:
env->cp0_count_ns=cpu->cp0_count_rate
* clock_get_ns(MIPS_CPU(cpu)->clock);
so I think it is trying to calculate "nanoseconds for X ticks of the clock".
CLOCK_PERIOD_TO_HZ()andclock_get_hz()are used by:
* theqdev_print()code that prints a human-readable description of the clock
*hw/char/cadence_uart.candhw/char/ibex_uart.ccode that calculates a baud rate given the input clock
CLOCK_PERIOD_FROM_HZandCLOCK_PERIOD_FROM_NSare used only in the clock_update*() and clock_set*() functions. I think those should all be OK, because they're just setting the period of the clock (possibly propagating it to connected clocks), and we can assume the caller uses whatever unit they naturally have available as the accurate way to set the clock.
Quoted 5 lines
So that suggests to me that we should look at designing APIs for:
* "give me the time in nanoseconds for X ticks of this clock"
* "give me a human-readable string describing this clock" for theqdev_print()monitor output
Half of it is commit 709616c713f
("util/cutils: Introduce freq_to_str() to display Hertz units")
Other half on the list:
https://www.mail-archive.com/[email protected]/msg749603.html
Quoted 15 lines
and we should adjust the
clock_setandclock_updatetracepoints to trace the raw period values (perhaps with an extra "approx %"PRIu64" ns" for the benefit of humans reading traces). Then we can deleteCLOCK_PERIOD_TO_NS()andclock_get_ns().Not sure about what the UART code should be doing. Given that it's basically calculating baud rates it does eventually want to get a frequency in hz but maybe we should arrange for the frequency-division part to happen before we convert from clock-period to hz rather than after.
thanks
-- PMM
[PULL 06/31] hw/net: Add Smartfusion2 emac block
In reply to Peter MaydellFrom: Subbaraya Sundeep <[email protected]>
Modelled Ethernet MAC of Smartfusion2 SoC.
Micrel KSZ8051 PHY is present on Emcraft's
SOM kit hence same PHY is emulated.
Message-id: [email protected]
--- hw/net/Makefile.objs | 1 + include/hw/net/msf2-emac.h | 53 ++++ hw/net/msf2-emac.c | 589 +++++++++++++++++++++++++++++++++++++ MAINTAINERS | 2 + 4 files changed, 645 insertions(+) create mode 100644 include/hw/net/msf2-emac.h create mode 100644 hw/net/msf2-emac.c
hw/net/Makefile.objs +1 -0
@@ -55,3 +55,4 @@ common-obj-$(CONFIG_ROCKER) += rocker/rocker.o rocker/rocker_fp.o \ obj-$(call lnot,$(CONFIG_ROCKER)) += rocker/qmp-norocker.o common-obj-$(CONFIG_CAN_BUS) += can/ +common-obj-$(CONFIG_MSF2) += msf2-emac.o
include/hw/net/msf2-emac.h new file +53 -0
53 lines not on this page · raw message
hw/net/msf2-emac.c new file +589 -0
589 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -919,6 +919,8 @@ F: include/hw/arm/msf2-soc.h F: include/hw/misc/msf2-sysreg.h F: include/hw/timer/mss-timer.h F: include/hw/ssi/mss-spi.h +F: hw/net/msf2-emac.c +F: include/hw/net/msf2-emac.h Emcraft M2S-FG484 M: Subbaraya Sundeep <[email protected]>
Signature · 1 line
2.20.1
[PULL 04/31] bugfix: Use gicr_typer in arm_gicv3_icc_reset
In reply to Peter MaydellFrom: Keqian Zhu <[email protected]>
The KVM_VGIC_ATTR macro expect the second parameter as gicr_typer, of which high 32bit is constructed by mp_affinity. For most case, the high 32bit of mp_affinity is zero, so it will always access the ICC_CTLR_EL1 of CPU0.
Message-id: [email protected]
--- hw/intc/arm_gicv3_kvm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/intc/arm_gicv3_kvm.c +1 -3
@@ -658,13 +658,11 @@ static void kvm_arm_gicv3_get(GICv3State *s)static void arm_gicv3_icc_reset (CPUARMState *env,const ARMCPRegInfo *ri) { -ARMCPU *cpu;GICv3State *s;GICv3CPUState *c; c = (GICv3CPUState *)env->gicv3state; s = c->gic; - cpu =ARM_CPU (c->cpu); c->icc_pmr_el1 =0 ; c->icc_bpr[GICV3_G0 ] =GIC_MIN_BPR ;
@@ -681,7 +679,7 @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)/* Initialize to actual HW supported configuration */ kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS , -KVM_VGIC_ATTR (ICC_CTLR_EL1 , cpu->mp_affinity), +KVM_VGIC_ATTR (ICC_CTLR_EL1 , c->gicr_typer), &c->icc_ctlr_el1[GICV3_NS ], false, &error_abort); c->icc_ctlr_el1[GICV3_S ] = c->icc_ctlr_el1[GICV3_NS ];
Signature · 1 line
2.20.1
[PULL 07/31] msf2: Add EMAC block to SmartFusion2 SoC
In reply to Peter MaydellFrom: Subbaraya Sundeep <[email protected]>
With SmartFusion2 Ethernet MAC model in
place this patch adds the same to SoC.
Message-id: [email protected]
--- include/hw/arm/msf2-soc.h | 2 ++ hw/arm/msf2-soc.c | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-)
include/hw/arm/msf2-soc.h +2 -0
@@ -29,6 +29,7 @@#include "hw/timer/mss-timer.h" #include "hw/misc/msf2-sysreg.h" #include "hw/ssi/mss-spi.h" +#include "hw/net/msf2-emac.h" #define TYPE_MSF2_SOC "msf2-soc"#define MSF2_SOC (obj) OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC)
@@ -62,6 +63,7 @@ typedef struct MSF2State {MSF2SysregState sysreg;MSSTimerState timer;MSSSpiState spi[MSF2_NUM_SPIS ]; + MSF2EmacState emac; } MSF2State;#endif
hw/arm/msf2-soc.c +24 -2
@@ -1,7 +1,7 @@/* * SmartFusion2 SoC emulation. * -* Copyright (c) 2017 Subbaraya Sundeep <[email protected]> +* Copyright (c) 2017-2020 Subbaraya Sundeep <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal
@@ -35,11 +35,14 @@#define MSF2_TIMER_BASE 0x40004000#define MSF2_SYSREG_BASE 0x40038000 +#define MSF2_EMAC_BASE 0x40041000#define ENVM_BASE_ADDRESS 0x60000000#define SRAM_BASE_ADDRESS 0x20000000 +#define MSF2_EMAC_IRQ 12 +#define MSF2_ENVM_MAX_SIZE (512 * KiB)/*
@@ -81,6 +84,13 @@ static void m2sxxx_soc_initfn(Object *obj)sysbus_init_child_obj (obj,"spi[*]" , &s->spi[i],sizeof (s->spi[i]),TYPE_MSS_SPI ); } + +sysbus_init_child_obj (obj,"emac" , &s->emac,sizeof (s->emac), +TYPE_MSS_EMAC ); +if (nd_table[0 ].used) { +qemu_check_nic_model (&nd_table[0 ],TYPE_MSS_EMAC ); +qdev_set_nic_properties (DEVICE (&s->emac), &nd_table[0 ]); + } }static void m2sxxx_soc_realize (DeviceState *dev_soc,Error **errp)
@@ -192,6 +202,19 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)g_free (bus_name); } + dev =DEVICE (&s->emac); +object_property_set_link (OBJECT (&s->emac),OBJECT (get_system_memory ()), +"ahb-bus" , &error_abort); +object_property_set_bool (OBJECT (&s->emac), true,"realized" , &err); +if (err !=NULL ) { +error_propagate (errp, err); +return ; + } + busdev =SYS_BUS_DEVICE (dev); +sysbus_mmio_map (busdev,0 ,MSF2_EMAC_BASE ); +sysbus_connect_irq (busdev,0 , +qdev_get_gpio_in (armv7m,MSF2_EMAC_IRQ )); +/* Below devices are not modelled yet. */ create_unimplemented_device ("i2c_0" ,0x40002000 ,0x1000 );create_unimplemented_device ("dma" ,0x40003000 ,0x1000 );
@@ -202,7 +225,6 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)create_unimplemented_device ("can" ,0x40015000 ,0x1000 );create_unimplemented_device ("rtc" ,0x40017000 ,0x1000 );create_unimplemented_device ("apb_config" ,0x40020000 ,0x10000 ); -create_unimplemented_device ("emac" ,0x40041000 ,0x1000 );create_unimplemented_device ("usb" ,0x40043000 ,0x1000 ); }
Signature · 1 line
2.20.1
[PULL 13/31] docs/clocks: add device's clock documentation
In reply to Peter MaydellAdd the documentation about the clock inputs and outputs in devices.
This is based on the original work of Frederic Konrad.
Message-id: [email protected] [PMM: Editing pass for minor grammar, style and Sphinx
formatting fixes]
--- docs/devel/clocks.rst | 391 ++++++++++++++++++++++++++++++++++++++++++ docs/devel/index.rst | 1 + 2 files changed, 392 insertions(+) create mode 100644 docs/devel/clocks.rst
docs/devel/clocks.rst new file +391 -0
@@ -0,0 +1,391 @@ +Modelling a clock tree in QEMU +============================== + +What are clocks? +---------------- + +Clocks are QOM objects developed for the purpose of modelling the +distribution of clocks in QEMU. + +They allow us to model the clock distribution of a platform and detect +configuration errors in the clock tree such as badly configured PLL, clock +source selection or disabled clock. + +The object is *Clock* and its QOM name is ``clock`` (in C code, the macro +``TYPE_CLOCK``). + +Clocks are typically used with devices where they are used to model inputs +and outputs. They are created in a similar way to GPIOs. Inputs and outputs +of different devices can be connected together. + +In these cases a Clock object is a child of a Device object, but this +is not a requirement. Clocks can be independent of devices. For +example it is possible to create a clock outside of any device to +model the main clock source of a machine. + +Here is an example of clocks:: + + +---------+ +----------------------+ +--------------+ + | Clock 1 | | Device B | | Device C | + | | | +-------+ +-------+ | | +-------+ | + | |>>-+-->>|Clock 2| |Clock 3|>>--->>|Clock 6| | + +---------+ | | | (in) | | (out) | | | | (in) | | + | | +-------+ +-------+ | | +-------+ | + | | +-------+ | +--------------+ + | | |Clock 4|>> + | | | (out) | | +--------------+ + | | +-------+ | | Device D | + | | +-------+ | | +-------+ | + | | |Clock 5|>>--->>|Clock 7| | + | | | (out) | | | | (in) | | + | | +-------+ | | +-------+ | + | +----------------------+ | | + | | +-------+ | + +----------------------------->>|Clock 8| | + | | (in) | | + | +-------+ | + +--------------+ + +Clocks are defined in the ``include/hw/clock.h`` header and device +related functions are defined in the ``include/hw/qdev-clock.h`` +header. + +The clock state +--------------- + +The state of a clock is its period; it is stored as an integer +representing it in units of 2 :sup:`-32` ns. The special value of 0 is used to +represent the clock being inactive or gated. The clocks do not model +the signal itself (pin toggling) or other properties such as the duty +cycle. + +All clocks contain this state: outputs as well as inputs. This allows +the current period of a clock to be fetched at any time. When a clock +is updated, the value is immediately propagated to all connected +clocks in the tree. + +To ease interaction with clocks, helpers with a unit suffix are defined for +every clock state setter or getter. The suffixes are: + +- ``_ns`` for handling periods in nanoseconds +- ``_hz`` for handling frequencies in hertz + +The 0 period value is converted to 0 in hertz and vice versa. 0 always means +that the clock is disabled. + +Adding a new clock +------------------ + +Adding clocks to a device must be done during the init method of the Device +instance. + +To add an input clock to a device, the function ``qdev_init_clock_in()`` +must be used. It takes the name, a callback and an opaque parameter +for the callback (this will be explained in a following section). +Output is simpler; only the name is required. Typically:: + + qdev_init_clock_in(DEVICE(dev), "clk_in", clk_in_callback, dev); + qdev_init_clock_out(DEVICE(dev), "clk_out"); + +Both functions return the created Clock pointer, which should be saved in the +device's state structure for further use. + +These objects will be automatically deleted by the QOM reference mechanism. + +Note that it is possible to create a static array describing clock inputs and +outputs. The function ``qdev_init_clocks()`` must be called with the array as +parameter to initialize the clocks: it has the same behaviour as calling the +``qdev_init_clock_in/out()`` for each clock in the array. To ease the array +construction, some macros are defined in ``include/hw/qdev-clock.h``. +As an example, the following creates 2 clocks to a device: one input and one +output. + +.. code-block:: c + + /* device structure containing pointers to the clock objects */ + typedef struct MyDeviceState { + DeviceState parent_obj; + Clock *clk_in; + Clock *clk_out; + } MyDeviceState; + + /* + * callback for the input clock (see "Callback on input clock + * change" section below for more information). + */ + static void clk_in_callback(void *opaque); + + /* + * static array describing clocks: + * + a clock input named "clk_in", whose pointer is stored in + * the clk_in field of a MyDeviceState structure with callback + * clk_in_callback. + * + a clock output named "clk_out" whose pointer is stored in + * the clk_out field of a MyDeviceState structure. + */ + static const ClockPortInitArray mydev_clocks = { + QDEV_CLOCK_IN(MyDeviceState, clk_in, clk_in_callback), + QDEV_CLOCK_OUT(MyDeviceState, clk_out), + QDEV_CLOCK_END + }; + + /* device initialization function */ + static void mydev_init(Object *obj) + { + /* cast to MyDeviceState */ + MyDeviceState *mydev = MYDEVICE(obj); + /* create and fill the pointer fields in the MyDeviceState */ + qdev_init_clocks(mydev, mydev_clocks); + [...] + } + +An alternative way to create a clock is to simply call +``object_new(TYPE_CLOCK)``. In that case the clock will neither be an +input nor an output of a device. After the whole QOM hierarchy of the +clock has been set ``clock_setup_canonical_path()`` should be called. + +At creation, the period of the clock is 0: the clock is disabled. You can +change it using ``clock_set_ns()`` or ``clock_set_hz()``. + +Note that if you are creating a clock with a fixed period which will never +change (for example the main clock source of a board), then you'll have +nothing else to do. This value will be propagated to other clocks when +connecting the clocks together and devices will fetch the right value during +the first reset. + +Retrieving clocks from a device +------------------------------- + +``qdev_get_clock_in()`` and ``dev_get_clock_out()`` are available to +get the clock inputs or outputs of a device. For example: + +.. code-block:: c + + Clock *clk = qdev_get_clock_in(DEVICE(mydev), "clk_in"); + +or: + +.. code-block:: c + + Clock *clk = qdev_get_clock_out(DEVICE(mydev), "clk_out"); + +Connecting two clocks together +------------------------------ + +To connect two clocks together, use the ``clock_set_source()`` function. +Given two clocks ``clk1``, and ``clk2``, ``clock_set_source(clk2, clk1);`` +configures ``clk2`` to follow the ``clk1`` period changes. Every time ``clk1`` +is updated, ``clk2`` will be updated too. + +When connecting clock between devices, prefer using the +``qdev_connect_clock_in()`` function to set the source of an input +device clock. For example, to connect the input clock ``clk2`` of +``devB`` to the output clock ``clk1`` of ``devA``, do: + +.. code-block:: c + + qdev_connect_clock_in(devB, "clk2", qdev_get_clock_out(devA, "clk1")) + +We used ``qdev_get_clock_out()`` above, but any clock can drive an +input clock, even another input clock. The following diagram shows +some examples of connections. Note also that a clock can drive several +other clocks. + +:: + + +------------+ +--------------------------------------------------+ + | Device A | | Device B | + | | | +---------------------+ | + | | | | Device C | | + | +-------+ | | +-------+ | +-------+ +-------+ | +-------+ | + | |Clock 1|>>-->>|Clock 2|>>+-->>|Clock 3| |Clock 5|>>>>|Clock 6|>> + | | (out) | | | | (in) | | | | (in) | | (out) | | | (out) | | + | +-------+ | | +-------+ | | +-------+ +-------+ | +-------+ | + +------------+ | | +---------------------+ | + | | | + | | +--------------+ | + | | | Device D | | + | | | +-------+ | | + | +-->>|Clock 4| | | + | | | (in) | | | + | | +-------+ | | + | +--------------+ | + +--------------------------------------------------+ + +In the above example, when *Clock 1* is updated by *Device A*, three +clocks get the new clock period value: *Clock 2*, *Clock 3* and *Clock 4*. + +It is not possible to disconnect a clock or to change the clock connection +after it is connected. + +Unconnected input clocks +------------------------ + +A newly created input clock is disabled (period of 0). This means the +clock will be considered as disabled until the period is updated. If +the clock remains unconnected it will always keep its initial value +of 0. If this is not the desired behaviour, ``clock_set()``, +``clock_set_ns()`` or ``clock_set_hz()`` should be called on the Clock +object during device instance init. For example: + +.. code-block:: c + + clk = qdev_init_clock_in(DEVICE(dev), "clk-in", clk_in_callback, + dev); + /* set initial value to 10ns / 100MHz */ + clock_set_ns(clk, 10); + +Fetching clock frequency/period +------------------------------- + +To get the current state of a clock, use the functions ``clock_get()``, +``clock_get_ns()`` or ``clock_get_hz()``. + +It is also possible to register a callback on clock frequency changes. +Here is an example: + +.. code-block:: c + + void clock_callback(void *opaque) { + MyDeviceState *s = (MyDeviceState *) opaque; + /* + * 'opaque' is the argument passed to qdev_init_clock_in(); + * usually this will be the device state pointer. + */ + + /* do something with the new period */ + fprintf(stdout, "device new period is %" PRIu64 "ns\n", + clock_get_ns(dev->my_clk_input)); + } + +Changing a clock period +----------------------- + +A device can change its outputs using the ``clock_update()``, +``clock_update_ns()`` or ``clock_update_hz()`` function. It will trigger +updates on every connected input. + +For example, let's say that we have an output clock *clkout* and we +have a pointer to it in the device state because we did the following +in init phase: + +.. code-block:: c + + dev->clkout = qdev_init_clock_out(DEVICE(dev), "clkout"); + +Then at any time (apart from the cases listed below), it is possible to +change the clock value by doing: + +.. code-block:: c + + clock_update_hz(dev->clkout, 1000 * 1000 * 1000); /* 1GHz */ + +Because updating a clock may trigger any side effects through +connected clocks and their callbacks, this operation must be done +while holding the qemu io lock. + +For the same reason, one can update clocks only when it is allowed to have +side effects on other objects. In consequence, it is forbidden: + +* during migration, +* and in the enter phase of reset. + +Note that calling ``clock_update[_ns|_hz]()`` is equivalent to calling +``clock_set[_ns|_hz]()`` (with the same arguments) then +``clock_propagate()`` on the clock. Thus, setting the clock value can +be separated from triggering the side-effects. This is often required +to factorize code to handle reset and migration in devices. + +Aliasing clocks +--------------- + +Sometimes, one needs to forward, or inherit, a clock from another +device. Typically, when doing device composition, a device might +expose a sub-device's clock without interfering with it. The function +``qdev_alias_clock()`` can be used to achieve this behaviour. Note +that it is possible to expose the clock under a different name. +``qdev_alias_clock()`` works for both input and output clocks. + +For example, if device B is a child of device A, +``device_a_instance_init()`` may do something like this: + +.. code-block:: c + + void device_a_instance_init(Object *obj) + { + AState *A = DEVICE_A(obj); + BState *B; + /* create object B as child of A */ + [...] + qdev_alias_clock(B, "clk", A, "b_clk"); + /* + * Now A has a clock "b_clk" which is an alias to + * the clock "clk" of its child B. + */ + } + +This function does not return any clock object. The new clock has the +same direction (input or output) as the original one. This function +only adds a link to the existing clock. In the above example, object B +remains the only object allowed to use the clock and device A must not +try to change the clock period or set a callback to the clock. This +diagram describes the example with an input clock:: + + +--------------------------+ + | Device A | + | +--------------+ | + | | Device B | | + | | +-------+ | | + >>"b_clk">>>| "clk" | | | + | (in) | | (in) | | | + | | +-------+ | | + | +--------------+ | + +--------------------------+ + +Migration +--------- + +Clock state is not migrated automatically. Every device must handle its +clock migration. Alias clocks must not be migrated. + +To ensure clock states are restored correctly during migration, there +are two solutions. + +Clock states can be migrated by adding an entry into the device +vmstate description. You should use the ``VMSTATE_CLOCK`` macro for this. +This is typically used to migrate an input clock state. For example: + +.. code-block:: c + + MyDeviceState { + DeviceState parent_obj; + [...] /* some fields */ + Clock *clk; + }; + + VMStateDescription my_device_vmstate = { + .name = "my_device", + .fields = (VMStateField[]) { + [...], /* other migrated fields */ + VMSTATE_CLOCK(clk, MyDeviceState), + VMSTATE_END_OF_LIST() + } + }; + +The second solution is to restore the clock state using information already +at our disposal. This can be used to restore output clock states using the +device state. The functions ``clock_set[_ns|_hz]()`` can be used during the +``post_load()`` migration callback. + +When adding clock support to an existing device, if you care about +migration compatibility you will need to be careful, as simply adding +a ``VMSTATE_CLOCK()`` line will break compatibility. Instead, you can +put the ``VMSTATE_CLOCK()`` line into a vmstate subsection with a +suitable ``needed`` function, and use ``clock_set()`` in a +``pre_load()`` function to set the default value that will be used if +the source virtual machine in the migration does not send the clock +state. + +Care should be taken not to use ``clock_update[_ns|_hz]()`` or +``clock_propagate()`` during the whole migration procedure because it +will trigger side effects to other devices in an unknown state.
docs/devel/index.rst +1 -0
@@ -27,3 +27,4 @@ Contents: bitops reset s390-dasd-ipl + clocks
Signature · 1 line
2.20.1
[PULL 16/31] hw/arm/xilinx_zynq: connect uart clocks to slcr
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
Add the connection between the slcr's output clocks and the uarts inputs.
Also add the main board clock 'ps_clk', which is hard-coded to 33.33MHz (the default frequency). This clock is used to feed the slcr's input clock.
Message-id: [email protected]
--- hw/arm/xilinx_zynq.c | 57 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 8 deletions(-)
hw/arm/xilinx_zynq.c +49 -8
@@ -35,6 +35,15 @@#include "hw/char/cadence_uart.h" #include "hw/net/cadence_gem.h" #include "hw/cpu/a9mpcore.h" +#include "hw/qdev-clock.h" +#include "sysemu/reset.h" + +#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") +#define ZYNQ_MACHINE (obj) \ + OBJECT_CHECK(ZynqMachineState, (obj), TYPE_ZYNQ_MACHINE) + +/* board base frequency: 33.333333 MHz */ +#define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3)#define NUM_SPI_FLASHES 4#define NUM_QSPI_FLASHES 2
@@ -75,6 +84,11 @@ static const int dma_irqs[8] = {0xe3401000 +ARMV7_IMM16 (extract32 ((val),16 ,16 )),/* movt r1 ... */ \0xe5801000 + (addr ) +typedef struct ZynqMachineState { +MachineState parent; +Clock *ps_clk; +} ZynqMachineState; +static void zynq_write_board_setup (ARMCPU *cpu,const struct arm_boot_info *info) {
@@ -159,10 +173,11 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,static void zynq_init (MachineState *machine) { +ZynqMachineState *zynq_machine =ZYNQ_MACHINE (machine);ARMCPU *cpu;MemoryRegion *address_space_mem =get_system_memory ();MemoryRegion *ocm_ram =g_new (MemoryRegion,1 ); -DeviceState *dev; +DeviceState *dev, *slcr;SysBusDevice *busdev;qemu_irq pic[64 ];int n;
@@ -206,9 +221,18 @@ static void zynq_init(MachineState *machine)1 ,0x0066 ,0x0022 ,0x0000 ,0x0000 ,0x0555 ,0x2aa , 0); - dev =qdev_create (NULL ,"xilinx,zynq_slcr" ); -qdev_init_nofail (dev); -sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,0xF8000000 ); +/* Create slcr, keep a pointer to connect clocks */ + slcr =qdev_create (NULL ,"xilinx,zynq_slcr" ); +qdev_init_nofail (slcr); +sysbus_mmio_map (SYS_BUS_DEVICE (slcr),0 ,0xF8000000 ); + +/* Create the main clock source, and feed slcr with it */ + zynq_machine->ps_clk =CLOCK (object_new (TYPE_CLOCK )); +object_property_add_child (OBJECT (zynq_machine),"ps_clk" , +OBJECT (zynq_machine->ps_clk), &error_abort); +object_unref (OBJECT (zynq_machine->ps_clk)); +clock_set_hz (zynq_machine->ps_clk,PS_CLK_FREQUENCY ); +qdev_connect_clock_in (slcr,"ps_clk" , zynq_machine->ps_clk); dev =qdev_create (NULL ,TYPE_A9MPCORE_PRIV );qdev_prop_set_uint32 (dev,"num-cpu" ,1 );
@@ -229,8 +253,12 @@ static void zynq_init(MachineState *machine)sysbus_create_simple (TYPE_CHIPIDEA ,0xE0002000 , pic[53 -IRQ_OFFSET ]);sysbus_create_simple (TYPE_CHIPIDEA ,0xE0003000 , pic[76 -IRQ_OFFSET ]); -cadence_uart_create (0xE0000000 , pic[59 -IRQ_OFFSET ],serial_hd (0 )); -cadence_uart_create (0xE0001000 , pic[82 -IRQ_OFFSET ],serial_hd (1 )); + dev =cadence_uart_create (0xE0000000 , pic[59 -IRQ_OFFSET ],serial_hd (0 )); +qdev_connect_clock_in (dev,"refclk" , +qdev_get_clock_out (slcr,"uart0_ref_clk" )); + dev =cadence_uart_create (0xE0001000 , pic[82 -IRQ_OFFSET ],serial_hd (1 )); +qdev_connect_clock_in (dev,"refclk" , +qdev_get_clock_out (slcr,"uart1_ref_clk" ));sysbus_create_varargs ("cadence_ttc" ,0xF8001000 , pic[42 -IRQ_OFFSET ], pic[43 -IRQ_OFFSET ], pic[44 -IRQ_OFFSET ],NULL );
@@ -308,8 +336,9 @@ static void zynq_init(MachineState *machine)arm_load_kernel (ARM_CPU (first_cpu), machine, &zynq_binfo); } -static void zynq_machine_init (MachineClass *mc) +static void zynq_machine_class_init (ObjectClass *oc,void *data) { +MachineClass *mc =MACHINE_CLASS (oc); mc->desc ="Xilinx Zynq Platform Baseboard for Cortex-A9" ; mc->init = zynq_init; mc->max_cpus =1 ;
@@ -319,4 +348,16 @@ static void zynq_machine_init(MachineClass *mc) mc->default_ram_id ="zynq.ext_ram" ; } -DEFINE_MACHINE ("xilinx-zynq-a9" , zynq_machine_init) +static const TypeInfo zynq_machine_type = { + .name =TYPE_ZYNQ_MACHINE , + .parent =TYPE_MACHINE , + .class_init = zynq_machine_class_init, + .instance_size =sizeof (ZynqMachineState), +}; + +static void zynq_machine_register_types (void ) +{ +type_register_static (&zynq_machine_type); +} + +type_init (zynq_machine_register_types)
Signature · 1 line
2.20.1
[PULL 10/31] hw/core/clock-vmstate: define a vmstate entry for clock state
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
Message-id: [email protected]
--- hw/core/Makefile.objs | 1 + include/hw/clock.h | 9 +++++++++ hw/core/clock-vmstate.c | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 hw/core/clock-vmstate.c
hw/core/Makefile.objs +1 -0
@@ -21,6 +21,7 @@ common-obj-$(CONFIG_SOFTMMU) += null-machine.o common-obj-$(CONFIG_SOFTMMU) += loader.o common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o common-obj-$(CONFIG_SOFTMMU) += numa.o +common-obj-$(CONFIG_SOFTMMU) += clock-vmstate.o obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
include/hw/clock.h +9 -0
@@ -74,6 +74,15 @@ struct Clock {QLIST_ENTRY (Clock) sibling; }; +/* +* vmstate description entry to be added in device vmsd. +*/ +extern const VMStateDescription vmstate_clock; +#define VMSTATE_CLOCK (field, state) \ + VMSTATE_CLOCK_V(field, state, 0) +#define VMSTATE_CLOCK_V (field, state, version) \ + VMSTATE_STRUCT_POINTER_V(field, state, version, vmstate_clock, Clock) +/** * clock_setup_canonical_path: * @clk: clock
hw/core/clock-vmstate.c new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Clock migration structure +* +* Copyright GreenSocs 2019-2020 +* +* Authors: +* Damien Hedde +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#include "qemu/osdep.h" +#include "migration/vmstate.h" +#include "hw/clock.h" + +const VMStateDescription vmstate_clock = { + .name ="clock" , + .version_id =0 , + .minimum_version_id =0 , + .fields = (VMStateField []) { +VMSTATE_UINT64 (period, Clock), +VMSTATE_END_OF_LIST () + } +};
Signature · 1 line
2.20.1
[PULL 08/31] tests/boot_linux_console: Add ethernet test to SmartFusion2
In reply to Peter MaydellFrom: Subbaraya Sundeep <[email protected]>
In addition to simple serial test this patch uses ping to test the ethernet block modelled in SmartFusion2 SoC.
Message-id: [email protected]
--- tests/acceptance/boot_linux_console.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
tests/acceptance/boot_linux_console.py +10 -5
@@ -336,13 +336,13 @@ class BootLinuxConsole(Test): """ uboot_url = ('https://raw.githubusercontent.com/' 'Subbaraya-Sundeep/qemu-test-binaries/' - 'fa030bd77a014a0b8e360d3b7011df89283a2f0b/u-boot') - uboot_hash = 'abba5d9c24cdd2d49cdc2a8aa92976cf20737eff' + 'fe371d32e50ca682391e1e70ab98c2942aeffb01/u-boot') + uboot_hash = 'cbb8cbab970f594bf6523b9855be209c08374ae2' uboot_path = self.fetch_asset(uboot_url, asset_hash=uboot_hash) spi_url = ('https://raw.githubusercontent.com/' 'Subbaraya-Sundeep/qemu-test-binaries/' - 'fa030bd77a014a0b8e360d3b7011df89283a2f0b/spi.bin') - spi_hash = '85f698329d38de63aea6e884a86fbde70890a78a' + 'fe371d32e50ca682391e1e70ab98c2942aeffb01/spi.bin') + spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501' spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash) self.vm.set_console()
@@ -352,7 +352,12 @@ class BootLinuxConsole(Test): '-drive', 'file=' + spi_path + ',if=mtd,format=raw', '-no-reboot') self.vm.launch() - self.wait_for_console_pattern('init started: BusyBox') + self.wait_for_console_pattern('Enter \'help\' for a list') + + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 10.0.2.15', + 'eth0: link becomes ready') + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + '3 packets transmitted, 3 packets received, 0% packet loss') def do_test_arm_raspi2(self, uart_id): """
Signature · 1 line
2.20.1
[PULL 15/31] hw/char/cadence_uart: add clock support
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
Switch the cadence uart to multi-phase reset and add the reference clock input.
The input clock frequency is added to the migration structure.
The reference clock controls the baudrate generation. If it disabled, any input characters and events are ignored.
If this clock remains unconnected, the uart behaves as before (it default to a 50MHz ref clock).
Message-id: [email protected]
--- include/hw/char/cadence_uart.h | 1 + hw/char/cadence_uart.c | 73 +++++++++++++++++++++++++++++----- hw/char/trace-events | 3 ++ 3 files changed, 67 insertions(+), 10 deletions(-)
include/hw/char/cadence_uart.h +1 -0
@@ -49,6 +49,7 @@ typedef struct {CharBackend chr;qemu_irq irq;QEMUTimer *fifo_trigger_handle; +Clock *refclk; } CadenceUARTState; static inline DeviceState *cadence_uart_create(hwaddr addr,
hw/char/cadence_uart.c +63 -10
162 lines not on this page · raw message
hw/char/trace-events +3 -0
@@ -97,3 +97,6 @@ exynos_uart_wo_read(uint32_t channel, const char *name, uint32_t reg) "UART%d: T exynos_uart_rxsize(uint32_t channel, uint32_t size) "UART%d: Rx FIFO size: %d" exynos_uart_channel_error(uint32_t channel) "Wrong UART channel number: %d" exynos_uart_rx_timeout(uint32_t channel, uint32_t stat, uint32_t intsp) "UART%d: Rx timeout stat=0x%x intsp=0x%x" + +# hw/char/cadence_uart.c +cadence_uart_baudrate(unsigned baudrate) "baudrate %u"
Signature · 1 line
2.20.1
[PULL 23/31] hw/arm/virt: dt: add kaslr-seed property
In reply to Peter MaydellFrom: Jerome Forissier <[email protected]>
Generate random seeds to be used by the non-secure and/or secure OSes for ASLR. The seeds are 64-bit random values exported via the DT properties /chosen/kaslr-seed [1] and /secure-chosen/kaslr-seed, the latter being used by OP-TEE [2].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5bc0c37c97e1
[2] https://github.com/OP-TEE/optee_os/commit/ef262691fe0e
Message-id: [email protected]
--- hw/arm/virt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
hw/arm/virt.c +15 -0
@@ -77,6 +77,7 @@#include "hw/acpi/generic_event_device.h" #include "hw/virtio/virtio-iommu.h" #include "hw/char/pl011.h" +#include "qemu/guest-random.h" #define DEFINE_VIRT_MACHINE_LATEST (major, minor, latest) \ static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
@@ -213,6 +214,18 @@ static bool cpu_type_valid(const char *cpu)return false; } +static void create_kaslr_seed (VirtMachineState *vms,const char *node) +{ +Error *err =NULL ; +uint64_t seed; + +if (qemu_guest_getrandom (&seed,sizeof (seed), &err)) { +error_free (err); +return ; + } +qemu_fdt_setprop_u64 (vms->fdt, node,"kaslr-seed" , seed); +} +static void create_fdt (VirtMachineState *vms) {MachineState *ms =MACHINE (vms);
@@ -233,9 +246,11 @@ static void create_fdt(VirtMachineState *vms)/* /chosen must exist for load_dtb to fill in necessary properties later */ qemu_fdt_add_subnode (fdt,"/chosen" ); +create_kaslr_seed (vms,"/chosen" );if (vms->secure) {qemu_fdt_add_subnode (fdt,"/secure-chosen" ); +create_kaslr_seed (vms,"/secure-chosen" ); }/* Clock node, for the benefit of the UART. The kernel device tree
Signature · 1 line
2.20.1
[PULL 11/31] qdev: add clock input&output support to devices.
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
Add functions to easily handle clocks with devices. Clock inputs and outputs should be used to handle clock propagation between devices.
The API is very similar the GPIO API.
This is based on the original work of Frederic Konrad.
Message-id: [email protected]
--- hw/core/Makefile.objs | 2 +- tests/Makefile.include | 1 + include/hw/qdev-clock.h | 104 +++++++++++++++++++++++++ include/hw/qdev-core.h | 12 +++ hw/core/qdev-clock.c | 168 ++++++++++++++++++++++++++++++++++++++++ hw/core/qdev.c | 12 +++ 6 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 include/hw/qdev-clock.h create mode 100644 hw/core/qdev-clock.c
hw/core/Makefile.objs +1 -1
@@ -7,7 +7,7 @@ common-obj-y += hotplug.o common-obj-y += vmstate-if.o # irq.o needed for qdev GPIO handling: common-obj-y += irq.o -common-obj-y += clock.o +common-obj-y += clock.o qdev-clock.o common-obj-$(CONFIG_SOFTMMU) += reset.o common-obj-$(CONFIG_SOFTMMU) += qdev-fw.o
tests/Makefile.include +1 -0
@@ -439,6 +439,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ hw/core/fw-path-provider.o \ hw/core/reset.o \ hw/core/vmstate-if.o \ + hw/core/clock.o hw/core/qdev-clock.o \ $(test-qapi-obj-y) tests/test-vmstate$(EXESUF): tests/test-vmstate.o \ migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \
include/hw/qdev-clock.h new file +104 -0
104 lines not on this page · raw message
include/hw/qdev-core.h +12 -0
@@ -149,6 +149,17 @@ struct NamedGPIOList {QLIST_ENTRY (NamedGPIOList) node; }; +typedef struct Clock Clock ; +typedef struct NamedClockList NamedClockList ; + +struct NamedClockList { +char *name; +Clock *clock; +bool output; +bool alias; +QLIST_ENTRY (NamedClockList) node; +}; +/** * DeviceState: * @realized: Indicates whether the device has been fully constructed.
@@ -171,6 +182,7 @@ struct DeviceState {bool allow_unplug_during_migration;BusState *parent_bus; QLIST_HEAD(, NamedGPIOList) gpios; + QLIST_HEAD(, NamedClockList) clocks; QLIST_HEAD(, BusState) child_bus;int num_child_bus;int instance_id_alias;
hw/core/qdev-clock.c new file +168 -0
168 lines not on this page · raw message
hw/core/qdev.c +12 -0
@@ -37,6 +37,7 @@#include "hw/qdev-properties.h" #include "hw/boards.h" #include "hw/sysbus.h" +#include "hw/qdev-clock.h" #include "migration/vmstate.h" #include "trace.h"
@@ -855,6 +856,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)DeviceClass *dc =DEVICE_GET_CLASS (dev);HotplugHandler *hotplug_ctrl;BusState *bus; +NamedClockList *ncl;Error *local_err =NULL ;bool unattached_parent = false;static int unattached_count;
@@ -902,6 +904,13 @@ static void device_set_realized(Object *obj, bool value, Error **errp)*/ g_free (dev->canonical_path); dev->canonical_path =object_get_canonical_path (OBJECT (dev)); + QLIST_FOREACH(ncl, &dev->clocks, node) { +if (ncl->alias) { +continue ; + }else { +clock_setup_canonical_path (ncl->clock); + } + }if (qdev_get_vmsd (dev)) { if (vmstate_register_with_alias_id(VMSTATE_IF(dev),
@@ -1025,6 +1034,7 @@ static void device_initfn(Object *obj) dev->allow_unplug_during_migration = false;QLIST_INIT (&dev->gpios); +QLIST_INIT (&dev->clocks); }static void device_post_init (Object *obj)
@@ -1054,6 +1064,8 @@ static void device_finalize(Object *obj)*/ } +qdev_finalize_clocklist (dev); +/* Only send event if the device had been completely realized */ if (dev->pending_deleted_event) {g_assert (dev->canonical_path);
Signature · 1 line
2.20.1
[PULL 18/31] hw/arm: versal: Setup the ADMA with 128bit bus-width
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
Setup the ADMA with 128bit bus-width. This matters when FIXED BURST mode is used.
Message-id: [email protected]
--- hw/arm/xlnx-versal.c | 2 ++ 1 file changed, 2 insertions(+)
hw/arm/xlnx-versal.c +2 -0
@@ -205,6 +205,8 @@ static void versal_create_admas(Versal *s, qemu_irq *pic) dev =qdev_create (NULL ,"xlnx.zdma" ); s->lpd.iou.adma[i] =SYS_BUS_DEVICE (dev); +object_property_set_int (OBJECT (s->lpd.iou.adma[i]),128 ,"bus-width" , + &error_abort);object_property_add_child (OBJECT (s), name,OBJECT (dev), &error_fatal);qdev_init_nofail (dev);
Signature · 1 line
2.20.1
[PULL 12/31] qdev-clock: introduce an init array to ease the device construction
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
Introduce a function and macro helpers to setup several clocks in a device from a static array description.
An element of the array describes the clock (name and direction) as well as the related callback and an optional offset to store the created object pointer in the device state structure.
The array must be terminated by a special element QDEV_CLOCK_END.
This is based on the original work of Frederic Konrad.
Message-id: [email protected]
--- include/hw/qdev-clock.h | 55 +++++++++++++++++++++++++++++++++++++++++ hw/core/qdev-clock.c | 17 +++++++++++++ 2 files changed, 72 insertions(+)
include/hw/qdev-clock.h +55 -0
@@ -101,4 +101,59 @@ Clock *qdev_alias_clock(DeviceState *dev, const char *name,*/ void qdev_finalize_clocklist (DeviceState *dev); +/** +* ClockPortInitElem: +* @name: name of the clock (can't be NULL) +* @output: indicates whether the clock is input or output +* @callback: for inputs, optional callback to be called on clock's update +* with device as opaque +* @offset: optional offset to store the ClockIn or ClockOut pointer in device +* state structure (0 means unused) +*/ +struct ClockPortInitElem { +const char *name; +bool is_output; +ClockCallback *callback; +size_t offset; +}; + +#define clock_offset_value (devstate, field) \ + (offsetof(devstate, field) + \ + type_check(Clock *, typeof_field(devstate, field))) + +#define QDEV_CLOCK (out_not_in, devstate, field, cb) { \ + .name = (stringify(field)), \ + .is_output = out_not_in, \ + .callback = cb, \ + .offset = clock_offset_value(devstate, field), \ +} + +/** +* QDEV_CLOCK_(IN|OUT): +* @devstate: structure type. @dev argument of qdev_init_clocks below must be +* a pointer to that same type. +* @field: a field in @_devstate (must be Clock*) +* @callback: (for input only) callback (or NULL) to be called with the device +* state as argument +* +* The name of the clock will be derived from @field +*/ +#define QDEV_CLOCK_IN (devstate, field, callback) \ + QDEV_CLOCK(false, devstate, field, callback) + +#define QDEV_CLOCK_OUT (devstate, field) \ + QDEV_CLOCK(true, devstate, field, NULL) + +#define QDEV_CLOCK_END { .name = NULL } + +typedef struct ClockPortInitElem ClockPortInitArray []; + +/** +* qdev_init_clocks: +* @dev: the device to add clocks to +* @clocks: a QDEV_CLOCK_END-terminated array which contains the +* clocks information. +*/ +void qdev_init_clocks (DeviceState *dev,const ClockPortInitArray clocks); +#endif /* QDEV_CLOCK_H */
hw/core/qdev-clock.c +17 -0
@@ -116,6 +116,23 @@ Clock *qdev_init_clock_in(DeviceState *dev, const char *name,return ncl->clock; } +void qdev_init_clocks (DeviceState *dev,const ClockPortInitArray clocks) +{ +const struct ClockPortInitElem *elem; + +for (elem = &clocks[0 ]; elem->name !=NULL ; elem++) { +Clock **clkp; +/* offset cannot be inside the DeviceState part */ +assert (elem->offset >sizeof (DeviceState)); + clkp = (Clock **)(((void *) dev) + elem->offset); +if (elem->is_output) { + *clkp =qdev_init_clock_out (dev, elem->name); + }else { + *clkp =qdev_init_clock_in (dev, elem->name, elem->callback, dev); + } + } +} +static NamedClockList *qdev_get_clocklist (DeviceState *dev,const char *name) {NamedClockList *ncl;
Signature · 1 line
2.20.1
[PULL 14/31] hw/misc/zynq_slcr: add clock generation for uarts
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
Add some clocks to zynq_slcr
+ the main input clock (ps_clk)
+ the reference clock outputs for each uart (uart0 & 1)
This commit also transitional the slcr to multi-phase reset as it is required to initialize the clocks correctly.
The clock frequencies are computed using the internal pll & uart configuration registers and the input ps_clk frequency.
Message-id: [email protected]
--- hw/misc/zynq_slcr.c | 172 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 168 insertions(+), 4 deletions(-)
hw/misc/zynq_slcr.c +168 -4
@@ -22,6 +22,7 @@#include "qemu/log.h" #include "qemu/module.h" #include "hw/registerfields.h" +#include "hw/qdev-clock.h" #ifndef ZYNQ_SLCR_ERR_DEBUG #define ZYNQ_SLCR_ERR_DEBUG 0
@@ -45,6 +46,12 @@ REG32(LOCKSTA, 0x00c) REG32(ARM_PLL_CTRL, 0x100) REG32(DDR_PLL_CTRL, 0x104)REG32 (IO_PLL_CTRL ,0x108 ) +/* fields for [ARM|DDR|IO]_PLL_CTRL registers */ + FIELD(xxx_PLL_CTRL, PLL_RESET, 0, 1) + FIELD(xxx_PLL_CTRL, PLL_PWRDWN, 1, 1) + FIELD(xxx_PLL_CTRL, PLL_BYPASS_QUAL, 3, 1) + FIELD(xxx_PLL_CTRL, PLL_BYPASS_FORCE, 4, 1) + FIELD(xxx_PLL_CTRL, PLL_FPDIV, 12, 7) REG32(PLL_STATUS, 0x10c) REG32(ARM_PLL_CFG, 0x110)REG32 (DDR_PLL_CFG ,0x114 )
@@ -64,6 +71,10 @@ REG32(SMC_CLK_CTRL, 0x148) REG32(LQSPI_CLK_CTRL, 0x14c) REG32(SDIO_CLK_CTRL, 0x150) REG32(UART_CLK_CTRL, 0x154) + FIELD(UART_CLK_CTRL, CLKACT0, 0, 1) + FIELD(UART_CLK_CTRL, CLKACT1, 1, 1) + FIELD(UART_CLK_CTRL, SRCSEL, 4, 2) + FIELD(UART_CLK_CTRL, DIVISOR, 8, 6) REG32(SPI_CLK_CTRL, 0x158) REG32(CAN_CLK_CTRL, 0x15c)REG32 (CAN_MIOCLK_CTRL ,0x160 )
@@ -179,11 +190,127 @@ typedef struct ZynqSLCRState {MemoryRegion iomem;uint32_t regs[ZYNQ_SLCR_NUM_REGS ]; + +Clock *ps_clk; +Clock *uart0_ref_clk; +Clock *uart1_ref_clk; } ZynqSLCRState; -static void zynq_slcr_reset (DeviceState *d) +/* +* return the output frequency of ARM/DDR/IO pll +* using input frequency and PLL_CTRL register +*/ +static uint64_t zynq_slcr_compute_pll (uint64_t input,uint32_t ctrl_reg) { -ZynqSLCRState *s =ZYNQ_SLCR (d); +uint32_t mult = ((ctrl_reg & R_xxx_PLL_CTRL_PLL_FPDIV_MASK) >> + R_xxx_PLL_CTRL_PLL_FPDIV_SHIFT); + +/* first, check if pll is bypassed */ +if (ctrl_reg & R_xxx_PLL_CTRL_PLL_BYPASS_FORCE_MASK) { +return input; + } + +/* is pll disabled ? */ +if (ctrl_reg & (R_xxx_PLL_CTRL_PLL_RESET_MASK | + R_xxx_PLL_CTRL_PLL_PWRDWN_MASK)) { +return 0 ; + } + +/* frequency multiplier -> period division */ +return input / mult; +} + +/* +* return the output period of a clock given: +* + the periods in an array corresponding to input mux selector +* + the register xxx_CLK_CTRL value +* + enable bit index in ctrl register +* +* This function makes the assumption that the ctrl_reg value is organized as +* follows: +* + bits[13:8] clock frequency divisor +* + bits[5:4] clock mux selector (index in array) +* + bits[index] clock enable +*/ +static uint64_t zynq_slcr_compute_clock (const uint64_t periods[], +uint32_t ctrl_reg, +unsigned index) +{ +uint32_t srcsel =extract32 (ctrl_reg,4 ,2 );/* bits [5:4] */ +uint32_t divisor =extract32 (ctrl_reg,8 ,6 );/* bits [13:8] */ + +/* first, check if clock is disabled */ +if (((ctrl_reg >> index) &1u ) ==0 ) { +return 0 ; + } + +/* +* according to the Zynq technical ref. manual UG585 v1.12.2 in +* Clocks chapter, section 25.10.1 page 705: +* "The 6-bit divider provides a divide range of 1 to 63" +* We follow here what is implemented in linux kernel and consider +* the 0 value as a bypass (no division). +*/ +/* frequency divisor -> period multiplication */ +return periods[srcsel] * (divisor ? divisor :1u ); +} + +/* +* macro helper around zynq_slcr_compute_clock to avoid repeating +* the register name. +*/ +#define ZYNQ_COMPUTE_CLK (state, plls, reg, enable_field) \ + zynq_slcr_compute_clock((plls), (state)->regs[reg], \ + reg ## _ ## enable_field ## _SHIFT) + +/** +* Compute and set the ouputs clocks periods. +* But do not propagate them further. Connected clocks +* will not receive any updates (See zynq_slcr_compute_clocks()) +*/ +static void zynq_slcr_compute_clocks (ZynqSLCRState *s) +{ +uint64_t ps_clk =clock_get (s->ps_clk); + +/* consider outputs clocks are disabled while in reset */ +if (device_is_in_reset (DEVICE (s))) { + ps_clk =0 ; + } + +uint64_t io_pll =zynq_slcr_compute_pll (ps_clk, s->regs[R_IO_PLL_CTRL ]); +uint64_t arm_pll =zynq_slcr_compute_pll (ps_clk, s->regs[R_ARM_PLL_CTRL ]); +uint64_t ddr_pll =zynq_slcr_compute_pll (ps_clk, s->regs[R_DDR_PLL_CTRL ]); + +uint64_t uart_mux[4 ] = {io_pll, io_pll, arm_pll, ddr_pll}; + +/* compute uartX reference clocks */ +clock_set (s->uart0_ref_clk, +ZYNQ_COMPUTE_CLK (s, uart_mux,R_UART_CLK_CTRL ,CLKACT0 )); +clock_set (s->uart1_ref_clk, +ZYNQ_COMPUTE_CLK (s, uart_mux,R_UART_CLK_CTRL ,CLKACT1 )); +} + +/** +* Propagate the outputs clocks. +* zynq_slcr_compute_clocks() should have been called before +* to configure them. +*/ +static void zynq_slcr_propagate_clocks (ZynqSLCRState *s) +{ +clock_propagate (s->uart0_ref_clk); +clock_propagate (s->uart1_ref_clk); +} + +static void zynq_slcr_ps_clk_callback (void *opaque) +{ +ZynqSLCRState *s = (ZynqSLCRState *) opaque; +zynq_slcr_compute_clocks (s); +zynq_slcr_propagate_clocks (s); +} + +static void zynq_slcr_reset_init (Object *obj,ResetType type) +{ +ZynqSLCRState *s =ZYNQ_SLCR (obj);int i;DB_PRINT ("RESET\n" );
@@ -277,6 +404,23 @@ static void zynq_slcr_reset(DeviceState *d) s->regs[R_DDRIOB +12 ] =0x00000021 ; } +static void zynq_slcr_reset_hold (Object *obj) +{ +ZynqSLCRState *s =ZYNQ_SLCR (obj); + +/* will disable all output clocks */ +zynq_slcr_compute_clocks (s); +zynq_slcr_propagate_clocks (s); +} + +static void zynq_slcr_reset_exit (Object *obj) +{ +ZynqSLCRState *s =ZYNQ_SLCR (obj); + +/* will compute output clocks according to ps_clk and registers */ +zynq_slcr_compute_clocks (s); +zynq_slcr_propagate_clocks (s); +}static bool zynq_slcr_check_offset (hwaddr offset,bool rnw) {
@@ -409,6 +553,13 @@ static void zynq_slcr_write(void *opaque, hwaddr offset,qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; +case R_IO_PLL_CTRL : +case R_ARM_PLL_CTRL : +case R_DDR_PLL_CTRL : +case R_UART_CLK_CTRL : +zynq_slcr_compute_clocks (s); +zynq_slcr_propagate_clocks (s); +break ; } }
@@ -418,6 +569,13 @@ static const MemoryRegionOps slcr_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; +static const ClockPortInitArray zynq_slcr_clocks = { +QDEV_CLOCK_IN (ZynqSLCRState, ps_clk, zynq_slcr_ps_clk_callback), +QDEV_CLOCK_OUT (ZynqSLCRState, uart0_ref_clk), +QDEV_CLOCK_OUT (ZynqSLCRState, uart1_ref_clk), +QDEV_CLOCK_END +}; +static void zynq_slcr_init (Object *obj) {ZynqSLCRState *s =ZYNQ_SLCR (obj);
@@ -425,14 +583,17 @@ static void zynq_slcr_init(Object *obj)memory_region_init_io (&s->iomem, obj, &slcr_ops, s,"slcr" ,ZYNQ_SLCR_MMIO_SIZE );sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->iomem); + +qdev_init_clocks (DEVICE (obj), zynq_slcr_clocks); }static const VMStateDescription vmstate_zynq_slcr = { .name ="zynq_slcr" , - .version_id =2 , + .version_id =3 , .minimum_version_id =2 , .fields = (VMStateField []) {VMSTATE_UINT32_ARRAY (regs, ZynqSLCRState,ZYNQ_SLCR_NUM_REGS ), +VMSTATE_CLOCK_V (ps_clk, ZynqSLCRState,3 ),VMSTATE_END_OF_LIST () } };
@@ -440,9 +601,12 @@ static const VMStateDescription vmstate_zynq_slcr = {static void zynq_slcr_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->vmsd = &vmstate_zynq_slcr; - dc->reset = zynq_slcr_reset; + rc->phases.enter = zynq_slcr_reset_init; + rc->phases.hold = zynq_slcr_reset_hold; + rc->phases.exit = zynq_slcr_reset_exit; }static const TypeInfo zynq_slcr_info = {
Signature · 1 line
2.20.1
[PULL 26/31] target/arm/cpu: Use ARRAY_SIZE() to iterate over ARMCPUInfo[]
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Message-id: [email protected]
--- target/arm/cpu.c | 8 +++----- target/arm/cpu64.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-)
target/arm/cpu.c +3 -5
@@ -2745,7 +2745,6 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "any", .initfn = arm_max_initfn }, #endif #endif - { .name = NULL } }; static Property arm_cpu_properties[] = {
@@ -2893,14 +2892,13 @@ static const TypeInfo idau_interface_type_info = {static void arm_cpu_register_types (void ) { -const ARMCPUInfo *info = arm_cpus; +size_t i;type_register_static (&arm_cpu_type_info);type_register_static (&idau_interface_type_info); -while (info->name) { -arm_cpu_register (info); - info++; +for (i =0 ; i <ARRAY_SIZE (arm_cpus); ++i) { +arm_cpu_register (&arm_cpus[i]); }#ifdef CONFIG_KVM
target/arm/cpu64.c +3 -5
@@ -742,7 +742,6 @@ static const ARMCPUInfo aarch64_cpus[] = { { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, { .name = "max", .initfn = aarch64_max_initfn }, - { .name = NULL } };static bool aarch64_cpu_get_aarch64 (Object *obj,Error **errp)
@@ -848,13 +847,12 @@ static const TypeInfo aarch64_cpu_type_info = {static void aarch64_cpu_register_types (void ) { -const ARMCPUInfo *info = aarch64_cpus; +size_t i;type_register_static (&aarch64_cpu_type_info); -while (info->name) { -aarch64_cpu_register (info); - info++; +for (i =0 ; i <ARRAY_SIZE (aarch64_cpus); ++i) { +aarch64_cpu_register (&aarch64_cpus[i]); } }
Signature · 1 line
2.20.1
Re: [PULL 26/31] target/arm/cpu: Use ARRAY_SIZE() to iterate over ARMCPUInfo[]
Quoted 8 lines · Peter Maydell
From: Philippe Mathieu-Daudé <[email protected]>
Suggested-by Richard Henderson <[email protected]>Reviewed-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>
This causes compile errors on configs where the array ends up empty:
/home/pm/qemu/target/arm/cpu.c: In function ‘arm_cpu_register_types’:/home/pm/qemu/target/arm/cpu.c:2903:19: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
for (i = 0; i < ARRAY_SIZE(arm_cpus); ++i) {
^I've dropped the patch from the pullreq.
thanks
-- PMM
[PULL 21/31] target/arm: Vectorize integer comparison vs zero
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
These instructions are often used in glibc's string routines. They were the final uses of the 32-bit at a time neon helpers.
Message-id: [email protected]
--- target/arm/helper.h | 27 ++-- target/arm/translate.h | 5 + target/arm/neon_helper.c | 24 ---- target/arm/translate-a64.c | 64 +++------- target/arm/translate.c | 256 +++++++++++++++++++++++++++++++------ target/arm/vec_helper.c | 25 ++++ 6 files changed, 278 insertions(+), 123 deletions(-)
target/arm/helper.h +11 -16
@@ -275,19 +275,6 @@ DEF_HELPER_2(neon_hsub_u16, i32, i32, i32) DEF_HELPER_2(neon_hsub_s32, s32, s32, s32) DEF_HELPER_2(neon_hsub_u32, i32, i32, i32) -DEF_HELPER_2(neon_cgt_u8, i32, i32, i32) -DEF_HELPER_2(neon_cgt_s8, i32, i32, i32) -DEF_HELPER_2(neon_cgt_u16, i32, i32, i32) -DEF_HELPER_2(neon_cgt_s16, i32, i32, i32) -DEF_HELPER_2(neon_cgt_u32, i32, i32, i32) -DEF_HELPER_2(neon_cgt_s32, i32, i32, i32) -DEF_HELPER_2(neon_cge_u8, i32, i32, i32) -DEF_HELPER_2(neon_cge_s8, i32, i32, i32) -DEF_HELPER_2(neon_cge_u16, i32, i32, i32) -DEF_HELPER_2(neon_cge_s16, i32, i32, i32) -DEF_HELPER_2(neon_cge_u32, i32, i32, i32) -DEF_HELPER_2(neon_cge_s32, i32, i32, i32) - DEF_HELPER_2(neon_pmin_u8, i32, i32, i32) DEF_HELPER_2(neon_pmin_s8, i32, i32, i32)DEF_HELPER_2 (neon_pmin_u16, i32, i32, i32)
@@ -347,9 +334,6 @@ DEF_HELPER_2(neon_mul_u16, i32, i32, i32) DEF_HELPER_2(neon_tst_u8, i32, i32, i32) DEF_HELPER_2(neon_tst_u16, i32, i32, i32) DEF_HELPER_2(neon_tst_u32, i32, i32, i32) -DEF_HELPER_2(neon_ceq_u8, i32, i32, i32) -DEF_HELPER_2(neon_ceq_u16, i32, i32, i32) -DEF_HELPER_2(neon_ceq_u32, i32, i32, i32) DEF_HELPER_1(neon_clz_u8, i32, i32)DEF_HELPER_1 (neon_clz_u16, i32, i32)
@@ -686,6 +670,17 @@ DEF_HELPER_FLAGS_2(frint64_s, TCG_CALL_NO_RWG, f32, f32, ptr) DEF_HELPER_FLAGS_2(frint32_d, TCG_CALL_NO_RWG, f64, f64, ptr) DEF_HELPER_FLAGS_2(frint64_d, TCG_CALL_NO_RWG, f64, f64, ptr) +DEF_HELPER_FLAGS_3(gvec_ceq0_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_ceq0_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_clt0_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_clt0_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_cle0_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_cle0_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_cgt0_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_cgt0_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_cge0_b, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(gvec_cge0_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(gvec_sshl_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(gvec_sshl_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)DEF_HELPER_FLAGS_4 (gvec_ushl_b,TCG_CALL_NO_RWG , void, ptr, ptr, ptr, i32)
target/arm/translate.h +5 -0
@@ -275,6 +275,11 @@ static inline void gen_swstep_exception(DisasContext *s, int isv, int ex)uint64_t vfp_expand_imm (int size,uint8_t imm8);/* Vector operations shared between ARM and AArch64. */ +extern const GVecGen2 ceq0_op[4 ]; +extern const GVecGen2 clt0_op[4 ]; +extern const GVecGen2 cgt0_op[4 ]; +extern const GVecGen2 cle0_op[4 ]; +extern const GVecGen2 cge0_op[4 ];extern const GVecGen3 mla_op[4 ];extern const GVecGen3 mls_op[4 ];extern const GVecGen3 cmtst_op[4 ];
target/arm/neon_helper.c +0 -24
@@ -562,24 +562,6 @@ uint32_t HELPER(neon_hsub_u32)(uint32_t src1, uint32_t src2)return dest; } -#define NEON_FN (dest, src1, src2) dest = (src1 > src2) ? ~0 : 0 -NEON_VOP(cgt_s8, neon_s8, 4) -NEON_VOP(cgt_u8, neon_u8, 4) -NEON_VOP(cgt_s16, neon_s16, 2) -NEON_VOP(cgt_u16, neon_u16, 2) -NEON_VOP(cgt_s32, neon_s32, 1) -NEON_VOP(cgt_u32, neon_u32, 1) -#undef NEON_FN - -#define NEON_FN (dest, src1, src2) dest = (src1 >= src2) ? ~0 : 0 -NEON_VOP(cge_s8, neon_s8, 4) -NEON_VOP(cge_u8, neon_u8, 4) -NEON_VOP(cge_s16, neon_s16, 2) -NEON_VOP(cge_u16, neon_u16, 2) -NEON_VOP(cge_s32, neon_s32, 1) -NEON_VOP(cge_u32, neon_u32, 1) -#undef NEON_FN -#define NEON_FN (dest, src1, src2) dest = (src1 < src2) ? src1 : src2 NEON_POP(pmin_s8, neon_s8, 4)NEON_POP (pmin_u8, neon_u8,4 )
@@ -1135,12 +1117,6 @@ NEON_VOP(tst_u16, neon_u16, 2) NEON_VOP(tst_u32, neon_u32, 1)#undef NEON_FN -#define NEON_FN (dest, src1, src2) dest = (src1 == src2) ? -1 : 0 -NEON_VOP(ceq_u8, neon_u8, 4) -NEON_VOP(ceq_u16, neon_u16, 2) -NEON_VOP(ceq_u32, neon_u32, 1) -#undef NEON_FN -/* Count Leading Sign/Zero Bits. */ static inline int do_clz8 (uint8_t x) {
target/arm/translate-a64.c +17 -47
94 lines not on this page · raw message
target/arm/translate.c +220 -36
274 lines not on this page · raw message
target/arm/vec_helper.c +25 -0
@@ -1257,3 +1257,28 @@ void HELPER(sve2_pmull_h)(void *vd, void *vn, void *vm, uint32_t desc) } } #endif + +#define DO_CMP0(NAME, TYPE, OP) \ +void HELPER(NAME)(void *vd, void *vn, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + for (i = 0; i < opr_sz; i += sizeof(TYPE)) { \ + TYPE nn = *(TYPE *)(vn + i); \ + *(TYPE *)(vd + i) = -(nn OP 0); \ + } \ + clear_tail(vd, opr_sz, simd_maxsz(desc)); \ +} + +DO_CMP0(gvec_ceq0_b, int8_t, ==) +DO_CMP0(gvec_clt0_b, int8_t, <) +DO_CMP0(gvec_cle0_b, int8_t, <=) +DO_CMP0(gvec_cgt0_b, int8_t, >) +DO_CMP0(gvec_cge0_b, int8_t, >=) + +DO_CMP0(gvec_ceq0_h, int16_t, ==) +DO_CMP0(gvec_clt0_h, int16_t, <) +DO_CMP0(gvec_cle0_h, int16_t, <=) +DO_CMP0(gvec_cgt0_h, int16_t, >) +DO_CMP0(gvec_cge0_h, int16_t, >=) + +#undef DO_CMP0
Signature · 1 line
2.20.1
[PULL 17/31] qdev-monitor: print the device's clock with info qtree
In reply to Peter MaydellFrom: Damien Hedde <[email protected]>
This prints the clocks attached to a DeviceState when using "info qtree" monitor command. For every clock, it displays the direction, the name and if the clock is forwarded. For input clock, it displays also the frequency.
This is based on the original work of Frederic Konrad.
Here follows a sample of info qtree output on xilinx_zynq machine after linux boot with only one uart clocked:
Quoted 11 lines
bus: main-system-bus
type System
[...]
dev:cadence_uart, id ""
gpio-out "sysbus-irq" 1
clock-in "refclk" freq_hz=0.000000e+00
chardev = ""
mmio 00000000e0001000/0000000000001000
dev:cadence_uart, id ""
gpio-out "sysbus-irq" 1
clock-in "refclk" freq_hz=1.375661e+07
Quoted 8 lines
chardev = "serial0"
mmio 00000000e0000000/0000000000001000
[...]
dev: xilinx,zynq_slcr, id ""
clock-out "uart1_ref_clk" freq_hz=0.000000e+00
clock-out "uart0_ref_clk" freq_hz=1.375661e+07
clock-in "ps_clk" freq_hz=3.333333e+07
mmio 00000000f8000000/0000000000001000
Message-id: [email protected]
--- qdev-monitor.c | 9 +++++++++ 1 file changed, 9 insertions(+)
qdev-monitor.c +9 -0
@@ -38,6 +38,7 @@#include "migration/misc.h" #include "migration/migration.h" #include "qemu/cutils.h" +#include "hw/clock.h" /* * Aliases were a bad idea from the start. Let's keep them
@@ -737,6 +738,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent)ObjectClass *class;BusState *child;NamedGPIOList *ngl; +NamedClockList *ncl;qdev_printf ("dev: %s, id \"%s\"\n" ,object_get_typename (OBJECT (dev)), dev->id ? dev->id :"" );
@@ -751,6 +753,13 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent) ngl->num_out); } } + QLIST_FOREACH(ncl, &dev->clocks, node) { +qdev_printf ("clock-%s%s \"%s\" freq_hz=%e\n" , + ncl->output ?"out" :"in" , + ncl->alias ?" (alias)" :"" , + ncl->name, +CLOCK_PERIOD_TO_HZ (1.0 *clock_get (ncl->clock))); + } class =object_get_class (OBJECT (dev)); do { qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent);
Signature · 1 line
2.20.1
[PULL 20/31] net: cadence_gem: clear RX control descriptor
In reply to Peter MaydellFrom: Ramon Fried <[email protected]>
The RX ring descriptors control field is used for setting SOF and EOF (start of frame and end of frame).
The SOF and EOF weren't cleared from the previous descriptors, causing inconsistencies in ring buffer.
Fix that by clearing the control field of every descriptors we're processing.
Message-id: [email protected]
--- hw/net/cadence_gem.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/net/cadence_gem.c +7 -0
@@ -411,6 +411,11 @@ static inline void rx_desc_set_sof(uint32_t *desc) desc[1 ] |=DESC_1_RX_SOF ; } +static inline void rx_desc_clear_control (uint32_t *desc) +{ + desc[1 ] =0 ; +} +static inline void rx_desc_set_eof (uint32_t *desc) { desc[1 ] |=DESC_1_RX_EOF ;
@@ -999,6 +1004,8 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size) rxbuf_ptr +=MIN (bytes_to_copy, rxbufsize); bytes_to_copy -=MIN (bytes_to_copy, rxbufsize); +rx_desc_clear_control (s->rx_desc[q]); +/* Update the descriptor. */ if (first_desc) {rx_desc_set_sof (s->rx_desc[q]);
Signature · 1 line
2.20.1
[PULL 27/31] target/arm/cpu: Update coding style to make checkpatch.pl happy
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
We will move this code in the next commit. Clean it up first to avoid checkpatch.pl errors.
Message-id: [email protected]
--- target/arm/cpu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
target/arm/cpu.c +6 -3
@@ -582,7 +582,8 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)CPUARMState *env = &cpu->env;bool ret = false; -/* ARMv7-M interrupt masking works differently than -A or -R. +/* +* ARMv7-M interrupt masking works differently than -A or -R. * There is no FIQ/IRQ distinction. Instead of I and F bits * masking FIQ and IRQ interrupts, an exception is taken only * if it is higher priority than the current execution priority
@@ -1912,7 +1913,8 @@ static void arm1026_initfn(Object *obj)static void arm1136_r2_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj); -/* What qemu calls "arm1136_r2" is actually the 1136 r0p2, ie an +/* +* What qemu calls "arm1136_r2" is actually the 1136 r0p2, ie an * older core than plain "arm1136". In particular this does not * have the v6K features. * These ID register values are correct for 1136 but may be wrong
@@ -2698,7 +2700,8 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "arm926", .initfn = arm926_initfn }, { .name = "arm946", .initfn = arm946_initfn }, { .name = "arm1026", .initfn = arm1026_initfn }, -/* What QEMU calls "arm1136-r2" is actually the 1136 r0p2, i.e. an +/* +* What QEMU calls "arm1136-r2" is actually the 1136 r0p2, i.e. an * older core than plain "arm1136". In particular this does not * have the v6K features. */
Signature · 1 line
2.20.1
Re: [PULL 27/31] target/arm/cpu: Update coding style to make checkpatch.pl happy
Quoted 4 lines · Peter Maydell
From: Philippe Mathieu-Daudé <[email protected]>
We will move this code in the next commit. Clean it up first to avoid checkpatch.pl errors.
Oops this isn't the next commit anymore :S
Quoted 44 lines
Reviewed-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)target/arm/cpu.c +6
-3@@ -582,7 +582,8 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)CPUARMState *env = &cpu->env;bool ret = false; -/* ARMv7-M interrupt masking works differently than -A or -R. +/* +* ARMv7-M interrupt masking works differently than -A or -R. * There is no FIQ/IRQ distinction. Instead of I and F bits * masking FIQ and IRQ interrupts, an exception is taken only * if it is higher priority than the current execution priority @@ -1912,7 +1913,8 @@ static void arm1026_initfn(Object *obj)static void arm1136_r2_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj); -/* What qemu calls "arm1136_r2" is actually the 1136 r0p2, ie an +/* +* What qemu calls "arm1136_r2" is actually the 1136 r0p2, ie an * older core than plain "arm1136". In particular this does not * have the v6K features. * These ID register values are correct for 1136 but may be wrong @@ -2698,7 +2700,8 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "arm926", .initfn = arm926_initfn }, { .name = "arm946", .initfn = arm946_initfn }, { .name = "arm1026", .initfn = arm1026_initfn }, -/* What QEMU calls "arm1136-r2" is actually the 1136 r0p2, i.e. an +/* +* What QEMU calls "arm1136-r2" is actually the 1136 r0p2, i.e. an * older core than plain "arm1136". In particular this does not * have the v6K features. */
[PULL 28/31] device_tree: Allow name wildcards in qemu_fdt_node_path()
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
Allow name wildcards in qemu_fdt_node_path(). This is useful to find all nodes with a given compatibility string.
Message-id: [email protected]
--- include/sysemu/device_tree.h | 3 +++ device_tree.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
include/sysemu/device_tree.h +3 -0
@@ -39,6 +39,9 @@ void *load_device_tree_from_sysfs(void);* NULL. If there is no error but no matching node was found, the * returned array contains a single element equal to NULL. If an error * was encountered when parsing the blob, the function returns NULL +* +* @name may be NULL to wildcard names and only match compatibility +* strings. */ char **qemu_fdt_node_path (void *fdt,const char *name,char *compat,Error **errp);
device_tree.c +1 -1
@@ -308,7 +308,7 @@ char **qemu_fdt_node_path(void *fdt, const char *name, char *compat, offset = len;break ; } -if (!strcmp (iter_name, name)) { +if (!name || !strcmp (iter_name, name)) {char *path; path =g_malloc (path_len);
Signature · 1 line
2.20.1
[PULL 19/31] Cadence: gem: fix wraparound in 64bit descriptors
In reply to Peter MaydellFrom: Ramon Fried <[email protected]>
Wraparound of TX descriptor cyclic buffer only updated the low 32 bits of the descriptor.
Fix that by checking if we're working with 64bit descriptors.
Message-id: [email protected]
--- hw/net/cadence_gem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/net/cadence_gem.c +8 -1
@@ -1238,7 +1238,14 @@ static void gem_transmit(CadenceGEMState *s)/* read next descriptor */ if (tx_desc_get_wrap (desc)) {tx_desc_set_last (desc); - packet_desc_addr = s->regs[GEM_TXQBASE ]; + +if (s->regs[GEM_DMACFG ] &GEM_DMACFG_ADDR_64B ) { + packet_desc_addr = s->regs[GEM_TBQPH ]; + packet_desc_addr <<=32 ; + }else { + packet_desc_addr =0 ; + } + packet_desc_addr |= s->regs[GEM_TXQBASE ]; }else { packet_desc_addr +=4 *gem_get_desc_len (s, false); }
Signature · 1 line
2.20.1
[PULL 22/31] hw/arm/virt: dt: move creation of /secure-chosen to create_fdt()
In reply to Peter MaydellFrom: Jerome Forissier <[email protected]>
The /secure-chosen node is currently used only by create_uart(), but this will change. Therefore move the creation of this node to create_fdt().
Message-id: [email protected]
--- hw/arm/virt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/arm/virt.c +4 -1
@@ -234,6 +234,10 @@ static void create_fdt(VirtMachineState *vms)/* /chosen must exist for load_dtb to fill in necessary properties later */ qemu_fdt_add_subnode (fdt,"/chosen" ); +if (vms->secure) { +qemu_fdt_add_subnode (fdt,"/secure-chosen" ); + } +/* Clock node, for the benefit of the UART. The kernel device tree * binding documentation claims the PL011 node clock properties are * optional but in practice if you omit them the kernel refuses to
@@ -761,7 +765,6 @@ static void create_uart(const VirtMachineState *vms, int uart,qemu_fdt_setprop_string (vms->fdt, nodename,"status" ,"disabled" );qemu_fdt_setprop_string (vms->fdt, nodename,"secure-status" ,"okay" ); -qemu_fdt_add_subnode (vms->fdt,"/secure-chosen" );qemu_fdt_setprop_string (vms->fdt,"/secure-chosen" ,"stdout-path" , nodename); }
Signature · 1 line
2.20.1
[PULL 30/31] hw/arm: xlnx-zcu102: Move arm_boot_info into XlnxZCU102
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
Move arm_boot_info into XlnxZCU102.
Message-id: [email protected]
--- hw/arm/xlnx-zcu102.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
hw/arm/xlnx-zcu102.c +5 -4
@@ -31,13 +31,14 @@ typedef struct XlnxZCU102 {bool secure;bool virt; + +struct arm_boot_info binfo; } XlnxZCU102;#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")#define ZCU102_MACHINE (obj) \ OBJECT_CHECK(XlnxZCU102, (obj), TYPE_ZCU102_MACHINE) -static struct arm_boot_info xlnx_zcu102_binfo;static bool zcu102_get_secure (Object *obj,Error **errp) {
@@ -166,9 +167,9 @@ static void xlnx_zcu102_init(MachineState *machine)/* TODO create and connect IDE devices for ide_drive_get() */ - xlnx_zcu102_binfo.ram_size = ram_size; - xlnx_zcu102_binfo.loader_start =0 ; -arm_load_kernel (s->soc.boot_cpu_ptr, machine, &xlnx_zcu102_binfo); + s->binfo.ram_size = ram_size; + s->binfo.loader_start =0 ; +arm_load_kernel (s->soc.boot_cpu_ptr, machine, &s->binfo); }static void xlnx_zcu102_machine_instance_init (Object *obj)
Signature · 1 line
2.20.1
[PULL 31/31] hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
Disable unsupported FDT firmware nodes if a user passes us a DTB with nodes enabled that the machine cannot support due to lack of EL3 or EL2 support.
Message-id: [email protected]
--- hw/arm/xlnx-zcu102.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
hw/arm/xlnx-zcu102.c +30 -0
@@ -23,6 +23,7 @@#include "qemu/error-report.h" #include "qemu/log.h" #include "sysemu/qtest.h" +#include "sysemu/device_tree.h" typedef struct XlnxZCU102 { MachineState parent_obj;
@@ -68,6 +69,34 @@ static void zcu102_set_virt(Object *obj, bool value, Error **errp) s->virt = value; } +static void zcu102_modify_dtb (const struct arm_boot_info *binfo,void *fdt) +{ +XlnxZCU102 *s =container_of (binfo, XlnxZCU102, binfo); +bool method_is_hvc; +char **node_path; +const char *r; +int prop_len; +int i; + +/* If EL3 is enabled, we keep all firmware nodes active. */ +if (!s->secure) { + node_path =qemu_fdt_node_path (fdt,NULL ,"xlnx,zynqmp-firmware" , + &error_fatal); + +for (i =0 ; node_path && node_path[i]; i++) { + r =qemu_fdt_getprop (fdt, node_path[i],"method" , &prop_len,NULL ); + method_is_hvc = r && !strcmp ("hvc" , r); + +/* Allow HVC based firmware if EL2 is enabled. */ +if (method_is_hvc && s->virt) { +continue ; + } +qemu_fdt_setprop_string (fdt, node_path[i],"status" ,"disabled" ); + } +g_strfreev (node_path); + } +} +static void xlnx_zcu102_init (MachineState *machine) {XlnxZCU102 *s =ZCU102_MACHINE (machine);
@@ -169,6 +198,7 @@ static void xlnx_zcu102_init(MachineState *machine) s->binfo.ram_size = ram_size; s->binfo.loader_start =0 ; + s->binfo.modify_dtb = zcu102_modify_dtb;arm_load_kernel (s->soc.boot_cpu_ptr, machine, &s->binfo); }
Signature · 1 line
2.20.1
[PULL 25/31] target/arm: Make cpu_register() available for other files
In reply to Peter MaydellFrom: Thomas Huth <[email protected]>
Make cpu_register() (renamed to arm_cpu_register()) available from internals.h so we can register CPUs also from other files in the future.
Message-id: [email protected]
Message-ID: <[email protected]>
--- target/arm/cpu-qom.h | 9 ++++++++- target/arm/cpu.c | 10 ++-------- target/arm/cpu64.c | 8 +------- 3 files changed, 11 insertions(+), 16 deletions(-)
target/arm/cpu-qom.h +8 -1
@@ -35,7 +35,14 @@ struct arm_boot_info;#define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU -typedef struct ARMCPUInfo ARMCPUInfo ; +typedef struct ARMCPUInfo { +const char *name; +void (*initfn)(Object *obj); +void (*class_init)(ObjectClass *oc,void *data); +}ARMCPUInfo ; + +void arm_cpu_register (const ARMCPUInfo *info); +void aarch64_cpu_register (const ARMCPUInfo *info);/** * ARMCPUClass:
target/arm/cpu.c +2 -8
@@ -2693,12 +2693,6 @@ static void arm_max_initfn(Object *obj)#endif /* !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) */ -struct ARMCPUInfo { -const char *name; -void (*initfn)(Object *obj); -void (*class_init)(ObjectClass *oc,void *data); -}; -static const ARMCPUInfo arm_cpus[] = { #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) { .name = "arm926", .initfn = arm926_initfn },
@@ -2864,7 +2858,7 @@ static void cpu_register_class_init(ObjectClass *oc, void *data) acc->info = data; } -static void cpu_register (const ARMCPUInfo *info) +void arm_cpu_register (const ARMCPUInfo *info) {TypeInfo type_info = { .parent =TYPE_ARM_CPU ,
@@ -2905,7 +2899,7 @@ static void arm_cpu_register_types(void)type_register_static (&idau_interface_type_info);while (info->name) { -cpu_register (info); +arm_cpu_register (info); info++; }
target/arm/cpu64.c +1 -7
@@ -737,12 +737,6 @@ static void aarch64_max_initfn(Object *obj) cpu_max_set_sve_max_vq, NULL, NULL, &error_fatal); } -struct ARMCPUInfo { -const char *name; -void (*initfn)(Object *obj); -void (*class_init)(ObjectClass *oc,void *data); -}; -static const ARMCPUInfo aarch64_cpus[] = { { .name ="cortex-a57" , .initfn = aarch64_a57_initfn }, { .name ="cortex-a53" , .initfn = aarch64_a53_initfn },
@@ -825,7 +819,7 @@ static void cpu_register_class_init(ObjectClass *oc, void *data) acc->info = data; } -static void aarch64_cpu_register (const ARMCPUInfo *info) +void aarch64_cpu_register (const ARMCPUInfo *info) {TypeInfo type_info = { .parent =TYPE_AARCH64_CPU ,
Signature · 1 line
2.20.1
[PULL 24/31] target/arm: Restrict the Address Translate write operation to TCG accel
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Under KVM these registers are written by the hardware. Restrict the writefn handlers to TCG to avoid when building without TCG:
LINK aarch64-softmmu/qemu-system-aarch64
target/arm/helper.o: In function `do_ats_write':
target/arm/helper.c:3524: undefined reference to `raise_exception'
Message-id: [email protected]
--- target/arm/helper.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
target/arm/helper.c +17 -0
@@ -3442,6 +3442,7 @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri,return CP_ACCESS_OK ; } +#ifdef CONFIG_TCG static uint64_t do_ats_write (CPUARMState *env,uint64_t value,MMUAccessType access_type,ARMMMUIdx mmu_idx) {
@@ -3602,9 +3603,11 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, }return par64; } +#endif /* CONFIG_TCG */ static void ats_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) { +#ifdef CONFIG_TCG MMUAccessType access_type = ri->opc2 &1 ?MMU_DATA_STORE :MMU_DATA_LOAD ;uint64_t par64;ARMMMUIdx mmu_idx;
@@ -3664,17 +3667,26 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) par64 =do_ats_write (env, value, access_type, mmu_idx);A32_BANKED_CURRENT_REG_SET (env, par, par64); +#else +/* Handled by hardware accelerator. */ +g_assert_not_reached (); +#endif /* CONFIG_TCG */ }static void ats1h_write (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) { +#ifdef CONFIG_TCG MMUAccessType access_type = ri->opc2 &1 ?MMU_DATA_STORE :MMU_DATA_LOAD ;uint64_t par64; par64 =do_ats_write (env, value, access_type, ARMMMUIdx_E2);A32_BANKED_CURRENT_REG_SET (env, par, par64); +#else +/* Handled by hardware accelerator. */ +g_assert_not_reached (); +#endif /* CONFIG_TCG */ } static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -3689,6 +3701,7 @@ static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo *ri,static void ats_write64 (CPUARMState *env,const ARMCPRegInfo *ri,uint64_t value) { +#ifdef CONFIG_TCG MMUAccessType access_type = ri->opc2 &1 ?MMU_DATA_STORE :MMU_DATA_LOAD ;ARMMMUIdx mmu_idx;int secure =arm_is_secure_below_el3 (env);
@@ -3728,6 +3741,10 @@ static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri, } env->cp15.par_el[1 ] =do_ats_write (env, value, access_type, mmu_idx); +#else +/* Handled by hardware accelerator. */ +g_assert_not_reached (); +#endif /* CONFIG_TCG */ }#endif
Signature · 1 line
2.20.1
[PULL 29/31] device_tree: Constify compat in qemu_fdt_node_path()
In reply to Peter MaydellFrom: "Edgar E. Iglesias" <[email protected]>
Make compat in qemu_fdt_node_path() const char *.
Message-id: [email protected]
--- include/sysemu/device_tree.h | 2 +- device_tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/sysemu/device_tree.h +1 -1
@@ -43,7 +43,7 @@ void *load_device_tree_from_sysfs(void);* @name may be NULL to wildcard names and only match compatibility * strings. */ -char **qemu_fdt_node_path (void *fdt,const char *name,char *compat, +char **qemu_fdt_node_path (void *fdt,const char *name,const char *compat,Error **errp);/**
device_tree.c +1 -1
@@ -291,7 +291,7 @@ char **qemu_fdt_node_unit_path(void *fdt, const char *name, Error **errp)return path_array; } -char **qemu_fdt_node_path (void *fdt,const char *name,char *compat, +char **qemu_fdt_node_path (void *fdt,const char *name,const char *compat,Error **errp) {int offset, len, ret;
Signature · 1 line
2.20.1
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [PULL 00/31] target-arm queue
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
cc6c93a hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes 851a774 hw/arm: xlnx-zcu102: Move arm_boot_info into XlnxZCU102 cb4770a device_tree: Constify compat in qemu_fdt_node_path() a26ed36 device_tree: Allow name wildcards in qemu_fdt_node_path() 0c7b245 target/arm/cpu: Update coding style to make checkpatch.pl happy 6e87116 target/arm/cpu: Use ARRAY_SIZE() to iterate over ARMCPUInfo[] ac5d9f2 target/arm: Make cpu_register() available for other files 1f8dbd1 target/arm: Restrict the Address Translate write operation to TCG accel 26c5aa2 hw/arm/virt: dt: add kaslr-seed property
256d88c hw/arm/virt: dt: move creation of /secure-chosen to create_fdt() 281ba0a target/arm: Vectorize integer comparison vs zero
d335551 net: cadence_gem: clear RX control descriptor
886d104 Cadence: gem: fix wraparound in 64bit descriptors
adab3ff hw/arm: versal: Setup the ADMA with 128bit bus-width 9ff65f3 qdev-monitor: print the device's clock with info qtree ea507fb hw/arm/xilinx_zynq: connect uart clocks to slcr
abd4b39 hw/char/cadence_uart: add clock support
02a7d87 hw/misc/zynq_slcr: add clock generation for uarts
947bc22 docs/clocks: add device's clock documentation
49f9409 qdev-clock: introduce an init array to ease the device construction 6b7b97c qdev: add clock input&output support to devices.
62643a6 hw/core/clock-vmstate: define a vmstate entry for clock state d7158be hw/core/clock: introduce clock object
de7c1af tests/boot_linux_console: Add ethernet test to SmartFusion2 2dd76b4 msf2: Add EMAC block to SmartFusion2 SoC
bf46971 hw/net: Add Smartfusion2 emac block
0af4051 Typo: Correct the name of CPU hotplug memory region fb7f6b0 bugfix: Use gicr_typer in arm_gicv3_icc_reset
95a592a nrf51: Fix last GPIO CNF address
00478e2 dma/xlnx-zdma: Fix descriptor loading (REG) wrt endianness 7fec387 dma/xlnx-zdma: Fix descriptor loading (MEM) wrt endianness
=== OUTPUT BEGIN ===
1/31 Checking commit 7fec38768f4a (dma/xlnx-zdma: Fix descriptor loading (MEM) wrt endianness) 2/31 Checking commit 00478e21e556 (dma/xlnx-zdma: Fix descriptor loading (REG) wrt endianness) 3/31 Checking commit 95a592a9ca01 (nrf51: Fix last GPIO CNF address)
4/31 Checking commit fb7f6b03b3bd (bugfix: Use gicr_typer in arm_gicv3_icc_reset) 5/31 Checking commit 0af4051edd5b (Typo: Correct the name of CPU hotplug memory region) 6/31 Checking commit bf46971ba6f8 (hw/net: Add Smartfusion2 emac block)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#41:
new file mode 100644
total: 0 errors, 1 warnings, 654 lines checked
Patch 6/31 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/31 Checking commit 2dd76b4a530d (msf2: Add EMAC block to SmartFusion2 SoC) 8/31 Checking commit de7c1af6c5fa (tests/boot_linux_console: Add ethernet test to SmartFusion2) 9/31 Checking commit d7158be1a4b6 (hw/core/clock: introduce clock object)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#42:
new file mode 100644
total: 0 errors, 1 warnings, 363 lines checked
Patch 9/31 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
10/31 Checking commit 62643a6e45ee (hw/core/clock-vmstate: define a vmstate entry for clock state)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#29:
new file mode 100644
total: 0 errors, 1 warnings, 47 lines checked
Patch 10/31 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/31 Checking commit 6b7b97c06fc4 (qdev: add clock input&output support to devices.)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #35:
new file mode 100644
total: 0 errors, 1 warnings, 353 lines checked
Patch 11/31 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
12/31 Checking commit 49f9409e6aba (qdev-clock: introduce an init array to ease the device construction) 13/31 Checking commit 947bc2295320 (docs/clocks: add device's clock documentation)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#22:
new file mode 100644
total: 0 errors, 1 warnings, 395 lines checked
Patch 13/31 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
14/31 Checking commit 02a7d875317b (hw/misc/zynq_slcr: add clock generation for uarts) 15/31 Checking commit abd4b39e45cc (hw/char/cadence_uart: add clock support) 16/31 Checking commit ea507fb82a69 (hw/arm/xilinx_zynq: connect uart clocks to slcr) 17/31 Checking commit 9ff65f39fc29 (qdev-monitor: print the device's clock with info qtree) 18/31 Checking commit adab3ff8d273 (hw/arm: versal: Setup the ADMA with 128bit bus-width) 19/31 Checking commit 886d104dd971 (Cadence: gem: fix wraparound in 64bit descriptors) 20/31 Checking commit d335551dccc5 (net: cadence_gem: clear RX control descriptor) 21/31 Checking commit 281ba0a4e829 (target/arm: Vectorize integer comparison vs zero)
ERROR: spaces required around that '==' (ctx:WxB)
#529: FILE: target/arm/vec_helper.c:1272:
+DO_CMP0(gvec_ceq0_b, int8_t, ==)
^
ERROR: spaces required around that '<' (ctx:WxB)
#530: FILE: target/arm/vec_helper.c:1273:
+DO_CMP0(gvec_clt0_b, int8_t, <)
^
ERROR: spaces required around that '<=' (ctx:WxB)
#531: FILE: target/arm/vec_helper.c:1274:
+DO_CMP0(gvec_cle0_b, int8_t, <=)
^
ERROR: spaces required around that '>' (ctx:WxB)
#532: FILE: target/arm/vec_helper.c:1275:
+DO_CMP0(gvec_cgt0_b, int8_t, >)
^
ERROR: spaces required around that '>=' (ctx:WxB)
#533: FILE: target/arm/vec_helper.c:1276:
+DO_CMP0(gvec_cge0_b, int8_t, >=)
^
ERROR: spaces required around that '==' (ctx:WxB)
#535: FILE: target/arm/vec_helper.c:1278:
+DO_CMP0(gvec_ceq0_h, int16_t, ==)
^
ERROR: spaces required around that '<' (ctx:WxB)
#536: FILE: target/arm/vec_helper.c:1279:
+DO_CMP0(gvec_clt0_h, int16_t, <)
^
ERROR: spaces required around that '<=' (ctx:WxB)
#537: FILE: target/arm/vec_helper.c:1280:
+DO_CMP0(gvec_cle0_h, int16_t, <=)
^
ERROR: spaces required around that '>' (ctx:WxB)
#538: FILE: target/arm/vec_helper.c:1281:
+DO_CMP0(gvec_cgt0_h, int16_t, >)
^
ERROR: spaces required around that '>=' (ctx:WxB)
#539: FILE: target/arm/vec_helper.c:1282:
+DO_CMP0(gvec_cge0_h, int16_t, >=)
^
total: 10 errors, 0 warnings, 488 lines checked
Patch 21/31 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
22/31 Checking commit 256d88c8ec50 (hw/arm/virt: dt: move creation of /secure-chosen to create_fdt()) 23/31 Checking commit 26c5aa2e8033 (hw/arm/virt: dt: add kaslr-seed property)
24/31 Checking commit 1f8dbd12050f (target/arm: Restrict the Address Translate write operation to TCG accel) 25/31 Checking commit ac5d9f2b0eab (target/arm: Make cpu_register() available for other files) 26/31 Checking commit 6e87116ad76d (target/arm/cpu: Use ARRAY_SIZE() to iterate over ARMCPUInfo[]) 27/31 Checking commit 0c7b245988d9 (target/arm/cpu: Update coding style to make checkpatch.pl happy) 28/31 Checking commit a26ed36615e1 (device_tree: Allow name wildcards in qemu_fdt_node_path()) 29/31 Checking commit cb4770a86c1d (device_tree: Constify compat in qemu_fdt_node_path()) 30/31 Checking commit 851a7747ead2 (hw/arm: xlnx-zcu102: Move arm_boot_info into XlnxZCU102) 31/31 Checking commit cc6c93a4b886 (hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]