1
target-arm queue. This has the "plumb txattrs through various
1
Just flushing my target-arm queue since I won't be working next week :-)
2
bits of exec.c" patches, and a collection of bug fixes from
3
various people.
4
2
5
thanks
6
-- PMM
3
-- PMM
7
4
5
The following changes since commit b3cd3b5a66f0dddfe3d5ba2bef13cd4f5b89cde9:
8
6
9
7
Merge tag 'pull-riscv-to-apply-20220610' of github.com:alistair23/qemu into staging (2022-06-09 22:08:27 -0700)
10
The following changes since commit a3ac12fba028df90f7b3dbec924995c126c41022:
11
12
Merge remote-tracking branch 'remotes/ehabkost/tags/numa-next-pull-request' into staging (2018-05-31 11:12:36 +0100)
13
8
14
are available in the Git repository at:
9
are available in the Git repository at:
15
10
16
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180531
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220610
17
12
18
for you to fetch changes up to 49d1dca0520ea71bc21867fab6647f474fcf857b:
13
for you to fetch changes up to 90c072e063737e9e8f431489bbd334452f89056e:
19
14
20
KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice (2018-05-31 14:52:53 +0100)
15
semihosting/config: Merge --semihosting-config option groups (2022-06-10 14:32:36 +0100)
21
16
22
----------------------------------------------------------------
17
----------------------------------------------------------------
23
target-arm queue:
18
* refactor exception routing code
24
* target/arm: Honour FPCR.FZ in FRECPX
19
* fix SCR_EL3 RAO/RAZ bits
25
* MAINTAINERS: Add entries for newer MPS2 boards and devices
20
* gdbstub: Don't use GDB syscalls if no GDB is attached
26
* hw/intc/arm_gicv3: Fix APxR<n> register dispatching
21
* semihosting/config: Merge --semihosting-config option groups
27
* arm_gicv3_kvm: fix bug in writing zero bits back to the in-kernel
22
* tests/qtest: Reduce npcm7xx_sdhci test image size
28
GIC state
29
* tcg: Fix helper function vs host abi for float16
30
* arm: fix qemu crash on startup with -bios option
31
* arm: fix malloc type mismatch
32
* xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors
33
* Correct CPACR reset value for v7 cores
34
* memory.h: Improve IOMMU related documentation
35
* exec: Plumb transaction attributes through various functions in
36
preparation for allowing IOMMUs to see them
37
* vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY
38
* ARM: ACPI: Fix use-after-free due to memory realloc
39
* KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice
40
23
41
----------------------------------------------------------------
24
----------------------------------------------------------------
42
Francisco Iglesias (1):
25
Hao Wu (1):
43
xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors
26
tests/qtest: Reduce npcm7xx_sdhci test image size
44
27
45
Igor Mammedov (1):
28
Peter Maydell (2):
46
arm: fix qemu crash on startup with -bios option
29
gdbstub: Don't use GDB syscalls if no GDB is attached
30
semihosting/config: Merge --semihosting-config option groups
47
31
48
Jan Kiszka (1):
32
Richard Henderson (25):
49
hw/intc/arm_gicv3: Fix APxR<n> register dispatching
33
target/arm: Mark exception helpers as noreturn
34
target/arm: Add coproc parameter to syn_fp_access_trap
35
target/arm: Move exception_target_el out of line
36
target/arm: Move arm_singlestep_active out of line
37
target/arm: Move arm_generate_debug_exceptions out of line
38
target/arm: Use is_a64 in arm_generate_debug_exceptions
39
target/arm: Move exception_bkpt_insn to debug_helper.c
40
target/arm: Move arm_debug_exception_fsr to debug_helper.c
41
target/arm: Rename helper_exception_with_syndrome
42
target/arm: Introduce gen_exception_insn_el_v
43
target/arm: Rename gen_exception_insn to gen_exception_insn_el
44
target/arm: Introduce gen_exception_insn
45
target/arm: Create helper_exception_swstep
46
target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL
47
target/arm: Move gen_exception to translate.c
48
target/arm: Rename gen_exception to gen_exception_el
49
target/arm: Introduce gen_exception
50
target/arm: Introduce gen_exception_el_v
51
target/arm: Introduce helper_exception_with_syndrome
52
target/arm: Remove default_exception_el
53
target/arm: Create raise_exception_debug
54
target/arm: Move arm_debug_target_el to debug_helper.c
55
target/arm: Fix Secure PL1 tests in fp_exception_el
56
target/arm: Adjust format test in scr_write
57
target/arm: SCR_EL3.RW is RAO/WI without AArch32 EL[12]
50
58
51
Paolo Bonzini (1):
59
target/arm/cpu.h | 133 ++---------------------
52
arm: fix malloc type mismatch
60
target/arm/helper.h | 8 +-
53
61
target/arm/internals.h | 43 +-------
54
Peter Maydell (17):
62
target/arm/syndrome.h | 7 +-
55
target/arm: Honour FPCR.FZ in FRECPX
63
target/arm/translate.h | 43 ++------
56
MAINTAINERS: Add entries for newer MPS2 boards and devices
64
gdbstub.c | 14 ++-
57
Correct CPACR reset value for v7 cores
65
semihosting/config.c | 1 +
58
memory.h: Improve IOMMU related documentation
66
target/arm/debug_helper.c | 220 +++++++++++++++++++++++++++++++++++++--
59
Make tb_invalidate_phys_addr() take a MemTxAttrs argument
67
target/arm/helper.c | 53 ++++------
60
Make address_space_translate{, _cached}() take a MemTxAttrs argument
68
target/arm/op_helper.c | 52 +++++----
61
Make address_space_map() take a MemTxAttrs argument
69
target/arm/translate-a64.c | 34 +++---
62
Make address_space_access_valid() take a MemTxAttrs argument
70
target/arm/translate-m-nocp.c | 15 ++-
63
Make flatview_extend_translation() take a MemTxAttrs argument
71
target/arm/translate-mve.c | 3 +-
64
Make memory_region_access_valid() take a MemTxAttrs argument
72
target/arm/translate-vfp.c | 18 +++-
65
Make MemoryRegion valid.accepts callback take a MemTxAttrs argument
73
target/arm/translate.c | 106 ++++++++++---------
66
Make flatview_access_valid() take a MemTxAttrs argument
74
tests/qtest/npcm7xx_sdhci-test.c | 2 +-
67
Make flatview_translate() take a MemTxAttrs argument
75
16 files changed, 390 insertions(+), 362 deletions(-)
68
Make address_space_get_iotlb_entry() take a MemTxAttrs argument
69
Make flatview_do_translate() take a MemTxAttrs argument
70
Make address_space_translate_iommu take a MemTxAttrs argument
71
vmstate.h: Provide VMSTATE_BOOL_SUB_ARRAY
72
73
Richard Henderson (1):
74
tcg: Fix helper function vs host abi for float16
75
76
Shannon Zhao (3):
77
arm_gicv3_kvm: increase clroffset accordingly
78
ARM: ACPI: Fix use-after-free due to memory realloc
79
KVM: GIC: Fix memory leak due to calling kvm_init_irq_routing twice
80
81
include/exec/exec-all.h | 5 +-
82
include/exec/helper-head.h | 2 +-
83
include/exec/memory-internal.h | 3 +-
84
include/exec/memory.h | 128 +++++++++++++++++++++++++++++++++++------
85
include/migration/vmstate.h | 3 +
86
include/sysemu/dma.h | 6 +-
87
accel/tcg/translate-all.c | 4 +-
88
exec.c | 95 ++++++++++++++++++------------
89
hw/arm/boot.c | 18 +++---
90
hw/arm/virt-acpi-build.c | 20 +++++--
91
hw/dma/xlnx-zdma.c | 10 +++-
92
hw/hppa/dino.c | 3 +-
93
hw/intc/arm_gic_kvm.c | 1 -
94
hw/intc/arm_gicv3_cpuif.c | 12 ++--
95
hw/intc/arm_gicv3_kvm.c | 2 +-
96
hw/nvram/fw_cfg.c | 12 ++--
97
hw/s390x/s390-pci-inst.c | 3 +-
98
hw/scsi/esp.c | 3 +-
99
hw/vfio/common.c | 3 +-
100
hw/virtio/vhost.c | 3 +-
101
hw/xen/xen_pt_msi.c | 3 +-
102
memory.c | 12 ++--
103
memory_ldst.inc.c | 18 +++---
104
target/arm/gdbstub.c | 3 +-
105
target/arm/helper-a64.c | 41 +++++++------
106
target/arm/helper.c | 90 ++++++++++++++++-------------
107
target/ppc/mmu-hash64.c | 3 +-
108
target/riscv/helper.c | 2 +-
109
target/s390x/diag.c | 6 +-
110
target/s390x/excp_helper.c | 3 +-
111
target/s390x/mmu_helper.c | 3 +-
112
target/s390x/sigp.c | 3 +-
113
target/xtensa/op_helper.c | 3 +-
114
MAINTAINERS | 9 ++-
115
34 files changed, 353 insertions(+), 182 deletions(-)
116
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220609202901.1177572-2-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
target/arm/helper.h | 6 +++---
9
1 file changed, 3 insertions(+), 3 deletions(-)
10
11
diff --git a/target/arm/helper.h b/target/arm/helper.h
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/helper.h
14
+++ b/target/arm/helper.h
15
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i32)
16
17
DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
18
i32, i32, i32, i32)
19
-DEF_HELPER_2(exception_internal, void, env, i32)
20
-DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32)
21
-DEF_HELPER_2(exception_bkpt_insn, void, env, i32)
22
+DEF_HELPER_2(exception_internal, noreturn, env, i32)
23
+DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32)
24
+DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32)
25
DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl)
26
DEF_HELPER_1(setend, void, env)
27
DEF_HELPER_2(wfi, void, env, i32)
28
--
29
2.25.1
diff view generated by jsdifflib
1
From: Shannon Zhao <zhaoshenglong@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
acpi_data_push uses g_array_set_size to resize the memory size. If there
3
With ARMv8, this field is always RES0.
4
is no enough contiguous memory, the address will be changed. So previous
4
With ARMv7, targeting EL2 and TA=0, it is always 0xA.
5
pointer could not be used any more. It must update the pointer and use
6
the new one.
7
5
8
Also, previous codes wrongly use le32 conversion of iort->node_offset
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
for subsequent computations that will result incorrect value if host is
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
not litlle endian. So use the non-converted one instead.
8
Message-id: 20220609202901.1177572-3-richard.henderson@linaro.org
11
12
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
13
Reviewed-by: Eric Auger <eric.auger@redhat.com>
14
Message-id: 1527663951-14552-1-git-send-email-zhaoshenglong@huawei.com
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
hw/arm/virt-acpi-build.c | 20 +++++++++++++++-----
11
target/arm/syndrome.h | 7 ++++---
18
1 file changed, 15 insertions(+), 5 deletions(-)
12
target/arm/translate-a64.c | 3 ++-
13
target/arm/translate-vfp.c | 14 ++++++++++++--
14
3 files changed, 18 insertions(+), 6 deletions(-)
19
15
20
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
16
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
21
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/virt-acpi-build.c
18
--- a/target/arm/syndrome.h
23
+++ b/hw/arm/virt-acpi-build.c
19
+++ b/target/arm/syndrome.h
24
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
20
@@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_cp15_rrt_trap(int cv, int cond, int opc1, int crm,
25
AcpiIortItsGroup *its;
21
| (rt2 << 10) | (rt << 5) | (crm << 1) | isread;
26
AcpiIortTable *iort;
22
}
27
AcpiIortSmmu3 *smmu;
23
28
- size_t node_size, iort_length, smmu_offset = 0;
24
-static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit)
29
+ size_t node_size, iort_node_offset, iort_length, smmu_offset = 0;
25
+static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit,
30
AcpiIortRC *rc;
26
+ int coproc)
31
27
{
32
iort = acpi_data_push(table_data, sizeof(*iort));
28
- /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA == 0 coproc == 0xa */
33
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
29
+ /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA == 0 */
34
30
return (EC_ADVSIMDFPACCESSTRAP << ARM_EL_EC_SHIFT)
35
iort_length = sizeof(*iort);
31
| (is_16bit ? 0 : ARM_EL_IL)
36
iort->node_count = cpu_to_le32(nb_nodes);
32
- | (cv << 24) | (cond << 20) | 0xa;
37
- iort->node_offset = cpu_to_le32(sizeof(*iort));
33
+ | (cv << 24) | (cond << 20) | coproc;
38
+ /*
34
}
39
+ * Use a copy in case table_data->data moves during acpi_data_push
35
40
+ * operations.
36
static inline uint32_t syn_simd_access_trap(int cv, int cond, bool is_16bit)
41
+ */
37
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
42
+ iort_node_offset = sizeof(*iort);
38
index XXXXXXX..XXXXXXX 100644
43
+ iort->node_offset = cpu_to_le32(iort_node_offset);
39
--- a/target/arm/translate-a64.c
44
40
+++ b/target/arm/translate-a64.c
45
/* ITS group node */
41
@@ -XXX,XX +XXX,XX @@ static bool fp_access_check(DisasContext *s)
46
node_size = sizeof(*its) + sizeof(uint32_t);
42
s->fp_access_checked = true;
47
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
43
48
int irq = vms->irqmap[VIRT_SMMU];
44
gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
49
45
- syn_fp_access_trap(1, 0xe, false), s->fp_excp_el);
50
/* SMMUv3 node */
46
+ syn_fp_access_trap(1, 0xe, false, 0),
51
- smmu_offset = iort->node_offset + node_size;
47
+ s->fp_excp_el);
52
+ smmu_offset = iort_node_offset + node_size;
48
return false;
53
node_size = sizeof(*smmu) + sizeof(*idmap);
54
iort_length += node_size;
55
smmu = acpi_data_push(table_data, node_size);
56
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
57
idmap->id_count = cpu_to_le32(0xFFFF);
58
idmap->output_base = 0;
59
/* output IORT node is the ITS group node (the first node) */
60
- idmap->output_reference = cpu_to_le32(iort->node_offset);
61
+ idmap->output_reference = cpu_to_le32(iort_node_offset);
62
}
49
}
63
50
s->fp_access_checked = true;
64
/* Root Complex Node */
51
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c
65
@@ -XXX,XX +XXX,XX @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
52
index XXXXXXX..XXXXXXX 100644
66
idmap->output_reference = cpu_to_le32(smmu_offset);
53
--- a/target/arm/translate-vfp.c
67
} else {
54
+++ b/target/arm/translate-vfp.c
68
/* output IORT node is the ITS group node (the first node) */
55
@@ -XXX,XX +XXX,XX @@ static void gen_update_fp_context(DisasContext *s)
69
- idmap->output_reference = cpu_to_le32(iort->node_offset);
56
static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled)
70
+ idmap->output_reference = cpu_to_le32(iort_node_offset);
57
{
58
if (s->fp_excp_el) {
59
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
60
- syn_fp_access_trap(1, 0xe, false), s->fp_excp_el);
61
+ /*
62
+ * The full syndrome is only used for HSR when HCPTR traps:
63
+ * For v8, when TA==0, coproc is RES0.
64
+ * For v7, any use of a Floating-point instruction or access
65
+ * to a Floating-point Extension register that is trapped to
66
+ * Hyp mode because of a trap configured in the HCPTR sets
67
+ * this field to 0xA.
68
+ */
69
+ int coproc = arm_dc_feature(s, ARM_FEATURE_V8) ? 0 : 0xa;
70
+ uint32_t syn = syn_fp_access_trap(1, 0xe, false, coproc);
71
+
72
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el);
73
return false;
71
}
74
}
72
75
73
+ /*
74
+ * Update the pointer address in case table_data->data moves during above
75
+ * acpi_data_push operations.
76
+ */
77
+ iort = (AcpiIortTable *)(table_data->data + iort_start);
78
iort->length = cpu_to_le32(iort_length);
79
80
build_header(linker, table_data, (void *)(table_data->data + iort_start),
81
--
76
--
82
2.17.1
77
2.25.1
83
84
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Move the function to op_helper.c, near raise_exception.
4
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220609202901.1177572-4-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/internals.h | 16 +---------------
11
target/arm/op_helper.c | 15 +++++++++++++++
12
2 files changed, 16 insertions(+), 15 deletions(-)
13
14
diff --git a/target/arm/internals.h b/target/arm/internals.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/internals.h
17
+++ b/target/arm/internals.h
18
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
19
int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx);
20
int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx);
21
22
-static inline int exception_target_el(CPUARMState *env)
23
-{
24
- int target_el = MAX(1, arm_current_el(env));
25
-
26
- /*
27
- * No such thing as secure EL1 if EL3 is aarch32,
28
- * so update the target EL to EL3 in this case.
29
- */
30
- if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) {
31
- target_el = 3;
32
- }
33
-
34
- return target_el;
35
-}
36
-
37
/* Determine if allocation tags are available. */
38
static inline bool allocation_tag_access_enabled(CPUARMState *env, int el,
39
uint64_t sctlr)
40
@@ -XXX,XX +XXX,XX @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
41
bool el_is_in_host(CPUARMState *env, int el);
42
43
void aa32_max_features(ARMCPU *cpu);
44
+int exception_target_el(CPUARMState *env);
45
46
/* Powers of 2 for sve_vq_map et al. */
47
#define SVE_VQ_POW2_MAP \
48
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/target/arm/op_helper.c
51
+++ b/target/arm/op_helper.c
52
@@ -XXX,XX +XXX,XX @@
53
#define SIGNBIT (uint32_t)0x80000000
54
#define SIGNBIT64 ((uint64_t)1 << 63)
55
56
+int exception_target_el(CPUARMState *env)
57
+{
58
+ int target_el = MAX(1, arm_current_el(env));
59
+
60
+ /*
61
+ * No such thing as secure EL1 if EL3 is aarch32,
62
+ * so update the target EL to EL3 in this case.
63
+ */
64
+ if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el == 1) {
65
+ target_el = 3;
66
+ }
67
+
68
+ return target_el;
69
+}
70
+
71
void raise_exception(CPUARMState *env, uint32_t excp,
72
uint32_t syndrome, uint32_t target_el)
73
{
74
--
75
2.25.1
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Move the function to debug_helper.c, and the
4
declaration to internals.h.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-5-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 10 ----------
12
target/arm/internals.h | 1 +
13
target/arm/debug_helper.c | 12 ++++++++++++
14
3 files changed, 13 insertions(+), 10 deletions(-)
15
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
19
+++ b/target/arm/cpu.h
20
@@ -XXX,XX +XXX,XX @@ static inline bool arm_generate_debug_exceptions(CPUARMState *env)
21
}
22
}
23
24
-/* Is single-stepping active? (Note that the "is EL_D AArch64?" check
25
- * implicitly means this always returns false in pre-v8 CPUs.)
26
- */
27
-static inline bool arm_singlestep_active(CPUARMState *env)
28
-{
29
- return extract32(env->cp15.mdscr_el1, 0, 1)
30
- && arm_el_is_aa64(env, arm_debug_target_el(env))
31
- && arm_generate_debug_exceptions(env);
32
-}
33
-
34
static inline bool arm_sctlr_b(CPUARMState *env)
35
{
36
return
37
diff --git a/target/arm/internals.h b/target/arm/internals.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/internals.h
40
+++ b/target/arm/internals.h
41
@@ -XXX,XX +XXX,XX @@ bool el_is_in_host(CPUARMState *env, int el);
42
43
void aa32_max_features(ARMCPU *cpu);
44
int exception_target_el(CPUARMState *env);
45
+bool arm_singlestep_active(CPUARMState *env);
46
47
/* Powers of 2 for sve_vq_map et al. */
48
#define SVE_VQ_POW2_MAP \
49
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/debug_helper.c
52
+++ b/target/arm/debug_helper.c
53
@@ -XXX,XX +XXX,XX @@
54
#include "exec/exec-all.h"
55
#include "exec/helper-proto.h"
56
57
+
58
+/*
59
+ * Is single-stepping active? (Note that the "is EL_D AArch64?" check
60
+ * implicitly means this always returns false in pre-v8 CPUs.)
61
+ */
62
+bool arm_singlestep_active(CPUARMState *env)
63
+{
64
+ return extract32(env->cp15.mdscr_el1, 0, 1)
65
+ && arm_el_is_aa64(env, arm_debug_target_el(env))
66
+ && arm_generate_debug_exceptions(env);
67
+}
68
+
69
/* Return true if the linked breakpoint entry lbn passes its checks */
70
static bool linked_bp_matches(ARMCPU *cpu, int lbn)
71
{
72
--
73
2.25.1
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to flatview_do_translate().
3
2
3
Move arm_generate_debug_exceptions and its two subroutines,
4
{aa32,aa64}_generate_debug_exceptions into debug_helper.c,
5
and the one interface declaration to internals.h.
6
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220609202901.1177572-6-richard.henderson@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180521140402.23318-13-peter.maydell@linaro.org
8
---
11
---
9
exec.c | 9 ++++++---
12
target/arm/cpu.h | 91 -------------------------------------
10
1 file changed, 6 insertions(+), 3 deletions(-)
13
target/arm/internals.h | 1 +
14
target/arm/debug_helper.c | 94 +++++++++++++++++++++++++++++++++++++++
15
3 files changed, 95 insertions(+), 91 deletions(-)
11
16
12
diff --git a/exec.c b/exec.c
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
14
--- a/exec.c
19
--- a/target/arm/cpu.h
15
+++ b/exec.c
20
+++ b/target/arm/cpu.h
16
@@ -XXX,XX +XXX,XX @@ unassigned:
21
@@ -XXX,XX +XXX,XX @@ static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu)
17
* @is_write: whether the translation operation is for write
22
return (cpu->clidr & R_V7M_CLIDR_CTYPE_ALL_MASK) != 0;
18
* @is_mmio: whether this can be MMIO, set true if it can
23
}
19
* @target_as: the address space targeted by the IOMMU
24
20
+ * @attrs: memory transaction attributes
25
-/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */
21
*
26
-static inline bool aa64_generate_debug_exceptions(CPUARMState *env)
22
* This function is called from RCU critical section
27
-{
23
*/
28
- int cur_el = arm_current_el(env);
24
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,
29
- int debug_el;
25
hwaddr *page_mask_out,
30
-
26
bool is_write,
31
- if (cur_el == 3) {
27
bool is_mmio,
32
- return false;
28
- AddressSpace **target_as)
33
- }
29
+ AddressSpace **target_as,
34
-
30
+ MemTxAttrs attrs)
35
- /* MDCR_EL3.SDD disables debug events from Secure state */
36
- if (arm_is_secure_below_el3(env)
37
- && extract32(env->cp15.mdcr_el3, 16, 1)) {
38
- return false;
39
- }
40
-
41
- /*
42
- * Same EL to same EL debug exceptions need MDSCR_KDE enabled
43
- * while not masking the (D)ebug bit in DAIF.
44
- */
45
- debug_el = arm_debug_target_el(env);
46
-
47
- if (cur_el == debug_el) {
48
- return extract32(env->cp15.mdscr_el1, 13, 1)
49
- && !(env->daif & PSTATE_D);
50
- }
51
-
52
- /* Otherwise the debug target needs to be a higher EL */
53
- return debug_el > cur_el;
54
-}
55
-
56
-static inline bool aa32_generate_debug_exceptions(CPUARMState *env)
57
-{
58
- int el = arm_current_el(env);
59
-
60
- if (el == 0 && arm_el_is_aa64(env, 1)) {
61
- return aa64_generate_debug_exceptions(env);
62
- }
63
-
64
- if (arm_is_secure(env)) {
65
- int spd;
66
-
67
- if (el == 0 && (env->cp15.sder & 1)) {
68
- /* SDER.SUIDEN means debug exceptions from Secure EL0
69
- * are always enabled. Otherwise they are controlled by
70
- * SDCR.SPD like those from other Secure ELs.
71
- */
72
- return true;
73
- }
74
-
75
- spd = extract32(env->cp15.mdcr_el3, 14, 2);
76
- switch (spd) {
77
- case 1:
78
- /* SPD == 0b01 is reserved, but behaves as 0b00. */
79
- case 0:
80
- /* For 0b00 we return true if external secure invasive debug
81
- * is enabled. On real hardware this is controlled by external
82
- * signals to the core. QEMU always permits debug, and behaves
83
- * as if DBGEN, SPIDEN, NIDEN and SPNIDEN are all tied high.
84
- */
85
- return true;
86
- case 2:
87
- return false;
88
- case 3:
89
- return true;
90
- }
91
- }
92
-
93
- return el != 2;
94
-}
95
-
96
-/* Return true if debugging exceptions are currently enabled.
97
- * This corresponds to what in ARM ARM pseudocode would be
98
- * if UsingAArch32() then
99
- * return AArch32.GenerateDebugExceptions()
100
- * else
101
- * return AArch64.GenerateDebugExceptions()
102
- * We choose to push the if() down into this function for clarity,
103
- * since the pseudocode has it at all callsites except for the one in
104
- * CheckSoftwareStep(), where it is elided because both branches would
105
- * always return the same value.
106
- */
107
-static inline bool arm_generate_debug_exceptions(CPUARMState *env)
108
-{
109
- if (env->aarch64) {
110
- return aa64_generate_debug_exceptions(env);
111
- } else {
112
- return aa32_generate_debug_exceptions(env);
113
- }
114
-}
115
-
116
static inline bool arm_sctlr_b(CPUARMState *env)
31
{
117
{
32
MemoryRegionSection *section;
118
return
33
IOMMUMemoryRegion *iommu_mr;
119
diff --git a/target/arm/internals.h b/target/arm/internals.h
34
@@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
120
index XXXXXXX..XXXXXXX 100644
35
* but page mask.
121
--- a/target/arm/internals.h
36
*/
122
+++ b/target/arm/internals.h
37
section = flatview_do_translate(address_space_to_flatview(as), addr, &xlat,
123
@@ -XXX,XX +XXX,XX @@ bool el_is_in_host(CPUARMState *env, int el);
38
- NULL, &page_mask, is_write, false, &as);
124
void aa32_max_features(ARMCPU *cpu);
39
+ NULL, &page_mask, is_write, false, &as,
125
int exception_target_el(CPUARMState *env);
40
+ attrs);
126
bool arm_singlestep_active(CPUARMState *env);
41
127
+bool arm_generate_debug_exceptions(CPUARMState *env);
42
/* Illegal translation */
128
43
if (section.mr == &io_mem_unassigned) {
129
/* Powers of 2 for sve_vq_map et al. */
44
@@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat,
130
#define SVE_VQ_POW2_MAP \
45
131
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
46
/* This can be MMIO, so setup MMIO bit. */
132
index XXXXXXX..XXXXXXX 100644
47
section = flatview_do_translate(fv, addr, xlat, plen, NULL,
133
--- a/target/arm/debug_helper.c
48
- is_write, true, &as);
134
+++ b/target/arm/debug_helper.c
49
+ is_write, true, &as, attrs);
135
@@ -XXX,XX +XXX,XX @@
50
mr = section.mr;
136
#include "exec/helper-proto.h"
51
137
52
if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
138
139
+/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */
140
+static bool aa64_generate_debug_exceptions(CPUARMState *env)
141
+{
142
+ int cur_el = arm_current_el(env);
143
+ int debug_el;
144
+
145
+ if (cur_el == 3) {
146
+ return false;
147
+ }
148
+
149
+ /* MDCR_EL3.SDD disables debug events from Secure state */
150
+ if (arm_is_secure_below_el3(env)
151
+ && extract32(env->cp15.mdcr_el3, 16, 1)) {
152
+ return false;
153
+ }
154
+
155
+ /*
156
+ * Same EL to same EL debug exceptions need MDSCR_KDE enabled
157
+ * while not masking the (D)ebug bit in DAIF.
158
+ */
159
+ debug_el = arm_debug_target_el(env);
160
+
161
+ if (cur_el == debug_el) {
162
+ return extract32(env->cp15.mdscr_el1, 13, 1)
163
+ && !(env->daif & PSTATE_D);
164
+ }
165
+
166
+ /* Otherwise the debug target needs to be a higher EL */
167
+ return debug_el > cur_el;
168
+}
169
+
170
+static bool aa32_generate_debug_exceptions(CPUARMState *env)
171
+{
172
+ int el = arm_current_el(env);
173
+
174
+ if (el == 0 && arm_el_is_aa64(env, 1)) {
175
+ return aa64_generate_debug_exceptions(env);
176
+ }
177
+
178
+ if (arm_is_secure(env)) {
179
+ int spd;
180
+
181
+ if (el == 0 && (env->cp15.sder & 1)) {
182
+ /*
183
+ * SDER.SUIDEN means debug exceptions from Secure EL0
184
+ * are always enabled. Otherwise they are controlled by
185
+ * SDCR.SPD like those from other Secure ELs.
186
+ */
187
+ return true;
188
+ }
189
+
190
+ spd = extract32(env->cp15.mdcr_el3, 14, 2);
191
+ switch (spd) {
192
+ case 1:
193
+ /* SPD == 0b01 is reserved, but behaves as 0b00. */
194
+ case 0:
195
+ /*
196
+ * For 0b00 we return true if external secure invasive debug
197
+ * is enabled. On real hardware this is controlled by external
198
+ * signals to the core. QEMU always permits debug, and behaves
199
+ * as if DBGEN, SPIDEN, NIDEN and SPNIDEN are all tied high.
200
+ */
201
+ return true;
202
+ case 2:
203
+ return false;
204
+ case 3:
205
+ return true;
206
+ }
207
+ }
208
+
209
+ return el != 2;
210
+}
211
+
212
+/*
213
+ * Return true if debugging exceptions are currently enabled.
214
+ * This corresponds to what in ARM ARM pseudocode would be
215
+ * if UsingAArch32() then
216
+ * return AArch32.GenerateDebugExceptions()
217
+ * else
218
+ * return AArch64.GenerateDebugExceptions()
219
+ * We choose to push the if() down into this function for clarity,
220
+ * since the pseudocode has it at all callsites except for the one in
221
+ * CheckSoftwareStep(), where it is elided because both branches would
222
+ * always return the same value.
223
+ */
224
+bool arm_generate_debug_exceptions(CPUARMState *env)
225
+{
226
+ if (env->aarch64) {
227
+ return aa64_generate_debug_exceptions(env);
228
+ } else {
229
+ return aa32_generate_debug_exceptions(env);
230
+ }
231
+}
232
+
233
/*
234
* Is single-stepping active? (Note that the "is EL_D AArch64?" check
235
* implicitly means this always returns false in pre-v8 CPUs.)
53
--
236
--
54
2.17.1
237
2.25.1
55
56
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to address_space_get_iotlb_entry().
3
2
3
Use the accessor rather than the raw structure member.
4
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220609202901.1177572-7-richard.henderson@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180521140402.23318-12-peter.maydell@linaro.org
8
---
9
---
9
include/exec/memory.h | 2 +-
10
target/arm/debug_helper.c | 2 +-
10
exec.c | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
11
hw/virtio/vhost.c | 3 ++-
12
3 files changed, 4 insertions(+), 3 deletions(-)
13
12
14
diff --git a/include/exec/memory.h b/include/exec/memory.h
13
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/include/exec/memory.h
15
--- a/target/arm/debug_helper.c
17
+++ b/include/exec/memory.h
16
+++ b/target/arm/debug_helper.c
18
@@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache);
17
@@ -XXX,XX +XXX,XX @@ static bool aa32_generate_debug_exceptions(CPUARMState *env)
19
* entry. Should be called from an RCU critical section.
20
*/
18
*/
21
IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
19
bool arm_generate_debug_exceptions(CPUARMState *env)
22
- bool is_write);
23
+ bool is_write, MemTxAttrs attrs);
24
25
/* address_space_translate: translate an address range into an address space
26
* into a MemoryRegion and an address range into that section. Should be
27
diff --git a/exec.c b/exec.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/exec.c
30
+++ b/exec.c
31
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,
32
33
/* Called from RCU critical section */
34
IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
35
- bool is_write)
36
+ bool is_write, MemTxAttrs attrs)
37
{
20
{
38
MemoryRegionSection section;
21
- if (env->aarch64) {
39
hwaddr xlat, page_mask;
22
+ if (is_a64(env)) {
40
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
23
return aa64_generate_debug_exceptions(env);
41
index XXXXXXX..XXXXXXX 100644
24
} else {
42
--- a/hw/virtio/vhost.c
25
return aa32_generate_debug_exceptions(env);
43
+++ b/hw/virtio/vhost.c
44
@@ -XXX,XX +XXX,XX @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write)
45
trace_vhost_iotlb_miss(dev, 1);
46
47
iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
48
- iova, write);
49
+ iova, write,
50
+ MEMTXATTRS_UNSPECIFIED);
51
if (iotlb.target_as != NULL) {
52
ret = vhost_memory_region_lookup(dev, iotlb.translated_addr,
53
&uaddr, &len);
54
--
26
--
55
2.17.1
27
2.25.1
56
57
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to tb_invalidate_phys_addr().
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220609202901.1177572-8-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20180521140402.23318-3-peter.maydell@linaro.org
10
---
7
---
11
include/exec/exec-all.h | 5 +++--
8
target/arm/debug_helper.c | 31 +++++++++++++++++++++++++++++++
12
accel/tcg/translate-all.c | 2 +-
9
target/arm/op_helper.c | 29 -----------------------------
13
exec.c | 2 +-
10
2 files changed, 31 insertions(+), 29 deletions(-)
14
target/xtensa/op_helper.c | 3 ++-
15
4 files changed, 7 insertions(+), 5 deletions(-)
16
11
17
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
12
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
18
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
19
--- a/include/exec/exec-all.h
14
--- a/target/arm/debug_helper.c
20
+++ b/include/exec/exec-all.h
15
+++ b/target/arm/debug_helper.c
21
@@ -XXX,XX +XXX,XX @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
16
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
22
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
23
hwaddr paddr, int prot,
24
int mmu_idx, target_ulong size);
25
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr);
26
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
27
void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx,
28
uintptr_t retaddr);
29
#else
30
@@ -XXX,XX +XXX,XX @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu,
31
uint16_t idxmap)
32
{
33
}
34
-static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
35
+static inline void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr,
36
+ MemTxAttrs attrs)
37
{
38
}
39
#endif
40
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/accel/tcg/translate-all.c
43
+++ b/accel/tcg/translate-all.c
44
@@ -XXX,XX +XXX,XX @@ static TranslationBlock *tb_find_pc(uintptr_t tc_ptr)
45
}
46
47
#if !defined(CONFIG_USER_ONLY)
48
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
49
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
50
{
51
ram_addr_t ram_addr;
52
MemoryRegion *mr;
53
diff --git a/exec.c b/exec.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/exec.c
56
+++ b/exec.c
57
@@ -XXX,XX +XXX,XX @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
58
if (phys != -1) {
59
/* Locks grabbed by tb_invalidate_phys_addr */
60
tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as,
61
- phys | (pc & ~TARGET_PAGE_MASK));
62
+ phys | (pc & ~TARGET_PAGE_MASK), attrs);
63
}
17
}
64
}
18
}
65
#endif
19
66
diff --git a/target/xtensa/op_helper.c b/target/xtensa/op_helper.c
20
+/*
21
+ * Raise an EXCP_BKPT with the specified syndrome register value,
22
+ * targeting the correct exception level for debug exceptions.
23
+ */
24
+void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
25
+{
26
+ int debug_el = arm_debug_target_el(env);
27
+ int cur_el = arm_current_el(env);
28
+
29
+ /* FSR will only be used if the debug target EL is AArch32. */
30
+ env->exception.fsr = arm_debug_exception_fsr(env);
31
+ /*
32
+ * FAR is UNKNOWN: clear vaddress to avoid potentially exposing
33
+ * values to the guest that it shouldn't be able to see at its
34
+ * exception/security level.
35
+ */
36
+ env->exception.vaddress = 0;
37
+ /*
38
+ * Other kinds of architectural debug exception are ignored if
39
+ * they target an exception level below the current one (in QEMU
40
+ * this is checked by arm_generate_debug_exceptions()). Breakpoint
41
+ * instructions are special because they always generate an exception
42
+ * to somewhere: if they can't go to the configured debug exception
43
+ * level they are taken to the current exception level.
44
+ */
45
+ if (debug_el < cur_el) {
46
+ debug_el = cur_el;
47
+ }
48
+ raise_exception(env, EXCP_BKPT, syndrome, debug_el);
49
+}
50
+
51
#if !defined(CONFIG_USER_ONLY)
52
53
vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
54
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
67
index XXXXXXX..XXXXXXX 100644
55
index XXXXXXX..XXXXXXX 100644
68
--- a/target/xtensa/op_helper.c
56
--- a/target/arm/op_helper.c
69
+++ b/target/xtensa/op_helper.c
57
+++ b/target/arm/op_helper.c
70
@@ -XXX,XX +XXX,XX @@ static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr)
58
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
71
int ret = xtensa_get_physical_addr(env, false, vaddr, 2, 0,
59
raise_exception(env, excp, syndrome, target_el);
72
&paddr, &page_size, &access);
73
if (ret == 0) {
74
- tb_invalidate_phys_addr(&address_space_memory, paddr);
75
+ tb_invalidate_phys_addr(&address_space_memory, paddr,
76
+ MEMTXATTRS_UNSPECIFIED);
77
}
78
}
60
}
79
61
62
-/* Raise an EXCP_BKPT with the specified syndrome register value,
63
- * targeting the correct exception level for debug exceptions.
64
- */
65
-void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
66
-{
67
- int debug_el = arm_debug_target_el(env);
68
- int cur_el = arm_current_el(env);
69
-
70
- /* FSR will only be used if the debug target EL is AArch32. */
71
- env->exception.fsr = arm_debug_exception_fsr(env);
72
- /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
73
- * values to the guest that it shouldn't be able to see at its
74
- * exception/security level.
75
- */
76
- env->exception.vaddress = 0;
77
- /*
78
- * Other kinds of architectural debug exception are ignored if
79
- * they target an exception level below the current one (in QEMU
80
- * this is checked by arm_generate_debug_exceptions()). Breakpoint
81
- * instructions are special because they always generate an exception
82
- * to somewhere: if they can't go to the configured debug exception
83
- * level they are taken to the current exception level.
84
- */
85
- if (debug_el < cur_el) {
86
- debug_el = cur_el;
87
- }
88
- raise_exception(env, EXCP_BKPT, syndrome, debug_el);
89
-}
90
-
91
uint32_t HELPER(cpsr_read)(CPUARMState *env)
92
{
93
return cpsr_read(env) & ~CPSR_EXEC;
80
--
94
--
81
2.17.1
95
2.25.1
82
83
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to flatview_access_valid().
3
Its callers now all have an attrs value to hand, so we can
4
correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED.
5
2
3
This function now now only used in debug_helper.c, so there is
4
no reason to have a declaration in a header.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-9-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-10-peter.maydell@linaro.org
10
---
10
---
11
exec.c | 12 +++++-------
11
target/arm/internals.h | 25 -------------------------
12
1 file changed, 5 insertions(+), 7 deletions(-)
12
target/arm/debug_helper.c | 26 ++++++++++++++++++++++++++
13
2 files changed, 26 insertions(+), 25 deletions(-)
13
14
14
diff --git a/exec.c b/exec.c
15
diff --git a/target/arm/internals.h b/target/arm/internals.h
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/exec.c
17
--- a/target/arm/internals.h
17
+++ b/exec.c
18
+++ b/target/arm/internals.h
18
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
19
@@ -XXX,XX +XXX,XX @@ static inline TCR *regime_tcr(CPUARMState *env, ARMMMUIdx mmu_idx)
19
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
20
return &env->cp15.tcr_el[regime_el(env, mmu_idx)];
20
const uint8_t *buf, int len);
21
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
22
- bool is_write);
23
+ bool is_write, MemTxAttrs attrs);
24
25
static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,
26
unsigned len, MemTxAttrs attrs)
27
@@ -XXX,XX +XXX,XX @@ static bool subpage_accepts(void *opaque, hwaddr addr,
28
#endif
29
30
return flatview_access_valid(subpage->fv, addr + subpage->base,
31
- len, is_write);
32
+ len, is_write, attrs);
33
}
21
}
34
22
35
static const MemoryRegionOps subpage_ops = {
23
-/* Return the FSR value for a debug exception (watchpoint, hardware
36
@@ -XXX,XX +XXX,XX @@ static void cpu_notify_map_clients(void)
24
- * breakpoint or BKPT insn) targeting the specified exception level.
25
- */
26
-static inline uint32_t arm_debug_exception_fsr(CPUARMState *env)
27
-{
28
- ARMMMUFaultInfo fi = { .type = ARMFault_Debug };
29
- int target_el = arm_debug_target_el(env);
30
- bool using_lpae = false;
31
-
32
- if (target_el == 2 || arm_el_is_aa64(env, target_el)) {
33
- using_lpae = true;
34
- } else {
35
- if (arm_feature(env, ARM_FEATURE_LPAE) &&
36
- (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) {
37
- using_lpae = true;
38
- }
39
- }
40
-
41
- if (using_lpae) {
42
- return arm_fi_to_lfsc(&fi);
43
- } else {
44
- return arm_fi_to_sfsc(&fi);
45
- }
46
-}
47
-
48
/**
49
* arm_num_brps: Return number of implemented breakpoints.
50
* Note that the ID register BRPS field is "number of bps - 1",
51
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/target/arm/debug_helper.c
54
+++ b/target/arm/debug_helper.c
55
@@ -XXX,XX +XXX,XX @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
56
return check_watchpoints(cpu);
37
}
57
}
38
58
39
static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
59
+/*
40
- bool is_write)
60
+ * Return the FSR value for a debug exception (watchpoint, hardware
41
+ bool is_write, MemTxAttrs attrs)
61
+ * breakpoint or BKPT insn) targeting the specified exception level.
62
+ */
63
+static uint32_t arm_debug_exception_fsr(CPUARMState *env)
64
+{
65
+ ARMMMUFaultInfo fi = { .type = ARMFault_Debug };
66
+ int target_el = arm_debug_target_el(env);
67
+ bool using_lpae = false;
68
+
69
+ if (target_el == 2 || arm_el_is_aa64(env, target_el)) {
70
+ using_lpae = true;
71
+ } else {
72
+ if (arm_feature(env, ARM_FEATURE_LPAE) &&
73
+ (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) {
74
+ using_lpae = true;
75
+ }
76
+ }
77
+
78
+ if (using_lpae) {
79
+ return arm_fi_to_lfsc(&fi);
80
+ } else {
81
+ return arm_fi_to_sfsc(&fi);
82
+ }
83
+}
84
+
85
void arm_debug_excp_handler(CPUState *cs)
42
{
86
{
43
MemoryRegion *mr;
87
/*
44
hwaddr l, xlat;
45
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
46
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
47
if (!memory_access_is_direct(mr, is_write)) {
48
l = memory_access_size(mr, l, addr);
49
- /* When our callers all have attrs we'll pass them through here */
50
- if (!memory_region_access_valid(mr, xlat, l, is_write,
51
- MEMTXATTRS_UNSPECIFIED)) {
52
+ if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {
53
return false;
54
}
55
}
56
@@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
57
58
rcu_read_lock();
59
fv = address_space_to_flatview(as);
60
- result = flatview_access_valid(fv, addr, len, is_write);
61
+ result = flatview_access_valid(fv, addr, len, is_write, attrs);
62
rcu_read_unlock();
63
return result;
64
}
65
--
88
--
66
2.17.1
89
2.25.1
67
68
diff view generated by jsdifflib
1
Provide a VMSTATE_BOOL_SUB_ARRAY to go with VMSTATE_UINT8_SUB_ARRAY
1
From: Richard Henderson <richard.henderson@linaro.org>
2
and friends.
3
2
3
Rename to helper_exception_with_syndrome_el, to emphasize
4
that the target el is a parameter.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-10-richard.henderson@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Message-id: 20180521140402.23318-23-peter.maydell@linaro.org
7
---
10
---
8
include/migration/vmstate.h | 3 +++
11
target/arm/helper.h | 2 +-
9
1 file changed, 3 insertions(+)
12
target/arm/translate.h | 6 +++---
13
target/arm/op_helper.c | 6 +++---
14
target/arm/translate.c | 6 +++---
15
4 files changed, 10 insertions(+), 10 deletions(-)
10
16
11
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
17
diff --git a/target/arm/helper.h b/target/arm/helper.h
12
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
13
--- a/include/migration/vmstate.h
19
--- a/target/arm/helper.h
14
+++ b/include/migration/vmstate.h
20
+++ b/target/arm/helper.h
15
@@ -XXX,XX +XXX,XX @@ extern const VMStateInfo vmstate_info_qtailq;
21
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i32)
16
#define VMSTATE_BOOL_ARRAY(_f, _s, _n) \
22
DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
17
VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0)
23
i32, i32, i32, i32)
18
24
DEF_HELPER_2(exception_internal, noreturn, env, i32)
19
+#define VMSTATE_BOOL_SUB_ARRAY(_f, _s, _start, _num) \
25
-DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32)
20
+ VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_bool, bool)
26
+DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32)
21
+
27
DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32)
22
#define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \
28
DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl)
23
VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t)
29
DEF_HELPER_1(setend, void, env)
30
diff --git a/target/arm/translate.h b/target/arm/translate.h
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/translate.h
33
+++ b/target/arm/translate.h
34
@@ -XXX,XX +XXX,XX @@ static inline void gen_ss_advance(DisasContext *s)
35
static inline void gen_exception(int excp, uint32_t syndrome,
36
uint32_t target_el)
37
{
38
- gen_helper_exception_with_syndrome(cpu_env, tcg_constant_i32(excp),
39
- tcg_constant_i32(syndrome),
40
- tcg_constant_i32(target_el));
41
+ gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
42
+ tcg_constant_i32(syndrome),
43
+ tcg_constant_i32(target_el));
44
}
45
46
/* Generate an architectural singlestep exception */
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 HELPER(yield)(CPUARMState *env)
52
* those EXCP values which are special cases for QEMU to interrupt
53
* execution and not to be used for exceptions which are passed to
54
* the guest (those must all have syndrome information and thus should
55
- * use exception_with_syndrome).
56
+ * use exception_with_syndrome*).
57
*/
58
void HELPER(exception_internal)(CPUARMState *env, uint32_t excp)
59
{
60
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_internal)(CPUARMState *env, uint32_t excp)
61
}
62
63
/* Raise an exception with the specified syndrome register value */
64
-void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
65
- uint32_t syndrome, uint32_t target_el)
66
+void HELPER(exception_with_syndrome_el)(CPUARMState *env, uint32_t excp,
67
+ uint32_t syndrome, uint32_t target_el)
68
{
69
raise_exception(env, excp, syndrome, target_el);
70
}
71
diff --git a/target/arm/translate.c b/target/arm/translate.c
72
index XXXXXXX..XXXXXXX 100644
73
--- a/target/arm/translate.c
74
+++ b/target/arm/translate.c
75
@@ -XXX,XX +XXX,XX @@ static void gen_exception_el(DisasContext *s, int excp, uint32_t syn,
76
{
77
gen_set_condexec(s);
78
gen_set_pc_im(s, s->pc_curr);
79
- gen_helper_exception_with_syndrome(cpu_env,
80
- tcg_constant_i32(excp),
81
- tcg_constant_i32(syn), tcg_el);
82
+ gen_helper_exception_with_syndrome_el(cpu_env,
83
+ tcg_constant_i32(excp),
84
+ tcg_constant_i32(syn), tcg_el);
85
s->base.is_jmp = DISAS_NORETURN;
86
}
24
87
25
--
88
--
26
2.17.1
89
2.25.1
27
28
diff view generated by jsdifflib
1
From: Shannon Zhao <zhaoshenglong@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
kvm_irqchip_create called by kvm_init will call kvm_init_irq_routing to
3
Create a function below gen_exception_insn that takes
4
initialize global capability variables. If we call kvm_init_irq_routing in
4
the target_el as a TCGv_i32, replacing gen_exception_el.
5
GIC realize function, previous allocated memory will leak.
6
5
7
Fix this by deleting the unnecessary call.
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
8
Message-id: 20220609202901.1177572-11-richard.henderson@linaro.org
10
Reviewed-by: Eric Auger <eric.auger@redhat.com>
11
Message-id: 1527750994-14360-1-git-send-email-zhaoshenglong@huawei.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
hw/intc/arm_gic_kvm.c | 1 -
11
target/arm/translate.c | 27 ++++++++++++---------------
15
hw/intc/arm_gicv3_kvm.c | 1 -
12
1 file changed, 12 insertions(+), 15 deletions(-)
16
2 files changed, 2 deletions(-)
17
13
18
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
19
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/intc/arm_gic_kvm.c
16
--- a/target/arm/translate.c
21
+++ b/hw/intc/arm_gic_kvm.c
17
+++ b/target/arm/translate.c
22
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
18
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp)
23
19
s->base.is_jmp = DISAS_NORETURN;
24
if (kvm_has_gsi_routing()) {
20
}
25
/* set up irq routing */
21
26
- kvm_init_irq_routing(kvm_state);
22
-void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
27
for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
23
- uint32_t syn, uint32_t target_el)
28
kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
24
+static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp,
29
}
25
+ uint32_t syn, TCGv_i32 tcg_el)
30
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
26
{
31
index XXXXXXX..XXXXXXX 100644
27
if (s->aarch64) {
32
--- a/hw/intc/arm_gicv3_kvm.c
28
gen_a64_set_pc_im(pc);
33
+++ b/hw/intc/arm_gicv3_kvm.c
29
@@ -XXX,XX +XXX,XX @@ void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
34
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
30
gen_set_condexec(s);
35
31
gen_set_pc_im(s, pc);
36
if (kvm_has_gsi_routing()) {
32
}
37
/* set up irq routing */
33
- gen_exception(excp, syn, target_el);
38
- kvm_init_irq_routing(kvm_state);
34
+ gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
39
for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) {
35
+ tcg_constant_i32(syn), tcg_el);
40
kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
36
s->base.is_jmp = DISAS_NORETURN;
37
}
38
39
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
40
+ uint32_t syn, uint32_t target_el)
41
+{
42
+ gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el));
43
+}
44
+
45
static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
46
{
47
gen_set_condexec(s);
48
@@ -XXX,XX +XXX,XX @@ void unallocated_encoding(DisasContext *s)
49
default_exception_el(s));
50
}
51
52
-static void gen_exception_el(DisasContext *s, int excp, uint32_t syn,
53
- TCGv_i32 tcg_el)
54
-{
55
- gen_set_condexec(s);
56
- gen_set_pc_im(s, s->pc_curr);
57
- gen_helper_exception_with_syndrome_el(cpu_env,
58
- tcg_constant_i32(excp),
59
- tcg_constant_i32(syn), tcg_el);
60
- s->base.is_jmp = DISAS_NORETURN;
61
-}
62
-
63
/* Force a TB lookup after an instruction that changes the CPU state. */
64
void gen_lookup_tb(DisasContext *s)
65
{
66
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
67
tcg_el = tcg_constant_i32(3);
68
}
69
70
- gen_exception_el(s, EXCP_UDEF, syn_uncategorized(), tcg_el);
71
+ gen_exception_insn_el_v(s, s->pc_curr, EXCP_UDEF,
72
+ syn_uncategorized(), tcg_el);
73
tcg_temp_free_i32(tcg_el);
74
return false;
41
}
75
}
42
--
76
--
43
2.17.1
77
2.25.1
44
45
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to flatview_extend_translation().
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
2
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20220609202901.1177572-12-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-7-peter.maydell@linaro.org
10
---
7
---
11
exec.c | 15 ++++++++++-----
8
target/arm/translate.h | 4 ++--
12
1 file changed, 10 insertions(+), 5 deletions(-)
9
target/arm/translate-a64.c | 36 ++++++++++++++++----------------
10
target/arm/translate-m-nocp.c | 16 +++++++-------
11
target/arm/translate-mve.c | 4 ++--
12
target/arm/translate-vfp.c | 6 +++---
13
target/arm/translate.c | 39 ++++++++++++++++++-----------------
14
6 files changed, 53 insertions(+), 52 deletions(-)
13
15
14
diff --git a/exec.c b/exec.c
16
diff --git a/target/arm/translate.h b/target/arm/translate.h
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/exec.c
18
--- a/target/arm/translate.h
17
+++ b/exec.c
19
+++ b/target/arm/translate.h
18
@@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
20
@@ -XXX,XX +XXX,XX @@ void arm_jump_cc(DisasCompare *cmp, TCGLabel *label);
19
21
void arm_gen_test_cc(int cc, TCGLabel *label);
20
static hwaddr
22
MemOp pow2_align(unsigned i);
21
flatview_extend_translation(FlatView *fv, hwaddr addr,
23
void unallocated_encoding(DisasContext *s);
22
- hwaddr target_len,
24
-void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
23
- MemoryRegion *mr, hwaddr base, hwaddr len,
25
- uint32_t syn, uint32_t target_el);
24
- bool is_write)
26
+void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
25
+ hwaddr target_len,
27
+ uint32_t syn, uint32_t target_el);
26
+ MemoryRegion *mr, hwaddr base, hwaddr len,
28
27
+ bool is_write, MemTxAttrs attrs)
29
/* Return state of Alternate Half-precision flag, caller frees result */
30
static inline TCGv_i32 get_ahp_flag(void)
31
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/translate-a64.c
34
+++ b/target/arm/translate-a64.c
35
@@ -XXX,XX +XXX,XX @@ static bool fp_access_check(DisasContext *s)
36
assert(!s->fp_access_checked);
37
s->fp_access_checked = true;
38
39
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
40
- syn_fp_access_trap(1, 0xe, false, 0),
41
- s->fp_excp_el);
42
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
43
+ syn_fp_access_trap(1, 0xe, false, 0),
44
+ s->fp_excp_el);
45
return false;
46
}
47
s->fp_access_checked = true;
48
@@ -XXX,XX +XXX,XX @@ bool sve_access_check(DisasContext *s)
49
assert(!s->sve_access_checked);
50
s->sve_access_checked = true;
51
52
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
53
- syn_sve_access_trap(), s->sve_excp_el);
54
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
55
+ syn_sve_access_trap(), s->sve_excp_el);
56
return false;
57
}
58
s->sve_access_checked = true;
59
@@ -XXX,XX +XXX,XX @@ static void gen_sysreg_undef(DisasContext *s, bool isread,
60
} else {
61
syndrome = syn_uncategorized();
62
}
63
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syndrome,
64
- default_exception_el(s));
65
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syndrome,
66
+ default_exception_el(s));
67
}
68
69
/* MRS - move from system register
70
@@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn)
71
switch (op2_ll) {
72
case 1: /* SVC */
73
gen_ss_advance(s);
74
- gen_exception_insn(s, s->base.pc_next, EXCP_SWI,
75
- syn_aa64_svc(imm16), default_exception_el(s));
76
+ gen_exception_insn_el(s, s->base.pc_next, EXCP_SWI,
77
+ syn_aa64_svc(imm16), default_exception_el(s));
78
break;
79
case 2: /* HVC */
80
if (s->current_el == 0) {
81
@@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn)
82
gen_a64_set_pc_im(s->pc_curr);
83
gen_helper_pre_hvc(cpu_env);
84
gen_ss_advance(s);
85
- gen_exception_insn(s, s->base.pc_next, EXCP_HVC,
86
- syn_aa64_hvc(imm16), 2);
87
+ gen_exception_insn_el(s, s->base.pc_next, EXCP_HVC,
88
+ syn_aa64_hvc(imm16), 2);
89
break;
90
case 3: /* SMC */
91
if (s->current_el == 0) {
92
@@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn)
93
gen_a64_set_pc_im(s->pc_curr);
94
gen_helper_pre_smc(cpu_env, tcg_constant_i32(syn_aa64_smc(imm16)));
95
gen_ss_advance(s);
96
- gen_exception_insn(s, s->base.pc_next, EXCP_SMC,
97
- syn_aa64_smc(imm16), 3);
98
+ gen_exception_insn_el(s, s->base.pc_next, EXCP_SMC,
99
+ syn_aa64_smc(imm16), 3);
100
break;
101
default:
102
unallocated_encoding(s);
103
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
104
* Illegal execution state. This has priority over BTI
105
* exceptions, but comes after instruction abort exceptions.
106
*/
107
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
108
- syn_illegalstate(), default_exception_el(s));
109
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
110
+ syn_illegalstate(), default_exception_el(s));
111
return;
112
}
113
114
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
115
if (s->btype != 0
116
&& s->guarded_page
117
&& !btype_destination_ok(insn, s->bt, s->btype)) {
118
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
119
- syn_btitrap(s->btype),
120
- default_exception_el(s));
121
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
122
+ syn_btitrap(s->btype),
123
+ default_exception_el(s));
124
return;
125
}
126
} else {
127
diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c
128
index XXXXXXX..XXXXXXX 100644
129
--- a/target/arm/translate-m-nocp.c
130
+++ b/target/arm/translate-m-nocp.c
131
@@ -XXX,XX +XXX,XX @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a)
132
tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel);
133
134
if (s->fp_excp_el != 0) {
135
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
136
- syn_uncategorized(), s->fp_excp_el);
137
+ gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
138
+ syn_uncategorized(), s->fp_excp_el);
139
return true;
140
}
141
142
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
143
if (!vfp_access_check_m(s, true)) {
144
/*
145
* This was only a conditional exception, so override
146
- * gen_exception_insn()'s default to DISAS_NORETURN
147
+ * gen_exception_insn_el()'s default to DISAS_NORETURN
148
*/
149
s->base.is_jmp = DISAS_NEXT;
150
break;
151
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno,
152
if (!vfp_access_check_m(s, true)) {
153
/*
154
* This was only a conditional exception, so override
155
- * gen_exception_insn()'s default to DISAS_NORETURN
156
+ * gen_exception_insn_el()'s default to DISAS_NORETURN
157
*/
158
s->base.is_jmp = DISAS_NEXT;
159
break;
160
@@ -XXX,XX +XXX,XX @@ static bool trans_NOCP(DisasContext *s, arg_nocp *a)
161
}
162
163
if (a->cp != 10) {
164
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
165
- syn_uncategorized(), default_exception_el(s));
166
+ gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
167
+ syn_uncategorized(), default_exception_el(s));
168
return true;
169
}
170
171
if (s->fp_excp_el != 0) {
172
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
173
- syn_uncategorized(), s->fp_excp_el);
174
+ gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
175
+ syn_uncategorized(), s->fp_excp_el);
176
return true;
177
}
178
179
diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c
180
index XXXXXXX..XXXXXXX 100644
181
--- a/target/arm/translate-mve.c
182
+++ b/target/arm/translate-mve.c
183
@@ -XXX,XX +XXX,XX @@ bool mve_eci_check(DisasContext *s)
184
return true;
185
default:
186
/* Reserved value: INVSTATE UsageFault */
187
- gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
188
- default_exception_el(s));
189
+ gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
190
+ default_exception_el(s));
191
return false;
192
}
193
}
194
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c
195
index XXXXXXX..XXXXXXX 100644
196
--- a/target/arm/translate-vfp.c
197
+++ b/target/arm/translate-vfp.c
198
@@ -XXX,XX +XXX,XX @@ static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled)
199
int coproc = arm_dc_feature(s, ARM_FEATURE_V8) ? 0 : 0xa;
200
uint32_t syn = syn_fp_access_trap(1, 0xe, false, coproc);
201
202
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el);
203
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el);
204
return false;
205
}
206
207
@@ -XXX,XX +XXX,XX @@ bool vfp_access_check_m(DisasContext *s, bool skip_context_update)
208
* the encoding space handled by the patterns in m-nocp.decode,
209
* and for them we may need to raise NOCP here.
210
*/
211
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
212
- syn_uncategorized(), s->fp_excp_el);
213
+ gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
214
+ syn_uncategorized(), s->fp_excp_el);
215
return false;
216
}
217
218
diff --git a/target/arm/translate.c b/target/arm/translate.c
219
index XXXXXXX..XXXXXXX 100644
220
--- a/target/arm/translate.c
221
+++ b/target/arm/translate.c
222
@@ -XXX,XX +XXX,XX @@ static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp,
223
s->base.is_jmp = DISAS_NORETURN;
224
}
225
226
-void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
227
- uint32_t syn, uint32_t target_el)
228
+void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
229
+ uint32_t syn, uint32_t target_el)
28
{
230
{
29
hwaddr done = 0;
231
gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el));
30
hwaddr xlat;
232
}
31
@@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as,
233
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
32
234
void unallocated_encoding(DisasContext *s)
33
memory_region_ref(mr);
235
{
34
*plen = flatview_extend_translation(fv, addr, len, mr, xlat,
236
/* Unallocated and reserved encodings are uncategorized */
35
- l, is_write);
237
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
36
+ l, is_write, attrs);
238
- default_exception_el(s));
37
ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true);
239
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
38
rcu_read_unlock();
240
+ default_exception_el(s));
39
241
}
40
@@ -XXX,XX +XXX,XX @@ int64_t address_space_cache_init(MemoryRegionCache *cache,
242
41
mr = cache->mrs.mr;
243
/* Force a TB lookup after an instruction that changes the CPU state. */
42
memory_region_ref(mr);
244
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
43
if (memory_access_is_direct(mr, is_write)) {
245
44
+ /* We don't care about the memory attributes here as we're only
246
undef:
45
+ * doing this if we found actual RAM, which behaves the same
247
/* If we get here then some access check did not pass */
46
+ * regardless of attributes; so UNSPECIFIED is fine.
248
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
47
+ */
249
- syn_uncategorized(), exc_target);
48
l = flatview_extend_translation(cache->fv, addr, len, mr,
250
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
49
- cache->xlat, l, is_write);
251
+ syn_uncategorized(), exc_target);
50
+ cache->xlat, l, is_write,
252
return false;
51
+ MEMTXATTRS_UNSPECIFIED);
253
}
52
cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true);
254
53
} else {
255
@@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s,
54
cache->ptr = NULL;
256
* For the UNPREDICTABLE cases we choose to UNDEF.
257
*/
258
if (s->current_el == 1 && !s->ns && mode == ARM_CPU_MODE_MON) {
259
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), 3);
260
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
261
+ syn_uncategorized(), 3);
262
return;
263
}
264
265
@@ -XXX,XX +XXX,XX @@ static bool trans_WLS(DisasContext *s, arg_WLS *a)
266
* Do the check-and-raise-exception by hand.
267
*/
268
if (s->fp_excp_el) {
269
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
270
- syn_uncategorized(), s->fp_excp_el);
271
+ gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
272
+ syn_uncategorized(), s->fp_excp_el);
273
return true;
274
}
275
}
276
@@ -XXX,XX +XXX,XX @@ static bool trans_LE(DisasContext *s, arg_LE *a)
277
tmp = load_cpu_field(v7m.ltpsize);
278
tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 4, skipexc);
279
tcg_temp_free_i32(tmp);
280
- gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
281
- default_exception_el(s));
282
+ gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
283
+ default_exception_el(s));
284
gen_set_label(skipexc);
285
}
286
287
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
288
* UsageFault exception.
289
*/
290
if (arm_dc_feature(s, ARM_FEATURE_M)) {
291
- gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
292
- default_exception_el(s));
293
+ gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
294
+ default_exception_el(s));
295
return;
296
}
297
298
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
299
* Illegal execution state. This has priority over BTI
300
* exceptions, but comes after instruction abort exceptions.
301
*/
302
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
303
- syn_illegalstate(), default_exception_el(s));
304
+ gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
305
+ syn_illegalstate(), default_exception_el(s));
306
return;
307
}
308
309
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
310
* Illegal execution state. This has priority over BTI
311
* exceptions, but comes after instruction abort exceptions.
312
*/
313
- gen_exception_insn(dc, dc->pc_curr, EXCP_UDEF,
314
- syn_illegalstate(), default_exception_el(dc));
315
+ gen_exception_insn_el(dc, dc->pc_curr, EXCP_UDEF,
316
+ syn_illegalstate(), default_exception_el(dc));
317
return;
318
}
319
320
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
321
*/
322
tcg_remove_ops_after(dc->insn_eci_rewind);
323
dc->condjmp = 0;
324
- gen_exception_insn(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
325
- default_exception_el(dc));
326
+ gen_exception_insn_el(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
327
+ default_exception_el(dc));
328
}
329
330
arm_post_translate_insn(dc);
55
--
331
--
56
2.17.1
332
2.25.1
57
58
diff view generated by jsdifflib
1
From: Francisco Iglesias <frasse.iglesias@gmail.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Coverity found that the string return by 'object_get_canonical_path' was not
3
Create a new wrapper function that passes the default
4
being freed at two locations in the model (CID 1391294 and CID 1391293) and
4
exception target to gen_exception_insn_el.
5
also that a memset was being called with a value greater than the max of a byte
6
on the second argument (CID 1391286). This patch corrects this by adding the
7
freeing of the strings and also changing to memset to zero instead on
8
descriptor unaligned errors.
9
5
10
Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20180528184859.3530-1-frasse.iglesias@gmail.com
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-13-richard.henderson@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
hw/dma/xlnx-zdma.c | 10 +++++++---
11
target/arm/translate.h | 1 +
18
1 file changed, 7 insertions(+), 3 deletions(-)
12
target/arm/translate-a64.c | 15 ++++++---------
13
target/arm/translate-m-nocp.c | 3 +--
14
target/arm/translate-mve.c | 3 +--
15
target/arm/translate.c | 29 +++++++++++++----------------
16
5 files changed, 22 insertions(+), 29 deletions(-)
19
17
20
diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c
18
diff --git a/target/arm/translate.h b/target/arm/translate.h
21
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/dma/xlnx-zdma.c
20
--- a/target/arm/translate.h
23
+++ b/hw/dma/xlnx-zdma.c
21
+++ b/target/arm/translate.h
24
@@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, void *buf)
22
@@ -XXX,XX +XXX,XX @@ MemOp pow2_align(unsigned i);
25
qemu_log_mask(LOG_GUEST_ERROR,
23
void unallocated_encoding(DisasContext *s);
26
"zdma: unaligned descriptor at %" PRIx64,
24
void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
27
addr);
25
uint32_t syn, uint32_t target_el);
28
- memset(buf, 0xdeadbeef, sizeof(XlnxZDMADescr));
26
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t syn);
29
+ memset(buf, 0x0, sizeof(XlnxZDMADescr));
27
30
s->error = true;
28
/* Return state of Alternate Half-precision flag, caller frees result */
29
static inline TCGv_i32 get_ahp_flag(void)
30
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/translate-a64.c
33
+++ b/target/arm/translate-a64.c
34
@@ -XXX,XX +XXX,XX @@ static void gen_sysreg_undef(DisasContext *s, bool isread,
35
} else {
36
syndrome = syn_uncategorized();
37
}
38
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syndrome,
39
- default_exception_el(s));
40
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syndrome);
41
}
42
43
/* MRS - move from system register
44
@@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn)
45
switch (op2_ll) {
46
case 1: /* SVC */
47
gen_ss_advance(s);
48
- gen_exception_insn_el(s, s->base.pc_next, EXCP_SWI,
49
- syn_aa64_svc(imm16), default_exception_el(s));
50
+ gen_exception_insn(s, s->base.pc_next, EXCP_SWI,
51
+ syn_aa64_svc(imm16));
52
break;
53
case 2: /* HVC */
54
if (s->current_el == 0) {
55
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
56
* Illegal execution state. This has priority over BTI
57
* exceptions, but comes after instruction abort exceptions.
58
*/
59
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
60
- syn_illegalstate(), default_exception_el(s));
61
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_illegalstate());
62
return;
63
}
64
65
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
66
if (s->btype != 0
67
&& s->guarded_page
68
&& !btype_destination_ok(insn, s->bt, s->btype)) {
69
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
70
- syn_btitrap(s->btype),
71
- default_exception_el(s));
72
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
73
+ syn_btitrap(s->btype));
74
return;
75
}
76
} else {
77
diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/target/arm/translate-m-nocp.c
80
+++ b/target/arm/translate-m-nocp.c
81
@@ -XXX,XX +XXX,XX @@ static bool trans_NOCP(DisasContext *s, arg_nocp *a)
82
}
83
84
if (a->cp != 10) {
85
- gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP,
86
- syn_uncategorized(), default_exception_el(s));
87
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized());
88
return true;
89
}
90
91
diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c
92
index XXXXXXX..XXXXXXX 100644
93
--- a/target/arm/translate-mve.c
94
+++ b/target/arm/translate-mve.c
95
@@ -XXX,XX +XXX,XX @@ bool mve_eci_check(DisasContext *s)
96
return true;
97
default:
98
/* Reserved value: INVSTATE UsageFault */
99
- gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
100
- default_exception_el(s));
101
+ gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized());
31
return false;
102
return false;
32
}
103
}
33
@@ -XXX,XX +XXX,XX @@ static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size)
104
}
34
RegisterInfo *r = &s->regs_info[addr / 4];
105
diff --git a/target/arm/translate.c b/target/arm/translate.c
35
106
index XXXXXXX..XXXXXXX 100644
36
if (!r->data) {
107
--- a/target/arm/translate.c
37
+ gchar *path = object_get_canonical_path(OBJECT(s));
108
+++ b/target/arm/translate.c
38
qemu_log("%s: Decode error: read from %" HWADDR_PRIx "\n",
109
@@ -XXX,XX +XXX,XX @@ void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
39
- object_get_canonical_path(OBJECT(s)),
110
gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el));
40
+ path,
111
}
41
addr);
112
42
+ g_free(path);
113
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t syn)
43
ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true);
114
+{
44
zdma_ch_imr_update_irq(s);
115
+ gen_exception_insn_el(s, pc, excp, syn, default_exception_el(s));
45
return 0;
116
+}
46
@@ -XXX,XX +XXX,XX @@ static void zdma_write(void *opaque, hwaddr addr, uint64_t value,
117
+
47
RegisterInfo *r = &s->regs_info[addr / 4];
118
static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
48
119
{
49
if (!r->data) {
120
gen_set_condexec(s);
50
+ gchar *path = object_get_canonical_path(OBJECT(s));
121
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
51
qemu_log("%s: Decode error: write to %" HWADDR_PRIx "=%" PRIx64 "\n",
122
void unallocated_encoding(DisasContext *s)
52
- object_get_canonical_path(OBJECT(s)),
123
{
53
+ path,
124
/* Unallocated and reserved encodings are uncategorized */
54
addr, value);
125
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
55
+ g_free(path);
126
- default_exception_el(s));
56
ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true);
127
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized());
57
zdma_ch_imr_update_irq(s);
128
}
58
return;
129
130
/* Force a TB lookup after an instruction that changes the CPU state. */
131
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
132
* an exception and return false. Otherwise it will return true,
133
* and set *tgtmode and *regno appropriately.
134
*/
135
- int exc_target = default_exception_el(s);
136
-
137
/* These instructions are present only in ARMv8, or in ARMv7 with the
138
* Virtualization Extensions.
139
*/
140
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
141
142
undef:
143
/* If we get here then some access check did not pass */
144
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
145
- syn_uncategorized(), exc_target);
146
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized());
147
return false;
148
}
149
150
@@ -XXX,XX +XXX,XX @@ static bool trans_LE(DisasContext *s, arg_LE *a)
151
tmp = load_cpu_field(v7m.ltpsize);
152
tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 4, skipexc);
153
tcg_temp_free_i32(tmp);
154
- gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
155
- default_exception_el(s));
156
+ gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized());
157
gen_set_label(skipexc);
158
}
159
160
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
161
* UsageFault exception.
162
*/
163
if (arm_dc_feature(s, ARM_FEATURE_M)) {
164
- gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
165
- default_exception_el(s));
166
+ gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized());
167
return;
168
}
169
170
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
171
* Illegal execution state. This has priority over BTI
172
* exceptions, but comes after instruction abort exceptions.
173
*/
174
- gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF,
175
- syn_illegalstate(), default_exception_el(s));
176
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_illegalstate());
177
return;
178
}
179
180
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
181
* Illegal execution state. This has priority over BTI
182
* exceptions, but comes after instruction abort exceptions.
183
*/
184
- gen_exception_insn_el(dc, dc->pc_curr, EXCP_UDEF,
185
- syn_illegalstate(), default_exception_el(dc));
186
+ gen_exception_insn(dc, dc->pc_curr, EXCP_UDEF, syn_illegalstate());
187
return;
188
}
189
190
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
191
*/
192
tcg_remove_ops_after(dc->insn_eci_rewind);
193
dc->condjmp = 0;
194
- gen_exception_insn_el(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncategorized(),
195
- default_exception_el(dc));
196
+ gen_exception_insn(dc, dc->pc_curr, EXCP_INVSTATE,
197
+ syn_uncategorized());
198
}
199
200
arm_post_translate_insn(dc);
59
--
201
--
60
2.17.1
202
2.25.1
61
62
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to address_space_access_valid().
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
2
3
Move the computation from gen_swstep_exception into a helper.
4
5
This fixes a bug when:
6
- MDSCR_EL1.KDE == 1 to enable debug exceptions within EL_D itself
7
- we singlestep an ERET from EL_D to some lower EL
8
9
Previously we were computing 'same el' based on the EL which
10
executed the ERET instruction, whereas it ought to be computed
11
based on the EL to which ERET returned. This happens naturally
12
with the new helper, which runs after EL has been changed.
13
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20220609202901.1177572-14-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-6-peter.maydell@linaro.org
10
---
18
---
11
include/exec/memory.h | 4 +++-
19
target/arm/helper.h | 1 +
12
include/sysemu/dma.h | 3 ++-
20
target/arm/translate.h | 12 +++---------
13
exec.c | 3 ++-
21
target/arm/debug_helper.c | 16 ++++++++++++++++
14
target/s390x/diag.c | 6 ++++--
22
3 files changed, 20 insertions(+), 9 deletions(-)
15
target/s390x/excp_helper.c | 3 ++-
16
target/s390x/mmu_helper.c | 3 ++-
17
target/s390x/sigp.c | 3 ++-
18
7 files changed, 17 insertions(+), 8 deletions(-)
19
23
20
diff --git a/include/exec/memory.h b/include/exec/memory.h
24
diff --git a/target/arm/helper.h b/target/arm/helper.h
21
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
22
--- a/include/exec/memory.h
26
--- a/target/arm/helper.h
23
+++ b/include/exec/memory.h
27
+++ b/target/arm/helper.h
24
@@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as,
28
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
25
* @addr: address within that address space
29
DEF_HELPER_2(exception_internal, noreturn, env, i32)
26
* @len: length of the area to be checked
30
DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32)
27
* @is_write: indicates the transfer direction
31
DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32)
28
+ * @attrs: memory attributes
32
+DEF_HELPER_2(exception_swstep, noreturn, env, i32)
29
*/
33
DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl)
30
-bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write);
34
DEF_HELPER_1(setend, void, env)
31
+bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len,
35
DEF_HELPER_2(wfi, void, env, i32)
32
+ bool is_write, MemTxAttrs attrs);
36
diff --git a/target/arm/translate.h b/target/arm/translate.h
33
34
/* address_space_map: map a physical memory region into a host virtual address
35
*
36
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
37
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
38
--- a/include/sysemu/dma.h
38
--- a/target/arm/translate.h
39
+++ b/include/sysemu/dma.h
39
+++ b/target/arm/translate.h
40
@@ -XXX,XX +XXX,XX @@ static inline bool dma_memory_valid(AddressSpace *as,
40
@@ -XXX,XX +XXX,XX @@ static inline void gen_exception(int excp, uint32_t syndrome,
41
DMADirection dir)
41
/* Generate an architectural singlestep exception */
42
static inline void gen_swstep_exception(DisasContext *s, int isv, int ex)
42
{
43
{
43
return address_space_access_valid(as, addr, len,
44
- bool same_el = (s->debug_target_el == s->current_el);
44
- dir == DMA_DIRECTION_FROM_DEVICE);
45
-
45
+ dir == DMA_DIRECTION_FROM_DEVICE,
46
- /*
46
+ MEMTXATTRS_UNSPECIFIED);
47
- * If singlestep is targeting a lower EL than the current one,
48
- * then s->ss_active must be false and we can never get here.
49
- */
50
- assert(s->debug_target_el >= s->current_el);
51
-
52
- gen_exception(EXCP_UDEF, syn_swstep(same_el, isv, ex), s->debug_target_el);
53
+ /* Fill in the same_el field of the syndrome in the helper. */
54
+ uint32_t syn = syn_swstep(false, isv, ex);
55
+ gen_helper_exception_swstep(cpu_env, tcg_constant_i32(syn));
47
}
56
}
48
57
49
static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr,
58
/*
50
diff --git a/exec.c b/exec.c
59
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
51
index XXXXXXX..XXXXXXX 100644
60
index XXXXXXX..XXXXXXX 100644
52
--- a/exec.c
61
--- a/target/arm/debug_helper.c
53
+++ b/exec.c
62
+++ b/target/arm/debug_helper.c
54
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
63
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
64
raise_exception(env, EXCP_BKPT, syndrome, debug_el);
55
}
65
}
56
66
57
bool address_space_access_valid(AddressSpace *as, hwaddr addr,
67
+void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome)
58
- int len, bool is_write)
68
+{
59
+ int len, bool is_write,
69
+ int debug_el = arm_debug_target_el(env);
60
+ MemTxAttrs attrs)
70
+ int cur_el = arm_current_el(env);
61
{
71
+
62
FlatView *fv;
72
+ /*
63
bool result;
73
+ * If singlestep is targeting a lower EL than the current one, then
64
diff --git a/target/s390x/diag.c b/target/s390x/diag.c
74
+ * DisasContext.ss_active must be false and we can never get here.
65
index XXXXXXX..XXXXXXX 100644
75
+ */
66
--- a/target/s390x/diag.c
76
+ assert(debug_el >= cur_el);
67
+++ b/target/s390x/diag.c
77
+ if (debug_el == cur_el) {
68
@@ -XXX,XX +XXX,XX @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
78
+ syndrome |= 1 << ARM_EL_EC_SHIFT;
69
return;
79
+ }
70
}
80
+ raise_exception(env, EXCP_UDEF, syndrome, debug_el);
71
if (!address_space_access_valid(&address_space_memory, addr,
81
+}
72
- sizeof(IplParameterBlock), false)) {
82
+
73
+ sizeof(IplParameterBlock), false,
83
#if !defined(CONFIG_USER_ONLY)
74
+ MEMTXATTRS_UNSPECIFIED)) {
84
75
s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra);
85
vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
76
return;
77
}
78
@@ -XXX,XX +XXX,XX @@ out:
79
return;
80
}
81
if (!address_space_access_valid(&address_space_memory, addr,
82
- sizeof(IplParameterBlock), true)) {
83
+ sizeof(IplParameterBlock), true,
84
+ MEMTXATTRS_UNSPECIFIED)) {
85
s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra);
86
return;
87
}
88
diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/target/s390x/excp_helper.c
91
+++ b/target/s390x/excp_helper.c
92
@@ -XXX,XX +XXX,XX @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int size,
93
94
/* check out of RAM access */
95
if (!address_space_access_valid(&address_space_memory, raddr,
96
- TARGET_PAGE_SIZE, rw)) {
97
+ TARGET_PAGE_SIZE, rw,
98
+ MEMTXATTRS_UNSPECIFIED)) {
99
DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__,
100
(uint64_t)raddr, (uint64_t)ram_size);
101
trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO);
102
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
103
index XXXXXXX..XXXXXXX 100644
104
--- a/target/s390x/mmu_helper.c
105
+++ b/target/s390x/mmu_helper.c
106
@@ -XXX,XX +XXX,XX @@ static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages,
107
return ret;
108
}
109
if (!address_space_access_valid(&address_space_memory, pages[i],
110
- TARGET_PAGE_SIZE, is_write)) {
111
+ TARGET_PAGE_SIZE, is_write,
112
+ MEMTXATTRS_UNSPECIFIED)) {
113
trigger_access_exception(env, PGM_ADDRESSING, ILEN_AUTO, 0);
114
return -EFAULT;
115
}
116
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
117
index XXXXXXX..XXXXXXX 100644
118
--- a/target/s390x/sigp.c
119
+++ b/target/s390x/sigp.c
120
@@ -XXX,XX +XXX,XX @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg)
121
cpu_synchronize_state(cs);
122
123
if (!address_space_access_valid(&address_space_memory, addr,
124
- sizeof(struct LowCore), false)) {
125
+ sizeof(struct LowCore), false,
126
+ MEMTXATTRS_UNSPECIFIED)) {
127
set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);
128
return;
129
}
130
--
86
--
131
2.17.1
87
2.25.1
132
133
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to address_space_translate()
3
and address_space_translate_cached(). Callers either have an
4
attrs value to hand, or don't care and can use MEMTXATTRS_UNSPECIFIED.
5
2
3
We no longer need this value during translation,
4
as it is now handled within the helpers.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-15-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-4-peter.maydell@linaro.org
10
---
10
---
11
include/exec/memory.h | 4 +++-
11
target/arm/cpu.h | 6 ++----
12
accel/tcg/translate-all.c | 2 +-
12
target/arm/translate.h | 2 --
13
exec.c | 14 +++++++++-----
13
target/arm/helper.c | 12 ++----------
14
hw/vfio/common.c | 3 ++-
14
target/arm/translate-a64.c | 1 -
15
memory_ldst.inc.c | 18 +++++++++---------
15
target/arm/translate.c | 1 -
16
target/riscv/helper.c | 2 +-
16
5 files changed, 4 insertions(+), 18 deletions(-)
17
6 files changed, 25 insertions(+), 18 deletions(-)
18
17
19
diff --git a/include/exec/memory.h b/include/exec/memory.h
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
20
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
21
--- a/include/exec/memory.h
20
--- a/target/arm/cpu.h
22
+++ b/include/exec/memory.h
21
+++ b/target/arm/cpu.h
23
@@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
22
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, BE_DATA, 3, 1)
24
* #MemoryRegion.
23
FIELD(TBFLAG_ANY, MMUIDX, 4, 4)
25
* @len: pointer to length
24
/* Target EL if we take a floating-point-disabled exception */
26
* @is_write: indicates the transfer direction
25
FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2)
27
+ * @attrs: memory attributes
26
-/* For A-profile only, target EL for debug exceptions. */
28
*/
27
-FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 10, 2)
29
MemoryRegion *flatview_translate(FlatView *fv,
28
/* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */
30
hwaddr addr, hwaddr *xlat,
29
-FIELD(TBFLAG_ANY, ALIGN_MEM, 12, 1)
31
@@ -XXX,XX +XXX,XX @@ MemoryRegion *flatview_translate(FlatView *fv,
30
-FIELD(TBFLAG_ANY, PSTATE__IL, 13, 1)
32
31
+FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1)
33
static inline MemoryRegion *address_space_translate(AddressSpace *as,
32
+FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1)
34
hwaddr addr, hwaddr *xlat,
33
35
- hwaddr *len, bool is_write)
34
/*
36
+ hwaddr *len, bool is_write,
35
* Bit usage when in AArch32 state, both A- and M-profile.
37
+ MemTxAttrs attrs)
36
diff --git a/target/arm/translate.h b/target/arm/translate.h
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/translate.h
39
+++ b/target/arm/translate.h
40
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
41
*/
42
uint32_t svc_imm;
43
int current_el;
44
- /* Debug target exception level for single-step exceptions */
45
- int debug_target_el;
46
GHashTable *cp_regs;
47
uint64_t features; /* CPU features bits */
48
bool aarch64;
49
diff --git a/target/arm/helper.c b/target/arm/helper.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/helper.c
52
+++ b/target/arm/helper.c
53
@@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_m32(CPUARMState *env, int fp_el,
54
return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
55
}
56
57
-static CPUARMTBFlags rebuild_hflags_aprofile(CPUARMState *env)
58
-{
59
- CPUARMTBFlags flags = {};
60
-
61
- DP_TBFLAG_ANY(flags, DEBUG_TARGET_EL, arm_debug_target_el(env));
62
- return flags;
63
-}
64
-
65
static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el,
66
ARMMMUIdx mmu_idx)
38
{
67
{
39
return flatview_translate(address_space_to_flatview(as),
68
- CPUARMTBFlags flags = rebuild_hflags_aprofile(env);
40
addr, xlat, len, is_write);
69
+ CPUARMTBFlags flags = {};
41
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
70
int el = arm_current_el(env);
71
72
if (arm_sctlr(env, el) & SCTLR_A) {
73
@@ -XXX,XX +XXX,XX @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el,
74
static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
75
ARMMMUIdx mmu_idx)
76
{
77
- CPUARMTBFlags flags = rebuild_hflags_aprofile(env);
78
+ CPUARMTBFlags flags = {};
79
ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx);
80
uint64_t tcr = regime_tcr(env, mmu_idx)->raw_tcr;
81
uint64_t sctlr;
82
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
42
index XXXXXXX..XXXXXXX 100644
83
index XXXXXXX..XXXXXXX 100644
43
--- a/accel/tcg/translate-all.c
84
--- a/target/arm/translate-a64.c
44
+++ b/accel/tcg/translate-all.c
85
+++ b/target/arm/translate-a64.c
45
@@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
86
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,
46
hwaddr l = 1;
87
dc->ss_active = EX_TBFLAG_ANY(tb_flags, SS_ACTIVE);
47
88
dc->pstate_ss = EX_TBFLAG_ANY(tb_flags, PSTATE__SS);
48
rcu_read_lock();
89
dc->is_ldex = false;
49
- mr = address_space_translate(as, addr, &addr, &l, false);
90
- dc->debug_target_el = EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL);
50
+ mr = address_space_translate(as, addr, &addr, &l, false, attrs);
91
51
if (!(memory_region_is_ram(mr)
92
/* Bound the number of insns to execute to those left on the page. */
52
|| memory_region_is_romd(mr))) {
93
bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4;
53
rcu_read_unlock();
94
diff --git a/target/arm/translate.c b/target/arm/translate.c
54
diff --git a/exec.c b/exec.c
55
index XXXXXXX..XXXXXXX 100644
95
index XXXXXXX..XXXXXXX 100644
56
--- a/exec.c
96
--- a/target/arm/translate.c
57
+++ b/exec.c
97
+++ b/target/arm/translate.c
58
@@ -XXX,XX +XXX,XX @@ static inline void cpu_physical_memory_write_rom_internal(AddressSpace *as,
98
@@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
59
rcu_read_lock();
99
dc->v7m_lspact = EX_TBFLAG_M32(tb_flags, LSPACT);
60
while (len > 0) {
100
dc->mve_no_pred = EX_TBFLAG_M32(tb_flags, MVE_NO_PRED);
61
l = len;
101
} else {
62
- mr = address_space_translate(as, addr, &addr1, &l, true);
102
- dc->debug_target_el = EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL);
63
+ mr = address_space_translate(as, addr, &addr1, &l, true,
103
dc->sctlr_b = EX_TBFLAG_A32(tb_flags, SCTLR__B);
64
+ MEMTXATTRS_UNSPECIFIED);
104
dc->hstr_active = EX_TBFLAG_A32(tb_flags, HSTR_ACTIVE);
65
105
dc->ns = EX_TBFLAG_A32(tb_flags, NS);
66
if (!(memory_region_is_ram(mr) ||
67
memory_region_is_romd(mr))) {
68
@@ -XXX,XX +XXX,XX @@ void address_space_cache_destroy(MemoryRegionCache *cache)
69
*/
70
static inline MemoryRegion *address_space_translate_cached(
71
MemoryRegionCache *cache, hwaddr addr, hwaddr *xlat,
72
- hwaddr *plen, bool is_write)
73
+ hwaddr *plen, bool is_write, MemTxAttrs attrs)
74
{
75
MemoryRegionSection section;
76
MemoryRegion *mr;
77
@@ -XXX,XX +XXX,XX @@ address_space_read_cached_slow(MemoryRegionCache *cache, hwaddr addr,
78
MemoryRegion *mr;
79
80
l = len;
81
- mr = address_space_translate_cached(cache, addr, &addr1, &l, false);
82
+ mr = address_space_translate_cached(cache, addr, &addr1, &l, false,
83
+ MEMTXATTRS_UNSPECIFIED);
84
flatview_read_continue(cache->fv,
85
addr, MEMTXATTRS_UNSPECIFIED, buf, len,
86
addr1, l, mr);
87
@@ -XXX,XX +XXX,XX @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr,
88
MemoryRegion *mr;
89
90
l = len;
91
- mr = address_space_translate_cached(cache, addr, &addr1, &l, true);
92
+ mr = address_space_translate_cached(cache, addr, &addr1, &l, true,
93
+ MEMTXATTRS_UNSPECIFIED);
94
flatview_write_continue(cache->fv,
95
addr, MEMTXATTRS_UNSPECIFIED, buf, len,
96
addr1, l, mr);
97
@@ -XXX,XX +XXX,XX @@ bool cpu_physical_memory_is_io(hwaddr phys_addr)
98
99
rcu_read_lock();
100
mr = address_space_translate(&address_space_memory,
101
- phys_addr, &phys_addr, &l, false);
102
+ phys_addr, &phys_addr, &l, false,
103
+ MEMTXATTRS_UNSPECIFIED);
104
105
res = !(memory_region_is_ram(mr) || memory_region_is_romd(mr));
106
rcu_read_unlock();
107
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
108
index XXXXXXX..XXXXXXX 100644
109
--- a/hw/vfio/common.c
110
+++ b/hw/vfio/common.c
111
@@ -XXX,XX +XXX,XX @@ static bool vfio_get_vaddr(IOMMUTLBEntry *iotlb, void **vaddr,
112
*/
113
mr = address_space_translate(&address_space_memory,
114
iotlb->translated_addr,
115
- &xlat, &len, writable);
116
+ &xlat, &len, writable,
117
+ MEMTXATTRS_UNSPECIFIED);
118
if (!memory_region_is_ram(mr)) {
119
error_report("iommu map to non memory area %"HWADDR_PRIx"",
120
xlat);
121
diff --git a/memory_ldst.inc.c b/memory_ldst.inc.c
122
index XXXXXXX..XXXXXXX 100644
123
--- a/memory_ldst.inc.c
124
+++ b/memory_ldst.inc.c
125
@@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL,
126
bool release_lock = false;
127
128
RCU_READ_LOCK();
129
- mr = TRANSLATE(addr, &addr1, &l, false);
130
+ mr = TRANSLATE(addr, &addr1, &l, false, attrs);
131
if (l < 4 || !IS_DIRECT(mr, false)) {
132
release_lock |= prepare_mmio_access(mr);
133
134
@@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL,
135
bool release_lock = false;
136
137
RCU_READ_LOCK();
138
- mr = TRANSLATE(addr, &addr1, &l, false);
139
+ mr = TRANSLATE(addr, &addr1, &l, false, attrs);
140
if (l < 8 || !IS_DIRECT(mr, false)) {
141
release_lock |= prepare_mmio_access(mr);
142
143
@@ -XXX,XX +XXX,XX @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
144
bool release_lock = false;
145
146
RCU_READ_LOCK();
147
- mr = TRANSLATE(addr, &addr1, &l, false);
148
+ mr = TRANSLATE(addr, &addr1, &l, false, attrs);
149
if (!IS_DIRECT(mr, false)) {
150
release_lock |= prepare_mmio_access(mr);
151
152
@@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
153
bool release_lock = false;
154
155
RCU_READ_LOCK();
156
- mr = TRANSLATE(addr, &addr1, &l, false);
157
+ mr = TRANSLATE(addr, &addr1, &l, false, attrs);
158
if (l < 2 || !IS_DIRECT(mr, false)) {
159
release_lock |= prepare_mmio_access(mr);
160
161
@@ -XXX,XX +XXX,XX @@ void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL,
162
bool release_lock = false;
163
164
RCU_READ_LOCK();
165
- mr = TRANSLATE(addr, &addr1, &l, true);
166
+ mr = TRANSLATE(addr, &addr1, &l, true, attrs);
167
if (l < 4 || !IS_DIRECT(mr, true)) {
168
release_lock |= prepare_mmio_access(mr);
169
170
@@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL,
171
bool release_lock = false;
172
173
RCU_READ_LOCK();
174
- mr = TRANSLATE(addr, &addr1, &l, true);
175
+ mr = TRANSLATE(addr, &addr1, &l, true, attrs);
176
if (l < 4 || !IS_DIRECT(mr, true)) {
177
release_lock |= prepare_mmio_access(mr);
178
179
@@ -XXX,XX +XXX,XX @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL,
180
bool release_lock = false;
181
182
RCU_READ_LOCK();
183
- mr = TRANSLATE(addr, &addr1, &l, true);
184
+ mr = TRANSLATE(addr, &addr1, &l, true, attrs);
185
if (!IS_DIRECT(mr, true)) {
186
release_lock |= prepare_mmio_access(mr);
187
r = memory_region_dispatch_write(mr, addr1, val, 1, attrs);
188
@@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL,
189
bool release_lock = false;
190
191
RCU_READ_LOCK();
192
- mr = TRANSLATE(addr, &addr1, &l, true);
193
+ mr = TRANSLATE(addr, &addr1, &l, true, attrs);
194
if (l < 2 || !IS_DIRECT(mr, true)) {
195
release_lock |= prepare_mmio_access(mr);
196
197
@@ -XXX,XX +XXX,XX @@ static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL,
198
bool release_lock = false;
199
200
RCU_READ_LOCK();
201
- mr = TRANSLATE(addr, &addr1, &l, true);
202
+ mr = TRANSLATE(addr, &addr1, &l, true, attrs);
203
if (l < 8 || !IS_DIRECT(mr, true)) {
204
release_lock |= prepare_mmio_access(mr);
205
206
diff --git a/target/riscv/helper.c b/target/riscv/helper.c
207
index XXXXXXX..XXXXXXX 100644
208
--- a/target/riscv/helper.c
209
+++ b/target/riscv/helper.c
210
@@ -XXX,XX +XXX,XX @@ restart:
211
MemoryRegion *mr;
212
hwaddr l = sizeof(target_ulong), addr1;
213
mr = address_space_translate(cs->as, pte_addr,
214
- &addr1, &l, false);
215
+ &addr1, &l, false, MEMTXATTRS_UNSPECIFIED);
216
if (memory_access_is_direct(mr, true)) {
217
target_ulong *pte_pa =
218
qemu_map_ram_ptr(mr->ram_block, addr1);
219
--
106
--
220
2.17.1
107
2.25.1
221
222
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to flatview_translate(); all its
3
callers now have attrs available.
4
2
3
This function is not required by any other translation file.
4
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220609202901.1177572-16-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20180521140402.23318-11-peter.maydell@linaro.org
9
---
9
---
10
include/exec/memory.h | 7 ++++---
10
target/arm/translate.h | 8 --------
11
exec.c | 17 +++++++++--------
11
target/arm/translate.c | 7 +++++++
12
2 files changed, 13 insertions(+), 11 deletions(-)
12
2 files changed, 7 insertions(+), 8 deletions(-)
13
13
14
diff --git a/include/exec/memory.h b/include/exec/memory.h
14
diff --git a/target/arm/translate.h b/target/arm/translate.h
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/include/exec/memory.h
16
--- a/target/arm/translate.h
17
+++ b/include/exec/memory.h
17
+++ b/target/arm/translate.h
18
@@ -XXX,XX +XXX,XX @@ IOMMUTLBEntry address_space_get_iotlb_entry(AddressSpace *as, hwaddr addr,
18
@@ -XXX,XX +XXX,XX @@ static inline void gen_ss_advance(DisasContext *s)
19
*/
19
}
20
MemoryRegion *flatview_translate(FlatView *fv,
20
}
21
hwaddr addr, hwaddr *xlat,
21
22
- hwaddr *len, bool is_write);
22
-static inline void gen_exception(int excp, uint32_t syndrome,
23
+ hwaddr *len, bool is_write,
23
- uint32_t target_el)
24
+ MemTxAttrs attrs);
24
-{
25
25
- gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
26
static inline MemoryRegion *address_space_translate(AddressSpace *as,
26
- tcg_constant_i32(syndrome),
27
hwaddr addr, hwaddr *xlat,
27
- tcg_constant_i32(target_el));
28
@@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate(AddressSpace *as,
28
-}
29
MemTxAttrs attrs)
29
-
30
/* Generate an architectural singlestep exception */
31
static inline void gen_swstep_exception(DisasContext *s, int isv, int ex)
30
{
32
{
31
return flatview_translate(address_space_to_flatview(as),
33
diff --git a/target/arm/translate.c b/target/arm/translate.c
32
- addr, xlat, len, is_write);
34
index XXXXXXX..XXXXXXX 100644
33
+ addr, xlat, len, is_write, attrs);
35
--- a/target/arm/translate.c
36
+++ b/target/arm/translate.c
37
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp)
38
s->base.is_jmp = DISAS_NORETURN;
34
}
39
}
35
40
36
/* address_space_access_valid: check for validity of accessing an address
41
+static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el)
37
@@ -XXX,XX +XXX,XX @@ MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
42
+{
38
rcu_read_lock();
43
+ gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
39
fv = address_space_to_flatview(as);
44
+ tcg_constant_i32(syndrome),
40
l = len;
45
+ tcg_constant_i32(target_el));
41
- mr = flatview_translate(fv, addr, &addr1, &l, false);
46
+}
42
+ mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
47
+
43
if (len == l && memory_access_is_direct(mr, false)) {
48
static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp,
44
ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
49
uint32_t syn, TCGv_i32 tcg_el)
45
memcpy(buf, ptr, len);
46
diff --git a/exec.c b/exec.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/exec.c
49
+++ b/exec.c
50
@@ -XXX,XX +XXX,XX @@ iotlb_fail:
51
52
/* Called from RCU critical section */
53
MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat,
54
- hwaddr *plen, bool is_write)
55
+ hwaddr *plen, bool is_write,
56
+ MemTxAttrs attrs)
57
{
50
{
58
MemoryRegion *mr;
59
MemoryRegionSection section;
60
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
61
}
62
63
l = len;
64
- mr = flatview_translate(fv, addr, &addr1, &l, true);
65
+ mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
66
}
67
68
return result;
69
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
70
MemTxResult result = MEMTX_OK;
71
72
l = len;
73
- mr = flatview_translate(fv, addr, &addr1, &l, true);
74
+ mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
75
result = flatview_write_continue(fv, addr, attrs, buf, len,
76
addr1, l, mr);
77
78
@@ -XXX,XX +XXX,XX @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
79
}
80
81
l = len;
82
- mr = flatview_translate(fv, addr, &addr1, &l, false);
83
+ mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
84
}
85
86
return result;
87
@@ -XXX,XX +XXX,XX @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
88
MemoryRegion *mr;
89
90
l = len;
91
- mr = flatview_translate(fv, addr, &addr1, &l, false);
92
+ mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
93
return flatview_read_continue(fv, addr, attrs, buf, len,
94
addr1, l, mr);
95
}
96
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
97
98
while (len > 0) {
99
l = len;
100
- mr = flatview_translate(fv, addr, &xlat, &l, is_write);
101
+ mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs);
102
if (!memory_access_is_direct(mr, is_write)) {
103
l = memory_access_size(mr, l, addr);
104
if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {
105
@@ -XXX,XX +XXX,XX @@ flatview_extend_translation(FlatView *fv, hwaddr addr,
106
107
len = target_len;
108
this_mr = flatview_translate(fv, addr, &xlat,
109
- &len, is_write);
110
+ &len, is_write, attrs);
111
if (this_mr != mr || xlat != base + done) {
112
return done;
113
}
114
@@ -XXX,XX +XXX,XX @@ void *address_space_map(AddressSpace *as,
115
l = len;
116
rcu_read_lock();
117
fv = address_space_to_flatview(as);
118
- mr = flatview_translate(fv, addr, &xlat, &l, is_write);
119
+ mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs);
120
121
if (!memory_access_is_direct(mr, is_write)) {
122
if (atomic_xchg(&bounce.in_use, true)) {
123
--
51
--
124
2.17.1
52
2.25.1
125
126
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to memory_region_access_valid().
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
2
6
The callsite in flatview_access_valid() is part of a recursive
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
loop flatview_access_valid() -> memory_region_access_valid() ->
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
subpage_accepts() -> flatview_access_valid(); we make it pass
5
Message-id: 20220609202901.1177572-17-richard.henderson@linaro.org
9
MEMTXATTRS_UNSPECIFIED for now, until the next several commits
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
have plumbed an attrs parameter through the rest of the loop
7
---
11
and we can add an attrs parameter to flatview_access_valid().
8
target/arm/translate.c | 18 +++++++++---------
9
1 file changed, 9 insertions(+), 9 deletions(-)
12
10
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
diff --git a/target/arm/translate.c b/target/arm/translate.c
14
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20180521140402.23318-8-peter.maydell@linaro.org
17
---
18
include/exec/memory-internal.h | 3 ++-
19
exec.c | 4 +++-
20
hw/s390x/s390-pci-inst.c | 3 ++-
21
memory.c | 7 ++++---
22
4 files changed, 11 insertions(+), 6 deletions(-)
23
24
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
25
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
26
--- a/include/exec/memory-internal.h
13
--- a/target/arm/translate.c
27
+++ b/include/exec/memory-internal.h
14
+++ b/target/arm/translate.c
28
@@ -XXX,XX +XXX,XX @@ void flatview_unref(FlatView *view);
15
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp)
29
extern const MemoryRegionOps unassigned_mem_ops;
16
s->base.is_jmp = DISAS_NORETURN;
30
17
}
31
bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
18
32
- unsigned size, bool is_write);
19
-static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el)
33
+ unsigned size, bool is_write,
20
+static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_el)
34
+ MemTxAttrs attrs);
21
{
35
22
gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
36
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section);
23
tcg_constant_i32(syndrome),
37
AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
24
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
38
diff --git a/exec.c b/exec.c
25
switch (dc->base.is_jmp) {
39
index XXXXXXX..XXXXXXX 100644
26
case DISAS_SWI:
40
--- a/exec.c
27
gen_ss_advance(dc);
41
+++ b/exec.c
28
- gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
42
@@ -XXX,XX +XXX,XX @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
29
- default_exception_el(dc));
43
mr = flatview_translate(fv, addr, &xlat, &l, is_write);
30
+ gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
44
if (!memory_access_is_direct(mr, is_write)) {
31
+ default_exception_el(dc));
45
l = memory_access_size(mr, l, addr);
32
break;
46
- if (!memory_region_access_valid(mr, xlat, l, is_write)) {
33
case DISAS_HVC:
47
+ /* When our callers all have attrs we'll pass them through here */
34
gen_ss_advance(dc);
48
+ if (!memory_region_access_valid(mr, xlat, l, is_write,
35
- gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
49
+ MEMTXATTRS_UNSPECIFIED)) {
36
+ gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
50
return false;
37
break;
51
}
38
case DISAS_SMC:
39
gen_ss_advance(dc);
40
- gen_exception(EXCP_SMC, syn_aa32_smc(), 3);
41
+ gen_exception_el(EXCP_SMC, syn_aa32_smc(), 3);
42
break;
43
case DISAS_NEXT:
44
case DISAS_TOO_MANY:
45
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
46
gen_helper_yield(cpu_env);
47
break;
48
case DISAS_SWI:
49
- gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
50
- default_exception_el(dc));
51
+ gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
52
+ default_exception_el(dc));
53
break;
54
case DISAS_HVC:
55
- gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
56
+ gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
57
break;
58
case DISAS_SMC:
59
- gen_exception(EXCP_SMC, syn_aa32_smc(), 3);
60
+ gen_exception_el(EXCP_SMC, syn_aa32_smc(), 3);
61
break;
52
}
62
}
53
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/s390x/s390-pci-inst.c
56
+++ b/hw/s390x/s390-pci-inst.c
57
@@ -XXX,XX +XXX,XX @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
58
mr = s390_get_subregion(mr, offset, len);
59
offset -= mr->addr;
60
61
- if (!memory_region_access_valid(mr, offset, len, true)) {
62
+ if (!memory_region_access_valid(mr, offset, len, true,
63
+ MEMTXATTRS_UNSPECIFIED)) {
64
s390_program_interrupt(env, PGM_OPERAND, 6, ra);
65
return 0;
66
}
67
diff --git a/memory.c b/memory.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/memory.c
70
+++ b/memory.c
71
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps ram_device_mem_ops = {
72
bool memory_region_access_valid(MemoryRegion *mr,
73
hwaddr addr,
74
unsigned size,
75
- bool is_write)
76
+ bool is_write,
77
+ MemTxAttrs attrs)
78
{
79
int access_size_min, access_size_max;
80
int access_size, i;
81
@@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr,
82
{
83
MemTxResult r;
84
85
- if (!memory_region_access_valid(mr, addr, size, false)) {
86
+ if (!memory_region_access_valid(mr, addr, size, false, attrs)) {
87
*pval = unassigned_mem_read(mr, addr, size);
88
return MEMTX_DECODE_ERROR;
89
}
90
@@ -XXX,XX +XXX,XX @@ MemTxResult memory_region_dispatch_write(MemoryRegion *mr,
91
unsigned size,
92
MemTxAttrs attrs)
93
{
94
- if (!memory_region_access_valid(mr, addr, size, true)) {
95
+ if (!memory_region_access_valid(mr, addr, size, true, attrs)) {
96
unassigned_mem_write(mr, addr, data, size);
97
return MEMTX_DECODE_ERROR;
98
}
63
}
99
--
64
--
100
2.17.1
65
2.25.1
101
102
diff view generated by jsdifflib
1
Add more detail to the documentation for memory_region_init_iommu()
1
From: Richard Henderson <richard.henderson@linaro.org>
2
and other IOMMU-related functions and data structures.
3
2
3
Create a new wrapper function that passes the default
4
exception target to gen_exception_el.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-18-richard.henderson@linaro.org
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
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20180521140402.23318-2-peter.maydell@linaro.org
9
---
10
---
10
include/exec/memory.h | 105 ++++++++++++++++++++++++++++++++++++++----
11
target/arm/translate.c | 11 +++++++----
11
1 file changed, 95 insertions(+), 10 deletions(-)
12
1 file changed, 7 insertions(+), 4 deletions(-)
12
13
13
diff --git a/include/exec/memory.h b/include/exec/memory.h
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/include/exec/memory.h
16
--- a/target/arm/translate.c
16
+++ b/include/exec/memory.h
17
+++ b/target/arm/translate.c
17
@@ -XXX,XX +XXX,XX @@ enum IOMMUMemoryRegionAttr {
18
@@ -XXX,XX +XXX,XX @@ static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_el)
18
IOMMU_ATTR_SPAPR_TCE_FD
19
tcg_constant_i32(target_el));
19
};
20
}
20
21
21
+/**
22
+static void gen_exception(DisasContext *s, int excp, uint32_t syndrome)
22
+ * IOMMUMemoryRegionClass:
23
+{
23
+ *
24
+ gen_exception_el(excp, syndrome, default_exception_el(s));
24
+ * All IOMMU implementations need to subclass TYPE_IOMMU_MEMORY_REGION
25
+}
25
+ * and provide an implementation of at least the @translate method here
26
+
26
+ * to handle requests to the memory region. Other methods are optional.
27
static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp,
27
+ *
28
uint32_t syn, TCGv_i32 tcg_el)
28
+ * The IOMMU implementation must use the IOMMU notifier infrastructure
29
{
29
+ * to report whenever mappings are changed, by calling
30
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
30
+ * memory_region_notify_iommu() (or, if necessary, by calling
31
switch (dc->base.is_jmp) {
31
+ * memory_region_notify_one() for each registered notifier).
32
case DISAS_SWI:
32
+ */
33
gen_ss_advance(dc);
33
typedef struct IOMMUMemoryRegionClass {
34
- gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
34
/* private */
35
- default_exception_el(dc));
35
struct DeviceClass parent_class;
36
+ gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb));
36
37
break;
37
/*
38
case DISAS_HVC:
38
- * Return a TLB entry that contains a given address. Flag should
39
gen_ss_advance(dc);
39
- * be the access permission of this translation operation. We can
40
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
40
- * set flag to IOMMU_NONE to mean that we don't need any
41
gen_helper_yield(cpu_env);
41
- * read/write permission checks, like, when for region replay.
42
break;
42
+ * Return a TLB entry that contains a given address.
43
case DISAS_SWI:
43
+ *
44
- gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb),
44
+ * The IOMMUAccessFlags indicated via @flag are optional and may
45
- default_exception_el(dc));
45
+ * be specified as IOMMU_NONE to indicate that the caller needs
46
+ gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb));
46
+ * the full translation information for both reads and writes. If
47
break;
47
+ * the access flags are specified then the IOMMU implementation
48
case DISAS_HVC:
48
+ * may use this as an optimization, to stop doing a page table
49
gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
49
+ * walk as soon as it knows that the requested permissions are not
50
+ * allowed. If IOMMU_NONE is passed then the IOMMU must do the
51
+ * full page table walk and report the permissions in the returned
52
+ * IOMMUTLBEntry. (Note that this implies that an IOMMU may not
53
+ * return different mappings for reads and writes.)
54
+ *
55
+ * The returned information remains valid while the caller is
56
+ * holding the big QEMU lock or is inside an RCU critical section;
57
+ * if the caller wishes to cache the mapping beyond that it must
58
+ * register an IOMMU notifier so it can invalidate its cached
59
+ * information when the IOMMU mapping changes.
60
+ *
61
+ * @iommu: the IOMMUMemoryRegion
62
+ * @hwaddr: address to be translated within the memory region
63
+ * @flag: requested access permissions
64
*/
65
IOMMUTLBEntry (*translate)(IOMMUMemoryRegion *iommu, hwaddr addr,
66
IOMMUAccessFlags flag);
67
- /* Returns minimum supported page size */
68
+ /* Returns minimum supported page size in bytes.
69
+ * If this method is not provided then the minimum is assumed to
70
+ * be TARGET_PAGE_SIZE.
71
+ *
72
+ * @iommu: the IOMMUMemoryRegion
73
+ */
74
uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu);
75
- /* Called when IOMMU Notifier flag changed */
76
+ /* Called when IOMMU Notifier flag changes (ie when the set of
77
+ * events which IOMMU users are requesting notification for changes).
78
+ * Optional method -- need not be provided if the IOMMU does not
79
+ * need to know exactly which events must be notified.
80
+ *
81
+ * @iommu: the IOMMUMemoryRegion
82
+ * @old_flags: events which previously needed to be notified
83
+ * @new_flags: events which now need to be notified
84
+ */
85
void (*notify_flag_changed)(IOMMUMemoryRegion *iommu,
86
IOMMUNotifierFlag old_flags,
87
IOMMUNotifierFlag new_flags);
88
- /* Set this up to provide customized IOMMU replay function */
89
+ /* Called to handle memory_region_iommu_replay().
90
+ *
91
+ * The default implementation of memory_region_iommu_replay() is to
92
+ * call the IOMMU translate method for every page in the address space
93
+ * with flag == IOMMU_NONE and then call the notifier if translate
94
+ * returns a valid mapping. If this method is implemented then it
95
+ * overrides the default behaviour, and must provide the full semantics
96
+ * of memory_region_iommu_replay(), by calling @notifier for every
97
+ * translation present in the IOMMU.
98
+ *
99
+ * Optional method -- an IOMMU only needs to provide this method
100
+ * if the default is inefficient or produces undesirable side effects.
101
+ *
102
+ * Note: this is not related to record-and-replay functionality.
103
+ */
104
void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
105
106
- /* Get IOMMU misc attributes */
107
- int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr,
108
+ /* Get IOMMU misc attributes. This is an optional method that
109
+ * can be used to allow users of the IOMMU to get implementation-specific
110
+ * information. The IOMMU implements this method to handle calls
111
+ * by IOMMU users to memory_region_iommu_get_attr() by filling in
112
+ * the arbitrary data pointer for any IOMMUMemoryRegionAttr values that
113
+ * the IOMMU supports. If the method is unimplemented then
114
+ * memory_region_iommu_get_attr() will always return -EINVAL.
115
+ *
116
+ * @iommu: the IOMMUMemoryRegion
117
+ * @attr: attribute being queried
118
+ * @data: memory to fill in with the attribute data
119
+ *
120
+ * Returns 0 on success, or a negative errno; in particular
121
+ * returns -EINVAL for unrecognized or unimplemented attribute types.
122
+ */
123
+ int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr attr,
124
void *data);
125
} IOMMUMemoryRegionClass;
126
127
@@ -XXX,XX +XXX,XX @@ static inline void memory_region_init_reservation(MemoryRegion *mr,
128
* An IOMMU region translates addresses and forwards accesses to a target
129
* memory region.
130
*
131
+ * The IOMMU implementation must define a subclass of TYPE_IOMMU_MEMORY_REGION.
132
+ * @_iommu_mr should be a pointer to enough memory for an instance of
133
+ * that subclass, @instance_size is the size of that subclass, and
134
+ * @mrtypename is its name. This function will initialize @_iommu_mr as an
135
+ * instance of the subclass, and its methods will then be called to handle
136
+ * accesses to the memory region. See the documentation of
137
+ * #IOMMUMemoryRegionClass for further details.
138
+ *
139
* @_iommu_mr: the #IOMMUMemoryRegion to be initialized
140
* @instance_size: the IOMMUMemoryRegion subclass instance size
141
* @mrtypename: the type name of the #IOMMUMemoryRegion
142
@@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr,
143
* a notifier with the minimum page granularity returned by
144
* mr->iommu_ops->get_page_size().
145
*
146
+ * Note: this is not related to record-and-replay functionality.
147
+ *
148
* @iommu_mr: the memory region to observe
149
* @n: the notifier to which to replay iommu mappings
150
*/
151
@@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n);
152
* memory_region_iommu_replay_all: replay existing IOMMU translations
153
* to all the notifiers registered.
154
*
155
+ * Note: this is not related to record-and-replay functionality.
156
+ *
157
* @iommu_mr: the memory region to observe
158
*/
159
void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr);
160
@@ -XXX,XX +XXX,XX @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
161
* memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is
162
* defined on the IOMMU.
163
*
164
- * Returns 0 if succeded, error code otherwise.
165
+ * Returns 0 on success, or a negative errno otherwise. In particular,
166
+ * -EINVAL indicates that the IOMMU does not support the requested
167
+ * attribute.
168
*
169
* @iommu_mr: the memory region
170
* @attr: the requested attribute
171
--
50
--
172
2.17.1
51
2.25.1
173
174
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to address_space_translate_iommu().
3
2
3
Split out a common helper function for gen_exception_el
4
and gen_exception_insn_el_v.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-19-richard.henderson@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180521140402.23318-14-peter.maydell@linaro.org
8
---
10
---
9
exec.c | 8 +++++---
11
target/arm/translate.c | 13 ++++++++-----
10
1 file changed, 5 insertions(+), 3 deletions(-)
12
1 file changed, 8 insertions(+), 5 deletions(-)
11
13
12
diff --git a/exec.c b/exec.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/exec.c
16
--- a/target/arm/translate.c
15
+++ b/exec.c
17
+++ b/target/arm/translate.c
16
@@ -XXX,XX +XXX,XX @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x
18
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp)
17
* @is_write: whether the translation operation is for write
19
s->base.is_jmp = DISAS_NORETURN;
18
* @is_mmio: whether this can be MMIO, set true if it can
20
}
19
* @target_as: the address space targeted by the IOMMU
21
20
+ * @attrs: transaction attributes
22
-static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_el)
21
*
23
+static void gen_exception_el_v(int excp, uint32_t syndrome, TCGv_i32 tcg_el)
22
* This function is called from RCU critical section. It is the common
23
* part of flatview_do_translate and address_space_translate_cached.
24
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection address_space_translate_iommu(IOMMUMemoryRegion *iomm
25
hwaddr *page_mask_out,
26
bool is_write,
27
bool is_mmio,
28
- AddressSpace **target_as)
29
+ AddressSpace **target_as,
30
+ MemTxAttrs attrs)
31
{
24
{
32
MemoryRegionSection *section;
25
gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
33
hwaddr page_mask = (hwaddr)-1;
26
- tcg_constant_i32(syndrome),
34
@@ -XXX,XX +XXX,XX @@ static MemoryRegionSection flatview_do_translate(FlatView *fv,
27
- tcg_constant_i32(target_el));
35
return address_space_translate_iommu(iommu_mr, xlat,
28
+ tcg_constant_i32(syndrome), tcg_el);
36
plen_out, page_mask_out,
29
+}
37
is_write, is_mmio,
30
+
38
- target_as);
31
+static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_el)
39
+ target_as, attrs);
32
+{
33
+ gen_exception_el_v(excp, syndrome, tcg_constant_i32(target_el));
34
}
35
36
static void gen_exception(DisasContext *s, int excp, uint32_t syndrome)
37
@@ -XXX,XX +XXX,XX @@ static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp,
38
gen_set_condexec(s);
39
gen_set_pc_im(s, pc);
40
}
40
}
41
if (page_mask_out) {
41
- gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp),
42
/* Not behind an IOMMU, use default page size. */
42
- tcg_constant_i32(syn), tcg_el);
43
@@ -XXX,XX +XXX,XX @@ static inline MemoryRegion *address_space_translate_cached(
43
+ gen_exception_el_v(excp, syn, tcg_el);
44
44
s->base.is_jmp = DISAS_NORETURN;
45
section = address_space_translate_iommu(iommu_mr, xlat, plen,
46
NULL, is_write, true,
47
- &target_as);
48
+ &target_as, attrs);
49
return section.mr;
50
}
45
}
51
46
52
--
47
--
53
2.17.1
48
2.25.1
54
55
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to the MemoryRegion valid.accepts
3
callback. We'll need this for subpage_accepts().
4
2
5
We could take the approach we used with the read and write
3
With the helper we can use exception_target_el at runtime,
6
callbacks and add new a new _with_attrs version, but since there
4
instead of default_exception_el at translate time.
7
are so few implementations of the accepts hook we just change
5
While we're at it, remove the DisasContext parameter from
8
them all.
6
gen_exception, as it is no longer used.
9
7
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20220609202901.1177572-20-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20180521140402.23318-9-peter.maydell@linaro.org
14
---
12
---
15
include/exec/memory.h | 3 ++-
13
target/arm/helper.h | 1 +
16
exec.c | 9 ++++++---
14
target/arm/op_helper.c | 10 ++++++++++
17
hw/hppa/dino.c | 3 ++-
15
target/arm/translate.c | 18 +++++++++++++-----
18
hw/nvram/fw_cfg.c | 12 ++++++++----
16
3 files changed, 24 insertions(+), 5 deletions(-)
19
hw/scsi/esp.c | 3 ++-
20
hw/xen/xen_pt_msi.c | 3 ++-
21
memory.c | 5 +++--
22
7 files changed, 25 insertions(+), 13 deletions(-)
23
17
24
diff --git a/include/exec/memory.h b/include/exec/memory.h
18
diff --git a/target/arm/helper.h b/target/arm/helper.h
25
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
26
--- a/include/exec/memory.h
20
--- a/target/arm/helper.h
27
+++ b/include/exec/memory.h
21
+++ b/target/arm/helper.h
28
@@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps {
22
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i32)
29
* as a machine check exception).
23
DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
30
*/
24
i32, i32, i32, i32)
31
bool (*accepts)(void *opaque, hwaddr addr,
25
DEF_HELPER_2(exception_internal, noreturn, env, i32)
32
- unsigned size, bool is_write);
26
+DEF_HELPER_3(exception_with_syndrome, noreturn, env, i32, i32)
33
+ unsigned size, bool is_write,
27
DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32)
34
+ MemTxAttrs attrs);
28
DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32)
35
} valid;
29
DEF_HELPER_2(exception_swstep, noreturn, env, i32)
36
/* Internal implementation constraints: */
30
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
37
struct {
38
diff --git a/exec.c b/exec.c
39
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
40
--- a/exec.c
32
--- a/target/arm/op_helper.c
41
+++ b/exec.c
33
+++ b/target/arm/op_helper.c
42
@@ -XXX,XX +XXX,XX @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
34
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome_el)(CPUARMState *env, uint32_t excp,
35
raise_exception(env, excp, syndrome, target_el);
43
}
36
}
44
37
45
static bool notdirty_mem_accepts(void *opaque, hwaddr addr,
38
+/*
46
- unsigned size, bool is_write)
39
+ * Raise an exception with the specified syndrome register value
47
+ unsigned size, bool is_write,
40
+ * to the default target el.
48
+ MemTxAttrs attrs)
41
+ */
42
+void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp,
43
+ uint32_t syndrome)
44
+{
45
+ raise_exception(env, excp, syndrome, exception_target_el(env));
46
+}
47
+
48
uint32_t HELPER(cpsr_read)(CPUARMState *env)
49
{
49
{
50
return is_write;
50
return cpsr_read(env) & ~CPSR_EXEC;
51
diff --git a/target/arm/translate.c b/target/arm/translate.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/target/arm/translate.c
54
+++ b/target/arm/translate.c
55
@@ -XXX,XX +XXX,XX @@ static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_el)
56
gen_exception_el_v(excp, syndrome, tcg_constant_i32(target_el));
51
}
57
}
52
@@ -XXX,XX +XXX,XX @@ static MemTxResult subpage_write(void *opaque, hwaddr addr,
58
59
-static void gen_exception(DisasContext *s, int excp, uint32_t syndrome)
60
+static void gen_exception(int excp, uint32_t syndrome)
61
{
62
- gen_exception_el(excp, syndrome, default_exception_el(s));
63
+ gen_helper_exception_with_syndrome(cpu_env, tcg_constant_i32(excp),
64
+ tcg_constant_i32(syndrome));
53
}
65
}
54
66
55
static bool subpage_accepts(void *opaque, hwaddr addr,
67
static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp,
56
- unsigned len, bool is_write)
68
@@ -XXX,XX +XXX,XX @@ void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp,
57
+ unsigned len, bool is_write,
69
58
+ MemTxAttrs attrs)
70
void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t syn)
59
{
71
{
60
subpage_t *subpage = opaque;
72
- gen_exception_insn_el(s, pc, excp, syn, default_exception_el(s));
61
#if defined(DEBUG_SUBPAGE)
73
+ if (s->aarch64) {
62
@@ -XXX,XX +XXX,XX @@ static void readonly_mem_write(void *opaque, hwaddr addr,
74
+ gen_a64_set_pc_im(pc);
75
+ } else {
76
+ gen_set_condexec(s);
77
+ gen_set_pc_im(s, pc);
78
+ }
79
+ gen_exception(excp, syn);
80
+ s->base.is_jmp = DISAS_NORETURN;
63
}
81
}
64
82
65
static bool readonly_mem_accepts(void *opaque, hwaddr addr,
83
static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
66
- unsigned size, bool is_write)
84
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
67
+ unsigned size, bool is_write,
85
switch (dc->base.is_jmp) {
68
+ MemTxAttrs attrs)
86
case DISAS_SWI:
69
{
87
gen_ss_advance(dc);
70
return is_write;
88
- gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb));
71
}
89
+ gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb));
72
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
90
break;
73
index XXXXXXX..XXXXXXX 100644
91
case DISAS_HVC:
74
--- a/hw/hppa/dino.c
92
gen_ss_advance(dc);
75
+++ b/hw/hppa/dino.c
93
@@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
76
@@ -XXX,XX +XXX,XX @@ static void gsc_to_pci_forwarding(DinoState *s)
94
gen_helper_yield(cpu_env);
77
}
95
break;
78
96
case DISAS_SWI:
79
static bool dino_chip_mem_valid(void *opaque, hwaddr addr,
97
- gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb));
80
- unsigned size, bool is_write)
98
+ gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb));
81
+ unsigned size, bool is_write,
99
break;
82
+ MemTxAttrs attrs)
100
case DISAS_HVC:
83
{
101
gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2);
84
switch (addr) {
85
case DINO_IAR0:
86
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/hw/nvram/fw_cfg.c
89
+++ b/hw/nvram/fw_cfg.c
90
@@ -XXX,XX +XXX,XX @@ static void fw_cfg_dma_mem_write(void *opaque, hwaddr addr,
91
}
92
93
static bool fw_cfg_dma_mem_valid(void *opaque, hwaddr addr,
94
- unsigned size, bool is_write)
95
+ unsigned size, bool is_write,
96
+ MemTxAttrs attrs)
97
{
98
return !is_write || ((size == 4 && (addr == 0 || addr == 4)) ||
99
(size == 8 && addr == 0));
100
}
101
102
static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr,
103
- unsigned size, bool is_write)
104
+ unsigned size, bool is_write,
105
+ MemTxAttrs attrs)
106
{
107
return addr == 0;
108
}
109
@@ -XXX,XX +XXX,XX @@ static void fw_cfg_ctl_mem_write(void *opaque, hwaddr addr,
110
}
111
112
static bool fw_cfg_ctl_mem_valid(void *opaque, hwaddr addr,
113
- unsigned size, bool is_write)
114
+ unsigned size, bool is_write,
115
+ MemTxAttrs attrs)
116
{
117
return is_write && size == 2;
118
}
119
@@ -XXX,XX +XXX,XX @@ static void fw_cfg_comb_write(void *opaque, hwaddr addr,
120
}
121
122
static bool fw_cfg_comb_valid(void *opaque, hwaddr addr,
123
- unsigned size, bool is_write)
124
+ unsigned size, bool is_write,
125
+ MemTxAttrs attrs)
126
{
127
return (size == 1) || (is_write && size == 2);
128
}
129
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
130
index XXXXXXX..XXXXXXX 100644
131
--- a/hw/scsi/esp.c
132
+++ b/hw/scsi/esp.c
133
@@ -XXX,XX +XXX,XX @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val)
134
}
135
136
static bool esp_mem_accepts(void *opaque, hwaddr addr,
137
- unsigned size, bool is_write)
138
+ unsigned size, bool is_write,
139
+ MemTxAttrs attrs)
140
{
141
return (size == 1) || (is_write && size == 4);
142
}
143
diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
144
index XXXXXXX..XXXXXXX 100644
145
--- a/hw/xen/xen_pt_msi.c
146
+++ b/hw/xen/xen_pt_msi.c
147
@@ -XXX,XX +XXX,XX @@ static uint64_t pci_msix_read(void *opaque, hwaddr addr,
148
}
149
150
static bool pci_msix_accepts(void *opaque, hwaddr addr,
151
- unsigned size, bool is_write)
152
+ unsigned size, bool is_write,
153
+ MemTxAttrs attrs)
154
{
155
return !(addr & (size - 1));
156
}
157
diff --git a/memory.c b/memory.c
158
index XXXXXXX..XXXXXXX 100644
159
--- a/memory.c
160
+++ b/memory.c
161
@@ -XXX,XX +XXX,XX @@ static void unassigned_mem_write(void *opaque, hwaddr addr,
162
}
163
164
static bool unassigned_mem_accepts(void *opaque, hwaddr addr,
165
- unsigned size, bool is_write)
166
+ unsigned size, bool is_write,
167
+ MemTxAttrs attrs)
168
{
169
return false;
170
}
171
@@ -XXX,XX +XXX,XX @@ bool memory_region_access_valid(MemoryRegion *mr,
172
access_size = MAX(MIN(size, access_size_max), access_size_min);
173
for (i = 0; i < size; i += access_size) {
174
if (!mr->ops->valid.accepts(mr->opaque, addr + i, access_size,
175
- is_write)) {
176
+ is_write, attrs)) {
177
return false;
178
}
179
}
180
--
102
--
181
2.17.1
103
2.25.1
182
183
diff view generated by jsdifflib
1
From: Paolo Bonzini <pbonzini@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
cpregs_keys is an uint32_t* so the allocation should use uint32_t.
3
This function is no longer used. At the same time, remove
4
g_new is even better because it is type-safe.
4
DisasContext.secure_routed_to_el3, as it in turn becomes unused.
5
5
6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-21-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
target/arm/gdbstub.c | 3 +--
11
target/arm/translate.h | 16 ----------------
12
1 file changed, 1 insertion(+), 2 deletions(-)
12
target/arm/translate-a64.c | 5 -----
13
target/arm/translate.c | 5 -----
14
3 files changed, 26 deletions(-)
13
15
14
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
16
diff --git a/target/arm/translate.h b/target/arm/translate.h
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/gdbstub.c
18
--- a/target/arm/translate.h
17
+++ b/target/arm/gdbstub.c
19
+++ b/target/arm/translate.h
18
@@ -XXX,XX +XXX,XX @@ int arm_gen_dynamic_xml(CPUState *cs)
20
@@ -XXX,XX +XXX,XX @@ typedef struct DisasContext {
19
RegisterSysregXmlParam param = {cs, s};
21
int fp_excp_el; /* FP exception EL or 0 if enabled */
20
22
int sve_excp_el; /* SVE exception EL or 0 if enabled */
21
cpu->dyn_xml.num_cpregs = 0;
23
int vl; /* current vector length in bytes */
22
- cpu->dyn_xml.cpregs_keys = g_malloc(sizeof(uint32_t *) *
24
- /* Flag indicating that exceptions from secure mode are routed to EL3. */
23
- g_hash_table_size(cpu->cp_regs));
25
- bool secure_routed_to_el3;
24
+ cpu->dyn_xml.cpregs_keys = g_new(uint32_t, g_hash_table_size(cpu->cp_regs));
26
bool vfp_enabled; /* FP enabled via FPSCR.EN */
25
g_string_printf(s, "<?xml version=\"1.0\"?>");
27
int vec_len;
26
g_string_append_printf(s, "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">");
28
int vec_stride;
27
g_string_append_printf(s, "<feature name=\"org.qemu.gdb.arm.sys.regs\">");
29
@@ -XXX,XX +XXX,XX @@ static inline int get_mem_index(DisasContext *s)
30
return arm_to_core_mmu_idx(s->mmu_idx);
31
}
32
33
-/* Function used to determine the target exception EL when otherwise not known
34
- * or default.
35
- */
36
-static inline int default_exception_el(DisasContext *s)
37
-{
38
- /* If we are coming from secure EL0 in a system with a 32-bit EL3, then
39
- * there is no secure EL1, so we route exceptions to EL3. Otherwise,
40
- * exceptions can only be routed to ELs above 1, so we target the higher of
41
- * 1 or the current EL.
42
- */
43
- return (s->mmu_idx == ARMMMUIdx_SE10_0 && s->secure_routed_to_el3)
44
- ? 3 : MAX(1, s->current_el);
45
-}
46
-
47
static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)
48
{
49
/* We don't need to save all of the syndrome so we mask and shift
50
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/translate-a64.c
53
+++ b/target/arm/translate-a64.c
54
@@ -XXX,XX +XXX,XX @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,
55
dc->condjmp = 0;
56
57
dc->aarch64 = true;
58
- /* If we are coming from secure EL0 in a system with a 32-bit EL3, then
59
- * there is no secure EL1, so we route exceptions to EL3.
60
- */
61
- dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) &&
62
- !arm_el_is_aa64(env, 3);
63
dc->thumb = false;
64
dc->sctlr_b = 0;
65
dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE;
66
diff --git a/target/arm/translate.c b/target/arm/translate.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/translate.c
69
+++ b/target/arm/translate.c
70
@@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
71
dc->condjmp = 0;
72
73
dc->aarch64 = false;
74
- /* If we are coming from secure EL0 in a system with a 32-bit EL3, then
75
- * there is no secure EL1, so we route exceptions to EL3.
76
- */
77
- dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) &&
78
- !arm_el_is_aa64(env, 3);
79
dc->thumb = EX_TBFLAG_AM32(tb_flags, THUMB);
80
dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE;
81
condexec = EX_TBFLAG_AM32(tb_flags, CONDEXEC);
28
--
82
--
29
2.17.1
83
2.25.1
30
31
diff view generated by jsdifflib
1
As part of plumbing MemTxAttrs down to the IOMMU translate method,
1
From: Richard Henderson <richard.henderson@linaro.org>
2
add MemTxAttrs as an argument to address_space_map().
3
Its callers either have an attrs value to hand, or don't care
4
and can use MEMTXATTRS_UNSPECIFIED.
5
2
3
Handle the debug vs current el exception test in one place.
4
Leave EXCP_BKPT alone, since that treats debug < current differently.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220609202901.1177572-22-richard.henderson@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20180521140402.23318-5-peter.maydell@linaro.org
10
---
10
---
11
include/exec/memory.h | 3 ++-
11
target/arm/debug_helper.c | 44 +++++++++++++++++++++------------------
12
include/sysemu/dma.h | 3 ++-
12
1 file changed, 24 insertions(+), 20 deletions(-)
13
exec.c | 6 ++++--
14
target/ppc/mmu-hash64.c | 3 ++-
15
4 files changed, 10 insertions(+), 5 deletions(-)
16
13
17
diff --git a/include/exec/memory.h b/include/exec/memory.h
14
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/include/exec/memory.h
16
--- a/target/arm/debug_helper.c
20
+++ b/include/exec/memory.h
17
+++ b/target/arm/debug_helper.c
21
@@ -XXX,XX +XXX,XX @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_
18
@@ -XXX,XX +XXX,XX @@
22
* @addr: address within that address space
19
#include "exec/helper-proto.h"
23
* @plen: pointer to length of buffer; updated on return
20
24
* @is_write: indicates the transfer direction
21
25
+ * @attrs: memory attributes
22
+/*
26
*/
23
+ * Raise an exception to the debug target el.
27
void *address_space_map(AddressSpace *as, hwaddr addr,
24
+ * Modify syndrome to indicate when origin and target EL are the same.
28
- hwaddr *plen, bool is_write);
25
+ */
29
+ hwaddr *plen, bool is_write, MemTxAttrs attrs);
26
+G_NORETURN static void
30
27
+raise_exception_debug(CPUARMState *env, uint32_t excp, uint32_t syndrome)
31
/* address_space_unmap: Unmaps a memory region previously mapped by address_space_map()
28
+{
32
*
29
+ int debug_el = arm_debug_target_el(env);
33
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
30
+ int cur_el = arm_current_el(env);
34
index XXXXXXX..XXXXXXX 100644
31
+
35
--- a/include/sysemu/dma.h
32
+ /*
36
+++ b/include/sysemu/dma.h
33
+ * If singlestep is targeting a lower EL than the current one, then
37
@@ -XXX,XX +XXX,XX @@ static inline void *dma_memory_map(AddressSpace *as,
34
+ * DisasContext.ss_active must be false and we can never get here.
38
hwaddr xlen = *len;
35
+ * Similarly for watchpoint and breakpoint matches.
39
void *p;
36
+ */
40
37
+ assert(debug_el >= cur_el);
41
- p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE);
38
+ syndrome |= (debug_el == cur_el) << ARM_EL_EC_SHIFT;
42
+ p = address_space_map(as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE,
39
+ raise_exception(env, excp, syndrome, debug_el);
43
+ MEMTXATTRS_UNSPECIFIED);
40
+}
44
*len = xlen;
41
+
45
return p;
42
/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */
43
static bool aa64_generate_debug_exceptions(CPUARMState *env)
44
{
45
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
46
if (wp_hit) {
47
if (wp_hit->flags & BP_CPU) {
48
bool wnr = (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) != 0;
49
- bool same_el = arm_debug_target_el(env) == arm_current_el(env);
50
51
cs->watchpoint_hit = NULL;
52
53
env->exception.fsr = arm_debug_exception_fsr(env);
54
env->exception.vaddress = wp_hit->hitaddr;
55
- raise_exception(env, EXCP_DATA_ABORT,
56
- syn_watchpoint(same_el, 0, wnr),
57
- arm_debug_target_el(env));
58
+ raise_exception_debug(env, EXCP_DATA_ABORT,
59
+ syn_watchpoint(0, 0, wnr));
60
}
61
} else {
62
uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
63
- bool same_el = (arm_debug_target_el(env) == arm_current_el(env));
64
65
/*
66
* (1) GDB breakpoints should be handled first.
67
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
68
* exception/security level.
69
*/
70
env->exception.vaddress = 0;
71
- raise_exception(env, EXCP_PREFETCH_ABORT,
72
- syn_breakpoint(same_el),
73
- arm_debug_target_el(env));
74
+ raise_exception_debug(env, EXCP_PREFETCH_ABORT, syn_breakpoint(0));
75
}
46
}
76
}
47
diff --git a/exec.c b/exec.c
77
48
index XXXXXXX..XXXXXXX 100644
78
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome)
49
--- a/exec.c
79
50
+++ b/exec.c
80
void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome)
51
@@ -XXX,XX +XXX,XX @@ flatview_extend_translation(FlatView *fv, hwaddr addr,
52
void *address_space_map(AddressSpace *as,
53
hwaddr addr,
54
hwaddr *plen,
55
- bool is_write)
56
+ bool is_write,
57
+ MemTxAttrs attrs)
58
{
81
{
59
hwaddr len = *plen;
82
- int debug_el = arm_debug_target_el(env);
60
hwaddr l, xlat;
83
- int cur_el = arm_current_el(env);
61
@@ -XXX,XX +XXX,XX @@ void *cpu_physical_memory_map(hwaddr addr,
84
-
62
hwaddr *plen,
85
- /*
63
int is_write)
86
- * If singlestep is targeting a lower EL than the current one, then
64
{
87
- * DisasContext.ss_active must be false and we can never get here.
65
- return address_space_map(&address_space_memory, addr, plen, is_write);
88
- */
66
+ return address_space_map(&address_space_memory, addr, plen, is_write,
89
- assert(debug_el >= cur_el);
67
+ MEMTXATTRS_UNSPECIFIED);
90
- if (debug_el == cur_el) {
91
- syndrome |= 1 << ARM_EL_EC_SHIFT;
92
- }
93
- raise_exception(env, EXCP_UDEF, syndrome, debug_el);
94
+ raise_exception_debug(env, EXCP_UDEF, syndrome);
68
}
95
}
69
96
70
void cpu_physical_memory_unmap(void *buffer, hwaddr len,
97
#if !defined(CONFIG_USER_ONLY)
71
diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c
72
index XXXXXXX..XXXXXXX 100644
73
--- a/target/ppc/mmu-hash64.c
74
+++ b/target/ppc/mmu-hash64.c
75
@@ -XXX,XX +XXX,XX @@ const ppc_hash_pte64_t *ppc_hash64_map_hptes(PowerPCCPU *cpu,
76
return NULL;
77
}
78
79
- hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false);
80
+ hptes = address_space_map(CPU(cpu)->as, base + pte_offset, &plen, false,
81
+ MEMTXATTRS_UNSPECIFIED);
82
if (plen < (n * HASH_PTE_SIZE_64)) {
83
hw_error("%s: Unable to map all requested HPTEs\n", __func__);
84
}
85
--
98
--
86
2.17.1
99
2.25.1
87
88
diff view generated by jsdifflib
1
From: Igor Mammedov <imammedo@redhat.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
When QEMU is started with following CLI
3
This function is no longer used outside debug_helper.c.
4
-machine virt,gic-version=3,accel=kvm -cpu host -bios AAVMF_CODE.fd
5
it crashes with abort at
6
accel/kvm/kvm-all.c:2164:
7
KVM_SET_DEVICE_ATTR failed: Group 6 attr 0x000000000000c665: Invalid argument
8
4
9
Which is caused by implicit dependency of kvm_arm_gicv3_reset() on
10
arm_gicv3_icc_reset() where the later is called by CPU reset
11
reset callback.
12
13
However commit:
14
3b77f6c arm/boot: split load_dtb() from arm_load_kernel()
15
broke CPU reset callback registration in case
16
17
arm_load_kernel()
18
...
19
if (!info->kernel_filename || info->firmware_loaded)
20
21
branch is taken, i.e. it's sufficient to provide a firmware
22
or do not provide kernel on CLI to skip cpu reset callback
23
registration, where before offending commit the callback
24
has been registered unconditionally.
25
26
Fix it by registering the callback right at the beginning of
27
arm_load_kernel() unconditionally instead of doing it at the end.
28
29
NOTE:
30
we probably should eliminate that dependency anyways as well as
31
separate arch CPU reset parts from arm_load_kernel() into CPU
32
itself, but that refactoring that I probably would have to do
33
anyways later for CPU hotplug to work.
34
35
Reported-by: Auger Eric <eric.auger@redhat.com>
36
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
37
Reviewed-by: Eric Auger <eric.auger@redhat.com>
38
Tested-by: Eric Auger <eric.auger@redhat.com>
39
Message-id: 1527070950-208350-1-git-send-email-imammedo@redhat.com
40
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220609202901.1177572-23-richard.henderson@linaro.org
41
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
42
---
9
---
43
hw/arm/boot.c | 18 +++++++++---------
10
target/arm/cpu.h | 21 ---------------------
44
1 file changed, 9 insertions(+), 9 deletions(-)
11
target/arm/debug_helper.c | 21 +++++++++++++++++++++
12
2 files changed, 21 insertions(+), 21 deletions(-)
45
13
46
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
47
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/arm/boot.c
16
--- a/target/arm/cpu.h
49
+++ b/hw/arm/boot.c
17
+++ b/target/arm/cpu.h
50
@@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
18
@@ -XXX,XX +XXX,XX @@ typedef enum ARMASIdx {
51
static const ARMInsnFixup *primary_loader;
19
ARMASIdx_TagS = 3,
52
AddressSpace *as = arm_boot_address_space(cpu, info);
20
} ARMASIdx;
53
21
54
+ /* CPU objects (unlike devices) are not automatically reset on system
22
-/* Return the Exception Level targeted by debug exceptions. */
55
+ * reset, so we must always register a handler to do so. If we're
23
-static inline int arm_debug_target_el(CPUARMState *env)
56
+ * actually loading a kernel, the handler is also responsible for
24
-{
57
+ * arranging that we start it correctly.
25
- bool secure = arm_is_secure(env);
58
+ */
26
- bool route_to_el2 = false;
59
+ for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
27
-
60
+ qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
28
- if (arm_is_el2_enabled(env)) {
29
- route_to_el2 = env->cp15.hcr_el2 & HCR_TGE ||
30
- env->cp15.mdcr_el2 & MDCR_TDE;
31
- }
32
-
33
- if (route_to_el2) {
34
- return 2;
35
- } else if (arm_feature(env, ARM_FEATURE_EL3) &&
36
- !arm_el_is_aa64(env, 3) && secure) {
37
- return 3;
38
- } else {
39
- return 1;
40
- }
41
-}
42
-
43
static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu)
44
{
45
/* If all the CLIDR.Ctypem bits are 0 there are no caches, and
46
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/target/arm/debug_helper.c
49
+++ b/target/arm/debug_helper.c
50
@@ -XXX,XX +XXX,XX @@
51
#include "exec/helper-proto.h"
52
53
54
+/* Return the Exception Level targeted by debug exceptions. */
55
+static int arm_debug_target_el(CPUARMState *env)
56
+{
57
+ bool secure = arm_is_secure(env);
58
+ bool route_to_el2 = false;
59
+
60
+ if (arm_is_el2_enabled(env)) {
61
+ route_to_el2 = env->cp15.hcr_el2 & HCR_TGE ||
62
+ env->cp15.mdcr_el2 & MDCR_TDE;
61
+ }
63
+ }
62
+
64
+
63
/* The board code is not supposed to set secure_board_setup unless
65
+ if (route_to_el2) {
64
* running its code in secure mode is actually possible, and KVM
66
+ return 2;
65
* doesn't support secure.
67
+ } else if (arm_feature(env, ARM_FEATURE_EL3) &&
66
@@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
68
+ !arm_el_is_aa64(env, 3) && secure) {
67
ARM_CPU(cs)->env.boot_info = info;
69
+ return 3;
68
}
70
+ } else {
69
71
+ return 1;
70
- /* CPU objects (unlike devices) are not automatically reset on system
72
+ }
71
- * reset, so we must always register a handler to do so. If we're
73
+}
72
- * actually loading a kernel, the handler is also responsible for
74
+
73
- * arranging that we start it correctly.
75
/*
74
- */
76
* Raise an exception to the debug target el.
75
- for (cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
77
* Modify syndrome to indicate when origin and target EL are the same.
76
- qemu_register_reset(do_cpu_reset, ARM_CPU(cs));
77
- }
78
-
79
if (!info->skip_dtb_autoload && have_dtb(info)) {
80
if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as) < 0) {
81
exit(1);
82
--
78
--
83
2.17.1
79
2.25.1
84
85
diff view generated by jsdifflib
1
In commit f0aff255700 we made cpacr_write() enforce that some CPACR
1
From: Richard Henderson <richard.henderson@linaro.org>
2
bits are RAZ/WI and some are RAO/WI for ARMv7 cores. Unfortunately
3
we forgot to also update the register's reset value. The effect
4
was that (a) a guest that read CPACR on reset would not see ones in
5
the RAO bits, and (b) if you did a migration before the guest did
6
a write to the CPACR then the migration would fail because the
7
destination would enforce the RAO bits and then complain that they
8
didn't match the zero value from the source.
9
2
10
Implement reset for the CPACR using a custom reset function
3
We were using arm_is_secure and is_a64, which are
11
that just calls cpacr_write(), to avoid having to duplicate
4
tests against the current EL, as opposed to
12
the logic for which bits are RAO.
5
arm_el_is_aa64 and arm_is_secure_below_el3, which
6
can be applied to a different EL than current.
7
Consolidate the two tests.
13
8
14
This bug would affect migration for TCG CPUs which are ARMv7
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
with VFP but without one of Neon or VFPv3.
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
11
Message-id: 20220609202901.1177572-24-richard.henderson@linaro.org
17
Reported-by: Cédric Le Goater <clg@kaod.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Tested-by: Cédric Le Goater <clg@kaod.org>
20
Message-id: 20180522173713.26282-1-peter.maydell@linaro.org
21
---
13
---
22
target/arm/helper.c | 10 +++++++++-
14
target/arm/helper.c | 23 +++++++++--------------
23
1 file changed, 9 insertions(+), 1 deletion(-)
15
1 file changed, 9 insertions(+), 14 deletions(-)
24
16
25
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
27
--- a/target/arm/helper.c
19
--- a/target/arm/helper.c
28
+++ b/target/arm/helper.c
20
+++ b/target/arm/helper.c
29
@@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri,
21
@@ -XXX,XX +XXX,XX @@ int fp_exception_el(CPUARMState *env, int cur_el)
30
env->cp15.cpacr_el1 = value;
22
int fpen = FIELD_EX64(env->cp15.cpacr_el1, CPACR_EL1, FPEN);
31
}
23
32
24
switch (fpen) {
33
+static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri)
25
+ case 1:
34
+{
26
+ if (cur_el != 0) {
35
+ /* Call cpacr_write() so that we reset with the correct RAO bits set
27
+ break;
36
+ * for our CPU features.
28
+ }
37
+ */
29
+ /* fall through */
38
+ cpacr_write(env, ri, 0);
30
case 0:
39
+}
31
case 2:
40
+
32
- if (cur_el == 0 || cur_el == 1) {
41
static CPAccessResult cpacr_access(CPUARMState *env, const ARMCPRegInfo *ri,
33
- /* Trap to PL1, which might be EL1 or EL3 */
42
bool isread)
34
- if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) {
43
{
35
- return 3;
44
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
36
- }
45
{ .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3,
37
- return 1;
46
.crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access,
38
- }
47
.access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1),
39
- if (cur_el == 3 && !is_a64(env)) {
48
- .resetvalue = 0, .writefn = cpacr_write },
40
- /* Secure PL1 running at EL3 */
49
+ .resetfn = cpacr_reset, .writefn = cpacr_write },
41
+ /* Trap from Secure PL0 or PL1 to Secure PL1. */
50
REGINFO_SENTINEL
42
+ if (!arm_el_is_aa64(env, 3)
51
};
43
+ && (cur_el == 3 || arm_is_secure_below_el3(env))) {
44
return 3;
45
}
46
- break;
47
- case 1:
48
- if (cur_el == 0) {
49
+ if (cur_el <= 1) {
50
return 1;
51
}
52
break;
53
- case 3:
54
- break;
55
}
56
}
52
57
53
--
58
--
54
2.17.1
59
2.25.1
55
56
diff view generated by jsdifflib
1
From: Jan Kiszka <jan.kiszka@siemens.com>
1
From: Hao Wu <wuhaotsh@google.com>
2
2
3
There was a nasty flip in identifying which register group an access is
3
Creating 1GB image for a simple qtest is unnecessary
4
targeting. The issue caused spuriously raised priorities of the guest
4
and could lead to failures. We reduce the image size
5
when handing CPUs over in the Jailhouse hypervisor.
5
to 1MB to reduce the test overhead.
6
6
7
Cc: qemu-stable@nongnu.org
7
Signed-off-by: Hao Wu <wuhaotsh@google.com>
8
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
8
Message-id: 20220609214125.4192212-1-wuhaotsh@google.com
9
Message-id: 28b927d3-da58-bce4-cc13-bfec7f9b1cb9@siemens.com
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
11
---
13
hw/intc/arm_gicv3_cpuif.c | 12 ++++++------
12
tests/qtest/npcm7xx_sdhci-test.c | 2 +-
14
1 file changed, 6 insertions(+), 6 deletions(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
15
14
16
diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c
15
diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c
17
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/intc/arm_gicv3_cpuif.c
17
--- a/tests/qtest/npcm7xx_sdhci-test.c
19
+++ b/hw/intc/arm_gicv3_cpuif.c
18
+++ b/tests/qtest/npcm7xx_sdhci-test.c
20
@@ -XXX,XX +XXX,XX @@ static uint64_t icv_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
19
@@ -XXX,XX +XXX,XX @@
21
{
20
#define NPCM7XX_REG_SIZE 0x100
22
GICv3CPUState *cs = icc_cs_from_env(env);
21
#define NPCM7XX_MMC_BA 0xF0842000
23
int regno = ri->opc2 & 3;
22
#define NPCM7XX_BLK_SIZE 512
24
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS;
23
-#define NPCM7XX_TEST_IMAGE_SIZE (1 << 30)
25
+ int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0;
24
+#define NPCM7XX_TEST_IMAGE_SIZE (1 << 20)
26
uint64_t value = cs->ich_apr[grp][regno];
25
27
26
char *sd_path;
28
trace_gicv3_icv_ap_read(ri->crm & 1, regno, gicv3_redist_affid(cs), value);
29
@@ -XXX,XX +XXX,XX @@ static void icv_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
30
{
31
GICv3CPUState *cs = icc_cs_from_env(env);
32
int regno = ri->opc2 & 3;
33
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS;
34
+ int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0;
35
36
trace_gicv3_icv_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value);
37
38
@@ -XXX,XX +XXX,XX @@ static uint64_t icc_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
39
uint64_t value;
40
41
int regno = ri->opc2 & 3;
42
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1;
43
+ int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0;
44
45
if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) {
46
return icv_ap_read(env, ri);
47
@@ -XXX,XX +XXX,XX @@ static void icc_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
48
GICv3CPUState *cs = icc_cs_from_env(env);
49
50
int regno = ri->opc2 & 3;
51
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1;
52
+ int grp = (ri->crm & 1) ? GICV3_G1 : GICV3_G0;
53
54
if (icv_access(env, grp == GICV3_G0 ? HCR_FMO : HCR_IMO)) {
55
icv_ap_write(env, ri, value);
56
@@ -XXX,XX +XXX,XX @@ static uint64_t ich_ap_read(CPUARMState *env, const ARMCPRegInfo *ri)
57
{
58
GICv3CPUState *cs = icc_cs_from_env(env);
59
int regno = ri->opc2 & 3;
60
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS;
61
+ int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0;
62
uint64_t value;
63
64
value = cs->ich_apr[grp][regno];
65
@@ -XXX,XX +XXX,XX @@ static void ich_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
66
{
67
GICv3CPUState *cs = icc_cs_from_env(env);
68
int regno = ri->opc2 & 3;
69
- int grp = ri->crm & 1 ? GICV3_G0 : GICV3_G1NS;
70
+ int grp = (ri->crm & 1) ? GICV3_G1NS : GICV3_G0;
71
72
trace_gicv3_ich_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value);
73
27
74
--
28
--
75
2.17.1
29
2.25.1
76
77
diff view generated by jsdifflib
1
From: Shannon Zhao <zhaoshenglong@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
It forgot to increase clroffset during the loop. So it only clear the
3
Because reset always initializes the AA64 version, SCR_EL3,
4
first 4 bytes.
4
test the mode of EL3 instead of the type of the cpreg.
5
5
6
Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Cc: qemu-stable@nongnu.org
7
Message-id: 20220609214657.1217913-2-richard.henderson@linaro.org
8
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
9
Reviewed-by: Eric Auger <eric.auger@redhat.com>
10
Message-id: 1527047633-12368-1-git-send-email-zhaoshenglong@huawei.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
hw/intc/arm_gicv3_kvm.c | 1 +
11
target/arm/helper.c | 14 ++++++++------
15
1 file changed, 1 insertion(+)
12
1 file changed, 8 insertions(+), 6 deletions(-)
16
13
17
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/intc/arm_gicv3_kvm.c
16
--- a/target/arm/helper.c
20
+++ b/hw/intc/arm_gicv3_kvm.c
17
+++ b/target/arm/helper.c
21
@@ -XXX,XX +XXX,XX @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
18
@@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
22
if (clroffset != 0) {
19
uint32_t valid_mask = 0x3fff;
23
reg = 0;
20
ARMCPU *cpu = env_archcpu(env);
24
kvm_gicd_access(s, clroffset, &reg, true);
21
25
+ clroffset += 4;
22
- if (ri->state == ARM_CP_STATE_AA64) {
26
}
23
- if (arm_feature(env, ARM_FEATURE_AARCH64) &&
27
reg = *gic_bmp_ptr32(bmp, irq);
24
- !cpu_isar_feature(aa64_aa32_el1, cpu)) {
28
kvm_gicd_access(s, offset, &reg, true);
25
- value |= SCR_FW | SCR_AW; /* these two bits are RES1. */
26
- }
27
- valid_mask &= ~SCR_NET;
28
+ /*
29
+ * Because SCR_EL3 is the "real" cpreg and SCR is the alias, reset always
30
+ * passes the reginfo for SCR_EL3, which has type ARM_CP_STATE_AA64.
31
+ * Instead, choose the format based on the mode of EL3.
32
+ */
33
+ if (arm_el_is_aa64(env, 3)) {
34
+ value |= SCR_FW | SCR_AW; /* RES1 */
35
+ valid_mask &= ~SCR_NET; /* RES0 */
36
37
if (cpu_isar_feature(aa64_ras, cpu)) {
38
valid_mask |= SCR_TERR;
29
--
39
--
30
2.17.1
40
2.25.1
31
32
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Depending on the host abi, float16, aka uint16_t, values are
3
Since DDI0487F.a, the RW bit is RAO/WI. When specifically
4
passed and returned either zero-extended in the host register
4
targeting such a cpu, e.g. cortex-a76, it is legitimate to
5
or with garbage at the top of the host register.
5
ignore the bit within the secure monitor.
6
6
7
The tcg code generator has so far been assuming garbage, as that
7
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1062
8
matches the x86 abi, but this is incorrect for other host abis.
9
Further, target/arm has so far been assuming zero-extended results,
10
so that it may store the 16-bit value into a 32-bit slot with the
11
high 16-bits already clear.
12
13
Rectify both problems by mapping "f16" in the helper definition
14
to uint32_t instead of (a typedef for) uint16_t. This forces
15
the host compiler to assume garbage in the upper 16 bits on input
16
and to zero-extend the result on output.
17
18
Cc: qemu-stable@nongnu.org
19
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
20
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20220609214657.1217913-3-richard.henderson@linaro.org
21
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
22
Message-id: 20180522175629.24932-1-richard.henderson@linaro.org
23
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
12
---
26
include/exec/helper-head.h | 2 +-
13
target/arm/cpu.h | 5 +++++
27
target/arm/helper-a64.c | 35 +++++++++--------
14
target/arm/helper.c | 4 ++++
28
target/arm/helper.c | 80 +++++++++++++++++++-------------------
15
2 files changed, 9 insertions(+)
29
3 files changed, 59 insertions(+), 58 deletions(-)
30
16
31
diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
32
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
33
--- a/include/exec/helper-head.h
19
--- a/target/arm/cpu.h
34
+++ b/include/exec/helper-head.h
20
+++ b/target/arm/cpu.h
35
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_aa32_el1(const ARMISARegisters *id)
36
#define dh_ctype_int int
22
return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >= 2;
37
#define dh_ctype_i64 uint64_t
38
#define dh_ctype_s64 int64_t
39
-#define dh_ctype_f16 float16
40
+#define dh_ctype_f16 uint32_t
41
#define dh_ctype_f32 float32
42
#define dh_ctype_f64 float64
43
#define dh_ctype_ptr void *
44
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/target/arm/helper-a64.c
47
+++ b/target/arm/helper-a64.c
48
@@ -XXX,XX +XXX,XX @@ static inline uint32_t float_rel_to_flags(int res)
49
return flags;
50
}
23
}
51
24
52
-uint64_t HELPER(vfp_cmph_a64)(float16 x, float16 y, void *fp_status)
25
+static inline bool isar_feature_aa64_aa32_el2(const ARMISARegisters *id)
53
+uint64_t HELPER(vfp_cmph_a64)(uint32_t x, uint32_t y, void *fp_status)
26
+{
27
+ return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL2) >= 2;
28
+}
29
+
30
static inline bool isar_feature_aa64_ras(const ARMISARegisters *id)
54
{
31
{
55
return float_rel_to_flags(float16_compare_quiet(x, y, fp_status));
32
return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) != 0;
56
}
57
58
-uint64_t HELPER(vfp_cmpeh_a64)(float16 x, float16 y, void *fp_status)
59
+uint64_t HELPER(vfp_cmpeh_a64)(uint32_t x, uint32_t y, void *fp_status)
60
{
61
return float_rel_to_flags(float16_compare(x, y, fp_status));
62
}
63
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(neon_cgt_f64)(float64 a, float64 b, void *fpstp)
64
#define float64_three make_float64(0x4008000000000000ULL)
65
#define float64_one_point_five make_float64(0x3FF8000000000000ULL)
66
67
-float16 HELPER(recpsf_f16)(float16 a, float16 b, void *fpstp)
68
+uint32_t HELPER(recpsf_f16)(uint32_t a, uint32_t b, void *fpstp)
69
{
70
float_status *fpst = fpstp;
71
72
@@ -XXX,XX +XXX,XX @@ float64 HELPER(recpsf_f64)(float64 a, float64 b, void *fpstp)
73
return float64_muladd(a, b, float64_two, 0, fpst);
74
}
75
76
-float16 HELPER(rsqrtsf_f16)(float16 a, float16 b, void *fpstp)
77
+uint32_t HELPER(rsqrtsf_f16)(uint32_t a, uint32_t b, void *fpstp)
78
{
79
float_status *fpst = fpstp;
80
81
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(neon_addlp_u16)(uint64_t a)
82
}
83
84
/* Floating-point reciprocal exponent - see FPRecpX in ARM ARM */
85
-float16 HELPER(frecpx_f16)(float16 a, void *fpstp)
86
+uint32_t HELPER(frecpx_f16)(uint32_t a, void *fpstp)
87
{
88
float_status *fpst = fpstp;
89
uint16_t val16, sbit;
90
@@ -XXX,XX +XXX,XX @@ void HELPER(casp_be_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr,
91
#define ADVSIMD_HELPER(name, suffix) HELPER(glue(glue(advsimd_, name), suffix))
92
93
#define ADVSIMD_HALFOP(name) \
94
-float16 ADVSIMD_HELPER(name, h)(float16 a, float16 b, void *fpstp) \
95
+uint32_t ADVSIMD_HELPER(name, h)(uint32_t a, uint32_t b, void *fpstp) \
96
{ \
97
float_status *fpst = fpstp; \
98
return float16_ ## name(a, b, fpst); \
99
@@ -XXX,XX +XXX,XX @@ ADVSIMD_HALFOP(mulx)
100
ADVSIMD_TWOHALFOP(mulx)
101
102
/* fused multiply-accumulate */
103
-float16 HELPER(advsimd_muladdh)(float16 a, float16 b, float16 c, void *fpstp)
104
+uint32_t HELPER(advsimd_muladdh)(uint32_t a, uint32_t b, uint32_t c,
105
+ void *fpstp)
106
{
107
float_status *fpst = fpstp;
108
return float16_muladd(a, b, c, 0, fpst);
109
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_muladd2h)(uint32_t two_a, uint32_t two_b,
110
111
#define ADVSIMD_CMPRES(test) (test) ? 0xffff : 0
112
113
-uint32_t HELPER(advsimd_ceq_f16)(float16 a, float16 b, void *fpstp)
114
+uint32_t HELPER(advsimd_ceq_f16)(uint32_t a, uint32_t b, void *fpstp)
115
{
116
float_status *fpst = fpstp;
117
int compare = float16_compare_quiet(a, b, fpst);
118
return ADVSIMD_CMPRES(compare == float_relation_equal);
119
}
120
121
-uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp)
122
+uint32_t HELPER(advsimd_cge_f16)(uint32_t a, uint32_t b, void *fpstp)
123
{
124
float_status *fpst = fpstp;
125
int compare = float16_compare(a, b, fpst);
126
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_cge_f16)(float16 a, float16 b, void *fpstp)
127
compare == float_relation_equal);
128
}
129
130
-uint32_t HELPER(advsimd_cgt_f16)(float16 a, float16 b, void *fpstp)
131
+uint32_t HELPER(advsimd_cgt_f16)(uint32_t a, uint32_t b, void *fpstp)
132
{
133
float_status *fpst = fpstp;
134
int compare = float16_compare(a, b, fpst);
135
return ADVSIMD_CMPRES(compare == float_relation_greater);
136
}
137
138
-uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp)
139
+uint32_t HELPER(advsimd_acge_f16)(uint32_t a, uint32_t b, void *fpstp)
140
{
141
float_status *fpst = fpstp;
142
float16 f0 = float16_abs(a);
143
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_acge_f16)(float16 a, float16 b, void *fpstp)
144
compare == float_relation_equal);
145
}
146
147
-uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp)
148
+uint32_t HELPER(advsimd_acgt_f16)(uint32_t a, uint32_t b, void *fpstp)
149
{
150
float_status *fpst = fpstp;
151
float16 f0 = float16_abs(a);
152
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_acgt_f16)(float16 a, float16 b, void *fpstp)
153
}
154
155
/* round to integral */
156
-float16 HELPER(advsimd_rinth_exact)(float16 x, void *fp_status)
157
+uint32_t HELPER(advsimd_rinth_exact)(uint32_t x, void *fp_status)
158
{
159
return float16_round_to_int(x, fp_status);
160
}
161
162
-float16 HELPER(advsimd_rinth)(float16 x, void *fp_status)
163
+uint32_t HELPER(advsimd_rinth)(uint32_t x, void *fp_status)
164
{
165
int old_flags = get_float_exception_flags(fp_status), new_flags;
166
float16 ret;
167
@@ -XXX,XX +XXX,XX @@ float16 HELPER(advsimd_rinth)(float16 x, void *fp_status)
168
* setting the mode appropriately before calling the helper.
169
*/
170
171
-uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp)
172
+uint32_t HELPER(advsimd_f16tosinth)(uint32_t a, void *fpstp)
173
{
174
float_status *fpst = fpstp;
175
176
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_f16tosinth)(float16 a, void *fpstp)
177
return float16_to_int16(a, fpst);
178
}
179
180
-uint32_t HELPER(advsimd_f16touinth)(float16 a, void *fpstp)
181
+uint32_t HELPER(advsimd_f16touinth)(uint32_t a, void *fpstp)
182
{
183
float_status *fpst = fpstp;
184
185
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(advsimd_f16touinth)(float16 a, void *fpstp)
186
* Square Root and Reciprocal square root
187
*/
188
189
-float16 HELPER(sqrt_f16)(float16 a, void *fpstp)
190
+uint32_t HELPER(sqrt_f16)(uint32_t a, void *fpstp)
191
{
192
float_status *s = fpstp;
193
194
diff --git a/target/arm/helper.c b/target/arm/helper.c
33
diff --git a/target/arm/helper.c b/target/arm/helper.c
195
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
196
--- a/target/arm/helper.c
35
--- a/target/arm/helper.c
197
+++ b/target/arm/helper.c
36
+++ b/target/arm/helper.c
198
@@ -XXX,XX +XXX,XX @@ DO_VFP_cmp(d, float64)
37
@@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
199
38
value |= SCR_FW | SCR_AW; /* RES1 */
200
/* Integer to float and float to integer conversions */
39
valid_mask &= ~SCR_NET; /* RES0 */
201
40
202
-#define CONV_ITOF(name, fsz, sign) \
41
+ if (!cpu_isar_feature(aa64_aa32_el1, cpu) &&
203
- float##fsz HELPER(name)(uint32_t x, void *fpstp) \
42
+ !cpu_isar_feature(aa64_aa32_el2, cpu)) {
204
-{ \
43
+ value |= SCR_RW; /* RAO/WI */
205
- float_status *fpst = fpstp; \
44
+ }
206
- return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \
45
if (cpu_isar_feature(aa64_ras, cpu)) {
207
+#define CONV_ITOF(name, ftype, fsz, sign) \
46
valid_mask |= SCR_TERR;
208
+ftype HELPER(name)(uint32_t x, void *fpstp) \
47
}
209
+{ \
210
+ float_status *fpst = fpstp; \
211
+ return sign##int32_to_##float##fsz((sign##int32_t)x, fpst); \
212
}
213
214
-#define CONV_FTOI(name, fsz, sign, round) \
215
-uint32_t HELPER(name)(float##fsz x, void *fpstp) \
216
-{ \
217
- float_status *fpst = fpstp; \
218
- if (float##fsz##_is_any_nan(x)) { \
219
- float_raise(float_flag_invalid, fpst); \
220
- return 0; \
221
- } \
222
- return float##fsz##_to_##sign##int32##round(x, fpst); \
223
+#define CONV_FTOI(name, ftype, fsz, sign, round) \
224
+uint32_t HELPER(name)(ftype x, void *fpstp) \
225
+{ \
226
+ float_status *fpst = fpstp; \
227
+ if (float##fsz##_is_any_nan(x)) { \
228
+ float_raise(float_flag_invalid, fpst); \
229
+ return 0; \
230
+ } \
231
+ return float##fsz##_to_##sign##int32##round(x, fpst); \
232
}
233
234
-#define FLOAT_CONVS(name, p, fsz, sign) \
235
-CONV_ITOF(vfp_##name##to##p, fsz, sign) \
236
-CONV_FTOI(vfp_to##name##p, fsz, sign, ) \
237
-CONV_FTOI(vfp_to##name##z##p, fsz, sign, _round_to_zero)
238
+#define FLOAT_CONVS(name, p, ftype, fsz, sign) \
239
+ CONV_ITOF(vfp_##name##to##p, ftype, fsz, sign) \
240
+ CONV_FTOI(vfp_to##name##p, ftype, fsz, sign, ) \
241
+ CONV_FTOI(vfp_to##name##z##p, ftype, fsz, sign, _round_to_zero)
242
243
-FLOAT_CONVS(si, h, 16, )
244
-FLOAT_CONVS(si, s, 32, )
245
-FLOAT_CONVS(si, d, 64, )
246
-FLOAT_CONVS(ui, h, 16, u)
247
-FLOAT_CONVS(ui, s, 32, u)
248
-FLOAT_CONVS(ui, d, 64, u)
249
+FLOAT_CONVS(si, h, uint32_t, 16, )
250
+FLOAT_CONVS(si, s, float32, 32, )
251
+FLOAT_CONVS(si, d, float64, 64, )
252
+FLOAT_CONVS(ui, h, uint32_t, 16, u)
253
+FLOAT_CONVS(ui, s, float32, 32, u)
254
+FLOAT_CONVS(ui, d, float64, 64, u)
255
256
#undef CONV_ITOF
257
#undef CONV_FTOI
258
@@ -XXX,XX +XXX,XX @@ static float16 do_postscale_fp16(float64 f, int shift, float_status *fpst)
259
return float64_to_float16(float64_scalbn(f, -shift, fpst), true, fpst);
260
}
261
262
-float16 HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst)
263
+uint32_t HELPER(vfp_sltoh)(uint32_t x, uint32_t shift, void *fpst)
264
{
265
return do_postscale_fp16(int32_to_float64(x, fpst), shift, fpst);
266
}
267
268
-float16 HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst)
269
+uint32_t HELPER(vfp_ultoh)(uint32_t x, uint32_t shift, void *fpst)
270
{
271
return do_postscale_fp16(uint32_to_float64(x, fpst), shift, fpst);
272
}
273
274
-float16 HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst)
275
+uint32_t HELPER(vfp_sqtoh)(uint64_t x, uint32_t shift, void *fpst)
276
{
277
return do_postscale_fp16(int64_to_float64(x, fpst), shift, fpst);
278
}
279
280
-float16 HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)
281
+uint32_t HELPER(vfp_uqtoh)(uint64_t x, uint32_t shift, void *fpst)
282
{
283
return do_postscale_fp16(uint64_to_float64(x, fpst), shift, fpst);
284
}
285
@@ -XXX,XX +XXX,XX @@ static float64 do_prescale_fp16(float16 f, int shift, float_status *fpst)
286
}
287
}
288
289
-uint32_t HELPER(vfp_toshh)(float16 x, uint32_t shift, void *fpst)
290
+uint32_t HELPER(vfp_toshh)(uint32_t x, uint32_t shift, void *fpst)
291
{
292
return float64_to_int16(do_prescale_fp16(x, shift, fpst), fpst);
293
}
294
295
-uint32_t HELPER(vfp_touhh)(float16 x, uint32_t shift, void *fpst)
296
+uint32_t HELPER(vfp_touhh)(uint32_t x, uint32_t shift, void *fpst)
297
{
298
return float64_to_uint16(do_prescale_fp16(x, shift, fpst), fpst);
299
}
300
301
-uint32_t HELPER(vfp_toslh)(float16 x, uint32_t shift, void *fpst)
302
+uint32_t HELPER(vfp_toslh)(uint32_t x, uint32_t shift, void *fpst)
303
{
304
return float64_to_int32(do_prescale_fp16(x, shift, fpst), fpst);
305
}
306
307
-uint32_t HELPER(vfp_toulh)(float16 x, uint32_t shift, void *fpst)
308
+uint32_t HELPER(vfp_toulh)(uint32_t x, uint32_t shift, void *fpst)
309
{
310
return float64_to_uint32(do_prescale_fp16(x, shift, fpst), fpst);
311
}
312
313
-uint64_t HELPER(vfp_tosqh)(float16 x, uint32_t shift, void *fpst)
314
+uint64_t HELPER(vfp_tosqh)(uint32_t x, uint32_t shift, void *fpst)
315
{
316
return float64_to_int64(do_prescale_fp16(x, shift, fpst), fpst);
317
}
318
319
-uint64_t HELPER(vfp_touqh)(float16 x, uint32_t shift, void *fpst)
320
+uint64_t HELPER(vfp_touqh)(uint32_t x, uint32_t shift, void *fpst)
321
{
322
return float64_to_uint64(do_prescale_fp16(x, shift, fpst), fpst);
323
}
324
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(set_neon_rmode)(uint32_t rmode, CPUARMState *env)
325
}
326
327
/* Half precision conversions. */
328
-float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode)
329
+float32 HELPER(vfp_fcvt_f16_to_f32)(uint32_t a, void *fpstp, uint32_t ahp_mode)
330
{
331
/* Squash FZ16 to 0 for the duration of conversion. In this case,
332
* it would affect flushing input denormals.
333
@@ -XXX,XX +XXX,XX @@ float32 HELPER(vfp_fcvt_f16_to_f32)(float16 a, void *fpstp, uint32_t ahp_mode)
334
return r;
335
}
336
337
-float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode)
338
+uint32_t HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode)
339
{
340
/* Squash FZ16 to 0 for the duration of conversion. In this case,
341
* it would affect flushing output denormals.
342
@@ -XXX,XX +XXX,XX @@ float16 HELPER(vfp_fcvt_f32_to_f16)(float32 a, void *fpstp, uint32_t ahp_mode)
343
return r;
344
}
345
346
-float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode)
347
+float64 HELPER(vfp_fcvt_f16_to_f64)(uint32_t a, void *fpstp, uint32_t ahp_mode)
348
{
349
/* Squash FZ16 to 0 for the duration of conversion. In this case,
350
* it would affect flushing input denormals.
351
@@ -XXX,XX +XXX,XX @@ float64 HELPER(vfp_fcvt_f16_to_f64)(float16 a, void *fpstp, uint32_t ahp_mode)
352
return r;
353
}
354
355
-float16 HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode)
356
+uint32_t HELPER(vfp_fcvt_f64_to_f16)(float64 a, void *fpstp, uint32_t ahp_mode)
357
{
358
/* Squash FZ16 to 0 for the duration of conversion. In this case,
359
* it would affect flushing output denormals.
360
@@ -XXX,XX +XXX,XX @@ static bool round_to_inf(float_status *fpst, bool sign_bit)
361
g_assert_not_reached();
362
}
363
364
-float16 HELPER(recpe_f16)(float16 input, void *fpstp)
365
+uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp)
366
{
367
float_status *fpst = fpstp;
368
float16 f16 = float16_squash_input_denormal(input, fpst);
369
@@ -XXX,XX +XXX,XX @@ static uint64_t recip_sqrt_estimate(int *exp , int exp_off, uint64_t frac)
370
return extract64(estimate, 0, 8) << 44;
371
}
372
373
-float16 HELPER(rsqrte_f16)(float16 input, void *fpstp)
374
+uint32_t HELPER(rsqrte_f16)(uint32_t input, void *fpstp)
375
{
376
float_status *s = fpstp;
377
float16 f16 = float16_squash_input_denormal(input, s);
378
--
48
--
379
2.17.1
49
2.25.1
380
381
diff view generated by jsdifflib
1
The FRECPX instructions should (like most other floating point operations)
1
In two places in gdbstub.c we look at gdbserver_state.init to decide
2
honour the FPCR.FZ bit which specifies whether input denormals should
2
whether we're going to do a semihosting syscall via the gdb remote
3
be flushed to zero (or FZ16 for the half-precision version).
3
protocol:
4
We forgot to implement this, which doesn't affect the results (since
4
* when setting up, if the user didn't explicitly select either
5
the calculation doesn't actually care about the mantissa bits) but did
5
native semihosting or gdb semihosting, we autoselect, with the
6
mean we were failing to set the FPSR.IDC bit.
6
intended behaviour "use gdb if gdb is connected"
7
* when the semihosting layer attempts to do a syscall via gdb, we
8
silently ignore it if the gdbstub wasn't actually set up
7
9
10
However, if the user's commandline sets up the gdbstub but tells QEMU
11
to start rather than waiting for a GDB to connect (eg using '-s' but
12
not '-S'), then we will have gdbserver_state.init true but no actual
13
connection; an attempt to use gdb syscalls will then crash because we
14
try to use gdbserver_state.c_cpu when it hasn't been set up:
15
16
#0 0x00007ffff6803ba8 in qemu_cpu_kick (cpu=0x0) at ../../softmmu/cpus.c:457
17
#1 0x00007ffff6c03913 in gdb_do_syscallv (cb=0x7ffff6c19944 <common_semi_cb>,
18
fmt=0x7ffff7573b7e "", va=0x7ffff56294c0) at ../../gdbstub.c:2946
19
#2 0x00007ffff6c19c3a in common_semi_gdb_syscall (cs=0x7ffff83fe060,
20
cb=0x7ffff6c19944 <common_semi_cb>, fmt=0x7ffff7573b75 "isatty,%x")
21
at ../../semihosting/arm-compat-semi.c:494
22
#3 0x00007ffff6c1a064 in gdb_isattyfn (cs=0x7ffff83fe060, gf=0x7ffff86a3690)
23
at ../../semihosting/arm-compat-semi.c:636
24
#4 0x00007ffff6c1b20f in do_common_semihosting (cs=0x7ffff83fe060)
25
at ../../semihosting/arm-compat-semi.c:967
26
#5 0x00007ffff693a037 in handle_semihosting (cs=0x7ffff83fe060)
27
at ../../target/arm/helper.c:10316
28
29
You can probably also get into this state via some odd
30
corner cases involving connecting a GDB and then telling it
31
to detach from all the vCPUs.
32
33
Abstract out the test into a new gdb_attached() function
34
which returns true only if there's actually a GDB connected
35
to the debug stub and attached to at least one vCPU.
36
37
Reported-by: Liviu Ionescu <ilg@livius.net>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
38
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
39
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Message-id: 20180521172712.19930-1-peter.maydell@linaro.org
40
Reviewed-by: Luc Michel <luc@lmichel.fr>
41
Message-id: 20220526190053.521505-2-peter.maydell@linaro.org
11
---
42
---
12
target/arm/helper-a64.c | 6 ++++++
43
gdbstub.c | 14 +++++++++++---
13
1 file changed, 6 insertions(+)
44
1 file changed, 11 insertions(+), 3 deletions(-)
14
45
15
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
46
diff --git a/gdbstub.c b/gdbstub.c
16
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper-a64.c
48
--- a/gdbstub.c
18
+++ b/target/arm/helper-a64.c
49
+++ b/gdbstub.c
19
@@ -XXX,XX +XXX,XX @@ float16 HELPER(frecpx_f16)(float16 a, void *fpstp)
50
@@ -XXX,XX +XXX,XX @@ static int get_char(void)
20
return nan;
51
}
52
#endif
53
54
+/*
55
+ * Return true if there is a GDB currently connected to the stub
56
+ * and attached to a CPU
57
+ */
58
+static bool gdb_attached(void)
59
+{
60
+ return gdbserver_state.init && gdbserver_state.c_cpu;
61
+}
62
+
63
static enum {
64
GDB_SYS_UNKNOWN,
65
GDB_SYS_ENABLED,
66
@@ -XXX,XX +XXX,XX @@ int use_gdb_syscalls(void)
67
/* -semihosting-config target=auto */
68
/* On the first call check if gdb is connected and remember. */
69
if (gdb_syscall_mode == GDB_SYS_UNKNOWN) {
70
- gdb_syscall_mode = gdbserver_state.init ?
71
- GDB_SYS_ENABLED : GDB_SYS_DISABLED;
72
+ gdb_syscall_mode = gdb_attached() ? GDB_SYS_ENABLED : GDB_SYS_DISABLED;
21
}
73
}
22
74
return gdb_syscall_mode == GDB_SYS_ENABLED;
23
+ a = float16_squash_input_denormal(a, fpst);
75
}
24
+
76
@@ -XXX,XX +XXX,XX @@ void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va)
25
val16 = float16_val(a);
77
target_ulong addr;
26
sbit = 0x8000 & val16;
78
uint64_t i64;
27
exp = extract32(val16, 10, 5);
79
28
@@ -XXX,XX +XXX,XX @@ float32 HELPER(frecpx_f32)(float32 a, void *fpstp)
80
- if (!gdbserver_state.init) {
29
return nan;
81
+ if (!gdb_attached()) {
82
return;
30
}
83
}
31
84
32
+ a = float32_squash_input_denormal(a, fpst);
33
+
34
val32 = float32_val(a);
35
sbit = 0x80000000ULL & val32;
36
exp = extract32(val32, 23, 8);
37
@@ -XXX,XX +XXX,XX @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp)
38
return nan;
39
}
40
41
+ a = float64_squash_input_denormal(a, fpst);
42
+
43
val64 = float64_val(a);
44
sbit = 0x8000000000000000ULL & val64;
45
exp = extract64(float64_val(a), 52, 11);
46
--
85
--
47
2.17.1
86
2.25.1
48
87
49
88
diff view generated by jsdifflib
1
Add entries to MAINTAINERS to cover the newer MPS2 boards and
1
Currently we mishandle the --semihosting-config option if the
2
the new devices they use.
2
user specifies it on the command line more than once. For
3
example with:
4
--semihosting-config target=gdb --semihosting-config arg=foo,arg=bar
5
6
the function qemu_semihosting_config_options() is called twice, once
7
for each argument. But that function expects to be called only once,
8
and it always unconditionally sets the semihosting.enabled,
9
semihost_chardev and semihosting.target variables. This means that
10
if any of those options were set anywhere except the last
11
--semihosting-config option on the command line, those settings are
12
ignored. In the example above, 'target=gdb' in the first option is
13
overridden by an implied default 'target=auto' in the second.
14
15
The QemuOptsList machinery has a flag for handling this kind of
16
"option group is setting global state": by setting
17
.merge_lists = true;
18
we make the machinery merge all the --semihosting-config arguments
19
the user passes into a single set of options and call our
20
qemu_semihosting_config_options() just once.
3
21
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: 20180518153157.14899-1-peter.maydell@linaro.org
23
Reviewed-by: Luc Michel <luc@lmichel.fr>
24
Message-id: 20220526190053.521505-3-peter.maydell@linaro.org
6
---
25
---
7
MAINTAINERS | 9 +++++++--
26
semihosting/config.c | 1 +
8
1 file changed, 7 insertions(+), 2 deletions(-)
27
1 file changed, 1 insertion(+)
9
28
10
diff --git a/MAINTAINERS b/MAINTAINERS
29
diff --git a/semihosting/config.c b/semihosting/config.c
11
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
12
--- a/MAINTAINERS
31
--- a/semihosting/config.c
13
+++ b/MAINTAINERS
32
+++ b/semihosting/config.c
14
@@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c
33
@@ -XXX,XX +XXX,XX @@
15
F: include/hw/timer/cmsdk-apb-timer.h
34
16
F: hw/char/cmsdk-apb-uart.c
35
QemuOptsList qemu_semihosting_config_opts = {
17
F: include/hw/char/cmsdk-apb-uart.h
36
.name = "semihosting-config",
18
+F: hw/misc/tz-ppc.c
37
+ .merge_lists = true,
19
+F: include/hw/misc/tz-ppc.h
38
.implied_opt_name = "enable",
20
39
.head = QTAILQ_HEAD_INITIALIZER(qemu_semihosting_config_opts.head),
21
ARM cores
40
.desc = {
22
M: Peter Maydell <peter.maydell@linaro.org>
23
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
24
L: qemu-arm@nongnu.org
25
S: Maintained
26
F: hw/arm/mps2.c
27
-F: hw/misc/mps2-scc.c
28
-F: include/hw/misc/mps2-scc.h
29
+F: hw/arm/mps2-tz.c
30
+F: hw/misc/mps2-*.c
31
+F: include/hw/misc/mps2-*.h
32
+F: hw/arm/iotkit.c
33
+F: include/hw/arm/iotkit.h
34
35
Musicpal
36
M: Jan Kiszka <jan.kiszka@web.de>
37
--
41
--
38
2.17.1
42
2.25.1
39
40
diff view generated by jsdifflib