1 | Last lot of target-arm changes to squeeze in before rc1: | 1 | Hi; here's an arm pullreq. The big bits here are Fabiano's |
---|---|---|---|
2 | * various minor Arm bug fixes | 2 | CONFIG_TCG=n patches and my set that deprecate -singlestep; |
3 | * David Carlier's Haiku build portability fixes | 3 | other than that there's a collection of smaller bugfixes. |
4 | * Wentong Wu's fixes for icount handling in the nios2 target | ||
5 | 4 | ||
6 | The following changes since commit 00ce6c36b35e0eb8cc5d68a28f288a6335848813: | 5 | thanks |
6 | -- PMM | ||
7 | 7 | ||
8 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-07-13' into staging (2020-07-13 13:01:30 +0100) | 8 | The following changes since commit 7c18f2d663521f1b31b821a13358ce38075eaf7d: |
9 | |||
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-20200713 | 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 756f739b1682bf131994ec96dad7fbdf8b54493a: | 16 | for you to fetch changes up to 0ab99e4252f21550f2c16f859cbcdd3cced9f8bf: |
15 | 17 | ||
16 | hw/arm/aspeed: Do not create and attach empty SD cards by default (2020-07-13 14:36:12 +0100) | 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 | * hw/arm/bcm2836: Remove unused 'cpu_type' field | 22 | * hw/net: npcm7xx_emc: set MAC in register space |
21 | * target/arm: Fix mtedesc for do_mem_zpz | 23 | * hw/arm/bcm2835_property: Implement "get command line" message |
22 | * Add the ability to change the FEC PHY MDIO device number on i.MX25/i.MX6/i.MX7 | 24 | * Deprecate the '-singlestep' command line option in favour of |
23 | * target/arm: Don't do raw writes for PMINTENCLR | 25 | '-one-insn-per-tb' and '-accel one-insn-per-tb=on' |
24 | * virtio-iommu: Fix coverity issue in virtio_iommu_handle_command() | 26 | * Deprecate 'singlestep' member of QMP StatusInfo struct |
25 | * build: Fix various issues with building on Haiku | 27 | * docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation |
26 | * target/nios2: fix wrctl behaviour when using icount | 28 | * hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc() |
27 | * hw/arm/tosa: Encapsulate misc GPIO handling in a device | 29 | * raspi, aspeed: Write bootloader code correctly on big-endian hosts |
28 | * hw/arm/palm.c: Encapsulate misc GPIO handling in a device | 30 | * hw/intc/allwinner-a10-pic: Fix bug on big-endian hosts |
29 | * hw/arm/aspeed: Do not create and attach empty SD cards by default | 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 | Aaron Lindsay (1): | 36 | Claudio Fontana (1): |
33 | target/arm: Don't do raw writes for PMINTENCLR | 37 | target/arm: move cpu_tcg to tcg/cpu32.c |
34 | 38 | ||
35 | David CARLIER (8): | 39 | Cédric Le Goater (2): |
36 | build: Enable BSD symbols for Haiku | 40 | hw/arm/boot: Make write_bootloader() public as arm_write_bootloader() |
37 | util/qemu-openpty.c: Don't assume pty.h is glibc-only | 41 | hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader |
38 | build: Check that mlockall() exists | ||
39 | osdep.h: Always include <sys/signal.h> if it exists | ||
40 | osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL | ||
41 | bswap.h: Include <endian.h> on Haiku for bswap operations | ||
42 | util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD | ||
43 | util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku | ||
44 | 42 | ||
45 | Eric Auger (1): | 43 | Daniel Bertalan (1): |
46 | virtio-iommu: Fix coverity issue in virtio_iommu_handle_command() | 44 | hw/arm/bcm2835_property: Implement "get command line" message |
47 | 45 | ||
48 | Gerd Hoffmann (1): | 46 | Fabiano Rosas (11): |
49 | util/drm: make portable by avoiding struct dirent d_type | 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 | ||
50 | 58 | ||
51 | Jean-Christophe Dubois (3): | 59 | Patrick Venture (1): |
52 | Add the ability to change the FEC PHY MDIO device number on i.MX25 processor | 60 | hw/net: npcm7xx_emc: set MAC in register space |
53 | Add the ability to change the FEC PHY MDIO device number on i.MX6 processor | ||
54 | Add the ability to change the FEC PHY MDIO devices numbers on i.MX7 processor | ||
55 | 61 | ||
56 | Peter Maydell (4): | 62 | Peter Maydell (18): |
57 | hw/arm/tosa.c: Detabify | 63 | make one-insn-per-tb an accel option |
58 | hw/arm/tosa: Encapsulate misc GPIO handling in a device | 64 | softmmu: Don't use 'singlestep' global in QMP and HMP commands |
59 | hw/arm/palm.c: Detabify | 65 | accel/tcg: Use one_insn_per_tb global instead of old singlestep global |
60 | hw/arm/palm.c: Encapsulate misc GPIO handling in a device | 66 | linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' |
67 | bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' | ||
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 | ||
61 | 81 | ||
62 | Philippe Mathieu-Daudé (2): | 82 | Philippe Mathieu-Daudé (1): |
63 | hw/arm/bcm2836: Remove unused 'cpu_type' field | 83 | gitlab-ci: Check building KVM-only aarch64 target |
64 | hw/arm/aspeed: Do not create and attach empty SD cards by default | ||
65 | 84 | ||
66 | Richard Henderson (1): | 85 | docs/about/deprecated.rst | 43 +- |
67 | target/arm: Fix mtedesc for do_mem_zpz | 86 | docs/user/main.rst | 14 +- |
87 | configs/devices/aarch64-softmmu/default.mak | 4 - | ||
88 | configs/devices/arm-softmmu/default.mak | 39 -- | ||
89 | qapi/run-state.json | 16 +- | ||
90 | accel/tcg/internal.h | 2 + | ||
91 | include/exec/cpu-common.h | 2 - | ||
92 | include/hw/arm/boot.h | 49 ++ | ||
93 | include/hw/misc/bcm2835_property.h | 1 + | ||
94 | include/monitor/hmp.h | 2 +- | ||
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 | ||
68 | 146 | ||
69 | Wentong Wu (4): | ||
70 | target/nios2: add DISAS_NORETURN case for nothing more to generate | ||
71 | target/nios2: in line the semantics of DISAS_UPDATE with other targets | ||
72 | target/nios2: Use gen_io_start around wrctl instruction | ||
73 | hw/nios2: exit to main CPU loop only when unmasking interrupts | ||
74 | |||
75 | configure | 38 ++++++++++++- | ||
76 | include/hw/arm/bcm2836.h | 1 - | ||
77 | include/hw/arm/fsl-imx25.h | 1 + | ||
78 | include/hw/arm/fsl-imx6.h | 1 + | ||
79 | include/hw/arm/fsl-imx7.h | 1 + | ||
80 | include/qemu/bswap.h | 2 + | ||
81 | include/qemu/osdep.h | 6 +- | ||
82 | hw/arm/aspeed.c | 9 +-- | ||
83 | hw/arm/fsl-imx25.c | 7 +++ | ||
84 | hw/arm/fsl-imx6.c | 7 +++ | ||
85 | hw/arm/fsl-imx7.c | 9 +++ | ||
86 | hw/arm/palm.c | 111 +++++++++++++++++++++++++------------ | ||
87 | hw/arm/tosa.c | 132 +++++++++++++++++++++++++++++--------------- | ||
88 | hw/nios2/cpu_pic.c | 3 +- | ||
89 | hw/virtio/virtio-iommu.c | 1 + | ||
90 | hw/xen/xen-legacy-backend.c | 1 - | ||
91 | os-posix.c | 4 ++ | ||
92 | target/arm/helper.c | 4 +- | ||
93 | target/arm/translate-sve.c | 2 +- | ||
94 | target/nios2/translate.c | 12 +++- | ||
95 | util/compatfd.c | 2 + | ||
96 | util/drm.c | 19 +++++-- | ||
97 | util/oslib-posix.c | 20 ++++++- | ||
98 | util/qemu-openpty.c | 2 +- | ||
99 | 24 files changed, 292 insertions(+), 103 deletions(-) | ||
100 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Fabiano Rosas <farosas@suse.de> | |
2 | |||
3 | The file cpu_tcg.c is about to be moved into the tcg/ directory, so | ||
4 | move the register definitions into a new file. | ||
5 | |||
6 | Also move the function declaration to the more appropriate cpregs.h. | ||
7 | |||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Message-id: 20230426180013.14814-2-farosas@suse.de | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/cpregs.h | 6 ++++ | ||
15 | target/arm/internals.h | 6 ---- | ||
16 | target/arm/cortex-regs.c | 69 ++++++++++++++++++++++++++++++++++++++++ | ||
17 | target/arm/cpu64.c | 1 + | ||
18 | target/arm/cpu_tcg.c | 59 ---------------------------------- | ||
19 | target/arm/meson.build | 1 + | ||
20 | 6 files changed, 77 insertions(+), 65 deletions(-) | ||
21 | create mode 100644 target/arm/cortex-regs.c | ||
22 | |||
23 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/target/arm/cpregs.h | ||
26 | +++ b/target/arm/cpregs.h | ||
27 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_cpreg_in_idspace(const ARMCPRegInfo *ri) | ||
28 | ri->crn, ri->crm); | ||
29 | } | ||
30 | |||
31 | +#ifdef CONFIG_USER_ONLY | ||
32 | +static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } | ||
33 | +#else | ||
34 | +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); | ||
35 | +#endif | ||
36 | + | ||
37 | #endif /* TARGET_ARM_CPREGS_H */ | ||
38 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/internals.h | ||
41 | +++ b/target/arm/internals.h | ||
42 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure); | ||
43 | uint32_t *arm_v7m_get_sp_ptr(CPUARMState *env, bool secure, | ||
44 | bool threadmode, bool spsel); | ||
45 | |||
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 | ||
56 | new file mode 100644 | ||
57 | index XXXXXXX..XXXXXXX | ||
58 | --- /dev/null | ||
59 | +++ b/target/arm/cortex-regs.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | +/* | ||
62 | + * ARM Cortex-A registers | ||
63 | + * | ||
64 | + * This code is licensed under the GNU GPL v2 or later. | ||
65 | + * | ||
66 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
67 | + */ | ||
68 | + | ||
69 | +#include "qemu/osdep.h" | ||
70 | +#include "cpu.h" | ||
71 | +#include "cpregs.h" | ||
72 | + | ||
73 | + | ||
74 | +static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
75 | +{ | ||
76 | + ARMCPU *cpu = env_archcpu(env); | ||
77 | + | ||
78 | + /* Number of cores is in [25:24]; otherwise we RAZ */ | ||
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 }, | ||
124 | +}; | ||
125 | + | ||
126 | +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) | ||
127 | +{ | ||
128 | + define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
129 | +} | ||
130 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
131 | index XXXXXXX..XXXXXXX 100644 | ||
132 | --- a/target/arm/cpu64.c | ||
133 | +++ b/target/arm/cpu64.c | ||
134 | @@ -XXX,XX +XXX,XX @@ | ||
135 | #include "qapi/visitor.h" | ||
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 | )) | ||
224 | -- | ||
225 | 2.34.1 | ||
226 | |||
227 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | In line the semantics of DISAS_UPDATE on nios2 target with other targets | 3 | The sve-max-vq property has been removed from the -cpu max used with |
4 | which is to explicitly write the PC back into the cpu state before doing | 4 | KVM, so code under kvm_enabled in cpu_max_set_sve_max_vq is not |
5 | a tcg_gen_exit_tb(). | 5 | reachable. |
6 | 6 | ||
7 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | 7 | Fixes: 0baa21be49 ("target/arm: Make KVM -cpu max exactly like -cpu host") |
8 | Message-id: 20200710233433.19729-2-wentong.wu@intel.com | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@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 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | target/nios2/translate.c | 2 +- | 14 | target/arm/cpu64.c | 6 ------ |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | 1 file changed, 6 deletions(-) |
14 | 16 | ||
15 | diff --git a/target/nios2/translate.c b/target/nios2/translate.c | 17 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/nios2/translate.c | 19 | --- a/target/arm/cpu64.c |
18 | +++ b/target/nios2/translate.c | 20 | +++ b/target/arm/cpu64.c |
19 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) | 21 | @@ -XXX,XX +XXX,XX @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name, |
20 | /* Indicate where the next block should start */ | 22 | return; |
21 | switch (dc->is_jmp) { | 23 | } |
22 | case DISAS_NEXT: | 24 | |
23 | + case DISAS_UPDATE: | 25 | - if (kvm_enabled() && !kvm_arm_sve_supported()) { |
24 | /* Save the current PC back into the CPU register */ | 26 | - error_setg(errp, "cannot set sve-max-vq"); |
25 | tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); | 27 | - error_append_hint(errp, "SVE not supported by KVM on this host\n"); |
26 | tcg_gen_exit_tb(NULL, 0); | 28 | - return; |
27 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) | 29 | - } |
28 | 30 | - | |
29 | default: | 31 | if (max_vq == 0 || max_vq > ARM_MAX_VQ) { |
30 | case DISAS_JUMP: | 32 | error_setg(errp, "unsupported SVE vector length"); |
31 | - case DISAS_UPDATE: | 33 | error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n", |
32 | /* The jump will already have updated the PC register */ | ||
33 | tcg_gen_exit_tb(NULL, 0); | ||
34 | break; | ||
35 | -- | 34 | -- |
36 | 2.20.1 | 35 | 2.34.1 |
37 | 36 | ||
38 | 37 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Only when guest code is unmasking interrupts, terminate the excution | 3 | Introduce aarch64_max_tcg_initfn that contains the TCG-only part of |
4 | of translated code and exit to the main CPU loop to handle previous | 4 | -cpu max configuration. We'll need that to be able to restrict this |
5 | pended interrupts because of the interrupts mask by guest code. | 5 | code to a TCG-only config in the next patches. |
6 | 6 | ||
7 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Message-id: 20200710233433.19729-4-wentong.wu@intel.com | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
10 | Message-id: 20230426180013.14814-4-farosas@suse.de | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 12 | --- |
12 | hw/nios2/cpu_pic.c | 3 ++- | 13 | target/arm/cpu64.c | 32 ++++++++++++++++++-------------- |
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | 14 | 1 file changed, 18 insertions(+), 14 deletions(-) |
14 | 15 | ||
15 | diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c | 16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/nios2/cpu_pic.c | 18 | --- a/target/arm/cpu64.c |
18 | +++ b/hw/nios2/cpu_pic.c | 19 | +++ b/target/arm/cpu64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void nios2_pic_cpu_handler(void *opaque, int irq, int level) | 20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj) |
20 | 21 | #endif | |
21 | void nios2_check_interrupts(CPUNios2State *env) | 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) | ||
22 | { | 34 | { |
23 | - if (env->irq_pending) { | 35 | ARMCPU *cpu = ARM_CPU(obj); |
24 | + if (env->irq_pending && | 36 | uint64_t t; |
25 | + (env->regs[CR_STATUS] & CR_STATUS_PIE)) { | 37 | uint32_t u; |
26 | env->irq_pending = 0; | 38 | |
27 | cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD); | 39 | - if (kvm_enabled() || hvf_enabled()) { |
28 | } | 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 | - | ||
49 | /* | ||
50 | * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
51 | * one and try to apply errata workarounds or use impdef features we | ||
52 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
53 | qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); | ||
54 | } | ||
55 | |||
56 | +static void aarch64_max_initfn(Object *obj) | ||
57 | +{ | ||
58 | + if (kvm_enabled() || hvf_enabled()) { | ||
59 | + /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ | ||
60 | + aarch64_host_initfn(obj); | ||
61 | + return; | ||
62 | + } | ||
63 | + | ||
64 | + /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ | ||
65 | + | ||
66 | + aarch64_a57_initfn(obj); | ||
67 | + aarch64_max_tcg_initfn(obj); | ||
68 | +} | ||
69 | + | ||
70 | static const ARMCPUInfo aarch64_cpus[] = { | ||
71 | { .name = "cortex-a35", .initfn = aarch64_a35_initfn }, | ||
72 | { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, | ||
29 | -- | 73 | -- |
30 | 2.20.1 | 74 | 2.34.1 |
31 | 75 | ||
32 | 76 | diff view generated by jsdifflib |
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | 3 | We're about to move the TCG-only -cpu max configuration code under |
4 | Message-id: 05a64e83eb1c0c865ac077b22c599425c024c02c.1593806826.git.jcd@tribudubois.net | 4 | CONFIG_TCG. To be able to do that we need to make sure the qtests |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | still have some cpu configured even when no other accelerator is |
6 | [PMM: updated for object_property_set_uint() argument reordering] | 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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 16 | --- |
9 | include/hw/arm/fsl-imx6.h | 1 + | 17 | target/arm/cpu64.c | 12 +++++++++--- |
10 | hw/arm/fsl-imx6.c | 7 +++++++ | 18 | 1 file changed, 9 insertions(+), 3 deletions(-) |
11 | 2 files changed, 8 insertions(+) | ||
12 | 19 | ||
13 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | 20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/fsl-imx6.h | 22 | --- a/target/arm/cpu64.c |
16 | +++ b/include/hw/arm/fsl-imx6.h | 23 | +++ b/target/arm/cpu64.c |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State { | 24 | @@ -XXX,XX +XXX,XX @@ |
18 | MemoryRegion caam; | 25 | #include "qemu/module.h" |
19 | MemoryRegion ocram; | 26 | #include "sysemu/kvm.h" |
20 | MemoryRegion ocram_alias; | 27 | #include "sysemu/hvf.h" |
21 | + uint32_t phy_num; | 28 | +#include "sysemu/qtest.h" |
22 | } FslIMX6State; | 29 | +#include "sysemu/tcg.h" |
23 | 30 | #include "kvm_arm.h" | |
24 | 31 | #include "hvf_arm.h" | |
25 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | 32 | #include "qapi/visitor.h" |
26 | index XXXXXXX..XXXXXXX 100644 | 33 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
27 | --- a/hw/arm/fsl-imx6.c | 34 | return; |
28 | +++ b/hw/arm/fsl-imx6.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
30 | spi_table[i].irq)); | ||
31 | } | 35 | } |
32 | 36 | ||
33 | + object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &err); | 37 | - /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ |
34 | qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]); | 38 | + if (tcg_enabled() || qtest_enabled()) { |
35 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) { | 39 | + aarch64_a57_initfn(obj); |
36 | return; | 40 | + } |
37 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | 41 | |
38 | &s->ocram_alias); | 42 | - aarch64_a57_initfn(obj); |
43 | - aarch64_max_tcg_initfn(obj); | ||
44 | + /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ | ||
45 | + if (tcg_enabled()) { | ||
46 | + aarch64_max_tcg_initfn(obj); | ||
47 | + } | ||
39 | } | 48 | } |
40 | 49 | ||
41 | +static Property fsl_imx6_properties[] = { | 50 | static const ARMCPUInfo aarch64_cpus[] = { |
42 | + DEFINE_PROP_UINT32("fec-phy-num", FslIMX6State, phy_num, 0), | ||
43 | + DEFINE_PROP_END_OF_LIST(), | ||
44 | +}; | ||
45 | + | ||
46 | static void fsl_imx6_class_init(ObjectClass *oc, void *data) | ||
47 | { | ||
48 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
49 | |||
50 | + device_class_set_props(dc, fsl_imx6_properties); | ||
51 | dc->realize = fsl_imx6_realize; | ||
52 | dc->desc = "i.MX6 SOC"; | ||
53 | /* Reason: Uses serial_hd() in the realize() function */ | ||
54 | -- | 51 | -- |
55 | 2.20.1 | 52 | 2.34.1 |
56 | 53 | ||
57 | 54 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Instead of using an OS-specific ifdef test to select the "openpty() | 3 | Move the 64-bit CPUs that are TCG-only: |
4 | is in pty.h" codepath, make configure check for the existence of | 4 | - cortex-a35 |
5 | the header and use the new CONFIG_PTY instead. | 5 | - cortex-a55 |
6 | - cortex-a72 | ||
7 | - cortex-a76 | ||
8 | - a64fx | ||
9 | - neoverse-n1 | ||
6 | 10 | ||
7 | This is necessary to build on Haiku, which also provides openpty() | 11 | Keep the CPUs that can be used with KVM: |
8 | via pty.h. | 12 | - cortex-a57 |
13 | - cortex-a53 | ||
14 | - max | ||
15 | - host | ||
9 | 16 | ||
10 | Signed-off-by: David Carlier <devnexen@gmail.com> | 17 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
13 | Message-id: 20200703145614.16684-3-peter.maydell@linaro.org | 20 | Message-id: 20230426180013.14814-6-farosas@suse.de |
14 | [PMM: Expanded commit message; rename to HAVE_PTY_H] | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 22 | --- |
18 | configure | 9 +++++++++ | 23 | target/arm/internals.h | 4 + |
19 | util/qemu-openpty.c | 2 +- | 24 | hw/arm/virt.c | 6 +- |
20 | 2 files changed, 10 insertions(+), 1 deletion(-) | 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%) | ||
21 | 30 | ||
22 | diff --git a/configure b/configure | 31 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
23 | index XXXXXXX..XXXXXXX 100755 | ||
24 | --- a/configure | ||
25 | +++ b/configure | ||
26 | @@ -XXX,XX +XXX,XX @@ else | ||
27 | l2tpv3=no | ||
28 | fi | ||
29 | |||
30 | +if check_include "pty.h" ; then | ||
31 | + pty_h=yes | ||
32 | +else | ||
33 | + pty_h=no | ||
34 | +fi | ||
35 | + | ||
36 | ######################################### | ||
37 | # vhost interdependencies and host support | ||
38 | |||
39 | @@ -XXX,XX +XXX,XX @@ fi | ||
40 | if test "$sheepdog" = "yes" ; then | ||
41 | echo "CONFIG_SHEEPDOG=y" >> $config_host_mak | ||
42 | fi | ||
43 | +if test "$pty_h" = "yes" ; then | ||
44 | + echo "HAVE_PTY_H=y" >> $config_host_mak | ||
45 | +fi | ||
46 | if test "$fuzzing" = "yes" ; then | ||
47 | if test "$have_fuzzer" = "yes"; then | ||
48 | FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" | ||
49 | diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/util/qemu-openpty.c | 33 | --- a/target/arm/internals.h |
52 | +++ b/util/qemu-openpty.c | 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. */ | ||
46 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/virt.c | ||
49 | +++ b/hw/arm/virt.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = { | ||
51 | ARM_CPU_TYPE_NAME("cortex-a7"), | ||
52 | #endif | ||
53 | ARM_CPU_TYPE_NAME("cortex-a15"), | ||
54 | +#ifdef CONFIG_TCG | ||
55 | ARM_CPU_TYPE_NAME("cortex-a35"), | ||
56 | - ARM_CPU_TYPE_NAME("cortex-a53"), | ||
57 | ARM_CPU_TYPE_NAME("cortex-a55"), | ||
58 | - ARM_CPU_TYPE_NAME("cortex-a57"), | ||
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) | ||
230 | } | ||
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 | * | ||
53 | @@ -XXX,XX +XXX,XX @@ | 839 | @@ -XXX,XX +XXX,XX @@ |
54 | #include "qemu/osdep.h" | 840 | #include "qemu/osdep.h" |
55 | #include "qemu-common.h" | 841 | #include "qapi/error.h" |
56 | 842 | #include "cpu.h" | |
57 | -#if defined(__GLIBC__) | 843 | -#include "cpregs.h" |
58 | +#if defined HAVE_PTY_H | 844 | #include "qemu/module.h" |
59 | # include <pty.h> | 845 | -#include "sysemu/kvm.h" |
60 | #elif defined CONFIG_BSD | 846 | -#include "sysemu/hvf.h" |
61 | # include <termios.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', | ||
62 | -- | 1688 | -- |
63 | 2.20.1 | 1689 | 2.34.1 |
64 | 1690 | ||
65 | 1691 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | The qemu_init_exec_dir() function is inherently non-portable; | 3 | We're about to move the 32-bit CPUs under CONFIG_TCG, so adjust the |
4 | provide an implementation for Haiku hosts. | 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: David Carlier <devnexen@gmail.com> | 9 | While here add comments clarifying what we're testing. |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
9 | Message-id: 20200703145614.16684-9-peter.maydell@linaro.org | 12 | Acked-by: Thomas Huth <thuth@redhat.com> |
10 | [PMM: Expanded commit message] | 13 | Message-id: 20230426180013.14814-7-farosas@suse.de |
14 | Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 17 | --- |
14 | util/oslib-posix.c | 19 +++++++++++++++++++ | 18 | tests/qtest/arm-cpu-features.c | 20 +++++++++++++++++--- |
15 | 1 file changed, 19 insertions(+) | 19 | 1 file changed, 17 insertions(+), 3 deletions(-) |
16 | 20 | ||
17 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 21 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c |
18 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/util/oslib-posix.c | 23 | --- a/tests/qtest/arm-cpu-features.c |
20 | +++ b/util/oslib-posix.c | 24 | +++ b/tests/qtest/arm-cpu-features.c |
21 | @@ -XXX,XX +XXX,XX @@ | 25 | @@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data) |
22 | #include <mach-o/dyld.h> | 26 | QDict *resp; |
23 | #endif | 27 | char *error; |
24 | 28 | ||
25 | +#ifdef __HAIKU__ | 29 | - assert_error(qts, "cortex-a15", |
26 | +#include <kernel/image.h> | 30 | - "We cannot guarantee the CPU type 'cortex-a15' works " |
27 | +#endif | 31 | - "with KVM on this host", NULL); |
28 | + | 32 | + /* |
29 | #include "qemu/mmap-alloc.h" | 33 | + * When using KVM, only the 'host' and 'max' CPU models are |
30 | 34 | + * supported. Test that we're emitting a suitable error for | |
31 | #ifdef CONFIG_DEBUG_STACK_USAGE | 35 | + * unsupported CPU models. |
32 | @@ -XXX,XX +XXX,XX @@ void qemu_init_exec_dir(const char *argv0) | 36 | + */ |
33 | } | 37 | + if (qtest_has_accel("tcg")) { |
34 | } | 38 | + assert_error(qts, "cortex-a7", |
35 | } | 39 | + "We cannot guarantee the CPU type 'cortex-a7' works " |
36 | +#elif defined(__HAIKU__) | 40 | + "with KVM on this host", NULL); |
37 | + { | 41 | + } else { |
38 | + image_info ii; | 42 | + /* |
39 | + int32_t c = 0; | 43 | + * With a KVM-only build the 32-bit CPUs are not present. |
40 | + | 44 | + */ |
41 | + *buf = '\0'; | 45 | + assert_error(qts, "cortex-a7", |
42 | + while (get_next_image_info(0, &c, &ii) == B_OK) { | 46 | + "The CPU type 'cortex-a7' is not a " |
43 | + if (ii.type == B_APP_IMAGE) { | 47 | + "recognized ARM CPU type", NULL); |
44 | + strncpy(buf, ii.name, sizeof(buf)); | ||
45 | + buf[sizeof(buf) - 1] = 0; | ||
46 | + p = buf; | ||
47 | + break; | ||
48 | + } | ||
49 | + } | 48 | + } |
50 | + } | 49 | |
51 | #endif | 50 | assert_has_feature_enabled(qts, "host", "aarch64"); |
52 | /* If we don't have any way of figuring out the actual executable | 51 | |
53 | location then try argv[0]. */ | ||
54 | -- | 52 | -- |
55 | 2.20.1 | 53 | 2.34.1 |
56 | 54 | ||
57 | 55 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | util/compatfd.c includes <sys/syscall.h> so that the CONFIG_SIGNALFD | 3 | move the module containing cpu models definitions |
4 | code can use SYS_signalfd. Guard the #include with CONFIG_SIGNALFD | 4 | for 32bit TCG-only CPUs to tcg/ and rename it for clarity. |
5 | to avoid portability issues on hosts like Haiku which do not | ||
6 | provide that header file. | ||
7 | 5 | ||
8 | Signed-off-by: David Carlier <devnexen@gmail.com> | 6 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
10 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Acked-by: Thomas Huth <thuth@redhat.com> |
12 | Message-id: 20200703145614.16684-8-peter.maydell@linaro.org | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
13 | [PMM: Expanded commit message] | 11 | Message-id: 20230426180013.14814-8-farosas@suse.de |
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 13 | --- |
17 | util/compatfd.c | 2 ++ | 14 | hw/arm/virt.c | 2 -- |
18 | 1 file changed, 2 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%) | ||
19 | 21 | ||
20 | diff --git a/util/compatfd.c b/util/compatfd.c | 22 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
21 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/util/compatfd.c | 24 | --- a/hw/arm/virt.c |
23 | +++ b/util/compatfd.c | 25 | +++ b/hw/arm/virt.c |
26 | @@ -XXX,XX +XXX,XX @@ static const int a15irqmap[] = { | ||
27 | static const char *valid_cpus[] = { | ||
28 | #ifdef CONFIG_TCG | ||
29 | ARM_CPU_TYPE_NAME("cortex-a7"), | ||
30 | -#endif | ||
31 | ARM_CPU_TYPE_NAME("cortex-a15"), | ||
32 | -#ifdef CONFIG_TCG | ||
33 | ARM_CPU_TYPE_NAME("cortex-a35"), | ||
34 | ARM_CPU_TYPE_NAME("cortex-a55"), | ||
35 | ARM_CPU_TYPE_NAME("cortex-a72"), | ||
36 | diff --git a/target/arm/cpu_tcg.c b/target/arm/tcg/cpu32.c | ||
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 | ||
24 | @@ -XXX,XX +XXX,XX @@ | 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 | |||
25 | #include "qemu/osdep.h" | 52 | #include "qemu/osdep.h" |
26 | #include "qemu/thread.h" | 53 | #include "cpu.h" |
27 | 54 | -#ifdef CONFIG_TCG | |
28 | +#if defined(CONFIG_SIGNALFD) | 55 | #include "hw/core/tcg-cpu-ops.h" |
29 | #include <sys/syscall.h> | 56 | -#endif /* CONFIG_TCG */ |
30 | +#endif | 57 | #include "internals.h" |
31 | 58 | #include "target/arm/idau.h" | |
32 | struct sigfd_compat_info | 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) | ||
33 | { | 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', | ||
34 | -- | 142 | -- |
35 | 2.20.1 | 143 | 2.34.1 |
36 | 144 | ||
37 | 145 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Instead of assuming that all POSIX platforms provide mlockall(), | 3 | It is possible to have a build with both TCG and KVM disabled due to |
4 | test for it in configure. If the host doesn't provide this platform | 4 | Xen requiring the i386 and x86_64 binaries to be present in an aarch64 |
5 | then os_mlock() will fail -ENOSYS, as it does already on Windows. | 5 | host. |
6 | 6 | ||
7 | This is necessary for Haiku, which does not have mlockall(). | 7 | If we build with --disable-tcg on the aarch64 host, we will end-up |
8 | with a QEMU binary (x86) that does not support TCG nor KVM. | ||
8 | 9 | ||
9 | Signed-off-by: David Carlier <devnexen@gmail.com> | 10 | Skip tests that crash or hang in the above scenario. Do not include |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | any test cases if TCG and KVM are missing. |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | |
12 | Message-id: 20200703145614.16684-4-peter.maydell@linaro.org | 13 | Make sure that calls to qtest_has_accel are placed after g_test_init |
13 | [PMM: Expanded commit message; rename to HAVE_MLOCKALL] | 14 | in similar fashion to commit ae4b01b349 ("tests: Ensure TAP version is |
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 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 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 25 | --- |
17 | configure | 15 +++++++++++++++ | 26 | tests/qtest/bios-tables-test.c | 11 +++++++++-- |
18 | os-posix.c | 4 ++++ | 27 | tests/qtest/boot-serial-test.c | 5 +++++ |
19 | 2 files changed, 19 insertions(+) | 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(-) | ||
20 | 32 | ||
21 | diff --git a/configure b/configure | 33 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
22 | index XXXXXXX..XXXXXXX 100755 | 34 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/configure | 35 | --- a/tests/qtest/bios-tables-test.c |
24 | +++ b/configure | 36 | +++ b/tests/qtest/bios-tables-test.c |
25 | @@ -XXX,XX +XXX,XX @@ else | 37 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_oem_fields(void) |
26 | pty_h=no | 38 | int main(int argc, char *argv[]) |
27 | fi | 39 | { |
28 | 40 | const char *arch = qtest_get_arch(); | |
29 | +cat > $TMPC <<EOF | 41 | - const bool has_kvm = qtest_has_accel("kvm"); |
30 | +#include <sys/mman.h> | 42 | - const bool has_tcg = qtest_has_accel("tcg"); |
31 | +int main(int argc, char *argv[]) { | 43 | + bool has_kvm, has_tcg; |
32 | + return mlockall(MCL_FUTURE); | 44 | char *v_env = getenv("V"); |
33 | +} | 45 | int ret; |
34 | +EOF | 46 | |
35 | +if compile_prog "" "" ; then | 47 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
36 | + have_mlockall=yes | 48 | |
37 | +else | 49 | g_test_init(&argc, &argv, NULL); |
38 | + have_mlockall=no | 50 | |
39 | +fi | 51 | + has_kvm = qtest_has_accel("kvm"); |
52 | + has_tcg = qtest_has_accel("tcg"); | ||
40 | + | 53 | + |
41 | ######################################### | 54 | + if (!has_tcg && !has_kvm) { |
42 | # vhost interdependencies and host support | 55 | + g_test_skip("No KVM or TCG accelerator available"); |
43 | 56 | + return 0; | |
44 | @@ -XXX,XX +XXX,XX @@ fi | 57 | + } |
45 | if test "$pty_h" = "yes" ; then | 58 | + |
46 | echo "HAVE_PTY_H=y" >> $config_host_mak | 59 | if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { |
47 | fi | 60 | ret = boot_sector_init(disk); |
48 | +if test "$have_mlockall" = "yes" ; then | 61 | if (ret) { |
49 | + echo "HAVE_MLOCKALL=y" >> $config_host_mak | 62 | diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c |
50 | +fi | ||
51 | if test "$fuzzing" = "yes" ; then | ||
52 | if test "$have_fuzzer" = "yes"; then | ||
53 | FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" | ||
54 | diff --git a/os-posix.c b/os-posix.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | 63 | index XXXXXXX..XXXXXXX 100644 |
56 | --- a/os-posix.c | 64 | --- a/tests/qtest/boot-serial-test.c |
57 | +++ b/os-posix.c | 65 | +++ b/tests/qtest/boot-serial-test.c |
58 | @@ -XXX,XX +XXX,XX @@ bool is_daemonized(void) | 66 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
59 | 67 | ||
60 | int os_mlock(void) | 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 | + } | ||
74 | + | ||
75 | for (i = 0; tests[i].arch != NULL; i++) { | ||
76 | if (g_str_equal(arch, tests[i].arch) && | ||
77 | qtest_has_machine(tests[i].machine)) { | ||
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) | ||
61 | { | 85 | { |
62 | +#ifdef HAVE_MLOCKALL | 86 | - bool has_kvm; |
63 | int ret = 0; | 87 | + bool has_kvm, has_tcg; |
64 | 88 | bool has_uffd; | |
65 | ret = mlockall(MCL_CURRENT | MCL_FUTURE); | 89 | const char *arch; |
66 | @@ -XXX,XX +XXX,XX @@ int os_mlock(void) | 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"); | ||
96 | + | ||
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) | ||
133 | { | ||
134 | int ret; | ||
135 | |||
136 | + g_test_init(&argc, &argv, NULL); | ||
137 | + | ||
138 | + if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) { | ||
139 | + g_test_skip("No KVM or TCG accelerator available"); | ||
140 | + return 0; | ||
141 | + } | ||
142 | + | ||
143 | ret = boot_sector_init(disk); | ||
144 | if (ret) { | ||
145 | return ret; | ||
67 | } | 146 | } |
68 | 147 | ||
69 | return ret; | 148 | - g_test_init(&argc, &argv, NULL); |
70 | +#else | 149 | - |
71 | + return -ENOSYS; | 150 | qtest_add_func("/vmgenid/vmgenid/set-guid", |
72 | +#endif | 151 | vmgenid_set_guid_test); |
73 | } | 152 | qtest_add_func("/vmgenid/vmgenid/set-guid-auto", |
74 | -- | 153 | -- |
75 | 2.20.1 | 154 | 2.34.1 |
76 | 155 | ||
77 | 156 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Tell Haiku to provide various BSD functions by setting BSD_SOURCE | 3 | The migration tests are currently broken for an aarch64 host because |
4 | and linking libbsd. | 4 | the tests pass no 'machine' and 'cpu' options on the QEMU command |
5 | line. | ||
5 | 6 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 7 | Add a separate class to each architecture so that we can specify |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | 'machine' and 'cpu' options instead of relying on defaults. |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | |
9 | Message-id: 20200703145614.16684-2-peter.maydell@linaro.org | 10 | Add a skip decorator to keep the current behavior of only running |
10 | [PMM: expanded commit message] | 11 | migration tests when the qemu target matches the host architecture. |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
14 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
15 | Message-id: 20230426180013.14814-10-farosas@suse.de | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 17 | --- |
14 | configure | 4 ++-- | 18 | tests/avocado/migration.py | 83 +++++++++++++++++++++++++++++++++++--- |
15 | 1 file changed, 2 insertions(+), 2 deletions(-) | 19 | 1 file changed, 78 insertions(+), 5 deletions(-) |
16 | 20 | ||
17 | diff --git a/configure b/configure | 21 | diff --git a/tests/avocado/migration.py b/tests/avocado/migration.py |
18 | index XXXXXXX..XXXXXXX 100755 | 22 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/configure | 23 | --- a/tests/avocado/migration.py |
20 | +++ b/configure | 24 | +++ b/tests/avocado/migration.py |
21 | @@ -XXX,XX +XXX,XX @@ SunOS) | 25 | @@ -XXX,XX +XXX,XX @@ |
22 | ;; | 26 | |
23 | Haiku) | 27 | |
24 | haiku="yes" | 28 | import tempfile |
25 | - QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" | 29 | +import os |
26 | - LIBS="-lposix_error_mapper -lnetwork $LIBS" | 30 | + |
27 | + QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" | 31 | from avocado_qemu import QemuSystemTest |
28 | + LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS" | 32 | from avocado import skipUnless |
29 | ;; | 33 | |
30 | Linux) | 34 | @@ -XXX,XX +XXX,XX @@ |
31 | audio_drv_list="try-pa oss" | 35 | from avocado.utils.path import find_command |
36 | |||
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() | ||
32 | -- | 139 | -- |
33 | 2.20.1 | 140 | 2.34.1 |
34 | 141 | ||
35 | 142 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Fabiano Rosas <farosas@suse.de> | ||
1 | 2 | ||
3 | We are about to enable the build without TCG, so CONFIG_SEMIHOSTING | ||
4 | and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in | ||
5 | default.mak anymore. So reflect the change in a Kconfig. | ||
6 | |||
7 | Instead of using semihosting/Kconfig, use a target-specific file, so | ||
8 | that the change doesn't affect other architectures which might | ||
9 | implement semihosting in a way compatible with KVM. | ||
10 | |||
11 | The selection from ARM_v7M needs to be removed to avoid a cycle during | ||
12 | parsing. | ||
13 | |||
14 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20230426180013.14814-11-farosas@suse.de | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | configs/devices/arm-softmmu/default.mak | 2 -- | ||
20 | hw/arm/Kconfig | 1 - | ||
21 | target/arm/Kconfig | 7 +++++++ | ||
22 | 3 files changed, 7 insertions(+), 3 deletions(-) | ||
23 | |||
24 | diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/configs/devices/arm-softmmu/default.mak | ||
27 | +++ b/configs/devices/arm-softmmu/default.mak | ||
28 | @@ -XXX,XX +XXX,XX @@ CONFIG_MICROBIT=y | ||
29 | CONFIG_FSL_IMX25=y | ||
30 | CONFIG_FSL_IMX7=y | ||
31 | CONFIG_FSL_IMX6UL=y | ||
32 | -CONFIG_SEMIHOSTING=y | ||
33 | -CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y | ||
34 | CONFIG_ALLWINNER_H3=y | ||
35 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/hw/arm/Kconfig | ||
38 | +++ b/hw/arm/Kconfig | ||
39 | @@ -XXX,XX +XXX,XX @@ config ARM_V7M | ||
40 | # currently v7M must be included in a TCG build due to translate.c | ||
41 | default y if TCG && (ARM || AARCH64) | ||
42 | select PTIMER | ||
43 | - select ARM_COMPATIBLE_SEMIHOSTING | ||
44 | |||
45 | config ALLWINNER_A10 | ||
46 | bool | ||
47 | diff --git a/target/arm/Kconfig b/target/arm/Kconfig | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/target/arm/Kconfig | ||
50 | +++ b/target/arm/Kconfig | ||
51 | @@ -XXX,XX +XXX,XX @@ config ARM | ||
52 | config AARCH64 | ||
53 | bool | ||
54 | select ARM | ||
55 | + | ||
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 | ||
62 | -- | ||
63 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Fabiano Rosas <farosas@suse.de> | |
2 | |||
3 | Move all the CONFIG_FOO=y from default.mak into "default y if TCG" | ||
4 | statements in Kconfig. That way they won't be selected when | ||
5 | CONFIG_TCG=n. | ||
6 | |||
7 | I'm leaving CONFIG_ARM_VIRT in default.mak because it allows us to | ||
8 | keep the two default.mak files not empty and keep aarch64-default.mak | ||
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 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | configs/devices/aarch64-softmmu/default.mak | 4 -- | ||
20 | configs/devices/arm-softmmu/default.mak | 37 ------------------ | ||
21 | hw/arm/Kconfig | 42 ++++++++++++++++++++- | ||
22 | 3 files changed, 41 insertions(+), 42 deletions(-) | ||
23 | |||
24 | diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/configs/devices/aarch64-softmmu/default.mak | ||
27 | +++ b/configs/devices/aarch64-softmmu/default.mak | ||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | |||
30 | # We support all the 32 bit boards so need all their config | ||
31 | include ../arm-softmmu/default.mak | ||
32 | - | ||
33 | -CONFIG_XLNX_ZYNQMP_ARM=y | ||
34 | -CONFIG_XLNX_VERSAL=y | ||
35 | -CONFIG_SBSA_REF=y | ||
36 | diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/configs/devices/arm-softmmu/default.mak | ||
39 | +++ b/configs/devices/arm-softmmu/default.mak | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | # CONFIG_TEST_DEVICES=n | ||
42 | |||
43 | CONFIG_ARM_VIRT=y | ||
44 | -CONFIG_CUBIEBOARD=y | ||
45 | -CONFIG_EXYNOS4=y | ||
46 | -CONFIG_HIGHBANK=y | ||
47 | -CONFIG_INTEGRATOR=y | ||
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 | ||
81 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/hw/arm/Kconfig | ||
84 | +++ b/hw/arm/Kconfig | ||
85 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | ||
86 | |||
87 | config CHEETAH | ||
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 | |||
390 | -- | ||
391 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Fabiano Rosas <farosas@suse.de> | ||
1 | 2 | ||
3 | The test set -accel tcg, so restrict it to when TCG is present. | ||
4 | |||
5 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
6 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20230426180013.14814-13-farosas@suse.de | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | tests/qtest/meson.build | 3 ++- | ||
12 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tests/qtest/meson.build | ||
17 | +++ b/tests/qtest/meson.build | ||
18 | @@ -XXX,XX +XXX,XX @@ qtests_aarch64 = \ | ||
19 | ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ | ||
20 | (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ | ||
21 | (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ | ||
22 | - (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ | ||
23 | + (config_all.has_key('CONFIG_TCG') and \ | ||
24 | + config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ | ||
25 | ['arm-cpu-features', | ||
26 | 'numa-test', | ||
27 | 'boot-serial-test', | ||
28 | -- | ||
29 | 2.34.1 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Haiku doesn't provide SIGIO; fix this up in osdep.h by defining it as | 3 | Add a manual new job to cross-build the aarch64 target with |
4 | equal to SIGPOLL. | 4 | only the KVM accelerator enabled (in particular, no TCG). |
5 | 5 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 6 | Re-enable running the similar job on the project Aarch64 |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | custom runner. |
8 | |||
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
10 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
8 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 11 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20200703145614.16684-6-peter.maydell@linaro.org | 13 | Message-id: 20230426180013.14814-14-farosas@suse.de |
11 | [PMM: Expanded commit message] | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 15 | --- |
15 | include/qemu/osdep.h | 4 ++++ | 16 | .gitlab-ci.d/crossbuilds.yml | 11 +++++++++++ |
16 | 1 file changed, 4 insertions(+) | 17 | .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | 4 ---- |
18 | 2 files changed, 11 insertions(+), 4 deletions(-) | ||
17 | 19 | ||
18 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | 20 | diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml |
19 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/qemu/osdep.h | 22 | --- a/.gitlab-ci.d/crossbuilds.yml |
21 | +++ b/include/qemu/osdep.h | 23 | +++ b/.gitlab-ci.d/crossbuilds.yml |
22 | @@ -XXX,XX +XXX,XX @@ void qemu_anon_ram_free(void *ptr, size_t size); | 24 | @@ -XXX,XX +XXX,XX @@ cross-arm64-xen-only: |
23 | #define HAVE_CHARDEV_PARPORT 1 | 25 | IMAGE: debian-arm64-cross |
24 | #endif | 26 | ACCEL: xen |
25 | 27 | EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm | |
26 | +#if defined(__HAIKU__) | ||
27 | +#define SIGIO SIGPOLL | ||
28 | +#endif | ||
29 | + | 28 | + |
30 | #if defined(CONFIG_LINUX) | 29 | +# Similar job is run by qemu-project's custom runner by default |
31 | #ifndef BUS_MCEERR_AR | 30 | +cross-arm64-kvm-only: |
32 | #define BUS_MCEERR_AR 4 | 31 | + extends: .cross_accel_build_job |
32 | + needs: | ||
33 | + job: arm64-debian-cross-container | ||
34 | + variables: | ||
35 | + QEMU_JOB_OPTIONAL: 1 | ||
36 | + IMAGE: debian-arm64-cross | ||
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 | ||
33 | -- | 55 | -- |
34 | 2.20.1 | 56 | 2.34.1 |
35 | 57 | ||
36 | 58 | diff view generated by jsdifflib |
1 | From: Gerd Hoffmann <kraxel@redhat.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Given this isn't perforance critical at all lets avoid the non-portable | 3 | The MAC address set from Qemu wasn't being saved into the register space. |
4 | d_type and use fstat instead to check whenever the file is a chardev. | ||
5 | 4 | ||
6 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | 5 | Reviewed-by: Hao Wu <wuhaotsh@google.com> |
7 | Reported-by: David Carlier <devnexen@gmail.com> | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | [PMM: moved variable declaration to top of function] |
11 | Message-id: 20200703145614.16684-10-peter.maydell@linaro.org | ||
12 | Message-id: 20200701180302.14821-1-kraxel@redhat.com | ||
13 | [PMM: fixed comment style; tweaked subject line] | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 11 | --- |
17 | util/drm.c | 19 ++++++++++++++----- | 12 | hw/net/npcm7xx_emc.c | 32 +++++++++++++++++++++++++------- |
18 | 1 file changed, 14 insertions(+), 5 deletions(-) | 13 | 1 file changed, 25 insertions(+), 7 deletions(-) |
19 | 14 | ||
20 | diff --git a/util/drm.c b/util/drm.c | 15 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
21 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/util/drm.c | 17 | --- a/hw/net/npcm7xx_emc.c |
23 | +++ b/util/drm.c | 18 | +++ b/hw/net/npcm7xx_emc.c |
24 | @@ -XXX,XX +XXX,XX @@ int qemu_drm_rendernode_open(const char *rendernode) | 19 | @@ -XXX,XX +XXX,XX @@ static const char *emc_reg_name(int regno) |
20 | |||
21 | static void emc_reset(NPCM7xxEMCState *emc) | ||
25 | { | 22 | { |
26 | DIR *dir; | 23 | + uint32_t value; |
27 | struct dirent *e; | 24 | + |
28 | - int r, fd; | 25 | trace_npcm7xx_emc_reset(emc->emc_num); |
29 | + struct stat st; | 26 | |
30 | + int r, fd, ret; | 27 | memset(&emc->regs[0], 0, sizeof(emc->regs)); |
31 | char *p; | 28 | @@ -XXX,XX +XXX,XX @@ static void emc_reset(NPCM7xxEMCState *emc) |
32 | 29 | ||
33 | if (rendernode) { | 30 | emc->tx_active = false; |
34 | @@ -XXX,XX +XXX,XX @@ int qemu_drm_rendernode_open(const char *rendernode) | 31 | emc->rx_active = false; |
35 | 32 | + | |
36 | fd = -1; | 33 | + /* Set the MAC address in the register space. */ |
37 | while ((e = readdir(dir))) { | 34 | + value = (emc->conf.macaddr.a[0] << 24) | |
38 | - if (e->d_type != DT_CHR) { | 35 | + (emc->conf.macaddr.a[1] << 16) | |
39 | - continue; | 36 | + (emc->conf.macaddr.a[2] << 8) | |
40 | - } | 37 | + emc->conf.macaddr.a[3]; |
41 | - | 38 | + emc->regs[REG_CAMM_BASE] = value; |
42 | if (strncmp(e->d_name, "renderD", 7)) { | 39 | + |
43 | continue; | 40 | + value = (emc->conf.macaddr.a[4] << 24) | (emc->conf.macaddr.a[5] << 16); |
41 | + emc->regs[REG_CAML_BASE] = value; | ||
42 | } | ||
43 | |||
44 | static void npcm7xx_emc_reset(DeviceState *dev) | ||
45 | @@ -XXX,XX +XXX,XX @@ static bool emc_receive_filter1(NPCM7xxEMCState *emc, const uint8_t *buf, | ||
44 | } | 46 | } |
45 | @@ -XXX,XX +XXX,XX @@ int qemu_drm_rendernode_open(const char *rendernode) | 47 | case ETH_PKT_UCAST: { |
46 | g_free(p); | 48 | bool matches; |
47 | continue; | 49 | + uint32_t value; |
50 | + struct MACAddr mac; | ||
51 | if (emc->regs[REG_CAMCMR] & REG_CAMCMR_AUP) { | ||
52 | return true; | ||
48 | } | 53 | } |
49 | + | 54 | + |
50 | + /* | 55 | + value = emc->regs[REG_CAMM_BASE]; |
51 | + * prefer fstat() over checking e->d_type == DT_CHR for | 56 | + mac.a[0] = value >> 24; |
52 | + * portability reasons | 57 | + mac.a[1] = value >> 16; |
53 | + */ | 58 | + mac.a[2] = value >> 8; |
54 | + ret = fstat(r, &st); | 59 | + mac.a[3] = value >> 0; |
55 | + if (ret < 0 || (st.st_mode & S_IFMT) != S_IFCHR) { | 60 | + value = emc->regs[REG_CAML_BASE]; |
56 | + close(r); | 61 | + mac.a[4] = value >> 24; |
57 | + g_free(p); | 62 | + mac.a[5] = value >> 16; |
58 | + continue; | ||
59 | + } | ||
60 | + | 63 | + |
61 | fd = r; | 64 | matches = ((emc->regs[REG_CAMCMR] & REG_CAMCMR_ECMP) && |
62 | g_free(p); | 65 | /* We only support one CAM register, CAM0. */ |
66 | (emc->regs[REG_CAMEN] & (1 << 0)) && | ||
67 | - memcmp(buf, emc->conf.macaddr.a, ETH_ALEN) == 0); | ||
68 | + memcmp(buf, mac.a, ETH_ALEN) == 0); | ||
69 | if (emc->regs[REG_CAMCMR] & REG_CAMCMR_CCAM) { | ||
70 | *fail_reason = "MACADDR matched, comparison complemented"; | ||
71 | return !matches; | ||
72 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | ||
63 | break; | 73 | break; |
74 | case REG_CAMM_BASE + 0: | ||
75 | emc->regs[reg] = value; | ||
76 | - emc->conf.macaddr.a[0] = value >> 24; | ||
77 | - emc->conf.macaddr.a[1] = value >> 16; | ||
78 | - emc->conf.macaddr.a[2] = value >> 8; | ||
79 | - emc->conf.macaddr.a[3] = value >> 0; | ||
80 | break; | ||
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.20.1 | 89 | 2.34.1 |
66 | 90 | ||
67 | 91 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Daniel Bertalan <dani@danielbertalan.dev> | ||
1 | 2 | ||
3 | This query copies the kernel command line into the message buffer. It | ||
4 | was previously stubbed out to return empty, this commit makes it reflect | ||
5 | the arguments specified with `-append`. | ||
6 | |||
7 | I observed the following peculiarities on my Pi 3B+: | ||
8 | - If the buffer is shorter than the string, the response header gives | ||
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] | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | --- | ||
23 | include/hw/misc/bcm2835_property.h | 1 + | ||
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(-) | ||
29 | |||
30 | diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/include/hw/misc/bcm2835_property.h | ||
33 | +++ b/include/hw/misc/bcm2835_property.h | ||
34 | @@ -XXX,XX +XXX,XX @@ struct BCM2835PropertyState { | ||
35 | MACAddr macaddr; | ||
36 | uint32_t board_rev; | ||
37 | uint32_t addr; | ||
38 | + char *command_line; | ||
39 | bool pending; | ||
40 | }; | ||
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 | }; | ||
111 | |||
112 | -- | ||
113 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | This commit adds 'one-insn-per-tb' as a property on the TCG | |
2 | accelerator object, so you can enable it with | ||
3 | -accel tcg,one-insn-per-tb=on | ||
4 | |||
5 | It has the same behaviour as the existing '-singlestep' command line | ||
6 | option. We use a different name because 'singlestep' has always been | ||
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 | |||
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 | ||
27 | --- | ||
28 | accel/tcg/tcg-all.c | 21 +++++++++++++++++++++ | ||
29 | bsd-user/main.c | 8 ++++++-- | ||
30 | linux-user/main.c | 8 ++++++-- | ||
31 | softmmu/vl.c | 17 +++++++++++++++-- | ||
32 | qemu-options.hx | 7 +++++++ | ||
33 | 5 files changed, 55 insertions(+), 6 deletions(-) | ||
34 | |||
35 | diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c | ||
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; | ||
49 | } | ||
50 | |||
51 | +static bool tcg_get_one_insn_per_tb(Object *obj, Error **errp) | ||
52 | +{ | ||
53 | + TCGState *s = TCG_STATE(obj); | ||
54 | + return s->one_insn_per_tb; | ||
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) | ||
66 | { | ||
67 | /* | ||
68 | @@ -XXX,XX +XXX,XX @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) | ||
69 | tcg_get_splitwx, tcg_set_splitwx); | ||
70 | object_class_property_set_description(oc, "split-wx", | ||
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); | ||
167 | - | ||
168 | + /* | ||
169 | + * If legacy -singlestep option is set, honour it for TCG and | ||
170 | + * silently ignore for any other accelerator (which is how this | ||
171 | + * option has always behaved). | ||
172 | + */ | ||
173 | + if (opt_one_insn_per_tb) { | ||
174 | + /* | ||
175 | + * This will always succeed for TCG, and we want to ignore | ||
176 | + * the error from trying to set a nonexistent property | ||
177 | + * on any other accelerator. | ||
178 | + */ | ||
179 | + object_property_set_bool(OBJECT(accel), "one-insn-per-tb", true, NULL); | ||
180 | + } | ||
181 | ret = accel_init_machine(accel, current_machine); | ||
182 | if (ret < 0) { | ||
183 | if (!qtest_with_kvm || ret != -ENOENT) { | ||
184 | @@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv) | ||
185 | qdict_put_str(machine_opts_dict, "firmware", optarg); | ||
186 | break; | ||
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 | ||
218 | -- | ||
219 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
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. | ||
1 | 5 | ||
6 | This leaves the HMP and QMP command/field names and output strings | ||
7 | unchanged; we will clean that up later. | ||
8 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
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(-) | ||
17 | |||
18 | diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/softmmu/runstate-hmp-cmds.c | ||
21 | +++ b/softmmu/runstate-hmp-cmds.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | #include "qapi/error.h" | ||
24 | #include "qapi/qapi-commands-run-state.h" | ||
25 | #include "qapi/qmp/qdict.h" | ||
26 | +#include "qemu/accel.h" | ||
27 | |||
28 | void hmp_info_status(Monitor *mon, const QDict *qdict) | ||
29 | { | ||
30 | @@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict) | ||
31 | void hmp_singlestep(Monitor *mon, const QDict *qdict) | ||
32 | { | ||
33 | const char *option = qdict_get_try_str(qdict, "option"); | ||
34 | + AccelState *accel = current_accel(); | ||
35 | + bool newval; | ||
36 | + | ||
37 | + if (!object_property_find(OBJECT(accel), "one-insn-per-tb")) { | ||
38 | + monitor_printf(mon, | ||
39 | + "This accelerator does not support setting one-insn-per-tb\n"); | ||
40 | + return; | ||
41 | + } | ||
42 | + | ||
43 | if (!option || !strcmp(option, "on")) { | ||
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; | ||
52 | } | ||
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 | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/softmmu/runstate.c | ||
62 | +++ b/softmmu/runstate.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | #include "qapi/error.h" | ||
65 | #include "qapi/qapi-commands-run-state.h" | ||
66 | #include "qapi/qapi-events-run-state.h" | ||
67 | +#include "qemu/accel.h" | ||
68 | #include "qemu/error-report.h" | ||
69 | #include "qemu/job.h" | ||
70 | #include "qemu/log.h" | ||
71 | @@ -XXX,XX +XXX,XX @@ bool runstate_needs_reset(void) | ||
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; | ||
89 | -- | ||
90 | 2.34.1 | ||
91 | |||
92 | diff view generated by jsdifflib |
1 | Currently we have a free-floating set of IRQs and a function | 1 | The only place left that looks at the old 'singlestep' global |
---|---|---|---|
2 | tosa_out_switch() which handle the GPIO lines on the tosa board which | 2 | variable is the TCG curr_cflags() function. Replace the old global |
3 | connect to LEDs, and another free-floating IRQ and tosa_reset() | 3 | with a new 'one_insn_per_tb' which is defined in tcg-all.c and |
4 | function to handle the GPIO line that resets the system. Encapsulate | 4 | declared in accel/tcg/internal.h. This keeps it restricted to the |
5 | this behaviour in a simple QOM device. | 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. | ||
6 | 8 | ||
7 | This commit fixes Coverity issue CID 1421929 (which pointed out that | 9 | While we're making this change, use qatomic_read() and qatomic_set() |
8 | the 'outsignals' in tosa_gpio_setup() were leaked), because it | 10 | on the accesses to the new global, because TCG will read it without |
9 | removes the use of the qemu_allocate_irqs() API from this code | 11 | holding a lock. |
10 | entirely. | ||
11 | 12 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Message-id: 20200628203748.14250-3-peter.maydell@linaro.org | 15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
16 | Message-id: 20230417164041.684562-4-peter.maydell@linaro.org | ||
15 | --- | 17 | --- |
16 | hw/arm/tosa.c | 88 +++++++++++++++++++++++++++++++++++++-------------- | 18 | accel/tcg/internal.h | 2 ++ |
17 | 1 file changed, 64 insertions(+), 24 deletions(-) | 19 | include/exec/cpu-common.h | 2 -- |
20 | accel/tcg/cpu-exec.c | 2 +- | ||
21 | accel/tcg/tcg-all.c | 6 ++++-- | ||
22 | bsd-user/main.c | 1 - | ||
23 | linux-user/main.c | 1 - | ||
24 | softmmu/globals.c | 1 - | ||
25 | 7 files changed, 7 insertions(+), 8 deletions(-) | ||
18 | 26 | ||
19 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | 27 | diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h |
20 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/tosa.c | 29 | --- a/accel/tcg/internal.h |
22 | +++ b/hw/arm/tosa.c | 30 | +++ b/accel/tcg/internal.h |
23 | @@ -XXX,XX +XXX,XX @@ static void tosa_microdrive_attach(PXA2xxState *cpu) | 31 | @@ -XXX,XX +XXX,XX @@ static inline target_ulong log_pc(CPUState *cpu, const TranslationBlock *tb) |
24 | pxa2xx_pcmcia_attach(cpu->pcmcia[0], md); | 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 | ||
68 | @@ -XXX,XX +XXX,XX @@ | ||
69 | #include "qapi/error.h" | ||
70 | #include "qemu/error-report.h" | ||
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) | ||
25 | } | 77 | } |
26 | 78 | ||
27 | -static void tosa_out_switch(void *opaque, int line, int level) | 79 | bool mttcg_enabled; |
28 | +/* | 80 | +bool one_insn_per_tb; |
29 | + * Encapsulation of some GPIO line behaviour for the Tosa board | 81 | |
30 | + * | 82 | static int tcg_init_machine(MachineState *ms) |
31 | + * QEMU interface: | ||
32 | + * + named GPIO inputs "leds[0..3]": assert to light LEDs | ||
33 | + * + named GPIO input "reset": when asserted, resets the system | ||
34 | + */ | ||
35 | + | ||
36 | +#define TYPE_TOSA_MISC_GPIO "tosa-misc-gpio" | ||
37 | +#define TOSA_MISC_GPIO(obj) \ | ||
38 | + OBJECT_CHECK(TosaMiscGPIOState, (obj), TYPE_TOSA_MISC_GPIO) | ||
39 | + | ||
40 | +typedef struct TosaMiscGPIOState { | ||
41 | + SysBusDevice parent_obj; | ||
42 | +} TosaMiscGPIOState; | ||
43 | + | ||
44 | +static void tosa_gpio_leds(void *opaque, int line, int level) | ||
45 | { | 83 | { |
46 | switch (line) { | 84 | @@ -XXX,XX +XXX,XX @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp) |
47 | - case 0: | 85 | { |
48 | - fprintf(stderr, "blue LED %s.\n", level ? "on" : "off"); | 86 | TCGState *s = TCG_STATE(obj); |
49 | - break; | 87 | s->one_insn_per_tb = value; |
50 | - case 1: | 88 | - /* For the moment, set the global also: this changes the behaviour */ |
51 | - fprintf(stderr, "green LED %s.\n", level ? "on" : "off"); | 89 | - singlestep = value; |
52 | - break; | 90 | + /* Set the global also: this changes the behaviour */ |
53 | - case 2: | 91 | + qatomic_set(&one_insn_per_tb, value); |
54 | - fprintf(stderr, "amber LED %s.\n", level ? "on" : "off"); | ||
55 | - break; | ||
56 | - case 3: | ||
57 | - fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off"); | ||
58 | - break; | ||
59 | - default: | ||
60 | - fprintf(stderr, "Uhandled out event: %d = %d\n", line, level); | ||
61 | - break; | ||
62 | + case 0: | ||
63 | + fprintf(stderr, "blue LED %s.\n", level ? "on" : "off"); | ||
64 | + break; | ||
65 | + case 1: | ||
66 | + fprintf(stderr, "green LED %s.\n", level ? "on" : "off"); | ||
67 | + break; | ||
68 | + case 2: | ||
69 | + fprintf(stderr, "amber LED %s.\n", level ? "on" : "off"); | ||
70 | + break; | ||
71 | + case 3: | ||
72 | + fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off"); | ||
73 | + break; | ||
74 | + default: | ||
75 | + g_assert_not_reached(); | ||
76 | } | ||
77 | } | 92 | } |
78 | 93 | ||
79 | @@ -XXX,XX +XXX,XX @@ static void tosa_reset(void *opaque, int line, int level) | 94 | static int tcg_gdbstub_supported_sstep_flags(void) |
80 | } | 95 | diff --git a/bsd-user/main.c b/bsd-user/main.c |
81 | } | 96 | index XXXXXXX..XXXXXXX 100644 |
82 | 97 | --- a/bsd-user/main.c | |
83 | +static void tosa_misc_gpio_init(Object *obj) | 98 | +++ b/bsd-user/main.c |
84 | +{ | 99 | @@ -XXX,XX +XXX,XX @@ |
85 | + DeviceState *dev = DEVICE(obj); | 100 | #include "host-os.h" |
86 | + | 101 | #include "target_arch_cpu.h" |
87 | + qdev_init_gpio_in_named(dev, tosa_gpio_leds, "leds", 4); | 102 | |
88 | + qdev_init_gpio_in_named(dev, tosa_reset, "reset", 1); | 103 | -int singlestep; |
89 | +} | 104 | static bool opt_one_insn_per_tb; |
90 | + | 105 | uintptr_t guest_base; |
91 | static void tosa_gpio_setup(PXA2xxState *cpu, | 106 | bool have_guest_base; |
92 | DeviceState *scp0, | 107 | diff --git a/linux-user/main.c b/linux-user/main.c |
93 | DeviceState *scp1, | 108 | index XXXXXXX..XXXXXXX 100644 |
94 | TC6393xbState *tmio) | 109 | --- a/linux-user/main.c |
95 | { | 110 | +++ b/linux-user/main.c |
96 | - qemu_irq *outsignals = qemu_allocate_irqs(tosa_out_switch, cpu, 4); | 111 | @@ -XXX,XX +XXX,XX @@ |
97 | - qemu_irq reset; | 112 | char *exec_path; |
98 | + DeviceState *misc_gpio; | 113 | char real_exec_path[PATH_MAX]; |
99 | + | 114 | |
100 | + misc_gpio = sysbus_create_simple(TYPE_TOSA_MISC_GPIO, -1, NULL); | 115 | -int singlestep; |
101 | 116 | static bool opt_one_insn_per_tb; | |
102 | /* MMC/SD host */ | 117 | static const char *argv0; |
103 | pxa2xx_mmci_handlers(cpu->mmc, | 118 | static const char *gdbstub; |
104 | @@ -XXX,XX +XXX,XX @@ static void tosa_gpio_setup(PXA2xxState *cpu, | 119 | diff --git a/softmmu/globals.c b/softmmu/globals.c |
105 | qemu_irq_invert(qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_nSD_DETECT))); | 120 | index XXXXXXX..XXXXXXX 100644 |
106 | 121 | --- a/softmmu/globals.c | |
107 | /* Handle reset */ | 122 | +++ b/softmmu/globals.c |
108 | - reset = qemu_allocate_irq(tosa_reset, cpu, 0); | 123 | @@ -XXX,XX +XXX,XX @@ int vga_interface_type = VGA_NONE; |
109 | - qdev_connect_gpio_out(cpu->gpio, TOSA_GPIO_ON_RESET, reset); | 124 | bool vga_interface_created; |
110 | + qdev_connect_gpio_out(cpu->gpio, TOSA_GPIO_ON_RESET, | 125 | Chardev *parallel_hds[MAX_PARALLEL_PORTS]; |
111 | + qdev_get_gpio_in_named(misc_gpio, "reset", 0)); | 126 | int win2k_install_hack; |
112 | 127 | -int singlestep; | |
113 | /* PCMCIA signals: card's IRQ and Card-Detect */ | 128 | int fd_bootchk = 1; |
114 | pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0], | 129 | int graphic_rotate; |
115 | @@ -XXX,XX +XXX,XX @@ static void tosa_gpio_setup(PXA2xxState *cpu, | 130 | QEMUOptionRom option_rom[MAX_OPTION_ROMS]; |
116 | qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_JC_CF_IRQ), | ||
117 | NULL); | ||
118 | |||
119 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_BT_LED, outsignals[0]); | ||
120 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_NOTE_LED, outsignals[1]); | ||
121 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_CHRG_ERR_LED, outsignals[2]); | ||
122 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_WLAN_LED, outsignals[3]); | ||
123 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_BT_LED, | ||
124 | + qdev_get_gpio_in_named(misc_gpio, "leds", 0)); | ||
125 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_NOTE_LED, | ||
126 | + qdev_get_gpio_in_named(misc_gpio, "leds", 1)); | ||
127 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_CHRG_ERR_LED, | ||
128 | + qdev_get_gpio_in_named(misc_gpio, "leds", 2)); | ||
129 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_WLAN_LED, | ||
130 | + qdev_get_gpio_in_named(misc_gpio, "leds", 3)); | ||
131 | |||
132 | qdev_connect_gpio_out(scp1, TOSA_GPIO_TC6393XB_L3V_ON, tc6393xb_l3v_get(tmio)); | ||
133 | |||
134 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo tosa_ssp_info = { | ||
135 | .class_init = tosa_ssp_class_init, | ||
136 | }; | ||
137 | |||
138 | +static const TypeInfo tosa_misc_gpio_info = { | ||
139 | + .name = "tosa-misc-gpio", | ||
140 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
141 | + .instance_size = sizeof(TosaMiscGPIOState), | ||
142 | + .instance_init = tosa_misc_gpio_init, | ||
143 | + /* | ||
144 | + * No class init required: device has no internal state so does not | ||
145 | + * need to set up reset or vmstate, and has no realize method. | ||
146 | + */ | ||
147 | +}; | ||
148 | + | ||
149 | static void tosa_register_types(void) | ||
150 | { | ||
151 | type_register_static(&tosa_dac_info); | ||
152 | type_register_static(&tosa_ssp_info); | ||
153 | + type_register_static(&tosa_misc_gpio_info); | ||
154 | } | ||
155 | |||
156 | type_init(tosa_register_types) | ||
157 | -- | 131 | -- |
158 | 2.20.1 | 132 | 2.34.1 |
159 | 133 | ||
160 | 134 | diff view generated by jsdifflib |
1 | Remove hard-tabs from palm.c. | 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. | ||
5 | |||
6 | Create a new command line argument -one-insn-per-tb, so we can | ||
7 | document that -singlestep is just a deprecated synonym for it, | ||
8 | and eventually perhaps drop it. | ||
2 | 9 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Li Qiang <liq3ea@gmail.com> | 11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 12 | Reviewed-by: Warner Losh <imp@bsdimp.com> |
6 | Message-id: 20200628214230.2592-2-peter.maydell@linaro.org | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
14 | Message-id: 20230417164041.684562-5-peter.maydell@linaro.org | ||
7 | --- | 15 | --- |
8 | hw/arm/palm.c | 64 +++++++++++++++++++++++++-------------------------- | 16 | docs/user/main.rst | 7 ++++++- |
9 | 1 file changed, 32 insertions(+), 32 deletions(-) | 17 | linux-user/main.c | 9 ++++++--- |
18 | 2 files changed, 12 insertions(+), 4 deletions(-) | ||
10 | 19 | ||
11 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | 20 | diff --git a/docs/user/main.rst b/docs/user/main.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/palm.c | 22 | --- a/docs/user/main.rst |
14 | +++ b/hw/arm/palm.c | 23 | +++ b/docs/user/main.rst |
15 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps static_ops = { | 24 | @@ -XXX,XX +XXX,XX @@ Debug options: |
16 | /* Palm Tunsgten|E support */ | 25 | ``-g port`` |
17 | 26 | Wait gdb connection to port | |
18 | /* Shared GPIOs */ | 27 | |
19 | -#define PALMTE_USBDETECT_GPIO 0 | 28 | +``-one-insn-per-tb`` |
20 | -#define PALMTE_USB_OR_DC_GPIO 1 | 29 | + Run the emulation with one guest instruction per translation block. |
21 | -#define PALMTE_TSC_GPIO 4 | 30 | + This slows down emulation a lot, but can be useful in some situations, |
22 | -#define PALMTE_PINTDAV_GPIO 6 | 31 | + such as when trying to analyse the logs produced by the ``-d`` option. |
23 | -#define PALMTE_MMC_WP_GPIO 8 | 32 | + |
24 | -#define PALMTE_MMC_POWER_GPIO 9 | 33 | ``-singlestep`` |
25 | -#define PALMTE_HDQ_GPIO 11 | 34 | - Run the emulation in single step mode. |
26 | -#define PALMTE_HEADPHONES_GPIO 14 | 35 | + This is a deprecated synonym for the ``-one-insn-per-tb`` option. |
27 | -#define PALMTE_SPEAKER_GPIO 15 | 36 | |
28 | +#define PALMTE_USBDETECT_GPIO 0 | 37 | Environment variables: |
29 | +#define PALMTE_USB_OR_DC_GPIO 1 | 38 | |
30 | +#define PALMTE_TSC_GPIO 4 | 39 | diff --git a/linux-user/main.c b/linux-user/main.c |
31 | +#define PALMTE_PINTDAV_GPIO 6 | 40 | index XXXXXXX..XXXXXXX 100644 |
32 | +#define PALMTE_MMC_WP_GPIO 8 | 41 | --- a/linux-user/main.c |
33 | +#define PALMTE_MMC_POWER_GPIO 9 | 42 | +++ b/linux-user/main.c |
34 | +#define PALMTE_HDQ_GPIO 11 | 43 | @@ -XXX,XX +XXX,XX @@ static void handle_arg_reserved_va(const char *arg) |
35 | +#define PALMTE_HEADPHONES_GPIO 14 | 44 | reserved_va = val ? val - 1 : 0; |
36 | +#define PALMTE_SPEAKER_GPIO 15 | 45 | } |
37 | /* MPU private GPIOs */ | 46 | |
38 | -#define PALMTE_DC_GPIO 2 | 47 | -static void handle_arg_singlestep(const char *arg) |
39 | -#define PALMTE_MMC_SWITCH_GPIO 4 | 48 | +static void handle_arg_one_insn_per_tb(const char *arg) |
40 | -#define PALMTE_MMC1_GPIO 6 | 49 | { |
41 | -#define PALMTE_MMC2_GPIO 7 | 50 | opt_one_insn_per_tb = true; |
42 | -#define PALMTE_MMC3_GPIO 11 | 51 | } |
43 | +#define PALMTE_DC_GPIO 2 | 52 | @@ -XXX,XX +XXX,XX @@ static const struct qemu_argument arg_table[] = { |
44 | +#define PALMTE_MMC_SWITCH_GPIO 4 | 53 | "logfile", "write logs to 'logfile' (default stderr)"}, |
45 | +#define PALMTE_MMC1_GPIO 6 | 54 | {"p", "QEMU_PAGESIZE", true, handle_arg_pagesize, |
46 | +#define PALMTE_MMC2_GPIO 7 | 55 | "pagesize", "set the host page size to 'pagesize'"}, |
47 | +#define PALMTE_MMC3_GPIO 11 | 56 | - {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep, |
48 | 57 | - "", "run in singlestep mode"}, | |
49 | static MouseTransformInfo palmte_pointercal = { | 58 | + {"one-insn-per-tb", |
50 | .x = 320, | 59 | + "QEMU_ONE_INSN_PER_TB", false, handle_arg_one_insn_per_tb, |
51 | @@ -XXX,XX +XXX,XX @@ static struct { | 60 | + "", "run with one guest instruction per emulated TB"}, |
52 | int column; | 61 | + {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_one_insn_per_tb, |
53 | } palmte_keymap[0x80] = { | 62 | + "", "deprecated synonym for -one-insn-per-tb"}, |
54 | [0 ... 0x7f] = { -1, -1 }, | 63 | {"strace", "QEMU_STRACE", false, handle_arg_strace, |
55 | - [0x3b] = { 0, 0 }, /* F1 -> Calendar */ | 64 | "", "log system calls"}, |
56 | - [0x3c] = { 1, 0 }, /* F2 -> Contacts */ | 65 | {"seed", "QEMU_RAND_SEED", true, handle_arg_seed, |
57 | - [0x3d] = { 2, 0 }, /* F3 -> Tasks List */ | ||
58 | - [0x3e] = { 3, 0 }, /* F4 -> Note Pad */ | ||
59 | - [0x01] = { 4, 0 }, /* Esc -> Power */ | ||
60 | - [0x4b] = { 0, 1 }, /* Left */ | ||
61 | - [0x50] = { 1, 1 }, /* Down */ | ||
62 | - [0x48] = { 2, 1 }, /* Up */ | ||
63 | - [0x4d] = { 3, 1 }, /* Right */ | ||
64 | - [0x4c] = { 4, 1 }, /* Centre */ | ||
65 | - [0x39] = { 4, 1 }, /* Spc -> Centre */ | ||
66 | + [0x3b] = { 0, 0 }, /* F1 -> Calendar */ | ||
67 | + [0x3c] = { 1, 0 }, /* F2 -> Contacts */ | ||
68 | + [0x3d] = { 2, 0 }, /* F3 -> Tasks List */ | ||
69 | + [0x3e] = { 3, 0 }, /* F4 -> Note Pad */ | ||
70 | + [0x01] = { 4, 0 }, /* Esc -> Power */ | ||
71 | + [0x4b] = { 0, 1 }, /* Left */ | ||
72 | + [0x50] = { 1, 1 }, /* Down */ | ||
73 | + [0x48] = { 2, 1 }, /* Up */ | ||
74 | + [0x4d] = { 3, 1 }, /* Right */ | ||
75 | + [0x4c] = { 4, 1 }, /* Centre */ | ||
76 | + [0x39] = { 4, 1 }, /* Spc -> Centre */ | ||
77 | }; | ||
78 | |||
79 | static void palmte_button_event(void *opaque, int keycode) | ||
80 | @@ -XXX,XX +XXX,XX @@ static void palmte_gpio_setup(struct omap_mpu_state_s *cpu) | ||
81 | [PALMTE_MMC_SWITCH_GPIO])); | ||
82 | |||
83 | misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7); | ||
84 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); | ||
85 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); | ||
86 | - qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]); | ||
87 | - qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]); | ||
88 | - qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]); | ||
89 | - omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); | ||
90 | - omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); | ||
91 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); | ||
92 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); | ||
93 | + qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]); | ||
94 | + qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]); | ||
95 | + qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]); | ||
96 | + omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); | ||
97 | + omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); | ||
98 | |||
99 | /* Reset some inputs to initial state. */ | ||
100 | qemu_irq_lower(qdev_get_gpio_in(cpu->gpio, PALMTE_USBDETECT_GPIO)); | ||
101 | -- | 66 | -- |
102 | 2.20.1 | 67 | 2.34.1 |
103 | 68 | ||
104 | 69 | diff view generated by jsdifflib |
1 | Remove the hardcoded tabs from hw/arm/tosa.c. There aren't | 1 | The '-singlestep' option is confusing, because it doesn't actually |
---|---|---|---|
2 | many, but since they're all in constant #defines they're not | 2 | have anything to do with single-stepping the CPU. What it does do |
3 | going to go away with our usual "only when we touch a function" | 3 | is force TCG emulation to put one guest instruction in each TB, |
4 | policy on reformatting. | 4 | which can be useful in some situations. |
5 | |||
6 | Create a new command line argument -one-insn-per-tb, so we can | ||
7 | document that -singlestep is just a deprecated synonym for it, | ||
8 | and eventually perhaps drop it. | ||
5 | 9 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 11 | Reviewed-by: Warner Losh <imp@bsdimp.com> |
8 | Message-id: 20200628203748.14250-2-peter.maydell@linaro.org | 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 | ||
9 | --- | 15 | --- |
10 | hw/arm/tosa.c | 44 ++++++++++++++++++++++---------------------- | 16 | docs/user/main.rst | 7 ++++++- |
11 | 1 file changed, 22 insertions(+), 22 deletions(-) | 17 | bsd-user/main.c | 5 +++-- |
18 | 2 files changed, 9 insertions(+), 3 deletions(-) | ||
12 | 19 | ||
13 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | 20 | diff --git a/docs/user/main.rst b/docs/user/main.rst |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/tosa.c | 22 | --- a/docs/user/main.rst |
16 | +++ b/hw/arm/tosa.c | 23 | +++ b/docs/user/main.rst |
17 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ Debug options: |
18 | #include "hw/sysbus.h" | 25 | ``-p pagesize`` |
19 | #include "exec/address-spaces.h" | 26 | Act as if the host page size was 'pagesize' bytes |
20 | 27 | ||
21 | -#define TOSA_RAM 0x04000000 | 28 | +``-one-insn-per-tb`` |
22 | -#define TOSA_ROM 0x00800000 | 29 | + Run the emulation with one guest instruction per translation block. |
23 | +#define TOSA_RAM 0x04000000 | 30 | + This slows down emulation a lot, but can be useful in some situations, |
24 | +#define TOSA_ROM 0x00800000 | 31 | + such as when trying to analyse the logs produced by the ``-d`` option. |
25 | 32 | + | |
26 | -#define TOSA_GPIO_USB_IN (5) | 33 | ``-singlestep`` |
27 | -#define TOSA_GPIO_nSD_DETECT (9) | 34 | - Run the emulation in single step mode. |
28 | -#define TOSA_GPIO_ON_RESET (19) | 35 | + This is a deprecated synonym for the ``-one-insn-per-tb`` option. |
29 | -#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ | 36 | diff --git a/bsd-user/main.c b/bsd-user/main.c |
30 | -#define TOSA_GPIO_CF_CD (13) | 37 | index XXXXXXX..XXXXXXX 100644 |
31 | -#define TOSA_GPIO_TC6393XB_INT (15) | 38 | --- a/bsd-user/main.c |
32 | -#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ | 39 | +++ b/bsd-user/main.c |
33 | +#define TOSA_GPIO_USB_IN (5) | 40 | @@ -XXX,XX +XXX,XX @@ static void usage(void) |
34 | +#define TOSA_GPIO_nSD_DETECT (9) | 41 | "-d item1[,...] enable logging of specified items\n" |
35 | +#define TOSA_GPIO_ON_RESET (19) | 42 | " (use '-d help' for a list of log items)\n" |
36 | +#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ | 43 | "-D logfile write logs to 'logfile' (default stderr)\n" |
37 | +#define TOSA_GPIO_CF_CD (13) | 44 | - "-singlestep always run in singlestep mode\n" |
38 | +#define TOSA_GPIO_TC6393XB_INT (15) | 45 | + "-one-insn-per-tb run with one guest instruction per emulated TB\n" |
39 | +#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ | 46 | + "-singlestep deprecated synonym for -one-insn-per-tb\n" |
40 | 47 | "-strace log system calls\n" | |
41 | -#define TOSA_SCOOP_GPIO_BASE 1 | 48 | "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n" |
42 | -#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) | 49 | " specify tracing options\n" |
43 | -#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3) | 50 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) |
44 | -#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4) | 51 | (void) envlist_unsetenv(envlist, "LD_PRELOAD"); |
45 | +#define TOSA_SCOOP_GPIO_BASE 1 | 52 | } else if (!strcmp(r, "seed")) { |
46 | +#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) | 53 | seed_optarg = optarg; |
47 | +#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3) | 54 | - } else if (!strcmp(r, "singlestep")) { |
48 | +#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4) | 55 | + } else if (!strcmp(r, "singlestep") || !strcmp(r, "one-insn-per-tb")) { |
49 | 56 | opt_one_insn_per_tb = true; | |
50 | -#define TOSA_SCOOP_JC_GPIO_BASE 1 | 57 | } else if (!strcmp(r, "strace")) { |
51 | -#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0) | 58 | do_strace = 1; |
52 | -#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) | ||
53 | -#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) | ||
54 | -#define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5) | ||
55 | -#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7) | ||
56 | +#define TOSA_SCOOP_JC_GPIO_BASE 1 | ||
57 | +#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0) | ||
58 | +#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) | ||
59 | +#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) | ||
60 | +#define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5) | ||
61 | +#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7) | ||
62 | |||
63 | -#define DAC_BASE 0x4e | ||
64 | -#define DAC_CH1 0 | ||
65 | -#define DAC_CH2 1 | ||
66 | +#define DAC_BASE 0x4e | ||
67 | +#define DAC_CH1 0 | ||
68 | +#define DAC_CH2 1 | ||
69 | |||
70 | static void tosa_microdrive_attach(PXA2xxState *cpu) | ||
71 | { | ||
72 | -- | 59 | -- |
73 | 2.20.1 | 60 | 2.34.1 |
74 | 61 | ||
75 | 62 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | Document that the -singlestep command line option is now |
---|---|---|---|
2 | deprecated, as it is replaced by either the TCG accelerator | ||
3 | property 'one-insn-per-tb' for system emulation or the new | ||
4 | '-one-insn-per-tb' option for usermode emulation, and remove | ||
5 | the only use of the deprecated syntax from a README. | ||
2 | 6 | ||
3 | Coverity points out (CID 1430180) that the new case is missing | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | break or a /* fallthrough */ comment. Break is the right thing to | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | do as in that case, tail is not used. | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Message-id: 20230417164041.684562-7-peter.maydell@linaro.org | ||
11 | --- | ||
12 | docs/about/deprecated.rst | 16 ++++++++++++++++ | ||
13 | qemu-options.hx | 5 +++-- | ||
14 | tcg/tci/README | 2 +- | ||
15 | 3 files changed, 20 insertions(+), 3 deletions(-) | ||
6 | 16 | ||
7 | Fixes 1733eebb9e ("virtio-iommu: Implement RESV_MEM probe request") | 17 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
8 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Message-id: 20200708160147.18426-1-eric.auger@redhat.com | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/virtio/virtio-iommu.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/virtio/virtio-iommu.c | 19 | --- a/docs/about/deprecated.rst |
20 | +++ b/hw/virtio/virtio-iommu.c | 20 | +++ b/docs/about/deprecated.rst |
21 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) | 21 | @@ -XXX,XX +XXX,XX @@ Use ``-machine acpi=off`` instead. |
22 | ptail = (struct virtio_iommu_req_tail *) | 22 | The HAXM project has been retired (see https://github.com/intel/haxm#status). |
23 | (buf + s->config.probe_size); | 23 | Use "whpx" (on Windows) or "hvf" (on macOS) instead. |
24 | ptail->status = virtio_iommu_handle_probe(s, iov, iov_cnt, buf); | 24 | |
25 | + break; | 25 | +``-singlestep`` (since 8.1) |
26 | } | 26 | +''''''''''''''''''''''''''' |
27 | default: | 27 | + |
28 | tail.status = VIRTIO_IOMMU_S_UNSUPP; | 28 | +The ``-singlestep`` option has been turned into an accelerator property, |
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 | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/qemu-options.hx | ||
47 | +++ b/qemu-options.hx | ||
48 | @@ -XXX,XX +XXX,XX @@ SRST | ||
49 | ERST | ||
50 | |||
51 | DEF("singlestep", 0, QEMU_OPTION_singlestep, \ | ||
52 | - "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL) | ||
53 | + "-singlestep deprecated synonym for -accel tcg,one-insn-per-tb=on\n", QEMU_ARCH_ALL) | ||
54 | SRST | ||
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 | ||
29 | -- | 75 | -- |
30 | 2.20.1 | 76 | 2.34.1 |
31 | 77 | ||
32 | 78 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | Currently we report whether the TCG accelerator is in |
---|---|---|---|
2 | 'one-insn-per-tb' mode in the 'info status' output. This is a pretty | ||
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'. | ||
2 | 6 | ||
3 | Regularize our handling of <sys/signal.h>: currently we include it in | 7 | We don't need a deprecate-and-drop period for this because the |
4 | osdep.h, but only for OpenBSD, and we include it without an ifdef | 8 | HMP interface has no stability guarantees. |
5 | guard in a couple of C files. This causes problems for Haiku, which | ||
6 | doesn't have that header. | ||
7 | 9 | ||
8 | Instead, check in configure whether sys/signal.h exists, and if it | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | does then always include it from osdep.h. | 11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
13 | Message-id: 20230417164041.684562-8-peter.maydell@linaro.org | ||
14 | --- | ||
15 | accel/tcg/monitor.c | 14 ++++++++++++++ | ||
16 | softmmu/runstate-hmp-cmds.c | 5 ++--- | ||
17 | 2 files changed, 16 insertions(+), 3 deletions(-) | ||
10 | 18 | ||
11 | Signed-off-by: David Carlier <devnexen@gmail.com> | 19 | diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c |
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Message-id: 20200703145614.16684-5-peter.maydell@linaro.org | ||
17 | [PMM: Expanded commit message; rename to HAVE_SYS_SIGNAL_H] | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | configure | 10 ++++++++++ | ||
22 | include/qemu/osdep.h | 2 +- | ||
23 | hw/xen/xen-legacy-backend.c | 1 - | ||
24 | util/oslib-posix.c | 1 - | ||
25 | 4 files changed, 11 insertions(+), 3 deletions(-) | ||
26 | |||
27 | diff --git a/configure b/configure | ||
28 | index XXXXXXX..XXXXXXX 100755 | ||
29 | --- a/configure | ||
30 | +++ b/configure | ||
31 | @@ -XXX,XX +XXX,XX @@ if check_include "libdrm/drm.h" ; then | ||
32 | have_drm_h=yes | ||
33 | fi | ||
34 | |||
35 | +######################################### | ||
36 | +# sys/signal.h check | ||
37 | +have_sys_signal_h=no | ||
38 | +if check_include "sys/signal.h" ; then | ||
39 | + have_sys_signal_h=yes | ||
40 | +fi | ||
41 | + | ||
42 | ########################################## | ||
43 | # VTE probe | ||
44 | |||
45 | @@ -XXX,XX +XXX,XX @@ fi | ||
46 | if test "$have_openpty" = "yes" ; then | ||
47 | echo "HAVE_OPENPTY=y" >> $config_host_mak | ||
48 | fi | ||
49 | +if test "$have_sys_signal_h" = "yes" ; then | ||
50 | + echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak | ||
51 | +fi | ||
52 | |||
53 | # Work around a system header bug with some kernel/XFS header | ||
54 | # versions where they both try to define 'struct fsxattr': | ||
55 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
56 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/include/qemu/osdep.h | 21 | --- a/accel/tcg/monitor.c |
58 | +++ b/include/qemu/osdep.h | 22 | +++ b/accel/tcg/monitor.c |
59 | @@ -XXX,XX +XXX,XX @@ extern int daemon(int, int); | ||
60 | #include <setjmp.h> | ||
61 | #include <signal.h> | ||
62 | |||
63 | -#ifdef __OpenBSD__ | ||
64 | +#ifdef HAVE_SYS_SIGNAL_H | ||
65 | #include <sys/signal.h> | ||
66 | #endif | ||
67 | |||
68 | diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/hw/xen/xen-legacy-backend.c | ||
71 | +++ b/hw/xen/xen-legacy-backend.c | ||
72 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ |
73 | */ | 24 | */ |
74 | 25 | ||
75 | #include "qemu/osdep.h" | 26 | #include "qemu/osdep.h" |
76 | -#include <sys/signal.h> | 27 | +#include "qemu/accel.h" |
77 | 28 | #include "qapi/error.h" | |
78 | #include "hw/sysbus.h" | 29 | #include "qapi/type-helpers.h" |
79 | #include "hw/boards.h" | 30 | #include "qapi/qapi-commands-machine.h" |
80 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 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 | ||
81 | index XXXXXXX..XXXXXXX 100644 | 59 | index XXXXXXX..XXXXXXX 100644 |
82 | --- a/util/oslib-posix.c | 60 | --- a/softmmu/runstate-hmp-cmds.c |
83 | +++ b/util/oslib-posix.c | 61 | +++ b/softmmu/runstate-hmp-cmds.c |
84 | @@ -XXX,XX +XXX,XX @@ | 62 | @@ -XXX,XX +XXX,XX @@ void hmp_info_status(Monitor *mon, const QDict *qdict) |
85 | #include "qemu/sockets.h" | 63 | |
86 | #include "qemu/thread.h" | 64 | info = qmp_query_status(NULL); |
87 | #include <libgen.h> | 65 | |
88 | -#include <sys/signal.h> | 66 | - monitor_printf(mon, "VM status: %s%s", |
89 | #include "qemu/cutils.h" | 67 | - info->running ? "running" : "paused", |
90 | 68 | - info->singlestep ? " (single step mode)" : ""); | |
91 | #ifdef CONFIG_LINUX | 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)); | ||
92 | -- | 74 | -- |
93 | 2.20.1 | 75 | 2.34.1 |
94 | 76 | ||
95 | 77 | diff view generated by jsdifflib |
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | 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 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | 6 | Create a new HMP command 'one-insn-per-tb', so we can document that |
4 | Message-id: c850187322be9930e47c8b234c385a7d0da245cb.1593806826.git.jcd@tribudubois.net | 7 | 'singlestep' is just a deprecated synonym for it, and eventually |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | perhaps drop it. |
6 | [PMM: updated for object_property_set_uint() argument reordering] | 9 | |
10 | We aren't obliged to do deprecate-and-drop for HMP commands, | ||
11 | but it's easy enough to do so, so we do. | ||
12 | |||
7 | 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 | ||
8 | --- | 18 | --- |
9 | include/hw/arm/fsl-imx7.h | 1 + | 19 | docs/about/deprecated.rst | 9 +++++++++ |
10 | hw/arm/fsl-imx7.c | 9 +++++++++ | 20 | include/monitor/hmp.h | 2 +- |
11 | 2 files changed, 10 insertions(+) | 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(-) | ||
12 | 25 | ||
13 | diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h | 26 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
14 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/fsl-imx7.h | 28 | --- a/docs/about/deprecated.rst |
16 | +++ b/include/hw/arm/fsl-imx7.h | 29 | +++ b/docs/about/deprecated.rst |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX7State { | 30 | @@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that |
18 | IMX7GPRState gpr; | 31 | all arguments passed to ``device_add`` are consistent with the documented |
19 | ChipideaState usb[FSL_IMX7_NUM_USBS]; | 32 | property types. |
20 | DesignwarePCIEHost pcie; | 33 | |
21 | + uint32_t phy_num[FSL_IMX7_NUM_ETHS]; | 34 | +Human Monitor Protocol (HMP) commands |
22 | } FslIMX7State; | 35 | +------------------------------------- |
23 | 36 | + | |
24 | enum FslIMX7MemoryMap { | 37 | +``singlestep`` (since 8.1) |
25 | diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c | 38 | +'''''''''''''''''''''''''' |
39 | + | ||
40 | +The ``singlestep`` command has been replaced by the ``one-insn-per-tb`` | ||
41 | +command, which has the same behaviour but a less misleading name. | ||
42 | + | ||
43 | Host Architectures | ||
44 | ------------------ | ||
45 | |||
46 | diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/hw/arm/fsl-imx7.c | 48 | --- a/include/monitor/hmp.h |
28 | +++ b/hw/arm/fsl-imx7.c | 49 | +++ b/include/monitor/hmp.h |
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | 50 | @@ -XXX,XX +XXX,XX @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict); |
30 | FSL_IMX7_ENET2_ADDR, | 51 | void hmp_human_readable_text_helper(Monitor *mon, |
31 | }; | 52 | HumanReadableText *(*qmp_handler)(Error **)); |
32 | 53 | void hmp_info_stats(Monitor *mon, const QDict *qdict); | |
33 | + object_property_set_uint(OBJECT(&s->eth[i]), "phy-num", | 54 | -void hmp_singlestep(Monitor *mon, const QDict *qdict); |
34 | + s->phy_num[i], &error_abort); | 55 | +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict); |
35 | object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", | 56 | void hmp_watchdog_action(Monitor *mon, const QDict *qdict); |
36 | FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort); | 57 | void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict); |
37 | qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); | 58 | void hmp_info_capture(Monitor *mon, const QDict *qdict); |
38 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | 59 | diff --git a/softmmu/runstate-hmp-cmds.c b/softmmu/runstate-hmp-cmds.c |
39 | FSL_IMX7_PCIE_PHY_SIZE); | 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); | ||
40 | } | 65 | } |
41 | 66 | ||
42 | +static Property fsl_imx7_properties[] = { | 67 | -void hmp_singlestep(Monitor *mon, const QDict *qdict) |
43 | + DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0), | 68 | +void hmp_one_insn_per_tb(Monitor *mon, const QDict *qdict) |
44 | + DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1), | 69 | { |
45 | + DEFINE_PROP_END_OF_LIST(), | 70 | const char *option = qdict_get_try_str(qdict, "option"); |
46 | +}; | 71 | AccelState *accel = current_accel(); |
72 | diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/tests/qtest/test-hmp.c | ||
75 | +++ b/tests/qtest/test-hmp.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static const char *hmp_cmds[] = { | ||
77 | "o /w 0 0x1234", | ||
78 | "object_add memory-backend-ram,id=mem1,size=256M", | ||
79 | "object_del mem1", | ||
80 | + "one-insn-per-tb on", | ||
81 | "pmemsave 0 4096 \"/dev/null\"", | ||
82 | "p $pc + 8", | ||
83 | "qom-list /", | ||
84 | diff --git a/hmp-commands.hx b/hmp-commands.hx | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hmp-commands.hx | ||
87 | +++ b/hmp-commands.hx | ||
88 | @@ -XXX,XX +XXX,XX @@ SRST | ||
89 | only *tag* as parameter. | ||
90 | ERST | ||
91 | |||
92 | + { | ||
93 | + .name = "one-insn-per-tb", | ||
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 | + }, | ||
47 | + | 99 | + |
48 | static void fsl_imx7_class_init(ObjectClass *oc, void *data) | 100 | +SRST |
49 | { | 101 | +``one-insn-per-tb [off]`` |
50 | DeviceClass *dc = DEVICE_CLASS(oc); | 102 | + Run the emulation with one guest instruction per translation block. |
51 | 103 | + This slows down emulation a lot, but can be useful in some situations, | |
52 | + device_class_set_props(dc, fsl_imx7_properties); | 104 | + such as when trying to analyse the logs produced by the ``-d`` option. |
53 | dc->realize = fsl_imx7_realize; | 105 | + This only has an effect when using TCG, not with KVM or other accelerators. |
54 | 106 | + | |
55 | /* Reason: Uses serial_hds and nd_table in realize() directly */ | 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 | { | ||
56 | -- | 128 | -- |
57 | 2.20.1 | 129 | 2.34.1 |
58 | 130 | ||
59 | 131 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The run-state.json file is missing a trailing newline; add it. |
---|---|---|---|
2 | 2 | ||
3 | The mtedesc that was constructed was not actually passed in. | ||
4 | Found by Coverity (CID 1429996). | ||
5 | |||
6 | Fixes: d28d12f008e | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20200706202345.193676-1-richard.henderson@linaro.org | ||
10 | 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 | ||
11 | --- | 7 | --- |
12 | target/arm/translate-sve.c | 2 +- | 8 | qapi/run-state.json | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 10 | ||
15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | 11 | diff --git a/qapi/run-state.json b/qapi/run-state.json |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate-sve.c | 13 | --- a/qapi/run-state.json |
18 | +++ b/target/arm/translate-sve.c | 14 | +++ b/qapi/run-state.json |
19 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, | 15 | @@ -XXX,XX +XXX,XX @@ |
20 | desc = FIELD_DP32(desc, MTEDESC, ESIZE, 1 << msz); | 16 | # Since: 7.2 |
21 | desc <<= SVE_MTEDESC_SHIFT; | 17 | ## |
22 | } | 18 | { 'enum': 'NotifyVmexitOption', |
23 | - desc = simd_desc(vsz, vsz, scale); | 19 | - 'data': [ 'run', 'internal-error', 'disable' ] } |
24 | + desc = simd_desc(vsz, vsz, desc | scale); | 20 | \ No newline at end of file |
25 | t_desc = tcg_const_i32(desc); | 21 | + 'data': [ 'run', 'internal-error', 'disable' ] } |
26 | |||
27 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); | ||
28 | -- | 22 | -- |
29 | 2.20.1 | 23 | 2.34.1 |
30 | 24 | ||
31 | 25 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The 'singlestep' member of StatusInfo has never done what the QMP |
---|---|---|---|
2 | documentation claims it does. What it actually reports is whether | ||
3 | TCG is working in "one guest instruction per translation block" mode. | ||
2 | 4 | ||
3 | The 'cpu_type' has been moved from BCM283XState to BCM283XClass | 5 | We no longer need this field for the HMP 'info status' command, as |
4 | in commit 210f47840d, but we forgot to remove the old variable. | 6 | we've moved that information to 'info jit'. It seems unlikely that |
5 | Do it now. | 7 | anybody is monitoring the state of this obscure TCG setting via QMP, |
8 | especially since QMP provides no means for changing the setting. So | ||
9 | simply deprecate the field, without providing any replacement. | ||
6 | 10 | ||
7 | Fixes: 210f47840d ("hw/arm/bcm2836: Hardcode correct CPU type") | 11 | Until we do eventually delete the member, correct the misstatements |
8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 12 | in the QAPI documentation about it. |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 13 | |
10 | Message-id: 20200703200459.23294-1-f4bug@amsat.org | 14 | If we do find that there are users for this, then the most likely way |
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. | ||
19 | |||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@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 | ||
12 | --- | 25 | --- |
13 | include/hw/arm/bcm2836.h | 1 - | 26 | docs/about/deprecated.rst | 14 ++++++++++++++ |
14 | 1 file changed, 1 deletion(-) | 27 | qapi/run-state.json | 14 +++++++++++--- |
28 | 2 files changed, 25 insertions(+), 3 deletions(-) | ||
15 | 29 | ||
16 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | 30 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/bcm2836.h | 32 | --- a/docs/about/deprecated.rst |
19 | +++ b/include/hw/arm/bcm2836.h | 33 | +++ b/docs/about/deprecated.rst |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct BCM283XState { | 34 | @@ -XXX,XX +XXX,XX @@ accepted incorrect commands will return an error. Users should make sure that |
21 | DeviceState parent_obj; | 35 | all arguments passed to ``device_add`` are consistent with the documented |
22 | /*< public >*/ | 36 | property types. |
23 | 37 | ||
24 | - char *cpu_type; | 38 | +``StatusInfo`` member ``singlestep`` (since 8.1) |
25 | uint32_t enabled_cpus; | 39 | +'''''''''''''''''''''''''''''''''''''''''''''''' |
26 | 40 | + | |
27 | struct { | 41 | +The ``singlestep`` member of the ``StatusInfo`` returned from the |
42 | +``query-status`` command is deprecated. This member has a confusing | ||
43 | +name and it never did what the documentation claimed or what its name | ||
44 | +suggests. We do not believe that anybody is actually using the | ||
45 | +information provided in this member. | ||
46 | + | ||
47 | +The information it reports is whether the TCG JIT is in "one | ||
48 | +instruction per translated block" mode (which can be set on the | ||
49 | +command line or via the HMP, but not via QMP). The information remains | ||
50 | +available via the HMP 'info jit' command. | ||
51 | + | ||
52 | Human Monitor Protocol (HMP) commands | ||
53 | ------------------------------------- | ||
54 | |||
55 | diff --git a/qapi/run-state.json b/qapi/run-state.json | ||
56 | index XXXXXXX..XXXXXXX 100644 | ||
57 | --- a/qapi/run-state.json | ||
58 | +++ b/qapi/run-state.json | ||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | # | ||
61 | # @running: true if all VCPUs are runnable, false if not runnable | ||
62 | # | ||
63 | -# @singlestep: true if VCPUs are in single-step mode | ||
64 | +# @singlestep: true if using TCG with one guest instruction | ||
65 | +# per translation block | ||
66 | # | ||
67 | # @status: the virtual machine @RunState | ||
68 | # | ||
69 | +# Features: | ||
70 | +# @deprecated: Member 'singlestep' is deprecated (with no replacement). | ||
71 | +# | ||
72 | # Since: 0.14 | ||
73 | # | ||
74 | -# Notes: @singlestep is enabled through the GDB stub | ||
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: | ||
28 | -- | 87 | -- |
29 | 2.20.1 | 88 | 2.34.1 |
30 | 89 | ||
31 | 90 | diff view generated by jsdifflib |
1 | From: Aaron Lindsay <aaron@os.amperecomputing.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 | Raw writes to this register when in KVM mode can cause interrupts to be | 5 | This deprecation note first appeared in the 7.1 release, so |
4 | raised (even when the PMU is disabled). Because the underlying state is | 6 | retrospectively add the correct "since 7.1" annotation to it. |
5 | already aliased to PMINTENSET (which already provides raw write | ||
6 | functions), we can safely disable raw accesses to PMINTENCLR entirely. | ||
7 | 7 | ||
8 | Signed-off-by: Aaron Lindsay <aaron@os.amperecomputing.com> | ||
9 | Message-id: 20200707152616.1917154-1-aaron@os.amperecomputing.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
11 | Message-id: 20230420122256.1023709-1-peter.maydell@linaro.org | ||
12 | --- | 12 | --- |
13 | target/arm/helper.c | 4 ++-- | 13 | docs/about/deprecated.rst | 4 ++-- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 14 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 15 | ||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 16 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper.c | 18 | --- a/docs/about/deprecated.rst |
19 | +++ b/target/arm/helper.c | 19 | +++ b/docs/about/deprecated.rst |
20 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | 20 | @@ -XXX,XX +XXX,XX @@ Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead. |
21 | .resetvalue = 0x0 }, | 21 | System emulator machines |
22 | { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, | 22 | ------------------------ |
23 | .access = PL1_RW, .accessfn = access_tpm, | 23 | |
24 | - .type = ARM_CP_ALIAS | ARM_CP_IO, | 24 | -Arm ``virt`` machine ``dtb-kaslr-seed`` property |
25 | + .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | 25 | -'''''''''''''''''''''''''''''''''''''''''''''''' |
26 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | 26 | +Arm ``virt`` machine ``dtb-kaslr-seed`` property (since 7.1) |
27 | .writefn = pmintenclr_write, }, | 27 | +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
28 | { .name = "PMINTENCLR_EL1", .state = ARM_CP_STATE_AA64, | 28 | |
29 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 2, | 29 | The ``dtb-kaslr-seed`` property on the ``virt`` board has been |
30 | .access = PL1_RW, .accessfn = access_tpm, | 30 | deprecated; use the new name ``dtb-randomness`` instead. The new name |
31 | - .type = ARM_CP_ALIAS | ARM_CP_IO, | ||
32 | + .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | ||
33 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | ||
34 | .writefn = pmintenclr_write }, | ||
35 | { .name = "CCSIDR", .state = ARM_CP_STATE_BOTH, | ||
36 | -- | 31 | -- |
37 | 2.20.1 | 32 | 2.34.1 |
38 | 33 | ||
39 | 34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
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. | ||
1 | 4 | ||
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. | ||
12 | |||
13 | The effect of this is that on a big-endian host networking doesn't | ||
14 | work because the address of the next descriptor is corrupted. | ||
15 | |||
16 | We could fix this by making the callsite avoid using the struct; but | ||
17 | it's more robust to have emac_store_desc() leave its input alone. | ||
18 | |||
19 | (emac_load_desc() also does an in-place conversion, but here this is | ||
20 | fine, because the function is supposed to be initializing the | ||
21 | struct.) | ||
22 | |||
23 | Cc: qemu-stable@nongnu.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 | ||
27 | --- | ||
28 | hw/net/msf2-emac.c | 16 ++++++++++------ | ||
29 | 1 file changed, 10 insertions(+), 6 deletions(-) | ||
30 | |||
31 | diff --git a/hw/net/msf2-emac.c b/hw/net/msf2-emac.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/net/msf2-emac.c | ||
34 | +++ b/hw/net/msf2-emac.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static void emac_load_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc) | ||
36 | d->next = le32_to_cpu(d->next); | ||
37 | } | ||
38 | |||
39 | -static void emac_store_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc) | ||
40 | +static void emac_store_desc(MSF2EmacState *s, const EmacDesc *d, hwaddr desc) | ||
41 | { | ||
42 | - /* Convert from host endianness into LE. */ | ||
43 | - d->pktaddr = cpu_to_le32(d->pktaddr); | ||
44 | - d->pktsize = cpu_to_le32(d->pktsize); | ||
45 | - d->next = cpu_to_le32(d->next); | ||
46 | + EmacDesc outd; | ||
47 | + /* | ||
48 | + * Convert from host endianness into LE. We use a local struct because | ||
49 | + * calling code may still want to look at the fields afterwards. | ||
50 | + */ | ||
51 | + outd.pktaddr = cpu_to_le32(d->pktaddr); | ||
52 | + outd.pktsize = cpu_to_le32(d->pktsize); | ||
53 | + outd.next = cpu_to_le32(d->next); | ||
54 | |||
55 | - address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, d, sizeof *d); | ||
56 | + address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, &outd, sizeof outd); | ||
57 | } | ||
58 | |||
59 | static void msf2_dma_tx(MSF2EmacState *s) | ||
60 | -- | ||
61 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | 1 | From: Cédric Le Goater <clg@kaod.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | 3 | The arm boot.c code includes a utility function write_bootloader() |
4 | Message-id: 9f8923ecd974160ae8f634c275b1100c2cbe66d7.1593806826.git.jcd@tribudubois.net | 4 | which assists in writing a boot-code fragment into guest memory, |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | including handling endianness and fixing it up with entry point |
6 | [PMM: updated for object_property_set_uint() argument reordering] | 6 | addresses and similar things. This is useful not just for the boot.c |
7 | code but also in board model code, so rename it to | ||
8 | arm_write_bootloader() and make it globally visible. | ||
9 | |||
10 | Since we are making it public, make its API a little neater: move the | ||
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. | ||
14 | |||
15 | Cc: qemu-stable@nongnu.org | ||
16 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
17 | Tested-by: Cédric Le Goater <clg@kaod.org> | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | Message-id: 20230424152717.1333930-2-peter.maydell@linaro.org | ||
21 | [PMM: Split out from another patch by Cédric, added doc comment] | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 23 | --- |
9 | include/hw/arm/fsl-imx25.h | 1 + | 24 | include/hw/arm/boot.h | 49 +++++++++++++++++++++++++++++++++++++++++++ |
10 | hw/arm/fsl-imx25.c | 7 +++++++ | 25 | hw/arm/boot.c | 35 +++++++------------------------ |
11 | 2 files changed, 8 insertions(+) | 26 | 2 files changed, 57 insertions(+), 27 deletions(-) |
12 | 27 | ||
13 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h | 28 | diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h |
14 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/fsl-imx25.h | 30 | --- a/include/hw/arm/boot.h |
16 | +++ b/include/hw/arm/fsl-imx25.h | 31 | +++ b/include/hw/arm/boot.h |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State { | 32 | @@ -XXX,XX +XXX,XX @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, |
18 | MemoryRegion rom[2]; | 33 | const struct arm_boot_info *info, |
19 | MemoryRegion iram; | 34 | hwaddr mvbar_addr); |
20 | MemoryRegion iram_alias; | 35 | |
21 | + uint32_t phy_num; | 36 | +typedef enum { |
22 | } FslIMX25State; | 37 | + FIXUP_NONE = 0, /* do nothing */ |
23 | 38 | + FIXUP_TERMINATOR, /* end of insns */ | |
24 | /** | 39 | + FIXUP_BOARDID, /* overwrite with board ID number */ |
25 | diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c | 40 | + FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */ |
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 | ||
26 | index XXXXXXX..XXXXXXX 100644 | 87 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/hw/arm/fsl-imx25.c | 88 | --- a/hw/arm/boot.c |
28 | +++ b/hw/arm/fsl-imx25.c | 89 | +++ b/hw/arm/boot.c |
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) | 90 | @@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, |
30 | epit_table[i].irq)); | 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; | ||
31 | } | 133 | } |
32 | 134 | ||
33 | + object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &err); | 135 | - write_bootloader("smpboot", info->smp_loader_start, |
34 | qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]); | 136 | - smpboot, fixupcontext, as); |
35 | 137 | + arm_write_bootloader("smpboot", as, info->smp_loader_start, | |
36 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) { | 138 | + smpboot, fixupcontext); |
37 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) | ||
38 | &s->iram_alias); | ||
39 | } | 139 | } |
40 | 140 | ||
41 | +static Property fsl_imx25_properties[] = { | 141 | void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, |
42 | + DEFINE_PROP_UINT32("fec-phy-num", FslIMX25State, phy_num, 0), | 142 | @@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, |
43 | + DEFINE_PROP_END_OF_LIST(), | 143 | fixupcontext[FIXUP_ENTRYPOINT_LO] = entry; |
44 | +}; | 144 | fixupcontext[FIXUP_ENTRYPOINT_HI] = entry >> 32; |
45 | + | 145 | |
46 | static void fsl_imx25_class_init(ObjectClass *oc, void *data) | 146 | - write_bootloader("bootloader", info->loader_start, |
47 | { | 147 | - primary_loader, fixupcontext, as); |
48 | DeviceClass *dc = DEVICE_CLASS(oc); | 148 | + arm_write_bootloader("bootloader", as, info->loader_start, |
49 | 149 | + primary_loader, fixupcontext); | |
50 | + device_class_set_props(dc, fsl_imx25_properties); | 150 | |
51 | dc->realize = fsl_imx25_realize; | 151 | if (info->write_board_setup) { |
52 | dc->desc = "i.MX25 SOC"; | 152 | info->write_board_setup(cpu, info); |
53 | /* | ||
54 | -- | 153 | -- |
55 | 2.20.1 | 154 | 2.34.1 |
56 | 155 | ||
57 | 156 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Cédric Le Goater <clg@kaod.org> |
---|---|---|---|
2 | 2 | ||
3 | Since added in commit 2bea128c3d, each SDHCI is wired with a SD | 3 | When writing the secondary-CPU stub boot loader code to the guest, |
4 | card, using empty card when no block drive provided. This is not | 4 | use arm_write_bootloader() instead of directly calling |
5 | the desired behavior. The SDHCI exposes a SD bus to plug cards | 5 | rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because |
6 | on, if no card available, it is fine to have an unplugged bus. | 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. | ||
7 | 9 | ||
8 | Avoid creating unnecessary SD card device when no block drive | 10 | Cc: qemu-stable@nongnu.org |
9 | provided. | 11 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
10 | 12 | Tested-by: Cédric Le Goater <clg@kaod.org> | |
11 | Fixes: 2bea128c3d ("hw/sd/aspeed_sdhci: New device") | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Message-id: 20200705173402.15620-1-f4bug@amsat.org | 15 | Message-id: 20230424152717.1333930-3-peter.maydell@linaro.org |
14 | Reviewed-by: Cédric Le Goater <clg@kaod.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] | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 20 | --- |
17 | hw/arm/aspeed.c | 9 +++++---- | 21 | hw/arm/aspeed.c | 38 ++++++++++++++++++++------------------ |
18 | 1 file changed, 5 insertions(+), 4 deletions(-) | 22 | 1 file changed, 20 insertions(+), 18 deletions(-) |
19 | 23 | ||
20 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 24 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c |
21 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/aspeed.c | 26 | --- a/hw/arm/aspeed.c |
23 | +++ b/hw/arm/aspeed.c | 27 | +++ b/hw/arm/aspeed.c |
24 | @@ -XXX,XX +XXX,XX @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo) | 28 | @@ -XXX,XX +XXX,XX @@ struct AspeedMachineState { |
29 | static void aspeed_write_smpboot(ARMCPU *cpu, | ||
30 | const struct arm_boot_info *info) | ||
25 | { | 31 | { |
26 | DeviceState *card; | 32 | - static const uint32_t poll_mailbox_ready[] = { |
27 | 33 | + AddressSpace *as = arm_boot_address_space(cpu, info); | |
28 | - card = qdev_new(TYPE_SD_CARD); | 34 | + static const ARMInsnFixup poll_mailbox_ready[] = { |
29 | - if (dinfo) { | 35 | /* |
30 | - qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), | 36 | * r2 = per-cpu go sign value |
31 | - &error_fatal); | 37 | * r1 = AST_SMP_MBOX_FIELD_ENTRY |
32 | + if (!dinfo) { | 38 | * r0 = AST_SMP_MBOX_FIELD_GOSIGN |
33 | + return; | 39 | */ |
34 | } | 40 | - 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5 */ |
35 | + card = qdev_new(TYPE_SD_CARD); | 41 | - 0xe21000ff, /* ands r0, r0, #255 */ |
36 | + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), | 42 | - 0xe59f201c, /* ldr r2, [pc, #28] */ |
37 | + &error_fatal); | 43 | - 0xe1822000, /* orr r2, r2, r0 */ |
38 | qdev_realize_and_unref(card, | 44 | + { 0xee100fb0 }, /* mrc p15, 0, r0, c0, c0, 5 */ |
39 | qdev_get_child_bus(DEVICE(sdhci), "sd-bus"), | 45 | + { 0xe21000ff }, /* ands r0, r0, #255 */ |
40 | &error_fatal); | 46 | + { 0xe59f201c }, /* ldr r2, [pc, #28] */ |
47 | + { 0xe1822000 }, /* orr r2, r2, r0 */ | ||
48 | |||
49 | - 0xe59f1018, /* ldr r1, [pc, #24] */ | ||
50 | - 0xe59f0018, /* ldr r0, [pc, #24] */ | ||
51 | + { 0xe59f1018 }, /* ldr r1, [pc, #24] */ | ||
52 | + { 0xe59f0018 }, /* ldr r0, [pc, #24] */ | ||
53 | |||
54 | - 0xe320f002, /* wfe */ | ||
55 | - 0xe5904000, /* ldr r4, [r0] */ | ||
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, | ||
41 | -- | 82 | -- |
42 | 2.20.1 | 83 | 2.34.1 |
43 | 84 | ||
44 | 85 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 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 | wrctl instruction on nios2 target will cause checking cpu | 8 | Cc: qemu-stable@nongnu.org |
4 | interrupt but tcg_handle_interrupt() will call cpu_abort() | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | if the CPU gets an interrupt while it's not in 'can do IO' | 10 | Tested-by: Cédric Le Goater <clg@kaod.org> |
6 | state, so add gen_io_start around wrctl instruction. Also | 11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | at the same time, end the onging TB with DISAS_UPDATE. | 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(-) | ||
8 | 16 | ||
9 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | 17 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c |
10 | Message-id: 20200710233433.19729-3-wentong.wu@intel.com | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/nios2/translate.c | 5 +++++ | ||
15 | 1 file changed, 5 insertions(+) | ||
16 | |||
17 | diff --git a/target/nios2/translate.c b/target/nios2/translate.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/nios2/translate.c | 19 | --- a/hw/arm/raspi.c |
20 | +++ b/target/nios2/translate.c | 20 | +++ b/hw/arm/raspi.c |
21 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
22 | #include "exec/cpu_ldst.h" | 22 | #include "qemu/units.h" |
23 | #include "exec/translator.h" | 23 | #include "qemu/cutils.h" |
24 | #include "qemu/qemu-print.h" | 24 | #include "qapi/error.h" |
25 | +#include "exec/gen-icount.h" | 25 | +#include "hw/arm/boot.h" |
26 | 26 | #include "hw/arm/bcm2836.h" | |
27 | /* is_jmp field values */ | 27 | #include "hw/registerfields.h" |
28 | #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ | 28 | #include "qemu/error-report.h" |
29 | @@ -XXX,XX +XXX,XX @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) | 29 | @@ -XXX,XX +XXX,XX @@ static const char *board_type(uint32_t board_rev) |
30 | /* If interrupts were enabled using WRCTL, trigger them. */ | 30 | |
31 | #if !defined(CONFIG_USER_ONLY) | 31 | static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) |
32 | if ((instr.imm5 + CR_BASE) == CR_STATUS) { | 32 | { |
33 | + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) { | 33 | - static const uint32_t smpboot[] = { |
34 | + gen_io_start(); | 34 | - 0xe1a0e00f, /* mov lr, pc */ |
35 | + } | 35 | - 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4), /* mov pc, BOARDSETUP_ADDR */ |
36 | gen_helper_check_interrupts(dc->cpu_env); | 36 | - 0xee100fb0, /* mrc p15, 0, r0, c0, c0, 5;get core ID */ |
37 | + dc->is_jmp = DISAS_UPDATE; | 37 | - 0xe7e10050, /* ubfx r0, r0, #0, #2 ;extract LSB */ |
38 | } | 38 | - 0xe59f5014, /* ldr r5, =0x400000CC ;load mbox base */ |
39 | #endif | 39 | - 0xe320f001, /* 1: yield */ |
40 | - 0xe7953200, /* ldr r3, [r5, r0, lsl #4] ;read mbox for our core*/ | ||
41 | - 0xe3530000, /* cmp r3, #0 ;spin while zero */ | ||
42 | - 0x0afffffb, /* beq 1b */ | ||
43 | - 0xe7853200, /* str r3, [r5, r0, lsl #4] ;clear mbox */ | ||
44 | - 0xe12fff13, /* bx r3 ;jump to target */ | ||
45 | - 0x400000cc, /* (constant: mailbox 3 read/clear base) */ | ||
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); | ||
40 | } | 119 | } |
41 | -- | 120 | -- |
42 | 2.20.1 | 121 | 2.34.1 |
43 | 122 | ||
44 | 123 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | The Allwinner PIC model uses set_bit() and clear_bit() to update the |
---|---|---|---|
2 | values in its irq_pending[] array when an interrupt arrives. However | ||
3 | it is using these functions wrongly: they work on an array of type | ||
4 | 'long', and it is passing an array of type 'uint32_t'. Because the | ||
5 | code manually figures out the right array element, this works on | ||
6 | little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 | ||
7 | in a 'long' are in the same place as they are in a 'uint32_t'. | ||
8 | However it breaks on 64-bit big-endian hosts. | ||
2 | 9 | ||
3 | Haiku puts the bswap* functions in <endian.h>; pull in that | 10 | Remove the use of set_bit() and clear_bit() in favour of using |
4 | include file on that platform. | 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. | ||
5 | 14 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 15 | Cc: qemu-stable@nongnu.org |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 17 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 18 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Message-id: 20230424152833.1334136-1-peter.maydell@linaro.org |
11 | Message-id: 20200703145614.16684-7-peter.maydell@linaro.org | ||
12 | [PMM: Expanded commit message] | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | 20 | --- |
16 | include/qemu/bswap.h | 2 ++ | 21 | hw/intc/allwinner-a10-pic.c | 7 ++----- |
17 | 1 file changed, 2 insertions(+) | 22 | 1 file changed, 2 insertions(+), 5 deletions(-) |
18 | 23 | ||
19 | diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h | 24 | diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c |
20 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/qemu/bswap.h | 26 | --- a/hw/intc/allwinner-a10-pic.c |
22 | +++ b/include/qemu/bswap.h | 27 | +++ b/hw/intc/allwinner-a10-pic.c |
23 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_pic_update(AwA10PICState *s) |
24 | # include <machine/bswap.h> | 29 | static void aw_a10_pic_set_irq(void *opaque, int irq, int level) |
25 | #elif defined(__FreeBSD__) | 30 | { |
26 | # include <sys/endian.h> | 31 | AwA10PICState *s = opaque; |
27 | +#elif defined(__HAIKU__) | 32 | + uint32_t *pending_reg = &s->irq_pending[irq / 32]; |
28 | +# include <endian.h> | 33 | |
29 | #elif defined(CONFIG_BYTESWAP_H) | 34 | - if (level) { |
30 | # include <byteswap.h> | 35 | - set_bit(irq % 32, (void *)&s->irq_pending[irq / 32]); |
36 | - } else { | ||
37 | - clear_bit(irq % 32, (void *)&s->irq_pending[irq / 32]); | ||
38 | - } | ||
39 | + *pending_reg = deposit32(*pending_reg, irq % 32, 1, level); | ||
40 | aw_a10_pic_update(s); | ||
41 | } | ||
31 | 42 | ||
32 | -- | 43 | -- |
33 | 2.20.1 | 44 | 2.34.1 |
34 | 45 | ||
35 | 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 | Replace the free-floating set of IRQs and palmte_onoff_gpios() | 1 | In allwinner_sdhost_process_desc() we just read directly from |
---|---|---|---|
2 | function with a simple QOM device that encapsulates this | 2 | guest memory into a host TransferDescriptor struct and back. |
3 | behaviour. | 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. | ||
4 | 7 | ||
5 | This fixes Coverity issue CID 1421944, which points out that | 8 | This fixes a failure of one of the avocado tests on s390. |
6 | the memory returned by qemu_allocate_irqs() is leaked. | ||
7 | 9 | ||
10 | Cc: qemu-stable@nongnu.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Li Qiang <liq3ea@gmail.com> | 12 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 13 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
11 | Message-id: 20200628214230.2592-3-peter.maydell@linaro.org | 14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
15 | Message-id: 20230424165053.1428857-2-peter.maydell@linaro.org | ||
12 | --- | 16 | --- |
13 | hw/arm/palm.c | 61 +++++++++++++++++++++++++++++++++++++++++++-------- | 17 | hw/sd/allwinner-sdhost.c | 31 ++++++++++++++++++++++++++----- |
14 | 1 file changed, 52 insertions(+), 9 deletions(-) | 18 | 1 file changed, 26 insertions(+), 5 deletions(-) |
15 | 19 | ||
16 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | 20 | diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/palm.c | 22 | --- a/hw/sd/allwinner-sdhost.c |
19 | +++ b/hw/arm/palm.c | 23 | +++ b/hw/sd/allwinner-sdhost.c |
20 | @@ -XXX,XX +XXX,XX @@ static void palmte_button_event(void *opaque, int keycode) | 24 | @@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_auto_stop(AwSdHostState *s) |
21 | !(keycode & 0x80)); | ||
22 | } | ||
23 | |||
24 | +/* | ||
25 | + * Encapsulation of some GPIO line behaviour for the Palm board | ||
26 | + * | ||
27 | + * QEMU interface: | ||
28 | + * + unnamed GPIO inputs 0..6: for the various miscellaneous input lines | ||
29 | + */ | ||
30 | + | ||
31 | +#define TYPE_PALM_MISC_GPIO "palm-misc-gpio" | ||
32 | +#define PALM_MISC_GPIO(obj) \ | ||
33 | + OBJECT_CHECK(PalmMiscGPIOState, (obj), TYPE_PALM_MISC_GPIO) | ||
34 | + | ||
35 | +typedef struct PalmMiscGPIOState { | ||
36 | + SysBusDevice parent_obj; | ||
37 | +} PalmMiscGPIOState; | ||
38 | + | ||
39 | static void palmte_onoff_gpios(void *opaque, int line, int level) | ||
40 | { | ||
41 | switch (line) { | ||
42 | @@ -XXX,XX +XXX,XX @@ static void palmte_onoff_gpios(void *opaque, int line, int level) | ||
43 | } | 25 | } |
44 | } | 26 | } |
45 | 27 | ||
46 | +static void palm_misc_gpio_init(Object *obj) | 28 | +static void read_descriptor(AwSdHostState *s, hwaddr desc_addr, |
29 | + TransferDescriptor *desc) | ||
47 | +{ | 30 | +{ |
48 | + DeviceState *dev = DEVICE(obj); | 31 | + uint32_t desc_words[4]; |
49 | + | 32 | + dma_memory_read(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words), |
50 | + qdev_init_gpio_in(dev, palmte_onoff_gpios, 7); | 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]); | ||
51 | +} | 38 | +} |
52 | + | 39 | + |
53 | +static const TypeInfo palm_misc_gpio_info = { | 40 | +static void write_descriptor(AwSdHostState *s, hwaddr desc_addr, |
54 | + .name = TYPE_PALM_MISC_GPIO, | 41 | + const TransferDescriptor *desc) |
55 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
56 | + .instance_size = sizeof(PalmMiscGPIOState), | ||
57 | + .instance_init = palm_misc_gpio_init, | ||
58 | + /* | ||
59 | + * No class init required: device has no internal state so does not | ||
60 | + * need to set up reset or vmstate, and has no realize method. | ||
61 | + */ | ||
62 | +}; | ||
63 | + | ||
64 | static void palmte_gpio_setup(struct omap_mpu_state_s *cpu) | ||
65 | { | ||
66 | - qemu_irq *misc_gpio; | ||
67 | + DeviceState *misc_gpio; | ||
68 | + | ||
69 | + misc_gpio = sysbus_create_simple(TYPE_PALM_MISC_GPIO, -1, NULL); | ||
70 | |||
71 | omap_mmc_handlers(cpu->mmc, | ||
72 | qdev_get_gpio_in(cpu->gpio, PALMTE_MMC_WP_GPIO), | ||
73 | qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio) | ||
74 | [PALMTE_MMC_SWITCH_GPIO])); | ||
75 | |||
76 | - misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7); | ||
77 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); | ||
78 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); | ||
79 | - qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]); | ||
80 | - qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]); | ||
81 | - qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]); | ||
82 | - omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); | ||
83 | - omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); | ||
84 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, | ||
85 | + qdev_get_gpio_in(misc_gpio, 0)); | ||
86 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, | ||
87 | + qdev_get_gpio_in(misc_gpio, 1)); | ||
88 | + qdev_connect_gpio_out(cpu->gpio, 11, qdev_get_gpio_in(misc_gpio, 2)); | ||
89 | + qdev_connect_gpio_out(cpu->gpio, 12, qdev_get_gpio_in(misc_gpio, 3)); | ||
90 | + qdev_connect_gpio_out(cpu->gpio, 13, qdev_get_gpio_in(misc_gpio, 4)); | ||
91 | + omap_mpuio_out_set(cpu->mpuio, 1, qdev_get_gpio_in(misc_gpio, 5)); | ||
92 | + omap_mpuio_out_set(cpu->mpuio, 3, qdev_get_gpio_in(misc_gpio, 6)); | ||
93 | |||
94 | /* Reset some inputs to initial state. */ | ||
95 | qemu_irq_lower(qdev_get_gpio_in(cpu->gpio, PALMTE_USBDETECT_GPIO)); | ||
96 | @@ -XXX,XX +XXX,XX @@ static void palmte_machine_init(MachineClass *mc) | ||
97 | } | ||
98 | |||
99 | DEFINE_MACHINE("cheetah", palmte_machine_init) | ||
100 | + | ||
101 | +static void palm_register_types(void) | ||
102 | +{ | 42 | +{ |
103 | + type_register_static(&palm_misc_gpio_info); | 43 | + uint32_t desc_words[4]; |
44 | + desc_words[0] = cpu_to_le32(desc->status); | ||
45 | + desc_words[1] = cpu_to_le32(desc->size); | ||
46 | + desc_words[2] = cpu_to_le32(desc->addr); | ||
47 | + desc_words[3] = cpu_to_le32(desc->next); | ||
48 | + dma_memory_write(&s->dma_as, desc_addr, &desc_words, sizeof(desc_words), | ||
49 | + MEMTXATTRS_UNSPECIFIED); | ||
104 | +} | 50 | +} |
105 | + | 51 | + |
106 | +type_init(palm_register_types) | 52 | static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, |
53 | hwaddr desc_addr, | ||
54 | TransferDescriptor *desc, | ||
55 | @@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, | ||
56 | uint32_t num_bytes = max_bytes; | ||
57 | uint8_t buf[1024]; | ||
58 | |||
59 | - /* Read descriptor */ | ||
60 | - dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc), | ||
61 | - MEMTXATTRS_UNSPECIFIED); | ||
62 | + read_descriptor(s, desc_addr, desc); | ||
63 | if (desc->size == 0) { | ||
64 | desc->size = klass->max_desc_size; | ||
65 | } else if (desc->size > klass->max_desc_size) { | ||
66 | @@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, | ||
67 | |||
68 | /* Clear hold flag and flush descriptor */ | ||
69 | desc->status &= ~DESC_STATUS_HOLD; | ||
70 | - dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc), | ||
71 | - MEMTXATTRS_UNSPECIFIED); | ||
72 | + write_descriptor(s, desc_addr, desc); | ||
73 | |||
74 | return num_done; | ||
75 | } | ||
107 | -- | 76 | -- |
108 | 2.20.1 | 77 | 2.34.1 |
109 | 78 | ||
110 | 79 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 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 | Add DISAS_NORETURN case for nothing more to generate because at runtime | 9 | Cc: qemu-stable@nongnu.org |
4 | execution will never return from some helper call. And at the same time | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | replace DISAS_UPDATE in t_gen_helper_raise_exception and gen_exception | 11 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
6 | with the newly added DISAS_NORETURN. | 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(-) | ||
7 | 18 | ||
8 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | 19 | diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c |
9 | Message-id: 20200710233433.19729-1-wentong.wu@intel.com | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/nios2/translate.c | 5 +++-- | ||
14 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/target/nios2/translate.c b/target/nios2/translate.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/nios2/translate.c | 21 | --- a/hw/net/allwinner-sun8i-emac.c |
19 | +++ b/target/nios2/translate.c | 22 | +++ b/hw/net/allwinner-sun8i-emac.c |
20 | @@ -XXX,XX +XXX,XX @@ static void t_gen_helper_raise_exception(DisasContext *dc, | 23 | @@ -XXX,XX +XXX,XX @@ static void allwinner_sun8i_emac_get_desc(AwSun8iEmacState *s, |
21 | tcg_gen_movi_tl(dc->cpu_R[R_PC], dc->pc); | 24 | FrameDescriptor *desc, |
22 | gen_helper_raise_exception(dc->cpu_env, tmp); | 25 | uint32_t phys_addr) |
23 | tcg_temp_free_i32(tmp); | 26 | { |
24 | - dc->is_jmp = DISAS_UPDATE; | 27 | - dma_memory_read(&s->dma_as, phys_addr, desc, sizeof(*desc), |
25 | + dc->is_jmp = DISAS_NORETURN; | 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]); | ||
26 | } | 35 | } |
27 | 36 | ||
28 | static bool use_goto_tb(DisasContext *dc, uint32_t dest) | 37 | static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iEmacState *s, |
29 | @@ -XXX,XX +XXX,XX @@ static void gen_exception(DisasContext *dc, uint32_t excp) | 38 | @@ -XXX,XX +XXX,XX @@ static uint32_t allwinner_sun8i_emac_tx_desc(AwSun8iEmacState *s, |
30 | tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); | ||
31 | gen_helper_raise_exception(cpu_env, tmp); | ||
32 | tcg_temp_free_i32(tmp); | ||
33 | - dc->is_jmp = DISAS_UPDATE; | ||
34 | + dc->is_jmp = DISAS_NORETURN; | ||
35 | } | 39 | } |
36 | 40 | ||
37 | /* generate intermediate code for basic block 'tb'. */ | 41 | static void allwinner_sun8i_emac_flush_desc(AwSun8iEmacState *s, |
38 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) | 42 | - FrameDescriptor *desc, |
39 | tcg_gen_exit_tb(NULL, 0); | 43 | + const FrameDescriptor *desc, |
44 | uint32_t phys_addr) | ||
45 | { | ||
46 | - dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc), | ||
47 | + uint32_t desc_words[4]; | ||
48 | + desc_words[0] = cpu_to_le32(desc->status); | ||
49 | + desc_words[1] = cpu_to_le32(desc->status2); | ||
50 | + desc_words[2] = cpu_to_le32(desc->addr); | ||
51 | + desc_words[3] = cpu_to_le32(desc->next); | ||
52 | + dma_memory_write(&s->dma_as, phys_addr, &desc_words, sizeof(desc_words), | ||
53 | MEMTXATTRS_UNSPECIFIED); | ||
54 | } | ||
55 | |||
56 | @@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset, | ||
40 | break; | 57 | break; |
41 | 58 | case REG_TX_CUR_BUF: /* Transmit Current Buffer */ | |
42 | + case DISAS_NORETURN: | 59 | if (s->tx_desc_curr != 0) { |
43 | case DISAS_TB_JUMP: | 60 | - dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(desc), |
44 | /* nothing more to generate */ | 61 | - MEMTXATTRS_UNSPECIFIED); |
62 | + allwinner_sun8i_emac_get_desc(s, &desc, s->tx_desc_curr); | ||
63 | value = desc.addr; | ||
64 | } else { | ||
65 | value = 0; | ||
66 | @@ -XXX,XX +XXX,XX @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset, | ||
45 | break; | 67 | break; |
68 | case REG_RX_CUR_BUF: /* Receive Current Buffer */ | ||
69 | if (s->rx_desc_curr != 0) { | ||
70 | - dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(desc), | ||
71 | - MEMTXATTRS_UNSPECIFIED); | ||
72 | + allwinner_sun8i_emac_get_desc(s, &desc, s->rx_desc_curr); | ||
73 | value = desc.addr; | ||
74 | } else { | ||
75 | value = 0; | ||
46 | -- | 76 | -- |
47 | 2.20.1 | 77 | 2.34.1 |
48 | 78 | ||
49 | 79 | diff view generated by jsdifflib |