1
target-arm queue: nothing big, just a collection of minor things.
1
The following changes since commit 003ba52a8b327180e284630b289c6ece5a3e08b9:
2
2
3
-- PMM
3
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-02-16 11:16:39 +0000)
4
5
The following changes since commit ae3aa5da96f4ccf0c2a28851449d92db9fcfad71:
6
7
Merge remote-tracking branch 'remotes/berrange/tags/socket-next-pull-request' into staging (2020-05-21 16:47:28 +0100)
8
4
9
are available in the Git repository at:
5
are available in the Git repository at:
10
6
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200521
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230216
12
8
13
for you to fetch changes up to 17b5df7b65d0192c5d775b5e1581518580774c77:
9
for you to fetch changes up to caf01d6a435d9f4a95aeae2f9fc6cb8b889b1fb8:
14
10
15
linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32 (2020-05-21 20:00:19 +0100)
11
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG (2023-02-16 16:28:53 +0000)
16
12
17
----------------------------------------------------------------
13
----------------------------------------------------------------
18
target-arm queue:
14
target-arm queue:
19
* tests/acceptance: Add a test for the canon-a1100 machine
15
* Some mostly M-profile-related code cleanups
20
* docs/system: Document some of the Arm development boards
16
* avocado: Retire the boot_linux.py AArch64 TCG tests
21
* linux-user: make BKPT insn cause SIGTRAP, not be a syscall
17
* hw/arm/smmuv3: Add GBPA register
22
* target/arm: Remove unused GEN_NEON_INTEGER_OP macro
18
* arm/virt: don't try to spell out the accelerator
23
* fsl-imx25, fsl-imx31, fsl-imx6, fsl-imx6ul, fsl-imx7: implement watchdog
19
* hw/arm: Attach PSPI module to NPCM7XX SoC
24
* hw/arm: Use qemu_log_mask() instead of hw_error() in various places
20
* Some cleanup/refactoring patches aiming towards
25
* ARM: PL061: Introduce N_GPIOS
21
allowing building Arm targets without CONFIG_TCG
26
* target/arm: Improve clear_vec_high() usage
27
* target/arm: Allow user-mode code to write CPSR.E via MSR
28
* linux-user/arm: Reset CPSR_E when entering a signal handler
29
* linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32
30
22
31
----------------------------------------------------------------
23
----------------------------------------------------------------
32
Amanieu d'Antras (1):
24
Alex Bennée (1):
33
linux-user/arm: Reset CPSR_E when entering a signal handler
25
tests/avocado: retire the Aarch64 TCG tests from boot_linux.py
34
26
35
Geert Uytterhoeven (1):
27
Claudio Fontana (3):
36
ARM: PL061: Introduce N_GPIOS
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()
37
31
38
Guenter Roeck (8):
32
Cornelia Huck (1):
39
hw: Move i.MX watchdog driver to hw/watchdog
33
arm/virt: don't try to spell out the accelerator
40
hw/watchdog: Implement full i.MX watchdog support
41
hw/arm/fsl-imx25: Wire up watchdog
42
hw/arm/fsl-imx31: Wire up watchdog
43
hw/arm/fsl-imx6: Connect watchdog interrupts
44
hw/arm/fsl-imx6ul: Connect watchdog interrupts
45
hw/arm/fsl-imx7: Instantiate various unimplemented devices
46
hw/arm/fsl-imx7: Connect watchdog interrupts
47
34
48
Peter Maydell (12):
35
Fabiano Rosas (7):
49
docs/system: Add 'Arm' to the Integrator/CP document title
36
target/arm: Move PC alignment check
50
docs/system: Sort Arm board index into alphabetical order
37
target/arm: Move cpregs code out of cpu.h
51
docs/system: Document Arm Versatile Express boards
38
tests/avocado: Skip tests that require a missing accelerator
52
docs/system: Document the various MPS2 models
39
tests/avocado: Tag TCG tests with accel:tcg
53
docs/system: Document Musca boards
40
target/arm: Use "max" as default cpu for the virt machine with KVM
54
linux-user/arm: BKPT should cause SIGTRAP, not be a syscall
41
tests/qtest: arm-cpu-features: Match tests to required accelerators
55
linux-user/arm: Remove bogus SVC 0xf0002 handling
42
tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG
56
linux-user/arm: Handle invalid arm-specific syscalls correctly
57
linux-user/arm: Fix identification of syscall numbers
58
target/arm: Remove unused GEN_NEON_INTEGER_OP macro
59
target/arm: Allow user-mode code to write CPSR.E via MSR
60
linux-user/arm/signal.c: Drop TARGET_CONFIG_CPU_32
61
43
62
Philippe Mathieu-Daudé (4):
44
Hao Wu (3):
63
hw/arm/integratorcp: Replace hw_error() by qemu_log_mask()
45
MAINTAINERS: Add myself to maintainers and remove Havard
64
hw/arm/pxa2xx: Replace hw_error() by qemu_log_mask()
46
hw/ssi: Add Nuvoton PSPI Module
65
hw/char/xilinx_uartlite: Replace hw_error() by qemu_log_mask()
47
hw/arm: Attach PSPI module to NPCM7XX SoC
66
hw/timer/exynos4210_mct: Replace hw_error() by qemu_log_mask()
67
48
68
Richard Henderson (2):
49
Jean-Philippe Brucker (2):
69
target/arm: Use tcg_gen_gvec_mov for clear_vec_high
50
hw/arm/smmu-common: Support 64-bit addresses
70
target/arm: Use clear_vec_high more effectively
51
hw/arm/smmu-common: Fix TTB1 handling
71
52
72
Thomas Huth (1):
53
Mostafa Saleh (1):
73
tests/acceptance: Add a test for the canon-a1100 machine
54
hw/arm/smmuv3: Add GBPA register
74
55
75
docs/system/arm/integratorcp.rst | 4 +-
56
Philippe Mathieu-Daudé (12):
76
docs/system/arm/mps2.rst | 29 +++
57
hw/intc/armv7m_nvic: Use OBJECT_DECLARE_SIMPLE_TYPE() macro
77
docs/system/arm/musca.rst | 31 +++
58
target/arm: Simplify arm_v7m_mmu_idx_for_secstate() for user emulation
78
docs/system/arm/vexpress.rst | 60 ++++++
59
target/arm: Reduce arm_v7m_mmu_idx_[all/for_secstate_and_priv]() scope
79
docs/system/target-arm.rst | 20 +-
60
target/arm: Constify ID_PFR1 on user emulation
80
include/hw/arm/fsl-imx25.h | 5 +
61
target/arm: Convert CPUARMState::eabi to boolean
81
include/hw/arm/fsl-imx31.h | 4 +
62
target/arm: Avoid resetting CPUARMState::eabi field
82
include/hw/arm/fsl-imx6.h | 2 +-
63
target/arm: Restrict CPUARMState::gicv3state to sysemu
83
include/hw/arm/fsl-imx6ul.h | 2 +-
64
target/arm: Restrict CPUARMState::arm_boot_info to sysemu
84
include/hw/arm/fsl-imx7.h | 23 ++-
65
target/arm: Restrict CPUARMState::nvic to sysemu
85
include/hw/misc/imx2_wdt.h | 33 ----
66
target/arm: Store CPUARMState::nvic as NVICState*
86
include/hw/watchdog/wdt_imx2.h | 90 +++++++++
67
target/arm: Declare CPU <-> NVIC helpers in 'hw/intc/armv7m_nvic.h'
87
target/arm/cpu.h | 2 +-
68
hw/arm: Add missing XLNX_ZYNQMP_ARM -> USB_DWC3 Kconfig dependency
88
hw/arm/fsl-imx25.c | 10 +
89
hw/arm/fsl-imx31.c | 6 +
90
hw/arm/fsl-imx6.c | 9 +
91
hw/arm/fsl-imx6ul.c | 10 +
92
hw/arm/fsl-imx7.c | 35 ++++
93
hw/arm/integratorcp.c | 23 ++-
94
hw/arm/pxa2xx_gpio.c | 7 +-
95
hw/char/xilinx_uartlite.c | 5 +-
96
hw/display/pxa2xx_lcd.c | 8 +-
97
hw/dma/pxa2xx_dma.c | 14 +-
98
hw/gpio/pl061.c | 12 +-
99
hw/misc/imx2_wdt.c | 90 ---------
100
hw/timer/exynos4210_mct.c | 12 +-
101
hw/watchdog/wdt_imx2.c | 303 +++++++++++++++++++++++++++++
102
linux-user/arm/cpu_loop.c | 145 ++++++++------
103
linux-user/arm/signal.c | 15 +-
104
target/arm/translate-a64.c | 63 +++---
105
target/arm/translate.c | 23 ---
106
MAINTAINERS | 6 +
107
hw/arm/Kconfig | 5 +
108
hw/misc/Makefile.objs | 1 -
109
hw/watchdog/Kconfig | 3 +
110
hw/watchdog/Makefile.objs | 1 +
111
tests/acceptance/machine_arm_canona1100.py | 35 ++++
112
37 files changed, 854 insertions(+), 292 deletions(-)
113
create mode 100644 docs/system/arm/mps2.rst
114
create mode 100644 docs/system/arm/musca.rst
115
create mode 100644 docs/system/arm/vexpress.rst
116
delete mode 100644 include/hw/misc/imx2_wdt.h
117
create mode 100644 include/hw/watchdog/wdt_imx2.h
118
delete mode 100644 hw/misc/imx2_wdt.c
119
create mode 100644 hw/watchdog/wdt_imx2.c
120
create mode 100644 tests/acceptance/machine_arm_canona1100.py
121
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: Amanieu d'Antras <amanieu@gmail.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
This fixes signal handlers running with the wrong endianness if the
3
Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro,
4
interrupted code used SETEND to dynamically switch endianness.
4
similarly to automatic conversion from commit 8063396bf3
5
("Use OBJECT_DECLARE_SIMPLE_TYPE when possible").
5
6
6
Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200511131117.2486486-1-amanieu@gmail.com
9
Message-id: 20230206223502.25122-2-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
linux-user/arm/signal.c | 8 +++++++-
12
include/hw/intc/armv7m_nvic.h | 5 +----
12
1 file changed, 7 insertions(+), 1 deletion(-)
13
1 file changed, 1 insertion(+), 4 deletions(-)
13
14
14
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
15
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/linux-user/arm/signal.c
17
--- a/include/hw/intc/armv7m_nvic.h
17
+++ b/linux-user/arm/signal.c
18
+++ b/include/hw/intc/armv7m_nvic.h
18
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
19
@@ -XXX,XX +XXX,XX @@
19
} else {
20
#include "qom/object.h"
20
cpsr &= ~CPSR_T;
21
21
}
22
#define TYPE_NVIC "armv7m_nvic"
22
+ if (env->cp15.sctlr_el[1] & SCTLR_E0E) {
23
-
23
+ cpsr |= CPSR_E;
24
-typedef struct NVICState NVICState;
24
+ } else {
25
-DECLARE_INSTANCE_CHECKER(NVICState, NVIC,
25
+ cpsr &= ~CPSR_E;
26
- TYPE_NVIC)
26
+ }
27
+OBJECT_DECLARE_SIMPLE_TYPE(NVICState, NVIC)
27
28
28
if (ka->sa_flags & TARGET_SA_RESTORER) {
29
/* Highest permitted number of exceptions (architectural limit) */
29
if (is_fdpic) {
30
#define NVIC_MAX_VECTORS 512
30
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
31
env->regs[13] = frame_addr;
32
env->regs[14] = retcode;
33
env->regs[15] = handler & (thumb ? ~1 : ~3);
34
- cpsr_write(env, cpsr, CPSR_IT | CPSR_T, CPSRWriteByInstr);
35
+ cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr);
36
+ arm_rebuild_hflags(env);
37
38
return 0;
39
}
40
--
31
--
41
2.20.1
32
2.34.1
42
33
43
34
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The 8-byte store for the end a !is_q operation can be
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
4
merged with the other stores. Use a no-op vector move
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
to trigger the expand_clr portion of tcg_gen_gvec_mov.
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
6
Message-id: 20230206223502.25122-3-philmd@linaro.org
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200519212453.28494-2-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
8
---
12
target/arm/translate-a64.c | 10 ++--------
9
target/arm/m_helper.c | 11 ++++++++---
13
1 file changed, 2 insertions(+), 8 deletions(-)
10
1 file changed, 8 insertions(+), 3 deletions(-)
14
11
15
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
12
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-a64.c
14
--- a/target/arm/m_helper.c
18
+++ b/target/arm/translate-a64.c
15
+++ b/target/arm/m_helper.c
19
@@ -XXX,XX +XXX,XX @@ static void clear_vec_high(DisasContext *s, bool is_q, int rd)
16
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
20
unsigned ofs = fp_reg_offset(s, rd, MO_64);
17
return 0;
21
unsigned vsz = vec_full_reg_size(s);
22
23
- if (!is_q) {
24
- TCGv_i64 tcg_zero = tcg_const_i64(0);
25
- tcg_gen_st_i64(tcg_zero, cpu_env, ofs + 8);
26
- tcg_temp_free_i64(tcg_zero);
27
- }
28
- if (vsz > 16) {
29
- tcg_gen_gvec_dup_imm(MO_64, ofs + 16, vsz - 16, vsz - 16, 0);
30
- }
31
+ /* Nop move, with side effect of clearing the tail. */
32
+ tcg_gen_gvec_mov(MO_64, ofs, ofs, is_q ? 16 : 8, vsz);
33
}
18
}
34
19
35
void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v)
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 */
27
28
/*
29
* What kind of stack write are we doing? This affects how exceptions
30
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
31
return tt_resp;
32
}
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 */
36
--
45
--
37
2.20.1
46
2.34.1
38
47
39
48
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
With this patch, the watchdog on i.MX31 emulations is fully operational.
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
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20200517162135.110364-5-linux@roeck-us.net
9
Message-id: 20230206223502.25122-4-philmd@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
11
---
10
include/hw/arm/fsl-imx31.h | 4 ++++
12
target/arm/internals.h | 14 --------
11
hw/arm/fsl-imx31.c | 6 ++++++
13
target/arm/m_helper.c | 74 +++++++++++++++++++++---------------------
12
hw/arm/Kconfig | 1 +
14
2 files changed, 37 insertions(+), 51 deletions(-)
13
3 files changed, 11 insertions(+)
14
15
15
diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx31.h
18
--- a/target/arm/internals.h
18
+++ b/include/hw/arm/fsl-imx31.h
19
+++ b/target/arm/internals.h
19
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx)
20
#include "hw/timer/imx_epit.h"
21
21
#include "hw/i2c/imx_i2c.h"
22
int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx);
22
#include "hw/gpio/imx_gpio.h"
23
23
+#include "hw/watchdog/wdt_imx2.h"
24
-/*
24
#include "exec/memory.h"
25
- * Return the MMU index for a v7M CPU with all relevant information
25
#include "target/arm/cpu.h"
26
- * manually specified.
26
27
- */
27
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX31State {
28
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
28
IMXEPITState epit[FSL_IMX31_NUM_EPITS];
29
- bool secstate, bool priv, bool negpri);
29
IMXI2CState i2c[FSL_IMX31_NUM_I2CS];
30
-
30
IMXGPIOState gpio[FSL_IMX31_NUM_GPIOS];
31
-/*
31
+ IMX2WdtState wdt;
32
- * Return the MMU index for a v7M CPU in the specified security and
32
MemoryRegion secure_rom;
33
- * privilege state.
33
MemoryRegion rom;
34
- */
34
MemoryRegion iram;
35
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
35
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX31State {
36
- bool secstate, bool priv);
36
#define FSL_IMX31_GPIO1_SIZE 0x4000
37
-
37
#define FSL_IMX31_GPIO2_ADDR 0x53FD0000
38
/* Return the MMU index for a v7M CPU in the specified security state */
38
#define FSL_IMX31_GPIO2_SIZE 0x4000
39
ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);
39
+#define FSL_IMX31_WDT_ADDR 0x53FDC000
40
40
+#define FSL_IMX31_WDT_SIZE 0x4000
41
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
41
#define FSL_IMX31_AVIC_ADDR 0x68000000
42
#define FSL_IMX31_AVIC_SIZE 0x100
43
#define FSL_IMX31_SDRAM0_ADDR 0x80000000
44
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
45
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/fsl-imx31.c
43
--- a/target/arm/m_helper.c
47
+++ b/hw/arm/fsl-imx31.c
44
+++ b/target/arm/m_helper.c
48
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj)
45
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
49
sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]),
46
50
TYPE_IMX_GPIO);
47
#else /* !CONFIG_USER_ONLY */
51
}
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;
52
+
53
+
53
+ sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
54
+ if (priv) {
55
+ mmu_idx |= ARM_MMU_IDX_M_PRIV;
56
+ }
57
+
58
+ if (negpri) {
59
+ mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
60
+ }
61
+
62
+ if (secstate) {
63
+ mmu_idx |= ARM_MMU_IDX_M_S;
64
+ }
65
+
66
+ return mmu_idx;
67
+}
68
+
69
+static ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
70
+ bool secstate, bool priv)
71
+{
72
+ bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
73
+
74
+ return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
75
+}
76
+
77
+/* Return the MMU index for a v7M CPU in the specified security state */
78
+ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
79
+{
80
+ bool priv = arm_v7m_is_handler_mode(env) ||
81
+ !(env->v7m.control[secstate] & 1);
82
+
83
+ return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
84
+}
85
+
86
/*
87
* What kind of stack write are we doing? This affects how exceptions
88
* generated during the stacking are treated.
89
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
90
return tt_resp;
54
}
91
}
55
92
56
static void fsl_imx31_realize(DeviceState *dev, Error **errp)
93
-ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env,
57
@@ -XXX,XX +XXX,XX @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
94
- bool secstate, bool priv, bool negpri)
58
gpio_table[i].irq));
95
-{
59
}
96
- ARMMMUIdx mmu_idx = ARM_MMU_IDX_M;
60
97
-
61
+ /* Watchdog */
98
- if (priv) {
62
+ object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
99
- mmu_idx |= ARM_MMU_IDX_M_PRIV;
63
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR);
100
- }
64
+
101
-
65
/* On a real system, the first 16k is a `secure boot rom' */
102
- if (negpri) {
66
memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom",
103
- mmu_idx |= ARM_MMU_IDX_M_NEGPRI;
67
FSL_IMX31_SECURE_ROM_SIZE, &err);
104
- }
68
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
105
-
69
index XXXXXXX..XXXXXXX 100644
106
- if (secstate) {
70
--- a/hw/arm/Kconfig
107
- mmu_idx |= ARM_MMU_IDX_M_S;
71
+++ b/hw/arm/Kconfig
108
- }
72
@@ -XXX,XX +XXX,XX @@ config FSL_IMX31
109
-
73
select SERIAL
110
- return mmu_idx;
74
select IMX
111
-}
75
select IMX_I2C
112
-
76
+ select WDT_IMX2
113
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env,
77
select LAN9118
114
- bool secstate, bool priv)
78
115
-{
79
config FSL_IMX6
116
- bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate);
117
-
118
- return arm_v7m_mmu_idx_all(env, secstate, priv, negpri);
119
-}
120
-
121
-/* Return the MMU index for a v7M CPU in the specified security state */
122
-ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
123
-{
124
- bool priv = arm_v7m_is_handler_mode(env) ||
125
- !(env->v7m.control[secstate] & 1);
126
-
127
- return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv);
128
-}
129
-
130
#endif /* !CONFIG_USER_ONLY */
80
--
131
--
81
2.20.1
132
2.34.1
82
133
83
134
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
the accesses as unimplemented or guest error.
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
5
Message-id: 20230206223502.25122-5-philmd@linaro.org
6
When fuzzing the devices, we don't want the whole process to
7
exit. Replace some hw_error() calls by qemu_log_mask().
8
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20200518140309.5220-3-f4bug@amsat.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
7
---
14
hw/arm/pxa2xx_gpio.c | 7 ++++---
8
target/arm/helper.c | 12 ++++++++++--
15
hw/display/pxa2xx_lcd.c | 8 +++++---
9
1 file changed, 10 insertions(+), 2 deletions(-)
16
hw/dma/pxa2xx_dma.c | 14 +++++++++-----
17
3 files changed, 18 insertions(+), 11 deletions(-)
18
10
19
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
11
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/pxa2xx_gpio.c
13
--- a/target/arm/helper.c
22
+++ b/hw/arm/pxa2xx_gpio.c
14
+++ b/target/arm/helper.c
23
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
24
25
#include "qemu/osdep.h"
26
#include "cpu.h"
27
-#include "hw/hw.h"
28
#include "hw/irq.h"
29
#include "hw/qdev-properties.h"
30
#include "hw/sysbus.h"
31
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_gpio_read(void *opaque, hwaddr offset,
32
return s->status[bank];
33
34
default:
35
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
36
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
37
+ __func__, offset);
38
}
39
40
return 0;
41
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_gpio_write(void *opaque, hwaddr offset,
42
break;
43
44
default:
45
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
46
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
47
+ __func__, offset);
48
}
16
}
49
}
17
}
50
18
51
diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c
19
+#ifndef CONFIG_USER_ONLY
52
index XXXXXXX..XXXXXXX 100644
20
/*
53
--- a/hw/display/pxa2xx_lcd.c
21
* We don't know until after realize whether there's a GICv3
54
+++ b/hw/display/pxa2xx_lcd.c
22
* attached, and that is what registers the gicv3 sysregs.
55
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri)
56
*/
24
return pfr1;
57
58
#include "qemu/osdep.h"
59
-#include "hw/hw.h"
60
+#include "qemu/log.h"
61
#include "hw/irq.h"
62
#include "migration/vmstate.h"
63
#include "ui/console.h"
64
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_lcdc_read(void *opaque, hwaddr offset,
65
66
default:
67
fail:
68
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
69
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
70
+ __func__, offset);
71
}
72
73
return 0;
74
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_lcdc_write(void *opaque, hwaddr offset,
75
76
default:
77
fail:
78
- hw_error("%s: Bad offset " REG_FMT "\n", __func__, offset);
79
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
80
+ __func__, offset);
81
}
82
}
25
}
83
26
84
diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c
27
-#ifndef CONFIG_USER_ONLY
85
index XXXXXXX..XXXXXXX 100644
28
static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
86
--- a/hw/dma/pxa2xx_dma.c
29
{
87
+++ b/hw/dma/pxa2xx_dma.c
30
ARMCPU *cpu = env_archcpu(env);
88
@@ -XXX,XX +XXX,XX @@
31
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
89
*/
32
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1,
90
33
.access = PL1_R, .type = ARM_CP_NO_RAW,
91
#include "qemu/osdep.h"
34
.accessfn = access_aa32_tid3,
92
+#include "qemu/log.h"
35
+#ifdef CONFIG_USER_ONLY
93
#include "hw/hw.h"
36
+ .type = ARM_CP_CONST,
94
#include "hw/irq.h"
37
+ .resetvalue = cpu->isar.id_pfr1,
95
#include "hw/qdev-properties.h"
38
+#else
96
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
39
+ .type = ARM_CP_NO_RAW,
97
unsigned int channel;
40
+ .accessfn = access_aa32_tid3,
98
41
.readfn = id_pfr1_read,
99
if (size != 4) {
42
- .writefn = arm_cp_write_ignore },
100
- hw_error("%s: Bad access width\n", __func__);
43
+ .writefn = arm_cp_write_ignore
101
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad access width %u\n",
44
+#endif
102
+ __func__, size);
45
+ },
103
return 5;
46
{ .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH,
104
}
47
.opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2,
105
48
.access = PL1_R, .type = ARM_CP_CONST,
106
@@ -XXX,XX +XXX,XX @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset,
107
return s->chan[channel].cmd;
108
}
109
}
110
-
111
- hw_error("%s: Bad offset 0x" TARGET_FMT_plx "\n", __func__, offset);
112
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
113
+ __func__, offset);
114
return 7;
115
}
116
117
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
118
unsigned int channel;
119
120
if (size != 4) {
121
- hw_error("%s: Bad access width\n", __func__);
122
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad access width %u\n",
123
+ __func__, size);
124
return;
125
}
126
127
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_dma_write(void *opaque, hwaddr offset,
128
break;
129
}
130
fail:
131
- hw_error("%s: Bad offset " TARGET_FMT_plx "\n", __func__, offset);
132
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
133
+ __func__, offset);
134
}
135
}
136
137
--
49
--
138
2.20.1
50
2.34.1
139
51
140
52
diff view generated by jsdifflib
1
In linux-user/arm/cpu-loop.c we incorrectly treat EXCP_BKPT similarly
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
to EXCP_SWI, which means that if the guest executes a BKPT insn then
3
QEMU will perform a syscall for it (which syscall depends on what
4
value happens to be in r7...). The correct behaviour is that the
5
guest process should take a SIGTRAP.
6
2
7
This code has been like this (more or less) since commit
3
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
8
06c949e62a098f in 2006 which added BKPT in the first place. This is
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
probably because at the time the same code path was used to handle
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
both Linux syscalls and semihosting calls, and (on M profile) BKPT
6
Message-id: 20230206223502.25122-6-philmd@linaro.org
11
with a suitable magic number is used for semihosting calls. But
12
these days we've moved handling of semihosting out to an entirely
13
different codepath, so we can fix this bug by simply removing this
14
handling of EXCP_BKPT and instead making it deliver a SIGTRAP like
15
EXCP_DEBUG (as we do already on aarch64).
16
17
Reported-by: <omerg681@gmail.com>
18
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
19
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Message-id: 20200420212206.12776-2-peter.maydell@linaro.org
22
Fixes: https://bugs.launchpad.net/qemu/+bug/1873898
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
---
8
---
25
linux-user/arm/cpu_loop.c | 30 ++++++++----------------------
9
linux-user/user-internals.h | 2 +-
26
1 file changed, 8 insertions(+), 22 deletions(-)
10
target/arm/cpu.h | 2 +-
11
linux-user/arm/cpu_loop.c | 4 ++--
12
3 files changed, 4 insertions(+), 4 deletions(-)
27
13
14
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/linux-user/user-internals.h
17
+++ b/linux-user/user-internals.h
18
@@ -XXX,XX +XXX,XX @@ void print_termios(void *arg);
19
#ifdef TARGET_ARM
20
static inline int regpairs_aligned(CPUArchState *cpu_env, int num)
21
{
22
- return cpu_env->eabi == 1;
23
+ return cpu_env->eabi;
24
}
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];
28
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
40
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
29
index XXXXXXX..XXXXXXX 100644
41
index XXXXXXX..XXXXXXX 100644
30
--- a/linux-user/arm/cpu_loop.c
42
--- a/linux-user/arm/cpu_loop.c
31
+++ b/linux-user/arm/cpu_loop.c
43
+++ b/linux-user/arm/cpu_loop.c
32
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
44
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
33
}
34
break;
45
break;
35
case EXCP_SWI:
46
case EXCP_SWI:
36
- case EXCP_BKPT:
37
{
47
{
38
env->eabi = 1;
48
- env->eabi = 1;
49
+ env->eabi = true;
39
/* system call */
50
/* system call */
40
- if (trapnr == EXCP_BKPT) {
51
if (env->thumb) {
41
- if (env->thumb) {
52
/* Thumb is always EABI style with syscall number in r7 */
42
- /* FIXME - what to do if get_user() fails? */
53
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
43
- get_user_code_u16(insn, env->regs[15], env);
54
* > 0xfffff and are handled below as out-of-range.
44
- n = insn & 0xff;
55
*/
45
- env->regs[15] += 2;
56
n ^= ARM_SYSCALL_BASE;
46
- } else {
57
- env->eabi = 0;
47
- /* FIXME - what to do if get_user() fails? */
58
+ env->eabi = false;
48
- get_user_code_u32(insn, env->regs[15], env);
59
}
49
- n = (insn & 0xf) | ((insn >> 4) & 0xff0);
50
- env->regs[15] += 4;
51
- }
52
+ if (env->thumb) {
53
+ /* FIXME - what to do if get_user() fails? */
54
+ get_user_code_u16(insn, env->regs[15] - 2, env);
55
+ n = insn & 0xff;
56
} else {
57
- if (env->thumb) {
58
- /* FIXME - what to do if get_user() fails? */
59
- get_user_code_u16(insn, env->regs[15] - 2, env);
60
- n = insn & 0xff;
61
- } else {
62
- /* FIXME - what to do if get_user() fails? */
63
- get_user_code_u32(insn, env->regs[15] - 4, env);
64
- n = insn & 0xffffff;
65
- }
66
+ /* FIXME - what to do if get_user() fails? */
67
+ get_user_code_u32(insn, env->regs[15] - 4, env);
68
+ n = insn & 0xffffff;
69
}
60
}
70
61
71
if (n == ARM_NR_cacheflush) {
72
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
73
}
74
break;
75
case EXCP_DEBUG:
76
+ case EXCP_BKPT:
77
excp_debug:
78
info.si_signo = TARGET_SIGTRAP;
79
info.si_errno = 0;
80
--
62
--
81
2.20.1
63
2.34.1
82
64
83
65
diff view generated by jsdifflib
1
Using the MSR instruction to write to CPSR.E is deprecated, but it is
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
required to work from any mode including unprivileged code. We were
3
incorrectly forbidding usermode code from writing it because
4
CPSR_USER did not include the CPSR_E bit.
5
2
6
We use CPSR_USER in only three places:
3
Although the 'eabi' field is only used in user emulation where
7
* as the mask of what to allow userspace MSR to write to CPSR
4
CPU reset doesn't occur, it doesn't belong to the area to reset.
8
* when deciding what bits a linux-user signal-return should be
5
Move it after the 'end_reset_fields' for consistency.
9
able to write from the sigcontext structure
10
* in target_user_copy_regs() when we set up the initial
11
registers for the linux-user process
12
6
13
In the first two cases not being able to update CPSR.E is a bug, and
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
in the third case it doesn't matter because CPSR.E is always 0 there.
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15
So we can fix both bugs by adding CPSR_E to CPSR_USER.
9
Message-id: 20230206223502.25122-7-philmd@linaro.org
16
17
Because the cpsr_write() in restore_sigcontext() is now changing
18
a CPSR bit which is cached in hflags, we need to add an
19
arm_rebuild_hflags() call there; the callsite in
20
target_user_copy_regs() was already rebuilding hflags for other
21
reasons.
22
23
(The recommended way to change CPSR.E is to use the 'SETEND'
24
instruction, which we do correctly allow from usermode code.)
25
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
28
Message-id: 20200518142801.20503-1-peter.maydell@linaro.org
29
---
11
---
30
target/arm/cpu.h | 2 +-
12
target/arm/cpu.h | 9 ++++-----
31
linux-user/arm/signal.c | 1 +
13
1 file changed, 4 insertions(+), 5 deletions(-)
32
2 files changed, 2 insertions(+), 1 deletion(-)
33
14
34
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
35
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/cpu.h
17
--- a/target/arm/cpu.h
37
+++ b/target/arm/cpu.h
18
+++ b/target/arm/cpu.h
38
@@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu);
19
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
39
#define CACHED_CPSR_BITS (CPSR_T | CPSR_AIF | CPSR_GE | CPSR_IT | CPSR_Q \
20
ARMVectorReg zarray[ARM_MAX_VQ * 16];
40
| CPSR_NZCV)
41
/* Bits writable in user mode. */
42
-#define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE)
43
+#define CPSR_USER (CPSR_NZCV | CPSR_Q | CPSR_GE | CPSR_E)
44
/* Execution state bits. MRS read as zero, MSR writes ignored. */
45
#define CPSR_EXEC (CPSR_T | CPSR_IT | CPSR_J | CPSR_IL)
46
47
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/linux-user/arm/signal.c
50
+++ b/linux-user/arm/signal.c
51
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
52
#ifdef TARGET_CONFIG_CPU_32
53
__get_user(cpsr, &sc->arm_cpsr);
54
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
55
+ arm_rebuild_hflags(env);
56
#endif
21
#endif
57
22
58
err |= !valid_user_regs(env);
23
-#if defined(CONFIG_USER_ONLY)
24
- /* For usermode syscall translation. */
25
- bool eabi;
26
-#endif
27
-
28
struct CPUBreakpoint *cpu_breakpoint[16];
29
struct CPUWatchpoint *cpu_watchpoint[16];
30
31
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
32
const struct arm_boot_info *boot_info;
33
/* Store GICv3CPUState to access from this struct */
34
void *gicv3state;
35
+#if defined(CONFIG_USER_ONLY)
36
+ /* For usermode syscall translation. */
37
+ bool eabi;
38
+#endif /* CONFIG_USER_ONLY */
39
40
#ifdef TARGET_TAGGED_ADDRESSES
41
/* Linux syscall tagged address support */
59
--
42
--
60
2.20.1
43
2.34.1
61
44
62
45
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
the accesses as unimplemented or guest error.
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
5
Message-id: 20230206223502.25122-8-philmd@linaro.org
6
When fuzzing the devices, we don't want the whole process to
7
exit. Replace some hw_error() calls by qemu_log_mask().
8
9
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
Message-id: 20200518140309.5220-4-f4bug@amsat.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
7
---
15
hw/char/xilinx_uartlite.c | 5 +++--
8
target/arm/cpu.h | 3 ++-
16
1 file changed, 3 insertions(+), 2 deletions(-)
9
1 file changed, 2 insertions(+), 1 deletion(-)
17
10
18
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/char/xilinx_uartlite.c
13
--- a/target/arm/cpu.h
21
+++ b/hw/char/xilinx_uartlite.c
14
+++ b/target/arm/cpu.h
22
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
23
*/
16
24
17
void *nvic;
25
#include "qemu/osdep.h"
18
const struct arm_boot_info *boot_info;
26
-#include "hw/hw.h"
19
+#if !defined(CONFIG_USER_ONLY)
27
+#include "qemu/log.h"
20
/* Store GICv3CPUState to access from this struct */
28
#include "hw/irq.h"
21
void *gicv3state;
29
#include "hw/qdev-properties.h"
22
-#if defined(CONFIG_USER_ONLY)
30
#include "hw/sysbus.h"
23
+#else /* CONFIG_USER_ONLY */
31
@@ -XXX,XX +XXX,XX @@ uart_write(void *opaque, hwaddr addr,
24
/* For usermode syscall translation. */
32
switch (addr)
25
bool eabi;
33
{
26
#endif /* CONFIG_USER_ONLY */
34
case R_STATUS:
35
- hw_error("write to UART STATUS?\n");
36
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: write to UART STATUS\n",
37
+ __func__);
38
break;
39
40
case R_CTRL:
41
--
27
--
42
2.20.1
28
2.34.1
43
29
44
30
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Instantiating PWM, CAN, CAAM, and OCOTP devices is necessary to avoid
3
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
crashes when booting mainline Linux.
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
5
Message-id: 20230206223502.25122-9-philmd@linaro.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Message-id: 20200517162135.110364-8-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
7
---
11
include/hw/arm/fsl-imx7.h | 16 ++++++++++++++++
8
target/arm/cpu.h | 2 +-
12
hw/arm/fsl-imx7.c | 24 ++++++++++++++++++++++++
9
1 file changed, 1 insertion(+), 1 deletion(-)
13
2 files changed, 40 insertions(+)
14
10
15
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
16
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx7.h
13
--- a/target/arm/cpu.h
18
+++ b/include/hw/arm/fsl-imx7.h
14
+++ b/target/arm/cpu.h
19
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
20
FSL_IMX7_IOMUXC_GPR_ADDR = 0x30340000,
16
} sau;
21
FSL_IMX7_IOMUXCn_SIZE = 0x1000,
17
22
18
void *nvic;
23
+ FSL_IMX7_OCOTP_ADDR = 0x30350000,
19
- const struct arm_boot_info *boot_info;
24
+ FSL_IMX7_OCOTP_SIZE = 0x10000,
20
#if !defined(CONFIG_USER_ONLY)
25
+
21
+ const struct arm_boot_info *boot_info;
26
FSL_IMX7_ANALOG_ADDR = 0x30360000,
22
/* Store GICv3CPUState to access from this struct */
27
FSL_IMX7_SNVS_ADDR = 0x30370000,
23
void *gicv3state;
28
FSL_IMX7_CCM_ADDR = 0x30380000,
24
#else /* CONFIG_USER_ONLY */
29
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
30
FSL_IMX7_ADC2_ADDR = 0x30620000,
31
FSL_IMX7_ADCn_SIZE = 0x1000,
32
33
+ FSL_IMX7_PWM1_ADDR = 0x30660000,
34
+ FSL_IMX7_PWM2_ADDR = 0x30670000,
35
+ FSL_IMX7_PWM3_ADDR = 0x30680000,
36
+ FSL_IMX7_PWM4_ADDR = 0x30690000,
37
+ FSL_IMX7_PWMn_SIZE = 0x10000,
38
+
39
FSL_IMX7_PCIE_PHY_ADDR = 0x306D0000,
40
FSL_IMX7_PCIE_PHY_SIZE = 0x10000,
41
42
FSL_IMX7_GPC_ADDR = 0x303A0000,
43
44
+ FSL_IMX7_CAAM_ADDR = 0x30900000,
45
+ FSL_IMX7_CAAM_SIZE = 0x40000,
46
+
47
+ FSL_IMX7_CAN1_ADDR = 0x30A00000,
48
+ FSL_IMX7_CAN2_ADDR = 0x30A10000,
49
+ FSL_IMX7_CANn_SIZE = 0x10000,
50
+
51
FSL_IMX7_I2C1_ADDR = 0x30A20000,
52
FSL_IMX7_I2C2_ADDR = 0x30A30000,
53
FSL_IMX7_I2C3_ADDR = 0x30A40000,
54
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/hw/arm/fsl-imx7.c
57
+++ b/hw/arm/fsl-imx7.c
58
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
59
*/
60
create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
61
62
+ /*
63
+ * CAAM
64
+ */
65
+ create_unimplemented_device("caam", FSL_IMX7_CAAM_ADDR, FSL_IMX7_CAAM_SIZE);
66
+
67
+ /*
68
+ * PWM
69
+ */
70
+ create_unimplemented_device("pwm1", FSL_IMX7_PWM1_ADDR, FSL_IMX7_PWMn_SIZE);
71
+ create_unimplemented_device("pwm2", FSL_IMX7_PWM2_ADDR, FSL_IMX7_PWMn_SIZE);
72
+ create_unimplemented_device("pwm3", FSL_IMX7_PWM3_ADDR, FSL_IMX7_PWMn_SIZE);
73
+ create_unimplemented_device("pwm4", FSL_IMX7_PWM4_ADDR, FSL_IMX7_PWMn_SIZE);
74
+
75
+ /*
76
+ * CAN
77
+ */
78
+ create_unimplemented_device("can1", FSL_IMX7_CAN1_ADDR, FSL_IMX7_CANn_SIZE);
79
+ create_unimplemented_device("can2", FSL_IMX7_CAN2_ADDR, FSL_IMX7_CANn_SIZE);
80
+
81
+ /*
82
+ * OCOTP
83
+ */
84
+ create_unimplemented_device("ocotp", FSL_IMX7_OCOTP_ADDR,
85
+ FSL_IMX7_OCOTP_SIZE);
86
87
object_property_set_bool(OBJECT(&s->gpr), true, "realized",
88
&error_abort);
89
--
25
--
90
2.20.1
26
2.34.1
91
27
92
28
diff view generated by jsdifflib
1
The GEN_NEON_INTEGER_OP macro is no longer used; remove it.
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20230206223502.25122-10-philmd@linaro.org
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
---
7
---
6
target/arm/translate.c | 23 -----------------------
8
target/arm/cpu.h | 2 +-
7
1 file changed, 23 deletions(-)
9
1 file changed, 1 insertion(+), 1 deletion(-)
8
10
9
diff --git a/target/arm/translate.c b/target/arm/translate.c
11
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
10
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
11
--- a/target/arm/translate.c
13
--- a/target/arm/cpu.h
12
+++ b/target/arm/translate.c
14
+++ b/target/arm/cpu.h
13
@@ -XXX,XX +XXX,XX @@ static inline void gen_neon_rsb(int size, TCGv_i32 t0, TCGv_i32 t1)
15
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
14
default: return 1; \
16
uint32_t ctrl;
15
}} while (0)
17
} sau;
16
18
17
-#define GEN_NEON_INTEGER_OP(name) do { \
19
- void *nvic;
18
- switch ((size << 1) | u) { \
20
#if !defined(CONFIG_USER_ONLY)
19
- case 0: \
21
+ void *nvic;
20
- gen_helper_neon_##name##_s8(tmp, tmp, tmp2); \
22
const struct arm_boot_info *boot_info;
21
- break; \
23
/* Store GICv3CPUState to access from this struct */
22
- case 1: \
24
void *gicv3state;
23
- gen_helper_neon_##name##_u8(tmp, tmp, tmp2); \
24
- break; \
25
- case 2: \
26
- gen_helper_neon_##name##_s16(tmp, tmp, tmp2); \
27
- break; \
28
- case 3: \
29
- gen_helper_neon_##name##_u16(tmp, tmp, tmp2); \
30
- break; \
31
- case 4: \
32
- gen_helper_neon_##name##_s32(tmp, tmp, tmp2); \
33
- break; \
34
- case 5: \
35
- gen_helper_neon_##name##_u32(tmp, tmp, tmp2); \
36
- break; \
37
- default: return 1; \
38
- }} while (0)
39
-
40
static TCGv_i32 neon_load_scratch(int scratch)
41
{
42
TCGv_i32 tmp = tcg_temp_new_i32();
43
--
25
--
44
2.20.1
26
2.34.1
45
27
46
28
diff view generated by jsdifflib
1
Our code to identify syscall numbers has some issues:
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
* for Thumb mode, we never need the immediate value from the insn,
2
3
but we always read it anyway
3
There is no point in using a void pointer to access the NVIC.
4
* bad immediate values in the svc insn should cause a SIGILL, but we
4
Use the real type to avoid casting it while debugging.
5
were abort()ing instead (via "goto error")
5
6
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
We can fix both these things by refactoring the code that identifies
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
the syscall number to more closely follow the kernel COMPAT_OABI code:
8
Message-id: 20230206223502.25122-11-philmd@linaro.org
9
* for Thumb it is always r7
10
* for Arm, if the immediate value is 0, then this is an EABI call
11
with the syscall number in r7
12
* otherwise, we XOR the immediate value with 0x900000
13
(ARM_SYSCALL_BASE for QEMU; __NR_OABI_SYSCALL_BASE in the kernel),
14
which converts valid syscall immediates into the desired value,
15
and puts all invalid immediates in the range 0x100000 or above
16
* then we can just let the existing "value too large, deliver
17
SIGILL" case handle invalid numbers, and drop the 'goto error'
18
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
21
Message-id: 20200420212206.12776-5-peter.maydell@linaro.org
22
---
10
---
23
linux-user/arm/cpu_loop.c | 143 ++++++++++++++++++++------------------
11
target/arm/cpu.h | 46 ++++++++++++++++++++++---------------------
24
1 file changed, 77 insertions(+), 66 deletions(-)
12
hw/intc/armv7m_nvic.c | 38 ++++++++++++-----------------------
25
13
target/arm/cpu.c | 1 +
26
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
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
27
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
28
--- a/linux-user/arm/cpu_loop.c
19
--- a/target/arm/cpu.h
29
+++ b/linux-user/arm/cpu_loop.c
20
+++ b/target/arm/cpu.h
30
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMTBFlags {
31
env->eabi = 1;
22
32
/* system call */
23
typedef struct ARMMMUFaultInfo ARMMMUFaultInfo;
33
if (env->thumb) {
24
34
- /* FIXME - what to do if get_user() fails? */
25
+typedef struct NVICState NVICState;
35
- get_user_code_u16(insn, env->regs[15] - 2, env);
26
+
36
- n = insn & 0xff;
27
typedef struct CPUArchState {
37
+ /* Thumb is always EABI style with syscall number in r7 */
28
/* Regs for current mode. */
38
+ n = env->regs[7];
29
uint32_t regs[16];
39
} else {
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
40
+ /*
31
} sau;
41
+ * Equivalent of kernel CONFIG_OABI_COMPAT: read the
32
42
+ * Arm SVC insn to extract the immediate, which is the
33
#if !defined(CONFIG_USER_ONLY)
43
+ * syscall number in OABI.
34
- void *nvic;
44
+ */
35
+ NVICState *nvic;
45
/* FIXME - what to do if get_user() fails? */
36
const struct arm_boot_info *boot_info;
46
get_user_code_u32(insn, env->regs[15] - 4, env);
37
/* Store GICv3CPUState to access from this struct */
47
n = insn & 0xffffff;
38
void *gicv3state;
48
- }
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;
49
-
190
-
50
- if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
191
if (s->cpu->env.v7m.faultmask[secure]) {
51
- /* linux syscall */
192
return true;
52
- if (env->thumb || n == 0) {
193
}
53
+ if (n == 0) {
194
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure)
54
+ /* zero immediate: EABI, syscall number in r7 */
195
return false;
55
n = env->regs[7];
196
}
56
} else {
197
57
- n -= ARM_SYSCALL_BASE;
198
-bool armv7m_nvic_can_take_pending_exception(void *opaque)
58
+ /*
199
+bool armv7m_nvic_can_take_pending_exception(NVICState *s)
59
+ * This XOR matches the kernel code: an immediate
200
{
60
+ * in the valid range (0x900000 .. 0x9fffff) is
201
- NVICState *s = opaque;
61
+ * converted into the correct EABI-style syscall
202
-
62
+ * number; invalid immediates end up as values
203
return nvic_exec_prio(s) > nvic_pending_prio(s);
63
+ * > 0xfffff and are handled below as out-of-range.
204
}
64
+ */
205
65
+ n ^= ARM_SYSCALL_BASE;
206
-int armv7m_nvic_raw_execution_priority(void *opaque)
66
env->eabi = 0;
207
+int armv7m_nvic_raw_execution_priority(NVICState *s)
67
}
208
{
68
- if ( n > ARM_NR_BASE) {
209
- NVICState *s = opaque;
69
- switch (n) {
210
-
70
- case ARM_NR_cacheflush:
211
return s->exception_prio;
71
- /* nop */
212
}
72
- break;
213
73
- case ARM_NR_set_tls:
214
@@ -XXX,XX +XXX,XX @@ static void nvic_irq_update(NVICState *s)
74
- cpu_set_tls(env, env->regs[0]);
215
* if @secure is true and @irq does not specify one of the fixed set
75
- env->regs[0] = 0;
216
* of architecturally banked exceptions.
76
- break;
217
*/
77
- case ARM_NR_breakpoint:
218
-static void armv7m_nvic_clear_pending(void *opaque, int irq, bool secure)
78
- env->regs[15] -= env->thumb ? 2 : 4;
219
+static void armv7m_nvic_clear_pending(NVICState *s, int irq, bool secure)
79
- goto excp_debug;
220
{
80
- case ARM_NR_get_tls:
221
- NVICState *s = (NVICState *)opaque;
81
- env->regs[0] = cpu_get_tls(env);
222
VecInfo *vec;
82
- break;
223
83
- default:
224
assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq);
84
- if (n < 0xf0800) {
225
@@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
85
- /*
226
}
86
- * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
227
}
87
- * 0x9f07ff in OABI numbering) are defined
228
88
- * to return -ENOSYS rather than raising
229
-void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
89
- * SIGILL. Note that we have already
230
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure)
90
- * removed the 0x900000 prefix.
231
{
91
- */
232
- do_armv7m_nvic_set_pending(opaque, irq, secure, false);
92
- qemu_log_mask(LOG_UNIMP,
233
+ do_armv7m_nvic_set_pending(s, irq, secure, false);
93
- "qemu: Unsupported ARM syscall: 0x%x\n",
234
}
94
- n);
235
95
- env->regs[0] = -TARGET_ENOSYS;
236
-void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure)
96
+ }
237
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure)
97
+
238
{
98
+ if (n > ARM_NR_BASE) {
239
- do_armv7m_nvic_set_pending(opaque, irq, secure, true);
99
+ switch (n) {
240
+ do_armv7m_nvic_set_pending(s, irq, secure, true);
100
+ case ARM_NR_cacheflush:
241
}
101
+ /* nop */
242
102
+ break;
243
-void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
103
+ case ARM_NR_set_tls:
244
+void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure)
104
+ cpu_set_tls(env, env->regs[0]);
245
{
105
+ env->regs[0] = 0;
246
/*
106
+ break;
247
* Pend an exception during lazy FP stacking. This differs
107
+ case ARM_NR_breakpoint:
248
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
108
+ env->regs[15] -= env->thumb ? 2 : 4;
249
* whether we should escalate depends on the saved context
109
+ goto excp_debug;
250
* in the FPCCR register, not on the current state of the CPU/NVIC.
110
+ case ARM_NR_get_tls:
251
*/
111
+ env->regs[0] = cpu_get_tls(env);
252
- NVICState *s = (NVICState *)opaque;
112
+ break;
253
bool banked = exc_is_banked(irq);
113
+ default:
254
VecInfo *vec;
114
+ if (n < 0xf0800) {
255
bool targets_secure;
115
+ /*
256
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure)
116
+ * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
257
}
117
+ * 0x9f07ff in OABI numbering) are defined
258
118
+ * to return -ENOSYS rather than raising
259
/* Make pending IRQ active. */
119
+ * SIGILL. Note that we have already
260
-void armv7m_nvic_acknowledge_irq(void *opaque)
120
+ * removed the 0x900000 prefix.
261
+void armv7m_nvic_acknowledge_irq(NVICState *s)
121
+ */
262
{
122
+ qemu_log_mask(LOG_UNIMP,
263
- NVICState *s = (NVICState *)opaque;
123
+ "qemu: Unsupported ARM syscall: 0x%x\n",
264
CPUARMState *env = &s->cpu->env;
124
+ n);
265
const int pending = s->vectpending;
125
+ env->regs[0] = -TARGET_ENOSYS;
266
const int running = nvic_exec_prio(s);
126
+ } else {
267
@@ -XXX,XX +XXX,XX @@ static bool vectpending_targets_secure(NVICState *s)
127
+ /*
268
exc_targets_secure(s, s->vectpending);
128
+ * Otherwise SIGILL. This includes any SWI with
269
}
129
+ * immediate not originally 0x9fxxxx, because
270
130
+ * of the earlier XOR.
271
-void armv7m_nvic_get_pending_irq_info(void *opaque,
131
+ */
272
+void armv7m_nvic_get_pending_irq_info(NVICState *s,
132
+ info.si_signo = TARGET_SIGILL;
273
int *pirq, bool *ptargets_secure)
133
+ info.si_errno = 0;
274
{
134
+ info.si_code = TARGET_ILL_ILLTRP;
275
- NVICState *s = (NVICState *)opaque;
135
+ info._sifields._sigfault._addr = env->regs[15];
276
const int pending = s->vectpending;
136
+ if (env->thumb) {
277
bool targets_secure;
137
+ info._sifields._sigfault._addr -= 2;
278
138
} else {
279
@@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque,
139
- /* Otherwise SIGILL */
280
*pirq = pending;
140
- info.si_signo = TARGET_SIGILL;
281
}
141
- info.si_errno = 0;
282
142
- info.si_code = TARGET_ILL_ILLTRP;
283
-int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
143
- info._sifields._sigfault._addr = env->regs[15];
284
+int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure)
144
- if (env->thumb) {
285
{
145
- info._sifields._sigfault._addr -= 2;
286
- NVICState *s = (NVICState *)opaque;
146
- } else {
287
VecInfo *vec = NULL;
147
- info._sifields._sigfault._addr -= 4;
288
int ret = 0;
148
- }
289
149
- queue_signal(env, info.si_signo,
290
@@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
150
- QEMU_SI_FAULT, &info);
291
return ret;
151
+ info._sifields._sigfault._addr -= 4;
292
}
152
}
293
153
- break;
294
-bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
154
- }
295
+bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure)
155
- } else {
296
{
156
- ret = do_syscall(env,
297
/*
157
- n,
298
* Return whether an exception is "ready", i.e. it is enabled and is
158
- env->regs[0],
299
@@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure)
159
- env->regs[1],
300
* for non-banked exceptions secure is always false; for banked exceptions
160
- env->regs[2],
301
* it indicates which of the exceptions is required.
161
- env->regs[3],
302
*/
162
- env->regs[4],
303
- NVICState *s = (NVICState *)opaque;
163
- env->regs[5],
304
bool banked = exc_is_banked(irq);
164
- 0, 0);
305
VecInfo *vec;
165
- if (ret == -TARGET_ERESTARTSYS) {
306
int running = nvic_exec_prio(s);
166
- env->regs[15] -= env->thumb ? 2 : 4;
307
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
167
- } else if (ret != -TARGET_QEMU_ESIGRETURN) {
308
index XXXXXXX..XXXXXXX 100644
168
- env->regs[0] = ret;
309
--- a/target/arm/cpu.c
169
+ queue_signal(env, info.si_signo,
310
+++ b/target/arm/cpu.c
170
+ QEMU_SI_FAULT, &info);
311
@@ -XXX,XX +XXX,XX @@
171
}
312
#if !defined(CONFIG_USER_ONLY)
172
+ break;
313
#include "hw/loader.h"
173
}
314
#include "hw/boards.h"
174
} else {
315
+#include "hw/intc/armv7m_nvic.h"
175
- goto error;
316
#endif
176
+ ret = do_syscall(env,
317
#include "sysemu/tcg.h"
177
+ n,
318
#include "sysemu/qtest.h"
178
+ env->regs[0],
319
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
179
+ env->regs[1],
320
index XXXXXXX..XXXXXXX 100644
180
+ env->regs[2],
321
--- a/target/arm/m_helper.c
181
+ env->regs[3],
322
+++ b/target/arm/m_helper.c
182
+ env->regs[4],
323
@@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr,
183
+ env->regs[5],
324
* that we will need later in order to do lazy FP reg stacking.
184
+ 0, 0);
325
*/
185
+ if (ret == -TARGET_ERESTARTSYS) {
326
bool is_secure = env->v7m.secure;
186
+ env->regs[15] -= env->thumb ? 2 : 4;
327
- void *nvic = env->nvic;
187
+ } else if (ret != -TARGET_QEMU_ESIGRETURN) {
328
+ NVICState *nvic = env->nvic;
188
+ env->regs[0] = ret;
329
/*
189
+ }
330
* Some bits are unbanked and live always in fpccr[M_REG_S]; some bits
190
}
331
* are banked and we want to update the bit in the bank for the
191
}
192
break;
193
--
332
--
194
2.20.1
333
2.34.1
195
334
196
335
diff view generated by jsdifflib
1
The kernel has different handling for syscalls with invalid
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
numbers that are in the "arm-specific" range 0x9f0000 and up:
2
3
* 0x9f0000..0x9f07ff return -ENOSYS if not implemented
3
While dozens of files include "cpu.h", only 3 files require
4
* other out of range syscalls cause a SIGILL
4
these NVIC helper declarations.
5
(see the kernel's arch/arm/kernel/traps.c:arm_syscall())
5
6
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Implement this distinction. (Note that our code doesn't look
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
quite like the kernel's, because we have removed the
8
Message-id: 20230206223502.25122-12-philmd@linaro.org
9
0x900000 prefix by this point, whereas the kernel retains
10
it in arm_syscall().)
11
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-id: 20200420212206.12776-4-peter.maydell@linaro.org
15
---
10
---
16
linux-user/arm/cpu_loop.c | 30 ++++++++++++++++++++++++++----
11
include/hw/intc/armv7m_nvic.h | 123 ++++++++++++++++++++++++++++++++++
17
1 file changed, 26 insertions(+), 4 deletions(-)
12
target/arm/cpu.h | 123 ----------------------------------
18
13
target/arm/cpu.c | 4 +-
19
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
14
target/arm/cpu_tcg.c | 3 +
20
index XXXXXXX..XXXXXXX 100644
15
target/arm/m_helper.c | 3 +
21
--- a/linux-user/arm/cpu_loop.c
16
5 files changed, 132 insertions(+), 124 deletions(-)
22
+++ b/linux-user/arm/cpu_loop.c
17
23
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
18
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
24
env->regs[0] = cpu_get_tls(env);
19
index XXXXXXX..XXXXXXX 100644
25
break;
20
--- a/include/hw/intc/armv7m_nvic.h
26
default:
21
+++ b/include/hw/intc/armv7m_nvic.h
27
- qemu_log_mask(LOG_UNIMP,
22
@@ -XXX,XX +XXX,XX @@ struct NVICState {
28
- "qemu: Unsupported ARM syscall: 0x%x\n",
23
qemu_irq sysresetreq;
29
- n);
24
};
30
- env->regs[0] = -TARGET_ENOSYS;
25
31
+ if (n < 0xf0800) {
26
+/* Interface between CPU and Interrupt controller. */
32
+ /*
27
+/**
33
+ * Syscalls 0xf0000..0xf07ff (or 0x9f0000..
28
+ * armv7m_nvic_set_pending: mark the specified exception as pending
34
+ * 0x9f07ff in OABI numbering) are defined
29
+ * @s: the NVIC
35
+ * to return -ENOSYS rather than raising
30
+ * @irq: the exception number to mark pending
36
+ * SIGILL. Note that we have already
31
+ * @secure: false for non-banked exceptions or for the nonsecure
37
+ * removed the 0x900000 prefix.
32
+ * version of a banked exception, true for the secure version of a banked
38
+ */
33
+ * exception.
39
+ qemu_log_mask(LOG_UNIMP,
34
+ *
40
+ "qemu: Unsupported ARM syscall: 0x%x\n",
35
+ * Marks the specified exception as pending. Note that we will assert()
41
+ n);
36
+ * if @secure is true and @irq does not specify one of the fixed set
42
+ env->regs[0] = -TARGET_ENOSYS;
37
+ * of architecturally banked exceptions.
43
+ } else {
38
+ */
44
+ /* Otherwise SIGILL */
39
+void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure);
45
+ info.si_signo = TARGET_SIGILL;
40
+/**
46
+ info.si_errno = 0;
41
+ * armv7m_nvic_set_pending_derived: mark this derived exception as pending
47
+ info.si_code = TARGET_ILL_ILLTRP;
42
+ * @s: the NVIC
48
+ info._sifields._sigfault._addr = env->regs[15];
43
+ * @irq: the exception number to mark pending
49
+ if (env->thumb) {
44
+ * @secure: false for non-banked exceptions or for the nonsecure
50
+ info._sifields._sigfault._addr -= 2;
45
+ * version of a banked exception, true for the secure version of a banked
51
+ } else {
46
+ * exception.
52
+ info._sifields._sigfault._addr -= 4;
47
+ *
53
+ }
48
+ * Similar to armv7m_nvic_set_pending(), but specifically for derived
54
+ queue_signal(env, info.si_signo,
49
+ * exceptions (exceptions generated in the course of trying to take
55
+ QEMU_SI_FAULT, &info);
50
+ * a different exception).
56
+ }
51
+ */
57
break;
52
+void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure);
58
}
53
+/**
59
} else {
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)
60
--
328
--
61
2.20.1
329
2.34.1
62
330
63
331
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
The two TCG tests for GICv2 and GICv3 are very heavy weight distros
4
the accesses as unimplemented or guest error.
4
that take a long time to boot up, especially for an --enable-debug
5
5
build. The total code coverage they give is:
6
When fuzzing the devices, we don't want the whole process to
6
7
exit. Replace some hw_error() calls by qemu_log_mask().
7
Overall coverage rate:
8
8
lines......: 11.2% (59584 of 530123 lines)
9
Per the datasheet "Exynos 4412 RISC Microprocessor Rev 1.00"
9
functions..: 15.0% (7436 of 49443 functions)
10
Chapter 25 "Multi Core Timer (MCT)" figure 1 and table 4,
10
branches...: 6.3% (19273 of 303933 branches)
11
the default value on the APB bus is 0.
11
12
12
We already get pretty close to that with the machine_aarch64_virt
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
tests which only does one full boot (~120s vs ~600s) of alpine. We
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
14
expand the kernel+initrd boot (~8s) to test both GICs and also add an
15
Message-id: 20200518140309.5220-5-f4bug@amsat.org
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.
26
27
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
28
Reviewed-by: Fabiano Rosas <farosas@suse.de>
29
Acked-by: Richard Henderson <richard.henderson@linaro.org>
30
Message-id: 20230203181632.2919715-1-alex.bennee@linaro.org
31
Cc: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
33
---
18
hw/timer/exynos4210_mct.c | 12 +++++-------
34
tests/avocado/boot_linux.py | 48 ++++----------------
19
1 file changed, 5 insertions(+), 7 deletions(-)
35
tests/avocado/machine_aarch64_virt.py | 63 ++++++++++++++++++++++++---
20
36
2 files changed, 65 insertions(+), 46 deletions(-)
21
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
37
38
diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py
22
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/timer/exynos4210_mct.c
40
--- a/tests/avocado/boot_linux.py
24
+++ b/hw/timer/exynos4210_mct.c
41
+++ b/tests/avocado/boot_linux.py
42
@@ -XXX,XX +XXX,XX @@ def test_pc_q35_kvm(self):
43
self.launch_and_wait(set_up_ssh_connection=False)
44
45
46
-# For Aarch64 we only boot KVM tests in CI as the TCG tests are very
47
-# heavyweight. There are lighter weight distros which we use in the
48
-# machine_aarch64_virt.py tests.
49
+# For Aarch64 we only boot KVM tests in CI as booting the current
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
25
@@ -XXX,XX +XXX,XX @@
115
@@ -XXX,XX +XXX,XX @@
26
116
27
#include "qemu/osdep.h"
117
import time
28
#include "qemu/log.h"
118
import os
29
-#include "hw/hw.h"
119
+import logging
30
#include "hw/sysbus.h"
120
31
#include "migration/vmstate.h"
121
from avocado_qemu import QemuSystemTest
32
#include "qemu/timer.h"
122
from avocado_qemu import wait_for_console_pattern
33
@@ -XXX,XX +XXX,XX @@
123
from avocado_qemu import exec_command
34
#include "hw/ptimer.h"
124
from avocado_qemu import BUILD_DIR
35
125
+from avocado.utils import process
36
#include "hw/arm/exynos4210.h"
126
+from avocado.utils.path import find_command
37
-#include "hw/hw.h"
127
38
#include "hw/irq.h"
128
class Aarch64VirtMachine(QemuSystemTest):
39
129
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
40
//#define DEBUG_MCT
130
@@ -XXX,XX +XXX,XX @@ def test_alpine_virt_tcg_gic_max(self):
41
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset,
131
self.wait_for_console_pattern('Welcome to Alpine Linux 3.16')
42
int index;
132
43
int shift;
133
44
uint64_t count;
134
- def test_aarch64_virt(self):
45
- uint32_t value;
135
+ def common_aarch64_virt(self, machine):
46
+ uint32_t value = 0;
136
"""
47
int lt_i;
137
- :avocado: tags=arch:aarch64
48
138
- :avocado: tags=machine:virt
49
switch (offset) {
139
- :avocado: tags=accel:tcg
50
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_mct_read(void *opaque, hwaddr offset,
140
- :avocado: tags=cpu:max
51
break;
141
+ Common code to launch basic virt machine with kernel+initrd
52
142
+ and a scratch disk.
53
default:
143
"""
54
- hw_error("exynos4210.mct: bad read offset "
144
+ logger = logging.getLogger('aarch64_virt')
55
- TARGET_FMT_plx "\n", offset);
145
+
56
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
146
kernel_url = ('https://fileserver.linaro.org/s/'
57
+ __func__, offset);
147
'z6B2ARM7DQT3HWN/download')
58
break;
148
-
59
}
149
kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347'
60
return value;
150
kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
61
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
151
62
break;
152
@@ -XXX,XX +XXX,XX @@ def test_aarch64_virt(self):
63
153
'console=ttyAMA0')
64
default:
154
self.require_accelerator("tcg")
65
- hw_error("exynos4210.mct: bad write offset "
155
self.vm.add_args('-cpu', 'max,pauth-impdef=on',
66
- TARGET_FMT_plx "\n", offset);
156
+ '-machine', machine,
67
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
157
'-accel', 'tcg',
68
+ __func__, offset);
158
'-kernel', kernel_path,
69
break;
159
'-append', kernel_command_line)
70
}
160
+
71
}
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")
72
--
215
--
73
2.20.1
216
2.34.1
74
217
75
218
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Mostafa Saleh <smostafa@google.com>
2
2
3
Implement full support for the watchdog in i.MX systems.
3
GBPA register can be used to globally abort all
4
Pretimeout support is optional because the watchdog hardware
4
transactions.
5
on i.MX31 does not support pretimeouts.
6
5
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
6
It is described in the SMMU manual in "6.3.14 SMMU_GBPA".
8
Message-id: 20200517162135.110364-3-linux@roeck-us.net
7
ABORT reset value is IMPLEMENTATION DEFINED, it is chosen to
8
be zero(Do not abort incoming transactions).
9
10
Other fields have default values of Use Incoming.
11
12
If UPDATE is not set, the write is ignored. This is the only permitted
13
behavior in SMMUv3.2 and later.(6.3.14.1 Update procedure)
14
15
As this patch adds a new state to the SMMU (GBPA), it is added
16
in a new subsection for forward migration compatibility.
17
GBPA is only migrated if its value is different from the reset value.
18
It does this to be backward migration compatible if SW didn't write
19
the register.
20
21
Signed-off-by: Mostafa Saleh <smostafa@google.com>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Eric Auger <eric.auger@redhat.com>
24
Message-id: 20230214094009.2445653-1-smostafa@google.com
25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
---
27
---
12
include/hw/watchdog/wdt_imx2.h | 61 ++++++++-
28
hw/arm/smmuv3-internal.h | 7 +++++++
13
hw/watchdog/wdt_imx2.c | 239 +++++++++++++++++++++++++++++++--
29
include/hw/arm/smmuv3.h | 1 +
14
2 files changed, 285 insertions(+), 15 deletions(-)
30
hw/arm/smmuv3.c | 43 +++++++++++++++++++++++++++++++++++++++-
31
3 files changed, 50 insertions(+), 1 deletion(-)
15
32
16
diff --git a/include/hw/watchdog/wdt_imx2.h b/include/hw/watchdog/wdt_imx2.h
33
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
17
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/watchdog/wdt_imx2.h
35
--- a/hw/arm/smmuv3-internal.h
19
+++ b/include/hw/watchdog/wdt_imx2.h
36
+++ b/hw/arm/smmuv3-internal.h
20
@@ -XXX,XX +XXX,XX @@
37
@@ -XXX,XX +XXX,XX @@ REG32(CR0ACK, 0x24)
21
#ifndef IMX2_WDT_H
38
REG32(CR1, 0x28)
22
#define IMX2_WDT_H
39
REG32(CR2, 0x2c)
23
40
REG32(STATUSR, 0x40)
24
+#include "qemu/bitops.h"
41
+REG32(GBPA, 0x44)
25
#include "hw/sysbus.h"
42
+ FIELD(GBPA, ABORT, 20, 1)
26
+#include "hw/irq.h"
43
+ FIELD(GBPA, UPDATE, 31, 1)
27
+#include "hw/ptimer.h"
44
+
28
45
+/* Use incoming. */
29
#define TYPE_IMX2_WDT "imx2.wdt"
46
+#define SMMU_GBPA_RESET_VAL 0x1000
30
#define IMX2_WDT(obj) OBJECT_CHECK(IMX2WdtState, (obj), TYPE_IMX2_WDT)
47
+
31
48
REG32(IRQ_CTRL, 0x50)
32
enum IMX2WdtRegisters {
49
FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1)
33
- IMX2_WDT_WCR = 0x0000,
50
FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1)
34
- IMX2_WDT_REG_NUM = 0x0008 / sizeof(uint16_t) + 1,
51
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
35
+ IMX2_WDT_WCR = 0x0000, /* Control Register */
52
index XXXXXXX..XXXXXXX 100644
36
+ IMX2_WDT_WSR = 0x0002, /* Service Register */
53
--- a/include/hw/arm/smmuv3.h
37
+ IMX2_WDT_WRSR = 0x0004, /* Reset Status Register */
54
+++ b/include/hw/arm/smmuv3.h
38
+ IMX2_WDT_WICR = 0x0006, /* Interrupt Control Register */
55
@@ -XXX,XX +XXX,XX @@ struct SMMUv3State {
39
+ IMX2_WDT_WMCR = 0x0008, /* Misc Register */
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;
63
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/hw/arm/smmuv3.c
66
+++ b/hw/arm/smmuv3.c
67
@@ -XXX,XX +XXX,XX @@ static void smmuv3_init_regs(SMMUv3State *s)
68
s->gerror = 0;
69
s->gerrorn = 0;
70
s->statusr = 0;
71
+ s->gbpa = SMMU_GBPA_RESET_VAL;
72
}
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;
84
+ }
85
goto epilogue;
86
}
87
88
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_writel(SMMUv3State *s, hwaddr offset,
89
case A_GERROR_IRQ_CFG2:
90
s->gerror_irq_cfg2 = data;
91
return MEMTX_OK;
92
+ case A_GBPA:
93
+ /*
94
+ * If UPDATE is not set, the write is ignored. This is the only
95
+ * permitted behavior in SMMUv3.2 and later.
96
+ */
97
+ if (data & R_GBPA_UPDATE_MASK) {
98
+ /* Ignore update bit as write is synchronous. */
99
+ s->gbpa = data & ~R_GBPA_UPDATE_MASK;
100
+ }
101
+ return MEMTX_OK;
102
case A_STRTAB_BASE: /* 64b */
103
s->strtab_base = deposit64(s->strtab_base, 0, 32, data);
104
return MEMTX_OK;
105
@@ -XXX,XX +XXX,XX @@ static MemTxResult smmu_readl(SMMUv3State *s, hwaddr offset,
106
case A_STATUSR:
107
*data = s->statusr;
108
return MEMTX_OK;
109
+ case A_GBPA:
110
+ *data = s->gbpa;
111
+ return MEMTX_OK;
112
case A_IRQ_CTRL:
113
case A_IRQ_CTRL_ACK:
114
*data = s->irq_ctrl;
115
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3_queue = {
116
},
40
};
117
};
41
118
42
+#define IMX2_WDT_MMIO_SIZE 0x000a
119
+static bool smmuv3_gbpa_needed(void *opaque)
120
+{
121
+ SMMUv3State *s = opaque;
43
+
122
+
44
+/* Control Register definitions */
123
+ /* Only migrate GBPA if it has different reset value. */
45
+#define IMX2_WDT_WCR_WT (0xFF << 8) /* Watchdog Timeout Field */
124
+ return s->gbpa != SMMU_GBPA_RESET_VAL;
46
+#define IMX2_WDT_WCR_WDW BIT(7) /* WDOG Disable for Wait */
47
+#define IMX2_WDT_WCR_WDA BIT(5) /* WDOG Assertion */
48
+#define IMX2_WDT_WCR_SRS BIT(4) /* Software Reset Signal */
49
+#define IMX2_WDT_WCR_WDT BIT(3) /* WDOG Timeout Assertion */
50
+#define IMX2_WDT_WCR_WDE BIT(2) /* Watchdog Enable */
51
+#define IMX2_WDT_WCR_WDBG BIT(1) /* Watchdog Debug Enable */
52
+#define IMX2_WDT_WCR_WDZST BIT(0) /* Watchdog Timer Suspend */
53
+
54
+#define IMX2_WDT_WCR_LOCK_MASK (IMX2_WDT_WCR_WDZST | IMX2_WDT_WCR_WDBG \
55
+ | IMX2_WDT_WCR_WDW)
56
+
57
+/* Service Register definitions */
58
+#define IMX2_WDT_SEQ1 0x5555 /* service sequence 1 */
59
+#define IMX2_WDT_SEQ2 0xAAAA /* service sequence 2 */
60
+
61
+/* Reset Status Register definitions */
62
+#define IMX2_WDT_WRSR_TOUT BIT(1) /* Reset due to Timeout */
63
+#define IMX2_WDT_WRSR_SFTW BIT(0) /* Reset due to software reset */
64
+
65
+/* Interrupt Control Register definitions */
66
+#define IMX2_WDT_WICR_WIE BIT(15) /* Interrupt Enable */
67
+#define IMX2_WDT_WICR_WTIS BIT(14) /* Interrupt Status */
68
+#define IMX2_WDT_WICR_WICT 0xff /* Interrupt Timeout */
69
+#define IMX2_WDT_WICR_WICT_DEF 0x04 /* Default interrupt timeout (2s) */
70
+
71
+#define IMX2_WDT_WICR_LOCK_MASK (IMX2_WDT_WICR_WIE | IMX2_WDT_WICR_WICT)
72
+
73
+/* Misc Control Register definitions */
74
+#define IMX2_WDT_WMCR_PDE BIT(0) /* Power-Down Enable */
75
76
typedef struct IMX2WdtState {
77
/* <private> */
78
SysBusDevice parent_obj;
79
80
+ /*< public >*/
81
MemoryRegion mmio;
82
+ qemu_irq irq;
83
+
84
+ struct ptimer_state *timer;
85
+ struct ptimer_state *itimer;
86
+
87
+ bool pretimeout_support;
88
+ bool wicr_locked;
89
+
90
+ uint16_t wcr;
91
+ uint16_t wsr;
92
+ uint16_t wrsr;
93
+ uint16_t wicr;
94
+ uint16_t wmcr;
95
+
96
+ bool wcr_locked; /* affects WDZST, WDBG, and WDW */
97
+ bool wcr_wde_locked; /* affects WDE */
98
+ bool wcr_wdt_locked; /* affects WDT (never cleared) */
99
} IMX2WdtState;
100
101
#endif /* IMX2_WDT_H */
102
diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c
103
index XXXXXXX..XXXXXXX 100644
104
--- a/hw/watchdog/wdt_imx2.c
105
+++ b/hw/watchdog/wdt_imx2.c
106
@@ -XXX,XX +XXX,XX @@
107
#include "qemu/bitops.h"
108
#include "qemu/module.h"
109
#include "sysemu/watchdog.h"
110
+#include "migration/vmstate.h"
111
+#include "hw/qdev-properties.h"
112
113
#include "hw/watchdog/wdt_imx2.h"
114
115
-#define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset WDOG_B */
116
-#define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset Signal */
117
-
118
-static uint64_t imx2_wdt_read(void *opaque, hwaddr addr,
119
- unsigned int size)
120
+static void imx2_wdt_interrupt(void *opaque)
121
{
122
+ IMX2WdtState *s = IMX2_WDT(opaque);
123
+
124
+ s->wicr |= IMX2_WDT_WICR_WTIS;
125
+ qemu_set_irq(s->irq, 1);
126
+}
125
+}
127
+
126
+
128
+static void imx2_wdt_expired(void *opaque)
127
+static const VMStateDescription vmstate_gbpa = {
129
+{
128
+ .name = "smmuv3/gbpa",
130
+ IMX2WdtState *s = IMX2_WDT(opaque);
129
+ .version_id = 1,
131
+
130
+ .minimum_version_id = 1,
132
+ s->wrsr = IMX2_WDT_WRSR_TOUT;
131
+ .needed = smmuv3_gbpa_needed,
133
+
134
+ /* Perform watchdog action if watchdog is enabled */
135
+ if (s->wcr & IMX2_WDT_WCR_WDE) {
136
+ s->wrsr = IMX2_WDT_WRSR_TOUT;
137
+ watchdog_perform_action();
138
+ }
139
+}
140
+
141
+static void imx2_wdt_reset(DeviceState *dev)
142
+{
143
+ IMX2WdtState *s = IMX2_WDT(dev);
144
+
145
+ ptimer_transaction_begin(s->timer);
146
+ ptimer_stop(s->timer);
147
+ ptimer_transaction_commit(s->timer);
148
+
149
+ if (s->pretimeout_support) {
150
+ ptimer_transaction_begin(s->itimer);
151
+ ptimer_stop(s->itimer);
152
+ ptimer_transaction_commit(s->itimer);
153
+ }
154
+
155
+ s->wicr_locked = false;
156
+ s->wcr_locked = false;
157
+ s->wcr_wde_locked = false;
158
+
159
+ s->wcr = IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS;
160
+ s->wsr = 0;
161
+ s->wrsr &= ~(IMX2_WDT_WRSR_TOUT | IMX2_WDT_WRSR_SFTW);
162
+ s->wicr = IMX2_WDT_WICR_WICT_DEF;
163
+ s->wmcr = IMX2_WDT_WMCR_PDE;
164
+}
165
+
166
+static uint64_t imx2_wdt_read(void *opaque, hwaddr addr, unsigned int size)
167
+{
168
+ IMX2WdtState *s = IMX2_WDT(opaque);
169
+
170
+ switch (addr) {
171
+ case IMX2_WDT_WCR:
172
+ return s->wcr;
173
+ case IMX2_WDT_WSR:
174
+ return s->wsr;
175
+ case IMX2_WDT_WRSR:
176
+ return s->wrsr;
177
+ case IMX2_WDT_WICR:
178
+ return s->wicr;
179
+ case IMX2_WDT_WMCR:
180
+ return s->wmcr;
181
+ }
182
return 0;
183
}
184
185
+static void imx_wdt2_update_itimer(IMX2WdtState *s, bool start)
186
+{
187
+ bool running = (s->wcr & IMX2_WDT_WCR_WDE) && (s->wcr & IMX2_WDT_WCR_WT);
188
+ bool enabled = s->wicr & IMX2_WDT_WICR_WIE;
189
+
190
+ ptimer_transaction_begin(s->itimer);
191
+ if (start || !enabled) {
192
+ ptimer_stop(s->itimer);
193
+ }
194
+ if (running && enabled) {
195
+ int count = ptimer_get_count(s->timer);
196
+ int pretimeout = s->wicr & IMX2_WDT_WICR_WICT;
197
+
198
+ /*
199
+ * Only (re-)start pretimeout timer if its counter value is larger
200
+ * than 0. Otherwise it will fire right away and we'll get an
201
+ * interrupt loop.
202
+ */
203
+ if (count > pretimeout) {
204
+ ptimer_set_count(s->itimer, count - pretimeout);
205
+ if (start) {
206
+ ptimer_run(s->itimer, 1);
207
+ }
208
+ }
209
+ }
210
+ ptimer_transaction_commit(s->itimer);
211
+}
212
+
213
+static void imx_wdt2_update_timer(IMX2WdtState *s, bool start)
214
+{
215
+ ptimer_transaction_begin(s->timer);
216
+ if (start) {
217
+ ptimer_stop(s->timer);
218
+ }
219
+ if ((s->wcr & IMX2_WDT_WCR_WDE) && (s->wcr & IMX2_WDT_WCR_WT)) {
220
+ int count = (s->wcr & IMX2_WDT_WCR_WT) >> 8;
221
+
222
+ /* A value of 0 reflects one period (0.5s). */
223
+ ptimer_set_count(s->timer, count + 1);
224
+ if (start) {
225
+ ptimer_run(s->timer, 1);
226
+ }
227
+ }
228
+ ptimer_transaction_commit(s->timer);
229
+ if (s->pretimeout_support) {
230
+ imx_wdt2_update_itimer(s, start);
231
+ }
232
+}
233
+
234
static void imx2_wdt_write(void *opaque, hwaddr addr,
235
uint64_t value, unsigned int size)
236
{
237
- if (addr == IMX2_WDT_WCR &&
238
- (~value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS))) {
239
- watchdog_perform_action();
240
+ IMX2WdtState *s = IMX2_WDT(opaque);
241
+
242
+ switch (addr) {
243
+ case IMX2_WDT_WCR:
244
+ if (s->wcr_locked) {
245
+ value &= ~IMX2_WDT_WCR_LOCK_MASK;
246
+ value |= (s->wicr & IMX2_WDT_WCR_LOCK_MASK);
247
+ }
248
+ s->wcr_locked = true;
249
+ if (s->wcr_wde_locked) {
250
+ value &= ~IMX2_WDT_WCR_WDE;
251
+ value |= (s->wicr & ~IMX2_WDT_WCR_WDE);
252
+ } else if (value & IMX2_WDT_WCR_WDE) {
253
+ s->wcr_wde_locked = true;
254
+ }
255
+ if (s->wcr_wdt_locked) {
256
+ value &= ~IMX2_WDT_WCR_WDT;
257
+ value |= (s->wicr & ~IMX2_WDT_WCR_WDT);
258
+ } else if (value & IMX2_WDT_WCR_WDT) {
259
+ s->wcr_wdt_locked = true;
260
+ }
261
+
262
+ s->wcr = value;
263
+ if (!(value & IMX2_WDT_WCR_SRS)) {
264
+ s->wrsr = IMX2_WDT_WRSR_SFTW;
265
+ }
266
+ if (!(value & (IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS)) ||
267
+ (!(value & IMX2_WDT_WCR_WT) && (value & IMX2_WDT_WCR_WDE))) {
268
+ watchdog_perform_action();
269
+ }
270
+ s->wcr |= IMX2_WDT_WCR_SRS;
271
+ imx_wdt2_update_timer(s, true);
272
+ break;
273
+ case IMX2_WDT_WSR:
274
+ if (s->wsr == IMX2_WDT_SEQ1 && value == IMX2_WDT_SEQ2) {
275
+ imx_wdt2_update_timer(s, false);
276
+ }
277
+ s->wsr = value;
278
+ break;
279
+ case IMX2_WDT_WRSR:
280
+ break;
281
+ case IMX2_WDT_WICR:
282
+ if (!s->pretimeout_support) {
283
+ return;
284
+ }
285
+ value &= IMX2_WDT_WICR_LOCK_MASK | IMX2_WDT_WICR_WTIS;
286
+ if (s->wicr_locked) {
287
+ value &= IMX2_WDT_WICR_WTIS;
288
+ value |= (s->wicr & IMX2_WDT_WICR_LOCK_MASK);
289
+ }
290
+ s->wicr = value | (s->wicr & IMX2_WDT_WICR_WTIS);
291
+ if (value & IMX2_WDT_WICR_WTIS) {
292
+ s->wicr &= ~IMX2_WDT_WICR_WTIS;
293
+ qemu_set_irq(s->irq, 0);
294
+ }
295
+ imx_wdt2_update_itimer(s, true);
296
+ s->wicr_locked = true;
297
+ break;
298
+ case IMX2_WDT_WMCR:
299
+ s->wmcr = value & IMX2_WDT_WMCR_PDE;
300
+ break;
301
}
302
}
303
304
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps imx2_wdt_ops = {
305
* real device but in practice there is no reason for a guest
306
* to access this device unaligned.
307
*/
308
- .min_access_size = 4,
309
- .max_access_size = 4,
310
+ .min_access_size = 2,
311
+ .max_access_size = 2,
312
.unaligned = false,
313
},
314
};
315
316
+static const VMStateDescription vmstate_imx2_wdt = {
317
+ .name = "imx2.wdt",
318
+ .fields = (VMStateField[]) {
132
+ .fields = (VMStateField[]) {
319
+ VMSTATE_PTIMER(timer, IMX2WdtState),
133
+ VMSTATE_UINT32(gbpa, SMMUv3State),
320
+ VMSTATE_PTIMER(itimer, IMX2WdtState),
321
+ VMSTATE_BOOL(wicr_locked, IMX2WdtState),
322
+ VMSTATE_BOOL(wcr_locked, IMX2WdtState),
323
+ VMSTATE_BOOL(wcr_wde_locked, IMX2WdtState),
324
+ VMSTATE_BOOL(wcr_wdt_locked, IMX2WdtState),
325
+ VMSTATE_UINT16(wcr, IMX2WdtState),
326
+ VMSTATE_UINT16(wsr, IMX2WdtState),
327
+ VMSTATE_UINT16(wrsr, IMX2WdtState),
328
+ VMSTATE_UINT16(wmcr, IMX2WdtState),
329
+ VMSTATE_UINT16(wicr, IMX2WdtState),
330
+ VMSTATE_END_OF_LIST()
134
+ VMSTATE_END_OF_LIST()
331
+ }
135
+ }
332
+};
136
+};
333
+
137
+
334
static void imx2_wdt_realize(DeviceState *dev, Error **errp)
138
static const VMStateDescription vmstate_smmuv3 = {
335
{
139
.name = "smmuv3",
336
IMX2WdtState *s = IMX2_WDT(dev);
140
.version_id = 1,
337
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
141
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = {
338
142
339
memory_region_init_io(&s->mmio, OBJECT(dev),
143
VMSTATE_END_OF_LIST(),
340
&imx2_wdt_ops, s,
144
},
341
- TYPE_IMX2_WDT".mmio",
145
+ .subsections = (const VMStateDescription * []) {
342
- IMX2_WDT_REG_NUM * sizeof(uint16_t));
146
+ &vmstate_gbpa,
343
- sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
147
+ NULL
344
+ TYPE_IMX2_WDT,
345
+ IMX2_WDT_MMIO_SIZE);
346
+ sysbus_init_mmio(sbd, &s->mmio);
347
+ sysbus_init_irq(sbd, &s->irq);
348
+
349
+ s->timer = ptimer_init(imx2_wdt_expired, s,
350
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
351
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
352
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
353
+ ptimer_transaction_begin(s->timer);
354
+ ptimer_set_freq(s->timer, 2);
355
+ ptimer_set_limit(s->timer, 0xff, 1);
356
+ ptimer_transaction_commit(s->timer);
357
+ if (s->pretimeout_support) {
358
+ s->itimer = ptimer_init(imx2_wdt_interrupt, s,
359
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
360
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
361
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
362
+ ptimer_transaction_begin(s->itimer);
363
+ ptimer_set_freq(s->itimer, 2);
364
+ ptimer_set_limit(s->itimer, 0xff, 1);
365
+ ptimer_transaction_commit(s->itimer);
366
+ }
148
+ }
367
}
149
};
368
150
369
+static Property imx2_wdt_properties[] = {
151
static void smmuv3_instance_init(Object *obj)
370
+ DEFINE_PROP_BOOL("pretimeout-support", IMX2WdtState, pretimeout_support,
371
+ false),
372
+};
373
+
374
static void imx2_wdt_class_init(ObjectClass *klass, void *data)
375
{
376
DeviceClass *dc = DEVICE_CLASS(klass);
377
378
+ device_class_set_props(dc, imx2_wdt_properties);
379
dc->realize = imx2_wdt_realize;
380
+ dc->reset = imx2_wdt_reset;
381
+ dc->vmsd = &vmstate_imx2_wdt;
382
+ dc->desc = "i.MX watchdog timer";
383
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
384
}
385
386
--
152
--
387
2.20.1
153
2.34.1
388
389
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
In preparation for a full implementation, move i.MX watchdog driver
3
Since commit acc0b8b05a when running the ZynqMP ZCU102 board with
4
from hw/misc to hw/watchdog. While at it, add the watchdog files
4
a QEMU configured using --without-default-devices, we get:
5
to MAINTAINERS.
6
5
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
$ qemu-system-aarch64 -M xlnx-zcu102
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
qemu-system-aarch64: missing object type 'usb_dwc3'
9
Message-id: 20200517162135.110364-2-linux@roeck-us.net
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>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
17
---
12
include/hw/arm/fsl-imx6.h | 2 +-
18
hw/arm/Kconfig | 1 +
13
include/hw/arm/fsl-imx6ul.h | 2 +-
19
1 file changed, 1 insertion(+)
14
include/hw/arm/fsl-imx7.h | 2 +-
15
include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} | 0
16
hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} | 2 +-
17
MAINTAINERS | 2 ++
18
hw/arm/Kconfig | 3 +++
19
hw/misc/Makefile.objs | 1 -
20
hw/watchdog/Kconfig | 3 +++
21
hw/watchdog/Makefile.objs | 1 +
22
10 files changed, 13 insertions(+), 5 deletions(-)
23
rename include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} (100%)
24
rename hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} (98%)
25
20
26
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
27
index XXXXXXX..XXXXXXX 100644
28
--- a/include/hw/arm/fsl-imx6.h
29
+++ b/include/hw/arm/fsl-imx6.h
30
@@ -XXX,XX +XXX,XX @@
31
#include "hw/cpu/a9mpcore.h"
32
#include "hw/misc/imx6_ccm.h"
33
#include "hw/misc/imx6_src.h"
34
-#include "hw/misc/imx2_wdt.h"
35
+#include "hw/watchdog/wdt_imx2.h"
36
#include "hw/char/imx_serial.h"
37
#include "hw/timer/imx_gpt.h"
38
#include "hw/timer/imx_epit.h"
39
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
40
index XXXXXXX..XXXXXXX 100644
41
--- a/include/hw/arm/fsl-imx6ul.h
42
+++ b/include/hw/arm/fsl-imx6ul.h
43
@@ -XXX,XX +XXX,XX @@
44
#include "hw/misc/imx7_snvs.h"
45
#include "hw/misc/imx7_gpr.h"
46
#include "hw/intc/imx_gpcv2.h"
47
-#include "hw/misc/imx2_wdt.h"
48
+#include "hw/watchdog/wdt_imx2.h"
49
#include "hw/gpio/imx_gpio.h"
50
#include "hw/char/imx_serial.h"
51
#include "hw/timer/imx_gpt.h"
52
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
53
index XXXXXXX..XXXXXXX 100644
54
--- a/include/hw/arm/fsl-imx7.h
55
+++ b/include/hw/arm/fsl-imx7.h
56
@@ -XXX,XX +XXX,XX @@
57
#include "hw/misc/imx7_snvs.h"
58
#include "hw/misc/imx7_gpr.h"
59
#include "hw/misc/imx6_src.h"
60
-#include "hw/misc/imx2_wdt.h"
61
+#include "hw/watchdog/wdt_imx2.h"
62
#include "hw/gpio/imx_gpio.h"
63
#include "hw/char/imx_serial.h"
64
#include "hw/timer/imx_gpt.h"
65
diff --git a/include/hw/misc/imx2_wdt.h b/include/hw/watchdog/wdt_imx2.h
66
similarity index 100%
67
rename from include/hw/misc/imx2_wdt.h
68
rename to include/hw/watchdog/wdt_imx2.h
69
diff --git a/hw/misc/imx2_wdt.c b/hw/watchdog/wdt_imx2.c
70
similarity index 98%
71
rename from hw/misc/imx2_wdt.c
72
rename to hw/watchdog/wdt_imx2.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/hw/misc/imx2_wdt.c
75
+++ b/hw/watchdog/wdt_imx2.c
76
@@ -XXX,XX +XXX,XX @@
77
#include "qemu/module.h"
78
#include "sysemu/watchdog.h"
79
80
-#include "hw/misc/imx2_wdt.h"
81
+#include "hw/watchdog/wdt_imx2.h"
82
83
#define IMX2_WDT_WCR_WDA BIT(5) /* -> External Reset WDOG_B */
84
#define IMX2_WDT_WCR_SRS BIT(4) /* -> Software Reset Signal */
85
diff --git a/MAINTAINERS b/MAINTAINERS
86
index XXXXXXX..XXXXXXX 100644
87
--- a/MAINTAINERS
88
+++ b/MAINTAINERS
89
@@ -XXX,XX +XXX,XX @@ S: Odd Fixes
90
F: hw/arm/fsl-imx25.c
91
F: hw/arm/imx25_pdk.c
92
F: hw/misc/imx25_ccm.c
93
+F: hw/watchdog/wdt_imx2.c
94
F: include/hw/arm/fsl-imx25.h
95
F: include/hw/misc/imx25_ccm.h
96
+F: include/hw/watchdog/wdt_imx2.h
97
98
i.MX31 (kzm)
99
M: Peter Chubb <peter.chubb@nicta.com.au>
100
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
21
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
101
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/arm/Kconfig
23
--- a/hw/arm/Kconfig
103
+++ b/hw/arm/Kconfig
24
+++ b/hw/arm/Kconfig
104
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
25
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
105
select IMX_FEC
26
select XLNX_CSU_DMA
106
select IMX_I2C
27
select XLNX_ZYNQMP
107
select IMX_USBPHY
28
select XLNX_ZDMA
108
+ select WDT_IMX2
29
+ select USB_DWC3
109
select SDHCI
30
110
31
config XLNX_VERSAL
111
config ASPEED_SOC
112
@@ -XXX,XX +XXX,XX @@ config FSL_IMX7
113
select IMX
114
select IMX_FEC
115
select IMX_I2C
116
+ select WDT_IMX2
117
select PCI_EXPRESS_DESIGNWARE
118
select SDHCI
119
select UNIMP
120
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6UL
121
select IMX
122
select IMX_FEC
123
select IMX_I2C
124
+ select WDT_IMX2
125
select SDHCI
126
select UNIMP
127
128
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
129
index XXXXXXX..XXXXXXX 100644
130
--- a/hw/misc/Makefile.objs
131
+++ b/hw/misc/Makefile.objs
132
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_IMX) += imx6_ccm.o
133
common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
134
obj-$(CONFIG_IMX) += imx6_src.o
135
common-obj-$(CONFIG_IMX) += imx7_ccm.o
136
-common-obj-$(CONFIG_IMX) += imx2_wdt.o
137
common-obj-$(CONFIG_IMX) += imx7_snvs.o
138
common-obj-$(CONFIG_IMX) += imx7_gpr.o
139
common-obj-$(CONFIG_IMX) += imx_rngc.o
140
diff --git a/hw/watchdog/Kconfig b/hw/watchdog/Kconfig
141
index XXXXXXX..XXXXXXX 100644
142
--- a/hw/watchdog/Kconfig
143
+++ b/hw/watchdog/Kconfig
144
@@ -XXX,XX +XXX,XX @@ config WDT_IB700
145
146
config WDT_DIAG288
147
bool
32
bool
148
+
149
+config WDT_IMX2
150
+ bool
151
diff --git a/hw/watchdog/Makefile.objs b/hw/watchdog/Makefile.objs
152
index XXXXXXX..XXXXXXX 100644
153
--- a/hw/watchdog/Makefile.objs
154
+++ b/hw/watchdog/Makefile.objs
155
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
156
common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
157
common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
158
common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o
159
+common-obj-$(CONFIG_WDT_IMX2) += wdt_imx2.o
160
--
33
--
161
2.20.1
34
2.34.1
162
35
163
36
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Cornelia Huck <cohuck@redhat.com>
2
2
3
Do not explicitly store zero to the NEON high part
3
Just use current_accel_name() directly.
4
when we can pass !is_q to clear_vec_high.
5
4
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20200519212453.28494-3-richard.henderson@linaro.org
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
target/arm/translate-a64.c | 53 +++++++++++++++++++++++---------------
10
hw/arm/virt.c | 6 +++---
12
1 file changed, 32 insertions(+), 21 deletions(-)
11
1 file changed, 3 insertions(+), 3 deletions(-)
13
12
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
13
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
15
--- a/hw/arm/virt.c
17
+++ b/target/arm/translate-a64.c
16
+++ b/hw/arm/virt.c
18
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
17
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
19
{
18
if (vms->secure && (kvm_enabled() || hvf_enabled())) {
20
/* This always zero-extends and writes to a full 128 bit wide vector */
19
error_report("mach-virt: %s does not support providing "
21
TCGv_i64 tmplo = tcg_temp_new_i64();
20
"Security extensions (TrustZone) to the guest CPU",
22
- TCGv_i64 tmphi;
21
- kvm_enabled() ? "KVM" : "HVF");
23
+ TCGv_i64 tmphi = NULL;
22
+ current_accel_name());
24
23
exit(1);
25
if (size < 4) {
26
MemOp memop = s->be_data + size;
27
- tmphi = tcg_const_i64(0);
28
tcg_gen_qemu_ld_i64(tmplo, tcg_addr, get_mem_index(s), memop);
29
} else {
30
bool be = s->be_data == MO_BE;
31
@@ -XXX,XX +XXX,XX @@ static void do_fp_ld(DisasContext *s, int destidx, TCGv_i64 tcg_addr, int size)
32
}
24
}
33
25
34
tcg_gen_st_i64(tmplo, cpu_env, fp_reg_offset(s, destidx, MO_64));
26
if (vms->virt && (kvm_enabled() || hvf_enabled())) {
35
- tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
27
error_report("mach-virt: %s does not support providing "
36
-
28
"Virtualization extensions to the guest CPU",
37
tcg_temp_free_i64(tmplo);
29
- kvm_enabled() ? "KVM" : "HVF");
38
- tcg_temp_free_i64(tmphi);
30
+ current_accel_name());
39
31
exit(1);
40
- clear_vec_high(s, true, destidx);
41
+ if (tmphi) {
42
+ tcg_gen_st_i64(tmphi, cpu_env, fp_reg_hi_offset(s, destidx));
43
+ tcg_temp_free_i64(tmphi);
44
+ }
45
+ clear_vec_high(s, tmphi != NULL, destidx);
46
}
47
48
/*
49
@@ -XXX,XX +XXX,XX @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
50
read_vec_element(s, tcg_resh, rm, 0, MO_64);
51
do_ext64(s, tcg_resh, tcg_resl, pos);
52
}
53
- tcg_gen_movi_i64(tcg_resh, 0);
54
} else {
55
TCGv_i64 tcg_hh;
56
typedef struct {
57
@@ -XXX,XX +XXX,XX @@ static void disas_simd_ext(DisasContext *s, uint32_t insn)
58
59
write_vec_element(s, tcg_resl, rd, 0, MO_64);
60
tcg_temp_free_i64(tcg_resl);
61
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
62
+ if (is_q) {
63
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
64
+ }
65
tcg_temp_free_i64(tcg_resh);
66
- clear_vec_high(s, true, rd);
67
+ clear_vec_high(s, is_q, rd);
68
}
69
70
/* TBL/TBX
71
@@ -XXX,XX +XXX,XX @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
72
* the input.
73
*/
74
tcg_resl = tcg_temp_new_i64();
75
- tcg_resh = tcg_temp_new_i64();
76
+ tcg_resh = NULL;
77
78
if (is_tblx) {
79
read_vec_element(s, tcg_resl, rd, 0, MO_64);
80
} else {
81
tcg_gen_movi_i64(tcg_resl, 0);
82
}
32
}
83
- if (is_tblx && is_q) {
33
84
- read_vec_element(s, tcg_resh, rd, 1, MO_64);
34
if (vms->mte && (kvm_enabled() || hvf_enabled())) {
85
- } else {
35
error_report("mach-virt: %s does not support providing "
86
- tcg_gen_movi_i64(tcg_resh, 0);
36
"MTE to the guest CPU",
87
+
37
- kvm_enabled() ? "KVM" : "HVF");
88
+ if (is_q) {
38
+ current_accel_name());
89
+ tcg_resh = tcg_temp_new_i64();
39
exit(1);
90
+ if (is_tblx) {
91
+ read_vec_element(s, tcg_resh, rd, 1, MO_64);
92
+ } else {
93
+ tcg_gen_movi_i64(tcg_resh, 0);
94
+ }
95
}
40
}
96
41
97
tcg_idx = tcg_temp_new_i64();
98
@@ -XXX,XX +XXX,XX @@ static void disas_simd_tb(DisasContext *s, uint32_t insn)
99
100
write_vec_element(s, tcg_resl, rd, 0, MO_64);
101
tcg_temp_free_i64(tcg_resl);
102
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
103
- tcg_temp_free_i64(tcg_resh);
104
- clear_vec_high(s, true, rd);
105
+
106
+ if (is_q) {
107
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
108
+ tcg_temp_free_i64(tcg_resh);
109
+ }
110
+ clear_vec_high(s, is_q, rd);
111
}
112
113
/* ZIP/UZP/TRN
114
@@ -XXX,XX +XXX,XX @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
115
}
116
117
tcg_resl = tcg_const_i64(0);
118
- tcg_resh = tcg_const_i64(0);
119
+ tcg_resh = is_q ? tcg_const_i64(0) : NULL;
120
tcg_res = tcg_temp_new_i64();
121
122
for (i = 0; i < elements; i++) {
123
@@ -XXX,XX +XXX,XX @@ static void disas_simd_zip_trn(DisasContext *s, uint32_t insn)
124
125
write_vec_element(s, tcg_resl, rd, 0, MO_64);
126
tcg_temp_free_i64(tcg_resl);
127
- write_vec_element(s, tcg_resh, rd, 1, MO_64);
128
- tcg_temp_free_i64(tcg_resh);
129
- clear_vec_high(s, true, rd);
130
+
131
+ if (is_q) {
132
+ write_vec_element(s, tcg_resh, rd, 1, MO_64);
133
+ tcg_temp_free_i64(tcg_resh);
134
+ }
135
+ clear_vec_high(s, is_q, rd);
136
}
137
138
/*
139
--
42
--
140
2.20.1
43
2.34.1
141
142
diff view generated by jsdifflib
1
Provide a minimal documentation of the Musca boards.
1
From: Hao Wu <wuhaotsh@google.com>
2
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
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20200507151819.28444-6-peter.maydell@linaro.org
8
---
12
---
9
docs/system/arm/musca.rst | 31 +++++++++++++++++++++++++++++++
13
MAINTAINERS | 2 +-
10
docs/system/target-arm.rst | 1 +
14
1 file changed, 1 insertion(+), 1 deletion(-)
11
MAINTAINERS | 1 +
12
3 files changed, 33 insertions(+)
13
create mode 100644 docs/system/arm/musca.rst
14
15
15
diff --git a/docs/system/arm/musca.rst b/docs/system/arm/musca.rst
16
new file mode 100644
17
index XXXXXXX..XXXXXXX
18
--- /dev/null
19
+++ b/docs/system/arm/musca.rst
20
@@ -XXX,XX +XXX,XX @@
21
+Arm Musca boards (``musca-a``, ``musca-b1``)
22
+============================================
23
+
24
+The Arm Musca development boards are a reference implementation
25
+of a system using the SSE-200 Subsystem for Embedded. They are
26
+dual Cortex-M33 systems.
27
+
28
+QEMU provides models of the A and B1 variants of this board.
29
+
30
+Unimplemented devices:
31
+
32
+- SPI
33
+- |I2C|
34
+- |I2S|
35
+- PWM
36
+- QSPI
37
+- Timer
38
+- SCC
39
+- GPIO
40
+- eFlash
41
+- MHU
42
+- PVT
43
+- SDIO
44
+- CryptoCell
45
+
46
+Note that (like the real hardware) the Musca-A machine is
47
+asymmetric: CPU 0 does not have the FPU or DSP extensions,
48
+but CPU 1 does. Also like the real hardware, the memory maps
49
+for the A and B1 variants differ significantly, so guest
50
+software must be built for the right variant.
51
+
52
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
53
index XXXXXXX..XXXXXXX 100644
54
--- a/docs/system/target-arm.rst
55
+++ b/docs/system/target-arm.rst
56
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
57
58
arm/integratorcp
59
arm/mps2
60
+ arm/musca
61
arm/realview
62
arm/versatile
63
arm/vexpress
64
diff --git a/MAINTAINERS b/MAINTAINERS
16
diff --git a/MAINTAINERS b/MAINTAINERS
65
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
66
--- a/MAINTAINERS
18
--- a/MAINTAINERS
67
+++ b/MAINTAINERS
19
+++ b/MAINTAINERS
68
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
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>
69
L: qemu-arm@nongnu.org
27
L: qemu-arm@nongnu.org
70
S: Maintained
28
S: Supported
71
F: hw/arm/musca.c
29
F: hw/*/npcm7xx*
72
+F: docs/system/arm/musca.rst
73
74
Musicpal
75
M: Jan Kiszka <jan.kiszka@web.de>
76
--
30
--
77
2.20.1
31
2.34.1
78
79
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Hao Wu <wuhaotsh@google.com>
2
2
3
The canon-a1100 machine can be used with the Barebox firmware. The
3
Nuvoton's PSPI is a general purpose SPI module which enables
4
QEMU Advent Calendar 2018 features a pre-compiled image which we
4
connections to SPI-based peripheral devices.
5
can use for testing.
6
5
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Hao Wu <wuhaotsh@google.com>
8
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Chris Rauer <crauer@google.com>
9
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
10
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
9
Message-id: 20230208235433.3989937-3-wuhaotsh@google.com
11
Signed-off-by: Thomas Huth <thuth@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Message-id: 20200514190422.23645-1-f4bug@amsat.org
14
Message-Id: <20200129090420.13954-1-thuth@redhat.com>
15
[PMD: Rebased MAINTAINERS]
16
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
11
---
19
MAINTAINERS | 1 +
12
MAINTAINERS | 6 +-
20
tests/acceptance/machine_arm_canona1100.py | 35 ++++++++++++++++++++++
13
include/hw/ssi/npcm_pspi.h | 53 +++++++++
21
2 files changed, 36 insertions(+)
14
hw/ssi/npcm_pspi.c | 221 +++++++++++++++++++++++++++++++++++++
22
create mode 100644 tests/acceptance/machine_arm_canona1100.py
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
23
20
24
diff --git a/MAINTAINERS b/MAINTAINERS
21
diff --git a/MAINTAINERS b/MAINTAINERS
25
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
26
--- a/MAINTAINERS
23
--- a/MAINTAINERS
27
+++ b/MAINTAINERS
24
+++ b/MAINTAINERS
28
@@ -XXX,XX +XXX,XX @@ S: Odd Fixes
25
@@ -XXX,XX +XXX,XX @@ M: Tyrone Ting <kfting@nuvoton.com>
29
F: include/hw/arm/digic.h
26
M: Hao Wu <wuhaotsh@google.com>
30
F: hw/*/digic*
27
L: qemu-arm@nongnu.org
31
F: include/hw/*/digic*
28
S: Supported
32
+F: tests/acceptance/machine_arm_canona1100.py
29
-F: hw/*/npcm7xx*
33
30
-F: include/hw/*/npcm7xx*
34
Goldfish RTC
31
-F: tests/qtest/npcm7xx*
35
M: Anup Patel <anup.patel@wdc.com>
32
+F: hw/*/npcm*
36
diff --git a/tests/acceptance/machine_arm_canona1100.py b/tests/acceptance/machine_arm_canona1100.py
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
37
new file mode 100644
39
new file mode 100644
38
index XXXXXXX..XXXXXXX
40
index XXXXXXX..XXXXXXX
39
--- /dev/null
41
--- /dev/null
40
+++ b/tests/acceptance/machine_arm_canona1100.py
42
+++ b/include/hw/ssi/npcm_pspi.h
41
@@ -XXX,XX +XXX,XX @@
43
@@ -XXX,XX +XXX,XX @@
42
+# Functional test that boots the canon-a1100 machine with firmware
44
+/*
43
+#
45
+ * Nuvoton Peripheral SPI Module
44
+# Copyright (c) 2020 Red Hat, Inc.
46
+ *
45
+#
47
+ * Copyright 2023 Google LLC
46
+# Author:
48
+ *
47
+# Thomas Huth <thuth@redhat.com>
49
+ * This program is free software; you can redistribute it and/or modify it
48
+#
50
+ * under the terms of the GNU General Public License as published by the
49
+# This work is licensed under the terms of the GNU GPL, version 2 or
51
+ * Free Software Foundation; either version 2 of the License, or
50
+# later. See the COPYING file in the top-level directory.
52
+ * (at your option) any later version.
51
+
53
+ *
52
+from avocado_qemu import Test
54
+ * This program is distributed in the hope that it will be useful, but WITHOUT
53
+from avocado_qemu import wait_for_console_pattern
55
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
54
+from avocado.utils import archive
56
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
55
+
57
+ * for more details.
56
+class CanonA1100Machine(Test):
58
+ */
57
+ """Boots the barebox firmware and checks that the console is operational"""
59
+#ifndef NPCM_PSPI_H
58
+
60
+#define NPCM_PSPI_H
59
+ timeout = 90
61
+
60
+
62
+#include "hw/ssi/ssi.h"
61
+ def test_arm_canona1100(self):
63
+#include "hw/sysbus.h"
62
+ """
64
+
63
+ :avocado: tags=arch:arm
65
+/*
64
+ :avocado: tags=machine:canon-a1100
66
+ * Number of registers in our device state structure. Don't change this without
65
+ :avocado: tags=device:pflash_cfi02
67
+ * incrementing the version_id in the vmstate.
66
+ """
68
+ */
67
+ tar_url = ('https://www.qemu-advent-calendar.org'
69
+#define NPCM_PSPI_NR_REGS 3
68
+ '/2018/download/day18.tar.xz')
70
+
69
+ tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
71
+/**
70
+ file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
72
+ * NPCMPSPIState - Device state for one Flash Interface Unit.
71
+ archive.extract(file_path, self.workdir)
73
+ * @parent: System bus device.
72
+ self.vm.set_console()
74
+ * @mmio: Memory region for register access.
73
+ self.vm.add_args('-bios',
75
+ * @spi: The SPI bus mastered by this controller.
74
+ self.workdir + '/day18/barebox.canon-a1100.bin')
76
+ * @regs: Register contents.
75
+ self.vm.launch()
77
+ * @irq: The interrupt request queue for this module.
76
+ wait_for_console_pattern(self, 'running /env/bin/init')
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"
77
--
352
--
78
2.20.1
353
2.34.1
79
80
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Hao Wu <wuhaotsh@google.com>
2
2
3
i.MX7 supports watchdog pretimeout interupts. With this commit,
3
Signed-off-by: Hao Wu <wuhaotsh@google.com>
4
the watchdog in mcimx7d-sabre is fully operational, including
4
Reviewed-by: Titus Rwantare <titusr@google.com>
5
pretimeout support.
5
Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org>
6
6
Message-id: 20230208235433.3989937-4-wuhaotsh@google.com
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
Message-id: 20200517162135.110364-9-linux@roeck-us.net
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
8
---
12
include/hw/arm/fsl-imx7.h | 5 +++++
9
docs/system/arm/nuvoton.rst | 2 +-
13
hw/arm/fsl-imx7.c | 11 +++++++++++
10
include/hw/arm/npcm7xx.h | 2 ++
14
2 files changed, 16 insertions(+)
11
hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++--
12
3 files changed, 26 insertions(+), 3 deletions(-)
15
13
16
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
14
diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx7.h
16
--- a/docs/system/arm/nuvoton.rst
19
+++ b/include/hw/arm/fsl-imx7.h
17
+++ b/docs/system/arm/nuvoton.rst
20
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
18
@@ -XXX,XX +XXX,XX @@ Supported devices
21
FSL_IMX7_USB2_IRQ = 42,
19
* SMBus controller (SMBF)
22
FSL_IMX7_USB3_IRQ = 40,
20
* Ethernet controller (EMC)
23
21
* Tachometer
24
+ FSL_IMX7_WDOG1_IRQ = 78,
22
+ * Peripheral SPI controller (PSPI)
25
+ FSL_IMX7_WDOG2_IRQ = 79,
23
26
+ FSL_IMX7_WDOG3_IRQ = 10,
24
Missing devices
27
+ FSL_IMX7_WDOG4_IRQ = 109,
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
+};
28
+
76
+
29
FSL_IMX7_PCI_INTA_IRQ = 125,
77
static const struct {
30
FSL_IMX7_PCI_INTB_IRQ = 124,
78
hwaddr regs_addr;
31
FSL_IMX7_PCI_INTC_IRQ = 123,
79
uint32_t unconnected_pins;
32
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
80
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_init(Object *obj)
33
index XXXXXXX..XXXXXXX 100644
81
object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EMC);
34
--- a/hw/arm/fsl-imx7.c
35
+++ b/hw/arm/fsl-imx7.c
36
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
37
FSL_IMX7_WDOG3_ADDR,
38
FSL_IMX7_WDOG4_ADDR,
39
};
40
+ static const int FSL_IMX7_WDOGn_IRQ[FSL_IMX7_NUM_WDTS] = {
41
+ FSL_IMX7_WDOG1_IRQ,
42
+ FSL_IMX7_WDOG2_IRQ,
43
+ FSL_IMX7_WDOG3_IRQ,
44
+ FSL_IMX7_WDOG4_IRQ,
45
+ };
46
47
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
48
+ &error_abort);
49
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
50
&error_abort);
51
52
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX7_WDOGn_ADDR[i]);
53
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
54
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
55
+ FSL_IMX7_WDOGn_IRQ[i]));
56
}
82
}
57
83
58
/*
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);
89
}
90
91
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
92
sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc), 0,
93
npcm7xx_irq(s, NPCM7XX_MMC_IRQ));
94
95
+ /* PSPI */
96
+ QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_pspi_addr) != ARRAY_SIZE(s->pspi));
97
+ for (i = 0; i < ARRAY_SIZE(s->pspi); i++) {
98
+ SysBusDevice *sbd = SYS_BUS_DEVICE(&s->pspi[i]);
99
+ int irq = (i == 0) ? NPCM7XX_PSPI1_IRQ : NPCM7XX_PSPI2_IRQ;
100
+
101
+ sysbus_realize(sbd, &error_abort);
102
+ sysbus_mmio_map(sbd, 0, npcm7xx_pspi_addr[i]);
103
+ sysbus_connect_irq(sbd, 0, npcm7xx_irq(s, irq));
104
+ }
105
+
106
create_unimplemented_device("npcm7xx.shm", 0xc0001000, 4 * KiB);
107
create_unimplemented_device("npcm7xx.vdmx", 0xe0800000, 4 * KiB);
108
create_unimplemented_device("npcm7xx.pcierc", 0xe1000000, 64 * KiB);
109
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
110
create_unimplemented_device("npcm7xx.peci", 0xf0100000, 4 * KiB);
111
create_unimplemented_device("npcm7xx.siox[1]", 0xf0101000, 4 * KiB);
112
create_unimplemented_device("npcm7xx.siox[2]", 0xf0102000, 4 * KiB);
113
- create_unimplemented_device("npcm7xx.pspi1", 0xf0200000, 4 * KiB);
114
- create_unimplemented_device("npcm7xx.pspi2", 0xf0201000, 4 * KiB);
115
create_unimplemented_device("npcm7xx.ahbpci", 0xf0400000, 1 * MiB);
116
create_unimplemented_device("npcm7xx.mcphy", 0xf05f0000, 64 * KiB);
117
create_unimplemented_device("npcm7xx.gmac1", 0xf0802000, 8 * KiB);
59
--
118
--
60
2.20.1
119
2.34.1
61
62
diff view generated by jsdifflib
1
We incorrectly treat SVC 0xf0002 as a cacheflush request (which is a
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
NOP for QEMU). This is the wrong syscall number, because in the
3
svc-immediate OABI syscall numbers are all offset by the
4
ARM_SYSCALL_BASE value and so the correct insn is SVC 0x9f0002.
5
(This is handled further down in the code with the other Arm-specific
6
syscalls like NR_breakpoint.)
7
2
8
When this code was initially added in commit 6f1f31c069b20611 in
3
Addresses targeting the second translation table (TTB1) in the SMMU have
9
2004, ARM_NR_cacheflush was defined as (ARM_SYSCALL_BASE + 0xf0000 + 2)
4
all upper bits set. Ensure the IOMMU region covers all 64 bits.
10
so the value in the comparison took account of the extra 0x900000
11
offset. In commit fbb4a2e371f2fa7 in 2008, the ARM_SYSCALL_BASE
12
was removed from the definition of ARM_NR_cacheflush and handling
13
for this group of syscalls was added below the point where we subtract
14
ARM_SYSCALL_BASE from the SVC immediate value. However that commit
15
forgot to remove the now-obsolete earlier handling code.
16
5
17
Remove the spurious ARM_NR_cacheflush condition.
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(-)
18
15
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
20
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
21
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
22
Message-id: 20200420212206.12776-3-peter.maydell@linaro.org
23
---
24
linux-user/arm/cpu_loop.c | 4 +---
25
1 file changed, 1 insertion(+), 3 deletions(-)
26
27
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
28
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
29
--- a/linux-user/arm/cpu_loop.c
18
--- a/include/hw/arm/smmu-common.h
30
+++ b/linux-user/arm/cpu_loop.c
19
+++ b/include/hw/arm/smmu-common.h
31
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
20
@@ -XXX,XX +XXX,XX @@
32
n = insn & 0xffffff;
21
#define SMMU_PCI_DEVFN_MAX 256
33
}
22
#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
34
23
35
- if (n == ARM_NR_cacheflush) {
24
-#define SMMU_MAX_VA_BITS 48
36
- /* nop */
25
-
37
- } else if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
26
/*
38
+ if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
27
* Page table walk error types
39
/* linux syscall */
28
*/
40
if (env->thumb || n == 0) {
29
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
41
n = env->regs[7];
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
--
42
--
43
2.20.1
43
2.34.1
44
45
diff view generated by jsdifflib
1
Add basic documentation of the MPS2 board models.
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
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
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20200507151819.28444-5-peter.maydell@linaro.org
8
---
13
---
9
docs/system/arm/mps2.rst | 29 +++++++++++++++++++++++++++++
14
hw/arm/smmu-common.c | 2 +-
10
docs/system/target-arm.rst | 1 +
15
1 file changed, 1 insertion(+), 1 deletion(-)
11
MAINTAINERS | 1 +
12
3 files changed, 31 insertions(+)
13
create mode 100644 docs/system/arm/mps2.rst
14
16
15
diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst
17
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
16
new file mode 100644
17
index XXXXXXX..XXXXXXX
18
--- /dev/null
19
+++ b/docs/system/arm/mps2.rst
20
@@ -XXX,XX +XXX,XX @@
21
+Arm MPS2 boards (``mps2-an385``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``)
22
+================================================================================
23
+
24
+These board models all use Arm M-profile CPUs.
25
+
26
+The Arm MPS2 and MPS2+ dev boards are FPGA based (the 2+ has a bigger
27
+FPGA but is otherwise the same as the 2). Since the CPU itself
28
+and most of the devices are in the FPGA, the details of the board
29
+as seen by the guest depend significantly on the FPGA image.
30
+
31
+QEMU models the following FPGA images:
32
+
33
+``mps2-an385``
34
+ Cortex-M3 as documented in ARM Application Note AN385
35
+``mps2-an511``
36
+ Cortex-M3 'DesignStart' as documented in AN511
37
+``mps2-an505``
38
+ Cortex-M33 as documented in ARM Application Note AN505
39
+``mps2-an521``
40
+ Dual Cortex-M33 as documented in Application Note AN521
41
+
42
+Differences between QEMU and real hardware:
43
+
44
+- AN385 remapping of low 16K of memory to either ZBT SSRAM1 or to
45
+ block RAM is unimplemented (QEMU always maps this to ZBT SSRAM1, as
46
+ if zbt_boot_ctrl is always zero)
47
+- QEMU provides a LAN9118 ethernet rather than LAN9220; the only guest
48
+ visible difference is that the LAN9118 doesn't support checksum
49
+ offloading
50
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
51
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
52
--- a/docs/system/target-arm.rst
19
--- a/hw/arm/smmu-common.c
53
+++ b/docs/system/target-arm.rst
20
+++ b/hw/arm/smmu-common.c
54
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
21
@@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova)
55
:maxdepth: 1
22
/* there is a ttbr0 region and we are in it (high bits all zero) */
56
23
return &cfg->tt[0];
57
arm/integratorcp
24
} else if (cfg->tt[1].tsz &&
58
+ arm/mps2
25
- !extract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte)) {
59
arm/realview
26
+ sextract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte) == -1) {
60
arm/versatile
27
/* there is a ttbr1 region and we are in it (high bits all one) */
61
arm/vexpress
28
return &cfg->tt[1];
62
diff --git a/MAINTAINERS b/MAINTAINERS
29
} else if (!cfg->tt[0].tsz) {
63
index XXXXXXX..XXXXXXX 100644
64
--- a/MAINTAINERS
65
+++ b/MAINTAINERS
66
@@ -XXX,XX +XXX,XX @@ F: hw/misc/armsse-cpuid.c
67
F: include/hw/misc/armsse-cpuid.h
68
F: hw/misc/armsse-mhu.c
69
F: include/hw/misc/armsse-mhu.h
70
+F: docs/system/arm/mps2.rst
71
72
Musca
73
M: Peter Maydell <peter.maydell@linaro.org>
74
--
30
--
75
2.20.1
31
2.34.1
76
77
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
hw_error() calls exit(). This a bit overkill when we can log
3
make it clearer from the name that this is a tcg-only function.
4
the accesses as unimplemented or guest error.
5
4
6
When fuzzing the devices, we don't want the whole process to
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
exit. Replace some hw_error() calls by qemu_log_mask().
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20200518140309.5220-2-f4bug@amsat.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
11
---
14
hw/arm/integratorcp.c | 23 +++++++++++++++--------
12
target/arm/helper.c | 4 ++--
15
1 file changed, 15 insertions(+), 8 deletions(-)
13
1 file changed, 2 insertions(+), 2 deletions(-)
16
14
17
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/integratorcp.c
17
--- a/target/arm/helper.c
20
+++ b/hw/arm/integratorcp.c
18
+++ b/target/arm/helper.c
21
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
22
#include "exec/address-spaces.h"
20
* trapped to the hypervisor in KVM.
23
#include "sysemu/runstate.h"
21
*/
24
#include "sysemu/sysemu.h"
22
#ifdef CONFIG_TCG
25
+#include "qemu/log.h"
23
-static void handle_semihosting(CPUState *cs)
26
#include "qemu/error-report.h"
24
+static void tcg_handle_semihosting(CPUState *cs)
27
#include "hw/char/pl011.h"
25
{
28
#include "hw/hw.h"
26
ARMCPU *cpu = ARM_CPU(cs);
29
@@ -XXX,XX +XXX,XX @@ static uint64_t integratorcm_read(void *opaque, hwaddr offset,
27
CPUARMState *env = &cpu->env;
30
/* ??? Voltage control unimplemented. */
28
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
31
return 0;
29
*/
32
default:
30
#ifdef CONFIG_TCG
33
- hw_error("integratorcm_read: Unimplemented offset 0x%x\n",
31
if (cs->exception_index == EXCP_SEMIHOST) {
34
- (int)offset);
32
- handle_semihosting(cs);
35
+ qemu_log_mask(LOG_UNIMP,
33
+ tcg_handle_semihosting(cs);
36
+ "%s: Unimplemented offset 0x%" HWADDR_PRIX "\n",
37
+ __func__, offset);
38
return 0;
39
}
40
}
41
@@ -XXX,XX +XXX,XX @@ static void integratorcm_write(void *opaque, hwaddr offset,
42
/* ??? Voltage control unimplemented. */
43
break;
44
default:
45
- hw_error("integratorcm_write: Unimplemented offset 0x%x\n",
46
- (int)offset);
47
+ qemu_log_mask(LOG_UNIMP,
48
+ "%s: Unimplemented offset 0x%" HWADDR_PRIX "\n",
49
+ __func__, offset);
50
break;
51
}
52
}
53
@@ -XXX,XX +XXX,XX @@ static uint64_t icp_pic_read(void *opaque, hwaddr offset,
54
case 5: /* INT_SOFTCLR */
55
case 11: /* FRQ_ENABLECLR */
56
default:
57
- printf ("icp_pic_read: Bad register offset 0x%x\n", (int)offset);
58
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
59
+ __func__, offset);
60
return 0;
61
}
62
}
63
@@ -XXX,XX +XXX,XX @@ static void icp_pic_write(void *opaque, hwaddr offset,
64
case 8: /* FRQ_STATUS */
65
case 9: /* FRQ_RAWSTAT */
66
default:
67
- printf ("icp_pic_write: Bad register offset 0x%x\n", (int)offset);
68
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
69
+ __func__, offset);
70
return;
34
return;
71
}
35
}
72
icp_pic_update(s);
36
#endif
73
@@ -XXX,XX +XXX,XX @@ static uint64_t icp_control_read(void *opaque, hwaddr offset,
74
case 3: /* CP_DECODE */
75
return 0x11;
76
default:
77
- hw_error("icp_control_read: Bad offset %x\n", (int)offset);
78
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
79
+ __func__, offset);
80
return 0;
81
}
82
}
83
@@ -XXX,XX +XXX,XX @@ static void icp_control_write(void *opaque, hwaddr offset,
84
/* Nothing interesting implemented yet. */
85
break;
86
default:
87
- hw_error("icp_control_write: Bad offset %x\n", (int)offset);
88
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%" HWADDR_PRIX "\n",
89
+ __func__, offset);
90
}
91
}
92
93
--
37
--
94
2.20.1
38
2.34.1
95
39
96
40
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
With this commit, the watchdog on mcimx6ul-evk is fully operational,
3
for "all" builds (tcg + kvm), we want to avoid doing
4
including pretimeout support.
4
the psci check if tcg is built-in, but not enabled.
5
5
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200517162135.110364-7-linux@roeck-us.net
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
hw/arm/fsl-imx6ul.c | 10 ++++++++++
12
target/arm/helper.c | 3 ++-
12
1 file changed, 10 insertions(+)
13
1 file changed, 2 insertions(+), 1 deletion(-)
13
14
14
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.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/hw/arm/fsl-imx6ul.c
17
--- a/target/arm/helper.c
17
+++ b/hw/arm/fsl-imx6ul.c
18
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
19
@@ -XXX,XX +XXX,XX @@
19
FSL_IMX6UL_WDOG2_ADDR,
20
#include "hw/irq.h"
20
FSL_IMX6UL_WDOG3_ADDR,
21
#include "sysemu/cpu-timers.h"
21
};
22
#include "sysemu/kvm.h"
22
+ static const int FSL_IMX6UL_WDOGn_IRQ[FSL_IMX6UL_NUM_WDTS] = {
23
+#include "sysemu/tcg.h"
23
+ FSL_IMX6UL_WDOG1_IRQ,
24
#include "qapi/qapi-commands-machine-target.h"
24
+ FSL_IMX6UL_WDOG2_IRQ,
25
#include "qapi/error.h"
25
+ FSL_IMX6UL_WDOG3_IRQ,
26
#include "qemu/guest-random.h"
26
+ };
27
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
27
28
env->exception.syndrome);
28
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
29
+ &error_abort);
30
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
31
&error_abort);
32
33
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
34
FSL_IMX6UL_WDOGn_ADDR[i]);
35
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
36
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
37
+ FSL_IMX6UL_WDOGn_IRQ[i]));
38
}
29
}
39
30
40
/*
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;
41
--
36
--
42
2.20.1
37
2.34.1
43
38
44
39
diff view generated by jsdifflib
1
From: Geert Uytterhoeven <geert+renesas@glider.be>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
Add a definition for the number of GPIO lines controlled by a PL061
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
instance, and use it instead of the hardcoded magic value 8.
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
5
Signed-off-by: Fabiano Rosas <farosas@suse.de>
6
Suggested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20200519085143.1376-1-geert+renesas@glider.be
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
8
---
12
hw/gpio/pl061.c | 12 +++++++-----
9
target/arm/helper.c | 12 +++++++-----
13
1 file changed, 7 insertions(+), 5 deletions(-)
10
1 file changed, 7 insertions(+), 5 deletions(-)
14
11
15
diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/gpio/pl061.c
14
--- a/target/arm/helper.c
18
+++ b/hw/gpio/pl061.c
15
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ static const uint8_t pl061_id_luminary[12] =
16
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
20
#define TYPE_PL061 "pl061"
17
unsigned int cur_el = arm_current_el(env);
21
#define PL061(obj) OBJECT_CHECK(PL061State, (obj), TYPE_PL061)
18
int rt;
22
19
23
+#define N_GPIOS 8
20
- /*
24
+
21
- * Note that new_el can never be 0. If cur_el is 0, then
25
typedef struct PL061State {
22
- * el0_a64 is is_a64(), else el0_a64 is ignored.
26
SysBusDevice parent_obj;
23
- */
27
24
- aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
28
@@ -XXX,XX +XXX,XX @@ typedef struct PL061State {
25
+ if (tcg_enabled()) {
29
uint32_t cr;
26
+ /*
30
uint32_t amsel;
27
+ * Note that new_el can never be 0. If cur_el is 0, then
31
qemu_irq irq;
28
+ * el0_a64 is is_a64(), else el0_a64 is ignored.
32
- qemu_irq out[8];
29
+ */
33
+ qemu_irq out[N_GPIOS];
30
+ aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
34
const unsigned char *id;
31
+ }
35
uint32_t rsvd_start; /* reserved area: [rsvd_start, 0xfcc] */
32
36
} PL061State;
33
if (cur_el < new_el) {
37
@@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s)
34
/*
38
changed = s->old_out_data ^ out;
39
if (changed) {
40
s->old_out_data = out;
41
- for (i = 0; i < 8; i++) {
42
+ for (i = 0; i < N_GPIOS; i++) {
43
mask = 1 << i;
44
if (changed & mask) {
45
DPRINTF("Set output %d = %d\n", i, (out & mask) != 0);
46
@@ -XXX,XX +XXX,XX @@ static void pl061_update(PL061State *s)
47
changed = (s->old_in_data ^ s->data) & ~s->dir;
48
if (changed) {
49
s->old_in_data = s->data;
50
- for (i = 0; i < 8; i++) {
51
+ for (i = 0; i < N_GPIOS; i++) {
52
mask = 1 << i;
53
if (changed & mask) {
54
DPRINTF("Changed input %d = %d\n", i, (s->data & mask) != 0);
55
@@ -XXX,XX +XXX,XX @@ static void pl061_init(Object *obj)
56
memory_region_init_io(&s->iomem, obj, &pl061_ops, s, "pl061", 0x1000);
57
sysbus_init_mmio(sbd, &s->iomem);
58
sysbus_init_irq(sbd, &s->irq);
59
- qdev_init_gpio_in(dev, pl061_set_irq, 8);
60
- qdev_init_gpio_out(dev, s->out, 8);
61
+ qdev_init_gpio_in(dev, pl061_set_irq, N_GPIOS);
62
+ qdev_init_gpio_out(dev, s->out, N_GPIOS);
63
}
64
65
static void pl061_class_init(ObjectClass *klass, void *data)
66
--
35
--
67
2.20.1
36
2.34.1
68
37
69
38
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
With this commit, the watchdog on imx25-pdk is fully operational,
3
Move this earlier to make the next patch diff cleaner. While here
4
including pretimeout support.
4
update the comment slightly to not give the impression that the
5
misalignment affects only TCG.
5
6
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Message-id: 20200517162135.110364-4-linux@roeck-us.net
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
12
---
11
include/hw/arm/fsl-imx25.h | 5 +++++
13
target/arm/machine.c | 18 +++++++++---------
12
hw/arm/fsl-imx25.c | 10 ++++++++++
14
1 file changed, 9 insertions(+), 9 deletions(-)
13
hw/arm/Kconfig | 1 +
14
3 files changed, 16 insertions(+)
15
15
16
diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h
16
diff --git a/target/arm/machine.c b/target/arm/machine.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx25.h
18
--- a/target/arm/machine.c
19
+++ b/include/hw/arm/fsl-imx25.h
19
+++ b/target/arm/machine.c
20
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
21
#include "hw/gpio/imx_gpio.h"
21
}
22
#include "hw/sd/sdhci.h"
23
#include "hw/usb/chipidea.h"
24
+#include "hw/watchdog/wdt_imx2.h"
25
#include "exec/memory.h"
26
#include "target/arm/cpu.h"
27
28
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
29
IMXGPIOState gpio[FSL_IMX25_NUM_GPIOS];
30
SDHCIState esdhc[FSL_IMX25_NUM_ESDHCS];
31
ChipideaState usb[FSL_IMX25_NUM_USBS];
32
+ IMX2WdtState wdt;
33
MemoryRegion rom[2];
34
MemoryRegion iram;
35
MemoryRegion iram_alias;
36
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
37
#define FSL_IMX25_GPIO1_SIZE 0x4000
38
#define FSL_IMX25_GPIO2_ADDR 0x53FD0000
39
#define FSL_IMX25_GPIO2_SIZE 0x4000
40
+#define FSL_IMX25_WDT_ADDR 0x53FDC000
41
+#define FSL_IMX25_WDT_SIZE 0x4000
42
#define FSL_IMX25_USB1_ADDR 0x53FF4000
43
#define FSL_IMX25_USB1_SIZE 0x0200
44
#define FSL_IMX25_USB2_ADDR 0x53FF4400
45
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State {
46
#define FSL_IMX25_ESDHC2_IRQ 8
47
#define FSL_IMX25_USB1_IRQ 37
48
#define FSL_IMX25_USB2_IRQ 35
49
+#define FSL_IMX25_WDT_IRQ 55
50
51
#endif /* FSL_IMX25_H */
52
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/arm/fsl-imx25.c
55
+++ b/hw/arm/fsl-imx25.c
56
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj)
57
TYPE_CHIPIDEA);
58
}
22
}
59
23
60
+ sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
24
+ /*
61
}
25
+ * Misaligned thumb pc is architecturally impossible. Fail the
62
26
+ * incoming migration. For TCG it would trigger the assert in
63
static void fsl_imx25_realize(DeviceState *dev, Error **errp)
27
+ * thumb_tr_translate_insn().
64
@@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
28
+ */
65
usb_table[i].irq));
29
+ if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
30
+ return -1;
31
+ }
32
+
33
hw_breakpoint_update_all(cpu);
34
hw_watchpoint_update_all(cpu);
35
36
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
37
}
66
}
38
}
67
39
68
+ /* Watchdog */
40
- /*
69
+ object_property_set_bool(OBJECT(&s->wdt), true, "pretimeout-support",
41
- * Misaligned thumb pc is architecturally impossible.
70
+ &error_abort);
42
- * We have an assert in thumb_tr_translate_insn to verify this.
71
+ object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
43
- * Fail an incoming migrate to avoid this assert.
72
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX25_WDT_ADDR);
44
- */
73
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt), 0,
45
- if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
74
+ qdev_get_gpio_in(DEVICE(&s->avic),
46
- return -1;
75
+ FSL_IMX25_WDT_IRQ));
47
- }
76
+
48
-
77
/* initialize 2 x 16 KB ROM */
49
if (!kvm_enabled()) {
78
memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0",
50
pmu_op_finish(&cpu->env);
79
FSL_IMX25_ROM0_SIZE, &err);
51
}
80
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
81
index XXXXXXX..XXXXXXX 100644
82
--- a/hw/arm/Kconfig
83
+++ b/hw/arm/Kconfig
84
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
85
select IMX
86
select IMX_FEC
87
select IMX_I2C
88
+ select WDT_IMX2
89
select DS1338
90
91
config FSL_IMX31
92
--
52
--
93
2.20.1
53
2.34.1
94
54
95
55
diff view generated by jsdifflib
1
Provide a minimal documentation of the Versatile Express boards
1
From: Fabiano Rosas <farosas@suse.de>
2
(vexpress-a9, vexpress-a15).
2
3
3
Since commit cf7c6d1004 ("target/arm: Split out cpregs.h") we now have
4
a cpregs.h header which is more suitable for this code.
5
6
Code moved verbatim.
7
8
Signed-off-by: Fabiano Rosas <farosas@suse.de>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20200507151819.28444-4-peter.maydell@linaro.org
9
---
13
---
10
docs/system/arm/vexpress.rst | 60 ++++++++++++++++++++++++++++++++++++
14
target/arm/cpregs.h | 98 +++++++++++++++++++++++++++++++++++++++++++++
11
docs/system/target-arm.rst | 1 +
15
target/arm/cpu.h | 91 -----------------------------------------
12
MAINTAINERS | 1 +
16
2 files changed, 98 insertions(+), 91 deletions(-)
13
3 files changed, 62 insertions(+)
17
14
create mode 100644 docs/system/arm/vexpress.rst
18
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
15
16
diff --git a/docs/system/arm/vexpress.rst b/docs/system/arm/vexpress.rst
17
new file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- /dev/null
20
+++ b/docs/system/arm/vexpress.rst
21
@@ -XXX,XX +XXX,XX @@
22
+Arm Versatile Express boards (``vexpress-a9``, ``vexpress-a15``)
23
+================================================================
24
+
25
+QEMU models two variants of the Arm Versatile Express development
26
+board family:
27
+
28
+- ``vexpress-a9`` models the combination of the Versatile Express
29
+ motherboard and the CoreTile Express A9x4 daughterboard
30
+- ``vexpress-a15`` models the combination of the Versatile Express
31
+ motherboard and the CoreTile Express A15x2 daughterboard
32
+
33
+Note that as this hardware does not have PCI, IDE or SCSI,
34
+the only available storage option is emulated SD card.
35
+
36
+Implemented devices:
37
+
38
+- PL041 audio
39
+- PL181 SD controller
40
+- PL050 keyboard and mouse
41
+- PL011 UARTs
42
+- SP804 timers
43
+- I2C controller
44
+- PL031 RTC
45
+- PL111 LCD display controller
46
+- Flash memory
47
+- LAN9118 ethernet
48
+
49
+Unimplemented devices:
50
+
51
+- SP810 system control block
52
+- PCI-express
53
+- USB controller (Philips ISP1761)
54
+- Local DAP ROM
55
+- CoreSight interfaces
56
+- PL301 AXI interconnect
57
+- SCC
58
+- System counter
59
+- HDLCD controller (``vexpress-a15``)
60
+- SP805 watchdog
61
+- PL341 dynamic memory controller
62
+- DMA330 DMA controller
63
+- PL354 static memory controller
64
+- BP147 TrustZone Protection Controller
65
+- TrustZone Address Space Controller
66
+
67
+Other differences between the hardware and the QEMU model:
68
+
69
+- QEMU will default to creating one CPU unless you pass a different
70
+ ``-smp`` argument
71
+- QEMU allows the amount of RAM provided to be specified with the
72
+ ``-m`` argument
73
+- QEMU defaults to providing a CPU which does not provide either
74
+ TrustZone or the Virtualization Extensions: if you want these you
75
+ must enable them with ``-machine secure=on`` and ``-machine
76
+ virtualization=on``
77
+- QEMU provides 4 virtio-mmio virtio transports; these start at
78
+ address ``0x10013000`` for ``vexpress-a9`` and at ``0x1c130000`` for
79
+ ``vexpress-a15``, and have IRQs from 40 upwards. If a dtb is
80
+ provided on the command line then QEMU will edit it to include
81
+ suitable entries describing these transports for the guest.
82
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
83
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
84
--- a/docs/system/target-arm.rst
20
--- a/target/arm/cpregs.h
85
+++ b/docs/system/target-arm.rst
21
+++ b/target/arm/cpregs.h
86
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
22
@@ -XXX,XX +XXX,XX @@ enum {
87
arm/integratorcp
23
ARM_CP_SME = 1 << 19,
88
arm/realview
24
};
89
arm/versatile
25
90
+ arm/vexpress
26
+/*
91
arm/musicpal
27
+ * Interface for defining coprocessor registers.
92
arm/nseries
28
+ * Registers are defined in tables of arm_cp_reginfo structs
93
arm/orangepi
29
+ * which are passed to define_arm_cp_regs().
94
diff --git a/MAINTAINERS b/MAINTAINERS
30
+ */
31
+
32
+/*
33
+ * When looking up a coprocessor register we look for it
34
+ * via an integer which encodes all of:
35
+ * coprocessor number
36
+ * Crn, Crm, opc1, opc2 fields
37
+ * 32 or 64 bit register (ie is it accessed via MRC/MCR
38
+ * or via MRRC/MCRR?)
39
+ * non-secure/secure bank (AArch32 only)
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)
84
+{
85
+ uint32_t cpregid = kvmid;
86
+ if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
87
+ cpregid |= CP_REG_AA64_MASK;
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;
100
+}
101
+
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
95
index XXXXXXX..XXXXXXX 100644
128
index XXXXXXX..XXXXXXX 100644
96
--- a/MAINTAINERS
129
--- a/target/arm/cpu.h
97
+++ b/MAINTAINERS
130
+++ b/target/arm/cpu.h
98
@@ -XXX,XX +XXX,XX @@ M: Peter Maydell <peter.maydell@linaro.org>
131
@@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void);
99
L: qemu-arm@nongnu.org
132
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
100
S: Maintained
133
uint32_t cur_el, bool secure);
101
F: hw/arm/vexpress.c
134
102
+F: docs/system/arm/vexpress.rst
135
-/* Interface for defining coprocessor registers.
103
136
- * Registers are defined in tables of arm_cp_reginfo structs
104
Versatile PB
137
- * which are passed to define_arm_cp_regs().
105
M: Peter Maydell <peter.maydell@linaro.org>
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)
228
{
106
--
229
--
107
2.20.1
230
2.34.1
108
231
109
232
diff view generated by jsdifflib
1
The Arm signal-handling code has some parts ifdeffed with a
1
From: Fabiano Rosas <farosas@suse.de>
2
TARGET_CONFIG_CPU_32, which is always defined. This is a leftover
3
from when this code's structure was based on the Linux kernel
4
signal handling code, where it was intended to support 26-bit
5
Arm CPUs. The kernel dropped its CONFIG_CPU_32 in kernel commit
6
4da8b8208eded0ba21e3 in 2009.
7
2
8
QEMU has never had 26-bit CPU support and is unlikely to ever
3
If a test was tagged with the "accel" tag and the specified
9
add it; we certainly aren't going to support 26-bit Linux
4
accelerator it not present in the qemu binary, cancel the test.
10
binaries via linux-user mode. The ifdef is just unhelpful
11
noise, so remove it entirely.
12
5
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>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20200518143014.20689-1-peter.maydell@linaro.org
16
---
13
---
17
linux-user/arm/signal.c | 6 ------
14
tests/avocado/avocado_qemu/__init__.py | 4 ++++
18
1 file changed, 6 deletions(-)
15
1 file changed, 4 insertions(+)
19
16
20
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
17
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
21
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
22
--- a/linux-user/arm/signal.c
19
--- a/tests/avocado/avocado_qemu/__init__.py
23
+++ b/linux-user/arm/signal.c
20
+++ b/tests/avocado/avocado_qemu/__init__.py
24
@@ -XXX,XX +XXX,XX @@ struct rt_sigframe_v2
21
@@ -XXX,XX +XXX,XX @@ def setUp(self):
25
abi_ulong retcode[4];
22
26
};
23
super().setUp('qemu-system-')
27
24
28
-#define TARGET_CONFIG_CPU_32 1
25
+ accel_required = self._get_unique_tag_val('accel')
29
-
26
+ if accel_required:
30
/*
27
+ self.require_accelerator(accel_required)
31
* For ARM syscalls, we encode the syscall number into the instruction.
28
+
32
*/
29
self.machine = self.params.get('machine',
33
@@ -XXX,XX +XXX,XX @@ setup_sigcontext(struct target_sigcontext *sc, /*struct _fpstate *fpstate,*/
30
default=self._get_unique_tag_val('machine'))
34
__put_user(env->regs[13], &sc->arm_sp);
35
__put_user(env->regs[14], &sc->arm_lr);
36
__put_user(env->regs[15], &sc->arm_pc);
37
-#ifdef TARGET_CONFIG_CPU_32
38
__put_user(cpsr_read(env), &sc->arm_cpsr);
39
-#endif
40
41
__put_user(/* current->thread.trap_no */ 0, &sc->trap_no);
42
__put_user(/* current->thread.error_code */ 0, &sc->error_code);
43
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
44
__get_user(env->regs[13], &sc->arm_sp);
45
__get_user(env->regs[14], &sc->arm_lr);
46
__get_user(env->regs[15], &sc->arm_pc);
47
-#ifdef TARGET_CONFIG_CPU_32
48
__get_user(cpsr, &sc->arm_cpsr);
49
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
50
arm_rebuild_hflags(env);
51
-#endif
52
53
err |= !valid_user_regs(env);
54
31
55
--
32
--
56
2.20.1
33
2.34.1
57
34
58
35
diff view generated by jsdifflib
1
Sort the board index into alphabetical order. (Note that we need to
1
From: Fabiano Rosas <farosas@suse.de>
2
sort alphabetically by the title text of each file, which isn't the
3
same ordering as sorting by the filename.)
4
2
3
This allows the test to be skipped when TCG is not present in the QEMU
4
binary.
5
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20200507151819.28444-3-peter.maydell@linaro.org
10
---
10
---
11
docs/system/target-arm.rst | 17 +++++++++++------
11
tests/avocado/boot_linux_console.py | 1 +
12
1 file changed, 11 insertions(+), 6 deletions(-)
12
tests/avocado/reverse_debugging.py | 8 ++++++++
13
2 files changed, 9 insertions(+)
13
14
14
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
15
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/target-arm.rst
17
--- a/tests/avocado/boot_linux_console.py
17
+++ b/docs/system/target-arm.rst
18
+++ b/tests/avocado/boot_linux_console.py
18
@@ -XXX,XX +XXX,XX @@ Unfortunately many of the Arm boards QEMU supports are currently
19
@@ -XXX,XX +XXX,XX @@ def test_arm_orangepi_uboot_netbsd9(self):
19
undocumented; you can get a complete list by running
20
20
``qemu-system-aarch64 --machine help``.
21
def test_aarch64_raspi3_atf(self):
21
22
"""
22
+..
23
+ :avocado: tags=accel:tcg
23
+ This table of contents should be kept sorted alphabetically
24
:avocado: tags=arch:aarch64
24
+ by the title text of each file, which isn't the same ordering
25
:avocado: tags=machine:raspi3b
25
+ as an alphabetical sort by filename.
26
:avocado: tags=cpu:cortex-a53
27
diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py
28
index XXXXXXX..XXXXXXX 100644
29
--- a/tests/avocado/reverse_debugging.py
30
+++ b/tests/avocado/reverse_debugging.py
31
@@ -XXX,XX +XXX,XX @@ def reverse_debugging(self, shift=7, args=None):
32
vm.shutdown()
33
34
class ReverseDebugging_X86_64(ReverseDebugging):
35
+ """
36
+ :avocado: tags=accel:tcg
37
+ """
26
+
38
+
27
.. toctree::
39
REG_PC = 0x10
28
:maxdepth: 1
40
REG_CS = 0x12
29
41
def get_pc(self, g):
30
arm/integratorcp
42
@@ -XXX,XX +XXX,XX @@ def test_x86_64_pc(self):
31
- arm/versatile
43
self.reverse_debugging()
32
arm/realview
44
33
- arm/xscale
45
class ReverseDebugging_AArch64(ReverseDebugging):
34
- arm/palm
46
+ """
35
- arm/nseries
47
+ :avocado: tags=accel:tcg
36
- arm/stellaris
48
+ """
37
+ arm/versatile
49
+
38
arm/musicpal
50
REG_PC = 32
39
- arm/sx1
51
40
+ arm/nseries
52
# unidentified gitlab timeout problem
41
arm/orangepi
42
+ arm/palm
43
+ arm/xscale
44
+ arm/sx1
45
+ arm/stellaris
46
47
Arm CPU features
48
================
49
--
53
--
50
2.20.1
54
2.34.1
51
55
52
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
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
With this patch applied, the watchdog in the sabrelite emulation
3
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4
is fully operational, including pretimeout support.
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
5
Acked-by: Thomas Huth <thuth@redhat.com>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8
Message-id: 20200517162135.110364-6-linux@roeck-us.net
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
7
---
11
hw/arm/fsl-imx6.c | 9 +++++++++
8
tests/qtest/arm-cpu-features.c | 28 ++++++++++++++++++----------
12
1 file changed, 9 insertions(+)
9
1 file changed, 18 insertions(+), 10 deletions(-)
13
10
14
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
11
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/fsl-imx6.c
13
--- a/tests/qtest/arm-cpu-features.c
17
+++ b/hw/arm/fsl-imx6.c
14
+++ b/tests/qtest/arm-cpu-features.c
18
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
15
@@ -XXX,XX +XXX,XX @@
19
FSL_IMX6_WDOG1_ADDR,
16
#define SVE_MAX_VQ 16
20
FSL_IMX6_WDOG2_ADDR,
17
21
};
18
#define MACHINE "-machine virt,gic-version=max -accel tcg "
22
+ static const int FSL_IMX6_WDOGn_IRQ[FSL_IMX6_NUM_WDTS] = {
19
-#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
23
+ FSL_IMX6_WDOG1_IRQ,
20
+#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm "
24
+ FSL_IMX6_WDOG2_IRQ,
21
#define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \
25
+ };
22
" 'arguments': { 'type': 'full', "
26
23
#define QUERY_TAIL "}}"
27
+ object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
24
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
28
+ &error_abort);
25
{
29
object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
26
g_test_init(&argc, &argv, NULL);
30
&error_abort);
27
31
28
- qtest_add_data_func("/arm/query-cpu-model-expansion",
32
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]);
29
- NULL, test_query_cpu_model_expansion);
33
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
30
+ if (qtest_has_accel("tcg")) {
34
+ qdev_get_gpio_in(DEVICE(&s->a9mpcore),
31
+ qtest_add_data_func("/arm/query-cpu-model-expansion",
35
+ FSL_IMX6_WDOGn_IRQ[i]));
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);
36
}
61
}
37
62
38
/* ROM memory */
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
}
39
--
73
--
40
2.20.1
74
2.34.1
41
42
diff view generated by jsdifflib
1
Add 'Arm' to the Integrator/CP document title, for consistency with
1
From: Fabiano Rosas <farosas@suse.de>
2
the titling of the other documentation of Arm devboard models
3
(versatile, realview).
4
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>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-id: 20200507151819.28444-2-peter.maydell@linaro.org
10
---
9
---
11
docs/system/arm/integratorcp.rst | 4 ++--
10
tests/qtest/meson.build | 4 ++--
12
1 file changed, 2 insertions(+), 2 deletions(-)
11
1 file changed, 2 insertions(+), 2 deletions(-)
13
12
14
diff --git a/docs/system/arm/integratorcp.rst b/docs/system/arm/integratorcp.rst
13
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/arm/integratorcp.rst
15
--- a/tests/qtest/meson.build
17
+++ b/docs/system/arm/integratorcp.rst
16
+++ b/tests/qtest/meson.build
18
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ qtests_arm = \
19
-Integrator/CP (``integratorcp``)
18
# TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
20
-================================
19
qtests_aarch64 = \
21
+Arm Integrator/CP (``integratorcp``)
20
(cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \
22
+====================================
21
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \
23
22
- (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \
24
The Arm Integrator/CP board is emulated with the following devices:
23
+ (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \
25
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',
26
--
28
--
27
2.20.1
29
2.34.1
28
29
diff view generated by jsdifflib