1
Arm patch queue for 2.12 -- a miscellaneous collection
1
Handful of bugfixes for rc2. None of these are particularly critical
2
of bug fixes.
2
or exciting.
3
3
4
thanks
5
-- PMM
4
-- PMM
6
5
6
The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345:
7
7
8
The following changes since commit fb4fe32d5b6290deabe752b51cc1cc2a9e8573db:
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100)
9
10
Merge remote-tracking branch 'remotes/xtensa/tags/20180409-xtensa' into staging (2018-04-10 10:22:45 +0100)
11
9
12
are available in the Git repository at:
10
are available in the Git repository at:
13
11
14
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180410
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803
15
13
16
for you to fetch changes up to bd49e6027cbc207c87633c7add3ebd7d3474cd35:
14
for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8:
17
15
18
fpu: Fix rounding mode for floatN_to_uintM_round_to_zero (2018-04-10 13:02:26 +0100)
16
hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100)
19
17
20
----------------------------------------------------------------
18
----------------------------------------------------------------
21
target-arm queue:
19
target-arm queue:
22
* fpu: Fix rounding mode for floatN_to_uintM_round_to_zero
20
* hw/timer/imx_epit: Avoid assertion when CR.SWR is written
23
* tcg: Fix guest state corruption when running 64-bit Arm
21
* netduino2, netduinoplus2, microbit: set system_clock_scale so that
24
guests on a 32-bit host (especially when using icount)
22
SysTick running on the CPU clock works
25
* linux-user/signal.c: Ensure AArch64 signal frame isn't too small
23
* target/arm: Avoid maybe-uninitialized warning with gcc 4.9
26
* cpus.c: ensure running CPU recalculates icount deadlines on timer expiry
24
* target/arm: Fix AddPAC error indication
27
* target/arm: Report unsupported MPU region sizes more clearly
25
* Make AIRCR.SYSRESETREQ actually reset the system for the
28
* hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7
26
microbit, mps2-*, musca-*, netduino* boards
29
* hw/arm/allwinner-a10: Do not use nd_table in instance_init function
30
* hw/sd/bcm2835_sdhost: Don't raise spurious interrupts
31
* hw/sd/bcm2835_sdhost: Add tracepoints
32
* target-arm: Check undefined opcodes for SWP in A32 decoder
33
* hw/arm/integratorcp: Don't do things that could be fatal in the instance_init
34
* hw/arm: Allow manually specified /psci node
35
27
36
----------------------------------------------------------------
28
----------------------------------------------------------------
37
Andrey Smirnov (1):
29
Kaige Li (1):
38
hw/arm: Allow manually specified /psci node
30
target/arm: Avoid maybe-uninitialized warning with gcc 4.9
39
31
40
Onur Sahin (1):
32
Peter Maydell (6):
41
target-arm: Check undefined opcodes for SWP in A32 decoder
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
42
39
43
Peter Maydell (5):
40
Richard Henderson (1):
44
hw/sd/bcm2835_sdhost: Add tracepoints
41
target/arm: Fix AddPAC error indication
45
hw/sd/bcm2835_sdhost: Don't raise spurious interrupts
46
target/arm: Report unsupported MPU region sizes more clearly
47
cpus.c: ensure running CPU recalculates icount deadlines on timer expiry
48
linux-user/signal.c: Ensure AArch64 signal frame isn't too small
49
42
50
Richard Henderson (2):
43
include/hw/arm/armv7m.h | 4 +++-
51
tcg: Introduce tcg_set_insn_start_param
44
include/hw/irq.h | 18 ++++++++++++++++++
52
fpu: Fix rounding mode for floatN_to_uintM_round_to_zero
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
53
58
54
Thomas Huth (3):
55
hw/arm/integratorcp: Don't do things that could be fatal in the instance_init
56
hw/arm/allwinner-a10: Do not use nd_table in instance_init function
57
hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7
58
59
target/arm/translate.h | 2 +-
60
tcg/tcg.h | 10 ++++++++++
61
cpus.c | 10 +++++++++-
62
fpu/softfloat.c | 4 ++--
63
hw/arm/allwinner-a10.c | 12 +++++------
64
hw/arm/boot.c | 10 ++++++++++
65
hw/arm/fsl-imx6.c | 14 ++++++-------
66
hw/arm/fsl-imx7.c | 13 ++++++------
67
hw/arm/integratorcp.c | 23 +++++++++++++--------
68
hw/sd/bcm2835_sdhost.c | 54 ++++++++++++++++++++++++++++++++------------------
69
linux-user/signal.c | 6 ++++++
70
target/arm/helper.c | 6 +++---
71
target/arm/translate.c | 9 +++++++--
72
hw/sd/trace-events | 6 ++++++
73
14 files changed, 124 insertions(+), 55 deletions(-)
74
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.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
Change the code to avoid exiting QEMU if user provided DTB contains
5
Set the global to match the documented CPU clock speed of these boards.
4
manually specified /psci node and skip any /psci related fixups
6
Judging by the data sheet this is slightly simplistic because the
5
instead.
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.
6
9
7
Fixes: 4cbca7d9b4 ("hw/arm: Move virt's PSCI DT fixup code to
10
Fixes: https://bugs.launchpad.net/qemu/+bug/1876187
8
arm/boot.c")
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
14
---
15
hw/arm/netduino2.c | 10 ++++++++++
16
hw/arm/netduinoplus2.c | 10 ++++++++++
17
2 files changed, 20 insertions(+)
9
18
10
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
19
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
11
Reported-by: Marc Zyngier <marc.zyngier@arm.com>
12
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
13
Message-id: 20180402205654.14572-1-andrew.smirnov@gmail.com
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/arm/boot.c | 10 ++++++++++
18
1 file changed, 10 insertions(+)
19
20
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
21
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/boot.c
21
--- a/hw/arm/netduino2.c
23
+++ b/hw/arm/boot.c
22
+++ b/hw/arm/netduino2.c
24
@@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt)
23
@@ -XXX,XX +XXX,XX @@
25
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0));
24
#include "hw/arm/stm32f205_soc.h"
26
const char *psci_method;
25
#include "hw/arm/boot.h"
27
int64_t psci_conduit;
26
28
+ int rc;
27
+/* Main SYSCLK frequency in Hz (120MHz) */
29
28
+#define SYSCLK_FRQ 120000000ULL
30
psci_conduit = object_property_get_int(OBJECT(armcpu),
29
+
31
"psci-conduit",
30
static void netduino2_init(MachineState *machine)
32
@@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt)
31
{
33
g_assert_not_reached();
32
DeviceState *dev;
34
}
35
33
36
+ /*
34
+ /*
37
+ * If /psci node is present in provided DTB, assume that no fixup
35
+ * TODO: ideally we would model the SoC RCC and let it handle
38
+ * is necessary and all PSCI configuration should be taken as-is
36
+ * system_clock_scale, including its ability to define different
37
+ * possible SYSCLK sources.
39
+ */
38
+ */
40
+ rc = fdt_path_offset(fdt, "/psci");
39
+ system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
41
+ if (rc >= 0) {
42
+ return;
43
+ }
44
+
40
+
45
qemu_fdt_add_subnode(fdt, "/psci");
41
dev = qdev_new(TYPE_STM32F205_SOC);
46
if (armcpu->psci_version == 2) {
42
qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"));
47
const char comp[] = "arm,psci-0.2\0arm,psci";
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);
48
--
69
--
49
2.16.2
70
2.20.1
50
71
51
72
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
An instance_init function must not fail - and might be called multiple times,
4
e.g. during device introspection with the 'device-list-properties' QMP
5
command. Since the integratorcm device ignores this rule, QEMU currently
6
aborts in this case (though it really should not):
7
8
echo "{'execute':'qmp_capabilities'}"\
9
"{'execute':'device-list-properties',"\
10
"'arguments':{'typename':'integrator_core'}}" \
11
| arm-softmmu/qemu-system-arm -M integratorcp,accel=qtest -qmp stdio
12
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
13
"package": "build-all"}, "capabilities": []}}
14
{"return": {}}
15
RAMBlock "integrator.flash" already registered, abort!
16
Aborted (core dumped)
17
18
Move the problematic code to the realize() function instead to fix this
19
problem.
20
21
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
22
Signed-off-by: Thomas Huth <thuth@redhat.com>
23
Message-id: 1522906473-11252-1-git-send-email-thuth@redhat.com
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
26
hw/arm/integratorcp.c | 23 +++++++++++++++--------
27
1 file changed, 15 insertions(+), 8 deletions(-)
28
29
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/arm/integratorcp.c
32
+++ b/hw/arm/integratorcp.c
33
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps integratorcm_ops = {
34
static void integratorcm_init(Object *obj)
35
{
36
IntegratorCMState *s = INTEGRATOR_CM(obj);
37
- SysBusDevice *dev = SYS_BUS_DEVICE(obj);
38
39
s->cm_osc = 0x01000048;
40
/* ??? What should the high bits of this value be? */
41
@@ -XXX,XX +XXX,XX @@ static void integratorcm_init(Object *obj)
42
s->cm_init = 0x00000112;
43
s->cm_refcnt_offset = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24,
44
1000);
45
- memory_region_init_ram(&s->flash, obj, "integrator.flash", 0x100000,
46
- &error_fatal);
47
48
- memory_region_init_io(&s->iomem, obj, &integratorcm_ops, s,
49
- "integratorcm", 0x00800000);
50
- sysbus_init_mmio(dev, &s->iomem);
51
-
52
- integratorcm_do_remap(s);
53
/* ??? Save/restore. */
54
}
55
56
static void integratorcm_realize(DeviceState *d, Error **errp)
57
{
58
IntegratorCMState *s = INTEGRATOR_CM(d);
59
+ SysBusDevice *dev = SYS_BUS_DEVICE(d);
60
+ Error *local_err = NULL;
61
+
62
+ memory_region_init_ram(&s->flash, OBJECT(d), "integrator.flash", 0x100000,
63
+ &local_err);
64
+ if (local_err) {
65
+ error_propagate(errp, local_err);
66
+ return;
67
+ }
68
+
69
+ memory_region_init_io(&s->iomem, OBJECT(d), &integratorcm_ops, s,
70
+ "integratorcm", 0x00800000);
71
+ sysbus_init_mmio(dev, &s->iomem);
72
+
73
+ integratorcm_do_remap(s);
74
75
if (s->memsz >= 256) {
76
integrator_spd[31] = 64;
77
--
78
2.16.2
79
80
diff view generated by jsdifflib
Deleted patch
1
From: Onur Sahin <onursahin08@gmail.com>
2
1
3
Make sure we are not treating architecturally Undefined instructions
4
as a SWP, by verifying the opcodes as per section A8.8.229 of ARMv7-A
5
specification. Bits [21:20] must be zero for this to be a SWP or SWPB.
6
We also choose to UNDEF for the architecturally UNPREDICTABLE case of
7
bits [11:8] not being zero.
8
9
Signed-off-by: Onur Sahin <onursahin08@gmail.com>
10
[PMM: tweaked commit message]
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/translate.c | 9 +++++++--
15
1 file changed, 7 insertions(+), 2 deletions(-)
16
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/translate.c
20
+++ b/target/arm/translate.c
21
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
22
}
23
}
24
tcg_temp_free_i32(addr);
25
- } else {
26
+ } else if ((insn & 0x00300f00) == 0) {
27
+ /* 0bcccc_0001_0x00_xxxx_xxxx_0000_1001_xxxx
28
+ * - SWP, SWPB
29
+ */
30
+
31
TCGv taddr;
32
TCGMemOp opc = s->be_data;
33
34
- /* SWP instruction */
35
rm = (insn) & 0xf;
36
37
if (insn & (1 << 22)) {
38
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
39
get_mem_index(s), opc);
40
tcg_temp_free(taddr);
41
store_reg(s, rd, tmp);
42
+ } else {
43
+ goto illegal_op;
44
}
45
}
46
} else {
47
--
48
2.16.2
49
50
diff view generated by jsdifflib
1
Currently our PMSAv7 and ARMv7M MPU implementation cannot handle
1
Mostly devices don't need to care whether one of their output
2
MPU region sizes smaller than our TARGET_PAGE_SIZE. However we
2
qemu_irq lines is connected, because functions like qemu_set_irq()
3
report that in a slightly confusing way:
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.
4
6
5
DRSR[3]: No support for MPU (sub)region alignment of 9 bits. Minimum is 10
7
Provide a function qemu_irq_is_connected() that devices can use for
6
8
this purpose. (The test is trivial but encapsulating it in a
7
The problem is not the alignment of the region, but its size;
9
function makes it easier to see where we're doing it in case we need
8
tweak the error message to say so:
10
to change the implementation later.)
9
DRSR[3]: No support for MPU (sub)region size of 512 bytes. Minimum is 1024.
10
11
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180405172554.27401-1-peter.maydell@linaro.org
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-id: 20200728103744.6909-2-peter.maydell@linaro.org
14
---
16
---
15
target/arm/helper.c | 6 +++---
17
include/hw/irq.h | 18 ++++++++++++++++++
16
1 file changed, 3 insertions(+), 3 deletions(-)
18
1 file changed, 18 insertions(+)
17
19
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
diff --git a/include/hw/irq.h b/include/hw/irq.h
19
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/helper.c
22
--- a/include/hw/irq.h
21
+++ b/target/arm/helper.c
23
+++ b/include/hw/irq.h
22
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
24
@@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
23
}
25
on an existing vector of qemu_irq. */
24
if (rsize < TARGET_PAGE_BITS) {
26
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
25
qemu_log_mask(LOG_UNIMP,
27
26
- "DRSR[%d]: No support for MPU (sub)region "
28
+/**
27
- "alignment of %" PRIu32 " bits. Minimum is %d\n",
29
+ * qemu_irq_is_connected: Return true if IRQ line is wired up
28
- n, rsize, TARGET_PAGE_BITS);
30
+ *
29
+ "DRSR[%d]: No support for MPU (sub)region size of"
31
+ * If a qemu_irq has a device on the other (receiving) end of it,
30
+ " %" PRIu32 " bytes. Minimum is %d.\n",
32
+ * return true; otherwise return false.
31
+ n, (1 << rsize), TARGET_PAGE_SIZE);
33
+ *
32
continue;
34
+ * Usually device models don't need to care whether the machine model
33
}
35
+ * has wired up their outbound qemu_irq lines, because functions like
34
if (srdis) {
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
35
--
47
--
36
2.16.2
48
2.20.1
37
49
38
50
diff view generated by jsdifflib
1
The Linux bcm2835_sdhost driver doesn't work on QEMU, because our
1
The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals
2
model raises spurious data interrupts. Our function
2
when the guest sets the SYSRESETREQ bit in the AIRCR register. This
3
bcm2835_sdhost_fifo_run() will flag an interrupt any time it is
3
matches the hardware design (where the CPU has a signal of this name
4
called with s->datacnt == 0, even if the host hasn't actually issued
4
and it is up to the SoC to connect that up to an actual reset
5
a data read or write command yet. This means that the driver gets a
5
mechanism), but in QEMU it mostly results in duplicated code in SoC
6
spurious data interrupt as soon as it enables IRQs and then does
6
objects and bugs where SoC model implementors forget to wire up the
7
something else that causes us to call the fifo_run routine, like
7
SYSRESETREQ line.
8
writing to SDHCFG, and before it does the write to SDCMD to issue the
9
read. The driver's IRQ handler then spins forever complaining that
10
there's no data and the SD controller isn't in a state where there's
11
going to be any data:
12
8
13
[ 41.040738] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000
9
Provide a default behaviour for the case where SYSRESETREQ is not
14
[ 41.042059] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000
10
actually connected to anything: use qemu_system_reset_request() to
15
(continues forever).
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:
16
15
17
Move the interrupt flag setting to more plausible places:
16
* microbit
18
* for BUSY, raise this as soon as a BUSYWAIT command has executed
17
* mps2-an385
19
* for DATA, raise this when the FIFO has any space free (for a write)
18
* mps2-an505
20
or any data in it (for a read)
19
* mps2-an511
21
* for BLOCK, raise this when the data count is 0 and we've
20
* mps2-an521
22
actually done some reading or writing
21
* musca-a
22
* musca-b1
23
* netduino
24
* netduinoplus2
23
25
24
This is pure guesswork since the documentation for this hardware is
26
We still allow the board to wire up the signal if it needs to, in case
25
not public, but it is sufficient to get the Linux bcm2835_sdhost
27
we need to model more complicated reset controller logic or to model
26
driver to work.
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".
27
31
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
33
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
30
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
34
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
31
Message-id: 20180319161556.16446-3-peter.maydell@linaro.org
35
Message-id: 20200728103744.6909-3-peter.maydell@linaro.org
32
---
36
---
33
hw/sd/bcm2835_sdhost.c | 46 ++++++++++++++++++++++++++--------------------
37
include/hw/arm/armv7m.h | 4 +++-
34
1 file changed, 26 insertions(+), 20 deletions(-)
38
hw/intc/armv7m_nvic.c | 17 ++++++++++++++++-
39
2 files changed, 19 insertions(+), 2 deletions(-)
35
40
36
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
41
diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h
37
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/sd/bcm2835_sdhost.c
43
--- a/include/hw/arm/armv7m.h
39
+++ b/hw/sd/bcm2835_sdhost.c
44
+++ b/include/hw/arm/armv7m.h
40
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_send_command(BCM2835SDHostState *s)
45
@@ -XXX,XX +XXX,XX @@ typedef struct {
41
}
46
42
#undef RWORD
47
/* ARMv7M container object.
43
}
48
* + Unnamed GPIO input lines: external IRQ lines for the NVIC
44
+ /* We never really delay commands, so if this was a 'busywait' command
49
- * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ
45
+ * then we've completed it now and can raise the interrupt.
50
+ * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
46
+ */
51
+ * If this GPIO is not wired up then the NVIC will default to performing
47
+ if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) {
52
+ * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
48
+ s->status |= SDHSTS_BUSY_IRPT;
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
60
@@ -XXX,XX +XXX,XX @@
61
#include "hw/intc/armv7m_nvic.h"
62
#include "hw/irq.h"
63
#include "hw/qdev-properties.h"
64
+#include "sysemu/runstate.h"
65
#include "target/arm/cpu.h"
66
#include "exec/exec-all.h"
67
#include "exec/memop.h"
68
@@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = {
69
0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1
70
};
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);
49
+ }
83
+ }
50
return;
84
+}
51
85
+
52
error:
86
static int nvic_pending_prio(NVICState *s)
53
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
87
{
54
n++;
88
/* return the group priority of the current pending interrupt,
55
if (n == 4) {
89
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
56
bcm2835_sdhost_fifo_push(s, value);
90
if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) {
57
+ s->status |= SDHSTS_DATA_FLAG;
91
if (attrs.secure ||
58
+ if (s->config & SDHCFG_DATA_IRPT_EN) {
92
!(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) {
59
+ s->status |= SDHSTS_SDIO_IRPT;
93
- qemu_irq_pulse(s->sysresetreq);
60
+ }
94
+ signal_sysresetreq(s);
61
n = 0;
62
value = 0;
63
}
95
}
64
}
96
}
65
if (n != 0) {
97
if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) {
66
bcm2835_sdhost_fifo_push(s, value);
67
+ s->status |= SDHSTS_DATA_FLAG;
68
}
69
} else { /* write */
70
n = 0;
71
while (s->datacnt > 0 && (s->fifo_len > 0 || n > 0)) {
72
if (n == 0) {
73
value = bcm2835_sdhost_fifo_pop(s);
74
+ s->status |= SDHSTS_DATA_FLAG;
75
+ if (s->config & SDHCFG_DATA_IRPT_EN) {
76
+ s->status |= SDHSTS_SDIO_IRPT;
77
+ }
78
n = 4;
79
}
80
n--;
81
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
82
value >>= 8;
83
}
84
}
85
+ if (s->datacnt == 0) {
86
+ s->edm &= ~SDEDM_FSM_MASK;
87
+ s->edm |= SDEDM_FSM_DATAMODE;
88
+ trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm);
89
+
90
+ if ((s->cmd & SDCMD_WRITE_CMD) &&
91
+ (s->config & SDHCFG_BLOCK_IRPT_EN)) {
92
+ s->status |= SDHSTS_BLOCK_IRPT;
93
+ }
94
+ }
95
}
96
- if (s->datacnt == 0) {
97
- s->status |= SDHSTS_DATA_FLAG;
98
99
- s->edm &= ~0xf;
100
- s->edm |= SDEDM_FSM_DATAMODE;
101
- trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm);
102
-
103
- if (s->config & SDHCFG_DATA_IRPT_EN) {
104
- s->status |= SDHSTS_SDIO_IRPT;
105
- }
106
-
107
- if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) {
108
- s->status |= SDHSTS_BUSY_IRPT;
109
- }
110
-
111
- if ((s->cmd & SDCMD_WRITE_CMD) && (s->config & SDHCFG_BLOCK_IRPT_EN)) {
112
- s->status |= SDHSTS_BLOCK_IRPT;
113
- }
114
-
115
- bcm2835_sdhost_update_irq(s);
116
- }
117
+ bcm2835_sdhost_update_irq(s);
118
119
s->edm &= ~(0x1f << 4);
120
s->edm |= ((s->fifo_len & 0x1f) << 4);
121
--
98
--
122
2.16.2
99
2.20.1
123
100
124
101
diff view generated by jsdifflib
1
When we run in TCG icount mode, we calculate the number of instructions
1
The MSF2 SoC model and the Stellaris board code both wire
2
to execute using tcg_get_icount_limit(), which ensures that we stop
2
SYSRESETREQ up to a function that just invokes
3
execution at the next timer deadline. However there is a bug where
3
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
4
currently we do not recalculate that limit if the guest reprograms
4
This is now the default action that the NVIC does if the line is
5
a timer so that the next deadline moves closer, and so we will
5
not connected, so we can delete the handling code.
6
continue execution until the original limit and fire the timer
7
later than we should.
8
6
9
Fix this bug in qemu_timer_notify_cb(): if we are currently running
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
a VCPU in icount mode, we simply need to kick it out of the main
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
loop and back to tcg_cpu_exec(), where it will recalculate the
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
icount limit. If we are not currently running a VCPU, then we
10
Message-id: 20200728103744.6909-4-peter.maydell@linaro.org
13
retain the existing logic for waking up a halted CPU.
11
---
12
hw/arm/msf2-soc.c | 11 -----------
13
hw/arm/stellaris.c | 12 ------------
14
2 files changed, 23 deletions(-)
14
15
15
Cc: qemu-stable@nongnu.org
16
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
16
Fixes: https://bugs.launchpad.net/qemu/+bug/1754038
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
20
Message-id: 20180406123838.21249-1-peter.maydell@linaro.org
21
---
22
cpus.c | 10 +++++++++-
23
1 file changed, 9 insertions(+), 1 deletion(-)
24
25
diff --git a/cpus.c b/cpus.c
26
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
27
--- a/cpus.c
18
--- a/hw/arm/msf2-soc.c
28
+++ b/cpus.c
19
+++ b/hw/arm/msf2-soc.c
29
@@ -XXX,XX +XXX,XX @@ void qemu_timer_notify_cb(void *opaque, QEMUClockType type)
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)
30
return;
43
return;
31
}
44
}
32
45
33
- if (!qemu_in_vcpu_thread() && first_cpu) {
46
- qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0,
34
+ if (qemu_in_vcpu_thread()) {
47
- qemu_allocate_irq(&do_sys_reset, NULL, 0));
35
+ /* A CPU is currently running; kick it back out to the
48
-
36
+ * tcg_cpu_exec() loop so it will recalculate its
49
system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;
37
+ * icount deadline immediately.
50
38
+ */
51
for (i = 0; i < MSF2_NUM_UARTS; i++) {
39
+ qemu_cpu_kick(current_cpu);
52
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
40
+ } else if (first_cpu) {
53
index XXXXXXX..XXXXXXX 100644
41
/* qemu_cpu_kick is not enough to kick a halted CPU out of
54
--- a/hw/arm/stellaris.c
42
* qemu_tcg_wait_io_event. async_run_on_cpu, instead,
55
+++ b/hw/arm/stellaris.c
43
* causes cpu_thread_is_idle to return false. This way,
56
@@ -XXX,XX +XXX,XX @@
44
* handle_icount_deadline can run.
57
#include "hw/boards.h"
45
+ * If we have no CPUs at all for some reason, we don't
58
#include "qemu/log.h"
46
+ * need to do anything.
59
#include "exec/address-spaces.h"
47
*/
60
-#include "sysemu/runstate.h"
48
async_run_on_cpu(first_cpu, do_nothing, RUN_ON_CPU_NULL);
61
#include "sysemu/sysemu.h"
49
}
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),
50
--
89
--
51
2.16.2
90
2.20.1
52
91
53
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
We incorrectly passed in the current rounding mode
3
The definition of top_bit used in this function is one higher
4
instead of float_round_to_zero.
4
than that used in the Arm ARM psuedo-code, which put the error
5
indication at top_bit - 1 at the wrong place, which meant that
6
it wasn't visible to Auth.
5
7
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.
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>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180410055912.934-1-richard.henderson@linaro.org
17
Message-id: 20200728195706.11087-1-richard.henderson@linaro.org
8
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]
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
21
---
11
fpu/softfloat.c | 4 ++--
22
target/arm/pauth_helper.c | 6 +++++-
12
1 file changed, 2 insertions(+), 2 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
13
27
14
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
28
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
15
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
16
--- a/fpu/softfloat.c
30
--- a/target/arm/pauth_helper.c
17
+++ b/fpu/softfloat.c
31
+++ b/target/arm/pauth_helper.c
18
@@ -XXX,XX +XXX,XX @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero \
32
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
19
(float ## fsz a, float_status *s) \
33
*/
20
{ \
34
test = sextract64(ptr, bot_bit, top_bit - bot_bit);
21
FloatParts p = float ## fsz ## _unpack_canonical(a, s); \
35
if (test != 0 && test != -1) {
22
- return round_to_uint_and_pack(p, s->float_rounding_mode, \
36
- pac ^= MAKE_64BIT_MASK(top_bit - 1, 1);
23
- UINT ## isz ## _MAX, s); \
37
+ /*
24
+ return round_to_uint_and_pack(p, float_round_to_zero, \
38
+ * Note that our top_bit is one greater than the pseudocode's
25
+ UINT ## isz ## _MAX, s); \
39
+ * version, hence "- 2" here.
26
}
40
+ */
27
41
+ pac ^= MAKE_64BIT_MASK(top_bit - 2, 1);
28
FLOAT_TO_UINT(16, 16)
42
}
43
44
/*
45
diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c
46
new file mode 100644
47
index XXXXXXX..XXXXXXX
48
--- /dev/null
49
+++ b/tests/tcg/aarch64/pauth-5.c
50
@@ -XXX,XX +XXX,XX @@
51
+#include <assert.h>
52
+
53
+static int x;
54
+
55
+int main()
56
+{
57
+ int *p0 = &x, *p1, *p2, *p3;
58
+ unsigned long salt = 0;
59
+
60
+ /*
61
+ * With TBI enabled and a 48-bit VA, there are 7 bits of auth, and so
62
+ * a 1/128 chance of auth = pac(ptr,key,salt) producing zero.
63
+ * Find a salt that creates auth != 0.
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
29
--
97
--
30
2.16.2
98
2.20.1
31
99
32
100
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Kaige Li <likaige@loongson.cn>
2
2
3
The parameters for tcg_gen_insn_start are target_ulong, which may be split
3
GCC version 4.9.4 isn't clever enough to figure out that all
4
into two TCGArg parameters for storage in the opcode on 32-bit hosts.
4
execution paths in disas_ldst() that use 'fn' will have initialized
5
it first, and so it warns:
5
6
6
Fixes the ARM target and its direct use of tcg_set_insn_param, which would
7
/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
7
set the wrong argument in the 64-on-32 case.
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
^
8
14
9
Cc: qemu-stable@nongnu.org
15
Make it happy by initializing the variable to NULL.
10
Reported-by: alarson@ddci.com
16
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
17
Signed-off-by: Kaige Li <likaige@loongson.cn>
12
Message-id: 20180410003558.2470-1-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>
20
[PMM: Clean up commit message and note which gcc version this was]
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
22
---
16
target/arm/translate.h | 2 +-
23
target/arm/translate-a64.c | 2 +-
17
tcg/tcg.h | 10 ++++++++++
24
1 file changed, 1 insertion(+), 1 deletion(-)
18
2 files changed, 11 insertions(+), 1 deletion(-)
19
25
20
diff --git a/target/arm/translate.h b/target/arm/translate.h
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/target/arm/translate.h
28
--- a/target/arm/translate-a64.c
23
+++ b/target/arm/translate.h
29
+++ b/target/arm/translate-a64.c
24
@@ -XXX,XX +XXX,XX @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)
30
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
25
31
bool r = extract32(insn, 22, 1);
26
/* We check and clear insn_start_idx to catch multiple updates. */
32
bool a = extract32(insn, 23, 1);
27
assert(s->insn_start != NULL);
33
TCGv_i64 tcg_rs, clean_addr;
28
- tcg_set_insn_param(s->insn_start, 2, syn);
34
- AtomicThreeOpFn *fn;
29
+ tcg_set_insn_start_param(s->insn_start, 2, syn);
35
+ AtomicThreeOpFn *fn = NULL;
30
s->insn_start = NULL;
36
31
}
37
if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
32
38
unallocated_encoding(s);
33
diff --git a/tcg/tcg.h b/tcg/tcg.h
34
index XXXXXXX..XXXXXXX 100644
35
--- a/tcg/tcg.h
36
+++ b/tcg/tcg.h
37
@@ -XXX,XX +XXX,XX @@ static inline void tcg_set_insn_param(TCGOp *op, int arg, TCGArg v)
38
op->args[arg] = v;
39
}
40
41
+static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v)
42
+{
43
+#if TARGET_LONG_BITS <= TCG_TARGET_REG_BITS
44
+ tcg_set_insn_param(op, arg, v);
45
+#else
46
+ tcg_set_insn_param(op, arg * 2, v);
47
+ tcg_set_insn_param(op, arg * 2 + 1, v >> 32);
48
+#endif
49
+}
50
+
51
/* The last op that was emitted. */
52
static inline TCGOp *tcg_last_op(void)
53
{
54
--
39
--
55
2.16.2
40
2.20.1
56
41
57
42
diff view generated by jsdifflib
1
Add some tracepoints to the bcm2835_sdhost driver, to assist
1
The nrf51 SoC model wasn't setting the system_clock_scale
2
debugging.
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.
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.
3
12
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
15
Message-id: 20200727193458.31250-1-peter.maydell@linaro.org
7
Message-id: 20180319161556.16446-2-peter.maydell@linaro.org
8
---
16
---
9
hw/sd/bcm2835_sdhost.c | 10 ++++++++++
17
hw/arm/nrf51_soc.c | 5 +++++
10
hw/sd/trace-events | 6 ++++++
18
1 file changed, 5 insertions(+)
11
2 files changed, 16 insertions(+)
12
19
13
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
20
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/sd/bcm2835_sdhost.c
22
--- a/hw/arm/nrf51_soc.c
16
+++ b/hw/sd/bcm2835_sdhost.c
23
+++ b/hw/arm/nrf51_soc.c
17
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@
18
#include "qemu/log.h"
25
19
#include "sysemu/blockdev.h"
26
#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
20
#include "hw/sd/bcm2835_sdhost.h"
27
21
+#include "trace.h"
28
+/* HCLK (the main CPU clock) on this SoC is always 16MHz */
22
29
+#define HCLK_FRQ 16000000
23
#define TYPE_BCM2835_SDHOST_BUS "bcm2835-sdhost-bus"
30
+
24
#define BCM2835_SDHOST_BUS(obj) \
31
static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
25
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_update_irq(BCM2835SDHostState *s)
26
{
32
{
27
uint32_t irq = s->status &
33
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
28
(SDHSTS_BUSY_IRPT | SDHSTS_BLOCK_IRPT | SDHSTS_SDIO_IRPT);
34
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
29
+ trace_bcm2835_sdhost_update_irq(irq);
35
return;
30
qemu_set_irq(s->irq, !!irq);
31
}
32
33
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
34
35
s->edm &= ~0xf;
36
s->edm |= SDEDM_FSM_DATAMODE;
37
+ trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm);
38
39
if (s->config & SDHCFG_DATA_IRPT_EN) {
40
s->status |= SDHSTS_SDIO_IRPT;
41
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
42
43
s->edm &= ~(0x1f << 4);
44
s->edm |= ((s->fifo_len & 0x1f) << 4);
45
+ trace_bcm2835_sdhost_edm_change("fifo run", s->edm);
46
}
47
48
static uint64_t bcm2835_sdhost_read(void *opaque, hwaddr offset,
49
@@ -XXX,XX +XXX,XX @@ static uint64_t bcm2835_sdhost_read(void *opaque, hwaddr offset,
50
break;
51
}
36
}
52
37
53
+ trace_bcm2835_sdhost_read(offset, res, size);
38
+ system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ;
54
+
39
+
55
return res;
40
object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container),
56
}
41
&error_abort);
57
42
if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) {
58
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_write(void *opaque, hwaddr offset,
59
{
60
BCM2835SDHostState *s = (BCM2835SDHostState *)opaque;
61
62
+ trace_bcm2835_sdhost_write(offset, value, size);
63
+
64
switch (offset) {
65
case SDCMD:
66
s->cmd = value;
67
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_write(void *opaque, hwaddr offset,
68
value &= ~0xf;
69
}
70
s->edm = value;
71
+ trace_bcm2835_sdhost_edm_change("guest register write", s->edm);
72
break;
73
case SDHCFG:
74
s->config = value;
75
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_reset(DeviceState *dev)
76
s->cmd = 0;
77
s->cmdarg = 0;
78
s->edm = 0x0000c60f;
79
+ trace_bcm2835_sdhost_edm_change("device reset", s->edm);
80
s->config = 0;
81
s->hbct = 0;
82
s->hblc = 0;
83
diff --git a/hw/sd/trace-events b/hw/sd/trace-events
84
index XXXXXXX..XXXXXXX 100644
85
--- a/hw/sd/trace-events
86
+++ b/hw/sd/trace-events
87
@@ -XXX,XX +XXX,XX @@
88
# See docs/devel/tracing.txt for syntax documentation.
89
90
+# hw/sd/bcm2835_sdhost.c
91
+bcm2835_sdhost_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
92
+bcm2835_sdhost_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
93
+bcm2835_sdhost_edm_change(const char *why, uint32_t edm) "(%s) EDM now 0x%x"
94
+bcm2835_sdhost_update_irq(uint32_t irq) "IRQ bits 0x%x\n"
95
+
96
# hw/sd/core.c
97
sdbus_command(const char *bus_name, uint8_t cmd, uint32_t arg, uint8_t crc) "@%s CMD%02d arg 0x%08x crc 0x%02x"
98
sdbus_read(const char *bus_name, uint8_t value) "@%s value 0x%02x"
99
--
43
--
100
2.16.2
44
2.20.1
101
45
102
46
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
The instance_init function of a device can be called at any time, even
4
if the device is not going to be used (i.e. not going to be realized).
5
So a instance_init function must not do things that could cause QEMU
6
to exit, like calling qemu_check_nic_model(&nd_table[0], ...) for example.
7
But this is what the instance_init function of the allwinner-a10 device
8
is currently doing - and this causes QEMU to quit unexpectedly when
9
you run the 'device-list-properties' QMP command for example:
10
11
$ echo "{'execute':'qmp_capabilities'}"\
12
"{'execute':'device-list-properties',"\
13
" 'arguments':{'typename':'allwinner-a10'}}" \
14
| arm-softmmu/qemu-system-arm -M mps2-an505,accel=qtest -qmp stdio
15
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
16
"package": "build-all"}, "capabilities": []}}
17
{"return": {}}
18
Unsupported NIC model: lan9118
19
20
... and QEMU quits after printing the last line (which should not happen
21
just because of running 'device-list-properties' here).
22
23
And with the cubieboard, this even causes QEMU to abort():
24
25
$ echo "{'execute':'qmp_capabilities'}"\
26
"{'execute':'device-list-properties',"\
27
" 'arguments':{'typename':'allwinner-a10'}}" \
28
| arm-softmmu/qemu-system-arm -M cubieboard,accel=qtest -qmp stdio
29
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
30
"package": "build-all"}, "capabilities": []}}
31
{"return": {}}
32
Unexpected error in error_set_from_qdev_prop_error() at hw/core/qdev-properties.c:1095:
33
Property 'allwinner-emac.netdev' can't take value 'hub0port0', it's in use
34
Aborted (core dumped)
35
36
To fix the problem we've got to move the offending code to the realize
37
function instead.
38
39
Signed-off-by: Thomas Huth <thuth@redhat.com>
40
Message-id: 1522862420-7484-1-git-send-email-thuth@redhat.com
41
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
44
hw/arm/allwinner-a10.c | 12 ++++++------
45
1 file changed, 6 insertions(+), 6 deletions(-)
46
47
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/allwinner-a10.c
50
+++ b/hw/arm/allwinner-a10.c
51
@@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj)
52
53
object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC);
54
qdev_set_parent_bus(DEVICE(&s->emac), sysbus_get_default());
55
- /* FIXME use qdev NIC properties instead of nd_table[] */
56
- if (nd_table[0].used) {
57
- qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
58
- qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
59
- }
60
61
object_initialize(&s->sata, sizeof(s->sata), TYPE_ALLWINNER_AHCI);
62
qdev_set_parent_bus(DEVICE(&s->sata), sysbus_get_default());
63
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
64
sysbus_connect_irq(sysbusdev, 4, s->irq[67]);
65
sysbus_connect_irq(sysbusdev, 5, s->irq[68]);
66
67
+ /* FIXME use qdev NIC properties instead of nd_table[] */
68
+ if (nd_table[0].used) {
69
+ qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
70
+ qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
71
+ }
72
object_property_set_bool(OBJECT(&s->emac), true, "realized", &err);
73
if (err != NULL) {
74
error_propagate(errp, err);
75
@@ -XXX,XX +XXX,XX @@ static void aw_a10_class_init(ObjectClass *oc, void *data)
76
DeviceClass *dc = DEVICE_CLASS(oc);
77
78
dc->realize = aw_a10_realize;
79
- /* Reason: Uses serial_hds in realize and nd_table in instance_init */
80
+ /* Reason: Uses serial_hds and nd_table in realize function */
81
dc->user_creatable = false;
82
}
83
84
--
85
2.16.2
86
87
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
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
QEMU currently exits unexpectedly when trying to introspect the fsl-imx6
8
The cleanest way to avoid this double-transaction is to move the
4
and fsl-imx7 devices on systems with many SMP CPUs:
9
start-transaction for the CR write handling down below the check of
10
the SWR bit.
5
11
6
$ echo "{'execute':'qmp_capabilities'}"\
12
Fixes: https://bugs.launchpad.net/qemu/+bug/1880424
7
"{'execute':'device-list-properties',"\
13
Fixes: cc2722ec83ad944505fe
8
" 'arguments':{'typename':'fsl,imx6'}}" \
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
| arm-softmmu/qemu-system-arm -M virt,accel=qtest -qmp stdio -smp 8
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
16
Message-id: 20200727154550.3409-1-peter.maydell@linaro.org
11
"package": "build-all"}, "capabilities": []}}
17
---
12
{"return": {}}
18
hw/timer/imx_epit.c | 13 ++++++++++---
13
fsl,imx6: Only 4 CPUs are supported (8 requested)
19
1 file changed, 10 insertions(+), 3 deletions(-)
14
20
15
And:
21
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
16
17
$ echo "{'execute':'qmp_capabilities'}"\
18
"{'execute':'device-list-properties',"\
19
" 'arguments':{'typename':'fsl,imx7'}}" \
20
| arm-softmmu/qemu-system-arm -M raspi2,accel=qtest -qmp stdio
21
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
22
"package": "build-all"}, "capabilities": []}}
23
{"return": {}}
24
fsl,imx7: Only 2 CPUs are supported (4 requested)
25
26
This happens because these devices are doing an exit() from their
27
instance_init function - which should never be done since instance_init
28
can be called at any time for device introspection! Fix it by moving
29
the deadly check into the realize() function instead.
30
31
Signed-off-by: Thomas Huth <thuth@redhat.com>
32
Message-id: 1522908551-14885-1-git-send-email-thuth@redhat.com
33
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
34
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
---
36
hw/arm/fsl-imx6.c | 14 +++++++-------
37
hw/arm/fsl-imx7.c | 13 +++++++------
38
2 files changed, 14 insertions(+), 13 deletions(-)
39
40
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
41
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/arm/fsl-imx6.c
23
--- a/hw/timer/imx_epit.c
43
+++ b/hw/arm/fsl-imx6.c
24
+++ b/hw/timer/imx_epit.c
44
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
25
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
45
char name[NAME_SIZE];
26
46
int i;
27
switch (offset >> 2) {
47
28
case 0: /* CR */
48
- if (smp_cpus > FSL_IMX6_NUM_CPUS) {
29
- ptimer_transaction_begin(s->timer_cmp);
49
- error_report("%s: Only %d CPUs are supported (%d requested)",
30
- ptimer_transaction_begin(s->timer_reload);
50
- TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus);
31
51
- exit(1);
32
oldcr = s->cr;
52
- }
33
s->cr = value & 0x03ffffff;
53
-
34
if (s->cr & CR_SWR) {
54
- for (i = 0; i < smp_cpus; i++) {
35
/* handle the reset */
55
+ for (i = 0; i < MIN(smp_cpus, FSL_IMX6_NUM_CPUS); i++) {
36
imx_epit_reset(DEVICE(s));
56
object_initialize(&s->cpu[i], sizeof(s->cpu[i]),
37
- } else {
57
"cortex-a9-" TYPE_ARM_CPU);
38
+ /*
58
snprintf(name, NAME_SIZE, "cpu%d", i);
39
+ * TODO: could we 'break' here? following operations appear
59
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
40
+ * to duplicate the work imx_epit_reset() already did.
60
uint16_t i;
41
+ */
61
Error *err = NULL;
42
+ }
62
63
+ if (smp_cpus > FSL_IMX6_NUM_CPUS) {
64
+ error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
65
+ TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus);
66
+ return;
67
+ }
68
+
43
+
69
for (i = 0; i < smp_cpus; i++) {
44
+ ptimer_transaction_begin(s->timer_cmp);
70
45
+ ptimer_transaction_begin(s->timer_reload);
71
/* On uniprocessor, the CBAR is set to 0 */
72
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/hw/arm/fsl-imx7.c
75
+++ b/hw/arm/fsl-imx7.c
76
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_init(Object *obj)
77
char name[NAME_SIZE];
78
int i;
79
80
- if (smp_cpus > FSL_IMX7_NUM_CPUS) {
81
- error_report("%s: Only %d CPUs are supported (%d requested)",
82
- TYPE_FSL_IMX7, FSL_IMX7_NUM_CPUS, smp_cpus);
83
- exit(1);
84
- }
85
86
- for (i = 0; i < smp_cpus; i++) {
87
+ for (i = 0; i < MIN(smp_cpus, FSL_IMX7_NUM_CPUS); i++) {
88
object_initialize(&s->cpu[i], sizeof(s->cpu[i]),
89
ARM_CPU_TYPE_NAME("cortex-a7"));
90
snprintf(name, NAME_SIZE, "cpu%d", i);
91
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
92
qemu_irq irq;
93
char name[NAME_SIZE];
94
95
+ if (smp_cpus > FSL_IMX7_NUM_CPUS) {
96
+ error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
97
+ TYPE_FSL_IMX7, FSL_IMX7_NUM_CPUS, smp_cpus);
98
+ return;
99
+ }
100
+
46
+
101
for (i = 0; i < smp_cpus; i++) {
47
+ if (!(s->cr & CR_SWR)) {
102
o = OBJECT(&s->cpu[i]);
48
imx_epit_set_freq(s);
49
}
103
50
104
--
51
--
105
2.16.2
52
2.20.1
106
53
107
54
diff view generated by jsdifflib
Deleted patch
1
The AArch64 signal frame design was extended for SVE in commit
2
8c5931de0ac77388096d79ceb, so that instead of having a fixed setup we
3
now add various records to the frame, with some of them possibly
4
overflowing into an extra space outside the original 4K reserved
5
block in the target_sigcontext. However, we failed to ensure that we
6
always at least allocate the 4K reserved block. This is ABI, and
7
some userspace programs rely on it. In particular the dash shell
8
would segfault if the frame wasn't as big enough.
9
1
10
(Compare the kernel's sigframe_size() function in
11
arch/arm64/kernel/signal.c.)
12
13
Reported-by: Richard Henwood <richard.henwood@arm.com>
14
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20180409140714.26841-1-peter.maydell@linaro.org
17
Fixes: https://bugs.launchpad.net/bugs/1761535
18
Fixes: 8c5931de0ac77388096d79ceb
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
21
linux-user/signal.c | 6 ++++++
22
1 file changed, 6 insertions(+)
23
24
diff --git a/linux-user/signal.c b/linux-user/signal.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/linux-user/signal.c
27
+++ b/linux-user/signal.c
28
@@ -XXX,XX +XXX,XX @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
29
fr_ofs = layout.total_size;
30
layout.total_size += sizeof(struct target_rt_frame_record);
31
32
+ /* We must always provide at least the standard 4K reserved space,
33
+ * even if we don't use all of it (this is part of the ABI)
34
+ */
35
+ layout.total_size = MAX(layout.total_size,
36
+ sizeof(struct target_rt_sigframe));
37
+
38
frame_addr = get_sigframe(ka, env, layout.total_size);
39
trace_user_setup_frame(env, frame_addr);
40
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
41
--
42
2.16.2
43
44
diff view generated by jsdifflib