1
target-arm queue: nothing big, just a collection of minor things.
1
Small pile of bug fixes for rc1. I've included my patches to get
2
our docs building with Sphinx 3, just for convenience...
2
3
3
-- PMM
4
-- PMM
4
5
5
The following changes since commit ae3aa5da96f4ccf0c2a28851449d92db9fcfad71:
6
The following changes since commit b149dea55cce97cb226683d06af61984a1c11e96:
6
7
7
Merge remote-tracking branch 'remotes/berrange/tags/socket-next-pull-request' into staging (2020-05-21 16:47:28 +0100)
8
Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20201102' into staging (2020-11-02 10:57:48 +0000)
8
9
9
are available in the Git repository at:
10
are available in the Git repository at:
10
11
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200521
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201102
12
13
13
for you to fetch changes up to 17b5df7b65d0192c5d775b5e1581518580774c77:
14
for you to fetch changes up to ffb4fbf90a2f63c9cb33e4bb9f854c79bf04ca4a:
14
15
15
linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32 (2020-05-21 20:00:19 +0100)
16
tests/qtest/npcm7xx_rng-test: Disable randomness tests (2020-11-02 16:52:18 +0000)
16
17
17
----------------------------------------------------------------
18
----------------------------------------------------------------
18
target-arm queue:
19
target-arm queue:
19
* tests/acceptance: Add a test for the canon-a1100 machine
20
* target/arm: Fix Neon emulation bugs on big-endian hosts
20
* docs/system: Document some of the Arm development boards
21
* target/arm: fix handling of HCR.FB
21
* linux-user: make BKPT insn cause SIGTRAP, not be a syscall
22
* target/arm: fix LORID_EL1 access check
22
* target/arm: Remove unused GEN_NEON_INTEGER_OP macro
23
* disas/capstone: Fix monitor disassembly of >32 bytes
23
* fsl-imx25, fsl-imx31, fsl-imx6, fsl-imx6ul, fsl-imx7: implement watchdog
24
* hw/arm/smmuv3: Fix potential integer overflow (CID 1432363)
24
* hw/arm: Use qemu_log_mask() instead of hw_error() in various places
25
* hw/arm/boot: fix SVE for EL3 direct kernel boot
25
* ARM: PL061: Introduce N_GPIOS
26
* hw/display/omap_lcdc: Fix potential NULL pointer dereference
26
* target/arm: Improve clear_vec_high() usage
27
* hw/display/exynos4210_fimd: Fix potential NULL pointer dereference
27
* target/arm: Allow user-mode code to write CPSR.E via MSR
28
* target/arm: Get correct MMU index for other-security-state
28
* linux-user/arm: Reset CPSR_E when entering a signal handler
29
* configure: Test that gio libs from pkg-config work
29
* linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32
30
* hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work
31
* docs: Fix building with Sphinx 3
32
* tests/qtest/npcm7xx_rng-test: Disable randomness tests
30
33
31
----------------------------------------------------------------
34
----------------------------------------------------------------
32
Amanieu d'Antras (1):
35
AlexChen (2):
33
linux-user/arm: Reset CPSR_E when entering a signal handler
36
hw/display/omap_lcdc: Fix potential NULL pointer dereference
37
hw/display/exynos4210_fimd: Fix potential NULL pointer dereference
34
38
35
Geert Uytterhoeven (1):
39
Peter Maydell (9):
36
ARM: PL061: Introduce N_GPIOS
40
target/arm: Fix float16 pairwise Neon ops on big-endian hosts
41
target/arm: Fix VUDOT/VSDOT (scalar) on big-endian hosts
42
disas/capstone: Fix monitor disassembly of >32 bytes
43
target/arm: Get correct MMU index for other-security-state
44
configure: Test that gio libs from pkg-config work
45
hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work
46
scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments
47
qemu-option-trace.rst.inc: Don't use option:: markup
48
tests/qtest/npcm7xx_rng-test: Disable randomness tests
37
49
38
Guenter Roeck (8):
50
Philippe Mathieu-Daudé (1):
39
hw: Move i.MX watchdog driver to hw/watchdog
51
hw/arm/smmuv3: Fix potential integer overflow (CID 1432363)
40
hw/watchdog: Implement full i.MX watchdog support
41
hw/arm/fsl-imx25: Wire up watchdog
42
hw/arm/fsl-imx31: Wire up watchdog
43
hw/arm/fsl-imx6: Connect watchdog interrupts
44
hw/arm/fsl-imx6ul: Connect watchdog interrupts
45
hw/arm/fsl-imx7: Instantiate various unimplemented devices
46
hw/arm/fsl-imx7: Connect watchdog interrupts
47
52
48
Peter Maydell (12):
53
Richard Henderson (11):
49
docs/system: Add 'Arm' to the Integrator/CP document title
54
target/arm: Introduce neon_full_reg_offset
50
docs/system: Sort Arm board index into alphabetical order
55
target/arm: Move neon_element_offset to translate.c
51
docs/system: Document Arm Versatile Express boards
56
target/arm: Use neon_element_offset in neon_load/store_reg
52
docs/system: Document the various MPS2 models
57
target/arm: Use neon_element_offset in vfp_reg_offset
53
docs/system: Document Musca boards
58
target/arm: Add read/write_neon_element32
54
linux-user/arm: BKPT should cause SIGTRAP, not be a syscall
59
target/arm: Expand read/write_neon_element32 to all MemOp
55
linux-user/arm: Remove bogus SVC 0xf0002 handling
60
target/arm: Rename neon_load_reg32 to vfp_load_reg32
56
linux-user/arm: Handle invalid arm-specific syscalls correctly
61
target/arm: Add read/write_neon_element64
57
linux-user/arm: Fix identification of syscall numbers
62
target/arm: Rename neon_load_reg64 to vfp_load_reg64
58
target/arm: Remove unused GEN_NEON_INTEGER_OP macro
63
target/arm: Simplify do_long_3d and do_2scalar_long
59
target/arm: Allow user-mode code to write CPSR.E via MSR
64
target/arm: Improve do_prewiden_3d
60
linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32
61
65
62
Philippe Mathieu-Daudé (4):
66
Rémi Denis-Courmont (3):
63
hw/arm/integratorcp: Replace hw_error() by qemu_log_mask()
67
target/arm: fix handling of HCR.FB
64
hw/arm/pxa2xx: Replace hw_error() by qemu_log_mask()
68
target/arm: fix LORID_EL1 access check
65
hw/char/xilinx_uartlite: Replace hw_error() by qemu_log_mask()
69
hw/arm/boot: fix SVE for EL3 direct kernel boot
66
hw/timer/exynos4210_mct: Replace hw_error() by qemu_log_mask()
67
70
68
Richard Henderson (2):
71
docs/qemu-option-trace.rst.inc | 6 +-
69
target/arm: Use tcg_gen_gvec_mov for clear_vec_high
72
configure | 10 +-
70
target/arm: Use clear_vec_high more effectively
73
include/hw/intc/arm_gicv3_common.h | 1 -
74
disas/capstone.c | 2 +-
75
hw/arm/boot.c | 3 +
76
hw/arm/smmuv3.c | 3 +-
77
hw/display/exynos4210_fimd.c | 4 +-
78
hw/display/omap_lcdc.c | 10 +-
79
hw/intc/arm_gicv3_cpuif.c | 5 +-
80
target/arm/helper.c | 24 +-
81
target/arm/m_helper.c | 3 +-
82
target/arm/translate.c | 153 +++++++++---
83
target/arm/vec_helper.c | 12 +-
84
tests/qtest/npcm7xx_rng-test.c | 14 +-
85
scripts/kernel-doc | 18 +-
86
target/arm/translate-neon.c.inc | 472 ++++++++++++++++++++-----------------
87
target/arm/translate-vfp.c.inc | 341 +++++++++++----------------
88
17 files changed, 588 insertions(+), 493 deletions(-)
71
89
72
Thomas Huth (1):
73
tests/acceptance: Add a test for the canon-a1100 machine
74
75
docs/system/arm/integratorcp.rst | 4 +-
76
docs/system/arm/mps2.rst | 29 +++
77
docs/system/arm/musca.rst | 31 +++
78
docs/system/arm/vexpress.rst | 60 ++++++
79
docs/system/target-arm.rst | 20 +-
80
include/hw/arm/fsl-imx25.h | 5 +
81
include/hw/arm/fsl-imx31.h | 4 +
82
include/hw/arm/fsl-imx6.h | 2 +-
83
include/hw/arm/fsl-imx6ul.h | 2 +-
84
include/hw/arm/fsl-imx7.h | 23 ++-
85
include/hw/misc/imx2_wdt.h | 33 ----
86
include/hw/watchdog/wdt_imx2.h | 90 +++++++++
87
target/arm/cpu.h | 2 +-
88
hw/arm/fsl-imx25.c | 10 +
89
hw/arm/fsl-imx31.c | 6 +
90
hw/arm/fsl-imx6.c | 9 +
91
hw/arm/fsl-imx6ul.c | 10 +
92
hw/arm/fsl-imx7.c | 35 ++++
93
hw/arm/integratorcp.c | 23 ++-
94
hw/arm/pxa2xx_gpio.c | 7 +-
95
hw/char/xilinx_uartlite.c | 5 +-
96
hw/display/pxa2xx_lcd.c | 8 +-
97
hw/dma/pxa2xx_dma.c | 14 +-
98
hw/gpio/pl061.c | 12 +-
99
hw/misc/imx2_wdt.c | 90 ---------
100
hw/timer/exynos4210_mct.c | 12 +-
101
hw/watchdog/wdt_imx2.c | 303 +++++++++++++++++++++++++++++
102
linux-user/arm/cpu_loop.c | 145 ++++++++------
103
linux-user/arm/signal.c | 15 +-
104
target/arm/translate-a64.c | 63 +++---
105
target/arm/translate.c | 23 ---
106
MAINTAINERS | 6 +
107
hw/arm/Kconfig | 5 +
108
hw/misc/Makefile.objs | 1 -
109
hw/watchdog/Kconfig | 3 +
110
hw/watchdog/Makefile.objs | 1 +
111
tests/acceptance/machine_arm_canona1100.py | 35 ++++
112
37 files changed, 854 insertions(+), 292 deletions(-)
113
create mode 100644 docs/system/arm/mps2.rst
114
create mode 100644 docs/system/arm/musca.rst
115
create mode 100644 docs/system/arm/vexpress.rst
116
delete mode 100644 include/hw/misc/imx2_wdt.h
117
create mode 100644 include/hw/watchdog/wdt_imx2.h
118
delete mode 100644 hw/misc/imx2_wdt.c
119
create mode 100644 hw/watchdog/wdt_imx2.c
120
create mode 100644 tests/acceptance/machine_arm_canona1100.py
121
diff view generated by jsdifflib
Deleted patch
1
From: Thomas Huth <thuth@redhat.com>
2
1
3
The canon-a1100 machine can be used with the Barebox firmware. The
4
QEMU Advent Calendar 2018 features a pre-compiled image which we
5
can use for testing.
6
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
10
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
11
Signed-off-by: Thomas Huth <thuth@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20200514190422.23645-1-f4bug@amsat.org
14
Message-Id: <20200129090420.13954-1-thuth@redhat.com>
15
[PMD: Rebased MAINTAINERS]
16
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
MAINTAINERS | 1 +
20
tests/acceptance/machine_arm_canona1100.py | 35 ++++++++++++++++++++++
21
2 files changed, 36 insertions(+)
22
create mode 100644 tests/acceptance/machine_arm_canona1100.py
23
24
diff --git a/MAINTAINERS b/MAINTAINERS
25
index XXXXXXX..XXXXXXX 100644
26
--- a/MAINTAINERS
27
+++ b/MAINTAINERS
28
@@ -XXX,XX +XXX,XX @@ S: Odd Fixes
29
F: include/hw/arm/digic.h
30
F: hw/*/digic*
31
F: include/hw/*/digic*
32
+F: tests/acceptance/machine_arm_canona1100.py
33
34
Goldfish RTC
35
M: Anup Patel <anup.patel@wdc.com>
36
diff --git a/tests/acceptance/machine_arm_canona1100.py b/tests/acceptance/machine_arm_canona1100.py
37
new file mode 100644
38
index XXXXXXX..XXXXXXX
39
--- /dev/null
40
+++ b/tests/acceptance/machine_arm_canona1100.py
41
@@ -XXX,XX +XXX,XX @@
42
+# Functional test that boots the canon-a1100 machine with firmware
43
+#
44
+# Copyright (c) 2020 Red Hat, Inc.
45
+#
46
+# Author:
47
+# Thomas Huth <thuth@redhat.com>
48
+#
49
+# This work is licensed under the terms of the GNU GPL, version 2 or
50
+# later. See the COPYING file in the top-level directory.
51
+
52
+from avocado_qemu import Test
53
+from avocado_qemu import wait_for_console_pattern
54
+from avocado.utils import archive
55
+
56
+class CanonA1100Machine(Test):
57
+ """Boots the barebox firmware and checks that the console is operational"""
58
+
59
+ timeout = 90
60
+
61
+ def test_arm_canona1100(self):
62
+ """
63
+ :avocado: tags=arch:arm
64
+ :avocado: tags=machine:canon-a1100
65
+ :avocado: tags=device:pflash_cfi02
66
+ """
67
+ tar_url = ('https://www.qemu-advent-calendar.org'
68
+ '/2018/download/day18.tar.xz')
69
+ tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
70
+ file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
71
+ archive.extract(file_path, self.workdir)
72
+ self.vm.set_console()
73
+ self.vm.add_args('-bios',
74
+ self.workdir + '/day18/barebox.canon-a1100.bin')
75
+ self.vm.launch()
76
+ wait_for_console_pattern(self, 'running /env/bin/init')
77
--
78
2.20.1
79
80
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Do not explicitly store zero to the NEON high part
3
This function makes it clear that we're talking about the whole
4
when we can pass !is_q to clear_vec_high.
4
register, and not the 32-bit piece at index 0. This fixes a bug
5
when running on a big-endian host.
5
6
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200519212453.28494-3-richard.henderson@linaro.org
8
Message-id: 20201030022618.785675-2-richard.henderson@linaro.org
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
target/arm/translate-a64.c | 53 +++++++++++++++++++++++---------------
12
target/arm/translate.c | 8 ++++++
12
1 file changed, 32 insertions(+), 21 deletions(-)
13
target/arm/translate-neon.c.inc | 44 ++++++++++++++++-----------------
14
target/arm/translate-vfp.c.inc | 2 +-
15
3 files changed, 31 insertions(+), 23 deletions(-)
13
16
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
19
--- a/target/arm/translate.c
17
+++ b/target/arm/translate-a64.c
20
+++ b/target/arm/translate.c
18
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
21
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
22
unallocated_encoding(s);
23
}
24
25
+/*
26
+ * Return the offset of a "full" NEON Dreg.
27
+ */
28
+static long neon_full_reg_offset(unsigned reg)
29
+{
30
+ return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
31
+}
32
+
33
static inline long vfp_reg_offset(bool dp, unsigned reg)
19
{
34
{
20
/* This always zero-extends and writes to a full 128 bit wide vector */
35
if (dp) {
21
TCGv_i64 tmplo = tcg_temp_new_i64();
36
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
22
- TCGv_i64 tmphi;
37
index XXXXXXX..XXXXXXX 100644
23
+ TCGv_i64 tmphi = NULL;
38
--- a/target/arm/translate-neon.c.inc
24
39
+++ b/target/arm/translate-neon.c.inc
25
if (size < 4) {
40
@@ -XXX,XX +XXX,XX @@ neon_element_offset(int reg, int element, MemOp size)
26
MemOp memop = s->be_data + size;
41
ofs ^= 8 - element_size;
27
- tmphi = tcg_const_i64(0);
28
tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), memop);
29
} else {
30
bool be = s->be_data == MO_BE;
31
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
32
}
42
}
33
43
#endif
34
tcg_gen_st_i64(tmplo, cpu_env, fp_reg_offset(s, destidx, MO_64));
44
- return neon_reg_offset(reg, 0) + ofs;
35
- tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
45
+ return neon_full_reg_offset(reg) + ofs;
36
-
37
tcg_temp_free_i64(tmplo);
38
- tcg_temp_free_i64(tmphi);
39
40
- clear_vec_high(s, true, destidx);
41
+ if (tmphi) {
42
+ tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
43
+ tcg_temp_free_i64(tmphi);
44
+ }
45
+ clear_vec_high(s, tmphi != NULL, destidx);
46
}
46
}
47
47
48
/*
48
static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop)
49
@@ -XXX,XX +XXX,XX @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
49
@@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a)
50
read_vec_element(s, tcg_resh, rm, 0, MO_64);
50
* We cannot write 16 bytes at once because the
51
do_ext64(s, tcg_resh, tcg_resl, pos);
51
* destination is unaligned.
52
*/
53
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
54
+ tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(vd),
55
8, 8, tmp);
56
- tcg_gen_gvec_mov(0, neon_reg_offset(vd + 1, 0),
57
- neon_reg_offset(vd, 0), 8, 8);
58
+ tcg_gen_gvec_mov(0, neon_full_reg_offset(vd + 1),
59
+ neon_full_reg_offset(vd), 8, 8);
60
} else {
61
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
62
+ tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(vd),
63
vec_size, vec_size, tmp);
52
}
64
}
53
- tcg_gen_movi_i64(tcg_resh, 0);
65
tcg_gen_addi_i32(addr, addr, 1 << size);
54
} else {
66
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a)
55
TCGv_i64 tcg_hh;
67
static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn)
56
typedef struct {
68
{
57
@@ -XXX,XX +XXX,XX @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
69
int vec_size = a->q ? 16 : 8;
58
70
- int rd_ofs = neon_reg_offset(a->vd, 0);
59
write_vec_element(s, tcg_resl, rd, 0, MO_64);
71
- int rn_ofs = neon_reg_offset(a->vn, 0);
60
tcg_temp_free_i64(tcg_resl);
72
- int rm_ofs = neon_reg_offset(a->vm, 0);
61
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
73
+ int rd_ofs = neon_full_reg_offset(a->vd);
62
+ if (is_q) {
74
+ int rn_ofs = neon_full_reg_offset(a->vn);
63
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
75
+ int rm_ofs = neon_full_reg_offset(a->vm);
64
+ }
76
65
tcg_temp_free_i64(tcg_resh);
77
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
66
- clear_vec_high(s, true, rd);
78
return false;
67
+ clear_vec_high(s, is_q, rd);
79
@@ -XXX,XX +XXX,XX @@ static bool do_vector_2sh(DisasContext *s, arg_2reg_shift *a, GVecGen2iFn *fn)
80
{
81
/* Handle a 2-reg-shift insn which can be vectorized. */
82
int vec_size = a->q ? 16 : 8;
83
- int rd_ofs = neon_reg_offset(a->vd, 0);
84
- int rm_ofs = neon_reg_offset(a->vm, 0);
85
+ int rd_ofs = neon_full_reg_offset(a->vd);
86
+ int rm_ofs = neon_full_reg_offset(a->vm);
87
88
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
89
return false;
90
@@ -XXX,XX +XXX,XX @@ static bool do_fp_2sh(DisasContext *s, arg_2reg_shift *a,
91
{
92
/* FP operations in 2-reg-and-shift group */
93
int vec_size = a->q ? 16 : 8;
94
- int rd_ofs = neon_reg_offset(a->vd, 0);
95
- int rm_ofs = neon_reg_offset(a->vm, 0);
96
+ int rd_ofs = neon_full_reg_offset(a->vd);
97
+ int rm_ofs = neon_full_reg_offset(a->vm);
98
TCGv_ptr fpst;
99
100
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
101
@@ -XXX,XX +XXX,XX @@ static bool do_1reg_imm(DisasContext *s, arg_1reg_imm *a,
102
return true;
103
}
104
105
- reg_ofs = neon_reg_offset(a->vd, 0);
106
+ reg_ofs = neon_full_reg_offset(a->vd);
107
vec_size = a->q ? 16 : 8;
108
imm = asimd_imm_const(a->imm, a->cmode, a->op);
109
110
@@ -XXX,XX +XXX,XX @@ static bool trans_VMULL_P_3d(DisasContext *s, arg_3diff *a)
111
return true;
112
}
113
114
- tcg_gen_gvec_3_ool(neon_reg_offset(a->vd, 0),
115
- neon_reg_offset(a->vn, 0),
116
- neon_reg_offset(a->vm, 0),
117
+ tcg_gen_gvec_3_ool(neon_full_reg_offset(a->vd),
118
+ neon_full_reg_offset(a->vn),
119
+ neon_full_reg_offset(a->vm),
120
16, 16, 0, fn_gvec);
121
return true;
68
}
122
}
69
123
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_fp_vec(DisasContext *s, arg_2scalar *a,
70
/* TBL/TBX
124
{
71
@@ -XXX,XX +XXX,XX @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
125
/* Two registers and a scalar, using gvec */
72
* the input.
126
int vec_size = a->q ? 16 : 8;
73
*/
127
- int rd_ofs = neon_reg_offset(a->vd, 0);
74
tcg_resl = tcg_temp_new_i64();
128
- int rn_ofs = neon_reg_offset(a->vn, 0);
75
- tcg_resh = tcg_temp_new_i64();
129
+ int rd_ofs = neon_full_reg_offset(a->vd);
76
+ tcg_resh = NULL;
130
+ int rn_ofs = neon_full_reg_offset(a->vn);
77
131
int rm_ofs;
78
if (is_tblx) {
132
int idx;
79
read_vec_element(s, tcg_resl, rd, 0, MO_64);
133
TCGv_ptr fpstatus;
80
} else {
134
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_fp_vec(DisasContext *s, arg_2scalar *a,
81
tcg_gen_movi_i64(tcg_resl, 0);
135
/* a->vm is M:Vm, which encodes both register and index */
136
idx = extract32(a->vm, a->size + 2, 2);
137
a->vm = extract32(a->vm, 0, a->size + 2);
138
- rm_ofs = neon_reg_offset(a->vm, 0);
139
+ rm_ofs = neon_full_reg_offset(a->vm);
140
141
fpstatus = fpstatus_ptr(a->size == 1 ? FPST_STD_F16 : FPST_STD);
142
tcg_gen_gvec_3_ptr(rd_ofs, rn_ofs, rm_ofs, fpstatus,
143
@@ -XXX,XX +XXX,XX @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a)
144
return true;
82
}
145
}
83
- if (is_tblx && is_q) {
146
84
- read_vec_element(s, tcg_resh, rd, 1, MO_64);
147
- tcg_gen_gvec_dup_mem(a->size, neon_reg_offset(a->vd, 0),
85
- } else {
148
+ tcg_gen_gvec_dup_mem(a->size, neon_full_reg_offset(a->vd),
86
- tcg_gen_movi_i64(tcg_resh, 0);
149
neon_element_offset(a->vm, a->index, a->size),
87
+
150
a->q ? 16 : 8, a->q ? 16 : 8);
88
+ if (is_q) {
151
return true;
89
+ tcg_resh = tcg_temp_new_i64();
152
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a)
90
+ if (is_tblx) {
153
static bool do_2misc_vec(DisasContext *s, arg_2misc *a, GVecGen2Fn *fn)
91
+ read_vec_element(s, tcg_resh, rd, 1, MO_64);
154
{
92
+ } else {
155
int vec_size = a->q ? 16 : 8;
93
+ tcg_gen_movi_i64(tcg_resh, 0);
156
- int rd_ofs = neon_reg_offset(a->vd, 0);
94
+ }
157
- int rm_ofs = neon_reg_offset(a->vm, 0);
158
+ int rd_ofs = neon_full_reg_offset(a->vd);
159
+ int rm_ofs = neon_full_reg_offset(a->vm);
160
161
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
162
return false;
163
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
164
index XXXXXXX..XXXXXXX 100644
165
--- a/target/arm/translate-vfp.c.inc
166
+++ b/target/arm/translate-vfp.c.inc
167
@@ -XXX,XX +XXX,XX @@ static bool trans_VDUP(DisasContext *s, arg_VDUP *a)
95
}
168
}
96
169
97
tcg_idx = tcg_temp_new_i64();
170
tmp = load_reg(s, a->rt);
98
@@ -XXX,XX +XXX,XX @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
171
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(a->vn, 0),
99
172
+ tcg_gen_gvec_dup_i32(size, neon_full_reg_offset(a->vn),
100
write_vec_element(s, tcg_resl, rd, 0, MO_64);
173
vec_size, vec_size, tmp);
101
tcg_temp_free_i64(tcg_resl);
174
tcg_temp_free_i32(tmp);
102
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
175
103
- tcg_temp_free_i64(tcg_resh);
104
- clear_vec_high(s, true, rd);
105
+
106
+ if (is_q) {
107
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
108
+ tcg_temp_free_i64(tcg_resh);
109
+ }
110
+ clear_vec_high(s, is_q, rd);
111
}
112
113
/* ZIP/UZP/TRN
114
@@ -XXX,XX +XXX,XX @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
115
}
116
117
tcg_resl = tcg_const_i64(0);
118
- tcg_resh = tcg_const_i64(0);
119
+ tcg_resh = is_q ? tcg_const_i64(0) : NULL;
120
tcg_res = tcg_temp_new_i64();
121
122
for (i = 0; i < elements; i++) {
123
@@ -XXX,XX +XXX,XX @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
124
125
write_vec_element(s, tcg_resl, rd, 0, MO_64);
126
tcg_temp_free_i64(tcg_resl);
127
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
128
- tcg_temp_free_i64(tcg_resh);
129
- clear_vec_high(s, true, rd);
130
+
131
+ if (is_q) {
132
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
133
+ tcg_temp_free_i64(tcg_resh);
134
+ }
135
+ clear_vec_high(s, is_q, rd);
136
}
137
138
/*
139
--
176
--
140
2.20.1
177
2.20.1
141
178
142
179
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
i.MX7 supports watchdog pretimeout interupts. With this commit,
3
This will shortly have users outside of translate-neon.c.inc.
4
the watchdog in mcimx7d-sabre is fully operational, including
5
pretimeout support.
6
4
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20201030022618.785675-3-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
Message-id: 20200517162135.110364-9-linux@roeck-us.net
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
9
---
12
include/hw/arm/fsl-imx7.h | 5 +++++
10
target/arm/translate.c | 20 ++++++++++++++++++++
13
hw/arm/fsl-imx7.c | 11 +++++++++++
11
target/arm/translate-neon.c.inc | 19 -------------------
14
2 files changed, 16 insertions(+)
12
2 files changed, 20 insertions(+), 19 deletions(-)
15
13
16
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx7.h
16
--- a/target/arm/translate.c
19
+++ b/include/hw/arm/fsl-imx7.h
17
+++ b/target/arm/translate.c
20
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
18
@@ -XXX,XX +XXX,XX @@ static long neon_full_reg_offset(unsigned reg)
21
FSL_IMX7_USB2_IRQ = 42,
19
return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
22
FSL_IMX7_USB3_IRQ = 40,
20
}
23
21
24
+ FSL_IMX7_WDOG1_IRQ = 78,
22
+/*
25
+ FSL_IMX7_WDOG2_IRQ = 79,
23
+ * Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
26
+ FSL_IMX7_WDOG3_IRQ = 10,
24
+ * where 0 is the least significant end of the register.
27
+ FSL_IMX7_WDOG4_IRQ = 109,
25
+ */
26
+static long neon_element_offset(int reg, int element, MemOp size)
27
+{
28
+ int element_size = 1 << size;
29
+ int ofs = element * element_size;
30
+#ifdef HOST_WORDS_BIGENDIAN
31
+ /*
32
+ * Calculate the offset assuming fully little-endian,
33
+ * then XOR to account for the order of the 8-byte units.
34
+ */
35
+ if (element_size < 8) {
36
+ ofs ^= 8 - element_size;
37
+ }
38
+#endif
39
+ return neon_full_reg_offset(reg) + ofs;
40
+}
28
+
41
+
29
FSL_IMX7_PCI_INTA_IRQ = 125,
42
static inline long vfp_reg_offset(bool dp, unsigned reg)
30
FSL_IMX7_PCI_INTB_IRQ = 124,
43
{
31
FSL_IMX7_PCI_INTC_IRQ = 123,
44
if (dp) {
32
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
45
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
33
index XXXXXXX..XXXXXXX 100644
46
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/fsl-imx7.c
47
--- a/target/arm/translate-neon.c.inc
35
+++ b/hw/arm/fsl-imx7.c
48
+++ b/target/arm/translate-neon.c.inc
36
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
49
@@ -XXX,XX +XXX,XX @@ static inline int neon_3same_fp_size(DisasContext *s, int x)
37
FSL_IMX7_WDOG3_ADDR,
50
#include "decode-neon-ls.c.inc"
38
FSL_IMX7_WDOG4_ADDR,
51
#include "decode-neon-shared.c.inc"
39
};
52
40
+ static const int FSL_IMX7_WDOGn_IRQ[FSL_IMX7_NUM_WDTS] = {
53
-/* Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
41
+ FSL_IMX7_WDOG1_IRQ,
54
- * where 0 is the least significant end of the register.
42
+ FSL_IMX7_WDOG2_IRQ,
55
- */
43
+ FSL_IMX7_WDOG3_IRQ,
56
-static inline long
44
+ FSL_IMX7_WDOG4_IRQ,
57
-neon_element_offset(int reg, int element, MemOp size)
45
+ };
58
-{
46
59
- int element_size = 1 << size;
47
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
60
- int ofs = element * element_size;
48
+ &error_abort);
61
-#ifdef HOST_WORDS_BIGENDIAN
49
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
62
- /* Calculate the offset assuming fully little-endian,
50
&error_abort);
63
- * then XOR to account for the order of the 8-byte units.
51
64
- */
52
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX7_WDOGn_ADDR[i]);
65
- if (element_size < 8) {
53
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
66
- ofs ^= 8 - element_size;
54
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
67
- }
55
+ FSL_IMX7_WDOGn_IRQ[i]));
68
-#endif
56
}
69
- return neon_full_reg_offset(reg) + ofs;
57
70
-}
58
/*
71
-
72
static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop)
73
{
74
long offset = neon_element_offset(reg, ele, mop & MO_SIZE);
59
--
75
--
60
2.20.1
76
2.20.1
61
77
62
78
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
These are the only users of neon_reg_offset, so remove that.
4
the accesses as unimplemented or guest error.
5
4
6
When fuzzing the devices, we don't want the whole process to
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
exit. Replace some hw_error() calls by qemu_log_mask().
6
Message-id: 20201030022618.785675-4-richard.henderson@linaro.org
8
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20200518140309.5220-3-f4bug@amsat.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
9
---
14
hw/arm/pxa2xx_gpio.c | 7 ++++---
10
target/arm/translate.c | 14 ++------------
15
hw/display/pxa2xx_lcd.c | 8 +++++---
11
1 file changed, 2 insertions(+), 12 deletions(-)
16
hw/dma/pxa2xx_dma.c | 14 +++++++++-----
17
3 files changed, 18 insertions(+), 11 deletions(-)
18
12
19
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
20
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/pxa2xx_gpio.c
15
--- a/target/arm/translate.c
22
+++ b/hw/arm/pxa2xx_gpio.c
16
+++ b/target/arm/translate.c
23
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ static inline long vfp_reg_offset(bool dp, unsigned reg)
24
25
#include "qemu/osdep.h"
26
#include "cpu.h"
27
-#include "hw/hw.h"
28
#include "hw/irq.h"
29
#include "hw/qdev-properties.h"
30
#include "hw/sysbus.h"
31
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_gpio_read(void *opaque, hwaddr offset,
32
return s->status[bank];
33
34
default:
35
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
36
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
37
+ __func__, offset);
38
}
39
40
return 0;
41
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_gpio_write(void *opaque, hwaddr offset,
42
break;
43
44
default:
45
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
46
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
47
+ __func__, offset);
48
}
18
}
49
}
19
}
50
20
51
diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c
21
-/* Return the offset of a 32-bit piece of a NEON register.
52
index XXXXXXX..XXXXXXX 100644
22
- zero is the least significant end of the register. */
53
--- a/hw/display/pxa2xx_lcd.c
23
-static inline long
54
+++ b/hw/display/pxa2xx_lcd.c
24
-neon_reg_offset (int reg, int n)
55
@@ -XXX,XX +XXX,XX @@
25
-{
56
*/
26
- int sreg;
57
27
- sreg = reg * 2 + n;
58
#include "qemu/osdep.h"
28
- return vfp_reg_offset(0, sreg);
59
-#include "hw/hw.h"
29
-}
60
+#include "qemu/log.h"
30
-
61
#include "hw/irq.h"
31
static TCGv_i32 neon_load_reg(int reg, int pass)
62
#include "migration/vmstate.h"
32
{
63
#include "ui/console.h"
33
TCGv_i32 tmp = tcg_temp_new_i32();
64
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_lcdc_read(void *opaque, hwaddr offset,
34
- tcg_gen_ld_i32(tmp, cpu_env, neon_reg_offset(reg, pass));
65
35
+ tcg_gen_ld_i32(tmp, cpu_env, neon_element_offset(reg, pass, MO_32));
66
default:
36
return tmp;
67
fail:
68
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
69
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
70
+ __func__, offset);
71
}
72
73
return 0;
74
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,
75
76
default:
77
fail:
78
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
79
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
80
+ __func__, offset);
81
}
82
}
37
}
83
38
84
diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c
39
static void neon_store_reg(int reg, int pass, TCGv_i32 var)
85
index XXXXXXX..XXXXXXX 100644
40
{
86
--- a/hw/dma/pxa2xx_dma.c
41
- tcg_gen_st_i32(var, cpu_env, neon_reg_offset(reg, pass));
87
+++ b/hw/dma/pxa2xx_dma.c
42
+ tcg_gen_st_i32(var, cpu_env, neon_element_offset(reg, pass, MO_32));
88
@@ -XXX,XX +XXX,XX @@
43
tcg_temp_free_i32(var);
89
*/
90
91
#include "qemu/osdep.h"
92
+#include "qemu/log.h"
93
#include "hw/hw.h"
94
#include "hw/irq.h"
95
#include "hw/qdev-properties.h"
96
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
97
unsigned int channel;
98
99
if (size != 4) {
100
- hw_error("%s: Bad access width\n", __func__);
101
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad access width %u\n",
102
+ __func__, size);
103
return 5;
104
}
105
106
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
107
return s->chan[channel].cmd;
108
}
109
}
110
-
111
- hw_error("%s: Bad offset 0x" TARGET_FMT_plx "\n", __func__, offset);
112
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
113
+ __func__, offset);
114
return 7;
115
}
44
}
116
117
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
118
unsigned int channel;
119
120
if (size != 4) {
121
- hw_error("%s: Bad access width\n", __func__);
122
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad access width %u\n",
123
+ __func__, size);
124
return;
125
}
126
127
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
128
break;
129
}
130
fail:
131
- hw_error("%s: Bad offset " TARGET_FMT_plx "\n", __func__, offset);
132
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
133
+ __func__, offset);
134
}
135
}
136
45
137
--
46
--
138
2.20.1
47
2.20.1
139
48
140
49
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
The 8-byte store for the end a !is_q operation can be
3
This seems a bit more readable than using offsetof CPU_DoubleU.
4
merged with the other stores. Use a no-op vector move
5
to trigger the expand_clr portion of tcg_gen_gvec_mov.
6
4
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200519212453.28494-2-richard.henderson@linaro.org
6
Message-id: 20201030022618.785675-5-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
9
---
12
target/arm/translate-a64.c | 10 ++--------
10
target/arm/translate.c | 13 ++++---------
13
1 file changed, 2 insertions(+), 8 deletions(-)
11
1 file changed, 4 insertions(+), 9 deletions(-)
14
12
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
15
--- a/target/arm/translate.c
18
+++ b/target/arm/translate-a64.c
16
+++ b/target/arm/translate.c
19
@@ -XXX,XX +XXX,XX @@ static void clear_vec_high(DisasContext *s, bool is_q, int rd)
17
@@ -XXX,XX +XXX,XX @@ static long neon_element_offset(int reg, int element, MemOp size)
20
unsigned ofs = fp_reg_offset(s, rd, MO_64);
18
return neon_full_reg_offset(reg) + ofs;
21
unsigned vsz = vec_full_reg_size(s);
22
23
- if (!is_q) {
24
- TCGv_i64 tcg_zero = tcg_const_i64(0);
25
- tcg_gen_st_i64(tcg_zero, cpu_env, ofs + 8);
26
- tcg_temp_free_i64(tcg_zero);
27
- }
28
- if (vsz > 16) {
29
- tcg_gen_gvec_dup_imm(MO_64, ofs + 16, vsz - 16, vsz - 16, 0);
30
- }
31
+ /* Nop move, with side effect of clearing the tail. */
32
+ tcg_gen_gvec_mov(MO_64, ofs, ofs, is_q ? 16 : 8, vsz);
33
}
19
}
34
20
35
void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
21
-static inline long vfp_reg_offset(bool dp, unsigned reg)
22
+/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */
23
+static long vfp_reg_offset(bool dp, unsigned reg)
24
{
25
if (dp) {
26
- return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
27
+ return neon_element_offset(reg, 0, MO_64);
28
} else {
29
- long ofs = offsetof(CPUARMState, vfp.zregs[reg >> 2].d[(reg >> 1) & 1]);
30
- if (reg & 1) {
31
- ofs += offsetof(CPU_DoubleU, l.upper);
32
- } else {
33
- ofs += offsetof(CPU_DoubleU, l.lower);
34
- }
35
- return ofs;
36
+ return neon_element_offset(reg >> 1, reg & 1, MO_32);
37
}
38
}
39
36
--
40
--
37
2.20.1
41
2.20.1
38
42
39
43
diff view generated by jsdifflib
1
From: Amanieu d'Antras <amanieu@gmail.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
This fixes signal handlers running with the wrong endianness if the
3
Model these off the aa64 read/write_vec_element functions.
4
interrupted code used SETEND to dynamically switch endianness.
4
Use it within translate-neon.c.inc. The new functions do
5
not allocate or free temps, so this rearranges the calling
6
code a bit.
5
7
6
Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201030022618.785675-6-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20200511131117.2486486-1-amanieu@gmail.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
12
---
11
linux-user/arm/signal.c | 8 +++++++-
13
target/arm/translate.c | 26 ++++
12
1 file changed, 7 insertions(+), 1 deletion(-)
14
target/arm/translate-neon.c.inc | 256 ++++++++++++++++++++------------
15
2 files changed, 183 insertions(+), 99 deletions(-)
13
16
14
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/linux-user/arm/signal.c
19
--- a/target/arm/translate.c
17
+++ b/linux-user/arm/signal.c
20
+++ b/target/arm/translate.c
18
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
21
@@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg32(TCGv_i32 var, int reg)
22
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
23
}
24
25
+static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size)
26
+{
27
+ long off = neon_element_offset(reg, ele, size);
28
+
29
+ switch (size) {
30
+ case MO_32:
31
+ tcg_gen_ld_i32(dest, cpu_env, off);
32
+ break;
33
+ default:
34
+ g_assert_not_reached();
35
+ }
36
+}
37
+
38
+static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp size)
39
+{
40
+ long off = neon_element_offset(reg, ele, size);
41
+
42
+ switch (size) {
43
+ case MO_32:
44
+ tcg_gen_st_i32(src, cpu_env, off);
45
+ break;
46
+ default:
47
+ g_assert_not_reached();
48
+ }
49
+}
50
+
51
static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
52
{
53
TCGv_ptr ret = tcg_temp_new_ptr();
54
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/translate-neon.c.inc
57
+++ b/target/arm/translate-neon.c.inc
58
@@ -XXX,XX +XXX,XX @@ static bool do_3same_pair(DisasContext *s, arg_3same *a, NeonGenTwoOpFn *fn)
59
* early. Since Q is 0 there are always just two passes, so instead
60
* of a complicated loop over each pass we just unroll.
61
*/
62
- tmp = neon_load_reg(a->vn, 0);
63
- tmp2 = neon_load_reg(a->vn, 1);
64
+ tmp = tcg_temp_new_i32();
65
+ tmp2 = tcg_temp_new_i32();
66
+ tmp3 = tcg_temp_new_i32();
67
+
68
+ read_neon_element32(tmp, a->vn, 0, MO_32);
69
+ read_neon_element32(tmp2, a->vn, 1, MO_32);
70
fn(tmp, tmp, tmp2);
71
- tcg_temp_free_i32(tmp2);
72
73
- tmp3 = neon_load_reg(a->vm, 0);
74
- tmp2 = neon_load_reg(a->vm, 1);
75
+ read_neon_element32(tmp3, a->vm, 0, MO_32);
76
+ read_neon_element32(tmp2, a->vm, 1, MO_32);
77
fn(tmp3, tmp3, tmp2);
78
- tcg_temp_free_i32(tmp2);
79
80
- neon_store_reg(a->vd, 0, tmp);
81
- neon_store_reg(a->vd, 1, tmp3);
82
+ write_neon_element32(tmp, a->vd, 0, MO_32);
83
+ write_neon_element32(tmp3, a->vd, 1, MO_32);
84
+
85
+ tcg_temp_free_i32(tmp);
86
+ tcg_temp_free_i32(tmp2);
87
+ tcg_temp_free_i32(tmp3);
88
return true;
89
}
90
91
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a,
92
* 2-reg-and-shift operations, size < 3 case, where the
93
* helper needs to be passed cpu_env.
94
*/
95
- TCGv_i32 constimm;
96
+ TCGv_i32 constimm, tmp;
97
int pass;
98
99
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
100
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a,
101
* by immediate using the variable shift operations.
102
*/
103
constimm = tcg_const_i32(dup_const(a->size, a->shift));
104
+ tmp = tcg_temp_new_i32();
105
106
for (pass = 0; pass < (a->q ? 4 : 2); pass++) {
107
- TCGv_i32 tmp = neon_load_reg(a->vm, pass);
108
+ read_neon_element32(tmp, a->vm, pass, MO_32);
109
fn(tmp, cpu_env, tmp, constimm);
110
- neon_store_reg(a->vd, pass, tmp);
111
+ write_neon_element32(tmp, a->vd, pass, MO_32);
112
}
113
+ tcg_temp_free_i32(tmp);
114
tcg_temp_free_i32(constimm);
115
return true;
116
}
117
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a,
118
constimm = tcg_const_i64(-a->shift);
119
rm1 = tcg_temp_new_i64();
120
rm2 = tcg_temp_new_i64();
121
+ rd = tcg_temp_new_i32();
122
123
/* Load both inputs first to avoid potential overwrite if rm == rd */
124
neon_load_reg64(rm1, a->vm);
125
neon_load_reg64(rm2, a->vm + 1);
126
127
shiftfn(rm1, rm1, constimm);
128
- rd = tcg_temp_new_i32();
129
narrowfn(rd, cpu_env, rm1);
130
- neon_store_reg(a->vd, 0, rd);
131
+ write_neon_element32(rd, a->vd, 0, MO_32);
132
133
shiftfn(rm2, rm2, constimm);
134
- rd = tcg_temp_new_i32();
135
narrowfn(rd, cpu_env, rm2);
136
- neon_store_reg(a->vd, 1, rd);
137
+ write_neon_element32(rd, a->vd, 1, MO_32);
138
139
+ tcg_temp_free_i32(rd);
140
tcg_temp_free_i64(rm1);
141
tcg_temp_free_i64(rm2);
142
tcg_temp_free_i64(constimm);
143
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a,
144
constimm = tcg_const_i32(imm);
145
146
/* Load all inputs first to avoid potential overwrite */
147
- rm1 = neon_load_reg(a->vm, 0);
148
- rm2 = neon_load_reg(a->vm, 1);
149
- rm3 = neon_load_reg(a->vm + 1, 0);
150
- rm4 = neon_load_reg(a->vm + 1, 1);
151
+ rm1 = tcg_temp_new_i32();
152
+ rm2 = tcg_temp_new_i32();
153
+ rm3 = tcg_temp_new_i32();
154
+ rm4 = tcg_temp_new_i32();
155
+ read_neon_element32(rm1, a->vm, 0, MO_32);
156
+ read_neon_element32(rm2, a->vm, 1, MO_32);
157
+ read_neon_element32(rm3, a->vm, 2, MO_32);
158
+ read_neon_element32(rm4, a->vm, 3, MO_32);
159
rtmp = tcg_temp_new_i64();
160
161
shiftfn(rm1, rm1, constimm);
162
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a,
163
tcg_temp_free_i32(rm2);
164
165
narrowfn(rm1, cpu_env, rtmp);
166
- neon_store_reg(a->vd, 0, rm1);
167
+ write_neon_element32(rm1, a->vd, 0, MO_32);
168
+ tcg_temp_free_i32(rm1);
169
170
shiftfn(rm3, rm3, constimm);
171
shiftfn(rm4, rm4, constimm);
172
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a,
173
174
narrowfn(rm3, cpu_env, rtmp);
175
tcg_temp_free_i64(rtmp);
176
- neon_store_reg(a->vd, 1, rm3);
177
+ write_neon_element32(rm3, a->vd, 1, MO_32);
178
+ tcg_temp_free_i32(rm3);
179
return true;
180
}
181
182
@@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a,
183
widen_mask = dup_const(a->size + 1, widen_mask);
184
}
185
186
- rm0 = neon_load_reg(a->vm, 0);
187
- rm1 = neon_load_reg(a->vm, 1);
188
+ rm0 = tcg_temp_new_i32();
189
+ rm1 = tcg_temp_new_i32();
190
+ read_neon_element32(rm0, a->vm, 0, MO_32);
191
+ read_neon_element32(rm1, a->vm, 1, MO_32);
192
tmp = tcg_temp_new_i64();
193
194
widenfn(tmp, rm0);
195
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
196
if (src1_wide) {
197
neon_load_reg64(rn0_64, a->vn);
19
} else {
198
} else {
20
cpsr &= ~CPSR_T;
199
- TCGv_i32 tmp = neon_load_reg(a->vn, 0);
21
}
200
+ TCGv_i32 tmp = tcg_temp_new_i32();
22
+ if (env->cp15.sctlr_el[1] & SCTLR_E0E) {
201
+ read_neon_element32(tmp, a->vn, 0, MO_32);
23
+ cpsr |= CPSR_E;
202
widenfn(rn0_64, tmp);
24
+ } else {
203
tcg_temp_free_i32(tmp);
25
+ cpsr &= ~CPSR_E;
204
}
26
+ }
205
- rm = neon_load_reg(a->vm, 0);
27
206
+ rm = tcg_temp_new_i32();
28
if (ka->sa_flags & TARGET_SA_RESTORER) {
207
+ read_neon_element32(rm, a->vm, 0, MO_32);
29
if (is_fdpic) {
208
30
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
209
widenfn(rm_64, rm);
31
env->regs[13] = frame_addr;
210
tcg_temp_free_i32(rm);
32
env->regs[14] = retcode;
211
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
33
env->regs[15] = handler & (thumb ? ~1 : ~3);
212
if (src1_wide) {
34
- cpsr_write(env, cpsr, CPSR_IT | CPSR_T, CPSRWriteByInstr);
213
neon_load_reg64(rn1_64, a->vn + 1);
35
+ cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr);
214
} else {
36
+ arm_rebuild_hflags(env);
215
- TCGv_i32 tmp = neon_load_reg(a->vn, 1);
37
216
+ TCGv_i32 tmp = tcg_temp_new_i32();
38
return 0;
217
+ read_neon_element32(tmp, a->vn, 1, MO_32);
218
widenfn(rn1_64, tmp);
219
tcg_temp_free_i32(tmp);
220
}
221
- rm = neon_load_reg(a->vm, 1);
222
+ rm = tcg_temp_new_i32();
223
+ read_neon_element32(rm, a->vm, 1, MO_32);
224
225
neon_store_reg64(rn0_64, a->vd);
226
227
@@ -XXX,XX +XXX,XX @@ static bool do_narrow_3d(DisasContext *s, arg_3diff *a,
228
229
narrowfn(rd1, rn_64);
230
231
- neon_store_reg(a->vd, 0, rd0);
232
- neon_store_reg(a->vd, 1, rd1);
233
+ write_neon_element32(rd0, a->vd, 0, MO_32);
234
+ write_neon_element32(rd1, a->vd, 1, MO_32);
235
236
+ tcg_temp_free_i32(rd0);
237
+ tcg_temp_free_i32(rd1);
238
tcg_temp_free_i64(rn_64);
239
tcg_temp_free_i64(rm_64);
240
241
@@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a,
242
rd0 = tcg_temp_new_i64();
243
rd1 = tcg_temp_new_i64();
244
245
- rn = neon_load_reg(a->vn, 0);
246
- rm = neon_load_reg(a->vm, 0);
247
+ rn = tcg_temp_new_i32();
248
+ rm = tcg_temp_new_i32();
249
+ read_neon_element32(rn, a->vn, 0, MO_32);
250
+ read_neon_element32(rm, a->vm, 0, MO_32);
251
opfn(rd0, rn, rm);
252
- tcg_temp_free_i32(rn);
253
- tcg_temp_free_i32(rm);
254
255
- rn = neon_load_reg(a->vn, 1);
256
- rm = neon_load_reg(a->vm, 1);
257
+ read_neon_element32(rn, a->vn, 1, MO_32);
258
+ read_neon_element32(rm, a->vm, 1, MO_32);
259
opfn(rd1, rn, rm);
260
tcg_temp_free_i32(rn);
261
tcg_temp_free_i32(rm);
262
@@ -XXX,XX +XXX,XX @@ static void gen_neon_dup_high16(TCGv_i32 var)
263
264
static inline TCGv_i32 neon_get_scalar(int size, int reg)
265
{
266
- TCGv_i32 tmp;
267
- if (size == 1) {
268
- tmp = neon_load_reg(reg & 7, reg >> 4);
269
+ TCGv_i32 tmp = tcg_temp_new_i32();
270
+ if (size == MO_16) {
271
+ read_neon_element32(tmp, reg & 7, reg >> 4, MO_32);
272
if (reg & 8) {
273
gen_neon_dup_high16(tmp);
274
} else {
275
gen_neon_dup_low16(tmp);
276
}
277
} else {
278
- tmp = neon_load_reg(reg & 15, reg >> 4);
279
+ read_neon_element32(tmp, reg & 15, reg >> 4, MO_32);
280
}
281
return tmp;
282
}
283
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar(DisasContext *s, arg_2scalar *a,
284
* perform an accumulation operation of that result into the
285
* destination.
286
*/
287
- TCGv_i32 scalar;
288
+ TCGv_i32 scalar, tmp;
289
int pass;
290
291
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
292
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar(DisasContext *s, arg_2scalar *a,
293
}
294
295
scalar = neon_get_scalar(a->size, a->vm);
296
+ tmp = tcg_temp_new_i32();
297
298
for (pass = 0; pass < (a->q ? 4 : 2); pass++) {
299
- TCGv_i32 tmp = neon_load_reg(a->vn, pass);
300
+ read_neon_element32(tmp, a->vn, pass, MO_32);
301
opfn(tmp, tmp, scalar);
302
if (accfn) {
303
- TCGv_i32 rd = neon_load_reg(a->vd, pass);
304
+ TCGv_i32 rd = tcg_temp_new_i32();
305
+ read_neon_element32(rd, a->vd, pass, MO_32);
306
accfn(tmp, rd, tmp);
307
tcg_temp_free_i32(rd);
308
}
309
- neon_store_reg(a->vd, pass, tmp);
310
+ write_neon_element32(tmp, a->vd, pass, MO_32);
311
}
312
+ tcg_temp_free_i32(tmp);
313
tcg_temp_free_i32(scalar);
314
return true;
315
}
316
@@ -XXX,XX +XXX,XX @@ static bool do_vqrdmlah_2sc(DisasContext *s, arg_2scalar *a,
317
* performs a kind of fused op-then-accumulate using a helper
318
* function that takes all of rd, rn and the scalar at once.
319
*/
320
- TCGv_i32 scalar;
321
+ TCGv_i32 scalar, rn, rd;
322
int pass;
323
324
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
325
@@ -XXX,XX +XXX,XX @@ static bool do_vqrdmlah_2sc(DisasContext *s, arg_2scalar *a,
326
}
327
328
scalar = neon_get_scalar(a->size, a->vm);
329
+ rn = tcg_temp_new_i32();
330
+ rd = tcg_temp_new_i32();
331
332
for (pass = 0; pass < (a->q ? 4 : 2); pass++) {
333
- TCGv_i32 rn = neon_load_reg(a->vn, pass);
334
- TCGv_i32 rd = neon_load_reg(a->vd, pass);
335
+ read_neon_element32(rn, a->vn, pass, MO_32);
336
+ read_neon_element32(rd, a->vd, pass, MO_32);
337
opfn(rd, cpu_env, rn, scalar, rd);
338
- tcg_temp_free_i32(rn);
339
- neon_store_reg(a->vd, pass, rd);
340
+ write_neon_element32(rd, a->vd, pass, MO_32);
341
}
342
+ tcg_temp_free_i32(rn);
343
+ tcg_temp_free_i32(rd);
344
tcg_temp_free_i32(scalar);
345
346
return true;
347
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a,
348
scalar = neon_get_scalar(a->size, a->vm);
349
350
/* Load all inputs before writing any outputs, in case of overlap */
351
- rn = neon_load_reg(a->vn, 0);
352
+ rn = tcg_temp_new_i32();
353
+ read_neon_element32(rn, a->vn, 0, MO_32);
354
rn0_64 = tcg_temp_new_i64();
355
opfn(rn0_64, rn, scalar);
356
- tcg_temp_free_i32(rn);
357
358
- rn = neon_load_reg(a->vn, 1);
359
+ read_neon_element32(rn, a->vn, 1, MO_32);
360
rn1_64 = tcg_temp_new_i64();
361
opfn(rn1_64, rn, scalar);
362
tcg_temp_free_i32(rn);
363
@@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a)
364
return false;
365
}
366
n <<= 3;
367
+ tmp = tcg_temp_new_i32();
368
if (a->op) {
369
- tmp = neon_load_reg(a->vd, 0);
370
+ read_neon_element32(tmp, a->vd, 0, MO_32);
371
} else {
372
- tmp = tcg_temp_new_i32();
373
tcg_gen_movi_i32(tmp, 0);
374
}
375
- tmp2 = neon_load_reg(a->vm, 0);
376
+ tmp2 = tcg_temp_new_i32();
377
+ read_neon_element32(tmp2, a->vm, 0, MO_32);
378
ptr1 = vfp_reg_ptr(true, a->vn);
379
tmp4 = tcg_const_i32(n);
380
gen_helper_neon_tbl(tmp2, tmp2, tmp, ptr1, tmp4);
381
- tcg_temp_free_i32(tmp);
382
+
383
if (a->op) {
384
- tmp = neon_load_reg(a->vd, 1);
385
+ read_neon_element32(tmp, a->vd, 1, MO_32);
386
} else {
387
- tmp = tcg_temp_new_i32();
388
tcg_gen_movi_i32(tmp, 0);
389
}
390
- tmp3 = neon_load_reg(a->vm, 1);
391
+ tmp3 = tcg_temp_new_i32();
392
+ read_neon_element32(tmp3, a->vm, 1, MO_32);
393
gen_helper_neon_tbl(tmp3, tmp3, tmp, ptr1, tmp4);
394
+ tcg_temp_free_i32(tmp);
395
tcg_temp_free_i32(tmp4);
396
tcg_temp_free_ptr(ptr1);
397
- neon_store_reg(a->vd, 0, tmp2);
398
- neon_store_reg(a->vd, 1, tmp3);
399
- tcg_temp_free_i32(tmp);
400
+
401
+ write_neon_element32(tmp2, a->vd, 0, MO_32);
402
+ write_neon_element32(tmp3, a->vd, 1, MO_32);
403
+ tcg_temp_free_i32(tmp2);
404
+ tcg_temp_free_i32(tmp3);
405
return true;
406
}
407
408
@@ -XXX,XX +XXX,XX @@ static bool trans_VDUP_scalar(DisasContext *s, arg_VDUP_scalar *a)
409
static bool trans_VREV64(DisasContext *s, arg_VREV64 *a)
410
{
411
int pass, half;
412
+ TCGv_i32 tmp[2];
413
414
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
415
return false;
416
@@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a)
417
return true;
418
}
419
420
- for (pass = 0; pass < (a->q ? 2 : 1); pass++) {
421
- TCGv_i32 tmp[2];
422
+ tmp[0] = tcg_temp_new_i32();
423
+ tmp[1] = tcg_temp_new_i32();
424
425
+ for (pass = 0; pass < (a->q ? 2 : 1); pass++) {
426
for (half = 0; half < 2; half++) {
427
- tmp[half] = neon_load_reg(a->vm, pass * 2 + half);
428
+ read_neon_element32(tmp[half], a->vm, pass * 2 + half, MO_32);
429
switch (a->size) {
430
case 0:
431
tcg_gen_bswap32_i32(tmp[half], tmp[half]);
432
@@ -XXX,XX +XXX,XX @@ static bool trans_VREV64(DisasContext *s, arg_VREV64 *a)
433
g_assert_not_reached();
434
}
435
}
436
- neon_store_reg(a->vd, pass * 2, tmp[1]);
437
- neon_store_reg(a->vd, pass * 2 + 1, tmp[0]);
438
+ write_neon_element32(tmp[1], a->vd, pass * 2, MO_32);
439
+ write_neon_element32(tmp[0], a->vd, pass * 2 + 1, MO_32);
440
}
441
+
442
+ tcg_temp_free_i32(tmp[0]);
443
+ tcg_temp_free_i32(tmp[1]);
444
return true;
445
}
446
447
@@ -XXX,XX +XXX,XX @@ static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a,
448
rm0_64 = tcg_temp_new_i64();
449
rm1_64 = tcg_temp_new_i64();
450
rd_64 = tcg_temp_new_i64();
451
- tmp = neon_load_reg(a->vm, pass * 2);
452
+
453
+ tmp = tcg_temp_new_i32();
454
+ read_neon_element32(tmp, a->vm, pass * 2, MO_32);
455
widenfn(rm0_64, tmp);
456
- tcg_temp_free_i32(tmp);
457
- tmp = neon_load_reg(a->vm, pass * 2 + 1);
458
+ read_neon_element32(tmp, a->vm, pass * 2 + 1, MO_32);
459
widenfn(rm1_64, tmp);
460
tcg_temp_free_i32(tmp);
461
+
462
opfn(rd_64, rm0_64, rm1_64);
463
tcg_temp_free_i64(rm0_64);
464
tcg_temp_free_i64(rm1_64);
465
@@ -XXX,XX +XXX,XX @@ static bool do_vmovn(DisasContext *s, arg_2misc *a,
466
narrowfn(rd0, cpu_env, rm);
467
neon_load_reg64(rm, a->vm + 1);
468
narrowfn(rd1, cpu_env, rm);
469
- neon_store_reg(a->vd, 0, rd0);
470
- neon_store_reg(a->vd, 1, rd1);
471
+ write_neon_element32(rd0, a->vd, 0, MO_32);
472
+ write_neon_element32(rd1, a->vd, 1, MO_32);
473
+ tcg_temp_free_i32(rd0);
474
+ tcg_temp_free_i32(rd1);
475
tcg_temp_free_i64(rm);
476
return true;
477
}
478
@@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL(DisasContext *s, arg_2misc *a)
479
}
480
481
rd = tcg_temp_new_i64();
482
+ rm0 = tcg_temp_new_i32();
483
+ rm1 = tcg_temp_new_i32();
484
485
- rm0 = neon_load_reg(a->vm, 0);
486
- rm1 = neon_load_reg(a->vm, 1);
487
+ read_neon_element32(rm0, a->vm, 0, MO_32);
488
+ read_neon_element32(rm1, a->vm, 1, MO_32);
489
490
widenfn(rd, rm0);
491
tcg_gen_shli_i64(rd, rd, 8 << a->size);
492
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F16_F32(DisasContext *s, arg_2misc *a)
493
494
fpst = fpstatus_ptr(FPST_STD);
495
ahp = get_ahp_flag();
496
- tmp = neon_load_reg(a->vm, 0);
497
+ tmp = tcg_temp_new_i32();
498
+ read_neon_element32(tmp, a->vm, 0, MO_32);
499
gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp);
500
- tmp2 = neon_load_reg(a->vm, 1);
501
+ tmp2 = tcg_temp_new_i32();
502
+ read_neon_element32(tmp2, a->vm, 1, MO_32);
503
gen_helper_vfp_fcvt_f32_to_f16(tmp2, tmp2, fpst, ahp);
504
tcg_gen_shli_i32(tmp2, tmp2, 16);
505
tcg_gen_or_i32(tmp2, tmp2, tmp);
506
- tcg_temp_free_i32(tmp);
507
- tmp = neon_load_reg(a->vm, 2);
508
+ read_neon_element32(tmp, a->vm, 2, MO_32);
509
gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp);
510
- tmp3 = neon_load_reg(a->vm, 3);
511
- neon_store_reg(a->vd, 0, tmp2);
512
+ tmp3 = tcg_temp_new_i32();
513
+ read_neon_element32(tmp3, a->vm, 3, MO_32);
514
+ write_neon_element32(tmp2, a->vd, 0, MO_32);
515
+ tcg_temp_free_i32(tmp2);
516
gen_helper_vfp_fcvt_f32_to_f16(tmp3, tmp3, fpst, ahp);
517
tcg_gen_shli_i32(tmp3, tmp3, 16);
518
tcg_gen_or_i32(tmp3, tmp3, tmp);
519
- neon_store_reg(a->vd, 1, tmp3);
520
+ write_neon_element32(tmp3, a->vd, 1, MO_32);
521
+ tcg_temp_free_i32(tmp3);
522
tcg_temp_free_i32(tmp);
523
tcg_temp_free_i32(ahp);
524
tcg_temp_free_ptr(fpst);
525
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_F32_F16(DisasContext *s, arg_2misc *a)
526
fpst = fpstatus_ptr(FPST_STD);
527
ahp = get_ahp_flag();
528
tmp3 = tcg_temp_new_i32();
529
- tmp = neon_load_reg(a->vm, 0);
530
- tmp2 = neon_load_reg(a->vm, 1);
531
+ tmp2 = tcg_temp_new_i32();
532
+ tmp = tcg_temp_new_i32();
533
+ read_neon_element32(tmp, a->vm, 0, MO_32);
534
+ read_neon_element32(tmp2, a->vm, 1, MO_32);
535
tcg_gen_ext16u_i32(tmp3, tmp);
536
gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp);
537
- neon_store_reg(a->vd, 0, tmp3);
538
+ write_neon_element32(tmp3, a->vd, 0, MO_32);
539
tcg_gen_shri_i32(tmp, tmp, 16);
540
gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp);
541
- neon_store_reg(a->vd, 1, tmp);
542
- tmp3 = tcg_temp_new_i32();
543
+ write_neon_element32(tmp, a->vd, 1, MO_32);
544
+ tcg_temp_free_i32(tmp);
545
tcg_gen_ext16u_i32(tmp3, tmp2);
546
gen_helper_vfp_fcvt_f16_to_f32(tmp3, tmp3, fpst, ahp);
547
- neon_store_reg(a->vd, 2, tmp3);
548
+ write_neon_element32(tmp3, a->vd, 2, MO_32);
549
+ tcg_temp_free_i32(tmp3);
550
tcg_gen_shri_i32(tmp2, tmp2, 16);
551
gen_helper_vfp_fcvt_f16_to_f32(tmp2, tmp2, fpst, ahp);
552
- neon_store_reg(a->vd, 3, tmp2);
553
+ write_neon_element32(tmp2, a->vd, 3, MO_32);
554
+ tcg_temp_free_i32(tmp2);
555
tcg_temp_free_i32(ahp);
556
tcg_temp_free_ptr(fpst);
557
558
@@ -XXX,XX +XXX,XX @@ DO_2M_CRYPTO(SHA256SU0, aa32_sha2, 2)
559
560
static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn)
561
{
562
+ TCGv_i32 tmp;
563
int pass;
564
565
/* Handle a 2-reg-misc operation by iterating 32 bits at a time */
566
@@ -XXX,XX +XXX,XX @@ static bool do_2misc(DisasContext *s, arg_2misc *a, NeonGenOneOpFn *fn)
567
return true;
568
}
569
570
+ tmp = tcg_temp_new_i32();
571
for (pass = 0; pass < (a->q ? 4 : 2); pass++) {
572
- TCGv_i32 tmp = neon_load_reg(a->vm, pass);
573
+ read_neon_element32(tmp, a->vm, pass, MO_32);
574
fn(tmp, tmp);
575
- neon_store_reg(a->vd, pass, tmp);
576
+ write_neon_element32(tmp, a->vd, pass, MO_32);
577
}
578
+ tcg_temp_free_i32(tmp);
579
580
return true;
581
}
582
@@ -XXX,XX +XXX,XX @@ static bool trans_VTRN(DisasContext *s, arg_2misc *a)
583
return true;
584
}
585
586
- if (a->size == 2) {
587
+ tmp = tcg_temp_new_i32();
588
+ tmp2 = tcg_temp_new_i32();
589
+ if (a->size == MO_32) {
590
for (pass = 0; pass < (a->q ? 4 : 2); pass += 2) {
591
- tmp = neon_load_reg(a->vm, pass);
592
- tmp2 = neon_load_reg(a->vd, pass + 1);
593
- neon_store_reg(a->vm, pass, tmp2);
594
- neon_store_reg(a->vd, pass + 1, tmp);
595
+ read_neon_element32(tmp, a->vm, pass, MO_32);
596
+ read_neon_element32(tmp2, a->vd, pass + 1, MO_32);
597
+ write_neon_element32(tmp2, a->vm, pass, MO_32);
598
+ write_neon_element32(tmp, a->vd, pass + 1, MO_32);
599
}
600
} else {
601
for (pass = 0; pass < (a->q ? 4 : 2); pass++) {
602
- tmp = neon_load_reg(a->vm, pass);
603
- tmp2 = neon_load_reg(a->vd, pass);
604
- if (a->size == 0) {
605
+ read_neon_element32(tmp, a->vm, pass, MO_32);
606
+ read_neon_element32(tmp2, a->vd, pass, MO_32);
607
+ if (a->size == MO_8) {
608
gen_neon_trn_u8(tmp, tmp2);
609
} else {
610
gen_neon_trn_u16(tmp, tmp2);
611
}
612
- neon_store_reg(a->vm, pass, tmp2);
613
- neon_store_reg(a->vd, pass, tmp);
614
+ write_neon_element32(tmp2, a->vm, pass, MO_32);
615
+ write_neon_element32(tmp, a->vd, pass, MO_32);
616
}
617
}
618
+ tcg_temp_free_i32(tmp);
619
+ tcg_temp_free_i32(tmp2);
620
return true;
39
}
621
}
40
--
622
--
41
2.20.1
623
2.20.1
42
624
43
625
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
We can then use this to improve VMOV (scalar to gp) and
4
the accesses as unimplemented or guest error.
4
VMOV (gp to scalar) so that we simply perform the memory
5
5
operation that we wanted, rather than inserting or
6
When fuzzing the devices, we don't want the whole process to
6
extracting from a 32-bit quantity.
7
exit. Replace some hw_error() calls by qemu_log_mask().
7
8
8
These were the last uses of neon_load/store_reg, so remove them.
9
Per the datasheet "Exynos 4412 RISC Microprocessor Rev 1.00"
9
10
Chapter 25 "Multi Core Timer (MCT)" figure 1 and table 4,
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
the default value on the APB bus is 0.
11
Message-id: 20201030022618.785675-7-richard.henderson@linaro.org
12
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-id: 20200518140309.5220-5-f4bug@amsat.org
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
14
---
18
hw/timer/exynos4210_mct.c | 12 +++++-------
15
target/arm/translate.c | 50 +++++++++++++-----------
19
1 file changed, 5 insertions(+), 7 deletions(-)
16
target/arm/translate-vfp.c.inc | 71 +++++-----------------------------
20
17
2 files changed, 37 insertions(+), 84 deletions(-)
21
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
18
19
diff --git a/target/arm/translate.c b/target/arm/translate.c
22
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/timer/exynos4210_mct.c
21
--- a/target/arm/translate.c
24
+++ b/hw/timer/exynos4210_mct.c
22
+++ b/target/arm/translate.c
25
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ static long neon_full_reg_offset(unsigned reg)
26
24
* Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
27
#include "qemu/osdep.h"
25
* where 0 is the least significant end of the register.
28
#include "qemu/log.h"
26
*/
29
-#include "hw/hw.h"
27
-static long neon_element_offset(int reg, int element, MemOp size)
30
#include "hw/sysbus.h"
28
+static long neon_element_offset(int reg, int element, MemOp memop)
31
#include "migration/vmstate.h"
29
{
32
#include "qemu/timer.h"
30
- int element_size = 1 << size;
33
@@ -XXX,XX +XXX,XX @@
31
+ int element_size = 1 << (memop & MO_SIZE);
34
#include "hw/ptimer.h"
32
int ofs = element * element_size;
35
33
#ifdef HOST_WORDS_BIGENDIAN
36
#include "hw/arm/exynos4210.h"
34
/*
37
-#include "hw/hw.h"
35
@@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg)
38
#include "hw/irq.h"
36
}
39
37
}
40
//#define DEBUG_MCT
38
41
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset,
39
-static TCGv_i32 neon_load_reg(int reg, int pass)
42
int index;
40
-{
43
int shift;
41
- TCGv_i32 tmp = tcg_temp_new_i32();
44
uint64_t count;
42
- tcg_gen_ld_i32(tmp, cpu_env, neon_element_offset(reg, pass, MO_32));
45
- uint32_t value;
43
- return tmp;
46
+ uint32_t value = 0;
44
-}
47
int lt_i;
45
-
48
46
-static void neon_store_reg(int reg, int pass, TCGv_i32 var)
49
switch (offset) {
47
-{
50
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset,
48
- tcg_gen_st_i32(var, cpu_env, neon_element_offset(reg, pass, MO_32));
49
- tcg_temp_free_i32(var);
50
-}
51
-
52
static inline void neon_load_reg64(TCGv_i64 var, int reg)
53
{
54
tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg));
55
@@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg32(TCGv_i32 var, int reg)
56
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
57
}
58
59
-static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size)
60
+static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
61
{
62
- long off = neon_element_offset(reg, ele, size);
63
+ long off = neon_element_offset(reg, ele, memop);
64
65
- switch (size) {
66
- case MO_32:
67
+ switch (memop) {
68
+ case MO_SB:
69
+ tcg_gen_ld8s_i32(dest, cpu_env, off);
70
+ break;
71
+ case MO_UB:
72
+ tcg_gen_ld8u_i32(dest, cpu_env, off);
73
+ break;
74
+ case MO_SW:
75
+ tcg_gen_ld16s_i32(dest, cpu_env, off);
76
+ break;
77
+ case MO_UW:
78
+ tcg_gen_ld16u_i32(dest, cpu_env, off);
79
+ break;
80
+ case MO_UL:
81
+ case MO_SL:
82
tcg_gen_ld_i32(dest, cpu_env, off);
51
break;
83
break;
52
53
default:
84
default:
54
- hw_error("exynos4210.mct: bad read offset "
85
@@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp size)
55
- TARGET_FMT_plx "\n", offset);
86
}
56
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
87
}
57
+ __func__, offset);
88
89
-static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp size)
90
+static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
91
{
92
- long off = neon_element_offset(reg, ele, size);
93
+ long off = neon_element_offset(reg, ele, memop);
94
95
- switch (size) {
96
+ switch (memop) {
97
+ case MO_8:
98
+ tcg_gen_st8_i32(src, cpu_env, off);
99
+ break;
100
+ case MO_16:
101
+ tcg_gen_st16_i32(src, cpu_env, off);
102
+ break;
103
case MO_32:
104
tcg_gen_st_i32(src, cpu_env, off);
58
break;
105
break;
59
}
106
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
60
return value;
107
index XXXXXXX..XXXXXXX 100644
61
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
108
--- a/target/arm/translate-vfp.c.inc
62
break;
109
+++ b/target/arm/translate-vfp.c.inc
63
110
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
64
default:
111
{
65
- hw_error("exynos4210.mct: bad write offset "
112
/* VMOV scalar to general purpose register */
66
- TARGET_FMT_plx "\n", offset);
113
TCGv_i32 tmp;
67
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
114
- int pass;
68
+ __func__, offset);
115
- uint32_t offset;
69
break;
116
70
}
117
- /* SIZE == 2 is a VFP instruction; otherwise NEON. */
118
- if (a->size == 2
119
+ /* SIZE == MO_32 is a VFP instruction; otherwise NEON. */
120
+ if (a->size == MO_32
121
? !dc_isar_feature(aa32_fpsp_v2, s)
122
: !arm_dc_feature(s, ARM_FEATURE_NEON)) {
123
return false;
124
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
125
return false;
126
}
127
128
- offset = a->index << a->size;
129
- pass = extract32(offset, 2, 1);
130
- offset = extract32(offset, 0, 2) * 8;
131
-
132
if (!vfp_access_check(s)) {
133
return true;
134
}
135
136
- tmp = neon_load_reg(a->vn, pass);
137
- switch (a->size) {
138
- case 0:
139
- if (offset) {
140
- tcg_gen_shri_i32(tmp, tmp, offset);
141
- }
142
- if (a->u) {
143
- gen_uxtb(tmp);
144
- } else {
145
- gen_sxtb(tmp);
146
- }
147
- break;
148
- case 1:
149
- if (a->u) {
150
- if (offset) {
151
- tcg_gen_shri_i32(tmp, tmp, 16);
152
- } else {
153
- gen_uxth(tmp);
154
- }
155
- } else {
156
- if (offset) {
157
- tcg_gen_sari_i32(tmp, tmp, 16);
158
- } else {
159
- gen_sxth(tmp);
160
- }
161
- }
162
- break;
163
- case 2:
164
- break;
165
- }
166
+ tmp = tcg_temp_new_i32();
167
+ read_neon_element32(tmp, a->vn, a->index, a->size | (a->u ? 0 : MO_SIGN));
168
store_reg(s, a->rt, tmp);
169
170
return true;
171
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
172
static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a)
173
{
174
/* VMOV general purpose register to scalar */
175
- TCGv_i32 tmp, tmp2;
176
- int pass;
177
- uint32_t offset;
178
+ TCGv_i32 tmp;
179
180
- /* SIZE == 2 is a VFP instruction; otherwise NEON. */
181
- if (a->size == 2
182
+ /* SIZE == MO_32 is a VFP instruction; otherwise NEON. */
183
+ if (a->size == MO_32
184
? !dc_isar_feature(aa32_fpsp_v2, s)
185
: !arm_dc_feature(s, ARM_FEATURE_NEON)) {
186
return false;
187
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a)
188
return false;
189
}
190
191
- offset = a->index << a->size;
192
- pass = extract32(offset, 2, 1);
193
- offset = extract32(offset, 0, 2) * 8;
194
-
195
if (!vfp_access_check(s)) {
196
return true;
197
}
198
199
tmp = load_reg(s, a->rt);
200
- switch (a->size) {
201
- case 0:
202
- tmp2 = neon_load_reg(a->vn, pass);
203
- tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 8);
204
- tcg_temp_free_i32(tmp2);
205
- break;
206
- case 1:
207
- tmp2 = neon_load_reg(a->vn, pass);
208
- tcg_gen_deposit_i32(tmp, tmp2, tmp, offset, 16);
209
- tcg_temp_free_i32(tmp2);
210
- break;
211
- case 2:
212
- break;
213
- }
214
- neon_store_reg(a->vn, pass, tmp);
215
+ write_neon_element32(tmp, a->vn, a->index, a->size);
216
+ tcg_temp_free_i32(tmp);
217
218
return true;
71
}
219
}
72
--
220
--
73
2.20.1
221
2.20.1
74
222
75
223
diff view generated by jsdifflib
1
The GEN_NEON_INTEGER_OP macro is no longer used; remove it.
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
The only uses of this function are for loading VFP
4
single-precision values, and nothing to do with NEON.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201030022618.785675-8-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
---
10
---
6
target/arm/translate.c | 23 -----------------------
11
target/arm/translate.c | 4 +-
7
1 file changed, 23 deletions(-)
12
target/arm/translate-vfp.c.inc | 184 ++++++++++++++++-----------------
13
2 files changed, 94 insertions(+), 94 deletions(-)
8
14
9
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
10
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
11
--- a/target/arm/translate.c
17
--- a/target/arm/translate.c
12
+++ b/target/arm/translate.c
18
+++ b/target/arm/translate.c
13
@@ -XXX,XX +XXX,XX @@ static inline void gen_neon_rsb(int size, TCGv_i32 t0, TCGv_i32 t1)
19
@@ -XXX,XX +XXX,XX @@ static inline void neon_store_reg64(TCGv_i64 var, int reg)
14
default: return 1; \
20
tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg));
15
}} while (0)
21
}
16
22
17
-#define GEN_NEON_INTEGER_OP(name) do { \
23
-static inline void neon_load_reg32(TCGv_i32 var, int reg)
18
- switch ((size << 1) | u) { \
24
+static inline void vfp_load_reg32(TCGv_i32 var, int reg)
19
- case 0: \
20
- gen_helper_neon_##name##_s8(tmp, tmp, tmp2); \
21
- break; \
22
- case 1: \
23
- gen_helper_neon_##name##_u8(tmp, tmp, tmp2); \
24
- break; \
25
- case 2: \
26
- gen_helper_neon_##name##_s16(tmp, tmp, tmp2); \
27
- break; \
28
- case 3: \
29
- gen_helper_neon_##name##_u16(tmp, tmp, tmp2); \
30
- break; \
31
- case 4: \
32
- gen_helper_neon_##name##_s32(tmp, tmp, tmp2); \
33
- break; \
34
- case 5: \
35
- gen_helper_neon_##name##_u32(tmp, tmp, tmp2); \
36
- break; \
37
- default: return 1; \
38
- }} while (0)
39
-
40
static TCGv_i32 neon_load_scratch(int scratch)
41
{
25
{
42
TCGv_i32 tmp = tcg_temp_new_i32();
26
tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg));
27
}
28
29
-static inline void neon_store_reg32(TCGv_i32 var, int reg)
30
+static inline void vfp_store_reg32(TCGv_i32 var, int reg)
31
{
32
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
33
}
34
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/translate-vfp.c.inc
37
+++ b/target/arm/translate-vfp.c.inc
38
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
39
frn = tcg_temp_new_i32();
40
frm = tcg_temp_new_i32();
41
dest = tcg_temp_new_i32();
42
- neon_load_reg32(frn, rn);
43
- neon_load_reg32(frm, rm);
44
+ vfp_load_reg32(frn, rn);
45
+ vfp_load_reg32(frm, rm);
46
switch (a->cc) {
47
case 0: /* eq: Z */
48
tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero,
49
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
50
if (sz == 1) {
51
tcg_gen_andi_i32(dest, dest, 0xffff);
52
}
53
- neon_store_reg32(dest, rd);
54
+ vfp_store_reg32(dest, rd);
55
tcg_temp_free_i32(frn);
56
tcg_temp_free_i32(frm);
57
tcg_temp_free_i32(dest);
58
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
59
TCGv_i32 tcg_res;
60
tcg_op = tcg_temp_new_i32();
61
tcg_res = tcg_temp_new_i32();
62
- neon_load_reg32(tcg_op, rm);
63
+ vfp_load_reg32(tcg_op, rm);
64
if (sz == 1) {
65
gen_helper_rinth(tcg_res, tcg_op, fpst);
66
} else {
67
gen_helper_rints(tcg_res, tcg_op, fpst);
68
}
69
- neon_store_reg32(tcg_res, rd);
70
+ vfp_store_reg32(tcg_res, rd);
71
tcg_temp_free_i32(tcg_op);
72
tcg_temp_free_i32(tcg_res);
73
}
74
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
75
gen_helper_vfp_tould(tcg_res, tcg_double, tcg_shift, fpst);
76
}
77
tcg_gen_extrl_i64_i32(tcg_tmp, tcg_res);
78
- neon_store_reg32(tcg_tmp, rd);
79
+ vfp_store_reg32(tcg_tmp, rd);
80
tcg_temp_free_i32(tcg_tmp);
81
tcg_temp_free_i64(tcg_res);
82
tcg_temp_free_i64(tcg_double);
83
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
84
TCGv_i32 tcg_single, tcg_res;
85
tcg_single = tcg_temp_new_i32();
86
tcg_res = tcg_temp_new_i32();
87
- neon_load_reg32(tcg_single, rm);
88
+ vfp_load_reg32(tcg_single, rm);
89
if (sz == 1) {
90
if (is_signed) {
91
gen_helper_vfp_toslh(tcg_res, tcg_single, tcg_shift, fpst);
92
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
93
gen_helper_vfp_touls(tcg_res, tcg_single, tcg_shift, fpst);
94
}
95
}
96
- neon_store_reg32(tcg_res, rd);
97
+ vfp_store_reg32(tcg_res, rd);
98
tcg_temp_free_i32(tcg_res);
99
tcg_temp_free_i32(tcg_single);
100
}
101
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_half(DisasContext *s, arg_VMOV_single *a)
102
if (a->l) {
103
/* VFP to general purpose register */
104
tmp = tcg_temp_new_i32();
105
- neon_load_reg32(tmp, a->vn);
106
+ vfp_load_reg32(tmp, a->vn);
107
tcg_gen_andi_i32(tmp, tmp, 0xffff);
108
store_reg(s, a->rt, tmp);
109
} else {
110
/* general purpose register to VFP */
111
tmp = load_reg(s, a->rt);
112
tcg_gen_andi_i32(tmp, tmp, 0xffff);
113
- neon_store_reg32(tmp, a->vn);
114
+ vfp_store_reg32(tmp, a->vn);
115
tcg_temp_free_i32(tmp);
116
}
117
118
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a)
119
if (a->l) {
120
/* VFP to general purpose register */
121
tmp = tcg_temp_new_i32();
122
- neon_load_reg32(tmp, a->vn);
123
+ vfp_load_reg32(tmp, a->vn);
124
if (a->rt == 15) {
125
/* Set the 4 flag bits in the CPSR. */
126
gen_set_nzcv(tmp);
127
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a)
128
} else {
129
/* general purpose register to VFP */
130
tmp = load_reg(s, a->rt);
131
- neon_store_reg32(tmp, a->vn);
132
+ vfp_store_reg32(tmp, a->vn);
133
tcg_temp_free_i32(tmp);
134
}
135
136
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
137
if (a->op) {
138
/* fpreg to gpreg */
139
tmp = tcg_temp_new_i32();
140
- neon_load_reg32(tmp, a->vm);
141
+ vfp_load_reg32(tmp, a->vm);
142
store_reg(s, a->rt, tmp);
143
tmp = tcg_temp_new_i32();
144
- neon_load_reg32(tmp, a->vm + 1);
145
+ vfp_load_reg32(tmp, a->vm + 1);
146
store_reg(s, a->rt2, tmp);
147
} else {
148
/* gpreg to fpreg */
149
tmp = load_reg(s, a->rt);
150
- neon_store_reg32(tmp, a->vm);
151
+ vfp_store_reg32(tmp, a->vm);
152
tcg_temp_free_i32(tmp);
153
tmp = load_reg(s, a->rt2);
154
- neon_store_reg32(tmp, a->vm + 1);
155
+ vfp_store_reg32(tmp, a->vm + 1);
156
tcg_temp_free_i32(tmp);
157
}
158
159
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_dp *a)
160
if (a->op) {
161
/* fpreg to gpreg */
162
tmp = tcg_temp_new_i32();
163
- neon_load_reg32(tmp, a->vm * 2);
164
+ vfp_load_reg32(tmp, a->vm * 2);
165
store_reg(s, a->rt, tmp);
166
tmp = tcg_temp_new_i32();
167
- neon_load_reg32(tmp, a->vm * 2 + 1);
168
+ vfp_load_reg32(tmp, a->vm * 2 + 1);
169
store_reg(s, a->rt2, tmp);
170
} else {
171
/* gpreg to fpreg */
172
tmp = load_reg(s, a->rt);
173
- neon_store_reg32(tmp, a->vm * 2);
174
+ vfp_store_reg32(tmp, a->vm * 2);
175
tcg_temp_free_i32(tmp);
176
tmp = load_reg(s, a->rt2);
177
- neon_store_reg32(tmp, a->vm * 2 + 1);
178
+ vfp_store_reg32(tmp, a->vm * 2 + 1);
179
tcg_temp_free_i32(tmp);
180
}
181
182
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_hp(DisasContext *s, arg_VLDR_VSTR_sp *a)
183
tmp = tcg_temp_new_i32();
184
if (a->l) {
185
gen_aa32_ld16u(s, tmp, addr, get_mem_index(s));
186
- neon_store_reg32(tmp, a->vd);
187
+ vfp_store_reg32(tmp, a->vd);
188
} else {
189
- neon_load_reg32(tmp, a->vd);
190
+ vfp_load_reg32(tmp, a->vd);
191
gen_aa32_st16(s, tmp, addr, get_mem_index(s));
192
}
193
tcg_temp_free_i32(tmp);
194
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a)
195
tmp = tcg_temp_new_i32();
196
if (a->l) {
197
gen_aa32_ld32u(s, tmp, addr, get_mem_index(s));
198
- neon_store_reg32(tmp, a->vd);
199
+ vfp_store_reg32(tmp, a->vd);
200
} else {
201
- neon_load_reg32(tmp, a->vd);
202
+ vfp_load_reg32(tmp, a->vd);
203
gen_aa32_st32(s, tmp, addr, get_mem_index(s));
204
}
205
tcg_temp_free_i32(tmp);
206
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a)
207
if (a->l) {
208
/* load */
209
gen_aa32_ld32u(s, tmp, addr, get_mem_index(s));
210
- neon_store_reg32(tmp, a->vd + i);
211
+ vfp_store_reg32(tmp, a->vd + i);
212
} else {
213
/* store */
214
- neon_load_reg32(tmp, a->vd + i);
215
+ vfp_load_reg32(tmp, a->vd + i);
216
gen_aa32_st32(s, tmp, addr, get_mem_index(s));
217
}
218
tcg_gen_addi_i32(addr, addr, offset);
219
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn,
220
fd = tcg_temp_new_i32();
221
fpst = fpstatus_ptr(FPST_FPCR);
222
223
- neon_load_reg32(f0, vn);
224
- neon_load_reg32(f1, vm);
225
+ vfp_load_reg32(f0, vn);
226
+ vfp_load_reg32(f1, vm);
227
228
for (;;) {
229
if (reads_vd) {
230
- neon_load_reg32(fd, vd);
231
+ vfp_load_reg32(fd, vd);
232
}
233
fn(fd, f0, f1, fpst);
234
- neon_store_reg32(fd, vd);
235
+ vfp_store_reg32(fd, vd);
236
237
if (veclen == 0) {
238
break;
239
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn,
240
veclen--;
241
vd = vfp_advance_sreg(vd, delta_d);
242
vn = vfp_advance_sreg(vn, delta_d);
243
- neon_load_reg32(f0, vn);
244
+ vfp_load_reg32(f0, vn);
245
if (delta_m) {
246
vm = vfp_advance_sreg(vm, delta_m);
247
- neon_load_reg32(f1, vm);
248
+ vfp_load_reg32(f1, vm);
249
}
250
}
251
252
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn,
253
fd = tcg_temp_new_i32();
254
fpst = fpstatus_ptr(FPST_FPCR_F16);
255
256
- neon_load_reg32(f0, vn);
257
- neon_load_reg32(f1, vm);
258
+ vfp_load_reg32(f0, vn);
259
+ vfp_load_reg32(f1, vm);
260
261
if (reads_vd) {
262
- neon_load_reg32(fd, vd);
263
+ vfp_load_reg32(fd, vd);
264
}
265
fn(fd, f0, f1, fpst);
266
- neon_store_reg32(fd, vd);
267
+ vfp_store_reg32(fd, vd);
268
269
tcg_temp_free_i32(f0);
270
tcg_temp_free_i32(f1);
271
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm)
272
f0 = tcg_temp_new_i32();
273
fd = tcg_temp_new_i32();
274
275
- neon_load_reg32(f0, vm);
276
+ vfp_load_reg32(f0, vm);
277
278
for (;;) {
279
fn(fd, f0);
280
- neon_store_reg32(fd, vd);
281
+ vfp_store_reg32(fd, vd);
282
283
if (veclen == 0) {
284
break;
285
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm)
286
/* single source one-many */
287
while (veclen--) {
288
vd = vfp_advance_sreg(vd, delta_d);
289
- neon_store_reg32(fd, vd);
290
+ vfp_store_reg32(fd, vd);
291
}
292
break;
293
}
294
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm)
295
veclen--;
296
vd = vfp_advance_sreg(vd, delta_d);
297
vm = vfp_advance_sreg(vm, delta_m);
298
- neon_load_reg32(f0, vm);
299
+ vfp_load_reg32(f0, vm);
300
}
301
302
tcg_temp_free_i32(f0);
303
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_hp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm)
304
}
305
306
f0 = tcg_temp_new_i32();
307
- neon_load_reg32(f0, vm);
308
+ vfp_load_reg32(f0, vm);
309
fn(f0, f0);
310
- neon_store_reg32(f0, vd);
311
+ vfp_store_reg32(f0, vd);
312
tcg_temp_free_i32(f0);
313
314
return true;
315
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_hp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d)
316
vm = tcg_temp_new_i32();
317
vd = tcg_temp_new_i32();
318
319
- neon_load_reg32(vn, a->vn);
320
- neon_load_reg32(vm, a->vm);
321
+ vfp_load_reg32(vn, a->vn);
322
+ vfp_load_reg32(vm, a->vm);
323
if (neg_n) {
324
/* VFNMS, VFMS */
325
gen_helper_vfp_negh(vn, vn);
326
}
327
- neon_load_reg32(vd, a->vd);
328
+ vfp_load_reg32(vd, a->vd);
329
if (neg_d) {
330
/* VFNMA, VFNMS */
331
gen_helper_vfp_negh(vd, vd);
332
}
333
fpst = fpstatus_ptr(FPST_FPCR_F16);
334
gen_helper_vfp_muladdh(vd, vn, vm, vd, fpst);
335
- neon_store_reg32(vd, a->vd);
336
+ vfp_store_reg32(vd, a->vd);
337
338
tcg_temp_free_ptr(fpst);
339
tcg_temp_free_i32(vn);
340
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d)
341
vm = tcg_temp_new_i32();
342
vd = tcg_temp_new_i32();
343
344
- neon_load_reg32(vn, a->vn);
345
- neon_load_reg32(vm, a->vm);
346
+ vfp_load_reg32(vn, a->vn);
347
+ vfp_load_reg32(vm, a->vm);
348
if (neg_n) {
349
/* VFNMS, VFMS */
350
gen_helper_vfp_negs(vn, vn);
351
}
352
- neon_load_reg32(vd, a->vd);
353
+ vfp_load_reg32(vd, a->vd);
354
if (neg_d) {
355
/* VFNMA, VFNMS */
356
gen_helper_vfp_negs(vd, vd);
357
}
358
fpst = fpstatus_ptr(FPST_FPCR);
359
gen_helper_vfp_muladds(vd, vn, vm, vd, fpst);
360
- neon_store_reg32(vd, a->vd);
361
+ vfp_store_reg32(vd, a->vd);
362
363
tcg_temp_free_ptr(fpst);
364
tcg_temp_free_i32(vn);
365
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a)
366
}
367
368
fd = tcg_const_i32(vfp_expand_imm(MO_16, a->imm));
369
- neon_store_reg32(fd, a->vd);
370
+ vfp_store_reg32(fd, a->vd);
371
tcg_temp_free_i32(fd);
372
return true;
373
}
374
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a)
375
fd = tcg_const_i32(vfp_expand_imm(MO_32, a->imm));
376
377
for (;;) {
378
- neon_store_reg32(fd, vd);
379
+ vfp_store_reg32(fd, vd);
380
381
if (veclen == 0) {
382
break;
383
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_hp(DisasContext *s, arg_VCMP_sp *a)
384
vd = tcg_temp_new_i32();
385
vm = tcg_temp_new_i32();
386
387
- neon_load_reg32(vd, a->vd);
388
+ vfp_load_reg32(vd, a->vd);
389
if (a->z) {
390
tcg_gen_movi_i32(vm, 0);
391
} else {
392
- neon_load_reg32(vm, a->vm);
393
+ vfp_load_reg32(vm, a->vm);
394
}
395
396
if (a->e) {
397
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a)
398
vd = tcg_temp_new_i32();
399
vm = tcg_temp_new_i32();
400
401
- neon_load_reg32(vd, a->vd);
402
+ vfp_load_reg32(vd, a->vd);
403
if (a->z) {
404
tcg_gen_movi_i32(vm, 0);
405
} else {
406
- neon_load_reg32(vm, a->vm);
407
+ vfp_load_reg32(vm, a->vm);
408
}
409
410
if (a->e) {
411
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f32_f16(DisasContext *s, arg_VCVT_f32_f16 *a)
412
/* The T bit tells us if we want the low or high 16 bits of Vm */
413
tcg_gen_ld16u_i32(tmp, cpu_env, vfp_f16_offset(a->vm, a->t));
414
gen_helper_vfp_fcvt_f16_to_f32(tmp, tmp, fpst, ahp_mode);
415
- neon_store_reg32(tmp, a->vd);
416
+ vfp_store_reg32(tmp, a->vd);
417
tcg_temp_free_i32(ahp_mode);
418
tcg_temp_free_ptr(fpst);
419
tcg_temp_free_i32(tmp);
420
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a)
421
ahp_mode = get_ahp_flag();
422
tmp = tcg_temp_new_i32();
423
424
- neon_load_reg32(tmp, a->vm);
425
+ vfp_load_reg32(tmp, a->vm);
426
gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp_mode);
427
tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t));
428
tcg_temp_free_i32(ahp_mode);
429
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_hp(DisasContext *s, arg_VRINTR_sp *a)
430
}
431
432
tmp = tcg_temp_new_i32();
433
- neon_load_reg32(tmp, a->vm);
434
+ vfp_load_reg32(tmp, a->vm);
435
fpst = fpstatus_ptr(FPST_FPCR_F16);
436
gen_helper_rinth(tmp, tmp, fpst);
437
- neon_store_reg32(tmp, a->vd);
438
+ vfp_store_reg32(tmp, a->vd);
439
tcg_temp_free_ptr(fpst);
440
tcg_temp_free_i32(tmp);
441
return true;
442
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_sp(DisasContext *s, arg_VRINTR_sp *a)
443
}
444
445
tmp = tcg_temp_new_i32();
446
- neon_load_reg32(tmp, a->vm);
447
+ vfp_load_reg32(tmp, a->vm);
448
fpst = fpstatus_ptr(FPST_FPCR);
449
gen_helper_rints(tmp, tmp, fpst);
450
- neon_store_reg32(tmp, a->vd);
451
+ vfp_store_reg32(tmp, a->vd);
452
tcg_temp_free_ptr(fpst);
453
tcg_temp_free_i32(tmp);
454
return true;
455
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_hp(DisasContext *s, arg_VRINTZ_sp *a)
456
}
457
458
tmp = tcg_temp_new_i32();
459
- neon_load_reg32(tmp, a->vm);
460
+ vfp_load_reg32(tmp, a->vm);
461
fpst = fpstatus_ptr(FPST_FPCR_F16);
462
tcg_rmode = tcg_const_i32(float_round_to_zero);
463
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
464
gen_helper_rinth(tmp, tmp, fpst);
465
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
466
- neon_store_reg32(tmp, a->vd);
467
+ vfp_store_reg32(tmp, a->vd);
468
tcg_temp_free_ptr(fpst);
469
tcg_temp_free_i32(tcg_rmode);
470
tcg_temp_free_i32(tmp);
471
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_sp(DisasContext *s, arg_VRINTZ_sp *a)
472
}
473
474
tmp = tcg_temp_new_i32();
475
- neon_load_reg32(tmp, a->vm);
476
+ vfp_load_reg32(tmp, a->vm);
477
fpst = fpstatus_ptr(FPST_FPCR);
478
tcg_rmode = tcg_const_i32(float_round_to_zero);
479
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
480
gen_helper_rints(tmp, tmp, fpst);
481
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
482
- neon_store_reg32(tmp, a->vd);
483
+ vfp_store_reg32(tmp, a->vd);
484
tcg_temp_free_ptr(fpst);
485
tcg_temp_free_i32(tcg_rmode);
486
tcg_temp_free_i32(tmp);
487
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_hp(DisasContext *s, arg_VRINTX_sp *a)
488
}
489
490
tmp = tcg_temp_new_i32();
491
- neon_load_reg32(tmp, a->vm);
492
+ vfp_load_reg32(tmp, a->vm);
493
fpst = fpstatus_ptr(FPST_FPCR_F16);
494
gen_helper_rinth_exact(tmp, tmp, fpst);
495
- neon_store_reg32(tmp, a->vd);
496
+ vfp_store_reg32(tmp, a->vd);
497
tcg_temp_free_ptr(fpst);
498
tcg_temp_free_i32(tmp);
499
return true;
500
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_sp(DisasContext *s, arg_VRINTX_sp *a)
501
}
502
503
tmp = tcg_temp_new_i32();
504
- neon_load_reg32(tmp, a->vm);
505
+ vfp_load_reg32(tmp, a->vm);
506
fpst = fpstatus_ptr(FPST_FPCR);
507
gen_helper_rints_exact(tmp, tmp, fpst);
508
- neon_store_reg32(tmp, a->vd);
509
+ vfp_store_reg32(tmp, a->vd);
510
tcg_temp_free_ptr(fpst);
511
tcg_temp_free_i32(tmp);
512
return true;
513
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a)
514
515
vm = tcg_temp_new_i32();
516
vd = tcg_temp_new_i64();
517
- neon_load_reg32(vm, a->vm);
518
+ vfp_load_reg32(vm, a->vm);
519
gen_helper_vfp_fcvtds(vd, vm, cpu_env);
520
neon_store_reg64(vd, a->vd);
521
tcg_temp_free_i32(vm);
522
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a)
523
vm = tcg_temp_new_i64();
524
neon_load_reg64(vm, a->vm);
525
gen_helper_vfp_fcvtsd(vd, vm, cpu_env);
526
- neon_store_reg32(vd, a->vd);
527
+ vfp_store_reg32(vd, a->vd);
528
tcg_temp_free_i32(vd);
529
tcg_temp_free_i64(vm);
530
return true;
531
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a)
532
}
533
534
vm = tcg_temp_new_i32();
535
- neon_load_reg32(vm, a->vm);
536
+ vfp_load_reg32(vm, a->vm);
537
fpst = fpstatus_ptr(FPST_FPCR_F16);
538
if (a->s) {
539
/* i32 -> f16 */
540
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a)
541
/* u32 -> f16 */
542
gen_helper_vfp_uitoh(vm, vm, fpst);
543
}
544
- neon_store_reg32(vm, a->vd);
545
+ vfp_store_reg32(vm, a->vd);
546
tcg_temp_free_i32(vm);
547
tcg_temp_free_ptr(fpst);
548
return true;
549
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a)
550
}
551
552
vm = tcg_temp_new_i32();
553
- neon_load_reg32(vm, a->vm);
554
+ vfp_load_reg32(vm, a->vm);
555
fpst = fpstatus_ptr(FPST_FPCR);
556
if (a->s) {
557
/* i32 -> f32 */
558
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a)
559
/* u32 -> f32 */
560
gen_helper_vfp_uitos(vm, vm, fpst);
561
}
562
- neon_store_reg32(vm, a->vd);
563
+ vfp_store_reg32(vm, a->vd);
564
tcg_temp_free_i32(vm);
565
tcg_temp_free_ptr(fpst);
566
return true;
567
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a)
568
569
vm = tcg_temp_new_i32();
570
vd = tcg_temp_new_i64();
571
- neon_load_reg32(vm, a->vm);
572
+ vfp_load_reg32(vm, a->vm);
573
fpst = fpstatus_ptr(FPST_FPCR);
574
if (a->s) {
575
/* i32 -> f64 */
576
@@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a)
577
vd = tcg_temp_new_i32();
578
neon_load_reg64(vm, a->vm);
579
gen_helper_vjcvt(vd, vm, cpu_env);
580
- neon_store_reg32(vd, a->vd);
581
+ vfp_store_reg32(vd, a->vd);
582
tcg_temp_free_i64(vm);
583
tcg_temp_free_i32(vd);
584
return true;
585
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a)
586
frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm);
587
588
vd = tcg_temp_new_i32();
589
- neon_load_reg32(vd, a->vd);
590
+ vfp_load_reg32(vd, a->vd);
591
592
fpst = fpstatus_ptr(FPST_FPCR_F16);
593
shift = tcg_const_i32(frac_bits);
594
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a)
595
g_assert_not_reached();
596
}
597
598
- neon_store_reg32(vd, a->vd);
599
+ vfp_store_reg32(vd, a->vd);
600
tcg_temp_free_i32(vd);
601
tcg_temp_free_i32(shift);
602
tcg_temp_free_ptr(fpst);
603
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
604
frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm);
605
606
vd = tcg_temp_new_i32();
607
- neon_load_reg32(vd, a->vd);
608
+ vfp_load_reg32(vd, a->vd);
609
610
fpst = fpstatus_ptr(FPST_FPCR);
611
shift = tcg_const_i32(frac_bits);
612
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
613
g_assert_not_reached();
614
}
615
616
- neon_store_reg32(vd, a->vd);
617
+ vfp_store_reg32(vd, a->vd);
618
tcg_temp_free_i32(vd);
619
tcg_temp_free_i32(shift);
620
tcg_temp_free_ptr(fpst);
621
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a)
622
623
fpst = fpstatus_ptr(FPST_FPCR_F16);
624
vm = tcg_temp_new_i32();
625
- neon_load_reg32(vm, a->vm);
626
+ vfp_load_reg32(vm, a->vm);
627
628
if (a->s) {
629
if (a->rz) {
630
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a)
631
gen_helper_vfp_touih(vm, vm, fpst);
632
}
633
}
634
- neon_store_reg32(vm, a->vd);
635
+ vfp_store_reg32(vm, a->vd);
636
tcg_temp_free_i32(vm);
637
tcg_temp_free_ptr(fpst);
638
return true;
639
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a)
640
641
fpst = fpstatus_ptr(FPST_FPCR);
642
vm = tcg_temp_new_i32();
643
- neon_load_reg32(vm, a->vm);
644
+ vfp_load_reg32(vm, a->vm);
645
646
if (a->s) {
647
if (a->rz) {
648
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a)
649
gen_helper_vfp_touis(vm, vm, fpst);
650
}
651
}
652
- neon_store_reg32(vm, a->vd);
653
+ vfp_store_reg32(vm, a->vd);
654
tcg_temp_free_i32(vm);
655
tcg_temp_free_ptr(fpst);
656
return true;
657
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
658
gen_helper_vfp_touid(vd, vm, fpst);
659
}
660
}
661
- neon_store_reg32(vd, a->vd);
662
+ vfp_store_reg32(vd, a->vd);
663
tcg_temp_free_i32(vd);
664
tcg_temp_free_i64(vm);
665
tcg_temp_free_ptr(fpst);
666
@@ -XXX,XX +XXX,XX @@ static bool trans_VINS(DisasContext *s, arg_VINS *a)
667
/* Insert low half of Vm into high half of Vd */
668
rm = tcg_temp_new_i32();
669
rd = tcg_temp_new_i32();
670
- neon_load_reg32(rm, a->vm);
671
- neon_load_reg32(rd, a->vd);
672
+ vfp_load_reg32(rm, a->vm);
673
+ vfp_load_reg32(rd, a->vd);
674
tcg_gen_deposit_i32(rd, rd, rm, 16, 16);
675
- neon_store_reg32(rd, a->vd);
676
+ vfp_store_reg32(rd, a->vd);
677
tcg_temp_free_i32(rm);
678
tcg_temp_free_i32(rd);
679
return true;
680
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOVX(DisasContext *s, arg_VINS *a)
681
682
/* Set Vd to high half of Vm */
683
rm = tcg_temp_new_i32();
684
- neon_load_reg32(rm, a->vm);
685
+ vfp_load_reg32(rm, a->vm);
686
tcg_gen_shri_i32(rm, rm, 16);
687
- neon_store_reg32(rm, a->vd);
688
+ vfp_store_reg32(rm, a->vd);
689
tcg_temp_free_i32(rm);
690
return true;
691
}
43
--
692
--
44
2.20.1
693
2.20.1
45
694
46
695
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Implement full support for the watchdog in i.MX systems.
3
Replace all uses of neon_load/store_reg64 within translate-neon.c.inc.
4
Pretimeout support is optional because the watchdog hardware
4
5
on i.MX31 does not support pretimeouts.
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
6
Message-id: 20201030022618.785675-9-richard.henderson@linaro.org
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20200517162135.110364-3-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
---
9
---
12
include/hw/watchdog/wdt_imx2.h | 61 ++++++++-
10
target/arm/translate.c | 26 +++++++++
13
hw/watchdog/wdt_imx2.c | 239 +++++++++++++++++++++++++++++++--
11
target/arm/translate-neon.c.inc | 94 ++++++++++++++++-----------------
14
2 files changed, 285 insertions(+), 15 deletions(-)
12
2 files changed, 73 insertions(+), 47 deletions(-)
15
13
16
diff --git a/include/hw/watchdog/wdt_imx2.h b/include/hw/watchdog/wdt_imx2.h
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/watchdog/wdt_imx2.h
16
--- a/target/arm/translate.c
19
+++ b/include/hw/watchdog/wdt_imx2.h
17
+++ b/target/arm/translate.c
20
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
21
#ifndef IMX2_WDT_H
19
}
22
#define IMX2_WDT_H
20
}
23
21
24
+#include "qemu/bitops.h"
22
+static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
25
#include "hw/sysbus.h"
23
+{
26
+#include "hw/irq.h"
24
+ long off = neon_element_offset(reg, ele, memop);
27
+#include "hw/ptimer.h"
28
29
#define TYPE_IMX2_WDT "imx2.wdt"
30
#define IMX2_WDT(obj) OBJECT_CHECK(IMX2WdtState, (obj), TYPE_IMX2_WDT)
31
32
enum IMX2WdtRegisters {
33
- IMX2_WDT_WCR = 0x0000,
34
- IMX2_WDT_REG_NUM = 0x0008 / sizeof(uint16_t) + 1,
35
+ IMX2_WDT_WCR = 0x0000, /* Control Register */
36
+ IMX2_WDT_WSR = 0x0002, /* Service Register */
37
+ IMX2_WDT_WRSR = 0x0004, /* Reset Status Register */
38
+ IMX2_WDT_WICR = 0x0006, /* Interrupt Control Register */
39
+ IMX2_WDT_WMCR = 0x0008, /* Misc Register */
40
};
41
42
+#define IMX2_WDT_MMIO_SIZE 0x000a
43
+
25
+
44
+/* Control Register definitions */
26
+ switch (memop) {
45
+#define IMX2_WDT_WCR_WT (0xFF << 8) /* Watchdog Timeout Field */
27
+ case MO_Q:
46
+#define IMX2_WDT_WCR_WDW BIT(7) /* WDOG Disable for Wait */
28
+ tcg_gen_ld_i64(dest, cpu_env, off);
47
+#define IMX2_WDT_WCR_WDA BIT(5) /* WDOG Assertion */
29
+ break;
48
+#define IMX2_WDT_WCR_SRS BIT(4) /* Software Reset Signal */
30
+ default:
49
+#define IMX2_WDT_WCR_WDT BIT(3) /* WDOG Timeout Assertion */
31
+ g_assert_not_reached();
50
+#define IMX2_WDT_WCR_WDE BIT(2) /* Watchdog Enable */
51
+#define IMX2_WDT_WCR_WDBG BIT(1) /* Watchdog Debug Enable */
52
+#define IMX2_WDT_WCR_WDZST BIT(0) /* Watchdog Timer Suspend */
53
+
54
+#define IMX2_WDT_WCR_LOCK_MASK (IMX2_WDT_WCR_WDZST | IMX2_WDT_WCR_WDBG \
55
+ | IMX2_WDT_WCR_WDW)
56
+
57
+/* Service Register definitions */
58
+#define IMX2_WDT_SEQ1 0x5555 /* service sequence 1 */
59
+#define IMX2_WDT_SEQ2 0xAAAA /* service sequence 2 */
60
+
61
+/* Reset Status Register definitions */
62
+#define IMX2_WDT_WRSR_TOUT BIT(1) /* Reset due to Timeout */
63
+#define IMX2_WDT_WRSR_SFTW BIT(0) /* Reset due to software reset */
64
+
65
+/* Interrupt Control Register definitions */
66
+#define IMX2_WDT_WICR_WIE BIT(15) /* Interrupt Enable */
67
+#define IMX2_WDT_WICR_WTIS BIT(14) /* Interrupt Status */
68
+#define IMX2_WDT_WICR_WICT 0xff /* Interrupt Timeout */
69
+#define IMX2_WDT_WICR_WICT_DEF 0x04 /* Default interrupt timeout (2s) */
70
+
71
+#define IMX2_WDT_WICR_LOCK_MASK (IMX2_WDT_WICR_WIE | IMX2_WDT_WICR_WICT)
72
+
73
+/* Misc Control Register definitions */
74
+#define IMX2_WDT_WMCR_PDE BIT(0) /* Power-Down Enable */
75
76
typedef struct IMX2WdtState {
77
/* <private> */
78
SysBusDevice parent_obj;
79
80
+ /*< public >*/
81
MemoryRegion mmio;
82
+ qemu_irq irq;
83
+
84
+ struct ptimer_state *timer;
85
+ struct ptimer_state *itimer;
86
+
87
+ bool pretimeout_support;
88
+ bool wicr_locked;
89
+
90
+ uint16_t wcr;
91
+ uint16_t wsr;
92
+ uint16_t wrsr;
93
+ uint16_t wicr;
94
+ uint16_t wmcr;
95
+
96
+ bool wcr_locked; /* affects WDZST, WDBG, and WDW */
97
+ bool wcr_wde_locked; /* affects WDE */
98
+ bool wcr_wdt_locked; /* affects WDT (never cleared) */
99
} IMX2WdtState;
100
101
#endif /* IMX2_WDT_H */
102
diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c
103
index XXXXXXX..XXXXXXX 100644
104
--- a/hw/watchdog/wdt_imx2.c
105
+++ b/hw/watchdog/wdt_imx2.c
106
@@ -XXX,XX +XXX,XX @@
107
#include "qemu/bitops.h"
108
#include "qemu/module.h"
109
#include "sysemu/watchdog.h"
110
+#include "migration/vmstate.h"
111
+#include "hw/qdev-properties.h"
112
113
#include "hw/watchdog/wdt_imx2.h"
114
115
-#define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset WDOG_B */
116
-#define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset Signal */
117
-
118
-static uint64_t imx2_wdt_read(void *opaque, hwaddr addr,
119
- unsigned int size)
120
+static void imx2_wdt_interrupt(void *opaque)
121
{
122
+ IMX2WdtState *s = IMX2_WDT(opaque);
123
+
124
+ s->wicr |= IMX2_WDT_WICR_WTIS;
125
+ qemu_set_irq(s->irq, 1);
126
+}
127
+
128
+static void imx2_wdt_expired(void *opaque)
129
+{
130
+ IMX2WdtState *s = IMX2_WDT(opaque);
131
+
132
+ s->wrsr = IMX2_WDT_WRSR_TOUT;
133
+
134
+ /* Perform watchdog action if watchdog is enabled */
135
+ if (s->wcr & IMX2_WDT_WCR_WDE) {
136
+ s->wrsr = IMX2_WDT_WRSR_TOUT;
137
+ watchdog_perform_action();
138
+ }
32
+ }
139
+}
33
+}
140
+
34
+
141
+static void imx2_wdt_reset(DeviceState *dev)
35
static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
36
{
37
long off = neon_element_offset(reg, ele, memop);
38
@@ -XXX,XX +XXX,XX @@ static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
39
}
40
}
41
42
+static void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
142
+{
43
+{
143
+ IMX2WdtState *s = IMX2_WDT(dev);
44
+ long off = neon_element_offset(reg, ele, memop);
144
+
45
+
145
+ ptimer_transaction_begin(s->timer);
46
+ switch (memop) {
146
+ ptimer_stop(s->timer);
47
+ case MO_64:
147
+ ptimer_transaction_commit(s->timer);
48
+ tcg_gen_st_i64(src, cpu_env, off);
148
+
49
+ break;
149
+ if (s->pretimeout_support) {
50
+ default:
150
+ ptimer_transaction_begin(s->itimer);
51
+ g_assert_not_reached();
151
+ ptimer_stop(s->itimer);
152
+ ptimer_transaction_commit(s->itimer);
153
+ }
154
+
155
+ s->wicr_locked = false;
156
+ s->wcr_locked = false;
157
+ s->wcr_wde_locked = false;
158
+
159
+ s->wcr = IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS;
160
+ s->wsr = 0;
161
+ s->wrsr &= ~(IMX2_WDT_WRSR_TOUT | IMX2_WDT_WRSR_SFTW);
162
+ s->wicr = IMX2_WDT_WICR_WICT_DEF;
163
+ s->wmcr = IMX2_WDT_WMCR_PDE;
164
+}
165
+
166
+static uint64_t imx2_wdt_read(void *opaque, hwaddr addr, unsigned int size)
167
+{
168
+ IMX2WdtState *s = IMX2_WDT(opaque);
169
+
170
+ switch (addr) {
171
+ case IMX2_WDT_WCR:
172
+ return s->wcr;
173
+ case IMX2_WDT_WSR:
174
+ return s->wsr;
175
+ case IMX2_WDT_WRSR:
176
+ return s->wrsr;
177
+ case IMX2_WDT_WICR:
178
+ return s->wicr;
179
+ case IMX2_WDT_WMCR:
180
+ return s->wmcr;
181
+ }
182
return 0;
183
}
184
185
+static void imx_wdt2_update_itimer(IMX2WdtState *s, bool start)
186
+{
187
+ bool running = (s->wcr & IMX2_WDT_WCR_WDE) && (s->wcr & IMX2_WDT_WCR_WT);
188
+ bool enabled = s->wicr & IMX2_WDT_WICR_WIE;
189
+
190
+ ptimer_transaction_begin(s->itimer);
191
+ if (start || !enabled) {
192
+ ptimer_stop(s->itimer);
193
+ }
194
+ if (running && enabled) {
195
+ int count = ptimer_get_count(s->timer);
196
+ int pretimeout = s->wicr & IMX2_WDT_WICR_WICT;
197
+
198
+ /*
199
+ * Only (re-)start pretimeout timer if its counter value is larger
200
+ * than 0. Otherwise it will fire right away and we'll get an
201
+ * interrupt loop.
202
+ */
203
+ if (count > pretimeout) {
204
+ ptimer_set_count(s->itimer, count - pretimeout);
205
+ if (start) {
206
+ ptimer_run(s->itimer, 1);
207
+ }
208
+ }
209
+ }
210
+ ptimer_transaction_commit(s->itimer);
211
+}
212
+
213
+static void imx_wdt2_update_timer(IMX2WdtState *s, bool start)
214
+{
215
+ ptimer_transaction_begin(s->timer);
216
+ if (start) {
217
+ ptimer_stop(s->timer);
218
+ }
219
+ if ((s->wcr & IMX2_WDT_WCR_WDE) && (s->wcr & IMX2_WDT_WCR_WT)) {
220
+ int count = (s->wcr & IMX2_WDT_WCR_WT) >> 8;
221
+
222
+ /* A value of 0 reflects one period (0.5s). */
223
+ ptimer_set_count(s->timer, count + 1);
224
+ if (start) {
225
+ ptimer_run(s->timer, 1);
226
+ }
227
+ }
228
+ ptimer_transaction_commit(s->timer);
229
+ if (s->pretimeout_support) {
230
+ imx_wdt2_update_itimer(s, start);
231
+ }
52
+ }
232
+}
53
+}
233
+
54
+
234
static void imx2_wdt_write(void *opaque, hwaddr addr,
55
static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
235
uint64_t value, unsigned int size)
236
{
56
{
237
- if (addr == IMX2_WDT_WCR &&
57
TCGv_ptr ret = tcg_temp_new_ptr();
238
- (~value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS))) {
58
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
239
- watchdog_perform_action();
59
index XXXXXXX..XXXXXXX 100644
240
+ IMX2WdtState *s = IMX2_WDT(opaque);
60
--- a/target/arm/translate-neon.c.inc
241
+
61
+++ b/target/arm/translate-neon.c.inc
242
+ switch (addr) {
62
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a,
243
+ case IMX2_WDT_WCR:
63
for (pass = 0; pass < a->q + 1; pass++) {
244
+ if (s->wcr_locked) {
64
TCGv_i64 tmp = tcg_temp_new_i64();
245
+ value &= ~IMX2_WDT_WCR_LOCK_MASK;
65
246
+ value |= (s->wicr & IMX2_WDT_WCR_LOCK_MASK);
66
- neon_load_reg64(tmp, a->vm + pass);
247
+ }
67
+ read_neon_element64(tmp, a->vm, pass, MO_64);
248
+ s->wcr_locked = true;
68
fn(tmp, cpu_env, tmp, constimm);
249
+ if (s->wcr_wde_locked) {
69
- neon_store_reg64(tmp, a->vd + pass);
250
+ value &= ~IMX2_WDT_WCR_WDE;
70
+ write_neon_element64(tmp, a->vd, pass, MO_64);
251
+ value |= (s->wicr & ~IMX2_WDT_WCR_WDE);
71
tcg_temp_free_i64(tmp);
252
+ } else if (value & IMX2_WDT_WCR_WDE) {
72
}
253
+ s->wcr_wde_locked = true;
73
tcg_temp_free_i64(constimm);
254
+ }
74
@@ -XXX,XX +XXX,XX @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a,
255
+ if (s->wcr_wdt_locked) {
75
rd = tcg_temp_new_i32();
256
+ value &= ~IMX2_WDT_WCR_WDT;
76
257
+ value |= (s->wicr & ~IMX2_WDT_WCR_WDT);
77
/* Load both inputs first to avoid potential overwrite if rm == rd */
258
+ } else if (value & IMX2_WDT_WCR_WDT) {
78
- neon_load_reg64(rm1, a->vm);
259
+ s->wcr_wdt_locked = true;
79
- neon_load_reg64(rm2, a->vm + 1);
260
+ }
80
+ read_neon_element64(rm1, a->vm, 0, MO_64);
261
+
81
+ read_neon_element64(rm2, a->vm, 1, MO_64);
262
+ s->wcr = value;
82
263
+ if (!(value & IMX2_WDT_WCR_SRS)) {
83
shiftfn(rm1, rm1, constimm);
264
+ s->wrsr = IMX2_WDT_WRSR_SFTW;
84
narrowfn(rd, cpu_env, rm1);
265
+ }
85
@@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a,
266
+ if (!(value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS)) ||
86
tcg_gen_shli_i64(tmp, tmp, a->shift);
267
+ (!(value & IMX2_WDT_WCR_WT) && (value & IMX2_WDT_WCR_WDE))) {
87
tcg_gen_andi_i64(tmp, tmp, ~widen_mask);
268
+ watchdog_perform_action();
88
}
269
+ }
89
- neon_store_reg64(tmp, a->vd);
270
+ s->wcr |= IMX2_WDT_WCR_SRS;
90
+ write_neon_element64(tmp, a->vd, 0, MO_64);
271
+ imx_wdt2_update_timer(s, true);
91
272
+ break;
92
widenfn(tmp, rm1);
273
+ case IMX2_WDT_WSR:
93
tcg_temp_free_i32(rm1);
274
+ if (s->wsr == IMX2_WDT_SEQ1 && value == IMX2_WDT_SEQ2) {
94
@@ -XXX,XX +XXX,XX @@ static bool do_vshll_2sh(DisasContext *s, arg_2reg_shift *a,
275
+ imx_wdt2_update_timer(s, false);
95
tcg_gen_shli_i64(tmp, tmp, a->shift);
276
+ }
96
tcg_gen_andi_i64(tmp, tmp, ~widen_mask);
277
+ s->wsr = value;
97
}
278
+ break;
98
- neon_store_reg64(tmp, a->vd + 1);
279
+ case IMX2_WDT_WRSR:
99
+ write_neon_element64(tmp, a->vd, 1, MO_64);
280
+ break;
100
tcg_temp_free_i64(tmp);
281
+ case IMX2_WDT_WICR:
101
return true;
282
+ if (!s->pretimeout_support) {
283
+ return;
284
+ }
285
+ value &= IMX2_WDT_WICR_LOCK_MASK | IMX2_WDT_WICR_WTIS;
286
+ if (s->wicr_locked) {
287
+ value &= IMX2_WDT_WICR_WTIS;
288
+ value |= (s->wicr & IMX2_WDT_WICR_LOCK_MASK);
289
+ }
290
+ s->wicr = value | (s->wicr & IMX2_WDT_WICR_WTIS);
291
+ if (value & IMX2_WDT_WICR_WTIS) {
292
+ s->wicr &= ~IMX2_WDT_WICR_WTIS;
293
+ qemu_set_irq(s->irq, 0);
294
+ }
295
+ imx_wdt2_update_itimer(s, true);
296
+ s->wicr_locked = true;
297
+ break;
298
+ case IMX2_WDT_WMCR:
299
+ s->wmcr = value & IMX2_WDT_WMCR_PDE;
300
+ break;
301
}
302
}
102
}
303
103
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
304
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps imx2_wdt_ops = {
104
rm_64 = tcg_temp_new_i64();
305
* real device but in practice there is no reason for a guest
105
306
* to access this device unaligned.
106
if (src1_wide) {
307
*/
107
- neon_load_reg64(rn0_64, a->vn);
308
- .min_access_size = 4,
108
+ read_neon_element64(rn0_64, a->vn, 0, MO_64);
309
- .max_access_size = 4,
109
} else {
310
+ .min_access_size = 2,
110
TCGv_i32 tmp = tcg_temp_new_i32();
311
+ .max_access_size = 2,
111
read_neon_element32(tmp, a->vn, 0, MO_32);
312
.unaligned = false,
112
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
313
},
113
* avoid incorrect results if a narrow input overlaps with the result.
314
};
114
*/
315
115
if (src1_wide) {
316
+static const VMStateDescription vmstate_imx2_wdt = {
116
- neon_load_reg64(rn1_64, a->vn + 1);
317
+ .name = "imx2.wdt",
117
+ read_neon_element64(rn1_64, a->vn, 1, MO_64);
318
+ .fields = (VMStateField[]) {
118
} else {
319
+ VMSTATE_PTIMER(timer, IMX2WdtState),
119
TCGv_i32 tmp = tcg_temp_new_i32();
320
+ VMSTATE_PTIMER(itimer, IMX2WdtState),
120
read_neon_element32(tmp, a->vn, 1, MO_32);
321
+ VMSTATE_BOOL(wicr_locked, IMX2WdtState),
121
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
322
+ VMSTATE_BOOL(wcr_locked, IMX2WdtState),
122
rm = tcg_temp_new_i32();
323
+ VMSTATE_BOOL(wcr_wde_locked, IMX2WdtState),
123
read_neon_element32(rm, a->vm, 1, MO_32);
324
+ VMSTATE_BOOL(wcr_wdt_locked, IMX2WdtState),
124
325
+ VMSTATE_UINT16(wcr, IMX2WdtState),
125
- neon_store_reg64(rn0_64, a->vd);
326
+ VMSTATE_UINT16(wsr, IMX2WdtState),
126
+ write_neon_element64(rn0_64, a->vd, 0, MO_64);
327
+ VMSTATE_UINT16(wrsr, IMX2WdtState),
127
328
+ VMSTATE_UINT16(wmcr, IMX2WdtState),
128
widenfn(rm_64, rm);
329
+ VMSTATE_UINT16(wicr, IMX2WdtState),
129
tcg_temp_free_i32(rm);
330
+ VMSTATE_END_OF_LIST()
130
opfn(rn1_64, rn1_64, rm_64);
331
+ }
131
- neon_store_reg64(rn1_64, a->vd + 1);
332
+};
132
+ write_neon_element64(rn1_64, a->vd, 1, MO_64);
333
+
133
334
static void imx2_wdt_realize(DeviceState *dev, Error **errp)
134
tcg_temp_free_i64(rn0_64);
335
{
135
tcg_temp_free_i64(rn1_64);
336
IMX2WdtState *s = IMX2_WDT(dev);
136
@@ -XXX,XX +XXX,XX @@ static bool do_narrow_3d(DisasContext *s, arg_3diff *a,
337
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
137
rd0 = tcg_temp_new_i32();
338
138
rd1 = tcg_temp_new_i32();
339
memory_region_init_io(&s->mmio, OBJECT(dev),
139
340
&imx2_wdt_ops, s,
140
- neon_load_reg64(rn_64, a->vn);
341
- TYPE_IMX2_WDT".mmio",
141
- neon_load_reg64(rm_64, a->vm);
342
- IMX2_WDT_REG_NUM * sizeof(uint16_t));
142
+ read_neon_element64(rn_64, a->vn, 0, MO_64);
343
- sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
143
+ read_neon_element64(rm_64, a->vm, 0, MO_64);
344
+ TYPE_IMX2_WDT,
144
345
+ IMX2_WDT_MMIO_SIZE);
145
opfn(rn_64, rn_64, rm_64);
346
+ sysbus_init_mmio(sbd, &s->mmio);
146
347
+ sysbus_init_irq(sbd, &s->irq);
147
narrowfn(rd0, rn_64);
348
+
148
349
+ s->timer = ptimer_init(imx2_wdt_expired, s,
149
- neon_load_reg64(rn_64, a->vn + 1);
350
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
150
- neon_load_reg64(rm_64, a->vm + 1);
351
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
151
+ read_neon_element64(rn_64, a->vn, 1, MO_64);
352
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
152
+ read_neon_element64(rm_64, a->vm, 1, MO_64);
353
+ ptimer_transaction_begin(s->timer);
153
354
+ ptimer_set_freq(s->timer, 2);
154
opfn(rn_64, rn_64, rm_64);
355
+ ptimer_set_limit(s->timer, 0xff, 1);
155
356
+ ptimer_transaction_commit(s->timer);
156
@@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a,
357
+ if (s->pretimeout_support) {
157
/* Don't store results until after all loads: they might overlap */
358
+ s->itimer = ptimer_init(imx2_wdt_interrupt, s,
158
if (accfn) {
359
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
159
tmp = tcg_temp_new_i64();
360
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
160
- neon_load_reg64(tmp, a->vd);
361
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
161
+ read_neon_element64(tmp, a->vd, 0, MO_64);
362
+ ptimer_transaction_begin(s->itimer);
162
accfn(tmp, tmp, rd0);
363
+ ptimer_set_freq(s->itimer, 2);
163
- neon_store_reg64(tmp, a->vd);
364
+ ptimer_set_limit(s->itimer, 0xff, 1);
164
- neon_load_reg64(tmp, a->vd + 1);
365
+ ptimer_transaction_commit(s->itimer);
165
+ write_neon_element64(tmp, a->vd, 0, MO_64);
366
+ }
166
+ read_neon_element64(tmp, a->vd, 1, MO_64);
367
}
167
accfn(tmp, tmp, rd1);
368
168
- neon_store_reg64(tmp, a->vd + 1);
369
+static Property imx2_wdt_properties[] = {
169
+ write_neon_element64(tmp, a->vd, 1, MO_64);
370
+ DEFINE_PROP_BOOL("pretimeout-support", IMX2WdtState, pretimeout_support,
170
tcg_temp_free_i64(tmp);
371
+ false),
171
} else {
372
+};
172
- neon_store_reg64(rd0, a->vd);
373
+
173
- neon_store_reg64(rd1, a->vd + 1);
374
static void imx2_wdt_class_init(ObjectClass *klass, void *data)
174
+ write_neon_element64(rd0, a->vd, 0, MO_64);
375
{
175
+ write_neon_element64(rd1, a->vd, 1, MO_64);
376
DeviceClass *dc = DEVICE_CLASS(klass);
176
}
377
177
378
+ device_class_set_props(dc, imx2_wdt_properties);
178
tcg_temp_free_i64(rd0);
379
dc->realize = imx2_wdt_realize;
179
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a,
380
+ dc->reset = imx2_wdt_reset;
180
381
+ dc->vmsd = &vmstate_imx2_wdt;
181
if (accfn) {
382
+ dc->desc = "i.MX watchdog timer";
182
TCGv_i64 t64 = tcg_temp_new_i64();
383
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
183
- neon_load_reg64(t64, a->vd);
384
}
184
+ read_neon_element64(t64, a->vd, 0, MO_64);
385
185
accfn(t64, t64, rn0_64);
186
- neon_store_reg64(t64, a->vd);
187
- neon_load_reg64(t64, a->vd + 1);
188
+ write_neon_element64(t64, a->vd, 0, MO_64);
189
+ read_neon_element64(t64, a->vd, 1, MO_64);
190
accfn(t64, t64, rn1_64);
191
- neon_store_reg64(t64, a->vd + 1);
192
+ write_neon_element64(t64, a->vd, 1, MO_64);
193
tcg_temp_free_i64(t64);
194
} else {
195
- neon_store_reg64(rn0_64, a->vd);
196
- neon_store_reg64(rn1_64, a->vd + 1);
197
+ write_neon_element64(rn0_64, a->vd, 0, MO_64);
198
+ write_neon_element64(rn1_64, a->vd, 1, MO_64);
199
}
200
tcg_temp_free_i64(rn0_64);
201
tcg_temp_free_i64(rn1_64);
202
@@ -XXX,XX +XXX,XX @@ static bool trans_VEXT(DisasContext *s, arg_VEXT *a)
203
right = tcg_temp_new_i64();
204
dest = tcg_temp_new_i64();
205
206
- neon_load_reg64(right, a->vn);
207
- neon_load_reg64(left, a->vm);
208
+ read_neon_element64(right, a->vn, 0, MO_64);
209
+ read_neon_element64(left, a->vm, 0, MO_64);
210
tcg_gen_extract2_i64(dest, right, left, a->imm * 8);
211
- neon_store_reg64(dest, a->vd);
212
+ write_neon_element64(dest, a->vd, 0, MO_64);
213
214
tcg_temp_free_i64(left);
215
tcg_temp_free_i64(right);
216
@@ -XXX,XX +XXX,XX @@ static bool trans_VEXT(DisasContext *s, arg_VEXT *a)
217
destright = tcg_temp_new_i64();
218
219
if (a->imm < 8) {
220
- neon_load_reg64(right, a->vn);
221
- neon_load_reg64(middle, a->vn + 1);
222
+ read_neon_element64(right, a->vn, 0, MO_64);
223
+ read_neon_element64(middle, a->vn, 1, MO_64);
224
tcg_gen_extract2_i64(destright, right, middle, a->imm * 8);
225
- neon_load_reg64(left, a->vm);
226
+ read_neon_element64(left, a->vm, 0, MO_64);
227
tcg_gen_extract2_i64(destleft, middle, left, a->imm * 8);
228
} else {
229
- neon_load_reg64(right, a->vn + 1);
230
- neon_load_reg64(middle, a->vm);
231
+ read_neon_element64(right, a->vn, 1, MO_64);
232
+ read_neon_element64(middle, a->vm, 0, MO_64);
233
tcg_gen_extract2_i64(destright, right, middle, (a->imm - 8) * 8);
234
- neon_load_reg64(left, a->vm + 1);
235
+ read_neon_element64(left, a->vm, 1, MO_64);
236
tcg_gen_extract2_i64(destleft, middle, left, (a->imm - 8) * 8);
237
}
238
239
- neon_store_reg64(destright, a->vd);
240
- neon_store_reg64(destleft, a->vd + 1);
241
+ write_neon_element64(destright, a->vd, 0, MO_64);
242
+ write_neon_element64(destleft, a->vd, 1, MO_64);
243
244
tcg_temp_free_i64(destright);
245
tcg_temp_free_i64(destleft);
246
@@ -XXX,XX +XXX,XX @@ static bool do_2misc_pairwise(DisasContext *s, arg_2misc *a,
247
248
if (accfn) {
249
TCGv_i64 tmp64 = tcg_temp_new_i64();
250
- neon_load_reg64(tmp64, a->vd + pass);
251
+ read_neon_element64(tmp64, a->vd, pass, MO_64);
252
accfn(rd_64, tmp64, rd_64);
253
tcg_temp_free_i64(tmp64);
254
}
255
- neon_store_reg64(rd_64, a->vd + pass);
256
+ write_neon_element64(rd_64, a->vd, pass, MO_64);
257
tcg_temp_free_i64(rd_64);
258
}
259
return true;
260
@@ -XXX,XX +XXX,XX @@ static bool do_vmovn(DisasContext *s, arg_2misc *a,
261
rd0 = tcg_temp_new_i32();
262
rd1 = tcg_temp_new_i32();
263
264
- neon_load_reg64(rm, a->vm);
265
+ read_neon_element64(rm, a->vm, 0, MO_64);
266
narrowfn(rd0, cpu_env, rm);
267
- neon_load_reg64(rm, a->vm + 1);
268
+ read_neon_element64(rm, a->vm, 1, MO_64);
269
narrowfn(rd1, cpu_env, rm);
270
write_neon_element32(rd0, a->vd, 0, MO_32);
271
write_neon_element32(rd1, a->vd, 1, MO_32);
272
@@ -XXX,XX +XXX,XX @@ static bool trans_VSHLL(DisasContext *s, arg_2misc *a)
273
274
widenfn(rd, rm0);
275
tcg_gen_shli_i64(rd, rd, 8 << a->size);
276
- neon_store_reg64(rd, a->vd);
277
+ write_neon_element64(rd, a->vd, 0, MO_64);
278
widenfn(rd, rm1);
279
tcg_gen_shli_i64(rd, rd, 8 << a->size);
280
- neon_store_reg64(rd, a->vd + 1);
281
+ write_neon_element64(rd, a->vd, 1, MO_64);
282
283
tcg_temp_free_i64(rd);
284
tcg_temp_free_i32(rm0);
285
@@ -XXX,XX +XXX,XX @@ static bool trans_VSWP(DisasContext *s, arg_2misc *a)
286
rm = tcg_temp_new_i64();
287
rd = tcg_temp_new_i64();
288
for (pass = 0; pass < (a->q ? 2 : 1); pass++) {
289
- neon_load_reg64(rm, a->vm + pass);
290
- neon_load_reg64(rd, a->vd + pass);
291
- neon_store_reg64(rm, a->vd + pass);
292
- neon_store_reg64(rd, a->vm + pass);
293
+ read_neon_element64(rm, a->vm, pass, MO_64);
294
+ read_neon_element64(rd, a->vd, pass, MO_64);
295
+ write_neon_element64(rm, a->vd, pass, MO_64);
296
+ write_neon_element64(rd, a->vm, pass, MO_64);
297
}
298
tcg_temp_free_i64(rm);
299
tcg_temp_free_i64(rd);
386
--
300
--
387
2.20.1
301
2.20.1
388
302
389
303
diff view generated by jsdifflib
1
In linux-user/arm/cpu-loop.c we incorrectly treat EXCP_BKPT similarly
1
From: Richard Henderson <richard.henderson@linaro.org>
2
to EXCP_SWI, which means that if the guest executes a BKPT insn then
2
3
QEMU will perform a syscall for it (which syscall depends on what
3
The only uses of this function are for loading VFP
4
value happens to be in r7...). The correct behaviour is that the
4
double-precision values, and nothing to do with NEON.
5
guest process should take a SIGTRAP.
5
6
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
This code has been like this (more or less) since commit
7
Message-id: 20201030022618.785675-10-richard.henderson@linaro.org
8
06c949e62a098f in 2006 which added BKPT in the first place. This is
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
probably because at the time the same code path was used to handle
10
both Linux syscalls and semihosting calls, and (on M profile) BKPT
11
with a suitable magic number is used for semihosting calls. But
12
these days we've moved handling of semihosting out to an entirely
13
different codepath, so we can fix this bug by simply removing this
14
handling of EXCP_BKPT and instead making it deliver a SIGTRAP like
15
EXCP_DEBUG (as we do already on aarch64).
16
17
Reported-by: <omerg681@gmail.com>
18
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
19
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Message-id: 20200420212206.12776-2-peter.maydell@linaro.org
22
Fixes: https://bugs.launchpad.net/qemu/+bug/1873898
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
---
10
---
25
linux-user/arm/cpu_loop.c | 30 ++++++++----------------------
11
target/arm/translate.c | 8 ++--
26
1 file changed, 8 insertions(+), 22 deletions(-)
12
target/arm/translate-vfp.c.inc | 84 +++++++++++++++++-----------------
27
13
2 files changed, 46 insertions(+), 46 deletions(-)
28
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
14
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
29
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
30
--- a/linux-user/arm/cpu_loop.c
17
--- a/target/arm/translate.c
31
+++ b/linux-user/arm/cpu_loop.c
18
+++ b/target/arm/translate.c
32
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
19
@@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg)
20
}
21
}
22
23
-static inline void neon_load_reg64(TCGv_i64 var, int reg)
24
+static inline void vfp_load_reg64(TCGv_i64 var, int reg)
25
{
26
- tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(1, reg));
27
+ tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg));
28
}
29
30
-static inline void neon_store_reg64(TCGv_i64 var, int reg)
31
+static inline void vfp_store_reg64(TCGv_i64 var, int reg)
32
{
33
- tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(1, reg));
34
+ tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg));
35
}
36
37
static inline void vfp_load_reg32(TCGv_i32 var, int reg)
38
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
39
index XXXXXXX..XXXXXXX 100644
40
--- a/target/arm/translate-vfp.c.inc
41
+++ b/target/arm/translate-vfp.c.inc
42
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
43
tcg_gen_ext_i32_i64(nf, cpu_NF);
44
tcg_gen_ext_i32_i64(vf, cpu_VF);
45
46
- neon_load_reg64(frn, rn);
47
- neon_load_reg64(frm, rm);
48
+ vfp_load_reg64(frn, rn);
49
+ vfp_load_reg64(frm, rm);
50
switch (a->cc) {
51
case 0: /* eq: Z */
52
tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero,
53
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
54
tcg_temp_free_i64(tmp);
55
break;
56
}
57
- neon_store_reg64(dest, rd);
58
+ vfp_store_reg64(dest, rd);
59
tcg_temp_free_i64(frn);
60
tcg_temp_free_i64(frm);
61
tcg_temp_free_i64(dest);
62
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
63
TCGv_i64 tcg_res;
64
tcg_op = tcg_temp_new_i64();
65
tcg_res = tcg_temp_new_i64();
66
- neon_load_reg64(tcg_op, rm);
67
+ vfp_load_reg64(tcg_op, rm);
68
gen_helper_rintd(tcg_res, tcg_op, fpst);
69
- neon_store_reg64(tcg_res, rd);
70
+ vfp_store_reg64(tcg_res, rd);
71
tcg_temp_free_i64(tcg_op);
72
tcg_temp_free_i64(tcg_res);
73
} else {
74
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
75
tcg_double = tcg_temp_new_i64();
76
tcg_res = tcg_temp_new_i64();
77
tcg_tmp = tcg_temp_new_i32();
78
- neon_load_reg64(tcg_double, rm);
79
+ vfp_load_reg64(tcg_double, rm);
80
if (is_signed) {
81
gen_helper_vfp_tosld(tcg_res, tcg_double, tcg_shift, fpst);
82
} else {
83
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a)
84
tmp = tcg_temp_new_i64();
85
if (a->l) {
86
gen_aa32_ld64(s, tmp, addr, get_mem_index(s));
87
- neon_store_reg64(tmp, a->vd);
88
+ vfp_store_reg64(tmp, a->vd);
89
} else {
90
- neon_load_reg64(tmp, a->vd);
91
+ vfp_load_reg64(tmp, a->vd);
92
gen_aa32_st64(s, tmp, addr, get_mem_index(s));
93
}
94
tcg_temp_free_i64(tmp);
95
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a)
96
if (a->l) {
97
/* load */
98
gen_aa32_ld64(s, tmp, addr, get_mem_index(s));
99
- neon_store_reg64(tmp, a->vd + i);
100
+ vfp_store_reg64(tmp, a->vd + i);
101
} else {
102
/* store */
103
- neon_load_reg64(tmp, a->vd + i);
104
+ vfp_load_reg64(tmp, a->vd + i);
105
gen_aa32_st64(s, tmp, addr, get_mem_index(s));
106
}
107
tcg_gen_addi_i32(addr, addr, offset);
108
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn,
109
fd = tcg_temp_new_i64();
110
fpst = fpstatus_ptr(FPST_FPCR);
111
112
- neon_load_reg64(f0, vn);
113
- neon_load_reg64(f1, vm);
114
+ vfp_load_reg64(f0, vn);
115
+ vfp_load_reg64(f1, vm);
116
117
for (;;) {
118
if (reads_vd) {
119
- neon_load_reg64(fd, vd);
120
+ vfp_load_reg64(fd, vd);
121
}
122
fn(fd, f0, f1, fpst);
123
- neon_store_reg64(fd, vd);
124
+ vfp_store_reg64(fd, vd);
125
126
if (veclen == 0) {
127
break;
128
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn,
129
veclen--;
130
vd = vfp_advance_dreg(vd, delta_d);
131
vn = vfp_advance_dreg(vn, delta_d);
132
- neon_load_reg64(f0, vn);
133
+ vfp_load_reg64(f0, vn);
134
if (delta_m) {
135
vm = vfp_advance_dreg(vm, delta_m);
136
- neon_load_reg64(f1, vm);
137
+ vfp_load_reg64(f1, vm);
138
}
139
}
140
141
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm)
142
f0 = tcg_temp_new_i64();
143
fd = tcg_temp_new_i64();
144
145
- neon_load_reg64(f0, vm);
146
+ vfp_load_reg64(f0, vm);
147
148
for (;;) {
149
fn(fd, f0);
150
- neon_store_reg64(fd, vd);
151
+ vfp_store_reg64(fd, vd);
152
153
if (veclen == 0) {
154
break;
155
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm)
156
/* single source one-many */
157
while (veclen--) {
158
vd = vfp_advance_dreg(vd, delta_d);
159
- neon_store_reg64(fd, vd);
160
+ vfp_store_reg64(fd, vd);
33
}
161
}
34
break;
162
break;
35
case EXCP_SWI:
163
}
36
- case EXCP_BKPT:
164
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm)
37
{
165
veclen--;
38
env->eabi = 1;
166
vd = vfp_advance_dreg(vd, delta_d);
39
/* system call */
167
vd = vfp_advance_dreg(vm, delta_m);
40
- if (trapnr == EXCP_BKPT) {
168
- neon_load_reg64(f0, vm);
41
- if (env->thumb) {
169
+ vfp_load_reg64(f0, vm);
42
- /* FIXME - what to do if get_user() fails? */
170
}
43
- get_user_code_u16(insn, env->regs[15], env);
171
44
- n = insn & 0xff;
172
tcg_temp_free_i64(f0);
45
- env->regs[15] += 2;
173
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d)
46
- } else {
174
vm = tcg_temp_new_i64();
47
- /* FIXME - what to do if get_user() fails? */
175
vd = tcg_temp_new_i64();
48
- get_user_code_u32(insn, env->regs[15], env);
176
49
- n = (insn & 0xf) | ((insn >> 4) & 0xff0);
177
- neon_load_reg64(vn, a->vn);
50
- env->regs[15] += 4;
178
- neon_load_reg64(vm, a->vm);
51
- }
179
+ vfp_load_reg64(vn, a->vn);
52
+ if (env->thumb) {
180
+ vfp_load_reg64(vm, a->vm);
53
+ /* FIXME - what to do if get_user() fails? */
181
if (neg_n) {
54
+ get_user_code_u16(insn, env->regs[15] - 2, env);
182
/* VFNMS, VFMS */
55
+ n = insn & 0xff;
183
gen_helper_vfp_negd(vn, vn);
56
} else {
184
}
57
- if (env->thumb) {
185
- neon_load_reg64(vd, a->vd);
58
- /* FIXME - what to do if get_user() fails? */
186
+ vfp_load_reg64(vd, a->vd);
59
- get_user_code_u16(insn, env->regs[15] - 2, env);
187
if (neg_d) {
60
- n = insn & 0xff;
188
/* VFNMA, VFNMS */
61
- } else {
189
gen_helper_vfp_negd(vd, vd);
62
- /* FIXME - what to do if get_user() fails? */
190
}
63
- get_user_code_u32(insn, env->regs[15] - 4, env);
191
fpst = fpstatus_ptr(FPST_FPCR);
64
- n = insn & 0xffffff;
192
gen_helper_vfp_muladdd(vd, vn, vm, vd, fpst);
65
- }
193
- neon_store_reg64(vd, a->vd);
66
+ /* FIXME - what to do if get_user() fails? */
194
+ vfp_store_reg64(vd, a->vd);
67
+ get_user_code_u32(insn, env->regs[15] - 4, env);
195
68
+ n = insn & 0xffffff;
196
tcg_temp_free_ptr(fpst);
69
}
197
tcg_temp_free_i64(vn);
70
198
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
71
if (n == ARM_NR_cacheflush) {
199
fd = tcg_const_i64(vfp_expand_imm(MO_64, a->imm));
72
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
200
73
}
201
for (;;) {
74
break;
202
- neon_store_reg64(fd, vd);
75
case EXCP_DEBUG:
203
+ vfp_store_reg64(fd, vd);
76
+ case EXCP_BKPT:
204
77
excp_debug:
205
if (veclen == 0) {
78
info.si_signo = TARGET_SIGTRAP;
206
break;
79
info.si_errno = 0;
207
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a)
208
vd = tcg_temp_new_i64();
209
vm = tcg_temp_new_i64();
210
211
- neon_load_reg64(vd, a->vd);
212
+ vfp_load_reg64(vd, a->vd);
213
if (a->z) {
214
tcg_gen_movi_i64(vm, 0);
215
} else {
216
- neon_load_reg64(vm, a->vm);
217
+ vfp_load_reg64(vm, a->vm);
218
}
219
220
if (a->e) {
221
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a)
222
tcg_gen_ld16u_i32(tmp, cpu_env, vfp_f16_offset(a->vm, a->t));
223
vd = tcg_temp_new_i64();
224
gen_helper_vfp_fcvt_f16_to_f64(vd, tmp, fpst, ahp_mode);
225
- neon_store_reg64(vd, a->vd);
226
+ vfp_store_reg64(vd, a->vd);
227
tcg_temp_free_i32(ahp_mode);
228
tcg_temp_free_ptr(fpst);
229
tcg_temp_free_i32(tmp);
230
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a)
231
tmp = tcg_temp_new_i32();
232
vm = tcg_temp_new_i64();
233
234
- neon_load_reg64(vm, a->vm);
235
+ vfp_load_reg64(vm, a->vm);
236
gen_helper_vfp_fcvt_f64_to_f16(tmp, vm, fpst, ahp_mode);
237
tcg_temp_free_i64(vm);
238
tcg_gen_st16_i32(tmp, cpu_env, vfp_f16_offset(a->vd, a->t));
239
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a)
240
}
241
242
tmp = tcg_temp_new_i64();
243
- neon_load_reg64(tmp, a->vm);
244
+ vfp_load_reg64(tmp, a->vm);
245
fpst = fpstatus_ptr(FPST_FPCR);
246
gen_helper_rintd(tmp, tmp, fpst);
247
- neon_store_reg64(tmp, a->vd);
248
+ vfp_store_reg64(tmp, a->vd);
249
tcg_temp_free_ptr(fpst);
250
tcg_temp_free_i64(tmp);
251
return true;
252
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a)
253
}
254
255
tmp = tcg_temp_new_i64();
256
- neon_load_reg64(tmp, a->vm);
257
+ vfp_load_reg64(tmp, a->vm);
258
fpst = fpstatus_ptr(FPST_FPCR);
259
tcg_rmode = tcg_const_i32(float_round_to_zero);
260
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
261
gen_helper_rintd(tmp, tmp, fpst);
262
gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst);
263
- neon_store_reg64(tmp, a->vd);
264
+ vfp_store_reg64(tmp, a->vd);
265
tcg_temp_free_ptr(fpst);
266
tcg_temp_free_i64(tmp);
267
tcg_temp_free_i32(tcg_rmode);
268
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a)
269
}
270
271
tmp = tcg_temp_new_i64();
272
- neon_load_reg64(tmp, a->vm);
273
+ vfp_load_reg64(tmp, a->vm);
274
fpst = fpstatus_ptr(FPST_FPCR);
275
gen_helper_rintd_exact(tmp, tmp, fpst);
276
- neon_store_reg64(tmp, a->vd);
277
+ vfp_store_reg64(tmp, a->vd);
278
tcg_temp_free_ptr(fpst);
279
tcg_temp_free_i64(tmp);
280
return true;
281
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a)
282
vd = tcg_temp_new_i64();
283
vfp_load_reg32(vm, a->vm);
284
gen_helper_vfp_fcvtds(vd, vm, cpu_env);
285
- neon_store_reg64(vd, a->vd);
286
+ vfp_store_reg64(vd, a->vd);
287
tcg_temp_free_i32(vm);
288
tcg_temp_free_i64(vd);
289
return true;
290
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a)
291
292
vd = tcg_temp_new_i32();
293
vm = tcg_temp_new_i64();
294
- neon_load_reg64(vm, a->vm);
295
+ vfp_load_reg64(vm, a->vm);
296
gen_helper_vfp_fcvtsd(vd, vm, cpu_env);
297
vfp_store_reg32(vd, a->vd);
298
tcg_temp_free_i32(vd);
299
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a)
300
/* u32 -> f64 */
301
gen_helper_vfp_uitod(vd, vm, fpst);
302
}
303
- neon_store_reg64(vd, a->vd);
304
+ vfp_store_reg64(vd, a->vd);
305
tcg_temp_free_i32(vm);
306
tcg_temp_free_i64(vd);
307
tcg_temp_free_ptr(fpst);
308
@@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a)
309
310
vm = tcg_temp_new_i64();
311
vd = tcg_temp_new_i32();
312
- neon_load_reg64(vm, a->vm);
313
+ vfp_load_reg64(vm, a->vm);
314
gen_helper_vjcvt(vd, vm, cpu_env);
315
vfp_store_reg32(vd, a->vd);
316
tcg_temp_free_i64(vm);
317
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
318
frac_bits = (a->opc & 1) ? (32 - a->imm) : (16 - a->imm);
319
320
vd = tcg_temp_new_i64();
321
- neon_load_reg64(vd, a->vd);
322
+ vfp_load_reg64(vd, a->vd);
323
324
fpst = fpstatus_ptr(FPST_FPCR);
325
shift = tcg_const_i32(frac_bits);
326
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
327
g_assert_not_reached();
328
}
329
330
- neon_store_reg64(vd, a->vd);
331
+ vfp_store_reg64(vd, a->vd);
332
tcg_temp_free_i64(vd);
333
tcg_temp_free_i32(shift);
334
tcg_temp_free_ptr(fpst);
335
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
336
fpst = fpstatus_ptr(FPST_FPCR);
337
vm = tcg_temp_new_i64();
338
vd = tcg_temp_new_i32();
339
- neon_load_reg64(vm, a->vm);
340
+ vfp_load_reg64(vm, a->vm);
341
342
if (a->s) {
343
if (a->rz) {
80
--
344
--
81
2.20.1
345
2.20.1
82
346
83
347
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
With this commit, the watchdog on mcimx6ul-evk is fully operational,
3
In both cases, we can sink the write-back and perform
4
including pretimeout support.
4
the accumulate into the normal destination temps.
5
5
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Message-id: 20201030022618.785675-11-richard.henderson@linaro.org
8
Message-id: 20200517162135.110364-7-linux@roeck-us.net
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
hw/arm/fsl-imx6ul.c | 10 ++++++++++
11
target/arm/translate-neon.c.inc | 23 +++++++++--------------
12
1 file changed, 10 insertions(+)
12
1 file changed, 9 insertions(+), 14 deletions(-)
13
13
14
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
14
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/fsl-imx6ul.c
16
--- a/target/arm/translate-neon.c.inc
17
+++ b/hw/arm/fsl-imx6ul.c
17
+++ b/target/arm/translate-neon.c.inc
18
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
18
@@ -XXX,XX +XXX,XX @@ static bool do_long_3d(DisasContext *s, arg_3diff *a,
19
FSL_IMX6UL_WDOG2_ADDR,
19
if (accfn) {
20
FSL_IMX6UL_WDOG3_ADDR,
20
tmp = tcg_temp_new_i64();
21
};
21
read_neon_element64(tmp, a->vd, 0, MO_64);
22
+ static const int FSL_IMX6UL_WDOGn_IRQ[FSL_IMX6UL_NUM_WDTS] = {
22
- accfn(tmp, tmp, rd0);
23
+ FSL_IMX6UL_WDOG1_IRQ,
23
- write_neon_element64(tmp, a->vd, 0, MO_64);
24
+ FSL_IMX6UL_WDOG2_IRQ,
24
+ accfn(rd0, tmp, rd0);
25
+ FSL_IMX6UL_WDOG3_IRQ,
25
read_neon_element64(tmp, a->vd, 1, MO_64);
26
+ };
26
- accfn(tmp, tmp, rd1);
27
27
- write_neon_element64(tmp, a->vd, 1, MO_64);
28
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
28
+ accfn(rd1, tmp, rd1);
29
+ &error_abort);
29
tcg_temp_free_i64(tmp);
30
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
30
- } else {
31
&error_abort);
31
- write_neon_element64(rd0, a->vd, 0, MO_64);
32
32
- write_neon_element64(rd1, a->vd, 1, MO_64);
33
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
34
FSL_IMX6UL_WDOGn_ADDR[i]);
35
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
36
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
37
+ FSL_IMX6UL_WDOGn_IRQ[i]));
38
}
33
}
39
34
40
/*
35
+ write_neon_element64(rd0, a->vd, 0, MO_64);
36
+ write_neon_element64(rd1, a->vd, 1, MO_64);
37
tcg_temp_free_i64(rd0);
38
tcg_temp_free_i64(rd1);
39
40
@@ -XXX,XX +XXX,XX @@ static bool do_2scalar_long(DisasContext *s, arg_2scalar *a,
41
if (accfn) {
42
TCGv_i64 t64 = tcg_temp_new_i64();
43
read_neon_element64(t64, a->vd, 0, MO_64);
44
- accfn(t64, t64, rn0_64);
45
- write_neon_element64(t64, a->vd, 0, MO_64);
46
+ accfn(rn0_64, t64, rn0_64);
47
read_neon_element64(t64, a->vd, 1, MO_64);
48
- accfn(t64, t64, rn1_64);
49
- write_neon_element64(t64, a->vd, 1, MO_64);
50
+ accfn(rn1_64, t64, rn1_64);
51
tcg_temp_free_i64(t64);
52
- } else {
53
- write_neon_element64(rn0_64, a->vd, 0, MO_64);
54
- write_neon_element64(rn1_64, a->vd, 1, MO_64);
55
}
56
+
57
+ write_neon_element64(rn0_64, a->vd, 0, MO_64);
58
+ write_neon_element64(rn1_64, a->vd, 1, MO_64);
59
tcg_temp_free_i64(rn0_64);
60
tcg_temp_free_i64(rn1_64);
61
return true;
41
--
62
--
42
2.20.1
63
2.20.1
43
64
44
65
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
With this commit, the watchdog on imx25-pdk is fully operational,
3
We can use proper widening loads to extend 32-bit inputs,
4
including pretimeout support.
4
and skip the "widenfn" step.
5
5
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Message-id: 20201030022618.785675-12-richard.henderson@linaro.org
8
Message-id: 20200517162135.110364-4-linux@roeck-us.net
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
include/hw/arm/fsl-imx25.h | 5 +++++
11
target/arm/translate.c | 6 +++
12
hw/arm/fsl-imx25.c | 10 ++++++++++
12
target/arm/translate-neon.c.inc | 66 ++++++++++++++++++---------------
13
hw/arm/Kconfig | 1 +
13
2 files changed, 43 insertions(+), 29 deletions(-)
14
3 files changed, 16 insertions(+)
15
14
16
diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
17
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx25.h
17
--- a/target/arm/translate.c
19
+++ b/include/hw/arm/fsl-imx25.h
18
+++ b/target/arm/translate.c
20
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
21
#include "hw/gpio/imx_gpio.h"
20
long off = neon_element_offset(reg, ele, memop);
22
#include "hw/sd/sdhci.h"
21
23
#include "hw/usb/chipidea.h"
22
switch (memop) {
24
+#include "hw/watchdog/wdt_imx2.h"
23
+ case MO_SL:
25
#include "exec/memory.h"
24
+ tcg_gen_ld32s_i64(dest, cpu_env, off);
26
#include "target/arm/cpu.h"
25
+ break;
27
26
+ case MO_UL:
28
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
27
+ tcg_gen_ld32u_i64(dest, cpu_env, off);
29
IMXGPIOState gpio[FSL_IMX25_NUM_GPIOS];
28
+ break;
30
SDHCIState esdhc[FSL_IMX25_NUM_ESDHCS];
29
case MO_Q:
31
ChipideaState usb[FSL_IMX25_NUM_USBS];
30
tcg_gen_ld_i64(dest, cpu_env, off);
32
+ IMX2WdtState wdt;
31
break;
33
MemoryRegion rom[2];
32
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
34
MemoryRegion iram;
35
MemoryRegion iram_alias;
36
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
37
#define FSL_IMX25_GPIO1_SIZE 0x4000
38
#define FSL_IMX25_GPIO2_ADDR 0x53FD0000
39
#define FSL_IMX25_GPIO2_SIZE 0x4000
40
+#define FSL_IMX25_WDT_ADDR 0x53FDC000
41
+#define FSL_IMX25_WDT_SIZE 0x4000
42
#define FSL_IMX25_USB1_ADDR 0x53FF4000
43
#define FSL_IMX25_USB1_SIZE 0x0200
44
#define FSL_IMX25_USB2_ADDR 0x53FF4400
45
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
46
#define FSL_IMX25_ESDHC2_IRQ 8
47
#define FSL_IMX25_USB1_IRQ 37
48
#define FSL_IMX25_USB2_IRQ 35
49
+#define FSL_IMX25_WDT_IRQ 55
50
51
#endif /* FSL_IMX25_H */
52
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
53
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/fsl-imx25.c
34
--- a/target/arm/translate-neon.c.inc
55
+++ b/hw/arm/fsl-imx25.c
35
+++ b/target/arm/translate-neon.c.inc
56
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
36
@@ -XXX,XX +XXX,XX @@ static bool trans_Vimm_1r(DisasContext *s, arg_1reg_imm *a)
57
TYPE_CHIPIDEA);
37
static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
38
NeonGenWidenFn *widenfn,
39
NeonGenTwo64OpFn *opfn,
40
- bool src1_wide)
41
+ int src1_mop, int src2_mop)
42
{
43
/* 3-regs different lengths, prewidening case (VADDL/VSUBL/VAADW/VSUBW) */
44
TCGv_i64 rn0_64, rn1_64, rm_64;
45
- TCGv_i32 rm;
46
47
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
48
return false;
49
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
50
return false;
58
}
51
}
59
52
60
+ sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
53
- if (!widenfn || !opfn) {
54
+ if (!opfn) {
55
/* size == 3 case, which is an entirely different insn group */
56
return false;
57
}
58
59
- if ((a->vd & 1) || (src1_wide && (a->vn & 1))) {
60
+ if ((a->vd & 1) || (src1_mop == MO_Q && (a->vn & 1))) {
61
return false;
62
}
63
64
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
65
rn1_64 = tcg_temp_new_i64();
66
rm_64 = tcg_temp_new_i64();
67
68
- if (src1_wide) {
69
- read_neon_element64(rn0_64, a->vn, 0, MO_64);
70
+ if (src1_mop >= 0) {
71
+ read_neon_element64(rn0_64, a->vn, 0, src1_mop);
72
} else {
73
TCGv_i32 tmp = tcg_temp_new_i32();
74
read_neon_element32(tmp, a->vn, 0, MO_32);
75
widenfn(rn0_64, tmp);
76
tcg_temp_free_i32(tmp);
77
}
78
- rm = tcg_temp_new_i32();
79
- read_neon_element32(rm, a->vm, 0, MO_32);
80
+ if (src2_mop >= 0) {
81
+ read_neon_element64(rm_64, a->vm, 0, src2_mop);
82
+ } else {
83
+ TCGv_i32 tmp = tcg_temp_new_i32();
84
+ read_neon_element32(tmp, a->vm, 0, MO_32);
85
+ widenfn(rm_64, tmp);
86
+ tcg_temp_free_i32(tmp);
87
+ }
88
89
- widenfn(rm_64, rm);
90
- tcg_temp_free_i32(rm);
91
opfn(rn0_64, rn0_64, rm_64);
92
93
/*
94
* Load second pass inputs before storing the first pass result, to
95
* avoid incorrect results if a narrow input overlaps with the result.
96
*/
97
- if (src1_wide) {
98
- read_neon_element64(rn1_64, a->vn, 1, MO_64);
99
+ if (src1_mop >= 0) {
100
+ read_neon_element64(rn1_64, a->vn, 1, src1_mop);
101
} else {
102
TCGv_i32 tmp = tcg_temp_new_i32();
103
read_neon_element32(tmp, a->vn, 1, MO_32);
104
widenfn(rn1_64, tmp);
105
tcg_temp_free_i32(tmp);
106
}
107
- rm = tcg_temp_new_i32();
108
- read_neon_element32(rm, a->vm, 1, MO_32);
109
+ if (src2_mop >= 0) {
110
+ read_neon_element64(rm_64, a->vm, 1, src2_mop);
111
+ } else {
112
+ TCGv_i32 tmp = tcg_temp_new_i32();
113
+ read_neon_element32(tmp, a->vm, 1, MO_32);
114
+ widenfn(rm_64, tmp);
115
+ tcg_temp_free_i32(tmp);
116
+ }
117
118
write_neon_element64(rn0_64, a->vd, 0, MO_64);
119
120
- widenfn(rm_64, rm);
121
- tcg_temp_free_i32(rm);
122
opfn(rn1_64, rn1_64, rm_64);
123
write_neon_element64(rn1_64, a->vd, 1, MO_64);
124
125
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
126
return true;
61
}
127
}
62
128
63
static void fsl_imx25_realize(DeviceState *dev, Error **errp)
129
-#define DO_PREWIDEN(INSN, S, EXT, OP, SRC1WIDE) \
64
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
130
+#define DO_PREWIDEN(INSN, S, OP, SRC1WIDE, SIGN) \
65
usb_table[i].irq));
131
static bool trans_##INSN##_3d(DisasContext *s, arg_3diff *a) \
132
{ \
133
static NeonGenWidenFn * const widenfn[] = { \
134
gen_helper_neon_widen_##S##8, \
135
gen_helper_neon_widen_##S##16, \
136
- tcg_gen_##EXT##_i32_i64, \
137
- NULL, \
138
+ NULL, NULL, \
139
}; \
140
static NeonGenTwo64OpFn * const addfn[] = { \
141
gen_helper_neon_##OP##l_u16, \
142
@@ -XXX,XX +XXX,XX @@ static bool do_prewiden_3d(DisasContext *s, arg_3diff *a,
143
tcg_gen_##OP##_i64, \
144
NULL, \
145
}; \
146
- return do_prewiden_3d(s, a, widenfn[a->size], \
147
- addfn[a->size], SRC1WIDE); \
148
+ int narrow_mop = a->size == MO_32 ? MO_32 | SIGN : -1; \
149
+ return do_prewiden_3d(s, a, widenfn[a->size], addfn[a->size], \
150
+ SRC1WIDE ? MO_Q : narrow_mop, \
151
+ narrow_mop); \
66
}
152
}
67
153
68
+ /* Watchdog */
154
-DO_PREWIDEN(VADDL_S, s, ext, add, false)
69
+ object_property_set_bool(OBJECT(&s->wdt), true, "pretimeout-support",
155
-DO_PREWIDEN(VADDL_U, u, extu, add, false)
70
+ &error_abort);
156
-DO_PREWIDEN(VSUBL_S, s, ext, sub, false)
71
+ object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
157
-DO_PREWIDEN(VSUBL_U, u, extu, sub, false)
72
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX25_WDT_ADDR);
158
-DO_PREWIDEN(VADDW_S, s, ext, add, true)
73
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt), 0,
159
-DO_PREWIDEN(VADDW_U, u, extu, add, true)
74
+ qdev_get_gpio_in(DEVICE(&s->avic),
160
-DO_PREWIDEN(VSUBW_S, s, ext, sub, true)
75
+ FSL_IMX25_WDT_IRQ));
161
-DO_PREWIDEN(VSUBW_U, u, extu, sub, true)
76
+
162
+DO_PREWIDEN(VADDL_S, s, add, false, MO_SIGN)
77
/* initialize 2 x 16 KB ROM */
163
+DO_PREWIDEN(VADDL_U, u, add, false, 0)
78
memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
164
+DO_PREWIDEN(VSUBL_S, s, sub, false, MO_SIGN)
79
FSL_IMX25_ROM0_SIZE, &err);
165
+DO_PREWIDEN(VSUBL_U, u, sub, false, 0)
80
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
166
+DO_PREWIDEN(VADDW_S, s, add, true, MO_SIGN)
81
index XXXXXXX..XXXXXXX 100644
167
+DO_PREWIDEN(VADDW_U, u, add, true, 0)
82
--- a/hw/arm/Kconfig
168
+DO_PREWIDEN(VSUBW_S, s, sub, true, MO_SIGN)
83
+++ b/hw/arm/Kconfig
169
+DO_PREWIDEN(VSUBW_U, u, sub, true, 0)
84
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
170
85
select IMX
171
static bool do_narrow_3d(DisasContext *s, arg_3diff *a,
86
select IMX_FEC
172
NeonGenTwo64OpFn *opfn, NeonGenNarrowFn *narrowfn)
87
select IMX_I2C
88
+ select WDT_IMX2
89
select DS1338
90
91
config FSL_IMX31
92
--
173
--
93
2.20.1
174
2.20.1
94
175
95
176
diff view generated by jsdifflib
1
The Arm signal-handling code has some parts ifdeffed with a
1
In the neon_padd/pmax/pmin helpers for float16, a cut-and-paste error
2
TARGET_CONFIG_CPU_32, which is always defined. This is a leftover
2
meant we were using the H4() address swizzler macro rather than the
3
from when this code's structure was based on the Linux kernel
3
H2() which is required for 2-byte data. This had no effect on
4
signal handling code, where it was intended to support 26-bit
4
little-endian hosts but meant we put the result data into the
5
Arm CPUs. The kernel dropped its CONFIG_CPU_32 in kernel commit
5
destination Dreg in the wrong order on big-endian hosts.
6
4da8b8208eded0ba21e3 in 2009.
7
8
QEMU has never had 26-bit CPU support and is unlikely to ever
9
add it; we certainly aren't going to support 26-bit Linux
10
binaries via linux-user mode. The ifdef is just unhelpful
11
noise, so remove it entirely.
12
6
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20200518143014.20689-1-peter.maydell@linaro.org
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Message-id: 20201028191712.4910-2-peter.maydell@linaro.org
16
---
11
---
17
linux-user/arm/signal.c | 6 ------
12
target/arm/vec_helper.c | 8 ++++----
18
1 file changed, 6 deletions(-)
13
1 file changed, 4 insertions(+), 4 deletions(-)
19
14
20
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
15
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
21
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
22
--- a/linux-user/arm/signal.c
17
--- a/target/arm/vec_helper.c
23
+++ b/linux-user/arm/signal.c
18
+++ b/target/arm/vec_helper.c
24
@@ -XXX,XX +XXX,XX @@ struct rt_sigframe_v2
19
@@ -XXX,XX +XXX,XX @@ DO_ABA(gvec_uaba_d, uint64_t)
25
abi_ulong retcode[4];
20
r2 = float16_##OP(m[H2(0)], m[H2(1)], fpst); \
26
};
21
r3 = float16_##OP(m[H2(2)], m[H2(3)], fpst); \
27
22
\
28
-#define TARGET_CONFIG_CPU_32 1
23
- d[H4(0)] = r0; \
29
-
24
- d[H4(1)] = r1; \
30
/*
25
- d[H4(2)] = r2; \
31
* For ARM syscalls, we encode the syscall number into the instruction.
26
- d[H4(3)] = r3; \
32
*/
27
+ d[H2(0)] = r0; \
33
@@ -XXX,XX +XXX,XX @@ setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/
28
+ d[H2(1)] = r1; \
34
__put_user(env->regs[13], &sc->arm_sp);
29
+ d[H2(2)] = r2; \
35
__put_user(env->regs[14], &sc->arm_lr);
30
+ d[H2(3)] = r3; \
36
__put_user(env->regs[15], &sc->arm_pc);
31
}
37
-#ifdef TARGET_CONFIG_CPU_32
32
38
__put_user(cpsr_read(env), &sc->arm_cpsr);
33
DO_NEON_PAIRWISE(neon_padd, add)
39
-#endif
40
41
__put_user(/* current->thread.trap_no */ 0, &sc->trap_no);
42
__put_user(/* current->thread.error_code */ 0, &sc->error_code);
43
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
44
__get_user(env->regs[13], &sc->arm_sp);
45
__get_user(env->regs[14], &sc->arm_lr);
46
__get_user(env->regs[15], &sc->arm_pc);
47
-#ifdef TARGET_CONFIG_CPU_32
48
__get_user(cpsr, &sc->arm_cpsr);
49
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
50
arm_rebuild_hflags(env);
51
-#endif
52
53
err |= !valid_user_regs(env);
54
55
--
34
--
56
2.20.1
35
2.20.1
57
36
58
37
diff view generated by jsdifflib
1
Add 'Arm' to the Integrator/CP document title, for consistency with
1
The helper functions for performing the udot/sdot operations against
2
the titling of the other documentation of Arm devboard models
2
a scalar were not using an address-swizzling macro when converting
3
(versatile, realview).
3
the index of the scalar element into a pointer into the vm array.
4
This had no effect on little-endian hosts but meant we generated
5
incorrect results on big-endian hosts.
6
7
For these insns, the index is indexing over group of 4 8-bit values,
8
so 32 bits per indexed entity, and H4() is therefore what we want.
9
(For Neon the only possible input indexes are 0 and 1.)
4
10
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
14
Message-id: 20201028191712.4910-3-peter.maydell@linaro.org
9
Message-id: 20200507151819.28444-2-peter.maydell@linaro.org
10
---
15
---
11
docs/system/arm/integratorcp.rst | 4 ++--
16
target/arm/vec_helper.c | 4 ++--
12
1 file changed, 2 insertions(+), 2 deletions(-)
17
1 file changed, 2 insertions(+), 2 deletions(-)
13
18
14
diff --git a/docs/system/arm/integratorcp.rst b/docs/system/arm/integratorcp.rst
19
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/integratorcp.rst
21
--- a/target/arm/vec_helper.c
17
+++ b/docs/system/arm/integratorcp.rst
22
+++ b/target/arm/vec_helper.c
18
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_sdot_idx_b)(void *vd, void *vn, void *vm, uint32_t desc)
19
-Integrator/CP (``integratorcp``)
24
intptr_t index = simd_data(desc);
20
-================================
25
uint32_t *d = vd;
21
+Arm Integrator/CP (``integratorcp``)
26
int8_t *n = vn;
22
+====================================
27
- int8_t *m_indexed = (int8_t *)vm + index * 4;
23
28
+ int8_t *m_indexed = (int8_t *)vm + H4(index) * 4;
24
The Arm Integrator/CP board is emulated with the following devices:
29
25
30
/* Notice the special case of opr_sz == 8, from aa64/aa32 advsimd.
31
* Otherwise opr_sz is a multiple of 16.
32
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_udot_idx_b)(void *vd, void *vn, void *vm, uint32_t desc)
33
intptr_t index = simd_data(desc);
34
uint32_t *d = vd;
35
uint8_t *n = vn;
36
- uint8_t *m_indexed = (uint8_t *)vm + index * 4;
37
+ uint8_t *m_indexed = (uint8_t *)vm + H4(index) * 4;
38
39
/* Notice the special case of opr_sz == 8, from aa64/aa32 advsimd.
40
* Otherwise opr_sz is a multiple of 16.
26
--
41
--
27
2.20.1
42
2.20.1
28
43
29
44
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
2
2
3
Instantiating PWM, CAN, CAAM, and OCOTP devices is necessary to avoid
3
HCR should be applied when NS is set, not when it is cleared.
4
crashes when booting mainline Linux.
5
4
5
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Message-id: 20200517162135.110364-8-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
8
---
11
include/hw/arm/fsl-imx7.h | 16 ++++++++++++++++
9
target/arm/helper.c | 5 ++---
12
hw/arm/fsl-imx7.c | 24 ++++++++++++++++++++++++
10
1 file changed, 2 insertions(+), 3 deletions(-)
13
2 files changed, 40 insertions(+)
14
11
15
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx7.h
14
--- a/target/arm/helper.c
18
+++ b/include/hw/arm/fsl-imx7.h
15
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
16
@@ -XXX,XX +XXX,XX @@ static void tlbimvaa_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
20
FSL_IMX7_IOMUXC_GPR_ADDR = 0x30340000,
17
21
FSL_IMX7_IOMUXCn_SIZE = 0x1000,
18
/*
22
19
* Non-IS variants of TLB operations are upgraded to
23
+ FSL_IMX7_OCOTP_ADDR = 0x30350000,
20
- * IS versions if we are at NS EL1 and HCR_EL2.FB is set to
24
+ FSL_IMX7_OCOTP_SIZE = 0x10000,
21
+ * IS versions if we are at EL1 and HCR_EL2.FB is effectively set to
25
+
22
* force broadcast of these operations.
26
FSL_IMX7_ANALOG_ADDR = 0x30360000,
23
*/
27
FSL_IMX7_SNVS_ADDR = 0x30370000,
24
static bool tlb_force_broadcast(CPUARMState *env)
28
FSL_IMX7_CCM_ADDR = 0x30380000,
25
{
29
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
26
- return (env->cp15.hcr_el2 & HCR_FB) &&
30
FSL_IMX7_ADC2_ADDR = 0x30620000,
27
- arm_current_el(env) == 1 && arm_is_secure_below_el3(env);
31
FSL_IMX7_ADCn_SIZE = 0x1000,
28
+ return arm_current_el(env) == 1 && (arm_hcr_el2_eff(env) & HCR_FB);
32
29
}
33
+ FSL_IMX7_PWM1_ADDR = 0x30660000,
30
34
+ FSL_IMX7_PWM2_ADDR = 0x30670000,
31
static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri,
35
+ FSL_IMX7_PWM3_ADDR = 0x30680000,
36
+ FSL_IMX7_PWM4_ADDR = 0x30690000,
37
+ FSL_IMX7_PWMn_SIZE = 0x10000,
38
+
39
FSL_IMX7_PCIE_PHY_ADDR = 0x306D0000,
40
FSL_IMX7_PCIE_PHY_SIZE = 0x10000,
41
42
FSL_IMX7_GPC_ADDR = 0x303A0000,
43
44
+ FSL_IMX7_CAAM_ADDR = 0x30900000,
45
+ FSL_IMX7_CAAM_SIZE = 0x40000,
46
+
47
+ FSL_IMX7_CAN1_ADDR = 0x30A00000,
48
+ FSL_IMX7_CAN2_ADDR = 0x30A10000,
49
+ FSL_IMX7_CANn_SIZE = 0x10000,
50
+
51
FSL_IMX7_I2C1_ADDR = 0x30A20000,
52
FSL_IMX7_I2C2_ADDR = 0x30A30000,
53
FSL_IMX7_I2C3_ADDR = 0x30A40000,
54
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/hw/arm/fsl-imx7.c
57
+++ b/hw/arm/fsl-imx7.c
58
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
59
*/
60
create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
61
62
+ /*
63
+ * CAAM
64
+ */
65
+ create_unimplemented_device("caam", FSL_IMX7_CAAM_ADDR, FSL_IMX7_CAAM_SIZE);
66
+
67
+ /*
68
+ * PWM
69
+ */
70
+ create_unimplemented_device("pwm1", FSL_IMX7_PWM1_ADDR, FSL_IMX7_PWMn_SIZE);
71
+ create_unimplemented_device("pwm2", FSL_IMX7_PWM2_ADDR, FSL_IMX7_PWMn_SIZE);
72
+ create_unimplemented_device("pwm3", FSL_IMX7_PWM3_ADDR, FSL_IMX7_PWMn_SIZE);
73
+ create_unimplemented_device("pwm4", FSL_IMX7_PWM4_ADDR, FSL_IMX7_PWMn_SIZE);
74
+
75
+ /*
76
+ * CAN
77
+ */
78
+ create_unimplemented_device("can1", FSL_IMX7_CAN1_ADDR, FSL_IMX7_CANn_SIZE);
79
+ create_unimplemented_device("can2", FSL_IMX7_CAN2_ADDR, FSL_IMX7_CANn_SIZE);
80
+
81
+ /*
82
+ * OCOTP
83
+ */
84
+ create_unimplemented_device("ocotp", FSL_IMX7_OCOTP_ADDR,
85
+ FSL_IMX7_OCOTP_SIZE);
86
87
object_property_set_bool(OBJECT(&s->gpr), true, "realized",
88
&error_abort);
89
--
32
--
90
2.20.1
33
2.20.1
91
34
92
35
diff view generated by jsdifflib
1
From: Geert Uytterhoeven <geert+renesas@glider.be>
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
2
2
3
Add a definition for the number of GPIO lines controlled by a PL061
3
Secure mode is not exempted from checking SCR_EL3.TLOR, and in the
4
instance, and use it instead of the hardcoded magic value 8.
4
future HCR_EL2.TLOR when S-EL2 is enabled.
5
5
6
Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
7
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20200519085143.1376-1-geert+renesas@glider.be
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
9
---
12
hw/gpio/pl061.c | 12 +++++++-----
10
target/arm/helper.c | 19 +++++--------------
13
1 file changed, 7 insertions(+), 5 deletions(-)
11
1 file changed, 5 insertions(+), 14 deletions(-)
14
12
15
diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/gpio/pl061.c
15
--- a/target/arm/helper.c
18
+++ b/hw/gpio/pl061.c
16
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ static const uint8_t pl061_id_luminary[12] =
17
@@ -XXX,XX +XXX,XX @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
20
#define TYPE_PL061 "pl061"
18
#endif
21
#define PL061(obj) OBJECT_CHECK(PL061State, (obj), TYPE_PL061)
19
22
20
/* Shared logic between LORID and the rest of the LOR* registers.
23
+#define N_GPIOS 8
21
- * Secure state has already been delt with.
24
+
22
+ * Secure state exclusion has already been dealt with.
25
typedef struct PL061State {
23
*/
26
SysBusDevice parent_obj;
24
-static CPAccessResult access_lor_ns(CPUARMState *env)
27
25
+static CPAccessResult access_lor_ns(CPUARMState *env,
28
@@ -XXX,XX +XXX,XX @@ typedef struct PL061State {
26
+ const ARMCPRegInfo *ri, bool isread)
29
uint32_t cr;
27
{
30
uint32_t amsel;
28
int el = arm_current_el(env);
31
qemu_irq irq;
29
32
- qemu_irq out[8];
30
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_ns(CPUARMState *env)
33
+ qemu_irq out[N_GPIOS];
31
return CP_ACCESS_OK;
34
const unsigned char *id;
35
uint32_t rsvd_start; /* reserved area: [rsvd_start, 0xfcc] */
36
} PL061State;
37
@@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s)
38
changed = s->old_out_data ^ out;
39
if (changed) {
40
s->old_out_data = out;
41
- for (i = 0; i < 8; i++) {
42
+ for (i = 0; i < N_GPIOS; i++) {
43
mask = 1 << i;
44
if (changed & mask) {
45
DPRINTF("Set output %d = %d\n", i, (out & mask) != 0);
46
@@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s)
47
changed = (s->old_in_data ^ s->data) & ~s->dir;
48
if (changed) {
49
s->old_in_data = s->data;
50
- for (i = 0; i < 8; i++) {
51
+ for (i = 0; i < N_GPIOS; i++) {
52
mask = 1 << i;
53
if (changed & mask) {
54
DPRINTF("Changed input %d = %d\n", i, (s->data & mask) != 0);
55
@@ -XXX,XX +XXX,XX @@ static void pl061_init(Object *obj)
56
memory_region_init_io(&s->iomem, obj, &pl061_ops, s, "pl061", 0x1000);
57
sysbus_init_mmio(sbd, &s->iomem);
58
sysbus_init_irq(sbd, &s->irq);
59
- qdev_init_gpio_in(dev, pl061_set_irq, 8);
60
- qdev_init_gpio_out(dev, s->out, 8);
61
+ qdev_init_gpio_in(dev, pl061_set_irq, N_GPIOS);
62
+ qdev_init_gpio_out(dev, s->out, N_GPIOS);
63
}
32
}
64
33
65
static void pl061_class_init(ObjectClass *klass, void *data)
34
-static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri,
35
- bool isread)
36
-{
37
- if (arm_is_secure_below_el3(env)) {
38
- /* Access ok in secure mode. */
39
- return CP_ACCESS_OK;
40
- }
41
- return access_lor_ns(env);
42
-}
43
-
44
static CPAccessResult access_lor_other(CPUARMState *env,
45
const ARMCPRegInfo *ri, bool isread)
46
{
47
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_lor_other(CPUARMState *env,
48
/* Access denied in secure mode. */
49
return CP_ACCESS_TRAP;
50
}
51
- return access_lor_ns(env);
52
+ return access_lor_ns(env, ri, isread);
53
}
54
55
/*
56
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lor_reginfo[] = {
57
.type = ARM_CP_CONST, .resetvalue = 0 },
58
{ .name = "LORID_EL1", .state = ARM_CP_STATE_AA64,
59
.opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7,
60
- .access = PL1_R, .accessfn = access_lorid,
61
+ .access = PL1_R, .accessfn = access_lor_ns,
62
.type = ARM_CP_CONST, .resetvalue = 0 },
63
REGINFO_SENTINEL
64
};
66
--
65
--
67
2.20.1
66
2.20.1
68
67
69
68
diff view generated by jsdifflib
1
The kernel has different handling for syscalls with invalid
1
If we're using the capstone disassembler, disassembly of a run of
2
numbers that are in the "arm-specific" range 0x9f0000 and up:
2
instructions more than 32 bytes long disassembles the wrong data for
3
* 0x9f0000..0x9f07ff return -ENOSYS if not implemented
3
instructions beyond the 32 byte mark:
4
* other out of range syscalls cause a SIGILL
5
(see the kernel's arch/arm/kernel/traps.c:arm_syscall())
6
4
7
Implement this distinction. (Note that our code doesn't look
5
(qemu) xp /16x 0x100
8
quite like the kernel's, because we have removed the
6
0000000000000100: 0x00000005 0x54410001 0x00000001 0x00001000
9
0x900000 prefix by this point, whereas the kernel retains
7
0000000000000110: 0x00000000 0x00000004 0x54410002 0x3c000000
10
it in arm_syscall().)
8
0000000000000120: 0x00000000 0x00000004 0x54410009 0x74736574
9
0000000000000130: 0x00000000 0x00000000 0x00000000 0x00000000
10
(qemu) xp /16i 0x100
11
0x00000100: 00000005 andeq r0, r0, r5
12
0x00000104: 54410001 strbpl r0, [r1], #-1
13
0x00000108: 00000001 andeq r0, r0, r1
14
0x0000010c: 00001000 andeq r1, r0, r0
15
0x00000110: 00000000 andeq r0, r0, r0
16
0x00000114: 00000004 andeq r0, r0, r4
17
0x00000118: 54410002 strbpl r0, [r1], #-2
18
0x0000011c: 3c000000 .byte 0x00, 0x00, 0x00, 0x3c
19
0x00000120: 54410001 strbpl r0, [r1], #-1
20
0x00000124: 00000001 andeq r0, r0, r1
21
0x00000128: 00001000 andeq r1, r0, r0
22
0x0000012c: 00000000 andeq r0, r0, r0
23
0x00000130: 00000004 andeq r0, r0, r4
24
0x00000134: 54410002 strbpl r0, [r1], #-2
25
0x00000138: 3c000000 .byte 0x00, 0x00, 0x00, 0x3c
26
0x0000013c: 00000000 andeq r0, r0, r0
11
27
28
Here the disassembly of 0x120..0x13f is using the data that is in
29
0x104..0x123.
30
31
This is caused by passing the wrong value to the read_memory_func().
32
The intention is that at this point in the loop the 'cap_buf' buffer
33
already contains 'csize' bytes of data for the instruction at guest
34
addr 'pc', and we want to read in an extra 'tsize' bytes. Those
35
extra bytes are therefore at 'pc + csize', not 'pc'. On the first
36
time through the loop 'csize' happens to be zero, so the initial read
37
of 32 bytes into cap_buf is correct and as long as the disassembly
38
never needs to read more data we return the correct information.
39
40
Use the correct guest address in the call to read_memory_func().
41
42
Cc: qemu-stable@nongnu.org
43
Fixes: https://bugs.launchpad.net/qemu/+bug/1900779
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
44
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
45
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-id: 20200420212206.12776-4-peter.maydell@linaro.org
46
Message-id: 20201022132445.25039-1-peter.maydell@linaro.org
15
---
47
---
16
linux-user/arm/cpu_loop.c | 30 ++++++++++++++++++++++++++----
48
disas/capstone.c | 2 +-
17
1 file changed, 26 insertions(+), 4 deletions(-)
49
1 file changed, 1 insertion(+), 1 deletion(-)
18
50
19
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
51
diff --git a/disas/capstone.c b/disas/capstone.c
20
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
21
--- a/linux-user/arm/cpu_loop.c
53
--- a/disas/capstone.c
22
+++ b/linux-user/arm/cpu_loop.c
54
+++ b/disas/capstone.c
23
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
55
@@ -XXX,XX +XXX,XX @@ bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count)
24
env->regs[0] = cpu_get_tls(env);
56
25
break;
57
/* Make certain that we can make progress. */
26
default:
58
assert(tsize != 0);
27
- qemu_log_mask(LOG_UNIMP,
59
- info->read_memory_func(pc, cap_buf + csize, tsize, info);
28
- "qemu: Unsupported ARM syscall: 0x%x\n",
60
+ info->read_memory_func(pc + csize, cap_buf + csize, tsize, info);
29
- n);
61
csize += tsize;
30
- env->regs[0] = -TARGET_ENOSYS;
62
31
+ if (n < 0xf0800) {
63
if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
32
+ /*
33
+ * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
34
+ * 0x9f07ff in OABI numbering) are defined
35
+ * to return -ENOSYS rather than raising
36
+ * SIGILL. Note that we have already
37
+ * removed the 0x900000 prefix.
38
+ */
39
+ qemu_log_mask(LOG_UNIMP,
40
+ "qemu: Unsupported ARM syscall: 0x%x\n",
41
+ n);
42
+ env->regs[0] = -TARGET_ENOSYS;
43
+ } else {
44
+ /* Otherwise SIGILL */
45
+ info.si_signo = TARGET_SIGILL;
46
+ info.si_errno = 0;
47
+ info.si_code = TARGET_ILL_ILLTRP;
48
+ info._sifields._sigfault._addr = env->regs[15];
49
+ if (env->thumb) {
50
+ info._sifields._sigfault._addr -= 2;
51
+ } else {
52
+ info._sifields._sigfault._addr -= 4;
53
+ }
54
+ queue_signal(env, info.si_signo,
55
+ QEMU_SI_FAULT, &info);
56
+ }
57
break;
58
}
59
} else {
60
--
64
--
61
2.20.1
65
2.20.1
62
66
63
67
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
Use the BIT_ULL() macro to ensure we use 64-bit arithmetic.
4
the accesses as unimplemented or guest error.
4
This fixes the following Coverity issue (OVERFLOW_BEFORE_WIDEN):
5
5
6
When fuzzing the devices, we don't want the whole process to
6
CID 1432363 (#1 of 1): Unintentional integer overflow:
7
exit. Replace some hw_error() calls by qemu_log_mask().
8
7
9
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
overflow_before_widen:
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Potentially overflowing expression 1 << scale with type int
11
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
(32 bits, signed) is evaluated using 32-bit arithmetic, and
12
Message-id: 20200518140309.5220-4-f4bug@amsat.org
11
then used in a context that expects an expression of type
12
hwaddr (64 bits, unsigned).
13
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Acked-by: Eric Auger <eric.auger@redhat.com>
16
Message-id: 20201030144617.1535064-1-philmd@redhat.com
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
19
---
15
hw/char/xilinx_uartlite.c | 5 +++--
20
hw/arm/smmuv3.c | 3 ++-
16
1 file changed, 3 insertions(+), 2 deletions(-)
21
1 file changed, 2 insertions(+), 1 deletion(-)
17
22
18
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
23
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
19
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/char/xilinx_uartlite.c
25
--- a/hw/arm/smmuv3.c
21
+++ b/hw/char/xilinx_uartlite.c
26
+++ b/hw/arm/smmuv3.c
22
@@ -XXX,XX +XXX,XX @@
27
@@ -XXX,XX +XXX,XX @@
23
*/
28
*/
24
29
25
#include "qemu/osdep.h"
30
#include "qemu/osdep.h"
26
-#include "hw/hw.h"
31
+#include "qemu/bitops.h"
27
+#include "qemu/log.h"
28
#include "hw/irq.h"
32
#include "hw/irq.h"
29
#include "hw/qdev-properties.h"
30
#include "hw/sysbus.h"
33
#include "hw/sysbus.h"
31
@@ -XXX,XX +XXX,XX @@ uart_write(void *opaque, hwaddr addr,
34
#include "migration/vmstate.h"
32
switch (addr)
35
@@ -XXX,XX +XXX,XX @@ static void smmuv3_s1_range_inval(SMMUState *s, Cmd *cmd)
33
{
36
scale = CMD_SCALE(cmd);
34
case R_STATUS:
37
num = CMD_NUM(cmd);
35
- hw_error("write to UART STATUS?\n");
38
ttl = CMD_TTL(cmd);
36
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: write to UART STATUS\n",
39
- num_pages = (num + 1) * (1 << (scale));
37
+ __func__);
40
+ num_pages = (num + 1) * BIT_ULL(scale);
38
break;
41
}
39
42
40
case R_CTRL:
43
if (type == SMMU_CMD_TLBI_NH_VA) {
41
--
44
--
42
2.20.1
45
2.20.1
43
46
44
47
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
2
2
3
In preparation for a full implementation, move i.MX watchdog driver
3
When booting a CPU with EL3 using the -kernel flag, set up CPTR_EL3 so
4
from hw/misc to hw/watchdog. While at it, add the watchdog files
4
that SVE will not trap to EL3.
5
to MAINTAINERS.
6
5
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200517162135.110364-2-linux@roeck-us.net
8
Message-id: 20201030151541.11976-1-remi@remlab.net
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
include/hw/arm/fsl-imx6.h | 2 +-
11
hw/arm/boot.c | 3 +++
13
include/hw/arm/fsl-imx6ul.h | 2 +-
12
1 file changed, 3 insertions(+)
14
include/hw/arm/fsl-imx7.h | 2 +-
15
include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} | 0
16
hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} | 2 +-
17
MAINTAINERS | 2 ++
18
hw/arm/Kconfig | 3 +++
19
hw/misc/Makefile.objs | 1 -
20
hw/watchdog/Kconfig | 3 +++
21
hw/watchdog/Makefile.objs | 1 +
22
10 files changed, 13 insertions(+), 5 deletions(-)
23
rename include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} (100%)
24
rename hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} (98%)
25
13
26
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
14
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
27
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
28
--- a/include/hw/arm/fsl-imx6.h
16
--- a/hw/arm/boot.c
29
+++ b/include/hw/arm/fsl-imx6.h
17
+++ b/hw/arm/boot.c
30
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque)
31
#include "hw/cpu/a9mpcore.h"
19
if (cpu_isar_feature(aa64_mte, cpu)) {
32
#include "hw/misc/imx6_ccm.h"
20
env->cp15.scr_el3 |= SCR_ATA;
33
#include "hw/misc/imx6_src.h"
21
}
34
-#include "hw/misc/imx2_wdt.h"
22
+ if (cpu_isar_feature(aa64_sve, cpu)) {
35
+#include "hw/watchdog/wdt_imx2.h"
23
+ env->cp15.cptr_el[3] |= CPTR_EZ;
36
#include "hw/char/imx_serial.h"
24
+ }
37
#include "hw/timer/imx_gpt.h"
25
/* AArch64 kernels never boot in secure mode */
38
#include "hw/timer/imx_epit.h"
26
assert(!info->secure_boot);
39
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
27
/* This hook is only supported for AArch32 currently:
40
index XXXXXXX..XXXXXXX 100644
41
--- a/include/hw/arm/fsl-imx6ul.h
42
+++ b/include/hw/arm/fsl-imx6ul.h
43
@@ -XXX,XX +XXX,XX @@
44
#include "hw/misc/imx7_snvs.h"
45
#include "hw/misc/imx7_gpr.h"
46
#include "hw/intc/imx_gpcv2.h"
47
-#include "hw/misc/imx2_wdt.h"
48
+#include "hw/watchdog/wdt_imx2.h"
49
#include "hw/gpio/imx_gpio.h"
50
#include "hw/char/imx_serial.h"
51
#include "hw/timer/imx_gpt.h"
52
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
53
index XXXXXXX..XXXXXXX 100644
54
--- a/include/hw/arm/fsl-imx7.h
55
+++ b/include/hw/arm/fsl-imx7.h
56
@@ -XXX,XX +XXX,XX @@
57
#include "hw/misc/imx7_snvs.h"
58
#include "hw/misc/imx7_gpr.h"
59
#include "hw/misc/imx6_src.h"
60
-#include "hw/misc/imx2_wdt.h"
61
+#include "hw/watchdog/wdt_imx2.h"
62
#include "hw/gpio/imx_gpio.h"
63
#include "hw/char/imx_serial.h"
64
#include "hw/timer/imx_gpt.h"
65
diff --git a/include/hw/misc/imx2_wdt.h b/include/hw/watchdog/wdt_imx2.h
66
similarity index 100%
67
rename from include/hw/misc/imx2_wdt.h
68
rename to include/hw/watchdog/wdt_imx2.h
69
diff --git a/hw/misc/imx2_wdt.c b/hw/watchdog/wdt_imx2.c
70
similarity index 98%
71
rename from hw/misc/imx2_wdt.c
72
rename to hw/watchdog/wdt_imx2.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/hw/misc/imx2_wdt.c
75
+++ b/hw/watchdog/wdt_imx2.c
76
@@ -XXX,XX +XXX,XX @@
77
#include "qemu/module.h"
78
#include "sysemu/watchdog.h"
79
80
-#include "hw/misc/imx2_wdt.h"
81
+#include "hw/watchdog/wdt_imx2.h"
82
83
#define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset WDOG_B */
84
#define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset Signal */
85
diff --git a/MAINTAINERS b/MAINTAINERS
86
index XXXXXXX..XXXXXXX 100644
87
--- a/MAINTAINERS
88
+++ b/MAINTAINERS
89
@@ -XXX,XX +XXX,XX @@ S: Odd Fixes
90
F: hw/arm/fsl-imx25.c
91
F: hw/arm/imx25_pdk.c
92
F: hw/misc/imx25_ccm.c
93
+F: hw/watchdog/wdt_imx2.c
94
F: include/hw/arm/fsl-imx25.h
95
F: include/hw/misc/imx25_ccm.h
96
+F: include/hw/watchdog/wdt_imx2.h
97
98
i.MX31 (kzm)
99
M: Peter Chubb <peter.chubb@nicta.com.au>
100
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/arm/Kconfig
103
+++ b/hw/arm/Kconfig
104
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
105
select IMX_FEC
106
select IMX_I2C
107
select IMX_USBPHY
108
+ select WDT_IMX2
109
select SDHCI
110
111
config ASPEED_SOC
112
@@ -XXX,XX +XXX,XX @@ config FSL_IMX7
113
select IMX
114
select IMX_FEC
115
select IMX_I2C
116
+ select WDT_IMX2
117
select PCI_EXPRESS_DESIGNWARE
118
select SDHCI
119
select UNIMP
120
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL
121
select IMX
122
select IMX_FEC
123
select IMX_I2C
124
+ select WDT_IMX2
125
select SDHCI
126
select UNIMP
127
128
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
129
index XXXXXXX..XXXXXXX 100644
130
--- a/hw/misc/Makefile.objs
131
+++ b/hw/misc/Makefile.objs
132
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_IMX) += imx6_ccm.o
133
common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
134
obj-$(CONFIG_IMX) += imx6_src.o
135
common-obj-$(CONFIG_IMX) += imx7_ccm.o
136
-common-obj-$(CONFIG_IMX) += imx2_wdt.o
137
common-obj-$(CONFIG_IMX) += imx7_snvs.o
138
common-obj-$(CONFIG_IMX) += imx7_gpr.o
139
common-obj-$(CONFIG_IMX) += imx_rngc.o
140
diff --git a/hw/watchdog/Kconfig b/hw/watchdog/Kconfig
141
index XXXXXXX..XXXXXXX 100644
142
--- a/hw/watchdog/Kconfig
143
+++ b/hw/watchdog/Kconfig
144
@@ -XXX,XX +XXX,XX @@ config WDT_IB700
145
146
config WDT_DIAG288
147
bool
148
+
149
+config WDT_IMX2
150
+ bool
151
diff --git a/hw/watchdog/Makefile.objs b/hw/watchdog/Makefile.objs
152
index XXXXXXX..XXXXXXX 100644
153
--- a/hw/watchdog/Makefile.objs
154
+++ b/hw/watchdog/Makefile.objs
155
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
156
common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
157
common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
158
common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o
159
+common-obj-$(CONFIG_WDT_IMX2) += wdt_imx2.o
160
--
28
--
161
2.20.1
29
2.20.1
162
30
163
31
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: AlexChen <alex.chen@huawei.com>
2
2
3
With this patch applied, the watchdog in the sabrelite emulation
3
In omap_lcd_interrupts(), the pointer omap_lcd is dereferinced before
4
is fully operational, including pretimeout support.
4
being check if it is valid, which may lead to NULL pointer dereference.
5
So move the assignment to surface after checking that the omap_lcd is valid
6
and move surface_bits_per_pixel(surface) to after the surface assignment.
5
7
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reported-by: Euler Robot <euler.robot@huawei.com>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
Signed-off-by: AlexChen <alex.chen@huawei.com>
8
Message-id: 20200517162135.110364-6-linux@roeck-us.net
10
Message-id: 5F9CDB8A.9000001@huawei.com
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/fsl-imx6.c | 9 +++++++++
14
hw/display/omap_lcdc.c | 10 +++++++---
12
1 file changed, 9 insertions(+)
15
1 file changed, 7 insertions(+), 3 deletions(-)
13
16
14
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
17
diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/fsl-imx6.c
19
--- a/hw/display/omap_lcdc.c
17
+++ b/hw/arm/fsl-imx6.c
20
+++ b/hw/display/omap_lcdc.c
18
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
21
@@ -XXX,XX +XXX,XX @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s *s)
19
FSL_IMX6_WDOG1_ADDR,
22
static void omap_update_display(void *opaque)
20
FSL_IMX6_WDOG2_ADDR,
23
{
21
};
24
struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque;
22
+ static const int FSL_IMX6_WDOGn_IRQ[FSL_IMX6_NUM_WDTS] = {
25
- DisplaySurface *surface = qemu_console_surface(omap_lcd->con);
23
+ FSL_IMX6_WDOG1_IRQ,
26
+ DisplaySurface *surface;
24
+ FSL_IMX6_WDOG2_IRQ,
27
draw_line_func draw_line;
25
+ };
28
int size, height, first, last;
26
29
int width, linesize, step, bpp, frame_offset;
27
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
30
hwaddr frame_base;
28
+ &error_abort);
31
29
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
32
- if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable ||
30
&error_abort);
33
- !surface_bits_per_pixel(surface)) {
31
34
+ if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable) {
32
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]);
35
+ return;
33
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
36
+ }
34
+ qdev_get_gpio_in(DEVICE(&s->a9mpcore),
37
+
35
+ FSL_IMX6_WDOGn_IRQ[i]));
38
+ surface = qemu_console_surface(omap_lcd->con);
39
+ if (!surface_bits_per_pixel(surface)) {
40
return;
36
}
41
}
37
42
38
/* ROM memory */
39
--
43
--
40
2.20.1
44
2.20.1
41
45
42
46
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: AlexChen <alex.chen@huawei.com>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
In exynos4210_fimd_update(), the pointer s is dereferinced before
4
the accesses as unimplemented or guest error.
4
being check if it is valid, which may lead to NULL pointer dereference.
5
So move the assignment to global_width after checking that the s is valid.
5
6
6
When fuzzing the devices, we don't want the whole process to
7
Reported-by: Euler Robot <euler.robot@huawei.com>
7
exit. Replace some hw_error() calls by qemu_log_mask().
8
Signed-off-by: Alex Chen <alex.chen@huawei.com>
8
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Message-id: 5F9F8D88.9030102@huawei.com
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20200518140309.5220-2-f4bug@amsat.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
12
---
14
hw/arm/integratorcp.c | 23 +++++++++++++++--------
13
hw/display/exynos4210_fimd.c | 4 +++-
15
1 file changed, 15 insertions(+), 8 deletions(-)
14
1 file changed, 3 insertions(+), 1 deletion(-)
16
15
17
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
16
diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c
18
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/integratorcp.c
18
--- a/hw/display/exynos4210_fimd.c
20
+++ b/hw/arm/integratorcp.c
19
+++ b/hw/display/exynos4210_fimd.c
21
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_fimd_update(void *opaque)
22
#include "exec/address-spaces.h"
21
bool blend = false;
23
#include "sysemu/runstate.h"
22
uint8_t *host_fb_addr;
24
#include "sysemu/sysemu.h"
23
bool is_dirty = false;
25
+#include "qemu/log.h"
24
- const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
26
#include "qemu/error-report.h"
25
+ int global_width;
27
#include "hw/char/pl011.h"
26
28
#include "hw/hw.h"
27
if (!s || !s->console || !s->enabled ||
29
@@ -XXX,XX +XXX,XX @@ static uint64_t integratorcm_read(void *opaque, hwaddr offset,
28
surface_bits_per_pixel(qemu_console_surface(s->console)) == 0) {
30
/* ??? Voltage control unimplemented. */
31
return 0;
32
default:
33
- hw_error("integratorcm_read: Unimplemented offset 0x%x\n",
34
- (int)offset);
35
+ qemu_log_mask(LOG_UNIMP,
36
+ "%s: Unimplemented offset 0x%" HWADDR_PRIX "\n",
37
+ __func__, offset);
38
return 0;
39
}
40
}
41
@@ -XXX,XX +XXX,XX @@ static void integratorcm_write(void *opaque, hwaddr offset,
42
/* ??? Voltage control unimplemented. */
43
break;
44
default:
45
- hw_error("integratorcm_write: Unimplemented offset 0x%x\n",
46
- (int)offset);
47
+ qemu_log_mask(LOG_UNIMP,
48
+ "%s: Unimplemented offset 0x%" HWADDR_PRIX "\n",
49
+ __func__, offset);
50
break;
51
}
52
}
53
@@ -XXX,XX +XXX,XX @@ static uint64_t icp_pic_read(void *opaque, hwaddr offset,
54
case 5: /* INT_SOFTCLR */
55
case 11: /* FRQ_ENABLECLR */
56
default:
57
- printf ("icp_pic_read: Bad register offset 0x%x\n", (int)offset);
58
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
59
+ __func__, offset);
60
return 0;
61
}
62
}
63
@@ -XXX,XX +XXX,XX @@ static void icp_pic_write(void *opaque, hwaddr offset,
64
case 8: /* FRQ_STATUS */
65
case 9: /* FRQ_RAWSTAT */
66
default:
67
- printf ("icp_pic_write: Bad register offset 0x%x\n", (int)offset);
68
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
69
+ __func__, offset);
70
return;
29
return;
71
}
30
}
72
icp_pic_update(s);
31
+
73
@@ -XXX,XX +XXX,XX @@ static uint64_t icp_control_read(void *opaque, hwaddr offset,
32
+ global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
74
case 3: /* CP_DECODE */
33
exynos4210_update_resolution(s);
75
return 0x11;
34
surface = qemu_console_surface(s->console);
76
default:
77
- hw_error("icp_control_read: Bad offset %x\n", (int)offset);
78
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
79
+ __func__, offset);
80
return 0;
81
}
82
}
83
@@ -XXX,XX +XXX,XX @@ static void icp_control_write(void *opaque, hwaddr offset,
84
/* Nothing interesting implemented yet. */
85
break;
86
default:
87
- hw_error("icp_control_write: Bad offset %x\n", (int)offset);
88
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
89
+ __func__, offset);
90
}
91
}
92
35
93
--
36
--
94
2.20.1
37
2.20.1
95
38
96
39
diff view generated by jsdifflib
1
Using the MSR instruction to write to CPSR.E is deprecated, but it is
1
In arm_v7m_mmu_idx_for_secstate() we get the 'priv' level to pass to
2
required to work from any mode including unprivileged code. We were
2
armv7m_mmu_idx_for_secstate_and_priv() by calling arm_current_el().
3
incorrectly forbidding usermode code from writing it because
3
This is incorrect when the security state being queried is not the
4
CPSR_USER did not include the CPSR_E bit.
4
current one, because arm_current_el() uses the current security state
5
to determine which of the banked CONTROL.nPRIV bits to look at.
6
The effect was that if (for instance) Secure state was in privileged
7
mode but Non-Secure was not then we would return the wrong MMU index.
5
8
6
We use CPSR_USER in only three places:
9
The only places where we are using this function in a way that could
7
* as the mask of what to allow userspace MSR to write to CPSR
10
trigger this bug are for the stack loads during a v8M function-return
8
* when deciding what bits a linux-user signal-return should be
11
and for the instruction fetch of a v8M SG insn.
9
able to write from the sigcontext structure
10
* in target_user_copy_regs() when we set up the initial
11
registers for the linux-user process
12
12
13
In the first two cases not being able to update CPSR.E is a bug, and
13
Fix the bug by expanding out the M-profile version of the
14
in the third case it doesn't matter because CPSR.E is always 0 there.
14
arm_current_el() logic inline so it can use the passed in secstate
15
So we can fix both bugs by adding CPSR_E to CPSR_USER.
15
rather than env->v7m.secure.
16
17
Because the cpsr_write() in restore_sigcontext() is now changing
18
a CPSR bit which is cached in hflags, we need to add an
19
arm_rebuild_hflags() call there; the callsite in
20
target_user_copy_regs() was already rebuilding hflags for other
21
reasons.
22
23
(The recommended way to change CPSR.E is to use the 'SETEND'
24
instruction, which we do correctly allow from usermode code.)
25
16
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
28
Message-id: 20200518142801.20503-1-peter.maydell@linaro.org
19
Message-id: 20201022164408.13214-1-peter.maydell@linaro.org
29
---
20
---
30
target/arm/cpu.h | 2 +-
21
target/arm/m_helper.c | 3 ++-
31
linux-user/arm/signal.c | 1 +
22
1 file changed, 2 insertions(+), 1 deletion(-)
32
2 files changed, 2 insertions(+), 1 deletion(-)
33
23
34
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
35
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/cpu.h
26
--- a/target/arm/m_helper.c
37
+++ b/target/arm/cpu.h
27
+++ b/target/arm/m_helper.c
38
@@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu);
28
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
39
#define CACHED_CPSR_BITS (CPSR_T | CPSR_AIF | CPSR_GE | CPSR_IT | CPSR_Q \
29
/* Return the MMU index for a v7M CPU in the specified security state */
40
| CPSR_NZCV)
30
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
41
/* Bits writable in user mode. */
31
{
42
-#define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE)
32
- bool priv = arm_current_el(env) != 0;
43
+#define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE | CPSR_E)
33
+ bool priv = arm_v7m_is_handler_mode(env) ||
44
/* Execution state bits. MRS read as zero, MSR writes ignored. */
34
+ !(env->v7m.control[secstate] & 1);
45
#define CPSR_EXEC (CPSR_T | CPSR_IT | CPSR_J | CPSR_IL)
35
46
36
return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
47
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
37
}
48
index XXXXXXX..XXXXXXX 100644
49
--- a/linux-user/arm/signal.c
50
+++ b/linux-user/arm/signal.c
51
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
52
#ifdef TARGET_CONFIG_CPU_32
53
__get_user(cpsr, &sc->arm_cpsr);
54
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
55
+ arm_rebuild_hflags(env);
56
#endif
57
58
err |= !valid_user_regs(env);
59
--
38
--
60
2.20.1
39
2.20.1
61
40
62
41
diff view generated by jsdifflib
1
Our code to identify syscall numbers has some issues:
1
On some hosts (eg Ubuntu Bionic) pkg-config returns a set of
2
* for Thumb mode, we never need the immediate value from the insn,
2
libraries for gio-2.0 which don't actually work when compiling
3
but we always read it anyway
3
statically. (Specifically, the returned library string includes
4
* bad immediate values in the svc insn should cause a SIGILL, but we
4
-lmount, but not -lblkid which -lmount depends upon, so linking
5
were abort()ing instead (via "goto error")
5
fails due to missing symbols.)
6
6
7
We can fix both these things by refactoring the code that identifies
7
Check that the libraries work, and don't enable gio if they don't,
8
the syscall number to more closely follow the kernel COMPAT_OABI code:
8
in the same way we do for gnutls.
9
* for Thumb it is always r7
10
* for Arm, if the immediate value is 0, then this is an EABI call
11
with the syscall number in r7
12
* otherwise, we XOR the immediate value with 0x900000
13
(ARM_SYSCALL_BASE for QEMU; __NR_OABI_SYSCALL_BASE in the kernel),
14
which converts valid syscall immediates into the desired value,
15
and puts all invalid immediates in the range 0x100000 or above
16
* then we can just let the existing "value too large, deliver
17
SIGILL" case handle invalid numbers, and drop the 'goto error'
18
9
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
11
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
21
Message-id: 20200420212206.12776-5-peter.maydell@linaro.org
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20200928160402.7961-1-peter.maydell@linaro.org
22
---
14
---
23
linux-user/arm/cpu_loop.c | 143 ++++++++++++++++++++------------------
15
configure | 10 +++++++++-
24
1 file changed, 77 insertions(+), 66 deletions(-)
16
1 file changed, 9 insertions(+), 1 deletion(-)
25
17
26
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
18
diff --git a/configure b/configure
27
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100755
28
--- a/linux-user/arm/cpu_loop.c
20
--- a/configure
29
+++ b/linux-user/arm/cpu_loop.c
21
+++ b/configure
30
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
22
@@ -XXX,XX +XXX,XX @@ if test "$static" = yes && test "$mingw32" = yes; then
31
env->eabi = 1;
23
fi
32
/* system call */
24
33
if (env->thumb) {
25
if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
34
- /* FIXME - what to do if get_user() fails? */
26
- gio=yes
35
- get_user_code_u16(insn, env->regs[15] - 2, env);
27
gio_cflags=$($pkg_config --cflags gio-2.0)
36
- n = insn & 0xff;
28
gio_libs=$($pkg_config --libs gio-2.0)
37
+ /* Thumb is always EABI style with syscall number in r7 */
29
gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
38
+ n = env->regs[7];
30
if [ ! -x "$gdbus_codegen" ]; then
39
} else {
31
gdbus_codegen=
40
+ /*
32
fi
41
+ * Equivalent of kernel CONFIG_OABI_COMPAT: read the
33
+ # Check that the libraries actually work -- Ubuntu 18.04 ships
42
+ * Arm SVC insn to extract the immediate, which is the
34
+ # with pkg-config --static --libs data for gio-2.0 that is missing
43
+ * syscall number in OABI.
35
+ # -lblkid and will give a link error.
44
+ */
36
+ write_c_skeleton
45
/* FIXME - what to do if get_user() fails? */
37
+ if compile_prog "" "gio_libs" ; then
46
get_user_code_u32(insn, env->regs[15] - 4, env);
38
+ gio=yes
47
n = insn & 0xffffff;
39
+ else
48
- }
40
+ gio=no
49
-
41
+ fi
50
- if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
42
else
51
- /* linux syscall */
43
gio=no
52
- if (env->thumb || n == 0) {
44
fi
53
+ if (n == 0) {
54
+ /* zero immediate: EABI, syscall number in r7 */
55
n = env->regs[7];
56
} else {
57
- n -= ARM_SYSCALL_BASE;
58
+ /*
59
+ * This XOR matches the kernel code: an immediate
60
+ * in the valid range (0x900000 .. 0x9fffff) is
61
+ * converted into the correct EABI-style syscall
62
+ * number; invalid immediates end up as values
63
+ * > 0xfffff and are handled below as out-of-range.
64
+ */
65
+ n ^= ARM_SYSCALL_BASE;
66
env->eabi = 0;
67
}
68
- if ( n > ARM_NR_BASE) {
69
- switch (n) {
70
- case ARM_NR_cacheflush:
71
- /* nop */
72
- break;
73
- case ARM_NR_set_tls:
74
- cpu_set_tls(env, env->regs[0]);
75
- env->regs[0] = 0;
76
- break;
77
- case ARM_NR_breakpoint:
78
- env->regs[15] -= env->thumb ? 2 : 4;
79
- goto excp_debug;
80
- case ARM_NR_get_tls:
81
- env->regs[0] = cpu_get_tls(env);
82
- break;
83
- default:
84
- if (n < 0xf0800) {
85
- /*
86
- * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
87
- * 0x9f07ff in OABI numbering) are defined
88
- * to return -ENOSYS rather than raising
89
- * SIGILL. Note that we have already
90
- * removed the 0x900000 prefix.
91
- */
92
- qemu_log_mask(LOG_UNIMP,
93
- "qemu: Unsupported ARM syscall: 0x%x\n",
94
- n);
95
- env->regs[0] = -TARGET_ENOSYS;
96
+ }
97
+
98
+ if (n > ARM_NR_BASE) {
99
+ switch (n) {
100
+ case ARM_NR_cacheflush:
101
+ /* nop */
102
+ break;
103
+ case ARM_NR_set_tls:
104
+ cpu_set_tls(env, env->regs[0]);
105
+ env->regs[0] = 0;
106
+ break;
107
+ case ARM_NR_breakpoint:
108
+ env->regs[15] -= env->thumb ? 2 : 4;
109
+ goto excp_debug;
110
+ case ARM_NR_get_tls:
111
+ env->regs[0] = cpu_get_tls(env);
112
+ break;
113
+ default:
114
+ if (n < 0xf0800) {
115
+ /*
116
+ * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
117
+ * 0x9f07ff in OABI numbering) are defined
118
+ * to return -ENOSYS rather than raising
119
+ * SIGILL. Note that we have already
120
+ * removed the 0x900000 prefix.
121
+ */
122
+ qemu_log_mask(LOG_UNIMP,
123
+ "qemu: Unsupported ARM syscall: 0x%x\n",
124
+ n);
125
+ env->regs[0] = -TARGET_ENOSYS;
126
+ } else {
127
+ /*
128
+ * Otherwise SIGILL. This includes any SWI with
129
+ * immediate not originally 0x9fxxxx, because
130
+ * of the earlier XOR.
131
+ */
132
+ info.si_signo = TARGET_SIGILL;
133
+ info.si_errno = 0;
134
+ info.si_code = TARGET_ILL_ILLTRP;
135
+ info._sifields._sigfault._addr = env->regs[15];
136
+ if (env->thumb) {
137
+ info._sifields._sigfault._addr -= 2;
138
} else {
139
- /* Otherwise SIGILL */
140
- info.si_signo = TARGET_SIGILL;
141
- info.si_errno = 0;
142
- info.si_code = TARGET_ILL_ILLTRP;
143
- info._sifields._sigfault._addr = env->regs[15];
144
- if (env->thumb) {
145
- info._sifields._sigfault._addr -= 2;
146
- } else {
147
- info._sifields._sigfault._addr -= 4;
148
- }
149
- queue_signal(env, info.si_signo,
150
- QEMU_SI_FAULT, &info);
151
+ info._sifields._sigfault._addr -= 4;
152
}
153
- break;
154
- }
155
- } else {
156
- ret = do_syscall(env,
157
- n,
158
- env->regs[0],
159
- env->regs[1],
160
- env->regs[2],
161
- env->regs[3],
162
- env->regs[4],
163
- env->regs[5],
164
- 0, 0);
165
- if (ret == -TARGET_ERESTARTSYS) {
166
- env->regs[15] -= env->thumb ? 2 : 4;
167
- } else if (ret != -TARGET_QEMU_ESIGRETURN) {
168
- env->regs[0] = ret;
169
+ queue_signal(env, info.si_signo,
170
+ QEMU_SI_FAULT, &info);
171
}
172
+ break;
173
}
174
} else {
175
- goto error;
176
+ ret = do_syscall(env,
177
+ n,
178
+ env->regs[0],
179
+ env->regs[1],
180
+ env->regs[2],
181
+ env->regs[3],
182
+ env->regs[4],
183
+ env->regs[5],
184
+ 0, 0);
185
+ if (ret == -TARGET_ERESTARTSYS) {
186
+ env->regs[15] -= env->thumb ? 2 : 4;
187
+ } else if (ret != -TARGET_QEMU_ESIGRETURN) {
188
+ env->regs[0] = ret;
189
+ }
190
}
191
}
192
break;
193
--
45
--
194
2.20.1
46
2.20.1
195
47
196
48
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
In gicv3_init_cpuif() we copy the ARMCPU gicv3_maintenance_interrupt
2
into the GICv3CPUState struct's maintenance_irq field. This will
3
only work if the board happens to have already wired up the CPU
4
maintenance IRQ before the GIC was realized. Unfortunately this is
5
not the case for the 'virt' board, and so the value that gets copied
6
is NULL (since a qemu_irq is really a pointer to an IRQState struct
7
under the hood). The effect is that the CPU interface code never
8
actually raises the maintenance interrupt line.
2
9
3
With this patch, the watchdog on i.MX31 emulations is fully operational.
10
Instead, since the GICv3CPUState has a pointer to the CPUState, make
11
the dereference at the point where we want to raise the interrupt, to
12
avoid an implicit requirement on board code to wire things up in a
13
particular order.
4
14
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reported-by: Jose Martins <josemartins90@gmail.com>
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Message-id: 20200517162135.110364-5-linux@roeck-us.net
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Message-id: 20201009153904.28529-1-peter.maydell@linaro.org
18
Reviewed-by: Luc Michel <luc@lmichel.fr>
9
---
19
---
10
include/hw/arm/fsl-imx31.h | 4 ++++
20
include/hw/intc/arm_gicv3_common.h | 1 -
11
hw/arm/fsl-imx31.c | 6 ++++++
21
hw/intc/arm_gicv3_cpuif.c | 5 ++---
12
hw/arm/Kconfig | 1 +
22
2 files changed, 2 insertions(+), 4 deletions(-)
13
3 files changed, 11 insertions(+)
14
23
15
diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h
24
diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h
16
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx31.h
26
--- a/include/hw/intc/arm_gicv3_common.h
18
+++ b/include/hw/arm/fsl-imx31.h
27
+++ b/include/hw/intc/arm_gicv3_common.h
19
@@ -XXX,XX +XXX,XX @@
28
@@ -XXX,XX +XXX,XX @@ struct GICv3CPUState {
20
#include "hw/timer/imx_epit.h"
29
qemu_irq parent_fiq;
21
#include "hw/i2c/imx_i2c.h"
30
qemu_irq parent_virq;
22
#include "hw/gpio/imx_gpio.h"
31
qemu_irq parent_vfiq;
23
+#include "hw/watchdog/wdt_imx2.h"
32
- qemu_irq maintenance_irq;
24
#include "exec/memory.h"
33
25
#include "target/arm/cpu.h"
34
/* Redistributor */
26
35
uint32_t level; /* Current IRQ level */
27
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX31State {
36
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
28
IMXEPITState epit[FSL_IMX31_NUM_EPITS];
29
IMXI2CState i2c[FSL_IMX31_NUM_I2CS];
30
IMXGPIOState gpio[FSL_IMX31_NUM_GPIOS];
31
+ IMX2WdtState wdt;
32
MemoryRegion secure_rom;
33
MemoryRegion rom;
34
MemoryRegion iram;
35
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX31State {
36
#define FSL_IMX31_GPIO1_SIZE 0x4000
37
#define FSL_IMX31_GPIO2_ADDR 0x53FD0000
38
#define FSL_IMX31_GPIO2_SIZE 0x4000
39
+#define FSL_IMX31_WDT_ADDR 0x53FDC000
40
+#define FSL_IMX31_WDT_SIZE 0x4000
41
#define FSL_IMX31_AVIC_ADDR 0x68000000
42
#define FSL_IMX31_AVIC_SIZE 0x100
43
#define FSL_IMX31_SDRAM0_ADDR 0x80000000
44
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
45
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/fsl-imx31.c
38
--- a/hw/intc/arm_gicv3_cpuif.c
47
+++ b/hw/arm/fsl-imx31.c
39
+++ b/hw/intc/arm_gicv3_cpuif.c
48
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
40
@@ -XXX,XX +XXX,XX @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs)
49
sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]),
41
int irqlevel = 0;
50
TYPE_IMX_GPIO);
42
int fiqlevel = 0;
51
}
43
int maintlevel = 0;
52
+
44
+ ARMCPU *cpu = ARM_CPU(cs->cpu);
53
+ sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
45
46
idx = hppvi_index(cs);
47
trace_gicv3_cpuif_virt_update(gicv3_redist_affid(cs), idx);
48
@@ -XXX,XX +XXX,XX @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs)
49
50
qemu_set_irq(cs->parent_vfiq, fiqlevel);
51
qemu_set_irq(cs->parent_virq, irqlevel);
52
- qemu_set_irq(cs->maintenance_irq, maintlevel);
53
+ qemu_set_irq(cpu->gicv3_maintenance_interrupt, maintlevel);
54
}
54
}
55
55
56
static void fsl_imx31_realize(DeviceState *dev, Error **errp)
56
static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
57
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
57
@@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s)
58
gpio_table[i].irq));
58
&& cpu->gic_num_lrs) {
59
}
59
int j;
60
60
61
+ /* Watchdog */
61
- cs->maintenance_irq = cpu->gicv3_maintenance_interrupt;
62
+ object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
62
-
63
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR);
63
cs->num_list_regs = cpu->gic_num_lrs;
64
+
64
cs->vpribits = cpu->gic_vpribits;
65
/* On a real system, the first 16k is a `secure boot rom' */
65
cs->vprebits = cpu->gic_vprebits;
66
memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom",
67
FSL_IMX31_SECURE_ROM_SIZE, &err);
68
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
69
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/arm/Kconfig
71
+++ b/hw/arm/Kconfig
72
@@ -XXX,XX +XXX,XX @@ config FSL_IMX31
73
select SERIAL
74
select IMX
75
select IMX_I2C
76
+ select WDT_IMX2
77
select LAN9118
78
79
config FSL_IMX6
80
--
66
--
81
2.20.1
67
2.20.1
82
68
83
69
diff view generated by jsdifflib
1
We incorrectly treat SVC 0xf0002 as a cacheflush request (which is a
1
The kerneldoc script currently emits Sphinx markup for a macro with
2
NOP for QEMU). This is the wrong syscall number, because in the
2
arguments that uses the c:function directive. This is correct for
3
svc-immediate OABI syscall numbers are all offset by the
3
Sphinx versions earlier than Sphinx 3, where c:macro doesn't allow
4
ARM_SYSCALL_BASE value and so the correct insn is SVC 0x9f0002.
4
documentation of macros with arguments and c:function is not picky
5
(This is handled further down in the code with the other Arm-specific
5
about the syntax of what it is passed. However, in Sphinx 3 the
6
syscalls like NR_breakpoint.)
6
c:macro directive was enhanced to support macros with arguments,
7
and c:function was made more picky about what syntax it accepted.
7
8
8
When this code was initially added in commit 6f1f31c069b20611 in
9
When kerneldoc is told that it needs to produce output for Sphinx
9
2004, ARM_NR_cacheflush was defined as (ARM_SYSCALL_BASE + 0xf0000 + 2)
10
3 or later, make it emit c:function only for functions and c:macro
10
so the value in the comparison took account of the extra 0x900000
11
for macros with arguments. We assume that anything with a return
11
offset. In commit fbb4a2e371f2fa7 in 2008, the ARM_SYSCALL_BASE
12
type is a function and anything without is a macro.
12
was removed from the definition of ARM_NR_cacheflush and handling
13
for this group of syscalls was added below the point where we subtract
14
ARM_SYSCALL_BASE from the SVC immediate value. However that commit
15
forgot to remove the now-obsolete earlier handling code.
16
13
17
Remove the spurious ARM_NR_cacheflush condition.
14
This fixes the Sphinx error:
15
16
/home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/qom/object.h:155:Error in declarator
17
If declarator-id with parameters (e.g., 'void f(int arg)'):
18
Invalid C declaration: Expected identifier in nested name. [error at 25]
19
DECLARE_INSTANCE_CHECKER ( InstanceType, OBJ_NAME, TYPENAME)
20
-------------------------^
21
If parenthesis in noptr-declarator (e.g., 'void (*f(int arg))(double)'):
22
Error in declarator or parameters
23
Invalid C declaration: Expecting "(" in parameters. [error at 39]
24
DECLARE_INSTANCE_CHECKER ( InstanceType, OBJ_NAME, TYPENAME)
25
---------------------------------------^
18
26
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
28
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
21
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
29
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
22
Message-id: 20200420212206.12776-3-peter.maydell@linaro.org
30
Message-id: 20201030174700.7204-2-peter.maydell@linaro.org
23
---
31
---
24
linux-user/arm/cpu_loop.c | 4 +---
32
scripts/kernel-doc | 18 +++++++++++++++++-
25
1 file changed, 1 insertion(+), 3 deletions(-)
33
1 file changed, 17 insertions(+), 1 deletion(-)
26
34
27
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
35
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
28
index XXXXXXX..XXXXXXX 100644
36
index XXXXXXX..XXXXXXX 100755
29
--- a/linux-user/arm/cpu_loop.c
37
--- a/scripts/kernel-doc
30
+++ b/linux-user/arm/cpu_loop.c
38
+++ b/scripts/kernel-doc
31
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
39
@@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) {
32
n = insn & 0xffffff;
40
    output_highlight_rst($args{'purpose'});
33
}
41
    $start = "\n\n**Syntax**\n\n ``";
34
42
} else {
35
- if (n == ARM_NR_cacheflush) {
43
-    print ".. c:function:: ";
36
- /* nop */
44
+ if ((split(/\./, $sphinx_version))[0] >= 3) {
37
- } else if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
45
+ # Sphinx 3 and later distinguish macros and functions and
38
+ if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
46
+ # complain if you use c:function with something that's not
39
/* linux syscall */
47
+ # syntactically valid as a function declaration.
40
if (env->thumb || n == 0) {
48
+ # We assume that anything with a return type is a function
41
n = env->regs[7];
49
+ # and anything without is a macro.
50
+ if ($args{'functiontype'} ne "") {
51
+ print ".. c:function:: ";
52
+ } else {
53
+ print ".. c:macro:: ";
54
+ }
55
+ } else {
56
+ # Older Sphinx don't support documenting macros that take
57
+ # arguments with c:macro, and don't complain about the use
58
+ # of c:function for this.
59
+ print ".. c:function:: ";
60
+ }
61
}
62
if ($args{'functiontype'} ne "") {
63
    $start .= $args{'functiontype'} . " " . $args{'function'} . " (";
42
--
64
--
43
2.20.1
65
2.20.1
44
66
45
67
diff view generated by jsdifflib
1
Provide a minimal documentation of the Musca boards.
1
Sphinx 3.2 is pickier than earlier versions about the option:: markup,
2
and complains about our usage in qemu-option-trace.rst:
3
4
../../docs/qemu-option-trace.rst.inc:4:Malformed option description
5
'[enable=]PATTERN', should look like "opt", "-opt args", "--opt args",
6
"/opt args" or "+opt args"
7
8
In this file, we're really trying to document the different parts of
9
the top-level --trace option, which qemu-nbd.rst and qemu-img.rst
10
have already introduced with an option:: markup. So it's not right
11
to use option:: here anyway. Switch to a different markup
12
(definition lists) which gives about the same formatted output.
13
14
(Unlike option::, this markup doesn't produce index entries; but
15
at the moment we don't do anything much with indexes anyway, and
16
in any case I think it doesn't make much sense to have individual
17
index entries for the sub-parts of the --trace option.)
2
18
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
20
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
21
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
22
Message-id: 20201030174700.7204-3-peter.maydell@linaro.org
7
Message-id: 20200507151819.28444-6-peter.maydell@linaro.org
8
---
23
---
9
docs/system/arm/musca.rst | 31 +++++++++++++++++++++++++++++++
24
docs/qemu-option-trace.rst.inc | 6 +++---
10
docs/system/target-arm.rst | 1 +
25
1 file changed, 3 insertions(+), 3 deletions(-)
11
MAINTAINERS | 1 +
12
3 files changed, 33 insertions(+)
13
create mode 100644 docs/system/arm/musca.rst
14
26
15
diff --git a/docs/system/arm/musca.rst b/docs/system/arm/musca.rst
27
diff --git a/docs/qemu-option-trace.rst.inc b/docs/qemu-option-trace.rst.inc
16
new file mode 100644
28
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX
29
--- a/docs/qemu-option-trace.rst.inc
18
--- /dev/null
30
+++ b/docs/qemu-option-trace.rst.inc
19
+++ b/docs/system/arm/musca.rst
20
@@ -XXX,XX +XXX,XX @@
31
@@ -XXX,XX +XXX,XX @@
21
+Arm Musca boards (``musca-a``, ``musca-b1``)
32
22
+============================================
33
Specify tracing options.
23
+
34
24
+The Arm Musca development boards are a reference implementation
35
-.. option:: [enable=]PATTERN
25
+of a system using the SSE-200 Subsystem for Embedded. They are
36
+``[enable=]PATTERN``
26
+dual Cortex-M33 systems.
37
27
+
38
Immediately enable events matching *PATTERN*
28
+QEMU provides models of the A and B1 variants of this board.
39
(either event name or a globbing pattern). This option is only
29
+
40
@@ -XXX,XX +XXX,XX @@ Specify tracing options.
30
+Unimplemented devices:
41
31
+
42
Use :option:`-trace help` to print a list of names of trace points.
32
+- SPI
43
33
+- |I2C|
44
-.. option:: events=FILE
34
+- |I2S|
45
+``events=FILE``
35
+- PWM
46
36
+- QSPI
47
Immediately enable events listed in *FILE*.
37
+- Timer
48
The file must contain one event name (as listed in the ``trace-events-all``
38
+- SCC
49
@@ -XXX,XX +XXX,XX @@ Specify tracing options.
39
+- GPIO
50
available if QEMU has been compiled with the ``simple``, ``log`` or
40
+- eFlash
51
``ftrace`` tracing backend.
41
+- MHU
52
42
+- PVT
53
-.. option:: file=FILE
43
+- SDIO
54
+``file=FILE``
44
+- CryptoCell
55
45
+
56
Log output traces to *FILE*.
46
+Note that (like the real hardware) the Musca-A machine is
57
This option is only available if QEMU has been compiled with
47
+asymmetric: CPU 0 does not have the FPU or DSP extensions,
48
+but CPU 1 does. Also like the real hardware, the memory maps
49
+for the A and B1 variants differ significantly, so guest
50
+software must be built for the right variant.
51
+
52
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
53
index XXXXXXX..XXXXXXX 100644
54
--- a/docs/system/target-arm.rst
55
+++ b/docs/system/target-arm.rst
56
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
57
58
arm/integratorcp
59
arm/mps2
60
+ arm/musca
61
arm/realview
62
arm/versatile
63
arm/vexpress
64
diff --git a/MAINTAINERS b/MAINTAINERS
65
index XXXXXXX..XXXXXXX 100644
66
--- a/MAINTAINERS
67
+++ b/MAINTAINERS
68
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
69
L: qemu-arm@nongnu.org
70
S: Maintained
71
F: hw/arm/musca.c
72
+F: docs/system/arm/musca.rst
73
74
Musicpal
75
M: Jan Kiszka <jan.kiszka@web.de>
76
--
58
--
77
2.20.1
59
2.20.1
78
60
79
61
diff view generated by jsdifflib
1
Sort the board index into alphabetical order. (Note that we need to
1
The randomness tests in the NPCM7xx RNG test fail intermittently
2
sort alphabetically by the title text of each file, which isn't the
2
but fairly frequently. On my machine running the test in a loop:
3
same ordering as sorting by the filename.)
3
while QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/npcm7xx_rng-test; do true; done
4
5
will fail in less than a minute with an error like:
6
ERROR:../../tests/qtest/npcm7xx_rng-test.c:256:test_first_byte_runs:
7
assertion failed (calc_runs_p(buf.l, sizeof(buf) * BITS_PER_BYTE) > 0.01): (0.00286205989 > 0.01)
8
9
(Failures have been observed on all 4 of the randomness tests,
10
not just first_byte_runs.)
11
12
It's not clear why these tests are failing like this, but intermittent
13
failures make CI and merge testing awkward, so disable running them
14
unless a developer specifically sets QEMU_TEST_FLAKY_RNG_TESTS when
15
running the test suite, until we work out the cause.
4
16
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
18
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
19
Message-id: 20201102152454.8287-1-peter.maydell@linaro.org
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
20
Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com>
9
Message-id: 20200507151819.28444-3-peter.maydell@linaro.org
10
---
21
---
11
docs/system/target-arm.rst | 17 +++++++++++------
22
tests/qtest/npcm7xx_rng-test.c | 14 ++++++++++----
12
1 file changed, 11 insertions(+), 6 deletions(-)
23
1 file changed, 10 insertions(+), 4 deletions(-)
13
24
14
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
25
diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c
15
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/target-arm.rst
27
--- a/tests/qtest/npcm7xx_rng-test.c
17
+++ b/docs/system/target-arm.rst
28
+++ b/tests/qtest/npcm7xx_rng-test.c
18
@@ -XXX,XX +XXX,XX @@ Unfortunately many of the Arm boards QEMU supports are currently
29
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
19
undocumented; you can get a complete list by running
30
20
``qemu-system-aarch64 --machine help``.
31
qtest_add_func("npcm7xx_rng/enable_disable", test_enable_disable);
21
32
qtest_add_func("npcm7xx_rng/rosel", test_rosel);
22
+..
33
- qtest_add_func("npcm7xx_rng/continuous/monobit", test_continuous_monobit);
23
+ This table of contents should be kept sorted alphabetically
34
- qtest_add_func("npcm7xx_rng/continuous/runs", test_continuous_runs);
24
+ by the title text of each file, which isn't the same ordering
35
- qtest_add_func("npcm7xx_rng/first_byte/monobit", test_first_byte_monobit);
25
+ as an alphabetical sort by filename.
36
- qtest_add_func("npcm7xx_rng/first_byte/runs", test_first_byte_runs);
26
+
37
+ /*
27
.. toctree::
38
+ * These tests fail intermittently; only run them on explicit
28
:maxdepth: 1
39
+ * request until we figure out why.
29
40
+ */
30
arm/integratorcp
41
+ if (getenv("QEMU_TEST_FLAKY_RNG_TESTS")) {
31
- arm/versatile
42
+ qtest_add_func("npcm7xx_rng/continuous/monobit", test_continuous_monobit);
32
arm/realview
43
+ qtest_add_func("npcm7xx_rng/continuous/runs", test_continuous_runs);
33
- arm/xscale
44
+ qtest_add_func("npcm7xx_rng/first_byte/monobit", test_first_byte_monobit);
34
- arm/palm
45
+ qtest_add_func("npcm7xx_rng/first_byte/runs", test_first_byte_runs);
35
- arm/nseries
46
+ }
36
- arm/stellaris
47
37
+ arm/versatile
48
qtest_start("-machine npcm750-evb");
38
arm/musicpal
49
ret = g_test_run();
39
- arm/sx1
40
+ arm/nseries
41
arm/orangepi
42
+ arm/palm
43
+ arm/xscale
44
+ arm/sx1
45
+ arm/stellaris
46
47
Arm CPU features
48
================
49
--
50
--
50
2.20.1
51
2.20.1
51
52
52
53
diff view generated by jsdifflib
Deleted patch
1
Provide a minimal documentation of the Versatile Express boards
2
(vexpress-a9, vexpress-a15).
3
1
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20200507151819.28444-4-peter.maydell@linaro.org
9
---
10
docs/system/arm/vexpress.rst | 60 ++++++++++++++++++++++++++++++++++++
11
docs/system/target-arm.rst | 1 +
12
MAINTAINERS | 1 +
13
3 files changed, 62 insertions(+)
14
create mode 100644 docs/system/arm/vexpress.rst
15
16
diff --git a/docs/system/arm/vexpress.rst b/docs/system/arm/vexpress.rst
17
new file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- /dev/null
20
+++ b/docs/system/arm/vexpress.rst
21
@@ -XXX,XX +XXX,XX @@
22
+Arm Versatile Express boards (``vexpress-a9``, ``vexpress-a15``)
23
+================================================================
24
+
25
+QEMU models two variants of the Arm Versatile Express development
26
+board family:
27
+
28
+- ``vexpress-a9`` models the combination of the Versatile Express
29
+ motherboard and the CoreTile Express A9x4 daughterboard
30
+- ``vexpress-a15`` models the combination of the Versatile Express
31
+ motherboard and the CoreTile Express A15x2 daughterboard
32
+
33
+Note that as this hardware does not have PCI, IDE or SCSI,
34
+the only available storage option is emulated SD card.
35
+
36
+Implemented devices:
37
+
38
+- PL041 audio
39
+- PL181 SD controller
40
+- PL050 keyboard and mouse
41
+- PL011 UARTs
42
+- SP804 timers
43
+- I2C controller
44
+- PL031 RTC
45
+- PL111 LCD display controller
46
+- Flash memory
47
+- LAN9118 ethernet
48
+
49
+Unimplemented devices:
50
+
51
+- SP810 system control block
52
+- PCI-express
53
+- USB controller (Philips ISP1761)
54
+- Local DAP ROM
55
+- CoreSight interfaces
56
+- PL301 AXI interconnect
57
+- SCC
58
+- System counter
59
+- HDLCD controller (``vexpress-a15``)
60
+- SP805 watchdog
61
+- PL341 dynamic memory controller
62
+- DMA330 DMA controller
63
+- PL354 static memory controller
64
+- BP147 TrustZone Protection Controller
65
+- TrustZone Address Space Controller
66
+
67
+Other differences between the hardware and the QEMU model:
68
+
69
+- QEMU will default to creating one CPU unless you pass a different
70
+ ``-smp`` argument
71
+- QEMU allows the amount of RAM provided to be specified with the
72
+ ``-m`` argument
73
+- QEMU defaults to providing a CPU which does not provide either
74
+ TrustZone or the Virtualization Extensions: if you want these you
75
+ must enable them with ``-machine secure=on`` and ``-machine
76
+ virtualization=on``
77
+- QEMU provides 4 virtio-mmio virtio transports; these start at
78
+ address ``0x10013000`` for ``vexpress-a9`` and at ``0x1c130000`` for
79
+ ``vexpress-a15``, and have IRQs from 40 upwards. If a dtb is
80
+ provided on the command line then QEMU will edit it to include
81
+ suitable entries describing these transports for the guest.
82
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
83
index XXXXXXX..XXXXXXX 100644
84
--- a/docs/system/target-arm.rst
85
+++ b/docs/system/target-arm.rst
86
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
87
arm/integratorcp
88
arm/realview
89
arm/versatile
90
+ arm/vexpress
91
arm/musicpal
92
arm/nseries
93
arm/orangepi
94
diff --git a/MAINTAINERS b/MAINTAINERS
95
index XXXXXXX..XXXXXXX 100644
96
--- a/MAINTAINERS
97
+++ b/MAINTAINERS
98
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
99
L: qemu-arm@nongnu.org
100
S: Maintained
101
F: hw/arm/vexpress.c
102
+F: docs/system/arm/vexpress.rst
103
104
Versatile PB
105
M: Peter Maydell <peter.maydell@linaro.org>
106
--
107
2.20.1
108
109
diff view generated by jsdifflib
Deleted patch
1
Add basic documentation of the MPS2 board models.
2
1
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20200507151819.28444-5-peter.maydell@linaro.org
8
---
9
docs/system/arm/mps2.rst | 29 +++++++++++++++++++++++++++++
10
docs/system/target-arm.rst | 1 +
11
MAINTAINERS | 1 +
12
3 files changed, 31 insertions(+)
13
create mode 100644 docs/system/arm/mps2.rst
14
15
diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst
16
new file mode 100644
17
index XXXXXXX..XXXXXXX
18
--- /dev/null
19
+++ b/docs/system/arm/mps2.rst
20
@@ -XXX,XX +XXX,XX @@
21
+Arm MPS2 boards (``mps2-an385``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``)
22
+================================================================================
23
+
24
+These board models all use Arm M-profile CPUs.
25
+
26
+The Arm MPS2 and MPS2+ dev boards are FPGA based (the 2+ has a bigger
27
+FPGA but is otherwise the same as the 2). Since the CPU itself
28
+and most of the devices are in the FPGA, the details of the board
29
+as seen by the guest depend significantly on the FPGA image.
30
+
31
+QEMU models the following FPGA images:
32
+
33
+``mps2-an385``
34
+ Cortex-M3 as documented in ARM Application Note AN385
35
+``mps2-an511``
36
+ Cortex-M3 'DesignStart' as documented in AN511
37
+``mps2-an505``
38
+ Cortex-M33 as documented in ARM Application Note AN505
39
+``mps2-an521``
40
+ Dual Cortex-M33 as documented in Application Note AN521
41
+
42
+Differences between QEMU and real hardware:
43
+
44
+- AN385 remapping of low 16K of memory to either ZBT SSRAM1 or to
45
+ block RAM is unimplemented (QEMU always maps this to ZBT SSRAM1, as
46
+ if zbt_boot_ctrl is always zero)
47
+- QEMU provides a LAN9118 ethernet rather than LAN9220; the only guest
48
+ visible difference is that the LAN9118 doesn't support checksum
49
+ offloading
50
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
51
index XXXXXXX..XXXXXXX 100644
52
--- a/docs/system/target-arm.rst
53
+++ b/docs/system/target-arm.rst
54
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
55
:maxdepth: 1
56
57
arm/integratorcp
58
+ arm/mps2
59
arm/realview
60
arm/versatile
61
arm/vexpress
62
diff --git a/MAINTAINERS b/MAINTAINERS
63
index XXXXXXX..XXXXXXX 100644
64
--- a/MAINTAINERS
65
+++ b/MAINTAINERS
66
@@ -XXX,XX +XXX,XX @@ F: hw/misc/armsse-cpuid.c
67
F: include/hw/misc/armsse-cpuid.h
68
F: hw/misc/armsse-mhu.c
69
F: include/hw/misc/armsse-mhu.h
70
+F: docs/system/arm/mps2.rst
71
72
Musca
73
M: Peter Maydell <peter.maydell@linaro.org>
74
--
75
2.20.1
76
77
diff view generated by jsdifflib