1 | First arm pullreq of the 2.11 cycle. I know I still have some | 1 | The following changes since commit 1ea06abceec61b6f3ab33dadb0510b6e09fb61e2: |
---|---|---|---|
2 | more stuff on my queue to review, but 36 patches is big enough | ||
3 | as it is; I expect I'll do another pull later this week. | ||
4 | 2 | ||
5 | thanks | 3 | Merge remote-tracking branch 'remotes/berrange-gitlab/tags/misc-fixes-pull-request' into staging (2021-06-14 15:59:13 +0100) |
6 | -- PMM | ||
7 | 4 | ||
8 | The following changes since commit 32f0f68bb77289b75a82925f712bb52e16eac3ba: | 5 | are available in the Git repository at: |
9 | 6 | ||
10 | Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging (2017-09-01 17:28:54 +0100) | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210615 |
11 | 8 | ||
12 | are available in the git repository at: | 9 | for you to fetch changes up to c611c956c7fdce651e30687b1f5d19b4cab78b6a: |
13 | 10 | ||
14 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170904 | 11 | include/qemu/int128.h: Add function to create Int128 from int64_t (2021-06-15 16:18:50 +0100) |
15 | |||
16 | for you to fetch changes up to 1e35c4ce33a94cf78dbf639695cb877ef35920b0: | ||
17 | |||
18 | arm_gicv3_kvm: Fix compile warning (2017-09-04 12:09:32 +0100) | ||
19 | 12 | ||
20 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
21 | target-arm: | 14 | target-arm queue: |
22 | * collection of M profile cleanups and minor bugfixes | 15 | * hw/intc/arm_gicv3_cpuif: Tolerate spurious EOIR writes |
23 | * loader: handle ELF files with overlapping zero-init data | 16 | * handle some UNALLOCATED decode cases correctly rather |
24 | * virt: allow PMU instantiation with userspace irqchip | 17 | than asserting |
25 | * wdt_aspeed: Add support for the reset width register | 18 | * hw: virt: consider hw_compat_6_0 |
26 | * cpu: Define new cpu_transaction_failed() hook | 19 | * hw/arm: add quanta-gbs-bmc machine |
27 | * arm: Support generating CPU exceptions on memory | 20 | * hw/intc/armv7m_nvic: Remove stale comment |
28 | transaction failures (bus faults) | 21 | * arm, acpi: Remove dependency on presence of 'virt' board |
29 | * Mark some SoC devices as not user-creatable | 22 | * target/arm: Fix mte page crossing test |
30 | * arm: Fix aa64 ldp register writeback | 23 | * hw/arm: quanta-q71l add pca954x muxes |
31 | * arm_gicv3_kvm: Fix compile warning | 24 | * target/arm: First few parts of MVE support |
32 | 25 | ||
33 | ---------------------------------------------------------------- | 26 | ---------------------------------------------------------------- |
34 | Andrew Jeffery (2): | 27 | Heinrich Schuchardt (1): |
35 | watchdog: wdt_aspeed: Add support for the reset width register | 28 | hw: virt: consider hw_compat_6_0 |
36 | aspeed_soc: Propagate silicon-rev to watchdog | ||
37 | 29 | ||
38 | Andrew Jones (4): | 30 | Jean-Philippe Brucker (1): |
39 | hw/arm/virt: add pmu interrupt state | 31 | hw/intc/arm_gicv3_cpuif: Tolerate spurious EOIR writes |
40 | target/arm/kvm: pmu: split init and set-irq stages | ||
41 | hw/arm/virt: allow pmu instantiation with userspace irqchip | ||
42 | target/arm/kvm: pmu: improve error handling | ||
43 | 32 | ||
44 | Peter Maydell (25): | 33 | Patrick Venture (5): |
45 | target/arm: Use MMUAccessType enum rather than int | 34 | hw/arm: add quanta-gbs-bmc machine |
46 | target/arm: Don't trap WFI/WFE for M profile | 35 | hw/arm: quanta-gbs-bmc add i2c comments |
47 | target/arm: Consolidate PMSA handling in get_phys_addr() | 36 | hw/arm: gsj add i2c comments |
48 | target/arm: Tighten up Thumb decode where new v8M insns will be | 37 | hw/arm: gsj add pca9548 |
49 | hw/intc/armv7m_nvic.c: Remove out of date comment | 38 | hw/arm: quanta-q71l add pca954x muxes |
50 | target/arm: Remove incorrect comment about MPU_CTRL | ||
51 | target/arm: Fix outdated comment about exception exit | ||
52 | target/arm: Define and use XPSR bit masks | ||
53 | target/arm: Don't store M profile PRIMASK and FAULTMASK in daif | ||
54 | target/arm: Don't use cpsr_write/cpsr_read to transfer M profile XPSR | ||
55 | target/arm: Make arm_cpu_dump_state() handle the M-profile XPSR | ||
56 | target/arm: Don't calculate lr in arm_v7m_cpu_do_interrupt() until needed | ||
57 | target/arm: Create and use new function arm_v7m_is_handler_mode() | ||
58 | armv7m_nvic.h: Move from include/hw/arm to include/hw/intc | ||
59 | nvic: Implement "user accesses BusFault" SCS region behaviour | ||
60 | loader: Handle ELF files with overlapping zero-initialized data | ||
61 | loader: Ignore zero-sized ELF segments | ||
62 | memory.h: Move MemTxResult type to memattrs.h | ||
63 | cpu: Define new cpu_transaction_failed() hook | ||
64 | cputlb: Support generating CPU exceptions on memory transaction failures | ||
65 | boards.h: Define new flag ignore_memory_transaction_failures | ||
66 | hw/arm: Set ignore_memory_transaction_failures for most ARM boards | ||
67 | target/arm: Factor out fault delivery code | ||
68 | target/arm: Allow deliver_fault() caller to specify EA bit | ||
69 | target/arm: Implement new do_transaction_failed hook | ||
70 | 39 | ||
71 | Philippe Mathieu-Daudé (1): | 40 | Peter Maydell (17): |
72 | hw/arm: use defined type name instead of hard-coded string | 41 | hw/intc/armv7m_nvic: Remove stale comment |
42 | hw/acpi: Provide stub version of acpi_ghes_record_errors() | ||
43 | hw/acpi: Provide function acpi_ghes_present() | ||
44 | target/arm: Use acpi_ghes_present() to see if we report ACPI memory errors | ||
45 | target/arm: Provide and use H8 and H1_8 macros | ||
46 | target/arm: Enable FPSCR.QC bit for MVE | ||
47 | target/arm: Handle VPR semantics in existing code | ||
48 | target/arm: Add handling for PSR.ECI/ICI | ||
49 | target/arm: Let vfp_access_check() handle late NOCP checks | ||
50 | target/arm: Implement MVE LCTP | ||
51 | target/arm: Implement MVE WLSTP insn | ||
52 | target/arm: Implement MVE DLSTP | ||
53 | target/arm: Implement MVE LETP insn | ||
54 | target/arm: Add framework for MVE decode | ||
55 | target/arm: Move expand_pred_b() data to vec_helper.c | ||
56 | bitops.h: Provide hswap32(), hswap64(), wswap64() swapping operations | ||
57 | include/qemu/int128.h: Add function to create Int128 from int64_t | ||
73 | 58 | ||
74 | Pranith Kumar (1): | 59 | Richard Henderson (4): |
75 | arm_gicv3_kvm: Fix compile warning | 60 | target/arm: Diagnose UNALLOCATED in disas_simd_two_reg_misc_fp16 |
61 | target/arm: Remove fprintf from disas_simd_mod_imm | ||
62 | target/arm: Diagnose UNALLOCATED in disas_simd_three_reg_same_fp16 | ||
63 | target/arm: Fix mte page crossing test | ||
76 | 64 | ||
77 | Richard Henderson (1): | 65 | include/hw/acpi/ghes.h | 9 + |
78 | target/arm: Fix aa64 ldp register writeback | 66 | include/qemu/bitops.h | 29 +++ |
67 | include/qemu/int128.h | 10 + | ||
68 | target/arm/translate-a32.h | 2 + | ||
69 | target/arm/translate.h | 9 + | ||
70 | target/arm/vec_internal.h | 9 + | ||
71 | target/arm/mve.decode | 20 ++ | ||
72 | target/arm/t32.decode | 15 +- | ||
73 | hw/acpi/ghes-stub.c | 22 +++ | ||
74 | hw/acpi/ghes.c | 17 ++ | ||
75 | hw/arm/aspeed.c | 11 +- | ||
76 | hw/arm/npcm7xx_boards.c | 107 ++++++++++- | ||
77 | hw/arm/virt.c | 2 + | ||
78 | hw/intc/arm_gicv3_cpuif.c | 5 +- | ||
79 | hw/intc/armv7m_nvic.c | 6 - | ||
80 | target/arm/kvm64.c | 6 +- | ||
81 | target/arm/m_helper.c | 54 +++++- | ||
82 | target/arm/mte_helper.c | 2 +- | ||
83 | target/arm/sve_helper.c | 381 +++++++++++++------------------------- | ||
84 | target/arm/translate-a64.c | 87 +++++---- | ||
85 | target/arm/translate-m-nocp.c | 16 +- | ||
86 | target/arm/translate-mve.c | 29 +++ | ||
87 | target/arm/translate-vfp.c | 65 +++++-- | ||
88 | target/arm/translate.c | 300 ++++++++++++++++++++++++++++-- | ||
89 | target/arm/vec_helper.c | 116 +++++++++++- | ||
90 | target/arm/vfp_helper.c | 3 +- | ||
91 | tests/tcg/aarch64/mte-7.c | 31 ++++ | ||
92 | hw/acpi/meson.build | 6 +- | ||
93 | hw/arm/Kconfig | 2 + | ||
94 | target/arm/meson.build | 2 + | ||
95 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
96 | 31 files changed, 1019 insertions(+), 356 deletions(-) | ||
97 | create mode 100644 target/arm/mve.decode | ||
98 | create mode 100644 hw/acpi/ghes-stub.c | ||
99 | create mode 100644 target/arm/translate-mve.c | ||
100 | create mode 100644 tests/tcg/aarch64/mte-7.c | ||
79 | 101 | ||
80 | Thomas Huth (2): | ||
81 | hw/arm/aspeed_soc: Mark devices as user_creatable = false | ||
82 | hw/arm/digic: Mark device with user_creatable = false | ||
83 | |||
84 | include/exec/memattrs.h | 10 +++ | ||
85 | include/exec/memory.h | 10 --- | ||
86 | include/hw/arm/armv7m.h | 2 +- | ||
87 | include/hw/boards.h | 11 +++ | ||
88 | include/hw/elf_ops.h | 72 +++++++++++++-- | ||
89 | include/hw/{arm => intc}/armv7m_nvic.h | 0 | ||
90 | include/hw/watchdog/wdt_aspeed.h | 2 + | ||
91 | include/qom/cpu.h | 27 ++++++ | ||
92 | softmmu_template.h | 4 +- | ||
93 | target/arm/cpu.h | 56 +++++++++--- | ||
94 | target/arm/internals.h | 15 +++- | ||
95 | target/arm/kvm_arm.h | 9 +- | ||
96 | accel/tcg/cputlb.c | 32 ++++++- | ||
97 | hw/arm/armv7m.c | 4 +- | ||
98 | hw/arm/aspeed.c | 3 + | ||
99 | hw/arm/aspeed_soc.c | 4 + | ||
100 | hw/arm/collie.c | 1 + | ||
101 | hw/arm/cubieboard.c | 1 + | ||
102 | hw/arm/digic.c | 2 + | ||
103 | hw/arm/digic_boards.c | 1 + | ||
104 | hw/arm/exynos4210.c | 4 +- | ||
105 | hw/arm/exynos4_boards.c | 2 + | ||
106 | hw/arm/gumstix.c | 2 + | ||
107 | hw/arm/highbank.c | 13 ++- | ||
108 | hw/arm/imx25_pdk.c | 1 + | ||
109 | hw/arm/integratorcp.c | 1 + | ||
110 | hw/arm/kzm.c | 1 + | ||
111 | hw/arm/mainstone.c | 1 + | ||
112 | hw/arm/musicpal.c | 1 + | ||
113 | hw/arm/netduino2.c | 1 + | ||
114 | hw/arm/nseries.c | 2 + | ||
115 | hw/arm/omap_sx1.c | 2 + | ||
116 | hw/arm/palm.c | 1 + | ||
117 | hw/arm/raspi.c | 1 + | ||
118 | hw/arm/realview.c | 10 ++- | ||
119 | hw/arm/sabrelite.c | 1 + | ||
120 | hw/arm/spitz.c | 4 + | ||
121 | hw/arm/stellaris.c | 2 + | ||
122 | hw/arm/tosa.c | 1 + | ||
123 | hw/arm/versatilepb.c | 2 + | ||
124 | hw/arm/vexpress.c | 7 +- | ||
125 | hw/arm/virt.c | 12 ++- | ||
126 | hw/arm/xilinx_zynq.c | 15 ++-- | ||
127 | hw/arm/xlnx-ep108.c | 2 + | ||
128 | hw/arm/z2.c | 1 + | ||
129 | hw/intc/arm_gicv3_kvm.c | 2 +- | ||
130 | hw/intc/armv7m_nvic.c | 68 +++++++++----- | ||
131 | hw/watchdog/wdt_aspeed.c | 93 ++++++++++++++++--- | ||
132 | qom/cpu.c | 7 ++ | ||
133 | target/arm/cpu.c | 8 +- | ||
134 | target/arm/helper.c | 124 ++++++++++++------------- | ||
135 | target/arm/kvm.c | 6 +- | ||
136 | target/arm/kvm32.c | 7 +- | ||
137 | target/arm/kvm64.c | 63 +++++++------ | ||
138 | target/arm/machine.c | 54 ++++++++++- | ||
139 | target/arm/op_helper.c | 160 ++++++++++++++++++++++----------- | ||
140 | target/arm/translate-a64.c | 29 +++--- | ||
141 | target/arm/translate.c | 106 ++++++++++++++++------ | ||
142 | 58 files changed, 795 insertions(+), 288 deletions(-) | ||
143 | rename include/hw/{arm => intc}/armv7m_nvic.h (100%) | ||
144 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The reset width register controls how the pulse on the SoC's WDTRST{1,2} | 3 | Commit 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access |
4 | pins behaves. A pulse is emitted if the external reset bit is set in | 4 | check logic") added an assert_not_reached() if the guest writes the EOIR |
5 | WDT_CTRL. On the AST2500 WDT_RESET_WIDTH can consume magic bit patterns | 5 | register while no interrupt is active. |
6 | to configure push-pull/open-drain and active-high/active-low | ||
7 | behaviours and thus needs some special handling in the write path. | ||
8 | 6 | ||
9 | As some of the capabilities depend on the SoC version a silicon-rev | 7 | It turns out some software does this: EDK2, in |
10 | property is introduced, which is used to guard version-specific | 8 | GicV3ExitBootServicesEvent(), unconditionally write EOIR for all |
11 | behaviour. | 9 | interrupts that it manages. This now causes QEMU to abort when running |
10 | UEFI on a VM with GICv3. Although it is UNPREDICTABLE behavior and EDK2 | ||
11 | does need fixing, the punishment seems a little harsh, especially since | ||
12 | icc_eoir_write() already tolerates writes of nonexistent interrupt | ||
13 | numbers. Display a guest error and tolerate spurious EOIR writes. | ||
12 | 14 | ||
13 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | 15 | Fixes: 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic") |
14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 16 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> |
17 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
19 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
20 | Message-id: 20210604130352.1887560-1-jean-philippe@linaro.org | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 23 | --- |
17 | include/hw/watchdog/wdt_aspeed.h | 2 + | 24 | hw/intc/arm_gicv3_cpuif.c | 5 ++++- |
18 | hw/watchdog/wdt_aspeed.c | 93 +++++++++++++++++++++++++++++++++++----- | 25 | 1 file changed, 4 insertions(+), 1 deletion(-) |
19 | 2 files changed, 84 insertions(+), 11 deletions(-) | ||
20 | 26 | ||
21 | diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h | 27 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
22 | index XXXXXXX..XXXXXXX 100644 | 28 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/watchdog/wdt_aspeed.h | 29 | --- a/hw/intc/arm_gicv3_cpuif.c |
24 | +++ b/include/hw/watchdog/wdt_aspeed.h | 30 | +++ b/hw/intc/arm_gicv3_cpuif.c |
25 | @@ -XXX,XX +XXX,XX @@ typedef struct AspeedWDTState { | ||
26 | uint32_t regs[ASPEED_WDT_REGS_MAX]; | ||
27 | |||
28 | uint32_t pclk_freq; | ||
29 | + uint32_t silicon_rev; | ||
30 | + uint32_t ext_pulse_width_mask; | ||
31 | } AspeedWDTState; | ||
32 | |||
33 | #endif /* ASPEED_WDT_H */ | ||
34 | diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/hw/watchdog/wdt_aspeed.c | ||
37 | +++ b/hw/watchdog/wdt_aspeed.c | ||
38 | @@ -XXX,XX +XXX,XX @@ | 31 | @@ -XXX,XX +XXX,XX @@ |
39 | */ | ||
40 | 32 | ||
41 | #include "qemu/osdep.h" | 33 | #include "qemu/osdep.h" |
42 | + | 34 | #include "qemu/bitops.h" |
43 | +#include "qapi/error.h" | 35 | +#include "qemu/log.h" |
44 | #include "qemu/log.h" | 36 | #include "qemu/main-loop.h" |
45 | +#include "qemu/timer.h" | 37 | #include "trace.h" |
46 | #include "sysemu/watchdog.h" | 38 | #include "gicv3_internal.h" |
47 | +#include "hw/misc/aspeed_scu.h" | 39 | @@ -XXX,XX +XXX,XX @@ static void icc_eoir_write(CPUARMState *env, const ARMCPRegInfo *ri, |
48 | #include "hw/sysbus.h" | ||
49 | -#include "qemu/timer.h" | ||
50 | #include "hw/watchdog/wdt_aspeed.h" | ||
51 | |||
52 | -#define WDT_STATUS (0x00 / 4) | ||
53 | -#define WDT_RELOAD_VALUE (0x04 / 4) | ||
54 | -#define WDT_RESTART (0x08 / 4) | ||
55 | -#define WDT_CTRL (0x0C / 4) | ||
56 | +#define WDT_STATUS (0x00 / 4) | ||
57 | +#define WDT_RELOAD_VALUE (0x04 / 4) | ||
58 | +#define WDT_RESTART (0x08 / 4) | ||
59 | +#define WDT_CTRL (0x0C / 4) | ||
60 | #define WDT_CTRL_RESET_MODE_SOC (0x00 << 5) | ||
61 | #define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5) | ||
62 | #define WDT_CTRL_1MHZ_CLK BIT(4) | ||
63 | @@ -XXX,XX +XXX,XX @@ | ||
64 | #define WDT_CTRL_WDT_INTR BIT(2) | ||
65 | #define WDT_CTRL_RESET_SYSTEM BIT(1) | ||
66 | #define WDT_CTRL_ENABLE BIT(0) | ||
67 | +#define WDT_RESET_WIDTH (0x18 / 4) | ||
68 | +#define WDT_RESET_WIDTH_ACTIVE_HIGH BIT(31) | ||
69 | +#define WDT_POLARITY_MASK (0xFF << 24) | ||
70 | +#define WDT_ACTIVE_HIGH_MAGIC (0xA5 << 24) | ||
71 | +#define WDT_ACTIVE_LOW_MAGIC (0x5A << 24) | ||
72 | +#define WDT_RESET_WIDTH_PUSH_PULL BIT(30) | ||
73 | +#define WDT_DRIVE_TYPE_MASK (0xFF << 24) | ||
74 | +#define WDT_PUSH_PULL_MAGIC (0xA8 << 24) | ||
75 | +#define WDT_OPEN_DRAIN_MAGIC (0x8A << 24) | ||
76 | |||
77 | -#define WDT_TIMEOUT_STATUS (0x10 / 4) | ||
78 | -#define WDT_TIMEOUT_CLEAR (0x14 / 4) | ||
79 | -#define WDT_RESET_WDITH (0x18 / 4) | ||
80 | +#define WDT_TIMEOUT_STATUS (0x10 / 4) | ||
81 | +#define WDT_TIMEOUT_CLEAR (0x14 / 4) | ||
82 | |||
83 | -#define WDT_RESTART_MAGIC 0x4755 | ||
84 | +#define WDT_RESTART_MAGIC 0x4755 | ||
85 | |||
86 | static bool aspeed_wdt_is_enabled(const AspeedWDTState *s) | ||
87 | { | ||
88 | return s->regs[WDT_CTRL] & WDT_CTRL_ENABLE; | ||
89 | } | ||
90 | |||
91 | +static bool is_ast2500(const AspeedWDTState *s) | ||
92 | +{ | ||
93 | + switch (s->silicon_rev) { | ||
94 | + case AST2500_A0_SILICON_REV: | ||
95 | + case AST2500_A1_SILICON_REV: | ||
96 | + return true; | ||
97 | + case AST2400_A0_SILICON_REV: | ||
98 | + case AST2400_A1_SILICON_REV: | ||
99 | + default: | ||
100 | + break; | ||
101 | + } | ||
102 | + | ||
103 | + return false; | ||
104 | +} | ||
105 | + | ||
106 | static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size) | ||
107 | { | ||
108 | AspeedWDTState *s = ASPEED_WDT(opaque); | ||
109 | @@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size) | ||
110 | return 0; | ||
111 | case WDT_CTRL: | ||
112 | return s->regs[WDT_CTRL]; | ||
113 | + case WDT_RESET_WIDTH: | ||
114 | + return s->regs[WDT_RESET_WIDTH]; | ||
115 | case WDT_TIMEOUT_STATUS: | ||
116 | case WDT_TIMEOUT_CLEAR: | ||
117 | - case WDT_RESET_WDITH: | ||
118 | qemu_log_mask(LOG_UNIMP, | ||
119 | "%s: uninmplemented read at offset 0x%" HWADDR_PRIx "\n", | ||
120 | __func__, offset); | ||
121 | @@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data, | ||
122 | timer_del(s->timer); | ||
123 | } | 40 | } |
124 | break; | 41 | break; |
125 | + case WDT_RESET_WIDTH: | 42 | default: |
126 | + { | 43 | - g_assert_not_reached(); |
127 | + uint32_t property = data & WDT_POLARITY_MASK; | 44 | + qemu_log_mask(LOG_GUEST_ERROR, |
128 | + | 45 | + "%s: IRQ %d isn't active\n", __func__, irq); |
129 | + if (property && is_ast2500(s)) { | ||
130 | + if (property == WDT_ACTIVE_HIGH_MAGIC) { | ||
131 | + s->regs[WDT_RESET_WIDTH] |= WDT_RESET_WIDTH_ACTIVE_HIGH; | ||
132 | + } else if (property == WDT_ACTIVE_LOW_MAGIC) { | ||
133 | + s->regs[WDT_RESET_WIDTH] &= ~WDT_RESET_WIDTH_ACTIVE_HIGH; | ||
134 | + } else if (property == WDT_PUSH_PULL_MAGIC) { | ||
135 | + s->regs[WDT_RESET_WIDTH] |= WDT_RESET_WIDTH_PUSH_PULL; | ||
136 | + } else if (property == WDT_OPEN_DRAIN_MAGIC) { | ||
137 | + s->regs[WDT_RESET_WIDTH] &= ~WDT_RESET_WIDTH_PUSH_PULL; | ||
138 | + } | ||
139 | + } | ||
140 | + s->regs[WDT_RESET_WIDTH] &= ~s->ext_pulse_width_mask; | ||
141 | + s->regs[WDT_RESET_WIDTH] |= data & s->ext_pulse_width_mask; | ||
142 | + break; | ||
143 | + } | ||
144 | case WDT_TIMEOUT_STATUS: | ||
145 | case WDT_TIMEOUT_CLEAR: | ||
146 | - case WDT_RESET_WDITH: | ||
147 | qemu_log_mask(LOG_UNIMP, | ||
148 | "%s: uninmplemented write at offset 0x%" HWADDR_PRIx "\n", | ||
149 | __func__, offset); | ||
150 | @@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_reset(DeviceState *dev) | ||
151 | s->regs[WDT_RELOAD_VALUE] = 0x03EF1480; | ||
152 | s->regs[WDT_RESTART] = 0; | ||
153 | s->regs[WDT_CTRL] = 0; | ||
154 | + s->regs[WDT_RESET_WIDTH] = 0xFF; | ||
155 | |||
156 | timer_del(s->timer); | ||
157 | } | ||
158 | @@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) | ||
159 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
160 | AspeedWDTState *s = ASPEED_WDT(dev); | ||
161 | |||
162 | + if (!is_supported_silicon_rev(s->silicon_rev)) { | ||
163 | + error_setg(errp, "Unknown silicon revision: 0x%" PRIx32, | ||
164 | + s->silicon_rev); | ||
165 | + return; | 46 | + return; |
166 | + } | 47 | } |
167 | + | 48 | |
168 | + switch (s->silicon_rev) { | 49 | icc_drop_prio(cs, grp); |
169 | + case AST2400_A0_SILICON_REV: | ||
170 | + case AST2400_A1_SILICON_REV: | ||
171 | + s->ext_pulse_width_mask = 0xff; | ||
172 | + break; | ||
173 | + case AST2500_A0_SILICON_REV: | ||
174 | + case AST2500_A1_SILICON_REV: | ||
175 | + s->ext_pulse_width_mask = 0xfffff; | ||
176 | + break; | ||
177 | + default: | ||
178 | + g_assert_not_reached(); | ||
179 | + } | ||
180 | + | ||
181 | s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, aspeed_wdt_timer_expired, dev); | ||
182 | |||
183 | /* FIXME: This setting should be derived from the SCU hw strapping | ||
184 | @@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) | ||
185 | sysbus_init_mmio(sbd, &s->iomem); | ||
186 | } | ||
187 | |||
188 | +static Property aspeed_wdt_properties[] = { | ||
189 | + DEFINE_PROP_UINT32("silicon-rev", AspeedWDTState, silicon_rev, 0), | ||
190 | + DEFINE_PROP_END_OF_LIST(), | ||
191 | +}; | ||
192 | + | ||
193 | static void aspeed_wdt_class_init(ObjectClass *klass, void *data) | ||
194 | { | ||
195 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
196 | @@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_class_init(ObjectClass *klass, void *data) | ||
197 | dc->reset = aspeed_wdt_reset; | ||
198 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
199 | dc->vmsd = &vmstate_aspeed_wdt; | ||
200 | + dc->props = aspeed_wdt_properties; | ||
201 | } | ||
202 | |||
203 | static const TypeInfo aspeed_wdt_info = { | ||
204 | -- | 50 | -- |
205 | 2.7.4 | 51 | 2.20.1 |
206 | 52 | ||
207 | 53 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This is required to configure differences in behaviour between the | 3 | This fprintf+assert has been in place since the beginning. |
4 | AST2400 and AST2500 watchdog IPs. | 4 | It is prior to the fp_access_check, so we're still good to |
5 | raise sigill here. | ||
5 | 6 | ||
6 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | 7 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/381 |
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20210604183506.916654-2-richard.henderson@linaro.org | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@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 | hw/arm/aspeed_soc.c | 2 ++ | 14 | target/arm/translate-a64.c | 4 ++-- |
12 | 1 file changed, 2 insertions(+) | 15 | 1 file changed, 2 insertions(+), 2 deletions(-) |
13 | 16 | ||
14 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c | 17 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/aspeed_soc.c | 19 | --- a/target/arm/translate-a64.c |
17 | +++ b/hw/arm/aspeed_soc.c | 20 | +++ b/target/arm/translate-a64.c |
18 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj) | 21 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) |
19 | object_initialize(&s->wdt[i], sizeof(s->wdt[i]), TYPE_ASPEED_WDT); | 22 | case 0x7f: /* FSQRT (vector) */ |
20 | object_property_add_child(obj, "wdt[*]", OBJECT(&s->wdt[i]), NULL); | 23 | break; |
21 | qdev_set_parent_bus(DEVICE(&s->wdt[i]), sysbus_get_default()); | 24 | default: |
22 | + qdev_prop_set_uint32(DEVICE(&s->wdt[i]), "silicon-rev", | 25 | - fprintf(stderr, "%s: insn 0x%04x fpop 0x%2x\n", __func__, insn, fpop); |
23 | + sc->info->silicon_rev); | 26 | - g_assert_not_reached(); |
27 | + unallocated_encoding(s); | ||
28 | + return; | ||
24 | } | 29 | } |
25 | 30 | ||
26 | object_initialize(&s->ftgmac100, sizeof(s->ftgmac100), TYPE_FTGMAC100); | 31 | |
27 | -- | 32 | -- |
28 | 2.7.4 | 33 | 2.20.1 |
29 | 34 | ||
30 | 35 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | For "ldp x0, x1, [x0]", if the second load is on a second page and | 3 | The default of this switch is truly unreachable. |
4 | the second page is unmapped, the exception would be raised with x0 | 4 | The switch selector is 3 bits, and all 8 cases are present. |
5 | already modified. This means the instruction couldn't be restarted. | ||
6 | 5 | ||
7 | Cc: qemu-arm@nongnu.org | ||
8 | Cc: qemu-stable@nongnu.org | ||
9 | Reported-by: Andrew <andrew@fubar.geek.nz> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 20170825224833.4463-1-richard.henderson@linaro.org | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | Fixes: https://bugs.launchpad.net/qemu/+bug/1713066 | 8 | Message-id: 20210604183506.916654-3-richard.henderson@linaro.org |
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | [PMM: tweaked comment format] | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 11 | --- |
18 | target/arm/translate-a64.c | 29 +++++++++++++++++------------ | 12 | target/arm/translate-a64.c | 1 - |
19 | 1 file changed, 17 insertions(+), 12 deletions(-) | 13 | 1 file changed, 1 deletion(-) |
20 | 14 | ||
21 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
22 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/translate-a64.c | 17 | --- a/target/arm/translate-a64.c |
24 | +++ b/target/arm/translate-a64.c | 18 | +++ b/target/arm/translate-a64.c |
25 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) | 19 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_mod_imm(DisasContext *s, uint32_t insn) |
26 | } else { | ||
27 | do_fp_st(s, rt, tcg_addr, size); | ||
28 | } | 20 | } |
29 | - } else { | 21 | break; |
30 | - TCGv_i64 tcg_rt = cpu_reg(s, rt); | 22 | default: |
31 | - if (is_load) { | 23 | - fprintf(stderr, "%s: cmode_3_1: %x\n", __func__, cmode_3_1); |
32 | - do_gpr_ld(s, tcg_rt, tcg_addr, size, is_signed, false, | 24 | g_assert_not_reached(); |
33 | - false, 0, false, false); | 25 | } |
34 | - } else { | 26 | |
35 | - do_gpr_st(s, tcg_rt, tcg_addr, size, | ||
36 | - false, 0, false, false); | ||
37 | - } | ||
38 | - } | ||
39 | - tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); | ||
40 | - if (is_vector) { | ||
41 | + tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); | ||
42 | if (is_load) { | ||
43 | do_fp_ld(s, rt2, tcg_addr, size); | ||
44 | } else { | ||
45 | do_fp_st(s, rt2, tcg_addr, size); | ||
46 | } | ||
47 | } else { | ||
48 | + TCGv_i64 tcg_rt = cpu_reg(s, rt); | ||
49 | TCGv_i64 tcg_rt2 = cpu_reg(s, rt2); | ||
50 | + | ||
51 | if (is_load) { | ||
52 | + TCGv_i64 tmp = tcg_temp_new_i64(); | ||
53 | + | ||
54 | + /* Do not modify tcg_rt before recognizing any exception | ||
55 | + * from the second load. | ||
56 | + */ | ||
57 | + do_gpr_ld(s, tmp, tcg_addr, size, is_signed, false, | ||
58 | + false, 0, false, false); | ||
59 | + tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); | ||
60 | do_gpr_ld(s, tcg_rt2, tcg_addr, size, is_signed, false, | ||
61 | false, 0, false, false); | ||
62 | + | ||
63 | + tcg_gen_mov_i64(tcg_rt, tmp); | ||
64 | + tcg_temp_free_i64(tmp); | ||
65 | } else { | ||
66 | + do_gpr_st(s, tcg_rt, tcg_addr, size, | ||
67 | + false, 0, false, false); | ||
68 | + tcg_gen_addi_i64(tcg_addr, tcg_addr, 1 << size); | ||
69 | do_gpr_st(s, tcg_rt2, tcg_addr, size, | ||
70 | false, 0, false, false); | ||
71 | } | ||
72 | -- | 27 | -- |
73 | 2.7.4 | 28 | 2.20.1 |
74 | 29 | ||
75 | 30 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | This fprintf+assert has been in place since the beginning. |
4 | It is after to the fp_access_check, so we need to move the | ||
5 | check up. Fold that in to the pairwise filter. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20210604183506.916654-4-richard.henderson@linaro.org | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | --- | 12 | --- |
7 | hw/arm/armv7m.c | 4 ++-- | 13 | target/arm/translate-a64.c | 82 +++++++++++++++++++++++--------------- |
8 | hw/arm/exynos4210.c | 4 ++-- | 14 | 1 file changed, 50 insertions(+), 32 deletions(-) |
9 | hw/arm/highbank.c | 11 +++++++---- | ||
10 | hw/arm/realview.c | 6 ++++-- | ||
11 | hw/arm/vexpress.c | 6 ++++-- | ||
12 | hw/arm/xilinx_zynq.c | 14 ++++++++------ | ||
13 | 6 files changed, 27 insertions(+), 18 deletions(-) | ||
14 | 15 | ||
15 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c | 16 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
16 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/armv7m.c | 18 | --- a/target/arm/translate-a64.c |
18 | +++ b/hw/arm/armv7m.c | 19 | +++ b/target/arm/translate-a64.c |
19 | @@ -XXX,XX +XXX,XX @@ static void armv7m_instance_init(Object *obj) | 20 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same(DisasContext *s, uint32_t insn) |
20 | &error_abort); | 21 | */ |
21 | memory_region_init(&s->container, obj, "armv7m-container", UINT64_MAX); | 22 | static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) |
22 | 23 | { | |
23 | - object_initialize(&s->nvic, sizeof(s->nvic), "armv7m_nvic"); | 24 | - int opcode, fpopcode; |
24 | + object_initialize(&s->nvic, sizeof(s->nvic), TYPE_NVIC); | 25 | - int is_q, u, a, rm, rn, rd; |
25 | qdev_set_parent_bus(DEVICE(&s->nvic), sysbus_get_default()); | 26 | - int datasize, elements; |
26 | object_property_add_alias(obj, "num-irq", | 27 | - int pass; |
27 | OBJECT(&s->nvic), "num-irq", &error_abort); | 28 | + int opcode = extract32(insn, 11, 3); |
28 | @@ -XXX,XX +XXX,XX @@ DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq, | 29 | + int u = extract32(insn, 29, 1); |
29 | cpu_model = "cortex-m3"; | 30 | + int a = extract32(insn, 23, 1); |
31 | + int is_q = extract32(insn, 30, 1); | ||
32 | + int rm = extract32(insn, 16, 5); | ||
33 | + int rn = extract32(insn, 5, 5); | ||
34 | + int rd = extract32(insn, 0, 5); | ||
35 | + /* | ||
36 | + * For these floating point ops, the U, a and opcode bits | ||
37 | + * together indicate the operation. | ||
38 | + */ | ||
39 | + int fpopcode = opcode | (a << 3) | (u << 4); | ||
40 | + int datasize = is_q ? 128 : 64; | ||
41 | + int elements = datasize / 16; | ||
42 | + bool pairwise; | ||
43 | TCGv_ptr fpst; | ||
44 | - bool pairwise = false; | ||
45 | + int pass; | ||
46 | + | ||
47 | + switch (fpopcode) { | ||
48 | + case 0x0: /* FMAXNM */ | ||
49 | + case 0x1: /* FMLA */ | ||
50 | + case 0x2: /* FADD */ | ||
51 | + case 0x3: /* FMULX */ | ||
52 | + case 0x4: /* FCMEQ */ | ||
53 | + case 0x6: /* FMAX */ | ||
54 | + case 0x7: /* FRECPS */ | ||
55 | + case 0x8: /* FMINNM */ | ||
56 | + case 0x9: /* FMLS */ | ||
57 | + case 0xa: /* FSUB */ | ||
58 | + case 0xe: /* FMIN */ | ||
59 | + case 0xf: /* FRSQRTS */ | ||
60 | + case 0x13: /* FMUL */ | ||
61 | + case 0x14: /* FCMGE */ | ||
62 | + case 0x15: /* FACGE */ | ||
63 | + case 0x17: /* FDIV */ | ||
64 | + case 0x1a: /* FABD */ | ||
65 | + case 0x1c: /* FCMGT */ | ||
66 | + case 0x1d: /* FACGT */ | ||
67 | + pairwise = false; | ||
68 | + break; | ||
69 | + case 0x10: /* FMAXNMP */ | ||
70 | + case 0x12: /* FADDP */ | ||
71 | + case 0x16: /* FMAXP */ | ||
72 | + case 0x18: /* FMINNMP */ | ||
73 | + case 0x1e: /* FMINP */ | ||
74 | + pairwise = true; | ||
75 | + break; | ||
76 | + default: | ||
77 | + unallocated_encoding(s); | ||
78 | + return; | ||
79 | + } | ||
80 | |||
81 | if (!dc_isar_feature(aa64_fp16, s)) { | ||
82 | unallocated_encoding(s); | ||
83 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) | ||
84 | return; | ||
30 | } | 85 | } |
31 | 86 | ||
32 | - armv7m = qdev_create(NULL, "armv7m"); | 87 | - /* For these floating point ops, the U, a and opcode bits |
33 | + armv7m = qdev_create(NULL, TYPE_ARMV7M); | 88 | - * together indicate the operation. |
34 | qdev_prop_set_uint32(armv7m, "num-irq", num_irq); | 89 | - */ |
35 | qdev_prop_set_string(armv7m, "cpu-model", cpu_model); | 90 | - opcode = extract32(insn, 11, 3); |
36 | object_property_set_link(OBJECT(armv7m), OBJECT(get_system_memory()), | 91 | - u = extract32(insn, 29, 1); |
37 | diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c | 92 | - a = extract32(insn, 23, 1); |
38 | index XXXXXXX..XXXXXXX 100644 | 93 | - is_q = extract32(insn, 30, 1); |
39 | --- a/hw/arm/exynos4210.c | 94 | - rm = extract32(insn, 16, 5); |
40 | +++ b/hw/arm/exynos4210.c | 95 | - rn = extract32(insn, 5, 5); |
41 | @@ -XXX,XX +XXX,XX @@ | 96 | - rd = extract32(insn, 0, 5); |
42 | #include "hw/arm/arm.h" | 97 | - |
43 | #include "hw/loader.h" | 98 | - fpopcode = opcode | (a << 3) | (u << 4); |
44 | #include "hw/arm/exynos4210.h" | 99 | - datasize = is_q ? 128 : 64; |
45 | -#include "hw/sd/sd.h" | 100 | - elements = datasize / 16; |
46 | +#include "hw/sd/sdhci.h" | 101 | - |
47 | #include "hw/usb/hcd-ehci.h" | 102 | - switch (fpopcode) { |
48 | 103 | - case 0x10: /* FMAXNMP */ | |
49 | #define EXYNOS4210_CHIPID_ADDR 0x10000000 | 104 | - case 0x12: /* FADDP */ |
50 | @@ -XXX,XX +XXX,XX @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem) | 105 | - case 0x16: /* FMAXP */ |
51 | BlockBackend *blk; | 106 | - case 0x18: /* FMINNMP */ |
52 | DriveInfo *di; | 107 | - case 0x1e: /* FMINP */ |
53 | 108 | - pairwise = true; | |
54 | - dev = qdev_create(NULL, "generic-sdhci"); | 109 | - break; |
55 | + dev = qdev_create(NULL, TYPE_SYSBUS_SDHCI); | 110 | - } |
56 | qdev_prop_set_uint32(dev, "capareg", EXYNOS4210_SDHCI_CAPABILITIES); | 111 | - |
57 | qdev_init_nofail(dev); | 112 | fpst = fpstatus_ptr(FPST_FPCR_F16); |
58 | 113 | ||
59 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | 114 | if (pairwise) { |
60 | index XXXXXXX..XXXXXXX 100644 | 115 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) |
61 | --- a/hw/arm/highbank.c | 116 | gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst); |
62 | +++ b/hw/arm/highbank.c | 117 | break; |
63 | @@ -XXX,XX +XXX,XX @@ | 118 | default: |
64 | #include "exec/address-spaces.h" | 119 | - fprintf(stderr, "%s: insn 0x%04x, fpop 0x%2x @ 0x%" PRIx64 "\n", |
65 | #include "qemu/error-report.h" | 120 | - __func__, insn, fpopcode, s->pc_curr); |
66 | #include "hw/char/pl011.h" | 121 | g_assert_not_reached(); |
67 | +#include "hw/ide/ahci.h" | 122 | } |
68 | +#include "hw/cpu/a9mpcore.h" | 123 | |
69 | +#include "hw/cpu/a15mpcore.h" | ||
70 | |||
71 | #define SMP_BOOT_ADDR 0x100 | ||
72 | #define SMP_BOOT_REG 0x40 | ||
73 | @@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) | ||
74 | busdev = SYS_BUS_DEVICE(dev); | ||
75 | sysbus_mmio_map(busdev, 0, 0xfff12000); | ||
76 | |||
77 | - dev = qdev_create(NULL, "a9mpcore_priv"); | ||
78 | + dev = qdev_create(NULL, TYPE_A9MPCORE_PRIV); | ||
79 | break; | ||
80 | case CALXEDA_MIDWAY: | ||
81 | - dev = qdev_create(NULL, "a15mpcore_priv"); | ||
82 | + dev = qdev_create(NULL, TYPE_A15MPCORE_PRIV); | ||
83 | break; | ||
84 | } | ||
85 | qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); | ||
86 | @@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) | ||
87 | sysbus_connect_irq(busdev, 0, pic[18]); | ||
88 | pl011_create(0xfff36000, pic[20], serial_hds[0]); | ||
89 | |||
90 | - dev = qdev_create(NULL, "highbank-regs"); | ||
91 | + dev = qdev_create(NULL, TYPE_HIGHBANK_REGISTERS); | ||
92 | qdev_init_nofail(dev); | ||
93 | busdev = SYS_BUS_DEVICE(dev); | ||
94 | sysbus_mmio_map(busdev, 0, 0xfff3c000); | ||
95 | @@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) | ||
96 | sysbus_create_simple("pl031", 0xfff35000, pic[19]); | ||
97 | sysbus_create_simple("pl022", 0xfff39000, pic[23]); | ||
98 | |||
99 | - sysbus_create_simple("sysbus-ahci", 0xffe08000, pic[83]); | ||
100 | + sysbus_create_simple(TYPE_SYSBUS_AHCI, 0xffe08000, pic[83]); | ||
101 | |||
102 | if (nd_table[0].used) { | ||
103 | qemu_check_nic_model(&nd_table[0], "xgmac"); | ||
104 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/hw/arm/realview.c | ||
107 | +++ b/hw/arm/realview.c | ||
108 | @@ -XXX,XX +XXX,XX @@ | ||
109 | #include "exec/address-spaces.h" | ||
110 | #include "qemu/error-report.h" | ||
111 | #include "hw/char/pl011.h" | ||
112 | +#include "hw/cpu/a9mpcore.h" | ||
113 | +#include "hw/intc/realview_gic.h" | ||
114 | |||
115 | #define SMP_BOOT_ADDR 0xe0000000 | ||
116 | #define SMP_BOOTREG_ADDR 0x10000030 | ||
117 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, | ||
118 | sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, 0x10000000); | ||
119 | |||
120 | if (is_mpcore) { | ||
121 | - dev = qdev_create(NULL, is_pb ? "a9mpcore_priv": "realview_mpcore"); | ||
122 | + dev = qdev_create(NULL, is_pb ? TYPE_A9MPCORE_PRIV : "realview_mpcore"); | ||
123 | qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); | ||
124 | qdev_init_nofail(dev); | ||
125 | busdev = SYS_BUS_DEVICE(dev); | ||
126 | @@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine, | ||
127 | } else { | ||
128 | uint32_t gic_addr = is_pb ? 0x1e000000 : 0x10040000; | ||
129 | /* For now just create the nIRQ GIC, and ignore the others. */ | ||
130 | - dev = sysbus_create_simple("realview_gic", gic_addr, cpu_irq[0]); | ||
131 | + dev = sysbus_create_simple(TYPE_REALVIEW_GIC, gic_addr, cpu_irq[0]); | ||
132 | } | ||
133 | for (n = 0; n < 64; n++) { | ||
134 | pic[n] = qdev_get_gpio_in(dev, n); | ||
135 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
136 | index XXXXXXX..XXXXXXX 100644 | ||
137 | --- a/hw/arm/vexpress.c | ||
138 | +++ b/hw/arm/vexpress.c | ||
139 | @@ -XXX,XX +XXX,XX @@ | ||
140 | #include "qemu/error-report.h" | ||
141 | #include <libfdt.h> | ||
142 | #include "hw/char/pl011.h" | ||
143 | +#include "hw/cpu/a9mpcore.h" | ||
144 | +#include "hw/cpu/a15mpcore.h" | ||
145 | |||
146 | #define VEXPRESS_BOARD_ID 0x8e0 | ||
147 | #define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024) | ||
148 | @@ -XXX,XX +XXX,XX @@ static void a9_daughterboard_init(const VexpressMachineState *vms, | ||
149 | memory_region_add_subregion(sysmem, 0x60000000, ram); | ||
150 | |||
151 | /* 0x1e000000 A9MPCore (SCU) private memory region */ | ||
152 | - init_cpus(cpu_model, "a9mpcore_priv", 0x1e000000, pic, vms->secure); | ||
153 | + init_cpus(cpu_model, TYPE_A9MPCORE_PRIV, 0x1e000000, pic, vms->secure); | ||
154 | |||
155 | /* Daughterboard peripherals : 0x10020000 .. 0x20000000 */ | ||
156 | |||
157 | @@ -XXX,XX +XXX,XX @@ static void a15_daughterboard_init(const VexpressMachineState *vms, | ||
158 | memory_region_add_subregion(sysmem, 0x80000000, ram); | ||
159 | |||
160 | /* 0x2c000000 A15MPCore private memory region (GIC) */ | ||
161 | - init_cpus(cpu_model, "a15mpcore_priv", 0x2c000000, pic, vms->secure); | ||
162 | + init_cpus(cpu_model, TYPE_A15MPCORE_PRIV, 0x2c000000, pic, vms->secure); | ||
163 | |||
164 | /* A15 daughterboard peripherals: */ | ||
165 | |||
166 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c | ||
167 | index XXXXXXX..XXXXXXX 100644 | ||
168 | --- a/hw/arm/xilinx_zynq.c | ||
169 | +++ b/hw/arm/xilinx_zynq.c | ||
170 | @@ -XXX,XX +XXX,XX @@ | ||
171 | #include "hw/misc/zynq-xadc.h" | ||
172 | #include "hw/ssi/ssi.h" | ||
173 | #include "qemu/error-report.h" | ||
174 | -#include "hw/sd/sd.h" | ||
175 | +#include "hw/sd/sdhci.h" | ||
176 | #include "hw/char/cadence_uart.h" | ||
177 | +#include "hw/net/cadence_gem.h" | ||
178 | +#include "hw/cpu/a9mpcore.h" | ||
179 | |||
180 | #define NUM_SPI_FLASHES 4 | ||
181 | #define NUM_QSPI_FLASHES 2 | ||
182 | @@ -XXX,XX +XXX,XX @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq) | ||
183 | DeviceState *dev; | ||
184 | SysBusDevice *s; | ||
185 | |||
186 | - dev = qdev_create(NULL, "cadence_gem"); | ||
187 | + dev = qdev_create(NULL, TYPE_CADENCE_GEM); | ||
188 | if (nd->used) { | ||
189 | - qemu_check_nic_model(nd, "cadence_gem"); | ||
190 | + qemu_check_nic_model(nd, TYPE_CADENCE_GEM); | ||
191 | qdev_set_nic_properties(dev, nd); | ||
192 | } | ||
193 | qdev_init_nofail(dev); | ||
194 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) | ||
195 | qdev_init_nofail(dev); | ||
196 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xF8000000); | ||
197 | |||
198 | - dev = qdev_create(NULL, "a9mpcore_priv"); | ||
199 | + dev = qdev_create(NULL, TYPE_A9MPCORE_PRIV); | ||
200 | qdev_prop_set_uint32(dev, "num-cpu", 1); | ||
201 | qdev_init_nofail(dev); | ||
202 | busdev = SYS_BUS_DEVICE(dev); | ||
203 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) | ||
204 | gem_init(&nd_table[0], 0xE000B000, pic[54-IRQ_OFFSET]); | ||
205 | gem_init(&nd_table[1], 0xE000C000, pic[77-IRQ_OFFSET]); | ||
206 | |||
207 | - dev = qdev_create(NULL, "generic-sdhci"); | ||
208 | + dev = qdev_create(NULL, TYPE_SYSBUS_SDHCI); | ||
209 | qdev_init_nofail(dev); | ||
210 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0100000); | ||
211 | sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[56-IRQ_OFFSET]); | ||
212 | @@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine) | ||
213 | qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); | ||
214 | object_property_set_bool(OBJECT(carddev), true, "realized", &error_fatal); | ||
215 | |||
216 | - dev = qdev_create(NULL, "generic-sdhci"); | ||
217 | + dev = qdev_create(NULL, TYPE_SYSBUS_SDHCI); | ||
218 | qdev_init_nofail(dev); | ||
219 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xE0101000); | ||
220 | sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[79-IRQ_OFFSET]); | ||
221 | -- | 124 | -- |
222 | 2.7.4 | 125 | 2.20.1 |
223 | 126 | ||
224 | 127 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Heinrich Schuchardt <xypron.glpk@gmx.de> |
---|---|---|---|
2 | 2 | ||
3 | Move the in-kernel-irqchip test to only guard the set-irq | 3 | virt-6.0 must consider hw_compat_6_0. |
4 | stage, not the init stage of the PMU. Also add the PMU to | ||
5 | the KVM device irq line synchronization to enable its use. | ||
6 | 4 | ||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 5 | Fixes: da7e13c00b59 ("hw: add compat machines for 6.1") |
8 | Reviewed-by: Christoffer Dall <cdall@linaro.org> | 6 | Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> |
9 | Message-id: 1500471597-2517-4-git-send-email-drjones@redhat.com | 7 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Message-id: 20210610183500.54207-1-xypron.glpk@gmx.de |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | hw/arm/virt.c | 3 ++- | 11 | hw/arm/virt.c | 2 ++ |
14 | target/arm/kvm.c | 6 +++++- | 12 | 1 file changed, 2 insertions(+) |
15 | target/arm/kvm64.c | 3 +-- | ||
16 | 3 files changed, 8 insertions(+), 4 deletions(-) | ||
17 | 13 | ||
18 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 14 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/virt.c | 16 | --- a/hw/arm/virt.c |
21 | +++ b/hw/arm/virt.c | 17 | +++ b/hw/arm/virt.c |
22 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms) | 18 | @@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(6, 1) |
23 | return; | 19 | |
24 | } | 20 | static void virt_machine_6_0_options(MachineClass *mc) |
25 | if (kvm_enabled()) { | 21 | { |
26 | - if (!kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ))) { | 22 | + virt_machine_6_1_options(mc); |
27 | + if (kvm_irqchip_in_kernel() && | 23 | + compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); |
28 | + !kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ))) { | 24 | } |
29 | return; | 25 | DEFINE_VIRT_MACHINE(6, 0) |
30 | } | 26 | |
31 | if (!kvm_arm_pmu_init(cpu)) { | ||
32 | diff --git a/target/arm/kvm.c b/target/arm/kvm.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/kvm.c | ||
35 | +++ b/target/arm/kvm.c | ||
36 | @@ -XXX,XX +XXX,XX @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run) | ||
37 | switched_level &= ~KVM_ARM_DEV_EL1_PTIMER; | ||
38 | } | ||
39 | |||
40 | - /* XXX PMU IRQ is missing */ | ||
41 | + if (switched_level & KVM_ARM_DEV_PMU) { | ||
42 | + qemu_set_irq(cpu->pmu_interrupt, | ||
43 | + !!(run->s.regs.device_irq_level & KVM_ARM_DEV_PMU)); | ||
44 | + switched_level &= ~KVM_ARM_DEV_PMU; | ||
45 | + } | ||
46 | |||
47 | if (switched_level) { | ||
48 | qemu_log_mask(LOG_UNIMP, "%s: unhandled in-kernel device IRQ %x\n", | ||
49 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/target/arm/kvm64.c | ||
52 | +++ b/target/arm/kvm64.c | ||
53 | @@ -XXX,XX +XXX,XX @@ int kvm_arch_init_vcpu(CPUState *cs) | ||
54 | if (!arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
55 | cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_EL1_32BIT; | ||
56 | } | ||
57 | - if (!kvm_irqchip_in_kernel() || | ||
58 | - !kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) { | ||
59 | + if (!kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) { | ||
60 | cpu->has_pmu = false; | ||
61 | } | ||
62 | if (cpu->has_pmu) { | ||
63 | -- | 27 | -- |
64 | 2.7.4 | 28 | 2.20.1 |
65 | 29 | ||
66 | 30 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | QEMU currently shows some unexpected behavior when the user trys to | 3 | Adds initial quanta-gbs-bmc machine support. |
4 | do a "device_add digic" on an unrelated ARM machine like integratorcp | ||
5 | in "-nographic" mode (the device_add command does not immediately | ||
6 | return to the monitor prompt), and trying to "device_del" the device | ||
7 | later results in a "qemu/qdev-monitor.c:872:qdev_unplug: assertion | ||
8 | failed: (hotplug_ctrl)" error condition. | ||
9 | Looking at the realize function of the device, it uses serial_hds | ||
10 | directly and this means that the device can not be added a second | ||
11 | time, so let's simply mark it with "user_creatable = false" now. | ||
12 | 4 | ||
13 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 5 | Tested: Boots to userspace. |
6 | Signed-off-by: Patrick Venture <venture@google.com> | ||
7 | Reviewed-by: Brandon Kim <brandonkim@google.com> | ||
8 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
9 | Message-id: 20210608193605.2611114-2-venture@google.com | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 12 | --- |
17 | hw/arm/digic.c | 2 ++ | 13 | hw/arm/npcm7xx_boards.c | 33 +++++++++++++++++++++++++++++++++ |
18 | 1 file changed, 2 insertions(+) | 14 | 1 file changed, 33 insertions(+) |
19 | 15 | ||
20 | diff --git a/hw/arm/digic.c b/hw/arm/digic.c | 16 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
21 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/digic.c | 18 | --- a/hw/arm/npcm7xx_boards.c |
23 | +++ b/hw/arm/digic.c | 19 | +++ b/hw/arm/npcm7xx_boards.c |
24 | @@ -XXX,XX +XXX,XX @@ static void digic_class_init(ObjectClass *oc, void *data) | 20 | @@ -XXX,XX +XXX,XX @@ |
25 | DeviceClass *dc = DEVICE_CLASS(oc); | 21 | |
26 | 22 | #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 | |
27 | dc->realize = digic_realize; | 23 | #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff |
28 | + /* Reason: Uses serial_hds in the realize function --> not usable twice */ | 24 | +#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff |
29 | + dc->user_creatable = false; | 25 | |
26 | static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin"; | ||
27 | |||
28 | @@ -XXX,XX +XXX,XX @@ static void quanta_gsj_init(MachineState *machine) | ||
29 | npcm7xx_load_kernel(machine, soc); | ||
30 | } | 30 | } |
31 | 31 | ||
32 | static const TypeInfo digic_type_info = { | 32 | +static void quanta_gbs_init(MachineState *machine) |
33 | +{ | ||
34 | + NPCM7xxState *soc; | ||
35 | + | ||
36 | + soc = npcm7xx_create_soc(machine, QUANTA_GBS_POWER_ON_STRAPS); | ||
37 | + npcm7xx_connect_dram(soc, machine->ram); | ||
38 | + qdev_realize(DEVICE(soc), NULL, &error_fatal); | ||
39 | + | ||
40 | + npcm7xx_load_bootrom(machine, soc); | ||
41 | + | ||
42 | + npcm7xx_connect_flash(&soc->fiu[0], 0, "mx66u51235f", | ||
43 | + drive_get(IF_MTD, 0, 0)); | ||
44 | + | ||
45 | + npcm7xx_load_kernel(machine, soc); | ||
46 | +} | ||
47 | + | ||
48 | static void npcm7xx_set_soc_type(NPCM7xxMachineClass *nmc, const char *type) | ||
49 | { | ||
50 | NPCM7xxClass *sc = NPCM7XX_CLASS(object_class_by_name(type)); | ||
51 | @@ -XXX,XX +XXX,XX @@ static void gsj_machine_class_init(ObjectClass *oc, void *data) | ||
52 | mc->default_ram_size = 512 * MiB; | ||
53 | }; | ||
54 | |||
55 | +static void gbs_bmc_machine_class_init(ObjectClass *oc, void *data) | ||
56 | +{ | ||
57 | + NPCM7xxMachineClass *nmc = NPCM7XX_MACHINE_CLASS(oc); | ||
58 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
59 | + | ||
60 | + npcm7xx_set_soc_type(nmc, TYPE_NPCM730); | ||
61 | + | ||
62 | + mc->desc = "Quanta GBS (Cortex-A9)"; | ||
63 | + mc->init = quanta_gbs_init; | ||
64 | + mc->default_ram_size = 1 * GiB; | ||
65 | +} | ||
66 | + | ||
67 | static const TypeInfo npcm7xx_machine_types[] = { | ||
68 | { | ||
69 | .name = TYPE_NPCM7XX_MACHINE, | ||
70 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo npcm7xx_machine_types[] = { | ||
71 | .name = MACHINE_TYPE_NAME("quanta-gsj"), | ||
72 | .parent = TYPE_NPCM7XX_MACHINE, | ||
73 | .class_init = gsj_machine_class_init, | ||
74 | + }, { | ||
75 | + .name = MACHINE_TYPE_NAME("quanta-gbs-bmc"), | ||
76 | + .parent = TYPE_NPCM7XX_MACHINE, | ||
77 | + .class_init = gbs_bmc_machine_class_init, | ||
78 | }, | ||
79 | }; | ||
80 | |||
33 | -- | 81 | -- |
34 | 2.7.4 | 82 | 2.20.1 |
35 | 83 | ||
36 | 84 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | If a KVM PMU init or set-irq attr call fails we just silently stop | 3 | Add a comment and i2c method that describes the board layout. |
4 | the PMU DT node generation. The only way they could fail, though, | ||
5 | is if the attr's respective KVM has-attr call fails. But that should | ||
6 | never happen if KVM advertises the PMU capability, because both | ||
7 | attrs have been available since the capability was introduced. Let's | ||
8 | just abort if this should-never-happen stuff does happen, because, | ||
9 | if it does, then something is obviously horribly wrong. | ||
10 | 4 | ||
11 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 5 | Tested: firmware booted to userspace. |
12 | Reviewed-by: Christoffer Dall <cdall@linaro.org> | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
13 | Message-id: 1500471597-2517-5-git-send-email-drjones@redhat.com | 7 | Reviewed-by: Brandon Kim <brandonkim@google.com> |
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Hao Wu <wuhaotsh@google.com> |
9 | Message-id: 20210608193605.2611114-3-venture@google.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 11 | --- |
17 | target/arm/kvm_arm.h | 15 ++++----------- | 12 | hw/arm/npcm7xx_boards.c | 60 +++++++++++++++++++++++++++++++++++++++++ |
18 | hw/arm/virt.c | 9 +++------ | 13 | 1 file changed, 60 insertions(+) |
19 | target/arm/kvm32.c | 3 +-- | ||
20 | target/arm/kvm64.c | 28 ++++++++++++++++++++-------- | ||
21 | 4 files changed, 28 insertions(+), 27 deletions(-) | ||
22 | 14 | ||
23 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | 15 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
24 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/kvm_arm.h | 17 | --- a/hw/arm/npcm7xx_boards.c |
26 | +++ b/target/arm/kvm_arm.h | 18 | +++ b/hw/arm/npcm7xx_boards.c |
27 | @@ -XXX,XX +XXX,XX @@ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu); | 19 | @@ -XXX,XX +XXX,XX @@ static void quanta_gsj_fan_init(NPCM7xxMachine *machine, NPCM7xxState *soc) |
28 | 20 | npcm7xx_connect_pwm_fan(soc, &splitter[2], 0x05, 1); | |
29 | int kvm_arm_vgic_probe(void); | ||
30 | |||
31 | -int kvm_arm_pmu_set_irq(CPUState *cs, int irq); | ||
32 | -int kvm_arm_pmu_init(CPUState *cs); | ||
33 | +void kvm_arm_pmu_set_irq(CPUState *cs, int irq); | ||
34 | +void kvm_arm_pmu_init(CPUState *cs); | ||
35 | |||
36 | #else | ||
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ static inline int kvm_arm_vgic_probe(void) | ||
39 | return 0; | ||
40 | } | 21 | } |
41 | 22 | ||
42 | -static inline int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | 23 | +static void quanta_gbs_i2c_init(NPCM7xxState *soc) |
43 | -{ | 24 | +{ |
44 | - return 0; | 25 | + /* |
45 | -} | 26 | + * i2c-0: |
46 | - | 27 | + * pca9546@71 |
47 | -static inline int kvm_arm_pmu_init(CPUState *cs) | 28 | + * |
48 | -{ | 29 | + * i2c-1: |
49 | - return 0; | 30 | + * pca9535@24 |
50 | -} | 31 | + * pca9535@20 |
51 | +static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) {} | 32 | + * pca9535@21 |
52 | +static inline void kvm_arm_pmu_init(CPUState *cs) {} | 33 | + * pca9535@22 |
53 | 34 | + * pca9535@23 | |
54 | #endif | 35 | + * pca9535@25 |
55 | 36 | + * pca9535@26 | |
56 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 37 | + * |
57 | index XXXXXXX..XXXXXXX 100644 | 38 | + * i2c-2: |
58 | --- a/hw/arm/virt.c | 39 | + * sbtsi@4c |
59 | +++ b/hw/arm/virt.c | 40 | + * |
60 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms) | 41 | + * i2c-5: |
61 | return; | 42 | + * atmel,24c64@50 mb_fru |
62 | } | 43 | + * pca9546@71 |
63 | if (kvm_enabled()) { | 44 | + * - channel 0: max31725@54 |
64 | - if (kvm_irqchip_in_kernel() && | 45 | + * - channel 1: max31725@55 |
65 | - !kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ))) { | 46 | + * - channel 2: max31725@5d |
66 | - return; | 47 | + * atmel,24c64@51 fan_fru |
67 | - } | 48 | + * - channel 3: atmel,24c64@52 hsbp_fru |
68 | - if (!kvm_arm_pmu_init(cpu)) { | 49 | + * |
69 | - return; | 50 | + * i2c-6: |
70 | + if (kvm_irqchip_in_kernel()) { | 51 | + * pca9545@73 |
71 | + kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ)); | 52 | + * |
72 | } | 53 | + * i2c-7: |
73 | + kvm_arm_pmu_init(cpu); | 54 | + * pca9545@72 |
74 | } | 55 | + * |
75 | } | 56 | + * i2c-8: |
76 | 57 | + * adi,adm1272@10 | |
77 | diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c | 58 | + * |
78 | index XXXXXXX..XXXXXXX 100644 | 59 | + * i2c-9: |
79 | --- a/target/arm/kvm32.c | 60 | + * pca9546@71 |
80 | +++ b/target/arm/kvm32.c | 61 | + * - channel 0: isil,isl68137@60 |
81 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_hw_debug_active(CPUState *cs) | 62 | + * - channel 1: isil,isl68137@61 |
82 | return false; | 63 | + * - channel 2: isil,isl68137@63 |
64 | + * - channel 3: isil,isl68137@45 | ||
65 | + * | ||
66 | + * i2c-10: | ||
67 | + * pca9545@71 | ||
68 | + * | ||
69 | + * i2c-11: | ||
70 | + * pca9545@76 | ||
71 | + * | ||
72 | + * i2c-12: | ||
73 | + * maxim,max34451@4e | ||
74 | + * isil,isl68137@5d | ||
75 | + * isil,isl68137@5e | ||
76 | + * | ||
77 | + * i2c-14: | ||
78 | + * pca9545@70 | ||
79 | + */ | ||
80 | +} | ||
81 | + | ||
82 | static void npcm750_evb_init(MachineState *machine) | ||
83 | { | ||
84 | NPCM7xxState *soc; | ||
85 | @@ -XXX,XX +XXX,XX @@ static void quanta_gbs_init(MachineState *machine) | ||
86 | npcm7xx_connect_flash(&soc->fiu[0], 0, "mx66u51235f", | ||
87 | drive_get(IF_MTD, 0, 0)); | ||
88 | |||
89 | + quanta_gbs_i2c_init(soc); | ||
90 | npcm7xx_load_kernel(machine, soc); | ||
83 | } | 91 | } |
84 | 92 | ||
85 | -int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
86 | +void kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
87 | { | ||
88 | qemu_log_mask(LOG_UNIMP, "%s: not implemented\n", __func__); | ||
89 | - return 0; | ||
90 | } | ||
91 | |||
92 | int kvm_arm_pmu_init(CPUState *cs) | ||
93 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
94 | index XXXXXXX..XXXXXXX 100644 | ||
95 | --- a/target/arm/kvm64.c | ||
96 | +++ b/target/arm/kvm64.c | ||
97 | @@ -XXX,XX +XXX,XX @@ static bool kvm_arm_pmu_set_attr(CPUState *cs, struct kvm_device_attr *attr) | ||
98 | |||
99 | err = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr); | ||
100 | if (err != 0) { | ||
101 | + error_report("PMU: KVM_HAS_DEVICE_ATTR: %s", strerror(-err)); | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, attr); | ||
106 | - if (err < 0) { | ||
107 | - fprintf(stderr, "KVM_SET_DEVICE_ATTR failed: %s\n", | ||
108 | - strerror(-err)); | ||
109 | - abort(); | ||
110 | + if (err != 0) { | ||
111 | + error_report("PMU: KVM_SET_DEVICE_ATTR: %s", strerror(-err)); | ||
112 | + return false; | ||
113 | } | ||
114 | |||
115 | return true; | ||
116 | } | ||
117 | |||
118 | -int kvm_arm_pmu_init(CPUState *cs) | ||
119 | +void kvm_arm_pmu_init(CPUState *cs) | ||
120 | { | ||
121 | struct kvm_device_attr attr = { | ||
122 | .group = KVM_ARM_VCPU_PMU_V3_CTRL, | ||
123 | .attr = KVM_ARM_VCPU_PMU_V3_INIT, | ||
124 | }; | ||
125 | |||
126 | - return kvm_arm_pmu_set_attr(cs, &attr); | ||
127 | + if (!ARM_CPU(cs)->has_pmu) { | ||
128 | + return; | ||
129 | + } | ||
130 | + if (!kvm_arm_pmu_set_attr(cs, &attr)) { | ||
131 | + error_report("failed to init PMU"); | ||
132 | + abort(); | ||
133 | + } | ||
134 | } | ||
135 | |||
136 | -int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
137 | +void kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
138 | { | ||
139 | struct kvm_device_attr attr = { | ||
140 | .group = KVM_ARM_VCPU_PMU_V3_CTRL, | ||
141 | @@ -XXX,XX +XXX,XX @@ int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
142 | .attr = KVM_ARM_VCPU_PMU_V3_IRQ, | ||
143 | }; | ||
144 | |||
145 | - return kvm_arm_pmu_set_attr(cs, &attr); | ||
146 | + if (!ARM_CPU(cs)->has_pmu) { | ||
147 | + return; | ||
148 | + } | ||
149 | + if (!kvm_arm_pmu_set_attr(cs, &attr)) { | ||
150 | + error_report("failed to set irq for PMU"); | ||
151 | + abort(); | ||
152 | + } | ||
153 | } | ||
154 | |||
155 | static inline void set_feature(uint64_t *features, int feature) | ||
156 | -- | 93 | -- |
157 | 2.7.4 | 94 | 2.20.1 |
158 | 95 | ||
159 | 96 | diff view generated by jsdifflib |
1 | Remove an out of date comment which says there's only one | 1 | In commit da6d674e509f0939b we split the NVIC code out from the GIC. |
---|---|---|---|
2 | item in the NVIC container region -- we put systick into its | 2 | This allowed us to specify the NVIC's default value for the num-irq |
3 | own device object a while back and so now there are two | 3 | property (64) in the usual way in its property list, and we deleted |
4 | things in the container. | 4 | the previous hack where we updated the value in the state struct in |
5 | the instance init function. Remove a stale comment about that hack | ||
6 | which we forgot to delete at that time. | ||
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: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 1501692241-23310-6-git-send-email-peter.maydell@linaro.org | 11 | Message-id: 20210614161243.14211-1-peter.maydell@linaro.org |
10 | --- | 12 | --- |
11 | hw/intc/armv7m_nvic.c | 4 ---- | 13 | hw/intc/armv7m_nvic.c | 6 ------ |
12 | 1 file changed, 4 deletions(-) | 14 | 1 file changed, 6 deletions(-) |
13 | 15 | ||
14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 16 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
15 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/armv7m_nvic.c | 18 | --- a/hw/intc/armv7m_nvic.c |
17 | +++ b/hw/intc/armv7m_nvic.c | 19 | +++ b/hw/intc/armv7m_nvic.c |
18 | @@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp) | 20 | @@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp) |
19 | * 0xd00..0xd3c - SCS registers | 21 | |
20 | * 0xd40..0xeff - Reserved or Not implemented | 22 | static void armv7m_nvic_instance_init(Object *obj) |
21 | * 0xf00 - STIR | 23 | { |
22 | - * | 24 | - /* We have a different default value for the num-irq property |
23 | - * At the moment there is only one thing in the container region, | 25 | - * than our superclass. This function runs after qdev init |
24 | - * but we leave it in place to allow us to pull systick out into | 26 | - * has set the defaults from the Property array and before |
25 | - * its own device object later. | 27 | - * any user-specified property setting, so just modify the |
26 | */ | 28 | - * value in the GICState struct. |
27 | memory_region_init(&s->container, OBJECT(s), "nvic", 0x1000); | 29 | - */ |
28 | /* The system register region goes at the bottom of the priority | 30 | DeviceState *dev = DEVICE(obj); |
31 | NVICState *nvic = NVIC(obj); | ||
32 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
29 | -- | 33 | -- |
30 | 2.7.4 | 34 | 2.20.1 |
31 | 35 | ||
32 | 36 | diff view generated by jsdifflib |
1 | For external aborts, we will want to be able to specify the EA | 1 | Generic code in target/arm wants to call acpi_ghes_record_errors(); |
---|---|---|---|
2 | (external abort type) bit in the syndrome field. Allow callers of | 2 | provide a stub version so that we don't fail to link when |
3 | deliver_fault() to do that by adding a field to ARMMMUFaultInfo which | 3 | CONFIG_ACPI_APEI is not set. This requires us to add a new |
4 | we use when constructing the syndrome values. | 4 | ghes-stub.c file to contain it and the meson.build mechanics |
5 | to use it when appropriate. | ||
5 | 6 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 9 | Reviewed-by: Dongjiu Geng <gengdongjiu1@gmail.com> |
10 | Message-id: 20210603171259.27962-2-peter.maydell@linaro.org | ||
9 | --- | 11 | --- |
10 | target/arm/internals.h | 2 ++ | 12 | hw/acpi/ghes-stub.c | 17 +++++++++++++++++ |
11 | target/arm/op_helper.c | 10 +++++----- | 13 | hw/acpi/meson.build | 6 +++--- |
12 | 2 files changed, 7 insertions(+), 5 deletions(-) | 14 | 2 files changed, 20 insertions(+), 3 deletions(-) |
15 | create mode 100644 hw/acpi/ghes-stub.c | ||
13 | 16 | ||
14 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 17 | diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c |
18 | new file mode 100644 | ||
19 | index XXXXXXX..XXXXXXX | ||
20 | --- /dev/null | ||
21 | +++ b/hw/acpi/ghes-stub.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | +/* | ||
24 | + * Support for generating APEI tables and recording CPER for Guests: | ||
25 | + * stub functions. | ||
26 | + * | ||
27 | + * Copyright (c) 2021 Linaro, Ltd | ||
28 | + * | ||
29 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
30 | + * See the COPYING file in the top-level directory. | ||
31 | + */ | ||
32 | + | ||
33 | +#include "qemu/osdep.h" | ||
34 | +#include "hw/acpi/ghes.h" | ||
35 | + | ||
36 | +int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) | ||
37 | +{ | ||
38 | + return -1; | ||
39 | +} | ||
40 | diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build | ||
15 | index XXXXXXX..XXXXXXX 100644 | 41 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/internals.h | 42 | --- a/hw/acpi/meson.build |
17 | +++ b/target/arm/internals.h | 43 | +++ b/hw/acpi/meson.build |
18 | @@ -XXX,XX +XXX,XX @@ void arm_handle_psci_call(ARMCPU *cpu); | 44 | @@ -XXX,XX +XXX,XX @@ acpi_ss.add(when: 'CONFIG_ACPI_PCI', if_true: files('pci.c')) |
19 | * @s2addr: Address that caused a fault at stage 2 | 45 | acpi_ss.add(when: 'CONFIG_ACPI_VMGENID', if_true: files('vmgenid.c')) |
20 | * @stage2: True if we faulted at stage 2 | 46 | acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c')) |
21 | * @s1ptw: True if we faulted at stage 2 while doing a stage 1 page-table walk | 47 | acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c')) |
22 | + * @ea: True if we should set the EA (external abort type) bit in syndrome | 48 | -acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c')) |
23 | */ | 49 | +acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false:('ghes-stub.c')) |
24 | typedef struct ARMMMUFaultInfo ARMMMUFaultInfo; | 50 | acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('core.c', 'piix4.c', 'pcihp.c'), if_false: files('acpi-stub.c')) |
25 | struct ARMMMUFaultInfo { | 51 | acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) |
26 | target_ulong s2addr; | 52 | acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) |
27 | bool stage2; | 53 | acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) |
28 | bool s1ptw; | 54 | acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c')) |
29 | + bool ea; | 55 | -softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c')) |
30 | }; | 56 | +softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c')) |
31 | 57 | softmmu_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss) | |
32 | /* Do a page table walk and add page to TLB if possible */ | 58 | softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c', |
33 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 59 | - 'acpi-x86-stub.c', 'ipmi-stub.c')) |
34 | index XXXXXXX..XXXXXXX 100644 | 60 | + 'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c')) |
35 | --- a/target/arm/op_helper.c | ||
36 | +++ b/target/arm/op_helper.c | ||
37 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(neon_tbl)(CPUARMState *env, uint32_t ireg, uint32_t def, | ||
38 | |||
39 | static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
40 | unsigned int target_el, | ||
41 | - bool same_el, | ||
42 | + bool same_el, bool ea, | ||
43 | bool s1ptw, bool is_write, | ||
44 | int fsc) | ||
45 | { | ||
46 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
47 | */ | ||
48 | if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) { | ||
49 | syn = syn_data_abort_no_iss(same_el, | ||
50 | - 0, 0, s1ptw, is_write, fsc); | ||
51 | + ea, 0, s1ptw, is_write, fsc); | ||
52 | } else { | ||
53 | /* Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template | ||
54 | * syndrome created at translation time. | ||
55 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | ||
56 | */ | ||
57 | syn = syn_data_abort_with_iss(same_el, | ||
58 | 0, 0, 0, 0, 0, | ||
59 | - 0, 0, s1ptw, is_write, fsc, | ||
60 | + ea, 0, s1ptw, is_write, fsc, | ||
61 | false); | ||
62 | /* Merge the runtime syndrome with the template syndrome. */ | ||
63 | syn |= template_syn; | ||
64 | @@ -XXX,XX +XXX,XX @@ static void deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type, | ||
65 | } | ||
66 | |||
67 | if (access_type == MMU_INST_FETCH) { | ||
68 | - syn = syn_insn_abort(same_el, 0, fi->s1ptw, fsc); | ||
69 | + syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc); | ||
70 | exc = EXCP_PREFETCH_ABORT; | ||
71 | } else { | ||
72 | syn = merge_syn_data_abort(env->exception.syndrome, target_el, | ||
73 | - same_el, fi->s1ptw, | ||
74 | + same_el, fi->ea, fi->s1ptw, | ||
75 | access_type == MMU_DATA_STORE, | ||
76 | fsc); | ||
77 | if (access_type == MMU_DATA_STORE | ||
78 | -- | 61 | -- |
79 | 2.7.4 | 62 | 2.20.1 |
80 | 63 | ||
81 | 64 | diff view generated by jsdifflib |
1 | Currently we have a rather half-baked setup for allowing CPUs to | 1 | Allow code elsewhere in the system to check whether the ACPI GHES |
---|---|---|---|
2 | generate exceptions on accesses to invalid memory: the CPU has a | 2 | table is present, so it can determine whether it is OK to try to |
3 | cpu_unassigned_access() hook which the memory system calls in | 3 | record an error by calling acpi_ghes_record_errors(). |
4 | unassigned_mem_write() and unassigned_mem_read() if the current_cpu | ||
5 | pointer is non-NULL. This was originally designed before we | ||
6 | implemented the MemTxResult type that allows memory operations to | ||
7 | report a success or failure code, which is why the hook is called | ||
8 | right at the bottom of the memory system. The major problem with | ||
9 | this is that it means that the hook can be called even when the | ||
10 | access was not actually done by the CPU: for instance if the CPU | ||
11 | writes to a DMA engine register which causes the DMA engine to begin | ||
12 | a transaction which has been set up by the guest to operate on | ||
13 | invalid memory then this will casue the CPU to take an exception | ||
14 | incorrectly. Another minor problem is that currently if a device | ||
15 | returns a transaction error then this won't turn into a CPU exception | ||
16 | at all. | ||
17 | 4 | ||
18 | The right way to do this is to have allow the CPU to respond | 5 | (We don't need to migrate the new 'present' field in AcpiGhesState, |
19 | to memory system transaction failures at the point where the | 6 | because it is set once at system initialization and doesn't change.) |
20 | CPU specific code calls into the memory system. | ||
21 | |||
22 | Define a new QOM CPU method and utility function | ||
23 | cpu_transaction_failed() which is called in these cases. | ||
24 | The functionality here overlaps with the existing | ||
25 | cpu_unassigned_access() because individual target CPUs will | ||
26 | need some work to convert them to the new system. When this | ||
27 | transition is complete we can remove the old cpu_unassigned_access() | ||
28 | code. | ||
29 | 7 | ||
30 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
31 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
32 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | Reviewed-by: Dongjiu Geng <gengdongjiu1@gmail.com> |
11 | Message-id: 20210603171259.27962-3-peter.maydell@linaro.org | ||
33 | --- | 12 | --- |
34 | include/qom/cpu.h | 22 ++++++++++++++++++++++ | 13 | include/hw/acpi/ghes.h | 9 +++++++++ |
35 | 1 file changed, 22 insertions(+) | 14 | hw/acpi/ghes-stub.c | 5 +++++ |
15 | hw/acpi/ghes.c | 17 +++++++++++++++++ | ||
16 | 3 files changed, 31 insertions(+) | ||
36 | 17 | ||
37 | diff --git a/include/qom/cpu.h b/include/qom/cpu.h | 18 | diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h |
38 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/include/qom/cpu.h | 20 | --- a/include/hw/acpi/ghes.h |
40 | +++ b/include/qom/cpu.h | 21 | +++ b/include/hw/acpi/ghes.h |
41 | @@ -XXX,XX +XXX,XX @@ struct TranslationBlock; | 22 | @@ -XXX,XX +XXX,XX @@ enum { |
42 | * @has_work: Callback for checking if there is work to do. | 23 | |
43 | * @do_interrupt: Callback for interrupt handling. | 24 | typedef struct AcpiGhesState { |
44 | * @do_unassigned_access: Callback for unassigned access handling. | 25 | uint64_t ghes_addr_le; |
45 | + * (this is deprecated: new targets should use do_transaction_failed instead) | 26 | + bool present; /* True if GHES is present at all on this board */ |
46 | * @do_unaligned_access: Callback for unaligned access handling, if | 27 | } AcpiGhesState; |
47 | * the target defines #ALIGNED_ONLY. | 28 | |
48 | + * @do_transaction_failed: Callback for handling failed memory transactions | 29 | void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker); |
49 | + * (ie bus faults or external aborts; not MMU faults) | 30 | @@ -XXX,XX +XXX,XX @@ void acpi_build_hest(GArray *table_data, BIOSLinker *linker, |
50 | * @virtio_is_big_endian: Callback to return %true if a CPU which supports | 31 | void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, |
51 | * runtime configurable endianness is currently big-endian. Non-configurable | 32 | GArray *hardware_errors); |
52 | * CPUs can use the default implementation of this method. This method should | 33 | int acpi_ghes_record_errors(uint8_t notify, uint64_t error_physical_addr); |
53 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUClass { | 34 | + |
54 | void (*do_unaligned_access)(CPUState *cpu, vaddr addr, | 35 | +/** |
55 | MMUAccessType access_type, | 36 | + * acpi_ghes_present: Report whether ACPI GHES table is present |
56 | int mmu_idx, uintptr_t retaddr); | 37 | + * |
57 | + void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr, | 38 | + * Returns: true if the system has an ACPI GHES table and it is |
58 | + unsigned size, MMUAccessType access_type, | 39 | + * safe to call acpi_ghes_record_errors() to record a memory error. |
59 | + int mmu_idx, MemTxAttrs attrs, | 40 | + */ |
60 | + MemTxResult response, uintptr_t retaddr); | 41 | +bool acpi_ghes_present(void); |
61 | bool (*virtio_is_big_endian)(CPUState *cpu); | 42 | #endif |
62 | int (*memory_rw_debug)(CPUState *cpu, vaddr addr, | 43 | diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c |
63 | uint8_t *buf, int len, bool is_write); | 44 | index XXXXXXX..XXXXXXX 100644 |
64 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, | 45 | --- a/hw/acpi/ghes-stub.c |
65 | 46 | +++ b/hw/acpi/ghes-stub.c | |
66 | cc->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); | 47 | @@ -XXX,XX +XXX,XX @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) |
48 | { | ||
49 | return -1; | ||
67 | } | 50 | } |
68 | + | 51 | + |
69 | +static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr, | 52 | +bool acpi_ghes_present(void) |
70 | + vaddr addr, unsigned size, | ||
71 | + MMUAccessType access_type, | ||
72 | + int mmu_idx, MemTxAttrs attrs, | ||
73 | + MemTxResult response, | ||
74 | + uintptr_t retaddr) | ||
75 | +{ | 53 | +{ |
76 | + CPUClass *cc = CPU_GET_CLASS(cpu); | 54 | + return false; |
55 | +} | ||
56 | diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/hw/acpi/ghes.c | ||
59 | +++ b/hw/acpi/ghes.c | ||
60 | @@ -XXX,XX +XXX,XX @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, | ||
61 | /* Create a read-write fw_cfg file for Address */ | ||
62 | fw_cfg_add_file_callback(s, ACPI_GHES_DATA_ADDR_FW_CFG_FILE, NULL, NULL, | ||
63 | NULL, &(ags->ghes_addr_le), sizeof(ags->ghes_addr_le), false); | ||
77 | + | 64 | + |
78 | + if (cc->do_transaction_failed) { | 65 | + ags->present = true; |
79 | + cc->do_transaction_failed(cpu, physaddr, addr, size, access_type, | 66 | } |
80 | + mmu_idx, attrs, response, retaddr); | 67 | |
68 | int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) | ||
69 | @@ -XXX,XX +XXX,XX @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) | ||
70 | |||
71 | return ret; | ||
72 | } | ||
73 | + | ||
74 | +bool acpi_ghes_present(void) | ||
75 | +{ | ||
76 | + AcpiGedState *acpi_ged_state; | ||
77 | + AcpiGhesState *ags; | ||
78 | + | ||
79 | + acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, | ||
80 | + NULL)); | ||
81 | + | ||
82 | + if (!acpi_ged_state) { | ||
83 | + return false; | ||
81 | + } | 84 | + } |
85 | + ags = &acpi_ged_state->ghes_state; | ||
86 | + return ags->present; | ||
82 | +} | 87 | +} |
83 | #endif | ||
84 | |||
85 | #endif /* NEED_CPU_H */ | ||
86 | -- | 88 | -- |
87 | 2.7.4 | 89 | 2.20.1 |
88 | 90 | ||
89 | 91 | diff view generated by jsdifflib |
1 | Move the MemTxResult type to memattrs.h. We're going to want to | 1 | The virt_is_acpi_enabled() function is specific to the virt board, as |
---|---|---|---|
2 | use it in cpu/qom.h, which doesn't want to include all of | 2 | is the check for its 'ras' property. Use the new acpi_ghes_present() |
3 | memory.h. In practice MemTxResult and MemTxAttrs are pretty | 3 | function to check whether we should report memory errors via |
4 | closely linked since both are used for the new-style | 4 | acpi_ghes_record_errors(). |
5 | read_with_attrs and write_with_attrs callbacks, so memattrs.h | 5 | |
6 | is a reasonable home for this rather than creating a whole | 6 | This avoids a link error if QEMU was built without support for the |
7 | new header file for it. | 7 | virt board, and provides a mechanism that can be used by any future |
8 | board models that want to add ACPI memory error reporting support | ||
9 | (they only need to call acpi_ghes_add_fw_cfg()). | ||
8 | 10 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 13 | Reviewed-by: Dongjiu Geng <gengdongjiu1@gmail.com> |
12 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | 14 | Message-id: 20210603171259.27962-4-peter.maydell@linaro.org |
13 | --- | 15 | --- |
14 | include/exec/memattrs.h | 10 ++++++++++ | 16 | target/arm/kvm64.c | 6 +----- |
15 | include/exec/memory.h | 10 ---------- | 17 | 1 file changed, 1 insertion(+), 5 deletions(-) |
16 | 2 files changed, 10 insertions(+), 10 deletions(-) | ||
17 | 18 | ||
18 | diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h | 19 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c |
19 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/exec/memattrs.h | 21 | --- a/target/arm/kvm64.c |
21 | +++ b/include/exec/memattrs.h | 22 | +++ b/target/arm/kvm64.c |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct MemTxAttrs { | 23 | @@ -XXX,XX +XXX,XX @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) |
23 | */ | 24 | { |
24 | #define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = 1 }) | 25 | ram_addr_t ram_addr; |
25 | 26 | hwaddr paddr; | |
26 | +/* New-style MMIO accessors can indicate that the transaction failed. | 27 | - Object *obj = qdev_get_machine(); |
27 | + * A zero (MEMTX_OK) response means success; anything else is a failure | 28 | - VirtMachineState *vms = VIRT_MACHINE(obj); |
28 | + * of some kind. The memory subsystem will bitwise-OR together results | 29 | - bool acpi_enabled = virt_is_acpi_enabled(vms); |
29 | + * if it is synthesizing an operation from multiple smaller accesses. | 30 | |
30 | + */ | 31 | assert(code == BUS_MCEERR_AR || code == BUS_MCEERR_AO); |
31 | +#define MEMTX_OK 0 | 32 | |
32 | +#define MEMTX_ERROR (1U << 0) /* device returned an error */ | 33 | - if (acpi_enabled && addr && |
33 | +#define MEMTX_DECODE_ERROR (1U << 1) /* nothing at that address */ | 34 | - object_property_get_bool(obj, "ras", NULL)) { |
34 | +typedef uint32_t MemTxResult; | 35 | + if (acpi_ghes_present() && addr) { |
35 | + | 36 | ram_addr = qemu_ram_addr_from_host(addr); |
36 | #endif | 37 | if (ram_addr != RAM_ADDR_INVALID && |
37 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 38 | kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)) { |
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/include/exec/memory.h | ||
40 | +++ b/include/exec/memory.h | ||
41 | @@ -XXX,XX +XXX,XX @@ static inline void iommu_notifier_init(IOMMUNotifier *n, IOMMUNotify fn, | ||
42 | n->end = end; | ||
43 | } | ||
44 | |||
45 | -/* New-style MMIO accessors can indicate that the transaction failed. | ||
46 | - * A zero (MEMTX_OK) response means success; anything else is a failure | ||
47 | - * of some kind. The memory subsystem will bitwise-OR together results | ||
48 | - * if it is synthesizing an operation from multiple smaller accesses. | ||
49 | - */ | ||
50 | -#define MEMTX_OK 0 | ||
51 | -#define MEMTX_ERROR (1U << 0) /* device returned an error */ | ||
52 | -#define MEMTX_DECODE_ERROR (1U << 1) /* nothing at that address */ | ||
53 | -typedef uint32_t MemTxResult; | ||
54 | - | ||
55 | /* | ||
56 | * Memory region callbacks | ||
57 | */ | ||
58 | -- | 39 | -- |
59 | 2.7.4 | 40 | 2.20.1 |
60 | 41 | ||
61 | 42 | diff view generated by jsdifflib |
1 | From: Pranith Kumar <bobby.prani@gmail.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Fix the following warning: | 3 | The test was off-by-one, because tag_last points to the |
4 | last byte of the tag to check, thus tag_last - prev_page | ||
5 | will equal TARGET_PAGE_SIZE when we use the first byte | ||
6 | of the next page. | ||
4 | 7 | ||
5 | /home/pranith/qemu/hw/intc/arm_gicv3_kvm.c:296:17: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses] | 8 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/403 |
6 | if (!c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS) { | 9 | Reported-by: Peter Collingbourne <pcc@google.com> |
7 | ^ ~ | 10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | /home/pranith/qemu/hw/intc/arm_gicv3_kvm.c:296:17: note: add parentheses after the '!' to evaluate the bitwise operator first | 11 | Message-id: 20210612195707.840217-1-richard.henderson@linaro.org |
9 | if (!c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS) { | ||
10 | ^ | ||
11 | /home/pranith/qemu/hw/intc/arm_gicv3_kvm.c:296:17: note: add parentheses around left hand side expression to silence this warning | ||
12 | if (!c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS) { | ||
13 | ^ | ||
14 | |||
15 | This logic error meant we were not setting the PTZ | ||
16 | bit when we should -- luckily as the comment suggests | ||
17 | this wouldn't have had any effects beyond making GIC | ||
18 | initialization take a little longer. | ||
19 | |||
20 | Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> | ||
21 | Message-id: 20170829173226.7625-1-bobby.prani@gmail.com | ||
22 | Cc: qemu-stable@nongnu.org | ||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 14 | --- |
26 | hw/intc/arm_gicv3_kvm.c | 2 +- | 15 | target/arm/mte_helper.c | 2 +- |
27 | 1 file changed, 1 insertion(+), 1 deletion(-) | 16 | tests/tcg/aarch64/mte-7.c | 31 +++++++++++++++++++++++++++++++ |
17 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
18 | 3 files changed, 33 insertions(+), 2 deletions(-) | ||
19 | create mode 100644 tests/tcg/aarch64/mte-7.c | ||
28 | 20 | ||
29 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | 21 | diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c |
30 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/intc/arm_gicv3_kvm.c | 23 | --- a/target/arm/mte_helper.c |
32 | +++ b/hw/intc/arm_gicv3_kvm.c | 24 | +++ b/target/arm/mte_helper.c |
33 | @@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_put(GICv3State *s) | 25 | @@ -XXX,XX +XXX,XX @@ static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr, |
34 | kvm_gicr_access(s, GICR_PROPBASER + 4, ncpu, ®h, true); | 26 | prev_page = ptr & TARGET_PAGE_MASK; |
35 | 27 | next_page = prev_page + TARGET_PAGE_SIZE; | |
36 | reg64 = c->gicr_pendbaser; | 28 | |
37 | - if (!c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS) { | 29 | - if (likely(tag_last - prev_page <= TARGET_PAGE_SIZE)) { |
38 | + if (!(c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS)) { | 30 | + if (likely(tag_last - prev_page < TARGET_PAGE_SIZE)) { |
39 | /* Setting PTZ is advised if LPIs are disabled, to reduce | 31 | /* Memory access stays on one page. */ |
40 | * GIC initialization time. | 32 | tag_size = ((tag_byte_last - tag_byte_first) / (2 * TAG_GRANULE)) + 1; |
41 | */ | 33 | mem1 = allocation_tag_mem(env, mmu_idx, ptr, type, sizem1 + 1, |
34 | diff --git a/tests/tcg/aarch64/mte-7.c b/tests/tcg/aarch64/mte-7.c | ||
35 | new file mode 100644 | ||
36 | index XXXXXXX..XXXXXXX | ||
37 | --- /dev/null | ||
38 | +++ b/tests/tcg/aarch64/mte-7.c | ||
39 | @@ -XXX,XX +XXX,XX @@ | ||
40 | +/* | ||
41 | + * Memory tagging, unaligned access crossing pages. | ||
42 | + * https://gitlab.com/qemu-project/qemu/-/issues/403 | ||
43 | + * | ||
44 | + * Copyright (c) 2021 Linaro Ltd | ||
45 | + * SPDX-License-Identifier: GPL-2.0-or-later | ||
46 | + */ | ||
47 | + | ||
48 | +#include "mte.h" | ||
49 | + | ||
50 | +int main(int ac, char **av) | ||
51 | +{ | ||
52 | + void *p; | ||
53 | + | ||
54 | + enable_mte(PR_MTE_TCF_SYNC); | ||
55 | + p = alloc_mte_mem(2 * 0x1000); | ||
56 | + | ||
57 | + /* Tag the pointer. */ | ||
58 | + p = (void *)((unsigned long)p | (1ul << 56)); | ||
59 | + | ||
60 | + /* Store tag in sequential granules. */ | ||
61 | + asm("stg %0, [%0]" : : "r"(p + 0x0ff0)); | ||
62 | + asm("stg %0, [%0]" : : "r"(p + 0x1000)); | ||
63 | + | ||
64 | + /* | ||
65 | + * Perform an unaligned store with tag 1 crossing the pages. | ||
66 | + * Failure dies with SIGSEGV. | ||
67 | + */ | ||
68 | + asm("str %0, [%0]" : : "r"(p + 0x0ffc)); | ||
69 | + return 0; | ||
70 | +} | ||
71 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/tests/tcg/aarch64/Makefile.target | ||
74 | +++ b/tests/tcg/aarch64/Makefile.target | ||
75 | @@ -XXX,XX +XXX,XX @@ AARCH64_TESTS += bti-2 | ||
76 | |||
77 | # MTE Tests | ||
78 | ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_MTE),) | ||
79 | -AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 | ||
80 | +AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 mte-7 | ||
81 | mte-%: CFLAGS += -march=armv8.5-a+memtag | ||
82 | endif | ||
83 | |||
42 | -- | 84 | -- |
43 | 2.7.4 | 85 | 2.20.1 |
44 | 86 | ||
45 | 87 | diff view generated by jsdifflib |
1 | Define a new MachineClass field ignore_memory_transaction_failures. | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | If this is flag is true then the CPU will ignore memory transaction | ||
3 | failures which should cause the CPU to take an exception due to an | ||
4 | access to an unassigned physical address; the transaction will | ||
5 | instead return zero (for a read) or be ignored (for a write). This | ||
6 | should be set only by legacy board models which rely on the old | ||
7 | RAZ/WI behaviour for handling devices that QEMU does not yet model. | ||
8 | New board models should instead use "unimplemented-device" for all | ||
9 | memory ranges where the guest will attempt to probe for a device that | ||
10 | QEMU doesn't implement and a stub device is required. | ||
11 | 2 | ||
12 | We need this for ARM boards, where we're about to implement support for | 3 | Adds comments to the board init to identify missing i2c devices. |
13 | generating external aborts on memory transaction failures. Too many | ||
14 | of our legacy board models rely on the RAZ/WI behaviour and we | ||
15 | would break currently working guests when their "probe for device" | ||
16 | code provoked an external abort rather than a RAZ. | ||
17 | 4 | ||
5 | Signed-off-by: Patrick Venture <venture@google.com> | ||
6 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
7 | Reviewed-by: Joel Stanley <joel@jms.id.au> | ||
8 | Message-id: 20210608202522.2677850-2-venture@google.com | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 10 | --- |
20 | include/hw/boards.h | 11 +++++++++++ | 11 | hw/arm/npcm7xx_boards.c | 16 +++++++++++++++- |
21 | include/qom/cpu.h | 7 ++++++- | 12 | 1 file changed, 15 insertions(+), 1 deletion(-) |
22 | qom/cpu.c | 7 +++++++ | ||
23 | 3 files changed, 24 insertions(+), 1 deletion(-) | ||
24 | 13 | ||
25 | diff --git a/include/hw/boards.h b/include/hw/boards.h | 14 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
26 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/include/hw/boards.h | 16 | --- a/hw/arm/npcm7xx_boards.c |
28 | +++ b/include/hw/boards.h | 17 | +++ b/hw/arm/npcm7xx_boards.c |
29 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 18 | @@ -XXX,XX +XXX,XX @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc) |
30 | * size than the target architecture's minimum. (Attempting to create | 19 | at24c_eeprom_init(soc, 9, 0x55, 8192); |
31 | * such a CPU will fail.) Note that changing this is a migration | 20 | at24c_eeprom_init(soc, 10, 0x55, 8192); |
32 | * compatibility break for the machine. | 21 | |
33 | + * @ignore_memory_transaction_failures: | 22 | - /* TODO: Add additional i2c devices. */ |
34 | + * If this is flag is true then the CPU will ignore memory transaction | 23 | + /* |
35 | + * failures which should cause the CPU to take an exception due to an | 24 | + * i2c-11: |
36 | + * access to an unassigned physical address; the transaction will instead | 25 | + * - power-brick@36: delta,dps800 |
37 | + * return zero (for a read) or be ignored (for a write). This should be | 26 | + * - hotswap@15: ti,lm5066i |
38 | + * set only by legacy board models which rely on the old RAZ/WI behaviour | 27 | + */ |
39 | + * for handling devices that QEMU does not yet model. New board models | ||
40 | + * should instead use "unimplemented-device" for all memory ranges where | ||
41 | + * the guest will attempt to probe for a device that QEMU doesn't | ||
42 | + * implement and a stub device is required. | ||
43 | */ | ||
44 | struct MachineClass { | ||
45 | /*< private >*/ | ||
46 | @@ -XXX,XX +XXX,XX @@ struct MachineClass { | ||
47 | bool rom_file_has_mr; | ||
48 | int minimum_page_bits; | ||
49 | bool has_hotpluggable_cpus; | ||
50 | + bool ignore_memory_transaction_failures; | ||
51 | int numa_mem_align_shift; | ||
52 | void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes, | ||
53 | int nb_nodes, ram_addr_t size); | ||
54 | diff --git a/include/qom/cpu.h b/include/qom/cpu.h | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/include/qom/cpu.h | ||
57 | +++ b/include/qom/cpu.h | ||
58 | @@ -XXX,XX +XXX,XX @@ struct qemu_work_item; | ||
59 | * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes | ||
60 | * to @trace_dstate). | ||
61 | * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask). | ||
62 | + * @ignore_memory_transaction_failures: Cached copy of the MachineState | ||
63 | + * flag of the same name: allows the board to suppress calling of the | ||
64 | + * CPU do_transaction_failed hook function. | ||
65 | * | ||
66 | * State of one CPU core or thread. | ||
67 | */ | ||
68 | @@ -XXX,XX +XXX,XX @@ struct CPUState { | ||
69 | */ | ||
70 | bool throttle_thread_scheduled; | ||
71 | |||
72 | + bool ignore_memory_transaction_failures; | ||
73 | + | 28 | + |
74 | /* Note that this is accessed at the start of every TB via a negative | 29 | + /* |
75 | offset from AREG0. Leave this field at the end so as to make the | 30 | + * i2c-12: |
76 | (absolute value) offset as small as possible. This reduces code | 31 | + * - ucd90160@6b |
77 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr, | 32 | + */ |
78 | { | ||
79 | CPUClass *cc = CPU_GET_CLASS(cpu); | ||
80 | |||
81 | - if (cc->do_transaction_failed) { | ||
82 | + if (!cpu->ignore_memory_transaction_failures && cc->do_transaction_failed) { | ||
83 | cc->do_transaction_failed(cpu, physaddr, addr, size, access_type, | ||
84 | mmu_idx, attrs, response, retaddr); | ||
85 | } | ||
86 | diff --git a/qom/cpu.c b/qom/cpu.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/qom/cpu.c | ||
89 | +++ b/qom/cpu.c | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | #include "exec/cpu-common.h" | ||
92 | #include "qemu/error-report.h" | ||
93 | #include "sysemu/sysemu.h" | ||
94 | +#include "hw/boards.h" | ||
95 | #include "hw/qdev-properties.h" | ||
96 | #include "trace-root.h" | ||
97 | |||
98 | @@ -XXX,XX +XXX,XX @@ static void cpu_common_parse_features(const char *typename, char *features, | ||
99 | static void cpu_common_realizefn(DeviceState *dev, Error **errp) | ||
100 | { | ||
101 | CPUState *cpu = CPU(dev); | ||
102 | + Object *machine = qdev_get_machine(); | ||
103 | + ObjectClass *oc = object_get_class(machine); | ||
104 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
105 | + | 33 | + |
106 | + cpu->ignore_memory_transaction_failures = | 34 | + /* |
107 | + mc->ignore_memory_transaction_failures; | 35 | + * i2c-15: |
108 | 36 | + * - pca9548@75 | |
109 | if (dev->hotplugged) { | 37 | + */ |
110 | cpu_synchronize_post_init(cpu); | 38 | } |
39 | |||
40 | static void quanta_gsj_fan_init(NPCM7xxMachine *machine, NPCM7xxState *soc) | ||
111 | -- | 41 | -- |
112 | 2.7.4 | 42 | 2.20.1 |
113 | 43 | ||
114 | 44 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | QEMU currently aborts if the user is accidentially trying to | 3 | Tested: Quanta-gsj firmware booted. |
4 | do something like this: | ||
5 | 4 | ||
6 | $ aarch64-softmmu/qemu-system-aarch64 -S -M integratorcp -nographic | 5 | i2c /dev entries driver |
7 | QEMU 2.9.93 monitor - type 'help' for more information | 6 | I2C init bus 1 freq 100000 |
8 | (qemu) device_add ast2400 | 7 | I2C init bus 2 freq 100000 |
9 | Unexpected error in error_set_from_qdev_prop_error() | 8 | I2C init bus 3 freq 100000 |
10 | at hw/core/qdev-properties.c:1032: | 9 | I2C init bus 4 freq 100000 |
11 | Aborted (core dumped) | 10 | I2C init bus 8 freq 100000 |
11 | I2C init bus 9 freq 100000 | ||
12 | at24 9-0055: 8192 byte 24c64 EEPROM, writable, 1 bytes/write | ||
13 | I2C init bus 10 freq 100000 | ||
14 | at24 10-0055: 8192 byte 24c64 EEPROM, writable, 1 bytes/write | ||
15 | I2C init bus 12 freq 100000 | ||
16 | I2C init bus 15 freq 100000 | ||
17 | i2c i2c-15: Added multiplexed i2c bus 16 | ||
18 | i2c i2c-15: Added multiplexed i2c bus 17 | ||
19 | i2c i2c-15: Added multiplexed i2c bus 18 | ||
20 | i2c i2c-15: Added multiplexed i2c bus 19 | ||
21 | i2c i2c-15: Added multiplexed i2c bus 20 | ||
22 | i2c i2c-15: Added multiplexed i2c bus 21 | ||
23 | i2c i2c-15: Added multiplexed i2c bus 22 | ||
24 | i2c i2c-15: Added multiplexed i2c bus 23 | ||
25 | pca954x 15-0075: registered 8 multiplexed busses for I2C switch pca9548 | ||
12 | 26 | ||
13 | The ast2400 SoC devices are clearly not creatable by the user since | 27 | Signed-off-by: Patrick Venture <venture@google.com> |
14 | they are using the serial_hds and nd_table arrays directly in their | 28 | Reviewed-by: Hao Wu <wuhaotsh@google.com> |
15 | realize function, so mark them with user_creatable = false. | 29 | Reviewed-by: Joel Stanley <joel@jms.id.au> |
16 | 30 | Message-id: 20210608202522.2677850-3-venture@google.com | |
17 | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 31 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | --- | 32 | --- |
22 | hw/arm/aspeed_soc.c | 2 ++ | 33 | hw/arm/npcm7xx_boards.c | 6 ++---- |
23 | 1 file changed, 2 insertions(+) | 34 | hw/arm/Kconfig | 1 + |
35 | 2 files changed, 3 insertions(+), 4 deletions(-) | ||
24 | 36 | ||
25 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c | 37 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
26 | index XXXXXXX..XXXXXXX 100644 | 38 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/hw/arm/aspeed_soc.c | 39 | --- a/hw/arm/npcm7xx_boards.c |
28 | +++ b/hw/arm/aspeed_soc.c | 40 | +++ b/hw/arm/npcm7xx_boards.c |
29 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data) | 41 | @@ -XXX,XX +XXX,XX @@ |
30 | 42 | ||
31 | sc->info = (AspeedSoCInfo *) data; | 43 | #include "hw/arm/npcm7xx.h" |
32 | dc->realize = aspeed_soc_realize; | 44 | #include "hw/core/cpu.h" |
33 | + /* Reason: Uses serial_hds and nd_table in realize() directly */ | 45 | +#include "hw/i2c/i2c_mux_pca954x.h" |
34 | + dc->user_creatable = false; | 46 | #include "hw/i2c/smbus_eeprom.h" |
47 | #include "hw/loader.h" | ||
48 | #include "hw/qdev-core.h" | ||
49 | @@ -XXX,XX +XXX,XX @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc) | ||
50 | * - ucd90160@6b | ||
51 | */ | ||
52 | |||
53 | - /* | ||
54 | - * i2c-15: | ||
55 | - * - pca9548@75 | ||
56 | - */ | ||
57 | + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 15), "pca9548", 0x75); | ||
35 | } | 58 | } |
36 | 59 | ||
37 | static const TypeInfo aspeed_soc_type_info = { | 60 | static void quanta_gsj_fan_init(NPCM7xxMachine *machine, NPCM7xxState *soc) |
61 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
62 | index XXXXXXX..XXXXXXX 100644 | ||
63 | --- a/hw/arm/Kconfig | ||
64 | +++ b/hw/arm/Kconfig | ||
65 | @@ -XXX,XX +XXX,XX @@ config NPCM7XX | ||
66 | select SERIAL | ||
67 | select SSI | ||
68 | select UNIMP | ||
69 | + select PCA954X | ||
70 | |||
71 | config FSL_IMX25 | ||
72 | bool | ||
38 | -- | 73 | -- |
39 | 2.7.4 | 74 | 2.20.1 |
40 | 75 | ||
41 | 76 | diff view generated by jsdifflib |
1 | Set the MachineClass flag ignore_memory_transaction_failures | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | for almost all ARM boards. This means they retain the legacy | ||
3 | behaviour that accesses to unimplemented addresses will RAZ/WI | ||
4 | rather than aborting, when a subsequent commit adds support | ||
5 | for external aborts. | ||
6 | 2 | ||
7 | The exceptions are: | 3 | Adds the pca954x muxes expected. |
8 | * virt -- we know that guests won't try to prod devices | ||
9 | that we don't describe in the device tree or ACPI tables | ||
10 | * mps2 -- this board was written to use unimplemented-device | ||
11 | for all the ranges with devices we don't yet handle | ||
12 | 4 | ||
13 | New boards should not set the flag, but instead be written | 5 | Tested: Booted quanta-q71l image to userspace. |
14 | like the mps2. | 6 | Signed-off-by: Patrick Venture <venture@google.com> |
15 | 7 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | |
8 | Reviewed-by: Joel Stanley <joel@jms.id.au> | ||
9 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
10 | Message-id: 20210608202522.2677850-4-venture@google.com | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | For the Xilinx boards: | ||
18 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
19 | --- | 12 | --- |
20 | hw/arm/aspeed.c | 3 +++ | 13 | hw/arm/aspeed.c | 11 ++++++++--- |
21 | hw/arm/collie.c | 1 + | 14 | hw/arm/Kconfig | 1 + |
22 | hw/arm/cubieboard.c | 1 + | 15 | 2 files changed, 9 insertions(+), 3 deletions(-) |
23 | hw/arm/digic_boards.c | 1 + | ||
24 | hw/arm/exynos4_boards.c | 2 ++ | ||
25 | hw/arm/gumstix.c | 2 ++ | ||
26 | hw/arm/highbank.c | 2 ++ | ||
27 | hw/arm/imx25_pdk.c | 1 + | ||
28 | hw/arm/integratorcp.c | 1 + | ||
29 | hw/arm/kzm.c | 1 + | ||
30 | hw/arm/mainstone.c | 1 + | ||
31 | hw/arm/musicpal.c | 1 + | ||
32 | hw/arm/netduino2.c | 1 + | ||
33 | hw/arm/nseries.c | 2 ++ | ||
34 | hw/arm/omap_sx1.c | 2 ++ | ||
35 | hw/arm/palm.c | 1 + | ||
36 | hw/arm/raspi.c | 1 + | ||
37 | hw/arm/realview.c | 4 ++++ | ||
38 | hw/arm/sabrelite.c | 1 + | ||
39 | hw/arm/spitz.c | 4 ++++ | ||
40 | hw/arm/stellaris.c | 2 ++ | ||
41 | hw/arm/tosa.c | 1 + | ||
42 | hw/arm/versatilepb.c | 2 ++ | ||
43 | hw/arm/vexpress.c | 1 + | ||
44 | hw/arm/xilinx_zynq.c | 1 + | ||
45 | hw/arm/xlnx-ep108.c | 2 ++ | ||
46 | hw/arm/z2.c | 1 + | ||
47 | 27 files changed, 43 insertions(+) | ||
48 | 16 | ||
49 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 17 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c |
50 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/hw/arm/aspeed.c | 19 | --- a/hw/arm/aspeed.c |
52 | +++ b/hw/arm/aspeed.c | 20 | +++ b/hw/arm/aspeed.c |
53 | @@ -XXX,XX +XXX,XX @@ static void palmetto_bmc_class_init(ObjectClass *oc, void *data) | 21 | @@ -XXX,XX +XXX,XX @@ |
54 | mc->no_floppy = 1; | 22 | #include "hw/arm/boot.h" |
55 | mc->no_cdrom = 1; | 23 | #include "hw/arm/aspeed.h" |
56 | mc->no_parallel = 1; | 24 | #include "hw/arm/aspeed_soc.h" |
57 | + mc->ignore_memory_transaction_failures = true; | 25 | +#include "hw/i2c/i2c_mux_pca954x.h" |
26 | #include "hw/i2c/smbus_eeprom.h" | ||
27 | #include "hw/misc/pca9552.h" | ||
28 | #include "hw/misc/tmp105.h" | ||
29 | @@ -XXX,XX +XXX,XX @@ static void quanta_q71l_bmc_i2c_init(AspeedMachineState *bmc) | ||
30 | /* TODO: i2c-1: Add Frontpanel FRU eeprom@57 24c64 */ | ||
31 | /* TODO: Add Memory Riser i2c mux and eeproms. */ | ||
32 | |||
33 | - /* TODO: i2c-2: pca9546@74 */ | ||
34 | - /* TODO: i2c-2: pca9548@77 */ | ||
35 | + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "pca9546", 0x74); | ||
36 | + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "pca9548", 0x77); | ||
37 | + | ||
38 | /* TODO: i2c-3: Add BIOS FRU eeprom@56 24c64 */ | ||
39 | - /* TODO: i2c-7: Add pca9546@70 */ | ||
40 | + | ||
41 | + /* i2c-7 */ | ||
42 | + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), "pca9546", 0x70); | ||
43 | /* - i2c@0: pmbus@59 */ | ||
44 | /* - i2c@1: pmbus@58 */ | ||
45 | /* - i2c@2: pmbus@58 */ | ||
46 | /* - i2c@3: pmbus@59 */ | ||
47 | + | ||
48 | /* TODO: i2c-7: Add PDB FRU eeprom@52 */ | ||
49 | /* TODO: i2c-8: Add BMC FRU eeprom@50 */ | ||
58 | } | 50 | } |
59 | 51 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | |
60 | static const TypeInfo palmetto_bmc_type = { | ||
61 | @@ -XXX,XX +XXX,XX @@ static void ast2500_evb_class_init(ObjectClass *oc, void *data) | ||
62 | mc->no_floppy = 1; | ||
63 | mc->no_cdrom = 1; | ||
64 | mc->no_parallel = 1; | ||
65 | + mc->ignore_memory_transaction_failures = true; | ||
66 | } | ||
67 | |||
68 | static const TypeInfo ast2500_evb_type = { | ||
69 | @@ -XXX,XX +XXX,XX @@ static void romulus_bmc_class_init(ObjectClass *oc, void *data) | ||
70 | mc->no_floppy = 1; | ||
71 | mc->no_cdrom = 1; | ||
72 | mc->no_parallel = 1; | ||
73 | + mc->ignore_memory_transaction_failures = true; | ||
74 | } | ||
75 | |||
76 | static const TypeInfo romulus_bmc_type = { | ||
77 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | 52 | index XXXXXXX..XXXXXXX 100644 |
79 | --- a/hw/arm/collie.c | 53 | --- a/hw/arm/Kconfig |
80 | +++ b/hw/arm/collie.c | 54 | +++ b/hw/arm/Kconfig |
81 | @@ -XXX,XX +XXX,XX @@ static void collie_machine_init(MachineClass *mc) | 55 | @@ -XXX,XX +XXX,XX @@ config ASPEED_SOC |
82 | { | 56 | select PCA9552 |
83 | mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)"; | 57 | select SERIAL |
84 | mc->init = collie_init; | 58 | select SMBUS_EEPROM |
85 | + mc->ignore_memory_transaction_failures = true; | 59 | + select PCA954X |
86 | } | 60 | select SSI |
87 | 61 | select SSI_M25P80 | |
88 | DEFINE_MACHINE("collie", collie_machine_init) | 62 | select TMP105 |
89 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/hw/arm/cubieboard.c | ||
92 | +++ b/hw/arm/cubieboard.c | ||
93 | @@ -XXX,XX +XXX,XX @@ static void cubieboard_machine_init(MachineClass *mc) | ||
94 | mc->init = cubieboard_init; | ||
95 | mc->block_default_type = IF_IDE; | ||
96 | mc->units_per_default_bus = 1; | ||
97 | + mc->ignore_memory_transaction_failures = true; | ||
98 | } | ||
99 | |||
100 | DEFINE_MACHINE("cubieboard", cubieboard_machine_init) | ||
101 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c | ||
102 | index XXXXXXX..XXXXXXX 100644 | ||
103 | --- a/hw/arm/digic_boards.c | ||
104 | +++ b/hw/arm/digic_boards.c | ||
105 | @@ -XXX,XX +XXX,XX @@ static void canon_a1100_machine_init(MachineClass *mc) | ||
106 | { | ||
107 | mc->desc = "Canon PowerShot A1100 IS"; | ||
108 | mc->init = &canon_a1100_init; | ||
109 | + mc->ignore_memory_transaction_failures = true; | ||
110 | } | ||
111 | |||
112 | DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init) | ||
113 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
114 | index XXXXXXX..XXXXXXX 100644 | ||
115 | --- a/hw/arm/exynos4_boards.c | ||
116 | +++ b/hw/arm/exynos4_boards.c | ||
117 | @@ -XXX,XX +XXX,XX @@ static void nuri_class_init(ObjectClass *oc, void *data) | ||
118 | mc->desc = "Samsung NURI board (Exynos4210)"; | ||
119 | mc->init = nuri_init; | ||
120 | mc->max_cpus = EXYNOS4210_NCPUS; | ||
121 | + mc->ignore_memory_transaction_failures = true; | ||
122 | } | ||
123 | |||
124 | static const TypeInfo nuri_type = { | ||
125 | @@ -XXX,XX +XXX,XX @@ static void smdkc210_class_init(ObjectClass *oc, void *data) | ||
126 | mc->desc = "Samsung SMDKC210 board (Exynos4210)"; | ||
127 | mc->init = smdkc210_init; | ||
128 | mc->max_cpus = EXYNOS4210_NCPUS; | ||
129 | + mc->ignore_memory_transaction_failures = true; | ||
130 | } | ||
131 | |||
132 | static const TypeInfo smdkc210_type = { | ||
133 | diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/hw/arm/gumstix.c | ||
136 | +++ b/hw/arm/gumstix.c | ||
137 | @@ -XXX,XX +XXX,XX @@ static void connex_class_init(ObjectClass *oc, void *data) | ||
138 | |||
139 | mc->desc = "Gumstix Connex (PXA255)"; | ||
140 | mc->init = connex_init; | ||
141 | + mc->ignore_memory_transaction_failures = true; | ||
142 | } | ||
143 | |||
144 | static const TypeInfo connex_type = { | ||
145 | @@ -XXX,XX +XXX,XX @@ static void verdex_class_init(ObjectClass *oc, void *data) | ||
146 | |||
147 | mc->desc = "Gumstix Verdex (PXA270)"; | ||
148 | mc->init = verdex_init; | ||
149 | + mc->ignore_memory_transaction_failures = true; | ||
150 | } | ||
151 | |||
152 | static const TypeInfo verdex_type = { | ||
153 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | ||
154 | index XXXXXXX..XXXXXXX 100644 | ||
155 | --- a/hw/arm/highbank.c | ||
156 | +++ b/hw/arm/highbank.c | ||
157 | @@ -XXX,XX +XXX,XX @@ static void highbank_class_init(ObjectClass *oc, void *data) | ||
158 | mc->block_default_type = IF_IDE; | ||
159 | mc->units_per_default_bus = 1; | ||
160 | mc->max_cpus = 4; | ||
161 | + mc->ignore_memory_transaction_failures = true; | ||
162 | } | ||
163 | |||
164 | static const TypeInfo highbank_type = { | ||
165 | @@ -XXX,XX +XXX,XX @@ static void midway_class_init(ObjectClass *oc, void *data) | ||
166 | mc->block_default_type = IF_IDE; | ||
167 | mc->units_per_default_bus = 1; | ||
168 | mc->max_cpus = 4; | ||
169 | + mc->ignore_memory_transaction_failures = true; | ||
170 | } | ||
171 | |||
172 | static const TypeInfo midway_type = { | ||
173 | diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c | ||
174 | index XXXXXXX..XXXXXXX 100644 | ||
175 | --- a/hw/arm/imx25_pdk.c | ||
176 | +++ b/hw/arm/imx25_pdk.c | ||
177 | @@ -XXX,XX +XXX,XX @@ static void imx25_pdk_machine_init(MachineClass *mc) | ||
178 | { | ||
179 | mc->desc = "ARM i.MX25 PDK board (ARM926)"; | ||
180 | mc->init = imx25_pdk_init; | ||
181 | + mc->ignore_memory_transaction_failures = true; | ||
182 | } | ||
183 | |||
184 | DEFINE_MACHINE("imx25-pdk", imx25_pdk_machine_init) | ||
185 | diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c | ||
186 | index XXXXXXX..XXXXXXX 100644 | ||
187 | --- a/hw/arm/integratorcp.c | ||
188 | +++ b/hw/arm/integratorcp.c | ||
189 | @@ -XXX,XX +XXX,XX @@ static void integratorcp_machine_init(MachineClass *mc) | ||
190 | { | ||
191 | mc->desc = "ARM Integrator/CP (ARM926EJ-S)"; | ||
192 | mc->init = integratorcp_init; | ||
193 | + mc->ignore_memory_transaction_failures = true; | ||
194 | } | ||
195 | |||
196 | DEFINE_MACHINE("integratorcp", integratorcp_machine_init) | ||
197 | diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c | ||
198 | index XXXXXXX..XXXXXXX 100644 | ||
199 | --- a/hw/arm/kzm.c | ||
200 | +++ b/hw/arm/kzm.c | ||
201 | @@ -XXX,XX +XXX,XX @@ static void kzm_machine_init(MachineClass *mc) | ||
202 | { | ||
203 | mc->desc = "ARM KZM Emulation Baseboard (ARM1136)"; | ||
204 | mc->init = kzm_init; | ||
205 | + mc->ignore_memory_transaction_failures = true; | ||
206 | } | ||
207 | |||
208 | DEFINE_MACHINE("kzm", kzm_machine_init) | ||
209 | diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c | ||
210 | index XXXXXXX..XXXXXXX 100644 | ||
211 | --- a/hw/arm/mainstone.c | ||
212 | +++ b/hw/arm/mainstone.c | ||
213 | @@ -XXX,XX +XXX,XX @@ static void mainstone2_machine_init(MachineClass *mc) | ||
214 | { | ||
215 | mc->desc = "Mainstone II (PXA27x)"; | ||
216 | mc->init = mainstone_init; | ||
217 | + mc->ignore_memory_transaction_failures = true; | ||
218 | } | ||
219 | |||
220 | DEFINE_MACHINE("mainstone", mainstone2_machine_init) | ||
221 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | ||
222 | index XXXXXXX..XXXXXXX 100644 | ||
223 | --- a/hw/arm/musicpal.c | ||
224 | +++ b/hw/arm/musicpal.c | ||
225 | @@ -XXX,XX +XXX,XX @@ static void musicpal_machine_init(MachineClass *mc) | ||
226 | { | ||
227 | mc->desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)"; | ||
228 | mc->init = musicpal_init; | ||
229 | + mc->ignore_memory_transaction_failures = true; | ||
230 | } | ||
231 | |||
232 | DEFINE_MACHINE("musicpal", musicpal_machine_init) | ||
233 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c | ||
234 | index XXXXXXX..XXXXXXX 100644 | ||
235 | --- a/hw/arm/netduino2.c | ||
236 | +++ b/hw/arm/netduino2.c | ||
237 | @@ -XXX,XX +XXX,XX @@ static void netduino2_machine_init(MachineClass *mc) | ||
238 | { | ||
239 | mc->desc = "Netduino 2 Machine"; | ||
240 | mc->init = netduino2_init; | ||
241 | + mc->ignore_memory_transaction_failures = true; | ||
242 | } | ||
243 | |||
244 | DEFINE_MACHINE("netduino2", netduino2_machine_init) | ||
245 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
246 | index XXXXXXX..XXXXXXX 100644 | ||
247 | --- a/hw/arm/nseries.c | ||
248 | +++ b/hw/arm/nseries.c | ||
249 | @@ -XXX,XX +XXX,XX @@ static void n800_class_init(ObjectClass *oc, void *data) | ||
250 | mc->desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)"; | ||
251 | mc->init = n800_init; | ||
252 | mc->default_boot_order = ""; | ||
253 | + mc->ignore_memory_transaction_failures = true; | ||
254 | } | ||
255 | |||
256 | static const TypeInfo n800_type = { | ||
257 | @@ -XXX,XX +XXX,XX @@ static void n810_class_init(ObjectClass *oc, void *data) | ||
258 | mc->desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)"; | ||
259 | mc->init = n810_init; | ||
260 | mc->default_boot_order = ""; | ||
261 | + mc->ignore_memory_transaction_failures = true; | ||
262 | } | ||
263 | |||
264 | static const TypeInfo n810_type = { | ||
265 | diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c | ||
266 | index XXXXXXX..XXXXXXX 100644 | ||
267 | --- a/hw/arm/omap_sx1.c | ||
268 | +++ b/hw/arm/omap_sx1.c | ||
269 | @@ -XXX,XX +XXX,XX @@ static void sx1_machine_v2_class_init(ObjectClass *oc, void *data) | ||
270 | |||
271 | mc->desc = "Siemens SX1 (OMAP310) V2"; | ||
272 | mc->init = sx1_init_v2; | ||
273 | + mc->ignore_memory_transaction_failures = true; | ||
274 | } | ||
275 | |||
276 | static const TypeInfo sx1_machine_v2_type = { | ||
277 | @@ -XXX,XX +XXX,XX @@ static void sx1_machine_v1_class_init(ObjectClass *oc, void *data) | ||
278 | |||
279 | mc->desc = "Siemens SX1 (OMAP310) V1"; | ||
280 | mc->init = sx1_init_v1; | ||
281 | + mc->ignore_memory_transaction_failures = true; | ||
282 | } | ||
283 | |||
284 | static const TypeInfo sx1_machine_v1_type = { | ||
285 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | ||
286 | index XXXXXXX..XXXXXXX 100644 | ||
287 | --- a/hw/arm/palm.c | ||
288 | +++ b/hw/arm/palm.c | ||
289 | @@ -XXX,XX +XXX,XX @@ static void palmte_machine_init(MachineClass *mc) | ||
290 | { | ||
291 | mc->desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)"; | ||
292 | mc->init = palmte_init; | ||
293 | + mc->ignore_memory_transaction_failures = true; | ||
294 | } | ||
295 | |||
296 | DEFINE_MACHINE("cheetah", palmte_machine_init) | ||
297 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
298 | index XXXXXXX..XXXXXXX 100644 | ||
299 | --- a/hw/arm/raspi.c | ||
300 | +++ b/hw/arm/raspi.c | ||
301 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc) | ||
302 | mc->no_cdrom = 1; | ||
303 | mc->max_cpus = BCM2836_NCPUS; | ||
304 | mc->default_ram_size = 1024 * 1024 * 1024; | ||
305 | + mc->ignore_memory_transaction_failures = true; | ||
306 | }; | ||
307 | DEFINE_MACHINE("raspi2", raspi2_machine_init) | ||
308 | diff --git a/hw/arm/realview.c b/hw/arm/realview.c | ||
309 | index XXXXXXX..XXXXXXX 100644 | ||
310 | --- a/hw/arm/realview.c | ||
311 | +++ b/hw/arm/realview.c | ||
312 | @@ -XXX,XX +XXX,XX @@ static void realview_eb_class_init(ObjectClass *oc, void *data) | ||
313 | mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)"; | ||
314 | mc->init = realview_eb_init; | ||
315 | mc->block_default_type = IF_SCSI; | ||
316 | + mc->ignore_memory_transaction_failures = true; | ||
317 | } | ||
318 | |||
319 | static const TypeInfo realview_eb_type = { | ||
320 | @@ -XXX,XX +XXX,XX @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) | ||
321 | mc->init = realview_eb_mpcore_init; | ||
322 | mc->block_default_type = IF_SCSI; | ||
323 | mc->max_cpus = 4; | ||
324 | + mc->ignore_memory_transaction_failures = true; | ||
325 | } | ||
326 | |||
327 | static const TypeInfo realview_eb_mpcore_type = { | ||
328 | @@ -XXX,XX +XXX,XX @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) | ||
329 | |||
330 | mc->desc = "ARM RealView Platform Baseboard for Cortex-A8"; | ||
331 | mc->init = realview_pb_a8_init; | ||
332 | + mc->ignore_memory_transaction_failures = true; | ||
333 | } | ||
334 | |||
335 | static const TypeInfo realview_pb_a8_type = { | ||
336 | @@ -XXX,XX +XXX,XX @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) | ||
337 | mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9"; | ||
338 | mc->init = realview_pbx_a9_init; | ||
339 | mc->max_cpus = 4; | ||
340 | + mc->ignore_memory_transaction_failures = true; | ||
341 | } | ||
342 | |||
343 | static const TypeInfo realview_pbx_a9_type = { | ||
344 | diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c | ||
345 | index XXXXXXX..XXXXXXX 100644 | ||
346 | --- a/hw/arm/sabrelite.c | ||
347 | +++ b/hw/arm/sabrelite.c | ||
348 | @@ -XXX,XX +XXX,XX @@ static void sabrelite_machine_init(MachineClass *mc) | ||
349 | mc->desc = "Freescale i.MX6 Quad SABRE Lite Board (Cortex A9)"; | ||
350 | mc->init = sabrelite_init; | ||
351 | mc->max_cpus = FSL_IMX6_NUM_CPUS; | ||
352 | + mc->ignore_memory_transaction_failures = true; | ||
353 | } | ||
354 | |||
355 | DEFINE_MACHINE("sabrelite", sabrelite_machine_init) | ||
356 | diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c | ||
357 | index XXXXXXX..XXXXXXX 100644 | ||
358 | --- a/hw/arm/spitz.c | ||
359 | +++ b/hw/arm/spitz.c | ||
360 | @@ -XXX,XX +XXX,XX @@ static void akitapda_class_init(ObjectClass *oc, void *data) | ||
361 | |||
362 | mc->desc = "Sharp SL-C1000 (Akita) PDA (PXA270)"; | ||
363 | mc->init = akita_init; | ||
364 | + mc->ignore_memory_transaction_failures = true; | ||
365 | } | ||
366 | |||
367 | static const TypeInfo akitapda_type = { | ||
368 | @@ -XXX,XX +XXX,XX @@ static void spitzpda_class_init(ObjectClass *oc, void *data) | ||
369 | mc->desc = "Sharp SL-C3000 (Spitz) PDA (PXA270)"; | ||
370 | mc->init = spitz_init; | ||
371 | mc->block_default_type = IF_IDE; | ||
372 | + mc->ignore_memory_transaction_failures = true; | ||
373 | } | ||
374 | |||
375 | static const TypeInfo spitzpda_type = { | ||
376 | @@ -XXX,XX +XXX,XX @@ static void borzoipda_class_init(ObjectClass *oc, void *data) | ||
377 | mc->desc = "Sharp SL-C3100 (Borzoi) PDA (PXA270)"; | ||
378 | mc->init = borzoi_init; | ||
379 | mc->block_default_type = IF_IDE; | ||
380 | + mc->ignore_memory_transaction_failures = true; | ||
381 | } | ||
382 | |||
383 | static const TypeInfo borzoipda_type = { | ||
384 | @@ -XXX,XX +XXX,XX @@ static void terrierpda_class_init(ObjectClass *oc, void *data) | ||
385 | mc->desc = "Sharp SL-C3200 (Terrier) PDA (PXA270)"; | ||
386 | mc->init = terrier_init; | ||
387 | mc->block_default_type = IF_IDE; | ||
388 | + mc->ignore_memory_transaction_failures = true; | ||
389 | } | ||
390 | |||
391 | static const TypeInfo terrierpda_type = { | ||
392 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | ||
393 | index XXXXXXX..XXXXXXX 100644 | ||
394 | --- a/hw/arm/stellaris.c | ||
395 | +++ b/hw/arm/stellaris.c | ||
396 | @@ -XXX,XX +XXX,XX @@ static void lm3s811evb_class_init(ObjectClass *oc, void *data) | ||
397 | |||
398 | mc->desc = "Stellaris LM3S811EVB"; | ||
399 | mc->init = lm3s811evb_init; | ||
400 | + mc->ignore_memory_transaction_failures = true; | ||
401 | } | ||
402 | |||
403 | static const TypeInfo lm3s811evb_type = { | ||
404 | @@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_class_init(ObjectClass *oc, void *data) | ||
405 | |||
406 | mc->desc = "Stellaris LM3S6965EVB"; | ||
407 | mc->init = lm3s6965evb_init; | ||
408 | + mc->ignore_memory_transaction_failures = true; | ||
409 | } | ||
410 | |||
411 | static const TypeInfo lm3s6965evb_type = { | ||
412 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | ||
413 | index XXXXXXX..XXXXXXX 100644 | ||
414 | --- a/hw/arm/tosa.c | ||
415 | +++ b/hw/arm/tosa.c | ||
416 | @@ -XXX,XX +XXX,XX @@ static void tosapda_machine_init(MachineClass *mc) | ||
417 | mc->desc = "Sharp SL-6000 (Tosa) PDA (PXA255)"; | ||
418 | mc->init = tosa_init; | ||
419 | mc->block_default_type = IF_IDE; | ||
420 | + mc->ignore_memory_transaction_failures = true; | ||
421 | } | ||
422 | |||
423 | DEFINE_MACHINE("tosa", tosapda_machine_init) | ||
424 | diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c | ||
425 | index XXXXXXX..XXXXXXX 100644 | ||
426 | --- a/hw/arm/versatilepb.c | ||
427 | +++ b/hw/arm/versatilepb.c | ||
428 | @@ -XXX,XX +XXX,XX @@ static void versatilepb_class_init(ObjectClass *oc, void *data) | ||
429 | mc->desc = "ARM Versatile/PB (ARM926EJ-S)"; | ||
430 | mc->init = vpb_init; | ||
431 | mc->block_default_type = IF_SCSI; | ||
432 | + mc->ignore_memory_transaction_failures = true; | ||
433 | } | ||
434 | |||
435 | static const TypeInfo versatilepb_type = { | ||
436 | @@ -XXX,XX +XXX,XX @@ static void versatileab_class_init(ObjectClass *oc, void *data) | ||
437 | mc->desc = "ARM Versatile/AB (ARM926EJ-S)"; | ||
438 | mc->init = vab_init; | ||
439 | mc->block_default_type = IF_SCSI; | ||
440 | + mc->ignore_memory_transaction_failures = true; | ||
441 | } | ||
442 | |||
443 | static const TypeInfo versatileab_type = { | ||
444 | diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c | ||
445 | index XXXXXXX..XXXXXXX 100644 | ||
446 | --- a/hw/arm/vexpress.c | ||
447 | +++ b/hw/arm/vexpress.c | ||
448 | @@ -XXX,XX +XXX,XX @@ static void vexpress_class_init(ObjectClass *oc, void *data) | ||
449 | mc->desc = "ARM Versatile Express"; | ||
450 | mc->init = vexpress_common_init; | ||
451 | mc->max_cpus = 4; | ||
452 | + mc->ignore_memory_transaction_failures = true; | ||
453 | } | ||
454 | |||
455 | static void vexpress_a9_class_init(ObjectClass *oc, void *data) | ||
456 | diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c | ||
457 | index XXXXXXX..XXXXXXX 100644 | ||
458 | --- a/hw/arm/xilinx_zynq.c | ||
459 | +++ b/hw/arm/xilinx_zynq.c | ||
460 | @@ -XXX,XX +XXX,XX @@ static void zynq_machine_init(MachineClass *mc) | ||
461 | mc->init = zynq_init; | ||
462 | mc->max_cpus = 1; | ||
463 | mc->no_sdcard = 1; | ||
464 | + mc->ignore_memory_transaction_failures = true; | ||
465 | } | ||
466 | |||
467 | DEFINE_MACHINE("xilinx-zynq-a9", zynq_machine_init) | ||
468 | diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c | ||
469 | index XXXXXXX..XXXXXXX 100644 | ||
470 | --- a/hw/arm/xlnx-ep108.c | ||
471 | +++ b/hw/arm/xlnx-ep108.c | ||
472 | @@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_init(MachineClass *mc) | ||
473 | mc->init = xlnx_ep108_init; | ||
474 | mc->block_default_type = IF_IDE; | ||
475 | mc->units_per_default_bus = 1; | ||
476 | + mc->ignore_memory_transaction_failures = true; | ||
477 | } | ||
478 | |||
479 | DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init) | ||
480 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_init(MachineClass *mc) | ||
481 | mc->init = xlnx_ep108_init; | ||
482 | mc->block_default_type = IF_IDE; | ||
483 | mc->units_per_default_bus = 1; | ||
484 | + mc->ignore_memory_transaction_failures = true; | ||
485 | } | ||
486 | |||
487 | DEFINE_MACHINE("xlnx-zcu102", xlnx_zcu102_machine_init) | ||
488 | diff --git a/hw/arm/z2.c b/hw/arm/z2.c | ||
489 | index XXXXXXX..XXXXXXX 100644 | ||
490 | --- a/hw/arm/z2.c | ||
491 | +++ b/hw/arm/z2.c | ||
492 | @@ -XXX,XX +XXX,XX @@ static void z2_machine_init(MachineClass *mc) | ||
493 | { | ||
494 | mc->desc = "Zipit Z2 (PXA27x)"; | ||
495 | mc->init = z2_init; | ||
496 | + mc->ignore_memory_transaction_failures = true; | ||
497 | } | ||
498 | |||
499 | DEFINE_MACHINE("z2", z2_machine_init) | ||
500 | -- | 63 | -- |
501 | 2.7.4 | 64 | 2.20.1 |
502 | 65 | ||
503 | 66 | diff view generated by jsdifflib |
1 | In the ARM get_phys_addr() code, switch to using the MMUAccessType | 1 | Currently we provide Hn and H1_n macros for accessing the correct |
---|---|---|---|
2 | enum and its MMU_* values rather than int and literal 0/1/2. | 2 | data within arrays of vector elements of size 1, 2 and 4, accounting |
3 | for host endianness. We don't provide any macros for elements of | ||
4 | size 8 because there the host endianness doesn't matter. However, | ||
5 | this does result in awkwardness where we need to pass empty arguments | ||
6 | to macros, because checkpatch complains about them. The empty | ||
7 | argument is a little confusing for humans to read as well. | ||
3 | 8 | ||
9 | Add H8() and H1_8() macros and use them where we were previously | ||
10 | passing empty arguments to macros. | ||
11 | |||
12 | Suggested-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 1501692241-23310-2-git-send-email-peter.maydell@linaro.org | 16 | Message-id: 20210614151007.4545-2-peter.maydell@linaro.org |
17 | Message-id: 20210610132505.5827-1-peter.maydell@linaro.org | ||
9 | --- | 18 | --- |
10 | target/arm/internals.h | 3 ++- | 19 | target/arm/vec_internal.h | 8 +- |
11 | target/arm/helper.c | 30 +++++++++++++++--------------- | 20 | target/arm/sve_helper.c | 258 +++++++++++++++++++------------------- |
12 | 2 files changed, 17 insertions(+), 16 deletions(-) | 21 | target/arm/vec_helper.c | 14 +-- |
22 | 3 files changed, 143 insertions(+), 137 deletions(-) | ||
13 | 23 | ||
14 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 24 | diff --git a/target/arm/vec_internal.h b/target/arm/vec_internal.h |
15 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/internals.h | 26 | --- a/target/arm/vec_internal.h |
17 | +++ b/target/arm/internals.h | 27 | +++ b/target/arm/vec_internal.h |
18 | @@ -XXX,XX +XXX,XX @@ struct ARMMMUFaultInfo { | 28 | @@ -XXX,XX +XXX,XX @@ |
19 | }; | 29 | #define H2(x) (x) |
20 | 30 | #define H4(x) (x) | |
21 | /* Do a page table walk and add page to TLB if possible */ | 31 | #endif |
22 | -bool arm_tlb_fill(CPUState *cpu, vaddr address, int rw, int mmu_idx, | 32 | - |
23 | +bool arm_tlb_fill(CPUState *cpu, vaddr address, | 33 | +/* |
24 | + MMUAccessType access_type, int mmu_idx, | 34 | + * Access to 64-bit elements isn't host-endian dependent; we provide H8 |
25 | uint32_t *fsr, ARMMMUFaultInfo *fi); | 35 | + * and H1_8 so that when a function is being generated from a macro we |
26 | 36 | + * can pass these rather than an empty macro argument, for clarity. | |
27 | /* Return true if the stage 1 translation regime is using LPAE format page | 37 | + */ |
28 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 38 | +#define H8(x) (x) |
39 | +#define H1_8(x) (x) | ||
40 | |||
41 | static inline void clear_tail(void *vd, uintptr_t opr_sz, uintptr_t max_sz) | ||
42 | { | ||
43 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | 44 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/target/arm/helper.c | 45 | --- a/target/arm/sve_helper.c |
31 | +++ b/target/arm/helper.c | 46 | +++ b/target/arm/sve_helper.c |
32 | @@ -XXX,XX +XXX,XX @@ | 47 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, \ |
33 | 48 | ||
34 | #ifndef CONFIG_USER_ONLY | 49 | DO_ZPZZ_PAIR_FP(sve2_faddp_zpzz_h, float16, H1_2, float16_add) |
35 | static bool get_phys_addr(CPUARMState *env, target_ulong address, | 50 | DO_ZPZZ_PAIR_FP(sve2_faddp_zpzz_s, float32, H1_4, float32_add) |
36 | - int access_type, ARMMMUIdx mmu_idx, | 51 | -DO_ZPZZ_PAIR_FP(sve2_faddp_zpzz_d, float64, , float64_add) |
37 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 52 | +DO_ZPZZ_PAIR_FP(sve2_faddp_zpzz_d, float64, H1_8, float64_add) |
38 | hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, | 53 | |
39 | target_ulong *page_size, uint32_t *fsr, | 54 | DO_ZPZZ_PAIR_FP(sve2_fmaxnmp_zpzz_h, float16, H1_2, float16_maxnum) |
40 | ARMMMUFaultInfo *fi); | 55 | DO_ZPZZ_PAIR_FP(sve2_fmaxnmp_zpzz_s, float32, H1_4, float32_maxnum) |
41 | 56 | -DO_ZPZZ_PAIR_FP(sve2_fmaxnmp_zpzz_d, float64, , float64_maxnum) | |
42 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 57 | +DO_ZPZZ_PAIR_FP(sve2_fmaxnmp_zpzz_d, float64, H1_8, float64_maxnum) |
43 | - int access_type, ARMMMUIdx mmu_idx, | 58 | |
44 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 59 | DO_ZPZZ_PAIR_FP(sve2_fminnmp_zpzz_h, float16, H1_2, float16_minnum) |
45 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | 60 | DO_ZPZZ_PAIR_FP(sve2_fminnmp_zpzz_s, float32, H1_4, float32_minnum) |
46 | target_ulong *page_size_ptr, uint32_t *fsr, | 61 | -DO_ZPZZ_PAIR_FP(sve2_fminnmp_zpzz_d, float64, , float64_minnum) |
47 | ARMMMUFaultInfo *fi); | 62 | +DO_ZPZZ_PAIR_FP(sve2_fminnmp_zpzz_d, float64, H1_8, float64_minnum) |
48 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri, | 63 | |
64 | DO_ZPZZ_PAIR_FP(sve2_fmaxp_zpzz_h, float16, H1_2, float16_max) | ||
65 | DO_ZPZZ_PAIR_FP(sve2_fmaxp_zpzz_s, float32, H1_4, float32_max) | ||
66 | -DO_ZPZZ_PAIR_FP(sve2_fmaxp_zpzz_d, float64, , float64_max) | ||
67 | +DO_ZPZZ_PAIR_FP(sve2_fmaxp_zpzz_d, float64, H1_8, float64_max) | ||
68 | |||
69 | DO_ZPZZ_PAIR_FP(sve2_fminp_zpzz_h, float16, H1_2, float16_min) | ||
70 | DO_ZPZZ_PAIR_FP(sve2_fminp_zpzz_s, float32, H1_4, float32_min) | ||
71 | -DO_ZPZZ_PAIR_FP(sve2_fminp_zpzz_d, float64, , float64_min) | ||
72 | +DO_ZPZZ_PAIR_FP(sve2_fminp_zpzz_d, float64, H1_8, float64_min) | ||
73 | |||
74 | #undef DO_ZPZZ_PAIR_FP | ||
75 | |||
76 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
77 | |||
78 | DO_ZZZ_TB(sve2_saddl_h, int16_t, int8_t, H1_2, H1, DO_ADD) | ||
79 | DO_ZZZ_TB(sve2_saddl_s, int32_t, int16_t, H1_4, H1_2, DO_ADD) | ||
80 | -DO_ZZZ_TB(sve2_saddl_d, int64_t, int32_t, , H1_4, DO_ADD) | ||
81 | +DO_ZZZ_TB(sve2_saddl_d, int64_t, int32_t, H1_8, H1_4, DO_ADD) | ||
82 | |||
83 | DO_ZZZ_TB(sve2_ssubl_h, int16_t, int8_t, H1_2, H1, DO_SUB) | ||
84 | DO_ZZZ_TB(sve2_ssubl_s, int32_t, int16_t, H1_4, H1_2, DO_SUB) | ||
85 | -DO_ZZZ_TB(sve2_ssubl_d, int64_t, int32_t, , H1_4, DO_SUB) | ||
86 | +DO_ZZZ_TB(sve2_ssubl_d, int64_t, int32_t, H1_8, H1_4, DO_SUB) | ||
87 | |||
88 | DO_ZZZ_TB(sve2_sabdl_h, int16_t, int8_t, H1_2, H1, DO_ABD) | ||
89 | DO_ZZZ_TB(sve2_sabdl_s, int32_t, int16_t, H1_4, H1_2, DO_ABD) | ||
90 | -DO_ZZZ_TB(sve2_sabdl_d, int64_t, int32_t, , H1_4, DO_ABD) | ||
91 | +DO_ZZZ_TB(sve2_sabdl_d, int64_t, int32_t, H1_8, H1_4, DO_ABD) | ||
92 | |||
93 | DO_ZZZ_TB(sve2_uaddl_h, uint16_t, uint8_t, H1_2, H1, DO_ADD) | ||
94 | DO_ZZZ_TB(sve2_uaddl_s, uint32_t, uint16_t, H1_4, H1_2, DO_ADD) | ||
95 | -DO_ZZZ_TB(sve2_uaddl_d, uint64_t, uint32_t, , H1_4, DO_ADD) | ||
96 | +DO_ZZZ_TB(sve2_uaddl_d, uint64_t, uint32_t, H1_8, H1_4, DO_ADD) | ||
97 | |||
98 | DO_ZZZ_TB(sve2_usubl_h, uint16_t, uint8_t, H1_2, H1, DO_SUB) | ||
99 | DO_ZZZ_TB(sve2_usubl_s, uint32_t, uint16_t, H1_4, H1_2, DO_SUB) | ||
100 | -DO_ZZZ_TB(sve2_usubl_d, uint64_t, uint32_t, , H1_4, DO_SUB) | ||
101 | +DO_ZZZ_TB(sve2_usubl_d, uint64_t, uint32_t, H1_8, H1_4, DO_SUB) | ||
102 | |||
103 | DO_ZZZ_TB(sve2_uabdl_h, uint16_t, uint8_t, H1_2, H1, DO_ABD) | ||
104 | DO_ZZZ_TB(sve2_uabdl_s, uint32_t, uint16_t, H1_4, H1_2, DO_ABD) | ||
105 | -DO_ZZZ_TB(sve2_uabdl_d, uint64_t, uint32_t, , H1_4, DO_ABD) | ||
106 | +DO_ZZZ_TB(sve2_uabdl_d, uint64_t, uint32_t, H1_8, H1_4, DO_ABD) | ||
107 | |||
108 | DO_ZZZ_TB(sve2_smull_zzz_h, int16_t, int8_t, H1_2, H1, DO_MUL) | ||
109 | DO_ZZZ_TB(sve2_smull_zzz_s, int32_t, int16_t, H1_4, H1_2, DO_MUL) | ||
110 | -DO_ZZZ_TB(sve2_smull_zzz_d, int64_t, int32_t, , H1_4, DO_MUL) | ||
111 | +DO_ZZZ_TB(sve2_smull_zzz_d, int64_t, int32_t, H1_8, H1_4, DO_MUL) | ||
112 | |||
113 | DO_ZZZ_TB(sve2_umull_zzz_h, uint16_t, uint8_t, H1_2, H1, DO_MUL) | ||
114 | DO_ZZZ_TB(sve2_umull_zzz_s, uint32_t, uint16_t, H1_4, H1_2, DO_MUL) | ||
115 | -DO_ZZZ_TB(sve2_umull_zzz_d, uint64_t, uint32_t, , H1_4, DO_MUL) | ||
116 | +DO_ZZZ_TB(sve2_umull_zzz_d, uint64_t, uint32_t, H1_8, H1_4, DO_MUL) | ||
117 | |||
118 | /* Note that the multiply cannot overflow, but the doubling can. */ | ||
119 | static inline int16_t do_sqdmull_h(int16_t n, int16_t m) | ||
120 | @@ -XXX,XX +XXX,XX @@ static inline int64_t do_sqdmull_d(int64_t n, int64_t m) | ||
121 | |||
122 | DO_ZZZ_TB(sve2_sqdmull_zzz_h, int16_t, int8_t, H1_2, H1, do_sqdmull_h) | ||
123 | DO_ZZZ_TB(sve2_sqdmull_zzz_s, int32_t, int16_t, H1_4, H1_2, do_sqdmull_s) | ||
124 | -DO_ZZZ_TB(sve2_sqdmull_zzz_d, int64_t, int32_t, , H1_4, do_sqdmull_d) | ||
125 | +DO_ZZZ_TB(sve2_sqdmull_zzz_d, int64_t, int32_t, H1_8, H1_4, do_sqdmull_d) | ||
126 | |||
127 | #undef DO_ZZZ_TB | ||
128 | |||
129 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
130 | |||
131 | DO_ZZZ_WTB(sve2_saddw_h, int16_t, int8_t, H1_2, H1, DO_ADD) | ||
132 | DO_ZZZ_WTB(sve2_saddw_s, int32_t, int16_t, H1_4, H1_2, DO_ADD) | ||
133 | -DO_ZZZ_WTB(sve2_saddw_d, int64_t, int32_t, , H1_4, DO_ADD) | ||
134 | +DO_ZZZ_WTB(sve2_saddw_d, int64_t, int32_t, H1_8, H1_4, DO_ADD) | ||
135 | |||
136 | DO_ZZZ_WTB(sve2_ssubw_h, int16_t, int8_t, H1_2, H1, DO_SUB) | ||
137 | DO_ZZZ_WTB(sve2_ssubw_s, int32_t, int16_t, H1_4, H1_2, DO_SUB) | ||
138 | -DO_ZZZ_WTB(sve2_ssubw_d, int64_t, int32_t, , H1_4, DO_SUB) | ||
139 | +DO_ZZZ_WTB(sve2_ssubw_d, int64_t, int32_t, H1_8, H1_4, DO_SUB) | ||
140 | |||
141 | DO_ZZZ_WTB(sve2_uaddw_h, uint16_t, uint8_t, H1_2, H1, DO_ADD) | ||
142 | DO_ZZZ_WTB(sve2_uaddw_s, uint32_t, uint16_t, H1_4, H1_2, DO_ADD) | ||
143 | -DO_ZZZ_WTB(sve2_uaddw_d, uint64_t, uint32_t, , H1_4, DO_ADD) | ||
144 | +DO_ZZZ_WTB(sve2_uaddw_d, uint64_t, uint32_t, H1_8, H1_4, DO_ADD) | ||
145 | |||
146 | DO_ZZZ_WTB(sve2_usubw_h, uint16_t, uint8_t, H1_2, H1, DO_SUB) | ||
147 | DO_ZZZ_WTB(sve2_usubw_s, uint32_t, uint16_t, H1_4, H1_2, DO_SUB) | ||
148 | -DO_ZZZ_WTB(sve2_usubw_d, uint64_t, uint32_t, , H1_4, DO_SUB) | ||
149 | +DO_ZZZ_WTB(sve2_usubw_d, uint64_t, uint32_t, H1_8, H1_4, DO_SUB) | ||
150 | |||
151 | #undef DO_ZZZ_WTB | ||
152 | |||
153 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
154 | DO_ZZZ_NTB(sve2_eoril_b, uint8_t, H1, DO_EOR) | ||
155 | DO_ZZZ_NTB(sve2_eoril_h, uint16_t, H1_2, DO_EOR) | ||
156 | DO_ZZZ_NTB(sve2_eoril_s, uint32_t, H1_4, DO_EOR) | ||
157 | -DO_ZZZ_NTB(sve2_eoril_d, uint64_t, , DO_EOR) | ||
158 | +DO_ZZZ_NTB(sve2_eoril_d, uint64_t, H1_8, DO_EOR) | ||
159 | |||
160 | #undef DO_ZZZ_NTB | ||
161 | |||
162 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ | ||
163 | |||
164 | DO_ZZZW_ACC(sve2_sabal_h, int16_t, int8_t, H1_2, H1, DO_ABD) | ||
165 | DO_ZZZW_ACC(sve2_sabal_s, int32_t, int16_t, H1_4, H1_2, DO_ABD) | ||
166 | -DO_ZZZW_ACC(sve2_sabal_d, int64_t, int32_t, , H1_4, DO_ABD) | ||
167 | +DO_ZZZW_ACC(sve2_sabal_d, int64_t, int32_t, H1_8, H1_4, DO_ABD) | ||
168 | |||
169 | DO_ZZZW_ACC(sve2_uabal_h, uint16_t, uint8_t, H1_2, H1, DO_ABD) | ||
170 | DO_ZZZW_ACC(sve2_uabal_s, uint32_t, uint16_t, H1_4, H1_2, DO_ABD) | ||
171 | -DO_ZZZW_ACC(sve2_uabal_d, uint64_t, uint32_t, , H1_4, DO_ABD) | ||
172 | +DO_ZZZW_ACC(sve2_uabal_d, uint64_t, uint32_t, H1_8, H1_4, DO_ABD) | ||
173 | |||
174 | DO_ZZZW_ACC(sve2_smlal_zzzw_h, int16_t, int8_t, H1_2, H1, DO_MUL) | ||
175 | DO_ZZZW_ACC(sve2_smlal_zzzw_s, int32_t, int16_t, H1_4, H1_2, DO_MUL) | ||
176 | -DO_ZZZW_ACC(sve2_smlal_zzzw_d, int64_t, int32_t, , H1_4, DO_MUL) | ||
177 | +DO_ZZZW_ACC(sve2_smlal_zzzw_d, int64_t, int32_t, H1_8, H1_4, DO_MUL) | ||
178 | |||
179 | DO_ZZZW_ACC(sve2_umlal_zzzw_h, uint16_t, uint8_t, H1_2, H1, DO_MUL) | ||
180 | DO_ZZZW_ACC(sve2_umlal_zzzw_s, uint32_t, uint16_t, H1_4, H1_2, DO_MUL) | ||
181 | -DO_ZZZW_ACC(sve2_umlal_zzzw_d, uint64_t, uint32_t, , H1_4, DO_MUL) | ||
182 | +DO_ZZZW_ACC(sve2_umlal_zzzw_d, uint64_t, uint32_t, H1_8, H1_4, DO_MUL) | ||
183 | |||
184 | #define DO_NMUL(N, M) -(N * M) | ||
185 | |||
186 | DO_ZZZW_ACC(sve2_smlsl_zzzw_h, int16_t, int8_t, H1_2, H1, DO_NMUL) | ||
187 | DO_ZZZW_ACC(sve2_smlsl_zzzw_s, int32_t, int16_t, H1_4, H1_2, DO_NMUL) | ||
188 | -DO_ZZZW_ACC(sve2_smlsl_zzzw_d, int64_t, int32_t, , H1_4, DO_NMUL) | ||
189 | +DO_ZZZW_ACC(sve2_smlsl_zzzw_d, int64_t, int32_t, H1_8, H1_4, DO_NMUL) | ||
190 | |||
191 | DO_ZZZW_ACC(sve2_umlsl_zzzw_h, uint16_t, uint8_t, H1_2, H1, DO_NMUL) | ||
192 | DO_ZZZW_ACC(sve2_umlsl_zzzw_s, uint32_t, uint16_t, H1_4, H1_2, DO_NMUL) | ||
193 | -DO_ZZZW_ACC(sve2_umlsl_zzzw_d, uint64_t, uint32_t, , H1_4, DO_NMUL) | ||
194 | +DO_ZZZW_ACC(sve2_umlsl_zzzw_d, uint64_t, uint32_t, H1_8, H1_4, DO_NMUL) | ||
195 | |||
196 | #undef DO_ZZZW_ACC | ||
197 | |||
198 | @@ -XXX,XX +XXX,XX @@ DO_SQDMLAL(sve2_sqdmlal_zzzw_h, int16_t, int8_t, H1_2, H1, | ||
199 | do_sqdmull_h, DO_SQADD_H) | ||
200 | DO_SQDMLAL(sve2_sqdmlal_zzzw_s, int32_t, int16_t, H1_4, H1_2, | ||
201 | do_sqdmull_s, DO_SQADD_S) | ||
202 | -DO_SQDMLAL(sve2_sqdmlal_zzzw_d, int64_t, int32_t, , H1_4, | ||
203 | +DO_SQDMLAL(sve2_sqdmlal_zzzw_d, int64_t, int32_t, H1_8, H1_4, | ||
204 | do_sqdmull_d, do_sqadd_d) | ||
205 | |||
206 | DO_SQDMLAL(sve2_sqdmlsl_zzzw_h, int16_t, int8_t, H1_2, H1, | ||
207 | do_sqdmull_h, DO_SQSUB_H) | ||
208 | DO_SQDMLAL(sve2_sqdmlsl_zzzw_s, int32_t, int16_t, H1_4, H1_2, | ||
209 | do_sqdmull_s, DO_SQSUB_S) | ||
210 | -DO_SQDMLAL(sve2_sqdmlsl_zzzw_d, int64_t, int32_t, , H1_4, | ||
211 | +DO_SQDMLAL(sve2_sqdmlsl_zzzw_d, int64_t, int32_t, H1_8, H1_4, | ||
212 | do_sqdmull_d, do_sqsub_d) | ||
213 | |||
214 | #undef DO_SQDMLAL | ||
215 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ | ||
216 | DO_CMLA_FUNC(sve2_cmla_zzzz_b, uint8_t, H1, DO_CMLA) | ||
217 | DO_CMLA_FUNC(sve2_cmla_zzzz_h, uint16_t, H2, DO_CMLA) | ||
218 | DO_CMLA_FUNC(sve2_cmla_zzzz_s, uint32_t, H4, DO_CMLA) | ||
219 | -DO_CMLA_FUNC(sve2_cmla_zzzz_d, uint64_t, , DO_CMLA) | ||
220 | +DO_CMLA_FUNC(sve2_cmla_zzzz_d, uint64_t, H8, DO_CMLA) | ||
221 | |||
222 | #define DO_SQRDMLAH_B(N, M, A, S) \ | ||
223 | do_sqrdmlah_b(N, M, A, S, true) | ||
224 | @@ -XXX,XX +XXX,XX @@ DO_CMLA_FUNC(sve2_cmla_zzzz_d, uint64_t, , DO_CMLA) | ||
225 | DO_CMLA_FUNC(sve2_sqrdcmlah_zzzz_b, int8_t, H1, DO_SQRDMLAH_B) | ||
226 | DO_CMLA_FUNC(sve2_sqrdcmlah_zzzz_h, int16_t, H2, DO_SQRDMLAH_H) | ||
227 | DO_CMLA_FUNC(sve2_sqrdcmlah_zzzz_s, int32_t, H4, DO_SQRDMLAH_S) | ||
228 | -DO_CMLA_FUNC(sve2_sqrdcmlah_zzzz_d, int64_t, , DO_SQRDMLAH_D) | ||
229 | +DO_CMLA_FUNC(sve2_sqrdcmlah_zzzz_d, int64_t, H8, DO_SQRDMLAH_D) | ||
230 | |||
231 | #define DO_CMLA_IDX_FUNC(NAME, TYPE, H, OP) \ | ||
232 | void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ | ||
233 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ | ||
234 | |||
235 | DO_ZZXZ(sve2_sqrdmlah_idx_h, int16_t, H2, DO_SQRDMLAH_H) | ||
236 | DO_ZZXZ(sve2_sqrdmlah_idx_s, int32_t, H4, DO_SQRDMLAH_S) | ||
237 | -DO_ZZXZ(sve2_sqrdmlah_idx_d, int64_t, , DO_SQRDMLAH_D) | ||
238 | +DO_ZZXZ(sve2_sqrdmlah_idx_d, int64_t, H8, DO_SQRDMLAH_D) | ||
239 | |||
240 | #define DO_SQRDMLSH_H(N, M, A) \ | ||
241 | ({ uint32_t discard; do_sqrdmlah_h(N, M, A, true, true, &discard); }) | ||
242 | @@ -XXX,XX +XXX,XX @@ DO_ZZXZ(sve2_sqrdmlah_idx_d, int64_t, , DO_SQRDMLAH_D) | ||
243 | |||
244 | DO_ZZXZ(sve2_sqrdmlsh_idx_h, int16_t, H2, DO_SQRDMLSH_H) | ||
245 | DO_ZZXZ(sve2_sqrdmlsh_idx_s, int32_t, H4, DO_SQRDMLSH_S) | ||
246 | -DO_ZZXZ(sve2_sqrdmlsh_idx_d, int64_t, , DO_SQRDMLSH_D) | ||
247 | +DO_ZZXZ(sve2_sqrdmlsh_idx_d, int64_t, H8, DO_SQRDMLSH_D) | ||
248 | |||
249 | #undef DO_ZZXZ | ||
250 | |||
251 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ | ||
252 | #define DO_MLA(N, M, A) (A + N * M) | ||
253 | |||
254 | DO_ZZXW(sve2_smlal_idx_s, int32_t, int16_t, H1_4, H1_2, DO_MLA) | ||
255 | -DO_ZZXW(sve2_smlal_idx_d, int64_t, int32_t, , H1_4, DO_MLA) | ||
256 | +DO_ZZXW(sve2_smlal_idx_d, int64_t, int32_t, H1_8, H1_4, DO_MLA) | ||
257 | DO_ZZXW(sve2_umlal_idx_s, uint32_t, uint16_t, H1_4, H1_2, DO_MLA) | ||
258 | -DO_ZZXW(sve2_umlal_idx_d, uint64_t, uint32_t, , H1_4, DO_MLA) | ||
259 | +DO_ZZXW(sve2_umlal_idx_d, uint64_t, uint32_t, H1_8, H1_4, DO_MLA) | ||
260 | |||
261 | #define DO_MLS(N, M, A) (A - N * M) | ||
262 | |||
263 | DO_ZZXW(sve2_smlsl_idx_s, int32_t, int16_t, H1_4, H1_2, DO_MLS) | ||
264 | -DO_ZZXW(sve2_smlsl_idx_d, int64_t, int32_t, , H1_4, DO_MLS) | ||
265 | +DO_ZZXW(sve2_smlsl_idx_d, int64_t, int32_t, H1_8, H1_4, DO_MLS) | ||
266 | DO_ZZXW(sve2_umlsl_idx_s, uint32_t, uint16_t, H1_4, H1_2, DO_MLS) | ||
267 | -DO_ZZXW(sve2_umlsl_idx_d, uint64_t, uint32_t, , H1_4, DO_MLS) | ||
268 | +DO_ZZXW(sve2_umlsl_idx_d, uint64_t, uint32_t, H1_8, H1_4, DO_MLS) | ||
269 | |||
270 | #define DO_SQDMLAL_S(N, M, A) DO_SQADD_S(A, do_sqdmull_s(N, M)) | ||
271 | #define DO_SQDMLAL_D(N, M, A) do_sqadd_d(A, do_sqdmull_d(N, M)) | ||
272 | |||
273 | DO_ZZXW(sve2_sqdmlal_idx_s, int32_t, int16_t, H1_4, H1_2, DO_SQDMLAL_S) | ||
274 | -DO_ZZXW(sve2_sqdmlal_idx_d, int64_t, int32_t, , H1_4, DO_SQDMLAL_D) | ||
275 | +DO_ZZXW(sve2_sqdmlal_idx_d, int64_t, int32_t, H1_8, H1_4, DO_SQDMLAL_D) | ||
276 | |||
277 | #define DO_SQDMLSL_S(N, M, A) DO_SQSUB_S(A, do_sqdmull_s(N, M)) | ||
278 | #define DO_SQDMLSL_D(N, M, A) do_sqsub_d(A, do_sqdmull_d(N, M)) | ||
279 | |||
280 | DO_ZZXW(sve2_sqdmlsl_idx_s, int32_t, int16_t, H1_4, H1_2, DO_SQDMLSL_S) | ||
281 | -DO_ZZXW(sve2_sqdmlsl_idx_d, int64_t, int32_t, , H1_4, DO_SQDMLSL_D) | ||
282 | +DO_ZZXW(sve2_sqdmlsl_idx_d, int64_t, int32_t, H1_8, H1_4, DO_SQDMLSL_D) | ||
283 | |||
284 | #undef DO_MLA | ||
285 | #undef DO_MLS | ||
286 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
49 | } | 287 | } |
50 | 288 | ||
51 | static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | 289 | DO_ZZX(sve2_sqdmull_idx_s, int32_t, int16_t, H1_4, H1_2, do_sqdmull_s) |
52 | - int access_type, ARMMMUIdx mmu_idx) | 290 | -DO_ZZX(sve2_sqdmull_idx_d, int64_t, int32_t, , H1_4, do_sqdmull_d) |
53 | + MMUAccessType access_type, ARMMMUIdx mmu_idx) | 291 | +DO_ZZX(sve2_sqdmull_idx_d, int64_t, int32_t, H1_8, H1_4, do_sqdmull_d) |
292 | |||
293 | DO_ZZX(sve2_smull_idx_s, int32_t, int16_t, H1_4, H1_2, DO_MUL) | ||
294 | -DO_ZZX(sve2_smull_idx_d, int64_t, int32_t, , H1_4, DO_MUL) | ||
295 | +DO_ZZX(sve2_smull_idx_d, int64_t, int32_t, H1_8, H1_4, DO_MUL) | ||
296 | |||
297 | DO_ZZX(sve2_umull_idx_s, uint32_t, uint16_t, H1_4, H1_2, DO_MUL) | ||
298 | -DO_ZZX(sve2_umull_idx_d, uint64_t, uint32_t, , H1_4, DO_MUL) | ||
299 | +DO_ZZX(sve2_umull_idx_d, uint64_t, uint32_t, H1_8, H1_4, DO_MUL) | ||
300 | |||
301 | #undef DO_ZZX | ||
302 | |||
303 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
304 | DO_CADD(sve2_cadd_b, int8_t, H1, DO_ADD, DO_SUB) | ||
305 | DO_CADD(sve2_cadd_h, int16_t, H1_2, DO_ADD, DO_SUB) | ||
306 | DO_CADD(sve2_cadd_s, int32_t, H1_4, DO_ADD, DO_SUB) | ||
307 | -DO_CADD(sve2_cadd_d, int64_t, , DO_ADD, DO_SUB) | ||
308 | +DO_CADD(sve2_cadd_d, int64_t, H1_8, DO_ADD, DO_SUB) | ||
309 | |||
310 | DO_CADD(sve2_sqcadd_b, int8_t, H1, DO_SQADD_B, DO_SQSUB_B) | ||
311 | DO_CADD(sve2_sqcadd_h, int16_t, H1_2, DO_SQADD_H, DO_SQSUB_H) | ||
312 | DO_CADD(sve2_sqcadd_s, int32_t, H1_4, DO_SQADD_S, DO_SQSUB_S) | ||
313 | -DO_CADD(sve2_sqcadd_d, int64_t, , do_sqadd_d, do_sqsub_d) | ||
314 | +DO_CADD(sve2_sqcadd_d, int64_t, H1_8, do_sqadd_d, do_sqsub_d) | ||
315 | |||
316 | #undef DO_CADD | ||
317 | |||
318 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, uint32_t desc) \ | ||
319 | |||
320 | DO_ZZI_SHLL(sve2_sshll_h, int16_t, int8_t, H1_2, H1) | ||
321 | DO_ZZI_SHLL(sve2_sshll_s, int32_t, int16_t, H1_4, H1_2) | ||
322 | -DO_ZZI_SHLL(sve2_sshll_d, int64_t, int32_t, , H1_4) | ||
323 | +DO_ZZI_SHLL(sve2_sshll_d, int64_t, int32_t, H1_8, H1_4) | ||
324 | |||
325 | DO_ZZI_SHLL(sve2_ushll_h, uint16_t, uint8_t, H1_2, H1) | ||
326 | DO_ZZI_SHLL(sve2_ushll_s, uint32_t, uint16_t, H1_4, H1_2) | ||
327 | -DO_ZZI_SHLL(sve2_ushll_d, uint64_t, uint32_t, , H1_4) | ||
328 | +DO_ZZI_SHLL(sve2_ushll_d, uint64_t, uint32_t, H1_8, H1_4) | ||
329 | |||
330 | #undef DO_ZZI_SHLL | ||
331 | |||
332 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_shrnb_d, uint64_t, uint32_t, DO_SHR) | ||
333 | |||
334 | DO_SHRNT(sve2_shrnt_h, uint16_t, uint8_t, H1_2, H1, DO_SHR) | ||
335 | DO_SHRNT(sve2_shrnt_s, uint32_t, uint16_t, H1_4, H1_2, DO_SHR) | ||
336 | -DO_SHRNT(sve2_shrnt_d, uint64_t, uint32_t, , H1_4, DO_SHR) | ||
337 | +DO_SHRNT(sve2_shrnt_d, uint64_t, uint32_t, H1_8, H1_4, DO_SHR) | ||
338 | |||
339 | DO_SHRNB(sve2_rshrnb_h, uint16_t, uint8_t, do_urshr) | ||
340 | DO_SHRNB(sve2_rshrnb_s, uint32_t, uint16_t, do_urshr) | ||
341 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_rshrnb_d, uint64_t, uint32_t, do_urshr) | ||
342 | |||
343 | DO_SHRNT(sve2_rshrnt_h, uint16_t, uint8_t, H1_2, H1, do_urshr) | ||
344 | DO_SHRNT(sve2_rshrnt_s, uint32_t, uint16_t, H1_4, H1_2, do_urshr) | ||
345 | -DO_SHRNT(sve2_rshrnt_d, uint64_t, uint32_t, , H1_4, do_urshr) | ||
346 | +DO_SHRNT(sve2_rshrnt_d, uint64_t, uint32_t, H1_8, H1_4, do_urshr) | ||
347 | |||
348 | #define DO_SQSHRUN_H(x, sh) do_sat_bhs((int64_t)(x) >> sh, 0, UINT8_MAX) | ||
349 | #define DO_SQSHRUN_S(x, sh) do_sat_bhs((int64_t)(x) >> sh, 0, UINT16_MAX) | ||
350 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_sqshrunb_d, int64_t, uint32_t, DO_SQSHRUN_D) | ||
351 | |||
352 | DO_SHRNT(sve2_sqshrunt_h, int16_t, uint8_t, H1_2, H1, DO_SQSHRUN_H) | ||
353 | DO_SHRNT(sve2_sqshrunt_s, int32_t, uint16_t, H1_4, H1_2, DO_SQSHRUN_S) | ||
354 | -DO_SHRNT(sve2_sqshrunt_d, int64_t, uint32_t, , H1_4, DO_SQSHRUN_D) | ||
355 | +DO_SHRNT(sve2_sqshrunt_d, int64_t, uint32_t, H1_8, H1_4, DO_SQSHRUN_D) | ||
356 | |||
357 | #define DO_SQRSHRUN_H(x, sh) do_sat_bhs(do_srshr(x, sh), 0, UINT8_MAX) | ||
358 | #define DO_SQRSHRUN_S(x, sh) do_sat_bhs(do_srshr(x, sh), 0, UINT16_MAX) | ||
359 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_sqrshrunb_d, int64_t, uint32_t, DO_SQRSHRUN_D) | ||
360 | |||
361 | DO_SHRNT(sve2_sqrshrunt_h, int16_t, uint8_t, H1_2, H1, DO_SQRSHRUN_H) | ||
362 | DO_SHRNT(sve2_sqrshrunt_s, int32_t, uint16_t, H1_4, H1_2, DO_SQRSHRUN_S) | ||
363 | -DO_SHRNT(sve2_sqrshrunt_d, int64_t, uint32_t, , H1_4, DO_SQRSHRUN_D) | ||
364 | +DO_SHRNT(sve2_sqrshrunt_d, int64_t, uint32_t, H1_8, H1_4, DO_SQRSHRUN_D) | ||
365 | |||
366 | #define DO_SQSHRN_H(x, sh) do_sat_bhs(x >> sh, INT8_MIN, INT8_MAX) | ||
367 | #define DO_SQSHRN_S(x, sh) do_sat_bhs(x >> sh, INT16_MIN, INT16_MAX) | ||
368 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_sqshrnb_d, int64_t, uint32_t, DO_SQSHRN_D) | ||
369 | |||
370 | DO_SHRNT(sve2_sqshrnt_h, int16_t, uint8_t, H1_2, H1, DO_SQSHRN_H) | ||
371 | DO_SHRNT(sve2_sqshrnt_s, int32_t, uint16_t, H1_4, H1_2, DO_SQSHRN_S) | ||
372 | -DO_SHRNT(sve2_sqshrnt_d, int64_t, uint32_t, , H1_4, DO_SQSHRN_D) | ||
373 | +DO_SHRNT(sve2_sqshrnt_d, int64_t, uint32_t, H1_8, H1_4, DO_SQSHRN_D) | ||
374 | |||
375 | #define DO_SQRSHRN_H(x, sh) do_sat_bhs(do_srshr(x, sh), INT8_MIN, INT8_MAX) | ||
376 | #define DO_SQRSHRN_S(x, sh) do_sat_bhs(do_srshr(x, sh), INT16_MIN, INT16_MAX) | ||
377 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_sqrshrnb_d, int64_t, uint32_t, DO_SQRSHRN_D) | ||
378 | |||
379 | DO_SHRNT(sve2_sqrshrnt_h, int16_t, uint8_t, H1_2, H1, DO_SQRSHRN_H) | ||
380 | DO_SHRNT(sve2_sqrshrnt_s, int32_t, uint16_t, H1_4, H1_2, DO_SQRSHRN_S) | ||
381 | -DO_SHRNT(sve2_sqrshrnt_d, int64_t, uint32_t, , H1_4, DO_SQRSHRN_D) | ||
382 | +DO_SHRNT(sve2_sqrshrnt_d, int64_t, uint32_t, H1_8, H1_4, DO_SQRSHRN_D) | ||
383 | |||
384 | #define DO_UQSHRN_H(x, sh) MIN(x >> sh, UINT8_MAX) | ||
385 | #define DO_UQSHRN_S(x, sh) MIN(x >> sh, UINT16_MAX) | ||
386 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_uqshrnb_d, uint64_t, uint32_t, DO_UQSHRN_D) | ||
387 | |||
388 | DO_SHRNT(sve2_uqshrnt_h, uint16_t, uint8_t, H1_2, H1, DO_UQSHRN_H) | ||
389 | DO_SHRNT(sve2_uqshrnt_s, uint32_t, uint16_t, H1_4, H1_2, DO_UQSHRN_S) | ||
390 | -DO_SHRNT(sve2_uqshrnt_d, uint64_t, uint32_t, , H1_4, DO_UQSHRN_D) | ||
391 | +DO_SHRNT(sve2_uqshrnt_d, uint64_t, uint32_t, H1_8, H1_4, DO_UQSHRN_D) | ||
392 | |||
393 | #define DO_UQRSHRN_H(x, sh) MIN(do_urshr(x, sh), UINT8_MAX) | ||
394 | #define DO_UQRSHRN_S(x, sh) MIN(do_urshr(x, sh), UINT16_MAX) | ||
395 | @@ -XXX,XX +XXX,XX @@ DO_SHRNB(sve2_uqrshrnb_d, uint64_t, uint32_t, DO_UQRSHRN_D) | ||
396 | |||
397 | DO_SHRNT(sve2_uqrshrnt_h, uint16_t, uint8_t, H1_2, H1, DO_UQRSHRN_H) | ||
398 | DO_SHRNT(sve2_uqrshrnt_s, uint32_t, uint16_t, H1_4, H1_2, DO_UQRSHRN_S) | ||
399 | -DO_SHRNT(sve2_uqrshrnt_d, uint64_t, uint32_t, , H1_4, DO_UQRSHRN_D) | ||
400 | +DO_SHRNT(sve2_uqrshrnt_d, uint64_t, uint32_t, H1_8, H1_4, DO_UQRSHRN_D) | ||
401 | |||
402 | #undef DO_SHRNB | ||
403 | #undef DO_SHRNT | ||
404 | @@ -XXX,XX +XXX,XX @@ DO_BINOPNB(sve2_addhnb_d, uint64_t, uint32_t, 32, DO_ADDHN) | ||
405 | |||
406 | DO_BINOPNT(sve2_addhnt_h, uint16_t, uint8_t, 8, H1_2, H1, DO_ADDHN) | ||
407 | DO_BINOPNT(sve2_addhnt_s, uint32_t, uint16_t, 16, H1_4, H1_2, DO_ADDHN) | ||
408 | -DO_BINOPNT(sve2_addhnt_d, uint64_t, uint32_t, 32, , H1_4, DO_ADDHN) | ||
409 | +DO_BINOPNT(sve2_addhnt_d, uint64_t, uint32_t, 32, H1_8, H1_4, DO_ADDHN) | ||
410 | |||
411 | DO_BINOPNB(sve2_raddhnb_h, uint16_t, uint8_t, 8, DO_RADDHN) | ||
412 | DO_BINOPNB(sve2_raddhnb_s, uint32_t, uint16_t, 16, DO_RADDHN) | ||
413 | @@ -XXX,XX +XXX,XX @@ DO_BINOPNB(sve2_raddhnb_d, uint64_t, uint32_t, 32, DO_RADDHN) | ||
414 | |||
415 | DO_BINOPNT(sve2_raddhnt_h, uint16_t, uint8_t, 8, H1_2, H1, DO_RADDHN) | ||
416 | DO_BINOPNT(sve2_raddhnt_s, uint32_t, uint16_t, 16, H1_4, H1_2, DO_RADDHN) | ||
417 | -DO_BINOPNT(sve2_raddhnt_d, uint64_t, uint32_t, 32, , H1_4, DO_RADDHN) | ||
418 | +DO_BINOPNT(sve2_raddhnt_d, uint64_t, uint32_t, 32, H1_8, H1_4, DO_RADDHN) | ||
419 | |||
420 | DO_BINOPNB(sve2_subhnb_h, uint16_t, uint8_t, 8, DO_SUBHN) | ||
421 | DO_BINOPNB(sve2_subhnb_s, uint32_t, uint16_t, 16, DO_SUBHN) | ||
422 | @@ -XXX,XX +XXX,XX @@ DO_BINOPNB(sve2_subhnb_d, uint64_t, uint32_t, 32, DO_SUBHN) | ||
423 | |||
424 | DO_BINOPNT(sve2_subhnt_h, uint16_t, uint8_t, 8, H1_2, H1, DO_SUBHN) | ||
425 | DO_BINOPNT(sve2_subhnt_s, uint32_t, uint16_t, 16, H1_4, H1_2, DO_SUBHN) | ||
426 | -DO_BINOPNT(sve2_subhnt_d, uint64_t, uint32_t, 32, , H1_4, DO_SUBHN) | ||
427 | +DO_BINOPNT(sve2_subhnt_d, uint64_t, uint32_t, 32, H1_8, H1_4, DO_SUBHN) | ||
428 | |||
429 | DO_BINOPNB(sve2_rsubhnb_h, uint16_t, uint8_t, 8, DO_RSUBHN) | ||
430 | DO_BINOPNB(sve2_rsubhnb_s, uint32_t, uint16_t, 16, DO_RSUBHN) | ||
431 | @@ -XXX,XX +XXX,XX @@ DO_BINOPNB(sve2_rsubhnb_d, uint64_t, uint32_t, 32, DO_RSUBHN) | ||
432 | |||
433 | DO_BINOPNT(sve2_rsubhnt_h, uint16_t, uint8_t, 8, H1_2, H1, DO_RSUBHN) | ||
434 | DO_BINOPNT(sve2_rsubhnt_s, uint32_t, uint16_t, 16, H1_4, H1_2, DO_RSUBHN) | ||
435 | -DO_BINOPNT(sve2_rsubhnt_d, uint64_t, uint32_t, 32, , H1_4, DO_RSUBHN) | ||
436 | +DO_BINOPNT(sve2_rsubhnt_d, uint64_t, uint32_t, 32, H1_8, H1_4, DO_RSUBHN) | ||
437 | |||
438 | #undef DO_RSUBHN | ||
439 | #undef DO_SUBHN | ||
440 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, uint64_t val, uint32_t desc) \ | ||
441 | DO_INSR(sve_insr_b, uint8_t, H1) | ||
442 | DO_INSR(sve_insr_h, uint16_t, H1_2) | ||
443 | DO_INSR(sve_insr_s, uint32_t, H1_4) | ||
444 | -DO_INSR(sve_insr_d, uint64_t, ) | ||
445 | +DO_INSR(sve_insr_d, uint64_t, H1_8) | ||
446 | |||
447 | #undef DO_INSR | ||
448 | |||
449 | @@ -XXX,XX +XXX,XX @@ void HELPER(sve2_tbx_##SUFF)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
450 | DO_TB(b, uint8_t, H1) | ||
451 | DO_TB(h, uint16_t, H2) | ||
452 | DO_TB(s, uint32_t, H4) | ||
453 | -DO_TB(d, uint64_t, ) | ||
454 | +DO_TB(d, uint64_t, H8) | ||
455 | |||
456 | #undef DO_TB | ||
457 | |||
458 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, uint32_t desc) \ | ||
459 | |||
460 | DO_UNPK(sve_sunpk_h, int16_t, int8_t, H2, H1) | ||
461 | DO_UNPK(sve_sunpk_s, int32_t, int16_t, H4, H2) | ||
462 | -DO_UNPK(sve_sunpk_d, int64_t, int32_t, , H4) | ||
463 | +DO_UNPK(sve_sunpk_d, int64_t, int32_t, H8, H4) | ||
464 | |||
465 | DO_UNPK(sve_uunpk_h, uint16_t, uint8_t, H2, H1) | ||
466 | DO_UNPK(sve_uunpk_s, uint32_t, uint16_t, H4, H2) | ||
467 | -DO_UNPK(sve_uunpk_d, uint64_t, uint32_t, , H4) | ||
468 | +DO_UNPK(sve_uunpk_d, uint64_t, uint32_t, H8, H4) | ||
469 | |||
470 | #undef DO_UNPK | ||
471 | |||
472 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
473 | DO_ZIP(sve_zip_b, uint8_t, H1) | ||
474 | DO_ZIP(sve_zip_h, uint16_t, H1_2) | ||
475 | DO_ZIP(sve_zip_s, uint32_t, H1_4) | ||
476 | -DO_ZIP(sve_zip_d, uint64_t, ) | ||
477 | +DO_ZIP(sve_zip_d, uint64_t, H1_8) | ||
478 | DO_ZIP(sve2_zip_q, Int128, ) | ||
479 | |||
480 | #define DO_UZP(NAME, TYPE, H) \ | ||
481 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
482 | DO_UZP(sve_uzp_b, uint8_t, H1) | ||
483 | DO_UZP(sve_uzp_h, uint16_t, H1_2) | ||
484 | DO_UZP(sve_uzp_s, uint32_t, H1_4) | ||
485 | -DO_UZP(sve_uzp_d, uint64_t, ) | ||
486 | +DO_UZP(sve_uzp_d, uint64_t, H1_8) | ||
487 | DO_UZP(sve2_uzp_q, Int128, ) | ||
488 | |||
489 | #define DO_TRN(NAME, TYPE, H) \ | ||
490 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ | ||
491 | DO_TRN(sve_trn_b, uint8_t, H1) | ||
492 | DO_TRN(sve_trn_h, uint16_t, H1_2) | ||
493 | DO_TRN(sve_trn_s, uint32_t, H1_4) | ||
494 | -DO_TRN(sve_trn_d, uint64_t, ) | ||
495 | +DO_TRN(sve_trn_d, uint64_t, H1_8) | ||
496 | DO_TRN(sve2_trn_q, Int128, ) | ||
497 | |||
498 | #undef DO_ZIP | ||
499 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, uint32_t desc) \ | ||
500 | #define DO_CMP_PPZZ_S(NAME, TYPE, OP) \ | ||
501 | DO_CMP_PPZZ(NAME, TYPE, OP, H1_4, 0x1111111111111111ull) | ||
502 | #define DO_CMP_PPZZ_D(NAME, TYPE, OP) \ | ||
503 | - DO_CMP_PPZZ(NAME, TYPE, OP, , 0x0101010101010101ull) | ||
504 | + DO_CMP_PPZZ(NAME, TYPE, OP, H1_8, 0x0101010101010101ull) | ||
505 | |||
506 | DO_CMP_PPZZ_B(sve_cmpeq_ppzz_b, uint8_t, ==) | ||
507 | DO_CMP_PPZZ_H(sve_cmpeq_ppzz_h, uint16_t, ==) | ||
508 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(NAME)(void *vd, void *vn, void *vg, uint32_t desc) \ | ||
509 | #define DO_CMP_PPZI_S(NAME, TYPE, OP) \ | ||
510 | DO_CMP_PPZI(NAME, TYPE, OP, H1_4, 0x1111111111111111ull) | ||
511 | #define DO_CMP_PPZI_D(NAME, TYPE, OP) \ | ||
512 | - DO_CMP_PPZI(NAME, TYPE, OP, , 0x0101010101010101ull) | ||
513 | + DO_CMP_PPZI(NAME, TYPE, OP, H1_8, 0x0101010101010101ull) | ||
514 | |||
515 | DO_CMP_PPZI_B(sve_cmpeq_ppzi_b, uint8_t, ==) | ||
516 | DO_CMP_PPZI_H(sve_cmpeq_ppzi_h, uint16_t, ==) | ||
517 | @@ -XXX,XX +XXX,XX @@ uint64_t HELPER(NAME)(void *vn, void *vg, void *vs, uint32_t desc) \ | ||
518 | |||
519 | DO_REDUCE(sve_faddv_h, float16, H1_2, add, float16_zero) | ||
520 | DO_REDUCE(sve_faddv_s, float32, H1_4, add, float32_zero) | ||
521 | -DO_REDUCE(sve_faddv_d, float64, , add, float64_zero) | ||
522 | +DO_REDUCE(sve_faddv_d, float64, H1_8, add, float64_zero) | ||
523 | |||
524 | /* Identity is floatN_default_nan, without the function call. */ | ||
525 | DO_REDUCE(sve_fminnmv_h, float16, H1_2, minnum, 0x7E00) | ||
526 | DO_REDUCE(sve_fminnmv_s, float32, H1_4, minnum, 0x7FC00000) | ||
527 | -DO_REDUCE(sve_fminnmv_d, float64, , minnum, 0x7FF8000000000000ULL) | ||
528 | +DO_REDUCE(sve_fminnmv_d, float64, H1_8, minnum, 0x7FF8000000000000ULL) | ||
529 | |||
530 | DO_REDUCE(sve_fmaxnmv_h, float16, H1_2, maxnum, 0x7E00) | ||
531 | DO_REDUCE(sve_fmaxnmv_s, float32, H1_4, maxnum, 0x7FC00000) | ||
532 | -DO_REDUCE(sve_fmaxnmv_d, float64, , maxnum, 0x7FF8000000000000ULL) | ||
533 | +DO_REDUCE(sve_fmaxnmv_d, float64, H1_8, maxnum, 0x7FF8000000000000ULL) | ||
534 | |||
535 | DO_REDUCE(sve_fminv_h, float16, H1_2, min, float16_infinity) | ||
536 | DO_REDUCE(sve_fminv_s, float32, H1_4, min, float32_infinity) | ||
537 | -DO_REDUCE(sve_fminv_d, float64, , min, float64_infinity) | ||
538 | +DO_REDUCE(sve_fminv_d, float64, H1_8, min, float64_infinity) | ||
539 | |||
540 | DO_REDUCE(sve_fmaxv_h, float16, H1_2, max, float16_chs(float16_infinity)) | ||
541 | DO_REDUCE(sve_fmaxv_s, float32, H1_4, max, float32_chs(float32_infinity)) | ||
542 | -DO_REDUCE(sve_fmaxv_d, float64, , max, float64_chs(float64_infinity)) | ||
543 | +DO_REDUCE(sve_fmaxv_d, float64, H1_8, max, float64_chs(float64_infinity)) | ||
544 | |||
545 | #undef DO_REDUCE | ||
546 | |||
547 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, \ | ||
548 | |||
549 | DO_ZPZZ_FP(sve_fadd_h, uint16_t, H1_2, float16_add) | ||
550 | DO_ZPZZ_FP(sve_fadd_s, uint32_t, H1_4, float32_add) | ||
551 | -DO_ZPZZ_FP(sve_fadd_d, uint64_t, , float64_add) | ||
552 | +DO_ZPZZ_FP(sve_fadd_d, uint64_t, H1_8, float64_add) | ||
553 | |||
554 | DO_ZPZZ_FP(sve_fsub_h, uint16_t, H1_2, float16_sub) | ||
555 | DO_ZPZZ_FP(sve_fsub_s, uint32_t, H1_4, float32_sub) | ||
556 | -DO_ZPZZ_FP(sve_fsub_d, uint64_t, , float64_sub) | ||
557 | +DO_ZPZZ_FP(sve_fsub_d, uint64_t, H1_8, float64_sub) | ||
558 | |||
559 | DO_ZPZZ_FP(sve_fmul_h, uint16_t, H1_2, float16_mul) | ||
560 | DO_ZPZZ_FP(sve_fmul_s, uint32_t, H1_4, float32_mul) | ||
561 | -DO_ZPZZ_FP(sve_fmul_d, uint64_t, , float64_mul) | ||
562 | +DO_ZPZZ_FP(sve_fmul_d, uint64_t, H1_8, float64_mul) | ||
563 | |||
564 | DO_ZPZZ_FP(sve_fdiv_h, uint16_t, H1_2, float16_div) | ||
565 | DO_ZPZZ_FP(sve_fdiv_s, uint32_t, H1_4, float32_div) | ||
566 | -DO_ZPZZ_FP(sve_fdiv_d, uint64_t, , float64_div) | ||
567 | +DO_ZPZZ_FP(sve_fdiv_d, uint64_t, H1_8, float64_div) | ||
568 | |||
569 | DO_ZPZZ_FP(sve_fmin_h, uint16_t, H1_2, float16_min) | ||
570 | DO_ZPZZ_FP(sve_fmin_s, uint32_t, H1_4, float32_min) | ||
571 | -DO_ZPZZ_FP(sve_fmin_d, uint64_t, , float64_min) | ||
572 | +DO_ZPZZ_FP(sve_fmin_d, uint64_t, H1_8, float64_min) | ||
573 | |||
574 | DO_ZPZZ_FP(sve_fmax_h, uint16_t, H1_2, float16_max) | ||
575 | DO_ZPZZ_FP(sve_fmax_s, uint32_t, H1_4, float32_max) | ||
576 | -DO_ZPZZ_FP(sve_fmax_d, uint64_t, , float64_max) | ||
577 | +DO_ZPZZ_FP(sve_fmax_d, uint64_t, H1_8, float64_max) | ||
578 | |||
579 | DO_ZPZZ_FP(sve_fminnum_h, uint16_t, H1_2, float16_minnum) | ||
580 | DO_ZPZZ_FP(sve_fminnum_s, uint32_t, H1_4, float32_minnum) | ||
581 | -DO_ZPZZ_FP(sve_fminnum_d, uint64_t, , float64_minnum) | ||
582 | +DO_ZPZZ_FP(sve_fminnum_d, uint64_t, H1_8, float64_minnum) | ||
583 | |||
584 | DO_ZPZZ_FP(sve_fmaxnum_h, uint16_t, H1_2, float16_maxnum) | ||
585 | DO_ZPZZ_FP(sve_fmaxnum_s, uint32_t, H1_4, float32_maxnum) | ||
586 | -DO_ZPZZ_FP(sve_fmaxnum_d, uint64_t, , float64_maxnum) | ||
587 | +DO_ZPZZ_FP(sve_fmaxnum_d, uint64_t, H1_8, float64_maxnum) | ||
588 | |||
589 | static inline float16 abd_h(float16 a, float16 b, float_status *s) | ||
54 | { | 590 | { |
55 | hwaddr phys_addr; | 591 | @@ -XXX,XX +XXX,XX @@ static inline float64 abd_d(float64 a, float64 b, float_status *s) |
56 | target_ulong page_size; | 592 | |
57 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | 593 | DO_ZPZZ_FP(sve_fabd_h, uint16_t, H1_2, abd_h) |
58 | 594 | DO_ZPZZ_FP(sve_fabd_s, uint32_t, H1_4, abd_s) | |
59 | static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 595 | -DO_ZPZZ_FP(sve_fabd_d, uint64_t, , abd_d) |
596 | +DO_ZPZZ_FP(sve_fabd_d, uint64_t, H1_8, abd_d) | ||
597 | |||
598 | static inline float64 scalbn_d(float64 a, int64_t b, float_status *s) | ||
60 | { | 599 | { |
61 | - int access_type = ri->opc2 & 1; | 600 | @@ -XXX,XX +XXX,XX @@ static inline float64 scalbn_d(float64 a, int64_t b, float_status *s) |
62 | + MMUAccessType access_type = ri->opc2 & 1 ? MMU_DATA_STORE : MMU_DATA_LOAD; | 601 | |
63 | uint64_t par64; | 602 | DO_ZPZZ_FP(sve_fscalbn_h, int16_t, H1_2, float16_scalbn) |
64 | ARMMMUIdx mmu_idx; | 603 | DO_ZPZZ_FP(sve_fscalbn_s, int32_t, H1_4, float32_scalbn) |
65 | int el = arm_current_el(env); | 604 | -DO_ZPZZ_FP(sve_fscalbn_d, int64_t, , scalbn_d) |
66 | @@ -XXX,XX +XXX,XX @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 605 | +DO_ZPZZ_FP(sve_fscalbn_d, int64_t, H1_8, scalbn_d) |
67 | static void ats1h_write(CPUARMState *env, const ARMCPRegInfo *ri, | 606 | |
68 | uint64_t value) | 607 | DO_ZPZZ_FP(sve_fmulx_h, uint16_t, H1_2, helper_advsimd_mulxh) |
608 | DO_ZPZZ_FP(sve_fmulx_s, uint32_t, H1_4, helper_vfp_mulxs) | ||
609 | -DO_ZPZZ_FP(sve_fmulx_d, uint64_t, , helper_vfp_mulxd) | ||
610 | +DO_ZPZZ_FP(sve_fmulx_d, uint64_t, H1_8, helper_vfp_mulxd) | ||
611 | |||
612 | #undef DO_ZPZZ_FP | ||
613 | |||
614 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vg, uint64_t scalar, \ | ||
615 | |||
616 | DO_ZPZS_FP(sve_fadds_h, float16, H1_2, float16_add) | ||
617 | DO_ZPZS_FP(sve_fadds_s, float32, H1_4, float32_add) | ||
618 | -DO_ZPZS_FP(sve_fadds_d, float64, , float64_add) | ||
619 | +DO_ZPZS_FP(sve_fadds_d, float64, H1_8, float64_add) | ||
620 | |||
621 | DO_ZPZS_FP(sve_fsubs_h, float16, H1_2, float16_sub) | ||
622 | DO_ZPZS_FP(sve_fsubs_s, float32, H1_4, float32_sub) | ||
623 | -DO_ZPZS_FP(sve_fsubs_d, float64, , float64_sub) | ||
624 | +DO_ZPZS_FP(sve_fsubs_d, float64, H1_8, float64_sub) | ||
625 | |||
626 | DO_ZPZS_FP(sve_fmuls_h, float16, H1_2, float16_mul) | ||
627 | DO_ZPZS_FP(sve_fmuls_s, float32, H1_4, float32_mul) | ||
628 | -DO_ZPZS_FP(sve_fmuls_d, float64, , float64_mul) | ||
629 | +DO_ZPZS_FP(sve_fmuls_d, float64, H1_8, float64_mul) | ||
630 | |||
631 | static inline float16 subr_h(float16 a, float16 b, float_status *s) | ||
69 | { | 632 | { |
70 | - int access_type = ri->opc2 & 1; | 633 | @@ -XXX,XX +XXX,XX @@ static inline float64 subr_d(float64 a, float64 b, float_status *s) |
71 | + MMUAccessType access_type = ri->opc2 & 1 ? MMU_DATA_STORE : MMU_DATA_LOAD; | 634 | |
72 | uint64_t par64; | 635 | DO_ZPZS_FP(sve_fsubrs_h, float16, H1_2, subr_h) |
73 | 636 | DO_ZPZS_FP(sve_fsubrs_s, float32, H1_4, subr_s) | |
74 | par64 = do_ats_write(env, value, access_type, ARMMMUIdx_S2NS); | 637 | -DO_ZPZS_FP(sve_fsubrs_d, float64, , subr_d) |
75 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult at_s1e2_access(CPUARMState *env, const ARMCPRegInfo *ri, | 638 | +DO_ZPZS_FP(sve_fsubrs_d, float64, H1_8, subr_d) |
76 | static void ats_write64(CPUARMState *env, const ARMCPRegInfo *ri, | 639 | |
77 | uint64_t value) | 640 | DO_ZPZS_FP(sve_fmaxnms_h, float16, H1_2, float16_maxnum) |
641 | DO_ZPZS_FP(sve_fmaxnms_s, float32, H1_4, float32_maxnum) | ||
642 | -DO_ZPZS_FP(sve_fmaxnms_d, float64, , float64_maxnum) | ||
643 | +DO_ZPZS_FP(sve_fmaxnms_d, float64, H1_8, float64_maxnum) | ||
644 | |||
645 | DO_ZPZS_FP(sve_fminnms_h, float16, H1_2, float16_minnum) | ||
646 | DO_ZPZS_FP(sve_fminnms_s, float32, H1_4, float32_minnum) | ||
647 | -DO_ZPZS_FP(sve_fminnms_d, float64, , float64_minnum) | ||
648 | +DO_ZPZS_FP(sve_fminnms_d, float64, H1_8, float64_minnum) | ||
649 | |||
650 | DO_ZPZS_FP(sve_fmaxs_h, float16, H1_2, float16_max) | ||
651 | DO_ZPZS_FP(sve_fmaxs_s, float32, H1_4, float32_max) | ||
652 | -DO_ZPZS_FP(sve_fmaxs_d, float64, , float64_max) | ||
653 | +DO_ZPZS_FP(sve_fmaxs_d, float64, H1_8, float64_max) | ||
654 | |||
655 | DO_ZPZS_FP(sve_fmins_h, float16, H1_2, float16_min) | ||
656 | DO_ZPZS_FP(sve_fmins_s, float32, H1_4, float32_min) | ||
657 | -DO_ZPZS_FP(sve_fmins_d, float64, , float64_min) | ||
658 | +DO_ZPZS_FP(sve_fmins_d, float64, H1_8, float64_min) | ||
659 | |||
660 | /* Fully general two-operand expander, controlled by a predicate, | ||
661 | * With the extra float_status parameter. | ||
662 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t vfp_float64_to_uint64_rtz(float64 f, float_status *s) | ||
663 | DO_ZPZ_FP(sve_fcvt_sh, uint32_t, H1_4, sve_f32_to_f16) | ||
664 | DO_ZPZ_FP(sve_fcvt_hs, uint32_t, H1_4, sve_f16_to_f32) | ||
665 | DO_ZPZ_FP(sve_bfcvt, uint32_t, H1_4, float32_to_bfloat16) | ||
666 | -DO_ZPZ_FP(sve_fcvt_dh, uint64_t, , sve_f64_to_f16) | ||
667 | -DO_ZPZ_FP(sve_fcvt_hd, uint64_t, , sve_f16_to_f64) | ||
668 | -DO_ZPZ_FP(sve_fcvt_ds, uint64_t, , float64_to_float32) | ||
669 | -DO_ZPZ_FP(sve_fcvt_sd, uint64_t, , float32_to_float64) | ||
670 | +DO_ZPZ_FP(sve_fcvt_dh, uint64_t, H1_8, sve_f64_to_f16) | ||
671 | +DO_ZPZ_FP(sve_fcvt_hd, uint64_t, H1_8, sve_f16_to_f64) | ||
672 | +DO_ZPZ_FP(sve_fcvt_ds, uint64_t, H1_8, float64_to_float32) | ||
673 | +DO_ZPZ_FP(sve_fcvt_sd, uint64_t, H1_8, float32_to_float64) | ||
674 | |||
675 | DO_ZPZ_FP(sve_fcvtzs_hh, uint16_t, H1_2, vfp_float16_to_int16_rtz) | ||
676 | DO_ZPZ_FP(sve_fcvtzs_hs, uint32_t, H1_4, helper_vfp_tosizh) | ||
677 | DO_ZPZ_FP(sve_fcvtzs_ss, uint32_t, H1_4, helper_vfp_tosizs) | ||
678 | -DO_ZPZ_FP(sve_fcvtzs_hd, uint64_t, , vfp_float16_to_int64_rtz) | ||
679 | -DO_ZPZ_FP(sve_fcvtzs_sd, uint64_t, , vfp_float32_to_int64_rtz) | ||
680 | -DO_ZPZ_FP(sve_fcvtzs_ds, uint64_t, , helper_vfp_tosizd) | ||
681 | -DO_ZPZ_FP(sve_fcvtzs_dd, uint64_t, , vfp_float64_to_int64_rtz) | ||
682 | +DO_ZPZ_FP(sve_fcvtzs_hd, uint64_t, H1_8, vfp_float16_to_int64_rtz) | ||
683 | +DO_ZPZ_FP(sve_fcvtzs_sd, uint64_t, H1_8, vfp_float32_to_int64_rtz) | ||
684 | +DO_ZPZ_FP(sve_fcvtzs_ds, uint64_t, H1_8, helper_vfp_tosizd) | ||
685 | +DO_ZPZ_FP(sve_fcvtzs_dd, uint64_t, H1_8, vfp_float64_to_int64_rtz) | ||
686 | |||
687 | DO_ZPZ_FP(sve_fcvtzu_hh, uint16_t, H1_2, vfp_float16_to_uint16_rtz) | ||
688 | DO_ZPZ_FP(sve_fcvtzu_hs, uint32_t, H1_4, helper_vfp_touizh) | ||
689 | DO_ZPZ_FP(sve_fcvtzu_ss, uint32_t, H1_4, helper_vfp_touizs) | ||
690 | -DO_ZPZ_FP(sve_fcvtzu_hd, uint64_t, , vfp_float16_to_uint64_rtz) | ||
691 | -DO_ZPZ_FP(sve_fcvtzu_sd, uint64_t, , vfp_float32_to_uint64_rtz) | ||
692 | -DO_ZPZ_FP(sve_fcvtzu_ds, uint64_t, , helper_vfp_touizd) | ||
693 | -DO_ZPZ_FP(sve_fcvtzu_dd, uint64_t, , vfp_float64_to_uint64_rtz) | ||
694 | +DO_ZPZ_FP(sve_fcvtzu_hd, uint64_t, H1_8, vfp_float16_to_uint64_rtz) | ||
695 | +DO_ZPZ_FP(sve_fcvtzu_sd, uint64_t, H1_8, vfp_float32_to_uint64_rtz) | ||
696 | +DO_ZPZ_FP(sve_fcvtzu_ds, uint64_t, H1_8, helper_vfp_touizd) | ||
697 | +DO_ZPZ_FP(sve_fcvtzu_dd, uint64_t, H1_8, vfp_float64_to_uint64_rtz) | ||
698 | |||
699 | DO_ZPZ_FP(sve_frint_h, uint16_t, H1_2, helper_advsimd_rinth) | ||
700 | DO_ZPZ_FP(sve_frint_s, uint32_t, H1_4, helper_rints) | ||
701 | -DO_ZPZ_FP(sve_frint_d, uint64_t, , helper_rintd) | ||
702 | +DO_ZPZ_FP(sve_frint_d, uint64_t, H1_8, helper_rintd) | ||
703 | |||
704 | DO_ZPZ_FP(sve_frintx_h, uint16_t, H1_2, float16_round_to_int) | ||
705 | DO_ZPZ_FP(sve_frintx_s, uint32_t, H1_4, float32_round_to_int) | ||
706 | -DO_ZPZ_FP(sve_frintx_d, uint64_t, , float64_round_to_int) | ||
707 | +DO_ZPZ_FP(sve_frintx_d, uint64_t, H1_8, float64_round_to_int) | ||
708 | |||
709 | DO_ZPZ_FP(sve_frecpx_h, uint16_t, H1_2, helper_frecpx_f16) | ||
710 | DO_ZPZ_FP(sve_frecpx_s, uint32_t, H1_4, helper_frecpx_f32) | ||
711 | -DO_ZPZ_FP(sve_frecpx_d, uint64_t, , helper_frecpx_f64) | ||
712 | +DO_ZPZ_FP(sve_frecpx_d, uint64_t, H1_8, helper_frecpx_f64) | ||
713 | |||
714 | DO_ZPZ_FP(sve_fsqrt_h, uint16_t, H1_2, float16_sqrt) | ||
715 | DO_ZPZ_FP(sve_fsqrt_s, uint32_t, H1_4, float32_sqrt) | ||
716 | -DO_ZPZ_FP(sve_fsqrt_d, uint64_t, , float64_sqrt) | ||
717 | +DO_ZPZ_FP(sve_fsqrt_d, uint64_t, H1_8, float64_sqrt) | ||
718 | |||
719 | DO_ZPZ_FP(sve_scvt_hh, uint16_t, H1_2, int16_to_float16) | ||
720 | DO_ZPZ_FP(sve_scvt_sh, uint32_t, H1_4, int32_to_float16) | ||
721 | DO_ZPZ_FP(sve_scvt_ss, uint32_t, H1_4, int32_to_float32) | ||
722 | -DO_ZPZ_FP(sve_scvt_sd, uint64_t, , int32_to_float64) | ||
723 | -DO_ZPZ_FP(sve_scvt_dh, uint64_t, , int64_to_float16) | ||
724 | -DO_ZPZ_FP(sve_scvt_ds, uint64_t, , int64_to_float32) | ||
725 | -DO_ZPZ_FP(sve_scvt_dd, uint64_t, , int64_to_float64) | ||
726 | +DO_ZPZ_FP(sve_scvt_sd, uint64_t, H1_8, int32_to_float64) | ||
727 | +DO_ZPZ_FP(sve_scvt_dh, uint64_t, H1_8, int64_to_float16) | ||
728 | +DO_ZPZ_FP(sve_scvt_ds, uint64_t, H1_8, int64_to_float32) | ||
729 | +DO_ZPZ_FP(sve_scvt_dd, uint64_t, H1_8, int64_to_float64) | ||
730 | |||
731 | DO_ZPZ_FP(sve_ucvt_hh, uint16_t, H1_2, uint16_to_float16) | ||
732 | DO_ZPZ_FP(sve_ucvt_sh, uint32_t, H1_4, uint32_to_float16) | ||
733 | DO_ZPZ_FP(sve_ucvt_ss, uint32_t, H1_4, uint32_to_float32) | ||
734 | -DO_ZPZ_FP(sve_ucvt_sd, uint64_t, , uint32_to_float64) | ||
735 | -DO_ZPZ_FP(sve_ucvt_dh, uint64_t, , uint64_to_float16) | ||
736 | -DO_ZPZ_FP(sve_ucvt_ds, uint64_t, , uint64_to_float32) | ||
737 | -DO_ZPZ_FP(sve_ucvt_dd, uint64_t, , uint64_to_float64) | ||
738 | +DO_ZPZ_FP(sve_ucvt_sd, uint64_t, H1_8, uint32_to_float64) | ||
739 | +DO_ZPZ_FP(sve_ucvt_dh, uint64_t, H1_8, uint64_to_float16) | ||
740 | +DO_ZPZ_FP(sve_ucvt_ds, uint64_t, H1_8, uint64_to_float32) | ||
741 | +DO_ZPZ_FP(sve_ucvt_dd, uint64_t, H1_8, uint64_to_float64) | ||
742 | |||
743 | static int16_t do_float16_logb_as_int(float16 a, float_status *s) | ||
78 | { | 744 | { |
79 | - int access_type = ri->opc2 & 1; | 745 | @@ -XXX,XX +XXX,XX @@ static int64_t do_float64_logb_as_int(float64 a, float_status *s) |
80 | + MMUAccessType access_type = ri->opc2 & 1 ? MMU_DATA_STORE : MMU_DATA_LOAD; | 746 | |
81 | ARMMMUIdx mmu_idx; | 747 | DO_ZPZ_FP(flogb_h, float16, H1_2, do_float16_logb_as_int) |
82 | int secure = arm_is_secure_below_el3(env); | 748 | DO_ZPZ_FP(flogb_s, float32, H1_4, do_float32_logb_as_int) |
83 | 749 | -DO_ZPZ_FP(flogb_d, float64, , do_float64_logb_as_int) | |
84 | @@ -XXX,XX +XXX,XX @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure, | 750 | +DO_ZPZ_FP(flogb_d, float64, H1_8, do_float64_logb_as_int) |
751 | |||
752 | #undef DO_ZPZ_FP | ||
753 | |||
754 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, \ | ||
755 | #define DO_FPCMP_PPZZ_S(NAME, OP) \ | ||
756 | DO_FPCMP_PPZZ(NAME##_s, float32, H1_4, OP) | ||
757 | #define DO_FPCMP_PPZZ_D(NAME, OP) \ | ||
758 | - DO_FPCMP_PPZZ(NAME##_d, float64, , OP) | ||
759 | + DO_FPCMP_PPZZ(NAME##_d, float64, H1_8, OP) | ||
760 | |||
761 | #define DO_FPCMP_PPZZ_ALL(NAME, OP) \ | ||
762 | DO_FPCMP_PPZZ_H(NAME, OP) \ | ||
763 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vg, \ | ||
764 | #define DO_FPCMP_PPZ0_S(NAME, OP) \ | ||
765 | DO_FPCMP_PPZ0(NAME##_s, float32, H1_4, OP) | ||
766 | #define DO_FPCMP_PPZ0_D(NAME, OP) \ | ||
767 | - DO_FPCMP_PPZ0(NAME##_d, float64, , OP) | ||
768 | + DO_FPCMP_PPZ0(NAME##_d, float64, H1_8, OP) | ||
769 | |||
770 | #define DO_FPCMP_PPZ0_ALL(NAME, OP) \ | ||
771 | DO_FPCMP_PPZ0_H(NAME, OP) \ | ||
772 | @@ -XXX,XX +XXX,XX @@ DO_LD_PRIM_1(ld1bhu, H1_2, uint16_t, uint8_t) | ||
773 | DO_LD_PRIM_1(ld1bhs, H1_2, uint16_t, int8_t) | ||
774 | DO_LD_PRIM_1(ld1bsu, H1_4, uint32_t, uint8_t) | ||
775 | DO_LD_PRIM_1(ld1bss, H1_4, uint32_t, int8_t) | ||
776 | -DO_LD_PRIM_1(ld1bdu, , uint64_t, uint8_t) | ||
777 | -DO_LD_PRIM_1(ld1bds, , uint64_t, int8_t) | ||
778 | +DO_LD_PRIM_1(ld1bdu, H1_8, uint64_t, uint8_t) | ||
779 | +DO_LD_PRIM_1(ld1bds, H1_8, uint64_t, int8_t) | ||
780 | |||
781 | #define DO_ST_PRIM_1(NAME, H, TE, TM) \ | ||
782 | DO_ST_HOST(st1##NAME, H, TE, TM, stb_p) \ | ||
783 | @@ -XXX,XX +XXX,XX @@ DO_LD_PRIM_1(ld1bds, , uint64_t, int8_t) | ||
784 | DO_ST_PRIM_1(bb, H1, uint8_t, uint8_t) | ||
785 | DO_ST_PRIM_1(bh, H1_2, uint16_t, uint8_t) | ||
786 | DO_ST_PRIM_1(bs, H1_4, uint32_t, uint8_t) | ||
787 | -DO_ST_PRIM_1(bd, , uint64_t, uint8_t) | ||
788 | +DO_ST_PRIM_1(bd, H1_8, uint64_t, uint8_t) | ||
789 | |||
790 | #define DO_LD_PRIM_2(NAME, H, TE, TM, LD) \ | ||
791 | DO_LD_HOST(ld1##NAME##_be, H, TE, TM, LD##_be_p) \ | ||
792 | @@ -XXX,XX +XXX,XX @@ DO_ST_PRIM_1(bd, , uint64_t, uint8_t) | ||
793 | DO_LD_PRIM_2(hh, H1_2, uint16_t, uint16_t, lduw) | ||
794 | DO_LD_PRIM_2(hsu, H1_4, uint32_t, uint16_t, lduw) | ||
795 | DO_LD_PRIM_2(hss, H1_4, uint32_t, int16_t, lduw) | ||
796 | -DO_LD_PRIM_2(hdu, , uint64_t, uint16_t, lduw) | ||
797 | -DO_LD_PRIM_2(hds, , uint64_t, int16_t, lduw) | ||
798 | +DO_LD_PRIM_2(hdu, H1_8, uint64_t, uint16_t, lduw) | ||
799 | +DO_LD_PRIM_2(hds, H1_8, uint64_t, int16_t, lduw) | ||
800 | |||
801 | DO_ST_PRIM_2(hh, H1_2, uint16_t, uint16_t, stw) | ||
802 | DO_ST_PRIM_2(hs, H1_4, uint32_t, uint16_t, stw) | ||
803 | -DO_ST_PRIM_2(hd, , uint64_t, uint16_t, stw) | ||
804 | +DO_ST_PRIM_2(hd, H1_8, uint64_t, uint16_t, stw) | ||
805 | |||
806 | DO_LD_PRIM_2(ss, H1_4, uint32_t, uint32_t, ldl) | ||
807 | -DO_LD_PRIM_2(sdu, , uint64_t, uint32_t, ldl) | ||
808 | -DO_LD_PRIM_2(sds, , uint64_t, int32_t, ldl) | ||
809 | +DO_LD_PRIM_2(sdu, H1_8, uint64_t, uint32_t, ldl) | ||
810 | +DO_LD_PRIM_2(sds, H1_8, uint64_t, int32_t, ldl) | ||
811 | |||
812 | DO_ST_PRIM_2(ss, H1_4, uint32_t, uint32_t, stl) | ||
813 | -DO_ST_PRIM_2(sd, , uint64_t, uint32_t, stl) | ||
814 | +DO_ST_PRIM_2(sd, H1_8, uint64_t, uint32_t, stl) | ||
815 | |||
816 | -DO_LD_PRIM_2(dd, , uint64_t, uint64_t, ldq) | ||
817 | -DO_ST_PRIM_2(dd, , uint64_t, uint64_t, stq) | ||
818 | +DO_LD_PRIM_2(dd, H1_8, uint64_t, uint64_t, ldq) | ||
819 | +DO_ST_PRIM_2(dd, H1_8, uint64_t, uint64_t, stq) | ||
820 | |||
821 | #undef DO_LD_TLB | ||
822 | #undef DO_ST_TLB | ||
823 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vg, void *status, uint32_t desc) \ | ||
824 | |||
825 | DO_FCVTNT(sve_bfcvtnt, uint32_t, uint16_t, H1_4, H1_2, float32_to_bfloat16) | ||
826 | DO_FCVTNT(sve2_fcvtnt_sh, uint32_t, uint16_t, H1_4, H1_2, sve_f32_to_f16) | ||
827 | -DO_FCVTNT(sve2_fcvtnt_ds, uint64_t, uint32_t, , H1_4, float64_to_float32) | ||
828 | +DO_FCVTNT(sve2_fcvtnt_ds, uint64_t, uint32_t, H1_8, H1_4, float64_to_float32) | ||
829 | |||
830 | #define DO_FCVTLT(NAME, TYPEW, TYPEN, HW, HN, OP) \ | ||
831 | void HELPER(NAME)(void *vd, void *vn, void *vg, void *status, uint32_t desc) \ | ||
832 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vg, void *status, uint32_t desc) \ | ||
85 | } | 833 | } |
86 | 834 | ||
87 | static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | 835 | DO_FCVTLT(sve2_fcvtlt_hs, uint32_t, uint16_t, H1_4, H1_2, sve_f16_to_f32) |
88 | - int access_type, ARMMMUIdx mmu_idx, | 836 | -DO_FCVTLT(sve2_fcvtlt_sd, uint64_t, uint32_t, , H1_4, float32_to_float64) |
89 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 837 | +DO_FCVTLT(sve2_fcvtlt_sd, uint64_t, uint32_t, H1_8, H1_4, float32_to_float64) |
90 | hwaddr *phys_ptr, int *prot, | 838 | |
91 | target_ulong *page_size, uint32_t *fsr, | 839 | #undef DO_FCVTLT |
92 | ARMMMUFaultInfo *fi) | 840 | #undef DO_FCVTNT |
93 | @@ -XXX,XX +XXX,XX @@ do_fault: | 841 | diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c |
94 | } | 842 | index XXXXXXX..XXXXXXX 100644 |
95 | 843 | --- a/target/arm/vec_helper.c | |
96 | static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, | 844 | +++ b/target/arm/vec_helper.c |
97 | - int access_type, ARMMMUIdx mmu_idx, | 845 | @@ -XXX,XX +XXX,XX @@ DO_DOT_IDX(gvec_sdot_idx_b, int32_t, int8_t, int8_t, H4) |
98 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 846 | DO_DOT_IDX(gvec_udot_idx_b, uint32_t, uint8_t, uint8_t, H4) |
99 | hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, | 847 | DO_DOT_IDX(gvec_sudot_idx_b, int32_t, int8_t, uint8_t, H4) |
100 | target_ulong *page_size, uint32_t *fsr, | 848 | DO_DOT_IDX(gvec_usdot_idx_b, int32_t, uint8_t, int8_t, H4) |
101 | ARMMMUFaultInfo *fi) | 849 | -DO_DOT_IDX(gvec_sdot_idx_h, int64_t, int16_t, int16_t, ) |
102 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, | 850 | -DO_DOT_IDX(gvec_udot_idx_h, uint64_t, uint16_t, uint16_t, ) |
103 | if (pxn && !regime_is_user(env, mmu_idx)) { | 851 | +DO_DOT_IDX(gvec_sdot_idx_h, int64_t, int16_t, int16_t, H8) |
104 | xn = 1; | 852 | +DO_DOT_IDX(gvec_udot_idx_h, uint64_t, uint16_t, uint16_t, H8) |
105 | } | 853 | |
106 | - if (xn && access_type == 2) | 854 | void HELPER(gvec_fcaddh)(void *vd, void *vn, void *vm, |
107 | + if (xn && access_type == MMU_INST_FETCH) | 855 | void *vfpst, uint32_t desc) |
108 | goto do_fault; | 856 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ |
109 | 857 | ||
110 | if (arm_feature(env, ARM_FEATURE_V6K) && | 858 | DO_MUL_IDX(gvec_mul_idx_h, uint16_t, H2) |
111 | @@ -XXX,XX +XXX,XX @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, | 859 | DO_MUL_IDX(gvec_mul_idx_s, uint32_t, H4) |
112 | } | 860 | -DO_MUL_IDX(gvec_mul_idx_d, uint64_t, ) |
113 | 861 | +DO_MUL_IDX(gvec_mul_idx_d, uint64_t, H8) | |
114 | static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 862 | |
115 | - int access_type, ARMMMUIdx mmu_idx, | 863 | #undef DO_MUL_IDX |
116 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 864 | |
117 | hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, | 865 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, uint32_t desc) \ |
118 | target_ulong *page_size_ptr, uint32_t *fsr, | 866 | |
119 | ARMMMUFaultInfo *fi) | 867 | DO_MLA_IDX(gvec_mla_idx_h, uint16_t, +, H2) |
120 | @@ -XXX,XX +XXX,XX @@ static inline bool m_is_system_region(CPUARMState *env, uint32_t address) | 868 | DO_MLA_IDX(gvec_mla_idx_s, uint32_t, +, H4) |
121 | } | 869 | -DO_MLA_IDX(gvec_mla_idx_d, uint64_t, +, ) |
122 | 870 | +DO_MLA_IDX(gvec_mla_idx_d, uint64_t, +, H8) | |
123 | static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 871 | |
124 | - int access_type, ARMMMUIdx mmu_idx, | 872 | DO_MLA_IDX(gvec_mls_idx_h, uint16_t, -, H2) |
125 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 873 | DO_MLA_IDX(gvec_mls_idx_s, uint32_t, -, H4) |
126 | hwaddr *phys_ptr, int *prot, uint32_t *fsr) | 874 | -DO_MLA_IDX(gvec_mls_idx_d, uint64_t, -, ) |
127 | { | 875 | +DO_MLA_IDX(gvec_mls_idx_d, uint64_t, -, H8) |
128 | ARMCPU *cpu = arm_env_get_cpu(env); | 876 | |
129 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | 877 | #undef DO_MLA_IDX |
130 | } | 878 | |
131 | 879 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *stat, uint32_t desc) \ | |
132 | static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | 880 | |
133 | - int access_type, ARMMMUIdx mmu_idx, | 881 | DO_FMUL_IDX(gvec_fmul_idx_h, nop, float16, H2) |
134 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | 882 | DO_FMUL_IDX(gvec_fmul_idx_s, nop, float32, H4) |
135 | hwaddr *phys_ptr, int *prot, uint32_t *fsr) | 883 | -DO_FMUL_IDX(gvec_fmul_idx_d, nop, float64, ) |
136 | { | 884 | +DO_FMUL_IDX(gvec_fmul_idx_d, nop, float64, H8) |
137 | int n; | 885 | |
138 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | 886 | /* |
139 | return true; | 887 | * Non-fused multiply-accumulate operations, for Neon. NB that unlike |
140 | } | 888 | @@ -XXX,XX +XXX,XX @@ void HELPER(NAME)(void *vd, void *vn, void *vm, void *va, \ |
141 | 889 | ||
142 | - if (access_type == 2) { | 890 | DO_FMLA_IDX(gvec_fmla_idx_h, float16, H2) |
143 | + if (access_type == MMU_INST_FETCH) { | 891 | DO_FMLA_IDX(gvec_fmla_idx_s, float32, H4) |
144 | mask = env->cp15.pmsav5_insn_ap; | 892 | -DO_FMLA_IDX(gvec_fmla_idx_d, float64, ) |
145 | } else { | 893 | +DO_FMLA_IDX(gvec_fmla_idx_d, float64, H8) |
146 | mask = env->cp15.pmsav5_data_ap; | 894 | |
147 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | 895 | #undef DO_FMLA_IDX |
148 | * @fsr: set to the DFSR/IFSR value on failure | 896 | |
149 | */ | ||
150 | static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
151 | - int access_type, ARMMMUIdx mmu_idx, | ||
152 | + MMUAccessType access_type, ARMMMUIdx mmu_idx, | ||
153 | hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot, | ||
154 | target_ulong *page_size, uint32_t *fsr, | ||
155 | ARMMMUFaultInfo *fi) | ||
156 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
157 | * fsr with ARM DFSR/IFSR fault register format value on failure. | ||
158 | */ | ||
159 | bool arm_tlb_fill(CPUState *cs, vaddr address, | ||
160 | - int access_type, int mmu_idx, uint32_t *fsr, | ||
161 | + MMUAccessType access_type, int mmu_idx, uint32_t *fsr, | ||
162 | ARMMMUFaultInfo *fi) | ||
163 | { | ||
164 | ARMCPU *cpu = ARM_CPU(cs); | ||
165 | -- | 897 | -- |
166 | 2.7.4 | 898 | 2.20.1 |
167 | 899 | ||
168 | 900 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | M profile cores can never trap on WFI or WFE instructions. Check for | ||
2 | M profile in check_wfx_trap() to ensure this. | ||
3 | 1 | ||
4 | The existing code will do the right thing for v7M cores because | ||
5 | the hcr_el2 and scr_el3 registers will be all-zeroes and so we | ||
6 | won't attempt to trap, but when we start setting ARM_FEATURE_V8 | ||
7 | for v8M cores the v8A handling of SCTLR.nTWE and .nTWI will not | ||
8 | give the right results. | ||
9 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 1501692241-23310-3-git-send-email-peter.maydell@linaro.org | ||
14 | --- | ||
15 | target/arm/op_helper.c | 5 +++++ | ||
16 | 1 file changed, 5 insertions(+) | ||
17 | |||
18 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/op_helper.c | ||
21 | +++ b/target/arm/op_helper.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static inline int check_wfx_trap(CPUARMState *env, bool is_wfe) | ||
23 | int cur_el = arm_current_el(env); | ||
24 | uint64_t mask; | ||
25 | |||
26 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
27 | + /* M profile cores can never trap WFI/WFE. */ | ||
28 | + return 0; | ||
29 | + } | ||
30 | + | ||
31 | /* If we are currently in EL0 then we need to check if SCTLR is set up for | ||
32 | * WFx instructions being trapped to EL1. These trap bits don't exist in v7. | ||
33 | */ | ||
34 | -- | ||
35 | 2.7.4 | ||
36 | |||
37 | diff view generated by jsdifflib |
1 | Move the code in arm_v7m_cpu_do_interrupt() that calculates the | 1 | MVE has an FPSCR.QC bit similar to the A-profile Neon one; when MVE |
---|---|---|---|
2 | magic LR value down to when we're actually going to use it. | 2 | is implemented make the bit writeable, both in the generic "load and |
3 | Having the calculation and use so far apart makes the code | 3 | store FPSCR" helper functions and in the code for handling the NZCVQC |
4 | a little harder to understand than it needs to be. | 4 | sysreg which we had previously left as "TODO when we implement MVE". |
5 | 5 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 1501692241-23310-13-git-send-email-peter.maydell@linaro.org | 8 | Message-id: 20210614151007.4545-3-peter.maydell@linaro.org |
11 | --- | 9 | --- |
12 | target/arm/helper.c | 15 ++++++++------- | 10 | target/arm/translate-vfp.c | 30 +++++++++++++++++++++--------- |
13 | 1 file changed, 8 insertions(+), 7 deletions(-) | 11 | target/arm/vfp_helper.c | 3 ++- |
12 | 2 files changed, 23 insertions(+), 10 deletions(-) | ||
14 | 13 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 14 | diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/helper.c | 16 | --- a/target/arm/translate-vfp.c |
18 | +++ b/target/arm/helper.c | 17 | +++ b/target/arm/translate-vfp.c |
19 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 18 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, |
20 | 19 | { | |
21 | arm_log_exception(cs->exception_index); | 20 | TCGv_i32 fpscr; |
22 | 21 | tmp = loadfn(s, opaque); | |
23 | - lr = 0xfffffff1; | 22 | - /* |
24 | - if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) { | 23 | - * TODO: when we implement MVE, write the QC bit. |
25 | - lr |= 4; | 24 | - * For non-MVE, QC is RES0. |
26 | - } | 25 | - */ |
27 | - if (env->v7m.exception == 0) | 26 | + if (dc_isar_feature(aa32_mve, s)) { |
28 | - lr |= 8; | 27 | + /* QC is only present for MVE; otherwise RES0 */ |
29 | - | 28 | + TCGv_i32 qc = tcg_temp_new_i32(); |
30 | /* For exceptions we just mark as pending on the NVIC, and let that | 29 | + tcg_gen_andi_i32(qc, tmp, FPCR_QC); |
31 | handle it. */ | 30 | + /* |
32 | switch (cs->exception_index) { | 31 | + * The 4 vfp.qc[] fields need only be "zero" vs "non-zero"; |
33 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | 32 | + * here writing the same value into all elements is simplest. |
34 | return; /* Never happens. Keep compiler happy. */ | 33 | + */ |
34 | + tcg_gen_gvec_dup_i32(MO_32, offsetof(CPUARMState, vfp.qc), | ||
35 | + 16, 16, qc); | ||
36 | + } | ||
37 | tcg_gen_andi_i32(tmp, tmp, FPCR_NZCV_MASK); | ||
38 | fpscr = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); | ||
39 | tcg_gen_andi_i32(fpscr, fpscr, ~FPCR_NZCV_MASK); | ||
40 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, | ||
41 | break; | ||
35 | } | 42 | } |
36 | 43 | ||
37 | + lr = 0xfffffff1; | 44 | + if (regno == ARM_VFP_FPSCR_NZCVQC && !dc_isar_feature(aa32_mve, s)) { |
38 | + if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) { | 45 | + /* QC is RES0 without MVE, so NZCVQC simplifies to NZCV */ |
39 | + lr |= 4; | 46 | + regno = QEMU_VFP_FPSCR_NZCV; |
40 | + } | ||
41 | + if (env->v7m.exception == 0) { | ||
42 | + lr |= 8; | ||
43 | + } | 47 | + } |
44 | + | 48 | + |
45 | v7m_push_stack(cpu); | 49 | switch (regno) { |
46 | v7m_exception_taken(cpu, lr); | 50 | case ARM_VFP_FPSCR: |
47 | qemu_log_mask(CPU_LOG_INT, "... as %d\n", env->v7m.exception); | 51 | tmp = tcg_temp_new_i32(); |
52 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, | ||
53 | storefn(s, opaque, tmp); | ||
54 | break; | ||
55 | case ARM_VFP_FPSCR_NZCVQC: | ||
56 | - /* | ||
57 | - * TODO: MVE has a QC bit, which we probably won't store | ||
58 | - * in the xregs[] field. For non-MVE, where QC is RES0, | ||
59 | - * we can just fall through to the FPSCR_NZCV case. | ||
60 | - */ | ||
61 | + tmp = tcg_temp_new_i32(); | ||
62 | + gen_helper_vfp_get_fpscr(tmp, cpu_env); | ||
63 | + tcg_gen_andi_i32(tmp, tmp, FPCR_NZCVQC_MASK); | ||
64 | + storefn(s, opaque, tmp); | ||
65 | + break; | ||
66 | case QEMU_VFP_FPSCR_NZCV: | ||
67 | /* | ||
68 | * Read just NZCV; this is a special case to avoid the | ||
69 | diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/target/arm/vfp_helper.c | ||
72 | +++ b/target/arm/vfp_helper.c | ||
73 | @@ -XXX,XX +XXX,XX @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) | ||
74 | FPCR_LTPSIZE_LENGTH); | ||
75 | } | ||
76 | |||
77 | - if (arm_feature(env, ARM_FEATURE_NEON)) { | ||
78 | + if (arm_feature(env, ARM_FEATURE_NEON) || | ||
79 | + cpu_isar_feature(aa32_mve, cpu)) { | ||
80 | /* | ||
81 | * The bit we set within fpscr_q is arbitrary; the register as a | ||
82 | * whole being zero/non-zero is what counts. | ||
48 | -- | 83 | -- |
49 | 2.7.4 | 84 | 2.20.1 |
50 | 85 | ||
51 | 86 | diff view generated by jsdifflib |
1 | For embedded systems, notably ARM, one common use of ELF | 1 | When MVE is supported, the VPR register has a place on the exception |
---|---|---|---|
2 | file segments is that the 'physical addresses' represent load addresses | 2 | stack frame in a previously reserved slot just above the FPSCR. |
3 | and the 'virtual addresses' execution addresses, such that | 3 | It must also be zeroed in various situations when we invalidate |
4 | the load addresses are packed into ROM or flash, and the | 4 | FPU context. |
5 | relocation and zero-initialization of data is done at runtime. | 5 | |
6 | This means that the 'memsz' in the segment header represents | 6 | Update the code which handles the stack frames (exception entry and |
7 | the runtime size of the segment, but the size that needs to | 7 | exit code, VLLDM, and VLSTM) to save/restore VPR. |
8 | be loaded is only the 'filesz'. In particular, paddr+memsz | 8 | |
9 | may overlap with the next segment to be loaded, as in this | 9 | Update code which invalidates FP registers (mostly also exception |
10 | example: | 10 | entry and exit code, but also VSCCLRM and the code in |
11 | 11 | full_vfp_access_check() that corresponds to the ExecuteFPCheck() | |
12 | 0x70000001 off 0x00007f68 vaddr 0x00008150 paddr 0x00008150 align 2**2 | 12 | pseudocode) to zero VPR. |
13 | filesz 0x00000008 memsz 0x00000008 flags r-- | ||
14 | LOAD off 0x000000f4 vaddr 0x00000000 paddr 0x00000000 align 2**2 | ||
15 | filesz 0x00000124 memsz 0x00000124 flags r-- | ||
16 | LOAD off 0x00000218 vaddr 0x00000400 paddr 0x00000400 align 2**3 | ||
17 | filesz 0x00007d58 memsz 0x00007d58 flags r-x | ||
18 | LOAD off 0x00007f70 vaddr 0x20000140 paddr 0x00008158 align 2**3 | ||
19 | filesz 0x00000a80 memsz 0x000022f8 flags rw- | ||
20 | LOAD off 0x000089f0 vaddr 0x20002438 paddr 0x00008bd8 align 2**0 | ||
21 | filesz 0x00000000 memsz 0x00004000 flags rw- | ||
22 | LOAD off 0x000089f0 vaddr 0x20000000 paddr 0x20000000 align 2**0 | ||
23 | filesz 0x00000000 memsz 0x00000140 flags rw- | ||
24 | |||
25 | where the segment at paddr 0x8158 has a memsz of 0x2258 and | ||
26 | would overlap with the segment at paddr 0x8bd8 if QEMU's loader | ||
27 | tried to honour it. (At runtime the segments will not overlap | ||
28 | since their vaddrs are more widely spaced than their paddrs.) | ||
29 | |||
30 | Currently if you try to load an ELF file like this with QEMU then | ||
31 | it will fail with an error "rom: requested regions overlap", | ||
32 | because we create a ROM image for each segment using the memsz | ||
33 | as the size. | ||
34 | |||
35 | Support ELF files using this scheme, by truncating the | ||
36 | zero-initialized part of the segment if it would overlap another | ||
37 | segment. This will retain the existing loader behaviour for | ||
38 | all ELF files we currently accept, and also accept ELF files | ||
39 | which only need 'filesz' bytes to be loaded. | ||
40 | 13 | ||
41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
42 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
43 | Message-id: 1502116754-18867-2-git-send-email-peter.maydell@linaro.org | 16 | Message-id: 20210614151007.4545-4-peter.maydell@linaro.org |
44 | --- | 17 | --- |
45 | include/hw/elf_ops.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ | 18 | target/arm/m_helper.c | 54 +++++++++++++++++++++++++++++------ |
46 | 1 file changed, 48 insertions(+) | 19 | target/arm/translate-m-nocp.c | 5 +++- |
47 | 20 | target/arm/translate-vfp.c | 9 ++++-- | |
48 | diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h | 21 | 3 files changed, 57 insertions(+), 11 deletions(-) |
22 | |||
23 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/include/hw/elf_ops.h | 25 | --- a/target/arm/m_helper.c |
51 | +++ b/include/hw/elf_ops.h | 26 | +++ b/target/arm/m_helper.c |
52 | @@ -XXX,XX +XXX,XX @@ static int glue(load_elf, SZ)(const char *name, int fd, | 27 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_preserve_fp_state)(CPUARMState *env) |
53 | goto fail; | 28 | uint32_t shi = extract64(dn, 32, 32); |
54 | } | 29 | |
55 | } | 30 | if (i >= 16) { |
56 | + | 31 | - faddr += 8; /* skip the slot for the FPSCR */ |
57 | + /* The ELF spec is somewhat vague about the purpose of the | 32 | + faddr += 8; /* skip the slot for the FPSCR/VPR */ |
58 | + * physical address field. One common use in the embedded world | 33 | } |
59 | + * is that physical address field specifies the load address | 34 | stacked_ok = stacked_ok && |
60 | + * and the virtual address field specifies the execution address. | 35 | v7m_stack_write(cpu, faddr, slo, mmu_idx, STACK_LAZYFP) && |
61 | + * Segments are packed into ROM or flash, and the relocation | 36 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_preserve_fp_state)(CPUARMState *env) |
62 | + * and zero-initialization of data is done at runtime. This | 37 | stacked_ok = stacked_ok && |
63 | + * means that the memsz header represents the runtime size of the | 38 | v7m_stack_write(cpu, fpcar + 0x40, |
64 | + * segment, but the filesz represents the loadtime size. If | 39 | vfp_get_fpscr(env), mmu_idx, STACK_LAZYFP); |
65 | + * we try to honour the memsz value for an ELF file like this | 40 | + if (cpu_isar_feature(aa32_mve, cpu)) { |
66 | + * we will end up with overlapping segments (which the | 41 | + stacked_ok = stacked_ok && |
67 | + * loader.c code will later reject). | 42 | + v7m_stack_write(cpu, fpcar + 0x44, |
68 | + * We support ELF files using this scheme by by checking whether | 43 | + env->v7m.vpr, mmu_idx, STACK_LAZYFP); |
69 | + * paddr + memsz for this segment would overlap with any other | 44 | + } |
70 | + * segment. If so, then we assume it's using this scheme and | 45 | } |
71 | + * truncate the loaded segment to the filesz size. | 46 | |
72 | + * If the segment considered as being memsz size doesn't overlap | 47 | /* |
73 | + * then we use memsz for the segment length, to handle ELF files | 48 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_preserve_fp_state)(CPUARMState *env) |
74 | + * which assume that the loader will do the zero-initialization. | 49 | env->v7m.fpccr[is_secure] &= ~R_V7M_FPCCR_LSPACT_MASK; |
75 | + */ | 50 | |
76 | + if (mem_size > file_size) { | 51 | if (ts) { |
77 | + /* If this segment's zero-init portion overlaps another | 52 | - /* Clear s0 to s31 and the FPSCR */ |
78 | + * segment's data or zero-init portion, then truncate this one. | 53 | + /* Clear s0 to s31 and the FPSCR and VPR */ |
79 | + * Invalid ELF files where the segments overlap even when | 54 | int i; |
80 | + * only file_size bytes are loaded will be rejected by | 55 | |
81 | + * the ROM overlap check in loader.c, so we don't try to | 56 | for (i = 0; i < 32; i += 2) { |
82 | + * explicitly detect those here. | 57 | *aa32_vfp_dreg(env, i / 2) = 0; |
83 | + */ | 58 | } |
84 | + int j; | 59 | vfp_set_fpscr(env, 0); |
85 | + elf_word zero_start = ph->p_paddr + file_size; | 60 | + if (cpu_isar_feature(aa32_mve, cpu)) { |
86 | + elf_word zero_end = ph->p_paddr + mem_size; | 61 | + env->v7m.vpr = 0; |
87 | + | 62 | + } |
88 | + for (j = 0; j < ehdr.e_phnum; j++) { | 63 | } |
89 | + struct elf_phdr *jph = &phdr[j]; | 64 | /* |
90 | + | 65 | - * Otherwise s0 to s15 and FPSCR are UNKNOWN; we choose to leave them |
91 | + if (i != j && jph->p_type == PT_LOAD) { | 66 | + * Otherwise s0 to s15, FPSCR and VPR are UNKNOWN; we choose to leave them |
92 | + elf_word other_start = jph->p_paddr; | 67 | * unchanged. |
93 | + elf_word other_end = jph->p_paddr + jph->p_memsz; | 68 | */ |
94 | + | 69 | } |
95 | + if (!(other_start >= zero_end || | 70 | @@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr, |
96 | + zero_start >= other_end)) { | 71 | void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) |
97 | + mem_size = file_size; | 72 | { |
98 | + break; | 73 | /* fptr is the value of Rn, the frame pointer we store the FP regs to */ |
99 | + } | 74 | + ARMCPU *cpu = env_archcpu(env); |
75 | bool s = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK; | ||
76 | bool lspact = env->v7m.fpccr[s] & R_V7M_FPCCR_LSPACT_MASK; | ||
77 | uintptr_t ra = GETPC(); | ||
78 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | ||
79 | cpu_stl_data_ra(env, faddr + 4, shi, ra); | ||
80 | } | ||
81 | cpu_stl_data_ra(env, fptr + 0x40, vfp_get_fpscr(env), ra); | ||
82 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
83 | + cpu_stl_data_ra(env, fptr + 0x44, env->v7m.vpr, ra); | ||
84 | + } | ||
85 | |||
86 | /* | ||
87 | - * If TS is 0 then s0 to s15 and FPSCR are UNKNOWN; we choose to | ||
88 | + * If TS is 0 then s0 to s15, FPSCR and VPR are UNKNOWN; we choose to | ||
89 | * leave them unchanged, matching our choice in v7m_preserve_fp_state. | ||
90 | */ | ||
91 | if (ts) { | ||
92 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | ||
93 | *aa32_vfp_dreg(env, i / 2) = 0; | ||
94 | } | ||
95 | vfp_set_fpscr(env, 0); | ||
96 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
97 | + env->v7m.vpr = 0; | ||
98 | + } | ||
99 | } | ||
100 | } else { | ||
101 | v7m_update_fpccr(env, fptr, false); | ||
102 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlstm)(CPUARMState *env, uint32_t fptr) | ||
103 | |||
104 | void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr) | ||
105 | { | ||
106 | + ARMCPU *cpu = env_archcpu(env); | ||
107 | uintptr_t ra = GETPC(); | ||
108 | |||
109 | /* fptr is the value of Rn, the frame pointer we load the FP regs from */ | ||
110 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr) | ||
111 | uint32_t faddr = fptr + 4 * i; | ||
112 | |||
113 | if (i >= 16) { | ||
114 | - faddr += 8; /* skip the slot for the FPSCR */ | ||
115 | + faddr += 8; /* skip the slot for the FPSCR and VPR */ | ||
116 | } | ||
117 | |||
118 | slo = cpu_ldl_data_ra(env, faddr, ra); | ||
119 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr) | ||
120 | } | ||
121 | fpscr = cpu_ldl_data_ra(env, fptr + 0x40, ra); | ||
122 | vfp_set_fpscr(env, fpscr); | ||
123 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
124 | + env->v7m.vpr = cpu_ldl_data_ra(env, fptr + 0x44, ra); | ||
125 | + } | ||
126 | } | ||
127 | |||
128 | env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK; | ||
129 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | ||
130 | uint32_t shi = extract64(dn, 32, 32); | ||
131 | |||
132 | if (i >= 16) { | ||
133 | - faddr += 8; /* skip the slot for the FPSCR */ | ||
134 | + faddr += 8; /* skip the slot for the FPSCR and VPR */ | ||
135 | } | ||
136 | stacked_ok = stacked_ok && | ||
137 | v7m_stack_write(cpu, faddr, slo, | ||
138 | @@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu) | ||
139 | stacked_ok = stacked_ok && | ||
140 | v7m_stack_write(cpu, frameptr + 0x60, | ||
141 | vfp_get_fpscr(env), mmu_idx, STACK_NORMAL); | ||
142 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
143 | + stacked_ok = stacked_ok && | ||
144 | + v7m_stack_write(cpu, frameptr + 0x64, | ||
145 | + env->v7m.vpr, mmu_idx, STACK_NORMAL); | ||
146 | + } | ||
147 | if (cpacr_pass) { | ||
148 | for (i = 0; i < ((framesize == 0xa8) ? 32 : 16); i += 2) { | ||
149 | *aa32_vfp_dreg(env, i / 2) = 0; | ||
150 | } | ||
151 | vfp_set_fpscr(env, 0); | ||
152 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
153 | + env->v7m.vpr = 0; | ||
100 | + } | 154 | + } |
155 | } | ||
156 | } else { | ||
157 | /* Lazy stacking enabled, save necessary info to stack later */ | ||
158 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
159 | v7m_exception_taken(cpu, excret, true, false); | ||
160 | } | ||
161 | } | ||
162 | - /* Clear s0..s15 and FPSCR; TODO also VPR when MVE is implemented */ | ||
163 | + /* Clear s0..s15, FPSCR and VPR */ | ||
164 | int i; | ||
165 | |||
166 | for (i = 0; i < 16; i += 2) { | ||
167 | *aa32_vfp_dreg(env, i / 2) = 0; | ||
168 | } | ||
169 | vfp_set_fpscr(env, 0); | ||
170 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
171 | + env->v7m.vpr = 0; | ||
172 | + } | ||
173 | } | ||
174 | } | ||
175 | |||
176 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
177 | uint32_t faddr = frameptr + 0x20 + 4 * i; | ||
178 | |||
179 | if (i >= 16) { | ||
180 | - faddr += 8; /* Skip the slot for the FPSCR */ | ||
181 | + faddr += 8; /* Skip the slot for the FPSCR and VPR */ | ||
182 | } | ||
183 | |||
184 | pop_ok = pop_ok && | ||
185 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
186 | if (pop_ok) { | ||
187 | vfp_set_fpscr(env, fpscr); | ||
188 | } | ||
189 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
190 | + pop_ok = pop_ok && | ||
191 | + v7m_stack_read(cpu, &env->v7m.vpr, | ||
192 | + frameptr + 0x64, mmu_idx); | ||
101 | + } | 193 | + } |
194 | if (!pop_ok) { | ||
195 | /* | ||
196 | * These regs are 0 if security extension present; | ||
197 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
198 | *aa32_vfp_dreg(env, i / 2) = 0; | ||
199 | } | ||
200 | vfp_set_fpscr(env, 0); | ||
201 | + if (cpu_isar_feature(aa32_mve, cpu)) { | ||
202 | + env->v7m.vpr = 0; | ||
203 | + } | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c | ||
208 | index XXXXXXX..XXXXXXX 100644 | ||
209 | --- a/target/arm/translate-m-nocp.c | ||
210 | +++ b/target/arm/translate-m-nocp.c | ||
211 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) | ||
212 | btmreg++; | ||
213 | } | ||
214 | assert(btmreg == topreg + 1); | ||
215 | - /* TODO: when MVE is implemented, zero VPR here */ | ||
216 | + if (dc_isar_feature(aa32_mve, s)) { | ||
217 | + TCGv_i32 z32 = tcg_const_i32(0); | ||
218 | + store_cpu_field(z32, v7m.vpr); | ||
219 | + } | ||
220 | return true; | ||
221 | } | ||
222 | |||
223 | diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c | ||
224 | index XXXXXXX..XXXXXXX 100644 | ||
225 | --- a/target/arm/translate-vfp.c | ||
226 | +++ b/target/arm/translate-vfp.c | ||
227 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | ||
228 | |||
229 | if (s->v7m_new_fp_ctxt_needed) { | ||
230 | /* | ||
231 | - * Create new FP context by updating CONTROL.FPCA, CONTROL.SFPA | ||
232 | - * and the FPSCR. | ||
233 | + * Create new FP context by updating CONTROL.FPCA, CONTROL.SFPA, | ||
234 | + * the FPSCR, and VPR. | ||
235 | */ | ||
236 | TCGv_i32 control, fpscr; | ||
237 | uint32_t bits = R_V7M_CONTROL_FPCA_MASK; | ||
238 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | ||
239 | fpscr = load_cpu_field(v7m.fpdscr[s->v8m_secure]); | ||
240 | gen_helper_vfp_set_fpscr(cpu_env, fpscr); | ||
241 | tcg_temp_free_i32(fpscr); | ||
242 | + if (dc_isar_feature(aa32_mve, s)) { | ||
243 | + TCGv_i32 z32 = tcg_const_i32(0); | ||
244 | + store_cpu_field(z32, v7m.vpr); | ||
102 | + } | 245 | + } |
103 | + | 246 | + |
104 | /* address_offset is hack for kernel images that are | 247 | /* |
105 | linked at the wrong physical address. */ | 248 | * We don't need to arrange to end the TB, because the only |
106 | if (translate_fn) { | 249 | * parts of FPSCR which we cache in the TB flags are the VECLEN |
107 | -- | 250 | -- |
108 | 2.7.4 | 251 | 2.20.1 |
109 | 252 | ||
110 | 253 | diff view generated by jsdifflib |
1 | Currently get_phys_addr() has PMSAv7 handling before the | 1 | On A-profile, PSR bits [15:10][26:25] are always the IT state bits. |
---|---|---|---|
2 | "is translation disabled?" check, and then PMSAv5 after it. | 2 | On M-profile, some of the reserved encodings of the IT state are used |
3 | Tidy this up by making the PMSAv5 code handle the "MPU disabled" | 3 | to instead indicate partial progress through instructions that were |
4 | case itself, so that we have all the PMSA code in one place. | 4 | interrupted partway through by an exception and can be resumed. |
5 | This will make adding the PMSAv8 code slightly cleaner, and | 5 | |
6 | also means that pre-v7 PMSA cores benefit from the MPU lookup | 6 | These resumable instructions fall into two categories: |
7 | logging that the PMSAv7 codepath had. | 7 | |
8 | (1) load/store multiple instructions, where these bits are called | ||
9 | "ICI" and specify the register in the ldm/stm list where execution | ||
10 | should resume. (Specifically: LDM, STM, VLDM, VSTM, VLLDM, VLSTM, | ||
11 | CLRM, VSCCLRM.) | ||
12 | |||
13 | (2) MVE instructions subject to beatwise execution, where these bits | ||
14 | are called "ECI" and specify which beats in this and possibly also | ||
15 | the following MVE insn have been executed. | ||
16 | |||
17 | There are also a few insns (LE, LETP, and BKPT) which do not use the | ||
18 | ICI/ECI bits but must leave them alone. | ||
19 | |||
20 | Otherwise, we should raise an INVSTATE UsageFault for any attempt to | ||
21 | execute an insn with non-zero ICI/ECI bits. | ||
22 | |||
23 | So far we have been able to ignore ECI/ICI, because the architecture | ||
24 | allows the IMPDEF choice of "always restart load/store multiple from | ||
25 | the beginning regardless of ICI state", so the only thing we have | ||
26 | been missing is that we don't raise the INVSTATE fault for bad guest | ||
27 | code. However, MVE requires that we honour ECI bits and do not | ||
28 | rexecute beats of an insn that have already been executed. | ||
29 | |||
30 | Add the support in the decoder for handling ECI/ICI: | ||
31 | * identify the ECI/ICI case in the CONDEXEC TB flags | ||
32 | * when a load/store multiple insn succeeds, it updates the ECI/ICI | ||
33 | state (both in DisasContext and in the CPU state), and sets a flag | ||
34 | to say that the ECI/ICI state was handled | ||
35 | * if we find that the insn we just decoded did not handle the | ||
36 | ECI/ICI state, we delete all the code that we just generated for | ||
37 | it and instead emit the code to raise the INVFAULT. This allows | ||
38 | us to avoid having to update every non-MVE non-LDM/STM insn to | ||
39 | make it check for "is ECI/ICI set?". | ||
40 | |||
41 | We continue with our existing IMPDEF choice of not caring about the | ||
42 | ICI state for the load/store multiples and simply restarting them | ||
43 | from the beginning. Because we don't allow interrupts in the middle | ||
44 | of an insn, the only way we would see this state is if the guest set | ||
45 | ICI manually on return from an exception handler, so it's a corner | ||
46 | case which doesn't merit optimisation. | ||
47 | |||
48 | ICI update for LDM/STM is simple -- it always zeroes the state. ECI | ||
49 | update for MVE beatwise insns will be a little more complex, since | ||
50 | the ECI state may include information for the following insn. | ||
8 | 51 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 52 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 53 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Message-id: 1501692241-23310-4-git-send-email-peter.maydell@linaro.org | 54 | Message-id: 20210614151007.4545-5-peter.maydell@linaro.org |
14 | --- | 55 | --- |
15 | target/arm/helper.c | 38 ++++++++++++++++++++++---------------- | 56 | target/arm/translate-a32.h | 1 + |
16 | 1 file changed, 22 insertions(+), 16 deletions(-) | 57 | target/arm/translate.h | 9 +++ |
17 | 58 | target/arm/translate-m-nocp.c | 11 ++++ | |
18 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 59 | target/arm/translate-vfp.c | 6 ++ |
19 | index XXXXXXX..XXXXXXX 100644 | 60 | target/arm/translate.c | 111 ++++++++++++++++++++++++++++++++-- |
20 | --- a/target/arm/helper.c | 61 | 5 files changed, 133 insertions(+), 5 deletions(-) |
21 | +++ b/target/arm/helper.c | 62 | |
22 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address, | 63 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h |
23 | uint32_t base; | 64 | index XXXXXXX..XXXXXXX 100644 |
24 | bool is_user = regime_is_user(env, mmu_idx); | 65 | --- a/target/arm/translate-a32.h |
25 | 66 | +++ b/target/arm/translate-a32.h | |
26 | + if (regime_translation_disabled(env, mmu_idx)) { | 67 | @@ -XXX,XX +XXX,XX @@ long vfp_reg_offset(bool dp, unsigned reg); |
27 | + /* MPU disabled. */ | 68 | long neon_full_reg_offset(unsigned reg); |
28 | + *phys_ptr = address; | 69 | long neon_element_offset(int reg, int element, MemOp memop); |
29 | + *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | 70 | void gen_rev16(TCGv_i32 dest, TCGv_i32 var); |
30 | + return false; | 71 | +void clear_eci_state(DisasContext *s); |
31 | + } | 72 | |
32 | + | 73 | static inline TCGv_i32 load_cpu_offset(int offset) |
33 | *phys_ptr = address; | 74 | { |
34 | for (n = 7; n >= 0; n--) { | 75 | diff --git a/target/arm/translate.h b/target/arm/translate.h |
35 | base = env->cp15.c6_region[n]; | 76 | index XXXXXXX..XXXXXXX 100644 |
36 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | 77 | --- a/target/arm/translate.h |
78 | +++ b/target/arm/translate.h | ||
79 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContext { | ||
80 | /* Thumb-2 conditional execution bits. */ | ||
81 | int condexec_mask; | ||
82 | int condexec_cond; | ||
83 | + /* M-profile ECI/ICI exception-continuable instruction state */ | ||
84 | + int eci; | ||
85 | + /* | ||
86 | + * trans_ functions for insns which are continuable should set this true | ||
87 | + * after decode (ie after any UNDEF checks) | ||
88 | + */ | ||
89 | + bool eci_handled; | ||
90 | + /* TCG op to rewind to if this turns out to be an invalid ECI state */ | ||
91 | + TCGOp *insn_eci_rewind; | ||
92 | int thumb; | ||
93 | int sctlr_b; | ||
94 | MemOp be_data; | ||
95 | diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c | ||
96 | index XXXXXXX..XXXXXXX 100644 | ||
97 | --- a/target/arm/translate-m-nocp.c | ||
98 | +++ b/target/arm/translate-m-nocp.c | ||
99 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a) | ||
100 | unallocated_encoding(s); | ||
101 | return true; | ||
102 | } | ||
103 | + | ||
104 | + s->eci_handled = true; | ||
105 | + | ||
106 | /* If no fpu, NOP. */ | ||
107 | if (!dc_isar_feature(aa32_vfp, s)) { | ||
108 | + clear_eci_state(s); | ||
109 | return true; | ||
110 | } | ||
111 | |||
112 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a) | ||
113 | } | ||
114 | tcg_temp_free_i32(fptr); | ||
115 | |||
116 | + clear_eci_state(s); | ||
117 | + | ||
118 | /* End the TB, because we have updated FP control bits */ | ||
119 | s->base.is_jmp = DISAS_UPDATE_EXIT; | ||
120 | return true; | ||
121 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) | ||
122 | return true; | ||
123 | } | ||
124 | |||
125 | + s->eci_handled = true; | ||
126 | + | ||
127 | if (!dc_isar_feature(aa32_vfp_simd, s)) { | ||
128 | /* NOP if we have neither FP nor MVE */ | ||
129 | + clear_eci_state(s); | ||
130 | return true; | ||
131 | } | ||
132 | |||
133 | @@ -XXX,XX +XXX,XX @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) | ||
134 | TCGv_i32 z32 = tcg_const_i32(0); | ||
135 | store_cpu_field(z32, v7m.vpr); | ||
136 | } | ||
137 | + | ||
138 | + clear_eci_state(s); | ||
139 | return true; | ||
140 | } | ||
141 | |||
142 | diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c | ||
143 | index XXXXXXX..XXXXXXX 100644 | ||
144 | --- a/target/arm/translate-vfp.c | ||
145 | +++ b/target/arm/translate-vfp.c | ||
146 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) | ||
147 | return false; | ||
148 | } | ||
149 | |||
150 | + s->eci_handled = true; | ||
151 | + | ||
152 | if (!vfp_access_check(s)) { | ||
153 | return true; | ||
154 | } | ||
155 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a) | ||
156 | tcg_temp_free_i32(addr); | ||
157 | } | ||
158 | |||
159 | + clear_eci_state(s); | ||
160 | return true; | ||
161 | } | ||
162 | |||
163 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) | ||
164 | return false; | ||
165 | } | ||
166 | |||
167 | + s->eci_handled = true; | ||
168 | + | ||
169 | if (!vfp_access_check(s)) { | ||
170 | return true; | ||
171 | } | ||
172 | @@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a) | ||
173 | tcg_temp_free_i32(addr); | ||
174 | } | ||
175 | |||
176 | + clear_eci_state(s); | ||
177 | return true; | ||
178 | } | ||
179 | |||
180 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
181 | index XXXXXXX..XXXXXXX 100644 | ||
182 | --- a/target/arm/translate.c | ||
183 | +++ b/target/arm/translate.c | ||
184 | @@ -XXX,XX +XXX,XX @@ static inline bool is_singlestepping(DisasContext *s) | ||
185 | return s->base.singlestep_enabled || s->ss_active; | ||
186 | } | ||
187 | |||
188 | +void clear_eci_state(DisasContext *s) | ||
189 | +{ | ||
190 | + /* | ||
191 | + * Clear any ECI/ICI state: used when a load multiple/store | ||
192 | + * multiple insn executes. | ||
193 | + */ | ||
194 | + if (s->eci) { | ||
195 | + TCGv_i32 tmp = tcg_const_i32(0); | ||
196 | + store_cpu_field(tmp, condexec_bits); | ||
197 | + s->eci = 0; | ||
198 | + } | ||
199 | +} | ||
200 | + | ||
201 | static void gen_smul_dual(TCGv_i32 a, TCGv_i32 b) | ||
202 | { | ||
203 | TCGv_i32 tmp1 = tcg_temp_new_i32(); | ||
204 | @@ -XXX,XX +XXX,XX @@ static bool trans_BKPT(DisasContext *s, arg_BKPT *a) | ||
205 | if (!ENABLE_ARCH_5) { | ||
206 | return false; | ||
207 | } | ||
208 | + /* BKPT is OK with ECI set and leaves it untouched */ | ||
209 | + s->eci_handled = true; | ||
210 | if (arm_dc_feature(s, ARM_FEATURE_M) && | ||
211 | semihosting_enabled() && | ||
212 | #ifndef CONFIG_USER_ONLY | ||
213 | @@ -XXX,XX +XXX,XX @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
214 | return true; | ||
215 | } | ||
216 | |||
217 | + s->eci_handled = true; | ||
218 | + | ||
219 | addr = op_addr_block_pre(s, a, n); | ||
220 | mem_idx = get_mem_index(s); | ||
221 | |||
222 | @@ -XXX,XX +XXX,XX @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
223 | } | ||
224 | |||
225 | op_addr_block_post(s, a, addr, n); | ||
226 | + clear_eci_state(s); | ||
227 | return true; | ||
228 | } | ||
229 | |||
230 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
231 | return true; | ||
232 | } | ||
233 | |||
234 | + s->eci_handled = true; | ||
235 | + | ||
236 | addr = op_addr_block_pre(s, a, n); | ||
237 | mem_idx = get_mem_index(s); | ||
238 | loaded_base = false; | ||
239 | @@ -XXX,XX +XXX,XX @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) | ||
240 | /* Must exit loop to check un-masked IRQs */ | ||
241 | s->base.is_jmp = DISAS_EXIT; | ||
242 | } | ||
243 | + clear_eci_state(s); | ||
244 | return true; | ||
245 | } | ||
246 | |||
247 | @@ -XXX,XX +XXX,XX @@ static bool trans_CLRM(DisasContext *s, arg_CLRM *a) | ||
248 | return false; | ||
249 | } | ||
250 | |||
251 | + s->eci_handled = true; | ||
252 | + | ||
253 | zero = tcg_const_i32(0); | ||
254 | for (i = 0; i < 15; i++) { | ||
255 | if (extract32(a->list, i, 1)) { | ||
256 | @@ -XXX,XX +XXX,XX @@ static bool trans_CLRM(DisasContext *s, arg_CLRM *a) | ||
257 | tcg_temp_free_i32(maskreg); | ||
258 | } | ||
259 | tcg_temp_free_i32(zero); | ||
260 | + clear_eci_state(s); | ||
261 | return true; | ||
262 | } | ||
263 | |||
264 | @@ -XXX,XX +XXX,XX @@ static bool trans_LE(DisasContext *s, arg_LE *a) | ||
265 | return false; | ||
266 | } | ||
267 | |||
268 | + /* LE/LETP is OK with ECI set and leaves it untouched */ | ||
269 | + s->eci_handled = true; | ||
270 | + | ||
271 | if (!a->f) { | ||
272 | /* Not loop-forever. If LR <= 1 this is the last loop: do nothing. */ | ||
273 | arm_gen_condlabel(s); | ||
274 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
275 | dc->thumb = EX_TBFLAG_AM32(tb_flags, THUMB); | ||
276 | dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; | ||
277 | condexec = EX_TBFLAG_AM32(tb_flags, CONDEXEC); | ||
278 | - dc->condexec_mask = (condexec & 0xf) << 1; | ||
279 | - dc->condexec_cond = condexec >> 4; | ||
280 | + /* | ||
281 | + * the CONDEXEC TB flags are CPSR bits [15:10][26:25]. On A-profile this | ||
282 | + * is always the IT bits. On M-profile, some of the reserved encodings | ||
283 | + * of IT are used instead to indicate either ICI or ECI, which | ||
284 | + * indicate partial progress of a restartable insn that was interrupted | ||
285 | + * partway through by an exception: | ||
286 | + * * if CONDEXEC[3:0] != 0b0000 : CONDEXEC is IT bits | ||
287 | + * * if CONDEXEC[3:0] == 0b0000 : CONDEXEC is ICI or ECI bits | ||
288 | + * In all cases CONDEXEC == 0 means "not in IT block or restartable | ||
289 | + * insn, behave normally". | ||
290 | + */ | ||
291 | + dc->eci = dc->condexec_mask = dc->condexec_cond = 0; | ||
292 | + dc->eci_handled = false; | ||
293 | + dc->insn_eci_rewind = NULL; | ||
294 | + if (condexec & 0xf) { | ||
295 | + dc->condexec_mask = (condexec & 0xf) << 1; | ||
296 | + dc->condexec_cond = condexec >> 4; | ||
297 | + } else { | ||
298 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
299 | + dc->eci = condexec >> 4; | ||
300 | + } | ||
301 | + } | ||
302 | |||
303 | core_mmu_idx = EX_TBFLAG_ANY(tb_flags, MMUIDX); | ||
304 | dc->mmu_idx = core_to_arm_mmu_idx(env, core_mmu_idx); | ||
305 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_start(DisasContextBase *dcbase, CPUState *cpu) | ||
306 | static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) | ||
307 | { | ||
308 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
309 | + /* | ||
310 | + * The ECI/ICI bits share PSR bits with the IT bits, so we | ||
311 | + * need to reconstitute the bits from the split-out DisasContext | ||
312 | + * fields here. | ||
313 | + */ | ||
314 | + uint32_t condexec_bits; | ||
315 | |||
316 | - tcg_gen_insn_start(dc->base.pc_next, | ||
317 | - (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), | ||
318 | - 0); | ||
319 | + if (dc->eci) { | ||
320 | + condexec_bits = dc->eci << 4; | ||
321 | + } else { | ||
322 | + condexec_bits = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); | ||
323 | + } | ||
324 | + tcg_gen_insn_start(dc->base.pc_next, condexec_bits, 0); | ||
325 | dc->insn_start = tcg_last_op(); | ||
326 | } | ||
327 | |||
328 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
329 | } | ||
330 | dc->insn = insn; | ||
331 | |||
332 | + if (dc->eci) { | ||
333 | + /* | ||
334 | + * For M-profile continuable instructions, ECI/ICI handling | ||
335 | + * falls into these cases: | ||
336 | + * - interrupt-continuable instructions | ||
337 | + * These are the various load/store multiple insns (both | ||
338 | + * integer and fp). The ICI bits indicate the register | ||
339 | + * where the load/store can resume. We make the IMPDEF | ||
340 | + * choice to always do "instruction restart", ie ignore | ||
341 | + * the ICI value and always execute the ldm/stm from the | ||
342 | + * start. So all we need to do is zero PSR.ICI if the | ||
343 | + * insn executes. | ||
344 | + * - MVE instructions subject to beat-wise execution | ||
345 | + * Here the ECI bits indicate which beats have already been | ||
346 | + * executed, and we must honour this. Each insn of this | ||
347 | + * type will handle it correctly. We will update PSR.ECI | ||
348 | + * in the helper function for the insn (some ECI values | ||
349 | + * mean that the following insn also has been partially | ||
350 | + * executed). | ||
351 | + * - Special cases which don't advance ECI | ||
352 | + * The insns LE, LETP and BKPT leave the ECI/ICI state | ||
353 | + * bits untouched. | ||
354 | + * - all other insns (the common case) | ||
355 | + * Non-zero ECI/ICI means an INVSTATE UsageFault. | ||
356 | + * We place a rewind-marker here. Insns in the previous | ||
357 | + * three categories will set a flag in the DisasContext. | ||
358 | + * If the flag isn't set after we call disas_thumb_insn() | ||
359 | + * or disas_thumb2_insn() then we know we have a "some other | ||
360 | + * insn" case. We will rewind to the marker (ie throwing away | ||
361 | + * all the generated code) and instead emit "take exception". | ||
362 | + */ | ||
363 | + dc->insn_eci_rewind = tcg_last_op(); | ||
364 | + } | ||
365 | + | ||
366 | if (dc->condexec_mask && !thumb_insn_is_unconditional(dc, insn)) { | ||
367 | uint32_t cond = dc->condexec_cond; | ||
368 | |||
369 | @@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) | ||
37 | } | 370 | } |
38 | } | 371 | } |
39 | 372 | ||
40 | - /* pmsav7 has special handling for when MPU is disabled so call it before | 373 | + if (dc->eci && !dc->eci_handled) { |
41 | - * the common MMU/MPU disabled check below. | 374 | + /* |
42 | - */ | 375 | + * Insn wasn't valid for ECI/ICI at all: undo what we |
43 | - if (arm_feature(env, ARM_FEATURE_PMSA) && | 376 | + * just generated and instead emit an exception |
44 | - arm_feature(env, ARM_FEATURE_V7)) { | 377 | + */ |
45 | + if (arm_feature(env, ARM_FEATURE_PMSA)) { | 378 | + tcg_remove_ops_after(dc->insn_eci_rewind); |
46 | bool ret; | 379 | + dc->condjmp = 0; |
47 | *page_size = TARGET_PAGE_SIZE; | 380 | + gen_exception_insn(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncategorized(), |
48 | - ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, | 381 | + default_exception_el(dc)); |
49 | - phys_ptr, prot, fsr); | 382 | + } |
50 | - qemu_log_mask(CPU_LOG_MMU, "PMSAv7 MPU lookup for %s at 0x%08" PRIx32 | 383 | + |
51 | + | 384 | arm_post_translate_insn(dc); |
52 | + if (arm_feature(env, ARM_FEATURE_V7)) { | 385 | |
53 | + /* PMSAv7 */ | 386 | /* Thumb is a variable-length ISA. Stop translation when the next insn |
54 | + ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx, | ||
55 | + phys_ptr, prot, fsr); | ||
56 | + } else { | ||
57 | + /* Pre-v7 MPU */ | ||
58 | + ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx, | ||
59 | + phys_ptr, prot, fsr); | ||
60 | + } | ||
61 | + qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32 | ||
62 | " mmu_idx %u -> %s (prot %c%c%c)\n", | ||
63 | access_type == MMU_DATA_LOAD ? "reading" : | ||
64 | (access_type == MMU_DATA_STORE ? "writing" : "execute"), | ||
65 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address, | ||
66 | return ret; | ||
67 | } | ||
68 | |||
69 | + /* Definitely a real MMU, not an MPU */ | ||
70 | + | ||
71 | if (regime_translation_disabled(env, mmu_idx)) { | ||
72 | - /* MMU/MPU disabled. */ | ||
73 | + /* MMU disabled. */ | ||
74 | *phys_ptr = address; | ||
75 | *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; | ||
76 | *page_size = TARGET_PAGE_SIZE; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | - if (arm_feature(env, ARM_FEATURE_PMSA)) { | ||
81 | - /* Pre-v7 MPU */ | ||
82 | - *page_size = TARGET_PAGE_SIZE; | ||
83 | - return get_phys_addr_pmsav5(env, address, access_type, mmu_idx, | ||
84 | - phys_ptr, prot, fsr); | ||
85 | - } | ||
86 | - | ||
87 | if (regime_using_lpae_format(env, mmu_idx)) { | ||
88 | return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr, | ||
89 | attrs, prot, page_size, fsr, fi); | ||
90 | -- | 387 | -- |
91 | 2.7.4 | 388 | 2.20.1 |
92 | 389 | ||
93 | 390 | diff view generated by jsdifflib |
1 | For M profile the XPSR is a similar but not identical format to the | 1 | In commit a3494d4671797c we reworked the M-profile handling of its |
---|---|---|---|
2 | A profile CPSR/SPSR. (For instance the Thumb bit is in a different | 2 | checks for when the NOCP exception should be raised because the FPU |
3 | place.) For guest accesses we make the M profile code go through | 3 | is disabled, so that (in line with the architecture) the NOCP check |
4 | xpsr_read() and xpsr_write() which handle the different layout. | 4 | is done early over a large range of the encoding space, and takes |
5 | However for migration we use cpsr_read() and cpsr_write() to | 5 | precedence over UNDEF exceptions. As part of this, we removed the |
6 | marshal state into and out of the migration data stream. This | 6 | code from full_vfp_access_check() which raised an exception there for |
7 | is pretty confusing and works more by luck than anything else. | 7 | M-profile with the FPU disabled, because it was no longer reachable. |
8 | Make M profile migration use xpsr_read() and xpsr_write() instead. | ||
9 | 8 | ||
10 | The most complicated part of this is handling the possibility | 9 | For MVE, some instructions which are outside the "coprocessor space" |
11 | that the migration source is an older QEMU which hands us a | 10 | region of the encoding space must nonetheless do "is the FPU enabled" |
12 | CPSR format value; helpfully we can always tell the two apart. | 11 | checks and possibly raise a NOCP exception. (In particular this |
12 | covers the MVE-specific low-overhead branch insns LCTP, DLSTP and | ||
13 | WLSTP.) To support these insns, reinstate the code in | ||
14 | full_vfp_access_check(), so that their trans functions can call | ||
15 | vfp_access_check() and get the correct behaviour. | ||
13 | 16 | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 18 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
16 | Message-id: 1501692241-23310-11-git-send-email-peter.maydell@linaro.org | 19 | Message-id: 20210614151007.4545-6-peter.maydell@linaro.org |
17 | --- | 20 | --- |
18 | target/arm/machine.c | 49 ++++++++++++++++++++++++++++++++++--------------- | 21 | target/arm/translate-vfp.c | 20 +++++++++++++++----- |
19 | 1 file changed, 34 insertions(+), 15 deletions(-) | 22 | 1 file changed, 15 insertions(+), 5 deletions(-) |
20 | 23 | ||
21 | diff --git a/target/arm/machine.c b/target/arm/machine.c | 24 | diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c |
22 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/machine.c | 26 | --- a/target/arm/translate-vfp.c |
24 | +++ b/target/arm/machine.c | 27 | +++ b/target/arm/translate-vfp.c |
25 | @@ -XXX,XX +XXX,XX @@ static int get_cpsr(QEMUFile *f, void *opaque, size_t size, | 28 | @@ -XXX,XX +XXX,XX @@ static void gen_preserve_fp_state(DisasContext *s) |
26 | uint32_t val = qemu_get_be32(f); | 29 | static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) |
27 | 30 | { | |
28 | if (arm_feature(env, ARM_FEATURE_M)) { | 31 | if (s->fp_excp_el) { |
29 | - /* If the I or F bits are set then this is a migration from | 32 | - /* M-profile handled this earlier, in disas_m_nocp() */ |
30 | - * an old QEMU which still stored the M profile FAULTMASK | 33 | - assert (!arm_dc_feature(s, ARM_FEATURE_M)); |
31 | - * and PRIMASK in env->daif. Set v7m.faultmask and v7m.primask | 34 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, |
32 | - * accordingly, and then clear the bits so they don't confuse | 35 | - syn_fp_access_trap(1, 0xe, false), |
33 | - * cpsr_write(). For a new QEMU, the bits here will always be | 36 | - s->fp_excp_el); |
34 | - * clear, and the data is transferred using the | 37 | + if (arm_dc_feature(s, ARM_FEATURE_M)) { |
35 | - * vmstate_m_faultmask_primask subsection. | 38 | + /* |
36 | - */ | 39 | + * M-profile mostly catches the "FPU disabled" case early, in |
37 | - if (val & CPSR_F) { | 40 | + * disas_m_nocp(), but a few insns (eg LCTP, WLSTP, DLSTP) |
38 | - env->v7m.faultmask = 1; | 41 | + * which do coprocessor-checks are outside the large ranges of |
39 | - } | 42 | + * the encoding space handled by the patterns in m-nocp.decode, |
40 | - if (val & CPSR_I) { | 43 | + * and for them we may need to raise NOCP here. |
41 | - env->v7m.primask = 1; | ||
42 | + if (val & XPSR_EXCP) { | ||
43 | + /* This is a CPSR format value from an older QEMU. (We can tell | ||
44 | + * because values transferred in XPSR format always have zero | ||
45 | + * for the EXCP field, and CPSR format will always have bit 4 | ||
46 | + * set in CPSR_M.) Rearrange it into XPSR format. The significant | ||
47 | + * differences are that the T bit is not in the same place, the | ||
48 | + * primask/faultmask info may be in the CPSR I and F bits, and | ||
49 | + * we do not want the mode bits. | ||
50 | + */ | 44 | + */ |
51 | + uint32_t newval = val; | 45 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, |
52 | + | 46 | + syn_uncategorized(), s->fp_excp_el); |
53 | + newval &= (CPSR_NZCV | CPSR_Q | CPSR_IT | CPSR_GE); | 47 | + } else { |
54 | + if (val & CPSR_T) { | 48 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, |
55 | + newval |= XPSR_T; | 49 | + syn_fp_access_trap(1, 0xe, false), |
56 | + } | 50 | + s->fp_excp_el); |
57 | + /* If the I or F bits are set then this is a migration from | 51 | + } |
58 | + * an old QEMU which still stored the M profile FAULTMASK | 52 | return false; |
59 | + * and PRIMASK in env->daif. For a new QEMU, the data is | ||
60 | + * transferred using the vmstate_m_faultmask_primask subsection. | ||
61 | + */ | ||
62 | + if (val & CPSR_F) { | ||
63 | + env->v7m.faultmask = 1; | ||
64 | + } | ||
65 | + if (val & CPSR_I) { | ||
66 | + env->v7m.primask = 1; | ||
67 | + } | ||
68 | + val = newval; | ||
69 | } | ||
70 | - val &= ~(CPSR_F | CPSR_I); | ||
71 | + /* Ignore the low bits, they are handled by vmstate_m. */ | ||
72 | + xpsr_write(env, val, ~XPSR_EXCP); | ||
73 | + return 0; | ||
74 | } | 53 | } |
75 | 54 | ||
76 | env->aarch64 = ((val & PSTATE_nRW) == 0); | ||
77 | @@ -XXX,XX +XXX,XX @@ static int put_cpsr(QEMUFile *f, void *opaque, size_t size, | ||
78 | CPUARMState *env = &cpu->env; | ||
79 | uint32_t val; | ||
80 | |||
81 | - if (is_a64(env)) { | ||
82 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
83 | + /* The low 9 bits are v7m.exception, which is handled by vmstate_m. */ | ||
84 | + val = xpsr_read(env) & ~XPSR_EXCP; | ||
85 | + } else if (is_a64(env)) { | ||
86 | val = pstate_read(env); | ||
87 | } else { | ||
88 | val = cpsr_read(env); | ||
89 | -- | 55 | -- |
90 | 2.7.4 | 56 | 2.20.1 |
91 | 57 | ||
92 | 58 | diff view generated by jsdifflib |
1 | Implement the new do_transaction_failed hook for ARM, which should | 1 | Implement the MVE LCTP instruction. |
---|---|---|---|
2 | cause the CPU to take a prefetch abort or data abort. | 2 | |
3 | We put its decode and implementation with the other | ||
4 | low-overhead-branch insns because although it is only present if MVE | ||
5 | is implemented it is logically in the same group as the other LOB | ||
6 | insns. | ||
3 | 7 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | Message-id: 20210614151007.4545-7-peter.maydell@linaro.org |
7 | --- | 11 | --- |
8 | target/arm/internals.h | 10 ++++++++++ | 12 | target/arm/t32.decode | 2 ++ |
9 | target/arm/cpu.c | 1 + | 13 | target/arm/translate.c | 24 ++++++++++++++++++++++++ |
10 | target/arm/op_helper.c | 43 +++++++++++++++++++++++++++++++++++++++++++ | 14 | 2 files changed, 26 insertions(+) |
11 | 3 files changed, 54 insertions(+) | ||
12 | 15 | ||
13 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 16 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode |
14 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/internals.h | 18 | --- a/target/arm/t32.decode |
16 | +++ b/target/arm/internals.h | 19 | +++ b/target/arm/t32.decode |
17 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | 20 | @@ -XXX,XX +XXX,XX @@ BL 1111 0. .......... 11.1 ............ @branch24 |
18 | MMUAccessType access_type, | 21 | DLS 1111 0 0000 100 rn:4 1110 0000 0000 0001 |
19 | int mmu_idx, uintptr_t retaddr); | 22 | WLS 1111 0 0000 100 rn:4 1100 . .......... 1 imm=%lob_imm |
20 | 23 | LE 1111 0 0000 0 f:1 0 1111 1100 . .......... 1 imm=%lob_imm | |
21 | +/* arm_cpu_do_transaction_failed: handle a memory system error response | ||
22 | + * (eg "no device/memory present at address") by raising an external abort | ||
23 | + * exception | ||
24 | + */ | ||
25 | +void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, | ||
26 | + vaddr addr, unsigned size, | ||
27 | + MMUAccessType access_type, | ||
28 | + int mmu_idx, MemTxAttrs attrs, | ||
29 | + MemTxResult response, uintptr_t retaddr); | ||
30 | + | 24 | + |
31 | /* Call the EL change hook if one has been registered */ | 25 | + LCTP 1111 0 0000 000 1111 1110 0000 0000 0001 |
32 | static inline void arm_call_el_change_hook(ARMCPU *cpu) | 26 | ] |
33 | { | 27 | } |
34 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 28 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
35 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu.c | 30 | --- a/target/arm/translate.c |
37 | +++ b/target/arm/cpu.c | 31 | +++ b/target/arm/translate.c |
38 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | 32 | @@ -XXX,XX +XXX,XX @@ static bool trans_LE(DisasContext *s, arg_LE *a) |
39 | #else | 33 | return true; |
40 | cc->do_interrupt = arm_cpu_do_interrupt; | ||
41 | cc->do_unaligned_access = arm_cpu_do_unaligned_access; | ||
42 | + cc->do_transaction_failed = arm_cpu_do_transaction_failed; | ||
43 | cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug; | ||
44 | cc->asidx_from_attrs = arm_asidx_from_attrs; | ||
45 | cc->vmsd = &vmstate_arm_cpu; | ||
46 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/op_helper.c | ||
49 | +++ b/target/arm/op_helper.c | ||
50 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | ||
51 | deliver_fault(cpu, vaddr, access_type, fsr, fsc, &fi); | ||
52 | } | 34 | } |
53 | 35 | ||
54 | +/* arm_cpu_do_transaction_failed: handle a memory system error response | 36 | +static bool trans_LCTP(DisasContext *s, arg_LCTP *a) |
55 | + * (eg "no device/memory present at address") by raising an external abort | ||
56 | + * exception | ||
57 | + */ | ||
58 | +void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, | ||
59 | + vaddr addr, unsigned size, | ||
60 | + MMUAccessType access_type, | ||
61 | + int mmu_idx, MemTxAttrs attrs, | ||
62 | + MemTxResult response, uintptr_t retaddr) | ||
63 | +{ | 37 | +{ |
64 | + ARMCPU *cpu = ARM_CPU(cs); | 38 | + /* |
65 | + CPUARMState *env = &cpu->env; | 39 | + * M-profile Loop Clear with Tail Predication. Since our implementation |
66 | + uint32_t fsr, fsc; | 40 | + * doesn't cache branch information, all we need to do is reset |
67 | + ARMMMUFaultInfo fi = {}; | 41 | + * FPSCR.LTPSIZE to 4. |
68 | + ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | 42 | + */ |
43 | + TCGv_i32 ltpsize; | ||
69 | + | 44 | + |
70 | + if (retaddr) { | 45 | + if (!dc_isar_feature(aa32_lob, s) || |
71 | + /* now we have a real cpu fault */ | 46 | + !dc_isar_feature(aa32_mve, s)) { |
72 | + cpu_restore_state(cs, retaddr); | 47 | + return false; |
73 | + } | 48 | + } |
74 | + | 49 | + |
75 | + /* The EA bit in syndromes and fault status registers is an | 50 | + if (!vfp_access_check(s)) { |
76 | + * IMPDEF classification of external aborts. ARM implementations | 51 | + return true; |
77 | + * usually use this to indicate AXI bus Decode error (0) or | 52 | + } |
78 | + * Slave error (1); in QEMU we follow that. | ||
79 | + */ | ||
80 | + fi.ea = (response != MEMTX_DECODE_ERROR); | ||
81 | + | 53 | + |
82 | + /* The fault status register format depends on whether we're using | 54 | + ltpsize = tcg_const_i32(4); |
83 | + * the LPAE long descriptor format, or the short descriptor format. | 55 | + store_cpu_field(ltpsize, v7m.ltpsize); |
84 | + */ | 56 | + return true; |
85 | + if (arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | ||
86 | + /* long descriptor form, STATUS 0b010000: synchronous ext abort */ | ||
87 | + fsr = (fi.ea << 12) | (1 << 9) | 0x10; | ||
88 | + } else { | ||
89 | + /* short descriptor form, FSR 0b01000 : synchronous ext abort */ | ||
90 | + fsr = (fi.ea << 12) | 0x8; | ||
91 | + } | ||
92 | + fsc = 0x10; | ||
93 | + | ||
94 | + deliver_fault(cpu, addr, access_type, fsr, fsc, &fi); | ||
95 | +} | 57 | +} |
96 | + | 58 | + |
97 | #endif /* !defined(CONFIG_USER_ONLY) */ | 59 | + |
98 | 60 | static bool op_tbranch(DisasContext *s, arg_tbranch *a, bool half) | |
99 | uint32_t HELPER(add_setq)(CPUARMState *env, uint32_t a, uint32_t b) | 61 | { |
62 | TCGv_i32 addr, tmp; | ||
100 | -- | 63 | -- |
101 | 2.7.4 | 64 | 2.20.1 |
102 | 65 | ||
103 | 66 | diff view generated by jsdifflib |
1 | We currently store the M profile CPU register state PRIMASK and | 1 | Implement the MVE WLSTP insn; this is like the existing WLS insn, |
---|---|---|---|
2 | FAULTMASK in the daif field of the CPU state in its I and F | 2 | except that it specifies a size value which is used to set |
3 | bits. This is a legacy from the original implementation, which | 3 | FPSCR.LTPSIZE. |
4 | tried to share the cpu_exec_interrupt code between A profile | ||
5 | and M profile. We've since separated out the two cases because | ||
6 | they are significantly different, so now there is no common | ||
7 | code between M and A profile which looks at env->daif: all the | ||
8 | uses are either in A-only or M-only code paths. Sharing the state | ||
9 | fields now is just confusing, and will make things awkward | ||
10 | when we implement v8M, where the PRIMASK and FAULTMASK | ||
11 | registers are banked between security states. | ||
12 | |||
13 | Switch M profile over to using v7m.faultmask and v7m.primask | ||
14 | fields for these registers. | ||
15 | 4 | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
18 | Message-id: 1501692241-23310-10-git-send-email-peter.maydell@linaro.org | 7 | Message-id: 20210614151007.4545-8-peter.maydell@linaro.org |
19 | --- | 8 | --- |
20 | target/arm/cpu.h | 4 +++- | 9 | target/arm/t32.decode | 8 ++++++-- |
21 | hw/intc/armv7m_nvic.c | 4 ++-- | 10 | target/arm/translate.c | 37 ++++++++++++++++++++++++++++++++++++- |
22 | target/arm/cpu.c | 5 ----- | 11 | 2 files changed, 42 insertions(+), 3 deletions(-) |
23 | target/arm/helper.c | 18 +++++------------- | ||
24 | target/arm/machine.c | 33 +++++++++++++++++++++++++++++++++ | ||
25 | 5 files changed, 43 insertions(+), 21 deletions(-) | ||
26 | 12 | ||
27 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 13 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode |
28 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/target/arm/cpu.h | 15 | --- a/target/arm/t32.decode |
30 | +++ b/target/arm/cpu.h | 16 | +++ b/target/arm/t32.decode |
31 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | 17 | @@ -XXX,XX +XXX,XX @@ BL 1111 0. .......... 11.1 ............ @branch24 |
32 | uint32_t bfar; /* BusFault Address */ | 18 | %lob_imm 1:10 11:1 !function=times_2 |
33 | unsigned mpu_ctrl; /* MPU_CTRL */ | 19 | |
34 | int exception; | 20 | DLS 1111 0 0000 100 rn:4 1110 0000 0000 0001 |
35 | + uint32_t primask; | 21 | - WLS 1111 0 0000 100 rn:4 1100 . .......... 1 imm=%lob_imm |
36 | + uint32_t faultmask; | 22 | - LE 1111 0 0000 0 f:1 0 1111 1100 . .......... 1 imm=%lob_imm |
37 | } v7m; | 23 | + WLS 1111 0 0000 100 rn:4 1100 . .......... 1 imm=%lob_imm size=4 |
38 | 24 | + { | |
39 | /* Information associated with an exception about to be taken: | 25 | + LE 1111 0 0000 0 f:1 0 1111 1100 . .......... 1 imm=%lob_imm |
40 | @@ -XXX,XX +XXX,XX @@ static inline int cpu_mmu_index(CPUARMState *env, bool ifetch) | 26 | + # This is WLSTP |
41 | * we're in a HardFault or NMI handler. | 27 | + WLS 1111 0 0000 0 size:2 rn:4 1100 . .......... 1 imm=%lob_imm |
28 | + } | ||
29 | |||
30 | LCTP 1111 0 0000 000 1111 1110 0000 0000 0001 | ||
31 | ] | ||
32 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/translate.c | ||
35 | +++ b/target/arm/translate.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static bool trans_WLS(DisasContext *s, arg_WLS *a) | ||
37 | return false; | ||
38 | } | ||
39 | if (a->rn == 13 || a->rn == 15) { | ||
40 | - /* CONSTRAINED UNPREDICTABLE: we choose to UNDEF */ | ||
41 | + /* | ||
42 | + * For WLSTP rn == 15 is a related encoding (LE); the | ||
43 | + * other cases caught by this condition are all | ||
44 | + * CONSTRAINED UNPREDICTABLE: we choose to UNDEF | ||
45 | + */ | ||
46 | return false; | ||
47 | } | ||
48 | if (s->condexec_mask) { | ||
49 | @@ -XXX,XX +XXX,XX @@ static bool trans_WLS(DisasContext *s, arg_WLS *a) | ||
42 | */ | 50 | */ |
43 | if ((env->v7m.exception > 0 && env->v7m.exception <= 3) | 51 | return false; |
44 | - || env->daif & PSTATE_F) { | ||
45 | + || env->v7m.faultmask) { | ||
46 | return arm_to_core_mmu_idx(ARMMMUIdx_MNegPri); | ||
47 | } | ||
48 | |||
49 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/hw/intc/armv7m_nvic.c | ||
52 | +++ b/hw/intc/armv7m_nvic.c | ||
53 | @@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s) | ||
54 | CPUARMState *env = &s->cpu->env; | ||
55 | int running; | ||
56 | |||
57 | - if (env->daif & PSTATE_F) { /* FAULTMASK */ | ||
58 | + if (env->v7m.faultmask) { | ||
59 | running = -1; | ||
60 | - } else if (env->daif & PSTATE_I) { /* PRIMASK */ | ||
61 | + } else if (env->v7m.primask) { | ||
62 | running = 0; | ||
63 | } else if (env->v7m.basepri > 0) { | ||
64 | running = env->v7m.basepri & nvic_gprio_mask(s); | ||
65 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
66 | index XXXXXXX..XXXXXXX 100644 | ||
67 | --- a/target/arm/cpu.c | ||
68 | +++ b/target/arm/cpu.c | ||
69 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s) | ||
70 | uint32_t initial_pc; /* Loaded from 0x4 */ | ||
71 | uint8_t *rom; | ||
72 | |||
73 | - /* For M profile we store FAULTMASK and PRIMASK in the | ||
74 | - * PSTATE F and I bits; these are both clear at reset. | ||
75 | - */ | ||
76 | - env->daif &= ~(PSTATE_I | PSTATE_F); | ||
77 | - | ||
78 | /* The reset value of this bit is IMPDEF, but ARM recommends | ||
79 | * that it resets to 1, so QEMU always does that rather than making | ||
80 | * it dependent on CPU model. | ||
81 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/target/arm/helper.c | ||
84 | +++ b/target/arm/helper.c | ||
85 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
86 | |||
87 | if (env->v7m.exception != ARMV7M_EXCP_NMI) { | ||
88 | /* Auto-clear FAULTMASK on return from other than NMI */ | ||
89 | - env->daif &= ~PSTATE_F; | ||
90 | + env->v7m.faultmask = 0; | ||
91 | } | 52 | } |
92 | 53 | + if (a->size != 4) { | |
93 | switch (armv7m_nvic_complete_irq(env->nvic, env->v7m.exception)) { | 54 | + /* WLSTP */ |
94 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) | 55 | + if (!dc_isar_feature(aa32_mve, s)) { |
95 | return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ? | 56 | + return false; |
96 | env->regs[13] : env->v7m.other_sp; | 57 | + } |
97 | case 16: /* PRIMASK */ | 58 | + /* |
98 | - return (env->daif & PSTATE_I) != 0; | 59 | + * We need to check that the FPU is enabled here, but mustn't |
99 | + return env->v7m.primask; | 60 | + * call vfp_access_check() to do that because we don't want to |
100 | case 17: /* BASEPRI */ | 61 | + * do the lazy state preservation in the "loop count is zero" case. |
101 | case 18: /* BASEPRI_MAX */ | 62 | + * Do the check-and-raise-exception by hand. |
102 | return env->v7m.basepri; | ||
103 | case 19: /* FAULTMASK */ | ||
104 | - return (env->daif & PSTATE_F) != 0; | ||
105 | + return env->v7m.faultmask; | ||
106 | default: | ||
107 | qemu_log_mask(LOG_GUEST_ERROR, "Attempt to read unknown special" | ||
108 | " register %d\n", reg); | ||
109 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
110 | } | ||
111 | break; | ||
112 | case 16: /* PRIMASK */ | ||
113 | - if (val & 1) { | ||
114 | - env->daif |= PSTATE_I; | ||
115 | - } else { | ||
116 | - env->daif &= ~PSTATE_I; | ||
117 | - } | ||
118 | + env->v7m.primask = val & 1; | ||
119 | break; | ||
120 | case 17: /* BASEPRI */ | ||
121 | env->v7m.basepri = val & 0xff; | ||
122 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
123 | env->v7m.basepri = val; | ||
124 | break; | ||
125 | case 19: /* FAULTMASK */ | ||
126 | - if (val & 1) { | ||
127 | - env->daif |= PSTATE_F; | ||
128 | - } else { | ||
129 | - env->daif &= ~PSTATE_F; | ||
130 | - } | ||
131 | + env->v7m.faultmask = val & 1; | ||
132 | break; | ||
133 | case 20: /* CONTROL */ | ||
134 | /* Writing to the SPSEL bit only has an effect if we are in | ||
135 | diff --git a/target/arm/machine.c b/target/arm/machine.c | ||
136 | index XXXXXXX..XXXXXXX 100644 | ||
137 | --- a/target/arm/machine.c | ||
138 | +++ b/target/arm/machine.c | ||
139 | @@ -XXX,XX +XXX,XX @@ static bool m_needed(void *opaque) | ||
140 | return arm_feature(env, ARM_FEATURE_M); | ||
141 | } | ||
142 | |||
143 | +static const VMStateDescription vmstate_m_faultmask_primask = { | ||
144 | + .name = "cpu/m/faultmask-primask", | ||
145 | + .version_id = 1, | ||
146 | + .minimum_version_id = 1, | ||
147 | + .fields = (VMStateField[]) { | ||
148 | + VMSTATE_UINT32(env.v7m.faultmask, ARMCPU), | ||
149 | + VMSTATE_UINT32(env.v7m.primask, ARMCPU), | ||
150 | + VMSTATE_END_OF_LIST() | ||
151 | + } | ||
152 | +}; | ||
153 | + | ||
154 | static const VMStateDescription vmstate_m = { | ||
155 | .name = "cpu/m", | ||
156 | .version_id = 4, | ||
157 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = { | ||
158 | VMSTATE_UINT32(env.v7m.mpu_ctrl, ARMCPU), | ||
159 | VMSTATE_INT32(env.v7m.exception, ARMCPU), | ||
160 | VMSTATE_END_OF_LIST() | ||
161 | + }, | ||
162 | + .subsections = (const VMStateDescription*[]) { | ||
163 | + &vmstate_m_faultmask_primask, | ||
164 | + NULL | ||
165 | } | ||
166 | }; | ||
167 | |||
168 | @@ -XXX,XX +XXX,XX @@ static int get_cpsr(QEMUFile *f, void *opaque, size_t size, | ||
169 | CPUARMState *env = &cpu->env; | ||
170 | uint32_t val = qemu_get_be32(f); | ||
171 | |||
172 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
173 | + /* If the I or F bits are set then this is a migration from | ||
174 | + * an old QEMU which still stored the M profile FAULTMASK | ||
175 | + * and PRIMASK in env->daif. Set v7m.faultmask and v7m.primask | ||
176 | + * accordingly, and then clear the bits so they don't confuse | ||
177 | + * cpsr_write(). For a new QEMU, the bits here will always be | ||
178 | + * clear, and the data is transferred using the | ||
179 | + * vmstate_m_faultmask_primask subsection. | ||
180 | + */ | 63 | + */ |
181 | + if (val & CPSR_F) { | 64 | + if (s->fp_excp_el) { |
182 | + env->v7m.faultmask = 1; | 65 | + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, |
66 | + syn_uncategorized(), s->fp_excp_el); | ||
67 | + return true; | ||
183 | + } | 68 | + } |
184 | + if (val & CPSR_I) { | ||
185 | + env->v7m.primask = 1; | ||
186 | + } | ||
187 | + val &= ~(CPSR_F | CPSR_I); | ||
188 | + } | 69 | + } |
189 | + | 70 | + |
190 | env->aarch64 = ((val & PSTATE_nRW) == 0); | 71 | nextlabel = gen_new_label(); |
191 | 72 | tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_R[a->rn], 0, nextlabel); | |
192 | if (is_a64(env)) { | 73 | tmp = load_reg(s, a->rn); |
74 | store_reg(s, 14, tmp); | ||
75 | + if (a->size != 4) { | ||
76 | + /* | ||
77 | + * WLSTP: set FPSCR.LTPSIZE. This requires that we do the | ||
78 | + * lazy state preservation, new FP context creation, etc, | ||
79 | + * that vfp_access_check() does. We know that the actual | ||
80 | + * access check will succeed (ie it won't generate code that | ||
81 | + * throws an exception) because we did that check by hand earlier. | ||
82 | + */ | ||
83 | + bool ok = vfp_access_check(s); | ||
84 | + assert(ok); | ||
85 | + tmp = tcg_const_i32(a->size); | ||
86 | + store_cpu_field(tmp, v7m.ltpsize); | ||
87 | + } | ||
88 | gen_jmp_tb(s, s->base.pc_next, 1); | ||
89 | |||
90 | gen_set_label(nextlabel); | ||
193 | -- | 91 | -- |
194 | 2.7.4 | 92 | 2.20.1 |
195 | 93 | ||
196 | 94 | diff view generated by jsdifflib |
1 | Tighten up the T32 decoder in the places where new v8M instructions | 1 | Implement the MVE DLSTP insn; this is like the existing DLS |
---|---|---|---|
2 | will be: | 2 | insn, except that it must do an FPU access check and it |
3 | * TT/TTT/TTA/TTAT are in what was nominally LDREX/STREX r15, ... | 3 | sets LTPSIZE to the value specified in the insn. |
4 | which is UNPREDICTABLE: | ||
5 | make the UNPREDICTABLE behaviour be to UNDEF | ||
6 | * BXNS/BLXNS are distinguished from BX/BLX via the low 3 bits, | ||
7 | which in previous architectural versions are SBZ: | ||
8 | enforce the SBZ via UNDEF rather than ignoring it, and move | ||
9 | the "ARCH(5)" UNDEF case up so we don't leak a TCG temporary | ||
10 | * SG is in the encoding which would be LDRD/STRD with rn = r15; | ||
11 | this is UNPREDICTABLE and we currently UNDEF: | ||
12 | move this check further up the code so that we don't leak | ||
13 | TCG temporaries in the UNDEF case and have a better place | ||
14 | to put the SG decode. | ||
15 | |||
16 | This means that if a v8M binary is accidentally run on v7M | ||
17 | or if a test case hits something that we haven't implemented | ||
18 | yet the behaviour will be obvious (UNDEF) rather than obscure | ||
19 | (plough on treating it as a different instruction). | ||
20 | |||
21 | In the process, add some comments about the instruction patterns | ||
22 | at these points in the decode. Our Thumb and ARM decoders are | ||
23 | very difficult to understand currently, but gradually adding | ||
24 | comments like this should help to clarify what exactly has | ||
25 | been decoded when. | ||
26 | 4 | ||
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
30 | Message-id: 1501692241-23310-5-git-send-email-peter.maydell@linaro.org | 7 | Message-id: 20210614151007.4545-9-peter.maydell@linaro.org |
31 | --- | 8 | --- |
32 | target/arm/translate.c | 48 +++++++++++++++++++++++++++++++++++++++--------- | 9 | target/arm/t32.decode | 9 ++++++--- |
33 | 1 file changed, 39 insertions(+), 9 deletions(-) | 10 | target/arm/translate.c | 23 +++++++++++++++++++++-- |
11 | 2 files changed, 27 insertions(+), 5 deletions(-) | ||
34 | 12 | ||
13 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/t32.decode | ||
16 | +++ b/target/arm/t32.decode | ||
17 | @@ -XXX,XX +XXX,XX @@ BL 1111 0. .......... 11.1 ............ @branch24 | ||
18 | # LE and WLS immediate | ||
19 | %lob_imm 1:10 11:1 !function=times_2 | ||
20 | |||
21 | - DLS 1111 0 0000 100 rn:4 1110 0000 0000 0001 | ||
22 | + DLS 1111 0 0000 100 rn:4 1110 0000 0000 0001 size=4 | ||
23 | WLS 1111 0 0000 100 rn:4 1100 . .......... 1 imm=%lob_imm size=4 | ||
24 | { | ||
25 | LE 1111 0 0000 0 f:1 0 1111 1100 . .......... 1 imm=%lob_imm | ||
26 | # This is WLSTP | ||
27 | WLS 1111 0 0000 0 size:2 rn:4 1100 . .......... 1 imm=%lob_imm | ||
28 | } | ||
29 | - | ||
30 | - LCTP 1111 0 0000 000 1111 1110 0000 0000 0001 | ||
31 | + { | ||
32 | + LCTP 1111 0 0000 000 1111 1110 0000 0000 0001 | ||
33 | + # This is DLSTP | ||
34 | + DLS 1111 0 0000 0 size:2 rn:4 1110 0000 0000 0001 | ||
35 | + } | ||
36 | ] | ||
37 | } | ||
35 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 38 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
36 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/target/arm/translate.c | 40 | --- a/target/arm/translate.c |
38 | +++ b/target/arm/translate.c | 41 | +++ b/target/arm/translate.c |
39 | @@ -XXX,XX +XXX,XX @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw | 42 | @@ -XXX,XX +XXX,XX @@ static bool trans_DLS(DisasContext *s, arg_DLS *a) |
40 | abort(); | 43 | return false; |
41 | case 4: | 44 | } |
42 | if (insn & (1 << 22)) { | 45 | if (a->rn == 13 || a->rn == 15) { |
43 | - /* Other load/store, table branch. */ | 46 | - /* CONSTRAINED UNPREDICTABLE: we choose to UNDEF */ |
44 | + /* 0b1110_100x_x1xx_xxxx_xxxx_xxxx_xxxx_xxxx | 47 | + /* |
45 | + * - load/store doubleword, load/store exclusive, ldacq/strel, | 48 | + * For DLSTP rn == 15 is a related encoding (LCTP); the |
46 | + * table branch. | 49 | + * other cases caught by this condition are all |
47 | + */ | 50 | + * CONSTRAINED UNPREDICTABLE: we choose to UNDEF |
48 | if (insn & 0x01200000) { | 51 | + */ |
49 | - /* Load/store doubleword. */ | 52 | return false; |
50 | + /* 0b1110_1000_x11x_xxxx_xxxx_xxxx_xxxx_xxxx | 53 | } |
51 | + * - load/store dual (post-indexed) | 54 | |
52 | + * 0b1111_1001_x10x_xxxx_xxxx_xxxx_xxxx_xxxx | 55 | - /* Not a while loop, no tail predication: just set LR to the count */ |
53 | + * - load/store dual (literal and immediate) | 56 | + if (a->size != 4) { |
54 | + * 0b1111_1001_x11x_xxxx_xxxx_xxxx_xxxx_xxxx | 57 | + /* DLSTP */ |
55 | + * - load/store dual (pre-indexed) | 58 | + if (!dc_isar_feature(aa32_mve, s)) { |
56 | + */ | 59 | + return false; |
57 | if (rn == 15) { | 60 | + } |
58 | + if (insn & (1 << 21)) { | 61 | + if (!vfp_access_check(s)) { |
59 | + /* UNPREDICTABLE */ | 62 | + return true; |
60 | + goto illegal_op; | 63 | + } |
61 | + } | 64 | + } |
62 | addr = tcg_temp_new_i32(); | ||
63 | tcg_gen_movi_i32(addr, s->pc & ~3); | ||
64 | } else { | ||
65 | @@ -XXX,XX +XXX,XX @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw | ||
66 | } | ||
67 | if (insn & (1 << 21)) { | ||
68 | /* Base writeback. */ | ||
69 | - if (rn == 15) | ||
70 | - goto illegal_op; | ||
71 | tcg_gen_addi_i32(addr, addr, offset - 4); | ||
72 | store_reg(s, rn, addr); | ||
73 | } else { | ||
74 | tcg_temp_free_i32(addr); | ||
75 | } | ||
76 | } else if ((insn & (1 << 23)) == 0) { | ||
77 | - /* Load/store exclusive word. */ | ||
78 | + /* 0b1110_1000_010x_xxxx_xxxx_xxxx_xxxx_xxxx | ||
79 | + * - load/store exclusive word | ||
80 | + */ | ||
81 | + if (rs == 15) { | ||
82 | + goto illegal_op; | ||
83 | + } | ||
84 | addr = tcg_temp_local_new_i32(); | ||
85 | load_reg_var(s, addr, rn); | ||
86 | tcg_gen_addi_i32(addr, addr, (insn & 0xff) << 2); | ||
87 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) | ||
88 | break; | ||
89 | } | ||
90 | if (insn & (1 << 10)) { | ||
91 | - /* data processing extended or blx */ | ||
92 | + /* 0b0100_01xx_xxxx_xxxx | ||
93 | + * - data processing extended, branch and exchange | ||
94 | + */ | ||
95 | rd = (insn & 7) | ((insn >> 4) & 8); | ||
96 | rm = (insn >> 3) & 0xf; | ||
97 | op = (insn >> 8) & 3; | ||
98 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) | ||
99 | tmp = load_reg(s, rm); | ||
100 | store_reg(s, rd, tmp); | ||
101 | break; | ||
102 | - case 3:/* branch [and link] exchange thumb register */ | ||
103 | - tmp = load_reg(s, rm); | ||
104 | - if (insn & (1 << 7)) { | ||
105 | + case 3: | ||
106 | + { | ||
107 | + /* 0b0100_0111_xxxx_xxxx | ||
108 | + * - branch [and link] exchange thumb register | ||
109 | + */ | ||
110 | + bool link = insn & (1 << 7); | ||
111 | + | 65 | + |
112 | + if (insn & 7) { | 66 | + /* Not a while loop: set LR to the count, and set LTPSIZE for DLSTP */ |
113 | + goto undef; | 67 | tmp = load_reg(s, a->rn); |
114 | + } | 68 | store_reg(s, 14, tmp); |
115 | + if (link) { | 69 | + if (a->size != 4) { |
116 | ARCH(5); | 70 | + /* DLSTP: set FPSCR.LTPSIZE */ |
117 | + } | 71 | + tmp = tcg_const_i32(a->size); |
118 | + tmp = load_reg(s, rm); | 72 | + store_cpu_field(tmp, v7m.ltpsize); |
119 | + if (link) { | 73 | + } |
120 | val = (uint32_t)s->pc | 1; | 74 | return true; |
121 | tmp2 = tcg_temp_new_i32(); | 75 | } |
122 | tcg_gen_movi_i32(tmp2, val); | ||
123 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) | ||
124 | } | ||
125 | break; | ||
126 | } | ||
127 | + } | ||
128 | break; | ||
129 | } | ||
130 | 76 | ||
131 | -- | 77 | -- |
132 | 2.7.4 | 78 | 2.20.1 |
133 | 79 | ||
134 | 80 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Remove the comment that claims that some MPU_CTRL bits are stored | ||
2 | in sctlr_el[1]. This has never been true since MPU_CTRL was added | ||
3 | in commit 29c483a50607 -- the comment is a leftover from | ||
4 | Michael Davidsaver's original implementation, which I modified | ||
5 | not to use sctlr_el[1]; I forgot to delete the comment then. | ||
6 | 1 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 1501692241-23310-7-git-send-email-peter.maydell@linaro.org | ||
11 | --- | ||
12 | target/arm/cpu.h | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/cpu.h | ||
18 | +++ b/target/arm/cpu.h | ||
19 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState { | ||
20 | uint32_t dfsr; /* Debug Fault Status Register */ | ||
21 | uint32_t mmfar; /* MemManage Fault Address */ | ||
22 | uint32_t bfar; /* BusFault Address */ | ||
23 | - unsigned mpu_ctrl; /* MPU_CTRL (some bits kept in sctlr_el[1]) */ | ||
24 | + unsigned mpu_ctrl; /* MPU_CTRL */ | ||
25 | int exception; | ||
26 | } v7m; | ||
27 | |||
28 | -- | ||
29 | 2.7.4 | ||
30 | |||
31 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | When we switched our handling of exception exit to detect | ||
2 | the magic addresses at translate time rather than via | ||
3 | a do_unassigned_access hook, we forgot to update a | ||
4 | comment; correct the omission. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 1501692241-23310-8-git-send-email-peter.maydell@linaro.org | ||
10 | --- | ||
11 | target/arm/helper.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
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 @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
19 | bool rettobase = false; | ||
20 | |||
21 | /* We can only get here from an EXCP_EXCEPTION_EXIT, and | ||
22 | - * arm_v7m_do_unassigned_access() enforces the architectural rule | ||
23 | + * gen_bx_excret() enforces the architectural rule | ||
24 | * that jumps to magic addresses don't have magic behaviour unless | ||
25 | * we're in Handler mode (compare pseudocode BXWritePC()). | ||
26 | */ | ||
27 | -- | ||
28 | 2.7.4 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The M profile XPSR is almost the same format as the A profile CPSR, | ||
2 | but not quite. Define some XPSR_* macros and use them where we | ||
3 | definitely dealing with an XPSR rather than reusing the CPSR ones. | ||
4 | 1 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 1501692241-23310-9-git-send-email-peter.maydell@linaro.org | ||
9 | --- | ||
10 | target/arm/cpu.h | 38 ++++++++++++++++++++++++++++---------- | ||
11 | target/arm/helper.c | 15 ++++++++------- | ||
12 | 2 files changed, 36 insertions(+), 17 deletions(-) | ||
13 | |||
14 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/cpu.h | ||
17 | +++ b/target/arm/cpu.h | ||
18 | @@ -XXX,XX +XXX,XX @@ void pmccntr_sync(CPUARMState *env); | ||
19 | /* Mask of bits which may be set by exception return copying them from SPSR */ | ||
20 | #define CPSR_ERET_MASK (~CPSR_RESERVED) | ||
21 | |||
22 | +/* Bit definitions for M profile XPSR. Most are the same as CPSR. */ | ||
23 | +#define XPSR_EXCP 0x1ffU | ||
24 | +#define XPSR_SPREALIGN (1U << 9) /* Only set in exception stack frames */ | ||
25 | +#define XPSR_IT_2_7 CPSR_IT_2_7 | ||
26 | +#define XPSR_GE CPSR_GE | ||
27 | +#define XPSR_SFPA (1U << 20) /* Only set in exception stack frames */ | ||
28 | +#define XPSR_T (1U << 24) /* Not the same as CPSR_T ! */ | ||
29 | +#define XPSR_IT_0_1 CPSR_IT_0_1 | ||
30 | +#define XPSR_Q CPSR_Q | ||
31 | +#define XPSR_V CPSR_V | ||
32 | +#define XPSR_C CPSR_C | ||
33 | +#define XPSR_Z CPSR_Z | ||
34 | +#define XPSR_N CPSR_N | ||
35 | +#define XPSR_NZCV CPSR_NZCV | ||
36 | +#define XPSR_IT CPSR_IT | ||
37 | + | ||
38 | #define TTBCR_N (7U << 0) /* TTBCR.EAE==0 */ | ||
39 | #define TTBCR_T0SZ (7U << 0) /* TTBCR.EAE==1 */ | ||
40 | #define TTBCR_PD0 (1U << 4) | ||
41 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t xpsr_read(CPUARMState *env) | ||
42 | /* Set the xPSR. Note that some bits of mask must be all-set or all-clear. */ | ||
43 | static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | ||
44 | { | ||
45 | - if (mask & CPSR_NZCV) { | ||
46 | - env->ZF = (~val) & CPSR_Z; | ||
47 | + if (mask & XPSR_NZCV) { | ||
48 | + env->ZF = (~val) & XPSR_Z; | ||
49 | env->NF = val; | ||
50 | env->CF = (val >> 29) & 1; | ||
51 | env->VF = (val << 3) & 0x80000000; | ||
52 | } | ||
53 | - if (mask & CPSR_Q) | ||
54 | - env->QF = ((val & CPSR_Q) != 0); | ||
55 | - if (mask & (1 << 24)) | ||
56 | - env->thumb = ((val & (1 << 24)) != 0); | ||
57 | - if (mask & CPSR_IT_0_1) { | ||
58 | + if (mask & XPSR_Q) { | ||
59 | + env->QF = ((val & XPSR_Q) != 0); | ||
60 | + } | ||
61 | + if (mask & XPSR_T) { | ||
62 | + env->thumb = ((val & XPSR_T) != 0); | ||
63 | + } | ||
64 | + if (mask & XPSR_IT_0_1) { | ||
65 | env->condexec_bits &= ~3; | ||
66 | env->condexec_bits |= (val >> 25) & 3; | ||
67 | } | ||
68 | - if (mask & CPSR_IT_2_7) { | ||
69 | + if (mask & XPSR_IT_2_7) { | ||
70 | env->condexec_bits &= 3; | ||
71 | env->condexec_bits |= (val >> 8) & 0xfc; | ||
72 | } | ||
73 | - if (mask & 0x1ff) { | ||
74 | - env->v7m.exception = val & 0x1ff; | ||
75 | + if (mask & XPSR_EXCP) { | ||
76 | + env->v7m.exception = val & XPSR_EXCP; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/target/arm/helper.c | ||
83 | +++ b/target/arm/helper.c | ||
84 | @@ -XXX,XX +XXX,XX @@ static void v7m_push_stack(ARMCPU *cpu) | ||
85 | /* Align stack pointer if the guest wants that */ | ||
86 | if ((env->regs[13] & 4) && (env->v7m.ccr & R_V7M_CCR_STKALIGN_MASK)) { | ||
87 | env->regs[13] -= 4; | ||
88 | - xpsr |= 0x200; | ||
89 | + xpsr |= XPSR_SPREALIGN; | ||
90 | } | ||
91 | /* Switch to the handler mode. */ | ||
92 | v7m_push(env, xpsr); | ||
93 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
94 | env->regs[15] &= ~1U; | ||
95 | } | ||
96 | xpsr = v7m_pop(env); | ||
97 | - xpsr_write(env, xpsr, 0xfffffdff); | ||
98 | + xpsr_write(env, xpsr, ~XPSR_SPREALIGN); | ||
99 | /* Undo stack alignment. */ | ||
100 | - if (xpsr & 0x200) | ||
101 | + if (xpsr & XPSR_SPREALIGN) { | ||
102 | env->regs[13] |= 4; | ||
103 | + } | ||
104 | |||
105 | /* The restored xPSR exception field will be zero if we're | ||
106 | * resuming in Thread mode. If that doesn't match what the | ||
107 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) | ||
108 | case 0 ... 7: /* xPSR sub-fields */ | ||
109 | mask = 0; | ||
110 | if ((reg & 1) && el) { | ||
111 | - mask |= 0x000001ff; /* IPSR (unpriv. reads as zero) */ | ||
112 | + mask |= XPSR_EXCP; /* IPSR (unpriv. reads as zero) */ | ||
113 | } | ||
114 | if (!(reg & 4)) { | ||
115 | - mask |= 0xf8000000; /* APSR */ | ||
116 | + mask |= XPSR_NZCV | XPSR_Q; /* APSR */ | ||
117 | } | ||
118 | /* EPSR reads as zero */ | ||
119 | return xpsr_read(env) & mask; | ||
120 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
121 | uint32_t apsrmask = 0; | ||
122 | |||
123 | if (mask & 8) { | ||
124 | - apsrmask |= 0xf8000000; /* APSR NZCVQ */ | ||
125 | + apsrmask |= XPSR_NZCV | XPSR_Q; | ||
126 | } | ||
127 | if ((mask & 4) && arm_feature(env, ARM_FEATURE_THUMB_DSP)) { | ||
128 | - apsrmask |= 0x000f0000; /* APSR GE[3:0] */ | ||
129 | + apsrmask |= XPSR_GE; | ||
130 | } | ||
131 | xpsr_write(env, val, apsrmask); | ||
132 | } | ||
133 | -- | ||
134 | 2.7.4 | ||
135 | |||
136 | diff view generated by jsdifflib |
1 | The ARMv7M architecture specifies that most of the addresses in the | 1 | Implement the MVE LETP insn. This is like the existing LE loop-end |
---|---|---|---|
2 | PPB region (which includes the NVIC, systick and system registers) | 2 | insn, but it must perform an FPU-enabled check, and on loop-exit it |
3 | are not accessible to unprivileged accesses, which should | 3 | resets LTPSIZE to 4. |
4 | BusFault with a few exceptions: | ||
5 | * the STIR is configurably user-accessible | ||
6 | * the ITM (which we don't implement at all) is always | ||
7 | user-accessible | ||
8 | 4 | ||
9 | Implement this by switching the register access functions | 5 | To accommodate the requirement to do something on loop-exit, we drop |
10 | to the _with_attrs scheme that lets us distinguish user | 6 | the use of condlabel and instead manage both the TB exits manually, |
11 | mode accesses. | 7 | in the same way we already do in trans_WLS(). |
12 | 8 | ||
13 | This allows us to pull the handling of the CCR.USERSETMPEND | 9 | The other MVE-specific change to the LE insn is that we must raise an |
14 | flag up to the level where we can make it generate a BusFault | 10 | INVSTATE UsageFault insn if LTPSIZE is not 4. |
15 | as it should for non-permitted accesses. | ||
16 | |||
17 | Note that until the core ARM CPU code implements turning | ||
18 | MEMTX_ERROR into a BusFault the registers will continue to | ||
19 | act as RAZ/WI to user accesses. | ||
20 | 11 | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
22 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
23 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
24 | Message-id: 1501692241-23310-16-git-send-email-peter.maydell@linaro.org | 14 | Message-id: 20210614151007.4545-10-peter.maydell@linaro.org |
25 | --- | 15 | --- |
26 | hw/intc/armv7m_nvic.c | 58 ++++++++++++++++++++++++++++++++++++--------------- | 16 | target/arm/t32.decode | 2 +- |
27 | 1 file changed, 41 insertions(+), 17 deletions(-) | 17 | target/arm/translate.c | 104 +++++++++++++++++++++++++++++++++++++---- |
18 | 2 files changed, 97 insertions(+), 9 deletions(-) | ||
28 | 19 | ||
29 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 20 | diff --git a/target/arm/t32.decode b/target/arm/t32.decode |
30 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/intc/armv7m_nvic.c | 22 | --- a/target/arm/t32.decode |
32 | +++ b/hw/intc/armv7m_nvic.c | 23 | +++ b/target/arm/t32.decode |
33 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) | 24 | @@ -XXX,XX +XXX,XX @@ BL 1111 0. .......... 11.1 ............ @branch24 |
25 | DLS 1111 0 0000 100 rn:4 1110 0000 0000 0001 size=4 | ||
26 | WLS 1111 0 0000 100 rn:4 1100 . .......... 1 imm=%lob_imm size=4 | ||
27 | { | ||
28 | - LE 1111 0 0000 0 f:1 0 1111 1100 . .......... 1 imm=%lob_imm | ||
29 | + LE 1111 0 0000 0 f:1 tp:1 1111 1100 . .......... 1 imm=%lob_imm | ||
30 | # This is WLSTP | ||
31 | WLS 1111 0 0000 0 size:2 rn:4 1100 . .......... 1 imm=%lob_imm | ||
34 | } | 32 | } |
35 | case 0xf00: /* Software Triggered Interrupt Register */ | 33 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
36 | { | 34 | index XXXXXXX..XXXXXXX 100644 |
37 | - /* user mode can only write to STIR if CCR.USERSETMPEND permits it */ | 35 | --- a/target/arm/translate.c |
38 | int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; | 36 | +++ b/target/arm/translate.c |
39 | - if (excnum < s->num_irq && | 37 | @@ -XXX,XX +XXX,XX @@ static bool trans_LE(DisasContext *s, arg_LE *a) |
40 | - (arm_current_el(&cpu->env) || | 38 | * any faster. |
41 | - (cpu->env.v7m.ccr & R_V7M_CCR_USERSETMPEND_MASK))) { | 39 | */ |
42 | + if (excnum < s->num_irq) { | 40 | TCGv_i32 tmp; |
43 | armv7m_nvic_set_pending(s, excnum); | 41 | + TCGLabel *loopend; |
44 | } | 42 | + bool fpu_active; |
45 | break; | 43 | |
46 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value) | 44 | if (!dc_isar_feature(aa32_lob, s)) { |
45 | return false; | ||
47 | } | 46 | } |
48 | } | 47 | + if (a->f && a->tp) { |
49 | |||
50 | -static uint64_t nvic_sysreg_read(void *opaque, hwaddr addr, | ||
51 | - unsigned size) | ||
52 | +static bool nvic_user_access_ok(NVICState *s, hwaddr offset) | ||
53 | +{ | ||
54 | + /* Return true if unprivileged access to this register is permitted. */ | ||
55 | + switch (offset) { | ||
56 | + case 0xf00: /* STIR: accessible only if CCR.USERSETMPEND permits */ | ||
57 | + return s->cpu->env.v7m.ccr & R_V7M_CCR_USERSETMPEND_MASK; | ||
58 | + default: | ||
59 | + /* All other user accesses cause a BusFault unconditionally */ | ||
60 | + return false; | 48 | + return false; |
61 | + } | 49 | + } |
62 | +} | 50 | + if (s->condexec_mask) { |
51 | + /* | ||
52 | + * LE in an IT block is CONSTRAINED UNPREDICTABLE; | ||
53 | + * we choose to UNDEF, because otherwise our use of | ||
54 | + * gen_goto_tb(1) would clash with the use of TB exit 1 | ||
55 | + * in the dc->condjmp condition-failed codepath in | ||
56 | + * arm_tr_tb_stop() and we'd get an assertion. | ||
57 | + */ | ||
58 | + return false; | ||
59 | + } | ||
60 | + if (a->tp) { | ||
61 | + /* LETP */ | ||
62 | + if (!dc_isar_feature(aa32_mve, s)) { | ||
63 | + return false; | ||
64 | + } | ||
65 | + if (!vfp_access_check(s)) { | ||
66 | + s->eci_handled = true; | ||
67 | + return true; | ||
68 | + } | ||
69 | + } | ||
70 | |||
71 | /* LE/LETP is OK with ECI set and leaves it untouched */ | ||
72 | s->eci_handled = true; | ||
73 | |||
74 | - if (!a->f) { | ||
75 | - /* Not loop-forever. If LR <= 1 this is the last loop: do nothing. */ | ||
76 | - arm_gen_condlabel(s); | ||
77 | - tcg_gen_brcondi_i32(TCG_COND_LEU, cpu_R[14], 1, s->condlabel); | ||
78 | - /* Decrement LR */ | ||
79 | - tmp = load_reg(s, 14); | ||
80 | - tcg_gen_addi_i32(tmp, tmp, -1); | ||
81 | - store_reg(s, 14, tmp); | ||
82 | + /* | ||
83 | + * With MVE, LTPSIZE might not be 4, and we must emit an INVSTATE | ||
84 | + * UsageFault exception for the LE insn in that case. Note that we | ||
85 | + * are not directly checking FPSCR.LTPSIZE but instead check the | ||
86 | + * pseudocode LTPSIZE() function, which returns 4 if the FPU is | ||
87 | + * not currently active (ie ActiveFPState() returns false). We | ||
88 | + * can identify not-active purely from our TB state flags, as the | ||
89 | + * FPU is active only if: | ||
90 | + * the FPU is enabled | ||
91 | + * AND lazy state preservation is not active | ||
92 | + * AND we do not need a new fp context (this is the ASPEN/FPCA check) | ||
93 | + * | ||
94 | + * Usually we don't need to care about this distinction between | ||
95 | + * LTPSIZE and FPSCR.LTPSIZE, because the code in vfp_access_check() | ||
96 | + * will either take an exception or clear the conditions that make | ||
97 | + * the FPU not active. But LE is an unusual case of a non-FP insn | ||
98 | + * that looks at LTPSIZE. | ||
99 | + */ | ||
100 | + fpu_active = !s->fp_excp_el && !s->v7m_lspact && !s->v7m_new_fp_ctxt_needed; | ||
63 | + | 101 | + |
64 | +static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr, | 102 | + if (!a->tp && dc_isar_feature(aa32_mve, s) && fpu_active) { |
65 | + uint64_t *data, unsigned size, | 103 | + /* Need to do a runtime check for LTPSIZE != 4 */ |
66 | + MemTxAttrs attrs) | 104 | + TCGLabel *skipexc = gen_new_label(); |
67 | { | 105 | + tmp = load_cpu_field(v7m.ltpsize); |
68 | NVICState *s = (NVICState *)opaque; | 106 | + tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 4, skipexc); |
69 | uint32_t offset = addr; | 107 | + tcg_temp_free_i32(tmp); |
70 | unsigned i, startvec, end; | 108 | + gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(), |
71 | uint32_t val; | 109 | + default_exception_el(s)); |
72 | 110 | + gen_set_label(skipexc); | |
73 | + if (attrs.user && !nvic_user_access_ok(s, addr)) { | ||
74 | + /* Generate BusFault for unprivileged accesses */ | ||
75 | + return MEMTX_ERROR; | ||
76 | + } | 111 | + } |
77 | + | 112 | + |
78 | switch (offset) { | 113 | + if (a->f) { |
79 | /* reads of set and clear both return the status */ | 114 | + /* Loop-forever: just jump back to the loop start */ |
80 | case 0x100 ... 0x13f: /* NVIC Set enable */ | 115 | + gen_jmp(s, read_pc(s) - a->imm); |
81 | @@ -XXX,XX +XXX,XX @@ static uint64_t nvic_sysreg_read(void *opaque, hwaddr addr, | 116 | + return true; |
82 | } | ||
83 | |||
84 | trace_nvic_sysreg_read(addr, val, size); | ||
85 | - return val; | ||
86 | + *data = val; | ||
87 | + return MEMTX_OK; | ||
88 | } | ||
89 | |||
90 | -static void nvic_sysreg_write(void *opaque, hwaddr addr, | ||
91 | - uint64_t value, unsigned size) | ||
92 | +static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | ||
93 | + uint64_t value, unsigned size, | ||
94 | + MemTxAttrs attrs) | ||
95 | { | ||
96 | NVICState *s = (NVICState *)opaque; | ||
97 | uint32_t offset = addr; | ||
98 | @@ -XXX,XX +XXX,XX @@ static void nvic_sysreg_write(void *opaque, hwaddr addr, | ||
99 | |||
100 | trace_nvic_sysreg_write(addr, value, size); | ||
101 | |||
102 | + if (attrs.user && !nvic_user_access_ok(s, addr)) { | ||
103 | + /* Generate BusFault for unprivileged accesses */ | ||
104 | + return MEMTX_ERROR; | ||
105 | + } | 117 | + } |
106 | + | 118 | + |
107 | switch (offset) { | 119 | + /* |
108 | case 0x100 ... 0x13f: /* NVIC Set enable */ | 120 | + * Not loop-forever. If LR <= loop-decrement-value this is the last loop. |
109 | offset += 0x80; | 121 | + * For LE, we know at this point that LTPSIZE must be 4 and the |
110 | @@ -XXX,XX +XXX,XX @@ static void nvic_sysreg_write(void *opaque, hwaddr addr, | 122 | + * loop decrement value is 1. For LETP we need to calculate the decrement |
111 | } | 123 | + * value from LTPSIZE. |
112 | } | 124 | + */ |
113 | nvic_irq_update(s); | 125 | + loopend = gen_new_label(); |
114 | - return; | 126 | + if (!a->tp) { |
115 | + return MEMTX_OK; | 127 | + tcg_gen_brcondi_i32(TCG_COND_LEU, cpu_R[14], 1, loopend); |
116 | case 0x200 ... 0x23f: /* NVIC Set pend */ | 128 | + tcg_gen_addi_i32(cpu_R[14], cpu_R[14], -1); |
117 | /* the special logic in armv7m_nvic_set_pending() | 129 | + } else { |
118 | * is not needed since IRQs are never escalated | 130 | + /* |
119 | @@ -XXX,XX +XXX,XX @@ static void nvic_sysreg_write(void *opaque, hwaddr addr, | 131 | + * Decrement by 1 << (4 - LTPSIZE). We need to use a TCG local |
120 | } | 132 | + * so that decr stays live after the brcondi. |
121 | } | 133 | + */ |
122 | nvic_irq_update(s); | 134 | + TCGv_i32 decr = tcg_temp_local_new_i32(); |
123 | - return; | 135 | + TCGv_i32 ltpsize = load_cpu_field(v7m.ltpsize); |
124 | + return MEMTX_OK; | 136 | + tcg_gen_sub_i32(decr, tcg_constant_i32(4), ltpsize); |
125 | case 0x300 ... 0x33f: /* NVIC Active */ | 137 | + tcg_gen_shl_i32(decr, tcg_constant_i32(1), decr); |
126 | - return; /* R/O */ | 138 | + tcg_temp_free_i32(ltpsize); |
127 | + return MEMTX_OK; /* R/O */ | 139 | + |
128 | case 0x400 ... 0x5ef: /* NVIC Priority */ | 140 | + tcg_gen_brcond_i32(TCG_COND_LEU, cpu_R[14], decr, loopend); |
129 | startvec = 8 * (offset - 0x400) + NVIC_FIRST_IRQ; /* vector # */ | 141 | + |
130 | 142 | + tcg_gen_sub_i32(cpu_R[14], cpu_R[14], decr); | |
131 | @@ -XXX,XX +XXX,XX @@ static void nvic_sysreg_write(void *opaque, hwaddr addr, | 143 | + tcg_temp_free_i32(decr); |
132 | set_prio(s, startvec + i, (value >> (i * 8)) & 0xff); | ||
133 | } | ||
134 | nvic_irq_update(s); | ||
135 | - return; | ||
136 | + return MEMTX_OK; | ||
137 | case 0xd18 ... 0xd23: /* System Handler Priority. */ | ||
138 | for (i = 0; i < size; i++) { | ||
139 | unsigned hdlidx = (offset - 0xd14) + i; | ||
140 | set_prio(s, hdlidx, (value >> (i * 8)) & 0xff); | ||
141 | } | ||
142 | nvic_irq_update(s); | ||
143 | - return; | ||
144 | + return MEMTX_OK; | ||
145 | } | 144 | } |
146 | if (size == 4) { | 145 | /* Jump back to the loop start */ |
147 | nvic_writel(s, offset, value); | 146 | gen_jmp(s, read_pc(s) - a->imm); |
148 | - return; | 147 | + |
149 | + return MEMTX_OK; | 148 | + gen_set_label(loopend); |
150 | } | 149 | + if (a->tp) { |
151 | qemu_log_mask(LOG_GUEST_ERROR, | 150 | + /* Exits from tail-pred loops must reset LTPSIZE to 4 */ |
152 | "NVIC: Bad write of size %d at offset 0x%x\n", size, offset); | 151 | + tmp = tcg_const_i32(4); |
153 | + /* This is UNPREDICTABLE; treat as RAZ/WI */ | 152 | + store_cpu_field(tmp, v7m.ltpsize); |
154 | + return MEMTX_OK; | 153 | + } |
154 | + /* End TB, continuing to following insn */ | ||
155 | + gen_jmp_tb(s, s->base.pc_next, 1); | ||
156 | return true; | ||
155 | } | 157 | } |
156 | 158 | ||
157 | static const MemoryRegionOps nvic_sysreg_ops = { | ||
158 | - .read = nvic_sysreg_read, | ||
159 | - .write = nvic_sysreg_write, | ||
160 | + .read_with_attrs = nvic_sysreg_read, | ||
161 | + .write_with_attrs = nvic_sysreg_write, | ||
162 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
163 | }; | ||
164 | |||
165 | -- | 159 | -- |
166 | 2.7.4 | 160 | 2.20.1 |
167 | 161 | ||
168 | 162 | diff view generated by jsdifflib |
1 | Make the arm_cpu_dump_state() debug logging handle the M-profile XPSR | 1 | Add the framework for decoding MVE insns, with the necessary new |
---|---|---|---|
2 | rather than assuming it's an A-profile CPSR. On M profile the PSR | 2 | files and the meson.build rules, but no actual content yet. |
3 | line of a register dump will now look like this: | ||
4 | |||
5 | XPSR=41000000 -Z-- T priv-thread | ||
6 | 3 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 1501692241-23310-12-git-send-email-peter.maydell@linaro.org | 6 | Message-id: 20210614151007.4545-11-peter.maydell@linaro.org |
11 | --- | 7 | --- |
12 | target/arm/translate.c | 58 ++++++++++++++++++++++++++++++++++---------------- | 8 | target/arm/translate-a32.h | 1 + |
13 | 1 file changed, 40 insertions(+), 18 deletions(-) | 9 | target/arm/mve.decode | 20 ++++++++++++++++++++ |
10 | target/arm/translate-mve.c | 29 +++++++++++++++++++++++++++++ | ||
11 | target/arm/translate.c | 1 + | ||
12 | target/arm/meson.build | 2 ++ | ||
13 | 5 files changed, 53 insertions(+) | ||
14 | create mode 100644 target/arm/mve.decode | ||
15 | create mode 100644 target/arm/translate-mve.c | ||
14 | 16 | ||
17 | diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/translate-a32.h | ||
20 | +++ b/target/arm/translate-a32.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | |||
23 | /* Prototypes for autogenerated disassembler functions */ | ||
24 | bool disas_m_nocp(DisasContext *dc, uint32_t insn); | ||
25 | +bool disas_mve(DisasContext *dc, uint32_t insn); | ||
26 | bool disas_vfp(DisasContext *s, uint32_t insn); | ||
27 | bool disas_vfp_uncond(DisasContext *s, uint32_t insn); | ||
28 | bool disas_neon_dp(DisasContext *s, uint32_t insn); | ||
29 | diff --git a/target/arm/mve.decode b/target/arm/mve.decode | ||
30 | new file mode 100644 | ||
31 | index XXXXXXX..XXXXXXX | ||
32 | --- /dev/null | ||
33 | +++ b/target/arm/mve.decode | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | +# M-profile MVE instruction descriptions | ||
36 | +# | ||
37 | +# Copyright (c) 2021 Linaro, Ltd | ||
38 | +# | ||
39 | +# This library is free software; you can redistribute it and/or | ||
40 | +# modify it under the terms of the GNU Lesser General Public | ||
41 | +# License as published by the Free Software Foundation; either | ||
42 | +# version 2.1 of the License, or (at your option) any later version. | ||
43 | +# | ||
44 | +# This library is distributed in the hope that it will be useful, | ||
45 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
46 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
47 | +# Lesser General Public License for more details. | ||
48 | +# | ||
49 | +# You should have received a copy of the GNU Lesser General Public | ||
50 | +# License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
51 | + | ||
52 | +# | ||
53 | +# This file is processed by scripts/decodetree.py | ||
54 | +# | ||
55 | diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c | ||
56 | new file mode 100644 | ||
57 | index XXXXXXX..XXXXXXX | ||
58 | --- /dev/null | ||
59 | +++ b/target/arm/translate-mve.c | ||
60 | @@ -XXX,XX +XXX,XX @@ | ||
61 | +/* | ||
62 | + * ARM translation: M-profile MVE instructions | ||
63 | + * | ||
64 | + * Copyright (c) 2021 Linaro, Ltd. | ||
65 | + * | ||
66 | + * This library is free software; you can redistribute it and/or | ||
67 | + * modify it under the terms of the GNU Lesser General Public | ||
68 | + * License as published by the Free Software Foundation; either | ||
69 | + * version 2.1 of the License, or (at your option) any later version. | ||
70 | + * | ||
71 | + * This library is distributed in the hope that it will be useful, | ||
72 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
73 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
74 | + * Lesser General Public License for more details. | ||
75 | + * | ||
76 | + * You should have received a copy of the GNU Lesser General Public | ||
77 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
78 | + */ | ||
79 | + | ||
80 | +#include "qemu/osdep.h" | ||
81 | +#include "tcg/tcg-op.h" | ||
82 | +#include "tcg/tcg-op-gvec.h" | ||
83 | +#include "exec/exec-all.h" | ||
84 | +#include "exec/gen-icount.h" | ||
85 | +#include "translate.h" | ||
86 | +#include "translate-a32.h" | ||
87 | + | ||
88 | +/* Include the generated decoder */ | ||
89 | +#include "decode-mve.c.inc" | ||
15 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 90 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
16 | index XXXXXXX..XXXXXXX 100644 | 91 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate.c | 92 | --- a/target/arm/translate.c |
18 | +++ b/target/arm/translate.c | 93 | +++ b/target/arm/translate.c |
19 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, | 94 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) |
20 | ARMCPU *cpu = ARM_CPU(cs); | 95 | if (disas_t32(s, insn) || |
21 | CPUARMState *env = &cpu->env; | 96 | disas_vfp_uncond(s, insn) || |
22 | int i; | 97 | disas_neon_shared(s, insn) || |
23 | - uint32_t psr; | 98 | + disas_mve(s, insn) || |
24 | - const char *ns_status; | 99 | ((insn >> 28) == 0xe && disas_vfp(s, insn))) { |
25 | 100 | return; | |
26 | if (is_a64(env)) { | ||
27 | aarch64_cpu_dump_state(cs, f, cpu_fprintf, flags); | ||
28 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, | ||
29 | else | ||
30 | cpu_fprintf(f, " "); | ||
31 | } | 101 | } |
32 | - psr = cpsr_read(env); | 102 | diff --git a/target/arm/meson.build b/target/arm/meson.build |
33 | 103 | index XXXXXXX..XXXXXXX 100644 | |
34 | - if (arm_feature(env, ARM_FEATURE_EL3) && | 104 | --- a/target/arm/meson.build |
35 | - (psr & CPSR_M) != ARM_CPU_MODE_MON) { | 105 | +++ b/target/arm/meson.build |
36 | - ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S "; | 106 | @@ -XXX,XX +XXX,XX @@ gen = [ |
37 | + if (arm_feature(env, ARM_FEATURE_M)) { | 107 | decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'), |
38 | + uint32_t xpsr = xpsr_read(env); | 108 | decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'), |
39 | + const char *mode; | 109 | decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'), |
40 | + | 110 | + decodetree.process('mve.decode', extra_args: '--decode=disas_mve'), |
41 | + if (xpsr & XPSR_EXCP) { | 111 | decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'), |
42 | + mode = "handler"; | 112 | decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'), |
43 | + } else { | 113 | decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'), |
44 | + if (env->v7m.control & R_V7M_CONTROL_NPRIV_MASK) { | 114 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(files( |
45 | + mode = "unpriv-thread"; | 115 | 'tlb_helper.c', |
46 | + } else { | 116 | 'translate.c', |
47 | + mode = "priv-thread"; | 117 | 'translate-m-nocp.c', |
48 | + } | 118 | + 'translate-mve.c', |
49 | + } | 119 | 'translate-neon.c', |
50 | + | 120 | 'translate-vfp.c', |
51 | + cpu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s\n", | 121 | 'vec_helper.c', |
52 | + xpsr, | ||
53 | + xpsr & XPSR_N ? 'N' : '-', | ||
54 | + xpsr & XPSR_Z ? 'Z' : '-', | ||
55 | + xpsr & XPSR_C ? 'C' : '-', | ||
56 | + xpsr & XPSR_V ? 'V' : '-', | ||
57 | + xpsr & XPSR_T ? 'T' : 'A', | ||
58 | + mode); | ||
59 | } else { | ||
60 | - ns_status = ""; | ||
61 | - } | ||
62 | - | ||
63 | - cpu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n", | ||
64 | - psr, | ||
65 | - psr & (1 << 31) ? 'N' : '-', | ||
66 | - psr & (1 << 30) ? 'Z' : '-', | ||
67 | - psr & (1 << 29) ? 'C' : '-', | ||
68 | - psr & (1 << 28) ? 'V' : '-', | ||
69 | - psr & CPSR_T ? 'T' : 'A', | ||
70 | - ns_status, | ||
71 | - cpu_mode_names[psr & 0xf], (psr & 0x10) ? 32 : 26); | ||
72 | + uint32_t psr = cpsr_read(env); | ||
73 | + const char *ns_status = ""; | ||
74 | + | ||
75 | + if (arm_feature(env, ARM_FEATURE_EL3) && | ||
76 | + (psr & CPSR_M) != ARM_CPU_MODE_MON) { | ||
77 | + ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S "; | ||
78 | + } | ||
79 | + | ||
80 | + cpu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n", | ||
81 | + psr, | ||
82 | + psr & CPSR_N ? 'N' : '-', | ||
83 | + psr & CPSR_Z ? 'Z' : '-', | ||
84 | + psr & CPSR_C ? 'C' : '-', | ||
85 | + psr & CPSR_V ? 'V' : '-', | ||
86 | + psr & CPSR_T ? 'T' : 'A', | ||
87 | + ns_status, | ||
88 | + cpu_mode_names[psr & 0xf], (psr & 0x10) ? 32 : 26); | ||
89 | + } | ||
90 | |||
91 | if (flags & CPU_DUMP_FPU) { | ||
92 | int numvfpregs = 0; | ||
93 | -- | 122 | -- |
94 | 2.7.4 | 123 | 2.20.1 |
95 | 124 | ||
96 | 125 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Add a utility function for testing whether the CPU is in Handler | ||
2 | mode; this is just a check whether v7m.exception is non-zero, but | ||
3 | we do it in several places and it makes the code a bit easier | ||
4 | to read to not have to mentally figure out what the test is testing. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 1501692241-23310-14-git-send-email-peter.maydell@linaro.org | ||
11 | --- | ||
12 | target/arm/cpu.h | 10 ++++++++-- | ||
13 | target/arm/helper.c | 8 ++++---- | ||
14 | 2 files changed, 12 insertions(+), 6 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 @@ static inline int arm_highest_el(CPUARMState *env) | ||
21 | return 1; | ||
22 | } | ||
23 | |||
24 | +/* Return true if a v7M CPU is in Handler mode */ | ||
25 | +static inline bool arm_v7m_is_handler_mode(CPUARMState *env) | ||
26 | +{ | ||
27 | + return env->v7m.exception != 0; | ||
28 | +} | ||
29 | + | ||
30 | /* Return the current Exception Level (as per ARMv8; note that this differs | ||
31 | * from the ARMv7 Privilege Level). | ||
32 | */ | ||
33 | static inline int arm_current_el(CPUARMState *env) | ||
34 | { | ||
35 | if (arm_feature(env, ARM_FEATURE_M)) { | ||
36 | - return !((env->v7m.exception == 0) && (env->v7m.control & 1)); | ||
37 | + return arm_v7m_is_handler_mode(env) || !(env->v7m.control & 1); | ||
38 | } | ||
39 | |||
40 | if (is_a64(env)) { | ||
41 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
42 | } | ||
43 | *flags |= fp_exception_el(env) << ARM_TBFLAG_FPEXC_EL_SHIFT; | ||
44 | |||
45 | - if (env->v7m.exception != 0) { | ||
46 | + if (arm_v7m_is_handler_mode(env)) { | ||
47 | *flags |= ARM_TBFLAG_HANDLER_MASK; | ||
48 | } | ||
49 | |||
50 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/target/arm/helper.c | ||
53 | +++ b/target/arm/helper.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
55 | * that jumps to magic addresses don't have magic behaviour unless | ||
56 | * we're in Handler mode (compare pseudocode BXWritePC()). | ||
57 | */ | ||
58 | - assert(env->v7m.exception != 0); | ||
59 | + assert(arm_v7m_is_handler_mode(env)); | ||
60 | |||
61 | /* In the spec pseudocode ExceptionReturn() is called directly | ||
62 | * from BXWritePC() and gets the full target PC value including | ||
63 | @@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu) | ||
64 | * resuming in Thread mode. If that doesn't match what the | ||
65 | * exception return type specified then this is a UsageFault. | ||
66 | */ | ||
67 | - if (return_to_handler == (env->v7m.exception == 0)) { | ||
68 | + if (return_to_handler != arm_v7m_is_handler_mode(env)) { | ||
69 | /* Take an INVPC UsageFault by pushing the stack again. */ | ||
70 | armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE); | ||
71 | env->v7m.cfsr |= R_V7M_CFSR_INVPC_MASK; | ||
72 | @@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs) | ||
73 | if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) { | ||
74 | lr |= 4; | ||
75 | } | ||
76 | - if (env->v7m.exception == 0) { | ||
77 | + if (!arm_v7m_is_handler_mode(env)) { | ||
78 | lr |= 8; | ||
79 | } | ||
80 | |||
81 | @@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val) | ||
82 | * switch_v7m_sp() deals with updating the SPSEL bit in | ||
83 | * env->v7m.control, so we only need update the others. | ||
84 | */ | ||
85 | - if (env->v7m.exception == 0) { | ||
86 | + if (!arm_v7m_is_handler_mode(env)) { | ||
87 | switch_v7m_sp(env, (val & R_V7M_CONTROL_SPSEL_MASK) != 0); | ||
88 | } | ||
89 | env->v7m.control &= ~R_V7M_CONTROL_NPRIV_MASK; | ||
90 | -- | ||
91 | 2.7.4 | ||
92 | |||
93 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The armv7m_nvic.h header file was accidentally placed in | ||
2 | include/hw/arm; move it to include/hw/intc to match where | ||
3 | its corresponding .c file lives. | ||
4 | 1 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 1501692241-23310-15-git-send-email-peter.maydell@linaro.org | ||
10 | --- | ||
11 | include/hw/arm/armv7m.h | 2 +- | ||
12 | include/hw/{arm => intc}/armv7m_nvic.h | 0 | ||
13 | hw/intc/armv7m_nvic.c | 2 +- | ||
14 | 3 files changed, 2 insertions(+), 2 deletions(-) | ||
15 | rename include/hw/{arm => intc}/armv7m_nvic.h (100%) | ||
16 | |||
17 | diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/hw/arm/armv7m.h | ||
20 | +++ b/include/hw/arm/armv7m.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | #define HW_ARM_ARMV7M_H | ||
23 | |||
24 | #include "hw/sysbus.h" | ||
25 | -#include "hw/arm/armv7m_nvic.h" | ||
26 | +#include "hw/intc/armv7m_nvic.h" | ||
27 | |||
28 | #define TYPE_BITBAND "ARM,bitband-memory" | ||
29 | #define BITBAND(obj) OBJECT_CHECK(BitBandState, (obj), TYPE_BITBAND) | ||
30 | diff --git a/include/hw/arm/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h | ||
31 | similarity index 100% | ||
32 | rename from include/hw/arm/armv7m_nvic.h | ||
33 | rename to include/hw/intc/armv7m_nvic.h | ||
34 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/hw/intc/armv7m_nvic.c | ||
37 | +++ b/hw/intc/armv7m_nvic.c | ||
38 | @@ -XXX,XX +XXX,XX @@ | ||
39 | #include "hw/sysbus.h" | ||
40 | #include "qemu/timer.h" | ||
41 | #include "hw/arm/arm.h" | ||
42 | -#include "hw/arm/armv7m_nvic.h" | ||
43 | +#include "hw/intc/armv7m_nvic.h" | ||
44 | #include "target/arm/cpu.h" | ||
45 | #include "exec/exec-all.h" | ||
46 | #include "qemu/log.h" | ||
47 | -- | ||
48 | 2.7.4 | ||
49 | |||
50 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Some ELF files have program headers that specify segments that | ||
2 | are of zero size. Ignore them, rather than trying to create | ||
3 | zero-length ROM blobs for them, because the zero-length blob | ||
4 | can falsely trigger the overlapping-ROM-blobs check. | ||
5 | 1 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Tested-by: Hua Yanghao <huayanghao@gmail.com> | ||
10 | Message-id: 1502116754-18867-3-git-send-email-peter.maydell@linaro.org | ||
11 | --- | ||
12 | include/hw/elf_ops.h | 24 +++++++++++++++++------- | ||
13 | 1 file changed, 17 insertions(+), 7 deletions(-) | ||
14 | |||
15 | diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/elf_ops.h | ||
18 | +++ b/include/hw/elf_ops.h | ||
19 | @@ -XXX,XX +XXX,XX @@ static int glue(load_elf, SZ)(const char *name, int fd, | ||
20 | *pentry = ehdr.e_entry - ph->p_vaddr + ph->p_paddr; | ||
21 | } | ||
22 | |||
23 | - if (load_rom) { | ||
24 | - snprintf(label, sizeof(label), "phdr #%d: %s", i, name); | ||
25 | - | ||
26 | - /* rom_add_elf_program() seize the ownership of 'data' */ | ||
27 | - rom_add_elf_program(label, data, file_size, mem_size, addr, as); | ||
28 | - } else { | ||
29 | - cpu_physical_memory_write(addr, data, file_size); | ||
30 | + if (mem_size == 0) { | ||
31 | + /* Some ELF files really do have segments of zero size; | ||
32 | + * just ignore them rather than trying to create empty | ||
33 | + * ROM blobs, because the zero-length blob can falsely | ||
34 | + * trigger the overlapping-ROM-blobs check. | ||
35 | + */ | ||
36 | g_free(data); | ||
37 | + } else { | ||
38 | + if (load_rom) { | ||
39 | + snprintf(label, sizeof(label), "phdr #%d: %s", i, name); | ||
40 | + | ||
41 | + /* rom_add_elf_program() seize the ownership of 'data' */ | ||
42 | + rom_add_elf_program(label, data, file_size, mem_size, | ||
43 | + addr, as); | ||
44 | + } else { | ||
45 | + cpu_physical_memory_write(addr, data, file_size); | ||
46 | + g_free(data); | ||
47 | + } | ||
48 | } | ||
49 | |||
50 | total_size += mem_size; | ||
51 | -- | ||
52 | 2.7.4 | ||
53 | |||
54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
2 | 1 | ||
3 | Mimicking gicv3-maintenance-interrupt, add the PMU's interrupt to | ||
4 | CPU state. | ||
5 | |||
6 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Message-id: 1500471597-2517-2-git-send-email-drjones@redhat.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/cpu.h | 2 ++ | ||
12 | hw/arm/virt.c | 3 +++ | ||
13 | target/arm/cpu.c | 2 ++ | ||
14 | 3 files changed, 7 insertions(+) | ||
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 @@ struct ARMCPU { | ||
21 | qemu_irq gt_timer_outputs[NUM_GTIMERS]; | ||
22 | /* GPIO output for GICv3 maintenance interrupt signal */ | ||
23 | qemu_irq gicv3_maintenance_interrupt; | ||
24 | + /* GPIO output for the PMU interrupt */ | ||
25 | + qemu_irq pmu_interrupt; | ||
26 | |||
27 | /* MemoryRegion to use for secure physical accesses */ | ||
28 | MemoryRegion *secure_memory; | ||
29 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/virt.c | ||
32 | +++ b/hw/arm/virt.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void create_gic(VirtMachineState *vms, qemu_irq *pic) | ||
34 | qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", 0, | ||
35 | qdev_get_gpio_in(gicdev, ppibase | ||
36 | + ARCH_GICV3_MAINT_IRQ)); | ||
37 | + qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0, | ||
38 | + qdev_get_gpio_in(gicdev, ppibase | ||
39 | + + VIRTUAL_PMU_IRQ)); | ||
40 | |||
41 | sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); | ||
42 | sysbus_connect_irq(gicbusdev, i + smp_cpus, | ||
43 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/target/arm/cpu.c | ||
46 | +++ b/target/arm/cpu.c | ||
47 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj) | ||
48 | |||
49 | qdev_init_gpio_out_named(DEVICE(cpu), &cpu->gicv3_maintenance_interrupt, | ||
50 | "gicv3-maintenance-interrupt", 1); | ||
51 | + qdev_init_gpio_out_named(DEVICE(cpu), &cpu->pmu_interrupt, | ||
52 | + "pmu-interrupt", 1); | ||
53 | #endif | ||
54 | |||
55 | /* DTB consumers generally don't in fact care what the 'compatible' | ||
56 | -- | ||
57 | 2.7.4 | ||
58 | |||
59 | diff view generated by jsdifflib |
1 | Call the new cpu_transaction_failed() hook at the places where | 1 | For MVE, we want to re-use the large data table from expand_pred_b(). |
---|---|---|---|
2 | CPU generated code interacts with the memory system: | 2 | Move the data table to vec_helper.c so it is no longer in an SVE |
3 | io_readx() | 3 | specific source file. |
4 | io_writex() | ||
5 | get_page_addr_code() | ||
6 | |||
7 | Any access from C code (eg via cpu_physical_memory_rw(), | ||
8 | address_space_rw(), ld/st_*_phys()) will *not* trigger CPU exceptions | ||
9 | via cpu_transaction_failed(). Handling for transactions failures for | ||
10 | this kind of call should be done by using a function which returns a | ||
11 | MemTxResult and treating the failure case appropriately in the | ||
12 | calling code. | ||
13 | |||
14 | In an ideal world we would not generate CPU exceptions for | ||
15 | instruction fetch failures in get_page_addr_code() but instead wait | ||
16 | until the code translation process tried a load and it failed; | ||
17 | however that change would require too great a restructuring and | ||
18 | redesign to attempt at this point. | ||
19 | 4 | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20210614151007.4545-14-peter.maydell@linaro.org | ||
22 | --- | 8 | --- |
23 | softmmu_template.h | 4 ++-- | 9 | target/arm/vec_internal.h | 3 ++ |
24 | accel/tcg/cputlb.c | 32 ++++++++++++++++++++++++++++++-- | 10 | target/arm/sve_helper.c | 103 ++------------------------------------ |
25 | 2 files changed, 32 insertions(+), 4 deletions(-) | 11 | target/arm/vec_helper.c | 102 +++++++++++++++++++++++++++++++++++++ |
26 | 12 | 3 files changed, 109 insertions(+), 99 deletions(-) | |
27 | diff --git a/softmmu_template.h b/softmmu_template.h | 13 | |
14 | diff --git a/target/arm/vec_internal.h b/target/arm/vec_internal.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/softmmu_template.h | 16 | --- a/target/arm/vec_internal.h |
30 | +++ b/softmmu_template.h | 17 | +++ b/target/arm/vec_internal.h |
31 | @@ -XXX,XX +XXX,XX @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, | 18 | @@ -XXX,XX +XXX,XX @@ |
32 | uintptr_t retaddr) | 19 | #define H8(x) (x) |
20 | #define H1_8(x) (x) | ||
21 | |||
22 | +/* Data for expanding active predicate bits to bytes, for byte elements. */ | ||
23 | +extern const uint64_t expand_pred_b_data[256]; | ||
24 | + | ||
25 | static inline void clear_tail(void *vd, uintptr_t opr_sz, uintptr_t max_sz) | ||
33 | { | 26 | { |
34 | CPUIOTLBEntry *iotlbentry = &env->iotlb[mmu_idx][index]; | 27 | uint64_t *d = vd + opr_sz; |
35 | - return io_readx(env, iotlbentry, addr, retaddr, DATA_SIZE); | 28 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c |
36 | + return io_readx(env, iotlbentry, mmu_idx, addr, retaddr, DATA_SIZE); | 29 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/target/arm/sve_helper.c | ||
31 | +++ b/target/arm/sve_helper.c | ||
32 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(sve_predtest)(void *vd, void *vg, uint32_t words) | ||
33 | return flags; | ||
37 | } | 34 | } |
38 | #endif | 35 | |
39 | 36 | -/* Expand active predicate bits to bytes, for byte elements. | |
40 | @@ -XXX,XX +XXX,XX @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env, | 37 | - * for (i = 0; i < 256; ++i) { |
41 | uintptr_t retaddr) | 38 | - * unsigned long m = 0; |
39 | - * for (j = 0; j < 8; j++) { | ||
40 | - * if ((i >> j) & 1) { | ||
41 | - * m |= 0xfful << (j << 3); | ||
42 | - * } | ||
43 | - * } | ||
44 | - * printf("0x%016lx,\n", m); | ||
45 | - * } | ||
46 | +/* | ||
47 | + * Expand active predicate bits to bytes, for byte elements. | ||
48 | + * (The data table itself is in vec_helper.c as MVE also needs it.) | ||
49 | */ | ||
50 | static inline uint64_t expand_pred_b(uint8_t byte) | ||
42 | { | 51 | { |
43 | CPUIOTLBEntry *iotlbentry = &env->iotlb[mmu_idx][index]; | 52 | - static const uint64_t word[256] = { |
44 | - return io_writex(env, iotlbentry, val, addr, retaddr, DATA_SIZE); | 53 | - 0x0000000000000000, 0x00000000000000ff, 0x000000000000ff00, |
45 | + return io_writex(env, iotlbentry, mmu_idx, val, addr, retaddr, DATA_SIZE); | 54 | - 0x000000000000ffff, 0x0000000000ff0000, 0x0000000000ff00ff, |
55 | - 0x0000000000ffff00, 0x0000000000ffffff, 0x00000000ff000000, | ||
56 | - 0x00000000ff0000ff, 0x00000000ff00ff00, 0x00000000ff00ffff, | ||
57 | - 0x00000000ffff0000, 0x00000000ffff00ff, 0x00000000ffffff00, | ||
58 | - 0x00000000ffffffff, 0x000000ff00000000, 0x000000ff000000ff, | ||
59 | - 0x000000ff0000ff00, 0x000000ff0000ffff, 0x000000ff00ff0000, | ||
60 | - 0x000000ff00ff00ff, 0x000000ff00ffff00, 0x000000ff00ffffff, | ||
61 | - 0x000000ffff000000, 0x000000ffff0000ff, 0x000000ffff00ff00, | ||
62 | - 0x000000ffff00ffff, 0x000000ffffff0000, 0x000000ffffff00ff, | ||
63 | - 0x000000ffffffff00, 0x000000ffffffffff, 0x0000ff0000000000, | ||
64 | - 0x0000ff00000000ff, 0x0000ff000000ff00, 0x0000ff000000ffff, | ||
65 | - 0x0000ff0000ff0000, 0x0000ff0000ff00ff, 0x0000ff0000ffff00, | ||
66 | - 0x0000ff0000ffffff, 0x0000ff00ff000000, 0x0000ff00ff0000ff, | ||
67 | - 0x0000ff00ff00ff00, 0x0000ff00ff00ffff, 0x0000ff00ffff0000, | ||
68 | - 0x0000ff00ffff00ff, 0x0000ff00ffffff00, 0x0000ff00ffffffff, | ||
69 | - 0x0000ffff00000000, 0x0000ffff000000ff, 0x0000ffff0000ff00, | ||
70 | - 0x0000ffff0000ffff, 0x0000ffff00ff0000, 0x0000ffff00ff00ff, | ||
71 | - 0x0000ffff00ffff00, 0x0000ffff00ffffff, 0x0000ffffff000000, | ||
72 | - 0x0000ffffff0000ff, 0x0000ffffff00ff00, 0x0000ffffff00ffff, | ||
73 | - 0x0000ffffffff0000, 0x0000ffffffff00ff, 0x0000ffffffffff00, | ||
74 | - 0x0000ffffffffffff, 0x00ff000000000000, 0x00ff0000000000ff, | ||
75 | - 0x00ff00000000ff00, 0x00ff00000000ffff, 0x00ff000000ff0000, | ||
76 | - 0x00ff000000ff00ff, 0x00ff000000ffff00, 0x00ff000000ffffff, | ||
77 | - 0x00ff0000ff000000, 0x00ff0000ff0000ff, 0x00ff0000ff00ff00, | ||
78 | - 0x00ff0000ff00ffff, 0x00ff0000ffff0000, 0x00ff0000ffff00ff, | ||
79 | - 0x00ff0000ffffff00, 0x00ff0000ffffffff, 0x00ff00ff00000000, | ||
80 | - 0x00ff00ff000000ff, 0x00ff00ff0000ff00, 0x00ff00ff0000ffff, | ||
81 | - 0x00ff00ff00ff0000, 0x00ff00ff00ff00ff, 0x00ff00ff00ffff00, | ||
82 | - 0x00ff00ff00ffffff, 0x00ff00ffff000000, 0x00ff00ffff0000ff, | ||
83 | - 0x00ff00ffff00ff00, 0x00ff00ffff00ffff, 0x00ff00ffffff0000, | ||
84 | - 0x00ff00ffffff00ff, 0x00ff00ffffffff00, 0x00ff00ffffffffff, | ||
85 | - 0x00ffff0000000000, 0x00ffff00000000ff, 0x00ffff000000ff00, | ||
86 | - 0x00ffff000000ffff, 0x00ffff0000ff0000, 0x00ffff0000ff00ff, | ||
87 | - 0x00ffff0000ffff00, 0x00ffff0000ffffff, 0x00ffff00ff000000, | ||
88 | - 0x00ffff00ff0000ff, 0x00ffff00ff00ff00, 0x00ffff00ff00ffff, | ||
89 | - 0x00ffff00ffff0000, 0x00ffff00ffff00ff, 0x00ffff00ffffff00, | ||
90 | - 0x00ffff00ffffffff, 0x00ffffff00000000, 0x00ffffff000000ff, | ||
91 | - 0x00ffffff0000ff00, 0x00ffffff0000ffff, 0x00ffffff00ff0000, | ||
92 | - 0x00ffffff00ff00ff, 0x00ffffff00ffff00, 0x00ffffff00ffffff, | ||
93 | - 0x00ffffffff000000, 0x00ffffffff0000ff, 0x00ffffffff00ff00, | ||
94 | - 0x00ffffffff00ffff, 0x00ffffffffff0000, 0x00ffffffffff00ff, | ||
95 | - 0x00ffffffffffff00, 0x00ffffffffffffff, 0xff00000000000000, | ||
96 | - 0xff000000000000ff, 0xff0000000000ff00, 0xff0000000000ffff, | ||
97 | - 0xff00000000ff0000, 0xff00000000ff00ff, 0xff00000000ffff00, | ||
98 | - 0xff00000000ffffff, 0xff000000ff000000, 0xff000000ff0000ff, | ||
99 | - 0xff000000ff00ff00, 0xff000000ff00ffff, 0xff000000ffff0000, | ||
100 | - 0xff000000ffff00ff, 0xff000000ffffff00, 0xff000000ffffffff, | ||
101 | - 0xff0000ff00000000, 0xff0000ff000000ff, 0xff0000ff0000ff00, | ||
102 | - 0xff0000ff0000ffff, 0xff0000ff00ff0000, 0xff0000ff00ff00ff, | ||
103 | - 0xff0000ff00ffff00, 0xff0000ff00ffffff, 0xff0000ffff000000, | ||
104 | - 0xff0000ffff0000ff, 0xff0000ffff00ff00, 0xff0000ffff00ffff, | ||
105 | - 0xff0000ffffff0000, 0xff0000ffffff00ff, 0xff0000ffffffff00, | ||
106 | - 0xff0000ffffffffff, 0xff00ff0000000000, 0xff00ff00000000ff, | ||
107 | - 0xff00ff000000ff00, 0xff00ff000000ffff, 0xff00ff0000ff0000, | ||
108 | - 0xff00ff0000ff00ff, 0xff00ff0000ffff00, 0xff00ff0000ffffff, | ||
109 | - 0xff00ff00ff000000, 0xff00ff00ff0000ff, 0xff00ff00ff00ff00, | ||
110 | - 0xff00ff00ff00ffff, 0xff00ff00ffff0000, 0xff00ff00ffff00ff, | ||
111 | - 0xff00ff00ffffff00, 0xff00ff00ffffffff, 0xff00ffff00000000, | ||
112 | - 0xff00ffff000000ff, 0xff00ffff0000ff00, 0xff00ffff0000ffff, | ||
113 | - 0xff00ffff00ff0000, 0xff00ffff00ff00ff, 0xff00ffff00ffff00, | ||
114 | - 0xff00ffff00ffffff, 0xff00ffffff000000, 0xff00ffffff0000ff, | ||
115 | - 0xff00ffffff00ff00, 0xff00ffffff00ffff, 0xff00ffffffff0000, | ||
116 | - 0xff00ffffffff00ff, 0xff00ffffffffff00, 0xff00ffffffffffff, | ||
117 | - 0xffff000000000000, 0xffff0000000000ff, 0xffff00000000ff00, | ||
118 | - 0xffff00000000ffff, 0xffff000000ff0000, 0xffff000000ff00ff, | ||
119 | - 0xffff000000ffff00, 0xffff000000ffffff, 0xffff0000ff000000, | ||
120 | - 0xffff0000ff0000ff, 0xffff0000ff00ff00, 0xffff0000ff00ffff, | ||
121 | - 0xffff0000ffff0000, 0xffff0000ffff00ff, 0xffff0000ffffff00, | ||
122 | - 0xffff0000ffffffff, 0xffff00ff00000000, 0xffff00ff000000ff, | ||
123 | - 0xffff00ff0000ff00, 0xffff00ff0000ffff, 0xffff00ff00ff0000, | ||
124 | - 0xffff00ff00ff00ff, 0xffff00ff00ffff00, 0xffff00ff00ffffff, | ||
125 | - 0xffff00ffff000000, 0xffff00ffff0000ff, 0xffff00ffff00ff00, | ||
126 | - 0xffff00ffff00ffff, 0xffff00ffffff0000, 0xffff00ffffff00ff, | ||
127 | - 0xffff00ffffffff00, 0xffff00ffffffffff, 0xffffff0000000000, | ||
128 | - 0xffffff00000000ff, 0xffffff000000ff00, 0xffffff000000ffff, | ||
129 | - 0xffffff0000ff0000, 0xffffff0000ff00ff, 0xffffff0000ffff00, | ||
130 | - 0xffffff0000ffffff, 0xffffff00ff000000, 0xffffff00ff0000ff, | ||
131 | - 0xffffff00ff00ff00, 0xffffff00ff00ffff, 0xffffff00ffff0000, | ||
132 | - 0xffffff00ffff00ff, 0xffffff00ffffff00, 0xffffff00ffffffff, | ||
133 | - 0xffffffff00000000, 0xffffffff000000ff, 0xffffffff0000ff00, | ||
134 | - 0xffffffff0000ffff, 0xffffffff00ff0000, 0xffffffff00ff00ff, | ||
135 | - 0xffffffff00ffff00, 0xffffffff00ffffff, 0xffffffffff000000, | ||
136 | - 0xffffffffff0000ff, 0xffffffffff00ff00, 0xffffffffff00ffff, | ||
137 | - 0xffffffffffff0000, 0xffffffffffff00ff, 0xffffffffffffff00, | ||
138 | - 0xffffffffffffffff, | ||
139 | - }; | ||
140 | - return word[byte]; | ||
141 | + return expand_pred_b_data[byte]; | ||
46 | } | 142 | } |
47 | 143 | ||
48 | void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val, | 144 | /* Similarly for half-word elements. |
49 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | 145 | diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c |
50 | index XXXXXXX..XXXXXXX 100644 | 146 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/accel/tcg/cputlb.c | 147 | --- a/target/arm/vec_helper.c |
52 | +++ b/accel/tcg/cputlb.c | 148 | +++ b/target/arm/vec_helper.c |
53 | @@ -XXX,XX +XXX,XX @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) | 149 | @@ -XXX,XX +XXX,XX @@ |
54 | } | 150 | #include "qemu/int128.h" |
55 | 151 | #include "vec_internal.h" | |
56 | static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 152 | |
57 | + int mmu_idx, | 153 | +/* |
58 | target_ulong addr, uintptr_t retaddr, int size) | 154 | + * Data for expanding active predicate bits to bytes, for byte elements. |
59 | { | 155 | + * |
60 | CPUState *cpu = ENV_GET_CPU(env); | 156 | + * for (i = 0; i < 256; ++i) { |
61 | @@ -XXX,XX +XXX,XX @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 157 | + * unsigned long m = 0; |
62 | MemoryRegion *mr = iotlb_to_region(cpu, physaddr, iotlbentry->attrs); | 158 | + * for (j = 0; j < 8; j++) { |
63 | uint64_t val; | 159 | + * if ((i >> j) & 1) { |
64 | bool locked = false; | 160 | + * m |= 0xfful << (j << 3); |
65 | + MemTxResult r; | 161 | + * } |
66 | 162 | + * } | |
67 | physaddr = (physaddr & TARGET_PAGE_MASK) + addr; | 163 | + * printf("0x%016lx,\n", m); |
68 | cpu->mem_io_pc = retaddr; | 164 | + * } |
69 | @@ -XXX,XX +XXX,XX @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 165 | + */ |
70 | qemu_mutex_lock_iothread(); | 166 | +const uint64_t expand_pred_b_data[256] = { |
71 | locked = true; | 167 | + 0x0000000000000000, 0x00000000000000ff, 0x000000000000ff00, |
72 | } | 168 | + 0x000000000000ffff, 0x0000000000ff0000, 0x0000000000ff00ff, |
73 | - memory_region_dispatch_read(mr, physaddr, &val, size, iotlbentry->attrs); | 169 | + 0x0000000000ffff00, 0x0000000000ffffff, 0x00000000ff000000, |
74 | + r = memory_region_dispatch_read(mr, physaddr, | 170 | + 0x00000000ff0000ff, 0x00000000ff00ff00, 0x00000000ff00ffff, |
75 | + &val, size, iotlbentry->attrs); | 171 | + 0x00000000ffff0000, 0x00000000ffff00ff, 0x00000000ffffff00, |
76 | + if (r != MEMTX_OK) { | 172 | + 0x00000000ffffffff, 0x000000ff00000000, 0x000000ff000000ff, |
77 | + cpu_transaction_failed(cpu, physaddr, addr, size, MMU_DATA_LOAD, | 173 | + 0x000000ff0000ff00, 0x000000ff0000ffff, 0x000000ff00ff0000, |
78 | + mmu_idx, iotlbentry->attrs, r, retaddr); | 174 | + 0x000000ff00ff00ff, 0x000000ff00ffff00, 0x000000ff00ffffff, |
79 | + } | 175 | + 0x000000ffff000000, 0x000000ffff0000ff, 0x000000ffff00ff00, |
80 | if (locked) { | 176 | + 0x000000ffff00ffff, 0x000000ffffff0000, 0x000000ffffff00ff, |
81 | qemu_mutex_unlock_iothread(); | 177 | + 0x000000ffffffff00, 0x000000ffffffffff, 0x0000ff0000000000, |
82 | } | 178 | + 0x0000ff00000000ff, 0x0000ff000000ff00, 0x0000ff000000ffff, |
83 | @@ -XXX,XX +XXX,XX @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 179 | + 0x0000ff0000ff0000, 0x0000ff0000ff00ff, 0x0000ff0000ffff00, |
84 | } | 180 | + 0x0000ff0000ffffff, 0x0000ff00ff000000, 0x0000ff00ff0000ff, |
85 | 181 | + 0x0000ff00ff00ff00, 0x0000ff00ff00ffff, 0x0000ff00ffff0000, | |
86 | static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 182 | + 0x0000ff00ffff00ff, 0x0000ff00ffffff00, 0x0000ff00ffffffff, |
87 | + int mmu_idx, | 183 | + 0x0000ffff00000000, 0x0000ffff000000ff, 0x0000ffff0000ff00, |
88 | uint64_t val, target_ulong addr, | 184 | + 0x0000ffff0000ffff, 0x0000ffff00ff0000, 0x0000ffff00ff00ff, |
89 | uintptr_t retaddr, int size) | 185 | + 0x0000ffff00ffff00, 0x0000ffff00ffffff, 0x0000ffffff000000, |
90 | { | 186 | + 0x0000ffffff0000ff, 0x0000ffffff00ff00, 0x0000ffffff00ffff, |
91 | @@ -XXX,XX +XXX,XX @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 187 | + 0x0000ffffffff0000, 0x0000ffffffff00ff, 0x0000ffffffffff00, |
92 | hwaddr physaddr = iotlbentry->addr; | 188 | + 0x0000ffffffffffff, 0x00ff000000000000, 0x00ff0000000000ff, |
93 | MemoryRegion *mr = iotlb_to_region(cpu, physaddr, iotlbentry->attrs); | 189 | + 0x00ff00000000ff00, 0x00ff00000000ffff, 0x00ff000000ff0000, |
94 | bool locked = false; | 190 | + 0x00ff000000ff00ff, 0x00ff000000ffff00, 0x00ff000000ffffff, |
95 | + MemTxResult r; | 191 | + 0x00ff0000ff000000, 0x00ff0000ff0000ff, 0x00ff0000ff00ff00, |
96 | 192 | + 0x00ff0000ff00ffff, 0x00ff0000ffff0000, 0x00ff0000ffff00ff, | |
97 | physaddr = (physaddr & TARGET_PAGE_MASK) + addr; | 193 | + 0x00ff0000ffffff00, 0x00ff0000ffffffff, 0x00ff00ff00000000, |
98 | if (mr != &io_mem_rom && mr != &io_mem_notdirty && !cpu->can_do_io) { | 194 | + 0x00ff00ff000000ff, 0x00ff00ff0000ff00, 0x00ff00ff0000ffff, |
99 | @@ -XXX,XX +XXX,XX @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, | 195 | + 0x00ff00ff00ff0000, 0x00ff00ff00ff00ff, 0x00ff00ff00ffff00, |
100 | qemu_mutex_lock_iothread(); | 196 | + 0x00ff00ff00ffffff, 0x00ff00ffff000000, 0x00ff00ffff0000ff, |
101 | locked = true; | 197 | + 0x00ff00ffff00ff00, 0x00ff00ffff00ffff, 0x00ff00ffffff0000, |
102 | } | 198 | + 0x00ff00ffffff00ff, 0x00ff00ffffffff00, 0x00ff00ffffffffff, |
103 | - memory_region_dispatch_write(mr, physaddr, val, size, iotlbentry->attrs); | 199 | + 0x00ffff0000000000, 0x00ffff00000000ff, 0x00ffff000000ff00, |
104 | + r = memory_region_dispatch_write(mr, physaddr, | 200 | + 0x00ffff000000ffff, 0x00ffff0000ff0000, 0x00ffff0000ff00ff, |
105 | + val, size, iotlbentry->attrs); | 201 | + 0x00ffff0000ffff00, 0x00ffff0000ffffff, 0x00ffff00ff000000, |
106 | + if (r != MEMTX_OK) { | 202 | + 0x00ffff00ff0000ff, 0x00ffff00ff00ff00, 0x00ffff00ff00ffff, |
107 | + cpu_transaction_failed(cpu, physaddr, addr, size, MMU_DATA_STORE, | 203 | + 0x00ffff00ffff0000, 0x00ffff00ffff00ff, 0x00ffff00ffffff00, |
108 | + mmu_idx, iotlbentry->attrs, r, retaddr); | 204 | + 0x00ffff00ffffffff, 0x00ffffff00000000, 0x00ffffff000000ff, |
109 | + } | 205 | + 0x00ffffff0000ff00, 0x00ffffff0000ffff, 0x00ffffff00ff0000, |
110 | if (locked) { | 206 | + 0x00ffffff00ff00ff, 0x00ffffff00ffff00, 0x00ffffff00ffffff, |
111 | qemu_mutex_unlock_iothread(); | 207 | + 0x00ffffffff000000, 0x00ffffffff0000ff, 0x00ffffffff00ff00, |
112 | } | 208 | + 0x00ffffffff00ffff, 0x00ffffffffff0000, 0x00ffffffffff00ff, |
113 | @@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) | 209 | + 0x00ffffffffffff00, 0x00ffffffffffffff, 0xff00000000000000, |
114 | MemoryRegion *mr; | 210 | + 0xff000000000000ff, 0xff0000000000ff00, 0xff0000000000ffff, |
115 | CPUState *cpu = ENV_GET_CPU(env); | 211 | + 0xff00000000ff0000, 0xff00000000ff00ff, 0xff00000000ffff00, |
116 | CPUIOTLBEntry *iotlbentry; | 212 | + 0xff00000000ffffff, 0xff000000ff000000, 0xff000000ff0000ff, |
117 | + hwaddr physaddr; | 213 | + 0xff000000ff00ff00, 0xff000000ff00ffff, 0xff000000ffff0000, |
118 | 214 | + 0xff000000ffff00ff, 0xff000000ffffff00, 0xff000000ffffffff, | |
119 | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); | 215 | + 0xff0000ff00000000, 0xff0000ff000000ff, 0xff0000ff0000ff00, |
120 | mmu_idx = cpu_mmu_index(env, true); | 216 | + 0xff0000ff0000ffff, 0xff0000ff00ff0000, 0xff0000ff00ff00ff, |
121 | @@ -XXX,XX +XXX,XX @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) | 217 | + 0xff0000ff00ffff00, 0xff0000ff00ffffff, 0xff0000ffff000000, |
122 | } | 218 | + 0xff0000ffff0000ff, 0xff0000ffff00ff00, 0xff0000ffff00ffff, |
123 | qemu_mutex_unlock_iothread(); | 219 | + 0xff0000ffffff0000, 0xff0000ffffff00ff, 0xff0000ffffffff00, |
124 | 220 | + 0xff0000ffffffffff, 0xff00ff0000000000, 0xff00ff00000000ff, | |
125 | + /* Give the new-style cpu_transaction_failed() hook first chance | 221 | + 0xff00ff000000ff00, 0xff00ff000000ffff, 0xff00ff0000ff0000, |
126 | + * to handle this. | 222 | + 0xff00ff0000ff00ff, 0xff00ff0000ffff00, 0xff00ff0000ffffff, |
127 | + * This is not the ideal place to detect and generate CPU | 223 | + 0xff00ff00ff000000, 0xff00ff00ff0000ff, 0xff00ff00ff00ff00, |
128 | + * exceptions for instruction fetch failure (for instance | 224 | + 0xff00ff00ff00ffff, 0xff00ff00ffff0000, 0xff00ff00ffff00ff, |
129 | + * we don't know the length of the access that the CPU would | 225 | + 0xff00ff00ffffff00, 0xff00ff00ffffffff, 0xff00ffff00000000, |
130 | + * use, and it would be better to go ahead and try the access | 226 | + 0xff00ffff000000ff, 0xff00ffff0000ff00, 0xff00ffff0000ffff, |
131 | + * and use the MemTXResult it produced). However it is the | 227 | + 0xff00ffff00ff0000, 0xff00ffff00ff00ff, 0xff00ffff00ffff00, |
132 | + * simplest place we have currently available for the check. | 228 | + 0xff00ffff00ffffff, 0xff00ffffff000000, 0xff00ffffff0000ff, |
133 | + */ | 229 | + 0xff00ffffff00ff00, 0xff00ffffff00ffff, 0xff00ffffffff0000, |
134 | + physaddr = (iotlbentry->addr & TARGET_PAGE_MASK) + addr; | 230 | + 0xff00ffffffff00ff, 0xff00ffffffffff00, 0xff00ffffffffffff, |
135 | + cpu_transaction_failed(cpu, physaddr, addr, 0, MMU_INST_FETCH, mmu_idx, | 231 | + 0xffff000000000000, 0xffff0000000000ff, 0xffff00000000ff00, |
136 | + iotlbentry->attrs, MEMTX_DECODE_ERROR, 0); | 232 | + 0xffff00000000ffff, 0xffff000000ff0000, 0xffff000000ff00ff, |
233 | + 0xffff000000ffff00, 0xffff000000ffffff, 0xffff0000ff000000, | ||
234 | + 0xffff0000ff0000ff, 0xffff0000ff00ff00, 0xffff0000ff00ffff, | ||
235 | + 0xffff0000ffff0000, 0xffff0000ffff00ff, 0xffff0000ffffff00, | ||
236 | + 0xffff0000ffffffff, 0xffff00ff00000000, 0xffff00ff000000ff, | ||
237 | + 0xffff00ff0000ff00, 0xffff00ff0000ffff, 0xffff00ff00ff0000, | ||
238 | + 0xffff00ff00ff00ff, 0xffff00ff00ffff00, 0xffff00ff00ffffff, | ||
239 | + 0xffff00ffff000000, 0xffff00ffff0000ff, 0xffff00ffff00ff00, | ||
240 | + 0xffff00ffff00ffff, 0xffff00ffffff0000, 0xffff00ffffff00ff, | ||
241 | + 0xffff00ffffffff00, 0xffff00ffffffffff, 0xffffff0000000000, | ||
242 | + 0xffffff00000000ff, 0xffffff000000ff00, 0xffffff000000ffff, | ||
243 | + 0xffffff0000ff0000, 0xffffff0000ff00ff, 0xffffff0000ffff00, | ||
244 | + 0xffffff0000ffffff, 0xffffff00ff000000, 0xffffff00ff0000ff, | ||
245 | + 0xffffff00ff00ff00, 0xffffff00ff00ffff, 0xffffff00ffff0000, | ||
246 | + 0xffffff00ffff00ff, 0xffffff00ffffff00, 0xffffff00ffffffff, | ||
247 | + 0xffffffff00000000, 0xffffffff000000ff, 0xffffffff0000ff00, | ||
248 | + 0xffffffff0000ffff, 0xffffffff00ff0000, 0xffffffff00ff00ff, | ||
249 | + 0xffffffff00ffff00, 0xffffffff00ffffff, 0xffffffffff000000, | ||
250 | + 0xffffffffff0000ff, 0xffffffffff00ff00, 0xffffffffff00ffff, | ||
251 | + 0xffffffffffff0000, 0xffffffffffff00ff, 0xffffffffffffff00, | ||
252 | + 0xffffffffffffffff, | ||
253 | +}; | ||
137 | + | 254 | + |
138 | cpu_unassigned_access(cpu, addr, false, true, 0, 4); | 255 | /* Signed saturating rounding doubling multiply-accumulate high half, 8-bit */ |
139 | /* The CPU's unassigned access hook might have longjumped out | 256 | int8_t do_sqrdmlah_b(int8_t src1, int8_t src2, int8_t src3, |
140 | * with an exception. If it didn't (or there was no hook) then | 257 | bool neg, bool round) |
141 | -- | 258 | -- |
142 | 2.7.4 | 259 | 2.20.1 |
143 | 260 | ||
144 | 261 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | Currently the ARM SVE helper code defines locally some utility |
---|---|---|---|
2 | functions for swapping 16-bit halfwords within 32-bit or 64-bit | ||
3 | values and for swapping 32-bit words within 64-bit values, | ||
4 | parallel to the byte-swapping bswap16/32/64 functions. | ||
2 | 5 | ||
3 | When adding a PMU with a userspace irqchip we skip the set-irq | 6 | We want these also for the ARM MVE code, and they're potentially |
4 | stage of device creation. Split the 'create' function into two | 7 | generally useful for other targets, so move them to bitops.h. |
5 | functions 'init' and 'set-irq' so they may be called separately. | 8 | (We don't put them in bswap.h with the bswap* functions because |
9 | they are implemented in terms of the rotate operations also | ||
10 | defined in bitops.h, and including bitops.h from bswap.h seems | ||
11 | better avoided.) | ||
6 | 12 | ||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
8 | Reviewed-by: Christoffer Dall <cdall@linaro.org> | ||
9 | Message-id: 1500471597-2517-3-git-send-email-drjones@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 20210614151007.4545-17-peter.maydell@linaro.org | ||
11 | --- | 17 | --- |
12 | target/arm/kvm_arm.h | 10 ++++++++-- | 18 | include/qemu/bitops.h | 29 +++++++++++++++++++++++++++++ |
13 | hw/arm/virt.c | 11 +++++++++-- | 19 | target/arm/sve_helper.c | 20 -------------------- |
14 | target/arm/kvm32.c | 8 +++++++- | 20 | 2 files changed, 29 insertions(+), 20 deletions(-) |
15 | target/arm/kvm64.c | 52 +++++++++++++++++++++++++--------------------------- | ||
16 | 4 files changed, 49 insertions(+), 32 deletions(-) | ||
17 | 21 | ||
18 | diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h | 22 | diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h |
19 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/kvm_arm.h | 24 | --- a/include/qemu/bitops.h |
21 | +++ b/target/arm/kvm_arm.h | 25 | +++ b/include/qemu/bitops.h |
22 | @@ -XXX,XX +XXX,XX @@ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu); | 26 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t ror64(uint64_t word, unsigned int shift) |
23 | 27 | return (word >> shift) | (word << ((64 - shift) & 63)); | |
24 | int kvm_arm_vgic_probe(void); | ||
25 | |||
26 | -int kvm_arm_pmu_create(CPUState *cs, int irq); | ||
27 | +int kvm_arm_pmu_set_irq(CPUState *cs, int irq); | ||
28 | +int kvm_arm_pmu_init(CPUState *cs); | ||
29 | |||
30 | #else | ||
31 | |||
32 | @@ -XXX,XX +XXX,XX @@ static inline int kvm_arm_vgic_probe(void) | ||
33 | return 0; | ||
34 | } | 28 | } |
35 | 29 | ||
36 | -static inline int kvm_arm_pmu_create(CPUState *cs, int irq) | 30 | +/** |
37 | +static inline int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | 31 | + * hswap32 - swap 16-bit halfwords within a 32-bit value |
32 | + * @h: value to swap | ||
33 | + */ | ||
34 | +static inline uint32_t hswap32(uint32_t h) | ||
38 | +{ | 35 | +{ |
39 | + return 0; | 36 | + return rol32(h, 16); |
40 | +} | 37 | +} |
41 | + | 38 | + |
42 | +static inline int kvm_arm_pmu_init(CPUState *cs) | 39 | +/** |
43 | { | 40 | + * hswap64 - swap 16-bit halfwords within a 64-bit value |
44 | return 0; | 41 | + * @h: value to swap |
45 | } | 42 | + */ |
46 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 43 | +static inline uint64_t hswap64(uint64_t h) |
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/virt.c | ||
49 | +++ b/hw/arm/virt.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms) | ||
51 | |||
52 | CPU_FOREACH(cpu) { | ||
53 | armcpu = ARM_CPU(cpu); | ||
54 | - if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU) || | ||
55 | - (kvm_enabled() && !kvm_arm_pmu_create(cpu, PPI(VIRTUAL_PMU_IRQ)))) { | ||
56 | + if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) { | ||
57 | return; | ||
58 | } | ||
59 | + if (kvm_enabled()) { | ||
60 | + if (!kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ))) { | ||
61 | + return; | ||
62 | + } | ||
63 | + if (!kvm_arm_pmu_init(cpu)) { | ||
64 | + return; | ||
65 | + } | ||
66 | + } | ||
67 | } | ||
68 | |||
69 | if (vms->gic_version == 2) { | ||
70 | diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/target/arm/kvm32.c | ||
73 | +++ b/target/arm/kvm32.c | ||
74 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_hw_debug_active(CPUState *cs) | ||
75 | return false; | ||
76 | } | ||
77 | |||
78 | -int kvm_arm_pmu_create(CPUState *cs, int irq) | ||
79 | +int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
80 | +{ | 44 | +{ |
81 | + qemu_log_mask(LOG_UNIMP, "%s: not implemented\n", __func__); | 45 | + uint64_t m = 0x0000ffff0000ffffull; |
82 | + return 0; | 46 | + h = rol64(h, 32); |
47 | + return ((h & m) << 16) | ((h >> 16) & m); | ||
83 | +} | 48 | +} |
84 | + | 49 | + |
85 | +int kvm_arm_pmu_init(CPUState *cs) | 50 | +/** |
86 | { | 51 | + * wswap64 - swap 32-bit words within a 64-bit value |
87 | qemu_log_mask(LOG_UNIMP, "%s: not implemented\n", __func__); | 52 | + * @h: value to swap |
88 | return 0; | 53 | + */ |
89 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 54 | +static inline uint64_t wswap64(uint64_t h) |
55 | +{ | ||
56 | + return rol64(h, 32); | ||
57 | +} | ||
58 | + | ||
59 | /** | ||
60 | * extract32: | ||
61 | * @value: the value to extract the bit field from | ||
62 | diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c | ||
90 | index XXXXXXX..XXXXXXX 100644 | 63 | index XXXXXXX..XXXXXXX 100644 |
91 | --- a/target/arm/kvm64.c | 64 | --- a/target/arm/sve_helper.c |
92 | +++ b/target/arm/kvm64.c | 65 | +++ b/target/arm/sve_helper.c |
93 | @@ -XXX,XX +XXX,XX @@ static CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, target_ulong addr) | 66 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t expand_pred_s(uint8_t byte) |
94 | return NULL; | 67 | return word[byte & 0x11]; |
95 | } | 68 | } |
96 | 69 | ||
97 | -static bool kvm_arm_pmu_support_ctrl(CPUState *cs, struct kvm_device_attr *attr) | 70 | -/* Swap 16-bit words within a 32-bit word. */ |
71 | -static inline uint32_t hswap32(uint32_t h) | ||
98 | -{ | 72 | -{ |
99 | - return kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr) == 0; | 73 | - return rol32(h, 16); |
100 | -} | 74 | -} |
101 | - | 75 | - |
102 | -int kvm_arm_pmu_create(CPUState *cs, int irq) | 76 | -/* Swap 16-bit words within a 64-bit word. */ |
103 | +static bool kvm_arm_pmu_set_attr(CPUState *cs, struct kvm_device_attr *attr) | 77 | -static inline uint64_t hswap64(uint64_t h) |
104 | { | 78 | -{ |
105 | int err; | 79 | - uint64_t m = 0x0000ffff0000ffffull; |
106 | 80 | - h = rol64(h, 32); | |
107 | - struct kvm_device_attr attr = { | 81 | - return ((h & m) << 16) | ((h >> 16) & m); |
108 | - .group = KVM_ARM_VCPU_PMU_V3_CTRL, | 82 | -} |
109 | - .addr = (intptr_t)&irq, | ||
110 | - .attr = KVM_ARM_VCPU_PMU_V3_IRQ, | ||
111 | - .flags = 0, | ||
112 | - }; | ||
113 | - | 83 | - |
114 | - if (!kvm_arm_pmu_support_ctrl(cs, &attr)) { | 84 | -/* Swap 32-bit words within a 64-bit word. */ |
115 | - return 0; | 85 | -static inline uint64_t wswap64(uint64_t h) |
116 | + err = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, attr); | 86 | -{ |
117 | + if (err != 0) { | 87 | - return rol64(h, 32); |
118 | + return false; | 88 | -} |
119 | } | 89 | - |
120 | 90 | #define LOGICAL_PPPP(NAME, FUNC) \ | |
121 | - err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, &attr); | 91 | void HELPER(NAME)(void *vd, void *vn, void *vm, void *vg, uint32_t desc) \ |
122 | + err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, attr); | 92 | { \ |
123 | if (err < 0) { | ||
124 | fprintf(stderr, "KVM_SET_DEVICE_ATTR failed: %s\n", | ||
125 | strerror(-err)); | ||
126 | abort(); | ||
127 | } | ||
128 | |||
129 | - attr.group = KVM_ARM_VCPU_PMU_V3_CTRL; | ||
130 | - attr.attr = KVM_ARM_VCPU_PMU_V3_INIT; | ||
131 | - attr.addr = 0; | ||
132 | - attr.flags = 0; | ||
133 | + return true; | ||
134 | +} | ||
135 | |||
136 | - err = kvm_vcpu_ioctl(cs, KVM_SET_DEVICE_ATTR, &attr); | ||
137 | - if (err < 0) { | ||
138 | - fprintf(stderr, "KVM_SET_DEVICE_ATTR failed: %s\n", | ||
139 | - strerror(-err)); | ||
140 | - abort(); | ||
141 | - } | ||
142 | +int kvm_arm_pmu_init(CPUState *cs) | ||
143 | +{ | ||
144 | + struct kvm_device_attr attr = { | ||
145 | + .group = KVM_ARM_VCPU_PMU_V3_CTRL, | ||
146 | + .attr = KVM_ARM_VCPU_PMU_V3_INIT, | ||
147 | + }; | ||
148 | + | ||
149 | + return kvm_arm_pmu_set_attr(cs, &attr); | ||
150 | +} | ||
151 | + | ||
152 | +int kvm_arm_pmu_set_irq(CPUState *cs, int irq) | ||
153 | +{ | ||
154 | + struct kvm_device_attr attr = { | ||
155 | + .group = KVM_ARM_VCPU_PMU_V3_CTRL, | ||
156 | + .addr = (intptr_t)&irq, | ||
157 | + .attr = KVM_ARM_VCPU_PMU_V3_IRQ, | ||
158 | + }; | ||
159 | |||
160 | - return 1; | ||
161 | + return kvm_arm_pmu_set_attr(cs, &attr); | ||
162 | } | ||
163 | |||
164 | static inline void set_feature(uint64_t *features, int feature) | ||
165 | -- | 93 | -- |
166 | 2.7.4 | 94 | 2.20.1 |
167 | 95 | ||
168 | 96 | diff view generated by jsdifflib |
1 | We currently have some similar code in tlb_fill() and in | 1 | int128_make64() creates an Int128 from an unsigned 64 bit value; add |
---|---|---|---|
2 | arm_cpu_do_unaligned_access() for delivering a data abort or prefetch | 2 | a function int128_makes64() creating an Int128 from a signed 64 bit |
3 | abort. We're also going to want to do the same thing to handle | 3 | value. |
4 | external aborts. Factor out the common code into a new function | ||
5 | deliver_fault(). | ||
6 | 4 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20210614151007.4545-34-peter.maydell@linaro.org | ||
10 | --- | 9 | --- |
11 | target/arm/op_helper.c | 110 +++++++++++++++++++++++++------------------------ | 10 | include/qemu/int128.h | 10 ++++++++++ |
12 | 1 file changed, 57 insertions(+), 53 deletions(-) | 11 | 1 file changed, 10 insertions(+) |
13 | 12 | ||
14 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 13 | diff --git a/include/qemu/int128.h b/include/qemu/int128.h |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/op_helper.c | 15 | --- a/include/qemu/int128.h |
17 | +++ b/target/arm/op_helper.c | 16 | +++ b/include/qemu/int128.h |
18 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn, | 17 | @@ -XXX,XX +XXX,XX @@ static inline Int128 int128_make64(uint64_t a) |
19 | return syn; | 18 | return a; |
20 | } | 19 | } |
21 | 20 | ||
22 | +static void deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type, | 21 | +static inline Int128 int128_makes64(int64_t a) |
23 | + uint32_t fsr, uint32_t fsc, ARMMMUFaultInfo *fi) | ||
24 | +{ | 22 | +{ |
25 | + CPUARMState *env = &cpu->env; | 23 | + return a; |
26 | + int target_el; | ||
27 | + bool same_el; | ||
28 | + uint32_t syn, exc; | ||
29 | + | ||
30 | + target_el = exception_target_el(env); | ||
31 | + if (fi->stage2) { | ||
32 | + target_el = 2; | ||
33 | + env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4; | ||
34 | + } | ||
35 | + same_el = (arm_current_el(env) == target_el); | ||
36 | + | ||
37 | + if (fsc == 0x3f) { | ||
38 | + /* Caller doesn't have a long-format fault status code. This | ||
39 | + * should only happen if this fault will never actually be reported | ||
40 | + * to an EL that uses a syndrome register. Check that here. | ||
41 | + * 0x3f is a (currently) reserved FSC code, in case the constructed | ||
42 | + * syndrome does leak into the guest somehow. | ||
43 | + */ | ||
44 | + assert(target_el != 2 && !arm_el_is_aa64(env, target_el)); | ||
45 | + } | ||
46 | + | ||
47 | + if (access_type == MMU_INST_FETCH) { | ||
48 | + syn = syn_insn_abort(same_el, 0, fi->s1ptw, fsc); | ||
49 | + exc = EXCP_PREFETCH_ABORT; | ||
50 | + } else { | ||
51 | + syn = merge_syn_data_abort(env->exception.syndrome, target_el, | ||
52 | + same_el, fi->s1ptw, | ||
53 | + access_type == MMU_DATA_STORE, | ||
54 | + fsc); | ||
55 | + if (access_type == MMU_DATA_STORE | ||
56 | + && arm_feature(env, ARM_FEATURE_V6)) { | ||
57 | + fsr |= (1 << 11); | ||
58 | + } | ||
59 | + exc = EXCP_DATA_ABORT; | ||
60 | + } | ||
61 | + | ||
62 | + env->exception.vaddress = addr; | ||
63 | + env->exception.fsr = fsr; | ||
64 | + raise_exception(env, exc, syn, target_el); | ||
65 | +} | 24 | +} |
66 | + | 25 | + |
67 | /* try to fill the TLB and return an exception if error. If retaddr is | 26 | static inline Int128 int128_make128(uint64_t lo, uint64_t hi) |
68 | * NULL, it means that the function was called in C code (i.e. not | 27 | { |
69 | * from generated code or from helper.c) | 28 | return (__uint128_t)hi << 64 | lo; |
70 | @@ -XXX,XX +XXX,XX @@ void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type, | 29 | @@ -XXX,XX +XXX,XX @@ static inline Int128 int128_make64(uint64_t a) |
71 | ret = arm_tlb_fill(cs, addr, access_type, mmu_idx, &fsr, &fi); | 30 | return (Int128) { a, 0 }; |
72 | if (unlikely(ret)) { | ||
73 | ARMCPU *cpu = ARM_CPU(cs); | ||
74 | - CPUARMState *env = &cpu->env; | ||
75 | - uint32_t syn, exc, fsc; | ||
76 | - unsigned int target_el; | ||
77 | - bool same_el; | ||
78 | + uint32_t fsc; | ||
79 | |||
80 | if (retaddr) { | ||
81 | /* now we have a real cpu fault */ | ||
82 | cpu_restore_state(cs, retaddr); | ||
83 | } | ||
84 | |||
85 | - target_el = exception_target_el(env); | ||
86 | - if (fi.stage2) { | ||
87 | - target_el = 2; | ||
88 | - env->cp15.hpfar_el2 = extract64(fi.s2addr, 12, 47) << 4; | ||
89 | - } | ||
90 | - same_el = arm_current_el(env) == target_el; | ||
91 | - | ||
92 | if (fsr & (1 << 9)) { | ||
93 | /* LPAE format fault status register : bottom 6 bits are | ||
94 | * status code in the same form as needed for syndrome | ||
95 | @@ -XXX,XX +XXX,XX @@ void tlb_fill(CPUState *cs, target_ulong addr, MMUAccessType access_type, | ||
96 | fsc = extract32(fsr, 0, 6); | ||
97 | } else { | ||
98 | /* Short format FSR : this fault will never actually be reported | ||
99 | - * to an EL that uses a syndrome register. Check that here, | ||
100 | - * and use a (currently) reserved FSR code in case the constructed | ||
101 | - * syndrome does leak into the guest somehow. | ||
102 | + * to an EL that uses a syndrome register. Use a (currently) | ||
103 | + * reserved FSR code in case the constructed syndrome does leak | ||
104 | + * into the guest somehow. deliver_fault will assert that | ||
105 | + * we don't target an EL using the syndrome. | ||
106 | */ | ||
107 | - assert(target_el != 2 && !arm_el_is_aa64(env, target_el)); | ||
108 | fsc = 0x3f; | ||
109 | } | ||
110 | |||
111 | - /* For insn and data aborts we assume there is no instruction syndrome | ||
112 | - * information; this is always true for exceptions reported to EL1. | ||
113 | - */ | ||
114 | - if (access_type == MMU_INST_FETCH) { | ||
115 | - syn = syn_insn_abort(same_el, 0, fi.s1ptw, fsc); | ||
116 | - exc = EXCP_PREFETCH_ABORT; | ||
117 | - } else { | ||
118 | - syn = merge_syn_data_abort(env->exception.syndrome, target_el, | ||
119 | - same_el, fi.s1ptw, | ||
120 | - access_type == MMU_DATA_STORE, fsc); | ||
121 | - if (access_type == MMU_DATA_STORE | ||
122 | - && arm_feature(env, ARM_FEATURE_V6)) { | ||
123 | - fsr |= (1 << 11); | ||
124 | - } | ||
125 | - exc = EXCP_DATA_ABORT; | ||
126 | - } | ||
127 | - | ||
128 | - env->exception.vaddress = addr; | ||
129 | - env->exception.fsr = fsr; | ||
130 | - raise_exception(env, exc, syn, target_el); | ||
131 | + deliver_fault(cpu, addr, access_type, fsr, fsc, &fi); | ||
132 | } | ||
133 | } | 31 | } |
134 | 32 | ||
135 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | 33 | +static inline Int128 int128_makes64(int64_t a) |
34 | +{ | ||
35 | + return (Int128) { a, a >> 63 }; | ||
36 | +} | ||
37 | + | ||
38 | static inline Int128 int128_make128(uint64_t lo, uint64_t hi) | ||
136 | { | 39 | { |
137 | ARMCPU *cpu = ARM_CPU(cs); | 40 | return (Int128) { lo, hi }; |
138 | CPUARMState *env = &cpu->env; | ||
139 | - int target_el; | ||
140 | - bool same_el; | ||
141 | - uint32_t syn; | ||
142 | + uint32_t fsr, fsc; | ||
143 | + ARMMMUFaultInfo fi = {}; | ||
144 | ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx); | ||
145 | |||
146 | if (retaddr) { | ||
147 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, | ||
148 | cpu_restore_state(cs, retaddr); | ||
149 | } | ||
150 | |||
151 | - target_el = exception_target_el(env); | ||
152 | - same_el = (arm_current_el(env) == target_el); | ||
153 | - | ||
154 | - env->exception.vaddress = vaddr; | ||
155 | - | ||
156 | /* the DFSR for an alignment fault depends on whether we're using | ||
157 | * the LPAE long descriptor format, or the short descriptor format | ||
158 | */ | ||
159 | if (arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) { | ||
160 | - env->exception.fsr = (1 << 9) | 0x21; | ||
161 | + fsr = (1 << 9) | 0x21; | ||
162 | } else { | ||
163 | - env->exception.fsr = 0x1; | ||
164 | - } | ||
165 | - | ||
166 | - if (access_type == MMU_DATA_STORE && arm_feature(env, ARM_FEATURE_V6)) { | ||
167 | - env->exception.fsr |= (1 << 11); | ||
168 | + fsr = 0x1; | ||
169 | } | ||
170 | + fsc = 0x21; | ||
171 | |||
172 | - syn = merge_syn_data_abort(env->exception.syndrome, target_el, | ||
173 | - same_el, 0, access_type == MMU_DATA_STORE, | ||
174 | - 0x21); | ||
175 | - raise_exception(env, EXCP_DATA_ABORT, syn, target_el); | ||
176 | + deliver_fault(cpu, vaddr, access_type, fsr, fsc, &fi); | ||
177 | } | ||
178 | |||
179 | #endif /* !defined(CONFIG_USER_ONLY) */ | ||
180 | -- | 41 | -- |
181 | 2.7.4 | 42 | 2.20.1 |
182 | 43 | ||
183 | 44 | diff view generated by jsdifflib |