1
target-arm queue. The big thing here is the landing of the 3-phase
1
I don't have anything else queued up at the moment, so this is just
2
reset patches...
2
Richard's SME patches.
3
3
4
-- PMM
4
-- PMM
5
5
6
The following changes since commit 204aa60b37c23a89e690d418f49787d274303ca7:
6
The following changes since commit 63b38f6c85acd312c2cab68554abf33adf4ee2b3:
7
7
8
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-jan-29-2020' into staging (2020-01-30 14:18:45 +0000)
8
Merge tag 'pull-target-arm-20220707' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-07-08 06:17:11 +0530)
9
9
10
are available in the Git repository at:
10
are available in the Git repository at:
11
11
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200130
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220711
13
13
14
for you to fetch changes up to dea101a1ae9968c9fec6ab0291489dad7c49f36f:
14
for you to fetch changes up to f9982ceaf26df27d15547a3a7990a95019e9e3a8:
15
15
16
target/arm/cpu: Add the kvm-no-adjvtime CPU property (2020-01-30 16:02:06 +0000)
16
linux-user/aarch64: Add SME related hwcap entries (2022-07-11 13:43:52 +0100)
17
17
18
----------------------------------------------------------------
18
----------------------------------------------------------------
19
target-arm queue:
19
target-arm:
20
* hw/core/or-irq: Fix incorrect assert forbidding num-lines == MAX_OR_LINES
20
* Implement SME emulation, for both system and linux-user
21
* target/arm/arm-semi: Don't let the guest close stdin/stdout/stderr
22
* aspeed: some minor bugfixes
23
* aspeed: add eMMC controller model for AST2600 SoC
24
* hw/arm/raspi: Remove obsolete use of -smp to set the soc 'enabled-cpus'
25
* New 3-phase reset API for device models
26
* hw/intc/arm_gicv3_kvm: Stop wrongly programming GICR_PENDBASER.PTZ bit
27
* Arm KVM: stop/restart the guest counter when the VM is stopped and started
28
21
29
----------------------------------------------------------------
22
----------------------------------------------------------------
30
Andrew Jeffery (2):
23
Richard Henderson (45):
31
hw/sd: Configure number of slots exposed by the ASPEED SDHCI model
24
target/arm: Handle SME in aarch64_cpu_dump_state
32
hw/arm: ast2600: Wire up the eMMC controller
25
target/arm: Add infrastructure for disas_sme
26
target/arm: Trap non-streaming usage when Streaming SVE is active
27
target/arm: Mark ADR as non-streaming
28
target/arm: Mark RDFFR, WRFFR, SETFFR as non-streaming
29
target/arm: Mark BDEP, BEXT, BGRP, COMPACT, FEXPA, FTSSEL as non-streaming
30
target/arm: Mark PMULL, FMMLA as non-streaming
31
target/arm: Mark FTSMUL, FTMAD, FADDA as non-streaming
32
target/arm: Mark SMMLA, UMMLA, USMMLA as non-streaming
33
target/arm: Mark string/histo/crypto as non-streaming
34
target/arm: Mark gather/scatter load/store as non-streaming
35
target/arm: Mark gather prefetch as non-streaming
36
target/arm: Mark LDFF1 and LDNF1 as non-streaming
37
target/arm: Mark LD1RO as non-streaming
38
target/arm: Add SME enablement checks
39
target/arm: Handle SME in sve_access_check
40
target/arm: Implement SME RDSVL, ADDSVL, ADDSPL
41
target/arm: Implement SME ZERO
42
target/arm: Implement SME MOVA
43
target/arm: Implement SME LD1, ST1
44
target/arm: Export unpredicated ld/st from translate-sve.c
45
target/arm: Implement SME LDR, STR
46
target/arm: Implement SME ADDHA, ADDVA
47
target/arm: Implement FMOPA, FMOPS (non-widening)
48
target/arm: Implement BFMOPA, BFMOPS
49
target/arm: Implement FMOPA, FMOPS (widening)
50
target/arm: Implement SME integer outer product
51
target/arm: Implement PSEL
52
target/arm: Implement REVD
53
target/arm: Implement SCLAMP, UCLAMP
54
target/arm: Reset streaming sve state on exception boundaries
55
target/arm: Enable SME for -cpu max
56
linux-user/aarch64: Clear tpidr2_el0 if CLONE_SETTLS
57
linux-user/aarch64: Reset PSTATE.SM on syscalls
58
linux-user/aarch64: Add SM bit to SVE signal context
59
linux-user/aarch64: Tidy target_restore_sigframe error return
60
linux-user/aarch64: Do not allow duplicate or short sve records
61
linux-user/aarch64: Verify extra record lock succeeded
62
linux-user/aarch64: Move sve record checks into restore
63
linux-user/aarch64: Implement SME signal handling
64
linux-user: Rename sve prctls
65
linux-user/aarch64: Implement PR_SME_GET_VL, PR_SME_SET_VL
66
target/arm: Only set ZEN in reset if SVE present
67
target/arm: Enable SME for user-only
68
linux-user/aarch64: Add SME related hwcap entries
33
69
34
Andrew Jones (6):
70
docs/system/arm/emulation.rst | 4 +
35
target/arm/kvm: trivial: Clean up header documentation
71
linux-user/aarch64/target_cpu.h | 5 +-
36
hw/arm/virt: Add missing 5.0 options call to 4.2 options
72
linux-user/aarch64/target_prctl.h | 62 +-
37
target/arm/kvm64: kvm64 cpus have timer registers
73
target/arm/cpu.h | 7 +
38
tests/arm-cpu-features: Check feature default values
74
target/arm/helper-sme.h | 126 ++++
39
target/arm/kvm: Implement virtual time adjustment
75
target/arm/helper-sve.h | 4 +
40
target/arm/cpu: Add the kvm-no-adjvtime CPU property
76
target/arm/helper.h | 18 +
41
77
target/arm/translate-a64.h | 45 ++
42
Cédric Le Goater (2):
78
target/arm/translate.h | 16 +
43
ftgmac100: check RX and TX buffer alignment
79
target/arm/sme-fa64.decode | 60 ++
44
hw/arm/aspeed: add a 'execute-in-place' property to boot directly from CE0
80
target/arm/sme.decode | 88 +++
45
81
target/arm/sve.decode | 41 +-
46
Damien Hedde (11):
82
linux-user/aarch64/cpu_loop.c | 9 +
47
add device_legacy_reset function to prepare for reset api change
83
linux-user/aarch64/signal.c | 243 ++++++--
48
hw/core/qdev: add trace events to help with resettable transition
84
linux-user/elfload.c | 20 +
49
hw/core: create Resettable QOM interface
85
linux-user/syscall.c | 28 +-
50
hw/core: add Resettable support to BusClass and DeviceClass
86
target/arm/cpu.c | 35 +-
51
hw/core/resettable: add support for changing parent
87
target/arm/cpu64.c | 11 +
52
hw/core/qdev: handle parent bus change regarding resettable
88
target/arm/helper.c | 56 +-
53
hw/core/qdev: update hotplug reset regarding resettable
89
target/arm/sme_helper.c | 1140 +++++++++++++++++++++++++++++++++++++
54
hw/core: deprecate old reset functions and introduce new ones
90
target/arm/sve_helper.c | 28 +
55
docs/devel/reset.rst: add doc about Resettable interface
91
target/arm/translate-a64.c | 103 +++-
56
vl: replace deprecated qbus_reset_all registration
92
target/arm/translate-sme.c | 373 ++++++++++++
57
hw/s390x/ipl: replace deprecated qdev_reset_all registration
93
target/arm/translate-sve.c | 393 ++++++++++---
58
94
target/arm/translate-vfp.c | 12 +
59
Joel Stanley (1):
95
target/arm/translate.c | 2 +
60
misc/pca9552: Add qom set and get
96
target/arm/vec_helper.c | 24 +
61
97
target/arm/meson.build | 3 +
62
Peter Maydell (2):
98
28 files changed, 2821 insertions(+), 135 deletions(-)
63
hw/core/or-irq: Fix incorrect assert forbidding num-lines == MAX_OR_LINES
99
create mode 100644 target/arm/sme-fa64.decode
64
target/arm/arm-semi: Don't let the guest close stdin/stdout/stderr
100
create mode 100644 target/arm/sme.decode
65
101
create mode 100644 target/arm/translate-sme.c
66
Philippe Mathieu-Daudé (1):
67
hw/arm/raspi: Remove obsolete use of -smp to set the soc 'enabled-cpus'
68
69
Zenghui Yu (1):
70
hw/intc/arm_gicv3_kvm: Stop wrongly programming GICR_PENDBASER.PTZ bit
71
72
hw/core/Makefile.objs | 1 +
73
tests/Makefile.include | 1 +
74
include/hw/arm/aspeed.h | 2 +
75
include/hw/arm/aspeed_soc.h | 2 +
76
include/hw/arm/virt.h | 1 +
77
include/hw/qdev-core.h | 58 +++++++-
78
include/hw/resettable.h | 247 +++++++++++++++++++++++++++++++++
79
include/hw/sd/aspeed_sdhci.h | 1 +
80
target/arm/cpu.h | 7 +
81
target/arm/kvm_arm.h | 95 ++++++++++---
82
hw/arm/aspeed.c | 72 ++++++++--
83
hw/arm/aspeed_ast2600.c | 31 ++++-
84
hw/arm/aspeed_soc.c | 2 +
85
hw/arm/raspi.c | 2 -
86
hw/arm/virt.c | 9 ++
87
hw/audio/intel-hda.c | 2 +-
88
hw/core/bus.c | 102 ++++++++++++++
89
hw/core/or-irq.c | 2 +-
90
hw/core/qdev.c | 160 ++++++++++++++++++++--
91
hw/core/resettable.c | 301 +++++++++++++++++++++++++++++++++++++++++
92
hw/hyperv/hyperv.c | 2 +-
93
hw/i386/microvm.c | 2 +-
94
hw/i386/pc.c | 2 +-
95
hw/ide/microdrive.c | 8 +-
96
hw/intc/arm_gicv3_kvm.c | 11 +-
97
hw/intc/spapr_xive.c | 2 +-
98
hw/misc/pca9552.c | 90 ++++++++++++
99
hw/net/ftgmac100.c | 13 ++
100
hw/ppc/pnv_psi.c | 4 +-
101
hw/ppc/spapr_pci.c | 2 +-
102
hw/ppc/spapr_vio.c | 2 +-
103
hw/s390x/ipl.c | 10 +-
104
hw/s390x/s390-pci-inst.c | 2 +-
105
hw/scsi/vmw_pvscsi.c | 2 +-
106
hw/sd/aspeed_sdhci.c | 11 +-
107
hw/sd/omap_mmc.c | 2 +-
108
hw/sd/pl181.c | 2 +-
109
target/arm/arm-semi.c | 9 ++
110
target/arm/cpu.c | 2 +
111
target/arm/cpu64.c | 1 +
112
target/arm/kvm.c | 120 ++++++++++++++++
113
target/arm/kvm32.c | 3 +
114
target/arm/kvm64.c | 4 +
115
target/arm/machine.c | 7 +
116
target/arm/monitor.c | 1 +
117
tests/qtest/arm-cpu-features.c | 41 ++++--
118
vl.c | 10 +-
119
docs/arm-cpu-features.rst | 37 ++++-
120
docs/devel/index.rst | 1 +
121
docs/devel/reset.rst | 289 +++++++++++++++++++++++++++++++++++++++
122
hw/core/trace-events | 27 ++++
123
51 files changed, 1727 insertions(+), 90 deletions(-)
124
create mode 100644 include/hw/resettable.h
125
create mode 100644 hw/core/resettable.c
126
create mode 100644 docs/devel/reset.rst
127
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Dump SVCR, plus use the correct access check for Streaming Mode.
4
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220708151540.18136-2-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/cpu.c | 17 ++++++++++++++++-
11
1 file changed, 16 insertions(+), 1 deletion(-)
12
13
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/cpu.c
16
+++ b/target/arm/cpu.c
17
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
18
int i;
19
int el = arm_current_el(env);
20
const char *ns_status;
21
+ bool sve;
22
23
qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
24
for (i = 0; i < 32; i++) {
25
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
26
el,
27
psr & PSTATE_SP ? 'h' : 't');
28
29
+ if (cpu_isar_feature(aa64_sme, cpu)) {
30
+ qemu_fprintf(f, " SVCR=%08" PRIx64 " %c%c",
31
+ env->svcr,
32
+ (FIELD_EX64(env->svcr, SVCR, ZA) ? 'Z' : '-'),
33
+ (FIELD_EX64(env->svcr, SVCR, SM) ? 'S' : '-'));
34
+ }
35
if (cpu_isar_feature(aa64_bti, cpu)) {
36
qemu_fprintf(f, " BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
37
}
38
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
39
qemu_fprintf(f, " FPCR=%08x FPSR=%08x\n",
40
vfp_get_fpcr(env), vfp_get_fpsr(env));
41
42
- if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) {
43
+ if (cpu_isar_feature(aa64_sme, cpu) && FIELD_EX64(env->svcr, SVCR, SM)) {
44
+ sve = sme_exception_el(env, el) == 0;
45
+ } else if (cpu_isar_feature(aa64_sve, cpu)) {
46
+ sve = sve_exception_el(env, el) == 0;
47
+ } else {
48
+ sve = false;
49
+ }
50
+
51
+ if (sve) {
52
int j, zcr_len = sve_vqm1_for_el(env, el);
53
54
for (i = 0; i <= FFR_PRED_NUM; i++) {
55
--
56
2.25.1
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
This commit defines an interface allowing multi-phase reset. This aims
3
This includes the build rules for the decoder, and the
4
to solve a problem of the actual single-phase reset (built in
4
new file for translation, but excludes any instructions.
5
DeviceClass and BusClass): reset behavior is dependent on the order
6
in which reset handlers are called. In particular doing external
7
side-effect (like setting an qemu_irq) is problematic because receiving
8
object may not be reset yet.
9
5
10
The Resettable interface divides the reset in 3 well defined phases.
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
To reset an object tree, all 1st phases are executed then all 2nd then
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
all 3rd. See the comments in include/hw/resettable.h for a more complete
8
Message-id: 20220708151540.18136-3-richard.henderson@linaro.org
13
description. The interface defines 3 phases to let the future
14
possibility of holding an object into reset for some time.
15
16
The qdev/qbus reset in DeviceClass and BusClass will be modified in
17
following commits to use this interface. A mechanism is provided
18
to allow executing a transitional reset handler in place of the 2nd
19
phase which is executed in children-then-parent order inside a tree.
20
This will allow to transition devices and buses smoothly while
21
keeping the exact current qdev/qbus reset behavior for now.
22
23
Documentation will be added in a following commit.
24
25
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
26
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
27
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
28
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
29
Message-id: 20200123132823.1117486-4-damien.hedde@greensocs.com
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
---
10
---
32
hw/core/Makefile.objs | 1 +
11
target/arm/translate-a64.h | 1 +
33
include/hw/resettable.h | 211 +++++++++++++++++++++++++++++++++++
12
target/arm/sme.decode | 20 ++++++++++++++++++++
34
hw/core/resettable.c | 238 ++++++++++++++++++++++++++++++++++++++++
13
target/arm/translate-a64.c | 7 ++++++-
35
hw/core/trace-events | 17 +++
14
target/arm/translate-sme.c | 35 +++++++++++++++++++++++++++++++++++
36
4 files changed, 467 insertions(+)
15
target/arm/meson.build | 2 ++
37
create mode 100644 include/hw/resettable.h
16
5 files changed, 64 insertions(+), 1 deletion(-)
38
create mode 100644 hw/core/resettable.c
17
create mode 100644 target/arm/sme.decode
18
create mode 100644 target/arm/translate-sme.c
39
19
40
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
20
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
41
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/core/Makefile.objs
22
--- a/target/arm/translate-a64.h
43
+++ b/hw/core/Makefile.objs
23
+++ b/target/arm/translate-a64.h
44
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ static inline int pred_gvec_reg_size(DisasContext *s)
45
common-obj-y += qdev.o qdev-properties.o
25
}
46
common-obj-y += bus.o
26
47
common-obj-y += cpu.o
27
bool disas_sve(DisasContext *, uint32_t);
48
+common-obj-y += resettable.o
28
+bool disas_sme(DisasContext *, uint32_t);
49
common-obj-y += hotplug.o
29
50
common-obj-y += vmstate-if.o
30
void gen_gvec_rax1(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
51
# irq.o needed for qdev GPIO handling:
31
uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz);
52
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
32
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
53
new file mode 100644
33
new file mode 100644
54
index XXXXXXX..XXXXXXX
34
index XXXXXXX..XXXXXXX
55
--- /dev/null
35
--- /dev/null
56
+++ b/include/hw/resettable.h
36
+++ b/target/arm/sme.decode
57
@@ -XXX,XX +XXX,XX @@
37
@@ -XXX,XX +XXX,XX @@
58
+/*
38
+# AArch64 SME instruction descriptions
59
+ * Resettable interface header.
39
+#
60
+ *
40
+# Copyright (c) 2022 Linaro, Ltd
61
+ * Copyright (c) 2019 GreenSocs SAS
41
+#
62
+ *
42
+# This library is free software; you can redistribute it and/or
63
+ * Authors:
43
+# modify it under the terms of the GNU Lesser General Public
64
+ * Damien Hedde
44
+# License as published by the Free Software Foundation; either
65
+ *
45
+# version 2.1 of the License, or (at your option) any later version.
66
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
46
+#
67
+ * See the COPYING file in the top-level directory.
47
+# This library is distributed in the hope that it will be useful,
68
+ */
48
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
49
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
50
+# Lesser General Public License for more details.
51
+#
52
+# You should have received a copy of the GNU Lesser General Public
53
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
69
+
54
+
70
+#ifndef HW_RESETTABLE_H
55
+#
71
+#define HW_RESETTABLE_H
56
+# This file is processed by scripts/decodetree.py
72
+
57
+#
73
+#include "qom/object.h"
58
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
74
+
59
index XXXXXXX..XXXXXXX 100644
75
+#define TYPE_RESETTABLE_INTERFACE "resettable"
60
--- a/target/arm/translate-a64.c
76
+
61
+++ b/target/arm/translate-a64.c
77
+#define RESETTABLE_CLASS(class) \
62
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
78
+ OBJECT_CLASS_CHECK(ResettableClass, (class), TYPE_RESETTABLE_INTERFACE)
63
}
79
+
64
80
+#define RESETTABLE_GET_CLASS(obj) \
65
switch (extract32(insn, 25, 4)) {
81
+ OBJECT_GET_CLASS(ResettableClass, (obj), TYPE_RESETTABLE_INTERFACE)
66
- case 0x0: case 0x1: case 0x3: /* UNALLOCATED */
82
+
67
+ case 0x0:
83
+typedef struct ResettableState ResettableState;
68
+ if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) {
84
+
69
+ unallocated_encoding(s);
85
+/**
70
+ }
86
+ * ResetType:
71
+ break;
87
+ * Types of reset.
72
+ case 0x1: case 0x3: /* UNALLOCATED */
88
+ *
73
unallocated_encoding(s);
89
+ * + Cold: reset resulting from a power cycle of the object.
74
break;
90
+ *
75
case 0x2:
91
+ * TODO: Support has to be added to handle more types. In particular,
76
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
92
+ * ResettableState structure needs to be expanded.
93
+ */
94
+typedef enum ResetType {
95
+ RESET_TYPE_COLD,
96
+} ResetType;
97
+
98
+/*
99
+ * ResettableClass:
100
+ * Interface for resettable objects.
101
+ *
102
+ * See docs/devel/reset.rst for more detailed information about how QEMU models
103
+ * reset. This whole API must only be used when holding the iothread mutex.
104
+ *
105
+ * All objects which can be reset must implement this interface;
106
+ * it is usually provided by a base class such as DeviceClass or BusClass.
107
+ * Every Resettable object must maintain some state tracking the
108
+ * progress of a reset operation by providing a ResettableState structure.
109
+ * The functions defined in this module take care of updating the
110
+ * state of the reset.
111
+ * The base class implementation of the interface provides this
112
+ * state and implements the associated method: get_state.
113
+ *
114
+ * Concrete object implementations (typically specific devices
115
+ * such as a UART model) should provide the functions
116
+ * for the phases.enter, phases.hold and phases.exit methods, which
117
+ * they can set in their class init function, either directly or
118
+ * by calling resettable_class_set_parent_phases().
119
+ * The phase methods are guaranteed to only only ever be called once
120
+ * for any reset event, in the order 'enter', 'hold', 'exit'.
121
+ * An object will always move quickly from 'enter' to 'hold'
122
+ * but might remain in 'hold' for an arbitrary period of time
123
+ * before eventually reset is deasserted and the 'exit' phase is called.
124
+ * Object implementations should be prepared for functions handling
125
+ * inbound connections from other devices (such as qemu_irq handler
126
+ * functions) to be called at any point during reset after their
127
+ * 'enter' method has been called.
128
+ *
129
+ * Users of a resettable object should not call these methods
130
+ * directly, but instead use the function resettable_reset().
131
+ *
132
+ * @phases.enter: This phase is called when the object enters reset. It
133
+ * should reset local state of the object, but it must not do anything that
134
+ * has a side-effect on other objects, such as raising or lowering a qemu_irq
135
+ * line or reading or writing guest memory. It takes the reset's type as
136
+ * argument.
137
+ *
138
+ * @phases.hold: This phase is called for entry into reset, once every object
139
+ * in the system which is being reset has had its @phases.enter method called.
140
+ * At this point devices can do actions that affect other objects.
141
+ *
142
+ * @phases.exit: This phase is called when the object leaves the reset state.
143
+ * Actions affecting other objects are permitted.
144
+ *
145
+ * @get_state: Mandatory method which must return a pointer to a
146
+ * ResettableState.
147
+ *
148
+ * @get_transitional_function: transitional method to handle Resettable objects
149
+ * not yet fully moved to this interface. It will be removed as soon as it is
150
+ * not needed anymore. This method is optional and may return a pointer to a
151
+ * function to be used instead of the phases. If the method exists and returns
152
+ * a non-NULL function pointer then that function is executed as a replacement
153
+ * of the 'hold' phase method taking the object as argument. The two other phase
154
+ * methods are not executed.
155
+ *
156
+ * @child_foreach: Executes a given callback on every Resettable child. Child
157
+ * in this context means a child in the qbus tree, so the children of a qbus
158
+ * are the devices on it, and the children of a device are all the buses it
159
+ * owns. This is not the same as the QOM object hierarchy. The function takes
160
+ * additional opaque and ResetType arguments which must be passed unmodified to
161
+ * the callback.
162
+ */
163
+typedef void (*ResettableEnterPhase)(Object *obj, ResetType type);
164
+typedef void (*ResettableHoldPhase)(Object *obj);
165
+typedef void (*ResettableExitPhase)(Object *obj);
166
+typedef ResettableState * (*ResettableGetState)(Object *obj);
167
+typedef void (*ResettableTrFunction)(Object *obj);
168
+typedef ResettableTrFunction (*ResettableGetTrFunction)(Object *obj);
169
+typedef void (*ResettableChildCallback)(Object *, void *opaque,
170
+ ResetType type);
171
+typedef void (*ResettableChildForeach)(Object *obj,
172
+ ResettableChildCallback cb,
173
+ void *opaque, ResetType type);
174
+typedef struct ResettablePhases {
175
+ ResettableEnterPhase enter;
176
+ ResettableHoldPhase hold;
177
+ ResettableExitPhase exit;
178
+} ResettablePhases;
179
+typedef struct ResettableClass {
180
+ InterfaceClass parent_class;
181
+
182
+ /* Phase methods */
183
+ ResettablePhases phases;
184
+
185
+ /* State access method */
186
+ ResettableGetState get_state;
187
+
188
+ /* Transitional method for legacy reset compatibility */
189
+ ResettableGetTrFunction get_transitional_function;
190
+
191
+ /* Hierarchy handling method */
192
+ ResettableChildForeach child_foreach;
193
+} ResettableClass;
194
+
195
+/**
196
+ * ResettableState:
197
+ * Structure holding reset related state. The fields should not be accessed
198
+ * directly; the definition is here to allow further inclusion into other
199
+ * objects.
200
+ *
201
+ * @count: Number of reset level the object is into. It is incremented when
202
+ * the reset operation starts and decremented when it finishes.
203
+ * @hold_phase_pending: flag which indicates that we need to invoke the 'hold'
204
+ * phase handler for this object.
205
+ * @exit_phase_in_progress: true if we are currently in the exit phase
206
+ */
207
+struct ResettableState {
208
+ unsigned count;
209
+ bool hold_phase_pending;
210
+ bool exit_phase_in_progress;
211
+};
212
+
213
+/**
214
+ * resettable_reset:
215
+ * Trigger a reset on an object @obj of type @type. @obj must implement
216
+ * Resettable interface.
217
+ *
218
+ * Calling this function is equivalent to calling @resettable_assert_reset()
219
+ * then @resettable_release_reset().
220
+ */
221
+void resettable_reset(Object *obj, ResetType type);
222
+
223
+/**
224
+ * resettable_assert_reset:
225
+ * Put an object @obj into reset. @obj must implement Resettable interface.
226
+ *
227
+ * @resettable_release_reset() must eventually be called after this call.
228
+ * There must be one call to @resettable_release_reset() per call of
229
+ * @resettable_assert_reset(), with the same type argument.
230
+ *
231
+ * NOTE: Until support for migration is added, the @resettable_release_reset()
232
+ * must not be delayed. It must occur just after @resettable_assert_reset() so
233
+ * that migration cannot be triggered in between. Prefer using
234
+ * @resettable_reset() for now.
235
+ */
236
+void resettable_assert_reset(Object *obj, ResetType type);
237
+
238
+/**
239
+ * resettable_release_reset:
240
+ * Release the object @obj from reset. @obj must implement Resettable interface.
241
+ *
242
+ * See @resettable_assert_reset() description for details.
243
+ */
244
+void resettable_release_reset(Object *obj, ResetType type);
245
+
246
+/**
247
+ * resettable_is_in_reset:
248
+ * Return true if @obj is under reset.
249
+ *
250
+ * @obj must implement Resettable interface.
251
+ */
252
+bool resettable_is_in_reset(Object *obj);
253
+
254
+/**
255
+ * resettable_class_set_parent_phases:
256
+ *
257
+ * Save @rc current reset phases into @parent_phases and override @rc phases
258
+ * by the given new methods (@enter, @hold and @exit).
259
+ * Each phase is overridden only if the new one is not NULL allowing to
260
+ * override a subset of phases.
261
+ */
262
+void resettable_class_set_parent_phases(ResettableClass *rc,
263
+ ResettableEnterPhase enter,
264
+ ResettableHoldPhase hold,
265
+ ResettableExitPhase exit,
266
+ ResettablePhases *parent_phases);
267
+
268
+#endif
269
diff --git a/hw/core/resettable.c b/hw/core/resettable.c
270
new file mode 100644
77
new file mode 100644
271
index XXXXXXX..XXXXXXX
78
index XXXXXXX..XXXXXXX
272
--- /dev/null
79
--- /dev/null
273
+++ b/hw/core/resettable.c
80
+++ b/target/arm/translate-sme.c
274
@@ -XXX,XX +XXX,XX @@
81
@@ -XXX,XX +XXX,XX @@
275
+/*
82
+/*
276
+ * Resettable interface.
83
+ * AArch64 SME translation
277
+ *
84
+ *
278
+ * Copyright (c) 2019 GreenSocs SAS
85
+ * Copyright (c) 2022 Linaro, Ltd
279
+ *
86
+ *
280
+ * Authors:
87
+ * This library is free software; you can redistribute it and/or
281
+ * Damien Hedde
88
+ * modify it under the terms of the GNU Lesser General Public
89
+ * License as published by the Free Software Foundation; either
90
+ * version 2.1 of the License, or (at your option) any later version.
282
+ *
91
+ *
283
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
92
+ * This library is distributed in the hope that it will be useful,
284
+ * See the COPYING file in the top-level directory.
93
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
94
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95
+ * Lesser General Public License for more details.
96
+ *
97
+ * You should have received a copy of the GNU Lesser General Public
98
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
285
+ */
99
+ */
286
+
100
+
287
+#include "qemu/osdep.h"
101
+#include "qemu/osdep.h"
288
+#include "qemu/module.h"
102
+#include "cpu.h"
289
+#include "hw/resettable.h"
103
+#include "tcg/tcg-op.h"
290
+#include "trace.h"
104
+#include "tcg/tcg-op-gvec.h"
105
+#include "tcg/tcg-gvec-desc.h"
106
+#include "translate.h"
107
+#include "exec/helper-gen.h"
108
+#include "translate-a64.h"
109
+#include "fpu/softfloat.h"
291
+
110
+
292
+/**
111
+
293
+ * resettable_phase_enter/hold/exit:
112
+/*
294
+ * Function executing a phase recursively in a resettable object and its
113
+ * Include the generated decoder.
295
+ * children.
296
+ */
114
+ */
297
+static void resettable_phase_enter(Object *obj, void *opaque, ResetType type);
298
+static void resettable_phase_hold(Object *obj, void *opaque, ResetType type);
299
+static void resettable_phase_exit(Object *obj, void *opaque, ResetType type);
300
+
115
+
301
+/**
116
+#include "decode-sme.c.inc"
302
+ * enter_phase_in_progress:
117
diff --git a/target/arm/meson.build b/target/arm/meson.build
303
+ * True if we are currently in reset enter phase.
304
+ *
305
+ * Note: This flag is only used to guarantee (using asserts) that the reset
306
+ * API is used correctly. We can use a global variable because we rely on the
307
+ * iothread mutex to ensure only one reset operation is in a progress at a
308
+ * given time.
309
+ */
310
+static bool enter_phase_in_progress;
311
+
312
+void resettable_reset(Object *obj, ResetType type)
313
+{
314
+ trace_resettable_reset(obj, type);
315
+ resettable_assert_reset(obj, type);
316
+ resettable_release_reset(obj, type);
317
+}
318
+
319
+void resettable_assert_reset(Object *obj, ResetType type)
320
+{
321
+ /* TODO: change this assert when adding support for other reset types */
322
+ assert(type == RESET_TYPE_COLD);
323
+ trace_resettable_reset_assert_begin(obj, type);
324
+ assert(!enter_phase_in_progress);
325
+
326
+ enter_phase_in_progress = true;
327
+ resettable_phase_enter(obj, NULL, type);
328
+ enter_phase_in_progress = false;
329
+
330
+ resettable_phase_hold(obj, NULL, type);
331
+
332
+ trace_resettable_reset_assert_end(obj);
333
+}
334
+
335
+void resettable_release_reset(Object *obj, ResetType type)
336
+{
337
+ /* TODO: change this assert when adding support for other reset types */
338
+ assert(type == RESET_TYPE_COLD);
339
+ trace_resettable_reset_release_begin(obj, type);
340
+ assert(!enter_phase_in_progress);
341
+
342
+ resettable_phase_exit(obj, NULL, type);
343
+
344
+ trace_resettable_reset_release_end(obj);
345
+}
346
+
347
+bool resettable_is_in_reset(Object *obj)
348
+{
349
+ ResettableClass *rc = RESETTABLE_GET_CLASS(obj);
350
+ ResettableState *s = rc->get_state(obj);
351
+
352
+ return s->count > 0;
353
+}
354
+
355
+/**
356
+ * resettable_child_foreach:
357
+ * helper to avoid checking the existence of the method.
358
+ */
359
+static void resettable_child_foreach(ResettableClass *rc, Object *obj,
360
+ ResettableChildCallback cb,
361
+ void *opaque, ResetType type)
362
+{
363
+ if (rc->child_foreach) {
364
+ rc->child_foreach(obj, cb, opaque, type);
365
+ }
366
+}
367
+
368
+/**
369
+ * resettable_get_tr_func:
370
+ * helper to fetch transitional reset callback if any.
371
+ */
372
+static ResettableTrFunction resettable_get_tr_func(ResettableClass *rc,
373
+ Object *obj)
374
+{
375
+ ResettableTrFunction tr_func = NULL;
376
+ if (rc->get_transitional_function) {
377
+ tr_func = rc->get_transitional_function(obj);
378
+ }
379
+ return tr_func;
380
+}
381
+
382
+static void resettable_phase_enter(Object *obj, void *opaque, ResetType type)
383
+{
384
+ ResettableClass *rc = RESETTABLE_GET_CLASS(obj);
385
+ ResettableState *s = rc->get_state(obj);
386
+ const char *obj_typename = object_get_typename(obj);
387
+ bool action_needed = false;
388
+
389
+ /* exit phase has to finish properly before entering back in reset */
390
+ assert(!s->exit_phase_in_progress);
391
+
392
+ trace_resettable_phase_enter_begin(obj, obj_typename, s->count, type);
393
+
394
+ /* Only take action if we really enter reset for the 1st time. */
395
+ /*
396
+ * TODO: if adding more ResetType support, some additional checks
397
+ * are probably needed here.
398
+ */
399
+ if (s->count++ == 0) {
400
+ action_needed = true;
401
+ }
402
+ /*
403
+ * We limit the count to an arbitrary "big" value. The value is big
404
+ * enough not to be triggered normally.
405
+ * The assert will stop an infinite loop if there is a cycle in the
406
+ * reset tree. The loop goes through resettable_foreach_child below
407
+ * which at some point will call us again.
408
+ */
409
+ assert(s->count <= 50);
410
+
411
+ /*
412
+ * handle the children even if action_needed is at false so that
413
+ * child counts are incremented too
414
+ */
415
+ resettable_child_foreach(rc, obj, resettable_phase_enter, NULL, type);
416
+
417
+ /* execute enter phase for the object if needed */
418
+ if (action_needed) {
419
+ trace_resettable_phase_enter_exec(obj, obj_typename, type,
420
+ !!rc->phases.enter);
421
+ if (rc->phases.enter && !resettable_get_tr_func(rc, obj)) {
422
+ rc->phases.enter(obj, type);
423
+ }
424
+ s->hold_phase_pending = true;
425
+ }
426
+ trace_resettable_phase_enter_end(obj, obj_typename, s->count);
427
+}
428
+
429
+static void resettable_phase_hold(Object *obj, void *opaque, ResetType type)
430
+{
431
+ ResettableClass *rc = RESETTABLE_GET_CLASS(obj);
432
+ ResettableState *s = rc->get_state(obj);
433
+ const char *obj_typename = object_get_typename(obj);
434
+
435
+ /* exit phase has to finish properly before entering back in reset */
436
+ assert(!s->exit_phase_in_progress);
437
+
438
+ trace_resettable_phase_hold_begin(obj, obj_typename, s->count, type);
439
+
440
+ /* handle children first */
441
+ resettable_child_foreach(rc, obj, resettable_phase_hold, NULL, type);
442
+
443
+ /* exec hold phase */
444
+ if (s->hold_phase_pending) {
445
+ s->hold_phase_pending = false;
446
+ ResettableTrFunction tr_func = resettable_get_tr_func(rc, obj);
447
+ trace_resettable_phase_hold_exec(obj, obj_typename, !!rc->phases.hold);
448
+ if (tr_func) {
449
+ trace_resettable_transitional_function(obj, obj_typename);
450
+ tr_func(obj);
451
+ } else if (rc->phases.hold) {
452
+ rc->phases.hold(obj);
453
+ }
454
+ }
455
+ trace_resettable_phase_hold_end(obj, obj_typename, s->count);
456
+}
457
+
458
+static void resettable_phase_exit(Object *obj, void *opaque, ResetType type)
459
+{
460
+ ResettableClass *rc = RESETTABLE_GET_CLASS(obj);
461
+ ResettableState *s = rc->get_state(obj);
462
+ const char *obj_typename = object_get_typename(obj);
463
+
464
+ assert(!s->exit_phase_in_progress);
465
+ trace_resettable_phase_exit_begin(obj, obj_typename, s->count, type);
466
+
467
+ /* exit_phase_in_progress ensures this phase is 'atomic' */
468
+ s->exit_phase_in_progress = true;
469
+ resettable_child_foreach(rc, obj, resettable_phase_exit, NULL, type);
470
+
471
+ assert(s->count > 0);
472
+ if (s->count == 1) {
473
+ trace_resettable_phase_exit_exec(obj, obj_typename, !!rc->phases.exit);
474
+ if (rc->phases.exit && !resettable_get_tr_func(rc, obj)) {
475
+ rc->phases.exit(obj);
476
+ }
477
+ s->count = 0;
478
+ }
479
+ s->exit_phase_in_progress = false;
480
+ trace_resettable_phase_exit_end(obj, obj_typename, s->count);
481
+}
482
+
483
+void resettable_class_set_parent_phases(ResettableClass *rc,
484
+ ResettableEnterPhase enter,
485
+ ResettableHoldPhase hold,
486
+ ResettableExitPhase exit,
487
+ ResettablePhases *parent_phases)
488
+{
489
+ *parent_phases = rc->phases;
490
+ if (enter) {
491
+ rc->phases.enter = enter;
492
+ }
493
+ if (hold) {
494
+ rc->phases.hold = hold;
495
+ }
496
+ if (exit) {
497
+ rc->phases.exit = exit;
498
+ }
499
+}
500
+
501
+static const TypeInfo resettable_interface_info = {
502
+ .name = TYPE_RESETTABLE_INTERFACE,
503
+ .parent = TYPE_INTERFACE,
504
+ .class_size = sizeof(ResettableClass),
505
+};
506
+
507
+static void reset_register_types(void)
508
+{
509
+ type_register_static(&resettable_interface_info);
510
+}
511
+
512
+type_init(reset_register_types)
513
diff --git a/hw/core/trace-events b/hw/core/trace-events
514
index XXXXXXX..XXXXXXX 100644
118
index XXXXXXX..XXXXXXX 100644
515
--- a/hw/core/trace-events
119
--- a/target/arm/meson.build
516
+++ b/hw/core/trace-events
120
+++ b/target/arm/meson.build
517
@@ -XXX,XX +XXX,XX @@ qbus_reset(void *obj, const char *objtype) "obj=%p(%s)"
121
@@ -XXX,XX +XXX,XX @@
518
qbus_reset_all(void *obj, const char *objtype) "obj=%p(%s)"
122
gen = [
519
qbus_reset_tree(void *obj, const char *objtype) "obj=%p(%s)"
123
decodetree.process('sve.decode', extra_args: '--decode=disas_sve'),
520
qdev_update_parent_bus(void *obj, const char *objtype, void *oldp, const char *oldptype, void *newp, const char *newptype) "obj=%p(%s) old_parent=%p(%s) new_parent=%p(%s)"
124
+ decodetree.process('sme.decode', extra_args: '--decode=disas_sme'),
521
+
125
decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'),
522
+# resettable.c
126
decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'),
523
+resettable_reset(void *obj, int cold) "obj=%p cold=%d"
127
decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'),
524
+resettable_reset_assert_begin(void *obj, int cold) "obj=%p cold=%d"
128
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
525
+resettable_reset_assert_end(void *obj) "obj=%p"
129
'sme_helper.c',
526
+resettable_reset_release_begin(void *obj, int cold) "obj=%p cold=%d"
130
'translate-a64.c',
527
+resettable_reset_release_end(void *obj) "obj=%p"
131
'translate-sve.c',
528
+resettable_phase_enter_begin(void *obj, const char *objtype, unsigned count, int type) "obj=%p(%s) count=%d type=%d"
132
+ 'translate-sme.c',
529
+resettable_phase_enter_exec(void *obj, const char *objtype, int type, int has_method) "obj=%p(%s) type=%d method=%d"
133
))
530
+resettable_phase_enter_end(void *obj, const char *objtype, unsigned count) "obj=%p(%s) count=%d"
134
531
+resettable_phase_hold_begin(void *obj, const char *objtype, unsigned count, int type) "obj=%p(%s) count=%d type=%d"
135
arm_softmmu_ss = ss.source_set()
532
+resettable_phase_hold_exec(void *obj, const char *objtype, int has_method) "obj=%p(%s) method=%d"
533
+resettable_phase_hold_end(void *obj, const char *objtype, unsigned count) "obj=%p(%s) count=%d"
534
+resettable_phase_exit_begin(void *obj, const char *objtype, unsigned count, int type) "obj=%p(%s) count=%d type=%d"
535
+resettable_phase_exit_exec(void *obj, const char *objtype, int has_method) "obj=%p(%s) method=%d"
536
+resettable_phase_exit_end(void *obj, const char *objtype, unsigned count) "obj=%p(%s) count=%d"
537
+resettable_transitional_function(void *obj, const char *objtype) "obj=%p(%s)"
538
--
136
--
539
2.20.1
137
2.25.1
540
541
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Provide a temporary device_legacy_reset function doing what
3
This new behaviour is in the ARM pseudocode function
4
device_reset does to prepare for the transition with Resettable
4
AArch64.CheckFPAdvSIMDEnabled, which applies to AArch32
5
API.
5
via AArch32.CheckAdvSIMDOrFPEnabled when the EL to which
6
6
the trap would be delivered is in AArch64 mode.
7
All occurrence of device_reset in the code tree are also replaced
7
8
by device_legacy_reset.
8
Given that ARMv9 drops support for AArch32 outside EL0, the trap EL
9
9
detection ought to be trivially true, but the pseudocode still contains
10
The new resettable API has different prototype and semantics
10
a number of conditions, and QEMU has not yet committed to dropping A32
11
(resetting child buses as well as the specified device). Subsequent
11
support for EL[12] when v9 features are present.
12
commits will make the changeover for each call site individually; once
12
13
that is complete device_legacy_reset() will be removed.
13
Since the computation of SME_TRAP_NONSTREAMING is necessarily different
14
14
for the two modes, we might as well preserve bits within TBFLAG_ANY and
15
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
15
allocate separate bits within TBFLAG_A32 and TBFLAG_A64 instead.
16
17
Note that DDI0616A.a has typos for bits [22:21] of LD1RO in the table
18
of instructions illegal in streaming mode.
19
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
18
Acked-by: David Gibson <david@gibson.dropbear.id.au>
22
Message-id: 20220708151540.18136-4-richard.henderson@linaro.org
19
Acked-by: Cornelia Huck <cohuck@redhat.com>
20
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
21
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22
Message-id: 20200123132823.1117486-2-damien.hedde@greensocs.com
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
---
24
---
25
include/hw/qdev-core.h | 4 ++--
25
target/arm/cpu.h | 7 +++
26
hw/audio/intel-hda.c | 2 +-
26
target/arm/translate.h | 4 ++
27
hw/core/qdev.c | 6 +++---
27
target/arm/sme-fa64.decode | 90 ++++++++++++++++++++++++++++++++++++++
28
hw/hyperv/hyperv.c | 2 +-
28
target/arm/helper.c | 41 +++++++++++++++++
29
hw/i386/microvm.c | 2 +-
29
target/arm/translate-a64.c | 40 ++++++++++++++++-
30
hw/i386/pc.c | 2 +-
30
target/arm/translate-vfp.c | 12 +++++
31
hw/ide/microdrive.c | 8 ++++----
31
target/arm/translate.c | 2 +
32
hw/intc/spapr_xive.c | 2 +-
32
target/arm/meson.build | 1 +
33
hw/ppc/pnv_psi.c | 4 ++--
33
8 files changed, 195 insertions(+), 2 deletions(-)
34
hw/ppc/spapr_pci.c | 2 +-
34
create mode 100644 target/arm/sme-fa64.decode
35
hw/ppc/spapr_vio.c | 2 +-
35
36
hw/s390x/s390-pci-inst.c | 2 +-
36
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
37
hw/scsi/vmw_pvscsi.c | 2 +-
37
index XXXXXXX..XXXXXXX 100644
38
hw/sd/omap_mmc.c | 2 +-
38
--- a/target/arm/cpu.h
39
hw/sd/pl181.c | 2 +-
39
+++ b/target/arm/cpu.h
40
15 files changed, 22 insertions(+), 22 deletions(-)
40
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, HSTR_ACTIVE, 9, 1)
41
41
* the same thing as the current security state of the processor!
42
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
43
index XXXXXXX..XXXXXXX 100644
44
--- a/include/hw/qdev-core.h
45
+++ b/include/hw/qdev-core.h
46
@@ -XXX,XX +XXX,XX @@ char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
47
void qdev_machine_init(void);
48
49
/**
50
- * @device_reset
51
+ * device_legacy_reset:
52
*
53
* Reset a single device (by calling the reset method).
54
*/
42
*/
55
-void device_reset(DeviceState *dev);
43
FIELD(TBFLAG_A32, NS, 10, 1)
56
+void device_legacy_reset(DeviceState *dev);
44
+/*
57
45
+ * Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not.
58
void device_class_set_props(DeviceClass *dc, Property *props);
46
+ * This requires an SME trap from AArch32 mode when using NEON.
59
47
+ */
60
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
48
+FIELD(TBFLAG_A32, SME_TRAP_NONSTREAMING, 11, 1)
61
index XXXXXXX..XXXXXXX 100644
49
62
--- a/hw/audio/intel-hda.c
50
/*
63
+++ b/hw/audio/intel-hda.c
51
* Bit usage when in AArch32 state, for M-profile only.
64
@@ -XXX,XX +XXX,XX @@ static void intel_hda_reset(DeviceState *dev)
52
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, SMEEXC_EL, 20, 2)
65
QTAILQ_FOREACH(kid, &d->codecs.qbus.children, sibling) {
53
FIELD(TBFLAG_A64, PSTATE_SM, 22, 1)
66
DeviceState *qdev = kid->child;
54
FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1)
67
cdev = HDA_CODEC_DEVICE(qdev);
55
FIELD(TBFLAG_A64, SVL, 24, 4)
68
- device_reset(DEVICE(cdev));
56
+/* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. */
69
+ device_legacy_reset(DEVICE(cdev));
57
+FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1)
70
d->state_sts |= (1 << cdev->cad);
58
71
}
59
/*
72
intel_hda_update_irq(d);
60
* Helpers for using the above.
73
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
61
diff --git a/target/arm/translate.h b/target/arm/translate.h
74
index XXXXXXX..XXXXXXX 100644
62
index XXXXXXX..XXXXXXX 100644
75
--- a/hw/core/qdev.c
63
--- a/target/arm/translate.h
76
+++ b/hw/core/qdev.c
64
+++ b/target/arm/translate.h
77
@@ -XXX,XX +XXX,XX @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
65
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
78
66
bool pstate_sm;
79
static int qdev_reset_one(DeviceState *dev, void *opaque)
67
/* True if PSTATE.ZA is set. */
80
{
68
bool pstate_za;
81
- device_reset(dev);
69
+ /* True if non-streaming insns should raise an SME Streaming exception. */
82
+ device_legacy_reset(dev);
70
+ bool sme_trap_nonstreaming;
83
71
+ /* True if the current instruction is non-streaming. */
72
+ bool is_nonstreaming;
73
/* True if MVE insns are definitely not predicated by VPR or LTPSIZE */
74
bool mve_no_pred;
75
/*
76
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
77
new file mode 100644
78
index XXXXXXX..XXXXXXX
79
--- /dev/null
80
+++ b/target/arm/sme-fa64.decode
81
@@ -XXX,XX +XXX,XX @@
82
+# AArch64 SME allowed instruction decoding
83
+#
84
+# Copyright (c) 2022 Linaro, Ltd
85
+#
86
+# This library is free software; you can redistribute it and/or
87
+# modify it under the terms of the GNU Lesser General Public
88
+# License as published by the Free Software Foundation; either
89
+# version 2.1 of the License, or (at your option) any later version.
90
+#
91
+# This library is distributed in the hope that it will be useful,
92
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
93
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94
+# Lesser General Public License for more details.
95
+#
96
+# You should have received a copy of the GNU Lesser General Public
97
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
98
+
99
+#
100
+# This file is processed by scripts/decodetree.py
101
+#
102
+
103
+# These patterns are taken from Appendix E1.1 of DDI0616 A.a,
104
+# Arm Architecture Reference Manual Supplement,
105
+# The Scalable Matrix Extension (SME), for Armv9-A
106
+
107
+{
108
+ [
109
+ OK 0-00 1110 0000 0001 0010 11-- ---- ---- # SMOV W|Xd,Vn.B[0]
110
+ OK 0-00 1110 0000 0010 0010 11-- ---- ---- # SMOV W|Xd,Vn.H[0]
111
+ OK 0100 1110 0000 0100 0010 11-- ---- ---- # SMOV Xd,Vn.S[0]
112
+ OK 0000 1110 0000 0001 0011 11-- ---- ---- # UMOV Wd,Vn.B[0]
113
+ OK 0000 1110 0000 0010 0011 11-- ---- ---- # UMOV Wd,Vn.H[0]
114
+ OK 0000 1110 0000 0100 0011 11-- ---- ---- # UMOV Wd,Vn.S[0]
115
+ OK 0100 1110 0000 1000 0011 11-- ---- ---- # UMOV Xd,Vn.D[0]
116
+ ]
117
+ FAIL 0--0 111- ---- ---- ---- ---- ---- ---- # Advanced SIMD vector operations
118
+}
119
+
120
+{
121
+ [
122
+ OK 0101 1110 --1- ---- 11-1 11-- ---- ---- # FMULX/FRECPS/FRSQRTS (scalar)
123
+ OK 0101 1110 -10- ---- 00-1 11-- ---- ---- # FMULX/FRECPS/FRSQRTS (scalar, FP16)
124
+ OK 01-1 1110 1-10 0001 11-1 10-- ---- ---- # FRECPE/FRSQRTE/FRECPX (scalar)
125
+ OK 01-1 1110 1111 1001 11-1 10-- ---- ---- # FRECPE/FRSQRTE/FRECPX (scalar, FP16)
126
+ ]
127
+ FAIL 01-1 111- ---- ---- ---- ---- ---- ---- # Advanced SIMD single-element operations
128
+}
129
+
130
+FAIL 0-00 110- ---- ---- ---- ---- ---- ---- # Advanced SIMD structure load/store
131
+FAIL 1100 1110 ---- ---- ---- ---- ---- ---- # Advanced SIMD cryptography extensions
132
+FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
133
+
134
+# These are the "avoidance of doubt" final table of Illegal Advanced SIMD instructions
135
+# We don't actually need to include these, as the default is OK.
136
+# -001 111- ---- ---- ---- ---- ---- ---- # Scalar floating-point operations
137
+# --10 110- ---- ---- ---- ---- ---- ---- # Load/store pair of FP registers
138
+# --01 1100 ---- ---- ---- ---- ---- ---- # Load FP register (PC-relative literal)
139
+# --11 1100 --0- ---- ---- ---- ---- ---- # Load/store FP register (unscaled imm)
140
+# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
141
+# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
142
+
143
+FAIL 0000 0100 --1- ---- 1010 ---- ---- ---- # ADR
144
+FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA
145
+FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT
146
+FAIL 0010 0101 --01 100- 1111 000- ---0 ---- # RDFFR, RDFFRS
147
+FAIL 0010 0101 --10 1--- 1001 ---- ---- ---- # WRFFR, SETFFR
148
+FAIL 0100 0101 --0- ---- 1011 ---- ---- ---- # BDEP, BEXT, BGRP
149
+FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result)
150
+FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA
151
+FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL
152
+FAIL 0110 0101 --01 0--- 100- ---- ---- ---- # FTMAD
153
+FAIL 0110 0101 --01 1--- 001- ---- ---- ---- # FADDA
154
+FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA
155
+FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions
156
+FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar)
157
+FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm)
158
+FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector)
159
+FAIL 1000 010- -01- ---- 1--- ---- ---- ---- # SVE 32-bit gather load (vector+imm)
160
+FAIL 1000 0100 0-0- ---- 0--- ---- ---- ---- # SVE 32-bit gather load byte (scalar+vector)
161
+FAIL 1000 0100 1--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load half (scalar+vector)
162
+FAIL 1000 0101 0--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load word (scalar+vector)
163
+FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar)
164
+FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm)
165
+FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar)
166
+FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm)
167
+FAIL 1100 010- ---- ---- ---- ---- ---- ---- # SVE 64-bit gather load/prefetch
168
+FAIL 1110 010- -00- ---- 001- ---- ---- ---- # SVE2 64-bit scatter NT store (vector+scalar)
169
+FAIL 1110 010- -10- ---- 001- ---- ---- ---- # SVE2 32-bit scatter NT store (vector+scalar)
170
+FAIL 1110 010- ---- ---- 1-0- ---- ---- ---- # SVE scatter store (scalar+32-bit vector)
171
+FAIL 1110 010- ---- ---- 101- ---- ---- ---- # SVE scatter store (misc)
172
diff --git a/target/arm/helper.c b/target/arm/helper.c
173
index XXXXXXX..XXXXXXX 100644
174
--- a/target/arm/helper.c
175
+++ b/target/arm/helper.c
176
@@ -XXX,XX +XXX,XX @@ int sme_exception_el(CPUARMState *env, int el)
84
return 0;
177
return 0;
85
}
178
}
86
@@ -XXX,XX +XXX,XX @@ static void device_set_realized(Object *obj, bool value, Error **errp)
179
87
}
180
+/* This corresponds to the ARM pseudocode function IsFullA64Enabled(). */
181
+static bool sme_fa64(CPUARMState *env, int el)
182
+{
183
+ if (!cpu_isar_feature(aa64_sme_fa64, env_archcpu(env))) {
184
+ return false;
185
+ }
186
+
187
+ if (el <= 1 && !el_is_in_host(env, el)) {
188
+ if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) {
189
+ return false;
190
+ }
191
+ }
192
+ if (el <= 2 && arm_is_el2_enabled(env)) {
193
+ if (!FIELD_EX64(env->vfp.smcr_el[2], SMCR, FA64)) {
194
+ return false;
195
+ }
196
+ }
197
+ if (arm_feature(env, ARM_FEATURE_EL3)) {
198
+ if (!FIELD_EX64(env->vfp.smcr_el[3], SMCR, FA64)) {
199
+ return false;
200
+ }
201
+ }
202
+
203
+ return true;
204
+}
205
+
206
/*
207
* Given that SVE is enabled, return the vector length for EL.
208
*/
209
@@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el,
210
DP_TBFLAG_ANY(flags, PSTATE__IL, 1);
211
}
212
213
+ /*
214
+ * The SME exception we are testing for is raised via
215
+ * AArch64.CheckFPAdvSIMDEnabled(), as called from
216
+ * AArch32.CheckAdvSIMDOrFPEnabled().
217
+ */
218
+ if (el == 0
219
+ && FIELD_EX64(env->svcr, SVCR, SM)
220
+ && (!arm_is_el2_enabled(env)
221
+ || (arm_el_is_aa64(env, 2) && !(env->cp15.hcr_el2 & HCR_TGE)))
222
+ && arm_el_is_aa64(env, 1)
223
+ && !sme_fa64(env, el)) {
224
+ DP_TBFLAG_A32(flags, SME_TRAP_NONSTREAMING, 1);
225
+ }
226
+
227
return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
228
}
229
230
@@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
88
}
231
}
89
if (dev->hotplugged) {
232
if (FIELD_EX64(env->svcr, SVCR, SM)) {
90
- device_reset(dev);
233
DP_TBFLAG_A64(flags, PSTATE_SM, 1);
91
+ device_legacy_reset(dev);
234
+ DP_TBFLAG_A64(flags, SME_TRAP_NONSTREAMING, !sme_fa64(env, el));
92
}
235
}
93
dev->pending_deleted_event = false;
236
DP_TBFLAG_A64(flags, PSTATE_ZA, FIELD_EX64(env->svcr, SVCR, ZA));
94
237
}
95
@@ -XXX,XX +XXX,XX @@ void device_class_set_parent_unrealize(DeviceClass *dc,
238
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
96
dc->unrealize = dev_unrealize;
239
index XXXXXXX..XXXXXXX 100644
240
--- a/target/arm/translate-a64.c
241
+++ b/target/arm/translate-a64.c
242
@@ -XXX,XX +XXX,XX @@ static void do_vec_ld(DisasContext *s, int destidx, int element,
243
* unallocated-encoding checks (otherwise the syndrome information
244
* for the resulting exception will be incorrect).
245
*/
246
-static bool fp_access_check(DisasContext *s)
247
+static bool fp_access_check_only(DisasContext *s)
248
{
249
if (s->fp_excp_el) {
250
assert(!s->fp_access_checked);
251
@@ -XXX,XX +XXX,XX @@ static bool fp_access_check(DisasContext *s)
252
return true;
97
}
253
}
98
254
99
-void device_reset(DeviceState *dev)
255
+static bool fp_access_check(DisasContext *s)
100
+void device_legacy_reset(DeviceState *dev)
256
+{
101
{
257
+ if (!fp_access_check_only(s)) {
102
DeviceClass *klass = DEVICE_GET_CLASS(dev);
258
+ return false;
103
259
+ }
104
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
260
+ if (s->sme_trap_nonstreaming && s->is_nonstreaming) {
105
index XXXXXXX..XXXXXXX 100644
261
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
106
--- a/hw/hyperv/hyperv.c
262
+ syn_smetrap(SME_ET_Streaming, false));
107
+++ b/hw/hyperv/hyperv.c
263
+ return false;
108
@@ -XXX,XX +XXX,XX @@ void hyperv_synic_reset(CPUState *cs)
264
+ }
109
SynICState *synic = get_synic(cs);
265
+ return true;
110
266
+}
111
if (synic) {
267
+
112
- device_reset(DEVICE(synic));
268
/* Check that SVE access is enabled. If it is, return true.
113
+ device_legacy_reset(DEVICE(synic));
269
* If not, emit code to generate an appropriate exception and return false.
270
*/
271
@@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
272
default:
273
g_assert_not_reached();
274
}
275
- if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
276
+ if ((ri->type & ARM_CP_FPU) && !fp_access_check_only(s)) {
277
return;
278
} else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
279
return;
280
@@ -XXX,XX +XXX,XX @@ static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn)
114
}
281
}
115
}
282
}
116
283
117
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
284
+/*
118
index XXXXXXX..XXXXXXX 100644
285
+ * Include the generated SME FA64 decoder.
119
--- a/hw/i386/microvm.c
286
+ */
120
+++ b/hw/i386/microvm.c
287
+
121
@@ -XXX,XX +XXX,XX @@ static void microvm_machine_reset(MachineState *machine)
288
+#include "decode-sme-fa64.c.inc"
122
cpu = X86_CPU(cs);
289
+
123
290
+static bool trans_OK(DisasContext *s, arg_OK *a)
124
if (cpu->apic_state) {
291
+{
125
- device_reset(cpu->apic_state);
292
+ return true;
126
+ device_legacy_reset(cpu->apic_state);
293
+}
294
+
295
+static bool trans_FAIL(DisasContext *s, arg_OK *a)
296
+{
297
+ s->is_nonstreaming = true;
298
+ return true;
299
+}
300
+
301
/**
302
* is_guarded_page:
303
* @env: The cpu environment
304
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,
305
dc->mte_active[1] = EX_TBFLAG_A64(tb_flags, MTE0_ACTIVE);
306
dc->pstate_sm = EX_TBFLAG_A64(tb_flags, PSTATE_SM);
307
dc->pstate_za = EX_TBFLAG_A64(tb_flags, PSTATE_ZA);
308
+ dc->sme_trap_nonstreaming = EX_TBFLAG_A64(tb_flags, SME_TRAP_NONSTREAMING);
309
dc->vec_len = 0;
310
dc->vec_stride = 0;
311
dc->cp_regs = arm_cpu->cp_regs;
312
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
127
}
313
}
128
}
314
}
129
}
315
130
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
316
+ s->is_nonstreaming = false;
131
index XXXXXXX..XXXXXXX 100644
317
+ if (s->sme_trap_nonstreaming) {
132
--- a/hw/i386/pc.c
318
+ disas_sme_fa64(s, insn);
133
+++ b/hw/i386/pc.c
319
+ }
134
@@ -XXX,XX +XXX,XX @@ static void pc_machine_reset(MachineState *machine)
320
+
135
cpu = X86_CPU(cs);
321
switch (extract32(insn, 25, 4)) {
136
322
case 0x0:
137
if (cpu->apic_state) {
323
if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) {
138
- device_reset(cpu->apic_state);
324
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c
139
+ device_legacy_reset(cpu->apic_state);
325
index XXXXXXX..XXXXXXX 100644
326
--- a/target/arm/translate-vfp.c
327
+++ b/target/arm/translate-vfp.c
328
@@ -XXX,XX +XXX,XX @@ static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled)
329
return false;
330
}
331
332
+ /*
333
+ * Note that rebuild_hflags_a32 has already accounted for being in EL0
334
+ * and the higher EL in A64 mode, etc. Unlike A64 mode, there do not
335
+ * appear to be any insns which touch VFP which are allowed.
336
+ */
337
+ if (s->sme_trap_nonstreaming) {
338
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
339
+ syn_smetrap(SME_ET_Streaming,
340
+ s->base.pc_next - s->pc_curr == 2));
341
+ return false;
342
+ }
343
+
344
if (!s->vfp_enabled && !ignore_vfp_enabled) {
345
assert(!arm_dc_feature(s, ARM_FEATURE_M));
346
unallocated_encoding(s);
347
diff --git a/target/arm/translate.c b/target/arm/translate.c
348
index XXXXXXX..XXXXXXX 100644
349
--- a/target/arm/translate.c
350
+++ b/target/arm/translate.c
351
@@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
352
dc->vec_len = EX_TBFLAG_A32(tb_flags, VECLEN);
353
dc->vec_stride = EX_TBFLAG_A32(tb_flags, VECSTRIDE);
140
}
354
}
141
}
355
+ dc->sme_trap_nonstreaming =
142
}
356
+ EX_TBFLAG_A32(tb_flags, SME_TRAP_NONSTREAMING);
143
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
357
}
144
index XXXXXXX..XXXXXXX 100644
358
dc->cp_regs = cpu->cp_regs;
145
--- a/hw/ide/microdrive.c
359
dc->features = env->features;
146
+++ b/hw/ide/microdrive.c
360
diff --git a/target/arm/meson.build b/target/arm/meson.build
147
@@ -XXX,XX +XXX,XX @@ static void md_attr_write(PCMCIACardState *card, uint32_t at, uint8_t value)
361
index XXXXXXX..XXXXXXX 100644
148
case 0x00:    /* Configuration Option Register */
362
--- a/target/arm/meson.build
149
s->opt = value & 0xcf;
363
+++ b/target/arm/meson.build
150
if (value & OPT_SRESET) {
364
@@ -XXX,XX +XXX,XX @@
151
- device_reset(DEVICE(s));
365
gen = [
152
+ device_legacy_reset(DEVICE(s));
366
decodetree.process('sve.decode', extra_args: '--decode=disas_sve'),
153
}
367
decodetree.process('sme.decode', extra_args: '--decode=disas_sme'),
154
md_interrupt_update(s);
368
+ decodetree.process('sme-fa64.decode', extra_args: '--static-decode=disas_sme_fa64'),
155
break;
369
decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'),
156
@@ -XXX,XX +XXX,XX @@ static void md_common_write(PCMCIACardState *card, uint32_t at, uint16_t value)
370
decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'),
157
case 0xe:    /* Device Control */
371
decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'),
158
s->ctrl = value;
159
if (value & CTRL_SRST) {
160
- device_reset(DEVICE(s));
161
+ device_legacy_reset(DEVICE(s));
162
}
163
md_interrupt_update(s);
164
break;
165
@@ -XXX,XX +XXX,XX @@ static int dscm1xxxx_attach(PCMCIACardState *card)
166
md->attr_base = pcc->cis[0x74] | (pcc->cis[0x76] << 8);
167
md->io_base = 0x0;
168
169
- device_reset(DEVICE(md));
170
+ device_legacy_reset(DEVICE(md));
171
md_interrupt_update(md);
172
173
return 0;
174
@@ -XXX,XX +XXX,XX @@ static int dscm1xxxx_detach(PCMCIACardState *card)
175
{
176
MicroDriveState *md = MICRODRIVE(card);
177
178
- device_reset(DEVICE(md));
179
+ device_legacy_reset(DEVICE(md));
180
return 0;
181
}
182
183
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
184
index XXXXXXX..XXXXXXX 100644
185
--- a/hw/intc/spapr_xive.c
186
+++ b/hw/intc/spapr_xive.c
187
@@ -XXX,XX +XXX,XX @@ static target_ulong h_int_reset(PowerPCCPU *cpu,
188
return H_PARAMETER;
189
}
190
191
- device_reset(DEVICE(xive));
192
+ device_legacy_reset(DEVICE(xive));
193
194
if (kvm_irqchip_in_kernel()) {
195
Error *local_err = NULL;
196
diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c
197
index XXXXXXX..XXXXXXX 100644
198
--- a/hw/ppc/pnv_psi.c
199
+++ b/hw/ppc/pnv_psi.c
200
@@ -XXX,XX +XXX,XX @@ static void pnv_psi_reset(DeviceState *dev)
201
202
static void pnv_psi_reset_handler(void *dev)
203
{
204
- device_reset(DEVICE(dev));
205
+ device_legacy_reset(DEVICE(dev));
206
}
207
208
static void pnv_psi_realize(DeviceState *dev, Error **errp)
209
@@ -XXX,XX +XXX,XX @@ static void pnv_psi_p9_mmio_write(void *opaque, hwaddr addr,
210
break;
211
case PSIHB9_INTERRUPT_CONTROL:
212
if (val & PSIHB9_IRQ_RESET) {
213
- device_reset(DEVICE(&psi9->source));
214
+ device_legacy_reset(DEVICE(&psi9->source));
215
}
216
psi->regs[reg] = val;
217
break;
218
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
219
index XXXXXXX..XXXXXXX 100644
220
--- a/hw/ppc/spapr_pci.c
221
+++ b/hw/ppc/spapr_pci.c
222
@@ -XXX,XX +XXX,XX @@ static int spapr_phb_children_reset(Object *child, void *opaque)
223
DeviceState *dev = (DeviceState *) object_dynamic_cast(child, TYPE_DEVICE);
224
225
if (dev) {
226
- device_reset(dev);
227
+ device_legacy_reset(dev);
228
}
229
230
return 0;
231
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
232
index XXXXXXX..XXXXXXX 100644
233
--- a/hw/ppc/spapr_vio.c
234
+++ b/hw/ppc/spapr_vio.c
235
@@ -XXX,XX +XXX,XX @@ int spapr_vio_send_crq(SpaprVioDevice *dev, uint8_t *crq)
236
static void spapr_vio_quiesce_one(SpaprVioDevice *dev)
237
{
238
if (dev->tcet) {
239
- device_reset(DEVICE(dev->tcet));
240
+ device_legacy_reset(DEVICE(dev->tcet));
241
}
242
free_crq(dev);
243
}
244
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
245
index XXXXXXX..XXXXXXX 100644
246
--- a/hw/s390x/s390-pci-inst.c
247
+++ b/hw/s390x/s390-pci-inst.c
248
@@ -XXX,XX +XXX,XX @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
249
stw_p(&ressetpci->hdr.rsp, CLP_RC_SETPCIFN_FHOP);
250
goto out;
251
}
252
- device_reset(DEVICE(pbdev));
253
+ device_legacy_reset(DEVICE(pbdev));
254
pbdev->fh &= ~FH_MASK_ENABLE;
255
pbdev->state = ZPCI_FS_DISABLED;
256
stl_p(&ressetpci->fh, pbdev->fh);
257
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
258
index XXXXXXX..XXXXXXX 100644
259
--- a/hw/scsi/vmw_pvscsi.c
260
+++ b/hw/scsi/vmw_pvscsi.c
261
@@ -XXX,XX +XXX,XX @@ pvscsi_on_cmd_reset_device(PVSCSIState *s)
262
263
if (sdev != NULL) {
264
s->resetting++;
265
- device_reset(&sdev->qdev);
266
+ device_legacy_reset(&sdev->qdev);
267
s->resetting--;
268
return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;
269
}
270
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
271
index XXXXXXX..XXXXXXX 100644
272
--- a/hw/sd/omap_mmc.c
273
+++ b/hw/sd/omap_mmc.c
274
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
275
* into any bus, and we must reset it manually. When omap_mmc is
276
* QOMified this must move into the QOM reset function.
277
*/
278
- device_reset(DEVICE(host->card));
279
+ device_legacy_reset(DEVICE(host->card));
280
}
281
282
static uint64_t omap_mmc_read(void *opaque, hwaddr offset,
283
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
284
index XXXXXXX..XXXXXXX 100644
285
--- a/hw/sd/pl181.c
286
+++ b/hw/sd/pl181.c
287
@@ -XXX,XX +XXX,XX @@ static void pl181_reset(DeviceState *d)
288
/* Since we're still using the legacy SD API the card is not plugged
289
* into any bus, and we must reset it manually.
290
*/
291
- device_reset(DEVICE(s->card));
292
+ device_legacy_reset(DEVICE(s->card));
293
}
294
295
static void pl181_init(Object *obj)
296
--
372
--
297
2.20.1
373
2.25.1
298
299
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark ADR as a non-streaming instruction, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Removing entries from sme-fa64.decode is an easy way to see
7
what remains to be done.
8
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20220708151540.18136-5-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/translate.h | 7 +++++++
15
target/arm/sme-fa64.decode | 1 -
16
target/arm/translate-sve.c | 8 ++++----
17
3 files changed, 11 insertions(+), 5 deletions(-)
18
19
diff --git a/target/arm/translate.h b/target/arm/translate.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate.h
22
+++ b/target/arm/translate.h
23
@@ -XXX,XX +XXX,XX @@ uint64_t asimd_imm_const(uint32_t imm, int cmode, int op);
24
static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
25
{ return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); }
26
27
+#define TRANS_FEAT_NONSTREAMING(NAME, FEAT, FUNC, ...) \
28
+ static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
29
+ { \
30
+ s->is_nonstreaming = true; \
31
+ return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); \
32
+ }
33
+
34
#endif /* TARGET_ARM_TRANSLATE_H */
35
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/sme-fa64.decode
38
+++ b/target/arm/sme-fa64.decode
39
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
40
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
41
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
42
43
-FAIL 0000 0100 --1- ---- 1010 ---- ---- ---- # ADR
44
FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA
45
FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT
46
FAIL 0010 0101 --01 100- 1111 000- ---0 ---- # RDFFR, RDFFRS
47
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/target/arm/translate-sve.c
50
+++ b/target/arm/translate-sve.c
51
@@ -XXX,XX +XXX,XX @@ static bool do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn)
52
return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm);
53
}
54
55
-TRANS_FEAT(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32)
56
-TRANS_FEAT(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64)
57
-TRANS_FEAT(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32)
58
-TRANS_FEAT(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32)
59
+TRANS_FEAT_NONSTREAMING(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32)
60
+TRANS_FEAT_NONSTREAMING(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64)
61
+TRANS_FEAT_NONSTREAMING(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32)
62
+TRANS_FEAT_NONSTREAMING(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32)
63
64
/*
65
*** SVE Integer Misc - Unpredicated Group
66
--
67
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-6-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 2 --
12
target/arm/translate-sve.c | 9 ++++++---
13
2 files changed, 6 insertions(+), 5 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
21
FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA
22
FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT
23
-FAIL 0010 0101 --01 100- 1111 000- ---0 ---- # RDFFR, RDFFRS
24
-FAIL 0010 0101 --10 1--- 1001 ---- ---- ---- # WRFFR, SETFFR
25
FAIL 0100 0101 --0- ---- 1011 ---- ---- ---- # BDEP, BEXT, BGRP
26
FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result)
27
FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA
28
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/translate-sve.c
31
+++ b/target/arm/translate-sve.c
32
@@ -XXX,XX +XXX,XX @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag)
33
TRANS_FEAT(PTRUE, aa64_sve, do_predset, a->esz, a->rd, a->pat, a->s)
34
35
/* Note pat == 31 is #all, to set all elements. */
36
-TRANS_FEAT(SETFFR, aa64_sve, do_predset, 0, FFR_PRED_NUM, 31, false)
37
+TRANS_FEAT_NONSTREAMING(SETFFR, aa64_sve,
38
+ do_predset, 0, FFR_PRED_NUM, 31, false)
39
40
/* Note pat == 32 is #unimp, to set no elements. */
41
TRANS_FEAT(PFALSE, aa64_sve, do_predset, 0, a->rd, 32, false)
42
@@ -XXX,XX +XXX,XX @@ static bool trans_RDFFR_p(DisasContext *s, arg_RDFFR_p *a)
43
.rd = a->rd, .pg = a->pg, .s = a->s,
44
.rn = FFR_PRED_NUM, .rm = FFR_PRED_NUM,
45
};
46
+
47
+ s->is_nonstreaming = true;
48
return trans_AND_pppp(s, &alt_a);
49
}
50
51
-TRANS_FEAT(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM)
52
-TRANS_FEAT(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn)
53
+TRANS_FEAT_NONSTREAMING(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM)
54
+TRANS_FEAT_NONSTREAMING(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn)
55
56
static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a,
57
void (*gen_fn)(TCGv_i32, TCGv_ptr,
58
--
59
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-7-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 3 ---
12
target/arm/translate-sve.c | 22 ++++++++++++----------
13
2 files changed, 12 insertions(+), 13 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA
24
-FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT
25
-FAIL 0100 0101 --0- ---- 1011 ---- ---- ---- # BDEP, BEXT, BGRP
26
FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result)
27
FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA
28
FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL
29
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/translate-sve.c
32
+++ b/target/arm/translate-sve.c
33
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_2 * const fexpa_fns[4] = {
34
NULL, gen_helper_sve_fexpa_h,
35
gen_helper_sve_fexpa_s, gen_helper_sve_fexpa_d,
36
};
37
-TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz,
38
- fexpa_fns[a->esz], a->rd, a->rn, 0)
39
+TRANS_FEAT_NONSTREAMING(FEXPA, aa64_sve, gen_gvec_ool_zz,
40
+ fexpa_fns[a->esz], a->rd, a->rn, 0)
41
42
static gen_helper_gvec_3 * const ftssel_fns[4] = {
43
NULL, gen_helper_sve_ftssel_h,
44
gen_helper_sve_ftssel_s, gen_helper_sve_ftssel_d,
45
};
46
-TRANS_FEAT(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, ftssel_fns[a->esz], a, 0)
47
+TRANS_FEAT_NONSTREAMING(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz,
48
+ ftssel_fns[a->esz], a, 0)
49
50
/*
51
*** SVE Predicate Logical Operations Group
52
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz,
53
static gen_helper_gvec_3 * const compact_fns[4] = {
54
NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d
55
};
56
-TRANS_FEAT(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz, compact_fns[a->esz], a, 0)
57
+TRANS_FEAT_NONSTREAMING(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz,
58
+ compact_fns[a->esz], a, 0)
59
60
/* Call the helper that computes the ARM LastActiveElement pseudocode
61
* function, scaled by the element size. This includes the not found
62
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3 * const bext_fns[4] = {
63
gen_helper_sve2_bext_b, gen_helper_sve2_bext_h,
64
gen_helper_sve2_bext_s, gen_helper_sve2_bext_d,
65
};
66
-TRANS_FEAT(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
67
- bext_fns[a->esz], a, 0)
68
+TRANS_FEAT_NONSTREAMING(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
69
+ bext_fns[a->esz], a, 0)
70
71
static gen_helper_gvec_3 * const bdep_fns[4] = {
72
gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h,
73
gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d,
74
};
75
-TRANS_FEAT(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
76
- bdep_fns[a->esz], a, 0)
77
+TRANS_FEAT_NONSTREAMING(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
78
+ bdep_fns[a->esz], a, 0)
79
80
static gen_helper_gvec_3 * const bgrp_fns[4] = {
81
gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h,
82
gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d,
83
};
84
-TRANS_FEAT(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
85
- bgrp_fns[a->esz], a, 0)
86
+TRANS_FEAT_NONSTREAMING(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
87
+ bgrp_fns[a->esz], a, 0)
88
89
static gen_helper_gvec_3 * const cadd_fns[4] = {
90
gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h,
91
--
92
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-8-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 2 --
12
target/arm/translate-sve.c | 24 +++++++++++++++---------
13
2 files changed, 15 insertions(+), 11 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result)
24
-FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA
25
FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL
26
FAIL 0110 0101 --01 0--- 100- ---- ---- ---- # FTMAD
27
FAIL 0110 0101 --01 1--- 001- ---- ---- ---- # FADDA
28
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/translate-sve.c
31
+++ b/target/arm/translate-sve.c
32
@@ -XXX,XX +XXX,XX @@ static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel)
33
gen_helper_gvec_pmull_q, gen_helper_sve2_pmull_h,
34
NULL, gen_helper_sve2_pmull_d,
35
};
36
- if (a->esz == 0
37
- ? !dc_isar_feature(aa64_sve2_pmull128, s)
38
- : !dc_isar_feature(aa64_sve, s)) {
39
+
40
+ if (a->esz == 0) {
41
+ if (!dc_isar_feature(aa64_sve2_pmull128, s)) {
42
+ return false;
43
+ }
44
+ s->is_nonstreaming = true;
45
+ } else if (!dc_isar_feature(aa64_sve, s)) {
46
return false;
47
}
48
return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, sel);
49
@@ -XXX,XX +XXX,XX @@ DO_ZPZZ_FP(FMINP, aa64_sve2, sve2_fminp_zpzz)
50
* SVE Integer Multiply-Add (unpredicated)
51
*/
52
53
-TRANS_FEAT(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_s,
54
- a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR)
55
-TRANS_FEAT(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_d,
56
- a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR)
57
+TRANS_FEAT_NONSTREAMING(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz,
58
+ gen_helper_fmmla_s, a->rd, a->rn, a->rm, a->ra,
59
+ 0, FPST_FPCR)
60
+TRANS_FEAT_NONSTREAMING(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz,
61
+ gen_helper_fmmla_d, a->rd, a->rn, a->rm, a->ra,
62
+ 0, FPST_FPCR)
63
64
static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = {
65
NULL, gen_helper_sve2_sqdmlal_zzzw_h,
66
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
67
TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz,
68
gen_helper_gvec_bfdot_idx, a)
69
70
-TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
71
- gen_helper_gvec_bfmmla, a, 0)
72
+TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
73
+ gen_helper_gvec_bfmmla, a, 0)
74
75
static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel)
76
{
77
--
78
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-9-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 3 ---
12
target/arm/translate-sve.c | 15 +++++++++++----
13
2 files changed, 11 insertions(+), 7 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL
24
-FAIL 0110 0101 --01 0--- 100- ---- ---- ---- # FTMAD
25
-FAIL 0110 0101 --01 1--- 001- ---- ---- ---- # FADDA
26
FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA
27
FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions
28
FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar)
29
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/translate-sve.c
32
+++ b/target/arm/translate-sve.c
33
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = {
34
NULL, gen_helper_sve_ftmad_h,
35
gen_helper_sve_ftmad_s, gen_helper_sve_ftmad_d,
36
};
37
-TRANS_FEAT(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
38
- ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
39
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
40
+TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
41
+ ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
42
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
43
44
/*
45
*** SVE Floating Point Accumulating Reduction Group
46
@@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a)
47
if (a->esz == 0 || !dc_isar_feature(aa64_sve, s)) {
48
return false;
49
}
50
+ s->is_nonstreaming = true;
51
if (!sve_access_check(s)) {
52
return true;
53
}
54
@@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a)
55
DO_FP3(FADD_zzz, fadd)
56
DO_FP3(FSUB_zzz, fsub)
57
DO_FP3(FMUL_zzz, fmul)
58
-DO_FP3(FTSMUL, ftsmul)
59
DO_FP3(FRECPS, recps)
60
DO_FP3(FRSQRTS, rsqrts)
61
62
#undef DO_FP3
63
64
+static gen_helper_gvec_3_ptr * const ftsmul_fns[4] = {
65
+ NULL, gen_helper_gvec_ftsmul_h,
66
+ gen_helper_gvec_ftsmul_s, gen_helper_gvec_ftsmul_d
67
+};
68
+TRANS_FEAT_NONSTREAMING(FTSMUL, aa64_sve, gen_gvec_fpst_arg_zzz,
69
+ ftsmul_fns[a->esz], a, 0)
70
+
71
/*
72
*** SVE Floating Point Arithmetic - Predicated Group
73
*/
74
--
75
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-10-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 1 -
12
target/arm/translate-sve.c | 12 ++++++------
13
2 files changed, 6 insertions(+), 7 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA
24
FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions
25
FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar)
26
FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm)
27
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/translate-sve.c
30
+++ b/target/arm/translate-sve.c
31
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FMLALT_zzxw, aa64_sve2, do_FMLAL_zzxw, a, false, true)
32
TRANS_FEAT(FMLSLB_zzxw, aa64_sve2, do_FMLAL_zzxw, a, true, false)
33
TRANS_FEAT(FMLSLT_zzxw, aa64_sve2, do_FMLAL_zzxw, a, true, true)
34
35
-TRANS_FEAT(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
36
- gen_helper_gvec_smmla_b, a, 0)
37
-TRANS_FEAT(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
38
- gen_helper_gvec_usmmla_b, a, 0)
39
-TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
40
- gen_helper_gvec_ummla_b, a, 0)
41
+TRANS_FEAT_NONSTREAMING(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
42
+ gen_helper_gvec_smmla_b, a, 0)
43
+TRANS_FEAT_NONSTREAMING(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
44
+ gen_helper_gvec_usmmla_b, a, 0)
45
+TRANS_FEAT_NONSTREAMING(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
46
+ gen_helper_gvec_ummla_b, a, 0)
47
48
TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
49
gen_helper_gvec_bfdot, a, 0)
50
--
51
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-11-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 1 -
12
target/arm/translate-sve.c | 35 ++++++++++++++++++-----------------
13
2 files changed, 18 insertions(+), 18 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions
24
FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar)
25
FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm)
26
FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector)
27
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/translate-sve.c
30
+++ b/target/arm/translate-sve.c
31
@@ -XXX,XX +XXX,XX @@ DO_SVE2_ZZZ_NARROW(RSUBHNT, rsubhnt)
32
static gen_helper_gvec_flags_4 * const match_fns[4] = {
33
gen_helper_sve2_match_ppzz_b, gen_helper_sve2_match_ppzz_h, NULL, NULL
34
};
35
-TRANS_FEAT(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz])
36
+TRANS_FEAT_NONSTREAMING(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz])
37
38
static gen_helper_gvec_flags_4 * const nmatch_fns[4] = {
39
gen_helper_sve2_nmatch_ppzz_b, gen_helper_sve2_nmatch_ppzz_h, NULL, NULL
40
};
41
-TRANS_FEAT(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz])
42
+TRANS_FEAT_NONSTREAMING(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz])
43
44
static gen_helper_gvec_4 * const histcnt_fns[4] = {
45
NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d
46
};
47
-TRANS_FEAT(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz,
48
- histcnt_fns[a->esz], a, 0)
49
+TRANS_FEAT_NONSTREAMING(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz,
50
+ histcnt_fns[a->esz], a, 0)
51
52
-TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz,
53
- a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0)
54
+TRANS_FEAT_NONSTREAMING(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz,
55
+ a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0)
56
57
DO_ZPZZ_FP(FADDP, aa64_sve2, sve2_faddp_zpzz)
58
DO_ZPZZ_FP(FMAXNMP, aa64_sve2, sve2_fmaxnmp_zpzz)
59
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_zzzz,
60
TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
61
a->esz == 2 ? gen_helper_gvec_usdot_b : NULL, a, 0)
62
63
-TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz,
64
- gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt)
65
+TRANS_FEAT_NONSTREAMING(AESMC, aa64_sve2_aes, gen_gvec_ool_zz,
66
+ gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt)
67
68
-TRANS_FEAT(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
69
- gen_helper_crypto_aese, a, false)
70
-TRANS_FEAT(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
71
- gen_helper_crypto_aese, a, true)
72
+TRANS_FEAT_NONSTREAMING(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
73
+ gen_helper_crypto_aese, a, false)
74
+TRANS_FEAT_NONSTREAMING(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
75
+ gen_helper_crypto_aese, a, true)
76
77
-TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
78
- gen_helper_crypto_sm4e, a, 0)
79
-TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
80
- gen_helper_crypto_sm4ekey, a, 0)
81
+TRANS_FEAT_NONSTREAMING(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
82
+ gen_helper_crypto_sm4e, a, 0)
83
+TRANS_FEAT_NONSTREAMING(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
84
+ gen_helper_crypto_sm4ekey, a, 0)
85
86
-TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a)
87
+TRANS_FEAT_NONSTREAMING(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz,
88
+ gen_gvec_rax1, a)
89
90
TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz,
91
gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR)
92
--
93
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-12-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 9 ---------
12
target/arm/translate-sve.c | 6 ++++++
13
2 files changed, 6 insertions(+), 9 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar)
24
FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm)
25
FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector)
26
-FAIL 1000 010- -01- ---- 1--- ---- ---- ---- # SVE 32-bit gather load (vector+imm)
27
-FAIL 1000 0100 0-0- ---- 0--- ---- ---- ---- # SVE 32-bit gather load byte (scalar+vector)
28
-FAIL 1000 0100 1--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load half (scalar+vector)
29
-FAIL 1000 0101 0--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load word (scalar+vector)
30
FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar)
31
FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm)
32
FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar)
33
FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm)
34
FAIL 1100 010- ---- ---- ---- ---- ---- ---- # SVE 64-bit gather load/prefetch
35
-FAIL 1110 010- -00- ---- 001- ---- ---- ---- # SVE2 64-bit scatter NT store (vector+scalar)
36
-FAIL 1110 010- -10- ---- 001- ---- ---- ---- # SVE2 32-bit scatter NT store (vector+scalar)
37
-FAIL 1110 010- ---- ---- 1-0- ---- ---- ---- # SVE scatter store (scalar+32-bit vector)
38
-FAIL 1110 010- ---- ---- 101- ---- ---- ---- # SVE scatter store (misc)
39
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/translate-sve.c
42
+++ b/target/arm/translate-sve.c
43
@@ -XXX,XX +XXX,XX @@ static bool trans_LD1_zprz(DisasContext *s, arg_LD1_zprz *a)
44
if (!dc_isar_feature(aa64_sve, s)) {
45
return false;
46
}
47
+ s->is_nonstreaming = true;
48
if (!sve_access_check(s)) {
49
return true;
50
}
51
@@ -XXX,XX +XXX,XX @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a)
52
if (!dc_isar_feature(aa64_sve, s)) {
53
return false;
54
}
55
+ s->is_nonstreaming = true;
56
if (!sve_access_check(s)) {
57
return true;
58
}
59
@@ -XXX,XX +XXX,XX @@ static bool trans_LDNT1_zprz(DisasContext *s, arg_LD1_zprz *a)
60
if (!dc_isar_feature(aa64_sve2, s)) {
61
return false;
62
}
63
+ s->is_nonstreaming = true;
64
if (!sve_access_check(s)) {
65
return true;
66
}
67
@@ -XXX,XX +XXX,XX @@ static bool trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a)
68
if (!dc_isar_feature(aa64_sve, s)) {
69
return false;
70
}
71
+ s->is_nonstreaming = true;
72
if (!sve_access_check(s)) {
73
return true;
74
}
75
@@ -XXX,XX +XXX,XX @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a)
76
if (!dc_isar_feature(aa64_sve, s)) {
77
return false;
78
}
79
+ s->is_nonstreaming = true;
80
if (!sve_access_check(s)) {
81
return true;
82
}
83
@@ -XXX,XX +XXX,XX @@ static bool trans_STNT1_zprz(DisasContext *s, arg_ST1_zprz *a)
84
if (!dc_isar_feature(aa64_sve2, s)) {
85
return false;
86
}
87
+ s->is_nonstreaming = true;
88
if (!sve_access_check(s)) {
89
return true;
90
}
91
--
92
2.25.1
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
These buffers should be aligned on 16 bytes.
3
Mark these as a non-streaming instructions, which should trap if full
4
a64 support is not enabled in streaming mode. In this case, introduce
5
PRF_ns (prefetch non-streaming) to handle the checks.
4
6
5
Ignore invalid RX and TX buffer addresses and log an error. All
6
incoming and outgoing traffic will be dropped because no valid RX or
7
TX descriptors will be available.
8
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
Message-id: 20200114103433.30534-4-clg@kaod.org
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220708151540.18136-13-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
11
---
14
hw/net/ftgmac100.c | 13 +++++++++++++
12
target/arm/sme-fa64.decode | 3 ---
15
1 file changed, 13 insertions(+)
13
target/arm/sve.decode | 10 +++++-----
14
target/arm/translate-sve.c | 11 +++++++++++
15
3 files changed, 16 insertions(+), 8 deletions(-)
16
16
17
diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
17
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
18
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/net/ftgmac100.c
19
--- a/target/arm/sme-fa64.decode
20
+++ b/hw/net/ftgmac100.c
20
+++ b/target/arm/sme-fa64.decode
21
@@ -XXX,XX +XXX,XX @@ typedef struct {
21
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
22
uint32_t des3;
22
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
23
} FTGMAC100Desc;
23
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
24
24
25
+#define FTGMAC100_DESC_ALIGNMENT 16
25
-FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm)
26
-FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector)
27
FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar)
28
FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm)
29
FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar)
30
FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm)
31
-FAIL 1100 010- ---- ---- ---- ---- ---- ---- # SVE 64-bit gather load/prefetch
32
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/sve.decode
35
+++ b/target/arm/sve.decode
36
@@ -XXX,XX +XXX,XX @@ LD1RO_zpri 1010010 .. 01 0.... 001 ... ..... ..... \
37
@rpri_load_msz nreg=0
38
39
# SVE 32-bit gather prefetch (scalar plus 32-bit scaled offsets)
40
-PRF 1000010 00 -1 ----- 0-- --- ----- 0 ----
41
+PRF_ns 1000010 00 -1 ----- 0-- --- ----- 0 ----
42
43
# SVE 32-bit gather prefetch (vector plus immediate)
44
-PRF 1000010 -- 00 ----- 111 --- ----- 0 ----
45
+PRF_ns 1000010 -- 00 ----- 111 --- ----- 0 ----
46
47
# SVE contiguous prefetch (scalar plus immediate)
48
PRF 1000010 11 1- ----- 0-- --- ----- 0 ----
49
@@ -XXX,XX +XXX,XX @@ LD1_zpiz 1100010 .. 01 ..... 1.. ... ..... ..... \
50
@rpri_g_load esz=3
51
52
# SVE 64-bit gather prefetch (scalar plus 64-bit scaled offsets)
53
-PRF 1100010 00 11 ----- 1-- --- ----- 0 ----
54
+PRF_ns 1100010 00 11 ----- 1-- --- ----- 0 ----
55
56
# SVE 64-bit gather prefetch (scalar plus unpacked 32-bit scaled offsets)
57
-PRF 1100010 00 -1 ----- 0-- --- ----- 0 ----
58
+PRF_ns 1100010 00 -1 ----- 0-- --- ----- 0 ----
59
60
# SVE 64-bit gather prefetch (vector plus immediate)
61
-PRF 1100010 -- 00 ----- 111 --- ----- 0 ----
62
+PRF_ns 1100010 -- 00 ----- 111 --- ----- 0 ----
63
64
### SVE Memory Store Group
65
66
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/translate-sve.c
69
+++ b/target/arm/translate-sve.c
70
@@ -XXX,XX +XXX,XX @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a)
71
return true;
72
}
73
74
+static bool trans_PRF_ns(DisasContext *s, arg_PRF_ns *a)
75
+{
76
+ if (!dc_isar_feature(aa64_sve, s)) {
77
+ return false;
78
+ }
79
+ /* Prefetch is a nop within QEMU. */
80
+ s->is_nonstreaming = true;
81
+ (void)sve_access_check(s);
82
+ return true;
83
+}
26
+
84
+
27
/*
85
/*
28
* Specific RTL8211E MII Registers
86
* Move Prefix
29
*/
87
*
30
@@ -XXX,XX +XXX,XX @@ static void ftgmac100_write(void *opaque, hwaddr addr,
31
s->itc = value;
32
break;
33
case FTGMAC100_RXR_BADR: /* Ring buffer address */
34
+ if (!QEMU_IS_ALIGNED(value, FTGMAC100_DESC_ALIGNMENT)) {
35
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad RX buffer alignment 0x%"
36
+ HWADDR_PRIx "\n", __func__, value);
37
+ return;
38
+ }
39
+
40
s->rx_ring = value;
41
s->rx_descriptor = s->rx_ring;
42
break;
43
@@ -XXX,XX +XXX,XX @@ static void ftgmac100_write(void *opaque, hwaddr addr,
44
break;
45
46
case FTGMAC100_NPTXR_BADR: /* Transmit buffer address */
47
+ if (!QEMU_IS_ALIGNED(value, FTGMAC100_DESC_ALIGNMENT)) {
48
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad TX buffer alignment 0x%"
49
+ HWADDR_PRIx "\n", __func__, value);
50
+ return;
51
+ }
52
s->tx_ring = value;
53
s->tx_descriptor = s->tx_ring;
54
break;
55
--
88
--
56
2.20.1
89
2.25.1
57
58
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-14-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 2 --
12
target/arm/translate-sve.c | 2 ++
13
2 files changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
21
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
22
23
-FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar)
24
-FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm)
25
FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar)
26
FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm)
27
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/translate-sve.c
30
+++ b/target/arm/translate-sve.c
31
@@ -XXX,XX +XXX,XX @@ static bool trans_LDFF1_zprr(DisasContext *s, arg_rprr_load *a)
32
if (!dc_isar_feature(aa64_sve, s)) {
33
return false;
34
}
35
+ s->is_nonstreaming = true;
36
if (sve_access_check(s)) {
37
TCGv_i64 addr = new_tmp_a64(s);
38
tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype));
39
@@ -XXX,XX +XXX,XX @@ static bool trans_LDNF1_zpri(DisasContext *s, arg_rpri_load *a)
40
if (!dc_isar_feature(aa64_sve, s)) {
41
return false;
42
}
43
+ s->is_nonstreaming = true;
44
if (sve_access_check(s)) {
45
int vsz = vec_full_reg_size(s);
46
int elements = vsz >> dtype_esz[a->dtype];
47
--
48
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Mark these as a non-streaming instructions, which should trap
4
if full a64 support is not enabled in streaming mode.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-15-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme-fa64.decode | 3 ---
12
target/arm/translate-sve.c | 2 ++
13
2 files changed, 2 insertions(+), 3 deletions(-)
14
15
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme-fa64.decode
18
+++ b/target/arm/sme-fa64.decode
19
@@ -XXX,XX +XXX,XX @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS
20
# --11 1100 --0- ---- ---- ---- ---- ---- # Load/store FP register (unscaled imm)
21
# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset)
22
# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm)
23
-
24
-FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar)
25
-FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm)
26
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/translate-sve.c
29
+++ b/target/arm/translate-sve.c
30
@@ -XXX,XX +XXX,XX @@ static bool trans_LD1RO_zprr(DisasContext *s, arg_rprr_load *a)
31
if (a->rm == 31) {
32
return false;
33
}
34
+ s->is_nonstreaming = true;
35
if (sve_access_check(s)) {
36
TCGv_i64 addr = new_tmp_a64(s);
37
tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype));
38
@@ -XXX,XX +XXX,XX @@ static bool trans_LD1RO_zpri(DisasContext *s, arg_rpri_load *a)
39
if (!dc_isar_feature(aa64_sve_f64mm, s)) {
40
return false;
41
}
42
+ s->is_nonstreaming = true;
43
if (sve_access_check(s)) {
44
TCGv_i64 addr = new_tmp_a64(s);
45
tcg_gen_addi_i64(addr, cpu_reg_sp(s, a->rn), a->imm * 32);
46
--
47
2.25.1
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
The overhead for the OpenBMC firmware images using the a custom U-Boot
3
These functions will be used to verify that the cpu
4
is around 2 seconds, which is fine, but with a U-Boot from mainline,
4
is in the correct state for a given instruction.
5
it takes an extra 50 seconds or so to reach Linux. A quick survey on
6
the number of reads performed on the flash memory region gives the
7
following figures :
8
5
9
OpenBMC U-Boot 922478 (~ 3.5 MBytes)
10
Mainline U-Boot 20569977 (~ 80 MBytes)
11
12
QEMU must be trashing the TCG TBs and reloading text very often. Some
13
addresses are read more than 250.000 times. Until we find a solution
14
to improve boot time, execution from MMIO is not activated by default.
15
16
Setting this option also breaks migration compatibility.
17
18
Signed-off-by: Cédric Le Goater <clg@kaod.org>
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20200114103433.30534-5-clg@kaod.org
8
Message-id: 20220708151540.18136-16-richard.henderson@linaro.org
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
---
10
---
24
include/hw/arm/aspeed.h | 2 ++
11
target/arm/translate-a64.h | 21 +++++++++++++++++++++
25
hw/arm/aspeed.c | 44 ++++++++++++++++++++++++++++++++++++-----
12
target/arm/translate-a64.c | 34 ++++++++++++++++++++++++++++++++++
26
2 files changed, 41 insertions(+), 5 deletions(-)
13
2 files changed, 55 insertions(+)
27
14
28
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
15
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
29
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
30
--- a/include/hw/arm/aspeed.h
17
--- a/target/arm/translate-a64.h
31
+++ b/include/hw/arm/aspeed.h
18
+++ b/target/arm/translate-a64.h
32
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedBoardState AspeedBoardState;
19
@@ -XXX,XX +XXX,XX @@ void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v);
33
20
bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn,
34
typedef struct AspeedMachine {
21
unsigned int imms, unsigned int immr);
35
MachineState parent_obj;
22
bool sve_access_check(DisasContext *s);
23
+bool sme_enabled_check(DisasContext *s);
24
+bool sme_enabled_check_with_svcr(DisasContext *s, unsigned);
36
+
25
+
37
+ bool mmio_exec;
26
+/* This function corresponds to CheckStreamingSVEEnabled. */
38
} AspeedMachine;
27
+static inline bool sme_sm_enabled_check(DisasContext *s)
39
40
#define ASPEED_MACHINE_CLASS(klass) \
41
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/hw/arm/aspeed.c
44
+++ b/hw/arm/aspeed.c
45
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
46
* SoC and 128MB for the AST2500 SoC, which is twice as big as
47
* needed by the flash modules of the Aspeed machines.
48
*/
49
- memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
50
- fl->size, &error_abort);
51
- memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
52
- boot_rom);
53
- write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort);
54
+ if (ASPEED_MACHINE(machine)->mmio_exec) {
55
+ memory_region_init_alias(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
56
+ &fl->mmio, 0, fl->size);
57
+ memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
58
+ boot_rom);
59
+ } else {
60
+ memory_region_init_rom(boot_rom, OBJECT(bmc), "aspeed.boot_rom",
61
+ fl->size, &error_abort);
62
+ memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
63
+ boot_rom);
64
+ write_boot_rom(drive0, FIRMWARE_ADDR, fl->size, &error_abort);
65
+ }
66
}
67
68
aspeed_board_binfo.ram_size = ram_size;
69
@@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
70
/* Bus 11: TODO ucd90160@64 */
71
}
72
73
+static bool aspeed_get_mmio_exec(Object *obj, Error **errp)
74
+{
28
+{
75
+ return ASPEED_MACHINE(obj)->mmio_exec;
29
+ return sme_enabled_check_with_svcr(s, R_SVCR_SM_MASK);
76
+}
30
+}
77
+
31
+
78
+static void aspeed_set_mmio_exec(Object *obj, bool value, Error **errp)
32
+/* This function corresponds to CheckSMEAndZAEnabled. */
33
+static inline bool sme_za_enabled_check(DisasContext *s)
79
+{
34
+{
80
+ ASPEED_MACHINE(obj)->mmio_exec = value;
35
+ return sme_enabled_check_with_svcr(s, R_SVCR_ZA_MASK);
81
+}
36
+}
82
+
37
+
83
+static void aspeed_machine_instance_init(Object *obj)
38
+/* Note that this function corresponds to CheckStreamingSVEAndZAEnabled. */
39
+static inline bool sme_smza_enabled_check(DisasContext *s)
84
+{
40
+{
85
+ ASPEED_MACHINE(obj)->mmio_exec = false;
41
+ return sme_enabled_check_with_svcr(s, R_SVCR_SM_MASK | R_SVCR_ZA_MASK);
86
+}
42
+}
87
+
43
+
88
+static void aspeed_machine_class_props_init(ObjectClass *oc)
44
TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr);
45
TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write,
46
bool tag_checked, int log2_size);
47
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/target/arm/translate-a64.c
50
+++ b/target/arm/translate-a64.c
51
@@ -XXX,XX +XXX,XX @@ static bool sme_access_check(DisasContext *s)
52
return true;
53
}
54
55
+/* This function corresponds to CheckSMEEnabled. */
56
+bool sme_enabled_check(DisasContext *s)
89
+{
57
+{
90
+ object_class_property_add_bool(oc, "execute-in-place",
58
+ /*
91
+ aspeed_get_mmio_exec,
59
+ * Note that unlike sve_excp_el, we have not constrained sme_excp_el
92
+ aspeed_set_mmio_exec, &error_abort);
60
+ * to be zero when fp_excp_el has priority. This is because we need
93
+ object_class_property_set_description(oc, "execute-in-place",
61
+ * sme_excp_el by itself for cpregs access checks.
94
+ "boot directly from CE0 flash device", &error_abort);
62
+ */
63
+ if (!s->fp_excp_el || s->sme_excp_el < s->fp_excp_el) {
64
+ s->fp_access_checked = true;
65
+ return sme_access_check(s);
66
+ }
67
+ return fp_access_check_only(s);
95
+}
68
+}
96
+
69
+
97
static void aspeed_machine_class_init(ObjectClass *oc, void *data)
70
+/* Common subroutine for CheckSMEAnd*Enabled. */
98
{
71
+bool sme_enabled_check_with_svcr(DisasContext *s, unsigned req)
99
MachineClass *mc = MACHINE_CLASS(oc);
72
+{
100
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
73
+ if (!sme_enabled_check(s)) {
101
mc->no_floppy = 1;
74
+ return false;
102
mc->no_cdrom = 1;
75
+ }
103
mc->no_parallel = 1;
76
+ if (FIELD_EX64(req, SVCR, SM) && !s->pstate_sm) {
77
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
78
+ syn_smetrap(SME_ET_NotStreaming, false));
79
+ return false;
80
+ }
81
+ if (FIELD_EX64(req, SVCR, ZA) && !s->pstate_za) {
82
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
83
+ syn_smetrap(SME_ET_InactiveZA, false));
84
+ return false;
85
+ }
86
+ return true;
87
+}
104
+
88
+
105
+ aspeed_machine_class_props_init(oc);
89
/*
106
}
90
* This utility function is for doing register extension with an
107
91
* optional shift. You will likely want to pass a temporary for the
108
static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data)
109
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_machine_types[] = {
110
.name = TYPE_ASPEED_MACHINE,
111
.parent = TYPE_MACHINE,
112
.instance_size = sizeof(AspeedMachine),
113
+ .instance_init = aspeed_machine_instance_init,
114
.class_size = sizeof(AspeedMachineClass),
115
.class_init = aspeed_machine_class_init,
116
.abstract = true,
117
--
92
--
118
2.20.1
93
2.25.1
119
120
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
The pseudocode for CheckSVEEnabled gains a check for Streaming
4
SVE mode, and for SME present but SVE absent.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-17-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate-a64.c | 22 ++++++++++++++++------
12
1 file changed, 16 insertions(+), 6 deletions(-)
13
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
17
+++ b/target/arm/translate-a64.c
18
@@ -XXX,XX +XXX,XX @@ static bool fp_access_check(DisasContext *s)
19
return true;
20
}
21
22
-/* Check that SVE access is enabled. If it is, return true.
23
+/*
24
+ * Check that SVE access is enabled. If it is, return true.
25
* If not, emit code to generate an appropriate exception and return false.
26
+ * This function corresponds to CheckSVEEnabled().
27
*/
28
bool sve_access_check(DisasContext *s)
29
{
30
- if (s->sve_excp_el) {
31
- assert(!s->sve_access_checked);
32
- s->sve_access_checked = true;
33
-
34
+ if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) {
35
+ assert(dc_isar_feature(aa64_sme, s));
36
+ if (!sme_sm_enabled_check(s)) {
37
+ goto fail_exit;
38
+ }
39
+ } else if (s->sve_excp_el) {
40
gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
41
syn_sve_access_trap(), s->sve_excp_el);
42
- return false;
43
+ goto fail_exit;
44
}
45
s->sve_access_checked = true;
46
return fp_access_check(s);
47
+
48
+ fail_exit:
49
+ /* Assert that we only raise one exception per instruction. */
50
+ assert(!s->sve_access_checked);
51
+ s->sve_access_checked = true;
52
+ return false;
53
}
54
55
/*
56
--
57
2.25.1
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Deprecate device_legacy_reset(), qdev_reset_all() and
3
These SME instructions are nominally within the SVE decode space,
4
qbus_reset_all() to be replaced by new functions
4
so we add them to sve.decode and translate-sve.c.
5
device_cold_reset() and bus_cold_reset() which uses resettable API.
6
5
7
Also introduce resettable_cold_reset_fn() which may be used as a
8
replacement for qdev_reset_all_fn and qbus_reset_all_fn().
9
10
Following patches will be needed to look at legacy reset call sites
11
and switch to resettable api. The legacy functions will be removed
12
when unused.
13
14
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
15
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
18
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20220708151540.18136-18-richard.henderson@linaro.org
19
Message-id: 20200123132823.1117486-9-damien.hedde@greensocs.com
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
---
10
---
22
include/hw/qdev-core.h | 27 +++++++++++++++++++++++++++
11
target/arm/translate-a64.h | 12 ++++++++++++
23
include/hw/resettable.h | 9 +++++++++
12
target/arm/sve.decode | 5 ++++-
24
hw/core/bus.c | 5 +++++
13
target/arm/translate-sve.c | 38 ++++++++++++++++++++++++++++++++++++++
25
hw/core/qdev.c | 5 +++++
14
3 files changed, 54 insertions(+), 1 deletion(-)
26
hw/core/resettable.c | 5 +++++
27
5 files changed, 51 insertions(+)
28
15
29
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
16
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
30
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
31
--- a/include/hw/qdev-core.h
18
--- a/target/arm/translate-a64.h
32
+++ b/include/hw/qdev-core.h
19
+++ b/target/arm/translate-a64.h
33
@@ -XXX,XX +XXX,XX @@ int qdev_walk_children(DeviceState *dev,
20
@@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s)
34
qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn,
21
return s->vl;
35
void *opaque);
36
37
+/**
38
+ * @qdev_reset_all:
39
+ * Reset @dev. See @qbus_reset_all() for more details.
40
+ *
41
+ * Note: This function is deprecated and will be removed when it becomes unused.
42
+ * Please use device_cold_reset() now.
43
+ */
44
void qdev_reset_all(DeviceState *dev);
45
void qdev_reset_all_fn(void *opaque);
46
47
@@ -XXX,XX +XXX,XX @@ void qdev_reset_all_fn(void *opaque);
48
* hard reset means that qbus_reset_all will reset all state of the device.
49
* For PCI devices, for example, this will include the base address registers
50
* or configuration space.
51
+ *
52
+ * Note: This function is deprecated and will be removed when it becomes unused.
53
+ * Please use bus_cold_reset() now.
54
*/
55
void qbus_reset_all(BusState *bus);
56
void qbus_reset_all_fn(void *opaque);
57
58
+/**
59
+ * device_cold_reset:
60
+ * Reset device @dev and perform a recursive processing using the resettable
61
+ * interface. It triggers a RESET_TYPE_COLD.
62
+ */
63
+void device_cold_reset(DeviceState *dev);
64
+
65
+/**
66
+ * bus_cold_reset:
67
+ *
68
+ * Reset bus @bus and perform a recursive processing using the resettable
69
+ * interface. It triggers a RESET_TYPE_COLD.
70
+ */
71
+void bus_cold_reset(BusState *bus);
72
+
73
/**
74
* device_is_in_reset:
75
* Return true if the device @dev is currently being reset.
76
@@ -XXX,XX +XXX,XX @@ void qdev_machine_init(void);
77
* device_legacy_reset:
78
*
79
* Reset a single device (by calling the reset method).
80
+ * Note: This function is deprecated and will be removed when it becomes unused.
81
+ * Please use device_cold_reset() now.
82
*/
83
void device_legacy_reset(DeviceState *dev);
84
85
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
86
index XXXXXXX..XXXXXXX 100644
87
--- a/include/hw/resettable.h
88
+++ b/include/hw/resettable.h
89
@@ -XXX,XX +XXX,XX @@ bool resettable_is_in_reset(Object *obj);
90
*/
91
void resettable_change_parent(Object *obj, Object *newp, Object *oldp);
92
93
+/**
94
+ * resettable_cold_reset_fn:
95
+ * Helper to call resettable_reset((Object *) opaque, RESET_TYPE_COLD).
96
+ *
97
+ * This function is typically useful to register a reset handler with
98
+ * qemu_register_reset.
99
+ */
100
+void resettable_cold_reset_fn(void *opaque);
101
+
102
/**
103
* resettable_class_set_parent_phases:
104
*
105
diff --git a/hw/core/bus.c b/hw/core/bus.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/hw/core/bus.c
108
+++ b/hw/core/bus.c
109
@@ -XXX,XX +XXX,XX @@ int qbus_walk_children(BusState *bus,
110
return 0;
111
}
22
}
112
23
113
+void bus_cold_reset(BusState *bus)
24
+/* Return the byte size of the vector register, SVL / 8. */
25
+static inline int streaming_vec_reg_size(DisasContext *s)
114
+{
26
+{
115
+ resettable_reset(OBJECT(bus), RESET_TYPE_COLD);
27
+ return s->svl;
116
+}
28
+}
117
+
29
+
118
bool bus_is_in_reset(BusState *bus)
30
/*
119
{
31
* Return the offset info CPUARMState of the predicate vector register Pn.
120
return resettable_is_in_reset(OBJECT(bus));
32
* Note for this purpose, FFR is P16.
121
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
33
@@ -XXX,XX +XXX,XX @@ static inline int pred_full_reg_size(DisasContext *s)
122
index XXXXXXX..XXXXXXX 100644
34
return s->vl >> 3;
123
--- a/hw/core/qdev.c
124
+++ b/hw/core/qdev.c
125
@@ -XXX,XX +XXX,XX @@ void qbus_reset_all_fn(void *opaque)
126
qbus_reset_all(bus);
127
}
35
}
128
36
129
+void device_cold_reset(DeviceState *dev)
37
+/* Return the byte size of the predicate register, SVL / 64. */
38
+static inline int streaming_pred_reg_size(DisasContext *s)
130
+{
39
+{
131
+ resettable_reset(OBJECT(dev), RESET_TYPE_COLD);
40
+ return s->svl >> 3;
132
+}
41
+}
133
+
42
+
134
bool device_is_in_reset(DeviceState *dev)
43
/*
135
{
44
* Round up the size of a register to a size allowed by
136
return resettable_is_in_reset(OBJECT(dev));
45
* the tcg vector infrastructure. Any operation which uses this
137
diff --git a/hw/core/resettable.c b/hw/core/resettable.c
46
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
138
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
139
--- a/hw/core/resettable.c
48
--- a/target/arm/sve.decode
140
+++ b/hw/core/resettable.c
49
+++ b/target/arm/sve.decode
141
@@ -XXX,XX +XXX,XX @@ void resettable_change_parent(Object *obj, Object *newp, Object *oldp)
50
@@ -XXX,XX +XXX,XX @@ INDEX_ri 00000100 esz:2 1 imm:s5 010001 rn:5 rd:5
142
}
51
# SVE index generation (register start, register increment)
52
INDEX_rr 00000100 .. 1 ..... 010011 ..... ..... @rd_rn_rm
53
54
-### SVE Stack Allocation Group
55
+### SVE / Streaming SVE Stack Allocation Group
56
57
# SVE stack frame adjustment
58
ADDVL 00000100 001 ..... 01010 ...... ..... @rd_rn_i6
59
+ADDSVL 00000100 001 ..... 01011 ...... ..... @rd_rn_i6
60
ADDPL 00000100 011 ..... 01010 ...... ..... @rd_rn_i6
61
+ADDSPL 00000100 011 ..... 01011 ...... ..... @rd_rn_i6
62
63
# SVE stack frame size
64
RDVL 00000100 101 11111 01010 imm:s6 rd:5
65
+RDSVL 00000100 101 11111 01011 imm:s6 rd:5
66
67
### SVE Bitwise Shift - Unpredicated Group
68
69
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
70
index XXXXXXX..XXXXXXX 100644
71
--- a/target/arm/translate-sve.c
72
+++ b/target/arm/translate-sve.c
73
@@ -XXX,XX +XXX,XX @@ static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a)
74
return true;
143
}
75
}
144
76
145
+void resettable_cold_reset_fn(void *opaque)
77
+static bool trans_ADDSVL(DisasContext *s, arg_ADDSVL *a)
146
+{
78
+{
147
+ resettable_reset((Object *) opaque, RESET_TYPE_COLD);
79
+ if (!dc_isar_feature(aa64_sme, s)) {
80
+ return false;
81
+ }
82
+ if (sme_enabled_check(s)) {
83
+ TCGv_i64 rd = cpu_reg_sp(s, a->rd);
84
+ TCGv_i64 rn = cpu_reg_sp(s, a->rn);
85
+ tcg_gen_addi_i64(rd, rn, a->imm * streaming_vec_reg_size(s));
86
+ }
87
+ return true;
148
+}
88
+}
149
+
89
+
150
void resettable_class_set_parent_phases(ResettableClass *rc,
90
static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a)
151
ResettableEnterPhase enter,
91
{
152
ResettableHoldPhase hold,
92
if (!dc_isar_feature(aa64_sve, s)) {
93
@@ -XXX,XX +XXX,XX @@ static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a)
94
return true;
95
}
96
97
+static bool trans_ADDSPL(DisasContext *s, arg_ADDSPL *a)
98
+{
99
+ if (!dc_isar_feature(aa64_sme, s)) {
100
+ return false;
101
+ }
102
+ if (sme_enabled_check(s)) {
103
+ TCGv_i64 rd = cpu_reg_sp(s, a->rd);
104
+ TCGv_i64 rn = cpu_reg_sp(s, a->rn);
105
+ tcg_gen_addi_i64(rd, rn, a->imm * streaming_pred_reg_size(s));
106
+ }
107
+ return true;
108
+}
109
+
110
static bool trans_RDVL(DisasContext *s, arg_RDVL *a)
111
{
112
if (!dc_isar_feature(aa64_sve, s)) {
113
@@ -XXX,XX +XXX,XX @@ static bool trans_RDVL(DisasContext *s, arg_RDVL *a)
114
return true;
115
}
116
117
+static bool trans_RDSVL(DisasContext *s, arg_RDSVL *a)
118
+{
119
+ if (!dc_isar_feature(aa64_sme, s)) {
120
+ return false;
121
+ }
122
+ if (sme_enabled_check(s)) {
123
+ TCGv_i64 reg = cpu_reg(s, a->rd);
124
+ tcg_gen_movi_i64(reg, a->imm * streaming_vec_reg_size(s));
125
+ }
126
+ return true;
127
+}
128
+
129
/*
130
*** SVE Compute Vector Address Group
131
*/
153
--
132
--
154
2.20.1
133
2.25.1
155
156
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Add a function resettable_change_parent() to do the required
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
plumbing when changing the parent a of Resettable object.
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
5
Message-id: 20220708151540.18136-19-richard.henderson@linaro.org
6
We need to make sure that the reset state of the object remains
7
coherent with the reset state of the new parent.
8
9
We make the 2 following hypothesis:
10
+ when an object is put in a parent under reset, the object goes in
11
reset.
12
+ when an object is removed from a parent under reset, the object
13
leaves reset.
14
15
The added function avoids any glitch if both old and new parent are
16
already in reset.
17
18
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
21
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22
Message-id: 20200123132823.1117486-6-damien.hedde@greensocs.com
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
---
7
---
25
include/hw/resettable.h | 16 +++++++++++
8
target/arm/helper-sme.h | 2 ++
26
hw/core/resettable.c | 62 +++++++++++++++++++++++++++++++++++++++--
9
target/arm/sme.decode | 4 ++++
27
hw/core/trace-events | 1 +
10
target/arm/sme_helper.c | 25 +++++++++++++++++++++++++
28
3 files changed, 77 insertions(+), 2 deletions(-)
11
target/arm/translate-sme.c | 13 +++++++++++++
12
4 files changed, 44 insertions(+)
29
13
30
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
14
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
31
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
32
--- a/include/hw/resettable.h
16
--- a/target/arm/helper-sme.h
33
+++ b/include/hw/resettable.h
17
+++ b/target/arm/helper-sme.h
34
@@ -XXX,XX +XXX,XX @@ void resettable_release_reset(Object *obj, ResetType type);
18
@@ -XXX,XX +XXX,XX @@
35
*/
19
36
bool resettable_is_in_reset(Object *obj);
20
DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32)
37
21
DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32)
38
+/**
39
+ * resettable_change_parent:
40
+ * Indicate that the parent of Ressettable @obj is changing from @oldp to @newp.
41
+ * All 3 objects must implement resettable interface. @oldp or @newp may be
42
+ * NULL.
43
+ *
44
+ * This function will adapt the reset state of @obj so that it is coherent
45
+ * with the reset state of @newp. It may trigger @resettable_assert_reset()
46
+ * or @resettable_release_reset(). It will do such things only if the reset
47
+ * state of @newp and @oldp are different.
48
+ *
49
+ * When using this function during reset, it must only be called during
50
+ * a hold phase method. Calling this during enter or exit phase is an error.
51
+ */
52
+void resettable_change_parent(Object *obj, Object *newp, Object *oldp);
53
+
22
+
54
/**
23
+DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32)
55
* resettable_class_set_parent_phases:
24
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
56
*
57
diff --git a/hw/core/resettable.c b/hw/core/resettable.c
58
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
59
--- a/hw/core/resettable.c
26
--- a/target/arm/sme.decode
60
+++ b/hw/core/resettable.c
27
+++ b/target/arm/sme.decode
61
@@ -XXX,XX +XXX,XX @@ static void resettable_phase_exit(Object *obj, void *opaque, ResetType type);
28
@@ -XXX,XX +XXX,XX @@
62
* enter_phase_in_progress:
29
#
63
* True if we are currently in reset enter phase.
30
# This file is processed by scripts/decodetree.py
64
*
31
#
65
- * Note: This flag is only used to guarantee (using asserts) that the reset
32
+
66
- * API is used correctly. We can use a global variable because we rely on the
33
+### SME Misc
67
+ * exit_phase_in_progress:
34
+
68
+ * count the number of exit phase we are in.
35
+ZERO 11000000 00 001 00000000000 imm:8
69
+ *
36
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
70
+ * Note: These flags are only used to guarantee (using asserts) that the reset
37
index XXXXXXX..XXXXXXX 100644
71
+ * API is used correctly. We can use global variables because we rely on the
38
--- a/target/arm/sme_helper.c
72
* iothread mutex to ensure only one reset operation is in a progress at a
39
+++ b/target/arm/sme_helper.c
73
* given time.
40
@@ -XXX,XX +XXX,XX @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i)
74
*/
41
memset(env->zarray, 0, sizeof(env->zarray));
75
static bool enter_phase_in_progress;
42
}
76
+static unsigned exit_phase_in_progress;
77
78
void resettable_reset(Object *obj, ResetType type)
79
{
80
@@ -XXX,XX +XXX,XX @@ void resettable_release_reset(Object *obj, ResetType type)
81
trace_resettable_reset_release_begin(obj, type);
82
assert(!enter_phase_in_progress);
83
84
+ exit_phase_in_progress += 1;
85
resettable_phase_exit(obj, NULL, type);
86
+ exit_phase_in_progress -= 1;
87
88
trace_resettable_reset_release_end(obj);
89
}
43
}
90
@@ -XXX,XX +XXX,XX @@ static void resettable_phase_exit(Object *obj, void *opaque, ResetType type)
44
+
91
trace_resettable_phase_exit_end(obj, obj_typename, s->count);
45
+void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl)
92
}
93
94
+/*
95
+ * resettable_get_count:
96
+ * Get the count of the Resettable object @obj. Return 0 if @obj is NULL.
97
+ */
98
+static unsigned resettable_get_count(Object *obj)
99
+{
46
+{
100
+ if (obj) {
47
+ uint32_t i;
101
+ ResettableClass *rc = RESETTABLE_GET_CLASS(obj);
102
+ return rc->get_state(obj)->count;
103
+ }
104
+ return 0;
105
+}
106
+
107
+void resettable_change_parent(Object *obj, Object *newp, Object *oldp)
108
+{
109
+ ResettableClass *rc = RESETTABLE_GET_CLASS(obj);
110
+ ResettableState *s = rc->get_state(obj);
111
+ unsigned newp_count = resettable_get_count(newp);
112
+ unsigned oldp_count = resettable_get_count(oldp);
113
+
48
+
114
+ /*
49
+ /*
115
+ * Ensure we do not change parent when in enter or exit phase.
50
+ * Special case clearing the entire ZA space.
116
+ * During these phases, the reset subtree being updated is partly in reset
51
+ * This falls into the CONSTRAINED UNPREDICTABLE zeroing of any
117
+ * and partly not in reset (it depends on the actual position in
52
+ * parts of the ZA storage outside of SVL.
118
+ * resettable_child_foreach()s). We are not able to tell in which part is a
119
+ * leaving or arriving device. Thus we cannot set the reset count of the
120
+ * moving device to the proper value.
121
+ */
53
+ */
122
+ assert(!enter_phase_in_progress && !exit_phase_in_progress);
54
+ if (imm == 0xff) {
123
+ trace_resettable_change_parent(obj, oldp, oldp_count, newp, newp_count);
55
+ memset(env->zarray, 0, sizeof(env->zarray));
56
+ return;
57
+ }
124
+
58
+
125
+ /*
59
+ /*
126
+ * At most one of the two 'for' loops will be executed below
60
+ * Recall that ZAnH.D[m] is spread across ZA[n+8*m],
127
+ * in order to cope with the difference between the two counts.
61
+ * so each row is discontiguous within ZA[].
128
+ */
62
+ */
129
+ /* if newp is more reset than oldp */
63
+ for (i = 0; i < svl; i++) {
130
+ for (unsigned i = oldp_count; i < newp_count; i++) {
64
+ if (imm & (1 << (i % 8))) {
131
+ resettable_assert_reset(obj, RESET_TYPE_COLD);
65
+ memset(&env->zarray[i], 0, svl);
132
+ }
66
+ }
133
+ /*
134
+ * if obj is leaving a bus under reset, we need to ensure
135
+ * hold phase is not pending.
136
+ */
137
+ if (oldp_count && s->hold_phase_pending) {
138
+ resettable_phase_hold(obj, NULL, RESET_TYPE_COLD);
139
+ }
140
+ /* if oldp is more reset than newp */
141
+ for (unsigned i = newp_count; i < oldp_count; i++) {
142
+ resettable_release_reset(obj, RESET_TYPE_COLD);
143
+ }
67
+ }
144
+}
68
+}
69
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
70
index XXXXXXX..XXXXXXX 100644
71
--- a/target/arm/translate-sme.c
72
+++ b/target/arm/translate-sme.c
73
@@ -XXX,XX +XXX,XX @@
74
*/
75
76
#include "decode-sme.c.inc"
145
+
77
+
146
void resettable_class_set_parent_phases(ResettableClass *rc,
78
+
147
ResettableEnterPhase enter,
79
+static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
148
ResettableHoldPhase hold,
80
+{
149
diff --git a/hw/core/trace-events b/hw/core/trace-events
81
+ if (!dc_isar_feature(aa64_sme, s)) {
150
index XXXXXXX..XXXXXXX 100644
82
+ return false;
151
--- a/hw/core/trace-events
83
+ }
152
+++ b/hw/core/trace-events
84
+ if (sme_za_enabled_check(s)) {
153
@@ -XXX,XX +XXX,XX @@ resettable_reset_assert_begin(void *obj, int cold) "obj=%p cold=%d"
85
+ gen_helper_sme_zero(cpu_env, tcg_constant_i32(a->imm),
154
resettable_reset_assert_end(void *obj) "obj=%p"
86
+ tcg_constant_i32(streaming_vec_reg_size(s)));
155
resettable_reset_release_begin(void *obj, int cold) "obj=%p cold=%d"
87
+ }
156
resettable_reset_release_end(void *obj) "obj=%p"
88
+ return true;
157
+resettable_change_parent(void *obj, void *o, unsigned oc, void *n, unsigned nc) "obj=%p from=%p(%d) to=%p(%d)"
89
+}
158
resettable_phase_enter_begin(void *obj, const char *objtype, unsigned count, int type) "obj=%p(%s) count=%d type=%d"
159
resettable_phase_enter_exec(void *obj, const char *objtype, int type, int has_method) "obj=%p(%s) type=%d method=%d"
160
resettable_phase_enter_end(void *obj, const char *objtype, unsigned count) "obj=%p(%s) count=%d"
161
--
90
--
162
2.20.1
91
2.25.1
163
164
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
We can reuse the SVE functions for implementing moves to/from
4
horizontal tile slices, but we need new ones for moves to/from
5
vertical tile slices.
6
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220708151540.18136-20-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/helper-sme.h | 12 +++
13
target/arm/helper-sve.h | 2 +
14
target/arm/translate-a64.h | 8 ++
15
target/arm/translate.h | 5 ++
16
target/arm/sme.decode | 15 ++++
17
target/arm/sme_helper.c | 151 ++++++++++++++++++++++++++++++++++++-
18
target/arm/sve_helper.c | 12 +++
19
target/arm/translate-sme.c | 127 +++++++++++++++++++++++++++++++
20
8 files changed, 331 insertions(+), 1 deletion(-)
21
22
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
23
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/helper-sme.h
25
+++ b/target/arm/helper-sme.h
26
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32)
27
DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32)
28
29
DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32)
30
+
31
+/* Move to/from vertical array slices, i.e. columns, so 'c'. */
32
+DEF_HELPER_FLAGS_4(sme_mova_cz_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
33
+DEF_HELPER_FLAGS_4(sme_mova_zc_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
34
+DEF_HELPER_FLAGS_4(sme_mova_cz_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
35
+DEF_HELPER_FLAGS_4(sme_mova_zc_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
36
+DEF_HELPER_FLAGS_4(sme_mova_cz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
37
+DEF_HELPER_FLAGS_4(sme_mova_zc_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
38
+DEF_HELPER_FLAGS_4(sme_mova_cz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
39
+DEF_HELPER_FLAGS_4(sme_mova_zc_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
40
+DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
41
+DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
42
diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h
43
index XXXXXXX..XXXXXXX 100644
44
--- a/target/arm/helper-sve.h
45
+++ b/target/arm/helper-sve.h
46
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_5(sve_sel_zpzz_s, TCG_CALL_NO_RWG,
47
void, ptr, ptr, ptr, ptr, i32)
48
DEF_HELPER_FLAGS_5(sve_sel_zpzz_d, TCG_CALL_NO_RWG,
49
void, ptr, ptr, ptr, ptr, i32)
50
+DEF_HELPER_FLAGS_5(sve_sel_zpzz_q, TCG_CALL_NO_RWG,
51
+ void, ptr, ptr, ptr, ptr, i32)
52
53
DEF_HELPER_FLAGS_5(sve2_addp_zpzz_b, TCG_CALL_NO_RWG,
54
void, ptr, ptr, ptr, ptr, i32)
55
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
56
index XXXXXXX..XXXXXXX 100644
57
--- a/target/arm/translate-a64.h
58
+++ b/target/arm/translate-a64.h
59
@@ -XXX,XX +XXX,XX @@ static inline int pred_gvec_reg_size(DisasContext *s)
60
return size_for_gvec(pred_full_reg_size(s));
61
}
62
63
+/* Return a newly allocated pointer to the predicate register. */
64
+static inline TCGv_ptr pred_full_reg_ptr(DisasContext *s, int regno)
65
+{
66
+ TCGv_ptr ret = tcg_temp_new_ptr();
67
+ tcg_gen_addi_ptr(ret, cpu_env, pred_full_reg_offset(s, regno));
68
+ return ret;
69
+}
70
+
71
bool disas_sve(DisasContext *, uint32_t);
72
bool disas_sme(DisasContext *, uint32_t);
73
74
diff --git a/target/arm/translate.h b/target/arm/translate.h
75
index XXXXXXX..XXXXXXX 100644
76
--- a/target/arm/translate.h
77
+++ b/target/arm/translate.h
78
@@ -XXX,XX +XXX,XX @@ static inline int plus_2(DisasContext *s, int x)
79
return x + 2;
80
}
81
82
+static inline int plus_12(DisasContext *s, int x)
83
+{
84
+ return x + 12;
85
+}
86
+
87
static inline int times_2(DisasContext *s, int x)
88
{
89
return x * 2;
90
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
91
index XXXXXXX..XXXXXXX 100644
92
--- a/target/arm/sme.decode
93
+++ b/target/arm/sme.decode
94
@@ -XXX,XX +XXX,XX @@
95
### SME Misc
96
97
ZERO 11000000 00 001 00000000000 imm:8
98
+
99
+### SME Move into/from Array
100
+
101
+%mova_rs 13:2 !function=plus_12
102
+&mova esz rs pg zr za_imm v:bool to_vec:bool
103
+
104
+MOVA 11000000 esz:2 00000 0 v:1 .. pg:3 zr:5 0 za_imm:4 \
105
+ &mova to_vec=0 rs=%mova_rs
106
+MOVA 11000000 11 00000 1 v:1 .. pg:3 zr:5 0 za_imm:4 \
107
+ &mova to_vec=0 rs=%mova_rs esz=4
108
+
109
+MOVA 11000000 esz:2 00001 0 v:1 .. pg:3 0 za_imm:4 zr:5 \
110
+ &mova to_vec=1 rs=%mova_rs
111
+MOVA 11000000 11 00001 1 v:1 .. pg:3 0 za_imm:4 zr:5 \
112
+ &mova to_vec=1 rs=%mova_rs esz=4
113
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/target/arm/sme_helper.c
116
+++ b/target/arm/sme_helper.c
117
@@ -XXX,XX +XXX,XX @@
118
119
#include "qemu/osdep.h"
120
#include "cpu.h"
121
-#include "internals.h"
122
+#include "tcg/tcg-gvec-desc.h"
123
#include "exec/helper-proto.h"
124
+#include "qemu/int128.h"
125
+#include "vec_internal.h"
126
127
/* ResetSVEState */
128
void arm_reset_sve_state(CPUARMState *env)
129
@@ -XXX,XX +XXX,XX @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl)
130
}
131
}
132
}
133
+
134
+
135
+/*
136
+ * When considering the ZA storage as an array of elements of
137
+ * type T, the index within that array of the Nth element of
138
+ * a vertical slice of a tile can be calculated like this,
139
+ * regardless of the size of type T. This is because the tiles
140
+ * are interleaved, so if type T is size N bytes then row 1 of
141
+ * the tile is N rows away from row 0. The division by N to
142
+ * convert a byte offset into an array index and the multiplication
143
+ * by N to convert from vslice-index-within-the-tile to
144
+ * the index within the ZA storage cancel out.
145
+ */
146
+#define tile_vslice_index(i) ((i) * sizeof(ARMVectorReg))
147
+
148
+/*
149
+ * When doing byte arithmetic on the ZA storage, the element
150
+ * byteoff bytes away in a tile vertical slice is always this
151
+ * many bytes away in the ZA storage, regardless of the
152
+ * size of the tile element, assuming that byteoff is a multiple
153
+ * of the element size. Again this is because of the interleaving
154
+ * of the tiles. For instance if we have 1 byte per element then
155
+ * each row of the ZA storage has one byte of the vslice data,
156
+ * and (counting from 0) byte 8 goes in row 8 of the storage
157
+ * at offset (8 * row-size-in-bytes).
158
+ * If we have 8 bytes per element then each row of the ZA storage
159
+ * has 8 bytes of the data, but there are 8 interleaved tiles and
160
+ * so byte 8 of the data goes into row 1 of the tile,
161
+ * which is again row 8 of the storage, so the offset is still
162
+ * (8 * row-size-in-bytes). Similarly for other element sizes.
163
+ */
164
+#define tile_vslice_offset(byteoff) ((byteoff) * sizeof(ARMVectorReg))
165
+
166
+
167
+/*
168
+ * Move Zreg vector to ZArray column.
169
+ */
170
+#define DO_MOVA_C(NAME, TYPE, H) \
171
+void HELPER(NAME)(void *za, void *vn, void *vg, uint32_t desc) \
172
+{ \
173
+ int i, oprsz = simd_oprsz(desc); \
174
+ for (i = 0; i < oprsz; ) { \
175
+ uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \
176
+ do { \
177
+ if (pg & 1) { \
178
+ *(TYPE *)(za + tile_vslice_offset(i)) = *(TYPE *)(vn + H(i)); \
179
+ } \
180
+ i += sizeof(TYPE); \
181
+ pg >>= sizeof(TYPE); \
182
+ } while (i & 15); \
183
+ } \
184
+}
185
+
186
+DO_MOVA_C(sme_mova_cz_b, uint8_t, H1)
187
+DO_MOVA_C(sme_mova_cz_h, uint16_t, H1_2)
188
+DO_MOVA_C(sme_mova_cz_s, uint32_t, H1_4)
189
+
190
+void HELPER(sme_mova_cz_d)(void *za, void *vn, void *vg, uint32_t desc)
191
+{
192
+ int i, oprsz = simd_oprsz(desc) / 8;
193
+ uint8_t *pg = vg;
194
+ uint64_t *n = vn;
195
+ uint64_t *a = za;
196
+
197
+ for (i = 0; i < oprsz; i++) {
198
+ if (pg[H1(i)] & 1) {
199
+ a[tile_vslice_index(i)] = n[i];
200
+ }
201
+ }
202
+}
203
+
204
+void HELPER(sme_mova_cz_q)(void *za, void *vn, void *vg, uint32_t desc)
205
+{
206
+ int i, oprsz = simd_oprsz(desc) / 16;
207
+ uint16_t *pg = vg;
208
+ Int128 *n = vn;
209
+ Int128 *a = za;
210
+
211
+ /*
212
+ * Int128 is used here simply to copy 16 bytes, and to simplify
213
+ * the address arithmetic.
214
+ */
215
+ for (i = 0; i < oprsz; i++) {
216
+ if (pg[H2(i)] & 1) {
217
+ a[tile_vslice_index(i)] = n[i];
218
+ }
219
+ }
220
+}
221
+
222
+#undef DO_MOVA_C
223
+
224
+/*
225
+ * Move ZArray column to Zreg vector.
226
+ */
227
+#define DO_MOVA_Z(NAME, TYPE, H) \
228
+void HELPER(NAME)(void *vd, void *za, void *vg, uint32_t desc) \
229
+{ \
230
+ int i, oprsz = simd_oprsz(desc); \
231
+ for (i = 0; i < oprsz; ) { \
232
+ uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \
233
+ do { \
234
+ if (pg & 1) { \
235
+ *(TYPE *)(vd + H(i)) = *(TYPE *)(za + tile_vslice_offset(i)); \
236
+ } \
237
+ i += sizeof(TYPE); \
238
+ pg >>= sizeof(TYPE); \
239
+ } while (i & 15); \
240
+ } \
241
+}
242
+
243
+DO_MOVA_Z(sme_mova_zc_b, uint8_t, H1)
244
+DO_MOVA_Z(sme_mova_zc_h, uint16_t, H1_2)
245
+DO_MOVA_Z(sme_mova_zc_s, uint32_t, H1_4)
246
+
247
+void HELPER(sme_mova_zc_d)(void *vd, void *za, void *vg, uint32_t desc)
248
+{
249
+ int i, oprsz = simd_oprsz(desc) / 8;
250
+ uint8_t *pg = vg;
251
+ uint64_t *d = vd;
252
+ uint64_t *a = za;
253
+
254
+ for (i = 0; i < oprsz; i++) {
255
+ if (pg[H1(i)] & 1) {
256
+ d[i] = a[tile_vslice_index(i)];
257
+ }
258
+ }
259
+}
260
+
261
+void HELPER(sme_mova_zc_q)(void *vd, void *za, void *vg, uint32_t desc)
262
+{
263
+ int i, oprsz = simd_oprsz(desc) / 16;
264
+ uint16_t *pg = vg;
265
+ Int128 *d = vd;
266
+ Int128 *a = za;
267
+
268
+ /*
269
+ * Int128 is used here simply to copy 16 bytes, and to simplify
270
+ * the address arithmetic.
271
+ */
272
+ for (i = 0; i < oprsz; i++, za += sizeof(ARMVectorReg)) {
273
+ if (pg[H2(i)] & 1) {
274
+ d[i] = a[tile_vslice_index(i)];
275
+ }
276
+ }
277
+}
278
+
279
+#undef DO_MOVA_Z
280
diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
281
index XXXXXXX..XXXXXXX 100644
282
--- a/target/arm/sve_helper.c
283
+++ b/target/arm/sve_helper.c
284
@@ -XXX,XX +XXX,XX @@ void HELPER(sve_sel_zpzz_d)(void *vd, void *vn, void *vm,
285
}
286
}
287
288
+void HELPER(sve_sel_zpzz_q)(void *vd, void *vn, void *vm,
289
+ void *vg, uint32_t desc)
290
+{
291
+ intptr_t i, opr_sz = simd_oprsz(desc) / 16;
292
+ Int128 *d = vd, *n = vn, *m = vm;
293
+ uint16_t *pg = vg;
294
+
295
+ for (i = 0; i < opr_sz; i += 1) {
296
+ d[i] = (pg[H2(i)] & 1 ? n : m)[i];
297
+ }
298
+}
299
+
300
/* Two operand comparison controlled by a predicate.
301
* ??? It is very tempting to want to be able to expand this inline
302
* with x86 instructions, e.g.
303
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
304
index XXXXXXX..XXXXXXX 100644
305
--- a/target/arm/translate-sme.c
306
+++ b/target/arm/translate-sme.c
307
@@ -XXX,XX +XXX,XX @@
308
#include "decode-sme.c.inc"
309
310
311
+/*
312
+ * Resolve tile.size[index] to a host pointer, where tile and index
313
+ * are always decoded together, dependent on the element size.
314
+ */
315
+static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs,
316
+ int tile_index, bool vertical)
317
+{
318
+ int tile = tile_index >> (4 - esz);
319
+ int index = esz == MO_128 ? 0 : extract32(tile_index, 0, 4 - esz);
320
+ int pos, len, offset;
321
+ TCGv_i32 tmp;
322
+ TCGv_ptr addr;
323
+
324
+ /* Compute the final index, which is Rs+imm. */
325
+ tmp = tcg_temp_new_i32();
326
+ tcg_gen_trunc_tl_i32(tmp, cpu_reg(s, rs));
327
+ tcg_gen_addi_i32(tmp, tmp, index);
328
+
329
+ /* Prepare a power-of-two modulo via extraction of @len bits. */
330
+ len = ctz32(streaming_vec_reg_size(s)) - esz;
331
+
332
+ if (vertical) {
333
+ /*
334
+ * Compute the byte offset of the index within the tile:
335
+ * (index % (svl / size)) * size
336
+ * = (index % (svl >> esz)) << esz
337
+ * Perform the power-of-two modulo via extraction of the low @len bits.
338
+ * Perform the multiply by shifting left by @pos bits.
339
+ * Perform these operations simultaneously via deposit into zero.
340
+ */
341
+ pos = esz;
342
+ tcg_gen_deposit_z_i32(tmp, tmp, pos, len);
343
+
344
+ /*
345
+ * For big-endian, adjust the indexed column byte offset within
346
+ * the uint64_t host words that make up env->zarray[].
347
+ */
348
+ if (HOST_BIG_ENDIAN && esz < MO_64) {
349
+ tcg_gen_xori_i32(tmp, tmp, 8 - (1 << esz));
350
+ }
351
+ } else {
352
+ /*
353
+ * Compute the byte offset of the index within the tile:
354
+ * (index % (svl / size)) * (size * sizeof(row))
355
+ * = (index % (svl >> esz)) << (esz + log2(sizeof(row)))
356
+ */
357
+ pos = esz + ctz32(sizeof(ARMVectorReg));
358
+ tcg_gen_deposit_z_i32(tmp, tmp, pos, len);
359
+
360
+ /* Row slices are always aligned and need no endian adjustment. */
361
+ }
362
+
363
+ /* The tile byte offset within env->zarray is the row. */
364
+ offset = tile * sizeof(ARMVectorReg);
365
+
366
+ /* Include the byte offset of zarray to make this relative to env. */
367
+ offset += offsetof(CPUARMState, zarray);
368
+ tcg_gen_addi_i32(tmp, tmp, offset);
369
+
370
+ /* Add the byte offset to env to produce the final pointer. */
371
+ addr = tcg_temp_new_ptr();
372
+ tcg_gen_ext_i32_ptr(addr, tmp);
373
+ tcg_temp_free_i32(tmp);
374
+ tcg_gen_add_ptr(addr, addr, cpu_env);
375
+
376
+ return addr;
377
+}
378
+
379
static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
380
{
381
if (!dc_isar_feature(aa64_sme, s)) {
382
@@ -XXX,XX +XXX,XX @@ static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
383
}
384
return true;
385
}
386
+
387
+static bool trans_MOVA(DisasContext *s, arg_MOVA *a)
388
+{
389
+ static gen_helper_gvec_4 * const h_fns[5] = {
390
+ gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h,
391
+ gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d,
392
+ gen_helper_sve_sel_zpzz_q
393
+ };
394
+ static gen_helper_gvec_3 * const cz_fns[5] = {
395
+ gen_helper_sme_mova_cz_b, gen_helper_sme_mova_cz_h,
396
+ gen_helper_sme_mova_cz_s, gen_helper_sme_mova_cz_d,
397
+ gen_helper_sme_mova_cz_q,
398
+ };
399
+ static gen_helper_gvec_3 * const zc_fns[5] = {
400
+ gen_helper_sme_mova_zc_b, gen_helper_sme_mova_zc_h,
401
+ gen_helper_sme_mova_zc_s, gen_helper_sme_mova_zc_d,
402
+ gen_helper_sme_mova_zc_q,
403
+ };
404
+
405
+ TCGv_ptr t_za, t_zr, t_pg;
406
+ TCGv_i32 t_desc;
407
+ int svl;
408
+
409
+ if (!dc_isar_feature(aa64_sme, s)) {
410
+ return false;
411
+ }
412
+ if (!sme_smza_enabled_check(s)) {
413
+ return true;
414
+ }
415
+
416
+ t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v);
417
+ t_zr = vec_full_reg_ptr(s, a->zr);
418
+ t_pg = pred_full_reg_ptr(s, a->pg);
419
+
420
+ svl = streaming_vec_reg_size(s);
421
+ t_desc = tcg_constant_i32(simd_desc(svl, svl, 0));
422
+
423
+ if (a->v) {
424
+ /* Vertical slice -- use sme mova helpers. */
425
+ if (a->to_vec) {
426
+ zc_fns[a->esz](t_zr, t_za, t_pg, t_desc);
427
+ } else {
428
+ cz_fns[a->esz](t_za, t_zr, t_pg, t_desc);
429
+ }
430
+ } else {
431
+ /* Horizontal slice -- reuse sve sel helpers. */
432
+ if (a->to_vec) {
433
+ h_fns[a->esz](t_zr, t_za, t_zr, t_pg, t_desc);
434
+ } else {
435
+ h_fns[a->esz](t_za, t_zr, t_za, t_pg, t_desc);
436
+ }
437
+ }
438
+
439
+ tcg_temp_free_ptr(t_za);
440
+ tcg_temp_free_ptr(t_zr);
441
+ tcg_temp_free_ptr(t_pg);
442
+
443
+ return true;
444
+}
445
--
446
2.25.1
diff view generated by jsdifflib
1
From: Joel Stanley <joel@jms.id.au>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Following the pattern of the work recently done with the ASPEED GPIO
3
We cannot reuse the SVE functions for LD[1-4] and ST[1-4],
4
model, this adds support for inspecting and modifying the PCA9552 LEDs
4
because those functions accept only a Zreg register number.
5
from the monitor.
5
For SME, we want to pass a pointer into ZA storage.
6
6
7
(qemu) qom-set /machine/unattached/device[17] led0 on
8
(qemu) qom-set /machine/unattached/device[17] led0 off
9
(qemu) qom-set /machine/unattached/device[17] led0 pwm0
10
(qemu) qom-set /machine/unattached/device[17] led0 pwm1
11
12
Signed-off-by: Joel Stanley <joel@jms.id.au>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
14
Message-id: 20200114103433.30534-6-clg@kaod.org
15
[clg: - removed the "qom-get" examples from the commit log
16
- merged memory leak fixes from Joel ]
17
Signed-off-by: Cédric Le Goater <clg@kaod.org>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220708151540.18136-21-richard.henderson@linaro.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
11
---
21
hw/misc/pca9552.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++
12
target/arm/helper-sme.h | 82 +++++
22
1 file changed, 90 insertions(+)
13
target/arm/sme.decode | 9 +
14
target/arm/sme_helper.c | 595 +++++++++++++++++++++++++++++++++++++
15
target/arm/translate-sme.c | 70 +++++
16
4 files changed, 756 insertions(+)
23
17
24
diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c
18
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
25
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/misc/pca9552.c
20
--- a/target/arm/helper-sme.h
27
+++ b/hw/misc/pca9552.c
21
+++ b/target/arm/helper-sme.h
22
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(sme_mova_cz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
23
DEF_HELPER_FLAGS_4(sme_mova_zc_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
24
DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
25
DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
26
+
27
+DEF_HELPER_FLAGS_5(sme_ld1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
28
+DEF_HELPER_FLAGS_5(sme_ld1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
29
+DEF_HELPER_FLAGS_5(sme_ld1b_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
30
+DEF_HELPER_FLAGS_5(sme_ld1b_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
31
+
32
+DEF_HELPER_FLAGS_5(sme_ld1h_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
33
+DEF_HELPER_FLAGS_5(sme_ld1h_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
34
+DEF_HELPER_FLAGS_5(sme_ld1h_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
35
+DEF_HELPER_FLAGS_5(sme_ld1h_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
36
+DEF_HELPER_FLAGS_5(sme_ld1h_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
37
+DEF_HELPER_FLAGS_5(sme_ld1h_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
38
+DEF_HELPER_FLAGS_5(sme_ld1h_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
39
+DEF_HELPER_FLAGS_5(sme_ld1h_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
40
+
41
+DEF_HELPER_FLAGS_5(sme_ld1s_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
42
+DEF_HELPER_FLAGS_5(sme_ld1s_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
43
+DEF_HELPER_FLAGS_5(sme_ld1s_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
44
+DEF_HELPER_FLAGS_5(sme_ld1s_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
45
+DEF_HELPER_FLAGS_5(sme_ld1s_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
46
+DEF_HELPER_FLAGS_5(sme_ld1s_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
47
+DEF_HELPER_FLAGS_5(sme_ld1s_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
48
+DEF_HELPER_FLAGS_5(sme_ld1s_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
49
+
50
+DEF_HELPER_FLAGS_5(sme_ld1d_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
51
+DEF_HELPER_FLAGS_5(sme_ld1d_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
52
+DEF_HELPER_FLAGS_5(sme_ld1d_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
53
+DEF_HELPER_FLAGS_5(sme_ld1d_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
54
+DEF_HELPER_FLAGS_5(sme_ld1d_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
55
+DEF_HELPER_FLAGS_5(sme_ld1d_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
56
+DEF_HELPER_FLAGS_5(sme_ld1d_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
57
+DEF_HELPER_FLAGS_5(sme_ld1d_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
58
+
59
+DEF_HELPER_FLAGS_5(sme_ld1q_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
60
+DEF_HELPER_FLAGS_5(sme_ld1q_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
61
+DEF_HELPER_FLAGS_5(sme_ld1q_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
62
+DEF_HELPER_FLAGS_5(sme_ld1q_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
63
+DEF_HELPER_FLAGS_5(sme_ld1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
64
+DEF_HELPER_FLAGS_5(sme_ld1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
65
+DEF_HELPER_FLAGS_5(sme_ld1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
66
+DEF_HELPER_FLAGS_5(sme_ld1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
67
+
68
+DEF_HELPER_FLAGS_5(sme_st1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
69
+DEF_HELPER_FLAGS_5(sme_st1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
70
+DEF_HELPER_FLAGS_5(sme_st1b_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
71
+DEF_HELPER_FLAGS_5(sme_st1b_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
72
+
73
+DEF_HELPER_FLAGS_5(sme_st1h_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
74
+DEF_HELPER_FLAGS_5(sme_st1h_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
75
+DEF_HELPER_FLAGS_5(sme_st1h_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
76
+DEF_HELPER_FLAGS_5(sme_st1h_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
77
+DEF_HELPER_FLAGS_5(sme_st1h_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
78
+DEF_HELPER_FLAGS_5(sme_st1h_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
79
+DEF_HELPER_FLAGS_5(sme_st1h_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
80
+DEF_HELPER_FLAGS_5(sme_st1h_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
81
+
82
+DEF_HELPER_FLAGS_5(sme_st1s_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
83
+DEF_HELPER_FLAGS_5(sme_st1s_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
84
+DEF_HELPER_FLAGS_5(sme_st1s_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
85
+DEF_HELPER_FLAGS_5(sme_st1s_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
86
+DEF_HELPER_FLAGS_5(sme_st1s_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
87
+DEF_HELPER_FLAGS_5(sme_st1s_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
88
+DEF_HELPER_FLAGS_5(sme_st1s_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
89
+DEF_HELPER_FLAGS_5(sme_st1s_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
90
+
91
+DEF_HELPER_FLAGS_5(sme_st1d_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
92
+DEF_HELPER_FLAGS_5(sme_st1d_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
93
+DEF_HELPER_FLAGS_5(sme_st1d_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
94
+DEF_HELPER_FLAGS_5(sme_st1d_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
95
+DEF_HELPER_FLAGS_5(sme_st1d_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
96
+DEF_HELPER_FLAGS_5(sme_st1d_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
97
+DEF_HELPER_FLAGS_5(sme_st1d_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
98
+DEF_HELPER_FLAGS_5(sme_st1d_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
99
+
100
+DEF_HELPER_FLAGS_5(sme_st1q_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
101
+DEF_HELPER_FLAGS_5(sme_st1q_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
102
+DEF_HELPER_FLAGS_5(sme_st1q_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
103
+DEF_HELPER_FLAGS_5(sme_st1q_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
104
+DEF_HELPER_FLAGS_5(sme_st1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
105
+DEF_HELPER_FLAGS_5(sme_st1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
106
+DEF_HELPER_FLAGS_5(sme_st1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
107
+DEF_HELPER_FLAGS_5(sme_st1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
108
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
109
index XXXXXXX..XXXXXXX 100644
110
--- a/target/arm/sme.decode
111
+++ b/target/arm/sme.decode
112
@@ -XXX,XX +XXX,XX @@ MOVA 11000000 esz:2 00001 0 v:1 .. pg:3 0 za_imm:4 zr:5 \
113
&mova to_vec=1 rs=%mova_rs
114
MOVA 11000000 11 00001 1 v:1 .. pg:3 0 za_imm:4 zr:5 \
115
&mova to_vec=1 rs=%mova_rs esz=4
116
+
117
+### SME Memory
118
+
119
+&ldst esz rs pg rn rm za_imm v:bool st:bool
120
+
121
+LDST1 1110000 0 esz:2 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \
122
+ &ldst rs=%mova_rs
123
+LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \
124
+ &ldst esz=4 rs=%mova_rs
125
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
126
index XXXXXXX..XXXXXXX 100644
127
--- a/target/arm/sme_helper.c
128
+++ b/target/arm/sme_helper.c
28
@@ -XXX,XX +XXX,XX @@
129
@@ -XXX,XX +XXX,XX @@
29
#include "hw/misc/pca9552.h"
130
30
#include "hw/misc/pca9552_regs.h"
131
#include "qemu/osdep.h"
31
#include "migration/vmstate.h"
132
#include "cpu.h"
32
+#include "qapi/error.h"
133
+#include "internals.h"
33
+#include "qapi/visitor.h"
134
#include "tcg/tcg-gvec-desc.h"
34
135
#include "exec/helper-proto.h"
35
#define PCA9552_LED_ON 0x0
136
+#include "exec/cpu_ldst.h"
36
#define PCA9552_LED_OFF 0x1
137
+#include "exec/exec-all.h"
37
#define PCA9552_LED_PWM0 0x2
138
#include "qemu/int128.h"
38
#define PCA9552_LED_PWM1 0x3
139
#include "vec_internal.h"
39
140
+#include "sve_ldst_internal.h"
40
+static const char *led_state[] = {"on", "off", "pwm0", "pwm1"};
141
41
+
142
/* ResetSVEState */
42
static uint8_t pca9552_pin_get_config(PCA9552State *s, int pin)
143
void arm_reset_sve_state(CPUARMState *env)
43
{
144
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_mova_zc_q)(void *vd, void *za, void *vg, uint32_t desc)
44
uint8_t reg = PCA9552_LS0 + (pin / 4);
45
@@ -XXX,XX +XXX,XX @@ static int pca9552_event(I2CSlave *i2c, enum i2c_event event)
46
return 0;
47
}
145
}
48
146
49
+static void pca9552_get_led(Object *obj, Visitor *v, const char *name,
147
#undef DO_MOVA_Z
50
+ void *opaque, Error **errp)
148
+
51
+{
149
+/*
52
+ PCA9552State *s = PCA9552(obj);
150
+ * Clear elements in a tile slice comprising len bytes.
53
+ int led, rc, reg;
151
+ */
54
+ uint8_t state;
152
+
55
+
153
+typedef void ClearFn(void *ptr, size_t off, size_t len);
56
+ rc = sscanf(name, "led%2d", &led);
154
+
57
+ if (rc != 1) {
155
+static void clear_horizontal(void *ptr, size_t off, size_t len)
58
+ error_setg(errp, "%s: error reading %s", __func__, name);
156
+{
157
+ memset(ptr + off, 0, len);
158
+}
159
+
160
+static void clear_vertical_b(void *vptr, size_t off, size_t len)
161
+{
162
+ for (size_t i = 0; i < len; ++i) {
163
+ *(uint8_t *)(vptr + tile_vslice_offset(i + off)) = 0;
164
+ }
165
+}
166
+
167
+static void clear_vertical_h(void *vptr, size_t off, size_t len)
168
+{
169
+ for (size_t i = 0; i < len; i += 2) {
170
+ *(uint16_t *)(vptr + tile_vslice_offset(i + off)) = 0;
171
+ }
172
+}
173
+
174
+static void clear_vertical_s(void *vptr, size_t off, size_t len)
175
+{
176
+ for (size_t i = 0; i < len; i += 4) {
177
+ *(uint32_t *)(vptr + tile_vslice_offset(i + off)) = 0;
178
+ }
179
+}
180
+
181
+static void clear_vertical_d(void *vptr, size_t off, size_t len)
182
+{
183
+ for (size_t i = 0; i < len; i += 8) {
184
+ *(uint64_t *)(vptr + tile_vslice_offset(i + off)) = 0;
185
+ }
186
+}
187
+
188
+static void clear_vertical_q(void *vptr, size_t off, size_t len)
189
+{
190
+ for (size_t i = 0; i < len; i += 16) {
191
+ memset(vptr + tile_vslice_offset(i + off), 0, 16);
192
+ }
193
+}
194
+
195
+/*
196
+ * Copy elements from an array into a tile slice comprising len bytes.
197
+ */
198
+
199
+typedef void CopyFn(void *dst, const void *src, size_t len);
200
+
201
+static void copy_horizontal(void *dst, const void *src, size_t len)
202
+{
203
+ memcpy(dst, src, len);
204
+}
205
+
206
+static void copy_vertical_b(void *vdst, const void *vsrc, size_t len)
207
+{
208
+ const uint8_t *src = vsrc;
209
+ uint8_t *dst = vdst;
210
+ size_t i;
211
+
212
+ for (i = 0; i < len; ++i) {
213
+ dst[tile_vslice_index(i)] = src[i];
214
+ }
215
+}
216
+
217
+static void copy_vertical_h(void *vdst, const void *vsrc, size_t len)
218
+{
219
+ const uint16_t *src = vsrc;
220
+ uint16_t *dst = vdst;
221
+ size_t i;
222
+
223
+ for (i = 0; i < len / 2; ++i) {
224
+ dst[tile_vslice_index(i)] = src[i];
225
+ }
226
+}
227
+
228
+static void copy_vertical_s(void *vdst, const void *vsrc, size_t len)
229
+{
230
+ const uint32_t *src = vsrc;
231
+ uint32_t *dst = vdst;
232
+ size_t i;
233
+
234
+ for (i = 0; i < len / 4; ++i) {
235
+ dst[tile_vslice_index(i)] = src[i];
236
+ }
237
+}
238
+
239
+static void copy_vertical_d(void *vdst, const void *vsrc, size_t len)
240
+{
241
+ const uint64_t *src = vsrc;
242
+ uint64_t *dst = vdst;
243
+ size_t i;
244
+
245
+ for (i = 0; i < len / 8; ++i) {
246
+ dst[tile_vslice_index(i)] = src[i];
247
+ }
248
+}
249
+
250
+static void copy_vertical_q(void *vdst, const void *vsrc, size_t len)
251
+{
252
+ for (size_t i = 0; i < len; i += 16) {
253
+ memcpy(vdst + tile_vslice_offset(i), vsrc + i, 16);
254
+ }
255
+}
256
+
257
+/*
258
+ * Host and TLB primitives for vertical tile slice addressing.
259
+ */
260
+
261
+#define DO_LD(NAME, TYPE, HOST, TLB) \
262
+static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host) \
263
+{ \
264
+ TYPE val = HOST(host); \
265
+ *(TYPE *)(za + tile_vslice_offset(off)) = val; \
266
+} \
267
+static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za, \
268
+ intptr_t off, target_ulong addr, uintptr_t ra) \
269
+{ \
270
+ TYPE val = TLB(env, useronly_clean_ptr(addr), ra); \
271
+ *(TYPE *)(za + tile_vslice_offset(off)) = val; \
272
+}
273
+
274
+#define DO_ST(NAME, TYPE, HOST, TLB) \
275
+static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host) \
276
+{ \
277
+ TYPE val = *(TYPE *)(za + tile_vslice_offset(off)); \
278
+ HOST(host, val); \
279
+} \
280
+static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za, \
281
+ intptr_t off, target_ulong addr, uintptr_t ra) \
282
+{ \
283
+ TYPE val = *(TYPE *)(za + tile_vslice_offset(off)); \
284
+ TLB(env, useronly_clean_ptr(addr), val, ra); \
285
+}
286
+
287
+/*
288
+ * The ARMVectorReg elements are stored in host-endian 64-bit units.
289
+ * For 128-bit quantities, the sequence defined by the Elem[] pseudocode
290
+ * corresponds to storing the two 64-bit pieces in little-endian order.
291
+ */
292
+#define DO_LDQ(HNAME, VNAME, BE, HOST, TLB) \
293
+static inline void HNAME##_host(void *za, intptr_t off, void *host) \
294
+{ \
295
+ uint64_t val0 = HOST(host), val1 = HOST(host + 8); \
296
+ uint64_t *ptr = za + off; \
297
+ ptr[0] = BE ? val1 : val0, ptr[1] = BE ? val0 : val1; \
298
+} \
299
+static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \
300
+{ \
301
+ HNAME##_host(za, tile_vslice_offset(off), host); \
302
+} \
303
+static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off, \
304
+ target_ulong addr, uintptr_t ra) \
305
+{ \
306
+ uint64_t val0 = TLB(env, useronly_clean_ptr(addr), ra); \
307
+ uint64_t val1 = TLB(env, useronly_clean_ptr(addr + 8), ra); \
308
+ uint64_t *ptr = za + off; \
309
+ ptr[0] = BE ? val1 : val0, ptr[1] = BE ? val0 : val1; \
310
+} \
311
+static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off, \
312
+ target_ulong addr, uintptr_t ra) \
313
+{ \
314
+ HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra); \
315
+}
316
+
317
+#define DO_STQ(HNAME, VNAME, BE, HOST, TLB) \
318
+static inline void HNAME##_host(void *za, intptr_t off, void *host) \
319
+{ \
320
+ uint64_t *ptr = za + off; \
321
+ HOST(host, ptr[BE]); \
322
+ HOST(host + 1, ptr[!BE]); \
323
+} \
324
+static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \
325
+{ \
326
+ HNAME##_host(za, tile_vslice_offset(off), host); \
327
+} \
328
+static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off, \
329
+ target_ulong addr, uintptr_t ra) \
330
+{ \
331
+ uint64_t *ptr = za + off; \
332
+ TLB(env, useronly_clean_ptr(addr), ptr[BE], ra); \
333
+ TLB(env, useronly_clean_ptr(addr + 8), ptr[!BE], ra); \
334
+} \
335
+static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off, \
336
+ target_ulong addr, uintptr_t ra) \
337
+{ \
338
+ HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra); \
339
+}
340
+
341
+DO_LD(ld1b, uint8_t, ldub_p, cpu_ldub_data_ra)
342
+DO_LD(ld1h_be, uint16_t, lduw_be_p, cpu_lduw_be_data_ra)
343
+DO_LD(ld1h_le, uint16_t, lduw_le_p, cpu_lduw_le_data_ra)
344
+DO_LD(ld1s_be, uint32_t, ldl_be_p, cpu_ldl_be_data_ra)
345
+DO_LD(ld1s_le, uint32_t, ldl_le_p, cpu_ldl_le_data_ra)
346
+DO_LD(ld1d_be, uint64_t, ldq_be_p, cpu_ldq_be_data_ra)
347
+DO_LD(ld1d_le, uint64_t, ldq_le_p, cpu_ldq_le_data_ra)
348
+
349
+DO_LDQ(sve_ld1qq_be, sme_ld1q_be, 1, ldq_be_p, cpu_ldq_be_data_ra)
350
+DO_LDQ(sve_ld1qq_le, sme_ld1q_le, 0, ldq_le_p, cpu_ldq_le_data_ra)
351
+
352
+DO_ST(st1b, uint8_t, stb_p, cpu_stb_data_ra)
353
+DO_ST(st1h_be, uint16_t, stw_be_p, cpu_stw_be_data_ra)
354
+DO_ST(st1h_le, uint16_t, stw_le_p, cpu_stw_le_data_ra)
355
+DO_ST(st1s_be, uint32_t, stl_be_p, cpu_stl_be_data_ra)
356
+DO_ST(st1s_le, uint32_t, stl_le_p, cpu_stl_le_data_ra)
357
+DO_ST(st1d_be, uint64_t, stq_be_p, cpu_stq_be_data_ra)
358
+DO_ST(st1d_le, uint64_t, stq_le_p, cpu_stq_le_data_ra)
359
+
360
+DO_STQ(sve_st1qq_be, sme_st1q_be, 1, stq_be_p, cpu_stq_be_data_ra)
361
+DO_STQ(sve_st1qq_le, sme_st1q_le, 0, stq_le_p, cpu_stq_le_data_ra)
362
+
363
+#undef DO_LD
364
+#undef DO_ST
365
+#undef DO_LDQ
366
+#undef DO_STQ
367
+
368
+/*
369
+ * Common helper for all contiguous predicated loads.
370
+ */
371
+
372
+static inline QEMU_ALWAYS_INLINE
373
+void sme_ld1(CPUARMState *env, void *za, uint64_t *vg,
374
+ const target_ulong addr, uint32_t desc, const uintptr_t ra,
375
+ const int esz, uint32_t mtedesc, bool vertical,
376
+ sve_ldst1_host_fn *host_fn,
377
+ sve_ldst1_tlb_fn *tlb_fn,
378
+ ClearFn *clr_fn,
379
+ CopyFn *cpy_fn)
380
+{
381
+ const intptr_t reg_max = simd_oprsz(desc);
382
+ const intptr_t esize = 1 << esz;
383
+ intptr_t reg_off, reg_last;
384
+ SVEContLdSt info;
385
+ void *host;
386
+ int flags;
387
+
388
+ /* Find the active elements. */
389
+ if (!sve_cont_ldst_elements(&info, addr, vg, reg_max, esz, esize)) {
390
+ /* The entire predicate was false; no load occurs. */
391
+ clr_fn(za, 0, reg_max);
59
+ return;
392
+ return;
60
+ }
393
+ }
61
+ if (led < 0 || led > s->nr_leds) {
394
+
62
+ error_setg(errp, "%s invalid led %s", __func__, name);
395
+ /* Probe the page(s). Exit with exception for any invalid page. */
396
+ sve_cont_ldst_pages(&info, FAULT_ALL, env, addr, MMU_DATA_LOAD, ra);
397
+
398
+ /* Handle watchpoints for all active elements. */
399
+ sve_cont_ldst_watchpoints(&info, env, vg, addr, esize, esize,
400
+ BP_MEM_READ, ra);
401
+
402
+ /*
403
+ * Handle mte checks for all active elements.
404
+ * Since TBI must be set for MTE, !mtedesc => !mte_active.
405
+ */
406
+ if (mtedesc) {
407
+ sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize,
408
+ mtedesc, ra);
409
+ }
410
+
411
+ flags = info.page[0].flags | info.page[1].flags;
412
+ if (unlikely(flags != 0)) {
413
+#ifdef CONFIG_USER_ONLY
414
+ g_assert_not_reached();
415
+#else
416
+ /*
417
+ * At least one page includes MMIO.
418
+ * Any bus operation can fail with cpu_transaction_failed,
419
+ * which for ARM will raise SyncExternal. Perform the load
420
+ * into scratch memory to preserve register state until the end.
421
+ */
422
+ ARMVectorReg scratch = { };
423
+
424
+ reg_off = info.reg_off_first[0];
425
+ reg_last = info.reg_off_last[1];
426
+ if (reg_last < 0) {
427
+ reg_last = info.reg_off_split;
428
+ if (reg_last < 0) {
429
+ reg_last = info.reg_off_last[0];
430
+ }
431
+ }
432
+
433
+ do {
434
+ uint64_t pg = vg[reg_off >> 6];
435
+ do {
436
+ if ((pg >> (reg_off & 63)) & 1) {
437
+ tlb_fn(env, &scratch, reg_off, addr + reg_off, ra);
438
+ }
439
+ reg_off += esize;
440
+ } while (reg_off & 63);
441
+ } while (reg_off <= reg_last);
442
+
443
+ cpy_fn(za, &scratch, reg_max);
63
+ return;
444
+ return;
64
+ }
445
+#endif
446
+ }
447
+
448
+ /* The entire operation is in RAM, on valid pages. */
449
+
450
+ reg_off = info.reg_off_first[0];
451
+ reg_last = info.reg_off_last[0];
452
+ host = info.page[0].host;
453
+
454
+ if (!vertical) {
455
+ memset(za, 0, reg_max);
456
+ } else if (reg_off) {
457
+ clr_fn(za, 0, reg_off);
458
+ }
459
+
460
+ while (reg_off <= reg_last) {
461
+ uint64_t pg = vg[reg_off >> 6];
462
+ do {
463
+ if ((pg >> (reg_off & 63)) & 1) {
464
+ host_fn(za, reg_off, host + reg_off);
465
+ } else if (vertical) {
466
+ clr_fn(za, reg_off, esize);
467
+ }
468
+ reg_off += esize;
469
+ } while (reg_off <= reg_last && (reg_off & 63));
470
+ }
471
+
65
+ /*
472
+ /*
66
+ * Get the LSx register as the qom interface should expose the device
473
+ * Use the slow path to manage the cross-page misalignment.
67
+ * state, not the modeled 'input line' behaviour which would come from
474
+ * But we know this is RAM and cannot trap.
68
+ * reading the INPUTx reg
69
+ */
475
+ */
70
+ reg = PCA9552_LS0 + led / 4;
476
+ reg_off = info.reg_off_split;
71
+ state = (pca9552_read(s, reg) >> (led % 8)) & 0x3;
477
+ if (unlikely(reg_off >= 0)) {
72
+ visit_type_str(v, name, (char **)&led_state[state], errp);
478
+ tlb_fn(env, za, reg_off, addr + reg_off, ra);
73
+}
479
+ }
480
+
481
+ reg_off = info.reg_off_first[1];
482
+ if (unlikely(reg_off >= 0)) {
483
+ reg_last = info.reg_off_last[1];
484
+ host = info.page[1].host;
485
+
486
+ do {
487
+ uint64_t pg = vg[reg_off >> 6];
488
+ do {
489
+ if ((pg >> (reg_off & 63)) & 1) {
490
+ host_fn(za, reg_off, host + reg_off);
491
+ } else if (vertical) {
492
+ clr_fn(za, reg_off, esize);
493
+ }
494
+ reg_off += esize;
495
+ } while (reg_off & 63);
496
+ } while (reg_off <= reg_last);
497
+ }
498
+}
499
+
500
+static inline QEMU_ALWAYS_INLINE
501
+void sme_ld1_mte(CPUARMState *env, void *za, uint64_t *vg,
502
+ target_ulong addr, uint32_t desc, uintptr_t ra,
503
+ const int esz, bool vertical,
504
+ sve_ldst1_host_fn *host_fn,
505
+ sve_ldst1_tlb_fn *tlb_fn,
506
+ ClearFn *clr_fn,
507
+ CopyFn *cpy_fn)
508
+{
509
+ uint32_t mtedesc = desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
510
+ int bit55 = extract64(addr, 55, 1);
511
+
512
+ /* Remove mtedesc from the normal sve descriptor. */
513
+ desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
514
+
515
+ /* Perform gross MTE suppression early. */
516
+ if (!tbi_check(desc, bit55) ||
517
+ tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
518
+ mtedesc = 0;
519
+ }
520
+
521
+ sme_ld1(env, za, vg, addr, desc, ra, esz, mtedesc, vertical,
522
+ host_fn, tlb_fn, clr_fn, cpy_fn);
523
+}
524
+
525
+#define DO_LD(L, END, ESZ) \
526
+void HELPER(sme_ld1##L##END##_h)(CPUARMState *env, void *za, void *vg, \
527
+ target_ulong addr, uint32_t desc) \
528
+{ \
529
+ sme_ld1(env, za, vg, addr, desc, GETPC(), ESZ, 0, false, \
530
+ sve_ld1##L##L##END##_host, sve_ld1##L##L##END##_tlb, \
531
+ clear_horizontal, copy_horizontal); \
532
+} \
533
+void HELPER(sme_ld1##L##END##_v)(CPUARMState *env, void *za, void *vg, \
534
+ target_ulong addr, uint32_t desc) \
535
+{ \
536
+ sme_ld1(env, za, vg, addr, desc, GETPC(), ESZ, 0, true, \
537
+ sme_ld1##L##END##_v_host, sme_ld1##L##END##_v_tlb, \
538
+ clear_vertical_##L, copy_vertical_##L); \
539
+} \
540
+void HELPER(sme_ld1##L##END##_h_mte)(CPUARMState *env, void *za, void *vg, \
541
+ target_ulong addr, uint32_t desc) \
542
+{ \
543
+ sme_ld1_mte(env, za, vg, addr, desc, GETPC(), ESZ, false, \
544
+ sve_ld1##L##L##END##_host, sve_ld1##L##L##END##_tlb, \
545
+ clear_horizontal, copy_horizontal); \
546
+} \
547
+void HELPER(sme_ld1##L##END##_v_mte)(CPUARMState *env, void *za, void *vg, \
548
+ target_ulong addr, uint32_t desc) \
549
+{ \
550
+ sme_ld1_mte(env, za, vg, addr, desc, GETPC(), ESZ, true, \
551
+ sme_ld1##L##END##_v_host, sme_ld1##L##END##_v_tlb, \
552
+ clear_vertical_##L, copy_vertical_##L); \
553
+}
554
+
555
+DO_LD(b, , MO_8)
556
+DO_LD(h, _be, MO_16)
557
+DO_LD(h, _le, MO_16)
558
+DO_LD(s, _be, MO_32)
559
+DO_LD(s, _le, MO_32)
560
+DO_LD(d, _be, MO_64)
561
+DO_LD(d, _le, MO_64)
562
+DO_LD(q, _be, MO_128)
563
+DO_LD(q, _le, MO_128)
564
+
565
+#undef DO_LD
74
+
566
+
75
+/*
567
+/*
76
+ * Return an LED selector register value based on an existing one, with
568
+ * Common helper for all contiguous predicated stores.
77
+ * the appropriate 2-bit state value set for the given LED number (0-3).
78
+ */
569
+ */
79
+static inline uint8_t pca955x_ledsel(uint8_t oldval, int led_num, int state)
570
+
80
+{
571
+static inline QEMU_ALWAYS_INLINE
81
+ return (oldval & (~(0x3 << (led_num << 1)))) |
572
+void sme_st1(CPUARMState *env, void *za, uint64_t *vg,
82
+ ((state & 0x3) << (led_num << 1));
573
+ const target_ulong addr, uint32_t desc, const uintptr_t ra,
83
+}
574
+ const int esz, uint32_t mtedesc, bool vertical,
84
+
575
+ sve_ldst1_host_fn *host_fn,
85
+static void pca9552_set_led(Object *obj, Visitor *v, const char *name,
576
+ sve_ldst1_tlb_fn *tlb_fn)
86
+ void *opaque, Error **errp)
577
+{
87
+{
578
+ const intptr_t reg_max = simd_oprsz(desc);
88
+ PCA9552State *s = PCA9552(obj);
579
+ const intptr_t esize = 1 << esz;
89
+ Error *local_err = NULL;
580
+ intptr_t reg_off, reg_last;
90
+ int led, rc, reg, val;
581
+ SVEContLdSt info;
91
+ uint8_t state;
582
+ void *host;
92
+ char *state_str;
583
+ int flags;
93
+
584
+
94
+ visit_type_str(v, name, &state_str, &local_err);
585
+ /* Find the active elements. */
95
+ if (local_err) {
586
+ if (!sve_cont_ldst_elements(&info, addr, vg, reg_max, esz, esize)) {
96
+ error_propagate(errp, local_err);
587
+ /* The entire predicate was false; no store occurs. */
97
+ return;
588
+ return;
98
+ }
589
+ }
99
+ rc = sscanf(name, "led%2d", &led);
590
+
100
+ if (rc != 1) {
591
+ /* Probe the page(s). Exit with exception for any invalid page. */
101
+ error_setg(errp, "%s: error reading %s", __func__, name);
592
+ sve_cont_ldst_pages(&info, FAULT_ALL, env, addr, MMU_DATA_STORE, ra);
593
+
594
+ /* Handle watchpoints for all active elements. */
595
+ sve_cont_ldst_watchpoints(&info, env, vg, addr, esize, esize,
596
+ BP_MEM_WRITE, ra);
597
+
598
+ /*
599
+ * Handle mte checks for all active elements.
600
+ * Since TBI must be set for MTE, !mtedesc => !mte_active.
601
+ */
602
+ if (mtedesc) {
603
+ sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize,
604
+ mtedesc, ra);
605
+ }
606
+
607
+ flags = info.page[0].flags | info.page[1].flags;
608
+ if (unlikely(flags != 0)) {
609
+#ifdef CONFIG_USER_ONLY
610
+ g_assert_not_reached();
611
+#else
612
+ /*
613
+ * At least one page includes MMIO.
614
+ * Any bus operation can fail with cpu_transaction_failed,
615
+ * which for ARM will raise SyncExternal. We cannot avoid
616
+ * this fault and will leave with the store incomplete.
617
+ */
618
+ reg_off = info.reg_off_first[0];
619
+ reg_last = info.reg_off_last[1];
620
+ if (reg_last < 0) {
621
+ reg_last = info.reg_off_split;
622
+ if (reg_last < 0) {
623
+ reg_last = info.reg_off_last[0];
624
+ }
625
+ }
626
+
627
+ do {
628
+ uint64_t pg = vg[reg_off >> 6];
629
+ do {
630
+ if ((pg >> (reg_off & 63)) & 1) {
631
+ tlb_fn(env, za, reg_off, addr + reg_off, ra);
632
+ }
633
+ reg_off += esize;
634
+ } while (reg_off & 63);
635
+ } while (reg_off <= reg_last);
102
+ return;
636
+ return;
103
+ }
637
+#endif
104
+ if (led < 0 || led > s->nr_leds) {
638
+ }
105
+ error_setg(errp, "%s invalid led %s", __func__, name);
639
+
106
+ return;
640
+ reg_off = info.reg_off_first[0];
107
+ }
641
+ reg_last = info.reg_off_last[0];
108
+
642
+ host = info.page[0].host;
109
+ for (state = 0; state < ARRAY_SIZE(led_state); state++) {
643
+
110
+ if (!strcmp(state_str, led_state[state])) {
644
+ while (reg_off <= reg_last) {
111
+ break;
645
+ uint64_t pg = vg[reg_off >> 6];
112
+ }
646
+ do {
113
+ }
647
+ if ((pg >> (reg_off & 63)) & 1) {
114
+ if (state >= ARRAY_SIZE(led_state)) {
648
+ host_fn(za, reg_off, host + reg_off);
115
+ error_setg(errp, "%s invalid led state %s", __func__, state_str);
649
+ }
116
+ return;
650
+ reg_off += 1 << esz;
117
+ }
651
+ } while (reg_off <= reg_last && (reg_off & 63));
118
+
652
+ }
119
+ reg = PCA9552_LS0 + led / 4;
653
+
120
+ val = pca9552_read(s, reg);
654
+ /*
121
+ val = pca955x_ledsel(val, led % 4, state);
655
+ * Use the slow path to manage the cross-page misalignment.
122
+ pca9552_write(s, reg, val);
656
+ * But we know this is RAM and cannot trap.
123
+}
657
+ */
124
+
658
+ reg_off = info.reg_off_split;
125
static const VMStateDescription pca9552_vmstate = {
659
+ if (unlikely(reg_off >= 0)) {
126
.name = "PCA9552",
660
+ tlb_fn(env, za, reg_off, addr + reg_off, ra);
127
.version_id = 0,
661
+ }
128
@@ -XXX,XX +XXX,XX @@ static void pca9552_reset(DeviceState *dev)
662
+
129
static void pca9552_initfn(Object *obj)
663
+ reg_off = info.reg_off_first[1];
130
{
664
+ if (unlikely(reg_off >= 0)) {
131
PCA9552State *s = PCA9552(obj);
665
+ reg_last = info.reg_off_last[1];
132
+ int led;
666
+ host = info.page[1].host;
133
667
+
134
/* If support for the other PCA955X devices are implemented, these
668
+ do {
135
* constant values might be part of class structure describing the
669
+ uint64_t pg = vg[reg_off >> 6];
136
@@ -XXX,XX +XXX,XX @@ static void pca9552_initfn(Object *obj)
670
+ do {
137
*/
671
+ if ((pg >> (reg_off & 63)) & 1) {
138
s->max_reg = PCA9552_LS3;
672
+ host_fn(za, reg_off, host + reg_off);
139
s->nr_leds = 16;
673
+ }
140
+
674
+ reg_off += 1 << esz;
141
+ for (led = 0; led < s->nr_leds; led++) {
675
+ } while (reg_off & 63);
142
+ char *name;
676
+ } while (reg_off <= reg_last);
143
+
677
+ }
144
+ name = g_strdup_printf("led%d", led);
678
+}
145
+ object_property_add(obj, name, "bool", pca9552_get_led, pca9552_set_led,
679
+
146
+ NULL, NULL, NULL);
680
+static inline QEMU_ALWAYS_INLINE
147
+ g_free(name);
681
+void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong addr,
148
+ }
682
+ uint32_t desc, uintptr_t ra, int esz, bool vertical,
683
+ sve_ldst1_host_fn *host_fn,
684
+ sve_ldst1_tlb_fn *tlb_fn)
685
+{
686
+ uint32_t mtedesc = desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
687
+ int bit55 = extract64(addr, 55, 1);
688
+
689
+ /* Remove mtedesc from the normal sve descriptor. */
690
+ desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
691
+
692
+ /* Perform gross MTE suppression early. */
693
+ if (!tbi_check(desc, bit55) ||
694
+ tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
695
+ mtedesc = 0;
696
+ }
697
+
698
+ sme_st1(env, za, vg, addr, desc, ra, esz, mtedesc,
699
+ vertical, host_fn, tlb_fn);
700
+}
701
+
702
+#define DO_ST(L, END, ESZ) \
703
+void HELPER(sme_st1##L##END##_h)(CPUARMState *env, void *za, void *vg, \
704
+ target_ulong addr, uint32_t desc) \
705
+{ \
706
+ sme_st1(env, za, vg, addr, desc, GETPC(), ESZ, 0, false, \
707
+ sve_st1##L##L##END##_host, sve_st1##L##L##END##_tlb); \
708
+} \
709
+void HELPER(sme_st1##L##END##_v)(CPUARMState *env, void *za, void *vg, \
710
+ target_ulong addr, uint32_t desc) \
711
+{ \
712
+ sme_st1(env, za, vg, addr, desc, GETPC(), ESZ, 0, true, \
713
+ sme_st1##L##END##_v_host, sme_st1##L##END##_v_tlb); \
714
+} \
715
+void HELPER(sme_st1##L##END##_h_mte)(CPUARMState *env, void *za, void *vg, \
716
+ target_ulong addr, uint32_t desc) \
717
+{ \
718
+ sme_st1_mte(env, za, vg, addr, desc, GETPC(), ESZ, false, \
719
+ sve_st1##L##L##END##_host, sve_st1##L##L##END##_tlb); \
720
+} \
721
+void HELPER(sme_st1##L##END##_v_mte)(CPUARMState *env, void *za, void *vg, \
722
+ target_ulong addr, uint32_t desc) \
723
+{ \
724
+ sme_st1_mte(env, za, vg, addr, desc, GETPC(), ESZ, true, \
725
+ sme_st1##L##END##_v_host, sme_st1##L##END##_v_tlb); \
726
+}
727
+
728
+DO_ST(b, , MO_8)
729
+DO_ST(h, _be, MO_16)
730
+DO_ST(h, _le, MO_16)
731
+DO_ST(s, _be, MO_32)
732
+DO_ST(s, _le, MO_32)
733
+DO_ST(d, _be, MO_64)
734
+DO_ST(d, _le, MO_64)
735
+DO_ST(q, _be, MO_128)
736
+DO_ST(q, _le, MO_128)
737
+
738
+#undef DO_ST
739
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
740
index XXXXXXX..XXXXXXX 100644
741
--- a/target/arm/translate-sme.c
742
+++ b/target/arm/translate-sme.c
743
@@ -XXX,XX +XXX,XX @@ static bool trans_MOVA(DisasContext *s, arg_MOVA *a)
744
745
return true;
149
}
746
}
150
747
+
151
static void pca9552_class_init(ObjectClass *klass, void *data)
748
+static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
749
+{
750
+ typedef void GenLdSt1(TCGv_env, TCGv_ptr, TCGv_ptr, TCGv, TCGv_i32);
751
+
752
+ /*
753
+ * Indexed by [esz][be][v][mte][st], which is (except for load/store)
754
+ * also the order in which the elements appear in the function names,
755
+ * and so how we must concatenate the pieces.
756
+ */
757
+
758
+#define FN_LS(F) { gen_helper_sme_ld1##F, gen_helper_sme_st1##F }
759
+#define FN_MTE(F) { FN_LS(F), FN_LS(F##_mte) }
760
+#define FN_HV(F) { FN_MTE(F##_h), FN_MTE(F##_v) }
761
+#define FN_END(L, B) { FN_HV(L), FN_HV(B) }
762
+
763
+ static GenLdSt1 * const fns[5][2][2][2][2] = {
764
+ FN_END(b, b),
765
+ FN_END(h_le, h_be),
766
+ FN_END(s_le, s_be),
767
+ FN_END(d_le, d_be),
768
+ FN_END(q_le, q_be),
769
+ };
770
+
771
+#undef FN_LS
772
+#undef FN_MTE
773
+#undef FN_HV
774
+#undef FN_END
775
+
776
+ TCGv_ptr t_za, t_pg;
777
+ TCGv_i64 addr;
778
+ int svl, desc = 0;
779
+ bool be = s->be_data == MO_BE;
780
+ bool mte = s->mte_active[0];
781
+
782
+ if (!dc_isar_feature(aa64_sme, s)) {
783
+ return false;
784
+ }
785
+ if (!sme_smza_enabled_check(s)) {
786
+ return true;
787
+ }
788
+
789
+ t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v);
790
+ t_pg = pred_full_reg_ptr(s, a->pg);
791
+ addr = tcg_temp_new_i64();
792
+
793
+ tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz);
794
+ tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn));
795
+
796
+ if (mte) {
797
+ desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s));
798
+ desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
799
+ desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma);
800
+ desc = FIELD_DP32(desc, MTEDESC, WRITE, a->st);
801
+ desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1);
802
+ desc <<= SVE_MTEDESC_SHIFT;
803
+ } else {
804
+ addr = clean_data_tbi(s, addr);
805
+ }
806
+ svl = streaming_vec_reg_size(s);
807
+ desc = simd_desc(svl, svl, desc);
808
+
809
+ fns[a->esz][be][a->v][mte][a->st](cpu_env, t_za, t_pg, addr,
810
+ tcg_constant_i32(desc));
811
+
812
+ tcg_temp_free_ptr(t_za);
813
+ tcg_temp_free_ptr(t_pg);
814
+ tcg_temp_free_i64(addr);
815
+ return true;
816
+}
152
--
817
--
153
2.20.1
818
2.25.1
154
155
diff view generated by jsdifflib
1
From: Andrew Jeffery <andrew@aj.id.au>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Initialise another SDHCI model instance for the AST2600's eMMC
3
Add a TCGv_ptr base argument, which will be cpu_env for SVE.
4
controller and use the SDHCI's num_slots value introduced previously to
4
We will reuse this for SME save and restore array insns.
5
determine whether we should create an SD card instance for the new slot.
6
5
7
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20220708151540.18136-22-richard.henderson@linaro.org
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
Message-id: 20200114103433.30534-3-clg@kaod.org
12
[ clg : - removed ternary operator from sdhci_attach_drive()
13
- renamed SDHCI objects with a '-controller' prefix ]
14
Signed-off-by: Cédric Le Goater <clg@kaod.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
include/hw/arm/aspeed_soc.h | 2 ++
11
target/arm/translate-a64.h | 3 +++
18
hw/arm/aspeed.c | 26 +++++++++++++++++---------
12
target/arm/translate-sve.c | 48 ++++++++++++++++++++++++++++----------
19
hw/arm/aspeed_ast2600.c | 29 ++++++++++++++++++++++++++---
13
2 files changed, 39 insertions(+), 12 deletions(-)
20
3 files changed, 45 insertions(+), 12 deletions(-)
21
14
22
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
15
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
23
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
24
--- a/include/hw/arm/aspeed_soc.h
17
--- a/target/arm/translate-a64.h
25
+++ b/include/hw/arm/aspeed_soc.h
18
+++ b/target/arm/translate-a64.h
26
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCState {
19
@@ -XXX,XX +XXX,XX @@ void gen_gvec_xar(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
27
AspeedGPIOState gpio;
20
uint32_t rm_ofs, int64_t shift,
28
AspeedGPIOState gpio_1_8v;
21
uint32_t opr_sz, uint32_t max_sz);
29
AspeedSDHCIState sdhci;
22
30
+ AspeedSDHCIState emmc;
23
+void gen_sve_ldr(DisasContext *s, TCGv_ptr, int vofs, int len, int rn, int imm);
31
} AspeedSoCState;
24
+void gen_sve_str(DisasContext *s, TCGv_ptr, int vofs, int len, int rn, int imm);
32
25
+
33
#define TYPE_ASPEED_SOC "aspeed-soc"
26
#endif /* TARGET_ARM_TRANSLATE_A64_H */
34
@@ -XXX,XX +XXX,XX @@ enum {
27
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
35
ASPEED_MII4,
36
ASPEED_SDRAM,
37
ASPEED_XDMA,
38
+ ASPEED_EMMC,
39
};
40
41
#endif /* ASPEED_SOC_H */
42
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
43
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
44
--- a/hw/arm/aspeed.c
29
--- a/target/arm/translate-sve.c
45
+++ b/hw/arm/aspeed.c
30
+++ b/target/arm/translate-sve.c
46
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
31
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
32
* The load should begin at the address Rn + IMM.
33
*/
34
35
-static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
36
+void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs,
37
+ int len, int rn, int imm)
38
{
39
int len_align = QEMU_ALIGN_DOWN(len, 8);
40
int len_remain = len % 8;
41
@@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
42
t0 = tcg_temp_new_i64();
43
for (i = 0; i < len_align; i += 8) {
44
tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUQ);
45
- tcg_gen_st_i64(t0, cpu_env, vofs + i);
46
+ tcg_gen_st_i64(t0, base, vofs + i);
47
tcg_gen_addi_i64(clean_addr, clean_addr, 8);
48
}
49
tcg_temp_free_i64(t0);
50
@@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
51
clean_addr = new_tmp_a64_local(s);
52
tcg_gen_mov_i64(clean_addr, t0);
53
54
+ if (base != cpu_env) {
55
+ TCGv_ptr b = tcg_temp_local_new_ptr();
56
+ tcg_gen_mov_ptr(b, base);
57
+ base = b;
58
+ }
59
+
60
gen_set_label(loop);
61
62
t0 = tcg_temp_new_i64();
63
@@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
64
tcg_gen_addi_i64(clean_addr, clean_addr, 8);
65
66
tp = tcg_temp_new_ptr();
67
- tcg_gen_add_ptr(tp, cpu_env, i);
68
+ tcg_gen_add_ptr(tp, base, i);
69
tcg_gen_addi_ptr(i, i, 8);
70
tcg_gen_st_i64(t0, tp, vofs);
71
tcg_temp_free_ptr(tp);
72
@@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
73
74
tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop);
75
tcg_temp_free_ptr(i);
76
+
77
+ if (base != cpu_env) {
78
+ tcg_temp_free_ptr(base);
79
+ assert(len_remain == 0);
80
+ }
81
}
82
83
/*
84
@@ -XXX,XX +XXX,XX @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
85
default:
86
g_assert_not_reached();
87
}
88
- tcg_gen_st_i64(t0, cpu_env, vofs + len_align);
89
+ tcg_gen_st_i64(t0, base, vofs + len_align);
90
tcg_temp_free_i64(t0);
47
}
91
}
48
}
92
}
49
93
50
+static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
94
/* Similarly for stores. */
51
+{
95
-static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
52
+ DeviceState *card;
96
+void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs,
97
+ int len, int rn, int imm)
98
{
99
int len_align = QEMU_ALIGN_DOWN(len, 8);
100
int len_remain = len % 8;
101
@@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
102
103
t0 = tcg_temp_new_i64();
104
for (i = 0; i < len_align; i += 8) {
105
- tcg_gen_ld_i64(t0, cpu_env, vofs + i);
106
+ tcg_gen_ld_i64(t0, base, vofs + i);
107
tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUQ);
108
tcg_gen_addi_i64(clean_addr, clean_addr, 8);
109
}
110
@@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
111
clean_addr = new_tmp_a64_local(s);
112
tcg_gen_mov_i64(clean_addr, t0);
113
114
+ if (base != cpu_env) {
115
+ TCGv_ptr b = tcg_temp_local_new_ptr();
116
+ tcg_gen_mov_ptr(b, base);
117
+ base = b;
118
+ }
53
+
119
+
54
+ card = qdev_create(qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
120
gen_set_label(loop);
55
+ TYPE_SD_CARD);
121
56
+ if (dinfo) {
122
t0 = tcg_temp_new_i64();
57
+ qdev_prop_set_drive(card, "drive", blk_by_legacy_dinfo(dinfo),
123
tp = tcg_temp_new_ptr();
58
+ &error_fatal);
124
- tcg_gen_add_ptr(tp, cpu_env, i);
125
+ tcg_gen_add_ptr(tp, base, i);
126
tcg_gen_ld_i64(t0, tp, vofs);
127
tcg_gen_addi_ptr(i, i, 8);
128
tcg_temp_free_ptr(tp);
129
@@ -XXX,XX +XXX,XX @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm)
130
131
tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop);
132
tcg_temp_free_ptr(i);
133
+
134
+ if (base != cpu_env) {
135
+ tcg_temp_free_ptr(base);
136
+ assert(len_remain == 0);
59
+ }
137
+ }
60
+ object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
61
+}
62
+
63
static void aspeed_machine_init(MachineState *machine)
64
{
65
AspeedBoardState *bmc;
66
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
67
}
138
}
68
139
69
for (i = 0; i < bmc->soc.sdhci.num_slots; i++) {
140
/* Predicate register stores can be any multiple of 2. */
70
- SDHCIState *sdhci = &bmc->soc.sdhci.slots[i];
141
if (len_remain) {
71
- DriveInfo *dinfo = drive_get_next(IF_SD);
142
t0 = tcg_temp_new_i64();
72
- BlockBackend *blk;
143
- tcg_gen_ld_i64(t0, cpu_env, vofs + len_align);
73
- DeviceState *card;
144
+ tcg_gen_ld_i64(t0, base, vofs + len_align);
74
+ sdhci_attach_drive(&bmc->soc.sdhci.slots[i], drive_get_next(IF_SD));
145
75
+ }
146
switch (len_remain) {
76
147
case 2:
77
- blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
148
@@ -XXX,XX +XXX,XX @@ static bool trans_LDR_zri(DisasContext *s, arg_rri *a)
78
- card = qdev_create(qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
149
if (sve_access_check(s)) {
79
- TYPE_SD_CARD);
150
int size = vec_full_reg_size(s);
80
- qdev_prop_set_drive(card, "drive", blk, &error_fatal);
151
int off = vec_full_reg_offset(s, a->rd);
81
- object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
152
- do_ldr(s, off, size, a->rn, a->imm * size);
82
+ if (bmc->soc.emmc.num_slots) {
153
+ gen_sve_ldr(s, cpu_env, off, size, a->rn, a->imm * size);
83
+ sdhci_attach_drive(&bmc->soc.emmc.slots[0], drive_get_next(IF_SD));
84
}
154
}
85
155
return true;
86
arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
156
}
87
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
157
@@ -XXX,XX +XXX,XX @@ static bool trans_LDR_pri(DisasContext *s, arg_rri *a)
88
index XXXXXXX..XXXXXXX 100644
158
if (sve_access_check(s)) {
89
--- a/hw/arm/aspeed_ast2600.c
159
int size = pred_full_reg_size(s);
90
+++ b/hw/arm/aspeed_ast2600.c
160
int off = pred_full_reg_offset(s, a->rd);
91
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2600_memmap[] = {
161
- do_ldr(s, off, size, a->rn, a->imm * size);
92
[ASPEED_ADC] = 0x1E6E9000,
162
+ gen_sve_ldr(s, cpu_env, off, size, a->rn, a->imm * size);
93
[ASPEED_VIDEO] = 0x1E700000,
94
[ASPEED_SDHCI] = 0x1E740000,
95
+ [ASPEED_EMMC] = 0x1E750000,
96
[ASPEED_GPIO] = 0x1E780000,
97
[ASPEED_GPIO_1_8V] = 0x1E780800,
98
[ASPEED_RTC] = 0x1E781000,
99
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2600_memmap[] = {
100
101
#define ASPEED_SOC_AST2600_MAX_IRQ 128
102
103
+/* Shared Peripheral Interrupt values below are offset by -32 from datasheet */
104
static const int aspeed_soc_ast2600_irqmap[] = {
105
[ASPEED_UART1] = 47,
106
[ASPEED_UART2] = 48,
107
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2600_irqmap[] = {
108
[ASPEED_ADC] = 78,
109
[ASPEED_XDMA] = 6,
110
[ASPEED_SDHCI] = 43,
111
+ [ASPEED_EMMC] = 15,
112
[ASPEED_GPIO] = 40,
113
[ASPEED_GPIO_1_8V] = 11,
114
[ASPEED_RTC] = 13,
115
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj)
116
sysbus_init_child_obj(obj, "gpio_1_8v", OBJECT(&s->gpio_1_8v),
117
sizeof(s->gpio_1_8v), typename);
118
119
- sysbus_init_child_obj(obj, "sdc", OBJECT(&s->sdhci), sizeof(s->sdhci),
120
- TYPE_ASPEED_SDHCI);
121
+ sysbus_init_child_obj(obj, "sd-controller", OBJECT(&s->sdhci),
122
+ sizeof(s->sdhci), TYPE_ASPEED_SDHCI);
123
124
object_property_set_int(OBJECT(&s->sdhci), 2, "num-slots", &error_abort);
125
126
/* Init sd card slot class here so that they're under the correct parent */
127
for (i = 0; i < ASPEED_SDHCI_NUM_SLOTS; ++i) {
128
- sysbus_init_child_obj(obj, "sdhci[*]", OBJECT(&s->sdhci.slots[i]),
129
+ sysbus_init_child_obj(obj, "sd-controller.sdhci[*]",
130
+ OBJECT(&s->sdhci.slots[i]),
131
sizeof(s->sdhci.slots[i]), TYPE_SYSBUS_SDHCI);
132
}
163
}
133
+
164
return true;
134
+ sysbus_init_child_obj(obj, "emmc-controller", OBJECT(&s->emmc),
135
+ sizeof(s->emmc), TYPE_ASPEED_SDHCI);
136
+
137
+ object_property_set_int(OBJECT(&s->emmc), 1, "num-slots", &error_abort);
138
+
139
+ sysbus_init_child_obj(obj, "emmc-controller.sdhci",
140
+ OBJECT(&s->emmc.slots[0]), sizeof(s->emmc.slots[0]),
141
+ TYPE_SYSBUS_SDHCI);
142
}
165
}
143
166
@@ -XXX,XX +XXX,XX @@ static bool trans_STR_zri(DisasContext *s, arg_rri *a)
144
/*
167
if (sve_access_check(s)) {
145
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
168
int size = vec_full_reg_size(s);
146
sc->memmap[ASPEED_SDHCI]);
169
int off = vec_full_reg_offset(s, a->rd);
147
sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0,
170
- do_str(s, off, size, a->rn, a->imm * size);
148
aspeed_soc_get_irq(s, ASPEED_SDHCI));
171
+ gen_sve_str(s, cpu_env, off, size, a->rn, a->imm * size);
149
+
172
}
150
+ /* eMMC */
173
return true;
151
+ object_property_set_bool(OBJECT(&s->emmc), true, "realized", &err);
152
+ if (err) {
153
+ error_propagate(errp, err);
154
+ return;
155
+ }
156
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->emmc), 0, sc->memmap[ASPEED_EMMC]);
157
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0,
158
+ aspeed_soc_get_irq(s, ASPEED_EMMC));
159
}
174
}
160
175
@@ -XXX,XX +XXX,XX @@ static bool trans_STR_pri(DisasContext *s, arg_rri *a)
161
static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data)
176
if (sve_access_check(s)) {
177
int size = pred_full_reg_size(s);
178
int off = pred_full_reg_offset(s, a->rd);
179
- do_str(s, off, size, a->rn, a->imm * size);
180
+ gen_sve_str(s, cpu_env, off, size, a->rn, a->imm * size);
181
}
182
return true;
183
}
162
--
184
--
163
2.20.1
185
2.25.1
164
165
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
We can reuse the SVE functions for LDR and STR, passing in the
4
base of the ZA vector and a zero offset.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-23-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/sme.decode | 7 +++++++
12
target/arm/translate-sme.c | 24 ++++++++++++++++++++++++
13
2 files changed, 31 insertions(+)
14
15
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/sme.decode
18
+++ b/target/arm/sme.decode
19
@@ -XXX,XX +XXX,XX @@ LDST1 1110000 0 esz:2 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \
20
&ldst rs=%mova_rs
21
LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \
22
&ldst esz=4 rs=%mova_rs
23
+
24
+&ldstr rv rn imm
25
+@ldstr ....... ... . ...... .. ... rn:5 . imm:4 \
26
+ &ldstr rv=%mova_rs
27
+
28
+LDR 1110000 100 0 000000 .. 000 ..... 0 .... @ldstr
29
+STR 1110000 100 1 000000 .. 000 ..... 0 .... @ldstr
30
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/translate-sme.c
33
+++ b/target/arm/translate-sme.c
34
@@ -XXX,XX +XXX,XX @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
35
tcg_temp_free_i64(addr);
36
return true;
37
}
38
+
39
+typedef void GenLdStR(DisasContext *, TCGv_ptr, int, int, int, int);
40
+
41
+static bool do_ldst_r(DisasContext *s, arg_ldstr *a, GenLdStR *fn)
42
+{
43
+ int svl = streaming_vec_reg_size(s);
44
+ int imm = a->imm;
45
+ TCGv_ptr base;
46
+
47
+ if (!sme_za_enabled_check(s)) {
48
+ return true;
49
+ }
50
+
51
+ /* ZA[n] equates to ZA0H.B[n]. */
52
+ base = get_tile_rowcol(s, MO_8, a->rv, imm, false);
53
+
54
+ fn(s, base, 0, svl, a->rn, imm * svl);
55
+
56
+ tcg_temp_free_ptr(base);
57
+ return true;
58
+}
59
+
60
+TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr)
61
+TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str)
62
--
63
2.25.1
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
This commit adds support of Resettable interface to buses and devices:
4
+ ResettableState structure is added in the Bus/Device state
5
+ Resettable methods are implemented.
6
+ device/bus_is_in_reset function defined
7
8
This commit allows to transition the objects to the new
9
multi-phase interface without changing the reset behavior at all.
10
Object single reset method can be split into the 3 different phases
11
but the 3 phases are still executed in a row for a given object.
12
From the qdev/qbus reset api point of view, nothing is changed.
13
qdev_reset_all() and qbus_reset_all() are not modified as well as
14
device_legacy_reset().
15
16
Transition of an object must be done from parent class to child class.
17
Care has been taken to allow the transition of a parent class
18
without requiring the child classes to be transitioned at the same
19
time. Note that SysBus and SysBusDevice class do not need any transition
20
because they do not override the legacy reset method.
21
22
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
24
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
26
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Message-id: 20220708151540.18136-24-richard.henderson@linaro.org
27
Message-id: 20200123132823.1117486-5-damien.hedde@greensocs.com
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
---
7
---
30
tests/Makefile.include | 1 +
8
target/arm/helper-sme.h | 5 +++
31
include/hw/qdev-core.h | 27 ++++++++++++
9
target/arm/sme.decode | 11 +++++
32
hw/core/bus.c | 97 ++++++++++++++++++++++++++++++++++++++++++
10
target/arm/sme_helper.c | 90 ++++++++++++++++++++++++++++++++++++++
33
hw/core/qdev.c | 93 ++++++++++++++++++++++++++++++++++++++++
11
target/arm/translate-sme.c | 31 +++++++++++++
34
4 files changed, 218 insertions(+)
12
4 files changed, 137 insertions(+)
35
13
36
diff --git a/tests/Makefile.include b/tests/Makefile.include
14
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
37
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
38
--- a/tests/Makefile.include
16
--- a/target/arm/helper-sme.h
39
+++ b/tests/Makefile.include
17
+++ b/target/arm/helper-sme.h
40
@@ -XXX,XX +XXX,XX @@ tests/fp/%:
18
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_5(sme_st1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i
41
tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
19
DEF_HELPER_FLAGS_5(sme_st1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
42
    hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
20
DEF_HELPER_FLAGS_5(sme_st1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
43
    hw/core/bus.o \
21
DEF_HELPER_FLAGS_5(sme_st1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32)
44
+    hw/core/resettable.o \
22
+
45
    hw/core/irq.o \
23
+DEF_HELPER_FLAGS_5(sme_addha_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
46
    hw/core/fw-path-provider.o \
24
+DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
47
    hw/core/reset.o \
25
+DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
48
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
26
+DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
27
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
49
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
50
--- a/include/hw/qdev-core.h
29
--- a/target/arm/sme.decode
51
+++ b/include/hw/qdev-core.h
30
+++ b/target/arm/sme.decode
52
@@ -XXX,XX +XXX,XX @@
31
@@ -XXX,XX +XXX,XX @@ LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \
53
#include "qemu/bitmap.h"
32
54
#include "qom/object.h"
33
LDR 1110000 100 0 000000 .. 000 ..... 0 .... @ldstr
55
#include "hw/hotplug.h"
34
STR 1110000 100 1 000000 .. 000 ..... 0 .... @ldstr
56
+#include "hw/resettable.h"
57
58
enum {
59
DEV_NVECTORS_UNSPECIFIED = -1,
60
@@ -XXX,XX +XXX,XX @@ typedef struct DeviceClass {
61
bool hotpluggable;
62
63
/* callbacks */
64
+ /*
65
+ * Reset method here is deprecated and replaced by methods in the
66
+ * resettable class interface to implement a multi-phase reset.
67
+ * TODO: remove once every reset callback is unused
68
+ */
69
DeviceReset reset;
70
DeviceRealize realize;
71
DeviceUnrealize unrealize;
72
@@ -XXX,XX +XXX,XX @@ struct NamedGPIOList {
73
/**
74
* DeviceState:
75
* @realized: Indicates whether the device has been fully constructed.
76
+ * @reset: ResettableState for the device; handled by Resettable interface.
77
*
78
* This structure should not be accessed directly. We declare it here
79
* so that it can be embedded in individual device state structures.
80
@@ -XXX,XX +XXX,XX @@ struct DeviceState {
81
int num_child_bus;
82
int instance_id_alias;
83
int alias_required_for_version;
84
+ ResettableState reset;
85
};
86
87
struct DeviceListener {
88
@@ -XXX,XX +XXX,XX @@ typedef struct BusChild {
89
/**
90
* BusState:
91
* @hotplug_handler: link to a hotplug handler associated with bus.
92
+ * @reset: ResettableState for the bus; handled by Resettable interface.
93
*/
94
struct BusState {
95
Object obj;
96
@@ -XXX,XX +XXX,XX @@ struct BusState {
97
int num_children;
98
QTAILQ_HEAD(, BusChild) children;
99
QLIST_ENTRY(BusState) sibling;
100
+ ResettableState reset;
101
};
102
103
/**
104
@@ -XXX,XX +XXX,XX @@ void qdev_reset_all_fn(void *opaque);
105
void qbus_reset_all(BusState *bus);
106
void qbus_reset_all_fn(void *opaque);
107
108
+/**
109
+ * device_is_in_reset:
110
+ * Return true if the device @dev is currently being reset.
111
+ */
112
+bool device_is_in_reset(DeviceState *dev);
113
+
35
+
114
+/**
36
+### SME Add Vector to Array
115
+ * bus_is_in_reset:
116
+ * Return true if the bus @bus is currently being reset.
117
+ */
118
+bool bus_is_in_reset(BusState *bus);
119
+
37
+
120
/* This should go away once we get rid of the NULL bus hack */
38
+&adda zad zn pm pn
121
BusState *sysbus_get_default(void);
39
+@adda_32 ........ .. ..... . pm:3 pn:3 zn:5 ... zad:2 &adda
122
40
+@adda_64 ........ .. ..... . pm:3 pn:3 zn:5 .. zad:3 &adda
123
@@ -XXX,XX +XXX,XX @@ void device_legacy_reset(DeviceState *dev);
41
+
124
42
+ADDHA_s 11000000 10 01000 0 ... ... ..... 000 .. @adda_32
125
void device_class_set_props(DeviceClass *dc, Property *props);
43
+ADDVA_s 11000000 10 01000 1 ... ... ..... 000 .. @adda_32
126
44
+ADDHA_d 11000000 11 01000 0 ... ... ..... 00 ... @adda_64
127
+/**
45
+ADDVA_d 11000000 11 01000 1 ... ... ..... 00 ... @adda_64
128
+ * device_class_set_parent_reset:
46
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
129
+ * TODO: remove the function when DeviceClass's reset method
130
+ * is not used anymore.
131
+ */
132
void device_class_set_parent_reset(DeviceClass *dc,
133
DeviceReset dev_reset,
134
DeviceReset *parent_reset);
135
diff --git a/hw/core/bus.c b/hw/core/bus.c
136
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
137
--- a/hw/core/bus.c
48
--- a/target/arm/sme_helper.c
138
+++ b/hw/core/bus.c
49
+++ b/target/arm/sme_helper.c
139
@@ -XXX,XX +XXX,XX @@ int qbus_walk_children(BusState *bus,
50
@@ -XXX,XX +XXX,XX @@ DO_ST(q, _be, MO_128)
140
return 0;
51
DO_ST(q, _le, MO_128)
141
}
52
142
53
#undef DO_ST
143
+bool bus_is_in_reset(BusState *bus)
54
+
55
+void HELPER(sme_addha_s)(void *vzda, void *vzn, void *vpn,
56
+ void *vpm, uint32_t desc)
144
+{
57
+{
145
+ return resettable_is_in_reset(OBJECT(bus));
58
+ intptr_t row, col, oprsz = simd_oprsz(desc) / 4;
146
+}
59
+ uint64_t *pn = vpn, *pm = vpm;
60
+ uint32_t *zda = vzda, *zn = vzn;
147
+
61
+
148
+static ResettableState *bus_get_reset_state(Object *obj)
62
+ for (row = 0; row < oprsz; ) {
149
+{
63
+ uint64_t pa = pn[row >> 4];
150
+ BusState *bus = BUS(obj);
64
+ do {
151
+ return &bus->reset;
65
+ if (pa & 1) {
152
+}
66
+ for (col = 0; col < oprsz; ) {
153
+
67
+ uint64_t pb = pm[col >> 4];
154
+static void bus_reset_child_foreach(Object *obj, ResettableChildCallback cb,
68
+ do {
155
+ void *opaque, ResetType type)
69
+ if (pb & 1) {
156
+{
70
+ zda[tile_vslice_index(row) + H4(col)] += zn[H4(col)];
157
+ BusState *bus = BUS(obj);
71
+ }
158
+ BusChild *kid;
72
+ pb >>= 4;
159
+
73
+ } while (++col & 15);
160
+ QTAILQ_FOREACH(kid, &bus->children, sibling) {
74
+ }
161
+ cb(OBJECT(kid->child), opaque, type);
75
+ }
76
+ pa >>= 4;
77
+ } while (++row & 15);
162
+ }
78
+ }
163
+}
79
+}
164
+
80
+
165
static void qbus_realize(BusState *bus, DeviceState *parent, const char *name)
81
+void HELPER(sme_addha_d)(void *vzda, void *vzn, void *vpn,
166
{
82
+ void *vpm, uint32_t desc)
167
const char *typename = object_get_typename(OBJECT(bus));
168
@@ -XXX,XX +XXX,XX @@ static char *default_bus_get_fw_dev_path(DeviceState *dev)
169
return g_strdup(object_get_typename(OBJECT(dev)));
170
}
171
172
+/**
173
+ * bus_phases_reset:
174
+ * Transition reset method for buses to allow moving
175
+ * smoothly from legacy reset method to multi-phases
176
+ */
177
+static void bus_phases_reset(BusState *bus)
178
+{
83
+{
179
+ ResettableClass *rc = RESETTABLE_GET_CLASS(bus);
84
+ intptr_t row, col, oprsz = simd_oprsz(desc) / 8;
85
+ uint8_t *pn = vpn, *pm = vpm;
86
+ uint64_t *zda = vzda, *zn = vzn;
180
+
87
+
181
+ if (rc->phases.enter) {
88
+ for (row = 0; row < oprsz; ++row) {
182
+ rc->phases.enter(OBJECT(bus), RESET_TYPE_COLD);
89
+ if (pn[H1(row)] & 1) {
183
+ }
90
+ for (col = 0; col < oprsz; ++col) {
184
+ if (rc->phases.hold) {
91
+ if (pm[H1(col)] & 1) {
185
+ rc->phases.hold(OBJECT(bus));
92
+ zda[tile_vslice_index(row) + col] += zn[col];
186
+ }
93
+ }
187
+ if (rc->phases.exit) {
94
+ }
188
+ rc->phases.exit(OBJECT(bus));
95
+ }
189
+ }
96
+ }
190
+}
97
+}
191
+
98
+
192
+static void bus_transitional_reset(Object *obj)
99
+void HELPER(sme_addva_s)(void *vzda, void *vzn, void *vpn,
100
+ void *vpm, uint32_t desc)
193
+{
101
+{
194
+ BusClass *bc = BUS_GET_CLASS(obj);
102
+ intptr_t row, col, oprsz = simd_oprsz(desc) / 4;
103
+ uint64_t *pn = vpn, *pm = vpm;
104
+ uint32_t *zda = vzda, *zn = vzn;
195
+
105
+
196
+ /*
106
+ for (row = 0; row < oprsz; ) {
197
+ * This will call either @bus_phases_reset (for multi-phases transitioned
107
+ uint64_t pa = pn[row >> 4];
198
+ * buses) or a bus's specific method for not-yet transitioned buses.
108
+ do {
199
+ * In both case, it does not reset children.
109
+ if (pa & 1) {
200
+ */
110
+ uint32_t zn_row = zn[H4(row)];
201
+ if (bc->reset) {
111
+ for (col = 0; col < oprsz; ) {
202
+ bc->reset(BUS(obj));
112
+ uint64_t pb = pm[col >> 4];
113
+ do {
114
+ if (pb & 1) {
115
+ zda[tile_vslice_index(row) + H4(col)] += zn_row;
116
+ }
117
+ pb >>= 4;
118
+ } while (++col & 15);
119
+ }
120
+ }
121
+ pa >>= 4;
122
+ } while (++row & 15);
203
+ }
123
+ }
204
+}
124
+}
205
+
125
+
206
+/**
126
+void HELPER(sme_addva_d)(void *vzda, void *vzn, void *vpn,
207
+ * bus_get_transitional_reset:
127
+ void *vpm, uint32_t desc)
208
+ * check if the bus's class is ready for multi-phase
209
+ */
210
+static ResettableTrFunction bus_get_transitional_reset(Object *obj)
211
+{
128
+{
212
+ BusClass *dc = BUS_GET_CLASS(obj);
129
+ intptr_t row, col, oprsz = simd_oprsz(desc) / 8;
213
+ if (dc->reset != bus_phases_reset) {
130
+ uint8_t *pn = vpn, *pm = vpm;
214
+ /*
131
+ uint64_t *zda = vzda, *zn = vzn;
215
+ * dc->reset has been overridden by a subclass,
132
+
216
+ * the bus is not ready for multi phase yet.
133
+ for (row = 0; row < oprsz; ++row) {
217
+ */
134
+ if (pn[H1(row)] & 1) {
218
+ return bus_transitional_reset;
135
+ uint64_t zn_row = zn[row];
136
+ for (col = 0; col < oprsz; ++col) {
137
+ if (pm[H1(col)] & 1) {
138
+ zda[tile_vslice_index(row) + col] += zn_row;
139
+ }
140
+ }
141
+ }
219
+ }
142
+ }
220
+ return NULL;
143
+}
144
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
145
index XXXXXXX..XXXXXXX 100644
146
--- a/target/arm/translate-sme.c
147
+++ b/target/arm/translate-sme.c
148
@@ -XXX,XX +XXX,XX @@ static bool do_ldst_r(DisasContext *s, arg_ldstr *a, GenLdStR *fn)
149
150
TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr)
151
TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str)
152
+
153
+static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz,
154
+ gen_helper_gvec_4 *fn)
155
+{
156
+ int svl = streaming_vec_reg_size(s);
157
+ uint32_t desc = simd_desc(svl, svl, 0);
158
+ TCGv_ptr za, zn, pn, pm;
159
+
160
+ if (!sme_smza_enabled_check(s)) {
161
+ return true;
162
+ }
163
+
164
+ /* Sum XZR+zad to find ZAd. */
165
+ za = get_tile_rowcol(s, esz, 31, a->zad, false);
166
+ zn = vec_full_reg_ptr(s, a->zn);
167
+ pn = pred_full_reg_ptr(s, a->pn);
168
+ pm = pred_full_reg_ptr(s, a->pm);
169
+
170
+ fn(za, zn, pn, pm, tcg_constant_i32(desc));
171
+
172
+ tcg_temp_free_ptr(za);
173
+ tcg_temp_free_ptr(zn);
174
+ tcg_temp_free_ptr(pn);
175
+ tcg_temp_free_ptr(pm);
176
+ return true;
221
+}
177
+}
222
+
178
+
223
static void bus_class_init(ObjectClass *class, void *data)
179
+TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addha_s)
224
{
180
+TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s)
225
BusClass *bc = BUS_CLASS(class);
181
+TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d)
226
+ ResettableClass *rc = RESETTABLE_CLASS(class);
182
+TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d)
227
228
class->unparent = bus_unparent;
229
bc->get_fw_dev_path = default_bus_get_fw_dev_path;
230
+
231
+ rc->get_state = bus_get_reset_state;
232
+ rc->child_foreach = bus_reset_child_foreach;
233
+
234
+ /*
235
+ * @bus_phases_reset is put as the default reset method below, allowing
236
+ * to do the multi-phase transition from base classes to leaf classes. It
237
+ * allows a legacy-reset Bus class to extend a multi-phases-reset
238
+ * Bus class for the following reason:
239
+ * + If a base class B has been moved to multi-phase, then it does not
240
+ * override this default reset method and may have defined phase methods.
241
+ * + A child class C (extending class B) which uses
242
+ * bus_class_set_parent_reset() (or similar means) to override the
243
+ * reset method will still work as expected. @bus_phases_reset function
244
+ * will be registered as the parent reset method and effectively call
245
+ * parent reset phases.
246
+ */
247
+ bc->reset = bus_phases_reset;
248
+ rc->get_transitional_function = bus_get_transitional_reset;
249
}
250
251
static void qbus_finalize(Object *obj)
252
@@ -XXX,XX +XXX,XX @@ static const TypeInfo bus_info = {
253
.instance_init = qbus_initfn,
254
.instance_finalize = qbus_finalize,
255
.class_init = bus_class_init,
256
+ .interfaces = (InterfaceInfo[]) {
257
+ { TYPE_RESETTABLE_INTERFACE },
258
+ { }
259
+ },
260
};
261
262
static void bus_register_types(void)
263
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
264
index XXXXXXX..XXXXXXX 100644
265
--- a/hw/core/qdev.c
266
+++ b/hw/core/qdev.c
267
@@ -XXX,XX +XXX,XX @@ void qbus_reset_all_fn(void *opaque)
268
qbus_reset_all(bus);
269
}
270
271
+bool device_is_in_reset(DeviceState *dev)
272
+{
273
+ return resettable_is_in_reset(OBJECT(dev));
274
+}
275
+
276
+static ResettableState *device_get_reset_state(Object *obj)
277
+{
278
+ DeviceState *dev = DEVICE(obj);
279
+ return &dev->reset;
280
+}
281
+
282
+static void device_reset_child_foreach(Object *obj, ResettableChildCallback cb,
283
+ void *opaque, ResetType type)
284
+{
285
+ DeviceState *dev = DEVICE(obj);
286
+ BusState *bus;
287
+
288
+ QLIST_FOREACH(bus, &dev->child_bus, sibling) {
289
+ cb(OBJECT(bus), opaque, type);
290
+ }
291
+}
292
+
293
/* can be used as ->unplug() callback for the simple cases */
294
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
295
DeviceState *dev, Error **errp)
296
@@ -XXX,XX +XXX,XX @@ device_vmstate_if_get_id(VMStateIf *obj)
297
return qdev_get_dev_path(dev);
298
}
299
300
+/**
301
+ * device_phases_reset:
302
+ * Transition reset method for devices to allow moving
303
+ * smoothly from legacy reset method to multi-phases
304
+ */
305
+static void device_phases_reset(DeviceState *dev)
306
+{
307
+ ResettableClass *rc = RESETTABLE_GET_CLASS(dev);
308
+
309
+ if (rc->phases.enter) {
310
+ rc->phases.enter(OBJECT(dev), RESET_TYPE_COLD);
311
+ }
312
+ if (rc->phases.hold) {
313
+ rc->phases.hold(OBJECT(dev));
314
+ }
315
+ if (rc->phases.exit) {
316
+ rc->phases.exit(OBJECT(dev));
317
+ }
318
+}
319
+
320
+static void device_transitional_reset(Object *obj)
321
+{
322
+ DeviceClass *dc = DEVICE_GET_CLASS(obj);
323
+
324
+ /*
325
+ * This will call either @device_phases_reset (for multi-phases transitioned
326
+ * devices) or a device's specific method for not-yet transitioned devices.
327
+ * In both case, it does not reset children.
328
+ */
329
+ if (dc->reset) {
330
+ dc->reset(DEVICE(obj));
331
+ }
332
+}
333
+
334
+/**
335
+ * device_get_transitional_reset:
336
+ * check if the device's class is ready for multi-phase
337
+ */
338
+static ResettableTrFunction device_get_transitional_reset(Object *obj)
339
+{
340
+ DeviceClass *dc = DEVICE_GET_CLASS(obj);
341
+ if (dc->reset != device_phases_reset) {
342
+ /*
343
+ * dc->reset has been overridden by a subclass,
344
+ * the device is not ready for multi phase yet.
345
+ */
346
+ return device_transitional_reset;
347
+ }
348
+ return NULL;
349
+}
350
+
351
static void device_class_init(ObjectClass *class, void *data)
352
{
353
DeviceClass *dc = DEVICE_CLASS(class);
354
VMStateIfClass *vc = VMSTATE_IF_CLASS(class);
355
+ ResettableClass *rc = RESETTABLE_CLASS(class);
356
357
class->unparent = device_unparent;
358
359
@@ -XXX,XX +XXX,XX @@ static void device_class_init(ObjectClass *class, void *data)
360
dc->hotpluggable = true;
361
dc->user_creatable = true;
362
vc->get_id = device_vmstate_if_get_id;
363
+ rc->get_state = device_get_reset_state;
364
+ rc->child_foreach = device_reset_child_foreach;
365
+
366
+ /*
367
+ * @device_phases_reset is put as the default reset method below, allowing
368
+ * to do the multi-phase transition from base classes to leaf classes. It
369
+ * allows a legacy-reset Device class to extend a multi-phases-reset
370
+ * Device class for the following reason:
371
+ * + If a base class B has been moved to multi-phase, then it does not
372
+ * override this default reset method and may have defined phase methods.
373
+ * + A child class C (extending class B) which uses
374
+ * device_class_set_parent_reset() (or similar means) to override the
375
+ * reset method will still work as expected. @device_phases_reset function
376
+ * will be registered as the parent reset method and effectively call
377
+ * parent reset phases.
378
+ */
379
+ dc->reset = device_phases_reset;
380
+ rc->get_transitional_function = device_get_transitional_reset;
381
382
object_class_property_add_bool(class, "realized",
383
device_get_realized, device_set_realized,
384
@@ -XXX,XX +XXX,XX @@ static const TypeInfo device_type_info = {
385
.class_size = sizeof(DeviceClass),
386
.interfaces = (InterfaceInfo[]) {
387
{ TYPE_VMSTATE_IF },
388
+ { TYPE_RESETTABLE_INTERFACE },
389
{ }
390
}
391
};
392
--
183
--
393
2.20.1
184
2.25.1
394
395
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
Message-id: 20220708151540.18136-25-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/helper-sme.h | 5 +++
9
target/arm/sme.decode | 9 +++++
10
target/arm/sme_helper.c | 69 ++++++++++++++++++++++++++++++++++++++
11
target/arm/translate-sme.c | 32 ++++++++++++++++++
12
4 files changed, 115 insertions(+)
13
14
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper-sme.h
17
+++ b/target/arm/helper-sme.h
18
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_5(sme_addha_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
19
DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
20
DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
21
DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
22
+
23
+DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG,
24
+ void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
25
+DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
26
+ void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
27
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/sme.decode
30
+++ b/target/arm/sme.decode
31
@@ -XXX,XX +XXX,XX @@ ADDHA_s 11000000 10 01000 0 ... ... ..... 000 .. @adda_32
32
ADDVA_s 11000000 10 01000 1 ... ... ..... 000 .. @adda_32
33
ADDHA_d 11000000 11 01000 0 ... ... ..... 00 ... @adda_64
34
ADDVA_d 11000000 11 01000 1 ... ... ..... 00 ... @adda_64
35
+
36
+### SME Outer Product
37
+
38
+&op zad zn zm pm pn sub:bool
39
+@op_32 ........ ... zm:5 pm:3 pn:3 zn:5 sub:1 .. zad:2 &op
40
+@op_64 ........ ... zm:5 pm:3 pn:3 zn:5 sub:1 . zad:3 &op
41
+
42
+FMOPA_s 10000000 100 ..... ... ... ..... . 00 .. @op_32
43
+FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64
44
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/target/arm/sme_helper.c
47
+++ b/target/arm/sme_helper.c
48
@@ -XXX,XX +XXX,XX @@
49
#include "exec/cpu_ldst.h"
50
#include "exec/exec-all.h"
51
#include "qemu/int128.h"
52
+#include "fpu/softfloat.h"
53
#include "vec_internal.h"
54
#include "sve_ldst_internal.h"
55
56
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_addva_d)(void *vzda, void *vzn, void *vpn,
57
}
58
}
59
}
60
+
61
+void HELPER(sme_fmopa_s)(void *vza, void *vzn, void *vzm, void *vpn,
62
+ void *vpm, void *vst, uint32_t desc)
63
+{
64
+ intptr_t row, col, oprsz = simd_maxsz(desc);
65
+ uint32_t neg = simd_data(desc) << 31;
66
+ uint16_t *pn = vpn, *pm = vpm;
67
+ float_status fpst;
68
+
69
+ /*
70
+ * Make a copy of float_status because this operation does not
71
+ * update the cumulative fp exception status. It also produces
72
+ * default nans.
73
+ */
74
+ fpst = *(float_status *)vst;
75
+ set_default_nan_mode(true, &fpst);
76
+
77
+ for (row = 0; row < oprsz; ) {
78
+ uint16_t pa = pn[H2(row >> 4)];
79
+ do {
80
+ if (pa & 1) {
81
+ void *vza_row = vza + tile_vslice_offset(row);
82
+ uint32_t n = *(uint32_t *)(vzn + H1_4(row)) ^ neg;
83
+
84
+ for (col = 0; col < oprsz; ) {
85
+ uint16_t pb = pm[H2(col >> 4)];
86
+ do {
87
+ if (pb & 1) {
88
+ uint32_t *a = vza_row + H1_4(col);
89
+ uint32_t *m = vzm + H1_4(col);
90
+ *a = float32_muladd(n, *m, *a, 0, vst);
91
+ }
92
+ col += 4;
93
+ pb >>= 4;
94
+ } while (col & 15);
95
+ }
96
+ }
97
+ row += 4;
98
+ pa >>= 4;
99
+ } while (row & 15);
100
+ }
101
+}
102
+
103
+void HELPER(sme_fmopa_d)(void *vza, void *vzn, void *vzm, void *vpn,
104
+ void *vpm, void *vst, uint32_t desc)
105
+{
106
+ intptr_t row, col, oprsz = simd_oprsz(desc) / 8;
107
+ uint64_t neg = (uint64_t)simd_data(desc) << 63;
108
+ uint64_t *za = vza, *zn = vzn, *zm = vzm;
109
+ uint8_t *pn = vpn, *pm = vpm;
110
+ float_status fpst = *(float_status *)vst;
111
+
112
+ set_default_nan_mode(true, &fpst);
113
+
114
+ for (row = 0; row < oprsz; ++row) {
115
+ if (pn[H1(row)] & 1) {
116
+ uint64_t *za_row = &za[tile_vslice_index(row)];
117
+ uint64_t n = zn[row] ^ neg;
118
+
119
+ for (col = 0; col < oprsz; ++col) {
120
+ if (pm[H1(col)] & 1) {
121
+ uint64_t *a = &za_row[col];
122
+ *a = float64_muladd(n, zm[col], *a, 0, &fpst);
123
+ }
124
+ }
125
+ }
126
+ }
127
+}
128
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
129
index XXXXXXX..XXXXXXX 100644
130
--- a/target/arm/translate-sme.c
131
+++ b/target/arm/translate-sme.c
132
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addha_s)
133
TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s)
134
TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d)
135
TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d)
136
+
137
+static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
138
+ gen_helper_gvec_5_ptr *fn)
139
+{
140
+ int svl = streaming_vec_reg_size(s);
141
+ uint32_t desc = simd_desc(svl, svl, a->sub);
142
+ TCGv_ptr za, zn, zm, pn, pm, fpst;
143
+
144
+ if (!sme_smza_enabled_check(s)) {
145
+ return true;
146
+ }
147
+
148
+ /* Sum XZR+zad to find ZAd. */
149
+ za = get_tile_rowcol(s, esz, 31, a->zad, false);
150
+ zn = vec_full_reg_ptr(s, a->zn);
151
+ zm = vec_full_reg_ptr(s, a->zm);
152
+ pn = pred_full_reg_ptr(s, a->pn);
153
+ pm = pred_full_reg_ptr(s, a->pm);
154
+ fpst = fpstatus_ptr(FPST_FPCR);
155
+
156
+ fn(za, zn, zm, pn, pm, fpst, tcg_constant_i32(desc));
157
+
158
+ tcg_temp_free_ptr(za);
159
+ tcg_temp_free_ptr(zn);
160
+ tcg_temp_free_ptr(pn);
161
+ tcg_temp_free_ptr(pm);
162
+ tcg_temp_free_ptr(fpst);
163
+ return true;
164
+}
165
+
166
+TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s)
167
+TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d)
168
--
169
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
Message-id: 20220708151540.18136-26-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/helper-sme.h | 2 ++
9
target/arm/sme.decode | 2 ++
10
target/arm/sme_helper.c | 56 ++++++++++++++++++++++++++++++++++++++
11
target/arm/translate-sme.c | 30 ++++++++++++++++++++
12
4 files changed, 90 insertions(+)
13
14
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper-sme.h
17
+++ b/target/arm/helper-sme.h
18
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG,
19
void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
20
DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
21
void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
22
+DEF_HELPER_FLAGS_6(sme_bfmopa, TCG_CALL_NO_RWG,
23
+ void, ptr, ptr, ptr, ptr, ptr, i32)
24
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
25
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/sme.decode
27
+++ b/target/arm/sme.decode
28
@@ -XXX,XX +XXX,XX @@ ADDVA_d 11000000 11 01000 1 ... ... ..... 00 ... @adda_64
29
30
FMOPA_s 10000000 100 ..... ... ... ..... . 00 .. @op_32
31
FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64
32
+
33
+BFMOPA 10000001 100 ..... ... ... ..... . 00 .. @op_32
34
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/sme_helper.c
37
+++ b/target/arm/sme_helper.c
38
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_fmopa_d)(void *vza, void *vzn, void *vzm, void *vpn,
39
}
40
}
41
}
42
+
43
+/*
44
+ * Alter PAIR as needed for controlling predicates being false,
45
+ * and for NEG on an enabled row element.
46
+ */
47
+static inline uint32_t f16mop_adj_pair(uint32_t pair, uint32_t pg, uint32_t neg)
48
+{
49
+ /*
50
+ * The pseudocode uses a conditional negate after the conditional zero.
51
+ * It is simpler here to unconditionally negate before conditional zero.
52
+ */
53
+ pair ^= neg;
54
+ if (!(pg & 1)) {
55
+ pair &= 0xffff0000u;
56
+ }
57
+ if (!(pg & 4)) {
58
+ pair &= 0x0000ffffu;
59
+ }
60
+ return pair;
61
+}
62
+
63
+void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn,
64
+ void *vpm, uint32_t desc)
65
+{
66
+ intptr_t row, col, oprsz = simd_maxsz(desc);
67
+ uint32_t neg = simd_data(desc) * 0x80008000u;
68
+ uint16_t *pn = vpn, *pm = vpm;
69
+
70
+ for (row = 0; row < oprsz; ) {
71
+ uint16_t prow = pn[H2(row >> 4)];
72
+ do {
73
+ void *vza_row = vza + tile_vslice_offset(row);
74
+ uint32_t n = *(uint32_t *)(vzn + H1_4(row));
75
+
76
+ n = f16mop_adj_pair(n, prow, neg);
77
+
78
+ for (col = 0; col < oprsz; ) {
79
+ uint16_t pcol = pm[H2(col >> 4)];
80
+ do {
81
+ if (prow & pcol & 0b0101) {
82
+ uint32_t *a = vza_row + H1_4(col);
83
+ uint32_t m = *(uint32_t *)(vzm + H1_4(col));
84
+
85
+ m = f16mop_adj_pair(m, pcol, 0);
86
+ *a = bfdotadd(*a, n, m);
87
+
88
+ col += 4;
89
+ pcol >>= 4;
90
+ }
91
+ } while (col & 15);
92
+ }
93
+ row += 4;
94
+ prow >>= 4;
95
+ } while (row & 15);
96
+ }
97
+}
98
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
99
index XXXXXXX..XXXXXXX 100644
100
--- a/target/arm/translate-sme.c
101
+++ b/target/arm/translate-sme.c
102
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s)
103
TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d)
104
TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d)
105
106
+static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz,
107
+ gen_helper_gvec_5 *fn)
108
+{
109
+ int svl = streaming_vec_reg_size(s);
110
+ uint32_t desc = simd_desc(svl, svl, a->sub);
111
+ TCGv_ptr za, zn, zm, pn, pm;
112
+
113
+ if (!sme_smza_enabled_check(s)) {
114
+ return true;
115
+ }
116
+
117
+ /* Sum XZR+zad to find ZAd. */
118
+ za = get_tile_rowcol(s, esz, 31, a->zad, false);
119
+ zn = vec_full_reg_ptr(s, a->zn);
120
+ zm = vec_full_reg_ptr(s, a->zm);
121
+ pn = pred_full_reg_ptr(s, a->pn);
122
+ pm = pred_full_reg_ptr(s, a->pm);
123
+
124
+ fn(za, zn, zm, pn, pm, tcg_constant_i32(desc));
125
+
126
+ tcg_temp_free_ptr(za);
127
+ tcg_temp_free_ptr(zn);
128
+ tcg_temp_free_ptr(pn);
129
+ tcg_temp_free_ptr(pm);
130
+ return true;
131
+}
132
+
133
static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
134
gen_helper_gvec_5_ptr *fn)
135
{
136
@@ -XXX,XX +XXX,XX @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
137
138
TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s)
139
TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d)
140
+
141
+/* TODO: FEAT_EBF16 */
142
+TRANS_FEAT(BFMOPA, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_bfmopa)
143
--
144
2.25.1
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Adds trace events to reset procedure and when updating the parent
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
bus of a device.
4
Message-id: 20220708151540.18136-27-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/helper-sme.h | 2 ++
9
target/arm/sme.decode | 1 +
10
target/arm/sme_helper.c | 74 ++++++++++++++++++++++++++++++++++++++
11
target/arm/translate-sme.c | 1 +
12
4 files changed, 78 insertions(+)
5
13
6
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
14
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
10
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20200123132823.1117486-3-damien.hedde@greensocs.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/core/qdev.c | 29 ++++++++++++++++++++++++++---
15
hw/core/trace-events | 9 +++++++++
16
2 files changed, 35 insertions(+), 3 deletions(-)
17
18
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
19
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/core/qdev.c
16
--- a/target/arm/helper-sme.h
21
+++ b/hw/core/qdev.c
17
+++ b/target/arm/helper-sme.h
22
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
23
#include "hw/boards.h"
19
DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
24
#include "hw/sysbus.h"
20
DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32)
25
#include "migration/vmstate.h"
21
26
+#include "trace.h"
22
+DEF_HELPER_FLAGS_7(sme_fmopa_h, TCG_CALL_NO_RWG,
27
23
+ void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
28
bool qdev_hotplug = false;
24
DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG,
29
static bool qdev_hot_added = false;
25
void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
30
@@ -XXX,XX +XXX,XX @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
26
DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
31
bool replugging = dev->parent_bus != NULL;
27
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
32
28
index XXXXXXX..XXXXXXX 100644
33
if (replugging) {
29
--- a/target/arm/sme.decode
34
- /* Keep a reference to the device while it's not plugged into
30
+++ b/target/arm/sme.decode
35
+ trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
31
@@ -XXX,XX +XXX,XX @@ FMOPA_s 10000000 100 ..... ... ... ..... . 00 .. @op_32
36
+ dev->parent_bus, object_get_typename(OBJECT(dev->parent_bus)),
32
FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64
37
+ OBJECT(bus), object_get_typename(OBJECT(bus)));
33
38
+ /*
34
BFMOPA 10000001 100 ..... ... ... ..... . 00 .. @op_32
39
+ * Keep a reference to the device while it's not plugged into
35
+FMOPA_h 10000001 101 ..... ... ... ..... . 00 .. @op_32
40
* any bus, to avoid it potentially evaporating when it is
36
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
41
* dereffed in bus_remove_child().
37
index XXXXXXX..XXXXXXX 100644
42
*/
38
--- a/target/arm/sme_helper.c
43
@@ -XXX,XX +XXX,XX @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
39
+++ b/target/arm/sme_helper.c
44
return hotplug_ctrl;
40
@@ -XXX,XX +XXX,XX @@ static inline uint32_t f16mop_adj_pair(uint32_t pair, uint32_t pg, uint32_t neg)
41
return pair;
45
}
42
}
46
43
47
+static int qdev_prereset(DeviceState *dev, void *opaque)
44
+static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2,
45
+ float_status *s_std, float_status *s_odd)
48
+{
46
+{
49
+ trace_qdev_reset_tree(dev, object_get_typename(OBJECT(dev)));
47
+ float64 e1r = float16_to_float64(e1 & 0xffff, true, s_std);
50
+ return 0;
48
+ float64 e1c = float16_to_float64(e1 >> 16, true, s_std);
49
+ float64 e2r = float16_to_float64(e2 & 0xffff, true, s_std);
50
+ float64 e2c = float16_to_float64(e2 >> 16, true, s_std);
51
+ float64 t64;
52
+ float32 t32;
53
+
54
+ /*
55
+ * The ARM pseudocode function FPDot performs both multiplies
56
+ * and the add with a single rounding operation. Emulate this
57
+ * by performing the first multiply in round-to-odd, then doing
58
+ * the second multiply as fused multiply-add, and rounding to
59
+ * float32 all in one step.
60
+ */
61
+ t64 = float64_mul(e1r, e2r, s_odd);
62
+ t64 = float64r32_muladd(e1c, e2c, t64, 0, s_std);
63
+
64
+ /* This conversion is exact, because we've already rounded. */
65
+ t32 = float64_to_float32(t64, s_std);
66
+
67
+ /* The final accumulation step is not fused. */
68
+ return float32_add(sum, t32, s_std);
51
+}
69
+}
52
+
70
+
53
+static int qbus_prereset(BusState *bus, void *opaque)
71
+void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn,
72
+ void *vpm, void *vst, uint32_t desc)
54
+{
73
+{
55
+ trace_qbus_reset_tree(bus, object_get_typename(OBJECT(bus)));
74
+ intptr_t row, col, oprsz = simd_maxsz(desc);
56
+ return 0;
75
+ uint32_t neg = simd_data(desc) * 0x80008000u;
76
+ uint16_t *pn = vpn, *pm = vpm;
77
+ float_status fpst_odd, fpst_std;
78
+
79
+ /*
80
+ * Make a copy of float_status because this operation does not
81
+ * update the cumulative fp exception status. It also produces
82
+ * default nans. Make a second copy with round-to-odd -- see above.
83
+ */
84
+ fpst_std = *(float_status *)vst;
85
+ set_default_nan_mode(true, &fpst_std);
86
+ fpst_odd = fpst_std;
87
+ set_float_rounding_mode(float_round_to_odd, &fpst_odd);
88
+
89
+ for (row = 0; row < oprsz; ) {
90
+ uint16_t prow = pn[H2(row >> 4)];
91
+ do {
92
+ void *vza_row = vza + tile_vslice_offset(row);
93
+ uint32_t n = *(uint32_t *)(vzn + H1_4(row));
94
+
95
+ n = f16mop_adj_pair(n, prow, neg);
96
+
97
+ for (col = 0; col < oprsz; ) {
98
+ uint16_t pcol = pm[H2(col >> 4)];
99
+ do {
100
+ if (prow & pcol & 0b0101) {
101
+ uint32_t *a = vza_row + H1_4(col);
102
+ uint32_t m = *(uint32_t *)(vzm + H1_4(col));
103
+
104
+ m = f16mop_adj_pair(m, pcol, 0);
105
+ *a = f16_dotadd(*a, n, m, &fpst_std, &fpst_odd);
106
+
107
+ col += 4;
108
+ pcol >>= 4;
109
+ }
110
+ } while (col & 15);
111
+ }
112
+ row += 4;
113
+ prow >>= 4;
114
+ } while (row & 15);
115
+ }
57
+}
116
+}
58
+
117
+
59
static int qdev_reset_one(DeviceState *dev, void *opaque)
118
void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn,
119
void *vpm, uint32_t desc)
60
{
120
{
61
device_legacy_reset(dev);
121
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
62
@@ -XXX,XX +XXX,XX @@ static int qdev_reset_one(DeviceState *dev, void *opaque)
122
index XXXXXXX..XXXXXXX 100644
63
static int qbus_reset_one(BusState *bus, void *opaque)
123
--- a/target/arm/translate-sme.c
64
{
124
+++ b/target/arm/translate-sme.c
65
BusClass *bc = BUS_GET_CLASS(bus);
125
@@ -XXX,XX +XXX,XX @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
66
+ trace_qbus_reset(bus, object_get_typename(OBJECT(bus)));
126
return true;
67
if (bc->reset) {
68
bc->reset(bus);
69
}
70
@@ -XXX,XX +XXX,XX @@ static int qbus_reset_one(BusState *bus, void *opaque)
71
72
void qdev_reset_all(DeviceState *dev)
73
{
74
- qdev_walk_children(dev, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
75
+ trace_qdev_reset_all(dev, object_get_typename(OBJECT(dev)));
76
+ qdev_walk_children(dev, qdev_prereset, qbus_prereset,
77
+ qdev_reset_one, qbus_reset_one, NULL);
78
}
127
}
79
128
80
void qdev_reset_all_fn(void *opaque)
129
+TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_h)
81
@@ -XXX,XX +XXX,XX @@ void qdev_reset_all_fn(void *opaque)
130
TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s)
82
131
TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d)
83
void qbus_reset_all(BusState *bus)
132
84
{
85
- qbus_walk_children(bus, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
86
+ trace_qbus_reset_all(bus, object_get_typename(OBJECT(bus)));
87
+ qbus_walk_children(bus, qdev_prereset, qbus_prereset,
88
+ qdev_reset_one, qbus_reset_one, NULL);
89
}
90
91
void qbus_reset_all_fn(void *opaque)
92
@@ -XXX,XX +XXX,XX @@ void device_legacy_reset(DeviceState *dev)
93
{
94
DeviceClass *klass = DEVICE_GET_CLASS(dev);
95
96
+ trace_qdev_reset(dev, object_get_typename(OBJECT(dev)));
97
if (klass->reset) {
98
klass->reset(dev);
99
}
100
diff --git a/hw/core/trace-events b/hw/core/trace-events
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/core/trace-events
103
+++ b/hw/core/trace-events
104
@@ -XXX,XX +XXX,XX @@
105
# loader.c
106
loader_write_rom(const char *name, uint64_t gpa, uint64_t size, bool isrom) "%s: @0x%"PRIx64" size=0x%"PRIx64" ROM=%d"
107
+
108
+# qdev.c
109
+qdev_reset(void *obj, const char *objtype) "obj=%p(%s)"
110
+qdev_reset_all(void *obj, const char *objtype) "obj=%p(%s)"
111
+qdev_reset_tree(void *obj, const char *objtype) "obj=%p(%s)"
112
+qbus_reset(void *obj, const char *objtype) "obj=%p(%s)"
113
+qbus_reset_all(void *obj, const char *objtype) "obj=%p(%s)"
114
+qbus_reset_tree(void *obj, const char *objtype) "obj=%p(%s)"
115
+qdev_update_parent_bus(void *obj, const char *objtype, void *oldp, const char *oldptype, void *newp, const char *newptype) "obj=%p(%s) old_parent=%p(%s) new_parent=%p(%s)"
116
--
133
--
117
2.20.1
134
2.25.1
118
119
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
In qdev_set_parent_bus(), when changing the parent bus of a
3
This is SMOPA, SUMOPA, USMOPA_s, UMOPA, for both Int8 and Int16.
4
realized device, if the source and destination buses are not in the
5
same reset state, some adaptations are required. This patch adds
6
needed call to resettable_change_parent() to make sure a device reset
7
state stays coherent with its parent bus.
8
4
9
The addition is a no-op if:
10
1. the device being parented is not realized.
11
2. the device is realized, but both buses are not under reset.
12
13
Case 2 means that as long as qdev_set_parent_bus() is called
14
during the machine realization procedure (which is before the
15
machine reset so nothing is in reset), it is a no op.
16
17
There are 52 call sites of qdev_set_parent_bus(). All but one fall
18
into the no-op case:
19
+ 29 trivial calls related to virtio (in hw/{s390x,display,virtio}/
20
{vhost,virtio}-xxx.c) to set a vdev(or vgpu) composing device
21
parent bus just before realizing the same vdev(vgpu).
22
+ hw/core/qdev.c: when creating a device in qdev_try_create()
23
+ hw/core/sysbus.c: when initializing a device in the sysbus
24
+ hw/i386/amd_iommu.c: before realizing AMDVIState/pci
25
+ hw/isa/piix4.c: before realizing PIIX4State/rtc
26
+ hw/misc/auxbus.c: when creating an AUXBus
27
+ hw/misc/auxbus.c: when creating an AUXBus child
28
+ hw/misc/macio/macio.c: when initializing a MACIOState child
29
+ hw/misc/macio/macio.c: before realizing NewWorldMacIOState/pmu
30
+ hw/misc/macio/macio.c: before realizing NewWorldMacIOState/cuda
31
+ hw/net/virtio-net.c: Used for migration when using the failover
32
mechanism to migration a vfio-pci/net. It is
33
a no-op because at this point the device is
34
already on the bus.
35
+ hw/pci-host/designware.c: before realizing DesignwarePCIEHost/root
36
+ hw/pci-host/gpex.c: before realizing GPEXHost/root
37
+ hw/pci-host/prep.c: when initialiazing PREPPCIState/pci_dev
38
+ hw/pci-host/q35.c: before realizing Q35PCIHost/mch
39
+ hw/pci-host/versatile.c: when initializing PCIVPBState/pci_dev
40
+ hw/pci-host/xilinx-pcie.c: before realizing XilinxPCIEHost/root
41
+ hw/s390x/event-facility.c: when creating SCLPEventFacility/
42
TYPE_SCLP_QUIESCE
43
+ hw/s390x/event-facility.c: ditto with SCLPEventFacility/
44
TYPE_SCLP_CPU_HOTPLUG
45
+ hw/s390x/sclp.c: Not trivial because it is called on a SLCPDevice
46
just after realizing it. Ok because at this point the destination
47
bus (sysbus) is not in reset; the realize step is before the
48
machine reset.
49
+ hw/sd/core.c: Not OK. Used in sdbus_reparent_card(). See below.
50
+ hw/ssi/ssi.c: Used to put spi slave on spi bus and connect the cs
51
line in ssi_auto_connect_slave(). Ok because this function is only
52
used in realize step in hw/ssi/aspeed_smc.ci, hw/ssi/imx_spi.c,
53
hw/ssi/mss-spi.c, hw/ssi/xilinx_spi.c and hw/ssi/xilinx_spips.c.
54
+ hw/xen/xen-legacy-backend.c: when creating a XenLegacyDevice device
55
+ qdev-monitor.c: in device hotplug creation procedure before realize
56
57
Note that this commit alone will have no effect, right now there is no
58
use of resettable API to reset anything. So a bus will never be tagged
59
as in-reset by this same API.
60
61
The one place where side-effect will occurs is in hw/sd/core.c in
62
sdbus_reparent_card(). This function is only used in the raspi machines,
63
including during the sysbus reset procedure. This case will be
64
carrefully handled when doing the multiple phase reset transition.
65
66
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
67
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
68
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
69
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20220708151540.18136-28-richard.henderson@linaro.org
70
Message-id: 20200123132823.1117486-7-damien.hedde@greensocs.com
71
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
72
---
9
---
73
hw/core/qdev.c | 16 +++++++++++-----
10
target/arm/helper-sme.h | 16 ++++++++
74
1 file changed, 11 insertions(+), 5 deletions(-)
11
target/arm/sme.decode | 10 +++++
12
target/arm/sme_helper.c | 82 ++++++++++++++++++++++++++++++++++++++
13
target/arm/translate-sme.c | 10 +++++
14
4 files changed, 118 insertions(+)
75
15
76
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
16
diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
77
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
78
--- a/hw/core/qdev.c
18
--- a/target/arm/helper-sme.h
79
+++ b/hw/core/qdev.c
19
+++ b/target/arm/helper-sme.h
80
@@ -XXX,XX +XXX,XX @@ static void bus_add_child(BusState *bus, DeviceState *child)
20
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
81
21
void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
82
void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
22
DEF_HELPER_FLAGS_6(sme_bfmopa, TCG_CALL_NO_RWG,
83
{
23
void, ptr, ptr, ptr, ptr, ptr, i32)
84
- bool replugging = dev->parent_bus != NULL;
24
+DEF_HELPER_FLAGS_6(sme_smopa_s, TCG_CALL_NO_RWG,
85
+ BusState *old_parent_bus = dev->parent_bus;
25
+ void, ptr, ptr, ptr, ptr, ptr, i32)
86
26
+DEF_HELPER_FLAGS_6(sme_umopa_s, TCG_CALL_NO_RWG,
87
- if (replugging) {
27
+ void, ptr, ptr, ptr, ptr, ptr, i32)
88
+ if (old_parent_bus) {
28
+DEF_HELPER_FLAGS_6(sme_sumopa_s, TCG_CALL_NO_RWG,
89
trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
29
+ void, ptr, ptr, ptr, ptr, ptr, i32)
90
- dev->parent_bus, object_get_typename(OBJECT(dev->parent_bus)),
30
+DEF_HELPER_FLAGS_6(sme_usmopa_s, TCG_CALL_NO_RWG,
91
+ old_parent_bus, object_get_typename(OBJECT(old_parent_bus)),
31
+ void, ptr, ptr, ptr, ptr, ptr, i32)
92
OBJECT(bus), object_get_typename(OBJECT(bus)));
32
+DEF_HELPER_FLAGS_6(sme_smopa_d, TCG_CALL_NO_RWG,
93
/*
33
+ void, ptr, ptr, ptr, ptr, ptr, i32)
94
* Keep a reference to the device while it's not plugged into
34
+DEF_HELPER_FLAGS_6(sme_umopa_d, TCG_CALL_NO_RWG,
95
* any bus, to avoid it potentially evaporating when it is
35
+ void, ptr, ptr, ptr, ptr, ptr, i32)
96
* dereffed in bus_remove_child().
36
+DEF_HELPER_FLAGS_6(sme_sumopa_d, TCG_CALL_NO_RWG,
97
+ * Also keep the ref of the parent bus until the end, so that
37
+ void, ptr, ptr, ptr, ptr, ptr, i32)
98
+ * we can safely call resettable_change_parent() below.
38
+DEF_HELPER_FLAGS_6(sme_usmopa_d, TCG_CALL_NO_RWG,
99
*/
39
+ void, ptr, ptr, ptr, ptr, ptr, i32)
100
object_ref(OBJECT(dev));
40
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
101
bus_remove_child(dev->parent_bus, dev);
41
index XXXXXXX..XXXXXXX 100644
102
- object_unref(OBJECT(dev->parent_bus));
42
--- a/target/arm/sme.decode
103
}
43
+++ b/target/arm/sme.decode
104
dev->parent_bus = bus;
44
@@ -XXX,XX +XXX,XX @@ FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64
105
object_ref(OBJECT(bus));
45
106
bus_add_child(bus, dev);
46
BFMOPA 10000001 100 ..... ... ... ..... . 00 .. @op_32
107
- if (replugging) {
47
FMOPA_h 10000001 101 ..... ... ... ..... . 00 .. @op_32
108
+ if (dev->realized) {
48
+
109
+ resettable_change_parent(OBJECT(dev), OBJECT(bus),
49
+SMOPA_s 1010000 0 10 0 ..... ... ... ..... . 00 .. @op_32
110
+ OBJECT(old_parent_bus));
50
+SUMOPA_s 1010000 0 10 1 ..... ... ... ..... . 00 .. @op_32
111
+ }
51
+USMOPA_s 1010000 1 10 0 ..... ... ... ..... . 00 .. @op_32
112
+ if (old_parent_bus) {
52
+UMOPA_s 1010000 1 10 1 ..... ... ... ..... . 00 .. @op_32
113
+ object_unref(OBJECT(old_parent_bus));
53
+
114
object_unref(OBJECT(dev));
54
+SMOPA_d 1010000 0 11 0 ..... ... ... ..... . 0 ... @op_64
55
+SUMOPA_d 1010000 0 11 1 ..... ... ... ..... . 0 ... @op_64
56
+USMOPA_d 1010000 1 11 0 ..... ... ... ..... . 0 ... @op_64
57
+UMOPA_d 1010000 1 11 1 ..... ... ... ..... . 0 ... @op_64
58
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/sme_helper.c
61
+++ b/target/arm/sme_helper.c
62
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn,
63
} while (row & 15);
115
}
64
}
116
}
65
}
66
+
67
+typedef uint64_t IMOPFn(uint64_t, uint64_t, uint64_t, uint8_t, bool);
68
+
69
+static inline void do_imopa(uint64_t *za, uint64_t *zn, uint64_t *zm,
70
+ uint8_t *pn, uint8_t *pm,
71
+ uint32_t desc, IMOPFn *fn)
72
+{
73
+ intptr_t row, col, oprsz = simd_oprsz(desc) / 8;
74
+ bool neg = simd_data(desc);
75
+
76
+ for (row = 0; row < oprsz; ++row) {
77
+ uint8_t pa = pn[H1(row)];
78
+ uint64_t *za_row = &za[tile_vslice_index(row)];
79
+ uint64_t n = zn[row];
80
+
81
+ for (col = 0; col < oprsz; ++col) {
82
+ uint8_t pb = pm[H1(col)];
83
+ uint64_t *a = &za_row[col];
84
+
85
+ *a = fn(n, zm[col], *a, pa & pb, neg);
86
+ }
87
+ }
88
+}
89
+
90
+#define DEF_IMOP_32(NAME, NTYPE, MTYPE) \
91
+static uint64_t NAME(uint64_t n, uint64_t m, uint64_t a, uint8_t p, bool neg) \
92
+{ \
93
+ uint32_t sum0 = 0, sum1 = 0; \
94
+ /* Apply P to N as a mask, making the inactive elements 0. */ \
95
+ n &= expand_pred_b(p); \
96
+ sum0 += (NTYPE)(n >> 0) * (MTYPE)(m >> 0); \
97
+ sum0 += (NTYPE)(n >> 8) * (MTYPE)(m >> 8); \
98
+ sum0 += (NTYPE)(n >> 16) * (MTYPE)(m >> 16); \
99
+ sum0 += (NTYPE)(n >> 24) * (MTYPE)(m >> 24); \
100
+ sum1 += (NTYPE)(n >> 32) * (MTYPE)(m >> 32); \
101
+ sum1 += (NTYPE)(n >> 40) * (MTYPE)(m >> 40); \
102
+ sum1 += (NTYPE)(n >> 48) * (MTYPE)(m >> 48); \
103
+ sum1 += (NTYPE)(n >> 56) * (MTYPE)(m >> 56); \
104
+ if (neg) { \
105
+ sum0 = (uint32_t)a - sum0, sum1 = (uint32_t)(a >> 32) - sum1; \
106
+ } else { \
107
+ sum0 = (uint32_t)a + sum0, sum1 = (uint32_t)(a >> 32) + sum1; \
108
+ } \
109
+ return ((uint64_t)sum1 << 32) | sum0; \
110
+}
111
+
112
+#define DEF_IMOP_64(NAME, NTYPE, MTYPE) \
113
+static uint64_t NAME(uint64_t n, uint64_t m, uint64_t a, uint8_t p, bool neg) \
114
+{ \
115
+ uint64_t sum = 0; \
116
+ /* Apply P to N as a mask, making the inactive elements 0. */ \
117
+ n &= expand_pred_h(p); \
118
+ sum += (NTYPE)(n >> 0) * (MTYPE)(m >> 0); \
119
+ sum += (NTYPE)(n >> 16) * (MTYPE)(m >> 16); \
120
+ sum += (NTYPE)(n >> 32) * (MTYPE)(m >> 32); \
121
+ sum += (NTYPE)(n >> 48) * (MTYPE)(m >> 48); \
122
+ return neg ? a - sum : a + sum; \
123
+}
124
+
125
+DEF_IMOP_32(smopa_s, int8_t, int8_t)
126
+DEF_IMOP_32(umopa_s, uint8_t, uint8_t)
127
+DEF_IMOP_32(sumopa_s, int8_t, uint8_t)
128
+DEF_IMOP_32(usmopa_s, uint8_t, int8_t)
129
+
130
+DEF_IMOP_64(smopa_d, int16_t, int16_t)
131
+DEF_IMOP_64(umopa_d, uint16_t, uint16_t)
132
+DEF_IMOP_64(sumopa_d, int16_t, uint16_t)
133
+DEF_IMOP_64(usmopa_d, uint16_t, int16_t)
134
+
135
+#define DEF_IMOPH(NAME) \
136
+ void HELPER(sme_##NAME)(void *vza, void *vzn, void *vzm, void *vpn, \
137
+ void *vpm, uint32_t desc) \
138
+ { do_imopa(vza, vzn, vzm, vpn, vpm, desc, NAME); }
139
+
140
+DEF_IMOPH(smopa_s)
141
+DEF_IMOPH(umopa_s)
142
+DEF_IMOPH(sumopa_s)
143
+DEF_IMOPH(usmopa_s)
144
+DEF_IMOPH(smopa_d)
145
+DEF_IMOPH(umopa_d)
146
+DEF_IMOPH(sumopa_d)
147
+DEF_IMOPH(usmopa_d)
148
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
149
index XXXXXXX..XXXXXXX 100644
150
--- a/target/arm/translate-sme.c
151
+++ b/target/arm/translate-sme.c
152
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_f
153
154
/* TODO: FEAT_EBF16 */
155
TRANS_FEAT(BFMOPA, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_bfmopa)
156
+
157
+TRANS_FEAT(SMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_smopa_s)
158
+TRANS_FEAT(UMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_umopa_s)
159
+TRANS_FEAT(SUMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_sumopa_s)
160
+TRANS_FEAT(USMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_usmopa_s)
161
+
162
+TRANS_FEAT(SMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_smopa_d)
163
+TRANS_FEAT(UMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_umopa_d)
164
+TRANS_FEAT(SUMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_sumopa_d)
165
+TRANS_FEAT(USMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_usmopa_d)
117
--
166
--
118
2.20.1
167
2.25.1
119
120
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
3
This is an SVE instruction that operates using the SVE vector
4
length but that it is present only if SME is implemented.
5
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20200123132823.1117486-10-damien.hedde@greensocs.com
8
Message-id: 20220708151540.18136-29-richard.henderson@linaro.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
10
---
9
docs/devel/index.rst | 1 +
11
target/arm/sve.decode | 20 +++++++++++++
10
docs/devel/reset.rst | 289 +++++++++++++++++++++++++++++++++++++++++++
12
target/arm/translate-sve.c | 57 ++++++++++++++++++++++++++++++++++++++
11
2 files changed, 290 insertions(+)
13
2 files changed, 77 insertions(+)
12
create mode 100644 docs/devel/reset.rst
13
14
14
diff --git a/docs/devel/index.rst b/docs/devel/index.rst
15
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/devel/index.rst
17
--- a/target/arm/sve.decode
17
+++ b/docs/devel/index.rst
18
+++ b/target/arm/sve.decode
18
@@ -XXX,XX +XXX,XX @@ Contents:
19
@@ -XXX,XX +XXX,XX @@ BFMLALT_zzxw 01100100 11 1 ..... 0100.1 ..... ..... @rrxr_3a esz=2
19
tcg
20
20
tcg-plugins
21
### SVE2 floating-point bfloat16 dot-product (indexed)
21
bitops
22
BFDOT_zzxz 01100100 01 1 ..... 010000 ..... ..... @rrxr_2 esz=2
22
+ reset
23
diff --git a/docs/devel/reset.rst b/docs/devel/reset.rst
24
new file mode 100644
25
index XXXXXXX..XXXXXXX
26
--- /dev/null
27
+++ b/docs/devel/reset.rst
28
@@ -XXX,XX +XXX,XX @@
29
+
23
+
30
+=======================================
24
+### SVE broadcast predicate element
31
+Reset in QEMU: the Resettable interface
32
+=======================================
33
+
25
+
34
+The reset of qemu objects is handled using the resettable interface declared
26
+&psel esz pd pn pm rv imm
35
+in ``include/hw/resettable.h``.
27
+%psel_rv 16:2 !function=plus_12
28
+%psel_imm_b 22:2 19:2
29
+%psel_imm_h 22:2 20:1
30
+%psel_imm_s 22:2
31
+%psel_imm_d 23:1
32
+@psel ........ .. . ... .. .. pn:4 . pm:4 . pd:4 \
33
+ &psel rv=%psel_rv
36
+
34
+
37
+This interface allows objects to be grouped (on a tree basis); so that the
35
+PSEL 00100101 .. 1 ..1 .. 01 .... 0 .... 0 .... \
38
+whole group can be reset consistently. Each individual member object does not
36
+ @psel esz=0 imm=%psel_imm_b
39
+have to care about others; in particular, problems of order (which object is
37
+PSEL 00100101 .. 1 .10 .. 01 .... 0 .... 0 .... \
40
+reset first) are addressed.
38
+ @psel esz=1 imm=%psel_imm_h
39
+PSEL 00100101 .. 1 100 .. 01 .... 0 .... 0 .... \
40
+ @psel esz=2 imm=%psel_imm_s
41
+PSEL 00100101 .1 1 000 .. 01 .... 0 .... 0 .... \
42
+ @psel esz=3 imm=%psel_imm_d
43
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/target/arm/translate-sve.c
46
+++ b/target/arm/translate-sve.c
47
@@ -XXX,XX +XXX,XX @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel)
48
49
TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false)
50
TRANS_FEAT(BFMLALT_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, true)
41
+
51
+
42
+As of now DeviceClass and BusClass implement this interface.
52
+static bool trans_PSEL(DisasContext *s, arg_psel *a)
53
+{
54
+ int vl = vec_full_reg_size(s);
55
+ int pl = pred_gvec_reg_size(s);
56
+ int elements = vl >> a->esz;
57
+ TCGv_i64 tmp, didx, dbit;
58
+ TCGv_ptr ptr;
43
+
59
+
44
+
60
+ if (!dc_isar_feature(aa64_sme, s)) {
45
+Triggering reset
61
+ return false;
46
+----------------
62
+ }
47
+
63
+ if (!sve_access_check(s)) {
48
+This section documents the APIs which "users" of a resettable object should use
64
+ return true;
49
+to control it. All resettable control functions must be called while holding
50
+the iothread lock.
51
+
52
+You can apply a reset to an object using ``resettable_assert_reset()``. You need
53
+to call ``resettable_release_reset()`` to release the object from reset. To
54
+instantly reset an object, without keeping it in reset state, just call
55
+``resettable_reset()``. These functions take two parameters: a pointer to the
56
+object to reset and a reset type.
57
+
58
+Several types of reset will be supported. For now only cold reset is defined;
59
+others may be added later. The Resettable interface handles reset types with an
60
+enum:
61
+
62
+``RESET_TYPE_COLD``
63
+ Cold reset is supported by every resettable object. In QEMU, it means we reset
64
+ to the initial state corresponding to the start of QEMU; this might differ
65
+ from what is a real hardware cold reset. It differs from other resets (like
66
+ warm or bus resets) which may keep certain parts untouched.
67
+
68
+Calling ``resettable_reset()`` is equivalent to calling
69
+``resettable_assert_reset()`` then ``resettable_release_reset()``. It is
70
+possible to interleave multiple calls to these three functions. There may
71
+be several reset sources/controllers of a given object. The interface handles
72
+everything and the different reset controllers do not need to know anything
73
+about each others. The object will leave reset state only when each other
74
+controllers end their reset operation. This point is handled internally by
75
+maintaining a count of in-progress resets; it is crucial to call
76
+``resettable_release_reset()`` one time and only one time per
77
+``resettable_assert_reset()`` call.
78
+
79
+For now migration of a device or bus in reset is not supported. Care must be
80
+taken not to delay ``resettable_release_reset()`` after its
81
+``resettable_assert_reset()`` counterpart.
82
+
83
+Note that, since resettable is an interface, the API takes a simple Object as
84
+parameter. Still, it is a programming error to call a resettable function on a
85
+non-resettable object and it will trigger a run time assert error. Since most
86
+calls to resettable interface are done through base class functions, such an
87
+error is not likely to happen.
88
+
89
+For Devices and Buses, the following helper functions exist:
90
+
91
+- ``device_cold_reset()``
92
+- ``bus_cold_reset()``
93
+
94
+These are simple wrappers around resettable_reset() function; they only cast the
95
+Device or Bus into an Object and pass the cold reset type. When possible
96
+prefer to use these functions instead of ``resettable_reset()``.
97
+
98
+Device and bus functions co-exist because there can be semantic differences
99
+between resetting a bus and resetting the controller bridge which owns it.
100
+For example, consider a SCSI controller. Resetting the controller puts all
101
+its registers back to what reset state was as well as reset everything on the
102
+SCSI bus, whereas resetting just the SCSI bus only resets everything that's on
103
+it but not the controller.
104
+
105
+
106
+Multi-phase mechanism
107
+---------------------
108
+
109
+This section documents the internals of the resettable interface.
110
+
111
+The resettable interface uses a multi-phase system to relieve objects and
112
+machines from reset ordering problems. To address this, the reset operation
113
+of an object is split into three well defined phases.
114
+
115
+When resetting several objects (for example the whole machine at simulation
116
+startup), all first phases of all objects are executed, then all second phases
117
+and then all third phases.
118
+
119
+The three phases are:
120
+
121
+1. The **enter** phase is executed when the object enters reset. It resets only
122
+ local state of the object; it must not do anything that has a side-effect
123
+ on other objects, such as raising or lowering a qemu_irq line or reading or
124
+ writing guest memory.
125
+
126
+2. The **hold** phase is executed for entry into reset, once every object in the
127
+ group which is being reset has had its *enter* phase executed. At this point
128
+ devices can do actions that affect other objects.
129
+
130
+3. The **exit** phase is executed when the object leaves the reset state.
131
+ Actions affecting other objects are permitted.
132
+
133
+As said in previous section, the interface maintains a count of reset. This
134
+count is used to ensure phases are executed only when required. *enter* and
135
+*hold* phases are executed only when asserting reset for the first time
136
+(if an object is already in reset state when calling
137
+``resettable_assert_reset()`` or ``resettable_reset()``, they are not
138
+executed).
139
+The *exit* phase is executed only when the last reset operation ends. Therefore
140
+the object does not need to care how many of reset controllers it has and how
141
+many of them have started a reset.
142
+
143
+
144
+Handling reset in a resettable object
145
+-------------------------------------
146
+
147
+This section documents the APIs that an implementation of a resettable object
148
+must provide and what functions it has access to. It is intended for people
149
+who want to implement or convert a class which has the resettable interface;
150
+for example when specializing an existing device or bus.
151
+
152
+Methods to implement
153
+....................
154
+
155
+Three methods should be defined or left empty. Each method corresponds to a
156
+phase of the reset; they are name ``phases.enter()``, ``phases.hold()`` and
157
+``phases.exit()``. They all take the object as parameter. The *enter* method
158
+also take the reset type as second parameter.
159
+
160
+When extending an existing class, these methods may need to be extended too.
161
+The ``resettable_class_set_parent_phases()`` class function may be used to
162
+backup parent class methods.
163
+
164
+Here follows an example to implement reset for a Device which sets an IO while
165
+in reset.
166
+
167
+::
168
+
169
+ static void mydev_reset_enter(Object *obj, ResetType type)
170
+ {
171
+ MyDevClass *myclass = MYDEV_GET_CLASS(obj);
172
+ MyDevState *mydev = MYDEV(obj);
173
+ /* call parent class enter phase */
174
+ if (myclass->parent_phases.enter) {
175
+ myclass->parent_phases.enter(obj, type);
176
+ }
177
+ /* initialize local state only */
178
+ mydev->var = 0;
179
+ }
65
+ }
180
+
66
+
181
+ static void mydev_reset_hold(Object *obj)
67
+ tmp = tcg_temp_new_i64();
182
+ {
68
+ dbit = tcg_temp_new_i64();
183
+ MyDevClass *myclass = MYDEV_GET_CLASS(obj);
69
+ didx = tcg_temp_new_i64();
184
+ MyDevState *mydev = MYDEV(obj);
70
+ ptr = tcg_temp_new_ptr();
185
+ /* call parent class hold phase */
71
+
186
+ if (myclass->parent_phases.hold) {
72
+ /* Compute the predicate element. */
187
+ myclass->parent_phases.hold(obj);
73
+ tcg_gen_addi_i64(tmp, cpu_reg(s, a->rv), a->imm);
188
+ }
74
+ if (is_power_of_2(elements)) {
189
+ /* set an IO */
75
+ tcg_gen_andi_i64(tmp, tmp, elements - 1);
190
+ qemu_set_irq(mydev->irq, 1);
76
+ } else {
77
+ tcg_gen_remu_i64(tmp, tmp, tcg_constant_i64(elements));
191
+ }
78
+ }
192
+
79
+
193
+ static void mydev_reset_exit(Object *obj)
80
+ /* Extract the predicate byte and bit indices. */
194
+ {
81
+ tcg_gen_shli_i64(tmp, tmp, a->esz);
195
+ MyDevClass *myclass = MYDEV_GET_CLASS(obj);
82
+ tcg_gen_andi_i64(dbit, tmp, 7);
196
+ MyDevState *mydev = MYDEV(obj);
83
+ tcg_gen_shri_i64(didx, tmp, 3);
197
+ /* call parent class exit phase */
84
+ if (HOST_BIG_ENDIAN) {
198
+ if (myclass->parent_phases.exit) {
85
+ tcg_gen_xori_i64(didx, didx, 7);
199
+ myclass->parent_phases.exit(obj);
200
+ }
201
+ /* clear an IO */
202
+ qemu_set_irq(mydev->irq, 0);
203
+ }
86
+ }
204
+
87
+
205
+ typedef struct MyDevClass {
88
+ /* Load the predicate word. */
206
+ MyParentClass parent_class;
89
+ tcg_gen_trunc_i64_ptr(ptr, didx);
207
+ /* to store eventual parent reset methods */
90
+ tcg_gen_add_ptr(ptr, ptr, cpu_env);
208
+ ResettablePhases parent_phases;
91
+ tcg_gen_ld8u_i64(tmp, ptr, pred_full_reg_offset(s, a->pm));
209
+ } MyDevClass;
210
+
92
+
211
+ static void mydev_class_init(ObjectClass *class, void *data)
93
+ /* Extract the predicate bit and replicate to MO_64. */
212
+ {
94
+ tcg_gen_shr_i64(tmp, tmp, dbit);
213
+ MyDevClass *myclass = MYDEV_CLASS(class);
95
+ tcg_gen_andi_i64(tmp, tmp, 1);
214
+ ResettableClass *rc = RESETTABLE_CLASS(class);
96
+ tcg_gen_neg_i64(tmp, tmp);
215
+ resettable_class_set_parent_reset_phases(rc,
216
+ mydev_reset_enter,
217
+ mydev_reset_hold,
218
+ mydev_reset_exit,
219
+ &myclass->parent_phases);
220
+ }
221
+
97
+
222
+In the above example, we override all three phases. It is possible to override
98
+ /* Apply to either copy the source, or write zeros. */
223
+only some of them by passing NULL instead of a function pointer to
99
+ tcg_gen_gvec_ands(MO_64, pred_full_reg_offset(s, a->pd),
224
+``resettable_class_set_parent_reset_phases()``. For example, the following will
100
+ pred_full_reg_offset(s, a->pn), tmp, pl, pl);
225
+only override the *enter* phase and leave *hold* and *exit* untouched::
226
+
101
+
227
+ resettable_class_set_parent_reset_phases(rc, mydev_reset_enter,
102
+ tcg_temp_free_i64(tmp);
228
+ NULL, NULL,
103
+ tcg_temp_free_i64(dbit);
229
+ &myclass->parent_phases);
104
+ tcg_temp_free_i64(didx);
230
+
105
+ tcg_temp_free_ptr(ptr);
231
+This is equivalent to providing a trivial implementation of the hold and exit
106
+ return true;
232
+phases which does nothing but call the parent class's implementation of the
107
+}
233
+phase.
234
+
235
+Polling the reset state
236
+.......................
237
+
238
+Resettable interface provides the ``resettable_is_in_reset()`` function.
239
+This function returns true if the object parameter is currently under reset.
240
+
241
+An object is under reset from the beginning of the *init* phase to the end of
242
+the *exit* phase. During all three phases, the function will return that the
243
+object is in reset.
244
+
245
+This function may be used if the object behavior has to be adapted
246
+while in reset state. For example if a device has an irq input,
247
+it will probably need to ignore it while in reset; then it can for
248
+example check the reset state at the beginning of the irq callback.
249
+
250
+Note that until migration of the reset state is supported, an object
251
+should not be left in reset. So apart from being currently executing
252
+one of the reset phases, the only cases when this function will return
253
+true is if an external interaction (like changing an io) is made during
254
+*hold* or *exit* phase of another object in the same reset group.
255
+
256
+Helpers ``device_is_in_reset()`` and ``bus_is_in_reset()`` are also provided
257
+for devices and buses and should be preferred.
258
+
259
+
260
+Base class handling of reset
261
+----------------------------
262
+
263
+This section documents parts of the reset mechanism that you only need to know
264
+about if you are extending it to work with a new base class other than
265
+DeviceClass or BusClass, or maintaining the existing code in those classes. Most
266
+people can ignore it.
267
+
268
+Methods to implement
269
+....................
270
+
271
+There are two other methods that need to exist in a class implementing the
272
+interface: ``get_state()`` and ``child_foreach()``.
273
+
274
+``get_state()`` is simple. *resettable* is an interface and, as a consequence,
275
+does not have any class state structure. But in order to factorize the code, we
276
+need one. This method must return a pointer to ``ResettableState`` structure.
277
+The structure must be allocated by the base class; preferably it should be
278
+located inside the object instance structure.
279
+
280
+``child_foreach()`` is more complex. It should execute the given callback on
281
+every reset child of the given resettable object. All children must be
282
+resettable too. Additional parameters (a reset type and an opaque pointer) must
283
+be passed to the callback too.
284
+
285
+In ``DeviceClass`` and ``BusClass`` the ``ResettableState`` is located
286
+``DeviceState`` and ``BusState`` structure. ``child_foreach()`` is implemented
287
+to follow the bus hierarchy; for a bus, it calls the function on every child
288
+device; for a device, it calls the function on every bus child. When we reset
289
+the main system bus, we reset the whole machine bus tree.
290
+
291
+Changing a resettable parent
292
+............................
293
+
294
+One thing which should be taken care of by the base class is handling reset
295
+hierarchy changes.
296
+
297
+The reset hierarchy is supposed to be static and built during machine creation.
298
+But there are actually some exceptions. To cope with this, the resettable API
299
+provides ``resettable_change_parent()``. This function allows to set, update or
300
+remove the parent of a resettable object after machine creation is done. As
301
+parameters, it takes the object being moved, the old parent if any and the new
302
+parent if any.
303
+
304
+This function can be used at any time when not in a reset operation. During
305
+a reset operation it must be used only in *hold* phase. Using it in *enter* or
306
+*exit* phase is an error.
307
+Also it should not be used during machine creation, although it is harmless to
308
+do so: the function is a no-op as long as old and new parent are NULL or not
309
+in reset.
310
+
311
+There is currently 2 cases where this function is used:
312
+
313
+1. *device hotplug*; it means a new device is introduced on a live bus.
314
+
315
+2. *hot bus change*; it means an existing live device is added, moved or
316
+ removed in the bus hierarchy. At the moment, it occurs only in the raspi
317
+ machines for changing the sdbus used by sd card.
318
--
108
--
319
2.20.1
109
2.25.1
320
321
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
This commit make use of the resettable API to reset the device being
3
This is an SVE instruction that operates using the SVE vector
4
hotplugged when it is realized. Also it ensures it is put in a reset
4
length but that it is present only if SME is implemented.
5
state coherent with the parent it is plugged into.
6
5
7
Note that there is a difference in the reset. Instead of resetting
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
only the hotplugged device, we reset also its subtree (switch to
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
resettable API). This is not expected to be a problem because
8
Message-id: 20220708151540.18136-30-richard.henderson@linaro.org
10
sub-buses are just realized too. If a hotplugged device has any
11
sub-buses it is logical to reset them too at this point.
12
13
The recently added should_be_hidden and PCI's partially_hotplugged
14
mechanisms do not interfere with realize operation:
15
+ In the should_be_hidden use case, device creation is
16
delayed.
17
+ The partially_hotplugged mechanism prevents a device to be
18
unplugged and unrealized from qdev POV and unrealized.
19
20
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
23
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
24
Message-id: 20200123132823.1117486-8-damien.hedde@greensocs.com
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
---
10
---
27
include/hw/resettable.h | 11 +++++++++++
11
target/arm/helper-sve.h | 2 ++
28
hw/core/qdev.c | 15 ++++++++++++++-
12
target/arm/sve.decode | 1 +
29
2 files changed, 25 insertions(+), 1 deletion(-)
13
target/arm/sve_helper.c | 16 ++++++++++++++++
14
target/arm/translate-sve.c | 2 ++
15
4 files changed, 21 insertions(+)
30
16
31
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
17
diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h
32
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
33
--- a/include/hw/resettable.h
19
--- a/target/arm/helper-sve.h
34
+++ b/include/hw/resettable.h
20
+++ b/target/arm/helper-sve.h
35
@@ -XXX,XX +XXX,XX @@ struct ResettableState {
21
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_4(sve_revh_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
36
bool exit_phase_in_progress;
22
37
};
23
DEF_HELPER_FLAGS_4(sve_revw_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
38
24
39
+/**
25
+DEF_HELPER_FLAGS_4(sme_revd_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
40
+ * resettable_state_clear:
26
+
41
+ * Clear the state. It puts the state to the initial (zeroed) state required
27
DEF_HELPER_FLAGS_4(sve_rbit_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
42
+ * to reuse an object. Typically used in realize step of base classes
28
DEF_HELPER_FLAGS_4(sve_rbit_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
43
+ * implementing the interface.
29
DEF_HELPER_FLAGS_4(sve_rbit_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
44
+ */
30
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
45
+static inline void resettable_state_clear(ResettableState *state)
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/sve.decode
33
+++ b/target/arm/sve.decode
34
@@ -XXX,XX +XXX,XX @@ REVB 00000101 .. 1001 00 100 ... ..... ..... @rd_pg_rn
35
REVH 00000101 .. 1001 01 100 ... ..... ..... @rd_pg_rn
36
REVW 00000101 .. 1001 10 100 ... ..... ..... @rd_pg_rn
37
RBIT 00000101 .. 1001 11 100 ... ..... ..... @rd_pg_rn
38
+REVD 00000101 00 1011 10 100 ... ..... ..... @rd_pg_rn_e0
39
40
# SVE vector splice (predicated, destructive)
41
SPLICE 00000101 .. 101 100 100 ... ..... ..... @rdn_pg_rm
42
diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
43
index XXXXXXX..XXXXXXX 100644
44
--- a/target/arm/sve_helper.c
45
+++ b/target/arm/sve_helper.c
46
@@ -XXX,XX +XXX,XX @@ DO_ZPZ_D(sve_revh_d, uint64_t, hswap64)
47
48
DO_ZPZ_D(sve_revw_d, uint64_t, wswap64)
49
50
+void HELPER(sme_revd_q)(void *vd, void *vn, void *vg, uint32_t desc)
46
+{
51
+{
47
+ memset(state, 0, sizeof(ResettableState));
52
+ intptr_t i, opr_sz = simd_oprsz(desc) / 8;
53
+ uint64_t *d = vd, *n = vn;
54
+ uint8_t *pg = vg;
55
+
56
+ for (i = 0; i < opr_sz; i += 2) {
57
+ if (pg[H1(i)] & 1) {
58
+ uint64_t n0 = n[i + 0];
59
+ uint64_t n1 = n[i + 1];
60
+ d[i + 0] = n1;
61
+ d[i + 1] = n0;
62
+ }
63
+ }
48
+}
64
+}
49
+
65
+
50
/**
66
DO_ZPZ(sve_rbit_b, uint8_t, H1, revbit8)
51
* resettable_reset:
67
DO_ZPZ(sve_rbit_h, uint16_t, H1_2, revbit16)
52
* Trigger a reset on an object @obj of type @type. @obj must implement
68
DO_ZPZ(sve_rbit_s, uint32_t, H1_4, revbit32)
53
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
69
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
54
index XXXXXXX..XXXXXXX 100644
70
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/core/qdev.c
71
--- a/target/arm/translate-sve.c
56
+++ b/hw/core/qdev.c
72
+++ b/target/arm/translate-sve.c
57
@@ -XXX,XX +XXX,XX @@ static void device_set_realized(Object *obj, bool value, Error **errp)
73
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0)
58
}
74
TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz,
59
}
75
a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0)
60
76
61
+ /*
77
+TRANS_FEAT(REVD, aa64_sme, gen_gvec_ool_arg_zpz, gen_helper_sme_revd_q, a, 0)
62
+ * Clear the reset state, in case the object was previously unrealized
63
+ * with a dirty state.
64
+ */
65
+ resettable_state_clear(&dev->reset);
66
+
78
+
67
QLIST_FOREACH(bus, &dev->child_bus, sibling) {
79
TRANS_FEAT(SPLICE, aa64_sve, gen_gvec_ool_arg_zpzz,
68
object_property_set_bool(OBJECT(bus), true, "realized",
80
gen_helper_sve_splice, a, a->esz)
69
&local_err);
70
@@ -XXX,XX +XXX,XX @@ static void device_set_realized(Object *obj, bool value, Error **errp)
71
}
72
}
73
if (dev->hotplugged) {
74
- device_legacy_reset(dev);
75
+ /*
76
+ * Reset the device, as well as its subtree which, at this point,
77
+ * should be realized too.
78
+ */
79
+ resettable_assert_reset(OBJECT(dev), RESET_TYPE_COLD);
80
+ resettable_change_parent(OBJECT(dev), OBJECT(dev->parent_bus),
81
+ NULL);
82
+ resettable_release_reset(OBJECT(dev), RESET_TYPE_COLD);
83
}
84
dev->pending_deleted_event = false;
85
81
86
--
82
--
87
2.20.1
83
2.25.1
88
89
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
This is an SVE instruction that operates using the SVE vector
4
length but that it is present only if SME is implemented.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-31-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/helper.h | 18 +++++++
12
target/arm/sve.decode | 5 ++
13
target/arm/translate-sve.c | 102 +++++++++++++++++++++++++++++++++++++
14
target/arm/vec_helper.c | 24 +++++++++
15
4 files changed, 149 insertions(+)
16
17
diff --git a/target/arm/helper.h b/target/arm/helper.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/helper.h
20
+++ b/target/arm/helper.h
21
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_6(gvec_bfmlal, TCG_CALL_NO_RWG,
22
DEF_HELPER_FLAGS_6(gvec_bfmlal_idx, TCG_CALL_NO_RWG,
23
void, ptr, ptr, ptr, ptr, ptr, i32)
24
25
+DEF_HELPER_FLAGS_5(gvec_sclamp_b, TCG_CALL_NO_RWG,
26
+ void, ptr, ptr, ptr, ptr, i32)
27
+DEF_HELPER_FLAGS_5(gvec_sclamp_h, TCG_CALL_NO_RWG,
28
+ void, ptr, ptr, ptr, ptr, i32)
29
+DEF_HELPER_FLAGS_5(gvec_sclamp_s, TCG_CALL_NO_RWG,
30
+ void, ptr, ptr, ptr, ptr, i32)
31
+DEF_HELPER_FLAGS_5(gvec_sclamp_d, TCG_CALL_NO_RWG,
32
+ void, ptr, ptr, ptr, ptr, i32)
33
+
34
+DEF_HELPER_FLAGS_5(gvec_uclamp_b, TCG_CALL_NO_RWG,
35
+ void, ptr, ptr, ptr, ptr, i32)
36
+DEF_HELPER_FLAGS_5(gvec_uclamp_h, TCG_CALL_NO_RWG,
37
+ void, ptr, ptr, ptr, ptr, i32)
38
+DEF_HELPER_FLAGS_5(gvec_uclamp_s, TCG_CALL_NO_RWG,
39
+ void, ptr, ptr, ptr, ptr, i32)
40
+DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,
41
+ void, ptr, ptr, ptr, ptr, i32)
42
+
43
#ifdef TARGET_AARCH64
44
#include "helper-a64.h"
45
#include "helper-sve.h"
46
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
47
index XXXXXXX..XXXXXXX 100644
48
--- a/target/arm/sve.decode
49
+++ b/target/arm/sve.decode
50
@@ -XXX,XX +XXX,XX @@ PSEL 00100101 .. 1 100 .. 01 .... 0 .... 0 .... \
51
@psel esz=2 imm=%psel_imm_s
52
PSEL 00100101 .1 1 000 .. 01 .... 0 .... 0 .... \
53
@psel esz=3 imm=%psel_imm_d
54
+
55
+### SVE clamp
56
+
57
+SCLAMP 01000100 .. 0 ..... 110000 ..... ..... @rda_rn_rm
58
+UCLAMP 01000100 .. 0 ..... 110001 ..... ..... @rda_rn_rm
59
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/target/arm/translate-sve.c
62
+++ b/target/arm/translate-sve.c
63
@@ -XXX,XX +XXX,XX @@ static bool trans_PSEL(DisasContext *s, arg_psel *a)
64
tcg_temp_free_ptr(ptr);
65
return true;
66
}
67
+
68
+static void gen_sclamp_i32(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_i32 a)
69
+{
70
+ tcg_gen_smax_i32(d, a, n);
71
+ tcg_gen_smin_i32(d, d, m);
72
+}
73
+
74
+static void gen_sclamp_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 a)
75
+{
76
+ tcg_gen_smax_i64(d, a, n);
77
+ tcg_gen_smin_i64(d, d, m);
78
+}
79
+
80
+static void gen_sclamp_vec(unsigned vece, TCGv_vec d, TCGv_vec n,
81
+ TCGv_vec m, TCGv_vec a)
82
+{
83
+ tcg_gen_smax_vec(vece, d, a, n);
84
+ tcg_gen_smin_vec(vece, d, d, m);
85
+}
86
+
87
+static void gen_sclamp(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
88
+ uint32_t a, uint32_t oprsz, uint32_t maxsz)
89
+{
90
+ static const TCGOpcode vecop[] = {
91
+ INDEX_op_smin_vec, INDEX_op_smax_vec, 0
92
+ };
93
+ static const GVecGen4 ops[4] = {
94
+ { .fniv = gen_sclamp_vec,
95
+ .fno = gen_helper_gvec_sclamp_b,
96
+ .opt_opc = vecop,
97
+ .vece = MO_8 },
98
+ { .fniv = gen_sclamp_vec,
99
+ .fno = gen_helper_gvec_sclamp_h,
100
+ .opt_opc = vecop,
101
+ .vece = MO_16 },
102
+ { .fni4 = gen_sclamp_i32,
103
+ .fniv = gen_sclamp_vec,
104
+ .fno = gen_helper_gvec_sclamp_s,
105
+ .opt_opc = vecop,
106
+ .vece = MO_32 },
107
+ { .fni8 = gen_sclamp_i64,
108
+ .fniv = gen_sclamp_vec,
109
+ .fno = gen_helper_gvec_sclamp_d,
110
+ .opt_opc = vecop,
111
+ .vece = MO_64,
112
+ .prefer_i64 = TCG_TARGET_REG_BITS == 64 }
113
+ };
114
+ tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &ops[vece]);
115
+}
116
+
117
+TRANS_FEAT(SCLAMP, aa64_sme, gen_gvec_fn_arg_zzzz, gen_sclamp, a)
118
+
119
+static void gen_uclamp_i32(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_i32 a)
120
+{
121
+ tcg_gen_umax_i32(d, a, n);
122
+ tcg_gen_umin_i32(d, d, m);
123
+}
124
+
125
+static void gen_uclamp_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 a)
126
+{
127
+ tcg_gen_umax_i64(d, a, n);
128
+ tcg_gen_umin_i64(d, d, m);
129
+}
130
+
131
+static void gen_uclamp_vec(unsigned vece, TCGv_vec d, TCGv_vec n,
132
+ TCGv_vec m, TCGv_vec a)
133
+{
134
+ tcg_gen_umax_vec(vece, d, a, n);
135
+ tcg_gen_umin_vec(vece, d, d, m);
136
+}
137
+
138
+static void gen_uclamp(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
139
+ uint32_t a, uint32_t oprsz, uint32_t maxsz)
140
+{
141
+ static const TCGOpcode vecop[] = {
142
+ INDEX_op_umin_vec, INDEX_op_umax_vec, 0
143
+ };
144
+ static const GVecGen4 ops[4] = {
145
+ { .fniv = gen_uclamp_vec,
146
+ .fno = gen_helper_gvec_uclamp_b,
147
+ .opt_opc = vecop,
148
+ .vece = MO_8 },
149
+ { .fniv = gen_uclamp_vec,
150
+ .fno = gen_helper_gvec_uclamp_h,
151
+ .opt_opc = vecop,
152
+ .vece = MO_16 },
153
+ { .fni4 = gen_uclamp_i32,
154
+ .fniv = gen_uclamp_vec,
155
+ .fno = gen_helper_gvec_uclamp_s,
156
+ .opt_opc = vecop,
157
+ .vece = MO_32 },
158
+ { .fni8 = gen_uclamp_i64,
159
+ .fniv = gen_uclamp_vec,
160
+ .fno = gen_helper_gvec_uclamp_d,
161
+ .opt_opc = vecop,
162
+ .vece = MO_64,
163
+ .prefer_i64 = TCG_TARGET_REG_BITS == 64 }
164
+ };
165
+ tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &ops[vece]);
166
+}
167
+
168
+TRANS_FEAT(UCLAMP, aa64_sme, gen_gvec_fn_arg_zzzz, gen_uclamp, a)
169
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
170
index XXXXXXX..XXXXXXX 100644
171
--- a/target/arm/vec_helper.c
172
+++ b/target/arm/vec_helper.c
173
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_bfmlal_idx)(void *vd, void *vn, void *vm,
174
}
175
clear_tail(d, opr_sz, simd_maxsz(desc));
176
}
177
+
178
+#define DO_CLAMP(NAME, TYPE) \
179
+void HELPER(NAME)(void *d, void *n, void *m, void *a, uint32_t desc) \
180
+{ \
181
+ intptr_t i, opr_sz = simd_oprsz(desc); \
182
+ for (i = 0; i < opr_sz; i += sizeof(TYPE)) { \
183
+ TYPE aa = *(TYPE *)(a + i); \
184
+ TYPE nn = *(TYPE *)(n + i); \
185
+ TYPE mm = *(TYPE *)(m + i); \
186
+ TYPE dd = MIN(MAX(aa, nn), mm); \
187
+ *(TYPE *)(d + i) = dd; \
188
+ } \
189
+ clear_tail(d, opr_sz, simd_maxsz(desc)); \
190
+}
191
+
192
+DO_CLAMP(gvec_sclamp_b, int8_t)
193
+DO_CLAMP(gvec_sclamp_h, int16_t)
194
+DO_CLAMP(gvec_sclamp_s, int32_t)
195
+DO_CLAMP(gvec_sclamp_d, int64_t)
196
+
197
+DO_CLAMP(gvec_uclamp_b, uint8_t)
198
+DO_CLAMP(gvec_uclamp_h, uint16_t)
199
+DO_CLAMP(gvec_uclamp_s, uint32_t)
200
+DO_CLAMP(gvec_uclamp_d, uint64_t)
201
--
202
2.25.1
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Add the missing GENERIC_TIMER feature to kvm64 cpus.
3
We can handle both exception entry and exception return by
4
hooking into aarch64_sve_change_el.
4
5
5
We don't currently use these registers when KVM is enabled, but it's
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
probably best we add the feature flag for consistency and potential
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
future use. There's also precedent, as we add the PMU feature flag to
8
Message-id: 20220708151540.18136-32-richard.henderson@linaro.org
8
KVM enabled guests, even though we don't use those registers either.
9
10
This change was originally posted as a hunk of a different, never
11
merged patch from Bijan Mottahedeh.
12
13
Signed-off-by: Andrew Jones <drjones@redhat.com>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20200120101023.16030-4-drjones@redhat.com
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
10
---
18
target/arm/kvm64.c | 1 +
11
target/arm/helper.c | 15 +++++++++++++--
19
1 file changed, 1 insertion(+)
12
1 file changed, 13 insertions(+), 2 deletions(-)
20
13
21
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
22
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/kvm64.c
16
--- a/target/arm/helper.c
24
+++ b/target/arm/kvm64.c
17
+++ b/target/arm/helper.c
25
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
18
@@ -XXX,XX +XXX,XX @@ void aarch64_sve_change_el(CPUARMState *env, int old_el,
26
set_feature(&features, ARM_FEATURE_NEON);
19
return;
27
set_feature(&features, ARM_FEATURE_AARCH64);
20
}
28
set_feature(&features, ARM_FEATURE_PMU);
21
29
+ set_feature(&features, ARM_FEATURE_GENERIC_TIMER);
22
+ old_a64 = old_el ? arm_el_is_aa64(env, old_el) : el0_a64;
30
23
+ new_a64 = new_el ? arm_el_is_aa64(env, new_el) : el0_a64;
31
ahcf->features = features;
24
+
25
+ /*
26
+ * Both AArch64.TakeException and AArch64.ExceptionReturn
27
+ * invoke ResetSVEState when taking an exception from, or
28
+ * returning to, AArch32 state when PSTATE.SM is enabled.
29
+ */
30
+ if (old_a64 != new_a64 && FIELD_EX64(env->svcr, SVCR, SM)) {
31
+ arm_reset_sve_state(env);
32
+ return;
33
+ }
34
+
35
/*
36
* DDI0584A.d sec 3.2: "If SVE instructions are disabled or trapped
37
* at ELx, or not available because the EL is in AArch32 state, then
38
@@ -XXX,XX +XXX,XX @@ void aarch64_sve_change_el(CPUARMState *env, int old_el,
39
* we already have the correct register contents when encountering the
40
* vq0->vq0 transition between EL0->EL1.
41
*/
42
- old_a64 = old_el ? arm_el_is_aa64(env, old_el) : el0_a64;
43
old_len = (old_a64 && !sve_exception_el(env, old_el)
44
? sve_vqm1_for_el(env, old_el) : 0);
45
- new_a64 = new_el ? arm_el_is_aa64(env, new_el) : el0_a64;
46
new_len = (new_a64 && !sve_exception_el(env, new_el)
47
? sve_vqm1_for_el(env, new_el) : 0);
32
48
33
--
49
--
34
2.20.1
50
2.25.1
35
36
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
kvm-no-adjvtime is a KVM specific CPU property and a first of its
3
Note that SME remains effectively disabled for user-only,
4
kind. To accommodate it we also add kvm_arm_add_vcpu_properties()
4
because we do not yet set CPACR_EL1.SMEN. This needs to
5
and a KVM specific CPU properties description to the CPU features
5
wait until the kernel ABI is implemented.
6
document.
7
6
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Message-id: 20200120101023.16030-7-drjones@redhat.com
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220708151540.18136-33-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
11
---
13
include/hw/arm/virt.h | 1 +
12
docs/system/arm/emulation.rst | 4 ++++
14
target/arm/kvm_arm.h | 11 ++++++++++
13
target/arm/cpu64.c | 11 +++++++++++
15
hw/arm/virt.c | 8 ++++++++
14
2 files changed, 15 insertions(+)
16
target/arm/cpu.c | 2 ++
17
target/arm/cpu64.c | 1 +
18
target/arm/kvm.c | 28 +++++++++++++++++++++++++
19
target/arm/monitor.c | 1 +
20
tests/qtest/arm-cpu-features.c | 4 ++++
21
docs/arm-cpu-features.rst | 37 +++++++++++++++++++++++++++++++++-
22
9 files changed, 92 insertions(+), 1 deletion(-)
23
15
24
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
16
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
25
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/arm/virt.h
18
--- a/docs/system/arm/emulation.rst
27
+++ b/include/hw/arm/virt.h
19
+++ b/docs/system/arm/emulation.rst
28
@@ -XXX,XX +XXX,XX @@ typedef struct {
20
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
29
bool smbios_old_sys_ver;
21
- FEAT_SHA512 (Advanced SIMD SHA512 instructions)
30
bool no_highmem_ecam;
22
- FEAT_SM3 (Advanced SIMD SM3 instructions)
31
bool no_ged; /* Machines < 4.2 has no support for ACPI GED device */
23
- FEAT_SM4 (Advanced SIMD SM4 instructions)
32
+ bool kvm_no_adjvtime;
24
+- FEAT_SME (Scalable Matrix Extension)
33
} VirtMachineClass;
25
+- FEAT_SME_FA64 (Full A64 instruction set in Streaming SVE mode)
34
26
+- FEAT_SME_F64F64 (Double-precision floating-point outer product instructions)
35
typedef struct {
27
+- FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instructions)
36
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
28
- FEAT_SPECRES (Speculation restriction instructions)
37
index XXXXXXX..XXXXXXX 100644
29
- FEAT_SSBS (Speculative Store Bypass Safe)
38
--- a/target/arm/kvm_arm.h
30
- FEAT_TLBIOS (TLB invalidate instructions in Outer Shareable domain)
39
+++ b/target/arm/kvm_arm.h
40
@@ -XXX,XX +XXX,XX @@ void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map);
41
*/
42
void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
43
44
+/**
45
+ * kvm_arm_add_vcpu_properties:
46
+ * @obj: The CPU object to add the properties to
47
+ *
48
+ * Add all KVM specific CPU properties to the CPU object. These
49
+ * are the CPU properties with "kvm-" prefixed names.
50
+ */
51
+void kvm_arm_add_vcpu_properties(Object *obj);
52
+
53
/**
54
* kvm_arm_aarch32_supported:
55
* @cs: CPUState
56
@@ -XXX,XX +XXX,XX @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
57
cpu->host_cpu_probe_failed = true;
58
}
59
60
+static inline void kvm_arm_add_vcpu_properties(Object *obj) {}
61
+
62
static inline bool kvm_arm_aarch32_supported(CPUState *cs)
63
{
64
return false;
65
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/hw/arm/virt.c
68
+++ b/hw/arm/virt.c
69
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
70
}
71
}
72
73
+ if (vmc->kvm_no_adjvtime &&
74
+ object_property_find(cpuobj, "kvm-no-adjvtime", NULL)) {
75
+ object_property_set_bool(cpuobj, true, "kvm-no-adjvtime", NULL);
76
+ }
77
+
78
if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) {
79
object_property_set_bool(cpuobj, false, "pmu", NULL);
80
}
81
@@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 0)
82
83
static void virt_machine_4_2_options(MachineClass *mc)
84
{
85
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
86
+
87
virt_machine_5_0_options(mc);
88
compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
89
+ vmc->kvm_no_adjvtime = true;
90
}
91
DEFINE_VIRT_MACHINE(4, 2)
92
93
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
94
index XXXXXXX..XXXXXXX 100644
95
--- a/target/arm/cpu.c
96
+++ b/target/arm/cpu.c
97
@@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj)
98
99
if (kvm_enabled()) {
100
kvm_arm_set_cpu_features_from_host(cpu);
101
+ kvm_arm_add_vcpu_properties(obj);
102
} else {
103
cortex_a15_initfn(obj);
104
105
@@ -XXX,XX +XXX,XX @@ static void arm_host_initfn(Object *obj)
106
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
107
aarch64_add_sve_properties(obj);
108
}
109
+ kvm_arm_add_vcpu_properties(obj);
110
arm_cpu_post_init(obj);
111
}
112
113
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
31
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
114
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
115
--- a/target/arm/cpu64.c
33
--- a/target/arm/cpu64.c
116
+++ b/target/arm/cpu64.c
34
+++ b/target/arm/cpu64.c
117
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
35
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
118
36
*/
119
if (kvm_enabled()) {
37
t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */
120
kvm_arm_set_cpu_features_from_host(cpu);
38
t = FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0); /* FEAT_RASv1p1 + FEAT_DoubleFault */
121
+ kvm_arm_add_vcpu_properties(obj);
39
+ t = FIELD_DP64(t, ID_AA64PFR1, SME, 1); /* FEAT_SME */
122
} else {
40
t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */
123
uint64_t t;
41
cpu->isar.id_aa64pfr1 = t;
124
uint32_t u;
42
125
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
43
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
126
index XXXXXXX..XXXXXXX 100644
44
t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */
127
--- a/target/arm/kvm.c
45
cpu->isar.id_aa64dfr0 = t;
128
+++ b/target/arm/kvm.c
46
129
@@ -XXX,XX +XXX,XX @@
47
+ t = cpu->isar.id_aa64smfr0;
130
#include "qemu/timer.h"
48
+ t = FIELD_DP64(t, ID_AA64SMFR0, F32F32, 1); /* FEAT_SME */
131
#include "qemu/error-report.h"
49
+ t = FIELD_DP64(t, ID_AA64SMFR0, B16F32, 1); /* FEAT_SME */
132
#include "qemu/main-loop.h"
50
+ t = FIELD_DP64(t, ID_AA64SMFR0, F16F32, 1); /* FEAT_SME */
133
+#include "qom/object.h"
51
+ t = FIELD_DP64(t, ID_AA64SMFR0, I8I32, 0xf); /* FEAT_SME */
134
+#include "qapi/error.h"
52
+ t = FIELD_DP64(t, ID_AA64SMFR0, F64F64, 1); /* FEAT_SME_F64F64 */
135
#include "sysemu/sysemu.h"
53
+ t = FIELD_DP64(t, ID_AA64SMFR0, I16I64, 0xf); /* FEAT_SME_I16I64 */
136
#include "sysemu/kvm.h"
54
+ t = FIELD_DP64(t, ID_AA64SMFR0, FA64, 1); /* FEAT_SME_FA64 */
137
#include "sysemu/kvm_int.h"
55
+ cpu->isar.id_aa64smfr0 = t;
138
@@ -XXX,XX +XXX,XX @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
139
env->features = arm_host_cpu_features.features;
140
}
141
142
+static bool kvm_no_adjvtime_get(Object *obj, Error **errp)
143
+{
144
+ return !ARM_CPU(obj)->kvm_adjvtime;
145
+}
146
+
56
+
147
+static void kvm_no_adjvtime_set(Object *obj, bool value, Error **errp)
57
/* Replicate the same data to the 32-bit id registers. */
148
+{
58
aa32_max_features(cpu);
149
+ ARM_CPU(obj)->kvm_adjvtime = !value;
150
+}
151
+
152
+/* KVM VCPU properties should be prefixed with "kvm-". */
153
+void kvm_arm_add_vcpu_properties(Object *obj)
154
+{
155
+ if (!kvm_enabled()) {
156
+ return;
157
+ }
158
+
159
+ ARM_CPU(obj)->kvm_adjvtime = true;
160
+ object_property_add_bool(obj, "kvm-no-adjvtime", kvm_no_adjvtime_get,
161
+ kvm_no_adjvtime_set, &error_abort);
162
+ object_property_set_description(obj, "kvm-no-adjvtime",
163
+ "Set on to disable the adjustment of "
164
+ "the virtual counter. VM stopped time "
165
+ "will be counted.", &error_abort);
166
+}
167
+
168
bool kvm_arm_pmu_supported(CPUState *cpu)
169
{
170
return kvm_check_extension(cpu->kvm_state, KVM_CAP_ARM_PMU_V3);
171
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
172
index XXXXXXX..XXXXXXX 100644
173
--- a/target/arm/monitor.c
174
+++ b/target/arm/monitor.c
175
@@ -XXX,XX +XXX,XX @@ static const char *cpu_model_advertised_features[] = {
176
"sve128", "sve256", "sve384", "sve512",
177
"sve640", "sve768", "sve896", "sve1024", "sve1152", "sve1280",
178
"sve1408", "sve1536", "sve1664", "sve1792", "sve1920", "sve2048",
179
+ "kvm-no-adjvtime",
180
NULL
181
};
182
183
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
184
index XXXXXXX..XXXXXXX 100644
185
--- a/tests/qtest/arm-cpu-features.c
186
+++ b/tests/qtest/arm-cpu-features.c
187
@@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion(const void *data)
188
assert_has_feature_enabled(qts, "cortex-a15", "pmu");
189
assert_has_not_feature(qts, "cortex-a15", "aarch64");
190
191
+ assert_has_not_feature(qts, "max", "kvm-no-adjvtime");
192
+
193
if (g_str_equal(qtest_get_arch(), "aarch64")) {
194
assert_has_feature_enabled(qts, "max", "aarch64");
195
assert_has_feature_enabled(qts, "max", "sve");
196
@@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data)
197
return;
198
}
199
200
+ assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime");
201
+
202
if (g_str_equal(qtest_get_arch(), "aarch64")) {
203
bool kvm_supports_sve;
204
char max_name[8], name[8];
205
diff --git a/docs/arm-cpu-features.rst b/docs/arm-cpu-features.rst
206
index XXXXXXX..XXXXXXX 100644
207
--- a/docs/arm-cpu-features.rst
208
+++ b/docs/arm-cpu-features.rst
209
@@ -XXX,XX +XXX,XX @@ supporting the feature or only supporting the feature under certain
210
configurations. For example, the `aarch64` CPU feature, which, when
211
disabled, enables the optional AArch32 CPU feature, is only supported
212
when using the KVM accelerator and when running on a host CPU type that
213
-supports the feature.
214
+supports the feature. While `aarch64` currently only works with KVM,
215
+it could work with TCG. CPU features that are specific to KVM are
216
+prefixed with "kvm-" and are described in "KVM VCPU Features".
217
218
CPU Feature Probing
219
===================
220
@@ -XXX,XX +XXX,XX @@ disabling many SVE vector lengths would be quite verbose, the `sve<N>` CPU
221
properties have special semantics (see "SVE CPU Property Parsing
222
Semantics").
223
224
+KVM VCPU Features
225
+=================
226
+
227
+KVM VCPU features are CPU features that are specific to KVM, such as
228
+paravirt features or features that enable CPU virtualization extensions.
229
+The features' CPU properties are only available when KVM is enabled and
230
+are named with the prefix "kvm-". KVM VCPU features may be probed,
231
+enabled, and disabled in the same way as other CPU features. Below is
232
+the list of KVM VCPU features and their descriptions.
233
+
234
+ kvm-no-adjvtime By default kvm-no-adjvtime is disabled. This
235
+ means that by default the virtual time
236
+ adjustment is enabled (vtime is *not not*
237
+ adjusted).
238
+
239
+ When virtual time adjustment is enabled each
240
+ time the VM transitions back to running state
241
+ the VCPU's virtual counter is updated to ensure
242
+ stopped time is not counted. This avoids time
243
+ jumps surprising guest OSes and applications,
244
+ as long as they use the virtual counter for
245
+ timekeeping. However it has the side effect of
246
+ the virtual and physical counters diverging.
247
+ All timekeeping based on the virtual counter
248
+ will appear to lag behind any timekeeping that
249
+ does not subtract VM stopped time. The guest
250
+ may resynchronize its virtual counter with
251
+ other time sources as needed.
252
+
253
+ Enable kvm-no-adjvtime to disable virtual time
254
+ adjustment, also restoring the legacy (pre-5.0)
255
+ behavior.
256
+
257
SVE CPU Properties
258
==================
259
59
260
--
60
--
261
2.20.1
61
2.25.1
262
263
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220708151540.18136-34-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
linux-user/aarch64/target_cpu.h | 5 ++++-
9
1 file changed, 4 insertions(+), 1 deletion(-)
10
11
diff --git a/linux-user/aarch64/target_cpu.h b/linux-user/aarch64/target_cpu.h
12
index XXXXXXX..XXXXXXX 100644
13
--- a/linux-user/aarch64/target_cpu.h
14
+++ b/linux-user/aarch64/target_cpu.h
15
@@ -XXX,XX +XXX,XX @@ static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags)
16
17
static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
18
{
19
- /* Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is
20
+ /*
21
+ * Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is
22
* different from AArch32 Linux, which uses TPIDRRO.
23
*/
24
env->cp15.tpidr_el[0] = newtls;
25
+ /* TPIDR2_EL0 is cleared with CLONE_SETTLS. */
26
+ env->cp15.tpidr2_el0 = 0;
27
}
28
29
static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
30
--
31
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220708151540.18136-35-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
linux-user/aarch64/cpu_loop.c | 9 +++++++++
9
1 file changed, 9 insertions(+)
10
11
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/linux-user/aarch64/cpu_loop.c
14
+++ b/linux-user/aarch64/cpu_loop.c
15
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
16
17
switch (trapnr) {
18
case EXCP_SWI:
19
+ /*
20
+ * On syscall, PSTATE.ZA is preserved, along with the ZA matrix.
21
+ * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState.
22
+ */
23
+ if (FIELD_EX64(env->svcr, SVCR, SM)) {
24
+ env->svcr = FIELD_DP64(env->svcr, SVCR, SM, 0);
25
+ arm_rebuild_hflags(env);
26
+ arm_reset_sve_state(env);
27
+ }
28
ret = do_syscall(env,
29
env->xregs[8],
30
env->xregs[0],
31
--
32
2.25.1
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
If we know what the default value should be then we can test for
3
Make sure to zero the currently reserved fields.
4
that as well as the feature existence.
5
4
6
Signed-off-by: Andrew Jones <drjones@redhat.com>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200120101023.16030-5-drjones@redhat.com
7
Message-id: 20220708151540.18136-36-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
tests/qtest/arm-cpu-features.c | 37 +++++++++++++++++++++++++---------
10
linux-user/aarch64/signal.c | 9 ++++++++-
12
1 file changed, 28 insertions(+), 9 deletions(-)
11
1 file changed, 8 insertions(+), 1 deletion(-)
13
12
14
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
13
diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/arm-cpu-features.c
15
--- a/linux-user/aarch64/signal.c
17
+++ b/tests/qtest/arm-cpu-features.c
16
+++ b/linux-user/aarch64/signal.c
18
@@ -XXX,XX +XXX,XX @@ static bool resp_get_feature(QDict *resp, const char *feature)
17
@@ -XXX,XX +XXX,XX @@ struct target_extra_context {
19
qobject_unref(_resp); \
18
struct target_sve_context {
20
})
19
struct target_aarch64_ctx head;
21
20
uint16_t vl;
22
+#define assert_feature(qts, cpu_type, feature, expected_value) \
21
- uint16_t reserved[3];
23
+({ \
22
+ uint16_t flags;
24
+ QDict *_resp, *_props; \
23
+ uint16_t reserved[2];
25
+ \
24
/* The actual SVE data immediately follows. It is laid out
26
+ _resp = do_query_no_props(qts, cpu_type); \
25
* according to TARGET_SVE_SIG_{Z,P}REG_OFFSET, based off of
27
+ g_assert(_resp); \
26
* the original struct pointer.
28
+ g_assert(resp_has_props(_resp)); \
27
@@ -XXX,XX +XXX,XX @@ struct target_sve_context {
29
+ _props = resp_get_props(_resp); \
28
#define TARGET_SVE_SIG_CONTEXT_SIZE(VQ) \
30
+ g_assert(qdict_get(_props, feature)); \
29
(TARGET_SVE_SIG_PREG_OFFSET(VQ, 17))
31
+ g_assert(qdict_get_bool(_props, feature) == (expected_value)); \
30
32
+ qobject_unref(_resp); \
31
+#define TARGET_SVE_SIG_FLAG_SM 1
33
+})
34
+
32
+
35
+#define assert_has_feature_enabled(qts, cpu_type, feature) \
33
struct target_rt_sigframe {
36
+ assert_feature(qts, cpu_type, feature, true)
34
struct target_siginfo info;
37
+
35
struct target_ucontext uc;
38
+#define assert_has_feature_disabled(qts, cpu_type, feature) \
36
@@ -XXX,XX +XXX,XX @@ static void target_setup_sve_record(struct target_sve_context *sve,
39
+ assert_feature(qts, cpu_type, feature, false)
40
+
41
static void assert_type_full(QTestState *qts)
42
{
37
{
43
const char *error;
38
int i, j;
44
@@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion(const void *data)
39
45
assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL);
40
+ memset(sve, 0, sizeof(*sve));
46
41
__put_user(TARGET_SVE_MAGIC, &sve->head.magic);
47
/* Test expected feature presence/absence for some cpu types */
42
__put_user(size, &sve->head.size);
48
- assert_has_feature(qts, "max", "pmu");
43
__put_user(vq * TARGET_SVE_VQ_BYTES, &sve->vl);
49
- assert_has_feature(qts, "cortex-a15", "pmu");
44
+ if (FIELD_EX64(env->svcr, SVCR, SM)) {
50
+ assert_has_feature_enabled(qts, "max", "pmu");
45
+ __put_user(TARGET_SVE_SIG_FLAG_SM, &sve->flags);
51
+ assert_has_feature_enabled(qts, "cortex-a15", "pmu");
46
+ }
52
assert_has_not_feature(qts, "cortex-a15", "aarch64");
47
53
48
/* Note that SVE regs are stored as a byte stream, with each byte element
54
if (g_str_equal(qtest_get_arch(), "aarch64")) {
49
* at a subsequent address. This corresponds to a little-endian store
55
- assert_has_feature(qts, "max", "aarch64");
56
- assert_has_feature(qts, "max", "sve");
57
- assert_has_feature(qts, "max", "sve128");
58
- assert_has_feature(qts, "cortex-a57", "pmu");
59
- assert_has_feature(qts, "cortex-a57", "aarch64");
60
+ assert_has_feature_enabled(qts, "max", "aarch64");
61
+ assert_has_feature_enabled(qts, "max", "sve");
62
+ assert_has_feature_enabled(qts, "max", "sve128");
63
+ assert_has_feature_enabled(qts, "cortex-a57", "pmu");
64
+ assert_has_feature_enabled(qts, "cortex-a57", "aarch64");
65
66
sve_tests_default(qts, "max");
67
68
@@ -XXX,XX +XXX,XX @@ static void test_query_cpu_model_expansion_kvm(const void *data)
69
QDict *resp;
70
char *error;
71
72
- assert_has_feature(qts, "host", "aarch64");
73
- assert_has_feature(qts, "host", "pmu");
74
+ assert_has_feature_enabled(qts, "host", "aarch64");
75
+ assert_has_feature_enabled(qts, "host", "pmu");
76
77
assert_error(qts, "cortex-a15",
78
"We cannot guarantee the CPU type 'cortex-a15' works "
79
--
50
--
80
2.20.1
51
2.25.1
81
82
diff view generated by jsdifflib
1
The guest can use the semihosting API to open a handle
1
From: Richard Henderson <richard.henderson@linaro.org>
2
corresponding to QEMU's own stdin, stdout, or stderr.
3
When the guest closes this handle, we should not
4
close the underlying host stdin/stdout/stderr
5
the way we would do if the handle corresponded to
6
a host fd we'd opened on behalf of the guest in SYS_OPEN.
7
2
3
Fold the return value setting into the goto, so each
4
point of failure need not do both.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-37-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20200124172954.28481-1-peter.maydell@linaro.org
12
---
10
---
13
target/arm/arm-semi.c | 9 +++++++++
11
linux-user/aarch64/signal.c | 26 +++++++++++---------------
14
1 file changed, 9 insertions(+)
12
1 file changed, 11 insertions(+), 15 deletions(-)
15
13
16
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
14
diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/arm-semi.c
16
--- a/linux-user/aarch64/signal.c
19
+++ b/target/arm/arm-semi.c
17
+++ b/linux-user/aarch64/signal.c
20
@@ -XXX,XX +XXX,XX @@ static uint32_t host_closefn(ARMCPU *cpu, GuestFD *gf)
18
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
21
{
19
struct target_sve_context *sve = NULL;
22
CPUARMState *env = &cpu->env;
20
uint64_t extra_datap = 0;
23
21
bool used_extra = false;
24
+ /*
22
- bool err = false;
25
+ * Only close the underlying host fd if it's one we opened on behalf
23
int vq = 0, sve_size = 0;
26
+ * of the guest in SYS_OPEN.
24
27
+ */
25
target_restore_general_frame(env, sf);
28
+ if (gf->hostfd == STDIN_FILENO ||
26
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
29
+ gf->hostfd == STDOUT_FILENO ||
27
switch (magic) {
30
+ gf->hostfd == STDERR_FILENO) {
28
case 0:
31
+ return 0;
29
if (size != 0) {
32
+ }
30
- err = true;
33
return set_swi_errno(env, close(gf->hostfd));
31
- goto exit;
32
+ goto err;
33
}
34
if (used_extra) {
35
ctx = NULL;
36
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
37
38
case TARGET_FPSIMD_MAGIC:
39
if (fpsimd || size != sizeof(struct target_fpsimd_context)) {
40
- err = true;
41
- goto exit;
42
+ goto err;
43
}
44
fpsimd = (struct target_fpsimd_context *)ctx;
45
break;
46
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
47
break;
48
}
49
}
50
- err = true;
51
- goto exit;
52
+ goto err;
53
54
case TARGET_EXTRA_MAGIC:
55
if (extra || size != sizeof(struct target_extra_context)) {
56
- err = true;
57
- goto exit;
58
+ goto err;
59
}
60
__get_user(extra_datap,
61
&((struct target_extra_context *)ctx)->datap);
62
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
63
/* Unknown record -- we certainly didn't generate it.
64
* Did we in fact get out of sync?
65
*/
66
- err = true;
67
- goto exit;
68
+ goto err;
69
}
70
ctx = (void *)ctx + size;
71
}
72
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
73
if (fpsimd) {
74
target_restore_fpsimd_record(env, fpsimd);
75
} else {
76
- err = true;
77
+ goto err;
78
}
79
80
/* SVE data, if present, overwrites FPSIMD data. */
81
if (sve) {
82
target_restore_sve_record(env, sve, vq);
83
}
84
-
85
- exit:
86
unlock_user(extra, extra_datap, 0);
87
- return err;
88
+ return 0;
89
+
90
+ err:
91
+ unlock_user(extra, extra_datap, 0);
92
+ return 1;
34
}
93
}
35
94
95
static abi_ulong get_sigframe(struct target_sigaction *ka,
36
--
96
--
37
2.20.1
97
2.25.1
38
39
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Signed-off-by: Andrew Jones <drjones@redhat.com>
3
In parse_user_sigframe, the kernel rejects duplicate sve records,
4
Message-id: 20200120101023.16030-3-drjones@redhat.com
4
or records that are smaller than the header. We were silently
5
allowing these cases to pass, dropping the record.
6
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220708151540.18136-38-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
11
---
8
hw/arm/virt.c | 1 +
12
linux-user/aarch64/signal.c | 5 ++++-
9
1 file changed, 1 insertion(+)
13
1 file changed, 4 insertions(+), 1 deletion(-)
10
14
11
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
15
diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
12
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
13
--- a/hw/arm/virt.c
17
--- a/linux-user/aarch64/signal.c
14
+++ b/hw/arm/virt.c
18
+++ b/linux-user/aarch64/signal.c
15
@@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(5, 0)
19
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
16
20
break;
17
static void virt_machine_4_2_options(MachineClass *mc)
21
18
{
22
case TARGET_SVE_MAGIC:
19
+ virt_machine_5_0_options(mc);
23
+ if (sve || size < sizeof(struct target_sve_context)) {
20
compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len);
24
+ goto err;
21
}
25
+ }
22
DEFINE_VIRT_MACHINE(4, 2)
26
if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
27
vq = sve_vq(env);
28
sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16);
29
- if (!sve && size == sve_size) {
30
+ if (size == sve_size) {
31
sve = (struct target_sve_context *)ctx;
32
break;
33
}
23
--
34
--
24
2.20.1
35
2.25.1
25
26
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Signed-off-by: Andrew Jones <drjones@redhat.com>
4
Message-id: 20200120101023.16030-2-drjones@redhat.com
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220708151540.18136-39-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
7
---
8
target/arm/kvm_arm.h | 46 ++++++++++++++++++++++++++------------------
8
linux-user/aarch64/signal.c | 3 +++
9
1 file changed, 27 insertions(+), 19 deletions(-)
9
1 file changed, 3 insertions(+)
10
10
11
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
11
diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
12
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/kvm_arm.h
13
--- a/linux-user/aarch64/signal.c
14
+++ b/target/arm/kvm_arm.h
14
+++ b/linux-user/aarch64/signal.c
15
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
16
int kvm_arm_vcpu_init(CPUState *cs);
16
__get_user(extra_size,
17
17
&((struct target_extra_context *)ctx)->size);
18
/**
18
extra = lock_user(VERIFY_READ, extra_datap, extra_size, 0);
19
- * kvm_arm_vcpu_finalize
19
+ if (!extra) {
20
+ * kvm_arm_vcpu_finalize:
20
+ return 1;
21
* @cs: CPUState
21
+ }
22
- * @feature: int
22
break;
23
+ * @feature: feature to finalize
23
24
*
24
default:
25
* Finalizes the configuration of the specified VCPU feature by
26
* invoking the KVM_ARM_VCPU_FINALIZE ioctl. Features requiring
27
@@ -XXX,XX +XXX,XX @@ void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid, uint64_t group,
28
int kvm_arm_init_cpreg_list(ARMCPU *cpu);
29
30
/**
31
- * kvm_arm_reg_syncs_via_cpreg_list
32
- * regidx: KVM register index
33
+ * kvm_arm_reg_syncs_via_cpreg_list:
34
+ * @regidx: KVM register index
35
*
36
* Return true if this KVM register should be synchronized via the
37
* cpreg list of arbitrary system registers, false if it is synchronized
38
@@ -XXX,XX +XXX,XX @@ int kvm_arm_init_cpreg_list(ARMCPU *cpu);
39
bool kvm_arm_reg_syncs_via_cpreg_list(uint64_t regidx);
40
41
/**
42
- * kvm_arm_cpreg_level
43
- * regidx: KVM register index
44
+ * kvm_arm_cpreg_level:
45
+ * @regidx: KVM register index
46
*
47
* Return the level of this coprocessor/system register. Return value is
48
* either KVM_PUT_RUNTIME_STATE, KVM_PUT_RESET_STATE, or KVM_PUT_FULL_STATE.
49
@@ -XXX,XX +XXX,XX @@ void kvm_arm_init_serror_injection(CPUState *cs);
50
* @cpu: ARMCPU
51
*
52
* Get VCPU related state from kvm.
53
+ *
54
+ * Returns: 0 if success else < 0 error code
55
*/
56
int kvm_get_vcpu_events(ARMCPU *cpu);
57
58
@@ -XXX,XX +XXX,XX @@ int kvm_get_vcpu_events(ARMCPU *cpu);
59
* @cpu: ARMCPU
60
*
61
* Put VCPU related state to kvm.
62
+ *
63
+ * Returns: 0 if success else < 0 error code
64
*/
65
int kvm_put_vcpu_events(ARMCPU *cpu);
66
67
@@ -XXX,XX +XXX,XX @@ typedef struct ARMHostCPUFeatures {
68
69
/**
70
* kvm_arm_get_host_cpu_features:
71
- * @ahcc: ARMHostCPUClass to fill in
72
+ * @ahcf: ARMHostCPUClass to fill in
73
*
74
* Probe the capabilities of the host kernel's preferred CPU and fill
75
* in the ARMHostCPUClass struct accordingly.
76
+ *
77
+ * Returns true on success and false otherwise.
78
*/
79
bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf);
80
81
@@ -XXX,XX +XXX,XX @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
82
bool kvm_arm_aarch32_supported(CPUState *cs);
83
84
/**
85
- * bool kvm_arm_pmu_supported:
86
+ * kvm_arm_pmu_supported:
87
* @cs: CPUState
88
*
89
* Returns: true if the KVM VCPU can enable its PMU
90
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_aarch32_supported(CPUState *cs);
91
bool kvm_arm_pmu_supported(CPUState *cs);
92
93
/**
94
- * bool kvm_arm_sve_supported:
95
+ * kvm_arm_sve_supported:
96
* @cs: CPUState
97
*
98
* Returns true if the KVM VCPU can enable SVE and false otherwise.
99
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_pmu_supported(CPUState *cs);
100
bool kvm_arm_sve_supported(CPUState *cs);
101
102
/**
103
- * kvm_arm_get_max_vm_ipa_size - Returns the number of bits in the
104
- * IPA address space supported by KVM
105
- *
106
+ * kvm_arm_get_max_vm_ipa_size:
107
* @ms: Machine state handle
108
+ *
109
+ * Returns the number of bits in the IPA address space supported by KVM
110
*/
111
int kvm_arm_get_max_vm_ipa_size(MachineState *ms);
112
113
/**
114
- * kvm_arm_sync_mpstate_to_kvm
115
+ * kvm_arm_sync_mpstate_to_kvm:
116
* @cpu: ARMCPU
117
*
118
* If supported set the KVM MP_STATE based on QEMU's model.
119
+ *
120
+ * Returns 0 on success and -1 on failure.
121
*/
122
int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu);
123
124
/**
125
- * kvm_arm_sync_mpstate_to_qemu
126
+ * kvm_arm_sync_mpstate_to_qemu:
127
* @cpu: ARMCPU
128
*
129
* If supported get the MP_STATE from KVM and store in QEMU's model.
130
+ *
131
+ * Returns 0 on success and aborts on failure.
132
*/
133
int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu);
134
135
@@ -XXX,XX +XXX,XX @@ int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level);
136
137
static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
138
{
139
- /* This should never actually be called in the "not KVM" case,
140
+ /*
141
+ * This should never actually be called in the "not KVM" case,
142
* but set up the fields to indicate an error anyway.
143
*/
144
cpu->kvm_target = QEMU_KVM_ARM_TARGET_NONE;
145
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_debug_exit_arch *debug_exit);
146
*
147
* Return: TRUE if any hardware breakpoints in use.
148
*/
149
-
150
bool kvm_arm_hw_debug_active(CPUState *cs);
151
152
/**
153
* kvm_arm_copy_hw_debug_data:
154
- *
155
* @ptr: kvm_guest_debug_arch structure
156
*
157
* Copy the architecture specific debug registers into the
158
* kvm_guest_debug ioctl structure.
159
*/
160
struct kvm_guest_debug_arch;
161
-
162
void kvm_arm_copy_hw_debug_data(struct kvm_guest_debug_arch *ptr);
163
164
/**
165
- * its_class_name
166
+ * its_class_name:
167
*
168
* Return the ITS class name to use depending on whether KVM acceleration
169
* and KVM CAP_SIGNAL_MSI are supported
170
--
25
--
171
2.20.1
26
2.25.1
172
173
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
When a VM is stopped (such as when it's paused) guest virtual time
3
Move the checks out of the parsing loop and into the
4
should stop counting. Otherwise, when the VM is resumed it will
4
restore function. This more closely mirrors the code
5
experience time jumps and its kernel may report soft lockups. Not
5
structure in the kernel, and is slightly clearer.
6
counting virtual time while the VM is stopped has the side effect
7
of making the guest's time appear to lag when compared with real
8
time, and even with time derived from the physical counter. For
9
this reason, this change, which is enabled by default, comes with
10
a KVM CPU feature allowing it to be disabled, restoring legacy
11
behavior.
12
6
13
This patch only provides the implementation of the virtual time
7
Reject rather than silently skip incorrect VL and SVE record sizes,
14
adjustment. A subsequent patch will provide the CPU property
8
bringing our checks in to line with those the kernel does.
15
allowing the change to be enabled and disabled.
16
9
17
Reported-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
18
Signed-off-by: Andrew Jones <drjones@redhat.com>
19
Message-id: 20200120101023.16030-6-drjones@redhat.com
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20220708151540.18136-40-richard.henderson@linaro.org
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
14
---
23
target/arm/cpu.h | 7 ++++
15
linux-user/aarch64/signal.c | 51 +++++++++++++++++++++++++------------
24
target/arm/kvm_arm.h | 38 ++++++++++++++++++
16
1 file changed, 35 insertions(+), 16 deletions(-)
25
target/arm/kvm.c | 92 ++++++++++++++++++++++++++++++++++++++++++++
26
target/arm/kvm32.c | 3 ++
27
target/arm/kvm64.c | 3 ++
28
target/arm/machine.c | 7 ++++
29
6 files changed, 150 insertions(+)
30
17
31
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
32
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/cpu.h
20
--- a/linux-user/aarch64/signal.c
34
+++ b/target/arm/cpu.h
21
+++ b/linux-user/aarch64/signal.c
35
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
22
@@ -XXX,XX +XXX,XX @@ static void target_restore_fpsimd_record(CPUARMState *env,
36
/* KVM init features for this CPU */
23
}
37
uint32_t kvm_init_features[7];
38
39
+ /* KVM CPU state */
40
+
41
+ /* KVM virtual time adjustment */
42
+ bool kvm_adjvtime;
43
+ bool kvm_vtime_dirty;
44
+ uint64_t kvm_vtime;
45
+
46
/* Uniprocessor system with MP extensions */
47
bool mp_is_up;
48
49
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/kvm_arm.h
52
+++ b/target/arm/kvm_arm.h
53
@@ -XXX,XX +XXX,XX @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level);
54
*/
55
bool write_kvmstate_to_list(ARMCPU *cpu);
56
57
+/**
58
+ * kvm_arm_cpu_pre_save:
59
+ * @cpu: ARMCPU
60
+ *
61
+ * Called after write_kvmstate_to_list() from cpu_pre_save() to update
62
+ * the cpreg list with KVM CPU state.
63
+ */
64
+void kvm_arm_cpu_pre_save(ARMCPU *cpu);
65
+
66
+/**
67
+ * kvm_arm_cpu_post_load:
68
+ * @cpu: ARMCPU
69
+ *
70
+ * Called from cpu_post_load() to update KVM CPU state from the cpreg list.
71
+ */
72
+void kvm_arm_cpu_post_load(ARMCPU *cpu);
73
+
74
/**
75
* kvm_arm_reset_vcpu:
76
* @cpu: ARMCPU
77
@@ -XXX,XX +XXX,XX @@ int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu);
78
*/
79
int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu);
80
81
+/**
82
+ * kvm_arm_get_virtual_time:
83
+ * @cs: CPUState
84
+ *
85
+ * Gets the VCPU's virtual counter and stores it in the KVM CPU state.
86
+ */
87
+void kvm_arm_get_virtual_time(CPUState *cs);
88
+
89
+/**
90
+ * kvm_arm_put_virtual_time:
91
+ * @cs: CPUState
92
+ *
93
+ * Sets the VCPU's virtual counter to the value stored in the KVM CPU state.
94
+ */
95
+void kvm_arm_put_virtual_time(CPUState *cs);
96
+
97
+void kvm_arm_vm_state_change(void *opaque, int running, RunState state);
98
+
99
int kvm_arm_vgic_probe(void);
100
101
void kvm_arm_pmu_set_irq(CPUState *cs, int irq);
102
@@ -XXX,XX +XXX,XX @@ static inline void kvm_arm_pmu_set_irq(CPUState *cs, int irq) {}
103
static inline void kvm_arm_pmu_init(CPUState *cs) {}
104
105
static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) {}
106
+
107
+static inline void kvm_arm_get_virtual_time(CPUState *cs) {}
108
+static inline void kvm_arm_put_virtual_time(CPUState *cs) {}
109
#endif
110
111
static inline const char *gic_class_name(void)
112
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/target/arm/kvm.c
115
+++ b/target/arm/kvm.c
116
@@ -XXX,XX +XXX,XX @@ static int compare_u64(const void *a, const void *b)
117
return 0;
118
}
24
}
119
25
120
+/*
26
-static void target_restore_sve_record(CPUARMState *env,
121
+ * cpreg_values are sorted in ascending order by KVM register ID
27
- struct target_sve_context *sve, int vq)
122
+ * (see kvm_arm_init_cpreg_list). This allows us to cheaply find
28
+static bool target_restore_sve_record(CPUARMState *env,
123
+ * the storage for a KVM register by ID with a binary search.
29
+ struct target_sve_context *sve,
124
+ */
30
+ int size)
125
+static uint64_t *kvm_arm_get_cpreg_ptr(ARMCPU *cpu, uint64_t regidx)
126
+{
127
+ uint64_t *res;
128
+
129
+ res = bsearch(&regidx, cpu->cpreg_indexes, cpu->cpreg_array_len,
130
+ sizeof(uint64_t), compare_u64);
131
+ assert(res);
132
+
133
+ return &cpu->cpreg_values[res - cpu->cpreg_indexes];
134
+}
135
+
136
/* Initialize the ARMCPU cpreg list according to the kernel's
137
* definition of what CPU registers it knows about (and throw away
138
* the previous TCG-created cpreg list).
139
@@ -XXX,XX +XXX,XX @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
140
return ok;
141
}
142
143
+void kvm_arm_cpu_pre_save(ARMCPU *cpu)
144
+{
145
+ /* KVM virtual time adjustment */
146
+ if (cpu->kvm_vtime_dirty) {
147
+ *kvm_arm_get_cpreg_ptr(cpu, KVM_REG_ARM_TIMER_CNT) = cpu->kvm_vtime;
148
+ }
149
+}
150
+
151
+void kvm_arm_cpu_post_load(ARMCPU *cpu)
152
+{
153
+ /* KVM virtual time adjustment */
154
+ if (cpu->kvm_adjvtime) {
155
+ cpu->kvm_vtime = *kvm_arm_get_cpreg_ptr(cpu, KVM_REG_ARM_TIMER_CNT);
156
+ cpu->kvm_vtime_dirty = true;
157
+ }
158
+}
159
+
160
void kvm_arm_reset_vcpu(ARMCPU *cpu)
161
{
31
{
162
int ret;
32
- int i, j;
163
@@ -XXX,XX +XXX,XX @@ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu)
33
+ int i, j, vl, vq;
164
return 0;
34
165
}
35
- /* Note that SVE regs are stored as a byte stream, with each byte element
166
36
+ if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) {
167
+void kvm_arm_get_virtual_time(CPUState *cs)
37
+ return false;
168
+{
169
+ ARMCPU *cpu = ARM_CPU(cs);
170
+ struct kvm_one_reg reg = {
171
+ .id = KVM_REG_ARM_TIMER_CNT,
172
+ .addr = (uintptr_t)&cpu->kvm_vtime,
173
+ };
174
+ int ret;
175
+
176
+ if (cpu->kvm_vtime_dirty) {
177
+ return;
178
+ }
38
+ }
179
+
39
+
180
+ ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &reg);
40
+ __get_user(vl, &sve->vl);
181
+ if (ret) {
41
+ vq = sve_vq(env);
182
+ error_report("Failed to get KVM_REG_ARM_TIMER_CNT");
42
+
183
+ abort();
43
+ /* Reject mismatched VL. */
44
+ if (vl != vq * TARGET_SVE_VQ_BYTES) {
45
+ return false;
184
+ }
46
+ }
185
+
47
+
186
+ cpu->kvm_vtime_dirty = true;
48
+ /* Accept empty record -- used to clear PSTATE.SM. */
187
+}
49
+ if (size <= sizeof(*sve)) {
188
+
50
+ return true;
189
+void kvm_arm_put_virtual_time(CPUState *cs)
190
+{
191
+ ARMCPU *cpu = ARM_CPU(cs);
192
+ struct kvm_one_reg reg = {
193
+ .id = KVM_REG_ARM_TIMER_CNT,
194
+ .addr = (uintptr_t)&cpu->kvm_vtime,
195
+ };
196
+ int ret;
197
+
198
+ if (!cpu->kvm_vtime_dirty) {
199
+ return;
200
+ }
51
+ }
201
+
52
+
202
+ ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
53
+ /* Reject non-empty but incomplete record. */
203
+ if (ret) {
54
+ if (size < TARGET_SVE_SIG_CONTEXT_SIZE(vq)) {
204
+ error_report("Failed to set KVM_REG_ARM_TIMER_CNT");
55
+ return false;
205
+ abort();
206
+ }
56
+ }
207
+
57
+
208
+ cpu->kvm_vtime_dirty = false;
58
+ /*
209
+}
59
+ * Note that SVE regs are stored as a byte stream, with each byte element
210
+
60
* at a subsequent address. This corresponds to a little-endian load
211
int kvm_put_vcpu_events(ARMCPU *cpu)
61
* of our 64-bit hunks.
212
{
62
*/
213
CPUARMState *env = &cpu->env;
63
@@ -XXX,XX +XXX,XX @@ static void target_restore_sve_record(CPUARMState *env,
214
@@ -XXX,XX +XXX,XX @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
64
}
215
return MEMTXATTRS_UNSPECIFIED;
65
}
66
}
67
+ return true;
216
}
68
}
217
69
218
+void kvm_arm_vm_state_change(void *opaque, int running, RunState state)
70
static int target_restore_sigframe(CPUARMState *env,
219
+{
71
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
220
+ CPUState *cs = opaque;
72
struct target_sve_context *sve = NULL;
221
+ ARMCPU *cpu = ARM_CPU(cs);
73
uint64_t extra_datap = 0;
222
+
74
bool used_extra = false;
223
+ if (running) {
75
- int vq = 0, sve_size = 0;
224
+ if (cpu->kvm_adjvtime) {
76
+ int sve_size = 0;
225
+ kvm_arm_put_virtual_time(cs);
77
226
+ }
78
target_restore_general_frame(env, sf);
227
+ } else {
79
228
+ if (cpu->kvm_adjvtime) {
80
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
229
+ kvm_arm_get_virtual_time(cs);
81
if (sve || size < sizeof(struct target_sve_context)) {
230
+ }
82
goto err;
231
+ }
83
}
232
+}
84
- if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
233
85
- vq = sve_vq(env);
234
int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
86
- sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16);
235
{
87
- if (size == sve_size) {
236
diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c
88
- sve = (struct target_sve_context *)ctx;
237
index XXXXXXX..XXXXXXX 100644
89
- break;
238
--- a/target/arm/kvm32.c
90
- }
239
+++ b/target/arm/kvm32.c
91
- }
240
@@ -XXX,XX +XXX,XX @@
92
- goto err;
241
#include "qemu-common.h"
93
+ sve = (struct target_sve_context *)ctx;
242
#include "cpu.h"
94
+ sve_size = size;
243
#include "qemu/timer.h"
95
+ break;
244
+#include "sysemu/runstate.h"
96
245
#include "sysemu/kvm.h"
97
case TARGET_EXTRA_MAGIC:
246
#include "kvm_arm.h"
98
if (extra || size != sizeof(struct target_extra_context)) {
247
#include "internals.h"
99
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
248
@@ -XXX,XX +XXX,XX @@ int kvm_arch_init_vcpu(CPUState *cs)
249
return -EINVAL;
250
}
100
}
251
101
252
+ qemu_add_vm_change_state_handler(kvm_arm_vm_state_change, cs);
102
/* SVE data, if present, overwrites FPSIMD data. */
253
+
103
- if (sve) {
254
/* Determine init features for this CPU */
104
- target_restore_sve_record(env, sve, vq);
255
memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features));
105
+ if (sve && !target_restore_sve_record(env, sve, sve_size)) {
256
if (cpu->start_powered_off) {
106
+ goto err;
257
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
258
index XXXXXXX..XXXXXXX 100644
259
--- a/target/arm/kvm64.c
260
+++ b/target/arm/kvm64.c
261
@@ -XXX,XX +XXX,XX @@
262
#include "qemu/host-utils.h"
263
#include "qemu/main-loop.h"
264
#include "exec/gdbstub.h"
265
+#include "sysemu/runstate.h"
266
#include "sysemu/kvm.h"
267
#include "sysemu/kvm_int.h"
268
#include "kvm_arm.h"
269
@@ -XXX,XX +XXX,XX @@ int kvm_arch_init_vcpu(CPUState *cs)
270
return -EINVAL;
271
}
107
}
272
108
unlock_user(extra, extra_datap, 0);
273
+ qemu_add_vm_change_state_handler(kvm_arm_vm_state_change, cs);
109
return 0;
274
+
275
/* Determine init features for this CPU */
276
memset(cpu->kvm_init_features, 0, sizeof(cpu->kvm_init_features));
277
if (cpu->start_powered_off) {
278
diff --git a/target/arm/machine.c b/target/arm/machine.c
279
index XXXXXXX..XXXXXXX 100644
280
--- a/target/arm/machine.c
281
+++ b/target/arm/machine.c
282
@@ -XXX,XX +XXX,XX @@ static int cpu_pre_save(void *opaque)
283
/* This should never fail */
284
abort();
285
}
286
+
287
+ /*
288
+ * kvm_arm_cpu_pre_save() must be called after
289
+ * write_kvmstate_to_list()
290
+ */
291
+ kvm_arm_cpu_pre_save(cpu);
292
} else {
293
if (!write_cpustate_to_list(cpu, false)) {
294
/* This should never fail. */
295
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
296
* we're using it.
297
*/
298
write_list_to_cpustate(cpu);
299
+ kvm_arm_cpu_post_load(cpu);
300
} else {
301
if (!write_list_to_cpustate(cpu)) {
302
return -1;
303
--
110
--
304
2.20.1
111
2.25.1
305
306
diff view generated by jsdifflib
1
From: Andrew Jeffery <andrew@aj.id.au>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
The AST2600 includes a second cut-down version of the SD/MMC controller
3
Set the SM bit in the SVE record on signal delivery, create the ZA record.
4
found in the AST2500, named the eMMC controller. It's cut down in the
4
Restore SM and ZA state according to the records present on return.
5
sense that it only supports one slot rather than two, but it brings the
6
total number of slots supported by the AST2600 to three.
7
5
8
The existing code assumed that the SD controller always provided two
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
slots. Rework the SDHCI object to expose the number of slots as a
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
property to be set by the SoC configuration.
8
Message-id: 20220708151540.18136-41-richard.henderson@linaro.org
11
12
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Signed-off-by: Cédric Le Goater <clg@kaod.org>
16
Message-id: 20200114103433.30534-2-clg@kaod.org
17
[PMM: fixed up to use device_class_set_props()]
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
10
---
20
include/hw/sd/aspeed_sdhci.h | 1 +
11
linux-user/aarch64/signal.c | 167 +++++++++++++++++++++++++++++++++---
21
hw/arm/aspeed.c | 2 +-
12
1 file changed, 154 insertions(+), 13 deletions(-)
22
hw/arm/aspeed_ast2600.c | 2 ++
23
hw/arm/aspeed_soc.c | 2 ++
24
hw/sd/aspeed_sdhci.c | 11 +++++++++--
25
5 files changed, 15 insertions(+), 3 deletions(-)
26
13
27
diff --git a/include/hw/sd/aspeed_sdhci.h b/include/hw/sd/aspeed_sdhci.h
14
diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
28
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
29
--- a/include/hw/sd/aspeed_sdhci.h
16
--- a/linux-user/aarch64/signal.c
30
+++ b/include/hw/sd/aspeed_sdhci.h
17
+++ b/linux-user/aarch64/signal.c
31
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSDHCIState {
18
@@ -XXX,XX +XXX,XX @@ struct target_sve_context {
32
SysBusDevice parent;
19
33
20
#define TARGET_SVE_SIG_FLAG_SM 1
34
SDHCIState slots[ASPEED_SDHCI_NUM_SLOTS];
21
35
+ uint8_t num_slots;
22
+#define TARGET_ZA_MAGIC 0x54366345
36
23
+
37
MemoryRegion iomem;
24
+struct target_za_context {
38
qemu_irq irq;
25
+ struct target_aarch64_ctx head;
39
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
26
+ uint16_t vl;
40
index XXXXXXX..XXXXXXX 100644
27
+ uint16_t reserved[3];
41
--- a/hw/arm/aspeed.c
28
+ /* The actual ZA data immediately follows. */
42
+++ b/hw/arm/aspeed.c
43
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
44
amc->i2c_init(bmc);
45
}
46
47
- for (i = 0; i < ARRAY_SIZE(bmc->soc.sdhci.slots); i++) {
48
+ for (i = 0; i < bmc->soc.sdhci.num_slots; i++) {
49
SDHCIState *sdhci = &bmc->soc.sdhci.slots[i];
50
DriveInfo *dinfo = drive_get_next(IF_SD);
51
BlockBackend *blk;
52
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/aspeed_ast2600.c
55
+++ b/hw/arm/aspeed_ast2600.c
56
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj)
57
sysbus_init_child_obj(obj, "sdc", OBJECT(&s->sdhci), sizeof(s->sdhci),
58
TYPE_ASPEED_SDHCI);
59
60
+ object_property_set_int(OBJECT(&s->sdhci), 2, "num-slots", &error_abort);
61
+
62
/* Init sd card slot class here so that they're under the correct parent */
63
for (i = 0; i < ASPEED_SDHCI_NUM_SLOTS; ++i) {
64
sysbus_init_child_obj(obj, "sdhci[*]", OBJECT(&s->sdhci.slots[i]),
65
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/hw/arm/aspeed_soc.c
68
+++ b/hw/arm/aspeed_soc.c
69
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj)
70
sysbus_init_child_obj(obj, "sdc", OBJECT(&s->sdhci), sizeof(s->sdhci),
71
TYPE_ASPEED_SDHCI);
72
73
+ object_property_set_int(OBJECT(&s->sdhci), 2, "num-slots", &error_abort);
74
+
75
/* Init sd card slot class here so that they're under the correct parent */
76
for (i = 0; i < ASPEED_SDHCI_NUM_SLOTS; ++i) {
77
sysbus_init_child_obj(obj, "sdhci[*]", OBJECT(&s->sdhci.slots[i]),
78
diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
79
index XXXXXXX..XXXXXXX 100644
80
--- a/hw/sd/aspeed_sdhci.c
81
+++ b/hw/sd/aspeed_sdhci.c
82
@@ -XXX,XX +XXX,XX @@
83
#include "qapi/error.h"
84
#include "hw/irq.h"
85
#include "migration/vmstate.h"
86
+#include "hw/qdev-properties.h"
87
88
#define ASPEED_SDHCI_INFO 0x00
89
#define ASPEED_SDHCI_INFO_RESET 0x00030000
90
@@ -XXX,XX +XXX,XX @@ static void aspeed_sdhci_realize(DeviceState *dev, Error **errp)
91
92
/* Create input irqs for the slots */
93
qdev_init_gpio_in_named_with_opaque(DEVICE(sbd), aspeed_sdhci_set_irq,
94
- sdhci, NULL, ASPEED_SDHCI_NUM_SLOTS);
95
+ sdhci, NULL, sdhci->num_slots);
96
97
sysbus_init_irq(sbd, &sdhci->irq);
98
memory_region_init_io(&sdhci->iomem, OBJECT(sdhci), &aspeed_sdhci_ops,
99
sdhci, TYPE_ASPEED_SDHCI, 0x1000);
100
sysbus_init_mmio(sbd, &sdhci->iomem);
101
102
- for (int i = 0; i < ASPEED_SDHCI_NUM_SLOTS; ++i) {
103
+ for (int i = 0; i < sdhci->num_slots; ++i) {
104
Object *sdhci_slot = OBJECT(&sdhci->slots[i]);
105
SysBusDevice *sbd_slot = SYS_BUS_DEVICE(&sdhci->slots[i]);
106
107
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_aspeed_sdhci = {
108
},
109
};
110
111
+static Property aspeed_sdhci_properties[] = {
112
+ DEFINE_PROP_UINT8("num-slots", AspeedSDHCIState, num_slots, 0),
113
+ DEFINE_PROP_END_OF_LIST(),
114
+};
29
+};
115
+
30
+
116
static void aspeed_sdhci_class_init(ObjectClass *classp, void *data)
31
+#define TARGET_ZA_SIG_REGS_OFFSET \
117
{
32
+ QEMU_ALIGN_UP(sizeof(struct target_za_context), TARGET_SVE_VQ_BYTES)
118
DeviceClass *dc = DEVICE_CLASS(classp);
33
+#define TARGET_ZA_SIG_ZAV_OFFSET(VQ, N) \
119
@@ -XXX,XX +XXX,XX @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data)
34
+ (TARGET_ZA_SIG_REGS_OFFSET + (VQ) * TARGET_SVE_VQ_BYTES * (N))
120
dc->realize = aspeed_sdhci_realize;
35
+#define TARGET_ZA_SIG_CONTEXT_SIZE(VQ) \
121
dc->reset = aspeed_sdhci_reset;
36
+ TARGET_ZA_SIG_ZAV_OFFSET(VQ, VQ * TARGET_SVE_VQ_BYTES)
122
dc->vmsd = &vmstate_aspeed_sdhci;
37
+
123
+ device_class_set_props(dc, aspeed_sdhci_properties);
38
struct target_rt_sigframe {
39
struct target_siginfo info;
40
struct target_ucontext uc;
41
@@ -XXX,XX +XXX,XX @@ static void target_setup_end_record(struct target_aarch64_ctx *end)
124
}
42
}
125
43
126
static TypeInfo aspeed_sdhci_info = {
44
static void target_setup_sve_record(struct target_sve_context *sve,
45
- CPUARMState *env, int vq, int size)
46
+ CPUARMState *env, int size)
47
{
48
- int i, j;
49
+ int i, j, vq = sve_vq(env);
50
51
memset(sve, 0, sizeof(*sve));
52
__put_user(TARGET_SVE_MAGIC, &sve->head.magic);
53
@@ -XXX,XX +XXX,XX @@ static void target_setup_sve_record(struct target_sve_context *sve,
54
}
55
}
56
57
+static void target_setup_za_record(struct target_za_context *za,
58
+ CPUARMState *env, int size)
59
+{
60
+ int vq = sme_vq(env);
61
+ int vl = vq * TARGET_SVE_VQ_BYTES;
62
+ int i, j;
63
+
64
+ memset(za, 0, sizeof(*za));
65
+ __put_user(TARGET_ZA_MAGIC, &za->head.magic);
66
+ __put_user(size, &za->head.size);
67
+ __put_user(vl, &za->vl);
68
+
69
+ if (size == TARGET_ZA_SIG_CONTEXT_SIZE(0)) {
70
+ return;
71
+ }
72
+ assert(size == TARGET_ZA_SIG_CONTEXT_SIZE(vq));
73
+
74
+ /*
75
+ * Note that ZA vectors are stored as a byte stream,
76
+ * with each byte element at a subsequent address.
77
+ */
78
+ for (i = 0; i < vl; ++i) {
79
+ uint64_t *z = (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i);
80
+ for (j = 0; j < vq * 2; ++j) {
81
+ __put_user_e(env->zarray[i].d[j], z + j, le);
82
+ }
83
+ }
84
+}
85
+
86
static void target_restore_general_frame(CPUARMState *env,
87
struct target_rt_sigframe *sf)
88
{
89
@@ -XXX,XX +XXX,XX @@ static void target_restore_fpsimd_record(CPUARMState *env,
90
91
static bool target_restore_sve_record(CPUARMState *env,
92
struct target_sve_context *sve,
93
- int size)
94
+ int size, int *svcr)
95
{
96
- int i, j, vl, vq;
97
+ int i, j, vl, vq, flags;
98
+ bool sm;
99
100
- if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) {
101
+ __get_user(vl, &sve->vl);
102
+ __get_user(flags, &sve->flags);
103
+
104
+ sm = flags & TARGET_SVE_SIG_FLAG_SM;
105
+
106
+ /* The cpu must support Streaming or Non-streaming SVE. */
107
+ if (sm
108
+ ? !cpu_isar_feature(aa64_sme, env_archcpu(env))
109
+ : !cpu_isar_feature(aa64_sve, env_archcpu(env))) {
110
return false;
111
}
112
113
- __get_user(vl, &sve->vl);
114
- vq = sve_vq(env);
115
+ /*
116
+ * Note that we cannot use sve_vq() because that depends on the
117
+ * current setting of PSTATE.SM, not the state to be restored.
118
+ */
119
+ vq = sve_vqm1_for_el_sm(env, 0, sm) + 1;
120
121
/* Reject mismatched VL. */
122
if (vl != vq * TARGET_SVE_VQ_BYTES) {
123
@@ -XXX,XX +XXX,XX @@ static bool target_restore_sve_record(CPUARMState *env,
124
return false;
125
}
126
127
+ *svcr = FIELD_DP64(*svcr, SVCR, SM, sm);
128
+
129
/*
130
* Note that SVE regs are stored as a byte stream, with each byte element
131
* at a subsequent address. This corresponds to a little-endian load
132
@@ -XXX,XX +XXX,XX @@ static bool target_restore_sve_record(CPUARMState *env,
133
return true;
134
}
135
136
+static bool target_restore_za_record(CPUARMState *env,
137
+ struct target_za_context *za,
138
+ int size, int *svcr)
139
+{
140
+ int i, j, vl, vq;
141
+
142
+ if (!cpu_isar_feature(aa64_sme, env_archcpu(env))) {
143
+ return false;
144
+ }
145
+
146
+ __get_user(vl, &za->vl);
147
+ vq = sme_vq(env);
148
+
149
+ /* Reject mismatched VL. */
150
+ if (vl != vq * TARGET_SVE_VQ_BYTES) {
151
+ return false;
152
+ }
153
+
154
+ /* Accept empty record -- used to clear PSTATE.ZA. */
155
+ if (size <= TARGET_ZA_SIG_CONTEXT_SIZE(0)) {
156
+ return true;
157
+ }
158
+
159
+ /* Reject non-empty but incomplete record. */
160
+ if (size < TARGET_ZA_SIG_CONTEXT_SIZE(vq)) {
161
+ return false;
162
+ }
163
+
164
+ *svcr = FIELD_DP64(*svcr, SVCR, ZA, 1);
165
+
166
+ for (i = 0; i < vl; ++i) {
167
+ uint64_t *z = (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i);
168
+ for (j = 0; j < vq * 2; ++j) {
169
+ __get_user_e(env->zarray[i].d[j], z + j, le);
170
+ }
171
+ }
172
+ return true;
173
+}
174
+
175
static int target_restore_sigframe(CPUARMState *env,
176
struct target_rt_sigframe *sf)
177
{
178
struct target_aarch64_ctx *ctx, *extra = NULL;
179
struct target_fpsimd_context *fpsimd = NULL;
180
struct target_sve_context *sve = NULL;
181
+ struct target_za_context *za = NULL;
182
uint64_t extra_datap = 0;
183
bool used_extra = false;
184
int sve_size = 0;
185
+ int za_size = 0;
186
+ int svcr = 0;
187
188
target_restore_general_frame(env, sf);
189
190
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
191
sve_size = size;
192
break;
193
194
+ case TARGET_ZA_MAGIC:
195
+ if (za || size < sizeof(struct target_za_context)) {
196
+ goto err;
197
+ }
198
+ za = (struct target_za_context *)ctx;
199
+ za_size = size;
200
+ break;
201
+
202
case TARGET_EXTRA_MAGIC:
203
if (extra || size != sizeof(struct target_extra_context)) {
204
goto err;
205
@@ -XXX,XX +XXX,XX @@ static int target_restore_sigframe(CPUARMState *env,
206
}
207
208
/* SVE data, if present, overwrites FPSIMD data. */
209
- if (sve && !target_restore_sve_record(env, sve, sve_size)) {
210
+ if (sve && !target_restore_sve_record(env, sve, sve_size, &svcr)) {
211
goto err;
212
}
213
+ if (za && !target_restore_za_record(env, za, za_size, &svcr)) {
214
+ goto err;
215
+ }
216
+ if (env->svcr != svcr) {
217
+ env->svcr = svcr;
218
+ arm_rebuild_hflags(env);
219
+ }
220
unlock_user(extra, extra_datap, 0);
221
return 0;
222
223
@@ -XXX,XX +XXX,XX @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
224
.total_size = offsetof(struct target_rt_sigframe,
225
uc.tuc_mcontext.__reserved),
226
};
227
- int fpsimd_ofs, fr_ofs, sve_ofs = 0, vq = 0, sve_size = 0;
228
+ int fpsimd_ofs, fr_ofs, sve_ofs = 0, za_ofs = 0;
229
+ int sve_size = 0, za_size = 0;
230
struct target_rt_sigframe *frame;
231
struct target_rt_frame_record *fr;
232
abi_ulong frame_addr, return_addr;
233
@@ -XXX,XX +XXX,XX @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
234
&layout);
235
236
/* SVE state needs saving only if it exists. */
237
- if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
238
- vq = sve_vq(env);
239
- sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16);
240
+ if (cpu_isar_feature(aa64_sve, env_archcpu(env)) ||
241
+ cpu_isar_feature(aa64_sme, env_archcpu(env))) {
242
+ sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(sve_vq(env)), 16);
243
sve_ofs = alloc_sigframe_space(sve_size, &layout);
244
}
245
+ if (cpu_isar_feature(aa64_sme, env_archcpu(env))) {
246
+ /* ZA state needs saving only if it is enabled. */
247
+ if (FIELD_EX64(env->svcr, SVCR, ZA)) {
248
+ za_size = TARGET_ZA_SIG_CONTEXT_SIZE(sme_vq(env));
249
+ } else {
250
+ za_size = TARGET_ZA_SIG_CONTEXT_SIZE(0);
251
+ }
252
+ za_ofs = alloc_sigframe_space(za_size, &layout);
253
+ }
254
255
if (layout.extra_ofs) {
256
/* Reserve space for the extra end marker. The standard end marker
257
@@ -XXX,XX +XXX,XX @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
258
target_setup_end_record((void *)frame + layout.extra_end_ofs);
259
}
260
if (sve_ofs) {
261
- target_setup_sve_record((void *)frame + sve_ofs, env, vq, sve_size);
262
+ target_setup_sve_record((void *)frame + sve_ofs, env, sve_size);
263
+ }
264
+ if (za_ofs) {
265
+ target_setup_za_record((void *)frame + za_ofs, env, za_size);
266
}
267
268
/* Set up the stack frame for unwinding. */
269
@@ -XXX,XX +XXX,XX @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
270
env->btype = 2;
271
}
272
273
+ /*
274
+ * Invoke the signal handler with both SM and ZA disabled.
275
+ * When clearing SM, ResetSVEState, per SMSTOP.
276
+ */
277
+ if (FIELD_EX64(env->svcr, SVCR, SM)) {
278
+ arm_reset_sve_state(env);
279
+ }
280
+ if (env->svcr) {
281
+ env->svcr = 0;
282
+ arm_rebuild_hflags(env);
283
+ }
284
+
285
if (info) {
286
tswap_siginfo(&frame->info, info);
287
env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info);
127
--
288
--
128
2.20.1
289
2.25.1
129
130
diff view generated by jsdifflib
1
From: Zenghui Yu <yuzenghui@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
If LPIs are disabled, KVM will just ignore the GICR_PENDBASER.PTZ bit when
3
Add "sve" to the sve prctl functions, to distinguish
4
restoring GICR_CTLR. Setting PTZ here makes littlt sense in "reduce GIC
4
them from the coming "sme" prctls with similar names.
5
initialization time".
6
5
7
And what's worse, PTZ is generally programmed by guest to indicate to the
8
Redistributor whether the LPI Pending table is zero when enabling LPIs.
9
If migration is triggered when the PTZ has just been cleared by guest (and
10
before enabling LPIs), we will see PTZ==1 on the destination side, which
11
is not as expected. Let's just drop this hackish userspace behavior.
12
13
Also take this chance to refine the comment a bit.
14
15
Fixes: 367b9f527bec ("hw/intc/arm_gicv3_kvm: Implement get/put functions")
16
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
17
Message-id: 20200119133051.642-1-yuzenghui@huawei.com
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-42-richard.henderson@linaro.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
10
---
21
hw/intc/arm_gicv3_kvm.c | 11 ++++-------
11
linux-user/aarch64/target_prctl.h | 8 ++++----
22
1 file changed, 4 insertions(+), 7 deletions(-)
12
linux-user/syscall.c | 12 ++++++------
13
2 files changed, 10 insertions(+), 10 deletions(-)
23
14
24
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
15
diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h
25
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/intc/arm_gicv3_kvm.c
17
--- a/linux-user/aarch64/target_prctl.h
27
+++ b/hw/intc/arm_gicv3_kvm.c
18
+++ b/linux-user/aarch64/target_prctl.h
28
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_put(GICv3State *s)
19
@@ -XXX,XX +XXX,XX @@
29
kvm_gicd_access(s, GICD_CTLR, &reg, true);
20
#ifndef AARCH64_TARGET_PRCTL_H
30
21
#define AARCH64_TARGET_PRCTL_H
31
if (redist_typer & GICR_TYPER_PLPIS) {
22
32
- /* Set base addresses before LPIs are enabled by GICR_CTLR write */
23
-static abi_long do_prctl_get_vl(CPUArchState *env)
33
+ /*
24
+static abi_long do_prctl_sve_get_vl(CPUArchState *env)
34
+ * Restore base addresses before LPIs are potentially enabled by
25
{
35
+ * GICR_CTLR write
26
ARMCPU *cpu = env_archcpu(env);
36
+ */
27
if (cpu_isar_feature(aa64_sve, cpu)) {
37
for (ncpu = 0; ncpu < s->num_cpu; ncpu++) {
28
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_get_vl(CPUArchState *env)
38
GICv3CPUState *c = &s->cpu[ncpu];
29
}
39
30
return -TARGET_EINVAL;
40
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_put(GICv3State *s)
31
}
41
kvm_gicr_access(s, GICR_PROPBASER + 4, ncpu, &regh, true);
32
-#define do_prctl_get_vl do_prctl_get_vl
42
33
+#define do_prctl_sve_get_vl do_prctl_sve_get_vl
43
reg64 = c->gicr_pendbaser;
34
44
- if (!(c->gicr_ctlr & GICR_CTLR_ENABLE_LPIS)) {
35
-static abi_long do_prctl_set_vl(CPUArchState *env, abi_long arg2)
45
- /* Setting PTZ is advised if LPIs are disabled, to reduce
36
+static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2)
46
- * GIC initialization time.
37
{
47
- */
38
/*
48
- reg64 |= GICR_PENDBASER_PTZ;
39
* We cannot support either PR_SVE_SET_VL_ONEXEC or PR_SVE_VL_INHERIT.
49
- }
40
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_set_vl(CPUArchState *env, abi_long arg2)
50
regl = (uint32_t)reg64;
41
}
51
kvm_gicr_access(s, GICR_PENDBASER, ncpu, &regl, true);
42
return -TARGET_EINVAL;
52
regh = (uint32_t)(reg64 >> 32);
43
}
44
-#define do_prctl_set_vl do_prctl_set_vl
45
+#define do_prctl_sve_set_vl do_prctl_sve_set_vl
46
47
static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2)
48
{
49
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/linux-user/syscall.c
52
+++ b/linux-user/syscall.c
53
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_long arg2)
54
#ifndef do_prctl_set_fp_mode
55
#define do_prctl_set_fp_mode do_prctl_inval1
56
#endif
57
-#ifndef do_prctl_get_vl
58
-#define do_prctl_get_vl do_prctl_inval0
59
+#ifndef do_prctl_sve_get_vl
60
+#define do_prctl_sve_get_vl do_prctl_inval0
61
#endif
62
-#ifndef do_prctl_set_vl
63
-#define do_prctl_set_vl do_prctl_inval1
64
+#ifndef do_prctl_sve_set_vl
65
+#define do_prctl_sve_set_vl do_prctl_inval1
66
#endif
67
#ifndef do_prctl_reset_keys
68
#define do_prctl_reset_keys do_prctl_inval1
69
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
70
case PR_SET_FP_MODE:
71
return do_prctl_set_fp_mode(env, arg2);
72
case PR_SVE_GET_VL:
73
- return do_prctl_get_vl(env);
74
+ return do_prctl_sve_get_vl(env);
75
case PR_SVE_SET_VL:
76
- return do_prctl_set_vl(env, arg2);
77
+ return do_prctl_sve_set_vl(env, arg2);
78
case PR_PAC_RESET_KEYS:
79
if (arg3 || arg4 || arg5) {
80
return -TARGET_EINVAL;
53
--
81
--
54
2.20.1
82
2.25.1
55
56
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Replace deprecated qdev_reset_all by resettable_cold_reset_fn for
3
These prctl set the Streaming SVE vector length, which may
4
the ipl registration in the main reset handlers.
4
be completely different from the Normal SVE vector length.
5
5
6
This does not impact the behavior for the following reasons:
7
+ at this point resettable just call the old reset methods of devices
8
and buses in the same order than qdev/qbus.
9
+ resettable handlers registered with qemu_register_reset are
10
serialized; there is no interleaving.
11
+ eventual explicit calls to legacy reset API (device_reset or
12
qdev/qbus_reset) inside this reset handler will not be masked out
13
by resettable mechanism; they do not go through resettable api.
14
15
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
16
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220708151540.18136-43-richard.henderson@linaro.org
20
Message-id: 20200123132823.1117486-12-damien.hedde@greensocs.com
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
10
---
23
hw/s390x/ipl.c | 10 +++++++++-
11
linux-user/aarch64/target_prctl.h | 54 +++++++++++++++++++++++++++++++
24
1 file changed, 9 insertions(+), 1 deletion(-)
12
linux-user/syscall.c | 16 +++++++++
13
2 files changed, 70 insertions(+)
25
14
26
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
15
diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h
27
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/s390x/ipl.c
17
--- a/linux-user/aarch64/target_prctl.h
29
+++ b/hw/s390x/ipl.c
18
+++ b/linux-user/aarch64/target_prctl.h
30
@@ -XXX,XX +XXX,XX @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
19
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_sve_get_vl(CPUArchState *env)
31
*/
20
{
32
ipl->compat_start_addr = ipl->start_addr;
21
ARMCPU *cpu = env_archcpu(env);
33
ipl->compat_bios_start_addr = ipl->bios_start_addr;
22
if (cpu_isar_feature(aa64_sve, cpu)) {
34
- qemu_register_reset(qdev_reset_all_fn, dev);
23
+ /* PSTATE.SM is always unset on syscall entry. */
24
return sve_vq(env) * 16;
25
}
26
return -TARGET_EINVAL;
27
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2)
28
&& arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) {
29
uint32_t vq, old_vq;
30
31
+ /* PSTATE.SM is always unset on syscall entry. */
32
old_vq = sve_vq(env);
33
34
/*
35
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2)
36
}
37
#define do_prctl_sve_set_vl do_prctl_sve_set_vl
38
39
+static abi_long do_prctl_sme_get_vl(CPUArchState *env)
40
+{
41
+ ARMCPU *cpu = env_archcpu(env);
42
+ if (cpu_isar_feature(aa64_sme, cpu)) {
43
+ return sme_vq(env) * 16;
44
+ }
45
+ return -TARGET_EINVAL;
46
+}
47
+#define do_prctl_sme_get_vl do_prctl_sme_get_vl
48
+
49
+static abi_long do_prctl_sme_set_vl(CPUArchState *env, abi_long arg2)
50
+{
35
+ /*
51
+ /*
36
+ * Because this Device is not on any bus in the qbus tree (it is
52
+ * We cannot support either PR_SME_SET_VL_ONEXEC or PR_SME_VL_INHERIT.
37
+ * not a sysbus device and it's not on some other bus like a PCI
53
+ * Note the kernel definition of sve_vl_valid allows for VQ=512,
38
+ * bus) it will not be automatically reset by the 'reset the
54
+ * i.e. VL=8192, even though the architectural maximum is VQ=16.
39
+ * sysbus' hook registered by vl.c like most devices. So we must
40
+ * manually register a reset hook for it.
41
+ * TODO: there should be a better way to do this.
42
+ */
55
+ */
43
+ qemu_register_reset(resettable_cold_reset_fn, dev);
56
+ if (cpu_isar_feature(aa64_sme, env_archcpu(env))
44
error:
57
+ && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) {
45
error_propagate(errp, err);
58
+ int vq, old_vq;
46
}
59
+
60
+ old_vq = sme_vq(env);
61
+
62
+ /*
63
+ * Bound the value of vq, so that we know that it fits into
64
+ * the 4-bit field in SMCR_EL1. Because PSTATE.SM is cleared
65
+ * on syscall entry, we are not modifying the current SVE
66
+ * vector length.
67
+ */
68
+ vq = MAX(arg2 / 16, 1);
69
+ vq = MIN(vq, 16);
70
+ env->vfp.smcr_el[1] =
71
+ FIELD_DP64(env->vfp.smcr_el[1], SMCR, LEN, vq - 1);
72
+
73
+ /* Delay rebuilding hflags until we know if ZA must change. */
74
+ vq = sve_vqm1_for_el_sm(env, 0, true) + 1;
75
+
76
+ if (vq != old_vq) {
77
+ /*
78
+ * PSTATE.ZA state is cleared on any change to SVL.
79
+ * We need not call arm_rebuild_hflags because PSTATE.SM was
80
+ * cleared on syscall entry, so this hasn't changed VL.
81
+ */
82
+ env->svcr = FIELD_DP64(env->svcr, SVCR, ZA, 0);
83
+ arm_rebuild_hflags(env);
84
+ }
85
+ return vq * 16;
86
+ }
87
+ return -TARGET_EINVAL;
88
+}
89
+#define do_prctl_sme_set_vl do_prctl_sme_set_vl
90
+
91
static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2)
92
{
93
ARMCPU *cpu = env_archcpu(env);
94
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
95
index XXXXXXX..XXXXXXX 100644
96
--- a/linux-user/syscall.c
97
+++ b/linux-user/syscall.c
98
@@ -XXX,XX +XXX,XX @@ abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)
99
#ifndef PR_SET_SYSCALL_USER_DISPATCH
100
# define PR_SET_SYSCALL_USER_DISPATCH 59
101
#endif
102
+#ifndef PR_SME_SET_VL
103
+# define PR_SME_SET_VL 63
104
+# define PR_SME_GET_VL 64
105
+# define PR_SME_VL_LEN_MASK 0xffff
106
+# define PR_SME_VL_INHERIT (1 << 17)
107
+#endif
108
109
#include "target_prctl.h"
110
111
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_long arg2)
112
#ifndef do_prctl_set_unalign
113
#define do_prctl_set_unalign do_prctl_inval1
114
#endif
115
+#ifndef do_prctl_sme_get_vl
116
+#define do_prctl_sme_get_vl do_prctl_inval0
117
+#endif
118
+#ifndef do_prctl_sme_set_vl
119
+#define do_prctl_sme_set_vl do_prctl_inval1
120
+#endif
121
122
static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
123
abi_long arg3, abi_long arg4, abi_long arg5)
124
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
125
return do_prctl_sve_get_vl(env);
126
case PR_SVE_SET_VL:
127
return do_prctl_sve_set_vl(env, arg2);
128
+ case PR_SME_GET_VL:
129
+ return do_prctl_sme_get_vl(env);
130
+ case PR_SME_SET_VL:
131
+ return do_prctl_sme_set_vl(env, arg2);
132
case PR_PAC_RESET_KEYS:
133
if (arg3 || arg4 || arg5) {
134
return -TARGET_EINVAL;
47
--
135
--
48
2.20.1
136
2.25.1
49
50
diff view generated by jsdifflib
1
From: Damien Hedde <damien.hedde@greensocs.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Replace deprecated qbus_reset_all by resettable_cold_reset_fn for
3
There's no reason to set CPACR_EL1.ZEN if SVE disabled.
4
the sysbus reset registration.
5
4
6
Apart for the raspi machines, this does not impact the behavior
7
because:
8
+ at this point resettable just calls the old reset methods of devices
9
and buses in the same order as qdev/qbus.
10
+ resettable handlers registered with qemu_register_reset are
11
serialized; there is no interleaving.
12
+ eventual explicit calls to legacy reset API (device_reset or
13
qdev/qbus_reset) inside this reset handler will not be masked out
14
by resettable mechanism; they do not go through resettable api.
15
16
For the raspi machines, during the sysbus reset the sd-card is not
17
reset twice anymore but only once. This is a consequence of switching
18
both sysbus reset and changing parent to resettable; it detects the
19
second reset is not needed. This has no impact on the state after
20
reset; the sd-card reset method only reset local state and query
21
information from the block backend.
22
23
The raspi reset change can be observed by using the following command
24
(reset will occurs, then do Ctrl-C to end qemu; no firmware is
25
given here).
26
qemu-system-aarch64 -M raspi3 \
27
-trace resettable_phase_hold_exec \
28
-trace qdev_update_parent_bus \
29
-trace resettable_change_parent \
30
-trace qdev_reset -trace qbus_reset
31
32
Before the patch, the qdev/qbus_reset traces show when reset method are
33
called. After the patch, the resettable_phase_hold_exec show when reset
34
method are called.
35
36
The traced reset order of the raspi3 is listed below. I've added empty
37
lines and the tree structure.
38
39
+->bcm2835-peripherals reset
40
|
41
| +->sd-card reset
42
| +->sd-bus reset
43
+->bcm2835_gpio reset
44
| -> dev_update_parent_bus (move the sd-card on the sdhci-bus)
45
| -> resettable_change_parent
46
|
47
+->bcm2835-dma reset
48
|
49
| +->bcm2835-sdhost-bus reset
50
+->bcm2835-sdhost reset
51
|
52
| +->sd-card (reset ONLY BEFORE BEFORE THE PATCH)
53
| +->sdhci-bus reset
54
+->generic-sdhci reset
55
|
56
+->bcm2835-rng reset
57
+->bcm2835-property reset
58
+->bcm2835-fb reset
59
+->bcm2835-mbox reset
60
+->bcm2835-aux reset
61
+->pl011 reset
62
+->bcm2835-ic reset
63
+->bcm2836-control reset
64
System reset
65
66
In both case, the sd-card is reset (being on bcm2835_gpio/sd-bus) then moved
67
to generic-sdhci/sdhci-bus by the bcm2835_gpio reset method.
68
69
Before the patch, it is then reset again being part of generic-sdhci/sdhci-bus.
70
After the patch, it considered again for reset but its reset method is not
71
called because it is already flagged as reset.
72
73
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
74
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
75
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
76
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20220708151540.18136-44-richard.henderson@linaro.org
77
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
78
Message-id: 20200123132823.1117486-11-damien.hedde@greensocs.com
79
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
80
---
9
---
81
vl.c | 10 +++++++++-
10
target/arm/cpu.c | 7 +++----
82
1 file changed, 9 insertions(+), 1 deletion(-)
11
1 file changed, 3 insertions(+), 4 deletions(-)
83
12
84
diff --git a/vl.c b/vl.c
13
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
85
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
86
--- a/vl.c
15
--- a/target/arm/cpu.c
87
+++ b/vl.c
16
+++ b/target/arm/cpu.c
88
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp)
17
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev)
89
18
/* and to the FP/Neon instructions */
90
/* TODO: once all bus devices are qdevified, this should be done
19
env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1,
91
* when bus is created by qdev.c */
20
CPACR_EL1, FPEN, 3);
92
- qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
21
- /* and to the SVE instructions */
93
+ /*
22
- env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1,
94
+ * TODO: If we had a main 'reset container' that the whole system
23
- CPACR_EL1, ZEN, 3);
95
+ * lived in, we could reset that using the multi-phase reset
24
- /* with reasonable vector length */
96
+ * APIs. For the moment, we just reset the sysbus, which will cause
25
+ /* and to the SVE instructions, with default vector length */
97
+ * all devices hanging off it (and all their child buses, recursively)
26
if (cpu_isar_feature(aa64_sve, cpu)) {
98
+ * to be reset. Note that this will *not* reset any Device objects
27
+ env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1,
99
+ * which are not attached to some part of the qbus tree!
28
+ CPACR_EL1, ZEN, 3);
100
+ */
29
env->vfp.zcr_el[1] = cpu->sve_default_vq - 1;
101
+ qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default());
30
}
102
qemu_run_machine_init_done_notifiers();
31
/*
103
104
if (rom_check_and_register_reset() != 0) {
105
--
32
--
106
2.20.1
33
2.25.1
107
108
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Since we enabled parallel TCG code generation for softmmu (see
3
Enable SME, TPIDR2_EL0, and FA64 if supported by the cpu.
4
commit 3468b59 "tcg: enable multiple TCG contexts in softmmu")
5
and its subsequent fix (commit 72649619 "add .min_cpus and
6
.default_cpus fields to machine_class"), the raspi machines are
7
restricted to always use their 4 cores:
8
4
9
See in hw/arm/raspi2 (with BCM283X_NCPUS set to 4):
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
222 static void raspi2_machine_init(MachineClass *mc)
7
Message-id: 20220708151540.18136-45-richard.henderson@linaro.org
12
223 {
13
224 mc->desc = "Raspberry Pi 2";
14
230 mc->max_cpus = BCM283X_NCPUS;
15
231 mc->min_cpus = BCM283X_NCPUS;
16
232 mc->default_cpus = BCM283X_NCPUS;
17
235 };
18
236 DEFINE_MACHINE("raspi2", raspi2_machine_init)
19
20
We can no longer use the -smp option, as we get:
21
22
$ qemu-system-arm -M raspi2 -smp 1
23
qemu-system-arm: Invalid SMP CPUs 1. The min CPUs supported by machine 'raspi2' is 4
24
25
Since we can not set the TYPE_BCM283x SOC "enabled-cpus" with -smp,
26
remove the unuseful code.
27
28
We can achieve the same by using the '-global bcm2836.enabled-cpus=1'
29
option.
30
31
Reported-by: Laurent Bonnans <laurent.bonnans@here.com>
32
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
33
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
34
Message-id: 20200120235159.18510-2-f4bug@amsat.org
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
36
---
9
---
37
hw/arm/raspi.c | 2 --
10
target/arm/cpu.c | 11 +++++++++++
38
1 file changed, 2 deletions(-)
11
1 file changed, 11 insertions(+)
39
12
40
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
13
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
41
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/arm/raspi.c
15
--- a/target/arm/cpu.c
43
+++ b/hw/arm/raspi.c
16
+++ b/target/arm/cpu.c
44
@@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version)
17
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev)
45
/* Setup the SOC */
18
CPACR_EL1, ZEN, 3);
46
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
19
env->vfp.zcr_el[1] = cpu->sve_default_vq - 1;
47
&error_abort);
20
}
48
- object_property_set_int(OBJECT(&s->soc), machine->smp.cpus, "enabled-cpus",
21
+ /* and for SME instructions, with default vector length, and TPIDR2 */
49
- &error_abort);
22
+ if (cpu_isar_feature(aa64_sme, cpu)) {
50
int board_rev = version == 3 ? 0xa02082 : 0xa21041;
23
+ env->cp15.sctlr_el[1] |= SCTLR_EnTP2;
51
object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev",
24
+ env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1,
52
&error_abort);
25
+ CPACR_EL1, SMEN, 3);
26
+ env->vfp.smcr_el[1] = cpu->sme_default_vq - 1;
27
+ if (cpu_isar_feature(aa64_sme_fa64, cpu)) {
28
+ env->vfp.smcr_el[1] = FIELD_DP64(env->vfp.smcr_el[1],
29
+ SMCR, FA64, 1);
30
+ }
31
+ }
32
/*
33
* Enable 48-bit address space (TODO: take reserved_va into account).
34
* Enable TBI0 but not TBI1.
53
--
35
--
54
2.20.1
36
2.25.1
55
56
diff view generated by jsdifflib
1
The num-lines property of the TYPE_OR_GATE device sets the number
1
From: Richard Henderson <richard.henderson@linaro.org>
2
of input lines it has. An assert() in or_irq_realize() restricts
3
this to the maximum supported by the implementation. However we
4
got the condition in the assert wrong: it should be using <=,
5
because num-lines == MAX_OR_LINES is permitted, and means that
6
all entries from 0 to MAX_OR_LINES-1 in the s->levels[] array
7
are used.
8
2
9
We didn't notice this previously because no user has so far
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
needed that many input lines.
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220708151540.18136-46-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
linux-user/elfload.c | 20 ++++++++++++++++++++
9
1 file changed, 20 insertions(+)
11
10
12
Reported-by: Guenter Roeck <linux@roeck-us.net>
11
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
16
Message-id: 20200120142235.10432-1-peter.maydell@linaro.org
17
---
18
hw/core/or-irq.c | 2 +-
19
1 file changed, 1 insertion(+), 1 deletion(-)
20
21
diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c
22
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/core/or-irq.c
13
--- a/linux-user/elfload.c
24
+++ b/hw/core/or-irq.c
14
+++ b/linux-user/elfload.c
25
@@ -XXX,XX +XXX,XX @@ static void or_irq_realize(DeviceState *dev, Error **errp)
15
@@ -XXX,XX +XXX,XX @@ enum {
26
{
16
ARM_HWCAP2_A64_RNG = 1 << 16,
27
qemu_or_irq *s = OR_IRQ(dev);
17
ARM_HWCAP2_A64_BTI = 1 << 17,
28
18
ARM_HWCAP2_A64_MTE = 1 << 18,
29
- assert(s->num_lines < MAX_OR_LINES);
19
+ ARM_HWCAP2_A64_ECV = 1 << 19,
30
+ assert(s->num_lines <= MAX_OR_LINES);
20
+ ARM_HWCAP2_A64_AFP = 1 << 20,
31
21
+ ARM_HWCAP2_A64_RPRES = 1 << 21,
32
qdev_init_gpio_in(dev, or_irq_handler, s->num_lines);
22
+ ARM_HWCAP2_A64_MTE3 = 1 << 22,
23
+ ARM_HWCAP2_A64_SME = 1 << 23,
24
+ ARM_HWCAP2_A64_SME_I16I64 = 1 << 24,
25
+ ARM_HWCAP2_A64_SME_F64F64 = 1 << 25,
26
+ ARM_HWCAP2_A64_SME_I8I32 = 1 << 26,
27
+ ARM_HWCAP2_A64_SME_F16F32 = 1 << 27,
28
+ ARM_HWCAP2_A64_SME_B16F32 = 1 << 28,
29
+ ARM_HWCAP2_A64_SME_F32F32 = 1 << 29,
30
+ ARM_HWCAP2_A64_SME_FA64 = 1 << 30,
31
};
32
33
#define ELF_HWCAP get_elf_hwcap()
34
@@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap2(void)
35
GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG);
36
GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI);
37
GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE);
38
+ GET_FEATURE_ID(aa64_sme, (ARM_HWCAP2_A64_SME |
39
+ ARM_HWCAP2_A64_SME_F32F32 |
40
+ ARM_HWCAP2_A64_SME_B16F32 |
41
+ ARM_HWCAP2_A64_SME_F16F32 |
42
+ ARM_HWCAP2_A64_SME_I8I32));
43
+ GET_FEATURE_ID(aa64_sme_f64f64, ARM_HWCAP2_A64_SME_F64F64);
44
+ GET_FEATURE_ID(aa64_sme_i16i64, ARM_HWCAP2_A64_SME_I16I64);
45
+ GET_FEATURE_ID(aa64_sme_fa64, ARM_HWCAP2_A64_SME_FA64);
46
47
return hwcaps;
33
}
48
}
34
--
49
--
35
2.20.1
50
2.25.1
36
37
diff view generated by jsdifflib