1 | Almost nothing in here is arm-related, but the target-arm | 1 | The following changes since commit 003ba52a8b327180e284630b289c6ece5a3e08b9: |
---|---|---|---|
2 | queue was convenient for these last minute bits and pieces | ||
3 | for 5.0... | ||
4 | 2 | ||
5 | thanks | 3 | Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-02-16 11:16:39 +0000) |
6 | -- PMM | ||
7 | |||
8 | The following changes since commit 14e5526b51910efd62cd31cd95b49baca975c83f: | ||
9 | |||
10 | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-04-13 15:42:51 +0100) | ||
11 | 4 | ||
12 | are available in the Git repository at: | 5 | are available in the Git repository at: |
13 | 6 | ||
14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200414 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230216 |
15 | 8 | ||
16 | for you to fetch changes up to 84f82ddcbb4ac4ed04c8675e85155329f23184f0: | 9 | for you to fetch changes up to caf01d6a435d9f4a95aeae2f9fc6cb8b889b1fb8: |
17 | 10 | ||
18 | Deprecate KVM support for AArch32 (2020-04-14 17:20:22 +0100) | 11 | tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG (2023-02-16 16:28:53 +0000) |
19 | 12 | ||
20 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
21 | patch queue: | 14 | target-arm queue: |
22 | * Fix some problems that trip up Coverity's scanner | 15 | * Some mostly M-profile-related code cleanups |
23 | * run-coverity-scan: New script automating the scan-and-upload process | 16 | * avocado: Retire the boot_linux.py AArch64 TCG tests |
24 | * docs: Improve our gdbstub documentation | 17 | * hw/arm/smmuv3: Add GBPA register |
25 | * configure: Honour --disable-werror for Sphinx | 18 | * arm/virt: don't try to spell out the accelerator |
26 | * docs: Fix errors produced when building with Sphinx 3.0 | 19 | * hw/arm: Attach PSPI module to NPCM7XX SoC |
27 | * docs: Require Sphinx 1.6 or better | 20 | * Some cleanup/refactoring patches aiming towards |
28 | * Add deprecation notice for KVM support on AArch32 hosts | 21 | allowing building Arm targets without CONFIG_TCG |
29 | 22 | ||
30 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
31 | Peter Maydell (12): | 24 | Alex Bennée (1): |
32 | osdep.h: Drop no-longer-needed Coverity workarounds | 25 | tests/avocado: retire the Aarch64 TCG tests from boot_linux.py |
33 | thread.h: Fix Coverity version of qemu_cond_timedwait() | ||
34 | thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc | ||
35 | linux-user/flatload.c: Use "" for include of QEMU header target_flat.h | ||
36 | scripts/run-coverity-scan: Script to run Coverity Scan build | ||
37 | scripts/coverity-scan: Add Docker support | ||
38 | docs: Improve our gdbstub documentation | ||
39 | configure: Honour --disable-werror for Sphinx | ||
40 | scripts/kernel-doc: Add missing close-paren in c:function directives | ||
41 | kernel-doc: Use c:struct for Sphinx 3.0 and later | ||
42 | docs: Require Sphinx 1.6 or better | ||
43 | Deprecate KVM support for AArch32 | ||
44 | 26 | ||
45 | configure | 9 +- | 27 | Claudio Fontana (3): |
46 | Makefile | 2 +- | 28 | target/arm: rename handle_semihosting to tcg_handle_semihosting |
47 | include/qemu/osdep.h | 14 - | 29 | target/arm: wrap psci call with tcg_enabled |
48 | include/qemu/thread.h | 12 +- | 30 | target/arm: wrap call to aarch64_sve_change_el in tcg_enabled() |
49 | linux-user/flatload.c | 2 +- | ||
50 | MAINTAINERS | 5 + | ||
51 | docs/conf.py | 6 +- | ||
52 | docs/sphinx/kerneldoc.py | 1 + | ||
53 | docs/system/deprecated.rst | 8 + | ||
54 | docs/system/gdb.rst | 22 +- | ||
55 | qemu-options.hx | 24 +- | ||
56 | scripts/coverity-scan/coverity-scan.docker | 131 ++++++++++ | ||
57 | scripts/coverity-scan/run-coverity-scan | 401 +++++++++++++++++++++++++++++ | ||
58 | scripts/kernel-doc | 18 +- | ||
59 | 14 files changed, 615 insertions(+), 40 deletions(-) | ||
60 | create mode 100644 scripts/coverity-scan/coverity-scan.docker | ||
61 | create mode 100755 scripts/coverity-scan/run-coverity-scan | ||
62 | 31 | ||
32 | Cornelia Huck (1): | ||
33 | arm/virt: don't try to spell out the accelerator | ||
34 | |||
35 | Fabiano Rosas (7): | ||
36 | target/arm: Move PC alignment check | ||
37 | target/arm: Move cpregs code out of cpu.h | ||
38 | tests/avocado: Skip tests that require a missing accelerator | ||
39 | tests/avocado: Tag TCG tests with accel:tcg | ||
40 | target/arm: Use "max" as default cpu for the virt machine with KVM | ||
41 | tests/qtest: arm-cpu-features: Match tests to required accelerators | ||
42 | tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG | ||
43 | |||
44 | Hao Wu (3): | ||
45 | MAINTAINERS: Add myself to maintainers and remove Havard | ||
46 | hw/ssi: Add Nuvoton PSPI Module | ||
47 | hw/arm: Attach PSPI module to NPCM7XX SoC | ||
48 | |||
49 | Jean-Philippe Brucker (2): | ||
50 | hw/arm/smmu-common: Support 64-bit addresses | ||
51 | hw/arm/smmu-common: Fix TTB1 handling | ||
52 | |||
53 | Mostafa Saleh (1): | ||
54 | hw/arm/smmuv3: Add GBPA register | ||
55 | |||
56 | Philippe Mathieu-Daudé (12): | ||
57 | hw/intc/armv7m_nvic: Use OBJECT_DECLARE_SIMPLE_TYPE() macro | ||
58 | target/arm: Simplify arm_v7m_mmu_idx_for_secstate() for user emulation | ||
59 | target/arm: Reduce arm_v7m_mmu_idx_[all/for_secstate_and_priv]() scope | ||
60 | target/arm: Constify ID_PFR1 on user emulation | ||
61 | target/arm: Convert CPUARMState::eabi to boolean | ||
62 | target/arm: Avoid resetting CPUARMState::eabi field | ||
63 | target/arm: Restrict CPUARMState::gicv3state to sysemu | ||
64 | target/arm: Restrict CPUARMState::arm_boot_info to sysemu | ||
65 | target/arm: Restrict CPUARMState::nvic to sysemu | ||
66 | target/arm: Store CPUARMState::nvic as NVICState* | ||
67 | target/arm: Declare CPU <-> NVIC helpers in 'hw/intc/armv7m_nvic.h' | ||
68 | hw/arm: Add missing XLNX_ZYNQMP_ARM -> USB_DWC3 Kconfig dependency | ||
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 | When kernel-doc generates a 'c:function' directive for a function | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | one of whose arguments is a function pointer, it fails to print | ||
3 | the close-paren after the argument list of the function pointer | ||
4 | argument, for instance in the memory API documentation: | ||
5 | .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) | ||
6 | 2 | ||
7 | which should have a ')' after the 'void *host' which is the | 3 | Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro, |
8 | last argument to 'resized'. | 4 | similarly to automatic conversion from commit 8063396bf3 |
5 | ("Use OBJECT_DECLARE_SIMPLE_TYPE when possible"). | ||
9 | 6 | ||
10 | Older versions of Sphinx don't try to parse the argumnet | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | to c:function, but Sphinx 3.0 does do this and will complain: | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20230206223502.25122-2-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | include/hw/intc/armv7m_nvic.h | 5 +---- | ||
13 | 1 file changed, 1 insertion(+), 4 deletions(-) | ||
12 | 14 | ||
13 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters | 15 | diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h |
14 | Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208] | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) | 17 | --- a/include/hw/intc/armv7m_nvic.h |
16 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ | 18 | +++ b/include/hw/intc/armv7m_nvic.h |
17 | 19 | @@ -XXX,XX +XXX,XX @@ | |
18 | Add the missing close-paren. | 20 | #include "qom/object.h" |
19 | 21 | ||
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | #define TYPE_NVIC "armv7m_nvic" |
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 23 | - |
22 | Message-id: 20200411182934.28678-3-peter.maydell@linaro.org | 24 | -typedef struct NVICState NVICState; |
23 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 25 | -DECLARE_INSTANCE_CHECKER(NVICState, NVIC, |
24 | --- | 26 | - TYPE_NVIC) |
25 | scripts/kernel-doc | 2 +- | 27 | +OBJECT_DECLARE_SIMPLE_TYPE(NVICState, NVIC) |
26 | 1 file changed, 1 insertion(+), 1 deletion(-) | 28 | |
27 | 29 | /* Highest permitted number of exceptions (architectural limit) */ | |
28 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc | 30 | #define NVIC_MAX_VECTORS 512 |
29 | index XXXXXXX..XXXXXXX 100755 | ||
30 | --- a/scripts/kernel-doc | ||
31 | +++ b/scripts/kernel-doc | ||
32 | @@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) { | ||
33 | |||
34 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { | ||
35 | # pointer-to-function | ||
36 | - print $1 . $parameter . ") (" . $2; | ||
37 | + print $1 . $parameter . ") (" . $2 . ")"; | ||
38 | } else { | ||
39 | print $type . " " . $parameter; | ||
40 | } | ||
41 | -- | 31 | -- |
42 | 2.20.1 | 32 | 2.34.1 |
43 | 33 | ||
44 | 34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | Suggested-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20230206223502.25122-3-philmd@linaro.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | target/arm/m_helper.c | 11 ++++++++--- | ||
10 | 1 file changed, 8 insertions(+), 3 deletions(-) | ||
11 | |||
12 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/arm/m_helper.c | ||
15 | +++ b/target/arm/m_helper.c | ||
16 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) | ||
17 | return 0; | ||
18 | } | ||
19 | |||
20 | -#else | ||
21 | +ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) | ||
22 | +{ | ||
23 | + return ARMMMUIdx_MUser; | ||
24 | +} | ||
25 | + | ||
26 | +#else /* !CONFIG_USER_ONLY */ | ||
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 */ | ||
45 | -- | ||
46 | 2.34.1 | ||
47 | |||
48 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
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. | ||
6 | |||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20230206223502.25122-4-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/internals.h | 14 -------- | ||
13 | target/arm/m_helper.c | 74 +++++++++++++++++++++--------------------- | ||
14 | 2 files changed, 37 insertions(+), 51 deletions(-) | ||
15 | |||
16 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/internals.h | ||
19 | +++ b/target/arm/internals.h | ||
20 | @@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx) | ||
21 | |||
22 | int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx); | ||
23 | |||
24 | -/* | ||
25 | - * Return the MMU index for a v7M CPU with all relevant information | ||
26 | - * manually specified. | ||
27 | - */ | ||
28 | -ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, | ||
29 | - bool secstate, bool priv, bool negpri); | ||
30 | - | ||
31 | -/* | ||
32 | - * Return the MMU index for a v7M CPU in the specified security and | ||
33 | - * privilege state. | ||
34 | - */ | ||
35 | -ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | ||
36 | - bool secstate, bool priv); | ||
37 | - | ||
38 | /* Return the MMU index for a v7M CPU in the specified security state */ | ||
39 | ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate); | ||
40 | |||
41 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/target/arm/m_helper.c | ||
44 | +++ b/target/arm/m_helper.c | ||
45 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) | ||
46 | |||
47 | #else /* !CONFIG_USER_ONLY */ | ||
48 | |||
49 | +static ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, | ||
50 | + bool secstate, bool priv, bool negpri) | ||
51 | +{ | ||
52 | + ARMMMUIdx mmu_idx = ARM_MMU_IDX_M; | ||
53 | + | ||
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; | ||
91 | } | ||
92 | |||
93 | -ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, | ||
94 | - bool secstate, bool priv, bool negpri) | ||
95 | -{ | ||
96 | - ARMMMUIdx mmu_idx = ARM_MMU_IDX_M; | ||
97 | - | ||
98 | - if (priv) { | ||
99 | - mmu_idx |= ARM_MMU_IDX_M_PRIV; | ||
100 | - } | ||
101 | - | ||
102 | - if (negpri) { | ||
103 | - mmu_idx |= ARM_MMU_IDX_M_NEGPRI; | ||
104 | - } | ||
105 | - | ||
106 | - if (secstate) { | ||
107 | - mmu_idx |= ARM_MMU_IDX_M_S; | ||
108 | - } | ||
109 | - | ||
110 | - return mmu_idx; | ||
111 | -} | ||
112 | - | ||
113 | -ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, | ||
114 | - bool secstate, bool priv) | ||
115 | -{ | ||
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 */ | ||
131 | -- | ||
132 | 2.34.1 | ||
133 | |||
134 | diff view generated by jsdifflib |
1 | If we are not making warnings fatal for compilation, make them | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | non-fatal when building the Sphinx documentation also. (For instance | ||
3 | Sphinx 3.0 warns about some constructs that older versions were happy | ||
4 | with, which is a build failure if we use the warnings-as-errors | ||
5 | flag.) | ||
6 | 2 | ||
7 | This provides a workaround at least for LP:1872113. | 3 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Message-id: 20230206223502.25122-5-philmd@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/helper.c | 12 ++++++++++-- | ||
9 | 1 file changed, 10 insertions(+), 2 deletions(-) | ||
8 | 10 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | index XXXXXXX..XXXXXXX 100644 |
11 | Message-id: 20200411182934.28678-2-peter.maydell@linaro.org | 13 | --- a/target/arm/helper.c |
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 14 | +++ b/target/arm/helper.c |
13 | --- | 15 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) |
14 | configure | 9 ++++++++- | 16 | } |
15 | Makefile | 2 +- | ||
16 | 2 files changed, 9 insertions(+), 2 deletions(-) | ||
17 | |||
18 | diff --git a/configure b/configure | ||
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/configure | ||
21 | +++ b/configure | ||
22 | @@ -XXX,XX +XXX,XX @@ if check_include sys/kcov.h ; then | ||
23 | kcov=yes | ||
24 | fi | ||
25 | |||
26 | +# If we're making warnings fatal, apply this to Sphinx runs as well | ||
27 | +sphinx_werror="" | ||
28 | +if test "$werror" = "yes"; then | ||
29 | + sphinx_werror="-W" | ||
30 | +fi | ||
31 | + | ||
32 | # Check we have a new enough version of sphinx-build | ||
33 | has_sphinx_build() { | ||
34 | # This is a bit awkward but works: create a trivial document and | ||
35 | @@ -XXX,XX +XXX,XX @@ has_sphinx_build() { | ||
36 | # sphinx-build doesn't exist at all or if it is too old. | ||
37 | mkdir -p "$TMPDIR1/sphinx" | ||
38 | touch "$TMPDIR1/sphinx/index.rst" | ||
39 | - "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 | ||
40 | + "$sphinx_build" $sphinx_werror -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 | ||
41 | } | 17 | } |
42 | 18 | ||
43 | # Check if tools are available to build documentation. | 19 | +#ifndef CONFIG_USER_ONLY |
44 | @@ -XXX,XX +XXX,XX @@ echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak | 20 | /* |
45 | echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak | 21 | * We don't know until after realize whether there's a GICv3 |
46 | echo "PYTHON=$python" >> $config_host_mak | 22 | * attached, and that is what registers the gicv3 sysregs. |
47 | echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak | 23 | @@ -XXX,XX +XXX,XX @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri) |
48 | +echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak | 24 | return pfr1; |
49 | echo "GENISOIMAGE=$genisoimage" >> $config_host_mak | 25 | } |
50 | echo "CC=$cc" >> $config_host_mak | 26 | |
51 | if $iasl -h > /dev/null 2>&1; then | 27 | -#ifndef CONFIG_USER_ONLY |
52 | diff --git a/Makefile b/Makefile | 28 | static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) |
53 | index XXXXXXX..XXXXXXX 100644 | 29 | { |
54 | --- a/Makefile | 30 | ARMCPU *cpu = env_archcpu(env); |
55 | +++ b/Makefile | 31 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
56 | @@ -XXX,XX +XXX,XX @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ | 32 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1, |
57 | # Note the use of different doctree for each (manual, builder) tuple; | 33 | .access = PL1_R, .type = ARM_CP_NO_RAW, |
58 | # this works around Sphinx not handling parallel invocation on | 34 | .accessfn = access_aa32_tid3, |
59 | # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 | 35 | +#ifdef CONFIG_USER_ONLY |
60 | -build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") | 36 | + .type = ARM_CP_CONST, |
61 | +build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") | 37 | + .resetvalue = cpu->isar.id_pfr1, |
62 | # We assume all RST files in the manual's directory are used in it | 38 | +#else |
63 | manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ | 39 | + .type = ARM_CP_NO_RAW, |
64 | $(SRC_PATH)/docs/defs.rst.inc \ | 40 | + .accessfn = access_aa32_tid3, |
41 | .readfn = id_pfr1_read, | ||
42 | - .writefn = arm_cp_write_ignore }, | ||
43 | + .writefn = arm_cp_write_ignore | ||
44 | +#endif | ||
45 | + }, | ||
46 | { .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH, | ||
47 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, | ||
48 | .access = PL1_R, .type = ARM_CP_CONST, | ||
65 | -- | 49 | -- |
66 | 2.20.1 | 50 | 2.34.1 |
67 | 51 | ||
68 | 52 | diff view generated by jsdifflib |
1 | The Linux kernel has dropped support for allowing 32-bit Arm systems | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | to host KVM guests (kernel commit 541ad0150ca4aa663a2, which just | ||
3 | landed upstream in the 5.7 merge window). Mark QEMU's support for | ||
4 | this configuration as deprecated, so that we can delete that support | ||
5 | code in 5.2. | ||
6 | 2 | ||
3 | Suggested-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20230206223502.25122-6-philmd@linaro.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
9 | --- | 8 | --- |
10 | docs/system/deprecated.rst | 8 ++++++++ | 9 | linux-user/user-internals.h | 2 +- |
11 | 1 file changed, 8 insertions(+) | 10 | target/arm/cpu.h | 2 +- |
11 | linux-user/arm/cpu_loop.c | 4 ++-- | ||
12 | 3 files changed, 4 insertions(+), 4 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst | 14 | diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/docs/system/deprecated.rst | 16 | --- a/linux-user/user-internals.h |
16 | +++ b/docs/system/deprecated.rst | 17 | +++ b/linux-user/user-internals.h |
17 | @@ -XXX,XX +XXX,XX @@ The ``compat`` property used to set backwards compatibility modes for | 18 | @@ -XXX,XX +XXX,XX @@ void print_termios(void *arg); |
18 | the processor has been deprecated. The ``max-cpu-compat`` property of | 19 | #ifdef TARGET_ARM |
19 | the ``pseries`` machine type should be used instead. | 20 | static inline int regpairs_aligned(CPUArchState *cpu_env, int num) |
20 | 21 | { | |
21 | +KVM guest support on 32-bit Arm hosts (since 5.0) | 22 | - return cpu_env->eabi == 1; |
22 | +''''''''''''''''''''''''''''''''''''''''''''''''' | 23 | + return cpu_env->eabi; |
23 | + | 24 | } |
24 | +The Linux kernel has dropped support for allowing 32-bit Arm systems | 25 | #elif defined(TARGET_MIPS) && defined(TARGET_ABI_MIPSO32) |
25 | +to host KVM guests as of the 5.7 kernel. Accordingly, QEMU is deprecating | 26 | static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; } |
26 | +its support for this configuration and will remove it in a future version. | 27 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
27 | +Running 32-bit guests on a 64-bit Arm host remains supported. | 28 | index XXXXXXX..XXXXXXX 100644 |
28 | + | 29 | --- a/target/arm/cpu.h |
29 | System emulator devices | 30 | +++ b/target/arm/cpu.h |
30 | ----------------------- | 31 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
32 | |||
33 | #if defined(CONFIG_USER_ONLY) | ||
34 | /* For usermode syscall translation. */ | ||
35 | - int eabi; | ||
36 | + bool eabi; | ||
37 | #endif | ||
38 | |||
39 | struct CPUBreakpoint *cpu_breakpoint[16]; | ||
40 | diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/linux-user/arm/cpu_loop.c | ||
43 | +++ b/linux-user/arm/cpu_loop.c | ||
44 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) | ||
45 | break; | ||
46 | case EXCP_SWI: | ||
47 | { | ||
48 | - env->eabi = 1; | ||
49 | + env->eabi = true; | ||
50 | /* system call */ | ||
51 | if (env->thumb) { | ||
52 | /* Thumb is always EABI style with syscall number in r7 */ | ||
53 | @@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env) | ||
54 | * > 0xfffff and are handled below as out-of-range. | ||
55 | */ | ||
56 | n ^= ARM_SYSCALL_BASE; | ||
57 | - env->eabi = 0; | ||
58 | + env->eabi = false; | ||
59 | } | ||
60 | } | ||
31 | 61 | ||
32 | -- | 62 | -- |
33 | 2.20.1 | 63 | 2.34.1 |
34 | 64 | ||
35 | 65 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | Although the 'eabi' field is only used in user emulation where | ||
4 | CPU reset doesn't occur, it doesn't belong to the area to reset. | ||
5 | Move it after the 'end_reset_fields' for consistency. | ||
6 | |||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Message-id: 20230206223502.25122-7-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/cpu.h | 9 ++++----- | ||
13 | 1 file changed, 4 insertions(+), 5 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/cpu.h | ||
18 | +++ b/target/arm/cpu.h | ||
19 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { | ||
20 | ARMVectorReg zarray[ARM_MAX_VQ * 16]; | ||
21 | #endif | ||
22 | |||
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 */ | ||
42 | -- | ||
43 | 2.34.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Message-id: 20230206223502.25122-8-philmd@linaro.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | target/arm/cpu.h | 3 ++- | ||
9 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/arm/cpu.h | ||
14 | +++ b/target/arm/cpu.h | ||
15 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { | ||
16 | |||
17 | void *nvic; | ||
18 | const struct arm_boot_info *boot_info; | ||
19 | +#if !defined(CONFIG_USER_ONLY) | ||
20 | /* Store GICv3CPUState to access from this struct */ | ||
21 | void *gicv3state; | ||
22 | -#if defined(CONFIG_USER_ONLY) | ||
23 | +#else /* CONFIG_USER_ONLY */ | ||
24 | /* For usermode syscall translation. */ | ||
25 | bool eabi; | ||
26 | #endif /* CONFIG_USER_ONLY */ | ||
27 | -- | ||
28 | 2.34.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
1 | The target_flat.h file is a QEMU header, so we should include it using | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | quotes, not angle brackets. | ||
3 | 2 | ||
4 | Coverity otherwise is unable to find the header: | 3 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
6 | "../linux-user/flatload.c", line 40: error #1712: cannot open source file | 5 | Message-id: 20230206223502.25122-9-philmd@linaro.org |
7 | "target_flat.h" | ||
8 | #include <target_flat.h> | ||
9 | ^ | ||
10 | |||
11 | because the relevant directory is only on the -iquote path, not the -I path. | ||
12 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200319193323.2038-5-peter.maydell@linaro.org | ||
17 | --- | 7 | --- |
18 | linux-user/flatload.c | 2 +- | 8 | target/arm/cpu.h | 2 +- |
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
20 | 10 | ||
21 | diff --git a/linux-user/flatload.c b/linux-user/flatload.c | 11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
22 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/linux-user/flatload.c | 13 | --- a/target/arm/cpu.h |
24 | +++ b/linux-user/flatload.c | 14 | +++ b/target/arm/cpu.h |
25 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
26 | 16 | } sau; | |
27 | #include "qemu.h" | 17 | |
28 | #include "flat.h" | 18 | void *nvic; |
29 | -#include <target_flat.h> | 19 | - const struct arm_boot_info *boot_info; |
30 | +#include "target_flat.h" | 20 | #if !defined(CONFIG_USER_ONLY) |
31 | 21 | + const struct arm_boot_info *boot_info; | |
32 | //#define DEBUG | 22 | /* Store GICv3CPUState to access from this struct */ |
33 | 23 | void *gicv3state; | |
24 | #else /* CONFIG_USER_ONLY */ | ||
34 | -- | 25 | -- |
35 | 2.20.1 | 26 | 2.34.1 |
36 | 27 | ||
37 | 28 | diff view generated by jsdifflib |
1 | For Coverity's benefit, we provide simpler versions of functions like | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When | ||
3 | we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and | ||
4 | paste error meant that the Coverity version of qemu_cond_timedwait() | ||
5 | was using the wrong _impl function, which makes the Coverity parser | ||
6 | complain: | ||
7 | 2 | ||
8 | "/qemu/include/qemu/thread.h", line 159: warning #140: too many arguments in | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | function call | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | return qemu_cond_timedwait(cond, mutex, ms); | 5 | Message-id: 20230206223502.25122-10-philmd@linaro.org |
11 | ^ | ||
12 | |||
13 | "/qemu/include/qemu/thread.h", line 159: warning #120: return value type does | ||
14 | not match the function type | ||
15 | return qemu_cond_timedwait(cond, mutex, ms); | ||
16 | ^ | ||
17 | |||
18 | "/qemu/include/qemu/thread.h", line 156: warning #1563: function | ||
19 | "qemu_cond_timedwait" not emitted, consider modeling it or review | ||
20 | parse diagnostics to improve fidelity | ||
21 | static inline bool (qemu_cond_timedwait)(QemuCond *cond, QemuMutex *mutex, | ||
22 | ^ | ||
23 | |||
24 | These aren't fatal, but reduce the scope of the analysis. Fix the error. | ||
25 | |||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
29 | Message-id: 20200319193323.2038-3-peter.maydell@linaro.org | ||
30 | --- | 7 | --- |
31 | include/qemu/thread.h | 2 +- | 8 | target/arm/cpu.h | 2 +- |
32 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
33 | 10 | ||
34 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h | 11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
35 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/include/qemu/thread.h | 13 | --- a/target/arm/cpu.h |
37 | +++ b/include/qemu/thread.h | 14 | +++ b/target/arm/cpu.h |
38 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
39 | #define qemu_cond_wait(c, m) \ | 16 | uint32_t ctrl; |
40 | qemu_cond_wait_impl(c, m, __FILE__, __LINE__); | 17 | } sau; |
41 | #define qemu_cond_timedwait(c, m, ms) \ | 18 | |
42 | - qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__); | 19 | - void *nvic; |
43 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); | 20 | #if !defined(CONFIG_USER_ONLY) |
44 | #else | 21 | + void *nvic; |
45 | #define qemu_mutex_lock(m) ({ \ | 22 | const struct arm_boot_info *boot_info; |
46 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ | 23 | /* Store GICv3CPUState to access from this struct */ |
24 | void *gicv3state; | ||
47 | -- | 25 | -- |
48 | 2.20.1 | 26 | 2.34.1 |
49 | 27 | ||
50 | 28 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | |
2 | |||
3 | There is no point in using a void pointer to access the NVIC. | ||
4 | Use the real type to avoid casting it while debugging. | ||
5 | |||
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20230206223502.25122-11-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/cpu.h | 46 ++++++++++++++++++++++--------------------- | ||
12 | hw/intc/armv7m_nvic.c | 38 ++++++++++++----------------------- | ||
13 | target/arm/cpu.c | 1 + | ||
14 | target/arm/m_helper.c | 2 +- | ||
15 | 4 files changed, 39 insertions(+), 48 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/cpu.h | ||
20 | +++ b/target/arm/cpu.h | ||
21 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUARMTBFlags { | ||
22 | |||
23 | typedef struct ARMMMUFaultInfo ARMMMUFaultInfo; | ||
24 | |||
25 | +typedef struct NVICState NVICState; | ||
26 | + | ||
27 | typedef struct CPUArchState { | ||
28 | /* Regs for current mode. */ | ||
29 | uint32_t regs[16]; | ||
30 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { | ||
31 | } sau; | ||
32 | |||
33 | #if !defined(CONFIG_USER_ONLY) | ||
34 | - void *nvic; | ||
35 | + NVICState *nvic; | ||
36 | const struct arm_boot_info *boot_info; | ||
37 | /* Store GICv3CPUState to access from this struct */ | ||
38 | void *gicv3state; | ||
39 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | ||
40 | |||
41 | /* Interface between CPU and Interrupt controller. */ | ||
42 | #ifndef CONFIG_USER_ONLY | ||
43 | -bool armv7m_nvic_can_take_pending_exception(void *opaque); | ||
44 | +bool armv7m_nvic_can_take_pending_exception(NVICState *s); | ||
45 | #else | ||
46 | -static inline bool armv7m_nvic_can_take_pending_exception(void *opaque) | ||
47 | +static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s) | ||
48 | { | ||
49 | return true; | ||
50 | } | ||
51 | #endif | ||
52 | /** | ||
53 | * armv7m_nvic_set_pending: mark the specified exception as pending | ||
54 | - * @opaque: the NVIC | ||
55 | + * @s: the NVIC | ||
56 | * @irq: the exception number to mark pending | ||
57 | * @secure: false for non-banked exceptions or for the nonsecure | ||
58 | * version of a banked exception, true for the secure version of a banked | ||
59 | @@ -XXX,XX +XXX,XX @@ static inline bool armv7m_nvic_can_take_pending_exception(void *opaque) | ||
60 | * if @secure is true and @irq does not specify one of the fixed set | ||
61 | * of architecturally banked exceptions. | ||
62 | */ | ||
63 | -void armv7m_nvic_set_pending(void *opaque, int irq, bool secure); | ||
64 | +void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure); | ||
65 | /** | ||
66 | * armv7m_nvic_set_pending_derived: mark this derived exception as pending | ||
67 | - * @opaque: the NVIC | ||
68 | + * @s: the NVIC | ||
69 | * @irq: the exception number to mark pending | ||
70 | * @secure: false for non-banked exceptions or for the nonsecure | ||
71 | * version of a banked exception, true for the secure version of a banked | ||
72 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure); | ||
73 | * exceptions (exceptions generated in the course of trying to take | ||
74 | * a different exception). | ||
75 | */ | ||
76 | -void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure); | ||
77 | +void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure); | ||
78 | /** | ||
79 | * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending | ||
80 | - * @opaque: the NVIC | ||
81 | + * @s: the NVIC | ||
82 | * @irq: the exception number to mark pending | ||
83 | * @secure: false for non-banked exceptions or for the nonsecure | ||
84 | * version of a banked exception, true for the secure version of a banked | ||
85 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure); | ||
86 | * Similar to armv7m_nvic_set_pending(), but specifically for exceptions | ||
87 | * generated in the course of lazy stacking of FP registers. | ||
88 | */ | ||
89 | -void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure); | ||
90 | +void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure); | ||
91 | /** | ||
92 | * armv7m_nvic_get_pending_irq_info: return highest priority pending | ||
93 | * exception, and whether it targets Secure state | ||
94 | - * @opaque: the NVIC | ||
95 | + * @s: the NVIC | ||
96 | * @pirq: set to pending exception number | ||
97 | * @ptargets_secure: set to whether pending exception targets Secure | ||
98 | * | ||
99 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure); | ||
100 | * to true if the current highest priority pending exception should | ||
101 | * be taken to Secure state, false for NS. | ||
102 | */ | ||
103 | -void armv7m_nvic_get_pending_irq_info(void *opaque, int *pirq, | ||
104 | +void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq, | ||
105 | bool *ptargets_secure); | ||
106 | /** | ||
107 | * armv7m_nvic_acknowledge_irq: make highest priority pending exception active | ||
108 | - * @opaque: the NVIC | ||
109 | + * @s: the NVIC | ||
110 | * | ||
111 | * Move the current highest priority pending exception from the pending | ||
112 | * state to the active state, and update v7m.exception to indicate that | ||
113 | * it is the exception currently being handled. | ||
114 | */ | ||
115 | -void armv7m_nvic_acknowledge_irq(void *opaque); | ||
116 | +void armv7m_nvic_acknowledge_irq(NVICState *s); | ||
117 | /** | ||
118 | * armv7m_nvic_complete_irq: complete specified interrupt or exception | ||
119 | - * @opaque: the NVIC | ||
120 | + * @s: the NVIC | ||
121 | * @irq: the exception number to complete | ||
122 | * @secure: true if this exception was secure | ||
123 | * | ||
124 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_acknowledge_irq(void *opaque); | ||
125 | * 0 if there is still an irq active after this one was completed | ||
126 | * (Ignoring -1, this is the same as the RETTOBASE value before completion.) | ||
127 | */ | ||
128 | -int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure); | ||
129 | +int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure); | ||
130 | /** | ||
131 | * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | ||
132 | - * @opaque: the NVIC | ||
133 | + * @s: the NVIC | ||
134 | * @irq: the exception number to mark pending | ||
135 | * @secure: false for non-banked exceptions or for the nonsecure | ||
136 | * version of a banked exception, true for the secure version of a banked | ||
137 | @@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure); | ||
138 | * interrupt the current execution priority. This controls whether the | ||
139 | * RDY bit for it in the FPCCR is set. | ||
140 | */ | ||
141 | -bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure); | ||
142 | +bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure); | ||
143 | /** | ||
144 | * armv7m_nvic_raw_execution_priority: return the raw execution priority | ||
145 | - * @opaque: the NVIC | ||
146 | + * @s: the NVIC | ||
147 | * | ||
148 | * Returns: the raw execution priority as defined by the v8M architecture. | ||
149 | * This is the execution priority minus the effects of AIRCR.PRIS, | ||
150 | * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting. | ||
151 | * (v8M ARM ARM I_PKLD.) | ||
152 | */ | ||
153 | -int armv7m_nvic_raw_execution_priority(void *opaque); | ||
154 | +int armv7m_nvic_raw_execution_priority(NVICState *s); | ||
155 | /** | ||
156 | * armv7m_nvic_neg_prio_requested: return true if the requested execution | ||
157 | * priority is negative for the specified security state. | ||
158 | - * @opaque: the NVIC | ||
159 | + * @s: the NVIC | ||
160 | * @secure: the security state to test | ||
161 | * This corresponds to the pseudocode IsReqExecPriNeg(). | ||
162 | */ | ||
163 | #ifndef CONFIG_USER_ONLY | ||
164 | -bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure); | ||
165 | +bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure); | ||
166 | #else | ||
167 | -static inline bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure) | ||
168 | +static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure) | ||
169 | { | ||
170 | return false; | ||
171 | } | ||
172 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | ||
173 | index XXXXXXX..XXXXXXX 100644 | ||
174 | --- a/hw/intc/armv7m_nvic.c | ||
175 | +++ b/hw/intc/armv7m_nvic.c | ||
176 | @@ -XXX,XX +XXX,XX @@ static inline int nvic_exec_prio(NVICState *s) | ||
177 | return MIN(running, s->exception_prio); | ||
178 | } | ||
179 | |||
180 | -bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure) | ||
181 | +bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure) | ||
182 | { | ||
183 | /* Return true if the requested execution priority is negative | ||
184 | * for the specified security state, ie that security state | ||
185 | @@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure) | ||
186 | * mean we don't allow FAULTMASK_NS to actually make the execution | ||
187 | * priority negative). Compare pseudocode IsReqExcPriNeg(). | ||
188 | */ | ||
189 | - NVICState *s = opaque; | ||
190 | - | ||
191 | if (s->cpu->env.v7m.faultmask[secure]) { | ||
192 | return true; | ||
193 | } | ||
194 | @@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_neg_prio_requested(void *opaque, bool secure) | ||
195 | return false; | ||
196 | } | ||
197 | |||
198 | -bool armv7m_nvic_can_take_pending_exception(void *opaque) | ||
199 | +bool armv7m_nvic_can_take_pending_exception(NVICState *s) | ||
200 | { | ||
201 | - NVICState *s = opaque; | ||
202 | - | ||
203 | return nvic_exec_prio(s) > nvic_pending_prio(s); | ||
204 | } | ||
205 | |||
206 | -int armv7m_nvic_raw_execution_priority(void *opaque) | ||
207 | +int armv7m_nvic_raw_execution_priority(NVICState *s) | ||
208 | { | ||
209 | - NVICState *s = opaque; | ||
210 | - | ||
211 | return s->exception_prio; | ||
212 | } | ||
213 | |||
214 | @@ -XXX,XX +XXX,XX @@ static void nvic_irq_update(NVICState *s) | ||
215 | * if @secure is true and @irq does not specify one of the fixed set | ||
216 | * of architecturally banked exceptions. | ||
217 | */ | ||
218 | -static void armv7m_nvic_clear_pending(void *opaque, int irq, bool secure) | ||
219 | +static void armv7m_nvic_clear_pending(NVICState *s, int irq, bool secure) | ||
220 | { | ||
221 | - NVICState *s = (NVICState *)opaque; | ||
222 | VecInfo *vec; | ||
223 | |||
224 | assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq); | ||
225 | @@ -XXX,XX +XXX,XX @@ static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure, | ||
226 | } | ||
227 | } | ||
228 | |||
229 | -void armv7m_nvic_set_pending(void *opaque, int irq, bool secure) | ||
230 | +void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure) | ||
231 | { | ||
232 | - do_armv7m_nvic_set_pending(opaque, irq, secure, false); | ||
233 | + do_armv7m_nvic_set_pending(s, irq, secure, false); | ||
234 | } | ||
235 | |||
236 | -void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure) | ||
237 | +void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure) | ||
238 | { | ||
239 | - do_armv7m_nvic_set_pending(opaque, irq, secure, true); | ||
240 | + do_armv7m_nvic_set_pending(s, irq, secure, true); | ||
241 | } | ||
242 | |||
243 | -void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure) | ||
244 | +void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure) | ||
245 | { | ||
246 | /* | ||
247 | * Pend an exception during lazy FP stacking. This differs | ||
248 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure) | ||
249 | * whether we should escalate depends on the saved context | ||
250 | * in the FPCCR register, not on the current state of the CPU/NVIC. | ||
251 | */ | ||
252 | - NVICState *s = (NVICState *)opaque; | ||
253 | bool banked = exc_is_banked(irq); | ||
254 | VecInfo *vec; | ||
255 | bool targets_secure; | ||
256 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_set_pending_lazyfp(void *opaque, int irq, bool secure) | ||
257 | } | ||
258 | |||
259 | /* Make pending IRQ active. */ | ||
260 | -void armv7m_nvic_acknowledge_irq(void *opaque) | ||
261 | +void armv7m_nvic_acknowledge_irq(NVICState *s) | ||
262 | { | ||
263 | - NVICState *s = (NVICState *)opaque; | ||
264 | CPUARMState *env = &s->cpu->env; | ||
265 | const int pending = s->vectpending; | ||
266 | const int running = nvic_exec_prio(s); | ||
267 | @@ -XXX,XX +XXX,XX @@ static bool vectpending_targets_secure(NVICState *s) | ||
268 | exc_targets_secure(s, s->vectpending); | ||
269 | } | ||
270 | |||
271 | -void armv7m_nvic_get_pending_irq_info(void *opaque, | ||
272 | +void armv7m_nvic_get_pending_irq_info(NVICState *s, | ||
273 | int *pirq, bool *ptargets_secure) | ||
274 | { | ||
275 | - NVICState *s = (NVICState *)opaque; | ||
276 | const int pending = s->vectpending; | ||
277 | bool targets_secure; | ||
278 | |||
279 | @@ -XXX,XX +XXX,XX @@ void armv7m_nvic_get_pending_irq_info(void *opaque, | ||
280 | *pirq = pending; | ||
281 | } | ||
282 | |||
283 | -int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure) | ||
284 | +int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure) | ||
285 | { | ||
286 | - NVICState *s = (NVICState *)opaque; | ||
287 | VecInfo *vec = NULL; | ||
288 | int ret = 0; | ||
289 | |||
290 | @@ -XXX,XX +XXX,XX @@ int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure) | ||
291 | return ret; | ||
292 | } | ||
293 | |||
294 | -bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | ||
295 | +bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure) | ||
296 | { | ||
297 | /* | ||
298 | * Return whether an exception is "ready", i.e. it is enabled and is | ||
299 | @@ -XXX,XX +XXX,XX @@ bool armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | ||
300 | * for non-banked exceptions secure is always false; for banked exceptions | ||
301 | * it indicates which of the exceptions is required. | ||
302 | */ | ||
303 | - NVICState *s = (NVICState *)opaque; | ||
304 | bool banked = exc_is_banked(irq); | ||
305 | VecInfo *vec; | ||
306 | int running = nvic_exec_prio(s); | ||
307 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
308 | index XXXXXXX..XXXXXXX 100644 | ||
309 | --- a/target/arm/cpu.c | ||
310 | +++ b/target/arm/cpu.c | ||
311 | @@ -XXX,XX +XXX,XX @@ | ||
312 | #if !defined(CONFIG_USER_ONLY) | ||
313 | #include "hw/loader.h" | ||
314 | #include "hw/boards.h" | ||
315 | +#include "hw/intc/armv7m_nvic.h" | ||
316 | #endif | ||
317 | #include "sysemu/tcg.h" | ||
318 | #include "sysemu/qtest.h" | ||
319 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
320 | index XXXXXXX..XXXXXXX 100644 | ||
321 | --- a/target/arm/m_helper.c | ||
322 | +++ b/target/arm/m_helper.c | ||
323 | @@ -XXX,XX +XXX,XX @@ static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr, | ||
324 | * that we will need later in order to do lazy FP reg stacking. | ||
325 | */ | ||
326 | bool is_secure = env->v7m.secure; | ||
327 | - void *nvic = env->nvic; | ||
328 | + NVICState *nvic = env->nvic; | ||
329 | /* | ||
330 | * Some bits are unbanked and live always in fpccr[M_REG_S]; some bits | ||
331 | * are banked and we want to update the bit in the bank for the | ||
332 | -- | ||
333 | 2.34.1 | ||
334 | |||
335 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | |
2 | |||
3 | While dozens of files include "cpu.h", only 3 files require | ||
4 | these NVIC helper declarations. | ||
5 | |||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Message-id: 20230206223502.25122-12-philmd@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/intc/armv7m_nvic.h | 123 ++++++++++++++++++++++++++++++++++ | ||
12 | target/arm/cpu.h | 123 ---------------------------------- | ||
13 | target/arm/cpu.c | 4 +- | ||
14 | target/arm/cpu_tcg.c | 3 + | ||
15 | target/arm/m_helper.c | 3 + | ||
16 | 5 files changed, 132 insertions(+), 124 deletions(-) | ||
17 | |||
18 | diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/include/hw/intc/armv7m_nvic.h | ||
21 | +++ b/include/hw/intc/armv7m_nvic.h | ||
22 | @@ -XXX,XX +XXX,XX @@ struct NVICState { | ||
23 | qemu_irq sysresetreq; | ||
24 | }; | ||
25 | |||
26 | +/* Interface between CPU and Interrupt controller. */ | ||
27 | +/** | ||
28 | + * armv7m_nvic_set_pending: mark the specified exception as pending | ||
29 | + * @s: the NVIC | ||
30 | + * @irq: the exception number to mark pending | ||
31 | + * @secure: false for non-banked exceptions or for the nonsecure | ||
32 | + * version of a banked exception, true for the secure version of a banked | ||
33 | + * exception. | ||
34 | + * | ||
35 | + * Marks the specified exception as pending. Note that we will assert() | ||
36 | + * if @secure is true and @irq does not specify one of the fixed set | ||
37 | + * of architecturally banked exceptions. | ||
38 | + */ | ||
39 | +void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure); | ||
40 | +/** | ||
41 | + * armv7m_nvic_set_pending_derived: mark this derived exception as pending | ||
42 | + * @s: the NVIC | ||
43 | + * @irq: the exception number to mark pending | ||
44 | + * @secure: false for non-banked exceptions or for the nonsecure | ||
45 | + * version of a banked exception, true for the secure version of a banked | ||
46 | + * exception. | ||
47 | + * | ||
48 | + * Similar to armv7m_nvic_set_pending(), but specifically for derived | ||
49 | + * exceptions (exceptions generated in the course of trying to take | ||
50 | + * a different exception). | ||
51 | + */ | ||
52 | +void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure); | ||
53 | +/** | ||
54 | + * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending | ||
55 | + * @s: the NVIC | ||
56 | + * @irq: the exception number to mark pending | ||
57 | + * @secure: false for non-banked exceptions or for the nonsecure | ||
58 | + * version of a banked exception, true for the secure version of a banked | ||
59 | + * exception. | ||
60 | + * | ||
61 | + * Similar to armv7m_nvic_set_pending(), but specifically for exceptions | ||
62 | + * generated in the course of lazy stacking of FP registers. | ||
63 | + */ | ||
64 | +void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure); | ||
65 | +/** | ||
66 | + * armv7m_nvic_get_pending_irq_info: return highest priority pending | ||
67 | + * exception, and whether it targets Secure state | ||
68 | + * @s: the NVIC | ||
69 | + * @pirq: set to pending exception number | ||
70 | + * @ptargets_secure: set to whether pending exception targets Secure | ||
71 | + * | ||
72 | + * This function writes the number of the highest priority pending | ||
73 | + * exception (the one which would be made active by | ||
74 | + * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure | ||
75 | + * to true if the current highest priority pending exception should | ||
76 | + * be taken to Secure state, false for NS. | ||
77 | + */ | ||
78 | +void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq, | ||
79 | + bool *ptargets_secure); | ||
80 | +/** | ||
81 | + * armv7m_nvic_acknowledge_irq: make highest priority pending exception active | ||
82 | + * @s: the NVIC | ||
83 | + * | ||
84 | + * Move the current highest priority pending exception from the pending | ||
85 | + * state to the active state, and update v7m.exception to indicate that | ||
86 | + * it is the exception currently being handled. | ||
87 | + */ | ||
88 | +void armv7m_nvic_acknowledge_irq(NVICState *s); | ||
89 | +/** | ||
90 | + * armv7m_nvic_complete_irq: complete specified interrupt or exception | ||
91 | + * @s: the NVIC | ||
92 | + * @irq: the exception number to complete | ||
93 | + * @secure: true if this exception was secure | ||
94 | + * | ||
95 | + * Returns: -1 if the irq was not active | ||
96 | + * 1 if completing this irq brought us back to base (no active irqs) | ||
97 | + * 0 if there is still an irq active after this one was completed | ||
98 | + * (Ignoring -1, this is the same as the RETTOBASE value before completion.) | ||
99 | + */ | ||
100 | +int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure); | ||
101 | +/** | ||
102 | + * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | ||
103 | + * @s: the NVIC | ||
104 | + * @irq: the exception number to mark pending | ||
105 | + * @secure: false for non-banked exceptions or for the nonsecure | ||
106 | + * version of a banked exception, true for the secure version of a banked | ||
107 | + * exception. | ||
108 | + * | ||
109 | + * Return whether an exception is "ready", i.e. whether the exception is | ||
110 | + * enabled and is configured at a priority which would allow it to | ||
111 | + * interrupt the current execution priority. This controls whether the | ||
112 | + * RDY bit for it in the FPCCR is set. | ||
113 | + */ | ||
114 | +bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure); | ||
115 | +/** | ||
116 | + * armv7m_nvic_raw_execution_priority: return the raw execution priority | ||
117 | + * @s: the NVIC | ||
118 | + * | ||
119 | + * Returns: the raw execution priority as defined by the v8M architecture. | ||
120 | + * This is the execution priority minus the effects of AIRCR.PRIS, | ||
121 | + * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting. | ||
122 | + * (v8M ARM ARM I_PKLD.) | ||
123 | + */ | ||
124 | +int armv7m_nvic_raw_execution_priority(NVICState *s); | ||
125 | +/** | ||
126 | + * armv7m_nvic_neg_prio_requested: return true if the requested execution | ||
127 | + * priority is negative for the specified security state. | ||
128 | + * @s: the NVIC | ||
129 | + * @secure: the security state to test | ||
130 | + * This corresponds to the pseudocode IsReqExecPriNeg(). | ||
131 | + */ | ||
132 | +#ifndef CONFIG_USER_ONLY | ||
133 | +bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure); | ||
134 | +#else | ||
135 | +static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure) | ||
136 | +{ | ||
137 | + return false; | ||
138 | +} | ||
139 | +#endif | ||
140 | +#ifndef CONFIG_USER_ONLY | ||
141 | +bool armv7m_nvic_can_take_pending_exception(NVICState *s); | ||
142 | +#else | ||
143 | +static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s) | ||
144 | +{ | ||
145 | + return true; | ||
146 | +} | ||
147 | +#endif | ||
148 | + | ||
149 | #endif | ||
150 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
151 | index XXXXXXX..XXXXXXX 100644 | ||
152 | --- a/target/arm/cpu.h | ||
153 | +++ b/target/arm/cpu.h | ||
154 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void); | ||
155 | uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | ||
156 | uint32_t cur_el, bool secure); | ||
157 | |||
158 | -/* Interface between CPU and Interrupt controller. */ | ||
159 | -#ifndef CONFIG_USER_ONLY | ||
160 | -bool armv7m_nvic_can_take_pending_exception(NVICState *s); | ||
161 | -#else | ||
162 | -static inline bool armv7m_nvic_can_take_pending_exception(NVICState *s) | ||
163 | -{ | ||
164 | - return true; | ||
165 | -} | ||
166 | -#endif | ||
167 | -/** | ||
168 | - * armv7m_nvic_set_pending: mark the specified exception as pending | ||
169 | - * @s: the NVIC | ||
170 | - * @irq: the exception number to mark pending | ||
171 | - * @secure: false for non-banked exceptions or for the nonsecure | ||
172 | - * version of a banked exception, true for the secure version of a banked | ||
173 | - * exception. | ||
174 | - * | ||
175 | - * Marks the specified exception as pending. Note that we will assert() | ||
176 | - * if @secure is true and @irq does not specify one of the fixed set | ||
177 | - * of architecturally banked exceptions. | ||
178 | - */ | ||
179 | -void armv7m_nvic_set_pending(NVICState *s, int irq, bool secure); | ||
180 | -/** | ||
181 | - * armv7m_nvic_set_pending_derived: mark this derived exception as pending | ||
182 | - * @s: the NVIC | ||
183 | - * @irq: the exception number to mark pending | ||
184 | - * @secure: false for non-banked exceptions or for the nonsecure | ||
185 | - * version of a banked exception, true for the secure version of a banked | ||
186 | - * exception. | ||
187 | - * | ||
188 | - * Similar to armv7m_nvic_set_pending(), but specifically for derived | ||
189 | - * exceptions (exceptions generated in the course of trying to take | ||
190 | - * a different exception). | ||
191 | - */ | ||
192 | -void armv7m_nvic_set_pending_derived(NVICState *s, int irq, bool secure); | ||
193 | -/** | ||
194 | - * armv7m_nvic_set_pending_lazyfp: mark this lazy FP exception as pending | ||
195 | - * @s: the NVIC | ||
196 | - * @irq: the exception number to mark pending | ||
197 | - * @secure: false for non-banked exceptions or for the nonsecure | ||
198 | - * version of a banked exception, true for the secure version of a banked | ||
199 | - * exception. | ||
200 | - * | ||
201 | - * Similar to armv7m_nvic_set_pending(), but specifically for exceptions | ||
202 | - * generated in the course of lazy stacking of FP registers. | ||
203 | - */ | ||
204 | -void armv7m_nvic_set_pending_lazyfp(NVICState *s, int irq, bool secure); | ||
205 | -/** | ||
206 | - * armv7m_nvic_get_pending_irq_info: return highest priority pending | ||
207 | - * exception, and whether it targets Secure state | ||
208 | - * @s: the NVIC | ||
209 | - * @pirq: set to pending exception number | ||
210 | - * @ptargets_secure: set to whether pending exception targets Secure | ||
211 | - * | ||
212 | - * This function writes the number of the highest priority pending | ||
213 | - * exception (the one which would be made active by | ||
214 | - * armv7m_nvic_acknowledge_irq()) to @pirq, and sets @ptargets_secure | ||
215 | - * to true if the current highest priority pending exception should | ||
216 | - * be taken to Secure state, false for NS. | ||
217 | - */ | ||
218 | -void armv7m_nvic_get_pending_irq_info(NVICState *s, int *pirq, | ||
219 | - bool *ptargets_secure); | ||
220 | -/** | ||
221 | - * armv7m_nvic_acknowledge_irq: make highest priority pending exception active | ||
222 | - * @s: the NVIC | ||
223 | - * | ||
224 | - * Move the current highest priority pending exception from the pending | ||
225 | - * state to the active state, and update v7m.exception to indicate that | ||
226 | - * it is the exception currently being handled. | ||
227 | - */ | ||
228 | -void armv7m_nvic_acknowledge_irq(NVICState *s); | ||
229 | -/** | ||
230 | - * armv7m_nvic_complete_irq: complete specified interrupt or exception | ||
231 | - * @s: the NVIC | ||
232 | - * @irq: the exception number to complete | ||
233 | - * @secure: true if this exception was secure | ||
234 | - * | ||
235 | - * Returns: -1 if the irq was not active | ||
236 | - * 1 if completing this irq brought us back to base (no active irqs) | ||
237 | - * 0 if there is still an irq active after this one was completed | ||
238 | - * (Ignoring -1, this is the same as the RETTOBASE value before completion.) | ||
239 | - */ | ||
240 | -int armv7m_nvic_complete_irq(NVICState *s, int irq, bool secure); | ||
241 | -/** | ||
242 | - * armv7m_nvic_get_ready_status(void *opaque, int irq, bool secure) | ||
243 | - * @s: the NVIC | ||
244 | - * @irq: the exception number to mark pending | ||
245 | - * @secure: false for non-banked exceptions or for the nonsecure | ||
246 | - * version of a banked exception, true for the secure version of a banked | ||
247 | - * exception. | ||
248 | - * | ||
249 | - * Return whether an exception is "ready", i.e. whether the exception is | ||
250 | - * enabled and is configured at a priority which would allow it to | ||
251 | - * interrupt the current execution priority. This controls whether the | ||
252 | - * RDY bit for it in the FPCCR is set. | ||
253 | - */ | ||
254 | -bool armv7m_nvic_get_ready_status(NVICState *s, int irq, bool secure); | ||
255 | -/** | ||
256 | - * armv7m_nvic_raw_execution_priority: return the raw execution priority | ||
257 | - * @s: the NVIC | ||
258 | - * | ||
259 | - * Returns: the raw execution priority as defined by the v8M architecture. | ||
260 | - * This is the execution priority minus the effects of AIRCR.PRIS, | ||
261 | - * and minus any PRIMASK/FAULTMASK/BASEPRI priority boosting. | ||
262 | - * (v8M ARM ARM I_PKLD.) | ||
263 | - */ | ||
264 | -int armv7m_nvic_raw_execution_priority(NVICState *s); | ||
265 | -/** | ||
266 | - * armv7m_nvic_neg_prio_requested: return true if the requested execution | ||
267 | - * priority is negative for the specified security state. | ||
268 | - * @s: the NVIC | ||
269 | - * @secure: the security state to test | ||
270 | - * This corresponds to the pseudocode IsReqExecPriNeg(). | ||
271 | - */ | ||
272 | -#ifndef CONFIG_USER_ONLY | ||
273 | -bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure); | ||
274 | -#else | ||
275 | -static inline bool armv7m_nvic_neg_prio_requested(NVICState *s, bool secure) | ||
276 | -{ | ||
277 | - return false; | ||
278 | -} | ||
279 | -#endif | ||
280 | - | ||
281 | /* Interface for defining coprocessor registers. | ||
282 | * Registers are defined in tables of arm_cp_reginfo structs | ||
283 | * which are passed to define_arm_cp_regs(). | ||
284 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
285 | index XXXXXXX..XXXXXXX 100644 | ||
286 | --- a/target/arm/cpu.c | ||
287 | +++ b/target/arm/cpu.c | ||
288 | @@ -XXX,XX +XXX,XX @@ | ||
289 | #if !defined(CONFIG_USER_ONLY) | ||
290 | #include "hw/loader.h" | ||
291 | #include "hw/boards.h" | ||
292 | +#ifdef CONFIG_TCG | ||
293 | #include "hw/intc/armv7m_nvic.h" | ||
294 | -#endif | ||
295 | +#endif /* CONFIG_TCG */ | ||
296 | +#endif /* !CONFIG_USER_ONLY */ | ||
297 | #include "sysemu/tcg.h" | ||
298 | #include "sysemu/qtest.h" | ||
299 | #include "sysemu/hw_accel.h" | ||
300 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
301 | index XXXXXXX..XXXXXXX 100644 | ||
302 | --- a/target/arm/cpu_tcg.c | ||
303 | +++ b/target/arm/cpu_tcg.c | ||
304 | @@ -XXX,XX +XXX,XX @@ | ||
305 | #include "hw/boards.h" | ||
306 | #endif | ||
307 | #include "cpregs.h" | ||
308 | +#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) | ||
309 | +#include "hw/intc/armv7m_nvic.h" | ||
310 | +#endif | ||
311 | |||
312 | |||
313 | /* Share AArch32 -cpu max features with AArch64. */ | ||
314 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c | ||
315 | index XXXXXXX..XXXXXXX 100644 | ||
316 | --- a/target/arm/m_helper.c | ||
317 | +++ b/target/arm/m_helper.c | ||
318 | @@ -XXX,XX +XXX,XX @@ | ||
319 | #include "exec/cpu_ldst.h" | ||
320 | #include "semihosting/common-semi.h" | ||
321 | #endif | ||
322 | +#if !defined(CONFIG_USER_ONLY) | ||
323 | +#include "hw/intc/armv7m_nvic.h" | ||
324 | +#endif | ||
325 | |||
326 | static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask, | ||
327 | uint32_t reg, uint32_t val) | ||
328 | -- | ||
329 | 2.34.1 | ||
330 | |||
331 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Alex Bennée <alex.bennee@linaro.org> | |
2 | |||
3 | The two TCG tests for GICv2 and GICv3 are very heavy weight distros | ||
4 | that take a long time to boot up, especially for an --enable-debug | ||
5 | build. The total code coverage they give is: | ||
6 | |||
7 | Overall coverage rate: | ||
8 | lines......: 11.2% (59584 of 530123 lines) | ||
9 | functions..: 15.0% (7436 of 49443 functions) | ||
10 | branches...: 6.3% (19273 of 303933 branches) | ||
11 | |||
12 | We already get pretty close to that with the machine_aarch64_virt | ||
13 | tests which only does one full boot (~120s vs ~600s) of alpine. We | ||
14 | expand the kernel+initrd boot (~8s) to test both GICs and also add an | ||
15 | RNG device and a block device to generate a few IRQs and exercise the | ||
16 | storage layer. With that we get to a coverage of: | ||
17 | |||
18 | Overall coverage rate: | ||
19 | lines......: 11.0% (58121 of 530123 lines) | ||
20 | functions..: 14.9% (7343 of 49443 functions) | ||
21 | branches...: 6.0% (18269 of 303933 branches) | ||
22 | |||
23 | which I feel is close enough given the massive time saving. If we want | ||
24 | to target any more sub-systems we can use lighter weight more directed | ||
25 | tests. | ||
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> | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
33 | --- | ||
34 | tests/avocado/boot_linux.py | 48 ++++---------------- | ||
35 | tests/avocado/machine_aarch64_virt.py | 63 ++++++++++++++++++++++++--- | ||
36 | 2 files changed, 65 insertions(+), 46 deletions(-) | ||
37 | |||
38 | diff --git a/tests/avocado/boot_linux.py b/tests/avocado/boot_linux.py | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/tests/avocado/boot_linux.py | ||
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 | ||
115 | @@ -XXX,XX +XXX,XX @@ | ||
116 | |||
117 | import time | ||
118 | import os | ||
119 | +import logging | ||
120 | |||
121 | from avocado_qemu import QemuSystemTest | ||
122 | from avocado_qemu import wait_for_console_pattern | ||
123 | from avocado_qemu import exec_command | ||
124 | from avocado_qemu import BUILD_DIR | ||
125 | +from avocado.utils import process | ||
126 | +from avocado.utils.path import find_command | ||
127 | |||
128 | class Aarch64VirtMachine(QemuSystemTest): | ||
129 | KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' | ||
130 | @@ -XXX,XX +XXX,XX @@ def test_alpine_virt_tcg_gic_max(self): | ||
131 | self.wait_for_console_pattern('Welcome to Alpine Linux 3.16') | ||
132 | |||
133 | |||
134 | - def test_aarch64_virt(self): | ||
135 | + def common_aarch64_virt(self, machine): | ||
136 | """ | ||
137 | - :avocado: tags=arch:aarch64 | ||
138 | - :avocado: tags=machine:virt | ||
139 | - :avocado: tags=accel:tcg | ||
140 | - :avocado: tags=cpu:max | ||
141 | + Common code to launch basic virt machine with kernel+initrd | ||
142 | + and a scratch disk. | ||
143 | """ | ||
144 | + logger = logging.getLogger('aarch64_virt') | ||
145 | + | ||
146 | kernel_url = ('https://fileserver.linaro.org/s/' | ||
147 | 'z6B2ARM7DQT3HWN/download') | ||
148 | - | ||
149 | kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347' | ||
150 | kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) | ||
151 | |||
152 | @@ -XXX,XX +XXX,XX @@ def test_aarch64_virt(self): | ||
153 | 'console=ttyAMA0') | ||
154 | self.require_accelerator("tcg") | ||
155 | self.vm.add_args('-cpu', 'max,pauth-impdef=on', | ||
156 | + '-machine', machine, | ||
157 | '-accel', 'tcg', | ||
158 | '-kernel', kernel_path, | ||
159 | '-append', kernel_command_line) | ||
160 | + | ||
161 | + # A RNG offers an easy way to generate a few IRQs | ||
162 | + self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0') | ||
163 | + self.vm.add_args('-object', | ||
164 | + 'rng-random,id=rng0,filename=/dev/urandom') | ||
165 | + | ||
166 | + # Also add a scratch block device | ||
167 | + logger.info('creating scratch qcow2 image') | ||
168 | + image_path = os.path.join(self.workdir, 'scratch.qcow2') | ||
169 | + qemu_img = os.path.join(BUILD_DIR, 'qemu-img') | ||
170 | + if not os.path.exists(qemu_img): | ||
171 | + qemu_img = find_command('qemu-img', False) | ||
172 | + if qemu_img is False: | ||
173 | + self.cancel('Could not find "qemu-img", which is required to ' | ||
174 | + 'create the temporary qcow2 image') | ||
175 | + cmd = '%s create -f qcow2 %s 8M' % (qemu_img, image_path) | ||
176 | + process.run(cmd) | ||
177 | + | ||
178 | + # Add the device | ||
179 | + self.vm.add_args('-blockdev', | ||
180 | + f"driver=qcow2,file.driver=file,file.filename={image_path},node-name=scratch") | ||
181 | + self.vm.add_args('-device', | ||
182 | + 'virtio-blk-device,drive=scratch') | ||
183 | + | ||
184 | self.vm.launch() | ||
185 | self.wait_for_console_pattern('Welcome to Buildroot') | ||
186 | time.sleep(0.1) | ||
187 | exec_command(self, 'root') | ||
188 | time.sleep(0.1) | ||
189 | + exec_command(self, 'dd if=/dev/hwrng of=/dev/vda bs=512 count=4') | ||
190 | + time.sleep(0.1) | ||
191 | + exec_command(self, 'md5sum /dev/vda') | ||
192 | + time.sleep(0.1) | ||
193 | + exec_command(self, 'cat /proc/interrupts') | ||
194 | + time.sleep(0.1) | ||
195 | exec_command(self, 'cat /proc/self/maps') | ||
196 | time.sleep(0.1) | ||
197 | + | ||
198 | + def test_aarch64_virt_gicv3(self): | ||
199 | + """ | ||
200 | + :avocado: tags=arch:aarch64 | ||
201 | + :avocado: tags=machine:virt | ||
202 | + :avocado: tags=accel:tcg | ||
203 | + :avocado: tags=cpu:max | ||
204 | + """ | ||
205 | + self.common_aarch64_virt("virt,gic_version=3") | ||
206 | + | ||
207 | + def test_aarch64_virt_gicv2(self): | ||
208 | + """ | ||
209 | + :avocado: tags=arch:aarch64 | ||
210 | + :avocado: tags=machine:virt | ||
211 | + :avocado: tags=accel:tcg | ||
212 | + :avocado: tags=cpu:max | ||
213 | + """ | ||
214 | + self.common_aarch64_virt("virt,gic-version=2") | ||
215 | -- | ||
216 | 2.34.1 | ||
217 | |||
218 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Mostafa Saleh <smostafa@google.com> | ||
1 | 2 | ||
3 | GBPA register can be used to globally abort all | ||
4 | transactions. | ||
5 | |||
6 | It is described in the SMMU manual in "6.3.14 SMMU_GBPA". | ||
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> | ||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
27 | --- | ||
28 | hw/arm/smmuv3-internal.h | 7 +++++++ | ||
29 | include/hw/arm/smmuv3.h | 1 + | ||
30 | hw/arm/smmuv3.c | 43 +++++++++++++++++++++++++++++++++++++++- | ||
31 | 3 files changed, 50 insertions(+), 1 deletion(-) | ||
32 | |||
33 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/hw/arm/smmuv3-internal.h | ||
36 | +++ b/hw/arm/smmuv3-internal.h | ||
37 | @@ -XXX,XX +XXX,XX @@ REG32(CR0ACK, 0x24) | ||
38 | REG32(CR1, 0x28) | ||
39 | REG32(CR2, 0x2c) | ||
40 | REG32(STATUSR, 0x40) | ||
41 | +REG32(GBPA, 0x44) | ||
42 | + FIELD(GBPA, ABORT, 20, 1) | ||
43 | + FIELD(GBPA, UPDATE, 31, 1) | ||
44 | + | ||
45 | +/* Use incoming. */ | ||
46 | +#define SMMU_GBPA_RESET_VAL 0x1000 | ||
47 | + | ||
48 | REG32(IRQ_CTRL, 0x50) | ||
49 | FIELD(IRQ_CTRL, GERROR_IRQEN, 0, 1) | ||
50 | FIELD(IRQ_CTRL, PRI_IRQEN, 1, 1) | ||
51 | diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/include/hw/arm/smmuv3.h | ||
54 | +++ b/include/hw/arm/smmuv3.h | ||
55 | @@ -XXX,XX +XXX,XX @@ struct SMMUv3State { | ||
56 | uint32_t cr[3]; | ||
57 | uint32_t cr0ack; | ||
58 | uint32_t statusr; | ||
59 | + uint32_t gbpa; | ||
60 | uint32_t irq_ctrl; | ||
61 | uint32_t gerror; | ||
62 | uint32_t gerrorn; | ||
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 | }, | ||
117 | }; | ||
118 | |||
119 | +static bool smmuv3_gbpa_needed(void *opaque) | ||
120 | +{ | ||
121 | + SMMUv3State *s = opaque; | ||
122 | + | ||
123 | + /* Only migrate GBPA if it has different reset value. */ | ||
124 | + return s->gbpa != SMMU_GBPA_RESET_VAL; | ||
125 | +} | ||
126 | + | ||
127 | +static const VMStateDescription vmstate_gbpa = { | ||
128 | + .name = "smmuv3/gbpa", | ||
129 | + .version_id = 1, | ||
130 | + .minimum_version_id = 1, | ||
131 | + .needed = smmuv3_gbpa_needed, | ||
132 | + .fields = (VMStateField[]) { | ||
133 | + VMSTATE_UINT32(gbpa, SMMUv3State), | ||
134 | + VMSTATE_END_OF_LIST() | ||
135 | + } | ||
136 | +}; | ||
137 | + | ||
138 | static const VMStateDescription vmstate_smmuv3 = { | ||
139 | .name = "smmuv3", | ||
140 | .version_id = 1, | ||
141 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = { | ||
142 | |||
143 | VMSTATE_END_OF_LIST(), | ||
144 | }, | ||
145 | + .subsections = (const VMStateDescription * []) { | ||
146 | + &vmstate_gbpa, | ||
147 | + NULL | ||
148 | + } | ||
149 | }; | ||
150 | |||
151 | static void smmuv3_instance_init(Object *obj) | ||
152 | -- | ||
153 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
1 | 2 | ||
3 | Since commit acc0b8b05a when running the ZynqMP ZCU102 board with | ||
4 | a QEMU configured using --without-default-devices, we get: | ||
5 | |||
6 | $ qemu-system-aarch64 -M xlnx-zcu102 | ||
7 | qemu-system-aarch64: missing object type 'usb_dwc3' | ||
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> | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | hw/arm/Kconfig | 1 + | ||
19 | 1 file changed, 1 insertion(+) | ||
20 | |||
21 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/arm/Kconfig | ||
24 | +++ b/hw/arm/Kconfig | ||
25 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM | ||
26 | select XLNX_CSU_DMA | ||
27 | select XLNX_ZYNQMP | ||
28 | select XLNX_ZDMA | ||
29 | + select USB_DWC3 | ||
30 | |||
31 | config XLNX_VERSAL | ||
32 | bool | ||
33 | -- | ||
34 | 2.34.1 | ||
35 | |||
36 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Cornelia Huck <cohuck@redhat.com> | ||
1 | 2 | ||
3 | Just use current_accel_name() directly. | ||
4 | |||
5 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> | ||
6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/arm/virt.c | 6 +++--- | ||
11 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
12 | |||
13 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/arm/virt.c | ||
16 | +++ b/hw/arm/virt.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | ||
18 | if (vms->secure && (kvm_enabled() || hvf_enabled())) { | ||
19 | error_report("mach-virt: %s does not support providing " | ||
20 | "Security extensions (TrustZone) to the guest CPU", | ||
21 | - kvm_enabled() ? "KVM" : "HVF"); | ||
22 | + current_accel_name()); | ||
23 | exit(1); | ||
24 | } | ||
25 | |||
26 | if (vms->virt && (kvm_enabled() || hvf_enabled())) { | ||
27 | error_report("mach-virt: %s does not support providing " | ||
28 | "Virtualization extensions to the guest CPU", | ||
29 | - kvm_enabled() ? "KVM" : "HVF"); | ||
30 | + current_accel_name()); | ||
31 | exit(1); | ||
32 | } | ||
33 | |||
34 | if (vms->mte && (kvm_enabled() || hvf_enabled())) { | ||
35 | error_report("mach-virt: %s does not support providing " | ||
36 | "MTE to the guest CPU", | ||
37 | - kvm_enabled() ? "KVM" : "HVF"); | ||
38 | + current_accel_name()); | ||
39 | exit(1); | ||
40 | } | ||
41 | |||
42 | -- | ||
43 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Hao Wu <wuhaotsh@google.com> | ||
1 | 2 | ||
3 | Havard is no longer working on the Nuvoton systems for a while | ||
4 | and won't be able to do any work on it in the future. So I'll | ||
5 | take over maintaining the Nuvoton system from him. | ||
6 | |||
7 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | ||
8 | Acked-by: Havard Skinnemoen <hskinnemoen@google.com> | ||
9 | Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org> | ||
10 | Message-id: 20230208235433.3989937-2-wuhaotsh@google.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | MAINTAINERS | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/MAINTAINERS b/MAINTAINERS | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/MAINTAINERS | ||
19 | +++ b/MAINTAINERS | ||
20 | @@ -XXX,XX +XXX,XX @@ F: include/hw/net/mv88w8618_eth.h | ||
21 | F: docs/system/arm/musicpal.rst | ||
22 | |||
23 | Nuvoton NPCM7xx | ||
24 | -M: Havard Skinnemoen <hskinnemoen@google.com> | ||
25 | M: Tyrone Ting <kfting@nuvoton.com> | ||
26 | +M: Hao Wu <wuhaotsh@google.com> | ||
27 | L: qemu-arm@nongnu.org | ||
28 | S: Supported | ||
29 | F: hw/*/npcm7xx* | ||
30 | -- | ||
31 | 2.34.1 | diff view generated by jsdifflib |
1 | Add a new script to automate the process of running the Coverity | 1 | From: Hao Wu <wuhaotsh@google.com> |
---|---|---|---|
2 | Scan build tools and uploading the resulting tarball to the | ||
3 | website. | ||
4 | 2 | ||
5 | This is intended eventually to be driven from Travis, | 3 | Nuvoton's PSPI is a general purpose SPI module which enables |
6 | but it can be run locally, if you are a maintainer of the | 4 | connections to SPI-based peripheral devices. |
7 | QEMU project on the Coverity Scan website and have the secret | ||
8 | upload token. | ||
9 | 5 | ||
10 | The script must be run on a Fedora 30 system. Support for using a | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
11 | Docker container is added in a following commit. | 7 | Reviewed-by: Chris Rauer <crauer@google.com> |
12 | 8 | Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org> | |
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Message-id: 20230208235433.3989937-3-wuhaotsh@google.com |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Message-id: 20200319193323.2038-6-peter.maydell@linaro.org | ||
16 | --- | 11 | --- |
17 | MAINTAINERS | 5 + | 12 | MAINTAINERS | 6 +- |
18 | scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++ | 13 | include/hw/ssi/npcm_pspi.h | 53 +++++++++ |
19 | 2 files changed, 316 insertions(+) | 14 | hw/ssi/npcm_pspi.c | 221 +++++++++++++++++++++++++++++++++++++ |
20 | create mode 100755 scripts/coverity-scan/run-coverity-scan | 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 | ||
21 | 20 | ||
22 | diff --git a/MAINTAINERS b/MAINTAINERS | 21 | diff --git a/MAINTAINERS b/MAINTAINERS |
23 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/MAINTAINERS | 23 | --- a/MAINTAINERS |
25 | +++ b/MAINTAINERS | 24 | +++ b/MAINTAINERS |
26 | @@ -XXX,XX +XXX,XX @@ M: Markus Armbruster <armbru@redhat.com> | 25 | @@ -XXX,XX +XXX,XX @@ M: Tyrone Ting <kfting@nuvoton.com> |
26 | M: Hao Wu <wuhaotsh@google.com> | ||
27 | L: qemu-arm@nongnu.org | ||
27 | S: Supported | 28 | S: Supported |
28 | F: scripts/coverity-model.c | 29 | -F: hw/*/npcm7xx* |
29 | 30 | -F: include/hw/*/npcm7xx* | |
30 | +Coverity Scan integration | 31 | -F: tests/qtest/npcm7xx* |
31 | +M: Peter Maydell <peter.maydell@linaro.org> | 32 | +F: hw/*/npcm* |
32 | +S: Maintained | 33 | +F: include/hw/*/npcm* |
33 | +F: scripts/coverity-scan/ | 34 | +F: tests/qtest/npcm* |
34 | + | 35 | F: pc-bios/npcm7xx_bootrom.bin |
35 | Device Tree | 36 | F: roms/vbootrom |
36 | M: Alistair Francis <alistair.francis@wdc.com> | 37 | F: docs/system/arm/nuvoton.rst |
37 | R: David Gibson <david@gibson.dropbear.id.au> | 38 | diff --git a/include/hw/ssi/npcm_pspi.h b/include/hw/ssi/npcm_pspi.h |
38 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | 39 | new file mode 100644 |
39 | new file mode 100755 | ||
40 | index XXXXXXX..XXXXXXX | 40 | index XXXXXXX..XXXXXXX |
41 | --- /dev/null | 41 | --- /dev/null |
42 | +++ b/scripts/coverity-scan/run-coverity-scan | 42 | +++ b/include/hw/ssi/npcm_pspi.h |
43 | @@ -XXX,XX +XXX,XX @@ | 43 | @@ -XXX,XX +XXX,XX @@ |
44 | +#!/bin/sh -e | 44 | +/* |
45 | + | 45 | + * Nuvoton Peripheral SPI Module |
46 | +# Upload a created tarball to Coverity Scan, as per | 46 | + * |
47 | +# https://scan.coverity.com/projects/qemu/builds/new | 47 | + * Copyright 2023 Google LLC |
48 | + | 48 | + * |
49 | +# This work is licensed under the terms of the GNU GPL version 2, | 49 | + * This program is free software; you can redistribute it and/or modify it |
50 | +# or (at your option) any later version. | 50 | + * under the terms of the GNU General Public License as published by the |
51 | +# See the COPYING file in the top-level directory. | 51 | + * Free Software Foundation; either version 2 of the License, or |
52 | +# | 52 | + * (at your option) any later version. |
53 | +# Copyright (c) 2017-2020 Linaro Limited | 53 | + * |
54 | +# Written by Peter Maydell | 54 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
55 | + | 55 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
56 | +# Note that this script will automatically download and | 56 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
57 | +# run the (closed-source) coverity build tools, so don't | 57 | + * for more details. |
58 | +# use it if you don't trust them! | 58 | + */ |
59 | + | 59 | +#ifndef NPCM_PSPI_H |
60 | +# This script assumes that you're running it from a QEMU source | 60 | +#define NPCM_PSPI_H |
61 | +# tree, and that tree is a fresh clean one, because we do an in-tree | 61 | + |
62 | +# build. (This is necessary so that the filenames that the Coverity | 62 | +#include "hw/ssi/ssi.h" |
63 | +# Scan server sees are relative paths that match up with the component | 63 | +#include "hw/sysbus.h" |
64 | +# regular expressions it uses; an out-of-tree build won't work for this.) | 64 | + |
65 | +# The host machine should have as many of QEMU's dependencies | 65 | +/* |
66 | +# installed as possible, for maximum coverity coverage. | 66 | + * Number of registers in our device state structure. Don't change this without |
67 | + | 67 | + * incrementing the version_id in the vmstate. |
68 | +# To do an upload you need to be a maintainer in the Coverity online | 68 | + */ |
69 | +# service, and you will need to know the "Coverity token", which is a | 69 | +#define NPCM_PSPI_NR_REGS 3 |
70 | +# secret 8 digit hex string. You can find that from the web UI in the | 70 | + |
71 | +# project settings, if you have maintainer access there. | 71 | +/** |
72 | + | 72 | + * NPCMPSPIState - Device state for one Flash Interface Unit. |
73 | +# Command line options: | 73 | + * @parent: System bus device. |
74 | +# --dry-run : run the tools, but don't actually do the upload | 74 | + * @mmio: Memory region for register access. |
75 | +# --update-tools-only : update the cached copy of the tools, but don't run them | 75 | + * @spi: The SPI bus mastered by this controller. |
76 | +# --tokenfile : file to read Coverity token from | 76 | + * @regs: Register contents. |
77 | +# --version ver : specify version being analyzed (default: ask git) | 77 | + * @irq: The interrupt request queue for this module. |
78 | +# --description desc : specify description of this version (default: ask git) | 78 | + * |
79 | +# --srcdir : QEMU source tree to analyze (default: current working dir) | 79 | + * Each PSPI has a shared bank of registers, and controls up to four chip |
80 | +# --results-tarball : path to copy the results tarball to (default: don't | 80 | + * selects. Each chip select has a dedicated memory region which may be used to |
81 | +# copy it anywhere, just upload it) | 81 | + * read and write the flash connected to that chip select as if it were memory. |
82 | +# | 82 | + */ |
83 | +# User-specifiable environment variables: | 83 | +typedef struct NPCMPSPIState { |
84 | +# COVERITY_TOKEN -- Coverity token | 84 | + SysBusDevice parent; |
85 | +# COVERITY_EMAIL -- the email address to use for uploads (default: | 85 | + |
86 | +# looks at your git user.email config) | 86 | + MemoryRegion mmio; |
87 | +# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is | 87 | + |
88 | +# number of CPUs as determined by 'nproc') | 88 | + SSIBus *spi; |
89 | +# COVERITY_TOOL_BASE -- set to directory to put coverity tools | 89 | + uint16_t regs[NPCM_PSPI_NR_REGS]; |
90 | +# (default: /tmp/coverity-tools) | 90 | + qemu_irq irq; |
91 | +# | 91 | +} NPCMPSPIState; |
92 | +# You must specify the token, either by environment variable or by | 92 | + |
93 | +# putting it in a file and using --tokenfile. Everything else has | 93 | +#define TYPE_NPCM_PSPI "npcm-pspi" |
94 | +# a reasonable default if this is run from a git tree. | 94 | +OBJECT_DECLARE_SIMPLE_TYPE(NPCMPSPIState, NPCM_PSPI) |
95 | + | 95 | + |
96 | +check_upload_permissions() { | 96 | +#endif /* NPCM_PSPI_H */ |
97 | + # Check whether we can do an upload to the server; will exit the script | 97 | diff --git a/hw/ssi/npcm_pspi.c b/hw/ssi/npcm_pspi.c |
98 | + # with status 1 if the check failed (usually a bad token); | 98 | new file mode 100644 |
99 | + # will exit the script with status 0 if the check indicated that we | 99 | index XXXXXXX..XXXXXXX |
100 | + # can't upload yet (ie we are at quota) | 100 | --- /dev/null |
101 | + # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized. | 101 | +++ b/hw/ssi/npcm_pspi.c |
102 | + | 102 | @@ -XXX,XX +XXX,XX @@ |
103 | + echo "Checking upload permissions..." | 103 | +/* |
104 | + | 104 | + * Nuvoton NPCM Peripheral SPI Module (PSPI) |
105 | + if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted --post-data "token=$PROJTOKEN&project=$PROJNAME" -q -O -)"; then | 105 | + * |
106 | + echo "Coverity Scan API access denied: bad token?" | 106 | + * Copyright 2023 Google LLC |
107 | + exit 1 | 107 | + * |
108 | + fi | 108 | + * This program is free software; you can redistribute it and/or modify it |
109 | + | 109 | + * under the terms of the GNU General Public License as published by the |
110 | + # Really up_perm is a JSON response with either | 110 | + * Free Software Foundation; either version 2 of the License, or |
111 | + # {upload_permitted:true} or {next_upload_permitted_at:<date>} | 111 | + * (at your option) any later version. |
112 | + # We do some hacky string parsing instead of properly parsing it. | 112 | + * |
113 | + case "$up_perm" in | 113 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
114 | + *upload_permitted*true*) | 114 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
115 | + echo "Coverity Scan: upload permitted" | 115 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
116 | + ;; | 116 | + * for more details. |
117 | + *next_upload_permitted_at*) | 117 | + */ |
118 | + if [ "$DRYRUN" = yes ]; then | 118 | + |
119 | + echo "Coverity Scan: upload quota reached, continuing dry run" | 119 | +#include "qemu/osdep.h" |
120 | + else | 120 | + |
121 | + echo "Coverity Scan: upload quota reached; stopping here" | 121 | +#include "hw/irq.h" |
122 | + # Exit success as this isn't a build error. | 122 | +#include "hw/registerfields.h" |
123 | + exit 0 | 123 | +#include "hw/ssi/npcm_pspi.h" |
124 | + fi | 124 | +#include "migration/vmstate.h" |
125 | + ;; | 125 | +#include "qapi/error.h" |
126 | + *) | 126 | +#include "qemu/error-report.h" |
127 | + echo "Coverity Scan upload check: unexpected result $up_perm" | 127 | +#include "qemu/log.h" |
128 | + exit 1 | 128 | +#include "qemu/module.h" |
129 | + ;; | 129 | +#include "qemu/units.h" |
130 | + esac | 130 | + |
131 | +} | 131 | +#include "trace.h" |
132 | + | 132 | + |
133 | + | 133 | +REG16(PSPI_DATA, 0x0) |
134 | +update_coverity_tools () { | 134 | +REG16(PSPI_CTL1, 0x2) |
135 | + # Check for whether we need to download the Coverity tools | 135 | + FIELD(PSPI_CTL1, SPIEN, 0, 1) |
136 | + # (either because we don't have a copy, or because it's out of date) | 136 | + FIELD(PSPI_CTL1, MOD, 2, 1) |
137 | + # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set. | 137 | + FIELD(PSPI_CTL1, EIR, 5, 1) |
138 | + | 138 | + FIELD(PSPI_CTL1, EIW, 6, 1) |
139 | + mkdir -p "$COVERITY_TOOL_BASE" | 139 | + FIELD(PSPI_CTL1, SCM, 7, 1) |
140 | + cd "$COVERITY_TOOL_BASE" | 140 | + FIELD(PSPI_CTL1, SCIDL, 8, 1) |
141 | + | 141 | + FIELD(PSPI_CTL1, SCDV, 9, 7) |
142 | + echo "Checking for new version of coverity build tools..." | 142 | +REG16(PSPI_STAT, 0x4) |
143 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new | 143 | + FIELD(PSPI_STAT, BSY, 0, 1) |
144 | + | 144 | + FIELD(PSPI_STAT, RBF, 1, 1) |
145 | + if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then | 145 | + |
146 | + # out of date md5 or no md5: download new build tool | 146 | +static void npcm_pspi_update_irq(NPCMPSPIState *s) |
147 | + # blow away the old build tool | 147 | +{ |
148 | + echo "Downloading coverity build tools..." | 148 | + int level = 0; |
149 | + rm -rf coverity_tool coverity_tool.tgz | 149 | + |
150 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz | 150 | + /* Only fire IRQ when the module is enabled. */ |
151 | + if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5sum -c --status; then | 151 | + if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, SPIEN)) { |
152 | + echo "Downloaded tarball didn't match md5sum!" | 152 | + /* Update interrupt as BSY is cleared. */ |
153 | + exit 1 | 153 | + if ((!FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, BSY)) && |
154 | + fi | 154 | + FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIW)) { |
155 | + # extract the new one, keeping it corralled in a 'coverity_tool' directory | 155 | + level = 1; |
156 | + echo "Unpacking coverity build tools..." | 156 | + } |
157 | + mkdir -p coverity_tool | 157 | + |
158 | + cd coverity_tool | 158 | + /* Update interrupt as RBF is set. */ |
159 | + tar xf ../coverity_tool.tgz | 159 | + if (FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, RBF) && |
160 | + cd .. | 160 | + FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIR)) { |
161 | + mv coverity_tool.md5.new coverity_tool.md5 | 161 | + level = 1; |
162 | + fi | 162 | + } |
163 | + | 163 | + } |
164 | + rm -f coverity_tool.md5.new | 164 | + qemu_set_irq(s->irq, level); |
165 | +} | 165 | +} |
166 | + | 166 | + |
167 | + | 167 | +static uint16_t npcm_pspi_read_data(NPCMPSPIState *s) |
168 | +# Check user-provided environment variables and arguments | 168 | +{ |
169 | +DRYRUN=no | 169 | + uint16_t value = s->regs[R_PSPI_DATA]; |
170 | +UPDATE_ONLY=no | 170 | + |
171 | + | 171 | + /* Clear stat bits as the value are read out. */ |
172 | +while [ "$#" -ge 1 ]; do | 172 | + s->regs[R_PSPI_STAT] = 0; |
173 | + case "$1" in | 173 | + |
174 | + --dry-run) | 174 | + return value; |
175 | + shift | 175 | +} |
176 | + DRYRUN=yes | 176 | + |
177 | + ;; | 177 | +static void npcm_pspi_write_data(NPCMPSPIState *s, uint16_t data) |
178 | + --update-tools-only) | 178 | +{ |
179 | + shift | 179 | + uint16_t value = 0; |
180 | + UPDATE_ONLY=yes | 180 | + |
181 | + ;; | 181 | + if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, MOD)) { |
182 | + --version) | 182 | + value = ssi_transfer(s->spi, extract16(data, 8, 8)) << 8; |
183 | + shift | 183 | + } |
184 | + if [ $# -eq 0 ]; then | 184 | + value |= ssi_transfer(s->spi, extract16(data, 0, 8)); |
185 | + echo "--version needs an argument" | 185 | + s->regs[R_PSPI_DATA] = value; |
186 | + exit 1 | 186 | + |
187 | + fi | 187 | + /* Mark data as available */ |
188 | + VERSION="$1" | 188 | + s->regs[R_PSPI_STAT] = R_PSPI_STAT_BSY_MASK | R_PSPI_STAT_RBF_MASK; |
189 | + shift | 189 | +} |
190 | + ;; | 190 | + |
191 | + --description) | 191 | +/* Control register read handler. */ |
192 | + shift | 192 | +static uint64_t npcm_pspi_ctrl_read(void *opaque, hwaddr addr, |
193 | + if [ $# -eq 0 ]; then | 193 | + unsigned int size) |
194 | + echo "--description needs an argument" | 194 | +{ |
195 | + exit 1 | 195 | + NPCMPSPIState *s = opaque; |
196 | + fi | 196 | + uint16_t value; |
197 | + DESCRIPTION="$1" | 197 | + |
198 | + shift | 198 | + switch (addr) { |
199 | + ;; | 199 | + case A_PSPI_DATA: |
200 | + --tokenfile) | 200 | + value = npcm_pspi_read_data(s); |
201 | + shift | 201 | + break; |
202 | + if [ $# -eq 0 ]; then | 202 | + |
203 | + echo "--tokenfile needs an argument" | 203 | + case A_PSPI_CTL1: |
204 | + exit 1 | 204 | + value = s->regs[R_PSPI_CTL1]; |
205 | + fi | 205 | + break; |
206 | + COVERITY_TOKEN="$(cat "$1")" | 206 | + |
207 | + shift | 207 | + case A_PSPI_STAT: |
208 | + ;; | 208 | + value = s->regs[R_PSPI_STAT]; |
209 | + --srcdir) | 209 | + break; |
210 | + shift | 210 | + |
211 | + if [ $# -eq 0 ]; then | 211 | + default: |
212 | + echo "--srcdir needs an argument" | 212 | + qemu_log_mask(LOG_GUEST_ERROR, |
213 | + exit 1 | 213 | + "%s: write to invalid offset 0x%" PRIx64 "\n", |
214 | + fi | 214 | + DEVICE(s)->canonical_path, addr); |
215 | + SRCDIR="$1" | 215 | + return 0; |
216 | + shift | 216 | + } |
217 | + ;; | 217 | + trace_npcm_pspi_ctrl_read(DEVICE(s)->canonical_path, addr, value); |
218 | + --results-tarball) | 218 | + npcm_pspi_update_irq(s); |
219 | + shift | 219 | + |
220 | + if [ $# -eq 0 ]; then | 220 | + return value; |
221 | + echo "--results-tarball needs an argument" | 221 | +} |
222 | + exit 1 | 222 | + |
223 | + fi | 223 | +/* Control register write handler. */ |
224 | + RESULTSTARBALL="$1" | 224 | +static void npcm_pspi_ctrl_write(void *opaque, hwaddr addr, uint64_t v, |
225 | + shift | 225 | + unsigned int size) |
226 | + ;; | 226 | +{ |
227 | + *) | 227 | + NPCMPSPIState *s = opaque; |
228 | + echo "Unexpected argument '$1'" | 228 | + uint16_t value = v; |
229 | + exit 1 | 229 | + |
230 | + ;; | 230 | + trace_npcm_pspi_ctrl_write(DEVICE(s)->canonical_path, addr, value); |
231 | + esac | 231 | + |
232 | +done | 232 | + switch (addr) { |
233 | + | 233 | + case A_PSPI_DATA: |
234 | +if [ -z "$COVERITY_TOKEN" ]; then | 234 | + npcm_pspi_write_data(s, value); |
235 | + echo "COVERITY_TOKEN environment variable not set" | 235 | + break; |
236 | + exit 1 | 236 | + |
237 | +fi | 237 | + case A_PSPI_CTL1: |
238 | + | 238 | + s->regs[R_PSPI_CTL1] = value; |
239 | +if [ -z "$COVERITY_BUILD_CMD" ]; then | 239 | + break; |
240 | + NPROC=$(nproc) | 240 | + |
241 | + COVERITY_BUILD_CMD="make -j$NPROC" | 241 | + case A_PSPI_STAT: |
242 | + echo "COVERITY_BUILD_CMD: using default '$COVERITY_BUILD_CMD'" | 242 | + qemu_log_mask(LOG_GUEST_ERROR, |
243 | +fi | 243 | + "%s: write to read-only register PSPI_STAT: 0x%08" |
244 | + | 244 | + PRIx64 "\n", DEVICE(s)->canonical_path, v); |
245 | +if [ -z "$COVERITY_TOOL_BASE" ]; then | 245 | + break; |
246 | + echo "COVERITY_TOOL_BASE: using default /tmp/coverity-tools" | 246 | + |
247 | + COVERITY_TOOL_BASE=/tmp/coverity-tools | 247 | + default: |
248 | +fi | 248 | + qemu_log_mask(LOG_GUEST_ERROR, |
249 | + | 249 | + "%s: write to invalid offset 0x%" PRIx64 "\n", |
250 | +if [ -z "$SRCDIR" ]; then | 250 | + DEVICE(s)->canonical_path, addr); |
251 | + SRCDIR="$PWD" | 251 | + return; |
252 | +fi | 252 | + } |
253 | + | 253 | + npcm_pspi_update_irq(s); |
254 | +PROJTOKEN="$COVERITY_TOKEN" | 254 | +} |
255 | +PROJNAME=QEMU | 255 | + |
256 | +TARBALL=cov-int.tar.xz | 256 | +static const MemoryRegionOps npcm_pspi_ctrl_ops = { |
257 | + | 257 | + .read = npcm_pspi_ctrl_read, |
258 | + | 258 | + .write = npcm_pspi_ctrl_write, |
259 | +if [ "$UPDATE_ONLY" = yes ]; then | 259 | + .endianness = DEVICE_LITTLE_ENDIAN, |
260 | + # Just do the tools update; we don't need to check whether | 260 | + .valid = { |
261 | + # we are in a source tree or have upload rights for this, | 261 | + .min_access_size = 1, |
262 | + # so do it before some of the command line and source tree checks. | 262 | + .max_access_size = 2, |
263 | + update_coverity_tools | 263 | + .unaligned = false, |
264 | + exit 0 | 264 | + }, |
265 | +fi | 265 | + .impl = { |
266 | + | 266 | + .min_access_size = 2, |
267 | +cd "$SRCDIR" | 267 | + .max_access_size = 2, |
268 | + | 268 | + .unaligned = false, |
269 | +echo "Checking this is a QEMU source tree..." | 269 | + }, |
270 | +if ! [ -e "$SRCDIR/VERSION" ]; then | 270 | +}; |
271 | + echo "Not in a QEMU source tree?" | 271 | + |
272 | + exit 1 | 272 | +static void npcm_pspi_enter_reset(Object *obj, ResetType type) |
273 | +fi | 273 | +{ |
274 | + | 274 | + NPCMPSPIState *s = NPCM_PSPI(obj); |
275 | +# Fill in defaults used by the non-update-only process | 275 | + |
276 | +if [ -z "$VERSION" ]; then | 276 | + trace_npcm_pspi_enter_reset(DEVICE(obj)->canonical_path, type); |
277 | + VERSION="$(git describe --always HEAD)" | 277 | + memset(s->regs, 0, sizeof(s->regs)); |
278 | +fi | 278 | +} |
279 | + | 279 | + |
280 | +if [ -z "$DESCRIPTION" ]; then | 280 | +static void npcm_pspi_realize(DeviceState *dev, Error **errp) |
281 | + DESCRIPTION="$(git rev-parse HEAD)" | 281 | +{ |
282 | +fi | 282 | + NPCMPSPIState *s = NPCM_PSPI(dev); |
283 | + | 283 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); |
284 | +if [ -z "$COVERITY_EMAIL" ]; then | 284 | + Object *obj = OBJECT(dev); |
285 | + COVERITY_EMAIL="$(git config user.email)" | 285 | + |
286 | +fi | 286 | + s->spi = ssi_create_bus(dev, "pspi"); |
287 | + | 287 | + memory_region_init_io(&s->mmio, obj, &npcm_pspi_ctrl_ops, s, |
288 | +check_upload_permissions | 288 | + "mmio", 4 * KiB); |
289 | + | 289 | + sysbus_init_mmio(sbd, &s->mmio); |
290 | +update_coverity_tools | 290 | + sysbus_init_irq(sbd, &s->irq); |
291 | + | 291 | +} |
292 | +TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)" | 292 | + |
293 | + | 293 | +static const VMStateDescription vmstate_npcm_pspi = { |
294 | +if ! test -x "$TOOLBIN/cov-build"; then | 294 | + .name = "npcm-pspi", |
295 | + echo "Couldn't find cov-build in the coverity build-tool directory??" | 295 | + .version_id = 0, |
296 | + exit 1 | 296 | + .minimum_version_id = 0, |
297 | +fi | 297 | + .fields = (VMStateField[]) { |
298 | + | 298 | + VMSTATE_UINT16_ARRAY(regs, NPCMPSPIState, NPCM_PSPI_NR_REGS), |
299 | +export PATH="$TOOLBIN:$PATH" | 299 | + VMSTATE_END_OF_LIST(), |
300 | + | 300 | + }, |
301 | +cd "$SRCDIR" | 301 | +}; |
302 | + | 302 | + |
303 | +echo "Doing make distclean..." | 303 | + |
304 | +make distclean | 304 | +static void npcm_pspi_class_init(ObjectClass *klass, void *data) |
305 | + | 305 | +{ |
306 | +echo "Configuring..." | 306 | + ResettableClass *rc = RESETTABLE_CLASS(klass); |
307 | +# We configure with a fixed set of enables here to ensure that we don't | 307 | + DeviceClass *dc = DEVICE_CLASS(klass); |
308 | +# accidentally reduce the scope of the analysis by doing the build on | 308 | + |
309 | +# the system that's missing a dependency that we need to build part of | 309 | + dc->desc = "NPCM Peripheral SPI Module"; |
310 | +# the codebase. | 310 | + dc->realize = npcm_pspi_realize; |
311 | +./configure --disable-modules --enable-sdl --enable-gtk \ | 311 | + dc->vmsd = &vmstate_npcm_pspi; |
312 | + --enable-opengl --enable-vte --enable-gnutls \ | 312 | + rc->phases.enter = npcm_pspi_enter_reset; |
313 | + --enable-nettle --enable-curses --enable-curl \ | 313 | +} |
314 | + --audio-drv-list=oss,alsa,sdl,pa --enable-virtfs \ | 314 | + |
315 | + --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png \ | 315 | +static const TypeInfo npcm_pspi_types[] = { |
316 | + --enable-xen --enable-brlapi \ | 316 | + { |
317 | + --enable-linux-aio --enable-attr \ | 317 | + .name = TYPE_NPCM_PSPI, |
318 | + --enable-cap-ng --enable-trace-backends=log --enable-spice --enable-rbd \ | 318 | + .parent = TYPE_SYS_BUS_DEVICE, |
319 | + --enable-xfsctl --enable-libusb --enable-usb-redir \ | 319 | + .instance_size = sizeof(NPCMPSPIState), |
320 | + --enable-libiscsi --enable-libnfs --enable-seccomp \ | 320 | + .class_init = npcm_pspi_class_init, |
321 | + --enable-tpm --enable-libssh --enable-lzo --enable-snappy --enable-bzip2 \ | 321 | + }, |
322 | + --enable-numa --enable-rdma --enable-smartcard --enable-virglrenderer \ | 322 | +}; |
323 | + --enable-mpath --enable-libxml2 --enable-glusterfs \ | 323 | +DEFINE_TYPES(npcm_pspi_types); |
324 | + --enable-virtfs --enable-zstd | 324 | diff --git a/hw/ssi/meson.build b/hw/ssi/meson.build |
325 | + | 325 | index XXXXXXX..XXXXXXX 100644 |
326 | +echo "Making libqemustub.a..." | 326 | --- a/hw/ssi/meson.build |
327 | +make libqemustub.a | 327 | +++ b/hw/ssi/meson.build |
328 | + | 328 | @@ -XXX,XX +XXX,XX @@ |
329 | +echo "Running cov-build..." | 329 | softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_smc.c')) |
330 | +rm -rf cov-int | 330 | softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('mss-spi.c')) |
331 | +mkdir cov-int | 331 | -softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c')) |
332 | +cov-build --dir cov-int $COVERITY_BUILD_CMD | 332 | +softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c', 'npcm_pspi.c')) |
333 | + | 333 | softmmu_ss.add(when: 'CONFIG_PL022', if_true: files('pl022.c')) |
334 | +echo "Creating results tarball..." | 334 | softmmu_ss.add(when: 'CONFIG_SIFIVE_SPI', if_true: files('sifive_spi.c')) |
335 | +tar cvf - cov-int | xz > "$TARBALL" | 335 | softmmu_ss.add(when: 'CONFIG_SSI', if_true: files('ssi.c')) |
336 | + | 336 | diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events |
337 | +if [ ! -z "$RESULTSTARBALL" ]; then | 337 | index XXXXXXX..XXXXXXX 100644 |
338 | + echo "Copying results tarball to $RESULTSTARBALL..." | 338 | --- a/hw/ssi/trace-events |
339 | + cp "$TARBALL" "$RESULTSTARBALL" | 339 | +++ b/hw/ssi/trace-events |
340 | +fi | 340 | @@ -XXX,XX +XXX,XX @@ npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset: |
341 | + | 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 | +echo "Uploading results tarball..." | 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 | + | 343 | |
344 | +if [ "$DRYRUN" = yes ]; then | 344 | +# npcm_pspi.c |
345 | + echo "Dry run only, not uploading $TARBALL" | 345 | +npcm_pspi_enter_reset(const char *id, int reset_type) "%s reset type: %d" |
346 | + exit 0 | 346 | +npcm_pspi_ctrl_read(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16 |
347 | +fi | 347 | +npcm_pspi_ctrl_write(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16 |
348 | + | 348 | + |
349 | +curl --form token="$PROJTOKEN" --form email="$COVERITY_EMAIL" \ | 349 | # ibex_spi_host.c |
350 | + --form file=@"$TARBALL" --form version="$VERSION" \ | 350 | |
351 | + --form description="$DESCRIPTION" \ | 351 | ibex_spi_host_reset(const char *msg) "%s" |
352 | + https://scan.coverity.com/builds?project="$PROJNAME" | ||
353 | + | ||
354 | +echo "Done." | ||
355 | -- | 352 | -- |
356 | 2.20.1 | 353 | 2.34.1 |
357 | |||
358 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Hao Wu <wuhaotsh@google.com> | ||
1 | 2 | ||
3 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | ||
4 | Reviewed-by: Titus Rwantare <titusr@google.com> | ||
5 | Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org> | ||
6 | Message-id: 20230208235433.3989937-4-wuhaotsh@google.com | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | docs/system/arm/nuvoton.rst | 2 +- | ||
10 | include/hw/arm/npcm7xx.h | 2 ++ | ||
11 | hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++-- | ||
12 | 3 files changed, 26 insertions(+), 3 deletions(-) | ||
13 | |||
14 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/docs/system/arm/nuvoton.rst | ||
17 | +++ b/docs/system/arm/nuvoton.rst | ||
18 | @@ -XXX,XX +XXX,XX @@ Supported devices | ||
19 | * SMBus controller (SMBF) | ||
20 | * Ethernet controller (EMC) | ||
21 | * Tachometer | ||
22 | + * Peripheral SPI controller (PSPI) | ||
23 | |||
24 | Missing devices | ||
25 | --------------- | ||
26 | @@ -XXX,XX +XXX,XX @@ Missing devices | ||
27 | |||
28 | * Ethernet controller (GMAC) | ||
29 | * USB device (USBD) | ||
30 | - * Peripheral SPI controller (PSPI) | ||
31 | * SD/MMC host | ||
32 | * PECI interface | ||
33 | * PCI and PCIe root complex and bridges | ||
34 | diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/hw/arm/npcm7xx.h | ||
37 | +++ b/include/hw/arm/npcm7xx.h | ||
38 | @@ -XXX,XX +XXX,XX @@ | ||
39 | #include "hw/nvram/npcm7xx_otp.h" | ||
40 | #include "hw/timer/npcm7xx_timer.h" | ||
41 | #include "hw/ssi/npcm7xx_fiu.h" | ||
42 | +#include "hw/ssi/npcm_pspi.h" | ||
43 | #include "hw/usb/hcd-ehci.h" | ||
44 | #include "hw/usb/hcd-ohci.h" | ||
45 | #include "target/arm/cpu.h" | ||
46 | @@ -XXX,XX +XXX,XX @@ struct NPCM7xxState { | ||
47 | NPCM7xxFIUState fiu[2]; | ||
48 | NPCM7xxEMCState emc[2]; | ||
49 | NPCM7xxSDHCIState mmc; | ||
50 | + NPCMPSPIState pspi[2]; | ||
51 | }; | ||
52 | |||
53 | #define TYPE_NPCM7XX "npcm7xx" | ||
54 | diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/hw/arm/npcm7xx.c | ||
57 | +++ b/hw/arm/npcm7xx.c | ||
58 | @@ -XXX,XX +XXX,XX @@ enum NPCM7xxInterrupt { | ||
59 | NPCM7XX_EMC1RX_IRQ = 15, | ||
60 | NPCM7XX_EMC1TX_IRQ, | ||
61 | NPCM7XX_MMC_IRQ = 26, | ||
62 | + NPCM7XX_PSPI2_IRQ = 28, | ||
63 | + NPCM7XX_PSPI1_IRQ = 31, | ||
64 | NPCM7XX_TIMER0_IRQ = 32, /* Timer Module 0 */ | ||
65 | NPCM7XX_TIMER1_IRQ, | ||
66 | NPCM7XX_TIMER2_IRQ, | ||
67 | @@ -XXX,XX +XXX,XX @@ static const hwaddr npcm7xx_emc_addr[] = { | ||
68 | 0xf0826000, | ||
69 | }; | ||
70 | |||
71 | +/* Register base address for each PSPI Module */ | ||
72 | +static const hwaddr npcm7xx_pspi_addr[] = { | ||
73 | + 0xf0200000, | ||
74 | + 0xf0201000, | ||
75 | +}; | ||
76 | + | ||
77 | static const struct { | ||
78 | hwaddr regs_addr; | ||
79 | uint32_t unconnected_pins; | ||
80 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_init(Object *obj) | ||
81 | object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EMC); | ||
82 | } | ||
83 | |||
84 | + for (i = 0; i < ARRAY_SIZE(s->pspi); i++) { | ||
85 | + object_initialize_child(obj, "pspi[*]", &s->pspi[i], TYPE_NPCM_PSPI); | ||
86 | + } | ||
87 | + | ||
88 | object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI); | ||
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); | ||
118 | -- | ||
119 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
1 | 2 | ||
3 | Addresses targeting the second translation table (TTB1) in the SMMU have | ||
4 | all upper bits set. Ensure the IOMMU region covers all 64 bits. | ||
5 | |||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Message-id: 20230214171921.1917916-2-jean-philippe@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | include/hw/arm/smmu-common.h | 2 -- | ||
13 | hw/arm/smmu-common.c | 2 +- | ||
14 | 2 files changed, 1 insertion(+), 3 deletions(-) | ||
15 | |||
16 | diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/include/hw/arm/smmu-common.h | ||
19 | +++ b/include/hw/arm/smmu-common.h | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | #define SMMU_PCI_DEVFN_MAX 256 | ||
22 | #define SMMU_PCI_DEVFN(sid) (sid & 0xFF) | ||
23 | |||
24 | -#define SMMU_MAX_VA_BITS 48 | ||
25 | - | ||
26 | /* | ||
27 | * Page table walk error types | ||
28 | */ | ||
29 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/smmu-common.c | ||
32 | +++ b/hw/arm/smmu-common.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn) | ||
34 | |||
35 | memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu), | ||
36 | s->mrtypename, | ||
37 | - OBJECT(s), name, 1ULL << SMMU_MAX_VA_BITS); | ||
38 | + OBJECT(s), name, UINT64_MAX); | ||
39 | address_space_init(&sdev->as, | ||
40 | MEMORY_REGION(&sdev->iommu), name); | ||
41 | trace_smmu_add_mr(name); | ||
42 | -- | ||
43 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
1 | 2 | ||
3 | Addresses targeting the second translation table (TTB1) in the SMMU have | ||
4 | all upper bits set (except for the top byte when TBI is enabled). Fix | ||
5 | the TTB1 check. | ||
6 | |||
7 | Reported-by: Ola Hugosson <ola.hugosson@arm.com> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20230214171921.1917916-3-jean-philippe@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/smmu-common.c | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/smmu-common.c | ||
20 | +++ b/hw/arm/smmu-common.c | ||
21 | @@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova) | ||
22 | /* there is a ttbr0 region and we are in it (high bits all zero) */ | ||
23 | return &cfg->tt[0]; | ||
24 | } else if (cfg->tt[1].tsz && | ||
25 | - !extract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte)) { | ||
26 | + sextract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte) == -1) { | ||
27 | /* there is a ttbr1 region and we are in it (high bits all one) */ | ||
28 | return &cfg->tt[1]; | ||
29 | } else if (!cfg->tt[0].tsz) { | ||
30 | -- | ||
31 | 2.34.1 | diff view generated by jsdifflib |
1 | Versions of Sphinx older than 1.6 can't build all of our documentation, | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | because they are too picky about the syntax of the argument to the | ||
3 | option:: directive; see Sphinx bugs #646, #3366: | ||
4 | 2 | ||
5 | https://github.com/sphinx-doc/sphinx/issues/646 | 3 | make it clearer from the name that this is a tcg-only function. |
6 | https://github.com/sphinx-doc/sphinx/issues/3366 | ||
7 | 4 | ||
8 | Trying to build with a 1.4.x Sphinx fails with | 5 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
9 | docs/system/images.rst:4: SEVERE: Duplicate ID: "cmdoption-qcow2-arg-encrypt" | 6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
10 | and a 1.5.x Sphinx fails with | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | docs/system/invocation.rst:544: WARNING: Malformed option description '[enable=]PATTERN', should look like "opt", "-opt | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | args", "--opt args", "/opt args" or "+opt args" | 9 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/helper.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
13 | 14 | ||
14 | Update our needs_sphinx setting to indicate that we require at least | 15 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
15 | 1.6. This will allow configure to fall back to "don't build the | ||
16 | docs" rather than causing the build to fail entirely, which is | ||
17 | probably what most users building on a host old enough to have such | ||
18 | an old Sphinx would want; if they do want the docs then they'll have | ||
19 | a useful indication of what they need to do (upgrade Sphinx!) rather | ||
20 | than a confusing error message. | ||
21 | |||
22 | In theory our distro support policy would suggest that we should | ||
23 | support building on the Sphinx shipped in those distros, but: | ||
24 | * EPEL7 has Sphinx 1.2.3 (which we've never supported!) | ||
25 | * Debian Stretch has Sphinx 1.4.8 | ||
26 | |||
27 | Trying to get our docs to work with Sphinx 1.4 is not tractable | ||
28 | for the 5.0 release and I'm not sure it's worthwhile effort anyway; | ||
29 | at least with this change the build as a whole now succeeds. | ||
30 | |||
31 | Thanks to John Snow for doing the investigation and testing to | ||
32 | confirm what Sphinx versions fail in what ways and what distros | ||
33 | shipped what. | ||
34 | |||
35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
36 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
37 | --- | ||
38 | docs/conf.py | 6 ++++-- | ||
39 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
40 | |||
41 | diff --git a/docs/conf.py b/docs/conf.py | ||
42 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/docs/conf.py | 17 | --- a/target/arm/helper.c |
44 | +++ b/docs/conf.py | 18 | +++ b/target/arm/helper.c |
45 | @@ -XXX,XX +XXX,XX @@ sys.path.insert(0, os.path.join(qemu_docdir, "sphinx")) | 19 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) |
46 | 20 | * trapped to the hypervisor in KVM. | |
47 | # If your documentation needs a minimal Sphinx version, state it here. | 21 | */ |
48 | # | 22 | #ifdef CONFIG_TCG |
49 | -# 1.3 is where the 'alabaster' theme was shipped with Sphinx. | 23 | -static void handle_semihosting(CPUState *cs) |
50 | -needs_sphinx = '1.3' | 24 | +static void tcg_handle_semihosting(CPUState *cs) |
51 | +# Sphinx 1.5 and earlier can't build our docs because they are too | 25 | { |
52 | +# picky about the syntax of the argument to the option:: directive | 26 | ARMCPU *cpu = ARM_CPU(cs); |
53 | +# (see Sphinx bugs #646, #3366). | 27 | CPUARMState *env = &cpu->env; |
54 | +needs_sphinx = '1.6' | 28 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs) |
55 | 29 | */ | |
56 | # Add any Sphinx extension module names here, as strings. They can be | 30 | #ifdef CONFIG_TCG |
57 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | 31 | if (cs->exception_index == EXCP_SEMIHOST) { |
32 | - handle_semihosting(cs); | ||
33 | + tcg_handle_semihosting(cs); | ||
34 | return; | ||
35 | } | ||
36 | #endif | ||
58 | -- | 37 | -- |
59 | 2.20.1 | 38 | 2.34.1 |
60 | 39 | ||
61 | 40 | diff view generated by jsdifflib |
1 | The kernel-doc Sphinx plugin and associated script currently emit | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | 'c:type' directives for "struct foo" documentation. | ||
3 | 2 | ||
4 | Sphinx 3.0 warns about this: | 3 | for "all" builds (tcg + kvm), we want to avoid doing |
5 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:3: WARNING: Type must be either just a name or a typedef-like declaration. | 4 | the psci check if tcg is built-in, but not enabled. |
6 | If just a name: | ||
7 | Error in declarator or parameters | ||
8 | Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6] | ||
9 | struct MemoryListener | ||
10 | ------^ | ||
11 | If typedef-like declaration: | ||
12 | Error in declarator or parameters | ||
13 | Invalid C declaration: Expected identifier in nested name. [error at 21] | ||
14 | struct MemoryListener | ||
15 | ---------------------^ | ||
16 | 5 | ||
17 | because it wants us to use the new-in-3.0 'c:struct' instead. | 6 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
9 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/helper.c | 3 ++- | ||
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
18 | 14 | ||
19 | Plumb the Sphinx version through to the kernel-doc script | 15 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
20 | and use it to select 'c:struct' for newer versions than 3.0. | ||
21 | |||
22 | Fixes: LP:1872113 | ||
23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
24 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
25 | --- | ||
26 | docs/sphinx/kerneldoc.py | 1 + | ||
27 | scripts/kernel-doc | 16 +++++++++++++++- | ||
28 | 2 files changed, 16 insertions(+), 1 deletion(-) | ||
29 | |||
30 | diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py | ||
31 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/docs/sphinx/kerneldoc.py | 17 | --- a/target/arm/helper.c |
33 | +++ b/docs/sphinx/kerneldoc.py | 18 | +++ b/target/arm/helper.c |
34 | @@ -XXX,XX +XXX,XX @@ class KernelDocDirective(Directive): | 19 | @@ -XXX,XX +XXX,XX @@ |
35 | env.note_dependency(os.path.abspath(f)) | 20 | #include "hw/irq.h" |
36 | cmd += ['-export-file', f] | 21 | #include "sysemu/cpu-timers.h" |
37 | 22 | #include "sysemu/kvm.h" | |
38 | + cmd += ['-sphinx-version', sphinx.__version__] | 23 | +#include "sysemu/tcg.h" |
39 | cmd += [filename] | 24 | #include "qapi/qapi-commands-machine-target.h" |
40 | 25 | #include "qapi/error.h" | |
41 | try: | 26 | #include "qemu/guest-random.h" |
42 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc | 27 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs) |
43 | index XXXXXXX..XXXXXXX 100755 | 28 | env->exception.syndrome); |
44 | --- a/scripts/kernel-doc | 29 | } |
45 | +++ b/scripts/kernel-doc | 30 | |
46 | @@ -XXX,XX +XXX,XX @@ Output selection (mutually exclusive): | 31 | - if (arm_is_psci_call(cpu, cs->exception_index)) { |
47 | DOC: sections. May be specified multiple times. | 32 | + if (tcg_enabled() && arm_is_psci_call(cpu, cs->exception_index)) { |
48 | 33 | arm_handle_psci_call(cpu); | |
49 | Output selection modifiers: | 34 | qemu_log_mask(CPU_LOG_INT, "...handled as PSCI call\n"); |
50 | + -sphinx-version VER Generate rST syntax for the specified Sphinx version. | 35 | return; |
51 | + Only works with reStructuredTextFormat. | ||
52 | -no-doc-sections Do not output DOC: sections. | ||
53 | -enable-lineno Enable output of #define LINENO lines. Only works with | ||
54 | reStructuredText format. | ||
55 | @@ -XXX,XX +XXX,XX @@ use constant { | ||
56 | }; | ||
57 | my $output_selection = OUTPUT_ALL; | ||
58 | my $show_not_found = 0; # No longer used | ||
59 | +my $sphinx_version = "0.0"; # if not specified, assume old | ||
60 | |||
61 | my @export_file_list; | ||
62 | |||
63 | @@ -XXX,XX +XXX,XX @@ while ($ARGV[0] =~ m/^--?(.*)/) { | ||
64 | $enable_lineno = 1; | ||
65 | } elsif ($cmd eq 'show-not-found') { | ||
66 | $show_not_found = 1; # A no-op but don't fail | ||
67 | + } elsif ($cmd eq 'sphinx-version') { | ||
68 | + $sphinx_version = shift @ARGV; | ||
69 | } else { | ||
70 | # Unknown argument | ||
71 | usage(); | ||
72 | @@ -XXX,XX +XXX,XX @@ sub output_struct_rst(%) { | ||
73 | my $oldprefix = $lineprefix; | ||
74 | my $name = $args{'type'} . " " . $args{'struct'}; | ||
75 | |||
76 | - print "\n\n.. c:type:: " . $name . "\n\n"; | ||
77 | + # Sphinx 3.0 and up will emit warnings for "c:type:: struct Foo". | ||
78 | + # It wants to see "c:struct:: Foo" (and will add the word 'struct' in | ||
79 | + # the rendered output). | ||
80 | + if ((split(/\./, $sphinx_version))[0] >= 3) { | ||
81 | + my $sname = $name; | ||
82 | + $sname =~ s/^struct //; | ||
83 | + print "\n\n.. c:struct:: " . $sname . "\n\n"; | ||
84 | + } else { | ||
85 | + print "\n\n.. c:type:: " . $name . "\n\n"; | ||
86 | + } | ||
87 | print_lineno($declaration_start_line); | ||
88 | $lineprefix = " "; | ||
89 | output_highlight_rst($args{'purpose'}); | ||
90 | -- | 36 | -- |
91 | 2.20.1 | 37 | 2.34.1 |
92 | 38 | ||
93 | 39 | diff view generated by jsdifflib |
1 | The documentation of our -s and -gdb options is quite old; in | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | particular it still claims that it will cause QEMU to stop and wait | ||
3 | for the gdb connection, when this has not been true for some time: | ||
4 | you also need to pass -S if you want to make QEMU not launch the | ||
5 | guest on startup. | ||
6 | 2 | ||
7 | Improve the documentation to mention this requirement in the | 3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
8 | executable's --help output, the documentation of the -gdb option in | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | the manual, and in the "GDB usage" chapter. | 5 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
6 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | --- | ||
9 | target/arm/helper.c | 12 +++++++----- | ||
10 | 1 file changed, 7 insertions(+), 5 deletions(-) | ||
10 | 11 | ||
11 | Includes some minor tweaks to these paragraphs of documentation | 12 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
12 | since I was editing them anyway (such as dropping the description | ||
13 | of our gdb support as "primitive"). | ||
14 | |||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
19 | Message-id: 20200403094014.9589-1-peter.maydell@linaro.org | ||
20 | --- | ||
21 | docs/system/gdb.rst | 22 +++++++++++++++------- | ||
22 | qemu-options.hx | 24 ++++++++++++++++++------ | ||
23 | 2 files changed, 33 insertions(+), 13 deletions(-) | ||
24 | |||
25 | diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst | ||
26 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/docs/system/gdb.rst | 14 | --- a/target/arm/helper.c |
28 | +++ b/docs/system/gdb.rst | 15 | +++ b/target/arm/helper.c |
29 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) |
30 | GDB usage | 17 | unsigned int cur_el = arm_current_el(env); |
31 | --------- | 18 | int rt; |
32 | 19 | ||
33 | -QEMU has a primitive support to work with gdb, so that you can do | 20 | - /* |
34 | -'Ctrl-C' while the virtual machine is running and inspect its state. | 21 | - * Note that new_el can never be 0. If cur_el is 0, then |
35 | +QEMU supports working with gdb via gdb's remote-connection facility | 22 | - * el0_a64 is is_a64(), else el0_a64 is ignored. |
36 | +(the "gdbstub"). This allows you to debug guest code in the same | 23 | - */ |
37 | +way that you might with a low-level debug facility like JTAG | 24 | - aarch64_sve_change_el(env, cur_el, new_el, is_a64(env)); |
38 | +on real hardware. You can stop and start the virtual machine, | 25 | + if (tcg_enabled()) { |
39 | +examine state like registers and memory, and set breakpoints and | 26 | + /* |
40 | +watchpoints. | 27 | + * Note that new_el can never be 0. If cur_el is 0, then |
41 | 28 | + * el0_a64 is is_a64(), else el0_a64 is ignored. | |
42 | -In order to use gdb, launch QEMU with the '-s' option. It will wait for | 29 | + */ |
43 | -a gdb connection: | 30 | + aarch64_sve_change_el(env, cur_el, new_el, is_a64(env)); |
44 | +In order to use gdb, launch QEMU with the ``-s`` and ``-S`` options. | 31 | + } |
45 | +The ``-s`` option will make QEMU listen for an incoming connection | 32 | |
46 | +from gdb on TCP port 1234, and ``-S`` will make QEMU not start the | 33 | if (cur_el < new_el) { |
47 | +guest until you tell it to from gdb. (If you want to specify which | 34 | /* |
48 | +TCP port to use or to use something other than TCP for the gdbstub | ||
49 | +connection, use the ``-gdb dev`` option instead of ``-s``.) | ||
50 | |||
51 | .. parsed-literal:: | ||
52 | |||
53 | - |qemu_system| -s -kernel bzImage -hda rootdisk.img -append "root=/dev/hda" | ||
54 | - Connected to host network interface: tun0 | ||
55 | - Waiting gdb connection on port 1234 | ||
56 | + |qemu_system| -s -S -kernel bzImage -hda rootdisk.img -append "root=/dev/hda" | ||
57 | + | ||
58 | +QEMU will launch but will silently wait for gdb to connect. | ||
59 | |||
60 | Then launch gdb on the 'vmlinux' executable:: | ||
61 | |||
62 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/qemu-options.hx | ||
65 | +++ b/qemu-options.hx | ||
66 | @@ -XXX,XX +XXX,XX @@ SRST | ||
67 | ERST | ||
68 | |||
69 | DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \ | ||
70 | - "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL) | ||
71 | + "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n" | ||
72 | + " the guest without waiting for gdb to connect; use -S too\n" | ||
73 | + " if you want it to not start execution.)\n", | ||
74 | + QEMU_ARCH_ALL) | ||
75 | SRST | ||
76 | ``-gdb dev`` | ||
77 | - Wait for gdb connection on device dev (see | ||
78 | - :ref:`gdb_005fusage`). Typical connections will likely be | ||
79 | - TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable | ||
80 | - use case. The latter is allowing to start QEMU from within gdb and | ||
81 | - establish the connection via a pipe: | ||
82 | + Accept a gdb connection on device dev (see | ||
83 | + :ref:`gdb_005fusage`). Note that this option does not pause QEMU | ||
84 | + execution -- if you want QEMU to not start the guest until you | ||
85 | + connect with gdb and issue a ``continue`` command, you will need to | ||
86 | + also pass the ``-S`` option to QEMU. | ||
87 | + | ||
88 | + The most usual configuration is to listen on a local TCP socket:: | ||
89 | + | ||
90 | + -gdb tcp::3117 | ||
91 | + | ||
92 | + but you can specify other backends; UDP, pseudo TTY, or even stdio | ||
93 | + are all reasonable use cases. For example, a stdio connection | ||
94 | + allows you to start QEMU from within gdb and establish the | ||
95 | + connection via a pipe: | ||
96 | |||
97 | .. parsed-literal:: | ||
98 | |||
99 | -- | 35 | -- |
100 | 2.20.1 | 36 | 2.34.1 |
101 | 37 | ||
102 | 38 | diff view generated by jsdifflib |
1 | Add support for running the Coverity Scan tools inside a Docker | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | container rather than directly on the host system. | ||
3 | 2 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Move this earlier to make the next patch diff cleaner. While here |
4 | update the comment slightly to not give the impression that the | ||
5 | misalignment affects only TCG. | ||
6 | |||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
10 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Message-id: 20200319193323.2038-7-peter.maydell@linaro.org | ||
7 | --- | 12 | --- |
8 | scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++ | 13 | target/arm/machine.c | 18 +++++++++--------- |
9 | scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++ | 14 | 1 file changed, 9 insertions(+), 9 deletions(-) |
10 | 2 files changed, 221 insertions(+) | ||
11 | create mode 100644 scripts/coverity-scan/coverity-scan.docker | ||
12 | 15 | ||
13 | diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-scan/coverity-scan.docker | 16 | diff --git a/target/arm/machine.c b/target/arm/machine.c |
14 | new file mode 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
15 | index XXXXXXX..XXXXXXX | 18 | --- a/target/arm/machine.c |
16 | --- /dev/null | 19 | +++ b/target/arm/machine.c |
17 | +++ b/scripts/coverity-scan/coverity-scan.docker | 20 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
18 | @@ -XXX,XX +XXX,XX @@ | 21 | } |
19 | +# syntax=docker/dockerfile:1.0.0-experimental | 22 | } |
20 | +# | 23 | |
21 | +# Docker setup for running the "Coverity Scan" tools over the source | 24 | + /* |
22 | +# tree and uploading them to the website, as per | 25 | + * Misaligned thumb pc is architecturally impossible. Fail the |
23 | +# https://scan.coverity.com/projects/qemu/builds/new | 26 | + * incoming migration. For TCG it would trigger the assert in |
24 | +# We do this on a fixed config (currently Fedora 30 with a known | 27 | + * thumb_tr_translate_insn(). |
25 | +# set of dependencies and a configure command that enables a specific | 28 | + */ |
26 | +# set of options) so that random changes don't result in our accidentally | 29 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { |
27 | +# dropping some files from the scan. | 30 | + return -1; |
28 | +# | 31 | + } |
29 | +# We don't build on top of the fedora.docker file because we don't | ||
30 | +# want to accidentally change or break the scan config when that | ||
31 | +# is updated. | ||
32 | + | 32 | + |
33 | +# The work of actually doing the build is handled by the | 33 | hw_breakpoint_update_all(cpu); |
34 | +# run-coverity-scan script. | 34 | hw_watchpoint_update_all(cpu); |
35 | + | 35 | |
36 | +FROM fedora:30 | 36 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
37 | +ENV PACKAGES \ | 37 | } |
38 | + alsa-lib-devel \ | 38 | } |
39 | + bc \ | 39 | |
40 | + bison \ | 40 | - /* |
41 | + brlapi-devel \ | 41 | - * Misaligned thumb pc is architecturally impossible. |
42 | + bzip2 \ | 42 | - * We have an assert in thumb_tr_translate_insn to verify this. |
43 | + bzip2-devel \ | 43 | - * Fail an incoming migrate to avoid this assert. |
44 | + ccache \ | 44 | - */ |
45 | + clang \ | 45 | - if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { |
46 | + curl \ | 46 | - return -1; |
47 | + cyrus-sasl-devel \ | 47 | - } |
48 | + dbus-daemon \ | 48 | - |
49 | + device-mapper-multipath-devel \ | 49 | if (!kvm_enabled()) { |
50 | + findutils \ | 50 | pmu_op_finish(&cpu->env); |
51 | + flex \ | 51 | } |
52 | + gcc \ | ||
53 | + gcc-c++ \ | ||
54 | + gettext \ | ||
55 | + git \ | ||
56 | + glib2-devel \ | ||
57 | + glusterfs-api-devel \ | ||
58 | + gnutls-devel \ | ||
59 | + gtk3-devel \ | ||
60 | + hostname \ | ||
61 | + libaio-devel \ | ||
62 | + libasan \ | ||
63 | + libattr-devel \ | ||
64 | + libblockdev-mpath-devel \ | ||
65 | + libcap-devel \ | ||
66 | + libcap-ng-devel \ | ||
67 | + libcurl-devel \ | ||
68 | + libepoxy-devel \ | ||
69 | + libfdt-devel \ | ||
70 | + libgbm-devel \ | ||
71 | + libiscsi-devel \ | ||
72 | + libjpeg-devel \ | ||
73 | + libpmem-devel \ | ||
74 | + libnfs-devel \ | ||
75 | + libpng-devel \ | ||
76 | + librbd-devel \ | ||
77 | + libseccomp-devel \ | ||
78 | + libssh-devel \ | ||
79 | + libubsan \ | ||
80 | + libudev-devel \ | ||
81 | + libusbx-devel \ | ||
82 | + libxml2-devel \ | ||
83 | + libzstd-devel \ | ||
84 | + llvm \ | ||
85 | + lzo-devel \ | ||
86 | + make \ | ||
87 | + mingw32-bzip2 \ | ||
88 | + mingw32-curl \ | ||
89 | + mingw32-glib2 \ | ||
90 | + mingw32-gmp \ | ||
91 | + mingw32-gnutls \ | ||
92 | + mingw32-gtk3 \ | ||
93 | + mingw32-libjpeg-turbo \ | ||
94 | + mingw32-libpng \ | ||
95 | + mingw32-libtasn1 \ | ||
96 | + mingw32-nettle \ | ||
97 | + mingw32-nsis \ | ||
98 | + mingw32-pixman \ | ||
99 | + mingw32-pkg-config \ | ||
100 | + mingw32-SDL2 \ | ||
101 | + mingw64-bzip2 \ | ||
102 | + mingw64-curl \ | ||
103 | + mingw64-glib2 \ | ||
104 | + mingw64-gmp \ | ||
105 | + mingw64-gnutls \ | ||
106 | + mingw64-gtk3 \ | ||
107 | + mingw64-libjpeg-turbo \ | ||
108 | + mingw64-libpng \ | ||
109 | + mingw64-libtasn1 \ | ||
110 | + mingw64-nettle \ | ||
111 | + mingw64-pixman \ | ||
112 | + mingw64-pkg-config \ | ||
113 | + mingw64-SDL2 \ | ||
114 | + ncurses-devel \ | ||
115 | + nettle-devel \ | ||
116 | + nss-devel \ | ||
117 | + numactl-devel \ | ||
118 | + perl \ | ||
119 | + perl-Test-Harness \ | ||
120 | + pixman-devel \ | ||
121 | + pulseaudio-libs-devel \ | ||
122 | + python3 \ | ||
123 | + python3-sphinx \ | ||
124 | + PyYAML \ | ||
125 | + rdma-core-devel \ | ||
126 | + SDL2-devel \ | ||
127 | + snappy-devel \ | ||
128 | + sparse \ | ||
129 | + spice-server-devel \ | ||
130 | + systemd-devel \ | ||
131 | + systemtap-sdt-devel \ | ||
132 | + tar \ | ||
133 | + texinfo \ | ||
134 | + usbredir-devel \ | ||
135 | + virglrenderer-devel \ | ||
136 | + vte291-devel \ | ||
137 | + wget \ | ||
138 | + which \ | ||
139 | + xen-devel \ | ||
140 | + xfsprogs-devel \ | ||
141 | + zlib-devel | ||
142 | +ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3 | ||
143 | + | ||
144 | +RUN dnf install -y $PACKAGES | ||
145 | +RUN rpm -q $PACKAGES | sort > /packages.txt | ||
146 | +ENV PATH $PATH:/usr/libexec/python3-sphinx/ | ||
147 | +ENV COVERITY_TOOL_BASE=/coverity-tools | ||
148 | +COPY run-coverity-scan run-coverity-scan | ||
149 | +RUN --mount=type=secret,id=coverity.token,required ./run-coverity-scan --update-tools-only --tokenfile /run/secrets/coverity.token | ||
150 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | ||
151 | index XXXXXXX..XXXXXXX 100755 | ||
152 | --- a/scripts/coverity-scan/run-coverity-scan | ||
153 | +++ b/scripts/coverity-scan/run-coverity-scan | ||
154 | @@ -XXX,XX +XXX,XX @@ | ||
155 | |||
156 | # Command line options: | ||
157 | # --dry-run : run the tools, but don't actually do the upload | ||
158 | +# --docker : create and work inside a docker container | ||
159 | # --update-tools-only : update the cached copy of the tools, but don't run them | ||
160 | # --tokenfile : file to read Coverity token from | ||
161 | # --version ver : specify version being analyzed (default: ask git) | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | # --srcdir : QEMU source tree to analyze (default: current working dir) | ||
164 | # --results-tarball : path to copy the results tarball to (default: don't | ||
165 | # copy it anywhere, just upload it) | ||
166 | +# --src-tarball : tarball to untar into src dir (default: none); this | ||
167 | +# is intended mainly for internal use by the Docker support | ||
168 | # | ||
169 | # User-specifiable environment variables: | ||
170 | # COVERITY_TOKEN -- Coverity token | ||
171 | @@ -XXX,XX +XXX,XX @@ update_coverity_tools () { | ||
172 | # Check user-provided environment variables and arguments | ||
173 | DRYRUN=no | ||
174 | UPDATE_ONLY=no | ||
175 | +DOCKER=no | ||
176 | |||
177 | while [ "$#" -ge 1 ]; do | ||
178 | case "$1" in | ||
179 | @@ -XXX,XX +XXX,XX @@ while [ "$#" -ge 1 ]; do | ||
180 | RESULTSTARBALL="$1" | ||
181 | shift | ||
182 | ;; | ||
183 | + --src-tarball) | ||
184 | + shift | ||
185 | + if [ $# -eq 0 ]; then | ||
186 | + echo "--src-tarball needs an argument" | ||
187 | + exit 1 | ||
188 | + fi | ||
189 | + SRCTARBALL="$1" | ||
190 | + shift | ||
191 | + ;; | ||
192 | + --docker) | ||
193 | + DOCKER=yes | ||
194 | + shift | ||
195 | + ;; | ||
196 | *) | ||
197 | echo "Unexpected argument '$1'" | ||
198 | exit 1 | ||
199 | @@ -XXX,XX +XXX,XX @@ PROJTOKEN="$COVERITY_TOKEN" | ||
200 | PROJNAME=QEMU | ||
201 | TARBALL=cov-int.tar.xz | ||
202 | |||
203 | +if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then | ||
204 | + echo "Combining --docker and --update-only is not supported" | ||
205 | + exit 1 | ||
206 | +fi | ||
207 | |||
208 | if [ "$UPDATE_ONLY" = yes ]; then | ||
209 | # Just do the tools update; we don't need to check whether | ||
210 | @@ -XXX,XX +XXX,XX @@ if [ "$UPDATE_ONLY" = yes ]; then | ||
211 | exit 0 | ||
212 | fi | ||
213 | |||
214 | +if [ ! -e "$SRCDIR" ]; then | ||
215 | + mkdir "$SRCDIR" | ||
216 | +fi | ||
217 | + | ||
218 | cd "$SRCDIR" | ||
219 | |||
220 | +if [ ! -z "$SRCTARBALL" ]; then | ||
221 | + echo "Untarring source tarball into $SRCDIR..." | ||
222 | + tar xvf "$SRCTARBALL" | ||
223 | +fi | ||
224 | + | ||
225 | echo "Checking this is a QEMU source tree..." | ||
226 | if ! [ -e "$SRCDIR/VERSION" ]; then | ||
227 | echo "Not in a QEMU source tree?" | ||
228 | @@ -XXX,XX +XXX,XX @@ if [ -z "$COVERITY_EMAIL" ]; then | ||
229 | COVERITY_EMAIL="$(git config user.email)" | ||
230 | fi | ||
231 | |||
232 | +# Run ourselves inside docker if that's what the user wants | ||
233 | +if [ "$DOCKER" = yes ]; then | ||
234 | + # build docker container including the coverity-scan tools | ||
235 | + # Put the Coverity token into a temporary file that only | ||
236 | + # we have read access to, and then pass it to docker build | ||
237 | + # using --secret. This requires at least Docker 18.09. | ||
238 | + # Mostly what we are trying to do here is ensure we don't leak | ||
239 | + # the token into the Docker image. | ||
240 | + umask 077 | ||
241 | + SECRETDIR=$(mktemp -d) | ||
242 | + if [ -z "$SECRETDIR" ]; then | ||
243 | + echo "Failed to create temporary directory" | ||
244 | + exit 1 | ||
245 | + fi | ||
246 | + trap 'rm -rf "$SECRETDIR"' INT TERM EXIT | ||
247 | + echo "Created temporary directory $SECRETDIR" | ||
248 | + SECRET="$SECRETDIR/token" | ||
249 | + echo "$COVERITY_TOKEN" > "$SECRET" | ||
250 | + echo "Building docker container..." | ||
251 | + # TODO: This re-downloads the tools every time, rather than | ||
252 | + # caching and reusing the image produced with the downloaded tools. | ||
253 | + # Not sure why. | ||
254 | + # TODO: how do you get 'docker build' to print the output of the | ||
255 | + # commands it is running to its stdout? This would be useful for debug. | ||
256 | + DOCKER_BUILDKIT=1 docker build -t coverity-scanner \ | ||
257 | + --secret id=coverity.token,src="$SECRET" \ | ||
258 | + -f scripts/coverity-scan/coverity-scan.docker \ | ||
259 | + scripts/coverity-scan | ||
260 | + echo "Archiving sources to be analyzed..." | ||
261 | + ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz" | ||
262 | + if [ "$DRYRUN" = yes ]; then | ||
263 | + DRYRUNARG=--dry-run | ||
264 | + fi | ||
265 | + echo "Running scanner..." | ||
266 | + # If we need to capture the output tarball, get the inner run to | ||
267 | + # save it to the secrets directory so we can copy it out before the | ||
268 | + # directory is cleaned up. | ||
269 | + if [ ! -z "$RESULTSTARBALL" ]; then | ||
270 | + RTARGS="--results-tarball /work/cov-int.tar.xz" | ||
271 | + else | ||
272 | + RTARGS="" | ||
273 | + fi | ||
274 | + # Arrange for this docker run to get access to the sources with -v. | ||
275 | + # We pass through all the configuration from the outer script to the inner. | ||
276 | + export COVERITY_EMAIL COVERITY_BUILD_CMD | ||
277 | + docker run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \ | ||
278 | + -v "$SECRETDIR:/work" coverity-scanner \ | ||
279 | + ./run-coverity-scan --version "$VERSION" \ | ||
280 | + --description "$DESCRIPTION" $DRYRUNARG --tokenfile /work/token \ | ||
281 | + --srcdir /qemu --src-tarball /work/qemu-sources.tgz $RTARGS | ||
282 | + if [ ! -z "$RESULTSTARBALL" ]; then | ||
283 | + echo "Copying results tarball to $RESULTSTARBALL..." | ||
284 | + cp "$SECRETDIR/cov-int.tar.xz" "$RESULTSTARBALL" | ||
285 | + fi | ||
286 | + echo "Docker work complete." | ||
287 | + exit 0 | ||
288 | +fi | ||
289 | + | ||
290 | +# Otherwise, continue with the full build and upload process. | ||
291 | + | ||
292 | check_upload_permissions | ||
293 | |||
294 | update_coverity_tools | ||
295 | -- | 52 | -- |
296 | 2.20.1 | 53 | 2.34.1 |
297 | 54 | ||
298 | 55 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Fabiano Rosas <farosas@suse.de> | |
2 | |||
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> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/cpregs.h | 98 +++++++++++++++++++++++++++++++++++++++++++++ | ||
15 | target/arm/cpu.h | 91 ----------------------------------------- | ||
16 | 2 files changed, 98 insertions(+), 91 deletions(-) | ||
17 | |||
18 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/cpregs.h | ||
21 | +++ b/target/arm/cpregs.h | ||
22 | @@ -XXX,XX +XXX,XX @@ enum { | ||
23 | ARM_CP_SME = 1 << 19, | ||
24 | }; | ||
25 | |||
26 | +/* | ||
27 | + * Interface for defining coprocessor registers. | ||
28 | + * Registers are defined in tables of arm_cp_reginfo structs | ||
29 | + * which are passed to define_arm_cp_regs(). | ||
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 | ||
128 | index XXXXXXX..XXXXXXX 100644 | ||
129 | --- a/target/arm/cpu.h | ||
130 | +++ b/target/arm/cpu.h | ||
131 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_list(void); | ||
132 | uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | ||
133 | uint32_t cur_el, bool secure); | ||
134 | |||
135 | -/* Interface for defining coprocessor registers. | ||
136 | - * Registers are defined in tables of arm_cp_reginfo structs | ||
137 | - * which are passed to define_arm_cp_regs(). | ||
138 | - */ | ||
139 | - | ||
140 | -/* When looking up a coprocessor register we look for it | ||
141 | - * via an integer which encodes all of: | ||
142 | - * coprocessor number | ||
143 | - * Crn, Crm, opc1, opc2 fields | ||
144 | - * 32 or 64 bit register (ie is it accessed via MRC/MCR | ||
145 | - * or via MRRC/MCRR?) | ||
146 | - * non-secure/secure bank (AArch32 only) | ||
147 | - * We allow 4 bits for opc1 because MRRC/MCRR have a 4 bit field. | ||
148 | - * (In this case crn and opc2 should be zero.) | ||
149 | - * For AArch64, there is no 32/64 bit size distinction; | ||
150 | - * instead all registers have a 2 bit op0, 3 bit op1 and op2, | ||
151 | - * and 4 bit CRn and CRm. The encoding patterns are chosen | ||
152 | - * to be easy to convert to and from the KVM encodings, and also | ||
153 | - * so that the hashtable can contain both AArch32 and AArch64 | ||
154 | - * registers (to allow for interprocessing where we might run | ||
155 | - * 32 bit code on a 64 bit core). | ||
156 | - */ | ||
157 | -/* This bit is private to our hashtable cpreg; in KVM register | ||
158 | - * IDs the AArch64/32 distinction is the KVM_REG_ARM/ARM64 | ||
159 | - * in the upper bits of the 64 bit ID. | ||
160 | - */ | ||
161 | -#define CP_REG_AA64_SHIFT 28 | ||
162 | -#define CP_REG_AA64_MASK (1 << CP_REG_AA64_SHIFT) | ||
163 | - | ||
164 | -/* To enable banking of coprocessor registers depending on ns-bit we | ||
165 | - * add a bit to distinguish between secure and non-secure cpregs in the | ||
166 | - * hashtable. | ||
167 | - */ | ||
168 | -#define CP_REG_NS_SHIFT 29 | ||
169 | -#define CP_REG_NS_MASK (1 << CP_REG_NS_SHIFT) | ||
170 | - | ||
171 | -#define ENCODE_CP_REG(cp, is64, ns, crn, crm, opc1, opc2) \ | ||
172 | - ((ns) << CP_REG_NS_SHIFT | ((cp) << 16) | ((is64) << 15) | \ | ||
173 | - ((crn) << 11) | ((crm) << 7) | ((opc1) << 3) | (opc2)) | ||
174 | - | ||
175 | -#define ENCODE_AA64_CP_REG(cp, crn, crm, op0, op1, op2) \ | ||
176 | - (CP_REG_AA64_MASK | \ | ||
177 | - ((cp) << CP_REG_ARM_COPROC_SHIFT) | \ | ||
178 | - ((op0) << CP_REG_ARM64_SYSREG_OP0_SHIFT) | \ | ||
179 | - ((op1) << CP_REG_ARM64_SYSREG_OP1_SHIFT) | \ | ||
180 | - ((crn) << CP_REG_ARM64_SYSREG_CRN_SHIFT) | \ | ||
181 | - ((crm) << CP_REG_ARM64_SYSREG_CRM_SHIFT) | \ | ||
182 | - ((op2) << CP_REG_ARM64_SYSREG_OP2_SHIFT)) | ||
183 | - | ||
184 | -/* Convert a full 64 bit KVM register ID to the truncated 32 bit | ||
185 | - * version used as a key for the coprocessor register hashtable | ||
186 | - */ | ||
187 | -static inline uint32_t kvm_to_cpreg_id(uint64_t kvmid) | ||
188 | -{ | ||
189 | - uint32_t cpregid = kvmid; | ||
190 | - if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) { | ||
191 | - cpregid |= CP_REG_AA64_MASK; | ||
192 | - } else { | ||
193 | - if ((kvmid & CP_REG_SIZE_MASK) == CP_REG_SIZE_U64) { | ||
194 | - cpregid |= (1 << 15); | ||
195 | - } | ||
196 | - | ||
197 | - /* KVM is always non-secure so add the NS flag on AArch32 register | ||
198 | - * entries. | ||
199 | - */ | ||
200 | - cpregid |= 1 << CP_REG_NS_SHIFT; | ||
201 | - } | ||
202 | - return cpregid; | ||
203 | -} | ||
204 | - | ||
205 | -/* Convert a truncated 32 bit hashtable key into the full | ||
206 | - * 64 bit KVM register ID. | ||
207 | - */ | ||
208 | -static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) | ||
209 | -{ | ||
210 | - uint64_t kvmid; | ||
211 | - | ||
212 | - if (cpregid & CP_REG_AA64_MASK) { | ||
213 | - kvmid = cpregid & ~CP_REG_AA64_MASK; | ||
214 | - kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM64; | ||
215 | - } else { | ||
216 | - kvmid = cpregid & ~(1 << 15); | ||
217 | - if (cpregid & (1 << 15)) { | ||
218 | - kvmid |= CP_REG_SIZE_U64 | CP_REG_ARM; | ||
219 | - } else { | ||
220 | - kvmid |= CP_REG_SIZE_U32 | CP_REG_ARM; | ||
221 | - } | ||
222 | - } | ||
223 | - return kvmid; | ||
224 | -} | ||
225 | - | ||
226 | /* Return the highest implemented Exception Level */ | ||
227 | static inline int arm_highest_el(CPUARMState *env) | ||
228 | { | ||
229 | -- | ||
230 | 2.34.1 | ||
231 | |||
232 | diff view generated by jsdifflib |
1 | In commit a1a98357e3fd in 2018 we added some workarounds for Coverity | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | not being able to handle the _Float* types introduced by recent | ||
3 | glibc. Newer versions of the Coverity scan tools have support for | ||
4 | these types, and will fail with errors about duplicate typedefs if we | ||
5 | have our workaround. Remove our copy of the typedefs. | ||
6 | 2 | ||
3 | If a test was tagged with the "accel" tag and the specified | ||
4 | accelerator it not present in the qemu binary, cancel the test. | ||
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> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20200319193323.2038-2-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | include/qemu/osdep.h | 14 -------------- | 14 | tests/avocado/avocado_qemu/__init__.py | 4 ++++ |
12 | 1 file changed, 14 deletions(-) | 15 | 1 file changed, 4 insertions(+) |
13 | 16 | ||
14 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | 17 | diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/include/qemu/osdep.h | 19 | --- a/tests/avocado/avocado_qemu/__init__.py |
17 | +++ b/include/qemu/osdep.h | 20 | +++ b/tests/avocado/avocado_qemu/__init__.py |
18 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ def setUp(self): |
19 | #else | 22 | |
20 | #include "exec/poison.h" | 23 | super().setUp('qemu-system-') |
21 | #endif | 24 | |
22 | -#ifdef __COVERITY__ | 25 | + accel_required = self._get_unique_tag_val('accel') |
23 | -/* Coverity does not like the new _Float* types that are used by | 26 | + if accel_required: |
24 | - * recent glibc, and croaks on every single file that includes | 27 | + self.require_accelerator(accel_required) |
25 | - * stdlib.h. These typedefs are enough to please it. | 28 | + |
26 | - * | 29 | self.machine = self.params.get('machine', |
27 | - * Note that these fix parse errors so they cannot be placed in | 30 | default=self._get_unique_tag_val('machine')) |
28 | - * scripts/coverity-model.c. | ||
29 | - */ | ||
30 | -typedef float _Float32; | ||
31 | -typedef double _Float32x; | ||
32 | -typedef double _Float64; | ||
33 | -typedef __float80 _Float64x; | ||
34 | -typedef __float128 _Float128; | ||
35 | -#endif | ||
36 | |||
37 | #include "qemu/compiler.h" | ||
38 | 31 | ||
39 | -- | 32 | -- |
40 | 2.20.1 | 33 | 2.34.1 |
41 | 34 | ||
42 | 35 | diff view generated by jsdifflib |
1 | All the Coverity-specific definitions of qemu_mutex_lock() and friends | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | have a trailing semicolon. This works fine almost everywhere because | ||
3 | of QEMU's mandatory-braces coding style and because most callsites are | ||
4 | simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as | ||
5 | an if() statement, which makes the ';' a syntax error: | ||
6 | "../target/s390x/sigp.c", line 461: warning #18: expected a ")" | ||
7 | if (qemu_mutex_trylock(&qemu_sigp_mutex)) { | ||
8 | ^ | ||
9 | 2 | ||
10 | Remove the bogus semicolons from the macro definitions. | 3 | This allows the test to be skipped when TCG is not present in the QEMU |
4 | binary. | ||
11 | 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> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20200319193323.2038-4-peter.maydell@linaro.org | ||
16 | --- | 10 | --- |
17 | include/qemu/thread.h | 12 ++++++------ | 11 | tests/avocado/boot_linux_console.py | 1 + |
18 | 1 file changed, 6 insertions(+), 6 deletions(-) | 12 | tests/avocado/reverse_debugging.py | 8 ++++++++ |
13 | 2 files changed, 9 insertions(+) | ||
19 | 14 | ||
20 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h | 15 | diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py |
21 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/qemu/thread.h | 17 | --- a/tests/avocado/boot_linux_console.py |
23 | +++ b/include/qemu/thread.h | 18 | +++ b/tests/avocado/boot_linux_console.py |
24 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; | 19 | @@ -XXX,XX +XXX,XX @@ def test_arm_orangepi_uboot_netbsd9(self): |
25 | * hide them. | 20 | |
26 | */ | 21 | def test_aarch64_raspi3_atf(self): |
27 | #define qemu_mutex_lock(m) \ | 22 | """ |
28 | - qemu_mutex_lock_impl(m, __FILE__, __LINE__); | 23 | + :avocado: tags=accel:tcg |
29 | + qemu_mutex_lock_impl(m, __FILE__, __LINE__) | 24 | :avocado: tags=arch:aarch64 |
30 | #define qemu_mutex_trylock(m) \ | 25 | :avocado: tags=machine:raspi3b |
31 | - qemu_mutex_trylock_impl(m, __FILE__, __LINE__); | 26 | :avocado: tags=cpu:cortex-a53 |
32 | + qemu_mutex_trylock_impl(m, __FILE__, __LINE__) | 27 | diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py |
33 | #define qemu_rec_mutex_lock(m) \ | 28 | index XXXXXXX..XXXXXXX 100644 |
34 | - qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__); | 29 | --- a/tests/avocado/reverse_debugging.py |
35 | + qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__) | 30 | +++ b/tests/avocado/reverse_debugging.py |
36 | #define qemu_rec_mutex_trylock(m) \ | 31 | @@ -XXX,XX +XXX,XX @@ def reverse_debugging(self, shift=7, args=None): |
37 | - qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__); | 32 | vm.shutdown() |
38 | + qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__) | 33 | |
39 | #define qemu_cond_wait(c, m) \ | 34 | class ReverseDebugging_X86_64(ReverseDebugging): |
40 | - qemu_cond_wait_impl(c, m, __FILE__, __LINE__); | 35 | + """ |
41 | + qemu_cond_wait_impl(c, m, __FILE__, __LINE__) | 36 | + :avocado: tags=accel:tcg |
42 | #define qemu_cond_timedwait(c, m, ms) \ | 37 | + """ |
43 | - qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); | 38 | + |
44 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__) | 39 | REG_PC = 0x10 |
45 | #else | 40 | REG_CS = 0x12 |
46 | #define qemu_mutex_lock(m) ({ \ | 41 | def get_pc(self, g): |
47 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ | 42 | @@ -XXX,XX +XXX,XX @@ def test_x86_64_pc(self): |
43 | self.reverse_debugging() | ||
44 | |||
45 | class ReverseDebugging_AArch64(ReverseDebugging): | ||
46 | + """ | ||
47 | + :avocado: tags=accel:tcg | ||
48 | + """ | ||
49 | + | ||
50 | REG_PC = 32 | ||
51 | |||
52 | # unidentified gitlab timeout problem | ||
48 | -- | 53 | -- |
49 | 2.20.1 | 54 | 2.34.1 |
50 | 55 | ||
51 | 56 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Fabiano Rosas <farosas@suse.de> | ||
1 | 2 | ||
3 | Now that the cortex-a15 is under CONFIG_TCG, use as default CPU for a | ||
4 | KVM-only build the 'max' cpu. | ||
5 | |||
6 | Note that we cannot use 'host' here because the qtests can run without | ||
7 | any other accelerator (than qtest) and 'host' depends on KVM being | ||
8 | enabled. | ||
9 | |||
10 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
11 | Acked-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/arm/virt.c | 4 ++++ | ||
16 | 1 file changed, 4 insertions(+) | ||
17 | |||
18 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/arm/virt.c | ||
21 | +++ b/hw/arm/virt.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data) | ||
23 | mc->minimum_page_bits = 12; | ||
24 | mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; | ||
25 | mc->cpu_index_to_instance_props = virt_cpu_index_to_props; | ||
26 | +#ifdef CONFIG_TCG | ||
27 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); | ||
28 | +#else | ||
29 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("max"); | ||
30 | +#endif | ||
31 | mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; | ||
32 | mc->kvm_type = virt_kvm_type; | ||
33 | assert(!mc->get_hotplug_handler); | ||
34 | -- | ||
35 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Fabiano Rosas <farosas@suse.de> | ||
1 | 2 | ||
3 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Acked-by: Thomas Huth <thuth@redhat.com> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | tests/qtest/arm-cpu-features.c | 28 ++++++++++++++++++---------- | ||
9 | 1 file changed, 18 insertions(+), 10 deletions(-) | ||
10 | |||
11 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tests/qtest/arm-cpu-features.c | ||
14 | +++ b/tests/qtest/arm-cpu-features.c | ||
15 | @@ -XXX,XX +XXX,XX @@ | ||
16 | #define SVE_MAX_VQ 16 | ||
17 | |||
18 | #define MACHINE "-machine virt,gic-version=max -accel tcg " | ||
19 | -#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg " | ||
20 | +#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm " | ||
21 | #define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \ | ||
22 | " 'arguments': { 'type': 'full', " | ||
23 | #define QUERY_TAIL "}}" | ||
24 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) | ||
25 | { | ||
26 | g_test_init(&argc, &argv, NULL); | ||
27 | |||
28 | - qtest_add_data_func("/arm/query-cpu-model-expansion", | ||
29 | - NULL, test_query_cpu_model_expansion); | ||
30 | + if (qtest_has_accel("tcg")) { | ||
31 | + qtest_add_data_func("/arm/query-cpu-model-expansion", | ||
32 | + NULL, test_query_cpu_model_expansion); | ||
33 | + } | ||
34 | + | ||
35 | + if (!g_str_equal(qtest_get_arch(), "aarch64")) { | ||
36 | + goto out; | ||
37 | + } | ||
38 | |||
39 | /* | ||
40 | * For now we only run KVM specific tests with AArch64 QEMU in | ||
41 | * order avoid attempting to run an AArch32 QEMU with KVM on | ||
42 | * AArch64 hosts. That won't work and isn't easy to detect. | ||
43 | */ | ||
44 | - if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) { | ||
45 | + if (qtest_has_accel("kvm")) { | ||
46 | /* | ||
47 | * This tests target the 'host' CPU type, so register it only if | ||
48 | * KVM is available. | ||
49 | */ | ||
50 | qtest_add_data_func("/arm/kvm/query-cpu-model-expansion", | ||
51 | NULL, test_query_cpu_model_expansion_kvm); | ||
52 | - } | ||
53 | |||
54 | - if (g_str_equal(qtest_get_arch(), "aarch64")) { | ||
55 | - qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8", | ||
56 | - NULL, sve_tests_sve_max_vq_8); | ||
57 | - qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off", | ||
58 | - NULL, sve_tests_sve_off); | ||
59 | qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off", | ||
60 | NULL, sve_tests_sve_off_kvm); | ||
61 | } | ||
62 | |||
63 | + if (qtest_has_accel("tcg")) { | ||
64 | + qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8", | ||
65 | + NULL, sve_tests_sve_max_vq_8); | ||
66 | + qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off", | ||
67 | + NULL, sve_tests_sve_off); | ||
68 | + } | ||
69 | + | ||
70 | +out: | ||
71 | return g_test_run(); | ||
72 | } | ||
73 | -- | ||
74 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Fabiano Rosas <farosas@suse.de> | ||
1 | 2 | ||
3 | These tests set -accel tcg, so restrict them to when TCG is present. | ||
4 | |||
5 | Signed-off-by: Fabiano Rosas <farosas@suse.de> | ||
6 | Acked-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | tests/qtest/meson.build | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tests/qtest/meson.build | ||
16 | +++ b/tests/qtest/meson.build | ||
17 | @@ -XXX,XX +XXX,XX @@ qtests_arm = \ | ||
18 | # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional | ||
19 | qtests_aarch64 = \ | ||
20 | (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \ | ||
21 | - (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \ | ||
22 | - (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \ | ||
23 | + (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \ | ||
24 | + ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ | ||
25 | (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ | ||
26 | (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ | ||
27 | ['arm-cpu-features', | ||
28 | -- | ||
29 | 2.34.1 | diff view generated by jsdifflib |