1
Hi; this target-arm pull request has a collection of generally
1
Handful of bugfixes for rc2. None of these are particularly critical
2
fairly minor bugs to sneak in before 3.0 rc0 tomorrow...
2
or exciting.
3
3
4
thanks
5
-- PMM
4
-- PMM
6
5
7
The following changes since commit a98ff0ec2ba3538dd766b349518ee18d03942ed8:
6
The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345:
8
7
9
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.0-20180709' into staging (2018-07-09 11:00:45 +0100)
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100)
10
9
11
are available in the Git repository at:
10
are available in the Git repository at:
12
11
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180709
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803
14
13
15
for you to fetch changes up to 8fad0a65582c0a6e324580f45516461e9b6aa439:
14
for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8:
16
15
17
hw/net/dp8393x: don't make prom region 'nomigrate' (2018-07-09 14:51:35 +0100)
16
hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100)
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
target-arm queue:
19
target-arm queue:
21
* hw/net/dp8393x: don't make prom region 'nomigrate'
20
* hw/timer/imx_epit: Avoid assertion when CR.SWR is written
22
* boards.h: Remove doc comment reference to nonexistent function
21
* netduino2, netduinoplus2, microbit: set system_clock_scale so that
23
* hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset'
22
SysTick running on the CPU clock works
24
* target/arm: Fix do_predset for large VL
23
* target/arm: Avoid maybe-uninitialized warning with gcc 4.9
25
* tcg: Restrict check_size_impl to multiples of the line size
24
* target/arm: Fix AddPAC error indication
26
* target/arm: Suppress Coverity warning for PRF
25
* Make AIRCR.SYSRESETREQ actually reset the system for the
27
* hw/timer/cmsdk-apb-timer: fix minor corner-case bugs and
26
microbit, mps2-*, musca-*, netduino* boards
28
suppress spurious warnings when running Linux's timer driver
29
* hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr
30
27
31
----------------------------------------------------------------
28
----------------------------------------------------------------
32
Eric Auger (1):
29
Kaige Li (1):
33
hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr
30
target/arm: Avoid maybe-uninitialized warning with gcc 4.9
34
31
35
Guenter Roeck (1):
32
Peter Maydell (6):
36
hw/timer/cmsdk-apb-timer: Correctly identify and set one-shot mode
33
hw/arm/netduino2, netduinoplus2: Set system_clock_scale
34
include/hw/irq.h: New function qemu_irq_is_connected()
35
hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ
36
msf2-soc, stellaris: Don't wire up SYSRESETREQ
37
hw/arm/nrf51_soc: Set system_clock_scale
38
hw/timer/imx_epit: Avoid assertion when CR.SWR is written
37
39
38
Peter Maydell (5):
40
Richard Henderson (1):
39
ptimer: Add TRIGGER_ONLY_ON_DECREMENT policy option
41
target/arm: Fix AddPAC error indication
40
hw/timer/cmsdk-apb-timer: Correct ptimer policy settings
41
hw/timer/cmsdk-apb-timer: run or stop timer on writes to RELOAD and VALUE
42
boards.h: Remove doc comment reference to nonexistent function
43
hw/net/dp8393x: don't make prom region 'nomigrate'
44
42
45
Philippe Mathieu-Daudé (1):
43
include/hw/arm/armv7m.h | 4 +++-
46
hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset'
44
include/hw/irq.h | 18 ++++++++++++++++++
45
hw/arm/msf2-soc.c | 11 -----------
46
hw/arm/netduino2.c | 10 ++++++++++
47
hw/arm/netduinoplus2.c | 10 ++++++++++
48
hw/arm/nrf51_soc.c | 5 +++++
49
hw/arm/stellaris.c | 12 ------------
50
hw/intc/armv7m_nvic.c | 17 ++++++++++++++++-
51
hw/timer/imx_epit.c | 13 ++++++++++---
52
target/arm/pauth_helper.c | 6 +++++-
53
target/arm/translate-a64.c | 2 +-
54
tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++++
55
tests/tcg/aarch64/Makefile.target | 2 +-
56
13 files changed, 112 insertions(+), 31 deletions(-)
57
create mode 100644 tests/tcg/aarch64/pauth-5.c
47
58
48
Richard Henderson (3):
49
target/arm: Suppress Coverity warning for PRF
50
tcg: Restrict check_size_impl to multiples of the line size
51
target/arm: Fix do_predset for large VL
52
53
include/hw/arm/smmu-common.h | 1 +
54
include/hw/boards.h | 3 +--
55
include/hw/ptimer.h | 9 +++++++++
56
hw/arm/smmu-common.c | 2 +-
57
hw/core/ptimer.c | 22 +++++++++++++++++++++-
58
hw/net/dp8393x.c | 2 +-
59
hw/sd/omap_mmc.c | 14 +++++++++++---
60
hw/timer/cmsdk-apb-timer.c | 20 ++++++++++++++++++--
61
target/arm/translate-sve.c | 14 ++++----------
62
tcg/tcg-op-gvec.c | 7 +++++--
63
tests/ptimer-test.c | 25 +++++++++++++++++++------
64
11 files changed, 91 insertions(+), 28 deletions(-)
65
diff view generated by jsdifflib
Deleted patch
1
From: Eric Auger <eric.auger@redhat.com>
2
1
3
smmu_iommu_mr() aims at returning the IOMMUMemoryRegion corresponding
4
to a given sid. The function extracts both the PCIe bus number and
5
the devfn to return this data. Current computation of devfn is wrong
6
as it only returns the PCIe function instead of slot | function.
7
8
Fixes 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
9
10
Signed-off-by: Eric Auger <eric.auger@redhat.com>
11
Message-id: 1530775623-32399-1-git-send-email-eric.auger@redhat.com
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
include/hw/arm/smmu-common.h | 1 +
16
hw/arm/smmu-common.c | 2 +-
17
2 files changed, 2 insertions(+), 1 deletion(-)
18
19
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/arm/smmu-common.h
22
+++ b/include/hw/arm/smmu-common.h
23
@@ -XXX,XX +XXX,XX @@
24
25
#define SMMU_PCI_BUS_MAX 256
26
#define SMMU_PCI_DEVFN_MAX 256
27
+#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
28
29
#define SMMU_MAX_VA_BITS 48
30
31
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/arm/smmu-common.c
34
+++ b/hw/arm/smmu-common.c
35
@@ -XXX,XX +XXX,XX @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid)
36
bus_n = PCI_BUS_NUM(sid);
37
smmu_bus = smmu_find_smmu_pcibus(s, bus_n);
38
if (smmu_bus) {
39
- devfn = sid & 0x7;
40
+ devfn = SMMU_PCI_DEVFN(sid);
41
smmu = smmu_bus->pbdev[devfn];
42
if (smmu) {
43
return &smmu->iommu;
44
--
45
2.17.1
46
47
diff view generated by jsdifflib
1
Currently we use memory_region_init_rom_nomigrate() to create
1
The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale
2
the "dp3893x-prom" memory region, and we don't manually register
2
global, which meant that if guest code used the systick timer in "use
3
it with vmstate_register_ram(). This currently means that its
3
the processor clock" mode it would hang because time never advances.
4
contents are migrated but as a ram block whose name is the empty
5
string; in future it may mean they are not migrated at all. Use
6
memory_region_init_ram() instead.
7
4
8
Note that this is a a cross-version migration compatibility break
5
Set the global to match the documented CPU clock speed of these boards.
9
for the MIPS "magnum" and "pica61" machines.
6
Judging by the data sheet this is slightly simplistic because the
7
SoC allows configuration of the SYSCLK source and frequency via the
8
RCC (reset and clock control) module, but we don't model that.
10
9
10
Fixes: https://bugs.launchpad.net/qemu/+bug/1876187
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Aleksandar Markovic <aleksandar.markovic@wavecomp.com>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Message-id: 20180706174309.27110-1-peter.maydell@linaro.org
13
Message-id: 20200727162617.26227-1-peter.maydell@linaro.org
14
---
14
---
15
hw/net/dp8393x.c | 2 +-
15
hw/arm/netduino2.c | 10 ++++++++++
16
1 file changed, 1 insertion(+), 1 deletion(-)
16
hw/arm/netduinoplus2.c | 10 ++++++++++
17
2 files changed, 20 insertions(+)
17
18
18
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
19
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
19
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/net/dp8393x.c
21
--- a/hw/arm/netduino2.c
21
+++ b/hw/net/dp8393x.c
22
+++ b/hw/arm/netduino2.c
22
@@ -XXX,XX +XXX,XX @@ static void dp8393x_realize(DeviceState *dev, Error **errp)
23
@@ -XXX,XX +XXX,XX @@
23
s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s);
24
#include "hw/arm/stm32f205_soc.h"
24
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */
25
#include "hw/arm/boot.h"
25
26
26
- memory_region_init_ram_nomigrate(&s->prom, OBJECT(dev),
27
+/* Main SYSCLK frequency in Hz (120MHz) */
27
+ memory_region_init_ram(&s->prom, OBJECT(dev),
28
+#define SYSCLK_FRQ 120000000ULL
28
"dp8393x-prom", SONIC_PROM_SIZE, &local_err);
29
+
29
if (local_err) {
30
static void netduino2_init(MachineState *machine)
30
error_propagate(errp, local_err);
31
{
32
DeviceState *dev;
33
34
+ /*
35
+ * TODO: ideally we would model the SoC RCC and let it handle
36
+ * system_clock_scale, including its ability to define different
37
+ * possible SYSCLK sources.
38
+ */
39
+ system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
40
+
41
dev = qdev_new(TYPE_STM32F205_SOC);
42
qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"));
43
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
44
diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/netduinoplus2.c
47
+++ b/hw/arm/netduinoplus2.c
48
@@ -XXX,XX +XXX,XX @@
49
#include "hw/arm/stm32f405_soc.h"
50
#include "hw/arm/boot.h"
51
52
+/* Main SYSCLK frequency in Hz (168MHz) */
53
+#define SYSCLK_FRQ 168000000ULL
54
+
55
static void netduinoplus2_init(MachineState *machine)
56
{
57
DeviceState *dev;
58
59
+ /*
60
+ * TODO: ideally we would model the SoC RCC and let it handle
61
+ * system_clock_scale, including its ability to define different
62
+ * possible SYSCLK sources.
63
+ */
64
+ system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
65
+
66
dev = qdev_new(TYPE_STM32F405_SOC);
67
qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4"));
68
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
31
--
69
--
32
2.17.1
70
2.20.1
33
71
34
72
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Mostly devices don't need to care whether one of their output
2
qemu_irq lines is connected, because functions like qemu_set_irq()
3
silently do nothing if there is nothing on the other end. However
4
sometimes a device might want to implement default behaviour for the
5
case where the machine hasn't wired the line up to anywhere.
2
6
3
DeviceClass::reset models a "cold power-on" reset which can
7
Provide a function qemu_irq_is_connected() that devices can use for
4
also be used to powercycle a device; but there is no "hot reset"
8
this purpose. (The test is trivial but encapsulating it in a
5
(a.k.a. soft-reset) method available.
9
function makes it easier to see where we're doing it in case we need
10
to change the implementation later.)
6
11
7
The OMAP MMC Power-Up Control bit is not designed to powercycle
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
a card, but to disable it without powering it off (pseudo-reset):
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-id: 20200728103744.6909-2-peter.maydell@linaro.org
16
---
17
include/hw/irq.h | 18 ++++++++++++++++++
18
1 file changed, 18 insertions(+)
9
19
10
Multimedia Card (MMC/SD/SDIO) Interface [SPRU765A]
20
diff --git a/include/hw/irq.h b/include/hw/irq.h
11
12
MMC_CON[11] Power-Up Control (POW)
13
This bit must be set to 1 before any valid transaction to either
14
MMC/SD or SPI memory cards.
15
When 1, the card is considered powered-up and the controller core
16
is enabled.
17
When 0, the card is considered powered-down (system dependent),
18
and the controller core logic is in pseudo-reset state. This is,
19
the MMC_STAT flags and the FIFO pointers are reset, any access to
20
MMC_DATA[DATA] has no effect, a write into the MMC.CMD register
21
is ignored, and a setting of MMC_SPI[STR] to 1 is ignored.
22
23
By splitting the 'pseudo-reset' code out of the 'power-on' reset
24
function, this patch fixes a latent bug in omap_mmc_write(MMC_CON)i
25
recently exposed by ecd219f7abb.
26
27
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
28
Message-id: 20180706162155.8432-2-f4bug@amsat.org
29
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
---
32
hw/sd/omap_mmc.c | 14 +++++++++++---
33
1 file changed, 11 insertions(+), 3 deletions(-)
34
35
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
36
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/sd/omap_mmc.c
22
--- a/include/hw/irq.h
38
+++ b/hw/sd/omap_mmc.c
23
+++ b/include/hw/irq.h
39
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
40
/*
25
on an existing vector of qemu_irq. */
41
* OMAP on-chip MMC/SD host emulation.
26
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
42
*
27
43
+ * Datasheet: TI Multimedia Card (MMC/SD/SDIO) Interface (SPRU765A)
28
+/**
29
+ * qemu_irq_is_connected: Return true if IRQ line is wired up
44
+ *
30
+ *
45
* Copyright (C) 2006-2007 Andrzej Zaborowski <balrog@zabor.org>
31
+ * If a qemu_irq has a device on the other (receiving) end of it,
46
*
32
+ * return true; otherwise return false.
47
* This program is free software; you can redistribute it and/or
33
+ *
48
@@ -XXX,XX +XXX,XX @@ static void omap_mmc_update(void *opaque)
34
+ * Usually device models don't need to care whether the machine model
49
omap_mmc_interrupts_update(s);
35
+ * has wired up their outbound qemu_irq lines, because functions like
50
}
36
+ * qemu_set_irq() silently do nothing if there is nothing on the other
51
37
+ * end of the line. However occasionally a device model will want to
52
+static void omap_mmc_pseudo_reset(struct omap_mmc_s *host)
38
+ * provide default behaviour if its output is left floating, and
39
+ * it can use this function to identify when that is the case.
40
+ */
41
+static inline bool qemu_irq_is_connected(qemu_irq irq)
53
+{
42
+{
54
+ host->status = 0;
43
+ return irq != NULL;
55
+ host->fifo_len = 0;
56
+}
44
+}
57
+
45
+
58
void omap_mmc_reset(struct omap_mmc_s *host)
46
#endif
59
{
60
host->last_cmd = 0;
61
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
62
host->dw = 0;
63
host->mode = 0;
64
host->enable = 0;
65
- host->status = 0;
66
host->mask = 0;
67
host->cto = 0;
68
host->dto = 0;
69
- host->fifo_len = 0;
70
host->blen = 0;
71
host->blen_counter = 0;
72
host->nblk = 0;
73
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
74
qemu_set_irq(host->coverswitch, host->cdet_state);
75
host->clkdiv = 0;
76
77
+ omap_mmc_pseudo_reset(host);
78
+
79
/* Since we're still using the legacy SD API the card is not plugged
80
* into any bus, and we must reset it manually. When omap_mmc is
81
* QOMified this must move into the QOM reset function.
82
@@ -XXX,XX +XXX,XX @@ static void omap_mmc_write(void *opaque, hwaddr offset,
83
if (s->dw != 0 && s->lines < 4)
84
printf("4-bit SD bus enabled\n");
85
if (!s->enable)
86
- omap_mmc_reset(s);
87
+ omap_mmc_pseudo_reset(s);
88
break;
89
90
case 0x10:    /* MMC_STAT */
91
--
47
--
92
2.17.1
48
2.20.1
93
49
94
50
diff view generated by jsdifflib
1
If the CMSDK APB timer is set up with a zero RELOAD value
1
The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals
2
then it will count down to zero, fire once and then stay
2
when the guest sets the SYSRESETREQ bit in the AIRCR register. This
3
at zero. From the point of view of the ptimer system, the
3
matches the hardware design (where the CPU has a signal of this name
4
timer is disabled; but the enable bit in the CTRL register
4
and it is up to the SoC to connect that up to an actual reset
5
is still set and if the guest subsequently writes to the
5
mechanism), but in QEMU it mostly results in duplicated code in SoC
6
RELOAD or VALUE registers this should cause the timer to
6
objects and bugs where SoC model implementors forget to wire up the
7
start counting down again.
7
SYSRESETREQ line.
8
8
9
Add code to the write paths for RELOAD and VALUE so that
9
Provide a default behaviour for the case where SYSRESETREQ is not
10
we correctly restart the timer in this situation.
10
actually connected to anything: use qemu_system_reset_request() to
11
perform a system reset. This will allow us to remove the
12
implementations of SYSRESETREQ handling from the boards where that's
13
exactly what it does, and also fixes the bugs in the board models
14
which forgot to wire up the signal:
11
15
12
Conversely, if the new RELOAD and VALUE are both zero,
16
* microbit
13
we should stop the ptimer.
17
* mps2-an385
18
* mps2-an505
19
* mps2-an511
20
* mps2-an521
21
* musca-a
22
* musca-b1
23
* netduino
24
* netduinoplus2
25
26
We still allow the board to wire up the signal if it needs to, in case
27
we need to model more complicated reset controller logic or to model
28
buggy SoC hardware which forgot to wire up the line itself. But
29
defaulting to "reset the system" is more often going to be correct
30
than defaulting to "do nothing".
14
31
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
33
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Tested-by: Guenter Roeck <linux@roeck-us.net>
34
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
18
Message-id: 20180703171044.9503-5-peter.maydell@linaro.org
35
Message-id: 20200728103744.6909-3-peter.maydell@linaro.org
19
---
36
---
20
hw/timer/cmsdk-apb-timer.c | 16 ++++++++++++++++
37
include/hw/arm/armv7m.h | 4 +++-
21
1 file changed, 16 insertions(+)
38
hw/intc/armv7m_nvic.c | 17 ++++++++++++++++-
39
2 files changed, 19 insertions(+), 2 deletions(-)
22
40
23
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
41
diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h
24
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/timer/cmsdk-apb-timer.c
43
--- a/include/hw/arm/armv7m.h
26
+++ b/hw/timer/cmsdk-apb-timer.c
44
+++ b/include/hw/arm/armv7m.h
27
@@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value,
45
@@ -XXX,XX +XXX,XX @@ typedef struct {
28
break;
46
29
case A_RELOAD:
47
/* ARMv7M container object.
30
/* Writing to reload also sets the current timer value */
48
* + Unnamed GPIO input lines: external IRQ lines for the NVIC
31
+ if (!value) {
49
- * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ
32
+ ptimer_stop(s->timer);
50
+ * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
33
+ }
51
+ * If this GPIO is not wired up then the NVIC will default to performing
34
ptimer_set_limit(s->timer, value, 1);
52
+ * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
35
+ if (value && (s->ctrl & R_CTRL_EN_MASK)) {
53
* + Property "cpu-type": CPU type to instantiate
36
+ /*
54
* + Property "num-irq": number of external IRQ lines
37
+ * Make sure timer is running (it might have stopped if this
55
* + Property "memory": MemoryRegion defining the physical address space
38
+ * was an expired one-shot timer)
56
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
39
+ */
57
index XXXXXXX..XXXXXXX 100644
40
+ ptimer_run(s->timer, 0);
58
--- a/hw/intc/armv7m_nvic.c
41
+ }
59
+++ b/hw/intc/armv7m_nvic.c
42
break;
60
@@ -XXX,XX +XXX,XX @@
43
case A_VALUE:
61
#include "hw/intc/armv7m_nvic.h"
44
+ if (!value && !ptimer_get_limit(s->timer)) {
62
#include "hw/irq.h"
45
+ ptimer_stop(s->timer);
63
#include "hw/qdev-properties.h"
46
+ }
64
+#include "sysemu/runstate.h"
47
ptimer_set_count(s->timer, value);
65
#include "target/arm/cpu.h"
48
+ if (value && (s->ctrl & R_CTRL_EN_MASK)) {
66
#include "exec/exec-all.h"
49
+ ptimer_run(s->timer, ptimer_get_limit(s->timer) == 0);
67
#include "exec/memop.h"
50
+ }
68
@@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = {
51
break;
69
0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1
52
case A_INTSTATUS:
70
};
53
/* Just one bit, which is W1C. */
71
72
+static void signal_sysresetreq(NVICState *s)
73
+{
74
+ if (qemu_irq_is_connected(s->sysresetreq)) {
75
+ qemu_irq_pulse(s->sysresetreq);
76
+ } else {
77
+ /*
78
+ * Default behaviour if the SoC doesn't need to wire up
79
+ * SYSRESETREQ (eg to a system reset controller of some kind):
80
+ * perform a system reset via the usual QEMU API.
81
+ */
82
+ qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
83
+ }
84
+}
85
+
86
static int nvic_pending_prio(NVICState *s)
87
{
88
/* return the group priority of the current pending interrupt,
89
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
90
if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) {
91
if (attrs.secure ||
92
!(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) {
93
- qemu_irq_pulse(s->sysresetreq);
94
+ signal_sysresetreq(s);
95
}
96
}
97
if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) {
54
--
98
--
55
2.17.1
99
2.20.1
56
100
57
101
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The MSF2 SoC model and the Stellaris board code both wire
2
SYSRESETREQ up to a function that just invokes
3
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
4
This is now the default action that the NVIC does if the line is
5
not connected, so we can delete the handling code.
2
6
3
Normally this is automatic in the size restrictions that are placed
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
on vector sizes coming from the implementation. However, for the
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
legitimate size tuple [oprsz=8, maxsz=32], we need to clear the final
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
6
24 bytes of the vector register. Without this check, do_dup selects
10
Message-id: 20200728103744.6909-4-peter.maydell@linaro.org
7
TCG_TYPE_V128 and clears only 16 bytes.
11
---
12
hw/arm/msf2-soc.c | 11 -----------
13
hw/arm/stellaris.c | 12 ------------
14
2 files changed, 23 deletions(-)
8
15
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Tested-by: Alex Bennée <alex.bennee@linaro.org>
12
Message-id: 20180705191929.30773-2-richard.henderson@linaro.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
tcg/tcg-op-gvec.c | 7 +++++--
16
1 file changed, 5 insertions(+), 2 deletions(-)
17
18
diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
19
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
20
--- a/tcg/tcg-op-gvec.c
18
--- a/hw/arm/msf2-soc.c
21
+++ b/tcg/tcg-op-gvec.c
19
+++ b/hw/arm/msf2-soc.c
22
@@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs,
20
@@ -XXX,XX +XXX,XX @@
23
in units of LNSZ. This limits the expansion of inline code. */
21
#include "hw/irq.h"
24
static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz)
22
#include "hw/arm/msf2-soc.h"
23
#include "hw/misc/unimp.h"
24
-#include "sysemu/runstate.h"
25
#include "sysemu/sysemu.h"
26
27
#define MSF2_TIMER_BASE 0x40004000
28
@@ -XXX,XX +XXX,XX @@ static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };
29
static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };
30
static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };
31
32
-static void do_sys_reset(void *opaque, int n, int level)
33
-{
34
- if (level) {
35
- qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
36
- }
37
-}
38
-
39
static void m2sxxx_soc_initfn(Object *obj)
25
{
40
{
26
- uint32_t lnct = oprsz / lnsz;
41
MSF2State *s = MSF2_SOC(obj);
27
- return lnct >= 1 && lnct <= MAX_UNROLL;
42
@@ -XXX,XX +XXX,XX @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
28
+ if (oprsz % lnsz == 0) {
43
return;
29
+ uint32_t lnct = oprsz / lnsz;
44
}
30
+ return lnct >= 1 && lnct <= MAX_UNROLL;
45
31
+ }
46
- qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0,
32
+ return false;
47
- qemu_allocate_irq(&do_sys_reset, NULL, 0));
48
-
49
system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;
50
51
for (i = 0; i < MSF2_NUM_UARTS; i++) {
52
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/stellaris.c
55
+++ b/hw/arm/stellaris.c
56
@@ -XXX,XX +XXX,XX @@
57
#include "hw/boards.h"
58
#include "qemu/log.h"
59
#include "exec/address-spaces.h"
60
-#include "sysemu/runstate.h"
61
#include "sysemu/sysemu.h"
62
#include "hw/arm/armv7m.h"
63
#include "hw/char/pl011.h"
64
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj)
65
qdev_init_gpio_in(dev, stellaris_adc_trigger, 1);
33
}
66
}
34
67
35
static void expand_clr(uint32_t dofs, uint32_t maxsz);
68
-static
69
-void do_sys_reset(void *opaque, int n, int level)
70
-{
71
- if (level) {
72
- qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
73
- }
74
-}
75
-
76
/* Board init. */
77
static stellaris_board_info stellaris_boards[] = {
78
{ "LM3S811EVB",
79
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
80
/* This will exit with an error if the user passed us a bad cpu_type */
81
sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal);
82
83
- qdev_connect_gpio_out_named(nvic, "SYSRESETREQ", 0,
84
- qemu_allocate_irq(&do_sys_reset, NULL, 0));
85
-
86
if (board->dc1 & (1 << 16)) {
87
dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000,
88
qdev_get_gpio_in(nvic, 14),
36
--
89
--
37
2.17.1
90
2.20.1
38
91
39
92
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Use MAKE_64BIT_MASK instead of open-coding. Remove an odd
3
The definition of top_bit used in this function is one higher
4
vector size check that is unlikely to be more profitable
4
than that used in the Arm ARM psuedo-code, which put the error
5
than 3 64-bit integer stores. Correct the iteration for WORD
5
indication at top_bit - 1 at the wrong place, which meant that
6
to avoid writing too much data.
6
it wasn't visible to Auth.
7
7
8
Fixes RISU tests of PTRUE for VL 256.
8
Fixing the definition of top_bit requires more changes, because
9
its most common use is for the count of bits in top_bit:bot_bit,
10
which would then need to be computed as top_bit - bot_bit + 1.
9
11
12
For now, prefer the minimal fix to the error indication alone.
13
14
Fixes: 63ff0ca94cb
15
Reported-by: Derrick McKee <derrick.mckee@gmail.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
17
Message-id: 20200728195706.11087-1-richard.henderson@linaro.org
12
Tested-by: Alex Bennée <alex.bennee@linaro.org>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Message-id: 20180705191929.30773-3-richard.henderson@linaro.org
19
[PMM: added comment about the divergence from the pseudocode]
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
21
---
16
target/arm/translate-sve.c | 10 ++--------
22
target/arm/pauth_helper.c | 6 +++++-
17
1 file changed, 2 insertions(+), 8 deletions(-)
23
tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++
24
tests/tcg/aarch64/Makefile.target | 2 +-
25
3 files changed, 39 insertions(+), 2 deletions(-)
26
create mode 100644 tests/tcg/aarch64/pauth-5.c
18
27
19
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
28
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
20
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate-sve.c
30
--- a/target/arm/pauth_helper.c
22
+++ b/target/arm/translate-sve.c
31
+++ b/target/arm/pauth_helper.c
23
@@ -XXX,XX +XXX,XX @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag)
32
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
24
setsz = numelem << esz;
33
*/
25
lastword = word = pred_esz_masks[esz];
34
test = sextract64(ptr, bot_bit, top_bit - bot_bit);
26
if (setsz % 64) {
35
if (test != 0 && test != -1) {
27
- lastword &= ~(-1ull << (setsz % 64));
36
- pac ^= MAKE_64BIT_MASK(top_bit - 1, 1);
28
+ lastword &= MAKE_64BIT_MASK(0, setsz % 64);
37
+ /*
29
}
38
+ * Note that our top_bit is one greater than the pseudocode's
39
+ * version, hence "- 2" here.
40
+ */
41
+ pac ^= MAKE_64BIT_MASK(top_bit - 2, 1);
30
}
42
}
31
43
32
@@ -XXX,XX +XXX,XX @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag)
44
/*
33
tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word);
45
diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c
34
goto done;
46
new file mode 100644
35
}
47
index XXXXXXX..XXXXXXX
36
- if (oprsz * 8 == setsz + 8) {
48
--- /dev/null
37
- tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word);
49
+++ b/tests/tcg/aarch64/pauth-5.c
38
- tcg_gen_movi_i64(t, 0);
50
@@ -XXX,XX +XXX,XX @@
39
- tcg_gen_st_i64(t, cpu_env, ofs + oprsz - 8);
51
+#include <assert.h>
40
- goto done;
52
+
41
- }
53
+static int x;
42
}
54
+
43
55
+int main()
44
setsz /= 8;
56
+{
45
fullsz /= 8;
57
+ int *p0 = &x, *p1, *p2, *p3;
46
58
+ unsigned long salt = 0;
47
tcg_gen_movi_i64(t, word);
59
+
48
- for (i = 0; i < setsz; i += 8) {
60
+ /*
49
+ for (i = 0; i < QEMU_ALIGN_DOWN(setsz, 8); i += 8) {
61
+ * With TBI enabled and a 48-bit VA, there are 7 bits of auth, and so
50
tcg_gen_st_i64(t, cpu_env, ofs + i);
62
+ * a 1/128 chance of auth = pac(ptr,key,salt) producing zero.
51
}
63
+ * Find a salt that creates auth != 0.
52
if (lastword != word) {
64
+ */
65
+ do {
66
+ salt++;
67
+ asm("pacda %0, %1" : "=r"(p1) : "r"(salt), "0"(p0));
68
+ } while (p0 == p1);
69
+
70
+ /*
71
+ * This pac must fail, because the input pointer bears an encryption,
72
+ * and so is not properly extended within bits [55:47]. This will
73
+ * toggle bit 54 in the output...
74
+ */
75
+ asm("pacda %0, %1" : "=r"(p2) : "r"(salt), "0"(p1));
76
+
77
+ /* ... so that the aut must fail, setting bit 53 in the output ... */
78
+ asm("autda %0, %1" : "=r"(p3) : "r"(salt), "0"(p2));
79
+
80
+ /* ... which means this equality must not hold. */
81
+ assert(p3 != p0);
82
+ return 0;
83
+}
84
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
85
index XXXXXXX..XXXXXXX 100644
86
--- a/tests/tcg/aarch64/Makefile.target
87
+++ b/tests/tcg/aarch64/Makefile.target
88
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
89
90
# Pauth Tests
91
ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_3),)
92
-AARCH64_TESTS += pauth-1 pauth-2 pauth-4
93
+AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5
94
pauth-%: CFLAGS += -march=armv8.3-a
95
run-pauth-%: QEMU_OPTS += -cpu max
96
run-plugin-pauth-%: QEMU_OPTS += -cpu max
53
--
97
--
54
2.17.1
98
2.20.1
55
99
56
100
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Kaige Li <likaige@loongson.cn>
2
2
3
The CMSDK APB timer is currently always configured as periodic timer.
3
GCC version 4.9.4 isn't clever enough to figure out that all
4
This results in the following messages when trying to boot Linux.
4
execution paths in disas_ldst() that use 'fn' will have initialized
5
it first, and so it warns:
5
6
6
Timer with delta zero, disabling
7
/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
8
/home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
9
fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
10
^
11
/home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
12
AtomicThreeOpFn *fn;
13
^
7
14
8
If the timer limit set with the RELOAD command is 0, the timer
15
Make it happy by initializing the variable to NULL.
9
needs to be enabled as one-shot timer.
10
16
11
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
17
Signed-off-by: Kaige Li <likaige@loongson.cn>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Tested-by: Guenter Roeck <linux@roeck-us.net>
20
[PMM: Clean up commit message and note which gcc version this was]
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
22
---
17
hw/timer/cmsdk-apb-timer.c | 2 +-
23
target/arm/translate-a64.c | 2 +-
18
1 file changed, 1 insertion(+), 1 deletion(-)
24
1 file changed, 1 insertion(+), 1 deletion(-)
19
25
20
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
26
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
21
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/timer/cmsdk-apb-timer.c
28
--- a/target/arm/translate-a64.c
23
+++ b/hw/timer/cmsdk-apb-timer.c
29
+++ b/target/arm/translate-a64.c
24
@@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value,
30
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
25
}
31
bool r = extract32(insn, 22, 1);
26
s->ctrl = value & 0xf;
32
bool a = extract32(insn, 23, 1);
27
if (s->ctrl & R_CTRL_EN_MASK) {
33
TCGv_i64 tcg_rs, clean_addr;
28
- ptimer_run(s->timer, 0);
34
- AtomicThreeOpFn *fn;
29
+ ptimer_run(s->timer, ptimer_get_limit(s->timer) == 0);
35
+ AtomicThreeOpFn *fn = NULL;
30
} else {
36
31
ptimer_stop(s->timer);
37
if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
32
}
38
unallocated_encoding(s);
33
--
39
--
34
2.17.1
40
2.20.1
35
41
36
42
diff view generated by jsdifflib
1
The CMSDK timer behaviour is that an interrupt is triggered when the
1
The nrf51 SoC model wasn't setting the system_clock_scale
2
counter counts down from 1 to 0; however one is not triggered if the
2
global.which meant that if guest code used the systick timer in "use
3
counter is manually set to 0 by a guest write to the counter register.
3
the processor clock" mode it would hang because time never advances.
4
Currently ptimer can't handle this; add a policy option to allow
4
5
a ptimer user to request this behaviour.
5
Set the global to match the documented CPU clock speed for this SoC.
6
7
This SoC in fact doesn't have a SysTick timer (which is the only thing
8
currently that cares about the system_clock_scale), because it's
9
a configurable option in the Cortex-M0. However our Cortex-M0 and
10
thus our nrf51 and our micro:bit board do provide a SysTick, so
11
we ought to provide a functional one rather than a broken one.
6
12
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Tested-by: Guenter Roeck <linux@roeck-us.net>
15
Message-id: 20200727193458.31250-1-peter.maydell@linaro.org
10
Message-id: 20180703171044.9503-2-peter.maydell@linaro.org
11
---
16
---
12
include/hw/ptimer.h | 9 +++++++++
17
hw/arm/nrf51_soc.c | 5 +++++
13
hw/core/ptimer.c | 22 +++++++++++++++++++++-
18
1 file changed, 5 insertions(+)
14
tests/ptimer-test.c | 25 +++++++++++++++++++------
15
3 files changed, 49 insertions(+), 7 deletions(-)
16
19
17
diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
20
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
18
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/ptimer.h
22
--- a/hw/arm/nrf51_soc.c
20
+++ b/include/hw/ptimer.h
23
+++ b/hw/arm/nrf51_soc.c
21
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@
22
* not the one less. */
25
23
#define PTIMER_POLICY_NO_COUNTER_ROUND_DOWN (1 << 4)
26
#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
24
27
25
+/*
28
+/* HCLK (the main CPU clock) on this SoC is always 16MHz */
26
+ * Starting to run with a zero counter, or setting the counter to "0" via
29
+#define HCLK_FRQ 16000000
27
+ * ptimer_set_count() or ptimer_set_limit() will not trigger the timer
28
+ * (though it will cause a reload). Only a counter decrement to "0"
29
+ * will cause a trigger. Not compatible with NO_IMMEDIATE_TRIGGER;
30
+ * ptimer_init() will assert() that you don't set both.
31
+ */
32
+#define PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT (1 << 5)
33
+
30
+
34
/* ptimer.c */
31
static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
35
typedef struct ptimer_state ptimer_state;
32
{
36
typedef void (*ptimer_cb)(void *opaque);
33
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
37
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
34
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
38
index XXXXXXX..XXXXXXX 100644
35
return;
39
--- a/hw/core/ptimer.c
40
+++ b/hw/core/ptimer.c
41
@@ -XXX,XX +XXX,XX @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)
42
uint32_t period_frac = s->period_frac;
43
uint64_t period = s->period;
44
uint64_t delta = s->delta;
45
+ bool suppress_trigger = false;
46
47
- if (delta == 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)) {
48
+ /*
49
+ * Note that if delta_adjust is 0 then we must be here because of
50
+ * a count register write or timer start, not because of timer expiry.
51
+ * In that case the policy might require us to suppress the timer trigger
52
+ * that we would otherwise generate for a zero delta.
53
+ */
54
+ if (delta_adjust == 0 &&
55
+ (s->policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT)) {
56
+ suppress_trigger = true;
57
+ }
58
+ if (delta == 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)
59
+ && !suppress_trigger) {
60
ptimer_trigger(s);
61
}
36
}
62
37
63
@@ -XXX,XX +XXX,XX @@ ptimer_state *ptimer_init(QEMUBH *bh, uint8_t policy_mask)
38
+ system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ;
64
s->bh = bh;
65
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ptimer_tick, s);
66
s->policy_mask = policy_mask;
67
+
39
+
68
+ /*
40
object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container),
69
+ * These two policies are incompatible -- trigger-on-decrement implies
41
&error_abort);
70
+ * a timer trigger when the count becomes 0, but no-immediate-trigger
42
if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) {
71
+ * implies a trigger when the count stops being 0.
72
+ */
73
+ assert(!((policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) &&
74
+ (policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)));
75
return s;
76
}
77
78
diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c
79
index XXXXXXX..XXXXXXX 100644
80
--- a/tests/ptimer-test.c
81
+++ b/tests/ptimer-test.c
82
@@ -XXX,XX +XXX,XX @@ static void check_periodic(gconstpointer arg)
83
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
84
bool no_immediate_reload = (*policy & PTIMER_POLICY_NO_IMMEDIATE_RELOAD);
85
bool no_round_down = (*policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
86
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
87
88
triggered = false;
89
90
@@ -XXX,XX +XXX,XX @@ static void check_periodic(gconstpointer arg)
91
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
92
no_immediate_reload ? 0 : 10);
93
94
- if (no_immediate_trigger) {
95
+ if (no_immediate_trigger || trig_only_on_dec) {
96
g_assert_false(triggered);
97
} else {
98
g_assert_true(triggered);
99
@@ -XXX,XX +XXX,XX @@ static void check_run_with_delta_0(gconstpointer arg)
100
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
101
bool no_immediate_reload = (*policy & PTIMER_POLICY_NO_IMMEDIATE_RELOAD);
102
bool no_round_down = (*policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
103
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
104
105
triggered = false;
106
107
@@ -XXX,XX +XXX,XX @@ static void check_run_with_delta_0(gconstpointer arg)
108
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
109
no_immediate_reload ? 0 : 99);
110
111
- if (no_immediate_trigger) {
112
+ if (no_immediate_trigger || trig_only_on_dec) {
113
g_assert_false(triggered);
114
} else {
115
g_assert_true(triggered);
116
@@ -XXX,XX +XXX,XX @@ static void check_run_with_delta_0(gconstpointer arg)
117
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
118
no_immediate_reload ? 0 : 99);
119
120
- if (no_immediate_trigger) {
121
+ if (no_immediate_trigger || trig_only_on_dec) {
122
g_assert_false(triggered);
123
} else {
124
g_assert_true(triggered);
125
@@ -XXX,XX +XXX,XX @@ static void check_periodic_with_load_0(gconstpointer arg)
126
ptimer_state *ptimer = ptimer_init(bh, *policy);
127
bool continuous_trigger = (*policy & PTIMER_POLICY_CONTINUOUS_TRIGGER);
128
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
129
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
130
131
triggered = false;
132
133
@@ -XXX,XX +XXX,XX @@ static void check_periodic_with_load_0(gconstpointer arg)
134
135
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
136
137
- if (no_immediate_trigger) {
138
+ if (no_immediate_trigger || trig_only_on_dec) {
139
g_assert_false(triggered);
140
} else {
141
g_assert_true(triggered);
142
@@ -XXX,XX +XXX,XX @@ static void check_oneshot_with_load_0(gconstpointer arg)
143
QEMUBH *bh = qemu_bh_new(ptimer_trigger, NULL);
144
ptimer_state *ptimer = ptimer_init(bh, *policy);
145
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
146
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
147
148
triggered = false;
149
150
@@ -XXX,XX +XXX,XX @@ static void check_oneshot_with_load_0(gconstpointer arg)
151
152
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
153
154
- if (no_immediate_trigger) {
155
+ if (no_immediate_trigger || trig_only_on_dec) {
156
g_assert_false(triggered);
157
} else {
158
g_assert_true(triggered);
159
@@ -XXX,XX +XXX,XX @@ static void add_ptimer_tests(uint8_t policy)
160
g_strlcat(policy_name, "no_counter_rounddown,", 256);
161
}
162
163
+ if (policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) {
164
+ g_strlcat(policy_name, "trigger_only_on_decrement,", 256);
165
+ }
166
+
167
g_test_add_data_func_full(
168
tmp = g_strdup_printf("/ptimer/set_count policy=%s", policy_name),
169
g_memdup(&policy, 1), check_set_count, g_free);
170
@@ -XXX,XX +XXX,XX @@ static void add_ptimer_tests(uint8_t policy)
171
172
static void add_all_ptimer_policies_comb_tests(void)
173
{
174
- int last_policy = PTIMER_POLICY_NO_COUNTER_ROUND_DOWN;
175
+ int last_policy = PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT;
176
int policy = PTIMER_POLICY_DEFAULT;
177
178
for (; policy < (last_policy << 1); policy++) {
179
+ if ((policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) &&
180
+ (policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)) {
181
+ /* Incompatible policy flag settings -- don't try to test them */
182
+ continue;
183
+ }
184
add_ptimer_tests(policy);
185
}
186
}
187
--
43
--
188
2.17.1
44
2.20.1
189
45
190
46
diff view generated by jsdifflib
Deleted patch
1
The CMSDK timer interrupt triggers when the counter goes from 1 to 0,
2
so we want to trigger immediately, rather than waiting for a
3
clock cycle. Drop the incorrect NO_IMMEDIATE_TRIGGER setting.
4
We also do not want to get an interrupt if the guest sets the
5
counter directly to zero, so use the new TRIGGER_ONLY_ON_DECREMENT
6
policy.
7
1
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Tested-by: Guenter Roeck <linux@roeck-us.net>
11
Message-id: 20180703171044.9503-3-peter.maydell@linaro.org
12
---
13
hw/timer/cmsdk-apb-timer.c | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
16
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/timer/cmsdk-apb-timer.c
19
+++ b/hw/timer/cmsdk-apb-timer.c
20
@@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp)
21
bh = qemu_bh_new(cmsdk_apb_timer_tick, s);
22
s->timer = ptimer_init(bh,
23
PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD |
24
- PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
25
+ PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT |
26
PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
27
PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
28
29
--
30
2.17.1
31
32
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The imx_epit device has a software-controllable reset triggered by
2
setting the SWR bit in the CR register. An error in commit cc2722ec83ad9
3
means that we will end up assert()ing if the guest does this, because
4
the code in imx_epit_write() starts ptimer transactions, and then
5
imx_epit_reset() also starts ptimer transactions, triggering
6
"ptimer_transaction_begin: Assertion `!s->in_transaction' failed".
2
7
3
These instructions must perform the sve_access_check, but
8
The cleanest way to avoid this double-transaction is to move the
4
since they are implemented as NOPs there is no generated
9
start-transaction for the CR write handling down below the check of
5
code to elide when the access check fails.
10
the SWR bit.
6
11
7
Fixes: Coverity issues 1393780 & 1393779.
12
Fixes: https://bugs.launchpad.net/qemu/+bug/1880424
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Fixes: cc2722ec83ad944505fe
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Message-id: 20200727154550.3409-1-peter.maydell@linaro.org
11
---
17
---
12
target/arm/translate-sve.c | 4 ++--
18
hw/timer/imx_epit.c | 13 ++++++++++---
13
1 file changed, 2 insertions(+), 2 deletions(-)
19
1 file changed, 10 insertions(+), 3 deletions(-)
14
20
15
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
21
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-sve.c
23
--- a/hw/timer/imx_epit.c
18
+++ b/target/arm/translate-sve.c
24
+++ b/hw/timer/imx_epit.c
19
@@ -XXX,XX +XXX,XX @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a, uint32_t insn)
25
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
20
static bool trans_PRF(DisasContext *s, arg_PRF *a, uint32_t insn)
26
21
{
27
switch (offset >> 2) {
22
/* Prefetch is a nop within QEMU. */
28
case 0: /* CR */
23
- sve_access_check(s);
29
- ptimer_transaction_begin(s->timer_cmp);
24
+ (void)sve_access_check(s);
30
- ptimer_transaction_begin(s->timer_reload);
25
return true;
31
26
}
32
oldcr = s->cr;
27
33
s->cr = value & 0x03ffffff;
28
@@ -XXX,XX +XXX,XX @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a, uint32_t insn)
34
if (s->cr & CR_SWR) {
29
return false;
35
/* handle the reset */
30
}
36
imx_epit_reset(DEVICE(s));
31
/* Prefetch is a nop within QEMU. */
37
- } else {
32
- sve_access_check(s);
38
+ /*
33
+ (void)sve_access_check(s);
39
+ * TODO: could we 'break' here? following operations appear
34
return true;
40
+ * to duplicate the work imx_epit_reset() already did.
35
}
41
+ */
42
+ }
43
+
44
+ ptimer_transaction_begin(s->timer_cmp);
45
+ ptimer_transaction_begin(s->timer_reload);
46
+
47
+ if (!(s->cr & CR_SWR)) {
48
imx_epit_set_freq(s);
49
}
36
50
37
--
51
--
38
2.17.1
52
2.20.1
39
53
40
54
diff view generated by jsdifflib
Deleted patch
1
commit b08199c6fbea1 accidentally added a reference to a doc
2
comment to a nonexistent memory_region_allocate_aux_memory().
3
This was a leftover from a previous version of the patchset
4
which defined memory_region_allocate_aux_memory() for
5
"allocate RAM MemoryRegion and register it for migration"
6
and left "memory_region_init_ram()" with its original semantics
7
of "allocate RAM MR but do not register for migration". In
8
the end we decided on the approach of "memory_region_init_ram()
9
registers the MR for migration, and memory_region_init_ram_nomigrate()
10
is a new function which does not", but this comment change
11
got left in by mistake. Revert that part of the commit.
12
1
13
Reported-by: Thomas Huth <huth@tuxfamily.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Message-id: 20180702130605.13611-1-peter.maydell@linaro.org
16
---
17
include/hw/boards.h | 3 +--
18
1 file changed, 1 insertion(+), 2 deletions(-)
19
20
diff --git a/include/hw/boards.h b/include/hw/boards.h
21
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/boards.h
23
+++ b/include/hw/boards.h
24
@@ -XXX,XX +XXX,XX @@
25
*
26
* Smaller pieces of memory (display RAM, static RAMs, etc) don't need
27
* to be backed via the -mem-path memory backend and can simply
28
- * be created via memory_region_allocate_aux_memory() or
29
- * memory_region_init_ram().
30
+ * be created via memory_region_init_ram().
31
*/
32
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
33
const char *name,
34
--
35
2.17.1
36
37
diff view generated by jsdifflib