1
Ten arm-related bug fixes for 2.12...
1
The following changes since commit 131c58469f6fb68c89b38fee6aba8bbb20c7f4bf:
2
2
3
thanks
3
rust: add --rust-target option for bindgen (2025-02-06 13:51:46 -0500)
4
-- PMM
5
6
The following changes since commit 4c2c1015905fa1d616750dfe024b4c0b35875950:
7
8
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20180323' into staging (2018-03-23 10:20:54 +0000)
9
4
10
are available in the Git repository at:
5
are available in the Git repository at:
11
6
12
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180323
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250210
13
8
14
for you to fetch changes up to 548f514cf89dd9ab39c0cb4c063097bccf141fdd:
9
for you to fetch changes up to 27a8d899c7a100fd5aa040a8b993bb257687c393:
15
10
16
target/arm: Always set FAR to a known unknown value for debug exceptions (2018-03-23 18:26:46 +0000)
11
linux-user: Do not define struct sched_attr if libc headers do (2025-02-07 16:09:20 +0000)
17
12
18
----------------------------------------------------------------
13
----------------------------------------------------------------
19
target-arm queue:
14
target-arm queue:
20
* arm/translate-a64: don't lose interrupts after unmasking via write to DAIF
15
* Deprecate pxa2xx CPUs, iwMMXt emulation, -old-param option
21
* sdhci: fix incorrect use of Error *
16
* Drop unused AArch64DecodeTable typedefs
22
* hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses
17
* Minor code cleanups
23
* hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15
18
* hw/net/cadence_gem: Fix the mask/compare/disable-mask logic
24
* i.MX: Support serial RS-232 break properly
19
* linux-user: Do not define struct sched_attr if libc headers do
25
* mach-virt: Set VM's SMBIOS system version to mc->name
26
* target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK
27
* target/arm: Factor out code to calculate FSR for debug exceptions
28
* target/arm: Set FSR for BKPT, BRK when raising exception
29
* target/arm: Always set FAR to a known unknown value for debug exceptions
30
20
31
----------------------------------------------------------------
21
----------------------------------------------------------------
32
Paolo Bonzini (1):
22
Andrew Yuan (1):
33
sdhci: fix incorrect use of Error *
23
hw/net/cadence_gem: Fix the mask/compare/disable-mask logic
34
24
35
Peter Maydell (6):
25
Khem Raj (1):
36
hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses
26
linux-user: Do not define struct sched_attr if libc headers do
37
hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15
38
target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK
39
target/arm: Factor out code to calculate FSR for debug exceptions
40
target/arm: Set FSR for BKPT, BRK when raising exception
41
target/arm: Always set FAR to a known unknown value for debug exceptions
42
27
43
Trent Piepho (1):
28
Peter Maydell (4):
44
i.MX: Support serial RS-232 break properly
29
target/arm: deprecate the pxa2xx CPUs and iwMMXt emulation
30
tests/tcg/arm: Remove test-arm-iwmmxt test
31
target/arm: Drop unused AArch64DecodeTable typedefs
32
qemu-options: Deprecate -old-param command line option
45
33
46
Victor Kamensky (1):
34
Philippe Mathieu-Daudé (6):
47
arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT
35
hw/arm/boot: Propagate vCPU to arm_load_dtb()
36
hw/arm/fsl-imx6: Add local 'mpcore/gic' variables
37
hw/arm/fsl-imx6ul: Add local 'mpcore/gic' variables
38
hw/arm/fsl-imx7: Add local 'mpcore/gic' variables
39
hw/cpu/arm: Alias 'num-cpu' property on TYPE_REALVIEW_MPCORE
40
hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro
48
41
49
Wei Huang (1):
42
docs/about/deprecated.rst | 34 ++++++++++++++++++++++
50
mach-virt: Set VM's SMBIOS system version to mc->name
43
include/hw/arm/boot.h | 4 ++-
44
target/arm/cpu.h | 1 +
45
hw/arm/boot.c | 11 +++----
46
hw/arm/fsl-imx6.c | 52 ++++++++++++++-------------------
47
hw/arm/fsl-imx6ul.c | 64 +++++++++++++++++------------------------
48
hw/arm/fsl-imx7.c | 52 +++++++++++++++------------------
49
hw/arm/virt.c | 2 +-
50
hw/cpu/a15mpcore.c | 21 ++++++--------
51
hw/cpu/a9mpcore.c | 21 ++++++--------
52
hw/cpu/arm11mpcore.c | 21 ++++++--------
53
hw/cpu/realview_mpcore.c | 29 +++++++------------
54
hw/net/cadence_gem.c | 26 +++++++++++++----
55
linux-user/syscall.c | 4 ++-
56
system/vl.c | 1 +
57
target/arm/cpu.c | 3 ++
58
target/arm/tcg/cpu32.c | 36 +++++++++++++++--------
59
target/arm/tcg/translate-a64.c | 11 -------
60
tests/tcg/arm/Makefile.target | 7 -----
61
tests/tcg/arm/README | 5 ----
62
tests/tcg/arm/test-arm-iwmmxt.S | 49 -------------------------------
63
21 files changed, 205 insertions(+), 249 deletions(-)
64
delete mode 100644 tests/tcg/arm/test-arm-iwmmxt.S
51
65
52
include/hw/arm/virt.h | 1 +
53
include/hw/char/imx_serial.h | 1 +
54
target/arm/helper.h | 1 +
55
target/arm/internals.h | 25 +++++++++++++++++++++++++
56
hw/arm/bcm2836.c | 2 +-
57
hw/arm/raspi.c | 2 +-
58
hw/arm/virt.c | 8 +++++++-
59
hw/char/imx_serial.c | 5 ++++-
60
hw/intc/arm_gicv3_cpuif.c | 6 +++---
61
hw/sd/sdhci.c | 4 ++--
62
target/arm/helper.c | 1 -
63
target/arm/op_helper.c | 33 ++++++++++++++++++++++-----------
64
target/arm/translate-a64.c | 21 ++++++++++++++++-----
65
target/arm/translate.c | 19 ++++++++++++++-----
66
14 files changed, 98 insertions(+), 31 deletions(-)
67
diff view generated by jsdifflib
1
For debug exceptions due to breakpoints or the BKPT instruction which
1
The pxa2xx CPUs are now only useful with user-mode emulation, because
2
are taken to AArch32, the Fault Address Register is architecturally
2
we dropped all the machine types that used them in 9.2. (Technically
3
UNKNOWN. We were using that as license to simply not set
3
you could alse use "-cpu pxa270" with a board model like versatilepb
4
env->exception.vaddress, but this isn't correct, because it will
4
which doesn't sanity-check the CPU type, but that has never been a
5
expose to the guest whatever old value was in that field when
5
supported config.)
6
arm_cpu_do_interrupt_aarch32() writes it to the guest IFSR. That old
7
value might be a FAR for a previous guest EL2 or secure exception, in
8
which case we shouldn't show it to an EL1 or non-secure exception
9
handler. It might also be a non-deterministic value, which is bad
10
for record-and-replay.
11
6
12
Clear env->exception.vaddress before taking breakpoint debug
7
To use them (or iwMMXt emulation) with QEMU user-mode you would need
13
exceptions, to avoid this minor information leak.
8
to explicitly select them with the -cpu option or the QEMU_CPU
9
environment variable. A google search finds no examples of anybody
10
doing this in the last decade; I don't believe the GCC folks are
11
using QEMU to test their iwMMXt codegen either. In fact, GCC is in
12
the process of dropping support for iwMMXT entirely.
13
14
The iwMMXt emulation is thousands of lines of code in QEMU, and
15
is now the only bit of Arm insn decode which doesn't use decodetree.
16
We have no way to test or validate changes to it. This code is
17
just dead weight that is almost certainly not being used by anybody.
18
Mark it as deprecated.
14
19
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20180320134114.30418-5-peter.maydell@linaro.org
22
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
23
Message-id: 20250127112715.2936555-2-peter.maydell@linaro.org
18
---
24
---
19
target/arm/op_helper.c | 11 ++++++++++-
25
docs/about/deprecated.rst | 21 +++++++++++++++++++++
20
1 file changed, 10 insertions(+), 1 deletion(-)
26
target/arm/cpu.h | 1 +
27
target/arm/cpu.c | 3 +++
28
target/arm/tcg/cpu32.c | 36 ++++++++++++++++++++++++------------
29
4 files changed, 49 insertions(+), 12 deletions(-)
21
30
22
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
31
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
23
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/op_helper.c
33
--- a/docs/about/deprecated.rst
25
+++ b/target/arm/op_helper.c
34
+++ b/docs/about/deprecated.rst
26
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
35
@@ -XXX,XX +XXX,XX @@ is going to be so much slower it wouldn't make sense for any serious
27
{
36
instrumentation. Due to implementation differences there will also be
28
/* FSR will only be used if the debug target EL is AArch32. */
37
anomalies in things like memory instrumentation.
29
env->exception.fsr = arm_debug_exception_fsr(env);
38
30
+ /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
39
+linux-user mode CPUs
31
+ * values to the guest that it shouldn't be able to see at its
40
+--------------------
32
+ * exception/security level.
41
+
33
+ */
42
+iwMMXt emulation and the ``pxa`` CPUs (since 10.0)
34
+ env->exception.vaddress = 0;
43
+''''''''''''''''''''''''''''''''''''''''''''''''''
35
raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env));
44
+
45
+The ``pxa`` CPU family (``pxa250``, ``pxa255``, ``pxa260``,
46
+``pxa261``, ``pxa262``, ``pxa270-a0``, ``pxa270-a1``, ``pxa270``,
47
+``pxa270-b0``, ``pxa270-b1``, ``pxa270-c0``, ``pxa270-c5``) are no
48
+longer used in system emulation, because all the machine types which
49
+used these CPUs were removed in the QEMU 9.2 release. These CPUs can
50
+now only be used in linux-user mode, and to do that you would have to
51
+explicitly select one of these CPUs with the ``-cpu`` command line
52
+option or the ``QEMU_CPU`` environment variable.
53
+
54
+We don't believe that anybody is using the iwMMXt emulation, and we do
55
+not have any tests to validate it or any real hardware or similar
56
+known-good implementation to test against. GCC is in the process of
57
+dropping their support for iwMMXt codegen. These CPU types are
58
+therefore deprecated in QEMU, and will be removed in a future release.
59
+
60
System emulator CPUs
61
--------------------
62
63
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/cpu.h
66
+++ b/target/arm/cpu.h
67
@@ -XXX,XX +XXX,XX @@ struct ArchCPU {
68
69
typedef struct ARMCPUInfo {
70
const char *name;
71
+ const char *deprecation_note;
72
void (*initfn)(Object *obj);
73
void (*class_init)(ObjectClass *oc, void *data);
74
} ARMCPUInfo;
75
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/cpu.c
78
+++ b/target/arm/cpu.c
79
@@ -XXX,XX +XXX,XX @@ static void cpu_register_class_init(ObjectClass *oc, void *data)
80
81
acc->info = data;
82
cc->gdb_core_xml_file = "arm-core.xml";
83
+ if (acc->info->deprecation_note) {
84
+ cc->deprecation_note = acc->info->deprecation_note;
85
+ }
36
}
86
}
37
87
38
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
88
void arm_cpu_register(const ARMCPUInfo *info)
39
}
89
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
40
90
index XXXXXXX..XXXXXXX 100644
41
env->exception.fsr = arm_debug_exception_fsr(env);
91
--- a/target/arm/tcg/cpu32.c
42
- /* FAR is UNKNOWN, so doesn't need setting */
92
+++ b/target/arm/tcg/cpu32.c
43
+ /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
93
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = {
44
+ * values to the guest that it shouldn't be able to see at its
94
{ .name = "ti925t", .initfn = ti925t_initfn },
45
+ * exception/security level.
95
{ .name = "sa1100", .initfn = sa1100_initfn },
46
+ */
96
{ .name = "sa1110", .initfn = sa1110_initfn },
47
+ env->exception.vaddress = 0;
97
- { .name = "pxa250", .initfn = pxa250_initfn },
48
raise_exception(env, EXCP_PREFETCH_ABORT,
98
- { .name = "pxa255", .initfn = pxa255_initfn },
49
syn_breakpoint(same_el),
99
- { .name = "pxa260", .initfn = pxa260_initfn },
50
arm_debug_target_el(env));
100
- { .name = "pxa261", .initfn = pxa261_initfn },
101
- { .name = "pxa262", .initfn = pxa262_initfn },
102
+ { .name = "pxa250", .initfn = pxa250_initfn,
103
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
104
+ { .name = "pxa255", .initfn = pxa255_initfn,
105
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
106
+ { .name = "pxa260", .initfn = pxa260_initfn,
107
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
108
+ { .name = "pxa261", .initfn = pxa261_initfn,
109
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
110
+ { .name = "pxa262", .initfn = pxa262_initfn,
111
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
112
/* "pxa270" is an alias for "pxa270-a0" */
113
- { .name = "pxa270", .initfn = pxa270a0_initfn },
114
- { .name = "pxa270-a0", .initfn = pxa270a0_initfn },
115
- { .name = "pxa270-a1", .initfn = pxa270a1_initfn },
116
- { .name = "pxa270-b0", .initfn = pxa270b0_initfn },
117
- { .name = "pxa270-b1", .initfn = pxa270b1_initfn },
118
- { .name = "pxa270-c0", .initfn = pxa270c0_initfn },
119
- { .name = "pxa270-c5", .initfn = pxa270c5_initfn },
120
+ { .name = "pxa270", .initfn = pxa270a0_initfn,
121
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
122
+ { .name = "pxa270-a0", .initfn = pxa270a0_initfn,
123
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
124
+ { .name = "pxa270-a1", .initfn = pxa270a1_initfn,
125
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
126
+ { .name = "pxa270-b0", .initfn = pxa270b0_initfn,
127
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
128
+ { .name = "pxa270-b1", .initfn = pxa270b1_initfn,
129
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
130
+ { .name = "pxa270-c0", .initfn = pxa270c0_initfn,
131
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
132
+ { .name = "pxa270-c5", .initfn = pxa270c5_initfn,
133
+ .deprecation_note = "iwMMXt CPUs are no longer supported", },
134
#ifndef TARGET_AARCH64
135
{ .name = "max", .initfn = arm_max_initfn },
136
#endif
51
--
137
--
52
2.16.2
138
2.34.1
53
139
54
140
diff view generated by jsdifflib
1
When a debug exception is taken to AArch32, it appears as a Prefetch
1
The test-arm-iwmmmxt test isn't testing what it thinks it's testing.
2
Abort, and the Instruction Fault Status Register (IFSR) must be set.
3
The IFSR has two possible formats, depending on whether LPAE is in
4
use. Factor out the code in arm_debug_excp_handler() which picks
5
an FSR value into its own utility function, update it to use
6
arm_fi_to_lfsc() and arm_fi_to_sfsc() rather than hard-coded constants,
7
and use the correct condition to select long or short format.
8
2
9
In particular this fixes a bug where we could select the short
3
If you run it with a CPU type that supports iwMMXt then it will crash
10
format because we're at EL0 and the EL1 translation regime is
4
immediately with a SIGILL, because (even with -marm) GCC will link it
11
not using LPAE, but then route the debug exception to EL2 because
5
against startup code that is in Thumb mode, and no iwMMXt CPU has
12
of MDCR_EL2.TDE and hand EL2 the wrong format FSR.
6
Thumb:
7
8
00010338 <_start>:
9
10338: f04f 0b00 mov.w fp, #0
10
1033c: f04f 0e00 mov.w lr, #0
11
12
If you run it with a CPU type which does *not* support iwMMXt, which
13
is what 'make check-tcg' does, then QEMU will not try to handle the
14
insns as iwMMXt. Instead the translator turns them into illegal
15
instructions. Then in the linux-user cpu_loop() code we identify
16
them as FPA11 instructions inside emulate_arm_fpa11(), because the
17
FPA11 happened to use the same coprocessor number as these iwMMXt
18
insns. So we execute a completely different set of FPA11 insns,
19
which means we don't crash, but we will print garbage to stdout.
20
Then the test binary always exits with a 0 return code, so 'make
21
check-tcg' thinks the test passes.
22
23
Modern gnueabihf toolchains assume in their startup code that the CPU
24
is not so old as to not support Thumb, so there's no way to get them
25
to generate a binary that actually does what the test wants. Since
26
we're deprecating iwMMXt emulation anyway, it's not worth trying to
27
salvage the test case to get it to really test the iwMMXt insns.
28
29
Delete the test entirely.
13
30
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
32
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20180320134114.30418-3-peter.maydell@linaro.org
33
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
34
Message-id: 20250127112715.2936555-3-peter.maydell@linaro.org
17
---
35
---
18
target/arm/internals.h | 25 +++++++++++++++++++++++++
36
tests/tcg/arm/Makefile.target | 7 -----
19
target/arm/op_helper.c | 12 ++----------
37
tests/tcg/arm/README | 5 ----
20
2 files changed, 27 insertions(+), 10 deletions(-)
38
tests/tcg/arm/test-arm-iwmmxt.S | 49 ---------------------------------
39
3 files changed, 61 deletions(-)
40
delete mode 100644 tests/tcg/arm/test-arm-iwmmxt.S
21
41
22
diff --git a/target/arm/internals.h b/target/arm/internals.h
42
diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target
23
index XXXXXXX..XXXXXXX 100644
43
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/internals.h
44
--- a/tests/tcg/arm/Makefile.target
25
+++ b/target/arm/internals.h
45
+++ b/tests/tcg/arm/Makefile.target
26
@@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx)
46
@@ -XXX,XX +XXX,XX @@ ARM_TESTS = hello-arm
27
}
47
hello-arm: CFLAGS+=-marm -ffreestanding -fno-stack-protector
28
}
48
hello-arm: LDFLAGS+=-nostdlib
29
49
30
+/* Return the FSR value for a debug exception (watchpoint, hardware
50
-# IWMXT floating point extensions
31
+ * breakpoint or BKPT insn) targeting the specified exception level.
51
-ARM_TESTS += test-arm-iwmmxt
32
+ */
52
-# Clang assembler does not support IWMXT, so use the external assembler.
33
+static inline uint32_t arm_debug_exception_fsr(CPUARMState *env)
53
-test-arm-iwmmxt: CFLAGS += -marm -march=iwmmxt -mabi=aapcs -mfpu=fpv4-sp-d16 $(CROSS_CC_HAS_FNIA)
34
+{
54
-test-arm-iwmmxt: test-arm-iwmmxt.S
35
+ ARMMMUFaultInfo fi = { .type = ARMFault_Debug };
55
-    $(CC) $(CFLAGS) -Wa,--noexecstack $< -o $@ $(LDFLAGS)
36
+ int target_el = arm_debug_target_el(env);
56
-
37
+ bool using_lpae = false;
57
# Float-convert Tests
38
+
58
ARM_TESTS += fcvt
39
+ if (target_el == 2 || arm_el_is_aa64(env, target_el)) {
59
fcvt: LDFLAGS += -lm
40
+ using_lpae = true;
60
diff --git a/tests/tcg/arm/README b/tests/tcg/arm/README
41
+ } else {
42
+ if (arm_feature(env, ARM_FEATURE_LPAE) &&
43
+ (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) {
44
+ using_lpae = true;
45
+ }
46
+ }
47
+
48
+ if (using_lpae) {
49
+ return arm_fi_to_lfsc(&fi);
50
+ } else {
51
+ return arm_fi_to_sfsc(&fi);
52
+ }
53
+}
54
+
55
#endif
56
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
57
index XXXXXXX..XXXXXXX 100644
61
index XXXXXXX..XXXXXXX 100644
58
--- a/target/arm/op_helper.c
62
--- a/tests/tcg/arm/README
59
+++ b/target/arm/op_helper.c
63
+++ b/tests/tcg/arm/README
60
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
64
@@ -XXX,XX +XXX,XX @@ hello-arm
61
65
---------
62
cs->watchpoint_hit = NULL;
66
63
67
A very simple inline assembly, write syscall based hello world
64
- if (extended_addresses_enabled(env)) {
68
-
65
- env->exception.fsr = (1 << 9) | 0x22;
69
-test-arm-iwmmxt
66
- } else {
70
----------------
67
- env->exception.fsr = 0x2;
71
-
68
- }
72
-A simple test case for older iwmmxt extended ARMs
69
+ env->exception.fsr = arm_debug_exception_fsr(env);
73
diff --git a/tests/tcg/arm/test-arm-iwmmxt.S b/tests/tcg/arm/test-arm-iwmmxt.S
70
env->exception.vaddress = wp_hit->hitaddr;
74
deleted file mode 100644
71
raise_exception(env, EXCP_DATA_ABORT,
75
index XXXXXXX..XXXXXXX
72
syn_watchpoint(same_el, 0, wnr),
76
--- a/tests/tcg/arm/test-arm-iwmmxt.S
73
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
77
+++ /dev/null
74
return;
78
@@ -XXX,XX +XXX,XX @@
75
}
79
-@ Checks whether iwMMXt is functional.
76
80
-.code    32
77
- if (extended_addresses_enabled(env)) {
81
-.globl    main
78
- env->exception.fsr = (1 << 9) | 0x22;
82
-
79
- } else {
83
-main:
80
- env->exception.fsr = 0x2;
84
-ldr    r0, =data0
81
- }
85
-ldr    r1, =data1
82
+ env->exception.fsr = arm_debug_exception_fsr(env);
86
-ldr    r2, =data2
83
/* FAR is UNKNOWN, so doesn't need setting */
87
-#ifndef FPA
84
raise_exception(env, EXCP_PREFETCH_ABORT,
88
-wldrd    wr0, [r0, #0]
85
syn_breakpoint(same_el),
89
-wldrd    wr1, [r0, #8]
90
-wldrd    wr2, [r1, #0]
91
-wldrd    wr3, [r1, #8]
92
-wsubb    wr2, wr2, wr0
93
-wsubb    wr3, wr3, wr1
94
-wldrd    wr0, [r2, #0]
95
-wldrd    wr1, [r2, #8]
96
-waddb    wr0, wr0, wr2
97
-waddb    wr1, wr1, wr3
98
-wstrd    wr0, [r2, #0]
99
-wstrd    wr1, [r2, #8]
100
-#else
101
-ldfe    f0, [r0, #0]
102
-ldfe    f1, [r0, #8]
103
-ldfe    f2, [r1, #0]
104
-ldfe    f3, [r1, #8]
105
-adfdp    f2, f2, f0
106
-adfdp    f3, f3, f1
107
-ldfe    f0, [r2, #0]
108
-ldfe    f1, [r2, #8]
109
-adfd    f0, f0, f2
110
-adfd    f1, f1, f3
111
-stfe    f0, [r2, #0]
112
-stfe    f1, [r2, #8]
113
-#endif
114
-mov    r0, #1
115
-mov    r1, r2
116
-mov    r2, #0x11
117
-swi    #0x900004
118
-mov    r0, #0
119
-swi    #0x900001
120
-
121
-.data
122
-data0:
123
-.string    "aaaabbbbccccdddd"
124
-data1:
125
-.string    "bbbbccccddddeeee"
126
-data2:
127
-.string    "hvLLWs\x1fsdrs9\x1fNJ-\n"
86
--
128
--
87
2.16.2
129
2.34.1
88
130
89
131
diff view generated by jsdifflib
New patch
1
We removed the old table-based decoder in favour of decodetree, but
2
we left a couple of typedefs that are now unused; delete them.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250128135046.4108775-1-peter.maydell@linaro.org
7
---
8
target/arm/tcg/translate-a64.c | 11 -----------
9
1 file changed, 11 deletions(-)
10
11
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/tcg/translate-a64.c
14
+++ b/target/arm/tcg/translate-a64.c
15
@@ -XXX,XX +XXX,XX @@ static int scale_by_log2_tag_granule(DisasContext *s, int x)
16
#include "decode-sme-fa64.c.inc"
17
#include "decode-a64.c.inc"
18
19
-/* Table based decoder typedefs - used when the relevant bits for decode
20
- * are too awkwardly scattered across the instruction (eg SIMD).
21
- */
22
-typedef void AArch64DecodeFn(DisasContext *s, uint32_t insn);
23
-
24
-typedef struct AArch64DecodeTable {
25
- uint32_t pattern;
26
- uint32_t mask;
27
- AArch64DecodeFn *disas_fn;
28
-} AArch64DecodeTable;
29
-
30
/* initialize TCG globals. */
31
void a64_translate_init(void)
32
{
33
--
34
2.34.1
diff view generated by jsdifflib
1
From: Wei Huang <wei@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Instead of using "1.0" as the system version of SMBIOS, we should use
3
In heterogeneous setup the first vCPU might not be
4
mc->name for mach-virt machine type to be consistent other architectures.
4
the one expected, better pass it explicitly.
5
With this patch, "dmidecode -t 1" (e.g., "-M virt-2.12,accel=kvm") will
6
show:
7
5
8
Handle 0x0100, DMI type 1, 27 bytes
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
System Information
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
10
Manufacturer: QEMU
8
Message-id: 20250130112615.3219-2-philmd@linaro.org
11
Product Name: KVM Virtual Machine
12
Version: virt-2.12
13
Serial Number: Not Specified
14
...
15
16
instead of:
17
18
Handle 0x0100, DMI type 1, 27 bytes
19
System Information
20
Manufacturer: QEMU
21
Product Name: KVM Virtual Machine
22
Version: 1.0
23
Serial Number: Not Specified
24
...
25
26
For backward compatibility, we allow older machine types to keep "1.0"
27
as the default system version.
28
29
Signed-off-by: Wei Huang <wei@redhat.com>
30
Reviewed-by: Andrew Jones <drjones@redhat.com>
31
Message-id: 20180322212318.7182-1-wei@redhat.com
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
10
---
34
include/hw/arm/virt.h | 1 +
11
include/hw/arm/boot.h | 4 +++-
35
hw/arm/virt.c | 8 +++++++-
12
hw/arm/boot.c | 11 ++++++-----
36
2 files changed, 8 insertions(+), 1 deletion(-)
13
hw/arm/virt.c | 2 +-
14
3 files changed, 10 insertions(+), 7 deletions(-)
37
15
38
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
16
diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h
39
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
40
--- a/include/hw/arm/virt.h
18
--- a/include/hw/arm/boot.h
41
+++ b/include/hw/arm/virt.h
19
+++ b/include/hw/arm/boot.h
42
@@ -XXX,XX +XXX,XX @@ typedef struct {
20
@@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu,
43
bool no_its;
21
* @binfo: struct describing the boot environment
44
bool no_pmu;
22
* @addr_limit: upper limit of the available memory area at @addr
45
bool claim_edge_triggered_timers;
23
* @as: address space to load image to
46
+ bool smbios_old_sys_ver;
24
+ * @cpu: ARM CPU object
47
} VirtMachineClass;
25
*
48
26
* Load a device tree supplied by the machine or by the user with the
49
typedef struct {
27
* '-dtb' command line option, and put it at offset @addr in target
28
@@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu,
29
* Note: Must not be called unless have_dtb(binfo) is true.
30
*/
31
int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
32
- hwaddr addr_limit, AddressSpace *as, MachineState *ms);
33
+ hwaddr addr_limit, AddressSpace *as, MachineState *ms,
34
+ ARMCPU *cpu);
35
36
/* Write a secure board setup routine with a dummy handler for SMCs */
37
void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
38
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/boot.c
41
+++ b/hw/arm/boot.c
42
@@ -XXX,XX +XXX,XX @@ out:
43
return ret;
44
}
45
46
-static void fdt_add_psci_node(void *fdt)
47
+static void fdt_add_psci_node(void *fdt, ARMCPU *armcpu)
48
{
49
uint32_t cpu_suspend_fn;
50
uint32_t cpu_off_fn;
51
uint32_t cpu_on_fn;
52
uint32_t migrate_fn;
53
- ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0));
54
const char *psci_method;
55
int64_t psci_conduit;
56
int rc;
57
@@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt)
58
}
59
60
int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
61
- hwaddr addr_limit, AddressSpace *as, MachineState *ms)
62
+ hwaddr addr_limit, AddressSpace *as, MachineState *ms,
63
+ ARMCPU *cpu)
64
{
65
void *fdt = NULL;
66
int size, rc, n = 0;
67
@@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
68
}
69
}
70
71
- fdt_add_psci_node(fdt);
72
+ fdt_add_psci_node(fdt, cpu);
73
74
if (binfo->modify_dtb) {
75
binfo->modify_dtb(binfo, fdt);
76
@@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms, struct arm_boot_info *info)
77
* decided whether to enable PSCI and set the psci-conduit CPU properties.
78
*/
79
if (!info->skip_dtb_autoload && have_dtb(info)) {
80
- if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) {
81
+ if (arm_load_dtb(info->dtb_start, info, info->dtb_limit,
82
+ as, ms, cpu) < 0) {
83
exit(1);
84
}
85
}
50
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
86
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
51
index XXXXXXX..XXXXXXX 100644
87
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/virt.c
88
--- a/hw/arm/virt.c
53
+++ b/hw/arm/virt.c
89
+++ b/hw/arm/virt.c
54
@@ -XXX,XX +XXX,XX @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
90
@@ -XXX,XX +XXX,XX @@ void virt_machine_done(Notifier *notifier, void *data)
55
91
vms->memmap[VIRT_PLATFORM_BUS].size,
56
static void virt_build_smbios(VirtMachineState *vms)
92
vms->irqmap[VIRT_PLATFORM_BUS]);
57
{
58
+ MachineClass *mc = MACHINE_GET_CLASS(vms);
59
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
60
uint8_t *smbios_tables, *smbios_anchor;
61
size_t smbios_tables_len, smbios_anchor_len;
62
const char *product = "QEMU Virtual Machine";
63
@@ -XXX,XX +XXX,XX @@ static void virt_build_smbios(VirtMachineState *vms)
64
}
93
}
65
94
- if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) {
66
smbios_set_defaults("QEMU", product,
95
+ if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms, cpu) < 0) {
67
- "1.0", false, true, SMBIOS_ENTRY_POINT_30);
96
exit(1);
68
+ vmc->smbios_old_sys_ver ? "1.0" : mc->name, false,
97
}
69
+ true, SMBIOS_ENTRY_POINT_30);
70
71
smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len,
72
&smbios_anchor, &smbios_anchor_len);
73
@@ -XXX,XX +XXX,XX @@ static void virt_2_11_instance_init(Object *obj)
74
75
static void virt_machine_2_11_options(MachineClass *mc)
76
{
77
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
78
+
79
virt_machine_2_12_options(mc);
80
SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11);
81
+ vmc->smbios_old_sys_ver = true;
82
}
83
DEFINE_VIRT_MACHINE(2, 11)
84
98
85
--
99
--
86
2.16.2
100
2.34.1
87
101
88
102
diff view generated by jsdifflib
1
Now that we have a helper function specifically for the BRK and
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
BKPT instructions, we can set the exception.fsr there rather
3
than in arm_cpu_do_interrupt_aarch32(). This allows us to
4
use our new arm_debug_exception_fsr() helper.
5
2
6
In particular this fixes a bug where we were hardcoding the
3
The A9MPCore forward the IRQs from its internal GIC.
7
short-form IFSR value, which is wrong if the target exception
4
To make the code clearer, add the 'mpcore' and 'gic'
8
level has LPAE enabled.
5
variables.
9
6
10
Fixes: https://bugs.launchpad.net/qemu/+bug/1756927
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Message-id: 20250130112615.3219-3-philmd@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180320134114.30418-4-peter.maydell@linaro.org
14
---
11
---
15
target/arm/helper.c | 1 -
12
hw/arm/fsl-imx6.c | 52 +++++++++++++++++++----------------------------
16
target/arm/op_helper.c | 2 ++
13
1 file changed, 21 insertions(+), 31 deletions(-)
17
2 files changed, 2 insertions(+), 1 deletion(-)
18
14
19
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/helper.c
17
--- a/hw/arm/fsl-imx6.c
22
+++ b/target/arm/helper.c
18
+++ b/hw/arm/fsl-imx6.c
23
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
19
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
24
offset = 0;
20
uint16_t i;
25
break;
21
qemu_irq irq;
26
case EXCP_BKPT:
22
unsigned int smp_cpus = ms->smp.cpus;
27
- env->exception.fsr = 2;
23
+ DeviceState *mpcore = DEVICE(&s->a9mpcore);
28
/* Fall through to prefetch abort. */
24
+ DeviceState *gic;
29
case EXCP_PREFETCH_ABORT:
25
30
A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr);
26
if (smp_cpus > FSL_IMX6_NUM_CPUS) {
31
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
27
error_setg(errp, "%s: Only %d CPUs are supported (%d requested)",
32
index XXXXXXX..XXXXXXX 100644
28
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
33
--- a/target/arm/op_helper.c
29
}
34
+++ b/target/arm/op_helper.c
30
}
35
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
31
36
*/
32
- object_property_set_int(OBJECT(&s->a9mpcore), "num-cpu", smp_cpus,
37
void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
33
- &error_abort);
38
{
34
+ object_property_set_int(OBJECT(mpcore), "num-cpu", smp_cpus, &error_abort);
39
+ /* FSR will only be used if the debug target EL is AArch32. */
35
40
+ env->exception.fsr = arm_debug_exception_fsr(env);
36
- object_property_set_int(OBJECT(&s->a9mpcore), "num-irq",
41
raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env));
37
+ object_property_set_int(OBJECT(mpcore), "num-irq",
42
}
38
FSL_IMX6_MAX_IRQ + GIC_INTERNAL, &error_abort);
43
39
40
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->a9mpcore), errp)) {
41
+ if (!sysbus_realize(SYS_BUS_DEVICE(mpcore), errp)) {
42
return;
43
}
44
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->a9mpcore), 0, FSL_IMX6_A9MPCORE_ADDR);
45
+ sysbus_mmio_map(SYS_BUS_DEVICE(mpcore), 0, FSL_IMX6_A9MPCORE_ADDR);
46
47
+ gic = mpcore;
48
for (i = 0; i < smp_cpus; i++) {
49
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i,
50
+ sysbus_connect_irq(SYS_BUS_DEVICE(gic), i,
51
qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_IRQ));
52
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i + smp_cpus,
53
+ sysbus_connect_irq(SYS_BUS_DEVICE(gic), i + smp_cpus,
54
qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_FIQ));
55
}
56
57
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
58
59
sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr);
60
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
61
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
62
- serial_table[i].irq));
63
+ qdev_get_gpio_in(gic, serial_table[i].irq));
64
}
65
66
s->gpt.ccm = IMX_CCM(&s->ccm);
67
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
68
69
sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt), 0, FSL_IMX6_GPT_ADDR);
70
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt), 0,
71
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
72
- FSL_IMX6_GPT_IRQ));
73
+ qdev_get_gpio_in(gic, FSL_IMX6_GPT_IRQ));
74
75
/* Initialize all EPIT timers */
76
for (i = 0; i < FSL_IMX6_NUM_EPITS; i++) {
77
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
78
79
sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, epit_table[i].addr);
80
sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0,
81
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
82
- epit_table[i].irq));
83
+ qdev_get_gpio_in(gic, epit_table[i].irq));
84
}
85
86
/* Initialize all I2C */
87
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
88
89
sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, i2c_table[i].addr);
90
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
91
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
92
- i2c_table[i].irq));
93
+ qdev_get_gpio_in(gic, i2c_table[i].irq));
94
}
95
96
/* Initialize all GPIOs */
97
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
98
99
sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr);
100
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
101
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
102
- gpio_table[i].irq_low));
103
+ qdev_get_gpio_in(gic, gpio_table[i].irq_low));
104
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
105
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
106
- gpio_table[i].irq_high));
107
+ qdev_get_gpio_in(gic, gpio_table[i].irq_high));
108
}
109
110
/* Initialize all SDHC */
111
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
112
}
113
sysbus_mmio_map(SYS_BUS_DEVICE(&s->esdhc[i]), 0, esdhc_table[i].addr);
114
sysbus_connect_irq(SYS_BUS_DEVICE(&s->esdhc[i]), 0,
115
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
116
- esdhc_table[i].irq));
117
+ qdev_get_gpio_in(gic, esdhc_table[i].irq));
118
}
119
120
/* USB */
121
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
122
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
123
FSL_IMX6_USBOH3_USB_ADDR + i * 0x200);
124
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
125
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
126
- FSL_IMX6_USBn_IRQ[i]));
127
+ qdev_get_gpio_in(gic, FSL_IMX6_USBn_IRQ[i]));
128
}
129
130
/* Initialize all ECSPI */
131
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
132
133
sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_table[i].addr);
134
sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
135
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
136
- spi_table[i].irq));
137
+ qdev_get_gpio_in(gic, spi_table[i].irq));
138
}
139
140
object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num,
141
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
142
}
143
sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth), 0, FSL_IMX6_ENET_ADDR);
144
sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth), 0,
145
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
146
- FSL_IMX6_ENET_MAC_IRQ));
147
+ qdev_get_gpio_in(gic, FSL_IMX6_ENET_MAC_IRQ));
148
sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth), 1,
149
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
150
- FSL_IMX6_ENET_MAC_1588_IRQ));
151
+ qdev_get_gpio_in(gic, FSL_IMX6_ENET_MAC_1588_IRQ));
152
153
/*
154
* SNVS
155
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
156
157
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]);
158
sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
159
- qdev_get_gpio_in(DEVICE(&s->a9mpcore),
160
- FSL_IMX6_WDOGn_IRQ[i]));
161
+ qdev_get_gpio_in(gic, FSL_IMX6_WDOGn_IRQ[i]));
162
}
163
164
/*
44
--
165
--
45
2.16.2
166
2.34.1
46
167
47
168
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Detected by Coverity (CID 1386072, 1386073, 1386076, 1386077). local_err
3
The A7MPCore forward the IRQs from its internal GIC.
4
was unused, and this made the static analyzer unhappy.
4
To make the code clearer, add the 'mpcore' and 'gic'
5
variables. Rename 'd' variable as 'cpu'.
5
6
6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Message-id: 20180320151355.25854-1-pbonzini@redhat.com
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20250130112615.3219-4-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
hw/sd/sdhci.c | 4 ++--
12
hw/arm/fsl-imx6ul.c | 64 +++++++++++++++++++--------------------------
12
1 file changed, 2 insertions(+), 2 deletions(-)
13
1 file changed, 27 insertions(+), 37 deletions(-)
13
14
14
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
15
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/sd/sdhci.c
17
--- a/hw/arm/fsl-imx6ul.c
17
+++ b/hw/sd/sdhci.c
18
+++ b/hw/arm/fsl-imx6ul.c
18
@@ -XXX,XX +XXX,XX @@ static void sdhci_pci_realize(PCIDevice *dev, Error **errp)
19
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
19
Error *local_err = NULL;
20
{
20
21
MachineState *ms = MACHINE(qdev_get_machine());
21
sdhci_initfn(s);
22
FslIMX6ULState *s = FSL_IMX6UL(dev);
22
- sdhci_common_realize(s, errp);
23
+ DeviceState *mpcore = DEVICE(&s->a7mpcore);
23
+ sdhci_common_realize(s, &local_err);
24
int i;
24
if (local_err) {
25
char name[NAME_SIZE];
25
error_propagate(errp, local_err);
26
- SysBusDevice *sbd;
26
return;
27
- DeviceState *d;
27
@@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp)
28
+ DeviceState *gic;
28
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
29
+ SysBusDevice *gicsbd;
29
Error *local_err = NULL;
30
+ DeviceState *cpu;
30
31
31
- sdhci_common_realize(s, errp);
32
if (ms->smp.cpus > 1) {
32
+ sdhci_common_realize(s, &local_err);
33
error_setg(errp, "%s: Only a single CPU is supported (%d requested)",
33
if (local_err) {
34
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
34
error_propagate(errp, local_err);
35
/*
35
return;
36
* A7MPCORE
37
*/
38
- object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", 1, &error_abort);
39
- object_property_set_int(OBJECT(&s->a7mpcore), "num-irq",
40
+ object_property_set_int(OBJECT(mpcore), "num-cpu", 1, &error_abort);
41
+ object_property_set_int(OBJECT(mpcore), "num-irq",
42
FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, &error_abort);
43
- sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort);
44
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR);
45
+ sysbus_realize(SYS_BUS_DEVICE(mpcore), &error_abort);
46
+ sysbus_mmio_map(SYS_BUS_DEVICE(mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR);
47
48
- sbd = SYS_BUS_DEVICE(&s->a7mpcore);
49
- d = DEVICE(&s->cpu);
50
-
51
- sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(d, ARM_CPU_IRQ));
52
- sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(d, ARM_CPU_FIQ));
53
- sysbus_connect_irq(sbd, 2, qdev_get_gpio_in(d, ARM_CPU_VIRQ));
54
- sysbus_connect_irq(sbd, 3, qdev_get_gpio_in(d, ARM_CPU_VFIQ));
55
+ gic = mpcore;
56
+ gicsbd = SYS_BUS_DEVICE(gic);
57
+ cpu = DEVICE(&s->cpu);
58
+ sysbus_connect_irq(gicsbd, 0, qdev_get_gpio_in(cpu, ARM_CPU_IRQ));
59
+ sysbus_connect_irq(gicsbd, 1, qdev_get_gpio_in(cpu, ARM_CPU_FIQ));
60
+ sysbus_connect_irq(gicsbd, 2, qdev_get_gpio_in(cpu, ARM_CPU_VIRQ));
61
+ sysbus_connect_irq(gicsbd, 3, qdev_get_gpio_in(cpu, ARM_CPU_VFIQ));
62
63
/*
64
* A7MPCORE DAP
65
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
66
FSL_IMX6UL_GPTn_ADDR[i]);
67
68
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0,
69
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
70
- FSL_IMX6UL_GPTn_IRQ[i]));
71
+ qdev_get_gpio_in(gic, FSL_IMX6UL_GPTn_IRQ[i]));
72
}
73
74
/*
75
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
76
FSL_IMX6UL_EPITn_ADDR[i]);
77
78
sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0,
79
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
80
- FSL_IMX6UL_EPITn_IRQ[i]));
81
+ qdev_get_gpio_in(gic, FSL_IMX6UL_EPITn_IRQ[i]));
82
}
83
84
/*
85
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
86
FSL_IMX6UL_GPIOn_ADDR[i]);
87
88
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
89
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
90
- FSL_IMX6UL_GPIOn_LOW_IRQ[i]));
91
+ qdev_get_gpio_in(gic, FSL_IMX6UL_GPIOn_LOW_IRQ[i]));
92
93
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
94
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
95
- FSL_IMX6UL_GPIOn_HIGH_IRQ[i]));
96
+ qdev_get_gpio_in(gic, FSL_IMX6UL_GPIOn_HIGH_IRQ[i]));
97
}
98
99
/*
100
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
101
FSL_IMX6UL_SPIn_ADDR[i]);
102
103
sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
104
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
105
- FSL_IMX6UL_SPIn_IRQ[i]));
106
+ qdev_get_gpio_in(gic, FSL_IMX6UL_SPIn_IRQ[i]));
107
}
108
109
/*
110
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
111
sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, FSL_IMX6UL_I2Cn_ADDR[i]);
112
113
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
114
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
115
- FSL_IMX6UL_I2Cn_IRQ[i]));
116
+ qdev_get_gpio_in(gic, FSL_IMX6UL_I2Cn_IRQ[i]));
117
}
118
119
/*
120
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
121
FSL_IMX6UL_UARTn_ADDR[i]);
122
123
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0,
124
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
125
- FSL_IMX6UL_UARTn_IRQ[i]));
126
+ qdev_get_gpio_in(gic, FSL_IMX6UL_UARTn_IRQ[i]));
127
}
128
129
/*
130
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
131
FSL_IMX6UL_ENETn_ADDR[i]);
132
133
sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 0,
134
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
135
- FSL_IMX6UL_ENETn_IRQ[i]));
136
+ qdev_get_gpio_in(gic, FSL_IMX6UL_ENETn_IRQ[i]));
137
138
sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 1,
139
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
140
- FSL_IMX6UL_ENETn_TIMER_IRQ[i]));
141
+ qdev_get_gpio_in(gic, FSL_IMX6UL_ENETn_TIMER_IRQ[i]));
142
}
143
144
/*
145
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
146
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
147
FSL_IMX6UL_USB02_USBn_ADDR[i]);
148
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
149
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
150
- FSL_IMX6UL_USBn_IRQ[i]));
151
+ qdev_get_gpio_in(gic, FSL_IMX6UL_USBn_IRQ[i]));
152
}
153
154
/*
155
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
156
FSL_IMX6UL_USDHCn_ADDR[i]);
157
158
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0,
159
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
160
- FSL_IMX6UL_USDHCn_IRQ[i]));
161
+ qdev_get_gpio_in(gic, FSL_IMX6UL_USDHCn_IRQ[i]));
162
}
163
164
/*
165
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
166
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
167
FSL_IMX6UL_WDOGn_ADDR[i]);
168
sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
169
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
170
- FSL_IMX6UL_WDOGn_IRQ[i]));
171
+ qdev_get_gpio_in(gic, FSL_IMX6UL_WDOGn_IRQ[i]));
172
}
173
174
/*
36
--
175
--
37
2.16.2
176
2.34.1
38
177
39
178
diff view generated by jsdifflib
1
If the GIC has the security extension support enabled, then a
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
non-secure access to ICC_PMR must take account of the non-secure
3
view of interrupt priorities, where real priorities 0x00..0x7f
4
are secure-only and not visible to the non-secure guest, and
5
priorities 0x80..0xff are shown to the guest as if they were
6
0x00..0xff. We had the logic here wrong:
7
* on reads, the priority is in the secure range if bit 7
8
is clear, not if it is set
9
* on writes, we want to set bit 7, not mask everything else
10
2
11
Our ICC_RPR read code had the same error as ICC_PMR.
3
The A7MPCore forward the IRQs from its internal GIC.
4
To make the code clearer, add the 'mpcore' and 'gic'
5
variables.
12
6
13
(Compare the GICv3 spec pseudocode functions ICC_RPR_EL1
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
14
and ICC_PMR_EL1.)
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Message-id: 20250130112615.3219-5-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/arm/fsl-imx7.c | 52 +++++++++++++++++++++--------------------------
13
1 file changed, 23 insertions(+), 29 deletions(-)
15
14
16
Fixes: https://bugs.launchpad.net/qemu/+bug/1748434
15
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Andrew Jones <drjones@redhat.com>
19
Message-id: 20180315133441.24149-1-peter.maydell@linaro.org
20
---
21
hw/intc/arm_gicv3_cpuif.c | 6 +++---
22
1 file changed, 3 insertions(+), 3 deletions(-)
23
24
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
25
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/intc/arm_gicv3_cpuif.c
17
--- a/hw/arm/fsl-imx7.c
27
+++ b/hw/intc/arm_gicv3_cpuif.c
18
+++ b/hw/arm/fsl-imx7.c
28
@@ -XXX,XX +XXX,XX @@ static uint64_t icc_pmr_read(CPUARMState *env, const ARMCPRegInfo *ri)
19
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
29
/* NS access and Group 0 is inaccessible to NS: return the
20
{
30
* NS view of the current priority
21
MachineState *ms = MACHINE(qdev_get_machine());
31
*/
22
FslIMX7State *s = FSL_IMX7(dev);
32
- if (value & 0x80) {
23
- Object *o;
33
+ if ((value & 0x80) == 0) {
24
+ DeviceState *mpcore = DEVICE(&s->a7mpcore);
34
/* Secure priorities not visible to NS */
25
+ DeviceState *gic;
35
value = 0;
26
int i;
36
} else if (value != 0xff) {
27
qemu_irq irq;
37
@@ -XXX,XX +XXX,XX @@ static void icc_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri,
28
char name[NAME_SIZE];
38
/* Current PMR in the secure range, don't allow NS to change it */
29
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
39
return;
30
* CPUs
40
}
31
*/
41
- value = (value >> 1) & 0x80;
32
for (i = 0; i < smp_cpus; i++) {
42
+ value = (value >> 1) | 0x80;
33
- o = OBJECT(&s->cpu[i]);
34
+ Object *o = OBJECT(&s->cpu[i]);
35
36
/* On uniprocessor, the CBAR is set to 0 */
37
if (smp_cpus > 1) {
38
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
39
/*
40
* A7MPCORE
41
*/
42
- object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", smp_cpus,
43
- &error_abort);
44
- object_property_set_int(OBJECT(&s->a7mpcore), "num-irq",
45
+ object_property_set_int(OBJECT(mpcore), "num-cpu", smp_cpus, &error_abort);
46
+ object_property_set_int(OBJECT(mpcore), "num-irq",
47
FSL_IMX7_MAX_IRQ + GIC_INTERNAL, &error_abort);
48
+ sysbus_realize(SYS_BUS_DEVICE(mpcore), &error_abort);
49
+ sysbus_mmio_map(SYS_BUS_DEVICE(mpcore), 0, FSL_IMX7_A7MPCORE_ADDR);
50
51
- sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort);
52
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX7_A7MPCORE_ADDR);
53
-
54
+ gic = mpcore;
55
for (i = 0; i < smp_cpus; i++) {
56
- SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore);
57
+ SysBusDevice *sbd = SYS_BUS_DEVICE(gic);
58
DeviceState *d = DEVICE(qemu_get_cpu(i));
59
60
irq = qdev_get_gpio_in(d, ARM_CPU_IRQ);
61
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
62
sysbus_realize(SYS_BUS_DEVICE(&s->gpt[i]), &error_abort);
63
sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, FSL_IMX7_GPTn_ADDR[i]);
64
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0,
65
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
66
- FSL_IMX7_GPTn_IRQ[i]));
67
+ qdev_get_gpio_in(gic, FSL_IMX7_GPTn_IRQ[i]));
43
}
68
}
44
cs->icc_pmr_el1 = value;
69
45
gicv3_cpuif_update(cs);
70
/*
46
@@ -XXX,XX +XXX,XX @@ static uint64_t icc_rpr_read(CPUARMState *env, const ARMCPRegInfo *ri)
71
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
47
if (arm_feature(env, ARM_FEATURE_EL3) &&
72
FSL_IMX7_GPIOn_ADDR[i]);
48
!arm_is_secure(env) && (env->cp15.scr_el3 & SCR_FIQ)) {
73
49
/* NS GIC access and Group 0 is inaccessible to NS */
74
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
50
- if (prio & 0x80) {
75
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
51
+ if ((prio & 0x80) == 0) {
76
- FSL_IMX7_GPIOn_LOW_IRQ[i]));
52
/* NS mustn't see priorities in the Secure half of the range */
77
+ qdev_get_gpio_in(gic, FSL_IMX7_GPIOn_LOW_IRQ[i]));
53
prio = 0;
78
54
} else if (prio != 0xff) {
79
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
80
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
81
- FSL_IMX7_GPIOn_HIGH_IRQ[i]));
82
+ qdev_get_gpio_in(gic, FSL_IMX7_GPIOn_HIGH_IRQ[i]));
83
}
84
85
/*
86
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
87
sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0,
88
FSL_IMX7_SPIn_ADDR[i]);
89
sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0,
90
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
91
- FSL_IMX7_SPIn_IRQ[i]));
92
+ qdev_get_gpio_in(gic, FSL_IMX7_SPIn_IRQ[i]));
93
}
94
95
/*
96
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
97
sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, FSL_IMX7_I2Cn_ADDR[i]);
98
99
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0,
100
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
101
- FSL_IMX7_I2Cn_IRQ[i]));
102
+ qdev_get_gpio_in(gic, FSL_IMX7_I2Cn_IRQ[i]));
103
}
104
105
/*
106
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
107
108
sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, FSL_IMX7_UARTn_ADDR[i]);
109
110
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_UARTn_IRQ[i]);
111
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_UARTn_IRQ[i]);
112
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0, irq);
113
}
114
115
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
116
117
sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0, FSL_IMX7_ENETn_ADDR[i]);
118
119
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_ENET_IRQ(i, 0));
120
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_ENET_IRQ(i, 0));
121
sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 0, irq);
122
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_ENET_IRQ(i, 3));
123
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_ENET_IRQ(i, 3));
124
sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 1, irq);
125
}
126
127
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
128
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0,
129
FSL_IMX7_USDHCn_ADDR[i]);
130
131
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_USDHCn_IRQ[i]);
132
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_USDHCn_IRQ[i]);
133
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0, irq);
134
}
135
136
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
137
138
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX7_WDOGn_ADDR[i]);
139
sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
140
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
141
- FSL_IMX7_WDOGn_IRQ[i]));
142
+ qdev_get_gpio_in(gic, FSL_IMX7_WDOGn_IRQ[i]));
143
}
144
145
/*
146
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
147
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTD_MSI_IRQ);
148
qdev_connect_gpio_out(DEVICE(&s->pcie4_msi_irq), 0, irq);
149
150
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTA_IRQ);
151
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_PCI_INTA_IRQ);
152
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 0, irq);
153
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTB_IRQ);
154
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_PCI_INTB_IRQ);
155
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 1, irq);
156
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTC_IRQ);
157
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_PCI_INTC_IRQ);
158
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 2, irq);
159
irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 0);
160
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq);
161
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
162
sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
163
FSL_IMX7_USBn_ADDR[i]);
164
165
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_USBn_IRQ[i]);
166
+ irq = qdev_get_gpio_in(gic, FSL_IMX7_USBn_IRQ[i]);
167
sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, irq);
168
169
snprintf(name, NAME_SIZE, "usbmisc%d", i);
55
--
170
--
56
2.16.2
171
2.34.1
57
172
58
173
diff view generated by jsdifflib
1
From: Trent Piepho <tpiepho@impinj.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Linux does not detect a break from this IMX serial driver as a magic
3
No need to duplicate and forward the 'num-cpu' property from
4
sysrq. Nor does it note a break in the port error counts.
4
TYPE_ARM11MPCORE_PRIV to TYPE_REALVIEW_MPCORE, alias it with
5
QOM object_property_add_alias().
5
6
6
The former is because the Linux driver uses the BRCD bit in the USR2
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
register to trigger the RS-232 break handler in the kernel, which is
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
where sysrq hooks in. The emulated UART was not setting this status
9
Message-id: 20250130112615.3219-6-philmd@linaro.org
9
bit.
10
11
The latter is because the Linux driver expects, in addition to the BRK
12
bit, that the ERR bit is set when a break is read in the FIFO. A break
13
should also count as a frame error, so add that bit too.
14
15
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
16
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
17
Message-id: 20180320013657.25038-1-tpiepho@impinj.com
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
11
---
21
include/hw/char/imx_serial.h | 1 +
12
hw/cpu/realview_mpcore.c | 8 +-------
22
hw/char/imx_serial.c | 5 ++++-
13
1 file changed, 1 insertion(+), 7 deletions(-)
23
2 files changed, 5 insertions(+), 1 deletion(-)
24
14
25
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
15
diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c
26
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
27
--- a/include/hw/char/imx_serial.h
17
--- a/hw/cpu/realview_mpcore.c
28
+++ b/include/hw/char/imx_serial.h
18
+++ b/hw/cpu/realview_mpcore.c
29
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
30
20
#include "hw/cpu/arm11mpcore.h"
31
#define URXD_CHARRDY (1<<15) /* character read is valid */
21
#include "hw/intc/realview_gic.h"
32
#define URXD_ERR (1<<14) /* Character has error */
22
#include "hw/irq.h"
33
+#define URXD_FRMERR (1<<12) /* Character has frame error */
23
-#include "hw/qdev-properties.h"
34
#define URXD_BRK (1<<11) /* Break received */
24
#include "qom/object.h"
35
25
36
#define USR1_PARTYER (1<<15) /* Parity Error */
26
#define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore"
37
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
27
@@ -XXX,XX +XXX,XX @@ static void realview_mpcore_realize(DeviceState *dev, Error **errp)
38
index XXXXXXX..XXXXXXX 100644
28
int n;
39
--- a/hw/char/imx_serial.c
29
int i;
40
+++ b/hw/char/imx_serial.c
30
41
@@ -XXX,XX +XXX,XX @@ static void imx_put_data(void *opaque, uint32_t value)
31
- qdev_prop_set_uint32(priv, "num-cpu", s->num_cpu);
42
s->usr2 |= USR2_RDR;
32
if (!sysbus_realize(SYS_BUS_DEVICE(&s->priv), errp)) {
43
s->uts1 &= ~UTS1_RXEMPTY;
33
return;
44
s->readbuff = value;
34
}
45
+ if (value & URXD_BRK) {
35
@@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_init(Object *obj)
46
+ s->usr2 |= USR2_BRCD;
36
int i;
47
+ }
37
48
imx_update(s);
38
object_initialize_child(obj, "a11priv", &s->priv, TYPE_ARM11MPCORE_PRIV);
49
}
39
+ object_property_add_alias(obj, "num-cpu", OBJECT(&s->priv), "num-cpu");
50
40
privbusdev = SYS_BUS_DEVICE(&s->priv);
51
@@ -XXX,XX +XXX,XX @@ static void imx_receive(void *opaque, const uint8_t *buf, int size)
41
sysbus_init_mmio(sbd, sysbus_mmio_get_region(privbusdev, 0));
52
static void imx_event(void *opaque, int event)
42
53
{
43
@@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_init(Object *obj)
54
if (event == CHR_EVENT_BREAK) {
55
- imx_put_data(opaque, URXD_BRK);
56
+ imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR);
57
}
44
}
58
}
45
}
59
46
47
-static const Property mpcore_rirq_properties[] = {
48
- DEFINE_PROP_UINT32("num-cpu", mpcore_rirq_state, num_cpu, 1),
49
-};
50
-
51
static void mpcore_rirq_class_init(ObjectClass *klass, void *data)
52
{
53
DeviceClass *dc = DEVICE_CLASS(klass);
54
55
dc->realize = realview_mpcore_realize;
56
- device_class_set_props(dc, mpcore_rirq_properties);
57
}
58
59
static const TypeInfo mpcore_rirq_info = {
60
--
60
--
61
2.16.2
61
2.34.1
62
62
63
63
diff view generated by jsdifflib
1
The MDCR_EL2.TDE bit allows the exception level targeted by debug
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
exceptions to be set to EL2 for code executing at EL0. We handle
3
this in the arm_debug_target_el() function, but this is only used for
4
hardware breakpoint and watchpoint exceptions, not for the exception
5
generated when the guest executes an AArch32 BKPT or AArch64 BRK
6
instruction. We don't have enough information for a translate-time
7
equivalent of arm_debug_target_el(), so instead make BKPT and BRK
8
call a special purpose helper which can do the routing, rather than
9
the generic exception_with_syndrome helper.
10
2
3
When multiple QOM types are registered in the same file,
4
it is simpler to use the the DEFINE_TYPES() macro. In
5
particular because type array declared with such macro
6
are easier to review.
7
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Cédric Le Goater <clg@kaod.org>
10
Message-id: 20250130112615.3219-7-philmd@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180320134114.30418-2-peter.maydell@linaro.org
14
---
12
---
15
target/arm/helper.h | 1 +
13
hw/cpu/a15mpcore.c | 21 +++++++++------------
16
target/arm/op_helper.c | 8 ++++++++
14
hw/cpu/a9mpcore.c | 21 +++++++++------------
17
target/arm/translate-a64.c | 15 +++++++++++++--
15
hw/cpu/arm11mpcore.c | 21 +++++++++------------
18
target/arm/translate.c | 19 ++++++++++++++-----
16
hw/cpu/realview_mpcore.c | 21 +++++++++------------
19
4 files changed, 36 insertions(+), 7 deletions(-)
17
4 files changed, 36 insertions(+), 48 deletions(-)
20
18
21
diff --git a/target/arm/helper.h b/target/arm/helper.h
19
diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c
22
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/helper.h
21
--- a/hw/cpu/a15mpcore.c
24
+++ b/target/arm/helper.h
22
+++ b/hw/cpu/a15mpcore.c
25
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
23
@@ -XXX,XX +XXX,XX @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data)
26
i32, i32, i32, i32)
24
/* We currently have no saveable state */
27
DEF_HELPER_2(exception_internal, void, env, i32)
25
}
28
DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32)
26
29
+DEF_HELPER_2(exception_bkpt_insn, void, env, i32)
27
-static const TypeInfo a15mp_priv_info = {
30
DEF_HELPER_1(setend, void, env)
28
- .name = TYPE_A15MPCORE_PRIV,
31
DEF_HELPER_2(wfi, void, env, i32)
29
- .parent = TYPE_SYS_BUS_DEVICE,
32
DEF_HELPER_1(wfe, void, env)
30
- .instance_size = sizeof(A15MPPrivState),
33
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
31
- .instance_init = a15mp_priv_initfn,
32
- .class_init = a15mp_priv_class_init,
33
+static const TypeInfo a15mp_types[] = {
34
+ {
35
+ .name = TYPE_A15MPCORE_PRIV,
36
+ .parent = TYPE_SYS_BUS_DEVICE,
37
+ .instance_size = sizeof(A15MPPrivState),
38
+ .instance_init = a15mp_priv_initfn,
39
+ .class_init = a15mp_priv_class_init,
40
+ },
41
};
42
43
-static void a15mp_register_types(void)
44
-{
45
- type_register_static(&a15mp_priv_info);
46
-}
47
-
48
-type_init(a15mp_register_types)
49
+DEFINE_TYPES(a15mp_types)
50
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
34
index XXXXXXX..XXXXXXX 100644
51
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/op_helper.c
52
--- a/hw/cpu/a9mpcore.c
36
+++ b/target/arm/op_helper.c
53
+++ b/hw/cpu/a9mpcore.c
37
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
54
@@ -XXX,XX +XXX,XX @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data)
38
raise_exception(env, excp, syndrome, target_el);
55
device_class_set_props(dc, a9mp_priv_properties);
39
}
56
}
40
57
41
+/* Raise an EXCP_BKPT with the specified syndrome register value,
58
-static const TypeInfo a9mp_priv_info = {
42
+ * targeting the correct exception level for debug exceptions.
59
- .name = TYPE_A9MPCORE_PRIV,
43
+ */
60
- .parent = TYPE_SYS_BUS_DEVICE,
44
+void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
61
- .instance_size = sizeof(A9MPPrivState),
45
+{
62
- .instance_init = a9mp_priv_initfn,
46
+ raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env));
63
- .class_init = a9mp_priv_class_init,
47
+}
64
+static const TypeInfo a9mp_types[] = {
48
+
65
+ {
49
uint32_t HELPER(cpsr_read)(CPUARMState *env)
66
+ .name = TYPE_A9MPCORE_PRIV,
50
{
67
+ .parent = TYPE_SYS_BUS_DEVICE,
51
return cpsr_read(env) & ~(CPSR_EXEC | CPSR_RESERVED);
68
+ .instance_size = sizeof(A9MPPrivState),
52
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
69
+ .instance_init = a9mp_priv_initfn,
70
+ .class_init = a9mp_priv_class_init,
71
+ },
72
};
73
74
-static void a9mp_register_types(void)
75
-{
76
- type_register_static(&a9mp_priv_info);
77
-}
78
-
79
-type_init(a9mp_register_types)
80
+DEFINE_TYPES(a9mp_types)
81
diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c
53
index XXXXXXX..XXXXXXX 100644
82
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/translate-a64.c
83
--- a/hw/cpu/arm11mpcore.c
55
+++ b/target/arm/translate-a64.c
84
+++ b/hw/cpu/arm11mpcore.c
56
@@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp,
85
@@ -XXX,XX +XXX,XX @@ static void mpcore_priv_class_init(ObjectClass *klass, void *data)
57
s->base.is_jmp = DISAS_NORETURN;
86
device_class_set_props(dc, mpcore_priv_properties);
58
}
87
}
59
88
60
+static void gen_exception_bkpt_insn(DisasContext *s, int offset,
89
-static const TypeInfo mpcore_priv_info = {
61
+ uint32_t syndrome)
90
- .name = TYPE_ARM11MPCORE_PRIV,
62
+{
91
- .parent = TYPE_SYS_BUS_DEVICE,
63
+ TCGv_i32 tcg_syn;
92
- .instance_size = sizeof(ARM11MPCorePriveState),
64
+
93
- .instance_init = mpcore_priv_initfn,
65
+ gen_a64_set_pc_im(s->pc - offset);
94
- .class_init = mpcore_priv_class_init,
66
+ tcg_syn = tcg_const_i32(syndrome);
95
+static const TypeInfo arm11mp_types[] = {
67
+ gen_helper_exception_bkpt_insn(cpu_env, tcg_syn);
96
+ {
68
+ tcg_temp_free_i32(tcg_syn);
97
+ .name = TYPE_ARM11MPCORE_PRIV,
69
+ s->base.is_jmp = DISAS_NORETURN;
98
+ .parent = TYPE_SYS_BUS_DEVICE,
70
+}
99
+ .instance_size = sizeof(ARM11MPCorePriveState),
71
+
100
+ .instance_init = mpcore_priv_initfn,
72
static void gen_ss_advance(DisasContext *s)
101
+ .class_init = mpcore_priv_class_init,
73
{
102
+ },
74
/* If the singlestep state is Active-not-pending, advance to
103
};
75
@@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn)
104
76
break;
105
-static void arm11mpcore_register_types(void)
77
}
106
-{
78
/* BRK */
107
- type_register_static(&mpcore_priv_info);
79
- gen_exception_insn(s, 4, EXCP_BKPT, syn_aa64_bkpt(imm16),
108
-}
80
- default_exception_el(s));
109
-
81
+ gen_exception_bkpt_insn(s, 4, syn_aa64_bkpt(imm16));
110
-type_init(arm11mpcore_register_types)
82
break;
111
+DEFINE_TYPES(arm11mp_types)
83
case 2:
112
diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c
84
if (op2_ll != 0) {
85
diff --git a/target/arm/translate.c b/target/arm/translate.c
86
index XXXXXXX..XXXXXXX 100644
113
index XXXXXXX..XXXXXXX 100644
87
--- a/target/arm/translate.c
114
--- a/hw/cpu/realview_mpcore.c
88
+++ b/target/arm/translate.c
115
+++ b/hw/cpu/realview_mpcore.c
89
@@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp,
116
@@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_class_init(ObjectClass *klass, void *data)
90
s->base.is_jmp = DISAS_NORETURN;
117
dc->realize = realview_mpcore_realize;
91
}
118
}
92
119
93
+static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn)
120
-static const TypeInfo mpcore_rirq_info = {
94
+{
121
- .name = TYPE_REALVIEW_MPCORE_RIRQ,
95
+ TCGv_i32 tcg_syn;
122
- .parent = TYPE_SYS_BUS_DEVICE,
96
+
123
- .instance_size = sizeof(mpcore_rirq_state),
97
+ gen_set_condexec(s);
124
- .instance_init = mpcore_rirq_init,
98
+ gen_set_pc_im(s, s->pc - offset);
125
- .class_init = mpcore_rirq_class_init,
99
+ tcg_syn = tcg_const_i32(syn);
126
+static const TypeInfo realview_mpcore_types[] = {
100
+ gen_helper_exception_bkpt_insn(cpu_env, tcg_syn);
127
+ {
101
+ tcg_temp_free_i32(tcg_syn);
128
+ .name = TYPE_REALVIEW_MPCORE_RIRQ,
102
+ s->base.is_jmp = DISAS_NORETURN;
129
+ .parent = TYPE_SYS_BUS_DEVICE,
103
+}
130
+ .instance_size = sizeof(mpcore_rirq_state),
104
+
131
+ .instance_init = mpcore_rirq_init,
105
/* Force a TB lookup after an instruction that changes the CPU state. */
132
+ .class_init = mpcore_rirq_class_init,
106
static inline void gen_lookup_tb(DisasContext *s)
133
+ },
107
{
134
};
108
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
135
109
case 1:
136
-static void realview_mpcore_register_types(void)
110
/* bkpt */
137
-{
111
ARCH(5);
138
- type_register_static(&mpcore_rirq_info);
112
- gen_exception_insn(s, 4, EXCP_BKPT,
139
-}
113
- syn_aa32_bkpt(imm16, false),
140
-
114
- default_exception_el(s));
141
-type_init(realview_mpcore_register_types)
115
+ gen_exception_bkpt_insn(s, 4, syn_aa32_bkpt(imm16, false));
142
+DEFINE_TYPES(realview_mpcore_types)
116
break;
117
case 2:
118
/* Hypervisor call (v7) */
119
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
120
{
121
int imm8 = extract32(insn, 0, 8);
122
ARCH(5);
123
- gen_exception_insn(s, 2, EXCP_BKPT, syn_aa32_bkpt(imm8, true),
124
- default_exception_el(s));
125
+ gen_exception_bkpt_insn(s, 2, syn_aa32_bkpt(imm8, true));
126
break;
127
}
128
129
--
143
--
130
2.16.2
144
2.34.1
131
145
132
146
diff view generated by jsdifflib
1
From: Victor Kamensky <kamensky@cisco.com>
1
From: Andrew Yuan <andrew.yuan@jaguarmicro.com>
2
2
3
In OE project 4.15 linux kernel boot hang was observed under
3
Our current handling of the mask/compare logic in the Cadence
4
single cpu aarch64 qemu. Kernel code was in a loop waiting for
4
GEM ethernet device is wrong:
5
vtimer arrival, spinning in TC generated blocks, while interrupt
5
(1) we load the same byte twice from rx_buf when
6
was pending unprocessed. This happened because when qemu tried to
6
creating the compare value
7
handle vtimer interrupt target had interrupts disabled, as
7
(2) we ignore the DISABLE_MASK flag
8
result flag indicating TCG exit, cpu->icount_decr.u16.high,
9
was cleared but arm_cpu_exec_interrupt function did not call
10
arm_cpu_do_interrupt to process interrupt. Later when target
11
reenabled interrupts, it happened without exit into main loop, so
12
following code that waited for result of interrupt execution
13
run in infinite loop.
14
8
15
To solve the problem instructions that operate on CPU sys state
9
The "Cadence IP for Gigabit Ethernet MAC Part Number: IP7014 IP Rev:
16
(i.e enable/disable interrupt), and marked as DISAS_UPDATE,
10
R1p12 - Doc Rev: 1.3 User Guide" states that if the DISABLE_MASK bit
17
should be considered as DISAS_EXIT variant, and should be
11
in type2_compare_x_word_1 is set, the mask_value field in
18
forced to exit back to main loop so qemu will have a chance
12
type2_compare_x_word_0 is used as an additional 2 byte Compare Value.
19
processing pending CPU state updates, including pending
20
interrupts.
21
13
22
This change brings consistency with how DISAS_UPDATE is treated
14
Correct these bugs:
23
in aarch32 case.
15
* in the !disable_mask codepath, use lduw_le_p() so we
16
correctly load a 16-bit value for comparison
17
* in the disable_mask codepath, we load a full 4-byte value
18
from rx_buf for the comparison, set the compare value to
19
the whole of the cr0 register (i.e. the concatenation of
20
the mask and compare fields), and set mask to 0xffffffff
21
to force a 32-bit comparison
24
22
25
CC: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Andrew Yuan <andrew.yuan@jaguarmicro.com>
26
CC: Alex Bennée <alex.bennee@linaro.org>
24
Message-id: 20241219061658.805-1-andrew.yuan@jaguarmicro.com
27
CC: qemu-stable@nongnu.org
25
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
28
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
26
[PMM: Expand commit message and comment]
29
Signed-off-by: Victor Kamensky <kamensky@cisco.com>
27
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
30
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
28
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
31
Message-id: 1521526368-1996-1-git-send-email-kamensky@cisco.com
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
---
30
---
34
target/arm/translate-a64.c | 6 +++---
31
hw/net/cadence_gem.c | 26 +++++++++++++++++++++-----
35
1 file changed, 3 insertions(+), 3 deletions(-)
32
1 file changed, 21 insertions(+), 5 deletions(-)
36
33
37
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
34
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
38
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate-a64.c
36
--- a/hw/net/cadence_gem.c
40
+++ b/target/arm/translate-a64.c
37
+++ b/hw/net/cadence_gem.c
41
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
38
@@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr,
42
case DISAS_UPDATE:
39
43
gen_a64_set_pc_im(dc->pc);
40
/* Compare A, B, C */
44
/* fall through */
41
for (j = 0; j < 3; j++) {
45
- case DISAS_JUMP:
42
- uint32_t cr0, cr1, mask, compare;
46
- tcg_gen_lookup_and_goto_ptr();
43
- uint16_t rx_cmp;
47
- break;
44
+ uint32_t cr0, cr1, mask, compare, disable_mask;
48
case DISAS_EXIT:
45
+ uint32_t rx_cmp;
49
tcg_gen_exit_tb(0);
46
int offset;
50
break;
47
int cr_idx = extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_SHIFT + j * 6,
51
+ case DISAS_JUMP:
48
R_SCREENING_TYPE2_REG0_COMPARE_A_LENGTH);
52
+ tcg_gen_lookup_and_goto_ptr();
49
@@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr,
53
+ break;
50
break;
54
case DISAS_NORETURN:
51
}
55
case DISAS_SWI:
52
56
break;
53
- rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset];
54
- mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE);
55
- compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE);
56
+ disable_mask =
57
+ FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, DISABLE_MASK);
58
+ if (disable_mask) {
59
+ /*
60
+ * If disable_mask is set, mask_value is used as an
61
+ * additional 2 byte Compare Value; that is equivalent
62
+ * to using the whole cr0 register as the comparison value.
63
+ * Load 32 bits of data from rx_buf, and set mask to
64
+ * all-ones so we compare all 32 bits.
65
+ */
66
+ rx_cmp = ldl_le_p(rxbuf_ptr + offset);
67
+ mask = 0xFFFFFFFF;
68
+ compare = cr0;
69
+ } else {
70
+ rx_cmp = lduw_le_p(rxbuf_ptr + offset);
71
+ mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE);
72
+ compare =
73
+ FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE);
74
+ }
75
76
if ((rx_cmp & mask) == (compare & mask)) {
77
matched = true;
57
--
78
--
58
2.16.2
79
2.34.1
59
80
60
81
diff view generated by jsdifflib
1
The BCM2836 uses a Cortex-A7, not a Cortex-A15. Update the device to
1
The '-old-param' command line option is specific to Arm targets; it
2
use the correct CPU.
2
is very briefly documented as "old param mode". What this option
3
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf
3
actually does is change the behaviour when directly booting a guest
4
kernel, so that command line arguments are passed to the kernel using
5
the extremely old "param_struct" ABI, rather than the newer ATAGS or
6
even newer DTB mechanisms.
4
7
5
When the BCM2836 was introduced (bad5623690b) the Cortex-A7 was not
8
This support was added back in 2007 to support an old vendor kernel
6
available, so the very similar Cortex-A15 was used. Since dcf578ed8ce
9
on the akita/terrier board types:
7
we can model the correct core.
10
https://mail.gnu.org/archive/html/qemu-devel/2007-07/msg00344.html
11
Even then, it was an out-of-date mechanism from the kernel's
12
point of view -- the kernel has had a comment since 2001 marking
13
it as deprecated. As of mid-2024, the kernel only retained
14
param_struct support for the RiscPC and Footbridge platforms:
15
https://lore.kernel.org/linux-arm-kernel/2831c5a6-cfbf-4fe0-b51c-0396e5b0aeb7@app.fastmail.com/
16
17
None of the board types QEMU supports need param_struct support;
18
mark this option as deprecated.
8
19
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Alistair Francis <alistair@alistair23.me>
21
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
22
Message-id: 20250127123113.2947620-1-peter.maydell@linaro.org
12
Message-id: 20180319110215.16755-1-peter.maydell@linaro.org
13
---
23
---
14
hw/arm/bcm2836.c | 2 +-
24
docs/about/deprecated.rst | 13 +++++++++++++
15
hw/arm/raspi.c | 2 +-
25
system/vl.c | 1 +
16
2 files changed, 2 insertions(+), 2 deletions(-)
26
2 files changed, 14 insertions(+)
17
27
18
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
28
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
19
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/bcm2836.c
30
--- a/docs/about/deprecated.rst
21
+++ b/hw/arm/bcm2836.c
31
+++ b/docs/about/deprecated.rst
22
@@ -XXX,XX +XXX,XX @@ struct BCM283XInfo {
32
@@ -XXX,XX +XXX,XX @@ configurations (e.g. -smp drawers=1,books=1,clusters=1 for x86 PC machine) is
23
static const BCM283XInfo bcm283x_socs[] = {
33
marked deprecated since 9.0, users have to ensure that all the topology members
24
{
34
described with -smp are supported by the target machine.
25
.name = TYPE_BCM2836,
35
26
- .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"),
36
+``-old-param`` option for booting Arm kernels via param_struct (since 10.0)
27
+ .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"),
37
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
28
.clusterid = 0xf,
38
+
29
},
39
+The ``-old-param`` command line option is specific to Arm targets:
30
#ifdef TARGET_AARCH64
40
+it is used when directly booting a guest kernel to pass it the
31
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
41
+command line and other information via the old ``param_struct`` ABI,
42
+rather than the newer ATAGS or DTB mechanisms. This option was only
43
+ever needed to support ancient kernels on some old board types
44
+like the ``akita`` or ``terrier``; it has been deprecated in the
45
+kernel since 2001. None of the board types QEMU supports need
46
+``param_struct`` support, so this option has been deprecated and will
47
+be removed in a future QEMU version.
48
+
49
User-mode emulator command line arguments
50
-----------------------------------------
51
52
diff --git a/system/vl.c b/system/vl.c
32
index XXXXXXX..XXXXXXX 100644
53
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/arm/raspi.c
54
--- a/system/vl.c
34
+++ b/hw/arm/raspi.c
55
+++ b/system/vl.c
35
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
56
@@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv)
36
mc->no_parallel = 1;
57
nb_prom_envs++;
37
mc->no_floppy = 1;
58
break;
38
mc->no_cdrom = 1;
59
case QEMU_OPTION_old_param:
39
- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
60
+ warn_report("-old-param is deprecated");
40
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7");
61
old_param = 1;
41
mc->max_cpus = BCM283X_NCPUS;
62
break;
42
mc->min_cpus = BCM283X_NCPUS;
63
case QEMU_OPTION_rtc:
43
mc->default_cpus = BCM283X_NCPUS;
44
--
64
--
45
2.16.2
65
2.34.1
46
66
47
67
diff view generated by jsdifflib
New patch
1
From: Khem Raj <raj.khem@gmail.com>
1
2
3
glibc 2.41+ has added [1] definitions for sched_setattr and
4
sched_getattr functions and struct sched_attr. Therefore, it needs
5
to be checked for here as well before defining sched_attr, to avoid
6
a compilation failure.
7
8
Define sched_attr conditionally only when SCHED_ATTR_SIZE_VER0 is
9
not defined.
10
11
[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8
12
13
Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2799
15
Cc: qemu-stable@nongnu.org
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
linux-user/syscall.c | 4 +++-
20
1 file changed, 3 insertions(+), 1 deletion(-)
21
22
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/linux-user/syscall.c
25
+++ b/linux-user/syscall.c
26
@@ -XXX,XX +XXX,XX @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len,
27
#define __NR_sys_sched_setaffinity __NR_sched_setaffinity
28
_syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len,
29
unsigned long *, user_mask_ptr);
30
-/* sched_attr is not defined in glibc */
31
+/* sched_attr is not defined in glibc < 2.41 */
32
+#ifndef SCHED_ATTR_SIZE_VER0
33
struct sched_attr {
34
uint32_t size;
35
uint32_t sched_policy;
36
@@ -XXX,XX +XXX,XX @@ struct sched_attr {
37
uint32_t sched_util_min;
38
uint32_t sched_util_max;
39
};
40
+#endif
41
#define __NR_sys_sched_getattr __NR_sched_getattr
42
_syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr,
43
unsigned int, size, unsigned int, flags);
44
--
45
2.34.1
diff view generated by jsdifflib