1 | Last lot of target-arm stuff: cleanups, bug fixes; nothing major here. | 1 | The following changes since commit 131c58469f6fb68c89b38fee6aba8bbb20c7f4bf: |
---|---|---|---|
2 | 2 | ||
3 | -- PMM | 3 | rust: add --rust-target option for bindgen (2025-02-06 13:51:46 -0500) |
4 | |||
5 | The following changes since commit 9d662a6b22a0838a85c5432385f35db2488a33a5: | ||
6 | |||
7 | Merge remote-tracking branch 'remotes/legoater/tags/pull-ppc-20220305' into staging (2022-03-05 18:03:15 +0000) | ||
8 | 4 | ||
9 | are available in the Git repository at: | 5 | are available in the Git repository at: |
10 | 6 | ||
11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220307 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250210 |
12 | 8 | ||
13 | for you to fetch changes up to 0942820408dc788560f6968e9b5f011803b846c2: | 9 | for you to fetch changes up to 27a8d899c7a100fd5aa040a8b993bb257687c393: |
14 | 10 | ||
15 | hw/arm/virt: Disable LPA2 for -machine virt-6.2 (2022-03-07 14:32:21 +0000) | 11 | linux-user: Do not define struct sched_attr if libc headers do (2025-02-07 16:09:20 +0000) |
16 | 12 | ||
17 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
18 | target-arm queue: | 14 | target-arm queue: |
19 | * cleanups of qemu_oom_check() and qemu_memalign() | 15 | * Deprecate pxa2xx CPUs, iwMMXt emulation, -old-param option |
20 | * target/arm/translate-neon: UNDEF if VLD1/VST1 stride bits are non-zero | 16 | * Drop unused AArch64DecodeTable typedefs |
21 | * target/arm/translate-neon: Simplify align field check for VLD3 | 17 | * Minor code cleanups |
22 | * GICv3 ITS: add more trace events | 18 | * hw/net/cadence_gem: Fix the mask/compare/disable-mask logic |
23 | * GICv3 ITS: implement 8-byte accesses properly | 19 | * linux-user: Do not define struct sched_attr if libc headers do |
24 | * GICv3: fix minor issues with some trace/log messages | ||
25 | * ui/cocoa: Use the standard about panel | ||
26 | * target/arm: Provide cpu property for controling FEAT_LPA2 | ||
27 | * hw/arm/virt: Disable LPA2 for -machine virt-6.2 | ||
28 | 20 | ||
29 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
30 | Akihiko Odaki (1): | 22 | Andrew Yuan (1): |
31 | ui/cocoa: Use the standard about panel | 23 | hw/net/cadence_gem: Fix the mask/compare/disable-mask logic |
32 | 24 | ||
33 | Peter Maydell (15): | 25 | Khem Raj (1): |
34 | util: Make qemu_oom_check() a static function | 26 | linux-user: Do not define struct sched_attr if libc headers do |
35 | util: Unify implementations of qemu_memalign() | ||
36 | util: Return valid allocation for qemu_try_memalign() with zero size | ||
37 | meson.build: Don't misdetect posix_memalign() on Windows | ||
38 | util: Share qemu_try_memalign() implementation between POSIX and Windows | ||
39 | util: Use meson checks for valloc() and memalign() presence | ||
40 | util: Put qemu_vfree() in memalign.c | ||
41 | osdep: Move memalign-related functions to their own header | ||
42 | target/arm/translate-neon: UNDEF if VLD1/VST1 stride bits are non-zero | ||
43 | target/arm/translate-neon: Simplify align field check for VLD3 | ||
44 | hw/intc/arm_gicv3_its: Add trace events for commands | ||
45 | hw/intc/arm_gicv3_its: Add trace events for table reads and writes | ||
46 | hw/intc/arm_gicv3: Specify valid and impl in MemoryRegionOps | ||
47 | hw/intc/arm_gicv3: Fix missing spaces in error log messages | ||
48 | hw/intc/arm_gicv3_cpuif: Fix register names in ICV_HPPIR read trace event | ||
49 | 27 | ||
50 | Richard Henderson (2): | 28 | Peter Maydell (4): |
51 | target/arm: Provide cpu property for controling FEAT_LPA2 | 29 | target/arm: deprecate the pxa2xx CPUs and iwMMXt emulation |
52 | hw/arm/virt: Disable LPA2 for -machine virt-6.2 | 30 | tests/tcg/arm: Remove test-arm-iwmmxt test |
31 | target/arm: Drop unused AArch64DecodeTable typedefs | ||
32 | qemu-options: Deprecate -old-param command line option | ||
53 | 33 | ||
54 | meson.build | 7 ++- | 34 | Philippe Mathieu-Daudé (6): |
55 | include/hw/arm/virt.h | 1 + | 35 | hw/arm/boot: Propagate vCPU to arm_load_dtb() |
56 | include/qemu-common.h | 2 - | 36 | hw/arm/fsl-imx6: Add local 'mpcore/gic' variables |
57 | include/qemu/memalign.h | 61 ++++++++++++++++++++++ | 37 | hw/arm/fsl-imx6ul: Add local 'mpcore/gic' variables |
58 | include/qemu/osdep.h | 18 ------- | 38 | hw/arm/fsl-imx7: Add local 'mpcore/gic' variables |
59 | target/arm/cpu.h | 5 +- | 39 | hw/cpu/arm: Alias 'num-cpu' property on TYPE_REALVIEW_MPCORE |
60 | block/blkverify.c | 1 + | 40 | hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro |
61 | block/block-copy.c | 1 + | 41 | |
62 | block/commit.c | 1 + | 42 | docs/about/deprecated.rst | 34 ++++++++++++++++++++++ |
63 | block/crypto.c | 1 + | 43 | include/hw/arm/boot.h | 4 ++- |
64 | block/dmg.c | 1 + | 44 | target/arm/cpu.h | 1 + |
65 | block/export/fuse.c | 1 + | 45 | hw/arm/boot.c | 11 +++---- |
66 | block/file-posix.c | 1 + | 46 | hw/arm/fsl-imx6.c | 52 ++++++++++++++------------------- |
67 | block/io.c | 1 + | 47 | hw/arm/fsl-imx6ul.c | 64 +++++++++++++++++------------------------ |
68 | block/mirror.c | 1 + | 48 | hw/arm/fsl-imx7.c | 52 +++++++++++++++------------------ |
69 | block/nvme.c | 1 + | 49 | hw/arm/virt.c | 2 +- |
70 | block/parallels-ext.c | 1 + | 50 | hw/cpu/a15mpcore.c | 21 ++++++-------- |
71 | block/parallels.c | 1 + | 51 | hw/cpu/a9mpcore.c | 21 ++++++-------- |
72 | block/qcow.c | 1 + | 52 | hw/cpu/arm11mpcore.c | 21 ++++++-------- |
73 | block/qcow2-cache.c | 1 + | 53 | hw/cpu/realview_mpcore.c | 29 +++++++------------ |
74 | block/qcow2-cluster.c | 1 + | 54 | hw/net/cadence_gem.c | 26 +++++++++++++---- |
75 | block/qcow2-refcount.c | 1 + | 55 | linux-user/syscall.c | 4 ++- |
76 | block/qcow2-snapshot.c | 1 + | 56 | system/vl.c | 1 + |
77 | block/qcow2.c | 1 + | 57 | target/arm/cpu.c | 3 ++ |
78 | block/qed-l2-cache.c | 1 + | 58 | target/arm/tcg/cpu32.c | 36 +++++++++++++++-------- |
79 | block/qed-table.c | 1 + | 59 | target/arm/tcg/translate-a64.c | 11 ------- |
80 | block/qed.c | 1 + | 60 | tests/tcg/arm/Makefile.target | 7 ----- |
81 | block/quorum.c | 1 + | 61 | tests/tcg/arm/README | 5 ---- |
82 | block/raw-format.c | 1 + | 62 | tests/tcg/arm/test-arm-iwmmxt.S | 49 ------------------------------- |
83 | block/vdi.c | 1 + | 63 | 21 files changed, 205 insertions(+), 249 deletions(-) |
84 | block/vhdx-log.c | 1 + | 64 | delete mode 100644 tests/tcg/arm/test-arm-iwmmxt.S |
85 | block/vhdx.c | 1 + | 65 | |
86 | block/vmdk.c | 1 + | ||
87 | block/vpc.c | 1 + | ||
88 | block/win32-aio.c | 1 + | ||
89 | hw/arm/virt.c | 7 +++ | ||
90 | hw/block/dataplane/xen-block.c | 1 + | ||
91 | hw/block/fdc.c | 1 + | ||
92 | hw/ide/core.c | 1 + | ||
93 | hw/intc/arm_gicv3.c | 8 +++ | ||
94 | hw/intc/arm_gicv3_cpuif.c | 3 +- | ||
95 | hw/intc/arm_gicv3_dist.c | 4 +- | ||
96 | hw/intc/arm_gicv3_its.c | 69 +++++++++++++++++++++---- | ||
97 | hw/ppc/spapr.c | 1 + | ||
98 | hw/ppc/spapr_softmmu.c | 1 + | ||
99 | hw/scsi/scsi-disk.c | 1 + | ||
100 | hw/tpm/tpm_ppi.c | 2 +- | ||
101 | nbd/server.c | 1 + | ||
102 | net/l2tpv3.c | 2 +- | ||
103 | plugins/loader.c | 1 + | ||
104 | qemu-img.c | 1 + | ||
105 | qemu-io-cmds.c | 1 + | ||
106 | qom/object.c | 1 + | ||
107 | softmmu/physmem.c | 1 + | ||
108 | target/arm/cpu.c | 6 +++ | ||
109 | target/arm/cpu64.c | 24 +++++++++ | ||
110 | target/arm/translate-neon.c | 13 +++-- | ||
111 | target/i386/hvf/hvf.c | 1 + | ||
112 | target/i386/kvm/kvm.c | 1 + | ||
113 | tcg/region.c | 1 + | ||
114 | tests/bench/atomic_add-bench.c | 1 + | ||
115 | tests/bench/qht-bench.c | 1 + | ||
116 | util/atomic64.c | 1 + | ||
117 | util/memalign.c | 92 +++++++++++++++++++++++++++++++++ | ||
118 | util/oslib-posix.c | 46 ----------------- | ||
119 | util/oslib-win32.c | 35 ------------- | ||
120 | util/qht.c | 1 + | ||
121 | hw/intc/trace-events | 21 ++++++++ | ||
122 | tests/avocado/boot_linux.py | 2 + | ||
123 | ui/cocoa.m | 112 +++++++++-------------------------------- | ||
124 | util/meson.build | 1 + | ||
125 | 71 files changed, 377 insertions(+), 212 deletions(-) | ||
126 | create mode 100644 include/qemu/memalign.h | ||
127 | create mode 100644 util/memalign.c | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The pxa2xx CPUs are now only useful with user-mode emulation, because |
---|---|---|---|
2 | we dropped all the machine types that used them in 9.2. (Technically | ||
3 | you could alse use "-cpu pxa270" with a board model like versatilepb | ||
4 | which doesn't sanity-check the CPU type, but that has never been a | ||
5 | supported config.) | ||
2 | 6 | ||
3 | There is a Linux kernel bug present until v5.12 that prevents | 7 | To use them (or iwMMXt emulation) with QEMU user-mode you would need |
4 | booting with FEAT_LPA2 enabled. As a workaround for TCG, allow | 8 | to explicitly select them with the -cpu option or the QEMU_CPU |
5 | the feature to be disabled from -cpu max. | 9 | environment variable. A google search finds no examples of anybody |
10 | doing this in the last decade; I don't believe the GCC folks are | ||
11 | using QEMU to test their iwMMXt codegen either. In fact, GCC is in | ||
12 | the process of dropping support for iwMMXT entirely. | ||
6 | 13 | ||
7 | Since this kernel bug is present in the Fedora 31 image that | 14 | The iwMMXt emulation is thousands of lines of code in QEMU, and |
8 | we test in avocado, disable lpa2 on the command-line. | 15 | is now the only bit of Arm insn decode which doesn't use decodetree. |
16 | We have no way to test or validate changes to it. This code is | ||
17 | just dead weight that is almost certainly not being used by anybody. | ||
18 | Mark it as deprecated. | ||
9 | 19 | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 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 | Message-id: 20250127112715.2936555-2-peter.maydell@linaro.org | ||
13 | --- | 24 | --- |
14 | target/arm/cpu.h | 5 ++++- | 25 | docs/about/deprecated.rst | 21 +++++++++++++++++++++ |
15 | target/arm/cpu.c | 6 ++++++ | 26 | target/arm/cpu.h | 1 + |
16 | target/arm/cpu64.c | 24 ++++++++++++++++++++++++ | 27 | target/arm/cpu.c | 3 +++ |
17 | tests/avocado/boot_linux.py | 2 ++ | 28 | target/arm/tcg/cpu32.c | 36 ++++++++++++++++++++++++------------ |
18 | 4 files changed, 36 insertions(+), 1 deletion(-) | 29 | 4 files changed, 49 insertions(+), 12 deletions(-) |
19 | 30 | ||
31 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/docs/about/deprecated.rst | ||
34 | +++ b/docs/about/deprecated.rst | ||
35 | @@ -XXX,XX +XXX,XX @@ is going to be so much slower it wouldn't make sense for any serious | ||
36 | instrumentation. Due to implementation differences there will also be | ||
37 | anomalies in things like memory instrumentation. | ||
38 | |||
39 | +linux-user mode CPUs | ||
40 | +-------------------- | ||
41 | + | ||
42 | +iwMMXt emulation and the ``pxa`` CPUs (since 10.0) | ||
43 | +'''''''''''''''''''''''''''''''''''''''''''''''''' | ||
44 | + | ||
45 | +The ``pxa`` CPU family (``pxa250``, ``pxa255``, ``pxa260``, | ||
46 | +``pxa261``, ``pxa262``, ``pxa270-a0``, ``pxa270-a1``, ``pxa270``, | ||
47 | +``pxa270-b0``, ``pxa270-b1``, ``pxa270-c0``, ``pxa270-c5``) are no | ||
48 | +longer used in system emulation, because all the machine types which | ||
49 | +used these CPUs were removed in the QEMU 9.2 release. These CPUs can | ||
50 | +now only be used in linux-user mode, and to do that you would have to | ||
51 | +explicitly select one of these CPUs with the ``-cpu`` command line | ||
52 | +option or the ``QEMU_CPU`` environment variable. | ||
53 | + | ||
54 | +We don't believe that anybody is using the iwMMXt emulation, and we do | ||
55 | +not have any tests to validate it or any real hardware or similar | ||
56 | +known-good implementation to test against. GCC is in the process of | ||
57 | +dropping their support for iwMMXt codegen. These CPU types are | ||
58 | +therefore deprecated in QEMU, and will be removed in a future release. | ||
59 | + | ||
60 | System emulator CPUs | ||
61 | -------------------- | ||
62 | |||
20 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 63 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
21 | index XXXXXXX..XXXXXXX 100644 | 64 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/cpu.h | 65 | --- a/target/arm/cpu.h |
23 | +++ b/target/arm/cpu.h | 66 | +++ b/target/arm/cpu.h |
24 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 67 | @@ -XXX,XX +XXX,XX @@ struct ArchCPU { |
25 | # define ARM_MAX_VQ 16 | 68 | |
26 | void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); | 69 | typedef struct ARMCPUInfo { |
27 | void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); | 70 | const char *name; |
28 | +void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); | 71 | + const char *deprecation_note; |
29 | #else | 72 | void (*initfn)(Object *obj); |
30 | # define ARM_MAX_VQ 1 | 73 | void (*class_init)(ObjectClass *oc, void *data); |
31 | static inline void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { } | 74 | } ARMCPUInfo; |
32 | static inline void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) { } | ||
33 | +static inline void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) { } | ||
34 | #endif | ||
35 | |||
36 | typedef struct ARMVectorReg { | ||
37 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
38 | |||
39 | /* | ||
40 | * Intermediate values used during property parsing. | ||
41 | - * Once finalized, the values should be read from ID_AA64ISAR1. | ||
42 | + * Once finalized, the values should be read from ID_AA64*. | ||
43 | */ | ||
44 | bool prop_pauth; | ||
45 | bool prop_pauth_impdef; | ||
46 | + bool prop_lpa2; | ||
47 | |||
48 | /* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */ | ||
49 | uint32_t dcz_blocksize; | ||
50 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 75 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
51 | index XXXXXXX..XXXXXXX 100644 | 76 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/target/arm/cpu.c | 77 | --- a/target/arm/cpu.c |
53 | +++ b/target/arm/cpu.c | 78 | +++ b/target/arm/cpu.c |
54 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp) | 79 | @@ -XXX,XX +XXX,XX @@ static void cpu_register_class_init(ObjectClass *oc, void *data) |
55 | error_propagate(errp, local_err); | 80 | |
56 | return; | 81 | acc->info = data; |
57 | } | 82 | cc->gdb_core_xml_file = "arm-core.xml"; |
58 | + | 83 | + if (acc->info->deprecation_note) { |
59 | + arm_cpu_lpa2_finalize(cpu, &local_err); | 84 | + cc->deprecation_note = acc->info->deprecation_note; |
60 | + if (local_err != NULL) { | 85 | + } |
61 | + error_propagate(errp, local_err); | 86 | } |
62 | + return; | 87 | |
63 | + } | 88 | void arm_cpu_register(const ARMCPUInfo *info) |
64 | } | 89 | diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c |
65 | |||
66 | if (kvm_enabled()) { | ||
67 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | 90 | index XXXXXXX..XXXXXXX 100644 |
69 | --- a/target/arm/cpu64.c | 91 | --- a/target/arm/tcg/cpu32.c |
70 | +++ b/target/arm/cpu64.c | 92 | +++ b/target/arm/tcg/cpu32.c |
71 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) | 93 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = { |
72 | } | 94 | { .name = "ti925t", .initfn = ti925t_initfn }, |
73 | } | 95 | { .name = "sa1100", .initfn = sa1100_initfn }, |
74 | 96 | { .name = "sa1110", .initfn = sa1110_initfn }, | |
75 | +static Property arm_cpu_lpa2_property = | 97 | - { .name = "pxa250", .initfn = pxa250_initfn }, |
76 | + DEFINE_PROP_BOOL("lpa2", ARMCPU, prop_lpa2, true); | 98 | - { .name = "pxa255", .initfn = pxa255_initfn }, |
77 | + | 99 | - { .name = "pxa260", .initfn = pxa260_initfn }, |
78 | +void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp) | 100 | - { .name = "pxa261", .initfn = pxa261_initfn }, |
79 | +{ | 101 | - { .name = "pxa262", .initfn = pxa262_initfn }, |
80 | + uint64_t t; | 102 | + { .name = "pxa250", .initfn = pxa250_initfn, |
81 | + | 103 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
82 | + /* | 104 | + { .name = "pxa255", .initfn = pxa255_initfn, |
83 | + * We only install the property for tcg -cpu max; this is the | 105 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
84 | + * only situation in which the cpu field can be true. | 106 | + { .name = "pxa260", .initfn = pxa260_initfn, |
85 | + */ | 107 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
86 | + if (!cpu->prop_lpa2) { | 108 | + { .name = "pxa261", .initfn = pxa261_initfn, |
87 | + return; | 109 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
88 | + } | 110 | + { .name = "pxa262", .initfn = pxa262_initfn, |
89 | + | 111 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
90 | + t = cpu->isar.id_aa64mmfr0; | 112 | /* "pxa270" is an alias for "pxa270-a0" */ |
91 | + t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16, 2); /* 16k pages w/ LPA2 */ | 113 | - { .name = "pxa270", .initfn = pxa270a0_initfn }, |
92 | + t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4, 1); /* 4k pages w/ LPA2 */ | 114 | - { .name = "pxa270-a0", .initfn = pxa270a0_initfn }, |
93 | + t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN16_2, 3); /* 16k stage2 w/ LPA2 */ | 115 | - { .name = "pxa270-a1", .initfn = pxa270a1_initfn }, |
94 | + t = FIELD_DP64(t, ID_AA64MMFR0, TGRAN4_2, 3); /* 4k stage2 w/ LPA2 */ | 116 | - { .name = "pxa270-b0", .initfn = pxa270b0_initfn }, |
95 | + cpu->isar.id_aa64mmfr0 = t; | 117 | - { .name = "pxa270-b1", .initfn = pxa270b1_initfn }, |
96 | +} | 118 | - { .name = "pxa270-c0", .initfn = pxa270c0_initfn }, |
97 | + | 119 | - { .name = "pxa270-c5", .initfn = pxa270c5_initfn }, |
98 | static void aarch64_host_initfn(Object *obj) | 120 | + { .name = "pxa270", .initfn = pxa270a0_initfn, |
99 | { | 121 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
100 | #if defined(CONFIG_KVM) | 122 | + { .name = "pxa270-a0", .initfn = pxa270a0_initfn, |
101 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 123 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
102 | aarch64_add_sve_properties(obj); | 124 | + { .name = "pxa270-a1", .initfn = pxa270a1_initfn, |
103 | object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_max_vq, | 125 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
104 | cpu_max_set_sve_max_vq, NULL, NULL); | 126 | + { .name = "pxa270-b0", .initfn = pxa270b0_initfn, |
105 | + qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property); | 127 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
106 | } | 128 | + { .name = "pxa270-b1", .initfn = pxa270b1_initfn, |
107 | 129 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, | |
108 | static void aarch64_a64fx_initfn(Object *obj) | 130 | + { .name = "pxa270-c0", .initfn = pxa270c0_initfn, |
109 | diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py | 131 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
110 | index XXXXXXX..XXXXXXX 100644 | 132 | + { .name = "pxa270-c5", .initfn = pxa270c5_initfn, |
111 | --- a/tests/avocado/boot_linux.py | 133 | + .deprecation_note = "iwMMXt CPUs are no longer supported", }, |
112 | +++ b/tests/avocado/boot_linux.py | 134 | #ifndef TARGET_AARCH64 |
113 | @@ -XXX,XX +XXX,XX @@ def test_virt_tcg_gicv2(self): | 135 | { .name = "max", .initfn = arm_max_initfn }, |
114 | """ | 136 | #endif |
115 | self.require_accelerator("tcg") | ||
116 | self.vm.add_args("-accel", "tcg") | ||
117 | + self.vm.add_args("-cpu", "max,lpa2=off") | ||
118 | self.vm.add_args("-machine", "virt,gic-version=2") | ||
119 | self.add_common_args() | ||
120 | self.launch_and_wait(set_up_ssh_connection=False) | ||
121 | @@ -XXX,XX +XXX,XX @@ def test_virt_tcg_gicv3(self): | ||
122 | """ | ||
123 | self.require_accelerator("tcg") | ||
124 | self.vm.add_args("-accel", "tcg") | ||
125 | + self.vm.add_args("-cpu", "max,lpa2=off") | ||
126 | self.vm.add_args("-machine", "virt,gic-version=3") | ||
127 | self.add_common_args() | ||
128 | self.launch_and_wait(set_up_ssh_connection=False) | ||
129 | -- | 137 | -- |
130 | 2.25.1 | 138 | 2.34.1 |
139 | |||
140 | diff view generated by jsdifflib |
1 | The qemu_try_memalign() functions for POSIX and Windows used to be | 1 | The test-arm-iwmmmxt test isn't testing what it thinks it's testing. |
---|---|---|---|
2 | significantly different, but these days they are identical except for | ||
3 | the actual allocation function called, and the POSIX version already | ||
4 | has to have ifdeffery for different allocation functions. | ||
5 | 2 | ||
6 | Move to a single implementation in memalign.c, which uses the Windows | 3 | If you run it with a CPU type that supports iwMMXt then it will crash |
7 | _aligned_malloc if we detect that function in meson. | 4 | immediately with a SIGILL, because (even with -marm) GCC will link it |
5 | against startup code that is in Thumb mode, and no iwMMXt CPU has | ||
6 | Thumb: | ||
7 | |||
8 | 00010338 <_start>: | ||
9 | 10338: f04f 0b00 mov.w fp, #0 | ||
10 | 1033c: f04f 0e00 mov.w lr, #0 | ||
11 | |||
12 | If you run it with a CPU type which does *not* support iwMMXt, which | ||
13 | is what 'make check-tcg' does, then QEMU will not try to handle the | ||
14 | insns as iwMMXt. Instead the translator turns them into illegal | ||
15 | instructions. Then in the linux-user cpu_loop() code we identify | ||
16 | them as FPA11 instructions inside emulate_arm_fpa11(), because the | ||
17 | FPA11 happened to use the same coprocessor number as these iwMMXt | ||
18 | insns. So we execute a completely different set of FPA11 insns, | ||
19 | which means we don't crash, but we will print garbage to stdout. | ||
20 | Then the test binary always exits with a 0 return code, so 'make | ||
21 | check-tcg' thinks the test passes. | ||
22 | |||
23 | Modern gnueabihf toolchains assume in their startup code that the CPU | ||
24 | is not so old as to not support Thumb, so there's no way to get them | ||
25 | to generate a binary that actually does what the test wants. Since | ||
26 | we're deprecating iwMMXt emulation anyway, it's not worth trying to | ||
27 | salvage the test case to get it to really test the iwMMXt insns. | ||
28 | |||
29 | Delete the test entirely. | ||
8 | 30 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 31 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 32 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 20220226180723.1706285-7-peter.maydell@linaro.org | 33 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 34 | Message-id: 20250127112715.2936555-3-peter.maydell@linaro.org |
13 | --- | 35 | --- |
14 | meson.build | 1 + | 36 | tests/tcg/arm/Makefile.target | 7 ----- |
15 | util/memalign.c | 39 +++++++++++++++++++++++++++++++++++++++ | 37 | tests/tcg/arm/README | 5 ---- |
16 | util/oslib-posix.c | 29 ----------------------------- | 38 | tests/tcg/arm/test-arm-iwmmxt.S | 49 --------------------------------- |
17 | util/oslib-win32.c | 17 ----------------- | 39 | 3 files changed, 61 deletions(-) |
18 | 4 files changed, 40 insertions(+), 46 deletions(-) | 40 | delete mode 100644 tests/tcg/arm/test-arm-iwmmxt.S |
19 | 41 | ||
20 | diff --git a/meson.build b/meson.build | 42 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target |
21 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/meson.build | 44 | --- a/tests/tcg/arm/Makefile.target |
23 | +++ b/meson.build | 45 | +++ b/tests/tcg/arm/Makefile.target |
24 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fallocate' | 46 | @@ -XXX,XX +XXX,XX @@ ARM_TESTS = hello-arm |
25 | # Note that we need to specify prefix: here to avoid incorrectly | 47 | hello-arm: CFLAGS+=-marm -ffreestanding -fno-stack-protector |
26 | # thinking that Windows has posix_memalign() | 48 | hello-arm: LDFLAGS+=-nostdlib |
27 | config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign', prefix: '#include <stdlib.h>')) | 49 | |
28 | +config_host_data.set('CONFIG_ALIGNED_MALLOC', cc.has_function('_aligned_malloc')) | 50 | -# IWMXT floating point extensions |
29 | config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) | 51 | -ARM_TESTS += test-arm-iwmmxt |
30 | config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | 52 | -# Clang assembler does not support IWMXT, so use the external assembler. |
31 | config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwait', dependencies: threads)) | 53 | -test-arm-iwmmxt: CFLAGS += -marm -march=iwmmxt -mabi=aapcs -mfpu=fpv4-sp-d16 $(CROSS_CC_HAS_FNIA) |
32 | diff --git a/util/memalign.c b/util/memalign.c | 54 | -test-arm-iwmmxt: test-arm-iwmmxt.S |
55 | - $(CC) $(CFLAGS) -Wa,--noexecstack $< -o $@ $(LDFLAGS) | ||
56 | - | ||
57 | # Float-convert Tests | ||
58 | ARM_TESTS += fcvt | ||
59 | fcvt: LDFLAGS += -lm | ||
60 | diff --git a/tests/tcg/arm/README b/tests/tcg/arm/README | ||
33 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/util/memalign.c | 62 | --- a/tests/tcg/arm/README |
35 | +++ b/util/memalign.c | 63 | +++ b/tests/tcg/arm/README |
64 | @@ -XXX,XX +XXX,XX @@ hello-arm | ||
65 | --------- | ||
66 | |||
67 | A very simple inline assembly, write syscall based hello world | ||
68 | - | ||
69 | -test-arm-iwmmxt | ||
70 | ---------------- | ||
71 | - | ||
72 | -A simple test case for older iwmmxt extended ARMs | ||
73 | diff --git a/tests/tcg/arm/test-arm-iwmmxt.S b/tests/tcg/arm/test-arm-iwmmxt.S | ||
74 | deleted file mode 100644 | ||
75 | index XXXXXXX..XXXXXXX | ||
76 | --- a/tests/tcg/arm/test-arm-iwmmxt.S | ||
77 | +++ /dev/null | ||
36 | @@ -XXX,XX +XXX,XX @@ | 78 | @@ -XXX,XX +XXX,XX @@ |
37 | */ | 79 | -@ Checks whether iwMMXt is functional. |
38 | 80 | -.code 32 | |
39 | #include "qemu/osdep.h" | 81 | -.globl main |
40 | +#include "qemu/host-utils.h" | ||
41 | +#include "trace.h" | ||
42 | + | ||
43 | +void *qemu_try_memalign(size_t alignment, size_t size) | ||
44 | +{ | ||
45 | + void *ptr; | ||
46 | + | ||
47 | + if (alignment < sizeof(void*)) { | ||
48 | + alignment = sizeof(void*); | ||
49 | + } else { | ||
50 | + g_assert(is_power_of_2(alignment)); | ||
51 | + } | ||
52 | + | ||
53 | + /* | ||
54 | + * Handling of 0 allocations varies among the different | ||
55 | + * platform APIs (for instance _aligned_malloc() will | ||
56 | + * fail) -- ensure that we always return a valid non-NULL | ||
57 | + * pointer that can be freed by qemu_vfree(). | ||
58 | + */ | ||
59 | + if (size == 0) { | ||
60 | + size++; | ||
61 | + } | ||
62 | +#if defined(CONFIG_POSIX_MEMALIGN) | ||
63 | + int ret; | ||
64 | + ret = posix_memalign(&ptr, alignment, size); | ||
65 | + if (ret != 0) { | ||
66 | + errno = ret; | ||
67 | + ptr = NULL; | ||
68 | + } | ||
69 | +#elif defined(CONFIG_ALIGNED_MALLOC) | ||
70 | + ptr = _aligned_malloc(size, alignment); | ||
71 | +#elif defined(CONFIG_BSD) | ||
72 | + ptr = valloc(size); | ||
73 | +#else | ||
74 | + ptr = memalign(alignment, size); | ||
75 | +#endif | ||
76 | + trace_qemu_memalign(alignment, size, ptr); | ||
77 | + return ptr; | ||
78 | +} | ||
79 | |||
80 | void *qemu_memalign(size_t alignment, size_t size) | ||
81 | { | ||
82 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | ||
83 | index XXXXXXX..XXXXXXX 100644 | ||
84 | --- a/util/oslib-posix.c | ||
85 | +++ b/util/oslib-posix.c | ||
86 | @@ -XXX,XX +XXX,XX @@ fail_close: | ||
87 | return false; | ||
88 | } | ||
89 | |||
90 | -void *qemu_try_memalign(size_t alignment, size_t size) | ||
91 | -{ | ||
92 | - void *ptr; | ||
93 | - | 82 | - |
94 | - if (alignment < sizeof(void*)) { | 83 | -main: |
95 | - alignment = sizeof(void*); | 84 | -ldr r0, =data0 |
96 | - } else { | 85 | -ldr r1, =data1 |
97 | - g_assert(is_power_of_2(alignment)); | 86 | -ldr r2, =data2 |
98 | - } | 87 | -#ifndef FPA |
88 | -wldrd wr0, [r0, #0] | ||
89 | -wldrd wr1, [r0, #8] | ||
90 | -wldrd wr2, [r1, #0] | ||
91 | -wldrd wr3, [r1, #8] | ||
92 | -wsubb wr2, wr2, wr0 | ||
93 | -wsubb wr3, wr3, wr1 | ||
94 | -wldrd wr0, [r2, #0] | ||
95 | -wldrd wr1, [r2, #8] | ||
96 | -waddb wr0, wr0, wr2 | ||
97 | -waddb wr1, wr1, wr3 | ||
98 | -wstrd wr0, [r2, #0] | ||
99 | -wstrd wr1, [r2, #8] | ||
100 | -#else | ||
101 | -ldfe f0, [r0, #0] | ||
102 | -ldfe f1, [r0, #8] | ||
103 | -ldfe f2, [r1, #0] | ||
104 | -ldfe f3, [r1, #8] | ||
105 | -adfdp f2, f2, f0 | ||
106 | -adfdp f3, f3, f1 | ||
107 | -ldfe f0, [r2, #0] | ||
108 | -ldfe f1, [r2, #8] | ||
109 | -adfd f0, f0, f2 | ||
110 | -adfd f1, f1, f3 | ||
111 | -stfe f0, [r2, #0] | ||
112 | -stfe f1, [r2, #8] | ||
113 | -#endif | ||
114 | -mov r0, #1 | ||
115 | -mov r1, r2 | ||
116 | -mov r2, #0x11 | ||
117 | -swi #0x900004 | ||
118 | -mov r0, #0 | ||
119 | -swi #0x900001 | ||
99 | - | 120 | - |
100 | - if (size == 0) { | 121 | -.data |
101 | - size++; | 122 | -data0: |
102 | - } | 123 | -.string "aaaabbbbccccdddd" |
103 | -#if defined(CONFIG_POSIX_MEMALIGN) | 124 | -data1: |
104 | - int ret; | 125 | -.string "bbbbccccddddeeee" |
105 | - ret = posix_memalign(&ptr, alignment, size); | 126 | -data2: |
106 | - if (ret != 0) { | 127 | -.string "hvLLWs\x1fsdrs9\x1fNJ-\n" |
107 | - errno = ret; | ||
108 | - ptr = NULL; | ||
109 | - } | ||
110 | -#elif defined(CONFIG_BSD) | ||
111 | - ptr = valloc(size); | ||
112 | -#else | ||
113 | - ptr = memalign(alignment, size); | ||
114 | -#endif | ||
115 | - trace_qemu_memalign(alignment, size, ptr); | ||
116 | - return ptr; | ||
117 | -} | ||
118 | - | ||
119 | /* alloc shared memory pages */ | ||
120 | void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared, | ||
121 | bool noreserve) | ||
122 | diff --git a/util/oslib-win32.c b/util/oslib-win32.c | ||
123 | index XXXXXXX..XXXXXXX 100644 | ||
124 | --- a/util/oslib-win32.c | ||
125 | +++ b/util/oslib-win32.c | ||
126 | @@ -XXX,XX +XXX,XX @@ | ||
127 | /* this must come after including "trace.h" */ | ||
128 | #include <shlobj.h> | ||
129 | |||
130 | -void *qemu_try_memalign(size_t alignment, size_t size) | ||
131 | -{ | ||
132 | - void *ptr; | ||
133 | - | ||
134 | - if (alignment < sizeof(void *)) { | ||
135 | - alignment = sizeof(void *); | ||
136 | - } else { | ||
137 | - g_assert(is_power_of_2(alignment)); | ||
138 | - } | ||
139 | - if (size == 0) { | ||
140 | - size++; | ||
141 | - } | ||
142 | - ptr = _aligned_malloc(size, alignment); | ||
143 | - trace_qemu_memalign(alignment, size, ptr); | ||
144 | - return ptr; | ||
145 | -} | ||
146 | - | ||
147 | static int get_allocation_granularity(void) | ||
148 | { | ||
149 | SYSTEM_INFO system_info; | ||
150 | -- | 128 | -- |
151 | 2.25.1 | 129 | 2.34.1 |
152 | 130 | ||
153 | 131 | diff view generated by jsdifflib |
1 | The trace_gicv3_icv_hppir_read trace event takes an integer value | 1 | We removed the old table-based decoder in favour of decodetree, but |
---|---|---|---|
2 | which it uses to form the register name, which should be either | 2 | we left a couple of typedefs that are now unused; delete them. |
3 | ICV_HPPIR0 or ICV_HPPIR1. We were passing in the 'grp' variable for | ||
4 | this, but that is either GICV3_G0 or GICV3_G1NS, which happen to be 0 | ||
5 | and 2, which meant that tracing for the ICV_HPPIR1 register was | ||
6 | incorrectly printed as ICV_HPPIR2. | ||
7 | |||
8 | Use the same approach we do for all the other similar trace events, | ||
9 | and pass in 'ri->crm == 8 ? 0 : 1', deriving the index value | ||
10 | directly from the ARMCPRegInfo struct. | ||
11 | 3 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Message-id: 20220303202341.2232284-6-peter.maydell@linaro.org | 6 | Message-id: 20250128135046.4108775-1-peter.maydell@linaro.org |
15 | --- | 7 | --- |
16 | hw/intc/arm_gicv3_cpuif.c | 3 ++- | 8 | target/arm/tcg/translate-a64.c | 11 ----------- |
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | 9 | 1 file changed, 11 deletions(-) |
18 | 10 | ||
19 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 11 | diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c |
20 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/intc/arm_gicv3_cpuif.c | 13 | --- a/target/arm/tcg/translate-a64.c |
22 | +++ b/hw/intc/arm_gicv3_cpuif.c | 14 | +++ b/target/arm/tcg/translate-a64.c |
23 | @@ -XXX,XX +XXX,XX @@ static uint64_t icv_hppir_read(CPUARMState *env, const ARMCPRegInfo *ri) | 15 | @@ -XXX,XX +XXX,XX @@ static int scale_by_log2_tag_granule(DisasContext *s, int x) |
24 | } | 16 | #include "decode-sme-fa64.c.inc" |
25 | } | 17 | #include "decode-a64.c.inc" |
26 | 18 | ||
27 | - trace_gicv3_icv_hppir_read(grp, gicv3_redist_affid(cs), value); | 19 | -/* Table based decoder typedefs - used when the relevant bits for decode |
28 | + trace_gicv3_icv_hppir_read(ri->crm == 8 ? 0 : 1, | 20 | - * are too awkwardly scattered across the instruction (eg SIMD). |
29 | + gicv3_redist_affid(cs), value); | 21 | - */ |
30 | return value; | 22 | -typedef void AArch64DecodeFn(DisasContext *s, uint32_t insn); |
31 | } | 23 | - |
32 | 24 | -typedef struct AArch64DecodeTable { | |
25 | - uint32_t pattern; | ||
26 | - uint32_t mask; | ||
27 | - AArch64DecodeFn *disas_fn; | ||
28 | -} AArch64DecodeTable; | ||
29 | - | ||
30 | /* initialize TCG globals. */ | ||
31 | void a64_translate_init(void) | ||
32 | { | ||
33 | -- | 33 | -- |
34 | 2.25.1 | 34 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | There is a Linux kernel bug present until v5.12 that prevents | 3 | In heterogeneous setup the first vCPU might not be |
4 | booting with FEAT_LPA2 enabled. As a workaround for TCG, | 4 | the one expected, better pass it explicitly. |
5 | disable this feature for machine versions prior to 7.0. | ||
6 | 5 | ||
7 | Cc: Daniel P. Berrangé <berrange@redhat.com> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
8 | Message-id: 20250130112615.3219-2-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | 10 | --- |
12 | include/hw/arm/virt.h | 1 + | 11 | include/hw/arm/boot.h | 4 +++- |
13 | hw/arm/virt.c | 7 +++++++ | 12 | hw/arm/boot.c | 11 ++++++----- |
14 | 2 files changed, 8 insertions(+) | 13 | hw/arm/virt.c | 2 +- |
14 | 3 files changed, 10 insertions(+), 7 deletions(-) | ||
15 | 15 | ||
16 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | 16 | diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/virt.h | 18 | --- a/include/hw/arm/boot.h |
19 | +++ b/include/hw/arm/virt.h | 19 | +++ b/include/hw/arm/boot.h |
20 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineClass { | 20 | @@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, |
21 | bool no_secure_gpio; | 21 | * @binfo: struct describing the boot environment |
22 | /* Machines < 6.2 have no support for describing cpu topology to guest */ | 22 | * @addr_limit: upper limit of the available memory area at @addr |
23 | bool no_cpu_topology; | 23 | * @as: address space to load image to |
24 | + bool no_tcg_lpa2; | 24 | + * @cpu: ARM CPU object |
25 | }; | 25 | * |
26 | 26 | * Load a device tree supplied by the machine or by the user with the | |
27 | struct VirtMachineState { | 27 | * '-dtb' command line option, and put it at offset @addr in target |
28 | @@ -XXX,XX +XXX,XX @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, | ||
29 | * Note: Must not be called unless have_dtb(binfo) is true. | ||
30 | */ | ||
31 | int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
32 | - hwaddr addr_limit, AddressSpace *as, MachineState *ms); | ||
33 | + hwaddr addr_limit, AddressSpace *as, MachineState *ms, | ||
34 | + ARMCPU *cpu); | ||
35 | |||
36 | /* Write a secure board setup routine with a dummy handler for SMCs */ | ||
37 | void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, | ||
38 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/arm/boot.c | ||
41 | +++ b/hw/arm/boot.c | ||
42 | @@ -XXX,XX +XXX,XX @@ out: | ||
43 | return ret; | ||
44 | } | ||
45 | |||
46 | -static void fdt_add_psci_node(void *fdt) | ||
47 | +static void fdt_add_psci_node(void *fdt, ARMCPU *armcpu) | ||
48 | { | ||
49 | uint32_t cpu_suspend_fn; | ||
50 | uint32_t cpu_off_fn; | ||
51 | uint32_t cpu_on_fn; | ||
52 | uint32_t migrate_fn; | ||
53 | - ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); | ||
54 | const char *psci_method; | ||
55 | int64_t psci_conduit; | ||
56 | int rc; | ||
57 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_psci_node(void *fdt) | ||
58 | } | ||
59 | |||
60 | int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
61 | - hwaddr addr_limit, AddressSpace *as, MachineState *ms) | ||
62 | + hwaddr addr_limit, AddressSpace *as, MachineState *ms, | ||
63 | + ARMCPU *cpu) | ||
64 | { | ||
65 | void *fdt = NULL; | ||
66 | int size, rc, n = 0; | ||
67 | @@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, | ||
68 | } | ||
69 | } | ||
70 | |||
71 | - fdt_add_psci_node(fdt); | ||
72 | + fdt_add_psci_node(fdt, cpu); | ||
73 | |||
74 | if (binfo->modify_dtb) { | ||
75 | binfo->modify_dtb(binfo, fdt); | ||
76 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms, struct arm_boot_info *info) | ||
77 | * decided whether to enable PSCI and set the psci-conduit CPU properties. | ||
78 | */ | ||
79 | if (!info->skip_dtb_autoload && have_dtb(info)) { | ||
80 | - if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) { | ||
81 | + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, | ||
82 | + as, ms, cpu) < 0) { | ||
83 | exit(1); | ||
84 | } | ||
85 | } | ||
28 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 86 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
29 | index XXXXXXX..XXXXXXX 100644 | 87 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/hw/arm/virt.c | 88 | --- a/hw/arm/virt.c |
31 | +++ b/hw/arm/virt.c | 89 | +++ b/hw/arm/virt.c |
32 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 90 | @@ -XXX,XX +XXX,XX @@ void virt_machine_done(Notifier *notifier, void *data) |
33 | object_property_set_bool(cpuobj, "pmu", false, NULL); | 91 | vms->memmap[VIRT_PLATFORM_BUS].size, |
34 | } | 92 | vms->irqmap[VIRT_PLATFORM_BUS]); |
35 | 93 | } | |
36 | + if (vmc->no_tcg_lpa2 && object_property_find(cpuobj, "lpa2")) { | 94 | - if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) { |
37 | + object_property_set_bool(cpuobj, "lpa2", false, NULL); | 95 | + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms, cpu) < 0) { |
38 | + } | 96 | exit(1); |
39 | + | 97 | } |
40 | if (object_property_find(cpuobj, "reset-cbar")) { | ||
41 | object_property_set_int(cpuobj, "reset-cbar", | ||
42 | vms->memmap[VIRT_CPUPERIPHS].base, | ||
43 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 0) | ||
44 | |||
45 | static void virt_machine_6_2_options(MachineClass *mc) | ||
46 | { | ||
47 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
48 | + | ||
49 | virt_machine_7_0_options(mc); | ||
50 | compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); | ||
51 | + vmc->no_tcg_lpa2 = true; | ||
52 | } | ||
53 | DEFINE_VIRT_MACHINE(6, 2) | ||
54 | 98 | ||
55 | -- | 99 | -- |
56 | 2.25.1 | 100 | 2.34.1 |
57 | 101 | ||
58 | 102 | diff view generated by jsdifflib |
1 | Currently we incorrectly think that posix_memalign() exists on | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | Windows. This is because of a combination of: | ||
3 | 2 | ||
4 | * the msys2/mingw toolchain/libc claim to have a | 3 | The A9MPCore forward the IRQs from its internal GIC. |
5 | __builtin_posix_memalign when there isn't a builtin of that name | 4 | To make the code clearer, add the 'mpcore' and 'gic' |
6 | * meson will assume that if you have a __builtin_foo that | 5 | variables. |
7 | counts for has_function('foo') | ||
8 | 6 | ||
9 | Specifying a specific include file via prefix: causes meson to not | 7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
10 | treat builtins as sufficient and actually look for the function | 8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | itself; see this meson pull request which added that as the official | 9 | Message-id: 20250130112615.3219-3-philmd@linaro.org |
12 | way to get the right answer: | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | https://github.com/mesonbuild/meson/pull/1150 | 11 | --- |
12 | hw/arm/fsl-imx6.c | 52 +++++++++++++++++++---------------------------- | ||
13 | 1 file changed, 21 insertions(+), 31 deletions(-) | ||
14 | 14 | ||
15 | Currently this misdectection doesn't cause problems because we only | 15 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c |
16 | use CONFIG_POSIX_MEMALIGN in oslib-posix.c; however that will change | ||
17 | in a following commit. | ||
18 | |||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
21 | Message-id: 20220226180723.1706285-6-peter.maydell@linaro.org | ||
22 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
23 | --- | ||
24 | meson.build | 4 +++- | ||
25 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
26 | |||
27 | diff --git a/meson.build b/meson.build | ||
28 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/meson.build | 17 | --- a/hw/arm/fsl-imx6.c |
30 | +++ b/meson.build | 18 | +++ b/hw/arm/fsl-imx6.c |
31 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('CONFIG_CLOCK_ADJTIME', cc.has_function('clock_adjtime')) | 19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) |
32 | config_host_data.set('CONFIG_DUP3', cc.has_function('dup3')) | 20 | uint16_t i; |
33 | config_host_data.set('CONFIG_FALLOCATE', cc.has_function('fallocate')) | 21 | qemu_irq irq; |
34 | config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fallocate')) | 22 | unsigned int smp_cpus = ms->smp.cpus; |
35 | -config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign')) | 23 | + DeviceState *mpcore = DEVICE(&s->a9mpcore); |
36 | +# Note that we need to specify prefix: here to avoid incorrectly | 24 | + DeviceState *gic; |
37 | +# thinking that Windows has posix_memalign() | 25 | |
38 | +config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign', prefix: '#include <stdlib.h>')) | 26 | if (smp_cpus > FSL_IMX6_NUM_CPUS) { |
39 | config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) | 27 | error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", |
40 | config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | 28 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) |
41 | config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwait', dependencies: threads)) | 29 | } |
30 | } | ||
31 | |||
32 | - object_property_set_int(OBJECT(&s->a9mpcore), "num-cpu", smp_cpus, | ||
33 | - &error_abort); | ||
34 | + object_property_set_int(OBJECT(mpcore), "num-cpu", smp_cpus, &error_abort); | ||
35 | |||
36 | - object_property_set_int(OBJECT(&s->a9mpcore), "num-irq", | ||
37 | + object_property_set_int(OBJECT(mpcore), "num-irq", | ||
38 | FSL_IMX6_MAX_IRQ + GIC_INTERNAL, &error_abort); | ||
39 | |||
40 | - if (!sysbus_realize(SYS_BUS_DEVICE(&s->a9mpcore), errp)) { | ||
41 | + if (!sysbus_realize(SYS_BUS_DEVICE(mpcore), errp)) { | ||
42 | return; | ||
43 | } | ||
44 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->a9mpcore), 0, FSL_IMX6_A9MPCORE_ADDR); | ||
45 | + sysbus_mmio_map(SYS_BUS_DEVICE(mpcore), 0, FSL_IMX6_A9MPCORE_ADDR); | ||
46 | |||
47 | + gic = mpcore; | ||
48 | for (i = 0; i < smp_cpus; i++) { | ||
49 | - sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i, | ||
50 | + sysbus_connect_irq(SYS_BUS_DEVICE(gic), i, | ||
51 | qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_IRQ)); | ||
52 | - sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i + smp_cpus, | ||
53 | + sysbus_connect_irq(SYS_BUS_DEVICE(gic), i + smp_cpus, | ||
54 | qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_FIQ)); | ||
55 | } | ||
56 | |||
57 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
58 | |||
59 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, serial_table[i].addr); | ||
60 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0, | ||
61 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
62 | - serial_table[i].irq)); | ||
63 | + qdev_get_gpio_in(gic, serial_table[i].irq)); | ||
64 | } | ||
65 | |||
66 | s->gpt.ccm = IMX_CCM(&s->ccm); | ||
67 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
68 | |||
69 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt), 0, FSL_IMX6_GPT_ADDR); | ||
70 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt), 0, | ||
71 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
72 | - FSL_IMX6_GPT_IRQ)); | ||
73 | + qdev_get_gpio_in(gic, FSL_IMX6_GPT_IRQ)); | ||
74 | |||
75 | /* Initialize all EPIT timers */ | ||
76 | for (i = 0; i < FSL_IMX6_NUM_EPITS; i++) { | ||
77 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
78 | |||
79 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->epit[i]), 0, epit_table[i].addr); | ||
80 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0, | ||
81 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
82 | - epit_table[i].irq)); | ||
83 | + qdev_get_gpio_in(gic, epit_table[i].irq)); | ||
84 | } | ||
85 | |||
86 | /* Initialize all I2C */ | ||
87 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
88 | |||
89 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, i2c_table[i].addr); | ||
90 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0, | ||
91 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
92 | - i2c_table[i].irq)); | ||
93 | + qdev_get_gpio_in(gic, i2c_table[i].irq)); | ||
94 | } | ||
95 | |||
96 | /* Initialize all GPIOs */ | ||
97 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
98 | |||
99 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr); | ||
100 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, | ||
101 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
102 | - gpio_table[i].irq_low)); | ||
103 | + qdev_get_gpio_in(gic, gpio_table[i].irq_low)); | ||
104 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1, | ||
105 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
106 | - gpio_table[i].irq_high)); | ||
107 | + qdev_get_gpio_in(gic, gpio_table[i].irq_high)); | ||
108 | } | ||
109 | |||
110 | /* Initialize all SDHC */ | ||
111 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
112 | } | ||
113 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->esdhc[i]), 0, esdhc_table[i].addr); | ||
114 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->esdhc[i]), 0, | ||
115 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
116 | - esdhc_table[i].irq)); | ||
117 | + qdev_get_gpio_in(gic, esdhc_table[i].irq)); | ||
118 | } | ||
119 | |||
120 | /* USB */ | ||
121 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
122 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
123 | FSL_IMX6_USBOH3_USB_ADDR + i * 0x200); | ||
124 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
125 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
126 | - FSL_IMX6_USBn_IRQ[i])); | ||
127 | + qdev_get_gpio_in(gic, FSL_IMX6_USBn_IRQ[i])); | ||
128 | } | ||
129 | |||
130 | /* Initialize all ECSPI */ | ||
131 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
132 | |||
133 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, spi_table[i].addr); | ||
134 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, | ||
135 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
136 | - spi_table[i].irq)); | ||
137 | + qdev_get_gpio_in(gic, spi_table[i].irq)); | ||
138 | } | ||
139 | |||
140 | object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, | ||
141 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
142 | } | ||
143 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth), 0, FSL_IMX6_ENET_ADDR); | ||
144 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth), 0, | ||
145 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
146 | - FSL_IMX6_ENET_MAC_IRQ)); | ||
147 | + qdev_get_gpio_in(gic, FSL_IMX6_ENET_MAC_IRQ)); | ||
148 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth), 1, | ||
149 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
150 | - FSL_IMX6_ENET_MAC_1588_IRQ)); | ||
151 | + qdev_get_gpio_in(gic, FSL_IMX6_ENET_MAC_1588_IRQ)); | ||
152 | |||
153 | /* | ||
154 | * SNVS | ||
155 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
156 | |||
157 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]); | ||
158 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0, | ||
159 | - qdev_get_gpio_in(DEVICE(&s->a9mpcore), | ||
160 | - FSL_IMX6_WDOGn_IRQ[i])); | ||
161 | + qdev_get_gpio_in(gic, FSL_IMX6_WDOGn_IRQ[i])); | ||
162 | } | ||
163 | |||
164 | /* | ||
42 | -- | 165 | -- |
43 | 2.25.1 | 166 | 2.34.1 |
44 | 167 | ||
45 | 168 | diff view generated by jsdifflib |
1 | For debugging guest use of the ITS, it can be helpful to trace | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | when the ITS reads and writes the in-memory tables. | ||
3 | 2 | ||
3 | The A7MPCore forward the IRQs from its internal GIC. | ||
4 | To make the code clearer, add the 'mpcore' and 'gic' | ||
5 | variables. Rename 'd' variable as 'cpu'. | ||
6 | |||
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Message-id: 20250130112615.3219-4-philmd@linaro.org | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20220303202341.2232284-3-peter.maydell@linaro.org | ||
7 | --- | 11 | --- |
8 | hw/intc/arm_gicv3_its.c | 37 +++++++++++++++++++++++++++++++------ | 12 | hw/arm/fsl-imx6ul.c | 64 +++++++++++++++++++-------------------------- |
9 | hw/intc/trace-events | 9 +++++++++ | 13 | 1 file changed, 27 insertions(+), 37 deletions(-) |
10 | 2 files changed, 40 insertions(+), 6 deletions(-) | ||
11 | 14 | ||
12 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c | 15 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/intc/arm_gicv3_its.c | 17 | --- a/hw/arm/fsl-imx6ul.c |
15 | +++ b/hw/intc/arm_gicv3_its.c | 18 | +++ b/hw/arm/fsl-imx6ul.c |
16 | @@ -XXX,XX +XXX,XX @@ static MemTxResult get_cte(GICv3ITSState *s, uint16_t icid, CTEntry *cte) | 19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
17 | if (entry_addr == -1) { | 20 | { |
18 | /* No L2 table entry, i.e. no valid CTE, or a memory error */ | 21 | MachineState *ms = MACHINE(qdev_get_machine()); |
19 | cte->valid = false; | 22 | FslIMX6ULState *s = FSL_IMX6UL(dev); |
20 | - return res; | 23 | + DeviceState *mpcore = DEVICE(&s->a7mpcore); |
21 | + goto out; | 24 | int i; |
25 | char name[NAME_SIZE]; | ||
26 | - SysBusDevice *sbd; | ||
27 | - DeviceState *d; | ||
28 | + DeviceState *gic; | ||
29 | + SysBusDevice *gicsbd; | ||
30 | + DeviceState *cpu; | ||
31 | |||
32 | if (ms->smp.cpus > 1) { | ||
33 | error_setg(errp, "%s: Only a single CPU is supported (%d requested)", | ||
34 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
35 | /* | ||
36 | * A7MPCORE | ||
37 | */ | ||
38 | - object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", 1, &error_abort); | ||
39 | - object_property_set_int(OBJECT(&s->a7mpcore), "num-irq", | ||
40 | + object_property_set_int(OBJECT(mpcore), "num-cpu", 1, &error_abort); | ||
41 | + object_property_set_int(OBJECT(mpcore), "num-irq", | ||
42 | FSL_IMX6UL_MAX_IRQ + GIC_INTERNAL, &error_abort); | ||
43 | - sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort); | ||
44 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR); | ||
45 | + sysbus_realize(SYS_BUS_DEVICE(mpcore), &error_abort); | ||
46 | + sysbus_mmio_map(SYS_BUS_DEVICE(mpcore), 0, FSL_IMX6UL_A7MPCORE_ADDR); | ||
47 | |||
48 | - sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
49 | - d = DEVICE(&s->cpu); | ||
50 | - | ||
51 | - sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(d, ARM_CPU_IRQ)); | ||
52 | - sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(d, ARM_CPU_FIQ)); | ||
53 | - sysbus_connect_irq(sbd, 2, qdev_get_gpio_in(d, ARM_CPU_VIRQ)); | ||
54 | - sysbus_connect_irq(sbd, 3, qdev_get_gpio_in(d, ARM_CPU_VFIQ)); | ||
55 | + gic = mpcore; | ||
56 | + gicsbd = SYS_BUS_DEVICE(gic); | ||
57 | + cpu = DEVICE(&s->cpu); | ||
58 | + sysbus_connect_irq(gicsbd, 0, qdev_get_gpio_in(cpu, ARM_CPU_IRQ)); | ||
59 | + sysbus_connect_irq(gicsbd, 1, qdev_get_gpio_in(cpu, ARM_CPU_FIQ)); | ||
60 | + sysbus_connect_irq(gicsbd, 2, qdev_get_gpio_in(cpu, ARM_CPU_VIRQ)); | ||
61 | + sysbus_connect_irq(gicsbd, 3, qdev_get_gpio_in(cpu, ARM_CPU_VFIQ)); | ||
62 | |||
63 | /* | ||
64 | * A7MPCORE DAP | ||
65 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | ||
66 | FSL_IMX6UL_GPTn_ADDR[i]); | ||
67 | |||
68 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0, | ||
69 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
70 | - FSL_IMX6UL_GPTn_IRQ[i])); | ||
71 | + qdev_get_gpio_in(gic, FSL_IMX6UL_GPTn_IRQ[i])); | ||
22 | } | 72 | } |
23 | 73 | ||
24 | cteval = address_space_ldq_le(as, entry_addr, MEMTXATTRS_UNSPECIFIED, &res); | 74 | /* |
25 | if (res != MEMTX_OK) { | 75 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
26 | - return res; | 76 | FSL_IMX6UL_EPITn_ADDR[i]); |
27 | + goto out; | 77 | |
78 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->epit[i]), 0, | ||
79 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
80 | - FSL_IMX6UL_EPITn_IRQ[i])); | ||
81 | + qdev_get_gpio_in(gic, FSL_IMX6UL_EPITn_IRQ[i])); | ||
28 | } | 82 | } |
29 | cte->valid = FIELD_EX64(cteval, CTE, VALID); | 83 | |
30 | cte->rdbase = FIELD_EX64(cteval, CTE, RDBASE); | 84 | /* |
31 | - return MEMTX_OK; | 85 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
32 | +out: | 86 | FSL_IMX6UL_GPIOn_ADDR[i]); |
33 | + if (res != MEMTX_OK) { | 87 | |
34 | + trace_gicv3_its_cte_read_fault(icid); | 88 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, |
35 | + } else { | 89 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
36 | + trace_gicv3_its_cte_read(icid, cte->valid, cte->rdbase); | 90 | - FSL_IMX6UL_GPIOn_LOW_IRQ[i])); |
37 | + } | 91 | + qdev_get_gpio_in(gic, FSL_IMX6UL_GPIOn_LOW_IRQ[i])); |
38 | + return res; | 92 | |
39 | } | 93 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1, |
40 | 94 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | |
41 | /* | 95 | - FSL_IMX6UL_GPIOn_HIGH_IRQ[i])); |
42 | @@ -XXX,XX +XXX,XX @@ static bool update_ite(GICv3ITSState *s, uint32_t eventid, const DTEntry *dte, | 96 | + qdev_get_gpio_in(gic, FSL_IMX6UL_GPIOn_HIGH_IRQ[i])); |
43 | uint64_t itel = 0; | ||
44 | uint32_t iteh = 0; | ||
45 | |||
46 | + trace_gicv3_its_ite_write(dte->ittaddr, eventid, ite->valid, | ||
47 | + ite->inttype, ite->intid, ite->icid, | ||
48 | + ite->vpeid, ite->doorbell); | ||
49 | + | ||
50 | if (ite->valid) { | ||
51 | itel = FIELD_DP64(itel, ITE_L, VALID, 1); | ||
52 | itel = FIELD_DP64(itel, ITE_L, INTTYPE, ite->inttype); | ||
53 | @@ -XXX,XX +XXX,XX @@ static MemTxResult get_ite(GICv3ITSState *s, uint32_t eventid, | ||
54 | |||
55 | itel = address_space_ldq_le(as, iteaddr, MEMTXATTRS_UNSPECIFIED, &res); | ||
56 | if (res != MEMTX_OK) { | ||
57 | + trace_gicv3_its_ite_read_fault(dte->ittaddr, eventid); | ||
58 | return res; | ||
59 | } | 97 | } |
60 | 98 | ||
61 | iteh = address_space_ldl_le(as, iteaddr + 8, MEMTXATTRS_UNSPECIFIED, &res); | 99 | /* |
62 | if (res != MEMTX_OK) { | 100 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
63 | + trace_gicv3_its_ite_read_fault(dte->ittaddr, eventid); | 101 | FSL_IMX6UL_SPIn_ADDR[i]); |
64 | return res; | 102 | |
103 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, | ||
104 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
105 | - FSL_IMX6UL_SPIn_IRQ[i])); | ||
106 | + qdev_get_gpio_in(gic, FSL_IMX6UL_SPIn_IRQ[i])); | ||
65 | } | 107 | } |
66 | 108 | ||
67 | @@ -XXX,XX +XXX,XX @@ static MemTxResult get_ite(GICv3ITSState *s, uint32_t eventid, | 109 | /* |
68 | ite->icid = FIELD_EX64(itel, ITE_L, ICID); | 110 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
69 | ite->vpeid = FIELD_EX64(itel, ITE_L, VPEID); | 111 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, FSL_IMX6UL_I2Cn_ADDR[i]); |
70 | ite->doorbell = FIELD_EX64(iteh, ITE_H, DOORBELL); | 112 | |
71 | + trace_gicv3_its_ite_read(dte->ittaddr, eventid, ite->valid, | 113 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0, |
72 | + ite->inttype, ite->intid, ite->icid, | 114 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
73 | + ite->vpeid, ite->doorbell); | 115 | - FSL_IMX6UL_I2Cn_IRQ[i])); |
74 | return MEMTX_OK; | 116 | + qdev_get_gpio_in(gic, FSL_IMX6UL_I2Cn_IRQ[i])); |
75 | } | ||
76 | |||
77 | @@ -XXX,XX +XXX,XX @@ static MemTxResult get_dte(GICv3ITSState *s, uint32_t devid, DTEntry *dte) | ||
78 | if (entry_addr == -1) { | ||
79 | /* No L2 table entry, i.e. no valid DTE, or a memory error */ | ||
80 | dte->valid = false; | ||
81 | - return res; | ||
82 | + goto out; | ||
83 | } | 117 | } |
84 | dteval = address_space_ldq_le(as, entry_addr, MEMTXATTRS_UNSPECIFIED, &res); | 118 | |
85 | if (res != MEMTX_OK) { | 119 | /* |
86 | - return res; | 120 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
87 | + goto out; | 121 | FSL_IMX6UL_UARTn_ADDR[i]); |
122 | |||
123 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0, | ||
124 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
125 | - FSL_IMX6UL_UARTn_IRQ[i])); | ||
126 | + qdev_get_gpio_in(gic, FSL_IMX6UL_UARTn_IRQ[i])); | ||
88 | } | 127 | } |
89 | dte->valid = FIELD_EX64(dteval, DTE, VALID); | 128 | |
90 | dte->size = FIELD_EX64(dteval, DTE, SIZE); | 129 | /* |
91 | /* DTE word field stores bits [51:8] of the ITT address */ | 130 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
92 | dte->ittaddr = FIELD_EX64(dteval, DTE, ITTADDR) << ITTADDR_SHIFT; | 131 | FSL_IMX6UL_ENETn_ADDR[i]); |
93 | - return MEMTX_OK; | 132 | |
94 | +out: | 133 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 0, |
95 | + if (res != MEMTX_OK) { | 134 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
96 | + trace_gicv3_its_dte_read_fault(devid); | 135 | - FSL_IMX6UL_ENETn_IRQ[i])); |
97 | + } else { | 136 | + qdev_get_gpio_in(gic, FSL_IMX6UL_ENETn_IRQ[i])); |
98 | + trace_gicv3_its_dte_read(devid, dte->valid, dte->size, dte->ittaddr); | 137 | |
99 | + } | 138 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 1, |
100 | + return res; | 139 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
101 | } | 140 | - FSL_IMX6UL_ENETn_TIMER_IRQ[i])); |
102 | 141 | + qdev_get_gpio_in(gic, FSL_IMX6UL_ENETn_TIMER_IRQ[i])); | |
103 | /* | 142 | } |
104 | @@ -XXX,XX +XXX,XX @@ static bool update_cte(GICv3ITSState *s, uint16_t icid, const CTEntry *cte) | 143 | |
105 | uint64_t cteval = 0; | 144 | /* |
106 | MemTxResult res = MEMTX_OK; | 145 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
107 | 146 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, | |
108 | + trace_gicv3_its_cte_write(icid, cte->valid, cte->rdbase); | 147 | FSL_IMX6UL_USB02_USBn_ADDR[i]); |
109 | + | 148 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, |
110 | if (cte->valid) { | 149 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
111 | /* add mapping entry to collection table */ | 150 | - FSL_IMX6UL_USBn_IRQ[i])); |
112 | cteval = FIELD_DP64(cteval, CTE, VALID, 1); | 151 | + qdev_get_gpio_in(gic, FSL_IMX6UL_USBn_IRQ[i])); |
113 | @@ -XXX,XX +XXX,XX @@ static bool update_dte(GICv3ITSState *s, uint32_t devid, const DTEntry *dte) | 152 | } |
114 | uint64_t dteval = 0; | 153 | |
115 | MemTxResult res = MEMTX_OK; | 154 | /* |
116 | 155 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) | |
117 | + trace_gicv3_its_dte_write(devid, dte->valid, dte->size, dte->ittaddr); | 156 | FSL_IMX6UL_USDHCn_ADDR[i]); |
118 | + | 157 | |
119 | if (dte->valid) { | 158 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0, |
120 | /* add mapping entry to device table */ | 159 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
121 | dteval = FIELD_DP64(dteval, DTE, VALID, 1); | 160 | - FSL_IMX6UL_USDHCn_IRQ[i])); |
122 | diff --git a/hw/intc/trace-events b/hw/intc/trace-events | 161 | + qdev_get_gpio_in(gic, FSL_IMX6UL_USDHCn_IRQ[i])); |
123 | index XXXXXXX..XXXXXXX 100644 | 162 | } |
124 | --- a/hw/intc/trace-events | 163 | |
125 | +++ b/hw/intc/trace-events | 164 | /* |
126 | @@ -XXX,XX +XXX,XX @@ gicv3_its_cmd_inv(void) "GICv3 ITS: command INV or INVALL" | 165 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) |
127 | gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVALL RDbase1 0x%" PRIx64 " RDbase2 0x%" PRIx64 | 166 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, |
128 | gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" | 167 | FSL_IMX6UL_WDOGn_ADDR[i]); |
129 | gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" | 168 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0, |
130 | +gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" | 169 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
131 | +gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" | 170 | - FSL_IMX6UL_WDOGn_IRQ[i])); |
132 | +gicv3_its_cte_read_fault(uint32_t icid) "GICv3 ITS: Collection Table read for ICID 0x%x: faulted" | 171 | + qdev_get_gpio_in(gic, FSL_IMX6UL_WDOGn_IRQ[i])); |
133 | +gicv3_its_ite_read(uint64_t ittaddr, uint32_t eventid, int valid, int inttype, uint32_t intid, uint32_t icid, uint32_t vpeid, uint32_t doorbell) "GICv3 ITS: Interrupt Table read for ITTaddr 0x%" PRIx64 " EventID 0x%x: valid %d inttype %d intid 0x%x ICID 0x%x vPEID 0x%x doorbell 0x%x" | 172 | } |
134 | +gicv3_its_ite_read_fault(uint64_t ittaddr, uint32_t eventid) "GICv3 ITS: Interrupt Table read for ITTaddr 0x%" PRIx64 " EventID 0x%x: faulted" | 173 | |
135 | +gicv3_its_ite_write(uint64_t ittaddr, uint32_t eventid, int valid, int inttype, uint32_t intid, uint32_t icid, uint32_t vpeid, uint32_t doorbell) "GICv3 ITS: Interrupt Table write for ITTaddr 0x%" PRIx64 " EventID 0x%x: valid %d inttype %d intid 0x%x ICID 0x%x vPEID 0x%x doorbell 0x%x" | 174 | /* |
136 | +gicv3_its_dte_read(uint32_t devid, int valid, uint32_t size, uint64_t ittaddr) "GICv3 ITS: Device Table read for DeviceID 0x%x: valid %d size 0x%x ITTaddr 0x%" PRIx64 | ||
137 | +gicv3_its_dte_write(uint32_t devid, int valid, uint32_t size, uint64_t ittaddr) "GICv3 ITS: Device Table write for DeviceID 0x%x: valid %d size 0x%x ITTaddr 0x%" PRIx64 | ||
138 | +gicv3_its_dte_read_fault(uint32_t devid) "GICv3 ITS: Device Table read for DeviceID 0x%x: faulted" | ||
139 | |||
140 | # armv7m_nvic.c | ||
141 | nvic_recompute_state(int vectpending, int vectpending_prio, int exception_prio) "NVIC state recomputed: vectpending %d vectpending_prio %d exception_prio %d" | ||
142 | -- | 175 | -- |
143 | 2.25.1 | 176 | 2.34.1 |
177 | |||
178 | diff view generated by jsdifflib |
1 | Currently qemu_try_memalign()'s behaviour if asked to allocate | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 0 bytes is rather variable: | ||
3 | * on Windows, we will assert | ||
4 | * on POSIX platforms, we get the underlying behaviour of | ||
5 | the posix_memalign() or equivalent function, which may be | ||
6 | either "return a valid non-NULL pointer" or "return NULL" | ||
7 | 2 | ||
8 | Explictly check for 0 byte allocations, so we get consistent | 3 | The A7MPCore forward the IRQs from its internal GIC. |
9 | behaviour across platforms. We handle them by incrementing the size | 4 | To make the code clearer, add the 'mpcore' and 'gic' |
10 | so that we return a valid non-NULL pointer that can later be passed | 5 | variables. |
11 | to qemu_vfree(). This is permitted behaviour for the | ||
12 | posix_memalign() API and is the most usual way that underlying | ||
13 | malloc() etc implementations handle a zero-sized allocation request, | ||
14 | because it won't trip up calling code that assumes NULL means an | ||
15 | error. (This includes our own qemu_memalign(), which will abort on | ||
16 | NULL.) | ||
17 | 6 | ||
18 | This change is a preparation for sharing the qemu_try_memalign() code | 7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
19 | between Windows and POSIX. | 8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Message-id: 20250130112615.3219-5-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/fsl-imx7.c | 52 +++++++++++++++++++++-------------------------- | ||
13 | 1 file changed, 23 insertions(+), 29 deletions(-) | ||
20 | 14 | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c |
22 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
23 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
24 | --- | ||
25 | util/oslib-posix.c | 3 +++ | ||
26 | util/oslib-win32.c | 4 +++- | ||
27 | 2 files changed, 6 insertions(+), 1 deletion(-) | ||
28 | |||
29 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/util/oslib-posix.c | 17 | --- a/hw/arm/fsl-imx7.c |
32 | +++ b/util/oslib-posix.c | 18 | +++ b/hw/arm/fsl-imx7.c |
33 | @@ -XXX,XX +XXX,XX @@ void *qemu_try_memalign(size_t alignment, size_t size) | 19 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) |
34 | g_assert(is_power_of_2(alignment)); | 20 | { |
21 | MachineState *ms = MACHINE(qdev_get_machine()); | ||
22 | FslIMX7State *s = FSL_IMX7(dev); | ||
23 | - Object *o; | ||
24 | + DeviceState *mpcore = DEVICE(&s->a7mpcore); | ||
25 | + DeviceState *gic; | ||
26 | int i; | ||
27 | qemu_irq irq; | ||
28 | char name[NAME_SIZE]; | ||
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
30 | * CPUs | ||
31 | */ | ||
32 | for (i = 0; i < smp_cpus; i++) { | ||
33 | - o = OBJECT(&s->cpu[i]); | ||
34 | + Object *o = OBJECT(&s->cpu[i]); | ||
35 | |||
36 | /* On uniprocessor, the CBAR is set to 0 */ | ||
37 | if (smp_cpus > 1) { | ||
38 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
39 | /* | ||
40 | * A7MPCORE | ||
41 | */ | ||
42 | - object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", smp_cpus, | ||
43 | - &error_abort); | ||
44 | - object_property_set_int(OBJECT(&s->a7mpcore), "num-irq", | ||
45 | + object_property_set_int(OBJECT(mpcore), "num-cpu", smp_cpus, &error_abort); | ||
46 | + object_property_set_int(OBJECT(mpcore), "num-irq", | ||
47 | FSL_IMX7_MAX_IRQ + GIC_INTERNAL, &error_abort); | ||
48 | + sysbus_realize(SYS_BUS_DEVICE(mpcore), &error_abort); | ||
49 | + sysbus_mmio_map(SYS_BUS_DEVICE(mpcore), 0, FSL_IMX7_A7MPCORE_ADDR); | ||
50 | |||
51 | - sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort); | ||
52 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->a7mpcore), 0, FSL_IMX7_A7MPCORE_ADDR); | ||
53 | - | ||
54 | + gic = mpcore; | ||
55 | for (i = 0; i < smp_cpus; i++) { | ||
56 | - SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
57 | + SysBusDevice *sbd = SYS_BUS_DEVICE(gic); | ||
58 | DeviceState *d = DEVICE(qemu_get_cpu(i)); | ||
59 | |||
60 | irq = qdev_get_gpio_in(d, ARM_CPU_IRQ); | ||
61 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
62 | sysbus_realize(SYS_BUS_DEVICE(&s->gpt[i]), &error_abort); | ||
63 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, FSL_IMX7_GPTn_ADDR[i]); | ||
64 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0, | ||
65 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
66 | - FSL_IMX7_GPTn_IRQ[i])); | ||
67 | + qdev_get_gpio_in(gic, FSL_IMX7_GPTn_IRQ[i])); | ||
35 | } | 68 | } |
36 | 69 | ||
37 | + if (size == 0) { | 70 | /* |
38 | + size++; | 71 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) |
39 | + } | 72 | FSL_IMX7_GPIOn_ADDR[i]); |
40 | #if defined(CONFIG_POSIX_MEMALIGN) | 73 | |
41 | int ret; | 74 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0, |
42 | ret = posix_memalign(&ptr, alignment, size); | 75 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
43 | diff --git a/util/oslib-win32.c b/util/oslib-win32.c | 76 | - FSL_IMX7_GPIOn_LOW_IRQ[i])); |
44 | index XXXXXXX..XXXXXXX 100644 | 77 | + qdev_get_gpio_in(gic, FSL_IMX7_GPIOn_LOW_IRQ[i])); |
45 | --- a/util/oslib-win32.c | 78 | |
46 | +++ b/util/oslib-win32.c | 79 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1, |
47 | @@ -XXX,XX +XXX,XX @@ void *qemu_try_memalign(size_t alignment, size_t size) | 80 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), |
48 | { | 81 | - FSL_IMX7_GPIOn_HIGH_IRQ[i])); |
49 | void *ptr; | 82 | + qdev_get_gpio_in(gic, FSL_IMX7_GPIOn_HIGH_IRQ[i])); |
50 | |||
51 | - g_assert(size != 0); | ||
52 | if (alignment < sizeof(void *)) { | ||
53 | alignment = sizeof(void *); | ||
54 | } else { | ||
55 | g_assert(is_power_of_2(alignment)); | ||
56 | } | 83 | } |
57 | + if (size == 0) { | 84 | |
58 | + size++; | 85 | /* |
59 | + } | 86 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) |
60 | ptr = _aligned_malloc(size, alignment); | 87 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, |
61 | trace_qemu_memalign(alignment, size, ptr); | 88 | FSL_IMX7_SPIn_ADDR[i]); |
62 | return ptr; | 89 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi[i]), 0, |
90 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
91 | - FSL_IMX7_SPIn_IRQ[i])); | ||
92 | + qdev_get_gpio_in(gic, FSL_IMX7_SPIn_IRQ[i])); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
97 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c[i]), 0, FSL_IMX7_I2Cn_ADDR[i]); | ||
98 | |||
99 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c[i]), 0, | ||
100 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
101 | - FSL_IMX7_I2Cn_IRQ[i])); | ||
102 | + qdev_get_gpio_in(gic, FSL_IMX7_I2Cn_IRQ[i])); | ||
103 | } | ||
104 | |||
105 | /* | ||
106 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
107 | |||
108 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->uart[i]), 0, FSL_IMX7_UARTn_ADDR[i]); | ||
109 | |||
110 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_UARTn_IRQ[i]); | ||
111 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_UARTn_IRQ[i]); | ||
112 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart[i]), 0, irq); | ||
113 | } | ||
114 | |||
115 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
116 | |||
117 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0, FSL_IMX7_ENETn_ADDR[i]); | ||
118 | |||
119 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_ENET_IRQ(i, 0)); | ||
120 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_ENET_IRQ(i, 0)); | ||
121 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 0, irq); | ||
122 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_ENET_IRQ(i, 3)); | ||
123 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_ENET_IRQ(i, 3)); | ||
124 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->eth[i]), 1, irq); | ||
125 | } | ||
126 | |||
127 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
128 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->usdhc[i]), 0, | ||
129 | FSL_IMX7_USDHCn_ADDR[i]); | ||
130 | |||
131 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_USDHCn_IRQ[i]); | ||
132 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_USDHCn_IRQ[i]); | ||
133 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->usdhc[i]), 0, irq); | ||
134 | } | ||
135 | |||
136 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
137 | |||
138 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX7_WDOGn_ADDR[i]); | ||
139 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0, | ||
140 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
141 | - FSL_IMX7_WDOGn_IRQ[i])); | ||
142 | + qdev_get_gpio_in(gic, FSL_IMX7_WDOGn_IRQ[i])); | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
147 | irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTD_MSI_IRQ); | ||
148 | qdev_connect_gpio_out(DEVICE(&s->pcie4_msi_irq), 0, irq); | ||
149 | |||
150 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTA_IRQ); | ||
151 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_PCI_INTA_IRQ); | ||
152 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 0, irq); | ||
153 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTB_IRQ); | ||
154 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_PCI_INTB_IRQ); | ||
155 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 1, irq); | ||
156 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTC_IRQ); | ||
157 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_PCI_INTC_IRQ); | ||
158 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 2, irq); | ||
159 | irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 0); | ||
160 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq); | ||
161 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | ||
162 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, | ||
163 | FSL_IMX7_USBn_ADDR[i]); | ||
164 | |||
165 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_USBn_IRQ[i]); | ||
166 | + irq = qdev_get_gpio_in(gic, FSL_IMX7_USBn_IRQ[i]); | ||
167 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0, irq); | ||
168 | |||
169 | snprintf(name, NAME_SIZE, "usbmisc%d", i); | ||
63 | -- | 170 | -- |
64 | 2.25.1 | 171 | 2.34.1 |
65 | 172 | ||
66 | 173 | diff view generated by jsdifflib |
1 | The qemu_oom_check() function, which we define in both oslib-posix.c | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | and oslib-win32.c, is now used only locally in that file; make it | ||
3 | static. | ||
4 | 2 | ||
3 | No need to duplicate and forward the 'num-cpu' property from | ||
4 | TYPE_ARM11MPCORE_PRIV to TYPE_REALVIEW_MPCORE, alias it with | ||
5 | QOM object_property_add_alias(). | ||
6 | |||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
9 | Message-id: 20250130112615.3219-6-philmd@linaro.org | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20220226180723.1706285-3-peter.maydell@linaro.org | ||
9 | --- | 11 | --- |
10 | include/qemu-common.h | 2 -- | 12 | hw/cpu/realview_mpcore.c | 8 +------- |
11 | util/oslib-posix.c | 2 +- | 13 | 1 file changed, 1 insertion(+), 7 deletions(-) |
12 | util/oslib-win32.c | 2 +- | ||
13 | 3 files changed, 2 insertions(+), 4 deletions(-) | ||
14 | 14 | ||
15 | diff --git a/include/qemu-common.h b/include/qemu-common.h | 15 | diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/qemu-common.h | 17 | --- a/hw/cpu/realview_mpcore.c |
18 | +++ b/include/qemu-common.h | 18 | +++ b/hw/cpu/realview_mpcore.c |
19 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
20 | int qemu_main(int argc, char **argv, char **envp); | 20 | #include "hw/cpu/arm11mpcore.h" |
21 | #endif | 21 | #include "hw/intc/realview_gic.h" |
22 | 22 | #include "hw/irq.h" | |
23 | -void *qemu_oom_check(void *ptr); | 23 | -#include "hw/qdev-properties.h" |
24 | #include "qom/object.h" | ||
25 | |||
26 | #define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore" | ||
27 | @@ -XXX,XX +XXX,XX @@ static void realview_mpcore_realize(DeviceState *dev, Error **errp) | ||
28 | int n; | ||
29 | int i; | ||
30 | |||
31 | - qdev_prop_set_uint32(priv, "num-cpu", s->num_cpu); | ||
32 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->priv), errp)) { | ||
33 | return; | ||
34 | } | ||
35 | @@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_init(Object *obj) | ||
36 | int i; | ||
37 | |||
38 | object_initialize_child(obj, "a11priv", &s->priv, TYPE_ARM11MPCORE_PRIV); | ||
39 | + object_property_add_alias(obj, "num-cpu", OBJECT(&s->priv), "num-cpu"); | ||
40 | privbusdev = SYS_BUS_DEVICE(&s->priv); | ||
41 | sysbus_init_mmio(sbd, sysbus_mmio_get_region(privbusdev, 0)); | ||
42 | |||
43 | @@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_init(Object *obj) | ||
44 | } | ||
45 | } | ||
46 | |||
47 | -static const Property mpcore_rirq_properties[] = { | ||
48 | - DEFINE_PROP_UINT32("num-cpu", mpcore_rirq_state, num_cpu, 1), | ||
49 | -}; | ||
24 | - | 50 | - |
25 | ssize_t qemu_write_full(int fd, const void *buf, size_t count) | 51 | static void mpcore_rirq_class_init(ObjectClass *klass, void *data) |
26 | QEMU_WARN_UNUSED_RESULT; | 52 | { |
27 | 53 | DeviceClass *dc = DEVICE_CLASS(klass); | |
28 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 54 | |
29 | index XXXXXXX..XXXXXXX 100644 | 55 | dc->realize = realview_mpcore_realize; |
30 | --- a/util/oslib-posix.c | 56 | - device_class_set_props(dc, mpcore_rirq_properties); |
31 | +++ b/util/oslib-posix.c | ||
32 | @@ -XXX,XX +XXX,XX @@ fail_close: | ||
33 | return false; | ||
34 | } | 57 | } |
35 | 58 | ||
36 | -void *qemu_oom_check(void *ptr) | 59 | static const TypeInfo mpcore_rirq_info = { |
37 | +static void *qemu_oom_check(void *ptr) | ||
38 | { | ||
39 | if (ptr == NULL) { | ||
40 | fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); | ||
41 | diff --git a/util/oslib-win32.c b/util/oslib-win32.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/util/oslib-win32.c | ||
44 | +++ b/util/oslib-win32.c | ||
45 | @@ -XXX,XX +XXX,XX @@ | ||
46 | /* this must come after including "trace.h" */ | ||
47 | #include <shlobj.h> | ||
48 | |||
49 | -void *qemu_oom_check(void *ptr) | ||
50 | +static void *qemu_oom_check(void *ptr) | ||
51 | { | ||
52 | if (ptr == NULL) { | ||
53 | fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()); | ||
54 | -- | 60 | -- |
55 | 2.25.1 | 61 | 2.34.1 |
56 | 62 | ||
57 | 63 | diff view generated by jsdifflib |
1 | We implement qemu_memalign() in both oslib-posix.c and oslib-win32.c, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | but the two versions are essentially the same: they call | ||
3 | qemu_try_memalign(), and abort() after printing an error message if | ||
4 | it fails. The only difference is that the win32 version prints the | ||
5 | GetLastError() value whereas the POSIX version prints | ||
6 | strerror(errno). However, this is a bug in the win32 version: in | ||
7 | commit dfbd0b873a85021 in 2020 we changed the implementation of | ||
8 | qemu_try_memalign() from using VirtualAlloc() (which sets the | ||
9 | GetLastError() value) to using _aligned_malloc() (which sets errno), | ||
10 | but didn't update the error message to match. | ||
11 | 2 | ||
12 | Replace the two separate functions with a single version in a | 3 | When multiple QOM types are registered in the same file, |
13 | new memalign.c file, which drops the unnecessary extra qemu_oom_check() | 4 | it is simpler to use the the DEFINE_TYPES() macro. In |
14 | function and instead prints a more useful message including the | 5 | particular because type array declared with such macro |
15 | requested size and alignment as well as the errno string. | 6 | are easier to review. |
16 | 7 | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
10 | Message-id: 20250130112615.3219-7-philmd@linaro.org | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Message-id: 20220226180723.1706285-4-peter.maydell@linaro.org | ||
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | --- | 12 | --- |
22 | util/memalign.c | 39 +++++++++++++++++++++++++++++++++++++++ | 13 | hw/cpu/a15mpcore.c | 21 +++++++++------------ |
23 | util/oslib-posix.c | 14 -------------- | 14 | hw/cpu/a9mpcore.c | 21 +++++++++------------ |
24 | util/oslib-win32.c | 14 -------------- | 15 | hw/cpu/arm11mpcore.c | 21 +++++++++------------ |
25 | util/meson.build | 1 + | 16 | hw/cpu/realview_mpcore.c | 21 +++++++++------------ |
26 | 4 files changed, 40 insertions(+), 28 deletions(-) | 17 | 4 files changed, 36 insertions(+), 48 deletions(-) |
27 | create mode 100644 util/memalign.c | ||
28 | 18 | ||
29 | diff --git a/util/memalign.c b/util/memalign.c | 19 | diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c |
30 | new file mode 100644 | ||
31 | index XXXXXXX..XXXXXXX | ||
32 | --- /dev/null | ||
33 | +++ b/util/memalign.c | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | +/* | ||
36 | + * memalign.c: Allocate an aligned memory region | ||
37 | + * | ||
38 | + * Copyright (c) 2003-2008 Fabrice Bellard | ||
39 | + * Copyright (c) 2010-2016 Red Hat, Inc. | ||
40 | + * Copyright (c) 2022 Linaro Ltd | ||
41 | + * | ||
42 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
43 | + * of this software and associated documentation files (the "Software"), to deal | ||
44 | + * in the Software without restriction, including without limitation the rights | ||
45 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
46 | + * copies of the Software, and to permit persons to whom the Software is | ||
47 | + * furnished to do so, subject to the following conditions: | ||
48 | + * | ||
49 | + * The above copyright notice and this permission notice shall be included in | ||
50 | + * all copies or substantial portions of the Software. | ||
51 | + * | ||
52 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
53 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
54 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
55 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
56 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
57 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
58 | + * THE SOFTWARE. | ||
59 | + */ | ||
60 | + | ||
61 | +#include "qemu/osdep.h" | ||
62 | + | ||
63 | +void *qemu_memalign(size_t alignment, size_t size) | ||
64 | +{ | ||
65 | + void *p = qemu_try_memalign(alignment, size); | ||
66 | + if (p) { | ||
67 | + return p; | ||
68 | + } | ||
69 | + fprintf(stderr, | ||
70 | + "qemu_memalign: failed to allocate %zu bytes at alignment %zu: %s\n", | ||
71 | + size, alignment, strerror(errno)); | ||
72 | + abort(); | ||
73 | +} | ||
74 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | ||
75 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
76 | --- a/util/oslib-posix.c | 21 | --- a/hw/cpu/a15mpcore.c |
77 | +++ b/util/oslib-posix.c | 22 | +++ b/hw/cpu/a15mpcore.c |
78 | @@ -XXX,XX +XXX,XX @@ fail_close: | 23 | @@ -XXX,XX +XXX,XX @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data) |
79 | return false; | 24 | /* We currently have no saveable state */ |
80 | } | 25 | } |
81 | 26 | ||
82 | -static void *qemu_oom_check(void *ptr) | 27 | -static const TypeInfo a15mp_priv_info = { |
28 | - .name = TYPE_A15MPCORE_PRIV, | ||
29 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
30 | - .instance_size = sizeof(A15MPPrivState), | ||
31 | - .instance_init = a15mp_priv_initfn, | ||
32 | - .class_init = a15mp_priv_class_init, | ||
33 | +static const TypeInfo a15mp_types[] = { | ||
34 | + { | ||
35 | + .name = TYPE_A15MPCORE_PRIV, | ||
36 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
37 | + .instance_size = sizeof(A15MPPrivState), | ||
38 | + .instance_init = a15mp_priv_initfn, | ||
39 | + .class_init = a15mp_priv_class_init, | ||
40 | + }, | ||
41 | }; | ||
42 | |||
43 | -static void a15mp_register_types(void) | ||
83 | -{ | 44 | -{ |
84 | - if (ptr == NULL) { | 45 | - type_register_static(&a15mp_priv_info); |
85 | - fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); | ||
86 | - abort(); | ||
87 | - } | ||
88 | - return ptr; | ||
89 | -} | 46 | -} |
90 | - | 47 | - |
91 | void *qemu_try_memalign(size_t alignment, size_t size) | 48 | -type_init(a15mp_register_types) |
92 | { | 49 | +DEFINE_TYPES(a15mp_types) |
93 | void *ptr; | 50 | diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c |
94 | @@ -XXX,XX +XXX,XX @@ void *qemu_try_memalign(size_t alignment, size_t size) | 51 | index XXXXXXX..XXXXXXX 100644 |
95 | return ptr; | 52 | --- a/hw/cpu/a9mpcore.c |
53 | +++ b/hw/cpu/a9mpcore.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void a9mp_priv_class_init(ObjectClass *klass, void *data) | ||
55 | device_class_set_props(dc, a9mp_priv_properties); | ||
96 | } | 56 | } |
97 | 57 | ||
98 | -void *qemu_memalign(size_t alignment, size_t size) | 58 | -static const TypeInfo a9mp_priv_info = { |
59 | - .name = TYPE_A9MPCORE_PRIV, | ||
60 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
61 | - .instance_size = sizeof(A9MPPrivState), | ||
62 | - .instance_init = a9mp_priv_initfn, | ||
63 | - .class_init = a9mp_priv_class_init, | ||
64 | +static const TypeInfo a9mp_types[] = { | ||
65 | + { | ||
66 | + .name = TYPE_A9MPCORE_PRIV, | ||
67 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
68 | + .instance_size = sizeof(A9MPPrivState), | ||
69 | + .instance_init = a9mp_priv_initfn, | ||
70 | + .class_init = a9mp_priv_class_init, | ||
71 | + }, | ||
72 | }; | ||
73 | |||
74 | -static void a9mp_register_types(void) | ||
99 | -{ | 75 | -{ |
100 | - return qemu_oom_check(qemu_try_memalign(alignment, size)); | 76 | - type_register_static(&a9mp_priv_info); |
101 | -} | 77 | -} |
102 | - | 78 | - |
103 | /* alloc shared memory pages */ | 79 | -type_init(a9mp_register_types) |
104 | void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared, | 80 | +DEFINE_TYPES(a9mp_types) |
105 | bool noreserve) | 81 | diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c |
106 | diff --git a/util/oslib-win32.c b/util/oslib-win32.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | 82 | index XXXXXXX..XXXXXXX 100644 |
108 | --- a/util/oslib-win32.c | 83 | --- a/hw/cpu/arm11mpcore.c |
109 | +++ b/util/oslib-win32.c | 84 | +++ b/hw/cpu/arm11mpcore.c |
110 | @@ -XXX,XX +XXX,XX @@ | 85 | @@ -XXX,XX +XXX,XX @@ static void mpcore_priv_class_init(ObjectClass *klass, void *data) |
111 | /* this must come after including "trace.h" */ | 86 | device_class_set_props(dc, mpcore_priv_properties); |
112 | #include <shlobj.h> | 87 | } |
113 | 88 | ||
114 | -static void *qemu_oom_check(void *ptr) | 89 | -static const TypeInfo mpcore_priv_info = { |
90 | - .name = TYPE_ARM11MPCORE_PRIV, | ||
91 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
92 | - .instance_size = sizeof(ARM11MPCorePriveState), | ||
93 | - .instance_init = mpcore_priv_initfn, | ||
94 | - .class_init = mpcore_priv_class_init, | ||
95 | +static const TypeInfo arm11mp_types[] = { | ||
96 | + { | ||
97 | + .name = TYPE_ARM11MPCORE_PRIV, | ||
98 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
99 | + .instance_size = sizeof(ARM11MPCorePriveState), | ||
100 | + .instance_init = mpcore_priv_initfn, | ||
101 | + .class_init = mpcore_priv_class_init, | ||
102 | + }, | ||
103 | }; | ||
104 | |||
105 | -static void arm11mpcore_register_types(void) | ||
115 | -{ | 106 | -{ |
116 | - if (ptr == NULL) { | 107 | - type_register_static(&mpcore_priv_info); |
117 | - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()); | ||
118 | - abort(); | ||
119 | - } | ||
120 | - return ptr; | ||
121 | -} | 108 | -} |
122 | - | 109 | - |
123 | void *qemu_try_memalign(size_t alignment, size_t size) | 110 | -type_init(arm11mpcore_register_types) |
124 | { | 111 | +DEFINE_TYPES(arm11mp_types) |
125 | void *ptr; | 112 | diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c |
126 | @@ -XXX,XX +XXX,XX @@ void *qemu_try_memalign(size_t alignment, size_t size) | 113 | index XXXXXXX..XXXXXXX 100644 |
127 | return ptr; | 114 | --- a/hw/cpu/realview_mpcore.c |
115 | +++ b/hw/cpu/realview_mpcore.c | ||
116 | @@ -XXX,XX +XXX,XX @@ static void mpcore_rirq_class_init(ObjectClass *klass, void *data) | ||
117 | dc->realize = realview_mpcore_realize; | ||
128 | } | 118 | } |
129 | 119 | ||
130 | -void *qemu_memalign(size_t alignment, size_t size) | 120 | -static const TypeInfo mpcore_rirq_info = { |
121 | - .name = TYPE_REALVIEW_MPCORE_RIRQ, | ||
122 | - .parent = TYPE_SYS_BUS_DEVICE, | ||
123 | - .instance_size = sizeof(mpcore_rirq_state), | ||
124 | - .instance_init = mpcore_rirq_init, | ||
125 | - .class_init = mpcore_rirq_class_init, | ||
126 | +static const TypeInfo realview_mpcore_types[] = { | ||
127 | + { | ||
128 | + .name = TYPE_REALVIEW_MPCORE_RIRQ, | ||
129 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
130 | + .instance_size = sizeof(mpcore_rirq_state), | ||
131 | + .instance_init = mpcore_rirq_init, | ||
132 | + .class_init = mpcore_rirq_class_init, | ||
133 | + }, | ||
134 | }; | ||
135 | |||
136 | -static void realview_mpcore_register_types(void) | ||
131 | -{ | 137 | -{ |
132 | - return qemu_oom_check(qemu_try_memalign(alignment, size)); | 138 | - type_register_static(&mpcore_rirq_info); |
133 | -} | 139 | -} |
134 | - | 140 | - |
135 | static int get_allocation_granularity(void) | 141 | -type_init(realview_mpcore_register_types) |
136 | { | 142 | +DEFINE_TYPES(realview_mpcore_types) |
137 | SYSTEM_INFO system_info; | ||
138 | diff --git a/util/meson.build b/util/meson.build | ||
139 | index XXXXXXX..XXXXXXX 100644 | ||
140 | --- a/util/meson.build | ||
141 | +++ b/util/meson.build | ||
142 | @@ -XXX,XX +XXX,XX @@ util_ss.add(when: 'CONFIG_POSIX', if_true: files('drm.c')) | ||
143 | util_ss.add(files('guest-random.c')) | ||
144 | util_ss.add(files('yank.c')) | ||
145 | util_ss.add(files('int128.c')) | ||
146 | +util_ss.add(files('memalign.c')) | ||
147 | |||
148 | if have_user | ||
149 | util_ss.add(files('selfmap.c')) | ||
150 | -- | 143 | -- |
151 | 2.25.1 | 144 | 2.34.1 |
152 | 145 | ||
153 | 146 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Instead of assuming that all CONFIG_BSD have valloc() and anything | ||
2 | else is memalign(), explicitly check for those functions in | ||
3 | meson.build and use the "is the function present" define. Tests for | ||
4 | specific functionality are better than which-OS checks; this also | ||
5 | lets us give a helpful error message if somehow there's no usable | ||
6 | function present. | ||
7 | 1 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20220226180723.1706285-8-peter.maydell@linaro.org | ||
12 | --- | ||
13 | meson.build | 2 ++ | ||
14 | util/memalign.c | 6 ++++-- | ||
15 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/meson.build b/meson.build | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/meson.build | ||
20 | +++ b/meson.build | ||
21 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('CONFIG_POSIX_FALLOCATE', cc.has_function('posix_fallocate' | ||
22 | # thinking that Windows has posix_memalign() | ||
23 | config_host_data.set('CONFIG_POSIX_MEMALIGN', cc.has_function('posix_memalign', prefix: '#include <stdlib.h>')) | ||
24 | config_host_data.set('CONFIG_ALIGNED_MALLOC', cc.has_function('_aligned_malloc')) | ||
25 | +config_host_data.set('CONFIG_VALLOC', cc.has_function('valloc')) | ||
26 | +config_host_data.set('CONFIG_MEMALIGN', cc.has_function('memalign')) | ||
27 | config_host_data.set('CONFIG_PPOLL', cc.has_function('ppoll')) | ||
28 | config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>')) | ||
29 | config_host_data.set('CONFIG_SEM_TIMEDWAIT', cc.has_function('sem_timedwait', dependencies: threads)) | ||
30 | diff --git a/util/memalign.c b/util/memalign.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/util/memalign.c | ||
33 | +++ b/util/memalign.c | ||
34 | @@ -XXX,XX +XXX,XX @@ void *qemu_try_memalign(size_t alignment, size_t size) | ||
35 | } | ||
36 | #elif defined(CONFIG_ALIGNED_MALLOC) | ||
37 | ptr = _aligned_malloc(size, alignment); | ||
38 | -#elif defined(CONFIG_BSD) | ||
39 | +#elif defined(CONFIG_VALLOC) | ||
40 | ptr = valloc(size); | ||
41 | -#else | ||
42 | +#elif defined(CONFIG_MEMALIGN) | ||
43 | ptr = memalign(alignment, size); | ||
44 | +#else | ||
45 | + #error No function to allocate aligned memory available | ||
46 | #endif | ||
47 | trace_qemu_memalign(alignment, size, ptr); | ||
48 | return ptr; | ||
49 | -- | ||
50 | 2.25.1 | ||
51 | |||
52 | diff view generated by jsdifflib |
1 | Move the various memalign-related functions out of osdep.h and into | 1 | From: Andrew Yuan <andrew.yuan@jaguarmicro.com> |
---|---|---|---|
2 | their own header, which we include only where they are used. | ||
3 | While we're doing this, add some brief documentation comments. | ||
4 | 2 | ||
3 | Our current handling of the mask/compare logic in the Cadence | ||
4 | GEM ethernet device is wrong: | ||
5 | (1) we load the same byte twice from rx_buf when | ||
6 | creating the compare value | ||
7 | (2) we ignore the DISABLE_MASK flag | ||
8 | |||
9 | The "Cadence IP for Gigabit Ethernet MAC Part Number: IP7014 IP Rev: | ||
10 | R1p12 - Doc Rev: 1.3 User Guide" states that if the DISABLE_MASK bit | ||
11 | in type2_compare_x_word_1 is set, the mask_value field in | ||
12 | type2_compare_x_word_0 is used as an additional 2 byte Compare Value. | ||
13 | |||
14 | Correct these bugs: | ||
15 | * in the !disable_mask codepath, use lduw_le_p() so we | ||
16 | correctly load a 16-bit value for comparison | ||
17 | * in the disable_mask codepath, we load a full 4-byte value | ||
18 | from rx_buf for the comparison, set the compare value to | ||
19 | the whole of the cr0 register (i.e. the concatenation of | ||
20 | the mask and compare fields), and set mask to 0xffffffff | ||
21 | to force a 32-bit comparison | ||
22 | |||
23 | Signed-off-by: Andrew Yuan <andrew.yuan@jaguarmicro.com> | ||
24 | Message-id: 20241219061658.805-1-andrew.yuan@jaguarmicro.com | ||
25 | Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
26 | [PMM: Expand commit message and comment] | ||
27 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
28 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20220226180723.1706285-10-peter.maydell@linaro.org | ||
9 | --- | 30 | --- |
10 | include/qemu/memalign.h | 61 ++++++++++++++++++++++++++++++++++ | 31 | hw/net/cadence_gem.c | 26 +++++++++++++++++++++----- |
11 | include/qemu/osdep.h | 18 ---------- | 32 | 1 file changed, 21 insertions(+), 5 deletions(-) |
12 | block/blkverify.c | 1 + | ||
13 | block/block-copy.c | 1 + | ||
14 | block/commit.c | 1 + | ||
15 | block/crypto.c | 1 + | ||
16 | block/dmg.c | 1 + | ||
17 | block/export/fuse.c | 1 + | ||
18 | block/file-posix.c | 1 + | ||
19 | block/io.c | 1 + | ||
20 | block/mirror.c | 1 + | ||
21 | block/nvme.c | 1 + | ||
22 | block/parallels-ext.c | 1 + | ||
23 | block/parallels.c | 1 + | ||
24 | block/qcow.c | 1 + | ||
25 | block/qcow2-cache.c | 1 + | ||
26 | block/qcow2-cluster.c | 1 + | ||
27 | block/qcow2-refcount.c | 1 + | ||
28 | block/qcow2-snapshot.c | 1 + | ||
29 | block/qcow2.c | 1 + | ||
30 | block/qed-l2-cache.c | 1 + | ||
31 | block/qed-table.c | 1 + | ||
32 | block/qed.c | 1 + | ||
33 | block/quorum.c | 1 + | ||
34 | block/raw-format.c | 1 + | ||
35 | block/vdi.c | 1 + | ||
36 | block/vhdx-log.c | 1 + | ||
37 | block/vhdx.c | 1 + | ||
38 | block/vmdk.c | 1 + | ||
39 | block/vpc.c | 1 + | ||
40 | block/win32-aio.c | 1 + | ||
41 | hw/block/dataplane/xen-block.c | 1 + | ||
42 | hw/block/fdc.c | 1 + | ||
43 | hw/ide/core.c | 1 + | ||
44 | hw/ppc/spapr.c | 1 + | ||
45 | hw/ppc/spapr_softmmu.c | 1 + | ||
46 | hw/scsi/scsi-disk.c | 1 + | ||
47 | hw/tpm/tpm_ppi.c | 2 +- | ||
48 | nbd/server.c | 1 + | ||
49 | net/l2tpv3.c | 2 +- | ||
50 | plugins/loader.c | 1 + | ||
51 | qemu-img.c | 1 + | ||
52 | qemu-io-cmds.c | 1 + | ||
53 | qom/object.c | 1 + | ||
54 | softmmu/physmem.c | 1 + | ||
55 | target/i386/hvf/hvf.c | 1 + | ||
56 | target/i386/kvm/kvm.c | 1 + | ||
57 | tcg/region.c | 1 + | ||
58 | tests/bench/atomic_add-bench.c | 1 + | ||
59 | tests/bench/qht-bench.c | 1 + | ||
60 | util/atomic64.c | 1 + | ||
61 | util/memalign.c | 1 + | ||
62 | util/qht.c | 1 + | ||
63 | 53 files changed, 112 insertions(+), 20 deletions(-) | ||
64 | create mode 100644 include/qemu/memalign.h | ||
65 | 33 | ||
66 | diff --git a/include/qemu/memalign.h b/include/qemu/memalign.h | 34 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
67 | new file mode 100644 | ||
68 | index XXXXXXX..XXXXXXX | ||
69 | --- /dev/null | ||
70 | +++ b/include/qemu/memalign.h | ||
71 | @@ -XXX,XX +XXX,XX @@ | ||
72 | +/* | ||
73 | + * Allocation and free functions for aligned memory | ||
74 | + * | ||
75 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
76 | + * See the COPYING file in the top-level directory. | ||
77 | + */ | ||
78 | + | ||
79 | +#ifndef QEMU_MEMALIGN_H | ||
80 | +#define QEMU_MEMALIGN_H | ||
81 | + | ||
82 | +/** | ||
83 | + * qemu_try_memalign: Allocate aligned memory | ||
84 | + * @alignment: required alignment, in bytes | ||
85 | + * @size: size of allocation, in bytes | ||
86 | + * | ||
87 | + * Allocate memory on an aligned boundary (i.e. the returned | ||
88 | + * address will be an exact multiple of @alignment). | ||
89 | + * @alignment must be a power of 2, or the function will assert(). | ||
90 | + * On success, returns allocated memory; on failure, returns NULL. | ||
91 | + * | ||
92 | + * The memory allocated through this function must be freed via | ||
93 | + * qemu_vfree() (and not via free()). | ||
94 | + */ | ||
95 | +void *qemu_try_memalign(size_t alignment, size_t size); | ||
96 | +/** | ||
97 | + * qemu_memalign: Allocate aligned memory, without failing | ||
98 | + * @alignment: required alignment, in bytes | ||
99 | + * @size: size of allocation, in bytes | ||
100 | + * | ||
101 | + * Allocate memory in the same way as qemu_try_memalign(), but | ||
102 | + * abort() with an error message if the memory allocation fails. | ||
103 | + * | ||
104 | + * The memory allocated through this function must be freed via | ||
105 | + * qemu_vfree() (and not via free()). | ||
106 | + */ | ||
107 | +void *qemu_memalign(size_t alignment, size_t size); | ||
108 | +/** | ||
109 | + * qemu_vfree: Free memory allocated through qemu_memalign | ||
110 | + * @ptr: memory to free | ||
111 | + * | ||
112 | + * This function must be used to free memory allocated via qemu_memalign() | ||
113 | + * or qemu_try_memalign(). (Using the wrong free function will cause | ||
114 | + * subtle bugs on Windows hosts.) | ||
115 | + */ | ||
116 | +void qemu_vfree(void *ptr); | ||
117 | +/* | ||
118 | + * It's an analog of GLIB's g_autoptr_cleanup_generic_gfree(), used to define | ||
119 | + * g_autofree macro. | ||
120 | + */ | ||
121 | +static inline void qemu_cleanup_generic_vfree(void *p) | ||
122 | +{ | ||
123 | + void **pp = (void **)p; | ||
124 | + qemu_vfree(*pp); | ||
125 | +} | ||
126 | + | ||
127 | +/* | ||
128 | + * Analog of g_autofree, but qemu_vfree is called on cleanup instead of g_free. | ||
129 | + */ | ||
130 | +#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree))) | ||
131 | + | ||
132 | +#endif | ||
133 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
134 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
135 | --- a/include/qemu/osdep.h | 36 | --- a/hw/net/cadence_gem.c |
136 | +++ b/include/qemu/osdep.h | 37 | +++ b/hw/net/cadence_gem.c |
137 | @@ -XXX,XX +XXX,XX @@ extern "C" { | 38 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
138 | #endif | 39 | |
139 | 40 | /* Compare A, B, C */ | |
140 | int qemu_daemon(int nochdir, int noclose); | 41 | for (j = 0; j < 3; j++) { |
141 | -void *qemu_try_memalign(size_t alignment, size_t size); | 42 | - uint32_t cr0, cr1, mask, compare; |
142 | -void *qemu_memalign(size_t alignment, size_t size); | 43 | - uint16_t rx_cmp; |
143 | void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared, | 44 | + uint32_t cr0, cr1, mask, compare, disable_mask; |
144 | bool noreserve); | 45 | + uint32_t rx_cmp; |
145 | -void qemu_vfree(void *ptr); | 46 | int offset; |
146 | void qemu_anon_ram_free(void *ptr, size_t size); | 47 | int cr_idx = extract32(reg, R_SCREENING_TYPE2_REG0_COMPARE_A_SHIFT + j * 6, |
147 | 48 | R_SCREENING_TYPE2_REG0_COMPARE_A_LENGTH); | |
148 | -/* | 49 | @@ -XXX,XX +XXX,XX @@ static int get_queue_from_screen(CadenceGEMState *s, uint8_t *rxbuf_ptr, |
149 | - * It's an analog of GLIB's g_autoptr_cleanup_generic_gfree(), used to define | 50 | break; |
150 | - * g_autofree macro. | 51 | } |
151 | - */ | 52 | |
152 | -static inline void qemu_cleanup_generic_vfree(void *p) | 53 | - rx_cmp = rxbuf_ptr[offset] << 8 | rxbuf_ptr[offset]; |
153 | -{ | 54 | - mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); |
154 | - void **pp = (void **)p; | 55 | - compare = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); |
155 | - qemu_vfree(*pp); | 56 | + disable_mask = |
156 | -} | 57 | + FIELD_EX32(cr1, TYPE2_COMPARE_0_WORD_1, DISABLE_MASK); |
157 | - | 58 | + if (disable_mask) { |
158 | -/* | 59 | + /* |
159 | - * Analog of g_autofree, but qemu_vfree is called on cleanup instead of g_free. | 60 | + * If disable_mask is set, mask_value is used as an |
160 | - */ | 61 | + * additional 2 byte Compare Value; that is equivalent |
161 | -#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree))) | 62 | + * to using the whole cr0 register as the comparison value. |
162 | - | 63 | + * Load 32 bits of data from rx_buf, and set mask to |
163 | #ifdef _WIN32 | 64 | + * all-ones so we compare all 32 bits. |
164 | #define HAVE_CHARDEV_SERIAL 1 | 65 | + */ |
165 | #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ | 66 | + rx_cmp = ldl_le_p(rxbuf_ptr + offset); |
166 | diff --git a/block/blkverify.c b/block/blkverify.c | 67 | + mask = 0xFFFFFFFF; |
167 | index XXXXXXX..XXXXXXX 100644 | 68 | + compare = cr0; |
168 | --- a/block/blkverify.c | 69 | + } else { |
169 | +++ b/block/blkverify.c | 70 | + rx_cmp = lduw_le_p(rxbuf_ptr + offset); |
170 | @@ -XXX,XX +XXX,XX @@ | 71 | + mask = FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, MASK_VALUE); |
171 | #include "qemu/cutils.h" | 72 | + compare = |
172 | #include "qemu/module.h" | 73 | + FIELD_EX32(cr0, TYPE2_COMPARE_0_WORD_0, COMPARE_VALUE); |
173 | #include "qemu/option.h" | 74 | + } |
174 | +#include "qemu/memalign.h" | 75 | |
175 | 76 | if ((rx_cmp & mask) == (compare & mask)) { | |
176 | typedef struct { | 77 | matched = true; |
177 | BdrvChild *test_file; | ||
178 | diff --git a/block/block-copy.c b/block/block-copy.c | ||
179 | index XXXXXXX..XXXXXXX 100644 | ||
180 | --- a/block/block-copy.c | ||
181 | +++ b/block/block-copy.c | ||
182 | @@ -XXX,XX +XXX,XX @@ | ||
183 | #include "qemu/coroutine.h" | ||
184 | #include "block/aio_task.h" | ||
185 | #include "qemu/error-report.h" | ||
186 | +#include "qemu/memalign.h" | ||
187 | |||
188 | #define BLOCK_COPY_MAX_COPY_RANGE (16 * MiB) | ||
189 | #define BLOCK_COPY_MAX_BUFFER (1 * MiB) | ||
190 | diff --git a/block/commit.c b/block/commit.c | ||
191 | index XXXXXXX..XXXXXXX 100644 | ||
192 | --- a/block/commit.c | ||
193 | +++ b/block/commit.c | ||
194 | @@ -XXX,XX +XXX,XX @@ | ||
195 | #include "qapi/error.h" | ||
196 | #include "qapi/qmp/qerror.h" | ||
197 | #include "qemu/ratelimit.h" | ||
198 | +#include "qemu/memalign.h" | ||
199 | #include "sysemu/block-backend.h" | ||
200 | |||
201 | enum { | ||
202 | diff --git a/block/crypto.c b/block/crypto.c | ||
203 | index XXXXXXX..XXXXXXX 100644 | ||
204 | --- a/block/crypto.c | ||
205 | +++ b/block/crypto.c | ||
206 | @@ -XXX,XX +XXX,XX @@ | ||
207 | #include "qemu/module.h" | ||
208 | #include "qemu/option.h" | ||
209 | #include "qemu/cutils.h" | ||
210 | +#include "qemu/memalign.h" | ||
211 | #include "crypto.h" | ||
212 | |||
213 | typedef struct BlockCrypto BlockCrypto; | ||
214 | diff --git a/block/dmg.c b/block/dmg.c | ||
215 | index XXXXXXX..XXXXXXX 100644 | ||
216 | --- a/block/dmg.c | ||
217 | +++ b/block/dmg.c | ||
218 | @@ -XXX,XX +XXX,XX @@ | ||
219 | #include "qemu/bswap.h" | ||
220 | #include "qemu/error-report.h" | ||
221 | #include "qemu/module.h" | ||
222 | +#include "qemu/memalign.h" | ||
223 | #include "dmg.h" | ||
224 | |||
225 | int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, | ||
226 | diff --git a/block/export/fuse.c b/block/export/fuse.c | ||
227 | index XXXXXXX..XXXXXXX 100644 | ||
228 | --- a/block/export/fuse.c | ||
229 | +++ b/block/export/fuse.c | ||
230 | @@ -XXX,XX +XXX,XX @@ | ||
231 | #define FUSE_USE_VERSION 31 | ||
232 | |||
233 | #include "qemu/osdep.h" | ||
234 | +#include "qemu/memalign.h" | ||
235 | #include "block/aio.h" | ||
236 | #include "block/block.h" | ||
237 | #include "block/export.h" | ||
238 | diff --git a/block/file-posix.c b/block/file-posix.c | ||
239 | index XXXXXXX..XXXXXXX 100644 | ||
240 | --- a/block/file-posix.c | ||
241 | +++ b/block/file-posix.c | ||
242 | @@ -XXX,XX +XXX,XX @@ | ||
243 | #include "qemu/module.h" | ||
244 | #include "qemu/option.h" | ||
245 | #include "qemu/units.h" | ||
246 | +#include "qemu/memalign.h" | ||
247 | #include "trace.h" | ||
248 | #include "block/thread-pool.h" | ||
249 | #include "qemu/iov.h" | ||
250 | diff --git a/block/io.c b/block/io.c | ||
251 | index XXXXXXX..XXXXXXX 100644 | ||
252 | --- a/block/io.c | ||
253 | +++ b/block/io.c | ||
254 | @@ -XXX,XX +XXX,XX @@ | ||
255 | #include "block/coroutines.h" | ||
256 | #include "block/write-threshold.h" | ||
257 | #include "qemu/cutils.h" | ||
258 | +#include "qemu/memalign.h" | ||
259 | #include "qapi/error.h" | ||
260 | #include "qemu/error-report.h" | ||
261 | #include "qemu/main-loop.h" | ||
262 | diff --git a/block/mirror.c b/block/mirror.c | ||
263 | index XXXXXXX..XXXXXXX 100644 | ||
264 | --- a/block/mirror.c | ||
265 | +++ b/block/mirror.c | ||
266 | @@ -XXX,XX +XXX,XX @@ | ||
267 | #include "qapi/qmp/qerror.h" | ||
268 | #include "qemu/ratelimit.h" | ||
269 | #include "qemu/bitmap.h" | ||
270 | +#include "qemu/memalign.h" | ||
271 | |||
272 | #define MAX_IN_FLIGHT 16 | ||
273 | #define MAX_IO_BYTES (1 << 20) /* 1 Mb */ | ||
274 | diff --git a/block/nvme.c b/block/nvme.c | ||
275 | index XXXXXXX..XXXXXXX 100644 | ||
276 | --- a/block/nvme.c | ||
277 | +++ b/block/nvme.c | ||
278 | @@ -XXX,XX +XXX,XX @@ | ||
279 | #include "qemu/module.h" | ||
280 | #include "qemu/cutils.h" | ||
281 | #include "qemu/option.h" | ||
282 | +#include "qemu/memalign.h" | ||
283 | #include "qemu/vfio-helpers.h" | ||
284 | #include "block/block_int.h" | ||
285 | #include "sysemu/replay.h" | ||
286 | diff --git a/block/parallels-ext.c b/block/parallels-ext.c | ||
287 | index XXXXXXX..XXXXXXX 100644 | ||
288 | --- a/block/parallels-ext.c | ||
289 | +++ b/block/parallels-ext.c | ||
290 | @@ -XXX,XX +XXX,XX @@ | ||
291 | #include "parallels.h" | ||
292 | #include "crypto/hash.h" | ||
293 | #include "qemu/uuid.h" | ||
294 | +#include "qemu/memalign.h" | ||
295 | |||
296 | #define PARALLELS_FORMAT_EXTENSION_MAGIC 0xAB234CEF23DCEA87ULL | ||
297 | |||
298 | diff --git a/block/parallels.c b/block/parallels.c | ||
299 | index XXXXXXX..XXXXXXX 100644 | ||
300 | --- a/block/parallels.c | ||
301 | +++ b/block/parallels.c | ||
302 | @@ -XXX,XX +XXX,XX @@ | ||
303 | #include "qapi/qapi-visit-block-core.h" | ||
304 | #include "qemu/bswap.h" | ||
305 | #include "qemu/bitmap.h" | ||
306 | +#include "qemu/memalign.h" | ||
307 | #include "migration/blocker.h" | ||
308 | #include "parallels.h" | ||
309 | |||
310 | diff --git a/block/qcow.c b/block/qcow.c | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/block/qcow.c | ||
313 | +++ b/block/qcow.c | ||
314 | @@ -XXX,XX +XXX,XX @@ | ||
315 | #include "qemu/option.h" | ||
316 | #include "qemu/bswap.h" | ||
317 | #include "qemu/cutils.h" | ||
318 | +#include "qemu/memalign.h" | ||
319 | #include <zlib.h> | ||
320 | #include "qapi/qmp/qdict.h" | ||
321 | #include "qapi/qmp/qstring.h" | ||
322 | diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c | ||
323 | index XXXXXXX..XXXXXXX 100644 | ||
324 | --- a/block/qcow2-cache.c | ||
325 | +++ b/block/qcow2-cache.c | ||
326 | @@ -XXX,XX +XXX,XX @@ | ||
327 | */ | ||
328 | |||
329 | #include "qemu/osdep.h" | ||
330 | +#include "qemu/memalign.h" | ||
331 | #include "qcow2.h" | ||
332 | #include "trace.h" | ||
333 | |||
334 | diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c | ||
335 | index XXXXXXX..XXXXXXX 100644 | ||
336 | --- a/block/qcow2-cluster.c | ||
337 | +++ b/block/qcow2-cluster.c | ||
338 | @@ -XXX,XX +XXX,XX @@ | ||
339 | #include "qapi/error.h" | ||
340 | #include "qcow2.h" | ||
341 | #include "qemu/bswap.h" | ||
342 | +#include "qemu/memalign.h" | ||
343 | #include "trace.h" | ||
344 | |||
345 | int qcow2_shrink_l1_table(BlockDriverState *bs, uint64_t exact_size) | ||
346 | diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c | ||
347 | index XXXXXXX..XXXXXXX 100644 | ||
348 | --- a/block/qcow2-refcount.c | ||
349 | +++ b/block/qcow2-refcount.c | ||
350 | @@ -XXX,XX +XXX,XX @@ | ||
351 | #include "qemu/range.h" | ||
352 | #include "qemu/bswap.h" | ||
353 | #include "qemu/cutils.h" | ||
354 | +#include "qemu/memalign.h" | ||
355 | #include "trace.h" | ||
356 | |||
357 | static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size, | ||
358 | diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c | ||
359 | index XXXXXXX..XXXXXXX 100644 | ||
360 | --- a/block/qcow2-snapshot.c | ||
361 | +++ b/block/qcow2-snapshot.c | ||
362 | @@ -XXX,XX +XXX,XX @@ | ||
363 | #include "qemu/bswap.h" | ||
364 | #include "qemu/error-report.h" | ||
365 | #include "qemu/cutils.h" | ||
366 | +#include "qemu/memalign.h" | ||
367 | |||
368 | static void qcow2_free_single_snapshot(BlockDriverState *bs, int i) | ||
369 | { | ||
370 | diff --git a/block/qcow2.c b/block/qcow2.c | ||
371 | index XXXXXXX..XXXXXXX 100644 | ||
372 | --- a/block/qcow2.c | ||
373 | +++ b/block/qcow2.c | ||
374 | @@ -XXX,XX +XXX,XX @@ | ||
375 | #include "qemu/option_int.h" | ||
376 | #include "qemu/cutils.h" | ||
377 | #include "qemu/bswap.h" | ||
378 | +#include "qemu/memalign.h" | ||
379 | #include "qapi/qobject-input-visitor.h" | ||
380 | #include "qapi/qapi-visit-block-core.h" | ||
381 | #include "crypto.h" | ||
382 | diff --git a/block/qed-l2-cache.c b/block/qed-l2-cache.c | ||
383 | index XXXXXXX..XXXXXXX 100644 | ||
384 | --- a/block/qed-l2-cache.c | ||
385 | +++ b/block/qed-l2-cache.c | ||
386 | @@ -XXX,XX +XXX,XX @@ | ||
387 | */ | ||
388 | |||
389 | #include "qemu/osdep.h" | ||
390 | +#include "qemu/memalign.h" | ||
391 | #include "trace.h" | ||
392 | #include "qed.h" | ||
393 | |||
394 | diff --git a/block/qed-table.c b/block/qed-table.c | ||
395 | index XXXXXXX..XXXXXXX 100644 | ||
396 | --- a/block/qed-table.c | ||
397 | +++ b/block/qed-table.c | ||
398 | @@ -XXX,XX +XXX,XX @@ | ||
399 | #include "qemu/sockets.h" /* for EINPROGRESS on Windows */ | ||
400 | #include "qed.h" | ||
401 | #include "qemu/bswap.h" | ||
402 | +#include "qemu/memalign.h" | ||
403 | |||
404 | /* Called with table_lock held. */ | ||
405 | static int coroutine_fn qed_read_table(BDRVQEDState *s, uint64_t offset, | ||
406 | diff --git a/block/qed.c b/block/qed.c | ||
407 | index XXXXXXX..XXXXXXX 100644 | ||
408 | --- a/block/qed.c | ||
409 | +++ b/block/qed.c | ||
410 | @@ -XXX,XX +XXX,XX @@ | ||
411 | #include "qemu/main-loop.h" | ||
412 | #include "qemu/module.h" | ||
413 | #include "qemu/option.h" | ||
414 | +#include "qemu/memalign.h" | ||
415 | #include "trace.h" | ||
416 | #include "qed.h" | ||
417 | #include "sysemu/block-backend.h" | ||
418 | diff --git a/block/quorum.c b/block/quorum.c | ||
419 | index XXXXXXX..XXXXXXX 100644 | ||
420 | --- a/block/quorum.c | ||
421 | +++ b/block/quorum.c | ||
422 | @@ -XXX,XX +XXX,XX @@ | ||
423 | #include "qemu/cutils.h" | ||
424 | #include "qemu/module.h" | ||
425 | #include "qemu/option.h" | ||
426 | +#include "qemu/memalign.h" | ||
427 | #include "block/block_int.h" | ||
428 | #include "block/coroutines.h" | ||
429 | #include "block/qdict.h" | ||
430 | diff --git a/block/raw-format.c b/block/raw-format.c | ||
431 | index XXXXXXX..XXXXXXX 100644 | ||
432 | --- a/block/raw-format.c | ||
433 | +++ b/block/raw-format.c | ||
434 | @@ -XXX,XX +XXX,XX @@ | ||
435 | #include "qapi/error.h" | ||
436 | #include "qemu/module.h" | ||
437 | #include "qemu/option.h" | ||
438 | +#include "qemu/memalign.h" | ||
439 | |||
440 | typedef struct BDRVRawState { | ||
441 | uint64_t offset; | ||
442 | diff --git a/block/vdi.c b/block/vdi.c | ||
443 | index XXXXXXX..XXXXXXX 100644 | ||
444 | --- a/block/vdi.c | ||
445 | +++ b/block/vdi.c | ||
446 | @@ -XXX,XX +XXX,XX @@ | ||
447 | #include "qemu/coroutine.h" | ||
448 | #include "qemu/cutils.h" | ||
449 | #include "qemu/uuid.h" | ||
450 | +#include "qemu/memalign.h" | ||
451 | |||
452 | /* Code configuration options. */ | ||
453 | |||
454 | diff --git a/block/vhdx-log.c b/block/vhdx-log.c | ||
455 | index XXXXXXX..XXXXXXX 100644 | ||
456 | --- a/block/vhdx-log.c | ||
457 | +++ b/block/vhdx-log.c | ||
458 | @@ -XXX,XX +XXX,XX @@ | ||
459 | #include "block/block_int.h" | ||
460 | #include "qemu/error-report.h" | ||
461 | #include "qemu/bswap.h" | ||
462 | +#include "qemu/memalign.h" | ||
463 | #include "vhdx.h" | ||
464 | |||
465 | |||
466 | diff --git a/block/vhdx.c b/block/vhdx.c | ||
467 | index XXXXXXX..XXXXXXX 100644 | ||
468 | --- a/block/vhdx.c | ||
469 | +++ b/block/vhdx.c | ||
470 | @@ -XXX,XX +XXX,XX @@ | ||
471 | #include "qemu/crc32c.h" | ||
472 | #include "qemu/bswap.h" | ||
473 | #include "qemu/error-report.h" | ||
474 | +#include "qemu/memalign.h" | ||
475 | #include "vhdx.h" | ||
476 | #include "migration/blocker.h" | ||
477 | #include "qemu/uuid.h" | ||
478 | diff --git a/block/vmdk.c b/block/vmdk.c | ||
479 | index XXXXXXX..XXXXXXX 100644 | ||
480 | --- a/block/vmdk.c | ||
481 | +++ b/block/vmdk.c | ||
482 | @@ -XXX,XX +XXX,XX @@ | ||
483 | #include "qemu/module.h" | ||
484 | #include "qemu/option.h" | ||
485 | #include "qemu/bswap.h" | ||
486 | +#include "qemu/memalign.h" | ||
487 | #include "migration/blocker.h" | ||
488 | #include "qemu/cutils.h" | ||
489 | #include <zlib.h> | ||
490 | diff --git a/block/vpc.c b/block/vpc.c | ||
491 | index XXXXXXX..XXXXXXX 100644 | ||
492 | --- a/block/vpc.c | ||
493 | +++ b/block/vpc.c | ||
494 | @@ -XXX,XX +XXX,XX @@ | ||
495 | #include "migration/blocker.h" | ||
496 | #include "qemu/bswap.h" | ||
497 | #include "qemu/uuid.h" | ||
498 | +#include "qemu/memalign.h" | ||
499 | #include "qapi/qmp/qdict.h" | ||
500 | #include "qapi/qobject-input-visitor.h" | ||
501 | #include "qapi/qapi-visit-block-core.h" | ||
502 | diff --git a/block/win32-aio.c b/block/win32-aio.c | ||
503 | index XXXXXXX..XXXXXXX 100644 | ||
504 | --- a/block/win32-aio.c | ||
505 | +++ b/block/win32-aio.c | ||
506 | @@ -XXX,XX +XXX,XX @@ | ||
507 | #include "block/raw-aio.h" | ||
508 | #include "qemu/event_notifier.h" | ||
509 | #include "qemu/iov.h" | ||
510 | +#include "qemu/memalign.h" | ||
511 | #include <windows.h> | ||
512 | #include <winioctl.h> | ||
513 | |||
514 | diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c | ||
515 | index XXXXXXX..XXXXXXX 100644 | ||
516 | --- a/hw/block/dataplane/xen-block.c | ||
517 | +++ b/hw/block/dataplane/xen-block.c | ||
518 | @@ -XXX,XX +XXX,XX @@ | ||
519 | #include "qemu/osdep.h" | ||
520 | #include "qemu/error-report.h" | ||
521 | #include "qemu/main-loop.h" | ||
522 | +#include "qemu/memalign.h" | ||
523 | #include "qapi/error.h" | ||
524 | #include "hw/xen/xen_common.h" | ||
525 | #include "hw/block/xen_blkif.h" | ||
526 | diff --git a/hw/block/fdc.c b/hw/block/fdc.c | ||
527 | index XXXXXXX..XXXXXXX 100644 | ||
528 | --- a/hw/block/fdc.c | ||
529 | +++ b/hw/block/fdc.c | ||
530 | @@ -XXX,XX +XXX,XX @@ | ||
531 | #include "qapi/error.h" | ||
532 | #include "qemu/error-report.h" | ||
533 | #include "qemu/timer.h" | ||
534 | +#include "qemu/memalign.h" | ||
535 | #include "hw/irq.h" | ||
536 | #include "hw/isa/isa.h" | ||
537 | #include "hw/qdev-properties.h" | ||
538 | diff --git a/hw/ide/core.c b/hw/ide/core.c | ||
539 | index XXXXXXX..XXXXXXX 100644 | ||
540 | --- a/hw/ide/core.c | ||
541 | +++ b/hw/ide/core.c | ||
542 | @@ -XXX,XX +XXX,XX @@ | ||
543 | #include "qemu/main-loop.h" | ||
544 | #include "qemu/timer.h" | ||
545 | #include "qemu/hw-version.h" | ||
546 | +#include "qemu/memalign.h" | ||
547 | #include "sysemu/sysemu.h" | ||
548 | #include "sysemu/blockdev.h" | ||
549 | #include "sysemu/dma.h" | ||
550 | diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c | ||
551 | index XXXXXXX..XXXXXXX 100644 | ||
552 | --- a/hw/ppc/spapr.c | ||
553 | +++ b/hw/ppc/spapr.c | ||
554 | @@ -XXX,XX +XXX,XX @@ | ||
555 | #include "qemu/osdep.h" | ||
556 | #include "qemu-common.h" | ||
557 | #include "qemu/datadir.h" | ||
558 | +#include "qemu/memalign.h" | ||
559 | #include "qapi/error.h" | ||
560 | #include "qapi/qapi-events-machine.h" | ||
561 | #include "qapi/qapi-events-qdev.h" | ||
562 | diff --git a/hw/ppc/spapr_softmmu.c b/hw/ppc/spapr_softmmu.c | ||
563 | index XXXXXXX..XXXXXXX 100644 | ||
564 | --- a/hw/ppc/spapr_softmmu.c | ||
565 | +++ b/hw/ppc/spapr_softmmu.c | ||
566 | @@ -XXX,XX +XXX,XX @@ | ||
567 | #include "qemu/osdep.h" | ||
568 | #include "qemu/cutils.h" | ||
569 | +#include "qemu/memalign.h" | ||
570 | #include "cpu.h" | ||
571 | #include "helper_regs.h" | ||
572 | #include "hw/ppc/spapr.h" | ||
573 | diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c | ||
574 | index XXXXXXX..XXXXXXX 100644 | ||
575 | --- a/hw/scsi/scsi-disk.c | ||
576 | +++ b/hw/scsi/scsi-disk.c | ||
577 | @@ -XXX,XX +XXX,XX @@ | ||
578 | #include "qemu/main-loop.h" | ||
579 | #include "qemu/module.h" | ||
580 | #include "qemu/hw-version.h" | ||
581 | +#include "qemu/memalign.h" | ||
582 | #include "hw/scsi/scsi.h" | ||
583 | #include "migration/qemu-file-types.h" | ||
584 | #include "migration/vmstate.h" | ||
585 | diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c | ||
586 | index XXXXXXX..XXXXXXX 100644 | ||
587 | --- a/hw/tpm/tpm_ppi.c | ||
588 | +++ b/hw/tpm/tpm_ppi.c | ||
589 | @@ -XXX,XX +XXX,XX @@ | ||
590 | */ | ||
591 | |||
592 | #include "qemu/osdep.h" | ||
593 | - | ||
594 | +#include "qemu/memalign.h" | ||
595 | #include "qapi/error.h" | ||
596 | #include "sysemu/memory_mapping.h" | ||
597 | #include "migration/vmstate.h" | ||
598 | diff --git a/nbd/server.c b/nbd/server.c | ||
599 | index XXXXXXX..XXXXXXX 100644 | ||
600 | --- a/nbd/server.c | ||
601 | +++ b/nbd/server.c | ||
602 | @@ -XXX,XX +XXX,XX @@ | ||
603 | #include "trace.h" | ||
604 | #include "nbd-internal.h" | ||
605 | #include "qemu/units.h" | ||
606 | +#include "qemu/memalign.h" | ||
607 | |||
608 | #define NBD_META_ID_BASE_ALLOCATION 0 | ||
609 | #define NBD_META_ID_ALLOCATION_DEPTH 1 | ||
610 | diff --git a/net/l2tpv3.c b/net/l2tpv3.c | ||
611 | index XXXXXXX..XXXXXXX 100644 | ||
612 | --- a/net/l2tpv3.c | ||
613 | +++ b/net/l2tpv3.c | ||
614 | @@ -XXX,XX +XXX,XX @@ | ||
615 | #include "qemu/sockets.h" | ||
616 | #include "qemu/iov.h" | ||
617 | #include "qemu/main-loop.h" | ||
618 | - | ||
619 | +#include "qemu/memalign.h" | ||
620 | |||
621 | /* The buffer size needs to be investigated for optimum numbers and | ||
622 | * optimum means of paging in on different systems. This size is | ||
623 | diff --git a/plugins/loader.c b/plugins/loader.c | ||
624 | index XXXXXXX..XXXXXXX 100644 | ||
625 | --- a/plugins/loader.c | ||
626 | +++ b/plugins/loader.c | ||
627 | @@ -XXX,XX +XXX,XX @@ | ||
628 | #include "qemu/cacheinfo.h" | ||
629 | #include "qemu/xxhash.h" | ||
630 | #include "qemu/plugin.h" | ||
631 | +#include "qemu/memalign.h" | ||
632 | #include "hw/core/cpu.h" | ||
633 | #include "exec/exec-all.h" | ||
634 | #ifndef CONFIG_USER_ONLY | ||
635 | diff --git a/qemu-img.c b/qemu-img.c | ||
636 | index XXXXXXX..XXXXXXX 100644 | ||
637 | --- a/qemu-img.c | ||
638 | +++ b/qemu-img.c | ||
639 | @@ -XXX,XX +XXX,XX @@ | ||
640 | #include "qemu/module.h" | ||
641 | #include "qemu/sockets.h" | ||
642 | #include "qemu/units.h" | ||
643 | +#include "qemu/memalign.h" | ||
644 | #include "qom/object_interfaces.h" | ||
645 | #include "sysemu/block-backend.h" | ||
646 | #include "block/block_int.h" | ||
647 | diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c | ||
648 | index XXXXXXX..XXXXXXX 100644 | ||
649 | --- a/qemu-io-cmds.c | ||
650 | +++ b/qemu-io-cmds.c | ||
651 | @@ -XXX,XX +XXX,XX @@ | ||
652 | #include "qemu/option.h" | ||
653 | #include "qemu/timer.h" | ||
654 | #include "qemu/cutils.h" | ||
655 | +#include "qemu/memalign.h" | ||
656 | |||
657 | #define CMD_NOFILE_OK 0x01 | ||
658 | |||
659 | diff --git a/qom/object.c b/qom/object.c | ||
660 | index XXXXXXX..XXXXXXX 100644 | ||
661 | --- a/qom/object.c | ||
662 | +++ b/qom/object.c | ||
663 | @@ -XXX,XX +XXX,XX @@ | ||
664 | #include "qom/object.h" | ||
665 | #include "qom/object_interfaces.h" | ||
666 | #include "qemu/cutils.h" | ||
667 | +#include "qemu/memalign.h" | ||
668 | #include "qapi/visitor.h" | ||
669 | #include "qapi/string-input-visitor.h" | ||
670 | #include "qapi/string-output-visitor.h" | ||
671 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | ||
672 | index XXXXXXX..XXXXXXX 100644 | ||
673 | --- a/softmmu/physmem.c | ||
674 | +++ b/softmmu/physmem.c | ||
675 | @@ -XXX,XX +XXX,XX @@ | ||
676 | #include "qemu/config-file.h" | ||
677 | #include "qemu/error-report.h" | ||
678 | #include "qemu/qemu-print.h" | ||
679 | +#include "qemu/memalign.h" | ||
680 | #include "exec/memory.h" | ||
681 | #include "exec/ioport.h" | ||
682 | #include "sysemu/dma.h" | ||
683 | diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c | ||
684 | index XXXXXXX..XXXXXXX 100644 | ||
685 | --- a/target/i386/hvf/hvf.c | ||
686 | +++ b/target/i386/hvf/hvf.c | ||
687 | @@ -XXX,XX +XXX,XX @@ | ||
688 | #include "qemu/osdep.h" | ||
689 | #include "qemu-common.h" | ||
690 | #include "qemu/error-report.h" | ||
691 | +#include "qemu/memalign.h" | ||
692 | |||
693 | #include "sysemu/hvf.h" | ||
694 | #include "sysemu/hvf_int.h" | ||
695 | diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c | ||
696 | index XXXXXXX..XXXXXXX 100644 | ||
697 | --- a/target/i386/kvm/kvm.c | ||
698 | +++ b/target/i386/kvm/kvm.c | ||
699 | @@ -XXX,XX +XXX,XX @@ | ||
700 | #include "qemu/main-loop.h" | ||
701 | #include "qemu/config-file.h" | ||
702 | #include "qemu/error-report.h" | ||
703 | +#include "qemu/memalign.h" | ||
704 | #include "hw/i386/x86.h" | ||
705 | #include "hw/i386/apic.h" | ||
706 | #include "hw/i386/apic_internal.h" | ||
707 | diff --git a/tcg/region.c b/tcg/region.c | ||
708 | index XXXXXXX..XXXXXXX 100644 | ||
709 | --- a/tcg/region.c | ||
710 | +++ b/tcg/region.c | ||
711 | @@ -XXX,XX +XXX,XX @@ | ||
712 | #include "qemu/units.h" | ||
713 | #include "qemu/madvise.h" | ||
714 | #include "qemu/mprotect.h" | ||
715 | +#include "qemu/memalign.h" | ||
716 | #include "qemu/cacheinfo.h" | ||
717 | #include "qapi/error.h" | ||
718 | #include "exec/exec-all.h" | ||
719 | diff --git a/tests/bench/atomic_add-bench.c b/tests/bench/atomic_add-bench.c | ||
720 | index XXXXXXX..XXXXXXX 100644 | ||
721 | --- a/tests/bench/atomic_add-bench.c | ||
722 | +++ b/tests/bench/atomic_add-bench.c | ||
723 | @@ -XXX,XX +XXX,XX @@ | ||
724 | #include "qemu/thread.h" | ||
725 | #include "qemu/host-utils.h" | ||
726 | #include "qemu/processor.h" | ||
727 | +#include "qemu/memalign.h" | ||
728 | |||
729 | struct thread_info { | ||
730 | uint64_t r; | ||
731 | diff --git a/tests/bench/qht-bench.c b/tests/bench/qht-bench.c | ||
732 | index XXXXXXX..XXXXXXX 100644 | ||
733 | --- a/tests/bench/qht-bench.c | ||
734 | +++ b/tests/bench/qht-bench.c | ||
735 | @@ -XXX,XX +XXX,XX @@ | ||
736 | #include "qemu/qht.h" | ||
737 | #include "qemu/rcu.h" | ||
738 | #include "qemu/xxhash.h" | ||
739 | +#include "qemu/memalign.h" | ||
740 | |||
741 | struct thread_stats { | ||
742 | size_t rd; | ||
743 | diff --git a/util/atomic64.c b/util/atomic64.c | ||
744 | index XXXXXXX..XXXXXXX 100644 | ||
745 | --- a/util/atomic64.c | ||
746 | +++ b/util/atomic64.c | ||
747 | @@ -XXX,XX +XXX,XX @@ | ||
748 | #include "qemu/atomic.h" | ||
749 | #include "qemu/thread.h" | ||
750 | #include "qemu/cacheinfo.h" | ||
751 | +#include "qemu/memalign.h" | ||
752 | |||
753 | #ifdef CONFIG_ATOMIC64 | ||
754 | #error This file must only be compiled if !CONFIG_ATOMIC64 | ||
755 | diff --git a/util/memalign.c b/util/memalign.c | ||
756 | index XXXXXXX..XXXXXXX 100644 | ||
757 | --- a/util/memalign.c | ||
758 | +++ b/util/memalign.c | ||
759 | @@ -XXX,XX +XXX,XX @@ | ||
760 | |||
761 | #include "qemu/osdep.h" | ||
762 | #include "qemu/host-utils.h" | ||
763 | +#include "qemu/memalign.h" | ||
764 | #include "trace.h" | ||
765 | |||
766 | void *qemu_try_memalign(size_t alignment, size_t size) | ||
767 | diff --git a/util/qht.c b/util/qht.c | ||
768 | index XXXXXXX..XXXXXXX 100644 | ||
769 | --- a/util/qht.c | ||
770 | +++ b/util/qht.c | ||
771 | @@ -XXX,XX +XXX,XX @@ | ||
772 | #include "qemu/qht.h" | ||
773 | #include "qemu/atomic.h" | ||
774 | #include "qemu/rcu.h" | ||
775 | +#include "qemu/memalign.h" | ||
776 | |||
777 | //#define QHT_DEBUG | ||
778 | |||
779 | -- | 78 | -- |
780 | 2.25.1 | 79 | 2.34.1 |
781 | 80 | ||
782 | 81 | diff view generated by jsdifflib |
1 | qemu_vfree() is the companion free function to qemu_memalign(); put | 1 | The '-old-param' command line option is specific to Arm targets; it |
---|---|---|---|
2 | it in memalign.c so the allocation and free functions are together. | 2 | is very briefly documented as "old param mode". What this option |
3 | actually does is change the behaviour when directly booting a guest | ||
4 | kernel, so that command line arguments are passed to the kernel using | ||
5 | the extremely old "param_struct" ABI, rather than the newer ATAGS or | ||
6 | even newer DTB mechanisms. | ||
7 | |||
8 | This support was added back in 2007 to support an old vendor kernel | ||
9 | on the akita/terrier board types: | ||
10 | https://mail.gnu.org/archive/html/qemu-devel/2007-07/msg00344.html | ||
11 | Even then, it was an out-of-date mechanism from the kernel's | ||
12 | point of view -- the kernel has had a comment since 2001 marking | ||
13 | it as deprecated. As of mid-2024, the kernel only retained | ||
14 | param_struct support for the RiscPC and Footbridge platforms: | ||
15 | https://lore.kernel.org/linux-arm-kernel/2831c5a6-cfbf-4fe0-b51c-0396e5b0aeb7@app.fastmail.com/ | ||
16 | |||
17 | None of the board types QEMU supports need param_struct support; | ||
18 | mark this option as deprecated. | ||
3 | 19 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 21 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> |
6 | Message-id: 20220226180723.1706285-9-peter.maydell@linaro.org | 22 | Message-id: 20250127123113.2947620-1-peter.maydell@linaro.org |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | --- | 23 | --- |
9 | util/memalign.c | 11 +++++++++++ | 24 | docs/about/deprecated.rst | 13 +++++++++++++ |
10 | util/oslib-posix.c | 6 ------ | 25 | system/vl.c | 1 + |
11 | util/oslib-win32.c | 6 ------ | 26 | 2 files changed, 14 insertions(+) |
12 | 3 files changed, 11 insertions(+), 12 deletions(-) | ||
13 | 27 | ||
14 | diff --git a/util/memalign.c b/util/memalign.c | 28 | diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst |
15 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/util/memalign.c | 30 | --- a/docs/about/deprecated.rst |
17 | +++ b/util/memalign.c | 31 | +++ b/docs/about/deprecated.rst |
18 | @@ -XXX,XX +XXX,XX @@ void *qemu_memalign(size_t alignment, size_t size) | 32 | @@ -XXX,XX +XXX,XX @@ configurations (e.g. -smp drawers=1,books=1,clusters=1 for x86 PC machine) is |
19 | size, alignment, strerror(errno)); | 33 | marked deprecated since 9.0, users have to ensure that all the topology members |
20 | abort(); | 34 | described with -smp are supported by the target machine. |
21 | } | 35 | |
36 | +``-old-param`` option for booting Arm kernels via param_struct (since 10.0) | ||
37 | +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' | ||
22 | + | 38 | + |
23 | +void qemu_vfree(void *ptr) | 39 | +The ``-old-param`` command line option is specific to Arm targets: |
24 | +{ | 40 | +it is used when directly booting a guest kernel to pass it the |
25 | + trace_qemu_vfree(ptr); | 41 | +command line and other information via the old ``param_struct`` ABI, |
26 | +#if !defined(CONFIG_POSIX_MEMALIGN) && defined(CONFIG_ALIGNED_MALLOC) | 42 | +rather than the newer ATAGS or DTB mechanisms. This option was only |
27 | + /* Only Windows _aligned_malloc needs a special free function */ | 43 | +ever needed to support ancient kernels on some old board types |
28 | + _aligned_free(ptr); | 44 | +like the ``akita`` or ``terrier``; it has been deprecated in the |
29 | +#else | 45 | +kernel since 2001. None of the board types QEMU supports need |
30 | + free(ptr); | 46 | +``param_struct`` support, so this option has been deprecated and will |
31 | +#endif | 47 | +be removed in a future QEMU version. |
32 | +} | 48 | + |
33 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 49 | User-mode emulator command line arguments |
50 | ----------------------------------------- | ||
51 | |||
52 | diff --git a/system/vl.c b/system/vl.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | 53 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/util/oslib-posix.c | 54 | --- a/system/vl.c |
36 | +++ b/util/oslib-posix.c | 55 | +++ b/system/vl.c |
37 | @@ -XXX,XX +XXX,XX @@ void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared, | 56 | @@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv) |
38 | return ptr; | 57 | nb_prom_envs++; |
39 | } | 58 | break; |
40 | 59 | case QEMU_OPTION_old_param: | |
41 | -void qemu_vfree(void *ptr) | 60 | + warn_report("-old-param is deprecated"); |
42 | -{ | 61 | old_param = 1; |
43 | - trace_qemu_vfree(ptr); | 62 | break; |
44 | - free(ptr); | 63 | case QEMU_OPTION_rtc: |
45 | -} | ||
46 | - | ||
47 | void qemu_anon_ram_free(void *ptr, size_t size) | ||
48 | { | ||
49 | trace_qemu_anon_ram_free(ptr, size); | ||
50 | diff --git a/util/oslib-win32.c b/util/oslib-win32.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/util/oslib-win32.c | ||
53 | +++ b/util/oslib-win32.c | ||
54 | @@ -XXX,XX +XXX,XX @@ void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared, | ||
55 | return ptr; | ||
56 | } | ||
57 | |||
58 | -void qemu_vfree(void *ptr) | ||
59 | -{ | ||
60 | - trace_qemu_vfree(ptr); | ||
61 | - _aligned_free(ptr); | ||
62 | -} | ||
63 | - | ||
64 | void qemu_anon_ram_free(void *ptr, size_t size) | ||
65 | { | ||
66 | trace_qemu_anon_ram_free(ptr, size); | ||
67 | -- | 64 | -- |
68 | 2.25.1 | 65 | 2.34.1 |
69 | 66 | ||
70 | 67 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For VLD1/VST1 (single element to one lane) we are only accessing one | ||
2 | register, and so the 'stride' is meaningless. The bits that would | ||
3 | specify stride (insn bit [4] for size=1, bit [6] for size=2) are | ||
4 | specified to be zero in the encoding (which would correspond to a | ||
5 | stride of 1 for VLD2/VLD3/VLD4 etc), and we must UNDEF if they are | ||
6 | not. | ||
7 | 1 | ||
8 | We failed to make this check, which meant that we would incorrectly | ||
9 | handle some instruction patterns as loads or stores instead of | ||
10 | UNDEFing them. Enforce that stride == 1 for the nregs == 1 case. | ||
11 | |||
12 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/890 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Tested-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20220303113741.2156877-2-peter.maydell@linaro.org | ||
17 | --- | ||
18 | target/arm/translate-neon.c | 3 +++ | ||
19 | 1 file changed, 3 insertions(+) | ||
20 | |||
21 | diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/translate-neon.c | ||
24 | +++ b/target/arm/translate-neon.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
26 | /* Catch the UNDEF cases. This is unavoidably a bit messy. */ | ||
27 | switch (nregs) { | ||
28 | case 1: | ||
29 | + if (a->stride != 1) { | ||
30 | + return false; | ||
31 | + } | ||
32 | if (((a->align & (1 << a->size)) != 0) || | ||
33 | (a->size == 2 && (a->align == 1 || a->align == 2))) { | ||
34 | return false; | ||
35 | -- | ||
36 | 2.25.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For VLD3 (single 3-element structure to one lane), there is no | ||
2 | alignment specification and the alignment bits in the instruction | ||
3 | must be zero. This is bit [4] for the size=0 and size=1 cases, and | ||
4 | bits [5:4] for the size=2 case. We do this check correctly in | ||
5 | VLDST_single(), but we write it a bit oddly: in the 'case 3' code we | ||
6 | check for bit 0 of a->align (bit [4] of the insn), and then we fall | ||
7 | through to the 'case 2' code which checks bit 1 of a->align (bit [5] | ||
8 | of the insn) in the size 2 case. Replace this with just checking "is | ||
9 | a->align non-zero" for VLD3, which lets us drop the fall-through and | ||
10 | put the cases in this switch in numerical order. | ||
11 | 1 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Tested-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220303113741.2156877-3-peter.maydell@linaro.org | ||
16 | --- | ||
17 | target/arm/translate-neon.c | 10 +++++----- | ||
18 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
19 | |||
20 | diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/arm/translate-neon.c | ||
23 | +++ b/target/arm/translate-neon.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
25 | return false; | ||
26 | } | ||
27 | break; | ||
28 | - case 3: | ||
29 | - if ((a->align & 1) != 0) { | ||
30 | - return false; | ||
31 | - } | ||
32 | - /* fall through */ | ||
33 | case 2: | ||
34 | if (a->size == 2 && (a->align & 2) != 0) { | ||
35 | return false; | ||
36 | } | ||
37 | break; | ||
38 | + case 3: | ||
39 | + if (a->align != 0) { | ||
40 | + return false; | ||
41 | + } | ||
42 | + break; | ||
43 | case 4: | ||
44 | if (a->size == 2 && a->align == 3) { | ||
45 | return false; | ||
46 | -- | ||
47 | 2.25.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | When debugging code that's using the ITS, it's helpful to | ||
2 | see tracing of the ITS commands that the guest executes. Add | ||
3 | suitable trace events. | ||
4 | 1 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220303202341.2232284-2-peter.maydell@linaro.org | ||
8 | --- | ||
9 | hw/intc/arm_gicv3_its.c | 28 ++++++++++++++++++++++++++-- | ||
10 | hw/intc/trace-events | 12 ++++++++++++ | ||
11 | 2 files changed, 38 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/intc/arm_gicv3_its.c | ||
16 | +++ b/hw/intc/arm_gicv3_its.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static ItsCmdResult process_its_cmd(GICv3ITSState *s, const uint64_t *cmdpkt, | ||
18 | |||
19 | devid = (cmdpkt[0] & DEVID_MASK) >> DEVID_SHIFT; | ||
20 | eventid = cmdpkt[1] & EVENTID_MASK; | ||
21 | + switch (cmd) { | ||
22 | + case INTERRUPT: | ||
23 | + trace_gicv3_its_cmd_int(devid, eventid); | ||
24 | + break; | ||
25 | + case CLEAR: | ||
26 | + trace_gicv3_its_cmd_clear(devid, eventid); | ||
27 | + break; | ||
28 | + case DISCARD: | ||
29 | + trace_gicv3_its_cmd_discard(devid, eventid); | ||
30 | + break; | ||
31 | + default: | ||
32 | + g_assert_not_reached(); | ||
33 | + } | ||
34 | return do_process_its_cmd(s, devid, eventid, cmd); | ||
35 | } | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, | ||
38 | |||
39 | devid = (cmdpkt[0] & DEVID_MASK) >> DEVID_SHIFT; | ||
40 | eventid = cmdpkt[1] & EVENTID_MASK; | ||
41 | + icid = cmdpkt[2] & ICID_MASK; | ||
42 | |||
43 | if (ignore_pInt) { | ||
44 | pIntid = eventid; | ||
45 | + trace_gicv3_its_cmd_mapi(devid, eventid, icid); | ||
46 | } else { | ||
47 | pIntid = (cmdpkt[1] & pINTID_MASK) >> pINTID_SHIFT; | ||
48 | + trace_gicv3_its_cmd_mapti(devid, eventid, icid, pIntid); | ||
49 | } | ||
50 | |||
51 | - icid = cmdpkt[2] & ICID_MASK; | ||
52 | - | ||
53 | if (devid >= s->dt.num_entries) { | ||
54 | qemu_log_mask(LOG_GUEST_ERROR, | ||
55 | "%s: invalid command attributes: devid %d>=%d", | ||
56 | @@ -XXX,XX +XXX,XX @@ static ItsCmdResult process_mapc(GICv3ITSState *s, const uint64_t *cmdpkt) | ||
57 | } else { | ||
58 | cte.rdbase = 0; | ||
59 | } | ||
60 | + trace_gicv3_its_cmd_mapc(icid, cte.rdbase, cte.valid); | ||
61 | |||
62 | if (icid >= s->ct.num_entries) { | ||
63 | qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPC: invalid ICID 0x%d", icid); | ||
64 | @@ -XXX,XX +XXX,XX @@ static ItsCmdResult process_mapd(GICv3ITSState *s, const uint64_t *cmdpkt) | ||
65 | dte.ittaddr = (cmdpkt[2] & ITTADDR_MASK) >> ITTADDR_SHIFT; | ||
66 | dte.valid = cmdpkt[2] & CMD_FIELD_VALID_MASK; | ||
67 | |||
68 | + trace_gicv3_its_cmd_mapd(devid, dte.size, dte.ittaddr, dte.valid); | ||
69 | + | ||
70 | if (devid >= s->dt.num_entries) { | ||
71 | qemu_log_mask(LOG_GUEST_ERROR, | ||
72 | "ITS MAPD: invalid device ID field 0x%x >= 0x%x\n", | ||
73 | @@ -XXX,XX +XXX,XX @@ static ItsCmdResult process_movall(GICv3ITSState *s, const uint64_t *cmdpkt) | ||
74 | rd1 = FIELD_EX64(cmdpkt[2], MOVALL_2, RDBASE1); | ||
75 | rd2 = FIELD_EX64(cmdpkt[3], MOVALL_3, RDBASE2); | ||
76 | |||
77 | + trace_gicv3_its_cmd_movall(rd1, rd2); | ||
78 | + | ||
79 | if (rd1 >= s->gicv3->num_cpu) { | ||
80 | qemu_log_mask(LOG_GUEST_ERROR, | ||
81 | "%s: RDBASE1 %" PRId64 | ||
82 | @@ -XXX,XX +XXX,XX @@ static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) | ||
83 | eventid = FIELD_EX64(cmdpkt[1], MOVI_1, EVENTID); | ||
84 | new_icid = FIELD_EX64(cmdpkt[2], MOVI_2, ICID); | ||
85 | |||
86 | + trace_gicv3_its_cmd_movi(devid, eventid, new_icid); | ||
87 | + | ||
88 | if (devid >= s->dt.num_entries) { | ||
89 | qemu_log_mask(LOG_GUEST_ERROR, | ||
90 | "%s: invalid command attributes: devid %d>=%d", | ||
91 | @@ -XXX,XX +XXX,XX @@ static void process_cmdq(GICv3ITSState *s) | ||
92 | * is already consistent by the time SYNC command is executed. | ||
93 | * Hence no further processing is required for SYNC command. | ||
94 | */ | ||
95 | + trace_gicv3_its_cmd_sync(); | ||
96 | break; | ||
97 | case GITS_CMD_MAPD: | ||
98 | result = process_mapd(s, cmdpkt); | ||
99 | @@ -XXX,XX +XXX,XX @@ static void process_cmdq(GICv3ITSState *s) | ||
100 | * need to trigger lpi priority re-calculation to be in | ||
101 | * sync with LPI config table or pending table changes. | ||
102 | */ | ||
103 | + trace_gicv3_its_cmd_inv(); | ||
104 | for (i = 0; i < s->gicv3->num_cpu; i++) { | ||
105 | gicv3_redist_update_lpi(&s->gicv3->cpu[i]); | ||
106 | } | ||
107 | @@ -XXX,XX +XXX,XX @@ static void process_cmdq(GICv3ITSState *s) | ||
108 | result = process_movall(s, cmdpkt); | ||
109 | break; | ||
110 | default: | ||
111 | + trace_gicv3_its_cmd_unknown(cmd); | ||
112 | break; | ||
113 | } | ||
114 | if (result == CMD_CONTINUE) { | ||
115 | diff --git a/hw/intc/trace-events b/hw/intc/trace-events | ||
116 | index XXXXXXX..XXXXXXX 100644 | ||
117 | --- a/hw/intc/trace-events | ||
118 | +++ b/hw/intc/trace-events | ||
119 | @@ -XXX,XX +XXX,XX @@ gicv3_its_write(uint64_t offset, uint64_t data, unsigned size) "GICv3 ITS write: | ||
120 | gicv3_its_badwrite(uint64_t offset, uint64_t data, unsigned size) "GICv3 ITS write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u: error" | ||
121 | gicv3_its_translation_write(uint64_t offset, uint64_t data, unsigned size, uint32_t requester_id) "GICv3 ITS TRANSLATER write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u requester_id 0x%x" | ||
122 | gicv3_its_process_command(uint32_t rd_offset, uint8_t cmd) "GICv3 ITS: processing command at offset 0x%x: 0x%x" | ||
123 | +gicv3_its_cmd_int(uint32_t devid, uint32_t eventid) "GICv3 ITS: command INT DeviceID 0x%x EventID 0x%x" | ||
124 | +gicv3_its_cmd_clear(uint32_t devid, uint32_t eventid) "GICv3 ITS: command CLEAR DeviceID 0x%x EventID 0x%x" | ||
125 | +gicv3_its_cmd_discard(uint32_t devid, uint32_t eventid) "GICv3 ITS: command DISCARD DeviceID 0x%x EventID 0x%x" | ||
126 | +gicv3_its_cmd_sync(void) "GICv3 ITS: command SYNC" | ||
127 | +gicv3_its_cmd_mapd(uint32_t devid, uint32_t size, uint64_t ittaddr, int valid) "GICv3 ITS: command MAPD DeviceID 0x%x Size 0x%x ITT_addr 0x%" PRIx64 " V %d" | ||
128 | +gicv3_its_cmd_mapc(uint32_t icid, uint64_t rdbase, int valid) "GICv3 ITS: command MAPC ICID 0x%x RDbase 0x%" PRIx64 " V %d" | ||
129 | +gicv3_its_cmd_mapi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MAPI DeviceID 0x%x EventID 0x%x ICID 0x%x" | ||
130 | +gicv3_its_cmd_mapti(uint32_t devid, uint32_t eventid, uint32_t icid, uint32_t intid) "GICv3 ITS: command MAPTI DeviceID 0x%x EventID 0x%x ICID 0x%x pINTID 0x%x" | ||
131 | +gicv3_its_cmd_inv(void) "GICv3 ITS: command INV or INVALL" | ||
132 | +gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVALL RDbase1 0x%" PRIx64 " RDbase2 0x%" PRIx64 | ||
133 | +gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" | ||
134 | +gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" | ||
135 | |||
136 | # armv7m_nvic.c | ||
137 | nvic_recompute_state(int vectpending, int vectpending_prio, int exception_prio) "NVIC state recomputed: vectpending %d vectpending_prio %d exception_prio %d" | ||
138 | -- | ||
139 | 2.25.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The GICv3 has some registers that support byte accesses, and some | ||
2 | that support 8-byte accesses. Our TCG implementation implements all | ||
3 | of this, switching on the 'size' argument and handling the registers | ||
4 | that must support reads of that size while logging an error for | ||
5 | attempted accesses to registers that do not support that size access. | ||
6 | However we forgot to tell the core memory subsystem about this by | ||
7 | specifying the .impl and .valid fields in the MemoryRegionOps struct, | ||
8 | so the core was happily simulating 8 byte accesses by combining two 4 | ||
9 | byte accesses. This doesn't have much guest-visible effect, since | ||
10 | there aren't many 8 byte registers and they all support being written | ||
11 | in two 4 byte parts. | ||
12 | 1 | ||
13 | Set the .impl and .valid fields to say that all sizes from 1 to 8 | ||
14 | bytes are both valid and implemented by the device. | ||
15 | |||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Message-id: 20220303202341.2232284-4-peter.maydell@linaro.org | ||
19 | --- | ||
20 | hw/intc/arm_gicv3.c | 8 ++++++++ | ||
21 | 1 file changed, 8 insertions(+) | ||
22 | |||
23 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/hw/intc/arm_gicv3.c | ||
26 | +++ b/hw/intc/arm_gicv3.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps gic_ops[] = { | ||
28 | .read_with_attrs = gicv3_dist_read, | ||
29 | .write_with_attrs = gicv3_dist_write, | ||
30 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
31 | + .valid.min_access_size = 1, | ||
32 | + .valid.max_access_size = 8, | ||
33 | + .impl.min_access_size = 1, | ||
34 | + .impl.max_access_size = 8, | ||
35 | }, | ||
36 | { | ||
37 | .read_with_attrs = gicv3_redist_read, | ||
38 | .write_with_attrs = gicv3_redist_write, | ||
39 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
40 | + .valid.min_access_size = 1, | ||
41 | + .valid.max_access_size = 8, | ||
42 | + .impl.min_access_size = 1, | ||
43 | + .impl.max_access_size = 8, | ||
44 | } | ||
45 | }; | ||
46 | |||
47 | -- | ||
48 | 2.25.1 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | We forgot a space in some log messages, so the output ended | ||
2 | up looking like | ||
3 | gicv3_dist_write: invalid guest write at offset 0000000000008000size 8 | ||
4 | 1 | ||
5 | with a missing space before "size". Add the missing spaces. | ||
6 | |||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20220303202341.2232284-5-peter.maydell@linaro.org | ||
10 | --- | ||
11 | hw/intc/arm_gicv3_dist.c | 4 ++-- | ||
12 | hw/intc/arm_gicv3_its.c | 4 ++-- | ||
13 | 2 files changed, 4 insertions(+), 4 deletions(-) | ||
14 | |||
15 | diff --git a/hw/intc/arm_gicv3_dist.c b/hw/intc/arm_gicv3_dist.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/intc/arm_gicv3_dist.c | ||
18 | +++ b/hw/intc/arm_gicv3_dist.c | ||
19 | @@ -XXX,XX +XXX,XX @@ MemTxResult gicv3_dist_read(void *opaque, hwaddr offset, uint64_t *data, | ||
20 | if (!r) { | ||
21 | qemu_log_mask(LOG_GUEST_ERROR, | ||
22 | "%s: invalid guest read at offset " TARGET_FMT_plx | ||
23 | - "size %u\n", __func__, offset, size); | ||
24 | + " size %u\n", __func__, offset, size); | ||
25 | trace_gicv3_dist_badread(offset, size, attrs.secure); | ||
26 | /* The spec requires that reserved registers are RAZ/WI; | ||
27 | * so use MEMTX_ERROR returns from leaf functions as a way to | ||
28 | @@ -XXX,XX +XXX,XX @@ MemTxResult gicv3_dist_write(void *opaque, hwaddr offset, uint64_t data, | ||
29 | if (!r) { | ||
30 | qemu_log_mask(LOG_GUEST_ERROR, | ||
31 | "%s: invalid guest write at offset " TARGET_FMT_plx | ||
32 | - "size %u\n", __func__, offset, size); | ||
33 | + " size %u\n", __func__, offset, size); | ||
34 | trace_gicv3_dist_badwrite(offset, data, size, attrs.secure); | ||
35 | /* The spec requires that reserved registers are RAZ/WI; | ||
36 | * so use MEMTX_ERROR returns from leaf functions as a way to | ||
37 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/intc/arm_gicv3_its.c | ||
40 | +++ b/hw/intc/arm_gicv3_its.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static MemTxResult gicv3_its_read(void *opaque, hwaddr offset, uint64_t *data, | ||
42 | if (!result) { | ||
43 | qemu_log_mask(LOG_GUEST_ERROR, | ||
44 | "%s: invalid guest read at offset " TARGET_FMT_plx | ||
45 | - "size %u\n", __func__, offset, size); | ||
46 | + " size %u\n", __func__, offset, size); | ||
47 | trace_gicv3_its_badread(offset, size); | ||
48 | /* | ||
49 | * The spec requires that reserved registers are RAZ/WI; | ||
50 | @@ -XXX,XX +XXX,XX @@ static MemTxResult gicv3_its_write(void *opaque, hwaddr offset, uint64_t data, | ||
51 | if (!result) { | ||
52 | qemu_log_mask(LOG_GUEST_ERROR, | ||
53 | "%s: invalid guest write at offset " TARGET_FMT_plx | ||
54 | - "size %u\n", __func__, offset, size); | ||
55 | + " size %u\n", __func__, offset, size); | ||
56 | trace_gicv3_its_badwrite(offset, data, size); | ||
57 | /* | ||
58 | * The spec requires that reserved registers are RAZ/WI; | ||
59 | -- | ||
60 | 2.25.1 | diff view generated by jsdifflib |
1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> | 1 | From: Khem Raj <raj.khem@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | This provides standard look and feel for the about panel and reduces | 3 | glibc 2.41+ has added [1] definitions for sched_setattr and |
4 | code. | 4 | sched_getattr functions and struct sched_attr. Therefore, it needs |
5 | to be checked for here as well before defining sched_attr, to avoid | ||
6 | a compilation failure. | ||
5 | 7 | ||
6 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> | 8 | Define sched_attr conditionally only when SCHED_ATTR_SIZE_VER0 is |
7 | Message-id: 20220227042241.1543-1-akihiko.odaki@gmail.com | 9 | not defined. |
10 | |||
11 | [1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8 | ||
12 | |||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2799 | ||
15 | Cc: qemu-stable@nongnu.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 18 | --- |
11 | ui/cocoa.m | 112 +++++++++++------------------------------------------ | 19 | linux-user/syscall.c | 4 +++- |
12 | 1 file changed, 23 insertions(+), 89 deletions(-) | 20 | 1 file changed, 3 insertions(+), 1 deletion(-) |
13 | 21 | ||
14 | diff --git a/ui/cocoa.m b/ui/cocoa.m | 22 | diff --git a/linux-user/syscall.c b/linux-user/syscall.c |
15 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/ui/cocoa.m | 24 | --- a/linux-user/syscall.c |
17 | +++ b/ui/cocoa.m | 25 | +++ b/linux-user/syscall.c |
18 | @@ -XXX,XX +XXX,XX @@ static void cocoa_switch(DisplayChangeListener *dcl, | 26 | @@ -XXX,XX +XXX,XX @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len, |
19 | 27 | #define __NR_sys_sched_setaffinity __NR_sched_setaffinity | |
20 | static void cocoa_refresh(DisplayChangeListener *dcl); | 28 | _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len, |
21 | 29 | unsigned long *, user_mask_ptr); | |
22 | -static NSWindow *normalWindow, *about_window; | 30 | -/* sched_attr is not defined in glibc */ |
23 | +static NSWindow *normalWindow; | 31 | +/* sched_attr is not defined in glibc < 2.41 */ |
24 | static const DisplayChangeListenerOps dcl_ops = { | 32 | +#ifndef SCHED_ATTR_SIZE_VER0 |
25 | .dpy_name = "cocoa", | 33 | struct sched_attr { |
26 | .dpy_gfx_update = cocoa_update, | 34 | uint32_t size; |
27 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; | 35 | uint32_t sched_policy; |
28 | - (BOOL)verifyQuit; | 36 | @@ -XXX,XX +XXX,XX @@ struct sched_attr { |
29 | - (void)openDocumentation:(NSString *)filename; | 37 | uint32_t sched_util_min; |
30 | - (IBAction) do_about_menu_item: (id) sender; | 38 | uint32_t sched_util_max; |
31 | -- (void)make_about_window; | 39 | }; |
32 | - (void)adjustSpeed:(id)sender; | 40 | +#endif |
33 | @end | 41 | #define __NR_sys_sched_getattr __NR_sched_getattr |
34 | 42 | _syscall4(int, sys_sched_getattr, pid_t, pid, struct sched_attr *, attr, | |
35 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; | 43 | unsigned int, size, unsigned int, flags); |
36 | [pauseLabel setFont: [NSFont fontWithName: @"Helvetica" size: 90]]; | ||
37 | [pauseLabel setTextColor: [NSColor blackColor]]; | ||
38 | [pauseLabel sizeToFit]; | ||
39 | - | ||
40 | - [self make_about_window]; | ||
41 | } | ||
42 | return self; | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; | ||
45 | /* The action method for the About menu item */ | ||
46 | - (IBAction) do_about_menu_item: (id) sender | ||
47 | { | ||
48 | - [about_window makeKeyAndOrderFront: nil]; | ||
49 | -} | ||
50 | - | ||
51 | -/* Create and display the about dialog */ | ||
52 | -- (void)make_about_window | ||
53 | -{ | ||
54 | - /* Make the window */ | ||
55 | - int x = 0, y = 0, about_width = 400, about_height = 200; | ||
56 | - NSRect window_rect = NSMakeRect(x, y, about_width, about_height); | ||
57 | - about_window = [[NSWindow alloc] initWithContentRect:window_rect | ||
58 | - styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | | ||
59 | - NSWindowStyleMaskMiniaturizable | ||
60 | - backing:NSBackingStoreBuffered | ||
61 | - defer:NO]; | ||
62 | - [about_window setTitle: @"About"]; | ||
63 | - [about_window setReleasedWhenClosed: NO]; | ||
64 | - [about_window center]; | ||
65 | - NSView *superView = [about_window contentView]; | ||
66 | - | ||
67 | - /* Create the dimensions of the picture */ | ||
68 | - int picture_width = 80, picture_height = 80; | ||
69 | - x = (about_width - picture_width)/2; | ||
70 | - y = about_height - picture_height - 10; | ||
71 | - NSRect picture_rect = NSMakeRect(x, y, picture_width, picture_height); | ||
72 | - | ||
73 | - /* Make the picture of QEMU */ | ||
74 | - NSImageView *picture_view = [[NSImageView alloc] initWithFrame: | ||
75 | - picture_rect]; | ||
76 | - char *qemu_image_path_c = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/512x512/apps/qemu.png"); | ||
77 | - NSString *qemu_image_path = [NSString stringWithUTF8String:qemu_image_path_c]; | ||
78 | - g_free(qemu_image_path_c); | ||
79 | - NSImage *qemu_image = [[NSImage alloc] initWithContentsOfFile:qemu_image_path]; | ||
80 | - [picture_view setImage: qemu_image]; | ||
81 | - [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown]; | ||
82 | - [superView addSubview: picture_view]; | ||
83 | - | ||
84 | - /* Make the name label */ | ||
85 | - NSBundle *bundle = [NSBundle mainBundle]; | ||
86 | - if (bundle) { | ||
87 | - x = 0; | ||
88 | - y = y - 25; | ||
89 | - int name_width = about_width, name_height = 20; | ||
90 | - NSRect name_rect = NSMakeRect(x, y, name_width, name_height); | ||
91 | - NSTextField *name_label = [[NSTextField alloc] initWithFrame: name_rect]; | ||
92 | - [name_label setEditable: NO]; | ||
93 | - [name_label setBezeled: NO]; | ||
94 | - [name_label setDrawsBackground: NO]; | ||
95 | - [name_label setAlignment: NSTextAlignmentCenter]; | ||
96 | - NSString *qemu_name = [[bundle executablePath] lastPathComponent]; | ||
97 | - [name_label setStringValue: qemu_name]; | ||
98 | - [superView addSubview: name_label]; | ||
99 | + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
100 | + char *icon_path_c = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/512x512/apps/qemu.png"); | ||
101 | + NSString *icon_path = [NSString stringWithUTF8String:icon_path_c]; | ||
102 | + g_free(icon_path_c); | ||
103 | + NSImage *icon = [[NSImage alloc] initWithContentsOfFile:icon_path]; | ||
104 | + NSString *version = @"QEMU emulator version " QEMU_FULL_VERSION; | ||
105 | + NSString *copyright = @QEMU_COPYRIGHT; | ||
106 | + NSDictionary *options; | ||
107 | + if (icon) { | ||
108 | + options = @{ | ||
109 | + NSAboutPanelOptionApplicationIcon : icon, | ||
110 | + NSAboutPanelOptionApplicationVersion : version, | ||
111 | + @"Copyright" : copyright, | ||
112 | + }; | ||
113 | + [icon release]; | ||
114 | + } else { | ||
115 | + options = @{ | ||
116 | + NSAboutPanelOptionApplicationVersion : version, | ||
117 | + @"Copyright" : copyright, | ||
118 | + }; | ||
119 | } | ||
120 | - | ||
121 | - /* Set the version label's attributes */ | ||
122 | - x = 0; | ||
123 | - y = 50; | ||
124 | - int version_width = about_width, version_height = 20; | ||
125 | - NSRect version_rect = NSMakeRect(x, y, version_width, version_height); | ||
126 | - NSTextField *version_label = [[NSTextField alloc] initWithFrame: | ||
127 | - version_rect]; | ||
128 | - [version_label setEditable: NO]; | ||
129 | - [version_label setBezeled: NO]; | ||
130 | - [version_label setAlignment: NSTextAlignmentCenter]; | ||
131 | - [version_label setDrawsBackground: NO]; | ||
132 | - | ||
133 | - /* Create the version string*/ | ||
134 | - NSString *version_string; | ||
135 | - version_string = [[NSString alloc] initWithFormat: | ||
136 | - @"QEMU emulator version %s", QEMU_FULL_VERSION]; | ||
137 | - [version_label setStringValue: version_string]; | ||
138 | - [superView addSubview: version_label]; | ||
139 | - | ||
140 | - /* Make copyright label */ | ||
141 | - x = 0; | ||
142 | - y = 35; | ||
143 | - int copyright_width = about_width, copyright_height = 20; | ||
144 | - NSRect copyright_rect = NSMakeRect(x, y, copyright_width, copyright_height); | ||
145 | - NSTextField *copyright_label = [[NSTextField alloc] initWithFrame: | ||
146 | - copyright_rect]; | ||
147 | - [copyright_label setEditable: NO]; | ||
148 | - [copyright_label setBezeled: NO]; | ||
149 | - [copyright_label setDrawsBackground: NO]; | ||
150 | - [copyright_label setAlignment: NSTextAlignmentCenter]; | ||
151 | - [copyright_label setStringValue: [NSString stringWithFormat: @"%s", | ||
152 | - QEMU_COPYRIGHT]]; | ||
153 | - [superView addSubview: copyright_label]; | ||
154 | + [NSApp orderFrontStandardAboutPanelWithOptions:options]; | ||
155 | + [pool release]; | ||
156 | } | ||
157 | |||
158 | /* Used by the Speed menu items */ | ||
159 | -- | 44 | -- |
160 | 2.25.1 | 45 | 2.34.1 | diff view generated by jsdifflib |