1
The following changes since commit ad1b4ec39caa5b3f17cbd8160283a03a3dcfe2ae:
1
Just a collection of bug fixes this time around...
2
2
3
Merge remote-tracking branch 'remotes/kraxel/tags/input-20180515-pull-request' into staging (2018-05-15 12:50:06 +0100)
3
thanks
4
-- PMM
5
6
The following changes since commit 2a6ae69154542caa91dd17c40fd3f5ffbec300de:
7
8
Merge tag 'pull-maintainer-ominbus-030723-1' of https://gitlab.com/stsquad/qemu into staging (2023-07-04 08:36:44 +0200)
4
9
5
are available in the Git repository at:
10
are available in the Git repository at:
6
11
7
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180515
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230704
8
13
9
for you to fetch changes up to ae7651804748c6b479d5ae09aeac4edb9c44f76e:
14
for you to fetch changes up to 86a78272f094857b4eda79d721c116e93942aa9a:
10
15
11
tcg: Optionally log FPU state in TCG -d cpu logging (2018-05-15 14:58:44 +0100)
16
target/xtensa: Assert that interrupt level is within bounds (2023-07-04 14:27:08 +0100)
12
17
13
----------------------------------------------------------------
18
----------------------------------------------------------------
14
target-arm queue:
19
target-arm queue:
15
* Fix coverity nit in int_to_float code
20
* Add raw_writes ops for register whose write induce TLB maintenance
16
* Don't set Invalid for float-to-int(MAXINT)
21
* hw/arm/sbsa-ref: use XHCI to replace EHCI
17
* Fix fp_status_f16 tininess before rounding
22
* Avoid splitting Zregs across lines in dump
18
* Add various missing insns from the v8.2-FP16 extension
23
* Dump ZA[] when active
19
* Fix sqrt_f16 exception raising
24
* Fix SME full tile indexing
20
* sdcard: Correct CRC16 offset in sd_function_switch()
25
* Handle IC IVAU to improve compatibility with JITs
21
* tcg: Optionally log FPU state in TCG -d cpu logging
26
* xlnx-canfd-test: Fix code coverity issues
27
* gdbstub: Guard M-profile code with CONFIG_TCG
28
* allwinner-sramc: Set class_size
29
* target/xtensa: Assert that interrupt level is within bounds
22
30
23
----------------------------------------------------------------
31
----------------------------------------------------------------
24
Alex Bennée (5):
32
Akihiko Odaki (1):
25
fpu/softfloat: int_to_float ensure r fully initialised
33
hw: arm: allwinner-sramc: Set class_size
26
target/arm: Implement FCMP for fp16
27
target/arm: Implement FCSEL for fp16
28
target/arm: Implement FMOV (immediate) for fp16
29
target/arm: Fix sqrt_f16 exception raising
30
34
31
Peter Maydell (3):
35
Eric Auger (1):
32
fpu/softfloat: Don't set Invalid for float-to-int(MAXINT)
36
target/arm: Add raw_writes ops for register whose write induce TLB maintenance
33
target/arm: Fix fp_status_f16 tininess before rounding
34
tcg: Optionally log FPU state in TCG -d cpu logging
35
37
36
Philippe Mathieu-Daudé (1):
38
Fabiano Rosas (1):
37
sdcard: Correct CRC16 offset in sd_function_switch()
39
target/arm: gdbstub: Guard M-profile code with CONFIG_TCG
38
40
39
Richard Henderson (7):
41
John Högberg (2):
40
target/arm: Implement FMOV (general) for fp16
42
target/arm: Handle IC IVAU to improve compatibility with JITs
41
target/arm: Early exit after unallocated_encoding in disas_fp_int_conv
43
tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code
42
target/arm: Implement FCVT (scalar, integer) for fp16
43
target/arm: Implement FCVT (scalar, fixed-point) for fp16
44
target/arm: Introduce and use read_fp_hreg
45
target/arm: Implement FP data-processing (2 source) for fp16
46
target/arm: Implement FP data-processing (3 source) for fp16
47
44
48
include/qemu/log.h | 1 +
45
Peter Maydell (1):
49
target/arm/helper-a64.h | 2 +
46
target/xtensa: Assert that interrupt level is within bounds
50
target/arm/helper.h | 6 +
51
accel/tcg/cpu-exec.c | 9 +-
52
fpu/softfloat.c | 6 +-
53
hw/sd/sd.c | 2 +-
54
target/arm/cpu.c | 2 +
55
target/arm/helper-a64.c | 10 ++
56
target/arm/helper.c | 38 +++-
57
target/arm/translate-a64.c | 421 ++++++++++++++++++++++++++++++++++++++-------
58
util/log.c | 2 +
59
11 files changed, 428 insertions(+), 71 deletions(-)
60
47
48
Richard Henderson (3):
49
target/arm: Avoid splitting Zregs across lines in dump
50
target/arm: Dump ZA[] when active
51
target/arm: Fix SME full tile indexing
52
53
Vikram Garhwal (1):
54
tests/qtest: xlnx-canfd-test: Fix code coverity issues
55
56
Yuquan Wang (1):
57
hw/arm/sbsa-ref: use XHCI to replace EHCI
58
59
docs/system/arm/sbsa.rst | 5 +-
60
hw/arm/sbsa-ref.c | 23 +++--
61
hw/misc/allwinner-sramc.c | 1 +
62
target/arm/cpu.c | 65 ++++++++-----
63
target/arm/gdbstub.c | 4 +
64
target/arm/helper.c | 70 +++++++++++---
65
target/arm/tcg/translate-sme.c | 24 +++--
66
target/xtensa/exc_helper.c | 3 +
67
tests/qtest/xlnx-canfd-test.c | 33 +++----
68
tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++++++++++
69
tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++
70
hw/arm/Kconfig | 2 +-
71
tests/tcg/aarch64/Makefile.target | 13 ++-
72
13 files changed, 436 insertions(+), 79 deletions(-)
73
create mode 100644 tests/tcg/aarch64/icivau.c
74
create mode 100644 tests/tcg/aarch64/sme-outprod1.c
75
diff view generated by jsdifflib
Deleted patch
1
From: Alex Bennée <alex.bennee@linaro.org>
2
1
3
Reported by Coverity (CID1390635). We ensure this for uint_to_float
4
later on so we might as well mirror that.
5
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
fpu/softfloat.c | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
13
14
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/fpu/softfloat.c
17
+++ b/fpu/softfloat.c
18
@@ -XXX,XX +XXX,XX @@ FLOAT_TO_UINT(64, 64)
19
20
static FloatParts int_to_float(int64_t a, float_status *status)
21
{
22
- FloatParts r;
23
+ FloatParts r = {};
24
if (a == 0) {
25
r.cls = float_class_zero;
26
r.sign = false;
27
--
28
2.17.0
29
30
diff view generated by jsdifflib
Deleted patch
1
In float-to-integer conversion, if the floating point input
2
converts exactly to the largest or smallest integer that
3
fits in to the result type, this is not an overflow.
4
In this situation we were producing the correct result value,
5
but were incorrectly setting the Invalid flag.
6
For example for Arm A64, "FCVTAS w0, d0" on an input of
7
0x41dfffffffc00000 should produce 0x7fffffff and set no flags.
8
1
9
Fix the boundary case to take the right half of the if()
10
statements.
11
12
This fixes a regression from 2.11 introduced by the softfloat
13
refactoring.
14
15
Cc: qemu-stable@nongnu.org
16
Fixes: ab52f973a50
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Message-id: 20180510140141.12120-1-peter.maydell@linaro.org
20
---
21
fpu/softfloat.c | 4 ++--
22
1 file changed, 2 insertions(+), 2 deletions(-)
23
24
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/fpu/softfloat.c
27
+++ b/fpu/softfloat.c
28
@@ -XXX,XX +XXX,XX @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
29
r = UINT64_MAX;
30
}
31
if (p.sign) {
32
- if (r < -(uint64_t) min) {
33
+ if (r <= -(uint64_t) min) {
34
return -r;
35
} else {
36
s->float_exception_flags = orig_flags | float_flag_invalid;
37
return min;
38
}
39
} else {
40
- if (r < max) {
41
+ if (r <= max) {
42
return r;
43
} else {
44
s->float_exception_flags = orig_flags | float_flag_invalid;
45
--
46
2.17.0
47
48
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Eric Auger <eric.auger@redhat.com>
2
2
3
Cc: qemu-stable@nongnu.org
3
Some registers whose 'cooked' writefns induce TLB maintenance do
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
4
not have raw_writefn ops defined. If only the writefn ops is set
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
(ie. no raw_writefn is provided), it is assumed the cooked also
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
6
work as the raw one. For those registers it is not obvious the
7
Message-id: 20180512003217.9105-4-richard.henderson@linaro.org
7
tlb_flush works on KVM mode so better/safer setting the raw write.
8
9
Signed-off-by: Eric Auger <eric.auger@redhat.com>
10
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
13
---
10
target/arm/helper.h | 6 +++
14
target/arm/helper.c | 23 +++++++++++++----------
11
target/arm/helper.c | 38 ++++++++++++++-
15
1 file changed, 13 insertions(+), 10 deletions(-)
12
target/arm/translate-a64.c | 96 +++++++++++++++++++++++++++++++-------
13
3 files changed, 122 insertions(+), 18 deletions(-)
14
16
15
diff --git a/target/arm/helper.h b/target/arm/helper.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.h
18
+++ b/target/arm/helper.h
19
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_touhd_round_to_zero, i64, f64, i32, ptr)
20
DEF_HELPER_3(vfp_tould_round_to_zero, i64, f64, i32, ptr)
21
DEF_HELPER_3(vfp_touhh, i32, f16, i32, ptr)
22
DEF_HELPER_3(vfp_toshh, i32, f16, i32, ptr)
23
+DEF_HELPER_3(vfp_toulh, i32, f16, i32, ptr)
24
+DEF_HELPER_3(vfp_toslh, i32, f16, i32, ptr)
25
+DEF_HELPER_3(vfp_touqh, i64, f16, i32, ptr)
26
+DEF_HELPER_3(vfp_tosqh, i64, f16, i32, ptr)
27
DEF_HELPER_3(vfp_toshs, i32, f32, i32, ptr)
28
DEF_HELPER_3(vfp_tosls, i32, f32, i32, ptr)
29
DEF_HELPER_3(vfp_tosqs, i64, f32, i32, ptr)
30
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_3(vfp_ultod, f64, i64, i32, ptr)
31
DEF_HELPER_3(vfp_uqtod, f64, i64, i32, ptr)
32
DEF_HELPER_3(vfp_sltoh, f16, i32, i32, ptr)
33
DEF_HELPER_3(vfp_ultoh, f16, i32, i32, ptr)
34
+DEF_HELPER_3(vfp_sqtoh, f16, i64, i32, ptr)
35
+DEF_HELPER_3(vfp_uqtoh, f16, i64, i32, ptr)
36
37
DEF_HELPER_FLAGS_2(set_rmode, TCG_CALL_NO_RWG, i32, i32, ptr)
38
DEF_HELPER_FLAGS_2(set_neon_rmode, TCG_CALL_NO_RWG, i32, i32, env)
39
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
diff --git a/target/arm/helper.c b/target/arm/helper.c
40
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/helper.c
19
--- a/target/arm/helper.c
42
+++ b/target/arm/helper.c
20
+++ b/target/arm/helper.c
43
@@ -XXX,XX +XXX,XX @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64)
21
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = {
44
#undef VFP_CONV_FIX_A64
22
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0,
45
23
.access = PL1_RW, .accessfn = access_tvm_trvm,
46
/* Conversion to/from f16 can overflow to infinity before/after scaling.
24
.fgt = FGT_TTBR0_EL1,
47
- * Therefore we convert to f64 (which does not round), scale,
25
- .writefn = vmsa_ttbr_write, .resetvalue = 0,
48
- * and then convert f64 to f16 (which may round).
26
+ .writefn = vmsa_ttbr_write, .resetvalue = 0, .raw_writefn = raw_write,
49
+ * Therefore we convert to f64, scale, and then convert f64 to f16; or
27
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s),
50
+ * vice versa for conversion to integer.
28
offsetof(CPUARMState, cp15.ttbr0_ns) } },
51
+ *
29
{ .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH,
52
+ * For 16- and 32-bit integers, the conversion to f64 never rounds.
30
.opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1,
53
+ * For 64-bit integers, any integer that would cause rounding will also
31
.access = PL1_RW, .accessfn = access_tvm_trvm,
54
+ * overflow to f16 infinity, so there is no double rounding problem.
32
.fgt = FGT_TTBR1_EL1,
55
*/
33
- .writefn = vmsa_ttbr_write, .resetvalue = 0,
56
34
+ .writefn = vmsa_ttbr_write, .resetvalue = 0, .raw_writefn = raw_write,
57
static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst)
35
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s),
58
@@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst)
36
offsetof(CPUARMState, cp15.ttbr1_ns) } },
59
return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst);
37
{ .name = "TCR_EL1", .state = ARM_CP_STATE_AA64,
60
}
38
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lpae_cp_reginfo[] = {
61
39
.type = ARM_CP_64BIT | ARM_CP_ALIAS,
62
+float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst)
40
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s),
63
+{
41
offsetof(CPUARMState, cp15.ttbr0_ns) },
64
+ return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst);
42
- .writefn = vmsa_ttbr_write, },
65
+}
43
+ .writefn = vmsa_ttbr_write, .raw_writefn = raw_write },
66
+
44
{ .name = "TTBR1", .cp = 15, .crm = 2, .opc1 = 1,
67
+float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)
45
.access = PL1_RW, .accessfn = access_tvm_trvm,
68
+{
46
.type = ARM_CP_64BIT | ARM_CP_ALIAS,
69
+ return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst);
47
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s),
70
+}
48
offsetof(CPUARMState, cp15.ttbr1_ns) },
71
+
49
- .writefn = vmsa_ttbr_write, },
72
static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst)
50
+ .writefn = vmsa_ttbr_write, .raw_writefn = raw_write },
73
{
51
};
74
if (unlikely(float16_is_any_nan(f))) {
52
75
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst)
53
static uint64_t aa64_fpcr_read(CPUARMState *env, const ARMCPRegInfo *ri)
76
return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst);
54
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
77
}
55
.type = ARM_CP_IO,
78
56
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0,
79
+uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst)
57
.access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hcr_el2),
80
+{
58
- .writefn = hcr_write },
81
+ return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst);
59
+ .writefn = hcr_write, .raw_writefn = raw_write },
82
+}
60
{ .name = "HCR", .state = ARM_CP_STATE_AA32,
83
+
61
.type = ARM_CP_ALIAS | ARM_CP_IO,
84
+uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst)
62
.cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0,
85
+{
63
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
86
+ return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst);
64
{ .name = "TCR_EL2", .state = ARM_CP_STATE_BOTH,
87
+}
65
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 2,
88
+
66
.access = PL2_RW, .writefn = vmsa_tcr_el12_write,
89
+uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst)
67
+ .raw_writefn = raw_write,
90
+{
68
.fieldoffset = offsetof(CPUARMState, cp15.tcr_el[2]) },
91
+ return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst);
69
{ .name = "VTCR", .state = ARM_CP_STATE_AA32,
92
+}
70
.cp = 15, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2,
93
+
71
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
94
+uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst)
72
.type = ARM_CP_64BIT | ARM_CP_ALIAS,
95
+{
73
.access = PL2_RW, .accessfn = access_el3_aa32ns,
96
+ return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst);
74
.fieldoffset = offsetof(CPUARMState, cp15.vttbr_el2),
97
+}
75
- .writefn = vttbr_write },
98
+
76
+ .writefn = vttbr_write, .raw_writefn = raw_write },
99
/* Set the current fp rounding mode and return the old one.
77
{ .name = "VTTBR_EL2", .state = ARM_CP_STATE_AA64,
100
* The argument is a softfloat float_round_ value.
78
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 0,
101
*/
79
- .access = PL2_RW, .writefn = vttbr_write,
102
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
80
+ .access = PL2_RW, .writefn = vttbr_write, .raw_writefn = raw_write,
103
index XXXXXXX..XXXXXXX 100644
81
.fieldoffset = offsetof(CPUARMState, cp15.vttbr_el2) },
104
--- a/target/arm/translate-a64.c
82
{ .name = "SCTLR_EL2", .state = ARM_CP_STATE_BOTH,
105
+++ b/target/arm/translate-a64.c
83
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 0,
106
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
84
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
107
bool itof, int rmode, int scale, int sf, int type)
85
.fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[2]) },
108
{
86
{ .name = "TTBR0_EL2", .state = ARM_CP_STATE_AA64,
109
bool is_signed = !(opcode & 1);
87
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0,
110
- bool is_double = type;
88
- .access = PL2_RW, .resetvalue = 0, .writefn = vmsa_tcr_ttbr_el2_write,
111
TCGv_ptr tcg_fpstatus;
89
+ .access = PL2_RW, .resetvalue = 0,
112
- TCGv_i32 tcg_shift;
90
+ .writefn = vmsa_tcr_ttbr_el2_write, .raw_writefn = raw_write,
113
+ TCGv_i32 tcg_shift, tcg_single;
91
.fieldoffset = offsetof(CPUARMState, cp15.ttbr0_el[2]) },
114
+ TCGv_i64 tcg_double;
92
{ .name = "HTTBR", .cp = 15, .opc1 = 4, .crm = 2,
115
93
.access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_ALIAS,
116
- tcg_fpstatus = get_fpstatus_ptr(false);
94
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_cp_reginfo[] = {
117
+ tcg_fpstatus = get_fpstatus_ptr(type == 3);
95
{ .name = "SCR_EL3", .state = ARM_CP_STATE_AA64,
118
96
.opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 0,
119
tcg_shift = tcg_const_i32(64 - scale);
97
.access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.scr_el3),
120
98
- .resetfn = scr_reset, .writefn = scr_write },
121
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
99
+ .resetfn = scr_reset, .writefn = scr_write, .raw_writefn = raw_write },
122
tcg_int = tcg_extend;
100
{ .name = "SCR", .type = ARM_CP_ALIAS | ARM_CP_NEWEL,
123
}
101
.cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 0,
124
102
.access = PL1_RW, .accessfn = access_trap_aa32s_el1,
125
- if (is_double) {
103
.fieldoffset = offsetoflow32(CPUARMState, cp15.scr_el3),
126
- TCGv_i64 tcg_double = tcg_temp_new_i64();
104
- .writefn = scr_write },
127
+ switch (type) {
105
+ .writefn = scr_write, .raw_writefn = raw_write },
128
+ case 1: /* float64 */
106
{ .name = "SDER32_EL3", .state = ARM_CP_STATE_AA64,
129
+ tcg_double = tcg_temp_new_i64();
107
.opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 1,
130
if (is_signed) {
108
.access = PL3_RW, .resetvalue = 0,
131
gen_helper_vfp_sqtod(tcg_double, tcg_int,
109
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vhe_reginfo[] = {
132
tcg_shift, tcg_fpstatus);
110
{ .name = "TTBR1_EL2", .state = ARM_CP_STATE_AA64,
133
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
111
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 1,
134
}
112
.access = PL2_RW, .writefn = vmsa_tcr_ttbr_el2_write,
135
write_fp_dreg(s, rd, tcg_double);
113
+ .raw_writefn = raw_write,
136
tcg_temp_free_i64(tcg_double);
114
.fieldoffset = offsetof(CPUARMState, cp15.ttbr1_el[2]) },
137
- } else {
115
#ifndef CONFIG_USER_ONLY
138
- TCGv_i32 tcg_single = tcg_temp_new_i32();
116
{ .name = "CNTHV_CVAL_EL2", .state = ARM_CP_STATE_AA64,
139
+ break;
140
+
141
+ case 0: /* float32 */
142
+ tcg_single = tcg_temp_new_i32();
143
if (is_signed) {
144
gen_helper_vfp_sqtos(tcg_single, tcg_int,
145
tcg_shift, tcg_fpstatus);
146
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
147
}
148
write_fp_sreg(s, rd, tcg_single);
149
tcg_temp_free_i32(tcg_single);
150
+ break;
151
+
152
+ case 3: /* float16 */
153
+ tcg_single = tcg_temp_new_i32();
154
+ if (is_signed) {
155
+ gen_helper_vfp_sqtoh(tcg_single, tcg_int,
156
+ tcg_shift, tcg_fpstatus);
157
+ } else {
158
+ gen_helper_vfp_uqtoh(tcg_single, tcg_int,
159
+ tcg_shift, tcg_fpstatus);
160
+ }
161
+ write_fp_sreg(s, rd, tcg_single);
162
+ tcg_temp_free_i32(tcg_single);
163
+ break;
164
+
165
+ default:
166
+ g_assert_not_reached();
167
}
168
} else {
169
TCGv_i64 tcg_int = cpu_reg(s, rd);
170
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
171
172
gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus);
173
174
- if (is_double) {
175
- TCGv_i64 tcg_double = read_fp_dreg(s, rn);
176
+ switch (type) {
177
+ case 1: /* float64 */
178
+ tcg_double = read_fp_dreg(s, rn);
179
if (is_signed) {
180
if (!sf) {
181
gen_helper_vfp_tosld(tcg_int, tcg_double,
182
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
183
tcg_shift, tcg_fpstatus);
184
}
185
}
186
+ if (!sf) {
187
+ tcg_gen_ext32u_i64(tcg_int, tcg_int);
188
+ }
189
tcg_temp_free_i64(tcg_double);
190
- } else {
191
- TCGv_i32 tcg_single = read_fp_sreg(s, rn);
192
+ break;
193
+
194
+ case 0: /* float32 */
195
+ tcg_single = read_fp_sreg(s, rn);
196
if (sf) {
197
if (is_signed) {
198
gen_helper_vfp_tosqs(tcg_int, tcg_single,
199
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
200
tcg_temp_free_i32(tcg_dest);
201
}
202
tcg_temp_free_i32(tcg_single);
203
+ break;
204
+
205
+ case 3: /* float16 */
206
+ tcg_single = read_fp_sreg(s, rn);
207
+ if (sf) {
208
+ if (is_signed) {
209
+ gen_helper_vfp_tosqh(tcg_int, tcg_single,
210
+ tcg_shift, tcg_fpstatus);
211
+ } else {
212
+ gen_helper_vfp_touqh(tcg_int, tcg_single,
213
+ tcg_shift, tcg_fpstatus);
214
+ }
215
+ } else {
216
+ TCGv_i32 tcg_dest = tcg_temp_new_i32();
217
+ if (is_signed) {
218
+ gen_helper_vfp_toslh(tcg_dest, tcg_single,
219
+ tcg_shift, tcg_fpstatus);
220
+ } else {
221
+ gen_helper_vfp_toulh(tcg_dest, tcg_single,
222
+ tcg_shift, tcg_fpstatus);
223
+ }
224
+ tcg_gen_extu_i32_i64(tcg_int, tcg_dest);
225
+ tcg_temp_free_i32(tcg_dest);
226
+ }
227
+ tcg_temp_free_i32(tcg_single);
228
+ break;
229
+
230
+ default:
231
+ g_assert_not_reached();
232
}
233
234
gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus);
235
tcg_temp_free_i32(tcg_rmode);
236
-
237
- if (!sf) {
238
- tcg_gen_ext32u_i64(tcg_int, tcg_int);
239
- }
240
}
241
242
tcg_temp_free_ptr(tcg_fpstatus);
243
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
244
/* actual FP conversions */
245
bool itof = extract32(opcode, 1, 1);
246
247
- if (type > 1 || (rmode != 0 && opcode > 1)) {
248
+ if (rmode != 0 && opcode > 1) {
249
+ unallocated_encoding(s);
250
+ return;
251
+ }
252
+ switch (type) {
253
+ case 0: /* float32 */
254
+ case 1: /* float64 */
255
+ break;
256
+ case 3: /* float16 */
257
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
258
+ break;
259
+ }
260
+ /* fallthru */
261
+ default:
262
unallocated_encoding(s);
263
return;
264
}
265
--
117
--
266
2.17.0
118
2.34.1
267
268
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Yuquan Wang <wangyuquan1236@phytium.com.cn>
2
2
3
These where missed out from the rest of the half-precision work.
3
The current sbsa-ref cannot use EHCI controller which is only
4
able to do 32-bit DMA, since sbsa-ref doesn't have RAM below 4GB.
5
Hence, this uses XHCI to provide a usb controller with 64-bit
6
DMA capablity instead of EHCI.
4
7
5
Cc: qemu-stable@nongnu.org
8
We bump the platform version to 0.3 with this change. Although the
9
hardware at the USB controller address changes, the firmware and
10
Linux can both cope with this -- on an older non-XHCI-aware
11
firmware/kernel setup the probe routine simply fails and the guest
12
proceeds without any USB. (This isn't a loss of functionality,
13
because the old USB controller never worked in the first place.) So
14
we can call this a backwards-compatible change and only bump the
15
minor version.
16
17
Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
18
Message-id: 20230621103847.447508-2-wangyuquan1236@phytium.com.cn
19
[PMM: tweaked commit message; add line to docs about what
20
changes in platform version 0.3]
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180512003217.9105-9-richard.henderson@linaro.org
11
[rth: Diagnose lack of FP16 before fp_access_check]
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
23
---
15
target/arm/helper-a64.h | 2 +
24
docs/system/arm/sbsa.rst | 5 ++++-
16
target/arm/helper-a64.c | 10 +++++
25
hw/arm/sbsa-ref.c | 23 +++++++++++++----------
17
target/arm/translate-a64.c | 88 ++++++++++++++++++++++++++++++--------
26
hw/arm/Kconfig | 2 +-
18
3 files changed, 83 insertions(+), 17 deletions(-)
27
3 files changed, 18 insertions(+), 12 deletions(-)
19
28
20
diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h
29
diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst
21
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/helper-a64.h
31
--- a/docs/system/arm/sbsa.rst
23
+++ b/target/arm/helper-a64.h
32
+++ b/docs/system/arm/sbsa.rst
33
@@ -XXX,XX +XXX,XX @@ The ``sbsa-ref`` board supports:
34
- A configurable number of AArch64 CPUs
35
- GIC version 3
36
- System bus AHCI controller
37
- - System bus EHCI controller
38
+ - System bus XHCI controller
39
- CDROM and hard disc on AHCI bus
40
- E1000E ethernet card on PCIe bus
41
- Bochs display adapter on PCIe bus
42
@@ -XXX,XX +XXX,XX @@ Platform version changes:
43
44
0.2
45
GIC ITS information is present in devicetree.
46
+
47
+0.3
48
+ The USB controller is an XHCI device, not EHCI
49
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/arm/sbsa-ref.c
52
+++ b/hw/arm/sbsa-ref.c
24
@@ -XXX,XX +XXX,XX @@
53
@@ -XXX,XX +XXX,XX @@
25
DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
54
#include "hw/pci-host/gpex.h"
26
DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
55
#include "hw/qdev-properties.h"
27
DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64)
56
#include "hw/usb.h"
28
+DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr)
57
+#include "hw/usb/xhci.h"
29
+DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr)
58
#include "hw/char/pl011.h"
30
DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr)
59
#include "hw/watchdog/sbsa_gwdt.h"
31
DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr)
60
#include "net/net.h"
32
DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr)
61
@@ -XXX,XX +XXX,XX @@ enum {
33
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
62
SBSA_SECURE_UART_MM,
34
index XXXXXXX..XXXXXXX 100644
63
SBSA_SECURE_MEM,
35
--- a/target/arm/helper-a64.c
64
SBSA_AHCI,
36
+++ b/target/arm/helper-a64.c
65
- SBSA_EHCI,
37
@@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res)
66
+ SBSA_XHCI,
38
return flags;
67
};
39
}
68
40
69
struct SBSAMachineState {
41
+uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status)
70
@@ -XXX,XX +XXX,XX @@ static const MemMapEntry sbsa_ref_memmap[] = {
42
+{
71
[SBSA_SMMU] = { 0x60050000, 0x00020000 },
43
+ return float_rel_to_flags(float16_compare_quiet(x, y, fp_status));
72
/* Space here reserved for more SMMUs */
44
+}
73
[SBSA_AHCI] = { 0x60100000, 0x00010000 },
45
+
74
- [SBSA_EHCI] = { 0x60110000, 0x00010000 },
46
+uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status)
75
+ [SBSA_XHCI] = { 0x60110000, 0x00010000 },
47
+{
76
/* Space here reserved for other devices */
48
+ return float_rel_to_flags(float16_compare(x, y, fp_status));
77
[SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 },
49
+}
78
/* 32-bit address PCIE MMIO space */
50
+
79
@@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = {
51
uint64_t HELPER(vfp_cmps_a64)(float32 x, float32 y, void *fp_status)
80
[SBSA_SECURE_UART] = 8,
52
{
81
[SBSA_SECURE_UART_MM] = 9,
53
return float_rel_to_flags(float32_compare_quiet(x, y, fp_status));
82
[SBSA_AHCI] = 10,
54
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
83
- [SBSA_EHCI] = 11,
55
index XXXXXXX..XXXXXXX 100644
84
+ [SBSA_XHCI] = 11,
56
--- a/target/arm/translate-a64.c
85
[SBSA_SMMU] = 12, /* ... to 15 */
57
+++ b/target/arm/translate-a64.c
86
[SBSA_GWDT_WS0] = 16,
58
@@ -XXX,XX +XXX,XX @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn)
87
};
88
@@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms)
89
* fw compatibility.
90
*/
91
qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
92
- qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 2);
93
+ qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 3);
94
95
if (ms->numa_state->have_numa_distance) {
96
int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
97
@@ -XXX,XX +XXX,XX @@ static void create_ahci(const SBSAMachineState *sms)
59
}
98
}
60
}
99
}
61
100
62
-static void handle_fp_compare(DisasContext *s, bool is_double,
101
-static void create_ehci(const SBSAMachineState *sms)
63
+static void handle_fp_compare(DisasContext *s, int size,
102
+static void create_xhci(const SBSAMachineState *sms)
64
unsigned int rn, unsigned int rm,
65
bool cmp_with_zero, bool signal_all_nans)
66
{
103
{
67
TCGv_i64 tcg_flags = tcg_temp_new_i64();
104
- hwaddr base = sbsa_ref_memmap[SBSA_EHCI].base;
68
- TCGv_ptr fpst = get_fpstatus_ptr(false);
105
- int irq = sbsa_ref_irqmap[SBSA_EHCI];
69
+ TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16);
106
+ hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base;
70
107
+ int irq = sbsa_ref_irqmap[SBSA_XHCI];
71
- if (is_double) {
108
+ DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS);
72
+ if (size == MO_64) {
109
73
TCGv_i64 tcg_vn, tcg_vm;
110
- sysbus_create_simple("platform-ehci-usb", base,
74
111
- qdev_get_gpio_in(sms->gic, irq));
75
tcg_vn = read_fp_dreg(s, rn);
112
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
76
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double,
113
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
77
tcg_temp_free_i64(tcg_vn);
114
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(sms->gic, irq));
78
tcg_temp_free_i64(tcg_vm);
79
} else {
80
- TCGv_i32 tcg_vn, tcg_vm;
81
+ TCGv_i32 tcg_vn = tcg_temp_new_i32();
82
+ TCGv_i32 tcg_vm = tcg_temp_new_i32();
83
84
- tcg_vn = read_fp_sreg(s, rn);
85
+ read_vec_element_i32(s, tcg_vn, rn, 0, size);
86
if (cmp_with_zero) {
87
- tcg_vm = tcg_const_i32(0);
88
+ tcg_gen_movi_i32(tcg_vm, 0);
89
} else {
90
- tcg_vm = read_fp_sreg(s, rm);
91
+ read_vec_element_i32(s, tcg_vm, rm, 0, size);
92
}
93
- if (signal_all_nans) {
94
- gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
95
- } else {
96
- gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
97
+
98
+ switch (size) {
99
+ case MO_32:
100
+ if (signal_all_nans) {
101
+ gen_helper_vfp_cmpes_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
102
+ } else {
103
+ gen_helper_vfp_cmps_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
104
+ }
105
+ break;
106
+ case MO_16:
107
+ if (signal_all_nans) {
108
+ gen_helper_vfp_cmpeh_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
109
+ } else {
110
+ gen_helper_vfp_cmph_a64(tcg_flags, tcg_vn, tcg_vm, fpst);
111
+ }
112
+ break;
113
+ default:
114
+ g_assert_not_reached();
115
}
116
+
117
tcg_temp_free_i32(tcg_vn);
118
tcg_temp_free_i32(tcg_vm);
119
}
120
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double,
121
static void disas_fp_compare(DisasContext *s, uint32_t insn)
122
{
123
unsigned int mos, type, rm, op, rn, opc, op2r;
124
+ int size;
125
126
mos = extract32(insn, 29, 3);
127
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
128
+ type = extract32(insn, 22, 2);
129
rm = extract32(insn, 16, 5);
130
op = extract32(insn, 14, 2);
131
rn = extract32(insn, 5, 5);
132
opc = extract32(insn, 3, 2);
133
op2r = extract32(insn, 0, 3);
134
135
- if (mos || op || op2r || type > 1) {
136
+ if (mos || op || op2r) {
137
+ unallocated_encoding(s);
138
+ return;
139
+ }
140
+
141
+ switch (type) {
142
+ case 0:
143
+ size = MO_32;
144
+ break;
145
+ case 1:
146
+ size = MO_64;
147
+ break;
148
+ case 3:
149
+ size = MO_16;
150
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
151
+ break;
152
+ }
153
+ /* fallthru */
154
+ default:
155
unallocated_encoding(s);
156
return;
157
}
158
@@ -XXX,XX +XXX,XX @@ static void disas_fp_compare(DisasContext *s, uint32_t insn)
159
return;
160
}
161
162
- handle_fp_compare(s, type, rn, rm, opc & 1, opc & 2);
163
+ handle_fp_compare(s, size, rn, rm, opc & 1, opc & 2);
164
}
115
}
165
116
166
/* Floating point conditional compare
117
static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
167
@@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
118
@@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine)
168
unsigned int mos, type, rm, cond, rn, op, nzcv;
119
169
TCGv_i64 tcg_flags;
120
create_ahci(sms);
170
TCGLabel *label_continue = NULL;
121
171
+ int size;
122
- create_ehci(sms);
172
123
+ create_xhci(sms);
173
mos = extract32(insn, 29, 3);
124
174
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
125
create_pcie(sms);
175
+ type = extract32(insn, 22, 2);
126
176
rm = extract32(insn, 16, 5);
127
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
177
cond = extract32(insn, 12, 4);
128
index XXXXXXX..XXXXXXX 100644
178
rn = extract32(insn, 5, 5);
129
--- a/hw/arm/Kconfig
179
op = extract32(insn, 4, 1);
130
+++ b/hw/arm/Kconfig
180
nzcv = extract32(insn, 0, 4);
131
@@ -XXX,XX +XXX,XX @@ config SBSA_REF
181
132
select PL011 # UART
182
- if (mos || type > 1) {
133
select PL031 # RTC
183
+ if (mos) {
134
select PL061 # GPIO
184
+ unallocated_encoding(s);
135
- select USB_EHCI_SYSBUS
185
+ return;
136
+ select USB_XHCI_SYSBUS
186
+ }
137
select WDT_SBSA
187
+
138
select BOCHS_DISPLAY
188
+ switch (type) {
139
189
+ case 0:
190
+ size = MO_32;
191
+ break;
192
+ case 1:
193
+ size = MO_64;
194
+ break;
195
+ case 3:
196
+ size = MO_16;
197
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
198
+ break;
199
+ }
200
+ /* fallthru */
201
+ default:
202
unallocated_encoding(s);
203
return;
204
}
205
@@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
206
gen_set_label(label_match);
207
}
208
209
- handle_fp_compare(s, type, rn, rm, false, op);
210
+ handle_fp_compare(s, size, rn, rm, false, op);
211
212
if (cond < 0x0e) {
213
gen_set_label(label_continue);
214
--
140
--
215
2.17.0
141
2.34.1
216
217
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
No sense in emitting code after the exception.
3
Allow the line length to extend to 548 columns. While annoyingly wide,
4
it's still less confusing than the continuations we print. Also, the
5
default VL used by Linux (and max for A64FX) uses only 140 columns.
4
6
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20230622151201.1578522-2-richard.henderson@linaro.org
7
Message-id: 20180512003217.9105-3-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@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 | 2 +-
12
target/arm/cpu.c | 36 ++++++++++++++----------------------
12
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 14 insertions(+), 22 deletions(-)
13
14
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
17
--- a/target/arm/cpu.c
17
+++ b/target/arm/translate-a64.c
18
+++ b/target/arm/cpu.c
18
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
19
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
19
default:
20
ARMCPU *cpu = ARM_CPU(cs);
20
/* all other sf/type/rmode combinations are invalid */
21
CPUARMState *env = &cpu->env;
21
unallocated_encoding(s);
22
uint32_t psr = pstate_read(env);
22
- break;
23
- int i;
23
+ return;
24
+ int i, j;
25
int el = arm_current_el(env);
26
const char *ns_status;
27
bool sve;
28
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
29
}
30
31
if (sve) {
32
- int j, zcr_len = sve_vqm1_for_el(env, el);
33
+ int zcr_len = sve_vqm1_for_el(env, el);
34
35
for (i = 0; i <= FFR_PRED_NUM; i++) {
36
bool eol;
37
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
38
}
24
}
39
}
25
40
26
if (!fp_access_check(s)) {
41
- for (i = 0; i < 32; i++) {
42
- if (zcr_len == 0) {
43
+ if (zcr_len == 0) {
44
+ /*
45
+ * With vl=16, there are only 37 columns per register,
46
+ * so output two registers per line.
47
+ */
48
+ for (i = 0; i < 32; i++) {
49
qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
50
i, env->vfp.zregs[i].d[1],
51
env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
52
- } else if (zcr_len == 1) {
53
- qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
54
- ":%016" PRIx64 ":%016" PRIx64 "\n",
55
- i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
56
- env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
57
- } else {
58
+ }
59
+ } else {
60
+ for (i = 0; i < 32; i++) {
61
+ qemu_fprintf(f, "Z%02d=", i);
62
for (j = zcr_len; j >= 0; j--) {
63
- bool odd = (zcr_len - j) % 2 != 0;
64
- if (j == zcr_len) {
65
- qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
66
- } else if (!odd) {
67
- if (j > 0) {
68
- qemu_fprintf(f, " [%x-%x]=", j, j - 1);
69
- } else {
70
- qemu_fprintf(f, " [%x]=", j);
71
- }
72
- }
73
qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
74
env->vfp.zregs[i].d[j * 2 + 1],
75
- env->vfp.zregs[i].d[j * 2],
76
- odd || j == 0 ? "\n" : ":");
77
+ env->vfp.zregs[i].d[j * 2 + 0],
78
+ j ? ":" : "\n");
79
}
80
}
81
}
27
--
82
--
28
2.17.0
83
2.34.1
29
30
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Cc: qemu-stable@nongnu.org
3
Always print each matrix row whole, one per line, so that we
4
get the entire matrix in the proper shape.
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20230622151201.1578522-3-richard.henderson@linaro.org
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-6-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
target/arm/translate-a64.c | 30 ++++++++++++++----------------
11
target/arm/cpu.c | 18 ++++++++++++++++++
11
1 file changed, 14 insertions(+), 16 deletions(-)
12
1 file changed, 18 insertions(+)
12
13
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
14
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
16
--- a/target/arm/cpu.c
16
+++ b/target/arm/translate-a64.c
17
+++ b/target/arm/cpu.c
17
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg)
18
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
18
return v;
19
i, q[1], q[0], (i & 1 ? "\n" : " "));
20
}
21
}
22
+
23
+ if (cpu_isar_feature(aa64_sme, cpu) &&
24
+ FIELD_EX64(env->svcr, SVCR, ZA) &&
25
+ sme_exception_el(env, el) == 0) {
26
+ int zcr_len = sve_vqm1_for_el_sm(env, el, true);
27
+ int svl = (zcr_len + 1) * 16;
28
+ int svl_lg10 = svl < 100 ? 2 : 3;
29
+
30
+ for (i = 0; i < svl; i++) {
31
+ qemu_fprintf(f, "ZA[%0*d]=", svl_lg10, i);
32
+ for (j = zcr_len; j >= 0; --j) {
33
+ qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%c",
34
+ env->zarray[i].d[2 * j + 1],
35
+ env->zarray[i].d[2 * j],
36
+ j ? ':' : '\n');
37
+ }
38
+ }
39
+ }
19
}
40
}
20
41
21
+static TCGv_i32 read_fp_hreg(DisasContext *s, int reg)
42
#else
22
+{
23
+ TCGv_i32 v = tcg_temp_new_i32();
24
+
25
+ tcg_gen_ld16u_i32(v, cpu_env, fp_reg_offset(s, reg, MO_16));
26
+ return v;
27
+}
28
+
29
/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
30
* If SVE is not enabled, then there are only 128 bits in the vector.
31
*/
32
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
33
static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
34
{
35
TCGv_ptr fpst = NULL;
36
- TCGv_i32 tcg_op = tcg_temp_new_i32();
37
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
38
TCGv_i32 tcg_res = tcg_temp_new_i32();
39
40
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
41
-
42
switch (opcode) {
43
case 0x0: /* FMOV */
44
tcg_gen_mov_i32(tcg_res, tcg_op);
45
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_diff(DisasContext *s, uint32_t insn)
46
tcg_temp_free_i64(tcg_op2);
47
tcg_temp_free_i64(tcg_res);
48
} else {
49
- TCGv_i32 tcg_op1 = tcg_temp_new_i32();
50
- TCGv_i32 tcg_op2 = tcg_temp_new_i32();
51
+ TCGv_i32 tcg_op1 = read_fp_hreg(s, rn);
52
+ TCGv_i32 tcg_op2 = read_fp_hreg(s, rm);
53
TCGv_i64 tcg_res = tcg_temp_new_i64();
54
55
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
56
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
57
-
58
gen_helper_neon_mull_s16(tcg_res, tcg_op1, tcg_op2);
59
gen_helper_neon_addl_saturate_s32(tcg_res, cpu_env, tcg_res, tcg_res);
60
61
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s,
62
63
fpst = get_fpstatus_ptr(true);
64
65
- tcg_op1 = tcg_temp_new_i32();
66
- tcg_op2 = tcg_temp_new_i32();
67
+ tcg_op1 = read_fp_hreg(s, rn);
68
+ tcg_op2 = read_fp_hreg(s, rm);
69
tcg_res = tcg_temp_new_i32();
70
71
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
72
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
73
-
74
switch (fpopcode) {
75
case 0x03: /* FMULX */
76
gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst);
77
@@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
78
}
79
80
if (is_scalar) {
81
- TCGv_i32 tcg_op = tcg_temp_new_i32();
82
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
83
TCGv_i32 tcg_res = tcg_temp_new_i32();
84
85
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
86
-
87
switch (fpop) {
88
case 0x1a: /* FCVTNS */
89
case 0x1b: /* FCVTMS */
90
--
43
--
91
2.17.0
44
2.34.1
92
93
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
We missed all of the scalar fp16 fma operations.
3
For the outer product set of insns, which take an entire matrix
4
tile as output, the argument is not a combined tile+column.
5
Therefore using get_tile_rowcol was incorrect, as we extracted
6
the tile number from itself.
7
8
The test case relies only on assembler support for SME, since
9
no release of GCC recognizes -march=armv9-a+sme yet.
4
10
5
Cc: qemu-stable@nongnu.org
11
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
12
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1620
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
14
Message-id: 20230622151201.1578522-5-richard.henderson@linaro.org
9
Message-id: 20180512003217.9105-8-richard.henderson@linaro.org
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
17
---
12
target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++
18
target/arm/tcg/translate-sme.c | 24 ++++++---
13
1 file changed, 48 insertions(+)
19
tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++++++++++++++++
14
20
tests/tcg/aarch64/Makefile.target | 10 ++--
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
21
3 files changed, 108 insertions(+), 9 deletions(-)
22
create mode 100644 tests/tcg/aarch64/sme-outprod1.c
23
24
diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c
16
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
26
--- a/target/arm/tcg/translate-sme.c
18
+++ b/target/arm/translate-a64.c
27
+++ b/target/arm/tcg/translate-sme.c
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1,
28
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs,
20
tcg_temp_free_i64(tcg_res);
29
return addr;
21
}
30
}
22
31
23
+/* Floating-point data-processing (3 source) - half precision */
32
+/*
24
+static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1,
33
+ * Resolve tile.size[0] to a host pointer.
25
+ int rd, int rn, int rm, int ra)
34
+ * Used by e.g. outer product insns where we require the entire tile.
35
+ */
36
+static TCGv_ptr get_tile(DisasContext *s, int esz, int tile)
26
+{
37
+{
27
+ TCGv_i32 tcg_op1, tcg_op2, tcg_op3;
38
+ TCGv_ptr addr = tcg_temp_new_ptr();
28
+ TCGv_i32 tcg_res = tcg_temp_new_i32();
39
+ int offset;
29
+ TCGv_ptr fpst = get_fpstatus_ptr(true);
40
+
30
+
41
+ offset = tile * sizeof(ARMVectorReg) + offsetof(CPUARMState, zarray);
31
+ tcg_op1 = read_fp_hreg(s, rn);
42
+
32
+ tcg_op2 = read_fp_hreg(s, rm);
43
+ tcg_gen_addi_ptr(addr, cpu_env, offset);
33
+ tcg_op3 = read_fp_hreg(s, ra);
44
+ return addr;
34
+
45
+}
35
+ /* These are fused multiply-add, and must be done as one
46
+
36
+ * floating point operation with no rounding between the
47
static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
37
+ * multiplication and addition steps.
48
{
38
+ * NB that doing the negations here as separate steps is
49
if (!dc_isar_feature(aa64_sme, s)) {
39
+ * correct : an input NaN should come out with its sign bit
50
@@ -XXX,XX +XXX,XX @@ static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz,
40
+ * flipped if it is a negated-input.
51
return true;
41
+ */
52
}
42
+ if (o1 == true) {
53
43
+ tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000);
54
- /* Sum XZR+zad to find ZAd. */
55
- za = get_tile_rowcol(s, esz, 31, a->zad, false);
56
+ za = get_tile(s, esz, a->zad);
57
zn = vec_full_reg_ptr(s, a->zn);
58
pn = pred_full_reg_ptr(s, a->pn);
59
pm = pred_full_reg_ptr(s, a->pm);
60
@@ -XXX,XX +XXX,XX @@ static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz,
61
return true;
62
}
63
64
- /* Sum XZR+zad to find ZAd. */
65
- za = get_tile_rowcol(s, esz, 31, a->zad, false);
66
+ za = get_tile(s, esz, a->zad);
67
zn = vec_full_reg_ptr(s, a->zn);
68
zm = vec_full_reg_ptr(s, a->zm);
69
pn = pred_full_reg_ptr(s, a->pn);
70
@@ -XXX,XX +XXX,XX @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
71
return true;
72
}
73
74
- /* Sum XZR+zad to find ZAd. */
75
- za = get_tile_rowcol(s, esz, 31, a->zad, false);
76
+ za = get_tile(s, esz, a->zad);
77
zn = vec_full_reg_ptr(s, a->zn);
78
zm = vec_full_reg_ptr(s, a->zm);
79
pn = pred_full_reg_ptr(s, a->pn);
80
diff --git a/tests/tcg/aarch64/sme-outprod1.c b/tests/tcg/aarch64/sme-outprod1.c
81
new file mode 100644
82
index XXXXXXX..XXXXXXX
83
--- /dev/null
84
+++ b/tests/tcg/aarch64/sme-outprod1.c
85
@@ -XXX,XX +XXX,XX @@
86
+/*
87
+ * SME outer product, 1 x 1.
88
+ * SPDX-License-Identifier: GPL-2.0-or-later
89
+ */
90
+
91
+#include <stdio.h>
92
+
93
+extern void foo(float *dst);
94
+
95
+asm(
96
+"    .arch_extension sme\n"
97
+"    .type foo, @function\n"
98
+"foo:\n"
99
+"    stp x29, x30, [sp, -80]!\n"
100
+"    mov x29, sp\n"
101
+"    stp d8, d9, [sp, 16]\n"
102
+"    stp d10, d11, [sp, 32]\n"
103
+"    stp d12, d13, [sp, 48]\n"
104
+"    stp d14, d15, [sp, 64]\n"
105
+"    smstart\n"
106
+"    ptrue p0.s, vl4\n"
107
+"    fmov z0.s, #1.0\n"
108
+/*
109
+ * An outer product of a vector of 1.0 by itself should be a matrix of 1.0.
110
+ * Note that we are using tile 1 here (za1.s) rather than tile 0.
111
+ */
112
+"    zero {za}\n"
113
+"    fmopa za1.s, p0/m, p0/m, z0.s, z0.s\n"
114
+/*
115
+ * Read the first 4x4 sub-matrix of elements from tile 1:
116
+ * Note that za1h should be interchangable here.
117
+ */
118
+"    mov w12, #0\n"
119
+"    mova z0.s, p0/m, za1v.s[w12, #0]\n"
120
+"    mova z1.s, p0/m, za1v.s[w12, #1]\n"
121
+"    mova z2.s, p0/m, za1v.s[w12, #2]\n"
122
+"    mova z3.s, p0/m, za1v.s[w12, #3]\n"
123
+/*
124
+ * And store them to the input pointer (dst in the C code):
125
+ */
126
+"    st1w {z0.s}, p0, [x0]\n"
127
+"    add x0, x0, #16\n"
128
+"    st1w {z1.s}, p0, [x0]\n"
129
+"    add x0, x0, #16\n"
130
+"    st1w {z2.s}, p0, [x0]\n"
131
+"    add x0, x0, #16\n"
132
+"    st1w {z3.s}, p0, [x0]\n"
133
+"    smstop\n"
134
+"    ldp d8, d9, [sp, 16]\n"
135
+"    ldp d10, d11, [sp, 32]\n"
136
+"    ldp d12, d13, [sp, 48]\n"
137
+"    ldp d14, d15, [sp, 64]\n"
138
+"    ldp x29, x30, [sp], 80\n"
139
+"    ret\n"
140
+"    .size foo, . - foo"
141
+);
142
+
143
+int main()
144
+{
145
+ float dst[16];
146
+ int i, j;
147
+
148
+ foo(dst);
149
+
150
+ for (i = 0; i < 16; i++) {
151
+ if (dst[i] != 1.0f) {
152
+ break;
153
+ }
44
+ }
154
+ }
45
+
155
+
46
+ if (o0 != o1) {
156
+ if (i == 16) {
47
+ tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000);
157
+ return 0; /* success */
48
+ }
158
+ }
49
+
159
+
50
+ gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_op3, fpst);
160
+ /* failure */
51
+
161
+ for (i = 0; i < 4; ++i) {
52
+ write_fp_sreg(s, rd, tcg_res);
162
+ for (j = 0; j < 4; ++j) {
53
+
163
+ printf("%f ", (double)dst[i * 4 + j]);
54
+ tcg_temp_free_ptr(fpst);
164
+ }
55
+ tcg_temp_free_i32(tcg_op1);
165
+ printf("\n");
56
+ tcg_temp_free_i32(tcg_op2);
166
+ }
57
+ tcg_temp_free_i32(tcg_op3);
167
+ return 1;
58
+ tcg_temp_free_i32(tcg_res);
59
+}
168
+}
60
+
169
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
61
/* Floating point data-processing (3 source)
170
index XXXXXXX..XXXXXXX 100644
62
* 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0
171
--- a/tests/tcg/aarch64/Makefile.target
63
* +---+---+---+-----------+------+----+------+----+------+------+------+
172
+++ b/tests/tcg/aarch64/Makefile.target
64
@@ -XXX,XX +XXX,XX @@ static void disas_fp_3src(DisasContext *s, uint32_t insn)
173
@@ -XXX,XX +XXX,XX @@ config-cc.mak: Makefile
65
}
174
     $(call cc-option,-march=armv8.5-a, CROSS_CC_HAS_ARMV8_5); \
66
handle_fp_3src_double(s, o0, o1, rd, rn, rm, ra);
175
     $(call cc-option,-mbranch-protection=standard, CROSS_CC_HAS_ARMV8_BTI); \
67
break;
176
     $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE); \
68
+ case 3:
177
-     $(call cc-option,-march=armv9-a+sme, CROSS_CC_HAS_ARMV9_SME)) 3> config-cc.mak
69
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
178
+     $(call cc-option,-Wa$(COMMA)-march=armv9-a+sme, CROSS_AS_HAS_ARMV9_SME)) 3> config-cc.mak
70
+ unallocated_encoding(s);
179
-include config-cc.mak
71
+ return;
180
72
+ }
181
ifneq ($(CROSS_CC_HAS_ARMV8_2),)
73
+ if (!fp_access_check(s)) {
182
@@ -XXX,XX +XXX,XX @@ AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 mte-7
74
+ return;
183
mte-%: CFLAGS += -march=armv8.5-a+memtag
75
+ }
184
endif
76
+ handle_fp_3src_half(s, o0, o1, rd, rn, rm, ra);
185
77
+ break;
186
+ifneq ($(CROSS_AS_HAS_ARMV9_SME),)
78
default:
187
+AARCH64_TESTS += sme-outprod1
79
unallocated_encoding(s);
188
+endif
80
}
189
+
190
ifneq ($(CROSS_CC_HAS_SVE),)
191
# System Registers Tests
192
AARCH64_TESTS += sysregs
193
-ifneq ($(CROSS_CC_HAS_ARMV9_SME),)
194
-sysregs: CFLAGS+=-march=armv9-a+sme -DHAS_ARMV9_SME
195
+ifneq ($(CROSS_AS_HAS_ARMV9_SME),)
196
+sysregs: CFLAGS+=-Wa,-march=armv9-a+sme -DHAS_ARMV9_SME
197
else
198
sysregs: CFLAGS+=-march=armv8.1-a+sve
199
endif
81
--
200
--
82
2.17.0
201
2.34.1
83
84
diff view generated by jsdifflib
1
In commit d81ce0ef2c4f105 we added an extra float_status field
1
From: John Högberg <john.hogberg@ericsson.com>
2
fp_status_fp16 for Arm, but forgot to initialize it correctly
3
by setting it to float_tininess_before_rounding. This currently
4
will only cause problems for the new V8_FP16 feature, since the
5
float-to-float conversion code doesn't use it yet. The effect
6
would be that we failed to set the Underflow IEEE exception flag
7
in all the cases where we should.
8
2
9
Add the missing initialization.
3
Unlike architectures with precise self-modifying code semantics
4
(e.g. x86) ARM processors do not maintain coherency for instruction
5
execution and memory, requiring an instruction synchronization
6
barrier on every core that will execute the new code, and on many
7
models also the explicit use of cache management instructions.
10
8
11
Fixes: d81ce0ef2c4f105
9
While this is required to make JITs work on actual hardware, QEMU
12
Cc: qemu-stable@nongnu.org
10
has gotten away with not handling this since it does not emulate
11
caches, and unconditionally invalidates code whenever the softmmu
12
or the user-mode page protection logic detects that code has been
13
modified.
14
15
Unfortunately the latter does not work in the face of dual-mapped
16
code (a common W^X workaround), where one page is executable and
17
the other is writable: user-mode has no way to connect one with the
18
other as that is only known to the kernel and the emulated
19
application.
20
21
This commit works around the issue by telling software that
22
instruction cache invalidation is required by clearing the
23
CPR_EL0.DIC flag (regardless of whether the emulated processor
24
needs it), and then invalidating code in IC IVAU instructions.
25
26
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1034
27
28
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
29
Signed-off-by: John Högberg <john.hogberg@ericsson.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
30
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
31
Message-id: 168778890374.24232.3402138851538068785-1@git.sr.ht
32
[PMM: removed unnecessary AArch64 feature check; moved
33
"clear CTR_EL1.DIC" code up a bit so it's not in the middle
34
of the vfp/neon related tests]
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Message-id: 20180512004311.9299-16-richard.henderson@linaro.org
17
---
36
---
18
target/arm/cpu.c | 2 ++
37
target/arm/cpu.c | 11 +++++++++++
19
1 file changed, 2 insertions(+)
38
target/arm/helper.c | 47 ++++++++++++++++++++++++++++++++++++++++++---
39
2 files changed, 55 insertions(+), 3 deletions(-)
20
40
21
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
41
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
22
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.c
43
--- a/target/arm/cpu.c
24
+++ b/target/arm/cpu.c
44
+++ b/target/arm/cpu.c
25
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
45
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
26
&env->vfp.fp_status);
46
return;
27
set_float_detect_tininess(float_tininess_before_rounding,
47
}
28
&env->vfp.standard_fp_status);
48
29
+ set_float_detect_tininess(float_tininess_before_rounding,
49
+#ifdef CONFIG_USER_ONLY
30
+ &env->vfp.fp_status_f16);
50
+ /*
31
#ifndef CONFIG_USER_ONLY
51
+ * User mode relies on IC IVAU instructions to catch modification of
32
if (kvm_enabled()) {
52
+ * dual-mapped code.
33
kvm_arm_reset_vcpu(cpu);
53
+ *
54
+ * Clear CTR_EL0.DIC to ensure that software that honors these flags uses
55
+ * IC IVAU even if the emulated processor does not normally require it.
56
+ */
57
+ cpu->ctr = FIELD_DP64(cpu->ctr, CTR_EL0, DIC, 0);
58
+#endif
59
+
60
if (arm_feature(env, ARM_FEATURE_AARCH64) &&
61
cpu->has_vfp != cpu->has_neon) {
62
/*
63
diff --git a/target/arm/helper.c b/target/arm/helper.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/helper.c
66
+++ b/target/arm/helper.c
67
@@ -XXX,XX +XXX,XX @@ static void mdcr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri,
68
}
69
}
70
71
+#ifdef CONFIG_USER_ONLY
72
+/*
73
+ * `IC IVAU` is handled to improve compatibility with JITs that dual-map their
74
+ * code to get around W^X restrictions, where one region is writable and the
75
+ * other is executable.
76
+ *
77
+ * Since the executable region is never written to we cannot detect code
78
+ * changes when running in user mode, and rely on the emulated JIT telling us
79
+ * that the code has changed by executing this instruction.
80
+ */
81
+static void ic_ivau_write(CPUARMState *env, const ARMCPRegInfo *ri,
82
+ uint64_t value)
83
+{
84
+ uint64_t icache_line_mask, start_address, end_address;
85
+ const ARMCPU *cpu;
86
+
87
+ cpu = env_archcpu(env);
88
+
89
+ icache_line_mask = (4 << extract32(cpu->ctr, 0, 4)) - 1;
90
+ start_address = value & ~icache_line_mask;
91
+ end_address = value | icache_line_mask;
92
+
93
+ mmap_lock();
94
+
95
+ tb_invalidate_phys_range(start_address, end_address);
96
+
97
+ mmap_unlock();
98
+}
99
+#endif
100
+
101
static const ARMCPRegInfo v8_cp_reginfo[] = {
102
/*
103
* Minimal set of EL0-visible registers. This will need to be expanded
104
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
105
{ .name = "CURRENTEL", .state = ARM_CP_STATE_AA64,
106
.opc0 = 3, .opc1 = 0, .opc2 = 2, .crn = 4, .crm = 2,
107
.access = PL1_R, .type = ARM_CP_CURRENTEL },
108
- /* Cache ops: all NOPs since we don't emulate caches */
109
+ /*
110
+ * Instruction cache ops. All of these except `IC IVAU` NOP because we
111
+ * don't emulate caches.
112
+ */
113
{ .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64,
114
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
115
.access = PL1_W, .type = ARM_CP_NOP,
116
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
117
.accessfn = access_tocu },
118
{ .name = "IC_IVAU", .state = ARM_CP_STATE_AA64,
119
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1,
120
- .access = PL0_W, .type = ARM_CP_NOP,
121
+ .access = PL0_W,
122
.fgt = FGT_ICIVAU,
123
- .accessfn = access_tocu },
124
+ .accessfn = access_tocu,
125
+#ifdef CONFIG_USER_ONLY
126
+ .type = ARM_CP_NO_RAW,
127
+ .writefn = ic_ivau_write
128
+#else
129
+ .type = ARM_CP_NOP
130
+#endif
131
+ },
132
+ /* Cache ops: all NOPs since we don't emulate caches */
133
{ .name = "DC_IVAC", .state = ARM_CP_STATE_AA64,
134
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1,
135
.access = PL1_W, .accessfn = aa64_cacheop_poc_access,
34
--
136
--
35
2.17.0
137
2.34.1
36
138
37
139
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: John Högberg <john.hogberg@ericsson.com>
2
2
3
Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status":
3
https://gitlab.com/qemu-project/qemu/-/issues/1034
4
4
5
The block length is predefined to 512 bits
5
Signed-off-by: John Högberg <john.hogberg@ericsson.com>
6
6
Message-id: 168778890374.24232.3402138851538068785-2@git.sr.ht
7
and "4.10.2 SD Status":
8
9
The SD Status contains status bits that are related to the SD Memory Card
10
proprietary features and may be used for future application-specific usage.
11
The size of the SD Status is one data block of 512 bit. The content of this
12
register is transmitted to the Host over the DAT bus along with a 16-bit CRC.
13
14
Thus the 16-bit CRC goes at offset 64.
15
16
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Message-id: 20180509060104.4458-3-f4bug@amsat.org
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
[PMM: fixed typo in comment]
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
10
---
21
hw/sd/sd.c | 2 +-
11
tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++
22
1 file changed, 1 insertion(+), 1 deletion(-)
12
tests/tcg/aarch64/Makefile.target | 3 +-
23
13
2 files changed, 191 insertions(+), 1 deletion(-)
24
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
14
create mode 100644 tests/tcg/aarch64/icivau.c
15
16
diff --git a/tests/tcg/aarch64/icivau.c b/tests/tcg/aarch64/icivau.c
17
new file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- /dev/null
20
+++ b/tests/tcg/aarch64/icivau.c
21
@@ -XXX,XX +XXX,XX @@
22
+/*
23
+ * Tests the IC IVAU-driven workaround for catching changes made to dual-mapped
24
+ * code that would otherwise go unnoticed in user mode.
25
+ *
26
+ * Copyright (c) 2023 Ericsson AB
27
+ * SPDX-License-Identifier: GPL-2.0-or-later
28
+ */
29
+
30
+#include <sys/mman.h>
31
+#include <sys/stat.h>
32
+#include <string.h>
33
+#include <stdint.h>
34
+#include <stdlib.h>
35
+#include <unistd.h>
36
+#include <fcntl.h>
37
+
38
+#define MAX_CODE_SIZE 128
39
+
40
+typedef int (SelfModTest)(uint32_t, uint32_t*);
41
+typedef int (BasicTest)(int);
42
+
43
+static void mark_code_modified(const uint32_t *exec_data, size_t length)
44
+{
45
+ int dc_required, ic_required;
46
+ unsigned long ctr_el0;
47
+
48
+ /*
49
+ * Clear the data/instruction cache, as indicated by the CTR_ELO.{DIC,IDC}
50
+ * flags.
51
+ *
52
+ * For completeness we might be tempted to assert that we should fail when
53
+ * the whole code update sequence is omitted, but that would make the test
54
+ * flaky as it can succeed by coincidence on actual hardware.
55
+ */
56
+ asm ("mrs %0, ctr_el0\n" : "=r"(ctr_el0));
57
+
58
+ /* CTR_EL0.IDC */
59
+ dc_required = !((ctr_el0 >> 28) & 1);
60
+
61
+ /* CTR_EL0.DIC */
62
+ ic_required = !((ctr_el0 >> 29) & 1);
63
+
64
+ if (dc_required) {
65
+ size_t dcache_stride, i;
66
+
67
+ /*
68
+ * Step according to the minimum cache size, as the cache maintenance
69
+ * instructions operate on the cache line of the given address.
70
+ *
71
+ * We assume that exec_data is properly aligned.
72
+ */
73
+ dcache_stride = (4 << ((ctr_el0 >> 16) & 0xF));
74
+
75
+ for (i = 0; i < length; i += dcache_stride) {
76
+ const char *dc_addr = &((const char *)exec_data)[i];
77
+ asm volatile ("dc cvau, %x[dc_addr]\n"
78
+ : /* no outputs */
79
+ : [dc_addr] "r"(dc_addr)
80
+ : "memory");
81
+ }
82
+
83
+ asm volatile ("dmb ish\n");
84
+ }
85
+
86
+ if (ic_required) {
87
+ size_t icache_stride, i;
88
+
89
+ icache_stride = (4 << (ctr_el0 & 0xF));
90
+
91
+ for (i = 0; i < length; i += icache_stride) {
92
+ const char *ic_addr = &((const char *)exec_data)[i];
93
+ asm volatile ("ic ivau, %x[ic_addr]\n"
94
+ : /* no outputs */
95
+ : [ic_addr] "r"(ic_addr)
96
+ : "memory");
97
+ }
98
+
99
+ asm volatile ("dmb ish\n");
100
+ }
101
+
102
+ asm volatile ("isb sy\n");
103
+}
104
+
105
+static int basic_test(uint32_t *rw_data, const uint32_t *exec_data)
106
+{
107
+ /*
108
+ * As user mode only misbehaved for dual-mapped code when previously
109
+ * translated code had been changed, we'll start off with this basic test
110
+ * function to ensure that there's already some translated code at
111
+ * exec_data before the next test. This should cause the next test to fail
112
+ * if `mark_code_modified` fails to invalidate the code.
113
+ *
114
+ * Note that the payload is in binary form instead of inline assembler
115
+ * because we cannot use __attribute__((naked)) on this platform and the
116
+ * workarounds are at least as ugly as this is.
117
+ */
118
+ static const uint32_t basic_payload[] = {
119
+ 0xD65F03C0 /* 0x00: RET */
120
+ };
121
+
122
+ BasicTest *copied_ptr = (BasicTest *)exec_data;
123
+
124
+ memcpy(rw_data, basic_payload, sizeof(basic_payload));
125
+ mark_code_modified(exec_data, sizeof(basic_payload));
126
+
127
+ return copied_ptr(1234) == 1234;
128
+}
129
+
130
+static int self_modification_test(uint32_t *rw_data, const uint32_t *exec_data)
131
+{
132
+ /*
133
+ * This test is self-modifying in an attempt to cover an edge case where
134
+ * the IC IVAU instruction invalidates itself.
135
+ *
136
+ * Note that the IC IVAU instruction is 16 bytes into the function, in what
137
+ * will be the same cache line as the modified instruction on machines with
138
+ * a cache line size >= 16 bytes.
139
+ */
140
+ static const uint32_t self_mod_payload[] = {
141
+ /* Overwrite the placeholder instruction with the new one. */
142
+ 0xB9001C20, /* 0x00: STR w0, [x1, 0x1C] */
143
+
144
+ /* Get the executable address of the modified instruction. */
145
+ 0x100000A8, /* 0x04: ADR x8, <0x1C> */
146
+
147
+ /* Mark the modified instruction as updated. */
148
+ 0xD50B7B28, /* 0x08: DC CVAU x8 */
149
+ 0xD5033BBF, /* 0x0C: DMB ISH */
150
+ 0xD50B7528, /* 0x10: IC IVAU x8 */
151
+ 0xD5033BBF, /* 0x14: DMB ISH */
152
+ 0xD5033FDF, /* 0x18: ISB */
153
+
154
+ /* Placeholder instruction, overwritten above. */
155
+ 0x52800000, /* 0x1C: MOV w0, 0 */
156
+
157
+ 0xD65F03C0 /* 0x20: RET */
158
+ };
159
+
160
+ SelfModTest *copied_ptr = (SelfModTest *)exec_data;
161
+ int i;
162
+
163
+ memcpy(rw_data, self_mod_payload, sizeof(self_mod_payload));
164
+ mark_code_modified(exec_data, sizeof(self_mod_payload));
165
+
166
+ for (i = 1; i < 10; i++) {
167
+ /* Replace the placeholder instruction with `MOV w0, i` */
168
+ uint32_t new_instr = 0x52800000 | (i << 5);
169
+
170
+ if (copied_ptr(new_instr, rw_data) != i) {
171
+ return 0;
172
+ }
173
+ }
174
+
175
+ return 1;
176
+}
177
+
178
+int main(int argc, char **argv)
179
+{
180
+ const char *shm_name = "qemu-test-tcg-aarch64-icivau";
181
+ int fd;
182
+
183
+ fd = shm_open(shm_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
184
+
185
+ if (fd < 0) {
186
+ return EXIT_FAILURE;
187
+ }
188
+
189
+ /* Unlink early to avoid leaving garbage in case the test crashes. */
190
+ shm_unlink(shm_name);
191
+
192
+ if (ftruncate(fd, MAX_CODE_SIZE) == 0) {
193
+ const uint32_t *exec_data;
194
+ uint32_t *rw_data;
195
+
196
+ rw_data = mmap(0, MAX_CODE_SIZE, PROT_READ | PROT_WRITE,
197
+ MAP_SHARED, fd, 0);
198
+ exec_data = mmap(0, MAX_CODE_SIZE, PROT_READ | PROT_EXEC,
199
+ MAP_SHARED, fd, 0);
200
+
201
+ if (rw_data && exec_data) {
202
+ if (basic_test(rw_data, exec_data) &&
203
+ self_modification_test(rw_data, exec_data)) {
204
+ return EXIT_SUCCESS;
205
+ }
206
+ }
207
+ }
208
+
209
+ return EXIT_FAILURE;
210
+}
211
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
25
index XXXXXXX..XXXXXXX 100644
212
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/sd/sd.c
213
--- a/tests/tcg/aarch64/Makefile.target
27
+++ b/hw/sd/sd.c
214
+++ b/tests/tcg/aarch64/Makefile.target
28
@@ -XXX,XX +XXX,XX @@ static void sd_function_switch(SDState *sd, uint32_t arg)
215
@@ -XXX,XX +XXX,XX @@ AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64
29
sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
216
VPATH         += $(AARCH64_SRC)
30
}
217
31
memset(&sd->data[17], 0, 47);
218
# Base architecture tests
32
- stw_be_p(sd->data + 65, sd_crc16(sd->data, 64));
219
-AARCH64_TESTS=fcvt pcalign-a64
33
+ stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));
220
+AARCH64_TESTS=fcvt pcalign-a64 icivau
34
}
221
35
222
fcvt: LDFLAGS+=-lm
36
static inline bool sd_wp_addr(SDState *sd, uint64_t addr)
223
+icivau: LDFLAGS+=-lrt
224
225
run-fcvt: fcvt
226
    $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)")
37
--
227
--
38
2.17.0
228
2.34.1
39
229
40
230
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Vikram Garhwal <vikram.garhwal@amd.com>
2
2
3
Adding the fp16 moves to/from general registers.
3
Following are done to fix the coverity issues:
4
1. Change read_data to fix the CID 1512899: Out-of-bounds access (OVERRUN)
5
2. Fix match_rx_tx_data to fix CID 1512900: Logically dead code (DEADCODE)
6
3. Replace rand() in generate_random_data() with g_rand_int()
4
7
5
Cc: qemu-stable@nongnu.org
8
Signed-off-by: Vikram Garhwal <vikram.garhwal@amd.com>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20230628202758.16398-1-vikram.garhwal@amd.com
7
Tested-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20180512003217.9105-2-richard.henderson@linaro.org
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
---
12
target/arm/translate-a64.c | 21 +++++++++++++++++++++
13
tests/qtest/xlnx-canfd-test.c | 33 +++++++++++----------------------
13
1 file changed, 21 insertions(+)
14
1 file changed, 11 insertions(+), 22 deletions(-)
14
15
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
16
diff --git a/tests/qtest/xlnx-canfd-test.c b/tests/qtest/xlnx-canfd-test.c
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
18
--- a/tests/qtest/xlnx-canfd-test.c
18
+++ b/target/arm/translate-a64.c
19
+++ b/tests/qtest/xlnx-canfd-test.c
19
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
20
@@ -XXX,XX +XXX,XX @@ static void generate_random_data(uint32_t *buf_tx, bool is_canfd_frame)
20
tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd));
21
/* Generate random TX data for CANFD frame. */
21
clear_vec_high(s, true, rd);
22
if (is_canfd_frame) {
22
break;
23
for (int i = 0; i < CANFD_FRAME_SIZE - 2; i++) {
23
+ case 3:
24
- buf_tx[2 + i] = rand();
24
+ /* 16 bit */
25
+ buf_tx[2 + i] = g_random_int();
25
+ tmp = tcg_temp_new_i64();
26
+ tcg_gen_ext16u_i64(tmp, tcg_rn);
27
+ write_fp_dreg(s, rd, tmp);
28
+ tcg_temp_free_i64(tmp);
29
+ break;
30
+ default:
31
+ g_assert_not_reached();
32
}
26
}
33
} else {
27
} else {
34
TCGv_i64 tcg_rd = cpu_reg(s, rd);
28
/* Generate random TX data for CAN frame. */
35
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
29
for (int i = 0; i < CAN_FRAME_SIZE - 2; i++) {
36
/* 64 bits from top half */
30
- buf_tx[2 + i] = rand();
37
tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(s, rn));
31
+ buf_tx[2 + i] = g_random_int();
38
break;
39
+ case 3:
40
+ /* 16 bit */
41
+ tcg_gen_ld16u_i64(tcg_rd, cpu_env, fp_reg_offset(s, rn, MO_16));
42
+ break;
43
+ default:
44
+ g_assert_not_reached();
45
}
32
}
46
}
33
}
47
}
34
}
48
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
35
49
case 0xa: /* 64 bit */
36
-static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx)
50
case 0xd: /* 64 bit to top half of quad */
37
+static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx,
51
break;
38
+ uint32_t frame_size)
52
+ case 0x6: /* 16-bit float, 32-bit int */
39
{
53
+ case 0xe: /* 16-bit float, 64-bit int */
40
uint32_t int_status;
54
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
41
uint32_t fifo_status_reg_value;
55
+ break;
42
/* At which RX FIFO the received data is stored. */
56
+ }
43
uint8_t store_ind = 0;
57
+ /* fallthru */
44
- bool is_canfd_frame = false;
58
default:
45
59
/* all other sf/type/rmode combinations are invalid */
46
/* Read the interrupt on CANFD rx. */
60
unallocated_encoding(s);
47
int_status = qtest_readl(qts, can_base_addr + R_ISR_OFFSET) & ISR_RXOK;
48
@@ -XXX,XX +XXX,XX @@ static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx)
49
buf_rx[0] = qtest_readl(qts, can_base_addr + R_RX0_ID_OFFSET);
50
buf_rx[1] = qtest_readl(qts, can_base_addr + R_RX0_DLC_OFFSET);
51
52
- is_canfd_frame = (buf_rx[1] >> DLC_FD_BIT_SHIFT) & 1;
53
-
54
- if (is_canfd_frame) {
55
- for (int i = 0; i < CANFD_FRAME_SIZE - 2; i++) {
56
- buf_rx[i + 2] = qtest_readl(qts,
57
- can_base_addr + R_RX0_DATA1_OFFSET + 4 * i);
58
- }
59
- } else {
60
- buf_rx[2] = qtest_readl(qts, can_base_addr + R_RX0_DATA1_OFFSET);
61
- buf_rx[3] = qtest_readl(qts, can_base_addr + R_RX0_DATA2_OFFSET);
62
+ for (int i = 0; i < frame_size - 2; i++) {
63
+ buf_rx[i + 2] = qtest_readl(qts,
64
+ can_base_addr + R_RX0_DATA1_OFFSET + 4 * i);
65
}
66
67
/* Clear the RX interrupt. */
68
@@ -XXX,XX +XXX,XX @@ static void match_rx_tx_data(const uint32_t *buf_tx, const uint32_t *buf_rx,
69
g_assert_cmpint((buf_rx[size] & DLC_FD_BIT_MASK), ==,
70
(buf_tx[size] & DLC_FD_BIT_MASK));
71
} else {
72
- if (!is_canfd_frame && size == 4) {
73
- break;
74
- }
75
-
76
g_assert_cmpint(buf_rx[size], ==, buf_tx[size]);
77
}
78
79
@@ -XXX,XX +XXX,XX @@ static void test_can_data_transfer(void)
80
write_data(qts, CANFD0_BASE_ADDR, buf_tx, false);
81
82
send_data(qts, CANFD0_BASE_ADDR);
83
- read_data(qts, CANFD1_BASE_ADDR, buf_rx);
84
+ read_data(qts, CANFD1_BASE_ADDR, buf_rx, CAN_FRAME_SIZE);
85
match_rx_tx_data(buf_tx, buf_rx, false);
86
87
qtest_quit(qts);
88
@@ -XXX,XX +XXX,XX @@ static void test_canfd_data_transfer(void)
89
write_data(qts, CANFD0_BASE_ADDR, buf_tx, true);
90
91
send_data(qts, CANFD0_BASE_ADDR);
92
- read_data(qts, CANFD1_BASE_ADDR, buf_rx);
93
+ read_data(qts, CANFD1_BASE_ADDR, buf_rx, CANFD_FRAME_SIZE);
94
match_rx_tx_data(buf_tx, buf_rx, true);
95
96
qtest_quit(qts);
97
@@ -XXX,XX +XXX,XX @@ static void test_can_loopback(void)
98
write_data(qts, CANFD0_BASE_ADDR, buf_tx, true);
99
100
send_data(qts, CANFD0_BASE_ADDR);
101
- read_data(qts, CANFD0_BASE_ADDR, buf_rx);
102
+ read_data(qts, CANFD0_BASE_ADDR, buf_rx, CANFD_FRAME_SIZE);
103
match_rx_tx_data(buf_tx, buf_rx, true);
104
105
generate_random_data(buf_tx, true);
106
@@ -XXX,XX +XXX,XX @@ static void test_can_loopback(void)
107
write_data(qts, CANFD1_BASE_ADDR, buf_tx, true);
108
109
send_data(qts, CANFD1_BASE_ADDR);
110
- read_data(qts, CANFD1_BASE_ADDR, buf_rx);
111
+ read_data(qts, CANFD1_BASE_ADDR, buf_rx, CANFD_FRAME_SIZE);
112
match_rx_tx_data(buf_tx, buf_rx, true);
113
114
qtest_quit(qts);
61
--
115
--
62
2.17.0
116
2.34.1
63
64
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Cc: qemu-stable@nongnu.org
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-5-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/translate-a64.c | 17 +++++++++++++++--
11
1 file changed, 15 insertions(+), 2 deletions(-)
12
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
16
+++ b/target/arm/translate-a64.c
17
@@ -XXX,XX +XXX,XX @@ static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn)
18
bool sf = extract32(insn, 31, 1);
19
bool itof;
20
21
- if (sbit || (type > 1)
22
- || (!sf && scale < 32)) {
23
+ if (sbit || (!sf && scale < 32)) {
24
+ unallocated_encoding(s);
25
+ return;
26
+ }
27
+
28
+ switch (type) {
29
+ case 0: /* float32 */
30
+ case 1: /* float64 */
31
+ break;
32
+ case 3: /* float16 */
33
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
34
+ break;
35
+ }
36
+ /* fallthru */
37
+ default:
38
unallocated_encoding(s);
39
return;
40
}
41
--
42
2.17.0
43
44
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
We missed all of the scalar fp16 binary operations.
3
This code is only relevant when TCG is present in the build. Building
4
with --disable-tcg --enable-xen on an x86 host we get:
4
5
5
Cc: qemu-stable@nongnu.org
6
$ ../configure --target-list=x86_64-softmmu,aarch64-softmmu --disable-tcg --enable-xen
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
$ make -j$(nproc)
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
...
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub.c.o: in function `m_sysreg_ptr':
9
Message-id: 20180512003217.9105-7-richard.henderson@linaro.org
10
../target/arm/gdbstub.c:358: undefined reference to `arm_v7m_get_sp_ptr'
11
../target/arm/gdbstub.c:361: undefined reference to `arm_v7m_get_sp_ptr'
12
13
libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub.c.o: in function `arm_gdb_get_m_systemreg':
14
../target/arm/gdbstub.c:405: undefined reference to `arm_v7m_mrs_control'
15
16
Signed-off-by: Fabiano Rosas <farosas@suse.de>
17
Message-id: 20230628164821.16771-1-farosas@suse.de
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
20
---
12
target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++
21
target/arm/gdbstub.c | 4 ++++
13
1 file changed, 65 insertions(+)
22
1 file changed, 4 insertions(+)
14
23
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
24
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
16
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
26
--- a/target/arm/gdbstub.c
18
+++ b/target/arm/translate-a64.c
27
+++ b/target/arm/gdbstub.c
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_2src_double(DisasContext *s, int opcode,
28
@@ -XXX,XX +XXX,XX @@ static int arm_gen_dynamic_sysreg_xml(CPUState *cs, int base_reg)
20
tcg_temp_free_i64(tcg_res);
29
return cpu->dyn_sysreg_xml.num;
21
}
30
}
22
31
23
+/* Floating-point data-processing (2 source) - half precision */
32
+#ifdef CONFIG_TCG
24
+static void handle_fp_2src_half(DisasContext *s, int opcode,
33
typedef enum {
25
+ int rd, int rn, int rm)
34
M_SYSREG_MSP,
26
+{
35
M_SYSREG_PSP,
27
+ TCGv_i32 tcg_op1;
36
@@ -XXX,XX +XXX,XX @@ static int arm_gen_dynamic_m_secextreg_xml(CPUState *cs, int orig_base_reg)
28
+ TCGv_i32 tcg_op2;
37
return cpu->dyn_m_secextreg_xml.num;
29
+ TCGv_i32 tcg_res;
38
}
30
+ TCGv_ptr fpst;
39
#endif
31
+
40
+#endif /* CONFIG_TCG */
32
+ tcg_res = tcg_temp_new_i32();
41
33
+ fpst = get_fpstatus_ptr(true);
42
const char *arm_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
34
+ tcg_op1 = read_fp_hreg(s, rn);
43
{
35
+ tcg_op2 = read_fp_hreg(s, rm);
44
@@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
36
+
45
arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs),
37
+ switch (opcode) {
46
"system-registers.xml", 0);
38
+ case 0x0: /* FMUL */
47
39
+ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst);
48
+#ifdef CONFIG_TCG
40
+ break;
49
if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) {
41
+ case 0x1: /* FDIV */
50
gdb_register_coprocessor(cs,
42
+ gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst);
51
arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg,
43
+ break;
52
@@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
44
+ case 0x2: /* FADD */
45
+ gen_helper_advsimd_addh(tcg_res, tcg_op1, tcg_op2, fpst);
46
+ break;
47
+ case 0x3: /* FSUB */
48
+ gen_helper_advsimd_subh(tcg_res, tcg_op1, tcg_op2, fpst);
49
+ break;
50
+ case 0x4: /* FMAX */
51
+ gen_helper_advsimd_maxh(tcg_res, tcg_op1, tcg_op2, fpst);
52
+ break;
53
+ case 0x5: /* FMIN */
54
+ gen_helper_advsimd_minh(tcg_res, tcg_op1, tcg_op2, fpst);
55
+ break;
56
+ case 0x6: /* FMAXNM */
57
+ gen_helper_advsimd_maxnumh(tcg_res, tcg_op1, tcg_op2, fpst);
58
+ break;
59
+ case 0x7: /* FMINNM */
60
+ gen_helper_advsimd_minnumh(tcg_res, tcg_op1, tcg_op2, fpst);
61
+ break;
62
+ case 0x8: /* FNMUL */
63
+ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst);
64
+ tcg_gen_xori_i32(tcg_res, tcg_res, 0x8000);
65
+ break;
66
+ default:
67
+ g_assert_not_reached();
68
+ }
69
+
70
+ write_fp_sreg(s, rd, tcg_res);
71
+
72
+ tcg_temp_free_ptr(fpst);
73
+ tcg_temp_free_i32(tcg_op1);
74
+ tcg_temp_free_i32(tcg_op2);
75
+ tcg_temp_free_i32(tcg_res);
76
+}
77
+
78
/* Floating point data-processing (2 source)
79
* 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0
80
* +---+---+---+-----------+------+---+------+--------+-----+------+------+
81
@@ -XXX,XX +XXX,XX @@ static void disas_fp_2src(DisasContext *s, uint32_t insn)
82
}
53
}
83
handle_fp_2src_double(s, opcode, rd, rn, rm);
54
#endif
84
break;
85
+ case 3:
86
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
87
+ unallocated_encoding(s);
88
+ return;
89
+ }
90
+ if (!fp_access_check(s)) {
91
+ return;
92
+ }
93
+ handle_fp_2src_half(s, opcode, rd, rn, rm);
94
+ break;
95
default:
96
unallocated_encoding(s);
97
}
55
}
56
+#endif /* CONFIG_TCG */
57
}
98
--
58
--
99
2.17.0
59
2.34.1
100
101
diff view generated by jsdifflib
Deleted patch
1
From: Alex Bennée <alex.bennee@linaro.org>
2
1
3
These were missed out from the rest of the half-precision work.
4
5
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180512003217.9105-10-richard.henderson@linaro.org
11
[rth: Fix erroneous check vs type]
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
target/arm/translate-a64.c | 31 +++++++++++++++++++++++++------
16
1 file changed, 25 insertions(+), 6 deletions(-)
17
18
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/translate-a64.c
21
+++ b/target/arm/translate-a64.c
22
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
23
unsigned int mos, type, rm, cond, rn, rd;
24
TCGv_i64 t_true, t_false, t_zero;
25
DisasCompare64 c;
26
+ TCGMemOp sz;
27
28
mos = extract32(insn, 29, 3);
29
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
30
+ type = extract32(insn, 22, 2);
31
rm = extract32(insn, 16, 5);
32
cond = extract32(insn, 12, 4);
33
rn = extract32(insn, 5, 5);
34
rd = extract32(insn, 0, 5);
35
36
- if (mos || type > 1) {
37
+ if (mos) {
38
+ unallocated_encoding(s);
39
+ return;
40
+ }
41
+
42
+ switch (type) {
43
+ case 0:
44
+ sz = MO_32;
45
+ break;
46
+ case 1:
47
+ sz = MO_64;
48
+ break;
49
+ case 3:
50
+ sz = MO_16;
51
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
52
+ break;
53
+ }
54
+ /* fallthru */
55
+ default:
56
unallocated_encoding(s);
57
return;
58
}
59
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
60
return;
61
}
62
63
- /* Zero extend sreg inputs to 64 bits now. */
64
+ /* Zero extend sreg & hreg inputs to 64 bits now. */
65
t_true = tcg_temp_new_i64();
66
t_false = tcg_temp_new_i64();
67
- read_vec_element(s, t_true, rn, 0, type ? MO_64 : MO_32);
68
- read_vec_element(s, t_false, rm, 0, type ? MO_64 : MO_32);
69
+ read_vec_element(s, t_true, rn, 0, sz);
70
+ read_vec_element(s, t_false, rm, 0, sz);
71
72
a64_test_cc(&c, cond);
73
t_zero = tcg_const_i64(0);
74
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
75
tcg_temp_free_i64(t_false);
76
a64_free_cc(&c);
77
78
- /* Note that sregs write back zeros to the high bits,
79
+ /* Note that sregs & hregs write back zeros to the high bits,
80
and we've already done the zero-extension. */
81
write_fp_dreg(s, rd, t_true);
82
tcg_temp_free_i64(t_true);
83
--
84
2.17.0
85
86
diff view generated by jsdifflib
Deleted patch
1
From: Alex Bennée <alex.bennee@linaro.org>
2
1
3
All the hard work is already done by vfp_expand_imm, we just need to
4
make sure we pick up the correct size.
5
6
Cc: qemu-stable@nongnu.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20180512003217.9105-11-richard.henderson@linaro.org
12
[rth: Merge unallocated_encoding check with TCGMemOp conversion.]
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
target/arm/translate-a64.c | 20 +++++++++++++++++---
17
1 file changed, 17 insertions(+), 3 deletions(-)
18
19
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate-a64.c
22
+++ b/target/arm/translate-a64.c
23
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
24
{
25
int rd = extract32(insn, 0, 5);
26
int imm8 = extract32(insn, 13, 8);
27
- int is_double = extract32(insn, 22, 2);
28
+ int type = extract32(insn, 22, 2);
29
uint64_t imm;
30
TCGv_i64 tcg_res;
31
+ TCGMemOp sz;
32
33
- if (is_double > 1) {
34
+ switch (type) {
35
+ case 0:
36
+ sz = MO_32;
37
+ break;
38
+ case 1:
39
+ sz = MO_64;
40
+ break;
41
+ case 3:
42
+ sz = MO_16;
43
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
44
+ break;
45
+ }
46
+ /* fallthru */
47
+ default:
48
unallocated_encoding(s);
49
return;
50
}
51
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
52
return;
53
}
54
55
- imm = vfp_expand_imm(MO_32 + is_double, imm8);
56
+ imm = vfp_expand_imm(sz, imm8);
57
58
tcg_res = tcg_const_i64(imm);
59
write_fp_dreg(s, rd, tcg_res);
60
--
61
2.17.0
62
63
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
2
3
We are meant to explicitly pass fpst, not cpu_env.
3
AwSRAMCClass is larger than SysBusDeviceClass so the class size must be
4
advertised accordingly.
4
5
5
Cc: qemu-stable@nongnu.org
6
Fixes: 05def917e1 ("hw: arm: allwinner-sramc: Add SRAM Controller support for R40")
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20230628110905.38125-1-akihiko.odaki@daynix.com
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Message-id: 20180512003217.9105-12-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
12
---
13
target/arm/translate-a64.c | 3 ++-
13
hw/misc/allwinner-sramc.c | 1 +
14
1 file changed, 2 insertions(+), 1 deletion(-)
14
1 file changed, 1 insertion(+)
15
15
16
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
16
diff --git a/hw/misc/allwinner-sramc.c b/hw/misc/allwinner-sramc.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-a64.c
18
--- a/hw/misc/allwinner-sramc.c
19
+++ b/target/arm/translate-a64.c
19
+++ b/hw/misc/allwinner-sramc.c
20
@@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
20
@@ -XXX,XX +XXX,XX @@ static const TypeInfo allwinner_sramc_info = {
21
tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000);
21
.parent = TYPE_SYS_BUS_DEVICE,
22
break;
22
.instance_init = allwinner_sramc_init,
23
case 0x3: /* FSQRT */
23
.instance_size = sizeof(AwSRAMCState),
24
- gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env);
24
+ .class_size = sizeof(AwSRAMCClass),
25
+ fpst = get_fpstatus_ptr(true);
25
.class_init = allwinner_sramc_class_init,
26
+ gen_helper_sqrt_f16(tcg_res, tcg_op, fpst);
26
};
27
break;
27
28
case 0x8: /* FRINTN */
29
case 0x9: /* FRINTP */
30
--
28
--
31
2.17.0
29
2.34.1
32
30
33
31
diff view generated by jsdifflib
1
Usually the logging of the CPU state produced by -d cpu is sufficient
1
In handle_interrupt() we use level as an index into the interrupt_vector[]
2
to diagnose problems, but sometimes you want to see the state of
2
array. This is safe because we have checked it against env->config->nlevel,
3
the floating point registers as well. We don't want to enable that
3
but Coverity can't see that (and it is only true because each CPU config
4
by default as it adds a lot of extra data to the log; instead,
4
sets its XCHAL_NUM_INTLEVELS to something less than MAX_NLEVELS), so it
5
allow it to be optionally enabled via -d fpu.
5
complains about a possible array overrun (CID 1507131)
6
7
Add an assert() which will make Coverity happy and catch the unlikely
8
case of a mis-set XCHAL_NUM_INTLEVELS in future.
6
9
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
9
Message-id: 20180510130024.31678-1-peter.maydell@linaro.org
12
Message-id: 20230623154135.1930261-1-peter.maydell@linaro.org
10
---
13
---
11
include/qemu/log.h | 1 +
14
target/xtensa/exc_helper.c | 3 +++
12
accel/tcg/cpu-exec.c | 9 ++++++---
15
1 file changed, 3 insertions(+)
13
util/log.c | 2 ++
14
3 files changed, 9 insertions(+), 3 deletions(-)
15
16
16
diff --git a/include/qemu/log.h b/include/qemu/log.h
17
diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/include/qemu/log.h
19
--- a/target/xtensa/exc_helper.c
19
+++ b/include/qemu/log.h
20
+++ b/target/xtensa/exc_helper.c
20
@@ -XXX,XX +XXX,XX @@ static inline bool qemu_log_separate(void)
21
@@ -XXX,XX +XXX,XX @@ static void handle_interrupt(CPUXtensaState *env)
21
#define CPU_LOG_PAGE (1 << 14)
22
CPUState *cs = env_cpu(env);
22
/* LOG_TRACE (1 << 15) is defined in log-for-trace.h */
23
23
#define CPU_LOG_TB_OP_IND (1 << 16)
24
if (level > 1) {
24
+#define CPU_LOG_TB_FPU (1 << 17)
25
+ /* env->config->nlevel check should have ensured this */
25
26
+ assert(level < sizeof(env->config->interrupt_vector));
26
/* Lock output for a series of related logs. Since this is not needed
27
+
27
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
28
env->sregs[EPC1 + level - 1] = env->pc;
28
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
29
env->sregs[EPS2 + level - 2] = env->sregs[PS];
29
index XXXXXXX..XXXXXXX 100644
30
env->sregs[PS] =
30
--- a/accel/tcg/cpu-exec.c
31
+++ b/accel/tcg/cpu-exec.c
32
@@ -XXX,XX +XXX,XX @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
33
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
34
&& qemu_log_in_addr_range(itb->pc)) {
35
qemu_log_lock();
36
+ int flags = 0;
37
+ if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
38
+ flags |= CPU_DUMP_FPU;
39
+ }
40
#if defined(TARGET_I386)
41
- log_cpu_state(cpu, CPU_DUMP_CCOP);
42
-#else
43
- log_cpu_state(cpu, 0);
44
+ flags |= CPU_DUMP_CCOP;
45
#endif
46
+ log_cpu_state(cpu, flags);
47
qemu_log_unlock();
48
}
49
#endif /* DEBUG_DISAS */
50
diff --git a/util/log.c b/util/log.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/util/log.c
53
+++ b/util/log.c
54
@@ -XXX,XX +XXX,XX @@ const QEMULogItem qemu_log_items[] = {
55
"show trace before each executed TB (lots of logs)" },
56
{ CPU_LOG_TB_CPU, "cpu",
57
"show CPU registers before entering a TB (lots of logs)" },
58
+ { CPU_LOG_TB_FPU, "fpu",
59
+ "include FPU registers in the 'cpu' logging" },
60
{ CPU_LOG_MMU, "mmu",
61
"log MMU-related activities" },
62
{ CPU_LOG_PCALL, "pcall",
63
--
31
--
64
2.17.0
32
2.34.1
65
66
diff view generated by jsdifflib