1
ARM queue: nothing particularly exciting, but 18 patches
1
The following changes since commit ad1b4ec39caa5b3f17cbd8160283a03a3dcfe2ae:
2
is enough to send out.
3
2
4
thanks
3
Merge remote-tracking branch 'remotes/kraxel/tags/input-20180515-pull-request' into staging (2018-05-15 12:50:06 +0100)
5
-- PMM
6
4
7
The following changes since commit 3dabde1128b671f36ac6cb36b97b273139964420:
5
are available in the Git repository at:
8
6
9
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20170914' into staging (2017-09-14 16:33:02 +0100)
7
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180515
10
8
11
are available in the git repository at:
9
for you to fetch changes up to ae7651804748c6b479d5ae09aeac4edb9c44f76e:
12
10
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170914
11
tcg: Optionally log FPU state in TCG -d cpu logging (2018-05-15 14:58:44 +0100)
14
15
for you to fetch changes up to ce3bc112cdb1d462e2d52eaa17a7314e7f3af504:
16
17
mps2-an511: Fix wiring of UART overflow interrupt lines (2017-09-14 18:43:19 +0100)
18
12
19
----------------------------------------------------------------
13
----------------------------------------------------------------
20
target-arm queue:
14
target-arm queue:
21
* v7M: various code cleanups
15
* Fix coverity nit in int_to_float code
22
* v7M: set correct BFSR bits on bus fault
16
* Don't set Invalid for float-to-int(MAXINT)
23
* v7M: clear exclusive monitor on reset and exception entry/exit
17
* Fix fp_status_f16 tininess before rounding
24
* v7M: don't apply priority mask to negative priorities
18
* Add various missing insns from the v8.2-FP16 extension
25
* zcu102: support 'secure' and 'virtualization' machine properties
19
* Fix sqrt_f16 exception raising
26
* aarch64: fix ERET single stepping
20
* sdcard: Correct CRC16 offset in sd_function_switch()
27
* gpex: implement PCI INTx routing
21
* tcg: Optionally log FPU state in TCG -d cpu logging
28
* mps2-an511: fix UART overflow interrupt line wiring
29
22
30
----------------------------------------------------------------
23
----------------------------------------------------------------
31
Alistair Francis (5):
24
Alex Bennée (5):
32
xlnx-ep108: Rename to ZCU102
25
fpu/softfloat: int_to_float ensure r fully initialised
33
xlnx-zcu102: Manually create the machines
26
target/arm: Implement FCMP for fp16
34
xlnx-zcu102: Add a machine level secure property
27
target/arm: Implement FCSEL for fp16
35
xlnx-zcu102: Add a machine level virtualization property
28
target/arm: Implement FMOV (immediate) for fp16
36
xlnx-zcu102: Mark the EP108 machine as deprecated
29
target/arm: Fix sqrt_f16 exception raising
37
30
38
Jaroslaw Pelczar (1):
31
Peter Maydell (3):
39
AArch64: Fix single stepping of ERET instruction
32
fpu/softfloat: Don't set Invalid for float-to-int(MAXINT)
33
target/arm: Fix fp_status_f16 tininess before rounding
34
tcg: Optionally log FPU state in TCG -d cpu logging
40
35
41
Peter Maydell (8):
36
Philippe Mathieu-Daudé (1):
42
target/arm: Use M_REG_NUM_BANKS rather than hardcoding 2
37
sdcard: Correct CRC16 offset in sd_function_switch()
43
target/arm: Clear exclusive monitor on v7M reset, exception entry/exit
44
target/arm: Get PRECISERR and IBUSERR the right way round
45
nvic: Don't apply group priority mask to negative priorities
46
target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit()
47
target/arm: Add and use defines for EXCRET constants
48
target/arm: Rename 'type' to 'excret' in do_v7m_exception_exit()
49
mps2-an511: Fix wiring of UART overflow interrupt lines
50
38
51
Pranavkumar Sawargaonkar (3):
39
Richard Henderson (7):
52
hw/pci-host/gpex: Set INTx index/gsi mapping
40
target/arm: Implement FMOV (general) for fp16
53
hw/arm/virt: Set INTx/gsi mapping
41
target/arm: Early exit after unallocated_encoding in disas_fp_int_conv
54
hw/pci-host/gpex: Implement PCI INTx routing
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
55
47
56
Richard Henderson (1):
48
include/qemu/log.h | 1 +
57
target/arm: Avoid an extra temporary for store_exclusive
49
target/arm/helper-a64.h | 2 +
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(-)
58
60
59
hw/arm/Makefile.objs | 2 +-
60
include/hw/arm/xlnx-zynqmp.h | 2 +
61
include/hw/pci-host/gpex.h | 3 +
62
target/arm/cpu.h | 35 +++---
63
target/arm/internals.h | 20 ++++
64
hw/arm/mps2.c | 4 +-
65
hw/arm/virt.c | 1 +
66
hw/arm/xlnx-ep108.c | 139 -----------------------
67
hw/arm/xlnx-zcu102.c | 259 +++++++++++++++++++++++++++++++++++++++++++
68
hw/arm/xlnx-zynqmp.c | 3 +-
69
hw/intc/armv7m_nvic.c | 11 +-
70
hw/pci-host/gpex.c | 22 ++++
71
target/arm/cpu.c | 6 +
72
target/arm/helper.c | 43 ++++---
73
target/arm/op_helper.c | 2 +-
74
target/arm/translate-a64.c | 27 ++---
75
16 files changed, 382 insertions(+), 197 deletions(-)
76
delete mode 100644 hw/arm/xlnx-ep108.c
77
create mode 100644 hw/arm/xlnx-zcu102.c
78
diff view generated by jsdifflib
Deleted patch
1
Use a symbolic constant M_REG_NUM_BANKS for the array size for
2
registers which are banked by M profile security state, rather
3
than hardcoding lots of 2s.
4
1
5
Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
9
Message-id: 1505137930-13255-2-git-send-email-peter.maydell@linaro.org
10
---
11
target/arm/cpu.h | 35 +++++++++++++++++++----------------
12
1 file changed, 19 insertions(+), 16 deletions(-)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@
19
* accessed via env->registerfield[env->v7m.secure] (whether the security
20
* extension is implemented or not).
21
*/
22
-#define M_REG_NS 0
23
-#define M_REG_S 1
24
+enum {
25
+ M_REG_NS = 0,
26
+ M_REG_S = 1,
27
+ M_REG_NUM_BANKS = 2,
28
+};
29
30
/* ARM-specific interrupt pending bits. */
31
#define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1
32
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
33
uint32_t other_sp;
34
uint32_t other_ss_msp;
35
uint32_t other_ss_psp;
36
- uint32_t vecbase[2];
37
- uint32_t basepri[2];
38
- uint32_t control[2];
39
- uint32_t ccr[2]; /* Configuration and Control */
40
- uint32_t cfsr[2]; /* Configurable Fault Status */
41
+ uint32_t vecbase[M_REG_NUM_BANKS];
42
+ uint32_t basepri[M_REG_NUM_BANKS];
43
+ uint32_t control[M_REG_NUM_BANKS];
44
+ uint32_t ccr[M_REG_NUM_BANKS]; /* Configuration and Control */
45
+ uint32_t cfsr[M_REG_NUM_BANKS]; /* Configurable Fault Status */
46
uint32_t hfsr; /* HardFault Status */
47
uint32_t dfsr; /* Debug Fault Status Register */
48
- uint32_t mmfar[2]; /* MemManage Fault Address */
49
+ uint32_t mmfar[M_REG_NUM_BANKS]; /* MemManage Fault Address */
50
uint32_t bfar; /* BusFault Address */
51
- unsigned mpu_ctrl[2]; /* MPU_CTRL */
52
+ unsigned mpu_ctrl[M_REG_NUM_BANKS]; /* MPU_CTRL */
53
int exception;
54
- uint32_t primask[2];
55
- uint32_t faultmask[2];
56
+ uint32_t primask[M_REG_NUM_BANKS];
57
+ uint32_t faultmask[M_REG_NUM_BANKS];
58
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
59
} v7m;
60
61
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
62
uint32_t *drbar;
63
uint32_t *drsr;
64
uint32_t *dracr;
65
- uint32_t rnr[2];
66
+ uint32_t rnr[M_REG_NUM_BANKS];
67
} pmsav7;
68
69
/* PMSAv8 MPU */
70
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
71
* pmsav7.rnr (region number register)
72
* pmsav7_dregion (number of configured regions)
73
*/
74
- uint32_t *rbar[2];
75
- uint32_t *rlar[2];
76
- uint32_t mair0[2];
77
- uint32_t mair1[2];
78
+ uint32_t *rbar[M_REG_NUM_BANKS];
79
+ uint32_t *rlar[M_REG_NUM_BANKS];
80
+ uint32_t mair0[M_REG_NUM_BANKS];
81
+ uint32_t mair1[M_REG_NUM_BANKS];
82
} pmsav8;
83
84
void *nvic;
85
--
86
2.7.4
87
88
diff view generated by jsdifflib
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Let's provide the GPEX host bridge with the INTx/gsi mapping. This is
3
Reported by Coverity (CID1390635). We ensure this for uint_to_float
4
needed for INTx/gsi routing.
4
later on so we might as well mirror that.
5
5
6
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Eric Auger <eric.auger@redhat.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Andrew Jones <drjones@redhat.com>
10
Tested-by: Feng Kan <fkan@apm.com>
11
Message-id: 1505296004-6798-3-git-send-email-eric.auger@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
hw/arm/virt.c | 1 +
11
fpu/softfloat.c | 2 +-
15
1 file changed, 1 insertion(+)
12
1 file changed, 1 insertion(+), 1 deletion(-)
16
13
17
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
14
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/virt.c
16
--- a/fpu/softfloat.c
20
+++ b/hw/arm/virt.c
17
+++ b/fpu/softfloat.c
21
@@ -XXX,XX +XXX,XX @@ static void create_pcie(const VirtMachineState *vms, qemu_irq *pic)
18
@@ -XXX,XX +XXX,XX @@ FLOAT_TO_UINT(64, 64)
22
19
23
for (i = 0; i < GPEX_NUM_IRQS; i++) {
20
static FloatParts int_to_float(int64_t a, float_status *status)
24
sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
21
{
25
+ gpex_set_irq_num(GPEX_HOST(dev), i, irq + i);
22
- FloatParts r;
26
}
23
+ FloatParts r = {};
27
24
if (a == 0) {
28
pci = PCI_HOST_BRIDGE(dev);
25
r.cls = float_class_zero;
26
r.sign = false;
29
--
27
--
30
2.7.4
28
2.17.0
31
29
32
30
diff view generated by jsdifflib
1
Fix an error that meant we were wiring every UART's overflow
1
In float-to-integer conversion, if the floating point input
2
interrupts into the same inputs 0 and 1 of the OR gate,
2
converts exactly to the largest or smallest integer that
3
rather than giving each its own input.
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
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.
4
14
5
Cc: qemu-stable@nongnu.org
15
Cc: qemu-stable@nongnu.org
16
Fixes: ab52f973a50
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
19
Message-id: 20180510140141.12120-1-peter.maydell@linaro.org
9
Message-id: 1505232834-20890-1-git-send-email-peter.maydell@linaro.org
10
---
20
---
11
hw/arm/mps2.c | 4 ++--
21
fpu/softfloat.c | 4 ++--
12
1 file changed, 2 insertions(+), 2 deletions(-)
22
1 file changed, 2 insertions(+), 2 deletions(-)
13
23
14
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
24
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
15
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/mps2.c
26
--- a/fpu/softfloat.c
17
+++ b/hw/arm/mps2.c
27
+++ b/fpu/softfloat.c
18
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
28
@@ -XXX,XX +XXX,XX @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
19
cmsdk_apb_uart_create(uartbase[i],
29
r = UINT64_MAX;
20
qdev_get_gpio_in(txrx_orgate_dev, 0),
21
qdev_get_gpio_in(txrx_orgate_dev, 1),
22
- qdev_get_gpio_in(orgate_dev, 0),
23
- qdev_get_gpio_in(orgate_dev, 1),
24
+ qdev_get_gpio_in(orgate_dev, i * 2),
25
+ qdev_get_gpio_in(orgate_dev, i * 2 + 1),
26
NULL,
27
uartchr, SYSCLK_FRQ);
28
}
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;
29
--
45
--
30
2.7.4
46
2.17.0
31
47
32
48
diff view generated by jsdifflib
1
For M profile we must clear the exclusive monitor on reset, exception
1
In commit d81ce0ef2c4f105 we added an extra float_status field
2
entry and exception exit. We weren't doing any of these things; fix
2
fp_status_fp16 for Arm, but forgot to initialize it correctly
3
this bug.
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.
4
8
9
Add the missing initialization.
10
11
Fixes: d81ce0ef2c4f105
12
Cc: qemu-stable@nongnu.org
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
16
Message-id: 20180512004311.9299-16-richard.henderson@linaro.org
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 1505137930-13255-3-git-send-email-peter.maydell@linaro.org
9
---
17
---
10
target/arm/internals.h | 10 ++++++++++
18
target/arm/cpu.c | 2 ++
11
target/arm/cpu.c | 6 ++++++
19
1 file changed, 2 insertions(+)
12
target/arm/helper.c | 2 ++
13
target/arm/op_helper.c | 2 +-
14
4 files changed, 19 insertions(+), 1 deletion(-)
15
20
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/internals.h
19
+++ b/target/arm/internals.h
20
@@ -XXX,XX +XXX,XX @@ void arm_handle_psci_call(ARMCPU *cpu);
21
#endif
22
23
/**
24
+ * arm_clear_exclusive: clear the exclusive monitor
25
+ * @env: CPU env
26
+ * Clear the CPU's exclusive monitor, like the guest CLREX instruction.
27
+ */
28
+static inline void arm_clear_exclusive(CPUARMState *env)
29
+{
30
+ env->exclusive_addr = -1;
31
+}
32
+
33
+/**
34
* ARMMMUFaultInfo: Information describing an ARM MMU Fault
35
* @s2addr: Address that caused a fault at stage 2
36
* @stage2: True if we faulted at stage 2
37
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
21
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
38
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/cpu.c
23
--- a/target/arm/cpu.c
40
+++ b/target/arm/cpu.c
24
+++ b/target/arm/cpu.c
41
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
25
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
42
env->regs[15] = 0xFFFF0000;
26
&env->vfp.fp_status);
43
}
27
set_float_detect_tininess(float_tininess_before_rounding,
44
28
&env->vfp.standard_fp_status);
45
+ /* M profile requires that reset clears the exclusive monitor;
29
+ set_float_detect_tininess(float_tininess_before_rounding,
46
+ * A profile does not, but clearing it makes more sense than having it
30
+ &env->vfp.fp_status_f16);
47
+ * set with an exclusive access on address zero.
31
#ifndef CONFIG_USER_ONLY
48
+ */
32
if (kvm_enabled()) {
49
+ arm_clear_exclusive(env);
33
kvm_arm_reset_vcpu(cpu);
50
+
51
env->vfp.xregs[ARM_VFP_FPEXC] = 0;
52
#endif
53
54
diff --git a/target/arm/helper.c b/target/arm/helper.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/helper.c
57
+++ b/target/arm/helper.c
58
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr)
59
60
armv7m_nvic_acknowledge_irq(env->nvic);
61
switch_v7m_sp(env, 0);
62
+ arm_clear_exclusive(env);
63
/* Clear IT bits */
64
env->condexec_bits = 0;
65
env->regs[14] = lr;
66
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
67
}
68
69
/* Otherwise, we have a successful exception exit. */
70
+ arm_clear_exclusive(env);
71
qemu_log_mask(CPU_LOG_INT, "...successful exception return\n");
72
}
73
74
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/target/arm/op_helper.c
77
+++ b/target/arm/op_helper.c
78
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env)
79
80
aarch64_save_sp(env, cur_el);
81
82
- env->exclusive_addr = -1;
83
+ arm_clear_exclusive(env);
84
85
/* We must squash the PSTATE.SS bit to zero unless both of the
86
* following hold:
87
--
34
--
88
2.7.4
35
2.17.0
89
36
90
37
diff view generated by jsdifflib
Deleted patch
1
For a bus fault, the M profile BFSR bit PRECISERR means a bus
2
fault on a data access, and IBUSERR means a bus fault on an
3
instruction access. We had these the wrong way around; fix this.
4
1
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 1505137930-13255-4-git-send-email-peter.maydell@linaro.org
9
---
10
target/arm/helper.c | 8 ++++----
11
1 file changed, 4 insertions(+), 4 deletions(-)
12
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
18
case 0x8: /* External Abort */
19
switch (cs->exception_index) {
20
case EXCP_PREFETCH_ABORT:
21
- env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_PRECISERR_MASK;
22
- qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR\n");
23
+ env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_IBUSERR_MASK;
24
+ qemu_log_mask(CPU_LOG_INT, "...with CFSR.IBUSERR\n");
25
break;
26
case EXCP_DATA_ABORT:
27
env->v7m.cfsr[M_REG_NS] |=
28
- (R_V7M_CFSR_IBUSERR_MASK | R_V7M_CFSR_BFARVALID_MASK);
29
+ (R_V7M_CFSR_PRECISERR_MASK | R_V7M_CFSR_BFARVALID_MASK);
30
env->v7m.bfar = env->exception.vaddress;
31
qemu_log_mask(CPU_LOG_INT,
32
- "...with CFSR.IBUSERR and BFAR 0x%x\n",
33
+ "...with CFSR.PRECISERR and BFAR 0x%x\n",
34
env->v7m.bfar);
35
break;
36
}
37
--
38
2.7.4
39
40
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Instead of copying addr to a local temp, reuse the value (which we
3
Adding the fp16 moves to/from general registers.
4
have just compared as equal) already saved in cpu_exclusive_addr.
5
4
5
Cc: qemu-stable@nongnu.org
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
7
Tested-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20170908163859.29820-1-richard.henderson@linaro.org
8
Message-id: 20180512003217.9105-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 | 26 +++++++++-----------------
12
target/arm/translate-a64.c | 21 +++++++++++++++++++++
12
1 file changed, 9 insertions(+), 17 deletions(-)
13
1 file changed, 21 insertions(+)
13
14
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
17
--- a/target/arm/translate-a64.c
17
+++ b/target/arm/translate-a64.c
18
+++ b/target/arm/translate-a64.c
18
@@ -XXX,XX +XXX,XX @@ static void gen_load_exclusive(DisasContext *s, int rt, int rt2,
19
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
19
}
20
tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd));
20
21
clear_vec_high(s, true, rd);
21
static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
22
break;
22
- TCGv_i64 inaddr, int size, int is_pair)
23
+ case 3:
23
+ TCGv_i64 addr, int size, int is_pair)
24
+ /* 16 bit */
24
{
25
+ tmp = tcg_temp_new_i64();
25
/* if (env->exclusive_addr == addr && env->exclusive_val == [addr]
26
+ tcg_gen_ext16u_i64(tmp, tcg_rn);
26
* && (!is_pair || env->exclusive_high == [addr + datasize])) {
27
+ write_fp_dreg(s, rd, tmp);
27
@@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
28
+ tcg_temp_free_i64(tmp);
28
*/
29
+ break;
29
TCGLabel *fail_label = gen_new_label();
30
+ default:
30
TCGLabel *done_label = gen_new_label();
31
+ g_assert_not_reached();
31
- TCGv_i64 addr = tcg_temp_local_new_i64();
32
TCGv_i64 tmp;
33
34
- /* Copy input into a local temp so it is not trashed when the
35
- * basic block ends at the branch insn.
36
- */
37
- tcg_gen_mov_i64(addr, inaddr);
38
tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label);
39
40
tmp = tcg_temp_new_i64();
41
@@ -XXX,XX +XXX,XX @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
42
} else {
43
tcg_gen_concat32_i64(tmp, cpu_reg(s, rt2), cpu_reg(s, rt));
44
}
45
- tcg_gen_atomic_cmpxchg_i64(tmp, addr, cpu_exclusive_val, tmp,
46
+ tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr,
47
+ cpu_exclusive_val, tmp,
48
get_mem_index(s),
49
MO_64 | MO_ALIGN | s->be_data);
50
tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val);
51
} else if (s->be_data == MO_LE) {
52
- gen_helper_paired_cmpxchg64_le(tmp, cpu_env, addr, cpu_reg(s, rt),
53
- cpu_reg(s, rt2));
54
+ gen_helper_paired_cmpxchg64_le(tmp, cpu_env, cpu_exclusive_addr,
55
+ cpu_reg(s, rt), cpu_reg(s, rt2));
56
} else {
57
- gen_helper_paired_cmpxchg64_be(tmp, cpu_env, addr, cpu_reg(s, rt),
58
- cpu_reg(s, rt2));
59
+ gen_helper_paired_cmpxchg64_be(tmp, cpu_env, cpu_exclusive_addr,
60
+ cpu_reg(s, rt), cpu_reg(s, rt2));
61
}
32
}
62
} else {
33
} else {
63
- TCGv_i64 val = cpu_reg(s, rt);
34
TCGv_i64 tcg_rd = cpu_reg(s, rd);
64
- tcg_gen_atomic_cmpxchg_i64(tmp, addr, cpu_exclusive_val, val,
35
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
65
- get_mem_index(s),
36
/* 64 bits from top half */
66
+ tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val,
37
tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(s, rn));
67
+ cpu_reg(s, rt), get_mem_index(s),
38
break;
68
size | MO_ALIGN | s->be_data);
39
+ case 3:
69
tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val);
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
}
70
}
46
}
71
-
47
}
72
- tcg_temp_free_i64(addr);
48
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
73
-
49
case 0xa: /* 64 bit */
74
tcg_gen_mov_i64(cpu_reg(s, rd), tmp);
50
case 0xd: /* 64 bit to top half of quad */
75
tcg_temp_free_i64(tmp);
51
break;
76
tcg_gen_br(done_label);
52
+ case 0x6: /* 16-bit float, 32-bit int */
53
+ case 0xe: /* 16-bit float, 64-bit int */
54
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
55
+ break;
56
+ }
57
+ /* fallthru */
58
default:
59
/* all other sf/type/rmode combinations are invalid */
60
unallocated_encoding(s);
77
--
61
--
78
2.7.4
62
2.17.0
79
63
80
64
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@xilinx.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
The EP108 is the same as the ZCU102, mark it as deprecated as we don't
3
No sense in emitting code after the exception.
4
need two machines.
5
4
6
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-3-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@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
hw/arm/xlnx-zcu102.c | 2 +-
11
target/arm/translate-a64.c | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
12
13
13
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/xlnx-zcu102.c
16
--- a/target/arm/translate-a64.c
16
+++ b/hw/arm/xlnx-zcu102.c
17
+++ b/target/arm/translate-a64.c
17
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
18
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
18
{
19
default:
19
MachineClass *mc = MACHINE_CLASS(oc);
20
/* all other sf/type/rmode combinations are invalid */
20
21
unallocated_encoding(s);
21
- mc->desc = "Xilinx ZynqMP EP108 board";
22
- break;
22
+ mc->desc = "Xilinx ZynqMP EP108 board (Deprecated, please use xlnx-zcu102)";
23
+ return;
23
mc->init = xlnx_ep108_init;
24
}
24
mc->block_default_type = IF_IDE;
25
25
mc->units_per_default_bus = 1;
26
if (!fp_access_check(s)) {
26
--
27
--
27
2.7.4
28
2.17.0
28
29
29
30
diff view generated by jsdifflib
1
In the v7M and v8M ARM ARM, the magic exception return values are
1
From: Richard Henderson <richard.henderson@linaro.org>
2
referred to as EXC_RETURN values, and in QEMU we use V7M_EXCRET_*
2
3
constants to define bits within them. Rename the 'type' variable
3
Cc: qemu-stable@nongnu.org
4
which holds the exception return value in do_v7m_exception_exit()
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
to excret, making it clearer that it does hold an EXC_RETURN value.
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-4-richard.henderson@linaro.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 1505137930-13255-8-git-send-email-peter.maydell@linaro.org
12
---
9
---
13
target/arm/helper.c | 23 ++++++++++++-----------
10
target/arm/helper.h | 6 +++
14
1 file changed, 12 insertions(+), 11 deletions(-)
11
target/arm/helper.c | 38 ++++++++++++++-
15
12
target/arm/translate-a64.c | 96 +++++++++++++++++++++++++++++++-------
13
3 files changed, 122 insertions(+), 18 deletions(-)
14
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)
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
39
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
40
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
41
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
42
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ static void v7m_push_stack(ARMCPU *cpu)
43
@@ -XXX,XX +XXX,XX @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64)
21
static void do_v7m_exception_exit(ARMCPU *cpu)
44
#undef VFP_CONV_FIX_A64
45
46
/* Conversion to/from f16 can overflow to infinity before/after scaling.
47
- * Therefore we convert to f64 (which does not round), scale,
48
- * and then convert f64 to f16 (which may round).
49
+ * Therefore we convert to f64, scale, and then convert f64 to f16; or
50
+ * vice versa for conversion to integer.
51
+ *
52
+ * For 16- and 32-bit integers, the conversion to f64 never rounds.
53
+ * For 64-bit integers, any integer that would cause rounding will also
54
+ * overflow to f16 infinity, so there is no double rounding problem.
55
*/
56
57
static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst)
58
@@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst)
59
return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst);
60
}
61
62
+float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst)
63
+{
64
+ return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst);
65
+}
66
+
67
+float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)
68
+{
69
+ return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst);
70
+}
71
+
72
static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst)
22
{
73
{
23
CPUARMState *env = &cpu->env;
74
if (unlikely(float16_is_any_nan(f))) {
24
- uint32_t type;
75
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst)
25
+ uint32_t excret;
76
return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst);
26
uint32_t xpsr;
77
}
27
bool ufault = false;
78
28
bool return_to_sp_process = false;
79
+uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst)
29
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
80
+{
30
* the target value up between env->regs[15] and env->thumb in
81
+ return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst);
31
* gen_bx(). Reconstitute it.
82
+}
32
*/
83
+
33
- type = env->regs[15];
84
+uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst)
34
+ excret = env->regs[15];
85
+{
35
if (env->thumb) {
86
+ return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst);
36
- type |= 1;
87
+}
37
+ excret |= 1;
88
+
89
+uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst)
90
+{
91
+ return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst);
92
+}
93
+
94
+uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst)
95
+{
96
+ return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst);
97
+}
98
+
99
/* Set the current fp rounding mode and return the old one.
100
* The argument is a softfloat float_round_ value.
101
*/
102
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
103
index XXXXXXX..XXXXXXX 100644
104
--- a/target/arm/translate-a64.c
105
+++ b/target/arm/translate-a64.c
106
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
107
bool itof, int rmode, int scale, int sf, int type)
108
{
109
bool is_signed = !(opcode & 1);
110
- bool is_double = type;
111
TCGv_ptr tcg_fpstatus;
112
- TCGv_i32 tcg_shift;
113
+ TCGv_i32 tcg_shift, tcg_single;
114
+ TCGv_i64 tcg_double;
115
116
- tcg_fpstatus = get_fpstatus_ptr(false);
117
+ tcg_fpstatus = get_fpstatus_ptr(type == 3);
118
119
tcg_shift = tcg_const_i32(64 - scale);
120
121
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
122
tcg_int = tcg_extend;
123
}
124
125
- if (is_double) {
126
- TCGv_i64 tcg_double = tcg_temp_new_i64();
127
+ switch (type) {
128
+ case 1: /* float64 */
129
+ tcg_double = tcg_temp_new_i64();
130
if (is_signed) {
131
gen_helper_vfp_sqtod(tcg_double, tcg_int,
132
tcg_shift, tcg_fpstatus);
133
@@ -XXX,XX +XXX,XX @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode,
134
}
135
write_fp_dreg(s, rd, tcg_double);
136
tcg_temp_free_i64(tcg_double);
137
- } else {
138
- TCGv_i32 tcg_single = tcg_temp_new_i32();
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
- }
38
}
240
}
39
241
40
qemu_log_mask(CPU_LOG_INT, "Exception return: magic PC %" PRIx32
242
tcg_temp_free_ptr(tcg_fpstatus);
41
" previous exception %d\n",
243
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
42
- type, env->v7m.exception);
244
/* actual FP conversions */
43
+ excret, env->v7m.exception);
245
bool itof = extract32(opcode, 1, 1);
44
246
45
- if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
247
- if (type > 1 || (rmode != 0 && opcode > 1)) {
46
+ if ((excret & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
248
+ if (rmode != 0 && opcode > 1) {
47
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception "
249
+ unallocated_encoding(s);
48
- "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type);
250
+ return;
49
+ "exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n",
251
+ }
50
+ excret);
252
+ switch (type) {
51
}
253
+ case 0: /* float32 */
52
254
+ case 1: /* float64 */
53
if (env->v7m.exception != ARMV7M_EXCP_NMI) {
255
+ break;
54
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
256
+ case 3: /* float16 */
55
* which security state's faultmask to clear. (v8M ARM ARM R_KBNF.)
257
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
56
*/
258
+ break;
57
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
259
+ }
58
- int es = type & R_V7M_EXCRET_ES_MASK;
260
+ /* fallthru */
59
+ int es = excret & R_V7M_EXCRET_ES_MASK;
261
+ default:
60
if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) {
262
unallocated_encoding(s);
61
env->v7m.faultmask[es] = 0;
263
return;
62
}
264
}
63
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
64
g_assert_not_reached();
65
}
66
67
- switch (type & 0xf) {
68
+ switch (excret & 0xf) {
69
case 1: /* Return to Handler */
70
return_to_handler = true;
71
break;
72
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
73
*/
74
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
75
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
76
- v7m_exception_taken(cpu, type);
77
+ v7m_exception_taken(cpu, excret);
78
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
79
"stackframe: failed exception return integrity check\n");
80
return;
81
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
82
83
/* The restored xPSR exception field will be zero if we're
84
* resuming in Thread mode. If that doesn't match what the
85
- * exception return type specified then this is a UsageFault.
86
+ * exception return excret specified then this is a UsageFault.
87
*/
88
if (return_to_handler != arm_v7m_is_handler_mode(env)) {
89
/* Take an INVPC UsageFault by pushing the stack again. */
90
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
91
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
92
v7m_push_stack(cpu);
93
- v7m_exception_taken(cpu, type);
94
+ v7m_exception_taken(cpu, excret);
95
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
96
"failed exception return integrity check\n");
97
return;
98
--
265
--
99
2.7.4
266
2.17.0
100
267
101
268
diff view generated by jsdifflib
1
In several places we were unconditionally applying the
1
From: Richard Henderson <richard.henderson@linaro.org>
2
nvic_gprio_mask() to a priority value. This is incorrect
3
if the priority is one of the fixed negative priority
4
values (for NMI and HardFault), so don't do it.
5
2
6
This bug would have caused both NMI and HardFault to be
3
Cc: qemu-stable@nongnu.org
7
considered as the same priority and so NMI wouldn't
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
correctly preempt HardFault.
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(-)
9
12
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 1505137930-13255-5-git-send-email-peter.maydell@linaro.org
13
---
14
hw/intc/armv7m_nvic.c | 11 +++++++++--
15
1 file changed, 9 insertions(+), 2 deletions(-)
16
17
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/intc/armv7m_nvic.c
15
--- a/target/arm/translate-a64.c
20
+++ b/hw/intc/armv7m_nvic.c
16
+++ b/target/arm/translate-a64.c
21
@@ -XXX,XX +XXX,XX @@ static void nvic_recompute_state(NVICState *s)
17
@@ -XXX,XX +XXX,XX @@ static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn)
22
}
18
bool sf = extract32(insn, 31, 1);
23
}
19
bool itof;
24
20
25
+ if (active_prio > 0) {
21
- if (sbit || (type > 1)
26
+ active_prio &= nvic_gprio_mask(s);
22
- || (!sf && scale < 32)) {
23
+ if (sbit || (!sf && scale < 32)) {
24
+ unallocated_encoding(s);
25
+ return;
27
+ }
26
+ }
28
+
27
+
29
s->vectpending = pend_irq;
28
+ switch (type) {
30
- s->exception_prio = active_prio & nvic_gprio_mask(s);
29
+ case 0: /* float32 */
31
+ s->exception_prio = active_prio;
30
+ case 1: /* float64 */
32
31
+ break;
33
trace_nvic_recompute_state(s->vectpending, s->exception_prio);
32
+ case 3: /* float16 */
34
}
33
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
35
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque)
34
+ break;
36
assert(vec->enabled);
35
+ }
37
assert(vec->pending);
36
+ /* fallthru */
38
37
+ default:
39
- pendgroupprio = vec->prio & nvic_gprio_mask(s);
38
unallocated_encoding(s);
40
+ pendgroupprio = vec->prio;
39
return;
41
+ if (pendgroupprio > 0) {
40
}
42
+ pendgroupprio &= nvic_gprio_mask(s);
43
+ }
44
assert(pendgroupprio < running);
45
46
trace_nvic_acknowledge_irq(pending, vec->prio);
47
--
41
--
48
2.7.4
42
2.17.0
49
43
50
44
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@xilinx.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Add a machine level virtualization property. This defaults to false and can be
3
Cc: qemu-stable@nongnu.org
4
set to true using this machine command line argument:
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
-machine xlnx-zcu102,virtualization=on
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
This follows what the ARM virt machine does.
7
Message-id: 20180512003217.9105-6-richard.henderson@linaro.org
8
9
This property only applies to the ZCU102 machine. The EP108 machine does
10
not have this property.
11
12
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
13
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
9
---
16
include/hw/arm/xlnx-zynqmp.h | 2 ++
10
target/arm/translate-a64.c | 30 ++++++++++++++----------------
17
hw/arm/xlnx-zcu102.c | 30 +++++++++++++++++++++++++++++-
11
1 file changed, 14 insertions(+), 16 deletions(-)
18
hw/arm/xlnx-zynqmp.c | 3 ++-
19
3 files changed, 33 insertions(+), 2 deletions(-)
20
12
21
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
22
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/arm/xlnx-zynqmp.h
15
--- a/target/arm/translate-a64.c
24
+++ b/include/hw/arm/xlnx-zynqmp.h
16
+++ b/target/arm/translate-a64.c
25
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxZynqMPState {
17
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg)
26
18
return v;
27
/* Has the ARM Security extensions? */
28
bool secure;
29
+ /* Has the ARM Virtualization extensions? */
30
+ bool virt;
31
/* Has the RPU subsystem? */
32
bool has_rpu;
33
} XlnxZynqMPState;
34
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/xlnx-zcu102.c
37
+++ b/hw/arm/xlnx-zcu102.c
38
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 {
39
MemoryRegion ddr_ram;
40
41
bool secure;
42
+ bool virt;
43
} XlnxZCU102;
44
45
#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")
46
@@ -XXX,XX +XXX,XX @@ static void zcu102_set_secure(Object *obj, bool value, Error **errp)
47
s->secure = value;
48
}
19
}
49
20
50
+static bool zcu102_get_virt(Object *obj, Error **errp)
21
+static TCGv_i32 read_fp_hreg(DisasContext *s, int reg)
51
+{
22
+{
52
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
23
+ TCGv_i32 v = tcg_temp_new_i32();
53
+
24
+
54
+ return s->virt;
25
+ tcg_gen_ld16u_i32(v, cpu_env, fp_reg_offset(s, reg, MO_16));
26
+ return v;
55
+}
27
+}
56
+
28
+
57
+static void zcu102_set_virt(Object *obj, bool value, Error **errp)
29
/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
58
+{
30
* If SVE is not enabled, then there are only 128 bits in the vector.
59
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
31
*/
60
+
32
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
61
+ s->virt = value;
33
static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
62
+}
63
+
64
static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
65
{
34
{
66
int i;
35
TCGv_ptr fpst = NULL;
67
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
36
- TCGv_i32 tcg_op = tcg_temp_new_i32();
68
"ddr-ram", &error_abort);
37
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
69
object_property_set_bool(OBJECT(&s->soc), s->secure, "secure",
38
TCGv_i32 tcg_res = tcg_temp_new_i32();
70
&error_fatal);
39
71
+ object_property_set_bool(OBJECT(&s->soc), s->virt, "virtualization",
40
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
72
+ &error_fatal);
41
-
73
42
switch (opcode) {
74
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
43
case 0x0: /* FMOV */
75
44
tcg_gen_mov_i32(tcg_res, tcg_op);
76
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_instance_init(Object *obj)
45
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_diff(DisasContext *s, uint32_t insn)
77
{
46
tcg_temp_free_i64(tcg_op2);
78
XlnxZCU102 *s = EP108_MACHINE(obj);
47
tcg_temp_free_i64(tcg_res);
79
48
} else {
80
- /* EP108, we don't support setting secure */
49
- TCGv_i32 tcg_op1 = tcg_temp_new_i32();
81
+ /* EP108, we don't support setting secure or virt */
50
- TCGv_i32 tcg_op2 = tcg_temp_new_i32();
82
s->secure = false;
51
+ TCGv_i32 tcg_op1 = read_fp_hreg(s, rn);
83
+ s->virt = false;
52
+ TCGv_i32 tcg_op2 = read_fp_hreg(s, rm);
84
}
53
TCGv_i64 tcg_res = tcg_temp_new_i64();
85
54
86
static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
55
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
87
@@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_instance_init(Object *obj)
56
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
88
"Set on/off to enable/disable the ARM "
57
-
89
"Security Extensions (TrustZone)",
58
gen_helper_neon_mull_s16(tcg_res, tcg_op1, tcg_op2);
90
NULL);
59
gen_helper_neon_addl_saturate_s32(tcg_res, cpu_env, tcg_res, tcg_res);
91
+
60
92
+ /* Default to virt (EL2) being disabled */
61
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s,
93
+ s->virt = false;
62
94
+ object_property_add_bool(obj, "virtualization", zcu102_get_virt,
63
fpst = get_fpstatus_ptr(true);
95
+ zcu102_set_virt, NULL);
64
96
+ object_property_set_description(obj, "virtualization",
65
- tcg_op1 = tcg_temp_new_i32();
97
+ "Set on/off to enable/disable emulating a "
66
- tcg_op2 = tcg_temp_new_i32();
98
+ "guest CPU which implements the ARM "
67
+ tcg_op1 = read_fp_hreg(s, rn);
99
+ "Virtualization Extensions",
68
+ tcg_op2 = read_fp_hreg(s, rm);
100
+ NULL);
69
tcg_res = tcg_temp_new_i32();
101
}
70
102
71
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
103
static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
72
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
104
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
73
-
105
index XXXXXXX..XXXXXXX 100644
74
switch (fpopcode) {
106
--- a/hw/arm/xlnx-zynqmp.c
75
case 0x03: /* FMULX */
107
+++ b/hw/arm/xlnx-zynqmp.c
76
gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst);
108
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
77
@@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
109
object_property_set_bool(OBJECT(&s->apu_cpu[i]),
78
}
110
s->secure, "has_el3", NULL);
79
111
object_property_set_bool(OBJECT(&s->apu_cpu[i]),
80
if (is_scalar) {
112
- false, "has_el2", NULL);
81
- TCGv_i32 tcg_op = tcg_temp_new_i32();
113
+ s->virt, "has_el2", NULL);
82
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
114
object_property_set_int(OBJECT(&s->apu_cpu[i]), GIC_BASE_ADDR,
83
TCGv_i32 tcg_res = tcg_temp_new_i32();
115
"reset-cbar", &error_abort);
84
116
object_property_set_bool(OBJECT(&s->apu_cpu[i]), true, "realized",
85
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
117
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
86
-
118
static Property xlnx_zynqmp_props[] = {
87
switch (fpop) {
119
DEFINE_PROP_STRING("boot-cpu", XlnxZynqMPState, boot_cpu),
88
case 0x1a: /* FCVTNS */
120
DEFINE_PROP_BOOL("secure", XlnxZynqMPState, secure, false),
89
case 0x1b: /* FCVTMS */
121
+ DEFINE_PROP_BOOL("virtualization", XlnxZynqMPState, virt, false),
122
DEFINE_PROP_BOOL("has_rpu", XlnxZynqMPState, has_rpu, false),
123
DEFINE_PROP_LINK("ddr-ram", XlnxZynqMPState, ddr_ram, TYPE_MEMORY_REGION,
124
MemoryRegion *),
125
--
90
--
126
2.7.4
91
2.17.0
127
92
128
93
diff view generated by jsdifflib
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Now we are able to retrieve the gsi from the INTx pin, let's
3
We missed all of the scalar fp16 binary operations.
4
enable intx_to_irq routing. From that point on, irqfd becomes
5
usable along with INTx when assigning a PCIe device.
6
4
7
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
5
Cc: qemu-stable@nongnu.org
8
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Eric Auger <eric.auger@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Andrew Jones <drjones@redhat.com>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
11
Tested-by: Feng Kan <fkan@apm.com>
9
Message-id: 20180512003217.9105-7-richard.henderson@linaro.org
12
Message-id: 1505296004-6798-4-git-send-email-eric.auger@redhat.com
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
11
---
15
hw/pci-host/gpex.c | 12 ++++++++++++
12
target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++
16
1 file changed, 12 insertions(+)
13
1 file changed, 65 insertions(+)
17
14
18
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
19
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/pci-host/gpex.c
17
--- a/target/arm/translate-a64.c
21
+++ b/hw/pci-host/gpex.c
18
+++ b/target/arm/translate-a64.c
22
@@ -XXX,XX +XXX,XX @@ int gpex_set_irq_num(GPEXHost *s, int index, int gsi)
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_2src_double(DisasContext *s, int opcode,
23
return 0;
20
tcg_temp_free_i64(tcg_res);
24
}
21
}
25
22
26
+static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
23
+/* Floating-point data-processing (2 source) - half precision */
24
+static void handle_fp_2src_half(DisasContext *s, int opcode,
25
+ int rd, int rn, int rm)
27
+{
26
+{
28
+ PCIINTxRoute route;
27
+ TCGv_i32 tcg_op1;
29
+ GPEXHost *s = opaque;
28
+ TCGv_i32 tcg_op2;
29
+ TCGv_i32 tcg_res;
30
+ TCGv_ptr fpst;
30
+
31
+
31
+ route.mode = PCI_INTX_ENABLED;
32
+ tcg_res = tcg_temp_new_i32();
32
+ route.irq = s->irq_num[pin];
33
+ fpst = get_fpstatus_ptr(true);
34
+ tcg_op1 = read_fp_hreg(s, rn);
35
+ tcg_op2 = read_fp_hreg(s, rm);
33
+
36
+
34
+ return route;
37
+ switch (opcode) {
38
+ case 0x0: /* FMUL */
39
+ gen_helper_advsimd_mulh(tcg_res, tcg_op1, tcg_op2, fpst);
40
+ break;
41
+ case 0x1: /* FDIV */
42
+ gen_helper_advsimd_divh(tcg_res, tcg_op1, tcg_op2, fpst);
43
+ break;
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);
35
+}
76
+}
36
+
77
+
37
static void gpex_host_realize(DeviceState *dev, Error **errp)
78
/* Floating point data-processing (2 source)
38
{
79
* 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0
39
PCIHostState *pci = PCI_HOST_BRIDGE(dev);
80
* +---+---+---+-----------+------+---+------+--------+-----+------+------+
40
@@ -XXX,XX +XXX,XX @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
81
@@ -XXX,XX +XXX,XX @@ static void disas_fp_2src(DisasContext *s, uint32_t insn)
41
&s->io_ioport, 0, 4, TYPE_PCIE_BUS);
82
}
42
83
handle_fp_2src_double(s, opcode, rd, rn, rm);
43
qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus));
84
break;
44
+ pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq);
85
+ case 3:
45
qdev_init_nofail(DEVICE(&s->gpex_root));
86
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
46
}
87
+ unallocated_encoding(s);
47
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
}
48
--
98
--
49
2.7.4
99
2.17.0
50
100
51
101
diff view generated by jsdifflib
1
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
To implement INTx to gsi routing we need to pass the gpex host
3
We missed all of the scalar fp16 fma operations.
4
bridge the gsi associated to each INTx index. Let's introduce
5
irq_num array and gpex_set_irq_num setter function.
6
4
7
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
5
Cc: qemu-stable@nongnu.org
8
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Eric Auger <eric.auger@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Tested-by: Feng Kan <fkan@apm.com>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
11
Reviewed-by: Andrew Jones <drjones@redhat.com>
9
Message-id: 20180512003217.9105-8-richard.henderson@linaro.org
12
Message-id: 1505296004-6798-2-git-send-email-eric.auger@redhat.com
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
11
---
15
include/hw/pci-host/gpex.h | 3 +++
12
target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++
16
hw/pci-host/gpex.c | 10 ++++++++++
13
1 file changed, 48 insertions(+)
17
2 files changed, 13 insertions(+)
18
14
19
diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/pci-host/gpex.h
17
--- a/target/arm/translate-a64.c
22
+++ b/include/hw/pci-host/gpex.h
18
+++ b/target/arm/translate-a64.c
23
@@ -XXX,XX +XXX,XX @@ typedef struct GPEXHost {
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1,
24
MemoryRegion io_ioport;
20
tcg_temp_free_i64(tcg_res);
25
MemoryRegion io_mmio;
21
}
26
qemu_irq irq[GPEX_NUM_IRQS];
22
27
+ int irq_num[GPEX_NUM_IRQS];
23
+/* Floating-point data-processing (3 source) - half precision */
28
} GPEXHost;
24
+static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1,
29
25
+ int rd, int rn, int rm, int ra)
30
+int gpex_set_irq_num(GPEXHost *s, int index, int gsi);
26
+{
27
+ TCGv_i32 tcg_op1, tcg_op2, tcg_op3;
28
+ TCGv_i32 tcg_res = tcg_temp_new_i32();
29
+ TCGv_ptr fpst = get_fpstatus_ptr(true);
31
+
30
+
32
#endif /* HW_GPEX_H */
31
+ tcg_op1 = read_fp_hreg(s, rn);
33
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
32
+ tcg_op2 = read_fp_hreg(s, rm);
34
index XXXXXXX..XXXXXXX 100644
33
+ tcg_op3 = read_fp_hreg(s, ra);
35
--- a/hw/pci-host/gpex.c
34
+
36
+++ b/hw/pci-host/gpex.c
35
+ /* These are fused multiply-add, and must be done as one
37
@@ -XXX,XX +XXX,XX @@ static void gpex_set_irq(void *opaque, int irq_num, int level)
36
+ * floating point operation with no rounding between the
38
qemu_set_irq(s->irq[irq_num], level);
37
+ * multiplication and addition steps.
39
}
38
+ * NB that doing the negations here as separate steps is
40
39
+ * correct : an input NaN should come out with its sign bit
41
+int gpex_set_irq_num(GPEXHost *s, int index, int gsi)
40
+ * flipped if it is a negated-input.
42
+{
41
+ */
43
+ if (index >= GPEX_NUM_IRQS) {
42
+ if (o1 == true) {
44
+ return -EINVAL;
43
+ tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000);
45
+ }
44
+ }
46
+
45
+
47
+ s->irq_num[index] = gsi;
46
+ if (o0 != o1) {
48
+ return 0;
47
+ tcg_gen_xori_i32(tcg_op1, tcg_op1, 0x8000);
48
+ }
49
+
50
+ gen_helper_advsimd_muladdh(tcg_res, tcg_op1, tcg_op2, tcg_op3, fpst);
51
+
52
+ write_fp_sreg(s, rd, tcg_res);
53
+
54
+ tcg_temp_free_ptr(fpst);
55
+ tcg_temp_free_i32(tcg_op1);
56
+ tcg_temp_free_i32(tcg_op2);
57
+ tcg_temp_free_i32(tcg_op3);
58
+ tcg_temp_free_i32(tcg_res);
49
+}
59
+}
50
+
60
+
51
static void gpex_host_realize(DeviceState *dev, Error **errp)
61
/* Floating point data-processing (3 source)
52
{
62
* 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0
53
PCIHostState *pci = PCI_HOST_BRIDGE(dev);
63
* +---+---+---+-----------+------+----+------+----+------+------+------+
64
@@ -XXX,XX +XXX,XX @@ static void disas_fp_3src(DisasContext *s, uint32_t insn)
65
}
66
handle_fp_3src_double(s, o0, o1, rd, rn, rm, ra);
67
break;
68
+ case 3:
69
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
70
+ unallocated_encoding(s);
71
+ return;
72
+ }
73
+ if (!fp_access_check(s)) {
74
+ return;
75
+ }
76
+ handle_fp_3src_half(s, o0, o1, rd, rn, rm, ra);
77
+ break;
78
default:
79
unallocated_encoding(s);
80
}
54
--
81
--
55
2.7.4
82
2.17.0
56
83
57
84
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@xilinx.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Add a machine level secure property. This defaults to false and can be
3
These where missed out from the rest of the half-precision work.
4
set to true using this machine command line argument:
4
5
-machine xlnx-zcu102,secure=on
5
Cc: qemu-stable@nongnu.org
6
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
This follows what the ARM virt machine does.
7
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
This property only applies to the ZCU102 machine. The EP108 machine does
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
not have this property.
10
Message-id: 20180512003217.9105-9-richard.henderson@linaro.org
11
11
[rth: Diagnose lack of FP16 before fp_access_check]
12
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
14
---
16
hw/arm/xlnx-zcu102.c | 32 ++++++++++++++++++++++++++++++++
15
target/arm/helper-a64.h | 2 +
17
1 file changed, 32 insertions(+)
16
target/arm/helper-a64.c | 10 +++++
18
17
target/arm/translate-a64.c | 88 ++++++++++++++++++++++++++++++--------
19
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
18
3 files changed, 83 insertions(+), 17 deletions(-)
19
20
diff --git a/target/arm/helper-a64.h b/target/arm/helper-a64.h
20
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/xlnx-zcu102.c
22
--- a/target/arm/helper-a64.h
22
+++ b/hw/arm/xlnx-zcu102.c
23
+++ b/target/arm/helper-a64.h
23
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 {
24
@@ -XXX,XX +XXX,XX @@
24
25
DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
25
XlnxZynqMPState soc;
26
DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
26
MemoryRegion ddr_ram;
27
DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64)
27
+
28
+DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr)
28
+ bool secure;
29
+DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr)
29
} XlnxZCU102;
30
DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr)
30
31
DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr)
31
#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")
32
DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr)
32
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 {
33
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
33
34
index XXXXXXX..XXXXXXX 100644
34
static struct arm_boot_info xlnx_zcu102_binfo;
35
--- a/target/arm/helper-a64.c
35
36
+++ b/target/arm/helper-a64.c
36
+static bool zcu102_get_secure(Object *obj, Error **errp)
37
@@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res)
38
return flags;
39
}
40
41
+uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status)
37
+{
42
+{
38
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
43
+ return float_rel_to_flags(float16_compare_quiet(x, y, fp_status));
39
+
40
+ return s->secure;
41
+}
44
+}
42
+
45
+
43
+static void zcu102_set_secure(Object *obj, bool value, Error **errp)
46
+uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status)
44
+{
47
+{
45
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
48
+ return float_rel_to_flags(float16_compare(x, y, fp_status));
46
+
47
+ s->secure = value;
48
+}
49
+}
49
+
50
+
50
static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
51
uint64_t HELPER(vfp_cmps_a64)(float32 x, float32 y, void *fp_status)
51
{
52
{
52
int i;
53
return float_rel_to_flags(float32_compare_quiet(x, y, fp_status));
53
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
54
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
54
55
index XXXXXXX..XXXXXXX 100644
55
object_property_set_link(OBJECT(&s->soc), OBJECT(&s->ddr_ram),
56
--- a/target/arm/translate-a64.c
56
"ddr-ram", &error_abort);
57
+++ b/target/arm/translate-a64.c
57
+ object_property_set_bool(OBJECT(&s->soc), s->secure, "secure",
58
@@ -XXX,XX +XXX,XX @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn)
58
+ &error_fatal);
59
}
59
60
}
60
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
61
61
62
-static void handle_fp_compare(DisasContext *s, bool is_double,
62
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine)
63
+static void handle_fp_compare(DisasContext *s, int size,
63
64
unsigned int rn, unsigned int rm,
64
static void xlnx_ep108_machine_instance_init(Object *obj)
65
bool cmp_with_zero, bool signal_all_nans)
65
{
66
{
66
+ XlnxZCU102 *s = EP108_MACHINE(obj);
67
TCGv_i64 tcg_flags = tcg_temp_new_i64();
67
+
68
- TCGv_ptr fpst = get_fpstatus_ptr(false);
68
+ /* EP108, we don't support setting secure */
69
+ TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16);
69
+ s->secure = false;
70
71
- if (is_double) {
72
+ if (size == MO_64) {
73
TCGv_i64 tcg_vn, tcg_vm;
74
75
tcg_vn = read_fp_dreg(s, rn);
76
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, bool is_double,
77
tcg_temp_free_i64(tcg_vn);
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);
70
}
164
}
71
165
72
static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
166
/* Floating point conditional compare
73
@@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_init(MachineState *machine)
167
@@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
74
168
unsigned int mos, type, rm, cond, rn, op, nzcv;
75
static void xlnx_zcu102_machine_instance_init(Object *obj)
169
TCGv_i64 tcg_flags;
76
{
170
TCGLabel *label_continue = NULL;
77
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
171
+ int size;
78
+
172
79
+ /* Default to secure mode being disabled */
173
mos = extract32(insn, 29, 3);
80
+ s->secure = false;
174
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
81
+ object_property_add_bool(obj, "secure", zcu102_get_secure,
175
+ type = extract32(insn, 22, 2);
82
+ zcu102_set_secure, NULL);
176
rm = extract32(insn, 16, 5);
83
+ object_property_set_description(obj, "secure",
177
cond = extract32(insn, 12, 4);
84
+ "Set on/off to enable/disable the ARM "
178
rn = extract32(insn, 5, 5);
85
+ "Security Extensions (TrustZone)",
179
op = extract32(insn, 4, 1);
86
+ NULL);
180
nzcv = extract32(insn, 0, 4);
87
}
181
88
182
- if (mos || type > 1) {
89
static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
183
+ if (mos) {
184
+ unallocated_encoding(s);
185
+ return;
186
+ }
187
+
188
+ switch (type) {
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);
90
--
214
--
91
2.7.4
215
2.17.0
92
216
93
217
diff view generated by jsdifflib
1
The exception-return magic values get some new bits in v8M, which
1
From: Alex Bennée <alex.bennee@linaro.org>
2
makes some bit definitions for them worthwhile.
3
2
4
We don't use the bit definitions for the switch on the low bits
3
These were missed out from the rest of the half-precision work.
5
which checks the return type for v7M, because this is defined
6
in the v7M ARM ARM as a set of valid values rather than via
7
per-bit checks.
8
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>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
11
Message-id: 1505137930-13255-7-git-send-email-peter.maydell@linaro.org
12
---
14
---
13
target/arm/internals.h | 10 ++++++++++
15
target/arm/translate-a64.c | 31 +++++++++++++++++++++++++------
14
target/arm/helper.c | 14 +++++++++-----
16
1 file changed, 25 insertions(+), 6 deletions(-)
15
2 files changed, 19 insertions(+), 5 deletions(-)
16
17
17
diff --git a/target/arm/internals.h b/target/arm/internals.h
18
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
18
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/internals.h
20
--- a/target/arm/translate-a64.c
20
+++ b/target/arm/internals.h
21
+++ b/target/arm/translate-a64.c
21
@@ -XXX,XX +XXX,XX @@ FIELD(V7M_CONTROL, NPRIV, 0, 1)
22
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
22
FIELD(V7M_CONTROL, SPSEL, 1, 1)
23
unsigned int mos, type, rm, cond, rn, rd;
23
FIELD(V7M_CONTROL, FPCA, 2, 1)
24
TCGv_i64 t_true, t_false, t_zero;
24
25
DisasCompare64 c;
25
+/* Bit definitions for v7M exception return payload */
26
+ TCGMemOp sz;
26
+FIELD(V7M_EXCRET, ES, 0, 1)
27
27
+FIELD(V7M_EXCRET, RES0, 1, 1)
28
mos = extract32(insn, 29, 3);
28
+FIELD(V7M_EXCRET, SPSEL, 2, 1)
29
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
29
+FIELD(V7M_EXCRET, MODE, 3, 1)
30
+ type = extract32(insn, 22, 2);
30
+FIELD(V7M_EXCRET, FTYPE, 4, 1)
31
rm = extract32(insn, 16, 5);
31
+FIELD(V7M_EXCRET, DCRS, 5, 1)
32
cond = extract32(insn, 12, 4);
32
+FIELD(V7M_EXCRET, S, 6, 1)
33
rn = extract32(insn, 5, 5);
33
+FIELD(V7M_EXCRET, RES1, 7, 25) /* including the must-be-1 prefix */
34
rd = extract32(insn, 0, 5);
35
36
- if (mos || type > 1) {
37
+ if (mos) {
38
+ unallocated_encoding(s);
39
+ return;
40
+ }
34
+
41
+
35
/*
42
+ switch (type) {
36
* For AArch64, map a given EL to an index in the banked_spsr array.
43
+ case 0:
37
* Note that this mapping and the AArch32 mapping defined in bank_number()
44
+ sz = MO_32;
38
diff --git a/target/arm/helper.c b/target/arm/helper.c
45
+ break;
39
index XXXXXXX..XXXXXXX 100644
46
+ case 1:
40
--- a/target/arm/helper.c
47
+ sz = MO_64;
41
+++ b/target/arm/helper.c
48
+ break;
42
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
49
+ case 3:
43
" previous exception %d\n",
50
+ sz = MO_16;
44
type, env->v7m.exception);
51
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
45
52
+ break;
46
- if (extract32(type, 5, 23) != extract32(-1, 5, 23)) {
53
+ }
47
+ if ((type & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
54
+ /* fallthru */
48
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception "
55
+ default:
49
"exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n", type);
56
unallocated_encoding(s);
57
return;
50
}
58
}
51
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
59
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
52
* which security state's faultmask to clear. (v8M ARM ARM R_KBNF.)
60
return;
53
*/
54
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
55
- int es = type & 1;
56
+ int es = type & R_V7M_EXCRET_ES_MASK;
57
if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) {
58
env->v7m.faultmask[es] = 0;
59
}
60
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
61
return; /* Never happens. Keep compiler happy. */
62
}
61
}
63
62
64
- lr = 0xfffffff1;
63
- /* Zero extend sreg inputs to 64 bits now. */
65
+ lr = R_V7M_EXCRET_RES1_MASK |
64
+ /* Zero extend sreg & hreg inputs to 64 bits now. */
66
+ R_V7M_EXCRET_S_MASK |
65
t_true = tcg_temp_new_i64();
67
+ R_V7M_EXCRET_DCRS_MASK |
66
t_false = tcg_temp_new_i64();
68
+ R_V7M_EXCRET_FTYPE_MASK |
67
- read_vec_element(s, t_true, rn, 0, type ? MO_64 : MO_32);
69
+ R_V7M_EXCRET_ES_MASK;
68
- read_vec_element(s, t_false, rm, 0, type ? MO_64 : MO_32);
70
if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) {
69
+ read_vec_element(s, t_true, rn, 0, sz);
71
- lr |= 4;
70
+ read_vec_element(s, t_false, rm, 0, sz);
72
+ lr |= R_V7M_EXCRET_SPSEL_MASK;
71
73
}
72
a64_test_cc(&c, cond);
74
if (!arm_v7m_is_handler_mode(env)) {
73
t_zero = tcg_const_i64(0);
75
- lr |= 8;
74
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
76
+ lr |= R_V7M_EXCRET_MODE_MASK;
75
tcg_temp_free_i64(t_false);
77
}
76
a64_free_cc(&c);
78
77
79
v7m_push_stack(cpu);
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);
80
--
83
--
81
2.7.4
84
2.17.0
82
85
83
86
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@xilinx.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
The EP108 is a early access development board. Now that silicon is in
3
All the hard work is already done by vfp_expand_imm, we just need to
4
production people have access to the ZCU102. Let's rename the internal
4
make sure we pick up the correct size.
5
QEMU files and variables to use the ZCU102.
6
5
7
There is no functional change here as the EP108 is still a valid board
6
Cc: qemu-stable@nongnu.org
8
option.
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
8
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
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>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
15
---
14
hw/arm/Makefile.objs | 2 +-
16
target/arm/translate-a64.c | 20 +++++++++++++++++---
15
hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} | 30 +++++++++++++++---------------
17
1 file changed, 17 insertions(+), 3 deletions(-)
16
2 files changed, 16 insertions(+), 16 deletions(-)
17
rename hw/arm/{xlnx-ep108.c => xlnx-zcu102.c} (85%)
18
18
19
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
19
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
20
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/Makefile.objs
21
--- a/target/arm/translate-a64.c
22
+++ b/hw/arm/Makefile.objs
22
+++ b/target/arm/translate-a64.c
23
@@ -XXX,XX +XXX,XX @@ obj-y += omap1.o omap2.o strongarm.o
23
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
24
obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
25
obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o
26
obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
27
-obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-ep108.o
28
+obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o xlnx-zcu102.o
29
obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o
30
obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o
31
obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o
32
diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-zcu102.c
33
similarity index 85%
34
rename from hw/arm/xlnx-ep108.c
35
rename to hw/arm/xlnx-zcu102.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/arm/xlnx-ep108.c
38
+++ b/hw/arm/xlnx-zcu102.c
39
@@ -XXX,XX +XXX,XX @@
40
/*
41
- * Xilinx ZynqMP EP108 board
42
+ * Xilinx ZynqMP ZCU102 board
43
*
44
* Copyright (C) 2015 Xilinx Inc
45
* Written by Peter Crosthwaite <peter.crosthwaite@xilinx.com>
46
@@ -XXX,XX +XXX,XX @@
47
#include "exec/address-spaces.h"
48
#include "qemu/log.h"
49
50
-typedef struct XlnxEP108 {
51
+typedef struct XlnxZCU102 {
52
XlnxZynqMPState soc;
53
MemoryRegion ddr_ram;
54
-} XlnxEP108;
55
+} XlnxZCU102;
56
57
-static struct arm_boot_info xlnx_ep108_binfo;
58
+static struct arm_boot_info xlnx_zcu102_binfo;
59
60
-static void xlnx_ep108_init(MachineState *machine)
61
+static void xlnx_zcu102_init(MachineState *machine)
62
{
24
{
63
- XlnxEP108 *s = g_new0(XlnxEP108, 1);
25
int rd = extract32(insn, 0, 5);
64
+ XlnxZCU102 *s = g_new0(XlnxZCU102, 1);
26
int imm8 = extract32(insn, 13, 8);
65
int i;
27
- int is_double = extract32(insn, 22, 2);
66
uint64_t ram_size = machine->ram_size;
28
+ int type = extract32(insn, 22, 2);
67
29
uint64_t imm;
68
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine)
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;
69
}
50
}
70
51
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
71
if (ram_size < 0x08000000) {
52
return;
72
- qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for EP108",
73
+ qemu_log("WARNING: RAM size 0x%" PRIx64 " is small for ZCU102",
74
ram_size);
75
}
53
}
76
54
77
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_init(MachineState *machine)
55
- imm = vfp_expand_imm(MO_32 + is_double, imm8);
78
56
+ imm = vfp_expand_imm(sz, imm8);
79
/* TODO create and connect IDE devices for ide_drive_get() */
57
80
58
tcg_res = tcg_const_i64(imm);
81
- xlnx_ep108_binfo.ram_size = ram_size;
59
write_fp_dreg(s, rd, tcg_res);
82
- xlnx_ep108_binfo.kernel_filename = machine->kernel_filename;
83
- xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline;
84
- xlnx_ep108_binfo.initrd_filename = machine->initrd_filename;
85
- xlnx_ep108_binfo.loader_start = 0;
86
- arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_ep108_binfo);
87
+ xlnx_zcu102_binfo.ram_size = ram_size;
88
+ xlnx_zcu102_binfo.kernel_filename = machine->kernel_filename;
89
+ xlnx_zcu102_binfo.kernel_cmdline = machine->kernel_cmdline;
90
+ xlnx_zcu102_binfo.initrd_filename = machine->initrd_filename;
91
+ xlnx_zcu102_binfo.loader_start = 0;
92
+ arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_zcu102_binfo);
93
}
94
95
static void xlnx_ep108_machine_init(MachineClass *mc)
96
{
97
mc->desc = "Xilinx ZynqMP EP108 board";
98
- mc->init = xlnx_ep108_init;
99
+ mc->init = xlnx_zcu102_init;
100
mc->block_default_type = IF_IDE;
101
mc->units_per_default_bus = 1;
102
mc->ignore_memory_transaction_failures = true;
103
@@ -XXX,XX +XXX,XX @@ DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init)
104
static void xlnx_zcu102_machine_init(MachineClass *mc)
105
{
106
mc->desc = "Xilinx ZynqMP ZCU102 board";
107
- mc->init = xlnx_ep108_init;
108
+ mc->init = xlnx_zcu102_init;
109
mc->block_default_type = IF_IDE;
110
mc->units_per_default_bus = 1;
111
mc->ignore_memory_transaction_failures = true;
112
--
60
--
113
2.7.4
61
2.17.0
114
62
115
63
diff view generated by jsdifflib
1
From: Jaroslaw Pelczar <j.pelczar@samsung.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Previously when single stepping through ERET instruction via GDB
3
We are meant to explicitly pass fpst, not cpu_env.
4
would result in debugger entering the "next" PC after ERET instruction.
5
When debugging in kernel mode, this will also cause unintended behavior,
6
because debugger will try to access memory from EL0 point of view.
7
4
8
Signed-off-by: Jaroslaw Pelczar <j.pelczar@samsung.com>
5
Cc: qemu-stable@nongnu.org
9
Message-id: 001c01d32895$483027f0$d89077d0$@samsung.com
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
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 | 1 +
13
target/arm/translate-a64.c | 3 ++-
14
1 file changed, 1 insertion(+)
14
1 file changed, 2 insertions(+), 1 deletion(-)
15
15
16
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
16
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-a64.c
18
--- a/target/arm/translate-a64.c
19
+++ b/target/arm/translate-a64.c
19
+++ b/target/arm/translate-a64.c
20
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
20
@@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
21
default:
21
tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000);
22
gen_a64_set_pc_im(dc->pc);
22
break;
23
/* fall through */
23
case 0x3: /* FSQRT */
24
+ case DISAS_EXIT:
24
- gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env);
25
case DISAS_JUMP:
25
+ fpst = get_fpstatus_ptr(true);
26
if (dc->base.singlestep_enabled) {
26
+ gen_helper_sqrt_f16(tcg_res, tcg_op, fpst);
27
gen_exception_internal(EXCP_DEBUG);
27
break;
28
case 0x8: /* FRINTN */
29
case 0x9: /* FRINTP */
28
--
30
--
29
2.7.4
31
2.17.0
30
32
31
33
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@xilinx.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
In preperation for future work let's manually create the Xilnx machines.
3
Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status":
4
This will allow us to set properties for the machines in the future.
5
4
6
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
5
The block length is predefined to 512 bits
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
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>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
20
---
10
hw/arm/xlnx-zcu102.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++-----
21
hw/sd/sd.c | 2 +-
11
1 file changed, 67 insertions(+), 7 deletions(-)
22
1 file changed, 1 insertion(+), 1 deletion(-)
12
23
13
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
24
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
14
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/xlnx-zcu102.c
26
--- a/hw/sd/sd.c
16
+++ b/hw/arm/xlnx-zcu102.c
27
+++ b/hw/sd/sd.c
17
@@ -XXX,XX +XXX,XX @@
28
@@ -XXX,XX +XXX,XX @@ static void sd_function_switch(SDState *sd, uint32_t arg)
18
#include "qemu/log.h"
29
sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
19
30
}
20
typedef struct XlnxZCU102 {
31
memset(&sd->data[17], 0, 47);
21
+ MachineState parent_obj;
32
- stw_be_p(sd->data + 65, sd_crc16(sd->data, 64));
22
+
33
+ stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));
23
XlnxZynqMPState soc;
24
MemoryRegion ddr_ram;
25
} XlnxZCU102;
26
27
+#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")
28
+#define ZCU102_MACHINE(obj) \
29
+ OBJECT_CHECK(XlnxZCU102, (obj), TYPE_ZCU102_MACHINE)
30
+
31
+#define TYPE_EP108_MACHINE MACHINE_TYPE_NAME("xlnx-ep108")
32
+#define EP108_MACHINE(obj) \
33
+ OBJECT_CHECK(XlnxZCU102, (obj), TYPE_EP108_MACHINE)
34
+
35
static struct arm_boot_info xlnx_zcu102_binfo;
36
37
-static void xlnx_zcu102_init(MachineState *machine)
38
+static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
39
{
40
- XlnxZCU102 *s = g_new0(XlnxZCU102, 1);
41
int i;
42
uint64_t ram_size = machine->ram_size;
43
44
@@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_init(MachineState *machine)
45
arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_zcu102_binfo);
46
}
34
}
47
35
48
-static void xlnx_ep108_machine_init(MachineClass *mc)
36
static inline bool sd_wp_addr(SDState *sd, uint64_t addr)
49
+static void xlnx_ep108_init(MachineState *machine)
50
+{
51
+ XlnxZCU102 *s = EP108_MACHINE(machine);
52
+
53
+ xlnx_zynqmp_init(s, machine);
54
+}
55
+
56
+static void xlnx_ep108_machine_instance_init(Object *obj)
57
{
58
+}
59
+
60
+static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
61
+{
62
+ MachineClass *mc = MACHINE_CLASS(oc);
63
+
64
mc->desc = "Xilinx ZynqMP EP108 board";
65
- mc->init = xlnx_zcu102_init;
66
+ mc->init = xlnx_ep108_init;
67
mc->block_default_type = IF_IDE;
68
mc->units_per_default_bus = 1;
69
mc->ignore_memory_transaction_failures = true;
70
}
71
72
-DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init)
73
+static const TypeInfo xlnx_ep108_machine_init_typeinfo = {
74
+ .name = MACHINE_TYPE_NAME("xlnx-ep108"),
75
+ .parent = TYPE_MACHINE,
76
+ .class_init = xlnx_ep108_machine_class_init,
77
+ .instance_init = xlnx_ep108_machine_instance_init,
78
+ .instance_size = sizeof(XlnxZCU102),
79
+};
80
81
-static void xlnx_zcu102_machine_init(MachineClass *mc)
82
+static void xlnx_ep108_machine_init_register_types(void)
83
{
84
+ type_register_static(&xlnx_ep108_machine_init_typeinfo);
85
+}
86
+
87
+static void xlnx_zcu102_init(MachineState *machine)
88
+{
89
+ XlnxZCU102 *s = ZCU102_MACHINE(machine);
90
+
91
+ xlnx_zynqmp_init(s, machine);
92
+}
93
+
94
+static void xlnx_zcu102_machine_instance_init(Object *obj)
95
+{
96
+}
97
+
98
+static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
99
+{
100
+ MachineClass *mc = MACHINE_CLASS(oc);
101
+
102
mc->desc = "Xilinx ZynqMP ZCU102 board";
103
mc->init = xlnx_zcu102_init;
104
mc->block_default_type = IF_IDE;
105
@@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_init(MachineClass *mc)
106
mc->ignore_memory_transaction_failures = true;
107
}
108
109
-DEFINE_MACHINE("xlnx-zcu102", xlnx_zcu102_machine_init)
110
+static const TypeInfo xlnx_zcu102_machine_init_typeinfo = {
111
+ .name = MACHINE_TYPE_NAME("xlnx-zcu102"),
112
+ .parent = TYPE_MACHINE,
113
+ .class_init = xlnx_zcu102_machine_class_init,
114
+ .instance_init = xlnx_zcu102_machine_instance_init,
115
+ .instance_size = sizeof(XlnxZCU102),
116
+};
117
+
118
+static void xlnx_zcu102_machine_init_register_types(void)
119
+{
120
+ type_register_static(&xlnx_zcu102_machine_init_typeinfo);
121
+}
122
+
123
+type_init(xlnx_zcu102_machine_init_register_types)
124
+type_init(xlnx_ep108_machine_init_register_types)
125
--
37
--
126
2.7.4
38
2.17.0
127
39
128
40
diff view generated by jsdifflib
1
In do_v7m_exception_exit(), there's no need to force the high 4
1
Usually the logging of the CPU state produced by -d cpu is sufficient
2
bits of 'type' to 1 when calling v7m_exception_taken(), because
2
to diagnose problems, but sometimes you want to see the state of
3
we know that they're always 1 or we could not have got to this
3
the floating point registers as well. We don't want to enable that
4
"handle return to magic exception return address" code. Remove
4
by default as it adds a lot of extra data to the log; instead,
5
the unnecessary ORs.
5
allow it to be optionally enabled via -d fpu.
6
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
9
Message-id: 20180510130024.31678-1-peter.maydell@linaro.org
10
Message-id: 1505137930-13255-6-git-send-email-peter.maydell@linaro.org
11
---
10
---
12
target/arm/helper.c | 4 ++--
11
include/qemu/log.h | 1 +
13
1 file changed, 2 insertions(+), 2 deletions(-)
12
accel/tcg/cpu-exec.c | 9 ++++++---
13
util/log.c | 2 ++
14
3 files changed, 9 insertions(+), 3 deletions(-)
14
15
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
diff --git a/include/qemu/log.h b/include/qemu/log.h
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
18
--- a/include/qemu/log.h
18
+++ b/target/arm/helper.c
19
+++ b/include/qemu/log.h
19
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
20
@@ -XXX,XX +XXX,XX @@ static inline bool qemu_log_separate(void)
20
*/
21
#define CPU_LOG_PAGE (1 << 14)
21
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
22
/* LOG_TRACE (1 << 15) is defined in log-for-trace.h */
22
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
23
#define CPU_LOG_TB_OP_IND (1 << 16)
23
- v7m_exception_taken(cpu, type | 0xf0000000);
24
+#define CPU_LOG_TB_FPU (1 << 17)
24
+ v7m_exception_taken(cpu, type);
25
25
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
26
/* Lock output for a series of related logs. Since this is not needed
26
"stackframe: failed exception return integrity check\n");
27
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
27
return;
28
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
28
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
29
index XXXXXXX..XXXXXXX 100644
29
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
30
--- a/accel/tcg/cpu-exec.c
30
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
31
+++ b/accel/tcg/cpu-exec.c
31
v7m_push_stack(cpu);
32
@@ -XXX,XX +XXX,XX @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
32
- v7m_exception_taken(cpu, type | 0xf0000000);
33
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
33
+ v7m_exception_taken(cpu, type);
34
&& qemu_log_in_addr_range(itb->pc)) {
34
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
35
qemu_log_lock();
35
"failed exception return integrity check\n");
36
+ int flags = 0;
36
return;
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",
37
--
63
--
38
2.7.4
64
2.17.0
39
65
40
66
diff view generated by jsdifflib