1
Arm patch queue for 2.12 -- a miscellaneous collection
1
A last small test of bug fixes before rc1.
2
of bug fixes.
3
2
4
thanks
3
thanks
5
-- PMM
4
-- PMM
6
5
6
The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637:
7
7
8
The following changes since commit fb4fe32d5b6290deabe752b51cc1cc2a9e8573db:
8
Merge tag 'pull-tpm-2023-07-14-1' of https://github.com/stefanberger/qemu-tpm into staging (2023-07-15 14:54:04 +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-20230717
15
13
16
for you to fetch changes up to bd49e6027cbc207c87633c7add3ebd7d3474cd35:
14
for you to fetch changes up to c2c1c4a35c7c2b1a4140b0942b9797c857e476a4:
17
15
18
fpu: Fix rounding mode for floatN_to_uintM_round_to_zero (2018-04-10 13:02:26 +0100)
16
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write (2023-07-17 11:05:52 +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/arm/sbsa-ref: set 'slots' property of xhci
23
* tcg: Fix guest state corruption when running 64-bit Arm
21
* linux-user: Remove pointless NULL check in clock_adjtime handling
24
guests on a 32-bit host (especially when using icount)
22
* ptw: Fix S1_ptw_translate() debug path
25
* linux-user/signal.c: Ensure AArch64 signal frame isn't too small
23
* ptw: Account for FEAT_RME when applying {N}SW, SA bits
26
* cpus.c: ensure running CPU recalculates icount deadlines on timer expiry
24
* accel/tcg: Zero-pad PC in TCG CPU exec trace lines
27
* target/arm: Report unsupported MPU region sizes more clearly
25
* hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
28
* hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7
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
26
36
----------------------------------------------------------------
27
----------------------------------------------------------------
37
Andrey Smirnov (1):
28
Peter Maydell (5):
38
hw/arm: Allow manually specified /psci node
29
linux-user: Remove pointless NULL check in clock_adjtime handling
30
target/arm/ptw.c: Add comments to S1Translate struct fields
31
target/arm: Fix S1_ptw_translate() debug path
32
target/arm/ptw.c: Account for FEAT_RME when applying {N}SW, SA bits
33
accel/tcg: Zero-pad PC in TCG CPU exec trace lines
39
34
40
Onur Sahin (1):
35
Tong Ho (1):
41
target-arm: Check undefined opcodes for SWP in A32 decoder
36
hw/nvram: Avoid unnecessary Xilinx eFuse backstore write
42
37
43
Peter Maydell (5):
38
Yuquan Wang (1):
44
hw/sd/bcm2835_sdhost: Add tracepoints
39
hw/arm/sbsa-ref: set 'slots' property of xhci
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
40
50
Richard Henderson (2):
41
accel/tcg/cpu-exec.c | 4 +--
51
tcg: Introduce tcg_set_insn_start_param
42
accel/tcg/translate-all.c | 2 +-
52
fpu: Fix rounding mode for floatN_to_uintM_round_to_zero
43
hw/arm/sbsa-ref.c | 1 +
53
44
hw/nvram/xlnx-efuse.c | 11 ++++--
54
Thomas Huth (3):
45
linux-user/syscall.c | 12 +++----
55
hw/arm/integratorcp: Don't do things that could be fatal in the instance_init
46
target/arm/ptw.c | 90 +++++++++++++++++++++++++++++++++++++++++------
56
hw/arm/allwinner-a10: Do not use nd_table in instance_init function
47
6 files changed, 98 insertions(+), 22 deletions(-)
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
Deleted patch
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
2
1
3
Change the code to avoid exiting QEMU if user provided DTB contains
4
manually specified /psci node and skip any /psci related fixups
5
instead.
6
7
Fixes: 4cbca7d9b4 ("hw/arm: Move virt's PSCI DT fixup code to
8
arm/boot.c")
9
10
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
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
22
--- a/hw/arm/boot.c
23
+++ b/hw/arm/boot.c
24
@@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt)
25
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0));
26
const char *psci_method;
27
int64_t psci_conduit;
28
+ int rc;
29
30
psci_conduit = object_property_get_int(OBJECT(armcpu),
31
"psci-conduit",
32
@@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt)
33
g_assert_not_reached();
34
}
35
36
+ /*
37
+ * If /psci node is present in provided DTB, assume that no fixup
38
+ * is necessary and all PSCI configuration should be taken as-is
39
+ */
40
+ rc = fdt_path_offset(fdt, "/psci");
41
+ if (rc >= 0) {
42
+ return;
43
+ }
44
+
45
qemu_fdt_add_subnode(fdt, "/psci");
46
if (armcpu->psci_version == 2) {
47
const char comp[] = "arm,psci-0.2\0arm,psci";
48
--
49
2.16.2
50
51
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
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Yuquan Wang <wangyuquan1236@phytium.com.cn>
2
2
3
We incorrectly passed in the current rounding mode
3
This extends the slots of xhci to 64, since the default xhci_sysbus
4
instead of float_round_to_zero.
4
just supports one slot.
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Wang Yuquan <wangyuquan1236@phytium.com.cn>
7
Message-id: 20180410055912.934-1-richard.henderson@linaro.org
7
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
10
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
11
Message-id: 20230710063750.473510-2-wangyuquan1236@phytium.com.cn
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
13
---
11
fpu/softfloat.c | 4 ++--
14
hw/arm/sbsa-ref.c | 1 +
12
1 file changed, 2 insertions(+), 2 deletions(-)
15
1 file changed, 1 insertion(+)
13
16
14
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
17
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/fpu/softfloat.c
19
--- a/hw/arm/sbsa-ref.c
17
+++ b/fpu/softfloat.c
20
+++ b/hw/arm/sbsa-ref.c
18
@@ -XXX,XX +XXX,XX @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero \
21
@@ -XXX,XX +XXX,XX @@ static void create_xhci(const SBSAMachineState *sms)
19
(float ## fsz a, float_status *s) \
22
hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
20
{ \
23
int irq = sbsa_ref_irqmap[SBSA_XHCI];
21
FloatParts p = float ## fsz ## _unpack_canonical(a, s); \
24
DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
22
- return round_to_uint_and_pack(p, s->float_rounding_mode, \
25
+ qdev_prop_set_uint32(dev, "slots", XHCI_MAXSLOTS);
23
- UINT ## isz ## _MAX, s); \
26
24
+ return round_to_uint_and_pack(p, float_round_to_zero, \
27
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
25
+ UINT ## isz ## _MAX, s); \
28
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
26
}
27
28
FLOAT_TO_UINT(16, 16)
29
--
29
--
30
2.16.2
30
2.34.1
31
32
diff view generated by jsdifflib
1
The Linux bcm2835_sdhost driver doesn't work on QEMU, because our
1
In the code for TARGET_NR_clock_adjtime, we set the pointer phtx to
2
model raises spurious data interrupts. Our function
2
the address of the local variable htx. This means it can never be
3
bcm2835_sdhost_fifo_run() will flag an interrupt any time it is
3
NULL, but later in the code we check it for NULL anyway. Coverity
4
called with s->datacnt == 0, even if the host hasn't actually issued
4
complains about this (CID 1507683) because the NULL check comes after
5
a data read or write command yet. This means that the driver gets a
5
a call to clock_adjtime() that assumes it is non-NULL.
6
spurious data interrupt as soon as it enables IRQs and then does
7
something else that causes us to call the fifo_run routine, like
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
6
13
[ 41.040738] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000
7
Since phtx is always &htx, and is used only in three places, it's not
14
[ 41.042059] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000
8
really necessary. Remove it, bringing the code structure in to line
15
(continues forever).
9
with that for TARGET_NR_clock_adjtime64, which already uses a simple
16
10
'&htx' when it wants a pointer to 'htx'.
17
Move the interrupt flag setting to more plausible places:
18
* for BUSY, raise this as soon as a BUSYWAIT command has executed
19
* for DATA, raise this when the FIFO has any space free (for a write)
20
or any data in it (for a read)
21
* for BLOCK, raise this when the data count is 0 and we've
22
actually done some reading or writing
23
24
This is pure guesswork since the documentation for this hardware is
25
not public, but it is sufficient to get the Linux bcm2835_sdhost
26
driver to work.
27
11
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
30
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
31
Message-id: 20180319161556.16446-3-peter.maydell@linaro.org
15
Message-id: 20230623144410.1837261-1-peter.maydell@linaro.org
32
---
16
---
33
hw/sd/bcm2835_sdhost.c | 46 ++++++++++++++++++++++++++--------------------
17
linux-user/syscall.c | 12 +++++-------
34
1 file changed, 26 insertions(+), 20 deletions(-)
18
1 file changed, 5 insertions(+), 7 deletions(-)
35
19
36
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
20
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
37
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/sd/bcm2835_sdhost.c
22
--- a/linux-user/syscall.c
39
+++ b/hw/sd/bcm2835_sdhost.c
23
+++ b/linux-user/syscall.c
40
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_send_command(BCM2835SDHostState *s)
24
@@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
41
}
25
#if defined(TARGET_NR_clock_adjtime) && defined(CONFIG_CLOCK_ADJTIME)
42
#undef RWORD
26
case TARGET_NR_clock_adjtime:
43
}
27
{
44
+ /* We never really delay commands, so if this was a 'busywait' command
28
- struct timex htx, *phtx = &htx;
45
+ * then we've completed it now and can raise the interrupt.
29
+ struct timex htx;
46
+ */
30
47
+ if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) {
31
- if (target_to_host_timex(phtx, arg2) != 0) {
48
+ s->status |= SDHSTS_BUSY_IRPT;
32
+ if (target_to_host_timex(&htx, arg2) != 0) {
49
+ }
33
return -TARGET_EFAULT;
50
return;
51
52
error:
53
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
54
n++;
55
if (n == 4) {
56
bcm2835_sdhost_fifo_push(s, value);
57
+ s->status |= SDHSTS_DATA_FLAG;
58
+ if (s->config & SDHCFG_DATA_IRPT_EN) {
59
+ s->status |= SDHSTS_SDIO_IRPT;
60
+ }
61
n = 0;
62
value = 0;
63
}
64
}
34
}
65
if (n != 0) {
35
- ret = get_errno(clock_adjtime(arg1, phtx));
66
bcm2835_sdhost_fifo_push(s, value);
36
- if (!is_error(ret) && phtx) {
67
+ s->status |= SDHSTS_DATA_FLAG;
37
- if (host_to_target_timex(arg2, phtx) != 0) {
68
}
38
- return -TARGET_EFAULT;
69
} else { /* write */
39
- }
70
n = 0;
40
+ ret = get_errno(clock_adjtime(arg1, &htx));
71
while (s->datacnt > 0 && (s->fifo_len > 0 || n > 0)) {
41
+ if (!is_error(ret) && host_to_target_timex(arg2, &htx)) {
72
if (n == 0) {
42
+ return -TARGET_EFAULT;
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
}
43
}
84
}
44
}
85
+ if (s->datacnt == 0) {
45
return ret;
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
--
46
--
122
2.16.2
47
2.34.1
123
48
124
49
diff view generated by jsdifflib
1
Currently our PMSAv7 and ARMv7M MPU implementation cannot handle
1
Add comments to the in_* fields in the S1Translate struct
2
MPU region sizes smaller than our TARGET_PAGE_SIZE. However we
2
that explain what they're doing.
3
report that in a slightly confusing way:
4
5
DRSR[3]: No support for MPU (sub)region alignment of 9 bits. Minimum is 10
6
7
The problem is not the alignment of the region, but its size;
8
tweak the error message to say so:
9
DRSR[3]: No support for MPU (sub)region size of 512 bytes. Minimum is 1024.
10
3
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20180405172554.27401-1-peter.maydell@linaro.org
6
Message-id: 20230710152130.3928330-2-peter.maydell@linaro.org
14
---
7
---
15
target/arm/helper.c | 6 +++---
8
target/arm/ptw.c | 40 ++++++++++++++++++++++++++++++++++++++++
16
1 file changed, 3 insertions(+), 3 deletions(-)
9
1 file changed, 40 insertions(+)
17
10
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
11
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/helper.c
13
--- a/target/arm/ptw.c
21
+++ b/target/arm/helper.c
14
+++ b/target/arm/ptw.c
22
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
15
@@ -XXX,XX +XXX,XX @@
23
}
16
#endif
24
if (rsize < TARGET_PAGE_BITS) {
17
25
qemu_log_mask(LOG_UNIMP,
18
typedef struct S1Translate {
26
- "DRSR[%d]: No support for MPU (sub)region "
19
+ /*
27
- "alignment of %" PRIu32 " bits. Minimum is %d\n",
20
+ * in_mmu_idx : specifies which TTBR, TCR, etc to use for the walk.
28
- n, rsize, TARGET_PAGE_BITS);
21
+ * Together with in_space, specifies the architectural translation regime.
29
+ "DRSR[%d]: No support for MPU (sub)region size of"
22
+ */
30
+ " %" PRIu32 " bytes. Minimum is %d.\n",
23
ARMMMUIdx in_mmu_idx;
31
+ n, (1 << rsize), TARGET_PAGE_SIZE);
24
+ /*
32
continue;
25
+ * in_ptw_idx: specifies which mmuidx to use for the actual
33
}
26
+ * page table descriptor load operations. This will be one of the
34
if (srdis) {
27
+ * ARMMMUIdx_Stage2* or one of the ARMMMUIdx_Phys_* indexes.
28
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
29
+ * this field is updated accordingly.
30
+ */
31
ARMMMUIdx in_ptw_idx;
32
+ /*
33
+ * in_space: the security space for this walk. This plus
34
+ * the in_mmu_idx specify the architectural translation regime.
35
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
36
+ * this field is updated accordingly.
37
+ *
38
+ * Note that the security space for the in_ptw_idx may be different
39
+ * from that for the in_mmu_idx. We do not need to explicitly track
40
+ * the in_ptw_idx security space because:
41
+ * - if the in_ptw_idx is an ARMMMUIdx_Phys_* then the mmuidx
42
+ * itself specifies the security space
43
+ * - if the in_ptw_idx is an ARMMMUIdx_Stage2* then the security
44
+ * space used for ptw reads is the same as that of the security
45
+ * space of the stage 1 translation for all cases except where
46
+ * stage 1 is Secure; in that case the only possibilities for
47
+ * the ptw read are Secure and NonSecure, and the in_ptw_idx
48
+ * value being Stage2 vs Stage2_S distinguishes those.
49
+ */
50
ARMSecuritySpace in_space;
51
+ /*
52
+ * in_secure: whether the translation regime is a Secure one.
53
+ * This is always equal to arm_space_is_secure(in_space).
54
+ * If a Secure ptw is "downgraded" to NonSecure by an NSTable bit,
55
+ * this field is updated accordingly.
56
+ */
57
bool in_secure;
58
+ /*
59
+ * in_debug: is this a QEMU debug access (gdbstub, etc)? Debug
60
+ * accesses will not update the guest page table access flags
61
+ * and will not change the state of the softmmu TLBs.
62
+ */
63
bool in_debug;
64
/*
65
* If this is stage 2 of a stage 1+2 page table walk, then this must
35
--
66
--
36
2.16.2
67
2.34.1
37
38
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In commit fe4a5472ccd6 we rearranged the logic in S1_ptw_translate()
2
so that the debug-access "call get_phys_addr_*" codepath is used both
3
when S1 is doing ptw reads from stage 2 and when it is doing ptw
4
reads from physical memory. However, we didn't update the
5
calculation of s2ptw->in_space and s2ptw->in_secure to account for
6
the "ptw reads from physical memory" case. This meant that debug
7
accesses when in Secure state broke.
2
8
3
The parameters for tcg_gen_insn_start are target_ulong, which may be split
9
Create a new function S2_security_space() which returns the
4
into two TCGArg parameters for storage in the opcode on 32-bit hosts.
10
correct security space to use for the ptw load, and use it to
11
determine the correct .in_secure and .in_space fields for the
12
stage 2 lookup for the ptw load.
5
13
6
Fixes the ARM target and its direct use of tcg_set_insn_param, which would
14
Reported-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
7
set the wrong argument in the 64-on-32 case.
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
16
Tested-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
9
Cc: qemu-stable@nongnu.org
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reported-by: alarson@ddci.com
18
Message-id: 20230710152130.3928330-3-peter.maydell@linaro.org
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
19
Fixes: fe4a5472ccd6 ("target/arm: Use get_phys_addr_with_struct in S1_ptw_translate")
12
Message-id: 20180410003558.2470-1-richard.henderson@linaro.org
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
21
---
16
target/arm/translate.h | 2 +-
22
target/arm/ptw.c | 37 ++++++++++++++++++++++++++++++++-----
17
tcg/tcg.h | 10 ++++++++++
23
1 file changed, 32 insertions(+), 5 deletions(-)
18
2 files changed, 11 insertions(+), 1 deletion(-)
19
24
20
diff --git a/target/arm/translate.h b/target/arm/translate.h
25
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
21
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/translate.h
27
--- a/target/arm/ptw.c
23
+++ b/target/arm/translate.h
28
+++ b/target/arm/ptw.c
24
@@ -XXX,XX +XXX,XX @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)
29
@@ -XXX,XX +XXX,XX @@ static bool S2_attrs_are_device(uint64_t hcr, uint8_t attrs)
25
30
}
26
/* We check and clear insn_start_idx to catch multiple updates. */
27
assert(s->insn_start != NULL);
28
- tcg_set_insn_param(s->insn_start, 2, syn);
29
+ tcg_set_insn_start_param(s->insn_start, 2, syn);
30
s->insn_start = NULL;
31
}
31
}
32
32
33
diff --git a/tcg/tcg.h b/tcg/tcg.h
33
+static ARMSecuritySpace S2_security_space(ARMSecuritySpace s1_space,
34
index XXXXXXX..XXXXXXX 100644
34
+ ARMMMUIdx s2_mmu_idx)
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
+{
35
+{
43
+#if TARGET_LONG_BITS <= TCG_TARGET_REG_BITS
36
+ /*
44
+ tcg_set_insn_param(op, arg, v);
37
+ * Return the security space to use for stage 2 when doing
45
+#else
38
+ * the S1 page table descriptor load.
46
+ tcg_set_insn_param(op, arg * 2, v);
39
+ */
47
+ tcg_set_insn_param(op, arg * 2 + 1, v >> 32);
40
+ if (regime_is_stage2(s2_mmu_idx)) {
48
+#endif
41
+ /*
42
+ * The security space for ptw reads is almost always the same
43
+ * as that of the security space of the stage 1 translation.
44
+ * The only exception is when stage 1 is Secure; in that case
45
+ * the ptw read might be to the Secure or the NonSecure space
46
+ * (but never Realm or Root), and the s2_mmu_idx tells us which.
47
+ * Root translations are always single-stage.
48
+ */
49
+ if (s1_space == ARMSS_Secure) {
50
+ return arm_secure_to_space(s2_mmu_idx == ARMMMUIdx_Stage2_S);
51
+ } else {
52
+ assert(s2_mmu_idx != ARMMMUIdx_Stage2_S);
53
+ assert(s1_space != ARMSS_Root);
54
+ return s1_space;
55
+ }
56
+ } else {
57
+ /* ptw loads are from phys: the mmu idx itself says which space */
58
+ return arm_phys_to_space(s2_mmu_idx);
59
+ }
49
+}
60
+}
50
+
61
+
51
/* The last op that was emitted. */
62
/* Translate a S1 pagetable walk through S2 if needed. */
52
static inline TCGOp *tcg_last_op(void)
63
static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
64
hwaddr addr, ARMMMUFaultInfo *fi)
53
{
65
{
66
- ARMSecuritySpace space = ptw->in_space;
67
bool is_secure = ptw->in_secure;
68
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
69
ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
70
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
71
* From gdbstub, do not use softmmu so that we don't modify the
72
* state of the cpu at all, including softmmu tlb contents.
73
*/
74
+ ARMSecuritySpace s2_space = S2_security_space(ptw->in_space, s2_mmu_idx);
75
S1Translate s2ptw = {
76
.in_mmu_idx = s2_mmu_idx,
77
.in_ptw_idx = ptw_idx_for_stage_2(env, s2_mmu_idx),
78
- .in_secure = s2_mmu_idx == ARMMMUIdx_Stage2_S,
79
- .in_space = (s2_mmu_idx == ARMMMUIdx_Stage2_S ? ARMSS_Secure
80
- : space == ARMSS_Realm ? ARMSS_Realm
81
- : ARMSS_NonSecure),
82
+ .in_secure = arm_space_is_secure(s2_space),
83
+ .in_space = s2_space,
84
.in_debug = true,
85
};
86
GetPhysAddrResult s2 = { };
54
--
87
--
55
2.16.2
88
2.34.1
56
57
diff view generated by jsdifflib
1
Add some tracepoints to the bcm2835_sdhost driver, to assist
1
In get_phys_addr_twostage() the code that applies the effects of
2
debugging.
2
VSTCR.{SA,SW} and VTCR.{NSA,NSW} only updates result->f.attrs.secure.
3
Now we also have f.attrs.space for FEAT_RME, we need to keep the two
4
in sync.
5
6
These bits only have an effect for Secure space translations, not
7
for Root, so use the input in_space field to determine whether to
8
apply them rather than the input is_secure. This doesn't actually
9
make a difference because Root translations are never two-stage,
10
but it's a little clearer.
3
11
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
14
Message-id: 20230710152130.3928330-4-peter.maydell@linaro.org
7
Message-id: 20180319161556.16446-2-peter.maydell@linaro.org
8
---
15
---
9
hw/sd/bcm2835_sdhost.c | 10 ++++++++++
16
target/arm/ptw.c | 13 ++++++++-----
10
hw/sd/trace-events | 6 ++++++
17
1 file changed, 8 insertions(+), 5 deletions(-)
11
2 files changed, 16 insertions(+)
12
18
13
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
14
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/sd/bcm2835_sdhost.c
21
--- a/target/arm/ptw.c
16
+++ b/hw/sd/bcm2835_sdhost.c
22
+++ b/target/arm/ptw.c
17
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
18
#include "qemu/log.h"
24
hwaddr ipa;
19
#include "sysemu/blockdev.h"
25
int s1_prot, s1_lgpgsz;
20
#include "hw/sd/bcm2835_sdhost.h"
26
bool is_secure = ptw->in_secure;
21
+#include "trace.h"
27
+ ARMSecuritySpace in_space = ptw->in_space;
22
28
bool ret, ipa_secure;
23
#define TYPE_BCM2835_SDHOST_BUS "bcm2835-sdhost-bus"
29
ARMCacheAttrs cacheattrs1;
24
#define BCM2835_SDHOST_BUS(obj) \
30
ARMSecuritySpace ipa_space;
25
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_update_irq(BCM2835SDHostState *s)
31
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
26
{
32
* Check if IPA translates to secure or non-secure PA space.
27
uint32_t irq = s->status &
33
* Note that VSTCR overrides VTCR and {N}SW overrides {N}SA.
28
(SDHSTS_BUSY_IRPT | SDHSTS_BLOCK_IRPT | SDHSTS_SDIO_IRPT);
34
*/
29
+ trace_bcm2835_sdhost_update_irq(irq);
35
- result->f.attrs.secure =
30
qemu_set_irq(s->irq, !!irq);
36
- (is_secure
37
- && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
38
- && (ipa_secure
39
- || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));
40
+ if (in_space == ARMSS_Secure) {
41
+ result->f.attrs.secure =
42
+ !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))
43
+ && (ipa_secure
44
+ || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)));
45
+ result->f.attrs.space = arm_secure_to_space(result->f.attrs.secure);
46
+ }
47
48
return false;
31
}
49
}
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
}
52
53
+ trace_bcm2835_sdhost_read(offset, res, size);
54
+
55
return res;
56
}
57
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
--
50
--
100
2.16.2
51
2.34.1
101
102
diff view generated by jsdifflib
1
When we run in TCG icount mode, we calculate the number of instructions
1
In commit f0a08b0913befbd we changed the type of the PC from
2
to execute using tcg_get_icount_limit(), which ensures that we stop
2
target_ulong to vaddr. In doing so we inadvertently dropped the
3
execution at the next timer deadline. However there is a bug where
3
zero-padding on the PC in trace lines (the second item inside the []
4
currently we do not recalculate that limit if the guest reprograms
4
in these lines). They used to look like this on AArch64, for
5
a timer so that the next deadline moves closer, and so we will
5
instance:
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
Trace 0: 0x7f2260000100 [00000000/0000000040000000/00000061/ff200000]
10
a VCPU in icount mode, we simply need to kick it out of the main
11
loop and back to tcg_cpu_exec(), where it will recalculate the
12
icount limit. If we are not currently running a VCPU, then we
13
retain the existing logic for waking up a halted CPU.
14
8
15
Cc: qemu-stable@nongnu.org
9
and now they look like this:
16
Fixes: https://bugs.launchpad.net/qemu/+bug/1754038
10
Trace 0: 0x7f4f50000100 [00000000/40000000/00000061/ff200000]
11
12
and if the PC happens to be somewhere low like 0x5000
13
then the field is shown as /5000/.
14
15
This is because TARGET_FMT_lx is a "%08x" or "%016x" specifier,
16
depending on TARGET_LONG_SIZE, whereas VADDR_PRIx is just PRIx64
17
with no width specifier.
18
19
Restore the zero-padding by adding an 016 width specifier to
20
this tracing and a couple of others that were similarly recently
21
changed to use VADDR_PRIx without a width specifier.
22
23
We can't unfortunately restore the "32-bit guests are padded to
24
8 hex digits and 64-bit guests to 16 hex digits" behaviour so
25
easily.
26
27
Fixes: f0a08b0913befbd ("accel/tcg/cpu-exec.c: Widen pc to vaddr")
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
19
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
30
Reviewed-by: Anton Johansson <anjo@rev.ng>
20
Message-id: 20180406123838.21249-1-peter.maydell@linaro.org
31
Message-id: 20230711165434.4123674-1-peter.maydell@linaro.org
21
---
32
---
22
cpus.c | 10 +++++++++-
33
accel/tcg/cpu-exec.c | 4 ++--
23
1 file changed, 9 insertions(+), 1 deletion(-)
34
accel/tcg/translate-all.c | 2 +-
35
2 files changed, 3 insertions(+), 3 deletions(-)
24
36
25
diff --git a/cpus.c b/cpus.c
37
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
26
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
27
--- a/cpus.c
39
--- a/accel/tcg/cpu-exec.c
28
+++ b/cpus.c
40
+++ b/accel/tcg/cpu-exec.c
29
@@ -XXX,XX +XXX,XX @@ void qemu_timer_notify_cb(void *opaque, QEMUClockType type)
41
@@ -XXX,XX +XXX,XX @@ static void log_cpu_exec(vaddr pc, CPUState *cpu,
30
return;
42
if (qemu_log_in_addr_range(pc)) {
31
}
43
qemu_log_mask(CPU_LOG_EXEC,
32
44
"Trace %d: %p [%08" PRIx64
33
- if (!qemu_in_vcpu_thread() && first_cpu) {
45
- "/%" VADDR_PRIx "/%08x/%08x] %s\n",
34
+ if (qemu_in_vcpu_thread()) {
46
+ "/%016" VADDR_PRIx "/%08x/%08x] %s\n",
35
+ /* A CPU is currently running; kick it back out to the
47
cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
36
+ * tcg_cpu_exec() loop so it will recalculate its
48
tb->flags, tb->cflags, lookup_symbol(pc));
37
+ * icount deadline immediately.
49
38
+ */
50
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
39
+ qemu_cpu_kick(current_cpu);
51
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
40
+ } else if (first_cpu) {
52
vaddr pc = log_pc(cpu, last_tb);
41
/* qemu_cpu_kick is not enough to kick a halted CPU out of
53
if (qemu_log_in_addr_range(pc)) {
42
* qemu_tcg_wait_io_event. async_run_on_cpu, instead,
54
- qemu_log("Stopped execution of TB chain before %p [%"
43
* causes cpu_thread_is_idle to return false. This way,
55
+ qemu_log("Stopped execution of TB chain before %p [%016"
44
* handle_icount_deadline can run.
56
VADDR_PRIx "] %s\n",
45
+ * If we have no CPUs at all for some reason, we don't
57
last_tb->tc.ptr, pc, lookup_symbol(pc));
46
+ * need to do anything.
58
}
47
*/
59
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
48
async_run_on_cpu(first_cpu, do_nothing, RUN_ON_CPU_NULL);
60
index XXXXXXX..XXXXXXX 100644
61
--- a/accel/tcg/translate-all.c
62
+++ b/accel/tcg/translate-all.c
63
@@ -XXX,XX +XXX,XX @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
64
if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
65
vaddr pc = log_pc(cpu, tb);
66
if (qemu_log_in_addr_range(pc)) {
67
- qemu_log("cpu_io_recompile: rewound execution of TB to %"
68
+ qemu_log("cpu_io_recompile: rewound execution of TB to %016"
69
VADDR_PRIx "\n", pc);
70
}
49
}
71
}
50
--
72
--
51
2.16.2
73
2.34.1
52
74
53
75
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Tong Ho <tong.ho@amd.com>
2
2
3
The instance_init function of a device can be called at any time, even
3
Add a check in the bit-set operation to write the backstore
4
if the device is not going to be used (i.e. not going to be realized).
4
only if the affected bit is 0 before.
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
5
11
$ echo "{'execute':'qmp_capabilities'}"\
6
With this in place, there will be no need for callers to
12
"{'execute':'device-list-properties',"\
7
do the checking in order to avoid unnecessary writes.
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
8
20
... and QEMU quits after printing the last line (which should not happen
9
Signed-off-by: Tong Ho <tong.ho@amd.com>
21
just because of running 'device-list-properties' here).
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
22
11
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
23
And with the cubieboard, this even causes QEMU to abort():
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
14
---
44
hw/arm/allwinner-a10.c | 12 ++++++------
15
hw/nvram/xlnx-efuse.c | 11 +++++++++--
45
1 file changed, 6 insertions(+), 6 deletions(-)
16
1 file changed, 9 insertions(+), 2 deletions(-)
46
17
47
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
18
diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
48
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/allwinner-a10.c
20
--- a/hw/nvram/xlnx-efuse.c
50
+++ b/hw/arm/allwinner-a10.c
21
+++ b/hw/nvram/xlnx-efuse.c
51
@@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj)
22
@@ -XXX,XX +XXX,XX @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
52
23
53
object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC);
24
bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
54
qdev_set_parent_bus(DEVICE(&s->emac), sysbus_get_default());
25
{
55
- /* FIXME use qdev NIC properties instead of nd_table[] */
26
+ uint32_t set, *row;
56
- if (nd_table[0].used) {
27
+
57
- qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
28
if (efuse_ro_bits_find(s, bit)) {
58
- qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
29
g_autofree char *path = object_get_canonical_path(OBJECT(s));
59
- }
30
60
31
@@ -XXX,XX +XXX,XX @@ bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
61
object_initialize(&s->sata, sizeof(s->sata), TYPE_ALLWINNER_AHCI);
32
return false;
62
qdev_set_parent_bus(DEVICE(&s->sata), sysbus_get_default());
33
}
63
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
34
64
sysbus_connect_irq(sysbusdev, 4, s->irq[67]);
35
- s->fuse32[bit / 32] |= 1 << (bit % 32);
65
sysbus_connect_irq(sysbusdev, 5, s->irq[68]);
36
- efuse_bdrv_sync(s, bit);
66
37
+ /* Avoid back-end write unless there is a real update */
67
+ /* FIXME use qdev NIC properties instead of nd_table[] */
38
+ row = &s->fuse32[bit / 32];
68
+ if (nd_table[0].used) {
39
+ set = 1 << (bit % 32);
69
+ qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
40
+ if (!(set & *row)) {
70
+ qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
41
+ *row |= set;
42
+ efuse_bdrv_sync(s, bit);
71
+ }
43
+ }
72
object_property_set_bool(OBJECT(&s->emac), true, "realized", &err);
44
return true;
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
}
45
}
83
46
84
--
47
--
85
2.16.2
48
2.34.1
86
49
87
50
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
QEMU currently exits unexpectedly when trying to introspect the fsl-imx6
4
and fsl-imx7 devices on systems with many SMP CPUs:
5
6
$ echo "{'execute':'qmp_capabilities'}"\
7
"{'execute':'device-list-properties',"\
8
" 'arguments':{'typename':'fsl,imx6'}}" \
9
| arm-softmmu/qemu-system-arm -M virt,accel=qtest -qmp stdio -smp 8
10
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2},
11
"package": "build-all"}, "capabilities": []}}
12
{"return": {}}
13
fsl,imx6: Only 4 CPUs are supported (8 requested)
14
15
And:
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
42
--- a/hw/arm/fsl-imx6.c
43
+++ b/hw/arm/fsl-imx6.c
44
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
45
char name[NAME_SIZE];
46
int i;
47
48
- if (smp_cpus > FSL_IMX6_NUM_CPUS) {
49
- error_report("%s: Only %d CPUs are supported (%d requested)",
50
- TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus);
51
- exit(1);
52
- }
53
-
54
- for (i = 0; i < smp_cpus; i++) {
55
+ for (i = 0; i < MIN(smp_cpus, FSL_IMX6_NUM_CPUS); i++) {
56
object_initialize(&s->cpu[i], sizeof(s->cpu[i]),
57
"cortex-a9-" TYPE_ARM_CPU);
58
snprintf(name, NAME_SIZE, "cpu%d", i);
59
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
60
uint16_t i;
61
Error *err = NULL;
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
+
69
for (i = 0; i < smp_cpus; i++) {
70
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
+
101
for (i = 0; i < smp_cpus; i++) {
102
o = OBJECT(&s->cpu[i]);
103
104
--
105
2.16.2
106
107
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