1
Second ARM pull request of this week; this one has my next
1
Most of this is the Neon decodetree patches, followed by Edgar's versal cleanups.
2
set of v8M patches and a handful of more minor stuff from
3
other people.
4
2
5
thanks
3
thanks
6
-- PMM
4
-- PMM
7
5
8
The following changes since commit 8ee5f9b3ecc94e3eb7a8235f4b2c3ec9024807f6:
9
6
10
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2017-09-07 10:45:18 +0100)
7
The following changes since commit 2ef486e76d64436be90f7359a3071fb2a56ce835:
11
8
12
are available in the git repository at:
9
Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging (2020-05-03 14:12:56 +0100)
13
10
14
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20170907
11
are available in the Git repository at:
15
12
16
for you to fetch changes up to c99a55d38dd5b5131f3fcbbaf41828a09ee62544:
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200504
17
14
18
target/arm: Add Jazelle feature (2017-09-07 13:54:55 +0100)
15
for you to fetch changes up to 9aefc6cf9b73f66062d2f914a0136756e7a28211:
16
17
target/arm: Move gen_ function typedefs to translate.h (2020-05-04 12:59:26 +0100)
19
18
20
----------------------------------------------------------------
19
----------------------------------------------------------------
21
target-arm:
20
target-arm queue:
22
* cleanups converting to DEFINE_PROP_LINK
21
* Start of conversion of Neon insns to decodetree
23
* allwinner-a10: mark as not user-creatable
22
* versal board: support SD and RTC
24
* initial patches working towards ARMv8M support
23
* Implement ARMv8.2-TTS2UXN
25
* implement generating aborts on memory transaction failures
24
* Make VQDMULL undefined when U=1
26
* make BXJ behave correctly (ie not UNDEF) on ARMv6-and-later
25
* Some minor code cleanups
27
26
28
----------------------------------------------------------------
27
----------------------------------------------------------------
29
Fam Zheng (6):
28
Edgar E. Iglesias (11):
30
armv7m: Convert bitband.source-memory to DEFINE_PROP_LINK
29
hw/arm: versal: Remove inclusion of arm_gicv3_common.h
31
armv7m: Convert armv7m.memory to DEFINE_PROP_LINK
30
hw/arm: versal: Move misplaced comment
32
gicv3: Convert to DEFINE_PROP_LINK
31
hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal
33
xlnx_zynqmp: Convert to DEFINE_PROP_LINK
32
hw/arm: versal: Embed the UARTs into the SoC type
34
xilinx_axienet: Convert to DEFINE_PROP_LINK
33
hw/arm: versal: Embed the GEMs into the SoC type
35
xilinx_axidma: Convert to DEFINE_PROP_LINK
34
hw/arm: versal: Embed the ADMAs into the SoC type
35
hw/arm: versal: Embed the APUs into the SoC type
36
hw/arm: versal: Add support for SD
37
hw/arm: versal: Add support for the RTC
38
hw/arm: versal-virt: Add support for SD
39
hw/arm: versal-virt: Add support for the RTC
36
40
37
Peter Maydell (23):
41
Fredrik Strupe (1):
38
target/arm: Implement ARMv8M's PMSAv8 registers
42
target/arm: Make VQDMULL undefined when U=1
39
target/arm: Implement new PMSAv8 behaviour
40
target/arm: Add state field, feature bit and migration for v8M secure state
41
target/arm: Register second AddressSpace for secure v8M CPUs
42
target/arm: Add MMU indexes for secure v8M
43
target/arm: Make BASEPRI register banked for v8M
44
target/arm: Make PRIMASK register banked for v8M
45
target/arm: Make FAULTMASK register banked for v8M
46
target/arm: Make CONTROL register banked for v8M
47
nvic: Add NS alias SCS region
48
target/arm: Make VTOR register banked for v8M
49
target/arm: Make MPU_MAIR0, MPU_MAIR1 registers banked for v8M
50
target/arm: Make MPU_RBAR, MPU_RLAR banked for v8M
51
target/arm: Make MPU_RNR register banked for v8M
52
target/arm: Make MPU_CTRL register banked for v8M
53
target/arm: Make CCR register banked for v8M
54
target/arm: Make MMFAR banked for v8M
55
target/arm: Make CFSR register banked for v8M
56
target/arm: Move regime_is_secure() to target/arm/internals.h
57
target/arm: Implement BXNS, and banked stack pointers
58
boards.h: Define new flag ignore_memory_transaction_failures
59
hw/arm: Set ignore_memory_transaction_failures for most ARM boards
60
target/arm: Implement new do_transaction_failed hook
61
43
62
Portia Stephens (1):
44
Peter Maydell (25):
63
target/arm: Add Jazelle feature
45
target/arm: Don't use a TLB for ARMMMUIdx_Stage2
46
target/arm: Use enum constant in get_phys_addr_lpae() call
47
target/arm: Add new 's1_is_el0' argument to get_phys_addr_lpae()
48
target/arm: Implement ARMv8.2-TTS2UXN
49
target/arm: Use correct variable for setting 'max' cpu's ID_AA64DFR0
50
target/arm/translate-vfp.inc.c: Remove duplicate simd_r32 check
51
target/arm: Don't allow Thumb Neon insns without FEATURE_NEON
52
target/arm: Add stubs for AArch32 Neon decodetree
53
target/arm: Convert VCMLA (vector) to decodetree
54
target/arm: Convert VCADD (vector) to decodetree
55
target/arm: Convert V[US]DOT (vector) to decodetree
56
target/arm: Convert VFM[AS]L (vector) to decodetree
57
target/arm: Convert VCMLA (scalar) to decodetree
58
target/arm: Convert V[US]DOT (scalar) to decodetree
59
target/arm: Convert VFM[AS]L (scalar) to decodetree
60
target/arm: Convert Neon load/store multiple structures to decodetree
61
target/arm: Convert Neon 'load single structure to all lanes' to decodetree
62
target/arm: Convert Neon 'load/store single structure' to decodetree
63
target/arm: Convert Neon 3-reg-same VADD/VSUB to decodetree
64
target/arm: Convert Neon 3-reg-same logic ops to decodetree
65
target/arm: Convert Neon 3-reg-same VMAX/VMIN to decodetree
66
target/arm: Convert Neon 3-reg-same comparisons to decodetree
67
target/arm: Convert Neon 3-reg-same VQADD/VQSUB to decodetree
68
target/arm: Convert Neon 3-reg-same VMUL, VMLA, VMLS, VSHL to decodetree
69
target/arm: Move gen_ function typedefs to translate.h
64
70
65
Thomas Huth (1):
71
Philippe Mathieu-Daudé (2):
66
hw/arm/allwinner-a10: Mark the allwinner-a10 device with user_creatable = false
72
hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string
73
target/arm: Use uint64_t for midr field in CPU state struct
67
74
68
include/hw/boards.h | 11 ++
75
include/hw/arm/xlnx-versal.h | 31 +-
69
include/hw/intc/armv7m_nvic.h | 1 +
76
target/arm/cpu-param.h | 2 +-
70
include/qom/cpu.h | 7 +-
77
target/arm/cpu.h | 38 ++-
71
target/arm/cpu.h | 101 ++++++++++++--
78
target/arm/translate-a64.h | 9 -
72
target/arm/helper.h | 2 +
79
target/arm/translate.h | 26 ++
73
target/arm/internals.h | 36 +++++
80
target/arm/neon-dp.decode | 86 +++++
74
target/arm/translate.h | 1 +
81
target/arm/neon-ls.decode | 52 +++
75
hw/arm/allwinner-a10.c | 2 +
82
target/arm/neon-shared.decode | 66 ++++
76
hw/arm/armv7m.c | 16 +--
83
hw/arm/mps2-tz.c | 2 +-
77
hw/arm/aspeed.c | 3 +
84
hw/arm/xlnx-versal-virt.c | 74 ++++-
78
hw/arm/collie.c | 1 +
85
hw/arm/xlnx-versal.c | 115 +++++--
79
hw/arm/cubieboard.c | 1 +
86
target/arm/cpu.c | 3 +-
80
hw/arm/digic_boards.c | 1 +
87
target/arm/cpu64.c | 8 +-
81
hw/arm/exynos4_boards.c | 2 +
88
target/arm/helper.c | 183 ++++------
82
hw/arm/gumstix.c | 2 +
89
target/arm/translate-a64.c | 17 -
83
hw/arm/highbank.c | 2 +
90
target/arm/translate-neon.inc.c | 714 +++++++++++++++++++++++++++++++++++++++
84
hw/arm/imx25_pdk.c | 1 +
91
target/arm/translate-vfp.inc.c | 6 -
85
hw/arm/integratorcp.c | 1 +
92
target/arm/translate.c | 716 +++-------------------------------------
86
hw/arm/kzm.c | 1 +
93
target/arm/Makefile.objs | 18 +
87
hw/arm/mainstone.c | 1 +
94
19 files changed, 1302 insertions(+), 864 deletions(-)
88
hw/arm/musicpal.c | 1 +
95
create mode 100644 target/arm/neon-dp.decode
89
hw/arm/netduino2.c | 1 +
96
create mode 100644 target/arm/neon-ls.decode
90
hw/arm/nseries.c | 2 +
97
create mode 100644 target/arm/neon-shared.decode
91
hw/arm/omap_sx1.c | 2 +
98
create mode 100644 target/arm/translate-neon.inc.c
92
hw/arm/palm.c | 1 +
93
hw/arm/raspi.c | 1 +
94
hw/arm/realview.c | 4 +
95
hw/arm/sabrelite.c | 1 +
96
hw/arm/spitz.c | 4 +
97
hw/arm/stellaris.c | 2 +
98
hw/arm/tosa.c | 1 +
99
hw/arm/versatilepb.c | 2 +
100
hw/arm/vexpress.c | 1 +
101
hw/arm/xilinx_zynq.c | 1 +
102
hw/arm/xlnx-ep108.c | 2 +
103
hw/arm/xlnx-zynqmp.c | 7 +-
104
hw/arm/z2.c | 1 +
105
hw/dma/xilinx_axidma.c | 16 +--
106
hw/intc/arm_gicv3_its_kvm.c | 19 +--
107
hw/intc/armv7m_nvic.c | 291 ++++++++++++++++++++++++++++++++------
108
hw/net/xilinx_axienet.c | 16 +--
109
qom/cpu.c | 16 +++
110
target/arm/cpu.c | 88 +++++++++---
111
target/arm/helper.c | 315 +++++++++++++++++++++++++++++++++---------
112
target/arm/machine.c | 105 ++++++++++++--
113
target/arm/op_helper.c | 43 ++++++
114
target/arm/translate.c | 54 +++++++-
115
scripts/device-crash-test | 1 -
116
48 files changed, 978 insertions(+), 213 deletions(-)
117
99
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
From: Fredrik Strupe <fredrik@strupe.net>
2
2
3
Signed-off-by: Fam Zheng <famz@redhat.com>
3
According to Arm ARM, VQDMULL is only valid when U=0, while having
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
U=1 is unallocated.
5
Message-id: 20170905131149.10669-7-famz@redhat.com
5
6
Signed-off-by: Fredrik Strupe <fredrik@strupe.net>
7
Fixes: 695272dcb976 ("target-arm: Handle UNDEF cases for Neon 3-regs-different-widths")
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@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
hw/dma/xilinx_axidma.c | 16 ++++------------
11
target/arm/translate.c | 2 +-
10
1 file changed, 4 insertions(+), 12 deletions(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
11
13
12
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
13
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/dma/xilinx_axidma.c
16
--- a/target/arm/translate.c
15
+++ b/hw/dma/xilinx_axidma.c
17
+++ b/target/arm/translate.c
16
@@ -XXX,XX +XXX,XX @@ static void xilinx_axidma_init(Object *obj)
18
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
17
XilinxAXIDMA *s = XILINX_AXI_DMA(obj);
19
{0, 0, 0, 0}, /* VMLSL */
18
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
20
{0, 0, 0, 9}, /* VQDMLSL */
19
21
{0, 0, 0, 0}, /* Integer VMULL */
20
- object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,
22
- {0, 0, 0, 1}, /* VQDMULL */
21
- (Object **)&s->tx_data_dev,
23
+ {0, 0, 0, 9}, /* VQDMULL */
22
- qdev_prop_allow_set_link_before_realize,
24
{0, 0, 0, 0xa}, /* Polynomial VMULL */
23
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
25
{0, 0, 0, 7}, /* Reserved: always UNDEF */
24
- &error_abort);
26
};
25
- object_property_add_link(obj, "axistream-control-connected",
26
- TYPE_STREAM_SLAVE,
27
- (Object **)&s->tx_control_dev,
28
- qdev_prop_allow_set_link_before_realize,
29
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
30
- &error_abort);
31
-
32
object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),
33
TYPE_XILINX_AXI_DMA_DATA_STREAM);
34
object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),
35
@@ -XXX,XX +XXX,XX @@ static void xilinx_axidma_init(Object *obj)
36
37
static Property axidma_properties[] = {
38
DEFINE_PROP_UINT32("freqhz", XilinxAXIDMA, freqhz, 50000000),
39
+ DEFINE_PROP_LINK("axistream-connected", XilinxAXIDMA,
40
+ tx_data_dev, TYPE_STREAM_SLAVE, StreamSlave *),
41
+ DEFINE_PROP_LINK("axistream-control-connected", XilinxAXIDMA,
42
+ tx_control_dev, TYPE_STREAM_SLAVE, StreamSlave *),
43
DEFINE_PROP_END_OF_LIST(),
44
};
45
46
--
27
--
47
2.7.4
28
2.20.1
48
29
49
30
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Signed-off-by: Fam Zheng <famz@redhat.com>
3
By using the TYPE_* definitions for devices, we can:
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
- quickly find where devices are used with 'git-grep'
5
Message-id: 20170905131149.10669-6-famz@redhat.com
5
- easily rename a device (one-line change).
6
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20200428154650.21991-1-f4bug@amsat.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
11
---
9
hw/net/xilinx_axienet.c | 16 ++++------------
12
hw/arm/mps2-tz.c | 2 +-
10
1 file changed, 4 insertions(+), 12 deletions(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
11
14
12
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
15
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
13
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/net/xilinx_axienet.c
17
--- a/hw/arm/mps2-tz.c
15
+++ b/hw/net/xilinx_axienet.c
18
+++ b/hw/arm/mps2-tz.c
16
@@ -XXX,XX +XXX,XX @@ static void xilinx_enet_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
17
XilinxAXIEnet *s = XILINX_AXI_ENET(obj);
20
exit(EXIT_FAILURE);
18
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
21
}
19
22
20
- object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,
23
- sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit,
21
- (Object **) &s->tx_data_dev,
24
+ sysbus_init_child_obj(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit,
22
- qdev_prop_allow_set_link_before_realize,
25
sizeof(mms->iotkit), mmc->armsse_type);
23
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
26
iotkitdev = DEVICE(&mms->iotkit);
24
- &error_abort);
27
object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory),
25
- object_property_add_link(obj, "axistream-control-connected",
26
- TYPE_STREAM_SLAVE,
27
- (Object **) &s->tx_control_dev,
28
- qdev_prop_allow_set_link_before_realize,
29
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
30
- &error_abort);
31
-
32
object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),
33
TYPE_XILINX_AXI_ENET_DATA_STREAM);
34
object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),
35
@@ -XXX,XX +XXX,XX @@ static Property xilinx_enet_properties[] = {
36
DEFINE_PROP_UINT32("rxmem", XilinxAXIEnet, c_rxmem, 0x1000),
37
DEFINE_PROP_UINT32("txmem", XilinxAXIEnet, c_txmem, 0x1000),
38
DEFINE_NIC_PROPERTIES(XilinxAXIEnet, conf),
39
+ DEFINE_PROP_LINK("axistream-connected", XilinxAXIEnet,
40
+ tx_data_dev, TYPE_STREAM_SLAVE, StreamSlave *),
41
+ DEFINE_PROP_LINK("axistream-control-connected", XilinxAXIEnet,
42
+ tx_control_dev, TYPE_STREAM_SLAVE, StreamSlave *),
43
DEFINE_PROP_END_OF_LIST(),
44
};
45
46
--
28
--
47
2.7.4
29
2.20.1
48
30
49
31
diff view generated by jsdifflib
1
Make the CFSR register banked if v8M security extensions are enabled.
1
We define ARMMMUIdx_Stage2 as being an MMU index which uses a QEMU
2
2
TLB. However we never actually use the TLB -- all stage 2 lookups
3
Not all the bits in this register are banked: the BFSR
3
are done by direct calls to get_phys_addr_lpae() followed by a
4
bits [15:8] are shared between S and NS, and we store them
4
physical address load via address_space_ld*().
5
in the NS copy of the register.
5
6
Remove Stage2 from the list of ARM MMU indexes which correspond to
7
real core MMU indexes, and instead put it in the set of "NOTLB" ARM
8
MMU indexes.
9
10
This allows us to drop NB_MMU_MODES to 11. It also means we can
11
safely add support for the ARMv8.3-TTS2UXN extension, which adds
12
permission bits to the stage 2 descriptors which define execute
13
permission separatel for EL0 and EL1; supporting that while keeping
14
Stage2 in a QEMU TLB would require us to use separate TLBs for
15
"Stage2 for an EL0 access" and "Stage2 for an EL1 access", which is a
16
lot of extra complication given we aren't even using the QEMU TLB.
17
18
In the process of updating the comment on our MMU index use,
19
fix a couple of other minor errors:
20
* NS EL2 EL2&0 was missing from the list in the comment
21
* some text hadn't been updated from when we bumped NB_MMU_MODES
22
above 8
6
23
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
26
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 1503414539-28762-19-git-send-email-peter.maydell@linaro.org
27
Message-id: 20200330210400.11724-2-peter.maydell@linaro.org
10
---
28
---
11
target/arm/cpu.h | 7 ++++++-
29
target/arm/cpu-param.h | 2 +-
12
hw/intc/armv7m_nvic.c | 15 +++++++++++++--
30
target/arm/cpu.h | 21 +++++---
13
target/arm/helper.c | 18 +++++++++---------
31
target/arm/helper.c | 112 ++++-------------------------------------
14
target/arm/machine.c | 3 ++-
32
3 files changed, 27 insertions(+), 108 deletions(-)
15
4 files changed, 30 insertions(+), 13 deletions(-)
33
16
34
diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/cpu-param.h
37
+++ b/target/arm/cpu-param.h
38
@@ -XXX,XX +XXX,XX @@
39
# define TARGET_PAGE_BITS_MIN 10
40
#endif
41
42
-#define NB_MMU_MODES 12
43
+#define NB_MMU_MODES 11
44
45
#endif
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
46
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
48
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
49
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
50
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
22
uint32_t basepri[2];
51
* handling via the TLB. The only way to do a stage 1 translation without
23
uint32_t control[2];
52
* the immediate stage 2 translation is via the ATS or AT system insns,
24
uint32_t ccr[2]; /* Configuration and Control */
53
* which can be slow-pathed and always do a page table walk.
25
- uint32_t cfsr; /* Configurable Fault Status */
54
+ * The only use of stage 2 translations is either as part of an s1+2
26
+ uint32_t cfsr[2]; /* Configurable Fault Status */
55
+ * lookup or when loading the descriptors during a stage 1 page table walk,
27
uint32_t hfsr; /* HardFault Status */
56
+ * and in both those cases we don't use the TLB.
28
uint32_t dfsr; /* Debug Fault Status Register */
57
* 4. we can also safely fold together the "32 bit EL3" and "64 bit EL3"
29
uint32_t mmfar[2]; /* MemManage Fault Address */
58
* translation regimes, because they map reasonably well to each other
30
@@ -XXX,XX +XXX,XX @@ FIELD(V7M_CFSR, NOCP, 16 + 3, 1)
59
* and they can't both be active at the same time.
31
FIELD(V7M_CFSR, UNALIGNED, 16 + 8, 1)
60
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
32
FIELD(V7M_CFSR, DIVBYZERO, 16 + 9, 1)
61
* NS EL1 EL1&0 stage 1+2 (aka NS PL1)
33
62
* NS EL1 EL1&0 stage 1+2 +PAN
34
+/* V7M CFSR bit masks covering all of the subregister bits */
63
* NS EL0 EL2&0
35
+FIELD(V7M_CFSR, MMFSR, 0, 8)
64
+ * NS EL2 EL2&0
36
+FIELD(V7M_CFSR, BFSR, 8, 8)
65
* NS EL2 EL2&0 +PAN
37
+FIELD(V7M_CFSR, UFSR, 16, 16)
66
* NS EL2 (aka NS PL2)
38
+
67
* S EL0 EL1&0 (aka S PL0)
39
/* V7M HFSR bits */
68
* S EL1 EL1&0 (not used if EL3 is 32 bit)
40
FIELD(V7M_HFSR, VECTTBL, 1, 1)
69
* S EL1 EL1&0 +PAN
41
FIELD(V7M_HFSR, FORCED, 30, 1)
70
* S EL3 (aka S PL1)
42
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
71
- * NS EL1&0 stage 2
43
index XXXXXXX..XXXXXXX 100644
72
*
44
--- a/hw/intc/armv7m_nvic.c
73
- * for a total of 12 different mmu_idx.
45
+++ b/hw/intc/armv7m_nvic.c
74
+ * for a total of 11 different mmu_idx.
46
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
75
*
47
}
76
* R profile CPUs have an MPU, but can use the same set of MMU indexes
48
return val;
77
* as A profile. They only need to distinguish NS EL0 and NS EL1 (and
49
case 0xd28: /* Configurable Fault Status. */
78
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
50
- return cpu->env.v7m.cfsr;
79
* are not quite the same -- different CPU types (most notably M profile
51
+ /* The BFSR bits [15:8] are shared between security states
80
* vs A/R profile) would like to use MMU indexes with different semantics,
52
+ * and we store them in the NS copy
81
* but since we don't ever need to use all of those in a single CPU we
53
+ */
82
- * can avoid setting NB_MMU_MODES to more than 8. The lower bits of
54
+ val = cpu->env.v7m.cfsr[attrs.secure];
83
+ * can avoid having to set NB_MMU_MODES to "total number of A profile MMU
55
+ val |= cpu->env.v7m.cfsr[M_REG_NS] & R_V7M_CFSR_BFSR_MASK;
84
+ * modes + total number of M profile MMU modes". The lower bits of
56
+ return val;
85
* ARMMMUIdx are the core TLB mmu index, and the higher bits are always
57
case 0xd2c: /* Hard Fault Status. */
86
* the same for any particular CPU.
58
return cpu->env.v7m.hfsr;
87
* Variables of type ARMMUIdx are always full values, and the core
59
case 0xd30: /* Debug Fault Status. */
88
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx {
60
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
89
ARMMMUIdx_SE10_1_PAN = 9 | ARM_MMU_IDX_A,
61
nvic_irq_update(s);
90
ARMMMUIdx_SE3 = 10 | ARM_MMU_IDX_A,
62
break;
91
63
case 0xd28: /* Configurable Fault Status. */
92
- ARMMMUIdx_Stage2 = 11 | ARM_MMU_IDX_A,
64
- cpu->env.v7m.cfsr &= ~value; /* W1C */
93
-
65
+ cpu->env.v7m.cfsr[attrs.secure] &= ~value; /* W1C */
94
/*
66
+ if (attrs.secure) {
95
* These are not allocated TLBs and are used only for AT system
67
+ /* The BFSR bits [15:8] are shared between security states
96
* instructions or for the first stage of an S12 page table walk.
68
+ * and we store them in the NS copy.
97
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx {
69
+ */
98
ARMMMUIdx_Stage1_E0 = 0 | ARM_MMU_IDX_NOTLB,
70
+ cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK);
99
ARMMMUIdx_Stage1_E1 = 1 | ARM_MMU_IDX_NOTLB,
71
+ }
100
ARMMMUIdx_Stage1_E1_PAN = 2 | ARM_MMU_IDX_NOTLB,
72
break;
101
+ /*
73
case 0xd2c: /* Hard Fault Status. */
102
+ * Not allocated a TLB: used only for second stage of an S12 page
74
cpu->env.v7m.hfsr &= ~value; /* W1C */
103
+ * table walk, or for descriptor loads during first stage of an S1
104
+ * page table walk. Note that if we ever want to have a TLB for this
105
+ * then various TLB flush insns which currently are no-ops or flush
106
+ * only stage 1 MMU indexes will need to change to flush stage 2.
107
+ */
108
+ ARMMMUIdx_Stage2 = 3 | ARM_MMU_IDX_NOTLB,
109
110
/*
111
* M-profile.
112
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit {
113
TO_CORE_BIT(SE10_1),
114
TO_CORE_BIT(SE10_1_PAN),
115
TO_CORE_BIT(SE3),
116
- TO_CORE_BIT(Stage2),
117
118
TO_CORE_BIT(MUser),
119
TO_CORE_BIT(MPriv),
75
diff --git a/target/arm/helper.c b/target/arm/helper.c
120
diff --git a/target/arm/helper.c b/target/arm/helper.c
76
index XXXXXXX..XXXXXXX 100644
121
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/helper.c
122
--- a/target/arm/helper.c
78
+++ b/target/arm/helper.c
123
+++ b/target/arm/helper.c
79
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
124
@@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri,
80
/* Bad exception return: instead of popping the exception
125
tlb_flush_by_mmuidx(cs,
81
* stack, directly take a usage fault on the current stack.
126
ARMMMUIdxBit_E10_1 |
82
*/
127
ARMMMUIdxBit_E10_1_PAN |
83
- env->v7m.cfsr |= R_V7M_CFSR_INVPC_MASK;
128
- ARMMMUIdxBit_E10_0 |
84
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
129
- ARMMMUIdxBit_Stage2);
85
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
130
+ ARMMMUIdxBit_E10_0);
86
v7m_exception_taken(cpu, type | 0xf0000000);
131
}
87
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
132
88
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
133
static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
89
if (return_to_handler != arm_v7m_is_handler_mode(env)) {
134
@@ -XXX,XX +XXX,XX @@ static void tlbiall_nsnh_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
90
/* Take an INVPC UsageFault by pushing the stack again. */
135
tlb_flush_by_mmuidx_all_cpus_synced(cs,
91
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
136
ARMMMUIdxBit_E10_1 |
92
- env->v7m.cfsr |= R_V7M_CFSR_INVPC_MASK;
137
ARMMMUIdxBit_E10_1_PAN |
93
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
138
- ARMMMUIdxBit_E10_0 |
94
v7m_push_stack(cpu);
139
- ARMMMUIdxBit_Stage2);
95
v7m_exception_taken(cpu, type | 0xf0000000);
140
+ ARMMMUIdxBit_E10_0);
96
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
141
}
97
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
142
98
switch (cs->exception_index) {
143
-static void tlbiipas2_write(CPUARMState *env, const ARMCPRegInfo *ri,
99
case EXCP_UDEF:
144
- uint64_t value)
100
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
145
-{
101
- env->v7m.cfsr |= R_V7M_CFSR_UNDEFINSTR_MASK;
146
- /* Invalidate by IPA. This has to invalidate any structures that
102
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_UNDEFINSTR_MASK;
147
- * contain only stage 2 translation information, but does not need
103
break;
148
- * to apply to structures that contain combined stage 1 and stage 2
104
case EXCP_NOCP:
149
- * translation information.
105
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
150
- * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero.
106
- env->v7m.cfsr |= R_V7M_CFSR_NOCP_MASK;
151
- */
107
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_NOCP_MASK;
152
- CPUState *cs = env_cpu(env);
108
break;
153
- uint64_t pageaddr;
109
case EXCP_INVSTATE:
154
-
110
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
155
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
111
- env->v7m.cfsr |= R_V7M_CFSR_INVSTATE_MASK;
156
- return;
112
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVSTATE_MASK;
157
- }
113
break;
158
-
114
case EXCP_SWI:
159
- pageaddr = sextract64(value << 12, 0, 40);
115
/* The PC already points to the next instruction. */
160
-
116
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
161
- tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2);
117
case 0x8: /* External Abort */
162
-}
118
switch (cs->exception_index) {
163
-
119
case EXCP_PREFETCH_ABORT:
164
-static void tlbiipas2_is_write(CPUARMState *env, const ARMCPRegInfo *ri,
120
- env->v7m.cfsr |= R_V7M_CFSR_PRECISERR_MASK;
165
- uint64_t value)
121
+ env->v7m.cfsr[M_REG_NS] |= R_V7M_CFSR_PRECISERR_MASK;
166
-{
122
qemu_log_mask(CPU_LOG_INT, "...with CFSR.PRECISERR\n");
167
- CPUState *cs = env_cpu(env);
123
break;
168
- uint64_t pageaddr;
124
case EXCP_DATA_ABORT:
169
-
125
- env->v7m.cfsr |=
170
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
126
+ env->v7m.cfsr[M_REG_NS] |=
171
- return;
127
(R_V7M_CFSR_IBUSERR_MASK | R_V7M_CFSR_BFARVALID_MASK);
172
- }
128
env->v7m.bfar = env->exception.vaddress;
173
-
129
qemu_log_mask(CPU_LOG_INT,
174
- pageaddr = sextract64(value << 12, 0, 40);
130
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
175
-
131
*/
176
- tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr,
132
switch (cs->exception_index) {
177
- ARMMMUIdxBit_Stage2);
133
case EXCP_PREFETCH_ABORT:
178
-}
134
- env->v7m.cfsr |= R_V7M_CFSR_IACCVIOL_MASK;
179
135
+ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK;
180
static void tlbiall_hyp_write(CPUARMState *env, const ARMCPRegInfo *ri,
136
qemu_log_mask(CPU_LOG_INT, "...with CFSR.IACCVIOL\n");
181
uint64_t value)
137
break;
182
@@ -XXX,XX +XXX,XX @@ static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri,
138
case EXCP_DATA_ABORT:
183
tlb_flush_by_mmuidx(cs,
139
- env->v7m.cfsr |=
184
ARMMMUIdxBit_E10_1 |
140
+ env->v7m.cfsr[env->v7m.secure] |=
185
ARMMMUIdxBit_E10_1_PAN |
141
(R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK);
186
- ARMMMUIdxBit_E10_0 |
142
env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress;
187
- ARMMMUIdxBit_Stage2);
143
qemu_log_mask(CPU_LOG_INT,
188
+ ARMMMUIdxBit_E10_0);
144
diff --git a/target/arm/machine.c b/target/arm/machine.c
189
raw_write(env, ri, value);
145
index XXXXXXX..XXXXXXX 100644
146
--- a/target/arm/machine.c
147
+++ b/target/arm/machine.c
148
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
149
VMSTATE_UINT32(env.v7m.basepri[M_REG_NS], ARMCPU),
150
VMSTATE_UINT32(env.v7m.control[M_REG_NS], ARMCPU),
151
VMSTATE_UINT32(env.v7m.ccr[M_REG_NS], ARMCPU),
152
- VMSTATE_UINT32(env.v7m.cfsr, ARMCPU),
153
+ VMSTATE_UINT32(env.v7m.cfsr[M_REG_NS], ARMCPU),
154
VMSTATE_UINT32(env.v7m.hfsr, ARMCPU),
155
VMSTATE_UINT32(env.v7m.dfsr, ARMCPU),
156
VMSTATE_UINT32(env.v7m.mmfar[M_REG_NS], ARMCPU),
157
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
158
VMSTATE_UINT32(env.v7m.mpu_ctrl[M_REG_S], ARMCPU),
159
VMSTATE_UINT32(env.v7m.ccr[M_REG_S], ARMCPU),
160
VMSTATE_UINT32(env.v7m.mmfar[M_REG_S], ARMCPU),
161
+ VMSTATE_UINT32(env.v7m.cfsr[M_REG_S], ARMCPU),
162
VMSTATE_END_OF_LIST()
163
}
190
}
164
};
191
}
192
@@ -XXX,XX +XXX,XX @@ static int alle1_tlbmask(CPUARMState *env)
193
return ARMMMUIdxBit_SE10_1 |
194
ARMMMUIdxBit_SE10_1_PAN |
195
ARMMMUIdxBit_SE10_0;
196
- } else if (arm_feature(env, ARM_FEATURE_EL2)) {
197
- return ARMMMUIdxBit_E10_1 |
198
- ARMMMUIdxBit_E10_1_PAN |
199
- ARMMMUIdxBit_E10_0 |
200
- ARMMMUIdxBit_Stage2;
201
} else {
202
return ARMMMUIdxBit_E10_1 |
203
ARMMMUIdxBit_E10_1_PAN |
204
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae3is_write(CPUARMState *env, const ARMCPRegInfo *ri,
205
ARMMMUIdxBit_SE3);
206
}
207
208
-static void tlbi_aa64_ipas2e1_write(CPUARMState *env, const ARMCPRegInfo *ri,
209
- uint64_t value)
210
-{
211
- /* Invalidate by IPA. This has to invalidate any structures that
212
- * contain only stage 2 translation information, but does not need
213
- * to apply to structures that contain combined stage 1 and stage 2
214
- * translation information.
215
- * This must NOP if EL2 isn't implemented or SCR_EL3.NS is zero.
216
- */
217
- ARMCPU *cpu = env_archcpu(env);
218
- CPUState *cs = CPU(cpu);
219
- uint64_t pageaddr;
220
-
221
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
222
- return;
223
- }
224
-
225
- pageaddr = sextract64(value << 12, 0, 48);
226
-
227
- tlb_flush_page_by_mmuidx(cs, pageaddr, ARMMMUIdxBit_Stage2);
228
-}
229
-
230
-static void tlbi_aa64_ipas2e1is_write(CPUARMState *env, const ARMCPRegInfo *ri,
231
- uint64_t value)
232
-{
233
- CPUState *cs = env_cpu(env);
234
- uint64_t pageaddr;
235
-
236
- if (!arm_feature(env, ARM_FEATURE_EL2) || !(env->cp15.scr_el3 & SCR_NS)) {
237
- return;
238
- }
239
-
240
- pageaddr = sextract64(value << 12, 0, 48);
241
-
242
- tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr,
243
- ARMMMUIdxBit_Stage2);
244
-}
245
-
246
static CPAccessResult aa64_zva_access(CPUARMState *env, const ARMCPRegInfo *ri,
247
bool isread)
248
{
249
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
250
.writefn = tlbi_aa64_vae1_write },
251
{ .name = "TLBI_IPAS2E1IS", .state = ARM_CP_STATE_AA64,
252
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1,
253
- .access = PL2_W, .type = ARM_CP_NO_RAW,
254
- .writefn = tlbi_aa64_ipas2e1is_write },
255
+ .access = PL2_W, .type = ARM_CP_NOP },
256
{ .name = "TLBI_IPAS2LE1IS", .state = ARM_CP_STATE_AA64,
257
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5,
258
- .access = PL2_W, .type = ARM_CP_NO_RAW,
259
- .writefn = tlbi_aa64_ipas2e1is_write },
260
+ .access = PL2_W, .type = ARM_CP_NOP },
261
{ .name = "TLBI_ALLE1IS", .state = ARM_CP_STATE_AA64,
262
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 4,
263
.access = PL2_W, .type = ARM_CP_NO_RAW,
264
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
265
.writefn = tlbi_aa64_alle1is_write },
266
{ .name = "TLBI_IPAS2E1", .state = ARM_CP_STATE_AA64,
267
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1,
268
- .access = PL2_W, .type = ARM_CP_NO_RAW,
269
- .writefn = tlbi_aa64_ipas2e1_write },
270
+ .access = PL2_W, .type = ARM_CP_NOP },
271
{ .name = "TLBI_IPAS2LE1", .state = ARM_CP_STATE_AA64,
272
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5,
273
- .access = PL2_W, .type = ARM_CP_NO_RAW,
274
- .writefn = tlbi_aa64_ipas2e1_write },
275
+ .access = PL2_W, .type = ARM_CP_NOP },
276
{ .name = "TLBI_ALLE1", .state = ARM_CP_STATE_AA64,
277
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 4,
278
.access = PL2_W, .type = ARM_CP_NO_RAW,
279
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
280
.writefn = tlbimva_hyp_is_write },
281
{ .name = "TLBIIPAS2",
282
.cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 1,
283
- .type = ARM_CP_NO_RAW, .access = PL2_W,
284
- .writefn = tlbiipas2_write },
285
+ .type = ARM_CP_NOP, .access = PL2_W },
286
{ .name = "TLBIIPAS2IS",
287
.cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 1,
288
- .type = ARM_CP_NO_RAW, .access = PL2_W,
289
- .writefn = tlbiipas2_is_write },
290
+ .type = ARM_CP_NOP, .access = PL2_W },
291
{ .name = "TLBIIPAS2L",
292
.cp = 15, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 5,
293
- .type = ARM_CP_NO_RAW, .access = PL2_W,
294
- .writefn = tlbiipas2_write },
295
+ .type = ARM_CP_NOP, .access = PL2_W },
296
{ .name = "TLBIIPAS2LIS",
297
.cp = 15, .opc1 = 4, .crn = 8, .crm = 0, .opc2 = 5,
298
- .type = ARM_CP_NO_RAW, .access = PL2_W,
299
- .writefn = tlbiipas2_is_write },
300
+ .type = ARM_CP_NOP, .access = PL2_W },
301
/* 32 bit cache operations */
302
{ .name = "ICIALLUIS", .cp = 15, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0,
303
.type = ARM_CP_NOP, .access = PL1_W, .accessfn = aa64_cacheop_pou_access },
165
--
304
--
166
2.7.4
305
2.20.1
167
306
168
307
diff view generated by jsdifflib
1
Make the MMFAR register banked if v8M security extensions are
1
The access_type argument to get_phys_addr_lpae() is an MMUAccessType;
2
enabled.
2
use the enum constant MMU_DATA_LOAD rather than a literal 0 when we
3
call it in S1_ptw_translate().
3
4
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 1503414539-28762-18-git-send-email-peter.maydell@linaro.org
8
Message-id: 20200330210400.11724-3-peter.maydell@linaro.org
7
---
9
---
8
target/arm/cpu.h | 2 +-
10
target/arm/helper.c | 5 +++--
9
hw/intc/armv7m_nvic.c | 4 ++--
11
1 file changed, 3 insertions(+), 2 deletions(-)
10
target/arm/helper.c | 4 ++--
11
target/arm/machine.c | 3 ++-
12
4 files changed, 7 insertions(+), 6 deletions(-)
13
12
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
19
uint32_t cfsr; /* Configurable Fault Status */
20
uint32_t hfsr; /* HardFault Status */
21
uint32_t dfsr; /* Debug Fault Status Register */
22
- uint32_t mmfar; /* MemManage Fault Address */
23
+ uint32_t mmfar[2]; /* MemManage Fault Address */
24
uint32_t bfar; /* BusFault Address */
25
unsigned mpu_ctrl[2]; /* MPU_CTRL */
26
int exception;
27
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/intc/armv7m_nvic.c
30
+++ b/hw/intc/armv7m_nvic.c
31
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
32
case 0xd30: /* Debug Fault Status. */
33
return cpu->env.v7m.dfsr;
34
case 0xd34: /* MMFAR MemManage Fault Address */
35
- return cpu->env.v7m.mmfar;
36
+ return cpu->env.v7m.mmfar[attrs.secure];
37
case 0xd38: /* Bus Fault Address. */
38
return cpu->env.v7m.bfar;
39
case 0xd3c: /* Aux Fault Status. */
40
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
41
cpu->env.v7m.dfsr &= ~value; /* W1C */
42
break;
43
case 0xd34: /* Mem Manage Address. */
44
- cpu->env.v7m.mmfar = value;
45
+ cpu->env.v7m.mmfar[attrs.secure] = value;
46
return;
47
case 0xd38: /* Bus Fault Address. */
48
cpu->env.v7m.bfar = value;
49
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
50
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/helper.c
15
--- a/target/arm/helper.c
52
+++ b/target/arm/helper.c
16
+++ b/target/arm/helper.c
53
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
17
@@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
54
case EXCP_DATA_ABORT:
18
pcacheattrs = &cacheattrs;
55
env->v7m.cfsr |=
19
}
56
(R_V7M_CFSR_DACCVIOL_MASK | R_V7M_CFSR_MMARVALID_MASK);
20
57
- env->v7m.mmfar = env->exception.vaddress;
21
- ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_Stage2, &s2pa,
58
+ env->v7m.mmfar[env->v7m.secure] = env->exception.vaddress;
22
- &txattrs, &s2prot, &s2size, fi, pcacheattrs);
59
qemu_log_mask(CPU_LOG_INT,
23
+ ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2,
60
"...with CFSR.DACCVIOL and MMFAR 0x%x\n",
24
+ &s2pa, &txattrs, &s2prot, &s2size, fi,
61
- env->v7m.mmfar);
25
+ pcacheattrs);
62
+ env->v7m.mmfar[env->v7m.secure]);
26
if (ret) {
63
break;
27
assert(fi->type != ARMFault_None);
64
}
28
fi->s2addr = addr;
65
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM);
66
diff --git a/target/arm/machine.c b/target/arm/machine.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/machine.c
69
+++ b/target/arm/machine.c
70
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
71
VMSTATE_UINT32(env.v7m.cfsr, ARMCPU),
72
VMSTATE_UINT32(env.v7m.hfsr, ARMCPU),
73
VMSTATE_UINT32(env.v7m.dfsr, ARMCPU),
74
- VMSTATE_UINT32(env.v7m.mmfar, ARMCPU),
75
+ VMSTATE_UINT32(env.v7m.mmfar[M_REG_NS], ARMCPU),
76
VMSTATE_UINT32(env.v7m.bfar, ARMCPU),
77
VMSTATE_UINT32(env.v7m.mpu_ctrl[M_REG_NS], ARMCPU),
78
VMSTATE_INT32(env.v7m.exception, ARMCPU),
79
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
80
VMSTATE_VALIDATE("secure MPU_RNR is valid", s_rnr_vmstate_validate),
81
VMSTATE_UINT32(env.v7m.mpu_ctrl[M_REG_S], ARMCPU),
82
VMSTATE_UINT32(env.v7m.ccr[M_REG_S], ARMCPU),
83
+ VMSTATE_UINT32(env.v7m.mmfar[M_REG_S], ARMCPU),
84
VMSTATE_END_OF_LIST()
85
}
86
};
87
--
29
--
88
2.7.4
30
2.20.1
89
31
90
32
diff view generated by jsdifflib
1
Make the MPU_CTRL register banked if v8M security extensions are
1
For ARMv8.2-TTS2UXN, the stage 2 page table walk wants to know
2
enabled.
2
whether the stage 1 access is for EL0 or not, because whether
3
exec permission is given can depend on whether this is an EL0
4
or EL1 access. Add a new argument to get_phys_addr_lpae() so
5
the call sites can pass this information in.
6
7
Since get_phys_addr_lpae() doesn't already have a doc comment,
8
add one so we have a place to put the documentation of the
9
semantics of the new s1_is_el0 argument.
3
10
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 1503414539-28762-16-git-send-email-peter.maydell@linaro.org
14
Message-id: 20200330210400.11724-4-peter.maydell@linaro.org
7
---
15
---
8
target/arm/cpu.h | 2 +-
16
target/arm/helper.c | 29 ++++++++++++++++++++++++++++-
9
hw/intc/armv7m_nvic.c | 9 +++++----
17
1 file changed, 28 insertions(+), 1 deletion(-)
10
target/arm/helper.c | 5 +++--
11
target/arm/machine.c | 3 ++-
12
4 files changed, 11 insertions(+), 8 deletions(-)
13
18
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
19
uint32_t dfsr; /* Debug Fault Status Register */
20
uint32_t mmfar; /* MemManage Fault Address */
21
uint32_t bfar; /* BusFault Address */
22
- unsigned mpu_ctrl; /* MPU_CTRL */
23
+ unsigned mpu_ctrl[2]; /* MPU_CTRL */
24
int exception;
25
uint32_t primask[2];
26
uint32_t faultmask[2];
27
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/intc/armv7m_nvic.c
30
+++ b/hw/intc/armv7m_nvic.c
31
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
32
return cpu->pmsav7_dregion << 8;
33
break;
34
case 0xd94: /* MPU_CTRL */
35
- return cpu->env.v7m.mpu_ctrl;
36
+ return cpu->env.v7m.mpu_ctrl[attrs.secure];
37
case 0xd98: /* MPU_RNR */
38
return cpu->env.pmsav7.rnr[attrs.secure];
39
case 0xd9c: /* MPU_RBAR */
40
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
41
qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is "
42
"UNPREDICTABLE\n");
43
}
44
- cpu->env.v7m.mpu_ctrl = value & (R_V7M_MPU_CTRL_ENABLE_MASK |
45
- R_V7M_MPU_CTRL_HFNMIENA_MASK |
46
- R_V7M_MPU_CTRL_PRIVDEFENA_MASK);
47
+ cpu->env.v7m.mpu_ctrl[attrs.secure]
48
+ = value & (R_V7M_MPU_CTRL_ENABLE_MASK |
49
+ R_V7M_MPU_CTRL_HFNMIENA_MASK |
50
+ R_V7M_MPU_CTRL_PRIVDEFENA_MASK);
51
tlb_flush(CPU(cpu));
52
break;
53
case 0xd98: /* MPU_RNR */
54
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
diff --git a/target/arm/helper.c b/target/arm/helper.c
55
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/helper.c
21
--- a/target/arm/helper.c
57
+++ b/target/arm/helper.c
22
+++ b/target/arm/helper.c
58
@@ -XXX,XX +XXX,XX @@ static inline bool regime_translation_disabled(CPUARMState *env,
23
@@ -XXX,XX +XXX,XX @@
59
ARMMMUIdx mmu_idx)
24
60
{
25
static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
61
if (arm_feature(env, ARM_FEATURE_M)) {
26
MMUAccessType access_type, ARMMMUIdx mmu_idx,
62
- switch (env->v7m.mpu_ctrl &
27
+ bool s1_is_el0,
63
+ switch (env->v7m.mpu_ctrl[regime_is_secure(env, mmu_idx)] &
28
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
64
(R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK)) {
29
target_ulong *page_size_ptr,
65
case R_V7M_MPU_CTRL_ENABLE_MASK:
30
ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs);
66
/* Enabled, but not for HardFault and NMI */
31
@@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx,
67
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu,
32
}
33
34
ret = get_phys_addr_lpae(env, addr, MMU_DATA_LOAD, ARMMMUIdx_Stage2,
35
+ false,
36
&s2pa, &txattrs, &s2prot, &s2size, fi,
37
pcacheattrs);
38
if (ret) {
39
@@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va,
40
};
41
}
42
43
+/**
44
+ * get_phys_addr_lpae: perform one stage of page table walk, LPAE format
45
+ *
46
+ * Returns false if the translation was successful. Otherwise, phys_ptr, attrs,
47
+ * prot and page_size may not be filled in, and the populated fsr value provides
48
+ * information on why the translation aborted, in the format of a long-format
49
+ * DFSR/IFSR fault register, with the following caveats:
50
+ * * the WnR bit is never set (the caller must do this).
51
+ *
52
+ * @env: CPUARMState
53
+ * @address: virtual address to get physical address for
54
+ * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH
55
+ * @mmu_idx: MMU index indicating required translation regime
56
+ * @s1_is_el0: if @mmu_idx is ARMMMUIdx_Stage2 (so this is a stage 2 page table
57
+ * walk), must be true if this is stage 2 of a stage 1+2 walk for an
58
+ * EL0 access). If @mmu_idx is anything else, @s1_is_el0 is ignored.
59
+ * @phys_ptr: set to the physical address corresponding to the virtual address
60
+ * @attrs: set to the memory transaction attributes to use
61
+ * @prot: set to the permissions for the page containing phys_ptr
62
+ * @page_size_ptr: set to the size of the page containing phys_ptr
63
+ * @fi: set to fault info if the translation fails
64
+ * @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes
65
+ */
66
static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
67
MMUAccessType access_type, ARMMMUIdx mmu_idx,
68
+ bool s1_is_el0,
69
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
70
target_ulong *page_size_ptr,
71
ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs)
72
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
73
74
/* S1 is done. Now do S2 translation. */
75
ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_Stage2,
76
+ mmu_idx == ARMMMUIdx_E10_0,
77
phys_ptr, attrs, &s2_prot,
78
page_size, fi,
79
cacheattrs != NULL ? &cacheattrs2 : NULL);
80
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
68
}
81
}
69
82
70
if (arm_feature(env, ARM_FEATURE_M)) {
83
if (regime_using_lpae_format(env, mmu_idx)) {
71
- return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK;
84
- return get_phys_addr_lpae(env, address, access_type, mmu_idx,
72
+ return env->v7m.mpu_ctrl[regime_is_secure(env, mmu_idx)]
85
+ return get_phys_addr_lpae(env, address, access_type, mmu_idx, false,
73
+ & R_V7M_MPU_CTRL_PRIVDEFENA_MASK;
86
phys_ptr, attrs, prot, page_size,
74
} else {
87
fi, cacheattrs);
75
return regime_sctlr(env, mmu_idx) & SCTLR_BR;
88
} else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) {
76
}
77
diff --git a/target/arm/machine.c b/target/arm/machine.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/target/arm/machine.c
80
+++ b/target/arm/machine.c
81
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
82
VMSTATE_UINT32(env.v7m.dfsr, ARMCPU),
83
VMSTATE_UINT32(env.v7m.mmfar, ARMCPU),
84
VMSTATE_UINT32(env.v7m.bfar, ARMCPU),
85
- VMSTATE_UINT32(env.v7m.mpu_ctrl, ARMCPU),
86
+ VMSTATE_UINT32(env.v7m.mpu_ctrl[M_REG_NS], ARMCPU),
87
VMSTATE_INT32(env.v7m.exception, ARMCPU),
88
VMSTATE_END_OF_LIST()
89
},
90
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
91
0, vmstate_info_uint32, uint32_t),
92
VMSTATE_UINT32(env.pmsav7.rnr[M_REG_S], ARMCPU),
93
VMSTATE_VALIDATE("secure MPU_RNR is valid", s_rnr_vmstate_validate),
94
+ VMSTATE_UINT32(env.v7m.mpu_ctrl[M_REG_S], ARMCPU),
95
VMSTATE_END_OF_LIST()
96
}
97
};
98
--
89
--
99
2.7.4
90
2.20.1
100
91
101
92
diff view generated by jsdifflib
1
Make the CCR register banked if v8M security extensions are enabled.
1
The ARMv8.2-TTS2UXN feature extends the XN field in stage 2
2
2
translation table descriptors from just bit [54] to bits [54:53],
3
This is slightly more complicated than the other "add banking"
3
allowing stage 2 to control execution permissions separately for EL0
4
patches because there is one bit in the register which is not
4
and EL1. Implement the new semantics of the XN field and enable
5
banked. We keep the live data in the NS copy of the register,
5
the feature for our 'max' CPU.
6
and adjust it on register reads and writes. (Since we don't
7
currently implement the behaviour that the bit controls, there
8
is nowhere else that needs to care.)
9
10
This patch includes the enforcement of the bits which are newly
11
RES1 in ARMv8M.
12
6
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Message-id: 1503414539-28762-17-git-send-email-peter.maydell@linaro.org
8
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20200330210400.11724-5-peter.maydell@linaro.org
15
---
11
---
16
target/arm/cpu.h | 2 +-
12
target/arm/cpu.h | 15 +++++++++++++++
17
hw/intc/armv7m_nvic.c | 33 +++++++++++++++++++++++++++------
13
target/arm/cpu.c | 1 +
18
target/arm/cpu.c | 12 +++++++++---
14
target/arm/cpu64.c | 2 ++
19
target/arm/helper.c | 5 +++--
15
target/arm/helper.c | 37 +++++++++++++++++++++++++++++++------
20
target/arm/machine.c | 3 ++-
16
4 files changed, 49 insertions(+), 6 deletions(-)
21
5 files changed, 42 insertions(+), 13 deletions(-)
22
17
23
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/cpu.h
20
--- a/target/arm/cpu.h
26
+++ b/target/arm/cpu.h
21
+++ b/target/arm/cpu.h
27
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
22
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id)
28
uint32_t vecbase[2];
23
return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0;
29
uint32_t basepri[2];
24
}
30
uint32_t control[2];
25
31
- uint32_t ccr; /* Configuration and Control */
26
+static inline bool isar_feature_aa32_tts2uxn(const ARMISARegisters *id)
32
+ uint32_t ccr[2]; /* Configuration and Control */
27
+{
33
uint32_t cfsr; /* Configurable Fault Status */
28
+ return FIELD_EX32(id->id_mmfr4, ID_MMFR4, XNX) != 0;
34
uint32_t hfsr; /* HardFault Status */
29
+}
35
uint32_t dfsr; /* Debug Fault Status Register */
36
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/intc/armv7m_nvic.c
39
+++ b/hw/intc/armv7m_nvic.c
40
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
41
/* TODO: Implement SLEEPONEXIT. */
42
return 0;
43
case 0xd14: /* Configuration Control. */
44
- return cpu->env.v7m.ccr;
45
+ /* The BFHFNMIGN bit is the only non-banked bit; we
46
+ * keep it in the non-secure copy of the register.
47
+ */
48
+ val = cpu->env.v7m.ccr[attrs.secure];
49
+ val |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
50
+ return val;
51
case 0xd24: /* System Handler Status. */
52
val = 0;
53
if (s->vectors[ARMV7M_EXCP_MEM].active) {
54
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
55
R_V7M_CCR_USERSETMPEND_MASK |
56
R_V7M_CCR_NONBASETHRDENA_MASK);
57
58
- cpu->env.v7m.ccr = value;
59
+ if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
60
+ /* v8M makes NONBASETHRDENA and STKALIGN be RES1 */
61
+ value |= R_V7M_CCR_NONBASETHRDENA_MASK
62
+ | R_V7M_CCR_STKALIGN_MASK;
63
+ }
64
+ if (attrs.secure) {
65
+ /* the BFHFNMIGN bit is not banked; keep that in the NS copy */
66
+ cpu->env.v7m.ccr[M_REG_NS] =
67
+ (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK)
68
+ | (value & R_V7M_CCR_BFHFNMIGN_MASK);
69
+ value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
70
+ }
71
+
30
+
72
+ cpu->env.v7m.ccr[attrs.secure] = value;
31
/*
73
break;
32
* 64-bit feature tests via id registers.
74
case 0xd24: /* System Handler Control. */
33
*/
75
s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0;
34
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id)
76
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
35
return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0;
77
}
78
}
36
}
79
37
80
-static bool nvic_user_access_ok(NVICState *s, hwaddr offset)
38
+static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id)
81
+static bool nvic_user_access_ok(NVICState *s, hwaddr offset, MemTxAttrs attrs)
39
+{
82
{
40
+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0;
83
/* Return true if unprivileged access to this register is permitted. */
41
+}
84
switch (offset) {
42
+
85
case 0xf00: /* STIR: accessible only if CCR.USERSETMPEND permits */
43
/*
86
- return s->cpu->env.v7m.ccr & R_V7M_CCR_USERSETMPEND_MASK;
44
* Feature tests for "does this exist in either 32-bit or 64-bit?"
87
+ /* For access via STIR_NS it is the NS CCR.USERSETMPEND that
45
*/
88
+ * controls access even though the CPU is in Secure state (I_QDKX).
46
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_ccidx(const ARMISARegisters *id)
89
+ */
47
return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id);
90
+ return s->cpu->env.v7m.ccr[attrs.secure] & R_V7M_CCR_USERSETMPEND_MASK;
48
}
91
default:
49
92
/* All other user accesses cause a BusFault unconditionally */
50
+static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id)
93
return false;
51
+{
94
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
52
+ return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id);
95
unsigned i, startvec, end;
53
+}
96
uint32_t val;
54
+
97
55
/*
98
- if (attrs.user && !nvic_user_access_ok(s, addr)) {
56
* Forward to the above feature tests given an ARMCPU pointer.
99
+ if (attrs.user && !nvic_user_access_ok(s, addr, attrs)) {
57
*/
100
/* Generate BusFault for unprivileged accesses */
101
return MEMTX_ERROR;
102
}
103
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
104
105
trace_nvic_sysreg_write(addr, value, size);
106
107
- if (attrs.user && !nvic_user_access_ok(s, addr)) {
108
+ if (attrs.user && !nvic_user_access_ok(s, addr, attrs)) {
109
/* Generate BusFault for unprivileged accesses */
110
return MEMTX_ERROR;
111
}
112
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
58
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
113
index XXXXXXX..XXXXXXX 100644
59
index XXXXXXX..XXXXXXX 100644
114
--- a/target/arm/cpu.c
60
--- a/target/arm/cpu.c
115
+++ b/target/arm/cpu.c
61
+++ b/target/arm/cpu.c
116
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
62
@@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj)
117
env->v7m.secure = true;
63
t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
64
t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
65
t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
66
+ t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
67
cpu->isar.id_mmfr4 = t;
118
}
68
}
119
69
#endif
120
- /* The reset value of this bit is IMPDEF, but ARM recommends
70
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
121
+ /* In v7M the reset value of this bit is IMPDEF, but ARM recommends
71
index XXXXXXX..XXXXXXX 100644
122
* that it resets to 1, so QEMU always does that rather than making
72
--- a/target/arm/cpu64.c
123
- * it dependent on CPU model.
73
+++ b/target/arm/cpu64.c
124
+ * it dependent on CPU model. In v8M it is RES1.
74
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
125
*/
75
t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
126
- env->v7m.ccr = R_V7M_CCR_STKALIGN_MASK;
76
t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
127
+ env->v7m.ccr[M_REG_NS] = R_V7M_CCR_STKALIGN_MASK;
77
t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
128
+ env->v7m.ccr[M_REG_S] = R_V7M_CCR_STKALIGN_MASK;
78
+ t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
129
+ if (arm_feature(env, ARM_FEATURE_V8)) {
79
cpu->isar.id_aa64mmfr1 = t;
130
+ /* in v8M the NONBASETHRDENA bit [0] is RES1 */
80
131
+ env->v7m.ccr[M_REG_NS] |= R_V7M_CCR_NONBASETHRDENA_MASK;
81
t = cpu->isar.id_aa64mmfr2;
132
+ env->v7m.ccr[M_REG_S] |= R_V7M_CCR_NONBASETHRDENA_MASK;
82
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
133
+ }
83
u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
134
84
u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
135
/* Unlike A/R profile, M profile defines the reset LR value */
85
u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
136
env->regs[14] = 0xffffffff;
86
+ u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
87
cpu->isar.id_mmfr4 = u;
88
89
u = cpu->isar.id_aa64dfr0;
137
diff --git a/target/arm/helper.c b/target/arm/helper.c
90
diff --git a/target/arm/helper.c b/target/arm/helper.c
138
index XXXXXXX..XXXXXXX 100644
91
index XXXXXXX..XXXXXXX 100644
139
--- a/target/arm/helper.c
92
--- a/target/arm/helper.c
140
+++ b/target/arm/helper.c
93
+++ b/target/arm/helper.c
141
@@ -XXX,XX +XXX,XX @@ static void v7m_push_stack(ARMCPU *cpu)
94
@@ -XXX,XX +XXX,XX @@ simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap)
142
uint32_t xpsr = xpsr_read(env);
95
*
143
96
* @env: CPUARMState
144
/* Align stack pointer if the guest wants that */
97
* @s2ap: The 2-bit stage2 access permissions (S2AP)
145
- if ((env->regs[13] & 4) && (env->v7m.ccr & R_V7M_CCR_STKALIGN_MASK)) {
98
- * @xn: XN (execute-never) bit
146
+ if ((env->regs[13] & 4) &&
99
+ * @xn: XN (execute-never) bits
147
+ (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKALIGN_MASK)) {
100
+ * @s1_is_el0: true if this is S2 of an S1+2 walk for EL0
148
env->regs[13] -= 4;
101
*/
149
xpsr |= XPSR_SPREALIGN;
102
-static int get_S2prot(CPUARMState *env, int s2ap, int xn)
103
+static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0)
104
{
105
int prot = 0;
106
107
@@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn)
108
if (s2ap & 2) {
109
prot |= PAGE_WRITE;
150
}
110
}
151
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
111
- if (!xn) {
152
/* fall through */
112
- if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) {
153
case 9: /* Return to Thread using Main stack */
113
+
154
if (!rettobase &&
114
+ if (cpu_isar_feature(any_tts2uxn, env_archcpu(env))) {
155
- !(env->v7m.ccr & R_V7M_CCR_NONBASETHRDENA_MASK)) {
115
+ switch (xn) {
156
+ !(env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_NONBASETHRDENA_MASK)) {
116
+ case 0:
157
ufault = true;
117
prot |= PAGE_EXEC;
118
+ break;
119
+ case 1:
120
+ if (s1_is_el0) {
121
+ prot |= PAGE_EXEC;
122
+ }
123
+ break;
124
+ case 2:
125
+ break;
126
+ case 3:
127
+ if (!s1_is_el0) {
128
+ prot |= PAGE_EXEC;
129
+ }
130
+ break;
131
+ default:
132
+ g_assert_not_reached();
133
+ }
134
+ } else {
135
+ if (!extract32(xn, 1, 1)) {
136
+ if (arm_el_is_aa64(env, 2) || prot & PAGE_READ) {
137
+ prot |= PAGE_EXEC;
138
+ }
158
}
139
}
159
break;
160
diff --git a/target/arm/machine.c b/target/arm/machine.c
161
index XXXXXXX..XXXXXXX 100644
162
--- a/target/arm/machine.c
163
+++ b/target/arm/machine.c
164
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
165
VMSTATE_UINT32(env.v7m.vecbase[M_REG_NS], ARMCPU),
166
VMSTATE_UINT32(env.v7m.basepri[M_REG_NS], ARMCPU),
167
VMSTATE_UINT32(env.v7m.control[M_REG_NS], ARMCPU),
168
- VMSTATE_UINT32(env.v7m.ccr, ARMCPU),
169
+ VMSTATE_UINT32(env.v7m.ccr[M_REG_NS], ARMCPU),
170
VMSTATE_UINT32(env.v7m.cfsr, ARMCPU),
171
VMSTATE_UINT32(env.v7m.hfsr, ARMCPU),
172
VMSTATE_UINT32(env.v7m.dfsr, ARMCPU),
173
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
174
VMSTATE_UINT32(env.pmsav7.rnr[M_REG_S], ARMCPU),
175
VMSTATE_VALIDATE("secure MPU_RNR is valid", s_rnr_vmstate_validate),
176
VMSTATE_UINT32(env.v7m.mpu_ctrl[M_REG_S], ARMCPU),
177
+ VMSTATE_UINT32(env.v7m.ccr[M_REG_S], ARMCPU),
178
VMSTATE_END_OF_LIST()
179
}
140
}
180
};
141
return prot;
142
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
143
}
144
145
ap = extract32(attrs, 4, 2);
146
- xn = extract32(attrs, 12, 1);
147
148
if (mmu_idx == ARMMMUIdx_Stage2) {
149
ns = true;
150
- *prot = get_S2prot(env, ap, xn);
151
+ xn = extract32(attrs, 11, 2);
152
+ *prot = get_S2prot(env, ap, xn, s1_is_el0);
153
} else {
154
ns = extract32(attrs, 3, 1);
155
+ xn = extract32(attrs, 12, 1);
156
pxn = extract32(attrs, 11, 1);
157
*prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn);
158
}
181
--
159
--
182
2.7.4
160
2.20.1
183
161
184
162
diff view generated by jsdifflib
New patch
1
In aarch64_max_initfn() we update both 32-bit and 64-bit ID
2
registers. The intended pattern is that for 64-bit ID registers we
3
use FIELD_DP64 and the uint64_t 't' register, while 32-bit ID
4
registers use FIELD_DP32 and the uint32_t 'u' register. For
5
ID_AA64DFR0 we accidentally used 'u', meaning that the top 32 bits of
6
this 64-bit ID register would end up always zero. Luckily at the
7
moment that's what they should be anyway, so this bug has no visible
8
effects.
1
9
10
Use the right-sized variable.
11
12
Fixes: 3bec78447a958d481991
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Message-id: 20200423110915.10527-1-peter.maydell@linaro.org
17
---
18
target/arm/cpu64.c | 6 +++---
19
1 file changed, 3 insertions(+), 3 deletions(-)
20
21
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu64.c
24
+++ b/target/arm/cpu64.c
25
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
26
u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
27
cpu->isar.id_mmfr4 = u;
28
29
- u = cpu->isar.id_aa64dfr0;
30
- u = FIELD_DP64(u, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
31
- cpu->isar.id_aa64dfr0 = u;
32
+ t = cpu->isar.id_aa64dfr0;
33
+ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
34
+ cpu->isar.id_aa64dfr0 = t;
35
36
u = cpu->isar.id_dfr0;
37
u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
38
--
39
2.20.1
40
41
diff view generated by jsdifflib
1
From: Portia Stephens <portia.stephens@xilinx.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
This adds a feature bit indicating support of the (trivial) Jazelle
3
MIDR_EL1 is a 64-bit system register with the top 32-bit being RES0.
4
implementation if ARM_FEATURE_V6 is set or if the processor is arm926
4
Represent it in QEMU's ARMCPU struct with a uint64_t, not a
5
or arm1026. This fixes the issue that any BXJ instruction will
5
uint32_t.
6
result in an illegal_op. BXJ instructions will now check if the
7
architecture supports ARM_FEATURE_JAZELLE.
8
6
9
Signed-off-by: Portia Stephens <portia.stephens@xilinx.com>
7
This fixes an error when compiling with -Werror=conversion
10
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
8
because we were manipulating the register value using a
11
Message-id: 20170905211232.11092-1-portia.stephens@xilinx.com
9
local uint64_t variable:
12
[PMM: edited commit message and comment text a bit]
10
11
target/arm/cpu64.c: In function ‘aarch64_max_initfn’:
12
target/arm/cpu64.c:628:21: error: conversion from ‘uint64_t’ {aka ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} may change value [-Werror=conversion]
13
628 | cpu->midr = t;
14
| ^
15
16
and future-proofs us against a possible future architecture
17
change using some of the top 32 bits.
18
19
Suggested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
20
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
22
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
23
Message-id: 20200428172634.29707-1-f4bug@amsat.org
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
24
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
26
---
16
target/arm/cpu.h | 1 +
27
target/arm/cpu.h | 2 +-
17
target/arm/cpu.c | 3 +++
28
target/arm/cpu.c | 2 +-
18
target/arm/translate.c | 2 +-
29
2 files changed, 2 insertions(+), 2 deletions(-)
19
3 files changed, 5 insertions(+), 1 deletion(-)
20
30
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
31
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
22
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.h
33
--- a/target/arm/cpu.h
24
+++ b/target/arm/cpu.h
34
+++ b/target/arm/cpu.h
25
@@ -XXX,XX +XXX,XX @@ enum arm_features {
35
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
26
ARM_FEATURE_PMU, /* has PMU support */
36
uint64_t id_aa64dfr0;
27
ARM_FEATURE_VBAR, /* has cp15 VBAR */
37
uint64_t id_aa64dfr1;
28
ARM_FEATURE_M_SECURITY, /* M profile Security Extension */
38
} isar;
29
+ ARM_FEATURE_JAZELLE, /* has (trivial) Jazelle implementation */
39
- uint32_t midr;
30
};
40
+ uint64_t midr;
31
41
uint32_t revidr;
32
static inline int arm_feature(CPUARMState *env, int feature)
42
uint32_t reset_fpsid;
43
uint32_t ctr;
33
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
44
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
34
index XXXXXXX..XXXXXXX 100644
45
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/cpu.c
46
--- a/target/arm/cpu.c
36
+++ b/target/arm/cpu.c
47
+++ b/target/arm/cpu.c
37
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
48
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_cpus[] = {
38
}
49
static Property arm_cpu_properties[] = {
39
if (arm_feature(env, ARM_FEATURE_V6)) {
50
DEFINE_PROP_BOOL("start-powered-off", ARMCPU, start_powered_off, false),
40
set_feature(env, ARM_FEATURE_V5);
51
DEFINE_PROP_UINT32("psci-conduit", ARMCPU, psci_conduit, 0),
41
+ set_feature(env, ARM_FEATURE_JAZELLE);
52
- DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0),
42
if (!arm_feature(env, ARM_FEATURE_M)) {
53
+ DEFINE_PROP_UINT64("midr", ARMCPU, midr, 0),
43
set_feature(env, ARM_FEATURE_AUXCR);
54
DEFINE_PROP_UINT64("mp-affinity", ARMCPU,
44
}
55
mp_affinity, ARM64_AFFINITY_INVALID),
45
@@ -XXX,XX +XXX,XX @@ static void arm926_initfn(Object *obj)
56
DEFINE_PROP_INT32("node-id", ARMCPU, node_id, CPU_UNSET_NUMA_NODE_ID),
46
set_feature(&cpu->env, ARM_FEATURE_VFP);
47
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
48
set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);
49
+ set_feature(&cpu->env, ARM_FEATURE_JAZELLE);
50
cpu->midr = 0x41069265;
51
cpu->reset_fpsid = 0x41011090;
52
cpu->ctr = 0x1dd20d2;
53
@@ -XXX,XX +XXX,XX @@ static void arm1026_initfn(Object *obj)
54
set_feature(&cpu->env, ARM_FEATURE_AUXCR);
55
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
56
set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);
57
+ set_feature(&cpu->env, ARM_FEATURE_JAZELLE);
58
cpu->midr = 0x4106a262;
59
cpu->reset_fpsid = 0x410110a0;
60
cpu->ctr = 0x1dd20d2;
61
diff --git a/target/arm/translate.c b/target/arm/translate.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/target/arm/translate.c
64
+++ b/target/arm/translate.c
65
@@ -XXX,XX +XXX,XX @@
66
#define ENABLE_ARCH_5 arm_dc_feature(s, ARM_FEATURE_V5)
67
/* currently all emulated v5 cores are also v5TE, so don't bother */
68
#define ENABLE_ARCH_5TE arm_dc_feature(s, ARM_FEATURE_V5)
69
-#define ENABLE_ARCH_5J 0
70
+#define ENABLE_ARCH_5J arm_dc_feature(s, ARM_FEATURE_JAZELLE)
71
#define ENABLE_ARCH_6 arm_dc_feature(s, ARM_FEATURE_V6)
72
#define ENABLE_ARCH_6K arm_dc_feature(s, ARM_FEATURE_V6K)
73
#define ENABLE_ARCH_6T2 arm_dc_feature(s, ARM_FEATURE_THUMB2)
74
--
57
--
75
2.7.4
58
2.20.1
76
59
77
60
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
2
3
Signed-off-by: Fam Zheng <famz@redhat.com>
3
Remove inclusion of arm_gicv3_common.h, this already gets
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
included via xlnx-versal.h.
5
Message-id: 20170905131149.10669-3-famz@redhat.com
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Message-id: 20200427181649.26851-2-edgar.iglesias@gmail.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
11
---
9
hw/arm/armv7m.c | 8 ++------
12
hw/arm/xlnx-versal.c | 1 -
10
1 file changed, 2 insertions(+), 6 deletions(-)
13
1 file changed, 1 deletion(-)
11
14
12
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
15
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
13
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/arm/armv7m.c
17
--- a/hw/arm/xlnx-versal.c
15
+++ b/hw/arm/armv7m.c
18
+++ b/hw/arm/xlnx-versal.c
16
@@ -XXX,XX +XXX,XX @@ static void armv7m_instance_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@
17
20
#include "hw/arm/boot.h"
18
/* Can't init the cpu here, we don't yet know which model to use */
21
#include "kvm_arm.h"
19
22
#include "hw/misc/unimp.h"
20
- object_property_add_link(obj, "memory",
23
-#include "hw/intc/arm_gicv3_common.h"
21
- TYPE_MEMORY_REGION,
24
#include "hw/arm/xlnx-versal.h"
22
- (Object **)&s->board_memory,
25
#include "hw/char/pl011.h"
23
- qdev_prop_allow_set_link_before_realize,
24
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
25
- &error_abort);
26
memory_region_init(&s->container, obj, "armv7m-container", UINT64_MAX);
27
28
object_initialize(&s->nvic, sizeof(s->nvic), TYPE_NVIC);
29
@@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp)
30
31
static Property armv7m_properties[] = {
32
DEFINE_PROP_STRING("cpu-model", ARMv7MState, cpu_model),
33
+ DEFINE_PROP_LINK("memory", ARMv7MState, board_memory, TYPE_MEMORY_REGION,
34
+ MemoryRegion *),
35
DEFINE_PROP_END_OF_LIST(),
36
};
37
26
38
--
27
--
39
2.7.4
28
2.20.1
40
29
41
30
diff view generated by jsdifflib
New patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
2
3
Move misplaced comment.
4
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Message-id: 20200427181649.26851-3-edgar.iglesias@gmail.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/arm/xlnx-versal.c | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
14
15
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/xlnx-versal.c
18
+++ b/hw/arm/xlnx-versal.c
19
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
20
21
obj = object_new(XLNX_VERSAL_ACPU_TYPE);
22
if (!obj) {
23
- /* Secondary CPUs start in PSCI powered-down state */
24
error_report("Unable to create apu.cpu[%d] of type %s",
25
i, XLNX_VERSAL_ACPU_TYPE);
26
exit(EXIT_FAILURE);
27
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
28
object_property_set_int(obj, s->cfg.psci_conduit,
29
"psci-conduit", &error_abort);
30
if (i) {
31
+ /* Secondary CPUs start in PSCI powered-down state */
32
object_property_set_bool(obj, true,
33
"start-powered-off", &error_abort);
34
}
35
--
36
2.20.1
37
38
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
2
3
Signed-off-by: Fam Zheng <famz@redhat.com>
3
Fix typo xlnx-ve -> xlnx-versal.
4
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Message-id: 20170905131149.10669-5-famz@redhat.com
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20200427181649.26851-4-edgar.iglesias@gmail.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
11
---
9
hw/arm/xlnx-zynqmp.c | 7 ++-----
12
hw/arm/xlnx-versal-virt.c | 2 +-
10
1 file changed, 2 insertions(+), 5 deletions(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
11
14
12
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
15
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
13
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/arm/xlnx-zynqmp.c
17
--- a/hw/arm/xlnx-versal-virt.c
15
+++ b/hw/arm/xlnx-zynqmp.c
18
+++ b/hw/arm/xlnx-versal-virt.c
16
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
17
&error_abort);
20
psci_conduit = QEMU_PSCI_CONDUIT_SMC;
18
}
21
}
19
22
20
- object_property_add_link(obj, "ddr-ram", TYPE_MEMORY_REGION,
23
- sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
21
- (Object **)&s->ddr_ram,
24
+ sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc,
22
- qdev_prop_allow_set_link_before_realize,
25
sizeof(s->soc), TYPE_XLNX_VERSAL);
23
- OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
26
object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram),
24
-
27
"ddr", &error_abort);
25
object_initialize(&s->gic, sizeof(s->gic), gic_class_name());
26
qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default());
27
28
@@ -XXX,XX +XXX,XX @@ static Property xlnx_zynqmp_props[] = {
29
DEFINE_PROP_STRING("boot-cpu", XlnxZynqMPState, boot_cpu),
30
DEFINE_PROP_BOOL("secure", XlnxZynqMPState, secure, false),
31
DEFINE_PROP_BOOL("has_rpu", XlnxZynqMPState, has_rpu, false),
32
+ DEFINE_PROP_LINK("ddr-ram", XlnxZynqMPState, ddr_ram, TYPE_MEMORY_REGION,
33
+ MemoryRegion *),
34
DEFINE_PROP_END_OF_LIST()
35
};
36
37
--
28
--
38
2.7.4
29
2.20.1
39
30
40
31
diff view generated by jsdifflib
New patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
2
3
Embed the UARTs into the SoC type.
4
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-5-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/xlnx-versal.h | 3 ++-
14
hw/arm/xlnx-versal.c | 12 ++++++------
15
2 files changed, 8 insertions(+), 7 deletions(-)
16
17
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/xlnx-versal.h
20
+++ b/include/hw/arm/xlnx-versal.h
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/sysbus.h"
23
#include "hw/arm/boot.h"
24
#include "hw/intc/arm_gicv3.h"
25
+#include "hw/char/pl011.h"
26
27
#define TYPE_XLNX_VERSAL "xlnx-versal"
28
#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
29
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
30
MemoryRegion mr_ocm;
31
32
struct {
33
- SysBusDevice *uart[XLNX_VERSAL_NR_UARTS];
34
+ PL011State uart[XLNX_VERSAL_NR_UARTS];
35
SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
36
SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
37
} iou;
38
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/xlnx-versal.c
41
+++ b/hw/arm/xlnx-versal.c
42
@@ -XXX,XX +XXX,XX @@
43
#include "kvm_arm.h"
44
#include "hw/misc/unimp.h"
45
#include "hw/arm/xlnx-versal.h"
46
-#include "hw/char/pl011.h"
47
48
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
49
#define GEM_REVISION 0x40070106
50
@@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
51
DeviceState *dev;
52
MemoryRegion *mr;
53
54
- dev = qdev_create(NULL, TYPE_PL011);
55
- s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
56
+ sysbus_init_child_obj(OBJECT(s), name,
57
+ &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]),
58
+ TYPE_PL011);
59
+ dev = DEVICE(&s->lpd.iou.uart[i]);
60
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
61
- object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
62
qdev_init_nofail(dev);
63
64
- mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0);
65
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
66
memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
67
68
- sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]);
69
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
70
g_free(name);
71
}
72
}
73
--
74
2.20.1
75
76
diff view generated by jsdifflib
New patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
2
3
Embed the GEMs into the SoC type.
4
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-6-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/xlnx-versal.h | 3 ++-
14
hw/arm/xlnx-versal.c | 15 ++++++++-------
15
2 files changed, 10 insertions(+), 8 deletions(-)
16
17
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/xlnx-versal.h
20
+++ b/include/hw/arm/xlnx-versal.h
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/arm/boot.h"
23
#include "hw/intc/arm_gicv3.h"
24
#include "hw/char/pl011.h"
25
+#include "hw/net/cadence_gem.h"
26
27
#define TYPE_XLNX_VERSAL "xlnx-versal"
28
#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
29
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
30
31
struct {
32
PL011State uart[XLNX_VERSAL_NR_UARTS];
33
- SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
34
+ CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
35
SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
36
} iou;
37
} lpd;
38
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/xlnx-versal.c
41
+++ b/hw/arm/xlnx-versal.c
42
@@ -XXX,XX +XXX,XX @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
43
DeviceState *dev;
44
MemoryRegion *mr;
45
46
- dev = qdev_create(NULL, "cadence_gem");
47
- s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev);
48
- object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
49
+ sysbus_init_child_obj(OBJECT(s), name,
50
+ &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]),
51
+ TYPE_CADENCE_GEM);
52
+ dev = DEVICE(&s->lpd.iou.gem[i]);
53
if (nd->used) {
54
qemu_check_nic_model(nd, "cadence_gem");
55
qdev_set_nic_properties(dev, nd);
56
}
57
- object_property_set_int(OBJECT(s->lpd.iou.gem[i]),
58
+ object_property_set_int(OBJECT(dev),
59
2, "num-priority-queues",
60
&error_abort);
61
- object_property_set_link(OBJECT(s->lpd.iou.gem[i]),
62
+ object_property_set_link(OBJECT(dev),
63
OBJECT(&s->mr_ps), "dma",
64
&error_abort);
65
qdev_init_nofail(dev);
66
67
- mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0);
68
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
69
memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
70
71
- sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]);
72
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
73
g_free(name);
74
}
75
}
76
--
77
2.20.1
78
79
diff view generated by jsdifflib
New patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
2
3
Embed the ADMAs into the SoC type.
4
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-7-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/xlnx-versal.h | 3 ++-
14
hw/arm/xlnx-versal.c | 14 +++++++-------
15
2 files changed, 9 insertions(+), 8 deletions(-)
16
17
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/xlnx-versal.h
20
+++ b/include/hw/arm/xlnx-versal.h
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/arm/boot.h"
23
#include "hw/intc/arm_gicv3.h"
24
#include "hw/char/pl011.h"
25
+#include "hw/dma/xlnx-zdma.h"
26
#include "hw/net/cadence_gem.h"
27
28
#define TYPE_XLNX_VERSAL "xlnx-versal"
29
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
30
struct {
31
PL011State uart[XLNX_VERSAL_NR_UARTS];
32
CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
33
- SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
34
+ XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
35
} iou;
36
} lpd;
37
38
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/xlnx-versal.c
41
+++ b/hw/arm/xlnx-versal.c
42
@@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
43
DeviceState *dev;
44
MemoryRegion *mr;
45
46
- dev = qdev_create(NULL, "xlnx.zdma");
47
- s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
48
- object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width",
49
- &error_abort);
50
- object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
51
+ sysbus_init_child_obj(OBJECT(s), name,
52
+ &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]),
53
+ TYPE_XLNX_ZDMA);
54
+ dev = DEVICE(&s->lpd.iou.adma[i]);
55
+ object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort);
56
qdev_init_nofail(dev);
57
58
- mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
59
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
60
memory_region_add_subregion(&s->mr_ps,
61
MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
62
63
- sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]);
64
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]);
65
g_free(name);
66
}
67
}
68
--
69
2.20.1
70
71
diff view generated by jsdifflib
New patch
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
2
3
Embed the APUs into the SoC type.
4
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20200427181649.26851-8-edgar.iglesias@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/xlnx-versal.h | 2 +-
14
hw/arm/xlnx-versal-virt.c | 4 ++--
15
hw/arm/xlnx-versal.c | 19 +++++--------------
16
3 files changed, 8 insertions(+), 17 deletions(-)
17
18
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/arm/xlnx-versal.h
21
+++ b/include/hw/arm/xlnx-versal.h
22
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
23
struct {
24
struct {
25
MemoryRegion mr;
26
- ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
27
+ ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
28
GICv3State gic;
29
} apu;
30
} fpd;
31
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/arm/xlnx-versal-virt.c
34
+++ b/hw/arm/xlnx-versal-virt.c
35
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
36
s->binfo.get_dtb = versal_virt_get_dtb;
37
s->binfo.modify_dtb = versal_virt_modify_dtb;
38
if (machine->kernel_filename) {
39
- arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
40
+ arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
41
} else {
42
- AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
43
+ AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
44
&s->binfo);
45
/* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
46
* Offset things by 4K. */
47
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/xlnx-versal.c
50
+++ b/hw/arm/xlnx-versal.c
51
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
52
53
for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
54
Object *obj;
55
- char *name;
56
-
57
- obj = object_new(XLNX_VERSAL_ACPU_TYPE);
58
- if (!obj) {
59
- error_report("Unable to create apu.cpu[%d] of type %s",
60
- i, XLNX_VERSAL_ACPU_TYPE);
61
- exit(EXIT_FAILURE);
62
- }
63
-
64
- name = g_strdup_printf("apu-cpu[%d]", i);
65
- object_property_add_child(OBJECT(s), name, obj, &error_fatal);
66
- g_free(name);
67
68
+ object_initialize_child(OBJECT(s), "apu-cpu[*]",
69
+ &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
70
+ XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
71
+ obj = OBJECT(&s->fpd.apu.cpu[i]);
72
object_property_set_int(obj, s->cfg.psci_conduit,
73
"psci-conduit", &error_abort);
74
if (i) {
75
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_cpus(Versal *s)
76
object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
77
&error_abort);
78
object_property_set_bool(obj, true, "realized", &error_fatal);
79
- s->fpd.apu.cpu[i] = ARM_CPU(obj);
80
}
81
}
82
83
@@ -XXX,XX +XXX,XX @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
84
}
85
86
for (i = 0; i < nr_apu_cpus; i++) {
87
- DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
88
+ DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
89
int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
90
qemu_irq maint_irq;
91
int ti;
92
--
93
2.20.1
94
95
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
2
3
Signed-off-by: Fam Zheng <famz@redhat.com>
3
Add support for SD.
4
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Message-id: 20170905131149.10669-2-famz@redhat.com
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20200427181649.26851-9-edgar.iglesias@gmail.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
11
---
9
hw/arm/armv7m.c | 8 ++------
12
include/hw/arm/xlnx-versal.h | 12 ++++++++++++
10
1 file changed, 2 insertions(+), 6 deletions(-)
13
hw/arm/xlnx-versal.c | 31 +++++++++++++++++++++++++++++++
14
2 files changed, 43 insertions(+)
11
15
12
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
16
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
13
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/arm/armv7m.c
18
--- a/include/hw/arm/xlnx-versal.h
15
+++ b/hw/arm/armv7m.c
19
+++ b/include/hw/arm/xlnx-versal.h
16
@@ -XXX,XX +XXX,XX @@ static void bitband_init(Object *obj)
20
@@ -XXX,XX +XXX,XX @@
17
BitBandState *s = BITBAND(obj);
21
18
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
22
#include "hw/sysbus.h"
19
23
#include "hw/arm/boot.h"
20
- object_property_add_link(obj, "source-memory",
24
+#include "hw/sd/sdhci.h"
21
- TYPE_MEMORY_REGION,
25
#include "hw/intc/arm_gicv3.h"
22
- (Object **)&s->source_memory,
26
#include "hw/char/pl011.h"
23
- qdev_prop_allow_set_link_before_realize,
27
#include "hw/dma/xlnx-zdma.h"
24
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
28
@@ -XXX,XX +XXX,XX @@
25
- &error_abort);
29
#define XLNX_VERSAL_NR_UARTS 2
26
memory_region_init_io(&s->iomem, obj, &bitband_ops, s,
30
#define XLNX_VERSAL_NR_GEMS 2
27
"bitband", 0x02000000);
31
#define XLNX_VERSAL_NR_ADMAS 8
28
sysbus_init_mmio(dev, &s->iomem);
32
+#define XLNX_VERSAL_NR_SDS 2
29
@@ -XXX,XX +XXX,XX @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename, int mem_size)
33
#define XLNX_VERSAL_NR_IRQS 192
30
34
31
static Property bitband_properties[] = {
35
typedef struct Versal {
32
DEFINE_PROP_UINT32("base", BitBandState, base, 0),
36
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
33
+ DEFINE_PROP_LINK("source-memory", BitBandState, source_memory,
37
} iou;
34
+ TYPE_MEMORY_REGION, MemoryRegion *),
38
} lpd;
35
DEFINE_PROP_END_OF_LIST(),
39
36
};
40
+ /* The Platform Management Controller subsystem. */
41
+ struct {
42
+ struct {
43
+ SDHCIState sd[XLNX_VERSAL_NR_SDS];
44
+ } iou;
45
+ } pmc;
46
+
47
struct {
48
MemoryRegion *mr_ddr;
49
uint32_t psci_conduit;
50
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
51
#define VERSAL_GEM1_IRQ_0 58
52
#define VERSAL_GEM1_WAKE_IRQ_0 59
53
#define VERSAL_ADMA_IRQ_0 60
54
+#define VERSAL_SD0_IRQ_0 126
55
56
/* Architecturally reserved IRQs suitable for virtualization. */
57
#define VERSAL_RSVD_IRQ_FIRST 111
58
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
59
#define MM_FPD_CRF 0xfd1a0000U
60
#define MM_FPD_CRF_SIZE 0x140000
61
62
+#define MM_PMC_SD0 0xf1040000U
63
+#define MM_PMC_SD0_SIZE 0x10000
64
#define MM_PMC_CRP 0xf1260000U
65
#define MM_PMC_CRP_SIZE 0x10000
66
#endif
67
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/hw/arm/xlnx-versal.c
70
+++ b/hw/arm/xlnx-versal.c
71
@@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
72
}
73
}
74
75
+#define SDHCI_CAPABILITIES 0x280737ec6481 /* Same as on ZynqMP. */
76
+static void versal_create_sds(Versal *s, qemu_irq *pic)
77
+{
78
+ int i;
79
+
80
+ for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
81
+ DeviceState *dev;
82
+ MemoryRegion *mr;
83
+
84
+ sysbus_init_child_obj(OBJECT(s), "sd[*]",
85
+ &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]),
86
+ TYPE_SYSBUS_SDHCI);
87
+ dev = DEVICE(&s->pmc.iou.sd[i]);
88
+
89
+ object_property_set_uint(OBJECT(dev),
90
+ 3, "sd-spec-version", &error_fatal);
91
+ object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg",
92
+ &error_fatal);
93
+ object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal);
94
+ qdev_init_nofail(dev);
95
+
96
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
97
+ memory_region_add_subregion(&s->mr_ps,
98
+ MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
99
+
100
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
101
+ pic[VERSAL_SD0_IRQ_0 + i * 2]);
102
+ }
103
+}
104
+
105
/* This takes the board allocated linear DDR memory and creates aliases
106
* for each split DDR range/aperture on the Versal address map.
107
*/
108
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
109
versal_create_uarts(s, pic);
110
versal_create_gems(s, pic);
111
versal_create_admas(s, pic);
112
+ versal_create_sds(s, pic);
113
versal_map_ddr(s);
114
versal_unimp(s);
37
115
38
--
116
--
39
2.7.4
117
2.20.1
40
118
41
119
diff view generated by jsdifflib
1
From: Fam Zheng <famz@redhat.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
2
3
Signed-off-by: Fam Zheng <famz@redhat.com>
3
hw/arm: versal: Add support for the RTC.
4
Message-id: 20170905131149.10669-4-famz@redhat.com
4
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Message-id: 20200427181649.26851-10-edgar.iglesias@gmail.com
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
11
---
8
hw/intc/arm_gicv3_its_kvm.c | 19 +++++++------------
12
include/hw/arm/xlnx-versal.h | 8 ++++++++
9
1 file changed, 7 insertions(+), 12 deletions(-)
13
hw/arm/xlnx-versal.c | 21 +++++++++++++++++++++
14
2 files changed, 29 insertions(+)
10
15
11
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
16
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
12
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
13
--- a/hw/intc/arm_gicv3_its_kvm.c
18
--- a/include/hw/arm/xlnx-versal.h
14
+++ b/hw/intc/arm_gicv3_its_kvm.c
19
+++ b/include/hw/arm/xlnx-versal.h
15
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
20
@@ -XXX,XX +XXX,XX @@
16
qemu_add_vm_change_state_handler(vm_change_state_handler, s);
21
#include "hw/char/pl011.h"
22
#include "hw/dma/xlnx-zdma.h"
23
#include "hw/net/cadence_gem.h"
24
+#include "hw/rtc/xlnx-zynqmp-rtc.h"
25
26
#define TYPE_XLNX_VERSAL "xlnx-versal"
27
#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
28
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
29
struct {
30
SDHCIState sd[XLNX_VERSAL_NR_SDS];
31
} iou;
32
+
33
+ XlnxZynqMPRTC rtc;
34
} pmc;
35
36
struct {
37
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
38
#define VERSAL_GEM1_IRQ_0 58
39
#define VERSAL_GEM1_WAKE_IRQ_0 59
40
#define VERSAL_ADMA_IRQ_0 60
41
+#define VERSAL_RTC_APB_ERR_IRQ 121
42
#define VERSAL_SD0_IRQ_0 126
43
+#define VERSAL_RTC_ALARM_IRQ 142
44
+#define VERSAL_RTC_SECONDS_IRQ 143
45
46
/* Architecturally reserved IRQs suitable for virtualization. */
47
#define VERSAL_RSVD_IRQ_FIRST 111
48
@@ -XXX,XX +XXX,XX @@ typedef struct Versal {
49
#define MM_PMC_SD0_SIZE 0x10000
50
#define MM_PMC_CRP 0xf1260000U
51
#define MM_PMC_CRP_SIZE 0x10000
52
+#define MM_PMC_RTC 0xf12a0000
53
+#define MM_PMC_RTC_SIZE 0x10000
54
#endif
55
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/arm/xlnx-versal.c
58
+++ b/hw/arm/xlnx-versal.c
59
@@ -XXX,XX +XXX,XX @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
60
}
17
}
61
}
18
62
19
-static void kvm_arm_its_init(Object *obj)
63
+static void versal_create_rtc(Versal *s, qemu_irq *pic)
20
-{
64
+{
21
- GICv3ITSState *s = KVM_ARM_ITS(obj);
65
+ SysBusDevice *sbd;
22
-
66
+ MemoryRegion *mr;
23
- object_property_add_link(obj, "parent-gicv3",
24
- "kvm-arm-gicv3", (Object **)&s->gicv3,
25
- object_property_allow_set_link,
26
- OBJ_PROP_LINK_UNREF_ON_RELEASE,
27
- &error_abort);
28
-}
29
-
30
/**
31
* kvm_arm_its_pre_save - handles the saving of ITS registers.
32
* ITS tables are flushed into guest RAM separately and earlier,
33
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_post_load(GICv3ITSState *s)
34
GITS_CTLR, &s->ctlr, true, &error_abort);
35
}
36
37
+static Property kvm_arm_its_props[] = {
38
+ DEFINE_PROP_LINK("parent-gicv3", GICv3ITSState, gicv3, "kvm-arm-gicv3",
39
+ GICv3State *),
40
+ DEFINE_PROP_END_OF_LIST(),
41
+};
42
+
67
+
43
static void kvm_arm_its_class_init(ObjectClass *klass, void *data)
68
+ sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
44
{
69
+ TYPE_XLNX_ZYNQMP_RTC);
45
DeviceClass *dc = DEVICE_CLASS(klass);
70
+ sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
46
GICv3ITSCommonClass *icc = ARM_GICV3_ITS_COMMON_CLASS(klass);
71
+ qdev_init_nofail(DEVICE(sbd));
47
72
+
48
dc->realize = kvm_arm_its_realize;
73
+ mr = sysbus_mmio_get_region(sbd, 0);
49
+ dc->props = kvm_arm_its_props;
74
+ memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
50
icc->send_msi = kvm_its_send_msi;
75
+
51
icc->pre_save = kvm_arm_its_pre_save;
76
+ /*
52
icc->post_load = kvm_arm_its_post_load;
77
+ * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
53
@@ -XXX,XX +XXX,XX @@ static const TypeInfo kvm_arm_its_info = {
78
+ * supports them.
54
.name = TYPE_KVM_ARM_ITS,
79
+ */
55
.parent = TYPE_ARM_GICV3_ITS_COMMON,
80
+ sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
56
.instance_size = sizeof(GICv3ITSState),
81
+}
57
- .instance_init = kvm_arm_its_init,
82
+
58
.class_init = kvm_arm_its_class_init,
83
/* This takes the board allocated linear DDR memory and creates aliases
59
};
84
* for each split DDR range/aperture on the Versal address map.
85
*/
86
@@ -XXX,XX +XXX,XX @@ static void versal_realize(DeviceState *dev, Error **errp)
87
versal_create_gems(s, pic);
88
versal_create_admas(s, pic);
89
versal_create_sds(s, pic);
90
+ versal_create_rtc(s, pic);
91
versal_map_ddr(s);
92
versal_unimp(s);
60
93
61
--
94
--
62
2.7.4
95
2.20.1
63
96
64
97
diff view generated by jsdifflib
1
Move the regime_is_secure() utility function to internals.h;
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
we are going to want to call it from translate.c.
3
2
3
Add support for SD.
4
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
8
Message-id: 20200427181649.26851-11-edgar.iglesias@gmail.com
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 1503414539-28762-20-git-send-email-peter.maydell@linaro.org
7
---
10
---
8
target/arm/internals.h | 26 ++++++++++++++++++++++++++
11
hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++
9
target/arm/helper.c | 26 --------------------------
12
1 file changed, 46 insertions(+)
10
2 files changed, 26 insertions(+), 26 deletions(-)
11
13
12
diff --git a/target/arm/internals.h b/target/arm/internals.h
14
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
13
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/internals.h
16
--- a/hw/arm/xlnx-versal-virt.c
15
+++ b/target/arm/internals.h
17
+++ b/hw/arm/xlnx-versal-virt.c
16
@@ -XXX,XX +XXX,XX @@ static inline void arm_call_el_change_hook(ARMCPU *cpu)
18
@@ -XXX,XX +XXX,XX @@
19
#include "hw/arm/sysbus-fdt.h"
20
#include "hw/arm/fdt.h"
21
#include "cpu.h"
22
+#include "hw/qdev-properties.h"
23
#include "hw/arm/xlnx-versal.h"
24
25
#define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
26
@@ -XXX,XX +XXX,XX @@ static void fdt_add_zdma_nodes(VersalVirt *s)
17
}
27
}
18
}
28
}
19
29
20
+/* Return true if this address translation regime is secure */
30
+static void fdt_add_sd_nodes(VersalVirt *s)
21
+static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx)
22
+{
31
+{
23
+ switch (mmu_idx) {
32
+ const char clocknames[] = "clk_xin\0clk_ahb";
24
+ case ARMMMUIdx_S12NSE0:
33
+ const char compat[] = "arasan,sdhci-8.9a";
25
+ case ARMMMUIdx_S12NSE1:
34
+ int i;
26
+ case ARMMMUIdx_S1NSE0:
35
+
27
+ case ARMMMUIdx_S1NSE1:
36
+ for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) {
28
+ case ARMMMUIdx_S1E2:
37
+ uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i;
29
+ case ARMMMUIdx_S2NS:
38
+ char *name = g_strdup_printf("/sdhci@%" PRIx64, addr);
30
+ case ARMMMUIdx_MPriv:
39
+
31
+ case ARMMMUIdx_MNegPri:
40
+ qemu_fdt_add_subnode(s->fdt, name);
32
+ case ARMMMUIdx_MUser:
41
+
33
+ return false;
42
+ qemu_fdt_setprop_cells(s->fdt, name, "clocks",
34
+ case ARMMMUIdx_S1E3:
43
+ s->phandle.clk_25Mhz, s->phandle.clk_25Mhz);
35
+ case ARMMMUIdx_S1SE0:
44
+ qemu_fdt_setprop(s->fdt, name, "clock-names",
36
+ case ARMMMUIdx_S1SE1:
45
+ clocknames, sizeof(clocknames));
37
+ case ARMMMUIdx_MSPriv:
46
+ qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
38
+ case ARMMMUIdx_MSNegPri:
47
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2,
39
+ case ARMMMUIdx_MSUser:
48
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI);
40
+ return true;
49
+ qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
41
+ default:
50
+ 2, addr, 2, MM_PMC_SD0_SIZE);
42
+ g_assert_not_reached();
51
+ qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
52
+ g_free(name);
43
+ }
53
+ }
44
+}
54
+}
45
+
55
+
46
#endif
56
static void fdt_nop_memory_nodes(void *fdt, Error **errp)
47
diff --git a/target/arm/helper.c b/target/arm/helper.c
57
{
48
index XXXXXXX..XXXXXXX 100644
58
Error *err = NULL;
49
--- a/target/arm/helper.c
59
@@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s)
50
+++ b/target/arm/helper.c
51
@@ -XXX,XX +XXX,XX @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx)
52
}
60
}
53
}
61
}
54
62
55
-/* Return true if this address translation regime is secure */
63
+static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
56
-static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx)
64
+{
57
-{
65
+ BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
58
- switch (mmu_idx) {
66
+ DeviceState *card;
59
- case ARMMMUIdx_S12NSE0:
67
+
60
- case ARMMMUIdx_S12NSE1:
68
+ card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD);
61
- case ARMMMUIdx_S1NSE0:
69
+ object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card),
62
- case ARMMMUIdx_S1NSE1:
70
+ &error_fatal);
63
- case ARMMMUIdx_S1E2:
71
+ qdev_prop_set_drive(card, "drive", blk, &error_fatal);
64
- case ARMMMUIdx_S2NS:
72
+ object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
65
- case ARMMMUIdx_MPriv:
73
+}
66
- case ARMMMUIdx_MNegPri:
74
+
67
- case ARMMMUIdx_MUser:
75
static void versal_virt_init(MachineState *machine)
68
- return false;
69
- case ARMMMUIdx_S1E3:
70
- case ARMMMUIdx_S1SE0:
71
- case ARMMMUIdx_S1SE1:
72
- case ARMMMUIdx_MSPriv:
73
- case ARMMMUIdx_MSNegPri:
74
- case ARMMMUIdx_MSUser:
75
- return true;
76
- default:
77
- g_assert_not_reached();
78
- }
79
-}
80
-
81
/* Return the SCTLR value which controls this address translation regime */
82
static inline uint32_t regime_sctlr(CPUARMState *env, ARMMMUIdx mmu_idx)
83
{
76
{
77
VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
78
int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
79
+ int i;
80
81
/*
82
* If the user provides an Operating System to be loaded, we expect them
83
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
84
fdt_add_gic_nodes(s);
85
fdt_add_timer_nodes(s);
86
fdt_add_zdma_nodes(s);
87
+ fdt_add_sd_nodes(s);
88
fdt_add_cpu_nodes(s, psci_conduit);
89
fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
90
fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
91
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
92
memory_region_add_subregion_overlap(get_system_memory(),
93
0, &s->soc.fpd.apu.mr, 0);
94
95
+ /* Plugin SD cards. */
96
+ for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
97
+ sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
98
+ }
99
+
100
s->binfo.ram_size = machine->ram_size;
101
s->binfo.loader_start = 0x0;
102
s->binfo.get_dtb = versal_virt_get_dtb;
84
--
103
--
85
2.7.4
104
2.20.1
86
105
87
106
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
2
2
3
QEMU currently exits unexpectedly when the user accidentially
3
Add support for the RTC.
4
tries to do something like this:
5
4
6
$ aarch64-softmmu/qemu-system-aarch64 -S -M integratorcp -nographic
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
QEMU 2.9.93 monitor - type 'help' for more information
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
(qemu) device_add allwinner-a10
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
Unsupported NIC model: smc91c111
8
Message-id: 20200427181649.26851-12-edgar.iglesias@gmail.com
10
11
Exiting just due to a "device_add" should not happen. Looking closer
12
at the the realize and instance_init function of this device also
13
reveals that it is using serial_hds and nd_table directly there, so
14
this device is clearly not creatable by the user and should be marked
15
accordingly.
16
17
Signed-off-by: Thomas Huth <thuth@redhat.com>
18
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
19
Message-id: 1503416789-32080-1-git-send-email-thuth@redhat.com
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
10
---
23
hw/arm/allwinner-a10.c | 2 ++
11
hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++
24
scripts/device-crash-test | 1 -
12
1 file changed, 22 insertions(+)
25
2 files changed, 2 insertions(+), 1 deletion(-)
26
13
27
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
14
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
28
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/arm/allwinner-a10.c
16
--- a/hw/arm/xlnx-versal-virt.c
30
+++ b/hw/arm/allwinner-a10.c
17
+++ b/hw/arm/xlnx-versal-virt.c
31
@@ -XXX,XX +XXX,XX @@ static void aw_a10_class_init(ObjectClass *oc, void *data)
18
@@ -XXX,XX +XXX,XX @@ static void fdt_add_sd_nodes(VersalVirt *s)
32
DeviceClass *dc = DEVICE_CLASS(oc);
19
}
33
34
dc->realize = aw_a10_realize;
35
+ /* Reason: Uses serial_hds in realize and nd_table in instance_init */
36
+ dc->user_creatable = false;
37
}
20
}
38
21
39
static const TypeInfo aw_a10_type_info = {
22
+static void fdt_add_rtc_node(VersalVirt *s)
40
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
23
+{
41
index XXXXXXX..XXXXXXX 100755
24
+ const char compat[] = "xlnx,zynqmp-rtc";
42
--- a/scripts/device-crash-test
25
+ const char interrupt_names[] = "alarm\0sec";
43
+++ b/scripts/device-crash-test
26
+ char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC);
44
@@ -XXX,XX +XXX,XX @@ ERROR_WHITELIST = [
27
+
45
{'log':r"Device [\w.,-]+ can not be dynamically instantiated"},
28
+ qemu_fdt_add_subnode(s->fdt, name);
46
{'log':r"Platform Bus: Can not fit MMIO region of size "},
29
+
47
# other more specific errors we will ignore:
30
+ qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
48
- {'device':'allwinner-a10', 'log':"Unsupported NIC model:"},
31
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ,
49
{'device':'.*-spapr-cpu-core', 'log':r"CPU core type should be"},
32
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI,
50
{'log':r"MSI(-X)? is not supported by interrupt controller"},
33
+ GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ,
51
{'log':r"pxb-pcie? devices cannot reside on a PCIe? bus"},
34
+ GIC_FDT_IRQ_FLAGS_LEVEL_HI);
35
+ qemu_fdt_setprop(s->fdt, name, "interrupt-names",
36
+ interrupt_names, sizeof(interrupt_names));
37
+ qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
38
+ 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE);
39
+ qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
40
+ g_free(name);
41
+}
42
+
43
static void fdt_nop_memory_nodes(void *fdt, Error **errp)
44
{
45
Error *err = NULL;
46
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
47
fdt_add_timer_nodes(s);
48
fdt_add_zdma_nodes(s);
49
fdt_add_sd_nodes(s);
50
+ fdt_add_rtc_node(s);
51
fdt_add_cpu_nodes(s, psci_conduit);
52
fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
53
fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
52
--
54
--
53
2.7.4
55
2.20.1
54
56
55
57
diff view generated by jsdifflib
1
Make the MPU_RNR register banked if v8M security extensions are
1
Somewhere along theline we accidentally added a duplicate
2
enabled.
2
"using D16-D31 when they don't exist" check to do_vfm_dp()
3
(probably an artifact of a patchseries rebase). Remove it.
3
4
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 1503414539-28762-15-git-send-email-peter.maydell@linaro.org
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Message-id: 20200430181003.21682-2-peter.maydell@linaro.org
7
---
9
---
8
target/arm/cpu.h | 2 +-
10
target/arm/translate-vfp.inc.c | 6 ------
9
hw/intc/armv7m_nvic.c | 18 +++++++++---------
11
1 file changed, 6 deletions(-)
10
target/arm/cpu.c | 3 ++-
11
target/arm/helper.c | 6 +++---
12
target/arm/machine.c | 13 +++++++++++--
13
5 files changed, 26 insertions(+), 16 deletions(-)
14
12
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.h
15
--- a/target/arm/translate-vfp.inc.c
18
+++ b/target/arm/cpu.h
16
+++ b/target/arm/translate-vfp.inc.c
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
17
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d)
20
uint32_t *drbar;
18
return false;
21
uint32_t *drsr;
22
uint32_t *dracr;
23
- uint32_t rnr;
24
+ uint32_t rnr[2];
25
} pmsav7;
26
27
/* PMSAv8 MPU */
28
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/intc/armv7m_nvic.c
31
+++ b/hw/intc/armv7m_nvic.c
32
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
33
case 0xd94: /* MPU_CTRL */
34
return cpu->env.v7m.mpu_ctrl;
35
case 0xd98: /* MPU_RNR */
36
- return cpu->env.pmsav7.rnr;
37
+ return cpu->env.pmsav7.rnr[attrs.secure];
38
case 0xd9c: /* MPU_RBAR */
39
case 0xda4: /* MPU_RBAR_A1 */
40
case 0xdac: /* MPU_RBAR_A2 */
41
case 0xdb4: /* MPU_RBAR_A3 */
42
{
43
- int region = cpu->env.pmsav7.rnr;
44
+ int region = cpu->env.pmsav7.rnr[attrs.secure];
45
46
if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
47
/* PMSAv8M handling of the aliases is different from v7M:
48
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
49
case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */
50
case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */
51
{
52
- int region = cpu->env.pmsav7.rnr;
53
+ int region = cpu->env.pmsav7.rnr[attrs.secure];
54
55
if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
56
/* PMSAv8M handling of the aliases is different from v7M:
57
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
58
PRIu32 "/%" PRIu32 "\n",
59
value, cpu->pmsav7_dregion);
60
} else {
61
- cpu->env.pmsav7.rnr = value;
62
+ cpu->env.pmsav7.rnr[attrs.secure] = value;
63
}
64
break;
65
case 0xd9c: /* MPU_RBAR */
66
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
67
*/
68
int aliasno = (offset - 0xd9c) / 8; /* 0..3 */
69
70
- region = cpu->env.pmsav7.rnr;
71
+ region = cpu->env.pmsav7.rnr[attrs.secure];
72
if (aliasno) {
73
region = deposit32(region, 0, 2, aliasno);
74
}
75
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
76
region, cpu->pmsav7_dregion);
77
return;
78
}
79
- cpu->env.pmsav7.rnr = region;
80
+ cpu->env.pmsav7.rnr[attrs.secure] = region;
81
} else {
82
- region = cpu->env.pmsav7.rnr;
83
+ region = cpu->env.pmsav7.rnr[attrs.secure];
84
}
85
86
if (region >= cpu->pmsav7_dregion) {
87
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
88
case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */
89
case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */
90
{
91
- int region = cpu->env.pmsav7.rnr;
92
+ int region = cpu->env.pmsav7.rnr[attrs.secure];
93
94
if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
95
/* PMSAv8M handling of the aliases is different from v7M:
96
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
97
*/
98
int aliasno = (offset - 0xd9c) / 8; /* 0..3 */
99
100
- region = cpu->env.pmsav7.rnr;
101
+ region = cpu->env.pmsav7.rnr[attrs.secure];
102
if (aliasno) {
103
region = deposit32(region, 0, 2, aliasno);
104
}
105
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/target/arm/cpu.c
108
+++ b/target/arm/cpu.c
109
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
110
sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion);
111
}
112
}
113
- env->pmsav7.rnr = 0;
114
+ env->pmsav7.rnr[M_REG_NS] = 0;
115
+ env->pmsav7.rnr[M_REG_S] = 0;
116
env->pmsav8.mair0[M_REG_NS] = 0;
117
env->pmsav8.mair0[M_REG_S] = 0;
118
env->pmsav8.mair1[M_REG_NS] = 0;
119
diff --git a/target/arm/helper.c b/target/arm/helper.c
120
index XXXXXXX..XXXXXXX 100644
121
--- a/target/arm/helper.c
122
+++ b/target/arm/helper.c
123
@@ -XXX,XX +XXX,XX @@ static uint64_t pmsav7_read(CPUARMState *env, const ARMCPRegInfo *ri)
124
return 0;
125
}
19
}
126
20
127
- u32p += env->pmsav7.rnr;
21
- /* UNDEF accesses to D16-D31 if they don't exist. */
128
+ u32p += env->pmsav7.rnr[M_REG_NS];
22
- if (!dc_isar_feature(aa32_simd_r32, s) &&
129
return *u32p;
23
- ((a->vd | a->vn | a->vm) & 0x10)) {
130
}
24
- return false;
131
25
- }
132
@@ -XXX,XX +XXX,XX @@ static void pmsav7_write(CPUARMState *env, const ARMCPRegInfo *ri,
26
-
133
return;
27
if (!vfp_access_check(s)) {
28
return true;
134
}
29
}
135
136
- u32p += env->pmsav7.rnr;
137
+ u32p += env->pmsav7.rnr[M_REG_NS];
138
tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
139
*u32p = value;
140
}
141
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
142
.resetfn = arm_cp_reset_ignore },
143
{ .name = "RGNR", .cp = 15, .crn = 6, .opc1 = 0, .crm = 2, .opc2 = 0,
144
.access = PL1_RW,
145
- .fieldoffset = offsetof(CPUARMState, pmsav7.rnr),
146
+ .fieldoffset = offsetof(CPUARMState, pmsav7.rnr[M_REG_NS]),
147
.writefn = pmsav7_rgnr_write,
148
.resetfn = arm_cp_reset_ignore },
149
REGINFO_SENTINEL
150
diff --git a/target/arm/machine.c b/target/arm/machine.c
151
index XXXXXXX..XXXXXXX 100644
152
--- a/target/arm/machine.c
153
+++ b/target/arm/machine.c
154
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_rgnr_vmstate_validate(void *opaque, int version_id)
155
{
156
ARMCPU *cpu = opaque;
157
158
- return cpu->env.pmsav7.rnr < cpu->pmsav7_dregion;
159
+ return cpu->env.pmsav7.rnr[M_REG_NS] < cpu->pmsav7_dregion;
160
}
161
162
static const VMStateDescription vmstate_pmsav7 = {
163
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav7_rnr = {
164
.minimum_version_id = 1,
165
.needed = pmsav7_rnr_needed,
166
.fields = (VMStateField[]) {
167
- VMSTATE_UINT32(env.pmsav7.rnr, ARMCPU),
168
+ VMSTATE_UINT32(env.pmsav7.rnr[M_REG_NS], ARMCPU),
169
VMSTATE_END_OF_LIST()
170
}
171
};
172
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav8 = {
173
}
174
};
175
176
+static bool s_rnr_vmstate_validate(void *opaque, int version_id)
177
+{
178
+ ARMCPU *cpu = opaque;
179
+
180
+ return cpu->env.pmsav7.rnr[M_REG_S] < cpu->pmsav7_dregion;
181
+}
182
+
183
static bool m_security_needed(void *opaque)
184
{
185
ARMCPU *cpu = opaque;
186
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
187
0, vmstate_info_uint32, uint32_t),
188
VMSTATE_VARRAY_UINT32(env.pmsav8.rlar[M_REG_S], ARMCPU, pmsav7_dregion,
189
0, vmstate_info_uint32, uint32_t),
190
+ VMSTATE_UINT32(env.pmsav7.rnr[M_REG_S], ARMCPU),
191
+ VMSTATE_VALIDATE("secure MPU_RNR is valid", s_rnr_vmstate_validate),
192
VMSTATE_END_OF_LIST()
193
}
194
};
195
--
30
--
196
2.7.4
31
2.20.1
197
32
198
33
diff view generated by jsdifflib
1
Make the MPU registers MPU_MAIR0 and MPU_MAIR1 banked if v8M security
1
We were accidentally permitting decode of Thumb Neon insns even if
2
extensions are enabled.
2
the CPU didn't have the FEATURE_NEON bit set, because the feature
3
check was being done before the call to disas_neon_data_insn() and
4
disas_neon_ls_insn() in the Arm decoder but was omitted from the
5
Thumb decoder. Push the feature bit check down into the called
6
functions so it is done for both Arm and Thumb encodings.
3
7
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 1503414539-28762-13-git-send-email-peter.maydell@linaro.org
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20200430181003.21682-3-peter.maydell@linaro.org
7
---
12
---
8
target/arm/cpu.h | 4 ++--
13
target/arm/translate.c | 16 ++++++++--------
9
hw/intc/armv7m_nvic.c | 8 ++++----
14
1 file changed, 8 insertions(+), 8 deletions(-)
10
target/arm/cpu.c | 6 ++++--
11
target/arm/machine.c | 6 ++++--
12
4 files changed, 14 insertions(+), 10 deletions(-)
13
15
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
16
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
18
--- a/target/arm/translate.c
17
+++ b/target/arm/cpu.h
19
+++ b/target/arm/translate.c
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
20
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
19
*/
21
TCGv_i32 tmp2;
20
uint32_t *rbar;
22
TCGv_i64 tmp64;
21
uint32_t *rlar;
23
22
- uint32_t mair0;
24
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
23
- uint32_t mair1;
25
+ return 1;
24
+ uint32_t mair0[2];
26
+ }
25
+ uint32_t mair1[2];
27
+
26
} pmsav8;
28
/* FIXME: this access check should not take precedence over UNDEF
27
29
* for invalid encodings; we will generate incorrect syndrome information
28
void *nvic;
30
* for attempts to execute invalid vfp/neon encodings with FP disabled.
29
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
31
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
30
index XXXXXXX..XXXXXXX 100644
32
TCGv_ptr ptr1, ptr2, ptr3;
31
--- a/hw/intc/armv7m_nvic.c
33
TCGv_i64 tmp64;
32
+++ b/hw/intc/armv7m_nvic.c
34
33
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
35
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
34
if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
36
+ return 1;
35
goto bad_offset;
37
+ }
38
+
39
/* FIXME: this access check should not take precedence over UNDEF
40
* for invalid encodings; we will generate incorrect syndrome information
41
* for attempts to execute invalid vfp/neon encodings with FP disabled.
42
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
43
44
if (((insn >> 25) & 7) == 1) {
45
/* NEON Data processing. */
46
- if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
47
- goto illegal_op;
48
- }
49
-
50
if (disas_neon_data_insn(s, insn)) {
51
goto illegal_op;
52
}
53
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
36
}
54
}
37
- return cpu->env.pmsav8.mair0;
55
if ((insn & 0x0f100000) == 0x04000000) {
38
+ return cpu->env.pmsav8.mair0[attrs.secure];
56
/* NEON load/store. */
39
case 0xdc4: /* MPU_MAIR1 */
57
- if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
40
if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
58
- goto illegal_op;
41
goto bad_offset;
59
- }
42
}
60
-
43
- return cpu->env.pmsav8.mair1;
61
if (disas_neon_ls_insn(s, insn)) {
44
+ return cpu->env.pmsav8.mair1[attrs.secure];
62
goto illegal_op;
45
default:
46
bad_offset:
47
qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad read offset 0x%x\n", offset);
48
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
49
}
50
if (cpu->pmsav7_dregion) {
51
/* Register is RES0 if no MPU regions are implemented */
52
- cpu->env.pmsav8.mair0 = value;
53
+ cpu->env.pmsav8.mair0[attrs.secure] = value;
54
}
55
/* We don't need to do anything else because memory attributes
56
* only affect cacheability, and we don't implement caching.
57
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
58
}
59
if (cpu->pmsav7_dregion) {
60
/* Register is RES0 if no MPU regions are implemented */
61
- cpu->env.pmsav8.mair1 = value;
62
+ cpu->env.pmsav8.mair1[attrs.secure] = value;
63
}
64
/* We don't need to do anything else because memory attributes
65
* only affect cacheability, and we don't implement caching.
66
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/cpu.c
69
+++ b/target/arm/cpu.c
70
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
71
}
63
}
72
}
73
env->pmsav7.rnr = 0;
74
- env->pmsav8.mair0 = 0;
75
- env->pmsav8.mair1 = 0;
76
+ env->pmsav8.mair0[M_REG_NS] = 0;
77
+ env->pmsav8.mair0[M_REG_S] = 0;
78
+ env->pmsav8.mair1[M_REG_NS] = 0;
79
+ env->pmsav8.mair1[M_REG_S] = 0;
80
}
81
82
set_flush_to_zero(1, &env->vfp.standard_fp_status);
83
diff --git a/target/arm/machine.c b/target/arm/machine.c
84
index XXXXXXX..XXXXXXX 100644
85
--- a/target/arm/machine.c
86
+++ b/target/arm/machine.c
87
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav8 = {
88
vmstate_info_uint32, uint32_t),
89
VMSTATE_VARRAY_UINT32(env.pmsav8.rlar, ARMCPU, pmsav7_dregion, 0,
90
vmstate_info_uint32, uint32_t),
91
- VMSTATE_UINT32(env.pmsav8.mair0, ARMCPU),
92
- VMSTATE_UINT32(env.pmsav8.mair1, ARMCPU),
93
+ VMSTATE_UINT32(env.pmsav8.mair0[M_REG_NS], ARMCPU),
94
+ VMSTATE_UINT32(env.pmsav8.mair1[M_REG_NS], ARMCPU),
95
VMSTATE_END_OF_LIST()
96
}
97
};
98
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
99
VMSTATE_UINT32(env.v7m.faultmask[M_REG_S], ARMCPU),
100
VMSTATE_UINT32(env.v7m.control[M_REG_S], ARMCPU),
101
VMSTATE_UINT32(env.v7m.vecbase[M_REG_S], ARMCPU),
102
+ VMSTATE_UINT32(env.pmsav8.mair0[M_REG_S], ARMCPU),
103
+ VMSTATE_UINT32(env.pmsav8.mair1[M_REG_S], ARMCPU),
104
VMSTATE_END_OF_LIST()
105
}
106
};
107
--
64
--
108
2.7.4
65
2.20.1
109
66
110
67
diff view generated by jsdifflib
1
As part of ARMv8M, we need to add support for the PMSAv8 MPU
1
Add the infrastructure for building and invoking a decodetree decoder
2
architecture.
2
for the AArch32 Neon encodings. At the moment the new decoder covers
3
3
nothing, so we always fall back to the existing hand-written decode.
4
PMSAv8 differs from PMSAv7 both in register/data layout (for instance
4
5
using base and limit registers rather than base and size) and also in
5
We follow the same pattern we did for the VFP decodetree conversion
6
behaviour (for example it does not have subregions); rather than
6
(commit 78e138bc1f672c145ef6ace74617d and following): code that deals
7
trying to wedge it into the existing PMSAv7 code and data structures,
7
with Neon will be moving gradually out to translate-neon.vfp.inc,
8
we define separate ones.
8
which we #include into translate.c.
9
9
10
This commit adds the data structures which hold the state for a
10
In order to share the decode files between A32 and T32, we
11
PMSAv8 MPU and the register interface to it. The implementation of
11
split Neon into 3 parts:
12
the MPU behaviour will be added in a subsequent commit.
12
* data-processing
13
* load-store
14
* 'shared' encodings
15
16
The first two groups of instructions have similar but not identical
17
A32 and T32 encodings, so we need to manually transform the T32
18
encoding into the A32 one before calling the decoder; the third group
19
covers the Neon instructions which are identical in A32 and T32.
13
20
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 1503414539-28762-2-git-send-email-peter.maydell@linaro.org
23
Message-id: 20200430181003.21682-4-peter.maydell@linaro.org
17
---
24
---
18
target/arm/cpu.h | 13 ++++++
25
target/arm/neon-dp.decode | 29 ++++++++++++++++++++++++++
19
hw/intc/armv7m_nvic.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++----
26
target/arm/neon-ls.decode | 29 ++++++++++++++++++++++++++
20
target/arm/cpu.c | 36 ++++++++++-----
27
target/arm/neon-shared.decode | 27 +++++++++++++++++++++++++
21
target/arm/machine.c | 29 +++++++++++-
28
target/arm/translate-neon.inc.c | 32 +++++++++++++++++++++++++++++
22
4 files changed, 180 insertions(+), 20 deletions(-)
29
target/arm/translate.c | 36 +++++++++++++++++++++++++++++++--
23
30
target/arm/Makefile.objs | 18 +++++++++++++++++
24
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
31
6 files changed, 169 insertions(+), 2 deletions(-)
32
create mode 100644 target/arm/neon-dp.decode
33
create mode 100644 target/arm/neon-ls.decode
34
create mode 100644 target/arm/neon-shared.decode
35
create mode 100644 target/arm/translate-neon.inc.c
36
37
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
38
new file mode 100644
39
index XXXXXXX..XXXXXXX
40
--- /dev/null
41
+++ b/target/arm/neon-dp.decode
42
@@ -XXX,XX +XXX,XX @@
43
+# AArch32 Neon data-processing instruction descriptions
44
+#
45
+# Copyright (c) 2020 Linaro, Ltd
46
+#
47
+# This library is free software; you can redistribute it and/or
48
+# modify it under the terms of the GNU Lesser General Public
49
+# License as published by the Free Software Foundation; either
50
+# version 2 of the License, or (at your option) any later version.
51
+#
52
+# This library is distributed in the hope that it will be useful,
53
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
54
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
55
+# Lesser General Public License for more details.
56
+#
57
+# You should have received a copy of the GNU Lesser General Public
58
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
59
+
60
+#
61
+# This file is processed by scripts/decodetree.py
62
+#
63
+
64
+# Encodings for Neon data processing instructions where the T32 encoding
65
+# is a simple transformation of the A32 encoding.
66
+# More specifically, this file covers instructions where the A32 encoding is
67
+# 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
68
+# and the T32 encoding is
69
+# 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
70
+# This file works on the A32 encoding only; calling code for T32 has to
71
+# transform the insn into the A32 version first.
72
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
73
new file mode 100644
74
index XXXXXXX..XXXXXXX
75
--- /dev/null
76
+++ b/target/arm/neon-ls.decode
77
@@ -XXX,XX +XXX,XX @@
78
+# AArch32 Neon load/store instruction descriptions
79
+#
80
+# Copyright (c) 2020 Linaro, Ltd
81
+#
82
+# This library is free software; you can redistribute it and/or
83
+# modify it under the terms of the GNU Lesser General Public
84
+# License as published by the Free Software Foundation; either
85
+# version 2 of the License, or (at your option) any later version.
86
+#
87
+# This library is distributed in the hope that it will be useful,
88
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
89
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
90
+# Lesser General Public License for more details.
91
+#
92
+# You should have received a copy of the GNU Lesser General Public
93
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
94
+
95
+#
96
+# This file is processed by scripts/decodetree.py
97
+#
98
+
99
+# Encodings for Neon load/store instructions where the T32 encoding
100
+# is a simple transformation of the A32 encoding.
101
+# More specifically, this file covers instructions where the A32 encoding is
102
+# 0b1111_0100_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx
103
+# and the T32 encoding is
104
+# 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx
105
+# This file works on the A32 encoding only; calling code for T32 has to
106
+# transform the insn into the A32 version first.
107
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
108
new file mode 100644
109
index XXXXXXX..XXXXXXX
110
--- /dev/null
111
+++ b/target/arm/neon-shared.decode
112
@@ -XXX,XX +XXX,XX @@
113
+# AArch32 Neon instruction descriptions
114
+#
115
+# Copyright (c) 2020 Linaro, Ltd
116
+#
117
+# This library is free software; you can redistribute it and/or
118
+# modify it under the terms of the GNU Lesser General Public
119
+# License as published by the Free Software Foundation; either
120
+# version 2 of the License, or (at your option) any later version.
121
+#
122
+# This library is distributed in the hope that it will be useful,
123
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
124
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
125
+# Lesser General Public License for more details.
126
+#
127
+# You should have received a copy of the GNU Lesser General Public
128
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
129
+
130
+#
131
+# This file is processed by scripts/decodetree.py
132
+#
133
+
134
+# Encodings for Neon instructions whose encoding is the same for
135
+# both A32 and T32.
136
+
137
+# More specifically, this covers:
138
+# 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
139
+# 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
140
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
141
new file mode 100644
142
index XXXXXXX..XXXXXXX
143
--- /dev/null
144
+++ b/target/arm/translate-neon.inc.c
145
@@ -XXX,XX +XXX,XX @@
146
+/*
147
+ * ARM translation: AArch32 Neon instructions
148
+ *
149
+ * Copyright (c) 2003 Fabrice Bellard
150
+ * Copyright (c) 2005-2007 CodeSourcery
151
+ * Copyright (c) 2007 OpenedHand, Ltd.
152
+ * Copyright (c) 2020 Linaro, Ltd.
153
+ *
154
+ * This library is free software; you can redistribute it and/or
155
+ * modify it under the terms of the GNU Lesser General Public
156
+ * License as published by the Free Software Foundation; either
157
+ * version 2 of the License, or (at your option) any later version.
158
+ *
159
+ * This library is distributed in the hope that it will be useful,
160
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
161
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
162
+ * Lesser General Public License for more details.
163
+ *
164
+ * You should have received a copy of the GNU Lesser General Public
165
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
166
+ */
167
+
168
+/*
169
+ * This file is intended to be included from translate.c; it uses
170
+ * some macros and definitions provided by that file.
171
+ * It might be possible to convert it to a standalone .c file eventually.
172
+ */
173
+
174
+/* Include the generated Neon decoder */
175
+#include "decode-neon-dp.inc.c"
176
+#include "decode-neon-ls.inc.c"
177
+#include "decode-neon-shared.inc.c"
178
diff --git a/target/arm/translate.c b/target/arm/translate.c
25
index XXXXXXX..XXXXXXX 100644
179
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/cpu.h
180
--- a/target/arm/translate.c
27
+++ b/target/arm/cpu.h
181
+++ b/target/arm/translate.c
28
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
182
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
29
uint32_t rnr;
183
30
} pmsav7;
184
#define ARM_CP_RW_BIT (1 << 20)
31
185
32
+ /* PMSAv8 MPU */
186
-/* Include the VFP decoder */
33
+ struct {
187
+/* Include the VFP and Neon decoders */
34
+ /* The PMSAv8 implementation also shares some PMSAv7 config
188
#include "translate-vfp.inc.c"
35
+ * and state:
189
+#include "translate-neon.inc.c"
36
+ * pmsav7.rnr (region number register)
190
37
+ * pmsav7_dregion (number of configured regions)
191
static inline void iwmmxt_load_reg(TCGv_i64 var, int reg)
192
{
193
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
194
/* Unconditional instructions. */
195
/* TODO: Perhaps merge these into one decodetree output file. */
196
if (disas_a32_uncond(s, insn) ||
197
- disas_vfp_uncond(s, insn)) {
198
+ disas_vfp_uncond(s, insn) ||
199
+ disas_neon_dp(s, insn) ||
200
+ disas_neon_ls(s, insn) ||
201
+ disas_neon_shared(s, insn)) {
202
return;
203
}
204
/* fall back to legacy decoder */
205
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
206
ARCH(6T2);
207
}
208
209
+ if ((insn & 0xef000000) == 0xef000000) {
210
+ /*
211
+ * T32 encodings 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
212
+ * transform into
213
+ * A32 encodings 0b1111_001p_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
38
+ */
214
+ */
39
+ uint32_t *rbar;
215
+ uint32_t a32_insn = (insn & 0xe2ffffff) |
40
+ uint32_t *rlar;
216
+ ((insn & (1 << 28)) >> 4) | (1 << 28);
41
+ uint32_t mair0;
217
+
42
+ uint32_t mair1;
218
+ if (disas_neon_dp(s, a32_insn)) {
43
+ } pmsav8;
44
+
45
void *nvic;
46
const struct arm_boot_info *boot_info;
47
/* Store GICv3CPUState to access from this struct */
48
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/intc/armv7m_nvic.c
51
+++ b/hw/intc/armv7m_nvic.c
52
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset)
53
{
54
int region = cpu->env.pmsav7.rnr;
55
56
+ if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
57
+ /* PMSAv8M handling of the aliases is different from v7M:
58
+ * aliases A1, A2, A3 override the low two bits of the region
59
+ * number in MPU_RNR, and there is no 'region' field in the
60
+ * RBAR register.
61
+ */
62
+ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */
63
+ if (aliasno) {
64
+ region = deposit32(region, 0, 2, aliasno);
65
+ }
66
+ if (region >= cpu->pmsav7_dregion) {
67
+ return 0;
68
+ }
69
+ return cpu->env.pmsav8.rbar[region];
70
+ }
71
+
72
if (region >= cpu->pmsav7_dregion) {
73
return 0;
74
}
75
return (cpu->env.pmsav7.drbar[region] & 0x1f) | (region & 0xf);
76
}
77
- case 0xda0: /* MPU_RASR */
78
- case 0xda8: /* MPU_RASR_A1 */
79
- case 0xdb0: /* MPU_RASR_A2 */
80
- case 0xdb8: /* MPU_RASR_A3 */
81
+ case 0xda0: /* MPU_RASR (v7M), MPU_RLAR (v8M) */
82
+ case 0xda8: /* MPU_RASR_A1 (v7M), MPU_RLAR_A1 (v8M) */
83
+ case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */
84
+ case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */
85
{
86
int region = cpu->env.pmsav7.rnr;
87
88
+ if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
89
+ /* PMSAv8M handling of the aliases is different from v7M:
90
+ * aliases A1, A2, A3 override the low two bits of the region
91
+ * number in MPU_RNR.
92
+ */
93
+ int aliasno = (offset - 0xda0) / 8; /* 0..3 */
94
+ if (aliasno) {
95
+ region = deposit32(region, 0, 2, aliasno);
96
+ }
97
+ if (region >= cpu->pmsav7_dregion) {
98
+ return 0;
99
+ }
100
+ return cpu->env.pmsav8.rlar[region];
101
+ }
102
+
103
if (region >= cpu->pmsav7_dregion) {
104
return 0;
105
}
106
return ((cpu->env.pmsav7.dracr[region] & 0xffff) << 16) |
107
(cpu->env.pmsav7.drsr[region] & 0xffff);
108
}
109
+ case 0xdc0: /* MPU_MAIR0 */
110
+ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
111
+ goto bad_offset;
112
+ }
113
+ return cpu->env.pmsav8.mair0;
114
+ case 0xdc4: /* MPU_MAIR1 */
115
+ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
116
+ goto bad_offset;
117
+ }
118
+ return cpu->env.pmsav8.mair1;
119
default:
120
+ bad_offset:
121
qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad read offset 0x%x\n", offset);
122
return 0;
123
}
124
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
125
{
126
int region;
127
128
+ if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
129
+ /* PMSAv8M handling of the aliases is different from v7M:
130
+ * aliases A1, A2, A3 override the low two bits of the region
131
+ * number in MPU_RNR, and there is no 'region' field in the
132
+ * RBAR register.
133
+ */
134
+ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */
135
+
136
+ region = cpu->env.pmsav7.rnr;
137
+ if (aliasno) {
138
+ region = deposit32(region, 0, 2, aliasno);
139
+ }
140
+ if (region >= cpu->pmsav7_dregion) {
141
+ return;
142
+ }
143
+ cpu->env.pmsav8.rbar[region] = value;
144
+ tlb_flush(CPU(cpu));
145
+ return;
219
+ return;
146
+ }
220
+ }
147
+
221
+ }
148
if (value & (1 << 4)) {
222
+
149
/* VALID bit means use the region number specified in this
223
+ if ((insn & 0xff100000) == 0xf9000000) {
150
* value and also update MPU_RNR.REGION with that value.
224
+ /*
151
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
225
+ * T32 encodings 0b1111_1001_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq
152
tlb_flush(CPU(cpu));
226
+ * transform into
153
break;
227
+ * A32 encodings 0b1111_0100_ppp0_qqqq_qqqq_qqqq_qqqq_qqqq
154
}
228
+ */
155
- case 0xda0: /* MPU_RASR */
229
+ uint32_t a32_insn = (insn & 0x00ffffff) | 0xf4000000;
156
- case 0xda8: /* MPU_RASR_A1 */
230
+
157
- case 0xdb0: /* MPU_RASR_A2 */
231
+ if (disas_neon_ls(s, a32_insn)) {
158
- case 0xdb8: /* MPU_RASR_A3 */
159
+ case 0xda0: /* MPU_RASR (v7M), MPU_RLAR (v8M) */
160
+ case 0xda8: /* MPU_RASR_A1 (v7M), MPU_RLAR_A1 (v8M) */
161
+ case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */
162
+ case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */
163
{
164
int region = cpu->env.pmsav7.rnr;
165
166
+ if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
167
+ /* PMSAv8M handling of the aliases is different from v7M:
168
+ * aliases A1, A2, A3 override the low two bits of the region
169
+ * number in MPU_RNR.
170
+ */
171
+ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */
172
+
173
+ region = cpu->env.pmsav7.rnr;
174
+ if (aliasno) {
175
+ region = deposit32(region, 0, 2, aliasno);
176
+ }
177
+ if (region >= cpu->pmsav7_dregion) {
178
+ return;
179
+ }
180
+ cpu->env.pmsav8.rlar[region] = value;
181
+ tlb_flush(CPU(cpu));
182
+ return;
232
+ return;
183
+ }
233
+ }
184
+
234
+ }
185
if (region >= cpu->pmsav7_dregion) {
235
+
186
return;
236
/*
187
}
237
* TODO: Perhaps merge these into one decodetree output file.
188
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
238
* Note disas_vfp is written for a32 with cond field in the
189
tlb_flush(CPU(cpu));
239
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
190
break;
240
*/
241
if (disas_t32(s, insn) ||
242
disas_vfp_uncond(s, insn) ||
243
+ disas_neon_shared(s, insn) ||
244
((insn >> 28) == 0xe && disas_vfp(s, insn))) {
245
return;
191
}
246
}
192
+ case 0xdc0: /* MPU_MAIR0 */
247
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
193
+ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
194
+ goto bad_offset;
195
+ }
196
+ if (cpu->pmsav7_dregion) {
197
+ /* Register is RES0 if no MPU regions are implemented */
198
+ cpu->env.pmsav8.mair0 = value;
199
+ }
200
+ /* We don't need to do anything else because memory attributes
201
+ * only affect cacheability, and we don't implement caching.
202
+ */
203
+ break;
204
+ case 0xdc4: /* MPU_MAIR1 */
205
+ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
206
+ goto bad_offset;
207
+ }
208
+ if (cpu->pmsav7_dregion) {
209
+ /* Register is RES0 if no MPU regions are implemented */
210
+ cpu->env.pmsav8.mair1 = value;
211
+ }
212
+ /* We don't need to do anything else because memory attributes
213
+ * only affect cacheability, and we don't implement caching.
214
+ */
215
+ break;
216
case 0xf00: /* Software Triggered Interrupt Register */
217
{
218
int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ;
219
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
220
break;
221
}
222
default:
223
+ bad_offset:
224
qemu_log_mask(LOG_GUEST_ERROR,
225
"NVIC: Bad write offset 0x%x\n", offset);
226
}
227
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
228
index XXXXXXX..XXXXXXX 100644
248
index XXXXXXX..XXXXXXX 100644
229
--- a/target/arm/cpu.c
249
--- a/target/arm/Makefile.objs
230
+++ b/target/arm/cpu.c
250
+++ b/target/arm/Makefile.objs
231
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
251
@@ -XXX,XX +XXX,XX @@ target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE)
232
env->vfp.xregs[ARM_VFP_FPEXC] = 0;
252
     $(PYTHON) $(DECODETREE) --decode disas_sve -o $@ $<,\
233
#endif
253
     "GEN", $(TARGET_DIR)$@)
234
254
235
- if (arm_feature(env, ARM_FEATURE_PMSA) &&
255
+target/arm/decode-neon-shared.inc.c: $(SRC_PATH)/target/arm/neon-shared.decode $(DECODETREE)
236
- arm_feature(env, ARM_FEATURE_V7)) {
256
+    $(call quiet-command,\
237
+ if (arm_feature(env, ARM_FEATURE_PMSA)) {
257
+     $(PYTHON) $(DECODETREE) --static-decode disas_neon_shared -o $@ $<,\
238
if (cpu->pmsav7_dregion > 0) {
258
+     "GEN", $(TARGET_DIR)$@)
239
- memset(env->pmsav7.drbar, 0,
259
+
240
- sizeof(*env->pmsav7.drbar) * cpu->pmsav7_dregion);
260
+target/arm/decode-neon-dp.inc.c: $(SRC_PATH)/target/arm/neon-dp.decode $(DECODETREE)
241
- memset(env->pmsav7.drsr, 0,
261
+    $(call quiet-command,\
242
- sizeof(*env->pmsav7.drsr) * cpu->pmsav7_dregion);
262
+     $(PYTHON) $(DECODETREE) --static-decode disas_neon_dp -o $@ $<,\
243
- memset(env->pmsav7.dracr, 0,
263
+     "GEN", $(TARGET_DIR)$@)
244
- sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion);
264
+
245
+ if (arm_feature(env, ARM_FEATURE_V8)) {
265
+target/arm/decode-neon-ls.inc.c: $(SRC_PATH)/target/arm/neon-ls.decode $(DECODETREE)
246
+ memset(env->pmsav8.rbar, 0,
266
+    $(call quiet-command,\
247
+ sizeof(*env->pmsav8.rbar) * cpu->pmsav7_dregion);
267
+     $(PYTHON) $(DECODETREE) --static-decode disas_neon_ls -o $@ $<,\
248
+ memset(env->pmsav8.rlar, 0,
268
+     "GEN", $(TARGET_DIR)$@)
249
+ sizeof(*env->pmsav8.rlar) * cpu->pmsav7_dregion);
269
+
250
+ } else if (arm_feature(env, ARM_FEATURE_V7)) {
270
target/arm/decode-vfp.inc.c: $(SRC_PATH)/target/arm/vfp.decode $(DECODETREE)
251
+ memset(env->pmsav7.drbar, 0,
271
    $(call quiet-command,\
252
+ sizeof(*env->pmsav7.drbar) * cpu->pmsav7_dregion);
272
     $(PYTHON) $(DECODETREE) --static-decode disas_vfp -o $@ $<,\
253
+ memset(env->pmsav7.drsr, 0,
273
@@ -XXX,XX +XXX,XX @@ target/arm/decode-t16.inc.c: $(SRC_PATH)/target/arm/t16.decode $(DECODETREE)
254
+ sizeof(*env->pmsav7.drsr) * cpu->pmsav7_dregion);
274
     "GEN", $(TARGET_DIR)$@)
255
+ memset(env->pmsav7.dracr, 0,
275
256
+ sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion);
276
target/arm/translate-sve.o: target/arm/decode-sve.inc.c
257
+ }
277
+target/arm/translate.o: target/arm/decode-neon-shared.inc.c
258
}
278
+target/arm/translate.o: target/arm/decode-neon-dp.inc.c
259
env->pmsav7.rnr = 0;
279
+target/arm/translate.o: target/arm/decode-neon-ls.inc.c
260
+ env->pmsav8.mair0 = 0;
280
target/arm/translate.o: target/arm/decode-vfp.inc.c
261
+ env->pmsav8.mair1 = 0;
281
target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c
262
}
282
target/arm/translate.o: target/arm/decode-a32.inc.c
263
264
set_flush_to_zero(1, &env->vfp.standard_fp_status);
265
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
266
}
267
268
if (nr) {
269
- env->pmsav7.drbar = g_new0(uint32_t, nr);
270
- env->pmsav7.drsr = g_new0(uint32_t, nr);
271
- env->pmsav7.dracr = g_new0(uint32_t, nr);
272
+ if (arm_feature(env, ARM_FEATURE_V8)) {
273
+ /* PMSAv8 */
274
+ env->pmsav8.rbar = g_new0(uint32_t, nr);
275
+ env->pmsav8.rlar = g_new0(uint32_t, nr);
276
+ } else {
277
+ env->pmsav7.drbar = g_new0(uint32_t, nr);
278
+ env->pmsav7.drsr = g_new0(uint32_t, nr);
279
+ env->pmsav7.dracr = g_new0(uint32_t, nr);
280
+ }
281
}
282
}
283
284
diff --git a/target/arm/machine.c b/target/arm/machine.c
285
index XXXXXXX..XXXXXXX 100644
286
--- a/target/arm/machine.c
287
+++ b/target/arm/machine.c
288
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_needed(void *opaque)
289
CPUARMState *env = &cpu->env;
290
291
return arm_feature(env, ARM_FEATURE_PMSA) &&
292
- arm_feature(env, ARM_FEATURE_V7);
293
+ arm_feature(env, ARM_FEATURE_V7) &&
294
+ !arm_feature(env, ARM_FEATURE_V8);
295
}
296
297
static bool pmsav7_rgnr_vmstate_validate(void *opaque, int version_id)
298
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav7_rnr = {
299
}
300
};
301
302
+static bool pmsav8_needed(void *opaque)
303
+{
304
+ ARMCPU *cpu = opaque;
305
+ CPUARMState *env = &cpu->env;
306
+
307
+ return arm_feature(env, ARM_FEATURE_PMSA) &&
308
+ arm_feature(env, ARM_FEATURE_V8);
309
+}
310
+
311
+static const VMStateDescription vmstate_pmsav8 = {
312
+ .name = "cpu/pmsav8",
313
+ .version_id = 1,
314
+ .minimum_version_id = 1,
315
+ .needed = pmsav8_needed,
316
+ .fields = (VMStateField[]) {
317
+ VMSTATE_VARRAY_UINT32(env.pmsav8.rbar, ARMCPU, pmsav7_dregion, 0,
318
+ vmstate_info_uint32, uint32_t),
319
+ VMSTATE_VARRAY_UINT32(env.pmsav8.rlar, ARMCPU, pmsav7_dregion, 0,
320
+ vmstate_info_uint32, uint32_t),
321
+ VMSTATE_UINT32(env.pmsav8.mair0, ARMCPU),
322
+ VMSTATE_UINT32(env.pmsav8.mair1, ARMCPU),
323
+ VMSTATE_END_OF_LIST()
324
+ }
325
+};
326
+
327
static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
328
VMStateField *field)
329
{
330
@@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_arm_cpu = {
331
*/
332
&vmstate_pmsav7_rnr,
333
&vmstate_pmsav7,
334
+ &vmstate_pmsav8,
335
NULL
336
}
337
};
338
--
283
--
339
2.7.4
284
2.20.1
340
285
341
286
diff view generated by jsdifflib
1
Make the MPU registers MPU_MAIR0 and MPU_MAIR1 banked if v8M security
1
Convert the VCMLA (vector) insns in the 3same extension group to
2
extensions are enabled.
2
decodetree.
3
4
We can freely add more items to vmstate_m_security without
5
breaking migration compatibility, because no CPU currently
6
has the ARM_FEATURE_M_SECURITY bit enabled and so this
7
subsection is not yet used by anything.
8
3
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 1503414539-28762-14-git-send-email-peter.maydell@linaro.org
6
Message-id: 20200430181003.21682-5-peter.maydell@linaro.org
12
---
7
---
13
target/arm/cpu.h | 4 ++--
8
target/arm/neon-shared.decode | 11 ++++++++++
14
hw/intc/armv7m_nvic.c | 8 ++++----
9
target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++
15
target/arm/cpu.c | 26 ++++++++++++++++++++------
10
target/arm/translate.c | 11 +---------
16
target/arm/helper.c | 11 ++++++-----
11
3 files changed, 49 insertions(+), 10 deletions(-)
17
target/arm/machine.c | 12 ++++++++----
18
5 files changed, 40 insertions(+), 21 deletions(-)
19
12
20
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
21
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/cpu.h
15
--- a/target/arm/neon-shared.decode
23
+++ b/target/arm/cpu.h
16
+++ b/target/arm/neon-shared.decode
24
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
17
@@ -XXX,XX +XXX,XX @@
25
* pmsav7.rnr (region number register)
18
# More specifically, this covers:
26
* pmsav7_dregion (number of configured regions)
19
# 2reg scalar ext: 0b1111_1110_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
27
*/
20
# 3same ext: 0b1111_110x_xxxx_xxxx_xxxx_1x0x_xxxx_xxxx
28
- uint32_t *rbar;
21
+
29
- uint32_t *rlar;
22
+# VFP/Neon register fields; same as vfp.decode
30
+ uint32_t *rbar[2];
23
+%vm_dp 5:1 0:4
31
+ uint32_t *rlar[2];
24
+%vm_sp 0:4 5:1
32
uint32_t mair0[2];
25
+%vn_dp 7:1 16:4
33
uint32_t mair1[2];
26
+%vn_sp 16:4 7:1
34
} pmsav8;
27
+%vd_dp 22:1 12:4
35
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
28
+%vd_sp 12:4 22:1
29
+
30
+VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \
31
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
32
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
36
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/intc/armv7m_nvic.c
34
--- a/target/arm/translate-neon.inc.c
38
+++ b/hw/intc/armv7m_nvic.c
35
+++ b/target/arm/translate-neon.inc.c
39
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
36
@@ -XXX,XX +XXX,XX @@
40
if (region >= cpu->pmsav7_dregion) {
37
#include "decode-neon-dp.inc.c"
41
return 0;
38
#include "decode-neon-ls.inc.c"
42
}
39
#include "decode-neon-shared.inc.c"
43
- return cpu->env.pmsav8.rbar[region];
40
+
44
+ return cpu->env.pmsav8.rbar[attrs.secure][region];
41
+static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a)
45
}
42
+{
46
43
+ int opr_sz;
47
if (region >= cpu->pmsav7_dregion) {
44
+ TCGv_ptr fpst;
48
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
45
+ gen_helper_gvec_3_ptr *fn_gvec_ptr;
49
if (region >= cpu->pmsav7_dregion) {
46
+
50
return 0;
47
+ if (!dc_isar_feature(aa32_vcma, s)
51
}
48
+ || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) {
52
- return cpu->env.pmsav8.rlar[region];
49
+ return false;
53
+ return cpu->env.pmsav8.rlar[attrs.secure][region];
50
+ }
54
}
51
+
55
52
+ /* UNDEF accesses to D16-D31 if they don't exist. */
56
if (region >= cpu->pmsav7_dregion) {
53
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
57
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
54
+ ((a->vd | a->vn | a->vm) & 0x10)) {
58
if (region >= cpu->pmsav7_dregion) {
55
+ return false;
59
return;
56
+ }
60
}
57
+
61
- cpu->env.pmsav8.rbar[region] = value;
58
+ if ((a->vn | a->vm | a->vd) & a->q) {
62
+ cpu->env.pmsav8.rbar[attrs.secure][region] = value;
59
+ return false;
63
tlb_flush(CPU(cpu));
60
+ }
64
return;
61
+
65
}
62
+ if (!vfp_access_check(s)) {
66
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
63
+ return true;
67
if (region >= cpu->pmsav7_dregion) {
64
+ }
68
return;
65
+
69
}
66
+ opr_sz = (1 + a->q) * 8;
70
- cpu->env.pmsav8.rlar[region] = value;
67
+ fpst = get_fpstatus_ptr(1);
71
+ cpu->env.pmsav8.rlar[attrs.secure][region] = value;
68
+ fn_gvec_ptr = a->size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah;
72
tlb_flush(CPU(cpu));
69
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
73
return;
70
+ vfp_reg_offset(1, a->vn),
74
}
71
+ vfp_reg_offset(1, a->vm),
75
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
72
+ fpst, opr_sz, opr_sz, a->rot,
73
+ fn_gvec_ptr);
74
+ tcg_temp_free_ptr(fpst);
75
+ return true;
76
+}
77
diff --git a/target/arm/translate.c b/target/arm/translate.c
76
index XXXXXXX..XXXXXXX 100644
78
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/cpu.c
79
--- a/target/arm/translate.c
78
+++ b/target/arm/cpu.c
80
+++ b/target/arm/translate.c
79
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
81
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
80
if (arm_feature(env, ARM_FEATURE_PMSA)) {
82
bool is_long = false, q = extract32(insn, 6, 1);
81
if (cpu->pmsav7_dregion > 0) {
83
bool ptr_is_env = false;
82
if (arm_feature(env, ARM_FEATURE_V8)) {
84
83
- memset(env->pmsav8.rbar, 0,
85
- if ((insn & 0xfe200f10) == 0xfc200800) {
84
- sizeof(*env->pmsav8.rbar) * cpu->pmsav7_dregion);
86
- /* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */
85
- memset(env->pmsav8.rlar, 0,
87
- int size = extract32(insn, 20, 1);
86
- sizeof(*env->pmsav8.rlar) * cpu->pmsav7_dregion);
88
- data = extract32(insn, 23, 2); /* rot */
87
+ memset(env->pmsav8.rbar[M_REG_NS], 0,
89
- if (!dc_isar_feature(aa32_vcma, s)
88
+ sizeof(*env->pmsav8.rbar[M_REG_NS])
90
- || (!size && !dc_isar_feature(aa32_fp16_arith, s))) {
89
+ * cpu->pmsav7_dregion);
91
- return 1;
90
+ memset(env->pmsav8.rlar[M_REG_NS], 0,
92
- }
91
+ sizeof(*env->pmsav8.rlar[M_REG_NS])
93
- fn_gvec_ptr = size ? gen_helper_gvec_fcmlas : gen_helper_gvec_fcmlah;
92
+ * cpu->pmsav7_dregion);
94
- } else if ((insn & 0xfea00f10) == 0xfc800800) {
93
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
95
+ if ((insn & 0xfea00f10) == 0xfc800800) {
94
+ memset(env->pmsav8.rbar[M_REG_S], 0,
96
/* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */
95
+ sizeof(*env->pmsav8.rbar[M_REG_S])
97
int size = extract32(insn, 20, 1);
96
+ * cpu->pmsav7_dregion);
98
data = extract32(insn, 24, 1); /* rot */
97
+ memset(env->pmsav8.rlar[M_REG_S], 0,
98
+ sizeof(*env->pmsav8.rlar[M_REG_S])
99
+ * cpu->pmsav7_dregion);
100
+ }
101
} else if (arm_feature(env, ARM_FEATURE_V7)) {
102
memset(env->pmsav7.drbar, 0,
103
sizeof(*env->pmsav7.drbar) * cpu->pmsav7_dregion);
104
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
105
if (nr) {
106
if (arm_feature(env, ARM_FEATURE_V8)) {
107
/* PMSAv8 */
108
- env->pmsav8.rbar = g_new0(uint32_t, nr);
109
- env->pmsav8.rlar = g_new0(uint32_t, nr);
110
+ env->pmsav8.rbar[M_REG_NS] = g_new0(uint32_t, nr);
111
+ env->pmsav8.rlar[M_REG_NS] = g_new0(uint32_t, nr);
112
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
113
+ env->pmsav8.rbar[M_REG_S] = g_new0(uint32_t, nr);
114
+ env->pmsav8.rlar[M_REG_S] = g_new0(uint32_t, nr);
115
+ }
116
} else {
117
env->pmsav7.drbar = g_new0(uint32_t, nr);
118
env->pmsav7.drsr = g_new0(uint32_t, nr);
119
diff --git a/target/arm/helper.c b/target/arm/helper.c
120
index XXXXXXX..XXXXXXX 100644
121
--- a/target/arm/helper.c
122
+++ b/target/arm/helper.c
123
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address,
124
{
125
ARMCPU *cpu = arm_env_get_cpu(env);
126
bool is_user = regime_is_user(env, mmu_idx);
127
+ uint32_t secure = regime_is_secure(env, mmu_idx);
128
int n;
129
int matchregion = -1;
130
bool hit = false;
131
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address,
132
* with bits [4:0] all zeroes, but the limit address is bits
133
* [31:5] from the register with bits [4:0] all ones.
134
*/
135
- uint32_t base = env->pmsav8.rbar[n] & ~0x1f;
136
- uint32_t limit = env->pmsav8.rlar[n] | 0x1f;
137
+ uint32_t base = env->pmsav8.rbar[secure][n] & ~0x1f;
138
+ uint32_t limit = env->pmsav8.rlar[secure][n] | 0x1f;
139
140
- if (!(env->pmsav8.rlar[n] & 0x1)) {
141
+ if (!(env->pmsav8.rlar[secure][n] & 0x1)) {
142
/* Region disabled */
143
continue;
144
}
145
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address,
146
/* hit using the background region */
147
get_phys_addr_pmsav7_default(env, mmu_idx, address, prot);
148
} else {
149
- uint32_t ap = extract32(env->pmsav8.rbar[matchregion], 1, 2);
150
- uint32_t xn = extract32(env->pmsav8.rbar[matchregion], 0, 1);
151
+ uint32_t ap = extract32(env->pmsav8.rbar[secure][matchregion], 1, 2);
152
+ uint32_t xn = extract32(env->pmsav8.rbar[secure][matchregion], 0, 1);
153
154
if (m_is_system_region(env, address)) {
155
/* System space is always execute never */
156
diff --git a/target/arm/machine.c b/target/arm/machine.c
157
index XXXXXXX..XXXXXXX 100644
158
--- a/target/arm/machine.c
159
+++ b/target/arm/machine.c
160
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav8 = {
161
.minimum_version_id = 1,
162
.needed = pmsav8_needed,
163
.fields = (VMStateField[]) {
164
- VMSTATE_VARRAY_UINT32(env.pmsav8.rbar, ARMCPU, pmsav7_dregion, 0,
165
- vmstate_info_uint32, uint32_t),
166
- VMSTATE_VARRAY_UINT32(env.pmsav8.rlar, ARMCPU, pmsav7_dregion, 0,
167
- vmstate_info_uint32, uint32_t),
168
+ VMSTATE_VARRAY_UINT32(env.pmsav8.rbar[M_REG_NS], ARMCPU, pmsav7_dregion,
169
+ 0, vmstate_info_uint32, uint32_t),
170
+ VMSTATE_VARRAY_UINT32(env.pmsav8.rlar[M_REG_NS], ARMCPU, pmsav7_dregion,
171
+ 0, vmstate_info_uint32, uint32_t),
172
VMSTATE_UINT32(env.pmsav8.mair0[M_REG_NS], ARMCPU),
173
VMSTATE_UINT32(env.pmsav8.mair1[M_REG_NS], ARMCPU),
174
VMSTATE_END_OF_LIST()
175
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
176
VMSTATE_UINT32(env.v7m.vecbase[M_REG_S], ARMCPU),
177
VMSTATE_UINT32(env.pmsav8.mair0[M_REG_S], ARMCPU),
178
VMSTATE_UINT32(env.pmsav8.mair1[M_REG_S], ARMCPU),
179
+ VMSTATE_VARRAY_UINT32(env.pmsav8.rbar[M_REG_S], ARMCPU, pmsav7_dregion,
180
+ 0, vmstate_info_uint32, uint32_t),
181
+ VMSTATE_VARRAY_UINT32(env.pmsav8.rlar[M_REG_S], ARMCPU, pmsav7_dregion,
182
+ 0, vmstate_info_uint32, uint32_t),
183
VMSTATE_END_OF_LIST()
184
}
185
};
186
--
99
--
187
2.7.4
100
2.20.1
188
101
189
102
diff view generated by jsdifflib
1
Implement the new do_transaction_failed hook for ARM, which should
1
Convert the VCADD (vector) insns to decodetree.
2
cause the CPU to take a prefetch abort or data abort.
3
2
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
5
Message-id: 20200430181003.21682-6-peter.maydell@linaro.org
7
Message-id: 1504626814-23124-4-git-send-email-peter.maydell@linaro.org
8
---
6
---
9
target/arm/internals.h | 10 ++++++++++
7
target/arm/neon-shared.decode | 3 +++
10
target/arm/cpu.c | 1 +
8
target/arm/translate-neon.inc.c | 37 +++++++++++++++++++++++++++++++++
11
target/arm/op_helper.c | 43 +++++++++++++++++++++++++++++++++++++++++++
9
target/arm/translate.c | 11 +---------
12
3 files changed, 54 insertions(+)
10
3 files changed, 41 insertions(+), 10 deletions(-)
13
11
14
diff --git a/target/arm/internals.h b/target/arm/internals.h
12
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
15
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/internals.h
14
--- a/target/arm/neon-shared.decode
17
+++ b/target/arm/internals.h
15
+++ b/target/arm/neon-shared.decode
18
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
16
@@ -XXX,XX +XXX,XX @@
19
MMUAccessType access_type,
17
20
int mmu_idx, uintptr_t retaddr);
18
VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \
21
19
vm=%vm_dp vn=%vn_dp vd=%vd_dp
22
+/* arm_cpu_do_transaction_failed: handle a memory system error response
23
+ * (eg "no device/memory present at address") by raising an external abort
24
+ * exception
25
+ */
26
+void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
27
+ vaddr addr, unsigned size,
28
+ MMUAccessType access_type,
29
+ int mmu_idx, MemTxAttrs attrs,
30
+ MemTxResult response, uintptr_t retaddr);
31
+
20
+
32
/* Call the EL change hook if one has been registered */
21
+VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \
33
static inline void arm_call_el_change_hook(ARMCPU *cpu)
22
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
34
{
23
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
35
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
36
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/cpu.c
25
--- a/target/arm/translate-neon.inc.c
38
+++ b/target/arm/cpu.c
26
+++ b/target/arm/translate-neon.inc.c
39
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
27
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA(DisasContext *s, arg_VCMLA *a)
40
#else
28
tcg_temp_free_ptr(fpst);
41
cc->do_interrupt = arm_cpu_do_interrupt;
29
return true;
42
cc->do_unaligned_access = arm_cpu_do_unaligned_access;
43
+ cc->do_transaction_failed = arm_cpu_do_transaction_failed;
44
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
45
cc->asidx_from_attrs = arm_asidx_from_attrs;
46
cc->vmsd = &vmstate_arm_cpu;
47
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/target/arm/op_helper.c
50
+++ b/target/arm/op_helper.c
51
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
52
deliver_fault(cpu, vaddr, access_type, fsr, fsc, &fi);
53
}
30
}
54
31
+
55
+/* arm_cpu_do_transaction_failed: handle a memory system error response
32
+static bool trans_VCADD(DisasContext *s, arg_VCADD *a)
56
+ * (eg "no device/memory present at address") by raising an external abort
57
+ * exception
58
+ */
59
+void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
60
+ vaddr addr, unsigned size,
61
+ MMUAccessType access_type,
62
+ int mmu_idx, MemTxAttrs attrs,
63
+ MemTxResult response, uintptr_t retaddr)
64
+{
33
+{
65
+ ARMCPU *cpu = ARM_CPU(cs);
34
+ int opr_sz;
66
+ CPUARMState *env = &cpu->env;
35
+ TCGv_ptr fpst;
67
+ uint32_t fsr, fsc;
36
+ gen_helper_gvec_3_ptr *fn_gvec_ptr;
68
+ ARMMMUFaultInfo fi = {};
69
+ ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
70
+
37
+
71
+ if (retaddr) {
38
+ if (!dc_isar_feature(aa32_vcma, s)
72
+ /* now we have a real cpu fault */
39
+ || (!a->size && !dc_isar_feature(aa32_fp16_arith, s))) {
73
+ cpu_restore_state(cs, retaddr);
40
+ return false;
74
+ }
41
+ }
75
+
42
+
76
+ /* The EA bit in syndromes and fault status registers is an
43
+ /* UNDEF accesses to D16-D31 if they don't exist. */
77
+ * IMPDEF classification of external aborts. ARM implementations
44
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
78
+ * usually use this to indicate AXI bus Decode error (0) or
45
+ ((a->vd | a->vn | a->vm) & 0x10)) {
79
+ * Slave error (1); in QEMU we follow that.
46
+ return false;
80
+ */
47
+ }
81
+ fi.ea = (response != MEMTX_DECODE_ERROR);
82
+
48
+
83
+ /* The fault status register format depends on whether we're using
49
+ if ((a->vn | a->vm | a->vd) & a->q) {
84
+ * the LPAE long descriptor format, or the short descriptor format.
50
+ return false;
85
+ */
86
+ if (arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
87
+ /* long descriptor form, STATUS 0b010000: synchronous ext abort */
88
+ fsr = (fi.ea << 12) | (1 << 9) | 0x10;
89
+ } else {
90
+ /* short descriptor form, FSR 0b01000 : synchronous ext abort */
91
+ fsr = (fi.ea << 12) | 0x8;
92
+ }
51
+ }
93
+ fsc = 0x10;
94
+
52
+
95
+ deliver_fault(cpu, addr, access_type, fsr, fsc, &fi);
53
+ if (!vfp_access_check(s)) {
54
+ return true;
55
+ }
56
+
57
+ opr_sz = (1 + a->q) * 8;
58
+ fpst = get_fpstatus_ptr(1);
59
+ fn_gvec_ptr = a->size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh;
60
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
61
+ vfp_reg_offset(1, a->vn),
62
+ vfp_reg_offset(1, a->vm),
63
+ fpst, opr_sz, opr_sz, a->rot,
64
+ fn_gvec_ptr);
65
+ tcg_temp_free_ptr(fpst);
66
+ return true;
96
+}
67
+}
97
+
68
diff --git a/target/arm/translate.c b/target/arm/translate.c
98
#endif /* !defined(CONFIG_USER_ONLY) */
69
index XXXXXXX..XXXXXXX 100644
99
70
--- a/target/arm/translate.c
100
uint32_t HELPER(add_setq)(CPUARMState *env, uint32_t a, uint32_t b)
71
+++ b/target/arm/translate.c
72
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
73
bool is_long = false, q = extract32(insn, 6, 1);
74
bool ptr_is_env = false;
75
76
- if ((insn & 0xfea00f10) == 0xfc800800) {
77
- /* VCADD -- 1111 110R 1.0S .... .... 1000 ...0 .... */
78
- int size = extract32(insn, 20, 1);
79
- data = extract32(insn, 24, 1); /* rot */
80
- if (!dc_isar_feature(aa32_vcma, s)
81
- || (!size && !dc_isar_feature(aa32_fp16_arith, s))) {
82
- return 1;
83
- }
84
- fn_gvec_ptr = size ? gen_helper_gvec_fcadds : gen_helper_gvec_fcaddh;
85
- } else if ((insn & 0xfeb00f00) == 0xfc200d00) {
86
+ if ((insn & 0xfeb00f00) == 0xfc200d00) {
87
/* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */
88
bool u = extract32(insn, 4, 1);
89
if (!dc_isar_feature(aa32_dp, s)) {
101
--
90
--
102
2.7.4
91
2.20.1
103
92
104
93
diff view generated by jsdifflib
1
If a v8M CPU supports the security extension then we need to
1
Convert the V[US]DOT (vector) insns to decodetree.
2
give it two AddressSpaces, the same way we do already for
3
an A profile core with EL3.
4
2
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 1503414539-28762-5-git-send-email-peter.maydell@linaro.org
5
Message-id: 20200430181003.21682-7-peter.maydell@linaro.org
8
---
6
---
9
target/arm/cpu.c | 13 ++++++-------
7
target/arm/neon-shared.decode | 4 ++++
10
1 file changed, 6 insertions(+), 7 deletions(-)
8
target/arm/translate-neon.inc.c | 32 ++++++++++++++++++++++++++++++++
9
target/arm/translate.c | 9 +--------
10
3 files changed, 37 insertions(+), 8 deletions(-)
11
11
12
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
12
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
13
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpu.c
14
--- a/target/arm/neon-shared.decode
15
+++ b/target/arm/cpu.c
15
+++ b/target/arm/neon-shared.decode
16
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
16
@@ -XXX,XX +XXX,XX @@ VCMLA 1111 110 rot:2 . 1 size:1 .... .... 1000 . q:1 . 0 .... \
17
init_cpreg_list(cpu);
17
18
18
VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \
19
#ifndef CONFIG_USER_ONLY
19
vm=%vm_dp vn=%vn_dp vd=%vd_dp
20
- if (cpu->has_el3) {
21
- cs->num_ases = 2;
22
- } else {
23
- cs->num_ases = 1;
24
- }
25
-
26
- if (cpu->has_el3) {
27
+ if (cpu->has_el3 || arm_feature(env, ARM_FEATURE_M_SECURITY)) {
28
AddressSpace *as;
29
30
+ cs->num_ases = 2;
31
+
20
+
32
if (!cpu->secure_memory) {
21
+# VUDOT and VSDOT
33
cpu->secure_memory = cs->memory;
22
+VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \
34
}
23
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
35
as = address_space_init_shareable(cpu->secure_memory,
24
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
36
"cpu-secure-memory");
25
index XXXXXXX..XXXXXXX 100644
37
cpu_address_space_init(cs, as, ARMASIdx_S);
26
--- a/target/arm/translate-neon.inc.c
38
+ } else {
27
+++ b/target/arm/translate-neon.inc.c
39
+ cs->num_ases = 1;
28
@@ -XXX,XX +XXX,XX @@ static bool trans_VCADD(DisasContext *s, arg_VCADD *a)
40
}
29
tcg_temp_free_ptr(fpst);
30
return true;
31
}
41
+
32
+
42
cpu_address_space_init(cs,
33
+static bool trans_VDOT(DisasContext *s, arg_VDOT *a)
43
address_space_init_shareable(cs->memory,
34
+{
44
"cpu-memory"),
35
+ int opr_sz;
36
+ gen_helper_gvec_3 *fn_gvec;
37
+
38
+ if (!dc_isar_feature(aa32_dp, s)) {
39
+ return false;
40
+ }
41
+
42
+ /* UNDEF accesses to D16-D31 if they don't exist. */
43
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
44
+ ((a->vd | a->vn | a->vm) & 0x10)) {
45
+ return false;
46
+ }
47
+
48
+ if ((a->vn | a->vm | a->vd) & a->q) {
49
+ return false;
50
+ }
51
+
52
+ if (!vfp_access_check(s)) {
53
+ return true;
54
+ }
55
+
56
+ opr_sz = (1 + a->q) * 8;
57
+ fn_gvec = a->u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b;
58
+ tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd),
59
+ vfp_reg_offset(1, a->vn),
60
+ vfp_reg_offset(1, a->vm),
61
+ opr_sz, opr_sz, 0, fn_gvec);
62
+ return true;
63
+}
64
diff --git a/target/arm/translate.c b/target/arm/translate.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/translate.c
67
+++ b/target/arm/translate.c
68
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
69
bool is_long = false, q = extract32(insn, 6, 1);
70
bool ptr_is_env = false;
71
72
- if ((insn & 0xfeb00f00) == 0xfc200d00) {
73
- /* V[US]DOT -- 1111 1100 0.10 .... .... 1101 .Q.U .... */
74
- bool u = extract32(insn, 4, 1);
75
- if (!dc_isar_feature(aa32_dp, s)) {
76
- return 1;
77
- }
78
- fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b;
79
- } else if ((insn & 0xff300f10) == 0xfc200810) {
80
+ if ((insn & 0xff300f10) == 0xfc200810) {
81
/* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */
82
int is_s = extract32(insn, 23, 1);
83
if (!dc_isar_feature(aa32_fhm, s)) {
45
--
84
--
46
2.7.4
85
2.20.1
47
86
48
87
diff view generated by jsdifflib
1
Make the VTOR register banked if v8M security extensions are enabled.
1
Convert the VFM[AS]L (vector) insns to decodetree. This is the last
2
insn in the legacy decoder for the 3same_ext group, so we can
3
delete the legacy decoder function for the group entirely.
4
5
Note that in disas_thumb2_insn() the parts of this encoding space
6
where the decodetree decoder returns false will correctly be directed
7
to illegal_op by the "(insn & (1 << 28))" check so they won't fall
8
into disas_coproc_insn() by mistake.
2
9
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 1503414539-28762-12-git-send-email-peter.maydell@linaro.org
12
Message-id: 20200430181003.21682-8-peter.maydell@linaro.org
6
---
13
---
7
target/arm/cpu.h | 2 +-
14
target/arm/neon-shared.decode | 6 +++
8
hw/intc/armv7m_nvic.c | 13 +++++++------
15
target/arm/translate-neon.inc.c | 31 +++++++++++
9
target/arm/helper.c | 2 +-
16
target/arm/translate.c | 92 +--------------------------------
10
target/arm/machine.c | 3 ++-
17
3 files changed, 38 insertions(+), 91 deletions(-)
11
4 files changed, 11 insertions(+), 9 deletions(-)
12
18
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
19
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
14
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/cpu.h
21
--- a/target/arm/neon-shared.decode
16
+++ b/target/arm/cpu.h
22
+++ b/target/arm/neon-shared.decode
17
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
23
@@ -XXX,XX +XXX,XX @@ VCADD 1111 110 rot:1 1 . 0 size:1 .... .... 1000 . q:1 . 0 .... \
18
24
# VUDOT and VSDOT
19
struct {
25
VDOT 1111 110 00 . 10 .... .... 1101 . q:1 . u:1 .... \
20
uint32_t other_sp;
26
vm=%vm_dp vn=%vn_dp vd=%vd_dp
21
- uint32_t vecbase;
27
+
22
+ uint32_t vecbase[2];
28
+# VFM[AS]L
23
uint32_t basepri[2];
29
+VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \
24
uint32_t control[2];
30
+ vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0
25
uint32_t ccr; /* Configuration and Control */
31
+VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \
26
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
32
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1
33
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
27
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/intc/armv7m_nvic.c
35
--- a/target/arm/translate-neon.inc.c
29
+++ b/hw/intc/armv7m_nvic.c
36
+++ b/target/arm/translate-neon.inc.c
30
@@ -XXX,XX +XXX,XX @@ static void set_irq_level(void *opaque, int n, int level)
37
@@ -XXX,XX +XXX,XX @@ static bool trans_VDOT(DisasContext *s, arg_VDOT *a)
31
}
38
opr_sz, opr_sz, 0, fn_gvec);
39
return true;
32
}
40
}
33
41
+
34
-static uint32_t nvic_readl(NVICState *s, uint32_t offset)
42
+static bool trans_VFML(DisasContext *s, arg_VFML *a)
35
+static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
43
+{
36
{
44
+ int opr_sz;
37
ARMCPU *cpu = s->cpu;
45
+
38
uint32_t val;
46
+ if (!dc_isar_feature(aa32_fhm, s)) {
39
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset)
47
+ return false;
40
/* ISRPREEMPT not implemented */
48
+ }
41
return val;
49
+
42
case 0xd08: /* Vector Table Offset. */
50
+ /* UNDEF accesses to D16-D31 if they don't exist. */
43
- return cpu->env.v7m.vecbase;
51
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
44
+ return cpu->env.v7m.vecbase[attrs.secure];
52
+ (a->vd & 0x10)) {
45
case 0xd0c: /* Application Interrupt/Reset Control. */
53
+ return false;
46
return 0xfa050000 | (s->prigroup << 8);
54
+ }
47
case 0xd10: /* System Control. */
55
+
48
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset)
56
+ if (a->vd & a->q) {
49
}
57
+ return false;
58
+ }
59
+
60
+ if (!vfp_access_check(s)) {
61
+ return true;
62
+ }
63
+
64
+ opr_sz = (1 + a->q) * 8;
65
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
66
+ vfp_reg_offset(a->q, a->vn),
67
+ vfp_reg_offset(a->q, a->vm),
68
+ cpu_env, opr_sz, opr_sz, a->s, /* is_2 == 0 */
69
+ gen_helper_gvec_fmlal_a32);
70
+ return true;
71
+}
72
diff --git a/target/arm/translate.c b/target/arm/translate.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/translate.c
75
+++ b/target/arm/translate.c
76
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
77
return 0;
50
}
78
}
51
79
52
-static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
80
-/* Advanced SIMD three registers of the same length extension.
53
+static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
81
- * 31 25 23 22 20 16 12 11 10 9 8 3 0
54
+ MemTxAttrs attrs)
82
- * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+
55
{
83
- * | 1 1 1 1 1 1 0 | op1 | D | op2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm |
56
ARMCPU *cpu = s->cpu;
84
- * +---------------+-----+---+-----+----+----+---+----+---+----+---------+----+
57
85
- */
58
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value)
86
-static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn)
87
-{
88
- gen_helper_gvec_3 *fn_gvec = NULL;
89
- gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL;
90
- int rd, rn, rm, opr_sz;
91
- int data = 0;
92
- int off_rn, off_rm;
93
- bool is_long = false, q = extract32(insn, 6, 1);
94
- bool ptr_is_env = false;
95
-
96
- if ((insn & 0xff300f10) == 0xfc200810) {
97
- /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */
98
- int is_s = extract32(insn, 23, 1);
99
- if (!dc_isar_feature(aa32_fhm, s)) {
100
- return 1;
101
- }
102
- is_long = true;
103
- data = is_s; /* is_2 == 0 */
104
- fn_gvec_ptr = gen_helper_gvec_fmlal_a32;
105
- ptr_is_env = true;
106
- } else {
107
- return 1;
108
- }
109
-
110
- VFP_DREG_D(rd, insn);
111
- if (rd & q) {
112
- return 1;
113
- }
114
- if (q || !is_long) {
115
- VFP_DREG_N(rn, insn);
116
- VFP_DREG_M(rm, insn);
117
- if ((rn | rm) & q & !is_long) {
118
- return 1;
119
- }
120
- off_rn = vfp_reg_offset(1, rn);
121
- off_rm = vfp_reg_offset(1, rm);
122
- } else {
123
- rn = VFP_SREG_N(insn);
124
- rm = VFP_SREG_M(insn);
125
- off_rn = vfp_reg_offset(0, rn);
126
- off_rm = vfp_reg_offset(0, rm);
127
- }
128
-
129
- if (s->fp_excp_el) {
130
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
131
- syn_simd_access_trap(1, 0xe, false), s->fp_excp_el);
132
- return 0;
133
- }
134
- if (!s->vfp_enabled) {
135
- return 1;
136
- }
137
-
138
- opr_sz = (1 + q) * 8;
139
- if (fn_gvec_ptr) {
140
- TCGv_ptr ptr;
141
- if (ptr_is_env) {
142
- ptr = cpu_env;
143
- } else {
144
- ptr = get_fpstatus_ptr(1);
145
- }
146
- tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr,
147
- opr_sz, opr_sz, data, fn_gvec_ptr);
148
- if (!ptr_is_env) {
149
- tcg_temp_free_ptr(ptr);
150
- }
151
- } else {
152
- tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm,
153
- opr_sz, opr_sz, data, fn_gvec);
154
- }
155
- return 0;
156
-}
157
-
158
/* Advanced SIMD two registers and a scalar extension.
159
* 31 24 23 22 20 16 12 11 10 9 8 3 0
160
* +-----------------+----+---+----+----+----+---+----+---+----+---------+----+
161
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
162
}
163
}
164
}
165
- } else if ((insn & 0x0e000a00) == 0x0c000800
166
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
167
- if (disas_neon_insn_3same_ext(s, insn)) {
168
- goto illegal_op;
169
- }
170
- return;
171
} else if ((insn & 0x0f000a00) == 0x0e000800
172
&& arm_dc_feature(s, ARM_FEATURE_V8)) {
173
if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
174
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
175
}
176
break;
59
}
177
}
60
break;
178
- if ((insn & 0xfe000a00) == 0xfc000800
61
case 0xd08: /* Vector Table Offset. */
179
+ if ((insn & 0xff000a00) == 0xfe000800
62
- cpu->env.v7m.vecbase = value & 0xffffff80;
180
&& arm_dc_feature(s, ARM_FEATURE_V8)) {
63
+ cpu->env.v7m.vecbase[attrs.secure] = value & 0xffffff80;
181
/* The Thumb2 and ARM encodings are identical. */
64
break;
182
- if (disas_neon_insn_3same_ext(s, insn)) {
65
case 0xd0c: /* Application Interrupt/Reset Control. */
183
- goto illegal_op;
66
if ((value >> 16) == 0x05fa) {
184
- }
67
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr,
185
- } else if ((insn & 0xff000a00) == 0xfe000800
68
break;
186
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
69
default:
187
- /* The Thumb2 and ARM encodings are identical. */
70
if (size == 4) {
188
if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
71
- val = nvic_readl(s, offset);
189
goto illegal_op;
72
+ val = nvic_readl(s, offset, attrs);
190
}
73
} else {
74
qemu_log_mask(LOG_GUEST_ERROR,
75
"NVIC: Bad read of size %d at offset 0x%x\n",
76
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
77
return MEMTX_OK;
78
}
79
if (size == 4) {
80
- nvic_writel(s, offset, value);
81
+ nvic_writel(s, offset, value, attrs);
82
return MEMTX_OK;
83
}
84
qemu_log_mask(LOG_GUEST_ERROR,
85
diff --git a/target/arm/helper.c b/target/arm/helper.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/target/arm/helper.c
88
+++ b/target/arm/helper.c
89
@@ -XXX,XX +XXX,XX @@ static uint32_t arm_v7m_load_vector(ARMCPU *cpu)
90
CPUState *cs = CPU(cpu);
91
CPUARMState *env = &cpu->env;
92
MemTxResult result;
93
- hwaddr vec = env->v7m.vecbase + env->v7m.exception * 4;
94
+ hwaddr vec = env->v7m.vecbase[env->v7m.secure] + env->v7m.exception * 4;
95
uint32_t addr;
96
97
addr = address_space_ldl(cs->as, vec,
98
diff --git a/target/arm/machine.c b/target/arm/machine.c
99
index XXXXXXX..XXXXXXX 100644
100
--- a/target/arm/machine.c
101
+++ b/target/arm/machine.c
102
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
103
.minimum_version_id = 4,
104
.needed = m_needed,
105
.fields = (VMStateField[]) {
106
- VMSTATE_UINT32(env.v7m.vecbase, ARMCPU),
107
+ VMSTATE_UINT32(env.v7m.vecbase[M_REG_NS], ARMCPU),
108
VMSTATE_UINT32(env.v7m.basepri[M_REG_NS], ARMCPU),
109
VMSTATE_UINT32(env.v7m.control[M_REG_NS], ARMCPU),
110
VMSTATE_UINT32(env.v7m.ccr, ARMCPU),
111
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
112
VMSTATE_UINT32(env.v7m.primask[M_REG_S], ARMCPU),
113
VMSTATE_UINT32(env.v7m.faultmask[M_REG_S], ARMCPU),
114
VMSTATE_UINT32(env.v7m.control[M_REG_S], ARMCPU),
115
+ VMSTATE_UINT32(env.v7m.vecbase[M_REG_S], ARMCPU),
116
VMSTATE_END_OF_LIST()
117
}
118
};
119
--
191
--
120
2.7.4
192
2.20.1
121
193
122
194
diff view generated by jsdifflib
1
Implement the BXNS v8M instruction, which is like BX but will do a
1
Convert VCMLA (scalar) in the 2reg-scalar-ext group to decodetree.
2
jump-and-switch-to-NonSecure if the branch target address has bit 0
3
clear.
4
5
This is the first piece of code which implements "switch to the
6
other security state", so the commit also includes the code to
7
switch the stack pointers around, which is the only complicated
8
part of switching security state.
9
10
BLXNS is more complicated than just "BXNS but set the link register",
11
so we leave it for a separate commit.
12
2
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 1503414539-28762-21-git-send-email-peter.maydell@linaro.org
5
Message-id: 20200430181003.21682-9-peter.maydell@linaro.org
16
---
6
---
17
target/arm/cpu.h | 13 +++++++++
7
target/arm/neon-shared.decode | 5 +++++
18
target/arm/helper.h | 2 ++
8
target/arm/translate-neon.inc.c | 40 +++++++++++++++++++++++++++++++++
19
target/arm/translate.h | 1 +
9
target/arm/translate.c | 26 +--------------------
20
target/arm/helper.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++
10
3 files changed, 46 insertions(+), 25 deletions(-)
21
target/arm/machine.c | 2 ++
22
target/arm/translate.c | 42 ++++++++++++++++++++++++++-
23
6 files changed, 138 insertions(+), 1 deletion(-)
24
11
25
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
12
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
26
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
27
--- a/target/arm/cpu.h
14
--- a/target/arm/neon-shared.decode
28
+++ b/target/arm/cpu.h
15
+++ b/target/arm/neon-shared.decode
29
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
16
@@ -XXX,XX +XXX,XX @@ VFML 1111 110 0 s:1 . 10 .... .... 1000 . 0 . 1 .... \
30
} cp15;
17
vm=%vm_sp vn=%vn_sp vd=%vd_dp q=0
31
18
VFML 1111 110 0 s:1 . 10 .... .... 1000 . 1 . 1 .... \
32
struct {
19
vm=%vm_dp vn=%vn_dp vd=%vd_dp q=1
33
+ /* M profile has up to 4 stack pointers:
20
+
34
+ * a Main Stack Pointer and a Process Stack Pointer for each
21
+VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \
35
+ * of the Secure and Non-Secure states. (If the CPU doesn't support
22
+ vn=%vn_dp vd=%vd_dp size=0
36
+ * the security extension then it has only two SPs.)
23
+VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \
37
+ * In QEMU we always store the currently active SP in regs[13],
24
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0
38
+ * and the non-active SP for the current security state in
25
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
39
+ * v7m.other_sp. The stack pointers for the inactive security state
40
+ * are stored in other_ss_msp and other_ss_psp.
41
+ * switch_v7m_security_state() is responsible for rearranging them
42
+ * when we change security state.
43
+ */
44
uint32_t other_sp;
45
+ uint32_t other_ss_msp;
46
+ uint32_t other_ss_psp;
47
uint32_t vecbase[2];
48
uint32_t basepri[2];
49
uint32_t control[2];
50
diff --git a/target/arm/helper.h b/target/arm/helper.h
51
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/helper.h
27
--- a/target/arm/translate-neon.inc.c
53
+++ b/target/arm/helper.h
28
+++ b/target/arm/translate-neon.inc.c
54
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_1(cpsr_read, i32, env)
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VFML(DisasContext *s, arg_VFML *a)
55
DEF_HELPER_3(v7m_msr, void, env, i32, i32)
30
gen_helper_gvec_fmlal_a32);
56
DEF_HELPER_2(v7m_mrs, i32, env, i32)
31
return true;
57
32
}
58
+DEF_HELPER_2(v7m_bxns, void, env, i32)
59
+
33
+
60
DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32)
34
+static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a)
61
DEF_HELPER_3(set_cp_reg, void, env, ptr, i32)
62
DEF_HELPER_2(get_cp_reg, i32, env, ptr)
63
diff --git a/target/arm/translate.h b/target/arm/translate.h
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/translate.h
66
+++ b/target/arm/translate.h
67
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
68
int vec_len;
69
int vec_stride;
70
bool v7m_handler_mode;
71
+ bool v8m_secure; /* true if v8M and we're in Secure mode */
72
/* Immediate value in AArch32 SVC insn; must be set if is_jmp == DISAS_SWI
73
* so that top level loop can generate correct syndrome information.
74
*/
75
diff --git a/target/arm/helper.c b/target/arm/helper.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/helper.c
78
+++ b/target/arm/helper.c
79
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
80
return 0;
81
}
82
83
+void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
84
+{
35
+{
85
+ /* translate.c should never generate calls here in user-only mode */
36
+ gen_helper_gvec_3_ptr *fn_gvec_ptr;
86
+ g_assert_not_reached();
37
+ int opr_sz;
87
+}
38
+ TCGv_ptr fpst;
88
+
39
+
89
void switch_mode(CPUARMState *env, int mode)
40
+ if (!dc_isar_feature(aa32_vcma, s)) {
90
{
41
+ return false;
91
ARMCPU *cpu = arm_env_get_cpu(env);
42
+ }
92
@@ -XXX,XX +XXX,XX @@ static uint32_t v7m_pop(CPUARMState *env)
43
+ if (a->size == 0 && !dc_isar_feature(aa32_fp16_arith, s)) {
93
return val;
44
+ return false;
94
}
95
96
+/* Return true if we're using the process stack pointer (not the MSP) */
97
+static bool v7m_using_psp(CPUARMState *env)
98
+{
99
+ /* Handler mode always uses the main stack; for thread mode
100
+ * the CONTROL.SPSEL bit determines the answer.
101
+ * Note that in v7M it is not possible to be in Handler mode with
102
+ * CONTROL.SPSEL non-zero, but in v8M it is, so we must check both.
103
+ */
104
+ return !arm_v7m_is_handler_mode(env) &&
105
+ env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK;
106
+}
107
+
108
/* Switch to V7M main or process stack pointer. */
109
static void switch_v7m_sp(CPUARMState *env, bool new_spsel)
110
{
111
@@ -XXX,XX +XXX,XX @@ static void switch_v7m_sp(CPUARMState *env, bool new_spsel)
112
}
113
}
114
115
+/* Switch M profile security state between NS and S */
116
+static void switch_v7m_security_state(CPUARMState *env, bool new_secstate)
117
+{
118
+ uint32_t new_ss_msp, new_ss_psp;
119
+
120
+ if (env->v7m.secure == new_secstate) {
121
+ return;
122
+ }
45
+ }
123
+
46
+
124
+ /* All the banked state is accessed by looking at env->v7m.secure
47
+ /* UNDEF accesses to D16-D31 if they don't exist. */
125
+ * except for the stack pointer; rearrange the SP appropriately.
48
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
126
+ */
49
+ ((a->vd | a->vn | a->vm) & 0x10)) {
127
+ new_ss_msp = env->v7m.other_ss_msp;
50
+ return false;
128
+ new_ss_psp = env->v7m.other_ss_psp;
129
+
130
+ if (v7m_using_psp(env)) {
131
+ env->v7m.other_ss_psp = env->regs[13];
132
+ env->v7m.other_ss_msp = env->v7m.other_sp;
133
+ } else {
134
+ env->v7m.other_ss_msp = env->regs[13];
135
+ env->v7m.other_ss_psp = env->v7m.other_sp;
136
+ }
51
+ }
137
+
52
+
138
+ env->v7m.secure = new_secstate;
53
+ if ((a->vd | a->vn) & a->q) {
139
+
54
+ return false;
140
+ if (v7m_using_psp(env)) {
141
+ env->regs[13] = new_ss_psp;
142
+ env->v7m.other_sp = new_ss_msp;
143
+ } else {
144
+ env->regs[13] = new_ss_msp;
145
+ env->v7m.other_sp = new_ss_psp;
146
+ }
147
+}
148
+
149
+void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
150
+{
151
+ /* Handle v7M BXNS:
152
+ * - if the return value is a magic value, do exception return (like BX)
153
+ * - otherwise bit 0 of the return value is the target security state
154
+ */
155
+ if (dest >= 0xff000000) {
156
+ /* This is an exception return magic value; put it where
157
+ * do_v7m_exception_exit() expects and raise EXCEPTION_EXIT.
158
+ * Note that if we ever add gen_ss_advance() singlestep support to
159
+ * M profile this should count as an "instruction execution complete"
160
+ * event (compare gen_bx_excret_final_code()).
161
+ */
162
+ env->regs[15] = dest & ~1;
163
+ env->thumb = dest & 1;
164
+ HELPER(exception_internal)(env, EXCP_EXCEPTION_EXIT);
165
+ /* notreached */
166
+ }
55
+ }
167
+
56
+
168
+ /* translate.c should have made BXNS UNDEF unless we're secure */
57
+ if (!vfp_access_check(s)) {
169
+ assert(env->v7m.secure);
58
+ return true;
59
+ }
170
+
60
+
171
+ switch_v7m_security_state(env, dest & 1);
61
+ fn_gvec_ptr = (a->size ? gen_helper_gvec_fcmlas_idx
172
+ env->thumb = 1;
62
+ : gen_helper_gvec_fcmlah_idx);
173
+ env->regs[15] = dest & ~1;
63
+ opr_sz = (1 + a->q) * 8;
64
+ fpst = get_fpstatus_ptr(1);
65
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
66
+ vfp_reg_offset(1, a->vn),
67
+ vfp_reg_offset(1, a->vm),
68
+ fpst, opr_sz, opr_sz,
69
+ (a->index << 2) | a->rot, fn_gvec_ptr);
70
+ tcg_temp_free_ptr(fpst);
71
+ return true;
174
+}
72
+}
175
+
176
static uint32_t arm_v7m_load_vector(ARMCPU *cpu)
177
{
178
CPUState *cs = CPU(cpu);
179
diff --git a/target/arm/machine.c b/target/arm/machine.c
180
index XXXXXXX..XXXXXXX 100644
181
--- a/target/arm/machine.c
182
+++ b/target/arm/machine.c
183
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
184
.needed = m_security_needed,
185
.fields = (VMStateField[]) {
186
VMSTATE_UINT32(env.v7m.secure, ARMCPU),
187
+ VMSTATE_UINT32(env.v7m.other_ss_msp, ARMCPU),
188
+ VMSTATE_UINT32(env.v7m.other_ss_psp, ARMCPU),
189
VMSTATE_UINT32(env.v7m.basepri[M_REG_S], ARMCPU),
190
VMSTATE_UINT32(env.v7m.primask[M_REG_S], ARMCPU),
191
VMSTATE_UINT32(env.v7m.faultmask[M_REG_S], ARMCPU),
192
diff --git a/target/arm/translate.c b/target/arm/translate.c
73
diff --git a/target/arm/translate.c b/target/arm/translate.c
193
index XXXXXXX..XXXXXXX 100644
74
index XXXXXXX..XXXXXXX 100644
194
--- a/target/arm/translate.c
75
--- a/target/arm/translate.c
195
+++ b/target/arm/translate.c
76
+++ b/target/arm/translate.c
196
@@ -XXX,XX +XXX,XX @@ static inline void gen_bx_excret_final_code(DisasContext *s)
77
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)
197
gen_exception_internal(EXCP_EXCEPTION_EXIT);
78
bool is_long = false, q = extract32(insn, 6, 1);
198
}
79
bool ptr_is_env = false;
199
80
200
+static inline void gen_bxns(DisasContext *s, int rm)
81
- if ((insn & 0xff000f10) == 0xfe000800) {
201
+{
82
- /* VCMLA (indexed) -- 1111 1110 S.RR .... .... 1000 ...0 .... */
202
+ TCGv_i32 var = load_reg(s, rm);
83
- int rot = extract32(insn, 20, 2);
203
+
84
- int size = extract32(insn, 23, 1);
204
+ /* The bxns helper may raise an EXCEPTION_EXIT exception, so in theory
85
- int index;
205
+ * we need to sync state before calling it, but:
86
-
206
+ * - we don't need to do gen_set_pc_im() because the bxns helper will
87
- if (!dc_isar_feature(aa32_vcma, s)) {
207
+ * always set the PC itself
88
- return 1;
208
+ * - we don't need to do gen_set_condexec() because BXNS is UNPREDICTABLE
89
- }
209
+ * unless it's outside an IT block or the last insn in an IT block,
90
- if (size == 0) {
210
+ * so we know that condexec == 0 (already set at the top of the TB)
91
- if (!dc_isar_feature(aa32_fp16_arith, s)) {
211
+ * is correct in the non-UNPREDICTABLE cases, and we can choose
92
- return 1;
212
+ * "zeroes the IT bits" as our UNPREDICTABLE behaviour otherwise.
93
- }
213
+ */
94
- /* For fp16, rm is just Vm, and index is M. */
214
+ gen_helper_v7m_bxns(cpu_env, var);
95
- rm = extract32(insn, 0, 4);
215
+ tcg_temp_free_i32(var);
96
- index = extract32(insn, 5, 1);
216
+ s->is_jmp = DISAS_EXIT;
97
- } else {
217
+}
98
- /* For fp32, rm is the usual M:Vm, and index is 0. */
218
+
99
- VFP_DREG_M(rm, insn);
219
/* Variant of store_reg which uses branch&exchange logic when storing
100
- index = 0;
220
to r15 in ARM architecture v7 and above. The source must be a temporary
101
- }
221
and will be marked as dead. */
102
- data = (index << 2) | rot;
222
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
103
- fn_gvec_ptr = (size ? gen_helper_gvec_fcmlas_idx
223
*/
104
- : gen_helper_gvec_fcmlah_idx);
224
bool link = insn & (1 << 7);
105
- } else if ((insn & 0xffb00f00) == 0xfe200d00) {
225
106
+ if ((insn & 0xffb00f00) == 0xfe200d00) {
226
- if (insn & 7) {
107
/* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */
227
+ if (insn & 3) {
108
int u = extract32(insn, 4, 1);
228
goto undef;
229
}
230
if (link) {
231
ARCH(5);
232
}
233
+ if ((insn & 4)) {
234
+ /* BXNS/BLXNS: only exists for v8M with the
235
+ * security extensions, and always UNDEF if NonSecure.
236
+ * We don't implement these in the user-only mode
237
+ * either (in theory you can use them from Secure User
238
+ * mode but they are too tied in to system emulation.)
239
+ */
240
+ if (!s->v8m_secure || IS_USER_ONLY) {
241
+ goto undef;
242
+ }
243
+ if (link) {
244
+ /* BLXNS: not yet implemented */
245
+ goto undef;
246
+ } else {
247
+ gen_bxns(s, rm);
248
+ }
249
+ break;
250
+ }
251
+ /* BLX/BX */
252
tmp = load_reg(s, rm);
253
if (link) {
254
val = (uint32_t)s->pc | 1;
255
@@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
256
dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags);
257
dc->c15_cpar = ARM_TBFLAG_XSCALE_CPAR(tb->flags);
258
dc->v7m_handler_mode = ARM_TBFLAG_HANDLER(tb->flags);
259
+ dc->v8m_secure = arm_feature(env, ARM_FEATURE_M_SECURITY) &&
260
+ regime_is_secure(env, dc->mmu_idx);
261
dc->cp_regs = cpu->cp_regs;
262
dc->features = env->features;
263
109
264
--
110
--
265
2.7.4
111
2.20.1
266
112
267
113
diff view generated by jsdifflib
1
Make the BASEPRI register banked if v8M security extensions are enabled.
1
Convert the V[US]DOT (scalar) insns in the 2reg-scalar-ext group
2
2
to decodetree.
3
Note that we do not yet implement the functionality of the new
4
AIRCR.PRIS bit (which allows the effect of the NS copy of BASEPRI to
5
be restricted).
6
3
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 1503414539-28762-7-git-send-email-peter.maydell@linaro.org
6
Message-id: 20200430181003.21682-10-peter.maydell@linaro.org
10
---
7
---
11
target/arm/cpu.h | 14 +++++++++++++-
8
target/arm/neon-shared.decode | 3 +++
12
hw/intc/armv7m_nvic.c | 4 ++--
9
target/arm/translate-neon.inc.c | 35 +++++++++++++++++++++++++++++++++
13
target/arm/helper.c | 10 ++++++----
10
target/arm/translate.c | 13 +-----------
14
target/arm/machine.c | 3 ++-
11
3 files changed, 39 insertions(+), 12 deletions(-)
15
4 files changed, 23 insertions(+), 8 deletions(-)
16
12
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
15
--- a/target/arm/neon-shared.decode
20
+++ b/target/arm/cpu.h
16
+++ b/target/arm/neon-shared.decode
21
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 0 . rot:2 .... .... 1000 . q:1 index:1 0 vm:4 \
22
#define ARMV7M_EXCP_PENDSV 14
18
vn=%vn_dp vd=%vd_dp size=0
23
#define ARMV7M_EXCP_SYSTICK 15
19
VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \
24
20
vm=%vm_dp vn=%vn_dp vd=%vd_dp size=1 index=0
25
+/* For M profile, some registers are banked secure vs non-secure;
26
+ * these are represented as a 2-element array where the first element
27
+ * is the non-secure copy and the second is the secure copy.
28
+ * When the CPU does not have implement the security extension then
29
+ * only the first element is used.
30
+ * This means that the copy for the current security state can be
31
+ * accessed via env->registerfield[env->v7m.secure] (whether the security
32
+ * extension is implemented or not).
33
+ */
34
+#define M_REG_NS 0
35
+#define M_REG_S 1
36
+
21
+
37
/* ARM-specific interrupt pending bits. */
22
+VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \
38
#define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1
23
+ vm=%vm_dp vn=%vn_dp vd=%vd_dp
39
#define CPU_INTERRUPT_VIRQ CPU_INTERRUPT_TGT_EXT_2
24
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
40
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
41
struct {
42
uint32_t other_sp;
43
uint32_t vecbase;
44
- uint32_t basepri;
45
+ uint32_t basepri[2];
46
uint32_t control;
47
uint32_t ccr; /* Configuration and Control */
48
uint32_t cfsr; /* Configurable Fault Status */
49
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
50
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/intc/armv7m_nvic.c
26
--- a/target/arm/translate-neon.inc.c
52
+++ b/hw/intc/armv7m_nvic.c
27
+++ b/target/arm/translate-neon.inc.c
53
@@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s)
28
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMLA_scalar(DisasContext *s, arg_VCMLA_scalar *a)
54
running = -1;
29
tcg_temp_free_ptr(fpst);
55
} else if (env->v7m.primask) {
30
return true;
56
running = 0;
31
}
57
- } else if (env->v7m.basepri > 0) {
32
+
58
- running = env->v7m.basepri & nvic_gprio_mask(s);
33
+static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a)
59
+ } else if (env->v7m.basepri[env->v7m.secure] > 0) {
34
+{
60
+ running = env->v7m.basepri[env->v7m.secure] & nvic_gprio_mask(s);
35
+ gen_helper_gvec_3 *fn_gvec;
61
} else {
36
+ int opr_sz;
62
running = NVIC_NOEXC_PRIO; /* lower than any possible priority */
37
+ TCGv_ptr fpst;
63
}
38
+
64
diff --git a/target/arm/helper.c b/target/arm/helper.c
39
+ if (!dc_isar_feature(aa32_dp, s)) {
40
+ return false;
41
+ }
42
+
43
+ /* UNDEF accesses to D16-D31 if they don't exist. */
44
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
45
+ ((a->vd | a->vn) & 0x10)) {
46
+ return false;
47
+ }
48
+
49
+ if ((a->vd | a->vn) & a->q) {
50
+ return false;
51
+ }
52
+
53
+ if (!vfp_access_check(s)) {
54
+ return true;
55
+ }
56
+
57
+ fn_gvec = a->u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b;
58
+ opr_sz = (1 + a->q) * 8;
59
+ fpst = get_fpstatus_ptr(1);
60
+ tcg_gen_gvec_3_ool(vfp_reg_offset(1, a->vd),
61
+ vfp_reg_offset(1, a->vn),
62
+ vfp_reg_offset(1, a->rm),
63
+ opr_sz, opr_sz, a->index, fn_gvec);
64
+ tcg_temp_free_ptr(fpst);
65
+ return true;
66
+}
67
diff --git a/target/arm/translate.c b/target/arm/translate.c
65
index XXXXXXX..XXXXXXX 100644
68
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/helper.c
69
--- a/target/arm/translate.c
67
+++ b/target/arm/helper.c
70
+++ b/target/arm/translate.c
68
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
71
@@ -XXX,XX +XXX,XX @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)
69
return env->v7m.primask;
72
bool is_long = false, q = extract32(insn, 6, 1);
70
case 17: /* BASEPRI */
73
bool ptr_is_env = false;
71
case 18: /* BASEPRI_MAX */
74
72
- return env->v7m.basepri;
75
- if ((insn & 0xffb00f00) == 0xfe200d00) {
73
+ return env->v7m.basepri[env->v7m.secure];
76
- /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */
74
case 19: /* FAULTMASK */
77
- int u = extract32(insn, 4, 1);
75
return env->v7m.faultmask;
78
-
76
default:
79
- if (!dc_isar_feature(aa32_dp, s)) {
77
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
80
- return 1;
78
env->v7m.primask = val & 1;
81
- }
79
break;
82
- fn_gvec = u ? gen_helper_gvec_udot_idx_b : gen_helper_gvec_sdot_idx_b;
80
case 17: /* BASEPRI */
83
- /* rm is just Vm, and index is M. */
81
- env->v7m.basepri = val & 0xff;
84
- data = extract32(insn, 5, 1); /* index */
82
+ env->v7m.basepri[env->v7m.secure] = val & 0xff;
85
- rm = extract32(insn, 0, 4);
83
break;
86
- } else if ((insn & 0xffa00f10) == 0xfe000810) {
84
case 18: /* BASEPRI_MAX */
87
+ if ((insn & 0xffa00f10) == 0xfe000810) {
85
val &= 0xff;
88
/* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */
86
- if (val != 0 && (val < env->v7m.basepri || env->v7m.basepri == 0))
89
int is_s = extract32(insn, 20, 1);
87
- env->v7m.basepri = val;
90
int vm20 = extract32(insn, 0, 3);
88
+ if (val != 0 && (val < env->v7m.basepri[env->v7m.secure]
89
+ || env->v7m.basepri[env->v7m.secure] == 0)) {
90
+ env->v7m.basepri[env->v7m.secure] = val;
91
+ }
92
break;
93
case 19: /* FAULTMASK */
94
env->v7m.faultmask = val & 1;
95
diff --git a/target/arm/machine.c b/target/arm/machine.c
96
index XXXXXXX..XXXXXXX 100644
97
--- a/target/arm/machine.c
98
+++ b/target/arm/machine.c
99
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
100
.needed = m_needed,
101
.fields = (VMStateField[]) {
102
VMSTATE_UINT32(env.v7m.vecbase, ARMCPU),
103
- VMSTATE_UINT32(env.v7m.basepri, ARMCPU),
104
+ VMSTATE_UINT32(env.v7m.basepri[M_REG_NS], ARMCPU),
105
VMSTATE_UINT32(env.v7m.control, ARMCPU),
106
VMSTATE_UINT32(env.v7m.ccr, ARMCPU),
107
VMSTATE_UINT32(env.v7m.cfsr, ARMCPU),
108
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
109
.needed = m_security_needed,
110
.fields = (VMStateField[]) {
111
VMSTATE_UINT32(env.v7m.secure, ARMCPU),
112
+ VMSTATE_UINT32(env.v7m.basepri[M_REG_S], ARMCPU),
113
VMSTATE_END_OF_LIST()
114
}
115
};
116
--
91
--
117
2.7.4
92
2.20.1
118
93
119
94
diff view generated by jsdifflib
1
Set the MachineClass flag ignore_memory_transaction_failures
1
Convert the VFM[AS]L (scalar) insns in the 2reg-scalar-ext group
2
for almost all ARM boards. This means they retain the legacy
2
to decodetree. These are the last ones in the group so we can remove
3
behaviour that accesses to unimplemented addresses will RAZ/WI
3
all the legacy decode for the group.
4
rather than aborting, when a subsequent commit adds support
4
5
for external aborts.
5
Note that in disas_thumb2_insn() the parts of this encoding space
6
6
where the decodetree decoder returns false will correctly be directed
7
The exceptions are:
7
to illegal_op by the "(insn & (1 << 28))" check so they won't fall
8
* virt -- we know that guests won't try to prod devices
8
into disas_coproc_insn() by mistake.
9
that we don't describe in the device tree or ACPI tables
10
* mps2 -- this board was written to use unimplemented-device
11
for all the ranges with devices we don't yet handle
12
13
New boards should not set the flag, but instead be written
14
like the mps2.
15
9
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 1504626814-23124-3-git-send-email-peter.maydell@linaro.org
12
Message-id: 20200430181003.21682-11-peter.maydell@linaro.org
19
For the Xilinx boards:
20
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
21
---
13
---
22
hw/arm/aspeed.c | 3 +++
14
target/arm/neon-shared.decode | 7 +++
23
hw/arm/collie.c | 1 +
15
target/arm/translate-neon.inc.c | 32 ++++++++++
24
hw/arm/cubieboard.c | 1 +
16
target/arm/translate.c | 107 +-------------------------------
25
hw/arm/digic_boards.c | 1 +
17
3 files changed, 40 insertions(+), 106 deletions(-)
26
hw/arm/exynos4_boards.c | 2 ++
18
27
hw/arm/gumstix.c | 2 ++
19
diff --git a/target/arm/neon-shared.decode b/target/arm/neon-shared.decode
28
hw/arm/highbank.c | 2 ++
29
hw/arm/imx25_pdk.c | 1 +
30
hw/arm/integratorcp.c | 1 +
31
hw/arm/kzm.c | 1 +
32
hw/arm/mainstone.c | 1 +
33
hw/arm/musicpal.c | 1 +
34
hw/arm/netduino2.c | 1 +
35
hw/arm/nseries.c | 2 ++
36
hw/arm/omap_sx1.c | 2 ++
37
hw/arm/palm.c | 1 +
38
hw/arm/raspi.c | 1 +
39
hw/arm/realview.c | 4 ++++
40
hw/arm/sabrelite.c | 1 +
41
hw/arm/spitz.c | 4 ++++
42
hw/arm/stellaris.c | 2 ++
43
hw/arm/tosa.c | 1 +
44
hw/arm/versatilepb.c | 2 ++
45
hw/arm/vexpress.c | 1 +
46
hw/arm/xilinx_zynq.c | 1 +
47
hw/arm/xlnx-ep108.c | 2 ++
48
hw/arm/z2.c | 1 +
49
27 files changed, 43 insertions(+)
50
51
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
52
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
53
--- a/hw/arm/aspeed.c
21
--- a/target/arm/neon-shared.decode
54
+++ b/hw/arm/aspeed.c
22
+++ b/target/arm/neon-shared.decode
55
@@ -XXX,XX +XXX,XX @@ static void palmetto_bmc_class_init(ObjectClass *oc, void *data)
23
@@ -XXX,XX +XXX,XX @@ VCMLA_scalar 1111 1110 1 . rot:2 .... .... 1000 . q:1 . 0 .... \
56
mc->no_floppy = 1;
24
57
mc->no_cdrom = 1;
25
VDOT_scalar 1111 1110 0 . 10 .... .... 1101 . q:1 index:1 u:1 rm:4 \
58
mc->no_parallel = 1;
26
vm=%vm_dp vn=%vn_dp vd=%vd_dp
59
+ mc->ignore_memory_transaction_failures = true;
27
+
28
+%vfml_scalar_q0_rm 0:3 5:1
29
+%vfml_scalar_q1_index 5:1 3:1
30
+VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 0 . 1 index:1 ... \
31
+ rm=%vfml_scalar_q0_rm vn=%vn_sp vd=%vd_dp q=0
32
+VFML_scalar 1111 1110 0 . 0 s:1 .... .... 1000 . 1 . 1 . rm:3 \
33
+ index=%vfml_scalar_q1_index vn=%vn_dp vd=%vd_dp q=1
34
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/translate-neon.inc.c
37
+++ b/target/arm/translate-neon.inc.c
38
@@ -XXX,XX +XXX,XX @@ static bool trans_VDOT_scalar(DisasContext *s, arg_VDOT_scalar *a)
39
tcg_temp_free_ptr(fpst);
40
return true;
60
}
41
}
61
42
+
62
static const TypeInfo palmetto_bmc_type = {
43
+static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a)
63
@@ -XXX,XX +XXX,XX @@ static void ast2500_evb_class_init(ObjectClass *oc, void *data)
44
+{
64
mc->no_floppy = 1;
45
+ int opr_sz;
65
mc->no_cdrom = 1;
46
+
66
mc->no_parallel = 1;
47
+ if (!dc_isar_feature(aa32_fhm, s)) {
67
+ mc->ignore_memory_transaction_failures = true;
48
+ return false;
49
+ }
50
+
51
+ /* UNDEF accesses to D16-D31 if they don't exist. */
52
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
53
+ ((a->vd & 0x10) || (a->q && (a->vn & 0x10)))) {
54
+ return false;
55
+ }
56
+
57
+ if (a->vd & a->q) {
58
+ return false;
59
+ }
60
+
61
+ if (!vfp_access_check(s)) {
62
+ return true;
63
+ }
64
+
65
+ opr_sz = (1 + a->q) * 8;
66
+ tcg_gen_gvec_3_ptr(vfp_reg_offset(1, a->vd),
67
+ vfp_reg_offset(a->q, a->vn),
68
+ vfp_reg_offset(a->q, a->rm),
69
+ cpu_env, opr_sz, opr_sz,
70
+ (a->index << 2) | a->s, /* is_2 == 0 */
71
+ gen_helper_gvec_fmlal_idx_a32);
72
+ return true;
73
+}
74
diff --git a/target/arm/translate.c b/target/arm/translate.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/target/arm/translate.c
77
+++ b/target/arm/translate.c
78
@@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
68
}
79
}
69
80
70
static const TypeInfo ast2500_evb_type = {
81
#define VFP_REG_SHR(x, n) (((n) > 0) ? (x) >> (n) : (x) << -(n))
71
@@ -XXX,XX +XXX,XX @@ static void romulus_bmc_class_init(ObjectClass *oc, void *data)
82
-#define VFP_SREG(insn, bigbit, smallbit) \
72
mc->no_floppy = 1;
83
- ((VFP_REG_SHR(insn, bigbit - 1) & 0x1e) | (((insn) >> (smallbit)) & 1))
73
mc->no_cdrom = 1;
84
#define VFP_DREG(reg, insn, bigbit, smallbit) do { \
74
mc->no_parallel = 1;
85
if (dc_isar_feature(aa32_simd_r32, s)) { \
75
+ mc->ignore_memory_transaction_failures = true;
86
reg = (((insn) >> (bigbit)) & 0x0f) \
87
@@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
88
reg = ((insn) >> (bigbit)) & 0x0f; \
89
}} while (0)
90
91
-#define VFP_SREG_D(insn) VFP_SREG(insn, 12, 22)
92
#define VFP_DREG_D(reg, insn) VFP_DREG(reg, insn, 12, 22)
93
-#define VFP_SREG_N(insn) VFP_SREG(insn, 16, 7)
94
#define VFP_DREG_N(reg, insn) VFP_DREG(reg, insn, 16, 7)
95
-#define VFP_SREG_M(insn) VFP_SREG(insn, 0, 5)
96
#define VFP_DREG_M(reg, insn) VFP_DREG(reg, insn, 0, 5)
97
98
static void gen_neon_dup_low16(TCGv_i32 var)
99
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
100
return 0;
76
}
101
}
77
102
78
static const TypeInfo romulus_bmc_type = {
103
-/* Advanced SIMD two registers and a scalar extension.
79
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
104
- * 31 24 23 22 20 16 12 11 10 9 8 3 0
80
index XXXXXXX..XXXXXXX 100644
105
- * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+
81
--- a/hw/arm/collie.c
106
- * | 1 1 1 1 1 1 1 0 | o1 | D | o2 | Vn | Vd | 1 | o3 | 0 | o4 | N Q M U | Vm |
82
+++ b/hw/arm/collie.c
107
- * +-----------------+----+---+----+----+----+---+----+---+----+---------+----+
83
@@ -XXX,XX +XXX,XX @@ static void collie_machine_init(MachineClass *mc)
108
- *
109
- */
110
-
111
-static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn)
112
-{
113
- gen_helper_gvec_3 *fn_gvec = NULL;
114
- gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL;
115
- int rd, rn, rm, opr_sz, data;
116
- int off_rn, off_rm;
117
- bool is_long = false, q = extract32(insn, 6, 1);
118
- bool ptr_is_env = false;
119
-
120
- if ((insn & 0xffa00f10) == 0xfe000810) {
121
- /* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */
122
- int is_s = extract32(insn, 20, 1);
123
- int vm20 = extract32(insn, 0, 3);
124
- int vm3 = extract32(insn, 3, 1);
125
- int m = extract32(insn, 5, 1);
126
- int index;
127
-
128
- if (!dc_isar_feature(aa32_fhm, s)) {
129
- return 1;
130
- }
131
- if (q) {
132
- rm = vm20;
133
- index = m * 2 + vm3;
134
- } else {
135
- rm = vm20 * 2 + m;
136
- index = vm3;
137
- }
138
- is_long = true;
139
- data = (index << 2) | is_s; /* is_2 == 0 */
140
- fn_gvec_ptr = gen_helper_gvec_fmlal_idx_a32;
141
- ptr_is_env = true;
142
- } else {
143
- return 1;
144
- }
145
-
146
- VFP_DREG_D(rd, insn);
147
- if (rd & q) {
148
- return 1;
149
- }
150
- if (q || !is_long) {
151
- VFP_DREG_N(rn, insn);
152
- if (rn & q & !is_long) {
153
- return 1;
154
- }
155
- off_rn = vfp_reg_offset(1, rn);
156
- off_rm = vfp_reg_offset(1, rm);
157
- } else {
158
- rn = VFP_SREG_N(insn);
159
- off_rn = vfp_reg_offset(0, rn);
160
- off_rm = vfp_reg_offset(0, rm);
161
- }
162
- if (s->fp_excp_el) {
163
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
164
- syn_simd_access_trap(1, 0xe, false), s->fp_excp_el);
165
- return 0;
166
- }
167
- if (!s->vfp_enabled) {
168
- return 1;
169
- }
170
-
171
- opr_sz = (1 + q) * 8;
172
- if (fn_gvec_ptr) {
173
- TCGv_ptr ptr;
174
- if (ptr_is_env) {
175
- ptr = cpu_env;
176
- } else {
177
- ptr = get_fpstatus_ptr(1);
178
- }
179
- tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, ptr,
180
- opr_sz, opr_sz, data, fn_gvec_ptr);
181
- if (!ptr_is_env) {
182
- tcg_temp_free_ptr(ptr);
183
- }
184
- } else {
185
- tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm,
186
- opr_sz, opr_sz, data, fn_gvec);
187
- }
188
- return 0;
189
-}
190
-
191
static int disas_coproc_insn(DisasContext *s, uint32_t insn)
84
{
192
{
85
mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)";
193
int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2;
86
mc->init = collie_init;
194
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
87
+ mc->ignore_memory_transaction_failures = true;
195
}
88
}
196
}
89
197
}
90
DEFINE_MACHINE("collie", collie_machine_init)
198
- } else if ((insn & 0x0f000a00) == 0x0e000800
91
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
199
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
92
index XXXXXXX..XXXXXXX 100644
200
- if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
93
--- a/hw/arm/cubieboard.c
201
- goto illegal_op;
94
+++ b/hw/arm/cubieboard.c
202
- }
95
@@ -XXX,XX +XXX,XX @@ static void cubieboard_machine_init(MachineClass *mc)
203
- return;
96
mc->init = cubieboard_init;
204
}
97
mc->block_default_type = IF_IDE;
205
goto illegal_op;
98
mc->units_per_default_bus = 1;
206
}
99
+ mc->ignore_memory_transaction_failures = true;
207
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
100
}
208
}
101
209
break;
102
DEFINE_MACHINE("cubieboard", cubieboard_machine_init)
210
}
103
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
211
- if ((insn & 0xff000a00) == 0xfe000800
104
index XXXXXXX..XXXXXXX 100644
212
- && arm_dc_feature(s, ARM_FEATURE_V8)) {
105
--- a/hw/arm/digic_boards.c
213
- /* The Thumb2 and ARM encodings are identical. */
106
+++ b/hw/arm/digic_boards.c
214
- if (disas_neon_insn_2reg_scalar_ext(s, insn)) {
107
@@ -XXX,XX +XXX,XX @@ static void canon_a1100_machine_init(MachineClass *mc)
215
- goto illegal_op;
108
{
216
- }
109
mc->desc = "Canon PowerShot A1100 IS";
217
- } else if (((insn >> 24) & 3) == 3) {
110
mc->init = &canon_a1100_init;
218
+ if (((insn >> 24) & 3) == 3) {
111
+ mc->ignore_memory_transaction_failures = true;
219
/* Translate into the equivalent ARM encoding. */
112
}
220
insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28);
113
221
if (disas_neon_data_insn(s, insn)) {
114
DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init)
115
diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
116
index XXXXXXX..XXXXXXX 100644
117
--- a/hw/arm/exynos4_boards.c
118
+++ b/hw/arm/exynos4_boards.c
119
@@ -XXX,XX +XXX,XX @@ static void nuri_class_init(ObjectClass *oc, void *data)
120
mc->desc = "Samsung NURI board (Exynos4210)";
121
mc->init = nuri_init;
122
mc->max_cpus = EXYNOS4210_NCPUS;
123
+ mc->ignore_memory_transaction_failures = true;
124
}
125
126
static const TypeInfo nuri_type = {
127
@@ -XXX,XX +XXX,XX @@ static void smdkc210_class_init(ObjectClass *oc, void *data)
128
mc->desc = "Samsung SMDKC210 board (Exynos4210)";
129
mc->init = smdkc210_init;
130
mc->max_cpus = EXYNOS4210_NCPUS;
131
+ mc->ignore_memory_transaction_failures = true;
132
}
133
134
static const TypeInfo smdkc210_type = {
135
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
136
index XXXXXXX..XXXXXXX 100644
137
--- a/hw/arm/gumstix.c
138
+++ b/hw/arm/gumstix.c
139
@@ -XXX,XX +XXX,XX @@ static void connex_class_init(ObjectClass *oc, void *data)
140
141
mc->desc = "Gumstix Connex (PXA255)";
142
mc->init = connex_init;
143
+ mc->ignore_memory_transaction_failures = true;
144
}
145
146
static const TypeInfo connex_type = {
147
@@ -XXX,XX +XXX,XX @@ static void verdex_class_init(ObjectClass *oc, void *data)
148
149
mc->desc = "Gumstix Verdex (PXA270)";
150
mc->init = verdex_init;
151
+ mc->ignore_memory_transaction_failures = true;
152
}
153
154
static const TypeInfo verdex_type = {
155
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
156
index XXXXXXX..XXXXXXX 100644
157
--- a/hw/arm/highbank.c
158
+++ b/hw/arm/highbank.c
159
@@ -XXX,XX +XXX,XX @@ static void highbank_class_init(ObjectClass *oc, void *data)
160
mc->block_default_type = IF_IDE;
161
mc->units_per_default_bus = 1;
162
mc->max_cpus = 4;
163
+ mc->ignore_memory_transaction_failures = true;
164
}
165
166
static const TypeInfo highbank_type = {
167
@@ -XXX,XX +XXX,XX @@ static void midway_class_init(ObjectClass *oc, void *data)
168
mc->block_default_type = IF_IDE;
169
mc->units_per_default_bus = 1;
170
mc->max_cpus = 4;
171
+ mc->ignore_memory_transaction_failures = true;
172
}
173
174
static const TypeInfo midway_type = {
175
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
176
index XXXXXXX..XXXXXXX 100644
177
--- a/hw/arm/imx25_pdk.c
178
+++ b/hw/arm/imx25_pdk.c
179
@@ -XXX,XX +XXX,XX @@ static void imx25_pdk_machine_init(MachineClass *mc)
180
{
181
mc->desc = "ARM i.MX25 PDK board (ARM926)";
182
mc->init = imx25_pdk_init;
183
+ mc->ignore_memory_transaction_failures = true;
184
}
185
186
DEFINE_MACHINE("imx25-pdk", imx25_pdk_machine_init)
187
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
188
index XXXXXXX..XXXXXXX 100644
189
--- a/hw/arm/integratorcp.c
190
+++ b/hw/arm/integratorcp.c
191
@@ -XXX,XX +XXX,XX @@ static void integratorcp_machine_init(MachineClass *mc)
192
{
193
mc->desc = "ARM Integrator/CP (ARM926EJ-S)";
194
mc->init = integratorcp_init;
195
+ mc->ignore_memory_transaction_failures = true;
196
}
197
198
DEFINE_MACHINE("integratorcp", integratorcp_machine_init)
199
diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c
200
index XXXXXXX..XXXXXXX 100644
201
--- a/hw/arm/kzm.c
202
+++ b/hw/arm/kzm.c
203
@@ -XXX,XX +XXX,XX @@ static void kzm_machine_init(MachineClass *mc)
204
{
205
mc->desc = "ARM KZM Emulation Baseboard (ARM1136)";
206
mc->init = kzm_init;
207
+ mc->ignore_memory_transaction_failures = true;
208
}
209
210
DEFINE_MACHINE("kzm", kzm_machine_init)
211
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
212
index XXXXXXX..XXXXXXX 100644
213
--- a/hw/arm/mainstone.c
214
+++ b/hw/arm/mainstone.c
215
@@ -XXX,XX +XXX,XX @@ static void mainstone2_machine_init(MachineClass *mc)
216
{
217
mc->desc = "Mainstone II (PXA27x)";
218
mc->init = mainstone_init;
219
+ mc->ignore_memory_transaction_failures = true;
220
}
221
222
DEFINE_MACHINE("mainstone", mainstone2_machine_init)
223
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
224
index XXXXXXX..XXXXXXX 100644
225
--- a/hw/arm/musicpal.c
226
+++ b/hw/arm/musicpal.c
227
@@ -XXX,XX +XXX,XX @@ static void musicpal_machine_init(MachineClass *mc)
228
{
229
mc->desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)";
230
mc->init = musicpal_init;
231
+ mc->ignore_memory_transaction_failures = true;
232
}
233
234
DEFINE_MACHINE("musicpal", musicpal_machine_init)
235
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
236
index XXXXXXX..XXXXXXX 100644
237
--- a/hw/arm/netduino2.c
238
+++ b/hw/arm/netduino2.c
239
@@ -XXX,XX +XXX,XX @@ static void netduino2_machine_init(MachineClass *mc)
240
{
241
mc->desc = "Netduino 2 Machine";
242
mc->init = netduino2_init;
243
+ mc->ignore_memory_transaction_failures = true;
244
}
245
246
DEFINE_MACHINE("netduino2", netduino2_machine_init)
247
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
248
index XXXXXXX..XXXXXXX 100644
249
--- a/hw/arm/nseries.c
250
+++ b/hw/arm/nseries.c
251
@@ -XXX,XX +XXX,XX @@ static void n800_class_init(ObjectClass *oc, void *data)
252
mc->desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)";
253
mc->init = n800_init;
254
mc->default_boot_order = "";
255
+ mc->ignore_memory_transaction_failures = true;
256
}
257
258
static const TypeInfo n800_type = {
259
@@ -XXX,XX +XXX,XX @@ static void n810_class_init(ObjectClass *oc, void *data)
260
mc->desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)";
261
mc->init = n810_init;
262
mc->default_boot_order = "";
263
+ mc->ignore_memory_transaction_failures = true;
264
}
265
266
static const TypeInfo n810_type = {
267
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
268
index XXXXXXX..XXXXXXX 100644
269
--- a/hw/arm/omap_sx1.c
270
+++ b/hw/arm/omap_sx1.c
271
@@ -XXX,XX +XXX,XX @@ static void sx1_machine_v2_class_init(ObjectClass *oc, void *data)
272
273
mc->desc = "Siemens SX1 (OMAP310) V2";
274
mc->init = sx1_init_v2;
275
+ mc->ignore_memory_transaction_failures = true;
276
}
277
278
static const TypeInfo sx1_machine_v2_type = {
279
@@ -XXX,XX +XXX,XX @@ static void sx1_machine_v1_class_init(ObjectClass *oc, void *data)
280
281
mc->desc = "Siemens SX1 (OMAP310) V1";
282
mc->init = sx1_init_v1;
283
+ mc->ignore_memory_transaction_failures = true;
284
}
285
286
static const TypeInfo sx1_machine_v1_type = {
287
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
288
index XXXXXXX..XXXXXXX 100644
289
--- a/hw/arm/palm.c
290
+++ b/hw/arm/palm.c
291
@@ -XXX,XX +XXX,XX @@ static void palmte_machine_init(MachineClass *mc)
292
{
293
mc->desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)";
294
mc->init = palmte_init;
295
+ mc->ignore_memory_transaction_failures = true;
296
}
297
298
DEFINE_MACHINE("cheetah", palmte_machine_init)
299
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
300
index XXXXXXX..XXXXXXX 100644
301
--- a/hw/arm/raspi.c
302
+++ b/hw/arm/raspi.c
303
@@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc)
304
mc->no_cdrom = 1;
305
mc->max_cpus = BCM2836_NCPUS;
306
mc->default_ram_size = 1024 * 1024 * 1024;
307
+ mc->ignore_memory_transaction_failures = true;
308
};
309
DEFINE_MACHINE("raspi2", raspi2_machine_init)
310
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
311
index XXXXXXX..XXXXXXX 100644
312
--- a/hw/arm/realview.c
313
+++ b/hw/arm/realview.c
314
@@ -XXX,XX +XXX,XX @@ static void realview_eb_class_init(ObjectClass *oc, void *data)
315
mc->desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)";
316
mc->init = realview_eb_init;
317
mc->block_default_type = IF_SCSI;
318
+ mc->ignore_memory_transaction_failures = true;
319
}
320
321
static const TypeInfo realview_eb_type = {
322
@@ -XXX,XX +XXX,XX @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data)
323
mc->init = realview_eb_mpcore_init;
324
mc->block_default_type = IF_SCSI;
325
mc->max_cpus = 4;
326
+ mc->ignore_memory_transaction_failures = true;
327
}
328
329
static const TypeInfo realview_eb_mpcore_type = {
330
@@ -XXX,XX +XXX,XX @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data)
331
332
mc->desc = "ARM RealView Platform Baseboard for Cortex-A8";
333
mc->init = realview_pb_a8_init;
334
+ mc->ignore_memory_transaction_failures = true;
335
}
336
337
static const TypeInfo realview_pb_a8_type = {
338
@@ -XXX,XX +XXX,XX @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data)
339
mc->desc = "ARM RealView Platform Baseboard Explore for Cortex-A9";
340
mc->init = realview_pbx_a9_init;
341
mc->max_cpus = 4;
342
+ mc->ignore_memory_transaction_failures = true;
343
}
344
345
static const TypeInfo realview_pbx_a9_type = {
346
diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
347
index XXXXXXX..XXXXXXX 100644
348
--- a/hw/arm/sabrelite.c
349
+++ b/hw/arm/sabrelite.c
350
@@ -XXX,XX +XXX,XX @@ static void sabrelite_machine_init(MachineClass *mc)
351
mc->desc = "Freescale i.MX6 Quad SABRE Lite Board (Cortex A9)";
352
mc->init = sabrelite_init;
353
mc->max_cpus = FSL_IMX6_NUM_CPUS;
354
+ mc->ignore_memory_transaction_failures = true;
355
}
356
357
DEFINE_MACHINE("sabrelite", sabrelite_machine_init)
358
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
359
index XXXXXXX..XXXXXXX 100644
360
--- a/hw/arm/spitz.c
361
+++ b/hw/arm/spitz.c
362
@@ -XXX,XX +XXX,XX @@ static void akitapda_class_init(ObjectClass *oc, void *data)
363
364
mc->desc = "Sharp SL-C1000 (Akita) PDA (PXA270)";
365
mc->init = akita_init;
366
+ mc->ignore_memory_transaction_failures = true;
367
}
368
369
static const TypeInfo akitapda_type = {
370
@@ -XXX,XX +XXX,XX @@ static void spitzpda_class_init(ObjectClass *oc, void *data)
371
mc->desc = "Sharp SL-C3000 (Spitz) PDA (PXA270)";
372
mc->init = spitz_init;
373
mc->block_default_type = IF_IDE;
374
+ mc->ignore_memory_transaction_failures = true;
375
}
376
377
static const TypeInfo spitzpda_type = {
378
@@ -XXX,XX +XXX,XX @@ static void borzoipda_class_init(ObjectClass *oc, void *data)
379
mc->desc = "Sharp SL-C3100 (Borzoi) PDA (PXA270)";
380
mc->init = borzoi_init;
381
mc->block_default_type = IF_IDE;
382
+ mc->ignore_memory_transaction_failures = true;
383
}
384
385
static const TypeInfo borzoipda_type = {
386
@@ -XXX,XX +XXX,XX @@ static void terrierpda_class_init(ObjectClass *oc, void *data)
387
mc->desc = "Sharp SL-C3200 (Terrier) PDA (PXA270)";
388
mc->init = terrier_init;
389
mc->block_default_type = IF_IDE;
390
+ mc->ignore_memory_transaction_failures = true;
391
}
392
393
static const TypeInfo terrierpda_type = {
394
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
395
index XXXXXXX..XXXXXXX 100644
396
--- a/hw/arm/stellaris.c
397
+++ b/hw/arm/stellaris.c
398
@@ -XXX,XX +XXX,XX @@ static void lm3s811evb_class_init(ObjectClass *oc, void *data)
399
400
mc->desc = "Stellaris LM3S811EVB";
401
mc->init = lm3s811evb_init;
402
+ mc->ignore_memory_transaction_failures = true;
403
}
404
405
static const TypeInfo lm3s811evb_type = {
406
@@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_class_init(ObjectClass *oc, void *data)
407
408
mc->desc = "Stellaris LM3S6965EVB";
409
mc->init = lm3s6965evb_init;
410
+ mc->ignore_memory_transaction_failures = true;
411
}
412
413
static const TypeInfo lm3s6965evb_type = {
414
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
415
index XXXXXXX..XXXXXXX 100644
416
--- a/hw/arm/tosa.c
417
+++ b/hw/arm/tosa.c
418
@@ -XXX,XX +XXX,XX @@ static void tosapda_machine_init(MachineClass *mc)
419
mc->desc = "Sharp SL-6000 (Tosa) PDA (PXA255)";
420
mc->init = tosa_init;
421
mc->block_default_type = IF_IDE;
422
+ mc->ignore_memory_transaction_failures = true;
423
}
424
425
DEFINE_MACHINE("tosa", tosapda_machine_init)
426
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
427
index XXXXXXX..XXXXXXX 100644
428
--- a/hw/arm/versatilepb.c
429
+++ b/hw/arm/versatilepb.c
430
@@ -XXX,XX +XXX,XX @@ static void versatilepb_class_init(ObjectClass *oc, void *data)
431
mc->desc = "ARM Versatile/PB (ARM926EJ-S)";
432
mc->init = vpb_init;
433
mc->block_default_type = IF_SCSI;
434
+ mc->ignore_memory_transaction_failures = true;
435
}
436
437
static const TypeInfo versatilepb_type = {
438
@@ -XXX,XX +XXX,XX @@ static void versatileab_class_init(ObjectClass *oc, void *data)
439
mc->desc = "ARM Versatile/AB (ARM926EJ-S)";
440
mc->init = vab_init;
441
mc->block_default_type = IF_SCSI;
442
+ mc->ignore_memory_transaction_failures = true;
443
}
444
445
static const TypeInfo versatileab_type = {
446
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
447
index XXXXXXX..XXXXXXX 100644
448
--- a/hw/arm/vexpress.c
449
+++ b/hw/arm/vexpress.c
450
@@ -XXX,XX +XXX,XX @@ static void vexpress_class_init(ObjectClass *oc, void *data)
451
mc->desc = "ARM Versatile Express";
452
mc->init = vexpress_common_init;
453
mc->max_cpus = 4;
454
+ mc->ignore_memory_transaction_failures = true;
455
}
456
457
static void vexpress_a9_class_init(ObjectClass *oc, void *data)
458
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
459
index XXXXXXX..XXXXXXX 100644
460
--- a/hw/arm/xilinx_zynq.c
461
+++ b/hw/arm/xilinx_zynq.c
462
@@ -XXX,XX +XXX,XX @@ static void zynq_machine_init(MachineClass *mc)
463
mc->init = zynq_init;
464
mc->max_cpus = 1;
465
mc->no_sdcard = 1;
466
+ mc->ignore_memory_transaction_failures = true;
467
}
468
469
DEFINE_MACHINE("xilinx-zynq-a9", zynq_machine_init)
470
diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c
471
index XXXXXXX..XXXXXXX 100644
472
--- a/hw/arm/xlnx-ep108.c
473
+++ b/hw/arm/xlnx-ep108.c
474
@@ -XXX,XX +XXX,XX @@ static void xlnx_ep108_machine_init(MachineClass *mc)
475
mc->init = xlnx_ep108_init;
476
mc->block_default_type = IF_IDE;
477
mc->units_per_default_bus = 1;
478
+ mc->ignore_memory_transaction_failures = true;
479
}
480
481
DEFINE_MACHINE("xlnx-ep108", xlnx_ep108_machine_init)
482
@@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_init(MachineClass *mc)
483
mc->init = xlnx_ep108_init;
484
mc->block_default_type = IF_IDE;
485
mc->units_per_default_bus = 1;
486
+ mc->ignore_memory_transaction_failures = true;
487
}
488
489
DEFINE_MACHINE("xlnx-zcu102", xlnx_zcu102_machine_init)
490
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
491
index XXXXXXX..XXXXXXX 100644
492
--- a/hw/arm/z2.c
493
+++ b/hw/arm/z2.c
494
@@ -XXX,XX +XXX,XX @@ static void z2_machine_init(MachineClass *mc)
495
{
496
mc->desc = "Zipit Z2 (PXA27x)";
497
mc->init = z2_init;
498
+ mc->ignore_memory_transaction_failures = true;
499
}
500
501
DEFINE_MACHINE("z2", z2_machine_init)
502
--
222
--
503
2.7.4
223
2.20.1
504
224
505
225
diff view generated by jsdifflib
New patch
1
1
Convert the Neon "load/store multiple structures" insns to decodetree.
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20200430181003.21682-12-peter.maydell@linaro.org
6
---
7
target/arm/neon-ls.decode | 7 ++
8
target/arm/translate-neon.inc.c | 124 ++++++++++++++++++++++++++++++++
9
target/arm/translate.c | 91 +----------------------
10
3 files changed, 133 insertions(+), 89 deletions(-)
11
12
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/neon-ls.decode
15
+++ b/target/arm/neon-ls.decode
16
@@ -XXX,XX +XXX,XX @@
17
# 0b1111_1001_xxx0_xxxx_xxxx_xxxx_xxxx_xxxx
18
# This file works on the A32 encoding only; calling code for T32 has to
19
# transform the insn into the A32 version first.
20
+
21
+%vd_dp 22:1 12:4
22
+
23
+# Neon load/store multiple structures
24
+
25
+VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \
26
+ vd=%vd_dp
27
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/translate-neon.inc.c
30
+++ b/target/arm/translate-neon.inc.c
31
@@ -XXX,XX +XXX,XX @@ static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a)
32
gen_helper_gvec_fmlal_idx_a32);
33
return true;
34
}
35
+
36
+static struct {
37
+ int nregs;
38
+ int interleave;
39
+ int spacing;
40
+} const neon_ls_element_type[11] = {
41
+ {1, 4, 1},
42
+ {1, 4, 2},
43
+ {4, 1, 1},
44
+ {2, 2, 2},
45
+ {1, 3, 1},
46
+ {1, 3, 2},
47
+ {3, 1, 1},
48
+ {1, 1, 1},
49
+ {1, 2, 1},
50
+ {1, 2, 2},
51
+ {2, 1, 1}
52
+};
53
+
54
+static void gen_neon_ldst_base_update(DisasContext *s, int rm, int rn,
55
+ int stride)
56
+{
57
+ if (rm != 15) {
58
+ TCGv_i32 base;
59
+
60
+ base = load_reg(s, rn);
61
+ if (rm == 13) {
62
+ tcg_gen_addi_i32(base, base, stride);
63
+ } else {
64
+ TCGv_i32 index;
65
+ index = load_reg(s, rm);
66
+ tcg_gen_add_i32(base, base, index);
67
+ tcg_temp_free_i32(index);
68
+ }
69
+ store_reg(s, rn, base);
70
+ }
71
+}
72
+
73
+static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a)
74
+{
75
+ /* Neon load/store multiple structures */
76
+ int nregs, interleave, spacing, reg, n;
77
+ MemOp endian = s->be_data;
78
+ int mmu_idx = get_mem_index(s);
79
+ int size = a->size;
80
+ TCGv_i64 tmp64;
81
+ TCGv_i32 addr, tmp;
82
+
83
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
84
+ return false;
85
+ }
86
+
87
+ /* UNDEF accesses to D16-D31 if they don't exist */
88
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
89
+ return false;
90
+ }
91
+ if (a->itype > 10) {
92
+ return false;
93
+ }
94
+ /* Catch UNDEF cases for bad values of align field */
95
+ switch (a->itype & 0xc) {
96
+ case 4:
97
+ if (a->align >= 2) {
98
+ return false;
99
+ }
100
+ break;
101
+ case 8:
102
+ if (a->align == 3) {
103
+ return false;
104
+ }
105
+ break;
106
+ default:
107
+ break;
108
+ }
109
+ nregs = neon_ls_element_type[a->itype].nregs;
110
+ interleave = neon_ls_element_type[a->itype].interleave;
111
+ spacing = neon_ls_element_type[a->itype].spacing;
112
+ if (size == 3 && (interleave | spacing) != 1) {
113
+ return false;
114
+ }
115
+
116
+ if (!vfp_access_check(s)) {
117
+ return true;
118
+ }
119
+
120
+ /* For our purposes, bytes are always little-endian. */
121
+ if (size == 0) {
122
+ endian = MO_LE;
123
+ }
124
+ /*
125
+ * Consecutive little-endian elements from a single register
126
+ * can be promoted to a larger little-endian operation.
127
+ */
128
+ if (interleave == 1 && endian == MO_LE) {
129
+ size = 3;
130
+ }
131
+ tmp64 = tcg_temp_new_i64();
132
+ addr = tcg_temp_new_i32();
133
+ tmp = tcg_const_i32(1 << size);
134
+ load_reg_var(s, addr, a->rn);
135
+ for (reg = 0; reg < nregs; reg++) {
136
+ for (n = 0; n < 8 >> size; n++) {
137
+ int xs;
138
+ for (xs = 0; xs < interleave; xs++) {
139
+ int tt = a->vd + reg + spacing * xs;
140
+
141
+ if (a->l) {
142
+ gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size);
143
+ neon_store_element64(tt, n, size, tmp64);
144
+ } else {
145
+ neon_load_element64(tmp64, tt, n, size);
146
+ gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size);
147
+ }
148
+ tcg_gen_add_i32(addr, addr, tmp);
149
+ }
150
+ }
151
+ }
152
+ tcg_temp_free_i32(addr);
153
+ tcg_temp_free_i32(tmp);
154
+ tcg_temp_free_i64(tmp64);
155
+
156
+ gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8);
157
+ return true;
158
+}
159
diff --git a/target/arm/translate.c b/target/arm/translate.c
160
index XXXXXXX..XXXXXXX 100644
161
--- a/target/arm/translate.c
162
+++ b/target/arm/translate.c
163
@@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1)
164
}
165
166
167
-static struct {
168
- int nregs;
169
- int interleave;
170
- int spacing;
171
-} const neon_ls_element_type[11] = {
172
- {1, 4, 1},
173
- {1, 4, 2},
174
- {4, 1, 1},
175
- {2, 2, 2},
176
- {1, 3, 1},
177
- {1, 3, 2},
178
- {3, 1, 1},
179
- {1, 1, 1},
180
- {1, 2, 1},
181
- {1, 2, 2},
182
- {2, 1, 1}
183
-};
184
-
185
/* Translate a NEON load/store element instruction. Return nonzero if the
186
instruction is invalid. */
187
static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
188
{
189
int rd, rn, rm;
190
- int op;
191
int nregs;
192
- int interleave;
193
- int spacing;
194
int stride;
195
int size;
196
int reg;
197
int load;
198
- int n;
199
int vec_size;
200
- int mmu_idx;
201
- MemOp endian;
202
TCGv_i32 addr;
203
TCGv_i32 tmp;
204
- TCGv_i32 tmp2;
205
- TCGv_i64 tmp64;
206
207
if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
208
return 1;
209
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
210
rn = (insn >> 16) & 0xf;
211
rm = insn & 0xf;
212
load = (insn & (1 << 21)) != 0;
213
- endian = s->be_data;
214
- mmu_idx = get_mem_index(s);
215
if ((insn & (1 << 23)) == 0) {
216
- /* Load store all elements. */
217
- op = (insn >> 8) & 0xf;
218
- size = (insn >> 6) & 3;
219
- if (op > 10)
220
- return 1;
221
- /* Catch UNDEF cases for bad values of align field */
222
- switch (op & 0xc) {
223
- case 4:
224
- if (((insn >> 5) & 1) == 1) {
225
- return 1;
226
- }
227
- break;
228
- case 8:
229
- if (((insn >> 4) & 3) == 3) {
230
- return 1;
231
- }
232
- break;
233
- default:
234
- break;
235
- }
236
- nregs = neon_ls_element_type[op].nregs;
237
- interleave = neon_ls_element_type[op].interleave;
238
- spacing = neon_ls_element_type[op].spacing;
239
- if (size == 3 && (interleave | spacing) != 1) {
240
- return 1;
241
- }
242
- /* For our purposes, bytes are always little-endian. */
243
- if (size == 0) {
244
- endian = MO_LE;
245
- }
246
- /* Consecutive little-endian elements from a single register
247
- * can be promoted to a larger little-endian operation.
248
- */
249
- if (interleave == 1 && endian == MO_LE) {
250
- size = 3;
251
- }
252
- tmp64 = tcg_temp_new_i64();
253
- addr = tcg_temp_new_i32();
254
- tmp2 = tcg_const_i32(1 << size);
255
- load_reg_var(s, addr, rn);
256
- for (reg = 0; reg < nregs; reg++) {
257
- for (n = 0; n < 8 >> size; n++) {
258
- int xs;
259
- for (xs = 0; xs < interleave; xs++) {
260
- int tt = rd + reg + spacing * xs;
261
-
262
- if (load) {
263
- gen_aa32_ld_i64(s, tmp64, addr, mmu_idx, endian | size);
264
- neon_store_element64(tt, n, size, tmp64);
265
- } else {
266
- neon_load_element64(tmp64, tt, n, size);
267
- gen_aa32_st_i64(s, tmp64, addr, mmu_idx, endian | size);
268
- }
269
- tcg_gen_add_i32(addr, addr, tmp2);
270
- }
271
- }
272
- }
273
- tcg_temp_free_i32(addr);
274
- tcg_temp_free_i32(tmp2);
275
- tcg_temp_free_i64(tmp64);
276
- stride = nregs * interleave * 8;
277
+ /* Load store all elements -- handled already by decodetree */
278
+ return 1;
279
} else {
280
size = (insn >> 10) & 3;
281
if (size == 3) {
282
--
283
2.20.1
284
285
diff view generated by jsdifflib
1
Implement the behavioural side of the new PMSAv8 specification.
1
Convert the Neon "load single structure to all lanes" insns to
2
decodetree.
2
3
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 1503414539-28762-3-git-send-email-peter.maydell@linaro.org
6
Message-id: 20200430181003.21682-13-peter.maydell@linaro.org
6
---
7
---
7
target/arm/helper.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++-
8
target/arm/neon-ls.decode | 5 +++
8
1 file changed, 110 insertions(+), 1 deletion(-)
9
target/arm/translate-neon.inc.c | 73 +++++++++++++++++++++++++++++++++
10
target/arm/translate.c | 55 +------------------------
11
3 files changed, 80 insertions(+), 53 deletions(-)
9
12
10
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
11
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/helper.c
15
--- a/target/arm/neon-ls.decode
13
+++ b/target/arm/helper.c
16
+++ b/target/arm/neon-ls.decode
14
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
17
@@ -XXX,XX +XXX,XX @@
15
return !(*prot & (1 << access_type));
18
19
VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \
20
vd=%vd_dp
21
+
22
+# Neon load single element to all lanes
23
+
24
+VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \
25
+ vd=%vd_dp
26
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/translate-neon.inc.c
29
+++ b/target/arm/translate-neon.inc.c
30
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a)
31
gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8);
32
return true;
16
}
33
}
17
34
+
18
+static bool get_phys_addr_pmsav8(CPUARMState *env, uint32_t address,
35
+static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a)
19
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
20
+ hwaddr *phys_ptr, int *prot, uint32_t *fsr)
21
+{
36
+{
22
+ ARMCPU *cpu = arm_env_get_cpu(env);
37
+ /* Neon load single structure to all lanes */
23
+ bool is_user = regime_is_user(env, mmu_idx);
38
+ int reg, stride, vec_size;
24
+ int n;
39
+ int vd = a->vd;
25
+ int matchregion = -1;
40
+ int size = a->size;
26
+ bool hit = false;
41
+ int nregs = a->n + 1;
42
+ TCGv_i32 addr, tmp;
27
+
43
+
28
+ *phys_ptr = address;
44
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
29
+ *prot = 0;
45
+ return false;
30
+
31
+ /* Unlike the ARM ARM pseudocode, we don't need to check whether this
32
+ * was an exception vector read from the vector table (which is always
33
+ * done using the default system address map), because those accesses
34
+ * are done in arm_v7m_load_vector(), which always does a direct
35
+ * read using address_space_ldl(), rather than going via this function.
36
+ */
37
+ if (regime_translation_disabled(env, mmu_idx)) { /* MPU disabled */
38
+ hit = true;
39
+ } else if (m_is_ppb_region(env, address)) {
40
+ hit = true;
41
+ } else if (pmsav7_use_background_region(cpu, mmu_idx, is_user)) {
42
+ hit = true;
43
+ } else {
44
+ for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) {
45
+ /* region search */
46
+ /* Note that the base address is bits [31:5] from the register
47
+ * with bits [4:0] all zeroes, but the limit address is bits
48
+ * [31:5] from the register with bits [4:0] all ones.
49
+ */
50
+ uint32_t base = env->pmsav8.rbar[n] & ~0x1f;
51
+ uint32_t limit = env->pmsav8.rlar[n] | 0x1f;
52
+
53
+ if (!(env->pmsav8.rlar[n] & 0x1)) {
54
+ /* Region disabled */
55
+ continue;
56
+ }
57
+
58
+ if (address < base || address > limit) {
59
+ continue;
60
+ }
61
+
62
+ if (hit) {
63
+ /* Multiple regions match -- always a failure (unlike
64
+ * PMSAv7 where highest-numbered-region wins)
65
+ */
66
+ *fsr = 0x00d; /* permission fault */
67
+ return true;
68
+ }
69
+
70
+ matchregion = n;
71
+ hit = true;
72
+
73
+ if (base & ~TARGET_PAGE_MASK) {
74
+ qemu_log_mask(LOG_UNIMP,
75
+ "MPU_RBAR[%d]: No support for MPU region base"
76
+ "address of 0x%" PRIx32 ". Minimum alignment is "
77
+ "%d\n",
78
+ n, base, TARGET_PAGE_BITS);
79
+ continue;
80
+ }
81
+ if ((limit + 1) & ~TARGET_PAGE_MASK) {
82
+ qemu_log_mask(LOG_UNIMP,
83
+ "MPU_RBAR[%d]: No support for MPU region limit"
84
+ "address of 0x%" PRIx32 ". Minimum alignment is "
85
+ "%d\n",
86
+ n, limit, TARGET_PAGE_BITS);
87
+ continue;
88
+ }
89
+ }
90
+ }
46
+ }
91
+
47
+
92
+ if (!hit) {
48
+ /* UNDEF accesses to D16-D31 if they don't exist */
93
+ /* background fault */
49
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
94
+ *fsr = 0;
50
+ return false;
51
+ }
52
+
53
+ if (size == 3) {
54
+ if (nregs != 4 || a->a == 0) {
55
+ return false;
56
+ }
57
+ /* For VLD4 size == 3 a == 1 means 32 bits at 16 byte alignment */
58
+ size = 2;
59
+ }
60
+ if (nregs == 1 && a->a == 1 && size == 0) {
61
+ return false;
62
+ }
63
+ if (nregs == 3 && a->a == 1) {
64
+ return false;
65
+ }
66
+
67
+ if (!vfp_access_check(s)) {
95
+ return true;
68
+ return true;
96
+ }
69
+ }
97
+
70
+
98
+ if (matchregion == -1) {
71
+ /*
99
+ /* hit using the background region */
72
+ * VLD1 to all lanes: T bit indicates how many Dregs to write.
100
+ get_phys_addr_pmsav7_default(env, mmu_idx, address, prot);
73
+ * VLD2/3/4 to all lanes: T bit indicates register stride.
101
+ } else {
74
+ */
102
+ uint32_t ap = extract32(env->pmsav8.rbar[matchregion], 1, 2);
75
+ stride = a->t ? 2 : 1;
103
+ uint32_t xn = extract32(env->pmsav8.rbar[matchregion], 0, 1);
76
+ vec_size = nregs == 1 ? stride * 8 : 8;
104
+
77
+
105
+ if (m_is_system_region(env, address)) {
78
+ tmp = tcg_temp_new_i32();
106
+ /* System space is always execute never */
79
+ addr = tcg_temp_new_i32();
107
+ xn = 1;
80
+ load_reg_var(s, addr, a->rn);
81
+ for (reg = 0; reg < nregs; reg++) {
82
+ gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
83
+ s->be_data | size);
84
+ if ((vd & 1) && vec_size == 16) {
85
+ /*
86
+ * We cannot write 16 bytes at once because the
87
+ * destination is unaligned.
88
+ */
89
+ tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
90
+ 8, 8, tmp);
91
+ tcg_gen_gvec_mov(0, neon_reg_offset(vd + 1, 0),
92
+ neon_reg_offset(vd, 0), 8, 8);
93
+ } else {
94
+ tcg_gen_gvec_dup_i32(size, neon_reg_offset(vd, 0),
95
+ vec_size, vec_size, tmp);
108
+ }
96
+ }
97
+ tcg_gen_addi_i32(addr, addr, 1 << size);
98
+ vd += stride;
99
+ }
100
+ tcg_temp_free_i32(tmp);
101
+ tcg_temp_free_i32(addr);
109
+
102
+
110
+ *prot = simple_ap_to_rw_prot(env, mmu_idx, ap);
103
+ gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << size) * nregs);
111
+ if (*prot && !xn) {
112
+ *prot |= PAGE_EXEC;
113
+ }
114
+ /* We don't need to look the attribute up in the MAIR0/MAIR1
115
+ * registers because that only tells us about cacheability.
116
+ */
117
+ }
118
+
104
+
119
+ *fsr = 0x00d; /* Permission fault */
105
+ return true;
120
+ return !(*prot & (1 << access_type));
121
+}
106
+}
122
+
107
diff --git a/target/arm/translate.c b/target/arm/translate.c
123
static bool get_phys_addr_pmsav5(CPUARMState *env, uint32_t address,
108
index XXXXXXX..XXXXXXX 100644
124
MMUAccessType access_type, ARMMMUIdx mmu_idx,
109
--- a/target/arm/translate.c
125
hwaddr *phys_ptr, int *prot, uint32_t *fsr)
110
+++ b/target/arm/translate.c
126
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr(CPUARMState *env, target_ulong address,
111
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
127
bool ret;
112
int size;
128
*page_size = TARGET_PAGE_SIZE;
113
int reg;
129
114
int load;
130
- if (arm_feature(env, ARM_FEATURE_V7)) {
115
- int vec_size;
131
+ if (arm_feature(env, ARM_FEATURE_V8)) {
116
TCGv_i32 addr;
132
+ /* PMSAv8 */
117
TCGv_i32 tmp;
133
+ ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx,
118
134
+ phys_ptr, prot, fsr);
119
@@ -XXX,XX +XXX,XX @@ static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
135
+ } else if (arm_feature(env, ARM_FEATURE_V7)) {
120
} else {
136
/* PMSAv7 */
121
size = (insn >> 10) & 3;
137
ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx,
122
if (size == 3) {
138
phys_ptr, prot, fsr);
123
- /* Load single element to all lanes. */
124
- int a = (insn >> 4) & 1;
125
- if (!load) {
126
- return 1;
127
- }
128
- size = (insn >> 6) & 3;
129
- nregs = ((insn >> 8) & 3) + 1;
130
-
131
- if (size == 3) {
132
- if (nregs != 4 || a == 0) {
133
- return 1;
134
- }
135
- /* For VLD4 size==3 a == 1 means 32 bits at 16 byte alignment */
136
- size = 2;
137
- }
138
- if (nregs == 1 && a == 1 && size == 0) {
139
- return 1;
140
- }
141
- if (nregs == 3 && a == 1) {
142
- return 1;
143
- }
144
- addr = tcg_temp_new_i32();
145
- load_reg_var(s, addr, rn);
146
-
147
- /* VLD1 to all lanes: bit 5 indicates how many Dregs to write.
148
- * VLD2/3/4 to all lanes: bit 5 indicates register stride.
149
- */
150
- stride = (insn & (1 << 5)) ? 2 : 1;
151
- vec_size = nregs == 1 ? stride * 8 : 8;
152
-
153
- tmp = tcg_temp_new_i32();
154
- for (reg = 0; reg < nregs; reg++) {
155
- gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
156
- s->be_data | size);
157
- if ((rd & 1) && vec_size == 16) {
158
- /* We cannot write 16 bytes at once because the
159
- * destination is unaligned.
160
- */
161
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(rd, 0),
162
- 8, 8, tmp);
163
- tcg_gen_gvec_mov(0, neon_reg_offset(rd + 1, 0),
164
- neon_reg_offset(rd, 0), 8, 8);
165
- } else {
166
- tcg_gen_gvec_dup_i32(size, neon_reg_offset(rd, 0),
167
- vec_size, vec_size, tmp);
168
- }
169
- tcg_gen_addi_i32(addr, addr, 1 << size);
170
- rd += stride;
171
- }
172
- tcg_temp_free_i32(tmp);
173
- tcg_temp_free_i32(addr);
174
- stride = (1 << size) * nregs;
175
+ /* Load single element to all lanes -- handled by decodetree */
176
+ return 1;
177
} else {
178
/* Single element. */
179
int idx = (insn >> 4) & 0xf;
139
--
180
--
140
2.7.4
181
2.20.1
141
182
142
183
diff view generated by jsdifflib
New patch
1
1
Convert the Neon "load/store single structure to one lane" insns to
2
decodetree.
3
4
As this is the last set of insns in the neon load/store group,
5
we can remove the whole disas_neon_ls_insn() function.
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200430181003.21682-14-peter.maydell@linaro.org
10
---
11
target/arm/neon-ls.decode | 11 +++
12
target/arm/translate-neon.inc.c | 89 +++++++++++++++++++
13
target/arm/translate.c | 147 --------------------------------
14
3 files changed, 100 insertions(+), 147 deletions(-)
15
16
diff --git a/target/arm/neon-ls.decode b/target/arm/neon-ls.decode
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/neon-ls.decode
19
+++ b/target/arm/neon-ls.decode
20
@@ -XXX,XX +XXX,XX @@ VLDST_multiple 1111 0100 0 . l:1 0 rn:4 .... itype:4 size:2 align:2 rm:4 \
21
22
VLD_all_lanes 1111 0100 1 . 1 0 rn:4 .... 11 n:2 size:2 t:1 a:1 rm:4 \
23
vd=%vd_dp
24
+
25
+# Neon load/store single structure to one lane
26
+%imm1_5_p1 5:1 !function=plus1
27
+%imm1_6_p1 6:1 !function=plus1
28
+
29
+VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 00 n:2 reg_idx:3 align:1 rm:4 \
30
+ vd=%vd_dp size=0 stride=1
31
+VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 01 n:2 reg_idx:2 align:2 rm:4 \
32
+ vd=%vd_dp size=1 stride=%imm1_5_p1
33
+VLDST_single 1111 0100 1 . l:1 0 rn:4 .... 10 n:2 reg_idx:1 align:3 rm:4 \
34
+ vd=%vd_dp size=2 stride=%imm1_6_p1
35
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/translate-neon.inc.c
38
+++ b/target/arm/translate-neon.inc.c
39
@@ -XXX,XX +XXX,XX @@
40
* It might be possible to convert it to a standalone .c file eventually.
41
*/
42
43
+static inline int plus1(DisasContext *s, int x)
44
+{
45
+ return x + 1;
46
+}
47
+
48
/* Include the generated Neon decoder */
49
#include "decode-neon-dp.inc.c"
50
#include "decode-neon-ls.inc.c"
51
@@ -XXX,XX +XXX,XX @@ static bool trans_VLD_all_lanes(DisasContext *s, arg_VLD_all_lanes *a)
52
53
return true;
54
}
55
+
56
+static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a)
57
+{
58
+ /* Neon load/store single structure to one lane */
59
+ int reg;
60
+ int nregs = a->n + 1;
61
+ int vd = a->vd;
62
+ TCGv_i32 addr, tmp;
63
+
64
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
65
+ return false;
66
+ }
67
+
68
+ /* UNDEF accesses to D16-D31 if they don't exist */
69
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
70
+ return false;
71
+ }
72
+
73
+ /* Catch the UNDEF cases. This is unavoidably a bit messy. */
74
+ switch (nregs) {
75
+ case 1:
76
+ if (((a->align & (1 << a->size)) != 0) ||
77
+ (a->size == 2 && ((a->align & 3) == 1 || (a->align & 3) == 2))) {
78
+ return false;
79
+ }
80
+ break;
81
+ case 3:
82
+ if ((a->align & 1) != 0) {
83
+ return false;
84
+ }
85
+ /* fall through */
86
+ case 2:
87
+ if (a->size == 2 && (a->align & 2) != 0) {
88
+ return false;
89
+ }
90
+ break;
91
+ case 4:
92
+ if ((a->size == 2) && ((a->align & 3) == 3)) {
93
+ return false;
94
+ }
95
+ break;
96
+ default:
97
+ abort();
98
+ }
99
+ if ((vd + a->stride * (nregs - 1)) > 31) {
100
+ /*
101
+ * Attempts to write off the end of the register file are
102
+ * UNPREDICTABLE; we choose to UNDEF because otherwise we would
103
+ * access off the end of the array that holds the register data.
104
+ */
105
+ return false;
106
+ }
107
+
108
+ if (!vfp_access_check(s)) {
109
+ return true;
110
+ }
111
+
112
+ tmp = tcg_temp_new_i32();
113
+ addr = tcg_temp_new_i32();
114
+ load_reg_var(s, addr, a->rn);
115
+ /*
116
+ * TODO: if we implemented alignment exceptions, we should check
117
+ * addr against the alignment encoded in a->align here.
118
+ */
119
+ for (reg = 0; reg < nregs; reg++) {
120
+ if (a->l) {
121
+ gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
122
+ s->be_data | a->size);
123
+ neon_store_element(vd, a->reg_idx, a->size, tmp);
124
+ } else { /* Store */
125
+ neon_load_element(tmp, vd, a->reg_idx, a->size);
126
+ gen_aa32_st_i32(s, tmp, addr, get_mem_index(s),
127
+ s->be_data | a->size);
128
+ }
129
+ vd += a->stride;
130
+ tcg_gen_addi_i32(addr, addr, 1 << a->size);
131
+ }
132
+ tcg_temp_free_i32(addr);
133
+ tcg_temp_free_i32(tmp);
134
+
135
+ gen_neon_ldst_base_update(s, a->rm, a->rn, (1 << a->size) * nregs);
136
+
137
+ return true;
138
+}
139
diff --git a/target/arm/translate.c b/target/arm/translate.c
140
index XXXXXXX..XXXXXXX 100644
141
--- a/target/arm/translate.c
142
+++ b/target/arm/translate.c
143
@@ -XXX,XX +XXX,XX @@ static void gen_neon_trn_u16(TCGv_i32 t0, TCGv_i32 t1)
144
tcg_temp_free_i32(rd);
145
}
146
147
-
148
-/* Translate a NEON load/store element instruction. Return nonzero if the
149
- instruction is invalid. */
150
-static int disas_neon_ls_insn(DisasContext *s, uint32_t insn)
151
-{
152
- int rd, rn, rm;
153
- int nregs;
154
- int stride;
155
- int size;
156
- int reg;
157
- int load;
158
- TCGv_i32 addr;
159
- TCGv_i32 tmp;
160
-
161
- if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
162
- return 1;
163
- }
164
-
165
- /* FIXME: this access check should not take precedence over UNDEF
166
- * for invalid encodings; we will generate incorrect syndrome information
167
- * for attempts to execute invalid vfp/neon encodings with FP disabled.
168
- */
169
- if (s->fp_excp_el) {
170
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
171
- syn_simd_access_trap(1, 0xe, false), s->fp_excp_el);
172
- return 0;
173
- }
174
-
175
- if (!s->vfp_enabled)
176
- return 1;
177
- VFP_DREG_D(rd, insn);
178
- rn = (insn >> 16) & 0xf;
179
- rm = insn & 0xf;
180
- load = (insn & (1 << 21)) != 0;
181
- if ((insn & (1 << 23)) == 0) {
182
- /* Load store all elements -- handled already by decodetree */
183
- return 1;
184
- } else {
185
- size = (insn >> 10) & 3;
186
- if (size == 3) {
187
- /* Load single element to all lanes -- handled by decodetree */
188
- return 1;
189
- } else {
190
- /* Single element. */
191
- int idx = (insn >> 4) & 0xf;
192
- int reg_idx;
193
- switch (size) {
194
- case 0:
195
- reg_idx = (insn >> 5) & 7;
196
- stride = 1;
197
- break;
198
- case 1:
199
- reg_idx = (insn >> 6) & 3;
200
- stride = (insn & (1 << 5)) ? 2 : 1;
201
- break;
202
- case 2:
203
- reg_idx = (insn >> 7) & 1;
204
- stride = (insn & (1 << 6)) ? 2 : 1;
205
- break;
206
- default:
207
- abort();
208
- }
209
- nregs = ((insn >> 8) & 3) + 1;
210
- /* Catch the UNDEF cases. This is unavoidably a bit messy. */
211
- switch (nregs) {
212
- case 1:
213
- if (((idx & (1 << size)) != 0) ||
214
- (size == 2 && ((idx & 3) == 1 || (idx & 3) == 2))) {
215
- return 1;
216
- }
217
- break;
218
- case 3:
219
- if ((idx & 1) != 0) {
220
- return 1;
221
- }
222
- /* fall through */
223
- case 2:
224
- if (size == 2 && (idx & 2) != 0) {
225
- return 1;
226
- }
227
- break;
228
- case 4:
229
- if ((size == 2) && ((idx & 3) == 3)) {
230
- return 1;
231
- }
232
- break;
233
- default:
234
- abort();
235
- }
236
- if ((rd + stride * (nregs - 1)) > 31) {
237
- /* Attempts to write off the end of the register file
238
- * are UNPREDICTABLE; we choose to UNDEF because otherwise
239
- * the neon_load_reg() would write off the end of the array.
240
- */
241
- return 1;
242
- }
243
- tmp = tcg_temp_new_i32();
244
- addr = tcg_temp_new_i32();
245
- load_reg_var(s, addr, rn);
246
- for (reg = 0; reg < nregs; reg++) {
247
- if (load) {
248
- gen_aa32_ld_i32(s, tmp, addr, get_mem_index(s),
249
- s->be_data | size);
250
- neon_store_element(rd, reg_idx, size, tmp);
251
- } else { /* Store */
252
- neon_load_element(tmp, rd, reg_idx, size);
253
- gen_aa32_st_i32(s, tmp, addr, get_mem_index(s),
254
- s->be_data | size);
255
- }
256
- rd += stride;
257
- tcg_gen_addi_i32(addr, addr, 1 << size);
258
- }
259
- tcg_temp_free_i32(addr);
260
- tcg_temp_free_i32(tmp);
261
- stride = nregs * (1 << size);
262
- }
263
- }
264
- if (rm != 15) {
265
- TCGv_i32 base;
266
-
267
- base = load_reg(s, rn);
268
- if (rm == 13) {
269
- tcg_gen_addi_i32(base, base, stride);
270
- } else {
271
- TCGv_i32 index;
272
- index = load_reg(s, rm);
273
- tcg_gen_add_i32(base, base, index);
274
- tcg_temp_free_i32(index);
275
- }
276
- store_reg(s, rn, base);
277
- }
278
- return 0;
279
-}
280
-
281
static inline void gen_neon_narrow(int size, TCGv_i32 dest, TCGv_i64 src)
282
{
283
switch (size) {
284
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
285
}
286
return;
287
}
288
- if ((insn & 0x0f100000) == 0x04000000) {
289
- /* NEON load/store. */
290
- if (disas_neon_ls_insn(s, insn)) {
291
- goto illegal_op;
292
- }
293
- return;
294
- }
295
if ((insn & 0x0e000f00) == 0x0c000100) {
296
if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) {
297
/* iWMMXt register transfer. */
298
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
299
}
300
break;
301
case 12:
302
- if ((insn & 0x01100000) == 0x01000000) {
303
- if (disas_neon_ls_insn(s, insn)) {
304
- goto illegal_op;
305
- }
306
- break;
307
- }
308
goto illegal_op;
309
default:
310
illegal_op:
311
--
312
2.20.1
313
314
diff view generated by jsdifflib
1
As the first step in implementing ARM v8M's security extension:
1
Convert the Neon 3-reg-same VADD and VSUB insns to decodetree.
2
* add a new feature bit ARM_FEATURE_M_SECURITY
2
3
* add the CPU state field that indicates whether the CPU is
3
Note that we don't need the neon_3r_sizes[op] check here because all
4
currently in the secure state
4
size values are OK for VADD and VSUB; we'll add this when we convert
5
* add a migration subsection for this new state
5
the first insn that has size restrictions.
6
(we will add the Secure copies of banked register state
6
7
to this subsection in later patches)
7
For this we need one of the GVecGen*Fn typedefs currently in
8
* add a #define for the one new-in-v8M exception type
8
translate-a64.h; move them all to translate.h as a block so they
9
* make the CPU debug log print S/NS status
9
are visible to the 32-bit decoder.
10
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 1503414539-28762-4-git-send-email-peter.maydell@linaro.org
13
Message-id: 20200430181003.21682-15-peter.maydell@linaro.org
14
---
14
---
15
target/arm/cpu.h | 3 +++
15
target/arm/translate-a64.h | 9 --------
16
target/arm/cpu.c | 4 ++++
16
target/arm/translate.h | 9 ++++++++
17
target/arm/machine.c | 20 ++++++++++++++++++++
17
target/arm/neon-dp.decode | 17 +++++++++++++++
18
target/arm/translate.c | 8 +++++++-
18
target/arm/translate-neon.inc.c | 38 +++++++++++++++++++++++++++++++++
19
4 files changed, 34 insertions(+), 1 deletion(-)
19
target/arm/translate.c | 14 ++++--------
20
5 files changed, 68 insertions(+), 19 deletions(-)
20
21
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
22
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
22
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.h
24
--- a/target/arm/translate-a64.h
24
+++ b/target/arm/cpu.h
25
+++ b/target/arm/translate-a64.h
26
@@ -XXX,XX +XXX,XX @@ static inline int vec_full_reg_size(DisasContext *s)
27
28
bool disas_sve(DisasContext *, uint32_t);
29
30
-/* Note that the gvec expanders operate on offsets + sizes. */
31
-typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t);
32
-typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t,
33
- uint32_t, uint32_t);
34
-typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t,
35
- uint32_t, uint32_t, uint32_t);
36
-typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t,
37
- uint32_t, uint32_t, uint32_t);
38
-
39
#endif /* TARGET_ARM_TRANSLATE_A64_H */
40
diff --git a/target/arm/translate.h b/target/arm/translate.h
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/arm/translate.h
43
+++ b/target/arm/translate.h
44
@@ -XXX,XX +XXX,XX @@ void gen_sshl_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b);
45
#define dc_isar_feature(name, ctx) \
46
({ DisasContext *ctx_ = (ctx); isar_feature_##name(ctx_->isar); })
47
48
+/* Note that the gvec expanders operate on offsets + sizes. */
49
+typedef void GVecGen2Fn(unsigned, uint32_t, uint32_t, uint32_t, uint32_t);
50
+typedef void GVecGen2iFn(unsigned, uint32_t, uint32_t, int64_t,
51
+ uint32_t, uint32_t);
52
+typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t,
53
+ uint32_t, uint32_t, uint32_t);
54
+typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t,
55
+ uint32_t, uint32_t, uint32_t);
56
+
57
#endif /* TARGET_ARM_TRANSLATE_H */
58
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
59
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/neon-dp.decode
61
+++ b/target/arm/neon-dp.decode
25
@@ -XXX,XX +XXX,XX @@
62
@@ -XXX,XX +XXX,XX @@
26
#define ARMV7M_EXCP_MEM 4
63
#
27
#define ARMV7M_EXCP_BUS 5
64
# This file is processed by scripts/decodetree.py
28
#define ARMV7M_EXCP_USAGE 6
65
#
29
+#define ARMV7M_EXCP_SECURE 7
66
+# VFP/Neon register fields; same as vfp.decode
30
#define ARMV7M_EXCP_SVC 11
67
+%vm_dp 5:1 0:4
31
#define ARMV7M_EXCP_DEBUG 12
68
+%vn_dp 7:1 16:4
32
#define ARMV7M_EXCP_PENDSV 14
69
+%vd_dp 22:1 12:4
33
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
70
34
int exception;
71
# Encodings for Neon data processing instructions where the T32 encoding
35
uint32_t primask;
72
# is a simple transformation of the A32 encoding.
36
uint32_t faultmask;
73
@@ -XXX,XX +XXX,XX @@
37
+ uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
74
# 0b111p_1111_qqqq_qqqq_qqqq_qqqq_qqqq_qqqq
38
} v7m;
75
# This file works on the A32 encoding only; calling code for T32 has to
39
76
# transform the insn into the A32 version first.
40
/* Information associated with an exception about to be taken:
77
+
41
@@ -XXX,XX +XXX,XX @@ enum arm_features {
78
+######################################################################
42
ARM_FEATURE_THUMB_DSP, /* DSP insns supported in the Thumb encodings */
79
+# 3-reg-same grouping:
43
ARM_FEATURE_PMU, /* has PMU support */
80
+# 1111 001 U 0 D sz:2 Vn:4 Vd:4 opc:4 N Q M op Vm:4
44
ARM_FEATURE_VBAR, /* has cp15 VBAR */
81
+######################################################################
45
+ ARM_FEATURE_M_SECURITY, /* M profile Security Extension */
82
+
46
};
83
+&3same vm vn vd q size
47
84
+
48
static inline int arm_feature(CPUARMState *env, int feature)
85
+@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \
49
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
86
+ &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp
87
+
88
+VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
89
+VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
90
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
50
index XXXXXXX..XXXXXXX 100644
91
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/cpu.c
92
--- a/target/arm/translate-neon.inc.c
52
+++ b/target/arm/cpu.c
93
+++ b/target/arm/translate-neon.inc.c
53
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
94
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDST_single(DisasContext *s, arg_VLDST_single *a)
54
uint32_t initial_pc; /* Loaded from 0x4 */
95
55
uint8_t *rom;
96
return true;
56
97
}
57
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
58
+ env->v7m.secure = true;
59
+ }
60
+
98
+
61
/* The reset value of this bit is IMPDEF, but ARM recommends
99
+static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn)
62
* that it resets to 1, so QEMU always does that rather than making
63
* it dependent on CPU model.
64
diff --git a/target/arm/machine.c b/target/arm/machine.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/machine.c
67
+++ b/target/arm/machine.c
68
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav8 = {
69
}
70
};
71
72
+static bool m_security_needed(void *opaque)
73
+{
100
+{
74
+ ARMCPU *cpu = opaque;
101
+ int vec_size = a->q ? 16 : 8;
75
+ CPUARMState *env = &cpu->env;
102
+ int rd_ofs = neon_reg_offset(a->vd, 0);
103
+ int rn_ofs = neon_reg_offset(a->vn, 0);
104
+ int rm_ofs = neon_reg_offset(a->vm, 0);
76
+
105
+
77
+ return arm_feature(env, ARM_FEATURE_M_SECURITY);
106
+ if (!arm_dc_feature(s, ARM_FEATURE_NEON)) {
107
+ return false;
108
+ }
109
+
110
+ /* UNDEF accesses to D16-D31 if they don't exist. */
111
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
112
+ ((a->vd | a->vn | a->vm) & 0x10)) {
113
+ return false;
114
+ }
115
+
116
+ if ((a->vn | a->vm | a->vd) & a->q) {
117
+ return false;
118
+ }
119
+
120
+ if (!vfp_access_check(s)) {
121
+ return true;
122
+ }
123
+
124
+ fn(a->size, rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
125
+ return true;
78
+}
126
+}
79
+
127
+
80
+static const VMStateDescription vmstate_m_security = {
128
+#define DO_3SAME(INSN, FUNC) \
81
+ .name = "cpu/m-security",
129
+ static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \
82
+ .version_id = 1,
130
+ { \
83
+ .minimum_version_id = 1,
131
+ return do_3same(s, a, FUNC); \
84
+ .needed = m_security_needed,
85
+ .fields = (VMStateField[]) {
86
+ VMSTATE_UINT32(env.v7m.secure, ARMCPU),
87
+ VMSTATE_END_OF_LIST()
88
+ }
132
+ }
89
+};
90
+
133
+
91
static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
134
+DO_3SAME(VADD, tcg_gen_gvec_add)
92
VMStateField *field)
135
+DO_3SAME(VSUB, tcg_gen_gvec_sub)
93
{
94
@@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_arm_cpu = {
95
&vmstate_pmsav7_rnr,
96
&vmstate_pmsav7,
97
&vmstate_pmsav8,
98
+ &vmstate_m_security,
99
NULL
100
}
101
};
102
diff --git a/target/arm/translate.c b/target/arm/translate.c
136
diff --git a/target/arm/translate.c b/target/arm/translate.c
103
index XXXXXXX..XXXXXXX 100644
137
index XXXXXXX..XXXXXXX 100644
104
--- a/target/arm/translate.c
138
--- a/target/arm/translate.c
105
+++ b/target/arm/translate.c
139
+++ b/target/arm/translate.c
106
@@ -XXX,XX +XXX,XX @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
140
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
107
if (arm_feature(env, ARM_FEATURE_M)) {
141
}
108
uint32_t xpsr = xpsr_read(env);
142
return 0;
109
const char *mode;
143
110
+ const char *ns_status = "";
144
- case NEON_3R_VADD_VSUB:
145
- if (u) {
146
- tcg_gen_gvec_sub(size, rd_ofs, rn_ofs, rm_ofs,
147
- vec_size, vec_size);
148
- } else {
149
- tcg_gen_gvec_add(size, rd_ofs, rn_ofs, rm_ofs,
150
- vec_size, vec_size);
151
- }
152
- return 0;
153
-
154
case NEON_3R_VQADD:
155
tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
156
rn_ofs, rm_ofs, vec_size, vec_size,
157
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
158
tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
159
u ? &ushl_op[size] : &sshl_op[size]);
160
return 0;
111
+
161
+
112
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
162
+ case NEON_3R_VADD_VSUB:
113
+ ns_status = env->v7m.secure ? "S " : "NS ";
163
+ /* Already handled by decodetree */
114
+ }
164
+ return 1;
115
116
if (xpsr & XPSR_EXCP) {
117
mode = "handler";
118
@@ -XXX,XX +XXX,XX @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
119
}
120
}
165
}
121
166
122
- cpu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s\n",
167
if (size == 3) {
123
+ cpu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
124
xpsr,
125
xpsr & XPSR_N ? 'N' : '-',
126
xpsr & XPSR_Z ? 'Z' : '-',
127
xpsr & XPSR_C ? 'C' : '-',
128
xpsr & XPSR_V ? 'V' : '-',
129
xpsr & XPSR_T ? 'T' : 'A',
130
+ ns_status,
131
mode);
132
} else {
133
uint32_t psr = cpsr_read(env);
134
--
168
--
135
2.7.4
169
2.20.1
136
170
137
171
diff view generated by jsdifflib
1
Make the CONTROL register banked if v8M security extensions are enabled.
1
Convert the Neon logic ops in the 3-reg-same grouping to decodetree.
2
Note that for the logic ops the 'size' field forms part of their
3
decode and the actual operations are always bitwise.
2
4
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 1503414539-28762-10-git-send-email-peter.maydell@linaro.org
7
Message-id: 20200430181003.21682-16-peter.maydell@linaro.org
6
---
8
---
7
target/arm/cpu.h | 5 +++--
9
target/arm/neon-dp.decode | 12 +++++++++++
8
target/arm/helper.c | 21 +++++++++++----------
10
target/arm/translate-neon.inc.c | 19 +++++++++++++++++
9
target/arm/machine.c | 3 ++-
11
target/arm/translate.c | 38 +--------------------------------
10
target/arm/translate.c | 2 +-
12
3 files changed, 32 insertions(+), 37 deletions(-)
11
4 files changed, 17 insertions(+), 14 deletions(-)
12
13
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/cpu.h
16
--- a/target/arm/neon-dp.decode
16
+++ b/target/arm/cpu.h
17
+++ b/target/arm/neon-dp.decode
17
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
18
@@ -XXX,XX +XXX,XX @@
18
uint32_t other_sp;
19
@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \
19
uint32_t vecbase;
20
&3same vm=%vm_dp vn=%vn_dp vd=%vd_dp
20
uint32_t basepri[2];
21
21
- uint32_t control;
22
+@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \
22
+ uint32_t control[2];
23
+ &3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0
23
uint32_t ccr; /* Configuration and Control */
24
+
24
uint32_t cfsr; /* Configurable Fault Status */
25
+VAND_3s 1111 001 0 0 . 00 .... .... 0001 ... 1 .... @3same_logic
25
uint32_t hfsr; /* HardFault Status */
26
+VBIC_3s 1111 001 0 0 . 01 .... .... 0001 ... 1 .... @3same_logic
26
@@ -XXX,XX +XXX,XX @@ static inline bool arm_v7m_is_handler_mode(CPUARMState *env)
27
+VORR_3s 1111 001 0 0 . 10 .... .... 0001 ... 1 .... @3same_logic
27
static inline int arm_current_el(CPUARMState *env)
28
+VORN_3s 1111 001 0 0 . 11 .... .... 0001 ... 1 .... @3same_logic
28
{
29
+VEOR_3s 1111 001 1 0 . 00 .... .... 0001 ... 1 .... @3same_logic
29
if (arm_feature(env, ARM_FEATURE_M)) {
30
+VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
30
- return arm_v7m_is_handler_mode(env) || !(env->v7m.control & 1);
31
+VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
31
+ return arm_v7m_is_handler_mode(env) ||
32
+VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
32
+ !(env->v7m.control[env->v7m.secure] & 1);
33
+
33
}
34
VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
34
35
VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
35
if (is_a64(env)) {
36
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
36
diff --git a/target/arm/helper.c b/target/arm/helper.c
37
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/helper.c
38
--- a/target/arm/translate-neon.inc.c
39
+++ b/target/arm/helper.c
39
+++ b/target/arm/translate-neon.inc.c
40
@@ -XXX,XX +XXX,XX @@ static uint32_t v7m_pop(CPUARMState *env)
40
@@ -XXX,XX +XXX,XX @@ static bool do_3same(DisasContext *s, arg_3same *a, GVecGen3Fn fn)
41
static void switch_v7m_sp(CPUARMState *env, bool new_spsel)
41
42
{
42
DO_3SAME(VADD, tcg_gen_gvec_add)
43
uint32_t tmp;
43
DO_3SAME(VSUB, tcg_gen_gvec_sub)
44
- bool old_spsel = env->v7m.control & R_V7M_CONTROL_SPSEL_MASK;
44
+DO_3SAME(VAND, tcg_gen_gvec_and)
45
+ uint32_t old_control = env->v7m.control[env->v7m.secure];
45
+DO_3SAME(VBIC, tcg_gen_gvec_andc)
46
+ bool old_spsel = old_control & R_V7M_CONTROL_SPSEL_MASK;
46
+DO_3SAME(VORR, tcg_gen_gvec_or)
47
47
+DO_3SAME(VORN, tcg_gen_gvec_orc)
48
if (old_spsel != new_spsel) {
48
+DO_3SAME(VEOR, tcg_gen_gvec_xor)
49
tmp = env->v7m.other_sp;
49
+
50
env->v7m.other_sp = env->regs[13];
50
+/* These insns are all gvec_bitsel but with the inputs in various orders. */
51
env->regs[13] = tmp;
51
+#define DO_3SAME_BITSEL(INSN, O1, O2, O3) \
52
52
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
53
- env->v7m.control = deposit32(env->v7m.control,
53
+ uint32_t rn_ofs, uint32_t rm_ofs, \
54
+ env->v7m.control[env->v7m.secure] = deposit32(old_control,
54
+ uint32_t oprsz, uint32_t maxsz) \
55
R_V7M_CONTROL_SPSEL_SHIFT,
55
+ { \
56
R_V7M_CONTROL_SPSEL_LENGTH, new_spsel);
56
+ tcg_gen_gvec_bitsel(vece, rd_ofs, O1, O2, O3, oprsz, maxsz); \
57
}
57
+ } \
58
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
58
+ DO_3SAME(INSN, gen_##INSN##_3s)
59
}
59
+
60
60
+DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs)
61
lr = 0xfffffff1;
61
+DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs)
62
- if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) {
62
+DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs)
63
+ if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) {
64
lr |= 4;
65
}
66
if (!arm_v7m_is_handler_mode(env)) {
67
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
68
return xpsr_read(env) & mask;
69
break;
70
case 20: /* CONTROL */
71
- return env->v7m.control;
72
+ return env->v7m.control[env->v7m.secure];
73
}
74
75
if (el == 0) {
76
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
77
78
switch (reg) {
79
case 8: /* MSP */
80
- return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ?
81
+ return (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) ?
82
env->v7m.other_sp : env->regs[13];
83
case 9: /* PSP */
84
- return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ?
85
+ return (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) ?
86
env->regs[13] : env->v7m.other_sp;
87
case 16: /* PRIMASK */
88
return env->v7m.primask[env->v7m.secure];
89
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
90
}
91
break;
92
case 8: /* MSP */
93
- if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) {
94
+ if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) {
95
env->v7m.other_sp = val;
96
} else {
97
env->regs[13] = val;
98
}
99
break;
100
case 9: /* PSP */
101
- if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) {
102
+ if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_SPSEL_MASK) {
103
env->regs[13] = val;
104
} else {
105
env->v7m.other_sp = val;
106
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
107
if (!arm_v7m_is_handler_mode(env)) {
108
switch_v7m_sp(env, (val & R_V7M_CONTROL_SPSEL_MASK) != 0);
109
}
110
- env->v7m.control &= ~R_V7M_CONTROL_NPRIV_MASK;
111
- env->v7m.control |= val & R_V7M_CONTROL_NPRIV_MASK;
112
+ env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK;
113
+ env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK;
114
break;
115
default:
116
qemu_log_mask(LOG_GUEST_ERROR, "Attempt to write unknown special"
117
diff --git a/target/arm/machine.c b/target/arm/machine.c
118
index XXXXXXX..XXXXXXX 100644
119
--- a/target/arm/machine.c
120
+++ b/target/arm/machine.c
121
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m = {
122
.fields = (VMStateField[]) {
123
VMSTATE_UINT32(env.v7m.vecbase, ARMCPU),
124
VMSTATE_UINT32(env.v7m.basepri[M_REG_NS], ARMCPU),
125
- VMSTATE_UINT32(env.v7m.control, ARMCPU),
126
+ VMSTATE_UINT32(env.v7m.control[M_REG_NS], ARMCPU),
127
VMSTATE_UINT32(env.v7m.ccr, ARMCPU),
128
VMSTATE_UINT32(env.v7m.cfsr, ARMCPU),
129
VMSTATE_UINT32(env.v7m.hfsr, ARMCPU),
130
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
131
VMSTATE_UINT32(env.v7m.basepri[M_REG_S], ARMCPU),
132
VMSTATE_UINT32(env.v7m.primask[M_REG_S], ARMCPU),
133
VMSTATE_UINT32(env.v7m.faultmask[M_REG_S], ARMCPU),
134
+ VMSTATE_UINT32(env.v7m.control[M_REG_S], ARMCPU),
135
VMSTATE_END_OF_LIST()
136
}
137
};
138
diff --git a/target/arm/translate.c b/target/arm/translate.c
63
diff --git a/target/arm/translate.c b/target/arm/translate.c
139
index XXXXXXX..XXXXXXX 100644
64
index XXXXXXX..XXXXXXX 100644
140
--- a/target/arm/translate.c
65
--- a/target/arm/translate.c
141
+++ b/target/arm/translate.c
66
+++ b/target/arm/translate.c
142
@@ -XXX,XX +XXX,XX @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
67
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
143
if (xpsr & XPSR_EXCP) {
68
}
144
mode = "handler";
69
return 1;
145
} else {
70
146
- if (env->v7m.control & R_V7M_CONTROL_NPRIV_MASK) {
71
- case NEON_3R_LOGIC: /* Logic ops. */
147
+ if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_NPRIV_MASK) {
72
- switch ((u << 2) | size) {
148
mode = "unpriv-thread";
73
- case 0: /* VAND */
149
} else {
74
- tcg_gen_gvec_and(0, rd_ofs, rn_ofs, rm_ofs,
150
mode = "priv-thread";
75
- vec_size, vec_size);
76
- break;
77
- case 1: /* VBIC */
78
- tcg_gen_gvec_andc(0, rd_ofs, rn_ofs, rm_ofs,
79
- vec_size, vec_size);
80
- break;
81
- case 2: /* VORR */
82
- tcg_gen_gvec_or(0, rd_ofs, rn_ofs, rm_ofs,
83
- vec_size, vec_size);
84
- break;
85
- case 3: /* VORN */
86
- tcg_gen_gvec_orc(0, rd_ofs, rn_ofs, rm_ofs,
87
- vec_size, vec_size);
88
- break;
89
- case 4: /* VEOR */
90
- tcg_gen_gvec_xor(0, rd_ofs, rn_ofs, rm_ofs,
91
- vec_size, vec_size);
92
- break;
93
- case 5: /* VBSL */
94
- tcg_gen_gvec_bitsel(MO_8, rd_ofs, rd_ofs, rn_ofs, rm_ofs,
95
- vec_size, vec_size);
96
- break;
97
- case 6: /* VBIT */
98
- tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rn_ofs, rd_ofs,
99
- vec_size, vec_size);
100
- break;
101
- case 7: /* VBIF */
102
- tcg_gen_gvec_bitsel(MO_8, rd_ofs, rm_ofs, rd_ofs, rn_ofs,
103
- vec_size, vec_size);
104
- break;
105
- }
106
- return 0;
107
-
108
case NEON_3R_VQADD:
109
tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
110
rn_ofs, rm_ofs, vec_size, vec_size,
111
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
112
return 0;
113
114
case NEON_3R_VADD_VSUB:
115
+ case NEON_3R_LOGIC:
116
/* Already handled by decodetree */
117
return 1;
118
}
151
--
119
--
152
2.7.4
120
2.20.1
153
121
154
122
diff view generated by jsdifflib
1
For v8M the range 0xe002e000..0xe002efff is an alias region which
1
Convert the Neon 3-reg-same VMAX and VMIN insns to decodetree.
2
for secure accesses behaves like a NonSecure access to the main
3
SCS region. (For nonsecure accesses including when the security
4
extension is not implemented, it is RAZ/WI.)
5
2
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 1503414539-28762-11-git-send-email-peter.maydell@linaro.org
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20200430181003.21682-17-peter.maydell@linaro.org
8
---
6
---
9
include/hw/intc/armv7m_nvic.h | 1 +
7
target/arm/neon-dp.decode | 5 +++++
10
hw/intc/armv7m_nvic.c | 66 ++++++++++++++++++++++++++++++++++++++++++-
8
target/arm/translate-neon.inc.c | 14 ++++++++++++++
11
2 files changed, 66 insertions(+), 1 deletion(-)
9
target/arm/translate.c | 21 ++-------------------
10
3 files changed, 21 insertions(+), 19 deletions(-)
12
11
13
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
12
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
14
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
15
--- a/include/hw/intc/armv7m_nvic.h
14
--- a/target/arm/neon-dp.decode
16
+++ b/include/hw/intc/armv7m_nvic.h
15
+++ b/target/arm/neon-dp.decode
17
@@ -XXX,XX +XXX,XX @@ typedef struct NVICState {
16
@@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
18
int exception_prio; /* group prio of the highest prio active exception */
17
VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
19
18
VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
20
MemoryRegion sysregmem;
19
21
+ MemoryRegion sysreg_ns_mem;
20
+VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same
22
MemoryRegion container;
21
+VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
23
22
+VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same
24
uint32_t num_irq;
23
+VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same
25
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
24
+
25
VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
26
VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
27
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
26
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/intc/armv7m_nvic.c
29
--- a/target/arm/translate-neon.inc.c
28
+++ b/hw/intc/armv7m_nvic.c
30
+++ b/target/arm/translate-neon.inc.c
29
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps nvic_sysreg_ops = {
31
@@ -XXX,XX +XXX,XX @@ DO_3SAME(VEOR, tcg_gen_gvec_xor)
30
.endianness = DEVICE_NATIVE_ENDIAN,
32
DO_3SAME_BITSEL(VBSL, rd_ofs, rn_ofs, rm_ofs)
31
};
33
DO_3SAME_BITSEL(VBIT, rm_ofs, rn_ofs, rd_ofs)
32
34
DO_3SAME_BITSEL(VBIF, rm_ofs, rd_ofs, rn_ofs)
33
+static MemTxResult nvic_sysreg_ns_write(void *opaque, hwaddr addr,
34
+ uint64_t value, unsigned size,
35
+ MemTxAttrs attrs)
36
+{
37
+ if (attrs.secure) {
38
+ /* S accesses to the alias act like NS accesses to the real region */
39
+ attrs.secure = 0;
40
+ return nvic_sysreg_write(opaque, addr, value, size, attrs);
41
+ } else {
42
+ /* NS attrs are RAZ/WI for privileged, and BusFault for user */
43
+ if (attrs.user) {
44
+ return MEMTX_ERROR;
45
+ }
46
+ return MEMTX_OK;
47
+ }
48
+}
49
+
35
+
50
+static MemTxResult nvic_sysreg_ns_read(void *opaque, hwaddr addr,
36
+#define DO_3SAME_NO_SZ_3(INSN, FUNC) \
51
+ uint64_t *data, unsigned size,
37
+ static bool trans_##INSN##_3s(DisasContext *s, arg_3same *a) \
52
+ MemTxAttrs attrs)
38
+ { \
53
+{
39
+ if (a->size == 3) { \
54
+ if (attrs.secure) {
40
+ return false; \
55
+ /* S accesses to the alias act like NS accesses to the real region */
41
+ } \
56
+ attrs.secure = 0;
42
+ return do_3same(s, a, FUNC); \
57
+ return nvic_sysreg_read(opaque, addr, data, size, attrs);
58
+ } else {
59
+ /* NS attrs are RAZ/WI for privileged, and BusFault for user */
60
+ if (attrs.user) {
61
+ return MEMTX_ERROR;
62
+ }
63
+ *data = 0;
64
+ return MEMTX_OK;
65
+ }
66
+}
67
+
68
+static const MemoryRegionOps nvic_sysreg_ns_ops = {
69
+ .read_with_attrs = nvic_sysreg_ns_read,
70
+ .write_with_attrs = nvic_sysreg_ns_write,
71
+ .endianness = DEVICE_NATIVE_ENDIAN,
72
+};
73
+
74
static int nvic_post_load(void *opaque, int version_id)
75
{
76
NVICState *s = opaque;
77
@@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp)
78
NVICState *s = NVIC(dev);
79
SysBusDevice *systick_sbd;
80
Error *err = NULL;
81
+ int regionlen;
82
83
s->cpu = ARM_CPU(qemu_get_cpu(0));
84
assert(s->cpu);
85
@@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp)
86
* 0xd00..0xd3c - SCS registers
87
* 0xd40..0xeff - Reserved or Not implemented
88
* 0xf00 - STIR
89
+ *
90
+ * Some registers within this space are banked between security states.
91
+ * In v8M there is a second range 0xe002e000..0xe002efff which is the
92
+ * NonSecure alias SCS; secure accesses to this behave like NS accesses
93
+ * to the main SCS range, and non-secure accesses (including when
94
+ * the security extension is not implemented) are RAZ/WI.
95
+ * Note that both the main SCS range and the alias range are defined
96
+ * to be exempt from memory attribution (R_BLJT) and so the memory
97
+ * transaction attribute always matches the current CPU security
98
+ * state (attrs.secure == env->v7m.secure). In the nvic_sysreg_ns_ops
99
+ * wrappers we change attrs.secure to indicate the NS access; so
100
+ * generally code determining which banked register to use should
101
+ * use attrs.secure; code determining actual behaviour of the system
102
+ * should use env->v7m.secure.
103
*/
104
- memory_region_init(&s->container, OBJECT(s), "nvic", 0x1000);
105
+ regionlen = arm_feature(&s->cpu->env, ARM_FEATURE_V8) ? 0x21000 : 0x1000;
106
+ memory_region_init(&s->container, OBJECT(s), "nvic", regionlen);
107
/* The system register region goes at the bottom of the priority
108
* stack as it covers the whole page.
109
*/
110
@@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_realize(DeviceState *dev, Error **errp)
111
sysbus_mmio_get_region(systick_sbd, 0),
112
1);
113
114
+ if (arm_feature(&s->cpu->env, ARM_FEATURE_V8)) {
115
+ memory_region_init_io(&s->sysreg_ns_mem, OBJECT(s),
116
+ &nvic_sysreg_ns_ops, s,
117
+ "nvic_sysregs_ns", 0x1000);
118
+ memory_region_add_subregion(&s->container, 0x20000, &s->sysreg_ns_mem);
119
+ }
43
+ }
120
+
44
+
121
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->container);
45
+DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax)
122
}
46
+DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax)
123
47
+DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin)
48
+DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin)
49
diff --git a/target/arm/translate.c b/target/arm/translate.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/translate.c
52
+++ b/target/arm/translate.c
53
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
54
rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
55
return 0;
56
57
- case NEON_3R_VMAX:
58
- if (u) {
59
- tcg_gen_gvec_umax(size, rd_ofs, rn_ofs, rm_ofs,
60
- vec_size, vec_size);
61
- } else {
62
- tcg_gen_gvec_smax(size, rd_ofs, rn_ofs, rm_ofs,
63
- vec_size, vec_size);
64
- }
65
- return 0;
66
- case NEON_3R_VMIN:
67
- if (u) {
68
- tcg_gen_gvec_umin(size, rd_ofs, rn_ofs, rm_ofs,
69
- vec_size, vec_size);
70
- } else {
71
- tcg_gen_gvec_smin(size, rd_ofs, rn_ofs, rm_ofs,
72
- vec_size, vec_size);
73
- }
74
- return 0;
75
-
76
case NEON_3R_VSHL:
77
/* Note the operation is vshl vd,vm,vn */
78
tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
79
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
80
81
case NEON_3R_VADD_VSUB:
82
case NEON_3R_LOGIC:
83
+ case NEON_3R_VMAX:
84
+ case NEON_3R_VMIN:
85
/* Already handled by decodetree */
86
return 1;
87
}
124
--
88
--
125
2.7.4
89
2.20.1
126
90
127
91
diff view generated by jsdifflib
1
Make the PRIMASK register banked if v8M security extensions are enabled.
1
Convert the Neon comparison ops in the 3-reg-same grouping
2
2
to decodetree.
3
Note that we do not yet implement the functionality of the new
4
AIRCR.PRIS bit (which allows the effect of the NS copy of PRIMASK to
5
be restricted).
6
3
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 1503414539-28762-8-git-send-email-peter.maydell@linaro.org
6
Message-id: 20200430181003.21682-18-peter.maydell@linaro.org
10
---
7
---
11
target/arm/cpu.h | 2 +-
8
target/arm/neon-dp.decode | 8 ++++++++
12
hw/intc/armv7m_nvic.c | 2 +-
9
target/arm/translate-neon.inc.c | 22 ++++++++++++++++++++++
13
target/arm/helper.c | 4 ++--
10
target/arm/translate.c | 23 +++--------------------
14
target/arm/machine.c | 9 +++++++--
11
3 files changed, 33 insertions(+), 20 deletions(-)
15
4 files changed, 11 insertions(+), 6 deletions(-)
16
12
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
15
--- a/target/arm/neon-dp.decode
20
+++ b/target/arm/cpu.h
16
+++ b/target/arm/neon-dp.decode
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
17
@@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
22
uint32_t bfar; /* BusFault Address */
18
VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
23
unsigned mpu_ctrl; /* MPU_CTRL */
19
VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
24
int exception;
20
25
- uint32_t primask;
21
+VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same
26
+ uint32_t primask[2];
22
+VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same
27
uint32_t faultmask;
23
+VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same
28
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
24
+VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same
29
} v7m;
25
+
30
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
26
VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same
27
VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
28
VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same
29
@@ -XXX,XX +XXX,XX @@ VMIN_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 1 .... @3same
30
31
VADD_3s 1111 001 0 0 . .. .... .... 1000 . . . 0 .... @3same
32
VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
33
+
34
+VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same
35
+VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same
36
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
31
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/intc/armv7m_nvic.c
38
--- a/target/arm/translate-neon.inc.c
33
+++ b/hw/intc/armv7m_nvic.c
39
+++ b/target/arm/translate-neon.inc.c
34
@@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s)
40
@@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax)
35
41
DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax)
36
if (env->v7m.faultmask) {
42
DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin)
37
running = -1;
43
DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin)
38
- } else if (env->v7m.primask) {
44
+
39
+ } else if (env->v7m.primask[env->v7m.secure]) {
45
+#define DO_3SAME_CMP(INSN, COND) \
40
running = 0;
46
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
41
} else if (env->v7m.basepri[env->v7m.secure] > 0) {
47
+ uint32_t rn_ofs, uint32_t rm_ofs, \
42
running = env->v7m.basepri[env->v7m.secure] & nvic_gprio_mask(s);
48
+ uint32_t oprsz, uint32_t maxsz) \
43
diff --git a/target/arm/helper.c b/target/arm/helper.c
49
+ { \
50
+ tcg_gen_gvec_cmp(COND, vece, rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz); \
51
+ } \
52
+ DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s)
53
+
54
+DO_3SAME_CMP(VCGT_S, TCG_COND_GT)
55
+DO_3SAME_CMP(VCGT_U, TCG_COND_GTU)
56
+DO_3SAME_CMP(VCGE_S, TCG_COND_GE)
57
+DO_3SAME_CMP(VCGE_U, TCG_COND_GEU)
58
+DO_3SAME_CMP(VCEQ, TCG_COND_EQ)
59
+
60
+static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
61
+ uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz)
62
+{
63
+ tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]);
64
+}
65
+DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s)
66
diff --git a/target/arm/translate.c b/target/arm/translate.c
44
index XXXXXXX..XXXXXXX 100644
67
index XXXXXXX..XXXXXXX 100644
45
--- a/target/arm/helper.c
68
--- a/target/arm/translate.c
46
+++ b/target/arm/helper.c
69
+++ b/target/arm/translate.c
47
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
70
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
48
return (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) ?
71
u ? &mls_op[size] : &mla_op[size]);
49
env->regs[13] : env->v7m.other_sp;
72
return 0;
50
case 16: /* PRIMASK */
73
51
- return env->v7m.primask;
74
- case NEON_3R_VTST_VCEQ:
52
+ return env->v7m.primask[env->v7m.secure];
75
- if (u) { /* VCEQ */
53
case 17: /* BASEPRI */
76
- tcg_gen_gvec_cmp(TCG_COND_EQ, size, rd_ofs, rn_ofs, rm_ofs,
54
case 18: /* BASEPRI_MAX */
77
- vec_size, vec_size);
55
return env->v7m.basepri[env->v7m.secure];
78
- } else { /* VTST */
56
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
79
- tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs,
57
}
80
- vec_size, vec_size, &cmtst_op[size]);
58
break;
81
- }
59
case 16: /* PRIMASK */
82
- return 0;
60
- env->v7m.primask = val & 1;
83
-
61
+ env->v7m.primask[env->v7m.secure] = val & 1;
84
- case NEON_3R_VCGT:
62
break;
85
- tcg_gen_gvec_cmp(u ? TCG_COND_GTU : TCG_COND_GT, size,
63
case 17: /* BASEPRI */
86
- rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
64
env->v7m.basepri[env->v7m.secure] = val & 0xff;
87
- return 0;
65
diff --git a/target/arm/machine.c b/target/arm/machine.c
88
-
66
index XXXXXXX..XXXXXXX 100644
89
- case NEON_3R_VCGE:
67
--- a/target/arm/machine.c
90
- tcg_gen_gvec_cmp(u ? TCG_COND_GEU : TCG_COND_GE, size,
68
+++ b/target/arm/machine.c
91
- rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size);
69
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_faultmask_primask = {
92
- return 0;
70
.minimum_version_id = 1,
93
-
71
.fields = (VMStateField[]) {
94
case NEON_3R_VSHL:
72
VMSTATE_UINT32(env.v7m.faultmask, ARMCPU),
95
/* Note the operation is vshl vd,vm,vn */
73
- VMSTATE_UINT32(env.v7m.primask, ARMCPU),
96
tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
74
+ VMSTATE_UINT32(env.v7m.primask[M_REG_NS], ARMCPU),
97
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
75
VMSTATE_END_OF_LIST()
98
case NEON_3R_LOGIC:
76
}
99
case NEON_3R_VMAX:
77
};
100
case NEON_3R_VMIN:
78
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
101
+ case NEON_3R_VTST_VCEQ:
79
.fields = (VMStateField[]) {
102
+ case NEON_3R_VCGT:
80
VMSTATE_UINT32(env.v7m.secure, ARMCPU),
103
+ case NEON_3R_VCGE:
81
VMSTATE_UINT32(env.v7m.basepri[M_REG_S], ARMCPU),
104
/* Already handled by decodetree */
82
+ VMSTATE_UINT32(env.v7m.primask[M_REG_S], ARMCPU),
105
return 1;
83
VMSTATE_END_OF_LIST()
84
}
85
};
86
@@ -XXX,XX +XXX,XX @@ static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
87
* differences are that the T bit is not in the same place, the
88
* primask/faultmask info may be in the CPSR I and F bits, and
89
* we do not want the mode bits.
90
+ * We know that this cleanup happened before v8M, so there
91
+ * is no complication with banked primask/faultmask.
92
*/
93
uint32_t newval = val;
94
95
+ assert(!arm_feature(env, ARM_FEATURE_M_SECURITY));
96
+
97
newval &= (CPSR_NZCV | CPSR_Q | CPSR_IT | CPSR_GE);
98
if (val & CPSR_T) {
99
newval |= XPSR_T;
100
@@ -XXX,XX +XXX,XX @@ static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
101
env->v7m.faultmask = 1;
102
}
103
if (val & CPSR_I) {
104
- env->v7m.primask = 1;
105
+ env->v7m.primask[M_REG_NS] = 1;
106
}
107
val = newval;
108
}
106
}
109
--
107
--
110
2.7.4
108
2.20.1
111
109
112
110
diff view generated by jsdifflib
1
Now that MPU lookups can return different results for v8M
1
Convert the Neon VQADD/VQSUB insns in the 3-reg-same grouping
2
when the CPU is in secure vs non-secure state, we need to
2
to decodetree.
3
have separate MMU indexes; add the secure counterparts
4
to the existing three M profile MMU indexes.
5
3
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 1503414539-28762-6-git-send-email-peter.maydell@linaro.org
6
Message-id: 20200430181003.21682-19-peter.maydell@linaro.org
9
---
7
---
10
target/arm/cpu.h | 19 +++++++++++++++++--
8
target/arm/neon-dp.decode | 6 ++++++
11
target/arm/helper.c | 9 ++++++++-
9
target/arm/translate-neon.inc.c | 15 +++++++++++++++
12
2 files changed, 25 insertions(+), 3 deletions(-)
10
target/arm/translate.c | 14 ++------------
11
3 files changed, 23 insertions(+), 12 deletions(-)
13
12
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
15
--- a/target/arm/neon-dp.decode
17
+++ b/target/arm/cpu.h
16
+++ b/target/arm/neon-dp.decode
18
@@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
17
@@ -XXX,XX +XXX,XX @@
19
* Execution priority negative (this is like privileged, but the
18
@3same .... ... . . . size:2 .... .... .... . q:1 . . .... \
20
* MPU HFNMIENA bit means that it may have different access permission
19
&3same vm=%vm_dp vn=%vn_dp vd=%vd_dp
21
* check results to normal privileged code, so can't share a TLB).
20
22
+ * If the CPU supports the v8M Security Extension then there are also:
21
+VQADD_S_3s 1111 001 0 0 . .. .... .... 0000 . . . 1 .... @3same
23
+ * Secure User
22
+VQADD_U_3s 1111 001 1 0 . .. .... .... 0000 . . . 1 .... @3same
24
+ * Secure Privileged
25
+ * Secure, execution priority negative
26
*
27
* The ARMMMUIdx and the mmu index value used by the core QEMU TLB code
28
* are not quite the same -- different CPU types (most notably M profile
29
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdx {
30
ARMMMUIdx_MUser = 0 | ARM_MMU_IDX_M,
31
ARMMMUIdx_MPriv = 1 | ARM_MMU_IDX_M,
32
ARMMMUIdx_MNegPri = 2 | ARM_MMU_IDX_M,
33
+ ARMMMUIdx_MSUser = 3 | ARM_MMU_IDX_M,
34
+ ARMMMUIdx_MSPriv = 4 | ARM_MMU_IDX_M,
35
+ ARMMMUIdx_MSNegPri = 5 | ARM_MMU_IDX_M,
36
/* Indexes below here don't have TLBs and are used only for AT system
37
* instructions or for the first stage of an S12 page table walk.
38
*/
39
@@ -XXX,XX +XXX,XX @@ typedef enum ARMMMUIdxBit {
40
ARMMMUIdxBit_MUser = 1 << 0,
41
ARMMMUIdxBit_MPriv = 1 << 1,
42
ARMMMUIdxBit_MNegPri = 1 << 2,
43
+ ARMMMUIdxBit_MSUser = 1 << 3,
44
+ ARMMMUIdxBit_MSPriv = 1 << 4,
45
+ ARMMMUIdxBit_MSNegPri = 1 << 5,
46
} ARMMMUIdxBit;
47
48
#define MMU_USER_IDX 0
49
@@ -XXX,XX +XXX,XX @@ static inline int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx)
50
case ARM_MMU_IDX_A:
51
return mmu_idx & 3;
52
case ARM_MMU_IDX_M:
53
- return mmu_idx == ARMMMUIdx_MUser ? 0 : 1;
54
+ return (mmu_idx == ARMMMUIdx_MUser || mmu_idx == ARMMMUIdx_MSUser)
55
+ ? 0 : 1;
56
default:
57
g_assert_not_reached();
58
}
59
@@ -XXX,XX +XXX,XX @@ static inline int cpu_mmu_index(CPUARMState *env, bool ifetch)
60
*/
61
if ((env->v7m.exception > 0 && env->v7m.exception <= 3)
62
|| env->v7m.faultmask) {
63
- return arm_to_core_mmu_idx(ARMMMUIdx_MNegPri);
64
+ mmu_idx = ARMMMUIdx_MNegPri;
65
+ }
66
+
23
+
67
+ if (env->v7m.secure) {
24
@3same_logic .... ... . . . .. .... .... .... . q:1 .. .... \
68
+ mmu_idx += ARMMMUIdx_MSUser;
25
&3same vm=%vm_dp vn=%vn_dp vd=%vd_dp size=0
26
27
@@ -XXX,XX +XXX,XX @@ VBSL_3s 1111 001 1 0 . 01 .... .... 0001 ... 1 .... @3same_logic
28
VBIT_3s 1111 001 1 0 . 10 .... .... 0001 ... 1 .... @3same_logic
29
VBIF_3s 1111 001 1 0 . 11 .... .... 0001 ... 1 .... @3same_logic
30
31
+VQSUB_S_3s 1111 001 0 0 . .. .... .... 0010 . . . 1 .... @3same
32
+VQSUB_U_3s 1111 001 1 0 . .. .... .... 0010 . . . 1 .... @3same
33
+
34
VCGT_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 0 .... @3same
35
VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same
36
VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same
37
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate-neon.inc.c
40
+++ b/target/arm/translate-neon.inc.c
41
@@ -XXX,XX +XXX,XX @@ static void gen_VTST_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
42
tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz, &cmtst_op[vece]);
43
}
44
DO_3SAME_NO_SZ_3(VTST, gen_VTST_3s)
45
+
46
+#define DO_3SAME_GVEC4(INSN, OPARRAY) \
47
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
48
+ uint32_t rn_ofs, uint32_t rm_ofs, \
49
+ uint32_t oprsz, uint32_t maxsz) \
50
+ { \
51
+ tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), \
52
+ rn_ofs, rm_ofs, oprsz, maxsz, &OPARRAY[vece]); \
53
+ } \
54
+ DO_3SAME(INSN, gen_##INSN##_3s)
55
+
56
+DO_3SAME_GVEC4(VQADD_S, sqadd_op)
57
+DO_3SAME_GVEC4(VQADD_U, uqadd_op)
58
+DO_3SAME_GVEC4(VQSUB_S, sqsub_op)
59
+DO_3SAME_GVEC4(VQSUB_U, uqsub_op)
60
diff --git a/target/arm/translate.c b/target/arm/translate.c
61
index XXXXXXX..XXXXXXX 100644
62
--- a/target/arm/translate.c
63
+++ b/target/arm/translate.c
64
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
65
}
66
return 1;
67
68
- case NEON_3R_VQADD:
69
- tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
70
- rn_ofs, rm_ofs, vec_size, vec_size,
71
- (u ? uqadd_op : sqadd_op) + size);
72
- return 0;
73
-
74
- case NEON_3R_VQSUB:
75
- tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc),
76
- rn_ofs, rm_ofs, vec_size, vec_size,
77
- (u ? uqsub_op : sqsub_op) + size);
78
- return 0;
79
-
80
case NEON_3R_VMUL: /* VMUL */
81
if (u) {
82
/* Polynomial case allows only P8. */
83
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
84
case NEON_3R_VTST_VCEQ:
85
case NEON_3R_VCGT:
86
case NEON_3R_VCGE:
87
+ case NEON_3R_VQADD:
88
+ case NEON_3R_VQSUB:
89
/* Already handled by decodetree */
90
return 1;
69
}
91
}
70
71
return arm_to_core_mmu_idx(mmu_idx);
72
diff --git a/target/arm/helper.c b/target/arm/helper.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/helper.c
75
+++ b/target/arm/helper.c
76
@@ -XXX,XX +XXX,XX @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx)
77
case ARMMMUIdx_MPriv:
78
case ARMMMUIdx_MNegPri:
79
case ARMMMUIdx_MUser:
80
+ case ARMMMUIdx_MSPriv:
81
+ case ARMMMUIdx_MSNegPri:
82
+ case ARMMMUIdx_MSUser:
83
return 1;
84
default:
85
g_assert_not_reached();
86
@@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx)
87
case ARMMMUIdx_S1E3:
88
case ARMMMUIdx_S1SE0:
89
case ARMMMUIdx_S1SE1:
90
+ case ARMMMUIdx_MSPriv:
91
+ case ARMMMUIdx_MSNegPri:
92
+ case ARMMMUIdx_MSUser:
93
return true;
94
default:
95
g_assert_not_reached();
96
@@ -XXX,XX +XXX,XX @@ static inline bool regime_translation_disabled(CPUARMState *env,
97
(R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK)) {
98
case R_V7M_MPU_CTRL_ENABLE_MASK:
99
/* Enabled, but not for HardFault and NMI */
100
- return mmu_idx == ARMMMUIdx_MNegPri;
101
+ return mmu_idx == ARMMMUIdx_MNegPri ||
102
+ mmu_idx == ARMMMUIdx_MSNegPri;
103
case R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK:
104
/* Enabled for all cases */
105
return false;
106
--
92
--
107
2.7.4
93
2.20.1
108
94
109
95
diff view generated by jsdifflib
1
Make the FAULTMASK register banked if v8M security extensions are enabled.
1
Convert the Neon VMUL, VMLA, VMLS and VSHL insns in the
2
2
3-reg-same grouping to decodetree.
3
Note that we do not yet implement the functionality of the new
4
AIRCR.PRIS bit (which allows the effect of the NS copy of FAULTMASK to
5
be restricted).
6
7
This patch includes the code to determine for v8M which copy
8
of FAULTMASK should be updated on exception exit; further
9
changes will be required to the exception exit code in general
10
to support v8M, so this is just a small piece of that.
11
12
The v8M ARM ARM introduces a notation where individual paragraphs
13
are labelled with R (for rule) or I (for information) followed
14
by a random group of subscript letters. In comments where we want
15
to refer to a particular part of the manual we use this convention,
16
which should be more stable across document revisions than using
17
section or page numbers.
18
3
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 1503414539-28762-9-git-send-email-peter.maydell@linaro.org
6
Message-id: 20200430181003.21682-20-peter.maydell@linaro.org
22
---
7
---
23
target/arm/cpu.h | 14 ++++++++++++--
8
target/arm/neon-dp.decode | 9 +++++++
24
hw/intc/armv7m_nvic.c | 9 ++++++++-
9
target/arm/translate-neon.inc.c | 44 +++++++++++++++++++++++++++++++++
25
target/arm/helper.c | 20 ++++++++++++++++----
10
target/arm/translate.c | 28 +++------------------
26
target/arm/machine.c | 5 +++--
11
3 files changed, 56 insertions(+), 25 deletions(-)
27
4 files changed, 39 insertions(+), 9 deletions(-)
28
12
29
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/neon-dp.decode b/target/arm/neon-dp.decode
30
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/cpu.h
15
--- a/target/arm/neon-dp.decode
32
+++ b/target/arm/cpu.h
16
+++ b/target/arm/neon-dp.decode
33
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
17
@@ -XXX,XX +XXX,XX @@ VCGT_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 0 .... @3same
34
unsigned mpu_ctrl; /* MPU_CTRL */
18
VCGE_S_3s 1111 001 0 0 . .. .... .... 0011 . . . 1 .... @3same
35
int exception;
19
VCGE_U_3s 1111 001 1 0 . .. .... .... 0011 . . . 1 .... @3same
36
uint32_t primask[2];
20
37
- uint32_t faultmask;
21
+VSHL_S_3s 1111 001 0 0 . .. .... .... 0100 . . . 0 .... @3same
38
+ uint32_t faultmask[2];
22
+VSHL_U_3s 1111 001 1 0 . .. .... .... 0100 . . . 0 .... @3same
39
uint32_t secure; /* Is CPU in Secure state? (not guest visible) */
23
+
40
} v7m;
24
VMAX_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 0 .... @3same
41
25
VMAX_U_3s 1111 001 1 0 . .. .... .... 0110 . . . 0 .... @3same
42
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque);
26
VMIN_S_3s 1111 001 0 0 . .. .... .... 0110 . . . 1 .... @3same
43
* (Ignoring -1, this is the same as the RETTOBASE value before completion.)
27
@@ -XXX,XX +XXX,XX @@ VSUB_3s 1111 001 1 0 . .. .... .... 1000 . . . 0 .... @3same
44
*/
28
45
int armv7m_nvic_complete_irq(void *opaque, int irq);
29
VTST_3s 1111 001 0 0 . .. .... .... 1000 . . . 1 .... @3same
46
+/**
30
VCEQ_3s 1111 001 1 0 . .. .... .... 1000 . . . 1 .... @3same
47
+ * armv7m_nvic_raw_execution_priority: return the raw execution priority
31
+
48
+ * @opaque: the NVIC
32
+VMLA_3s 1111 001 0 0 . .. .... .... 1001 . . . 0 .... @3same
49
+ *
33
+VMLS_3s 1111 001 1 0 . .. .... .... 1001 . . . 0 .... @3same
50
+ * Returns: the raw execution priority as defined by the v8M architecture.
34
+
51
+ * This is the execution priority minus the effects of AIRCR.PRIS,
35
+VMUL_3s 1111 001 0 0 . .. .... .... 1001 . . . 1 .... @3same
52
+ * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
36
+VMUL_p_3s 1111 001 1 0 . .. .... .... 1001 . . . 1 .... @3same
53
+ * (v8M ARM ARM I_PKLD.)
37
diff --git a/target/arm/translate-neon.inc.c b/target/arm/translate-neon.inc.c
54
+ */
55
+int armv7m_nvic_raw_execution_priority(void *opaque);
56
57
/* Interface for defining coprocessor registers.
58
* Registers are defined in tables of arm_cp_reginfo structs
59
@@ -XXX,XX +XXX,XX @@ static inline int cpu_mmu_index(CPUARMState *env, bool ifetch)
60
* we're in a HardFault or NMI handler.
61
*/
62
if ((env->v7m.exception > 0 && env->v7m.exception <= 3)
63
- || env->v7m.faultmask) {
64
+ || env->v7m.faultmask[env->v7m.secure]) {
65
mmu_idx = ARMMMUIdx_MNegPri;
66
}
67
68
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
69
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/intc/armv7m_nvic.c
39
--- a/target/arm/translate-neon.inc.c
71
+++ b/hw/intc/armv7m_nvic.c
40
+++ b/target/arm/translate-neon.inc.c
72
@@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s)
41
@@ -XXX,XX +XXX,XX @@ DO_3SAME_NO_SZ_3(VMAX_S, tcg_gen_gvec_smax)
73
CPUARMState *env = &s->cpu->env;
42
DO_3SAME_NO_SZ_3(VMAX_U, tcg_gen_gvec_umax)
74
int running;
43
DO_3SAME_NO_SZ_3(VMIN_S, tcg_gen_gvec_smin)
75
44
DO_3SAME_NO_SZ_3(VMIN_U, tcg_gen_gvec_umin)
76
- if (env->v7m.faultmask) {
45
+DO_3SAME_NO_SZ_3(VMUL, tcg_gen_gvec_mul)
77
+ if (env->v7m.faultmask[env->v7m.secure]) {
46
78
running = -1;
47
#define DO_3SAME_CMP(INSN, COND) \
79
} else if (env->v7m.primask[env->v7m.secure]) {
48
static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
80
running = 0;
49
@@ -XXX,XX +XXX,XX @@ DO_3SAME_GVEC4(VQADD_S, sqadd_op)
81
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_can_take_pending_exception(void *opaque)
50
DO_3SAME_GVEC4(VQADD_U, uqadd_op)
82
return nvic_exec_prio(s) > nvic_pending_prio(s);
51
DO_3SAME_GVEC4(VQSUB_S, sqsub_op)
83
}
52
DO_3SAME_GVEC4(VQSUB_U, uqsub_op)
84
53
+
85
+int armv7m_nvic_raw_execution_priority(void *opaque)
54
+static void gen_VMUL_p_3s(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
55
+ uint32_t rm_ofs, uint32_t oprsz, uint32_t maxsz)
86
+{
56
+{
87
+ NVICState *s = opaque;
57
+ tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, oprsz, maxsz,
88
+
58
+ 0, gen_helper_gvec_pmul_b);
89
+ return s->exception_prio;
90
+}
59
+}
91
+
60
+
92
/* caller must call nvic_irq_update() after this */
61
+static bool trans_VMUL_p_3s(DisasContext *s, arg_3same *a)
93
static void set_prio(NVICState *s, unsigned irq, uint8_t prio)
62
+{
94
{
63
+ if (a->size != 0) {
95
diff --git a/target/arm/helper.c b/target/arm/helper.c
64
+ return false;
65
+ }
66
+ return do_3same(s, a, gen_VMUL_p_3s);
67
+}
68
+
69
+#define DO_3SAME_GVEC3_NO_SZ_3(INSN, OPARRAY) \
70
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
71
+ uint32_t rn_ofs, uint32_t rm_ofs, \
72
+ uint32_t oprsz, uint32_t maxsz) \
73
+ { \
74
+ tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, \
75
+ oprsz, maxsz, &OPARRAY[vece]); \
76
+ } \
77
+ DO_3SAME_NO_SZ_3(INSN, gen_##INSN##_3s)
78
+
79
+
80
+DO_3SAME_GVEC3_NO_SZ_3(VMLA, mla_op)
81
+DO_3SAME_GVEC3_NO_SZ_3(VMLS, mls_op)
82
+
83
+#define DO_3SAME_GVEC3_SHIFT(INSN, OPARRAY) \
84
+ static void gen_##INSN##_3s(unsigned vece, uint32_t rd_ofs, \
85
+ uint32_t rn_ofs, uint32_t rm_ofs, \
86
+ uint32_t oprsz, uint32_t maxsz) \
87
+ { \
88
+ /* Note the operation is vshl vd,vm,vn */ \
89
+ tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, \
90
+ oprsz, maxsz, &OPARRAY[vece]); \
91
+ } \
92
+ DO_3SAME(INSN, gen_##INSN##_3s)
93
+
94
+DO_3SAME_GVEC3_SHIFT(VSHL_S, sshl_op)
95
+DO_3SAME_GVEC3_SHIFT(VSHL_U, ushl_op)
96
diff --git a/target/arm/translate.c b/target/arm/translate.c
96
index XXXXXXX..XXXXXXX 100644
97
index XXXXXXX..XXXXXXX 100644
97
--- a/target/arm/helper.c
98
--- a/target/arm/translate.c
98
+++ b/target/arm/helper.c
99
+++ b/target/arm/translate.c
99
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
100
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
100
}
101
}
101
102
return 1;
102
if (env->v7m.exception != ARMV7M_EXCP_NMI) {
103
103
- /* Auto-clear FAULTMASK on return from other than NMI */
104
- case NEON_3R_VMUL: /* VMUL */
104
- env->v7m.faultmask = 0;
105
- if (u) {
105
+ /* Auto-clear FAULTMASK on return from other than NMI.
106
- /* Polynomial case allows only P8. */
106
+ * If the security extension is implemented then this only
107
- if (size != 0) {
107
+ * happens if the raw execution priority is >= 0; the
108
- return 1;
108
+ * value of the ES bit in the exception return value indicates
109
- }
109
+ * which security state's faultmask to clear. (v8M ARM ARM R_KBNF.)
110
- tcg_gen_gvec_3_ool(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size,
110
+ */
111
- 0, gen_helper_gvec_pmul_b);
111
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
112
- } else {
112
+ int es = type & 1;
113
- tcg_gen_gvec_mul(size, rd_ofs, rn_ofs, rm_ofs,
113
+ if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) {
114
- vec_size, vec_size);
114
+ env->v7m.faultmask[es] = 0;
115
- }
115
+ }
116
- return 0;
116
+ } else {
117
-
117
+ env->v7m.faultmask[M_REG_NS] = 0;
118
- case NEON_3R_VML: /* VMLA, VMLS */
118
+ }
119
- tcg_gen_gvec_3(rd_ofs, rn_ofs, rm_ofs, vec_size, vec_size,
119
}
120
- u ? &mls_op[size] : &mla_op[size]);
120
121
- return 0;
121
switch (armv7m_nvic_complete_irq(env->nvic, env->v7m.exception)) {
122
-
122
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
123
- case NEON_3R_VSHL:
123
case 18: /* BASEPRI_MAX */
124
- /* Note the operation is vshl vd,vm,vn */
124
return env->v7m.basepri[env->v7m.secure];
125
- tcg_gen_gvec_3(rd_ofs, rm_ofs, rn_ofs, vec_size, vec_size,
125
case 19: /* FAULTMASK */
126
- u ? &ushl_op[size] : &sshl_op[size]);
126
- return env->v7m.faultmask;
127
- return 0;
127
+ return env->v7m.faultmask[env->v7m.secure];
128
-
128
default:
129
case NEON_3R_VADD_VSUB:
129
qemu_log_mask(LOG_GUEST_ERROR, "Attempt to read unknown special"
130
case NEON_3R_LOGIC:
130
" register %d\n", reg);
131
case NEON_3R_VMAX:
131
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
132
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
133
case NEON_3R_VCGE:
134
case NEON_3R_VQADD:
135
case NEON_3R_VQSUB:
136
+ case NEON_3R_VMUL:
137
+ case NEON_3R_VML:
138
+ case NEON_3R_VSHL:
139
/* Already handled by decodetree */
140
return 1;
132
}
141
}
133
break;
134
case 19: /* FAULTMASK */
135
- env->v7m.faultmask = val & 1;
136
+ env->v7m.faultmask[env->v7m.secure] = val & 1;
137
break;
138
case 20: /* CONTROL */
139
/* Writing to the SPSEL bit only has an effect if we are in
140
diff --git a/target/arm/machine.c b/target/arm/machine.c
141
index XXXXXXX..XXXXXXX 100644
142
--- a/target/arm/machine.c
143
+++ b/target/arm/machine.c
144
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_faultmask_primask = {
145
.version_id = 1,
146
.minimum_version_id = 1,
147
.fields = (VMStateField[]) {
148
- VMSTATE_UINT32(env.v7m.faultmask, ARMCPU),
149
+ VMSTATE_UINT32(env.v7m.faultmask[M_REG_NS], ARMCPU),
150
VMSTATE_UINT32(env.v7m.primask[M_REG_NS], ARMCPU),
151
VMSTATE_END_OF_LIST()
152
}
153
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m_security = {
154
VMSTATE_UINT32(env.v7m.secure, ARMCPU),
155
VMSTATE_UINT32(env.v7m.basepri[M_REG_S], ARMCPU),
156
VMSTATE_UINT32(env.v7m.primask[M_REG_S], ARMCPU),
157
+ VMSTATE_UINT32(env.v7m.faultmask[M_REG_S], ARMCPU),
158
VMSTATE_END_OF_LIST()
159
}
160
};
161
@@ -XXX,XX +XXX,XX @@ static int get_cpsr(QEMUFile *f, void *opaque, size_t size,
162
* transferred using the vmstate_m_faultmask_primask subsection.
163
*/
164
if (val & CPSR_F) {
165
- env->v7m.faultmask = 1;
166
+ env->v7m.faultmask[M_REG_NS] = 1;
167
}
168
if (val & CPSR_I) {
169
env->v7m.primask[M_REG_NS] = 1;
170
--
142
--
171
2.7.4
143
2.20.1
172
144
173
145
diff view generated by jsdifflib
1
Define a new MachineClass field ignore_memory_transaction_failures.
1
We're going to want at least some of the NeonGen* typedefs
2
If this is flag is true then the CPU will ignore memory transaction
2
for the refactored 32-bit Neon decoder, so move them all
3
failures which should cause the CPU to take an exception due to an
3
to translate.h since it makes more sense to keep them in
4
access to an unassigned physical address; the transaction will
4
one group.
5
instead return zero (for a read) or be ignored (for a write). This
6
should be set only by legacy board models which rely on the old
7
RAZ/WI behaviour for handling devices that QEMU does not yet model.
8
New board models should instead use "unimplemented-device" for all
9
memory ranges where the guest will attempt to probe for a device that
10
QEMU doesn't implement and a stub device is required.
11
12
We need this for ARM boards, where we're about to implement support for
13
generating external aborts on memory transaction failures. Too many
14
of our legacy board models rely on the RAZ/WI behaviour and we
15
would break currently working guests when their "probe for device"
16
code provoked an external abort rather than a RAZ.
17
5
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
8
Message-id: 20200430181003.21682-23-peter.maydell@linaro.org
21
Message-id: 1504626814-23124-2-git-send-email-peter.maydell@linaro.org
22
---
9
---
23
include/hw/boards.h | 11 +++++++++++
10
target/arm/translate.h | 17 +++++++++++++++++
24
include/qom/cpu.h | 7 ++++++-
11
target/arm/translate-a64.c | 17 -----------------
25
qom/cpu.c | 16 ++++++++++++++++
12
2 files changed, 17 insertions(+), 17 deletions(-)
26
3 files changed, 33 insertions(+), 1 deletion(-)
27
13
28
diff --git a/include/hw/boards.h b/include/hw/boards.h
14
diff --git a/target/arm/translate.h b/target/arm/translate.h
29
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
30
--- a/include/hw/boards.h
16
--- a/target/arm/translate.h
31
+++ b/include/hw/boards.h
17
+++ b/target/arm/translate.h
32
@@ -XXX,XX +XXX,XX @@ typedef struct {
18
@@ -XXX,XX +XXX,XX @@ typedef void GVecGen3Fn(unsigned, uint32_t, uint32_t,
33
* size than the target architecture's minimum. (Attempting to create
19
typedef void GVecGen4Fn(unsigned, uint32_t, uint32_t, uint32_t,
34
* such a CPU will fail.) Note that changing this is a migration
20
uint32_t, uint32_t, uint32_t);
35
* compatibility break for the machine.
21
36
+ * @ignore_memory_transaction_failures:
22
+/* Function prototype for gen_ functions for calling Neon helpers */
37
+ * If this is flag is true then the CPU will ignore memory transaction
23
+typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32);
38
+ * failures which should cause the CPU to take an exception due to an
24
+typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32);
39
+ * access to an unassigned physical address; the transaction will instead
25
+typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32);
40
+ * return zero (for a read) or be ignored (for a write). This should be
26
+typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64);
41
+ * set only by legacy board models which rely on the old RAZ/WI behaviour
27
+typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64);
42
+ * for handling devices that QEMU does not yet model. New board models
28
+typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64);
43
+ * should instead use "unimplemented-device" for all memory ranges where
29
+typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64);
44
+ * the guest will attempt to probe for a device that QEMU doesn't
30
+typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32);
45
+ * implement and a stub device is required.
31
+typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
46
*/
32
+typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr);
47
struct MachineClass {
33
+typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64);
48
/*< private >*/
34
+typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr);
49
@@ -XXX,XX +XXX,XX @@ struct MachineClass {
35
+typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32);
50
bool rom_file_has_mr;
36
+typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr);
51
int minimum_page_bits;
37
+typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp);
52
bool has_hotpluggable_cpus;
38
+
53
+ bool ignore_memory_transaction_failures;
39
#endif /* TARGET_ARM_TRANSLATE_H */
54
int numa_mem_align_shift;
40
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
55
void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
56
int nb_nodes, ram_addr_t size);
57
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
58
index XXXXXXX..XXXXXXX 100644
41
index XXXXXXX..XXXXXXX 100644
59
--- a/include/qom/cpu.h
42
--- a/target/arm/translate-a64.c
60
+++ b/include/qom/cpu.h
43
+++ b/target/arm/translate-a64.c
61
@@ -XXX,XX +XXX,XX @@ struct qemu_work_item;
44
@@ -XXX,XX +XXX,XX @@ typedef struct AArch64DecodeTable {
62
* @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes
45
AArch64DecodeFn *disas_fn;
63
* to @trace_dstate).
46
} AArch64DecodeTable;
64
* @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask).
47
65
+ * @ignore_memory_transaction_failures: Cached copy of the MachineState
48
-/* Function prototype for gen_ functions for calling Neon helpers */
66
+ * flag of the same name: allows the board to suppress calling of the
49
-typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32);
67
+ * CPU do_transaction_failed hook function.
50
-typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32);
68
*
51
-typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32);
69
* State of one CPU core or thread.
52
-typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64);
70
*/
53
-typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64);
71
@@ -XXX,XX +XXX,XX @@ struct CPUState {
54
-typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64);
72
*/
55
-typedef void NeonGenNarrowEnvFn(TCGv_i32, TCGv_ptr, TCGv_i64);
73
bool throttle_thread_scheduled;
56
-typedef void NeonGenWidenFn(TCGv_i64, TCGv_i32);
74
57
-typedef void NeonGenTwoSingleOPFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
75
+ bool ignore_memory_transaction_failures;
58
-typedef void NeonGenTwoDoubleOPFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_ptr);
76
+
59
-typedef void NeonGenOneOpFn(TCGv_i64, TCGv_i64);
77
/* Note that this is accessed at the start of every TB via a negative
60
-typedef void CryptoTwoOpFn(TCGv_ptr, TCGv_ptr);
78
offset from AREG0. Leave this field at the end so as to make the
61
-typedef void CryptoThreeOpIntFn(TCGv_ptr, TCGv_ptr, TCGv_i32);
79
(absolute value) offset as small as possible. This reduces code
62
-typedef void CryptoThreeOpFn(TCGv_ptr, TCGv_ptr, TCGv_ptr);
80
@@ -XXX,XX +XXX,XX @@ static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr,
63
-typedef void AtomicThreeOpFn(TCGv_i64, TCGv_i64, TCGv_i64, TCGArg, MemOp);
64
-
65
/* initialize TCG globals. */
66
void a64_translate_init(void)
81
{
67
{
82
CPUClass *cc = CPU_GET_CLASS(cpu);
83
84
- if (cc->do_transaction_failed) {
85
+ if (!cpu->ignore_memory_transaction_failures && cc->do_transaction_failed) {
86
cc->do_transaction_failed(cpu, physaddr, addr, size, access_type,
87
mmu_idx, attrs, response, retaddr);
88
}
89
diff --git a/qom/cpu.c b/qom/cpu.c
90
index XXXXXXX..XXXXXXX 100644
91
--- a/qom/cpu.c
92
+++ b/qom/cpu.c
93
@@ -XXX,XX +XXX,XX @@
94
#include "exec/cpu-common.h"
95
#include "qemu/error-report.h"
96
#include "sysemu/sysemu.h"
97
+#include "hw/boards.h"
98
#include "hw/qdev-properties.h"
99
#include "trace-root.h"
100
101
@@ -XXX,XX +XXX,XX @@ static void cpu_common_parse_features(const char *typename, char *features,
102
static void cpu_common_realizefn(DeviceState *dev, Error **errp)
103
{
104
CPUState *cpu = CPU(dev);
105
+ Object *machine = qdev_get_machine();
106
+
107
+ /* qdev_get_machine() can return something that's not TYPE_MACHINE
108
+ * if this is one of the user-only emulators; in that case there's
109
+ * no need to check the ignore_memory_transaction_failures board flag.
110
+ */
111
+ if (object_dynamic_cast(machine, TYPE_MACHINE)) {
112
+ ObjectClass *oc = object_get_class(machine);
113
+ MachineClass *mc = MACHINE_CLASS(oc);
114
+
115
+ if (mc) {
116
+ cpu->ignore_memory_transaction_failures =
117
+ mc->ignore_memory_transaction_failures;
118
+ }
119
+ }
120
121
if (dev->hotplugged) {
122
cpu_synchronize_post_init(cpu);
123
--
68
--
124
2.7.4
69
2.20.1
125
70
126
71
diff view generated by jsdifflib