1 | ARM queue for 2.10: all M profile bugfixes... | 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 | 4 | ||
6 | The following changes since commit 25dd0e77898c3e10796d4cbeb35e8af5ba6ce975: | 5 | are available in the Git repository at: |
7 | 6 | ||
8 | Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-fetch' into staging (2017-07-31 11:27:43 +0100) | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250210 |
9 | 8 | ||
10 | are available in the git repository at: | 9 | for you to fetch changes up to 27a8d899c7a100fd5aa040a8b993bb257687c393: |
11 | 10 | ||
12 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170731 | 11 | linux-user: Do not define struct sched_attr if libc headers do (2025-02-07 16:09:20 +0000) |
13 | |||
14 | for you to fetch changes up to 89cbc3778a3d61761e2231e740269218c9a8a41d: | ||
15 | |||
16 | hw/mps2_scc: fix incorrect properties (2017-07-31 13:11:56 +0100) | ||
17 | 12 | ||
18 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
19 | target-arm queue: | 14 | target-arm queue: |
20 | * fix broken properties on MPS2 SCC device | 15 | * Deprecate pxa2xx CPUs, iwMMXt emulation, -old-param option |
21 | * fix MPU trace handling of write vs exec | 16 | * Drop unused AArch64DecodeTable typedefs |
22 | * fix MPU M profile bugs: | 17 | * Minor code cleanups |
23 | - not handling system space or PPB region correctly | 18 | * hw/net/cadence_gem: Fix the mask/compare/disable-mask logic |
24 | - not resetting state | 19 | * linux-user: Do not define struct sched_attr if libc headers do |
25 | - not migrating MPU_RNR | ||
26 | 20 | ||
27 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
28 | Peter Maydell (6): | 22 | Andrew Yuan (1): |
29 | target/arm: Correct MPU trace handling of write vs execute | 23 | hw/net/cadence_gem: Fix the mask/compare/disable-mask logic |
30 | target/arm: Don't do MPU lookups for addresses in M profile PPB region | ||
31 | target/arm: Don't allow guest to make System space executable for M profile | ||
32 | target/arm: Rename cp15.c6_rgnr to pmsav7.rnr | ||
33 | target/arm: Move PMSAv7 reset into arm_cpu_reset() so M profile MPUs get reset | ||
34 | target/arm: Migrate MPU_RNR register state for M profile cores | ||
35 | 24 | ||
36 | Philippe Mathieu-Daudé (1): | 25 | Khem Raj (1): |
37 | hw/mps2_scc: fix incorrect properties | 26 | linux-user: Do not define struct sched_attr if libc headers do |
38 | 27 | ||
39 | target/arm/cpu.h | 3 +-- | 28 | Peter Maydell (4): |
40 | hw/intc/armv7m_nvic.c | 14 +++++----- | 29 | target/arm: deprecate the pxa2xx CPUs and iwMMXt emulation |
41 | hw/misc/mps2-scc.c | 4 +-- | 30 | tests/tcg/arm: Remove test-arm-iwmmxt test |
42 | target/arm/cpu.c | 14 ++++++++++ | 31 | target/arm: Drop unused AArch64DecodeTable typedefs |
43 | target/arm/helper.c | 71 ++++++++++++++++++++++++++++++++++----------------- | 32 | qemu-options: Deprecate -old-param command line option |
44 | target/arm/machine.c | 30 +++++++++++++++++++++- | ||
45 | 6 files changed, 101 insertions(+), 35 deletions(-) | ||
46 | 33 | ||
34 | Philippe Mathieu-Daudé (6): | ||
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 | ||
41 | |||
42 | docs/about/deprecated.rst | 34 ++++++++++++++++++++++ | ||
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 | ||
65 | diff view generated by jsdifflib |
1 | Almost all of the PMSAv7 state is in the pmsav7 substruct of | 1 | The pxa2xx CPUs are now only useful with user-mode emulation, because |
---|---|---|---|
2 | the ARM CPU state structure. The exception is the region | 2 | we dropped all the machine types that used them in 9.2. (Technically |
3 | number register, which is in cp15.c6_rgnr. This exception | 3 | you could alse use "-cpu pxa270" with a board model like versatilepb |
4 | is a bit odd for M profile, which otherwise generally does | 4 | which doesn't sanity-check the CPU type, but that has never been a |
5 | not store state in the cp15 substruct. | 5 | supported config.) |
6 | 6 | ||
7 | Rename cp15.c6_rgnr to pmsav7.rnr accordingly. | 7 | To use them (or iwMMXt emulation) with QEMU user-mode you would need |
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. | ||
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: Philippe Mathieu-Daudé <f4bug@amsat.org> | 21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 1501153150-19984-4-git-send-email-peter.maydell@linaro.org | 22 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
23 | Message-id: 20250127112715.2936555-2-peter.maydell@linaro.org | ||
12 | --- | 24 | --- |
13 | target/arm/cpu.h | 3 +-- | 25 | docs/about/deprecated.rst | 21 +++++++++++++++++++++ |
14 | hw/intc/armv7m_nvic.c | 14 +++++++------- | 26 | target/arm/cpu.h | 1 + |
15 | target/arm/helper.c | 6 +++--- | 27 | target/arm/cpu.c | 3 +++ |
16 | target/arm/machine.c | 2 +- | 28 | target/arm/tcg/cpu32.c | 36 ++++++++++++++++++++++++------------ |
17 | 4 files changed, 12 insertions(+), 13 deletions(-) | 29 | 4 files changed, 49 insertions(+), 12 deletions(-) |
18 | 30 | ||
31 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/docs/about/deprecated.rst | ||
34 | +++ b/docs/about/deprecated.rst | ||
35 | @@ -XXX,XX +XXX,XX @@ is going to be so much slower it wouldn't make sense for any serious | ||
36 | instrumentation. Due to implementation differences there will also be | ||
37 | anomalies in things like memory instrumentation. | ||
38 | |||
39 | +linux-user mode CPUs | ||
40 | +-------------------- | ||
41 | + | ||
42 | +iwMMXt emulation and the ``pxa`` CPUs (since 10.0) | ||
43 | +'''''''''''''''''''''''''''''''''''''''''''''''''' | ||
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 | |||
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 63 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
20 | index XXXXXXX..XXXXXXX 100644 | 64 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/cpu.h | 65 | --- a/target/arm/cpu.h |
22 | +++ b/target/arm/cpu.h | 66 | +++ b/target/arm/cpu.h |
23 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | 67 | @@ -XXX,XX +XXX,XX @@ struct ArchCPU { |
24 | uint64_t par_el[4]; | 68 | |
25 | }; | 69 | typedef struct ARMCPUInfo { |
26 | 70 | const char *name; | |
27 | - uint32_t c6_rgnr; | 71 | + const char *deprecation_note; |
28 | - | 72 | void (*initfn)(Object *obj); |
29 | uint32_t c9_insn; /* Cache lockdown registers. */ | 73 | void (*class_init)(ObjectClass *oc, void *data); |
30 | uint32_t c9_data; | 74 | } ARMCPUInfo; |
31 | uint64_t c9_pmcr; /* performance monitor control register */ | 75 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
32 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
33 | uint32_t *drbar; | ||
34 | uint32_t *drsr; | ||
35 | uint32_t *dracr; | ||
36 | + uint32_t rnr; | ||
37 | } pmsav7; | ||
38 | |||
39 | void *nvic; | ||
40 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | 76 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/intc/armv7m_nvic.c | 77 | --- a/target/arm/cpu.c |
43 | +++ b/hw/intc/armv7m_nvic.c | 78 | +++ b/target/arm/cpu.c |
44 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset) | 79 | @@ -XXX,XX +XXX,XX @@ static void cpu_register_class_init(ObjectClass *oc, void *data) |
45 | case 0xd94: /* MPU_CTRL */ | 80 | |
46 | return cpu->env.v7m.mpu_ctrl; | 81 | acc->info = data; |
47 | case 0xd98: /* MPU_RNR */ | 82 | cc->gdb_core_xml_file = "arm-core.xml"; |
48 | - return cpu->env.cp15.c6_rgnr; | 83 | + if (acc->info->deprecation_note) { |
49 | + return cpu->env.pmsav7.rnr; | 84 | + cc->deprecation_note = acc->info->deprecation_note; |
50 | case 0xd9c: /* MPU_RBAR */ | 85 | + } |
51 | case 0xda4: /* MPU_RBAR_A1 */ | 86 | } |
52 | case 0xdac: /* MPU_RBAR_A2 */ | 87 | |
53 | case 0xdb4: /* MPU_RBAR_A3 */ | 88 | void arm_cpu_register(const ARMCPUInfo *info) |
54 | { | 89 | diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c |
55 | - int region = cpu->env.cp15.c6_rgnr; | ||
56 | + int region = cpu->env.pmsav7.rnr; | ||
57 | |||
58 | if (region >= cpu->pmsav7_dregion) { | ||
59 | return 0; | ||
60 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset) | ||
61 | case 0xdb0: /* MPU_RASR_A2 */ | ||
62 | case 0xdb8: /* MPU_RASR_A3 */ | ||
63 | { | ||
64 | - int region = cpu->env.cp15.c6_rgnr; | ||
65 | + int region = cpu->env.pmsav7.rnr; | ||
66 | |||
67 | if (region >= cpu->pmsav7_dregion) { | ||
68 | return 0; | ||
69 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) | ||
70 | PRIu32 "/%" PRIu32 "\n", | ||
71 | value, cpu->pmsav7_dregion); | ||
72 | } else { | ||
73 | - cpu->env.cp15.c6_rgnr = value; | ||
74 | + cpu->env.pmsav7.rnr = value; | ||
75 | } | ||
76 | break; | ||
77 | case 0xd9c: /* MPU_RBAR */ | ||
78 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) | ||
79 | region, cpu->pmsav7_dregion); | ||
80 | return; | ||
81 | } | ||
82 | - cpu->env.cp15.c6_rgnr = region; | ||
83 | + cpu->env.pmsav7.rnr = region; | ||
84 | } else { | ||
85 | - region = cpu->env.cp15.c6_rgnr; | ||
86 | + region = cpu->env.pmsav7.rnr; | ||
87 | } | ||
88 | |||
89 | if (region >= cpu->pmsav7_dregion) { | ||
90 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) | ||
91 | case 0xdb0: /* MPU_RASR_A2 */ | ||
92 | case 0xdb8: /* MPU_RASR_A3 */ | ||
93 | { | ||
94 | - int region = cpu->env.cp15.c6_rgnr; | ||
95 | + int region = cpu->env.pmsav7.rnr; | ||
96 | |||
97 | if (region >= cpu->pmsav7_dregion) { | ||
98 | return; | ||
99 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
100 | index XXXXXXX..XXXXXXX 100644 | 90 | index XXXXXXX..XXXXXXX 100644 |
101 | --- a/target/arm/helper.c | 91 | --- a/target/arm/tcg/cpu32.c |
102 | +++ b/target/arm/helper.c | 92 | +++ b/target/arm/tcg/cpu32.c |
103 | @@ -XXX,XX +XXX,XX @@ static uint64_t pmsav7_read(CPUARMState *env, const ARMCPRegInfo *ri) | 93 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = { |
104 | return 0; | 94 | { .name = "ti925t", .initfn = ti925t_initfn }, |
105 | } | 95 | { .name = "sa1100", .initfn = sa1100_initfn }, |
106 | 96 | { .name = "sa1110", .initfn = sa1110_initfn }, | |
107 | - u32p += env->cp15.c6_rgnr; | 97 | - { .name = "pxa250", .initfn = pxa250_initfn }, |
108 | + u32p += env->pmsav7.rnr; | 98 | - { .name = "pxa255", .initfn = pxa255_initfn }, |
109 | return *u32p; | 99 | - { .name = "pxa260", .initfn = pxa260_initfn }, |
110 | } | 100 | - { .name = "pxa261", .initfn = pxa261_initfn }, |
111 | 101 | - { .name = "pxa262", .initfn = pxa262_initfn }, | |
112 | @@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri, | 102 | + { .name = "pxa250", .initfn = pxa250_initfn, |
113 | return; | 103 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
114 | } | 104 | + { .name = "pxa255", .initfn = pxa255_initfn, |
115 | 105 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, | |
116 | - u32p += env->cp15.c6_rgnr; | 106 | + { .name = "pxa260", .initfn = pxa260_initfn, |
117 | + u32p += env->pmsav7.rnr; | 107 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
118 | tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */ | 108 | + { .name = "pxa261", .initfn = pxa261_initfn, |
119 | *u32p = value; | 109 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
120 | } | 110 | + { .name = "pxa262", .initfn = pxa262_initfn, |
121 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmsav7_cp_reginfo[] = { | 111 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
122 | .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset }, | 112 | /* "pxa270" is an alias for "pxa270-a0" */ |
123 | { .name = "RGNR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 2, .opc2 = 0, | 113 | - { .name = "pxa270", .initfn = pxa270a0_initfn }, |
124 | .access = PL1_RW, | 114 | - { .name = "pxa270-a0", .initfn = pxa270a0_initfn }, |
125 | - .fieldoffset = offsetof(CPUARMState, cp15.c6_rgnr), | 115 | - { .name = "pxa270-a1", .initfn = pxa270a1_initfn }, |
126 | + .fieldoffset = offsetof(CPUARMState, pmsav7.rnr), | 116 | - { .name = "pxa270-b0", .initfn = pxa270b0_initfn }, |
127 | .writefn = pmsav7_rgnr_write }, | 117 | - { .name = "pxa270-b1", .initfn = pxa270b1_initfn }, |
128 | REGINFO_SENTINEL | 118 | - { .name = "pxa270-c0", .initfn = pxa270c0_initfn }, |
129 | }; | 119 | - { .name = "pxa270-c5", .initfn = pxa270c5_initfn }, |
130 | diff --git a/target/arm/machine.c b/target/arm/machine.c | 120 | + { .name = "pxa270", .initfn = pxa270a0_initfn, |
131 | index XXXXXXX..XXXXXXX 100644 | 121 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
132 | --- a/target/arm/machine.c | 122 | + { .name = "pxa270-a0", .initfn = pxa270a0_initfn, |
133 | +++ b/target/arm/machine.c | 123 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
134 | @@ -XXX,XX +XXX,XX @@ static bool pmsav7_rgnr_vmstate_validate(void *opaque, int version_id) | 124 | + { .name = "pxa270-a1", .initfn = pxa270a1_initfn, |
135 | { | 125 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
136 | ARMCPU *cpu = opaque; | 126 | + { .name = "pxa270-b0", .initfn = pxa270b0_initfn, |
137 | 127 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, | |
138 | - return cpu->env.cp15.c6_rgnr < cpu->pmsav7_dregion; | 128 | + { .name = "pxa270-b1", .initfn = pxa270b1_initfn, |
139 | + return cpu->env.pmsav7.rnr < cpu->pmsav7_dregion; | 129 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
140 | } | 130 | + { .name = "pxa270-c0", .initfn = pxa270c0_initfn, |
141 | 131 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, | |
142 | static const VMStateDescription vmstate_pmsav7 = { | 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 | ||
143 | -- | 137 | -- |
144 | 2.7.4 | 138 | 2.34.1 |
145 | 139 | ||
146 | 140 | diff view generated by jsdifflib |
1 | The PMSAv7 region number register is migrated for R profile | 1 | The test-arm-iwmmmxt test isn't testing what it thinks it's testing. |
---|---|---|---|
2 | cores using the cpreg scheme, but M profile doesn't use | 2 | |
3 | cpregs, and so we weren't migrating the MPU_RNR register state | 3 | If you run it with a CPU type that supports iwMMXt then it will crash |
4 | at all. Fix that by adding a migration subsection for the | 4 | immediately with a SIGILL, because (even with -marm) GCC will link it |
5 | M profile case. | 5 | against startup code that is in Thumb mode, and no iwMMXt CPU has |
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. | ||
6 | 30 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 31 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 32 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 1501153150-19984-6-git-send-email-peter.maydell@linaro.org | 33 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
34 | Message-id: 20250127112715.2936555-3-peter.maydell@linaro.org | ||
10 | --- | 35 | --- |
11 | target/arm/machine.c | 28 ++++++++++++++++++++++++++++ | 36 | tests/tcg/arm/Makefile.target | 7 ----- |
12 | 1 file changed, 28 insertions(+) | 37 | tests/tcg/arm/README | 5 ---- |
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 | ||
13 | 41 | ||
14 | diff --git a/target/arm/machine.c b/target/arm/machine.c | 42 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target |
15 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/machine.c | 44 | --- a/tests/tcg/arm/Makefile.target |
17 | +++ b/target/arm/machine.c | 45 | +++ b/tests/tcg/arm/Makefile.target |
18 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav7 = { | 46 | @@ -XXX,XX +XXX,XX @@ ARM_TESTS = hello-arm |
19 | } | 47 | hello-arm: CFLAGS+=-marm -ffreestanding -fno-stack-protector |
20 | }; | 48 | hello-arm: LDFLAGS+=-nostdlib |
21 | 49 | ||
22 | +static bool pmsav7_rnr_needed(void *opaque) | 50 | -# IWMXT floating point extensions |
23 | +{ | 51 | -ARM_TESTS += test-arm-iwmmxt |
24 | + ARMCPU *cpu = opaque; | 52 | -# Clang assembler does not support IWMXT, so use the external assembler. |
25 | + CPUARMState *env = &cpu->env; | 53 | -test-arm-iwmmxt: CFLAGS += -marm -march=iwmmxt -mabi=aapcs -mfpu=fpv4-sp-d16 $(CROSS_CC_HAS_FNIA) |
26 | + | 54 | -test-arm-iwmmxt: test-arm-iwmmxt.S |
27 | + /* For R profile cores pmsav7.rnr is migrated via the cpreg | 55 | - $(CC) $(CFLAGS) -Wa,--noexecstack $< -o $@ $(LDFLAGS) |
28 | + * "RGNR" definition in helper.h. For M profile we have to | 56 | - |
29 | + * migrate it separately. | 57 | # Float-convert Tests |
30 | + */ | 58 | ARM_TESTS += fcvt |
31 | + return arm_feature(env, ARM_FEATURE_M); | 59 | fcvt: LDFLAGS += -lm |
32 | +} | 60 | diff --git a/tests/tcg/arm/README b/tests/tcg/arm/README |
33 | + | 61 | index XXXXXXX..XXXXXXX 100644 |
34 | +static const VMStateDescription vmstate_pmsav7_rnr = { | 62 | --- a/tests/tcg/arm/README |
35 | + .name = "cpu/pmsav7-rnr", | 63 | +++ b/tests/tcg/arm/README |
36 | + .version_id = 1, | 64 | @@ -XXX,XX +XXX,XX @@ hello-arm |
37 | + .minimum_version_id = 1, | 65 | --------- |
38 | + .needed = pmsav7_rnr_needed, | 66 | |
39 | + .fields = (VMStateField[]) { | 67 | A very simple inline assembly, write syscall based hello world |
40 | + VMSTATE_UINT32(env.pmsav7.rnr, ARMCPU), | 68 | - |
41 | + VMSTATE_END_OF_LIST() | 69 | -test-arm-iwmmxt |
42 | + } | 70 | ---------------- |
43 | +}; | 71 | - |
44 | + | 72 | -A simple test case for older iwmmxt extended ARMs |
45 | static int get_cpsr(QEMUFile *f, void *opaque, size_t size, | 73 | diff --git a/tests/tcg/arm/test-arm-iwmmxt.S b/tests/tcg/arm/test-arm-iwmmxt.S |
46 | VMStateField *field) | 74 | deleted file mode 100644 |
47 | { | 75 | index XXXXXXX..XXXXXXX |
48 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_arm_cpu = { | 76 | --- a/tests/tcg/arm/test-arm-iwmmxt.S |
49 | &vmstate_iwmmxt, | 77 | +++ /dev/null |
50 | &vmstate_m, | 78 | @@ -XXX,XX +XXX,XX @@ |
51 | &vmstate_thumb2ee, | 79 | -@ Checks whether iwMMXt is functional. |
52 | + /* pmsav7_rnr must come before pmsav7 so that we have the | 80 | -.code 32 |
53 | + * region number before we test it in the VMSTATE_VALIDATE | 81 | -.globl main |
54 | + * in vmstate_pmsav7. | 82 | - |
55 | + */ | 83 | -main: |
56 | + &vmstate_pmsav7_rnr, | 84 | -ldr r0, =data0 |
57 | &vmstate_pmsav7, | 85 | -ldr r1, =data1 |
58 | NULL | 86 | -ldr r2, =data2 |
59 | } | 87 | -#ifndef FPA |
88 | -wldrd wr0, [r0, #0] | ||
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" | ||
60 | -- | 128 | -- |
61 | 2.7.4 | 129 | 2.34.1 |
62 | 130 | ||
63 | 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 |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | In heterogeneous setup the first vCPU might not be | ||
4 | the one expected, better pass it explicitly. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Message-id: 20250130112615.3219-2-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/boot.h | 4 +++- | ||
12 | hw/arm/boot.c | 11 ++++++----- | ||
13 | hw/arm/virt.c | 2 +- | ||
14 | 3 files changed, 10 insertions(+), 7 deletions(-) | ||
15 | |||
16 | diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/include/hw/arm/boot.h | ||
19 | +++ b/include/hw/arm/boot.h | ||
20 | @@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, | ||
21 | * @binfo: struct describing the boot environment | ||
22 | * @addr_limit: upper limit of the available memory area at @addr | ||
23 | * @as: address space to load image to | ||
24 | + * @cpu: ARM CPU object | ||
25 | * | ||
26 | * Load a device tree supplied by the machine or by the user with the | ||
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 | } | ||
86 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/arm/virt.c | ||
89 | +++ b/hw/arm/virt.c | ||
90 | @@ -XXX,XX +XXX,XX @@ void virt_machine_done(Notifier *notifier, void *data) | ||
91 | vms->memmap[VIRT_PLATFORM_BUS].size, | ||
92 | vms->irqmap[VIRT_PLATFORM_BUS]); | ||
93 | } | ||
94 | - if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) { | ||
95 | + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms, cpu) < 0) { | ||
96 | exit(1); | ||
97 | } | ||
98 | |||
99 | -- | ||
100 | 2.34.1 | ||
101 | |||
102 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | The A9MPCore forward the IRQs from its internal GIC. | ||
4 | To make the code clearer, add the 'mpcore' and 'gic' | ||
5 | variables. | ||
6 | |||
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 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/fsl-imx6.c | 52 +++++++++++++++++++---------------------------- | ||
13 | 1 file changed, 21 insertions(+), 31 deletions(-) | ||
14 | |||
15 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/fsl-imx6.c | ||
18 | +++ b/hw/arm/fsl-imx6.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
20 | uint16_t i; | ||
21 | qemu_irq irq; | ||
22 | unsigned int smp_cpus = ms->smp.cpus; | ||
23 | + DeviceState *mpcore = DEVICE(&s->a9mpcore); | ||
24 | + DeviceState *gic; | ||
25 | |||
26 | if (smp_cpus > FSL_IMX6_NUM_CPUS) { | ||
27 | error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", | ||
28 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
29 | } | ||
30 | } | ||
31 | |||
32 | - object_property_set_int(OBJECT(&s->a9mpcore), "num-cpu", smp_cpus, | ||
33 | - &error_abort); | ||
34 | + object_property_set_int(OBJECT(mpcore), "num-cpu", smp_cpus, &error_abort); | ||
35 | |||
36 | - object_property_set_int(OBJECT(&s->a9mpcore), "num-irq", | ||
37 | + object_property_set_int(OBJECT(mpcore), "num-irq", | ||
38 | FSL_IMX6_MAX_IRQ + GIC_INTERNAL, &error_abort); | ||
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 | /* | ||
165 | -- | ||
166 | 2.34.1 | ||
167 | |||
168 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | The A7MPCore forward the IRQs from its internal GIC. | ||
4 | To make the code clearer, add the 'mpcore' and 'gic' | ||
5 | variables. Rename 'd' variable as 'cpu'. | ||
6 | |||
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-4-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/fsl-imx6ul.c | 64 +++++++++++++++++++-------------------------- | ||
13 | 1 file changed, 27 insertions(+), 37 deletions(-) | ||
14 | |||
15 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/fsl-imx6ul.c | ||
18 | +++ b/hw/arm/fsl-imx6ul.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
20 | { | ||
21 | MachineState *ms = MACHINE(qdev_get_machine()); | ||
22 | FslIMX6ULState *s = FSL_IMX6UL(dev); | ||
23 | + DeviceState *mpcore = DEVICE(&s->a7mpcore); | ||
24 | int i; | ||
25 | char name[NAME_SIZE]; | ||
26 | - SysBusDevice *sbd; | ||
27 | - DeviceState *d; | ||
28 | + DeviceState *gic; | ||
29 | + SysBusDevice *gicsbd; | ||
30 | + DeviceState *cpu; | ||
31 | |||
32 | if (ms->smp.cpus > 1) { | ||
33 | error_setg(errp, "%s: Only a single CPU is supported (%d requested)", | ||
34 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
35 | /* | ||
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 | /* | ||
175 | -- | ||
176 | 2.34.1 | ||
177 | |||
178 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | The A7MPCore forward the IRQs from its internal GIC. |
4 | Message-id: 20170729234930.725-1-f4bug@amsat.org | 4 | To make the code clearer, add the 'mpcore' and 'gic' |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | variables. |
6 | |||
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-5-philmd@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 11 | --- |
8 | hw/misc/mps2-scc.c | 4 ++-- | 12 | hw/arm/fsl-imx7.c | 52 +++++++++++++++++++++-------------------------- |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 13 | 1 file changed, 23 insertions(+), 29 deletions(-) |
10 | 14 | ||
11 | diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c | 15 | diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c |
12 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/misc/mps2-scc.c | 17 | --- a/hw/arm/fsl-imx7.c |
14 | +++ b/hw/misc/mps2-scc.c | 18 | +++ b/hw/arm/fsl-imx7.c |
15 | @@ -XXX,XX +XXX,XX @@ static Property mps2_scc_properties[] = { | 19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) |
16 | /* Values for various read-only ID registers (which are specific | 20 | { |
17 | * to the board model or FPGA image) | 21 | MachineState *ms = MACHINE(qdev_get_machine()); |
22 | FslIMX7State *s = FSL_IMX7(dev); | ||
23 | - Object *o; | ||
24 | + DeviceState *mpcore = DEVICE(&s->a7mpcore); | ||
25 | + DeviceState *gic; | ||
26 | int i; | ||
27 | qemu_irq irq; | ||
28 | char name[NAME_SIZE]; | ||
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
30 | * CPUs | ||
18 | */ | 31 | */ |
19 | - DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, aid, 0), | 32 | for (i = 0; i < smp_cpus; i++) { |
20 | + DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, cfg4, 0), | 33 | - o = OBJECT(&s->cpu[i]); |
21 | DEFINE_PROP_UINT32("scc-aid", MPS2SCC, aid, 0), | 34 | + Object *o = OBJECT(&s->cpu[i]); |
22 | - DEFINE_PROP_UINT32("scc-id", MPS2SCC, aid, 0), | 35 | |
23 | + DEFINE_PROP_UINT32("scc-id", MPS2SCC, id, 0), | 36 | /* On uniprocessor, the CBAR is set to 0 */ |
24 | /* These are the initial settings for the source clocks on the board. | 37 | if (smp_cpus > 1) { |
25 | * In hardware they can be configured via a config file read by the | 38 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) |
26 | * motherboard configuration controller to suit the FPGA image. | 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])); | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
72 | FSL_IMX7_GPIOn_ADDR[i]); | ||
73 | |||
74 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, | ||
75 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
76 | - FSL_IMX7_GPIOn_LOW_IRQ[i])); | ||
77 | + qdev_get_gpio_in(gic, FSL_IMX7_GPIOn_LOW_IRQ[i])); | ||
78 | |||
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); | ||
27 | -- | 170 | -- |
28 | 2.7.4 | 171 | 2.34.1 |
29 | 172 | ||
30 | 173 | diff view generated by jsdifflib |
1 | The M profile PMSAv7 specification says that if the address being looked | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | up is in the PPB region (0xe0000000 - 0xe00fffff) then we do not use | ||
3 | the MPU regions but always use the default memory map. Implement this | ||
4 | (we were previously behaving like an R profile PMSAv7, which does not | ||
5 | special case this). | ||
6 | 2 | ||
3 | No need to duplicate and forward the 'num-cpu' property from | ||
4 | TYPE_ARM11MPCORE_PRIV to TYPE_REALVIEW_MPCORE, alias it with | ||
5 | QOM object_property_add_alias(). | ||
6 | |||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
9 | Message-id: 20250130112615.3219-6-philmd@linaro.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 1501153150-19984-2-git-send-email-peter.maydell@linaro.org | ||
10 | --- | 11 | --- |
11 | target/arm/helper.c | 17 ++++++++++++++++- | 12 | hw/cpu/realview_mpcore.c | 8 +------- |
12 | 1 file changed, 16 insertions(+), 1 deletion(-) | 13 | 1 file changed, 1 insertion(+), 7 deletions(-) |
13 | 14 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 17 | --- a/hw/cpu/realview_mpcore.c |
17 | +++ b/target/arm/helper.c | 18 | +++ b/hw/cpu/realview_mpcore.c |
18 | @@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu, | 19 | @@ -XXX,XX +XXX,XX @@ |
20 | #include "hw/cpu/arm11mpcore.h" | ||
21 | #include "hw/intc/realview_gic.h" | ||
22 | #include "hw/irq.h" | ||
23 | -#include "hw/qdev-properties.h" | ||
24 | #include "qom/object.h" | ||
25 | |||
26 | #define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore" | ||
27 | @@ -XXX,XX +XXX,XX @@ static void realview_mpcore_realize(DeviceState *dev, Error **errp) | ||
28 | int n; | ||
29 | int i; | ||
30 | |||
31 | - qdev_prop_set_uint32(priv, "num-cpu", s->num_cpu); | ||
32 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->priv), errp)) { | ||
33 | return; | ||
34 | } | ||
35 | @@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_init(Object *obj) | ||
36 | int i; | ||
37 | |||
38 | object_initialize_child(obj, "a11priv", &s->priv, TYPE_ARM11MPCORE_PRIV); | ||
39 | + object_property_add_alias(obj, "num-cpu", OBJECT(&s->priv), "num-cpu"); | ||
40 | privbusdev = SYS_BUS_DEVICE(&s->priv); | ||
41 | sysbus_init_mmio(sbd, sysbus_mmio_get_region(privbusdev, 0)); | ||
42 | |||
43 | @@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_init(Object *obj) | ||
19 | } | 44 | } |
20 | } | 45 | } |
21 | 46 | ||
22 | +static inline bool m_is_ppb_region(CPUARMState *env, uint32_t address) | 47 | -static const Property mpcore_rirq_properties[] = { |
23 | +{ | 48 | - DEFINE_PROP_UINT32("num-cpu", mpcore_rirq_state, num_cpu, 1), |
24 | + /* True if address is in the M profile PPB region 0xe0000000 - 0xe00fffff */ | 49 | -}; |
25 | + return arm_feature(env, ARM_FEATURE_M) && | 50 | - |
26 | + extract32(address, 20, 12) == 0xe00; | 51 | static void mpcore_rirq_class_init(ObjectClass *klass, void *data) |
27 | +} | 52 | { |
28 | + | 53 | DeviceClass *dc = DEVICE_CLASS(klass); |
29 | static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 54 | |
30 | int access_type, ARMMMUIdx mmu_idx, | 55 | dc->realize = realview_mpcore_realize; |
31 | hwaddr *phys_ptr, int *prot, uint32_t *fsr) | 56 | - device_class_set_props(dc, mpcore_rirq_properties); |
32 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 57 | } |
33 | *phys_ptr = address; | 58 | |
34 | *prot = 0; | 59 | static const TypeInfo mpcore_rirq_info = { |
35 | |||
36 | - if (regime_translation_disabled(env, mmu_idx)) { /* MPU disabled */ | ||
37 | + if (regime_translation_disabled(env, mmu_idx) || | ||
38 | + m_is_ppb_region(env, address)) { | ||
39 | + /* MPU disabled or M profile PPB access: use default memory map. | ||
40 | + * The other case which uses the default memory map in the | ||
41 | + * v7M ARM ARM pseudocode is exception vector reads from the vector | ||
42 | + * table. In QEMU those accesses are done in arm_v7m_load_vector(), | ||
43 | + * which always does a direct read using address_space_ldl(), rather | ||
44 | + * than going via this function, so we don't need to check that here. | ||
45 | + */ | ||
46 | get_phys_addr_pmsav7_default(env, mmu_idx, address, prot); | ||
47 | } else { /* MPU enabled */ | ||
48 | for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) { | ||
49 | -- | 60 | -- |
50 | 2.7.4 | 61 | 2.34.1 |
51 | 62 | ||
52 | 63 | diff view generated by jsdifflib |
1 | When the PMSAv7 implementation was originally added it was for R profile | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | CPUs only, and reset was handled using the cpreg .resetfn hooks. | ||
3 | Unfortunately for M profile cores this doesn't work, because they do | ||
4 | not register any cpregs. Move the reset handling into arm_cpu_reset(), | ||
5 | where it will work for both R profile and M profile cores. | ||
6 | 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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 1501153150-19984-5-git-send-email-peter.maydell@linaro.org | ||
10 | --- | 12 | --- |
11 | target/arm/cpu.c | 14 ++++++++++++++ | 13 | hw/cpu/a15mpcore.c | 21 +++++++++------------ |
12 | target/arm/helper.c | 28 ++++++++++++---------------- | 14 | hw/cpu/a9mpcore.c | 21 +++++++++------------ |
13 | 2 files changed, 26 insertions(+), 16 deletions(-) | 15 | hw/cpu/arm11mpcore.c | 21 +++++++++------------ |
16 | hw/cpu/realview_mpcore.c | 21 +++++++++------------ | ||
17 | 4 files changed, 36 insertions(+), 48 deletions(-) | ||
14 | 18 | ||
15 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 19 | diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/cpu.c | 21 | --- a/hw/cpu/a15mpcore.c |
18 | +++ b/target/arm/cpu.c | 22 | +++ b/hw/cpu/a15mpcore.c |
19 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) | 23 | @@ -XXX,XX +XXX,XX @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data) |
20 | 24 | /* We currently have no saveable state */ | |
21 | env->vfp.xregs[ARM_VFP_FPEXC] = 0; | ||
22 | #endif | ||
23 | + | ||
24 | + if (arm_feature(env, ARM_FEATURE_PMSA) && | ||
25 | + arm_feature(env, ARM_FEATURE_V7)) { | ||
26 | + if (cpu->pmsav7_dregion > 0) { | ||
27 | + memset(env->pmsav7.drbar, 0, | ||
28 | + sizeof(*env->pmsav7.drbar) * cpu->pmsav7_dregion); | ||
29 | + memset(env->pmsav7.drsr, 0, | ||
30 | + sizeof(*env->pmsav7.drsr) * cpu->pmsav7_dregion); | ||
31 | + memset(env->pmsav7.dracr, 0, | ||
32 | + sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion); | ||
33 | + } | ||
34 | + env->pmsav7.rnr = 0; | ||
35 | + } | ||
36 | + | ||
37 | set_flush_to_zero(1, &env->vfp.standard_fp_status); | ||
38 | set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status); | ||
39 | set_default_nan_mode(1, &env->vfp.standard_fp_status); | ||
40 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/target/arm/helper.c | ||
43 | +++ b/target/arm/helper.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
45 | *u32p = value; | ||
46 | } | 25 | } |
47 | 26 | ||
48 | -static void pmsav7_reset(CPUARMState *env, const ARMCPRegInfo *ri) | 27 | -static const TypeInfo a15mp_priv_info = { |
28 | - .name = TYPE_A15MPCORE_PRIV, | ||
29 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
30 | - .instance_size = sizeof(A15MPPrivState), | ||
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) | ||
49 | -{ | 44 | -{ |
50 | - ARMCPU *cpu = arm_env_get_cpu(env); | 45 | - type_register_static(&a15mp_priv_info); |
51 | - uint32_t *u32p = *(uint32_t **)raw_ptr(env, ri); | ||
52 | - | ||
53 | - if (!u32p) { | ||
54 | - return; | ||
55 | - } | ||
56 | - | ||
57 | - memset(u32p, 0, sizeof(*u32p) * cpu->pmsav7_dregion); | ||
58 | -} | 46 | -} |
59 | - | 47 | - |
60 | static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 48 | -type_init(a15mp_register_types) |
61 | uint64_t value) | 49 | +DEFINE_TYPES(a15mp_types) |
62 | { | 50 | diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c |
63 | @@ -XXX,XX +XXX,XX @@ static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 51 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/hw/cpu/a9mpcore.c | ||
53 | +++ b/hw/cpu/a9mpcore.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data) | ||
55 | device_class_set_props(dc, a9mp_priv_properties); | ||
64 | } | 56 | } |
65 | 57 | ||
66 | static const ARMCPRegInfo pmsav7_cp_reginfo[] = { | 58 | -static const TypeInfo a9mp_priv_info = { |
67 | + /* Reset for all these registers is handled in arm_cpu_reset(), | 59 | - .name = TYPE_A9MPCORE_PRIV, |
68 | + * because the PMSAv7 is also used by M-profile CPUs, which do | 60 | - .parent = TYPE_SYS_BUS_DEVICE, |
69 | + * not register cpregs but still need the state to be reset. | 61 | - .instance_size = sizeof(A9MPPrivState), |
70 | + */ | 62 | - .instance_init = a9mp_priv_initfn, |
71 | { .name = "DRBAR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 1, .opc2 = 0, | 63 | - .class_init = a9mp_priv_class_init, |
72 | .access = PL1_RW, .type = ARM_CP_NO_RAW, | 64 | +static const TypeInfo a9mp_types[] = { |
73 | .fieldoffset = offsetof(CPUARMState, pmsav7.drbar), | 65 | + { |
74 | - .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset }, | 66 | + .name = TYPE_A9MPCORE_PRIV, |
75 | + .readfn = pmsav7_read, .writefn = pmsav7_write, | 67 | + .parent = TYPE_SYS_BUS_DEVICE, |
76 | + .resetfn = arm_cp_reset_ignore }, | 68 | + .instance_size = sizeof(A9MPPrivState), |
77 | { .name = "DRSR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 1, .opc2 = 2, | 69 | + .instance_init = a9mp_priv_initfn, |
78 | .access = PL1_RW, .type = ARM_CP_NO_RAW, | 70 | + .class_init = a9mp_priv_class_init, |
79 | .fieldoffset = offsetof(CPUARMState, pmsav7.drsr), | 71 | + }, |
80 | - .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset }, | ||
81 | + .readfn = pmsav7_read, .writefn = pmsav7_write, | ||
82 | + .resetfn = arm_cp_reset_ignore }, | ||
83 | { .name = "DRACR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 1, .opc2 = 4, | ||
84 | .access = PL1_RW, .type = ARM_CP_NO_RAW, | ||
85 | .fieldoffset = offsetof(CPUARMState, pmsav7.dracr), | ||
86 | - .readfn = pmsav7_read, .writefn = pmsav7_write, .resetfn = pmsav7_reset }, | ||
87 | + .readfn = pmsav7_read, .writefn = pmsav7_write, | ||
88 | + .resetfn = arm_cp_reset_ignore }, | ||
89 | { .name = "RGNR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 2, .opc2 = 0, | ||
90 | .access = PL1_RW, | ||
91 | .fieldoffset = offsetof(CPUARMState, pmsav7.rnr), | ||
92 | - .writefn = pmsav7_rgnr_write }, | ||
93 | + .writefn = pmsav7_rgnr_write, | ||
94 | + .resetfn = arm_cp_reset_ignore }, | ||
95 | REGINFO_SENTINEL | ||
96 | }; | 72 | }; |
97 | 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 | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/hw/cpu/arm11mpcore.c | ||
84 | +++ b/hw/cpu/arm11mpcore.c | ||
85 | @@ -XXX,XX +XXX,XX @@ static void mpcore_priv_class_init(ObjectClass *klass, void *data) | ||
86 | device_class_set_props(dc, mpcore_priv_properties); | ||
87 | } | ||
88 | |||
89 | -static const TypeInfo mpcore_priv_info = { | ||
90 | - .name = TYPE_ARM11MPCORE_PRIV, | ||
91 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
92 | - .instance_size = sizeof(ARM11MPCorePriveState), | ||
93 | - .instance_init = mpcore_priv_initfn, | ||
94 | - .class_init = mpcore_priv_class_init, | ||
95 | +static const TypeInfo arm11mp_types[] = { | ||
96 | + { | ||
97 | + .name = TYPE_ARM11MPCORE_PRIV, | ||
98 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
99 | + .instance_size = sizeof(ARM11MPCorePriveState), | ||
100 | + .instance_init = mpcore_priv_initfn, | ||
101 | + .class_init = mpcore_priv_class_init, | ||
102 | + }, | ||
103 | }; | ||
104 | |||
105 | -static void arm11mpcore_register_types(void) | ||
106 | -{ | ||
107 | - type_register_static(&mpcore_priv_info); | ||
108 | -} | ||
109 | - | ||
110 | -type_init(arm11mpcore_register_types) | ||
111 | +DEFINE_TYPES(arm11mp_types) | ||
112 | diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/hw/cpu/realview_mpcore.c | ||
115 | +++ b/hw/cpu/realview_mpcore.c | ||
116 | @@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_class_init(ObjectClass *klass, void *data) | ||
117 | dc->realize = realview_mpcore_realize; | ||
118 | } | ||
119 | |||
120 | -static const TypeInfo mpcore_rirq_info = { | ||
121 | - .name = TYPE_REALVIEW_MPCORE_RIRQ, | ||
122 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
123 | - .instance_size = sizeof(mpcore_rirq_state), | ||
124 | - .instance_init = mpcore_rirq_init, | ||
125 | - .class_init = mpcore_rirq_class_init, | ||
126 | +static const TypeInfo realview_mpcore_types[] = { | ||
127 | + { | ||
128 | + .name = TYPE_REALVIEW_MPCORE_RIRQ, | ||
129 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
130 | + .instance_size = sizeof(mpcore_rirq_state), | ||
131 | + .instance_init = mpcore_rirq_init, | ||
132 | + .class_init = mpcore_rirq_class_init, | ||
133 | + }, | ||
134 | }; | ||
135 | |||
136 | -static void realview_mpcore_register_types(void) | ||
137 | -{ | ||
138 | - type_register_static(&mpcore_rirq_info); | ||
139 | -} | ||
140 | - | ||
141 | -type_init(realview_mpcore_register_types) | ||
142 | +DEFINE_TYPES(realview_mpcore_types) | ||
98 | -- | 143 | -- |
99 | 2.7.4 | 144 | 2.34.1 |
100 | 145 | ||
101 | 146 | diff view generated by jsdifflib |
1 | For an M profile v7PMSA, the system space (0xe0000000 - 0xffffffff) can | 1 | From: Andrew Yuan <andrew.yuan@jaguarmicro.com> |
---|---|---|---|
2 | never be executable, even if the guest tries to set the MPU registers | ||
3 | up that way. Enforce this restriction. | ||
4 | 2 | ||
3 | Our current handling of the mask/compare logic in the Cadence | ||
4 | GEM ethernet device is wrong: | ||
5 | (1) we load the same byte twice from rx_buf when | ||
6 | creating the compare value | ||
7 | (2) we ignore the DISABLE_MASK flag | ||
8 | |||
9 | The "Cadence IP for Gigabit Ethernet MAC Part Number: IP7014 IP Rev: | ||
10 | R1p12 - Doc Rev: 1.3 User Guide" states that if the DISABLE_MASK bit | ||
11 | in type2_compare_x_word_1 is set, the mask_value field in | ||
12 | type2_compare_x_word_0 is used as an additional 2 byte Compare Value. | ||
13 | |||
14 | Correct these bugs: | ||
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 | ||
22 | |||
23 | Signed-off-by: Andrew Yuan <andrew.yuan@jaguarmicro.com> | ||
24 | Message-id: 20241219061658.805-1-andrew.yuan@jaguarmicro.com | ||
25 | Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
26 | [PMM: Expand commit message and comment] | ||
27 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
28 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 1501153150-19984-3-git-send-email-peter.maydell@linaro.org | ||
8 | --- | 30 | --- |
9 | target/arm/helper.c | 16 +++++++++++++++- | 31 | hw/net/cadence_gem.c | 26 +++++++++++++++++++++----- |
10 | 1 file changed, 15 insertions(+), 1 deletion(-) | 32 | 1 file changed, 21 insertions(+), 5 deletions(-) |
11 | 33 | ||
12 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 34 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
13 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/helper.c | 36 | --- a/hw/net/cadence_gem.c |
15 | +++ b/target/arm/helper.c | 37 | +++ b/hw/net/cadence_gem.c |
16 | @@ -XXX,XX +XXX,XX @@ static inline bool m_is_ppb_region(CPUARMState *env, uint32_t address) | 38 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
17 | extract32(address, 20, 12) == 0xe00; | 39 | |
18 | } | 40 | /* Compare A, B, C */ |
19 | 41 | for (j = 0; j < 3; j++) { | |
20 | +static inline bool m_is_system_region(CPUARMState *env, uint32_t address) | 42 | - uint32_t cr0, cr1, mask, compare; |
21 | +{ | 43 | - uint16_t rx_cmp; |
22 | + /* True if address is in the M profile system region | 44 | + uint32_t cr0, cr1, mask, compare, disable_mask; |
23 | + * 0xe0000000 - 0xffffffff | 45 | + uint32_t rx_cmp; |
24 | + */ | 46 | int offset; |
25 | + return arm_feature(env, ARM_FEATURE_M) && extract32(address, 29, 3) == 0x7; | 47 | int cr_idx = extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_SHIFT + j * 6, |
26 | +} | 48 | R_SCREENING_TYPE2_REG0_COMPARE_A_LENGTH); |
27 | + | 49 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
28 | static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 50 | break; |
29 | int access_type, ARMMMUIdx mmu_idx, | 51 | } |
30 | hwaddr *phys_ptr, int *prot, uint32_t *fsr) | 52 | |
31 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 53 | - rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset]; |
32 | get_phys_addr_pmsav7_default(env, mmu_idx, address, prot); | 54 | - mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); |
33 | } else { /* a MPU hit! */ | 55 | - compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); |
34 | uint32_t ap = extract32(env->pmsav7.dracr[n], 8, 3); | 56 | + disable_mask = |
35 | + uint32_t xn = extract32(env->pmsav7.dracr[n], 12, 1); | 57 | + FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, DISABLE_MASK); |
36 | + | 58 | + if (disable_mask) { |
37 | + if (m_is_system_region(env, address)) { | 59 | + /* |
38 | + /* System space is always execute never */ | 60 | + * If disable_mask is set, mask_value is used as an |
39 | + xn = 1; | 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); | ||
40 | + } | 74 | + } |
41 | 75 | ||
42 | if (is_user) { /* User mode AP bit decoding */ | 76 | if ((rx_cmp & mask) == (compare & mask)) { |
43 | switch (ap) { | 77 | matched = true; |
44 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
45 | } | ||
46 | |||
47 | /* execute never */ | ||
48 | - if (env->pmsav7.dracr[n] & (1 << 12)) { | ||
49 | + if (xn) { | ||
50 | *prot &= ~PAGE_EXEC; | ||
51 | } | ||
52 | } | ||
53 | -- | 78 | -- |
54 | 2.7.4 | 79 | 2.34.1 |
55 | 80 | ||
56 | 81 | diff view generated by jsdifflib |
1 | Correct off-by-one bug in the PSMAv7 MPU tracing where it would print | 1 | The '-old-param' command line option is specific to Arm targets; it |
---|---|---|---|
2 | a write access as "reading", an insn fetch as "writing", and a read | 2 | is very briefly documented as "old param mode". What this option |
3 | access as "execute". | 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 | Since we have an MMUAccessType enum now, we can make the code clearer | 8 | This support was added back in 2007 to support an old vendor kernel |
6 | in the process by using that rather than the raw 0/1/2 values. | 9 | on the akita/terrier board types: |
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. | ||
7 | 19 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <rth@twiddle.net> | 21 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> |
10 | Message-id: 1500906792-18010-1-git-send-email-peter.maydell@linaro.org | 22 | Message-id: 20250127123113.2947620-1-peter.maydell@linaro.org |
11 | --- | 23 | --- |
12 | target/arm/helper.c | 4 ++-- | 24 | docs/about/deprecated.rst | 13 +++++++++++++ |
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | 25 | system/vl.c | 1 + |
26 | 2 files changed, 14 insertions(+) | ||
14 | 27 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 28 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
16 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 30 | --- a/docs/about/deprecated.rst |
18 | +++ b/target/arm/helper.c | 31 | +++ b/docs/about/deprecated.rst |
19 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | 32 | @@ -XXX,XX +XXX,XX @@ configurations (e.g. -smp drawers=1,books=1,clusters=1 for x86 PC machine) is |
20 | phys_ptr, prot, fsr); | 33 | marked deprecated since 9.0, users have to ensure that all the topology members |
21 | qemu_log_mask(CPU_LOG_MMU, "PMSAv7 MPU lookup for %s at 0x%08" PRIx32 | 34 | described with -smp are supported by the target machine. |
22 | " mmu_idx %u -> %s (prot %c%c%c)\n", | 35 | |
23 | - access_type == 1 ? "reading" : | 36 | +``-old-param`` option for booting Arm kernels via param_struct (since 10.0) |
24 | - (access_type == 2 ? "writing" : "execute"), | 37 | +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
25 | + access_type == MMU_DATA_LOAD ? "reading" : | 38 | + |
26 | + (access_type == MMU_DATA_STORE ? "writing" : "execute"), | 39 | +The ``-old-param`` command line option is specific to Arm targets: |
27 | (uint32_t)address, mmu_idx, | 40 | +it is used when directly booting a guest kernel to pass it the |
28 | ret ? "Miss" : "Hit", | 41 | +command line and other information via the old ``param_struct`` ABI, |
29 | *prot & PAGE_READ ? 'r' : '-', | 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 | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/system/vl.c | ||
55 | +++ b/system/vl.c | ||
56 | @@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv) | ||
57 | nb_prom_envs++; | ||
58 | break; | ||
59 | case QEMU_OPTION_old_param: | ||
60 | + warn_report("-old-param is deprecated"); | ||
61 | old_param = 1; | ||
62 | break; | ||
63 | case QEMU_OPTION_rtc: | ||
30 | -- | 64 | -- |
31 | 2.7.4 | 65 | 2.34.1 |
32 | 66 | ||
33 | 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 |