1
A last arm pullreq before rc0. This is mostly bug fixes,
1
Handful of bugfixes for rc2. None of these are particularly critical
2
though you could call adding the missing local timer
2
or exciting.
3
support to bcm2836_control a new feature I suppose --
4
in any case it's a small and localised change.
5
3
6
thanks
7
-- PMM
4
-- PMM
8
5
9
The following changes since commit 7074ab12c81a1b2b1e0e1c40983f56b2c5ccc494:
6
The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345:
10
7
11
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-03-14 16:19:37 +0000)
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100)
12
9
13
are available in the Git repository at:
10
are available in the Git repository at:
14
11
15
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190315
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803
16
13
17
for you to fetch changes up to 5de56742a3c91de3d646326bec43a989bba83ca4:
14
for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8:
18
15
19
target/arm: Check access permission to ADDVL/ADDPL/RDVL (2019-03-15 11:12:29 +0000)
16
hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100)
20
17
21
----------------------------------------------------------------
18
----------------------------------------------------------------
22
target-arm queue:
19
target-arm queue:
23
* Add missing SVE-enabled check to ADDVL/ADDPL/RDVL
20
* hw/timer/imx_epit: Avoid assertion when CR.SWR is written
24
* virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number
21
* netduino2, netduinoplus2, microbit: set system_clock_scale so that
25
* virt-acpi-build: Fix SMMUv3 GSIV values
22
SysTick running on the CPU clock works
26
* Allow EL0 to write to arch timer registers, not just read them
23
* target/arm: Avoid maybe-uninitialized warning with gcc 4.9
27
* bcm2836_control: Implement local timer
24
* target/arm: Fix AddPAC error indication
25
* Make AIRCR.SYSRESETREQ actually reset the system for the
26
microbit, mps2-*, musca-*, netduino* boards
28
27
29
----------------------------------------------------------------
28
----------------------------------------------------------------
30
Amir Charif (1):
29
Kaige Li (1):
31
target/arm: Check access permission to ADDVL/ADDPL/RDVL
30
target/arm: Avoid maybe-uninitialized warning with gcc 4.9
32
31
33
Dongjiu Geng (1):
32
Peter Maydell (6):
34
target/arm: change arch timer registers access permission
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
35
39
36
Eric Auger (1):
40
Richard Henderson (1):
37
hw/arm/virt-acpi-build: Fix SMMUv3 GSIV values
41
target/arm: Fix AddPAC error indication
38
42
39
Wei Yang (1):
43
include/hw/arm/armv7m.h | 4 +++-
40
hw/arm/virt-acpi-build: use PCIE_MMCFG_BUS to retrieve end_bus_number
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
41
58
42
Zoltán Baldaszti (1):
43
hw/intc/bcm2836_control: Implement local timer
44
45
include/hw/intc/bcm2836_control.h | 9 ++++
46
hw/arm/virt-acpi-build.c | 6 +--
47
hw/intc/bcm2836_control.c | 101 +++++++++++++++++++++++++++++++++++++-
48
target/arm/helper.c | 30 +++++------
49
target/arm/translate-sve.c | 22 ++++++---
50
5 files changed, 140 insertions(+), 28 deletions(-)
51
diff view generated by jsdifflib
1
From: Wei Yang <richardw.yang@linux.intel.com>
1
The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale
2
global, which meant that if guest code used the systick timer in "use
3
the processor clock" mode it would hang because time never advances.
2
4
3
This is more proper to use PCIE_MMCFG_BUS to retrieve end_bus_number.
5
Set the global to match the documented CPU clock speed of these boards.
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.
4
9
5
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
10
Fixes: https://bugs.launchpad.net/qemu/+bug/1876187
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
7
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
8
Message-id: 20190312074953.16671-1-richardw.yang@linux.intel.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Message-id: 20200727162617.26227-1-peter.maydell@linaro.org
10
---
14
---
11
hw/arm/virt-acpi-build.c | 4 ++--
15
hw/arm/netduino2.c | 10 ++++++++++
12
1 file changed, 2 insertions(+), 2 deletions(-)
16
hw/arm/netduinoplus2.c | 10 ++++++++++
17
2 files changed, 20 insertions(+)
13
18
14
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
19
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/virt-acpi-build.c
21
--- a/hw/arm/netduino2.c
17
+++ b/hw/arm/virt-acpi-build.c
22
+++ b/hw/arm/netduino2.c
18
@@ -XXX,XX +XXX,XX @@ build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
23
@@ -XXX,XX +XXX,XX @@
19
/* Only a single allocation so no need to play with segments */
24
#include "hw/arm/stm32f205_soc.h"
20
mcfg->allocation[0].pci_segment = cpu_to_le16(0);
25
#include "hw/arm/boot.h"
21
mcfg->allocation[0].start_bus_number = 0;
26
22
- mcfg->allocation[0].end_bus_number = (memmap[ecam_id].size
27
+/* Main SYSCLK frequency in Hz (120MHz) */
23
- / PCIE_MMCFG_SIZE_MIN) - 1;
28
+#define SYSCLK_FRQ 120000000ULL
24
+ mcfg->allocation[0].end_bus_number =
29
+
25
+ PCIE_MMCFG_BUS(memmap[ecam_id].size - 1);
30
static void netduino2_init(MachineState *machine)
26
31
{
27
build_header(linker, table_data, (void *)(table_data->data + mcfg_start),
32
DeviceState *dev;
28
"MCFG", table_data->len - mcfg_start, 1, NULL, NULL);
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);
29
--
69
--
30
2.20.1
70
2.20.1
31
71
32
72
diff view generated by jsdifflib
New patch
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.
1
6
7
Provide a function qemu_irq_is_connected() that devices can use for
8
this purpose. (The test is trivial but encapsulating it in a
9
function makes it easier to see where we're doing it in case we need
10
to change the implementation later.)
11
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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(+)
19
20
diff --git a/include/hw/irq.h b/include/hw/irq.h
21
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/irq.h
23
+++ b/include/hw/irq.h
24
@@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
25
on an existing vector of qemu_irq. */
26
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
27
28
+/**
29
+ * qemu_irq_is_connected: Return true if IRQ line is wired up
30
+ *
31
+ * If a qemu_irq has a device on the other (receiving) end of it,
32
+ * return true; otherwise return false.
33
+ *
34
+ * Usually device models don't need to care whether the machine model
35
+ * has wired up their outbound qemu_irq lines, because functions like
36
+ * qemu_set_irq() silently do nothing if there is nothing on the other
37
+ * end of the line. However occasionally a device model will want to
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)
42
+{
43
+ return irq != NULL;
44
+}
45
+
46
#endif
47
--
48
2.20.1
49
50
diff view generated by jsdifflib
1
From: Zoltán Baldaszti <bztemail@gmail.com>
1
The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals
2
when the guest sets the SYSRESETREQ bit in the AIRCR register. This
3
matches the hardware design (where the CPU has a signal of this name
4
and it is up to the SoC to connect that up to an actual reset
5
mechanism), but in QEMU it mostly results in duplicated code in SoC
6
objects and bugs where SoC model implementors forget to wire up the
7
SYSRESETREQ line.
2
8
3
The BCM2836 control logic module includes a simple
9
Provide a default behaviour for the case where SYSRESETREQ is not
4
"local timer" which is a programmable down-counter that
10
actually connected to anything: use qemu_system_reset_request() to
5
can generates an interrupt. Implement this functionality.
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:
6
15
7
Signed-off-by: Zoltán Baldaszti <bztemail@gmail.com>
16
* microbit
8
[PMM: wrote commit message; wrapped long line; tweaked
17
* mps2-an385
9
some comments to match the final version of the code]
18
* mps2-an505
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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".
31
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
34
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
35
Message-id: 20200728103744.6909-3-peter.maydell@linaro.org
12
---
36
---
13
include/hw/intc/bcm2836_control.h | 9 +++
37
include/hw/arm/armv7m.h | 4 +++-
14
hw/intc/bcm2836_control.c | 101 +++++++++++++++++++++++++++++-
38
hw/intc/armv7m_nvic.c | 17 ++++++++++++++++-
15
2 files changed, 108 insertions(+), 2 deletions(-)
39
2 files changed, 19 insertions(+), 2 deletions(-)
16
40
17
diff --git a/include/hw/intc/bcm2836_control.h b/include/hw/intc/bcm2836_control.h
41
diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h
18
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/intc/bcm2836_control.h
43
--- a/include/hw/arm/armv7m.h
20
+++ b/include/hw/intc/bcm2836_control.h
44
+++ b/include/hw/arm/armv7m.h
45
@@ -XXX,XX +XXX,XX @@ typedef struct {
46
47
/* ARMv7M container object.
48
* + Unnamed GPIO input lines: external IRQ lines for the NVIC
49
- * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ
50
+ * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
51
+ * If this GPIO is not wired up then the NVIC will default to performing
52
+ * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
53
* + Property "cpu-type": CPU type to instantiate
54
* + Property "num-irq": number of external IRQ lines
55
* + Property "memory": MemoryRegion defining the physical address space
56
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/hw/intc/armv7m_nvic.c
59
+++ b/hw/intc/armv7m_nvic.c
21
@@ -XXX,XX +XXX,XX @@
60
@@ -XXX,XX +XXX,XX @@
22
* Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft
61
#include "hw/intc/armv7m_nvic.h"
23
* Written by Andrew Baumann
62
#include "hw/irq.h"
24
*
63
#include "hw/qdev-properties.h"
25
+ * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti
64
+#include "sysemu/runstate.h"
26
+ * Added basic IRQ_TIMER interrupt support
65
#include "target/arm/cpu.h"
27
+ *
66
#include "exec/exec-all.h"
28
* This code is licensed under the GNU GPLv2 and later.
67
#include "exec/memop.h"
29
*/
68
@@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = {
30
69
0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1
31
@@ -XXX,XX +XXX,XX @@
70
};
32
#define BCM2836_CONTROL_H
71
33
72
+static void signal_sysresetreq(NVICState *s)
34
#include "hw/sysbus.h"
35
+#include "qemu/timer.h"
36
37
/* 4 mailboxes per core, for 16 total */
38
#define BCM2836_NCORES 4
39
@@ -XXX,XX +XXX,XX @@ typedef struct BCM2836ControlState {
40
bool gpu_irq, gpu_fiq;
41
uint8_t timerirqs[BCM2836_NCORES];
42
43
+ /* local timer */
44
+ QEMUTimer timer;
45
+ uint32_t local_timer_control;
46
+ uint8_t route_localtimer;
47
+
48
/* interrupt source registers, post-routing (also input-derived; visible) */
49
uint32_t irqsrc[BCM2836_NCORES];
50
uint32_t fiqsrc[BCM2836_NCORES];
51
diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/hw/intc/bcm2836_control.c
54
+++ b/hw/intc/bcm2836_control.c
55
@@ -XXX,XX +XXX,XX @@
56
* This code is licensed under the GNU GPLv2 and later.
57
*
58
* At present, only implements interrupt routing, and mailboxes (i.e.,
59
- * not local timer, PMU interrupt, or AXI counters).
60
+ * not PMU interrupt, or AXI counters).
61
+ *
62
+ * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti
63
*
64
* Ref:
65
* https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf
66
@@ -XXX,XX +XXX,XX @@
67
#include "qemu/log.h"
68
69
#define REG_GPU_ROUTE 0x0c
70
+#define REG_LOCALTIMERROUTING 0x24
71
+#define REG_LOCALTIMERCONTROL 0x34
72
+#define REG_LOCALTIMERACK 0x38
73
#define REG_TIMERCONTROL 0x40
74
#define REG_MBOXCONTROL 0x50
75
#define REG_IRQSRC 0x60
76
@@ -XXX,XX +XXX,XX @@
77
#define IRQ_TIMER 11
78
#define IRQ_MAX IRQ_TIMER
79
80
+#define LOCALTIMER_FREQ 38400000
81
+#define LOCALTIMER_INTFLAG (1 << 31)
82
+#define LOCALTIMER_RELOAD (1 << 30)
83
+#define LOCALTIMER_INTENABLE (1 << 29)
84
+#define LOCALTIMER_ENABLE (1 << 28)
85
+#define LOCALTIMER_VALUE(x) ((x) & 0xfffffff)
86
+
87
static void deliver_local(BCM2836ControlState *s, uint8_t core, uint8_t irq,
88
uint32_t controlreg, uint8_t controlidx)
89
{
90
@@ -XXX,XX +XXX,XX @@ static void bcm2836_control_update(BCM2836ControlState *s)
91
s->fiqsrc[s->route_gpu_fiq] |= (uint32_t)1 << IRQ_GPU;
92
}
93
94
+ /*
95
+ * handle the control module 'local timer' interrupt for one of the
96
+ * cores' IRQ/FIQ; this is distinct from the per-CPU timer
97
+ * interrupts handled below.
98
+ */
99
+ if ((s->local_timer_control & LOCALTIMER_INTENABLE) &&
100
+ (s->local_timer_control & LOCALTIMER_INTFLAG)) {
101
+ if (s->route_localtimer & 4) {
102
+ s->fiqsrc[(s->route_localtimer & 3)] |= (uint32_t)1 << IRQ_TIMER;
103
+ } else {
104
+ s->irqsrc[(s->route_localtimer & 3)] |= (uint32_t)1 << IRQ_TIMER;
105
+ }
106
+ }
107
+
108
for (i = 0; i < BCM2836_NCORES; i++) {
109
/* handle local timer interrupts for this core */
110
if (s->timerirqs[i]) {
111
@@ -XXX,XX +XXX,XX @@ static void bcm2836_control_set_gpu_fiq(void *opaque, int irq, int level)
112
bcm2836_control_update(s);
113
}
114
115
+static void bcm2836_control_local_timer_set_next(void *opaque)
116
+{
73
+{
117
+ BCM2836ControlState *s = opaque;
74
+ if (qemu_irq_is_connected(s->sysresetreq)) {
118
+ uint64_t next_event;
75
+ qemu_irq_pulse(s->sysresetreq);
119
+
120
+ assert(LOCALTIMER_VALUE(s->local_timer_control) > 0);
121
+
122
+ next_event = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
123
+ muldiv64(LOCALTIMER_VALUE(s->local_timer_control),
124
+ NANOSECONDS_PER_SECOND, LOCALTIMER_FREQ);
125
+ timer_mod(&s->timer, next_event);
126
+}
127
+
128
+static void bcm2836_control_local_timer_tick(void *opaque)
129
+{
130
+ BCM2836ControlState *s = opaque;
131
+
132
+ bcm2836_control_local_timer_set_next(s);
133
+
134
+ s->local_timer_control |= LOCALTIMER_INTFLAG;
135
+ bcm2836_control_update(s);
136
+}
137
+
138
+static void bcm2836_control_local_timer_control(void *opaque, uint32_t val)
139
+{
140
+ BCM2836ControlState *s = opaque;
141
+
142
+ s->local_timer_control = val;
143
+ if (val & LOCALTIMER_ENABLE) {
144
+ bcm2836_control_local_timer_set_next(s);
145
+ } else {
76
+ } else {
146
+ timer_del(&s->timer);
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);
147
+ }
83
+ }
148
+}
84
+}
149
+
85
+
150
+static void bcm2836_control_local_timer_ack(void *opaque, uint32_t val)
86
static int nvic_pending_prio(NVICState *s)
151
+{
152
+ BCM2836ControlState *s = opaque;
153
+
154
+ if (val & LOCALTIMER_INTFLAG) {
155
+ s->local_timer_control &= ~LOCALTIMER_INTFLAG;
156
+ }
157
+ if ((val & LOCALTIMER_RELOAD) &&
158
+ (s->local_timer_control & LOCALTIMER_ENABLE)) {
159
+ bcm2836_control_local_timer_set_next(s);
160
+ }
161
+}
162
+
163
static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size)
164
{
87
{
165
BCM2836ControlState *s = opaque;
88
/* return the group priority of the current pending interrupt,
166
@@ -XXX,XX +XXX,XX @@ static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size)
89
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
167
assert(s->route_gpu_fiq < BCM2836_NCORES
90
if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) {
168
&& s->route_gpu_irq < BCM2836_NCORES);
91
if (attrs.secure ||
169
return ((uint32_t)s->route_gpu_fiq << 2) | s->route_gpu_irq;
92
!(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) {
170
+ } else if (offset == REG_LOCALTIMERROUTING) {
93
- qemu_irq_pulse(s->sysresetreq);
171
+ return s->route_localtimer;
94
+ signal_sysresetreq(s);
172
+ } else if (offset == REG_LOCALTIMERCONTROL) {
95
}
173
+ return s->local_timer_control;
96
}
174
+ } else if (offset == REG_LOCALTIMERACK) {
97
if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) {
175
+ return 0;
176
} else if (offset >= REG_TIMERCONTROL && offset < REG_MBOXCONTROL) {
177
return s->timercontrol[(offset - REG_TIMERCONTROL) >> 2];
178
} else if (offset >= REG_MBOXCONTROL && offset < REG_IRQSRC) {
179
@@ -XXX,XX +XXX,XX @@ static void bcm2836_control_write(void *opaque, hwaddr offset,
180
if (offset == REG_GPU_ROUTE) {
181
s->route_gpu_irq = val & 0x3;
182
s->route_gpu_fiq = (val >> 2) & 0x3;
183
+ } else if (offset == REG_LOCALTIMERROUTING) {
184
+ s->route_localtimer = val & 7;
185
+ } else if (offset == REG_LOCALTIMERCONTROL) {
186
+ bcm2836_control_local_timer_control(s, val);
187
+ } else if (offset == REG_LOCALTIMERACK) {
188
+ bcm2836_control_local_timer_ack(s, val);
189
} else if (offset >= REG_TIMERCONTROL && offset < REG_MBOXCONTROL) {
190
s->timercontrol[(offset - REG_TIMERCONTROL) >> 2] = val & 0xff;
191
} else if (offset >= REG_MBOXCONTROL && offset < REG_IRQSRC) {
192
@@ -XXX,XX +XXX,XX @@ static void bcm2836_control_reset(DeviceState *d)
193
194
s->route_gpu_irq = s->route_gpu_fiq = 0;
195
196
+ timer_del(&s->timer);
197
+ s->route_localtimer = 0;
198
+ s->local_timer_control = 0;
199
+
200
for (i = 0; i < BCM2836_NCORES; i++) {
201
s->timercontrol[i] = 0;
202
s->mailboxcontrol[i] = 0;
203
@@ -XXX,XX +XXX,XX @@ static void bcm2836_control_init(Object *obj)
204
/* outputs to CPU cores */
205
qdev_init_gpio_out_named(dev, s->irq, "irq", BCM2836_NCORES);
206
qdev_init_gpio_out_named(dev, s->fiq, "fiq", BCM2836_NCORES);
207
+
208
+ /* create a qemu virtual timer */
209
+ timer_init_ns(&s->timer, QEMU_CLOCK_VIRTUAL,
210
+ bcm2836_control_local_timer_tick, s);
211
}
212
213
static const VMStateDescription vmstate_bcm2836_control = {
214
.name = TYPE_BCM2836_CONTROL,
215
- .version_id = 1,
216
+ .version_id = 2,
217
.minimum_version_id = 1,
218
.fields = (VMStateField[]) {
219
VMSTATE_UINT32_ARRAY(mailboxes, BCM2836ControlState,
220
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_bcm2836_control = {
221
VMSTATE_UINT32_ARRAY(timercontrol, BCM2836ControlState, BCM2836_NCORES),
222
VMSTATE_UINT32_ARRAY(mailboxcontrol, BCM2836ControlState,
223
BCM2836_NCORES),
224
+ VMSTATE_TIMER_V(timer, BCM2836ControlState, 2),
225
+ VMSTATE_UINT32_V(local_timer_control, BCM2836ControlState, 2),
226
+ VMSTATE_UINT8_V(route_localtimer, BCM2836ControlState, 2),
227
VMSTATE_END_OF_LIST()
228
}
229
};
230
--
98
--
231
2.20.1
99
2.20.1
232
100
233
101
diff view generated by jsdifflib
New patch
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.
1
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20200728103744.6909-4-peter.maydell@linaro.org
11
---
12
hw/arm/msf2-soc.c | 11 -----------
13
hw/arm/stellaris.c | 12 ------------
14
2 files changed, 23 deletions(-)
15
16
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/msf2-soc.c
19
+++ b/hw/arm/msf2-soc.c
20
@@ -XXX,XX +XXX,XX @@
21
#include "hw/irq.h"
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)
40
{
41
MSF2State *s = MSF2_SOC(obj);
42
@@ -XXX,XX +XXX,XX @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
43
return;
44
}
45
46
- qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0,
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);
66
}
67
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),
89
--
90
2.20.1
91
92
diff view generated by jsdifflib
1
From: Dongjiu Geng <gengdongjiu@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Some generic arch timer registers are Config-RW in the EL0,
3
The definition of top_bit used in this function is one higher
4
which means the EL0 exception level can have write permission
4
than that used in the Arm ARM psuedo-code, which put the error
5
if it is appropriately configured.
5
indication at top_bit - 1 at the wrong place, which meant that
6
it wasn't visible to Auth.
6
7
7
When VM access registers, QEMU firstly checks whether they have RW
8
Fixing the definition of top_bit requires more changes, because
8
permission, then check whether it is appropriately configured.
9
its most common use is for the count of bits in top_bit:bot_bit,
9
If they are defined to read only in EL0, even though they have been
10
which would then need to be computed as top_bit - bot_bit + 1.
10
appropriately configured, they still do not have write permission.
11
So need to add the write permission according to ARMV8 spec when
12
define it.
13
11
14
Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
12
For now, prefer the minimal fix to the error indication alone.
15
Message-id: 1552395177-12608-1-git-send-email-gengdongjiu@huawei.com
13
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Fixes: 63ff0ca94cb
15
Reported-by: Derrick McKee <derrick.mckee@gmail.com>
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20200728195706.11087-1-richard.henderson@linaro.org
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
[PMM: added comment about the divergence from the pseudocode]
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
21
---
20
target/arm/helper.c | 30 +++++++++++++++---------------
22
target/arm/pauth_helper.c | 6 +++++-
21
1 file changed, 15 insertions(+), 15 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
22
27
23
diff --git a/target/arm/helper.c b/target/arm/helper.c
28
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
24
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/helper.c
30
--- a/target/arm/pauth_helper.c
26
+++ b/target/arm/helper.c
31
+++ b/target/arm/pauth_helper.c
27
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
32
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
28
/* per-timer control */
33
*/
29
{ .name = "CNTP_CTL", .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1,
34
test = sextract64(ptr, bot_bit, top_bit - bot_bit);
30
.secure = ARM_CP_SECSTATE_NS,
35
if (test != 0 && test != -1) {
31
- .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R,
36
- pac ^= MAKE_64BIT_MASK(top_bit - 1, 1);
32
+ .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW,
37
+ /*
33
.accessfn = gt_ptimer_access,
38
+ * Note that our top_bit is one greater than the pseudocode's
34
.fieldoffset = offsetoflow32(CPUARMState,
39
+ * version, hence "- 2" here.
35
cp15.c14_timer[GTIMER_PHYS].ctl),
40
+ */
36
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
41
+ pac ^= MAKE_64BIT_MASK(top_bit - 2, 1);
37
{ .name = "CNTP_CTL_S",
42
}
38
.cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1,
43
39
.secure = ARM_CP_SECSTATE_S,
44
/*
40
- .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R,
45
diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c
41
+ .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW,
46
new file mode 100644
42
.accessfn = gt_ptimer_access,
47
index XXXXXXX..XXXXXXX
43
.fieldoffset = offsetoflow32(CPUARMState,
48
--- /dev/null
44
cp15.c14_timer[GTIMER_SEC].ctl),
49
+++ b/tests/tcg/aarch64/pauth-5.c
45
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
50
@@ -XXX,XX +XXX,XX @@
46
},
51
+#include <assert.h>
47
{ .name = "CNTP_CTL_EL0", .state = ARM_CP_STATE_AA64,
52
+
48
.opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 1,
53
+static int x;
49
- .type = ARM_CP_IO, .access = PL1_RW | PL0_R,
54
+
50
+ .type = ARM_CP_IO, .access = PL0_RW,
55
+int main()
51
.accessfn = gt_ptimer_access,
56
+{
52
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].ctl),
57
+ int *p0 = &x, *p1, *p2, *p3;
53
.resetvalue = 0,
58
+ unsigned long salt = 0;
54
.writefn = gt_phys_ctl_write, .raw_writefn = raw_write,
59
+
55
},
60
+ /*
56
{ .name = "CNTV_CTL", .cp = 15, .crn = 14, .crm = 3, .opc1 = 0, .opc2 = 1,
61
+ * With TBI enabled and a 48-bit VA, there are 7 bits of auth, and so
57
- .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R,
62
+ * a 1/128 chance of auth = pac(ptr,key,salt) producing zero.
58
+ .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL0_RW,
63
+ * Find a salt that creates auth != 0.
59
.accessfn = gt_vtimer_access,
64
+ */
60
.fieldoffset = offsetoflow32(CPUARMState,
65
+ do {
61
cp15.c14_timer[GTIMER_VIRT].ctl),
66
+ salt++;
62
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
67
+ asm("pacda %0, %1" : "=r"(p1) : "r"(salt), "0"(p0));
63
},
68
+ } while (p0 == p1);
64
{ .name = "CNTV_CTL_EL0", .state = ARM_CP_STATE_AA64,
69
+
65
.opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 1,
70
+ /*
66
- .type = ARM_CP_IO, .access = PL1_RW | PL0_R,
71
+ * This pac must fail, because the input pointer bears an encryption,
67
+ .type = ARM_CP_IO, .access = PL0_RW,
72
+ * and so is not properly extended within bits [55:47]. This will
68
.accessfn = gt_vtimer_access,
73
+ * toggle bit 54 in the output...
69
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].ctl),
74
+ */
70
.resetvalue = 0,
75
+ asm("pacda %0, %1" : "=r"(p2) : "r"(salt), "0"(p1));
71
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
76
+
72
/* TimerValue views: a 32 bit downcounting view of the underlying state */
77
+ /* ... so that the aut must fail, setting bit 53 in the output ... */
73
{ .name = "CNTP_TVAL", .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0,
78
+ asm("autda %0, %1" : "=r"(p3) : "r"(salt), "0"(p2));
74
.secure = ARM_CP_SECSTATE_NS,
79
+
75
- .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R,
80
+ /* ... which means this equality must not hold. */
76
+ .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW,
81
+ assert(p3 != p0);
77
.accessfn = gt_ptimer_access,
82
+ return 0;
78
.readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write,
83
+}
79
},
84
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
80
{ .name = "CNTP_TVAL_S",
85
index XXXXXXX..XXXXXXX 100644
81
.cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0,
86
--- a/tests/tcg/aarch64/Makefile.target
82
.secure = ARM_CP_SECSTATE_S,
87
+++ b/tests/tcg/aarch64/Makefile.target
83
- .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R,
88
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
84
+ .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW,
89
85
.accessfn = gt_ptimer_access,
90
# Pauth Tests
86
.readfn = gt_sec_tval_read, .writefn = gt_sec_tval_write,
91
ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_3),)
87
},
92
-AARCH64_TESTS += pauth-1 pauth-2 pauth-4
88
{ .name = "CNTP_TVAL_EL0", .state = ARM_CP_STATE_AA64,
93
+AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5
89
.opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 0,
94
pauth-%: CFLAGS += -march=armv8.3-a
90
- .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R,
95
run-pauth-%: QEMU_OPTS += -cpu max
91
+ .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW,
96
run-plugin-pauth-%: QEMU_OPTS += -cpu max
92
.accessfn = gt_ptimer_access, .resetfn = gt_phys_timer_reset,
93
.readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write,
94
},
95
{ .name = "CNTV_TVAL", .cp = 15, .crn = 14, .crm = 3, .opc1 = 0, .opc2 = 0,
96
- .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R,
97
+ .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW,
98
.accessfn = gt_vtimer_access,
99
.readfn = gt_virt_tval_read, .writefn = gt_virt_tval_write,
100
},
101
{ .name = "CNTV_TVAL_EL0", .state = ARM_CP_STATE_AA64,
102
.opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 0,
103
- .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R,
104
+ .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL0_RW,
105
.accessfn = gt_vtimer_access, .resetfn = gt_virt_timer_reset,
106
.readfn = gt_virt_tval_read, .writefn = gt_virt_tval_write,
107
},
108
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
109
/* Comparison value, indicating when the timer goes off */
110
{ .name = "CNTP_CVAL", .cp = 15, .crm = 14, .opc1 = 2,
111
.secure = ARM_CP_SECSTATE_NS,
112
- .access = PL1_RW | PL0_R,
113
+ .access = PL0_RW,
114
.type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS,
115
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].cval),
116
.accessfn = gt_ptimer_access,
117
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
118
},
119
{ .name = "CNTP_CVAL_S", .cp = 15, .crm = 14, .opc1 = 2,
120
.secure = ARM_CP_SECSTATE_S,
121
- .access = PL1_RW | PL0_R,
122
+ .access = PL0_RW,
123
.type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS,
124
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC].cval),
125
.accessfn = gt_ptimer_access,
126
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
127
},
128
{ .name = "CNTP_CVAL_EL0", .state = ARM_CP_STATE_AA64,
129
.opc0 = 3, .opc1 = 3, .crn = 14, .crm = 2, .opc2 = 2,
130
- .access = PL1_RW | PL0_R,
131
+ .access = PL0_RW,
132
.type = ARM_CP_IO,
133
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_PHYS].cval),
134
.resetvalue = 0, .accessfn = gt_ptimer_access,
135
.writefn = gt_phys_cval_write, .raw_writefn = raw_write,
136
},
137
{ .name = "CNTV_CVAL", .cp = 15, .crm = 14, .opc1 = 3,
138
- .access = PL1_RW | PL0_R,
139
+ .access = PL0_RW,
140
.type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS,
141
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval),
142
.accessfn = gt_vtimer_access,
143
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
144
},
145
{ .name = "CNTV_CVAL_EL0", .state = ARM_CP_STATE_AA64,
146
.opc0 = 3, .opc1 = 3, .crn = 14, .crm = 3, .opc2 = 2,
147
- .access = PL1_RW | PL0_R,
148
+ .access = PL0_RW,
149
.type = ARM_CP_IO,
150
.fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_VIRT].cval),
151
.resetvalue = 0, .accessfn = gt_vtimer_access,
152
--
97
--
153
2.20.1
98
2.20.1
154
99
155
100
diff view generated by jsdifflib
1
From: Eric Auger <eric.auger@redhat.com>
1
From: Kaige Li <likaige@loongson.cn>
2
2
3
The GSIV numbers of the SPI based interrupts is not correct as
3
GCC version 4.9.4 isn't clever enough to figure out that all
4
ARM_SPI_BASE was not added to the irqmap[VIRT_SMMU] value. So
4
execution paths in disas_ldst() that use 'fn' will have initialized
5
this may collide with VIRTIO_MMIO irq window.
5
it first, and so it warns:
6
6
7
Signed-off-by: Eric Auger <eric.auger@redhat.com>
7
/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
8
Message-id: 20190312091031.5185-1-eric.auger@redhat.com
8
/home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
9
Reviewed-by: Shannon Zhao <shannon.zhaosl@gmail.com>
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
^
14
15
Make it happy by initializing the variable to NULL.
16
17
Signed-off-by: Kaige Li <likaige@loongson.cn>
18
Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
[PMM: Clean up commit message and note which gcc version this was]
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
22
---
12
hw/arm/virt-acpi-build.c | 2 +-
23
target/arm/translate-a64.c | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
24
1 file changed, 1 insertion(+), 1 deletion(-)
14
25
15
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
26
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
16
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/virt-acpi-build.c
28
--- a/target/arm/translate-a64.c
18
+++ b/hw/arm/virt-acpi-build.c
29
+++ b/target/arm/translate-a64.c
19
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
30
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
20
its->identifiers[0] = 0; /* MADT translation_id */
31
bool r = extract32(insn, 22, 1);
21
32
bool a = extract32(insn, 23, 1);
22
if (vms->iommu == VIRT_IOMMU_SMMUV3) {
33
TCGv_i64 tcg_rs, clean_addr;
23
- int irq = vms->irqmap[VIRT_SMMU];
34
- AtomicThreeOpFn *fn;
24
+ int irq = vms->irqmap[VIRT_SMMU] + ARM_SPI_BASE;
35
+ AtomicThreeOpFn *fn = NULL;
25
36
26
/* SMMUv3 node */
37
if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
27
smmu_offset = iort_node_offset + node_size;
38
unallocated_encoding(s);
28
--
39
--
29
2.20.1
40
2.20.1
30
41
31
42
diff view generated by jsdifflib
New patch
1
The nrf51 SoC model wasn't setting the system_clock_scale
2
global.which meant that if guest code used the systick timer in "use
3
the processor clock" mode it would hang because time never advances.
1
4
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.
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Message-id: 20200727193458.31250-1-peter.maydell@linaro.org
16
---
17
hw/arm/nrf51_soc.c | 5 +++++
18
1 file changed, 5 insertions(+)
19
20
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/nrf51_soc.c
23
+++ b/hw/arm/nrf51_soc.c
24
@@ -XXX,XX +XXX,XX @@
25
26
#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
27
28
+/* HCLK (the main CPU clock) on this SoC is always 16MHz */
29
+#define HCLK_FRQ 16000000
30
+
31
static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
32
{
33
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
34
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
35
return;
36
}
37
38
+ system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ;
39
+
40
object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container),
41
&error_abort);
42
if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) {
43
--
44
2.20.1
45
46
diff view generated by jsdifflib
1
From: Amir Charif <amir.charif@cea.fr>
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 do not trap when SVE is disabled in EL0,
8
The cleanest way to avoid this double-transaction is to move the
4
causing them to be executed with wrong size information.
9
start-transaction for the CR write handling down below the check of
10
the SWR bit.
5
11
6
Signed-off-by: Amir Charif <amir.charif@cea.fr>
12
Fixes: https://bugs.launchpad.net/qemu/+bug/1880424
7
Message-id: 1552579248-31025-1-git-send-email-amir.charif@cea.fr
13
Fixes: cc2722ec83ad944505fe
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
[PMM: added 'target/arm' prefix to subject]
11
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
12
---
17
---
13
target/arm/translate-sve.c | 22 ++++++++++++++--------
18
hw/timer/imx_epit.c | 13 ++++++++++---
14
1 file changed, 14 insertions(+), 8 deletions(-)
19
1 file changed, 10 insertions(+), 3 deletions(-)
15
20
16
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
17
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-sve.c
23
--- a/hw/timer/imx_epit.c
19
+++ b/target/arm/translate-sve.c
24
+++ b/hw/timer/imx_epit.c
20
@@ -XXX,XX +XXX,XX @@ static bool trans_INDEX_rr(DisasContext *s, arg_INDEX_rr *a)
25
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
21
26
22
static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a)
27
switch (offset >> 2) {
23
{
28
case 0: /* CR */
24
- TCGv_i64 rd = cpu_reg_sp(s, a->rd);
29
- ptimer_transaction_begin(s->timer_cmp);
25
- TCGv_i64 rn = cpu_reg_sp(s, a->rn);
30
- ptimer_transaction_begin(s->timer_reload);
26
- tcg_gen_addi_i64(rd, rn, a->imm * vec_full_reg_size(s));
31
27
+ if (sve_access_check(s)) {
32
oldcr = s->cr;
28
+ TCGv_i64 rd = cpu_reg_sp(s, a->rd);
33
s->cr = value & 0x03ffffff;
29
+ TCGv_i64 rn = cpu_reg_sp(s, a->rn);
34
if (s->cr & CR_SWR) {
30
+ tcg_gen_addi_i64(rd, rn, a->imm * vec_full_reg_size(s));
35
/* handle the reset */
31
+ }
36
imx_epit_reset(DEVICE(s));
32
return true;
37
- } else {
33
}
38
+ /*
34
39
+ * TODO: could we 'break' here? following operations appear
35
static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a)
40
+ * to duplicate the work imx_epit_reset() already did.
36
{
41
+ */
37
- TCGv_i64 rd = cpu_reg_sp(s, a->rd);
42
+ }
38
- TCGv_i64 rn = cpu_reg_sp(s, a->rn);
43
+
39
- tcg_gen_addi_i64(rd, rn, a->imm * pred_full_reg_size(s));
44
+ ptimer_transaction_begin(s->timer_cmp);
40
+ if (sve_access_check(s)) {
45
+ ptimer_transaction_begin(s->timer_reload);
41
+ TCGv_i64 rd = cpu_reg_sp(s, a->rd);
46
+
42
+ TCGv_i64 rn = cpu_reg_sp(s, a->rn);
47
+ if (!(s->cr & CR_SWR)) {
43
+ tcg_gen_addi_i64(rd, rn, a->imm * pred_full_reg_size(s));
48
imx_epit_set_freq(s);
44
+ }
49
}
45
return true;
46
}
47
48
static bool trans_RDVL(DisasContext *s, arg_RDVL *a)
49
{
50
- TCGv_i64 reg = cpu_reg(s, a->rd);
51
- tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s));
52
+ if (sve_access_check(s)) {
53
+ TCGv_i64 reg = cpu_reg(s, a->rd);
54
+ tcg_gen_movi_i64(reg, a->imm * vec_full_reg_size(s));
55
+ }
56
return true;
57
}
58
50
59
--
51
--
60
2.20.1
52
2.20.1
61
53
62
54
diff view generated by jsdifflib