1
target-arm queue: this time around is all small fixes
1
The following changes since commit 003ba52a8b327180e284630b289c6ece5a3e08b9:
2
and changes.
3
2
4
thanks
3
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-02-16 11:16:39 +0000)
5
-- PMM
6
7
The following changes since commit fec105c2abda8567ec15230429c41429b5ee307c:
8
9
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190828-pull-request' into staging (2019-09-03 14:03:15 +0100)
10
4
11
are available in the Git repository at:
5
are available in the Git repository at:
12
6
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190903
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230216
14
8
15
for you to fetch changes up to 5e5584c89f36b302c666bc6db535fd3f7ff35ad2:
9
for you to fetch changes up to caf01d6a435d9f4a95aeae2f9fc6cb8b889b1fb8:
16
10
17
target/arm: Don't abort on M-profile exception return in linux-user mode (2019-09-03 16:20:35 +0100)
11
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG (2023-02-16 16:28:53 +0000)
18
12
19
----------------------------------------------------------------
13
----------------------------------------------------------------
20
target-arm queue:
14
target-arm queue:
21
* Revert and correctly fix refactoring of unallocated_encoding()
15
* Some mostly M-profile-related code cleanups
22
* Take exceptions on ATS instructions when needed
16
* avocado: Retire the boot_linux.py AArch64 TCG tests
23
* aspeed/timer: Provide back-pressure information for short periods
17
* hw/arm/smmuv3: Add GBPA register
24
* memory: Remove unused memory_region_iommu_replay_all()
18
* arm/virt: don't try to spell out the accelerator
25
* hw/arm/smmuv3: Log a guest error when decoding an invalid STE
19
* hw/arm: Attach PSPI module to NPCM7XX SoC
26
* hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations
20
* Some cleanup/refactoring patches aiming towards
27
* target/arm: Fix SMMLS argument order
21
allowing building Arm targets without CONFIG_TCG
28
* hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate
29
* hw/arm: Correct reference counting for creation of various objects
30
* includes: remove stale [smp|max]_cpus externs
31
* tcg/README: fix typo
32
* atomic_template: fix indentation in GEN_ATOMIC_HELPER
33
* include/exec/cpu-defs.h: fix typo
34
* target/arm: Free TCG temps in trans_VMOV_64_sp()
35
* target/arm: Don't abort on M-profile exception return in linux-user mode
36
22
37
----------------------------------------------------------------
23
----------------------------------------------------------------
38
Alex Bennée (2):
24
Alex Bennée (1):
39
includes: remove stale [smp|max]_cpus externs
25
tests/avocado: retire the Aarch64 TCG tests from boot_linux.py
40
include/exec/cpu-defs.h: fix typo
41
26
42
Andrew Jeffery (1):
27
Claudio Fontana (3):
43
aspeed/timer: Provide back-pressure information for short periods
28
target/arm: rename handle_semihosting to tcg_handle_semihosting
29
target/arm: wrap psci call with tcg_enabled
30
target/arm: wrap call to aarch64_sve_change_el in tcg_enabled()
44
31
45
Emilio G. Cota (2):
32
Cornelia Huck (1):
46
tcg/README: fix typo s/afterwise/afterwards/
33
arm/virt: don't try to spell out the accelerator
47
atomic_template: fix indentation in GEN_ATOMIC_HELPER
48
34
49
Eric Auger (3):
35
Fabiano Rosas (7):
50
memory: Remove unused memory_region_iommu_replay_all()
36
target/arm: Move PC alignment check
51
hw/arm/smmuv3: Log a guest error when decoding an invalid STE
37
target/arm: Move cpregs code out of cpu.h
52
hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations
38
tests/avocado: Skip tests that require a missing accelerator
39
tests/avocado: Tag TCG tests with accel:tcg
40
target/arm: Use "max" as default cpu for the virt machine with KVM
41
tests/qtest: arm-cpu-features: Match tests to required accelerators
42
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG
53
43
54
Peter Maydell (4):
44
Hao Wu (3):
55
target/arm: Allow ARMCPRegInfo read/write functions to throw exceptions
45
MAINTAINERS: Add myself to maintainers and remove Havard
56
target/arm: Take exceptions on ATS instructions when needed
46
hw/ssi: Add Nuvoton PSPI Module
57
target/arm: Free TCG temps in trans_VMOV_64_sp()
47
hw/arm: Attach PSPI module to NPCM7XX SoC
58
target/arm: Don't abort on M-profile exception return in linux-user mode
59
48
60
Philippe Mathieu-Daudé (6):
49
Jean-Philippe Brucker (2):
61
hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate
50
hw/arm/smmu-common: Support 64-bit addresses
62
hw/arm: Use object_initialize_child for correct reference counting
51
hw/arm/smmu-common: Fix TTB1 handling
63
hw/arm: Use sysbus_init_child_obj for correct reference counting
64
hw/arm/fsl-imx: Add the cpu as child of the SoC object
65
hw/dma/xilinx_axi: Use object_initialize_child for correct ref. counting
66
hw/net/xilinx_axi: Use object_initialize_child for correct ref. counting
67
52
68
Richard Henderson (3):
53
Mostafa Saleh (1):
69
Revert "target/arm: Use unallocated_encoding for aarch32"
54
hw/arm/smmuv3: Add GBPA register
70
target/arm: Factor out unallocated_encoding for aarch32
71
target/arm: Fix SMMLS argument order
72
55
73
accel/tcg/atomic_template.h | 2 +-
56
Philippe Mathieu-Daudé (12):
74
hw/arm/smmuv3-internal.h | 1 +
57
hw/intc/armv7m_nvic: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
75
include/exec/cpu-defs.h | 2 +-
58
target/arm: Simplify arm_v7m_mmu_idx_for_secstate() for user emulation
76
include/exec/memory.h | 10 ----
59
target/arm: Reduce arm_v7m_mmu_idx_[all/for_secstate_and_priv]() scope
77
include/sysemu/sysemu.h | 2 -
60
target/arm: Constify ID_PFR1 on user emulation
78
target/arm/cpu.h | 6 ++-
61
target/arm: Convert CPUARMState::eabi to boolean
79
target/arm/translate-a64.h | 2 +
62
target/arm: Avoid resetting CPUARMState::eabi field
80
target/arm/translate.h | 2 -
63
target/arm: Restrict CPUARMState::gicv3state to sysemu
81
hw/arm/allwinner-a10.c | 3 +-
64
target/arm: Restrict CPUARMState::arm_boot_info to sysemu
82
hw/arm/cubieboard.c | 3 +-
65
target/arm: Restrict CPUARMState::nvic to sysemu
83
hw/arm/digic.c | 3 +-
66
target/arm: Store CPUARMState::nvic as NVICState*
84
hw/arm/exynos4_boards.c | 4 +-
67
target/arm: Declare CPU <-> NVIC helpers in 'hw/intc/armv7m_nvic.h'
85
hw/arm/fsl-imx25.c | 4 +-
68
hw/arm: Add missing XLNX_ZYNQMP_ARM -> USB_DWC3 Kconfig dependency
86
hw/arm/fsl-imx31.c | 4 +-
87
hw/arm/fsl-imx6.c | 3 +-
88
hw/arm/fsl-imx6ul.c | 2 +-
89
hw/arm/mcimx7d-sabre.c | 9 ++--
90
hw/arm/mps2-tz.c | 15 +++---
91
hw/arm/musca.c | 9 ++--
92
hw/arm/smmuv3.c | 18 ++++---
93
hw/arm/xlnx-zynqmp.c | 8 +--
94
hw/dma/xilinx_axidma.c | 16 +++---
95
hw/net/xilinx_axienet.c | 17 +++----
96
hw/timer/aspeed_timer.c | 17 ++++++-
97
memory.c | 9 ----
98
target/arm/helper.c | 107 +++++++++++++++++++++++++++++++++++------
99
target/arm/translate-a64.c | 13 +++++
100
target/arm/translate-vfp.inc.c | 2 +
101
target/arm/translate.c | 50 +++++++++++++++++--
102
tcg/README | 2 +-
103
30 files changed, 244 insertions(+), 101 deletions(-)
104
69
70
MAINTAINERS | 8 +-
71
docs/system/arm/nuvoton.rst | 2 +-
72
hw/arm/smmuv3-internal.h | 7 +
73
include/hw/arm/npcm7xx.h | 2 +
74
include/hw/arm/smmu-common.h | 2 -
75
include/hw/arm/smmuv3.h | 1 +
76
include/hw/intc/armv7m_nvic.h | 128 +++++++++++++++++-
77
include/hw/ssi/npcm_pspi.h | 53 ++++++++
78
linux-user/user-internals.h | 2 +-
79
target/arm/cpregs.h | 98 ++++++++++++++
80
target/arm/cpu.h | 228 ++-------------------------------
81
target/arm/internals.h | 14 --
82
hw/arm/npcm7xx.c | 25 +++-
83
hw/arm/smmu-common.c | 4 +-
84
hw/arm/smmuv3.c | 43 ++++++-
85
hw/arm/virt.c | 10 +-
86
hw/intc/armv7m_nvic.c | 38 ++----
87
hw/ssi/npcm_pspi.c | 221 ++++++++++++++++++++++++++++++++
88
linux-user/arm/cpu_loop.c | 4 +-
89
target/arm/cpu.c | 5 +-
90
target/arm/cpu_tcg.c | 3 +
91
target/arm/helper.c | 31 +++--
92
target/arm/m_helper.c | 86 +++++++------
93
target/arm/machine.c | 18 +--
94
tests/qtest/arm-cpu-features.c | 28 ++--
95
hw/arm/Kconfig | 1 +
96
hw/ssi/meson.build | 2 +-
97
hw/ssi/trace-events | 5 +
98
tests/avocado/avocado_qemu/__init__.py | 4 +
99
tests/avocado/boot_linux.py | 48 ++-----
100
tests/avocado/boot_linux_console.py | 1 +
101
tests/avocado/machine_aarch64_virt.py | 63 ++++++++-
102
tests/avocado/reverse_debugging.py | 8 ++
103
tests/qtest/meson.build | 4 +-
104
34 files changed, 798 insertions(+), 399 deletions(-)
105
create mode 100644 include/hw/ssi/npcm_pspi.h
106
create mode 100644 hw/ssi/npcm_pspi.c
107
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Child properties form the composition tree. All objects need to be
3
Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
4
a child of another object. Objects can only be a child of one object.
4
similarly to automatic conversion from commit 8063396bf3
5
("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
5
6
6
Respect this with the i.MX SoC, to get a cleaner composition tree.
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20190823143249.8096-5-philmd@redhat.com
9
Message-id: 20230206223502.25122-2-philmd@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/arm/fsl-imx25.c | 4 +++-
12
include/hw/intc/armv7m_nvic.h | 5 +----
14
hw/arm/fsl-imx31.c | 4 +++-
13
1 file changed, 1 insertion(+), 4 deletions(-)
15
2 files changed, 6 insertions(+), 2 deletions(-)
16
14
17
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
15
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/fsl-imx25.c
17
--- a/include/hw/intc/armv7m_nvic.h
20
+++ b/hw/arm/fsl-imx25.c
18
+++ b/include/hw/intc/armv7m_nvic.h
21
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@
22
FslIMX25State *s = FSL_IMX25(obj);
20
#include "qom/object.h"
23
int i;
21
24
22
#define TYPE_NVIC "armv7m_nvic"
25
- object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm926"));
23
-
26
+ object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
24
-typedef struct NVICState NVICState;
27
+ ARM_CPU_TYPE_NAME("arm926"),
25
-DECLARE_INSTANCE_CHECKER(NVICState, NVIC,
28
+ &error_abort, NULL);
26
- TYPE_NVIC)
29
27
+OBJECT_DECLARE_SIMPLE_TYPE(NVICState, NVIC)
30
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
28
31
TYPE_IMX_AVIC);
29
/* Highest permitted number of exceptions (architectural limit) */
32
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
30
#define NVIC_MAX_VECTORS 512
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/fsl-imx31.c
35
+++ b/hw/arm/fsl-imx31.c
36
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
37
FslIMX31State *s = FSL_IMX31(obj);
38
int i;
39
40
- object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm1136"));
41
+ object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
42
+ ARM_CPU_TYPE_NAME("arm1136"),
43
+ &error_abort, NULL);
44
45
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
46
TYPE_IMX_AVIC);
47
--
31
--
48
2.20.1
32
2.34.1
49
33
50
34
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Message-id: 20230206223502.25122-3-philmd@linaro.org
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20190828165307.18321-10-alex.bennee@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
8
---
10
include/exec/cpu-defs.h | 2 +-
9
target/arm/m_helper.c | 11 ++++++++---
11
1 file changed, 1 insertion(+), 1 deletion(-)
10
1 file changed, 8 insertions(+), 3 deletions(-)
12
11
13
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
12
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
14
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
15
--- a/include/exec/cpu-defs.h
14
--- a/target/arm/m_helper.c
16
+++ b/include/exec/cpu-defs.h
15
+++ b/target/arm/m_helper.c
17
@@ -XXX,XX +XXX,XX @@ typedef struct CPUTLB { } CPUTLB;
16
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
18
#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */
17
return 0;
18
}
19
20
-#else
21
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
22
+{
23
+ return ARMMMUIdx_MUser;
24
+}
25
+
26
+#else /* !CONFIG_USER_ONLY */
19
27
20
/*
28
/*
21
- * This structure must be placed in ArchCPU immedately
29
* What kind of stack write are we doing? This affects how exceptions
22
+ * This structure must be placed in ArchCPU immediately
30
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
23
* before CPUArchState, as a field named "neg".
31
return tt_resp;
24
*/
32
}
25
typedef struct CPUNegativeOffsetState {
33
34
-#endif /* !CONFIG_USER_ONLY */
35
-
36
ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
37
bool secstate, bool priv, bool negpri)
38
{
39
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
40
41
return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
42
}
43
+
44
+#endif /* !CONFIG_USER_ONLY */
26
--
45
--
27
2.20.1
46
2.34.1
28
47
29
48
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
This reverts commit 3cb36637157088892e9e33ddb1034bffd1251d3b.
3
arm_v7m_mmu_idx_all() and arm_v7m_mmu_idx_for_secstate_and_priv()
4
are only used for system emulation in m_helper.c.
5
Move the definitions to avoid prototype forward declarations.
4
6
5
Despite the fact that the text for the call to gen_exception_insn
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
is identical for aarch64 and aarch32, the implementation inside
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
gen_exception_insn is totally different.
9
Message-id: 20230206223502.25122-4-philmd@linaro.org
8
9
This fixes exceptions raised from aarch64.
10
11
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
14
Message-id: 20190826151536.6771-2-richard.henderson@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
11
---
17
target/arm/translate-a64.h | 2 ++
12
target/arm/internals.h | 14 --------
18
target/arm/translate.h | 2 --
13
target/arm/m_helper.c | 74 +++++++++++++++++++++---------------------
19
target/arm/translate-a64.c | 7 +++++++
14
2 files changed, 37 insertions(+), 51 deletions(-)
20
target/arm/translate-vfp.inc.c | 3 ++-
21
target/arm/translate.c | 22 ++++++++++------------
22
5 files changed, 21 insertions(+), 15 deletions(-)
23
15
24
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
25
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/translate-a64.h
18
--- a/target/arm/internals.h
27
+++ b/target/arm/translate-a64.h
19
+++ b/target/arm/internals.h
28
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)
29
#ifndef TARGET_ARM_TRANSLATE_A64_H
21
30
#define TARGET_ARM_TRANSLATE_A64_H
22
int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);
31
23
32
+void unallocated_encoding(DisasContext *s);
24
-/*
25
- * Return the MMU index for a v7M CPU with all relevant information
26
- * manually specified.
27
- */
28
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
29
- bool secstate, bool priv, bool negpri);
30
-
31
-/*
32
- * Return the MMU index for a v7M CPU in the specified security and
33
- * privilege state.
34
- */
35
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
36
- bool secstate, bool priv);
37
-
38
/* Return the MMU index for a v7M CPU in the specified security state */
39
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);
40
41
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/target/arm/m_helper.c
44
+++ b/target/arm/m_helper.c
45
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
46
47
#else /* !CONFIG_USER_ONLY */
48
49
+static ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
50
+ bool secstate, bool priv, bool negpri)
51
+{
52
+ ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
33
+
53
+
34
#define unsupported_encoding(s, insn) \
54
+ if (priv) {
35
do { \
55
+ mmu_idx |= ARM_MMU_IDX_M_PRIV;
36
qemu_log_mask(LOG_UNIMP, \
56
+ }
37
diff --git a/target/arm/translate.h b/target/arm/translate.h
57
+
38
index XXXXXXX..XXXXXXX 100644
58
+ if (negpri) {
39
--- a/target/arm/translate.h
59
+ mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
40
+++ b/target/arm/translate.h
60
+ }
41
@@ -XXX,XX +XXX,XX @@ typedef struct DisasCompare {
61
+
42
bool value_global;
62
+ if (secstate) {
43
} DisasCompare;
63
+ mmu_idx |= ARM_MMU_IDX_M_S;
44
64
+ }
45
-void unallocated_encoding(DisasContext *s);
65
+
46
-
66
+ return mmu_idx;
47
/* Share the TCG temporaries common between 32 and 64 bit modes. */
48
extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF;
49
extern TCGv_i64 cpu_exclusive_addr;
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 inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
55
}
56
}
57
58
+void unallocated_encoding(DisasContext *s)
59
+{
60
+ /* Unallocated and reserved encodings are uncategorized */
61
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
62
+ default_exception_el(s));
63
+}
67
+}
64
+
68
+
65
static void init_tmp_a64_array(DisasContext *s)
69
+static ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
66
{
70
+ bool secstate, bool priv)
67
#ifdef CONFIG_DEBUG_TCG
71
+{
68
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
72
+ bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
69
index XXXXXXX..XXXXXXX 100644
73
+
70
--- a/target/arm/translate-vfp.inc.c
74
+ return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
71
+++ b/target/arm/translate-vfp.inc.c
75
+}
72
@@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
76
+
73
77
+/* Return the MMU index for a v7M CPU in the specified security state */
74
if (!s->vfp_enabled && !ignore_vfp_enabled) {
78
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
75
assert(!arm_dc_feature(s, ARM_FEATURE_M));
79
+{
76
- unallocated_encoding(s);
80
+ bool priv = arm_v7m_is_handler_mode(env) ||
77
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
81
+ !(env->v7m.control[secstate] & 1);
78
+ default_exception_el(s));
82
+
79
return false;
83
+ return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
80
}
84
+}
81
85
+
82
diff --git a/target/arm/translate.c b/target/arm/translate.c
86
/*
83
index XXXXXXX..XXXXXXX 100644
87
* What kind of stack write are we doing? This affects how exceptions
84
--- a/target/arm/translate.c
88
* generated during the stacking are treated.
85
+++ b/target/arm/translate.c
89
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
86
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
90
return tt_resp;
87
s->base.is_jmp = DISAS_NORETURN;
88
}
91
}
89
92
90
-void unallocated_encoding(DisasContext *s)
93
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
94
- bool secstate, bool priv, bool negpri)
91
-{
95
-{
92
- /* Unallocated and reserved encodings are uncategorized */
96
- ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
93
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
97
-
94
- default_exception_el(s));
98
- if (priv) {
99
- mmu_idx |= ARM_MMU_IDX_M_PRIV;
100
- }
101
-
102
- if (negpri) {
103
- mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
104
- }
105
-
106
- if (secstate) {
107
- mmu_idx |= ARM_MMU_IDX_M_S;
108
- }
109
-
110
- return mmu_idx;
95
-}
111
-}
96
-
112
-
97
/* Force a TB lookup after an instruction that changes the CPU state. */
113
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
98
static inline void gen_lookup_tb(DisasContext *s)
114
- bool secstate, bool priv)
99
{
115
-{
100
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
116
- bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
101
return;
117
-
102
}
118
- return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
103
119
-}
104
- unallocated_encoding(s);
120
-
105
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
121
-/* Return the MMU index for a v7M CPU in the specified security state */
106
+ default_exception_el(s));
122
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
107
}
123
-{
108
124
- bool priv = arm_v7m_is_handler_mode(env) ||
109
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn,
125
- !(env->v7m.control[secstate] & 1);
110
@@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s,
126
-
111
}
127
- return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
112
128
-}
113
if (undef) {
129
-
114
- unallocated_encoding(s);
130
#endif /* !CONFIG_USER_ONLY */
115
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
116
+ default_exception_el(s));
117
return;
118
}
119
120
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
121
break;
122
default:
123
illegal_op:
124
- unallocated_encoding(s);
125
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
126
+ default_exception_el(s));
127
break;
128
}
129
}
130
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
131
}
132
return;
133
illegal_op:
134
- unallocated_encoding(s);
135
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
136
+ default_exception_el(s));
137
}
138
139
static void disas_thumb_insn(DisasContext *s, uint32_t insn)
140
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
141
return;
142
illegal_op:
143
undef:
144
- unallocated_encoding(s);
145
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
146
+ default_exception_el(s));
147
}
148
149
static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
150
--
131
--
151
2.20.1
132
2.34.1
152
133
153
134
diff view generated by jsdifflib
1
From: Eric Auger <eric.auger@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
memory_region_iommu_replay_all is not used. Remove it.
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Eric Auger <eric.auger@redhat.com>
5
Message-id: 20230206223502.25122-5-philmd@linaro.org
6
Reported-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Peter Xu <peterx@redhat.com>
9
Message-id: 20190822172350.12008-2-eric.auger@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
7
---
12
include/exec/memory.h | 10 ----------
8
target/arm/helper.c | 12 ++++++++++--
13
memory.c | 9 ---------
9
1 file changed, 10 insertions(+), 2 deletions(-)
14
2 files changed, 19 deletions(-)
15
10
16
diff --git a/include/exec/memory.h b/include/exec/memory.h
11
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
18
--- a/include/exec/memory.h
13
--- a/target/arm/helper.c
19
+++ b/include/exec/memory.h
14
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr,
15
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
21
*/
22
void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n);
23
24
-/**
25
- * memory_region_iommu_replay_all: replay existing IOMMU translations
26
- * to all the notifiers registered.
27
- *
28
- * Note: this is not related to record-and-replay functionality.
29
- *
30
- * @iommu_mr: the memory region to observe
31
- */
32
-void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr);
33
-
34
/**
35
* memory_region_unregister_iommu_notifier: unregister a notifier for
36
* changes to IOMMU translation entries.
37
diff --git a/memory.c b/memory.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/memory.c
40
+++ b/memory.c
41
@@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)
42
}
16
}
43
}
17
}
44
18
45
-void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr)
19
+#ifndef CONFIG_USER_ONLY
46
-{
20
/*
47
- IOMMUNotifier *notifier;
21
* We don't know until after realize whether there's a GICv3
48
-
22
* attached, and that is what registers the gicv3 sysregs.
49
- IOMMU_NOTIFIER_FOREACH(notifier, iommu_mr) {
23
@@ -XXX,XX +XXX,XX @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
50
- memory_region_iommu_replay(iommu_mr, notifier);
24
return pfr1;
51
- }
25
}
52
-}
26
53
-
27
-#ifndef CONFIG_USER_ONLY
54
void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
28
static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
55
IOMMUNotifier *n)
56
{
29
{
30
ARMCPU *cpu = env_archcpu(env);
31
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
32
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1,
33
.access = PL1_R, .type = ARM_CP_NO_RAW,
34
.accessfn = access_aa32_tid3,
35
+#ifdef CONFIG_USER_ONLY
36
+ .type = ARM_CP_CONST,
37
+ .resetvalue = cpu->isar.id_pfr1,
38
+#else
39
+ .type = ARM_CP_NO_RAW,
40
+ .accessfn = access_aa32_tid3,
41
.readfn = id_pfr1_read,
42
- .writefn = arm_cp_write_ignore },
43
+ .writefn = arm_cp_write_ignore
44
+#endif
45
+ },
46
{ .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH,
47
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
48
.access = PL1_R, .type = ARM_CP_CONST,
57
--
49
--
58
2.20.1
50
2.34.1
59
51
60
52
diff view generated by jsdifflib
1
From: "Emilio G. Cota" <cota@braap.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Afterwise is "wise after the fact", as in "hindsight".
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
4
Here we meant "afterwards" (as in "subsequently"). Fix it.
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Emilio G. Cota <cota@braap.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6
Message-id: 20230206223502.25122-6-philmd@linaro.org
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20190828165307.18321-7-alex.bennee@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
8
---
14
tcg/README | 2 +-
9
linux-user/user-internals.h | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
10
target/arm/cpu.h | 2 +-
11
linux-user/arm/cpu_loop.c | 4 ++--
12
3 files changed, 4 insertions(+), 4 deletions(-)
16
13
17
diff --git a/tcg/README b/tcg/README
14
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/tcg/README
16
--- a/linux-user/user-internals.h
20
+++ b/tcg/README
17
+++ b/linux-user/user-internals.h
21
@@ -XXX,XX +XXX,XX @@ This can be overridden using the following function modifiers:
18
@@ -XXX,XX +XXX,XX @@ void print_termios(void *arg);
22
canonical locations before calling the helper.
19
#ifdef TARGET_ARM
23
- TCG_CALL_NO_WRITE_GLOBALS means that the helper does not modify any globals.
20
static inline int regpairs_aligned(CPUArchState *cpu_env, int num)
24
They will only be saved to their canonical location before calling helpers,
21
{
25
- but they won't be reloaded afterwise.
22
- return cpu_env->eabi == 1;
26
+ but they won't be reloaded afterwards.
23
+ return cpu_env->eabi;
27
- TCG_CALL_NO_SIDE_EFFECTS means that the call to the function is removed if
24
}
28
the return value is not used.
25
#elif defined(TARGET_MIPS) && defined(TARGET_ABI_MIPSO32)
26
static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; }
27
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/cpu.h
30
+++ b/target/arm/cpu.h
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
32
33
#if defined(CONFIG_USER_ONLY)
34
/* For usermode syscall translation. */
35
- int eabi;
36
+ bool eabi;
37
#endif
38
39
struct CPUBreakpoint *cpu_breakpoint[16];
40
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/linux-user/arm/cpu_loop.c
43
+++ b/linux-user/arm/cpu_loop.c
44
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
45
break;
46
case EXCP_SWI:
47
{
48
- env->eabi = 1;
49
+ env->eabi = true;
50
/* system call */
51
if (env->thumb) {
52
/* Thumb is always EABI style with syscall number in r7 */
53
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
54
* > 0xfffff and are handled below as out-of-range.
55
*/
56
n ^= ARM_SYSCALL_BASE;
57
- env->eabi = 0;
58
+ env->eabi = false;
59
}
60
}
29
61
30
--
62
--
31
2.20.1
63
2.34.1
32
64
33
65
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
As explained in commit aff39be0ed97:
3
Although the 'eabi' field is only used in user emulation where
4
CPU reset doesn't occur, it doesn't belong to the area to reset.
5
Move it after the 'end_reset_fields' for consistency.
4
6
5
Both functions, object_initialize() and object_property_add_child()
6
increase the reference counter of the new object, so one of the
7
references has to be dropped afterwards to get the reference
8
counting right. Otherwise the child object will not be properly
9
cleaned up when the parent gets destroyed.
10
Thus let's use now object_initialize_child() instead to get the
11
reference counting here right.
12
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20190823143249.8096-7-philmd@redhat.com
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Message-id: 20230206223502.25122-7-philmd@linaro.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
11
---
20
hw/net/xilinx_axienet.c | 17 ++++++++---------
12
target/arm/cpu.h | 9 ++++-----
21
1 file changed, 8 insertions(+), 9 deletions(-)
13
1 file changed, 4 insertions(+), 5 deletions(-)
22
14
23
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/net/xilinx_axienet.c
17
--- a/target/arm/cpu.h
26
+++ b/hw/net/xilinx_axienet.c
18
+++ b/target/arm/cpu.h
27
@@ -XXX,XX +XXX,XX @@ static void xilinx_enet_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
28
XilinxAXIEnet *s = XILINX_AXI_ENET(obj);
20
ARMVectorReg zarray[ARM_MAX_VQ * 16];
29
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
21
#endif
30
22
31
- object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),
23
-#if defined(CONFIG_USER_ONLY)
32
- TYPE_XILINX_AXI_ENET_DATA_STREAM);
24
- /* For usermode syscall translation. */
33
- object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),
25
- bool eabi;
34
- TYPE_XILINX_AXI_ENET_CONTROL_STREAM);
26
-#endif
35
- object_property_add_child(OBJECT(s), "axistream-connected-target",
36
- (Object *)&s->rx_data_dev, &error_abort);
37
- object_property_add_child(OBJECT(s), "axistream-control-connected-target",
38
- (Object *)&s->rx_control_dev, &error_abort);
39
-
27
-
40
+ object_initialize_child(OBJECT(s), "axistream-connected-target",
28
struct CPUBreakpoint *cpu_breakpoint[16];
41
+ &s->rx_data_dev, sizeof(s->rx_data_dev),
29
struct CPUWatchpoint *cpu_watchpoint[16];
42
+ TYPE_XILINX_AXI_ENET_DATA_STREAM, &error_abort,
30
43
+ NULL);
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
44
+ object_initialize_child(OBJECT(s), "axistream-control-connected-target",
32
const struct arm_boot_info *boot_info;
45
+ &s->rx_control_dev, sizeof(s->rx_control_dev),
33
/* Store GICv3CPUState to access from this struct */
46
+ TYPE_XILINX_AXI_ENET_CONTROL_STREAM, &error_abort,
34
void *gicv3state;
47
+ NULL);
35
+#if defined(CONFIG_USER_ONLY)
48
sysbus_init_irq(sbd, &s->irq);
36
+ /* For usermode syscall translation. */
49
37
+ bool eabi;
50
memory_region_init_io(&s->iomem, OBJECT(s), &enet_ops, s, "enet", 0x40000);
38
+#endif /* CONFIG_USER_ONLY */
39
40
#ifdef TARGET_TAGGED_ADDRESSES
41
/* Linux syscall tagged address support */
51
--
42
--
52
2.20.1
43
2.34.1
53
44
54
45
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
As explained in commit aff39be0ed97:
4
5
Both functions, object_initialize() and object_property_add_child()
6
increase the reference counter of the new object, so one of the
7
references has to be dropped afterwards to get the reference
8
counting right. Otherwise the child object will not be properly
9
cleaned up when the parent gets destroyed.
10
Thus let's use now object_initialize_child() instead to get the
11
reference counting here right.
12
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20190823143249.8096-6-philmd@redhat.com
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Message-id: 20230206223502.25122-8-philmd@linaro.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
7
---
20
hw/dma/xilinx_axidma.c | 16 ++++++++--------
8
target/arm/cpu.h | 3 ++-
21
1 file changed, 8 insertions(+), 8 deletions(-)
9
1 file changed, 2 insertions(+), 1 deletion(-)
22
10
23
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/dma/xilinx_axidma.c
13
--- a/target/arm/cpu.h
26
+++ b/hw/dma/xilinx_axidma.c
14
+++ b/target/arm/cpu.h
27
@@ -XXX,XX +XXX,XX @@ static void xilinx_axidma_init(Object *obj)
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
28
XilinxAXIDMA *s = XILINX_AXI_DMA(obj);
16
29
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
17
void *nvic;
30
18
const struct arm_boot_info *boot_info;
31
- object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),
19
+#if !defined(CONFIG_USER_ONLY)
32
- TYPE_XILINX_AXI_DMA_DATA_STREAM);
20
/* Store GICv3CPUState to access from this struct */
33
- object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),
21
void *gicv3state;
34
- TYPE_XILINX_AXI_DMA_CONTROL_STREAM);
22
-#if defined(CONFIG_USER_ONLY)
35
- object_property_add_child(OBJECT(s), "axistream-connected-target",
23
+#else /* CONFIG_USER_ONLY */
36
- (Object *)&s->rx_data_dev, &error_abort);
24
/* For usermode syscall translation. */
37
- object_property_add_child(OBJECT(s), "axistream-control-connected-target",
25
bool eabi;
38
- (Object *)&s->rx_control_dev, &error_abort);
26
#endif /* CONFIG_USER_ONLY */
39
+ object_initialize_child(OBJECT(s), "axistream-connected-target",
40
+ &s->rx_data_dev, sizeof(s->rx_data_dev),
41
+ TYPE_XILINX_AXI_DMA_DATA_STREAM, &error_abort,
42
+ NULL);
43
+ object_initialize_child(OBJECT(s), "axistream-control-connected-target",
44
+ &s->rx_control_dev, sizeof(s->rx_control_dev),
45
+ TYPE_XILINX_AXI_DMA_CONTROL_STREAM, &error_abort,
46
+ NULL);
47
48
sysbus_init_irq(sbd, &s->streams[0].irq);
49
sysbus_init_irq(sbd, &s->streams[1].irq);
50
--
27
--
51
2.20.1
28
2.34.1
52
29
53
30
diff view generated by jsdifflib
1
From: "Emilio G. Cota" <cota@braap.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
4
Signed-off-by: Emilio G. Cota <cota@braap.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Message-id: 20230206223502.25122-9-philmd@linaro.org
8
Message-id: 20190828165307.18321-8-alex.bennee@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
7
---
11
accel/tcg/atomic_template.h | 2 +-
8
target/arm/cpu.h | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
9
1 file changed, 1 insertion(+), 1 deletion(-)
13
10
14
diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/accel/tcg/atomic_template.h
13
--- a/target/arm/cpu.h
17
+++ b/accel/tcg/atomic_template.h
14
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr,
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
19
16
} sau;
20
#define GEN_ATOMIC_HELPER(X) \
17
21
ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
18
void *nvic;
22
- ABI_TYPE val EXTRA_ARGS) \
19
- const struct arm_boot_info *boot_info;
23
+ ABI_TYPE val EXTRA_ARGS) \
20
#if !defined(CONFIG_USER_ONLY)
24
{ \
21
+ const struct arm_boot_info *boot_info;
25
ATOMIC_MMU_DECLS; \
22
/* Store GICv3CPUState to access from this struct */
26
DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \
23
void *gicv3state;
24
#else /* CONFIG_USER_ONLY */
27
--
25
--
28
2.20.1
26
2.34.1
29
27
30
28
diff view generated by jsdifflib
1
Currently the only part of an ARMCPRegInfo which is allowed to cause
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
a CPU exception is the access function, which returns a value indicating
3
that some flavour of UNDEF should be generated.
4
2
5
For the ATS system instructions, we would like to conditionally
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
generate exceptions as part of the writefn, because some faults
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
during the page table walk (like external aborts) should cause
5
Message-id: 20230206223502.25122-10-philmd@linaro.org
8
an exception to be raised rather than returning a value.
9
10
There are several ways we could do this:
11
* plumb the GETPC() value from the top level set_cp_reg/get_cp_reg
12
helper functions through into the readfn and writefn hooks
13
* add extra readfn_with_ra/writefn_with_ra hooks that take the GETPC()
14
value
15
* require the ATS instructions to provide a dummy accessfn,
16
which serves no purpose except to cause the code generation
17
to emit TCG ops to sync the CPU state
18
* add an ARM_CP_ flag to mark the ARMCPRegInfo as possibly
19
throwing an exception in its read/write hooks, and make the
20
codegen sync the CPU state before calling the hooks if the
21
flag is set
22
23
This patch opts for the last of these, as it is fairly simple
24
to implement and doesn't require invasive changes like updating
25
the readfn/writefn hook function prototype signature.
26
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
30
Message-id: 20190816125802.25877-2-peter.maydell@linaro.org
31
---
7
---
32
target/arm/cpu.h | 6 +++++-
8
target/arm/cpu.h | 2 +-
33
target/arm/translate-a64.c | 6 ++++++
9
1 file changed, 1 insertion(+), 1 deletion(-)
34
target/arm/translate.c | 7 +++++++
35
3 files changed, 18 insertions(+), 1 deletion(-)
36
10
37
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
38
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/cpu.h
13
--- a/target/arm/cpu.h
40
+++ b/target/arm/cpu.h
14
+++ b/target/arm/cpu.h
41
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
42
* IO indicates that this register does I/O and therefore its accesses
16
uint32_t ctrl;
43
* need to be surrounded by gen_io_start()/gen_io_end(). In particular,
17
} sau;
44
* registers which implement clocks or timers require this.
18
45
+ * RAISES_EXC is for when the read or write hook might raise an exception;
19
- void *nvic;
46
+ * the generated code will synchronize the CPU state before calling the hook
20
#if !defined(CONFIG_USER_ONLY)
47
+ * so that it is safe for the hook to call raise_exception().
21
+ void *nvic;
48
*/
22
const struct arm_boot_info *boot_info;
49
#define ARM_CP_SPECIAL 0x0001
23
/* Store GICv3CPUState to access from this struct */
50
#define ARM_CP_CONST 0x0002
24
void *gicv3state;
51
@@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
52
#define ARM_CP_FPU 0x1000
53
#define ARM_CP_SVE 0x2000
54
#define ARM_CP_NO_GDB 0x4000
55
+#define ARM_CP_RAISES_EXC 0x8000
56
/* Used only as a terminator for ARMCPRegInfo lists */
57
#define ARM_CP_SENTINEL 0xffff
58
/* Mask of only the flag bits in a type field */
59
-#define ARM_CP_FLAG_MASK 0x70ff
60
+#define ARM_CP_FLAG_MASK 0xf0ff
61
62
/* Valid values for ARMCPRegInfo state field, indicating which of
63
* the AArch32 and AArch64 execution states this register is visible in.
64
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/translate-a64.c
67
+++ b/target/arm/translate-a64.c
68
@@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
69
tcg_temp_free_ptr(tmpptr);
70
tcg_temp_free_i32(tcg_syn);
71
tcg_temp_free_i32(tcg_isread);
72
+ } else if (ri->type & ARM_CP_RAISES_EXC) {
73
+ /*
74
+ * The readfn or writefn might raise an exception;
75
+ * synchronize the CPU state in case it does.
76
+ */
77
+ gen_a64_set_pc_im(s->pc_curr);
78
}
79
80
/* Handle special cases first */
81
diff --git a/target/arm/translate.c b/target/arm/translate.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/translate.c
84
+++ b/target/arm/translate.c
85
@@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn)
86
tcg_temp_free_ptr(tmpptr);
87
tcg_temp_free_i32(tcg_syn);
88
tcg_temp_free_i32(tcg_isread);
89
+ } else if (ri->type & ARM_CP_RAISES_EXC) {
90
+ /*
91
+ * The readfn or writefn might raise an exception;
92
+ * synchronize the CPU state in case it does.
93
+ */
94
+ gen_set_condexec(s);
95
+ gen_set_pc_im(s, s->pc_curr);
96
}
97
98
/* Handle special cases first */
99
--
25
--
100
2.20.1
26
2.34.1
101
27
102
28
diff view generated by jsdifflib
New patch
1
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
3
There is no point in using a void pointer to access the NVIC.
4
Use the real type to avoid casting it while debugging.
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20230206223502.25122-11-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 46 ++++++++++++++++++++++---------------------
12
hw/intc/armv7m_nvic.c | 38 ++++++++++++-----------------------
13
target/arm/cpu.c | 1 +
14
target/arm/m_helper.c | 2 +-
15
4 files changed, 39 insertions(+), 48 deletions(-)
16
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMTBFlags {
22
23
typedef struct ARMMMUFaultInfo ARMMMUFaultInfo;
24
25
+typedef struct NVICState NVICState;
26
+
27
typedef struct CPUArchState {
28
/* Regs for current mode. */
29
uint32_t regs[16];
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
31
} sau;
32
33
#if !defined(CONFIG_USER_ONLY)
34
- void *nvic;
35
+ NVICState *nvic;
36
const struct arm_boot_info *boot_info;
37
/* Store GICv3CPUState to access from this struct */
38
void *gicv3state;
39
@@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
40
41
/* Interface between CPU and Interrupt controller. */
42
#ifndef CONFIG_USER_ONLY
43
-bool armv7m_nvic_can_take_pending_exception(void *opaque);
44
+bool armv7m_nvic_can_take_pending_exception(NVICState *s);
45
#else
46
-static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
47
+static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
48
{
49
return true;
50
}
51
#endif
52
/**
53
* armv7m_nvic_set_pending: mark the specified exception as pending
54
- * @opaque: the NVIC
55
+ * @s: the NVIC
56
* @irq: the exception number to mark pending
57
* @secure: false for non-banked exceptions or for the nonsecure
58
* version of a banked exception, true for the secure version of a banked
59
@@ -XXX,XX +XXX,XX @@ static inline bool armv7m_nvic_can_take_pending_exception(void *opaque)
60
* if @secure is true and @irq does not specify one of the fixed set
61
* of architecturally banked exceptions.
62
*/
63
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure);
64
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
65
/**
66
* armv7m_nvic_set_pending_derived: mark this derived exception as pending
67
- * @opaque: the NVIC
68
+ * @s: the NVIC
69
* @irq: the exception number to mark pending
70
* @secure: false for non-banked exceptions or for the nonsecure
71
* version of a banked exception, true for the secure version of a banked
72
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure);
73
* exceptions (exceptions generated in the course of trying to take
74
* a different exception).
75
*/
76
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure);
77
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
78
/**
79
* armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
80
- * @opaque: the NVIC
81
+ * @s: the NVIC
82
* @irq: the exception number to mark pending
83
* @secure: false for non-banked exceptions or for the nonsecure
84
* version of a banked exception, true for the secure version of a banked
85
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure);
86
* Similar to armv7m_nvic_set_pending(), but specifically for exceptions
87
* generated in the course of lazy stacking of FP registers.
88
*/
89
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure);
90
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
91
/**
92
* armv7m_nvic_get_pending_irq_info: return highest priority pending
93
* exception, and whether it targets Secure state
94
- * @opaque: the NVIC
95
+ * @s: the NVIC
96
* @pirq: set to pending exception number
97
* @ptargets_secure: set to whether pending exception targets Secure
98
*
99
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure);
100
* to true if the current highest priority pending exception should
101
* be taken to Secure state, false for NS.
102
*/
103
-void armv7m_nvic_get_pending_irq_info(void *opaque, int *pirq,
104
+void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
105
bool *ptargets_secure);
106
/**
107
* armv7m_nvic_acknowledge_irq: make highest priority pending exception active
108
- * @opaque: the NVIC
109
+ * @s: the NVIC
110
*
111
* Move the current highest priority pending exception from the pending
112
* state to the active state, and update v7m.exception to indicate that
113
* it is the exception currently being handled.
114
*/
115
-void armv7m_nvic_acknowledge_irq(void *opaque);
116
+void armv7m_nvic_acknowledge_irq(NVICState *s);
117
/**
118
* armv7m_nvic_complete_irq: complete specified interrupt or exception
119
- * @opaque: the NVIC
120
+ * @s: the NVIC
121
* @irq: the exception number to complete
122
* @secure: true if this exception was secure
123
*
124
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque);
125
* 0 if there is still an irq active after this one was completed
126
* (Ignoring -1, this is the same as the RETTOBASE value before completion.)
127
*/
128
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure);
129
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
130
/**
131
* armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
132
- * @opaque: the NVIC
133
+ * @s: the NVIC
134
* @irq: the exception number to mark pending
135
* @secure: false for non-banked exceptions or for the nonsecure
136
* version of a banked exception, true for the secure version of a banked
137
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure);
138
* interrupt the current execution priority. This controls whether the
139
* RDY bit for it in the FPCCR is set.
140
*/
141
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure);
142
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
143
/**
144
* armv7m_nvic_raw_execution_priority: return the raw execution priority
145
- * @opaque: the NVIC
146
+ * @s: the NVIC
147
*
148
* Returns: the raw execution priority as defined by the v8M architecture.
149
* This is the execution priority minus the effects of AIRCR.PRIS,
150
* and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
151
* (v8M ARM ARM I_PKLD.)
152
*/
153
-int armv7m_nvic_raw_execution_priority(void *opaque);
154
+int armv7m_nvic_raw_execution_priority(NVICState *s);
155
/**
156
* armv7m_nvic_neg_prio_requested: return true if the requested execution
157
* priority is negative for the specified security state.
158
- * @opaque: the NVIC
159
+ * @s: the NVIC
160
* @secure: the security state to test
161
* This corresponds to the pseudocode IsReqExecPriNeg().
162
*/
163
#ifndef CONFIG_USER_ONLY
164
-bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure);
165
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
166
#else
167
-static inline bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
168
+static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
169
{
170
return false;
171
}
172
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
173
index XXXXXXX..XXXXXXX 100644
174
--- a/hw/intc/armv7m_nvic.c
175
+++ b/hw/intc/armv7m_nvic.c
176
@@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s)
177
return MIN(running, s->exception_prio);
178
}
179
180
-bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
181
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
182
{
183
/* Return true if the requested execution priority is negative
184
* for the specified security state, ie that security state
185
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
186
* mean we don't allow FAULTMASK_NS to actually make the execution
187
* priority negative). Compare pseudocode IsReqExcPriNeg().
188
*/
189
- NVICState *s = opaque;
190
-
191
if (s->cpu->env.v7m.faultmask[secure]) {
192
return true;
193
}
194
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
195
return false;
196
}
197
198
-bool armv7m_nvic_can_take_pending_exception(void *opaque)
199
+bool armv7m_nvic_can_take_pending_exception(NVICState *s)
200
{
201
- NVICState *s = opaque;
202
-
203
return nvic_exec_prio(s) > nvic_pending_prio(s);
204
}
205
206
-int armv7m_nvic_raw_execution_priority(void *opaque)
207
+int armv7m_nvic_raw_execution_priority(NVICState *s)
208
{
209
- NVICState *s = opaque;
210
-
211
return s->exception_prio;
212
}
213
214
@@ -XXX,XX +XXX,XX @@ static void nvic_irq_update(NVICState *s)
215
* if @secure is true and @irq does not specify one of the fixed set
216
* of architecturally banked exceptions.
217
*/
218
-static void armv7m_nvic_clear_pending(void *opaque, int irq, bool secure)
219
+static void armv7m_nvic_clear_pending(NVICState *s, int irq, bool secure)
220
{
221
- NVICState *s = (NVICState *)opaque;
222
VecInfo *vec;
223
224
assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq);
225
@@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
226
}
227
}
228
229
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
230
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure)
231
{
232
- do_armv7m_nvic_set_pending(opaque, irq, secure, false);
233
+ do_armv7m_nvic_set_pending(s, irq, secure, false);
234
}
235
236
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure)
237
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure)
238
{
239
- do_armv7m_nvic_set_pending(opaque, irq, secure, true);
240
+ do_armv7m_nvic_set_pending(s, irq, secure, true);
241
}
242
243
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
244
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure)
245
{
246
/*
247
* Pend an exception during lazy FP stacking. This differs
248
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
249
* whether we should escalate depends on the saved context
250
* in the FPCCR register, not on the current state of the CPU/NVIC.
251
*/
252
- NVICState *s = (NVICState *)opaque;
253
bool banked = exc_is_banked(irq);
254
VecInfo *vec;
255
bool targets_secure;
256
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
257
}
258
259
/* Make pending IRQ active. */
260
-void armv7m_nvic_acknowledge_irq(void *opaque)
261
+void armv7m_nvic_acknowledge_irq(NVICState *s)
262
{
263
- NVICState *s = (NVICState *)opaque;
264
CPUARMState *env = &s->cpu->env;
265
const int pending = s->vectpending;
266
const int running = nvic_exec_prio(s);
267
@@ -XXX,XX +XXX,XX @@ static bool vectpending_targets_secure(NVICState *s)
268
exc_targets_secure(s, s->vectpending);
269
}
270
271
-void armv7m_nvic_get_pending_irq_info(void *opaque,
272
+void armv7m_nvic_get_pending_irq_info(NVICState *s,
273
int *pirq, bool *ptargets_secure)
274
{
275
- NVICState *s = (NVICState *)opaque;
276
const int pending = s->vectpending;
277
bool targets_secure;
278
279
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque,
280
*pirq = pending;
281
}
282
283
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
284
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure)
285
{
286
- NVICState *s = (NVICState *)opaque;
287
VecInfo *vec = NULL;
288
int ret = 0;
289
290
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
291
return ret;
292
}
293
294
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
295
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure)
296
{
297
/*
298
* Return whether an exception is "ready", i.e. it is enabled and is
299
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
300
* for non-banked exceptions secure is always false; for banked exceptions
301
* it indicates which of the exceptions is required.
302
*/
303
- NVICState *s = (NVICState *)opaque;
304
bool banked = exc_is_banked(irq);
305
VecInfo *vec;
306
int running = nvic_exec_prio(s);
307
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
308
index XXXXXXX..XXXXXXX 100644
309
--- a/target/arm/cpu.c
310
+++ b/target/arm/cpu.c
311
@@ -XXX,XX +XXX,XX @@
312
#if !defined(CONFIG_USER_ONLY)
313
#include "hw/loader.h"
314
#include "hw/boards.h"
315
+#include "hw/intc/armv7m_nvic.h"
316
#endif
317
#include "sysemu/tcg.h"
318
#include "sysemu/qtest.h"
319
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
320
index XXXXXXX..XXXXXXX 100644
321
--- a/target/arm/m_helper.c
322
+++ b/target/arm/m_helper.c
323
@@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr,
324
* that we will need later in order to do lazy FP reg stacking.
325
*/
326
bool is_secure = env->v7m.secure;
327
- void *nvic = env->nvic;
328
+ NVICState *nvic = env->nvic;
329
/*
330
* Some bits are unbanked and live always in fpccr[M_REG_S]; some bits
331
* are banked and we want to update the bit in the bank for the
332
--
333
2.34.1
334
335
diff view generated by jsdifflib
New patch
1
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
3
While dozens of files include "cpu.h", only 3 files require
4
these NVIC helper declarations.
5
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Message-id: 20230206223502.25122-12-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
include/hw/intc/armv7m_nvic.h | 123 ++++++++++++++++++++++++++++++++++
12
target/arm/cpu.h | 123 ----------------------------------
13
target/arm/cpu.c | 4 +-
14
target/arm/cpu_tcg.c | 3 +
15
target/arm/m_helper.c | 3 +
16
5 files changed, 132 insertions(+), 124 deletions(-)
17
18
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/intc/armv7m_nvic.h
21
+++ b/include/hw/intc/armv7m_nvic.h
22
@@ -XXX,XX +XXX,XX @@ struct NVICState {
23
qemu_irq sysresetreq;
24
};
25
26
+/* Interface between CPU and Interrupt controller. */
27
+/**
28
+ * armv7m_nvic_set_pending: mark the specified exception as pending
29
+ * @s: the NVIC
30
+ * @irq: the exception number to mark pending
31
+ * @secure: false for non-banked exceptions or for the nonsecure
32
+ * version of a banked exception, true for the secure version of a banked
33
+ * exception.
34
+ *
35
+ * Marks the specified exception as pending. Note that we will assert()
36
+ * if @secure is true and @irq does not specify one of the fixed set
37
+ * of architecturally banked exceptions.
38
+ */
39
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
40
+/**
41
+ * armv7m_nvic_set_pending_derived: mark this derived exception as pending
42
+ * @s: the NVIC
43
+ * @irq: the exception number to mark pending
44
+ * @secure: false for non-banked exceptions or for the nonsecure
45
+ * version of a banked exception, true for the secure version of a banked
46
+ * exception.
47
+ *
48
+ * Similar to armv7m_nvic_set_pending(), but specifically for derived
49
+ * exceptions (exceptions generated in the course of trying to take
50
+ * a different exception).
51
+ */
52
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
53
+/**
54
+ * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
55
+ * @s: the NVIC
56
+ * @irq: the exception number to mark pending
57
+ * @secure: false for non-banked exceptions or for the nonsecure
58
+ * version of a banked exception, true for the secure version of a banked
59
+ * exception.
60
+ *
61
+ * Similar to armv7m_nvic_set_pending(), but specifically for exceptions
62
+ * generated in the course of lazy stacking of FP registers.
63
+ */
64
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
65
+/**
66
+ * armv7m_nvic_get_pending_irq_info: return highest priority pending
67
+ * exception, and whether it targets Secure state
68
+ * @s: the NVIC
69
+ * @pirq: set to pending exception number
70
+ * @ptargets_secure: set to whether pending exception targets Secure
71
+ *
72
+ * This function writes the number of the highest priority pending
73
+ * exception (the one which would be made active by
74
+ * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure
75
+ * to true if the current highest priority pending exception should
76
+ * be taken to Secure state, false for NS.
77
+ */
78
+void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
79
+ bool *ptargets_secure);
80
+/**
81
+ * armv7m_nvic_acknowledge_irq: make highest priority pending exception active
82
+ * @s: the NVIC
83
+ *
84
+ * Move the current highest priority pending exception from the pending
85
+ * state to the active state, and update v7m.exception to indicate that
86
+ * it is the exception currently being handled.
87
+ */
88
+void armv7m_nvic_acknowledge_irq(NVICState *s);
89
+/**
90
+ * armv7m_nvic_complete_irq: complete specified interrupt or exception
91
+ * @s: the NVIC
92
+ * @irq: the exception number to complete
93
+ * @secure: true if this exception was secure
94
+ *
95
+ * Returns: -1 if the irq was not active
96
+ * 1 if completing this irq brought us back to base (no active irqs)
97
+ * 0 if there is still an irq active after this one was completed
98
+ * (Ignoring -1, this is the same as the RETTOBASE value before completion.)
99
+ */
100
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
101
+/**
102
+ * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
103
+ * @s: the NVIC
104
+ * @irq: the exception number to mark pending
105
+ * @secure: false for non-banked exceptions or for the nonsecure
106
+ * version of a banked exception, true for the secure version of a banked
107
+ * exception.
108
+ *
109
+ * Return whether an exception is "ready", i.e. whether the exception is
110
+ * enabled and is configured at a priority which would allow it to
111
+ * interrupt the current execution priority. This controls whether the
112
+ * RDY bit for it in the FPCCR is set.
113
+ */
114
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
115
+/**
116
+ * armv7m_nvic_raw_execution_priority: return the raw execution priority
117
+ * @s: the NVIC
118
+ *
119
+ * Returns: the raw execution priority as defined by the v8M architecture.
120
+ * This is the execution priority minus the effects of AIRCR.PRIS,
121
+ * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
122
+ * (v8M ARM ARM I_PKLD.)
123
+ */
124
+int armv7m_nvic_raw_execution_priority(NVICState *s);
125
+/**
126
+ * armv7m_nvic_neg_prio_requested: return true if the requested execution
127
+ * priority is negative for the specified security state.
128
+ * @s: the NVIC
129
+ * @secure: the security state to test
130
+ * This corresponds to the pseudocode IsReqExecPriNeg().
131
+ */
132
+#ifndef CONFIG_USER_ONLY
133
+bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
134
+#else
135
+static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
136
+{
137
+ return false;
138
+}
139
+#endif
140
+#ifndef CONFIG_USER_ONLY
141
+bool armv7m_nvic_can_take_pending_exception(NVICState *s);
142
+#else
143
+static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
144
+{
145
+ return true;
146
+}
147
+#endif
148
+
149
#endif
150
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
151
index XXXXXXX..XXXXXXX 100644
152
--- a/target/arm/cpu.h
153
+++ b/target/arm/cpu.h
154
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
155
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
156
uint32_t cur_el, bool secure);
157
158
-/* Interface between CPU and Interrupt controller. */
159
-#ifndef CONFIG_USER_ONLY
160
-bool armv7m_nvic_can_take_pending_exception(NVICState *s);
161
-#else
162
-static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s)
163
-{
164
- return true;
165
-}
166
-#endif
167
-/**
168
- * armv7m_nvic_set_pending: mark the specified exception as pending
169
- * @s: the NVIC
170
- * @irq: the exception number to mark pending
171
- * @secure: false for non-banked exceptions or for the nonsecure
172
- * version of a banked exception, true for the secure version of a banked
173
- * exception.
174
- *
175
- * Marks the specified exception as pending. Note that we will assert()
176
- * if @secure is true and @irq does not specify one of the fixed set
177
- * of architecturally banked exceptions.
178
- */
179
-void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
180
-/**
181
- * armv7m_nvic_set_pending_derived: mark this derived exception as pending
182
- * @s: the NVIC
183
- * @irq: the exception number to mark pending
184
- * @secure: false for non-banked exceptions or for the nonsecure
185
- * version of a banked exception, true for the secure version of a banked
186
- * exception.
187
- *
188
- * Similar to armv7m_nvic_set_pending(), but specifically for derived
189
- * exceptions (exceptions generated in the course of trying to take
190
- * a different exception).
191
- */
192
-void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
193
-/**
194
- * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending
195
- * @s: the NVIC
196
- * @irq: the exception number to mark pending
197
- * @secure: false for non-banked exceptions or for the nonsecure
198
- * version of a banked exception, true for the secure version of a banked
199
- * exception.
200
- *
201
- * Similar to armv7m_nvic_set_pending(), but specifically for exceptions
202
- * generated in the course of lazy stacking of FP registers.
203
- */
204
-void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure);
205
-/**
206
- * armv7m_nvic_get_pending_irq_info: return highest priority pending
207
- * exception, and whether it targets Secure state
208
- * @s: the NVIC
209
- * @pirq: set to pending exception number
210
- * @ptargets_secure: set to whether pending exception targets Secure
211
- *
212
- * This function writes the number of the highest priority pending
213
- * exception (the one which would be made active by
214
- * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure
215
- * to true if the current highest priority pending exception should
216
- * be taken to Secure state, false for NS.
217
- */
218
-void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq,
219
- bool *ptargets_secure);
220
-/**
221
- * armv7m_nvic_acknowledge_irq: make highest priority pending exception active
222
- * @s: the NVIC
223
- *
224
- * Move the current highest priority pending exception from the pending
225
- * state to the active state, and update v7m.exception to indicate that
226
- * it is the exception currently being handled.
227
- */
228
-void armv7m_nvic_acknowledge_irq(NVICState *s);
229
-/**
230
- * armv7m_nvic_complete_irq: complete specified interrupt or exception
231
- * @s: the NVIC
232
- * @irq: the exception number to complete
233
- * @secure: true if this exception was secure
234
- *
235
- * Returns: -1 if the irq was not active
236
- * 1 if completing this irq brought us back to base (no active irqs)
237
- * 0 if there is still an irq active after this one was completed
238
- * (Ignoring -1, this is the same as the RETTOBASE value before completion.)
239
- */
240
-int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure);
241
-/**
242
- * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
243
- * @s: the NVIC
244
- * @irq: the exception number to mark pending
245
- * @secure: false for non-banked exceptions or for the nonsecure
246
- * version of a banked exception, true for the secure version of a banked
247
- * exception.
248
- *
249
- * Return whether an exception is "ready", i.e. whether the exception is
250
- * enabled and is configured at a priority which would allow it to
251
- * interrupt the current execution priority. This controls whether the
252
- * RDY bit for it in the FPCCR is set.
253
- */
254
-bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure);
255
-/**
256
- * armv7m_nvic_raw_execution_priority: return the raw execution priority
257
- * @s: the NVIC
258
- *
259
- * Returns: the raw execution priority as defined by the v8M architecture.
260
- * This is the execution priority minus the effects of AIRCR.PRIS,
261
- * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting.
262
- * (v8M ARM ARM I_PKLD.)
263
- */
264
-int armv7m_nvic_raw_execution_priority(NVICState *s);
265
-/**
266
- * armv7m_nvic_neg_prio_requested: return true if the requested execution
267
- * priority is negative for the specified security state.
268
- * @s: the NVIC
269
- * @secure: the security state to test
270
- * This corresponds to the pseudocode IsReqExecPriNeg().
271
- */
272
-#ifndef CONFIG_USER_ONLY
273
-bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure);
274
-#else
275
-static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure)
276
-{
277
- return false;
278
-}
279
-#endif
280
-
281
/* Interface for defining coprocessor registers.
282
* Registers are defined in tables of arm_cp_reginfo structs
283
* which are passed to define_arm_cp_regs().
284
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
285
index XXXXXXX..XXXXXXX 100644
286
--- a/target/arm/cpu.c
287
+++ b/target/arm/cpu.c
288
@@ -XXX,XX +XXX,XX @@
289
#if !defined(CONFIG_USER_ONLY)
290
#include "hw/loader.h"
291
#include "hw/boards.h"
292
+#ifdef CONFIG_TCG
293
#include "hw/intc/armv7m_nvic.h"
294
-#endif
295
+#endif /* CONFIG_TCG */
296
+#endif /* !CONFIG_USER_ONLY */
297
#include "sysemu/tcg.h"
298
#include "sysemu/qtest.h"
299
#include "sysemu/hw_accel.h"
300
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
301
index XXXXXXX..XXXXXXX 100644
302
--- a/target/arm/cpu_tcg.c
303
+++ b/target/arm/cpu_tcg.c
304
@@ -XXX,XX +XXX,XX @@
305
#include "hw/boards.h"
306
#endif
307
#include "cpregs.h"
308
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
309
+#include "hw/intc/armv7m_nvic.h"
310
+#endif
311
312
313
/* Share AArch32 -cpu max features with AArch64. */
314
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
315
index XXXXXXX..XXXXXXX 100644
316
--- a/target/arm/m_helper.c
317
+++ b/target/arm/m_helper.c
318
@@ -XXX,XX +XXX,XX @@
319
#include "exec/cpu_ldst.h"
320
#include "semihosting/common-semi.h"
321
#endif
322
+#if !defined(CONFIG_USER_ONLY)
323
+#include "hw/intc/armv7m_nvic.h"
324
+#endif
325
326
static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
327
uint32_t reg, uint32_t val)
328
--
329
2.34.1
330
331
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Commit a5e0b3311 removed these in favour of querying machine
3
The two TCG tests for GICv2 and GICv3 are very heavy weight distros
4
properties. Remove the extern declarations as well.
4
that take a long time to boot up, especially for an --enable-debug
5
build. The total code coverage they give is:
6
7
Overall coverage rate:
8
lines......: 11.2% (59584 of 530123 lines)
9
functions..: 15.0% (7436 of 49443 functions)
10
branches...: 6.3% (19273 of 303933 branches)
11
12
We already get pretty close to that with the machine_aarch64_virt
13
tests which only does one full boot (~120s vs ~600s) of alpine. We
14
expand the kernel+initrd boot (~8s) to test both GICs and also add an
15
RNG device and a block device to generate a few IRQs and exercise the
16
storage layer. With that we get to a coverage of:
17
18
Overall coverage rate:
19
lines......: 11.0% (58121 of 530123 lines)
20
functions..: 14.9% (7343 of 49443 functions)
21
branches...: 6.0% (18269 of 303933 branches)
22
23
which I feel is close enough given the massive time saving. If we want
24
to target any more sub-systems we can use lighter weight more directed
25
tests.
5
26
6
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
27
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
28
Reviewed-by: Fabiano Rosas <farosas@suse.de>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Acked-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20190828165307.18321-6-alex.bennee@linaro.org
30
Message-id: 20230203181632.2919715-1-alex.bennee@linaro.org
10
Cc: Like Xu <like.xu@linux.intel.com>
31
Cc: Peter Maydell <peter.maydell@linaro.org>
11
Message-Id: <20190711130546.18578-1-alex.bennee@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
33
---
14
include/sysemu/sysemu.h | 2 --
34
tests/avocado/boot_linux.py | 48 ++++----------------
15
1 file changed, 2 deletions(-)
35
tests/avocado/machine_aarch64_virt.py | 63 ++++++++++++++++++++++++---
16
36
2 files changed, 65 insertions(+), 46 deletions(-)
17
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
37
38
diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
18
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
19
--- a/include/sysemu/sysemu.h
40
--- a/tests/avocado/boot_linux.py
20
+++ b/include/sysemu/sysemu.h
41
+++ b/tests/avocado/boot_linux.py
21
@@ -XXX,XX +XXX,XX @@ extern const char *keyboard_layout;
42
@@ -XXX,XX +XXX,XX @@ def test_pc_q35_kvm(self):
22
extern int win2k_install_hack;
43
self.launch_and_wait(set_up_ssh_connection=False)
23
extern int alt_grab;
44
24
extern int ctrl_grab;
45
25
-extern int smp_cpus;
46
-# For Aarch64 we only boot KVM tests in CI as the TCG tests are very
26
-extern unsigned int max_cpus;
47
-# heavyweight. There are lighter weight distros which we use in the
27
extern int cursor_hide;
48
-# machine_aarch64_virt.py tests.
28
extern int graphic_rotate;
49
+# For Aarch64 we only boot KVM tests in CI as booting the current
29
extern int no_quit;
50
+# Fedora OS in TCG tests is very heavyweight. There are lighter weight
51
+# distros which we use in the machine_aarch64_virt.py tests.
52
class BootLinuxAarch64(LinuxTest):
53
"""
54
:avocado: tags=arch:aarch64
55
:avocado: tags=machine:virt
56
- :avocado: tags=machine:gic-version=2
57
"""
58
timeout = 720
59
60
- def add_common_args(self):
61
- self.vm.add_args('-bios',
62
- os.path.join(BUILD_DIR, 'pc-bios',
63
- 'edk2-aarch64-code.fd'))
64
- self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
65
- self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
66
-
67
- @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
68
- def test_fedora_cloud_tcg_gicv2(self):
69
- """
70
- :avocado: tags=accel:tcg
71
- :avocado: tags=cpu:max
72
- :avocado: tags=device:gicv2
73
- """
74
- self.require_accelerator("tcg")
75
- self.vm.add_args("-accel", "tcg")
76
- self.vm.add_args("-cpu", "max,lpa2=off")
77
- self.vm.add_args("-machine", "virt,gic-version=2")
78
- self.add_common_args()
79
- self.launch_and_wait(set_up_ssh_connection=False)
80
-
81
- @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
82
- def test_fedora_cloud_tcg_gicv3(self):
83
- """
84
- :avocado: tags=accel:tcg
85
- :avocado: tags=cpu:max
86
- :avocado: tags=device:gicv3
87
- """
88
- self.require_accelerator("tcg")
89
- self.vm.add_args("-accel", "tcg")
90
- self.vm.add_args("-cpu", "max,lpa2=off")
91
- self.vm.add_args("-machine", "virt,gic-version=3")
92
- self.add_common_args()
93
- self.launch_and_wait(set_up_ssh_connection=False)
94
-
95
def test_virt_kvm(self):
96
"""
97
:avocado: tags=accel:kvm
98
@@ -XXX,XX +XXX,XX @@ def test_virt_kvm(self):
99
self.require_accelerator("kvm")
100
self.vm.add_args("-accel", "kvm")
101
self.vm.add_args("-machine", "virt,gic-version=host")
102
- self.add_common_args()
103
+ self.vm.add_args('-bios',
104
+ os.path.join(BUILD_DIR, 'pc-bios',
105
+ 'edk2-aarch64-code.fd'))
106
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
107
+ self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
108
self.launch_and_wait(set_up_ssh_connection=False)
109
110
111
diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_aarch64_virt.py
112
index XXXXXXX..XXXXXXX 100644
113
--- a/tests/avocado/machine_aarch64_virt.py
114
+++ b/tests/avocado/machine_aarch64_virt.py
115
@@ -XXX,XX +XXX,XX @@
116
117
import time
118
import os
119
+import logging
120
121
from avocado_qemu import QemuSystemTest
122
from avocado_qemu import wait_for_console_pattern
123
from avocado_qemu import exec_command
124
from avocado_qemu import BUILD_DIR
125
+from avocado.utils import process
126
+from avocado.utils.path import find_command
127
128
class Aarch64VirtMachine(QemuSystemTest):
129
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
130
@@ -XXX,XX +XXX,XX @@ def test_alpine_virt_tcg_gic_max(self):
131
self.wait_for_console_pattern('Welcome to Alpine Linux 3.16')
132
133
134
- def test_aarch64_virt(self):
135
+ def common_aarch64_virt(self, machine):
136
"""
137
- :avocado: tags=arch:aarch64
138
- :avocado: tags=machine:virt
139
- :avocado: tags=accel:tcg
140
- :avocado: tags=cpu:max
141
+ Common code to launch basic virt machine with kernel+initrd
142
+ and a scratch disk.
143
"""
144
+ logger = logging.getLogger('aarch64_virt')
145
+
146
kernel_url = ('https://fileserver.linaro.org/s/'
147
'z6B2ARM7DQT3HWN/download')
148
-
149
kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347'
150
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
151
152
@@ -XXX,XX +XXX,XX @@ def test_aarch64_virt(self):
153
'console=ttyAMA0')
154
self.require_accelerator("tcg")
155
self.vm.add_args('-cpu', 'max,pauth-impdef=on',
156
+ '-machine', machine,
157
'-accel', 'tcg',
158
'-kernel', kernel_path,
159
'-append', kernel_command_line)
160
+
161
+ # A RNG offers an easy way to generate a few IRQs
162
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
163
+ self.vm.add_args('-object',
164
+ 'rng-random,id=rng0,filename=/dev/urandom')
165
+
166
+ # Also add a scratch block device
167
+ logger.info('creating scratch qcow2 image')
168
+ image_path = os.path.join(self.workdir, 'scratch.qcow2')
169
+ qemu_img = os.path.join(BUILD_DIR, 'qemu-img')
170
+ if not os.path.exists(qemu_img):
171
+ qemu_img = find_command('qemu-img', False)
172
+ if qemu_img is False:
173
+ self.cancel('Could not find "qemu-img", which is required to '
174
+ 'create the temporary qcow2 image')
175
+ cmd = '%s create -f qcow2 %s 8M' % (qemu_img, image_path)
176
+ process.run(cmd)
177
+
178
+ # Add the device
179
+ self.vm.add_args('-blockdev',
180
+ f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch")
181
+ self.vm.add_args('-device',
182
+ 'virtio-blk-device,drive=scratch')
183
+
184
self.vm.launch()
185
self.wait_for_console_pattern('Welcome to Buildroot')
186
time.sleep(0.1)
187
exec_command(self, 'root')
188
time.sleep(0.1)
189
+ exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4')
190
+ time.sleep(0.1)
191
+ exec_command(self, 'md5sum /dev/vda')
192
+ time.sleep(0.1)
193
+ exec_command(self, 'cat /proc/interrupts')
194
+ time.sleep(0.1)
195
exec_command(self, 'cat /proc/self/maps')
196
time.sleep(0.1)
197
+
198
+ def test_aarch64_virt_gicv3(self):
199
+ """
200
+ :avocado: tags=arch:aarch64
201
+ :avocado: tags=machine:virt
202
+ :avocado: tags=accel:tcg
203
+ :avocado: tags=cpu:max
204
+ """
205
+ self.common_aarch64_virt("virt,gic_version=3")
206
+
207
+ def test_aarch64_virt_gicv2(self):
208
+ """
209
+ :avocado: tags=arch:aarch64
210
+ :avocado: tags=machine:virt
211
+ :avocado: tags=accel:tcg
212
+ :avocado: tags=cpu:max
213
+ """
214
+ self.common_aarch64_virt("virt,gic-version=2")
30
--
215
--
31
2.20.1
216
2.34.1
32
217
33
218
diff view generated by jsdifflib
1
From: Eric Auger <eric.auger@redhat.com>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
An IOVA/ASID invalidation is notified to all IOMMU Memory Regions
3
GBPA register can be used to globally abort all
4
through smmuv3_inv_notifiers_iova/smmuv3_notify_iova.
4
transactions.
5
5
6
When the notification occurs it is possible that some of the
6
It is described in the SMMU manual in "6.3.14 SMMU_GBPA".
7
PCIe devices associated to the notified regions do not have a
7
ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to
8
valid stream table entry. In that case we output a LOG_GUEST_ERROR
8
be zero(Do not abort incoming transactions).
9
message, for example:
10
9
11
invalid sid=<SID> (L1STD span=0)
10
Other fields have default values of Use Incoming.
12
"smmuv3_notify_iova error decoding the configuration for iommu mr=<MR>
13
11
14
This is unfortunate as the user gets the impression that there
12
If UPDATE is not set, the write is ignored. This is the only permitted
15
are some translation decoding errors whereas there are not.
13
behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
16
14
17
This patch adds a new field in SMMUEventInfo that tells whether
15
As this patch adds a new state to the SMMU (GBPA), it is added
18
the detection of an invalid STE must lead to an error report.
16
in a new subsection for forward migration compatibility.
19
invalid_ste_allowed is set before doing the invalidations and
17
GBPA is only migrated if its value is different from the reset value.
20
kept unset on actual translation.
18
It does this to be backward migration compatible if SW didn't write
19
the register.
21
20
22
The other configuration decoding error messages are kept since if the
21
Signed-off-by: Mostafa Saleh <smostafa@google.com>
23
STE is valid then the rest of the config must be correct.
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
24
23
Reviewed-by: Eric Auger <eric.auger@redhat.com>
25
Signed-off-by: Eric Auger <eric.auger@redhat.com>
24
Message-id: 20230214094009.2445653-1-smostafa@google.com
26
Message-id: 20190822172350.12008-6-eric.auger@redhat.com
27
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
---
27
---
30
hw/arm/smmuv3-internal.h | 1 +
28
hw/arm/smmuv3-internal.h | 7 +++++++
31
hw/arm/smmuv3.c | 19 +++++++++++--------
29
include/hw/arm/smmuv3.h | 1 +
32
2 files changed, 12 insertions(+), 8 deletions(-)
30
hw/arm/smmuv3.c | 43 +++++++++++++++++++++++++++++++++++++++-
31
3 files changed, 50 insertions(+), 1 deletion(-)
33
32
34
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
33
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
35
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/smmuv3-internal.h
35
--- a/hw/arm/smmuv3-internal.h
37
+++ b/hw/arm/smmuv3-internal.h
36
+++ b/hw/arm/smmuv3-internal.h
38
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUEventInfo {
37
@@ -XXX,XX +XXX,XX @@ REG32(CR0ACK, 0x24)
39
uint32_t sid;
38
REG32(CR1, 0x28)
40
bool recorded;
39
REG32(CR2, 0x2c)
41
bool record_trans_faults;
40
REG32(STATUSR, 0x40)
42
+ bool inval_ste_allowed;
41
+REG32(GBPA, 0x44)
43
union {
42
+ FIELD(GBPA, ABORT, 20, 1)
44
struct {
43
+ FIELD(GBPA, UPDATE, 31, 1)
45
uint32_t ssid;
44
+
45
+/* Use incoming. */
46
+#define SMMU_GBPA_RESET_VAL 0x1000
47
+
48
REG32(IRQ_CTRL, 0x50)
49
FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)
50
FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1)
51
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
52
index XXXXXXX..XXXXXXX 100644
53
--- a/include/hw/arm/smmuv3.h
54
+++ b/include/hw/arm/smmuv3.h
55
@@ -XXX,XX +XXX,XX @@ struct SMMUv3State {
56
uint32_t cr[3];
57
uint32_t cr0ack;
58
uint32_t statusr;
59
+ uint32_t gbpa;
60
uint32_t irq_ctrl;
61
uint32_t gerror;
62
uint32_t gerrorn;
46
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
63
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
47
index XXXXXXX..XXXXXXX 100644
64
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/arm/smmuv3.c
65
--- a/hw/arm/smmuv3.c
49
+++ b/hw/arm/smmuv3.c
66
+++ b/hw/arm/smmuv3.c
50
@@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
67
@@ -XXX,XX +XXX,XX @@ static void smmuv3_init_regs(SMMUv3State *s)
51
uint32_t config;
68
s->gerror = 0;
52
69
s->gerrorn = 0;
53
if (!STE_VALID(ste)) {
70
s->statusr = 0;
54
- qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n");
71
+ s->gbpa = SMMU_GBPA_RESET_VAL;
55
+ if (!event->inval_ste_allowed) {
72
}
56
+ qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n");
73
74
static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf,
75
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
76
qemu_mutex_lock(&s->mutex);
77
78
if (!smmu_enabled(s)) {
79
- status = SMMU_TRANS_DISABLE;
80
+ if (FIELD_EX32(s->gbpa, GBPA, ABORT)) {
81
+ status = SMMU_TRANS_ABORT;
82
+ } else {
83
+ status = SMMU_TRANS_DISABLE;
57
+ }
84
+ }
58
goto bad_ste;
85
goto epilogue;
59
}
86
}
60
87
61
@@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste,
88
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
62
89
case A_GERROR_IRQ_CFG2:
63
if (!span) {
90
s->gerror_irq_cfg2 = data;
64
/* l2ptr is not valid */
91
return MEMTX_OK;
65
- qemu_log_mask(LOG_GUEST_ERROR,
92
+ case A_GBPA:
66
- "invalid sid=%d (L1STD span=0)\n", sid);
93
+ /*
67
+ if (!event->inval_ste_allowed) {
94
+ * If UPDATE is not set, the write is ignored. This is the only
68
+ qemu_log_mask(LOG_GUEST_ERROR,
95
+ * permitted behavior in SMMUv3.2 and later.
69
+ "invalid sid=%d (L1STD span=0)\n", sid);
96
+ */
70
+ }
97
+ if (data & R_GBPA_UPDATE_MASK) {
71
event->type = SMMU_EVT_C_BAD_STREAMID;
98
+ /* Ignore update bit as write is synchronous. */
72
return -EINVAL;
99
+ s->gbpa = data & ~R_GBPA_UPDATE_MASK;
73
}
100
+ }
74
@@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr,
101
+ return MEMTX_OK;
75
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
102
case A_STRTAB_BASE: /* 64b */
76
SMMUv3State *s = sdev->smmu;
103
s->strtab_base = deposit64(s->strtab_base, 0, 32, data);
77
uint32_t sid = smmu_get_sid(sdev);
104
return MEMTX_OK;
78
- SMMUEventInfo event = {.type = SMMU_EVT_NONE, .sid = sid};
105
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_readl(SMMUv3State *s, hwaddr offset,
79
+ SMMUEventInfo event = {.type = SMMU_EVT_NONE,
106
case A_STATUSR:
80
+ .sid = sid,
107
*data = s->statusr;
81
+ .inval_ste_allowed = false};
108
return MEMTX_OK;
82
SMMUPTWEventInfo ptw_info = {};
109
+ case A_GBPA:
83
SMMUTranslationStatus status;
110
+ *data = s->gbpa;
84
SMMUState *bs = ARM_SMMU(s);
111
+ return MEMTX_OK;
85
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
112
case A_IRQ_CTRL:
86
dma_addr_t iova)
113
case A_IRQ_CTRL_ACK:
87
{
114
*data = s->irq_ctrl;
88
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
115
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3_queue = {
89
- SMMUEventInfo event = {};
116
},
90
+ SMMUEventInfo event = {.inval_ste_allowed = true};
117
};
91
SMMUTransTableInfo *tt;
118
92
SMMUTransCfg *cfg;
119
+static bool smmuv3_gbpa_needed(void *opaque)
93
IOMMUTLBEntry entry;
120
+{
94
121
+ SMMUv3State *s = opaque;
95
cfg = smmuv3_get_config(sdev, &event);
122
+
96
if (!cfg) {
123
+ /* Only migrate GBPA if it has different reset value. */
97
- qemu_log_mask(LOG_GUEST_ERROR,
124
+ return s->gbpa != SMMU_GBPA_RESET_VAL;
98
- "%s error decoding the configuration for iommu mr=%s\n",
125
+}
99
- __func__, mr->parent_obj.name);
126
+
100
return;
127
+static const VMStateDescription vmstate_gbpa = {
101
}
128
+ .name = "smmuv3/gbpa",
102
129
+ .version_id = 1,
130
+ .minimum_version_id = 1,
131
+ .needed = smmuv3_gbpa_needed,
132
+ .fields = (VMStateField[]) {
133
+ VMSTATE_UINT32(gbpa, SMMUv3State),
134
+ VMSTATE_END_OF_LIST()
135
+ }
136
+};
137
+
138
static const VMStateDescription vmstate_smmuv3 = {
139
.name = "smmuv3",
140
.version_id = 1,
141
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = {
142
143
VMSTATE_END_OF_LIST(),
144
},
145
+ .subsections = (const VMStateDescription * []) {
146
+ &vmstate_gbpa,
147
+ NULL
148
+ }
149
};
150
151
static void smmuv3_instance_init(Object *obj)
103
--
152
--
104
2.20.1
153
2.34.1
105
106
diff view generated by jsdifflib
1
From: Eric Auger <eric.auger@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Log a guest error when encountering an invalid STE.
3
Since commit acc0b8b05a when running the ZynqMP ZCU102 board with
4
a QEMU configured using --without-default-devices, we get:
4
5
5
Signed-off-by: Eric Auger <eric.auger@redhat.com>
6
$ qemu-system-aarch64 -M xlnx-zcu102
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
qemu-system-aarch64: missing object type 'usb_dwc3'
7
Message-id: 20190822172350.12008-5-eric.auger@redhat.com
8
Abort trap: 6
9
10
Fix by adding the missing Kconfig dependency.
11
12
Fixes: acc0b8b05a ("hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers")
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Message-id: 20230216092327.2203-1-philmd@linaro.org
15
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
17
---
10
hw/arm/smmuv3.c | 1 +
18
hw/arm/Kconfig | 1 +
11
1 file changed, 1 insertion(+)
19
1 file changed, 1 insertion(+)
12
20
13
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
21
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
14
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/smmuv3.c
23
--- a/hw/arm/Kconfig
16
+++ b/hw/arm/smmuv3.c
24
+++ b/hw/arm/Kconfig
17
@@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg,
25
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
18
uint32_t config;
26
select XLNX_CSU_DMA
19
27
select XLNX_ZYNQMP
20
if (!STE_VALID(ste)) {
28
select XLNX_ZDMA
21
+ qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n");
29
+ select USB_DWC3
22
goto bad_ste;
30
23
}
31
config XLNX_VERSAL
24
32
bool
25
--
33
--
26
2.20.1
34
2.34.1
27
35
28
36
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Cornelia Huck <cohuck@redhat.com>
2
2
3
Make this a static function private to translate.c.
3
Just use current_accel_name() directly.
4
Thus we can use the same idiom between aarch64 and aarch32
5
without actually sharing function implementations.
6
4
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
8
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Message-id: 20190826151536.6771-3-richard.henderson@linaro.org
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
9
---
12
target/arm/translate-vfp.inc.c | 3 +--
10
hw/arm/virt.c | 6 +++---
13
target/arm/translate.c | 22 ++++++++++++----------
11
1 file changed, 3 insertions(+), 3 deletions(-)
14
2 files changed, 13 insertions(+), 12 deletions(-)
15
12
16
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
13
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
17
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-vfp.inc.c
15
--- a/hw/arm/virt.c
19
+++ b/target/arm/translate-vfp.inc.c
16
+++ b/hw/arm/virt.c
20
@@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
17
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
21
18
if (vms->secure && (kvm_enabled() || hvf_enabled())) {
22
if (!s->vfp_enabled && !ignore_vfp_enabled) {
19
error_report("mach-virt: %s does not support providing "
23
assert(!arm_dc_feature(s, ARM_FEATURE_M));
20
"Security extensions (TrustZone) to the guest CPU",
24
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
21
- kvm_enabled() ? "KVM" : "HVF");
25
- default_exception_el(s));
22
+ current_accel_name());
26
+ unallocated_encoding(s);
23
exit(1);
27
return false;
28
}
24
}
29
25
30
diff --git a/target/arm/translate.c b/target/arm/translate.c
26
if (vms->virt && (kvm_enabled() || hvf_enabled())) {
31
index XXXXXXX..XXXXXXX 100644
27
error_report("mach-virt: %s does not support providing "
32
--- a/target/arm/translate.c
28
"Virtualization extensions to the guest CPU",
33
+++ b/target/arm/translate.c
29
- kvm_enabled() ? "KVM" : "HVF");
34
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
30
+ current_accel_name());
35
s->base.is_jmp = DISAS_NORETURN;
31
exit(1);
36
}
37
38
+static void unallocated_encoding(DisasContext *s)
39
+{
40
+ /* Unallocated and reserved encodings are uncategorized */
41
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
42
+ default_exception_el(s));
43
+}
44
+
45
/* Force a TB lookup after an instruction that changes the CPU state. */
46
static inline void gen_lookup_tb(DisasContext *s)
47
{
48
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
49
return;
50
}
32
}
51
33
52
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
34
if (vms->mte && (kvm_enabled() || hvf_enabled())) {
53
- default_exception_el(s));
35
error_report("mach-virt: %s does not support providing "
54
+ unallocated_encoding(s);
36
"MTE to the guest CPU",
55
}
37
- kvm_enabled() ? "KVM" : "HVF");
56
38
+ current_accel_name());
57
static inline void gen_add_data_offset(DisasContext *s, unsigned int insn,
39
exit(1);
58
@@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s,
59
}
40
}
60
41
61
if (undef) {
62
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
63
- default_exception_el(s));
64
+ unallocated_encoding(s);
65
return;
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
69
break;
70
default:
71
illegal_op:
72
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
73
- default_exception_el(s));
74
+ unallocated_encoding(s);
75
break;
76
}
77
}
78
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
79
}
80
return;
81
illegal_op:
82
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
83
- default_exception_el(s));
84
+ unallocated_encoding(s);
85
}
86
87
static void disas_thumb_insn(DisasContext *s, uint32_t insn)
88
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
89
return;
90
illegal_op:
91
undef:
92
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
93
- default_exception_el(s));
94
+ unallocated_encoding(s);
95
}
96
97
static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
98
--
42
--
99
2.20.1
43
2.34.1
100
101
diff view generated by jsdifflib
New patch
1
From: Hao Wu <wuhaotsh@google.com>
1
2
3
Havard is no longer working on the Nuvoton systems for a while
4
and won't be able to do any work on it in the future. So I'll
5
take over maintaining the Nuvoton system from him.
6
7
Signed-off-by: Hao Wu <wuhaotsh@google.com>
8
Acked-by: Havard Skinnemoen <hskinnemoen@google.com>
9
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
10
Message-id: 20230208235433.3989937-2-wuhaotsh@google.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
MAINTAINERS | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
16
diff --git a/MAINTAINERS b/MAINTAINERS
17
index XXXXXXX..XXXXXXX 100644
18
--- a/MAINTAINERS
19
+++ b/MAINTAINERS
20
@@ -XXX,XX +XXX,XX @@ F: include/hw/net/mv88w8618_eth.h
21
F: docs/system/arm/musicpal.rst
22
23
Nuvoton NPCM7xx
24
-M: Havard Skinnemoen <hskinnemoen@google.com>
25
M: Tyrone Ting <kfting@nuvoton.com>
26
+M: Hao Wu <wuhaotsh@google.com>
27
L: qemu-arm@nongnu.org
28
S: Supported
29
F: hw/*/npcm7xx*
30
--
31
2.34.1
diff view generated by jsdifflib
New patch
1
From: Hao Wu <wuhaotsh@google.com>
1
2
3
Nuvoton's PSPI is a general purpose SPI module which enables
4
connections to SPI-based peripheral devices.
5
6
Signed-off-by: Hao Wu <wuhaotsh@google.com>
7
Reviewed-by: Chris Rauer <crauer@google.com>
8
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
9
Message-id: 20230208235433.3989937-3-wuhaotsh@google.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
MAINTAINERS | 6 +-
13
include/hw/ssi/npcm_pspi.h | 53 +++++++++
14
hw/ssi/npcm_pspi.c | 221 +++++++++++++++++++++++++++++++++++++
15
hw/ssi/meson.build | 2 +-
16
hw/ssi/trace-events | 5 +
17
5 files changed, 283 insertions(+), 4 deletions(-)
18
create mode 100644 include/hw/ssi/npcm_pspi.h
19
create mode 100644 hw/ssi/npcm_pspi.c
20
21
diff --git a/MAINTAINERS b/MAINTAINERS
22
index XXXXXXX..XXXXXXX 100644
23
--- a/MAINTAINERS
24
+++ b/MAINTAINERS
25
@@ -XXX,XX +XXX,XX @@ M: Tyrone Ting <kfting@nuvoton.com>
26
M: Hao Wu <wuhaotsh@google.com>
27
L: qemu-arm@nongnu.org
28
S: Supported
29
-F: hw/*/npcm7xx*
30
-F: include/hw/*/npcm7xx*
31
-F: tests/qtest/npcm7xx*
32
+F: hw/*/npcm*
33
+F: include/hw/*/npcm*
34
+F: tests/qtest/npcm*
35
F: pc-bios/npcm7xx_bootrom.bin
36
F: roms/vbootrom
37
F: docs/system/arm/nuvoton.rst
38
diff --git a/include/hw/ssi/npcm_pspi.h b/include/hw/ssi/npcm_pspi.h
39
new file mode 100644
40
index XXXXXXX..XXXXXXX
41
--- /dev/null
42
+++ b/include/hw/ssi/npcm_pspi.h
43
@@ -XXX,XX +XXX,XX @@
44
+/*
45
+ * Nuvoton Peripheral SPI Module
46
+ *
47
+ * Copyright 2023 Google LLC
48
+ *
49
+ * This program is free software; you can redistribute it and/or modify it
50
+ * under the terms of the GNU General Public License as published by the
51
+ * Free Software Foundation; either version 2 of the License, or
52
+ * (at your option) any later version.
53
+ *
54
+ * This program is distributed in the hope that it will be useful, but WITHOUT
55
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
56
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
57
+ * for more details.
58
+ */
59
+#ifndef NPCM_PSPI_H
60
+#define NPCM_PSPI_H
61
+
62
+#include "hw/ssi/ssi.h"
63
+#include "hw/sysbus.h"
64
+
65
+/*
66
+ * Number of registers in our device state structure. Don't change this without
67
+ * incrementing the version_id in the vmstate.
68
+ */
69
+#define NPCM_PSPI_NR_REGS 3
70
+
71
+/**
72
+ * NPCMPSPIState - Device state for one Flash Interface Unit.
73
+ * @parent: System bus device.
74
+ * @mmio: Memory region for register access.
75
+ * @spi: The SPI bus mastered by this controller.
76
+ * @regs: Register contents.
77
+ * @irq: The interrupt request queue for this module.
78
+ *
79
+ * Each PSPI has a shared bank of registers, and controls up to four chip
80
+ * selects. Each chip select has a dedicated memory region which may be used to
81
+ * read and write the flash connected to that chip select as if it were memory.
82
+ */
83
+typedef struct NPCMPSPIState {
84
+ SysBusDevice parent;
85
+
86
+ MemoryRegion mmio;
87
+
88
+ SSIBus *spi;
89
+ uint16_t regs[NPCM_PSPI_NR_REGS];
90
+ qemu_irq irq;
91
+} NPCMPSPIState;
92
+
93
+#define TYPE_NPCM_PSPI "npcm-pspi"
94
+OBJECT_DECLARE_SIMPLE_TYPE(NPCMPSPIState, NPCM_PSPI)
95
+
96
+#endif /* NPCM_PSPI_H */
97
diff --git a/hw/ssi/npcm_pspi.c b/hw/ssi/npcm_pspi.c
98
new file mode 100644
99
index XXXXXXX..XXXXXXX
100
--- /dev/null
101
+++ b/hw/ssi/npcm_pspi.c
102
@@ -XXX,XX +XXX,XX @@
103
+/*
104
+ * Nuvoton NPCM Peripheral SPI Module (PSPI)
105
+ *
106
+ * Copyright 2023 Google LLC
107
+ *
108
+ * This program is free software; you can redistribute it and/or modify it
109
+ * under the terms of the GNU General Public License as published by the
110
+ * Free Software Foundation; either version 2 of the License, or
111
+ * (at your option) any later version.
112
+ *
113
+ * This program is distributed in the hope that it will be useful, but WITHOUT
114
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
115
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
116
+ * for more details.
117
+ */
118
+
119
+#include "qemu/osdep.h"
120
+
121
+#include "hw/irq.h"
122
+#include "hw/registerfields.h"
123
+#include "hw/ssi/npcm_pspi.h"
124
+#include "migration/vmstate.h"
125
+#include "qapi/error.h"
126
+#include "qemu/error-report.h"
127
+#include "qemu/log.h"
128
+#include "qemu/module.h"
129
+#include "qemu/units.h"
130
+
131
+#include "trace.h"
132
+
133
+REG16(PSPI_DATA, 0x0)
134
+REG16(PSPI_CTL1, 0x2)
135
+ FIELD(PSPI_CTL1, SPIEN, 0, 1)
136
+ FIELD(PSPI_CTL1, MOD, 2, 1)
137
+ FIELD(PSPI_CTL1, EIR, 5, 1)
138
+ FIELD(PSPI_CTL1, EIW, 6, 1)
139
+ FIELD(PSPI_CTL1, SCM, 7, 1)
140
+ FIELD(PSPI_CTL1, SCIDL, 8, 1)
141
+ FIELD(PSPI_CTL1, SCDV, 9, 7)
142
+REG16(PSPI_STAT, 0x4)
143
+ FIELD(PSPI_STAT, BSY, 0, 1)
144
+ FIELD(PSPI_STAT, RBF, 1, 1)
145
+
146
+static void npcm_pspi_update_irq(NPCMPSPIState *s)
147
+{
148
+ int level = 0;
149
+
150
+ /* Only fire IRQ when the module is enabled. */
151
+ if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, SPIEN)) {
152
+ /* Update interrupt as BSY is cleared. */
153
+ if ((!FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, BSY)) &&
154
+ FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIW)) {
155
+ level = 1;
156
+ }
157
+
158
+ /* Update interrupt as RBF is set. */
159
+ if (FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, RBF) &&
160
+ FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIR)) {
161
+ level = 1;
162
+ }
163
+ }
164
+ qemu_set_irq(s->irq, level);
165
+}
166
+
167
+static uint16_t npcm_pspi_read_data(NPCMPSPIState *s)
168
+{
169
+ uint16_t value = s->regs[R_PSPI_DATA];
170
+
171
+ /* Clear stat bits as the value are read out. */
172
+ s->regs[R_PSPI_STAT] = 0;
173
+
174
+ return value;
175
+}
176
+
177
+static void npcm_pspi_write_data(NPCMPSPIState *s, uint16_t data)
178
+{
179
+ uint16_t value = 0;
180
+
181
+ if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, MOD)) {
182
+ value = ssi_transfer(s->spi, extract16(data, 8, 8)) << 8;
183
+ }
184
+ value |= ssi_transfer(s->spi, extract16(data, 0, 8));
185
+ s->regs[R_PSPI_DATA] = value;
186
+
187
+ /* Mark data as available */
188
+ s->regs[R_PSPI_STAT] = R_PSPI_STAT_BSY_MASK | R_PSPI_STAT_RBF_MASK;
189
+}
190
+
191
+/* Control register read handler. */
192
+static uint64_t npcm_pspi_ctrl_read(void *opaque, hwaddr addr,
193
+ unsigned int size)
194
+{
195
+ NPCMPSPIState *s = opaque;
196
+ uint16_t value;
197
+
198
+ switch (addr) {
199
+ case A_PSPI_DATA:
200
+ value = npcm_pspi_read_data(s);
201
+ break;
202
+
203
+ case A_PSPI_CTL1:
204
+ value = s->regs[R_PSPI_CTL1];
205
+ break;
206
+
207
+ case A_PSPI_STAT:
208
+ value = s->regs[R_PSPI_STAT];
209
+ break;
210
+
211
+ default:
212
+ qemu_log_mask(LOG_GUEST_ERROR,
213
+ "%s: write to invalid offset 0x%" PRIx64 "\n",
214
+ DEVICE(s)->canonical_path, addr);
215
+ return 0;
216
+ }
217
+ trace_npcm_pspi_ctrl_read(DEVICE(s)->canonical_path, addr, value);
218
+ npcm_pspi_update_irq(s);
219
+
220
+ return value;
221
+}
222
+
223
+/* Control register write handler. */
224
+static void npcm_pspi_ctrl_write(void *opaque, hwaddr addr, uint64_t v,
225
+ unsigned int size)
226
+{
227
+ NPCMPSPIState *s = opaque;
228
+ uint16_t value = v;
229
+
230
+ trace_npcm_pspi_ctrl_write(DEVICE(s)->canonical_path, addr, value);
231
+
232
+ switch (addr) {
233
+ case A_PSPI_DATA:
234
+ npcm_pspi_write_data(s, value);
235
+ break;
236
+
237
+ case A_PSPI_CTL1:
238
+ s->regs[R_PSPI_CTL1] = value;
239
+ break;
240
+
241
+ case A_PSPI_STAT:
242
+ qemu_log_mask(LOG_GUEST_ERROR,
243
+ "%s: write to read-only register PSPI_STAT: 0x%08"
244
+ PRIx64 "\n", DEVICE(s)->canonical_path, v);
245
+ break;
246
+
247
+ default:
248
+ qemu_log_mask(LOG_GUEST_ERROR,
249
+ "%s: write to invalid offset 0x%" PRIx64 "\n",
250
+ DEVICE(s)->canonical_path, addr);
251
+ return;
252
+ }
253
+ npcm_pspi_update_irq(s);
254
+}
255
+
256
+static const MemoryRegionOps npcm_pspi_ctrl_ops = {
257
+ .read = npcm_pspi_ctrl_read,
258
+ .write = npcm_pspi_ctrl_write,
259
+ .endianness = DEVICE_LITTLE_ENDIAN,
260
+ .valid = {
261
+ .min_access_size = 1,
262
+ .max_access_size = 2,
263
+ .unaligned = false,
264
+ },
265
+ .impl = {
266
+ .min_access_size = 2,
267
+ .max_access_size = 2,
268
+ .unaligned = false,
269
+ },
270
+};
271
+
272
+static void npcm_pspi_enter_reset(Object *obj, ResetType type)
273
+{
274
+ NPCMPSPIState *s = NPCM_PSPI(obj);
275
+
276
+ trace_npcm_pspi_enter_reset(DEVICE(obj)->canonical_path, type);
277
+ memset(s->regs, 0, sizeof(s->regs));
278
+}
279
+
280
+static void npcm_pspi_realize(DeviceState *dev, Error **errp)
281
+{
282
+ NPCMPSPIState *s = NPCM_PSPI(dev);
283
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
284
+ Object *obj = OBJECT(dev);
285
+
286
+ s->spi = ssi_create_bus(dev, "pspi");
287
+ memory_region_init_io(&s->mmio, obj, &npcm_pspi_ctrl_ops, s,
288
+ "mmio", 4 * KiB);
289
+ sysbus_init_mmio(sbd, &s->mmio);
290
+ sysbus_init_irq(sbd, &s->irq);
291
+}
292
+
293
+static const VMStateDescription vmstate_npcm_pspi = {
294
+ .name = "npcm-pspi",
295
+ .version_id = 0,
296
+ .minimum_version_id = 0,
297
+ .fields = (VMStateField[]) {
298
+ VMSTATE_UINT16_ARRAY(regs, NPCMPSPIState, NPCM_PSPI_NR_REGS),
299
+ VMSTATE_END_OF_LIST(),
300
+ },
301
+};
302
+
303
+
304
+static void npcm_pspi_class_init(ObjectClass *klass, void *data)
305
+{
306
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
307
+ DeviceClass *dc = DEVICE_CLASS(klass);
308
+
309
+ dc->desc = "NPCM Peripheral SPI Module";
310
+ dc->realize = npcm_pspi_realize;
311
+ dc->vmsd = &vmstate_npcm_pspi;
312
+ rc->phases.enter = npcm_pspi_enter_reset;
313
+}
314
+
315
+static const TypeInfo npcm_pspi_types[] = {
316
+ {
317
+ .name = TYPE_NPCM_PSPI,
318
+ .parent = TYPE_SYS_BUS_DEVICE,
319
+ .instance_size = sizeof(NPCMPSPIState),
320
+ .class_init = npcm_pspi_class_init,
321
+ },
322
+};
323
+DEFINE_TYPES(npcm_pspi_types);
324
diff --git a/hw/ssi/meson.build b/hw/ssi/meson.build
325
index XXXXXXX..XXXXXXX 100644
326
--- a/hw/ssi/meson.build
327
+++ b/hw/ssi/meson.build
328
@@ -XXX,XX +XXX,XX @@
329
softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_smc.c'))
330
softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('mss-spi.c'))
331
-softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c'))
332
+softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c', 'npcm_pspi.c'))
333
softmmu_ss.add(when: 'CONFIG_PL022', if_true: files('pl022.c'))
334
softmmu_ss.add(when: 'CONFIG_SIFIVE_SPI', if_true: files('sifive_spi.c'))
335
softmmu_ss.add(when: 'CONFIG_SSI', if_true: files('ssi.c'))
336
diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events
337
index XXXXXXX..XXXXXXX 100644
338
--- a/hw/ssi/trace-events
339
+++ b/hw/ssi/trace-events
340
@@ -XXX,XX +XXX,XX @@ npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset:
341
npcm7xx_fiu_flash_read(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64
342
npcm7xx_fiu_flash_write(const char *id, unsigned cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64
343
344
+# npcm_pspi.c
345
+npcm_pspi_enter_reset(const char *id, int reset_type) "%s reset type: %d"
346
+npcm_pspi_ctrl_read(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16
347
+npcm_pspi_ctrl_write(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16
348
+
349
# ibex_spi_host.c
350
351
ibex_spi_host_reset(const char *msg) "%s"
352
--
353
2.34.1
diff view generated by jsdifflib
1
An attempt to do an exception-return (branch to one of the magic
1
From: Hao Wu <wuhaotsh@google.com>
2
addresses) in linux-user mode for M-profile should behave like
3
a normal branch, because linux-user mode is always going to be
4
in 'handler' mode. This used to work, but we broke it when we added
5
support for the M-profile security extension in commit d02a8698d7ae2bfed.
6
2
7
In that commit we allowed even handler-mode calls to magic return
3
Signed-off-by: Hao Wu <wuhaotsh@google.com>
8
values to be checked for and dealt with by causing an
4
Reviewed-by: Titus Rwantare <titusr@google.com>
9
EXCP_EXCEPTION_EXIT exception to be taken, because this is
5
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
10
needed for the FNC_RETURN return-from-non-secure-function-call
6
Message-id: 20230208235433.3989937-4-wuhaotsh@google.com
11
handling. For system mode we added a check in do_v7m_exception_exit()
12
to make any spurious calls from Handler mode behave correctly, but
13
forgot that linux-user mode would also be affected.
14
15
How an attempted return-from-non-secure-function-call in linux-user
16
mode should be handled is not clear -- on real hardware it would
17
result in return to secure code (not to the Linux kernel) which
18
could then handle the error in any way it chose. For QEMU we take
19
the simple approach of treating this erroneous return the same way
20
it would be handled on a CPU without the security extensions --
21
treat it as a normal branch.
22
23
The upshot of all this is that for linux-user mode we should never
24
do any of the bx_excret magic, so the code change is simple.
25
26
This ought to be a weird corner case that only affects broken guest
27
code (because Linux user processes should never be attempting to do
28
exception returns or NS function returns), except that the code that
29
assigns addresses in RAM for the process and stack in our linux-user
30
code does not attempt to avoid this magic address range, so
31
legitimate code attempting to return to a trampoline routine on the
32
stack can fall into this case. This change fixes those programs,
33
but we should also look at restricting the range of memory we
34
use for M-profile linux-user guests to the area that would be
35
real RAM in hardware.
36
37
Cc: qemu-stable@nongnu.org
38
Reported-by: Christophe Lyon <christophe.lyon@linaro.org>
39
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
40
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
41
Message-id: 20190822131534.16602-1-peter.maydell@linaro.org
42
Fixes: https://bugs.launchpad.net/qemu/+bug/1840922
43
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
44
---
8
---
45
target/arm/translate.c | 21 ++++++++++++++++++++-
9
docs/system/arm/nuvoton.rst | 2 +-
46
1 file changed, 20 insertions(+), 1 deletion(-)
10
include/hw/arm/npcm7xx.h | 2 ++
11
hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++--
12
3 files changed, 26 insertions(+), 3 deletions(-)
47
13
48
diff --git a/target/arm/translate.c b/target/arm/translate.c
14
diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst
49
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
50
--- a/target/arm/translate.c
16
--- a/docs/system/arm/nuvoton.rst
51
+++ b/target/arm/translate.c
17
+++ b/docs/system/arm/nuvoton.rst
52
@@ -XXX,XX +XXX,XX @@ static inline void gen_bx(DisasContext *s, TCGv_i32 var)
18
@@ -XXX,XX +XXX,XX @@ Supported devices
53
store_cpu_field(var, thumb);
19
* SMBus controller (SMBF)
20
* Ethernet controller (EMC)
21
* Tachometer
22
+ * Peripheral SPI controller (PSPI)
23
24
Missing devices
25
---------------
26
@@ -XXX,XX +XXX,XX @@ Missing devices
27
28
* Ethernet controller (GMAC)
29
* USB device (USBD)
30
- * Peripheral SPI controller (PSPI)
31
* SD/MMC host
32
* PECI interface
33
* PCI and PCIe root complex and bridges
34
diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/include/hw/arm/npcm7xx.h
37
+++ b/include/hw/arm/npcm7xx.h
38
@@ -XXX,XX +XXX,XX @@
39
#include "hw/nvram/npcm7xx_otp.h"
40
#include "hw/timer/npcm7xx_timer.h"
41
#include "hw/ssi/npcm7xx_fiu.h"
42
+#include "hw/ssi/npcm_pspi.h"
43
#include "hw/usb/hcd-ehci.h"
44
#include "hw/usb/hcd-ohci.h"
45
#include "target/arm/cpu.h"
46
@@ -XXX,XX +XXX,XX @@ struct NPCM7xxState {
47
NPCM7xxFIUState fiu[2];
48
NPCM7xxEMCState emc[2];
49
NPCM7xxSDHCIState mmc;
50
+ NPCMPSPIState pspi[2];
51
};
52
53
#define TYPE_NPCM7XX "npcm7xx"
54
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/hw/arm/npcm7xx.c
57
+++ b/hw/arm/npcm7xx.c
58
@@ -XXX,XX +XXX,XX @@ enum NPCM7xxInterrupt {
59
NPCM7XX_EMC1RX_IRQ = 15,
60
NPCM7XX_EMC1TX_IRQ,
61
NPCM7XX_MMC_IRQ = 26,
62
+ NPCM7XX_PSPI2_IRQ = 28,
63
+ NPCM7XX_PSPI1_IRQ = 31,
64
NPCM7XX_TIMER0_IRQ = 32, /* Timer Module 0 */
65
NPCM7XX_TIMER1_IRQ,
66
NPCM7XX_TIMER2_IRQ,
67
@@ -XXX,XX +XXX,XX @@ static const hwaddr npcm7xx_emc_addr[] = {
68
0xf0826000,
69
};
70
71
+/* Register base address for each PSPI Module */
72
+static const hwaddr npcm7xx_pspi_addr[] = {
73
+ 0xf0200000,
74
+ 0xf0201000,
75
+};
76
+
77
static const struct {
78
hwaddr regs_addr;
79
uint32_t unconnected_pins;
80
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_init(Object *obj)
81
object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EMC);
82
}
83
84
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
85
+ object_initialize_child(obj, "pspi[*]", &s->pspi[i], TYPE_NPCM_PSPI);
86
+ }
87
+
88
object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI);
54
}
89
}
55
90
56
-/* Set PC and Thumb state from var. var is marked as dead.
91
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
57
+/*
92
sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc), 0,
58
+ * Set PC and Thumb state from var. var is marked as dead.
93
npcm7xx_irq(s, NPCM7XX_MMC_IRQ));
59
* For M-profile CPUs, include logic to detect exception-return
94
60
* branches and handle them. This is needed for Thumb POP/LDM to PC, LDR to PC,
95
+ /* PSPI */
61
* and BX reg, and no others, and happens only for code in Handler mode.
96
+ QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_pspi_addr) != ARRAY_SIZE(s->pspi));
62
+ * The Security Extension also requires us to check for the FNC_RETURN
97
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
63
+ * which signals a function return from non-secure state; this can happen
98
+ SysBusDevice *sbd = SYS_BUS_DEVICE(&s->pspi[i]);
64
+ * in both Handler and Thread mode.
99
+ int irq = (i == 0) ? NPCM7XX_PSPI1_IRQ : NPCM7XX_PSPI2_IRQ;
65
+ * To avoid having to do multiple comparisons in inline generated code,
100
+
66
+ * we make the check we do here loose, so it will match for EXC_RETURN
101
+ sysbus_realize(sbd, &error_abort);
67
+ * in Thread mode. For system emulation do_v7m_exception_exit() checks
102
+ sysbus_mmio_map(sbd, 0, npcm7xx_pspi_addr[i]);
68
+ * for these spurious cases and returns without doing anything (giving
103
+ sysbus_connect_irq(sbd, 0, npcm7xx_irq(s, irq));
69
+ * the same behaviour as for a branch to a non-magic address).
104
+ }
70
+ *
105
+
71
+ * In linux-user mode it is unclear what the right behaviour for an
106
create_unimplemented_device("npcm7xx.shm", 0xc0001000, 4 * KiB);
72
+ * attempted FNC_RETURN should be, because in real hardware this will go
107
create_unimplemented_device("npcm7xx.vdmx", 0xe0800000, 4 * KiB);
73
+ * directly to Secure code (ie not the Linux kernel) which will then treat
108
create_unimplemented_device("npcm7xx.pcierc", 0xe1000000, 64 * KiB);
74
+ * the error in any way it chooses. For QEMU we opt to make the FNC_RETURN
109
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
75
+ * attempt behave the way it would on a CPU without the security extension,
110
create_unimplemented_device("npcm7xx.peci", 0xf0100000, 4 * KiB);
76
+ * which is to say "like a normal branch". That means we can simply treat
111
create_unimplemented_device("npcm7xx.siox[1]", 0xf0101000, 4 * KiB);
77
+ * all branches as normal with no magic address behaviour.
112
create_unimplemented_device("npcm7xx.siox[2]", 0xf0102000, 4 * KiB);
78
*/
113
- create_unimplemented_device("npcm7xx.pspi1", 0xf0200000, 4 * KiB);
79
static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var)
114
- create_unimplemented_device("npcm7xx.pspi2", 0xf0201000, 4 * KiB);
80
{
115
create_unimplemented_device("npcm7xx.ahbpci", 0xf0400000, 1 * MiB);
81
@@ -XXX,XX +XXX,XX @@ static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var)
116
create_unimplemented_device("npcm7xx.mcphy", 0xf05f0000, 64 * KiB);
82
* s->base.is_jmp that we need to do the rest of the work later.
117
create_unimplemented_device("npcm7xx.gmac1", 0xf0802000, 8 * KiB);
83
*/
84
gen_bx(s, var);
85
+#ifndef CONFIG_USER_ONLY
86
if (arm_dc_feature(s, ARM_FEATURE_M_SECURITY) ||
87
(s->v7m_handler_mode && arm_dc_feature(s, ARM_FEATURE_M))) {
88
s->base.is_jmp = DISAS_BX_EXCRET;
89
}
90
+#endif
91
}
92
93
static inline void gen_bx_excret_final_code(DisasContext *s)
94
--
118
--
95
2.20.1
119
2.34.1
96
97
diff view generated by jsdifflib
New patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
2
3
Addresses targeting the second translation table (TTB1) in the SMMU have
4
all upper bits set. Ensure the IOMMU region covers all 64 bits.
5
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Message-id: 20230214171921.1917916-2-jean-philippe@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
include/hw/arm/smmu-common.h | 2 --
13
hw/arm/smmu-common.c | 2 +-
14
2 files changed, 1 insertion(+), 3 deletions(-)
15
16
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/smmu-common.h
19
+++ b/include/hw/arm/smmu-common.h
20
@@ -XXX,XX +XXX,XX @@
21
#define SMMU_PCI_DEVFN_MAX 256
22
#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
23
24
-#define SMMU_MAX_VA_BITS 48
25
-
26
/*
27
* Page table walk error types
28
*/
29
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/arm/smmu-common.c
32
+++ b/hw/arm/smmu-common.c
33
@@ -XXX,XX +XXX,XX @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn)
34
35
memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu),
36
s->mrtypename,
37
- OBJECT(s), name, 1ULL << SMMU_MAX_VA_BITS);
38
+ OBJECT(s), name, UINT64_MAX);
39
address_space_init(&sdev->as,
40
MEMORY_REGION(&sdev->iommu), name);
41
trace_smmu_add_mr(name);
42
--
43
2.34.1
diff view generated by jsdifflib
New patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
2
3
Addresses targeting the second translation table (TTB1) in the SMMU have
4
all upper bits set (except for the top byte when TBI is enabled). Fix
5
the TTB1 check.
6
7
Reported-by: Ola Hugosson <ola.hugosson@arm.com>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
11
Message-id: 20230214171921.1917916-3-jean-philippe@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/smmu-common.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/smmu-common.c
20
+++ b/hw/arm/smmu-common.c
21
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
22
/* there is a ttbr0 region and we are in it (high bits all zero) */
23
return &cfg->tt[0];
24
} else if (cfg->tt[1].tsz &&
25
- !extract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte)) {
26
+ sextract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte) == -1) {
27
/* there is a ttbr1 region and we are in it (high bits all one) */
28
return &cfg->tt[1];
29
} else if (!cfg->tt[0].tsz) {
30
--
31
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
As explained in commit aff39be0ed97:
3
make it clearer from the name that this is a tcg-only function.
4
4
5
Both functions, object_initialize() and object_property_add_child()
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
6
increase the reference counter of the new object, so one of the
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
references has to be dropped afterwards to get the reference
8
counting right. Otherwise the child object will not be properly
9
cleaned up when the parent gets destroyed.
10
Thus let's use now object_initialize_child() instead to get the
11
reference counting here right.
12
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: Thomas Huth <thuth@redhat.com>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20190823143249.8096-3-philmd@redhat.com
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
11
---
20
hw/arm/mcimx7d-sabre.c | 9 ++++-----
12
target/arm/helper.c | 4 ++--
21
hw/arm/mps2-tz.c | 15 +++++++--------
13
1 file changed, 2 insertions(+), 2 deletions(-)
22
hw/arm/musca.c | 9 +++++----
23
3 files changed, 16 insertions(+), 17 deletions(-)
24
14
25
diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/arm/mcimx7d-sabre.c
17
--- a/target/arm/helper.c
28
+++ b/hw/arm/mcimx7d-sabre.c
18
+++ b/target/arm/helper.c
29
@@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine)
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
20
* trapped to the hypervisor in KVM.
21
*/
22
#ifdef CONFIG_TCG
23
-static void handle_semihosting(CPUState *cs)
24
+static void tcg_handle_semihosting(CPUState *cs)
30
{
25
{
31
static struct arm_boot_info boot_info;
26
ARMCPU *cpu = ARM_CPU(cs);
32
MCIMX7Sabre *s = g_new0(MCIMX7Sabre, 1);
27
CPUARMState *env = &cpu->env;
33
- Object *soc;
28
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
34
int i;
35
36
if (machine->ram_size > FSL_IMX7_MMDC_SIZE) {
37
@@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine)
38
.nb_cpus = machine->smp.cpus,
39
};
40
41
- object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX7);
42
- soc = OBJECT(&s->soc);
43
- object_property_add_child(OBJECT(machine), "soc", soc, &error_fatal);
44
- object_property_set_bool(soc, true, "realized", &error_fatal);
45
+ object_initialize_child(OBJECT(machine), "soc",
46
+ &s->soc, sizeof(s->soc),
47
+ TYPE_FSL_IMX7, &error_fatal, NULL);
48
+ object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
49
50
memory_region_allocate_system_memory(&s->ram, NULL, "mcimx7d-sabre.ram",
51
machine->ram_size);
52
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/mps2-tz.c
55
+++ b/hw/arm/mps2-tz.c
56
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
57
/* The sec_resp_cfg output from the IoTKit must be split into multiple
58
* lines, one for each of the PPCs we create here, plus one per MSC.
59
*/
29
*/
60
- object_initialize(&mms->sec_resp_splitter, sizeof(mms->sec_resp_splitter),
30
#ifdef CONFIG_TCG
61
- TYPE_SPLIT_IRQ);
31
if (cs->exception_index == EXCP_SEMIHOST) {
62
- object_property_add_child(OBJECT(machine), "sec-resp-splitter",
32
- handle_semihosting(cs);
63
- OBJECT(&mms->sec_resp_splitter), &error_abort);
33
+ tcg_handle_semihosting(cs);
64
+ object_initialize_child(OBJECT(machine), "sec-resp-splitter",
34
return;
65
+ &mms->sec_resp_splitter,
35
}
66
+ sizeof(mms->sec_resp_splitter),
36
#endif
67
+ TYPE_SPLIT_IRQ, &error_abort, NULL);
68
object_property_set_int(OBJECT(&mms->sec_resp_splitter),
69
ARRAY_SIZE(mms->ppc) + ARRAY_SIZE(mms->msc),
70
"num-lines", &error_fatal);
71
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
72
* Tx, Rx and "combined" IRQs are sent to the NVIC separately.
73
* Create the OR gate for this.
74
*/
75
- object_initialize(&mms->uart_irq_orgate, sizeof(mms->uart_irq_orgate),
76
- TYPE_OR_IRQ);
77
- object_property_add_child(OBJECT(mms), "uart-irq-orgate",
78
- OBJECT(&mms->uart_irq_orgate), &error_abort);
79
+ object_initialize_child(OBJECT(mms), "uart-irq-orgate",
80
+ &mms->uart_irq_orgate, sizeof(mms->uart_irq_orgate),
81
+ TYPE_OR_IRQ, &error_abort, NULL);
82
object_property_set_int(OBJECT(&mms->uart_irq_orgate), 10, "num-lines",
83
&error_fatal);
84
object_property_set_bool(OBJECT(&mms->uart_irq_orgate), true,
85
diff --git a/hw/arm/musca.c b/hw/arm/musca.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/hw/arm/musca.c
88
+++ b/hw/arm/musca.c
89
@@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine)
90
* The sec_resp_cfg output from the SSE-200 must be split into multiple
91
* lines, one for each of the PPCs we create here.
92
*/
93
- object_initialize(&mms->sec_resp_splitter, sizeof(mms->sec_resp_splitter),
94
- TYPE_SPLIT_IRQ);
95
- object_property_add_child(OBJECT(machine), "sec-resp-splitter",
96
- OBJECT(&mms->sec_resp_splitter), &error_fatal);
97
+ object_initialize_child(OBJECT(machine), "sec-resp-splitter",
98
+ &mms->sec_resp_splitter,
99
+ sizeof(mms->sec_resp_splitter),
100
+ TYPE_SPLIT_IRQ, &error_fatal, NULL);
101
+
102
object_property_set_int(OBJECT(&mms->sec_resp_splitter),
103
ARRAY_SIZE(mms->ppc), "num-lines", &error_fatal);
104
object_property_set_bool(OBJECT(&mms->sec_resp_splitter), true,
105
--
37
--
106
2.20.1
38
2.34.1
107
39
108
40
diff view generated by jsdifflib
1
The function neon_store_reg32() doesn't free the TCG temp that it
1
From: Claudio Fontana <cfontana@suse.de>
2
is passed, so the caller must do that. We got this right in most
3
places but forgot to free the TCG temps in trans_VMOV_64_sp().
4
2
5
Cc: qemu-stable@nongnu.org
3
for "all" builds (tcg + kvm), we want to avoid doing
4
the psci check if tcg is built-in, but not enabled.
5
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Message-id: 20190827121931.26836-1-peter.maydell@linaro.org
10
---
11
---
11
target/arm/translate-vfp.inc.c | 2 ++
12
target/arm/helper.c | 3 ++-
12
1 file changed, 2 insertions(+)
13
1 file changed, 2 insertions(+), 1 deletion(-)
13
14
14
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-vfp.inc.c
17
--- a/target/arm/helper.c
17
+++ b/target/arm/translate-vfp.inc.c
18
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
19
@@ -XXX,XX +XXX,XX @@
19
/* gpreg to fpreg */
20
#include "hw/irq.h"
20
tmp = load_reg(s, a->rt);
21
#include "sysemu/cpu-timers.h"
21
neon_store_reg32(tmp, a->vm);
22
#include "sysemu/kvm.h"
22
+ tcg_temp_free_i32(tmp);
23
+#include "sysemu/tcg.h"
23
tmp = load_reg(s, a->rt2);
24
#include "qapi/qapi-commands-machine-target.h"
24
neon_store_reg32(tmp, a->vm + 1);
25
#include "qapi/error.h"
25
+ tcg_temp_free_i32(tmp);
26
#include "qemu/guest-random.h"
27
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
28
env->exception.syndrome);
26
}
29
}
27
30
28
return true;
31
- if (arm_is_psci_call(cpu, cs->exception_index)) {
32
+ if (tcg_enabled() && arm_is_psci_call(cpu, cs->exception_index)) {
33
arm_handle_psci_call(cpu);
34
qemu_log_mask(CPU_LOG_INT, "...handled as PSCI call\n");
35
return;
29
--
36
--
30
2.20.1
37
2.34.1
31
38
32
39
diff view generated by jsdifflib
1
The translation table walk for an ATS instruction can result in
1
From: Claudio Fontana <cfontana@suse.de>
2
various faults. In general these are just reported back via the
3
PAR_EL1 fault status fields, but in some cases the architecture
4
requires that the fault is turned into an exception:
5
* synchronous stage 2 faults of any kind during AT S1E0* and
6
AT S1E1* instructions executed from NS EL1 fault to EL2 or EL3
7
* synchronous external aborts are taken as Data Abort exceptions
8
2
9
(This is documented in the v8A Arm ARM DDI0487A.e D5.2.11 and
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
10
G5.13.4.)
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
15
Message-id: 20190816125802.25877-3-peter.maydell@linaro.org
16
---
8
---
17
target/arm/helper.c | 107 +++++++++++++++++++++++++++++++++++++-------
9
target/arm/helper.c | 12 +++++++-----
18
1 file changed, 92 insertions(+), 15 deletions(-)
10
1 file changed, 7 insertions(+), 5 deletions(-)
19
11
20
diff --git a/target/arm/helper.c b/target/arm/helper.c
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
21
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/helper.c
14
--- a/target/arm/helper.c
23
+++ b/target/arm/helper.c
15
+++ b/target/arm/helper.c
24
@@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
16
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
25
ret = get_phys_addr(env, value, access_type, mmu_idx, &phys_addr, &attrs,
17
unsigned int cur_el = arm_current_el(env);
26
&prot, &page_size, &fi, &cacheattrs);
18
int rt;
27
19
28
+ if (ret) {
20
- /*
21
- * Note that new_el can never be 0. If cur_el is 0, then
22
- * el0_a64 is is_a64(), else el0_a64 is ignored.
23
- */
24
- aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
25
+ if (tcg_enabled()) {
29
+ /*
26
+ /*
30
+ * Some kinds of translation fault must cause exceptions rather
27
+ * Note that new_el can never be 0. If cur_el is 0, then
31
+ * than being reported in the PAR.
28
+ * el0_a64 is is_a64(), else el0_a64 is ignored.
32
+ */
29
+ */
33
+ int current_el = arm_current_el(env);
30
+ aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
34
+ int target_el;
35
+ uint32_t syn, fsr, fsc;
36
+ bool take_exc = false;
37
+
38
+ if (fi.s1ptw && current_el == 1 && !arm_is_secure(env)
39
+ && (mmu_idx == ARMMMUIdx_S1NSE1 || mmu_idx == ARMMMUIdx_S1NSE0)) {
40
+ /*
41
+ * Synchronous stage 2 fault on an access made as part of the
42
+ * translation table walk for AT S1E0* or AT S1E1* insn
43
+ * executed from NS EL1. If this is a synchronous external abort
44
+ * and SCR_EL3.EA == 1, then we take a synchronous external abort
45
+ * to EL3. Otherwise the fault is taken as an exception to EL2,
46
+ * and HPFAR_EL2 holds the faulting IPA.
47
+ */
48
+ if (fi.type == ARMFault_SyncExternalOnWalk &&
49
+ (env->cp15.scr_el3 & SCR_EA)) {
50
+ target_el = 3;
51
+ } else {
52
+ env->cp15.hpfar_el2 = extract64(fi.s2addr, 12, 47) << 4;
53
+ target_el = 2;
54
+ }
55
+ take_exc = true;
56
+ } else if (fi.type == ARMFault_SyncExternalOnWalk) {
57
+ /*
58
+ * Synchronous external aborts during a translation table walk
59
+ * are taken as Data Abort exceptions.
60
+ */
61
+ if (fi.stage2) {
62
+ if (current_el == 3) {
63
+ target_el = 3;
64
+ } else {
65
+ target_el = 2;
66
+ }
67
+ } else {
68
+ target_el = exception_target_el(env);
69
+ }
70
+ take_exc = true;
71
+ }
72
+
73
+ if (take_exc) {
74
+ /* Construct FSR and FSC using same logic as arm_deliver_fault() */
75
+ if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
76
+ arm_s1_regime_using_lpae_format(env, mmu_idx)) {
77
+ fsr = arm_fi_to_lfsc(&fi);
78
+ fsc = extract32(fsr, 0, 6);
79
+ } else {
80
+ fsr = arm_fi_to_sfsc(&fi);
81
+ fsc = 0x3f;
82
+ }
83
+ /*
84
+ * Report exception with ESR indicating a fault due to a
85
+ * translation table walk for a cache maintenance instruction.
86
+ */
87
+ syn = syn_data_abort_no_iss(current_el == target_el,
88
+ fi.ea, 1, fi.s1ptw, 1, fsc);
89
+ env->exception.vaddress = value;
90
+ env->exception.fsr = fsr;
91
+ raise_exception(env, EXCP_DATA_ABORT, syn, target_el);
92
+ }
93
+ }
31
+ }
94
+
32
95
if (is_a64(env)) {
33
if (cur_el < new_el) {
96
format64 = true;
34
/*
97
} else if (arm_feature(env, ARM_FEATURE_LPAE)) {
98
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vapa_cp_reginfo[] = {
99
/* This underdecoding is safe because the reginfo is NO_RAW. */
100
{ .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY,
101
.access = PL1_W, .accessfn = ats_access,
102
- .writefn = ats_write, .type = ARM_CP_NO_RAW },
103
+ .writefn = ats_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
104
#endif
105
REGINFO_SENTINEL
106
};
107
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
108
/* 64 bit address translation operations */
109
{ .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64,
110
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0,
111
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
112
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
113
+ .writefn = ats_write64 },
114
{ .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64,
115
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1,
116
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
117
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
118
+ .writefn = ats_write64 },
119
{ .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64,
120
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2,
121
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
122
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
123
+ .writefn = ats_write64 },
124
{ .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64,
125
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3,
126
- .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
127
+ .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
128
+ .writefn = ats_write64 },
129
{ .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64,
130
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4,
131
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
132
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
133
+ .writefn = ats_write64 },
134
{ .name = "AT_S12E1W", .state = ARM_CP_STATE_AA64,
135
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 5,
136
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
137
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
138
+ .writefn = ats_write64 },
139
{ .name = "AT_S12E0R", .state = ARM_CP_STATE_AA64,
140
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 6,
141
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
142
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
143
+ .writefn = ats_write64 },
144
{ .name = "AT_S12E0W", .state = ARM_CP_STATE_AA64,
145
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 7,
146
- .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
147
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
148
+ .writefn = ats_write64 },
149
/* AT S1E2* are elsewhere as they UNDEF from EL3 if EL2 is not present */
150
{ .name = "AT_S1E3R", .state = ARM_CP_STATE_AA64,
151
.opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 0,
152
- .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
153
+ .access = PL3_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
154
+ .writefn = ats_write64 },
155
{ .name = "AT_S1E3W", .state = ARM_CP_STATE_AA64,
156
.opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 1,
157
- .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
158
+ .access = PL3_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC,
159
+ .writefn = ats_write64 },
160
{ .name = "PAR_EL1", .state = ARM_CP_STATE_AA64,
161
.type = ARM_CP_ALIAS,
162
.opc0 = 3, .opc1 = 0, .crn = 7, .crm = 4, .opc2 = 0,
163
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
164
{ .name = "AT_S1E2R", .state = ARM_CP_STATE_AA64,
165
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0,
166
.access = PL2_W, .accessfn = at_s1e2_access,
167
- .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
168
+ .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 },
169
{ .name = "AT_S1E2W", .state = ARM_CP_STATE_AA64,
170
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1,
171
.access = PL2_W, .accessfn = at_s1e2_access,
172
- .type = ARM_CP_NO_RAW, .writefn = ats_write64 },
173
+ .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 },
174
/* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE
175
* if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3
176
* with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose
177
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
178
*/
179
{ .name = "ATS1HR", .cp = 15, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0,
180
.access = PL2_W,
181
- .writefn = ats1h_write, .type = ARM_CP_NO_RAW },
182
+ .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
183
{ .name = "ATS1HW", .cp = 15, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1,
184
.access = PL2_W,
185
- .writefn = ats1h_write, .type = ARM_CP_NO_RAW },
186
+ .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
187
{ .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH,
188
.opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0,
189
/* ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the
190
--
35
--
191
2.20.1
36
2.34.1
192
37
193
38
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Commit ba1ba5cca introduce the ARM_CPU_TYPE_NAME() macro.
3
Move this earlier to make the next patch diff cleaner. While here
4
Unify the code base by use it in all places.
4
update the comment slightly to not give the impression that the
5
misalignment affects only TCG.
5
6
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20190823143249.8096-2-philmd@redhat.com
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
---
12
hw/arm/allwinner-a10.c | 3 ++-
13
target/arm/machine.c | 18 +++++++++---------
13
hw/arm/cubieboard.c | 3 ++-
14
1 file changed, 9 insertions(+), 9 deletions(-)
14
hw/arm/digic.c | 3 ++-
15
hw/arm/fsl-imx25.c | 2 +-
16
hw/arm/fsl-imx31.c | 2 +-
17
hw/arm/fsl-imx6.c | 3 ++-
18
hw/arm/fsl-imx6ul.c | 2 +-
19
hw/arm/xlnx-zynqmp.c | 8 ++++----
20
8 files changed, 15 insertions(+), 11 deletions(-)
21
15
22
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
16
diff --git a/target/arm/machine.c b/target/arm/machine.c
23
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/arm/allwinner-a10.c
18
--- a/target/arm/machine.c
25
+++ b/hw/arm/allwinner-a10.c
19
+++ b/target/arm/machine.c
26
@@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj)
20
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
27
AwA10State *s = AW_A10(obj);
21
}
28
29
object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
30
- "cortex-a8-" TYPE_ARM_CPU, &error_abort, NULL);
31
+ ARM_CPU_TYPE_NAME("cortex-a8"),
32
+ &error_abort, NULL);
33
34
sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc),
35
TYPE_AW_A10_PIC);
36
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/arm/cubieboard.c
39
+++ b/hw/arm/cubieboard.c
40
@@ -XXX,XX +XXX,XX @@ static void cubieboard_init(MachineState *machine)
41
42
static void cubieboard_machine_init(MachineClass *mc)
43
{
44
- mc->desc = "cubietech cubieboard";
45
+ mc->desc = "cubietech cubieboard (Cortex-A9)";
46
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9");
47
mc->init = cubieboard_init;
48
mc->block_default_type = IF_IDE;
49
mc->units_per_default_bus = 1;
50
diff --git a/hw/arm/digic.c b/hw/arm/digic.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/digic.c
53
+++ b/hw/arm/digic.c
54
@@ -XXX,XX +XXX,XX @@ static void digic_init(Object *obj)
55
int i;
56
57
object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu),
58
- "arm946-" TYPE_ARM_CPU, &error_abort, NULL);
59
+ ARM_CPU_TYPE_NAME("arm946"),
60
+ &error_abort, NULL);
61
62
for (i = 0; i < DIGIC4_NB_TIMERS; i++) {
63
#define DIGIC_TIMER_NAME_MLEN 11
64
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/hw/arm/fsl-imx25.c
67
+++ b/hw/arm/fsl-imx25.c
68
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
69
FslIMX25State *s = FSL_IMX25(obj);
70
int i;
71
72
- object_initialize(&s->cpu, sizeof(s->cpu), "arm926-" TYPE_ARM_CPU);
73
+ object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm926"));
74
75
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
76
TYPE_IMX_AVIC);
77
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/hw/arm/fsl-imx31.c
80
+++ b/hw/arm/fsl-imx31.c
81
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
82
FslIMX31State *s = FSL_IMX31(obj);
83
int i;
84
85
- object_initialize(&s->cpu, sizeof(s->cpu), "arm1136-" TYPE_ARM_CPU);
86
+ object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm1136"));
87
88
sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic),
89
TYPE_IMX_AVIC);
90
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/hw/arm/fsl-imx6.c
93
+++ b/hw/arm/fsl-imx6.c
94
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
95
for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6_NUM_CPUS); i++) {
96
snprintf(name, NAME_SIZE, "cpu%d", i);
97
object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]),
98
- "cortex-a9-" TYPE_ARM_CPU, &error_abort, NULL);
99
+ ARM_CPU_TYPE_NAME("cortex-a9"),
100
+ &error_abort, NULL);
101
}
22
}
102
23
103
sysbus_init_child_obj(obj, "a9mpcore", &s->a9mpcore, sizeof(s->a9mpcore),
24
+ /*
104
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
25
+ * Misaligned thumb pc is architecturally impossible. Fail the
105
index XXXXXXX..XXXXXXX 100644
26
+ * incoming migration. For TCG it would trigger the assert in
106
--- a/hw/arm/fsl-imx6ul.c
27
+ * thumb_tr_translate_insn().
107
+++ b/hw/arm/fsl-imx6ul.c
28
+ */
108
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_init(Object *obj)
29
+ if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
109
int i;
30
+ return -1;
110
31
+ }
111
object_initialize_child(obj, "cpu0", &s->cpu, sizeof(s->cpu),
32
+
112
- "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL);
33
hw_breakpoint_update_all(cpu);
113
+ ARM_CPU_TYPE_NAME("cortex-a7"), &error_abort, NULL);
34
hw_watchpoint_update_all(cpu);
114
35
115
/*
36
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
116
* A7MPCORE
37
}
117
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
118
index XXXXXXX..XXXXXXX 100644
119
--- a/hw/arm/xlnx-zynqmp.c
120
+++ b/hw/arm/xlnx-zynqmp.c
121
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,
122
123
object_initialize_child(OBJECT(&s->rpu_cluster), "rpu-cpu[*]",
124
&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]),
125
- "cortex-r5f-" TYPE_ARM_CPU, &error_abort,
126
- NULL);
127
+ ARM_CPU_TYPE_NAME("cortex-r5f"),
128
+ &error_abort, NULL);
129
130
name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i]));
131
if (strcmp(name, boot_cpu)) {
132
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(Object *obj)
133
for (i = 0; i < num_apus; i++) {
134
object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]",
135
&s->apu_cpu[i], sizeof(s->apu_cpu[i]),
136
- "cortex-a53-" TYPE_ARM_CPU, &error_abort,
137
- NULL);
138
+ ARM_CPU_TYPE_NAME("cortex-a53"),
139
+ &error_abort, NULL);
140
}
38
}
141
39
142
sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic),
40
- /*
41
- * Misaligned thumb pc is architecturally impossible.
42
- * We have an assert in thumb_tr_translate_insn to verify this.
43
- * Fail an incoming migrate to avoid this assert.
44
- */
45
- if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
46
- return -1;
47
- }
48
-
49
if (!kvm_enabled()) {
50
pmu_op_finish(&cpu->env);
51
}
143
--
52
--
144
2.20.1
53
2.34.1
145
54
146
55
diff view generated by jsdifflib
1
From: Andrew Jeffery <andrew@aj.id.au>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
First up: This is not the way the hardware behaves.
3
Since commit cf7c6d1004 ("target/arm: Split out cpregs.h") we now have
4
4
a cpregs.h header which is more suitable for this code.
5
However, it helps resolve real-world problems with short periods being
5
6
used under Linux. Commit 4451d3f59f2a ("clocksource/drivers/fttmr010:
6
Code moved verbatim.
7
Fix set_next_event handler") in Linux fixed the timer driver to
7
8
correctly schedule the next event for the Aspeed controller, and in
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
combination with 5daa8212c08e ("ARM: dts: aspeed: Describe random number
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
device") Linux will now set a timer with a period as low as 1us.
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Configuring a qemu timer with such a short period results in spending
13
time handling the interrupt in the model rather than executing guest
14
code, leading to noticeable "sticky" behaviour in the guest.
15
16
The behaviour of Linux is correct with respect to the hardware, so we
17
need to improve our handling under emulation. The approach chosen is to
18
provide back-pressure information by calculating an acceptable minimum
19
number of ticks to be set on the model. Under Linux an additional read
20
is added in the timer configuration path to detect back-pressure, which
21
will never occur on hardware. However if back-pressure is observed, the
22
driver alerts the clock event subsystem, which then performs its own
23
next event dilation via a config option - d1748302f70b ("clockevents:
24
Make minimum delay adjustments configurable")
25
26
A minimum period of 5us was experimentally determined on a Lenovo
27
T480s, which I've increased to 20us for "safety".
28
29
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
30
Reviewed-by: Joel Stanley <joel@jms.id.au>
31
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
32
Tested-by: Joel Stanley <joel@jms.id.au>
33
Signed-off-by: Cédric Le Goater <clg@kaod.org>
34
Message-id: 20190704055150.4899-1-clg@kaod.org
35
[clg: - changed the computation of min_ticks to be done each time the
36
timer value is reloaded. It removes the ordering issue of the
37
timer and scu reset handlers but is slightly slower ]
38
- introduced TIMER_MIN_NS
39
- introduced calculate_min_ticks() ]
40
Signed-off-by: Cédric Le Goater <clg@kaod.org>
41
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
42
---
13
---
43
hw/timer/aspeed_timer.c | 17 ++++++++++++++++-
14
target/arm/cpregs.h | 98 +++++++++++++++++++++++++++++++++++++++++++++
44
1 file changed, 16 insertions(+), 1 deletion(-)
15
target/arm/cpu.h | 91 -----------------------------------------
45
16
2 files changed, 98 insertions(+), 91 deletions(-)
46
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
17
18
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
47
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/timer/aspeed_timer.c
20
--- a/target/arm/cpregs.h
49
+++ b/hw/timer/aspeed_timer.c
21
+++ b/target/arm/cpregs.h
50
@@ -XXX,XX +XXX,XX @@ enum timer_ctrl_op {
22
@@ -XXX,XX +XXX,XX @@ enum {
51
op_pulse_enable
23
ARM_CP_SME = 1 << 19,
52
};
24
};
53
25
54
+/*
26
+/*
55
+ * Minimum value of the reload register to filter out short period
27
+ * Interface for defining coprocessor registers.
56
+ * timers which have a noticeable impact in emulation. 5us should be
28
+ * Registers are defined in tables of arm_cp_reginfo structs
57
+ * enough, use 20us for "safety".
29
+ * which are passed to define_arm_cp_regs().
58
+ */
30
+ */
59
+#define TIMER_MIN_NS (20 * SCALE_US)
31
+
60
+
32
+/*
61
/**
33
+ * When looking up a coprocessor register we look for it
62
* Avoid mutual references between AspeedTimerCtrlState and AspeedTimer
34
+ * via an integer which encodes all of:
63
* structs, as it's a waste of memory. The ptimer BH callback needs to know
35
+ * coprocessor number
64
@@ -XXX,XX +XXX,XX @@ static inline uint32_t calculate_ticks(struct AspeedTimer *t, uint64_t now_ns)
36
+ * Crn, Crm, opc1, opc2 fields
65
return t->reload - MIN(t->reload, ticks);
37
+ * 32 or 64 bit register (ie is it accessed via MRC/MCR
66
}
38
+ * or via MRRC/MCRR?)
67
39
+ * non-secure/secure bank (AArch32 only)
68
+static uint32_t calculate_min_ticks(AspeedTimer *t, uint32_t value)
40
+ * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field.
41
+ * (In this case crn and opc2 should be zero.)
42
+ * For AArch64, there is no 32/64 bit size distinction;
43
+ * instead all registers have a 2 bit op0, 3 bit op1 and op2,
44
+ * and 4 bit CRn and CRm. The encoding patterns are chosen
45
+ * to be easy to convert to and from the KVM encodings, and also
46
+ * so that the hashtable can contain both AArch32 and AArch64
47
+ * registers (to allow for interprocessing where we might run
48
+ * 32 bit code on a 64 bit core).
49
+ */
50
+/*
51
+ * This bit is private to our hashtable cpreg; in KVM register
52
+ * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64
53
+ * in the upper bits of the 64 bit ID.
54
+ */
55
+#define CP_REG_AA64_SHIFT 28
56
+#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT)
57
+
58
+/*
59
+ * To enable banking of coprocessor registers depending on ns-bit we
60
+ * add a bit to distinguish between secure and non-secure cpregs in the
61
+ * hashtable.
62
+ */
63
+#define CP_REG_NS_SHIFT 29
64
+#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT)
65
+
66
+#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \
67
+ ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \
68
+ ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
69
+
70
+#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
71
+ (CP_REG_AA64_MASK | \
72
+ ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
73
+ ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
74
+ ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
75
+ ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
76
+ ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \
77
+ ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT))
78
+
79
+/*
80
+ * Convert a full 64 bit KVM register ID to the truncated 32 bit
81
+ * version used as a key for the coprocessor register hashtable
82
+ */
83
+static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid)
69
+{
84
+{
70
+ uint32_t rate = calculate_rate(t);
85
+ uint32_t cpregid = kvmid;
71
+ uint32_t min_ticks = muldiv64(TIMER_MIN_NS, rate, NANOSECONDS_PER_SECOND);
86
+ if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
72
+
87
+ cpregid |= CP_REG_AA64_MASK;
73
+ return value < min_ticks ? min_ticks : value;
88
+ } else {
89
+ if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
90
+ cpregid |= (1 << 15);
91
+ }
92
+
93
+ /*
94
+ * KVM is always non-secure so add the NS flag on AArch32 register
95
+ * entries.
96
+ */
97
+ cpregid |= 1 << CP_REG_NS_SHIFT;
98
+ }
99
+ return cpregid;
74
+}
100
+}
75
+
101
+
76
static inline uint64_t calculate_time(struct AspeedTimer *t, uint32_t ticks)
102
+/*
103
+ * Convert a truncated 32 bit hashtable key into the full
104
+ * 64 bit KVM register ID.
105
+ */
106
+static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
107
+{
108
+ uint64_t kvmid;
109
+
110
+ if (cpregid & CP_REG_AA64_MASK) {
111
+ kvmid = cpregid & ~CP_REG_AA64_MASK;
112
+ kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64;
113
+ } else {
114
+ kvmid = cpregid & ~(1 << 15);
115
+ if (cpregid & (1 << 15)) {
116
+ kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM;
117
+ } else {
118
+ kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM;
119
+ }
120
+ }
121
+ return kvmid;
122
+}
123
+
124
/*
125
* Valid values for ARMCPRegInfo state field, indicating which of
126
* the AArch32 and AArch64 execution states this register is visible in.
127
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
128
index XXXXXXX..XXXXXXX 100644
129
--- a/target/arm/cpu.h
130
+++ b/target/arm/cpu.h
131
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
132
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
133
uint32_t cur_el, bool secure);
134
135
-/* Interface for defining coprocessor registers.
136
- * Registers are defined in tables of arm_cp_reginfo structs
137
- * which are passed to define_arm_cp_regs().
138
- */
139
-
140
-/* When looking up a coprocessor register we look for it
141
- * via an integer which encodes all of:
142
- * coprocessor number
143
- * Crn, Crm, opc1, opc2 fields
144
- * 32 or 64 bit register (ie is it accessed via MRC/MCR
145
- * or via MRRC/MCRR?)
146
- * non-secure/secure bank (AArch32 only)
147
- * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field.
148
- * (In this case crn and opc2 should be zero.)
149
- * For AArch64, there is no 32/64 bit size distinction;
150
- * instead all registers have a 2 bit op0, 3 bit op1 and op2,
151
- * and 4 bit CRn and CRm. The encoding patterns are chosen
152
- * to be easy to convert to and from the KVM encodings, and also
153
- * so that the hashtable can contain both AArch32 and AArch64
154
- * registers (to allow for interprocessing where we might run
155
- * 32 bit code on a 64 bit core).
156
- */
157
-/* This bit is private to our hashtable cpreg; in KVM register
158
- * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64
159
- * in the upper bits of the 64 bit ID.
160
- */
161
-#define CP_REG_AA64_SHIFT 28
162
-#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT)
163
-
164
-/* To enable banking of coprocessor registers depending on ns-bit we
165
- * add a bit to distinguish between secure and non-secure cpregs in the
166
- * hashtable.
167
- */
168
-#define CP_REG_NS_SHIFT 29
169
-#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT)
170
-
171
-#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \
172
- ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \
173
- ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2))
174
-
175
-#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \
176
- (CP_REG_AA64_MASK | \
177
- ((cp) << CP_REG_ARM_COPROC_SHIFT) | \
178
- ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \
179
- ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \
180
- ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \
181
- ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \
182
- ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT))
183
-
184
-/* Convert a full 64 bit KVM register ID to the truncated 32 bit
185
- * version used as a key for the coprocessor register hashtable
186
- */
187
-static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid)
188
-{
189
- uint32_t cpregid = kvmid;
190
- if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
191
- cpregid |= CP_REG_AA64_MASK;
192
- } else {
193
- if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) {
194
- cpregid |= (1 << 15);
195
- }
196
-
197
- /* KVM is always non-secure so add the NS flag on AArch32 register
198
- * entries.
199
- */
200
- cpregid |= 1 << CP_REG_NS_SHIFT;
201
- }
202
- return cpregid;
203
-}
204
-
205
-/* Convert a truncated 32 bit hashtable key into the full
206
- * 64 bit KVM register ID.
207
- */
208
-static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
209
-{
210
- uint64_t kvmid;
211
-
212
- if (cpregid & CP_REG_AA64_MASK) {
213
- kvmid = cpregid & ~CP_REG_AA64_MASK;
214
- kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64;
215
- } else {
216
- kvmid = cpregid & ~(1 << 15);
217
- if (cpregid & (1 << 15)) {
218
- kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM;
219
- } else {
220
- kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM;
221
- }
222
- }
223
- return kvmid;
224
-}
225
-
226
/* Return the highest implemented Exception Level */
227
static inline int arm_highest_el(CPUARMState *env)
77
{
228
{
78
uint64_t delta_ns;
79
@@ -XXX,XX +XXX,XX @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg,
80
switch (reg) {
81
case TIMER_REG_RELOAD:
82
old_reload = t->reload;
83
- t->reload = value;
84
+ t->reload = calculate_min_ticks(t, value);
85
86
/* If the reload value was not previously set, or zero, and
87
* the current value is valid, try to start the timer if it is
88
--
229
--
89
2.20.1
230
2.34.1
90
231
91
232
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Both object_initialize() and qdev_set_parent_bus() increase the
3
If a test was tagged with the "accel" tag and the specified
4
reference counter of the new object, so one of the references has
4
accelerator it not present in the qemu binary, cancel the test.
5
to be dropped afterwards to get the reference counting right.
6
In machine model code this refcount leak is not particularly
7
problematic because (unlike devices) machines will never be
8
created on demand via QMP, and they are never destroyed.
9
But in any case let's use the new sysbus_init_child_obj() instead
10
to get the reference counting here right.
11
5
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
We can now write tests without explicit calls to require_accelerator,
7
just the tag is enough.
8
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20190823143249.8096-4-philmd@redhat.com
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15
[PMM: rewrote commit message]
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
13
---
18
hw/arm/exynos4_boards.c | 4 ++--
14
tests/avocado/avocado_qemu/__init__.py | 4 ++++
19
1 file changed, 2 insertions(+), 2 deletions(-)
15
1 file changed, 4 insertions(+)
20
16
21
diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
17
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
22
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/arm/exynos4_boards.c
19
--- a/tests/avocado/avocado_qemu/__init__.py
24
+++ b/hw/arm/exynos4_boards.c
20
+++ b/tests/avocado/avocado_qemu/__init__.py
25
@@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine,
21
@@ -XXX,XX +XXX,XX @@ def setUp(self):
26
exynos4_boards_init_ram(s, get_system_memory(),
22
27
exynos4_board_ram_size[board_type]);
23
super().setUp('qemu-system-')
28
24
29
- object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
25
+ accel_required = self._get_unique_tag_val('accel')
30
- qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default());
26
+ if accel_required:
31
+ sysbus_init_child_obj(OBJECT(machine), "soc",
27
+ self.require_accelerator(accel_required)
32
+ &s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
28
+
33
object_property_set_bool(OBJECT(&s->soc), true, "realized",
29
self.machine = self.params.get('machine',
34
&error_fatal);
30
default=self._get_unique_tag_val('machine'))
35
31
36
--
32
--
37
2.20.1
33
2.34.1
38
34
39
35
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
The previous simplification got the order of operands to the
3
This allows the test to be skipped when TCG is not present in the QEMU
4
subtraction wrong. Since the 64-bit product is the subtrahend,
4
binary.
5
we must use a 64-bit subtract to properly compute the borrow
6
from the low-part of the product.
7
5
8
Fixes: 5f8cd06ebcf5 ("target/arm: Simplify SMMLA, SMMLAR, SMMLS, SMMLSR")
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
12
Message-id: 20190829013258.16102-1-richard.henderson@linaro.org
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
10
---
16
target/arm/translate.c | 20 ++++++++++++++++++--
11
tests/avocado/boot_linux_console.py | 1 +
17
1 file changed, 18 insertions(+), 2 deletions(-)
12
tests/avocado/reverse_debugging.py | 8 ++++++++
13
2 files changed, 9 insertions(+)
18
14
19
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate.c
17
--- a/tests/avocado/boot_linux_console.py
22
+++ b/target/arm/translate.c
18
+++ b/tests/avocado/boot_linux_console.py
23
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
19
@@ -XXX,XX +XXX,XX @@ def test_arm_orangepi_uboot_netbsd9(self):
24
if (rd != 15) {
20
25
tmp3 = load_reg(s, rd);
21
def test_aarch64_raspi3_atf(self):
26
if (insn & (1 << 6)) {
22
"""
27
- tcg_gen_sub_i32(tmp, tmp, tmp3);
23
+ :avocado: tags=accel:tcg
28
+ /*
24
:avocado: tags=arch:aarch64
29
+ * For SMMLS, we need a 64-bit subtract.
25
:avocado: tags=machine:raspi3b
30
+ * Borrow caused by a non-zero multiplicand
26
:avocado: tags=cpu:cortex-a53
31
+ * lowpart, and the correct result lowpart
27
diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py
32
+ * for rounding.
28
index XXXXXXX..XXXXXXX 100644
33
+ */
29
--- a/tests/avocado/reverse_debugging.py
34
+ TCGv_i32 zero = tcg_const_i32(0);
30
+++ b/tests/avocado/reverse_debugging.py
35
+ tcg_gen_sub2_i32(tmp2, tmp, zero, tmp3,
31
@@ -XXX,XX +XXX,XX @@ def reverse_debugging(self, shift=7, args=None):
36
+ tmp2, tmp);
32
vm.shutdown()
37
+ tcg_temp_free_i32(zero);
33
38
} else {
34
class ReverseDebugging_X86_64(ReverseDebugging):
39
tcg_gen_add_i32(tmp, tmp, tmp3);
35
+ """
40
}
36
+ :avocado: tags=accel:tcg
41
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
37
+ """
42
if (insn & (1 << 20)) {
38
+
43
tcg_gen_add_i32(tmp, tmp, tmp3);
39
REG_PC = 0x10
44
} else {
40
REG_CS = 0x12
45
- tcg_gen_sub_i32(tmp, tmp, tmp3);
41
def get_pc(self, g):
46
+ /*
42
@@ -XXX,XX +XXX,XX @@ def test_x86_64_pc(self):
47
+ * For SMMLS, we need a 64-bit subtract.
43
self.reverse_debugging()
48
+ * Borrow caused by a non-zero multiplicand lowpart,
44
49
+ * and the correct result lowpart for rounding.
45
class ReverseDebugging_AArch64(ReverseDebugging):
50
+ */
46
+ """
51
+ TCGv_i32 zero = tcg_const_i32(0);
47
+ :avocado: tags=accel:tcg
52
+ tcg_gen_sub2_i32(tmp2, tmp, zero, tmp3, tmp2, tmp);
48
+ """
53
+ tcg_temp_free_i32(zero);
49
+
54
}
50
REG_PC = 32
55
tcg_temp_free_i32(tmp3);
51
56
}
52
# unidentified gitlab timeout problem
57
--
53
--
58
2.20.1
54
2.34.1
59
55
60
56
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
Now that the cortex-a15 is under CONFIG_TCG, use as default CPU for a
4
KVM-only build the 'max' cpu.
5
6
Note that we cannot use 'host' here because the qtests can run without
7
any other accelerator (than qtest) and 'host' depends on KVM being
8
enabled.
9
10
Signed-off-by: Fabiano Rosas <farosas@suse.de>
11
Acked-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Thomas Huth <thuth@redhat.com>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
hw/arm/virt.c | 4 ++++
16
1 file changed, 4 insertions(+)
17
18
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/virt.c
21
+++ b/hw/arm/virt.c
22
@@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
23
mc->minimum_page_bits = 12;
24
mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
25
mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
26
+#ifdef CONFIG_TCG
27
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
28
+#else
29
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
30
+#endif
31
mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
32
mc->kvm_type = virt_kvm_type;
33
assert(!mc->get_hotplug_handler);
34
--
35
2.34.1
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Acked-by: Thomas Huth <thuth@redhat.com>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
tests/qtest/arm-cpu-features.c | 28 ++++++++++++++++++----------
9
1 file changed, 18 insertions(+), 10 deletions(-)
10
11
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/tests/qtest/arm-cpu-features.c
14
+++ b/tests/qtest/arm-cpu-features.c
15
@@ -XXX,XX +XXX,XX @@
16
#define SVE_MAX_VQ 16
17
18
#define MACHINE "-machine virt,gic-version=max -accel tcg "
19
-#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
20
+#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
21
#define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \
22
" 'arguments': { 'type': 'full', "
23
#define QUERY_TAIL "}}"
24
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
25
{
26
g_test_init(&argc, &argv, NULL);
27
28
- qtest_add_data_func("/arm/query-cpu-model-expansion",
29
- NULL, test_query_cpu_model_expansion);
30
+ if (qtest_has_accel("tcg")) {
31
+ qtest_add_data_func("/arm/query-cpu-model-expansion",
32
+ NULL, test_query_cpu_model_expansion);
33
+ }
34
+
35
+ if (!g_str_equal(qtest_get_arch(), "aarch64")) {
36
+ goto out;
37
+ }
38
39
/*
40
* For now we only run KVM specific tests with AArch64 QEMU in
41
* order avoid attempting to run an AArch32 QEMU with KVM on
42
* AArch64 hosts. That won't work and isn't easy to detect.
43
*/
44
- if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) {
45
+ if (qtest_has_accel("kvm")) {
46
/*
47
* This tests target the 'host' CPU type, so register it only if
48
* KVM is available.
49
*/
50
qtest_add_data_func("/arm/kvm/query-cpu-model-expansion",
51
NULL, test_query_cpu_model_expansion_kvm);
52
- }
53
54
- if (g_str_equal(qtest_get_arch(), "aarch64")) {
55
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
56
- NULL, sve_tests_sve_max_vq_8);
57
- qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
58
- NULL, sve_tests_sve_off);
59
qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off",
60
NULL, sve_tests_sve_off_kvm);
61
}
62
63
+ if (qtest_has_accel("tcg")) {
64
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8",
65
+ NULL, sve_tests_sve_max_vq_8);
66
+ qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off",
67
+ NULL, sve_tests_sve_off);
68
+ }
69
+
70
+out:
71
return g_test_run();
72
}
73
--
74
2.34.1
diff view generated by jsdifflib
New patch
1
From: Fabiano Rosas <farosas@suse.de>
1
2
3
These tests set -accel tcg, so restrict them to when TCG is present.
4
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
Acked-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Thomas Huth <thuth@redhat.com>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
tests/qtest/meson.build | 4 ++--
11
1 file changed, 2 insertions(+), 2 deletions(-)
12
13
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/qtest/meson.build
16
+++ b/tests/qtest/meson.build
17
@@ -XXX,XX +XXX,XX @@ qtests_arm = \
18
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
19
qtests_aarch64 = \
20
(cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
21
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \
22
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \
23
+ (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
24
+ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \
25
(config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
26
(config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \
27
['arm-cpu-features',
28
--
29
2.34.1
diff view generated by jsdifflib