1
First arm pullreq of the 2.13 cycle!
1
The following changes since commit ad1b4ec39caa5b3f17cbd8160283a03a3dcfe2ae:
2
2
3
-- PMM
3
Merge remote-tracking branch 'remotes/kraxel/tags/input-20180515-pull-request' into staging (2018-05-15 12:50:06 +0100)
4
5
The following changes since commit 4743c23509a51bd4ee85cc272287a41917d1be35:
6
7
Update version for v2.12.0 release (2018-04-24 16:44:55 +0100)
8
4
9
are available in the Git repository at:
5
are available in the Git repository at:
10
6
11
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180426
7
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180515
12
8
13
for you to fetch changes up to fbf32752663878947de455ff57cb5b9318f14bec:
9
for you to fetch changes up to ae7651804748c6b479d5ae09aeac4edb9c44f76e:
14
10
15
xilinx_spips: Correct SNOOP_NONE state when flushing the txfifo (2018-04-26 11:04:40 +0100)
11
tcg: Optionally log FPU state in TCG -d cpu logging (2018-05-15 14:58:44 +0100)
16
12
17
----------------------------------------------------------------
13
----------------------------------------------------------------
18
target-arm queue:
14
target-arm queue:
19
* xilinx_spips: Correct SNOOP_NONE state when flushing the txfifo
15
* Fix coverity nit in int_to_float code
20
* timer/aspeed: fix vmstate version id
16
* Don't set Invalid for float-to-int(MAXINT)
21
* hw/arm/aspeed_soc: don't use vmstate_register_ram_global for SRAM
17
* Fix fp_status_f16 tininess before rounding
22
* hw/arm/aspeed: don't make 'boot_rom' region 'nomigrate'
18
* Add various missing insns from the v8.2-FP16 extension
23
* hw/arm/highbank: don't make sysram 'nomigrate'
19
* Fix sqrt_f16 exception raising
24
* hw/arm/raspi: Don't bother setting default_cpu_type
20
* sdcard: Correct CRC16 offset in sd_function_switch()
25
* PMU emulation: some minor bugfixes and preparation for
21
* tcg: Optionally log FPU state in TCG -d cpu logging
26
support of other events than just the cycle counter
27
* target/arm: Use v7m_stack_read() for reading the frame signature
28
* target/arm: Remove stale TODO comment
29
* arm: always start from first_cpu when registering loader cpu reset callback
30
* device_tree: Increase FDT_MAX_SIZE to 1 MiB
31
22
32
----------------------------------------------------------------
23
----------------------------------------------------------------
33
Aaron Lindsay (9):
24
Alex Bennée (5):
34
target/arm: Check PMCNTEN for whether PMCCNTR is enabled
25
fpu/softfloat: int_to_float ensure r fully initialised
35
target/arm: Treat PMCCNTR as alias of PMCCNTR_EL0
26
target/arm: Implement FCMP for fp16
36
target/arm: Mask PMU register writes based on PMCR_EL0.N
27
target/arm: Implement FCSEL for fp16
37
target/arm: Fetch GICv3 state directly from CPUARMState
28
target/arm: Implement FMOV (immediate) for fp16
38
target/arm: Support multiple EL change hooks
29
target/arm: Fix sqrt_f16 exception raising
39
target/arm: Add pre-EL change hooks
40
target/arm: Allow EL change hooks to do IO
41
target/arm: Fix bitmask for PMCCFILTR writes
42
target/arm: Make PMOVSCLR and PMUSERENR 64 bits wide
43
30
44
Cédric Le Goater (1):
31
Peter Maydell (3):
45
timer/aspeed: fix vmstate version id
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
46
35
47
Geert Uytterhoeven (1):
36
Philippe Mathieu-Daudé (1):
48
device_tree: Increase FDT_MAX_SIZE to 1 MiB
37
sdcard: Correct CRC16 offset in sd_function_switch()
49
38
50
Igor Mammedov (1):
39
Richard Henderson (7):
51
arm: always start from first_cpu when registering loader cpu reset callback
40
target/arm: Implement FMOV (general) for fp16
41
target/arm: Early exit after unallocated_encoding in disas_fp_int_conv
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
52
47
53
Peter Maydell (6):
48
include/qemu/log.h | 1 +
54
target/arm: Remove stale TODO comment
49
target/arm/helper-a64.h | 2 +
55
target/arm: Use v7m_stack_read() for reading the frame signature
50
target/arm/helper.h | 6 +
56
hw/arm/raspi: Don't bother setting default_cpu_type
51
accel/tcg/cpu-exec.c | 9 +-
57
hw/arm/highbank: don't make sysram 'nomigrate'
52
fpu/softfloat.c | 6 +-
58
hw/arm/aspeed: don't make 'boot_rom' region 'nomigrate'
53
hw/sd/sd.c | 2 +-
59
hw/arm/aspeed_soc: don't use vmstate_register_ram_global for SRAM
54
target/arm/cpu.c | 2 +
55
target/arm/helper-a64.c | 10 ++
56
target/arm/helper.c | 38 +++-
57
target/arm/translate-a64.c | 421 ++++++++++++++++++++++++++++++++++++++-------
58
util/log.c | 2 +
59
11 files changed, 428 insertions(+), 71 deletions(-)
60
60
61
Sai Pavan Boddu (1):
62
xilinx_spips: Correct SNOOP_NONE state when flushing the txfifo
63
64
target/arm/cpu.h | 48 +++++++++++++++++-------------
65
target/arm/internals.h | 14 +++++++--
66
device_tree.c | 2 +-
67
hw/arm/aspeed.c | 2 +-
68
hw/arm/aspeed_soc.c | 3 +-
69
hw/arm/boot.c | 2 +-
70
hw/arm/highbank.c | 2 +-
71
hw/arm/raspi.c | 2 --
72
hw/intc/arm_gicv3_cpuif.c | 10 ++-----
73
hw/ssi/xilinx_spips.c | 3 +-
74
hw/timer/aspeed_timer.c | 2 +-
75
target/arm/cpu.c | 37 +++++++++++++++++++----
76
target/arm/helper.c | 73 ++++++++++++++++++++++++++--------------------
77
target/arm/op_helper.c | 8 +++++
78
target/arm/translate-a64.c | 6 ++++
79
target/arm/translate.c | 12 ++++++++
80
16 files changed, 148 insertions(+), 78 deletions(-)
81
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
This is a bug fix to ensure 64-bit reads of these registers don't read
3
Reported by Coverity (CID1390635). We ensure this for uint_to_float
4
adjacent data.
4
later on so we might as well mirror that.
5
5
6
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 1523997485-1905-13-git-send-email-alindsay@codeaurora.org
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
target/arm/cpu.h | 4 ++--
11
fpu/softfloat.c | 2 +-
12
target/arm/helper.c | 5 +++--
12
1 file changed, 1 insertion(+), 1 deletion(-)
13
2 files changed, 5 insertions(+), 4 deletions(-)
14
13
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.h
16
--- a/fpu/softfloat.c
18
+++ b/target/arm/cpu.h
17
+++ b/fpu/softfloat.c
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
18
@@ -XXX,XX +XXX,XX @@ FLOAT_TO_UINT(64, 64)
20
uint32_t c9_data;
19
21
uint64_t c9_pmcr; /* performance monitor control register */
20
static FloatParts int_to_float(int64_t a, float_status *status)
22
uint64_t c9_pmcnten; /* perf monitor counter enables */
21
{
23
- uint32_t c9_pmovsr; /* perf monitor overflow status */
22
- FloatParts r;
24
- uint32_t c9_pmuserenr; /* perf monitor user enable */
23
+ FloatParts r = {};
25
+ uint64_t c9_pmovsr; /* perf monitor overflow status */
24
if (a == 0) {
26
+ uint64_t c9_pmuserenr; /* perf monitor user enable */
25
r.cls = float_class_zero;
27
uint64_t c9_pmselr; /* perf monitor counter selection register */
26
r.sign = false;
28
uint64_t c9_pminten; /* perf monitor interrupt enables */
29
union { /* Memory attribute redirection */
30
diff --git a/target/arm/helper.c b/target/arm/helper.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/helper.c
33
+++ b/target/arm/helper.c
34
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
35
.fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten),
36
.writefn = pmcntenclr_write },
37
{ .name = "PMOVSR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 3,
38
- .access = PL0_RW, .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr),
39
+ .access = PL0_RW,
40
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmovsr),
41
.accessfn = pmreg_access,
42
.writefn = pmovsr_write,
43
.raw_writefn = raw_write },
44
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
45
.accessfn = pmreg_access_xevcntr },
46
{ .name = "PMUSERENR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 0,
47
.access = PL0_R | PL1_RW, .accessfn = access_tpm,
48
- .fieldoffset = offsetof(CPUARMState, cp15.c9_pmuserenr),
49
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmuserenr),
50
.resetvalue = 0,
51
.writefn = pmuserenr_write, .raw_writefn = raw_write },
52
{ .name = "PMUSERENR_EL0", .state = ARM_CP_STATE_AA64,
53
--
27
--
54
2.17.0
28
2.17.0
55
29
56
30
diff view generated by jsdifflib
1
Currently we use vmstate_register_ram_global() for the SRAM;
1
In float-to-integer conversion, if the floating point input
2
this is not a good idea for devices, because it means that
2
converts exactly to the largest or smallest integer that
3
you can only ever create one instance of the device, as
3
fits in to the result type, this is not an overflow.
4
the second instance would get a RAM block name clash.
4
In this situation we were producing the correct result value,
5
Instead, use memory_region_init_ram(), which automatically
5
but were incorrectly setting the Invalid flag.
6
registers the RAM block with a local-to-the-device name.
6
For example for Arm A64, "FCVTAS w0, d0" on an input of
7
0x41dfffffffc00000 should produce 0x7fffffff and set no flags.
7
8
8
Note that this would be a cross-version migration compatibility break
9
Fix the boundary case to take the right half of the if()
9
for the "palmetto-bmc", "ast2500-evb" and "romulus-bmc" machines,
10
statements.
10
but migration is currently broken for them.
11
11
12
This fixes a regression from 2.11 introduced by the softfloat
13
refactoring.
14
15
Cc: qemu-stable@nongnu.org
16
Fixes: ab52f973a50
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Cédric Le Goater <clg@kaod.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Tested-by: Cédric Le Goater <clg@kaod.org>
19
Message-id: 20180510140141.12120-1-peter.maydell@linaro.org
15
Message-id: 20180420124835.7268-4-peter.maydell@linaro.org
16
---
20
---
17
hw/arm/aspeed_soc.c | 3 +--
21
fpu/softfloat.c | 4 ++--
18
1 file changed, 1 insertion(+), 2 deletions(-)
22
1 file changed, 2 insertions(+), 2 deletions(-)
19
23
20
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
24
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
21
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/aspeed_soc.c
26
--- a/fpu/softfloat.c
23
+++ b/hw/arm/aspeed_soc.c
27
+++ b/fpu/softfloat.c
24
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
28
@@ -XXX,XX +XXX,XX @@ static int64_t round_to_int_and_pack(FloatParts in, int rmode,
25
}
29
r = UINT64_MAX;
26
30
}
27
/* SRAM */
31
if (p.sign) {
28
- memory_region_init_ram_nomigrate(&s->sram, OBJECT(dev), "aspeed.sram",
32
- if (r < -(uint64_t) min) {
29
+ memory_region_init_ram(&s->sram, OBJECT(dev), "aspeed.sram",
33
+ if (r <= -(uint64_t) min) {
30
sc->info->sram_size, &err);
34
return -r;
31
if (err) {
35
} else {
32
error_propagate(errp, err);
36
s->float_exception_flags = orig_flags | float_flag_invalid;
33
return;
37
return min;
34
}
38
}
35
- vmstate_register_ram_global(&s->sram);
39
} else {
36
memory_region_add_subregion(get_system_memory(), ASPEED_SOC_SRAM_BASE,
40
- if (r < max) {
37
&s->sram);
41
+ if (r <= max) {
38
42
return r;
43
} else {
44
s->float_exception_flags = orig_flags | float_flag_invalid;
39
--
45
--
40
2.17.0
46
2.17.0
41
47
42
48
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
In commit d81ce0ef2c4f105 we added an extra float_status field
2
fp_status_fp16 for Arm, but forgot to initialize it correctly
3
by setting it to float_tininess_before_rounding. This currently
4
will only cause problems for the new V8_FP16 feature, since the
5
float-to-float conversion code doesn't use it yet. The effect
6
would be that we failed to set the Underflow IEEE exception flag
7
in all the cases where we should.
2
8
3
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
9
Add the missing initialization.
4
Message-id: 1523997485-1905-7-git-send-email-alindsay@codeaurora.org
10
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Message-id: 20180512004311.9299-16-richard.henderson@linaro.org
7
---
17
---
8
target/arm/cpu.h | 20 ++++++++++----------
18
target/arm/cpu.c | 2 ++
9
target/arm/internals.h | 7 ++++---
19
1 file changed, 2 insertions(+)
10
target/arm/cpu.c | 21 ++++++++++++++++-----
11
3 files changed, 30 insertions(+), 18 deletions(-)
12
20
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/cpu.h
16
+++ b/target/arm/cpu.h
17
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
18
} CPUARMState;
19
20
/**
21
- * ARMELChangeHook:
22
+ * ARMELChangeHookFn:
23
* type of a function which can be registered via arm_register_el_change_hook()
24
* to get callbacks when the CPU changes its exception level or mode.
25
*/
26
-typedef void ARMELChangeHook(ARMCPU *cpu, void *opaque);
27
-
28
+typedef void ARMELChangeHookFn(ARMCPU *cpu, void *opaque);
29
+typedef struct ARMELChangeHook ARMELChangeHook;
30
+struct ARMELChangeHook {
31
+ ARMELChangeHookFn *hook;
32
+ void *opaque;
33
+ QLIST_ENTRY(ARMELChangeHook) node;
34
+};
35
36
/* These values map onto the return values for
37
* QEMU_PSCI_0_2_FN_AFFINITY_INFO */
38
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
39
*/
40
bool cfgend;
41
42
- ARMELChangeHook *el_change_hook;
43
- void *el_change_hook_opaque;
44
+ QLIST_HEAD(, ARMELChangeHook) el_change_hooks;
45
46
int32_t node_id; /* NUMA node this CPU belongs to */
47
48
@@ -XXX,XX +XXX,XX @@ static inline AddressSpace *arm_addressspace(CPUState *cs, MemTxAttrs attrs)
49
* CPU changes exception level or mode. The hook function will be
50
* passed a pointer to the ARMCPU and the opaque data pointer passed
51
* to this function when the hook was registered.
52
- *
53
- * Note that we currently only support registering a single hook function,
54
- * and will assert if this function is called twice.
55
- * This facility is intended for the use of the GICv3 emulation.
56
*/
57
-void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHook *hook,
58
+void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
59
void *opaque);
60
61
/**
62
diff --git a/target/arm/internals.h b/target/arm/internals.h
63
index XXXXXXX..XXXXXXX 100644
64
--- a/target/arm/internals.h
65
+++ b/target/arm/internals.h
66
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
67
int mmu_idx, MemTxAttrs attrs,
68
MemTxResult response, uintptr_t retaddr);
69
70
-/* Call the EL change hook if one has been registered */
71
+/* Call any registered EL change hooks */
72
static inline void arm_call_el_change_hook(ARMCPU *cpu)
73
{
74
- if (cpu->el_change_hook) {
75
- cpu->el_change_hook(cpu, cpu->el_change_hook_opaque);
76
+ ARMELChangeHook *hook, *next;
77
+ QLIST_FOREACH_SAFE(hook, &cpu->el_change_hooks, node, next) {
78
+ hook->hook(cpu, hook->opaque);
79
}
80
}
81
82
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
83
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
84
--- a/target/arm/cpu.c
23
--- a/target/arm/cpu.c
85
+++ b/target/arm/cpu.c
24
+++ b/target/arm/cpu.c
86
@@ -XXX,XX +XXX,XX @@ static bool arm_cpu_has_work(CPUState *cs)
25
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
87
| CPU_INTERRUPT_EXITTB);
26
&env->vfp.fp_status);
88
}
27
set_float_detect_tininess(float_tininess_before_rounding,
89
28
&env->vfp.standard_fp_status);
90
-void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHook *hook,
29
+ set_float_detect_tininess(float_tininess_before_rounding,
91
+void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
30
+ &env->vfp.fp_status_f16);
92
void *opaque)
93
{
94
- /* We currently only support registering a single hook function */
95
- assert(!cpu->el_change_hook);
96
- cpu->el_change_hook = hook;
97
- cpu->el_change_hook_opaque = opaque;
98
+ ARMELChangeHook *entry = g_new0(ARMELChangeHook, 1);
99
+
100
+ entry->hook = hook;
101
+ entry->opaque = opaque;
102
+
103
+ QLIST_INSERT_HEAD(&cpu->el_change_hooks, entry, node);
104
}
105
106
static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
107
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj)
108
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
109
g_free, g_free);
110
111
+ QLIST_INIT(&cpu->el_change_hooks);
112
+
113
#ifndef CONFIG_USER_ONLY
31
#ifndef CONFIG_USER_ONLY
114
/* Our inbound IRQ and FIQ lines */
115
if (kvm_enabled()) {
32
if (kvm_enabled()) {
116
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_post_init(Object *obj)
33
kvm_arm_reset_vcpu(cpu);
117
static void arm_cpu_finalizefn(Object *obj)
118
{
119
ARMCPU *cpu = ARM_CPU(obj);
120
+ ARMELChangeHook *hook, *next;
121
+
122
g_hash_table_destroy(cpu->cp_regs);
123
+
124
+ QLIST_FOREACH_SAFE(hook, &cpu->el_change_hooks, node, next) {
125
+ QLIST_REMOVE(hook, node);
126
+ g_free(hook);
127
+ }
128
}
129
130
static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
131
--
34
--
132
2.17.0
35
2.17.0
133
36
134
37
diff view generated by jsdifflib
1
From: Igor Mammedov <imammedo@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
if arm_load_kernel() were passed non first_cpu, QEMU would end up
3
Adding the fp16 moves to/from general registers.
4
with partially set do_cpu_reset() callback leaving some CPUs without it.
5
4
6
Make sure that do_cpu_reset() is registered for all CPUs by enumerating
5
Cc: qemu-stable@nongnu.org
7
CPUs from first_cpu.
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
7
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
(In practice every board that we have was passing us the first CPU
8
Message-id: 20180512003217.9105-2-richard.henderson@linaro.org
10
as the boot CPU, either directly or indirectly, so this wasn't
11
causing incorrect behaviour.)
12
13
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
[PMM: added a note that this isn't a behaviour change]
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
11
---
18
hw/arm/boot.c | 2 +-
12
target/arm/translate-a64.c | 21 +++++++++++++++++++++
19
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 21 insertions(+)
20
14
21
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
22
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/arm/boot.c
17
--- a/target/arm/translate-a64.c
24
+++ b/hw/arm/boot.c
18
+++ b/target/arm/translate-a64.c
25
@@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
19
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
26
* actually loading a kernel, the handler is also responsible for
20
tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(s, rd));
27
* arranging that we start it correctly.
21
clear_vec_high(s, true, rd);
28
*/
22
break;
29
- for (cs = CPU(cpu); cs; cs = CPU_NEXT(cs)) {
23
+ case 3:
30
+ for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
24
+ /* 16 bit */
31
qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
25
+ tmp = tcg_temp_new_i64();
26
+ tcg_gen_ext16u_i64(tmp, tcg_rn);
27
+ write_fp_dreg(s, rd, tmp);
28
+ tcg_temp_free_i64(tmp);
29
+ break;
30
+ default:
31
+ g_assert_not_reached();
32
}
33
} else {
34
TCGv_i64 tcg_rd = cpu_reg(s, rd);
35
@@ -XXX,XX +XXX,XX @@ static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof)
36
/* 64 bits from top half */
37
tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(s, rn));
38
break;
39
+ case 3:
40
+ /* 16 bit */
41
+ tcg_gen_ld16u_i64(tcg_rd, cpu_env, fp_reg_offset(s, rn, MO_16));
42
+ break;
43
+ default:
44
+ g_assert_not_reached();
45
}
32
}
46
}
33
}
47
}
48
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
49
case 0xa: /* 64 bit */
50
case 0xd: /* 64 bit to top half of quad */
51
break;
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);
34
--
61
--
35
2.17.0
62
2.17.0
36
63
37
64
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
commit 1d3e65aa7ac5 ("hw/timer: Add value matching support to
3
No sense in emitting code after the exception.
4
aspeed_timer") increased the vmstate version of aspeed.timer because
5
the state had changed, but it also bumped the version of the
6
VMSTATE_STRUCT_ARRAY under the aspeed.timerctrl which did not need to.
7
4
8
Change back this version to fix migration.
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Message-id: 20180512003217.9105-3-richard.henderson@linaro.org
11
Message-id: 20180423101433.17759-1-clg@kaod.org
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
10
---
15
hw/timer/aspeed_timer.c | 2 +-
11
target/arm/translate-a64.c | 2 +-
16
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
17
13
18
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
19
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/timer/aspeed_timer.c
16
--- a/target/arm/translate-a64.c
21
+++ b/hw/timer/aspeed_timer.c
17
+++ b/target/arm/translate-a64.c
22
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_aspeed_timer_state = {
18
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
23
VMSTATE_UINT32(ctrl, AspeedTimerCtrlState),
19
default:
24
VMSTATE_UINT32(ctrl2, AspeedTimerCtrlState),
20
/* all other sf/type/rmode combinations are invalid */
25
VMSTATE_STRUCT_ARRAY(timers, AspeedTimerCtrlState,
21
unallocated_encoding(s);
26
- ASPEED_TIMER_NR_TIMERS, 2, vmstate_aspeed_timer,
22
- break;
27
+ ASPEED_TIMER_NR_TIMERS, 1, vmstate_aspeed_timer,
23
+ return;
28
AspeedTimer),
24
}
29
VMSTATE_END_OF_LIST()
25
30
}
26
if (!fp_access_check(s)) {
31
--
27
--
32
2.17.0
28
2.17.0
33
29
34
30
diff view generated by jsdifflib
1
Remove a stale TODO comment -- we have now made the arm_ldl_ptw()
1
From: Richard Henderson <richard.henderson@linaro.org>
2
and arm_ldq_ptw() functions propagate physical memory read errors
2
3
out to their callers.
3
Cc: qemu-stable@nongnu.org
4
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-4-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20180419142151.9862-1-peter.maydell@linaro.org
8
---
9
---
9
target/arm/helper.c | 8 +-------
10
target/arm/helper.h | 6 +++
10
1 file changed, 1 insertion(+), 7 deletions(-)
11
target/arm/helper.c | 38 ++++++++++++++-
11
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)
12
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
13
index XXXXXXX..XXXXXXX 100644
40
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/helper.c
41
--- a/target/arm/helper.c
15
+++ b/target/arm/helper.c
42
+++ b/target/arm/helper.c
16
@@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
43
@@ -XXX,XX +XXX,XX @@ VFP_CONV_FIX_A64(uq, s, 32, 64, uint64)
17
return addr;
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);
18
}
60
}
19
61
20
-/* All loads done in the course of a page table walk go through here.
62
+float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst)
21
- * TODO: rather than ignoring errors from physical memory reads (which
63
+{
22
- * are external aborts in ARM terminology) we should propagate this
64
+ return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst);
23
- * error out so that we can turn it into a Data Abort if this walk
65
+}
24
- * was being done for a CPU load/store or an address translation instruction
66
+
25
- * (but not if it was for a debug access).
67
+float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)
26
- */
68
+{
27
+/* All loads done in the course of a page table walk go through here. */
69
+ return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst);
28
static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure,
70
+}
29
ARMMMUIdx mmu_idx, ARMMMUFaultInfo *fi)
71
+
72
static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst)
30
{
73
{
74
if (unlikely(float16_is_any_nan(f))) {
75
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst)
76
return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst);
77
}
78
79
+uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst)
80
+{
81
+ return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst);
82
+}
83
+
84
+uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst)
85
+{
86
+ return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst);
87
+}
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
- }
240
}
241
242
tcg_temp_free_ptr(tcg_fpstatus);
243
@@ -XXX,XX +XXX,XX @@ static void disas_fp_int_conv(DisasContext *s, uint32_t insn)
244
/* actual FP conversions */
245
bool itof = extract32(opcode, 1, 1);
246
247
- if (type > 1 || (rmode != 0 && opcode > 1)) {
248
+ if (rmode != 0 && opcode > 1) {
249
+ unallocated_encoding(s);
250
+ return;
251
+ }
252
+ switch (type) {
253
+ case 0: /* float32 */
254
+ case 1: /* float64 */
255
+ break;
256
+ case 3: /* float16 */
257
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
258
+ break;
259
+ }
260
+ /* fallthru */
261
+ default:
262
unallocated_encoding(s);
263
return;
264
}
31
--
265
--
32
2.17.0
266
2.17.0
33
267
34
268
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
During code generation, surround CPSR writes and exception returns which
3
Cc: qemu-stable@nongnu.org
4
call the EL change hooks with gen_io_start/end. The immediate need is
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
for the PMU to access the clock and icount during EL change to support
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
mode filtering.
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
7
Message-id: 20180512003217.9105-5-richard.henderson@linaro.org
8
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
9
Message-id: 1523997485-1905-9-git-send-email-alindsay@codeaurora.org
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
9
---
13
target/arm/translate-a64.c | 6 ++++++
10
target/arm/translate-a64.c | 17 +++++++++++++++--
14
target/arm/translate.c | 12 ++++++++++++
11
1 file changed, 15 insertions(+), 2 deletions(-)
15
2 files changed, 18 insertions(+)
16
12
17
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/translate-a64.c
15
--- a/target/arm/translate-a64.c
20
+++ b/target/arm/translate-a64.c
16
+++ b/target/arm/translate-a64.c
21
@@ -XXX,XX +XXX,XX @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
17
@@ -XXX,XX +XXX,XX @@ static void disas_fp_fixed_conv(DisasContext *s, uint32_t insn)
22
unallocated_encoding(s);
18
bool sf = extract32(insn, 31, 1);
23
return;
19
bool itof;
24
}
20
25
+ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
21
- if (sbit || (type > 1)
26
+ gen_io_start();
22
- || (!sf && scale < 32)) {
23
+ if (sbit || (!sf && scale < 32)) {
24
+ unallocated_encoding(s);
25
+ return;
26
+ }
27
+
28
+ switch (type) {
29
+ case 0: /* float32 */
30
+ case 1: /* float64 */
31
+ break;
32
+ case 3: /* float16 */
33
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
34
+ break;
27
+ }
35
+ }
28
gen_helper_exception_return(cpu_env);
36
+ /* fallthru */
29
+ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
37
+ default:
30
+ gen_io_end();
38
unallocated_encoding(s);
31
+ }
32
/* Must exit loop to check un-masked IRQs */
33
s->base.is_jmp = DISAS_EXIT;
34
return;
39
return;
35
diff --git a/target/arm/translate.c b/target/arm/translate.c
40
}
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/translate.c
38
+++ b/target/arm/translate.c
39
@@ -XXX,XX +XXX,XX @@ static void gen_rfe(DisasContext *s, TCGv_i32 pc, TCGv_i32 cpsr)
40
* appropriately depending on the new Thumb bit, so it must
41
* be called after storing the new PC.
42
*/
43
+ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
44
+ gen_io_start();
45
+ }
46
gen_helper_cpsr_write_eret(cpu_env, cpsr);
47
+ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
48
+ gen_io_end();
49
+ }
50
tcg_temp_free_i32(cpsr);
51
/* Must exit loop to check un-masked IRQs */
52
s->base.is_jmp = DISAS_EXIT;
53
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
54
if (exc_return) {
55
/* Restore CPSR from SPSR. */
56
tmp = load_cpu_field(spsr);
57
+ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
58
+ gen_io_start();
59
+ }
60
gen_helper_cpsr_write_eret(cpu_env, tmp);
61
+ if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
62
+ gen_io_end();
63
+ }
64
tcg_temp_free_i32(tmp);
65
/* Must exit loop to check un-masked IRQs */
66
s->base.is_jmp = DISAS_EXIT;
67
--
41
--
68
2.17.0
42
2.17.0
69
43
70
44
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
3
Cc: qemu-stable@nongnu.org
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: 1523997485-1905-2-git-send-email-alindsay@codeaurora.org
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20180512003217.9105-6-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
9
---
8
target/arm/helper.c | 2 +-
10
target/arm/translate-a64.c | 30 ++++++++++++++----------------
9
1 file changed, 1 insertion(+), 1 deletion(-)
11
1 file changed, 14 insertions(+), 16 deletions(-)
10
12
11
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
12
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/helper.c
15
--- a/target/arm/translate-a64.c
14
+++ b/target/arm/helper.c
16
+++ b/target/arm/translate-a64.c
15
@@ -XXX,XX +XXX,XX @@ static inline bool arm_ccnt_enabled(CPUARMState *env)
17
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 read_fp_sreg(DisasContext *s, int reg)
18
return v;
19
}
20
21
+static TCGv_i32 read_fp_hreg(DisasContext *s, int reg)
22
+{
23
+ TCGv_i32 v = tcg_temp_new_i32();
24
+
25
+ tcg_gen_ld16u_i32(v, cpu_env, fp_reg_offset(s, reg, MO_16));
26
+ return v;
27
+}
28
+
29
/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
30
* If SVE is not enabled, then there are only 128 bits in the vector.
31
*/
32
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
33
static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
16
{
34
{
17
/* This does not support checking PMCCFILTR_EL0 register */
35
TCGv_ptr fpst = NULL;
18
36
- TCGv_i32 tcg_op = tcg_temp_new_i32();
19
- if (!(env->cp15.c9_pmcr & PMCRE)) {
37
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
20
+ if (!(env->cp15.c9_pmcr & PMCRE) || !(env->cp15.c9_pmcnten & (1 << 31))) {
38
TCGv_i32 tcg_res = tcg_temp_new_i32();
21
return false;
39
40
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
41
-
42
switch (opcode) {
43
case 0x0: /* FMOV */
44
tcg_gen_mov_i32(tcg_res, tcg_op);
45
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_diff(DisasContext *s, uint32_t insn)
46
tcg_temp_free_i64(tcg_op2);
47
tcg_temp_free_i64(tcg_res);
48
} else {
49
- TCGv_i32 tcg_op1 = tcg_temp_new_i32();
50
- TCGv_i32 tcg_op2 = tcg_temp_new_i32();
51
+ TCGv_i32 tcg_op1 = read_fp_hreg(s, rn);
52
+ TCGv_i32 tcg_op2 = read_fp_hreg(s, rm);
53
TCGv_i64 tcg_res = tcg_temp_new_i64();
54
55
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
56
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
57
-
58
gen_helper_neon_mull_s16(tcg_res, tcg_op1, tcg_op2);
59
gen_helper_neon_addl_saturate_s32(tcg_res, cpu_env, tcg_res, tcg_res);
60
61
@@ -XXX,XX +XXX,XX @@ static void disas_simd_scalar_three_reg_same_fp16(DisasContext *s,
62
63
fpst = get_fpstatus_ptr(true);
64
65
- tcg_op1 = tcg_temp_new_i32();
66
- tcg_op2 = tcg_temp_new_i32();
67
+ tcg_op1 = read_fp_hreg(s, rn);
68
+ tcg_op2 = read_fp_hreg(s, rm);
69
tcg_res = tcg_temp_new_i32();
70
71
- read_vec_element_i32(s, tcg_op1, rn, 0, MO_16);
72
- read_vec_element_i32(s, tcg_op2, rm, 0, MO_16);
73
-
74
switch (fpopcode) {
75
case 0x03: /* FMULX */
76
gen_helper_advsimd_mulxh(tcg_res, tcg_op1, tcg_op2, fpst);
77
@@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
22
}
78
}
23
79
80
if (is_scalar) {
81
- TCGv_i32 tcg_op = tcg_temp_new_i32();
82
+ TCGv_i32 tcg_op = read_fp_hreg(s, rn);
83
TCGv_i32 tcg_res = tcg_temp_new_i32();
84
85
- read_vec_element_i32(s, tcg_op, rn, 0, MO_16);
86
-
87
switch (fpop) {
88
case 0x1a: /* FCVTNS */
89
case 0x1b: /* FCVTMS */
24
--
90
--
25
2.17.0
91
2.17.0
26
92
27
93
diff view generated by jsdifflib
1
From: Geert Uytterhoeven <geert+renesas@glider.be>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
It is not uncommon for a contemporary FDT to be larger than 64 KiB,
3
We missed all of the scalar fp16 binary operations.
4
leading to failures loading the device tree from sysfs:
5
6
qemu-system-aarch64: qemu_fdt_setprop: Couldn't set ...: FDT_ERR_NOSPACE
7
8
Hence increase the limit to 1 MiB, like on PPC.
9
10
For reference, the largest arm64 DTB created from the Linux sources is
11
ca. 75 KiB large (100 KiB when built with symbols/fixup support).
12
4
13
Cc: qemu-stable@nongnu.org
5
Cc: qemu-stable@nongnu.org
14
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
Message-id: 1523541337-23919-1-git-send-email-geert+renesas@glider.be
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20180512003217.9105-7-richard.henderson@linaro.org
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
11
---
19
device_tree.c | 2 +-
12
target/arm/translate-a64.c | 65 ++++++++++++++++++++++++++++++++++++++
20
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 65 insertions(+)
21
14
22
diff --git a/device_tree.c b/device_tree.c
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
23
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
24
--- a/device_tree.c
17
--- a/target/arm/translate-a64.c
25
+++ b/device_tree.c
18
+++ b/target/arm/translate-a64.c
26
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_2src_double(DisasContext *s, int opcode,
27
20
tcg_temp_free_i64(tcg_res);
28
#include <libfdt.h>
21
}
29
22
30
-#define FDT_MAX_SIZE 0x10000
23
+/* Floating-point data-processing (2 source) - half precision */
31
+#define FDT_MAX_SIZE 0x100000
24
+static void handle_fp_2src_half(DisasContext *s, int opcode,
32
25
+ int rd, int rn, int rm)
33
void *create_device_tree(int *sizep)
26
+{
34
{
27
+ TCGv_i32 tcg_op1;
28
+ TCGv_i32 tcg_op2;
29
+ TCGv_i32 tcg_res;
30
+ TCGv_ptr fpst;
31
+
32
+ tcg_res = tcg_temp_new_i32();
33
+ fpst = get_fpstatus_ptr(true);
34
+ tcg_op1 = read_fp_hreg(s, rn);
35
+ tcg_op2 = read_fp_hreg(s, rm);
36
+
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);
76
+}
77
+
78
/* Floating point data-processing (2 source)
79
* 31 30 29 28 24 23 22 21 20 16 15 12 11 10 9 5 4 0
80
* +---+---+---+-----------+------+---+------+--------+-----+------+------+
81
@@ -XXX,XX +XXX,XX @@ static void disas_fp_2src(DisasContext *s, uint32_t insn)
82
}
83
handle_fp_2src_double(s, opcode, rd, rn, rm);
84
break;
85
+ case 3:
86
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
87
+ unallocated_encoding(s);
88
+ return;
89
+ }
90
+ if (!fp_access_check(s)) {
91
+ return;
92
+ }
93
+ handle_fp_2src_half(s, opcode, rd, rn, rm);
94
+ break;
95
default:
96
unallocated_encoding(s);
97
}
35
--
98
--
36
2.17.0
99
2.17.0
37
100
38
101
diff view generated by jsdifflib
Deleted patch
1
In commit 95695effe8caa552b8f2 we changed the v7M/v8M stack
2
pop code to use a new v7m_stack_read() function that checks
3
whether the read should fail due to an MPU or bus abort.
4
We missed one call though, the one which reads the signature
5
word for the callee-saved register part of the frame.
6
1
7
Correct the omission.
8
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20180419142106.9694-1-peter.maydell@linaro.org
13
---
14
target/arm/helper.c | 9 +++++----
15
1 file changed, 5 insertions(+), 4 deletions(-)
16
17
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/helper.c
20
+++ b/target/arm/helper.c
21
@@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu)
22
static void do_v7m_exception_exit(ARMCPU *cpu)
23
{
24
CPUARMState *env = &cpu->env;
25
- CPUState *cs = CPU(cpu);
26
uint32_t excret;
27
uint32_t xpsr;
28
bool ufault = false;
29
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
30
((excret & R_V7M_EXCRET_ES_MASK) == 0 ||
31
(excret & R_V7M_EXCRET_DCRS_MASK) == 0)) {
32
uint32_t expected_sig = 0xfefa125b;
33
- uint32_t actual_sig = ldl_phys(cs->as, frameptr);
34
+ uint32_t actual_sig;
35
36
- if (expected_sig != actual_sig) {
37
+ pop_ok = v7m_stack_read(cpu, &actual_sig, frameptr, mmu_idx);
38
+
39
+ if (pop_ok && expected_sig != actual_sig) {
40
/* Take a SecureFault on the current stack */
41
env->v7m.sfsr |= R_V7M_SFSR_INVIS_MASK;
42
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false);
43
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
44
return;
45
}
46
47
- pop_ok =
48
+ pop_ok = pop_ok &&
49
v7m_stack_read(cpu, &env->regs[4], frameptr + 0x8, mmu_idx) &&
50
v7m_stack_read(cpu, &env->regs[4], frameptr + 0x8, mmu_idx) &&
51
v7m_stack_read(cpu, &env->regs[5], frameptr + 0xc, mmu_idx) &&
52
--
53
2.17.0
54
55
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
This eliminates the need for fetching it from el_change_hook_opaque, and
3
We missed all of the scalar fp16 fma operations.
4
allows for supporting multiple el_change_hooks without having to hack
5
something together to find the registered opaque belonging to GICv3.
6
4
7
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
5
Cc: qemu-stable@nongnu.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 1523997485-1905-6-git-send-email-alindsay@codeaurora.org
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20180512003217.9105-8-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
target/arm/cpu.h | 10 ----------
12
target/arm/translate-a64.c | 48 ++++++++++++++++++++++++++++++++++++++
13
hw/intc/arm_gicv3_cpuif.c | 10 ++--------
13
1 file changed, 48 insertions(+)
14
2 files changed, 2 insertions(+), 18 deletions(-)
15
14
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
17
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
17
--- a/target/arm/translate-a64.c
19
+++ b/target/arm/cpu.h
18
+++ b/target/arm/translate-a64.c
20
@@ -XXX,XX +XXX,XX @@ static inline AddressSpace *arm_addressspace(CPUState *cs, MemTxAttrs attrs)
19
@@ -XXX,XX +XXX,XX @@ static void handle_fp_3src_double(DisasContext *s, bool o0, bool o1,
21
void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHook *hook,
20
tcg_temp_free_i64(tcg_res);
22
void *opaque);
23
24
-/**
25
- * arm_get_el_change_hook_opaque:
26
- * Return the opaque data that will be used by the el_change_hook
27
- * for this CPU.
28
- */
29
-static inline void *arm_get_el_change_hook_opaque(ARMCPU *cpu)
30
-{
31
- return cpu->el_change_hook_opaque;
32
-}
33
-
34
/**
35
* aa32_vfp_dreg:
36
* Return a pointer to the Dn register within env in 32-bit mode.
37
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/intc/arm_gicv3_cpuif.c
40
+++ b/hw/intc/arm_gicv3_cpuif.c
41
@@ -XXX,XX +XXX,XX @@ void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s)
42
43
static GICv3CPUState *icc_cs_from_env(CPUARMState *env)
44
{
45
- /* Given the CPU, find the right GICv3CPUState struct.
46
- * Since we registered the CPU interface with the EL change hook as
47
- * the opaque pointer, we can just directly get from the CPU to it.
48
- */
49
- return arm_get_el_change_hook_opaque(arm_env_get_cpu(env));
50
+ return env->gicv3state;
51
}
21
}
52
22
53
static bool gicv3_use_ns_bank(CPUARMState *env)
23
+/* Floating-point data-processing (3 source) - half precision */
54
@@ -XXX,XX +XXX,XX @@ void gicv3_init_cpuif(GICv3State *s)
24
+static void handle_fp_3src_half(DisasContext *s, bool o0, bool o1,
55
* it might be with code translated by CPU 0 but run by CPU 1, in
25
+ int rd, int rn, int rm, int ra)
56
* which case we'd get the wrong value.
26
+{
57
* So instead we define the regs with no ri->opaque info, and
27
+ TCGv_i32 tcg_op1, tcg_op2, tcg_op3;
58
- * get back to the GICv3CPUState from the ARMCPU by reading back
28
+ TCGv_i32 tcg_res = tcg_temp_new_i32();
59
- * the opaque pointer from the el_change_hook, which we're going
29
+ TCGv_ptr fpst = get_fpstatus_ptr(true);
60
- * to need to register anyway.
30
+
61
+ * get back to the GICv3CPUState from the CPUARMState.
31
+ tcg_op1 = read_fp_hreg(s, rn);
62
*/
32
+ tcg_op2 = read_fp_hreg(s, rm);
63
define_arm_cp_regs(cpu, gicv3_cpuif_reginfo);
33
+ tcg_op3 = read_fp_hreg(s, ra);
64
if (arm_feature(&cpu->env, ARM_FEATURE_EL2)
34
+
35
+ /* These are fused multiply-add, and must be done as one
36
+ * floating point operation with no rounding between the
37
+ * multiplication and addition steps.
38
+ * NB that doing the negations here as separate steps is
39
+ * correct : an input NaN should come out with its sign bit
40
+ * flipped if it is a negated-input.
41
+ */
42
+ if (o1 == true) {
43
+ tcg_gen_xori_i32(tcg_op3, tcg_op3, 0x8000);
44
+ }
45
+
46
+ if (o0 != o1) {
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);
59
+}
60
+
61
/* Floating point data-processing (3 source)
62
* 31 30 29 28 24 23 22 21 20 16 15 14 10 9 5 4 0
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
}
65
--
81
--
66
2.17.0
82
2.17.0
67
83
68
84
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
This is in preparation for enabling counters other than PMCCNTR
3
These where missed out from the rest of the half-precision work.
4
4
5
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
5
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 1523997485-1905-5-git-send-email-alindsay@codeaurora.org
7
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20180512003217.9105-9-richard.henderson@linaro.org
11
[rth: Diagnose lack of FP16 before fp_access_check]
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
14
---
10
target/arm/helper.c | 31 ++++++++++++++++++++++---------
15
target/arm/helper-a64.h | 2 +
11
1 file changed, 22 insertions(+), 9 deletions(-)
16
target/arm/helper-a64.c | 10 +++++
12
17
target/arm/translate-a64.c | 88 ++++++++++++++++++++++++++++++--------
13
diff --git a/target/arm/helper.c b/target/arm/helper.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
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
22
--- a/target/arm/helper-a64.h
16
+++ b/target/arm/helper.c
23
+++ b/target/arm/helper-a64.h
17
@@ -XXX,XX +XXX,XX @@ typedef struct V8M_SAttributes {
24
@@ -XXX,XX +XXX,XX @@
18
static void v8m_security_lookup(CPUARMState *env, uint32_t address,
25
DEF_HELPER_FLAGS_2(udiv64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
19
MMUAccessType access_type, ARMMMUIdx mmu_idx,
26
DEF_HELPER_FLAGS_2(sdiv64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
20
V8M_SAttributes *sattrs);
27
DEF_HELPER_FLAGS_1(rbit64, TCG_CALL_NO_RWG_SE, i64, i64)
21
-
28
+DEF_HELPER_3(vfp_cmph_a64, i64, f16, f16, ptr)
22
-/* Definitions for the PMCCNTR and PMCR registers */
29
+DEF_HELPER_3(vfp_cmpeh_a64, i64, f16, f16, ptr)
23
-#define PMCRD 0x8
30
DEF_HELPER_3(vfp_cmps_a64, i64, f32, f32, ptr)
24
-#define PMCRC 0x4
31
DEF_HELPER_3(vfp_cmpes_a64, i64, f32, f32, ptr)
25
-#define PMCRE 0x1
32
DEF_HELPER_3(vfp_cmpd_a64, i64, f64, f64, ptr)
26
#endif
33
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
27
34
index XXXXXXX..XXXXXXX 100644
28
static int vfp_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg)
35
--- a/target/arm/helper-a64.c
29
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
36
+++ b/target/arm/helper-a64.c
30
REGINFO_SENTINEL
37
@@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res)
31
};
38
return flags;
32
39
}
33
+/* Definitions for the PMU registers */
40
34
+#define PMCRN_MASK 0xf800
41
+uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status)
35
+#define PMCRN_SHIFT 11
36
+#define PMCRD 0x8
37
+#define PMCRC 0x4
38
+#define PMCRE 0x1
39
+
40
+static inline uint32_t pmu_num_counters(CPUARMState *env)
41
+{
42
+{
42
+ return (env->cp15.c9_pmcr & PMCRN_MASK) >> PMCRN_SHIFT;
43
+ return float_rel_to_flags(float16_compare_quiet(x, y, fp_status));
43
+}
44
+}
44
+
45
+
45
+/* Bits allowed to be set/cleared for PMCNTEN* and PMINTEN* */
46
+uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status)
46
+static inline uint64_t pmu_counter_mask(CPUARMState *env)
47
+{
47
+{
48
+ return (1 << 31) | ((1 << pmu_num_counters(env)) - 1);
48
+ return float_rel_to_flags(float16_compare(x, y, fp_status));
49
+}
49
+}
50
+
50
+
51
static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri,
51
uint64_t HELPER(vfp_cmps_a64)(float32 x, float32 y, void *fp_status)
52
bool isread)
53
{
52
{
54
@@ -XXX,XX +XXX,XX @@ static void pmccfiltr_write(CPUARMState *env, const ARMCPRegInfo *ri,
53
return float_rel_to_flags(float32_compare_quiet(x, y, fp_status));
55
static void pmcntenset_write(CPUARMState *env, const ARMCPRegInfo *ri,
54
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
56
uint64_t value)
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/translate-a64.c
57
+++ b/target/arm/translate-a64.c
58
@@ -XXX,XX +XXX,XX @@ static void disas_data_proc_reg(DisasContext *s, uint32_t insn)
59
}
60
}
61
62
-static void handle_fp_compare(DisasContext *s, bool is_double,
63
+static void handle_fp_compare(DisasContext *s, int size,
64
unsigned int rn, unsigned int rm,
65
bool cmp_with_zero, bool signal_all_nans)
57
{
66
{
58
- value &= (1 << 31);
67
TCGv_i64 tcg_flags = tcg_temp_new_i64();
59
+ value &= pmu_counter_mask(env);
68
- TCGv_ptr fpst = get_fpstatus_ptr(false);
60
env->cp15.c9_pmcnten |= value;
69
+ TCGv_ptr fpst = get_fpstatus_ptr(size == MO_16);
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);
61
}
164
}
62
165
63
static void pmcntenclr_write(CPUARMState *env, const ARMCPRegInfo *ri,
166
/* Floating point conditional compare
64
uint64_t value)
167
@@ -XXX,XX +XXX,XX @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn)
65
{
168
unsigned int mos, type, rm, cond, rn, op, nzcv;
66
- value &= (1 << 31);
169
TCGv_i64 tcg_flags;
67
+ value &= pmu_counter_mask(env);
170
TCGLabel *label_continue = NULL;
68
env->cp15.c9_pmcnten &= ~value;
171
+ int size;
69
}
172
70
173
mos = extract32(insn, 29, 3);
71
@@ -XXX,XX +XXX,XX @@ static void pmintenset_write(CPUARMState *env, const ARMCPRegInfo *ri,
174
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
72
uint64_t value)
175
+ type = extract32(insn, 22, 2);
73
{
176
rm = extract32(insn, 16, 5);
74
/* We have no event counters so only the C bit can be changed */
177
cond = extract32(insn, 12, 4);
75
- value &= (1 << 31);
178
rn = extract32(insn, 5, 5);
76
+ value &= pmu_counter_mask(env);
179
op = extract32(insn, 4, 1);
77
env->cp15.c9_pminten |= value;
180
nzcv = extract32(insn, 0, 4);
78
}
181
79
182
- if (mos || type > 1) {
80
static void pmintenclr_write(CPUARMState *env, const ARMCPRegInfo *ri,
183
+ if (mos) {
81
uint64_t value)
184
+ unallocated_encoding(s);
82
{
185
+ return;
83
- value &= (1 << 31);
186
+ }
84
+ value &= pmu_counter_mask(env);
187
+
85
env->cp15.c9_pminten &= ~value;
188
+ switch (type) {
86
}
189
+ case 0:
87
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);
88
--
214
--
89
2.17.0
215
2.17.0
90
216
91
217
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
They share the same underlying state
3
These were missed out from the rest of the half-precision work.
4
4
5
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
5
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 1523997485-1905-3-git-send-email-alindsay@codeaurora.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>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
14
---
10
target/arm/helper.c | 2 +-
15
target/arm/translate-a64.c | 31 +++++++++++++++++++++++++------
11
1 file changed, 1 insertion(+), 1 deletion(-)
16
1 file changed, 25 insertions(+), 6 deletions(-)
12
17
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
14
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
20
--- a/target/arm/translate-a64.c
16
+++ b/target/arm/helper.c
21
+++ b/target/arm/translate-a64.c
17
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
22
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
18
.fieldoffset = offsetof(CPUARMState, cp15.c9_pmselr),
23
unsigned int mos, type, rm, cond, rn, rd;
19
.writefn = pmselr_write, .raw_writefn = raw_write, },
24
TCGv_i64 t_true, t_false, t_zero;
20
{ .name = "PMCCNTR", .cp = 15, .crn = 9, .crm = 13, .opc1 = 0, .opc2 = 0,
25
DisasCompare64 c;
21
- .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_IO,
26
+ TCGMemOp sz;
22
+ .access = PL0_RW, .resetvalue = 0, .type = ARM_CP_ALIAS | ARM_CP_IO,
27
23
.readfn = pmccntr_read, .writefn = pmccntr_write32,
28
mos = extract32(insn, 29, 3);
24
.accessfn = pmreg_access_ccntr },
29
- type = extract32(insn, 22, 2); /* 0 = single, 1 = double */
25
{ .name = "PMCCNTR_EL0", .state = ARM_CP_STATE_AA64,
30
+ type = extract32(insn, 22, 2);
31
rm = extract32(insn, 16, 5);
32
cond = extract32(insn, 12, 4);
33
rn = extract32(insn, 5, 5);
34
rd = extract32(insn, 0, 5);
35
36
- if (mos || type > 1) {
37
+ if (mos) {
38
+ unallocated_encoding(s);
39
+ return;
40
+ }
41
+
42
+ switch (type) {
43
+ case 0:
44
+ sz = MO_32;
45
+ break;
46
+ case 1:
47
+ sz = MO_64;
48
+ break;
49
+ case 3:
50
+ sz = MO_16;
51
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
52
+ break;
53
+ }
54
+ /* fallthru */
55
+ default:
56
unallocated_encoding(s);
57
return;
58
}
59
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
60
return;
61
}
62
63
- /* Zero extend sreg inputs to 64 bits now. */
64
+ /* Zero extend sreg & hreg inputs to 64 bits now. */
65
t_true = tcg_temp_new_i64();
66
t_false = tcg_temp_new_i64();
67
- read_vec_element(s, t_true, rn, 0, type ? MO_64 : MO_32);
68
- read_vec_element(s, t_false, rm, 0, type ? MO_64 : MO_32);
69
+ read_vec_element(s, t_true, rn, 0, sz);
70
+ read_vec_element(s, t_false, rm, 0, sz);
71
72
a64_test_cc(&c, cond);
73
t_zero = tcg_const_i64(0);
74
@@ -XXX,XX +XXX,XX @@ static void disas_fp_csel(DisasContext *s, uint32_t insn)
75
tcg_temp_free_i64(t_false);
76
a64_free_cc(&c);
77
78
- /* Note that sregs write back zeros to the high bits,
79
+ /* Note that sregs & hregs write back zeros to the high bits,
80
and we've already done the zero-extension. */
81
write_fp_dreg(s, rd, t_true);
82
tcg_temp_free_i64(t_true);
26
--
83
--
27
2.17.0
84
2.17.0
28
85
29
86
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Because the design of the PMU requires that the counter values be
3
All the hard work is already done by vfp_expand_imm, we just need to
4
converted between their delta and guest-visible forms for mode
4
make sure we pick up the correct size.
5
filtering, an additional hook which occurs before the EL is changed is
6
necessary.
7
5
8
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
6
Cc: qemu-stable@nongnu.org
9
Message-id: 1523997485-1905-8-git-send-email-alindsay@codeaurora.org
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
9
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20180512003217.9105-11-richard.henderson@linaro.org
12
[rth: Merge unallocated_encoding check with TCGMemOp conversion.]
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
15
---
13
target/arm/cpu.h | 22 +++++++++++++++++++---
16
target/arm/translate-a64.c | 20 +++++++++++++++++---
14
target/arm/internals.h | 7 +++++++
17
1 file changed, 17 insertions(+), 3 deletions(-)
15
target/arm/cpu.c | 16 ++++++++++++++++
16
target/arm/helper.c | 14 ++++++++------
17
target/arm/op_helper.c | 8 ++++++++
18
5 files changed, 58 insertions(+), 9 deletions(-)
19
18
20
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
19
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
21
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/cpu.h
21
--- a/target/arm/translate-a64.c
23
+++ b/target/arm/cpu.h
22
+++ b/target/arm/translate-a64.c
24
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
23
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
25
*/
26
bool cfgend;
27
28
+ QLIST_HEAD(, ARMELChangeHook) pre_el_change_hooks;
29
QLIST_HEAD(, ARMELChangeHook) el_change_hooks;
30
31
int32_t node_id; /* NUMA node this CPU belongs to */
32
@@ -XXX,XX +XXX,XX @@ static inline AddressSpace *arm_addressspace(CPUState *cs, MemTxAttrs attrs)
33
#endif
34
35
/**
36
- * arm_register_el_change_hook:
37
- * Register a hook function which will be called back whenever this
38
+ * arm_register_pre_el_change_hook:
39
+ * Register a hook function which will be called immediately before this
40
* CPU changes exception level or mode. The hook function will be
41
* passed a pointer to the ARMCPU and the opaque data pointer passed
42
* to this function when the hook was registered.
43
+ *
44
+ * Note that if a pre-change hook is called, any registered post-change hooks
45
+ * are guaranteed to subsequently be called.
46
*/
47
-void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
48
+void arm_register_pre_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
49
void *opaque);
50
+/**
51
+ * arm_register_el_change_hook:
52
+ * Register a hook function which will be called immediately after this
53
+ * CPU changes exception level or mode. The hook function will be
54
+ * passed a pointer to the ARMCPU and the opaque data pointer passed
55
+ * to this function when the hook was registered.
56
+ *
57
+ * Note that any registered hooks registered here are guaranteed to be called
58
+ * if pre-change hooks have been.
59
+ */
60
+void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, void
61
+ *opaque);
62
63
/**
64
* aa32_vfp_dreg:
65
diff --git a/target/arm/internals.h b/target/arm/internals.h
66
index XXXXXXX..XXXXXXX 100644
67
--- a/target/arm/internals.h
68
+++ b/target/arm/internals.h
69
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
70
MemTxResult response, uintptr_t retaddr);
71
72
/* Call any registered EL change hooks */
73
+static inline void arm_call_pre_el_change_hook(ARMCPU *cpu)
74
+{
75
+ ARMELChangeHook *hook, *next;
76
+ QLIST_FOREACH_SAFE(hook, &cpu->pre_el_change_hooks, node, next) {
77
+ hook->hook(cpu, hook->opaque);
78
+ }
79
+}
80
static inline void arm_call_el_change_hook(ARMCPU *cpu)
81
{
24
{
82
ARMELChangeHook *hook, *next;
25
int rd = extract32(insn, 0, 5);
83
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
26
int imm8 = extract32(insn, 13, 8);
84
index XXXXXXX..XXXXXXX 100644
27
- int is_double = extract32(insn, 22, 2);
85
--- a/target/arm/cpu.c
28
+ int type = extract32(insn, 22, 2);
86
+++ b/target/arm/cpu.c
29
uint64_t imm;
87
@@ -XXX,XX +XXX,XX @@ static bool arm_cpu_has_work(CPUState *cs)
30
TCGv_i64 tcg_res;
88
| CPU_INTERRUPT_EXITTB);
31
+ TCGMemOp sz;
89
}
32
90
33
- if (is_double > 1) {
91
+void arm_register_pre_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
34
+ switch (type) {
92
+ void *opaque)
35
+ case 0:
93
+{
36
+ sz = MO_32;
94
+ ARMELChangeHook *entry = g_new0(ARMELChangeHook, 1);
37
+ break;
95
+
38
+ case 1:
96
+ entry->hook = hook;
39
+ sz = MO_64;
97
+ entry->opaque = opaque;
40
+ break;
98
+
41
+ case 3:
99
+ QLIST_INSERT_HEAD(&cpu->pre_el_change_hooks, entry, node);
42
+ sz = MO_16;
100
+}
43
+ if (arm_dc_feature(s, ARM_FEATURE_V8_FP16)) {
101
+
44
+ break;
102
void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
45
+ }
103
void *opaque)
46
+ /* fallthru */
104
{
47
+ default:
105
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj)
48
unallocated_encoding(s);
106
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
107
g_free, g_free);
108
109
+ QLIST_INIT(&cpu->pre_el_change_hooks);
110
QLIST_INIT(&cpu->el_change_hooks);
111
112
#ifndef CONFIG_USER_ONLY
113
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_finalizefn(Object *obj)
114
115
g_hash_table_destroy(cpu->cp_regs);
116
117
+ QLIST_FOREACH_SAFE(hook, &cpu->pre_el_change_hooks, node, next) {
118
+ QLIST_REMOVE(hook, node);
119
+ g_free(hook);
120
+ }
121
QLIST_FOREACH_SAFE(hook, &cpu->el_change_hooks, node, next) {
122
QLIST_REMOVE(hook, node);
123
g_free(hook);
124
diff --git a/target/arm/helper.c b/target/arm/helper.c
125
index XXXXXXX..XXXXXXX 100644
126
--- a/target/arm/helper.c
127
+++ b/target/arm/helper.c
128
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
129
return;
49
return;
130
}
50
}
131
51
@@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn)
132
+ /* Hooks may change global state so BQL should be held, also the
52
return;
133
+ * BQL needs to be held for any modification of
134
+ * cs->interrupt_request.
135
+ */
136
+ g_assert(qemu_mutex_iothread_locked());
137
+
138
+ arm_call_pre_el_change_hook(cpu);
139
+
140
assert(!excp_is_internal(cs->exception_index));
141
if (arm_el_is_aa64(env, new_el)) {
142
arm_cpu_do_interrupt_aarch64(cs);
143
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
144
arm_cpu_do_interrupt_aarch32(cs);
145
}
53
}
146
54
147
- /* Hooks may change global state so BQL should be held, also the
55
- imm = vfp_expand_imm(MO_32 + is_double, imm8);
148
- * BQL needs to be held for any modification of
56
+ imm = vfp_expand_imm(sz, imm8);
149
- * cs->interrupt_request.
57
150
- */
58
tcg_res = tcg_const_i64(imm);
151
- g_assert(qemu_mutex_iothread_locked());
59
write_fp_dreg(s, rd, tcg_res);
152
-
153
arm_call_el_change_hook(cpu);
154
155
if (!kvm_enabled()) {
156
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
157
index XXXXXXX..XXXXXXX 100644
158
--- a/target/arm/op_helper.c
159
+++ b/target/arm/op_helper.c
160
@@ -XXX,XX +XXX,XX @@ void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask)
161
/* Write the CPSR for a 32-bit exception return */
162
void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t val)
163
{
164
+ qemu_mutex_lock_iothread();
165
+ arm_call_pre_el_change_hook(arm_env_get_cpu(env));
166
+ qemu_mutex_unlock_iothread();
167
+
168
cpsr_write(env, val, CPSR_ERET_MASK, CPSRWriteExceptionReturn);
169
170
/* Generated code has already stored the new PC value, but
171
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env)
172
goto illegal_return;
173
}
174
175
+ qemu_mutex_lock_iothread();
176
+ arm_call_pre_el_change_hook(arm_env_get_cpu(env));
177
+ qemu_mutex_unlock_iothread();
178
+
179
if (!return_to_aa64) {
180
env->aarch64 = 0;
181
/* We do a raw CPSR write because aarch64_sync_64_to_32()
182
--
60
--
183
2.17.0
61
2.17.0
184
62
185
63
diff view generated by jsdifflib
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
SNOOP_NONE state handle is moved above in the if ladder, as it's same
3
We are meant to explicitly pass fpst, not cpu_env.
4
as SNOOP_STRIPPING during data cycles.
5
4
6
Signed-off-by: Sai Pavan Boddu <saipava@xilinx.com>
5
Cc: qemu-stable@nongnu.org
7
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 1524119244-1240-1-git-send-email-saipava@xilinx.com
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
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
12
---
11
hw/ssi/xilinx_spips.c | 3 ++-
13
target/arm/translate-a64.c | 3 ++-
12
1 file changed, 2 insertions(+), 1 deletion(-)
14
1 file changed, 2 insertions(+), 1 deletion(-)
13
15
14
diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
16
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/ssi/xilinx_spips.c
18
--- a/target/arm/translate-a64.c
17
+++ b/hw/ssi/xilinx_spips.c
19
+++ b/target/arm/translate-a64.c
18
@@ -XXX,XX +XXX,XX @@ static void xilinx_spips_flush_txfifo(XilinxSPIPS *s)
20
@@ -XXX,XX +XXX,XX @@ static void handle_fp_1src_half(DisasContext *s, int opcode, int rd, int rn)
19
if (fifo8_is_empty(&s->tx_fifo)) {
21
tcg_gen_xori_i32(tcg_res, tcg_op, 0x8000);
20
xilinx_spips_update_ixr(s);
22
break;
21
return;
23
case 0x3: /* FSQRT */
22
- } else if (s->snoop_state == SNOOP_STRIPING) {
24
- gen_helper_sqrt_f16(tcg_res, tcg_op, cpu_env);
23
+ } else if (s->snoop_state == SNOOP_STRIPING ||
25
+ fpst = get_fpstatus_ptr(true);
24
+ s->snoop_state == SNOOP_NONE) {
26
+ gen_helper_sqrt_f16(tcg_res, tcg_op, fpst);
25
for (i = 0; i < num_effective_busses(s); ++i) {
27
break;
26
tx_rx[i] = fifo8_pop(&s->tx_fifo);
28
case 0x8: /* FRINTN */
27
}
29
case 0x9: /* FRINTP */
28
--
30
--
29
2.17.0
31
2.17.0
30
32
31
33
diff view generated by jsdifflib
1
From: Aaron Lindsay <alindsay@codeaurora.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
It was shifted to the left one bit too few.
3
Per the Physical Layer Simplified Spec. "4.3.10.4 Switch Function Status":
4
4
5
Signed-off-by: Aaron Lindsay <alindsay@codeaurora.org>
5
The block length is predefined to 512 bits
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
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 1523997485-1905-10-git-send-email-alindsay@codeaurora.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
20
---
10
target/arm/helper.c | 2 +-
21
hw/sd/sd.c | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
22
1 file changed, 1 insertion(+), 1 deletion(-)
12
23
13
diff --git a/target/arm/helper.c b/target/arm/helper.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/target/arm/helper.c
26
--- a/hw/sd/sd.c
16
+++ b/target/arm/helper.c
27
+++ b/hw/sd/sd.c
17
@@ -XXX,XX +XXX,XX @@ static void pmccfiltr_write(CPUARMState *env, const ARMCPRegInfo *ri,
28
@@ -XXX,XX +XXX,XX @@ static void sd_function_switch(SDState *sd, uint32_t arg)
18
uint64_t value)
29
sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
19
{
30
}
20
pmccntr_sync(env);
31
memset(&sd->data[17], 0, 47);
21
- env->cp15.pmccfiltr_el0 = value & 0x7E000000;
32
- stw_be_p(sd->data + 65, sd_crc16(sd->data, 64));
22
+ env->cp15.pmccfiltr_el0 = value & 0xfc000000;
33
+ stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));
23
pmccntr_sync(env);
24
}
34
}
25
35
36
static inline bool sd_wp_addr(SDState *sd, uint64_t addr)
26
--
37
--
27
2.17.0
38
2.17.0
28
39
29
40
diff view generated by jsdifflib
Deleted patch
1
In commit 210f47840dd62, we changed the bcm2836 SoC object to
2
always create a CPU of the correct type for that SoC model. This
3
makes the default_cpu_type settings in the MachineClass structs
4
for the raspi2 and raspi3 boards redundant. We didn't change
5
those at the time because it would have meant a temporary
6
regression in a corner case of error handling if the user
7
requested a non-existing CPU type. The -cpu parse handling
8
changes in 2278b93941d42c3 mean that it no longer implicitly
9
depends on default_cpu_type for this to work, so we can now
10
delete the redundant default_cpu_type fields.
11
1
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-id: 20180420155547.9497-1-peter.maydell@linaro.org
15
---
16
hw/arm/raspi.c | 2 --
17
1 file changed, 2 deletions(-)
18
19
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/raspi.c
22
+++ b/hw/arm/raspi.c
23
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
24
mc->no_parallel = 1;
25
mc->no_floppy = 1;
26
mc->no_cdrom = 1;
27
- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7");
28
mc->max_cpus = BCM283X_NCPUS;
29
mc->min_cpus = BCM283X_NCPUS;
30
mc->default_cpus = BCM283X_NCPUS;
31
@@ -XXX,XX +XXX,XX @@ static void raspi3_machine_init(MachineClass *mc)
32
mc->no_parallel = 1;
33
mc->no_floppy = 1;
34
mc->no_cdrom = 1;
35
- mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
36
mc->max_cpus = BCM283X_NCPUS;
37
mc->min_cpus = BCM283X_NCPUS;
38
mc->default_cpus = BCM283X_NCPUS;
39
--
40
2.17.0
41
42
diff view generated by jsdifflib
Deleted patch
1
Currently we use memory_region_init_ram_nomigrate() to create
2
the "highbank.sysram" memory region, and we don't manually
3
register it with vmstate_register_ram(). This currently
4
means that its contents are migrated but as a ram block
5
whose name is the empty string; in future it may mean they
6
are not migrated at all. Use memory_region_init_ram() instead.
7
1
8
Note that this is a cross-version migration compatibility
9
break for the "highbank" and "midway" machines.
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 20180420124835.7268-2-peter.maydell@linaro.org
13
---
14
hw/arm/highbank.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/highbank.c
20
+++ b/hw/arm/highbank.c
21
@@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
22
memory_region_add_subregion(sysmem, 0, dram);
23
24
sysram = g_new(MemoryRegion, 1);
25
- memory_region_init_ram_nomigrate(sysram, NULL, "highbank.sysram", 0x8000,
26
+ memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000,
27
&error_fatal);
28
memory_region_add_subregion(sysmem, 0xfff88000, sysram);
29
if (bios_name != NULL) {
30
--
31
2.17.0
32
33
diff view generated by jsdifflib
1
Currently we use memory_region_init_ram_nomigrate() to create
1
Usually the logging of the CPU state produced by -d cpu is sufficient
2
the "aspeed.boot_rom" memory region, and we don't manually
2
to diagnose problems, but sometimes you want to see the state of
3
register it with vmstate_register_ram(). This currently
3
the floating point registers as well. We don't want to enable that
4
means that its contents are migrated but as a ram block
4
by default as it adds a lot of extra data to the log; instead,
5
whose name is the empty string; in future it may mean they
5
allow it to be optionally enabled via -d fpu.
6
are not migrated at all. Use memory_region_init_ram() instead.
7
8
Note that would be a cross-version migration compatibility break
9
for the "palmetto-bmc", "ast2500-evb" and "romulus-bmc" machines,
10
but migration is currently broken for them.
11
6
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Tested-by: Cédric Le Goater <clg@kaod.org>
9
Message-id: 20180510130024.31678-1-peter.maydell@linaro.org
15
Message-id: 20180420124835.7268-3-peter.maydell@linaro.org
16
---
10
---
17
hw/arm/aspeed.c | 2 +-
11
include/qemu/log.h | 1 +
18
1 file changed, 1 insertion(+), 1 deletion(-)
12
accel/tcg/cpu-exec.c | 9 ++++++---
13
util/log.c | 2 ++
14
3 files changed, 9 insertions(+), 3 deletions(-)
19
15
20
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
16
diff --git a/include/qemu/log.h b/include/qemu/log.h
21
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/aspeed.c
18
--- a/include/qemu/log.h
23
+++ b/hw/arm/aspeed.c
19
+++ b/include/qemu/log.h
24
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
20
@@ -XXX,XX +XXX,XX @@ static inline bool qemu_log_separate(void)
25
* SoC and 128MB for the AST2500 SoC, which is twice as big as
21
#define CPU_LOG_PAGE (1 << 14)
26
* needed by the flash modules of the Aspeed machines.
22
/* LOG_TRACE (1 << 15) is defined in log-for-trace.h */
27
*/
23
#define CPU_LOG_TB_OP_IND (1 << 16)
28
- memory_region_init_rom_nomigrate(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
24
+#define CPU_LOG_TB_FPU (1 << 17)
29
+ memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
25
30
fl->size, &error_abort);
26
/* Lock output for a series of related logs. Since this is not needed
31
memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
27
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
32
boot_rom);
28
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/accel/tcg/cpu-exec.c
31
+++ b/accel/tcg/cpu-exec.c
32
@@ -XXX,XX +XXX,XX @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
33
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
34
&& qemu_log_in_addr_range(itb->pc)) {
35
qemu_log_lock();
36
+ int flags = 0;
37
+ if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
38
+ flags |= CPU_DUMP_FPU;
39
+ }
40
#if defined(TARGET_I386)
41
- log_cpu_state(cpu, CPU_DUMP_CCOP);
42
-#else
43
- log_cpu_state(cpu, 0);
44
+ flags |= CPU_DUMP_CCOP;
45
#endif
46
+ log_cpu_state(cpu, flags);
47
qemu_log_unlock();
48
}
49
#endif /* DEBUG_DISAS */
50
diff --git a/util/log.c b/util/log.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/util/log.c
53
+++ b/util/log.c
54
@@ -XXX,XX +XXX,XX @@ const QEMULogItem qemu_log_items[] = {
55
"show trace before each executed TB (lots of logs)" },
56
{ CPU_LOG_TB_CPU, "cpu",
57
"show CPU registers before entering a TB (lots of logs)" },
58
+ { CPU_LOG_TB_FPU, "fpu",
59
+ "include FPU registers in the 'cpu' logging" },
60
{ CPU_LOG_MMU, "mmu",
61
"log MMU-related activities" },
62
{ CPU_LOG_PCALL, "pcall",
33
--
63
--
34
2.17.0
64
2.17.0
35
65
36
66
diff view generated by jsdifflib