1 | The big thing in here is RTH's caching-of-tb-flags patchset | 1 | Hi; here's the first target-arm pullreq for the 7.0 cycle. |
---|---|---|---|
2 | which should improve TCG performance. | ||
3 | 2 | ||
4 | thanks | 3 | thanks |
5 | -- PMM | 4 | -- PMM |
6 | 5 | ||
7 | The following changes since commit 2152e740a8938b3bad73bfe1a01f8b94dab02d41: | 6 | The following changes since commit 76b56fdfc9fa43ec6e5986aee33f108c6c6a511e: |
8 | 7 | ||
9 | Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-10-22 12:03:03 +0100) | 8 | Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2021-12-14 12:46:18 -0800) |
10 | 9 | ||
11 | are available in the Git repository at: | 10 | are available in the Git repository at: |
12 | 11 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191022 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20211215 |
14 | 13 | ||
15 | for you to fetch changes up to 833043a060f7d0e95ded88e61e992466305c0345: | 14 | for you to fetch changes up to aed176558806674d030a8305d989d4e6a5073359: |
16 | 15 | ||
17 | hw/arm/digic4: Inline digic4_board_setup_ram() function (2019-10-22 14:21:57 +0100) | 16 | tests/acpi: add expected blob for VIOT test on virt machine (2021-12-15 10:35:26 +0000) |
18 | 17 | ||
19 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
20 | target-arm queue: | 19 | target-arm queue: |
21 | * Fix sign-extension for SMLAL* instructions | 20 | * ITS: error reporting cleanup |
22 | * aspeed: Add an AST2600 eval board | 21 | * aspeed: improve documentation |
23 | * Various ptimer device conversions to new transaction API | 22 | * Fix STM32F2XX USART data register readout |
24 | * Cache TB flags to avoid expensively recomputing them every time | 23 | * allow emulated GICv3 to be disabled in non-TCG builds |
25 | * Add a dummy Samsung SDHCI controller model to exynos4 boards | 24 | * fix exception priority for singlestep, misaligned PC, bp, etc |
26 | * Minor refactorings of RAM creation for some arm boards | 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 | ||
27 | 30 | ||
28 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
29 | Cédric Le Goater (1): | 32 | Alex Bennée (1): |
30 | aspeed: Add an AST2600 eval board | 33 | hw/intc: clean-up error reporting for failed ITS cmd |
31 | 34 | ||
32 | Guenter Roeck (1): | 35 | Jean-Philippe Brucker (8): |
33 | hw/timer/exynos4210_mct: Initialize ptimer before starting it | 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 | ||
34 | 44 | ||
35 | Peter Maydell (7): | 45 | Joel Stanley (4): |
36 | hw/timer/arm_mptimer.c: Undo accidental rename of arm_mptimer_init() | 46 | docs: aspeed: Add new boards |
37 | hw/timer/puv3_ost.c: Switch to transaction-based ptimer API | 47 | docs: aspeed: Update OpenBMC image URL |
38 | hw/timer/sh_timer: Switch to transaction-based ptimer API | 48 | docs: aspeed: Give an example of booting a kernel |
39 | hw/timer/lm32_timer: Switch to transaction-based ptimer API | 49 | docs: aspeed: ADC is now modelled |
40 | hw/timer/altera_timer.c: Switch to transaction-based ptimer API | ||
41 | hw/watchdog/etraxfs_timer.c: Switch to transaction-based ptimer API | ||
42 | hw/m68k/mcf5208.c: Switch to transaction-based ptimer API | ||
43 | 50 | ||
44 | Philippe Mathieu-Daudé (9): | 51 | Olivier Hériveaux (1): |
45 | hw/sd/sdhci: Add a comment to distinct the i.MX eSDHC functions | 52 | Fix STM32F2XX USART data register readout |
46 | hw/sd/sdhci: Add dummy Samsung SDHCI controller | ||
47 | hw/arm/exynos4210: Use the Samsung s3c SDHCI controller | ||
48 | hw/arm/xilinx_zynq: Use the IEC binary prefix definitions | ||
49 | hw/arm/mps2: Use the IEC binary prefix definitions | ||
50 | hw/arm/collie: Create the RAM in the board | ||
51 | hw/arm/omap2: Create the RAM in the board | ||
52 | hw/arm/omap1: Create the RAM in the board | ||
53 | hw/arm/digic4: Inline digic4_board_setup_ram() function | ||
54 | 53 | ||
55 | Richard Henderson (23): | 54 | Patrick Venture (1): |
56 | target/arm: Fix sign-extension for SMLAL* | 55 | hw/net: npcm7xx_emc fix missing queue_flush |
57 | target/arm: Split out rebuild_hflags_common | ||
58 | target/arm: Split out rebuild_hflags_a64 | ||
59 | target/arm: Split out rebuild_hflags_common_32 | ||
60 | target/arm: Split arm_cpu_data_is_big_endian | ||
61 | target/arm: Split out rebuild_hflags_m32 | ||
62 | target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state | ||
63 | target/arm: Split out rebuild_hflags_a32 | ||
64 | target/arm: Split out rebuild_hflags_aprofile | ||
65 | target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state | ||
66 | target/arm: Simplify set of PSTATE_SS in cpu_get_tb_cpu_state | ||
67 | target/arm: Hoist computation of TBFLAG_A32.VFPEN | ||
68 | target/arm: Add arm_rebuild_hflags | ||
69 | target/arm: Split out arm_mmu_idx_el | ||
70 | target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state | ||
71 | target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32}) | ||
72 | target/arm: Rebuild hflags at EL changes | ||
73 | target/arm: Rebuild hflags at MSR writes | ||
74 | target/arm: Rebuild hflags at CPSR writes | ||
75 | target/arm: Rebuild hflags at Xscale SCTLR writes | ||
76 | target/arm: Rebuild hflags for M-profile | ||
77 | target/arm: Rebuild hflags for M-profile NVIC | ||
78 | target/arm: Rely on hflags correct in cpu_get_tb_cpu_state | ||
79 | 56 | ||
80 | hw/arm/strongarm.h | 4 +- | 57 | Peter Maydell (6): |
81 | include/hw/arm/aspeed.h | 1 + | 58 | target/i386: Use assert() to sanity-check b1 in SSE decode |
82 | include/hw/arm/omap.h | 10 +- | 59 | include/hw/i386: Don't include qemu-common.h in .h files |
83 | include/hw/sd/sdhci.h | 2 + | 60 | target/hexagon/cpu.h: don't include qemu-common.h |
84 | target/arm/cpu.h | 84 ++++++---- | 61 | target/rx/cpu.h: Don't include qemu-common.h |
85 | target/arm/helper.h | 4 + | 62 | hw/arm: Don't include qemu-common.h unnecessarily |
86 | target/arm/internals.h | 9 ++ | 63 | target/arm: Correct calculation of tlb range invalidate length |
87 | hw/arm/aspeed.c | 23 +++ | ||
88 | hw/arm/collie.c | 8 +- | ||
89 | hw/arm/digic_boards.c | 9 +- | ||
90 | hw/arm/exynos4210.c | 2 +- | ||
91 | hw/arm/mps2-tz.c | 3 +- | ||
92 | hw/arm/mps2.c | 3 +- | ||
93 | hw/arm/nseries.c | 10 +- | ||
94 | hw/arm/omap1.c | 12 +- | ||
95 | hw/arm/omap2.c | 13 +- | ||
96 | hw/arm/omap_sx1.c | 8 +- | ||
97 | hw/arm/palm.c | 8 +- | ||
98 | hw/arm/strongarm.c | 7 +- | ||
99 | hw/arm/xilinx_zynq.c | 3 +- | ||
100 | hw/intc/armv7m_nvic.c | 22 +-- | ||
101 | hw/m68k/mcf5208.c | 9 +- | ||
102 | hw/sd/sdhci.c | 68 +++++++- | ||
103 | hw/timer/altera_timer.c | 13 +- | ||
104 | hw/timer/arm_mptimer.c | 4 +- | ||
105 | hw/timer/etraxfs_timer.c | 23 +-- | ||
106 | hw/timer/exynos4210_mct.c | 2 +- | ||
107 | hw/timer/lm32_timer.c | 13 +- | ||
108 | hw/timer/puv3_ost.c | 9 +- | ||
109 | hw/timer/sh_timer.c | 13 +- | ||
110 | linux-user/syscall.c | 1 + | ||
111 | target/arm/cpu.c | 1 + | ||
112 | target/arm/helper-a64.c | 3 + | ||
113 | target/arm/helper.c | 393 +++++++++++++++++++++++++++++---------------- | ||
114 | target/arm/m_helper.c | 6 + | ||
115 | target/arm/machine.c | 1 + | ||
116 | target/arm/op_helper.c | 4 + | ||
117 | target/arm/translate-a64.c | 13 +- | ||
118 | target/arm/translate.c | 37 ++++- | ||
119 | 39 files changed, 588 insertions(+), 270 deletions(-) | ||
120 | 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: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Having the RAM creation code in a separate function is not | 3 | While trying to debug a GIC ITS failure I saw some guest errors that |
4 | very helpful. Move this code directly inside the board_init() | 4 | had poor formatting as well as leaving me confused as to what failed. |
5 | function, this will later allow the board to have the QOM | 5 | As most of the checks aren't possible without a valid dte split that |
6 | ownership of the RAM. | 6 | check apart and then check the other conditions in steps. This avoids |
7 | us relying on undefined data. | ||
7 | 8 | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | I still get a failure with the current kvm-unit-tests but at least I |
9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 10 | know (partially) why now: |
10 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | |
11 | Message-id: 20191021190653.9511-7-philmd@redhat.com | 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> | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org | ||
23 | Cc: Shashi Mallela <shashi.mallela@linaro.org> | ||
24 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 26 | --- |
14 | hw/arm/digic_boards.c | 9 ++------- | 27 | hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ |
15 | 1 file changed, 2 insertions(+), 7 deletions(-) | 28 | 1 file changed, 27 insertions(+), 12 deletions(-) |
16 | 29 | ||
17 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c | 30 | diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c |
18 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/digic_boards.c | 32 | --- a/hw/intc/arm_gicv3_its.c |
20 | +++ b/hw/arm/digic_boards.c | 33 | +++ b/hw/intc/arm_gicv3_its.c |
21 | @@ -XXX,XX +XXX,XX @@ typedef struct DigicBoard { | 34 | @@ -XXX,XX +XXX,XX @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, |
22 | const char *rom1_def_filename; | 35 | if (res != MEMTX_OK) { |
23 | } DigicBoard; | 36 | return result; |
24 | 37 | } | |
25 | -static void digic4_board_setup_ram(DigicBoardState *s, hwaddr ram_size) | 38 | + } else { |
26 | -{ | 39 | + qemu_log_mask(LOG_GUEST_ERROR, |
27 | - memory_region_allocate_system_memory(&s->ram, NULL, "ram", ram_size); | 40 | + "%s: invalid command attributes: " |
28 | - memory_region_add_subregion(get_system_memory(), 0, &s->ram); | 41 | + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", |
29 | -} | 42 | + __func__, dte, devid, res); |
30 | - | 43 | + return result; |
31 | static void digic4_board_init(DigicBoard *board) | ||
32 | { | ||
33 | Error *err = NULL; | ||
34 | @@ -XXX,XX +XXX,XX @@ static void digic4_board_init(DigicBoard *board) | ||
35 | exit(1); | ||
36 | } | 44 | } |
37 | 45 | ||
38 | - digic4_board_setup_ram(s, board->ram_size); | 46 | - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || |
39 | + memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_size); | 47 | - !cte_valid || (eventid > max_eventid)) { |
40 | + memory_region_add_subregion(get_system_memory(), 0, &s->ram); | 48 | + |
41 | 49 | + /* | |
42 | if (board->add_rom0) { | 50 | + * In this implementation, in case of guest errors we ignore the |
43 | board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename); | 51 | + * command and move onto the next command in the queue. |
52 | + */ | ||
53 | + if (devid > s->dt.maxids.max_devids) { | ||
54 | qemu_log_mask(LOG_GUEST_ERROR, | ||
55 | - "%s: invalid command attributes " | ||
56 | - "devid %d or eventid %d or invalid dte %d or" | ||
57 | - "invalid cte %d or invalid ite %d\n", | ||
58 | - __func__, devid, eventid, dte_valid, cte_valid, | ||
59 | - ite_valid); | ||
60 | - /* | ||
61 | - * in this implementation, in case of error | ||
62 | - * we ignore this command and move onto the next | ||
63 | - * command in the queue | ||
64 | - */ | ||
65 | + "%s: invalid command attributes: devid %d>%d", | ||
66 | + __func__, devid, s->dt.maxids.max_devids); | ||
67 | + | ||
68 | + } else if (!dte_valid || !ite_valid || !cte_valid) { | ||
69 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
70 | + "%s: invalid command attributes: " | ||
71 | + "dte: %s, ite: %s, cte: %s\n", | ||
72 | + __func__, | ||
73 | + dte_valid ? "valid" : "invalid", | ||
74 | + ite_valid ? "valid" : "invalid", | ||
75 | + cte_valid ? "valid" : "invalid"); | ||
76 | + } else if (eventid > max_eventid) { | ||
77 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
78 | + "%s: invalid command attributes: eventid %d > %d\n", | ||
79 | + __func__, eventid, max_eventid); | ||
80 | } else { | ||
81 | /* | ||
82 | * Current implementation only supports rdbase == procnum | ||
44 | -- | 83 | -- |
45 | 2.20.1 | 84 | 2.25.1 |
46 | 85 | ||
47 | 86 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | The SDRAM is incorrectly created in the OMAP310 SoC. | 3 | Add X11, FP5280G2, G220A, Rainier and Fuji. Mention that Swift will be |
4 | Move its creation in the board code, this will later allow the | 4 | removed in v7.0. |
5 | board to have the QOM ownership of the RAM. | ||
6 | 5 | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Message-id: 20211117065752.330632-2-joel@jms.id.au |
10 | Message-id: 20191021190653.9511-6-philmd@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/omap.h | 6 ++---- | 11 | docs/system/arm/aspeed.rst | 7 ++++++- |
14 | hw/arm/omap1.c | 12 +++++------- | 12 | 1 file changed, 6 insertions(+), 1 deletion(-) |
15 | hw/arm/omap_sx1.c | 8 ++++++-- | ||
16 | hw/arm/palm.c | 8 ++++++-- | ||
17 | 4 files changed, 19 insertions(+), 15 deletions(-) | ||
18 | 13 | ||
19 | diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/hw/arm/omap.h | 16 | --- a/docs/system/arm/aspeed.rst |
22 | +++ b/include/hw/arm/omap.h | 17 | +++ b/docs/system/arm/aspeed.rst |
23 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s { | 18 | @@ -XXX,XX +XXX,XX @@ AST2400 SoC based machines : |
24 | MemoryRegion mpui_io_iomem; | 19 | |
25 | MemoryRegion tap_iomem; | 20 | - ``palmetto-bmc`` OpenPOWER Palmetto POWER8 BMC |
26 | MemoryRegion imif_ram; | 21 | - ``quanta-q71l-bmc`` OpenBMC Quanta BMC |
27 | - MemoryRegion emiff_ram; | 22 | +- ``supermicrox11-bmc`` Supermicro X11 BMC |
28 | MemoryRegion sram; | 23 | |
29 | 24 | AST2500 SoC based machines : | |
30 | struct omap_dma_port_if_s { | 25 | |
31 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s { | 26 | @@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines : |
32 | hwaddr addr); | 27 | - ``romulus-bmc`` OpenPOWER Romulus POWER9 BMC |
33 | } port[__omap_dma_port_last]; | 28 | - ``witherspoon-bmc`` OpenPOWER Witherspoon POWER9 BMC |
34 | 29 | - ``sonorapass-bmc`` OCP SonoraPass BMC | |
35 | - unsigned long sdram_size; | 30 | -- ``swift-bmc`` OpenPOWER Swift BMC POWER9 |
36 | + uint64_t sdram_size; | 31 | +- ``swift-bmc`` OpenPOWER Swift BMC POWER9 (to be removed in v7.0) |
37 | unsigned long sram_size; | 32 | +- ``fp5280g2-bmc`` Inspur FP5280G2 BMC |
38 | 33 | +- ``g220a-bmc`` Bytedance G220A BMC | |
39 | /* MPUI-TIPB peripherals */ | 34 | |
40 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s { | 35 | AST2600 SoC based machines : |
41 | }; | 36 | |
42 | 37 | - ``ast2600-evb`` Aspeed AST2600 Evaluation board (Cortex-A7) | |
43 | /* omap1.c */ | 38 | - ``tacoma-bmc`` OpenPOWER Witherspoon POWER9 AST2600 BMC |
44 | -struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, | 39 | +- ``rainier-bmc`` IBM Rainier POWER10 BMC |
45 | - unsigned long sdram_size, | 40 | +- ``fuji-bmc`` Facebook Fuji BMC |
46 | +struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *sdram, | 41 | |
47 | const char *core); | 42 | Supported devices |
48 | 43 | ----------------- | |
49 | /* omap2.c */ | ||
50 | diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/arm/omap1.c | ||
53 | +++ b/hw/arm/omap1.c | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | #include "qapi/error.h" | ||
56 | #include "qemu-common.h" | ||
57 | #include "cpu.h" | ||
58 | +#include "exec/address-spaces.h" | ||
59 | #include "hw/boards.h" | ||
60 | #include "hw/hw.h" | ||
61 | #include "hw/irq.h" | ||
62 | @@ -XXX,XX +XXX,XX @@ static int omap_validate_tipb_mpui_addr(struct omap_mpu_state_s *s, | ||
63 | return range_covers_byte(0xe1010000, 0xe1020004 - 0xe1010000, addr); | ||
64 | } | ||
65 | |||
66 | -struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, | ||
67 | - unsigned long sdram_size, | ||
68 | +struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram, | ||
69 | const char *cpu_type) | ||
70 | { | ||
71 | int i; | ||
72 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, | ||
73 | qemu_irq dma_irqs[6]; | ||
74 | DriveInfo *dinfo; | ||
75 | SysBusDevice *busdev; | ||
76 | + MemoryRegion *system_memory = get_system_memory(); | ||
77 | |||
78 | /* Core */ | ||
79 | s->mpu_model = omap310; | ||
80 | s->cpu = ARM_CPU(cpu_create(cpu_type)); | ||
81 | - s->sdram_size = sdram_size; | ||
82 | + s->sdram_size = memory_region_size(dram); | ||
83 | s->sram_size = OMAP15XX_SRAM_SIZE; | ||
84 | |||
85 | s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0); | ||
86 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, | ||
87 | omap_clk_init(s); | ||
88 | |||
89 | /* Memory-mapped stuff */ | ||
90 | - memory_region_allocate_system_memory(&s->emiff_ram, NULL, "omap1.dram", | ||
91 | - s->sdram_size); | ||
92 | - memory_region_add_subregion(system_memory, OMAP_EMIFF_BASE, &s->emiff_ram); | ||
93 | memory_region_init_ram(&s->imif_ram, NULL, "omap1.sram", s->sram_size, | ||
94 | &error_fatal); | ||
95 | memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram); | ||
96 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, | ||
97 | s->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr; | ||
98 | |||
99 | /* Register SDRAM and SRAM DMA ports for fast transfers. */ | ||
100 | - soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->emiff_ram), | ||
101 | + soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(dram), | ||
102 | OMAP_EMIFF_BASE, s->sdram_size); | ||
103 | soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->imif_ram), | ||
104 | OMAP_IMIF_BASE, s->sram_size); | ||
105 | diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c | ||
106 | index XXXXXXX..XXXXXXX 100644 | ||
107 | --- a/hw/arm/omap_sx1.c | ||
108 | +++ b/hw/arm/omap_sx1.c | ||
109 | @@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version) | ||
110 | { | ||
111 | struct omap_mpu_state_s *mpu; | ||
112 | MemoryRegion *address_space = get_system_memory(); | ||
113 | + MemoryRegion *dram = g_new(MemoryRegion, 1); | ||
114 | MemoryRegion *flash = g_new(MemoryRegion, 1); | ||
115 | MemoryRegion *cs = g_new(MemoryRegion, 4); | ||
116 | static uint32_t cs0val = 0x00213090; | ||
117 | @@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version) | ||
118 | flash_size = flash2_size; | ||
119 | } | ||
120 | |||
121 | - mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size, | ||
122 | - machine->cpu_type); | ||
123 | + memory_region_allocate_system_memory(dram, NULL, "omap1.dram", | ||
124 | + sx1_binfo.ram_size); | ||
125 | + memory_region_add_subregion(address_space, OMAP_EMIFF_BASE, dram); | ||
126 | + | ||
127 | + mpu = omap310_mpu_init(dram, machine->cpu_type); | ||
128 | |||
129 | /* External Flash (EMIFS) */ | ||
130 | memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size, | ||
131 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/hw/arm/palm.c | ||
134 | +++ b/hw/arm/palm.c | ||
135 | @@ -XXX,XX +XXX,XX @@ static void palmte_init(MachineState *machine) | ||
136 | MemoryRegion *address_space_mem = get_system_memory(); | ||
137 | struct omap_mpu_state_s *mpu; | ||
138 | int flash_size = 0x00800000; | ||
139 | - int sdram_size = palmte_binfo.ram_size; | ||
140 | static uint32_t cs0val = 0xffffffff; | ||
141 | static uint32_t cs1val = 0x0000e1a0; | ||
142 | static uint32_t cs2val = 0x0000e1a0; | ||
143 | static uint32_t cs3val = 0xe1a0e1a0; | ||
144 | int rom_size, rom_loaded = 0; | ||
145 | + MemoryRegion *dram = g_new(MemoryRegion, 1); | ||
146 | MemoryRegion *flash = g_new(MemoryRegion, 1); | ||
147 | MemoryRegion *cs = g_new(MemoryRegion, 4); | ||
148 | |||
149 | - mpu = omap310_mpu_init(address_space_mem, sdram_size, machine->cpu_type); | ||
150 | + memory_region_allocate_system_memory(dram, NULL, "omap1.dram", | ||
151 | + palmte_binfo.ram_size); | ||
152 | + memory_region_add_subregion(address_space_mem, OMAP_EMIFF_BASE, dram); | ||
153 | + | ||
154 | + mpu = omap310_mpu_init(dram, machine->cpu_type); | ||
155 | |||
156 | /* External Flash (EMIFS) */ | ||
157 | memory_region_init_ram(flash, NULL, "palmte.flash", flash_size, | ||
158 | -- | 44 | -- |
159 | 2.20.1 | 45 | 2.25.1 |
160 | 46 | ||
161 | 47 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | The Exynos SoC has specific SDHCI registers. Use the s3c SDHCI | 3 | This is the latest URL for the OpenBMC CI. The old URL still works, but |
4 | model which handle these specific registers. | 4 | redirects. |
5 | 5 | ||
6 | This silents the following "SDHC ... not implemented" warnings so | 6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
7 | we can focus on the important registers missing: | 7 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
8 | 8 | Message-id: 20211117065752.330632-3-joel@jms.id.au | |
9 | $ qemu-system-arm ... -d unimp \ | ||
10 | -append "... root=/dev/mmcblk0 rootfstype=ext4 rw rootwait" \ | ||
11 | -drive file=linux-build-test/rootfs/arm/rootfs-armv5.ext2,if=sd,format=raw | ||
12 | [...] | ||
13 | [ 25.744858] sdhci: Secure Digital Host Controller Interface driver | ||
14 | [ 25.745862] sdhci: Copyright(c) Pierre Ossman | ||
15 | [ 25.783188] s3c-sdhci 12530000.sdhci: clock source 2: mmc_busclk.2 (12000000 Hz) | ||
16 | SDHC rd_4b @0x80 not implemented | ||
17 | SDHC wr_4b @0x80 <- 0x00000020 not implemented | ||
18 | SDHC wr_4b @0x8c <- 0x00030000 not implemented | ||
19 | SDHC rd_4b @0x80 not implemented | ||
20 | SDHC wr_4b @0x80 <- 0xc0004100 not implemented | ||
21 | SDHC wr_4b @0x84 <- 0x80808080 not implemented | ||
22 | [ 26.013318] mmc0: SDHCI controller on samsung-hsmmc [12530000.sdhci] using ADMA | ||
23 | [ 26.032318] Synopsys Designware Multimedia Card Interface Driver | ||
24 | [ 42.024885] Waiting for root device /dev/mmcblk0... | ||
25 | |||
26 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
27 | Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> | ||
28 | Message-id: 20191005154748.21718-5-f4bug@amsat.org | ||
29 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
30 | --- | 10 | --- |
31 | hw/arm/exynos4210.c | 2 +- | 11 | docs/system/arm/aspeed.rst | 2 +- |
32 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
33 | 13 | ||
34 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
35 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/hw/arm/exynos4210.c | 16 | --- a/docs/system/arm/aspeed.rst |
37 | +++ b/hw/arm/exynos4210.c | 17 | +++ b/docs/system/arm/aspeed.rst |
38 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ The Aspeed machines can be started using the ``-kernel`` option to |
39 | * public datasheet which is very similar (implementing | 19 | load a Linux kernel or from a firmware. Images can be downloaded from |
40 | * MMC Specification Version 4.0 being the only difference noted) | 20 | the OpenBMC jenkins : |
41 | */ | 21 | |
42 | - dev = qdev_create(NULL, TYPE_SYSBUS_SDHCI); | 22 | - https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/distro=ubuntu,label=docker-builder |
43 | + dev = qdev_create(NULL, TYPE_S3C_SDHCI); | 23 | + https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
44 | qdev_prop_set_uint64(dev, "capareg", EXYNOS4210_SDHCI_CAPABILITIES); | 24 | |
45 | qdev_init_nofail(dev); | 25 | or directly from the OpenBMC GitHub release repository : |
46 | 26 | ||
47 | -- | 27 | -- |
48 | 2.20.1 | 28 | 2.25.1 |
49 | 29 | ||
50 | 30 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Joel Stanley <joel@jms.id.au> |
---|---|---|---|
2 | 2 | ||
3 | The SDRAM is incorrectly created in the OMAP2420 SoC. | 3 | A common use case for the ASPEED machine is to boot a Linux kernel. |
4 | Move its creation in the board code, this will later allow the | 4 | Provide a full example command line. |
5 | board to have the QOM ownership of the RAM. | ||
6 | 5 | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Message-id: 20211117065752.330632-4-joel@jms.id.au |
10 | Message-id: 20191021190653.9511-5-philmd@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/omap.h | 4 +--- | 11 | docs/system/arm/aspeed.rst | 15 ++++++++++++--- |
14 | hw/arm/nseries.c | 10 +++++++--- | 12 | 1 file changed, 12 insertions(+), 3 deletions(-) |
15 | hw/arm/omap2.c | 13 +++++-------- | ||
16 | 3 files changed, 13 insertions(+), 14 deletions(-) | ||
17 | 13 | ||
18 | diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h | 14 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/arm/omap.h | 16 | --- a/docs/system/arm/aspeed.rst |
21 | +++ b/include/hw/arm/omap.h | 17 | +++ b/docs/system/arm/aspeed.rst |
22 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s { | 18 | @@ -XXX,XX +XXX,XX @@ Missing devices |
23 | MemoryRegion tap_iomem; | 19 | Boot options |
24 | MemoryRegion imif_ram; | 20 | ------------ |
25 | MemoryRegion emiff_ram; | 21 | |
26 | - MemoryRegion sdram; | 22 | -The Aspeed machines can be started using the ``-kernel`` option to |
27 | MemoryRegion sram; | 23 | -load a Linux kernel or from a firmware. Images can be downloaded from |
28 | 24 | -the OpenBMC jenkins : | |
29 | struct omap_dma_port_if_s { | 25 | +The Aspeed machines can be started using the ``-kernel`` and ``-dtb`` options |
30 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, | 26 | +to load a Linux kernel or from a firmware. Images can be downloaded from the |
31 | const char *core); | 27 | +OpenBMC jenkins : |
32 | 28 | ||
33 | /* omap2.c */ | 29 | https://jenkins.openbmc.org/job/ci-openbmc/lastSuccessfulBuild/ |
34 | -struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, | 30 | |
35 | - unsigned long sdram_size, | 31 | @@ -XXX,XX +XXX,XX @@ or directly from the OpenBMC GitHub release repository : |
36 | +struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram, | 32 | |
37 | const char *core); | 33 | https://github.com/openbmc/openbmc/releases |
38 | 34 | ||
39 | uint32_t omap_badwidth_read8(void *opaque, hwaddr addr); | 35 | +To boot a kernel directly from a Linux build tree: |
40 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/arm/nseries.c | ||
43 | +++ b/hw/arm/nseries.c | ||
44 | @@ -XXX,XX +XXX,XX @@ | ||
45 | |||
46 | /* Nokia N8x0 support */ | ||
47 | struct n800_s { | ||
48 | + MemoryRegion sdram; | ||
49 | struct omap_mpu_state_s *mpu; | ||
50 | |||
51 | struct rfbi_chip_s blizzard; | ||
52 | @@ -XXX,XX +XXX,XX @@ static int n810_atag_setup(const struct arm_boot_info *info, void *p) | ||
53 | static void n8x0_init(MachineState *machine, | ||
54 | struct arm_boot_info *binfo, int model) | ||
55 | { | ||
56 | - MemoryRegion *sysmem = get_system_memory(); | ||
57 | struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s)); | ||
58 | - int sdram_size = binfo->ram_size; | ||
59 | + uint64_t sdram_size = binfo->ram_size; | ||
60 | |||
61 | - s->mpu = omap2420_mpu_init(sysmem, sdram_size, machine->cpu_type); | ||
62 | + memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram", | ||
63 | + sdram_size); | ||
64 | + memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE, &s->sdram); | ||
65 | + | 36 | + |
66 | + s->mpu = omap2420_mpu_init(&s->sdram, machine->cpu_type); | 37 | +.. code-block:: bash |
67 | 38 | + | |
68 | /* Setup peripherals | 39 | + $ qemu-system-arm -M ast2600-evb -nographic \ |
69 | * | 40 | + -kernel arch/arm/boot/zImage \ |
70 | diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c | 41 | + -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ |
71 | index XXXXXXX..XXXXXXX 100644 | 42 | + -initrd rootfs.cpio |
72 | --- a/hw/arm/omap2.c | 43 | + |
73 | +++ b/hw/arm/omap2.c | 44 | The image should be attached as an MTD drive. Run : |
74 | @@ -XXX,XX +XXX,XX @@ | 45 | |
75 | #include "qemu/error-report.h" | 46 | .. code-block:: bash |
76 | #include "qapi/error.h" | ||
77 | #include "cpu.h" | ||
78 | +#include "exec/address-spaces.h" | ||
79 | #include "sysemu/blockdev.h" | ||
80 | #include "sysemu/qtest.h" | ||
81 | #include "sysemu/reset.h" | ||
82 | @@ -XXX,XX +XXX,XX @@ static const struct dma_irq_map omap2_dma_irq_map[] = { | ||
83 | { 0, OMAP_INT_24XX_SDMA_IRQ3 }, | ||
84 | }; | ||
85 | |||
86 | -struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, | ||
87 | - unsigned long sdram_size, | ||
88 | +struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram, | ||
89 | const char *cpu_type) | ||
90 | { | ||
91 | struct omap_mpu_state_s *s = g_new0(struct omap_mpu_state_s, 1); | ||
92 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, | ||
93 | int i; | ||
94 | SysBusDevice *busdev; | ||
95 | struct omap_target_agent_s *ta; | ||
96 | + MemoryRegion *sysmem = get_system_memory(); | ||
97 | |||
98 | /* Core */ | ||
99 | s->mpu_model = omap2420; | ||
100 | s->cpu = ARM_CPU(cpu_create(cpu_type)); | ||
101 | - s->sdram_size = sdram_size; | ||
102 | s->sram_size = OMAP242X_SRAM_SIZE; | ||
103 | |||
104 | s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0); | ||
105 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, | ||
106 | omap_clk_init(s); | ||
107 | |||
108 | /* Memory-mapped stuff */ | ||
109 | - memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram", | ||
110 | - s->sdram_size); | ||
111 | - memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram); | ||
112 | memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size, | ||
113 | &error_fatal); | ||
114 | memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram); | ||
115 | @@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem, | ||
116 | s->port->addr_valid = omap2_validate_addr; | ||
117 | |||
118 | /* Register SDRAM and SRAM ports for fast DMA transfers. */ | ||
119 | - soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sdram), | ||
120 | - OMAP2_Q2_BASE, s->sdram_size); | ||
121 | + soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(sdram), | ||
122 | + OMAP2_Q2_BASE, memory_region_size(sdram)); | ||
123 | soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sram), | ||
124 | OMAP2_SRAM_BASE, s->sram_size); | ||
125 | |||
126 | -- | 47 | -- |
127 | 2.20.1 | 48 | 2.25.1 |
128 | 49 | ||
129 | 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 | By performing this store early, we avoid having to save and restore | 3 | Move it to the supported list. |
4 | the register holding the address around any function calls. | ||
5 | 4 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 5 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Message-id: 20211117065752.330632-5-joel@jms.id.au |
8 | Message-id: 20191018174431.1784-15-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 8 | --- |
11 | target/arm/helper.c | 2 +- | 9 | docs/system/arm/aspeed.rst | 2 +- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 11 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 12 | diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst |
15 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 14 | --- a/docs/system/arm/aspeed.rst |
17 | +++ b/target/arm/helper.c | 15 | +++ b/docs/system/arm/aspeed.rst |
18 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 16 | @@ -XXX,XX +XXX,XX @@ Supported devices |
19 | { | 17 | * Front LEDs (PCA9552 on I2C bus) |
20 | uint32_t flags, pstate_for_ss; | 18 | * LPC Peripheral Controller (a subset of subdevices are supported) |
21 | 19 | * Hash/Crypto Engine (HACE) - Hash support only. TODO: HMAC and RSA | |
22 | + *cs_base = 0; | 20 | + * ADC |
23 | flags = rebuild_hflags_internal(env); | 21 | |
24 | 22 | ||
25 | if (is_a64(env)) { | 23 | Missing devices |
26 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 24 | --------------- |
27 | } | 25 | |
28 | 26 | * Coprocessor support | |
29 | *pflags = flags; | 27 | - * ADC (out of tree implementation) |
30 | - *cs_base = 0; | 28 | * PWM and Fan Controller |
31 | } | 29 | * Slave GPIO Controller |
32 | 30 | * Super I/O Controller | |
33 | #ifdef TARGET_AARCH64 | ||
34 | -- | 31 | -- |
35 | 2.20.1 | 32 | 2.25.1 |
36 | 33 | ||
37 | 34 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Olivier Hériveaux <olivier.heriveaux@ledger.fr> |
---|---|---|---|
2 | 2 | ||
3 | This file keeps the various QDev blocks separated by comments. | 3 | Fix issue where the data register may be overwritten by next character |
4 | reception before being read and returned. | ||
4 | 5 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Signed-off-by: Olivier Hériveaux <olivier.heriveaux@ledger.fr> |
6 | Reviewed-by: Cleber Rosa <crosa@redhat.com> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Message-id: 20191005154748.21718-3-f4bug@amsat.org | 8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
9 | Message-id: 20211128120723.4053-1-olivier.heriveaux@ledger.fr | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 11 | --- |
10 | hw/sd/sdhci.c | 3 ++- | 12 | hw/char/stm32f2xx_usart.c | 3 ++- |
11 | 1 file changed, 2 insertions(+), 1 deletion(-) | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
12 | 14 | ||
13 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | 15 | diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/sd/sdhci.c | 17 | --- a/hw/char/stm32f2xx_usart.c |
16 | +++ b/hw/sd/sdhci.c | 18 | +++ b/hw/char/stm32f2xx_usart.c |
17 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo sdhci_bus_info = { | 19 | @@ -XXX,XX +XXX,XX @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr, |
18 | .class_init = sdhci_bus_class_init, | 20 | return retvalue; |
19 | }; | 21 | case USART_DR: |
20 | 22 | DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr); | |
21 | +/* --- qdev i.MX eSDHC --- */ | 23 | + retvalue = s->usart_dr & 0x3FF; |
22 | + | 24 | s->usart_sr &= ~USART_SR_RXNE; |
23 | static uint64_t usdhc_read(void *opaque, hwaddr offset, unsigned size) | 25 | qemu_chr_fe_accept_input(&s->chr); |
24 | { | 26 | qemu_set_irq(s->irq, 0); |
25 | SDHCIState *s = SYSBUS_SDHCI(opaque); | 27 | - return s->usart_dr & 0x3FF; |
26 | @@ -XXX,XX +XXX,XX @@ usdhc_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) | 28 | + return retvalue; |
27 | } | 29 | case USART_BRR: |
28 | } | 30 | return s->usart_brr; |
29 | 31 | case USART_CR1: | |
30 | - | ||
31 | static const MemoryRegionOps usdhc_mmio_ops = { | ||
32 | .read = usdhc_read, | ||
33 | .write = usdhc_write, | ||
34 | -- | 32 | -- |
35 | 2.20.1 | 33 | 2.25.1 |
36 | 34 | ||
37 | 35 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The SDRAM is incorrectly created in the SA1110 SoC. | 3 | gicv3_set_gicv3state() is used by arm_gicv3_common.c in |
4 | Move its creation in the board code, this will later allow the | 4 | arm_gicv3_common_realize(). Since we want to restrict |
5 | board to have the QOM ownership of the RAM. | 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". | ||
6 | 8 | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Message-id: 20191021190653.9511-4-philmd@redhat.com | 11 | Message-id: 20211115223619.2599282-2-philmd@redhat.com |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 13 | --- |
13 | hw/arm/strongarm.h | 4 +--- | 14 | hw/intc/arm_gicv3_cpuif.c | 10 +--------- |
14 | hw/arm/collie.c | 8 ++++++-- | 15 | hw/intc/arm_gicv3_cpuif_common.c | 22 ++++++++++++++++++++++ |
15 | hw/arm/strongarm.c | 7 +------ | 16 | hw/intc/meson.build | 1 + |
16 | 3 files changed, 8 insertions(+), 11 deletions(-) | 17 | 3 files changed, 24 insertions(+), 9 deletions(-) |
18 | create mode 100644 hw/intc/arm_gicv3_cpuif_common.c | ||
17 | 19 | ||
18 | diff --git a/hw/arm/strongarm.h b/hw/arm/strongarm.h | 20 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
19 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/strongarm.h | 22 | --- a/hw/intc/arm_gicv3_cpuif.c |
21 | +++ b/hw/arm/strongarm.h | 23 | +++ b/hw/intc/arm_gicv3_cpuif.c |
22 | @@ -XXX,XX +XXX,XX @@ enum { | 24 | @@ -XXX,XX +XXX,XX @@ |
23 | 25 | /* | |
24 | typedef struct { | 26 | - * ARM Generic Interrupt Controller v3 |
25 | ARMCPU *cpu; | 27 | + * ARM Generic Interrupt Controller v3 (emulation) |
26 | - MemoryRegion sdram; | 28 | * |
27 | DeviceState *pic; | 29 | * Copyright (c) 2016 Linaro Limited |
28 | DeviceState *gpio; | 30 | * Written by Peter Maydell |
29 | DeviceState *ppc; | 31 | @@ -XXX,XX +XXX,XX @@ |
30 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 32 | #include "hw/irq.h" |
31 | SSIBus *ssp_bus; | 33 | #include "cpu.h" |
32 | } StrongARMState; | 34 | |
33 | 35 | -void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s) | |
34 | -StrongARMState *sa1110_init(MemoryRegion *sysmem, | 36 | -{ |
35 | - unsigned int sdram_size, const char *rev); | 37 | - ARMCPU *arm_cpu = ARM_CPU(cpu); |
36 | +StrongARMState *sa1110_init(const char *cpu_type); | 38 | - CPUARMState *env = &arm_cpu->env; |
37 | 39 | - | |
38 | #endif | 40 | - env->gicv3state = (void *)s; |
39 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | 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 | ||
40 | index XXXXXXX..XXXXXXX 100644 | 75 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/hw/arm/collie.c | 76 | --- a/hw/intc/meson.build |
42 | +++ b/hw/arm/collie.c | 77 | +++ b/hw/intc/meson.build |
43 | @@ -XXX,XX +XXX,XX @@ static void collie_init(MachineState *machine) | 78 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in |
44 | { | 79 | |
45 | StrongARMState *s; | 80 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) |
46 | DriveInfo *dinfo; | 81 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) |
47 | - MemoryRegion *sysmem = get_system_memory(); | 82 | +specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) |
48 | + MemoryRegion *sdram = g_new(MemoryRegion, 1); | 83 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) |
49 | 84 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | |
50 | - s = sa1110_init(sysmem, collie_binfo.ram_size, machine->cpu_type); | 85 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) |
51 | + s = sa1110_init(machine->cpu_type); | ||
52 | + | ||
53 | + memory_region_allocate_system_memory(sdram, NULL, "strongarm.sdram", | ||
54 | + collie_binfo.ram_size); | ||
55 | + memory_region_add_subregion(get_system_memory(), SA_SDCS0, sdram); | ||
56 | |||
57 | dinfo = drive_get(IF_PFLASH, 0, 0); | ||
58 | pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000, | ||
59 | diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/hw/arm/strongarm.c | ||
62 | +++ b/hw/arm/strongarm.c | ||
63 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo strongarm_ssp_info = { | ||
64 | }; | ||
65 | |||
66 | /* Main CPU functions */ | ||
67 | -StrongARMState *sa1110_init(MemoryRegion *sysmem, | ||
68 | - unsigned int sdram_size, const char *cpu_type) | ||
69 | +StrongARMState *sa1110_init(const char *cpu_type) | ||
70 | { | ||
71 | StrongARMState *s; | ||
72 | int i; | ||
73 | @@ -XXX,XX +XXX,XX @@ StrongARMState *sa1110_init(MemoryRegion *sysmem, | ||
74 | |||
75 | s->cpu = ARM_CPU(cpu_create(cpu_type)); | ||
76 | |||
77 | - memory_region_allocate_system_memory(&s->sdram, NULL, "strongarm.sdram", | ||
78 | - sdram_size); | ||
79 | - memory_region_add_subregion(sysmem, SA_SDCS0, &s->sdram); | ||
80 | - | ||
81 | s->pic = sysbus_create_varargs("strongarm_pic", 0x90050000, | ||
82 | qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ), | ||
83 | qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ), | ||
84 | -- | 86 | -- |
85 | 2.20.1 | 87 | 2.25.1 |
86 | 88 | ||
87 | 89 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | IEC binary prefixes ease code review: the unit is explicit. | 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). | ||
4 | 6 | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 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 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 16 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20191021190653.9511-2-philmd@redhat.com | 18 | Message-id: 20211115223619.2599282-3-philmd@redhat.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 20 | --- |
11 | hw/arm/xilinx_zynq.c | 3 ++- | 21 | hw/intc/arm_gicv3.c | 2 +- |
12 | 1 file changed, 2 insertions(+), 1 deletion(-) | 22 | hw/intc/Kconfig | 5 +++++ |
23 | hw/intc/meson.build | 10 ++++++---- | ||
24 | 3 files changed, 12 insertions(+), 5 deletions(-) | ||
13 | 25 | ||
14 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c | 26 | diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c |
15 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/xilinx_zynq.c | 28 | --- a/hw/intc/arm_gicv3.c |
17 | +++ b/hw/arm/xilinx_zynq.c | 29 | +++ b/hw/intc/arm_gicv3.c |
18 | @@ -XXX,XX +XXX,XX @@ | 30 | @@ -XXX,XX +XXX,XX @@ |
19 | */ | 31 | /* |
20 | 32 | - * ARM Generic Interrupt Controller v3 | |
21 | #include "qemu/osdep.h" | 33 | + * ARM Generic Interrupt Controller v3 (emulation) |
22 | +#include "qemu/units.h" | 34 | * |
23 | #include "qapi/error.h" | 35 | * Copyright (c) 2015 Huawei. |
24 | #include "cpu.h" | 36 | * Copyright (c) 2016 Linaro Limited |
25 | #include "hw/sysbus.h" | 37 | diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig |
26 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) | 38 | index XXXXXXX..XXXXXXX 100644 |
27 | memory_region_add_subregion(address_space_mem, 0, ext_ram); | 39 | --- a/hw/intc/Kconfig |
28 | 40 | +++ b/hw/intc/Kconfig | |
29 | /* 256K of on-chip memory */ | 41 | @@ -XXX,XX +XXX,XX @@ config APIC |
30 | - memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10, | 42 | select MSI_NONBROKEN |
31 | + memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 * KiB, | 43 | select I8259 |
32 | &error_fatal); | 44 | |
33 | memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram); | 45 | +config ARM_GIC_TCG |
34 | 46 | + bool | |
47 | + default y | ||
48 | + depends on ARM_GIC && TCG | ||
49 | + | ||
50 | config ARM_GIC_KVM | ||
51 | bool | ||
52 | default y | ||
53 | diff --git a/hw/intc/meson.build b/hw/intc/meson.build | ||
54 | index XXXXXXX..XXXXXXX 100644 | ||
55 | --- a/hw/intc/meson.build | ||
56 | +++ b/hw/intc/meson.build | ||
57 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files( | ||
58 | 'arm_gic.c', | ||
59 | 'arm_gic_common.c', | ||
60 | 'arm_gicv2m.c', | ||
61 | - 'arm_gicv3.c', | ||
62 | 'arm_gicv3_common.c', | ||
63 | - 'arm_gicv3_dist.c', | ||
64 | 'arm_gicv3_its_common.c', | ||
65 | - 'arm_gicv3_redist.c', | ||
66 | +)) | ||
67 | +softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files( | ||
68 | + 'arm_gicv3.c', | ||
69 | + 'arm_gicv3_dist.c', | ||
70 | 'arm_gicv3_its.c', | ||
71 | + 'arm_gicv3_redist.c', | ||
72 | )) | ||
73 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) | ||
74 | softmmu_ss.add(when: 'CONFIG_HEATHROW_PIC', if_true: files('heathrow_pic.c')) | ||
75 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in | ||
76 | specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c')) | ||
77 | specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c')) | ||
78 | specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c')) | ||
79 | -specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif.c')) | ||
80 | +specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c')) | ||
81 | specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c')) | ||
82 | specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) | ||
83 | specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) | ||
35 | -- | 84 | -- |
36 | 2.20.1 | 85 | 2.25.1 |
37 | 86 | ||
38 | 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 | Continue setting, but not relying upon, env->hflags. | ||
4 | |||
5 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20191018174431.1784-22-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 6 | --- |
11 | hw/intc/armv7m_nvic.c | 22 +++++++++++++--------- | 7 | target/arm/translate-a64.c | 7 ++++--- |
12 | 1 file changed, 13 insertions(+), 9 deletions(-) | 8 | 1 file changed, 4 insertions(+), 3 deletions(-) |
13 | 9 | ||
14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 10 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/armv7m_nvic.c | 12 | --- a/target/arm/translate-a64.c |
17 | +++ b/hw/intc/armv7m_nvic.c | 13 | +++ b/target/arm/translate-a64.c |
18 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | 14 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
19 | } | 15 | { |
20 | } | 16 | DisasContext *s = container_of(dcbase, DisasContext, base); |
21 | nvic_irq_update(s); | 17 | CPUARMState *env = cpu->env_ptr; |
22 | - return MEMTX_OK; | 18 | + uint64_t pc = s->base.pc_next; |
23 | + goto exit_ok; | 19 | uint32_t insn; |
24 | case 0x200 ... 0x23f: /* NVIC Set pend */ | 20 | |
25 | /* the special logic in armv7m_nvic_set_pending() | 21 | if (s->ss_active && !s->pstate_ss) { |
26 | * is not needed since IRQs are never escalated | 22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
27 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | 23 | return; |
28 | } | ||
29 | } | ||
30 | nvic_irq_update(s); | ||
31 | - return MEMTX_OK; | ||
32 | + goto exit_ok; | ||
33 | case 0x300 ... 0x33f: /* NVIC Active */ | ||
34 | - return MEMTX_OK; /* R/O */ | ||
35 | + goto exit_ok; /* R/O */ | ||
36 | case 0x400 ... 0x5ef: /* NVIC Priority */ | ||
37 | startvec = (offset - 0x400) + NVIC_FIRST_IRQ; /* vector # */ | ||
38 | |||
39 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | ||
40 | } | ||
41 | } | ||
42 | nvic_irq_update(s); | ||
43 | - return MEMTX_OK; | ||
44 | + goto exit_ok; | ||
45 | case 0xd18 ... 0xd1b: /* System Handler Priority (SHPR1) */ | ||
46 | if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) { | ||
47 | - return MEMTX_OK; | ||
48 | + goto exit_ok; | ||
49 | } | ||
50 | /* fall through */ | ||
51 | case 0xd1c ... 0xd23: /* System Handler Priority (SHPR2, SHPR3) */ | ||
52 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | ||
53 | set_prio(s, hdlidx, sbank, newprio); | ||
54 | } | ||
55 | nvic_irq_update(s); | ||
56 | - return MEMTX_OK; | ||
57 | + goto exit_ok; | ||
58 | case 0xd28 ... 0xd2b: /* Configurable Fault Status (CFSR) */ | ||
59 | if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) { | ||
60 | - return MEMTX_OK; | ||
61 | + goto exit_ok; | ||
62 | } | ||
63 | /* All bits are W1C, so construct 32 bit value with 0s in | ||
64 | * the parts not written by the access size | ||
65 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | ||
66 | */ | ||
67 | s->cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK); | ||
68 | } | ||
69 | - return MEMTX_OK; | ||
70 | + goto exit_ok; | ||
71 | } | 24 | } |
72 | if (size == 4) { | 25 | |
73 | nvic_writel(s, offset, value, attrs); | 26 | - s->pc_curr = s->base.pc_next; |
74 | - return MEMTX_OK; | 27 | - insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); |
75 | + goto exit_ok; | 28 | + s->pc_curr = pc; |
76 | } | 29 | + insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); |
77 | qemu_log_mask(LOG_GUEST_ERROR, | 30 | s->insn = insn; |
78 | "NVIC: Bad write of size %d at offset 0x%x\n", size, offset); | 31 | - s->base.pc_next += 4; |
79 | /* This is UNPREDICTABLE; treat as RAZ/WI */ | 32 | + s->base.pc_next = pc + 4; |
80 | + | 33 | |
81 | + exit_ok: | 34 | s->fp_access_checked = false; |
82 | + /* Ensure any changes made are reflected in the cached hflags. */ | 35 | s->sve_access_checked = false; |
83 | + arm_rebuild_hflags(&s->cpu->env); | ||
84 | return MEMTX_OK; | ||
85 | } | ||
86 | |||
87 | -- | 36 | -- |
88 | 2.20.1 | 37 | 2.25.1 |
89 | 38 | ||
90 | 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 | Continue setting, but not relying upon, env->hflags. | ||
4 | |||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20191018174431.1784-21-richard.henderson@linaro.org | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 6 | --- |
10 | target/arm/m_helper.c | 6 ++++++ | 7 | target/arm/translate.c | 9 +++++---- |
11 | target/arm/translate.c | 5 ++++- | 8 | 1 file changed, 5 insertions(+), 4 deletions(-) |
12 | 2 files changed, 10 insertions(+), 1 deletion(-) | ||
13 | 9 | ||
14 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/m_helper.c | ||
17 | +++ b/target/arm/m_helper.c | ||
18 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest) | ||
19 | switch_v7m_security_state(env, dest & 1); | ||
20 | env->thumb = 1; | ||
21 | env->regs[15] = dest & ~1; | ||
22 | + arm_rebuild_hflags(env); | ||
23 | } | ||
24 | |||
25 | void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) | ||
26 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) | ||
27 | switch_v7m_security_state(env, 0); | ||
28 | env->thumb = 1; | ||
29 | env->regs[15] = dest; | ||
30 | + arm_rebuild_hflags(env); | ||
31 | } | ||
32 | |||
33 | static uint32_t *get_v7m_sp_ptr(CPUARMState *env, bool secure, bool threadmode, | ||
34 | @@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, | ||
35 | env->regs[14] = lr; | ||
36 | env->regs[15] = addr & 0xfffffffe; | ||
37 | env->thumb = addr & 1; | ||
38 | + arm_rebuild_hflags(env); | ||
39 | } | ||
40 | |||
41 | static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr, | ||
42 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
43 | |||
44 | /* Otherwise, we have a successful exception exit. */ | ||
45 | arm_clear_exclusive(env); | ||
46 | + arm_rebuild_hflags(env); | ||
47 | qemu_log_mask(CPU_LOG_INT, "...successful exception return\n"); | ||
48 | } | ||
49 | |||
50 | @@ -XXX,XX +XXX,XX @@ static bool do_v7m_function_return(ARMCPU *cpu) | ||
51 | xpsr_write(env, 0, XPSR_IT); | ||
52 | env->thumb = newpc & 1; | ||
53 | env->regs[15] = newpc & ~1; | ||
54 | + arm_rebuild_hflags(env); | ||
55 | |||
56 | qemu_log_mask(CPU_LOG_INT, "...function return successful\n"); | ||
57 | return true; | ||
58 | @@ -XXX,XX +XXX,XX @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu) | ||
59 | switch_v7m_security_state(env, true); | ||
60 | xpsr_write(env, 0, XPSR_IT); | ||
61 | env->regs[15] += 4; | ||
62 | + arm_rebuild_hflags(env); | ||
63 | return true; | ||
64 | |||
65 | gen_invep: | ||
66 | 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 |
67 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
68 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
69 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
70 | @@ -XXX,XX +XXX,XX @@ static bool trans_MRS_v7m(DisasContext *s, arg_MRS_v7m *a) | 14 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
71 | |||
72 | static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) | ||
73 | { | 15 | { |
74 | - TCGv_i32 addr, reg; | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
75 | + TCGv_i32 addr, reg, el; | 17 | CPUARMState *env = cpu->env_ptr; |
76 | 18 | + uint32_t pc = dc->base.pc_next; | |
77 | if (!arm_dc_feature(s, ARM_FEATURE_M)) { | 19 | unsigned int insn; |
78 | return false; | 20 | |
79 | @@ -XXX,XX +XXX,XX @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) | 21 | if (arm_pre_translate_insn(dc)) { |
80 | gen_helper_v7m_msr(cpu_env, addr, reg); | 22 | - dc->base.pc_next += 4; |
81 | tcg_temp_free_i32(addr); | 23 | + dc->base.pc_next = pc + 4; |
82 | tcg_temp_free_i32(reg); | 24 | return; |
83 | + el = tcg_const_i32(s->current_el); | 25 | } |
84 | + gen_helper_rebuild_hflags_m32(cpu_env, el); | 26 | |
85 | + tcg_temp_free_i32(el); | 27 | - dc->pc_curr = dc->base.pc_next; |
86 | gen_lookup_tb(s); | 28 | - insn = arm_ldl_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); |
87 | return true; | 29 | + dc->pc_curr = pc; |
88 | } | 30 | + insn = arm_ldl_code(env, &dc->base, pc, dc->sctlr_b); |
31 | dc->insn = insn; | ||
32 | - dc->base.pc_next += 4; | ||
33 | + dc->base.pc_next = pc + 4; | ||
34 | disas_arm_insn(dc, insn); | ||
35 | |||
36 | arm_post_translate_insn(dc); | ||
89 | -- | 37 | -- |
90 | 2.20.1 | 38 | 2.25.1 |
91 | 39 | ||
92 | 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 | The 32-bit product should be sign-extended, not zero-extended. | ||
4 | |||
5 | Fixes: ea96b374641b | ||
6 | Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
10 | Message-id: 20190912183058.17947-1-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.c | 4 +++- | 7 | target/arm/translate.c | 16 ++++++++-------- |
14 | 1 file changed, 3 insertions(+), 1 deletion(-) | 8 | 1 file changed, 8 insertions(+), 8 deletions(-) |
15 | 9 | ||
16 | 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 |
17 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate.c | 12 | --- a/target/arm/translate.c |
19 | +++ b/target/arm/translate.c | 13 | +++ b/target/arm/translate.c |
20 | @@ -XXX,XX +XXX,XX @@ static bool op_smlaxxx(DisasContext *s, arg_rrrr *a, | 14 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
21 | case 2: | 15 | { |
22 | tl = load_reg(s, a->ra); | 16 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
23 | th = load_reg(s, a->rd); | 17 | CPUARMState *env = cpu->env_ptr; |
24 | - t1 = tcg_const_i32(0); | 18 | + uint32_t pc = dc->base.pc_next; |
25 | + /* Sign-extend the 32-bit product to 64 bits. */ | 19 | uint32_t insn; |
26 | + t1 = tcg_temp_new_i32(); | 20 | bool is_16bit; |
27 | + tcg_gen_sari_i32(t1, t0, 31); | 21 | |
28 | tcg_gen_add2_i32(tl, th, tl, th, t0, t1); | 22 | if (arm_pre_translate_insn(dc)) { |
29 | tcg_temp_free_i32(t0); | 23 | - dc->base.pc_next += 2; |
30 | tcg_temp_free_i32(t1); | 24 | + dc->base.pc_next = pc + 2; |
25 | return; | ||
26 | } | ||
27 | |||
28 | - dc->pc_curr = dc->base.pc_next; | ||
29 | - insn = arm_lduw_code(env, &dc->base, dc->base.pc_next, dc->sctlr_b); | ||
30 | + dc->pc_curr = pc; | ||
31 | + insn = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | ||
32 | is_16bit = thumb_insn_is_16bit(dc, dc->base.pc_next, insn); | ||
33 | - dc->base.pc_next += 2; | ||
34 | + pc += 2; | ||
35 | if (!is_16bit) { | ||
36 | - uint32_t insn2 = arm_lduw_code(env, &dc->base, dc->base.pc_next, | ||
37 | - dc->sctlr_b); | ||
38 | - | ||
39 | + uint32_t insn2 = arm_lduw_code(env, &dc->base, pc, dc->sctlr_b); | ||
40 | insn = insn << 16 | insn2; | ||
41 | - dc->base.pc_next += 2; | ||
42 | + pc += 2; | ||
43 | } | ||
44 | + dc->base.pc_next = pc; | ||
45 | dc->insn = insn; | ||
46 | |||
47 | if (dc->pstate_il) { | ||
31 | -- | 48 | -- |
32 | 2.20.1 | 49 | 2.25.1 |
33 | 50 | ||
34 | 51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Cédric Le Goater <clg@kaod.org> | ||
2 | 1 | ||
3 | Define the board with 1 GiB of RAM but some boards can have up to 2 | ||
4 | GiB. | ||
5 | |||
6 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Reviewed-by: Joel Stanley <joel@jms.id.au> | ||
8 | Message-id: 20191016090745.15334-1-clg@kaod.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/aspeed.h | 1 + | ||
12 | hw/arm/aspeed.c | 23 +++++++++++++++++++++++ | ||
13 | 2 files changed, 24 insertions(+) | ||
14 | |||
15 | diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/aspeed.h | ||
18 | +++ b/include/hw/arm/aspeed.h | ||
19 | @@ -XXX,XX +XXX,XX @@ typedef struct AspeedBoardConfig { | ||
20 | const char *desc; | ||
21 | const char *soc_name; | ||
22 | uint32_t hw_strap1; | ||
23 | + uint32_t hw_strap2; | ||
24 | const char *fmc_model; | ||
25 | const char *spi_model; | ||
26 | uint32_t num_cs; | ||
27 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/hw/arm/aspeed.c | ||
30 | +++ b/hw/arm/aspeed.c | ||
31 | @@ -XXX,XX +XXX,XX @@ struct AspeedBoardState { | ||
32 | /* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */ | ||
33 | #define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1 | ||
34 | |||
35 | +/* AST2600 evb hardware value */ | ||
36 | +#define AST2600_EVB_HW_STRAP1 0x000000C0 | ||
37 | +#define AST2600_EVB_HW_STRAP2 0x00000003 | ||
38 | + | ||
39 | /* | ||
40 | * The max ram region is for firmwares that scan the address space | ||
41 | * with load/store to guess how much RAM the SoC has. | ||
42 | @@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine, | ||
43 | &error_abort); | ||
44 | object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1", | ||
45 | &error_abort); | ||
46 | + object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap2, "hw-strap2", | ||
47 | + &error_abort); | ||
48 | object_property_set_int(OBJECT(&bmc->soc), cfg->num_cs, "num-cs", | ||
49 | &error_abort); | ||
50 | object_property_set_int(OBJECT(&bmc->soc), machine->smp.cpus, "num-cpus", | ||
51 | @@ -XXX,XX +XXX,XX @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc) | ||
52 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32); | ||
53 | } | ||
54 | |||
55 | +static void ast2600_evb_i2c_init(AspeedBoardState *bmc) | ||
56 | +{ | ||
57 | + /* Start with some devices on our I2C busses */ | ||
58 | + ast2500_evb_i2c_init(bmc); | ||
59 | +} | ||
60 | + | ||
61 | static void romulus_bmc_i2c_init(AspeedBoardState *bmc) | ||
62 | { | ||
63 | AspeedSoCState *soc = &bmc->soc; | ||
64 | @@ -XXX,XX +XXX,XX @@ static const AspeedBoardConfig aspeed_boards[] = { | ||
65 | .num_cs = 2, | ||
66 | .i2c_init = witherspoon_bmc_i2c_init, | ||
67 | .ram = 512 * MiB, | ||
68 | + }, { | ||
69 | + .name = MACHINE_TYPE_NAME("ast2600-evb"), | ||
70 | + .desc = "Aspeed AST2600 EVB (Cortex A7)", | ||
71 | + .soc_name = "ast2600-a0", | ||
72 | + .hw_strap1 = AST2600_EVB_HW_STRAP1, | ||
73 | + .hw_strap2 = AST2600_EVB_HW_STRAP2, | ||
74 | + .fmc_model = "w25q512jv", | ||
75 | + .spi_model = "mx66u51235f", | ||
76 | + .num_cs = 1, | ||
77 | + .i2c_init = ast2600_evb_i2c_init, | ||
78 | + .ram = 1 * GiB, | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | -- | ||
83 | 2.20.1 | ||
84 | |||
85 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Guenter Roeck <linux@roeck-us.net> | ||
2 | 1 | ||
3 | When booting a recent Linux kernel, the qemu message "Timer with delta | ||
4 | zero, disabling" is seen, apparently because a ptimer is started before | ||
5 | being initialized. Fix the problem by initializing the offending ptimer | ||
6 | before starting it. | ||
7 | |||
8 | The bug is effectively harmless in the old QEMUBH setup | ||
9 | because the sequence of events is: | ||
10 | * the delta zero means the timer expires immediately | ||
11 | * ptimer_reload() arranges for exynos4210_gfrc_event() to be called | ||
12 | * ptimer_reload() notices the zero delta and disables the timer | ||
13 | * later, the QEMUBH runs, and exynos4210_gfrc_event() correctly | ||
14 | configures the timer and restarts it | ||
15 | |||
16 | In the new transaction based API the bug is still harmless, | ||
17 | but differences of when the callback function runs mean the | ||
18 | message is not printed any more: | ||
19 | * ptimer_run() does nothing as it's inside a transaction block | ||
20 | * ptimer_transaction_commit() sees it has work to do and | ||
21 | calls ptimer_reload() | ||
22 | * the zero delta means the timer expires immediately | ||
23 | * ptimer_reload() calls exynos4210_gfrc_event() directly | ||
24 | * exynos4210_gfrc_event() configures the timer | ||
25 | * the delta is no longer zero so ptimer_reload() doesn't complain | ||
26 | (the zero-delta test is after the trigger-callback in | ||
27 | the ptimer_reload() function) | ||
28 | |||
29 | Regardless, the behaviour here was not intentional, and we should | ||
30 | just program the ptimer correctly to start with. | ||
31 | |||
32 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
33 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
34 | Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
36 | Message-id: 20191018143149.9216-1-peter.maydell@linaro.org | ||
37 | [PMM: Expansion/clarification of the commit message: | ||
38 | the message is about a zero delta, not a zero period; | ||
39 | added detail to the commit message of the analysis of what | ||
40 | is happening and why the kernel boots even with the message; | ||
41 | added note that the message goes away with the new ptimer API] | ||
42 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
43 | --- | ||
44 | hw/timer/exynos4210_mct.c | 2 +- | ||
45 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
46 | |||
47 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/hw/timer/exynos4210_mct.c | ||
50 | +++ b/hw/timer/exynos4210_mct.c | ||
51 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset, | ||
52 | /* Start FRC if transition from disabled to enabled */ | ||
53 | if ((value & G_TCON_TIMER_ENABLE) > (old_val & | ||
54 | G_TCON_TIMER_ENABLE)) { | ||
55 | - exynos4210_gfrc_start(&s->g_timer); | ||
56 | + exynos4210_gfrc_restart(s); | ||
57 | } | ||
58 | if ((value & G_TCON_TIMER_ENABLE) < (old_val & | ||
59 | G_TCON_TIMER_ENABLE)) { | ||
60 | -- | ||
61 | 2.20.1 | ||
62 | |||
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 | Continue setting, but not relying upon, env->hflags. | 3 | Create arm_check_ss_active and arm_check_kernelpage. |
4 | |||
5 | Reverse the order of the tests. While it doesn't matter in practice, | ||
6 | because only user-only has a kernel page and user-only never sets | ||
7 | ss_active, ss_active has priority over execution exceptions and it | ||
8 | is best to keep them in the proper order. | ||
4 | 9 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20191018174431.1784-20-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 13 | --- |
10 | target/arm/helper.c | 10 ++++++++++ | 14 | target/arm/translate.c | 10 +++++++--- |
11 | 1 file changed, 10 insertions(+) | 15 | 1 file changed, 7 insertions(+), 3 deletions(-) |
12 | 16 | ||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 17 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 19 | --- a/target/arm/translate.c |
16 | +++ b/target/arm/helper.c | 20 | +++ b/target/arm/translate.c |
17 | @@ -XXX,XX +XXX,XX @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 21 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) |
18 | /* ??? Lots of these bits are not implemented. */ | 22 | dc->insn_start = tcg_last_op(); |
19 | /* This may enable/disable the MMU, so do a TLB flush. */ | ||
20 | tlb_flush(CPU(cpu)); | ||
21 | + | ||
22 | + if (ri->type & ARM_CP_SUPPRESS_TB_END) { | ||
23 | + /* | ||
24 | + * Normally we would always end the TB on an SCTLR write; see the | ||
25 | + * comment in ARMCPRegInfo sctlr initialization below for why Xscale | ||
26 | + * is special. Setting ARM_CP_SUPPRESS_TB_END also stops the rebuild | ||
27 | + * of hflags from the translator, so do it here. | ||
28 | + */ | ||
29 | + arm_rebuild_hflags(env); | ||
30 | + } | ||
31 | } | 23 | } |
32 | 24 | ||
33 | static CPAccessResult fpexc32_access(CPUARMState *env, const ARMCPRegInfo *ri, | 25 | -static bool arm_pre_translate_insn(DisasContext *dc) |
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) | ||
38 | +{ | ||
39 | if (dc->ss_active && !dc->pstate_ss) { | ||
40 | /* Singlestep state is Active-pending. | ||
41 | * If we're in this state at the start of a TB then either | ||
42 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
43 | uint32_t pc = dc->base.pc_next; | ||
44 | unsigned int insn; | ||
45 | |||
46 | - if (arm_pre_translate_insn(dc)) { | ||
47 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
48 | dc->base.pc_next = pc + 4; | ||
49 | return; | ||
50 | } | ||
51 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
52 | uint32_t insn; | ||
53 | bool is_16bit; | ||
54 | |||
55 | - if (arm_pre_translate_insn(dc)) { | ||
56 | + if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
57 | dc->base.pc_next = pc + 2; | ||
58 | return; | ||
59 | } | ||
34 | -- | 60 | -- |
35 | 2.20.1 | 61 | 2.25.1 |
36 | 62 | ||
37 | 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 | Continue setting, but not relying upon, env->hflags. | 3 | The size of the code covered by a TranslationBlock cannot be 0; |
4 | this is checked via assert in tb_gen_code. | ||
4 | 5 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20191018174431.1784-18-richard.henderson@linaro.org | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 9 | --- |
10 | target/arm/translate-a64.c | 13 +++++++++++-- | 10 | target/arm/translate-a64.c | 1 + |
11 | target/arm/translate.c | 28 +++++++++++++++++++++++----- | 11 | 1 file changed, 1 insertion(+) |
12 | 2 files changed, 34 insertions(+), 7 deletions(-) | ||
13 | 12 | ||
14 | 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 |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-a64.c | 15 | --- a/target/arm/translate-a64.c |
17 | +++ b/target/arm/translate-a64.c | 16 | +++ b/target/arm/translate-a64.c |
18 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | 17 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
19 | if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { | 18 | assert(s->base.num_insns == 1); |
20 | /* I/O operations must end the TB here (whether read or write) */ | 19 | gen_swstep_exception(s, 0, 0); |
21 | s->base.is_jmp = DISAS_UPDATE; | 20 | s->base.is_jmp = DISAS_NORETURN; |
22 | - } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { | 21 | + s->base.pc_next = pc + 4; |
23 | - /* We default to ending the TB on a coprocessor register write, | 22 | return; |
24 | + } | 23 | } |
25 | + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { | ||
26 | + /* | ||
27 | + * A write to any coprocessor regiser that ends a TB | ||
28 | + * must rebuild the hflags for the next TB. | ||
29 | + */ | ||
30 | + TCGv_i32 tcg_el = tcg_const_i32(s->current_el); | ||
31 | + gen_helper_rebuild_hflags_a64(cpu_env, tcg_el); | ||
32 | + tcg_temp_free_i32(tcg_el); | ||
33 | + /* | ||
34 | + * We default to ending the TB on a coprocessor register write, | ||
35 | * but allow this to be suppressed by the register definition | ||
36 | * (usually only necessary to work around guest bugs). | ||
37 | */ | ||
38 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/arm/translate.c | ||
41 | +++ b/target/arm/translate.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
43 | ri = get_arm_cp_reginfo(s->cp_regs, | ||
44 | ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); | ||
45 | if (ri) { | ||
46 | + bool need_exit_tb; | ||
47 | + | ||
48 | /* Check access permissions */ | ||
49 | if (!cp_access_ok(s->current_el, ri, isread)) { | ||
50 | return 1; | ||
51 | @@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
52 | } | ||
53 | } | ||
54 | |||
55 | - if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { | ||
56 | - /* I/O operations must end the TB here (whether read or write) */ | ||
57 | - gen_lookup_tb(s); | ||
58 | - } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { | ||
59 | - /* We default to ending the TB on a coprocessor register write, | ||
60 | + /* I/O operations must end the TB here (whether read or write) */ | ||
61 | + need_exit_tb = ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && | ||
62 | + (ri->type & ARM_CP_IO)); | ||
63 | + | ||
64 | + if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { | ||
65 | + /* | ||
66 | + * A write to any coprocessor regiser that ends a TB | ||
67 | + * must rebuild the hflags for the next TB. | ||
68 | + */ | ||
69 | + TCGv_i32 tcg_el = tcg_const_i32(s->current_el); | ||
70 | + if (arm_dc_feature(s, ARM_FEATURE_M)) { | ||
71 | + gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); | ||
72 | + } else { | ||
73 | + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); | ||
74 | + } | ||
75 | + tcg_temp_free_i32(tcg_el); | ||
76 | + /* | ||
77 | + * We default to ending the TB on a coprocessor register write, | ||
78 | * but allow this to be suppressed by the register definition | ||
79 | * (usually only necessary to work around guest bugs). | ||
80 | */ | ||
81 | + need_exit_tb = true; | ||
82 | + } | ||
83 | + if (need_exit_tb) { | ||
84 | gen_lookup_tb(s); | ||
85 | } | ||
86 | 24 | ||
87 | -- | 25 | -- |
88 | 2.20.1 | 26 | 2.25.1 |
89 | 27 | ||
90 | 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 | Create a function to compute the values of the TBFLAG_A32 bits | 3 | We will reuse this section of arm_deliver_fault for |
4 | that will be cached, and are used by all profiles. | 4 | raising pc alignment faults. |
5 | 5 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20191018174431.1784-4-richard.henderson@linaro.org | 7 | Reviewed-by: Peter Maydell <peter.maydell@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/helper.c | 16 +++++++++++----- | 10 | target/arm/tlb_helper.c | 45 +++++++++++++++++++++++++---------------- |
12 | 1 file changed, 11 insertions(+), 5 deletions(-) | 11 | 1 file changed, 28 insertions(+), 17 deletions(-) |
13 | 12 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 13 | diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 15 | --- a/target/arm/tlb_helper.c |
17 | +++ b/target/arm/helper.c | 16 | +++ b/target/arm/tlb_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | 17 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, |
19 | return flags; | 18 | return syn; |
20 | } | 19 | } |
21 | 20 | ||
22 | +static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | 21 | -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
23 | + ARMMMUIdx mmu_idx, uint32_t flags) | 22 | - MMUAccessType access_type, |
24 | +{ | 23 | - int mmu_idx, ARMMMUFaultInfo *fi) |
25 | + flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); | 24 | +static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi, |
26 | + flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); | 25 | + int target_el, int mmu_idx, uint32_t *ret_fsc) |
27 | + | 26 | { |
28 | + return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | 27 | - CPUARMState *env = &cpu->env; |
28 | - int target_el; | ||
29 | - bool same_el; | ||
30 | - uint32_t syn, exc, fsr, fsc; | ||
31 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | ||
32 | - | ||
33 | - target_el = exception_target_el(env); | ||
34 | - if (fi->stage2) { | ||
35 | - target_el = 2; | ||
36 | - env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
37 | - if (arm_is_secure_below_el3(env) && fi->s1ns) { | ||
38 | - env->cp15.hpfar_el2 |= HPFAR_NS; | ||
39 | - } | ||
40 | - } | ||
41 | - same_el = (arm_current_el(env) == target_el); | ||
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; | ||
48 | } | ||
49 | |||
50 | + *ret_fsc = fsc; | ||
51 | + return fsr; | ||
29 | +} | 52 | +} |
30 | + | 53 | + |
31 | static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | 54 | +static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, |
32 | ARMMMUIdx mmu_idx) | 55 | + MMUAccessType access_type, |
33 | { | 56 | + int mmu_idx, ARMMMUFaultInfo *fi) |
34 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 57 | +{ |
35 | ARMMMUIdx mmu_idx = arm_mmu_idx(env); | 58 | + CPUARMState *env = &cpu->env; |
36 | int current_el = arm_current_el(env); | 59 | + int target_el; |
37 | int fp_el = fp_exception_el(env, current_el); | 60 | + bool same_el; |
38 | - uint32_t flags = 0; | 61 | + uint32_t syn, exc, fsr, fsc; |
39 | + uint32_t flags; | 62 | + |
40 | 63 | + target_el = exception_target_el(env); | |
41 | if (is_a64(env)) { | 64 | + if (fi->stage2) { |
42 | *pc = env->pc; | 65 | + target_el = 2; |
43 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 66 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; |
44 | } | 67 | + if (arm_is_secure_below_el3(env) && fi->s1ns) { |
45 | } else { | 68 | + env->cp15.hpfar_el2 |= HPFAR_NS; |
46 | *pc = env->regs[15]; | 69 | + } |
47 | + flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | 70 | + } |
48 | flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); | 71 | + same_el = (arm_current_el(env) == target_el); |
49 | flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); | 72 | + |
50 | flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride); | 73 | + fsr = compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); |
51 | flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits); | 74 | + |
52 | - flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); | 75 | if (access_type == MMU_INST_FETCH) { |
53 | - flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); | 76 | syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); |
54 | if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) | 77 | exc = EXCP_PREFETCH_ABORT; |
55 | || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { | ||
56 | flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
57 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
58 | flags = FIELD_DP32(flags, TBFLAG_A32, | ||
59 | XSCALE_CPAR, env->cp15.c15_cpar); | ||
60 | } | ||
61 | - | ||
62 | - flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
63 | } | ||
64 | |||
65 | /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine | ||
66 | -- | 78 | -- |
67 | 2.20.1 | 79 | 2.25.1 |
68 | 80 | ||
69 | 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 | This functions are given the mode and el state of the cpu | 3 | For A64, any input to an indirect branch can cause this. |
4 | and writes the computed value to env->hflags. | 4 | |
5 | 5 | For A32, many indirect branch paths force the branch to be aligned, | |
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 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 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20191018174431.1784-16-richard.henderson@linaro.org | 16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 18 | --- |
11 | target/arm/helper.h | 4 ++++ | 19 | target/arm/helper.h | 1 + |
12 | target/arm/helper.c | 24 ++++++++++++++++++++++++ | 20 | target/arm/syndrome.h | 5 ++++ |
13 | 2 files changed, 28 insertions(+) | 21 | linux-user/aarch64/cpu_loop.c | 46 ++++++++++++++++++++--------------- |
22 | target/arm/tlb_helper.c | 18 ++++++++++++++ | ||
23 | target/arm/translate-a64.c | 15 ++++++++++++ | ||
24 | target/arm/translate.c | 22 ++++++++++++++++- | ||
25 | 6 files changed, 87 insertions(+), 20 deletions(-) | ||
14 | 26 | ||
15 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 27 | diff --git a/target/arm/helper.h b/target/arm/helper.h |
16 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.h | 29 | --- a/target/arm/helper.h |
18 | +++ b/target/arm/helper.h | 30 | +++ b/target/arm/helper.h |
19 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_4(msr_banked, void, env, i32, i32, i32) | 31 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, |
20 | DEF_HELPER_2(get_user_reg, i32, env, i32) | 32 | DEF_HELPER_2(exception_internal, void, env, i32) |
21 | DEF_HELPER_3(set_user_reg, void, env, i32, i32) | 33 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) |
22 | 34 | DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | |
23 | +DEF_HELPER_FLAGS_2(rebuild_hflags_m32, TCG_CALL_NO_RWG, void, env, int) | 35 | +DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) |
24 | +DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int) | 36 | DEF_HELPER_1(setend, void, env) |
25 | +DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int) | 37 | DEF_HELPER_2(wfi, void, env, i32) |
26 | + | 38 | DEF_HELPER_1(wfe, void, env) |
27 | DEF_HELPER_1(vfp_get_fpscr, i32, env) | 39 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h |
28 | DEF_HELPER_2(vfp_set_fpscr, void, env, i32) | 40 | index XXXXXXX..XXXXXXX 100644 |
29 | 41 | --- a/target/arm/syndrome.h | |
30 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 42 | +++ b/target/arm/syndrome.h |
31 | index XXXXXXX..XXXXXXX 100644 | 43 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_illegalstate(void) |
32 | --- a/target/arm/helper.c | 44 | return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; |
33 | +++ b/target/arm/helper.c | ||
34 | @@ -XXX,XX +XXX,XX @@ void arm_rebuild_hflags(CPUARMState *env) | ||
35 | env->hflags = rebuild_hflags_internal(env); | ||
36 | } | 45 | } |
37 | 46 | ||
38 | +void HELPER(rebuild_hflags_m32)(CPUARMState *env, int el) | 47 | +static inline uint32_t syn_pcalignment(void) |
39 | +{ | 48 | +{ |
40 | + int fp_el = fp_exception_el(env, el); | 49 | + return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; |
41 | + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el); | ||
42 | + | ||
43 | + env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx); | ||
44 | +} | 50 | +} |
45 | + | 51 | + |
46 | +void HELPER(rebuild_hflags_a32)(CPUARMState *env, int el) | 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) | ||
47 | +{ | 129 | +{ |
48 | + int fp_el = fp_exception_el(env, el); | 130 | + ARMMMUFaultInfo fi = { .type = ARMFault_Alignment }; |
49 | + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el); | 131 | + int target_el = exception_target_el(env); |
50 | + | 132 | + int mmu_idx = cpu_mmu_index(env, true); |
51 | + env->hflags = rebuild_hflags_a32(env, fp_el, mmu_idx); | 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); | ||
52 | +} | 143 | +} |
53 | + | 144 | + |
54 | +void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el) | 145 | #if !defined(CONFIG_USER_ONLY) |
55 | +{ | 146 | |
56 | + int fp_el = fp_exception_el(env, el); | 147 | /* |
57 | + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el); | 148 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
58 | + | 149 | index XXXXXXX..XXXXXXX 100644 |
59 | + env->hflags = rebuild_hflags_a64(env, el, fp_el, mmu_idx); | 150 | --- a/target/arm/translate-a64.c |
60 | +} | 151 | +++ b/target/arm/translate-a64.c |
61 | + | 152 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
62 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 153 | uint64_t pc = s->base.pc_next; |
63 | target_ulong *cs_base, uint32_t *pflags) | 154 | uint32_t insn; |
64 | { | 155 | |
156 | + /* Singlestep exceptions have the highest priority. */ | ||
157 | if (s->ss_active && !s->pstate_ss) { | ||
158 | /* Singlestep state is Active-pending. | ||
159 | * If we're in this state at the start of a TB then either | ||
160 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | + if (pc & 3) { | ||
165 | + /* | ||
166 | + * PC alignment fault. This has priority over the instruction abort | ||
167 | + * that we would receive from a translation fault via arm_ldl_code. | ||
168 | + * This should only be possible after an indirect branch, at the | ||
169 | + * start of the TB. | ||
170 | + */ | ||
171 | + assert(s->base.num_insns == 1); | ||
172 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
173 | + s->base.is_jmp = DISAS_NORETURN; | ||
174 | + s->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
175 | + return; | ||
176 | + } | ||
177 | + | ||
178 | s->pc_curr = pc; | ||
179 | insn = arm_ldl_code(env, &s->base, pc, s->sctlr_b); | ||
180 | s->insn = insn; | ||
181 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/target/arm/translate.c | ||
184 | +++ b/target/arm/translate.c | ||
185 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
186 | uint32_t pc = dc->base.pc_next; | ||
187 | unsigned int insn; | ||
188 | |||
189 | - if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { | ||
190 | + /* Singlestep exceptions have the highest priority. */ | ||
191 | + if (arm_check_ss_active(dc)) { | ||
192 | + dc->base.pc_next = pc + 4; | ||
193 | + return; | ||
194 | + } | ||
195 | + | ||
196 | + if (pc & 3) { | ||
197 | + /* | ||
198 | + * PC alignment fault. This has priority over the instruction abort | ||
199 | + * that we would receive from a translation fault via arm_ldl_code | ||
200 | + * (or the execution of the kernelpage entrypoint). This should only | ||
201 | + * be possible after an indirect branch, at the start of the TB. | ||
202 | + */ | ||
203 | + assert(dc->base.num_insns == 1); | ||
204 | + gen_helper_exception_pc_alignment(cpu_env, tcg_constant_tl(pc)); | ||
205 | + dc->base.is_jmp = DISAS_NORETURN; | ||
206 | + dc->base.pc_next = QEMU_ALIGN_UP(pc, 4); | ||
207 | + return; | ||
208 | + } | ||
209 | + | ||
210 | + if (arm_check_kernelpage(dc)) { | ||
211 | dc->base.pc_next = pc + 4; | ||
212 | return; | ||
213 | } | ||
65 | -- | 214 | -- |
66 | 2.20.1 | 215 | 2.25.1 |
67 | 216 | ||
68 | 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 | Begin setting, but not relying upon, env->hflags. | 3 | Misaligned thumb PC is architecturally impossible. |
4 | Assert is better than proceeding, in case we've missed | ||
5 | something somewhere. | ||
4 | 6 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 7 | Expand a comment about aligning the pc in gdbstub. |
8 | Fail an incoming migrate if a thumb pc is misaligned. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20191018174431.1784-17-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 13 | --- |
10 | linux-user/syscall.c | 1 + | 14 | target/arm/gdbstub.c | 9 +++++++-- |
11 | target/arm/cpu.c | 1 + | 15 | target/arm/machine.c | 10 ++++++++++ |
12 | target/arm/helper-a64.c | 3 +++ | 16 | target/arm/translate.c | 3 +++ |
13 | target/arm/helper.c | 2 ++ | 17 | 3 files changed, 20 insertions(+), 2 deletions(-) |
14 | target/arm/machine.c | 1 + | ||
15 | target/arm/op_helper.c | 1 + | ||
16 | 6 files changed, 9 insertions(+) | ||
17 | 18 | ||
18 | diff --git a/linux-user/syscall.c b/linux-user/syscall.c | 19 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/linux-user/syscall.c | 21 | --- a/target/arm/gdbstub.c |
21 | +++ b/linux-user/syscall.c | 22 | +++ b/target/arm/gdbstub.c |
22 | @@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, | 23 | @@ -XXX,XX +XXX,XX @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) |
23 | aarch64_sve_narrow_vq(env, vq); | 24 | |
24 | } | 25 | tmp = ldl_p(mem_buf); |
25 | env->vfp.zcr_el[1] = vq - 1; | 26 | |
26 | + arm_rebuild_hflags(env); | 27 | - /* Mask out low bit of PC to workaround gdb bugs. This will probably |
27 | ret = vq * 16; | 28 | - cause problems if we ever implement the Jazelle DBX extensions. */ |
28 | } | 29 | + /* |
29 | return ret; | 30 | + * Mask out low bits of PC to workaround gdb bugs. |
30 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 31 | + * This avoids an assert in thumb_tr_translate_insn, because it is |
31 | index XXXXXXX..XXXXXXX 100644 | 32 | + * architecturally impossible to misalign the pc. |
32 | --- a/target/arm/cpu.c | 33 | + * This will probably cause problems if we ever implement the |
33 | +++ b/target/arm/cpu.c | 34 | + * Jazelle DBX extensions. |
34 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) | 35 | + */ |
35 | 36 | if (n == 15) { | |
36 | hw_breakpoint_update_all(cpu); | 37 | tmp &= ~1; |
37 | hw_watchpoint_update_all(cpu); | ||
38 | + arm_rebuild_hflags(env); | ||
39 | } | ||
40 | |||
41 | bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) | ||
42 | diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/target/arm/helper-a64.c | ||
45 | +++ b/target/arm/helper-a64.c | ||
46 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) | ||
47 | } else { | ||
48 | env->regs[15] = new_pc & ~0x3; | ||
49 | } | ||
50 | + helper_rebuild_hflags_a32(env, new_el); | ||
51 | qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " | ||
52 | "AArch32 EL%d PC 0x%" PRIx32 "\n", | ||
53 | cur_el, new_el, env->regs[15]); | ||
54 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) | ||
55 | } | ||
56 | aarch64_restore_sp(env, new_el); | ||
57 | env->pc = new_pc; | ||
58 | + helper_rebuild_hflags_a64(env, new_el); | ||
59 | qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to " | ||
60 | "AArch64 EL%d PC 0x%" PRIx64 "\n", | ||
61 | cur_el, new_el, env->pc); | ||
62 | } | 38 | } |
63 | + | ||
64 | /* | ||
65 | * Note that cur_el can never be 0. If new_el is 0, then | ||
66 | * el0_a64 is return_to_aa64, else el0_a64 is ignored. | ||
67 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/target/arm/helper.c | ||
70 | +++ b/target/arm/helper.c | ||
71 | @@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode, | ||
72 | env->regs[14] = env->regs[15] + offset; | ||
73 | } | ||
74 | env->regs[15] = newpc; | ||
75 | + arm_rebuild_hflags(env); | ||
76 | } | ||
77 | |||
78 | static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs) | ||
79 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) | ||
80 | pstate_write(env, PSTATE_DAIF | new_mode); | ||
81 | env->aarch64 = 1; | ||
82 | aarch64_restore_sp(env, new_el); | ||
83 | + helper_rebuild_hflags_a64(env, new_el); | ||
84 | |||
85 | env->pc = addr; | ||
86 | |||
87 | diff --git a/target/arm/machine.c b/target/arm/machine.c | 39 | diff --git a/target/arm/machine.c b/target/arm/machine.c |
88 | index XXXXXXX..XXXXXXX 100644 | 40 | index XXXXXXX..XXXXXXX 100644 |
89 | --- a/target/arm/machine.c | 41 | --- a/target/arm/machine.c |
90 | +++ b/target/arm/machine.c | 42 | +++ b/target/arm/machine.c |
91 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) | 43 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
44 | return -1; | ||
45 | } | ||
46 | } | ||
47 | + | ||
48 | + /* | ||
49 | + * Misaligned thumb pc is architecturally impossible. | ||
50 | + * We have an assert in thumb_tr_translate_insn to verify this. | ||
51 | + * Fail an incoming migrate to avoid this assert. | ||
52 | + */ | ||
53 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { | ||
54 | + return -1; | ||
55 | + } | ||
56 | + | ||
92 | if (!kvm_enabled()) { | 57 | if (!kvm_enabled()) { |
93 | pmu_op_finish(&cpu->env); | 58 | pmu_op_finish(&cpu->env); |
94 | } | 59 | } |
95 | + arm_rebuild_hflags(&cpu->env); | 60 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
96 | |||
97 | return 0; | ||
98 | } | ||
99 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
100 | index XXXXXXX..XXXXXXX 100644 | 61 | index XXXXXXX..XXXXXXX 100644 |
101 | --- a/target/arm/op_helper.c | 62 | --- a/target/arm/translate.c |
102 | +++ b/target/arm/op_helper.c | 63 | +++ b/target/arm/translate.c |
103 | @@ -XXX,XX +XXX,XX @@ void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t val) | 64 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
104 | * state. Do the masking now. | 65 | uint32_t insn; |
105 | */ | 66 | bool is_16bit; |
106 | env->regs[15] &= (env->thumb ? ~1 : ~3); | 67 | |
107 | + arm_rebuild_hflags(env); | 68 | + /* Misaligned thumb PC is architecturally impossible. */ |
108 | 69 | + assert((dc->base.pc_next & 1) == 0); | |
109 | qemu_mutex_lock_iothread(); | 70 | + |
110 | arm_call_el_change_hook(env_archcpu(env)); | 71 | if (arm_check_ss_active(dc) || arm_check_kernelpage(dc)) { |
72 | dc->base.pc_next = pc + 2; | ||
73 | return; | ||
111 | -- | 74 | -- |
112 | 2.20.1 | 75 | 2.25.1 |
113 | 76 | ||
114 | 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 | Create a function to compute the values of the TBFLAG_A32 bits | 3 | Both single-step and pc alignment faults have priority over |
4 | that will be cached, and are used by M-profile. | 4 | breakpoint exceptions. |
5 | 5 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@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: 20191018174431.1784-6-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/helper.c | 45 ++++++++++++++++++++++++++++++--------------- | 10 | target/arm/debug_helper.c | 23 +++++++++++++++++++++++ |
12 | 1 file changed, 30 insertions(+), 15 deletions(-) | 11 | 1 file changed, 23 insertions(+) |
13 | 12 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.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/helper.c | 15 | --- a/target/arm/debug_helper.c |
17 | +++ b/target/arm/helper.c | 16 | +++ b/target/arm/debug_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | 17 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
19 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | 18 | { |
20 | } | 19 | ARMCPU *cpu = ARM_CPU(cs); |
21 | 20 | CPUARMState *env = &cpu->env; | |
22 | +static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | 21 | + target_ulong pc; |
23 | + ARMMMUIdx mmu_idx) | 22 | int n; |
24 | +{ | 23 | |
25 | + uint32_t flags = 0; | 24 | /* |
26 | + | 25 | @@ -XXX,XX +XXX,XX @@ bool arm_debug_check_breakpoint(CPUState *cs) |
27 | + if (arm_v7m_is_handler_mode(env)) { | 26 | return false; |
28 | + flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); | 27 | } |
28 | |||
29 | + /* | ||
30 | + * Single-step exceptions have priority over breakpoint exceptions. | ||
31 | + * If single-step state is active-pending, suppress the bp. | ||
32 | + */ | ||
33 | + if (arm_singlestep_active(env) && !(env->pstate & PSTATE_SS)) { | ||
34 | + return false; | ||
29 | + } | 35 | + } |
30 | + | 36 | + |
31 | + /* | 37 | + /* |
32 | + * v8M always applies stack limit checks unless CCR.STKOFHFNMIGN | 38 | + * PC alignment faults have priority over breakpoint exceptions. |
33 | + * is suppressing them because the requested execution priority | ||
34 | + * is less than 0. | ||
35 | + */ | 39 | + */ |
36 | + if (arm_feature(env, ARM_FEATURE_V8) && | 40 | + pc = is_a64(env) ? env->pc : env->regs[15]; |
37 | + !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && | 41 | + if ((is_a64(env) || !env->thumb) && (pc & 3) != 0) { |
38 | + (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { | 42 | + return false; |
39 | + flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); | ||
40 | + } | 43 | + } |
41 | + | 44 | + |
42 | + return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | 45 | + /* |
43 | +} | 46 | + * Instruction aborts have priority over breakpoint exceptions. |
47 | + * TODO: We would need to look up the page for PC and verify that | ||
48 | + * it is present and executable. | ||
49 | + */ | ||
44 | + | 50 | + |
45 | static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | 51 | for (n = 0; n < ARRAY_SIZE(env->cpu_breakpoint); n++) { |
46 | ARMMMUIdx mmu_idx) | 52 | if (bp_wp_matches(cpu, n, false)) { |
47 | { | 53 | return true; |
48 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
49 | } | ||
50 | } else { | ||
51 | *pc = env->regs[15]; | ||
52 | - flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | ||
53 | + | ||
54 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
55 | + flags = rebuild_hflags_m32(env, fp_el, mmu_idx); | ||
56 | + } else { | ||
57 | + flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | ||
58 | + } | ||
59 | + | ||
60 | flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); | ||
61 | flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); | ||
62 | flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride); | ||
63 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
64 | } | ||
65 | } | ||
66 | |||
67 | - if (arm_v7m_is_handler_mode(env)) { | ||
68 | - flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); | ||
69 | - } | ||
70 | - | ||
71 | - /* v8M always applies stack limit checks unless CCR.STKOFHFNMIGN is | ||
72 | - * suppressing them because the requested execution priority is less than 0. | ||
73 | - */ | ||
74 | - if (arm_feature(env, ARM_FEATURE_V8) && | ||
75 | - arm_feature(env, ARM_FEATURE_M) && | ||
76 | - !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && | ||
77 | - (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { | ||
78 | - flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); | ||
79 | - } | ||
80 | - | ||
81 | if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | ||
82 | FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) { | ||
83 | flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); | ||
84 | -- | 54 | -- |
85 | 2.20.1 | 55 | 2.25.1 |
86 | 56 | ||
87 | 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 | Set TBFLAG_ANY.BE_DATA in rebuild_hflags_common_32 and | 3 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
4 | rebuild_hflags_a64 instead of rebuild_hflags_common, where we do | ||
5 | not need to re-test is_a64() nor re-compute the various inputs. | ||
6 | |||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20191018174431.1784-5-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 6 | --- |
12 | target/arm/cpu.h | 49 +++++++++++++++++++++++++++------------------ | 7 | tests/tcg/aarch64/pcalign-a64.c | 37 +++++++++++++++++++++++++ |
13 | target/arm/helper.c | 16 +++++++++++---- | 8 | tests/tcg/arm/pcalign-a32.c | 46 +++++++++++++++++++++++++++++++ |
14 | 2 files changed, 42 insertions(+), 23 deletions(-) | 9 | tests/tcg/aarch64/Makefile.target | 4 +-- |
10 | tests/tcg/arm/Makefile.target | 4 +++ | ||
11 | 4 files changed, 89 insertions(+), 2 deletions(-) | ||
12 | create mode 100644 tests/tcg/aarch64/pcalign-a64.c | ||
13 | create mode 100644 tests/tcg/arm/pcalign-a32.c | ||
15 | 14 | ||
16 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 15 | diff --git a/tests/tcg/aarch64/pcalign-a64.c b/tests/tcg/aarch64/pcalign-a64.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | new file mode 100644 |
18 | --- a/target/arm/cpu.h | 17 | index XXXXXXX..XXXXXXX |
19 | +++ b/target/arm/cpu.h | 18 | --- /dev/null |
20 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t arm_sctlr(CPUARMState *env, int el) | 19 | +++ b/tests/tcg/aarch64/pcalign-a64.c |
21 | } | 20 | @@ -XXX,XX +XXX,XX @@ |
22 | } | 21 | +/* Test PC misalignment exception */ |
23 | 22 | + | |
24 | +static inline bool arm_cpu_data_is_big_endian_a32(CPUARMState *env, | 23 | +#include <assert.h> |
25 | + bool sctlr_b) | 24 | +#include <signal.h> |
25 | +#include <stdlib.h> | ||
26 | +#include <stdio.h> | ||
27 | + | ||
28 | +static void *expected; | ||
29 | + | ||
30 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
26 | +{ | 31 | +{ |
27 | +#ifdef CONFIG_USER_ONLY | 32 | + assert(info->si_code == BUS_ADRALN); |
28 | + /* | 33 | + assert(info->si_addr == expected); |
29 | + * In system mode, BE32 is modelled in line with the | 34 | + exit(EXIT_SUCCESS); |
30 | + * architecture (as word-invariant big-endianness), where loads | ||
31 | + * and stores are done little endian but from addresses which | ||
32 | + * are adjusted by XORing with the appropriate constant. So the | ||
33 | + * endianness to use for the raw data access is not affected by | ||
34 | + * SCTLR.B. | ||
35 | + * In user mode, however, we model BE32 as byte-invariant | ||
36 | + * big-endianness (because user-only code cannot tell the | ||
37 | + * difference), and so we need to use a data access endianness | ||
38 | + * that depends on SCTLR.B. | ||
39 | + */ | ||
40 | + if (sctlr_b) { | ||
41 | + return true; | ||
42 | + } | ||
43 | +#endif | ||
44 | + /* In 32bit endianness is determined by looking at CPSR's E bit */ | ||
45 | + return env->uncached_cpsr & CPSR_E; | ||
46 | +} | 35 | +} |
47 | + | 36 | + |
48 | +static inline bool arm_cpu_data_is_big_endian_a64(int el, uint64_t sctlr) | 37 | +int main() |
49 | +{ | 38 | +{ |
50 | + return sctlr & (el ? SCTLR_EE : SCTLR_E0E); | 39 | + void *tmp; |
51 | +} | ||
52 | |||
53 | /* Return true if the processor is in big-endian mode. */ | ||
54 | static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) | ||
55 | { | ||
56 | - /* In 32bit endianness is determined by looking at CPSR's E bit */ | ||
57 | if (!is_a64(env)) { | ||
58 | - return | ||
59 | -#ifdef CONFIG_USER_ONLY | ||
60 | - /* In system mode, BE32 is modelled in line with the | ||
61 | - * architecture (as word-invariant big-endianness), where loads | ||
62 | - * and stores are done little endian but from addresses which | ||
63 | - * are adjusted by XORing with the appropriate constant. So the | ||
64 | - * endianness to use for the raw data access is not affected by | ||
65 | - * SCTLR.B. | ||
66 | - * In user mode, however, we model BE32 as byte-invariant | ||
67 | - * big-endianness (because user-only code cannot tell the | ||
68 | - * difference), and so we need to use a data access endianness | ||
69 | - * that depends on SCTLR.B. | ||
70 | - */ | ||
71 | - arm_sctlr_b(env) || | ||
72 | -#endif | ||
73 | - ((env->uncached_cpsr & CPSR_E) ? 1 : 0); | ||
74 | + return arm_cpu_data_is_big_endian_a32(env, arm_sctlr_b(env)); | ||
75 | } else { | ||
76 | int cur_el = arm_current_el(env); | ||
77 | uint64_t sctlr = arm_sctlr(env, cur_el); | ||
78 | - | ||
79 | - return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) != 0; | ||
80 | + return arm_cpu_data_is_big_endian_a64(cur_el, sctlr); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/target/arm/helper.c | ||
87 | +++ b/target/arm/helper.c | ||
88 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
89 | flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, | ||
90 | arm_to_core_mmu_idx(mmu_idx)); | ||
91 | |||
92 | - if (arm_cpu_data_is_big_endian(env)) { | ||
93 | - flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
94 | - } | ||
95 | if (arm_singlestep_active(env)) { | ||
96 | flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); | ||
97 | } | ||
98 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
99 | static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, | ||
100 | ARMMMUIdx mmu_idx, uint32_t flags) | ||
101 | { | ||
102 | - flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); | ||
103 | + bool sctlr_b = arm_sctlr_b(env); | ||
104 | + | 40 | + |
105 | + if (sctlr_b) { | 41 | + struct sigaction sa = { |
106 | + flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, 1); | 42 | + .sa_sigaction = sigbus, |
107 | + } | 43 | + .sa_flags = SA_SIGINFO |
108 | + if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) { | 44 | + }; |
109 | + flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | 45 | + |
110 | + } | 46 | + if (sigaction(SIGBUS, &sa, NULL) < 0) { |
111 | flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); | 47 | + perror("sigaction"); |
112 | 48 | + return EXIT_FAILURE; | |
113 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
114 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
115 | |||
116 | sctlr = arm_sctlr(env, el); | ||
117 | |||
118 | + if (arm_cpu_data_is_big_endian_a64(el, sctlr)) { | ||
119 | + flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
120 | + } | 49 | + } |
121 | + | 50 | + |
122 | if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) { | 51 | + asm volatile("adr %0, 1f + 1\n\t" |
123 | /* | 52 | + "str %0, %1\n\t" |
124 | * In order to save space in flags, we record only whether | 53 | + "br %0\n" |
54 | + "1:" | ||
55 | + : "=&r"(tmp), "=m"(expected)); | ||
56 | + abort(); | ||
57 | +} | ||
58 | diff --git a/tests/tcg/arm/pcalign-a32.c b/tests/tcg/arm/pcalign-a32.c | ||
59 | new file mode 100644 | ||
60 | index XXXXXXX..XXXXXXX | ||
61 | --- /dev/null | ||
62 | +++ b/tests/tcg/arm/pcalign-a32.c | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | +/* Test PC misalignment exception */ | ||
65 | + | ||
66 | +#ifdef __thumb__ | ||
67 | +#error "This test must be compiled for ARM" | ||
68 | +#endif | ||
69 | + | ||
70 | +#include <assert.h> | ||
71 | +#include <signal.h> | ||
72 | +#include <stdlib.h> | ||
73 | +#include <stdio.h> | ||
74 | + | ||
75 | +static void *expected; | ||
76 | + | ||
77 | +static void sigbus(int sig, siginfo_t *info, void *vuc) | ||
78 | +{ | ||
79 | + assert(info->si_code == BUS_ADRALN); | ||
80 | + assert(info->si_addr == expected); | ||
81 | + exit(EXIT_SUCCESS); | ||
82 | +} | ||
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; | ||
109 | +} | ||
110 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/tests/tcg/aarch64/Makefile.target | ||
113 | +++ b/tests/tcg/aarch64/Makefile.target | ||
114 | @@ -XXX,XX +XXX,XX @@ VPATH += $(ARM_SRC) | ||
115 | AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 | ||
116 | VPATH += $(AARCH64_SRC) | ||
117 | |||
118 | -# Float-convert Tests | ||
119 | -AARCH64_TESTS=fcvt | ||
120 | +# Base architecture tests | ||
121 | +AARCH64_TESTS=fcvt pcalign-a64 | ||
122 | |||
123 | fcvt: LDFLAGS+=-lm | ||
124 | |||
125 | diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target | ||
126 | index XXXXXXX..XXXXXXX 100644 | ||
127 | --- a/tests/tcg/arm/Makefile.target | ||
128 | +++ b/tests/tcg/arm/Makefile.target | ||
129 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
130 | $(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)") | ||
131 | $(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref) | ||
132 | |||
133 | +# PC alignment test | ||
134 | +ARM_TESTS += pcalign-a32 | ||
135 | +pcalign-a32: CFLAGS+=-marm | ||
136 | + | ||
137 | ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y) | ||
138 | |||
139 | # Semihosting smoke test for linux-user | ||
125 | -- | 140 | -- |
126 | 2.20.1 | 141 | 2.25.1 |
127 | 142 | ||
128 | 143 | diff view generated by jsdifflib |
1 | In commit b01422622b we did an automated rename of the ptimer_init() | 1 | In the SSE decode function gen_sse(), we combine a byte |
---|---|---|---|
2 | function to ptimer_init_with_bh(). Unfortunately this caught the | 2 | 'b' and a value 'b1' which can be [0..3], and switch on them: |
3 | unrelated arm_mptimer_init() function. Undo that accidental | 3 | b |= (b1 << 8); |
4 | renaming. | 4 | switch (b) { |
5 | ... | ||
6 | default: | ||
7 | unknown_op: | ||
8 | gen_unknown_opcode(env, s); | ||
9 | return; | ||
10 | } | ||
5 | 11 | ||
6 | Fixes: b01422622b7c7293196fdaf1dbb4f495af44ecf9 | 12 | In three cases inside this switch, we were then also checking for |
13 | "if (b1 >= 2) { goto unknown_op; }". | ||
14 | However, this can never happen, because the 'case' values in each place | ||
15 | are 0x0nn or 0x1nn and the switch will have directed the b1 == (2, 3) | ||
16 | cases to the default already. | ||
17 | |||
18 | This check was added in commit c045af25a52e9 in 2010; the added code | ||
19 | was unnecessary then as well, and was apparently intended only to | ||
20 | ensure that we never accidentally ended up indexing off the end | ||
21 | of an sse_op_table with only 2 entries as a result of future bugs | ||
22 | in the decode logic. | ||
23 | |||
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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20191017133331.5901-1-peter.maydell@linaro.org | ||
11 | --- | 30 | --- |
12 | hw/timer/arm_mptimer.c | 4 ++-- | 31 | target/i386/tcg/translate.c | 12 +++--------- |
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | 32 | 1 file changed, 3 insertions(+), 9 deletions(-) |
14 | 33 | ||
15 | diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c | 34 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c |
16 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/timer/arm_mptimer.c | 36 | --- a/target/i386/tcg/translate.c |
18 | +++ b/hw/timer/arm_mptimer.c | 37 | +++ b/target/i386/tcg/translate.c |
19 | @@ -XXX,XX +XXX,XX @@ static void arm_mptimer_reset(DeviceState *dev) | 38 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
20 | } | 39 | case 0x171: /* shift xmm, im */ |
21 | } | 40 | case 0x172: |
22 | 41 | case 0x173: | |
23 | -static void arm_mptimer_init_with_bh(Object *obj) | 42 | - if (b1 >= 2) { |
24 | +static void arm_mptimer_init(Object *obj) | 43 | - goto unknown_op; |
25 | { | 44 | - } |
26 | ARMMPTimerState *s = ARM_MPTIMER(obj); | 45 | val = x86_ldub_code(env, s); |
27 | 46 | if (is_xmm) { | |
28 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo arm_mptimer_info = { | 47 | tcg_gen_movi_tl(s->T0, val); |
29 | .name = TYPE_ARM_MPTIMER, | 48 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, |
30 | .parent = TYPE_SYS_BUS_DEVICE, | 49 | offsetof(CPUX86State, mmx_t0.MMX_L(1))); |
31 | .instance_size = sizeof(ARMMPTimerState), | 50 | op1_offset = offsetof(CPUX86State,mmx_t0); |
32 | - .instance_init = arm_mptimer_init_with_bh, | 51 | } |
33 | + .instance_init = arm_mptimer_init, | 52 | + assert(b1 < 2); |
34 | .class_init = arm_mptimer_class_init, | 53 | sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + |
35 | }; | 54 | (((modrm >> 3)) & 7)][b1]; |
36 | 55 | if (!sse_fn_epp) { | |
56 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | ||
57 | rm = modrm & 7; | ||
58 | reg = ((modrm >> 3) & 7) | REX_R(s); | ||
59 | mod = (modrm >> 6) & 3; | ||
60 | - if (b1 >= 2) { | ||
61 | - goto unknown_op; | ||
62 | - } | ||
63 | |||
64 | + assert(b1 < 2); | ||
65 | sse_fn_epp = sse_op_table6[b].op[b1]; | ||
66 | if (!sse_fn_epp) { | ||
67 | goto unknown_op; | ||
68 | @@ -XXX,XX +XXX,XX @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, | ||
69 | rm = modrm & 7; | ||
70 | reg = ((modrm >> 3) & 7) | REX_R(s); | ||
71 | mod = (modrm >> 6) & 3; | ||
72 | - if (b1 >= 2) { | ||
73 | - goto unknown_op; | ||
74 | - } | ||
75 | |||
76 | + assert(b1 < 2); | ||
77 | sse_fn_eppi = sse_op_table7[b].op[b1]; | ||
78 | if (!sse_fn_eppi) { | ||
79 | goto unknown_op; | ||
37 | -- | 80 | -- |
38 | 2.20.1 | 81 | 2.25.1 |
39 | 82 | ||
40 | 83 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Switch the puv3_ost code away from bottom-half based ptimers to the | ||
2 | new transaction-based ptimer API. This just requires adding | ||
3 | begin/commit calls around the various places that modify the ptimer | ||
4 | state, and using the new ptimer_init() function to create the timer. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20191017132905.5604-2-peter.maydell@linaro.org | ||
10 | --- | ||
11 | hw/timer/puv3_ost.c | 9 +++++---- | ||
12 | 1 file changed, 5 insertions(+), 4 deletions(-) | ||
13 | |||
14 | diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/timer/puv3_ost.c | ||
17 | +++ b/hw/timer/puv3_ost.c | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | #include "hw/sysbus.h" | ||
20 | #include "hw/irq.h" | ||
21 | #include "hw/ptimer.h" | ||
22 | -#include "qemu/main-loop.h" | ||
23 | #include "qemu/module.h" | ||
24 | |||
25 | #undef DEBUG_PUV3 | ||
26 | @@ -XXX,XX +XXX,XX @@ typedef struct PUV3OSTState { | ||
27 | SysBusDevice parent_obj; | ||
28 | |||
29 | MemoryRegion iomem; | ||
30 | - QEMUBH *bh; | ||
31 | qemu_irq irq; | ||
32 | ptimer_state *ptimer; | ||
33 | |||
34 | @@ -XXX,XX +XXX,XX @@ static void puv3_ost_write(void *opaque, hwaddr offset, | ||
35 | DPRINTF("offset 0x%x, value 0x%x\n", offset, value); | ||
36 | switch (offset) { | ||
37 | case 0x00: /* Match Register 0 */ | ||
38 | + ptimer_transaction_begin(s->ptimer); | ||
39 | s->reg_OSMR0 = value; | ||
40 | if (s->reg_OSMR0 > s->reg_OSCR) { | ||
41 | ptimer_set_count(s->ptimer, s->reg_OSMR0 - s->reg_OSCR); | ||
42 | @@ -XXX,XX +XXX,XX @@ static void puv3_ost_write(void *opaque, hwaddr offset, | ||
43 | (0xffffffff - s->reg_OSCR)); | ||
44 | } | ||
45 | ptimer_run(s->ptimer, 2); | ||
46 | + ptimer_transaction_commit(s->ptimer); | ||
47 | break; | ||
48 | case 0x14: /* Status Register */ | ||
49 | assert(value == 0); | ||
50 | @@ -XXX,XX +XXX,XX @@ static void puv3_ost_realize(DeviceState *dev, Error **errp) | ||
51 | |||
52 | sysbus_init_irq(sbd, &s->irq); | ||
53 | |||
54 | - s->bh = qemu_bh_new(puv3_ost_tick, s); | ||
55 | - s->ptimer = ptimer_init_with_bh(s->bh, PTIMER_POLICY_DEFAULT); | ||
56 | + s->ptimer = ptimer_init(puv3_ost_tick, s, PTIMER_POLICY_DEFAULT); | ||
57 | + ptimer_transaction_begin(s->ptimer); | ||
58 | ptimer_set_freq(s->ptimer, 50 * 1000 * 1000); | ||
59 | + ptimer_transaction_commit(s->ptimer); | ||
60 | |||
61 | memory_region_init_io(&s->iomem, OBJECT(s), &puv3_ost_ops, s, "puv3_ost", | ||
62 | PUV3_REGS_OFFSET); | ||
63 | -- | ||
64 | 2.20.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Switch the sh_timer code away from bottom-half based ptimers to the | ||
2 | new transaction-based ptimer API. This just requires adding | ||
3 | begin/commit calls around the various places that modify the ptimer | ||
4 | state, and using the new ptimer_init() function to create the timer. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20191017132905.5604-3-peter.maydell@linaro.org | ||
10 | --- | ||
11 | hw/timer/sh_timer.c | 13 +++++++++---- | ||
12 | 1 file changed, 9 insertions(+), 4 deletions(-) | ||
13 | |||
14 | diff --git a/hw/timer/sh_timer.c b/hw/timer/sh_timer.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/timer/sh_timer.c | ||
17 | +++ b/hw/timer/sh_timer.c | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | #include "hw/irq.h" | ||
20 | #include "hw/sh4/sh.h" | ||
21 | #include "qemu/timer.h" | ||
22 | -#include "qemu/main-loop.h" | ||
23 | #include "hw/ptimer.h" | ||
24 | |||
25 | //#define DEBUG_TIMER | ||
26 | @@ -XXX,XX +XXX,XX @@ static void sh_timer_write(void *opaque, hwaddr offset, | ||
27 | switch (offset >> 2) { | ||
28 | case OFFSET_TCOR: | ||
29 | s->tcor = value; | ||
30 | + ptimer_transaction_begin(s->timer); | ||
31 | ptimer_set_limit(s->timer, s->tcor, 0); | ||
32 | + ptimer_transaction_commit(s->timer); | ||
33 | break; | ||
34 | case OFFSET_TCNT: | ||
35 | s->tcnt = value; | ||
36 | + ptimer_transaction_begin(s->timer); | ||
37 | ptimer_set_count(s->timer, s->tcnt); | ||
38 | + ptimer_transaction_commit(s->timer); | ||
39 | break; | ||
40 | case OFFSET_TCR: | ||
41 | + ptimer_transaction_begin(s->timer); | ||
42 | if (s->enabled) { | ||
43 | /* Pause the timer if it is running. This may cause some | ||
44 | inaccuracy dure to rounding, but avoids a whole lot of other | ||
45 | @@ -XXX,XX +XXX,XX @@ static void sh_timer_write(void *opaque, hwaddr offset, | ||
46 | /* Restart the timer if still enabled. */ | ||
47 | ptimer_run(s->timer, 0); | ||
48 | } | ||
49 | + ptimer_transaction_commit(s->timer); | ||
50 | break; | ||
51 | case OFFSET_TCPR: | ||
52 | if (s->feat & TIMER_FEAT_CAPT) { | ||
53 | @@ -XXX,XX +XXX,XX @@ static void sh_timer_start_stop(void *opaque, int enable) | ||
54 | printf("sh_timer_start_stop %d (%d)\n", enable, s->enabled); | ||
55 | #endif | ||
56 | |||
57 | + ptimer_transaction_begin(s->timer); | ||
58 | if (s->enabled && !enable) { | ||
59 | ptimer_stop(s->timer); | ||
60 | } | ||
61 | if (!s->enabled && enable) { | ||
62 | ptimer_run(s->timer, 0); | ||
63 | } | ||
64 | + ptimer_transaction_commit(s->timer); | ||
65 | s->enabled = !!enable; | ||
66 | |||
67 | #ifdef DEBUG_TIMER | ||
68 | @@ -XXX,XX +XXX,XX @@ static void sh_timer_tick(void *opaque) | ||
69 | static void *sh_timer_init(uint32_t freq, int feat, qemu_irq irq) | ||
70 | { | ||
71 | sh_timer_state *s; | ||
72 | - QEMUBH *bh; | ||
73 | |||
74 | s = (sh_timer_state *)g_malloc0(sizeof(sh_timer_state)); | ||
75 | s->freq = freq; | ||
76 | @@ -XXX,XX +XXX,XX @@ static void *sh_timer_init(uint32_t freq, int feat, qemu_irq irq) | ||
77 | s->enabled = 0; | ||
78 | s->irq = irq; | ||
79 | |||
80 | - bh = qemu_bh_new(sh_timer_tick, s); | ||
81 | - s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT); | ||
82 | + s->timer = ptimer_init(sh_timer_tick, s, PTIMER_POLICY_DEFAULT); | ||
83 | |||
84 | sh_timer_write(s, OFFSET_TCOR >> 2, s->tcor); | ||
85 | sh_timer_write(s, OFFSET_TCNT >> 2, s->tcnt); | ||
86 | -- | ||
87 | 2.20.1 | ||
88 | |||
89 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Switch the lm32_timer code away from bottom-half based ptimers to the | ||
2 | new transaction-based ptimer API. This just requires adding | ||
3 | begin/commit calls around the various places that modify the ptimer | ||
4 | state, and using the new ptimer_init() function to create the ytimer. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20191017132905.5604-4-peter.maydell@linaro.org | ||
10 | --- | ||
11 | hw/timer/lm32_timer.c | 13 +++++++++---- | ||
12 | 1 file changed, 9 insertions(+), 4 deletions(-) | ||
13 | |||
14 | diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/timer/lm32_timer.c | ||
17 | +++ b/hw/timer/lm32_timer.c | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | #include "hw/ptimer.h" | ||
20 | #include "hw/qdev-properties.h" | ||
21 | #include "qemu/error-report.h" | ||
22 | -#include "qemu/main-loop.h" | ||
23 | #include "qemu/module.h" | ||
24 | |||
25 | #define DEFAULT_FREQUENCY (50*1000000) | ||
26 | @@ -XXX,XX +XXX,XX @@ struct LM32TimerState { | ||
27 | |||
28 | MemoryRegion iomem; | ||
29 | |||
30 | - QEMUBH *bh; | ||
31 | ptimer_state *ptimer; | ||
32 | |||
33 | qemu_irq irq; | ||
34 | @@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr, | ||
35 | s->regs[R_SR] &= ~SR_TO; | ||
36 | break; | ||
37 | case R_CR: | ||
38 | + ptimer_transaction_begin(s->ptimer); | ||
39 | s->regs[R_CR] = value; | ||
40 | if (s->regs[R_CR] & CR_START) { | ||
41 | ptimer_run(s->ptimer, 1); | ||
42 | @@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr, | ||
43 | if (s->regs[R_CR] & CR_STOP) { | ||
44 | ptimer_stop(s->ptimer); | ||
45 | } | ||
46 | + ptimer_transaction_commit(s->ptimer); | ||
47 | break; | ||
48 | case R_PERIOD: | ||
49 | s->regs[R_PERIOD] = value; | ||
50 | + ptimer_transaction_begin(s->ptimer); | ||
51 | ptimer_set_count(s->ptimer, value); | ||
52 | + ptimer_transaction_commit(s->ptimer); | ||
53 | break; | ||
54 | case R_SNAPSHOT: | ||
55 | error_report("lm32_timer: write access to read only register 0x" | ||
56 | @@ -XXX,XX +XXX,XX @@ static void timer_reset(DeviceState *d) | ||
57 | for (i = 0; i < R_MAX; i++) { | ||
58 | s->regs[i] = 0; | ||
59 | } | ||
60 | + ptimer_transaction_begin(s->ptimer); | ||
61 | ptimer_stop(s->ptimer); | ||
62 | + ptimer_transaction_commit(s->ptimer); | ||
63 | } | ||
64 | |||
65 | static void lm32_timer_init(Object *obj) | ||
66 | @@ -XXX,XX +XXX,XX @@ static void lm32_timer_realize(DeviceState *dev, Error **errp) | ||
67 | { | ||
68 | LM32TimerState *s = LM32_TIMER(dev); | ||
69 | |||
70 | - s->bh = qemu_bh_new(timer_hit, s); | ||
71 | - s->ptimer = ptimer_init_with_bh(s->bh, PTIMER_POLICY_DEFAULT); | ||
72 | + s->ptimer = ptimer_init(timer_hit, s, PTIMER_POLICY_DEFAULT); | ||
73 | |||
74 | + ptimer_transaction_begin(s->ptimer); | ||
75 | ptimer_set_freq(s->ptimer, s->freq_hz); | ||
76 | + ptimer_transaction_commit(s->ptimer); | ||
77 | } | ||
78 | |||
79 | static const VMStateDescription vmstate_lm32_timer = { | ||
80 | -- | ||
81 | 2.20.1 | ||
82 | |||
83 | diff view generated by jsdifflib |
1 | Switch the etraxfs_timer code away from bottom-half based ptimers to | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | the new transaction-based ptimer API. This just requires adding | 2 | other header files, only from .c files (as documented in a comment at |
3 | begin/commit calls around the various places that modify the ptimer | 3 | the start of it). |
4 | state, and using the new ptimer_init() function to create the timer. | 4 | |
5 | include/hw/i386/x86.h and include/hw/i386/microvm.h break this rule. | ||
6 | In fact, the include is not required at all, so we can just drop it | ||
7 | from both files. | ||
5 | 8 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Message-id: 20191017132905.5604-7-peter.maydell@linaro.org | 12 | Message-id: 20211129200510.1233037-2-peter.maydell@linaro.org |
10 | --- | 13 | --- |
11 | hw/timer/etraxfs_timer.c | 23 +++++++++++++---------- | 14 | include/hw/i386/microvm.h | 1 - |
12 | 1 file changed, 13 insertions(+), 10 deletions(-) | 15 | include/hw/i386/x86.h | 1 - |
16 | 2 files changed, 2 deletions(-) | ||
13 | 17 | ||
14 | diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c | 18 | diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/timer/etraxfs_timer.c | 20 | --- a/include/hw/i386/microvm.h |
17 | +++ b/hw/timer/etraxfs_timer.c | 21 | +++ b/include/hw/i386/microvm.h |
18 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ |
19 | #include "hw/sysbus.h" | 23 | #ifndef HW_I386_MICROVM_H |
20 | #include "sysemu/reset.h" | 24 | #define HW_I386_MICROVM_H |
21 | #include "sysemu/runstate.h" | 25 | |
22 | -#include "qemu/main-loop.h" | 26 | -#include "qemu-common.h" |
23 | #include "qemu/module.h" | 27 | #include "exec/hwaddr.h" |
24 | #include "qemu/timer.h" | 28 | #include "qemu/notify.h" |
25 | #include "hw/irq.h" | 29 | |
26 | @@ -XXX,XX +XXX,XX @@ typedef struct ETRAXTimerState { | 30 | diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h |
27 | qemu_irq irq; | 31 | index XXXXXXX..XXXXXXX 100644 |
28 | qemu_irq nmi; | 32 | --- a/include/hw/i386/x86.h |
29 | 33 | +++ b/include/hw/i386/x86.h | |
30 | - QEMUBH *bh_t0; | 34 | @@ -XXX,XX +XXX,XX @@ |
31 | - QEMUBH *bh_t1; | 35 | #ifndef HW_I386_X86_H |
32 | - QEMUBH *bh_wd; | 36 | #define HW_I386_X86_H |
33 | ptimer_state *ptimer_t0; | 37 | |
34 | ptimer_state *ptimer_t1; | 38 | -#include "qemu-common.h" |
35 | ptimer_state *ptimer_wd; | 39 | #include "exec/hwaddr.h" |
36 | @@ -XXX,XX +XXX,XX @@ static void update_ctrl(ETRAXTimerState *t, int tnum) | 40 | #include "qemu/notify.h" |
37 | } | 41 | |
38 | |||
39 | D(printf ("freq_hz=%d div=%d\n", freq_hz, div)); | ||
40 | + ptimer_transaction_begin(timer); | ||
41 | ptimer_set_freq(timer, freq_hz); | ||
42 | ptimer_set_limit(timer, div, 0); | ||
43 | |||
44 | @@ -XXX,XX +XXX,XX @@ static void update_ctrl(ETRAXTimerState *t, int tnum) | ||
45 | abort(); | ||
46 | break; | ||
47 | } | ||
48 | + ptimer_transaction_commit(timer); | ||
49 | } | ||
50 | |||
51 | static void timer_update_irq(ETRAXTimerState *t) | ||
52 | @@ -XXX,XX +XXX,XX @@ static inline void timer_watchdog_update(ETRAXTimerState *t, uint32_t value) | ||
53 | |||
54 | t->wd_hits = 0; | ||
55 | |||
56 | + ptimer_transaction_begin(t->ptimer_wd); | ||
57 | ptimer_set_freq(t->ptimer_wd, 760); | ||
58 | if (wd_cnt == 0) | ||
59 | wd_cnt = 256; | ||
60 | @@ -XXX,XX +XXX,XX @@ static inline void timer_watchdog_update(ETRAXTimerState *t, uint32_t value) | ||
61 | ptimer_stop(t->ptimer_wd); | ||
62 | |||
63 | t->rw_wd_ctrl = value; | ||
64 | + ptimer_transaction_commit(t->ptimer_wd); | ||
65 | } | ||
66 | |||
67 | static void | ||
68 | @@ -XXX,XX +XXX,XX @@ static void etraxfs_timer_reset(void *opaque) | ||
69 | { | ||
70 | ETRAXTimerState *t = opaque; | ||
71 | |||
72 | + ptimer_transaction_begin(t->ptimer_t0); | ||
73 | ptimer_stop(t->ptimer_t0); | ||
74 | + ptimer_transaction_commit(t->ptimer_t0); | ||
75 | + ptimer_transaction_begin(t->ptimer_t1); | ||
76 | ptimer_stop(t->ptimer_t1); | ||
77 | + ptimer_transaction_commit(t->ptimer_t1); | ||
78 | + ptimer_transaction_begin(t->ptimer_wd); | ||
79 | ptimer_stop(t->ptimer_wd); | ||
80 | + ptimer_transaction_commit(t->ptimer_wd); | ||
81 | t->rw_wd_ctrl = 0; | ||
82 | t->r_intr = 0; | ||
83 | t->rw_intr_mask = 0; | ||
84 | @@ -XXX,XX +XXX,XX @@ static void etraxfs_timer_realize(DeviceState *dev, Error **errp) | ||
85 | ETRAXTimerState *t = ETRAX_TIMER(dev); | ||
86 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
87 | |||
88 | - t->bh_t0 = qemu_bh_new(timer0_hit, t); | ||
89 | - t->bh_t1 = qemu_bh_new(timer1_hit, t); | ||
90 | - t->bh_wd = qemu_bh_new(watchdog_hit, t); | ||
91 | - t->ptimer_t0 = ptimer_init_with_bh(t->bh_t0, PTIMER_POLICY_DEFAULT); | ||
92 | - t->ptimer_t1 = ptimer_init_with_bh(t->bh_t1, PTIMER_POLICY_DEFAULT); | ||
93 | - t->ptimer_wd = ptimer_init_with_bh(t->bh_wd, PTIMER_POLICY_DEFAULT); | ||
94 | + t->ptimer_t0 = ptimer_init(timer0_hit, t, PTIMER_POLICY_DEFAULT); | ||
95 | + t->ptimer_t1 = ptimer_init(timer1_hit, t, PTIMER_POLICY_DEFAULT); | ||
96 | + t->ptimer_wd = ptimer_init(watchdog_hit, t, PTIMER_POLICY_DEFAULT); | ||
97 | |||
98 | sysbus_init_irq(sbd, &t->irq); | ||
99 | sysbus_init_irq(sbd, &t->nmi); | ||
100 | -- | 42 | -- |
101 | 2.20.1 | 43 | 2.25.1 |
102 | 44 | ||
103 | 45 | diff view generated by jsdifflib |
1 | Switch the altera_timer code away from bottom-half based ptimers to | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | the new transaction-based ptimer API. This just requires adding | 2 | other header files, only from .c files (as documented in a comment at |
3 | begin/commit calls around the various places that modify the ptimer | 3 | the start of it). |
4 | state, and using the new ptimer_init() function to create the timer. | 4 | |
5 | Move the include to linux-user/hexagon/cpu_loop.c, which needs it for | ||
6 | the declaration of cpu_exec_step_atomic(). | ||
5 | 7 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Message-id: 20191017132905.5604-6-peter.maydell@linaro.org | 11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> |
12 | Message-id: 20211129200510.1233037-3-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | hw/timer/altera_timer.c | 13 +++++++++---- | 14 | target/hexagon/cpu.h | 1 - |
12 | 1 file changed, 9 insertions(+), 4 deletions(-) | 15 | linux-user/hexagon/cpu_loop.c | 1 + |
16 | 2 files changed, 1 insertion(+), 1 deletion(-) | ||
13 | 17 | ||
14 | diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c | 18 | diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/timer/altera_timer.c | 20 | --- a/target/hexagon/cpu.h |
17 | +++ b/hw/timer/altera_timer.c | 21 | +++ b/target/hexagon/cpu.h |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUHexagonState CPUHexagonState; | ||
23 | |||
24 | #include "fpu/softfloat-types.h" | ||
25 | |||
26 | -#include "qemu-common.h" | ||
27 | #include "exec/cpu-defs.h" | ||
28 | #include "hex_regs.h" | ||
29 | #include "mmvec/mmvec.h" | ||
30 | diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/linux-user/hexagon/cpu_loop.c | ||
33 | +++ b/linux-user/hexagon/cpu_loop.c | ||
18 | @@ -XXX,XX +XXX,XX @@ | 34 | @@ -XXX,XX +XXX,XX @@ |
19 | */ | 35 | */ |
20 | 36 | ||
21 | #include "qemu/osdep.h" | 37 | #include "qemu/osdep.h" |
22 | -#include "qemu/main-loop.h" | 38 | +#include "qemu-common.h" |
23 | #include "qemu/module.h" | 39 | #include "qemu.h" |
24 | #include "qapi/error.h" | 40 | #include "user-internals.h" |
25 | 41 | #include "cpu_loop-common.h" | |
26 | @@ -XXX,XX +XXX,XX @@ typedef struct AlteraTimer { | ||
27 | MemoryRegion mmio; | ||
28 | qemu_irq irq; | ||
29 | uint32_t freq_hz; | ||
30 | - QEMUBH *bh; | ||
31 | ptimer_state *ptimer; | ||
32 | uint32_t regs[R_MAX]; | ||
33 | } AlteraTimer; | ||
34 | @@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr, | ||
35 | break; | ||
36 | |||
37 | case R_CONTROL: | ||
38 | + ptimer_transaction_begin(t->ptimer); | ||
39 | t->regs[R_CONTROL] = value & (CONTROL_ITO | CONTROL_CONT); | ||
40 | if ((value & CONTROL_START) && | ||
41 | !(t->regs[R_STATUS] & STATUS_RUN)) { | ||
42 | @@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr, | ||
43 | ptimer_stop(t->ptimer); | ||
44 | t->regs[R_STATUS] &= ~STATUS_RUN; | ||
45 | } | ||
46 | + ptimer_transaction_commit(t->ptimer); | ||
47 | break; | ||
48 | |||
49 | case R_PERIODL: | ||
50 | case R_PERIODH: | ||
51 | + ptimer_transaction_begin(t->ptimer); | ||
52 | t->regs[addr] = value & 0xFFFF; | ||
53 | if (t->regs[R_STATUS] & STATUS_RUN) { | ||
54 | ptimer_stop(t->ptimer); | ||
55 | @@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr, | ||
56 | } | ||
57 | tvalue = (t->regs[R_PERIODH] << 16) | t->regs[R_PERIODL]; | ||
58 | ptimer_set_limit(t->ptimer, tvalue + 1, 1); | ||
59 | + ptimer_transaction_commit(t->ptimer); | ||
60 | break; | ||
61 | |||
62 | case R_SNAPL: | ||
63 | @@ -XXX,XX +XXX,XX @@ static void altera_timer_realize(DeviceState *dev, Error **errp) | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | - t->bh = qemu_bh_new(timer_hit, t); | ||
68 | - t->ptimer = ptimer_init_with_bh(t->bh, PTIMER_POLICY_DEFAULT); | ||
69 | + t->ptimer = ptimer_init(timer_hit, t, PTIMER_POLICY_DEFAULT); | ||
70 | + ptimer_transaction_begin(t->ptimer); | ||
71 | ptimer_set_freq(t->ptimer, t->freq_hz); | ||
72 | + ptimer_transaction_commit(t->ptimer); | ||
73 | |||
74 | memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, | ||
75 | TYPE_ALTERA_TIMER, R_MAX * sizeof(uint32_t)); | ||
76 | @@ -XXX,XX +XXX,XX @@ static void altera_timer_reset(DeviceState *dev) | ||
77 | { | ||
78 | AlteraTimer *t = ALTERA_TIMER(dev); | ||
79 | |||
80 | + ptimer_transaction_begin(t->ptimer); | ||
81 | ptimer_stop(t->ptimer); | ||
82 | ptimer_set_limit(t->ptimer, 0xffffffff, 1); | ||
83 | + ptimer_transaction_commit(t->ptimer); | ||
84 | memset(t->regs, 0, sizeof(t->regs)); | ||
85 | } | ||
86 | |||
87 | -- | 42 | -- |
88 | 2.20.1 | 43 | 2.25.1 |
89 | 44 | ||
90 | 45 | diff view generated by jsdifflib |
1 | Switch the mcf5208 code away from bottom-half based ptimers to | 1 | The qemu-common.h header is not supposed to be included from any |
---|---|---|---|
2 | the new transaction-based ptimer API. This just requires adding | 2 | other header files, only from .c files (as documented in a comment at |
3 | begin/commit calls around the various places that modify the ptimer | 3 | the start of it). |
4 | state, and using the new ptimer_init() function to create the timer. | 4 | |
5 | Nothing actually relies on target/rx/cpu.h including it, so we can | ||
6 | just drop the include. | ||
5 | 7 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Tested-by: Thomas Huth <huth@tuxfamily.org> | 11 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> |
10 | Message-id: 20191017132905.5604-9-peter.maydell@linaro.org | 12 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> |
13 | Message-id: 20211129200510.1233037-4-peter.maydell@linaro.org | ||
11 | --- | 14 | --- |
12 | hw/m68k/mcf5208.c | 9 +++++---- | 15 | target/rx/cpu.h | 1 - |
13 | 1 file changed, 5 insertions(+), 4 deletions(-) | 16 | 1 file changed, 1 deletion(-) |
14 | 17 | ||
15 | diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c | 18 | diff --git a/target/rx/cpu.h b/target/rx/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/m68k/mcf5208.c | 20 | --- a/target/rx/cpu.h |
18 | +++ b/hw/m68k/mcf5208.c | 21 | +++ b/target/rx/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ |
20 | #include "qemu/osdep.h" | 23 | #define RX_CPU_H |
21 | #include "qemu/units.h" | 24 | |
22 | #include "qemu/error-report.h" | 25 | #include "qemu/bitops.h" |
23 | -#include "qemu/main-loop.h" | 26 | -#include "qemu-common.h" |
24 | #include "qapi/error.h" | 27 | #include "hw/registerfields.h" |
25 | #include "qemu-common.h" | 28 | #include "cpu-qom.h" |
26 | #include "cpu.h" | 29 | |
27 | @@ -XXX,XX +XXX,XX @@ static void m5208_timer_write(void *opaque, hwaddr offset, | ||
28 | return; | ||
29 | } | ||
30 | |||
31 | + ptimer_transaction_begin(s->timer); | ||
32 | if (s->pcsr & PCSR_EN) | ||
33 | ptimer_stop(s->timer); | ||
34 | |||
35 | @@ -XXX,XX +XXX,XX @@ static void m5208_timer_write(void *opaque, hwaddr offset, | ||
36 | |||
37 | if (s->pcsr & PCSR_EN) | ||
38 | ptimer_run(s->timer, 0); | ||
39 | + ptimer_transaction_commit(s->timer); | ||
40 | break; | ||
41 | case 2: | ||
42 | + ptimer_transaction_begin(s->timer); | ||
43 | s->pmr = value; | ||
44 | s->pcsr &= ~PCSR_PIF; | ||
45 | if ((s->pcsr & PCSR_RLD) == 0) { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void m5208_timer_write(void *opaque, hwaddr offset, | ||
47 | } else { | ||
48 | ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW); | ||
49 | } | ||
50 | + ptimer_transaction_commit(s->timer); | ||
51 | break; | ||
52 | case 4: | ||
53 | break; | ||
54 | @@ -XXX,XX +XXX,XX @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic) | ||
55 | { | ||
56 | MemoryRegion *iomem = g_new(MemoryRegion, 1); | ||
57 | m5208_timer_state *s; | ||
58 | - QEMUBH *bh; | ||
59 | int i; | ||
60 | |||
61 | /* SDRAMC. */ | ||
62 | @@ -XXX,XX +XXX,XX @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic) | ||
63 | /* Timers. */ | ||
64 | for (i = 0; i < 2; i++) { | ||
65 | s = g_new0(m5208_timer_state, 1); | ||
66 | - bh = qemu_bh_new(m5208_timer_trigger, s); | ||
67 | - s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT); | ||
68 | + s->timer = ptimer_init(m5208_timer_trigger, s, PTIMER_POLICY_DEFAULT); | ||
69 | memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s, | ||
70 | "m5208-timer", 0x00004000); | ||
71 | memory_region_add_subregion(address_space, 0xfc080000 + 0x4000 * i, | ||
72 | -- | 30 | -- |
73 | 2.20.1 | 31 | 2.25.1 |
74 | 32 | ||
75 | 33 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Create a function to compute the values of the TBFLAG_ANY bits | ||
4 | that will be cached. For now, the env->hflags variable is not | ||
5 | used, and the results are fed back to cpu_get_tb_cpu_state. | ||
6 | |||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20191018174431.1784-2-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/cpu.h | 29 ++++++++++++++++++----------- | ||
13 | target/arm/helper.c | 26 +++++++++++++++++++------- | ||
14 | 2 files changed, 37 insertions(+), 18 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 struct CPUARMState { | ||
21 | uint32_t pstate; | ||
22 | uint32_t aarch64; /* 1 if CPU is in aarch64 state; inverse of PSTATE.nRW */ | ||
23 | |||
24 | + /* Cached TBFLAGS state. See below for which bits are included. */ | ||
25 | + uint32_t hflags; | ||
26 | + | ||
27 | /* Frequently accessed CPSR bits are stored separately for efficiency. | ||
28 | This contains all the other bits. Use cpsr_{read,write} to access | ||
29 | the whole CPSR. */ | ||
30 | @@ -XXX,XX +XXX,XX @@ typedef ARMCPU ArchCPU; | ||
31 | |||
32 | #include "exec/cpu-all.h" | ||
33 | |||
34 | -/* Bit usage in the TB flags field: bit 31 indicates whether we are | ||
35 | +/* | ||
36 | + * Bit usage in the TB flags field: bit 31 indicates whether we are | ||
37 | * in 32 or 64 bit mode. The meaning of the other bits depends on that. | ||
38 | * We put flags which are shared between 32 and 64 bit mode at the top | ||
39 | * of the word, and flags which apply to only one mode at the bottom. | ||
40 | + * | ||
41 | + * Unless otherwise noted, these bits are cached in env->hflags. | ||
42 | */ | ||
43 | FIELD(TBFLAG_ANY, AARCH64_STATE, 31, 1) | ||
44 | FIELD(TBFLAG_ANY, MMUIDX, 28, 3) | ||
45 | FIELD(TBFLAG_ANY, SS_ACTIVE, 27, 1) | ||
46 | -FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1) | ||
47 | +FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1) /* Not cached. */ | ||
48 | /* Target EL if we take a floating-point-disabled exception */ | ||
49 | FIELD(TBFLAG_ANY, FPEXC_EL, 24, 2) | ||
50 | FIELD(TBFLAG_ANY, BE_DATA, 23, 1) | ||
51 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, BE_DATA, 23, 1) | ||
52 | FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 21, 2) | ||
53 | |||
54 | /* Bit usage when in AArch32 state: */ | ||
55 | -FIELD(TBFLAG_A32, THUMB, 0, 1) | ||
56 | -FIELD(TBFLAG_A32, VECLEN, 1, 3) | ||
57 | -FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) | ||
58 | +FIELD(TBFLAG_A32, THUMB, 0, 1) /* Not cached. */ | ||
59 | +FIELD(TBFLAG_A32, VECLEN, 1, 3) /* Not cached. */ | ||
60 | +FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) /* Not cached. */ | ||
61 | /* | ||
62 | * We store the bottom two bits of the CPAR as TB flags and handle | ||
63 | * checks on the other bits at runtime. This shares the same bits as | ||
64 | * VECSTRIDE, which is OK as no XScale CPU has VFP. | ||
65 | + * Not cached, because VECLEN+VECSTRIDE are not cached. | ||
66 | */ | ||
67 | FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) | ||
68 | /* | ||
69 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) | ||
70 | * the same thing as the current security state of the processor! | ||
71 | */ | ||
72 | FIELD(TBFLAG_A32, NS, 6, 1) | ||
73 | -FIELD(TBFLAG_A32, VFPEN, 7, 1) | ||
74 | -FIELD(TBFLAG_A32, CONDEXEC, 8, 8) | ||
75 | +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */ | ||
76 | +FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */ | ||
77 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | ||
78 | /* For M profile only, set if FPCCR.LSPACT is set */ | ||
79 | -FIELD(TBFLAG_A32, LSPACT, 18, 1) | ||
80 | +FIELD(TBFLAG_A32, LSPACT, 18, 1) /* Not cached. */ | ||
81 | /* For M profile only, set if we must create a new FP context */ | ||
82 | -FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) | ||
83 | +FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) /* Not cached. */ | ||
84 | /* For M profile only, set if FPCCR.S does not match current security state */ | ||
85 | -FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) | ||
86 | +FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) /* Not cached. */ | ||
87 | /* For M profile only, Handler (ie not Thread) mode */ | ||
88 | FIELD(TBFLAG_A32, HANDLER, 21, 1) | ||
89 | /* For M profile only, whether we should generate stack-limit checks */ | ||
90 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, SVEEXC_EL, 2, 2) | ||
91 | FIELD(TBFLAG_A64, ZCR_LEN, 4, 4) | ||
92 | FIELD(TBFLAG_A64, PAUTH_ACTIVE, 8, 1) | ||
93 | FIELD(TBFLAG_A64, BT, 9, 1) | ||
94 | -FIELD(TBFLAG_A64, BTYPE, 10, 2) | ||
95 | +FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */ | ||
96 | FIELD(TBFLAG_A64, TBID, 12, 2) | ||
97 | |||
98 | static inline bool bswap_code(bool sctlr_b) | ||
99 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/target/arm/helper.c | ||
102 | +++ b/target/arm/helper.c | ||
103 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) | ||
104 | } | ||
105 | #endif | ||
106 | |||
107 | +static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | ||
108 | + ARMMMUIdx mmu_idx, uint32_t flags) | ||
109 | +{ | ||
110 | + flags = FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el); | ||
111 | + flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, | ||
112 | + arm_to_core_mmu_idx(mmu_idx)); | ||
113 | + | ||
114 | + if (arm_cpu_data_is_big_endian(env)) { | ||
115 | + flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
116 | + } | ||
117 | + if (arm_singlestep_active(env)) { | ||
118 | + flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); | ||
119 | + } | ||
120 | + return flags; | ||
121 | +} | ||
122 | + | ||
123 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
124 | target_ulong *cs_base, uint32_t *pflags) | ||
125 | { | ||
126 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
127 | } | ||
128 | } | ||
129 | |||
130 | - flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, arm_to_core_mmu_idx(mmu_idx)); | ||
131 | + flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
132 | |||
133 | /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine | ||
134 | * states defined in the ARM ARM for software singlestep: | ||
135 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
136 | * 0 x Inactive (the TB flag for SS is always 0) | ||
137 | * 1 0 Active-pending | ||
138 | * 1 1 Active-not-pending | ||
139 | + * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. | ||
140 | */ | ||
141 | - if (arm_singlestep_active(env)) { | ||
142 | - flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1); | ||
143 | + if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE)) { | ||
144 | if (is_a64(env)) { | ||
145 | if (env->pstate & PSTATE_SS) { | ||
146 | flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); | ||
147 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | - if (arm_cpu_data_is_big_endian(env)) { | ||
152 | - flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1); | ||
153 | - } | ||
154 | - flags = FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el); | ||
155 | |||
156 | if (arm_v7m_is_handler_mode(env)) { | ||
157 | flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); | ||
158 | -- | ||
159 | 2.20.1 | ||
160 | |||
161 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@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 | IEC binary prefixes ease code review: the unit is explicit. | 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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> |
8 | Message-id: 20191021190653.9511-3-philmd@redhat.com | 11 | Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Message-id: 20211129200510.1233037-5-peter.maydell@linaro.org |
10 | --- | 13 | --- |
11 | hw/arm/mps2-tz.c | 3 ++- | 14 | hw/arm/boot.c | 1 - |
12 | hw/arm/mps2.c | 3 ++- | 15 | hw/arm/digic_boards.c | 1 - |
13 | 2 files changed, 4 insertions(+), 2 deletions(-) | 16 | hw/arm/highbank.c | 1 - |
17 | hw/arm/npcm7xx_boards.c | 1 - | ||
18 | hw/arm/sbsa-ref.c | 1 - | ||
19 | hw/arm/stm32f405_soc.c | 1 - | ||
20 | hw/arm/vexpress.c | 1 - | ||
21 | hw/arm/virt.c | 1 - | ||
22 | 8 files changed, 8 deletions(-) | ||
14 | 23 | ||
15 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | 24 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c |
16 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/mps2-tz.c | 26 | --- a/hw/arm/boot.c |
18 | +++ b/hw/arm/mps2-tz.c | 27 | +++ b/hw/arm/boot.c |
19 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ |
20 | */ | 29 | */ |
21 | 30 | ||
22 | #include "qemu/osdep.h" | 31 | #include "qemu/osdep.h" |
23 | +#include "qemu/units.h" | 32 | -#include "qemu-common.h" |
33 | #include "qemu/datadir.h" | ||
34 | #include "qemu/error-report.h" | ||
35 | #include "qapi/error.h" | ||
36 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/digic_boards.c | ||
39 | +++ b/hw/arm/digic_boards.c | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | |||
42 | #include "qemu/osdep.h" | ||
43 | #include "qapi/error.h" | ||
44 | -#include "qemu-common.h" | ||
45 | #include "qemu/datadir.h" | ||
46 | #include "hw/boards.h" | ||
47 | #include "qemu/error-report.h" | ||
48 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/highbank.c | ||
51 | +++ b/hw/arm/highbank.c | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | */ | ||
54 | |||
55 | #include "qemu/osdep.h" | ||
56 | -#include "qemu-common.h" | ||
57 | #include "qemu/datadir.h" | ||
58 | #include "qapi/error.h" | ||
59 | #include "hw/sysbus.h" | ||
60 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/hw/arm/npcm7xx_boards.c | ||
63 | +++ b/hw/arm/npcm7xx_boards.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | #include "hw/qdev-core.h" | ||
66 | #include "hw/qdev-properties.h" | ||
67 | #include "qapi/error.h" | ||
68 | -#include "qemu-common.h" | ||
69 | #include "qemu/datadir.h" | ||
70 | #include "qemu/units.h" | ||
71 | #include "sysemu/blockdev.h" | ||
72 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/sbsa-ref.c | ||
75 | +++ b/hw/arm/sbsa-ref.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | */ | ||
78 | |||
79 | #include "qemu/osdep.h" | ||
80 | -#include "qemu-common.h" | ||
81 | #include "qemu/datadir.h" | ||
24 | #include "qapi/error.h" | 82 | #include "qapi/error.h" |
25 | #include "qemu/error-report.h" | 83 | #include "qemu/error-report.h" |
26 | #include "hw/arm/boot.h" | 84 | diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c |
27 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
28 | * call the 16MB our "system memory", as it's the largest lump. | ||
29 | */ | ||
30 | memory_region_allocate_system_memory(&mms->psram, | ||
31 | - NULL, "mps.ram", 0x01000000); | ||
32 | + NULL, "mps.ram", 16 * MiB); | ||
33 | memory_region_add_subregion(system_memory, 0x80000000, &mms->psram); | ||
34 | |||
35 | /* The overflow IRQs for all UARTs are ORed together. | ||
36 | diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | 85 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/hw/arm/mps2.c | 86 | --- a/hw/arm/stm32f405_soc.c |
39 | +++ b/hw/arm/mps2.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" | ||
108 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
109 | index XXXXXXX..XXXXXXX 100644 | ||
110 | --- a/hw/arm/virt.c | ||
111 | +++ b/hw/arm/virt.c | ||
40 | @@ -XXX,XX +XXX,XX @@ | 112 | @@ -XXX,XX +XXX,XX @@ |
41 | */ | 113 | */ |
42 | 114 | ||
43 | #include "qemu/osdep.h" | 115 | #include "qemu/osdep.h" |
44 | +#include "qemu/units.h" | 116 | -#include "qemu-common.h" |
45 | #include "qapi/error.h" | 117 | #include "qemu/datadir.h" |
46 | #include "qemu/error-report.h" | 118 | #include "qemu/units.h" |
47 | #include "hw/arm/boot.h" | 119 | #include "qemu/option.h" |
48 | @@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine) | ||
49 | * zbt_boot_ctrl is always zero). | ||
50 | */ | ||
51 | memory_region_allocate_system_memory(&mms->psram, | ||
52 | - NULL, "mps.ram", 0x1000000); | ||
53 | + NULL, "mps.ram", 16 * MiB); | ||
54 | memory_region_add_subregion(system_memory, 0x21000000, &mms->psram); | ||
55 | |||
56 | switch (mmc->fpga_type) { | ||
57 | -- | 120 | -- |
58 | 2.20.1 | 121 | 2.25.1 |
59 | 122 | ||
60 | 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 | Hoist the variable load for PSTATE into the existing test vs is_a64. | 12 | Thanks to the bug report submitter Cha HyunSoo for identifying |
13 | both these errors. | ||
4 | 14 | ||
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> | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 19 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 20 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Message-id: 20191018174431.1784-11-richard.henderson@linaro.org | 21 | Message-id: 20211130173257.1274194-1-peter.maydell@linaro.org |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | 22 | --- |
10 | target/arm/helper.c | 20 ++++++++------------ | 23 | target/arm/helper.c | 6 +++--- |
11 | 1 file changed, 8 insertions(+), 12 deletions(-) | 24 | 1 file changed, 3 insertions(+), 3 deletions(-) |
12 | 25 | ||
13 | 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 |
14 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/helper.c | 28 | --- a/target/arm/helper.c |
16 | +++ b/target/arm/helper.c | 29 | +++ b/target/arm/helper.c |
17 | @@ -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, |
18 | ARMMMUIdx mmu_idx = arm_mmu_idx(env); | 31 | uint64_t exponent; |
19 | int current_el = arm_current_el(env); | 32 | uint64_t length; |
20 | int fp_el = fp_exception_el(env, current_el); | 33 | |
21 | - uint32_t flags; | 34 | - num = extract64(value, 39, 4); |
22 | + uint32_t flags, pstate_for_ss; | 35 | + num = extract64(value, 39, 5); |
23 | 36 | scale = extract64(value, 44, 2); | |
24 | if (is_a64(env)) { | 37 | page_size_granule = extract64(value, 46, 2); |
25 | *pc = env->pc; | 38 | |
26 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 39 | - page_shift = page_size_granule * 2 + 12; |
27 | if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | 40 | - |
28 | flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); | 41 | if (page_size_granule == 0) { |
29 | } | 42 | qemu_log_mask(LOG_GUEST_ERROR, "Invalid page size granule %d\n", |
30 | + pstate_for_ss = env->pstate; | 43 | page_size_granule); |
31 | } else { | 44 | return 0; |
32 | *pc = env->regs[15]; | ||
33 | |||
34 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
35 | || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { | ||
36 | flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
37 | } | ||
38 | + pstate_for_ss = env->uncached_cpsr; | ||
39 | } | 45 | } |
40 | 46 | ||
41 | - /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine | 47 | + page_shift = (page_size_granule - 1) * 2 + 12; |
42 | + /* | 48 | + |
43 | + * The SS_ACTIVE and PSTATE_SS bits correspond to the state machine | 49 | exponent = (5 * scale) + 1; |
44 | * states defined in the ARM ARM for software singlestep: | 50 | length = (num + 1) << (exponent + page_shift); |
45 | * SS_ACTIVE PSTATE.SS State | 51 | |
46 | * 0 x Inactive (the TB flag for SS is always 0) | ||
47 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
48 | * 1 1 Active-not-pending | ||
49 | * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB. | ||
50 | */ | ||
51 | - if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE)) { | ||
52 | - if (is_a64(env)) { | ||
53 | - if (env->pstate & PSTATE_SS) { | ||
54 | - flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); | ||
55 | - } | ||
56 | - } else { | ||
57 | - if (env->uncached_cpsr & PSTATE_SS) { | ||
58 | - flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); | ||
59 | - } | ||
60 | - } | ||
61 | + if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE) && | ||
62 | + (pstate_for_ss & PSTATE_SS)) { | ||
63 | + flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1); | ||
64 | } | ||
65 | |||
66 | *pflags = flags; | ||
67 | -- | 52 | -- |
68 | 2.20.1 | 53 | 2.25.1 |
69 | 54 | ||
70 | 55 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | This function assumes nothing about the current state of the cpu, | 3 | The rx_active boolean change to true should always trigger a try_read |
4 | and writes the computed value to env->hflags. | 4 | call that flushes the queue. |
5 | 5 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20191018174431.1784-13-richard.henderson@linaro.org | 8 | Message-id: 20211203221002.1719306-1-venture@google.com |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | target/arm/cpu.h | 6 ++++++ | 11 | hw/net/npcm7xx_emc.c | 18 ++++++++---------- |
12 | target/arm/helper.c | 30 ++++++++++++++++++++++-------- | 12 | 1 file changed, 8 insertions(+), 10 deletions(-) |
13 | 2 files changed, 28 insertions(+), 8 deletions(-) | ||
14 | 13 | ||
15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/cpu.h | 16 | --- a/hw/net/npcm7xx_emc.c |
18 | +++ b/target/arm/cpu.h | 17 | +++ b/hw/net/npcm7xx_emc.c |
19 | @@ -XXX,XX +XXX,XX @@ void arm_register_pre_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, | 18 | @@ -XXX,XX +XXX,XX @@ static void emc_halt_rx(NPCM7xxEMCState *emc, uint32_t mista_flag) |
20 | void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, void | 19 | emc_set_mista(emc, mista_flag); |
21 | *opaque); | ||
22 | |||
23 | +/** | ||
24 | + * arm_rebuild_hflags: | ||
25 | + * Rebuild the cached TBFLAGS for arbitrary changed processor state. | ||
26 | + */ | ||
27 | +void arm_rebuild_hflags(CPUARMState *env); | ||
28 | + | ||
29 | /** | ||
30 | * aa32_vfp_dreg: | ||
31 | * Return a pointer to the Dn register within env in 32-bit mode. | ||
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_a64(CPUARMState *env, int el, int fp_el, | ||
37 | return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
38 | } | 20 | } |
39 | 21 | ||
40 | +static uint32_t rebuild_hflags_internal(CPUARMState *env) | 22 | +static void emc_enable_rx_and_flush(NPCM7xxEMCState *emc) |
41 | +{ | 23 | +{ |
42 | + int el = arm_current_el(env); | 24 | + emc->rx_active = true; |
43 | + int fp_el = fp_exception_el(env, el); | 25 | + qemu_flush_queued_packets(qemu_get_queue(emc->nic)); |
44 | + ARMMMUIdx mmu_idx = arm_mmu_idx(env); | ||
45 | + | ||
46 | + if (is_a64(env)) { | ||
47 | + return rebuild_hflags_a64(env, el, fp_el, mmu_idx); | ||
48 | + } else if (arm_feature(env, ARM_FEATURE_M)) { | ||
49 | + return rebuild_hflags_m32(env, fp_el, mmu_idx); | ||
50 | + } else { | ||
51 | + return rebuild_hflags_a32(env, fp_el, mmu_idx); | ||
52 | + } | ||
53 | +} | 26 | +} |
54 | + | 27 | + |
55 | +void arm_rebuild_hflags(CPUARMState *env) | 28 | static void emc_set_next_tx_descriptor(NPCM7xxEMCState *emc, |
56 | +{ | 29 | const NPCM7xxEMCTxDesc *tx_desc, |
57 | + env->hflags = rebuild_hflags_internal(env); | 30 | uint32_t desc_addr) |
58 | +} | 31 | @@ -XXX,XX +XXX,XX @@ static ssize_t emc_receive(NetClientState *nc, const uint8_t *buf, size_t len1) |
59 | + | 32 | return len; |
60 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 33 | } |
61 | target_ulong *cs_base, uint32_t *pflags) | 34 | |
35 | -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc) | ||
36 | -{ | ||
37 | - if (emc_can_receive(qemu_get_queue(emc->nic))) { | ||
38 | - qemu_flush_queued_packets(qemu_get_queue(emc->nic)); | ||
39 | - } | ||
40 | -} | ||
41 | - | ||
42 | static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size) | ||
62 | { | 43 | { |
63 | - ARMMMUIdx mmu_idx = arm_mmu_idx(env); | 44 | NPCM7xxEMCState *emc = opaque; |
64 | - int current_el = arm_current_el(env); | 45 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
65 | - int fp_el = fp_exception_el(env, current_el); | 46 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; |
66 | uint32_t flags, pstate_for_ss; | ||
67 | |||
68 | + flags = rebuild_hflags_internal(env); | ||
69 | + | ||
70 | if (is_a64(env)) { | ||
71 | *pc = env->pc; | ||
72 | - flags = rebuild_hflags_a64(env, current_el, fp_el, mmu_idx); | ||
73 | if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | ||
74 | flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); | ||
75 | } | 47 | } |
76 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 48 | if (value & REG_MCMDR_RXON) { |
77 | *pc = env->regs[15]; | 49 | - emc->rx_active = true; |
78 | 50 | + emc_enable_rx_and_flush(emc); | |
79 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
80 | - flags = rebuild_hflags_m32(env, fp_el, mmu_idx); | ||
81 | - | ||
82 | if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | ||
83 | FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) | ||
84 | != env->v7m.secure) { | ||
85 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
86 | flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); | ||
87 | } | ||
88 | } else { | 51 | } else { |
89 | - flags = rebuild_hflags_a32(env, fp_el, mmu_idx); | 52 | emc_halt_rx(emc, 0); |
90 | - | 53 | } |
91 | /* | 54 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
92 | * Note that XSCALE_CPAR shares bits with VECSTRIDE. | 55 | break; |
93 | * Note that VECLEN+VECSTRIDE are RES0 for M-profile. | 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: | ||
94 | -- | 64 | -- |
95 | 2.20.1 | 65 | 2.25.1 |
96 | 66 | ||
97 | 67 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The Linux kernel access few S3C-specific registers [1] to set some | 3 | When a virtio-iommu is instantiated, describe it using the ACPI VIOT |
4 | clock. We don't care about this part for device emulation [2]. Add | 4 | table. |
5 | a dummy device to properly ignore these accesses, so we can focus | ||
6 | on the important registers missing. | ||
7 | 5 | ||
8 | [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/sdhci-s3c-regs.h?h=cc014f3 | 6 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
9 | [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/sdhci-s3c.c?h=v5.3#n263 | 7 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
10 | 8 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | |
11 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 9 | Message-id: 20211210170415.583179-2-jean-philippe@linaro.org |
12 | Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> | ||
13 | Message-id: 20191005154748.21718-4-f4bug@amsat.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 11 | --- |
16 | include/hw/sd/sdhci.h | 2 ++ | 12 | hw/arm/virt-acpi-build.c | 7 +++++++ |
17 | hw/sd/sdhci.c | 65 +++++++++++++++++++++++++++++++++++++++++++ | 13 | hw/arm/Kconfig | 1 + |
18 | 2 files changed, 67 insertions(+) | 14 | 2 files changed, 8 insertions(+) |
19 | 15 | ||
20 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | 16 | diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c |
21 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/hw/sd/sdhci.h | 18 | --- a/hw/arm/virt-acpi-build.c |
23 | +++ b/include/hw/sd/sdhci.h | 19 | +++ b/hw/arm/virt-acpi-build.c |
24 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | 20 | @@ -XXX,XX +XXX,XX @@ |
25 | 21 | #include "kvm_arm.h" | |
26 | #define TYPE_IMX_USDHC "imx-usdhc" | 22 | #include "migration/vmstate.h" |
27 | 23 | #include "hw/acpi/ghes.h" | |
28 | +#define TYPE_S3C_SDHCI "s3c-sdhci" | 24 | +#include "hw/acpi/viot.h" |
29 | + | 25 | |
30 | #endif /* SDHCI_H */ | 26 | #define ARM_SPI_BASE 32 |
31 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | 27 | |
32 | index XXXXXXX..XXXXXXX 100644 | 28 | @@ -XXX,XX +XXX,XX @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) |
33 | --- a/hw/sd/sdhci.c | 29 | } |
34 | +++ b/hw/sd/sdhci.c | 30 | #endif |
35 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo imx_usdhc_info = { | 31 | |
36 | .instance_init = imx_usdhc_init, | 32 | + if (vms->iommu == VIRT_IOMMU_VIRTIO) { |
37 | }; | 33 | + acpi_add_table(table_offsets, tables_blob); |
38 | 34 | + build_viot(ms, tables_blob, tables->linker, vms->virtio_iommu_bdf, | |
39 | +/* --- qdev Samsung s3c --- */ | 35 | + vms->oem_id, vms->oem_table_id); |
40 | + | ||
41 | +#define S3C_SDHCI_CONTROL2 0x80 | ||
42 | +#define S3C_SDHCI_CONTROL3 0x84 | ||
43 | +#define S3C_SDHCI_CONTROL4 0x8c | ||
44 | + | ||
45 | +static uint64_t sdhci_s3c_read(void *opaque, hwaddr offset, unsigned size) | ||
46 | +{ | ||
47 | + uint64_t ret; | ||
48 | + | ||
49 | + switch (offset) { | ||
50 | + case S3C_SDHCI_CONTROL2: | ||
51 | + case S3C_SDHCI_CONTROL3: | ||
52 | + case S3C_SDHCI_CONTROL4: | ||
53 | + /* ignore */ | ||
54 | + ret = 0; | ||
55 | + break; | ||
56 | + default: | ||
57 | + ret = sdhci_read(opaque, offset, size); | ||
58 | + break; | ||
59 | + } | 36 | + } |
60 | + | 37 | + |
61 | + return ret; | 38 | /* XSDT is pointed to by RSDP */ |
62 | +} | 39 | xsdt = tables_blob->len; |
63 | + | 40 | build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id, |
64 | +static void sdhci_s3c_write(void *opaque, hwaddr offset, uint64_t val, | 41 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
65 | + unsigned size) | 42 | index XXXXXXX..XXXXXXX 100644 |
66 | +{ | 43 | --- a/hw/arm/Kconfig |
67 | + switch (offset) { | 44 | +++ b/hw/arm/Kconfig |
68 | + case S3C_SDHCI_CONTROL2: | 45 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
69 | + case S3C_SDHCI_CONTROL3: | 46 | select DIMM |
70 | + case S3C_SDHCI_CONTROL4: | 47 | select ACPI_HW_REDUCED |
71 | + /* ignore */ | 48 | select ACPI_APEI |
72 | + break; | 49 | + select ACPI_VIOT |
73 | + default: | 50 | |
74 | + sdhci_write(opaque, offset, val, size); | 51 | config CHEETAH |
75 | + break; | 52 | bool |
76 | + } | ||
77 | +} | ||
78 | + | ||
79 | +static const MemoryRegionOps sdhci_s3c_mmio_ops = { | ||
80 | + .read = sdhci_s3c_read, | ||
81 | + .write = sdhci_s3c_write, | ||
82 | + .valid = { | ||
83 | + .min_access_size = 1, | ||
84 | + .max_access_size = 4, | ||
85 | + .unaligned = false | ||
86 | + }, | ||
87 | + .endianness = DEVICE_LITTLE_ENDIAN, | ||
88 | +}; | ||
89 | + | ||
90 | +static void sdhci_s3c_init(Object *obj) | ||
91 | +{ | ||
92 | + SDHCIState *s = SYSBUS_SDHCI(obj); | ||
93 | + | ||
94 | + s->io_ops = &sdhci_s3c_mmio_ops; | ||
95 | +} | ||
96 | + | ||
97 | +static const TypeInfo sdhci_s3c_info = { | ||
98 | + .name = TYPE_S3C_SDHCI , | ||
99 | + .parent = TYPE_SYSBUS_SDHCI, | ||
100 | + .instance_init = sdhci_s3c_init, | ||
101 | +}; | ||
102 | + | ||
103 | static void sdhci_register_types(void) | ||
104 | { | ||
105 | type_register_static(&sdhci_sysbus_info); | ||
106 | type_register_static(&sdhci_bus_info); | ||
107 | type_register_static(&imx_usdhc_info); | ||
108 | + type_register_static(&sdhci_s3c_info); | ||
109 | } | ||
110 | |||
111 | type_init(sdhci_register_types) | ||
112 | -- | 53 | -- |
113 | 2.20.1 | 54 | 2.25.1 |
114 | 55 | ||
115 | 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 | Continue setting, but not relying upon, env->hflags. | 3 | virtio-iommu is now supported with ACPI VIOT as well as device tree. |
4 | Remove the restriction that prevents from instantiating a virtio-iommu | ||
5 | device under ACPI. | ||
4 | 6 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 7 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
7 | Message-id: 20191018174431.1784-19-richard.henderson@linaro.org | 9 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
10 | Message-id: 20211210170415.583179-3-jean-philippe@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 12 | --- |
10 | target/arm/op_helper.c | 3 +++ | 13 | hw/arm/virt.c | 10 ++-------- |
11 | 1 file changed, 3 insertions(+) | 14 | hw/virtio/virtio-iommu-pci.c | 12 ++---------- |
15 | 2 files changed, 4 insertions(+), 18 deletions(-) | ||
12 | 16 | ||
13 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/op_helper.c | 19 | --- a/hw/arm/virt.c |
16 | +++ b/target/arm/op_helper.c | 20 | +++ b/hw/arm/virt.c |
17 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(usat16)(CPUARMState *env, uint32_t x, uint32_t shift) | 21 | @@ -XXX,XX +XXX,XX @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine, |
18 | void HELPER(setend)(CPUARMState *env) | 22 | MachineClass *mc = MACHINE_GET_CLASS(machine); |
19 | { | 23 | |
20 | env->uncached_cpsr ^= CPSR_E; | 24 | if (device_is_dynamic_sysbus(mc, dev) || |
21 | + arm_rebuild_hflags(env); | 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; | ||
22 | } | 38 | } |
23 | 39 | ||
24 | /* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped. | 40 | diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c |
25 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(cpsr_read)(CPUARMState *env) | 41 | index XXXXXXX..XXXXXXX 100644 |
26 | void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask) | 42 | --- a/hw/virtio/virtio-iommu-pci.c |
27 | { | 43 | +++ b/hw/virtio/virtio-iommu-pci.c |
28 | cpsr_write(env, val, mask, CPSRWriteByInstr); | 44 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) |
29 | + /* TODO: Not all cpsr bits are relevant to hflags. */ | 45 | VirtIOIOMMU *s = VIRTIO_IOMMU(vdev); |
30 | + arm_rebuild_hflags(env); | 46 | |
31 | } | 47 | if (!qdev_get_machine_hotplug_handler(DEVICE(vpci_dev))) { |
32 | 48 | - MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); | |
33 | /* Write the CPSR for a 32-bit exception return */ | 49 | - |
50 | - error_setg(errp, | ||
51 | - "%s machine fails to create iommu-map device tree bindings", | ||
52 | - mc->name); | ||
53 | - error_append_hint(errp, | ||
54 | - "Check your machine implements a hotplug handler " | ||
55 | - "for the virtio-iommu-pci device\n"); | ||
56 | - error_append_hint(errp, "Check the guest is booted without FW or with " | ||
57 | - "-no-acpi\n"); | ||
58 | + error_setg(errp, "Check your machine implements a hotplug handler " | ||
59 | + "for the virtio-iommu-pci device"); | ||
60 | return; | ||
61 | } | ||
62 | for (int i = 0; i < s->nb_reserved_regions; i++) { | ||
34 | -- | 63 | -- |
35 | 2.20.1 | 64 | 2.25.1 |
36 | 65 | ||
37 | 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 | This is the payoff. | 3 | We do not support instantiating multiple IOMMUs. Before adding a |
4 | virtio-iommu, check that no other IOMMU is present. This will detect | ||
5 | both "iommu=smmuv3" machine parameter and another virtio-iommu instance. | ||
4 | 6 | ||
5 | From perf record -g data of ubuntu 18 boot and shutdown: | 7 | Fixes: 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings") |
6 | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | |
7 | BEFORE: | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
8 | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | |
9 | - 23.02% 2.82% qemu-system-aar [.] helper_lookup_tb_ptr | 11 | Message-id: 20211210170415.583179-4-jean-philippe@linaro.org |
10 | - 20.22% helper_lookup_tb_ptr | ||
11 | + 10.05% tb_htable_lookup | ||
12 | - 9.13% cpu_get_tb_cpu_state | ||
13 | 3.20% aa64_va_parameters_both | ||
14 | 0.55% fp_exception_el | ||
15 | |||
16 | - 11.66% 4.74% qemu-system-aar [.] cpu_get_tb_cpu_state | ||
17 | - 6.96% cpu_get_tb_cpu_state | ||
18 | 3.63% aa64_va_parameters_both | ||
19 | 0.60% fp_exception_el | ||
20 | 0.53% sve_exception_el | ||
21 | |||
22 | AFTER: | ||
23 | |||
24 | - 16.40% 3.40% qemu-system-aar [.] helper_lookup_tb_ptr | ||
25 | - 13.03% helper_lookup_tb_ptr | ||
26 | + 11.19% tb_htable_lookup | ||
27 | 0.55% cpu_get_tb_cpu_state | ||
28 | |||
29 | 0.98% 0.71% qemu-system-aar [.] cpu_get_tb_cpu_state | ||
30 | |||
31 | 0.87% 0.24% qemu-system-aar [.] rebuild_hflags_a64 | ||
32 | |||
33 | Before, helper_lookup_tb_ptr is the second hottest function in the | ||
34 | application, consuming almost a quarter of the runtime. Within the | ||
35 | entire execution, cpu_get_tb_cpu_state consumes about 12%. | ||
36 | |||
37 | After, helper_lookup_tb_ptr has dropped to the fourth hottest function, | ||
38 | with consumption dropping to a sixth of the runtime. Within the | ||
39 | entire execution, cpu_get_tb_cpu_state has dropped below 1%, and the | ||
40 | supporting function to rebuild hflags also consumes about 1%. | ||
41 | |||
42 | Assertions are retained for --enable-debug-tcg. | ||
43 | |||
44 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
45 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
46 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
47 | Message-id: 20191018174431.1784-23-richard.henderson@linaro.org | ||
48 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
49 | --- | 13 | --- |
50 | target/arm/helper.c | 9 ++++++--- | 14 | hw/arm/virt.c | 5 +++++ |
51 | 1 file changed, 6 insertions(+), 3 deletions(-) | 15 | 1 file changed, 5 insertions(+) |
52 | 16 | ||
53 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
54 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/target/arm/helper.c | 19 | --- a/hw/arm/virt.c |
56 | +++ b/target/arm/helper.c | 20 | +++ b/hw/arm/virt.c |
57 | @@ -XXX,XX +XXX,XX @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el) | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
58 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 22 | hwaddr db_start = 0, db_end = 0; |
59 | target_ulong *cs_base, uint32_t *pflags) | 23 | char *resv_prop_str; |
60 | { | 24 | |
61 | - uint32_t flags, pstate_for_ss; | 25 | + if (vms->iommu != VIRT_IOMMU_NONE) { |
62 | + uint32_t flags = env->hflags; | 26 | + error_setg(errp, "virt machine does not support multiple IOMMUs"); |
63 | + uint32_t pstate_for_ss; | 27 | + return; |
64 | 28 | + } | |
65 | *cs_base = 0; | 29 | + |
66 | - flags = rebuild_hflags_internal(env); | 30 | switch (vms->msi_controller) { |
67 | +#ifdef CONFIG_DEBUG_TCG | 31 | case VIRT_MSI_CTRL_NONE: |
68 | + assert(flags == rebuild_hflags_internal(env)); | 32 | return; |
69 | +#endif | ||
70 | |||
71 | - if (is_a64(env)) { | ||
72 | + if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { | ||
73 | *pc = env->pc; | ||
74 | if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | ||
75 | flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); | ||
76 | -- | 33 | -- |
77 | 2.20.1 | 34 | 2.25.1 |
78 | 35 | ||
79 | 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 | Avoid calling arm_current_el() twice. | 3 | To propagate errors to the caller of the pre_plug callback, use the |
4 | object_poperty_set*() functions directly instead of the qdev_prop_set*() | ||
5 | helpers. | ||
4 | 6 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 7 | Suggested-by: Igor Mammedov <imammedo@redhat.com> |
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
8 | Message-id: 20191018174431.1784-14-richard.henderson@linaro.org | 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/internals.h | 9 +++++++++ | 14 | hw/arm/virt.c | 5 +++-- |
12 | target/arm/helper.c | 12 +++++++----- | 15 | 1 file changed, 3 insertions(+), 2 deletions(-) |
13 | 2 files changed, 16 insertions(+), 5 deletions(-) | ||
14 | 16 | ||
15 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 17 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
16 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/internals.h | 19 | --- a/hw/arm/virt.c |
18 | +++ b/target/arm/internals.h | 20 | +++ b/hw/arm/virt.c |
19 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_update_virq(ARMCPU *cpu); | 21 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
20 | */ | 22 | db_start, db_end, |
21 | void arm_cpu_update_vfiq(ARMCPU *cpu); | 23 | VIRTIO_IOMMU_RESV_MEM_T_MSI); |
22 | 24 | ||
23 | +/** | 25 | - qdev_prop_set_uint32(dev, "len-reserved-regions", 1); |
24 | + * arm_mmu_idx_el: | 26 | - qdev_prop_set_string(dev, "reserved-regions[0]", resv_prop_str); |
25 | + * @env: The cpu environment | 27 | + object_property_set_uint(OBJECT(dev), "len-reserved-regions", 1, errp); |
26 | + * @el: The EL to use. | 28 | + object_property_set_str(OBJECT(dev), "reserved-regions[0]", |
27 | + * | 29 | + resv_prop_str, errp); |
28 | + * Return the full ARMMMUIdx for the translation regime for EL. | 30 | g_free(resv_prop_str); |
29 | + */ | ||
30 | +ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el); | ||
31 | + | ||
32 | /** | ||
33 | * arm_mmu_idx: | ||
34 | * @env: The cpu environment | ||
35 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/arm/helper.c | ||
38 | +++ b/target/arm/helper.c | ||
39 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) | ||
40 | } | ||
41 | #endif | ||
42 | |||
43 | -ARMMMUIdx arm_mmu_idx(CPUARMState *env) | ||
44 | +ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) | ||
45 | { | ||
46 | - int el; | ||
47 | - | ||
48 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
49 | return arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure); | ||
50 | } | ||
51 | |||
52 | - el = arm_current_el(env); | ||
53 | if (el < 2 && arm_is_secure_below_el3(env)) { | ||
54 | return ARMMMUIdx_S1SE0 + el; | ||
55 | } else { | ||
56 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) | ||
57 | } | 31 | } |
58 | } | 32 | } |
59 | |||
60 | +ARMMMUIdx arm_mmu_idx(CPUARMState *env) | ||
61 | +{ | ||
62 | + return arm_mmu_idx_el(env, arm_current_el(env)); | ||
63 | +} | ||
64 | + | ||
65 | int cpu_mmu_index(CPUARMState *env, bool ifetch) | ||
66 | { | ||
67 | return arm_to_core_mmu_idx(arm_mmu_idx(env)); | ||
68 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_internal(CPUARMState *env) | ||
69 | { | ||
70 | int el = arm_current_el(env); | ||
71 | int fp_el = fp_exception_el(env, el); | ||
72 | - ARMMMUIdx mmu_idx = arm_mmu_idx(env); | ||
73 | + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el); | ||
74 | |||
75 | if (is_a64(env)) { | ||
76 | return rebuild_hflags_a64(env, el, fp_el, mmu_idx); | ||
77 | -- | 33 | -- |
78 | 2.20.1 | 34 | 2.25.1 |
79 | 35 | ||
80 | 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 | There are 3 conditions that each enable this flag. M-profile always | 3 | Create empty data files and allow updates for the upcoming VIOT tests. |
4 | enables; A-profile with EL1 as AA64 always enables. Both of these | ||
5 | conditions can easily be cached. The final condition relies on the | ||
6 | FPEXC register which we are not prepared to cache. | ||
7 | 4 | ||
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 5 | Acked-by: Igor Mammedov <imammedo@redhat.com> |
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
10 | Message-id: 20191018174431.1784-12-richard.henderson@linaro.org | 7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
8 | Message-id: 20211210170415.583179-6-jean-philippe@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | target/arm/cpu.h | 2 +- | 11 | tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ |
14 | target/arm/helper.c | 14 ++++++++++---- | 12 | tests/data/acpi/q35/DSDT.viot | 0 |
15 | 2 files changed, 11 insertions(+), 5 deletions(-) | 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 | ||
16 | 19 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 20 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
18 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 22 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
20 | +++ b/target/arm/cpu.h | 23 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
21 | @@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2) | 24 | @@ -1 +1,4 @@ |
22 | * the same thing as the current security state of the processor! | 25 | /* List of comma-separated changed AML files to ignore */ |
23 | */ | 26 | +"tests/data/acpi/virt/VIOT", |
24 | FIELD(TBFLAG_A32, NS, 6, 1) | 27 | +"tests/data/acpi/q35/DSDT.viot", |
25 | -FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */ | 28 | +"tests/data/acpi/q35/VIOT.viot", |
26 | +FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Partially cached, minus FPEXC. */ | 29 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
27 | FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */ | 30 | new file mode 100644 |
28 | FIELD(TBFLAG_A32, SCTLR_B, 16, 1) | 31 | index XXXXXXX..XXXXXXX |
29 | /* For M profile only, set if FPCCR.LSPACT is set */ | 32 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
30 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 33 | new file mode 100644 |
31 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX |
32 | --- a/target/arm/helper.c | 35 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
33 | +++ b/target/arm/helper.c | 36 | new file mode 100644 |
34 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | 37 | index XXXXXXX..XXXXXXX |
35 | { | ||
36 | uint32_t flags = 0; | ||
37 | |||
38 | + /* v8M always enables the fpu. */ | ||
39 | + flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
40 | + | ||
41 | if (arm_v7m_is_handler_mode(env)) { | ||
42 | flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); | ||
43 | } | ||
44 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
45 | ARMMMUIdx mmu_idx) | ||
46 | { | ||
47 | uint32_t flags = rebuild_hflags_aprofile(env); | ||
48 | + | ||
49 | + if (arm_el_is_aa64(env, 1)) { | ||
50 | + flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
51 | + } | ||
52 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | ||
53 | } | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
56 | flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, | ||
57 | env->vfp.vec_stride); | ||
58 | } | ||
59 | + if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)) { | ||
60 | + flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
61 | + } | ||
62 | } | ||
63 | |||
64 | flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); | ||
65 | flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits); | ||
66 | - if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) | ||
67 | - || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { | ||
68 | - flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
69 | - } | ||
70 | pstate_for_ss = env->uncached_cpsr; | ||
71 | } | ||
72 | |||
73 | -- | 38 | -- |
74 | 2.20.1 | 39 | 2.25.1 |
75 | 40 | ||
76 | 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 | Create a function to compute the values of the TBFLAG_ANY bits | 3 | Add two test cases for VIOT, one on the q35 machine and the other on |
4 | that will be cached, and are used by A-profile. | 4 | virt. To test complex topologies the q35 test has two PCIe buses that |
5 | bypass the IOMMU (and are therefore not described by VIOT), and two | ||
6 | buses that are translated by virtio-iommu. | ||
5 | 7 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
8 | Message-id: 20191018174431.1784-9-richard.henderson@linaro.org | 10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
11 | Message-id: 20211210170415.583179-7-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/helper.c | 20 ++++++++++++-------- | 14 | tests/qtest/bios-tables-test.c | 38 ++++++++++++++++++++++++++++++++++ |
12 | 1 file changed, 12 insertions(+), 8 deletions(-) | 15 | 1 file changed, 38 insertions(+) |
13 | 16 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 17 | diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 19 | --- a/tests/qtest/bios-tables-test.c |
17 | +++ b/target/arm/helper.c | 20 | +++ b/tests/qtest/bios-tables-test.c |
18 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | 21 | @@ -XXX,XX +XXX,XX @@ static void test_acpi_virt_tcg(void) |
19 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | 22 | free_test_data(&data); |
20 | } | 23 | } |
21 | 24 | ||
22 | +static uint32_t rebuild_hflags_aprofile(CPUARMState *env) | 25 | +static void test_acpi_q35_viot(void) |
23 | +{ | 26 | +{ |
24 | + int flags = 0; | 27 | + test_data data = { |
28 | + .machine = MACHINE_Q35, | ||
29 | + .variant = ".viot", | ||
30 | + }; | ||
25 | + | 31 | + |
26 | + flags = FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, | 32 | + /* |
27 | + arm_debug_target_el(env)); | 33 | + * To keep things interesting, two buses bypass the IOMMU. |
28 | + return flags; | 34 | + * VIOT should only describes the other two buses. |
35 | + */ | ||
36 | + test_acpi_one("-machine default_bus_bypass_iommu=on " | ||
37 | + "-device virtio-iommu-pci " | ||
38 | + "-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " | ||
39 | + "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " | ||
40 | + "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", | ||
41 | + &data); | ||
42 | + free_test_data(&data); | ||
29 | +} | 43 | +} |
30 | + | 44 | + |
31 | static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, | 45 | +static void test_acpi_virt_viot(void) |
32 | ARMMMUIdx mmu_idx) | 46 | +{ |
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); | ||
59 | +} | ||
60 | + | ||
61 | static void test_oem_fields(test_data *data) | ||
33 | { | 62 | { |
34 | - return rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | 63 | int i; |
35 | + uint32_t flags = rebuild_hflags_aprofile(env); | 64 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
36 | + return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | 65 | qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); |
37 | } | 66 | qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); |
38 | 67 | } | |
39 | static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | 68 | + qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); |
40 | ARMMMUIdx mmu_idx) | 69 | } else if (strcmp(arch, "aarch64") == 0) { |
41 | { | 70 | if (has_tcg) { |
42 | + uint32_t flags = rebuild_hflags_aprofile(env); | 71 | qtest_add_func("acpi/virt", test_acpi_virt_tcg); |
43 | ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx); | 72 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char *argv[]) |
44 | ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1); | 73 | qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); |
45 | - uint32_t flags = 0; | 74 | qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); |
46 | uint64_t sctlr; | 75 | qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); |
47 | int tbii, tbid; | 76 | + qtest_add_func("acpi/virt/viot", test_acpi_virt_viot); |
48 | |||
49 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
50 | } | 77 | } |
51 | } | 78 | } |
52 | 79 | ret = g_test_run(); | |
53 | - if (!arm_feature(env, ARM_FEATURE_M)) { | ||
54 | - int target_el = arm_debug_target_el(env); | ||
55 | - | ||
56 | - flags = FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, target_el); | ||
57 | - } | ||
58 | - | ||
59 | *pflags = flags; | ||
60 | *cs_base = 0; | ||
61 | } | ||
62 | -- | 80 | -- |
63 | 2.20.1 | 81 | 2.25.1 |
64 | 82 | ||
65 | 83 | 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 | Create a function to compute the values of the TBFLAG_A64 bits | 3 | Add expected blobs of the VIOT and DSDT table for the VIOT test on the |
4 | that will be cached. For now, the env->hflags variable is not | 4 | q35 machine. |
5 | used, and the results are fed back to cpu_get_tb_cpu_state. | 5 | |
6 | 6 | Since the test instantiates a virtio device and two PCIe expander | |
7 | Note that not all BTI related flags are cached, so we have to | 7 | bridges, DSDT.viot has more blocks than the base DSDT. |
8 | test the BTI feature twice -- once for those bits moved out to | 8 | |
9 | rebuild_hflags_a64 and once for those bits that remain in | 9 | The VIOT table generated for the q35 test is: |
10 | cpu_get_tb_cpu_state. | 10 | |
11 | 11 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] | |
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 12 | [004h 0004 4] Table Length : 00000070 |
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 13 | [008h 0008 1] Revision : 00 |
14 | Message-id: 20191018174431.1784-3-richard.henderson@linaro.org | 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 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 459 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 460 | --- |
17 | target/arm/helper.c | 131 +++++++++++++++++++++++--------------------- | 461 | tests/qtest/bios-tables-test-allowed-diff.h | 2 -- |
18 | 1 file changed, 69 insertions(+), 62 deletions(-) | 462 | tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9398 bytes |
19 | 463 | tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes | |
20 | diff --git a/target/arm/helper.c b/target/arm/helper.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 | ||
21 | index XXXXXXX..XXXXXXX 100644 | 467 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/helper.c | 468 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
23 | +++ b/target/arm/helper.c | 469 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
24 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, | 470 | @@ -XXX,XX +XXX,XX @@ |
25 | return flags; | 471 | /* List of comma-separated changed AML files to ignore */ |
26 | } | 472 | "tests/data/acpi/virt/VIOT", |
27 | 473 | -"tests/data/acpi/q35/DSDT.viot", | |
28 | +static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | 474 | -"tests/data/acpi/q35/VIOT.viot", |
29 | + ARMMMUIdx mmu_idx) | 475 | diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot |
30 | +{ | 476 | index XXXXXXX..XXXXXXX 100644 |
31 | + ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx); | 477 | GIT binary patch |
32 | + ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1); | 478 | literal 9398 |
33 | + uint32_t flags = 0; | 479 | zcmeHNO>7&-8J*>iv|O&FB}G~Oi$yp||57BBoWHhc5OS9yDTx$CQgH$r;8Idr*-4Q_ |
34 | + uint64_t sctlr; | 480 | z5(9Az1F`}niVsB-)<KW7p`g9Br(A2Gm-gmc1N78GFS!;)e2V(MnH_0{q<{#yMgn&C |
35 | + int tbii, tbid; | 481 | zn|*J-d9yqFhO_H6z19~`FlPL*u<DkZ*}|)JH;X@mF-FI<cPg<fti9tEN*yB^i5czN |
36 | + | 482 | zNq&q?!OZ;BE3B7{KWzJ-`Tn~f`9?Qj8~2^N8{Oc8J%57{==w%rS#;nOCp*nTr@iZ1 |
37 | + flags = FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1); | 483 | zb+?i;JLQUJ=O0?8*>S~D)a>NF1~WVB6^~_B#yhJ`H+JU@=6aXs`?Yv)J2h=N?drcS |
38 | + | 484 | zeLZ*n<<Bm^n}6`jfBx#u8&(W}1?)}iF9o#mZ~E2+zwdn7yK3AbIzKnxpZ>JRPm3~# |
39 | + /* FIXME: ARMv8.1-VHE S2 translation regime. */ | 485 | z&ICS{+_OayRW-l=Mtk=~uaS3o8z<_udd|(wqg`&JnVPfCe>BUOO`Su3e>pff_^UW% |
40 | + if (regime_el(env, stage1) < 2) { | 486 | z&JE^NO`)=Amg~iqRB1pPscP?(>#ZuY8GHCmlEvD$9g3%4Db~Dfz2SATnddvrR-Oe^ |
41 | + ARMVAParameters p1 = aa64_va_parameters_both(env, -1, stage1); | 487 | z;s;dJec!hnzi)ri^I6YN9vtkm{^TdUF8h7gX8-<Qe4p)GQ=)AtYx2VcwdLVAEXEjG |
42 | + tbid = (p1.tbi << 1) | p0.tbi; | 488 | z^Mj|UHPqkj-LsWuzQem1>F3atdZn=zv3$#RmZzSHN+6-yyU#8cJb=YDilX&sl}vNm |
43 | + tbii = tbid & ~((p1.tbid << 1) | p0.tbid); | 489 | znkgAR^O<3kj4if>{ly5fwRfMWuC5=lrlvKPX~i#654Cp}R_d*JS$9laZ$ra6)<ns8 |
44 | + } else { | 490 | zFZy28G%xP(nit&F>LDi%G<tIc=TY=gl$jSD&Uv!Yat~XR46h%rI$!}a%!|xG7u8Zn |
45 | + tbid = p0.tbi; | 491 | zeY8_|n=K>xz_v_W8VX$W-Fg-qFWcT}7MCyz{%%{ia7hZ>Law-k6NOr}VI&_48U=2l |
46 | + tbii = tbid & !p0.tbid; | 492 | zwqDKFE8eTwwozDdms#e?x?5a|v>&JF;2_v0L~z5n%BYU^52<*cWuD4|GYUm@1+?)) |
47 | + } | 493 | zte^45>Rz)t*<T5V#={r>@t@{%?^i#W{i=HAZ*Dc9y59Va-+#P!jrGs;u38a{fLr`N |
48 | + | 494 | zvT@rUu>DljxJ?^&Z?-?vyJn3C>3D=qux{Y*bs5|5n)Qmi$TD^Zdn4GU$ocJS2Hh-< |
49 | + flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); | 495 | z`xPI^^+v0nUVdjMos8k`WGl7hA`{03ju%<lrgAHSpd^DRf-*}_#Ly0mB!LSfVgWcQ |
50 | + flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); | 496 | z&T$@~G9)JI=hz5m0vkrel+Xy{Oh7pkAu-V!j*W7rY(bO}Q$nMH2`FbGB&N)QaV4<4 |
51 | + | 497 | zo)~9JXiP9=;}NPl<C@MmXG&;XFlFNrsyfFsonxFSp<}vEgsRSQP3O3#b6nSnP}ON_ |
52 | + if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { | 498 | zI!#Tdsp~|j>ckUB>FI=~GokB5sOq#dotCE4(sd$KbtW~PNlj-`*NIToiD#j5J#9^= |
53 | + int sve_el = sve_exception_el(env, el); | 499 | zt?NXn>YUJYPG~wObe#xQos*i*NloXZt`niEb4t@WrRki~bs|)CI+{*L)9L6s5vn>< |
54 | + uint32_t zcr_len; | 500 | zn$DD_Go|Z9sOn5>I@6lYw5}7Os&iV?Ij!lO)^#FOb!If38BJ$K*NIToIiu;E(R9w} |
55 | + | 501 | zIuWWmPiZ<&X*y5oIuWWmF_XaEC!a&Jn$B5WCqh-{X-(&8P3LJ{Cqh-{8P3dyPr@^t |
56 | + /* | 502 | zSqL9?X9Uwd3W@23*s~h*tj0X6GZCuHa~kuU#yqDp5vt7d8uPryJg+kms?5hU=3^T3 |
57 | + * If SVE is disabled, but FP is enabled, | 503 | zF`bD}WnSP+=`t5MQ$FJ_2&Q~+BP6E0f^%BVIW6a$o)e+SX~IDBih-7z6{O~7YTy`& |
58 | + * then the effective len is 0. | 504 | zLjy&Cv?7QikV#>n0>>@MV8oK`Gmun34-FKdlm-J8SZSaNlnhir4-FI{S|bfqV8e)V |
59 | + */ | 505 | zss<{chX#reE#g=hsKAC%sF6d-Km}BWs!kZFsFpKfpbC@>6rprQGEjt4Ck#|zITHq| |
60 | + if (sve_el != 0 && fp_el == 0) { | 506 | zK*>M_l;<P^MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=xY&!axO< |
61 | + zcr_len = 0; | 507 | zGhv_#lnhirIg<<&q0|Wj6<E%MfhtfkPyyvkGEjt4Ck#|zITHq|K*>M_lrzad5lWpf |
62 | + } else { | 508 | zP=V!47^ngz0~JutBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb} |
63 | + zcr_len = sve_zcr_len_for_el(env, el); | 509 | zQYQ>lU^x>8szAv=1(Y+%KoLrvFi?TzOc<yFB?A>u&LjgxD0RX>1(q{mpbC@>R6seC |
64 | + } | 510 | z3>2Z%2?G^a&V+#~P%=;f<xDbAgi<FARA4z12C6{GKn0XD$v_cGoiI>=<xCi;0wn_# |
65 | + flags = FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el); | 511 | zP|hR+MJRQ`Kn0dFVW0|>3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^3{+q_69%e4 |
66 | + flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); | 512 | z$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axxz28u{EP=u<1B2)}iVZuNaCK;&0 |
67 | + } | 513 | zBm-5LFi?dF167!0pbC==RAItE6($T+VUmF=Ofpb~2?JG_Fi?d_2C6X0Kouqo6p_5T |
68 | + | 514 | zFi=FeV!SiSKoR0H$dH(_Z(*Q_WZ%L-5y`$K14StNmJAdjmWs}HV4<vU_xO+1efmLq |
69 | + sctlr = arm_sctlr(env, el); | 515 | zZ;W>N_U)fP6Qy6Nw5mbt9Y(#emWSi66=>tq#xoh#Ue=0qyhxi8ZOUe5y0V7VfPUhp |
70 | + | 516 | zwX=;ymc+i5%sg9Ja~lZ&8oAV@mHc>&CHP9v4R(jhtT?un;O4e9#pno)Xkh7OWgK&a |
71 | + if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) { | 517 | zyj=3Iv0OuoK_;5rOr5f(Kb~ZXDBO+V`OWYo#_C08imwChQxnjdd?wZLDou8aj;$SD |
72 | + /* | 518 | zGDYiA3<$Tu<JnHL(KPOChi#zrR32t83}naR$+ym4P_h?z_5#|cW-nw$XD_sOtE62l |
73 | + * In order to save space in flags, we record only whether | 519 | zrD3@*)NVyiklt0&yF9%+klsBey&I<Y2E<!f(E8TuJte)z(|ZHyy<^gQVfx}=`q&B5 |
74 | + * pauth is "inactive", meaning all insns are implemented as | 520 | z7nSryp1wGczIaUfVwiq$Fn#<4=@*ssi#+|}K>EdF(l3VTOM~ghPLRH&q%ZOGrGfON |
75 | + * a nop, or "active" when some action must be performed. | 521 | zW73zx^yR_y<0nX8R??Sw`tm^f@-gYlNFSp|*<gA{q?Zp5Oe-+l#rmyYmKozi9y=P> |
76 | + * The decision of which action to take is left to a helper. | 522 | zVReJU*h=ZuVXiS$ohTbw-O#v9>(yZbGE|)?8(H1ZIKvV!jWa0>vy!3eMA^vdhQ>`s |
77 | + */ | 523 | zuMSg{q3T50$m)j1!HixV<}X9liL#N^4c*tL^y)CF8LCc{jjV3yKAqL8!%SzWI#H%q |
78 | + if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) { | 524 | z=bSrQ&)%JCRttF5g4Zf`6l?y@>PzD7MA^D>wBlcH6r1ucwJ<p0O%rZ?JzIY3-QdmZ |
79 | + flags = FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1); | 525 | zzs|n>`a5r3e|z)wcUaqS>nqFQ-8x}eCF4u`OWUxqst-@1rSmUs%WmKP5e0dcb?e2N |
80 | + } | 526 | z;Z|x*!);VwF|Yuhqs^khqOM!@u*jY!WYldISF(V6`BoNd&6Qfk3>X#SuD^7J>p_D= |
81 | + } | 527 | zBPa51y^_n#=cpOt#Zf$ya$Ae9Mfz56n|<i!a=ELS@)%a{^NIH3SDuN<R~sah1km#P |
82 | + | 528 | zU@?*f%<rG=4W1wgfi;C?_n|W@%lm$&8YfvNOJodIg&IcIpIJQRHr<+ej11GQ6)&eF |
83 | + if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | 529 | z2Lam*jIH}#y0>KnY%4JQfOYS$*uU%f#@$U6`N8I3N-lV?5ErFCdv~xDmu2(wexld4 |
84 | + /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */ | 530 | z4v^;aVAT2k6GJ^m*FD(Wqc(Qg^)6a<?}h$zLoj}4;PP!+(O{@!a1y-hoAhF_7!z+6 |
85 | + if (sctlr & (el == 0 ? SCTLR_BT0 : SCTLR_BT1)) { | 531 | zslpAmNtYbjHrw-~#SPVk_FUf>-Obg6yV`8o$8_`PyJe_;bY5_EMBfBfWU!Q=*9HsG |
86 | + flags = FIELD_DP32(flags, TBFLAG_A64, BT, 1); | 532 | z%_Cda{@_Krr!oHVhv9+y+T5qR8zZ2aZ>5r!$*|f$^U%yBUYfR&B!+EYy_PwL!BeUi |
87 | + } | 533 | zJH^}r3r9Q+B)X@Z)fk=P13w&7x#wBtXTZ)g>WITPg5r&pQc!nmyrmk#S(>>b9xnNr |
88 | + } | 534 | zx_b#v9Xv-Y><Wb%?S^0Xe&<)bbKl_=Z|3C$tf|F<bYzE*mfHB;uC)`q-?buaBe?l? |
89 | + | 535 | zcLTpK*k<49Z32`K?|nSBMFqxTK^_IE-li2fEGdK~(ZdoKBl6ab4a;Hler#`xvEXJG |
90 | + return rebuild_hflags_common(env, fp_el, mmu_idx, flags); | 536 | zb?<E%EZExfX>jcOVhS*0rS~RS1dA#xhkv@Nct@#q?LyeKS<$uFec!bw>{@uu$gZ6a |
91 | +} | 537 | zyVen1i{1BKd%~`D7|m$;U0a<I*3I7%^N%N%lGYdU_GS!gaR8T$NA@GzFi~z`l7hdl |
92 | + | 538 | zarZy6590|88pi(1zq;V(>38zM0sT&<zX;R5$1w3;`_JMG`;&I&0Y23DMx1%@(w(R9 |
93 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 539 | z4M$j;D5J+Gy%fijRQsctzFKf&cv|BAz#YLq3CZJWDdtL4u1u1|mkdcUp7|sxJC+?Y |
94 | target_ulong *cs_base, uint32_t *pflags) | 540 | z_@@s`v3j}Q7*z>6X~cwUxUL8G1KT)_XTp!KAbs;vCp{K3&~_X@+ew=-D}v`2MbFV0 |
95 | { | 541 | zQsVsL=rXi-pI*G|iiz;VTCutgUs)hDzV1+4?8KcoP3xROf<M%qC6lgVdpFt4<-|uM |
96 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 542 | z=#rl_b1#YjSIl6Toj2z_hOZcKupkdE(LozC(fN=FY(x|sk)ym|;Rq2E1xJWD%Z!ol |
97 | uint32_t flags = 0; | 543 | Gu>S+TT-130 |
98 | 544 | ||
99 | if (is_a64(env)) { | 545 | literal 0 |
100 | - ARMCPU *cpu = env_archcpu(env); | 546 | HcmV?d00001 |
101 | - uint64_t sctlr; | 547 | |
102 | - | 548 | diff --git a/tests/data/acpi/q35/VIOT.viot b/tests/data/acpi/q35/VIOT.viot |
103 | *pc = env->pc; | 549 | index XXXXXXX..XXXXXXX 100644 |
104 | - flags = FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1); | 550 | GIT binary patch |
105 | - | 551 | literal 112 |
106 | - /* Get control bits for tagged addresses. */ | 552 | zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCA3T-xBj |
107 | - { | 553 | Q0Zb)W9Hva*zW_`e0M!8s0RR91 |
108 | - ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx); | 554 | |
109 | - ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1); | 555 | literal 0 |
110 | - int tbii, tbid; | 556 | HcmV?d00001 |
111 | - | 557 | |
112 | - /* FIXME: ARMv8.1-VHE S2 translation regime. */ | ||
113 | - if (regime_el(env, stage1) < 2) { | ||
114 | - ARMVAParameters p1 = aa64_va_parameters_both(env, -1, stage1); | ||
115 | - tbid = (p1.tbi << 1) | p0.tbi; | ||
116 | - tbii = tbid & ~((p1.tbid << 1) | p0.tbid); | ||
117 | - } else { | ||
118 | - tbid = p0.tbi; | ||
119 | - tbii = tbid & !p0.tbid; | ||
120 | - } | ||
121 | - | ||
122 | - flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii); | ||
123 | - flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid); | ||
124 | - } | ||
125 | - | ||
126 | - if (cpu_isar_feature(aa64_sve, cpu)) { | ||
127 | - int sve_el = sve_exception_el(env, current_el); | ||
128 | - uint32_t zcr_len; | ||
129 | - | ||
130 | - /* If SVE is disabled, but FP is enabled, | ||
131 | - * then the effective len is 0. | ||
132 | - */ | ||
133 | - if (sve_el != 0 && fp_el == 0) { | ||
134 | - zcr_len = 0; | ||
135 | - } else { | ||
136 | - zcr_len = sve_zcr_len_for_el(env, current_el); | ||
137 | - } | ||
138 | - flags = FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el); | ||
139 | - flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); | ||
140 | - } | ||
141 | - | ||
142 | - sctlr = arm_sctlr(env, current_el); | ||
143 | - | ||
144 | - if (cpu_isar_feature(aa64_pauth, cpu)) { | ||
145 | - /* | ||
146 | - * In order to save space in flags, we record only whether | ||
147 | - * pauth is "inactive", meaning all insns are implemented as | ||
148 | - * a nop, or "active" when some action must be performed. | ||
149 | - * The decision of which action to take is left to a helper. | ||
150 | - */ | ||
151 | - if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) { | ||
152 | - flags = FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1); | ||
153 | - } | ||
154 | - } | ||
155 | - | ||
156 | - if (cpu_isar_feature(aa64_bti, cpu)) { | ||
157 | - /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */ | ||
158 | - if (sctlr & (current_el == 0 ? SCTLR_BT0 : SCTLR_BT1)) { | ||
159 | - flags = FIELD_DP32(flags, TBFLAG_A64, BT, 1); | ||
160 | - } | ||
161 | + flags = rebuild_hflags_a64(env, current_el, fp_el, mmu_idx); | ||
162 | + if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { | ||
163 | flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); | ||
164 | } | ||
165 | } else { | ||
166 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
167 | flags = FIELD_DP32(flags, TBFLAG_A32, | ||
168 | XSCALE_CPAR, env->cp15.c15_cpar); | ||
169 | } | ||
170 | - } | ||
171 | |||
172 | - flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
173 | + flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags); | ||
174 | + } | ||
175 | |||
176 | /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine | ||
177 | * states defined in the ARM ARM for software singlestep: | ||
178 | -- | 558 | -- |
179 | 2.20.1 | 559 | 2.25.1 |
180 | 560 | ||
181 | 561 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Hoist the computation of some TBFLAG_A32 bits that only apply to | ||
4 | M-profile under a single test for ARM_FEATURE_M. | ||
5 | |||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20191018174431.1784-7-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/helper.c | 49 +++++++++++++++++++++------------------------ | ||
12 | 1 file changed, 23 insertions(+), 26 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/helper.c | ||
17 | +++ b/target/arm/helper.c | ||
18 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
19 | |||
20 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
21 | flags = rebuild_hflags_m32(env, fp_el, mmu_idx); | ||
22 | + | ||
23 | + if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | ||
24 | + FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) | ||
25 | + != env->v7m.secure) { | ||
26 | + flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); | ||
27 | + } | ||
28 | + | ||
29 | + if ((env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) && | ||
30 | + (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) || | ||
31 | + (env->v7m.secure && | ||
32 | + !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) { | ||
33 | + /* | ||
34 | + * ASPEN is set, but FPCA/SFPA indicate that there is no | ||
35 | + * active FP context; we must create a new FP context before | ||
36 | + * executing any FP insn. | ||
37 | + */ | ||
38 | + flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); | ||
39 | + } | ||
40 | + | ||
41 | + bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
42 | + if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { | ||
43 | + flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); | ||
44 | + } | ||
45 | } else { | ||
46 | flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | ||
47 | } | ||
48 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
49 | } | ||
50 | } | ||
51 | |||
52 | - if (arm_feature(env, ARM_FEATURE_M_SECURITY) && | ||
53 | - FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) { | ||
54 | - flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1); | ||
55 | - } | ||
56 | - | ||
57 | - if (arm_feature(env, ARM_FEATURE_M) && | ||
58 | - (env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) && | ||
59 | - (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) || | ||
60 | - (env->v7m.secure && | ||
61 | - !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) { | ||
62 | - /* | ||
63 | - * ASPEN is set, but FPCA/SFPA indicate that there is no active | ||
64 | - * FP context; we must create a new FP context before executing | ||
65 | - * any FP insn. | ||
66 | - */ | ||
67 | - flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1); | ||
68 | - } | ||
69 | - | ||
70 | - if (arm_feature(env, ARM_FEATURE_M)) { | ||
71 | - bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
72 | - | ||
73 | - if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) { | ||
74 | - flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); | ||
75 | - } | ||
76 | - } | ||
77 | - | ||
78 | if (!arm_feature(env, ARM_FEATURE_M)) { | ||
79 | int target_el = arm_debug_target_el(env); | ||
80 | |||
81 | -- | ||
82 | 2.20.1 | ||
83 | |||
84 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Currently a trivial wrapper for rebuild_hflags_common_32. | ||
4 | |||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20191018174431.1784-8-richard.henderson@linaro.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/helper.c | 8 +++++++- | ||
11 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/helper.c | ||
16 | +++ b/target/arm/helper.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, | ||
18 | return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); | ||
19 | } | ||
20 | |||
21 | +static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el, | ||
22 | + ARMMMUIdx mmu_idx) | ||
23 | +{ | ||
24 | + return rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | ||
25 | +} | ||
26 | + | ||
27 | static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | ||
28 | ARMMMUIdx mmu_idx) | ||
29 | { | ||
30 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
31 | flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1); | ||
32 | } | ||
33 | } else { | ||
34 | - flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); | ||
35 | + flags = rebuild_hflags_a32(env, fp_el, mmu_idx); | ||
36 | } | ||
37 | |||
38 | flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); | ||
39 | -- | ||
40 | 2.20.1 | ||
41 | |||
42 | 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 do not need to compute any of these values for M-profile. | 3 | The VIOT blob contains the following: |
4 | Further, XSCALE_CPAR overlaps VECSTRIDE so obviously the two | ||
5 | sets must be mutually exclusive. | ||
6 | 4 | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 5 | [000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | [004h 0004 4] Table Length : 00000058 |
9 | Message-id: 20191018174431.1784-10-richard.henderson@linaro.org | 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 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 44 | --- |
12 | target/arm/helper.c | 21 ++++++++++++++------- | 45 | tests/qtest/bios-tables-test-allowed-diff.h | 1 - |
13 | 1 file changed, 14 insertions(+), 7 deletions(-) | 46 | tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes |
47 | 2 files changed, 1 deletion(-) | ||
14 | 48 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 49 | diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h |
16 | index XXXXXXX..XXXXXXX 100644 | 50 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 51 | --- a/tests/qtest/bios-tables-test-allowed-diff.h |
18 | +++ b/target/arm/helper.c | 52 | +++ b/tests/qtest/bios-tables-test-allowed-diff.h |
19 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | 53 | @@ -1,2 +1 @@ |
20 | } | 54 | /* List of comma-separated changed AML files to ignore */ |
21 | } else { | 55 | -"tests/data/acpi/virt/VIOT", |
22 | flags = rebuild_hflags_a32(env, fp_el, mmu_idx); | 56 | diff --git a/tests/data/acpi/virt/VIOT b/tests/data/acpi/virt/VIOT |
23 | + | 57 | index XXXXXXX..XXXXXXX 100644 |
24 | + /* | 58 | GIT binary patch |
25 | + * Note that XSCALE_CPAR shares bits with VECSTRIDE. | 59 | literal 88 |
26 | + * Note that VECLEN+VECSTRIDE are RES0 for M-profile. | 60 | zcmWIZ^bd((0D?3pe`k+i1*eDrX9XZ&1PX!JAexE60Hgv8m>C3sGzXN&z`)2L0cSHX |
27 | + */ | 61 | I{D-Rq0Q5fy0RR91 |
28 | + if (arm_feature(env, ARM_FEATURE_XSCALE)) { | 62 | |
29 | + flags = FIELD_DP32(flags, TBFLAG_A32, | 63 | literal 0 |
30 | + XSCALE_CPAR, env->cp15.c15_cpar); | 64 | HcmV?d00001 |
31 | + } else { | 65 | |
32 | + flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, | ||
33 | + env->vfp.vec_len); | ||
34 | + flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, | ||
35 | + env->vfp.vec_stride); | ||
36 | + } | ||
37 | } | ||
38 | |||
39 | flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); | ||
40 | - flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); | ||
41 | - flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride); | ||
42 | flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits); | ||
43 | if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) | ||
44 | || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { | ||
45 | flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); | ||
46 | } | ||
47 | - /* Note that XSCALE_CPAR shares bits with VECSTRIDE */ | ||
48 | - if (arm_feature(env, ARM_FEATURE_XSCALE)) { | ||
49 | - flags = FIELD_DP32(flags, TBFLAG_A32, | ||
50 | - XSCALE_CPAR, env->cp15.c15_cpar); | ||
51 | - } | ||
52 | } | ||
53 | |||
54 | /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine | ||
55 | -- | 66 | -- |
56 | 2.20.1 | 67 | 2.25.1 |
57 | 68 | ||
58 | 69 | diff view generated by jsdifflib |