1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. | 1 | Hi; here's an arm pullreq. The big bits here are Fabiano's |
---|---|---|---|
2 | CONFIG_TCG=n patches and my set that deprecate -singlestep; | ||
3 | other than that there's a collection of smaller bugfixes. | ||
2 | 4 | ||
3 | thanks | 5 | thanks |
4 | -- PMM | 6 | -- PMM |
5 | 7 | ||
6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: | 8 | The following changes since commit 7c18f2d663521f1b31b821a13358ce38075eaf7d: |
7 | 9 | ||
8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) | 10 | Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-04-29 23:07:17 +0100) |
9 | 11 | ||
10 | are available in the Git repository at: | 12 | are available in the Git repository at: |
11 | 13 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230502-1 |
13 | 15 | ||
14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: | 16 | for you to fetch changes up to 0ab99e4252f21550f2c16f859cbcdd3cced9f8bf: |
15 | 17 | ||
16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) | 18 | hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields (2023-05-02 13:10:42 +0100) |
17 | 19 | ||
18 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
19 | target-arm queue: | 21 | * Support building Arm targets with CONFIG_TCG=no (ie KVM only) |
20 | * ITS: error reporting cleanup | 22 | * hw/net: npcm7xx_emc: set MAC in register space |
21 | * aspeed: improve documentation | 23 | * hw/arm/bcm2835_property: Implement "get command line" message |
22 | * Fix STM32F2XX USART data register readout | 24 | * Deprecate the '-singlestep' command line option in favour of |
23 | * allow emulated GICv3 to be disabled in non-TCG builds | 25 | '-one-insn-per-tb' and '-accel one-insn-per-tb=on' |
24 | * fix exception priority for singlestep, misaligned PC, bp, etc | 26 | * Deprecate 'singlestep' member of QMP StatusInfo struct |
25 | * Correct calculation of tlb range invalidate length | 27 | * docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation |
26 | * npcm7xx_emc: fix missing queue_flush | 28 | * hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc() |
27 | * virt: Add VIOT ACPI table for virtio-iommu | 29 | * raspi, aspeed: Write bootloader code correctly on big-endian hosts |
28 | * target/i386: Use assert() to sanity-check b1 in SSE decode | 30 | * hw/intc/allwinner-a10-pic: Fix bug on big-endian hosts |
29 | * Don't include qemu-common unnecessarily | 31 | * Fix bug in A32 ERET on big-endian hosts that caused guest crash |
32 | * hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields | ||
33 | * hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields | ||
30 | 34 | ||
31 | ---------------------------------------------------------------- | 35 | ---------------------------------------------------------------- |
32 | Alex Bennée (1): | 36 | Claudio Fontana (1): |
33 | hw/intc: clean-up error reporting for failed ITS cmd | 37 | target/arm: move cpu_tcg to tcg/cpu32.c |
34 | 38 | ||
35 | Jean-Philippe Brucker (8): | 39 | Cédric Le Goater (2): |
36 | hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu | 40 | hw/arm/boot: Make write_bootloader() public as arm_write_bootloader() |
37 | hw/arm/virt: Remove device tree restriction for virtio-iommu | 41 | hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader |
38 | hw/arm/virt: Reject instantiation of multiple IOMMUs | ||
39 | hw/arm/virt: Use object_property_set instead of qdev_prop_set | ||
40 | tests/acpi: allow updates of VIOT expected data files | ||
41 | tests/acpi: add test case for VIOT | ||
42 | tests/acpi: add expected blobs for VIOT test on q35 machine | ||
43 | tests/acpi: add expected blob for VIOT test on virt machine | ||
44 | 42 | ||
45 | Joel Stanley (4): | 43 | Daniel Bertalan (1): |
46 | docs: aspeed: Add new boards | 44 | hw/arm/bcm2835_property: Implement "get command line" message |
47 | docs: aspeed: Update OpenBMC image URL | ||
48 | docs: aspeed: Give an example of booting a kernel | ||
49 | docs: aspeed: ADC is now modelled | ||
50 | 45 | ||
51 | Olivier Hériveaux (1): | 46 | Fabiano Rosas (11): |
52 | Fix STM32F2XX USART data register readout | 47 | target/arm: Move cortex sysregs into a separate file |
48 | target/arm: Remove dead code from cpu_max_set_sve_max_vq | ||
49 | target/arm: Extract TCG -cpu max code into a function | ||
50 | target/arm: Do not expose all -cpu max features to qtests | ||
51 | target/arm: Move 64-bit TCG CPUs into tcg/ | ||
52 | tests/qtest: Adjust and document query-cpu-model-expansion test for arm | ||
53 | tests/qtest: Fix tests when no KVM or TCG are present | ||
54 | tests/avocado: Pass parameters to migration test | ||
55 | arm/Kconfig: Always select SEMIHOSTING when TCG is present | ||
56 | arm/Kconfig: Do not build TCG-only boards on a KVM-only build | ||
57 | tests/qtest: Restrict tpm-tis-i2c-test to CONFIG_TCG | ||
53 | 58 | ||
54 | Patrick Venture (1): | 59 | Patrick Venture (1): |
55 | hw/net: npcm7xx_emc fix missing queue_flush | 60 | hw/net: npcm7xx_emc: set MAC in register space |
56 | 61 | ||
57 | Peter Maydell (6): | 62 | Peter Maydell (18): |
58 | target/i386: Use assert() to sanity-check b1 in SSE decode | 63 | make one-insn-per-tb an accel option |
59 | include/hw/i386: Don't include qemu-common.h in .h files | 64 | softmmu: Don't use 'singlestep' global in QMP and HMP commands |
60 | target/hexagon/cpu.h: don't include qemu-common.h | 65 | accel/tcg: Use one_insn_per_tb global instead of old singlestep global |
61 | target/rx/cpu.h: Don't include qemu-common.h | 66 | linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' |
62 | hw/arm: Don't include qemu-common.h unnecessarily | 67 | bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' |
63 | target/arm: Correct calculation of tlb range invalidate length | 68 | Document that -singlestep command line option is deprecated |
69 | accel/tcg: Report one-insn-per-tb in 'info jit', not 'info status' | ||
70 | hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' | ||
71 | qapi/run-state.json: Fix missing newline at end of file | ||
72 | qmp: Deprecate 'singlestep' member of StatusInfo | ||
73 | docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation | ||
74 | hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc() | ||
75 | hw/arm/raspi: Use arm_write_bootloader() to write boot code | ||
76 | hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit() | ||
77 | target/arm: Define and use new load_cpu_field_low32() | ||
78 | target/arm: Add compile time asserts to load/store_cpu_field macros | ||
79 | hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields | ||
80 | hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields | ||
64 | 81 | ||
65 | Philippe Mathieu-Daudé (2): | 82 | Philippe Mathieu-Daudé (1): |
66 | hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c | 83 | gitlab-ci: Check building KVM-only aarch64 target |
67 | hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector | ||
68 | 84 | ||
69 | Richard Henderson (10): | 85 | docs/about/deprecated.rst | 43 +- |
70 | target/arm: Hoist pc_next to a local variable in aarch64_tr_translate_insn | 86 | docs/user/main.rst | 14 +- |
71 | target/arm: Hoist pc_next to a local variable in arm_tr_translate_insn | 87 | configs/devices/aarch64-softmmu/default.mak | 4 - |
72 | target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn | 88 | configs/devices/arm-softmmu/default.mak | 39 -- |
73 | target/arm: Split arm_pre_translate_insn | 89 | qapi/run-state.json | 16 +- |
74 | target/arm: Advance pc for arch single-step exception | 90 | accel/tcg/internal.h | 2 + |
75 | target/arm: Split compute_fsr_fsc out of arm_deliver_fault | 91 | include/exec/cpu-common.h | 2 - |
76 | target/arm: Take an exception if PC is misaligned | 92 | include/hw/arm/boot.h | 49 ++ |
77 | target/arm: Assert thumb pc is aligned | 93 | include/hw/misc/bcm2835_property.h | 1 + |
78 | target/arm: Suppress bp for exceptions with more priority | 94 | include/monitor/hmp.h | 2 +- |
79 | tests/tcg: Add arm and aarch64 pc alignment tests | 95 | target/arm/cpregs.h | 6 + |
96 | target/arm/internals.h | 10 +- | ||
97 | target/arm/translate-a32.h | 24 +- | ||
98 | accel/tcg/cpu-exec.c | 2 +- | ||
99 | accel/tcg/monitor.c | 14 + | ||
100 | accel/tcg/tcg-all.c | 23 + | ||
101 | bsd-user/main.c | 14 +- | ||
102 | hw/arm/aspeed.c | 38 +- | ||
103 | hw/arm/bcm2835_peripherals.c | 2 + | ||
104 | hw/arm/bcm2836.c | 2 + | ||
105 | hw/arm/boot.c | 35 +- | ||
106 | hw/arm/raspi.c | 66 +- | ||
107 | hw/arm/virt.c | 6 +- | ||
108 | hw/intc/allwinner-a10-pic.c | 7 +- | ||
109 | hw/misc/bcm2835_property.c | 13 +- | ||
110 | hw/net/allwinner-sun8i-emac.c | 22 +- | ||
111 | hw/net/msf2-emac.c | 16 +- | ||
112 | hw/net/npcm7xx_emc.c | 32 +- | ||
113 | hw/sd/allwinner-sdhost.c | 31 +- | ||
114 | linux-user/main.c | 18 +- | ||
115 | softmmu/globals.c | 1 - | ||
116 | softmmu/runstate-hmp-cmds.c | 25 +- | ||
117 | softmmu/runstate.c | 10 +- | ||
118 | softmmu/vl.c | 17 +- | ||
119 | target/arm/cortex-regs.c | 69 ++ | ||
120 | target/arm/cpu64.c | 702 +------------------- | ||
121 | target/arm/{cpu_tcg.c => tcg/cpu32.c} | 72 +- | ||
122 | target/arm/tcg/cpu64.c | 723 +++++++++++++++++++++ | ||
123 | target/arm/tcg/translate.c | 4 +- | ||
124 | tests/qtest/arm-cpu-features.c | 20 +- | ||
125 | tests/qtest/bios-tables-test.c | 11 +- | ||
126 | tests/qtest/boot-serial-test.c | 5 + | ||
127 | tests/qtest/migration-test.c | 9 +- | ||
128 | tests/qtest/pxe-test.c | 8 +- | ||
129 | tests/qtest/test-hmp.c | 1 + | ||
130 | tests/qtest/vmgenid-test.c | 9 +- | ||
131 | .gitlab-ci.d/crossbuilds.yml | 11 + | ||
132 | .../custom-runners/ubuntu-22.04-aarch64.yml | 4 - | ||
133 | hmp-commands.hx | 25 +- | ||
134 | hw/arm/Kconfig | 43 +- | ||
135 | qemu-options.hx | 12 +- | ||
136 | target/arm/Kconfig | 7 + | ||
137 | target/arm/meson.build | 2 +- | ||
138 | target/arm/tcg/meson.build | 2 + | ||
139 | tcg/tci/README | 2 +- | ||
140 | tests/avocado/migration.py | 83 ++- | ||
141 | tests/qtest/meson.build | 3 +- | ||
142 | 57 files changed, 1449 insertions(+), 984 deletions(-) | ||
143 | create mode 100644 target/arm/cortex-regs.c | ||
144 | rename target/arm/{cpu_tcg.c => tcg/cpu32.c} (93%) | ||
145 | create mode 100644 target/arm/tcg/cpu64.c | ||
80 | 146 | ||
81 | docs/system/arm/aspeed.rst | 26 ++++++++++++---- | ||
82 | include/hw/i386/microvm.h | 1 - | ||
83 | include/hw/i386/x86.h | 1 - | ||
84 | target/arm/helper.h | 1 + | ||
85 | target/arm/syndrome.h | 5 +++ | ||
86 | target/hexagon/cpu.h | 1 - | ||
87 | target/rx/cpu.h | 1 - | ||
88 | hw/arm/boot.c | 1 - | ||
89 | hw/arm/digic_boards.c | 1 - | ||
90 | hw/arm/highbank.c | 1 - | ||
91 | hw/arm/npcm7xx_boards.c | 1 - | ||
92 | hw/arm/sbsa-ref.c | 1 - | ||
93 | hw/arm/stm32f405_soc.c | 1 - | ||
94 | hw/arm/vexpress.c | 1 - | ||
95 | hw/arm/virt-acpi-build.c | 7 +++++ | ||
96 | hw/arm/virt.c | 21 ++++++------- | ||
97 | hw/char/stm32f2xx_usart.c | 3 +- | ||
98 | hw/intc/arm_gicv3.c | 2 +- | ||
99 | hw/intc/arm_gicv3_cpuif.c | 10 +----- | ||
100 | hw/intc/arm_gicv3_cpuif_common.c | 22 +++++++++++++ | ||
101 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++-------- | ||
102 | hw/net/npcm7xx_emc.c | 18 +++++------ | ||
103 | hw/virtio/virtio-iommu-pci.c | 12 ++------ | ||
104 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++------------ | ||
105 | linux-user/hexagon/cpu_loop.c | 1 + | ||
106 | target/arm/debug_helper.c | 23 ++++++++++++++ | ||
107 | target/arm/gdbstub.c | 9 ++++-- | ||
108 | target/arm/helper.c | 6 ++-- | ||
109 | target/arm/machine.c | 10 ++++++ | ||
110 | target/arm/tlb_helper.c | 63 ++++++++++++++++++++++++++++---------- | ||
111 | target/arm/translate-a64.c | 23 ++++++++++++-- | ||
112 | target/arm/translate.c | 58 ++++++++++++++++++++++++++--------- | ||
113 | target/i386/tcg/translate.c | 12 ++------ | ||
114 | tests/qtest/bios-tables-test.c | 38 +++++++++++++++++++++++ | ||
115 | tests/tcg/aarch64/pcalign-a64.c | 37 ++++++++++++++++++++++ | ||
116 | tests/tcg/arm/pcalign-a32.c | 46 ++++++++++++++++++++++++++++ | ||
117 | hw/arm/Kconfig | 1 + | ||
118 | hw/intc/Kconfig | 5 +++ | ||
119 | hw/intc/meson.build | 11 ++++--- | ||
120 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | ||
121 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | ||
122 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes | ||
123 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
124 | tests/tcg/arm/Makefile.target | 4 +++ | ||
125 | 44 files changed, 429 insertions(+), 145 deletions(-) | ||
126 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
127 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
128 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
129 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
130 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
131 | create mode 100644 tests/data/acpi/virt/VIOT | ||
132 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in | 3 | The file cpu_tcg.c is about to be moved into the tcg/ directory, so |
4 | arm_gicv3_common_realize(). Since we want to restrict | 4 | move the register definitions into a new file. |
5 | arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() | 5 | |
6 | to a new file. Add this file to the meson 'specific' | 6 | Also move the function declaration to the more appropriate cpregs.h. |
7 | source set, since it needs access to "cpu.h". | 7 | |
8 | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | |
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com | 11 | Message-id: 20230426180013.14814-2-farosas@suse.de |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 13 | --- |
14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- | 14 | target/arm/cpregs.h | 6 ++++ |
15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ | 15 | target/arm/internals.h | 6 ---- |
16 | hw/intc/meson.build | 1 + | 16 | target/arm/cortex-regs.c | 69 ++++++++++++++++++++++++++++++++++++++++ |
17 | 3 files changed, 24 insertions(+), 9 deletions(-) | 17 | target/arm/cpu64.c | 1 + |
18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | 18 | target/arm/cpu_tcg.c | 59 ---------------------------------- |
19 | 19 | target/arm/meson.build | 1 + | |
20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 20 | 6 files changed, 77 insertions(+), 65 deletions(-) |
21 | index XXXXXXX..XXXXXXX 100644 | 21 | create mode 100644 target/arm/cortex-regs.c |
22 | --- a/hw/intc/arm_gicv3_cpuif.c | 22 | |
23 | +++ b/hw/intc/arm_gicv3_cpuif.c | 23 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h |
24 | @@ -XXX,XX +XXX,XX @@ | 24 | index XXXXXXX..XXXXXXX 100644 |
25 | /* | 25 | --- a/target/arm/cpregs.h |
26 | - * ARM Generic Interrupt Controller v3 | 26 | +++ b/target/arm/cpregs.h |
27 | + * ARM Generic Interrupt Controller v3 (emulation) | 27 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_cpreg_in_idspace(const ARMCPRegInfo *ri) |
28 | * | 28 | ri->crn, ri->crm); |
29 | * Copyright (c) 2016 Linaro Limited | 29 | } |
30 | * Written by Peter Maydell | 30 | |
31 | @@ -XXX,XX +XXX,XX @@ | 31 | +#ifdef CONFIG_USER_ONLY |
32 | #include "hw/irq.h" | 32 | +static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } |
33 | #include "cpu.h" | 33 | +#else |
34 | 34 | +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); | |
35 | -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | 35 | +#endif |
36 | -{ | 36 | + |
37 | - ARMCPU *arm_cpu = ARM_CPU(cpu); | 37 | #endif /* TARGET_ARM_CPREGS_H */ |
38 | - CPUARMState *env = &arm_cpu->env; | 38 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
39 | - | 39 | index XXXXXXX..XXXXXXX 100644 |
40 | - env->gicv3state = (void *)s; | 40 | --- a/target/arm/internals.h |
41 | -}; | 41 | +++ b/target/arm/internals.h |
42 | - | 42 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure); |
43 | static GICv3CPUState *icc_cs_from_env(CPUARMState *env) | 43 | uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure, |
44 | { | 44 | bool threadmode, bool spsel); |
45 | return env->gicv3state; | 45 | |
46 | diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c | 46 | -#ifdef CONFIG_USER_ONLY |
47 | -static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } | ||
48 | -#else | ||
49 | -void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); | ||
50 | -#endif | ||
51 | - | ||
52 | bool el_is_in_host(CPUARMState *env, int el); | ||
53 | |||
54 | void aa32_max_features(ARMCPU *cpu); | ||
55 | diff --git a/target/arm/cortex-regs.c b/target/arm/cortex-regs.c | ||
47 | new file mode 100644 | 56 | new file mode 100644 |
48 | index XXXXXXX..XXXXXXX | 57 | index XXXXXXX..XXXXXXX |
49 | --- /dev/null | 58 | --- /dev/null |
50 | +++ b/hw/intc/arm_gicv3_cpuif_common.c | 59 | +++ b/target/arm/cortex-regs.c |
51 | @@ -XXX,XX +XXX,XX @@ | 60 | @@ -XXX,XX +XXX,XX @@ |
52 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
53 | +/* | 61 | +/* |
54 | + * ARM Generic Interrupt Controller v3 | 62 | + * ARM Cortex-A registers |
55 | + * | 63 | + * |
56 | + * Copyright (c) 2016 Linaro Limited | 64 | + * This code is licensed under the GNU GPL v2 or later. |
57 | + * Written by Peter Maydell | ||
58 | + * | 65 | + * |
59 | + * This code is licensed under the GPL, version 2 or (at your option) | 66 | + * SPDX-License-Identifier: GPL-2.0-or-later |
60 | + * any later version. | ||
61 | + */ | 67 | + */ |
62 | + | 68 | + |
63 | +#include "qemu/osdep.h" | 69 | +#include "qemu/osdep.h" |
64 | +#include "gicv3_internal.h" | ||
65 | +#include "cpu.h" | 70 | +#include "cpu.h" |
66 | + | 71 | +#include "cpregs.h" |
67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | 72 | + |
73 | + | ||
74 | +static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
68 | +{ | 75 | +{ |
69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | 76 | + ARMCPU *cpu = env_archcpu(env); |
70 | + CPUARMState *env = &arm_cpu->env; | 77 | + |
71 | + | 78 | + /* Number of cores is in [25:24]; otherwise we RAZ */ |
72 | + env->gicv3state = (void *)s; | 79 | + return (cpu->core_count - 1) << 24; |
80 | +} | ||
81 | + | ||
82 | +static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { | ||
83 | + { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
84 | + .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2, | ||
85 | + .access = PL1_RW, .readfn = l2ctlr_read, | ||
86 | + .writefn = arm_cp_write_ignore }, | ||
87 | + { .name = "L2CTLR", | ||
88 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2, | ||
89 | + .access = PL1_RW, .readfn = l2ctlr_read, | ||
90 | + .writefn = arm_cp_write_ignore }, | ||
91 | + { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
92 | + .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3, | ||
93 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
94 | + { .name = "L2ECTLR", | ||
95 | + .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3, | ||
96 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
97 | + { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH, | ||
98 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0, | ||
99 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
100 | + { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
101 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0, | ||
102 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
103 | + { .name = "CPUACTLR", | ||
104 | + .cp = 15, .opc1 = 0, .crm = 15, | ||
105 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
106 | + { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
107 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1, | ||
108 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
109 | + { .name = "CPUECTLR", | ||
110 | + .cp = 15, .opc1 = 1, .crm = 15, | ||
111 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
112 | + { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
113 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2, | ||
114 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
115 | + { .name = "CPUMERRSR", | ||
116 | + .cp = 15, .opc1 = 2, .crm = 15, | ||
117 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
118 | + { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
119 | + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3, | ||
120 | + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
121 | + { .name = "L2MERRSR", | ||
122 | + .cp = 15, .opc1 = 3, .crm = 15, | ||
123 | + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
73 | +}; | 124 | +}; |
74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | 125 | + |
75 | index XXXXXXX..XXXXXXX 100644 | 126 | +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) |
76 | --- a/hw/intc/meson.build | 127 | +{ |
77 | +++ b/hw/intc/meson.build | 128 | + define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); |
78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | 129 | +} |
79 | 130 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | |
80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | 131 | index XXXXXXX..XXXXXXX 100644 |
81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | 132 | --- a/target/arm/cpu64.c |
82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | 133 | +++ b/target/arm/cpu64.c |
83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | 134 | @@ -XXX,XX +XXX,XX @@ |
84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | 135 | #include "qapi/visitor.h" |
85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | 136 | #include "hw/qdev-properties.h" |
137 | #include "internals.h" | ||
138 | +#include "cpregs.h" | ||
139 | |||
140 | static void aarch64_a35_initfn(Object *obj) | ||
141 | { | ||
142 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
143 | index XXXXXXX..XXXXXXX 100644 | ||
144 | --- a/target/arm/cpu_tcg.c | ||
145 | +++ b/target/arm/cpu_tcg.c | ||
146 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | ||
147 | cpu->isar.id_dfr0 = t; | ||
148 | } | ||
149 | |||
150 | -#ifndef CONFIG_USER_ONLY | ||
151 | -static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
152 | -{ | ||
153 | - ARMCPU *cpu = env_archcpu(env); | ||
154 | - | ||
155 | - /* Number of cores is in [25:24]; otherwise we RAZ */ | ||
156 | - return (cpu->core_count - 1) << 24; | ||
157 | -} | ||
158 | - | ||
159 | -static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { | ||
160 | - { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
161 | - .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2, | ||
162 | - .access = PL1_RW, .readfn = l2ctlr_read, | ||
163 | - .writefn = arm_cp_write_ignore }, | ||
164 | - { .name = "L2CTLR", | ||
165 | - .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2, | ||
166 | - .access = PL1_RW, .readfn = l2ctlr_read, | ||
167 | - .writefn = arm_cp_write_ignore }, | ||
168 | - { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
169 | - .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3, | ||
170 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
171 | - { .name = "L2ECTLR", | ||
172 | - .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3, | ||
173 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
174 | - { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH, | ||
175 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0, | ||
176 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
177 | - { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
178 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0, | ||
179 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
180 | - { .name = "CPUACTLR", | ||
181 | - .cp = 15, .opc1 = 0, .crm = 15, | ||
182 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
183 | - { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
184 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1, | ||
185 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
186 | - { .name = "CPUECTLR", | ||
187 | - .cp = 15, .opc1 = 1, .crm = 15, | ||
188 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
189 | - { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
190 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2, | ||
191 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
192 | - { .name = "CPUMERRSR", | ||
193 | - .cp = 15, .opc1 = 2, .crm = 15, | ||
194 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
195 | - { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64, | ||
196 | - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3, | ||
197 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
198 | - { .name = "L2MERRSR", | ||
199 | - .cp = 15, .opc1 = 3, .crm = 15, | ||
200 | - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, | ||
201 | -}; | ||
202 | - | ||
203 | -void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) | ||
204 | -{ | ||
205 | - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
206 | -} | ||
207 | -#endif /* !CONFIG_USER_ONLY */ | ||
208 | - | ||
209 | /* CPU models. These are not needed for the AArch64 linux-user build. */ | ||
210 | #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) | ||
211 | |||
212 | diff --git a/target/arm/meson.build b/target/arm/meson.build | ||
213 | index XXXXXXX..XXXXXXX 100644 | ||
214 | --- a/target/arm/meson.build | ||
215 | +++ b/target/arm/meson.build | ||
216 | @@ -XXX,XX +XXX,XX @@ arm_softmmu_ss.add(files( | ||
217 | 'arch_dump.c', | ||
218 | 'arm-powerctl.c', | ||
219 | 'arm-qmp-cmds.c', | ||
220 | + 'cortex-regs.c', | ||
221 | 'machine.c', | ||
222 | 'ptw.c', | ||
223 | )) | ||
86 | -- | 224 | -- |
87 | 2.25.1 | 225 | 2.34.1 |
88 | 226 | ||
89 | 227 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | The sve-max-vq property has been removed from the -cpu max used with |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | KVM, so code under kvm_enabled in cpu_max_set_sve_max_vq is not |
5 | reachable. | ||
6 | |||
7 | Fixes: 0baa21be49 ("target/arm: Make KVM -cpu max exactly like -cpu host") | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
11 | Message-id: 20230426180013.14814-3-farosas@suse.de | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 13 | --- |
7 | target/arm/translate.c | 16 ++++++++-------- | 14 | target/arm/cpu64.c | 6 ------ |
8 | 1 file changed, 8 insertions(+), 8 deletions(-) | 15 | 1 file changed, 6 deletions(-) |
9 | 16 | ||
10 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 17 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
11 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/translate.c | 19 | --- a/target/arm/cpu64.c |
13 | +++ b/target/arm/translate.c | 20 | +++ b/target/arm/cpu64.c |
14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 21 | @@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, |
15 | { | ||
16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
17 | CPUARMState *env = cpu->env_ptr; | ||
18 | + uint32_t pc = dc->base.pc_next; | ||
19 | uint32_t insn; | ||
20 | bool is_16bit; | ||
21 | |||
22 | if (arm_pre_translate_insn(dc)) { | ||
23 | - dc->base.pc_next += 2; | ||
24 | + dc->base.pc_next = pc + 2; | ||
25 | return; | 22 | return; |
26 | } | 23 | } |
27 | 24 | ||
28 | - dc->pc_curr = dc->base.pc_next; | 25 | - if (kvm_enabled() && !kvm_arm_sve_supported()) { |
29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | 26 | - error_setg(errp, "cannot set sve-max-vq"); |
30 | + dc->pc_curr = pc; | 27 | - error_append_hint(errp, "SVE not supported by KVM on this host\n"); |
31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | 28 | - return; |
32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | 29 | - } |
33 | - dc->base.pc_next += 2; | ||
34 | + pc += 2; | ||
35 | if (!is_16bit) { | ||
36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, | ||
37 | - dc->sctlr_b); | ||
38 | - | 30 | - |
39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | 31 | if (max_vq == 0 || max_vq > ARM_MAX_VQ) { |
40 | insn = insn << 16 | insn2; | 32 | error_setg(errp, "unsupported SVE vector length"); |
41 | - dc->base.pc_next += 2; | 33 | error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n", |
42 | + pc += 2; | ||
43 | } | ||
44 | + dc->base.pc_next = pc; | ||
45 | dc->insn = insn; | ||
46 | |||
47 | if (dc->pstate_il) { | ||
48 | -- | 34 | -- |
49 | 2.25.1 | 35 | 2.34.1 |
50 | 36 | ||
51 | 37 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Both single-step and pc alignment faults have priority over | 3 | Introduce aarch64_max_tcg_initfn that contains the TCG-only part of |
4 | breakpoint exceptions. | 4 | -cpu max configuration. We'll need that to be able to restrict this |
5 | code to a TCG-only config in the next patches. | ||
5 | 6 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
10 | Message-id: 20230426180013.14814-4-farosas@suse.de | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 12 | --- |
10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ | 13 | target/arm/cpu64.c | 32 ++++++++++++++++++-------------- |
11 | 1 file changed, 23 insertions(+) | 14 | 1 file changed, 18 insertions(+), 14 deletions(-) |
12 | 15 | ||
13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c | 16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/debug_helper.c | 18 | --- a/target/arm/cpu64.c |
16 | +++ b/target/arm/debug_helper.c | 19 | +++ b/target/arm/cpu64.c |
17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | 20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj) |
21 | #endif | ||
22 | } | ||
23 | |||
24 | -/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); | ||
25 | - * otherwise, a CPU with as many features enabled as our emulation supports. | ||
26 | - * The version of '-cpu max' for qemu-system-arm is defined in cpu.c; | ||
27 | +/* | ||
28 | + * -cpu max: a CPU with as many features enabled as our emulation supports. | ||
29 | + * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c; | ||
30 | * this only needs to handle 64 bits. | ||
31 | */ | ||
32 | -static void aarch64_max_initfn(Object *obj) | ||
33 | +static void aarch64_max_tcg_initfn(Object *obj) | ||
18 | { | 34 | { |
19 | ARMCPU *cpu = ARM_CPU(cs); | 35 | ARMCPU *cpu = ARM_CPU(obj); |
20 | CPUARMState *env = &cpu->env; | 36 | uint64_t t; |
21 | + target_ulong pc; | 37 | uint32_t u; |
22 | int n; | 38 | |
23 | 39 | - if (kvm_enabled() || hvf_enabled()) { | |
40 | - /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ | ||
41 | - aarch64_host_initfn(obj); | ||
42 | - return; | ||
43 | - } | ||
44 | - | ||
45 | - /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ | ||
46 | - | ||
47 | - aarch64_a57_initfn(obj); | ||
48 | - | ||
24 | /* | 49 | /* |
25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | 50 | * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real |
26 | return false; | 51 | * one and try to apply errata workarounds or use impdef features we |
27 | } | 52 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
28 | 53 | qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); | |
29 | + /* | 54 | } |
30 | + * Single-step exceptions have priority over breakpoint exceptions. | 55 | |
31 | + * If single-step state is active-pending, suppress the bp. | 56 | +static void aarch64_max_initfn(Object *obj) |
32 | + */ | 57 | +{ |
33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { | 58 | + if (kvm_enabled() || hvf_enabled()) { |
34 | + return false; | 59 | + /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ |
60 | + aarch64_host_initfn(obj); | ||
61 | + return; | ||
35 | + } | 62 | + } |
36 | + | 63 | + |
37 | + /* | 64 | + /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ |
38 | + * PC alignment faults have priority over breakpoint exceptions. | ||
39 | + */ | ||
40 | + pc = is_a64(env) ? env->pc : env->regs[15]; | ||
41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { | ||
42 | + return false; | ||
43 | + } | ||
44 | + | 65 | + |
45 | + /* | 66 | + aarch64_a57_initfn(obj); |
46 | + * Instruction aborts have priority over breakpoint exceptions. | 67 | + aarch64_max_tcg_initfn(obj); |
47 | + * TODO: We would need to look up the page for PC and verify that | 68 | +} |
48 | + * it is present and executable. | ||
49 | + */ | ||
50 | + | 69 | + |
51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { | 70 | static const ARMCPUInfo aarch64_cpus[] = { |
52 | if (bp_wp_matches(cpu, n, false)) { | 71 | { .name = "cortex-a35", .initfn = aarch64_a35_initfn }, |
53 | return true; | 72 | { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, |
54 | -- | 73 | -- |
55 | 2.25.1 | 74 | 2.34.1 |
56 | 75 | ||
57 | 76 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | We're about to move the TCG-only -cpu max configuration code under |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | CONFIG_TCG. To be able to do that we need to make sure the qtests |
5 | still have some cpu configured even when no other accelerator is | ||
6 | available. | ||
7 | |||
8 | Delineate now what is used with TCG-only and what is also used with | ||
9 | qtests to make the subsequent patches cleaner. | ||
10 | |||
11 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Message-id: 20230426180013.14814-5-farosas@suse.de | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 16 | --- |
7 | target/arm/translate.c | 9 +++++---- | 17 | target/arm/cpu64.c | 12 +++++++++--- |
8 | 1 file changed, 5 insertions(+), 4 deletions(-) | 18 | 1 file changed, 9 insertions(+), 3 deletions(-) |
9 | 19 | ||
10 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
11 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/translate.c | 22 | --- a/target/arm/cpu64.c |
13 | +++ b/target/arm/translate.c | 23 | +++ b/target/arm/cpu64.c |
14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 24 | @@ -XXX,XX +XXX,XX @@ |
15 | { | 25 | #include "qemu/module.h" |
16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | 26 | #include "sysemu/kvm.h" |
17 | CPUARMState *env = cpu->env_ptr; | 27 | #include "sysemu/hvf.h" |
18 | + uint32_t pc = dc->base.pc_next; | 28 | +#include "sysemu/qtest.h" |
19 | unsigned int insn; | 29 | +#include "sysemu/tcg.h" |
20 | 30 | #include "kvm_arm.h" | |
21 | if (arm_pre_translate_insn(dc)) { | 31 | #include "hvf_arm.h" |
22 | - dc->base.pc_next += 4; | 32 | #include "qapi/visitor.h" |
23 | + dc->base.pc_next = pc + 4; | 33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
24 | return; | 34 | return; |
25 | } | 35 | } |
26 | 36 | ||
27 | - dc->pc_curr = dc->base.pc_next; | 37 | - /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ |
28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | 38 | + if (tcg_enabled() || qtest_enabled()) { |
29 | + dc->pc_curr = pc; | 39 | + aarch64_a57_initfn(obj); |
30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); | 40 | + } |
31 | dc->insn = insn; | 41 | |
32 | - dc->base.pc_next += 4; | 42 | - aarch64_a57_initfn(obj); |
33 | + dc->base.pc_next = pc + 4; | 43 | - aarch64_max_tcg_initfn(obj); |
34 | disas_arm_insn(dc, insn); | 44 | + /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ |
35 | 45 | + if (tcg_enabled()) { | |
36 | arm_post_translate_insn(dc); | 46 | + aarch64_max_tcg_initfn(obj); |
47 | + } | ||
48 | } | ||
49 | |||
50 | static const ARMCPUInfo aarch64_cpus[] = { | ||
37 | -- | 51 | -- |
38 | 2.25.1 | 52 | 2.34.1 |
39 | 53 | ||
40 | 54 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | To propagate errors to the caller of the pre_plug callback, use the | 3 | Move the 64-bit CPUs that are TCG-only: |
4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() | 4 | - cortex-a35 |
5 | helpers. | 5 | - cortex-a55 |
6 | - cortex-a72 | ||
7 | - cortex-a76 | ||
8 | - a64fx | ||
9 | - neoverse-n1 | ||
6 | 10 | ||
7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> | 11 | Keep the CPUs that can be used with KVM: |
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 12 | - cortex-a57 |
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 13 | - cortex-a53 |
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 14 | - max |
11 | Message-id: 20211210170415.583179-5-jean-philippe@linaro.org | 15 | - host |
16 | |||
17 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
20 | Message-id: 20230426180013.14814-6-farosas@suse.de | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 22 | --- |
14 | hw/arm/virt.c | 5 +++-- | 23 | target/arm/internals.h | 4 + |
15 | 1 file changed, 3 insertions(+), 2 deletions(-) | 24 | hw/arm/virt.c | 6 +- |
25 | target/arm/cpu64.c | 687 +----------------------------- | ||
26 | target/arm/{ => tcg}/cpu64.c | 782 +---------------------------------- | ||
27 | target/arm/tcg/meson.build | 1 + | ||
28 | 5 files changed, 14 insertions(+), 1466 deletions(-) | ||
29 | copy target/arm/{ => tcg}/cpu64.c (51%) | ||
16 | 30 | ||
31 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/target/arm/internals.h | ||
34 | +++ b/target/arm/internals.h | ||
35 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); | ||
36 | void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp); | ||
37 | void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); | ||
38 | void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); | ||
39 | +void aarch64_max_tcg_initfn(Object *obj); | ||
40 | +void aarch64_add_pauth_properties(Object *obj); | ||
41 | +void aarch64_add_sve_properties(Object *obj); | ||
42 | +void aarch64_add_sme_properties(Object *obj); | ||
43 | #endif | ||
44 | |||
45 | /* Read the CONTROL register as the MRS instruction would. */ | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 46 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
18 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 48 | --- a/hw/arm/virt.c |
20 | +++ b/hw/arm/virt.c | 49 | +++ b/hw/arm/virt.c |
21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, | 50 | @@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = { |
22 | db_start, db_end, | 51 | ARM_CPU_TYPE_NAME("cortex-a7"), |
23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); | 52 | #endif |
24 | 53 | ARM_CPU_TYPE_NAME("cortex-a15"), | |
25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); | 54 | +#ifdef CONFIG_TCG |
26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); | 55 | ARM_CPU_TYPE_NAME("cortex-a35"), |
27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); | 56 | - ARM_CPU_TYPE_NAME("cortex-a53"), |
28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", | 57 | ARM_CPU_TYPE_NAME("cortex-a55"), |
29 | + resv_prop_str, errp); | 58 | - ARM_CPU_TYPE_NAME("cortex-a57"), |
30 | g_free(resv_prop_str); | 59 | ARM_CPU_TYPE_NAME("cortex-a72"), |
60 | ARM_CPU_TYPE_NAME("cortex-a76"), | ||
61 | ARM_CPU_TYPE_NAME("a64fx"), | ||
62 | ARM_CPU_TYPE_NAME("neoverse-n1"), | ||
63 | +#endif | ||
64 | + ARM_CPU_TYPE_NAME("cortex-a53"), | ||
65 | + ARM_CPU_TYPE_NAME("cortex-a57"), | ||
66 | ARM_CPU_TYPE_NAME("host"), | ||
67 | ARM_CPU_TYPE_NAME("max"), | ||
68 | }; | ||
69 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/target/arm/cpu64.c | ||
72 | +++ b/target/arm/cpu64.c | ||
73 | @@ -XXX,XX +XXX,XX @@ | ||
74 | #include "internals.h" | ||
75 | #include "cpregs.h" | ||
76 | |||
77 | -static void aarch64_a35_initfn(Object *obj) | ||
78 | -{ | ||
79 | - ARMCPU *cpu = ARM_CPU(obj); | ||
80 | - | ||
81 | - cpu->dtb_compatible = "arm,cortex-a35"; | ||
82 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
83 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
84 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
85 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
86 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
87 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
88 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
89 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
90 | - | ||
91 | - /* From B2.2 AArch64 identification registers. */ | ||
92 | - cpu->midr = 0x411fd040; | ||
93 | - cpu->revidr = 0; | ||
94 | - cpu->ctr = 0x84448004; | ||
95 | - cpu->isar.id_pfr0 = 0x00000131; | ||
96 | - cpu->isar.id_pfr1 = 0x00011011; | ||
97 | - cpu->isar.id_dfr0 = 0x03010066; | ||
98 | - cpu->id_afr0 = 0; | ||
99 | - cpu->isar.id_mmfr0 = 0x10201105; | ||
100 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
101 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
102 | - cpu->isar.id_mmfr3 = 0x02102211; | ||
103 | - cpu->isar.id_isar0 = 0x02101110; | ||
104 | - cpu->isar.id_isar1 = 0x13112111; | ||
105 | - cpu->isar.id_isar2 = 0x21232042; | ||
106 | - cpu->isar.id_isar3 = 0x01112131; | ||
107 | - cpu->isar.id_isar4 = 0x00011142; | ||
108 | - cpu->isar.id_isar5 = 0x00011121; | ||
109 | - cpu->isar.id_aa64pfr0 = 0x00002222; | ||
110 | - cpu->isar.id_aa64pfr1 = 0; | ||
111 | - cpu->isar.id_aa64dfr0 = 0x10305106; | ||
112 | - cpu->isar.id_aa64dfr1 = 0; | ||
113 | - cpu->isar.id_aa64isar0 = 0x00011120; | ||
114 | - cpu->isar.id_aa64isar1 = 0; | ||
115 | - cpu->isar.id_aa64mmfr0 = 0x00101122; | ||
116 | - cpu->isar.id_aa64mmfr1 = 0; | ||
117 | - cpu->clidr = 0x0a200023; | ||
118 | - cpu->dcz_blocksize = 4; | ||
119 | - | ||
120 | - /* From B2.4 AArch64 Virtual Memory control registers */ | ||
121 | - cpu->reset_sctlr = 0x00c50838; | ||
122 | - | ||
123 | - /* From B2.10 AArch64 performance monitor registers */ | ||
124 | - cpu->isar.reset_pmcr_el0 = 0x410a3000; | ||
125 | - | ||
126 | - /* From B2.29 Cache ID registers */ | ||
127 | - cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */ | ||
128 | - cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */ | ||
129 | - cpu->ccsidr[2] = 0x703fe03a; /* 512KB L2 cache */ | ||
130 | - | ||
131 | - /* From B3.5 VGIC Type register */ | ||
132 | - cpu->gic_num_lrs = 4; | ||
133 | - cpu->gic_vpribits = 5; | ||
134 | - cpu->gic_vprebits = 5; | ||
135 | - cpu->gic_pribits = 5; | ||
136 | - | ||
137 | - /* From C6.4 Debug ID Register */ | ||
138 | - cpu->isar.dbgdidr = 0x3516d000; | ||
139 | - /* From C6.5 Debug Device ID Register */ | ||
140 | - cpu->isar.dbgdevid = 0x00110f13; | ||
141 | - /* From C6.6 Debug Device ID Register 1 */ | ||
142 | - cpu->isar.dbgdevid1 = 0x2; | ||
143 | - | ||
144 | - /* From Cortex-A35 SIMD and Floating-point Support r1p0 */ | ||
145 | - /* From 3.2 AArch32 register summary */ | ||
146 | - cpu->reset_fpsid = 0x41034043; | ||
147 | - | ||
148 | - /* From 2.2 AArch64 register summary */ | ||
149 | - cpu->isar.mvfr0 = 0x10110222; | ||
150 | - cpu->isar.mvfr1 = 0x12111111; | ||
151 | - cpu->isar.mvfr2 = 0x00000043; | ||
152 | - | ||
153 | - /* These values are the same with A53/A57/A72. */ | ||
154 | - define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
155 | -} | ||
156 | - | ||
157 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
158 | { | ||
159 | /* | ||
160 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
161 | cpu->sve_vq.map = vq_map; | ||
162 | } | ||
163 | |||
164 | -static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name, | ||
165 | - void *opaque, Error **errp) | ||
166 | -{ | ||
167 | - ARMCPU *cpu = ARM_CPU(obj); | ||
168 | - uint32_t value; | ||
169 | - | ||
170 | - /* All vector lengths are disabled when SVE is off. */ | ||
171 | - if (!cpu_isar_feature(aa64_sve, cpu)) { | ||
172 | - value = 0; | ||
173 | - } else { | ||
174 | - value = cpu->sve_max_vq; | ||
175 | - } | ||
176 | - visit_type_uint32(v, name, &value, errp); | ||
177 | -} | ||
178 | - | ||
179 | -static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, | ||
180 | - void *opaque, Error **errp) | ||
181 | -{ | ||
182 | - ARMCPU *cpu = ARM_CPU(obj); | ||
183 | - uint32_t max_vq; | ||
184 | - | ||
185 | - if (!visit_type_uint32(v, name, &max_vq, errp)) { | ||
186 | - return; | ||
187 | - } | ||
188 | - | ||
189 | - if (max_vq == 0 || max_vq > ARM_MAX_VQ) { | ||
190 | - error_setg(errp, "unsupported SVE vector length"); | ||
191 | - error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n", | ||
192 | - ARM_MAX_VQ); | ||
193 | - return; | ||
194 | - } | ||
195 | - | ||
196 | - cpu->sve_max_vq = max_vq; | ||
197 | -} | ||
198 | - | ||
199 | /* | ||
200 | * Note that cpu_arm_{get,set}_vq cannot use the simpler | ||
201 | * object_property_add_bool interface because they make use of the | ||
202 | @@ -XXX,XX +XXX,XX @@ static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v, | ||
203 | } | ||
204 | #endif | ||
205 | |||
206 | -static void aarch64_add_sve_properties(Object *obj) | ||
207 | +void aarch64_add_sve_properties(Object *obj) | ||
208 | { | ||
209 | ARMCPU *cpu = ARM_CPU(obj); | ||
210 | uint32_t vq; | ||
211 | @@ -XXX,XX +XXX,XX @@ static void aarch64_add_sve_properties(Object *obj) | ||
212 | #endif | ||
213 | } | ||
214 | |||
215 | -static void aarch64_add_sme_properties(Object *obj) | ||
216 | +void aarch64_add_sme_properties(Object *obj) | ||
217 | { | ||
218 | ARMCPU *cpu = ARM_CPU(obj); | ||
219 | uint32_t vq; | ||
220 | @@ -XXX,XX +XXX,XX @@ static Property arm_cpu_pauth_property = | ||
221 | static Property arm_cpu_pauth_impdef_property = | ||
222 | DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false); | ||
223 | |||
224 | -static void aarch64_add_pauth_properties(Object *obj) | ||
225 | +void aarch64_add_pauth_properties(Object *obj) | ||
226 | { | ||
227 | ARMCPU *cpu = ARM_CPU(obj); | ||
228 | |||
229 | @@ -XXX,XX +XXX,XX @@ static void aarch64_add_pauth_properties(Object *obj) | ||
31 | } | 230 | } |
32 | } | 231 | } |
232 | |||
233 | -static Property arm_cpu_lpa2_property = | ||
234 | - DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true); | ||
235 | - | ||
236 | void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) | ||
237 | { | ||
238 | uint64_t t; | ||
239 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) | ||
240 | define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
241 | } | ||
242 | |||
243 | -static void aarch64_a55_initfn(Object *obj) | ||
244 | -{ | ||
245 | - ARMCPU *cpu = ARM_CPU(obj); | ||
246 | - | ||
247 | - cpu->dtb_compatible = "arm,cortex-a55"; | ||
248 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
249 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
250 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
251 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
252 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
253 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
254 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
255 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
256 | - | ||
257 | - /* Ordered by B2.4 AArch64 registers by functional group */ | ||
258 | - cpu->clidr = 0x82000023; | ||
259 | - cpu->ctr = 0x84448004; /* L1Ip = VIPT */ | ||
260 | - cpu->dcz_blocksize = 4; /* 64 bytes */ | ||
261 | - cpu->isar.id_aa64dfr0 = 0x0000000010305408ull; | ||
262 | - cpu->isar.id_aa64isar0 = 0x0000100010211120ull; | ||
263 | - cpu->isar.id_aa64isar1 = 0x0000000000100001ull; | ||
264 | - cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull; | ||
265 | - cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
266 | - cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; | ||
267 | - cpu->isar.id_aa64pfr0 = 0x0000000010112222ull; | ||
268 | - cpu->isar.id_aa64pfr1 = 0x0000000000000010ull; | ||
269 | - cpu->id_afr0 = 0x00000000; | ||
270 | - cpu->isar.id_dfr0 = 0x04010088; | ||
271 | - cpu->isar.id_isar0 = 0x02101110; | ||
272 | - cpu->isar.id_isar1 = 0x13112111; | ||
273 | - cpu->isar.id_isar2 = 0x21232042; | ||
274 | - cpu->isar.id_isar3 = 0x01112131; | ||
275 | - cpu->isar.id_isar4 = 0x00011142; | ||
276 | - cpu->isar.id_isar5 = 0x01011121; | ||
277 | - cpu->isar.id_isar6 = 0x00000010; | ||
278 | - cpu->isar.id_mmfr0 = 0x10201105; | ||
279 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
280 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
281 | - cpu->isar.id_mmfr3 = 0x02122211; | ||
282 | - cpu->isar.id_mmfr4 = 0x00021110; | ||
283 | - cpu->isar.id_pfr0 = 0x10010131; | ||
284 | - cpu->isar.id_pfr1 = 0x00011011; | ||
285 | - cpu->isar.id_pfr2 = 0x00000011; | ||
286 | - cpu->midr = 0x412FD050; /* r2p0 */ | ||
287 | - cpu->revidr = 0; | ||
288 | - | ||
289 | - /* From B2.23 CCSIDR_EL1 */ | ||
290 | - cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */ | ||
291 | - cpu->ccsidr[1] = 0x200fe01a; /* 32KB L1 icache */ | ||
292 | - cpu->ccsidr[2] = 0x703fe07a; /* 512KB L2 cache */ | ||
293 | - | ||
294 | - /* From B2.96 SCTLR_EL3 */ | ||
295 | - cpu->reset_sctlr = 0x30c50838; | ||
296 | - | ||
297 | - /* From B4.45 ICH_VTR_EL2 */ | ||
298 | - cpu->gic_num_lrs = 4; | ||
299 | - cpu->gic_vpribits = 5; | ||
300 | - cpu->gic_vprebits = 5; | ||
301 | - cpu->gic_pribits = 5; | ||
302 | - | ||
303 | - cpu->isar.mvfr0 = 0x10110222; | ||
304 | - cpu->isar.mvfr1 = 0x13211111; | ||
305 | - cpu->isar.mvfr2 = 0x00000043; | ||
306 | - | ||
307 | - /* From D5.4 AArch64 PMU register summary */ | ||
308 | - cpu->isar.reset_pmcr_el0 = 0x410b3000; | ||
309 | -} | ||
310 | - | ||
311 | -static void aarch64_a72_initfn(Object *obj) | ||
312 | -{ | ||
313 | - ARMCPU *cpu = ARM_CPU(obj); | ||
314 | - | ||
315 | - cpu->dtb_compatible = "arm,cortex-a72"; | ||
316 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
317 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
318 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
319 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
320 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
321 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
322 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
323 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
324 | - cpu->midr = 0x410fd083; | ||
325 | - cpu->revidr = 0x00000000; | ||
326 | - cpu->reset_fpsid = 0x41034080; | ||
327 | - cpu->isar.mvfr0 = 0x10110222; | ||
328 | - cpu->isar.mvfr1 = 0x12111111; | ||
329 | - cpu->isar.mvfr2 = 0x00000043; | ||
330 | - cpu->ctr = 0x8444c004; | ||
331 | - cpu->reset_sctlr = 0x00c50838; | ||
332 | - cpu->isar.id_pfr0 = 0x00000131; | ||
333 | - cpu->isar.id_pfr1 = 0x00011011; | ||
334 | - cpu->isar.id_dfr0 = 0x03010066; | ||
335 | - cpu->id_afr0 = 0x00000000; | ||
336 | - cpu->isar.id_mmfr0 = 0x10201105; | ||
337 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
338 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
339 | - cpu->isar.id_mmfr3 = 0x02102211; | ||
340 | - cpu->isar.id_isar0 = 0x02101110; | ||
341 | - cpu->isar.id_isar1 = 0x13112111; | ||
342 | - cpu->isar.id_isar2 = 0x21232042; | ||
343 | - cpu->isar.id_isar3 = 0x01112131; | ||
344 | - cpu->isar.id_isar4 = 0x00011142; | ||
345 | - cpu->isar.id_isar5 = 0x00011121; | ||
346 | - cpu->isar.id_aa64pfr0 = 0x00002222; | ||
347 | - cpu->isar.id_aa64dfr0 = 0x10305106; | ||
348 | - cpu->isar.id_aa64isar0 = 0x00011120; | ||
349 | - cpu->isar.id_aa64mmfr0 = 0x00001124; | ||
350 | - cpu->isar.dbgdidr = 0x3516d000; | ||
351 | - cpu->isar.dbgdevid = 0x01110f13; | ||
352 | - cpu->isar.dbgdevid1 = 0x2; | ||
353 | - cpu->isar.reset_pmcr_el0 = 0x41023000; | ||
354 | - cpu->clidr = 0x0a200023; | ||
355 | - cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ | ||
356 | - cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */ | ||
357 | - cpu->ccsidr[2] = 0x707fe07a; /* 1MB L2 cache */ | ||
358 | - cpu->dcz_blocksize = 4; /* 64 bytes */ | ||
359 | - cpu->gic_num_lrs = 4; | ||
360 | - cpu->gic_vpribits = 5; | ||
361 | - cpu->gic_vprebits = 5; | ||
362 | - cpu->gic_pribits = 5; | ||
363 | - define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
364 | -} | ||
365 | - | ||
366 | -static void aarch64_a76_initfn(Object *obj) | ||
367 | -{ | ||
368 | - ARMCPU *cpu = ARM_CPU(obj); | ||
369 | - | ||
370 | - cpu->dtb_compatible = "arm,cortex-a76"; | ||
371 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
372 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
373 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
374 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
375 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
376 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
377 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
378 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
379 | - | ||
380 | - /* Ordered by B2.4 AArch64 registers by functional group */ | ||
381 | - cpu->clidr = 0x82000023; | ||
382 | - cpu->ctr = 0x8444C004; | ||
383 | - cpu->dcz_blocksize = 4; | ||
384 | - cpu->isar.id_aa64dfr0 = 0x0000000010305408ull; | ||
385 | - cpu->isar.id_aa64isar0 = 0x0000100010211120ull; | ||
386 | - cpu->isar.id_aa64isar1 = 0x0000000000100001ull; | ||
387 | - cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull; | ||
388 | - cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
389 | - cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; | ||
390 | - cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */ | ||
391 | - cpu->isar.id_aa64pfr1 = 0x0000000000000010ull; | ||
392 | - cpu->id_afr0 = 0x00000000; | ||
393 | - cpu->isar.id_dfr0 = 0x04010088; | ||
394 | - cpu->isar.id_isar0 = 0x02101110; | ||
395 | - cpu->isar.id_isar1 = 0x13112111; | ||
396 | - cpu->isar.id_isar2 = 0x21232042; | ||
397 | - cpu->isar.id_isar3 = 0x01112131; | ||
398 | - cpu->isar.id_isar4 = 0x00010142; | ||
399 | - cpu->isar.id_isar5 = 0x01011121; | ||
400 | - cpu->isar.id_isar6 = 0x00000010; | ||
401 | - cpu->isar.id_mmfr0 = 0x10201105; | ||
402 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
403 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
404 | - cpu->isar.id_mmfr3 = 0x02122211; | ||
405 | - cpu->isar.id_mmfr4 = 0x00021110; | ||
406 | - cpu->isar.id_pfr0 = 0x10010131; | ||
407 | - cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ | ||
408 | - cpu->isar.id_pfr2 = 0x00000011; | ||
409 | - cpu->midr = 0x414fd0b1; /* r4p1 */ | ||
410 | - cpu->revidr = 0; | ||
411 | - | ||
412 | - /* From B2.18 CCSIDR_EL1 */ | ||
413 | - cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */ | ||
414 | - cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */ | ||
415 | - cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */ | ||
416 | - | ||
417 | - /* From B2.93 SCTLR_EL3 */ | ||
418 | - cpu->reset_sctlr = 0x30c50838; | ||
419 | - | ||
420 | - /* From B4.23 ICH_VTR_EL2 */ | ||
421 | - cpu->gic_num_lrs = 4; | ||
422 | - cpu->gic_vpribits = 5; | ||
423 | - cpu->gic_vprebits = 5; | ||
424 | - cpu->gic_pribits = 5; | ||
425 | - | ||
426 | - /* From B5.1 AdvSIMD AArch64 register summary */ | ||
427 | - cpu->isar.mvfr0 = 0x10110222; | ||
428 | - cpu->isar.mvfr1 = 0x13211111; | ||
429 | - cpu->isar.mvfr2 = 0x00000043; | ||
430 | - | ||
431 | - /* From D5.1 AArch64 PMU register summary */ | ||
432 | - cpu->isar.reset_pmcr_el0 = 0x410b3000; | ||
433 | -} | ||
434 | - | ||
435 | -static void aarch64_a64fx_initfn(Object *obj) | ||
436 | -{ | ||
437 | - ARMCPU *cpu = ARM_CPU(obj); | ||
438 | - | ||
439 | - cpu->dtb_compatible = "arm,a64fx"; | ||
440 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
441 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
442 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
443 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
444 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
445 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
446 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
447 | - cpu->midr = 0x461f0010; | ||
448 | - cpu->revidr = 0x00000000; | ||
449 | - cpu->ctr = 0x86668006; | ||
450 | - cpu->reset_sctlr = 0x30000180; | ||
451 | - cpu->isar.id_aa64pfr0 = 0x0000000101111111; /* No RAS Extensions */ | ||
452 | - cpu->isar.id_aa64pfr1 = 0x0000000000000000; | ||
453 | - cpu->isar.id_aa64dfr0 = 0x0000000010305408; | ||
454 | - cpu->isar.id_aa64dfr1 = 0x0000000000000000; | ||
455 | - cpu->id_aa64afr0 = 0x0000000000000000; | ||
456 | - cpu->id_aa64afr1 = 0x0000000000000000; | ||
457 | - cpu->isar.id_aa64mmfr0 = 0x0000000000001122; | ||
458 | - cpu->isar.id_aa64mmfr1 = 0x0000000011212100; | ||
459 | - cpu->isar.id_aa64mmfr2 = 0x0000000000001011; | ||
460 | - cpu->isar.id_aa64isar0 = 0x0000000010211120; | ||
461 | - cpu->isar.id_aa64isar1 = 0x0000000000010001; | ||
462 | - cpu->isar.id_aa64zfr0 = 0x0000000000000000; | ||
463 | - cpu->clidr = 0x0000000080000023; | ||
464 | - cpu->ccsidr[0] = 0x7007e01c; /* 64KB L1 dcache */ | ||
465 | - cpu->ccsidr[1] = 0x2007e01c; /* 64KB L1 icache */ | ||
466 | - cpu->ccsidr[2] = 0x70ffe07c; /* 8MB L2 cache */ | ||
467 | - cpu->dcz_blocksize = 6; /* 256 bytes */ | ||
468 | - cpu->gic_num_lrs = 4; | ||
469 | - cpu->gic_vpribits = 5; | ||
470 | - cpu->gic_vprebits = 5; | ||
471 | - cpu->gic_pribits = 5; | ||
472 | - | ||
473 | - /* The A64FX supports only 128, 256 and 512 bit vector lengths */ | ||
474 | - aarch64_add_sve_properties(obj); | ||
475 | - cpu->sve_vq.supported = (1 << 0) /* 128bit */ | ||
476 | - | (1 << 1) /* 256bit */ | ||
477 | - | (1 << 3); /* 512bit */ | ||
478 | - | ||
479 | - cpu->isar.reset_pmcr_el0 = 0x46014040; | ||
480 | - | ||
481 | - /* TODO: Add A64FX specific HPC extension registers */ | ||
482 | -} | ||
483 | - | ||
484 | -static const ARMCPRegInfo neoverse_n1_cp_reginfo[] = { | ||
485 | - { .name = "ATCR_EL1", .state = ARM_CP_STATE_AA64, | ||
486 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 7, .opc2 = 0, | ||
487 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
488 | - { .name = "ATCR_EL2", .state = ARM_CP_STATE_AA64, | ||
489 | - .opc0 = 3, .opc1 = 4, .crn = 15, .crm = 7, .opc2 = 0, | ||
490 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
491 | - { .name = "ATCR_EL3", .state = ARM_CP_STATE_AA64, | ||
492 | - .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 7, .opc2 = 0, | ||
493 | - .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
494 | - { .name = "ATCR_EL12", .state = ARM_CP_STATE_AA64, | ||
495 | - .opc0 = 3, .opc1 = 5, .crn = 15, .crm = 7, .opc2 = 0, | ||
496 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
497 | - { .name = "AVTCR_EL2", .state = ARM_CP_STATE_AA64, | ||
498 | - .opc0 = 3, .opc1 = 4, .crn = 15, .crm = 7, .opc2 = 1, | ||
499 | - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
500 | - { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
501 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 0, | ||
502 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
503 | - { .name = "CPUACTLR2_EL1", .state = ARM_CP_STATE_AA64, | ||
504 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 1, | ||
505 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
506 | - { .name = "CPUACTLR3_EL1", .state = ARM_CP_STATE_AA64, | ||
507 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 2, | ||
508 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
509 | - /* | ||
510 | - * Report CPUCFR_EL1.SCU as 1, as we do not implement the DSU | ||
511 | - * (and in particular its system registers). | ||
512 | - */ | ||
513 | - { .name = "CPUCFR_EL1", .state = ARM_CP_STATE_AA64, | ||
514 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 0, | ||
515 | - .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 4 }, | ||
516 | - { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
517 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 1, .opc2 = 4, | ||
518 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0x961563010 }, | ||
519 | - { .name = "CPUPCR_EL3", .state = ARM_CP_STATE_AA64, | ||
520 | - .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 1, | ||
521 | - .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
522 | - { .name = "CPUPMR_EL3", .state = ARM_CP_STATE_AA64, | ||
523 | - .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 3, | ||
524 | - .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
525 | - { .name = "CPUPOR_EL3", .state = ARM_CP_STATE_AA64, | ||
526 | - .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 2, | ||
527 | - .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
528 | - { .name = "CPUPSELR_EL3", .state = ARM_CP_STATE_AA64, | ||
529 | - .opc0 = 3, .opc1 = 6, .crn = 15, .crm = 8, .opc2 = 0, | ||
530 | - .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
531 | - { .name = "CPUPWRCTLR_EL1", .state = ARM_CP_STATE_AA64, | ||
532 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 7, | ||
533 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
534 | - { .name = "ERXPFGCDN_EL1", .state = ARM_CP_STATE_AA64, | ||
535 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 2, | ||
536 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
537 | - { .name = "ERXPFGCTL_EL1", .state = ARM_CP_STATE_AA64, | ||
538 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 1, | ||
539 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
540 | - { .name = "ERXPFGF_EL1", .state = ARM_CP_STATE_AA64, | ||
541 | - .opc0 = 3, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 0, | ||
542 | - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
543 | -}; | ||
544 | - | ||
545 | -static void define_neoverse_n1_cp_reginfo(ARMCPU *cpu) | ||
546 | -{ | ||
547 | - define_arm_cp_regs(cpu, neoverse_n1_cp_reginfo); | ||
548 | -} | ||
549 | - | ||
550 | -static void aarch64_neoverse_n1_initfn(Object *obj) | ||
551 | -{ | ||
552 | - ARMCPU *cpu = ARM_CPU(obj); | ||
553 | - | ||
554 | - cpu->dtb_compatible = "arm,neoverse-n1"; | ||
555 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
556 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
557 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
558 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
559 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
560 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
561 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
562 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
563 | - | ||
564 | - /* Ordered by B2.4 AArch64 registers by functional group */ | ||
565 | - cpu->clidr = 0x82000023; | ||
566 | - cpu->ctr = 0x8444c004; | ||
567 | - cpu->dcz_blocksize = 4; | ||
568 | - cpu->isar.id_aa64dfr0 = 0x0000000110305408ull; | ||
569 | - cpu->isar.id_aa64isar0 = 0x0000100010211120ull; | ||
570 | - cpu->isar.id_aa64isar1 = 0x0000000000100001ull; | ||
571 | - cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull; | ||
572 | - cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; | ||
573 | - cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; | ||
574 | - cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */ | ||
575 | - cpu->isar.id_aa64pfr1 = 0x0000000000000020ull; | ||
576 | - cpu->id_afr0 = 0x00000000; | ||
577 | - cpu->isar.id_dfr0 = 0x04010088; | ||
578 | - cpu->isar.id_isar0 = 0x02101110; | ||
579 | - cpu->isar.id_isar1 = 0x13112111; | ||
580 | - cpu->isar.id_isar2 = 0x21232042; | ||
581 | - cpu->isar.id_isar3 = 0x01112131; | ||
582 | - cpu->isar.id_isar4 = 0x00010142; | ||
583 | - cpu->isar.id_isar5 = 0x01011121; | ||
584 | - cpu->isar.id_isar6 = 0x00000010; | ||
585 | - cpu->isar.id_mmfr0 = 0x10201105; | ||
586 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
587 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
588 | - cpu->isar.id_mmfr3 = 0x02122211; | ||
589 | - cpu->isar.id_mmfr4 = 0x00021110; | ||
590 | - cpu->isar.id_pfr0 = 0x10010131; | ||
591 | - cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ | ||
592 | - cpu->isar.id_pfr2 = 0x00000011; | ||
593 | - cpu->midr = 0x414fd0c1; /* r4p1 */ | ||
594 | - cpu->revidr = 0; | ||
595 | - | ||
596 | - /* From B2.23 CCSIDR_EL1 */ | ||
597 | - cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */ | ||
598 | - cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */ | ||
599 | - cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */ | ||
600 | - | ||
601 | - /* From B2.98 SCTLR_EL3 */ | ||
602 | - cpu->reset_sctlr = 0x30c50838; | ||
603 | - | ||
604 | - /* From B4.23 ICH_VTR_EL2 */ | ||
605 | - cpu->gic_num_lrs = 4; | ||
606 | - cpu->gic_vpribits = 5; | ||
607 | - cpu->gic_vprebits = 5; | ||
608 | - cpu->gic_pribits = 5; | ||
609 | - | ||
610 | - /* From B5.1 AdvSIMD AArch64 register summary */ | ||
611 | - cpu->isar.mvfr0 = 0x10110222; | ||
612 | - cpu->isar.mvfr1 = 0x13211111; | ||
613 | - cpu->isar.mvfr2 = 0x00000043; | ||
614 | - | ||
615 | - /* From D5.1 AArch64 PMU register summary */ | ||
616 | - cpu->isar.reset_pmcr_el0 = 0x410c3000; | ||
617 | - | ||
618 | - define_neoverse_n1_cp_reginfo(cpu); | ||
619 | -} | ||
620 | - | ||
621 | static void aarch64_host_initfn(Object *obj) | ||
622 | { | ||
623 | #if defined(CONFIG_KVM) | ||
624 | @@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj) | ||
625 | #endif | ||
626 | } | ||
627 | |||
628 | -/* | ||
629 | - * -cpu max: a CPU with as many features enabled as our emulation supports. | ||
630 | - * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c; | ||
631 | - * this only needs to handle 64 bits. | ||
632 | - */ | ||
633 | -static void aarch64_max_tcg_initfn(Object *obj) | ||
634 | -{ | ||
635 | - ARMCPU *cpu = ARM_CPU(obj); | ||
636 | - uint64_t t; | ||
637 | - uint32_t u; | ||
638 | - | ||
639 | - /* | ||
640 | - * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
641 | - * one and try to apply errata workarounds or use impdef features we | ||
642 | - * don't provide. | ||
643 | - * An IMPLEMENTER field of 0 means "reserved for software use"; | ||
644 | - * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers | ||
645 | - * to see which features are present"; | ||
646 | - * the VARIANT, PARTNUM and REVISION fields are all implementation | ||
647 | - * defined and we choose to define PARTNUM just in case guest | ||
648 | - * code needs to distinguish this QEMU CPU from other software | ||
649 | - * implementations, though this shouldn't be needed. | ||
650 | - */ | ||
651 | - t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0); | ||
652 | - t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); | ||
653 | - t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q'); | ||
654 | - t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0); | ||
655 | - t = FIELD_DP64(t, MIDR_EL1, REVISION, 0); | ||
656 | - cpu->midr = t; | ||
657 | - | ||
658 | - /* | ||
659 | - * We're going to set FEAT_S2FWB, which mandates that CLIDR_EL1.{LoUU,LoUIS} | ||
660 | - * are zero. | ||
661 | - */ | ||
662 | - u = cpu->clidr; | ||
663 | - u = FIELD_DP32(u, CLIDR_EL1, LOUIS, 0); | ||
664 | - u = FIELD_DP32(u, CLIDR_EL1, LOUU, 0); | ||
665 | - cpu->clidr = u; | ||
666 | - | ||
667 | - t = cpu->isar.id_aa64isar0; | ||
668 | - t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* FEAT_PMULL */ | ||
669 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); /* FEAT_SHA1 */ | ||
670 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* FEAT_SHA512 */ | ||
671 | - t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); | ||
672 | - t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); /* FEAT_LSE */ | ||
673 | - t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); /* FEAT_RDM */ | ||
674 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); /* FEAT_SHA3 */ | ||
675 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); /* FEAT_SM3 */ | ||
676 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); /* FEAT_SM4 */ | ||
677 | - t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); /* FEAT_DotProd */ | ||
678 | - t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); /* FEAT_FHM */ | ||
679 | - t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* FEAT_FlagM2 */ | ||
680 | - t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
681 | - t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); /* FEAT_RNG */ | ||
682 | - cpu->isar.id_aa64isar0 = t; | ||
683 | - | ||
684 | - t = cpu->isar.id_aa64isar1; | ||
685 | - t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); /* FEAT_DPB2 */ | ||
686 | - t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); /* FEAT_JSCVT */ | ||
687 | - t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); /* FEAT_FCMA */ | ||
688 | - t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* FEAT_LRCPC2 */ | ||
689 | - t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); /* FEAT_FRINTTS */ | ||
690 | - t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */ | ||
691 | - t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */ | ||
692 | - t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */ | ||
693 | - t = FIELD_DP64(t, ID_AA64ISAR1, DGH, 1); /* FEAT_DGH */ | ||
694 | - t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */ | ||
695 | - cpu->isar.id_aa64isar1 = t; | ||
696 | - | ||
697 | - t = cpu->isar.id_aa64pfr0; | ||
698 | - t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */ | ||
699 | - t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */ | ||
700 | - t = FIELD_DP64(t, ID_AA64PFR0, RAS, 2); /* FEAT_RASv1p1 + FEAT_DoubleFault */ | ||
701 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
702 | - t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ | ||
703 | - t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ | ||
704 | - t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */ | ||
705 | - t = FIELD_DP64(t, ID_AA64PFR0, CSV3, 1); /* FEAT_CSV3 */ | ||
706 | - cpu->isar.id_aa64pfr0 = t; | ||
707 | - | ||
708 | - t = cpu->isar.id_aa64pfr1; | ||
709 | - t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); /* FEAT_BTI */ | ||
710 | - t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); /* FEAT_SSBS2 */ | ||
711 | - /* | ||
712 | - * Begin with full support for MTE. This will be downgraded to MTE=0 | ||
713 | - * during realize if the board provides no tag memory, much like | ||
714 | - * we do for EL2 with the virtualization=on property. | ||
715 | - */ | ||
716 | - t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ | ||
717 | - t = FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0); /* FEAT_RASv1p1 + FEAT_DoubleFault */ | ||
718 | - t = FIELD_DP64(t, ID_AA64PFR1, SME, 1); /* FEAT_SME */ | ||
719 | - t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */ | ||
720 | - cpu->isar.id_aa64pfr1 = t; | ||
721 | - | ||
722 | - t = cpu->isar.id_aa64mmfr0; | ||
723 | - t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 6); /* FEAT_LPA: 52 bits */ | ||
724 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16, 1); /* 16k pages supported */ | ||
725 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 2); /* 16k stage2 supported */ | ||
726 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN64_2, 2); /* 64k stage2 supported */ | ||
727 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 2); /* 4k stage2 supported */ | ||
728 | - t = FIELD_DP64(t, ID_AA64MMFR0, FGT, 1); /* FEAT_FGT */ | ||
729 | - cpu->isar.id_aa64mmfr0 = t; | ||
730 | - | ||
731 | - t = cpu->isar.id_aa64mmfr1; | ||
732 | - t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 2); /* FEAT_HAFDBS */ | ||
733 | - t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */ | ||
734 | - t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */ | ||
735 | - t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */ | ||
736 | - t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); /* FEAT_LOR */ | ||
737 | - t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 3); /* FEAT_PAN3 */ | ||
738 | - t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */ | ||
739 | - t = FIELD_DP64(t, ID_AA64MMFR1, ETS, 1); /* FEAT_ETS */ | ||
740 | - t = FIELD_DP64(t, ID_AA64MMFR1, HCX, 1); /* FEAT_HCX */ | ||
741 | - cpu->isar.id_aa64mmfr1 = t; | ||
742 | - | ||
743 | - t = cpu->isar.id_aa64mmfr2; | ||
744 | - t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */ | ||
745 | - t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */ | ||
746 | - t = FIELD_DP64(t, ID_AA64MMFR2, IESB, 1); /* FEAT_IESB */ | ||
747 | - t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ | ||
748 | - t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */ | ||
749 | - t = FIELD_DP64(t, ID_AA64MMFR2, IDS, 1); /* FEAT_IDST */ | ||
750 | - t = FIELD_DP64(t, ID_AA64MMFR2, FWB, 1); /* FEAT_S2FWB */ | ||
751 | - t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ | ||
752 | - t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */ | ||
753 | - t = FIELD_DP64(t, ID_AA64MMFR2, EVT, 2); /* FEAT_EVT */ | ||
754 | - t = FIELD_DP64(t, ID_AA64MMFR2, E0PD, 1); /* FEAT_E0PD */ | ||
755 | - cpu->isar.id_aa64mmfr2 = t; | ||
756 | - | ||
757 | - t = cpu->isar.id_aa64zfr0; | ||
758 | - t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); | ||
759 | - t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* FEAT_SVE_PMULL128 */ | ||
760 | - t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* FEAT_SVE_BitPerm */ | ||
761 | - t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); /* FEAT_BF16 */ | ||
762 | - t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* FEAT_SVE_SHA3 */ | ||
763 | - t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* FEAT_SVE_SM4 */ | ||
764 | - t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); /* FEAT_I8MM */ | ||
765 | - t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); /* FEAT_F32MM */ | ||
766 | - t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); /* FEAT_F64MM */ | ||
767 | - cpu->isar.id_aa64zfr0 = t; | ||
768 | - | ||
769 | - t = cpu->isar.id_aa64dfr0; | ||
770 | - t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 9); /* FEAT_Debugv8p4 */ | ||
771 | - t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 6); /* FEAT_PMUv3p5 */ | ||
772 | - cpu->isar.id_aa64dfr0 = t; | ||
773 | - | ||
774 | - t = cpu->isar.id_aa64smfr0; | ||
775 | - t = FIELD_DP64(t, ID_AA64SMFR0, F32F32, 1); /* FEAT_SME */ | ||
776 | - t = FIELD_DP64(t, ID_AA64SMFR0, B16F32, 1); /* FEAT_SME */ | ||
777 | - t = FIELD_DP64(t, ID_AA64SMFR0, F16F32, 1); /* FEAT_SME */ | ||
778 | - t = FIELD_DP64(t, ID_AA64SMFR0, I8I32, 0xf); /* FEAT_SME */ | ||
779 | - t = FIELD_DP64(t, ID_AA64SMFR0, F64F64, 1); /* FEAT_SME_F64F64 */ | ||
780 | - t = FIELD_DP64(t, ID_AA64SMFR0, I16I64, 0xf); /* FEAT_SME_I16I64 */ | ||
781 | - t = FIELD_DP64(t, ID_AA64SMFR0, FA64, 1); /* FEAT_SME_FA64 */ | ||
782 | - cpu->isar.id_aa64smfr0 = t; | ||
783 | - | ||
784 | - /* Replicate the same data to the 32-bit id registers. */ | ||
785 | - aa32_max_features(cpu); | ||
786 | - | ||
787 | -#ifdef CONFIG_USER_ONLY | ||
788 | - /* | ||
789 | - * For usermode -cpu max we can use a larger and more efficient DCZ | ||
790 | - * blocksize since we don't have to follow what the hardware does. | ||
791 | - */ | ||
792 | - cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ | ||
793 | - cpu->dcz_blocksize = 7; /* 512 bytes */ | ||
794 | -#endif | ||
795 | - | ||
796 | - cpu->sve_vq.supported = MAKE_64BIT_MASK(0, ARM_MAX_VQ); | ||
797 | - cpu->sme_vq.supported = SVE_VQ_POW2_MAP; | ||
798 | - | ||
799 | - aarch64_add_pauth_properties(obj); | ||
800 | - aarch64_add_sve_properties(obj); | ||
801 | - aarch64_add_sme_properties(obj); | ||
802 | - object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_max_vq, | ||
803 | - cpu_max_set_sve_max_vq, NULL, NULL); | ||
804 | - qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); | ||
805 | -} | ||
806 | - | ||
807 | static void aarch64_max_initfn(Object *obj) | ||
808 | { | ||
809 | if (kvm_enabled() || hvf_enabled()) { | ||
810 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
811 | } | ||
812 | |||
813 | static const ARMCPUInfo aarch64_cpus[] = { | ||
814 | - { .name = "cortex-a35", .initfn = aarch64_a35_initfn }, | ||
815 | { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, | ||
816 | { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, | ||
817 | - { .name = "cortex-a55", .initfn = aarch64_a55_initfn }, | ||
818 | - { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, | ||
819 | - { .name = "cortex-a76", .initfn = aarch64_a76_initfn }, | ||
820 | - { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, | ||
821 | - { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn }, | ||
822 | { .name = "max", .initfn = aarch64_max_initfn }, | ||
823 | #if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
824 | { .name = "host", .initfn = aarch64_host_initfn }, | ||
825 | diff --git a/target/arm/cpu64.c b/target/arm/tcg/cpu64.c | ||
826 | similarity index 51% | ||
827 | copy from target/arm/cpu64.c | ||
828 | copy to target/arm/tcg/cpu64.c | ||
829 | index XXXXXXX..XXXXXXX 100644 | ||
830 | --- a/target/arm/cpu64.c | ||
831 | +++ b/target/arm/tcg/cpu64.c | ||
832 | @@ -XXX,XX +XXX,XX @@ | ||
833 | /* | ||
834 | - * QEMU AArch64 CPU | ||
835 | + * QEMU AArch64 TCG CPUs | ||
836 | * | ||
837 | * Copyright (c) 2013 Linaro Ltd | ||
838 | * | ||
839 | @@ -XXX,XX +XXX,XX @@ | ||
840 | #include "qemu/osdep.h" | ||
841 | #include "qapi/error.h" | ||
842 | #include "cpu.h" | ||
843 | -#include "cpregs.h" | ||
844 | #include "qemu/module.h" | ||
845 | -#include "sysemu/kvm.h" | ||
846 | -#include "sysemu/hvf.h" | ||
847 | -#include "sysemu/qtest.h" | ||
848 | -#include "sysemu/tcg.h" | ||
849 | -#include "kvm_arm.h" | ||
850 | -#include "hvf_arm.h" | ||
851 | #include "qapi/visitor.h" | ||
852 | #include "hw/qdev-properties.h" | ||
853 | #include "internals.h" | ||
854 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a35_initfn(Object *obj) | ||
855 | define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
856 | } | ||
857 | |||
858 | -void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
859 | -{ | ||
860 | - /* | ||
861 | - * If any vector lengths are explicitly enabled with sve<N> properties, | ||
862 | - * then all other lengths are implicitly disabled. If sve-max-vq is | ||
863 | - * specified then it is the same as explicitly enabling all lengths | ||
864 | - * up to and including the specified maximum, which means all larger | ||
865 | - * lengths will be implicitly disabled. If no sve<N> properties | ||
866 | - * are enabled and sve-max-vq is not specified, then all lengths not | ||
867 | - * explicitly disabled will be enabled. Additionally, all power-of-two | ||
868 | - * vector lengths less than the maximum enabled length will be | ||
869 | - * automatically enabled and all vector lengths larger than the largest | ||
870 | - * disabled power-of-two vector length will be automatically disabled. | ||
871 | - * Errors are generated if the user provided input that interferes with | ||
872 | - * any of the above. Finally, if SVE is not disabled, then at least one | ||
873 | - * vector length must be enabled. | ||
874 | - */ | ||
875 | - uint32_t vq_map = cpu->sve_vq.map; | ||
876 | - uint32_t vq_init = cpu->sve_vq.init; | ||
877 | - uint32_t vq_supported; | ||
878 | - uint32_t vq_mask = 0; | ||
879 | - uint32_t tmp, vq, max_vq = 0; | ||
880 | - | ||
881 | - /* | ||
882 | - * CPU models specify a set of supported vector lengths which are | ||
883 | - * enabled by default. Attempting to enable any vector length not set | ||
884 | - * in the supported bitmap results in an error. When KVM is enabled we | ||
885 | - * fetch the supported bitmap from the host. | ||
886 | - */ | ||
887 | - if (kvm_enabled()) { | ||
888 | - if (kvm_arm_sve_supported()) { | ||
889 | - cpu->sve_vq.supported = kvm_arm_sve_get_vls(CPU(cpu)); | ||
890 | - vq_supported = cpu->sve_vq.supported; | ||
891 | - } else { | ||
892 | - assert(!cpu_isar_feature(aa64_sve, cpu)); | ||
893 | - vq_supported = 0; | ||
894 | - } | ||
895 | - } else { | ||
896 | - vq_supported = cpu->sve_vq.supported; | ||
897 | - } | ||
898 | - | ||
899 | - /* | ||
900 | - * Process explicit sve<N> properties. | ||
901 | - * From the properties, sve_vq_map<N> implies sve_vq_init<N>. | ||
902 | - * Check first for any sve<N> enabled. | ||
903 | - */ | ||
904 | - if (vq_map != 0) { | ||
905 | - max_vq = 32 - clz32(vq_map); | ||
906 | - vq_mask = MAKE_64BIT_MASK(0, max_vq); | ||
907 | - | ||
908 | - if (cpu->sve_max_vq && max_vq > cpu->sve_max_vq) { | ||
909 | - error_setg(errp, "cannot enable sve%d", max_vq * 128); | ||
910 | - error_append_hint(errp, "sve%d is larger than the maximum vector " | ||
911 | - "length, sve-max-vq=%d (%d bits)\n", | ||
912 | - max_vq * 128, cpu->sve_max_vq, | ||
913 | - cpu->sve_max_vq * 128); | ||
914 | - return; | ||
915 | - } | ||
916 | - | ||
917 | - if (kvm_enabled()) { | ||
918 | - /* | ||
919 | - * For KVM we have to automatically enable all supported unitialized | ||
920 | - * lengths, even when the smaller lengths are not all powers-of-two. | ||
921 | - */ | ||
922 | - vq_map |= vq_supported & ~vq_init & vq_mask; | ||
923 | - } else { | ||
924 | - /* Propagate enabled bits down through required powers-of-two. */ | ||
925 | - vq_map |= SVE_VQ_POW2_MAP & ~vq_init & vq_mask; | ||
926 | - } | ||
927 | - } else if (cpu->sve_max_vq == 0) { | ||
928 | - /* | ||
929 | - * No explicit bits enabled, and no implicit bits from sve-max-vq. | ||
930 | - */ | ||
931 | - if (!cpu_isar_feature(aa64_sve, cpu)) { | ||
932 | - /* SVE is disabled and so are all vector lengths. Good. */ | ||
933 | - return; | ||
934 | - } | ||
935 | - | ||
936 | - if (kvm_enabled()) { | ||
937 | - /* Disabling a supported length disables all larger lengths. */ | ||
938 | - tmp = vq_init & vq_supported; | ||
939 | - } else { | ||
940 | - /* Disabling a power-of-two disables all larger lengths. */ | ||
941 | - tmp = vq_init & SVE_VQ_POW2_MAP; | ||
942 | - } | ||
943 | - vq = ctz32(tmp) + 1; | ||
944 | - | ||
945 | - max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | ||
946 | - vq_mask = MAKE_64BIT_MASK(0, max_vq); | ||
947 | - vq_map = vq_supported & ~vq_init & vq_mask; | ||
948 | - | ||
949 | - if (max_vq == 0 || vq_map == 0) { | ||
950 | - error_setg(errp, "cannot disable sve%d", vq * 128); | ||
951 | - error_append_hint(errp, "Disabling sve%d results in all " | ||
952 | - "vector lengths being disabled.\n", | ||
953 | - vq * 128); | ||
954 | - error_append_hint(errp, "With SVE enabled, at least one " | ||
955 | - "vector length must be enabled.\n"); | ||
956 | - return; | ||
957 | - } | ||
958 | - | ||
959 | - max_vq = 32 - clz32(vq_map); | ||
960 | - vq_mask = MAKE_64BIT_MASK(0, max_vq); | ||
961 | - } | ||
962 | - | ||
963 | - /* | ||
964 | - * Process the sve-max-vq property. | ||
965 | - * Note that we know from the above that no bit above | ||
966 | - * sve-max-vq is currently set. | ||
967 | - */ | ||
968 | - if (cpu->sve_max_vq != 0) { | ||
969 | - max_vq = cpu->sve_max_vq; | ||
970 | - vq_mask = MAKE_64BIT_MASK(0, max_vq); | ||
971 | - | ||
972 | - if (vq_init & ~vq_map & (1 << (max_vq - 1))) { | ||
973 | - error_setg(errp, "cannot disable sve%d", max_vq * 128); | ||
974 | - error_append_hint(errp, "The maximum vector length must be " | ||
975 | - "enabled, sve-max-vq=%d (%d bits)\n", | ||
976 | - max_vq, max_vq * 128); | ||
977 | - return; | ||
978 | - } | ||
979 | - | ||
980 | - /* Set all bits not explicitly set within sve-max-vq. */ | ||
981 | - vq_map |= ~vq_init & vq_mask; | ||
982 | - } | ||
983 | - | ||
984 | - /* | ||
985 | - * We should know what max-vq is now. Also, as we're done | ||
986 | - * manipulating sve-vq-map, we ensure any bits above max-vq | ||
987 | - * are clear, just in case anybody looks. | ||
988 | - */ | ||
989 | - assert(max_vq != 0); | ||
990 | - assert(vq_mask != 0); | ||
991 | - vq_map &= vq_mask; | ||
992 | - | ||
993 | - /* Ensure the set of lengths matches what is supported. */ | ||
994 | - tmp = vq_map ^ (vq_supported & vq_mask); | ||
995 | - if (tmp) { | ||
996 | - vq = 32 - clz32(tmp); | ||
997 | - if (vq_map & (1 << (vq - 1))) { | ||
998 | - if (cpu->sve_max_vq) { | ||
999 | - error_setg(errp, "cannot set sve-max-vq=%d", cpu->sve_max_vq); | ||
1000 | - error_append_hint(errp, "This CPU does not support " | ||
1001 | - "the vector length %d-bits.\n", vq * 128); | ||
1002 | - error_append_hint(errp, "It may not be possible to use " | ||
1003 | - "sve-max-vq with this CPU. Try " | ||
1004 | - "using only sve<N> properties.\n"); | ||
1005 | - } else { | ||
1006 | - error_setg(errp, "cannot enable sve%d", vq * 128); | ||
1007 | - if (vq_supported) { | ||
1008 | - error_append_hint(errp, "This CPU does not support " | ||
1009 | - "the vector length %d-bits.\n", vq * 128); | ||
1010 | - } else { | ||
1011 | - error_append_hint(errp, "SVE not supported by KVM " | ||
1012 | - "on this host\n"); | ||
1013 | - } | ||
1014 | - } | ||
1015 | - return; | ||
1016 | - } else { | ||
1017 | - if (kvm_enabled()) { | ||
1018 | - error_setg(errp, "cannot disable sve%d", vq * 128); | ||
1019 | - error_append_hint(errp, "The KVM host requires all " | ||
1020 | - "supported vector lengths smaller " | ||
1021 | - "than %d bits to also be enabled.\n", | ||
1022 | - max_vq * 128); | ||
1023 | - return; | ||
1024 | - } else { | ||
1025 | - /* Ensure all required powers-of-two are enabled. */ | ||
1026 | - tmp = SVE_VQ_POW2_MAP & vq_mask & ~vq_map; | ||
1027 | - if (tmp) { | ||
1028 | - vq = 32 - clz32(tmp); | ||
1029 | - error_setg(errp, "cannot disable sve%d", vq * 128); | ||
1030 | - error_append_hint(errp, "sve%d is required as it " | ||
1031 | - "is a power-of-two length smaller " | ||
1032 | - "than the maximum, sve%d\n", | ||
1033 | - vq * 128, max_vq * 128); | ||
1034 | - return; | ||
1035 | - } | ||
1036 | - } | ||
1037 | - } | ||
1038 | - } | ||
1039 | - | ||
1040 | - /* | ||
1041 | - * Now that we validated all our vector lengths, the only question | ||
1042 | - * left to answer is if we even want SVE at all. | ||
1043 | - */ | ||
1044 | - if (!cpu_isar_feature(aa64_sve, cpu)) { | ||
1045 | - error_setg(errp, "cannot enable sve%d", max_vq * 128); | ||
1046 | - error_append_hint(errp, "SVE must be enabled to enable vector " | ||
1047 | - "lengths.\n"); | ||
1048 | - error_append_hint(errp, "Add sve=on to the CPU property list.\n"); | ||
1049 | - return; | ||
1050 | - } | ||
1051 | - | ||
1052 | - /* From now on sve_max_vq is the actual maximum supported length. */ | ||
1053 | - cpu->sve_max_vq = max_vq; | ||
1054 | - cpu->sve_vq.map = vq_map; | ||
1055 | -} | ||
1056 | - | ||
1057 | static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name, | ||
1058 | void *opaque, Error **errp) | ||
1059 | { | ||
1060 | @@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, | ||
1061 | cpu->sve_max_vq = max_vq; | ||
1062 | } | ||
1063 | |||
1064 | -/* | ||
1065 | - * Note that cpu_arm_{get,set}_vq cannot use the simpler | ||
1066 | - * object_property_add_bool interface because they make use of the | ||
1067 | - * contents of "name" to determine which bit on which to operate. | ||
1068 | - */ | ||
1069 | -static void cpu_arm_get_vq(Object *obj, Visitor *v, const char *name, | ||
1070 | - void *opaque, Error **errp) | ||
1071 | -{ | ||
1072 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1073 | - ARMVQMap *vq_map = opaque; | ||
1074 | - uint32_t vq = atoi(&name[3]) / 128; | ||
1075 | - bool sve = vq_map == &cpu->sve_vq; | ||
1076 | - bool value; | ||
1077 | - | ||
1078 | - /* All vector lengths are disabled when feature is off. */ | ||
1079 | - if (sve | ||
1080 | - ? !cpu_isar_feature(aa64_sve, cpu) | ||
1081 | - : !cpu_isar_feature(aa64_sme, cpu)) { | ||
1082 | - value = false; | ||
1083 | - } else { | ||
1084 | - value = extract32(vq_map->map, vq - 1, 1); | ||
1085 | - } | ||
1086 | - visit_type_bool(v, name, &value, errp); | ||
1087 | -} | ||
1088 | - | ||
1089 | -static void cpu_arm_set_vq(Object *obj, Visitor *v, const char *name, | ||
1090 | - void *opaque, Error **errp) | ||
1091 | -{ | ||
1092 | - ARMVQMap *vq_map = opaque; | ||
1093 | - uint32_t vq = atoi(&name[3]) / 128; | ||
1094 | - bool value; | ||
1095 | - | ||
1096 | - if (!visit_type_bool(v, name, &value, errp)) { | ||
1097 | - return; | ||
1098 | - } | ||
1099 | - | ||
1100 | - vq_map->map = deposit32(vq_map->map, vq - 1, 1, value); | ||
1101 | - vq_map->init |= 1 << (vq - 1); | ||
1102 | -} | ||
1103 | - | ||
1104 | -static bool cpu_arm_get_sve(Object *obj, Error **errp) | ||
1105 | -{ | ||
1106 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1107 | - return cpu_isar_feature(aa64_sve, cpu); | ||
1108 | -} | ||
1109 | - | ||
1110 | -static void cpu_arm_set_sve(Object *obj, bool value, Error **errp) | ||
1111 | -{ | ||
1112 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1113 | - uint64_t t; | ||
1114 | - | ||
1115 | - if (value && kvm_enabled() && !kvm_arm_sve_supported()) { | ||
1116 | - error_setg(errp, "'sve' feature not supported by KVM on this host"); | ||
1117 | - return; | ||
1118 | - } | ||
1119 | - | ||
1120 | - t = cpu->isar.id_aa64pfr0; | ||
1121 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, value); | ||
1122 | - cpu->isar.id_aa64pfr0 = t; | ||
1123 | -} | ||
1124 | - | ||
1125 | -void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp) | ||
1126 | -{ | ||
1127 | - uint32_t vq_map = cpu->sme_vq.map; | ||
1128 | - uint32_t vq_init = cpu->sme_vq.init; | ||
1129 | - uint32_t vq_supported = cpu->sme_vq.supported; | ||
1130 | - uint32_t vq; | ||
1131 | - | ||
1132 | - if (vq_map == 0) { | ||
1133 | - if (!cpu_isar_feature(aa64_sme, cpu)) { | ||
1134 | - cpu->isar.id_aa64smfr0 = 0; | ||
1135 | - return; | ||
1136 | - } | ||
1137 | - | ||
1138 | - /* TODO: KVM will require limitations via SMCR_EL2. */ | ||
1139 | - vq_map = vq_supported & ~vq_init; | ||
1140 | - | ||
1141 | - if (vq_map == 0) { | ||
1142 | - vq = ctz32(vq_supported) + 1; | ||
1143 | - error_setg(errp, "cannot disable sme%d", vq * 128); | ||
1144 | - error_append_hint(errp, "All SME vector lengths are disabled.\n"); | ||
1145 | - error_append_hint(errp, "With SME enabled, at least one " | ||
1146 | - "vector length must be enabled.\n"); | ||
1147 | - return; | ||
1148 | - } | ||
1149 | - } else { | ||
1150 | - if (!cpu_isar_feature(aa64_sme, cpu)) { | ||
1151 | - vq = 32 - clz32(vq_map); | ||
1152 | - error_setg(errp, "cannot enable sme%d", vq * 128); | ||
1153 | - error_append_hint(errp, "SME must be enabled to enable " | ||
1154 | - "vector lengths.\n"); | ||
1155 | - error_append_hint(errp, "Add sme=on to the CPU property list.\n"); | ||
1156 | - return; | ||
1157 | - } | ||
1158 | - /* TODO: KVM will require limitations via SMCR_EL2. */ | ||
1159 | - } | ||
1160 | - | ||
1161 | - cpu->sme_vq.map = vq_map; | ||
1162 | -} | ||
1163 | - | ||
1164 | -static bool cpu_arm_get_sme(Object *obj, Error **errp) | ||
1165 | -{ | ||
1166 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1167 | - return cpu_isar_feature(aa64_sme, cpu); | ||
1168 | -} | ||
1169 | - | ||
1170 | -static void cpu_arm_set_sme(Object *obj, bool value, Error **errp) | ||
1171 | -{ | ||
1172 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1173 | - uint64_t t; | ||
1174 | - | ||
1175 | - t = cpu->isar.id_aa64pfr1; | ||
1176 | - t = FIELD_DP64(t, ID_AA64PFR1, SME, value); | ||
1177 | - cpu->isar.id_aa64pfr1 = t; | ||
1178 | -} | ||
1179 | - | ||
1180 | -static bool cpu_arm_get_sme_fa64(Object *obj, Error **errp) | ||
1181 | -{ | ||
1182 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1183 | - return cpu_isar_feature(aa64_sme, cpu) && | ||
1184 | - cpu_isar_feature(aa64_sme_fa64, cpu); | ||
1185 | -} | ||
1186 | - | ||
1187 | -static void cpu_arm_set_sme_fa64(Object *obj, bool value, Error **errp) | ||
1188 | -{ | ||
1189 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1190 | - uint64_t t; | ||
1191 | - | ||
1192 | - t = cpu->isar.id_aa64smfr0; | ||
1193 | - t = FIELD_DP64(t, ID_AA64SMFR0, FA64, value); | ||
1194 | - cpu->isar.id_aa64smfr0 = t; | ||
1195 | -} | ||
1196 | - | ||
1197 | -#ifdef CONFIG_USER_ONLY | ||
1198 | -/* Mirror linux /proc/sys/abi/{sve,sme}_default_vector_length. */ | ||
1199 | -static void cpu_arm_set_default_vec_len(Object *obj, Visitor *v, | ||
1200 | - const char *name, void *opaque, | ||
1201 | - Error **errp) | ||
1202 | -{ | ||
1203 | - uint32_t *ptr_default_vq = opaque; | ||
1204 | - int32_t default_len, default_vq, remainder; | ||
1205 | - | ||
1206 | - if (!visit_type_int32(v, name, &default_len, errp)) { | ||
1207 | - return; | ||
1208 | - } | ||
1209 | - | ||
1210 | - /* Undocumented, but the kernel allows -1 to indicate "maximum". */ | ||
1211 | - if (default_len == -1) { | ||
1212 | - *ptr_default_vq = ARM_MAX_VQ; | ||
1213 | - return; | ||
1214 | - } | ||
1215 | - | ||
1216 | - default_vq = default_len / 16; | ||
1217 | - remainder = default_len % 16; | ||
1218 | - | ||
1219 | - /* | ||
1220 | - * Note that the 512 max comes from include/uapi/asm/sve_context.h | ||
1221 | - * and is the maximum architectural width of ZCR_ELx.LEN. | ||
1222 | - */ | ||
1223 | - if (remainder || default_vq < 1 || default_vq > 512) { | ||
1224 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1225 | - const char *which = | ||
1226 | - (ptr_default_vq == &cpu->sve_default_vq ? "sve" : "sme"); | ||
1227 | - | ||
1228 | - error_setg(errp, "cannot set %s-default-vector-length", which); | ||
1229 | - if (remainder) { | ||
1230 | - error_append_hint(errp, "Vector length not a multiple of 16\n"); | ||
1231 | - } else if (default_vq < 1) { | ||
1232 | - error_append_hint(errp, "Vector length smaller than 16\n"); | ||
1233 | - } else { | ||
1234 | - error_append_hint(errp, "Vector length larger than %d\n", | ||
1235 | - 512 * 16); | ||
1236 | - } | ||
1237 | - return; | ||
1238 | - } | ||
1239 | - | ||
1240 | - *ptr_default_vq = default_vq; | ||
1241 | -} | ||
1242 | - | ||
1243 | -static void cpu_arm_get_default_vec_len(Object *obj, Visitor *v, | ||
1244 | - const char *name, void *opaque, | ||
1245 | - Error **errp) | ||
1246 | -{ | ||
1247 | - uint32_t *ptr_default_vq = opaque; | ||
1248 | - int32_t value = *ptr_default_vq * 16; | ||
1249 | - | ||
1250 | - visit_type_int32(v, name, &value, errp); | ||
1251 | -} | ||
1252 | -#endif | ||
1253 | - | ||
1254 | -static void aarch64_add_sve_properties(Object *obj) | ||
1255 | -{ | ||
1256 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1257 | - uint32_t vq; | ||
1258 | - | ||
1259 | - object_property_add_bool(obj, "sve", cpu_arm_get_sve, cpu_arm_set_sve); | ||
1260 | - | ||
1261 | - for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { | ||
1262 | - char name[8]; | ||
1263 | - sprintf(name, "sve%d", vq * 128); | ||
1264 | - object_property_add(obj, name, "bool", cpu_arm_get_vq, | ||
1265 | - cpu_arm_set_vq, NULL, &cpu->sve_vq); | ||
1266 | - } | ||
1267 | - | ||
1268 | -#ifdef CONFIG_USER_ONLY | ||
1269 | - /* Mirror linux /proc/sys/abi/sve_default_vector_length. */ | ||
1270 | - object_property_add(obj, "sve-default-vector-length", "int32", | ||
1271 | - cpu_arm_get_default_vec_len, | ||
1272 | - cpu_arm_set_default_vec_len, NULL, | ||
1273 | - &cpu->sve_default_vq); | ||
1274 | -#endif | ||
1275 | -} | ||
1276 | - | ||
1277 | -static void aarch64_add_sme_properties(Object *obj) | ||
1278 | -{ | ||
1279 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1280 | - uint32_t vq; | ||
1281 | - | ||
1282 | - object_property_add_bool(obj, "sme", cpu_arm_get_sme, cpu_arm_set_sme); | ||
1283 | - object_property_add_bool(obj, "sme_fa64", cpu_arm_get_sme_fa64, | ||
1284 | - cpu_arm_set_sme_fa64); | ||
1285 | - | ||
1286 | - for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) { | ||
1287 | - char name[8]; | ||
1288 | - sprintf(name, "sme%d", vq * 128); | ||
1289 | - object_property_add(obj, name, "bool", cpu_arm_get_vq, | ||
1290 | - cpu_arm_set_vq, NULL, &cpu->sme_vq); | ||
1291 | - } | ||
1292 | - | ||
1293 | -#ifdef CONFIG_USER_ONLY | ||
1294 | - /* Mirror linux /proc/sys/abi/sme_default_vector_length. */ | ||
1295 | - object_property_add(obj, "sme-default-vector-length", "int32", | ||
1296 | - cpu_arm_get_default_vec_len, | ||
1297 | - cpu_arm_set_default_vec_len, NULL, | ||
1298 | - &cpu->sme_default_vq); | ||
1299 | -#endif | ||
1300 | -} | ||
1301 | - | ||
1302 | -void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) | ||
1303 | -{ | ||
1304 | - int arch_val = 0, impdef_val = 0; | ||
1305 | - uint64_t t; | ||
1306 | - | ||
1307 | - /* Exit early if PAuth is enabled, and fall through to disable it */ | ||
1308 | - if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) { | ||
1309 | - if (!cpu_isar_feature(aa64_pauth, cpu)) { | ||
1310 | - error_setg(errp, "'pauth' feature not supported by %s on this host", | ||
1311 | - kvm_enabled() ? "KVM" : "hvf"); | ||
1312 | - } | ||
1313 | - | ||
1314 | - return; | ||
1315 | - } | ||
1316 | - | ||
1317 | - /* TODO: Handle HaveEnhancedPAC, HaveEnhancedPAC2, HaveFPAC. */ | ||
1318 | - if (cpu->prop_pauth) { | ||
1319 | - if (cpu->prop_pauth_impdef) { | ||
1320 | - impdef_val = 1; | ||
1321 | - } else { | ||
1322 | - arch_val = 1; | ||
1323 | - } | ||
1324 | - } else if (cpu->prop_pauth_impdef) { | ||
1325 | - error_setg(errp, "cannot enable pauth-impdef without pauth"); | ||
1326 | - error_append_hint(errp, "Add pauth=on to the CPU property list.\n"); | ||
1327 | - } | ||
1328 | - | ||
1329 | - t = cpu->isar.id_aa64isar1; | ||
1330 | - t = FIELD_DP64(t, ID_AA64ISAR1, APA, arch_val); | ||
1331 | - t = FIELD_DP64(t, ID_AA64ISAR1, GPA, arch_val); | ||
1332 | - t = FIELD_DP64(t, ID_AA64ISAR1, API, impdef_val); | ||
1333 | - t = FIELD_DP64(t, ID_AA64ISAR1, GPI, impdef_val); | ||
1334 | - cpu->isar.id_aa64isar1 = t; | ||
1335 | -} | ||
1336 | - | ||
1337 | -static Property arm_cpu_pauth_property = | ||
1338 | - DEFINE_PROP_BOOL("pauth", ARMCPU, prop_pauth, true); | ||
1339 | -static Property arm_cpu_pauth_impdef_property = | ||
1340 | - DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false); | ||
1341 | - | ||
1342 | -static void aarch64_add_pauth_properties(Object *obj) | ||
1343 | -{ | ||
1344 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1345 | - | ||
1346 | - /* Default to PAUTH on, with the architected algorithm on TCG. */ | ||
1347 | - qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); | ||
1348 | - if (kvm_enabled() || hvf_enabled()) { | ||
1349 | - /* | ||
1350 | - * Mirror PAuth support from the probed sysregs back into the | ||
1351 | - * property for KVM or hvf. Is it just a bit backward? Yes it is! | ||
1352 | - * Note that prop_pauth is true whether the host CPU supports the | ||
1353 | - * architected QARMA5 algorithm or the IMPDEF one. We don't | ||
1354 | - * provide the separate pauth-impdef property for KVM or hvf, | ||
1355 | - * only for TCG. | ||
1356 | - */ | ||
1357 | - cpu->prop_pauth = cpu_isar_feature(aa64_pauth, cpu); | ||
1358 | - } else { | ||
1359 | - qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property); | ||
1360 | - } | ||
1361 | -} | ||
1362 | - | ||
1363 | static Property arm_cpu_lpa2_property = | ||
1364 | DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true); | ||
1365 | |||
1366 | -void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) | ||
1367 | -{ | ||
1368 | - uint64_t t; | ||
1369 | - | ||
1370 | - /* | ||
1371 | - * We only install the property for tcg -cpu max; this is the | ||
1372 | - * only situation in which the cpu field can be true. | ||
1373 | - */ | ||
1374 | - if (!cpu->prop_lpa2) { | ||
1375 | - return; | ||
1376 | - } | ||
1377 | - | ||
1378 | - t = cpu->isar.id_aa64mmfr0; | ||
1379 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16, 2); /* 16k pages w/ LPA2 */ | ||
1380 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4, 1); /* 4k pages w/ LPA2 */ | ||
1381 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 3); /* 16k stage2 w/ LPA2 */ | ||
1382 | - t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 3); /* 4k stage2 w/ LPA2 */ | ||
1383 | - cpu->isar.id_aa64mmfr0 = t; | ||
1384 | -} | ||
1385 | - | ||
1386 | -static void aarch64_a57_initfn(Object *obj) | ||
1387 | -{ | ||
1388 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1389 | - | ||
1390 | - cpu->dtb_compatible = "arm,cortex-a57"; | ||
1391 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
1392 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
1393 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
1394 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
1395 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
1396 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
1397 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
1398 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
1399 | - cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A57; | ||
1400 | - cpu->midr = 0x411fd070; | ||
1401 | - cpu->revidr = 0x00000000; | ||
1402 | - cpu->reset_fpsid = 0x41034070; | ||
1403 | - cpu->isar.mvfr0 = 0x10110222; | ||
1404 | - cpu->isar.mvfr1 = 0x12111111; | ||
1405 | - cpu->isar.mvfr2 = 0x00000043; | ||
1406 | - cpu->ctr = 0x8444c004; | ||
1407 | - cpu->reset_sctlr = 0x00c50838; | ||
1408 | - cpu->isar.id_pfr0 = 0x00000131; | ||
1409 | - cpu->isar.id_pfr1 = 0x00011011; | ||
1410 | - cpu->isar.id_dfr0 = 0x03010066; | ||
1411 | - cpu->id_afr0 = 0x00000000; | ||
1412 | - cpu->isar.id_mmfr0 = 0x10101105; | ||
1413 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
1414 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
1415 | - cpu->isar.id_mmfr3 = 0x02102211; | ||
1416 | - cpu->isar.id_isar0 = 0x02101110; | ||
1417 | - cpu->isar.id_isar1 = 0x13112111; | ||
1418 | - cpu->isar.id_isar2 = 0x21232042; | ||
1419 | - cpu->isar.id_isar3 = 0x01112131; | ||
1420 | - cpu->isar.id_isar4 = 0x00011142; | ||
1421 | - cpu->isar.id_isar5 = 0x00011121; | ||
1422 | - cpu->isar.id_isar6 = 0; | ||
1423 | - cpu->isar.id_aa64pfr0 = 0x00002222; | ||
1424 | - cpu->isar.id_aa64dfr0 = 0x10305106; | ||
1425 | - cpu->isar.id_aa64isar0 = 0x00011120; | ||
1426 | - cpu->isar.id_aa64mmfr0 = 0x00001124; | ||
1427 | - cpu->isar.dbgdidr = 0x3516d000; | ||
1428 | - cpu->isar.dbgdevid = 0x01110f13; | ||
1429 | - cpu->isar.dbgdevid1 = 0x2; | ||
1430 | - cpu->isar.reset_pmcr_el0 = 0x41013000; | ||
1431 | - cpu->clidr = 0x0a200023; | ||
1432 | - cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ | ||
1433 | - cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */ | ||
1434 | - cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */ | ||
1435 | - cpu->dcz_blocksize = 4; /* 64 bytes */ | ||
1436 | - cpu->gic_num_lrs = 4; | ||
1437 | - cpu->gic_vpribits = 5; | ||
1438 | - cpu->gic_vprebits = 5; | ||
1439 | - cpu->gic_pribits = 5; | ||
1440 | - define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
1441 | -} | ||
1442 | - | ||
1443 | -static void aarch64_a53_initfn(Object *obj) | ||
1444 | -{ | ||
1445 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1446 | - | ||
1447 | - cpu->dtb_compatible = "arm,cortex-a53"; | ||
1448 | - set_feature(&cpu->env, ARM_FEATURE_V8); | ||
1449 | - set_feature(&cpu->env, ARM_FEATURE_NEON); | ||
1450 | - set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); | ||
1451 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
1452 | - set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); | ||
1453 | - set_feature(&cpu->env, ARM_FEATURE_EL2); | ||
1454 | - set_feature(&cpu->env, ARM_FEATURE_EL3); | ||
1455 | - set_feature(&cpu->env, ARM_FEATURE_PMU); | ||
1456 | - cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A53; | ||
1457 | - cpu->midr = 0x410fd034; | ||
1458 | - cpu->revidr = 0x00000000; | ||
1459 | - cpu->reset_fpsid = 0x41034070; | ||
1460 | - cpu->isar.mvfr0 = 0x10110222; | ||
1461 | - cpu->isar.mvfr1 = 0x12111111; | ||
1462 | - cpu->isar.mvfr2 = 0x00000043; | ||
1463 | - cpu->ctr = 0x84448004; /* L1Ip = VIPT */ | ||
1464 | - cpu->reset_sctlr = 0x00c50838; | ||
1465 | - cpu->isar.id_pfr0 = 0x00000131; | ||
1466 | - cpu->isar.id_pfr1 = 0x00011011; | ||
1467 | - cpu->isar.id_dfr0 = 0x03010066; | ||
1468 | - cpu->id_afr0 = 0x00000000; | ||
1469 | - cpu->isar.id_mmfr0 = 0x10101105; | ||
1470 | - cpu->isar.id_mmfr1 = 0x40000000; | ||
1471 | - cpu->isar.id_mmfr2 = 0x01260000; | ||
1472 | - cpu->isar.id_mmfr3 = 0x02102211; | ||
1473 | - cpu->isar.id_isar0 = 0x02101110; | ||
1474 | - cpu->isar.id_isar1 = 0x13112111; | ||
1475 | - cpu->isar.id_isar2 = 0x21232042; | ||
1476 | - cpu->isar.id_isar3 = 0x01112131; | ||
1477 | - cpu->isar.id_isar4 = 0x00011142; | ||
1478 | - cpu->isar.id_isar5 = 0x00011121; | ||
1479 | - cpu->isar.id_isar6 = 0; | ||
1480 | - cpu->isar.id_aa64pfr0 = 0x00002222; | ||
1481 | - cpu->isar.id_aa64dfr0 = 0x10305106; | ||
1482 | - cpu->isar.id_aa64isar0 = 0x00011120; | ||
1483 | - cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */ | ||
1484 | - cpu->isar.dbgdidr = 0x3516d000; | ||
1485 | - cpu->isar.dbgdevid = 0x00110f13; | ||
1486 | - cpu->isar.dbgdevid1 = 0x1; | ||
1487 | - cpu->isar.reset_pmcr_el0 = 0x41033000; | ||
1488 | - cpu->clidr = 0x0a200023; | ||
1489 | - cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */ | ||
1490 | - cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */ | ||
1491 | - cpu->ccsidr[2] = 0x707fe07a; /* 1024KB L2 cache */ | ||
1492 | - cpu->dcz_blocksize = 4; /* 64 bytes */ | ||
1493 | - cpu->gic_num_lrs = 4; | ||
1494 | - cpu->gic_vpribits = 5; | ||
1495 | - cpu->gic_vprebits = 5; | ||
1496 | - cpu->gic_pribits = 5; | ||
1497 | - define_cortex_a72_a57_a53_cp_reginfo(cpu); | ||
1498 | -} | ||
1499 | - | ||
1500 | static void aarch64_a55_initfn(Object *obj) | ||
1501 | { | ||
1502 | ARMCPU *cpu = ARM_CPU(obj); | ||
1503 | @@ -XXX,XX +XXX,XX @@ static void aarch64_neoverse_n1_initfn(Object *obj) | ||
1504 | define_neoverse_n1_cp_reginfo(cpu); | ||
1505 | } | ||
1506 | |||
1507 | -static void aarch64_host_initfn(Object *obj) | ||
1508 | -{ | ||
1509 | -#if defined(CONFIG_KVM) | ||
1510 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1511 | - kvm_arm_set_cpu_features_from_host(cpu); | ||
1512 | - if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
1513 | - aarch64_add_sve_properties(obj); | ||
1514 | - aarch64_add_pauth_properties(obj); | ||
1515 | - } | ||
1516 | -#elif defined(CONFIG_HVF) | ||
1517 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1518 | - hvf_arm_set_cpu_features_from_host(cpu); | ||
1519 | - aarch64_add_pauth_properties(obj); | ||
1520 | -#else | ||
1521 | - g_assert_not_reached(); | ||
1522 | -#endif | ||
1523 | -} | ||
1524 | - | ||
1525 | /* | ||
1526 | * -cpu max: a CPU with as many features enabled as our emulation supports. | ||
1527 | * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c; | ||
1528 | * this only needs to handle 64 bits. | ||
1529 | */ | ||
1530 | -static void aarch64_max_tcg_initfn(Object *obj) | ||
1531 | +void aarch64_max_tcg_initfn(Object *obj) | ||
1532 | { | ||
1533 | ARMCPU *cpu = ARM_CPU(obj); | ||
1534 | uint64_t t; | ||
1535 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_tcg_initfn(Object *obj) | ||
1536 | qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); | ||
1537 | } | ||
1538 | |||
1539 | -static void aarch64_max_initfn(Object *obj) | ||
1540 | -{ | ||
1541 | - if (kvm_enabled() || hvf_enabled()) { | ||
1542 | - /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ | ||
1543 | - aarch64_host_initfn(obj); | ||
1544 | - return; | ||
1545 | - } | ||
1546 | - | ||
1547 | - if (tcg_enabled() || qtest_enabled()) { | ||
1548 | - aarch64_a57_initfn(obj); | ||
1549 | - } | ||
1550 | - | ||
1551 | - /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ | ||
1552 | - if (tcg_enabled()) { | ||
1553 | - aarch64_max_tcg_initfn(obj); | ||
1554 | - } | ||
1555 | -} | ||
1556 | - | ||
1557 | static const ARMCPUInfo aarch64_cpus[] = { | ||
1558 | { .name = "cortex-a35", .initfn = aarch64_a35_initfn }, | ||
1559 | - { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, | ||
1560 | - { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, | ||
1561 | { .name = "cortex-a55", .initfn = aarch64_a55_initfn }, | ||
1562 | { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, | ||
1563 | { .name = "cortex-a76", .initfn = aarch64_a76_initfn }, | ||
1564 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, | ||
1565 | { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn }, | ||
1566 | - { .name = "max", .initfn = aarch64_max_initfn }, | ||
1567 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
1568 | - { .name = "host", .initfn = aarch64_host_initfn }, | ||
1569 | -#endif | ||
1570 | -}; | ||
1571 | - | ||
1572 | -static bool aarch64_cpu_get_aarch64(Object *obj, Error **errp) | ||
1573 | -{ | ||
1574 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1575 | - | ||
1576 | - return arm_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
1577 | -} | ||
1578 | - | ||
1579 | -static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp) | ||
1580 | -{ | ||
1581 | - ARMCPU *cpu = ARM_CPU(obj); | ||
1582 | - | ||
1583 | - /* At this time, this property is only allowed if KVM is enabled. This | ||
1584 | - * restriction allows us to avoid fixing up functionality that assumes a | ||
1585 | - * uniform execution state like do_interrupt. | ||
1586 | - */ | ||
1587 | - if (value == false) { | ||
1588 | - if (!kvm_enabled() || !kvm_arm_aarch32_supported()) { | ||
1589 | - error_setg(errp, "'aarch64' feature cannot be disabled " | ||
1590 | - "unless KVM is enabled and 32-bit EL1 " | ||
1591 | - "is supported"); | ||
1592 | - return; | ||
1593 | - } | ||
1594 | - unset_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
1595 | - } else { | ||
1596 | - set_feature(&cpu->env, ARM_FEATURE_AARCH64); | ||
1597 | - } | ||
1598 | -} | ||
1599 | - | ||
1600 | -static void aarch64_cpu_finalizefn(Object *obj) | ||
1601 | -{ | ||
1602 | -} | ||
1603 | - | ||
1604 | -static gchar *aarch64_gdb_arch_name(CPUState *cs) | ||
1605 | -{ | ||
1606 | - return g_strdup("aarch64"); | ||
1607 | -} | ||
1608 | - | ||
1609 | -static void aarch64_cpu_class_init(ObjectClass *oc, void *data) | ||
1610 | -{ | ||
1611 | - CPUClass *cc = CPU_CLASS(oc); | ||
1612 | - | ||
1613 | - cc->gdb_read_register = aarch64_cpu_gdb_read_register; | ||
1614 | - cc->gdb_write_register = aarch64_cpu_gdb_write_register; | ||
1615 | - cc->gdb_num_core_regs = 34; | ||
1616 | - cc->gdb_core_xml_file = "aarch64-core.xml"; | ||
1617 | - cc->gdb_arch_name = aarch64_gdb_arch_name; | ||
1618 | - | ||
1619 | - object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64, | ||
1620 | - aarch64_cpu_set_aarch64); | ||
1621 | - object_class_property_set_description(oc, "aarch64", | ||
1622 | - "Set on/off to enable/disable aarch64 " | ||
1623 | - "execution state "); | ||
1624 | -} | ||
1625 | - | ||
1626 | -static void aarch64_cpu_instance_init(Object *obj) | ||
1627 | -{ | ||
1628 | - ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj); | ||
1629 | - | ||
1630 | - acc->info->initfn(obj); | ||
1631 | - arm_cpu_post_init(obj); | ||
1632 | -} | ||
1633 | - | ||
1634 | -static void cpu_register_class_init(ObjectClass *oc, void *data) | ||
1635 | -{ | ||
1636 | - ARMCPUClass *acc = ARM_CPU_CLASS(oc); | ||
1637 | - | ||
1638 | - acc->info = data; | ||
1639 | -} | ||
1640 | - | ||
1641 | -void aarch64_cpu_register(const ARMCPUInfo *info) | ||
1642 | -{ | ||
1643 | - TypeInfo type_info = { | ||
1644 | - .parent = TYPE_AARCH64_CPU, | ||
1645 | - .instance_size = sizeof(ARMCPU), | ||
1646 | - .instance_init = aarch64_cpu_instance_init, | ||
1647 | - .class_size = sizeof(ARMCPUClass), | ||
1648 | - .class_init = info->class_init ?: cpu_register_class_init, | ||
1649 | - .class_data = (void *)info, | ||
1650 | - }; | ||
1651 | - | ||
1652 | - type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); | ||
1653 | - type_register(&type_info); | ||
1654 | - g_free((void *)type_info.name); | ||
1655 | -} | ||
1656 | - | ||
1657 | -static const TypeInfo aarch64_cpu_type_info = { | ||
1658 | - .name = TYPE_AARCH64_CPU, | ||
1659 | - .parent = TYPE_ARM_CPU, | ||
1660 | - .instance_size = sizeof(ARMCPU), | ||
1661 | - .instance_finalize = aarch64_cpu_finalizefn, | ||
1662 | - .abstract = true, | ||
1663 | - .class_size = sizeof(AArch64CPUClass), | ||
1664 | - .class_init = aarch64_cpu_class_init, | ||
1665 | }; | ||
1666 | |||
1667 | static void aarch64_cpu_register_types(void) | ||
1668 | { | ||
1669 | size_t i; | ||
1670 | |||
1671 | - type_register_static(&aarch64_cpu_type_info); | ||
1672 | - | ||
1673 | for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { | ||
1674 | aarch64_cpu_register(&aarch64_cpus[i]); | ||
1675 | } | ||
1676 | diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build | ||
1677 | index XXXXXXX..XXXXXXX 100644 | ||
1678 | --- a/target/arm/tcg/meson.build | ||
1679 | +++ b/target/arm/tcg/meson.build | ||
1680 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( | ||
1681 | )) | ||
1682 | |||
1683 | arm_ss.add(when: 'TARGET_AARCH64', if_true: files( | ||
1684 | + 'cpu64.c', | ||
1685 | 'translate-a64.c', | ||
1686 | 'translate-sve.c', | ||
1687 | 'translate-sme.c', | ||
33 | -- | 1688 | -- |
34 | 2.25.1 | 1689 | 2.34.1 |
35 | 1690 | ||
36 | 1691 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | The size of the code covered by a TranslationBlock cannot be 0; | 3 | We're about to move the 32-bit CPUs under CONFIG_TCG, so adjust the |
4 | this is checked via assert in tb_gen_code. | 4 | query-cpu-model-expansion test to check against the cortex-a7, which |
5 | is already under CONFIG_TCG. That allows the next patch to contain | ||
6 | only code movement. (All the test cares about is that the CPU type | ||
7 | it's checking is one which definitely doesn't work under KVM.) | ||
5 | 8 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | While here add comments clarifying what we're testing. |
10 | |||
11 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
12 | Acked-by: Thomas Huth <thuth@redhat.com> | ||
13 | Message-id: 20230426180013.14814-7-farosas@suse.de | ||
14 | Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 17 | --- |
10 | target/arm/translate-a64.c | 1 + | 18 | tests/qtest/arm-cpu-features.c | 20 +++++++++++++++++--- |
11 | 1 file changed, 1 insertion(+) | 19 | 1 file changed, 17 insertions(+), 3 deletions(-) |
12 | 20 | ||
13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 21 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c |
14 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate-a64.c | 23 | --- a/tests/qtest/arm-cpu-features.c |
16 | +++ b/target/arm/translate-a64.c | 24 | +++ b/tests/qtest/arm-cpu-features.c |
17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 25 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) |
18 | assert(s->base.num_insns == 1); | 26 | QDict *resp; |
19 | gen_swstep_exception(s, 0, 0); | 27 | char *error; |
20 | s->base.is_jmp = DISAS_NORETURN; | 28 | |
21 | + s->base.pc_next = pc + 4; | 29 | - assert_error(qts, "cortex-a15", |
22 | return; | 30 | - "We cannot guarantee the CPU type 'cortex-a15' works " |
23 | } | 31 | - "with KVM on this host", NULL); |
32 | + /* | ||
33 | + * When using KVM, only the 'host' and 'max' CPU models are | ||
34 | + * supported. Test that we're emitting a suitable error for | ||
35 | + * unsupported CPU models. | ||
36 | + */ | ||
37 | + if (qtest_has_accel("tcg")) { | ||
38 | + assert_error(qts, "cortex-a7", | ||
39 | + "We cannot guarantee the CPU type 'cortex-a7' works " | ||
40 | + "with KVM on this host", NULL); | ||
41 | + } else { | ||
42 | + /* | ||
43 | + * With a KVM-only build the 32-bit CPUs are not present. | ||
44 | + */ | ||
45 | + assert_error(qts, "cortex-a7", | ||
46 | + "The CPU type 'cortex-a7' is not a " | ||
47 | + "recognized ARM CPU type", NULL); | ||
48 | + } | ||
49 | |||
50 | assert_has_feature_enabled(qts, "host", "aarch64"); | ||
24 | 51 | ||
25 | -- | 52 | -- |
26 | 2.25.1 | 53 | 2.34.1 |
27 | 54 | ||
28 | 55 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | We do not support instantiating multiple IOMMUs. Before adding a | 3 | move the module containing cpu models definitions |
4 | virtio-iommu, check that no other IOMMU is present. This will detect | 4 | for 32bit TCG-only CPUs to tcg/ and rename it for clarity. |
5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. | ||
6 | 5 | ||
7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") | 6 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 9 | Acked-by: Thomas Huth <thuth@redhat.com> |
11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Message-id: 20230426180013.14814-8-farosas@suse.de | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 13 | --- |
14 | hw/arm/virt.c | 5 +++++ | 14 | hw/arm/virt.c | 2 -- |
15 | 1 file changed, 5 insertions(+) | 15 | target/arm/{cpu_tcg.c => tcg/cpu32.c} | 13 +++---------- |
16 | target/arm/tcg/cpu64.c | 2 +- | ||
17 | target/arm/meson.build | 1 - | ||
18 | target/arm/tcg/meson.build | 1 + | ||
19 | 5 files changed, 5 insertions(+), 14 deletions(-) | ||
20 | rename target/arm/{cpu_tcg.c => tcg/cpu32.c} (99%) | ||
16 | 21 | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 22 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
18 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 24 | --- a/hw/arm/virt.c |
20 | +++ b/hw/arm/virt.c | 25 | +++ b/hw/arm/virt.c |
21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, | 26 | @@ -XXX,XX +XXX,XX @@ static const int a15irqmap[] = { |
22 | hwaddr db_start = 0, db_end = 0; | 27 | static const char *valid_cpus[] = { |
23 | char *resv_prop_str; | 28 | #ifdef CONFIG_TCG |
24 | 29 | ARM_CPU_TYPE_NAME("cortex-a7"), | |
25 | + if (vms->iommu != VIRT_IOMMU_NONE) { | 30 | -#endif |
26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); | 31 | ARM_CPU_TYPE_NAME("cortex-a15"), |
27 | + return; | 32 | -#ifdef CONFIG_TCG |
28 | + } | 33 | ARM_CPU_TYPE_NAME("cortex-a35"), |
29 | + | 34 | ARM_CPU_TYPE_NAME("cortex-a55"), |
30 | switch (vms->msi_controller) { | 35 | ARM_CPU_TYPE_NAME("cortex-a72"), |
31 | case VIRT_MSI_CTRL_NONE: | 36 | diff --git a/target/arm/cpu_tcg.c b/target/arm/tcg/cpu32.c |
32 | return; | 37 | similarity index 99% |
38 | rename from target/arm/cpu_tcg.c | ||
39 | rename to target/arm/tcg/cpu32.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/cpu_tcg.c | ||
42 | +++ b/target/arm/tcg/cpu32.c | ||
43 | @@ -XXX,XX +XXX,XX @@ | ||
44 | /* | ||
45 | - * QEMU ARM TCG CPUs. | ||
46 | + * QEMU ARM TCG-only CPUs. | ||
47 | * | ||
48 | * Copyright (c) 2012 SUSE LINUX Products GmbH | ||
49 | * | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | |||
52 | #include "qemu/osdep.h" | ||
53 | #include "cpu.h" | ||
54 | -#ifdef CONFIG_TCG | ||
55 | #include "hw/core/tcg-cpu-ops.h" | ||
56 | -#endif /* CONFIG_TCG */ | ||
57 | #include "internals.h" | ||
58 | #include "target/arm/idau.h" | ||
59 | #if !defined(CONFIG_USER_ONLY) | ||
60 | @@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu) | ||
61 | /* CPU models. These are not needed for the AArch64 linux-user build. */ | ||
62 | #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) | ||
63 | |||
64 | -#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) | ||
65 | +#if !defined(CONFIG_USER_ONLY) | ||
66 | static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) | ||
67 | { | ||
68 | CPUClass *cc = CPU_GET_CLASS(cs); | ||
69 | @@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) | ||
70 | } | ||
71 | return ret; | ||
72 | } | ||
73 | -#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ | ||
74 | +#endif /* !CONFIG_USER_ONLY */ | ||
75 | |||
76 | static void arm926_initfn(Object *obj) | ||
77 | { | ||
78 | @@ -XXX,XX +XXX,XX @@ static void pxa270c5_initfn(Object *obj) | ||
79 | cpu->reset_sctlr = 0x00000078; | ||
80 | } | ||
81 | |||
82 | -#ifdef CONFIG_TCG | ||
83 | static const struct TCGCPUOps arm_v7m_tcg_ops = { | ||
84 | .initialize = arm_translate_init, | ||
85 | .synchronize_from_tb = arm_cpu_synchronize_from_tb, | ||
86 | @@ -XXX,XX +XXX,XX @@ static const struct TCGCPUOps arm_v7m_tcg_ops = { | ||
87 | .debug_check_breakpoint = arm_debug_check_breakpoint, | ||
88 | #endif /* !CONFIG_USER_ONLY */ | ||
89 | }; | ||
90 | -#endif /* CONFIG_TCG */ | ||
91 | |||
92 | static void arm_v7m_class_init(ObjectClass *oc, void *data) | ||
93 | { | ||
94 | @@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data) | ||
95 | CPUClass *cc = CPU_CLASS(oc); | ||
96 | |||
97 | acc->info = data; | ||
98 | -#ifdef CONFIG_TCG | ||
99 | cc->tcg_ops = &arm_v7m_tcg_ops; | ||
100 | -#endif /* CONFIG_TCG */ | ||
101 | - | ||
102 | cc->gdb_core_xml_file = "arm-m-profile.xml"; | ||
103 | } | ||
104 | |||
105 | diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/target/arm/tcg/cpu64.c | ||
108 | +++ b/target/arm/tcg/cpu64.c | ||
109 | @@ -XXX,XX +XXX,XX @@ static void aarch64_neoverse_n1_initfn(Object *obj) | ||
110 | |||
111 | /* | ||
112 | * -cpu max: a CPU with as many features enabled as our emulation supports. | ||
113 | - * The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c; | ||
114 | + * The version of '-cpu max' for qemu-system-arm is defined in cpu32.c; | ||
115 | * this only needs to handle 64 bits. | ||
116 | */ | ||
117 | void aarch64_max_tcg_initfn(Object *obj) | ||
118 | diff --git a/target/arm/meson.build b/target/arm/meson.build | ||
119 | index XXXXXXX..XXXXXXX 100644 | ||
120 | --- a/target/arm/meson.build | ||
121 | +++ b/target/arm/meson.build | ||
122 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( | ||
123 | 'gdbstub.c', | ||
124 | 'helper.c', | ||
125 | 'vfp_helper.c', | ||
126 | - 'cpu_tcg.c', | ||
127 | )) | ||
128 | arm_ss.add(zlib) | ||
129 | |||
130 | diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build | ||
131 | index XXXXXXX..XXXXXXX 100644 | ||
132 | --- a/target/arm/tcg/meson.build | ||
133 | +++ b/target/arm/tcg/meson.build | ||
134 | @@ -XXX,XX +XXX,XX @@ gen = [ | ||
135 | arm_ss.add(gen) | ||
136 | |||
137 | arm_ss.add(files( | ||
138 | + 'cpu32.c', | ||
139 | 'translate.c', | ||
140 | 'translate-m-nocp.c', | ||
141 | 'translate-mve.c', | ||
33 | -- | 142 | -- |
34 | 2.25.1 | 143 | 2.34.1 |
35 | 144 | ||
36 | 145 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Add two test cases for VIOT, one on the q35 machine and the other on | 3 | It is possible to have a build with both TCG and KVM disabled due to |
4 | virt. To test complex topologies the q35 test has two PCIe buses that | 4 | Xen requiring the i386 and x86_64 binaries to be present in an aarch64 |
5 | bypass the IOMMU (and are therefore not described by VIOT), and two | 5 | host. |
6 | buses that are translated by virtio-iommu. | ||
7 | 6 | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | If we build with --disable-tcg on the aarch64 host, we will end-up |
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 8 | with a QEMU binary (x86) that does not support TCG nor KVM. |
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 9 | |
11 | Message-id: 20211210170415.583179-7-jean-philippe@linaro.org | 10 | Skip tests that crash or hang in the above scenario. Do not include |
11 | any test cases if TCG and KVM are missing. | ||
12 | |||
13 | Make sure that calls to qtest_has_accel are placed after g_test_init | ||
14 | in similar fashion to commit ae4b01b349 ("tests: Ensure TAP version is | ||
15 | printed before other messages") to avoid TAP parsing errors. | ||
16 | |||
17 | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||
18 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
19 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
20 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
22 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
23 | Message-id: 20230426180013.14814-9-farosas@suse.de | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 25 | --- |
14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ | 26 | tests/qtest/bios-tables-test.c | 11 +++++++++-- |
15 | 1 file changed, 38 insertions(+) | 27 | tests/qtest/boot-serial-test.c | 5 +++++ |
28 | tests/qtest/migration-test.c | 9 ++++++++- | ||
29 | tests/qtest/pxe-test.c | 8 +++++++- | ||
30 | tests/qtest/vmgenid-test.c | 9 +++++++-- | ||
31 | 5 files changed, 36 insertions(+), 6 deletions(-) | ||
16 | 32 | ||
17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c | 33 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
18 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tests/qtest/bios-tables-test.c | 35 | --- a/tests/qtest/bios-tables-test.c |
20 | +++ b/tests/qtest/bios-tables-test.c | 36 | +++ b/tests/qtest/bios-tables-test.c |
21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) | 37 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_oem_fields(void) |
22 | free_test_data(&data); | 38 | int main(int argc, char *argv[]) |
23 | } | 39 | { |
24 | 40 | const char *arch = qtest_get_arch(); | |
25 | +static void test_acpi_q35_viot(void) | 41 | - const bool has_kvm = qtest_has_accel("kvm"); |
26 | +{ | 42 | - const bool has_tcg = qtest_has_accel("tcg"); |
27 | + test_data data = { | 43 | + bool has_kvm, has_tcg; |
28 | + .machine = MACHINE_Q35, | 44 | char *v_env = getenv("V"); |
29 | + .variant = ".viot", | 45 | int ret; |
30 | + }; | 46 | |
47 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | ||
48 | |||
49 | g_test_init(&argc, &argv, NULL); | ||
50 | |||
51 | + has_kvm = qtest_has_accel("kvm"); | ||
52 | + has_tcg = qtest_has_accel("tcg"); | ||
31 | + | 53 | + |
32 | + /* | 54 | + if (!has_tcg && !has_kvm) { |
33 | + * To keep things interesting, two buses bypass the IOMMU. | 55 | + g_test_skip("No KVM or TCG accelerator available"); |
34 | + * VIOT should only describes the other two buses. | 56 | + return 0; |
35 | + */ | 57 | + } |
36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " | ||
37 | + "-device virtio-iommu-pci " | ||
38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " | ||
39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " | ||
40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", | ||
41 | + &data); | ||
42 | + free_test_data(&data); | ||
43 | +} | ||
44 | + | 58 | + |
45 | +static void test_acpi_virt_viot(void) | 59 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { |
46 | +{ | 60 | ret = boot_sector_init(disk); |
47 | + test_data data = { | 61 | if (ret) { |
48 | + .machine = "virt", | 62 | diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c |
49 | + .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", | 63 | index XXXXXXX..XXXXXXX 100644 |
50 | + .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", | 64 | --- a/tests/qtest/boot-serial-test.c |
51 | + .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", | 65 | +++ b/tests/qtest/boot-serial-test.c |
52 | + .ram_start = 0x40000000ULL, | 66 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
53 | + .scan_len = 128ULL * 1024 * 1024, | 67 | |
54 | + }; | 68 | g_test_init(&argc, &argv, NULL); |
69 | |||
70 | + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { | ||
71 | + g_test_skip("No KVM or TCG accelerator available"); | ||
72 | + return 0; | ||
73 | + } | ||
55 | + | 74 | + |
56 | + test_acpi_one("-cpu cortex-a57 " | 75 | for (i = 0; tests[i].arch != NULL; i++) { |
57 | + "-device virtio-iommu-pci", &data); | 76 | if (g_str_equal(arch, tests[i].arch) && |
58 | + free_test_data(&data); | 77 | qtest_has_machine(tests[i].machine)) { |
59 | +} | 78 | diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c |
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/tests/qtest/migration-test.c | ||
81 | +++ b/tests/qtest/migration-test.c | ||
82 | @@ -XXX,XX +XXX,XX @@ static bool kvm_dirty_ring_supported(void) | ||
83 | |||
84 | int main(int argc, char **argv) | ||
85 | { | ||
86 | - bool has_kvm; | ||
87 | + bool has_kvm, has_tcg; | ||
88 | bool has_uffd; | ||
89 | const char *arch; | ||
90 | g_autoptr(GError) err = NULL; | ||
91 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
92 | g_test_init(&argc, &argv, NULL); | ||
93 | |||
94 | has_kvm = qtest_has_accel("kvm"); | ||
95 | + has_tcg = qtest_has_accel("tcg"); | ||
60 | + | 96 | + |
61 | static void test_oem_fields(test_data *data) | 97 | + if (!has_tcg && !has_kvm) { |
98 | + g_test_skip("No KVM or TCG accelerator available"); | ||
99 | + return 0; | ||
100 | + } | ||
101 | + | ||
102 | has_uffd = ufd_version_check(); | ||
103 | arch = qtest_get_arch(); | ||
104 | |||
105 | diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/tests/qtest/pxe-test.c | ||
108 | +++ b/tests/qtest/pxe-test.c | ||
109 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | ||
110 | int ret; | ||
111 | const char *arch = qtest_get_arch(); | ||
112 | |||
113 | + g_test_init(&argc, &argv, NULL); | ||
114 | + | ||
115 | + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { | ||
116 | + g_test_skip("No KVM or TCG accelerator available"); | ||
117 | + return 0; | ||
118 | + } | ||
119 | + | ||
120 | ret = boot_sector_init(disk); | ||
121 | if(ret) | ||
122 | return ret; | ||
123 | |||
124 | - g_test_init(&argc, &argv, NULL); | ||
125 | |||
126 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { | ||
127 | test_batch(x86_tests, false); | ||
128 | diff --git a/tests/qtest/vmgenid-test.c b/tests/qtest/vmgenid-test.c | ||
129 | index XXXXXXX..XXXXXXX 100644 | ||
130 | --- a/tests/qtest/vmgenid-test.c | ||
131 | +++ b/tests/qtest/vmgenid-test.c | ||
132 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
62 | { | 133 | { |
63 | int i; | 134 | int ret; |
64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | 135 | |
65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); | 136 | + g_test_init(&argc, &argv, NULL); |
66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); | 137 | + |
67 | } | 138 | + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { |
68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); | 139 | + g_test_skip("No KVM or TCG accelerator available"); |
69 | } else if (strcmp(arch, "aarch64") == 0) { | 140 | + return 0; |
70 | if (has_tcg) { | 141 | + } |
71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); | 142 | + |
72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) | 143 | ret = boot_sector_init(disk); |
73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); | 144 | if (ret) { |
74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); | 145 | return ret; |
75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); | ||
76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); | ||
77 | } | ||
78 | } | 146 | } |
79 | ret = g_test_run(); | 147 | |
148 | - g_test_init(&argc, &argv, NULL); | ||
149 | - | ||
150 | qtest_add_func("/vmgenid/vmgenid/set-guid", | ||
151 | vmgenid_set_guid_test); | ||
152 | qtest_add_func("/vmgenid/vmgenid/set-guid-auto", | ||
80 | -- | 153 | -- |
81 | 2.25.1 | 154 | 2.34.1 |
82 | 155 | ||
83 | 156 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | The VIOT blob contains the following: | 3 | The migration tests are currently broken for an aarch64 host because |
4 | the tests pass no 'machine' and 'cpu' options on the QEMU command | ||
5 | line. | ||
4 | 6 | ||
5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | 7 | Add a separate class to each architecture so that we can specify |
6 | [004h 0004 4] Table Length : 00000058 | 8 | 'machine' and 'cpu' options instead of relying on defaults. |
7 | [008h 0008 1] Revision : 00 | ||
8 | [009h 0009 1] Checksum : 66 | ||
9 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
10 | [010h 0016 8] Oem Table ID : "BXPC " | ||
11 | [018h 0024 4] Oem Revision : 00000001 | ||
12 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
13 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
14 | 9 | ||
15 | [024h 0036 2] Node count : 0002 | 10 | Add a skip decorator to keep the current behavior of only running |
16 | [026h 0038 2] Node offset : 0030 | 11 | migration tests when the qemu target matches the host architecture. |
17 | [028h 0040 8] Reserved : 0000000000000000 | ||
18 | 12 | ||
19 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
20 | [031h 0049 1] Reserved : 00 | 14 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
21 | [032h 0050 2] Length : 0010 | 15 | Message-id: 20230426180013.14814-10-farosas@suse.de |
22 | |||
23 | [034h 0052 2] PCI Segment : 0000 | ||
24 | [036h 0054 2] PCI BDF number : 0008 | ||
25 | [038h 0056 8] Reserved : 0000000000000000 | ||
26 | |||
27 | [040h 0064 1] Type : 01 [PCI Range] | ||
28 | [041h 0065 1] Reserved : 00 | ||
29 | [042h 0066 2] Length : 0018 | ||
30 | |||
31 | [044h 0068 4] Endpoint start : 00000000 | ||
32 | [048h 0072 2] PCI Segment start : 0000 | ||
33 | [04Ah 0074 2] PCI Segment end : 0000 | ||
34 | [04Ch 0076 2] PCI BDF start : 0000 | ||
35 | [04Eh 0078 2] PCI BDF end : 00FF | ||
36 | [050h 0080 2] Output node : 0030 | ||
37 | [052h 0082 6] Reserved : 000000000000 | ||
38 | |||
39 | Acked-by: Ani Sinha <ani@anisinha.ca> | ||
40 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
41 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
42 | Message-id: 20211210170415.583179-9-jean-philippe@linaro.org | ||
43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
44 | --- | 17 | --- |
45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - | 18 | tests/avocado/migration.py | 83 +++++++++++++++++++++++++++++++++++--- |
46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes | 19 | 1 file changed, 78 insertions(+), 5 deletions(-) |
47 | 2 files changed, 1 deletion(-) | ||
48 | 20 | ||
49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | 21 | diff --git a/tests/avocado/migration.py b/tests/avocado/migration.py |
50 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | 23 | --- a/tests/avocado/migration.py |
52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | 24 | +++ b/tests/avocado/migration.py |
53 | @@ -1,2 +1 @@ | 25 | @@ -XXX,XX +XXX,XX @@ |
54 | /* List of comma-separated changed AML files to ignore */ | 26 | |
55 | -"tests/data/acpi/virt/VIOT", | 27 | |
56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT | 28 | import tempfile |
57 | index XXXXXXX..XXXXXXX 100644 | 29 | +import os |
58 | GIT binary patch | 30 | + |
59 | literal 88 | 31 | from avocado_qemu import QemuSystemTest |
60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX | 32 | from avocado import skipUnless |
61 | I{D-Rq0Q5fy0RR91 | 33 | |
62 | 34 | @@ -XXX,XX +XXX,XX @@ | |
63 | literal 0 | 35 | from avocado.utils.path import find_command |
64 | HcmV?d00001 | 36 | |
65 | 37 | ||
38 | -class Migration(QemuSystemTest): | ||
39 | +class MigrationTest(QemuSystemTest): | ||
40 | """ | ||
41 | :avocado: tags=migration | ||
42 | """ | ||
43 | @@ -XXX,XX +XXX,XX @@ def _get_free_port(self): | ||
44 | self.cancel('Failed to find a free port') | ||
45 | return port | ||
46 | |||
47 | - | ||
48 | - def test_migration_with_tcp_localhost(self): | ||
49 | + def migration_with_tcp_localhost(self): | ||
50 | dest_uri = 'tcp:localhost:%u' % self._get_free_port() | ||
51 | self.do_migrate(dest_uri) | ||
52 | |||
53 | - def test_migration_with_unix(self): | ||
54 | + def migration_with_unix(self): | ||
55 | with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: | ||
56 | dest_uri = 'unix:%s/qemu-test.sock' % socket_path | ||
57 | self.do_migrate(dest_uri) | ||
58 | |||
59 | @skipUnless(find_command('nc', default=False), "'nc' command not found") | ||
60 | - def test_migration_with_exec(self): | ||
61 | + def migration_with_exec(self): | ||
62 | """The test works for both netcat-traditional and netcat-openbsd packages.""" | ||
63 | free_port = self._get_free_port() | ||
64 | dest_uri = 'exec:nc -l localhost %u' % free_port | ||
65 | src_uri = 'exec:nc localhost %u' % free_port | ||
66 | self.do_migrate(dest_uri, src_uri) | ||
67 | + | ||
68 | + | ||
69 | +@skipUnless('aarch64' in os.uname()[4], "host != target") | ||
70 | +class Aarch64(MigrationTest): | ||
71 | + """ | ||
72 | + :avocado: tags=arch:aarch64 | ||
73 | + :avocado: tags=machine:virt | ||
74 | + :avocado: tags=cpu:max | ||
75 | + """ | ||
76 | + | ||
77 | + def test_migration_with_tcp_localhost(self): | ||
78 | + self.migration_with_tcp_localhost() | ||
79 | + | ||
80 | + def test_migration_with_unix(self): | ||
81 | + self.migration_with_unix() | ||
82 | + | ||
83 | + def test_migration_with_exec(self): | ||
84 | + self.migration_with_exec() | ||
85 | + | ||
86 | + | ||
87 | +@skipUnless('x86_64' in os.uname()[4], "host != target") | ||
88 | +class X86_64(MigrationTest): | ||
89 | + """ | ||
90 | + :avocado: tags=arch:x86_64 | ||
91 | + :avocado: tags=machine:pc | ||
92 | + :avocado: tags=cpu:qemu64 | ||
93 | + """ | ||
94 | + | ||
95 | + def test_migration_with_tcp_localhost(self): | ||
96 | + self.migration_with_tcp_localhost() | ||
97 | + | ||
98 | + def test_migration_with_unix(self): | ||
99 | + self.migration_with_unix() | ||
100 | + | ||
101 | + def test_migration_with_exec(self): | ||
102 | + self.migration_with_exec() | ||
103 | + | ||
104 | + | ||
105 | +@skipUnless('ppc64le' in os.uname()[4], "host != target") | ||
106 | +class PPC64(MigrationTest): | ||
107 | + """ | ||
108 | + :avocado: tags=arch:ppc64 | ||
109 | + :avocado: tags=machine:pseries | ||
110 | + :avocado: tags=cpu:power9_v2.0 | ||
111 | + """ | ||
112 | + | ||
113 | + def test_migration_with_tcp_localhost(self): | ||
114 | + self.migration_with_tcp_localhost() | ||
115 | + | ||
116 | + def test_migration_with_unix(self): | ||
117 | + self.migration_with_unix() | ||
118 | + | ||
119 | + def test_migration_with_exec(self): | ||
120 | + self.migration_with_exec() | ||
121 | + | ||
122 | + | ||
123 | +@skipUnless('s390x' in os.uname()[4], "host != target") | ||
124 | +class S390X(MigrationTest): | ||
125 | + """ | ||
126 | + :avocado: tags=arch:s390x | ||
127 | + :avocado: tags=machine:s390-ccw-virtio | ||
128 | + :avocado: tags=cpu:qemu | ||
129 | + """ | ||
130 | + | ||
131 | + def test_migration_with_tcp_localhost(self): | ||
132 | + self.migration_with_tcp_localhost() | ||
133 | + | ||
134 | + def test_migration_with_unix(self): | ||
135 | + self.migration_with_unix() | ||
136 | + | ||
137 | + def test_migration_with_exec(self): | ||
138 | + self.migration_with_exec() | ||
66 | -- | 139 | -- |
67 | 2.25.1 | 140 | 2.34.1 |
68 | 141 | ||
69 | 142 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the | 3 | We are about to enable the build without TCG, so CONFIG_SEMIHOSTING |
4 | q35 machine. | 4 | and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in |
5 | default.mak anymore. So reflect the change in a Kconfig. | ||
5 | 6 | ||
6 | Since the test instantiates a virtio device and two PCIe expander | 7 | Instead of using semihosting/Kconfig, use a target-specific file, so |
7 | bridges, DSDT.viot has more blocks than the base DSDT. | 8 | that the change doesn't affect other architectures which might |
9 | implement semihosting in a way compatible with KVM. | ||
8 | 10 | ||
9 | The VIOT table generated for the q35 test is: | 11 | The selection from ARM_v7M needs to be removed to avoid a cycle during |
12 | parsing. | ||
10 | 13 | ||
11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | 14 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
12 | [004h 0004 4] Table Length : 00000070 | 15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | [008h 0008 1] Revision : 00 | 16 | Message-id: 20230426180013.14814-11-farosas@suse.de |
14 | [009h 0009 1] Checksum : 3D | ||
15 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
16 | [010h 0016 8] Oem Table ID : "BXPC " | ||
17 | [018h 0024 4] Oem Revision : 00000001 | ||
18 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
19 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
20 | |||
21 | [024h 0036 2] Node count : 0003 | ||
22 | [026h 0038 2] Node offset : 0030 | ||
23 | [028h 0040 8] Reserved : 0000000000000000 | ||
24 | |||
25 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
26 | [031h 0049 1] Reserved : 00 | ||
27 | [032h 0050 2] Length : 0010 | ||
28 | |||
29 | [034h 0052 2] PCI Segment : 0000 | ||
30 | [036h 0054 2] PCI BDF number : 0010 | ||
31 | [038h 0056 8] Reserved : 0000000000000000 | ||
32 | |||
33 | [040h 0064 1] Type : 01 [PCI Range] | ||
34 | [041h 0065 1] Reserved : 00 | ||
35 | [042h 0066 2] Length : 0018 | ||
36 | |||
37 | [044h 0068 4] Endpoint start : 00003000 | ||
38 | [048h 0072 2] PCI Segment start : 0000 | ||
39 | [04Ah 0074 2] PCI Segment end : 0000 | ||
40 | [04Ch 0076 2] PCI BDF start : 3000 | ||
41 | [04Eh 0078 2] PCI BDF end : 30FF | ||
42 | [050h 0080 2] Output node : 0030 | ||
43 | [052h 0082 6] Reserved : 000000000000 | ||
44 | |||
45 | [058h 0088 1] Type : 01 [PCI Range] | ||
46 | [059h 0089 1] Reserved : 00 | ||
47 | [05Ah 0090 2] Length : 0018 | ||
48 | |||
49 | [05Ch 0092 4] Endpoint start : 00001000 | ||
50 | [060h 0096 2] PCI Segment start : 0000 | ||
51 | [062h 0098 2] PCI Segment end : 0000 | ||
52 | [064h 0100 2] PCI BDF start : 1000 | ||
53 | [066h 0102 2] PCI BDF end : 10FF | ||
54 | [068h 0104 2] Output node : 0030 | ||
55 | [06Ah 0106 6] Reserved : 000000000000 | ||
56 | |||
57 | And the DSDT diff is: | ||
58 | |||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | * | ||
61 | * Disassembling to symbolic ASL+ operators | ||
62 | * | ||
63 | - * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021 | ||
64 | + * Disassembly of /tmp/aml-H9Y5D1, Fri Dec 10 15:02:27 2021 | ||
65 | * | ||
66 | * Original Table Header: | ||
67 | * Signature "DSDT" | ||
68 | - * Length 0x00002061 (8289) | ||
69 | + * Length 0x000024B6 (9398) | ||
70 | * Revision 0x01 **** 32-bit table (V1), no 64-bit math support | ||
71 | - * Checksum 0xFA | ||
72 | + * Checksum 0xA7 | ||
73 | * OEM ID "BOCHS " | ||
74 | * OEM Table ID "BXPC " | ||
75 | * OEM Revision 0x00000001 (1) | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | } | ||
78 | } | ||
79 | |||
80 | + Scope (\_SB) | ||
81 | + { | ||
82 | + Device (PC30) | ||
83 | + { | ||
84 | + Name (_UID, 0x30) // _UID: Unique ID | ||
85 | + Name (_BBN, 0x30) // _BBN: BIOS Bus Number | ||
86 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
87 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
88 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
89 | + { | ||
90 | + CreateDWordField (Arg3, Zero, CDW1) | ||
91 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
92 | + { | ||
93 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
94 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
95 | + Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */ | ||
96 | + Local0 &= 0x1F | ||
97 | + If ((Arg1 != One)) | ||
98 | + { | ||
99 | + CDW1 |= 0x08 | ||
100 | + } | ||
101 | + | ||
102 | + If ((CDW3 != Local0)) | ||
103 | + { | ||
104 | + CDW1 |= 0x10 | ||
105 | + } | ||
106 | + | ||
107 | + CDW3 = Local0 | ||
108 | + } | ||
109 | + Else | ||
110 | + { | ||
111 | + CDW1 |= 0x04 | ||
112 | + } | ||
113 | + | ||
114 | + Return (Arg3) | ||
115 | + } | ||
116 | + | ||
117 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
118 | + { | ||
119 | + Local0 = Package (0x80){} | ||
120 | + Local1 = Zero | ||
121 | + While ((Local1 < 0x80)) | ||
122 | + { | ||
123 | + Local2 = (Local1 >> 0x02) | ||
124 | + Local3 = ((Local1 + Local2) & 0x03) | ||
125 | + If ((Local3 == Zero)) | ||
126 | + { | ||
127 | + Local4 = Package (0x04) | ||
128 | + { | ||
129 | + Zero, | ||
130 | + Zero, | ||
131 | + LNKD, | ||
132 | + Zero | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + If ((Local3 == One)) | ||
137 | + { | ||
138 | + Local4 = Package (0x04) | ||
139 | + { | ||
140 | + Zero, | ||
141 | + Zero, | ||
142 | + LNKA, | ||
143 | + Zero | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + If ((Local3 == 0x02)) | ||
148 | + { | ||
149 | + Local4 = Package (0x04) | ||
150 | + { | ||
151 | + Zero, | ||
152 | + Zero, | ||
153 | + LNKB, | ||
154 | + Zero | ||
155 | + } | ||
156 | + } | ||
157 | + | ||
158 | + If ((Local3 == 0x03)) | ||
159 | + { | ||
160 | + Local4 = Package (0x04) | ||
161 | + { | ||
162 | + Zero, | ||
163 | + Zero, | ||
164 | + LNKC, | ||
165 | + Zero | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
170 | + Local4 [One] = (Local1 & 0x03) | ||
171 | + Local0 [Local1] = Local4 | ||
172 | + Local1++ | ||
173 | + } | ||
174 | + | ||
175 | + Return (Local0) | ||
176 | + } | ||
177 | + | ||
178 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
179 | + { | ||
180 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
181 | + 0x0000, // Granularity | ||
182 | + 0x0030, // Range Minimum | ||
183 | + 0x0030, // Range Maximum | ||
184 | + 0x0000, // Translation Offset | ||
185 | + 0x0001, // Length | ||
186 | + ,, ) | ||
187 | + }) | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + Scope (\_SB) | ||
192 | + { | ||
193 | + Device (PC20) | ||
194 | + { | ||
195 | + Name (_UID, 0x20) // _UID: Unique ID | ||
196 | + Name (_BBN, 0x20) // _BBN: BIOS Bus Number | ||
197 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
198 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
199 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
200 | + { | ||
201 | + CreateDWordField (Arg3, Zero, CDW1) | ||
202 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
203 | + { | ||
204 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
205 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
206 | + Local0 = CDW3 /* \_SB_.PC20._OSC.CDW3 */ | ||
207 | + Local0 &= 0x1F | ||
208 | + If ((Arg1 != One)) | ||
209 | + { | ||
210 | + CDW1 |= 0x08 | ||
211 | + } | ||
212 | + | ||
213 | + If ((CDW3 != Local0)) | ||
214 | + { | ||
215 | + CDW1 |= 0x10 | ||
216 | + } | ||
217 | + | ||
218 | + CDW3 = Local0 | ||
219 | + } | ||
220 | + Else | ||
221 | + { | ||
222 | + CDW1 |= 0x04 | ||
223 | + } | ||
224 | + | ||
225 | + Return (Arg3) | ||
226 | + } | ||
227 | + | ||
228 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
229 | + { | ||
230 | + Local0 = Package (0x80){} | ||
231 | + Local1 = Zero | ||
232 | + While ((Local1 < 0x80)) | ||
233 | + { | ||
234 | + Local2 = (Local1 >> 0x02) | ||
235 | + Local3 = ((Local1 + Local2) & 0x03) | ||
236 | + If ((Local3 == Zero)) | ||
237 | + { | ||
238 | + Local4 = Package (0x04) | ||
239 | + { | ||
240 | + Zero, | ||
241 | + Zero, | ||
242 | + LNKD, | ||
243 | + Zero | ||
244 | + } | ||
245 | + } | ||
246 | + | ||
247 | + If ((Local3 == One)) | ||
248 | + { | ||
249 | + Local4 = Package (0x04) | ||
250 | + { | ||
251 | + Zero, | ||
252 | + Zero, | ||
253 | + LNKA, | ||
254 | + Zero | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
258 | + If ((Local3 == 0x02)) | ||
259 | + { | ||
260 | + Local4 = Package (0x04) | ||
261 | + { | ||
262 | + Zero, | ||
263 | + Zero, | ||
264 | + LNKB, | ||
265 | + Zero | ||
266 | + } | ||
267 | + } | ||
268 | + | ||
269 | + If ((Local3 == 0x03)) | ||
270 | + { | ||
271 | + Local4 = Package (0x04) | ||
272 | + { | ||
273 | + Zero, | ||
274 | + Zero, | ||
275 | + LNKC, | ||
276 | + Zero | ||
277 | + } | ||
278 | + } | ||
279 | + | ||
280 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
281 | + Local4 [One] = (Local1 & 0x03) | ||
282 | + Local0 [Local1] = Local4 | ||
283 | + Local1++ | ||
284 | + } | ||
285 | + | ||
286 | + Return (Local0) | ||
287 | + } | ||
288 | + | ||
289 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
290 | + { | ||
291 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
292 | + 0x0000, // Granularity | ||
293 | + 0x0020, // Range Minimum | ||
294 | + 0x0020, // Range Maximum | ||
295 | + 0x0000, // Translation Offset | ||
296 | + 0x0001, // Length | ||
297 | + ,, ) | ||
298 | + }) | ||
299 | + } | ||
300 | + } | ||
301 | + | ||
302 | + Scope (\_SB) | ||
303 | + { | ||
304 | + Device (PC10) | ||
305 | + { | ||
306 | + Name (_UID, 0x10) // _UID: Unique ID | ||
307 | + Name (_BBN, 0x10) // _BBN: BIOS Bus Number | ||
308 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
309 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
310 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
311 | + { | ||
312 | + CreateDWordField (Arg3, Zero, CDW1) | ||
313 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
314 | + { | ||
315 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
316 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
317 | + Local0 = CDW3 /* \_SB_.PC10._OSC.CDW3 */ | ||
318 | + Local0 &= 0x1F | ||
319 | + If ((Arg1 != One)) | ||
320 | + { | ||
321 | + CDW1 |= 0x08 | ||
322 | + } | ||
323 | + | ||
324 | + If ((CDW3 != Local0)) | ||
325 | + { | ||
326 | + CDW1 |= 0x10 | ||
327 | + } | ||
328 | + | ||
329 | + CDW3 = Local0 | ||
330 | + } | ||
331 | + Else | ||
332 | + { | ||
333 | + CDW1 |= 0x04 | ||
334 | + } | ||
335 | + | ||
336 | + Return (Arg3) | ||
337 | + } | ||
338 | + | ||
339 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
340 | + { | ||
341 | + Local0 = Package (0x80){} | ||
342 | + Local1 = Zero | ||
343 | + While ((Local1 < 0x80)) | ||
344 | + { | ||
345 | + Local2 = (Local1 >> 0x02) | ||
346 | + Local3 = ((Local1 + Local2) & 0x03) | ||
347 | + If ((Local3 == Zero)) | ||
348 | + { | ||
349 | + Local4 = Package (0x04) | ||
350 | + { | ||
351 | + Zero, | ||
352 | + Zero, | ||
353 | + LNKD, | ||
354 | + Zero | ||
355 | + } | ||
356 | + } | ||
357 | + | ||
358 | + If ((Local3 == One)) | ||
359 | + { | ||
360 | + Local4 = Package (0x04) | ||
361 | + { | ||
362 | + Zero, | ||
363 | + Zero, | ||
364 | + LNKA, | ||
365 | + Zero | ||
366 | + } | ||
367 | + } | ||
368 | + | ||
369 | + If ((Local3 == 0x02)) | ||
370 | + { | ||
371 | + Local4 = Package (0x04) | ||
372 | + { | ||
373 | + Zero, | ||
374 | + Zero, | ||
375 | + LNKB, | ||
376 | + Zero | ||
377 | + } | ||
378 | + } | ||
379 | + | ||
380 | + If ((Local3 == 0x03)) | ||
381 | + { | ||
382 | + Local4 = Package (0x04) | ||
383 | + { | ||
384 | + Zero, | ||
385 | + Zero, | ||
386 | + LNKC, | ||
387 | + Zero | ||
388 | + } | ||
389 | + } | ||
390 | + | ||
391 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
392 | + Local4 [One] = (Local1 & 0x03) | ||
393 | + Local0 [Local1] = Local4 | ||
394 | + Local1++ | ||
395 | + } | ||
396 | + | ||
397 | + Return (Local0) | ||
398 | + } | ||
399 | + | ||
400 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
401 | + { | ||
402 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
403 | + 0x0000, // Granularity | ||
404 | + 0x0010, // Range Minimum | ||
405 | + 0x0010, // Range Maximum | ||
406 | + 0x0000, // Translation Offset | ||
407 | + 0x0001, // Length | ||
408 | + ,, ) | ||
409 | + }) | ||
410 | + } | ||
411 | + } | ||
412 | + | ||
413 | Scope (\_SB.PCI0) | ||
414 | { | ||
415 | Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
416 | @@ -XXX,XX +XXX,XX @@ | ||
417 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
418 | 0x0000, // Granularity | ||
419 | 0x0000, // Range Minimum | ||
420 | - 0x00FF, // Range Maximum | ||
421 | + 0x000F, // Range Maximum | ||
422 | 0x0000, // Translation Offset | ||
423 | - 0x0100, // Length | ||
424 | + 0x0010, // Length | ||
425 | ,, ) | ||
426 | IO (Decode16, | ||
427 | 0x0CF8, // Range Minimum | ||
428 | @@ -XXX,XX +XXX,XX @@ | ||
429 | } | ||
430 | } | ||
431 | |||
432 | + Device (S10) | ||
433 | + { | ||
434 | + Name (_ADR, 0x00020000) // _ADR: Address | ||
435 | + } | ||
436 | + | ||
437 | + Device (S18) | ||
438 | + { | ||
439 | + Name (_ADR, 0x00030000) // _ADR: Address | ||
440 | + } | ||
441 | + | ||
442 | + Device (S20) | ||
443 | + { | ||
444 | + Name (_ADR, 0x00040000) // _ADR: Address | ||
445 | + } | ||
446 | + | ||
447 | + Device (S28) | ||
448 | + { | ||
449 | + Name (_ADR, 0x00050000) // _ADR: Address | ||
450 | + } | ||
451 | + | ||
452 | Method (PCNT, 0, NotSerialized) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
457 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
458 | Message-id: 20211210170415.583179-8-jean-philippe@linaro.org | ||
459 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
460 | --- | 18 | --- |
461 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- | 19 | configs/devices/arm-softmmu/default.mak | 2 -- |
462 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | 20 | hw/arm/Kconfig | 1 - |
463 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | 21 | target/arm/Kconfig | 7 +++++++ |
464 | 3 files changed, 2 deletions(-) | 22 | 3 files changed, 7 insertions(+), 3 deletions(-) |
465 | 23 | ||
466 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | 24 | diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak |
467 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
468 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | 26 | --- a/configs/devices/arm-softmmu/default.mak |
469 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | 27 | +++ b/configs/devices/arm-softmmu/default.mak |
470 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ CONFIG_MICROBIT=y |
471 | /* List of comma-separated changed AML files to ignore */ | 29 | CONFIG_FSL_IMX25=y |
472 | "tests/data/acpi/virt/VIOT", | 30 | CONFIG_FSL_IMX7=y |
473 | -"tests/data/acpi/q35/DSDT.viot", | 31 | CONFIG_FSL_IMX6UL=y |
474 | -"tests/data/acpi/q35/VIOT.viot", | 32 | -CONFIG_SEMIHOSTING=y |
475 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | 33 | -CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y |
34 | CONFIG_ALLWINNER_H3=y | ||
35 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
476 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
477 | GIT binary patch | 37 | --- a/hw/arm/Kconfig |
478 | literal 9398 | 38 | +++ b/hw/arm/Kconfig |
479 | zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_ | 39 | @@ -XXX,XX +XXX,XX @@ config ARM_V7M |
480 | z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C | 40 | # currently v7M must be included in a TCG build due to translate.c |
481 | zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN | 41 | default y if TCG && (ARM || AARCH64) |
482 | zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1 | 42 | select PTIMER |
483 | zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS | 43 | - select ARM_COMPATIBLE_SEMIHOSTING |
484 | zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~# | 44 | |
485 | z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW% | 45 | config ALLWINNER_A10 |
486 | z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^ | 46 | bool |
487 | z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG | 47 | diff --git a/target/arm/Kconfig b/target/arm/Kconfig |
488 | z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm | ||
489 | znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8 | ||
490 | zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn | ||
491 | zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l | ||
492 | zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?)) | ||
493 | zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N | ||
494 | zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-< | ||
495 | z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ | ||
496 | z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4 | ||
497 | zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_ | ||
498 | zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^= | ||
499 | zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn>< | ||
500 | zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w} | ||
501 | zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t | ||
502 | zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3 | ||
503 | zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`& | ||
504 | zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V | ||
505 | zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq| | ||
506 | zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO< | ||
507 | zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf | ||
508 | zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb} | ||
509 | zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC | ||
510 | z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_# | ||
511 | zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4 | ||
512 | z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0 | ||
513 | zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T | ||
514 | zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq | ||
515 | zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp | ||
516 | zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a | ||
517 | zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD | ||
518 | zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l | ||
519 | zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5 | ||
520 | z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON | ||
521 | zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P> | ||
522 | zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s | ||
523 | zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q | ||
524 | z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ | ||
525 | zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N | ||
526 | z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D= | ||
527 | zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P | ||
528 | zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF | ||
529 | z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4 | ||
530 | z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6 | ||
531 | zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG | ||
532 | z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi | ||
533 | zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr | ||
534 | zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l? | ||
535 | zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG | ||
536 | zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a | ||
537 | zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl | ||
538 | zarZy6590|88pi(1zq;V(>38zM0sT&<zX;R5$1w3;`_JMG`;&I&0Y23DMx1%@(w(R9 | ||
539 | z4M$j;D5J+Gy%fijRQsctzFKf&cv|BAz#YLq3CZJWDdtL4u1u1|mkdcUp7|sxJC+?Y | ||
540 | z_@@s`v3j}Q7*z>6X~cwUxUL8G1KT)_XTp!KAbs;vCp{K3&~_X@+ew=-D}v`2MbFV0 | ||
541 | zQsVsL=rXi-pI*G|iiz;VTCutgUs)hDzV1+4?8KcoP3xROf<M%qC6lgVdpFt4<-|uM | ||
542 | z=#rl_b1#YjSIl6Toj2z_hOZcKupkdE(LozC(fN=FY(x|sk)ym|;Rq2E1xJWD%Z!ol | ||
543 | Gu>S+TT-130 | ||
544 | |||
545 | literal 0 | ||
546 | HcmV?d00001 | ||
547 | |||
548 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot | ||
549 | index XXXXXXX..XXXXXXX 100644 | 48 | index XXXXXXX..XXXXXXX 100644 |
550 | GIT binary patch | 49 | --- a/target/arm/Kconfig |
551 | literal 112 | 50 | +++ b/target/arm/Kconfig |
552 | zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj | 51 | @@ -XXX,XX +XXX,XX @@ config ARM |
553 | Q0Zb)W9Hva*zW_`e0M!8s0RR91 | 52 | config AARCH64 |
554 | 53 | bool | |
555 | literal 0 | 54 | select ARM |
556 | HcmV?d00001 | 55 | + |
557 | 56 | +# This config exists just so we can make SEMIHOSTING default when TCG | |
57 | +# is selected without also changing it for other architectures. | ||
58 | +config ARM_SEMIHOSTING | ||
59 | + bool | ||
60 | + default y if TCG && ARM | ||
61 | + select ARM_COMPATIBLE_SEMIHOSTING | ||
558 | -- | 62 | -- |
559 | 2.25.1 | 63 | 2.34.1 |
560 | |||
561 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT | 3 | Move all the CONFIG_FOO=y from default.mak into "default y if TCG" |
4 | table. | 4 | statements in Kconfig. That way they won't be selected when |
5 | 5 | CONFIG_TCG=n. | |
6 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 6 | |
7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | I'm leaving CONFIG_ARM_VIRT in default.mak because it allows us to |
8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 8 | keep the two default.mak files not empty and keep aarch64-default.mak |
9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org | 9 | including arm-default.mak. That way we don't surprise anyone that's |
10 | used to altering these files. | ||
11 | |||
12 | With this change we can start building with --disable-tcg. | ||
13 | |||
14 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20230426180013.14814-12-farosas@suse.de | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 18 | --- |
12 | hw/arm/virt-acpi-build.c | 7 +++++++ | 19 | configs/devices/aarch64-softmmu/default.mak | 4 -- |
13 | hw/arm/Kconfig | 1 + | 20 | configs/devices/arm-softmmu/default.mak | 37 ------------------ |
14 | 2 files changed, 8 insertions(+) | 21 | hw/arm/Kconfig | 42 ++++++++++++++++++++- |
15 | 22 | 3 files changed, 41 insertions(+), 42 deletions(-) | |
16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c | 23 | |
24 | diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak | ||
17 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/virt-acpi-build.c | 26 | --- a/configs/devices/aarch64-softmmu/default.mak |
19 | +++ b/hw/arm/virt-acpi-build.c | 27 | +++ b/configs/devices/aarch64-softmmu/default.mak |
20 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ |
21 | #include "kvm_arm.h" | 29 | |
22 | #include "migration/vmstate.h" | 30 | # We support all the 32 bit boards so need all their config |
23 | #include "hw/acpi/ghes.h" | 31 | include ../arm-softmmu/default.mak |
24 | +#include "hw/acpi/viot.h" | 32 | - |
25 | 33 | -CONFIG_XLNX_ZYNQMP_ARM=y | |
26 | #define ARM_SPI_BASE 32 | 34 | -CONFIG_XLNX_VERSAL=y |
27 | 35 | -CONFIG_SBSA_REF=y | |
28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) | 36 | diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak |
29 | } | 37 | index XXXXXXX..XXXXXXX 100644 |
30 | #endif | 38 | --- a/configs/devices/arm-softmmu/default.mak |
31 | 39 | +++ b/configs/devices/arm-softmmu/default.mak | |
32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { | 40 | @@ -XXX,XX +XXX,XX @@ |
33 | + acpi_add_table(table_offsets, tables_blob); | 41 | # CONFIG_TEST_DEVICES=n |
34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, | 42 | |
35 | + vms->oem_id, vms->oem_table_id); | 43 | CONFIG_ARM_VIRT=y |
36 | + } | 44 | -CONFIG_CUBIEBOARD=y |
37 | + | 45 | -CONFIG_EXYNOS4=y |
38 | /* XSDT is pointed to by RSDP */ | 46 | -CONFIG_HIGHBANK=y |
39 | xsdt = tables_blob->len; | 47 | -CONFIG_INTEGRATOR=y |
40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, | 48 | -CONFIG_FSL_IMX31=y |
49 | -CONFIG_MUSICPAL=y | ||
50 | -CONFIG_MUSCA=y | ||
51 | -CONFIG_CHEETAH=y | ||
52 | -CONFIG_SX1=y | ||
53 | -CONFIG_NSERIES=y | ||
54 | -CONFIG_STELLARIS=y | ||
55 | -CONFIG_STM32VLDISCOVERY=y | ||
56 | -CONFIG_REALVIEW=y | ||
57 | -CONFIG_VERSATILE=y | ||
58 | -CONFIG_VEXPRESS=y | ||
59 | -CONFIG_ZYNQ=y | ||
60 | -CONFIG_MAINSTONE=y | ||
61 | -CONFIG_GUMSTIX=y | ||
62 | -CONFIG_SPITZ=y | ||
63 | -CONFIG_TOSA=y | ||
64 | -CONFIG_Z2=y | ||
65 | -CONFIG_NPCM7XX=y | ||
66 | -CONFIG_COLLIE=y | ||
67 | -CONFIG_ASPEED_SOC=y | ||
68 | -CONFIG_NETDUINO2=y | ||
69 | -CONFIG_NETDUINOPLUS2=y | ||
70 | -CONFIG_OLIMEX_STM32_H405=y | ||
71 | -CONFIG_MPS2=y | ||
72 | -CONFIG_RASPI=y | ||
73 | -CONFIG_DIGIC=y | ||
74 | -CONFIG_SABRELITE=y | ||
75 | -CONFIG_EMCRAFT_SF2=y | ||
76 | -CONFIG_MICROBIT=y | ||
77 | -CONFIG_FSL_IMX25=y | ||
78 | -CONFIG_FSL_IMX7=y | ||
79 | -CONFIG_FSL_IMX6UL=y | ||
80 | -CONFIG_ALLWINNER_H3=y | ||
41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 81 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
42 | index XXXXXXX..XXXXXXX 100644 | 82 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/hw/arm/Kconfig | 83 | --- a/hw/arm/Kconfig |
44 | +++ b/hw/arm/Kconfig | 84 | +++ b/hw/arm/Kconfig |
45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | 85 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
46 | select DIMM | ||
47 | select ACPI_HW_REDUCED | ||
48 | select ACPI_APEI | ||
49 | + select ACPI_VIOT | ||
50 | 86 | ||
51 | config CHEETAH | 87 | config CHEETAH |
52 | bool | 88 | bool |
89 | + default y if TCG && ARM | ||
90 | select OMAP | ||
91 | select TSC210X | ||
92 | |||
93 | config CUBIEBOARD | ||
94 | bool | ||
95 | + default y if TCG && ARM | ||
96 | select ALLWINNER_A10 | ||
97 | |||
98 | config DIGIC | ||
99 | bool | ||
100 | + default y if TCG && ARM | ||
101 | select PTIMER | ||
102 | select PFLASH_CFI02 | ||
103 | |||
104 | config EXYNOS4 | ||
105 | bool | ||
106 | + default y if TCG && ARM | ||
107 | imply I2C_DEVICES | ||
108 | select A9MPCORE | ||
109 | select I2C | ||
110 | @@ -XXX,XX +XXX,XX @@ config EXYNOS4 | ||
111 | |||
112 | config HIGHBANK | ||
113 | bool | ||
114 | + default y if TCG && ARM | ||
115 | select A9MPCORE | ||
116 | select A15MPCORE | ||
117 | select AHCI | ||
118 | @@ -XXX,XX +XXX,XX @@ config HIGHBANK | ||
119 | |||
120 | config INTEGRATOR | ||
121 | bool | ||
122 | + default y if TCG && ARM | ||
123 | select ARM_TIMER | ||
124 | select INTEGRATOR_DEBUG | ||
125 | select PL011 # UART | ||
126 | @@ -XXX,XX +XXX,XX @@ config INTEGRATOR | ||
127 | |||
128 | config MAINSTONE | ||
129 | bool | ||
130 | + default y if TCG && ARM | ||
131 | select PXA2XX | ||
132 | select PFLASH_CFI01 | ||
133 | select SMC91C111 | ||
134 | |||
135 | config MUSCA | ||
136 | bool | ||
137 | + default y if TCG && ARM | ||
138 | select ARMSSE | ||
139 | select PL011 | ||
140 | select PL031 | ||
141 | @@ -XXX,XX +XXX,XX @@ config MARVELL_88W8618 | ||
142 | |||
143 | config MUSICPAL | ||
144 | bool | ||
145 | + default y if TCG && ARM | ||
146 | select OR_IRQ | ||
147 | select BITBANG_I2C | ||
148 | select MARVELL_88W8618 | ||
149 | @@ -XXX,XX +XXX,XX @@ config MUSICPAL | ||
150 | |||
151 | config NETDUINO2 | ||
152 | bool | ||
153 | + default y if TCG && ARM | ||
154 | select STM32F205_SOC | ||
155 | |||
156 | config NETDUINOPLUS2 | ||
157 | bool | ||
158 | + default y if TCG && ARM | ||
159 | select STM32F405_SOC | ||
160 | |||
161 | config OLIMEX_STM32_H405 | ||
162 | bool | ||
163 | + default y if TCG && ARM | ||
164 | select STM32F405_SOC | ||
165 | |||
166 | config NSERIES | ||
167 | bool | ||
168 | + default y if TCG && ARM | ||
169 | select OMAP | ||
170 | select TMP105 # temperature sensor | ||
171 | select BLIZZARD # LCD/TV controller | ||
172 | @@ -XXX,XX +XXX,XX @@ config PXA2XX | ||
173 | |||
174 | config GUMSTIX | ||
175 | bool | ||
176 | + default y if TCG && ARM | ||
177 | select PFLASH_CFI01 | ||
178 | select SMC91C111 | ||
179 | select PXA2XX | ||
180 | |||
181 | config TOSA | ||
182 | bool | ||
183 | + default y if TCG && ARM | ||
184 | select ZAURUS # scoop | ||
185 | select MICRODRIVE | ||
186 | select PXA2XX | ||
187 | @@ -XXX,XX +XXX,XX @@ config TOSA | ||
188 | |||
189 | config SPITZ | ||
190 | bool | ||
191 | + default y if TCG && ARM | ||
192 | select ADS7846 # touch-screen controller | ||
193 | select MAX111X # A/D converter | ||
194 | select WM8750 # audio codec | ||
195 | @@ -XXX,XX +XXX,XX @@ config SPITZ | ||
196 | |||
197 | config Z2 | ||
198 | bool | ||
199 | + default y if TCG && ARM | ||
200 | select PFLASH_CFI01 | ||
201 | select WM8750 | ||
202 | select PL011 # UART | ||
203 | @@ -XXX,XX +XXX,XX @@ config Z2 | ||
204 | |||
205 | config REALVIEW | ||
206 | bool | ||
207 | + default y if TCG && ARM | ||
208 | imply PCI_DEVICES | ||
209 | imply PCI_TESTDEV | ||
210 | imply I2C_DEVICES | ||
211 | @@ -XXX,XX +XXX,XX @@ config REALVIEW | ||
212 | |||
213 | config SBSA_REF | ||
214 | bool | ||
215 | + default y if TCG && AARCH64 | ||
216 | imply PCI_DEVICES | ||
217 | select AHCI | ||
218 | select ARM_SMMUV3 | ||
219 | @@ -XXX,XX +XXX,XX @@ config SBSA_REF | ||
220 | |||
221 | config SABRELITE | ||
222 | bool | ||
223 | + default y if TCG && ARM | ||
224 | select FSL_IMX6 | ||
225 | select SSI_M25P80 | ||
226 | |||
227 | config STELLARIS | ||
228 | bool | ||
229 | + default y if TCG && ARM | ||
230 | imply I2C_DEVICES | ||
231 | select ARM_V7M | ||
232 | select CMSDK_APB_WATCHDOG | ||
233 | @@ -XXX,XX +XXX,XX @@ config STELLARIS | ||
234 | |||
235 | config STM32VLDISCOVERY | ||
236 | bool | ||
237 | + default y if TCG && ARM | ||
238 | select STM32F100_SOC | ||
239 | |||
240 | config STRONGARM | ||
241 | @@ -XXX,XX +XXX,XX @@ config STRONGARM | ||
242 | |||
243 | config COLLIE | ||
244 | bool | ||
245 | + default y if TCG && ARM | ||
246 | select PFLASH_CFI01 | ||
247 | select ZAURUS # scoop | ||
248 | select STRONGARM | ||
249 | |||
250 | config SX1 | ||
251 | bool | ||
252 | + default y if TCG && ARM | ||
253 | select OMAP | ||
254 | |||
255 | config VERSATILE | ||
256 | bool | ||
257 | + default y if TCG && ARM | ||
258 | select ARM_TIMER # sp804 | ||
259 | select PFLASH_CFI01 | ||
260 | select LSI_SCSI_PCI | ||
261 | @@ -XXX,XX +XXX,XX @@ config VERSATILE | ||
262 | |||
263 | config VEXPRESS | ||
264 | bool | ||
265 | + default y if TCG && ARM | ||
266 | select A9MPCORE | ||
267 | select A15MPCORE | ||
268 | select ARM_MPTIMER | ||
269 | @@ -XXX,XX +XXX,XX @@ config VEXPRESS | ||
270 | |||
271 | config ZYNQ | ||
272 | bool | ||
273 | + default y if TCG && ARM | ||
274 | select A9MPCORE | ||
275 | select CADENCE # UART | ||
276 | select PFLASH_CFI02 | ||
277 | @@ -XXX,XX +XXX,XX @@ config ZYNQ | ||
278 | config ARM_V7M | ||
279 | bool | ||
280 | # currently v7M must be included in a TCG build due to translate.c | ||
281 | - default y if TCG && (ARM || AARCH64) | ||
282 | + default y if TCG && ARM | ||
283 | select PTIMER | ||
284 | |||
285 | config ALLWINNER_A10 | ||
286 | @@ -XXX,XX +XXX,XX @@ config ALLWINNER_A10 | ||
287 | |||
288 | config ALLWINNER_H3 | ||
289 | bool | ||
290 | + default y if TCG && ARM | ||
291 | select ALLWINNER_A10_PIT | ||
292 | select ALLWINNER_SUN8I_EMAC | ||
293 | select ALLWINNER_I2C | ||
294 | @@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3 | ||
295 | |||
296 | config RASPI | ||
297 | bool | ||
298 | + default y if TCG && ARM | ||
299 | select FRAMEBUFFER | ||
300 | select PL011 # UART | ||
301 | select SDHCI | ||
302 | @@ -XXX,XX +XXX,XX @@ config STM32F405_SOC | ||
303 | |||
304 | config XLNX_ZYNQMP_ARM | ||
305 | bool | ||
306 | + default y if TCG && AARCH64 | ||
307 | select AHCI | ||
308 | select ARM_GIC | ||
309 | select CADENCE | ||
310 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM | ||
311 | |||
312 | config XLNX_VERSAL | ||
313 | bool | ||
314 | + default y if TCG && AARCH64 | ||
315 | select ARM_GIC | ||
316 | select PL011 | ||
317 | select CADENCE | ||
318 | @@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL | ||
319 | |||
320 | config NPCM7XX | ||
321 | bool | ||
322 | + default y if TCG && ARM | ||
323 | select A9MPCORE | ||
324 | select ADM1272 | ||
325 | select ARM_GIC | ||
326 | @@ -XXX,XX +XXX,XX @@ config NPCM7XX | ||
327 | |||
328 | config FSL_IMX25 | ||
329 | bool | ||
330 | + default y if TCG && ARM | ||
331 | imply I2C_DEVICES | ||
332 | select IMX | ||
333 | select IMX_FEC | ||
334 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX25 | ||
335 | |||
336 | config FSL_IMX31 | ||
337 | bool | ||
338 | + default y if TCG && ARM | ||
339 | imply I2C_DEVICES | ||
340 | select SERIAL | ||
341 | select IMX | ||
342 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX6 | ||
343 | |||
344 | config ASPEED_SOC | ||
345 | bool | ||
346 | + default y if TCG && ARM | ||
347 | select DS1338 | ||
348 | select FTGMAC100 | ||
349 | select I2C | ||
350 | @@ -XXX,XX +XXX,XX @@ config ASPEED_SOC | ||
351 | |||
352 | config MPS2 | ||
353 | bool | ||
354 | + default y if TCG && ARM | ||
355 | imply I2C_DEVICES | ||
356 | select ARMSSE | ||
357 | select LAN9118 | ||
358 | @@ -XXX,XX +XXX,XX @@ config MPS2 | ||
359 | |||
360 | config FSL_IMX7 | ||
361 | bool | ||
362 | + default y if TCG && ARM | ||
363 | imply PCI_DEVICES | ||
364 | imply TEST_DEVICES | ||
365 | imply I2C_DEVICES | ||
366 | @@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3 | ||
367 | |||
368 | config FSL_IMX6UL | ||
369 | bool | ||
370 | + default y if TCG && ARM | ||
371 | imply I2C_DEVICES | ||
372 | select A15MPCORE | ||
373 | select IMX | ||
374 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL | ||
375 | |||
376 | config MICROBIT | ||
377 | bool | ||
378 | + default y if TCG && ARM | ||
379 | select NRF51_SOC | ||
380 | |||
381 | config NRF51_SOC | ||
382 | @@ -XXX,XX +XXX,XX @@ config NRF51_SOC | ||
383 | |||
384 | config EMCRAFT_SF2 | ||
385 | bool | ||
386 | + default y if TCG && ARM | ||
387 | select MSF2 | ||
388 | select SSI_M25P80 | ||
389 | |||
53 | -- | 390 | -- |
54 | 2.25.1 | 391 | 2.34.1 |
55 | |||
56 | diff view generated by jsdifflib |
1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Fix issue where the data register may be overwritten by next character | 3 | The test set -accel tcg, so restrict it to when TCG is present. |
4 | reception before being read and returned. | ||
5 | 4 | ||
6 | Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | 5 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr | 8 | Message-id: 20230426180013.14814-13-farosas@suse.de |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | hw/char/stm32f2xx_usart.c | 3 ++- | 11 | tests/qtest/meson.build | 3 ++- |
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | 12 | 1 file changed, 2 insertions(+), 1 deletion(-) |
14 | 13 | ||
15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c | 14 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/char/stm32f2xx_usart.c | 16 | --- a/tests/qtest/meson.build |
18 | +++ b/hw/char/stm32f2xx_usart.c | 17 | +++ b/tests/qtest/meson.build |
19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, | 18 | @@ -XXX,XX +XXX,XX @@ qtests_aarch64 = \ |
20 | return retvalue; | 19 | ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ |
21 | case USART_DR: | 20 | (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ |
22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); | 21 | (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ |
23 | + retvalue = s->usart_dr & 0x3FF; | 22 | - (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ |
24 | s->usart_sr &= ~USART_SR_RXNE; | 23 | + (config_all.has_key('CONFIG_TCG') and \ |
25 | qemu_chr_fe_accept_input(&s->chr); | 24 | + config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ |
26 | qemu_set_irq(s->irq, 0); | 25 | ['arm-cpu-features', |
27 | - return s->usart_dr & 0x3FF; | 26 | 'numa-test', |
28 | + return retvalue; | 27 | 'boot-serial-test', |
29 | case USART_BRR: | ||
30 | return s->usart_brr; | ||
31 | case USART_CR1: | ||
32 | -- | 28 | -- |
33 | 2.25.1 | 29 | 2.34.1 |
34 | |||
35 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Create empty data files and allow updates for the upcoming VIOT tests. | 3 | Add a manual new job to cross-build the aarch64 target with |
4 | only the KVM accelerator enabled (in particular, no TCG). | ||
4 | 5 | ||
5 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 6 | Re-enable running the similar job on the project Aarch64 |
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 7 | custom runner. |
7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 8 | |
8 | Message-id: 20211210170415.583179-6-jean-philippe@linaro.org | 9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
11 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20230426180013.14814-14-farosas@suse.de | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 15 | --- |
11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ | 16 | .gitlab-ci.d/crossbuilds.yml | 11 +++++++++++ |
12 | tests/data/acpi/q35/DSDT.viot | 0 | 17 | .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | 4 ---- |
13 | tests/data/acpi/q35/VIOT.viot | 0 | 18 | 2 files changed, 11 insertions(+), 4 deletions(-) |
14 | tests/data/acpi/virt/VIOT | 0 | ||
15 | 4 files changed, 3 insertions(+) | ||
16 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
17 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
18 | create mode 100644 tests/data/acpi/virt/VIOT | ||
19 | 19 | ||
20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | 20 | diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml |
21 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h | 22 | --- a/.gitlab-ci.d/crossbuilds.yml |
23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h | 23 | +++ b/.gitlab-ci.d/crossbuilds.yml |
24 | @@ -1 +1,4 @@ | 24 | @@ -XXX,XX +XXX,XX @@ cross-arm64-xen-only: |
25 | /* List of comma-separated changed AML files to ignore */ | 25 | IMAGE: debian-arm64-cross |
26 | +"tests/data/acpi/virt/VIOT", | 26 | ACCEL: xen |
27 | +"tests/data/acpi/q35/DSDT.viot", | 27 | EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm |
28 | +"tests/data/acpi/q35/VIOT.viot", | 28 | + |
29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot | 29 | +# Similar job is run by qemu-project's custom runner by default |
30 | new file mode 100644 | 30 | +cross-arm64-kvm-only: |
31 | index XXXXXXX..XXXXXXX | 31 | + extends: .cross_accel_build_job |
32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot | 32 | + needs: |
33 | new file mode 100644 | 33 | + job: arm64-debian-cross-container |
34 | index XXXXXXX..XXXXXXX | 34 | + variables: |
35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT | 35 | + QEMU_JOB_OPTIONAL: 1 |
36 | new file mode 100644 | 36 | + IMAGE: debian-arm64-cross |
37 | index XXXXXXX..XXXXXXX | 37 | + ACCEL: kvm |
38 | + EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-xen --without-default-devices | ||
39 | diff --git a/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml b/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | ||
42 | +++ b/.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | ||
43 | @@ -XXX,XX +XXX,XX @@ ubuntu-22.04-aarch64-notcg: | ||
44 | - aarch64 | ||
45 | rules: | ||
46 | - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/' | ||
47 | - when: manual | ||
48 | - allow_failure: true | ||
49 | - if: "$AARCH64_RUNNER_AVAILABLE" | ||
50 | - when: manual | ||
51 | - allow_failure: true | ||
52 | script: | ||
53 | - mkdir build | ||
54 | - cd build | ||
38 | -- | 55 | -- |
39 | 2.25.1 | 56 | 2.34.1 |
40 | 57 | ||
41 | 58 | diff view generated by jsdifflib |
1 | From: Patrick Venture <venture@google.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | The rx_active boolean change to true should always trigger a try_read | 3 | The MAC address set from Qemu wasn't being saved into the register space. |
4 | call that flushes the queue. | ||
5 | 4 | ||
5 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
6 | Signed-off-by: Patrick Venture <venture@google.com> | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Message-id: 20211203221002.1719306-1-venture@google.com | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | [PMM: moved variable declaration to top of function] | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- | 12 | hw/net/npcm7xx_emc.c | 32 +++++++++++++++++++++++++------- |
12 | 1 file changed, 8 insertions(+), 10 deletions(-) | 13 | 1 file changed, 25 insertions(+), 7 deletions(-) |
13 | 14 | ||
14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c | 15 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/net/npcm7xx_emc.c | 17 | --- a/hw/net/npcm7xx_emc.c |
17 | +++ b/hw/net/npcm7xx_emc.c | 18 | +++ b/hw/net/npcm7xx_emc.c |
18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) | 19 | @@ -XXX,XX +XXX,XX @@ static const char *emc_reg_name(int regno) |
19 | emc_set_mista(emc, mista_flag); | 20 | |
21 | static void emc_reset(NPCM7xxEMCState *emc) | ||
22 | { | ||
23 | + uint32_t value; | ||
24 | + | ||
25 | trace_npcm7xx_emc_reset(emc->emc_num); | ||
26 | |||
27 | memset(&emc->regs[0], 0, sizeof(emc->regs)); | ||
28 | @@ -XXX,XX +XXX,XX @@ static void emc_reset(NPCM7xxEMCState *emc) | ||
29 | |||
30 | emc->tx_active = false; | ||
31 | emc->rx_active = false; | ||
32 | + | ||
33 | + /* Set the MAC address in the register space. */ | ||
34 | + value = (emc->conf.macaddr.a[0] << 24) | | ||
35 | + (emc->conf.macaddr.a[1] << 16) | | ||
36 | + (emc->conf.macaddr.a[2] << 8) | | ||
37 | + emc->conf.macaddr.a[3]; | ||
38 | + emc->regs[REG_CAMM_BASE] = value; | ||
39 | + | ||
40 | + value = (emc->conf.macaddr.a[4] << 24) | (emc->conf.macaddr.a[5] << 16); | ||
41 | + emc->regs[REG_CAML_BASE] = value; | ||
20 | } | 42 | } |
21 | 43 | ||
22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) | 44 | static void npcm7xx_emc_reset(DeviceState *dev) |
23 | +{ | 45 | @@ -XXX,XX +XXX,XX @@ static bool emc_receive_filter1(NPCM7xxEMCState *emc, const uint8_t *buf, |
24 | + emc->rx_active = true; | 46 | } |
25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | 47 | case ETH_PKT_UCAST: { |
26 | +} | 48 | bool matches; |
49 | + uint32_t value; | ||
50 | + struct MACAddr mac; | ||
51 | if (emc->regs[REG_CAMCMR] & REG_CAMCMR_AUP) { | ||
52 | return true; | ||
53 | } | ||
27 | + | 54 | + |
28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, | 55 | + value = emc->regs[REG_CAMM_BASE]; |
29 | const NPCM7xxEMCTxDesc *tx_desc, | 56 | + mac.a[0] = value >> 24; |
30 | uint32_t desc_addr) | 57 | + mac.a[1] = value >> 16; |
31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) | 58 | + mac.a[2] = value >> 8; |
32 | return len; | 59 | + mac.a[3] = value >> 0; |
33 | } | 60 | + value = emc->regs[REG_CAML_BASE]; |
34 | 61 | + mac.a[4] = value >> 24; | |
35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) | 62 | + mac.a[5] = value >> 16; |
36 | -{ | 63 | + |
37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { | 64 | matches = ((emc->regs[REG_CAMCMR] & REG_CAMCMR_ECMP) && |
38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | 65 | /* We only support one CAM register, CAM0. */ |
39 | - } | 66 | (emc->regs[REG_CAMEN] & (1 << 0)) && |
40 | -} | 67 | - memcmp(buf, emc->conf.macaddr.a, ETH_ALEN) == 0); |
41 | - | 68 | + memcmp(buf, mac.a, ETH_ALEN) == 0); |
42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) | 69 | if (emc->regs[REG_CAMCMR] & REG_CAMCMR_CCAM) { |
43 | { | 70 | *fail_reason = "MACADDR matched, comparison complemented"; |
44 | NPCM7xxEMCState *emc = opaque; | 71 | return !matches; |
45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | ||
46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; | ||
47 | } | ||
48 | if (value & REG_MCMDR_RXON) { | ||
49 | - emc->rx_active = true; | ||
50 | + emc_enable_rx_and_flush(emc); | ||
51 | } else { | ||
52 | emc_halt_rx(emc, 0); | ||
53 | } | ||
54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | 72 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
55 | break; | 73 | break; |
56 | case REG_RSDR: | 74 | case REG_CAMM_BASE + 0: |
57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { | 75 | emc->regs[reg] = value; |
58 | - emc->rx_active = true; | 76 | - emc->conf.macaddr.a[0] = value >> 24; |
59 | - emc_try_receive_next_packet(emc); | 77 | - emc->conf.macaddr.a[1] = value >> 16; |
60 | + emc_enable_rx_and_flush(emc); | 78 | - emc->conf.macaddr.a[2] = value >> 8; |
61 | } | 79 | - emc->conf.macaddr.a[3] = value >> 0; |
62 | break; | 80 | break; |
63 | case REG_MIIDA: | 81 | case REG_CAML_BASE + 0: |
82 | emc->regs[reg] = value; | ||
83 | - emc->conf.macaddr.a[4] = value >> 24; | ||
84 | - emc->conf.macaddr.a[5] = value >> 16; | ||
85 | break; | ||
86 | case REG_MCMDR: { | ||
87 | uint32_t prev; | ||
64 | -- | 88 | -- |
65 | 2.25.1 | 89 | 2.34.1 |
66 | 90 | ||
67 | 91 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | From: Daniel Bertalan <dani@danielbertalan.dev> |
---|---|---|---|
2 | 2 | ||
3 | This is the latest URL for the OpenBMC CI. The old URL still works, but | 3 | This query copies the kernel command line into the message buffer. It |
4 | redirects. | 4 | was previously stubbed out to return empty, this commit makes it reflect |
5 | the arguments specified with `-append`. | ||
5 | 6 | ||
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 7 | I observed the following peculiarities on my Pi 3B+: |
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 8 | - If the buffer is shorter than the string, the response header gives |
8 | Message-id: 20211117065752.330632-3-joel@jms.id.au | 9 | the full length, but no data is actually copied. |
10 | - No NUL terminator is added: even if the buffer is long enough to fit | ||
11 | one, the buffer's original contents are preserved past the string's | ||
12 | end. | ||
13 | - The VC firmware adds the following extra parameters beside the | ||
14 | user-supplied ones (via /boot/cmdline.txt): `video`, `vc_mem.mem_base` | ||
15 | and `vc_mem.mem_size`. This is currently not implemented in qemu. | ||
16 | |||
17 | Signed-off-by: Daniel Bertalan <dani@danielbertalan.dev> | ||
18 | Message-id: 20230425103250.56653-1-dani@danielbertalan.dev | ||
19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | [PMM: added comment about NUL and short-buffer behaviour] | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 22 | --- |
11 | docs/system/arm/aspeed.rst | 2 +- | 23 | include/hw/misc/bcm2835_property.h | 1 + |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 24 | hw/arm/bcm2835_peripherals.c | 2 ++ |
25 | hw/arm/bcm2836.c | 2 ++ | ||
26 | hw/arm/raspi.c | 2 ++ | ||
27 | hw/misc/bcm2835_property.c | 13 ++++++++++++- | ||
28 | 5 files changed, 19 insertions(+), 1 deletion(-) | ||
13 | 29 | ||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 30 | diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h |
15 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 32 | --- a/include/hw/misc/bcm2835_property.h |
17 | +++ b/docs/system/arm/aspeed.rst | 33 | +++ b/include/hw/misc/bcm2835_property.h |
18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to | 34 | @@ -XXX,XX +XXX,XX @@ struct BCM2835PropertyState { |
19 | load a Linux kernel or from a firmware. Images can be downloaded from | 35 | MACAddr macaddr; |
20 | the OpenBMC jenkins : | 36 | uint32_t board_rev; |
21 | 37 | uint32_t addr; | |
22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder | 38 | + char *command_line; |
23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | 39 | bool pending; |
24 | 40 | }; | |
25 | or directly from the OpenBMC GitHub release repository : | 41 | |
42 | diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/hw/arm/bcm2835_peripherals.c | ||
45 | +++ b/hw/arm/bcm2835_peripherals.c | ||
46 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_peripherals_init(Object *obj) | ||
47 | TYPE_BCM2835_PROPERTY); | ||
48 | object_property_add_alias(obj, "board-rev", OBJECT(&s->property), | ||
49 | "board-rev"); | ||
50 | + object_property_add_alias(obj, "command-line", OBJECT(&s->property), | ||
51 | + "command-line"); | ||
52 | |||
53 | object_property_add_const_link(OBJECT(&s->property), "fb", | ||
54 | OBJECT(&s->fb)); | ||
55 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/hw/arm/bcm2836.c | ||
58 | +++ b/hw/arm/bcm2836.c | ||
59 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj) | ||
60 | TYPE_BCM2835_PERIPHERALS); | ||
61 | object_property_add_alias(obj, "board-rev", OBJECT(&s->peripherals), | ||
62 | "board-rev"); | ||
63 | + object_property_add_alias(obj, "command-line", OBJECT(&s->peripherals), | ||
64 | + "command-line"); | ||
65 | object_property_add_alias(obj, "vcram-size", OBJECT(&s->peripherals), | ||
66 | "vcram-size"); | ||
67 | } | ||
68 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/hw/arm/raspi.c | ||
71 | +++ b/hw/arm/raspi.c | ||
72 | @@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine) | ||
73 | object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram)); | ||
74 | object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev, | ||
75 | &error_abort); | ||
76 | + object_property_set_str(OBJECT(&s->soc), "command-line", | ||
77 | + machine->kernel_cmdline, &error_abort); | ||
78 | qdev_realize(DEVICE(&s->soc), NULL, &error_fatal); | ||
79 | |||
80 | /* Create and plug in the SD cards */ | ||
81 | diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/hw/misc/bcm2835_property.c | ||
84 | +++ b/hw/misc/bcm2835_property.c | ||
85 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) | ||
86 | break; | ||
87 | |||
88 | case 0x00050001: /* Get command line */ | ||
89 | - resplen = 0; | ||
90 | + /* | ||
91 | + * We follow the firmware behaviour: no NUL terminator is | ||
92 | + * written to the buffer, and if the buffer is too short | ||
93 | + * we report the required length in the response header | ||
94 | + * and copy nothing to the buffer. | ||
95 | + */ | ||
96 | + resplen = strlen(s->command_line); | ||
97 | + if (bufsize >= resplen) | ||
98 | + address_space_write(&s->dma_as, value + 12, | ||
99 | + MEMTXATTRS_UNSPECIFIED, s->command_line, | ||
100 | + resplen); | ||
101 | break; | ||
102 | |||
103 | default: | ||
104 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp) | ||
105 | |||
106 | static Property bcm2835_property_props[] = { | ||
107 | DEFINE_PROP_UINT32("board-rev", BCM2835PropertyState, board_rev, 0), | ||
108 | + DEFINE_PROP_STRING("command-line", BCM2835PropertyState, command_line), | ||
109 | DEFINE_PROP_END_OF_LIST() | ||
110 | }; | ||
26 | 111 | ||
27 | -- | 112 | -- |
28 | 2.25.1 | 113 | 2.34.1 |
29 | |||
30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | This commit adds 'one-insn-per-tb' as a property on the TCG |
---|---|---|---|
2 | 2 | accelerator object, so you can enable it with | |
3 | We will reuse this section of arm_deliver_fault for | 3 | -accel tcg,one-insn-per-tb=on |
4 | raising pc alignment faults. | 4 | |
5 | 5 | It has the same behaviour as the existing '-singlestep' command line | |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | option. We use a different name because 'singlestep' has always been |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | a confusing choice, because it doesn't have anything to do with |
8 | single-stepping the CPU. What it does do is force TCG emulation to | ||
9 | put one guest instruction in each TB, which can be useful in some | ||
10 | situations (such as analysing debug logs). | ||
11 | |||
12 | The existing '-singlestep' commandline options are decoupled from the | ||
13 | global 'singlestep' variable and instead now are syntactic sugar for | ||
14 | setting the accel property. (These can then go away after a | ||
15 | deprecation period.) | ||
16 | |||
17 | The global variable remains for the moment as: | ||
18 | * what the TCG code looks at to change its behaviour | ||
19 | * what HMP and QMP use to query and set the behaviour | ||
20 | |||
21 | In the following commits we'll clean those up to not directly | ||
22 | look at the global variable. | ||
23 | |||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
26 | Message-id: 20230417164041.684562-2-peter.maydell@linaro.org | ||
9 | --- | 27 | --- |
10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- | 28 | accel/tcg/tcg-all.c | 21 +++++++++++++++++++++ |
11 | 1 file changed, 28 insertions(+), 17 deletions(-) | 29 | bsd-user/main.c | 8 ++++++-- |
12 | 30 | linux-user/main.c | 8 ++++++-- | |
13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | 31 | softmmu/vl.c | 17 +++++++++++++++-- |
14 | index XXXXXXX..XXXXXXX 100644 | 32 | qemu-options.hx | 7 +++++++ |
15 | --- a/target/arm/tlb_helper.c | 33 | 5 files changed, 55 insertions(+), 6 deletions(-) |
16 | +++ b/target/arm/tlb_helper.c | 34 | |
17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | 35 | diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c |
18 | return syn; | 36 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/accel/tcg/tcg-all.c | ||
38 | +++ b/accel/tcg/tcg-all.c | ||
39 | @@ -XXX,XX +XXX,XX @@ struct TCGState { | ||
40 | AccelState parent_obj; | ||
41 | |||
42 | bool mttcg_enabled; | ||
43 | + bool one_insn_per_tb; | ||
44 | int splitwx_enabled; | ||
45 | unsigned long tb_size; | ||
46 | }; | ||
47 | @@ -XXX,XX +XXX,XX @@ static void tcg_set_splitwx(Object *obj, bool value, Error **errp) | ||
48 | s->splitwx_enabled = value; | ||
19 | } | 49 | } |
20 | 50 | ||
21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | 51 | +static bool tcg_get_one_insn_per_tb(Object *obj, Error **errp) |
22 | - MMUAccessType access_type, | 52 | +{ |
23 | - int mmu_idx, ARMMMUFaultInfo *fi) | 53 | + TCGState *s = TCG_STATE(obj); |
24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, | 54 | + return s->one_insn_per_tb; |
25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) | 55 | +} |
56 | + | ||
57 | +static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp) | ||
58 | +{ | ||
59 | + TCGState *s = TCG_STATE(obj); | ||
60 | + s->one_insn_per_tb = value; | ||
61 | + /* For the moment, set the global also: this changes the behaviour */ | ||
62 | + singlestep = value; | ||
63 | +} | ||
64 | + | ||
65 | static int tcg_gdbstub_supported_sstep_flags(void) | ||
26 | { | 66 | { |
27 | - CPUARMState *env = &cpu->env; | 67 | /* |
28 | - int target_el; | 68 | @@ -XXX,XX +XXX,XX @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) |
29 | - bool same_el; | 69 | tcg_get_splitwx, tcg_set_splitwx); |
30 | - uint32_t syn, exc, fsr, fsc; | 70 | object_class_property_set_description(oc, "split-wx", |
31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | 71 | "Map jit pages into separate RW and RX regions"); |
72 | + | ||
73 | + object_class_property_add_bool(oc, "one-insn-per-tb", | ||
74 | + tcg_get_one_insn_per_tb, | ||
75 | + tcg_set_one_insn_per_tb); | ||
76 | + object_class_property_set_description(oc, "one-insn-per-tb", | ||
77 | + "Only put one guest insn in each translation block"); | ||
78 | } | ||
79 | |||
80 | static const TypeInfo tcg_accel_type = { | ||
81 | diff --git a/bsd-user/main.c b/bsd-user/main.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/bsd-user/main.c | ||
84 | +++ b/bsd-user/main.c | ||
85 | @@ -XXX,XX +XXX,XX @@ | ||
86 | #include "target_arch_cpu.h" | ||
87 | |||
88 | int singlestep; | ||
89 | +static bool opt_one_insn_per_tb; | ||
90 | uintptr_t guest_base; | ||
91 | bool have_guest_base; | ||
92 | /* | ||
93 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
94 | } else if (!strcmp(r, "seed")) { | ||
95 | seed_optarg = optarg; | ||
96 | } else if (!strcmp(r, "singlestep")) { | ||
97 | - singlestep = 1; | ||
98 | + opt_one_insn_per_tb = true; | ||
99 | } else if (!strcmp(r, "strace")) { | ||
100 | do_strace = 1; | ||
101 | } else if (!strcmp(r, "trace")) { | ||
102 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
103 | |||
104 | /* init tcg before creating CPUs and to get qemu_host_page_size */ | ||
105 | { | ||
106 | - AccelClass *ac = ACCEL_GET_CLASS(current_accel()); | ||
107 | + AccelState *accel = current_accel(); | ||
108 | + AccelClass *ac = ACCEL_GET_CLASS(accel); | ||
109 | |||
110 | accel_init_interfaces(ac); | ||
111 | + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", | ||
112 | + opt_one_insn_per_tb, &error_abort); | ||
113 | ac->init_machine(NULL); | ||
114 | } | ||
115 | cpu = cpu_create(cpu_type); | ||
116 | diff --git a/linux-user/main.c b/linux-user/main.c | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/linux-user/main.c | ||
119 | +++ b/linux-user/main.c | ||
120 | @@ -XXX,XX +XXX,XX @@ char *exec_path; | ||
121 | char real_exec_path[PATH_MAX]; | ||
122 | |||
123 | int singlestep; | ||
124 | +static bool opt_one_insn_per_tb; | ||
125 | static const char *argv0; | ||
126 | static const char *gdbstub; | ||
127 | static envlist_t *envlist; | ||
128 | @@ -XXX,XX +XXX,XX @@ static void handle_arg_reserved_va(const char *arg) | ||
129 | |||
130 | static void handle_arg_singlestep(const char *arg) | ||
131 | { | ||
132 | - singlestep = 1; | ||
133 | + opt_one_insn_per_tb = true; | ||
134 | } | ||
135 | |||
136 | static void handle_arg_strace(const char *arg) | ||
137 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp) | ||
138 | |||
139 | /* init tcg before creating CPUs and to get qemu_host_page_size */ | ||
140 | { | ||
141 | - AccelClass *ac = ACCEL_GET_CLASS(current_accel()); | ||
142 | + AccelState *accel = current_accel(); | ||
143 | + AccelClass *ac = ACCEL_GET_CLASS(accel); | ||
144 | |||
145 | accel_init_interfaces(ac); | ||
146 | + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", | ||
147 | + opt_one_insn_per_tb, &error_abort); | ||
148 | ac->init_machine(NULL); | ||
149 | } | ||
150 | cpu = cpu_create(cpu_type); | ||
151 | diff --git a/softmmu/vl.c b/softmmu/vl.c | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/softmmu/vl.c | ||
154 | +++ b/softmmu/vl.c | ||
155 | @@ -XXX,XX +XXX,XX @@ static const char *log_file; | ||
156 | static bool list_data_dirs; | ||
157 | static const char *qtest_chrdev; | ||
158 | static const char *qtest_log; | ||
159 | +static bool opt_one_insn_per_tb; | ||
160 | |||
161 | static int has_defaults = 1; | ||
162 | static int default_serial = 1; | ||
163 | @@ -XXX,XX +XXX,XX @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) | ||
164 | qemu_opt_foreach(opts, accelerator_set_property, | ||
165 | accel, | ||
166 | &error_fatal); | ||
32 | - | 167 | - |
33 | - target_el = exception_target_el(env); | 168 | + /* |
34 | - if (fi->stage2) { | 169 | + * If legacy -singlestep option is set, honour it for TCG and |
35 | - target_el = 2; | 170 | + * silently ignore for any other accelerator (which is how this |
36 | - env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | 171 | + * option has always behaved). |
37 | - if (arm_is_secure_below_el3(env) && fi->s1ns) { | 172 | + */ |
38 | - env->cp15.hpfar_el2 |= HPFAR_NS; | 173 | + if (opt_one_insn_per_tb) { |
39 | - } | 174 | + /* |
40 | - } | 175 | + * This will always succeed for TCG, and we want to ignore |
41 | - same_el = (arm_current_el(env) == target_el); | 176 | + * the error from trying to set a nonexistent property |
42 | + uint32_t fsr, fsc; | 177 | + * on any other accelerator. |
43 | 178 | + */ | |
44 | if (target_el == 2 || arm_el_is_aa64(env, target_el) || | 179 | + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", true, NULL); |
45 | arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | ||
47 | fsc = 0x3f; | ||
48 | } | ||
49 | |||
50 | + *ret_fsc = fsc; | ||
51 | + return fsr; | ||
52 | +} | ||
53 | + | ||
54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | ||
55 | + MMUAccessType access_type, | ||
56 | + int mmu_idx, ARMMMUFaultInfo *fi) | ||
57 | +{ | ||
58 | + CPUARMState *env = &cpu->env; | ||
59 | + int target_el; | ||
60 | + bool same_el; | ||
61 | + uint32_t syn, exc, fsr, fsc; | ||
62 | + | ||
63 | + target_el = exception_target_el(env); | ||
64 | + if (fi->stage2) { | ||
65 | + target_el = 2; | ||
66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { | ||
68 | + env->cp15.hpfar_el2 |= HPFAR_NS; | ||
69 | + } | ||
70 | + } | 180 | + } |
71 | + same_el = (arm_current_el(env) == target_el); | 181 | ret = accel_init_machine(accel, current_machine); |
72 | + | 182 | if (ret < 0) { |
73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); | 183 | if (!qtest_with_kvm || ret != -ENOENT) { |
74 | + | 184 | @@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv) |
75 | if (access_type == MMU_INST_FETCH) { | 185 | qdict_put_str(machine_opts_dict, "firmware", optarg); |
76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); | 186 | break; |
77 | exc = EXCP_PREFETCH_ABORT; | 187 | case QEMU_OPTION_singlestep: |
188 | - singlestep = 1; | ||
189 | + opt_one_insn_per_tb = true; | ||
190 | break; | ||
191 | case QEMU_OPTION_S: | ||
192 | autostart = 0; | ||
193 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
194 | index XXXXXXX..XXXXXXX 100644 | ||
195 | --- a/qemu-options.hx | ||
196 | +++ b/qemu-options.hx | ||
197 | @@ -XXX,XX +XXX,XX @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, | ||
198 | " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" | ||
199 | " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n" | ||
200 | " kvm-shadow-mem=size of KVM shadow MMU in bytes\n" | ||
201 | + " one-insn-per-tb=on|off (one guest instruction per TCG translation block)\n" | ||
202 | " split-wx=on|off (enable TCG split w^x mapping)\n" | ||
203 | " tb-size=n (TCG translation block cache size)\n" | ||
204 | " dirty-ring-size=n (KVM dirty ring GFN count, default 0)\n" | ||
205 | @@ -XXX,XX +XXX,XX @@ SRST | ||
206 | ``kvm-shadow-mem=size`` | ||
207 | Defines the size of the KVM shadow MMU. | ||
208 | |||
209 | + ``one-insn-per-tb=on|off`` | ||
210 | + Makes the TCG accelerator put only one guest instruction into | ||
211 | + each translation block. This slows down emulation a lot, but | ||
212 | + can be useful in some situations, such as when trying to analyse | ||
213 | + the logs produced by the ``-d`` option. | ||
214 | + | ||
215 | ``split-wx=on|off`` | ||
216 | Controls the use of split w^x mapping for the TCG code generation | ||
217 | buffer. Some operating systems require this to be enabled, and in | ||
78 | -- | 218 | -- |
79 | 2.25.1 | 219 | 2.34.1 |
80 | |||
81 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The HMP 'singlestep' command, the QMP 'query-status' command and the |
---|---|---|---|
2 | HMP 'info status' command (which is just wrapping the QMP command | ||
3 | implementation) look at the 'singlestep' global variable. Make them | ||
4 | access the new TCG accelerator 'one-insn-per-tb' property instead. | ||
2 | 5 | ||
3 | Misaligned thumb PC is architecturally impossible. | 6 | This leaves the HMP and QMP command/field names and output strings |
4 | Assert is better than proceeding, in case we've missed | 7 | unchanged; we will clean that up later. |
5 | something somewhere. | ||
6 | 8 | ||
7 | Expand a comment about aligning the pc in gdbstub. | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Fail an incoming migrate if a thumb pc is misaligned. | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
12 | Message-id: 20230417164041.684562-3-peter.maydell@linaro.org | ||
13 | --- | ||
14 | softmmu/runstate-hmp-cmds.c | 18 ++++++++++++++++-- | ||
15 | softmmu/runstate.c | 10 +++++++++- | ||
16 | 2 files changed, 25 insertions(+), 3 deletions(-) | ||
9 | 17 | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c |
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/gdbstub.c | 9 +++++++-- | ||
15 | target/arm/machine.c | 10 ++++++++++ | ||
16 | target/arm/translate.c | 3 +++ | ||
17 | 3 files changed, 20 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/gdbstub.c | 20 | --- a/softmmu/runstate-hmp-cmds.c |
22 | +++ b/target/arm/gdbstub.c | 21 | +++ b/softmmu/runstate-hmp-cmds.c |
23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) | 22 | @@ -XXX,XX +XXX,XX @@ |
24 | 23 | #include "qapi/error.h" | |
25 | tmp = ldl_p(mem_buf); | 24 | #include "qapi/qapi-commands-run-state.h" |
26 | 25 | #include "qapi/qmp/qdict.h" | |
27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably | 26 | +#include "qemu/accel.h" |
28 | - cause problems if we ever implement the Jazelle DBX extensions. */ | 27 | |
29 | + /* | 28 | void hmp_info_status(Monitor *mon, const QDict *qdict) |
30 | + * Mask out low bits of PC to workaround gdb bugs. | 29 | { |
31 | + * This avoids an assert in thumb_tr_translate_insn, because it is | 30 | @@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict) |
32 | + * architecturally impossible to misalign the pc. | 31 | void hmp_singlestep(Monitor *mon, const QDict *qdict) |
33 | + * This will probably cause problems if we ever implement the | 32 | { |
34 | + * Jazelle DBX extensions. | 33 | const char *option = qdict_get_try_str(qdict, "option"); |
35 | + */ | 34 | + AccelState *accel = current_accel(); |
36 | if (n == 15) { | 35 | + bool newval; |
37 | tmp &= ~1; | ||
38 | } | ||
39 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/machine.c | ||
42 | +++ b/target/arm/machine.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) | ||
44 | return -1; | ||
45 | } | ||
46 | } | ||
47 | + | 36 | + |
48 | + /* | 37 | + if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) { |
49 | + * Misaligned thumb pc is architecturally impossible. | 38 | + monitor_printf(mon, |
50 | + * We have an assert in thumb_tr_translate_insn to verify this. | 39 | + "This accelerator does not support setting one-insn-per-tb\n"); |
51 | + * Fail an incoming migrate to avoid this assert. | 40 | + return; |
52 | + */ | ||
53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { | ||
54 | + return -1; | ||
55 | + } | 41 | + } |
56 | + | 42 | + |
57 | if (!kvm_enabled()) { | 43 | if (!option || !strcmp(option, "on")) { |
58 | pmu_op_finish(&cpu->env); | 44 | - singlestep = 1; |
45 | + newval = true; | ||
46 | } else if (!strcmp(option, "off")) { | ||
47 | - singlestep = 0; | ||
48 | + newval = false; | ||
49 | } else { | ||
50 | monitor_printf(mon, "unexpected option %s\n", option); | ||
51 | + return; | ||
59 | } | 52 | } |
60 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 53 | + /* If the property exists then setting it can never fail */ |
54 | + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", | ||
55 | + newval, &error_abort); | ||
56 | } | ||
57 | |||
58 | void hmp_watchdog_action(Monitor *mon, const QDict *qdict) | ||
59 | diff --git a/softmmu/runstate.c b/softmmu/runstate.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | 60 | index XXXXXXX..XXXXXXX 100644 |
62 | --- a/target/arm/translate.c | 61 | --- a/softmmu/runstate.c |
63 | +++ b/target/arm/translate.c | 62 | +++ b/softmmu/runstate.c |
64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 63 | @@ -XXX,XX +XXX,XX @@ |
65 | uint32_t insn; | 64 | #include "qapi/error.h" |
66 | bool is_16bit; | 65 | #include "qapi/qapi-commands-run-state.h" |
67 | 66 | #include "qapi/qapi-events-run-state.h" | |
68 | + /* Misaligned thumb PC is architecturally impossible. */ | 67 | +#include "qemu/accel.h" |
69 | + assert((dc->base.pc_next & 1) == 0); | 68 | #include "qemu/error-report.h" |
70 | + | 69 | #include "qemu/job.h" |
71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 70 | #include "qemu/log.h" |
72 | dc->base.pc_next = pc + 2; | 71 | @@ -XXX,XX +XXX,XX @@ bool runstate_needs_reset(void) |
73 | return; | 72 | StatusInfo *qmp_query_status(Error **errp) |
73 | { | ||
74 | StatusInfo *info = g_malloc0(sizeof(*info)); | ||
75 | + AccelState *accel = current_accel(); | ||
76 | |||
77 | + /* | ||
78 | + * We ignore errors, which will happen if the accelerator | ||
79 | + * is not TCG. "singlestep" is meaningless for other accelerators, | ||
80 | + * so we will set the StatusInfo field to false for those. | ||
81 | + */ | ||
82 | + info->singlestep = object_property_get_bool(OBJECT(accel), | ||
83 | + "one-insn-per-tb", NULL); | ||
84 | info->running = runstate_is_running(); | ||
85 | - info->singlestep = singlestep; | ||
86 | info->status = current_run_state; | ||
87 | |||
88 | return info; | ||
74 | -- | 89 | -- |
75 | 2.25.1 | 90 | 2.34.1 |
76 | 91 | ||
77 | 92 | diff view generated by jsdifflib |
1 | A lot of C files in hw/arm include qemu-common.h when they don't | 1 | The only place left that looks at the old 'singlestep' global |
---|---|---|---|
2 | need anything from it. Drop the include lines. | 2 | variable is the TCG curr_cflags() function. Replace the old global |
3 | with a new 'one_insn_per_tb' which is defined in tcg-all.c and | ||
4 | declared in accel/tcg/internal.h. This keeps it restricted to the | ||
5 | TCG code, unlike 'singlestep' which was available to every file in | ||
6 | the system and defined in multiple different places for softmmu vs | ||
7 | linux-user vs bsd-user. | ||
3 | 8 | ||
4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they | 9 | While we're making this change, use qatomic_read() and qatomic_set() |
5 | use it for the prototype of qemu_get_timedate(). | 10 | on the accesses to the new global, because TCG will read it without |
11 | holding a lock. | ||
6 | 12 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | 16 | Message-id: 20230417164041.684562-4-peter.maydell@linaro.org |
11 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
12 | Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org | ||
13 | --- | 17 | --- |
14 | hw/arm/boot.c | 1 - | 18 | accel/tcg/internal.h | 2 ++ |
15 | hw/arm/digic_boards.c | 1 - | 19 | include/exec/cpu-common.h | 2 -- |
16 | hw/arm/highbank.c | 1 - | 20 | accel/tcg/cpu-exec.c | 2 +- |
17 | hw/arm/npcm7xx_boards.c | 1 - | 21 | accel/tcg/tcg-all.c | 6 ++++-- |
18 | hw/arm/sbsa-ref.c | 1 - | 22 | bsd-user/main.c | 1 - |
19 | hw/arm/stm32f405_soc.c | 1 - | 23 | linux-user/main.c | 1 - |
20 | hw/arm/vexpress.c | 1 - | 24 | softmmu/globals.c | 1 - |
21 | hw/arm/virt.c | 1 - | 25 | 7 files changed, 7 insertions(+), 8 deletions(-) |
22 | 8 files changed, 8 deletions(-) | ||
23 | 26 | ||
24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 27 | diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h |
25 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/arm/boot.c | 29 | --- a/accel/tcg/internal.h |
27 | +++ b/hw/arm/boot.c | 30 | +++ b/accel/tcg/internal.h |
31 | @@ -XXX,XX +XXX,XX @@ static inline target_ulong log_pc(CPUState *cpu, const TranslationBlock *tb) | ||
32 | extern int64_t max_delay; | ||
33 | extern int64_t max_advance; | ||
34 | |||
35 | +extern bool one_insn_per_tb; | ||
36 | + | ||
37 | #endif /* ACCEL_TCG_INTERNAL_H */ | ||
38 | diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/include/exec/cpu-common.h | ||
41 | +++ b/include/exec/cpu-common.h | ||
42 | @@ -XXX,XX +XXX,XX @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, | ||
43 | void *ptr, size_t len, bool is_write); | ||
44 | |||
45 | /* vl.c */ | ||
46 | -extern int singlestep; | ||
47 | - | ||
48 | void list_cpus(void); | ||
49 | |||
50 | #endif /* CPU_COMMON_H */ | ||
51 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/accel/tcg/cpu-exec.c | ||
54 | +++ b/accel/tcg/cpu-exec.c | ||
55 | @@ -XXX,XX +XXX,XX @@ uint32_t curr_cflags(CPUState *cpu) | ||
56 | */ | ||
57 | if (unlikely(cpu->singlestep_enabled)) { | ||
58 | cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1; | ||
59 | - } else if (singlestep) { | ||
60 | + } else if (qatomic_read(&one_insn_per_tb)) { | ||
61 | cflags |= CF_NO_GOTO_TB | 1; | ||
62 | } else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { | ||
63 | cflags |= CF_NO_GOTO_TB; | ||
64 | diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/accel/tcg/tcg-all.c | ||
67 | +++ b/accel/tcg/tcg-all.c | ||
28 | @@ -XXX,XX +XXX,XX @@ | 68 | @@ -XXX,XX +XXX,XX @@ |
29 | */ | ||
30 | |||
31 | #include "qemu/osdep.h" | ||
32 | -#include "qemu-common.h" | ||
33 | #include "qemu/datadir.h" | ||
34 | #include "qemu/error-report.h" | ||
35 | #include "qapi/error.h" | ||
36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/digic_boards.c | ||
39 | +++ b/hw/arm/digic_boards.c | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | |||
42 | #include "qemu/osdep.h" | ||
43 | #include "qapi/error.h" | ||
44 | -#include "qemu-common.h" | ||
45 | #include "qemu/datadir.h" | ||
46 | #include "hw/boards.h" | ||
47 | #include "qemu/error-report.h" | ||
48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/highbank.c | ||
51 | +++ b/hw/arm/highbank.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | */ | ||
54 | |||
55 | #include "qemu/osdep.h" | ||
56 | -#include "qemu-common.h" | ||
57 | #include "qemu/datadir.h" | ||
58 | #include "qapi/error.h" | ||
59 | #include "hw/sysbus.h" | ||
60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/npcm7xx_boards.c | ||
63 | +++ b/hw/arm/npcm7xx_boards.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "hw/qdev-core.h" | ||
66 | #include "hw/qdev-properties.h" | ||
67 | #include "qapi/error.h" | ||
68 | -#include "qemu-common.h" | ||
69 | #include "qemu/datadir.h" | ||
70 | #include "qemu/units.h" | ||
71 | #include "sysemu/blockdev.h" | ||
72 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/sbsa-ref.c | ||
75 | +++ b/hw/arm/sbsa-ref.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | */ | ||
78 | |||
79 | #include "qemu/osdep.h" | ||
80 | -#include "qemu-common.h" | ||
81 | #include "qemu/datadir.h" | ||
82 | #include "qapi/error.h" | 69 | #include "qapi/error.h" |
83 | #include "qemu/error-report.h" | 70 | #include "qemu/error-report.h" |
84 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c | 71 | #include "qemu/accel.h" |
72 | +#include "qemu/atomic.h" | ||
73 | #include "qapi/qapi-builtin-visit.h" | ||
74 | #include "qemu/units.h" | ||
75 | #if !defined(CONFIG_USER_ONLY) | ||
76 | @@ -XXX,XX +XXX,XX @@ static void tcg_accel_instance_init(Object *obj) | ||
77 | } | ||
78 | |||
79 | bool mttcg_enabled; | ||
80 | +bool one_insn_per_tb; | ||
81 | |||
82 | static int tcg_init_machine(MachineState *ms) | ||
83 | { | ||
84 | @@ -XXX,XX +XXX,XX @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp) | ||
85 | { | ||
86 | TCGState *s = TCG_STATE(obj); | ||
87 | s->one_insn_per_tb = value; | ||
88 | - /* For the moment, set the global also: this changes the behaviour */ | ||
89 | - singlestep = value; | ||
90 | + /* Set the global also: this changes the behaviour */ | ||
91 | + qatomic_set(&one_insn_per_tb, value); | ||
92 | } | ||
93 | |||
94 | static int tcg_gdbstub_supported_sstep_flags(void) | ||
95 | diff --git a/bsd-user/main.c b/bsd-user/main.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | 96 | index XXXXXXX..XXXXXXX 100644 |
86 | --- a/hw/arm/stm32f405_soc.c | 97 | --- a/bsd-user/main.c |
87 | +++ b/hw/arm/stm32f405_soc.c | 98 | +++ b/bsd-user/main.c |
88 | @@ -XXX,XX +XXX,XX @@ | 99 | @@ -XXX,XX +XXX,XX @@ |
89 | 100 | #include "host-os.h" | |
90 | #include "qemu/osdep.h" | 101 | #include "target_arch_cpu.h" |
91 | #include "qapi/error.h" | 102 | |
92 | -#include "qemu-common.h" | 103 | -int singlestep; |
93 | #include "exec/address-spaces.h" | 104 | static bool opt_one_insn_per_tb; |
94 | #include "sysemu/sysemu.h" | 105 | uintptr_t guest_base; |
95 | #include "hw/arm/stm32f405_soc.h" | 106 | bool have_guest_base; |
96 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | 107 | diff --git a/linux-user/main.c b/linux-user/main.c |
97 | index XXXXXXX..XXXXXXX 100644 | 108 | index XXXXXXX..XXXXXXX 100644 |
98 | --- a/hw/arm/vexpress.c | 109 | --- a/linux-user/main.c |
99 | +++ b/hw/arm/vexpress.c | 110 | +++ b/linux-user/main.c |
100 | @@ -XXX,XX +XXX,XX @@ | 111 | @@ -XXX,XX +XXX,XX @@ |
101 | 112 | char *exec_path; | |
102 | #include "qemu/osdep.h" | 113 | char real_exec_path[PATH_MAX]; |
103 | #include "qapi/error.h" | 114 | |
104 | -#include "qemu-common.h" | 115 | -int singlestep; |
105 | #include "qemu/datadir.h" | 116 | static bool opt_one_insn_per_tb; |
106 | #include "cpu.h" | 117 | static const char *argv0; |
107 | #include "hw/sysbus.h" | 118 | static const char *gdbstub; |
108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 119 | diff --git a/softmmu/globals.c b/softmmu/globals.c |
109 | index XXXXXXX..XXXXXXX 100644 | 120 | index XXXXXXX..XXXXXXX 100644 |
110 | --- a/hw/arm/virt.c | 121 | --- a/softmmu/globals.c |
111 | +++ b/hw/arm/virt.c | 122 | +++ b/softmmu/globals.c |
112 | @@ -XXX,XX +XXX,XX @@ | 123 | @@ -XXX,XX +XXX,XX @@ int vga_interface_type = VGA_NONE; |
113 | */ | 124 | bool vga_interface_created; |
114 | 125 | Chardev *parallel_hds[MAX_PARALLEL_PORTS]; | |
115 | #include "qemu/osdep.h" | 126 | int win2k_install_hack; |
116 | -#include "qemu-common.h" | 127 | -int singlestep; |
117 | #include "qemu/datadir.h" | 128 | int fd_bootchk = 1; |
118 | #include "qemu/units.h" | 129 | int graphic_rotate; |
119 | #include "qemu/option.h" | 130 | QEMUOptionRom option_rom[MAX_OPTION_ROMS]; |
120 | -- | 131 | -- |
121 | 2.25.1 | 132 | 2.34.1 |
122 | 133 | ||
123 | 134 | diff view generated by jsdifflib |
1 | The qemu-common.h header is not supposed to be included from any | 1 | The '-singlestep' option is confusing, because it doesn't actually |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | 2 | have anything to do with single-stepping the CPU. What it does do |
3 | the start of it). | 3 | is force TCG emulation to put one guest instruction in each TB, |
4 | which can be useful in some situations. | ||
4 | 5 | ||
5 | Nothing actually relies on target/rx/cpu.h including it, so we can | 6 | Create a new command line argument -one-insn-per-tb, so we can |
6 | just drop the include. | 7 | document that -singlestep is just a deprecated synonym for it, |
8 | and eventually perhaps drop it. | ||
7 | 9 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 12 | Reviewed-by: Warner Losh <imp@bsdimp.com> |
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | 14 | Message-id: 20230417164041.684562-5-peter.maydell@linaro.org |
13 | Message-id: 20211129200510.1233037-4-peter.maydell@linaro.org | ||
14 | --- | 15 | --- |
15 | target/rx/cpu.h | 1 - | 16 | docs/user/main.rst | 7 ++++++- |
16 | 1 file changed, 1 deletion(-) | 17 | linux-user/main.c | 9 ++++++--- |
18 | 2 files changed, 12 insertions(+), 4 deletions(-) | ||
17 | 19 | ||
18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h | 20 | diff --git a/docs/user/main.rst b/docs/user/main.rst |
19 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/rx/cpu.h | 22 | --- a/docs/user/main.rst |
21 | +++ b/target/rx/cpu.h | 23 | +++ b/docs/user/main.rst |
22 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ Debug options: |
23 | #define RX_CPU_H | 25 | ``-g port`` |
24 | 26 | Wait gdb connection to port | |
25 | #include "qemu/bitops.h" | 27 | |
26 | -#include "qemu-common.h" | 28 | +``-one-insn-per-tb`` |
27 | #include "hw/registerfields.h" | 29 | + Run the emulation with one guest instruction per translation block. |
28 | #include "cpu-qom.h" | 30 | + This slows down emulation a lot, but can be useful in some situations, |
29 | 31 | + such as when trying to analyse the logs produced by the ``-d`` option. | |
32 | + | ||
33 | ``-singlestep`` | ||
34 | - Run the emulation in single step mode. | ||
35 | + This is a deprecated synonym for the ``-one-insn-per-tb`` option. | ||
36 | |||
37 | Environment variables: | ||
38 | |||
39 | diff --git a/linux-user/main.c b/linux-user/main.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/linux-user/main.c | ||
42 | +++ b/linux-user/main.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static void handle_arg_reserved_va(const char *arg) | ||
44 | reserved_va = val ? val - 1 : 0; | ||
45 | } | ||
46 | |||
47 | -static void handle_arg_singlestep(const char *arg) | ||
48 | +static void handle_arg_one_insn_per_tb(const char *arg) | ||
49 | { | ||
50 | opt_one_insn_per_tb = true; | ||
51 | } | ||
52 | @@ -XXX,XX +XXX,XX @@ static const struct qemu_argument arg_table[] = { | ||
53 | "logfile", "write logs to 'logfile' (default stderr)"}, | ||
54 | {"p", "QEMU_PAGESIZE", true, handle_arg_pagesize, | ||
55 | "pagesize", "set the host page size to 'pagesize'"}, | ||
56 | - {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep, | ||
57 | - "", "run in singlestep mode"}, | ||
58 | + {"one-insn-per-tb", | ||
59 | + "QEMU_ONE_INSN_PER_TB", false, handle_arg_one_insn_per_tb, | ||
60 | + "", "run with one guest instruction per emulated TB"}, | ||
61 | + {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_one_insn_per_tb, | ||
62 | + "", "deprecated synonym for -one-insn-per-tb"}, | ||
63 | {"strace", "QEMU_STRACE", false, handle_arg_strace, | ||
64 | "", "log system calls"}, | ||
65 | {"seed", "QEMU_RAND_SEED", true, handle_arg_seed, | ||
30 | -- | 66 | -- |
31 | 2.25.1 | 67 | 2.34.1 |
32 | 68 | ||
33 | 69 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The '-singlestep' option is confusing, because it doesn't actually |
---|---|---|---|
2 | have anything to do with single-stepping the CPU. What it does do | ||
3 | is force TCG emulation to put one guest instruction in each TB, | ||
4 | which can be useful in some situations. | ||
2 | 5 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Create a new command line argument -one-insn-per-tb, so we can |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | document that -singlestep is just a deprecated synonym for it, |
8 | and eventually perhaps drop it. | ||
9 | |||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Warner Losh <imp@bsdimp.com> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Message-id: 20230417164041.684562-6-peter.maydell@linaro.org | ||
6 | --- | 15 | --- |
7 | target/arm/translate-a64.c | 7 ++++--- | 16 | docs/user/main.rst | 7 ++++++- |
8 | 1 file changed, 4 insertions(+), 3 deletions(-) | 17 | bsd-user/main.c | 5 +++-- |
18 | 2 files changed, 9 insertions(+), 3 deletions(-) | ||
9 | 19 | ||
10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 20 | diff --git a/docs/user/main.rst b/docs/user/main.rst |
11 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/arm/translate-a64.c | 22 | --- a/docs/user/main.rst |
13 | +++ b/target/arm/translate-a64.c | 23 | +++ b/docs/user/main.rst |
14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 24 | @@ -XXX,XX +XXX,XX @@ Debug options: |
15 | { | 25 | ``-p pagesize`` |
16 | DisasContext *s = container_of(dcbase, DisasContext, base); | 26 | Act as if the host page size was 'pagesize' bytes |
17 | CPUARMState *env = cpu->env_ptr; | 27 | |
18 | + uint64_t pc = s->base.pc_next; | 28 | +``-one-insn-per-tb`` |
19 | uint32_t insn; | 29 | + Run the emulation with one guest instruction per translation block. |
20 | 30 | + This slows down emulation a lot, but can be useful in some situations, | |
21 | if (s->ss_active && !s->pstate_ss) { | 31 | + such as when trying to analyse the logs produced by the ``-d`` option. |
22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 32 | + |
23 | return; | 33 | ``-singlestep`` |
24 | } | 34 | - Run the emulation in single step mode. |
25 | 35 | + This is a deprecated synonym for the ``-one-insn-per-tb`` option. | |
26 | - s->pc_curr = s->base.pc_next; | 36 | diff --git a/bsd-user/main.c b/bsd-user/main.c |
27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); | 37 | index XXXXXXX..XXXXXXX 100644 |
28 | + s->pc_curr = pc; | 38 | --- a/bsd-user/main.c |
29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | 39 | +++ b/bsd-user/main.c |
30 | s->insn = insn; | 40 | @@ -XXX,XX +XXX,XX @@ static void usage(void) |
31 | - s->base.pc_next += 4; | 41 | "-d item1[,...] enable logging of specified items\n" |
32 | + s->base.pc_next = pc + 4; | 42 | " (use '-d help' for a list of log items)\n" |
33 | 43 | "-D logfile write logs to 'logfile' (default stderr)\n" | |
34 | s->fp_access_checked = false; | 44 | - "-singlestep always run in singlestep mode\n" |
35 | s->sve_access_checked = false; | 45 | + "-one-insn-per-tb run with one guest instruction per emulated TB\n" |
46 | + "-singlestep deprecated synonym for -one-insn-per-tb\n" | ||
47 | "-strace log system calls\n" | ||
48 | "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n" | ||
49 | " specify tracing options\n" | ||
50 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
51 | (void) envlist_unsetenv(envlist, "LD_PRELOAD"); | ||
52 | } else if (!strcmp(r, "seed")) { | ||
53 | seed_optarg = optarg; | ||
54 | - } else if (!strcmp(r, "singlestep")) { | ||
55 | + } else if (!strcmp(r, "singlestep") || !strcmp(r, "one-insn-per-tb")) { | ||
56 | opt_one_insn_per_tb = true; | ||
57 | } else if (!strcmp(r, "strace")) { | ||
58 | do_strace = 1; | ||
36 | -- | 59 | -- |
37 | 2.25.1 | 60 | 2.34.1 |
38 | 61 | ||
39 | 62 | diff view generated by jsdifflib |
1 | The qemu-common.h header is not supposed to be included from any | 1 | Document that the -singlestep command line option is now |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | 2 | deprecated, as it is replaced by either the TCG accelerator |
3 | the start of it). | 3 | property 'one-insn-per-tb' for system emulation or the new |
4 | 4 | '-one-insn-per-tb' option for usermode emulation, and remove | |
5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. | 5 | the only use of the deprecated syntax from a README. |
6 | In fact, the include is not required at all, so we can just drop it | ||
7 | from both files. | ||
8 | 6 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | 10 | Message-id: 20230417164041.684562-7-peter.maydell@linaro.org |
13 | --- | 11 | --- |
14 | include/hw/i386/microvm.h | 1 - | 12 | docs/about/deprecated.rst | 16 ++++++++++++++++ |
15 | include/hw/i386/x86.h | 1 - | 13 | qemu-options.hx | 5 +++-- |
16 | 2 files changed, 2 deletions(-) | 14 | tcg/tci/README | 2 +- |
15 | 3 files changed, 20 insertions(+), 3 deletions(-) | ||
17 | 16 | ||
18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h | 17 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
19 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/i386/microvm.h | 19 | --- a/docs/about/deprecated.rst |
21 | +++ b/include/hw/i386/microvm.h | 20 | +++ b/docs/about/deprecated.rst |
22 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ Use ``-machine acpi=off`` instead. |
23 | #ifndef HW_I386_MICROVM_H | 22 | The HAXM project has been retired (see https://github.com/intel/haxm#status). |
24 | #define HW_I386_MICROVM_H | 23 | Use "whpx" (on Windows) or "hvf" (on macOS) instead. |
25 | 24 | ||
26 | -#include "qemu-common.h" | 25 | +``-singlestep`` (since 8.1) |
27 | #include "exec/hwaddr.h" | 26 | +''''''''''''''''''''''''''' |
28 | #include "qemu/notify.h" | 27 | + |
29 | 28 | +The ``-singlestep`` option has been turned into an accelerator property, | |
30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h | 29 | +and given a name that better reflects what it actually does. |
30 | +Use ``-accel tcg,one-insn-per-tb=on`` instead. | ||
31 | + | ||
32 | +User-mode emulator command line arguments | ||
33 | +----------------------------------------- | ||
34 | + | ||
35 | +``-singlestep`` (since 8.1) | ||
36 | +''''''''''''''''''''''''''' | ||
37 | + | ||
38 | +The ``-singlestep`` option has been given a name that better reflects | ||
39 | +what it actually does. For both linux-user and bsd-user, use the | ||
40 | +new ``-one-insn-per-tb`` option instead. | ||
41 | |||
42 | QEMU Machine Protocol (QMP) commands | ||
43 | ------------------------------------ | ||
44 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
31 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/include/hw/i386/x86.h | 46 | --- a/qemu-options.hx |
33 | +++ b/include/hw/i386/x86.h | 47 | +++ b/qemu-options.hx |
34 | @@ -XXX,XX +XXX,XX @@ | 48 | @@ -XXX,XX +XXX,XX @@ SRST |
35 | #ifndef HW_I386_X86_H | 49 | ERST |
36 | #define HW_I386_X86_H | 50 | |
37 | 51 | DEF("singlestep", 0, QEMU_OPTION_singlestep, \ | |
38 | -#include "qemu-common.h" | 52 | - "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL) |
39 | #include "exec/hwaddr.h" | 53 | + "-singlestep deprecated synonym for -accel tcg,one-insn-per-tb=on\n", QEMU_ARCH_ALL) |
40 | #include "qemu/notify.h" | 54 | SRST |
41 | 55 | ``-singlestep`` | |
56 | - Run the emulation in single step mode. | ||
57 | + This is a deprecated synonym for the TCG accelerator property | ||
58 | + ``one-insn-per-tb``. | ||
59 | ERST | ||
60 | |||
61 | DEF("preconfig", 0, QEMU_OPTION_preconfig, \ | ||
62 | diff --git a/tcg/tci/README b/tcg/tci/README | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/tcg/tci/README | ||
65 | +++ b/tcg/tci/README | ||
66 | @@ -XXX,XX +XXX,XX @@ The only difference from running QEMU with TCI to running without TCI | ||
67 | should be speed. Especially during development of TCI, it was very | ||
68 | useful to compare runs with and without TCI. Create /tmp/qemu.log by | ||
69 | |||
70 | - qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -singlestep | ||
71 | + qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -accel tcg,one-insn-per-tb=on | ||
72 | |||
73 | once with interpreter and once without interpreter and compare the resulting | ||
74 | qemu.log files. This is also useful to see the effects of additional | ||
42 | -- | 75 | -- |
43 | 2.25.1 | 76 | 2.34.1 |
44 | 77 | ||
45 | 78 | diff view generated by jsdifflib |
1 | The qemu-common.h header is not supposed to be included from any | 1 | Currently we report whether the TCG accelerator is in |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | 2 | 'one-insn-per-tb' mode in the 'info status' output. This is a pretty |
3 | the start of it). | 3 | minor piece of TCG specific information, and we want to deprecate the |
4 | 'singlestep' field of the associated QMP command. Move the | ||
5 | 'one-insn-per-tb' reporting to 'info jit'. | ||
4 | 6 | ||
5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for | 7 | We don't need a deprecate-and-drop period for this because the |
6 | the declaration of cpu_exec_step_atomic(). | 8 | HMP interface has no stability guarantees. |
7 | 9 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | 13 | Message-id: 20230417164041.684562-8-peter.maydell@linaro.org |
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
13 | --- | 14 | --- |
14 | target/hexagon/cpu.h | 1 - | 15 | accel/tcg/monitor.c | 14 ++++++++++++++ |
15 | linux-user/hexagon/cpu_loop.c | 1 + | 16 | softmmu/runstate-hmp-cmds.c | 5 ++--- |
16 | 2 files changed, 1 insertion(+), 1 deletion(-) | 17 | 2 files changed, 16 insertions(+), 3 deletions(-) |
17 | 18 | ||
18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h | 19 | diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/hexagon/cpu.h | 21 | --- a/accel/tcg/monitor.c |
21 | +++ b/target/hexagon/cpu.h | 22 | +++ b/accel/tcg/monitor.c |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; | ||
23 | |||
24 | #include "fpu/softfloat-types.h" | ||
25 | |||
26 | -#include "qemu-common.h" | ||
27 | #include "exec/cpu-defs.h" | ||
28 | #include "hex_regs.h" | ||
29 | #include "mmvec/mmvec.h" | ||
30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/linux-user/hexagon/cpu_loop.c | ||
33 | +++ b/linux-user/hexagon/cpu_loop.c | ||
34 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ |
35 | */ | 24 | */ |
36 | 25 | ||
37 | #include "qemu/osdep.h" | 26 | #include "qemu/osdep.h" |
38 | +#include "qemu-common.h" | 27 | +#include "qemu/accel.h" |
39 | #include "qemu.h" | 28 | #include "qapi/error.h" |
40 | #include "user-internals.h" | 29 | #include "qapi/type-helpers.h" |
41 | #include "cpu_loop-common.h" | 30 | #include "qapi/qapi-commands-machine.h" |
31 | @@ -XXX,XX +XXX,XX @@ static void dump_drift_info(GString *buf) | ||
32 | } | ||
33 | } | ||
34 | |||
35 | +static void dump_accel_info(GString *buf) | ||
36 | +{ | ||
37 | + AccelState *accel = current_accel(); | ||
38 | + bool one_insn_per_tb = object_property_get_bool(OBJECT(accel), | ||
39 | + "one-insn-per-tb", | ||
40 | + &error_fatal); | ||
41 | + | ||
42 | + g_string_append_printf(buf, "Accelerator settings:\n"); | ||
43 | + g_string_append_printf(buf, "one-insn-per-tb: %s\n\n", | ||
44 | + one_insn_per_tb ? "on" : "off"); | ||
45 | +} | ||
46 | + | ||
47 | HumanReadableText *qmp_x_query_jit(Error **errp) | ||
48 | { | ||
49 | g_autoptr(GString) buf = g_string_new(""); | ||
50 | @@ -XXX,XX +XXX,XX @@ HumanReadableText *qmp_x_query_jit(Error **errp) | ||
51 | return NULL; | ||
52 | } | ||
53 | |||
54 | + dump_accel_info(buf); | ||
55 | dump_exec_info(buf); | ||
56 | dump_drift_info(buf); | ||
57 | |||
58 | diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/softmmu/runstate-hmp-cmds.c | ||
61 | +++ b/softmmu/runstate-hmp-cmds.c | ||
62 | @@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict) | ||
63 | |||
64 | info = qmp_query_status(NULL); | ||
65 | |||
66 | - monitor_printf(mon, "VM status: %s%s", | ||
67 | - info->running ? "running" : "paused", | ||
68 | - info->singlestep ? " (single step mode)" : ""); | ||
69 | + monitor_printf(mon, "VM status: %s", | ||
70 | + info->running ? "running" : "paused"); | ||
71 | |||
72 | if (!info->running && info->status != RUN_STATE_PAUSED) { | ||
73 | monitor_printf(mon, " (%s)", RunState_str(info->status)); | ||
42 | -- | 74 | -- |
43 | 2.25.1 | 75 | 2.34.1 |
44 | 76 | ||
45 | 77 | diff view generated by jsdifflib |
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | 1 | The 'singlestep' HMP command is confusing, because it doesn't |
---|---|---|---|
2 | actually have anything to do with single-stepping the CPU. What it | ||
3 | does do is force TCG emulation to put one guest instruction in each | ||
4 | TB, which can be useful in some situations. | ||
2 | 5 | ||
3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. | 6 | Create a new HMP command 'one-insn-per-tb', so we can document that |
4 | Remove the restriction that prevents from instantiating a virtio-iommu | 7 | 'singlestep' is just a deprecated synonym for it, and eventually |
5 | device under ACPI. | 8 | perhaps drop it. |
6 | 9 | ||
7 | Acked-by: Igor Mammedov <imammedo@redhat.com> | 10 | We aren't obliged to do deprecate-and-drop for HMP commands, |
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | 11 | but it's easy enough to do so, so we do. |
9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | 12 | |
10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
17 | Message-id: 20230417164041.684562-9-peter.maydell@linaro.org | ||
12 | --- | 18 | --- |
13 | hw/arm/virt.c | 10 ++-------- | 19 | docs/about/deprecated.rst | 9 +++++++++ |
14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- | 20 | include/monitor/hmp.h | 2 +- |
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | 21 | softmmu/runstate-hmp-cmds.c | 2 +- |
22 | tests/qtest/test-hmp.c | 1 + | ||
23 | hmp-commands.hx | 25 +++++++++++++++++++++---- | ||
24 | 5 files changed, 33 insertions(+), 6 deletions(-) | ||
16 | 25 | ||
17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 26 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
18 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/virt.c | 28 | --- a/docs/about/deprecated.rst |
20 | +++ b/hw/arm/virt.c | 29 | +++ b/docs/about/deprecated.rst |
21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, | 30 | @@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that |
22 | MachineClass *mc = MACHINE_GET_CLASS(machine); | 31 | all arguments passed to ``device_add`` are consistent with the documented |
23 | 32 | property types. | |
24 | if (device_is_dynamic_sysbus(mc, dev) || | 33 | |
25 | - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { | 34 | +Human Monitor Protocol (HMP) commands |
26 | + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || | 35 | +------------------------------------- |
27 | + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | 36 | + |
28 | return HOTPLUG_HANDLER(machine); | 37 | +``singlestep`` (since 8.1) |
29 | } | 38 | +'''''''''''''''''''''''''' |
30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | 39 | + |
31 | - VirtMachineState *vms = VIRT_MACHINE(machine); | 40 | +The ``singlestep`` command has been replaced by the ``one-insn-per-tb`` |
32 | - | 41 | +command, which has the same behaviour but a less misleading name. |
33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { | 42 | + |
34 | - return HOTPLUG_HANDLER(machine); | 43 | Host Architectures |
35 | - } | 44 | ------------------ |
36 | - } | 45 | |
37 | return NULL; | 46 | diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h |
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/include/monitor/hmp.h | ||
49 | +++ b/include/monitor/hmp.h | ||
50 | @@ -XXX,XX +XXX,XX @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); | ||
51 | void hmp_human_readable_text_helper(Monitor *mon, | ||
52 | HumanReadableText *(*qmp_handler)(Error **)); | ||
53 | void hmp_info_stats(Monitor *mon, const QDict *qdict); | ||
54 | -void hmp_singlestep(Monitor *mon, const QDict *qdict); | ||
55 | +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict); | ||
56 | void hmp_watchdog_action(Monitor *mon, const QDict *qdict); | ||
57 | void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict); | ||
58 | void hmp_info_capture(Monitor *mon, const QDict *qdict); | ||
59 | diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/softmmu/runstate-hmp-cmds.c | ||
62 | +++ b/softmmu/runstate-hmp-cmds.c | ||
63 | @@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict) | ||
64 | qapi_free_StatusInfo(info); | ||
38 | } | 65 | } |
39 | 66 | ||
40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c | 67 | -void hmp_singlestep(Monitor *mon, const QDict *qdict) |
68 | +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) | ||
69 | { | ||
70 | const char *option = qdict_get_try_str(qdict, "option"); | ||
71 | AccelState *accel = current_accel(); | ||
72 | diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | 73 | index XXXXXXX..XXXXXXX 100644 |
42 | --- a/hw/virtio/virtio-iommu-pci.c | 74 | --- a/tests/qtest/test-hmp.c |
43 | +++ b/hw/virtio/virtio-iommu-pci.c | 75 | +++ b/tests/qtest/test-hmp.c |
44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | 76 | @@ -XXX,XX +XXX,XX @@ static const char *hmp_cmds[] = { |
45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); | 77 | "o /w 0 0x1234", |
46 | 78 | "object_add memory-backend-ram,id=mem1,size=256M", | |
47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { | 79 | "object_del mem1", |
48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | 80 | + "one-insn-per-tb on", |
49 | - | 81 | "pmemsave 0 4096 \"/dev/null\"", |
50 | - error_setg(errp, | 82 | "p $pc + 8", |
51 | - "%s machine fails to create iommu-map device tree bindings", | 83 | "qom-list /", |
52 | - mc->name); | 84 | diff --git a/hmp-commands.hx b/hmp-commands.hx |
53 | - error_append_hint(errp, | 85 | index XXXXXXX..XXXXXXX 100644 |
54 | - "Check your machine implements a hotplug handler " | 86 | --- a/hmp-commands.hx |
55 | - "for the virtio-iommu-pci device\n"); | 87 | +++ b/hmp-commands.hx |
56 | - error_append_hint(errp, "Check the guest is booted without FW or with " | 88 | @@ -XXX,XX +XXX,XX @@ SRST |
57 | - "-no-acpi\n"); | 89 | only *tag* as parameter. |
58 | + error_setg(errp, "Check your machine implements a hotplug handler " | 90 | ERST |
59 | + "for the virtio-iommu-pci device"); | 91 | |
60 | return; | 92 | + { |
61 | } | 93 | + .name = "one-insn-per-tb", |
62 | for (int i = 0; i < s->nb_reserved_regions; i++) { | 94 | + .args_type = "option:s?", |
95 | + .params = "[on|off]", | ||
96 | + .help = "run emulation with one guest instruction per translation block", | ||
97 | + .cmd = hmp_one_insn_per_tb, | ||
98 | + }, | ||
99 | + | ||
100 | +SRST | ||
101 | +``one-insn-per-tb [off]`` | ||
102 | + Run the emulation with one guest instruction per translation block. | ||
103 | + This slows down emulation a lot, but can be useful in some situations, | ||
104 | + such as when trying to analyse the logs produced by the ``-d`` option. | ||
105 | + This only has an effect when using TCG, not with KVM or other accelerators. | ||
106 | + | ||
107 | + If called with option off, the emulation returns to normal mode. | ||
108 | +ERST | ||
109 | + | ||
110 | { | ||
111 | .name = "singlestep", | ||
112 | .args_type = "option:s?", | ||
113 | .params = "[on|off]", | ||
114 | - .help = "run emulation in singlestep mode or switch to normal mode", | ||
115 | - .cmd = hmp_singlestep, | ||
116 | + .help = "deprecated synonym for one-insn-per-tb", | ||
117 | + .cmd = hmp_one_insn_per_tb, | ||
118 | }, | ||
119 | |||
120 | SRST | ||
121 | ``singlestep [off]`` | ||
122 | - Run the emulation in single step mode. | ||
123 | - If called with option off, the emulation returns to normal mode. | ||
124 | + This is a deprecated synonym for the one-insn-per-tb command. | ||
125 | ERST | ||
126 | |||
127 | { | ||
63 | -- | 128 | -- |
64 | 2.25.1 | 129 | 2.34.1 |
65 | 130 | ||
66 | 131 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | The run-state.json file is missing a trailing newline; add it. |
---|---|---|---|
2 | 2 | ||
3 | Move it to the supported list. | ||
4 | |||
5 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
6 | Message-id: 20211117065752.330632-5-joel@jms.id.au | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
6 | Message-id: 20230417164041.684562-10-peter.maydell@linaro.org | ||
8 | --- | 7 | --- |
9 | docs/system/arm/aspeed.rst | 2 +- | 8 | qapi/run-state.json | 2 +- |
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
11 | 10 | ||
12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 11 | diff --git a/qapi/run-state.json b/qapi/run-state.json |
13 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/docs/system/arm/aspeed.rst | 13 | --- a/qapi/run-state.json |
15 | +++ b/docs/system/arm/aspeed.rst | 14 | +++ b/qapi/run-state.json |
16 | @@ -XXX,XX +XXX,XX @@ Supported devices | 15 | @@ -XXX,XX +XXX,XX @@ |
17 | * Front LEDs (PCA9552 on I2C bus) | 16 | # Since: 7.2 |
18 | * LPC Peripheral Controller (a subset of subdevices are supported) | 17 | ## |
19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA | 18 | { 'enum': 'NotifyVmexitOption', |
20 | + * ADC | 19 | - 'data': [ 'run', 'internal-error', 'disable' ] } |
21 | 20 | \ No newline at end of file | |
22 | 21 | + 'data': [ 'run', 'internal-error', 'disable' ] } | |
23 | Missing devices | ||
24 | --------------- | ||
25 | |||
26 | * Coprocessor support | ||
27 | - * ADC (out of tree implementation) | ||
28 | * PWM and Fan Controller | ||
29 | * Slave GPIO Controller | ||
30 | * Super I/O Controller | ||
31 | -- | 22 | -- |
32 | 2.25.1 | 23 | 2.34.1 |
33 | 24 | ||
34 | 25 | diff view generated by jsdifflib |
1 | In the SSE decode function gen_sse(), we combine a byte | 1 | The 'singlestep' member of StatusInfo has never done what the QMP |
---|---|---|---|
2 | 'b' and a value 'b1' which can be [0..3], and switch on them: | 2 | documentation claims it does. What it actually reports is whether |
3 | b |= (b1 << 8); | 3 | TCG is working in "one guest instruction per translation block" mode. |
4 | switch (b) { | ||
5 | ... | ||
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
11 | 4 | ||
12 | In three cases inside this switch, we were then also checking for | 5 | We no longer need this field for the HMP 'info status' command, as |
13 | "if (b1 >= 2) { goto unknown_op; }". | 6 | we've moved that information to 'info jit'. It seems unlikely that |
14 | However, this can never happen, because the 'case' values in each place | 7 | anybody is monitoring the state of this obscure TCG setting via QMP, |
15 | are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3) | 8 | especially since QMP provides no means for changing the setting. So |
16 | cases to the default already. | 9 | simply deprecate the field, without providing any replacement. |
17 | 10 | ||
18 | This check was added in commit c045af25a52e9 in 2010; the added code | 11 | Until we do eventually delete the member, correct the misstatements |
19 | was unnecessary then as well, and was apparently intended only to | 12 | in the QAPI documentation about it. |
20 | ensure that we never accidentally ended up indexing off the end | ||
21 | of an sse_op_table with only 2 entries as a result of future bugs | ||
22 | in the decode logic. | ||
23 | 13 | ||
24 | Change the checks to assert() instead, and make sure they're always | 14 | If we do find that there are users for this, then the most likely way |
25 | immediately before the array access they are protecting. | 15 | we would provide replacement access to the information would be to |
16 | put the accelerator QOM object at a well-known path such as | ||
17 | /machine/accel, which could then be used with the existing qom-set | ||
18 | and qom-get commands. | ||
26 | 19 | ||
27 | Fixes: Coverity CID 1460207 | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
22 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
23 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | ||
24 | Message-id: 20230417164041.684562-11-peter.maydell@linaro.org | ||
30 | --- | 25 | --- |
31 | target/i386/tcg/translate.c | 12 +++--------- | 26 | docs/about/deprecated.rst | 14 ++++++++++++++ |
32 | 1 file changed, 3 insertions(+), 9 deletions(-) | 27 | qapi/run-state.json | 14 +++++++++++--- |
28 | 2 files changed, 25 insertions(+), 3 deletions(-) | ||
33 | 29 | ||
34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c | 30 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
35 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/i386/tcg/translate.c | 32 | --- a/docs/about/deprecated.rst |
37 | +++ b/target/i386/tcg/translate.c | 33 | +++ b/docs/about/deprecated.rst |
38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 34 | @@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that |
39 | case 0x171: /* shift xmm, im */ | 35 | all arguments passed to ``device_add`` are consistent with the documented |
40 | case 0x172: | 36 | property types. |
41 | case 0x173: | 37 | |
42 | - if (b1 >= 2) { | 38 | +``StatusInfo`` member ``singlestep`` (since 8.1) |
43 | - goto unknown_op; | 39 | +'''''''''''''''''''''''''''''''''''''''''''''''' |
44 | - } | 40 | + |
45 | val = x86_ldub_code(env, s); | 41 | +The ``singlestep`` member of the ``StatusInfo`` returned from the |
46 | if (is_xmm) { | 42 | +``query-status`` command is deprecated. This member has a confusing |
47 | tcg_gen_movi_tl(s->T0, val); | 43 | +name and it never did what the documentation claimed or what its name |
48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 44 | +suggests. We do not believe that anybody is actually using the |
49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); | 45 | +information provided in this member. |
50 | op1_offset = offsetof(CPUX86State,mmx_t0); | 46 | + |
51 | } | 47 | +The information it reports is whether the TCG JIT is in "one |
52 | + assert(b1 < 2); | 48 | +instruction per translated block" mode (which can be set on the |
53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + | 49 | +command line or via the HMP, but not via QMP). The information remains |
54 | (((modrm >> 3)) & 7)][b1]; | 50 | +available via the HMP 'info jit' command. |
55 | if (!sse_fn_epp) { | 51 | + |
56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 52 | Human Monitor Protocol (HMP) commands |
57 | rm = modrm & 7; | 53 | ------------------------------------- |
58 | reg = ((modrm >> 3) & 7) | REX_R(s); | 54 | |
59 | mod = (modrm >> 6) & 3; | 55 | diff --git a/qapi/run-state.json b/qapi/run-state.json |
60 | - if (b1 >= 2) { | 56 | index XXXXXXX..XXXXXXX 100644 |
61 | - goto unknown_op; | 57 | --- a/qapi/run-state.json |
62 | - } | 58 | +++ b/qapi/run-state.json |
63 | 59 | @@ -XXX,XX +XXX,XX @@ | |
64 | + assert(b1 < 2); | 60 | # |
65 | sse_fn_epp = sse_op_table6[b].op[b1]; | 61 | # @running: true if all VCPUs are runnable, false if not runnable |
66 | if (!sse_fn_epp) { | 62 | # |
67 | goto unknown_op; | 63 | -# @singlestep: true if VCPUs are in single-step mode |
68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | 64 | +# @singlestep: true if using TCG with one guest instruction |
69 | rm = modrm & 7; | 65 | +# per translation block |
70 | reg = ((modrm >> 3) & 7) | REX_R(s); | 66 | # |
71 | mod = (modrm >> 6) & 3; | 67 | # @status: the virtual machine @RunState |
72 | - if (b1 >= 2) { | 68 | # |
73 | - goto unknown_op; | 69 | +# Features: |
74 | - } | 70 | +# @deprecated: Member 'singlestep' is deprecated (with no replacement). |
75 | 71 | +# | |
76 | + assert(b1 < 2); | 72 | # Since: 0.14 |
77 | sse_fn_eppi = sse_op_table7[b].op[b1]; | 73 | # |
78 | if (!sse_fn_eppi) { | 74 | -# Notes: @singlestep is enabled through the GDB stub |
79 | goto unknown_op; | 75 | +# Notes: @singlestep is enabled on the command line with |
76 | +# '-accel tcg,one-insn-per-tb=on', or with the HMP | ||
77 | +# 'one-insn-per-tb' command. | ||
78 | ## | ||
79 | { 'struct': 'StatusInfo', | ||
80 | - 'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} } | ||
81 | + 'data': {'running': 'bool', | ||
82 | + 'singlestep': { 'type': 'bool', 'features': [ 'deprecated' ]}, | ||
83 | + 'status': 'RunState'} } | ||
84 | |||
85 | ## | ||
86 | # @query-status: | ||
80 | -- | 87 | -- |
81 | 2.25.1 | 88 | 2.34.1 |
82 | 89 | ||
83 | 90 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | In commit 5242876f37ca we deprecated the dtb-kaslr-seed property of |
---|---|---|---|
2 | the virt board, but forgot the "since n.n" tag in the documentation | ||
3 | of this in deprecated.rst. | ||
2 | 4 | ||
3 | The TYPE_ARM_GICV3 device is an emulated one. When using | 5 | This deprecation note first appeared in the 7.1 release, so |
4 | KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device | 6 | retrospectively add the correct "since 7.1" annotation to it. |
5 | (which uses in-kernel support). | ||
6 | 7 | ||
7 | When using --with-devices-FOO, it is possible to build a | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | binary with a specific set of devices. When this binary is | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | restricted to KVM accelerator, the TYPE_ARM_GICV3 device is | 10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
10 | irrelevant, and it is desirable to remove it from the binary. | 11 | Message-id: 20230420122256.1023709-1-peter.maydell@linaro.org |
12 | --- | ||
13 | docs/about/deprecated.rst | 4 ++-- | ||
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
11 | 15 | ||
12 | Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector | 16 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
13 | which select the files required to have the TYPE_ARM_GICV3 | ||
14 | device, but also allowing to de-select this device. | ||
15 | |||
16 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Message-id: 20211115223619.2599282-3-philmd@redhat.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | hw/intc/arm_gicv3.c | 2 +- | ||
22 | hw/intc/Kconfig | 5 +++++ | ||
23 | hw/intc/meson.build | 10 ++++++---- | ||
24 | 3 files changed, 12 insertions(+), 5 deletions(-) | ||
25 | |||
26 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/intc/arm_gicv3.c | 18 | --- a/docs/about/deprecated.rst |
29 | +++ b/hw/intc/arm_gicv3.c | 19 | +++ b/docs/about/deprecated.rst |
30 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead. |
31 | /* | 21 | System emulator machines |
32 | - * ARM Generic Interrupt Controller v3 | 22 | ------------------------ |
33 | + * ARM Generic Interrupt Controller v3 (emulation) | 23 | |
34 | * | 24 | -Arm ``virt`` machine ``dtb-kaslr-seed`` property |
35 | * Copyright (c) 2015 Huawei. | 25 | -'''''''''''''''''''''''''''''''''''''''''''''''' |
36 | * Copyright (c) 2016 Linaro Limited | 26 | +Arm ``virt`` machine ``dtb-kaslr-seed`` property (since 7.1) |
37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig | 27 | +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
38 | index XXXXXXX..XXXXXXX 100644 | 28 | |
39 | --- a/hw/intc/Kconfig | 29 | The ``dtb-kaslr-seed`` property on the ``virt`` board has been |
40 | +++ b/hw/intc/Kconfig | 30 | deprecated; use the new name ``dtb-randomness`` instead. The new name |
41 | @@ -XXX,XX +XXX,XX @@ config APIC | ||
42 | select MSI_NONBROKEN | ||
43 | select I8259 | ||
44 | |||
45 | +config ARM_GIC_TCG | ||
46 | + bool | ||
47 | + default y | ||
48 | + depends on ARM_GIC && TCG | ||
49 | + | ||
50 | config ARM_GIC_KVM | ||
51 | bool | ||
52 | default y | ||
53 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/intc/meson.build | ||
56 | +++ b/hw/intc/meson.build | ||
57 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( | ||
58 | 'arm_gic.c', | ||
59 | 'arm_gic_common.c', | ||
60 | 'arm_gicv2m.c', | ||
61 | - 'arm_gicv3.c', | ||
62 | 'arm_gicv3_common.c', | ||
63 | - 'arm_gicv3_dist.c', | ||
64 | 'arm_gicv3_its_common.c', | ||
65 | - 'arm_gicv3_redist.c', | ||
66 | +)) | ||
67 | +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( | ||
68 | + 'arm_gicv3.c', | ||
69 | + 'arm_gicv3_dist.c', | ||
70 | 'arm_gicv3_its.c', | ||
71 | + 'arm_gicv3_redist.c', | ||
72 | )) | ||
73 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) | ||
74 | softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) | ||
75 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | ||
76 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | ||
77 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | ||
78 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | ||
79 | -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | ||
80 | +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c')) | ||
81 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | ||
82 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | ||
83 | specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) | ||
84 | -- | 31 | -- |
85 | 2.25.1 | 32 | 2.34.1 |
86 | 33 | ||
87 | 34 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The msf2-emac ethernet controller has functions emac_load_desc() and |
---|---|---|---|
2 | emac_store_desc() which read and write the in-memory descriptor | ||
3 | blocks and handle conversion between guest and host endianness. | ||
2 | 4 | ||
3 | For A64, any input to an indirect branch can cause this. | 5 | As currently written, emac_store_desc() does the endianness |
6 | conversion in-place; this means that it effectively consumes the | ||
7 | input EmacDesc struct, because on a big-endian host the fields will | ||
8 | be overwritten with the little-endian versions of their values. | ||
9 | Unfortunately, in all the callsites the code continues to access | ||
10 | fields in the EmacDesc struct after it has called emac_store_desc() | ||
11 | -- specifically, it looks at the d.next field. | ||
4 | 12 | ||
5 | For A32, many indirect branch paths force the branch to be aligned, | 13 | The effect of this is that on a big-endian host networking doesn't |
6 | but BXWritePC does not. This includes the BX instruction but also | 14 | work because the address of the next descriptor is corrupted. |
7 | other interworking changes to PC. Prior to v8, this case is UNDEFINED. | ||
8 | With v8, this is CONSTRAINED UNPREDICTABLE and may either raise an | ||
9 | exception or force align the PC. | ||
10 | 15 | ||
11 | We choose to raise an exception because we have the infrastructure, | 16 | We could fix this by making the callsite avoid using the struct; but |
12 | it makes the generated code for gen_bx simpler, and it has the | 17 | it's more robust to have emac_store_desc() leave its input alone. |
13 | possibility of catching more guest bugs. | ||
14 | 18 | ||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 19 | (emac_load_desc() also does an in-place conversion, but here this is |
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 20 | fine, because the function is supposed to be initializing the |
21 | struct.) | ||
22 | |||
23 | Cc: qemu-stable@nongnu.org | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
26 | Message-id: 20230424151919.1333299-1-peter.maydell@linaro.org | ||
18 | --- | 27 | --- |
19 | target/arm/helper.h | 1 + | 28 | hw/net/msf2-emac.c | 16 ++++++++++------ |
20 | target/arm/syndrome.h | 5 ++++ | 29 | 1 file changed, 10 insertions(+), 6 deletions(-) |
21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- | ||
22 | target/arm/tlb_helper.c | 18 ++++++++++++++ | ||
23 | target/arm/translate-a64.c | 15 ++++++++++++ | ||
24 | target/arm/translate.c | 22 ++++++++++++++++- | ||
25 | 6 files changed, 87 insertions(+), 20 deletions(-) | ||
26 | 30 | ||
27 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 31 | diff --git a/hw/net/msf2-emac.c b/hw/net/msf2-emac.c |
28 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/helper.h | 33 | --- a/hw/net/msf2-emac.c |
30 | +++ b/target/arm/helper.h | 34 | +++ b/hw/net/msf2-emac.c |
31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, | 35 | @@ -XXX,XX +XXX,XX @@ static void emac_load_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc) |
32 | DEF_HELPER_2(exception_internal, void, env, i32) | 36 | d->next = le32_to_cpu(d->next); |
33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) | ||
34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | ||
35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) | ||
36 | DEF_HELPER_1(setend, void, env) | ||
37 | DEF_HELPER_2(wfi, void, env, i32) | ||
38 | DEF_HELPER_1(wfe, void, env) | ||
39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/syndrome.h | ||
42 | +++ b/target/arm/syndrome.h | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) | ||
44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
45 | } | 37 | } |
46 | 38 | ||
47 | +static inline uint32_t syn_pcalignment(void) | 39 | -static void emac_store_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc) |
48 | +{ | 40 | +static void emac_store_desc(MSF2EmacState *s, const EmacDesc *d, hwaddr desc) |
49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; | 41 | { |
50 | +} | 42 | - /* Convert from host endianness into LE. */ |
51 | + | 43 | - d->pktaddr = cpu_to_le32(d->pktaddr); |
52 | #endif /* TARGET_ARM_SYNDROME_H */ | 44 | - d->pktsize = cpu_to_le32(d->pktsize); |
53 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c | 45 | - d->next = cpu_to_le32(d->next); |
54 | index XXXXXXX..XXXXXXX 100644 | 46 | + EmacDesc outd; |
55 | --- a/linux-user/aarch64/cpu_loop.c | 47 | + /* |
56 | +++ b/linux-user/aarch64/cpu_loop.c | 48 | + * Convert from host endianness into LE. We use a local struct because |
57 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) | 49 | + * calling code may still want to look at the fields afterwards. |
58 | break; | 50 | + */ |
59 | case EXCP_PREFETCH_ABORT: | 51 | + outd.pktaddr = cpu_to_le32(d->pktaddr); |
60 | case EXCP_DATA_ABORT: | 52 | + outd.pktsize = cpu_to_le32(d->pktsize); |
61 | - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ | 53 | + outd.next = cpu_to_le32(d->next); |
62 | ec = syn_get_ec(env->exception.syndrome); | 54 | |
63 | - assert(ec == EC_DATAABORT || ec == EC_INSNABORT); | 55 | - address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, d, sizeof *d); |
64 | - | 56 | + address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, &outd, sizeof outd); |
65 | - /* Both EC have the same format for FSC, or close enough. */ | ||
66 | - fsc = extract32(env->exception.syndrome, 0, 6); | ||
67 | - switch (fsc) { | ||
68 | - case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
69 | - si_signo = TARGET_SIGSEGV; | ||
70 | - si_code = TARGET_SEGV_MAPERR; | ||
71 | + switch (ec) { | ||
72 | + case EC_DATAABORT: | ||
73 | + case EC_INSNABORT: | ||
74 | + /* Both EC have the same format for FSC, or close enough. */ | ||
75 | + fsc = extract32(env->exception.syndrome, 0, 6); | ||
76 | + switch (fsc) { | ||
77 | + case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
78 | + si_signo = TARGET_SIGSEGV; | ||
79 | + si_code = TARGET_SEGV_MAPERR; | ||
80 | + break; | ||
81 | + case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
82 | + case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
83 | + si_signo = TARGET_SIGSEGV; | ||
84 | + si_code = TARGET_SEGV_ACCERR; | ||
85 | + break; | ||
86 | + case 0x11: /* Synchronous Tag Check Fault */ | ||
87 | + si_signo = TARGET_SIGSEGV; | ||
88 | + si_code = TARGET_SEGV_MTESERR; | ||
89 | + break; | ||
90 | + case 0x21: /* Alignment fault */ | ||
91 | + si_signo = TARGET_SIGBUS; | ||
92 | + si_code = TARGET_BUS_ADRALN; | ||
93 | + break; | ||
94 | + default: | ||
95 | + g_assert_not_reached(); | ||
96 | + } | ||
97 | break; | ||
98 | - case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
99 | - case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
100 | - si_signo = TARGET_SIGSEGV; | ||
101 | - si_code = TARGET_SEGV_ACCERR; | ||
102 | - break; | ||
103 | - case 0x11: /* Synchronous Tag Check Fault */ | ||
104 | - si_signo = TARGET_SIGSEGV; | ||
105 | - si_code = TARGET_SEGV_MTESERR; | ||
106 | - break; | ||
107 | - case 0x21: /* Alignment fault */ | ||
108 | + case EC_PCALIGNMENT: | ||
109 | si_signo = TARGET_SIGBUS; | ||
110 | si_code = TARGET_BUS_ADRALN; | ||
111 | break; | ||
112 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/target/arm/tlb_helper.c | ||
115 | +++ b/target/arm/tlb_helper.c | ||
116 | @@ -XXX,XX +XXX,XX @@ | ||
117 | #include "cpu.h" | ||
118 | #include "internals.h" | ||
119 | #include "exec/exec-all.h" | ||
120 | +#include "exec/helper-proto.h" | ||
121 | |||
122 | static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
123 | unsigned int target_el, | ||
124 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | ||
125 | arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi); | ||
126 | } | 57 | } |
127 | 58 | ||
128 | +void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) | 59 | static void msf2_dma_tx(MSF2EmacState *s) |
129 | +{ | ||
130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; | ||
131 | + int target_el = exception_target_el(env); | ||
132 | + int mmu_idx = cpu_mmu_index(env, true); | ||
133 | + uint32_t fsc; | ||
134 | + | ||
135 | + env->exception.vaddress = pc; | ||
136 | + | ||
137 | + /* | ||
138 | + * Note that the fsc is not applicable to this exception, | ||
139 | + * since any syndrome is pcalignment not insn_abort. | ||
140 | + */ | ||
141 | + env->exception.fsr = compute_fsr_fsc(env, &fi, target_el, mmu_idx, &fsc); | ||
142 | + raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el); | ||
143 | +} | ||
144 | + | ||
145 | #if !defined(CONFIG_USER_ONLY) | ||
146 | |||
147 | /* | ||
148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
149 | index XXXXXXX..XXXXXXX 100644 | ||
150 | --- a/target/arm/translate-a64.c | ||
151 | +++ b/target/arm/translate-a64.c | ||
152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
153 | uint64_t pc = s->base.pc_next; | ||
154 | uint32_t insn; | ||
155 | |||
156 | + /* Singlestep exceptions have the highest priority. */ | ||
157 | if (s->ss_active && !s->pstate_ss) { | ||
158 | /* Singlestep state is Active-pending. | ||
159 | * If we're in this state at the start of a TB then either | ||
160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | + if (pc & 3) { | ||
165 | + /* | ||
166 | + * PC alignment fault. This has priority over the instruction abort | ||
167 | + * that we would receive from a translation fault via arm_ldl_code. | ||
168 | + * This should only be possible after an indirect branch, at the | ||
169 | + * start of the TB. | ||
170 | + */ | ||
171 | + assert(s->base.num_insns == 1); | ||
172 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
173 | + s->base.is_jmp = DISAS_NORETURN; | ||
174 | + s->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
175 | + return; | ||
176 | + } | ||
177 | + | ||
178 | s->pc_curr = pc; | ||
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
180 | s->insn = insn; | ||
181 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/target/arm/translate.c | ||
184 | +++ b/target/arm/translate.c | ||
185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
186 | uint32_t pc = dc->base.pc_next; | ||
187 | unsigned int insn; | ||
188 | |||
189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
190 | + /* Singlestep exceptions have the highest priority. */ | ||
191 | + if (arm_check_ss_active(dc)) { | ||
192 | + dc->base.pc_next = pc + 4; | ||
193 | + return; | ||
194 | + } | ||
195 | + | ||
196 | + if (pc & 3) { | ||
197 | + /* | ||
198 | + * PC alignment fault. This has priority over the instruction abort | ||
199 | + * that we would receive from a translation fault via arm_ldl_code | ||
200 | + * (or the execution of the kernelpage entrypoint). This should only | ||
201 | + * be possible after an indirect branch, at the start of the TB. | ||
202 | + */ | ||
203 | + assert(dc->base.num_insns == 1); | ||
204 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
205 | + dc->base.is_jmp = DISAS_NORETURN; | ||
206 | + dc->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
207 | + return; | ||
208 | + } | ||
209 | + | ||
210 | + if (arm_check_kernelpage(dc)) { | ||
211 | dc->base.pc_next = pc + 4; | ||
212 | return; | ||
213 | } | ||
214 | -- | 60 | -- |
215 | 2.25.1 | 61 | 2.34.1 |
216 | |||
217 | diff view generated by jsdifflib |
1 | From: Alex Bennée <alex.bennee@linaro.org> | 1 | From: Cédric Le Goater <clg@kaod.org> |
---|---|---|---|
2 | 2 | ||
3 | While trying to debug a GIC ITS failure I saw some guest errors that | 3 | The arm boot.c code includes a utility function write_bootloader() |
4 | had poor formatting as well as leaving me confused as to what failed. | 4 | which assists in writing a boot-code fragment into guest memory, |
5 | As most of the checks aren't possible without a valid dte split that | 5 | including handling endianness and fixing it up with entry point |
6 | check apart and then check the other conditions in steps. This avoids | 6 | addresses and similar things. This is useful not just for the boot.c |
7 | us relying on undefined data. | 7 | code but also in board model code, so rename it to |
8 | arm_write_bootloader() and make it globally visible. | ||
8 | 9 | ||
9 | I still get a failure with the current kvm-unit-tests but at least I | 10 | Since we are making it public, make its API a little neater: move the |
10 | know (partially) why now: | 11 | AddressSpace* argument to be next to the hwaddr argument, and allow |
12 | the fixupcontext array to be const, since we never modify it in this | ||
13 | function. | ||
11 | 14 | ||
12 | Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588 | 15 | Cc: qemu-stable@nongnu.org |
13 | PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI | 16 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
14 | ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0 | 17 | Tested-by: Cédric Le Goater <clg@kaod.org> |
15 | INT dev_id=2 event_id=20 | 18 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
16 | process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0) | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap | 20 | Message-id: 20230424152717.1333930-2-peter.maydell@linaro.org |
18 | SUMMARY: 6 tests, 1 unexpected failures | 21 | [PMM: Split out from another patch by Cédric, added doc comment] |
19 | |||
20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org | ||
23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> | ||
24 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
26 | --- | 23 | --- |
27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ | 24 | include/hw/arm/boot.h | 49 +++++++++++++++++++++++++++++++++++++++++++ |
28 | 1 file changed, 27 insertions(+), 12 deletions(-) | 25 | hw/arm/boot.c | 35 +++++++------------------------ |
26 | 2 files changed, 57 insertions(+), 27 deletions(-) | ||
29 | 27 | ||
30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c | 28 | diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h |
31 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/intc/arm_gicv3_its.c | 30 | --- a/include/hw/arm/boot.h |
33 | +++ b/hw/intc/arm_gicv3_its.c | 31 | +++ b/include/hw/arm/boot.h |
34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, | 32 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, |
35 | if (res != MEMTX_OK) { | 33 | const struct arm_boot_info *info, |
36 | return result; | 34 | hwaddr mvbar_addr); |
37 | } | 35 | |
38 | + } else { | 36 | +typedef enum { |
39 | + qemu_log_mask(LOG_GUEST_ERROR, | 37 | + FIXUP_NONE = 0, /* do nothing */ |
40 | + "%s: invalid command attributes: " | 38 | + FIXUP_TERMINATOR, /* end of insns */ |
41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", | 39 | + FIXUP_BOARDID, /* overwrite with board ID number */ |
42 | + __func__, dte, devid, res); | 40 | + FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */ |
43 | + return result; | 41 | + FIXUP_ARGPTR_LO, /* overwrite with pointer to kernel args */ |
42 | + FIXUP_ARGPTR_HI, /* overwrite with pointer to kernel args (high half) */ | ||
43 | + FIXUP_ENTRYPOINT_LO, /* overwrite with kernel entry point */ | ||
44 | + FIXUP_ENTRYPOINT_HI, /* overwrite with kernel entry point (high half) */ | ||
45 | + FIXUP_GIC_CPU_IF, /* overwrite with GIC CPU interface address */ | ||
46 | + FIXUP_BOOTREG, /* overwrite with boot register address */ | ||
47 | + FIXUP_DSB, /* overwrite with correct DSB insn for cpu */ | ||
48 | + FIXUP_MAX, | ||
49 | +} FixupType; | ||
50 | + | ||
51 | +typedef struct ARMInsnFixup { | ||
52 | + uint32_t insn; | ||
53 | + FixupType fixup; | ||
54 | +} ARMInsnFixup; | ||
55 | + | ||
56 | +/** | ||
57 | + * arm_write_bootloader - write a bootloader to guest memory | ||
58 | + * @name: name of the bootloader blob | ||
59 | + * @as: AddressSpace to write the bootloader | ||
60 | + * @addr: guest address to write it | ||
61 | + * @insns: the blob to be loaded | ||
62 | + * @fixupcontext: context to be used for any fixups in @insns | ||
63 | + * | ||
64 | + * Write a bootloader to guest memory at address @addr in the address | ||
65 | + * space @as. @name is the name to use for the resulting ROM blob, so | ||
66 | + * it should be unique in the system and reasonably identifiable for debugging. | ||
67 | + * | ||
68 | + * @insns must be an array of ARMInsnFixup structs, each of which has | ||
69 | + * one 32-bit value to be written to the guest memory, and a fixup to be | ||
70 | + * applied to the value. FIXUP_NONE (do nothing) is value 0, so effectively | ||
71 | + * the fixup is optional when writing a struct initializer. | ||
72 | + * The final entry in the array must be { 0, FIXUP_TERMINATOR }. | ||
73 | + * | ||
74 | + * All other supported fixup types have the semantics "ignore insn | ||
75 | + * and instead use the value from the array element @fixupcontext[fixup]". | ||
76 | + * The caller should therefore provide @fixupcontext as an array of | ||
77 | + * size FIXUP_MAX whose elements have been initialized for at least | ||
78 | + * the entries that @insns refers to. | ||
79 | + */ | ||
80 | +void arm_write_bootloader(const char *name, | ||
81 | + AddressSpace *as, hwaddr addr, | ||
82 | + const ARMInsnFixup *insns, | ||
83 | + const uint32_t *fixupcontext); | ||
84 | + | ||
85 | #endif /* HW_ARM_BOOT_H */ | ||
86 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/arm/boot.c | ||
89 | +++ b/hw/arm/boot.c | ||
90 | @@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, | ||
91 | return cpu_get_address_space(cs, asidx); | ||
92 | } | ||
93 | |||
94 | -typedef enum { | ||
95 | - FIXUP_NONE = 0, /* do nothing */ | ||
96 | - FIXUP_TERMINATOR, /* end of insns */ | ||
97 | - FIXUP_BOARDID, /* overwrite with board ID number */ | ||
98 | - FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */ | ||
99 | - FIXUP_ARGPTR_LO, /* overwrite with pointer to kernel args */ | ||
100 | - FIXUP_ARGPTR_HI, /* overwrite with pointer to kernel args (high half) */ | ||
101 | - FIXUP_ENTRYPOINT_LO, /* overwrite with kernel entry point */ | ||
102 | - FIXUP_ENTRYPOINT_HI, /* overwrite with kernel entry point (high half) */ | ||
103 | - FIXUP_GIC_CPU_IF, /* overwrite with GIC CPU interface address */ | ||
104 | - FIXUP_BOOTREG, /* overwrite with boot register address */ | ||
105 | - FIXUP_DSB, /* overwrite with correct DSB insn for cpu */ | ||
106 | - FIXUP_MAX, | ||
107 | -} FixupType; | ||
108 | - | ||
109 | -typedef struct ARMInsnFixup { | ||
110 | - uint32_t insn; | ||
111 | - FixupType fixup; | ||
112 | -} ARMInsnFixup; | ||
113 | - | ||
114 | static const ARMInsnFixup bootloader_aarch64[] = { | ||
115 | { 0x580000c0 }, /* ldr x0, arg ; Load the lower 32-bits of DTB */ | ||
116 | { 0xaa1f03e1 }, /* mov x1, xzr */ | ||
117 | @@ -XXX,XX +XXX,XX @@ static const ARMInsnFixup smpboot[] = { | ||
118 | { 0, FIXUP_TERMINATOR } | ||
119 | }; | ||
120 | |||
121 | -static void write_bootloader(const char *name, hwaddr addr, | ||
122 | - const ARMInsnFixup *insns, uint32_t *fixupcontext, | ||
123 | - AddressSpace *as) | ||
124 | +void arm_write_bootloader(const char *name, | ||
125 | + AddressSpace *as, hwaddr addr, | ||
126 | + const ARMInsnFixup *insns, | ||
127 | + const uint32_t *fixupcontext) | ||
128 | { | ||
129 | /* Fix up the specified bootloader fragment and write it into | ||
130 | * guest memory using rom_add_blob_fixed(). fixupcontext is | ||
131 | @@ -XXX,XX +XXX,XX @@ static void default_write_secondary(ARMCPU *cpu, | ||
132 | fixupcontext[FIXUP_DSB] = CP15_DSB_INSN; | ||
44 | } | 133 | } |
45 | 134 | ||
46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || | 135 | - write_bootloader("smpboot", info->smp_loader_start, |
47 | - !cte_valid || (eventid > max_eventid)) { | 136 | - smpboot, fixupcontext, as); |
48 | + | 137 | + arm_write_bootloader("smpboot", as, info->smp_loader_start, |
49 | + /* | 138 | + smpboot, fixupcontext); |
50 | + * In this implementation, in case of guest errors we ignore the | 139 | } |
51 | + * command and move onto the next command in the queue. | 140 | |
52 | + */ | 141 | void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, |
53 | + if (devid > s->dt.maxids.max_devids) { | 142 | @@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, |
54 | qemu_log_mask(LOG_GUEST_ERROR, | 143 | fixupcontext[FIXUP_ENTRYPOINT_LO] = entry; |
55 | - "%s: invalid command attributes " | 144 | fixupcontext[FIXUP_ENTRYPOINT_HI] = entry >> 32; |
56 | - "devid %d or eventid %d or invalid dte %d or" | 145 | |
57 | - "invalid cte %d or invalid ite %d\n", | 146 | - write_bootloader("bootloader", info->loader_start, |
58 | - __func__, devid, eventid, dte_valid, cte_valid, | 147 | - primary_loader, fixupcontext, as); |
59 | - ite_valid); | 148 | + arm_write_bootloader("bootloader", as, info->loader_start, |
60 | - /* | 149 | + primary_loader, fixupcontext); |
61 | - * in this implementation, in case of error | 150 | |
62 | - * we ignore this command and move onto the next | 151 | if (info->write_board_setup) { |
63 | - * command in the queue | 152 | info->write_board_setup(cpu, info); |
64 | - */ | ||
65 | + "%s: invalid command attributes: devid %d>%d", | ||
66 | + __func__, devid, s->dt.maxids.max_devids); | ||
67 | + | ||
68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { | ||
69 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
70 | + "%s: invalid command attributes: " | ||
71 | + "dte: %s, ite: %s, cte: %s\n", | ||
72 | + __func__, | ||
73 | + dte_valid ? "valid" : "invalid", | ||
74 | + ite_valid ? "valid" : "invalid", | ||
75 | + cte_valid ? "valid" : "invalid"); | ||
76 | + } else if (eventid > max_eventid) { | ||
77 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
78 | + "%s: invalid command attributes: eventid %d > %d\n", | ||
79 | + __func__, eventid, max_eventid); | ||
80 | } else { | ||
81 | /* | ||
82 | * Current implementation only supports rdbase == procnum | ||
83 | -- | 153 | -- |
84 | 2.25.1 | 154 | 2.34.1 |
85 | 155 | ||
86 | 156 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | From: Cédric Le Goater <clg@kaod.org> |
---|---|---|---|
2 | 2 | ||
3 | A common use case for the ASPEED machine is to boot a Linux kernel. | 3 | When writing the secondary-CPU stub boot loader code to the guest, |
4 | Provide a full example command line. | 4 | use arm_write_bootloader() instead of directly calling |
5 | rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because | ||
6 | arm_write_bootloader() will correctly byte-swap the host-byte-order | ||
7 | array values into the guest-byte-order to write into the guest | ||
8 | memory. | ||
5 | 9 | ||
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 10 | Cc: qemu-stable@nongnu.org |
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 11 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
8 | Message-id: 20211117065752.330632-4-joel@jms.id.au | 12 | Tested-by: Cédric Le Goater <clg@kaod.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Message-id: 20230424152717.1333930-3-peter.maydell@linaro.org | ||
16 | [PMM: Moved the "make arm_write_bootloader() function public" part | ||
17 | to its own patch; updated commit message to note that this fixes | ||
18 | an actual bug; adjust to the API changes noted in previous commit] | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 20 | --- |
11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- | 21 | hw/arm/aspeed.c | 38 ++++++++++++++++++++------------------ |
12 | 1 file changed, 12 insertions(+), 3 deletions(-) | 22 | 1 file changed, 20 insertions(+), 18 deletions(-) |
13 | 23 | ||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | 24 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c |
15 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 26 | --- a/hw/arm/aspeed.c |
17 | +++ b/docs/system/arm/aspeed.rst | 27 | +++ b/hw/arm/aspeed.c |
18 | @@ -XXX,XX +XXX,XX @@ Missing devices | 28 | @@ -XXX,XX +XXX,XX @@ struct AspeedMachineState { |
19 | Boot options | 29 | static void aspeed_write_smpboot(ARMCPU *cpu, |
20 | ------------ | 30 | const struct arm_boot_info *info) |
21 | 31 | { | |
22 | -The Aspeed machines can be started using the ``-kernel`` option to | 32 | - static const uint32_t poll_mailbox_ready[] = { |
23 | -load a Linux kernel or from a firmware. Images can be downloaded from | 33 | + AddressSpace *as = arm_boot_address_space(cpu, info); |
24 | -the OpenBMC jenkins : | 34 | + static const ARMInsnFixup poll_mailbox_ready[] = { |
25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options | 35 | /* |
26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the | 36 | * r2 = per-cpu go sign value |
27 | +OpenBMC jenkins : | 37 | * r1 = AST_SMP_MBOX_FIELD_ENTRY |
28 | 38 | * r0 = AST_SMP_MBOX_FIELD_GOSIGN | |
29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ | 39 | */ |
30 | 40 | - 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5 */ | |
31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : | 41 | - 0xe21000ff, /* ands r0, r0, #255 */ |
32 | 42 | - 0xe59f201c, /* ldr r2, [pc, #28] */ | |
33 | https://github.com/openbmc/openbmc/releases | 43 | - 0xe1822000, /* orr r2, r2, r0 */ |
34 | 44 | + { 0xee100fb0 }, /* mrc p15, 0, r0, c0, c0, 5 */ | |
35 | +To boot a kernel directly from a Linux build tree: | 45 | + { 0xe21000ff }, /* ands r0, r0, #255 */ |
36 | + | 46 | + { 0xe59f201c }, /* ldr r2, [pc, #28] */ |
37 | +.. code-block:: bash | 47 | + { 0xe1822000 }, /* orr r2, r2, r0 */ |
38 | + | 48 | |
39 | + $ qemu-system-arm -M ast2600-evb -nographic \ | 49 | - 0xe59f1018, /* ldr r1, [pc, #24] */ |
40 | + -kernel arch/arm/boot/zImage \ | 50 | - 0xe59f0018, /* ldr r0, [pc, #24] */ |
41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ | 51 | + { 0xe59f1018 }, /* ldr r1, [pc, #24] */ |
42 | + -initrd rootfs.cpio | 52 | + { 0xe59f0018 }, /* ldr r0, [pc, #24] */ |
43 | + | 53 | |
44 | The image should be attached as an MTD drive. Run : | 54 | - 0xe320f002, /* wfe */ |
45 | 55 | - 0xe5904000, /* ldr r4, [r0] */ | |
46 | .. code-block:: bash | 56 | - 0xe1520004, /* cmp r2, r4 */ |
57 | - 0x1afffffb, /* bne <wfe> */ | ||
58 | - 0xe591f000, /* ldr pc, [r1] */ | ||
59 | - AST_SMP_MBOX_GOSIGN, | ||
60 | - AST_SMP_MBOX_FIELD_ENTRY, | ||
61 | - AST_SMP_MBOX_FIELD_GOSIGN, | ||
62 | + { 0xe320f002 }, /* wfe */ | ||
63 | + { 0xe5904000 }, /* ldr r4, [r0] */ | ||
64 | + { 0xe1520004 }, /* cmp r2, r4 */ | ||
65 | + { 0x1afffffb }, /* bne <wfe> */ | ||
66 | + { 0xe591f000 }, /* ldr pc, [r1] */ | ||
67 | + { AST_SMP_MBOX_GOSIGN }, | ||
68 | + { AST_SMP_MBOX_FIELD_ENTRY }, | ||
69 | + { AST_SMP_MBOX_FIELD_GOSIGN }, | ||
70 | + { 0, FIXUP_TERMINATOR } | ||
71 | }; | ||
72 | + static const uint32_t fixupcontext[FIXUP_MAX] = { 0 }; | ||
73 | |||
74 | - rom_add_blob_fixed("aspeed.smpboot", poll_mailbox_ready, | ||
75 | - sizeof(poll_mailbox_ready), | ||
76 | - info->smp_loader_start); | ||
77 | + arm_write_bootloader("aspeed.smpboot", as, info->smp_loader_start, | ||
78 | + poll_mailbox_ready, fixupcontext); | ||
79 | } | ||
80 | |||
81 | static void aspeed_reset_secondary(ARMCPU *cpu, | ||
47 | -- | 82 | -- |
48 | 2.25.1 | 83 | 2.34.1 |
49 | 84 | ||
50 | 85 | diff view generated by jsdifflib |
1 | From: Joel Stanley <joel@jms.id.au> | 1 | When writing the secondary-CPU stub boot loader code to the guest, |
---|---|---|---|
2 | use arm_write_bootloader() instead of directly calling | ||
3 | rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because | ||
4 | arm_write_bootloader() will correctly byte-swap the host-byte-order | ||
5 | array values into the guest-byte-order to write into the guest | ||
6 | memory. | ||
2 | 7 | ||
3 | Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be | 8 | Cc: qemu-stable@nongnu.org |
4 | removed in v7.0. | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Tested-by: Cédric Le Goater <clg@kaod.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
12 | Message-id: 20230424152717.1333930-4-peter.maydell@linaro.org | ||
13 | --- | ||
14 | hw/arm/raspi.c | 64 +++++++++++++++++++++++++++----------------------- | ||
15 | 1 file changed, 34 insertions(+), 30 deletions(-) | ||
5 | 16 | ||
6 | Signed-off-by: Joel Stanley <joel@jms.id.au> | 17 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c |
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Message-id: 20211117065752.330632-2-joel@jms.id.au | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | docs/system/arm/aspeed.rst | 7 ++++++- | ||
12 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/system/arm/aspeed.rst | 19 | --- a/hw/arm/raspi.c |
17 | +++ b/docs/system/arm/aspeed.rst | 20 | +++ b/hw/arm/raspi.c |
18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : | 21 | @@ -XXX,XX +XXX,XX @@ |
19 | 22 | #include "qemu/units.h" | |
20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC | 23 | #include "qemu/cutils.h" |
21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC | 24 | #include "qapi/error.h" |
22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC | 25 | +#include "hw/arm/boot.h" |
23 | 26 | #include "hw/arm/bcm2836.h" | |
24 | AST2500 SoC based machines : | 27 | #include "hw/registerfields.h" |
25 | 28 | #include "qemu/error-report.h" | |
26 | @@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines : | 29 | @@ -XXX,XX +XXX,XX @@ static const char *board_type(uint32_t board_rev) |
27 | - ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC | 30 | |
28 | - ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC | 31 | static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) |
29 | - ``sonorapass-bmc`` OCP SonoraPass BMC | 32 | { |
30 | -- ``swift-bmc`` OpenPOWER Swift BMC POWER9 | 33 | - static const uint32_t smpboot[] = { |
31 | +- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0) | 34 | - 0xe1a0e00f, /* mov lr, pc */ |
32 | +- ``fp5280g2-bmc`` Inspur FP5280G2 BMC | 35 | - 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4), /* mov pc, BOARDSETUP_ADDR */ |
33 | +- ``g220a-bmc`` Bytedance G220A BMC | 36 | - 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5;get core ID */ |
34 | 37 | - 0xe7e10050, /* ubfx r0, r0, #0, #2 ;extract LSB */ | |
35 | AST2600 SoC based machines : | 38 | - 0xe59f5014, /* ldr r5, =0x400000CC ;load mbox base */ |
36 | 39 | - 0xe320f001, /* 1: yield */ | |
37 | - ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7) | 40 | - 0xe7953200, /* ldr r3, [r5, r0, lsl #4] ;read mbox for our core*/ |
38 | - ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC | 41 | - 0xe3530000, /* cmp r3, #0 ;spin while zero */ |
39 | +- ``rainier-bmc`` IBM Rainier POWER10 BMC | 42 | - 0x0afffffb, /* beq 1b */ |
40 | +- ``fuji-bmc`` Facebook Fuji BMC | 43 | - 0xe7853200, /* str r3, [r5, r0, lsl #4] ;clear mbox */ |
41 | 44 | - 0xe12fff13, /* bx r3 ;jump to target */ | |
42 | Supported devices | 45 | - 0x400000cc, /* (constant: mailbox 3 read/clear base) */ |
43 | ----------------- | 46 | + static const ARMInsnFixup smpboot[] = { |
47 | + { 0xe1a0e00f }, /* mov lr, pc */ | ||
48 | + { 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4) }, /* mov pc, BOARDSETUP_ADDR */ | ||
49 | + { 0xee100fb0 }, /* mrc p15, 0, r0, c0, c0, 5;get core ID */ | ||
50 | + { 0xe7e10050 }, /* ubfx r0, r0, #0, #2 ;extract LSB */ | ||
51 | + { 0xe59f5014 }, /* ldr r5, =0x400000CC ;load mbox base */ | ||
52 | + { 0xe320f001 }, /* 1: yield */ | ||
53 | + { 0xe7953200 }, /* ldr r3, [r5, r0, lsl #4] ;read mbox for our core */ | ||
54 | + { 0xe3530000 }, /* cmp r3, #0 ;spin while zero */ | ||
55 | + { 0x0afffffb }, /* beq 1b */ | ||
56 | + { 0xe7853200 }, /* str r3, [r5, r0, lsl #4] ;clear mbox */ | ||
57 | + { 0xe12fff13 }, /* bx r3 ;jump to target */ | ||
58 | + { 0x400000cc }, /* (constant: mailbox 3 read/clear base) */ | ||
59 | + { 0, FIXUP_TERMINATOR } | ||
60 | }; | ||
61 | + static const uint32_t fixupcontext[FIXUP_MAX] = { 0 }; | ||
62 | |||
63 | /* check that we don't overrun board setup vectors */ | ||
64 | QEMU_BUILD_BUG_ON(SMPBOOT_ADDR + sizeof(smpboot) > MVBAR_ADDR); | ||
65 | @@ -XXX,XX +XXX,XX @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) | ||
66 | QEMU_BUILD_BUG_ON((BOARDSETUP_ADDR & 0xf) != 0 | ||
67 | || (BOARDSETUP_ADDR >> 4) >= 0x100); | ||
68 | |||
69 | - rom_add_blob_fixed_as("raspi_smpboot", smpboot, sizeof(smpboot), | ||
70 | - info->smp_loader_start, | ||
71 | - arm_boot_address_space(cpu, info)); | ||
72 | + arm_write_bootloader("raspi_smpboot", arm_boot_address_space(cpu, info), | ||
73 | + info->smp_loader_start, smpboot, fixupcontext); | ||
74 | } | ||
75 | |||
76 | static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info) | ||
77 | @@ -XXX,XX +XXX,XX @@ static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info) | ||
78 | * the primary CPU goes into the kernel. We put these variables inside | ||
79 | * a rom blob, so that the reset for ROM contents zeroes them for us. | ||
80 | */ | ||
81 | - static const uint32_t smpboot[] = { | ||
82 | - 0xd2801b05, /* mov x5, 0xd8 */ | ||
83 | - 0xd53800a6, /* mrs x6, mpidr_el1 */ | ||
84 | - 0x924004c6, /* and x6, x6, #0x3 */ | ||
85 | - 0xd503205f, /* spin: wfe */ | ||
86 | - 0xf86678a4, /* ldr x4, [x5,x6,lsl #3] */ | ||
87 | - 0xb4ffffc4, /* cbz x4, spin */ | ||
88 | - 0xd2800000, /* mov x0, #0x0 */ | ||
89 | - 0xd2800001, /* mov x1, #0x0 */ | ||
90 | - 0xd2800002, /* mov x2, #0x0 */ | ||
91 | - 0xd2800003, /* mov x3, #0x0 */ | ||
92 | - 0xd61f0080, /* br x4 */ | ||
93 | + static const ARMInsnFixup smpboot[] = { | ||
94 | + { 0xd2801b05 }, /* mov x5, 0xd8 */ | ||
95 | + { 0xd53800a6 }, /* mrs x6, mpidr_el1 */ | ||
96 | + { 0x924004c6 }, /* and x6, x6, #0x3 */ | ||
97 | + { 0xd503205f }, /* spin: wfe */ | ||
98 | + { 0xf86678a4 }, /* ldr x4, [x5,x6,lsl #3] */ | ||
99 | + { 0xb4ffffc4 }, /* cbz x4, spin */ | ||
100 | + { 0xd2800000 }, /* mov x0, #0x0 */ | ||
101 | + { 0xd2800001 }, /* mov x1, #0x0 */ | ||
102 | + { 0xd2800002 }, /* mov x2, #0x0 */ | ||
103 | + { 0xd2800003 }, /* mov x3, #0x0 */ | ||
104 | + { 0xd61f0080 }, /* br x4 */ | ||
105 | + { 0, FIXUP_TERMINATOR } | ||
106 | }; | ||
107 | + static const uint32_t fixupcontext[FIXUP_MAX] = { 0 }; | ||
108 | |||
109 | static const uint64_t spintables[] = { | ||
110 | 0, 0, 0, 0 | ||
111 | }; | ||
112 | |||
113 | - rom_add_blob_fixed_as("raspi_smpboot", smpboot, sizeof(smpboot), | ||
114 | - info->smp_loader_start, as); | ||
115 | + arm_write_bootloader("raspi_smpboot", as, info->smp_loader_start, | ||
116 | + smpboot, fixupcontext); | ||
117 | rom_add_blob_fixed_as("raspi_spintables", spintables, sizeof(spintables), | ||
118 | SPINTABLE_ADDR, as); | ||
119 | } | ||
44 | -- | 120 | -- |
45 | 2.25.1 | 121 | 2.34.1 |
46 | 122 | ||
47 | 123 | diff view generated by jsdifflib |
1 | The calculation of the length of TLB range invalidate operations | 1 | The Allwinner PIC model uses set_bit() and clear_bit() to update the |
---|---|---|---|
2 | in tlbi_aa64_range_get_length() is incorrect in two ways: | 2 | values in its irq_pending[] array when an interrupt arrives. However |
3 | * the NUM field is 5 bits, but we read only 4 bits | 3 | it is using these functions wrongly: they work on an array of type |
4 | * we miscalculate the page_shift value, because of an | 4 | 'long', and it is passing an array of type 'uint32_t'. Because the |
5 | off-by-one error: | 5 | code manually figures out the right array element, this works on |
6 | TG 0b00 is invalid | 6 | little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 |
7 | TG 0b01 is 4K granule size == 4096 == 2^12 | 7 | in a 'long' are in the same place as they are in a 'uint32_t'. |
8 | TG 0b10 is 16K granule size == 16384 == 2^14 | 8 | However it breaks on 64-bit big-endian hosts. |
9 | TG 0b11 is 64K granule size == 65536 == 2^16 | ||
10 | so page_shift should be (TG - 1) * 2 + 12 | ||
11 | 9 | ||
12 | Thanks to the bug report submitter Cha HyunSoo for identifying | 10 | Remove the use of set_bit() and clear_bit() in favour of using |
13 | both these errors. | 11 | deposit32() on the array element. This fixes a bug where on |
12 | big-endian 64-bit hosts the guest kernel would hang early on in | ||
13 | bootup. | ||
14 | 14 | ||
15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") | 15 | Cc: qemu-stable@nongnu.org |
16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 17 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 18 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 19 | Message-id: 20230424152833.1334136-1-peter.maydell@linaro.org |
21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org | ||
22 | --- | 20 | --- |
23 | target/arm/helper.c | 6 +++--- | 21 | hw/intc/allwinner-a10-pic.c | 7 ++----- |
24 | 1 file changed, 3 insertions(+), 3 deletions(-) | 22 | 1 file changed, 2 insertions(+), 5 deletions(-) |
25 | 23 | ||
26 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 24 | diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c |
27 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/target/arm/helper.c | 26 | --- a/hw/intc/allwinner-a10-pic.c |
29 | +++ b/target/arm/helper.c | 27 | +++ b/hw/intc/allwinner-a10-pic.c |
30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, | 28 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_pic_update(AwA10PICState *s) |
31 | uint64_t exponent; | 29 | static void aw_a10_pic_set_irq(void *opaque, int irq, int level) |
32 | uint64_t length; | 30 | { |
33 | 31 | AwA10PICState *s = opaque; | |
34 | - num = extract64(value, 39, 4); | 32 | + uint32_t *pending_reg = &s->irq_pending[irq / 32]; |
35 | + num = extract64(value, 39, 5); | 33 | |
36 | scale = extract64(value, 44, 2); | 34 | - if (level) { |
37 | page_size_granule = extract64(value, 46, 2); | 35 | - set_bit(irq % 32, (void *)&s->irq_pending[irq / 32]); |
38 | 36 | - } else { | |
39 | - page_shift = page_size_granule * 2 + 12; | 37 | - clear_bit(irq % 32, (void *)&s->irq_pending[irq / 32]); |
40 | - | 38 | - } |
41 | if (page_size_granule == 0) { | 39 | + *pending_reg = deposit32(*pending_reg, irq % 32, 1, level); |
42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", | 40 | aw_a10_pic_update(s); |
43 | page_size_granule); | 41 | } |
44 | return 0; | ||
45 | } | ||
46 | |||
47 | + page_shift = (page_size_granule - 1) * 2 + 12; | ||
48 | + | ||
49 | exponent = (5 * scale) + 1; | ||
50 | length = (num + 1) << (exponent + page_shift); | ||
51 | 42 | ||
52 | -- | 43 | -- |
53 | 2.25.1 | 44 | 2.34.1 |
54 | 45 | ||
55 | 46 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In several places in the 32-bit Arm translate.c, we try to use | ||
2 | load_cpu_field() to load from a CPUARMState field into a TCGv_i32 | ||
3 | where the field is actually 64-bit. This works on little-endian | ||
4 | hosts, but gives the wrong half of the register on big-endian. | ||
1 | 5 | ||
6 | Add a new load_cpu_field_low32() which loads the low 32 bits | ||
7 | of a 64-bit field into a TCGv_i32. The new macro includes a | ||
8 | compile-time check against accidentally using it on a field | ||
9 | of the wrong size. Use it to fix the two places in the code | ||
10 | where we were using load_cpu_field() on a 64-bit field. | ||
11 | |||
12 | This fixes a bug where on big-endian hosts the guest would | ||
13 | crash after executing an ERET instruction, and a more corner | ||
14 | case one where some UNDEFs for attempted accesses to MSR | ||
15 | banked registers from Secure EL1 might go to the wrong EL. | ||
16 | |||
17 | Cc: qemu-stable@nongnu.org | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
20 | Message-id: 20230424153909.1419369-2-peter.maydell@linaro.org | ||
21 | --- | ||
22 | target/arm/translate-a32.h | 7 +++++++ | ||
23 | target/arm/tcg/translate.c | 4 ++-- | ||
24 | 2 files changed, 9 insertions(+), 2 deletions(-) | ||
25 | |||
26 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/translate-a32.h | ||
29 | +++ b/target/arm/translate-a32.h | ||
30 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_cpu_offset(int offset) | ||
31 | |||
32 | #define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name)) | ||
33 | |||
34 | +/* Load from the low half of a 64-bit field to a TCGv_i32 */ | ||
35 | +#define load_cpu_field_low32(name) \ | ||
36 | + ({ \ | ||
37 | + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 8); \ | ||
38 | + load_cpu_offset(offsetoflow32(CPUARMState, name)); \ | ||
39 | + }) | ||
40 | + | ||
41 | void store_cpu_offset(TCGv_i32 var, int offset, int size); | ||
42 | |||
43 | #define store_cpu_field(var, name) \ | ||
44 | diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/tcg/translate.c | ||
47 | +++ b/target/arm/tcg/translate.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn, | ||
49 | if (arm_dc_feature(s, ARM_FEATURE_AARCH64) && | ||
50 | dc_isar_feature(aa64_sel2, s)) { | ||
51 | /* Target EL is EL<3 minus SCR_EL3.EEL2> */ | ||
52 | - tcg_el = load_cpu_field(cp15.scr_el3); | ||
53 | + tcg_el = load_cpu_field_low32(cp15.scr_el3); | ||
54 | tcg_gen_sextract_i32(tcg_el, tcg_el, ctz32(SCR_EEL2), 1); | ||
55 | tcg_gen_addi_i32(tcg_el, tcg_el, 3); | ||
56 | } else { | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool trans_ERET(DisasContext *s, arg_ERET *a) | ||
58 | } | ||
59 | if (s->current_el == 2) { | ||
60 | /* ERET from Hyp uses ELR_Hyp, not LR */ | ||
61 | - tmp = load_cpu_field(elr_el[2]); | ||
62 | + tmp = load_cpu_field_low32(elr_el[2]); | ||
63 | } else { | ||
64 | tmp = load_reg(s, 14); | ||
65 | } | ||
66 | -- | ||
67 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Add some compile-time asserts to the load_cpu_field() and store_cpu_field() | ||
2 | macros that the struct field being accessed is the expected size. This | ||
3 | lets us catch cases where we incorrectly tried to do a 32-bit load | ||
4 | from a 64-bit struct field. | ||
1 | 5 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20230424153909.1419369-3-peter.maydell@linaro.org | ||
9 | --- | ||
10 | target/arm/translate-a32.h | 17 +++++++++++++---- | ||
11 | 1 file changed, 13 insertions(+), 4 deletions(-) | ||
12 | |||
13 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/translate-a32.h | ||
16 | +++ b/target/arm/translate-a32.h | ||
17 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_cpu_offset(int offset) | ||
18 | return tmp; | ||
19 | } | ||
20 | |||
21 | -#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name)) | ||
22 | +/* Load from a 32-bit field to a TCGv_i32 */ | ||
23 | +#define load_cpu_field(name) \ | ||
24 | + ({ \ | ||
25 | + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 4); \ | ||
26 | + load_cpu_offset(offsetof(CPUARMState, name)); \ | ||
27 | + }) | ||
28 | |||
29 | /* Load from the low half of a 64-bit field to a TCGv_i32 */ | ||
30 | #define load_cpu_field_low32(name) \ | ||
31 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_cpu_offset(int offset) | ||
32 | |||
33 | void store_cpu_offset(TCGv_i32 var, int offset, int size); | ||
34 | |||
35 | -#define store_cpu_field(var, name) \ | ||
36 | - store_cpu_offset(var, offsetof(CPUARMState, name), \ | ||
37 | - sizeof_field(CPUARMState, name)) | ||
38 | +#define store_cpu_field(val, name) \ | ||
39 | + ({ \ | ||
40 | + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 4 \ | ||
41 | + && sizeof_field(CPUARMState, name) != 1); \ | ||
42 | + store_cpu_offset(val, offsetof(CPUARMState, name), \ | ||
43 | + sizeof_field(CPUARMState, name)); \ | ||
44 | + }) | ||
45 | |||
46 | #define store_cpu_field_constant(val, name) \ | ||
47 | store_cpu_field(tcg_constant_i32(val), name) | ||
48 | -- | ||
49 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | In allwinner_sdhost_process_desc() we just read directly from |
---|---|---|---|
2 | guest memory into a host TransferDescriptor struct and back. | ||
3 | This only works on little-endian hosts. Abstract the reading | ||
4 | and writing of descriptors into functions that handle the | ||
5 | byte-swapping so that TransferDescriptor structs as seen by | ||
6 | the rest of the code are always in host-order. | ||
2 | 7 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | This fixes a failure of one of the avocado tests on s390. |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | |
10 | Cc: qemu-stable@nongnu.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
13 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
15 | Message-id: 20230424165053.1428857-2-peter.maydell@linaro.org | ||
6 | --- | 16 | --- |
7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ | 17 | hw/sd/allwinner-sdhost.c | 31 ++++++++++++++++++++++++++----- |
8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ | 18 | 1 file changed, 26 insertions(+), 5 deletions(-) |
9 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
10 | tests/tcg/arm/Makefile.target | 4 +++ | ||
11 | 4 files changed, 89 insertions(+), 2 deletions(-) | ||
12 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
13 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
14 | 19 | ||
15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c | 20 | diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c |
16 | new file mode 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | index XXXXXXX..XXXXXXX | 22 | --- a/hw/sd/allwinner-sdhost.c |
18 | --- /dev/null | 23 | +++ b/hw/sd/allwinner-sdhost.c |
19 | +++ b/tests/tcg/aarch64/pcalign-a64.c | 24 | @@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_auto_stop(AwSdHostState *s) |
20 | @@ -XXX,XX +XXX,XX @@ | 25 | } |
21 | +/* Test PC misalignment exception */ | 26 | } |
22 | + | 27 | |
23 | +#include <assert.h> | 28 | +static void read_descriptor(AwSdHostState *s, hwaddr desc_addr, |
24 | +#include <signal.h> | 29 | + TransferDescriptor *desc) |
25 | +#include <stdlib.h> | ||
26 | +#include <stdio.h> | ||
27 | + | ||
28 | +static void *expected; | ||
29 | + | ||
30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
31 | +{ | 30 | +{ |
32 | + assert(info->si_code == BUS_ADRALN); | 31 | + uint32_t desc_words[4]; |
33 | + assert(info->si_addr == expected); | 32 | + dma_memory_read(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words), |
34 | + exit(EXIT_SUCCESS); | 33 | + MEMTXATTRS_UNSPECIFIED); |
34 | + desc->status = le32_to_cpu(desc_words[0]); | ||
35 | + desc->size = le32_to_cpu(desc_words[1]); | ||
36 | + desc->addr = le32_to_cpu(desc_words[2]); | ||
37 | + desc->next = le32_to_cpu(desc_words[3]); | ||
35 | +} | 38 | +} |
36 | + | 39 | + |
37 | +int main() | 40 | +static void write_descriptor(AwSdHostState *s, hwaddr desc_addr, |
41 | + const TransferDescriptor *desc) | ||
38 | +{ | 42 | +{ |
39 | + void *tmp; | 43 | + uint32_t desc_words[4]; |
40 | + | 44 | + desc_words[0] = cpu_to_le32(desc->status); |
41 | + struct sigaction sa = { | 45 | + desc_words[1] = cpu_to_le32(desc->size); |
42 | + .sa_sigaction = sigbus, | 46 | + desc_words[2] = cpu_to_le32(desc->addr); |
43 | + .sa_flags = SA_SIGINFO | 47 | + desc_words[3] = cpu_to_le32(desc->next); |
44 | + }; | 48 | + dma_memory_write(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words), |
45 | + | 49 | + MEMTXATTRS_UNSPECIFIED); |
46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | ||
47 | + perror("sigaction"); | ||
48 | + return EXIT_FAILURE; | ||
49 | + } | ||
50 | + | ||
51 | + asm volatile("adr %0, 1f + 1\n\t" | ||
52 | + "str %0, %1\n\t" | ||
53 | + "br %0\n" | ||
54 | + "1:" | ||
55 | + : "=&r"(tmp), "=m"(expected)); | ||
56 | + abort(); | ||
57 | +} | ||
58 | diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/tests/tcg/arm/pcalign-a32.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* Test PC misalignment exception */ | ||
65 | + | ||
66 | +#ifdef __thumb__ | ||
67 | +#error "This test must be compiled for ARM" | ||
68 | +#endif | ||
69 | + | ||
70 | +#include <assert.h> | ||
71 | +#include <signal.h> | ||
72 | +#include <stdlib.h> | ||
73 | +#include <stdio.h> | ||
74 | + | ||
75 | +static void *expected; | ||
76 | + | ||
77 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
78 | +{ | ||
79 | + assert(info->si_code == BUS_ADRALN); | ||
80 | + assert(info->si_addr == expected); | ||
81 | + exit(EXIT_SUCCESS); | ||
82 | +} | 50 | +} |
83 | + | 51 | + |
84 | +int main() | 52 | static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, |
85 | +{ | 53 | hwaddr desc_addr, |
86 | + void *tmp; | 54 | TransferDescriptor *desc, |
87 | + | 55 | @@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, |
88 | + struct sigaction sa = { | 56 | uint32_t num_bytes = max_bytes; |
89 | + .sa_sigaction = sigbus, | 57 | uint8_t buf[1024]; |
90 | + .sa_flags = SA_SIGINFO | 58 | |
91 | + }; | 59 | - /* Read descriptor */ |
92 | + | 60 | - dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc), |
93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | 61 | - MEMTXATTRS_UNSPECIFIED); |
94 | + perror("sigaction"); | 62 | + read_descriptor(s, desc_addr, desc); |
95 | + return EXIT_FAILURE; | 63 | if (desc->size == 0) { |
96 | + } | 64 | desc->size = klass->max_desc_size; |
97 | + | 65 | } else if (desc->size > klass->max_desc_size) { |
98 | + asm volatile("adr %0, 1f + 2\n\t" | 66 | @@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, |
99 | + "str %0, %1\n\t" | 67 | |
100 | + "bx %0\n" | 68 | /* Clear hold flag and flush descriptor */ |
101 | + "1:" | 69 | desc->status &= ~DESC_STATUS_HOLD; |
102 | + : "=&r"(tmp), "=m"(expected)); | 70 | - dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc), |
103 | + | 71 | - MEMTXATTRS_UNSPECIFIED); |
104 | + /* | 72 | + write_descriptor(s, desc_addr, desc); |
105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns | 73 | |
106 | + * the address or not. If so, we can legitimately fall through. | 74 | return num_done; |
107 | + */ | 75 | } |
108 | + return EXIT_SUCCESS; | ||
109 | +} | ||
110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/tests/tcg/aarch64/Makefile.target | ||
113 | +++ b/tests/tcg/aarch64/Makefile.target | ||
114 | @@ -XXX,XX +XXX,XX @@ VPATH += $(ARM_SRC) | ||
115 | AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 | ||
116 | VPATH += $(AARCH64_SRC) | ||
117 | |||
118 | -# Float-convert Tests | ||
119 | -AARCH64_TESTS=fcvt | ||
120 | +# Base architecture tests | ||
121 | +AARCH64_TESTS=fcvt pcalign-a64 | ||
122 | |||
123 | fcvt: LDFLAGS+=-lm | ||
124 | |||
125 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/tests/tcg/arm/Makefile.target | ||
128 | +++ b/tests/tcg/arm/Makefile.target | ||
129 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
130 | $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") | ||
131 | $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) | ||
132 | |||
133 | +# PC alignment test | ||
134 | +ARM_TESTS += pcalign-a32 | ||
135 | +pcalign-a32: CFLAGS+=-marm | ||
136 | + | ||
137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) | ||
138 | |||
139 | # Semihosting smoke test for linux-user | ||
140 | -- | 76 | -- |
141 | 2.25.1 | 77 | 2.34.1 |
142 | 78 | ||
143 | 79 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | In allwinner-sun8i-emac we just read directly from guest memory into |
---|---|---|---|
2 | a host FrameDescriptor struct and back. This only works on | ||
3 | little-endian hosts. Reading and writing of descriptors is already | ||
4 | abstracted into functions; make those functions also handle the | ||
5 | byte-swapping so that TransferDescriptor structs as seen by the rest | ||
6 | of the code are always in host-order, and fix two places that were | ||
7 | doing ad-hoc descriptor reading without using the functions. | ||
2 | 8 | ||
3 | Create arm_check_ss_active and arm_check_kernelpage. | 9 | Cc: qemu-stable@nongnu.org |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Message-id: 20230424165053.1428857-3-peter.maydell@linaro.org | ||
15 | --- | ||
16 | hw/net/allwinner-sun8i-emac.c | 22 +++++++++++++++------- | ||
17 | 1 file changed, 15 insertions(+), 7 deletions(-) | ||
4 | 18 | ||
5 | Reverse the order of the tests. While it doesn't matter in practice, | 19 | diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c |
6 | because only user-only has a kernel page and user-only never sets | ||
7 | ss_active, ss_active has priority over execution exceptions and it | ||
8 | is best to keep them in the proper order. | ||
9 | |||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/translate.c | 10 +++++++--- | ||
15 | 1 file changed, 7 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/translate.c | 21 | --- a/hw/net/allwinner-sun8i-emac.c |
20 | +++ b/target/arm/translate.c | 22 | +++ b/hw/net/allwinner-sun8i-emac.c |
21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) | 23 | @@ -XXX,XX +XXX,XX @@ static void allwinner_sun8i_emac_get_desc(AwSun8iEmacState *s, |
22 | dc->insn_start = tcg_last_op(); | 24 | FrameDescriptor *desc, |
25 | uint32_t phys_addr) | ||
26 | { | ||
27 | - dma_memory_read(&s->dma_as, phys_addr, desc, sizeof(*desc), | ||
28 | + uint32_t desc_words[4]; | ||
29 | + dma_memory_read(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words), | ||
30 | MEMTXATTRS_UNSPECIFIED); | ||
31 | + desc->status = le32_to_cpu(desc_words[0]); | ||
32 | + desc->status2 = le32_to_cpu(desc_words[1]); | ||
33 | + desc->addr = le32_to_cpu(desc_words[2]); | ||
34 | + desc->next = le32_to_cpu(desc_words[3]); | ||
23 | } | 35 | } |
24 | 36 | ||
25 | -static bool arm_pre_translate_insn(DisasContext *dc) | 37 | static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iEmacState *s, |
26 | +static bool arm_check_kernelpage(DisasContext *dc) | 38 | @@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sun8i_emac_tx_desc(AwSun8iEmacState *s, |
39 | } | ||
40 | |||
41 | static void allwinner_sun8i_emac_flush_desc(AwSun8iEmacState *s, | ||
42 | - FrameDescriptor *desc, | ||
43 | + const FrameDescriptor *desc, | ||
44 | uint32_t phys_addr) | ||
27 | { | 45 | { |
28 | #ifdef CONFIG_USER_ONLY | 46 | - dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc), |
29 | /* Intercept jump to the magic kernel page. */ | 47 | + uint32_t desc_words[4]; |
30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) | 48 | + desc_words[0] = cpu_to_le32(desc->status); |
31 | return true; | 49 | + desc_words[1] = cpu_to_le32(desc->status2); |
32 | } | 50 | + desc_words[2] = cpu_to_le32(desc->addr); |
33 | #endif | 51 | + desc_words[3] = cpu_to_le32(desc->next); |
34 | + return false; | 52 | + dma_memory_write(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words), |
35 | +} | 53 | MEMTXATTRS_UNSPECIFIED); |
36 | 54 | } | |
37 | +static bool arm_check_ss_active(DisasContext *dc) | 55 | |
38 | +{ | 56 | @@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset, |
39 | if (dc->ss_active && !dc->pstate_ss) { | 57 | break; |
40 | /* Singlestep state is Active-pending. | 58 | case REG_TX_CUR_BUF: /* Transmit Current Buffer */ |
41 | * If we're in this state at the start of a TB then either | 59 | if (s->tx_desc_curr != 0) { |
42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 60 | - dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(desc), |
43 | uint32_t pc = dc->base.pc_next; | 61 | - MEMTXATTRS_UNSPECIFIED); |
44 | unsigned int insn; | 62 | + allwinner_sun8i_emac_get_desc(s, &desc, s->tx_desc_curr); |
45 | 63 | value = desc.addr; | |
46 | - if (arm_pre_translate_insn(dc)) { | 64 | } else { |
47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 65 | value = 0; |
48 | dc->base.pc_next = pc + 4; | 66 | @@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset, |
49 | return; | 67 | break; |
50 | } | 68 | case REG_RX_CUR_BUF: /* Receive Current Buffer */ |
51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | 69 | if (s->rx_desc_curr != 0) { |
52 | uint32_t insn; | 70 | - dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(desc), |
53 | bool is_16bit; | 71 | - MEMTXATTRS_UNSPECIFIED); |
54 | 72 | + allwinner_sun8i_emac_get_desc(s, &desc, s->rx_desc_curr); | |
55 | - if (arm_pre_translate_insn(dc)) { | 73 | value = desc.addr; |
56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | 74 | } else { |
57 | dc->base.pc_next = pc + 2; | 75 | value = 0; |
58 | return; | ||
59 | } | ||
60 | -- | 76 | -- |
61 | 2.25.1 | 77 | 2.34.1 |
62 | 78 | ||
63 | 79 | diff view generated by jsdifflib |