1 | First arm pullreq for 6.1 cycle. The big stuff here is RTH's alignment series. | 1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | thanks |
4 | -- PMM | 4 | -- PMM |
5 | 5 | ||
6 | The following changes since commit ccdf06c1db192152ac70a1dd974c624f566cb7d4: | 6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: |
7 | 7 | ||
8 | Open 6.1 development tree (2021-04-30 11:15:40 +0100) | 8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) |
9 | 9 | ||
10 | are available in the Git repository at: | 10 | are available in the Git repository at: |
11 | 11 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210430 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 |
13 | 13 | ||
14 | for you to fetch changes up to a6091108aa44e9017af4ca13c43f55a629e3744c: | 14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: |
15 | 15 | ||
16 | hw/pci-host/gpex: Don't fault for unmapped parts of MMIO and PIO windows (2021-04-30 11:16:52 +0100) | 16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) |
17 | 17 | ||
18 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | target-arm queue: | 19 | target-arm queue: |
20 | * hw/pci-host/gpex: Don't fault for unmapped parts of MMIO and PIO windows | 20 | * ITS: error reporting cleanup |
21 | * hw: add compat machines for 6.1 | 21 | * aspeed: improve documentation |
22 | * Fault misaligned accesses where the architecture requires it | 22 | * Fix STM32F2XX USART data register readout |
23 | * Fix some corner cases of MTE faults (notably with misaligned accesses) | 23 | * allow emulated GICv3 to be disabled in non-TCG builds |
24 | * Make Thumb store insns UNDEF for Rn==1111 | 24 | * fix exception priority for singlestep, misaligned PC, bp, etc |
25 | * hw/arm/smmuv3: Support 16K translation granule | 25 | * Correct calculation of tlb range invalidate length |
26 | * npcm7xx_emc: fix missing queue_flush | ||
27 | * virt: Add VIOT ACPI table for virtio-iommu | ||
28 | * target/i386: Use assert() to sanity-check b1 in SSE decode | ||
29 | * Don't include qemu-common unnecessarily | ||
26 | 30 | ||
27 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
28 | Cornelia Huck (1): | 32 | Alex Bennée (1): |
29 | hw: add compat machines for 6.1 | 33 | hw/intc: clean-up error reporting for failed ITS cmd |
30 | 34 | ||
31 | Kunkun Jiang (1): | 35 | Jean-Philippe Brucker (8): |
32 | hw/arm/smmuv3: Support 16K translation granule | 36 | hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu |
37 | hw/arm/virt: Remove device tree restriction for virtio-iommu | ||
38 | hw/arm/virt: Reject instantiation of multiple IOMMUs | ||
39 | hw/arm/virt: Use object_property_set instead of qdev_prop_set | ||
40 | tests/acpi: allow updates of VIOT expected data files | ||
41 | tests/acpi: add test case for VIOT | ||
42 | tests/acpi: add expected blobs for VIOT test on q35 machine | ||
43 | tests/acpi: add expected blob for VIOT test on virt machine | ||
33 | 44 | ||
34 | Peter Maydell (2): | 45 | Joel Stanley (4): |
35 | target/arm: Make Thumb store insns UNDEF for Rn==1111 | 46 | docs: aspeed: Add new boards |
36 | hw/pci-host/gpex: Don't fault for unmapped parts of MMIO and PIO windows | 47 | docs: aspeed: Update OpenBMC image URL |
48 | docs: aspeed: Give an example of booting a kernel | ||
49 | docs: aspeed: ADC is now modelled | ||
37 | 50 | ||
38 | Richard Henderson (39): | 51 | Olivier Hériveaux (1): |
39 | target/arm: Fix mte_checkN | 52 | Fix STM32F2XX USART data register readout |
40 | target/arm: Split out mte_probe_int | ||
41 | target/arm: Fix unaligned checks for mte_check1, mte_probe1 | ||
42 | test/tcg/aarch64: Add mte-5 | ||
43 | target/arm: Replace MTEDESC ESIZE+TSIZE with SIZEM1 | ||
44 | target/arm: Merge mte_check1, mte_checkN | ||
45 | target/arm: Rename mte_probe1 to mte_probe | ||
46 | target/arm: Simplify sve mte checking | ||
47 | target/arm: Remove log2_esize parameter to gen_mte_checkN | ||
48 | target/arm: Fix decode of align in VLDST_single | ||
49 | target/arm: Rename TBFLAG_A32, SCTLR_B | ||
50 | target/arm: Rename TBFLAG_ANY, PSTATE_SS | ||
51 | target/arm: Add wrapper macros for accessing tbflags | ||
52 | target/arm: Introduce CPUARMTBFlags | ||
53 | target/arm: Move mode specific TB flags to tb->cs_base | ||
54 | target/arm: Move TBFLAG_AM32 bits to the top | ||
55 | target/arm: Move TBFLAG_ANY bits to the bottom | ||
56 | target/arm: Add ALIGN_MEM to TBFLAG_ANY | ||
57 | target/arm: Adjust gen_aa32_{ld, st}_i32 for align+endianness | ||
58 | target/arm: Merge gen_aa32_frob64 into gen_aa32_ld_i64 | ||
59 | target/arm: Fix SCTLR_B test for TCGv_i64 load/store | ||
60 | target/arm: Adjust gen_aa32_{ld, st}_i64 for align+endianness | ||
61 | target/arm: Enforce word alignment for LDRD/STRD | ||
62 | target/arm: Enforce alignment for LDA/LDAH/STL/STLH | ||
63 | target/arm: Enforce alignment for LDM/STM | ||
64 | target/arm: Enforce alignment for RFE | ||
65 | target/arm: Enforce alignment for SRS | ||
66 | target/arm: Enforce alignment for VLDM/VSTM | ||
67 | target/arm: Enforce alignment for VLDR/VSTR | ||
68 | target/arm: Enforce alignment for VLDn (all lanes) | ||
69 | target/arm: Enforce alignment for VLDn/VSTn (multiple) | ||
70 | target/arm: Enforce alignment for VLDn/VSTn (single) | ||
71 | target/arm: Use finalize_memop for aa64 gpr load/store | ||
72 | target/arm: Use finalize_memop for aa64 fpr load/store | ||
73 | target/arm: Enforce alignment for aa64 load-acq/store-rel | ||
74 | target/arm: Use MemOp for size + endian in aa64 vector ld/st | ||
75 | target/arm: Enforce alignment for aa64 vector LDn/STn (multiple) | ||
76 | target/arm: Enforce alignment for aa64 vector LDn/STn (single) | ||
77 | target/arm: Enforce alignment for sve LD1R | ||
78 | 53 | ||
79 | include/hw/boards.h | 3 + | 54 | Patrick Venture (1): |
80 | include/hw/i386/pc.h | 3 + | 55 | hw/net: npcm7xx_emc fix missing queue_flush |
81 | include/hw/pci-host/gpex.h | 4 + | ||
82 | target/arm/cpu.h | 105 ++++++++++----- | ||
83 | target/arm/helper-a64.h | 3 +- | ||
84 | target/arm/internals.h | 11 +- | ||
85 | target/arm/translate-a64.h | 2 +- | ||
86 | target/arm/translate.h | 38 ++++++ | ||
87 | target/arm/neon-ls.decode | 4 +- | ||
88 | hw/arm/smmuv3.c | 6 +- | ||
89 | hw/arm/virt.c | 7 +- | ||
90 | hw/core/machine.c | 5 + | ||
91 | hw/i386/pc.c | 3 + | ||
92 | hw/i386/pc_piix.c | 14 +- | ||
93 | hw/i386/pc_q35.c | 13 +- | ||
94 | hw/pci-host/gpex.c | 56 +++++++- | ||
95 | hw/ppc/spapr.c | 17 ++- | ||
96 | hw/s390x/s390-virtio-ccw.c | 14 +- | ||
97 | target/arm/helper-a64.c | 2 +- | ||
98 | target/arm/helper.c | 162 ++++++++++++---------- | ||
99 | target/arm/mte_helper.c | 185 ++++++++++--------------- | ||
100 | target/arm/sve_helper.c | 100 +++++--------- | ||
101 | target/arm/translate-a64.c | 236 ++++++++++++++++---------------- | ||
102 | target/arm/translate-sve.c | 11 +- | ||
103 | target/arm/translate.c | 274 ++++++++++++++++++++++---------------- | ||
104 | tests/tcg/aarch64/mte-5.c | 44 ++++++ | ||
105 | target/arm/translate-neon.c.inc | 117 ++++++++++++---- | ||
106 | target/arm/translate-vfp.c.inc | 20 +-- | ||
107 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
108 | 29 files changed, 878 insertions(+), 583 deletions(-) | ||
109 | create mode 100644 tests/tcg/aarch64/mte-5.c | ||
110 | 56 | ||
57 | Peter Maydell (6): | ||
58 | target/i386: Use assert() to sanity-check b1 in SSE decode | ||
59 | include/hw/i386: Don't include qemu-common.h in .h files | ||
60 | target/hexagon/cpu.h: don't include qemu-common.h | ||
61 | target/rx/cpu.h: Don't include qemu-common.h | ||
62 | hw/arm: Don't include qemu-common.h unnecessarily | ||
63 | target/arm: Correct calculation of tlb range invalidate length | ||
64 | |||
65 | Philippe Mathieu-Daudé (2): | ||
66 | hw/intc/arm_gicv3: Extract gicv3_set_gicv3state from arm_gicv3_cpuif.c | ||
67 | hw/intc/arm_gicv3: Introduce CONFIG_ARM_GIC_TCG Kconfig selector | ||
68 | |||
69 | Richard Henderson (10): | ||
70 | target/arm: Hoist pc_next to a local variable in aarch64_tr_translate_insn | ||
71 | target/arm: Hoist pc_next to a local variable in arm_tr_translate_insn | ||
72 | target/arm: Hoist pc_next to a local variable in thumb_tr_translate_insn | ||
73 | target/arm: Split arm_pre_translate_insn | ||
74 | target/arm: Advance pc for arch single-step exception | ||
75 | target/arm: Split compute_fsr_fsc out of arm_deliver_fault | ||
76 | target/arm: Take an exception if PC is misaligned | ||
77 | target/arm: Assert thumb pc is aligned | ||
78 | target/arm: Suppress bp for exceptions with more priority | ||
79 | tests/tcg: Add arm and aarch64 pc alignment tests | ||
80 | |||
81 | docs/system/arm/aspeed.rst | 26 ++++++++++++---- | ||
82 | include/hw/i386/microvm.h | 1 - | ||
83 | include/hw/i386/x86.h | 1 - | ||
84 | target/arm/helper.h | 1 + | ||
85 | target/arm/syndrome.h | 5 +++ | ||
86 | target/hexagon/cpu.h | 1 - | ||
87 | target/rx/cpu.h | 1 - | ||
88 | hw/arm/boot.c | 1 - | ||
89 | hw/arm/digic_boards.c | 1 - | ||
90 | hw/arm/highbank.c | 1 - | ||
91 | hw/arm/npcm7xx_boards.c | 1 - | ||
92 | hw/arm/sbsa-ref.c | 1 - | ||
93 | hw/arm/stm32f405_soc.c | 1 - | ||
94 | hw/arm/vexpress.c | 1 - | ||
95 | hw/arm/virt-acpi-build.c | 7 +++++ | ||
96 | hw/arm/virt.c | 21 ++++++------- | ||
97 | hw/char/stm32f2xx_usart.c | 3 +- | ||
98 | hw/intc/arm_gicv3.c | 2 +- | ||
99 | hw/intc/arm_gicv3_cpuif.c | 10 +----- | ||
100 | hw/intc/arm_gicv3_cpuif_common.c | 22 +++++++++++++ | ||
101 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++-------- | ||
102 | hw/net/npcm7xx_emc.c | 18 +++++------ | ||
103 | hw/virtio/virtio-iommu-pci.c | 12 ++------ | ||
104 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++------------ | ||
105 | linux-user/hexagon/cpu_loop.c | 1 + | ||
106 | target/arm/debug_helper.c | 23 ++++++++++++++ | ||
107 | target/arm/gdbstub.c | 9 ++++-- | ||
108 | target/arm/helper.c | 6 ++-- | ||
109 | target/arm/machine.c | 10 ++++++ | ||
110 | target/arm/tlb_helper.c | 63 ++++++++++++++++++++++++++++---------- | ||
111 | target/arm/translate-a64.c | 23 ++++++++++++-- | ||
112 | target/arm/translate.c | 58 ++++++++++++++++++++++++++--------- | ||
113 | target/i386/tcg/translate.c | 12 ++------ | ||
114 | tests/qtest/bios-tables-test.c | 38 +++++++++++++++++++++++ | ||
115 | tests/tcg/aarch64/pcalign-a64.c | 37 ++++++++++++++++++++++ | ||
116 | tests/tcg/arm/pcalign-a32.c | 46 ++++++++++++++++++++++++++++ | ||
117 | hw/arm/Kconfig | 1 + | ||
118 | hw/intc/Kconfig | 5 +++ | ||
119 | hw/intc/meson.build | 11 ++++--- | ||
120 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes | ||
121 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | ||
122 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes | ||
123 | tests/tcg/aarch64/Makefile.target | 4 +-- | ||
124 | tests/tcg/arm/Makefile.target | 4 +++ | ||
125 | 44 files changed, 429 insertions(+), 145 deletions(-) | ||
126 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
127 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
128 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
129 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
130 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
131 | create mode 100644 tests/data/acpi/virt/VIOT | ||
132 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | While trying to debug a GIC ITS failure I saw some guest errors that | ||
4 | had poor formatting as well as leaving me confused as to what failed. | ||
5 | As most of the checks aren't possible without a valid dte split that | ||
6 | check apart and then check the other conditions in steps. This avoids | ||
7 | us relying on undefined data. | ||
8 | |||
9 | I still get a failure with the current kvm-unit-tests but at least I | ||
10 | know (partially) why now: | ||
11 | |||
12 | Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588 | ||
13 | PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI | ||
14 | ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0 | ||
15 | INT dev_id=2 event_id=20 | ||
16 | process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0) | ||
17 | PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap | ||
18 | SUMMARY: 6 tests, 1 unexpected failures | ||
19 | |||
20 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org |
5 | Message-id: 20210419202257.161730-30-richard.henderson@linaro.org | 23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> |
24 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 26 | --- |
8 | target/arm/translate-a64.c | 15 +++++++++++---- | 27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ |
9 | 1 file changed, 11 insertions(+), 4 deletions(-) | 28 | 1 file changed, 27 insertions(+), 12 deletions(-) |
10 | 29 | ||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c |
12 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-a64.c | 32 | --- a/hw/intc/arm_gicv3_its.c |
14 | +++ b/target/arm/translate-a64.c | 33 | +++ b/hw/intc/arm_gicv3_its.c |
15 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | 34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, |
16 | bool is_postidx = extract32(insn, 23, 1); | 35 | if (res != MEMTX_OK) { |
17 | bool is_q = extract32(insn, 30, 1); | 36 | return result; |
18 | TCGv_i64 clean_addr, tcg_rn, tcg_ebytes; | 37 | } |
19 | - MemOp endian = s->be_data; | 38 | + } else { |
20 | + MemOp endian, align, mop; | 39 | + qemu_log_mask(LOG_GUEST_ERROR, |
21 | 40 | + "%s: invalid command attributes: " | |
22 | int total; /* total bytes */ | 41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", |
23 | int elements; /* elements per vector */ | 42 | + __func__, dte, devid, res); |
24 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | 43 | + return result; |
25 | } | 44 | } |
26 | 45 | ||
27 | /* For our purposes, bytes are always little-endian. */ | 46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || |
28 | + endian = s->be_data; | 47 | - !cte_valid || (eventid > max_eventid)) { |
29 | if (size == 0) { | 48 | + |
30 | endian = MO_LE; | 49 | + /* |
31 | } | 50 | + * In this implementation, in case of guest errors we ignore the |
32 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | 51 | + * command and move onto the next command in the queue. |
33 | * Consecutive little-endian elements from a single register | 52 | + */ |
34 | * can be promoted to a larger little-endian operation. | 53 | + if (devid > s->dt.maxids.max_devids) { |
35 | */ | 54 | qemu_log_mask(LOG_GUEST_ERROR, |
36 | + align = MO_ALIGN; | 55 | - "%s: invalid command attributes " |
37 | if (selem == 1 && endian == MO_LE) { | 56 | - "devid %d or eventid %d or invalid dte %d or" |
38 | + align = pow2_align(size); | 57 | - "invalid cte %d or invalid ite %d\n", |
39 | size = 3; | 58 | - __func__, devid, eventid, dte_valid, cte_valid, |
40 | } | 59 | - ite_valid); |
41 | - elements = (is_q ? 16 : 8) >> size; | 60 | - /* |
42 | + if (!s->align_mem) { | 61 | - * in this implementation, in case of error |
43 | + align = 0; | 62 | - * we ignore this command and move onto the next |
44 | + } | 63 | - * command in the queue |
45 | + mop = endian | size | align; | 64 | - */ |
46 | 65 | + "%s: invalid command attributes: devid %d>%d", | |
47 | + elements = (is_q ? 16 : 8) >> size; | 66 | + __func__, devid, s->dt.maxids.max_devids); |
48 | tcg_ebytes = tcg_const_i64(1 << size); | 67 | + |
49 | for (r = 0; r < rpt; r++) { | 68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { |
50 | int e; | 69 | + qemu_log_mask(LOG_GUEST_ERROR, |
51 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | 70 | + "%s: invalid command attributes: " |
52 | for (xs = 0; xs < selem; xs++) { | 71 | + "dte: %s, ite: %s, cte: %s\n", |
53 | int tt = (rt + r + xs) % 32; | 72 | + __func__, |
54 | if (is_store) { | 73 | + dte_valid ? "valid" : "invalid", |
55 | - do_vec_st(s, tt, e, clean_addr, size | endian); | 74 | + ite_valid ? "valid" : "invalid", |
56 | + do_vec_st(s, tt, e, clean_addr, mop); | 75 | + cte_valid ? "valid" : "invalid"); |
57 | } else { | 76 | + } else if (eventid > max_eventid) { |
58 | - do_vec_ld(s, tt, e, clean_addr, size | endian); | 77 | + qemu_log_mask(LOG_GUEST_ERROR, |
59 | + do_vec_ld(s, tt, e, clean_addr, mop); | 78 | + "%s: invalid command attributes: eventid %d > %d\n", |
60 | } | 79 | + __func__, eventid, max_eventid); |
61 | tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); | 80 | } else { |
62 | } | 81 | /* |
82 | * Current implementation only supports rdbase == procnum | ||
63 | -- | 83 | -- |
64 | 2.20.1 | 84 | 2.25.1 |
65 | 85 | ||
66 | 86 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | removed in v7.0. |
5 | Message-id: 20210419202257.161730-31-richard.henderson@linaro.org | 5 | |
6 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Message-id: 20211117065752.330632-2-joel@jms.id.au | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 10 | --- |
8 | target/arm/translate-a64.c | 9 +++++---- | 11 | docs/system/arm/aspeed.rst | 7 ++++++- |
9 | 1 file changed, 5 insertions(+), 4 deletions(-) | 12 | 1 file changed, 6 insertions(+), 1 deletion(-) |
10 | 13 | ||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-a64.c | 16 | --- a/docs/system/arm/aspeed.rst |
14 | +++ b/target/arm/translate-a64.c | 17 | +++ b/docs/system/arm/aspeed.rst |
15 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | 18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : |
16 | int index = is_q << 3 | S << 2 | size; | 19 | |
17 | int xs, total; | 20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC |
18 | TCGv_i64 clean_addr, tcg_rn, tcg_ebytes; | 21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC |
19 | + MemOp mop; | 22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC |
20 | 23 | ||
21 | if (extract32(insn, 31, 1)) { | 24 | AST2500 SoC based machines : |
22 | unallocated_encoding(s); | 25 | |
23 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | 26 | @@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines : |
24 | 27 | - ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC | |
25 | clean_addr = gen_mte_checkN(s, tcg_rn, !is_load, is_postidx || rn != 31, | 28 | - ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC |
26 | total); | 29 | - ``sonorapass-bmc`` OCP SonoraPass BMC |
27 | + mop = finalize_memop(s, scale); | 30 | -- ``swift-bmc`` OpenPOWER Swift BMC POWER9 |
28 | 31 | +- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0) | |
29 | tcg_ebytes = tcg_const_i64(1 << scale); | 32 | +- ``fp5280g2-bmc`` Inspur FP5280G2 BMC |
30 | for (xs = 0; xs < selem; xs++) { | 33 | +- ``g220a-bmc`` Bytedance G220A BMC |
31 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | 34 | |
32 | /* Load and replicate to all elements */ | 35 | AST2600 SoC based machines : |
33 | TCGv_i64 tcg_tmp = tcg_temp_new_i64(); | 36 | |
34 | 37 | - ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7) | |
35 | - tcg_gen_qemu_ld_i64(tcg_tmp, clean_addr, | 38 | - ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC |
36 | - get_mem_index(s), s->be_data + scale); | 39 | +- ``rainier-bmc`` IBM Rainier POWER10 BMC |
37 | + tcg_gen_qemu_ld_i64(tcg_tmp, clean_addr, get_mem_index(s), mop); | 40 | +- ``fuji-bmc`` Facebook Fuji BMC |
38 | tcg_gen_gvec_dup_i64(scale, vec_full_reg_offset(s, rt), | 41 | |
39 | (is_q + 1) * 8, vec_full_reg_size(s), | 42 | Supported devices |
40 | tcg_tmp); | 43 | ----------------- |
41 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | ||
42 | } else { | ||
43 | /* Load/store one element per register */ | ||
44 | if (is_load) { | ||
45 | - do_vec_ld(s, rt, index, clean_addr, scale | s->be_data); | ||
46 | + do_vec_ld(s, rt, index, clean_addr, mop); | ||
47 | } else { | ||
48 | - do_vec_st(s, rt, index, clean_addr, scale | s->be_data); | ||
49 | + do_vec_st(s, rt, index, clean_addr, mop); | ||
50 | } | ||
51 | } | ||
52 | tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); | ||
53 | -- | 44 | -- |
54 | 2.20.1 | 45 | 2.25.1 |
55 | 46 | ||
56 | 47 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | This is the latest URL for the OpenBMC CI. The old URL still works, but |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | redirects. |
5 | Message-id: 20210419202257.161730-17-richard.henderson@linaro.org | 5 | |
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
8 | Message-id: 20211117065752.330632-3-joel@jms.id.au | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 10 | --- |
8 | target/arm/translate.c | 4 ++-- | 11 | docs/system/arm/aspeed.rst | 2 +- |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
10 | 13 | ||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate.c | 16 | --- a/docs/system/arm/aspeed.rst |
14 | +++ b/target/arm/translate.c | 17 | +++ b/docs/system/arm/aspeed.rst |
15 | @@ -XXX,XX +XXX,XX @@ static bool op_stl(DisasContext *s, arg_STL *a, MemOp mop) | 18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to |
16 | addr = load_reg(s, a->rn); | 19 | load a Linux kernel or from a firmware. Images can be downloaded from |
17 | tmp = load_reg(s, a->rt); | 20 | the OpenBMC jenkins : |
18 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | 21 | |
19 | - gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), mop); | 22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder |
20 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), mop | MO_ALIGN); | 23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
21 | disas_set_da_iss(s, mop, a->rt | ISSIsAcqRel | ISSIsWrite); | 24 | |
22 | 25 | or directly from the OpenBMC GitHub release repository : | |
23 | tcg_temp_free_i32(tmp); | ||
24 | @@ -XXX,XX +XXX,XX @@ static bool op_lda(DisasContext *s, arg_LDA *a, MemOp mop) | ||
25 | |||
26 | addr = load_reg(s, a->rn); | ||
27 | tmp = tcg_temp_new_i32(); | ||
28 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), mop); | ||
29 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), mop | MO_ALIGN); | ||
30 | disas_set_da_iss(s, mop, a->rt | ISSIsAcqRel); | ||
31 | tcg_temp_free_i32(addr); | ||
32 | 26 | ||
33 | -- | 27 | -- |
34 | 2.20.1 | 28 | 2.25.1 |
35 | 29 | ||
36 | 30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | A common use case for the ASPEED machine is to boot a Linux kernel. |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Provide a full example command line. |
5 | Message-id: 20210419202257.161730-29-richard.henderson@linaro.org | 5 | |
6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
8 | Message-id: 20211117065752.330632-4-joel@jms.id.au | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 10 | --- |
8 | target/arm/translate-a64.c | 20 ++++++++++---------- | 11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- |
9 | 1 file changed, 10 insertions(+), 10 deletions(-) | 12 | 1 file changed, 12 insertions(+), 3 deletions(-) |
10 | 13 | ||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-a64.c | 16 | --- a/docs/system/arm/aspeed.rst |
14 | +++ b/target/arm/translate-a64.c | 17 | +++ b/docs/system/arm/aspeed.rst |
15 | @@ -XXX,XX +XXX,XX @@ static void write_vec_element_i32(DisasContext *s, TCGv_i32 tcg_src, | 18 | @@ -XXX,XX +XXX,XX @@ Missing devices |
16 | 19 | Boot options | |
17 | /* Store from vector register to memory */ | 20 | ------------ |
18 | static void do_vec_st(DisasContext *s, int srcidx, int element, | 21 | |
19 | - TCGv_i64 tcg_addr, int size, MemOp endian) | 22 | -The Aspeed machines can be started using the ``-kernel`` option to |
20 | + TCGv_i64 tcg_addr, MemOp mop) | 23 | -load a Linux kernel or from a firmware. Images can be downloaded from |
21 | { | 24 | -the OpenBMC jenkins : |
22 | TCGv_i64 tcg_tmp = tcg_temp_new_i64(); | 25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options |
23 | 26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the | |
24 | - read_vec_element(s, tcg_tmp, srcidx, element, size); | 27 | +OpenBMC jenkins : |
25 | - tcg_gen_qemu_st_i64(tcg_tmp, tcg_addr, get_mem_index(s), endian | size); | 28 | |
26 | + read_vec_element(s, tcg_tmp, srcidx, element, mop & MO_SIZE); | 29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
27 | + tcg_gen_qemu_st_i64(tcg_tmp, tcg_addr, get_mem_index(s), mop); | 30 | |
28 | 31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : | |
29 | tcg_temp_free_i64(tcg_tmp); | 32 | |
30 | } | 33 | https://github.com/openbmc/openbmc/releases |
31 | 34 | ||
32 | /* Load from memory to vector register */ | 35 | +To boot a kernel directly from a Linux build tree: |
33 | static void do_vec_ld(DisasContext *s, int destidx, int element, | 36 | + |
34 | - TCGv_i64 tcg_addr, int size, MemOp endian) | 37 | +.. code-block:: bash |
35 | + TCGv_i64 tcg_addr, MemOp mop) | 38 | + |
36 | { | 39 | + $ qemu-system-arm -M ast2600-evb -nographic \ |
37 | TCGv_i64 tcg_tmp = tcg_temp_new_i64(); | 40 | + -kernel arch/arm/boot/zImage \ |
38 | 41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ | |
39 | - tcg_gen_qemu_ld_i64(tcg_tmp, tcg_addr, get_mem_index(s), endian | size); | 42 | + -initrd rootfs.cpio |
40 | - write_vec_element(s, tcg_tmp, destidx, element, size); | 43 | + |
41 | + tcg_gen_qemu_ld_i64(tcg_tmp, tcg_addr, get_mem_index(s), mop); | 44 | The image should be attached as an MTD drive. Run : |
42 | + write_vec_element(s, tcg_tmp, destidx, element, mop & MO_SIZE); | 45 | |
43 | 46 | .. code-block:: bash | |
44 | tcg_temp_free_i64(tcg_tmp); | ||
45 | } | ||
46 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | ||
47 | for (xs = 0; xs < selem; xs++) { | ||
48 | int tt = (rt + r + xs) % 32; | ||
49 | if (is_store) { | ||
50 | - do_vec_st(s, tt, e, clean_addr, size, endian); | ||
51 | + do_vec_st(s, tt, e, clean_addr, size | endian); | ||
52 | } else { | ||
53 | - do_vec_ld(s, tt, e, clean_addr, size, endian); | ||
54 | + do_vec_ld(s, tt, e, clean_addr, size | endian); | ||
55 | } | ||
56 | tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); | ||
57 | } | ||
58 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | ||
59 | } else { | ||
60 | /* Load/store one element per register */ | ||
61 | if (is_load) { | ||
62 | - do_vec_ld(s, rt, index, clean_addr, scale, s->be_data); | ||
63 | + do_vec_ld(s, rt, index, clean_addr, scale | s->be_data); | ||
64 | } else { | ||
65 | - do_vec_st(s, rt, index, clean_addr, scale, s->be_data); | ||
66 | + do_vec_st(s, rt, index, clean_addr, scale | s->be_data); | ||
67 | } | ||
68 | } | ||
69 | tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); | ||
70 | -- | 47 | -- |
71 | 2.20.1 | 48 | 2.25.1 |
72 | 49 | ||
73 | 50 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Move it to the supported list. |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | |
5 | Message-id: 20210419202257.161730-32-richard.henderson@linaro.org | 5 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
6 | Message-id: 20211117065752.330632-5-joel@jms.id.au | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 8 | --- |
8 | target/arm/translate-sve.c | 2 +- | 9 | docs/system/arm/aspeed.rst | 2 +- |
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
10 | 11 | ||
11 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | 12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-sve.c | 14 | --- a/docs/system/arm/aspeed.rst |
14 | +++ b/target/arm/translate-sve.c | 15 | +++ b/docs/system/arm/aspeed.rst |
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri_load *a) | 16 | @@ -XXX,XX +XXX,XX @@ Supported devices |
16 | clean_addr = gen_mte_check1(s, temp, false, true, msz); | 17 | * Front LEDs (PCA9552 on I2C bus) |
17 | 18 | * LPC Peripheral Controller (a subset of subdevices are supported) | |
18 | tcg_gen_qemu_ld_i64(temp, clean_addr, get_mem_index(s), | 19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA |
19 | - s->be_data | dtype_mop[a->dtype]); | 20 | + * ADC |
20 | + finalize_memop(s, dtype_mop[a->dtype])); | 21 | |
21 | 22 | ||
22 | /* Broadcast to *all* elements. */ | 23 | Missing devices |
23 | tcg_gen_gvec_dup_i64(esz, vec_full_reg_offset(s, a->rd), | 24 | --------------- |
25 | |||
26 | * Coprocessor support | ||
27 | - * ADC (out of tree implementation) | ||
28 | * PWM and Fan Controller | ||
29 | * Slave GPIO Controller | ||
30 | * Super I/O Controller | ||
24 | -- | 31 | -- |
25 | 2.20.1 | 32 | 2.25.1 |
26 | 33 | ||
27 | 34 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> |
---|---|---|---|
2 | 2 | ||
3 | Fix issue where the data register may be overwritten by next character | ||
4 | reception before being read and returned. | ||
5 | |||
6 | Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr> | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
5 | Message-id: 20210419202257.161730-24-richard.henderson@linaro.org | 9 | Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 11 | --- |
8 | target/arm/translate-neon.c.inc | 27 ++++++++++++++++++++++----- | 12 | hw/char/stm32f2xx_usart.c | 3 ++- |
9 | 1 file changed, 22 insertions(+), 5 deletions(-) | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
10 | 14 | ||
11 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c |
12 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-neon.c.inc | 17 | --- a/hw/char/stm32f2xx_usart.c |
14 | +++ b/target/arm/translate-neon.c.inc | 18 | +++ b/hw/char/stm32f2xx_usart.c |
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | 19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, |
16 | { | 20 | return retvalue; |
17 | /* Neon load/store multiple structures */ | 21 | case USART_DR: |
18 | int nregs, interleave, spacing, reg, n; | 22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); |
19 | - MemOp endian = s->be_data; | 23 | + retvalue = s->usart_dr & 0x3FF; |
20 | + MemOp mop, align, endian; | 24 | s->usart_sr &= ~USART_SR_RXNE; |
21 | int mmu_idx = get_mem_index(s); | 25 | qemu_chr_fe_accept_input(&s->chr); |
22 | int size = a->size; | 26 | qemu_set_irq(s->irq, 0); |
23 | TCGv_i64 tmp64; | 27 | - return s->usart_dr & 0x3FF; |
24 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | 28 | + return retvalue; |
25 | } | 29 | case USART_BRR: |
26 | 30 | return s->usart_brr; | |
27 | /* For our purposes, bytes are always little-endian. */ | 31 | case USART_CR1: |
28 | + endian = s->be_data; | ||
29 | if (size == 0) { | ||
30 | endian = MO_LE; | ||
31 | } | ||
32 | + | ||
33 | + /* Enforce alignment requested by the instruction */ | ||
34 | + if (a->align) { | ||
35 | + align = pow2_align(a->align + 2); /* 4 ** a->align */ | ||
36 | + } else { | ||
37 | + align = s->align_mem ? MO_ALIGN : 0; | ||
38 | + } | ||
39 | + | ||
40 | /* | ||
41 | * Consecutive little-endian elements from a single register | ||
42 | * can be promoted to a larger little-endian operation. | ||
43 | */ | ||
44 | if (interleave == 1 && endian == MO_LE) { | ||
45 | + /* Retain any natural alignment. */ | ||
46 | + if (align == MO_ALIGN) { | ||
47 | + align = pow2_align(size); | ||
48 | + } | ||
49 | size = 3; | ||
50 | } | ||
51 | + | ||
52 | tmp64 = tcg_temp_new_i64(); | ||
53 | addr = tcg_temp_new_i32(); | ||
54 | tmp = tcg_const_i32(1 << size); | ||
55 | load_reg_var(s, addr, a->rn); | ||
56 | + | ||
57 | + mop = endian | size | align; | ||
58 | for (reg = 0; reg < nregs; reg++) { | ||
59 | for (n = 0; n < 8 >> size; n++) { | ||
60 | int xs; | ||
61 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | ||
62 | int tt = a->vd + reg + spacing * xs; | ||
63 | |||
64 | if (a->l) { | ||
65 | - gen_aa32_ld_internal_i64(s, tmp64, addr, mmu_idx, | ||
66 | - endian | size); | ||
67 | + gen_aa32_ld_internal_i64(s, tmp64, addr, mmu_idx, mop); | ||
68 | neon_store_element64(tt, n, size, tmp64); | ||
69 | } else { | ||
70 | neon_load_element64(tmp64, tt, n, size); | ||
71 | - gen_aa32_st_internal_i64(s, tmp64, addr, mmu_idx, | ||
72 | - endian | size); | ||
73 | + gen_aa32_st_internal_i64(s, tmp64, addr, mmu_idx, mop); | ||
74 | } | ||
75 | tcg_gen_add_i32(addr, addr, tmp); | ||
76 | + | ||
77 | + /* Subsequent memory operations inherit alignment */ | ||
78 | + mop &= ~MO_AMASK; | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | -- | 32 | -- |
83 | 2.20.1 | 33 | 2.25.1 |
84 | 34 | ||
85 | 35 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in | ||
4 | arm_gicv3_common_realize(). Since we want to restrict | ||
5 | arm_gicv3_cpuif.c to TCG, extract gicv3_set_gicv3state() | ||
6 | to a new file. Add this file to the meson 'specific' | ||
7 | source set, since it needs access to "cpu.h". | ||
8 | |||
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com |
5 | Message-id: 20210419202257.161730-23-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 13 | --- |
8 | target/arm/translate.h | 1 + | 14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- |
9 | target/arm/translate.c | 15 +++++++++++++ | 15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ |
10 | target/arm/translate-neon.c.inc | 37 +++++++++++++++++++++++++-------- | 16 | hw/intc/meson.build | 1 + |
11 | 3 files changed, 44 insertions(+), 9 deletions(-) | 17 | 3 files changed, 24 insertions(+), 9 deletions(-) |
18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
12 | 19 | ||
13 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/translate.h | 22 | --- a/hw/intc/arm_gicv3_cpuif.c |
16 | +++ b/target/arm/translate.h | 23 | +++ b/hw/intc/arm_gicv3_cpuif.c |
17 | @@ -XXX,XX +XXX,XX @@ void arm_test_cc(DisasCompare *cmp, int cc); | 24 | @@ -XXX,XX +XXX,XX @@ |
18 | void arm_free_cc(DisasCompare *cmp); | 25 | /* |
19 | void arm_jump_cc(DisasCompare *cmp, TCGLabel *label); | 26 | - * ARM Generic Interrupt Controller v3 |
20 | void arm_gen_test_cc(int cc, TCGLabel *label); | 27 | + * ARM Generic Interrupt Controller v3 (emulation) |
21 | +MemOp pow2_align(unsigned i); | 28 | * |
22 | 29 | * Copyright (c) 2016 Linaro Limited | |
23 | /* Return state of Alternate Half-precision flag, caller frees result */ | 30 | * Written by Peter Maydell |
24 | static inline TCGv_i32 get_ahp_flag(void) | 31 | @@ -XXX,XX +XXX,XX @@ |
25 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 32 | #include "hw/irq.h" |
33 | #include "cpu.h" | ||
34 | |||
35 | -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | ||
36 | -{ | ||
37 | - ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
38 | - CPUARMState *env = &arm_cpu->env; | ||
39 | - | ||
40 | - env->gicv3state = (void *)s; | ||
41 | -}; | ||
42 | - | ||
43 | static GICv3CPUState *icc_cs_from_env(CPUARMState *env) | ||
44 | { | ||
45 | return env->gicv3state; | ||
46 | diff --git a/hw/intc/arm_gicv3_cpuif_common.c b/hw/intc/arm_gicv3_cpuif_common.c | ||
47 | new file mode 100644 | ||
48 | index XXXXXXX..XXXXXXX | ||
49 | --- /dev/null | ||
50 | +++ b/hw/intc/arm_gicv3_cpuif_common.c | ||
51 | @@ -XXX,XX +XXX,XX @@ | ||
52 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
53 | +/* | ||
54 | + * ARM Generic Interrupt Controller v3 | ||
55 | + * | ||
56 | + * Copyright (c) 2016 Linaro Limited | ||
57 | + * Written by Peter Maydell | ||
58 | + * | ||
59 | + * This code is licensed under the GPL, version 2 or (at your option) | ||
60 | + * any later version. | ||
61 | + */ | ||
62 | + | ||
63 | +#include "qemu/osdep.h" | ||
64 | +#include "gicv3_internal.h" | ||
65 | +#include "cpu.h" | ||
66 | + | ||
67 | +void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | ||
68 | +{ | ||
69 | + ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
70 | + CPUARMState *env = &arm_cpu->env; | ||
71 | + | ||
72 | + env->gicv3state = (void *)s; | ||
73 | +}; | ||
74 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
26 | index XXXXXXX..XXXXXXX 100644 | 75 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/target/arm/translate.c | 76 | --- a/hw/intc/meson.build |
28 | +++ b/target/arm/translate.c | 77 | +++ b/hw/intc/meson.build |
29 | @@ -XXX,XX +XXX,XX @@ static inline void store_reg_from_load(DisasContext *s, int reg, TCGv_i32 var) | 78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in |
30 | #define IS_USER_ONLY 0 | 79 | |
31 | #endif | 80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) |
32 | 81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | |
33 | +MemOp pow2_align(unsigned i) | 82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) |
34 | +{ | 83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) |
35 | + static const MemOp mop_align[] = { | 84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) |
36 | + 0, MO_ALIGN_2, MO_ALIGN_4, MO_ALIGN_8, MO_ALIGN_16, | 85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) |
37 | + /* | ||
38 | + * FIXME: TARGET_PAGE_BITS_MIN affects TLB_FLAGS_MASK such | ||
39 | + * that 256-bit alignment (MO_ALIGN_32) cannot be supported: | ||
40 | + * see get_alignment_bits(). Enforce only 128-bit alignment for now. | ||
41 | + */ | ||
42 | + MO_ALIGN_16 | ||
43 | + }; | ||
44 | + g_assert(i < ARRAY_SIZE(mop_align)); | ||
45 | + return mop_align[i]; | ||
46 | +} | ||
47 | + | ||
48 | /* | ||
49 | * Abstractions of "generate code to do a guest load/store for | ||
50 | * AArch32", where a vaddr is always 32 bits (and is zero | ||
51 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/target/arm/translate-neon.c.inc | ||
54 | +++ b/target/arm/translate-neon.c.inc | ||
55 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
56 | int size = a->size; | ||
57 | int nregs = a->n + 1; | ||
58 | TCGv_i32 addr, tmp; | ||
59 | + MemOp mop, align; | ||
60 | |||
61 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
62 | return false; | ||
63 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
64 | return false; | ||
65 | } | ||
66 | |||
67 | + align = 0; | ||
68 | if (size == 3) { | ||
69 | if (nregs != 4 || a->a == 0) { | ||
70 | return false; | ||
71 | } | ||
72 | /* For VLD4 size == 3 a == 1 means 32 bits at 16 byte alignment */ | ||
73 | - size = 2; | ||
74 | - } | ||
75 | - if (nregs == 1 && a->a == 1 && size == 0) { | ||
76 | - return false; | ||
77 | - } | ||
78 | - if (nregs == 3 && a->a == 1) { | ||
79 | - return false; | ||
80 | + size = MO_32; | ||
81 | + align = MO_ALIGN_16; | ||
82 | + } else if (a->a) { | ||
83 | + switch (nregs) { | ||
84 | + case 1: | ||
85 | + if (size == 0) { | ||
86 | + return false; | ||
87 | + } | ||
88 | + align = MO_ALIGN; | ||
89 | + break; | ||
90 | + case 2: | ||
91 | + align = pow2_align(size + 1); | ||
92 | + break; | ||
93 | + case 3: | ||
94 | + return false; | ||
95 | + case 4: | ||
96 | + align = pow2_align(size + 2); | ||
97 | + break; | ||
98 | + default: | ||
99 | + g_assert_not_reached(); | ||
100 | + } | ||
101 | } | ||
102 | |||
103 | if (!vfp_access_check(s)) { | ||
104 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
105 | */ | ||
106 | stride = a->t ? 2 : 1; | ||
107 | vec_size = nregs == 1 ? stride * 8 : 8; | ||
108 | - | ||
109 | + mop = size | align; | ||
110 | tmp = tcg_temp_new_i32(); | ||
111 | addr = tcg_temp_new_i32(); | ||
112 | load_reg_var(s, addr, a->rn); | ||
113 | for (reg = 0; reg < nregs; reg++) { | ||
114 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), size); | ||
115 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), mop); | ||
116 | if ((vd & 1) && vec_size == 16) { | ||
117 | /* | ||
118 | * We cannot write 16 bytes at once because the | ||
119 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
120 | } | ||
121 | tcg_gen_addi_i32(addr, addr, 1 << size); | ||
122 | vd += stride; | ||
123 | + | ||
124 | + /* Subsequent memory operations inherit alignment */ | ||
125 | + mop &= ~MO_AMASK; | ||
126 | } | ||
127 | tcg_temp_free_i32(tmp); | ||
128 | tcg_temp_free_i32(addr); | ||
129 | -- | 86 | -- |
130 | 2.20.1 | 87 | 2.25.1 |
131 | 88 | ||
132 | 89 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The TYPE_ARM_GICV3 device is an emulated one. When using | ||
4 | KVM, it is recommended to use the TYPE_KVM_ARM_GICV3 device | ||
5 | (which uses in-kernel support). | ||
6 | |||
7 | When using --with-devices-FOO, it is possible to build a | ||
8 | binary with a specific set of devices. When this binary is | ||
9 | restricted to KVM accelerator, the TYPE_ARM_GICV3 device is | ||
10 | irrelevant, and it is desirable to remove it from the binary. | ||
11 | |||
12 | Therefore introduce the CONFIG_ARM_GIC_TCG Kconfig selector | ||
13 | which select the files required to have the TYPE_ARM_GICV3 | ||
14 | device, but also allowing to de-select this device. | ||
15 | |||
16 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 18 | Message-id: 20211115223619.2599282-3-philmd@redhat.com |
5 | Message-id: 20210419202257.161730-22-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 20 | --- |
8 | target/arm/translate-vfp.c.inc | 12 ++++++------ | 21 | hw/intc/arm_gicv3.c | 2 +- |
9 | 1 file changed, 6 insertions(+), 6 deletions(-) | 22 | hw/intc/Kconfig | 5 +++++ |
23 | hw/intc/meson.build | 10 ++++++---- | ||
24 | 3 files changed, 12 insertions(+), 5 deletions(-) | ||
10 | 25 | ||
11 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | 26 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c |
12 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-vfp.c.inc | 28 | --- a/hw/intc/arm_gicv3.c |
14 | +++ b/target/arm/translate-vfp.c.inc | 29 | +++ b/hw/intc/arm_gicv3.c |
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_hp(DisasContext *s, arg_VLDR_VSTR_sp *a) | 30 | @@ -XXX,XX +XXX,XX @@ |
16 | addr = add_reg_for_lit(s, a->rn, offset); | 31 | /* |
17 | tmp = tcg_temp_new_i32(); | 32 | - * ARM Generic Interrupt Controller v3 |
18 | if (a->l) { | 33 | + * ARM Generic Interrupt Controller v3 (emulation) |
19 | - gen_aa32_ld16u(s, tmp, addr, get_mem_index(s)); | 34 | * |
20 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), MO_UW | MO_ALIGN); | 35 | * Copyright (c) 2015 Huawei. |
21 | vfp_store_reg32(tmp, a->vd); | 36 | * Copyright (c) 2016 Linaro Limited |
22 | } else { | 37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig |
23 | vfp_load_reg32(tmp, a->vd); | 38 | index XXXXXXX..XXXXXXX 100644 |
24 | - gen_aa32_st16(s, tmp, addr, get_mem_index(s)); | 39 | --- a/hw/intc/Kconfig |
25 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), MO_UW | MO_ALIGN); | 40 | +++ b/hw/intc/Kconfig |
26 | } | 41 | @@ -XXX,XX +XXX,XX @@ config APIC |
27 | tcg_temp_free_i32(tmp); | 42 | select MSI_NONBROKEN |
28 | tcg_temp_free_i32(addr); | 43 | select I8259 |
29 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a) | 44 | |
30 | addr = add_reg_for_lit(s, a->rn, offset); | 45 | +config ARM_GIC_TCG |
31 | tmp = tcg_temp_new_i32(); | 46 | + bool |
32 | if (a->l) { | 47 | + default y |
33 | - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); | 48 | + depends on ARM_GIC && TCG |
34 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 49 | + |
35 | vfp_store_reg32(tmp, a->vd); | 50 | config ARM_GIC_KVM |
36 | } else { | 51 | bool |
37 | vfp_load_reg32(tmp, a->vd); | 52 | default y |
38 | - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); | 53 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build |
39 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 54 | index XXXXXXX..XXXXXXX 100644 |
40 | } | 55 | --- a/hw/intc/meson.build |
41 | tcg_temp_free_i32(tmp); | 56 | +++ b/hw/intc/meson.build |
42 | tcg_temp_free_i32(addr); | 57 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( |
43 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a) | 58 | 'arm_gic.c', |
44 | addr = add_reg_for_lit(s, a->rn, offset); | 59 | 'arm_gic_common.c', |
45 | tmp = tcg_temp_new_i64(); | 60 | 'arm_gicv2m.c', |
46 | if (a->l) { | 61 | - 'arm_gicv3.c', |
47 | - gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); | 62 | 'arm_gicv3_common.c', |
48 | + gen_aa32_ld_i64(s, tmp, addr, get_mem_index(s), MO_Q | MO_ALIGN_4); | 63 | - 'arm_gicv3_dist.c', |
49 | vfp_store_reg64(tmp, a->vd); | 64 | 'arm_gicv3_its_common.c', |
50 | } else { | 65 | - 'arm_gicv3_redist.c', |
51 | vfp_load_reg64(tmp, a->vd); | 66 | +)) |
52 | - gen_aa32_st64(s, tmp, addr, get_mem_index(s)); | 67 | +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( |
53 | + gen_aa32_st_i64(s, tmp, addr, get_mem_index(s), MO_Q | MO_ALIGN_4); | 68 | + 'arm_gicv3.c', |
54 | } | 69 | + 'arm_gicv3_dist.c', |
55 | tcg_temp_free_i64(tmp); | 70 | 'arm_gicv3_its.c', |
56 | tcg_temp_free_i32(addr); | 71 | + 'arm_gicv3_redist.c', |
72 | )) | ||
73 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) | ||
74 | softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) | ||
75 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | ||
76 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | ||
77 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | ||
78 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | ||
79 | -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | ||
80 | +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c')) | ||
81 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | ||
82 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | ||
83 | specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) | ||
57 | -- | 84 | -- |
58 | 2.20.1 | 85 | 2.25.1 |
59 | 86 | ||
60 | 87 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | For 128-bit load/store, use 16-byte alignment. This | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | requires that we perform the two operations in the | ||
5 | correct order so that we generate the alignment fault | ||
6 | before modifying memory. | ||
7 | |||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210419202257.161730-27-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 6 | --- |
13 | target/arm/translate-a64.c | 42 +++++++++++++++++++++++--------------- | 7 | target/arm/translate-a64.c | 7 ++++--- |
14 | 1 file changed, 26 insertions(+), 16 deletions(-) | 8 | 1 file changed, 4 insertions(+), 3 deletions(-) |
15 | 9 | ||
16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate-a64.c | 12 | --- a/target/arm/translate-a64.c |
19 | +++ b/target/arm/translate-a64.c | 13 | +++ b/target/arm/translate-a64.c |
20 | @@ -XXX,XX +XXX,XX @@ static void do_gpr_ld(DisasContext *s, TCGv_i64 dest, TCGv_i64 tcg_addr, | 14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
21 | static void do_fp_st(DisasContext *s, int srcidx, TCGv_i64 tcg_addr, int size) | ||
22 | { | 15 | { |
23 | /* This writes the bottom N bits of a 128 bit wide vector to memory */ | 16 | DisasContext *s = container_of(dcbase, DisasContext, base); |
24 | - TCGv_i64 tmp = tcg_temp_new_i64(); | 17 | CPUARMState *env = cpu->env_ptr; |
25 | - tcg_gen_ld_i64(tmp, cpu_env, fp_reg_offset(s, srcidx, MO_64)); | 18 | + uint64_t pc = s->base.pc_next; |
26 | + TCGv_i64 tmplo = tcg_temp_new_i64(); | 19 | uint32_t insn; |
27 | + MemOp mop; | 20 | |
28 | + | 21 | if (s->ss_active && !s->pstate_ss) { |
29 | + tcg_gen_ld_i64(tmplo, cpu_env, fp_reg_offset(s, srcidx, MO_64)); | 22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
30 | + | 23 | return; |
31 | if (size < 4) { | ||
32 | - tcg_gen_qemu_st_i64(tmp, tcg_addr, get_mem_index(s), | ||
33 | - s->be_data + size); | ||
34 | + mop = finalize_memop(s, size); | ||
35 | + tcg_gen_qemu_st_i64(tmplo, tcg_addr, get_mem_index(s), mop); | ||
36 | } else { | ||
37 | bool be = s->be_data == MO_BE; | ||
38 | TCGv_i64 tcg_hiaddr = tcg_temp_new_i64(); | ||
39 | + TCGv_i64 tmphi = tcg_temp_new_i64(); | ||
40 | |||
41 | + tcg_gen_ld_i64(tmphi, cpu_env, fp_reg_hi_offset(s, srcidx)); | ||
42 | + | ||
43 | + mop = s->be_data | MO_Q; | ||
44 | + tcg_gen_qemu_st_i64(be ? tmphi : tmplo, tcg_addr, get_mem_index(s), | ||
45 | + mop | (s->align_mem ? MO_ALIGN_16 : 0)); | ||
46 | tcg_gen_addi_i64(tcg_hiaddr, tcg_addr, 8); | ||
47 | - tcg_gen_qemu_st_i64(tmp, be ? tcg_hiaddr : tcg_addr, get_mem_index(s), | ||
48 | - s->be_data | MO_Q); | ||
49 | - tcg_gen_ld_i64(tmp, cpu_env, fp_reg_hi_offset(s, srcidx)); | ||
50 | - tcg_gen_qemu_st_i64(tmp, be ? tcg_addr : tcg_hiaddr, get_mem_index(s), | ||
51 | - s->be_data | MO_Q); | ||
52 | + tcg_gen_qemu_st_i64(be ? tmplo : tmphi, tcg_hiaddr, | ||
53 | + get_mem_index(s), mop); | ||
54 | + | ||
55 | tcg_temp_free_i64(tcg_hiaddr); | ||
56 | + tcg_temp_free_i64(tmphi); | ||
57 | } | 24 | } |
58 | 25 | ||
59 | - tcg_temp_free_i64(tmp); | 26 | - s->pc_curr = s->base.pc_next; |
60 | + tcg_temp_free_i64(tmplo); | 27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); |
61 | } | 28 | + s->pc_curr = pc; |
62 | 29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | |
63 | /* | 30 | s->insn = insn; |
64 | @@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size) | 31 | - s->base.pc_next += 4; |
65 | /* This always zero-extends and writes to a full 128 bit wide vector */ | 32 | + s->base.pc_next = pc + 4; |
66 | TCGv_i64 tmplo = tcg_temp_new_i64(); | 33 | |
67 | TCGv_i64 tmphi = NULL; | 34 | s->fp_access_checked = false; |
68 | + MemOp mop; | 35 | s->sve_access_checked = false; |
69 | |||
70 | if (size < 4) { | ||
71 | - MemOp memop = s->be_data + size; | ||
72 | - tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), memop); | ||
73 | + mop = finalize_memop(s, size); | ||
74 | + tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), mop); | ||
75 | } else { | ||
76 | bool be = s->be_data == MO_BE; | ||
77 | TCGv_i64 tcg_hiaddr; | ||
78 | @@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size) | ||
79 | tmphi = tcg_temp_new_i64(); | ||
80 | tcg_hiaddr = tcg_temp_new_i64(); | ||
81 | |||
82 | + mop = s->be_data | MO_Q; | ||
83 | + tcg_gen_qemu_ld_i64(be ? tmphi : tmplo, tcg_addr, get_mem_index(s), | ||
84 | + mop | (s->align_mem ? MO_ALIGN_16 : 0)); | ||
85 | tcg_gen_addi_i64(tcg_hiaddr, tcg_addr, 8); | ||
86 | - tcg_gen_qemu_ld_i64(tmplo, be ? tcg_hiaddr : tcg_addr, get_mem_index(s), | ||
87 | - s->be_data | MO_Q); | ||
88 | - tcg_gen_qemu_ld_i64(tmphi, be ? tcg_addr : tcg_hiaddr, get_mem_index(s), | ||
89 | - s->be_data | MO_Q); | ||
90 | + tcg_gen_qemu_ld_i64(be ? tmplo : tmphi, tcg_hiaddr, | ||
91 | + get_mem_index(s), mop); | ||
92 | tcg_temp_free_i64(tcg_hiaddr); | ||
93 | } | ||
94 | |||
95 | -- | 36 | -- |
96 | 2.20.1 | 37 | 2.25.1 |
97 | 38 | ||
98 | 39 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Just because operating on a TCGv_i64 temporary does not | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | mean that we're performing a 64-bit operation. Restrict | ||
5 | the frobbing to actual 64-bit operations. | ||
6 | |||
7 | This bug is not currently visible because all current | ||
8 | users of these two functions always pass MO_64. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20210419202257.161730-14-richard.henderson@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 6 | --- |
15 | target/arm/translate.c | 4 ++-- | 7 | target/arm/translate.c | 9 +++++---- |
16 | 1 file changed, 2 insertions(+), 2 deletions(-) | 8 | 1 file changed, 5 insertions(+), 4 deletions(-) |
17 | 9 | ||
18 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
19 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
21 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
22 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | 14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
23 | tcg_gen_qemu_ld_i64(val, addr, index, opc); | 15 | { |
24 | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | |
25 | /* Not needed for user-mode BE32, where we use MO_BE instead. */ | 17 | CPUARMState *env = cpu->env_ptr; |
26 | - if (!IS_USER_ONLY && s->sctlr_b) { | 18 | + uint32_t pc = dc->base.pc_next; |
27 | + if (!IS_USER_ONLY && s->sctlr_b && (opc & MO_SIZE) == MO_64) { | 19 | unsigned int insn; |
28 | tcg_gen_rotri_i64(val, val, 32); | 20 | |
21 | if (arm_pre_translate_insn(dc)) { | ||
22 | - dc->base.pc_next += 4; | ||
23 | + dc->base.pc_next = pc + 4; | ||
24 | return; | ||
29 | } | 25 | } |
30 | 26 | ||
31 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | 27 | - dc->pc_curr = dc->base.pc_next; |
32 | TCGv addr = gen_aa32_addr(s, a32, opc); | 28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); |
33 | 29 | + dc->pc_curr = pc; | |
34 | /* Not needed for user-mode BE32, where we use MO_BE instead. */ | 30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); |
35 | - if (!IS_USER_ONLY && s->sctlr_b) { | 31 | dc->insn = insn; |
36 | + if (!IS_USER_ONLY && s->sctlr_b && (opc & MO_SIZE) == MO_64) { | 32 | - dc->base.pc_next += 4; |
37 | TCGv_i64 tmp = tcg_temp_new_i64(); | 33 | + dc->base.pc_next = pc + 4; |
38 | tcg_gen_rotri_i64(tmp, val, 32); | 34 | disas_arm_insn(dc, insn); |
39 | tcg_gen_qemu_st_i64(tmp, addr, index, opc); | 35 | |
36 | arm_post_translate_insn(dc); | ||
40 | -- | 37 | -- |
41 | 2.20.1 | 38 | 2.25.1 |
42 | 39 | ||
43 | 40 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Buglink: https://bugs.launchpad.net/qemu/+bug/1905356 | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20210419202257.161730-16-richard.henderson@linaro.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 6 | --- |
9 | target/arm/translate.c | 16 ++++++++-------- | 7 | target/arm/translate.c | 16 ++++++++-------- |
10 | 1 file changed, 8 insertions(+), 8 deletions(-) | 8 | 1 file changed, 8 insertions(+), 8 deletions(-) |
11 | 9 | ||
12 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 10 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
13 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
15 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
16 | @@ -XXX,XX +XXX,XX @@ static bool trans_LDRD_rr(DisasContext *s, arg_ldst_rr *a) | 14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
17 | addr = op_addr_rr_pre(s, a); | 15 | { |
18 | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); | |
19 | tmp = tcg_temp_new_i32(); | 17 | CPUARMState *env = cpu->env_ptr; |
20 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | 18 | + uint32_t pc = dc->base.pc_next; |
21 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | 19 | uint32_t insn; |
22 | store_reg(s, a->rt, tmp); | 20 | bool is_16bit; |
23 | 21 | ||
24 | tcg_gen_addi_i32(addr, addr, 4); | 22 | if (arm_pre_translate_insn(dc)) { |
25 | 23 | - dc->base.pc_next += 2; | |
26 | tmp = tcg_temp_new_i32(); | 24 | + dc->base.pc_next = pc + 2; |
27 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | 25 | return; |
28 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | 26 | } |
29 | store_reg(s, a->rt + 1, tmp); | 27 | |
30 | 28 | - dc->pc_curr = dc->base.pc_next; | |
31 | /* LDRD w/ base writeback is undefined if the registers overlap. */ | 29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); |
32 | @@ -XXX,XX +XXX,XX @@ static bool trans_STRD_rr(DisasContext *s, arg_ldst_rr *a) | 30 | + dc->pc_curr = pc; |
33 | addr = op_addr_rr_pre(s, a); | 31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); |
34 | 32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | |
35 | tmp = load_reg(s, a->rt); | 33 | - dc->base.pc_next += 2; |
36 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | 34 | + pc += 2; |
37 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | 35 | if (!is_16bit) { |
38 | tcg_temp_free_i32(tmp); | 36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, |
39 | 37 | - dc->sctlr_b); | |
40 | tcg_gen_addi_i32(addr, addr, 4); | 38 | - |
41 | 39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | |
42 | tmp = load_reg(s, a->rt + 1); | 40 | insn = insn << 16 | insn2; |
43 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | 41 | - dc->base.pc_next += 2; |
44 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | 42 | + pc += 2; |
45 | tcg_temp_free_i32(tmp); | 43 | } |
46 | 44 | + dc->base.pc_next = pc; | |
47 | op_addr_rr_post(s, a, addr, -4); | 45 | dc->insn = insn; |
48 | @@ -XXX,XX +XXX,XX @@ static bool op_ldrd_ri(DisasContext *s, arg_ldst_ri *a, int rt2) | 46 | |
49 | addr = op_addr_ri_pre(s, a); | 47 | if (dc->pstate_il) { |
50 | |||
51 | tmp = tcg_temp_new_i32(); | ||
52 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | ||
53 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
54 | store_reg(s, a->rt, tmp); | ||
55 | |||
56 | tcg_gen_addi_i32(addr, addr, 4); | ||
57 | |||
58 | tmp = tcg_temp_new_i32(); | ||
59 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | ||
60 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
61 | store_reg(s, rt2, tmp); | ||
62 | |||
63 | /* LDRD w/ base writeback is undefined if the registers overlap. */ | ||
64 | @@ -XXX,XX +XXX,XX @@ static bool op_strd_ri(DisasContext *s, arg_ldst_ri *a, int rt2) | ||
65 | addr = op_addr_ri_pre(s, a); | ||
66 | |||
67 | tmp = load_reg(s, a->rt); | ||
68 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | ||
69 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
70 | tcg_temp_free_i32(tmp); | ||
71 | |||
72 | tcg_gen_addi_i32(addr, addr, 4); | ||
73 | |||
74 | tmp = load_reg(s, rt2); | ||
75 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | ||
76 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
77 | tcg_temp_free_i32(tmp); | ||
78 | |||
79 | op_addr_ri_post(s, a, addr, -4); | ||
80 | -- | 48 | -- |
81 | 2.20.1 | 49 | 2.25.1 |
82 | 50 | ||
83 | 51 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Adjust the interface to match what has been done to the | 3 | Create arm_check_ss_active and arm_check_kernelpage. |
4 | TCGv_i32 load/store functions. | ||
5 | 4 | ||
6 | This is less obvious, because at present the only user of | 5 | Reverse the order of the tests. While it doesn't matter in practice, |
7 | these functions, trans_VLDST_multiple, also wants to manipulate | 6 | because only user-only has a kernel page and user-only never sets |
8 | the endianness to speed up loading multiple bytes. Thus we | 7 | ss_active, ss_active has priority over execution exceptions and it |
9 | retain an "internal" interface which is identical to the | 8 | is best to keep them in the proper order. |
10 | current gen_aa32_{ld,st}_i64 interface. | ||
11 | 9 | ||
12 | The "new" interface will gain users as we remove the legacy | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | interfaces, gen_aa32_ld64 and gen_aa32_st64. | ||
14 | |||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20210419202257.161730-15-richard.henderson@linaro.org | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 13 | --- |
20 | target/arm/translate.c | 78 +++++++++++++++++++-------------- | 14 | target/arm/translate.c | 10 +++++++--- |
21 | target/arm/translate-neon.c.inc | 6 ++- | 15 | 1 file changed, 7 insertions(+), 3 deletions(-) |
22 | 2 files changed, 49 insertions(+), 35 deletions(-) | ||
23 | 16 | ||
24 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 17 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
25 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate.c | 19 | --- a/target/arm/translate.c |
27 | +++ b/target/arm/translate.c | 20 | +++ b/target/arm/translate.c |
28 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val, | 21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) |
29 | tcg_temp_free(addr); | 22 | dc->insn_start = tcg_last_op(); |
30 | } | 23 | } |
31 | 24 | ||
32 | +static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val, | 25 | -static bool arm_pre_translate_insn(DisasContext *dc) |
33 | + TCGv_i32 a32, int index, MemOp opc) | 26 | +static bool arm_check_kernelpage(DisasContext *dc) |
27 | { | ||
28 | #ifdef CONFIG_USER_ONLY | ||
29 | /* Intercept jump to the magic kernel page. */ | ||
30 | @@ -XXX,XX +XXX,XX @@ static bool arm_pre_translate_insn(DisasContext *dc) | ||
31 | return true; | ||
32 | } | ||
33 | #endif | ||
34 | + return false; | ||
35 | +} | ||
36 | |||
37 | +static bool arm_check_ss_active(DisasContext *dc) | ||
34 | +{ | 38 | +{ |
35 | + TCGv addr = gen_aa32_addr(s, a32, opc); | 39 | if (dc->ss_active && !dc->pstate_ss) { |
36 | + | 40 | /* Singlestep state is Active-pending. |
37 | + tcg_gen_qemu_ld_i64(val, addr, index, opc); | 41 | * If we're in this state at the start of a TB then either |
38 | + | 42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
39 | + /* Not needed for user-mode BE32, where we use MO_BE instead. */ | 43 | uint32_t pc = dc->base.pc_next; |
40 | + if (!IS_USER_ONLY && s->sctlr_b && (opc & MO_SIZE) == MO_64) { | 44 | unsigned int insn; |
41 | + tcg_gen_rotri_i64(val, val, 32); | 45 | |
42 | + } | 46 | - if (arm_pre_translate_insn(dc)) { |
43 | + tcg_temp_free(addr); | 47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
44 | +} | 48 | dc->base.pc_next = pc + 4; |
45 | + | 49 | return; |
46 | +static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val, | ||
47 | + TCGv_i32 a32, int index, MemOp opc) | ||
48 | +{ | ||
49 | + TCGv addr = gen_aa32_addr(s, a32, opc); | ||
50 | + | ||
51 | + /* Not needed for user-mode BE32, where we use MO_BE instead. */ | ||
52 | + if (!IS_USER_ONLY && s->sctlr_b && (opc & MO_SIZE) == MO_64) { | ||
53 | + TCGv_i64 tmp = tcg_temp_new_i64(); | ||
54 | + tcg_gen_rotri_i64(tmp, val, 32); | ||
55 | + tcg_gen_qemu_st_i64(tmp, addr, index, opc); | ||
56 | + tcg_temp_free_i64(tmp); | ||
57 | + } else { | ||
58 | + tcg_gen_qemu_st_i64(val, addr, index, opc); | ||
59 | + } | ||
60 | + tcg_temp_free(addr); | ||
61 | +} | ||
62 | + | ||
63 | static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
64 | int index, MemOp opc) | ||
65 | { | ||
66 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
67 | gen_aa32_st_internal_i32(s, val, a32, index, finalize_memop(s, opc)); | ||
68 | } | ||
69 | |||
70 | +static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
71 | + int index, MemOp opc) | ||
72 | +{ | ||
73 | + gen_aa32_ld_internal_i64(s, val, a32, index, finalize_memop(s, opc)); | ||
74 | +} | ||
75 | + | ||
76 | +static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
77 | + int index, MemOp opc) | ||
78 | +{ | ||
79 | + gen_aa32_st_internal_i64(s, val, a32, index, finalize_memop(s, opc)); | ||
80 | +} | ||
81 | + | ||
82 | #define DO_GEN_LD(SUFF, OPC) \ | ||
83 | static inline void gen_aa32_ld##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
84 | TCGv_i32 a32, int index) \ | ||
85 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
86 | gen_aa32_st_i32(s, val, a32, index, OPC); \ | ||
87 | } | 50 | } |
88 | 51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | |
89 | -static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | 52 | uint32_t insn; |
90 | - int index, MemOp opc) | 53 | bool is_16bit; |
91 | -{ | 54 | |
92 | - TCGv addr = gen_aa32_addr(s, a32, opc); | 55 | - if (arm_pre_translate_insn(dc)) { |
93 | - tcg_gen_qemu_ld_i64(val, addr, index, opc); | 56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
94 | - | 57 | dc->base.pc_next = pc + 2; |
95 | - /* Not needed for user-mode BE32, where we use MO_BE instead. */ | 58 | return; |
96 | - if (!IS_USER_ONLY && s->sctlr_b && (opc & MO_SIZE) == MO_64) { | 59 | } |
97 | - tcg_gen_rotri_i64(val, val, 32); | ||
98 | - } | ||
99 | - | ||
100 | - tcg_temp_free(addr); | ||
101 | -} | ||
102 | - | ||
103 | static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val, | ||
104 | TCGv_i32 a32, int index) | ||
105 | { | ||
106 | - gen_aa32_ld_i64(s, val, a32, index, MO_Q | s->be_data); | ||
107 | -} | ||
108 | - | ||
109 | -static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
110 | - int index, MemOp opc) | ||
111 | -{ | ||
112 | - TCGv addr = gen_aa32_addr(s, a32, opc); | ||
113 | - | ||
114 | - /* Not needed for user-mode BE32, where we use MO_BE instead. */ | ||
115 | - if (!IS_USER_ONLY && s->sctlr_b && (opc & MO_SIZE) == MO_64) { | ||
116 | - TCGv_i64 tmp = tcg_temp_new_i64(); | ||
117 | - tcg_gen_rotri_i64(tmp, val, 32); | ||
118 | - tcg_gen_qemu_st_i64(tmp, addr, index, opc); | ||
119 | - tcg_temp_free_i64(tmp); | ||
120 | - } else { | ||
121 | - tcg_gen_qemu_st_i64(val, addr, index, opc); | ||
122 | - } | ||
123 | - tcg_temp_free(addr); | ||
124 | + gen_aa32_ld_i64(s, val, a32, index, MO_Q); | ||
125 | } | ||
126 | |||
127 | static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val, | ||
128 | TCGv_i32 a32, int index) | ||
129 | { | ||
130 | - gen_aa32_st_i64(s, val, a32, index, MO_Q | s->be_data); | ||
131 | + gen_aa32_st_i64(s, val, a32, index, MO_Q); | ||
132 | } | ||
133 | |||
134 | DO_GEN_LD(8u, MO_UB) | ||
135 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
136 | index XXXXXXX..XXXXXXX 100644 | ||
137 | --- a/target/arm/translate-neon.c.inc | ||
138 | +++ b/target/arm/translate-neon.c.inc | ||
139 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) | ||
140 | int tt = a->vd + reg + spacing * xs; | ||
141 | |||
142 | if (a->l) { | ||
143 | - gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size); | ||
144 | + gen_aa32_ld_internal_i64(s, tmp64, addr, mmu_idx, | ||
145 | + endian | size); | ||
146 | neon_store_element64(tt, n, size, tmp64); | ||
147 | } else { | ||
148 | neon_load_element64(tmp64, tt, n, size); | ||
149 | - gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size); | ||
150 | + gen_aa32_st_internal_i64(s, tmp64, addr, mmu_idx, | ||
151 | + endian | size); | ||
152 | } | ||
153 | tcg_gen_add_i32(addr, addr, tmp); | ||
154 | } | ||
155 | -- | 60 | -- |
156 | 2.20.1 | 61 | 2.25.1 |
157 | 62 | ||
158 | 63 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The size of the code covered by a TranslationBlock cannot be 0; | ||
4 | this is checked via assert in tb_gen_code. | ||
5 | |||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20210419202257.161730-28-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 9 | --- |
8 | target/arm/translate-a64.c | 23 ++++++++++++++--------- | 10 | target/arm/translate-a64.c | 1 + |
9 | 1 file changed, 14 insertions(+), 9 deletions(-) | 11 | 1 file changed, 1 insertion(+) |
10 | 12 | ||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 13 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
12 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-a64.c | 15 | --- a/target/arm/translate-a64.c |
14 | +++ b/target/arm/translate-a64.c | 16 | +++ b/target/arm/translate-a64.c |
15 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | 17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
16 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | 18 | assert(s->base.num_insns == 1); |
17 | clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), | 19 | gen_swstep_exception(s, 0, 0); |
18 | true, rn != 31, size); | 20 | s->base.is_jmp = DISAS_NORETURN; |
19 | - do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, | 21 | + s->base.pc_next = pc + 4; |
20 | + /* TODO: ARMv8.4-LSE SCTLR.nAA */ | ||
21 | + do_gpr_st(s, cpu_reg(s, rt), clean_addr, size | MO_ALIGN, true, rt, | ||
22 | disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
23 | return; | ||
24 | |||
25 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | ||
26 | } | ||
27 | clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), | ||
28 | false, rn != 31, size); | ||
29 | - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, true, rt, | ||
30 | - disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
31 | + /* TODO: ARMv8.4-LSE SCTLR.nAA */ | ||
32 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size | MO_ALIGN, false, true, | ||
33 | + rt, disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
34 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
35 | return; | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) | ||
38 | int size = extract32(insn, 30, 2); | ||
39 | TCGv_i64 clean_addr, dirty_addr; | ||
40 | bool is_store = false; | ||
41 | - bool is_signed = false; | ||
42 | bool extend = false; | ||
43 | bool iss_sf; | ||
44 | + MemOp mop; | ||
45 | |||
46 | if (!dc_isar_feature(aa64_rcpc_8_4, s)) { | ||
47 | unallocated_encoding(s); | ||
48 | return; | 22 | return; |
49 | } | 23 | } |
50 | 24 | ||
51 | + /* TODO: ARMv8.4-LSE SCTLR.nAA */ | ||
52 | + mop = size | MO_ALIGN; | ||
53 | + | ||
54 | switch (opc) { | ||
55 | case 0: /* STLURB */ | ||
56 | is_store = true; | ||
57 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) | ||
58 | unallocated_encoding(s); | ||
59 | return; | ||
60 | } | ||
61 | - is_signed = true; | ||
62 | + mop |= MO_SIGN; | ||
63 | break; | ||
64 | case 3: /* LDAPURS* 32-bit variant */ | ||
65 | if (size > 1) { | ||
66 | unallocated_encoding(s); | ||
67 | return; | ||
68 | } | ||
69 | - is_signed = true; | ||
70 | + mop |= MO_SIGN; | ||
71 | extend = true; /* zero-extend 32->64 after signed load */ | ||
72 | break; | ||
73 | default: | ||
74 | g_assert_not_reached(); | ||
75 | } | ||
76 | |||
77 | - iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc); | ||
78 | + iss_sf = disas_ldst_compute_iss_sf(size, (mop & MO_SIGN) != 0, opc); | ||
79 | |||
80 | if (rn == 31) { | ||
81 | gen_check_sp_alignment(s); | ||
82 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) | ||
83 | if (is_store) { | ||
84 | /* Store-Release semantics */ | ||
85 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
86 | - do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, iss_sf, true); | ||
87 | + do_gpr_st(s, cpu_reg(s, rt), clean_addr, mop, true, rt, iss_sf, true); | ||
88 | } else { | ||
89 | /* | ||
90 | * Load-AcquirePC semantics; we implement as the slightly more | ||
91 | * restrictive Load-Acquire. | ||
92 | */ | ||
93 | - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size + is_signed * MO_SIGN, | ||
94 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, mop, | ||
95 | extend, true, rt, iss_sf, true); | ||
96 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
97 | } | ||
98 | -- | 25 | -- |
99 | 2.20.1 | 26 | 2.25.1 |
100 | 27 | ||
101 | 28 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Split out a helper function from mte_checkN to perform | 3 | We will reuse this section of arm_deliver_fault for |
4 | all of the checking and address manpulation. So far, | 4 | raising pc alignment faults. |
5 | just use this in mte_checkN itself. | ||
6 | 5 | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210416183106.1516563-3-richard.henderson@linaro.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 9 | --- |
13 | target/arm/mte_helper.c | 52 +++++++++++++++++++++++++++++++---------- | 10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- |
14 | 1 file changed, 40 insertions(+), 12 deletions(-) | 11 | 1 file changed, 28 insertions(+), 17 deletions(-) |
15 | 12 | ||
16 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | 13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/mte_helper.c | 15 | --- a/target/arm/tlb_helper.c |
19 | +++ b/target/arm/mte_helper.c | 16 | +++ b/target/arm/tlb_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ static int checkN(uint8_t *mem, int odd, int cmp, int count) | 17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, |
21 | return n; | 18 | return syn; |
22 | } | 19 | } |
23 | 20 | ||
24 | -uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | 21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
25 | - uint64_t ptr, uintptr_t ra) | 22 | - MMUAccessType access_type, |
26 | +/** | 23 | - int mmu_idx, ARMMMUFaultInfo *fi) |
27 | + * mte_probe_int() - helper for mte_probe and mte_check | 24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, |
28 | + * @env: CPU environment | 25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) |
29 | + * @desc: MTEDESC descriptor | ||
30 | + * @ptr: virtual address of the base of the access | ||
31 | + * @fault: return virtual address of the first check failure | ||
32 | + * | ||
33 | + * Internal routine for both mte_probe and mte_check. | ||
34 | + * Return zero on failure, filling in *fault. | ||
35 | + * Return negative on trivial success for tbi disabled. | ||
36 | + * Return positive on success with tbi enabled. | ||
37 | + */ | ||
38 | +static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr, | ||
39 | + uintptr_t ra, uint32_t total, uint64_t *fault) | ||
40 | { | 26 | { |
41 | int mmu_idx, ptr_tag, bit55; | 27 | - CPUARMState *env = &cpu->env; |
42 | uint64_t ptr_last, prev_page, next_page; | 28 | - int target_el; |
43 | uint64_t tag_first, tag_last; | 29 | - bool same_el; |
44 | uint64_t tag_byte_first, tag_byte_last; | 30 | - uint32_t syn, exc, fsr, fsc; |
45 | - uint32_t total, tag_count, tag_size, n, c; | 31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); |
46 | + uint32_t tag_count, tag_size, n, c; | 32 | - |
47 | uint8_t *mem1, *mem2; | 33 | - target_el = exception_target_el(env); |
48 | MMUAccessType type; | 34 | - if (fi->stage2) { |
49 | 35 | - target_el = 2; | |
50 | bit55 = extract64(ptr, 55, 1); | 36 | - env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; |
51 | + *fault = ptr; | 37 | - if (arm_is_secure_below_el3(env) && fi->s1ns) { |
52 | 38 | - env->cp15.hpfar_el2 |= HPFAR_NS; | |
53 | /* If TBI is disabled, the access is unchecked, and ptr is not dirty. */ | 39 | - } |
54 | if (unlikely(!tbi_check(desc, bit55))) { | 40 | - } |
55 | - return ptr; | 41 | - same_el = (arm_current_el(env) == target_el); |
56 | + return -1; | 42 | + uint32_t fsr, fsc; |
43 | |||
44 | if (target_el == 2 || arm_el_is_aa64(env, target_el) || | ||
45 | arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, | ||
47 | fsc = 0x3f; | ||
57 | } | 48 | } |
58 | 49 | ||
59 | ptr_tag = allocation_tag_from_addr(ptr); | 50 | + *ret_fsc = fsc; |
60 | 51 | + return fsr; | |
61 | if (tcma_check(desc, bit55, ptr_tag)) { | 52 | +} |
62 | - goto done; | 53 | + |
63 | + return 1; | 54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
64 | } | 55 | + MMUAccessType access_type, |
65 | 56 | + int mmu_idx, ARMMMUFaultInfo *fi) | |
66 | mmu_idx = FIELD_EX32(desc, MTEDESC, MIDX); | 57 | +{ |
67 | type = FIELD_EX32(desc, MTEDESC, WRITE) ? MMU_DATA_STORE : MMU_DATA_LOAD; | 58 | + CPUARMState *env = &cpu->env; |
68 | - total = FIELD_EX32(desc, MTEDESC, TSIZE); | 59 | + int target_el; |
69 | 60 | + bool same_el; | |
70 | /* Find the addr of the end of the access */ | 61 | + uint32_t syn, exc, fsr, fsc; |
71 | ptr_last = ptr + total - 1; | 62 | + |
72 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | 63 | + target_el = exception_target_el(env); |
73 | mem1 = allocation_tag_mem(env, mmu_idx, ptr, type, total, | 64 | + if (fi->stage2) { |
74 | MMU_DATA_LOAD, tag_size, ra); | 65 | + target_el = 2; |
75 | if (!mem1) { | 66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; |
76 | - goto done; | 67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { |
77 | + return 1; | 68 | + env->cp15.hpfar_el2 |= HPFAR_NS; |
78 | } | 69 | + } |
79 | /* Perform all of the comparisons. */ | ||
80 | n = checkN(mem1, ptr & TAG_GRANULE, ptr_tag, tag_count); | ||
81 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
82 | } | ||
83 | if (n == c) { | ||
84 | if (!mem2) { | ||
85 | - goto done; | ||
86 | + return 1; | ||
87 | } | ||
88 | n += checkN(mem2, 0, ptr_tag, tag_count - c); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | + if (likely(n == tag_count)) { | ||
93 | + return 1; | ||
94 | + } | 70 | + } |
71 | + same_el = (arm_current_el(env) == target_el); | ||
95 | + | 72 | + |
96 | /* | 73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); |
97 | * If we failed, we know which granule. For the first granule, the | ||
98 | * failure address is @ptr, the first byte accessed. Otherwise the | ||
99 | * failure address is the first byte of the nth granule. | ||
100 | */ | ||
101 | - if (unlikely(n < tag_count)) { | ||
102 | - uint64_t fault = (n == 0 ? ptr : tag_first + n * TAG_GRANULE); | ||
103 | - mte_check_fail(env, desc, fault, ra); | ||
104 | + if (n > 0) { | ||
105 | + *fault = tag_first + n * TAG_GRANULE; | ||
106 | } | ||
107 | + return 0; | ||
108 | +} | ||
109 | |||
110 | - done: | ||
111 | +uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
112 | + uint64_t ptr, uintptr_t ra) | ||
113 | +{ | ||
114 | + uint64_t fault; | ||
115 | + uint32_t total = FIELD_EX32(desc, MTEDESC, TSIZE); | ||
116 | + int ret = mte_probe_int(env, desc, ptr, ra, total, &fault); | ||
117 | + | 74 | + |
118 | + if (unlikely(ret == 0)) { | 75 | if (access_type == MMU_INST_FETCH) { |
119 | + mte_check_fail(env, desc, fault, ra); | 76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); |
120 | + } else if (ret < 0) { | 77 | exc = EXCP_PREFETCH_ABORT; |
121 | + return ptr; | ||
122 | + } | ||
123 | return useronly_clean_ptr(ptr); | ||
124 | } | ||
125 | |||
126 | -- | 78 | -- |
127 | 2.20.1 | 79 | 2.25.1 |
128 | 80 | ||
129 | 81 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Use this to signal when memory access alignment is required. | 3 | For A64, any input to an indirect branch can cause this. |
4 | This value comes from the CCR register for M-profile, and | 4 | |
5 | from the SCTLR register for A-profile. | 5 | For A32, many indirect branch paths force the branch to be aligned, |
6 | 6 | but BXWritePC does not. This includes the BX instruction but also | |
7 | other interworking changes to PC. Prior to v8, this case is UNDEFINED. | ||
8 | With v8, this is CONSTRAINED UNPREDICTABLE and may either raise an | ||
9 | exception or force align the PC. | ||
10 | |||
11 | We choose to raise an exception because we have the infrastructure, | ||
12 | it makes the generated code for gen_bx simpler, and it has the | ||
13 | possibility of catching more guest bugs. | ||
14 | |||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20210419202257.161730-11-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 18 | --- |
12 | target/arm/cpu.h | 2 ++ | 19 | target/arm/helper.h | 1 + |
13 | target/arm/translate.h | 2 ++ | 20 | target/arm/syndrome.h | 5 ++++ |
14 | target/arm/helper.c | 19 +++++++++++++++++-- | 21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- |
15 | target/arm/translate-a64.c | 1 + | 22 | target/arm/tlb_helper.c | 18 ++++++++++++++ |
16 | target/arm/translate.c | 7 +++---- | 23 | target/arm/translate-a64.c | 15 ++++++++++++ |
17 | 5 files changed, 25 insertions(+), 6 deletions(-) | 24 | target/arm/translate.c | 22 ++++++++++++++++- |
18 | 25 | 6 files changed, 87 insertions(+), 20 deletions(-) | |
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 26 | |
20 | index XXXXXXX..XXXXXXX 100644 | 27 | diff --git a/target/arm/helper.h b/target/arm/helper.h |
21 | --- a/target/arm/cpu.h | 28 | index XXXXXXX..XXXXXXX 100644 |
22 | +++ b/target/arm/cpu.h | 29 | --- a/target/arm/helper.h |
23 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, MMUIDX, 4, 4) | 30 | +++ b/target/arm/helper.h |
24 | FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) | 31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, |
25 | /* For A-profile only, target EL for debug exceptions. */ | 32 | DEF_HELPER_2(exception_internal, void, env, i32) |
26 | FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 10, 2) | 33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) |
27 | +/* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */ | 34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) |
28 | +FIELD(TBFLAG_ANY, ALIGN_MEM, 12, 1) | 35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) |
36 | DEF_HELPER_1(setend, void, env) | ||
37 | DEF_HELPER_2(wfi, void, env, i32) | ||
38 | DEF_HELPER_1(wfe, void, env) | ||
39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/syndrome.h | ||
42 | +++ b/target/arm/syndrome.h | ||
43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) | ||
44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
45 | } | ||
46 | |||
47 | +static inline uint32_t syn_pcalignment(void) | ||
48 | +{ | ||
49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; | ||
50 | +} | ||
51 | + | ||
52 | #endif /* TARGET_ARM_SYNDROME_H */ | ||
53 | diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/linux-user/aarch64/cpu_loop.c | ||
56 | +++ b/linux-user/aarch64/cpu_loop.c | ||
57 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) | ||
58 | break; | ||
59 | case EXCP_PREFETCH_ABORT: | ||
60 | case EXCP_DATA_ABORT: | ||
61 | - /* We should only arrive here with EC in {DATAABORT, INSNABORT}. */ | ||
62 | ec = syn_get_ec(env->exception.syndrome); | ||
63 | - assert(ec == EC_DATAABORT || ec == EC_INSNABORT); | ||
64 | - | ||
65 | - /* Both EC have the same format for FSC, or close enough. */ | ||
66 | - fsc = extract32(env->exception.syndrome, 0, 6); | ||
67 | - switch (fsc) { | ||
68 | - case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
69 | - si_signo = TARGET_SIGSEGV; | ||
70 | - si_code = TARGET_SEGV_MAPERR; | ||
71 | + switch (ec) { | ||
72 | + case EC_DATAABORT: | ||
73 | + case EC_INSNABORT: | ||
74 | + /* Both EC have the same format for FSC, or close enough. */ | ||
75 | + fsc = extract32(env->exception.syndrome, 0, 6); | ||
76 | + switch (fsc) { | ||
77 | + case 0x04 ... 0x07: /* Translation fault, level {0-3} */ | ||
78 | + si_signo = TARGET_SIGSEGV; | ||
79 | + si_code = TARGET_SEGV_MAPERR; | ||
80 | + break; | ||
81 | + case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
82 | + case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
83 | + si_signo = TARGET_SIGSEGV; | ||
84 | + si_code = TARGET_SEGV_ACCERR; | ||
85 | + break; | ||
86 | + case 0x11: /* Synchronous Tag Check Fault */ | ||
87 | + si_signo = TARGET_SIGSEGV; | ||
88 | + si_code = TARGET_SEGV_MTESERR; | ||
89 | + break; | ||
90 | + case 0x21: /* Alignment fault */ | ||
91 | + si_signo = TARGET_SIGBUS; | ||
92 | + si_code = TARGET_BUS_ADRALN; | ||
93 | + break; | ||
94 | + default: | ||
95 | + g_assert_not_reached(); | ||
96 | + } | ||
97 | break; | ||
98 | - case 0x09 ... 0x0b: /* Access flag fault, level {1-3} */ | ||
99 | - case 0x0d ... 0x0f: /* Permission fault, level {1-3} */ | ||
100 | - si_signo = TARGET_SIGSEGV; | ||
101 | - si_code = TARGET_SEGV_ACCERR; | ||
102 | - break; | ||
103 | - case 0x11: /* Synchronous Tag Check Fault */ | ||
104 | - si_signo = TARGET_SIGSEGV; | ||
105 | - si_code = TARGET_SEGV_MTESERR; | ||
106 | - break; | ||
107 | - case 0x21: /* Alignment fault */ | ||
108 | + case EC_PCALIGNMENT: | ||
109 | si_signo = TARGET_SIGBUS; | ||
110 | si_code = TARGET_BUS_ADRALN; | ||
111 | break; | ||
112 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c | ||
113 | index XXXXXXX..XXXXXXX 100644 | ||
114 | --- a/target/arm/tlb_helper.c | ||
115 | +++ b/target/arm/tlb_helper.c | ||
116 | @@ -XXX,XX +XXX,XX @@ | ||
117 | #include "cpu.h" | ||
118 | #include "internals.h" | ||
119 | #include "exec/exec-all.h" | ||
120 | +#include "exec/helper-proto.h" | ||
121 | |||
122 | static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
123 | unsigned int target_el, | ||
124 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | ||
125 | arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi); | ||
126 | } | ||
127 | |||
128 | +void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) | ||
129 | +{ | ||
130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; | ||
131 | + int target_el = exception_target_el(env); | ||
132 | + int mmu_idx = cpu_mmu_index(env, true); | ||
133 | + uint32_t fsc; | ||
134 | + | ||
135 | + env->exception.vaddress = pc; | ||
136 | + | ||
137 | + /* | ||
138 | + * Note that the fsc is not applicable to this exception, | ||
139 | + * since any syndrome is pcalignment not insn_abort. | ||
140 | + */ | ||
141 | + env->exception.fsr = compute_fsr_fsc(env, &fi, target_el, mmu_idx, &fsc); | ||
142 | + raise_exception(env, EXCP_PREFETCH_ABORT, syn_pcalignment(), target_el); | ||
143 | +} | ||
144 | + | ||
145 | #if !defined(CONFIG_USER_ONLY) | ||
29 | 146 | ||
30 | /* | 147 | /* |
31 | * Bit usage when in AArch32 state, both A- and M-profile. | ||
32 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate.h | ||
35 | +++ b/target/arm/translate.h | ||
36 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
37 | bool bt; | ||
38 | /* True if any CP15 access is trapped by HSTR_EL2 */ | ||
39 | bool hstr_active; | ||
40 | + /* True if memory operations require alignment */ | ||
41 | + bool align_mem; | ||
42 | /* | ||
43 | * >= 0, a copy of PSTATE.BTYPE, which will be 0 without v8.5-BTI. | ||
44 | * < 0, set by the current instruction. | ||
45 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/arm/helper.c | ||
48 | +++ b/target/arm/helper.c | ||
49 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
50 | ARMMMUIdx mmu_idx) | ||
51 | { | ||
52 | CPUARMTBFlags flags = {}; | ||
53 | + uint32_t ccr = env->v7m.ccr[env->v7m.secure]; | ||
54 | + | ||
55 | + /* Without HaveMainExt, CCR.UNALIGN_TRP is RES1. */ | ||
56 | + if (ccr & R_V7M_CCR_UNALIGN_TRP_MASK) { | ||
57 | + DP_TBFLAG_ANY(flags, ALIGN_MEM, 1); | ||
58 | + } | ||
59 | |||
60 | if (arm_v7m_is_handler_mode(env)) { | ||
61 | DP_TBFLAG_M32(flags, HANDLER, 1); | ||
62 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
63 | */ | ||
64 | if (arm_feature(env, ARM_FEATURE_V8) && | ||
65 | !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && | ||
66 | - (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { | ||
67 | + (ccr & R_V7M_CCR_STKOFHFNMIGN_MASK))) { | ||
68 | DP_TBFLAG_M32(flags, STACKCHECK, 1); | ||
69 | } | ||
70 | |||
71 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
72 | ARMMMUIdx mmu_idx) | ||
73 | { | ||
74 | CPUARMTBFlags flags = rebuild_hflags_aprofile(env); | ||
75 | + int el = arm_current_el(env); | ||
76 | + | ||
77 | + if (arm_sctlr(env, el) & SCTLR_A) { | ||
78 | + DP_TBFLAG_ANY(flags, ALIGN_MEM, 1); | ||
79 | + } | ||
80 | |||
81 | if (arm_el_is_aa64(env, 1)) { | ||
82 | DP_TBFLAG_A32(flags, VFPEN, 1); | ||
83 | } | ||
84 | |||
85 | - if (arm_current_el(env) < 2 && env->cp15.hstr_el2 && | ||
86 | + if (el < 2 && env->cp15.hstr_el2 && | ||
87 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { | ||
88 | DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); | ||
89 | } | ||
90 | @@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
91 | |||
92 | sctlr = regime_sctlr(env, stage1); | ||
93 | |||
94 | + if (sctlr & SCTLR_A) { | ||
95 | + DP_TBFLAG_ANY(flags, ALIGN_MEM, 1); | ||
96 | + } | ||
97 | + | ||
98 | if (arm_cpu_data_is_big_endian_a64(el, sctlr)) { | ||
99 | DP_TBFLAG_ANY(flags, BE_DATA, 1); | ||
100 | } | ||
101 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
102 | index XXXXXXX..XXXXXXX 100644 | 149 | index XXXXXXX..XXXXXXX 100644 |
103 | --- a/target/arm/translate-a64.c | 150 | --- a/target/arm/translate-a64.c |
104 | +++ b/target/arm/translate-a64.c | 151 | +++ b/target/arm/translate-a64.c |
105 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | 152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
106 | dc->user = (dc->current_el == 0); | 153 | uint64_t pc = s->base.pc_next; |
107 | #endif | 154 | uint32_t insn; |
108 | dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); | 155 | |
109 | + dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | 156 | + /* Singlestep exceptions have the highest priority. */ |
110 | dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | 157 | if (s->ss_active && !s->pstate_ss) { |
111 | dc->sve_len = (EX_TBFLAG_A64(tb_flags, ZCR_LEN) + 1) * 16; | 158 | /* Singlestep state is Active-pending. |
112 | dc->pauth_active = EX_TBFLAG_A64(tb_flags, PAUTH_ACTIVE); | 159 | * If we're in this state at the start of a TB then either |
160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | + if (pc & 3) { | ||
165 | + /* | ||
166 | + * PC alignment fault. This has priority over the instruction abort | ||
167 | + * that we would receive from a translation fault via arm_ldl_code. | ||
168 | + * This should only be possible after an indirect branch, at the | ||
169 | + * start of the TB. | ||
170 | + */ | ||
171 | + assert(s->base.num_insns == 1); | ||
172 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
173 | + s->base.is_jmp = DISAS_NORETURN; | ||
174 | + s->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
175 | + return; | ||
176 | + } | ||
177 | + | ||
178 | s->pc_curr = pc; | ||
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
180 | s->insn = insn; | ||
113 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 181 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
114 | index XXXXXXX..XXXXXXX 100644 | 182 | index XXXXXXX..XXXXXXX 100644 |
115 | --- a/target/arm/translate.c | 183 | --- a/target/arm/translate.c |
116 | +++ b/target/arm/translate.c | 184 | +++ b/target/arm/translate.c |
117 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | 185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
118 | { | 186 | uint32_t pc = dc->base.pc_next; |
119 | TCGv addr; | 187 | unsigned int insn; |
120 | 188 | ||
121 | - if (arm_dc_feature(s, ARM_FEATURE_M) && | 189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
122 | - !arm_dc_feature(s, ARM_FEATURE_M_MAIN)) { | 190 | + /* Singlestep exceptions have the highest priority. */ |
123 | + if (s->align_mem) { | 191 | + if (arm_check_ss_active(dc)) { |
124 | opc |= MO_ALIGN; | 192 | + dc->base.pc_next = pc + 4; |
193 | + return; | ||
194 | + } | ||
195 | + | ||
196 | + if (pc & 3) { | ||
197 | + /* | ||
198 | + * PC alignment fault. This has priority over the instruction abort | ||
199 | + * that we would receive from a translation fault via arm_ldl_code | ||
200 | + * (or the execution of the kernelpage entrypoint). This should only | ||
201 | + * be possible after an indirect branch, at the start of the TB. | ||
202 | + */ | ||
203 | + assert(dc->base.num_insns == 1); | ||
204 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
205 | + dc->base.is_jmp = DISAS_NORETURN; | ||
206 | + dc->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
207 | + return; | ||
208 | + } | ||
209 | + | ||
210 | + if (arm_check_kernelpage(dc)) { | ||
211 | dc->base.pc_next = pc + 4; | ||
212 | return; | ||
125 | } | 213 | } |
126 | |||
127 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
128 | { | ||
129 | TCGv addr; | ||
130 | |||
131 | - if (arm_dc_feature(s, ARM_FEATURE_M) && | ||
132 | - !arm_dc_feature(s, ARM_FEATURE_M_MAIN)) { | ||
133 | + if (s->align_mem) { | ||
134 | opc |= MO_ALIGN; | ||
135 | } | ||
136 | |||
137 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
138 | dc->user = (dc->current_el == 0); | ||
139 | #endif | ||
140 | dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); | ||
141 | + dc->align_mem = EX_TBFLAG_ANY(tb_flags, ALIGN_MEM); | ||
142 | |||
143 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
144 | dc->vfp_enabled = 1; | ||
145 | -- | 214 | -- |
146 | 2.20.1 | 215 | 2.25.1 |
147 | 216 | ||
148 | 217 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We're about to split tbflags into two parts. These macros | 3 | Misaligned thumb PC is architecturally impossible. |
4 | will ensure that the correct part is used with the correct | 4 | Assert is better than proceeding, in case we've missed |
5 | set of bits. | 5 | something somewhere. |
6 | |||
7 | Expand a comment about aligning the pc in gdbstub. | ||
8 | Fail an incoming migrate if a thumb pc is misaligned. | ||
6 | 9 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210419202257.161730-5-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | target/arm/cpu.h | 22 +++++++++- | 14 | target/arm/gdbstub.c | 9 +++++++-- |
13 | target/arm/helper-a64.c | 2 +- | 15 | target/arm/machine.c | 10 ++++++++++ |
14 | target/arm/helper.c | 85 +++++++++++++++++--------------------- | 16 | target/arm/translate.c | 3 +++ |
15 | target/arm/translate-a64.c | 36 ++++++++-------- | 17 | 3 files changed, 20 insertions(+), 2 deletions(-) |
16 | target/arm/translate.c | 48 ++++++++++----------- | ||
17 | 5 files changed, 101 insertions(+), 92 deletions(-) | ||
18 | 18 | ||
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
20 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/cpu.h | 21 | --- a/target/arm/gdbstub.c |
22 | +++ b/target/arm/cpu.h | 22 | +++ b/target/arm/gdbstub.c |
23 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, TCMA, 16, 2) | 23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
24 | FIELD(TBFLAG_A64, MTE_ACTIVE, 18, 1) | 24 | |
25 | FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) | 25 | tmp = ldl_p(mem_buf); |
26 | 26 | ||
27 | +/* | 27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably |
28 | + * Helpers for using the above. | 28 | - cause problems if we ever implement the Jazelle DBX extensions. */ |
29 | + */ | 29 | + /* |
30 | +#define DP_TBFLAG_ANY(DST, WHICH, VAL) \ | 30 | + * Mask out low bits of PC to workaround gdb bugs. |
31 | + (DST = FIELD_DP32(DST, TBFLAG_ANY, WHICH, VAL)) | 31 | + * This avoids an assert in thumb_tr_translate_insn, because it is |
32 | +#define DP_TBFLAG_A64(DST, WHICH, VAL) \ | 32 | + * architecturally impossible to misalign the pc. |
33 | + (DST = FIELD_DP32(DST, TBFLAG_A64, WHICH, VAL)) | 33 | + * This will probably cause problems if we ever implement the |
34 | +#define DP_TBFLAG_A32(DST, WHICH, VAL) \ | 34 | + * Jazelle DBX extensions. |
35 | + (DST = FIELD_DP32(DST, TBFLAG_A32, WHICH, VAL)) | 35 | + */ |
36 | +#define DP_TBFLAG_M32(DST, WHICH, VAL) \ | 36 | if (n == 15) { |
37 | + (DST = FIELD_DP32(DST, TBFLAG_M32, WHICH, VAL)) | 37 | tmp &= ~1; |
38 | +#define DP_TBFLAG_AM32(DST, WHICH, VAL) \ | 38 | } |
39 | + (DST = FIELD_DP32(DST, TBFLAG_AM32, WHICH, VAL)) | 39 | diff --git a/target/arm/machine.c b/target/arm/machine.c |
40 | + | ||
41 | +#define EX_TBFLAG_ANY(IN, WHICH) FIELD_EX32(IN, TBFLAG_ANY, WHICH) | ||
42 | +#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN, TBFLAG_A64, WHICH) | ||
43 | +#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN, TBFLAG_A32, WHICH) | ||
44 | +#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN, TBFLAG_M32, WHICH) | ||
45 | +#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN, TBFLAG_AM32, WHICH) | ||
46 | + | ||
47 | /** | ||
48 | * cpu_mmu_index: | ||
49 | * @env: The cpu environment | ||
50 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) | ||
51 | */ | ||
52 | static inline int cpu_mmu_index(CPUARMState *env, bool ifetch) | ||
53 | { | ||
54 | - return FIELD_EX32(env->hflags, TBFLAG_ANY, MMUIDX); | ||
55 | + return EX_TBFLAG_ANY(env->hflags, MMUIDX); | ||
56 | } | ||
57 | |||
58 | static inline bool bswap_code(bool sctlr_b) | ||
59 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
61 | --- a/target/arm/helper-a64.c | 41 | --- a/target/arm/machine.c |
62 | +++ b/target/arm/helper-a64.c | 42 | +++ b/target/arm/machine.c |
63 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) | 43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
64 | * the hflags rebuild, since we can pull the composite TBII field | 44 | return -1; |
65 | * from there. | ||
66 | */ | ||
67 | - tbii = FIELD_EX32(env->hflags, TBFLAG_A64, TBII); | ||
68 | + tbii = EX_TBFLAG_A64(env->hflags, TBII); | ||
69 | if ((tbii >> extract64(new_pc, 55, 1)) & 1) { | ||
70 | /* TBI is enabled. */ | ||
71 | int core_mmu_idx = cpu_mmu_index(env, false); | ||
72 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/target/arm/helper.c | ||
75 | +++ b/target/arm/helper.c | ||
76 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) | ||
77 | static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
78 | ARMMMUIdx mmu_idx, uint32_t flags) | ||
79 | { | ||
80 | - flags = FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el); | ||
81 | - flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, | ||
82 | - arm_to_core_mmu_idx(mmu_idx)); | ||
83 | + DP_TBFLAG_ANY(flags, FPEXC_EL, fp_el); | ||
84 | + DP_TBFLAG_ANY(flags, MMUIDX, arm_to_core_mmu_idx(mmu_idx)); | ||
85 | |||
86 | if (arm_singlestep_active(env)) { | ||
87 | - flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); | ||
88 | + DP_TBFLAG_ANY(flags, SS_ACTIVE, 1); | ||
89 | } | ||
90 | return flags; | ||
91 | } | ||
92 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
93 | bool sctlr_b = arm_sctlr_b(env); | ||
94 | |||
95 | if (sctlr_b) { | ||
96 | - flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR__B, 1); | ||
97 | + DP_TBFLAG_A32(flags, SCTLR__B, 1); | ||
98 | } | ||
99 | if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) { | ||
100 | - flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
101 | + DP_TBFLAG_ANY(flags, BE_DATA, 1); | ||
102 | } | ||
103 | - flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); | ||
104 | + DP_TBFLAG_A32(flags, NS, !access_secure_reg(env)); | ||
105 | |||
106 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
107 | } | ||
108 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
109 | uint32_t flags = 0; | ||
110 | |||
111 | if (arm_v7m_is_handler_mode(env)) { | ||
112 | - flags = FIELD_DP32(flags, TBFLAG_M32, HANDLER, 1); | ||
113 | + DP_TBFLAG_M32(flags, HANDLER, 1); | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
118 | if (arm_feature(env, ARM_FEATURE_V8) && | ||
119 | !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && | ||
120 | (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { | ||
121 | - flags = FIELD_DP32(flags, TBFLAG_M32, STACKCHECK, 1); | ||
122 | + DP_TBFLAG_M32(flags, STACKCHECK, 1); | ||
123 | } | ||
124 | |||
125 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | ||
126 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_aprofile(CPUARMState *env) | ||
127 | { | ||
128 | int flags = 0; | ||
129 | |||
130 | - flags = FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, | ||
131 | - arm_debug_target_el(env)); | ||
132 | + DP_TBFLAG_ANY(flags, DEBUG_TARGET_EL, arm_debug_target_el(env)); | ||
133 | return flags; | ||
134 | } | ||
135 | |||
136 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
137 | uint32_t flags = rebuild_hflags_aprofile(env); | ||
138 | |||
139 | if (arm_el_is_aa64(env, 1)) { | ||
140 | - flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
141 | + DP_TBFLAG_A32(flags, VFPEN, 1); | ||
142 | } | ||
143 | |||
144 | if (arm_current_el(env) < 2 && env->cp15.hstr_el2 && | ||
145 | (arm_hcr_el2_eff(env) & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) { | ||
146 | - flags = FIELD_DP32(flags, TBFLAG_A32, HSTR_ACTIVE, 1); | ||
147 | + DP_TBFLAG_A32(flags, HSTR_ACTIVE, 1); | ||
148 | } | ||
149 | |||
150 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | ||
151 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
152 | uint64_t sctlr; | ||
153 | int tbii, tbid; | ||
154 | |||
155 | - flags = FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1); | ||
156 | + DP_TBFLAG_ANY(flags, AARCH64_STATE, 1); | ||
157 | |||
158 | /* Get control bits for tagged addresses. */ | ||
159 | tbid = aa64_va_parameter_tbi(tcr, mmu_idx); | ||
160 | tbii = tbid & ~aa64_va_parameter_tbid(tcr, mmu_idx); | ||
161 | |||
162 | - flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); | ||
163 | - flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); | ||
164 | + DP_TBFLAG_A64(flags, TBII, tbii); | ||
165 | + DP_TBFLAG_A64(flags, TBID, tbid); | ||
166 | |||
167 | if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { | ||
168 | int sve_el = sve_exception_el(env, el); | ||
169 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
170 | } else { | ||
171 | zcr_len = sve_zcr_len_for_el(env, el); | ||
172 | } | ||
173 | - flags = FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el); | ||
174 | - flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); | ||
175 | + DP_TBFLAG_A64(flags, SVEEXC_EL, sve_el); | ||
176 | + DP_TBFLAG_A64(flags, ZCR_LEN, zcr_len); | ||
177 | } | ||
178 | |||
179 | sctlr = regime_sctlr(env, stage1); | ||
180 | |||
181 | if (arm_cpu_data_is_big_endian_a64(el, sctlr)) { | ||
182 | - flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
183 | + DP_TBFLAG_ANY(flags, BE_DATA, 1); | ||
184 | } | ||
185 | |||
186 | if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) { | ||
187 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
188 | * The decision of which action to take is left to a helper. | ||
189 | */ | ||
190 | if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) { | ||
191 | - flags = FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1); | ||
192 | + DP_TBFLAG_A64(flags, PAUTH_ACTIVE, 1); | ||
193 | } | 45 | } |
194 | } | 46 | } |
195 | 47 | + | |
196 | if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | 48 | + /* |
197 | /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */ | 49 | + * Misaligned thumb pc is architecturally impossible. |
198 | if (sctlr & (el == 0 ? SCTLR_BT0 : SCTLR_BT1)) { | 50 | + * We have an assert in thumb_tr_translate_insn to verify this. |
199 | - flags = FIELD_DP32(flags, TBFLAG_A64, BT, 1); | 51 | + * Fail an incoming migrate to avoid this assert. |
200 | + DP_TBFLAG_A64(flags, BT, 1); | 52 | + */ |
201 | } | 53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { |
54 | + return -1; | ||
55 | + } | ||
56 | + | ||
57 | if (!kvm_enabled()) { | ||
58 | pmu_op_finish(&cpu->env); | ||
202 | } | 59 | } |
203 | |||
204 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
205 | case ARMMMUIdx_SE10_1: | ||
206 | case ARMMMUIdx_SE10_1_PAN: | ||
207 | /* TODO: ARMv8.3-NV */ | ||
208 | - flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); | ||
209 | + DP_TBFLAG_A64(flags, UNPRIV, 1); | ||
210 | break; | ||
211 | case ARMMMUIdx_E20_2: | ||
212 | case ARMMMUIdx_E20_2_PAN: | ||
213 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
214 | * gated by HCR_EL2.<E2H,TGE> == '11', and so is LDTR. | ||
215 | */ | ||
216 | if (env->cp15.hcr_el2 & HCR_TGE) { | ||
217 | - flags = FIELD_DP32(flags, TBFLAG_A64, UNPRIV, 1); | ||
218 | + DP_TBFLAG_A64(flags, UNPRIV, 1); | ||
219 | } | ||
220 | break; | ||
221 | default: | ||
222 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
223 | * 4) If no Allocation Tag Access, then all accesses are Unchecked. | ||
224 | */ | ||
225 | if (allocation_tag_access_enabled(env, el, sctlr)) { | ||
226 | - flags = FIELD_DP32(flags, TBFLAG_A64, ATA, 1); | ||
227 | + DP_TBFLAG_A64(flags, ATA, 1); | ||
228 | if (tbid | ||
229 | && !(env->pstate & PSTATE_TCO) | ||
230 | && (sctlr & (el == 0 ? SCTLR_TCF0 : SCTLR_TCF))) { | ||
231 | - flags = FIELD_DP32(flags, TBFLAG_A64, MTE_ACTIVE, 1); | ||
232 | + DP_TBFLAG_A64(flags, MTE_ACTIVE, 1); | ||
233 | } | ||
234 | } | ||
235 | /* And again for unprivileged accesses, if required. */ | ||
236 | - if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV) | ||
237 | + if (EX_TBFLAG_A64(flags, UNPRIV) | ||
238 | && tbid | ||
239 | && !(env->pstate & PSTATE_TCO) | ||
240 | && (sctlr & SCTLR_TCF0) | ||
241 | && allocation_tag_access_enabled(env, 0, sctlr)) { | ||
242 | - flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1); | ||
243 | + DP_TBFLAG_A64(flags, MTE0_ACTIVE, 1); | ||
244 | } | ||
245 | /* Cache TCMA as well as TBI. */ | ||
246 | - flags = FIELD_DP32(flags, TBFLAG_A64, TCMA, | ||
247 | - aa64_va_parameter_tcma(tcr, mmu_idx)); | ||
248 | + DP_TBFLAG_A64(flags, TCMA, aa64_va_parameter_tcma(tcr, mmu_idx)); | ||
249 | } | ||
250 | |||
251 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
252 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
253 | *cs_base = 0; | ||
254 | assert_hflags_rebuild_correctly(env); | ||
255 | |||
256 | - if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { | ||
257 | + if (EX_TBFLAG_ANY(flags, AARCH64_STATE)) { | ||
258 | *pc = env->pc; | ||
259 | if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | ||
260 | - flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); | ||
261 | + DP_TBFLAG_A64(flags, BTYPE, env->btype); | ||
262 | } | ||
263 | } else { | ||
264 | *pc = env->regs[15]; | ||
265 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
266 | if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | ||
267 | FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) | ||
268 | != env->v7m.secure) { | ||
269 | - flags = FIELD_DP32(flags, TBFLAG_M32, FPCCR_S_WRONG, 1); | ||
270 | + DP_TBFLAG_M32(flags, FPCCR_S_WRONG, 1); | ||
271 | } | ||
272 | |||
273 | if ((env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) && | ||
274 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
275 | * active FP context; we must create a new FP context before | ||
276 | * executing any FP insn. | ||
277 | */ | ||
278 | - flags = FIELD_DP32(flags, TBFLAG_M32, NEW_FP_CTXT_NEEDED, 1); | ||
279 | + DP_TBFLAG_M32(flags, NEW_FP_CTXT_NEEDED, 1); | ||
280 | } | ||
281 | |||
282 | bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
283 | if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { | ||
284 | - flags = FIELD_DP32(flags, TBFLAG_M32, LSPACT, 1); | ||
285 | + DP_TBFLAG_M32(flags, LSPACT, 1); | ||
286 | } | ||
287 | } else { | ||
288 | /* | ||
289 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
290 | * Note that VECLEN+VECSTRIDE are RES0 for M-profile. | ||
291 | */ | ||
292 | if (arm_feature(env, ARM_FEATURE_XSCALE)) { | ||
293 | - flags = FIELD_DP32(flags, TBFLAG_A32, | ||
294 | - XSCALE_CPAR, env->cp15.c15_cpar); | ||
295 | + DP_TBFLAG_A32(flags, XSCALE_CPAR, env->cp15.c15_cpar); | ||
296 | } else { | ||
297 | - flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, | ||
298 | - env->vfp.vec_len); | ||
299 | - flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, | ||
300 | - env->vfp.vec_stride); | ||
301 | + DP_TBFLAG_A32(flags, VECLEN, env->vfp.vec_len); | ||
302 | + DP_TBFLAG_A32(flags, VECSTRIDE, env->vfp.vec_stride); | ||
303 | } | ||
304 | if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)) { | ||
305 | - flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
306 | + DP_TBFLAG_A32(flags, VFPEN, 1); | ||
307 | } | ||
308 | } | ||
309 | |||
310 | - flags = FIELD_DP32(flags, TBFLAG_AM32, THUMB, env->thumb); | ||
311 | - flags = FIELD_DP32(flags, TBFLAG_AM32, CONDEXEC, env->condexec_bits); | ||
312 | + DP_TBFLAG_AM32(flags, THUMB, env->thumb); | ||
313 | + DP_TBFLAG_AM32(flags, CONDEXEC, env->condexec_bits); | ||
314 | } | ||
315 | |||
316 | /* | ||
317 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
318 | * 1 1 Active-not-pending | ||
319 | * SS_ACTIVE is set in hflags; PSTATE__SS is computed every TB. | ||
320 | */ | ||
321 | - if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE) && | ||
322 | - (env->pstate & PSTATE_SS)) { | ||
323 | - flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE__SS, 1); | ||
324 | + if (EX_TBFLAG_ANY(flags, SS_ACTIVE) && (env->pstate & PSTATE_SS)) { | ||
325 | + DP_TBFLAG_ANY(flags, PSTATE__SS, 1); | ||
326 | } | ||
327 | |||
328 | *pflags = flags; | ||
329 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
330 | index XXXXXXX..XXXXXXX 100644 | ||
331 | --- a/target/arm/translate-a64.c | ||
332 | +++ b/target/arm/translate-a64.c | ||
333 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
334 | !arm_el_is_aa64(env, 3); | ||
335 | dc->thumb = 0; | ||
336 | dc->sctlr_b = 0; | ||
337 | - dc->be_data = FIELD_EX32(tb_flags, TBFLAG_ANY, BE_DATA) ? MO_BE : MO_LE; | ||
338 | + dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; | ||
339 | dc->condexec_mask = 0; | ||
340 | dc->condexec_cond = 0; | ||
341 | - core_mmu_idx = FIELD_EX32(tb_flags, TBFLAG_ANY, MMUIDX); | ||
342 | + core_mmu_idx = EX_TBFLAG_ANY(tb_flags, MMUIDX); | ||
343 | dc->mmu_idx = core_to_aa64_mmu_idx(core_mmu_idx); | ||
344 | - dc->tbii = FIELD_EX32(tb_flags, TBFLAG_A64, TBII); | ||
345 | - dc->tbid = FIELD_EX32(tb_flags, TBFLAG_A64, TBID); | ||
346 | - dc->tcma = FIELD_EX32(tb_flags, TBFLAG_A64, TCMA); | ||
347 | + dc->tbii = EX_TBFLAG_A64(tb_flags, TBII); | ||
348 | + dc->tbid = EX_TBFLAG_A64(tb_flags, TBID); | ||
349 | + dc->tcma = EX_TBFLAG_A64(tb_flags, TCMA); | ||
350 | dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); | ||
351 | #if !defined(CONFIG_USER_ONLY) | ||
352 | dc->user = (dc->current_el == 0); | ||
353 | #endif | ||
354 | - dc->fp_excp_el = FIELD_EX32(tb_flags, TBFLAG_ANY, FPEXC_EL); | ||
355 | - dc->sve_excp_el = FIELD_EX32(tb_flags, TBFLAG_A64, SVEEXC_EL); | ||
356 | - dc->sve_len = (FIELD_EX32(tb_flags, TBFLAG_A64, ZCR_LEN) + 1) * 16; | ||
357 | - dc->pauth_active = FIELD_EX32(tb_flags, TBFLAG_A64, PAUTH_ACTIVE); | ||
358 | - dc->bt = FIELD_EX32(tb_flags, TBFLAG_A64, BT); | ||
359 | - dc->btype = FIELD_EX32(tb_flags, TBFLAG_A64, BTYPE); | ||
360 | - dc->unpriv = FIELD_EX32(tb_flags, TBFLAG_A64, UNPRIV); | ||
361 | - dc->ata = FIELD_EX32(tb_flags, TBFLAG_A64, ATA); | ||
362 | - dc->mte_active[0] = FIELD_EX32(tb_flags, TBFLAG_A64, MTE_ACTIVE); | ||
363 | - dc->mte_active[1] = FIELD_EX32(tb_flags, TBFLAG_A64, MTE0_ACTIVE); | ||
364 | + dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); | ||
365 | + dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); | ||
366 | + dc->sve_len = (EX_TBFLAG_A64(tb_flags, ZCR_LEN) + 1) * 16; | ||
367 | + dc->pauth_active = EX_TBFLAG_A64(tb_flags, PAUTH_ACTIVE); | ||
368 | + dc->bt = EX_TBFLAG_A64(tb_flags, BT); | ||
369 | + dc->btype = EX_TBFLAG_A64(tb_flags, BTYPE); | ||
370 | + dc->unpriv = EX_TBFLAG_A64(tb_flags, UNPRIV); | ||
371 | + dc->ata = EX_TBFLAG_A64(tb_flags, ATA); | ||
372 | + dc->mte_active[0] = EX_TBFLAG_A64(tb_flags, MTE_ACTIVE); | ||
373 | + dc->mte_active[1] = EX_TBFLAG_A64(tb_flags, MTE0_ACTIVE); | ||
374 | dc->vec_len = 0; | ||
375 | dc->vec_stride = 0; | ||
376 | dc->cp_regs = arm_cpu->cp_regs; | ||
377 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
378 | * emit code to generate a software step exception | ||
379 | * end the TB | ||
380 | */ | ||
381 | - dc->ss_active = FIELD_EX32(tb_flags, TBFLAG_ANY, SS_ACTIVE); | ||
382 | - dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE__SS); | ||
383 | + dc->ss_active = EX_TBFLAG_ANY(tb_flags, SS_ACTIVE); | ||
384 | + dc->pstate_ss = EX_TBFLAG_ANY(tb_flags, PSTATE__SS); | ||
385 | dc->is_ldex = false; | ||
386 | - dc->debug_target_el = FIELD_EX32(tb_flags, TBFLAG_ANY, DEBUG_TARGET_EL); | ||
387 | + dc->debug_target_el = EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); | ||
388 | |||
389 | /* Bound the number of insns to execute to those left on the page. */ | ||
390 | bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; | ||
391 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 60 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
392 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
393 | --- a/target/arm/translate.c | 62 | --- a/target/arm/translate.c |
394 | +++ b/target/arm/translate.c | 63 | +++ b/target/arm/translate.c |
395 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | 64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
396 | */ | 65 | uint32_t insn; |
397 | dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) && | 66 | bool is_16bit; |
398 | !arm_el_is_aa64(env, 3); | 67 | |
399 | - dc->thumb = FIELD_EX32(tb_flags, TBFLAG_AM32, THUMB); | 68 | + /* Misaligned thumb PC is architecturally impossible. */ |
400 | - dc->be_data = FIELD_EX32(tb_flags, TBFLAG_ANY, BE_DATA) ? MO_BE : MO_LE; | 69 | + assert((dc->base.pc_next & 1) == 0); |
401 | - condexec = FIELD_EX32(tb_flags, TBFLAG_AM32, CONDEXEC); | 70 | + |
402 | + dc->thumb = EX_TBFLAG_AM32(tb_flags, THUMB); | 71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
403 | + dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; | 72 | dc->base.pc_next = pc + 2; |
404 | + condexec = EX_TBFLAG_AM32(tb_flags, CONDEXEC); | 73 | return; |
405 | dc->condexec_mask = (condexec & 0xf) << 1; | ||
406 | dc->condexec_cond = condexec >> 4; | ||
407 | |||
408 | - core_mmu_idx = FIELD_EX32(tb_flags, TBFLAG_ANY, MMUIDX); | ||
409 | + core_mmu_idx = EX_TBFLAG_ANY(tb_flags, MMUIDX); | ||
410 | dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx); | ||
411 | dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); | ||
412 | #if !defined(CONFIG_USER_ONLY) | ||
413 | dc->user = (dc->current_el == 0); | ||
414 | #endif | ||
415 | - dc->fp_excp_el = FIELD_EX32(tb_flags, TBFLAG_ANY, FPEXC_EL); | ||
416 | + dc->fp_excp_el = EX_TBFLAG_ANY(tb_flags, FPEXC_EL); | ||
417 | |||
418 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
419 | dc->vfp_enabled = 1; | ||
420 | dc->be_data = MO_TE; | ||
421 | - dc->v7m_handler_mode = FIELD_EX32(tb_flags, TBFLAG_M32, HANDLER); | ||
422 | + dc->v7m_handler_mode = EX_TBFLAG_M32(tb_flags, HANDLER); | ||
423 | dc->v8m_secure = arm_feature(env, ARM_FEATURE_M_SECURITY) && | ||
424 | regime_is_secure(env, dc->mmu_idx); | ||
425 | - dc->v8m_stackcheck = FIELD_EX32(tb_flags, TBFLAG_M32, STACKCHECK); | ||
426 | - dc->v8m_fpccr_s_wrong = | ||
427 | - FIELD_EX32(tb_flags, TBFLAG_M32, FPCCR_S_WRONG); | ||
428 | + dc->v8m_stackcheck = EX_TBFLAG_M32(tb_flags, STACKCHECK); | ||
429 | + dc->v8m_fpccr_s_wrong = EX_TBFLAG_M32(tb_flags, FPCCR_S_WRONG); | ||
430 | dc->v7m_new_fp_ctxt_needed = | ||
431 | - FIELD_EX32(tb_flags, TBFLAG_M32, NEW_FP_CTXT_NEEDED); | ||
432 | - dc->v7m_lspact = FIELD_EX32(tb_flags, TBFLAG_M32, LSPACT); | ||
433 | + EX_TBFLAG_M32(tb_flags, NEW_FP_CTXT_NEEDED); | ||
434 | + dc->v7m_lspact = EX_TBFLAG_M32(tb_flags, LSPACT); | ||
435 | } else { | ||
436 | - dc->be_data = | ||
437 | - FIELD_EX32(tb_flags, TBFLAG_ANY, BE_DATA) ? MO_BE : MO_LE; | ||
438 | - dc->debug_target_el = | ||
439 | - FIELD_EX32(tb_flags, TBFLAG_ANY, DEBUG_TARGET_EL); | ||
440 | - dc->sctlr_b = FIELD_EX32(tb_flags, TBFLAG_A32, SCTLR__B); | ||
441 | - dc->hstr_active = FIELD_EX32(tb_flags, TBFLAG_A32, HSTR_ACTIVE); | ||
442 | - dc->ns = FIELD_EX32(tb_flags, TBFLAG_A32, NS); | ||
443 | - dc->vfp_enabled = FIELD_EX32(tb_flags, TBFLAG_A32, VFPEN); | ||
444 | + dc->debug_target_el = EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); | ||
445 | + dc->sctlr_b = EX_TBFLAG_A32(tb_flags, SCTLR__B); | ||
446 | + dc->hstr_active = EX_TBFLAG_A32(tb_flags, HSTR_ACTIVE); | ||
447 | + dc->ns = EX_TBFLAG_A32(tb_flags, NS); | ||
448 | + dc->vfp_enabled = EX_TBFLAG_A32(tb_flags, VFPEN); | ||
449 | if (arm_feature(env, ARM_FEATURE_XSCALE)) { | ||
450 | - dc->c15_cpar = FIELD_EX32(tb_flags, TBFLAG_A32, XSCALE_CPAR); | ||
451 | + dc->c15_cpar = EX_TBFLAG_A32(tb_flags, XSCALE_CPAR); | ||
452 | } else { | ||
453 | - dc->vec_len = FIELD_EX32(tb_flags, TBFLAG_A32, VECLEN); | ||
454 | - dc->vec_stride = FIELD_EX32(tb_flags, TBFLAG_A32, VECSTRIDE); | ||
455 | + dc->vec_len = EX_TBFLAG_A32(tb_flags, VECLEN); | ||
456 | + dc->vec_stride = EX_TBFLAG_A32(tb_flags, VECSTRIDE); | ||
457 | } | ||
458 | } | ||
459 | dc->cp_regs = cpu->cp_regs; | ||
460 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
461 | * emit code to generate a software step exception | ||
462 | * end the TB | ||
463 | */ | ||
464 | - dc->ss_active = FIELD_EX32(tb_flags, TBFLAG_ANY, SS_ACTIVE); | ||
465 | - dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE__SS); | ||
466 | + dc->ss_active = EX_TBFLAG_ANY(tb_flags, SS_ACTIVE); | ||
467 | + dc->pstate_ss = EX_TBFLAG_ANY(tb_flags, PSTATE__SS); | ||
468 | dc->is_ldex = false; | ||
469 | |||
470 | dc->page_start = dc->base.pc_first & TARGET_PAGE_MASK; | ||
471 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int max_insns) | ||
472 | DisasContext dc = { }; | ||
473 | const TranslatorOps *ops = &arm_translator_ops; | ||
474 | |||
475 | - if (FIELD_EX32(tb->flags, TBFLAG_AM32, THUMB)) { | ||
476 | + if (EX_TBFLAG_AM32(tb->flags, THUMB)) { | ||
477 | ops = &thumb_translator_ops; | ||
478 | } | ||
479 | #ifdef TARGET_AARCH64 | ||
480 | - if (FIELD_EX32(tb->flags, TBFLAG_ANY, AARCH64_STATE)) { | ||
481 | + if (EX_TBFLAG_ANY(tb->flags, AARCH64_STATE)) { | ||
482 | ops = &aarch64_translator_ops; | ||
483 | } | ||
484 | #endif | ||
485 | -- | 74 | -- |
486 | 2.20.1 | 75 | 2.25.1 |
487 | 76 | ||
488 | 77 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This is the only caller. Adjust some commentary to talk | 3 | Both single-step and pc alignment faults have priority over |
4 | about SCTLR_B instead of the vanishing function. | 4 | breakpoint exceptions. |
5 | 5 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20210419202257.161730-13-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 9 | --- |
11 | target/arm/translate.c | 37 ++++++++++++++++--------------------- | 10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ |
12 | 1 file changed, 16 insertions(+), 21 deletions(-) | 11 | 1 file changed, 23 insertions(+) |
13 | 12 | ||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 13 | diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate.c | 15 | --- a/target/arm/debug_helper.c |
17 | +++ b/target/arm/translate.c | 16 | +++ b/target/arm/debug_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | 17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
19 | gen_aa32_st_i32(s, val, a32, index, OPC); \ | 18 | { |
19 | ARMCPU *cpu = ARM_CPU(cs); | ||
20 | CPUARMState *env = &cpu->env; | ||
21 | + target_ulong pc; | ||
22 | int n; | ||
23 | |||
24 | /* | ||
25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) | ||
26 | return false; | ||
20 | } | 27 | } |
21 | 28 | ||
22 | -static inline void gen_aa32_frob64(DisasContext *s, TCGv_i64 val) | 29 | + /* |
23 | -{ | 30 | + * Single-step exceptions have priority over breakpoint exceptions. |
24 | - /* Not needed for user-mode BE32, where we use MO_BE instead. */ | 31 | + * If single-step state is active-pending, suppress the bp. |
25 | - if (!IS_USER_ONLY && s->sctlr_b) { | 32 | + */ |
26 | - tcg_gen_rotri_i64(val, val, 32); | 33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { |
27 | - } | 34 | + return false; |
28 | -} | ||
29 | - | ||
30 | static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32, | ||
31 | int index, MemOp opc) | ||
32 | { | ||
33 | TCGv addr = gen_aa32_addr(s, a32, opc); | ||
34 | tcg_gen_qemu_ld_i64(val, addr, index, opc); | ||
35 | - gen_aa32_frob64(s, val); | ||
36 | + | ||
37 | + /* Not needed for user-mode BE32, where we use MO_BE instead. */ | ||
38 | + if (!IS_USER_ONLY && s->sctlr_b) { | ||
39 | + tcg_gen_rotri_i64(val, val, 32); | ||
40 | + } | 35 | + } |
41 | + | 36 | + |
42 | tcg_temp_free(addr); | 37 | + /* |
43 | } | 38 | + * PC alignment faults have priority over breakpoint exceptions. |
44 | 39 | + */ | |
45 | @@ -XXX,XX +XXX,XX @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2, | 40 | + pc = is_a64(env) ? env->pc : env->regs[15]; |
46 | TCGv_i32 tmp2 = tcg_temp_new_i32(); | 41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { |
47 | TCGv_i64 t64 = tcg_temp_new_i64(); | 42 | + return false; |
48 | 43 | + } | |
49 | - /* For AArch32, architecturally the 32-bit word at the lowest | ||
50 | + /* | ||
51 | + * For AArch32, architecturally the 32-bit word at the lowest | ||
52 | * address is always Rt and the one at addr+4 is Rt2, even if | ||
53 | * the CPU is big-endian. That means we don't want to do a | ||
54 | - * gen_aa32_ld_i64(), which invokes gen_aa32_frob64() as if | ||
55 | - * for an architecturally 64-bit access, but instead do a | ||
56 | - * 64-bit access using MO_BE if appropriate and then split | ||
57 | - * the two halves. | ||
58 | - * This only makes a difference for BE32 user-mode, where | ||
59 | - * frob64() must not flip the two halves of the 64-bit data | ||
60 | - * but this code must treat BE32 user-mode like BE32 system. | ||
61 | + * gen_aa32_ld_i64(), which checks SCTLR_B as if for an | ||
62 | + * architecturally 64-bit access, but instead do a 64-bit access | ||
63 | + * using MO_BE if appropriate and then split the two halves. | ||
64 | */ | ||
65 | TCGv taddr = gen_aa32_addr(s, addr, opc); | ||
66 | |||
67 | @@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, | ||
68 | TCGv_i64 n64 = tcg_temp_new_i64(); | ||
69 | |||
70 | t2 = load_reg(s, rt2); | ||
71 | - /* For AArch32, architecturally the 32-bit word at the lowest | ||
72 | + | 44 | + |
73 | + /* | 45 | + /* |
74 | + * For AArch32, architecturally the 32-bit word at the lowest | 46 | + * Instruction aborts have priority over breakpoint exceptions. |
75 | * address is always Rt and the one at addr+4 is Rt2, even if | 47 | + * TODO: We would need to look up the page for PC and verify that |
76 | * the CPU is big-endian. Since we're going to treat this as a | 48 | + * it is present and executable. |
77 | * single 64-bit BE store, we need to put the two halves in the | 49 | + */ |
78 | * opposite order for BE to LE, so that they end up in the right | 50 | + |
79 | - * places. | 51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { |
80 | - * We don't want gen_aa32_frob64() because that does the wrong | 52 | if (bp_wp_matches(cpu, n, false)) { |
81 | - * thing for BE32 usermode. | 53 | return true; |
82 | + * places. We don't want gen_aa32_st_i64, because that checks | ||
83 | + * SCTLR_B as if for an architectural 64-bit access. | ||
84 | */ | ||
85 | if (s->be_data == MO_BE) { | ||
86 | tcg_gen_concat_i32_i64(n64, t2, t1); | ||
87 | -- | 54 | -- |
88 | 2.20.1 | 55 | 2.25.1 |
89 | 56 | ||
90 | 57 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Buglink: https://bugs.launchpad.net/bugs/1921948 | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210416183106.1516563-5-richard.henderson@linaro.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 6 | --- |
9 | tests/tcg/aarch64/mte-5.c | 44 +++++++++++++++++++++++++++++++ | 7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ |
10 | tests/tcg/aarch64/Makefile.target | 2 +- | 8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ |
11 | 2 files changed, 45 insertions(+), 1 deletion(-) | 9 | tests/tcg/aarch64/Makefile.target | 4 +-- |
12 | create mode 100644 tests/tcg/aarch64/mte-5.c | 10 | tests/tcg/arm/Makefile.target | 4 +++ |
11 | 4 files changed, 89 insertions(+), 2 deletions(-) | ||
12 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
13 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
13 | 14 | ||
14 | diff --git a/tests/tcg/aarch64/mte-5.c b/tests/tcg/aarch64/mte-5.c | 15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c |
15 | new file mode 100644 | 16 | new file mode 100644 |
16 | index XXXXXXX..XXXXXXX | 17 | index XXXXXXX..XXXXXXX |
17 | --- /dev/null | 18 | --- /dev/null |
18 | +++ b/tests/tcg/aarch64/mte-5.c | 19 | +++ b/tests/tcg/aarch64/pcalign-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
20 | +/* | 21 | +/* Test PC misalignment exception */ |
21 | + * Memory tagging, faulting unaligned access. | ||
22 | + * | ||
23 | + * Copyright (c) 2021 Linaro Ltd | ||
24 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
25 | + */ | ||
26 | + | 22 | + |
27 | +#include "mte.h" | 23 | +#include <assert.h> |
24 | +#include <signal.h> | ||
25 | +#include <stdlib.h> | ||
26 | +#include <stdio.h> | ||
28 | + | 27 | + |
29 | +void pass(int sig, siginfo_t *info, void *uc) | 28 | +static void *expected; |
29 | + | ||
30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
30 | +{ | 31 | +{ |
31 | + assert(info->si_code == SEGV_MTESERR); | 32 | + assert(info->si_code == BUS_ADRALN); |
32 | + exit(0); | 33 | + assert(info->si_addr == expected); |
34 | + exit(EXIT_SUCCESS); | ||
33 | +} | 35 | +} |
34 | + | 36 | + |
35 | +int main(int ac, char **av) | 37 | +int main() |
36 | +{ | 38 | +{ |
37 | + struct sigaction sa; | 39 | + void *tmp; |
38 | + void *p0, *p1, *p2; | ||
39 | + long excl = 1; | ||
40 | + | 40 | + |
41 | + enable_mte(PR_MTE_TCF_SYNC); | 41 | + struct sigaction sa = { |
42 | + p0 = alloc_mte_mem(sizeof(*p0)); | 42 | + .sa_sigaction = sigbus, |
43 | + .sa_flags = SA_SIGINFO | ||
44 | + }; | ||
43 | + | 45 | + |
44 | + /* Create two differently tagged pointers. */ | 46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
45 | + asm("irg %0,%1,%2" : "=r"(p1) : "r"(p0), "r"(excl)); | 47 | + perror("sigaction"); |
46 | + asm("gmi %0,%1,%0" : "+r"(excl) : "r" (p1)); | 48 | + return EXIT_FAILURE; |
47 | + assert(excl != 1); | 49 | + } |
48 | + asm("irg %0,%1,%2" : "=r"(p2) : "r"(p0), "r"(excl)); | ||
49 | + assert(p1 != p2); | ||
50 | + | 50 | + |
51 | + memset(&sa, 0, sizeof(sa)); | 51 | + asm volatile("adr %0, 1f + 1\n\t" |
52 | + sa.sa_sigaction = pass; | 52 | + "str %0, %1\n\t" |
53 | + sa.sa_flags = SA_SIGINFO; | 53 | + "br %0\n" |
54 | + sigaction(SIGSEGV, &sa, NULL); | 54 | + "1:" |
55 | + : "=&r"(tmp), "=m"(expected)); | ||
56 | + abort(); | ||
57 | +} | ||
58 | diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/tests/tcg/arm/pcalign-a32.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* Test PC misalignment exception */ | ||
55 | + | 65 | + |
56 | + /* Store store two different tags in sequential granules. */ | 66 | +#ifdef __thumb__ |
57 | + asm("stg %0, [%0]" : : "r"(p1)); | 67 | +#error "This test must be compiled for ARM" |
58 | + asm("stg %0, [%0]" : : "r"(p2 + 16)); | 68 | +#endif |
59 | + | 69 | + |
60 | + /* Perform an unaligned load crossing the granules. */ | 70 | +#include <assert.h> |
61 | + asm volatile("ldr %0, [%1]" : "=r"(p0) : "r"(p1 + 12)); | 71 | +#include <signal.h> |
62 | + abort(); | 72 | +#include <stdlib.h> |
73 | +#include <stdio.h> | ||
74 | + | ||
75 | +static void *expected; | ||
76 | + | ||
77 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
78 | +{ | ||
79 | + assert(info->si_code == BUS_ADRALN); | ||
80 | + assert(info->si_addr == expected); | ||
81 | + exit(EXIT_SUCCESS); | ||
82 | +} | ||
83 | + | ||
84 | +int main() | ||
85 | +{ | ||
86 | + void *tmp; | ||
87 | + | ||
88 | + struct sigaction sa = { | ||
89 | + .sa_sigaction = sigbus, | ||
90 | + .sa_flags = SA_SIGINFO | ||
91 | + }; | ||
92 | + | ||
93 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { | ||
94 | + perror("sigaction"); | ||
95 | + return EXIT_FAILURE; | ||
96 | + } | ||
97 | + | ||
98 | + asm volatile("adr %0, 1f + 2\n\t" | ||
99 | + "str %0, %1\n\t" | ||
100 | + "bx %0\n" | ||
101 | + "1:" | ||
102 | + : "=&r"(tmp), "=m"(expected)); | ||
103 | + | ||
104 | + /* | ||
105 | + * From v8, it is CONSTRAINED UNPREDICTABLE whether BXWritePC aligns | ||
106 | + * the address or not. If so, we can legitimately fall through. | ||
107 | + */ | ||
108 | + return EXIT_SUCCESS; | ||
63 | +} | 109 | +} |
64 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | 110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target |
65 | index XXXXXXX..XXXXXXX 100644 | 111 | index XXXXXXX..XXXXXXX 100644 |
66 | --- a/tests/tcg/aarch64/Makefile.target | 112 | --- a/tests/tcg/aarch64/Makefile.target |
67 | +++ b/tests/tcg/aarch64/Makefile.target | 113 | +++ b/tests/tcg/aarch64/Makefile.target |
68 | @@ -XXX,XX +XXX,XX @@ AARCH64_TESTS += bti-2 | 114 | @@ -XXX,XX +XXX,XX @@ VPATH += $(ARM_SRC) |
69 | 115 | AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 | |
70 | # MTE Tests | 116 | VPATH += $(AARCH64_SRC) |
71 | ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_MTE),) | 117 | |
72 | -AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-6 | 118 | -# Float-convert Tests |
73 | +AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 | 119 | -AARCH64_TESTS=fcvt |
74 | mte-%: CFLAGS += -march=armv8.5-a+memtag | 120 | +# Base architecture tests |
75 | endif | 121 | +AARCH64_TESTS=fcvt pcalign-a64 |
76 | 122 | ||
123 | fcvt: LDFLAGS+=-lm | ||
124 | |||
125 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/tests/tcg/arm/Makefile.target | ||
128 | +++ b/tests/tcg/arm/Makefile.target | ||
129 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
130 | $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") | ||
131 | $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) | ||
132 | |||
133 | +# PC alignment test | ||
134 | +ARM_TESTS += pcalign-a32 | ||
135 | +pcalign-a32: CFLAGS+=-marm | ||
136 | + | ||
137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) | ||
138 | |||
139 | # Semihosting smoke test for linux-user | ||
77 | -- | 140 | -- |
78 | 2.20.1 | 141 | 2.25.1 |
79 | 142 | ||
80 | 143 | diff view generated by jsdifflib |
1 | Currently the gpex PCI controller implements no special behaviour for | 1 | In the SSE decode function gen_sse(), we combine a byte |
---|---|---|---|
2 | guest accesses to areas of the PIO and MMIO where it has not mapped | 2 | 'b' and a value 'b1' which can be [0..3], and switch on them: |
3 | any PCI devices, which means that for Arm you end up with a CPU | 3 | b |= (b1 << 8); |
4 | exception due to a data abort. | 4 | switch (b) { |
5 | ... | ||
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
5 | 11 | ||
6 | Most host OSes expect "like an x86 PC" behaviour, where bad accesses | 12 | In three cases inside this switch, we were then also checking for |
7 | like this return -1 for reads and ignore writes. In the interests of | 13 | "if (b1 >= 2) { goto unknown_op; }". |
8 | not being surprising, make host CPU accesses to these windows behave | 14 | However, this can never happen, because the 'case' values in each place |
9 | as -1/discard where there's no mapped PCI device. | 15 | are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3) |
16 | cases to the default already. | ||
10 | 17 | ||
11 | The old behaviour generally didn't cause any problems, because | 18 | This check was added in commit c045af25a52e9 in 2010; the added code |
12 | almost always the guest OS will map the PCI devices and then only | 19 | was unnecessary then as well, and was apparently intended only to |
13 | access where it has mapped them. One corner case where you will see | 20 | ensure that we never accidentally ended up indexing off the end |
14 | this kind of access is if Linux attempts to probe legacy ISA | 21 | of an sse_op_table with only 2 entries as a result of future bugs |
15 | devices via a PIO window access. So far the only case where we've | 22 | in the decode logic. |
16 | seen this has been via the syzkaller fuzzer. | ||
17 | 23 | ||
18 | Reported-by: Dmitry Vyukov <dvyukov@google.com> | 24 | Change the checks to assert() instead, and make sure they're always |
25 | immediately before the array access they are protecting. | ||
26 | |||
27 | Fixes: Coverity CID 1460207 | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
21 | Acked-by: Michael S. Tsirkin <mst@redhat.com> | ||
22 | Message-id: 20210325163315.27724-1-peter.maydell@linaro.org | ||
23 | Fixes: https://bugs.launchpad.net/qemu/+bug/1918917 | ||
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
25 | --- | 30 | --- |
26 | include/hw/pci-host/gpex.h | 4 +++ | 31 | target/i386/tcg/translate.c | 12 +++--------- |
27 | hw/core/machine.c | 4 ++- | 32 | 1 file changed, 3 insertions(+), 9 deletions(-) |
28 | hw/pci-host/gpex.c | 56 ++++++++++++++++++++++++++++++++++++-- | ||
29 | 3 files changed, 60 insertions(+), 4 deletions(-) | ||
30 | 33 | ||
31 | diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h | 34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c |
32 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/include/hw/pci-host/gpex.h | 36 | --- a/target/i386/tcg/translate.c |
34 | +++ b/include/hw/pci-host/gpex.h | 37 | +++ b/target/i386/tcg/translate.c |
35 | @@ -XXX,XX +XXX,XX @@ struct GPEXHost { | 38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
36 | 39 | case 0x171: /* shift xmm, im */ | |
37 | MemoryRegion io_ioport; | 40 | case 0x172: |
38 | MemoryRegion io_mmio; | 41 | case 0x173: |
39 | + MemoryRegion io_ioport_window; | 42 | - if (b1 >= 2) { |
40 | + MemoryRegion io_mmio_window; | 43 | - goto unknown_op; |
41 | qemu_irq irq[GPEX_NUM_IRQS]; | 44 | - } |
42 | int irq_num[GPEX_NUM_IRQS]; | 45 | val = x86_ldub_code(env, s); |
43 | + | 46 | if (is_xmm) { |
44 | + bool allow_unmapped_accesses; | 47 | tcg_gen_movi_tl(s->T0, val); |
45 | }; | 48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
46 | 49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); | |
47 | struct GPEXConfig { | 50 | op1_offset = offsetof(CPUX86State,mmx_t0); |
48 | diff --git a/hw/core/machine.c b/hw/core/machine.c | 51 | } |
49 | index XXXXXXX..XXXXXXX 100644 | 52 | + assert(b1 < 2); |
50 | --- a/hw/core/machine.c | 53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + |
51 | +++ b/hw/core/machine.c | 54 | (((modrm >> 3)) & 7)][b1]; |
52 | @@ -XXX,XX +XXX,XX @@ | 55 | if (!sse_fn_epp) { |
53 | #include "hw/virtio/virtio.h" | 56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
54 | #include "hw/virtio/virtio-pci.h" | 57 | rm = modrm & 7; |
55 | 58 | reg = ((modrm >> 3) & 7) | REX_R(s); | |
56 | -GlobalProperty hw_compat_6_0[] = {}; | 59 | mod = (modrm >> 6) & 3; |
57 | +GlobalProperty hw_compat_6_0[] = { | 60 | - if (b1 >= 2) { |
58 | + { "gpex-pcihost", "allow-unmapped-accesses", "false" }, | 61 | - goto unknown_op; |
59 | +}; | 62 | - } |
60 | const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0); | 63 | |
61 | 64 | + assert(b1 < 2); | |
62 | GlobalProperty hw_compat_5_2[] = { | 65 | sse_fn_epp = sse_op_table6[b].op[b1]; |
63 | diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c | 66 | if (!sse_fn_epp) { |
64 | index XXXXXXX..XXXXXXX 100644 | 67 | goto unknown_op; |
65 | --- a/hw/pci-host/gpex.c | 68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
66 | +++ b/hw/pci-host/gpex.c | 69 | rm = modrm & 7; |
67 | @@ -XXX,XX +XXX,XX @@ static void gpex_host_realize(DeviceState *dev, Error **errp) | 70 | reg = ((modrm >> 3) & 7) | REX_R(s); |
68 | int i; | 71 | mod = (modrm >> 6) & 3; |
69 | 72 | - if (b1 >= 2) { | |
70 | pcie_host_mmcfg_init(pex, PCIE_MMCFG_SIZE_MAX); | 73 | - goto unknown_op; |
71 | + sysbus_init_mmio(sbd, &pex->mmio); | 74 | - } |
72 | + | 75 | |
73 | + /* | 76 | + assert(b1 < 2); |
74 | + * Note that the MemoryRegions io_mmio and io_ioport that we pass | 77 | sse_fn_eppi = sse_op_table7[b].op[b1]; |
75 | + * to pci_register_root_bus() are not the same as the | 78 | if (!sse_fn_eppi) { |
76 | + * MemoryRegions io_mmio_window and io_ioport_window that we | 79 | goto unknown_op; |
77 | + * expose as SysBus MRs. The difference is in the behaviour of | ||
78 | + * accesses to addresses where no PCI device has been mapped. | ||
79 | + * | ||
80 | + * io_mmio and io_ioport are the underlying PCI view of the PCI | ||
81 | + * address space, and when a PCI device does a bus master access | ||
82 | + * to a bad address this is reported back to it as a transaction | ||
83 | + * failure. | ||
84 | + * | ||
85 | + * io_mmio_window and io_ioport_window implement "unmapped | ||
86 | + * addresses read as -1 and ignore writes"; this is traditional | ||
87 | + * x86 PC behaviour, which is not mandated by the PCI spec proper | ||
88 | + * but expected by much PCI-using guest software, including Linux. | ||
89 | + * | ||
90 | + * In the interests of not being unnecessarily surprising, we | ||
91 | + * implement it in the gpex PCI host controller, by providing the | ||
92 | + * _window MRs, which are containers with io ops that implement | ||
93 | + * the 'background' behaviour and which hold the real PCI MRs as | ||
94 | + * subregions. | ||
95 | + */ | ||
96 | memory_region_init(&s->io_mmio, OBJECT(s), "gpex_mmio", UINT64_MAX); | ||
97 | memory_region_init(&s->io_ioport, OBJECT(s), "gpex_ioport", 64 * 1024); | ||
98 | |||
99 | - sysbus_init_mmio(sbd, &pex->mmio); | ||
100 | - sysbus_init_mmio(sbd, &s->io_mmio); | ||
101 | - sysbus_init_mmio(sbd, &s->io_ioport); | ||
102 | + if (s->allow_unmapped_accesses) { | ||
103 | + memory_region_init_io(&s->io_mmio_window, OBJECT(s), | ||
104 | + &unassigned_io_ops, OBJECT(s), | ||
105 | + "gpex_mmio_window", UINT64_MAX); | ||
106 | + memory_region_init_io(&s->io_ioport_window, OBJECT(s), | ||
107 | + &unassigned_io_ops, OBJECT(s), | ||
108 | + "gpex_ioport_window", 64 * 1024); | ||
109 | + | ||
110 | + memory_region_add_subregion(&s->io_mmio_window, 0, &s->io_mmio); | ||
111 | + memory_region_add_subregion(&s->io_ioport_window, 0, &s->io_ioport); | ||
112 | + sysbus_init_mmio(sbd, &s->io_mmio_window); | ||
113 | + sysbus_init_mmio(sbd, &s->io_ioport_window); | ||
114 | + } else { | ||
115 | + sysbus_init_mmio(sbd, &s->io_mmio); | ||
116 | + sysbus_init_mmio(sbd, &s->io_ioport); | ||
117 | + } | ||
118 | + | ||
119 | for (i = 0; i < GPEX_NUM_IRQS; i++) { | ||
120 | sysbus_init_irq(sbd, &s->irq[i]); | ||
121 | s->irq_num[i] = -1; | ||
122 | @@ -XXX,XX +XXX,XX @@ static const char *gpex_host_root_bus_path(PCIHostState *host_bridge, | ||
123 | return "0000:00"; | ||
124 | } | ||
125 | |||
126 | +static Property gpex_host_properties[] = { | ||
127 | + /* | ||
128 | + * Permit CPU accesses to unmapped areas of the PIO and MMIO windows | ||
129 | + * (discarding writes and returning -1 for reads) rather than aborting. | ||
130 | + */ | ||
131 | + DEFINE_PROP_BOOL("allow-unmapped-accesses", GPEXHost, | ||
132 | + allow_unmapped_accesses, true), | ||
133 | + DEFINE_PROP_END_OF_LIST(), | ||
134 | +}; | ||
135 | + | ||
136 | static void gpex_host_class_init(ObjectClass *klass, void *data) | ||
137 | { | ||
138 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
139 | @@ -XXX,XX +XXX,XX @@ static void gpex_host_class_init(ObjectClass *klass, void *data) | ||
140 | dc->realize = gpex_host_realize; | ||
141 | set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); | ||
142 | dc->fw_name = "pci"; | ||
143 | + device_class_set_props(dc, gpex_host_properties); | ||
144 | } | ||
145 | |||
146 | static void gpex_host_initfn(Object *obj) | ||
147 | -- | 80 | -- |
148 | 2.20.1 | 81 | 2.25.1 |
149 | 82 | ||
150 | 83 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | ||
3 | the start of it). | ||
2 | 4 | ||
3 | For consistency with the mte_check1 + mte_checkN merge | 5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. |
4 | to mte_check, rename the probe function as well. | 6 | In fact, the include is not required at all, so we can just drop it |
7 | from both files. | ||
5 | 8 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210416183106.1516563-8-richard.henderson@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: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | target/arm/internals.h | 2 +- | 14 | include/hw/i386/microvm.h | 1 - |
12 | target/arm/mte_helper.c | 6 +++--- | 15 | include/hw/i386/x86.h | 1 - |
13 | target/arm/sve_helper.c | 6 +++--- | 16 | 2 files changed, 2 deletions(-) |
14 | 3 files changed, 7 insertions(+), 7 deletions(-) | ||
15 | 17 | ||
16 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h |
17 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/internals.h | 20 | --- a/include/hw/i386/microvm.h |
19 | +++ b/target/arm/internals.h | 21 | +++ b/include/hw/i386/microvm.h |
20 | @@ -XXX,XX +XXX,XX @@ FIELD(MTEDESC, TCMA, 6, 2) | 22 | @@ -XXX,XX +XXX,XX @@ |
21 | FIELD(MTEDESC, WRITE, 8, 1) | 23 | #ifndef HW_I386_MICROVM_H |
22 | FIELD(MTEDESC, SIZEM1, 9, SIMD_DATA_BITS - 9) /* size - 1 */ | 24 | #define HW_I386_MICROVM_H |
23 | 25 | ||
24 | -bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr); | 26 | -#include "qemu-common.h" |
25 | +bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr); | 27 | #include "exec/hwaddr.h" |
26 | uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra); | 28 | #include "qemu/notify.h" |
27 | 29 | ||
28 | static inline int allocation_tag_from_addr(uint64_t ptr) | 30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h |
29 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/target/arm/mte_helper.c | 32 | --- a/include/hw/i386/x86.h |
32 | +++ b/target/arm/mte_helper.c | 33 | +++ b/include/hw/i386/x86.h |
33 | @@ -XXX,XX +XXX,XX @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, | 34 | @@ -XXX,XX +XXX,XX @@ |
34 | * exception for inaccessible pages, and resolves the virtual address | 35 | #ifndef HW_I386_X86_H |
35 | * into the softmmu tlb. | 36 | #define HW_I386_X86_H |
36 | * | 37 | |
37 | - * When RA == 0, this is for mte_probe1. The page is expected to be | 38 | -#include "qemu-common.h" |
38 | + * When RA == 0, this is for mte_probe. The page is expected to be | 39 | #include "exec/hwaddr.h" |
39 | * valid. Indicate to probe_access_flags no-fault, then assert that | 40 | #include "qemu/notify.h" |
40 | * we received a valid page. | ||
41 | */ | ||
42 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(mte_check)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | - * No-fault version of mte_check1, to be used by SVE for MemSingleNF. | ||
47 | + * No-fault version of mte_check, to be used by SVE for MemSingleNF. | ||
48 | * Returns false if the access is Checked and the check failed. This | ||
49 | * is only intended to probe the tag -- the validity of the page must | ||
50 | * be checked beforehand. | ||
51 | */ | ||
52 | -bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
53 | +bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
54 | { | ||
55 | uint64_t fault; | ||
56 | int ret = mte_probe_int(env, desc, ptr, 0, &fault); | ||
57 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/target/arm/sve_helper.c | ||
60 | +++ b/target/arm/sve_helper.c | ||
61 | @@ -XXX,XX +XXX,XX @@ void sve_ldnfff1_r(CPUARMState *env, void *vg, const target_ulong addr, | ||
62 | /* Watchpoint hit, see below. */ | ||
63 | goto do_fault; | ||
64 | } | ||
65 | - if (mtedesc && !mte_probe1(env, mtedesc, addr + mem_off)) { | ||
66 | + if (mtedesc && !mte_probe(env, mtedesc, addr + mem_off)) { | ||
67 | goto do_fault; | ||
68 | } | ||
69 | /* | ||
70 | @@ -XXX,XX +XXX,XX @@ void sve_ldnfff1_r(CPUARMState *env, void *vg, const target_ulong addr, | ||
71 | & BP_MEM_READ)) { | ||
72 | goto do_fault; | ||
73 | } | ||
74 | - if (mtedesc && !mte_probe1(env, mtedesc, addr + mem_off)) { | ||
75 | + if (mtedesc && !mte_probe(env, mtedesc, addr + mem_off)) { | ||
76 | goto do_fault; | ||
77 | } | ||
78 | host_fn(vd, reg_off, host + mem_off); | ||
79 | @@ -XXX,XX +XXX,XX @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, | ||
80 | } | ||
81 | if (mtedesc && | ||
82 | arm_tlb_mte_tagged(&info.attrs) && | ||
83 | - !mte_probe1(env, mtedesc, addr)) { | ||
84 | + !mte_probe(env, mtedesc, addr)) { | ||
85 | goto fault; | ||
86 | } | ||
87 | 41 | ||
88 | -- | 42 | -- |
89 | 2.20.1 | 43 | 2.25.1 |
90 | 44 | ||
91 | 45 | diff view generated by jsdifflib |
1 | The Arm ARM specifies that for Thumb encodings of the various plain | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | store insns, if the Rn field is 1111 then we must UNDEF. This is | 2 | other header files, only from .c files (as documented in a comment at |
3 | different from the Arm encodings, where this case is either | 3 | the start of it). |
4 | UNPREDICTABLE or has well-defined behaviour. The exclusive stores, | ||
5 | store-release and STRD do not have this UNDEF case for any encoding. | ||
6 | 4 | ||
7 | Enforce the UNDEF for this case in the Thumb plain store insns. | 5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for |
6 | the declaration of cpu_exec_step_atomic(). | ||
8 | 7 | ||
9 | Fixes: https://bugs.launchpad.net/qemu/+bug/1922887 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20210408162402.5822-1-peter.maydell@linaro.org | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
13 | --- | 13 | --- |
14 | target/arm/translate.c | 16 ++++++++++++++++ | 14 | target/hexagon/cpu.h | 1 - |
15 | 1 file changed, 16 insertions(+) | 15 | linux-user/hexagon/cpu_loop.c | 1 + |
16 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
16 | 17 | ||
17 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/translate.c | 20 | --- a/target/hexagon/cpu.h |
20 | +++ b/target/arm/translate.c | 21 | +++ b/target/hexagon/cpu.h |
21 | @@ -XXX,XX +XXX,XX @@ static bool op_store_rr(DisasContext *s, arg_ldst_rr *a, | 22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; |
22 | ISSInfo issinfo = make_issinfo(s, a->rt, a->p, a->w) | ISSIsWrite; | 23 | |
23 | TCGv_i32 addr, tmp; | 24 | #include "fpu/softfloat-types.h" |
24 | 25 | ||
25 | + /* | 26 | -#include "qemu-common.h" |
26 | + * In Thumb encodings of stores Rn=1111 is UNDEF; for Arm it | 27 | #include "exec/cpu-defs.h" |
27 | + * is either UNPREDICTABLE or has defined behaviour | 28 | #include "hex_regs.h" |
28 | + */ | 29 | #include "mmvec/mmvec.h" |
29 | + if (s->thumb && a->rn == 15) { | 30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c |
30 | + return false; | 31 | index XXXXXXX..XXXXXXX 100644 |
31 | + } | 32 | --- a/linux-user/hexagon/cpu_loop.c |
32 | + | 33 | +++ b/linux-user/hexagon/cpu_loop.c |
33 | addr = op_addr_rr_pre(s, a); | 34 | @@ -XXX,XX +XXX,XX @@ |
34 | 35 | */ | |
35 | tmp = load_reg(s, a->rt); | 36 | |
36 | @@ -XXX,XX +XXX,XX @@ static bool op_store_ri(DisasContext *s, arg_ldst_ri *a, | 37 | #include "qemu/osdep.h" |
37 | ISSInfo issinfo = make_issinfo(s, a->rt, a->p, a->w) | ISSIsWrite; | 38 | +#include "qemu-common.h" |
38 | TCGv_i32 addr, tmp; | 39 | #include "qemu.h" |
39 | 40 | #include "user-internals.h" | |
40 | + /* | 41 | #include "cpu_loop-common.h" |
41 | + * In Thumb encodings of stores Rn=1111 is UNDEF; for Arm it | ||
42 | + * is either UNPREDICTABLE or has defined behaviour | ||
43 | + */ | ||
44 | + if (s->thumb && a->rn == 15) { | ||
45 | + return false; | ||
46 | + } | ||
47 | + | ||
48 | addr = op_addr_ri_pre(s, a); | ||
49 | |||
50 | tmp = load_reg(s, a->rt); | ||
51 | -- | 42 | -- |
52 | 2.20.1 | 43 | 2.25.1 |
53 | 44 | ||
54 | 45 | diff view generated by jsdifflib |
1 | From: Kunkun Jiang <jiangkunkun@huawei.com> | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | other header files, only from .c files (as documented in a comment at | ||
3 | the start of it). | ||
2 | 4 | ||
3 | The driver can query some bits in SMMUv3 IDR5 to learn which | 5 | Nothing actually relies on target/rx/cpu.h including it, so we can |
4 | translation granules are supported. Arm recommends that SMMUv3 | 6 | just drop the include. |
5 | implementations support at least 4K and 64K granules. But in | ||
6 | the vSMMUv3, there seems to be no reason not to support 16K | ||
7 | translation granule. In addition, if 16K is not supported, | ||
8 | vSVA will failed to be enabled in the future for 16K guest | ||
9 | kernel. So it'd better to support it. | ||
10 | 7 | ||
11 | Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com> | ||
12 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
13 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 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 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
12 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
13 | Message-id: 20211129200510.1233037-4-peter.maydell@linaro.org | ||
15 | --- | 14 | --- |
16 | hw/arm/smmuv3.c | 6 ++++-- | 15 | target/rx/cpu.h | 1 - |
17 | 1 file changed, 4 insertions(+), 2 deletions(-) | 16 | 1 file changed, 1 deletion(-) |
18 | 17 | ||
19 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h |
20 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/smmuv3.c | 20 | --- a/target/rx/cpu.h |
22 | +++ b/hw/arm/smmuv3.c | 21 | +++ b/target/rx/cpu.h |
23 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_init_regs(SMMUv3State *s) | 22 | @@ -XXX,XX +XXX,XX @@ |
24 | s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 1); | 23 | #define RX_CPU_H |
25 | s->idr[3] = FIELD_DP32(s->idr[3], IDR3, HAD, 1); | 24 | |
26 | 25 | #include "qemu/bitops.h" | |
27 | - /* 4K and 64K granule support */ | 26 | -#include "qemu-common.h" |
28 | + /* 4K, 16K and 64K granule support */ | 27 | #include "hw/registerfields.h" |
29 | s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN4K, 1); | 28 | #include "cpu-qom.h" |
30 | + s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN16K, 1); | ||
31 | s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN64K, 1); | ||
32 | s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS); /* 44 bits */ | ||
33 | |||
34 | @@ -XXX,XX +XXX,XX @@ static int decode_cd(SMMUTransCfg *cfg, CD *cd, SMMUEventInfo *event) | ||
35 | |||
36 | tg = CD_TG(cd, i); | ||
37 | tt->granule_sz = tg2granule(tg, i); | ||
38 | - if ((tt->granule_sz != 12 && tt->granule_sz != 16) || CD_ENDI(cd)) { | ||
39 | + if ((tt->granule_sz != 12 && tt->granule_sz != 14 && | ||
40 | + tt->granule_sz != 16) || CD_ENDI(cd)) { | ||
41 | goto bad_cd; | ||
42 | } | ||
43 | 29 | ||
44 | -- | 30 | -- |
45 | 2.20.1 | 31 | 2.25.1 |
46 | 32 | ||
47 | 33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | We were incorrectly assuming that only the first byte of an MTE access | ||
4 | is checked against the tags. But per the ARM, unaligned accesses are | ||
5 | pre-decomposed into single-byte accesses. So by the time we reach the | ||
6 | actual MTE check in the ARM pseudocode, all accesses are aligned. | ||
7 | |||
8 | Therefore, the first failure is always either the first byte of the | ||
9 | access, or the first byte of the granule. | ||
10 | |||
11 | In addition, some of the arithmetic is off for last-first -> count. | ||
12 | This does not become directly visible until a later patch that passes | ||
13 | single bytes into this function, so ptr == ptr_last. | ||
14 | |||
15 | Buglink: https://bugs.launchpad.net/bugs/1921948 | ||
16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20210416183106.1516563-2-richard.henderson@linaro.org | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | [PMM: tweaked a comment] | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | --- | ||
22 | target/arm/mte_helper.c | 40 ++++++++++++++++++---------------------- | ||
23 | 1 file changed, 18 insertions(+), 22 deletions(-) | ||
24 | |||
25 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/target/arm/mte_helper.c | ||
28 | +++ b/target/arm/mte_helper.c | ||
29 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
30 | uint64_t ptr, uintptr_t ra) | ||
31 | { | ||
32 | int mmu_idx, ptr_tag, bit55; | ||
33 | - uint64_t ptr_last, ptr_end, prev_page, next_page; | ||
34 | - uint64_t tag_first, tag_end; | ||
35 | - uint64_t tag_byte_first, tag_byte_end; | ||
36 | - uint32_t esize, total, tag_count, tag_size, n, c; | ||
37 | + uint64_t ptr_last, prev_page, next_page; | ||
38 | + uint64_t tag_first, tag_last; | ||
39 | + uint64_t tag_byte_first, tag_byte_last; | ||
40 | + uint32_t total, tag_count, tag_size, n, c; | ||
41 | uint8_t *mem1, *mem2; | ||
42 | MMUAccessType type; | ||
43 | |||
44 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
45 | |||
46 | mmu_idx = FIELD_EX32(desc, MTEDESC, MIDX); | ||
47 | type = FIELD_EX32(desc, MTEDESC, WRITE) ? MMU_DATA_STORE : MMU_DATA_LOAD; | ||
48 | - esize = FIELD_EX32(desc, MTEDESC, ESIZE); | ||
49 | total = FIELD_EX32(desc, MTEDESC, TSIZE); | ||
50 | |||
51 | - /* Find the addr of the end of the access, and of the last element. */ | ||
52 | - ptr_end = ptr + total; | ||
53 | - ptr_last = ptr_end - esize; | ||
54 | + /* Find the addr of the end of the access */ | ||
55 | + ptr_last = ptr + total - 1; | ||
56 | |||
57 | /* Round the bounds to the tag granule, and compute the number of tags. */ | ||
58 | tag_first = QEMU_ALIGN_DOWN(ptr, TAG_GRANULE); | ||
59 | - tag_end = QEMU_ALIGN_UP(ptr_last, TAG_GRANULE); | ||
60 | - tag_count = (tag_end - tag_first) / TAG_GRANULE; | ||
61 | + tag_last = QEMU_ALIGN_DOWN(ptr_last, TAG_GRANULE); | ||
62 | + tag_count = ((tag_last - tag_first) / TAG_GRANULE) + 1; | ||
63 | |||
64 | /* Round the bounds to twice the tag granule, and compute the bytes. */ | ||
65 | tag_byte_first = QEMU_ALIGN_DOWN(ptr, 2 * TAG_GRANULE); | ||
66 | - tag_byte_end = QEMU_ALIGN_UP(ptr_last, 2 * TAG_GRANULE); | ||
67 | + tag_byte_last = QEMU_ALIGN_DOWN(ptr_last, 2 * TAG_GRANULE); | ||
68 | |||
69 | /* Locate the page boundaries. */ | ||
70 | prev_page = ptr & TARGET_PAGE_MASK; | ||
71 | next_page = prev_page + TARGET_PAGE_SIZE; | ||
72 | |||
73 | - if (likely(tag_end - prev_page <= TARGET_PAGE_SIZE)) { | ||
74 | + if (likely(tag_last - prev_page <= TARGET_PAGE_SIZE)) { | ||
75 | /* Memory access stays on one page. */ | ||
76 | - tag_size = (tag_byte_end - tag_byte_first) / (2 * TAG_GRANULE); | ||
77 | + tag_size = ((tag_byte_last - tag_byte_first) / (2 * TAG_GRANULE)) + 1; | ||
78 | mem1 = allocation_tag_mem(env, mmu_idx, ptr, type, total, | ||
79 | MMU_DATA_LOAD, tag_size, ra); | ||
80 | if (!mem1) { | ||
81 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
82 | mem1 = allocation_tag_mem(env, mmu_idx, ptr, type, next_page - ptr, | ||
83 | MMU_DATA_LOAD, tag_size, ra); | ||
84 | |||
85 | - tag_size = (tag_byte_end - next_page) / (2 * TAG_GRANULE); | ||
86 | + tag_size = ((tag_byte_last - next_page) / (2 * TAG_GRANULE)) + 1; | ||
87 | mem2 = allocation_tag_mem(env, mmu_idx, next_page, type, | ||
88 | - ptr_end - next_page, | ||
89 | + ptr_last - next_page + 1, | ||
90 | MMU_DATA_LOAD, tag_size, ra); | ||
91 | |||
92 | /* | ||
93 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | - * If we failed, we know which granule. Compute the element that | ||
98 | - * is first in that granule, and signal failure on that element. | ||
99 | + * If we failed, we know which granule. For the first granule, the | ||
100 | + * failure address is @ptr, the first byte accessed. Otherwise the | ||
101 | + * failure address is the first byte of the nth granule. | ||
102 | */ | ||
103 | if (unlikely(n < tag_count)) { | ||
104 | - uint64_t fail_ofs; | ||
105 | - | ||
106 | - fail_ofs = tag_first + n * TAG_GRANULE - ptr; | ||
107 | - fail_ofs = ROUND_UP(fail_ofs, esize); | ||
108 | - mte_check_fail(env, desc, ptr + fail_ofs, ra); | ||
109 | + uint64_t fault = (n == 0 ? ptr : tag_first + n * TAG_GRANULE); | ||
110 | + mte_check_fail(env, desc, fault, ra); | ||
111 | } | ||
112 | |||
113 | done: | ||
114 | -- | ||
115 | 2.20.1 | ||
116 | |||
117 | diff view generated by jsdifflib |
1 | From: Cornelia Huck <cohuck@redhat.com> | 1 | A lot of C files in hw/arm include qemu-common.h when they don't |
---|---|---|---|
2 | need anything from it. Drop the include lines. | ||
2 | 3 | ||
3 | Add 6.1 machine types for arm/i440fx/q35/s390x/spapr. | 4 | omap1.c, pxa2xx.c and strongarm.c retain the include because they |
5 | use it for the prototype of qemu_get_timedate(). | ||
4 | 6 | ||
5 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | ||
6 | Acked-by: Greg Kurz <groug@kaod.org> | ||
7 | Message-id: 20210331111900.118274-1-cohuck@redhat.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | ||
11 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> | ||
12 | Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | include/hw/boards.h | 3 +++ | 14 | hw/arm/boot.c | 1 - |
12 | include/hw/i386/pc.h | 3 +++ | 15 | hw/arm/digic_boards.c | 1 - |
13 | hw/arm/virt.c | 7 ++++++- | 16 | hw/arm/highbank.c | 1 - |
14 | hw/core/machine.c | 3 +++ | 17 | hw/arm/npcm7xx_boards.c | 1 - |
15 | hw/i386/pc.c | 3 +++ | 18 | hw/arm/sbsa-ref.c | 1 - |
16 | hw/i386/pc_piix.c | 14 +++++++++++++- | 19 | hw/arm/stm32f405_soc.c | 1 - |
17 | hw/i386/pc_q35.c | 13 ++++++++++++- | 20 | hw/arm/vexpress.c | 1 - |
18 | hw/ppc/spapr.c | 17 ++++++++++++++--- | 21 | hw/arm/virt.c | 1 - |
19 | hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- | 22 | 8 files changed, 8 deletions(-) |
20 | 9 files changed, 70 insertions(+), 7 deletions(-) | ||
21 | 23 | ||
22 | diff --git a/include/hw/boards.h b/include/hw/boards.h | 24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
23 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/boards.h | 26 | --- a/hw/arm/boot.c |
25 | +++ b/include/hw/boards.h | 27 | +++ b/hw/arm/boot.c |
26 | @@ -XXX,XX +XXX,XX @@ struct MachineState { | 28 | @@ -XXX,XX +XXX,XX @@ |
27 | } \ | 29 | */ |
28 | type_init(machine_initfn##_register_types) | 30 | |
29 | 31 | #include "qemu/osdep.h" | |
30 | +extern GlobalProperty hw_compat_6_0[]; | 32 | -#include "qemu-common.h" |
31 | +extern const size_t hw_compat_6_0_len; | 33 | #include "qemu/datadir.h" |
32 | + | 34 | #include "qemu/error-report.h" |
33 | extern GlobalProperty hw_compat_5_2[]; | 35 | #include "qapi/error.h" |
34 | extern const size_t hw_compat_5_2_len; | 36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c |
35 | |||
36 | diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h | ||
37 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/include/hw/i386/pc.h | 38 | --- a/hw/arm/digic_boards.c |
39 | +++ b/include/hw/i386/pc.h | 39 | +++ b/hw/arm/digic_boards.c |
40 | @@ -XXX,XX +XXX,XX @@ bool pc_system_ovmf_table_find(const char *entry, uint8_t **data, | 40 | @@ -XXX,XX +XXX,XX @@ |
41 | void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, | 41 | |
42 | const CPUArchIdList *apic_ids, GArray *entry); | 42 | #include "qemu/osdep.h" |
43 | 43 | #include "qapi/error.h" | |
44 | +extern GlobalProperty pc_compat_6_0[]; | 44 | -#include "qemu-common.h" |
45 | +extern const size_t pc_compat_6_0_len; | 45 | #include "qemu/datadir.h" |
46 | + | 46 | #include "hw/boards.h" |
47 | extern GlobalProperty pc_compat_5_2[]; | 47 | #include "qemu/error-report.h" |
48 | extern const size_t pc_compat_5_2_len; | 48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c |
49 | 49 | index XXXXXXX..XXXXXXX 100644 | |
50 | --- a/hw/arm/highbank.c | ||
51 | +++ b/hw/arm/highbank.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | */ | ||
54 | |||
55 | #include "qemu/osdep.h" | ||
56 | -#include "qemu-common.h" | ||
57 | #include "qemu/datadir.h" | ||
58 | #include "qapi/error.h" | ||
59 | #include "hw/sysbus.h" | ||
60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/npcm7xx_boards.c | ||
63 | +++ b/hw/arm/npcm7xx_boards.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "hw/qdev-core.h" | ||
66 | #include "hw/qdev-properties.h" | ||
67 | #include "qapi/error.h" | ||
68 | -#include "qemu-common.h" | ||
69 | #include "qemu/datadir.h" | ||
70 | #include "qemu/units.h" | ||
71 | #include "sysemu/blockdev.h" | ||
72 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/sbsa-ref.c | ||
75 | +++ b/hw/arm/sbsa-ref.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | */ | ||
78 | |||
79 | #include "qemu/osdep.h" | ||
80 | -#include "qemu-common.h" | ||
81 | #include "qemu/datadir.h" | ||
82 | #include "qapi/error.h" | ||
83 | #include "qemu/error-report.h" | ||
84 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/arm/stm32f405_soc.c | ||
87 | +++ b/hw/arm/stm32f405_soc.c | ||
88 | @@ -XXX,XX +XXX,XX @@ | ||
89 | |||
90 | #include "qemu/osdep.h" | ||
91 | #include "qapi/error.h" | ||
92 | -#include "qemu-common.h" | ||
93 | #include "exec/address-spaces.h" | ||
94 | #include "sysemu/sysemu.h" | ||
95 | #include "hw/arm/stm32f405_soc.h" | ||
96 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/hw/arm/vexpress.c | ||
99 | +++ b/hw/arm/vexpress.c | ||
100 | @@ -XXX,XX +XXX,XX @@ | ||
101 | |||
102 | #include "qemu/osdep.h" | ||
103 | #include "qapi/error.h" | ||
104 | -#include "qemu-common.h" | ||
105 | #include "qemu/datadir.h" | ||
106 | #include "cpu.h" | ||
107 | #include "hw/sysbus.h" | ||
50 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
51 | index XXXXXXX..XXXXXXX 100644 | 109 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/hw/arm/virt.c | 110 | --- a/hw/arm/virt.c |
53 | +++ b/hw/arm/virt.c | 111 | +++ b/hw/arm/virt.c |
54 | @@ -XXX,XX +XXX,XX @@ static void machvirt_machine_init(void) | ||
55 | } | ||
56 | type_init(machvirt_machine_init); | ||
57 | |||
58 | +static void virt_machine_6_1_options(MachineClass *mc) | ||
59 | +{ | ||
60 | +} | ||
61 | +DEFINE_VIRT_MACHINE_AS_LATEST(6, 1) | ||
62 | + | ||
63 | static void virt_machine_6_0_options(MachineClass *mc) | ||
64 | { | ||
65 | } | ||
66 | -DEFINE_VIRT_MACHINE_AS_LATEST(6, 0) | ||
67 | +DEFINE_VIRT_MACHINE(6, 0) | ||
68 | |||
69 | static void virt_machine_5_2_options(MachineClass *mc) | ||
70 | { | ||
71 | diff --git a/hw/core/machine.c b/hw/core/machine.c | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/hw/core/machine.c | ||
74 | +++ b/hw/core/machine.c | ||
75 | @@ -XXX,XX +XXX,XX @@ | 112 | @@ -XXX,XX +XXX,XX @@ |
76 | #include "hw/virtio/virtio.h" | ||
77 | #include "hw/virtio/virtio-pci.h" | ||
78 | |||
79 | +GlobalProperty hw_compat_6_0[] = {}; | ||
80 | +const size_t hw_compat_6_0_len = G_N_ELEMENTS(hw_compat_6_0); | ||
81 | + | ||
82 | GlobalProperty hw_compat_5_2[] = { | ||
83 | { "ICH9-LPC", "smm-compat", "on"}, | ||
84 | { "PIIX4_PM", "smm-compat", "on"}, | ||
85 | diff --git a/hw/i386/pc.c b/hw/i386/pc.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/hw/i386/pc.c | ||
88 | +++ b/hw/i386/pc.c | ||
89 | @@ -XXX,XX +XXX,XX @@ | ||
90 | #include "trace.h" | ||
91 | #include CONFIG_DEVICES | ||
92 | |||
93 | +GlobalProperty pc_compat_6_0[] = {}; | ||
94 | +const size_t pc_compat_6_0_len = G_N_ELEMENTS(pc_compat_6_0); | ||
95 | + | ||
96 | GlobalProperty pc_compat_5_2[] = { | ||
97 | { "ICH9-LPC", "x-smi-cpu-hotunplug", "off" }, | ||
98 | }; | ||
99 | diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/hw/i386/pc_piix.c | ||
102 | +++ b/hw/i386/pc_piix.c | ||
103 | @@ -XXX,XX +XXX,XX @@ static void pc_i440fx_machine_options(MachineClass *m) | ||
104 | machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); | ||
105 | } | ||
106 | |||
107 | -static void pc_i440fx_6_0_machine_options(MachineClass *m) | ||
108 | +static void pc_i440fx_6_1_machine_options(MachineClass *m) | ||
109 | { | ||
110 | PCMachineClass *pcmc = PC_MACHINE_CLASS(m); | ||
111 | pc_i440fx_machine_options(m); | ||
112 | @@ -XXX,XX +XXX,XX @@ static void pc_i440fx_6_0_machine_options(MachineClass *m) | ||
113 | pcmc->default_cpu_version = 1; | ||
114 | } | ||
115 | |||
116 | +DEFINE_I440FX_MACHINE(v6_1, "pc-i440fx-6.1", NULL, | ||
117 | + pc_i440fx_6_1_machine_options); | ||
118 | + | ||
119 | +static void pc_i440fx_6_0_machine_options(MachineClass *m) | ||
120 | +{ | ||
121 | + pc_i440fx_6_1_machine_options(m); | ||
122 | + m->alias = NULL; | ||
123 | + m->is_default = false; | ||
124 | + compat_props_add(m->compat_props, hw_compat_6_0, hw_compat_6_0_len); | ||
125 | + compat_props_add(m->compat_props, pc_compat_6_0, pc_compat_6_0_len); | ||
126 | +} | ||
127 | + | ||
128 | DEFINE_I440FX_MACHINE(v6_0, "pc-i440fx-6.0", NULL, | ||
129 | pc_i440fx_6_0_machine_options); | ||
130 | |||
131 | diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/hw/i386/pc_q35.c | ||
134 | +++ b/hw/i386/pc_q35.c | ||
135 | @@ -XXX,XX +XXX,XX @@ static void pc_q35_machine_options(MachineClass *m) | ||
136 | m->max_cpus = 288; | ||
137 | } | ||
138 | |||
139 | -static void pc_q35_6_0_machine_options(MachineClass *m) | ||
140 | +static void pc_q35_6_1_machine_options(MachineClass *m) | ||
141 | { | ||
142 | PCMachineClass *pcmc = PC_MACHINE_CLASS(m); | ||
143 | pc_q35_machine_options(m); | ||
144 | @@ -XXX,XX +XXX,XX @@ static void pc_q35_6_0_machine_options(MachineClass *m) | ||
145 | pcmc->default_cpu_version = 1; | ||
146 | } | ||
147 | |||
148 | +DEFINE_Q35_MACHINE(v6_1, "pc-q35-6.1", NULL, | ||
149 | + pc_q35_6_1_machine_options); | ||
150 | + | ||
151 | +static void pc_q35_6_0_machine_options(MachineClass *m) | ||
152 | +{ | ||
153 | + pc_q35_6_1_machine_options(m); | ||
154 | + m->alias = NULL; | ||
155 | + compat_props_add(m->compat_props, hw_compat_6_0, hw_compat_6_0_len); | ||
156 | + compat_props_add(m->compat_props, pc_compat_6_0, pc_compat_6_0_len); | ||
157 | +} | ||
158 | + | ||
159 | DEFINE_Q35_MACHINE(v6_0, "pc-q35-6.0", NULL, | ||
160 | pc_q35_6_0_machine_options); | ||
161 | |||
162 | diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c | ||
163 | index XXXXXXX..XXXXXXX 100644 | ||
164 | --- a/hw/ppc/spapr.c | ||
165 | +++ b/hw/ppc/spapr.c | ||
166 | @@ -XXX,XX +XXX,XX @@ static void spapr_machine_latest_class_options(MachineClass *mc) | ||
167 | type_init(spapr_machine_register_##suffix) | ||
168 | |||
169 | /* | ||
170 | - * pseries-6.0 | ||
171 | + * pseries-6.1 | ||
172 | */ | 113 | */ |
173 | -static void spapr_machine_6_0_class_options(MachineClass *mc) | 114 | |
174 | +static void spapr_machine_6_1_class_options(MachineClass *mc) | 115 | #include "qemu/osdep.h" |
175 | { | 116 | -#include "qemu-common.h" |
176 | /* Defaults for the latest behaviour inherited from the base class */ | 117 | #include "qemu/datadir.h" |
177 | } | 118 | #include "qemu/units.h" |
178 | 119 | #include "qemu/option.h" | |
179 | -DEFINE_SPAPR_MACHINE(6_0, "6.0", true); | ||
180 | +DEFINE_SPAPR_MACHINE(6_1, "6.1", true); | ||
181 | + | ||
182 | +/* | ||
183 | + * pseries-6.0 | ||
184 | + */ | ||
185 | +static void spapr_machine_6_0_class_options(MachineClass *mc) | ||
186 | +{ | ||
187 | + spapr_machine_6_1_class_options(mc); | ||
188 | + compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); | ||
189 | +} | ||
190 | + | ||
191 | +DEFINE_SPAPR_MACHINE(6_0, "6.0", false); | ||
192 | |||
193 | /* | ||
194 | * pseries-5.2 | ||
195 | diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c | ||
196 | index XXXXXXX..XXXXXXX 100644 | ||
197 | --- a/hw/s390x/s390-virtio-ccw.c | ||
198 | +++ b/hw/s390x/s390-virtio-ccw.c | ||
199 | @@ -XXX,XX +XXX,XX @@ bool css_migration_enabled(void) | ||
200 | } \ | ||
201 | type_init(ccw_machine_register_##suffix) | ||
202 | |||
203 | +static void ccw_machine_6_1_instance_options(MachineState *machine) | ||
204 | +{ | ||
205 | +} | ||
206 | + | ||
207 | +static void ccw_machine_6_1_class_options(MachineClass *mc) | ||
208 | +{ | ||
209 | +} | ||
210 | +DEFINE_CCW_MACHINE(6_1, "6.1", true); | ||
211 | + | ||
212 | static void ccw_machine_6_0_instance_options(MachineState *machine) | ||
213 | { | ||
214 | + ccw_machine_6_1_instance_options(machine); | ||
215 | } | ||
216 | |||
217 | static void ccw_machine_6_0_class_options(MachineClass *mc) | ||
218 | { | ||
219 | + ccw_machine_6_1_class_options(mc); | ||
220 | + compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); | ||
221 | } | ||
222 | -DEFINE_CCW_MACHINE(6_0, "6.0", true); | ||
223 | +DEFINE_CCW_MACHINE(6_0, "6.0", false); | ||
224 | |||
225 | static void ccw_machine_5_2_instance_options(MachineState *machine) | ||
226 | { | ||
227 | -- | 120 | -- |
228 | 2.20.1 | 121 | 2.25.1 |
229 | 122 | ||
230 | 123 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The calculation of the length of TLB range invalidate operations |
---|---|---|---|
2 | in tlbi_aa64_range_get_length() is incorrect in two ways: | ||
3 | * the NUM field is 5 bits, but we read only 4 bits | ||
4 | * we miscalculate the page_shift value, because of an | ||
5 | off-by-one error: | ||
6 | TG 0b00 is invalid | ||
7 | TG 0b01 is 4K granule size == 4096 == 2^12 | ||
8 | TG 0b10 is 16K granule size == 16384 == 2^14 | ||
9 | TG 0b11 is 64K granule size == 65536 == 2^16 | ||
10 | so page_shift should be (TG - 1) * 2 + 12 | ||
2 | 11 | ||
3 | We're about to rearrange the macro expansion surrounding tbflags, | 12 | Thanks to the bug report submitter Cha HyunSoo for identifying |
4 | and this field name will be expanded using the bit definition of | 13 | both these errors. |
5 | the same name, resulting in a token pasting error. | ||
6 | 14 | ||
7 | So PSTATE_SS -> PSTATE__SS in the uses, and document it. | 15 | Fixes: 84940ed82552d3c ("target/arm: Add support for FEAT_TLBIRANGE") |
16 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/734 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org | ||
22 | --- | ||
23 | target/arm/helper.c | 6 +++--- | ||
24 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
8 | 25 | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20210419202257.161730-4-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/cpu.h | 2 +- | ||
15 | target/arm/helper.c | 4 ++-- | ||
16 | target/arm/translate-a64.c | 2 +- | ||
17 | target/arm/translate.c | 2 +- | ||
18 | 4 files changed, 5 insertions(+), 5 deletions(-) | ||
19 | |||
20 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/arm/cpu.h | ||
23 | +++ b/target/arm/cpu.h | ||
24 | @@ -XXX,XX +XXX,XX @@ typedef ARMCPU ArchCPU; | ||
25 | */ | ||
26 | FIELD(TBFLAG_ANY, AARCH64_STATE, 31, 1) | ||
27 | FIELD(TBFLAG_ANY, SS_ACTIVE, 30, 1) | ||
28 | -FIELD(TBFLAG_ANY, PSTATE_SS, 29, 1) /* Not cached. */ | ||
29 | +FIELD(TBFLAG_ANY, PSTATE__SS, 29, 1) /* Not cached. */ | ||
30 | FIELD(TBFLAG_ANY, BE_DATA, 28, 1) | ||
31 | FIELD(TBFLAG_ANY, MMUIDX, 24, 4) | ||
32 | /* Target EL if we take a floating-point-disabled exception */ | ||
33 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 26 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
34 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/helper.c | 28 | --- a/target/arm/helper.c |
36 | +++ b/target/arm/helper.c | 29 | +++ b/target/arm/helper.c |
37 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 30 | @@ -XXX,XX +XXX,XX @@ static uint64_t tlbi_aa64_range_get_length(CPUARMState *env, |
38 | * 0 x Inactive (the TB flag for SS is always 0) | 31 | uint64_t exponent; |
39 | * 1 0 Active-pending | 32 | uint64_t length; |
40 | * 1 1 Active-not-pending | 33 | |
41 | - * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. | 34 | - num = extract64(value, 39, 4); |
42 | + * SS_ACTIVE is set in hflags; PSTATE__SS is computed every TB. | 35 | + num = extract64(value, 39, 5); |
43 | */ | 36 | scale = extract64(value, 44, 2); |
44 | if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE) && | 37 | page_size_granule = extract64(value, 46, 2); |
45 | (env->pstate & PSTATE_SS)) { | 38 | |
46 | - flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); | 39 | - page_shift = page_size_granule * 2 + 12; |
47 | + flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE__SS, 1); | 40 | - |
41 | if (page_size_granule == 0) { | ||
42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", | ||
43 | page_size_granule); | ||
44 | return 0; | ||
48 | } | 45 | } |
49 | 46 | ||
50 | *pflags = flags; | 47 | + page_shift = (page_size_granule - 1) * 2 + 12; |
51 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 48 | + |
52 | index XXXXXXX..XXXXXXX 100644 | 49 | exponent = (5 * scale) + 1; |
53 | --- a/target/arm/translate-a64.c | 50 | length = (num + 1) << (exponent + page_shift); |
54 | +++ b/target/arm/translate-a64.c | 51 | |
55 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
56 | * end the TB | ||
57 | */ | ||
58 | dc->ss_active = FIELD_EX32(tb_flags, TBFLAG_ANY, SS_ACTIVE); | ||
59 | - dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE_SS); | ||
60 | + dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE__SS); | ||
61 | dc->is_ldex = false; | ||
62 | dc->debug_target_el = FIELD_EX32(tb_flags, TBFLAG_ANY, DEBUG_TARGET_EL); | ||
63 | |||
64 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/target/arm/translate.c | ||
67 | +++ b/target/arm/translate.c | ||
68 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
69 | * end the TB | ||
70 | */ | ||
71 | dc->ss_active = FIELD_EX32(tb_flags, TBFLAG_ANY, SS_ACTIVE); | ||
72 | - dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE_SS); | ||
73 | + dc->pstate_ss = FIELD_EX32(tb_flags, TBFLAG_ANY, PSTATE__SS); | ||
74 | dc->is_ldex = false; | ||
75 | |||
76 | dc->page_start = dc->base.pc_first & TARGET_PAGE_MASK; | ||
77 | -- | 52 | -- |
78 | 2.20.1 | 53 | 2.25.1 |
79 | 54 | ||
80 | 55 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Create a finalize_memop function that computes alignment and | 3 | The rx_active boolean change to true should always trigger a try_read |
4 | endianness and returns the final MemOp for the operation. | 4 | call that flushes the queue. |
5 | 5 | ||
6 | Split out gen_aa32_{ld,st}_internal_i32 which bypasses any special | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
7 | handling of endianness or alignment. Adjust gen_aa32_{ld,st}_i32 | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | so that s->be_data is not added by the callers. | 8 | Message-id: 20211203221002.1719306-1-venture@google.com |
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20210419202257.161730-12-richard.henderson@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 10 | --- |
15 | target/arm/translate.h | 24 ++++++++ | 11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- |
16 | target/arm/translate.c | 100 +++++++++++++++++--------------- | 12 | 1 file changed, 8 insertions(+), 10 deletions(-) |
17 | target/arm/translate-neon.c.inc | 9 +-- | ||
18 | 3 files changed, 79 insertions(+), 54 deletions(-) | ||
19 | 13 | ||
20 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/translate.h | 16 | --- a/hw/net/npcm7xx_emc.c |
23 | +++ b/target/arm/translate.h | 17 | +++ b/hw/net/npcm7xx_emc.c |
24 | @@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) | 18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) |
25 | return statusptr; | 19 | emc_set_mista(emc, mista_flag); |
26 | } | 20 | } |
27 | 21 | ||
28 | +/** | 22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) |
29 | + * finalize_memop: | ||
30 | + * @s: DisasContext | ||
31 | + * @opc: size+sign+align of the memory operation | ||
32 | + * | ||
33 | + * Build the complete MemOp for a memory operation, including alignment | ||
34 | + * and endianness. | ||
35 | + * | ||
36 | + * If (op & MO_AMASK) then the operation already contains the required | ||
37 | + * alignment, e.g. for AccType_ATOMIC. Otherwise, this an optionally | ||
38 | + * unaligned operation, e.g. for AccType_NORMAL. | ||
39 | + * | ||
40 | + * In the latter case, there are configuration bits that require alignment, | ||
41 | + * and this is applied here. Note that there is no way to indicate that | ||
42 | + * no alignment should ever be enforced; this must be handled manually. | ||
43 | + */ | ||
44 | +static inline MemOp finalize_memop(DisasContext *s, MemOp opc) | ||
45 | +{ | 23 | +{ |
46 | + if (s->align_mem && !(opc & MO_AMASK)) { | 24 | + emc->rx_active = true; |
47 | + opc |= MO_ALIGN; | 25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); |
48 | + } | ||
49 | + return opc | s->be_data; | ||
50 | +} | 26 | +} |
51 | + | 27 | + |
52 | #endif /* TARGET_ARM_TRANSLATE_H */ | 28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, |
53 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 29 | const NPCM7xxEMCTxDesc *tx_desc, |
54 | index XXXXXXX..XXXXXXX 100644 | 30 | uint32_t desc_addr) |
55 | --- a/target/arm/translate.c | 31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) |
56 | +++ b/target/arm/translate.c | 32 | return len; |
57 | @@ -XXX,XX +XXX,XX @@ static inline void store_reg_from_load(DisasContext *s, int reg, TCGv_i32 var) | ||
58 | #define IS_USER_ONLY 0 | ||
59 | #endif | ||
60 | |||
61 | -/* Abstractions of "generate code to do a guest load/store for | ||
62 | +/* | ||
63 | + * Abstractions of "generate code to do a guest load/store for | ||
64 | * AArch32", where a vaddr is always 32 bits (and is zero | ||
65 | * extended if we're a 64 bit core) and data is also | ||
66 | * 32 bits unless specifically doing a 64 bit access. | ||
67 | @@ -XXX,XX +XXX,XX @@ static inline void store_reg_from_load(DisasContext *s, int reg, TCGv_i32 var) | ||
68 | * that the address argument is TCGv_i32 rather than TCGv. | ||
69 | */ | ||
70 | |||
71 | -static inline TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, MemOp op) | ||
72 | +static TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, MemOp op) | ||
73 | { | ||
74 | TCGv addr = tcg_temp_new(); | ||
75 | tcg_gen_extu_i32_tl(addr, a32); | ||
76 | @@ -XXX,XX +XXX,XX @@ static inline TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, MemOp op) | ||
77 | return addr; | ||
78 | } | 33 | } |
79 | 34 | ||
80 | +/* | 35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) |
81 | + * Internal routines are used for NEON cases where the endianness | 36 | -{ |
82 | + * and/or alignment has already been taken into account and manipulated. | 37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { |
83 | + */ | 38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); |
84 | +static void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val, | ||
85 | + TCGv_i32 a32, int index, MemOp opc) | ||
86 | +{ | ||
87 | + TCGv addr = gen_aa32_addr(s, a32, opc); | ||
88 | + tcg_gen_qemu_ld_i32(val, addr, index, opc); | ||
89 | + tcg_temp_free(addr); | ||
90 | +} | ||
91 | + | ||
92 | +static void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val, | ||
93 | + TCGv_i32 a32, int index, MemOp opc) | ||
94 | +{ | ||
95 | + TCGv addr = gen_aa32_addr(s, a32, opc); | ||
96 | + tcg_gen_qemu_st_i32(val, addr, index, opc); | ||
97 | + tcg_temp_free(addr); | ||
98 | +} | ||
99 | + | ||
100 | static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
101 | int index, MemOp opc) | ||
102 | { | ||
103 | - TCGv addr; | ||
104 | - | ||
105 | - if (s->align_mem) { | ||
106 | - opc |= MO_ALIGN; | ||
107 | - } | 39 | - } |
108 | - | ||
109 | - addr = gen_aa32_addr(s, a32, opc); | ||
110 | - tcg_gen_qemu_ld_i32(val, addr, index, opc); | ||
111 | - tcg_temp_free(addr); | ||
112 | + gen_aa32_ld_internal_i32(s, val, a32, index, finalize_memop(s, opc)); | ||
113 | } | ||
114 | |||
115 | static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32, | ||
116 | int index, MemOp opc) | ||
117 | { | ||
118 | - TCGv addr; | ||
119 | + gen_aa32_st_internal_i32(s, val, a32, index, finalize_memop(s, opc)); | ||
120 | +} | ||
121 | |||
122 | - if (s->align_mem) { | ||
123 | - opc |= MO_ALIGN; | ||
124 | +#define DO_GEN_LD(SUFF, OPC) \ | ||
125 | + static inline void gen_aa32_ld##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
126 | + TCGv_i32 a32, int index) \ | ||
127 | + { \ | ||
128 | + gen_aa32_ld_i32(s, val, a32, index, OPC); \ | ||
129 | } | ||
130 | |||
131 | - addr = gen_aa32_addr(s, a32, opc); | ||
132 | - tcg_gen_qemu_st_i32(val, addr, index, opc); | ||
133 | - tcg_temp_free(addr); | ||
134 | -} | 40 | -} |
135 | - | 41 | - |
136 | -#define DO_GEN_LD(SUFF, OPC) \ | 42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) |
137 | -static inline void gen_aa32_ld##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
138 | - TCGv_i32 a32, int index) \ | ||
139 | -{ \ | ||
140 | - gen_aa32_ld_i32(s, val, a32, index, OPC | s->be_data); \ | ||
141 | -} | ||
142 | - | ||
143 | -#define DO_GEN_ST(SUFF, OPC) \ | ||
144 | -static inline void gen_aa32_st##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
145 | - TCGv_i32 a32, int index) \ | ||
146 | -{ \ | ||
147 | - gen_aa32_st_i32(s, val, a32, index, OPC | s->be_data); \ | ||
148 | -} | ||
149 | +#define DO_GEN_ST(SUFF, OPC) \ | ||
150 | + static inline void gen_aa32_st##SUFF(DisasContext *s, TCGv_i32 val, \ | ||
151 | + TCGv_i32 a32, int index) \ | ||
152 | + { \ | ||
153 | + gen_aa32_st_i32(s, val, a32, index, OPC); \ | ||
154 | + } | ||
155 | |||
156 | static inline void gen_aa32_frob64(DisasContext *s, TCGv_i64 val) | ||
157 | { | 43 | { |
158 | @@ -XXX,XX +XXX,XX @@ static bool op_load_rr(DisasContext *s, arg_ldst_rr *a, | 44 | NPCM7xxEMCState *emc = opaque; |
159 | addr = op_addr_rr_pre(s, a); | 45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
160 | 46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; | |
161 | tmp = tcg_temp_new_i32(); | ||
162 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, mop | s->be_data); | ||
163 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, mop); | ||
164 | disas_set_da_iss(s, mop, issinfo); | ||
165 | |||
166 | /* | ||
167 | @@ -XXX,XX +XXX,XX @@ static bool op_store_rr(DisasContext *s, arg_ldst_rr *a, | ||
168 | addr = op_addr_rr_pre(s, a); | ||
169 | |||
170 | tmp = load_reg(s, a->rt); | ||
171 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, mop | s->be_data); | ||
172 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, mop); | ||
173 | disas_set_da_iss(s, mop, issinfo); | ||
174 | tcg_temp_free_i32(tmp); | ||
175 | |||
176 | @@ -XXX,XX +XXX,XX @@ static bool trans_LDRD_rr(DisasContext *s, arg_ldst_rr *a) | ||
177 | addr = op_addr_rr_pre(s, a); | ||
178 | |||
179 | tmp = tcg_temp_new_i32(); | ||
180 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
181 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | ||
182 | store_reg(s, a->rt, tmp); | ||
183 | |||
184 | tcg_gen_addi_i32(addr, addr, 4); | ||
185 | |||
186 | tmp = tcg_temp_new_i32(); | ||
187 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
188 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | ||
189 | store_reg(s, a->rt + 1, tmp); | ||
190 | |||
191 | /* LDRD w/ base writeback is undefined if the registers overlap. */ | ||
192 | @@ -XXX,XX +XXX,XX @@ static bool trans_STRD_rr(DisasContext *s, arg_ldst_rr *a) | ||
193 | addr = op_addr_rr_pre(s, a); | ||
194 | |||
195 | tmp = load_reg(s, a->rt); | ||
196 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
197 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | ||
198 | tcg_temp_free_i32(tmp); | ||
199 | |||
200 | tcg_gen_addi_i32(addr, addr, 4); | ||
201 | |||
202 | tmp = load_reg(s, a->rt + 1); | ||
203 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
204 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | ||
205 | tcg_temp_free_i32(tmp); | ||
206 | |||
207 | op_addr_rr_post(s, a, addr, -4); | ||
208 | @@ -XXX,XX +XXX,XX @@ static bool op_load_ri(DisasContext *s, arg_ldst_ri *a, | ||
209 | addr = op_addr_ri_pre(s, a); | ||
210 | |||
211 | tmp = tcg_temp_new_i32(); | ||
212 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, mop | s->be_data); | ||
213 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, mop); | ||
214 | disas_set_da_iss(s, mop, issinfo); | ||
215 | |||
216 | /* | ||
217 | @@ -XXX,XX +XXX,XX @@ static bool op_store_ri(DisasContext *s, arg_ldst_ri *a, | ||
218 | addr = op_addr_ri_pre(s, a); | ||
219 | |||
220 | tmp = load_reg(s, a->rt); | ||
221 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, mop | s->be_data); | ||
222 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, mop); | ||
223 | disas_set_da_iss(s, mop, issinfo); | ||
224 | tcg_temp_free_i32(tmp); | ||
225 | |||
226 | @@ -XXX,XX +XXX,XX @@ static bool op_ldrd_ri(DisasContext *s, arg_ldst_ri *a, int rt2) | ||
227 | addr = op_addr_ri_pre(s, a); | ||
228 | |||
229 | tmp = tcg_temp_new_i32(); | ||
230 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
231 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | ||
232 | store_reg(s, a->rt, tmp); | ||
233 | |||
234 | tcg_gen_addi_i32(addr, addr, 4); | ||
235 | |||
236 | tmp = tcg_temp_new_i32(); | ||
237 | - gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
238 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL); | ||
239 | store_reg(s, rt2, tmp); | ||
240 | |||
241 | /* LDRD w/ base writeback is undefined if the registers overlap. */ | ||
242 | @@ -XXX,XX +XXX,XX @@ static bool op_strd_ri(DisasContext *s, arg_ldst_ri *a, int rt2) | ||
243 | addr = op_addr_ri_pre(s, a); | ||
244 | |||
245 | tmp = load_reg(s, a->rt); | ||
246 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
247 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | ||
248 | tcg_temp_free_i32(tmp); | ||
249 | |||
250 | tcg_gen_addi_i32(addr, addr, 4); | ||
251 | |||
252 | tmp = load_reg(s, rt2); | ||
253 | - gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | s->be_data); | ||
254 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL); | ||
255 | tcg_temp_free_i32(tmp); | ||
256 | |||
257 | op_addr_ri_post(s, a, addr, -4); | ||
258 | @@ -XXX,XX +XXX,XX @@ static bool op_stl(DisasContext *s, arg_STL *a, MemOp mop) | ||
259 | addr = load_reg(s, a->rn); | ||
260 | tmp = load_reg(s, a->rt); | ||
261 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); | ||
262 | - gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), mop | s->be_data); | ||
263 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), mop); | ||
264 | disas_set_da_iss(s, mop, a->rt | ISSIsAcqRel | ISSIsWrite); | ||
265 | |||
266 | tcg_temp_free_i32(tmp); | ||
267 | @@ -XXX,XX +XXX,XX @@ static bool op_lda(DisasContext *s, arg_LDA *a, MemOp mop) | ||
268 | |||
269 | addr = load_reg(s, a->rn); | ||
270 | tmp = tcg_temp_new_i32(); | ||
271 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), mop | s->be_data); | ||
272 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), mop); | ||
273 | disas_set_da_iss(s, mop, a->rt | ISSIsAcqRel); | ||
274 | tcg_temp_free_i32(addr); | ||
275 | |||
276 | @@ -XXX,XX +XXX,XX @@ static bool op_tbranch(DisasContext *s, arg_tbranch *a, bool half) | ||
277 | addr = load_reg(s, a->rn); | ||
278 | tcg_gen_add_i32(addr, addr, tmp); | ||
279 | |||
280 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
281 | - half ? MO_UW | s->be_data : MO_UB); | ||
282 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), half ? MO_UW : MO_UB); | ||
283 | tcg_temp_free_i32(addr); | ||
284 | |||
285 | tcg_gen_add_i32(tmp, tmp, tmp); | ||
286 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
287 | index XXXXXXX..XXXXXXX 100644 | ||
288 | --- a/target/arm/translate-neon.c.inc | ||
289 | +++ b/target/arm/translate-neon.c.inc | ||
290 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a) | ||
291 | addr = tcg_temp_new_i32(); | ||
292 | load_reg_var(s, addr, a->rn); | ||
293 | for (reg = 0; reg < nregs; reg++) { | ||
294 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
295 | - s->be_data | size); | ||
296 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), size); | ||
297 | if ((vd & 1) && vec_size == 16) { | ||
298 | /* | ||
299 | * We cannot write 16 bytes at once because the | ||
300 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
301 | */ | ||
302 | for (reg = 0; reg < nregs; reg++) { | ||
303 | if (a->l) { | ||
304 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), | ||
305 | - s->be_data | a->size); | ||
306 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), a->size); | ||
307 | neon_store_element(vd, a->reg_idx, a->size, tmp); | ||
308 | } else { /* Store */ | ||
309 | neon_load_element(tmp, vd, a->reg_idx, a->size); | ||
310 | - gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), | ||
311 | - s->be_data | a->size); | ||
312 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), a->size); | ||
313 | } | 47 | } |
314 | vd += a->stride; | 48 | if (value & REG_MCMDR_RXON) { |
315 | tcg_gen_addi_i32(addr, addr, 1 << a->size); | 49 | - emc->rx_active = true; |
50 | + emc_enable_rx_and_flush(emc); | ||
51 | } else { | ||
52 | emc_halt_rx(emc, 0); | ||
53 | } | ||
54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, | ||
55 | break; | ||
56 | case REG_RSDR: | ||
57 | if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) { | ||
58 | - emc->rx_active = true; | ||
59 | - emc_try_receive_next_packet(emc); | ||
60 | + emc_enable_rx_and_flush(emc); | ||
61 | } | ||
62 | break; | ||
63 | case REG_MIIDA: | ||
316 | -- | 64 | -- |
317 | 2.20.1 | 65 | 2.25.1 |
318 | 66 | ||
319 | 67 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Now that we have all of the proper macros defined, expanding | 3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT |
4 | the CPUARMTBFlags structure and populating the two TB fields | 4 | table. |
5 | is relatively simple. | ||
6 | 5 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
9 | Message-id: 20210419202257.161730-7-richard.henderson@linaro.org | 8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | target/arm/cpu.h | 49 ++++++++++++++++++++++++------------------ | 12 | hw/arm/virt-acpi-build.c | 7 +++++++ |
13 | target/arm/translate.h | 2 +- | 13 | hw/arm/Kconfig | 1 + |
14 | target/arm/helper.c | 10 +++++---- | 14 | 2 files changed, 8 insertions(+) |
15 | 3 files changed, 35 insertions(+), 26 deletions(-) | ||
16 | 15 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c |
18 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 18 | --- a/hw/arm/virt-acpi-build.c |
20 | +++ b/target/arm/cpu.h | 19 | +++ b/hw/arm/virt-acpi-build.c |
21 | @@ -XXX,XX +XXX,XX @@ typedef struct ARMPACKey { | 20 | @@ -XXX,XX +XXX,XX @@ |
22 | /* See the commentary above the TBFLAG field definitions. */ | 21 | #include "kvm_arm.h" |
23 | typedef struct CPUARMTBFlags { | 22 | #include "migration/vmstate.h" |
24 | uint32_t flags; | 23 | #include "hw/acpi/ghes.h" |
25 | + target_ulong flags2; | 24 | +#include "hw/acpi/viot.h" |
26 | } CPUARMTBFlags; | 25 | |
27 | 26 | #define ARM_SPI_BASE 32 | |
28 | typedef struct CPUARMState { | 27 | |
29 | @@ -XXX,XX +XXX,XX @@ typedef ARMCPU ArchCPU; | 28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) |
30 | #include "exec/cpu-all.h" | ||
31 | |||
32 | /* | ||
33 | - * Bit usage in the TB flags field: bit 31 indicates whether we are | ||
34 | - * in 32 or 64 bit mode. The meaning of the other bits depends on that. | ||
35 | - * We put flags which are shared between 32 and 64 bit mode at the top | ||
36 | - * of the word, and flags which apply to only one mode at the bottom. | ||
37 | + * We have more than 32-bits worth of state per TB, so we split the data | ||
38 | + * between tb->flags and tb->cs_base, which is otherwise unused for ARM. | ||
39 | + * We collect these two parts in CPUARMTBFlags where they are named | ||
40 | + * flags and flags2 respectively. | ||
41 | * | ||
42 | - * 31 20 18 14 9 0 | ||
43 | - * +--------------+-----+-----+----------+--------------+ | ||
44 | - * | | | TBFLAG_A32 | | | ||
45 | - * | | +-----+----------+ TBFLAG_AM32 | | ||
46 | - * | TBFLAG_ANY | |TBFLAG_M32| | | ||
47 | - * | +-----------+----------+--------------| | ||
48 | - * | | TBFLAG_A64 | | ||
49 | - * +--------------+-------------------------------------+ | ||
50 | - * 31 20 0 | ||
51 | + * The flags that are shared between all execution modes, TBFLAG_ANY, | ||
52 | + * are stored in flags. The flags that are specific to a given mode | ||
53 | + * are stores in flags2. Since cs_base is sized on the configured | ||
54 | + * address size, flags2 always has 64-bits for A64, and a minimum of | ||
55 | + * 32-bits for A32 and M32. | ||
56 | + * | ||
57 | + * The bits for 32-bit A-profile and M-profile partially overlap: | ||
58 | + * | ||
59 | + * 18 9 0 | ||
60 | + * +----------------+--------------+ | ||
61 | + * | TBFLAG_A32 | | | ||
62 | + * +-----+----------+ TBFLAG_AM32 | | ||
63 | + * | |TBFLAG_M32| | | ||
64 | + * +-----+----------+--------------+ | ||
65 | + * 14 9 0 | ||
66 | * | ||
67 | * Unless otherwise noted, these bits are cached in env->hflags. | ||
68 | */ | ||
69 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) | ||
70 | #define DP_TBFLAG_ANY(DST, WHICH, VAL) \ | ||
71 | (DST.flags = FIELD_DP32(DST.flags, TBFLAG_ANY, WHICH, VAL)) | ||
72 | #define DP_TBFLAG_A64(DST, WHICH, VAL) \ | ||
73 | - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_A64, WHICH, VAL)) | ||
74 | + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_A64, WHICH, VAL)) | ||
75 | #define DP_TBFLAG_A32(DST, WHICH, VAL) \ | ||
76 | - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_A32, WHICH, VAL)) | ||
77 | + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_A32, WHICH, VAL)) | ||
78 | #define DP_TBFLAG_M32(DST, WHICH, VAL) \ | ||
79 | - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_M32, WHICH, VAL)) | ||
80 | + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_M32, WHICH, VAL)) | ||
81 | #define DP_TBFLAG_AM32(DST, WHICH, VAL) \ | ||
82 | - (DST.flags = FIELD_DP32(DST.flags, TBFLAG_AM32, WHICH, VAL)) | ||
83 | + (DST.flags2 = FIELD_DP32(DST.flags2, TBFLAG_AM32, WHICH, VAL)) | ||
84 | |||
85 | #define EX_TBFLAG_ANY(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_ANY, WHICH) | ||
86 | -#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_A64, WHICH) | ||
87 | -#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_A32, WHICH) | ||
88 | -#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_M32, WHICH) | ||
89 | -#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_AM32, WHICH) | ||
90 | +#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_A64, WHICH) | ||
91 | +#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_A32, WHICH) | ||
92 | +#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_M32, WHICH) | ||
93 | +#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN.flags2, TBFLAG_AM32, WHICH) | ||
94 | |||
95 | /** | ||
96 | * cpu_mmu_index: | ||
97 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
98 | index XXXXXXX..XXXXXXX 100644 | ||
99 | --- a/target/arm/translate.h | ||
100 | +++ b/target/arm/translate.h | ||
101 | @@ -XXX,XX +XXX,XX @@ typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
102 | */ | ||
103 | static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb) | ||
104 | { | ||
105 | - return (CPUARMTBFlags){ tb->flags }; | ||
106 | + return (CPUARMTBFlags){ tb->flags, tb->cs_base }; | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/target/arm/helper.c | ||
113 | +++ b/target/arm/helper.c | ||
114 | @@ -XXX,XX +XXX,XX @@ static inline void assert_hflags_rebuild_correctly(CPUARMState *env) | ||
115 | CPUARMTBFlags c = env->hflags; | ||
116 | CPUARMTBFlags r = rebuild_hflags_internal(env); | ||
117 | |||
118 | - if (unlikely(c.flags != r.flags)) { | ||
119 | - fprintf(stderr, "TCG hflags mismatch (current:0x%08x rebuilt:0x%08x)\n", | ||
120 | - c.flags, r.flags); | ||
121 | + if (unlikely(c.flags != r.flags || c.flags2 != r.flags2)) { | ||
122 | + fprintf(stderr, "TCG hflags mismatch " | ||
123 | + "(current:(0x%08x,0x" TARGET_FMT_lx ")" | ||
124 | + " rebuilt:(0x%08x,0x" TARGET_FMT_lx ")\n", | ||
125 | + c.flags, c.flags2, r.flags, r.flags2); | ||
126 | abort(); | ||
127 | } | 29 | } |
128 | #endif | 30 | #endif |
129 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 31 | |
130 | { | 32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { |
131 | CPUARMTBFlags flags; | 33 | + acpi_add_table(table_offsets, tables_blob); |
132 | 34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, | |
133 | - *cs_base = 0; | 35 | + vms->oem_id, vms->oem_table_id); |
134 | assert_hflags_rebuild_correctly(env); | 36 | + } |
135 | flags = env->hflags; | 37 | + |
136 | 38 | /* XSDT is pointed to by RSDP */ | |
137 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 39 | xsdt = tables_blob->len; |
138 | } | 40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, |
139 | 41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | |
140 | *pflags = flags.flags; | 42 | index XXXXXXX..XXXXXXX 100644 |
141 | + *cs_base = flags.flags2; | 43 | --- a/hw/arm/Kconfig |
142 | } | 44 | +++ b/hw/arm/Kconfig |
143 | 45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | |
144 | #ifdef TARGET_AARCH64 | 46 | select DIMM |
47 | select ACPI_HW_REDUCED | ||
48 | select ACPI_APEI | ||
49 | + select ACPI_VIOT | ||
50 | |||
51 | config CHEETAH | ||
52 | bool | ||
145 | -- | 53 | -- |
146 | 2.20.1 | 54 | 2.25.1 |
147 | 55 | ||
148 | 56 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Now that mte_check1 and mte_checkN have been merged, we can | 3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. |
4 | merge sve_cont_ldst_mte_check1 and sve_cont_ldst_mte_checkN. | 4 | Remove the restriction that prevents from instantiating a virtio-iommu |
5 | device under ACPI. | ||
5 | 6 | ||
6 | Which means that we can eliminate the function pointer into | 7 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
7 | sve_ldN_r and sve_stN_r, calling sve_cont_ldst_mte_check directly. | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
8 | 9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | |
9 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org |
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20210416183106.1516563-9-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 12 | --- |
14 | target/arm/sve_helper.c | 84 +++++++++++++---------------------------- | 13 | hw/arm/virt.c | 10 ++-------- |
15 | 1 file changed, 26 insertions(+), 58 deletions(-) | 14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- |
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | ||
16 | 16 | ||
17 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
18 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/sve_helper.c | 19 | --- a/hw/arm/virt.c |
20 | +++ b/target/arm/sve_helper.c | 20 | +++ b/hw/arm/virt.c |
21 | @@ -XXX,XX +XXX,XX @@ static void sve_cont_ldst_watchpoints(SVEContLdSt *info, CPUARMState *env, | 21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
22 | #endif | 22 | MachineClass *mc = MACHINE_GET_CLASS(machine); |
23 | |||
24 | if (device_is_dynamic_sysbus(mc, dev) || | ||
25 | - (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM))) { | ||
26 | + object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || | ||
27 | + object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | ||
28 | return HOTPLUG_HANDLER(machine); | ||
29 | } | ||
30 | - if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { | ||
31 | - VirtMachineState *vms = VIRT_MACHINE(machine); | ||
32 | - | ||
33 | - if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { | ||
34 | - return HOTPLUG_HANDLER(machine); | ||
35 | - } | ||
36 | - } | ||
37 | return NULL; | ||
23 | } | 38 | } |
24 | 39 | ||
25 | -typedef uint64_t mte_check_fn(CPUARMState *, uint32_t, uint64_t, uintptr_t); | 40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c |
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/virtio/virtio-iommu-pci.c | ||
43 | +++ b/hw/virtio/virtio-iommu-pci.c | ||
44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) | ||
45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); | ||
46 | |||
47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { | ||
48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | ||
26 | - | 49 | - |
27 | -static inline QEMU_ALWAYS_INLINE | 50 | - error_setg(errp, |
28 | -void sve_cont_ldst_mte_check_int(SVEContLdSt *info, CPUARMState *env, | 51 | - "%s machine fails to create iommu-map device tree bindings", |
29 | - uint64_t *vg, target_ulong addr, int esize, | 52 | - mc->name); |
30 | - int msize, uint32_t mtedesc, uintptr_t ra, | 53 | - error_append_hint(errp, |
31 | - mte_check_fn *check) | 54 | - "Check your machine implements a hotplug handler " |
32 | +static void sve_cont_ldst_mte_check(SVEContLdSt *info, CPUARMState *env, | 55 | - "for the virtio-iommu-pci device\n"); |
33 | + uint64_t *vg, target_ulong addr, int esize, | 56 | - error_append_hint(errp, "Check the guest is booted without FW or with " |
34 | + int msize, uint32_t mtedesc, uintptr_t ra) | 57 | - "-no-acpi\n"); |
35 | { | 58 | + error_setg(errp, "Check your machine implements a hotplug handler " |
36 | intptr_t mem_off, reg_off, reg_last; | 59 | + "for the virtio-iommu-pci device"); |
37 | 60 | return; | |
38 | @@ -XXX,XX +XXX,XX @@ void sve_cont_ldst_mte_check_int(SVEContLdSt *info, CPUARMState *env, | ||
39 | uint64_t pg = vg[reg_off >> 6]; | ||
40 | do { | ||
41 | if ((pg >> (reg_off & 63)) & 1) { | ||
42 | - check(env, mtedesc, addr, ra); | ||
43 | + mte_check(env, mtedesc, addr, ra); | ||
44 | } | ||
45 | reg_off += esize; | ||
46 | mem_off += msize; | ||
47 | @@ -XXX,XX +XXX,XX @@ void sve_cont_ldst_mte_check_int(SVEContLdSt *info, CPUARMState *env, | ||
48 | uint64_t pg = vg[reg_off >> 6]; | ||
49 | do { | ||
50 | if ((pg >> (reg_off & 63)) & 1) { | ||
51 | - check(env, mtedesc, addr, ra); | ||
52 | + mte_check(env, mtedesc, addr, ra); | ||
53 | } | ||
54 | reg_off += esize; | ||
55 | mem_off += msize; | ||
56 | @@ -XXX,XX +XXX,XX @@ void sve_cont_ldst_mte_check_int(SVEContLdSt *info, CPUARMState *env, | ||
57 | } | 61 | } |
58 | } | 62 | for (int i = 0; i < s->nb_reserved_regions; i++) { |
59 | |||
60 | -typedef void sve_cont_ldst_mte_check_fn(SVEContLdSt *info, CPUARMState *env, | ||
61 | - uint64_t *vg, target_ulong addr, | ||
62 | - int esize, int msize, uint32_t mtedesc, | ||
63 | - uintptr_t ra); | ||
64 | - | ||
65 | -static void sve_cont_ldst_mte_check1(SVEContLdSt *info, CPUARMState *env, | ||
66 | - uint64_t *vg, target_ulong addr, | ||
67 | - int esize, int msize, uint32_t mtedesc, | ||
68 | - uintptr_t ra) | ||
69 | -{ | ||
70 | - sve_cont_ldst_mte_check_int(info, env, vg, addr, esize, msize, | ||
71 | - mtedesc, ra, mte_check); | ||
72 | -} | ||
73 | - | ||
74 | -static void sve_cont_ldst_mte_checkN(SVEContLdSt *info, CPUARMState *env, | ||
75 | - uint64_t *vg, target_ulong addr, | ||
76 | - int esize, int msize, uint32_t mtedesc, | ||
77 | - uintptr_t ra) | ||
78 | -{ | ||
79 | - sve_cont_ldst_mte_check_int(info, env, vg, addr, esize, msize, | ||
80 | - mtedesc, ra, mte_check); | ||
81 | -} | ||
82 | - | ||
83 | - | ||
84 | /* | ||
85 | * Common helper for all contiguous 1,2,3,4-register predicated stores. | ||
86 | */ | ||
87 | @@ -XXX,XX +XXX,XX @@ void sve_ldN_r(CPUARMState *env, uint64_t *vg, const target_ulong addr, | ||
88 | uint32_t desc, const uintptr_t retaddr, | ||
89 | const int esz, const int msz, const int N, uint32_t mtedesc, | ||
90 | sve_ldst1_host_fn *host_fn, | ||
91 | - sve_ldst1_tlb_fn *tlb_fn, | ||
92 | - sve_cont_ldst_mte_check_fn *mte_check_fn) | ||
93 | + sve_ldst1_tlb_fn *tlb_fn) | ||
94 | { | ||
95 | const unsigned rd = simd_data(desc); | ||
96 | const intptr_t reg_max = simd_oprsz(desc); | ||
97 | @@ -XXX,XX +XXX,XX @@ void sve_ldN_r(CPUARMState *env, uint64_t *vg, const target_ulong addr, | ||
98 | * Handle mte checks for all active elements. | ||
99 | * Since TBI must be set for MTE, !mtedesc => !mte_active. | ||
100 | */ | ||
101 | - if (mte_check_fn && mtedesc) { | ||
102 | - mte_check_fn(&info, env, vg, addr, 1 << esz, N << msz, | ||
103 | - mtedesc, retaddr); | ||
104 | + if (mtedesc) { | ||
105 | + sve_cont_ldst_mte_check(&info, env, vg, addr, 1 << esz, N << msz, | ||
106 | + mtedesc, retaddr); | ||
107 | } | ||
108 | |||
109 | flags = info.page[0].flags | info.page[1].flags; | ||
110 | @@ -XXX,XX +XXX,XX @@ void sve_ldN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr, | ||
111 | mtedesc = 0; | ||
112 | } | ||
113 | |||
114 | - sve_ldN_r(env, vg, addr, desc, ra, esz, msz, N, mtedesc, host_fn, tlb_fn, | ||
115 | - N == 1 ? sve_cont_ldst_mte_check1 : sve_cont_ldst_mte_checkN); | ||
116 | + sve_ldN_r(env, vg, addr, desc, ra, esz, msz, N, mtedesc, host_fn, tlb_fn); | ||
117 | } | ||
118 | |||
119 | #define DO_LD1_1(NAME, ESZ) \ | ||
120 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_##NAME##_r)(CPUARMState *env, void *vg, \ | ||
121 | target_ulong addr, uint32_t desc) \ | ||
122 | { \ | ||
123 | sve_ldN_r(env, vg, addr, desc, GETPC(), ESZ, MO_8, 1, 0, \ | ||
124 | - sve_##NAME##_host, sve_##NAME##_tlb, NULL); \ | ||
125 | + sve_##NAME##_host, sve_##NAME##_tlb); \ | ||
126 | } \ | ||
127 | void HELPER(sve_##NAME##_r_mte)(CPUARMState *env, void *vg, \ | ||
128 | target_ulong addr, uint32_t desc) \ | ||
129 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_##NAME##_le_r)(CPUARMState *env, void *vg, \ | ||
130 | target_ulong addr, uint32_t desc) \ | ||
131 | { \ | ||
132 | sve_ldN_r(env, vg, addr, desc, GETPC(), ESZ, MSZ, 1, 0, \ | ||
133 | - sve_##NAME##_le_host, sve_##NAME##_le_tlb, NULL); \ | ||
134 | + sve_##NAME##_le_host, sve_##NAME##_le_tlb); \ | ||
135 | } \ | ||
136 | void HELPER(sve_##NAME##_be_r)(CPUARMState *env, void *vg, \ | ||
137 | target_ulong addr, uint32_t desc) \ | ||
138 | { \ | ||
139 | sve_ldN_r(env, vg, addr, desc, GETPC(), ESZ, MSZ, 1, 0, \ | ||
140 | - sve_##NAME##_be_host, sve_##NAME##_be_tlb, NULL); \ | ||
141 | + sve_##NAME##_be_host, sve_##NAME##_be_tlb); \ | ||
142 | } \ | ||
143 | void HELPER(sve_##NAME##_le_r_mte)(CPUARMState *env, void *vg, \ | ||
144 | - target_ulong addr, uint32_t desc) \ | ||
145 | + target_ulong addr, uint32_t desc) \ | ||
146 | { \ | ||
147 | sve_ldN_r_mte(env, vg, addr, desc, GETPC(), ESZ, MSZ, 1, \ | ||
148 | sve_##NAME##_le_host, sve_##NAME##_le_tlb); \ | ||
149 | } \ | ||
150 | void HELPER(sve_##NAME##_be_r_mte)(CPUARMState *env, void *vg, \ | ||
151 | - target_ulong addr, uint32_t desc) \ | ||
152 | + target_ulong addr, uint32_t desc) \ | ||
153 | { \ | ||
154 | sve_ldN_r_mte(env, vg, addr, desc, GETPC(), ESZ, MSZ, 1, \ | ||
155 | sve_##NAME##_be_host, sve_##NAME##_be_tlb); \ | ||
156 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_ld##N##bb_r)(CPUARMState *env, void *vg, \ | ||
157 | target_ulong addr, uint32_t desc) \ | ||
158 | { \ | ||
159 | sve_ldN_r(env, vg, addr, desc, GETPC(), MO_8, MO_8, N, 0, \ | ||
160 | - sve_ld1bb_host, sve_ld1bb_tlb, NULL); \ | ||
161 | + sve_ld1bb_host, sve_ld1bb_tlb); \ | ||
162 | } \ | ||
163 | void HELPER(sve_ld##N##bb_r_mte)(CPUARMState *env, void *vg, \ | ||
164 | target_ulong addr, uint32_t desc) \ | ||
165 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_ld##N##SUFF##_le_r)(CPUARMState *env, void *vg, \ | ||
166 | target_ulong addr, uint32_t desc) \ | ||
167 | { \ | ||
168 | sve_ldN_r(env, vg, addr, desc, GETPC(), ESZ, ESZ, N, 0, \ | ||
169 | - sve_ld1##SUFF##_le_host, sve_ld1##SUFF##_le_tlb, NULL); \ | ||
170 | + sve_ld1##SUFF##_le_host, sve_ld1##SUFF##_le_tlb); \ | ||
171 | } \ | ||
172 | void HELPER(sve_ld##N##SUFF##_be_r)(CPUARMState *env, void *vg, \ | ||
173 | target_ulong addr, uint32_t desc) \ | ||
174 | { \ | ||
175 | sve_ldN_r(env, vg, addr, desc, GETPC(), ESZ, ESZ, N, 0, \ | ||
176 | - sve_ld1##SUFF##_be_host, sve_ld1##SUFF##_be_tlb, NULL); \ | ||
177 | + sve_ld1##SUFF##_be_host, sve_ld1##SUFF##_be_tlb); \ | ||
178 | } \ | ||
179 | void HELPER(sve_ld##N##SUFF##_le_r_mte)(CPUARMState *env, void *vg, \ | ||
180 | target_ulong addr, uint32_t desc) \ | ||
181 | @@ -XXX,XX +XXX,XX @@ void sve_stN_r(CPUARMState *env, uint64_t *vg, target_ulong addr, | ||
182 | uint32_t desc, const uintptr_t retaddr, | ||
183 | const int esz, const int msz, const int N, uint32_t mtedesc, | ||
184 | sve_ldst1_host_fn *host_fn, | ||
185 | - sve_ldst1_tlb_fn *tlb_fn, | ||
186 | - sve_cont_ldst_mte_check_fn *mte_check_fn) | ||
187 | + sve_ldst1_tlb_fn *tlb_fn) | ||
188 | { | ||
189 | const unsigned rd = simd_data(desc); | ||
190 | const intptr_t reg_max = simd_oprsz(desc); | ||
191 | @@ -XXX,XX +XXX,XX @@ void sve_stN_r(CPUARMState *env, uint64_t *vg, target_ulong addr, | ||
192 | * Handle mte checks for all active elements. | ||
193 | * Since TBI must be set for MTE, !mtedesc => !mte_active. | ||
194 | */ | ||
195 | - if (mte_check_fn && mtedesc) { | ||
196 | - mte_check_fn(&info, env, vg, addr, 1 << esz, N << msz, | ||
197 | - mtedesc, retaddr); | ||
198 | + if (mtedesc) { | ||
199 | + sve_cont_ldst_mte_check(&info, env, vg, addr, 1 << esz, N << msz, | ||
200 | + mtedesc, retaddr); | ||
201 | } | ||
202 | |||
203 | flags = info.page[0].flags | info.page[1].flags; | ||
204 | @@ -XXX,XX +XXX,XX @@ void sve_stN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr, | ||
205 | mtedesc = 0; | ||
206 | } | ||
207 | |||
208 | - sve_stN_r(env, vg, addr, desc, ra, esz, msz, N, mtedesc, host_fn, tlb_fn, | ||
209 | - N == 1 ? sve_cont_ldst_mte_check1 : sve_cont_ldst_mte_checkN); | ||
210 | + sve_stN_r(env, vg, addr, desc, ra, esz, msz, N, mtedesc, host_fn, tlb_fn); | ||
211 | } | ||
212 | |||
213 | #define DO_STN_1(N, NAME, ESZ) \ | ||
214 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_st##N##NAME##_r)(CPUARMState *env, void *vg, \ | ||
215 | target_ulong addr, uint32_t desc) \ | ||
216 | { \ | ||
217 | sve_stN_r(env, vg, addr, desc, GETPC(), ESZ, MO_8, N, 0, \ | ||
218 | - sve_st1##NAME##_host, sve_st1##NAME##_tlb, NULL); \ | ||
219 | + sve_st1##NAME##_host, sve_st1##NAME##_tlb); \ | ||
220 | } \ | ||
221 | void HELPER(sve_st##N##NAME##_r_mte)(CPUARMState *env, void *vg, \ | ||
222 | target_ulong addr, uint32_t desc) \ | ||
223 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve_st##N##NAME##_le_r)(CPUARMState *env, void *vg, \ | ||
224 | target_ulong addr, uint32_t desc) \ | ||
225 | { \ | ||
226 | sve_stN_r(env, vg, addr, desc, GETPC(), ESZ, MSZ, N, 0, \ | ||
227 | - sve_st1##NAME##_le_host, sve_st1##NAME##_le_tlb, NULL); \ | ||
228 | + sve_st1##NAME##_le_host, sve_st1##NAME##_le_tlb); \ | ||
229 | } \ | ||
230 | void HELPER(sve_st##N##NAME##_be_r)(CPUARMState *env, void *vg, \ | ||
231 | target_ulong addr, uint32_t desc) \ | ||
232 | { \ | ||
233 | sve_stN_r(env, vg, addr, desc, GETPC(), ESZ, MSZ, N, 0, \ | ||
234 | - sve_st1##NAME##_be_host, sve_st1##NAME##_be_tlb, NULL); \ | ||
235 | + sve_st1##NAME##_be_host, sve_st1##NAME##_be_tlb); \ | ||
236 | } \ | ||
237 | void HELPER(sve_st##N##NAME##_le_r_mte)(CPUARMState *env, void *vg, \ | ||
238 | target_ulong addr, uint32_t desc) \ | ||
239 | -- | 63 | -- |
240 | 2.20.1 | 64 | 2.25.1 |
241 | 65 | ||
242 | 66 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | We do not support instantiating multiple IOMMUs. Before adding a |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | virtio-iommu, check that no other IOMMU is present. This will detect |
5 | Message-id: 20210419202257.161730-25-richard.henderson@linaro.org | 5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. |
6 | |||
7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 13 | --- |
8 | target/arm/translate-neon.c.inc | 48 ++++++++++++++++++++++++++++----- | 14 | hw/arm/virt.c | 5 +++++ |
9 | 1 file changed, 42 insertions(+), 6 deletions(-) | 15 | 1 file changed, 5 insertions(+) |
10 | 16 | ||
11 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
12 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-neon.c.inc | 19 | --- a/hw/arm/virt.c |
14 | +++ b/target/arm/translate-neon.c.inc | 20 | +++ b/hw/arm/virt.c |
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
16 | int nregs = a->n + 1; | 22 | hwaddr db_start = 0, db_end = 0; |
17 | int vd = a->vd; | 23 | char *resv_prop_str; |
18 | TCGv_i32 addr, tmp; | 24 | |
19 | + MemOp mop; | 25 | + if (vms->iommu != VIRT_IOMMU_NONE) { |
20 | 26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); | |
21 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | 27 | + return; |
22 | return false; | ||
23 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
24 | return true; | ||
25 | } | ||
26 | |||
27 | + /* Pick up SCTLR settings */ | ||
28 | + mop = finalize_memop(s, a->size); | ||
29 | + | ||
30 | + if (a->align) { | ||
31 | + MemOp align_op; | ||
32 | + | ||
33 | + switch (nregs) { | ||
34 | + case 1: | ||
35 | + /* For VLD1, use natural alignment. */ | ||
36 | + align_op = MO_ALIGN; | ||
37 | + break; | ||
38 | + case 2: | ||
39 | + /* For VLD2, use double alignment. */ | ||
40 | + align_op = pow2_align(a->size + 1); | ||
41 | + break; | ||
42 | + case 4: | ||
43 | + if (a->size == MO_32) { | ||
44 | + /* | ||
45 | + * For VLD4.32, align = 1 is double alignment, align = 2 is | ||
46 | + * quad alignment; align = 3 is rejected above. | ||
47 | + */ | ||
48 | + align_op = pow2_align(a->size + a->align); | ||
49 | + } else { | ||
50 | + /* For VLD4.8 and VLD.16, we want quad alignment. */ | ||
51 | + align_op = pow2_align(a->size + 2); | ||
52 | + } | ||
53 | + break; | ||
54 | + default: | ||
55 | + /* For VLD3, the alignment field is zero and rejected above. */ | ||
56 | + g_assert_not_reached(); | ||
57 | + } | 28 | + } |
58 | + | 29 | + |
59 | + mop = (mop & ~MO_AMASK) | align_op; | 30 | switch (vms->msi_controller) { |
60 | + } | 31 | case VIRT_MSI_CTRL_NONE: |
61 | + | 32 | return; |
62 | tmp = tcg_temp_new_i32(); | ||
63 | addr = tcg_temp_new_i32(); | ||
64 | load_reg_var(s, addr, a->rn); | ||
65 | - /* | ||
66 | - * TODO: if we implemented alignment exceptions, we should check | ||
67 | - * addr against the alignment encoded in a->align here. | ||
68 | - */ | ||
69 | + | ||
70 | for (reg = 0; reg < nregs; reg++) { | ||
71 | if (a->l) { | ||
72 | - gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), a->size); | ||
73 | + gen_aa32_ld_internal_i32(s, tmp, addr, get_mem_index(s), mop); | ||
74 | neon_store_element(vd, a->reg_idx, a->size, tmp); | ||
75 | } else { /* Store */ | ||
76 | neon_load_element(tmp, vd, a->reg_idx, a->size); | ||
77 | - gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), a->size); | ||
78 | + gen_aa32_st_internal_i32(s, tmp, addr, get_mem_index(s), mop); | ||
79 | } | ||
80 | vd += a->stride; | ||
81 | tcg_gen_addi_i32(addr, addr, 1 << a->size); | ||
82 | + | ||
83 | + /* Subsequent memory operations inherit alignment */ | ||
84 | + mop &= ~MO_AMASK; | ||
85 | } | ||
86 | tcg_temp_free_i32(addr); | ||
87 | tcg_temp_free_i32(tmp); | ||
88 | -- | 33 | -- |
89 | 2.20.1 | 34 | 2.25.1 |
90 | 35 | ||
91 | 36 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | In the case of gpr load, merge the size and is_signed arguments; | 3 | To propagate errors to the caller of the pre_plug callback, use the |
4 | otherwise, simply convert size to memop. | 4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() |
5 | helpers. | ||
5 | 6 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
8 | Message-id: 20210419202257.161730-26-richard.henderson@linaro.org | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20211210170415.583179-5-jean-philippe@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | target/arm/translate-a64.c | 78 ++++++++++++++++---------------------- | 14 | hw/arm/virt.c | 5 +++-- |
12 | 1 file changed, 33 insertions(+), 45 deletions(-) | 15 | 1 file changed, 3 insertions(+), 2 deletions(-) |
13 | 16 | ||
14 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-a64.c | 19 | --- a/hw/arm/virt.c |
17 | +++ b/target/arm/translate-a64.c | 20 | +++ b/hw/arm/virt.c |
18 | @@ -XXX,XX +XXX,XX @@ static void gen_adc_CC(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
19 | * Store from GPR register to memory. | 22 | db_start, db_end, |
20 | */ | 23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); |
21 | static void do_gpr_st_memidx(DisasContext *s, TCGv_i64 source, | 24 | |
22 | - TCGv_i64 tcg_addr, int size, int memidx, | 25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); |
23 | + TCGv_i64 tcg_addr, MemOp memop, int memidx, | 26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); |
24 | bool iss_valid, | 27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); |
25 | unsigned int iss_srt, | 28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", |
26 | bool iss_sf, bool iss_ar) | 29 | + resv_prop_str, errp); |
27 | { | 30 | g_free(resv_prop_str); |
28 | - g_assert(size <= 3); | ||
29 | - tcg_gen_qemu_st_i64(source, tcg_addr, memidx, s->be_data + size); | ||
30 | + memop = finalize_memop(s, memop); | ||
31 | + tcg_gen_qemu_st_i64(source, tcg_addr, memidx, memop); | ||
32 | |||
33 | if (iss_valid) { | ||
34 | uint32_t syn; | ||
35 | |||
36 | syn = syn_data_abort_with_iss(0, | ||
37 | - size, | ||
38 | + (memop & MO_SIZE), | ||
39 | false, | ||
40 | iss_srt, | ||
41 | iss_sf, | ||
42 | @@ -XXX,XX +XXX,XX @@ static void do_gpr_st_memidx(DisasContext *s, TCGv_i64 source, | ||
43 | } | ||
44 | |||
45 | static void do_gpr_st(DisasContext *s, TCGv_i64 source, | ||
46 | - TCGv_i64 tcg_addr, int size, | ||
47 | + TCGv_i64 tcg_addr, MemOp memop, | ||
48 | bool iss_valid, | ||
49 | unsigned int iss_srt, | ||
50 | bool iss_sf, bool iss_ar) | ||
51 | { | ||
52 | - do_gpr_st_memidx(s, source, tcg_addr, size, get_mem_index(s), | ||
53 | + do_gpr_st_memidx(s, source, tcg_addr, memop, get_mem_index(s), | ||
54 | iss_valid, iss_srt, iss_sf, iss_ar); | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * Load from memory to GPR register | ||
59 | */ | ||
60 | -static void do_gpr_ld_memidx(DisasContext *s, | ||
61 | - TCGv_i64 dest, TCGv_i64 tcg_addr, | ||
62 | - int size, bool is_signed, | ||
63 | - bool extend, int memidx, | ||
64 | +static void do_gpr_ld_memidx(DisasContext *s, TCGv_i64 dest, TCGv_i64 tcg_addr, | ||
65 | + MemOp memop, bool extend, int memidx, | ||
66 | bool iss_valid, unsigned int iss_srt, | ||
67 | bool iss_sf, bool iss_ar) | ||
68 | { | ||
69 | - MemOp memop = s->be_data + size; | ||
70 | - | ||
71 | - g_assert(size <= 3); | ||
72 | - | ||
73 | - if (is_signed) { | ||
74 | - memop += MO_SIGN; | ||
75 | - } | ||
76 | - | ||
77 | + memop = finalize_memop(s, memop); | ||
78 | tcg_gen_qemu_ld_i64(dest, tcg_addr, memidx, memop); | ||
79 | |||
80 | - if (extend && is_signed) { | ||
81 | - g_assert(size < 3); | ||
82 | + if (extend && (memop & MO_SIGN)) { | ||
83 | + g_assert((memop & MO_SIZE) <= MO_32); | ||
84 | tcg_gen_ext32u_i64(dest, dest); | ||
85 | } | ||
86 | |||
87 | @@ -XXX,XX +XXX,XX @@ static void do_gpr_ld_memidx(DisasContext *s, | ||
88 | uint32_t syn; | ||
89 | |||
90 | syn = syn_data_abort_with_iss(0, | ||
91 | - size, | ||
92 | - is_signed, | ||
93 | + (memop & MO_SIZE), | ||
94 | + (memop & MO_SIGN) != 0, | ||
95 | iss_srt, | ||
96 | iss_sf, | ||
97 | iss_ar, | ||
98 | @@ -XXX,XX +XXX,XX @@ static void do_gpr_ld_memidx(DisasContext *s, | ||
99 | } | ||
100 | } | ||
101 | |||
102 | -static void do_gpr_ld(DisasContext *s, | ||
103 | - TCGv_i64 dest, TCGv_i64 tcg_addr, | ||
104 | - int size, bool is_signed, bool extend, | ||
105 | +static void do_gpr_ld(DisasContext *s, TCGv_i64 dest, TCGv_i64 tcg_addr, | ||
106 | + MemOp memop, bool extend, | ||
107 | bool iss_valid, unsigned int iss_srt, | ||
108 | bool iss_sf, bool iss_ar) | ||
109 | { | ||
110 | - do_gpr_ld_memidx(s, dest, tcg_addr, size, is_signed, extend, | ||
111 | - get_mem_index(s), | ||
112 | + do_gpr_ld_memidx(s, dest, tcg_addr, memop, extend, get_mem_index(s), | ||
113 | iss_valid, iss_srt, iss_sf, iss_ar); | ||
114 | } | ||
115 | |||
116 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | ||
117 | } | ||
118 | clean_addr = gen_mte_check1(s, cpu_reg_sp(s, rn), | ||
119 | false, rn != 31, size); | ||
120 | - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, false, true, rt, | ||
121 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, true, rt, | ||
122 | disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
123 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
124 | return; | ||
125 | @@ -XXX,XX +XXX,XX @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) | ||
126 | /* Only unsigned 32bit loads target 32bit registers. */ | ||
127 | bool iss_sf = opc != 0; | ||
128 | |||
129 | - do_gpr_ld(s, tcg_rt, clean_addr, size, is_signed, false, | ||
130 | - true, rt, iss_sf, false); | ||
131 | + do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, | ||
132 | + false, true, rt, iss_sf, false); | ||
133 | } | ||
134 | tcg_temp_free_i64(clean_addr); | ||
135 | } | ||
136 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) | ||
137 | /* Do not modify tcg_rt before recognizing any exception | ||
138 | * from the second load. | ||
139 | */ | ||
140 | - do_gpr_ld(s, tmp, clean_addr, size, is_signed, false, | ||
141 | - false, 0, false, false); | ||
142 | + do_gpr_ld(s, tmp, clean_addr, size + is_signed * MO_SIGN, | ||
143 | + false, false, 0, false, false); | ||
144 | tcg_gen_addi_i64(clean_addr, clean_addr, 1 << size); | ||
145 | - do_gpr_ld(s, tcg_rt2, clean_addr, size, is_signed, false, | ||
146 | - false, 0, false, false); | ||
147 | + do_gpr_ld(s, tcg_rt2, clean_addr, size + is_signed * MO_SIGN, | ||
148 | + false, false, 0, false, false); | ||
149 | |||
150 | tcg_gen_mov_i64(tcg_rt, tmp); | ||
151 | tcg_temp_free_i64(tmp); | ||
152 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, | ||
153 | do_gpr_st_memidx(s, tcg_rt, clean_addr, size, memidx, | ||
154 | iss_valid, rt, iss_sf, false); | ||
155 | } else { | ||
156 | - do_gpr_ld_memidx(s, tcg_rt, clean_addr, size, | ||
157 | - is_signed, is_extended, memidx, | ||
158 | + do_gpr_ld_memidx(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, | ||
159 | + is_extended, memidx, | ||
160 | iss_valid, rt, iss_sf, false); | ||
161 | } | ||
162 | } | ||
163 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, | ||
164 | do_gpr_st(s, tcg_rt, clean_addr, size, | ||
165 | true, rt, iss_sf, false); | ||
166 | } else { | ||
167 | - do_gpr_ld(s, tcg_rt, clean_addr, size, | ||
168 | - is_signed, is_extended, | ||
169 | - true, rt, iss_sf, false); | ||
170 | + do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, | ||
171 | + is_extended, true, rt, iss_sf, false); | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, | ||
176 | do_gpr_st(s, tcg_rt, clean_addr, size, | ||
177 | true, rt, iss_sf, false); | ||
178 | } else { | ||
179 | - do_gpr_ld(s, tcg_rt, clean_addr, size, is_signed, is_extended, | ||
180 | - true, rt, iss_sf, false); | ||
181 | + do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, | ||
182 | + is_extended, true, rt, iss_sf, false); | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, | ||
187 | * full load-acquire (we only need "load-acquire processor consistent"), | ||
188 | * but we choose to implement them as full LDAQ. | ||
189 | */ | ||
190 | - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, false, | ||
191 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, | ||
192 | true, rt, disas_ldst_compute_iss_sf(size, false, 0), true); | ||
193 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
194 | return; | ||
195 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn, | ||
196 | is_wback || rn != 31, size); | ||
197 | |||
198 | tcg_rt = cpu_reg(s, rt); | ||
199 | - do_gpr_ld(s, tcg_rt, clean_addr, size, /* is_signed */ false, | ||
200 | + do_gpr_ld(s, tcg_rt, clean_addr, size, | ||
201 | /* extend */ false, /* iss_valid */ !is_wback, | ||
202 | /* iss_srt */ rt, /* iss_sf */ true, /* iss_ar */ false); | ||
203 | |||
204 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn) | ||
205 | * Load-AcquirePC semantics; we implement as the slightly more | ||
206 | * restrictive Load-Acquire. | ||
207 | */ | ||
208 | - do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, is_signed, extend, | ||
209 | - true, rt, iss_sf, true); | ||
210 | + do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size + is_signed * MO_SIGN, | ||
211 | + extend, true, rt, iss_sf, true); | ||
212 | tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); | ||
213 | } | 31 | } |
214 | } | 32 | } |
215 | -- | 33 | -- |
216 | 2.20.1 | 34 | 2.25.1 |
217 | 35 | ||
218 | 36 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Create empty data files and allow updates for the upcoming VIOT tests. |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | |
5 | Message-id: 20210419202257.161730-21-richard.henderson@linaro.org | 5 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
8 | Message-id: 20211210170415.583179-6-jean-philippe@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 10 | --- |
8 | target/arm/translate-vfp.c.inc | 8 ++++---- | 11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
9 | 1 file changed, 4 insertions(+), 4 deletions(-) | 12 | tests/data/acpi/q35/DSDT.viot | 0 |
13 | tests/data/acpi/q35/VIOT.viot | 0 | ||
14 | tests/data/acpi/virt/VIOT | 0 | ||
15 | 4 files changed, 3 insertions(+) | ||
16 | create mode 100644 tests/data/acpi/q35/DSDT.viot | ||
17 | create mode 100644 tests/data/acpi/q35/VIOT.viot | ||
18 | create mode 100644 tests/data/acpi/virt/VIOT | ||
10 | 19 | ||
11 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | 20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
12 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-vfp.c.inc | 22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
14 | +++ b/target/arm/translate-vfp.c.inc | 23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) | 24 | @@ -1 +1,4 @@ |
16 | for (i = 0; i < n; i++) { | 25 | /* List of comma-separated changed AML files to ignore */ |
17 | if (a->l) { | 26 | +"tests/data/acpi/virt/VIOT", |
18 | /* load */ | 27 | +"tests/data/acpi/q35/DSDT.viot", |
19 | - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); | 28 | +"tests/data/acpi/q35/VIOT.viot", |
20 | + gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
21 | vfp_store_reg32(tmp, a->vd + i); | 30 | new file mode 100644 |
22 | } else { | 31 | index XXXXXXX..XXXXXXX |
23 | /* store */ | 32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
24 | vfp_load_reg32(tmp, a->vd + i); | 33 | new file mode 100644 |
25 | - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); | 34 | index XXXXXXX..XXXXXXX |
26 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
27 | } | 36 | new file mode 100644 |
28 | tcg_gen_addi_i32(addr, addr, offset); | 37 | index XXXXXXX..XXXXXXX |
29 | } | ||
30 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) | ||
31 | for (i = 0; i < n; i++) { | ||
32 | if (a->l) { | ||
33 | /* load */ | ||
34 | - gen_aa32_ld64(s, tmp, addr, get_mem_index(s)); | ||
35 | + gen_aa32_ld_i64(s, tmp, addr, get_mem_index(s), MO_Q | MO_ALIGN_4); | ||
36 | vfp_store_reg64(tmp, a->vd + i); | ||
37 | } else { | ||
38 | /* store */ | ||
39 | vfp_load_reg64(tmp, a->vd + i); | ||
40 | - gen_aa32_st64(s, tmp, addr, get_mem_index(s)); | ||
41 | + gen_aa32_st_i64(s, tmp, addr, get_mem_index(s), MO_Q | MO_ALIGN_4); | ||
42 | } | ||
43 | tcg_gen_addi_i32(addr, addr, offset); | ||
44 | } | ||
45 | -- | 38 | -- |
46 | 2.20.1 | 39 | 2.25.1 |
47 | 40 | ||
48 | 41 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We were incorrectly assuming that only the first byte of an MTE access | 3 | Add two test cases for VIOT, one on the q35 machine and the other on |
4 | is checked against the tags. But per the ARM, unaligned accesses are | 4 | virt. To test complex topologies the q35 test has two PCIe buses that |
5 | pre-decomposed into single-byte accesses. So by the time we reach the | 5 | bypass the IOMMU (and are therefore not described by VIOT), and two |
6 | actual MTE check in the ARM pseudocode, all accesses are aligned. | 6 | buses that are translated by virtio-iommu. |
7 | 7 | ||
8 | We cannot tell a priori whether or not a given scalar access is aligned, | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
9 | therefore we must at least check. Use mte_probe_int, which is already | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
10 | set up for checking multiple granules. | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
11 | 11 | Message-id: 20211210170415.583179-7-jean-philippe@linaro.org | |
12 | Buglink: https://bugs.launchpad.net/bugs/1921948 | ||
13 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
14 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | Message-id: 20210416183106.1516563-4-richard.henderson@linaro.org | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 13 | --- |
19 | target/arm/mte_helper.c | 109 +++++++++++++--------------------------- | 14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ |
20 | 1 file changed, 35 insertions(+), 74 deletions(-) | 15 | 1 file changed, 38 insertions(+) |
21 | 16 | ||
22 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | 17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
23 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/mte_helper.c | 19 | --- a/tests/qtest/bios-tables-test.c |
25 | +++ b/target/arm/mte_helper.c | 20 | +++ b/tests/qtest/bios-tables-test.c |
26 | @@ -XXX,XX +XXX,XX @@ static void mte_check_fail(CPUARMState *env, uint32_t desc, | 21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) |
27 | } | 22 | free_test_data(&data); |
28 | } | 23 | } |
29 | 24 | ||
30 | -/* | 25 | +static void test_acpi_q35_viot(void) |
31 | - * Perform an MTE checked access for a single logical or atomic access. | ||
32 | - */ | ||
33 | -static bool mte_probe1_int(CPUARMState *env, uint32_t desc, uint64_t ptr, | ||
34 | - uintptr_t ra, int bit55) | ||
35 | -{ | ||
36 | - int mem_tag, mmu_idx, ptr_tag, size; | ||
37 | - MMUAccessType type; | ||
38 | - uint8_t *mem; | ||
39 | - | ||
40 | - ptr_tag = allocation_tag_from_addr(ptr); | ||
41 | - | ||
42 | - if (tcma_check(desc, bit55, ptr_tag)) { | ||
43 | - return true; | ||
44 | - } | ||
45 | - | ||
46 | - mmu_idx = FIELD_EX32(desc, MTEDESC, MIDX); | ||
47 | - type = FIELD_EX32(desc, MTEDESC, WRITE) ? MMU_DATA_STORE : MMU_DATA_LOAD; | ||
48 | - size = FIELD_EX32(desc, MTEDESC, ESIZE); | ||
49 | - | ||
50 | - mem = allocation_tag_mem(env, mmu_idx, ptr, type, size, | ||
51 | - MMU_DATA_LOAD, 1, ra); | ||
52 | - if (!mem) { | ||
53 | - return true; | ||
54 | - } | ||
55 | - | ||
56 | - mem_tag = load_tag1(ptr, mem); | ||
57 | - return ptr_tag == mem_tag; | ||
58 | -} | ||
59 | - | ||
60 | -/* | ||
61 | - * No-fault version of mte_check1, to be used by SVE for MemSingleNF. | ||
62 | - * Returns false if the access is Checked and the check failed. This | ||
63 | - * is only intended to probe the tag -- the validity of the page must | ||
64 | - * be checked beforehand. | ||
65 | - */ | ||
66 | -bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
67 | -{ | ||
68 | - int bit55 = extract64(ptr, 55, 1); | ||
69 | - | ||
70 | - /* If TBI is disabled, the access is unchecked. */ | ||
71 | - if (unlikely(!tbi_check(desc, bit55))) { | ||
72 | - return true; | ||
73 | - } | ||
74 | - | ||
75 | - return mte_probe1_int(env, desc, ptr, 0, bit55); | ||
76 | -} | ||
77 | - | ||
78 | -uint64_t mte_check1(CPUARMState *env, uint32_t desc, | ||
79 | - uint64_t ptr, uintptr_t ra) | ||
80 | -{ | ||
81 | - int bit55 = extract64(ptr, 55, 1); | ||
82 | - | ||
83 | - /* If TBI is disabled, the access is unchecked, and ptr is not dirty. */ | ||
84 | - if (unlikely(!tbi_check(desc, bit55))) { | ||
85 | - return ptr; | ||
86 | - } | ||
87 | - | ||
88 | - if (unlikely(!mte_probe1_int(env, desc, ptr, ra, bit55))) { | ||
89 | - mte_check_fail(env, desc, ptr, ra); | ||
90 | - } | ||
91 | - | ||
92 | - return useronly_clean_ptr(ptr); | ||
93 | -} | ||
94 | - | ||
95 | -uint64_t HELPER(mte_check1)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
96 | -{ | ||
97 | - return mte_check1(env, desc, ptr, GETPC()); | ||
98 | -} | ||
99 | - | ||
100 | -/* | ||
101 | - * Perform an MTE checked access for multiple logical accesses. | ||
102 | - */ | ||
103 | - | ||
104 | /** | ||
105 | * checkN: | ||
106 | * @tag: tag memory to test | ||
107 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(mte_checkN)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
108 | return mte_checkN(env, desc, ptr, GETPC()); | ||
109 | } | ||
110 | |||
111 | +uint64_t mte_check1(CPUARMState *env, uint32_t desc, | ||
112 | + uint64_t ptr, uintptr_t ra) | ||
113 | +{ | 26 | +{ |
114 | + uint64_t fault; | 27 | + test_data data = { |
115 | + uint32_t total = FIELD_EX32(desc, MTEDESC, ESIZE); | 28 | + .machine = MACHINE_Q35, |
116 | + int ret = mte_probe_int(env, desc, ptr, ra, total, &fault); | 29 | + .variant = ".viot", |
30 | + }; | ||
117 | + | 31 | + |
118 | + if (unlikely(ret == 0)) { | 32 | + /* |
119 | + mte_check_fail(env, desc, fault, ra); | 33 | + * To keep things interesting, two buses bypass the IOMMU. |
120 | + } else if (ret < 0) { | 34 | + * VIOT should only describes the other two buses. |
121 | + return ptr; | 35 | + */ |
122 | + } | 36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " |
123 | + return useronly_clean_ptr(ptr); | 37 | + "-device virtio-iommu-pci " |
38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " | ||
39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " | ||
40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", | ||
41 | + &data); | ||
42 | + free_test_data(&data); | ||
124 | +} | 43 | +} |
125 | + | 44 | + |
126 | +uint64_t HELPER(mte_check1)(CPUARMState *env, uint32_t desc, uint64_t ptr) | 45 | +static void test_acpi_virt_viot(void) |
127 | +{ | 46 | +{ |
128 | + return mte_check1(env, desc, ptr, GETPC()); | 47 | + test_data data = { |
48 | + .machine = "virt", | ||
49 | + .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", | ||
50 | + .uefi_fl2 = "pc-bios/edk2-arm-vars.fd", | ||
51 | + .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", | ||
52 | + .ram_start = 0x40000000ULL, | ||
53 | + .scan_len = 128ULL * 1024 * 1024, | ||
54 | + }; | ||
55 | + | ||
56 | + test_acpi_one("-cpu cortex-a57 " | ||
57 | + "-device virtio-iommu-pci", &data); | ||
58 | + free_test_data(&data); | ||
129 | +} | 59 | +} |
130 | + | 60 | + |
131 | +/* | 61 | static void test_oem_fields(test_data *data) |
132 | + * No-fault version of mte_check1, to be used by SVE for MemSingleNF. | 62 | { |
133 | + * Returns false if the access is Checked and the check failed. This | 63 | int i; |
134 | + * is only intended to probe the tag -- the validity of the page must | 64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
135 | + * be checked beforehand. | 65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); |
136 | + */ | 66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); |
137 | +bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr) | 67 | } |
138 | +{ | 68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); |
139 | + uint64_t fault; | 69 | } else if (strcmp(arch, "aarch64") == 0) { |
140 | + uint32_t total = FIELD_EX32(desc, MTEDESC, ESIZE); | 70 | if (has_tcg) { |
141 | + int ret = mte_probe_int(env, desc, ptr, 0, total, &fault); | 71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); |
142 | + | 72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
143 | + return ret != 0; | 73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); |
144 | +} | 74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); |
145 | + | 75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); |
146 | /* | 76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); |
147 | * Perform an MTE checked access for DC_ZVA. | 77 | } |
148 | */ | 78 | } |
79 | ret = g_test_run(); | ||
149 | -- | 80 | -- |
150 | 2.20.1 | 81 | 2.25.1 |
151 | 82 | ||
152 | 83 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | After recent changes, mte_checkN does not use ESIZE, | ||
4 | and mte_check1 never used TSIZE. We can combine the | ||
5 | two into a single field: SIZEM1. | ||
6 | |||
7 | Choose to pass size - 1 because size == 0 is never used, | ||
8 | our immediate need in mte_probe_int is for the address | ||
9 | of the last byte (ptr + size - 1), and since almost all | ||
10 | operations are powers of 2, this makes the immediate | ||
11 | constant one bit smaller. | ||
12 | |||
13 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
14 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20210416183106.1516563-6-richard.henderson@linaro.org | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | target/arm/internals.h | 4 ++-- | ||
19 | target/arm/mte_helper.c | 18 ++++++++---------- | ||
20 | target/arm/translate-a64.c | 5 ++--- | ||
21 | target/arm/translate-sve.c | 5 ++--- | ||
22 | 4 files changed, 14 insertions(+), 18 deletions(-) | ||
23 | |||
24 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/target/arm/internals.h | ||
27 | +++ b/target/arm/internals.h | ||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | #define TARGET_ARM_INTERNALS_H | ||
30 | |||
31 | #include "hw/registerfields.h" | ||
32 | +#include "tcg/tcg-gvec-desc.h" | ||
33 | #include "syndrome.h" | ||
34 | |||
35 | /* register banks for CPU modes */ | ||
36 | @@ -XXX,XX +XXX,XX @@ FIELD(MTEDESC, MIDX, 0, 4) | ||
37 | FIELD(MTEDESC, TBI, 4, 2) | ||
38 | FIELD(MTEDESC, TCMA, 6, 2) | ||
39 | FIELD(MTEDESC, WRITE, 8, 1) | ||
40 | -FIELD(MTEDESC, ESIZE, 9, 5) | ||
41 | -FIELD(MTEDESC, TSIZE, 14, 10) /* mte_checkN only */ | ||
42 | +FIELD(MTEDESC, SIZEM1, 9, SIMD_DATA_BITS - 9) /* size - 1 */ | ||
43 | |||
44 | bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr); | ||
45 | uint64_t mte_check1(CPUARMState *env, uint32_t desc, | ||
46 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/mte_helper.c | ||
49 | +++ b/target/arm/mte_helper.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static int checkN(uint8_t *mem, int odd, int cmp, int count) | ||
51 | * Return positive on success with tbi enabled. | ||
52 | */ | ||
53 | static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr, | ||
54 | - uintptr_t ra, uint32_t total, uint64_t *fault) | ||
55 | + uintptr_t ra, uint64_t *fault) | ||
56 | { | ||
57 | int mmu_idx, ptr_tag, bit55; | ||
58 | uint64_t ptr_last, prev_page, next_page; | ||
59 | uint64_t tag_first, tag_last; | ||
60 | uint64_t tag_byte_first, tag_byte_last; | ||
61 | - uint32_t tag_count, tag_size, n, c; | ||
62 | + uint32_t sizem1, tag_count, tag_size, n, c; | ||
63 | uint8_t *mem1, *mem2; | ||
64 | MMUAccessType type; | ||
65 | |||
66 | @@ -XXX,XX +XXX,XX @@ static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr, | ||
67 | |||
68 | mmu_idx = FIELD_EX32(desc, MTEDESC, MIDX); | ||
69 | type = FIELD_EX32(desc, MTEDESC, WRITE) ? MMU_DATA_STORE : MMU_DATA_LOAD; | ||
70 | + sizem1 = FIELD_EX32(desc, MTEDESC, SIZEM1); | ||
71 | |||
72 | /* Find the addr of the end of the access */ | ||
73 | - ptr_last = ptr + total - 1; | ||
74 | + ptr_last = ptr + sizem1; | ||
75 | |||
76 | /* Round the bounds to the tag granule, and compute the number of tags. */ | ||
77 | tag_first = QEMU_ALIGN_DOWN(ptr, TAG_GRANULE); | ||
78 | @@ -XXX,XX +XXX,XX @@ static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr, | ||
79 | if (likely(tag_last - prev_page <= TARGET_PAGE_SIZE)) { | ||
80 | /* Memory access stays on one page. */ | ||
81 | tag_size = ((tag_byte_last - tag_byte_first) / (2 * TAG_GRANULE)) + 1; | ||
82 | - mem1 = allocation_tag_mem(env, mmu_idx, ptr, type, total, | ||
83 | + mem1 = allocation_tag_mem(env, mmu_idx, ptr, type, sizem1 + 1, | ||
84 | MMU_DATA_LOAD, tag_size, ra); | ||
85 | if (!mem1) { | ||
86 | return 1; | ||
87 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
88 | uint64_t ptr, uintptr_t ra) | ||
89 | { | ||
90 | uint64_t fault; | ||
91 | - uint32_t total = FIELD_EX32(desc, MTEDESC, TSIZE); | ||
92 | - int ret = mte_probe_int(env, desc, ptr, ra, total, &fault); | ||
93 | + int ret = mte_probe_int(env, desc, ptr, ra, &fault); | ||
94 | |||
95 | if (unlikely(ret == 0)) { | ||
96 | mte_check_fail(env, desc, fault, ra); | ||
97 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_check1(CPUARMState *env, uint32_t desc, | ||
98 | uint64_t ptr, uintptr_t ra) | ||
99 | { | ||
100 | uint64_t fault; | ||
101 | - uint32_t total = FIELD_EX32(desc, MTEDESC, ESIZE); | ||
102 | - int ret = mte_probe_int(env, desc, ptr, ra, total, &fault); | ||
103 | + int ret = mte_probe_int(env, desc, ptr, ra, &fault); | ||
104 | |||
105 | if (unlikely(ret == 0)) { | ||
106 | mte_check_fail(env, desc, fault, ra); | ||
107 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(mte_check1)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
108 | bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
109 | { | ||
110 | uint64_t fault; | ||
111 | - uint32_t total = FIELD_EX32(desc, MTEDESC, ESIZE); | ||
112 | - int ret = mte_probe_int(env, desc, ptr, 0, total, &fault); | ||
113 | + int ret = mte_probe_int(env, desc, ptr, 0, &fault); | ||
114 | |||
115 | return ret != 0; | ||
116 | } | ||
117 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
118 | index XXXXXXX..XXXXXXX 100644 | ||
119 | --- a/target/arm/translate-a64.c | ||
120 | +++ b/target/arm/translate-a64.c | ||
121 | @@ -XXX,XX +XXX,XX @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, | ||
122 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
123 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
124 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
125 | - desc = FIELD_DP32(desc, MTEDESC, ESIZE, 1 << log2_size); | ||
126 | + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << log2_size) - 1); | ||
127 | tcg_desc = tcg_const_i32(desc); | ||
128 | |||
129 | ret = new_tmp_a64(s); | ||
130 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
131 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
132 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
133 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
134 | - desc = FIELD_DP32(desc, MTEDESC, ESIZE, 1 << log2_esize); | ||
135 | - desc = FIELD_DP32(desc, MTEDESC, TSIZE, total_size); | ||
136 | + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); | ||
137 | tcg_desc = tcg_const_i32(desc); | ||
138 | |||
139 | ret = new_tmp_a64(s); | ||
140 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
141 | index XXXXXXX..XXXXXXX 100644 | ||
142 | --- a/target/arm/translate-sve.c | ||
143 | +++ b/target/arm/translate-sve.c | ||
144 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, | ||
145 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
146 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
147 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
148 | - desc = FIELD_DP32(desc, MTEDESC, ESIZE, 1 << msz); | ||
149 | - desc = FIELD_DP32(desc, MTEDESC, TSIZE, mte_n << msz); | ||
150 | + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (mte_n << msz) - 1); | ||
151 | desc <<= SVE_MTEDESC_SHIFT; | ||
152 | } else { | ||
153 | addr = clean_data_tbi(s, addr); | ||
154 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, | ||
155 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
156 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
157 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
158 | - desc = FIELD_DP32(desc, MTEDESC, ESIZE, 1 << msz); | ||
159 | + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << msz) - 1); | ||
160 | desc <<= SVE_MTEDESC_SHIFT; | ||
161 | } | ||
162 | desc = simd_desc(vsz, vsz, desc | scale); | ||
163 | -- | ||
164 | 2.20.1 | ||
165 | |||
166 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | The mte_check1 and mte_checkN functions are now identical. | ||
4 | Drop mte_check1 and rename mte_checkN to mte_check. | ||
5 | |||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210416183106.1516563-7-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/helper-a64.h | 3 +-- | ||
12 | target/arm/internals.h | 5 +---- | ||
13 | target/arm/mte_helper.c | 26 +++----------------------- | ||
14 | target/arm/sve_helper.c | 14 +++++++------- | ||
15 | target/arm/translate-a64.c | 4 ++-- | ||
16 | 5 files changed, 14 insertions(+), 38 deletions(-) | ||
17 | |||
18 | diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/helper-a64.h | ||
21 | +++ b/target/arm/helper-a64.h | ||
22 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(autdb, TCG_CALL_NO_WG, i64, env, i64, i64) | ||
23 | DEF_HELPER_FLAGS_2(xpaci, TCG_CALL_NO_RWG_SE, i64, env, i64) | ||
24 | DEF_HELPER_FLAGS_2(xpacd, TCG_CALL_NO_RWG_SE, i64, env, i64) | ||
25 | |||
26 | -DEF_HELPER_FLAGS_3(mte_check1, TCG_CALL_NO_WG, i64, env, i32, i64) | ||
27 | -DEF_HELPER_FLAGS_3(mte_checkN, TCG_CALL_NO_WG, i64, env, i32, i64) | ||
28 | +DEF_HELPER_FLAGS_3(mte_check, TCG_CALL_NO_WG, i64, env, i32, i64) | ||
29 | DEF_HELPER_FLAGS_3(mte_check_zva, TCG_CALL_NO_WG, i64, env, i32, i64) | ||
30 | DEF_HELPER_FLAGS_3(irg, TCG_CALL_NO_RWG, i64, env, i64, i64) | ||
31 | DEF_HELPER_FLAGS_4(addsubg, TCG_CALL_NO_RWG_SE, i64, env, i64, s32, i32) | ||
32 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/internals.h | ||
35 | +++ b/target/arm/internals.h | ||
36 | @@ -XXX,XX +XXX,XX @@ FIELD(MTEDESC, WRITE, 8, 1) | ||
37 | FIELD(MTEDESC, SIZEM1, 9, SIMD_DATA_BITS - 9) /* size - 1 */ | ||
38 | |||
39 | bool mte_probe1(CPUARMState *env, uint32_t desc, uint64_t ptr); | ||
40 | -uint64_t mte_check1(CPUARMState *env, uint32_t desc, | ||
41 | - uint64_t ptr, uintptr_t ra); | ||
42 | -uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
43 | - uint64_t ptr, uintptr_t ra); | ||
44 | +uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra); | ||
45 | |||
46 | static inline int allocation_tag_from_addr(uint64_t ptr) | ||
47 | { | ||
48 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/target/arm/mte_helper.c | ||
51 | +++ b/target/arm/mte_helper.c | ||
52 | @@ -XXX,XX +XXX,XX @@ static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr, | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | -uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
57 | - uint64_t ptr, uintptr_t ra) | ||
58 | +uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra) | ||
59 | { | ||
60 | uint64_t fault; | ||
61 | int ret = mte_probe_int(env, desc, ptr, ra, &fault); | ||
62 | @@ -XXX,XX +XXX,XX @@ uint64_t mte_checkN(CPUARMState *env, uint32_t desc, | ||
63 | return useronly_clean_ptr(ptr); | ||
64 | } | ||
65 | |||
66 | -uint64_t HELPER(mte_checkN)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
67 | +uint64_t HELPER(mte_check)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
68 | { | ||
69 | - return mte_checkN(env, desc, ptr, GETPC()); | ||
70 | -} | ||
71 | - | ||
72 | -uint64_t mte_check1(CPUARMState *env, uint32_t desc, | ||
73 | - uint64_t ptr, uintptr_t ra) | ||
74 | -{ | ||
75 | - uint64_t fault; | ||
76 | - int ret = mte_probe_int(env, desc, ptr, ra, &fault); | ||
77 | - | ||
78 | - if (unlikely(ret == 0)) { | ||
79 | - mte_check_fail(env, desc, fault, ra); | ||
80 | - } else if (ret < 0) { | ||
81 | - return ptr; | ||
82 | - } | ||
83 | - return useronly_clean_ptr(ptr); | ||
84 | -} | ||
85 | - | ||
86 | -uint64_t HELPER(mte_check1)(CPUARMState *env, uint32_t desc, uint64_t ptr) | ||
87 | -{ | ||
88 | - return mte_check1(env, desc, ptr, GETPC()); | ||
89 | + return mte_check(env, desc, ptr, GETPC()); | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/target/arm/sve_helper.c | ||
96 | +++ b/target/arm/sve_helper.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static void sve_cont_ldst_mte_check1(SVEContLdSt *info, CPUARMState *env, | ||
98 | uintptr_t ra) | ||
99 | { | ||
100 | sve_cont_ldst_mte_check_int(info, env, vg, addr, esize, msize, | ||
101 | - mtedesc, ra, mte_check1); | ||
102 | + mtedesc, ra, mte_check); | ||
103 | } | ||
104 | |||
105 | static void sve_cont_ldst_mte_checkN(SVEContLdSt *info, CPUARMState *env, | ||
106 | @@ -XXX,XX +XXX,XX @@ static void sve_cont_ldst_mte_checkN(SVEContLdSt *info, CPUARMState *env, | ||
107 | uintptr_t ra) | ||
108 | { | ||
109 | sve_cont_ldst_mte_check_int(info, env, vg, addr, esize, msize, | ||
110 | - mtedesc, ra, mte_checkN); | ||
111 | + mtedesc, ra, mte_check); | ||
112 | } | ||
113 | |||
114 | |||
115 | @@ -XXX,XX +XXX,XX @@ void sve_ldnfff1_r(CPUARMState *env, void *vg, const target_ulong addr, | ||
116 | if (fault == FAULT_FIRST) { | ||
117 | /* Trapping mte check for the first-fault element. */ | ||
118 | if (mtedesc) { | ||
119 | - mte_check1(env, mtedesc, addr + mem_off, retaddr); | ||
120 | + mte_check(env, mtedesc, addr + mem_off, retaddr); | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | @@ -XXX,XX +XXX,XX @@ void sve_ld1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, | ||
125 | info.attrs, BP_MEM_READ, retaddr); | ||
126 | } | ||
127 | if (mtedesc && arm_tlb_mte_tagged(&info.attrs)) { | ||
128 | - mte_check1(env, mtedesc, addr, retaddr); | ||
129 | + mte_check(env, mtedesc, addr, retaddr); | ||
130 | } | ||
131 | host_fn(&scratch, reg_off, info.host); | ||
132 | } else { | ||
133 | @@ -XXX,XX +XXX,XX @@ void sve_ld1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, | ||
134 | BP_MEM_READ, retaddr); | ||
135 | } | ||
136 | if (mtedesc && arm_tlb_mte_tagged(&info.attrs)) { | ||
137 | - mte_check1(env, mtedesc, addr, retaddr); | ||
138 | + mte_check(env, mtedesc, addr, retaddr); | ||
139 | } | ||
140 | tlb_fn(env, &scratch, reg_off, addr, retaddr); | ||
141 | } | ||
142 | @@ -XXX,XX +XXX,XX @@ void sve_ldff1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, | ||
143 | */ | ||
144 | addr = base + (off_fn(vm, reg_off) << scale); | ||
145 | if (mtedesc) { | ||
146 | - mte_check1(env, mtedesc, addr, retaddr); | ||
147 | + mte_check(env, mtedesc, addr, retaddr); | ||
148 | } | ||
149 | tlb_fn(env, vd, reg_off, addr, retaddr); | ||
150 | |||
151 | @@ -XXX,XX +XXX,XX @@ void sve_st1_z(CPUARMState *env, void *vd, uint64_t *vg, void *vm, | ||
152 | } | ||
153 | |||
154 | if (mtedesc && arm_tlb_mte_tagged(&info.attrs)) { | ||
155 | - mte_check1(env, mtedesc, addr, retaddr); | ||
156 | + mte_check(env, mtedesc, addr, retaddr); | ||
157 | } | ||
158 | } | ||
159 | i += 1; | ||
160 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
161 | index XXXXXXX..XXXXXXX 100644 | ||
162 | --- a/target/arm/translate-a64.c | ||
163 | +++ b/target/arm/translate-a64.c | ||
164 | @@ -XXX,XX +XXX,XX @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, | ||
165 | tcg_desc = tcg_const_i32(desc); | ||
166 | |||
167 | ret = new_tmp_a64(s); | ||
168 | - gen_helper_mte_check1(ret, cpu_env, tcg_desc, addr); | ||
169 | + gen_helper_mte_check(ret, cpu_env, tcg_desc, addr); | ||
170 | tcg_temp_free_i32(tcg_desc); | ||
171 | |||
172 | return ret; | ||
173 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
174 | tcg_desc = tcg_const_i32(desc); | ||
175 | |||
176 | ret = new_tmp_a64(s); | ||
177 | - gen_helper_mte_checkN(ret, cpu_env, tcg_desc, addr); | ||
178 | + gen_helper_mte_check(ret, cpu_env, tcg_desc, addr); | ||
179 | tcg_temp_free_i32(tcg_desc); | ||
180 | |||
181 | return ret; | ||
182 | -- | ||
183 | 2.20.1 | ||
184 | |||
185 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | The log2_esize parameter is not used except trivially. | ||
4 | Drop the parameter and the deferral to gen_mte_check1. | ||
5 | |||
6 | This fixes a bug in that the parameters as documented | ||
7 | in the header file were the reverse from those in the | ||
8 | implementation. Which meant that translate-sve.c was | ||
9 | passing the parameters in the wrong order. | ||
10 | |||
11 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20210416183106.1516563-10-richard.henderson@linaro.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | target/arm/translate-a64.h | 2 +- | ||
17 | target/arm/translate-a64.c | 15 +++++++-------- | ||
18 | target/arm/translate-sve.c | 4 ++-- | ||
19 | 3 files changed, 10 insertions(+), 11 deletions(-) | ||
20 | |||
21 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/target/arm/translate-a64.h | ||
24 | +++ b/target/arm/translate-a64.h | ||
25 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr); | ||
26 | TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
27 | bool tag_checked, int log2_size); | ||
28 | TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
29 | - bool tag_checked, int count, int log2_esize); | ||
30 | + bool tag_checked, int size); | ||
31 | |||
32 | /* We should have at some point before trying to access an FP register | ||
33 | * done the necessary access check, so assert that | ||
34 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/arm/translate-a64.c | ||
37 | +++ b/target/arm/translate-a64.c | ||
38 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
39 | * For MTE, check multiple logical sequential accesses. | ||
40 | */ | ||
41 | TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
42 | - bool tag_checked, int log2_esize, int total_size) | ||
43 | + bool tag_checked, int size) | ||
44 | { | ||
45 | - if (tag_checked && s->mte_active[0] && total_size != (1 << log2_esize)) { | ||
46 | + if (tag_checked && s->mte_active[0]) { | ||
47 | TCGv_i32 tcg_desc; | ||
48 | TCGv_i64 ret; | ||
49 | int desc = 0; | ||
50 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
51 | desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); | ||
52 | desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); | ||
53 | desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); | ||
54 | - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); | ||
55 | + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, size - 1); | ||
56 | tcg_desc = tcg_const_i32(desc); | ||
57 | |||
58 | ret = new_tmp_a64(s); | ||
59 | @@ -XXX,XX +XXX,XX @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, | ||
60 | |||
61 | return ret; | ||
62 | } | ||
63 | - return gen_mte_check1(s, addr, is_write, tag_checked, log2_esize); | ||
64 | + return clean_data_tbi(s, addr); | ||
65 | } | ||
66 | |||
67 | typedef struct DisasCompare64 { | ||
68 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) | ||
69 | } | ||
70 | |||
71 | clean_addr = gen_mte_checkN(s, dirty_addr, !is_load, | ||
72 | - (wback || rn != 31) && !set_tag, | ||
73 | - size, 2 << size); | ||
74 | + (wback || rn != 31) && !set_tag, 2 << size); | ||
75 | |||
76 | if (is_vector) { | ||
77 | if (is_load) { | ||
78 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) | ||
79 | * promote consecutive little-endian elements below. | ||
80 | */ | ||
81 | clean_addr = gen_mte_checkN(s, tcg_rn, is_store, is_postidx || rn != 31, | ||
82 | - size, total); | ||
83 | + total); | ||
84 | |||
85 | /* | ||
86 | * Consecutive little-endian elements from a single register | ||
87 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) | ||
88 | tcg_rn = cpu_reg_sp(s, rn); | ||
89 | |||
90 | clean_addr = gen_mte_checkN(s, tcg_rn, !is_load, is_postidx || rn != 31, | ||
91 | - scale, total); | ||
92 | + total); | ||
93 | |||
94 | tcg_ebytes = tcg_const_i64(1 << scale); | ||
95 | for (xs = 0; xs < selem; xs++) { | ||
96 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/target/arm/translate-sve.c | ||
99 | +++ b/target/arm/translate-sve.c | ||
100 | @@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) | ||
101 | |||
102 | dirty_addr = tcg_temp_new_i64(); | ||
103 | tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); | ||
104 | - clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len, MO_8); | ||
105 | + clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len); | ||
106 | tcg_temp_free_i64(dirty_addr); | ||
107 | |||
108 | /* | ||
109 | @@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) | ||
110 | |||
111 | dirty_addr = tcg_temp_new_i64(); | ||
112 | tcg_gen_addi_i64(dirty_addr, cpu_reg_sp(s, rn), imm); | ||
113 | - clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len, MO_8); | ||
114 | + clean_addr = gen_mte_checkN(s, dirty_addr, false, rn != 31, len); | ||
115 | tcg_temp_free_i64(dirty_addr); | ||
116 | |||
117 | /* Note that unpredicated load/store of vector/predicate registers | ||
118 | -- | ||
119 | 2.20.1 | ||
120 | |||
121 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | The encoding of size = 2 and size = 3 had the incorrect decode | ||
4 | for align, overlapping the stride field. This error was hidden | ||
5 | by what should have been unnecessary masking in translate. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20210419202257.161730-2-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/neon-ls.decode | 4 ++-- | ||
13 | target/arm/translate-neon.c.inc | 4 ++-- | ||
14 | 2 files changed, 4 insertions(+), 4 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/neon-ls.decode | ||
19 | +++ b/target/arm/neon-ls.decode | ||
20 | @@ -XXX,XX +XXX,XX @@ VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \ | ||
21 | |||
22 | VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 00 n:2 reg_idx:3 align:1 rm:4 \ | ||
23 | vd=%vd_dp size=0 stride=1 | ||
24 | -VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 align:2 rm:4 \ | ||
25 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 . align:1 rm:4 \ | ||
26 | vd=%vd_dp size=1 stride=%imm1_5_p1 | ||
27 | -VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 10 n:2 reg_idx:1 align:3 rm:4 \ | ||
28 | +VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 10 n:2 reg_idx:1 . align:2 rm:4 \ | ||
29 | vd=%vd_dp size=2 stride=%imm1_6_p1 | ||
30 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/translate-neon.c.inc | ||
33 | +++ b/target/arm/translate-neon.c.inc | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
35 | switch (nregs) { | ||
36 | case 1: | ||
37 | if (((a->align & (1 << a->size)) != 0) || | ||
38 | - (a->size == 2 && ((a->align & 3) == 1 || (a->align & 3) == 2))) { | ||
39 | + (a->size == 2 && (a->align == 1 || a->align == 2))) { | ||
40 | return false; | ||
41 | } | ||
42 | break; | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a) | ||
44 | } | ||
45 | break; | ||
46 | case 4: | ||
47 | - if ((a->size == 2) && ((a->align & 3) == 3)) { | ||
48 | + if (a->size == 2 && a->align == 3) { | ||
49 | return false; | ||
50 | } | ||
51 | break; | ||
52 | -- | ||
53 | 2.20.1 | ||
54 | |||
55 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | We're about to rearrange the macro expansion surrounding tbflags, | ||
4 | and this field name will be expanded using the bit definition of | ||
5 | the same name, resulting in a token pasting error. | ||
6 | |||
7 | So SCTLR_B -> SCTLR__B in the 3 uses, and document it. | ||
8 | |||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20210419202257.161730-3-richard.henderson@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/cpu.h | 2 +- | ||
15 | target/arm/helper.c | 2 +- | ||
16 | target/arm/translate.c | 2 +- | ||
17 | 3 files changed, 3 insertions(+), 3 deletions(-) | ||
18 | |||
19 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/cpu.h | ||
22 | +++ b/target/arm/cpu.h | ||
23 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, VECSTRIDE, 12, 2) /* Not cached. */ | ||
24 | */ | ||
25 | FIELD(TBFLAG_A32, XSCALE_CPAR, 12, 2) | ||
26 | FIELD(TBFLAG_A32, VFPEN, 14, 1) /* Partially cached, minus FPEXC. */ | ||
27 | -FIELD(TBFLAG_A32, SCTLR_B, 15, 1) | ||
28 | +FIELD(TBFLAG_A32, SCTLR__B, 15, 1) /* Cannot overlap with SCTLR_B */ | ||
29 | FIELD(TBFLAG_A32, HSTR_ACTIVE, 16, 1) | ||
30 | /* | ||
31 | * Indicates whether cp register reads and writes by guest code should access | ||
32 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/helper.c | ||
35 | +++ b/target/arm/helper.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
37 | bool sctlr_b = arm_sctlr_b(env); | ||
38 | |||
39 | if (sctlr_b) { | ||
40 | - flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, 1); | ||
41 | + flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR__B, 1); | ||
42 | } | ||
43 | if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) { | ||
44 | flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
45 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/target/arm/translate.c | ||
48 | +++ b/target/arm/translate.c | ||
49 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
50 | FIELD_EX32(tb_flags, TBFLAG_ANY, BE_DATA) ? MO_BE : MO_LE; | ||
51 | dc->debug_target_el = | ||
52 | FIELD_EX32(tb_flags, TBFLAG_ANY, DEBUG_TARGET_EL); | ||
53 | - dc->sctlr_b = FIELD_EX32(tb_flags, TBFLAG_A32, SCTLR_B); | ||
54 | + dc->sctlr_b = FIELD_EX32(tb_flags, TBFLAG_A32, SCTLR__B); | ||
55 | dc->hstr_active = FIELD_EX32(tb_flags, TBFLAG_A32, HSTR_ACTIVE); | ||
56 | dc->ns = FIELD_EX32(tb_flags, TBFLAG_A32, NS); | ||
57 | dc->vfp_enabled = FIELD_EX32(tb_flags, TBFLAG_A32, VFPEN); | ||
58 | -- | ||
59 | 2.20.1 | ||
60 | |||
61 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | In preparation for splitting tb->flags across multiple | ||
4 | fields, introduce a structure to hold the value(s). | ||
5 | So far this only migrates the one uint32_t and fixes | ||
6 | all of the places that require adjustment to match. | ||
7 | |||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210419202257.161730-6-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/arm/cpu.h | 26 ++++++++++++--------- | ||
14 | target/arm/translate.h | 11 +++++++++ | ||
15 | target/arm/helper.c | 48 +++++++++++++++++++++----------------- | ||
16 | target/arm/translate-a64.c | 2 +- | ||
17 | target/arm/translate.c | 7 +++--- | ||
18 | 5 files changed, 57 insertions(+), 37 deletions(-) | ||
19 | |||
20 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/arm/cpu.h | ||
23 | +++ b/target/arm/cpu.h | ||
24 | @@ -XXX,XX +XXX,XX @@ typedef struct ARMPACKey { | ||
25 | } ARMPACKey; | ||
26 | #endif | ||
27 | |||
28 | +/* See the commentary above the TBFLAG field definitions. */ | ||
29 | +typedef struct CPUARMTBFlags { | ||
30 | + uint32_t flags; | ||
31 | +} CPUARMTBFlags; | ||
32 | |||
33 | typedef struct CPUARMState { | ||
34 | /* Regs for current mode. */ | ||
35 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
36 | uint32_t aarch64; /* 1 if CPU is in aarch64 state; inverse of PSTATE.nRW */ | ||
37 | |||
38 | /* Cached TBFLAGS state. See below for which bits are included. */ | ||
39 | - uint32_t hflags; | ||
40 | + CPUARMTBFlags hflags; | ||
41 | |||
42 | /* Frequently accessed CPSR bits are stored separately for efficiency. | ||
43 | This contains all the other bits. Use cpsr_{read,write} to access | ||
44 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) | ||
45 | * Helpers for using the above. | ||
46 | */ | ||
47 | #define DP_TBFLAG_ANY(DST, WHICH, VAL) \ | ||
48 | - (DST = FIELD_DP32(DST, TBFLAG_ANY, WHICH, VAL)) | ||
49 | + (DST.flags = FIELD_DP32(DST.flags, TBFLAG_ANY, WHICH, VAL)) | ||
50 | #define DP_TBFLAG_A64(DST, WHICH, VAL) \ | ||
51 | - (DST = FIELD_DP32(DST, TBFLAG_A64, WHICH, VAL)) | ||
52 | + (DST.flags = FIELD_DP32(DST.flags, TBFLAG_A64, WHICH, VAL)) | ||
53 | #define DP_TBFLAG_A32(DST, WHICH, VAL) \ | ||
54 | - (DST = FIELD_DP32(DST, TBFLAG_A32, WHICH, VAL)) | ||
55 | + (DST.flags = FIELD_DP32(DST.flags, TBFLAG_A32, WHICH, VAL)) | ||
56 | #define DP_TBFLAG_M32(DST, WHICH, VAL) \ | ||
57 | - (DST = FIELD_DP32(DST, TBFLAG_M32, WHICH, VAL)) | ||
58 | + (DST.flags = FIELD_DP32(DST.flags, TBFLAG_M32, WHICH, VAL)) | ||
59 | #define DP_TBFLAG_AM32(DST, WHICH, VAL) \ | ||
60 | - (DST = FIELD_DP32(DST, TBFLAG_AM32, WHICH, VAL)) | ||
61 | + (DST.flags = FIELD_DP32(DST.flags, TBFLAG_AM32, WHICH, VAL)) | ||
62 | |||
63 | -#define EX_TBFLAG_ANY(IN, WHICH) FIELD_EX32(IN, TBFLAG_ANY, WHICH) | ||
64 | -#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN, TBFLAG_A64, WHICH) | ||
65 | -#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN, TBFLAG_A32, WHICH) | ||
66 | -#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN, TBFLAG_M32, WHICH) | ||
67 | -#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN, TBFLAG_AM32, WHICH) | ||
68 | +#define EX_TBFLAG_ANY(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_ANY, WHICH) | ||
69 | +#define EX_TBFLAG_A64(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_A64, WHICH) | ||
70 | +#define EX_TBFLAG_A32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_A32, WHICH) | ||
71 | +#define EX_TBFLAG_M32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_M32, WHICH) | ||
72 | +#define EX_TBFLAG_AM32(IN, WHICH) FIELD_EX32(IN.flags, TBFLAG_AM32, WHICH) | ||
73 | |||
74 | /** | ||
75 | * cpu_mmu_index: | ||
76 | diff --git a/target/arm/translate.h b/target/arm/translate.h | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/target/arm/translate.h | ||
79 | +++ b/target/arm/translate.h | ||
80 | @@ -XXX,XX +XXX,XX @@ typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32); | ||
81 | typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr); | ||
82 | typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp); | ||
83 | |||
84 | +/** | ||
85 | + * arm_tbflags_from_tb: | ||
86 | + * @tb: the TranslationBlock | ||
87 | + * | ||
88 | + * Extract the flag values from @tb. | ||
89 | + */ | ||
90 | +static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb) | ||
91 | +{ | ||
92 | + return (CPUARMTBFlags){ tb->flags }; | ||
93 | +} | ||
94 | + | ||
95 | /* | ||
96 | * Enum for argument to fpstatus_ptr(). | ||
97 | */ | ||
98 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/target/arm/helper.c | ||
101 | +++ b/target/arm/helper.c | ||
102 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) | ||
103 | } | ||
104 | #endif | ||
105 | |||
106 | -static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
107 | - ARMMMUIdx mmu_idx, uint32_t flags) | ||
108 | +static CPUARMTBFlags rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
109 | + ARMMMUIdx mmu_idx, | ||
110 | + CPUARMTBFlags flags) | ||
111 | { | ||
112 | DP_TBFLAG_ANY(flags, FPEXC_EL, fp_el); | ||
113 | DP_TBFLAG_ANY(flags, MMUIDX, arm_to_core_mmu_idx(mmu_idx)); | ||
114 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
115 | return flags; | ||
116 | } | ||
117 | |||
118 | -static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
119 | - ARMMMUIdx mmu_idx, uint32_t flags) | ||
120 | +static CPUARMTBFlags rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
121 | + ARMMMUIdx mmu_idx, | ||
122 | + CPUARMTBFlags flags) | ||
123 | { | ||
124 | bool sctlr_b = arm_sctlr_b(env); | ||
125 | |||
126 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
127 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
128 | } | ||
129 | |||
130 | -static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
131 | - ARMMMUIdx mmu_idx) | ||
132 | +static CPUARMTBFlags rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
133 | + ARMMMUIdx mmu_idx) | ||
134 | { | ||
135 | - uint32_t flags = 0; | ||
136 | + CPUARMTBFlags flags = {}; | ||
137 | |||
138 | if (arm_v7m_is_handler_mode(env)) { | ||
139 | DP_TBFLAG_M32(flags, HANDLER, 1); | ||
140 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
141 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | ||
142 | } | ||
143 | |||
144 | -static uint32_t rebuild_hflags_aprofile(CPUARMState *env) | ||
145 | +static CPUARMTBFlags rebuild_hflags_aprofile(CPUARMState *env) | ||
146 | { | ||
147 | - int flags = 0; | ||
148 | + CPUARMTBFlags flags = {}; | ||
149 | |||
150 | DP_TBFLAG_ANY(flags, DEBUG_TARGET_EL, arm_debug_target_el(env)); | ||
151 | return flags; | ||
152 | } | ||
153 | |||
154 | -static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
155 | - ARMMMUIdx mmu_idx) | ||
156 | +static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
157 | + ARMMMUIdx mmu_idx) | ||
158 | { | ||
159 | - uint32_t flags = rebuild_hflags_aprofile(env); | ||
160 | + CPUARMTBFlags flags = rebuild_hflags_aprofile(env); | ||
161 | |||
162 | if (arm_el_is_aa64(env, 1)) { | ||
163 | DP_TBFLAG_A32(flags, VFPEN, 1); | ||
164 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
165 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | ||
166 | } | ||
167 | |||
168 | -static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
169 | - ARMMMUIdx mmu_idx) | ||
170 | +static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
171 | + ARMMMUIdx mmu_idx) | ||
172 | { | ||
173 | - uint32_t flags = rebuild_hflags_aprofile(env); | ||
174 | + CPUARMTBFlags flags = rebuild_hflags_aprofile(env); | ||
175 | ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx); | ||
176 | uint64_t tcr = regime_tcr(env, mmu_idx)->raw_tcr; | ||
177 | uint64_t sctlr; | ||
178 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
179 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
180 | } | ||
181 | |||
182 | -static uint32_t rebuild_hflags_internal(CPUARMState *env) | ||
183 | +static CPUARMTBFlags rebuild_hflags_internal(CPUARMState *env) | ||
184 | { | ||
185 | int el = arm_current_el(env); | ||
186 | int fp_el = fp_exception_el(env, el); | ||
187 | @@ -XXX,XX +XXX,XX @@ void HELPER(rebuild_hflags_m32_newel)(CPUARMState *env) | ||
188 | int el = arm_current_el(env); | ||
189 | int fp_el = fp_exception_el(env, el); | ||
190 | ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el); | ||
191 | + | ||
192 | env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx); | ||
193 | } | ||
194 | |||
195 | @@ -XXX,XX +XXX,XX @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el) | ||
196 | static inline void assert_hflags_rebuild_correctly(CPUARMState *env) | ||
197 | { | ||
198 | #ifdef CONFIG_DEBUG_TCG | ||
199 | - uint32_t env_flags_current = env->hflags; | ||
200 | - uint32_t env_flags_rebuilt = rebuild_hflags_internal(env); | ||
201 | + CPUARMTBFlags c = env->hflags; | ||
202 | + CPUARMTBFlags r = rebuild_hflags_internal(env); | ||
203 | |||
204 | - if (unlikely(env_flags_current != env_flags_rebuilt)) { | ||
205 | + if (unlikely(c.flags != r.flags)) { | ||
206 | fprintf(stderr, "TCG hflags mismatch (current:0x%08x rebuilt:0x%08x)\n", | ||
207 | - env_flags_current, env_flags_rebuilt); | ||
208 | + c.flags, r.flags); | ||
209 | abort(); | ||
210 | } | ||
211 | #endif | ||
212 | @@ -XXX,XX +XXX,XX @@ static inline void assert_hflags_rebuild_correctly(CPUARMState *env) | ||
213 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
214 | target_ulong *cs_base, uint32_t *pflags) | ||
215 | { | ||
216 | - uint32_t flags = env->hflags; | ||
217 | + CPUARMTBFlags flags; | ||
218 | |||
219 | *cs_base = 0; | ||
220 | assert_hflags_rebuild_correctly(env); | ||
221 | + flags = env->hflags; | ||
222 | |||
223 | if (EX_TBFLAG_ANY(flags, AARCH64_STATE)) { | ||
224 | *pc = env->pc; | ||
225 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
226 | DP_TBFLAG_ANY(flags, PSTATE__SS, 1); | ||
227 | } | ||
228 | |||
229 | - *pflags = flags; | ||
230 | + *pflags = flags.flags; | ||
231 | } | ||
232 | |||
233 | #ifdef TARGET_AARCH64 | ||
234 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
235 | index XXXXXXX..XXXXXXX 100644 | ||
236 | --- a/target/arm/translate-a64.c | ||
237 | +++ b/target/arm/translate-a64.c | ||
238 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, | ||
239 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
240 | CPUARMState *env = cpu->env_ptr; | ||
241 | ARMCPU *arm_cpu = env_archcpu(env); | ||
242 | - uint32_t tb_flags = dc->base.tb->flags; | ||
243 | + CPUARMTBFlags tb_flags = arm_tbflags_from_tb(dc->base.tb); | ||
244 | int bound, core_mmu_idx; | ||
245 | |||
246 | dc->isar = &arm_cpu->isar; | ||
247 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
248 | index XXXXXXX..XXXXXXX 100644 | ||
249 | --- a/target/arm/translate.c | ||
250 | +++ b/target/arm/translate.c | ||
251 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
252 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
253 | CPUARMState *env = cs->env_ptr; | ||
254 | ARMCPU *cpu = env_archcpu(env); | ||
255 | - uint32_t tb_flags = dc->base.tb->flags; | ||
256 | + CPUARMTBFlags tb_flags = arm_tbflags_from_tb(dc->base.tb); | ||
257 | uint32_t condexec, core_mmu_idx; | ||
258 | |||
259 | dc->isar = &cpu->isar; | ||
260 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int max_insns) | ||
261 | { | ||
262 | DisasContext dc = { }; | ||
263 | const TranslatorOps *ops = &arm_translator_ops; | ||
264 | + CPUARMTBFlags tb_flags = arm_tbflags_from_tb(tb); | ||
265 | |||
266 | - if (EX_TBFLAG_AM32(tb->flags, THUMB)) { | ||
267 | + if (EX_TBFLAG_AM32(tb_flags, THUMB)) { | ||
268 | ops = &thumb_translator_ops; | ||
269 | } | ||
270 | #ifdef TARGET_AARCH64 | ||
271 | - if (EX_TBFLAG_ANY(tb->flags, AARCH64_STATE)) { | ||
272 | + if (EX_TBFLAG_ANY(tb_flags, AARCH64_STATE)) { | ||
273 | ops = &aarch64_translator_ops; | ||
274 | } | ||
275 | #endif | ||
276 | -- | ||
277 | 2.20.1 | ||
278 | |||
279 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Now that these bits have been moved out of tb->flags, | ||
4 | where TBFLAG_ANY was filling from the top, move AM32 | ||
5 | to fill from the top, and A32 and M32 to fill from the | ||
6 | bottom. This means fewer changes when adding new bits. | ||
7 | |||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210419202257.161730-9-richard.henderson@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | target/arm/cpu.h | 42 +++++++++++++++++++++--------------------- | ||
14 | 1 file changed, 21 insertions(+), 21 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/cpu.h | ||
19 | +++ b/target/arm/cpu.h | ||
20 | @@ -XXX,XX +XXX,XX @@ typedef ARMCPU ArchCPU; | ||
21 | * | ||
22 | * The bits for 32-bit A-profile and M-profile partially overlap: | ||
23 | * | ||
24 | - * 18 9 0 | ||
25 | - * +----------------+--------------+ | ||
26 | - * | TBFLAG_A32 | | | ||
27 | - * +-----+----------+ TBFLAG_AM32 | | ||
28 | - * | |TBFLAG_M32| | | ||
29 | - * +-----+----------+--------------+ | ||
30 | - * 14 9 0 | ||
31 | + * 31 23 11 10 0 | ||
32 | + * +-------------+----------+----------------+ | ||
33 | + * | | | TBFLAG_A32 | | ||
34 | + * | TBFLAG_AM32 | +-----+----------+ | ||
35 | + * | | |TBFLAG_M32| | ||
36 | + * +-------------+----------------+----------+ | ||
37 | + * 31 23 5 4 0 | ||
38 | * | ||
39 | * Unless otherwise noted, these bits are cached in env->hflags. | ||
40 | */ | ||
41 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 20, 2) | ||
42 | /* | ||
43 | * Bit usage when in AArch32 state, both A- and M-profile. | ||
44 | */ | ||
45 | -FIELD(TBFLAG_AM32, CONDEXEC, 0, 8) /* Not cached. */ | ||
46 | -FIELD(TBFLAG_AM32, THUMB, 8, 1) /* Not cached. */ | ||
47 | +FIELD(TBFLAG_AM32, CONDEXEC, 24, 8) /* Not cached. */ | ||
48 | +FIELD(TBFLAG_AM32, THUMB, 23, 1) /* Not cached. */ | ||
49 | |||
50 | /* | ||
51 | * Bit usage when in AArch32 state, for A-profile only. | ||
52 | */ | ||
53 | -FIELD(TBFLAG_A32, VECLEN, 9, 3) /* Not cached. */ | ||
54 | -FIELD(TBFLAG_A32, VECSTRIDE, 12, 2) /* Not cached. */ | ||
55 | +FIELD(TBFLAG_A32, VECLEN, 0, 3) /* Not cached. */ | ||
56 | +FIELD(TBFLAG_A32, VECSTRIDE, 3, 2) /* Not cached. */ | ||
57 | /* | ||
58 | * We store the bottom two bits of the CPAR as TB flags and handle | ||
59 | * checks on the other bits at runtime. This shares the same bits as | ||
60 | * VECSTRIDE, which is OK as no XScale CPU has VFP. | ||
61 | * Not cached, because VECLEN+VECSTRIDE are not cached. | ||
62 | */ | ||
63 | -FIELD(TBFLAG_A32, XSCALE_CPAR, 12, 2) | ||
64 | -FIELD(TBFLAG_A32, VFPEN, 14, 1) /* Partially cached, minus FPEXC. */ | ||
65 | -FIELD(TBFLAG_A32, SCTLR__B, 15, 1) /* Cannot overlap with SCTLR_B */ | ||
66 | -FIELD(TBFLAG_A32, HSTR_ACTIVE, 16, 1) | ||
67 | +FIELD(TBFLAG_A32, XSCALE_CPAR, 5, 2) | ||
68 | +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Partially cached, minus FPEXC. */ | ||
69 | +FIELD(TBFLAG_A32, SCTLR__B, 8, 1) /* Cannot overlap with SCTLR_B */ | ||
70 | +FIELD(TBFLAG_A32, HSTR_ACTIVE, 9, 1) | ||
71 | /* | ||
72 | * Indicates whether cp register reads and writes by guest code should access | ||
73 | * the secure or nonsecure bank of banked registers; note that this is not | ||
74 | * the same thing as the current security state of the processor! | ||
75 | */ | ||
76 | -FIELD(TBFLAG_A32, NS, 17, 1) | ||
77 | +FIELD(TBFLAG_A32, NS, 10, 1) | ||
78 | |||
79 | /* | ||
80 | * Bit usage when in AArch32 state, for M-profile only. | ||
81 | */ | ||
82 | /* Handler (ie not Thread) mode */ | ||
83 | -FIELD(TBFLAG_M32, HANDLER, 9, 1) | ||
84 | +FIELD(TBFLAG_M32, HANDLER, 0, 1) | ||
85 | /* Whether we should generate stack-limit checks */ | ||
86 | -FIELD(TBFLAG_M32, STACKCHECK, 10, 1) | ||
87 | +FIELD(TBFLAG_M32, STACKCHECK, 1, 1) | ||
88 | /* Set if FPCCR.LSPACT is set */ | ||
89 | -FIELD(TBFLAG_M32, LSPACT, 11, 1) /* Not cached. */ | ||
90 | +FIELD(TBFLAG_M32, LSPACT, 2, 1) /* Not cached. */ | ||
91 | /* Set if we must create a new FP context */ | ||
92 | -FIELD(TBFLAG_M32, NEW_FP_CTXT_NEEDED, 12, 1) /* Not cached. */ | ||
93 | +FIELD(TBFLAG_M32, NEW_FP_CTXT_NEEDED, 3, 1) /* Not cached. */ | ||
94 | /* Set if FPCCR.S does not match current security state */ | ||
95 | -FIELD(TBFLAG_M32, FPCCR_S_WRONG, 13, 1) /* Not cached. */ | ||
96 | +FIELD(TBFLAG_M32, FPCCR_S_WRONG, 4, 1) /* Not cached. */ | ||
97 | |||
98 | /* | ||
99 | * Bit usage when in AArch64 state | ||
100 | -- | ||
101 | 2.20.1 | ||
102 | |||
103 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Now that other bits have been moved out of tb->flags, | ||
4 | there's no point in filling from the top. | ||
5 | |||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20210419202257.161730-10-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/cpu.h | 14 +++++++------- | ||
12 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/cpu.h | ||
17 | +++ b/target/arm/cpu.h | ||
18 | @@ -XXX,XX +XXX,XX @@ typedef ARMCPU ArchCPU; | ||
19 | * | ||
20 | * Unless otherwise noted, these bits are cached in env->hflags. | ||
21 | */ | ||
22 | -FIELD(TBFLAG_ANY, AARCH64_STATE, 31, 1) | ||
23 | -FIELD(TBFLAG_ANY, SS_ACTIVE, 30, 1) | ||
24 | -FIELD(TBFLAG_ANY, PSTATE__SS, 29, 1) /* Not cached. */ | ||
25 | -FIELD(TBFLAG_ANY, BE_DATA, 28, 1) | ||
26 | -FIELD(TBFLAG_ANY, MMUIDX, 24, 4) | ||
27 | +FIELD(TBFLAG_ANY, AARCH64_STATE, 0, 1) | ||
28 | +FIELD(TBFLAG_ANY, SS_ACTIVE, 1, 1) | ||
29 | +FIELD(TBFLAG_ANY, PSTATE__SS, 2, 1) /* Not cached. */ | ||
30 | +FIELD(TBFLAG_ANY, BE_DATA, 3, 1) | ||
31 | +FIELD(TBFLAG_ANY, MMUIDX, 4, 4) | ||
32 | /* Target EL if we take a floating-point-disabled exception */ | ||
33 | -FIELD(TBFLAG_ANY, FPEXC_EL, 22, 2) | ||
34 | +FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) | ||
35 | /* For A-profile only, target EL for debug exceptions. */ | ||
36 | -FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 20, 2) | ||
37 | +FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 10, 2) | ||
38 | |||
39 | /* | ||
40 | * Bit usage when in AArch32 state, both A- and M-profile. | ||
41 | -- | ||
42 | 2.20.1 | ||
43 | |||
44 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20210419202257.161730-18-richard.henderson@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/translate.c | 4 ++-- | ||
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
10 | |||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/translate.c | ||
14 | +++ b/target/arm/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
16 | } else { | ||
17 | tmp = load_reg(s, i); | ||
18 | } | ||
19 | - gen_aa32_st32(s, tmp, addr, mem_idx); | ||
20 | + gen_aa32_st_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
21 | tcg_temp_free_i32(tmp); | ||
22 | |||
23 | /* No need to add after the last transfer. */ | ||
24 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
25 | } | ||
26 | |||
27 | tmp = tcg_temp_new_i32(); | ||
28 | - gen_aa32_ld32u(s, tmp, addr, mem_idx); | ||
29 | + gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); | ||
30 | if (user) { | ||
31 | tmp2 = tcg_const_i32(i); | ||
32 | gen_helper_set_user_reg(cpu_env, tmp2, tmp); | ||
33 | -- | ||
34 | 2.20.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | q35 machine. |
5 | Message-id: 20210419202257.161730-20-richard.henderson@linaro.org | 5 | |
6 | Since the test instantiates a virtio device and two PCIe expander | ||
7 | bridges, DSDT.viot has more blocks than the base DSDT. | ||
8 | |||
9 | The VIOT table generated for the q35 test is: | ||
10 | |||
11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | ||
12 | [004h 0004 4] Table Length : 00000070 | ||
13 | [008h 0008 1] Revision : 00 | ||
14 | [009h 0009 1] Checksum : 3D | ||
15 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
16 | [010h 0016 8] Oem Table ID : "BXPC " | ||
17 | [018h 0024 4] Oem Revision : 00000001 | ||
18 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
19 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
20 | |||
21 | [024h 0036 2] Node count : 0003 | ||
22 | [026h 0038 2] Node offset : 0030 | ||
23 | [028h 0040 8] Reserved : 0000000000000000 | ||
24 | |||
25 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
26 | [031h 0049 1] Reserved : 00 | ||
27 | [032h 0050 2] Length : 0010 | ||
28 | |||
29 | [034h 0052 2] PCI Segment : 0000 | ||
30 | [036h 0054 2] PCI BDF number : 0010 | ||
31 | [038h 0056 8] Reserved : 0000000000000000 | ||
32 | |||
33 | [040h 0064 1] Type : 01 [PCI Range] | ||
34 | [041h 0065 1] Reserved : 00 | ||
35 | [042h 0066 2] Length : 0018 | ||
36 | |||
37 | [044h 0068 4] Endpoint start : 00003000 | ||
38 | [048h 0072 2] PCI Segment start : 0000 | ||
39 | [04Ah 0074 2] PCI Segment end : 0000 | ||
40 | [04Ch 0076 2] PCI BDF start : 3000 | ||
41 | [04Eh 0078 2] PCI BDF end : 30FF | ||
42 | [050h 0080 2] Output node : 0030 | ||
43 | [052h 0082 6] Reserved : 000000000000 | ||
44 | |||
45 | [058h 0088 1] Type : 01 [PCI Range] | ||
46 | [059h 0089 1] Reserved : 00 | ||
47 | [05Ah 0090 2] Length : 0018 | ||
48 | |||
49 | [05Ch 0092 4] Endpoint start : 00001000 | ||
50 | [060h 0096 2] PCI Segment start : 0000 | ||
51 | [062h 0098 2] PCI Segment end : 0000 | ||
52 | [064h 0100 2] PCI BDF start : 1000 | ||
53 | [066h 0102 2] PCI BDF end : 10FF | ||
54 | [068h 0104 2] Output node : 0030 | ||
55 | [06Ah 0106 6] Reserved : 000000000000 | ||
56 | |||
57 | And the DSDT diff is: | ||
58 | |||
59 | @@ -XXX,XX +XXX,XX @@ | ||
60 | * | ||
61 | * Disassembling to symbolic ASL+ operators | ||
62 | * | ||
63 | - * Disassembly of tests/data/acpi/q35/DSDT, Fri Dec 10 15:03:08 2021 | ||
64 | + * Disassembly of /tmp/aml-H9Y5D1, Fri Dec 10 15:02:27 2021 | ||
65 | * | ||
66 | * Original Table Header: | ||
67 | * Signature "DSDT" | ||
68 | - * Length 0x00002061 (8289) | ||
69 | + * Length 0x000024B6 (9398) | ||
70 | * Revision 0x01 **** 32-bit table (V1), no 64-bit math support | ||
71 | - * Checksum 0xFA | ||
72 | + * Checksum 0xA7 | ||
73 | * OEM ID "BOCHS " | ||
74 | * OEM Table ID "BXPC " | ||
75 | * OEM Revision 0x00000001 (1) | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | } | ||
78 | } | ||
79 | |||
80 | + Scope (\_SB) | ||
81 | + { | ||
82 | + Device (PC30) | ||
83 | + { | ||
84 | + Name (_UID, 0x30) // _UID: Unique ID | ||
85 | + Name (_BBN, 0x30) // _BBN: BIOS Bus Number | ||
86 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
87 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
88 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
89 | + { | ||
90 | + CreateDWordField (Arg3, Zero, CDW1) | ||
91 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
92 | + { | ||
93 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
94 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
95 | + Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */ | ||
96 | + Local0 &= 0x1F | ||
97 | + If ((Arg1 != One)) | ||
98 | + { | ||
99 | + CDW1 |= 0x08 | ||
100 | + } | ||
101 | + | ||
102 | + If ((CDW3 != Local0)) | ||
103 | + { | ||
104 | + CDW1 |= 0x10 | ||
105 | + } | ||
106 | + | ||
107 | + CDW3 = Local0 | ||
108 | + } | ||
109 | + Else | ||
110 | + { | ||
111 | + CDW1 |= 0x04 | ||
112 | + } | ||
113 | + | ||
114 | + Return (Arg3) | ||
115 | + } | ||
116 | + | ||
117 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
118 | + { | ||
119 | + Local0 = Package (0x80){} | ||
120 | + Local1 = Zero | ||
121 | + While ((Local1 < 0x80)) | ||
122 | + { | ||
123 | + Local2 = (Local1 >> 0x02) | ||
124 | + Local3 = ((Local1 + Local2) & 0x03) | ||
125 | + If ((Local3 == Zero)) | ||
126 | + { | ||
127 | + Local4 = Package (0x04) | ||
128 | + { | ||
129 | + Zero, | ||
130 | + Zero, | ||
131 | + LNKD, | ||
132 | + Zero | ||
133 | + } | ||
134 | + } | ||
135 | + | ||
136 | + If ((Local3 == One)) | ||
137 | + { | ||
138 | + Local4 = Package (0x04) | ||
139 | + { | ||
140 | + Zero, | ||
141 | + Zero, | ||
142 | + LNKA, | ||
143 | + Zero | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + If ((Local3 == 0x02)) | ||
148 | + { | ||
149 | + Local4 = Package (0x04) | ||
150 | + { | ||
151 | + Zero, | ||
152 | + Zero, | ||
153 | + LNKB, | ||
154 | + Zero | ||
155 | + } | ||
156 | + } | ||
157 | + | ||
158 | + If ((Local3 == 0x03)) | ||
159 | + { | ||
160 | + Local4 = Package (0x04) | ||
161 | + { | ||
162 | + Zero, | ||
163 | + Zero, | ||
164 | + LNKC, | ||
165 | + Zero | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
170 | + Local4 [One] = (Local1 & 0x03) | ||
171 | + Local0 [Local1] = Local4 | ||
172 | + Local1++ | ||
173 | + } | ||
174 | + | ||
175 | + Return (Local0) | ||
176 | + } | ||
177 | + | ||
178 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
179 | + { | ||
180 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
181 | + 0x0000, // Granularity | ||
182 | + 0x0030, // Range Minimum | ||
183 | + 0x0030, // Range Maximum | ||
184 | + 0x0000, // Translation Offset | ||
185 | + 0x0001, // Length | ||
186 | + ,, ) | ||
187 | + }) | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + Scope (\_SB) | ||
192 | + { | ||
193 | + Device (PC20) | ||
194 | + { | ||
195 | + Name (_UID, 0x20) // _UID: Unique ID | ||
196 | + Name (_BBN, 0x20) // _BBN: BIOS Bus Number | ||
197 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
198 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
199 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
200 | + { | ||
201 | + CreateDWordField (Arg3, Zero, CDW1) | ||
202 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
203 | + { | ||
204 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
205 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
206 | + Local0 = CDW3 /* \_SB_.PC20._OSC.CDW3 */ | ||
207 | + Local0 &= 0x1F | ||
208 | + If ((Arg1 != One)) | ||
209 | + { | ||
210 | + CDW1 |= 0x08 | ||
211 | + } | ||
212 | + | ||
213 | + If ((CDW3 != Local0)) | ||
214 | + { | ||
215 | + CDW1 |= 0x10 | ||
216 | + } | ||
217 | + | ||
218 | + CDW3 = Local0 | ||
219 | + } | ||
220 | + Else | ||
221 | + { | ||
222 | + CDW1 |= 0x04 | ||
223 | + } | ||
224 | + | ||
225 | + Return (Arg3) | ||
226 | + } | ||
227 | + | ||
228 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
229 | + { | ||
230 | + Local0 = Package (0x80){} | ||
231 | + Local1 = Zero | ||
232 | + While ((Local1 < 0x80)) | ||
233 | + { | ||
234 | + Local2 = (Local1 >> 0x02) | ||
235 | + Local3 = ((Local1 + Local2) & 0x03) | ||
236 | + If ((Local3 == Zero)) | ||
237 | + { | ||
238 | + Local4 = Package (0x04) | ||
239 | + { | ||
240 | + Zero, | ||
241 | + Zero, | ||
242 | + LNKD, | ||
243 | + Zero | ||
244 | + } | ||
245 | + } | ||
246 | + | ||
247 | + If ((Local3 == One)) | ||
248 | + { | ||
249 | + Local4 = Package (0x04) | ||
250 | + { | ||
251 | + Zero, | ||
252 | + Zero, | ||
253 | + LNKA, | ||
254 | + Zero | ||
255 | + } | ||
256 | + } | ||
257 | + | ||
258 | + If ((Local3 == 0x02)) | ||
259 | + { | ||
260 | + Local4 = Package (0x04) | ||
261 | + { | ||
262 | + Zero, | ||
263 | + Zero, | ||
264 | + LNKB, | ||
265 | + Zero | ||
266 | + } | ||
267 | + } | ||
268 | + | ||
269 | + If ((Local3 == 0x03)) | ||
270 | + { | ||
271 | + Local4 = Package (0x04) | ||
272 | + { | ||
273 | + Zero, | ||
274 | + Zero, | ||
275 | + LNKC, | ||
276 | + Zero | ||
277 | + } | ||
278 | + } | ||
279 | + | ||
280 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
281 | + Local4 [One] = (Local1 & 0x03) | ||
282 | + Local0 [Local1] = Local4 | ||
283 | + Local1++ | ||
284 | + } | ||
285 | + | ||
286 | + Return (Local0) | ||
287 | + } | ||
288 | + | ||
289 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
290 | + { | ||
291 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
292 | + 0x0000, // Granularity | ||
293 | + 0x0020, // Range Minimum | ||
294 | + 0x0020, // Range Maximum | ||
295 | + 0x0000, // Translation Offset | ||
296 | + 0x0001, // Length | ||
297 | + ,, ) | ||
298 | + }) | ||
299 | + } | ||
300 | + } | ||
301 | + | ||
302 | + Scope (\_SB) | ||
303 | + { | ||
304 | + Device (PC10) | ||
305 | + { | ||
306 | + Name (_UID, 0x10) // _UID: Unique ID | ||
307 | + Name (_BBN, 0x10) // _BBN: BIOS Bus Number | ||
308 | + Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID | ||
309 | + Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID | ||
310 | + Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities | ||
311 | + { | ||
312 | + CreateDWordField (Arg3, Zero, CDW1) | ||
313 | + If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)) | ||
314 | + { | ||
315 | + CreateDWordField (Arg3, 0x04, CDW2) | ||
316 | + CreateDWordField (Arg3, 0x08, CDW3) | ||
317 | + Local0 = CDW3 /* \_SB_.PC10._OSC.CDW3 */ | ||
318 | + Local0 &= 0x1F | ||
319 | + If ((Arg1 != One)) | ||
320 | + { | ||
321 | + CDW1 |= 0x08 | ||
322 | + } | ||
323 | + | ||
324 | + If ((CDW3 != Local0)) | ||
325 | + { | ||
326 | + CDW1 |= 0x10 | ||
327 | + } | ||
328 | + | ||
329 | + CDW3 = Local0 | ||
330 | + } | ||
331 | + Else | ||
332 | + { | ||
333 | + CDW1 |= 0x04 | ||
334 | + } | ||
335 | + | ||
336 | + Return (Arg3) | ||
337 | + } | ||
338 | + | ||
339 | + Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table | ||
340 | + { | ||
341 | + Local0 = Package (0x80){} | ||
342 | + Local1 = Zero | ||
343 | + While ((Local1 < 0x80)) | ||
344 | + { | ||
345 | + Local2 = (Local1 >> 0x02) | ||
346 | + Local3 = ((Local1 + Local2) & 0x03) | ||
347 | + If ((Local3 == Zero)) | ||
348 | + { | ||
349 | + Local4 = Package (0x04) | ||
350 | + { | ||
351 | + Zero, | ||
352 | + Zero, | ||
353 | + LNKD, | ||
354 | + Zero | ||
355 | + } | ||
356 | + } | ||
357 | + | ||
358 | + If ((Local3 == One)) | ||
359 | + { | ||
360 | + Local4 = Package (0x04) | ||
361 | + { | ||
362 | + Zero, | ||
363 | + Zero, | ||
364 | + LNKA, | ||
365 | + Zero | ||
366 | + } | ||
367 | + } | ||
368 | + | ||
369 | + If ((Local3 == 0x02)) | ||
370 | + { | ||
371 | + Local4 = Package (0x04) | ||
372 | + { | ||
373 | + Zero, | ||
374 | + Zero, | ||
375 | + LNKB, | ||
376 | + Zero | ||
377 | + } | ||
378 | + } | ||
379 | + | ||
380 | + If ((Local3 == 0x03)) | ||
381 | + { | ||
382 | + Local4 = Package (0x04) | ||
383 | + { | ||
384 | + Zero, | ||
385 | + Zero, | ||
386 | + LNKC, | ||
387 | + Zero | ||
388 | + } | ||
389 | + } | ||
390 | + | ||
391 | + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) | ||
392 | + Local4 [One] = (Local1 & 0x03) | ||
393 | + Local0 [Local1] = Local4 | ||
394 | + Local1++ | ||
395 | + } | ||
396 | + | ||
397 | + Return (Local0) | ||
398 | + } | ||
399 | + | ||
400 | + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
401 | + { | ||
402 | + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
403 | + 0x0000, // Granularity | ||
404 | + 0x0010, // Range Minimum | ||
405 | + 0x0010, // Range Maximum | ||
406 | + 0x0000, // Translation Offset | ||
407 | + 0x0001, // Length | ||
408 | + ,, ) | ||
409 | + }) | ||
410 | + } | ||
411 | + } | ||
412 | + | ||
413 | Scope (\_SB.PCI0) | ||
414 | { | ||
415 | Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings | ||
416 | @@ -XXX,XX +XXX,XX @@ | ||
417 | WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, | ||
418 | 0x0000, // Granularity | ||
419 | 0x0000, // Range Minimum | ||
420 | - 0x00FF, // Range Maximum | ||
421 | + 0x000F, // Range Maximum | ||
422 | 0x0000, // Translation Offset | ||
423 | - 0x0100, // Length | ||
424 | + 0x0010, // Length | ||
425 | ,, ) | ||
426 | IO (Decode16, | ||
427 | 0x0CF8, // Range Minimum | ||
428 | @@ -XXX,XX +XXX,XX @@ | ||
429 | } | ||
430 | } | ||
431 | |||
432 | + Device (S10) | ||
433 | + { | ||
434 | + Name (_ADR, 0x00020000) // _ADR: Address | ||
435 | + } | ||
436 | + | ||
437 | + Device (S18) | ||
438 | + { | ||
439 | + Name (_ADR, 0x00030000) // _ADR: Address | ||
440 | + } | ||
441 | + | ||
442 | + Device (S20) | ||
443 | + { | ||
444 | + Name (_ADR, 0x00040000) // _ADR: Address | ||
445 | + } | ||
446 | + | ||
447 | + Device (S28) | ||
448 | + { | ||
449 | + Name (_ADR, 0x00050000) // _ADR: Address | ||
450 | + } | ||
451 | + | ||
452 | Method (PCNT, 0, NotSerialized) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
457 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
458 | Message-id: 20211210170415.583179-8-jean-philippe@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 459 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 460 | --- |
8 | target/arm/translate.c | 4 ++-- | 461 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 462 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes |
10 | 463 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | |
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 464 | 3 files changed, 2 deletions(-) |
465 | |||
466 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | 467 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate.c | 468 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
14 | +++ b/target/arm/translate.c | 469 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
15 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | 470 | @@ -XXX,XX +XXX,XX @@ |
16 | } | 471 | /* List of comma-separated changed AML files to ignore */ |
17 | tcg_gen_addi_i32(addr, addr, offset); | 472 | "tests/data/acpi/virt/VIOT", |
18 | tmp = load_reg(s, 14); | 473 | -"tests/data/acpi/q35/DSDT.viot", |
19 | - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); | 474 | -"tests/data/acpi/q35/VIOT.viot", |
20 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 475 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
21 | tcg_temp_free_i32(tmp); | 476 | index XXXXXXX..XXXXXXX 100644 |
22 | tmp = load_cpu_field(spsr); | 477 | GIT binary patch |
23 | tcg_gen_addi_i32(addr, addr, 4); | 478 | literal 9398 |
24 | - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); | 479 | zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_ |
25 | + gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 480 | z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C |
26 | tcg_temp_free_i32(tmp); | 481 | zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN |
27 | if (writeback) { | 482 | zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1 |
28 | switch (amode) { | 483 | zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS |
484 | zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~# | ||
485 | z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW% | ||
486 | z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^ | ||
487 | z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG | ||
488 | z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm | ||
489 | znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8 | ||
490 | zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn | ||
491 | zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l | ||
492 | zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?)) | ||
493 | zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N | ||
494 | zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-< | ||
495 | z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ | ||
496 | z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4 | ||
497 | zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_ | ||
498 | zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^= | ||
499 | zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn>< | ||
500 | zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w} | ||
501 | zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t | ||
502 | zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3 | ||
503 | zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`& | ||
504 | zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V | ||
505 | zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq| | ||
506 | zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO< | ||
507 | zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf | ||
508 | zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb} | ||
509 | zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC | ||
510 | z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_# | ||
511 | zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4 | ||
512 | z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0 | ||
513 | zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T | ||
514 | zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq | ||
515 | zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp | ||
516 | zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a | ||
517 | zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD | ||
518 | zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l | ||
519 | zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5 | ||
520 | z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON | ||
521 | zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P> | ||
522 | zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s | ||
523 | zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q | ||
524 | z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ | ||
525 | zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N | ||
526 | z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D= | ||
527 | zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P | ||
528 | zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF | ||
529 | z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4 | ||
530 | z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6 | ||
531 | zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG | ||
532 | z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi | ||
533 | zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr | ||
534 | zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l? | ||
535 | zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG | ||
536 | zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a | ||
537 | zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl | ||
538 | zarZy6590|88pi(1zq;V(>38zM0sT&<zX;R5$1w3;`_JMG`;&I&0Y23DMx1%@(w(R9 | ||
539 | z4M$j;D5J+Gy%fijRQsctzFKf&cv|BAz#YLq3CZJWDdtL4u1u1|mkdcUp7|sxJC+?Y | ||
540 | z_@@s`v3j}Q7*z>6X~cwUxUL8G1KT)_XTp!KAbs;vCp{K3&~_X@+ew=-D}v`2MbFV0 | ||
541 | zQsVsL=rXi-pI*G|iiz;VTCutgUs)hDzV1+4?8KcoP3xROf<M%qC6lgVdpFt4<-|uM | ||
542 | z=#rl_b1#YjSIl6Toj2z_hOZcKupkdE(LozC(fN=FY(x|sk)ym|;Rq2E1xJWD%Z!ol | ||
543 | Gu>S+TT-130 | ||
544 | |||
545 | literal 0 | ||
546 | HcmV?d00001 | ||
547 | |||
548 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot | ||
549 | index XXXXXXX..XXXXXXX 100644 | ||
550 | GIT binary patch | ||
551 | literal 112 | ||
552 | zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj | ||
553 | Q0Zb)W9Hva*zW_`e0M!8s0RR91 | ||
554 | |||
555 | literal 0 | ||
556 | HcmV?d00001 | ||
557 | |||
29 | -- | 558 | -- |
30 | 2.20.1 | 559 | 2.25.1 |
31 | 560 | ||
32 | 561 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 3 | The VIOT blob contains the following: |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | |
5 | Message-id: 20210419202257.161730-19-richard.henderson@linaro.org | 5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] |
6 | [004h 0004 4] Table Length : 00000058 | ||
7 | [008h 0008 1] Revision : 00 | ||
8 | [009h 0009 1] Checksum : 66 | ||
9 | [00Ah 0010 6] Oem ID : "BOCHS " | ||
10 | [010h 0016 8] Oem Table ID : "BXPC " | ||
11 | [018h 0024 4] Oem Revision : 00000001 | ||
12 | [01Ch 0028 4] Asl Compiler ID : "BXPC" | ||
13 | [020h 0032 4] Asl Compiler Revision : 00000001 | ||
14 | |||
15 | [024h 0036 2] Node count : 0002 | ||
16 | [026h 0038 2] Node offset : 0030 | ||
17 | [028h 0040 8] Reserved : 0000000000000000 | ||
18 | |||
19 | [030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] | ||
20 | [031h 0049 1] Reserved : 00 | ||
21 | [032h 0050 2] Length : 0010 | ||
22 | |||
23 | [034h 0052 2] PCI Segment : 0000 | ||
24 | [036h 0054 2] PCI BDF number : 0008 | ||
25 | [038h 0056 8] Reserved : 0000000000000000 | ||
26 | |||
27 | [040h 0064 1] Type : 01 [PCI Range] | ||
28 | [041h 0065 1] Reserved : 00 | ||
29 | [042h 0066 2] Length : 0018 | ||
30 | |||
31 | [044h 0068 4] Endpoint start : 00000000 | ||
32 | [048h 0072 2] PCI Segment start : 0000 | ||
33 | [04Ah 0074 2] PCI Segment end : 0000 | ||
34 | [04Ch 0076 2] PCI BDF start : 0000 | ||
35 | [04Eh 0078 2] PCI BDF end : 00FF | ||
36 | [050h 0080 2] Output node : 0030 | ||
37 | [052h 0082 6] Reserved : 000000000000 | ||
38 | |||
39 | Acked-by: Ani Sinha <ani@anisinha.ca> | ||
40 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
41 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
42 | Message-id: 20211210170415.583179-9-jean-philippe@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 44 | --- |
8 | target/arm/translate.c | 4 ++-- | 45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes |
47 | 2 files changed, 1 deletion(-) | ||
10 | 48 | ||
11 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
12 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate.c | 51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
14 | +++ b/target/arm/translate.c | 52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
15 | @@ -XXX,XX +XXX,XX @@ static bool trans_RFE(DisasContext *s, arg_RFE *a) | 53 | @@ -1,2 +1 @@ |
16 | 54 | /* List of comma-separated changed AML files to ignore */ | |
17 | /* Load PC into tmp and CPSR into tmp2. */ | 55 | -"tests/data/acpi/virt/VIOT", |
18 | t1 = tcg_temp_new_i32(); | 56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
19 | - gen_aa32_ld32u(s, t1, addr, get_mem_index(s)); | 57 | index XXXXXXX..XXXXXXX 100644 |
20 | + gen_aa32_ld_i32(s, t1, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 58 | GIT binary patch |
21 | tcg_gen_addi_i32(addr, addr, 4); | 59 | literal 88 |
22 | t2 = tcg_temp_new_i32(); | 60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX |
23 | - gen_aa32_ld32u(s, t2, addr, get_mem_index(s)); | 61 | I{D-Rq0Q5fy0RR91 |
24 | + gen_aa32_ld_i32(s, t2, addr, get_mem_index(s), MO_UL | MO_ALIGN); | 62 | |
25 | 63 | literal 0 | |
26 | if (a->w) { | 64 | HcmV?d00001 |
27 | /* Base writeback. */ | 65 | |
28 | -- | 66 | -- |
29 | 2.20.1 | 67 | 2.25.1 |
30 | 68 | ||
31 | 69 | diff view generated by jsdifflib |