1 | Last lot of target-arm changes to squeeze in before rc1: | 1 | The following changes since commit 003ba52a8b327180e284630b289c6ece5a3e08b9: |
---|---|---|---|
2 | * various minor Arm bug fixes | ||
3 | * David Carlier's Haiku build portability fixes | ||
4 | * Wentong Wu's fixes for icount handling in the nios2 target | ||
5 | 2 | ||
6 | The following changes since commit 00ce6c36b35e0eb8cc5d68a28f288a6335848813: | 3 | Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-02-16 11:16:39 +0000) |
7 | |||
8 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-07-13' into staging (2020-07-13 13:01:30 +0100) | ||
9 | 4 | ||
10 | are available in the Git repository at: | 5 | are available in the Git repository at: |
11 | 6 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200713 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230216 |
13 | 8 | ||
14 | for you to fetch changes up to 756f739b1682bf131994ec96dad7fbdf8b54493a: | 9 | for you to fetch changes up to caf01d6a435d9f4a95aeae2f9fc6cb8b889b1fb8: |
15 | 10 | ||
16 | hw/arm/aspeed: Do not create and attach empty SD cards by default (2020-07-13 14:36:12 +0100) | 11 | tests/qtest: Restrict tpm-tis-devices-{swtpm}-test to CONFIG_TCG (2023-02-16 16:28:53 +0000) |
17 | 12 | ||
18 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
19 | target-arm queue: | 14 | target-arm queue: |
20 | * hw/arm/bcm2836: Remove unused 'cpu_type' field | 15 | * Some mostly M-profile-related code cleanups |
21 | * target/arm: Fix mtedesc for do_mem_zpz | 16 | * avocado: Retire the boot_linux.py AArch64 TCG tests |
22 | * Add the ability to change the FEC PHY MDIO device number on i.MX25/i.MX6/i.MX7 | 17 | * hw/arm/smmuv3: Add GBPA register |
23 | * target/arm: Don't do raw writes for PMINTENCLR | 18 | * arm/virt: don't try to spell out the accelerator |
24 | * virtio-iommu: Fix coverity issue in virtio_iommu_handle_command() | 19 | * hw/arm: Attach PSPI module to NPCM7XX SoC |
25 | * build: Fix various issues with building on Haiku | 20 | * Some cleanup/refactoring patches aiming towards |
26 | * target/nios2: fix wrctl behaviour when using icount | 21 | allowing building Arm targets without CONFIG_TCG |
27 | * hw/arm/tosa: Encapsulate misc GPIO handling in a device | ||
28 | * hw/arm/palm.c: Encapsulate misc GPIO handling in a device | ||
29 | * hw/arm/aspeed: Do not create and attach empty SD cards by default | ||
30 | 22 | ||
31 | ---------------------------------------------------------------- | 23 | ---------------------------------------------------------------- |
32 | Aaron Lindsay (1): | 24 | Alex Bennée (1): |
33 | target/arm: Don't do raw writes for PMINTENCLR | 25 | tests/avocado: retire the Aarch64 TCG tests from boot_linux.py |
34 | 26 | ||
35 | David CARLIER (8): | 27 | Claudio Fontana (3): |
36 | build: Enable BSD symbols for Haiku | 28 | target/arm: rename handle_semihosting to tcg_handle_semihosting |
37 | util/qemu-openpty.c: Don't assume pty.h is glibc-only | 29 | target/arm: wrap psci call with tcg_enabled |
38 | build: Check that mlockall() exists | 30 | target/arm: wrap call to aarch64_sve_change_el in tcg_enabled() |
39 | osdep.h: Always include <sys/signal.h> if it exists | ||
40 | osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL | ||
41 | bswap.h: Include <endian.h> on Haiku for bswap operations | ||
42 | util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD | ||
43 | util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku | ||
44 | 31 | ||
45 | Eric Auger (1): | 32 | Cornelia Huck (1): |
46 | virtio-iommu: Fix coverity issue in virtio_iommu_handle_command() | 33 | arm/virt: don't try to spell out the accelerator |
47 | 34 | ||
48 | Gerd Hoffmann (1): | 35 | Fabiano Rosas (7): |
49 | util/drm: make portable by avoiding struct dirent d_type | 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 | ||
50 | 43 | ||
51 | Jean-Christophe Dubois (3): | 44 | Hao Wu (3): |
52 | Add the ability to change the FEC PHY MDIO device number on i.MX25 processor | 45 | MAINTAINERS: Add myself to maintainers and remove Havard |
53 | Add the ability to change the FEC PHY MDIO device number on i.MX6 processor | 46 | hw/ssi: Add Nuvoton PSPI Module |
54 | Add the ability to change the FEC PHY MDIO devices numbers on i.MX7 processor | 47 | hw/arm: Attach PSPI module to NPCM7XX SoC |
55 | 48 | ||
56 | Peter Maydell (4): | 49 | Jean-Philippe Brucker (2): |
57 | hw/arm/tosa.c: Detabify | 50 | hw/arm/smmu-common: Support 64-bit addresses |
58 | hw/arm/tosa: Encapsulate misc GPIO handling in a device | 51 | hw/arm/smmu-common: Fix TTB1 handling |
59 | hw/arm/palm.c: Detabify | ||
60 | hw/arm/palm.c: Encapsulate misc GPIO handling in a device | ||
61 | 52 | ||
62 | Philippe Mathieu-Daudé (2): | 53 | Mostafa Saleh (1): |
63 | hw/arm/bcm2836: Remove unused 'cpu_type' field | 54 | hw/arm/smmuv3: Add GBPA register |
64 | hw/arm/aspeed: Do not create and attach empty SD cards by default | ||
65 | 55 | ||
66 | Richard Henderson (1): | 56 | Philippe Mathieu-Daudé (12): |
67 | target/arm: Fix mtedesc for do_mem_zpz | 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 | ||
68 | 69 | ||
69 | Wentong Wu (4): | 70 | MAINTAINERS | 8 +- |
70 | target/nios2: add DISAS_NORETURN case for nothing more to generate | 71 | docs/system/arm/nuvoton.rst | 2 +- |
71 | target/nios2: in line the semantics of DISAS_UPDATE with other targets | 72 | hw/arm/smmuv3-internal.h | 7 + |
72 | target/nios2: Use gen_io_start around wrctl instruction | 73 | include/hw/arm/npcm7xx.h | 2 + |
73 | hw/nios2: exit to main CPU loop only when unmasking interrupts | 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 | ||
74 | 107 | ||
75 | configure | 38 ++++++++++++- | ||
76 | include/hw/arm/bcm2836.h | 1 - | ||
77 | include/hw/arm/fsl-imx25.h | 1 + | ||
78 | include/hw/arm/fsl-imx6.h | 1 + | ||
79 | include/hw/arm/fsl-imx7.h | 1 + | ||
80 | include/qemu/bswap.h | 2 + | ||
81 | include/qemu/osdep.h | 6 +- | ||
82 | hw/arm/aspeed.c | 9 +-- | ||
83 | hw/arm/fsl-imx25.c | 7 +++ | ||
84 | hw/arm/fsl-imx6.c | 7 +++ | ||
85 | hw/arm/fsl-imx7.c | 9 +++ | ||
86 | hw/arm/palm.c | 111 +++++++++++++++++++++++++------------ | ||
87 | hw/arm/tosa.c | 132 +++++++++++++++++++++++++++++--------------- | ||
88 | hw/nios2/cpu_pic.c | 3 +- | ||
89 | hw/virtio/virtio-iommu.c | 1 + | ||
90 | hw/xen/xen-legacy-backend.c | 1 - | ||
91 | os-posix.c | 4 ++ | ||
92 | target/arm/helper.c | 4 +- | ||
93 | target/arm/translate-sve.c | 2 +- | ||
94 | target/nios2/translate.c | 12 +++- | ||
95 | util/compatfd.c | 2 + | ||
96 | util/drm.c | 19 +++++-- | ||
97 | util/oslib-posix.c | 20 ++++++- | ||
98 | util/qemu-openpty.c | 2 +- | ||
99 | 24 files changed, 292 insertions(+), 103 deletions(-) | ||
100 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Since added in commit 2bea128c3d, each SDHCI is wired with a SD | 3 | Manually convert to OBJECT_DECLARE_SIMPLE_TYPE() macro, |
4 | card, using empty card when no block drive provided. This is not | 4 | similarly to automatic conversion from commit 8063396bf3 |
5 | the desired behavior. The SDHCI exposes a SD bus to plug cards | 5 | ("Use OBJECT_DECLARE_SIMPLE_TYPE when possible"). |
6 | on, if no card available, it is fine to have an unplugged bus. | ||
7 | 6 | ||
8 | Avoid creating unnecessary SD card device when no block drive | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | provided. | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | 9 | Message-id: 20230206223502.25122-2-philmd@linaro.org | |
11 | Fixes: 2bea128c3d ("hw/sd/aspeed_sdhci: New device") | ||
12 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20200705173402.15620-1-f4bug@amsat.org | ||
14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 11 | --- |
17 | hw/arm/aspeed.c | 9 +++++---- | 12 | include/hw/intc/armv7m_nvic.h | 5 +---- |
18 | 1 file changed, 5 insertions(+), 4 deletions(-) | 13 | 1 file changed, 1 insertion(+), 4 deletions(-) |
19 | 14 | ||
20 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 15 | diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h |
21 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/aspeed.c | 17 | --- a/include/hw/intc/armv7m_nvic.h |
23 | +++ b/hw/arm/aspeed.c | 18 | +++ b/include/hw/intc/armv7m_nvic.h |
24 | @@ -XXX,XX +XXX,XX @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo) | 19 | @@ -XXX,XX +XXX,XX @@ |
25 | { | 20 | #include "qom/object.h" |
26 | DeviceState *card; | 21 | |
27 | 22 | #define TYPE_NVIC "armv7m_nvic" | |
28 | - card = qdev_new(TYPE_SD_CARD); | 23 | - |
29 | - if (dinfo) { | 24 | -typedef struct NVICState NVICState; |
30 | - qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), | 25 | -DECLARE_INSTANCE_CHECKER(NVICState, NVIC, |
31 | - &error_fatal); | 26 | - TYPE_NVIC) |
32 | + if (!dinfo) { | 27 | +OBJECT_DECLARE_SIMPLE_TYPE(NVICState, NVIC) |
33 | + return; | 28 | |
34 | } | 29 | /* Highest permitted number of exceptions (architectural limit) */ |
35 | + card = qdev_new(TYPE_SD_CARD); | 30 | #define NVIC_MAX_VECTORS 512 |
36 | + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo), | ||
37 | + &error_fatal); | ||
38 | qdev_realize_and_unref(card, | ||
39 | qdev_get_child_bus(DEVICE(sdhci), "sd-bus"), | ||
40 | &error_fatal); | ||
41 | -- | 31 | -- |
42 | 2.20.1 | 32 | 2.34.1 |
43 | 33 | ||
44 | 34 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add DISAS_NORETURN case for nothing more to generate because at runtime | 3 | Suggested-by: Richard Henderson <richard.henderson@linaro.org> |
4 | execution will never return from some helper call. And at the same time | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | replace DISAS_UPDATE in t_gen_helper_raise_exception and gen_exception | ||
6 | with the newly added DISAS_NORETURN. | ||
7 | |||
8 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | ||
9 | Message-id: 20200710233433.19729-1-wentong.wu@intel.com | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20230206223502.25122-3-philmd@linaro.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 8 | --- |
13 | target/nios2/translate.c | 5 +++-- | 9 | target/arm/m_helper.c | 11 ++++++++--- |
14 | 1 file changed, 3 insertions(+), 2 deletions(-) | 10 | 1 file changed, 8 insertions(+), 3 deletions(-) |
15 | 11 | ||
16 | diff --git a/target/nios2/translate.c b/target/nios2/translate.c | 12 | diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/nios2/translate.c | 14 | --- a/target/arm/m_helper.c |
19 | +++ b/target/nios2/translate.c | 15 | +++ b/target/arm/m_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ static void t_gen_helper_raise_exception(DisasContext *dc, | 16 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op) |
21 | tcg_gen_movi_tl(dc->cpu_R[R_PC], dc->pc); | 17 | return 0; |
22 | gen_helper_raise_exception(dc->cpu_env, tmp); | ||
23 | tcg_temp_free_i32(tmp); | ||
24 | - dc->is_jmp = DISAS_UPDATE; | ||
25 | + dc->is_jmp = DISAS_NORETURN; | ||
26 | } | 18 | } |
27 | 19 | ||
28 | static bool use_goto_tb(DisasContext *dc, uint32_t dest) | 20 | -#else |
29 | @@ -XXX,XX +XXX,XX @@ static void gen_exception(DisasContext *dc, uint32_t excp) | 21 | +ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) |
30 | tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); | 22 | +{ |
31 | gen_helper_raise_exception(cpu_env, tmp); | 23 | + return ARMMMUIdx_MUser; |
32 | tcg_temp_free_i32(tmp); | 24 | +} |
33 | - dc->is_jmp = DISAS_UPDATE; | 25 | + |
34 | + dc->is_jmp = DISAS_NORETURN; | 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; | ||
35 | } | 32 | } |
36 | 33 | ||
37 | /* generate intermediate code for basic block 'tb'. */ | 34 | -#endif /* !CONFIG_USER_ONLY */ |
38 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) | 35 | - |
39 | tcg_gen_exit_tb(NULL, 0); | 36 | ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, |
40 | break; | 37 | bool secstate, bool priv, bool negpri) |
41 | 38 | { | |
42 | + case DISAS_NORETURN: | 39 | @@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) |
43 | case DISAS_TB_JUMP: | 40 | |
44 | /* nothing more to generate */ | 41 | return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv); |
45 | break; | 42 | } |
43 | + | ||
44 | +#endif /* !CONFIG_USER_ONLY */ | ||
46 | -- | 45 | -- |
47 | 2.20.1 | 46 | 2.34.1 |
48 | 47 | ||
49 | 48 | diff view generated by jsdifflib |
1 | Replace the free-floating set of IRQs and palmte_onoff_gpios() | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | function with a simple QOM device that encapsulates this | ||
3 | behaviour. | ||
4 | 2 | ||
5 | This fixes Coverity issue CID 1421944, which points out that | 3 | arm_v7m_mmu_idx_all() and arm_v7m_mmu_idx_for_secstate_and_priv() |
6 | the memory returned by qemu_allocate_irqs() is leaked. | 4 | are only used for system emulation in m_helper.c. |
5 | Move the definitions to avoid prototype forward declarations. | ||
7 | 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 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Li Qiang <liq3ea@gmail.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20200628214230.2592-3-peter.maydell@linaro.org | ||
12 | --- | 11 | --- |
13 | hw/arm/palm.c | 61 +++++++++++++++++++++++++++++++++++++++++++-------- | 12 | target/arm/internals.h | 14 -------- |
14 | 1 file changed, 52 insertions(+), 9 deletions(-) | 13 | target/arm/m_helper.c | 74 +++++++++++++++++++++--------------------- |
14 | 2 files changed, 37 insertions(+), 51 deletions(-) | ||
15 | 15 | ||
16 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | 16 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/palm.c | 18 | --- a/target/arm/internals.h |
19 | +++ b/hw/arm/palm.c | 19 | +++ b/target/arm/internals.h |
20 | @@ -XXX,XX +XXX,XX @@ static void palmte_button_event(void *opaque, int keycode) | 20 | @@ -XXX,XX +XXX,XX @@ static inline ARMMMUIdx core_to_aa64_mmu_idx(int mmu_idx) |
21 | !(keycode & 0x80)); | 21 | |
22 | } | 22 | int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx); |
23 | 23 | ||
24 | +/* | 24 | -/* |
25 | + * Encapsulation of some GPIO line behaviour for the Palm board | 25 | - * Return the MMU index for a v7M CPU with all relevant information |
26 | + * | 26 | - * manually specified. |
27 | + * QEMU interface: | 27 | - */ |
28 | + * + unnamed GPIO inputs 0..6: for the various miscellaneous input lines | 28 | -ARMMMUIdx arm_v7m_mmu_idx_all(CPUARMState *env, |
29 | + */ | 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; | ||
30 | + | 53 | + |
31 | +#define TYPE_PALM_MISC_GPIO "palm-misc-gpio" | 54 | + if (priv) { |
32 | +#define PALM_MISC_GPIO(obj) \ | 55 | + mmu_idx |= ARM_MMU_IDX_M_PRIV; |
33 | + OBJECT_CHECK(PalmMiscGPIOState, (obj), TYPE_PALM_MISC_GPIO) | 56 | + } |
34 | + | 57 | + |
35 | +typedef struct PalmMiscGPIOState { | 58 | + if (negpri) { |
36 | + SysBusDevice parent_obj; | 59 | + mmu_idx |= ARM_MMU_IDX_M_NEGPRI; |
37 | +} PalmMiscGPIOState; | 60 | + } |
38 | + | 61 | + |
39 | static void palmte_onoff_gpios(void *opaque, int line, int level) | 62 | + if (secstate) { |
40 | { | 63 | + mmu_idx |= ARM_MMU_IDX_M_S; |
41 | switch (line) { | 64 | + } |
42 | @@ -XXX,XX +XXX,XX @@ static void palmte_onoff_gpios(void *opaque, int line, int level) | ||
43 | } | ||
44 | } | ||
45 | |||
46 | +static void palm_misc_gpio_init(Object *obj) | ||
47 | +{ | ||
48 | + DeviceState *dev = DEVICE(obj); | ||
49 | + | 65 | + |
50 | + qdev_init_gpio_in(dev, palmte_onoff_gpios, 7); | 66 | + return mmu_idx; |
51 | +} | 67 | +} |
52 | + | 68 | + |
53 | +static const TypeInfo palm_misc_gpio_info = { | 69 | +static ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, |
54 | + .name = TYPE_PALM_MISC_GPIO, | 70 | + bool secstate, bool priv) |
55 | + .parent = TYPE_SYS_BUS_DEVICE, | 71 | +{ |
56 | + .instance_size = sizeof(PalmMiscGPIOState), | 72 | + bool negpri = armv7m_nvic_neg_prio_requested(env->nvic, secstate); |
57 | + .instance_init = palm_misc_gpio_init, | ||
58 | + /* | ||
59 | + * No class init required: device has no internal state so does not | ||
60 | + * need to set up reset or vmstate, and has no realize method. | ||
61 | + */ | ||
62 | +}; | ||
63 | + | 73 | + |
64 | static void palmte_gpio_setup(struct omap_mpu_state_s *cpu) | 74 | + return arm_v7m_mmu_idx_all(env, secstate, priv, negpri); |
65 | { | ||
66 | - qemu_irq *misc_gpio; | ||
67 | + DeviceState *misc_gpio; | ||
68 | + | ||
69 | + misc_gpio = sysbus_create_simple(TYPE_PALM_MISC_GPIO, -1, NULL); | ||
70 | |||
71 | omap_mmc_handlers(cpu->mmc, | ||
72 | qdev_get_gpio_in(cpu->gpio, PALMTE_MMC_WP_GPIO), | ||
73 | qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio) | ||
74 | [PALMTE_MMC_SWITCH_GPIO])); | ||
75 | |||
76 | - misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7); | ||
77 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); | ||
78 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); | ||
79 | - qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]); | ||
80 | - qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]); | ||
81 | - qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]); | ||
82 | - omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); | ||
83 | - omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); | ||
84 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, | ||
85 | + qdev_get_gpio_in(misc_gpio, 0)); | ||
86 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, | ||
87 | + qdev_get_gpio_in(misc_gpio, 1)); | ||
88 | + qdev_connect_gpio_out(cpu->gpio, 11, qdev_get_gpio_in(misc_gpio, 2)); | ||
89 | + qdev_connect_gpio_out(cpu->gpio, 12, qdev_get_gpio_in(misc_gpio, 3)); | ||
90 | + qdev_connect_gpio_out(cpu->gpio, 13, qdev_get_gpio_in(misc_gpio, 4)); | ||
91 | + omap_mpuio_out_set(cpu->mpuio, 1, qdev_get_gpio_in(misc_gpio, 5)); | ||
92 | + omap_mpuio_out_set(cpu->mpuio, 3, qdev_get_gpio_in(misc_gpio, 6)); | ||
93 | |||
94 | /* Reset some inputs to initial state. */ | ||
95 | qemu_irq_lower(qdev_get_gpio_in(cpu->gpio, PALMTE_USBDETECT_GPIO)); | ||
96 | @@ -XXX,XX +XXX,XX @@ static void palmte_machine_init(MachineClass *mc) | ||
97 | } | ||
98 | |||
99 | DEFINE_MACHINE("cheetah", palmte_machine_init) | ||
100 | + | ||
101 | +static void palm_register_types(void) | ||
102 | +{ | ||
103 | + type_register_static(&palm_misc_gpio_info); | ||
104 | +} | 75 | +} |
105 | + | 76 | + |
106 | +type_init(palm_register_types) | 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 */ | ||
107 | -- | 131 | -- |
108 | 2.20.1 | 132 | 2.34.1 |
109 | 133 | ||
110 | 134 | diff view generated by jsdifflib |
1 | Currently we have a free-floating set of IRQs and a function | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | tosa_out_switch() which handle the GPIO lines on the tosa board which | ||
3 | connect to LEDs, and another free-floating IRQ and tosa_reset() | ||
4 | function to handle the GPIO line that resets the system. Encapsulate | ||
5 | this behaviour in a simple QOM device. | ||
6 | 2 | ||
7 | This commit fixes Coverity issue CID 1421929 (which pointed out that | 3 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | the 'outsignals' in tosa_gpio_setup() were leaked), because it | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | removes the use of the qemu_allocate_irqs() API from this code | 5 | Message-id: 20230206223502.25122-5-philmd@linaro.org |
10 | entirely. | 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(-) | ||
11 | 10 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20200628203748.14250-3-peter.maydell@linaro.org | ||
15 | --- | ||
16 | hw/arm/tosa.c | 88 +++++++++++++++++++++++++++++++++++++-------------- | ||
17 | 1 file changed, 64 insertions(+), 24 deletions(-) | ||
18 | |||
19 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/arm/tosa.c | 13 | --- a/target/arm/helper.c |
22 | +++ b/hw/arm/tosa.c | 14 | +++ b/target/arm/helper.c |
23 | @@ -XXX,XX +XXX,XX @@ static void tosa_microdrive_attach(PXA2xxState *cpu) | 15 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) |
24 | pxa2xx_pcmcia_attach(cpu->pcmcia[0], md); | ||
25 | } | ||
26 | |||
27 | -static void tosa_out_switch(void *opaque, int line, int level) | ||
28 | +/* | ||
29 | + * Encapsulation of some GPIO line behaviour for the Tosa board | ||
30 | + * | ||
31 | + * QEMU interface: | ||
32 | + * + named GPIO inputs "leds[0..3]": assert to light LEDs | ||
33 | + * + named GPIO input "reset": when asserted, resets the system | ||
34 | + */ | ||
35 | + | ||
36 | +#define TYPE_TOSA_MISC_GPIO "tosa-misc-gpio" | ||
37 | +#define TOSA_MISC_GPIO(obj) \ | ||
38 | + OBJECT_CHECK(TosaMiscGPIOState, (obj), TYPE_TOSA_MISC_GPIO) | ||
39 | + | ||
40 | +typedef struct TosaMiscGPIOState { | ||
41 | + SysBusDevice parent_obj; | ||
42 | +} TosaMiscGPIOState; | ||
43 | + | ||
44 | +static void tosa_gpio_leds(void *opaque, int line, int level) | ||
45 | { | ||
46 | switch (line) { | ||
47 | - case 0: | ||
48 | - fprintf(stderr, "blue LED %s.\n", level ? "on" : "off"); | ||
49 | - break; | ||
50 | - case 1: | ||
51 | - fprintf(stderr, "green LED %s.\n", level ? "on" : "off"); | ||
52 | - break; | ||
53 | - case 2: | ||
54 | - fprintf(stderr, "amber LED %s.\n", level ? "on" : "off"); | ||
55 | - break; | ||
56 | - case 3: | ||
57 | - fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off"); | ||
58 | - break; | ||
59 | - default: | ||
60 | - fprintf(stderr, "Uhandled out event: %d = %d\n", line, level); | ||
61 | - break; | ||
62 | + case 0: | ||
63 | + fprintf(stderr, "blue LED %s.\n", level ? "on" : "off"); | ||
64 | + break; | ||
65 | + case 1: | ||
66 | + fprintf(stderr, "green LED %s.\n", level ? "on" : "off"); | ||
67 | + break; | ||
68 | + case 2: | ||
69 | + fprintf(stderr, "amber LED %s.\n", level ? "on" : "off"); | ||
70 | + break; | ||
71 | + case 3: | ||
72 | + fprintf(stderr, "wlan LED %s.\n", level ? "on" : "off"); | ||
73 | + break; | ||
74 | + default: | ||
75 | + g_assert_not_reached(); | ||
76 | } | 16 | } |
77 | } | 17 | } |
78 | 18 | ||
79 | @@ -XXX,XX +XXX,XX @@ static void tosa_reset(void *opaque, int line, int level) | 19 | +#ifndef CONFIG_USER_ONLY |
80 | } | 20 | /* |
21 | * We don't know until after realize whether there's a GICv3 | ||
22 | * attached, and that is what registers the gicv3 sysregs. | ||
23 | @@ -XXX,XX +XXX,XX @@ static uint64_t id_pfr1_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
24 | return pfr1; | ||
81 | } | 25 | } |
82 | 26 | ||
83 | +static void tosa_misc_gpio_init(Object *obj) | 27 | -#ifndef CONFIG_USER_ONLY |
84 | +{ | 28 | static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) |
85 | + DeviceState *dev = DEVICE(obj); | ||
86 | + | ||
87 | + qdev_init_gpio_in_named(dev, tosa_gpio_leds, "leds", 4); | ||
88 | + qdev_init_gpio_in_named(dev, tosa_reset, "reset", 1); | ||
89 | +} | ||
90 | + | ||
91 | static void tosa_gpio_setup(PXA2xxState *cpu, | ||
92 | DeviceState *scp0, | ||
93 | DeviceState *scp1, | ||
94 | TC6393xbState *tmio) | ||
95 | { | 29 | { |
96 | - qemu_irq *outsignals = qemu_allocate_irqs(tosa_out_switch, cpu, 4); | 30 | ARMCPU *cpu = env_archcpu(env); |
97 | - qemu_irq reset; | 31 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) |
98 | + DeviceState *misc_gpio; | 32 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 1, |
99 | + | 33 | .access = PL1_R, .type = ARM_CP_NO_RAW, |
100 | + misc_gpio = sysbus_create_simple(TYPE_TOSA_MISC_GPIO, -1, NULL); | 34 | .accessfn = access_aa32_tid3, |
101 | 35 | +#ifdef CONFIG_USER_ONLY | |
102 | /* MMC/SD host */ | 36 | + .type = ARM_CP_CONST, |
103 | pxa2xx_mmci_handlers(cpu->mmc, | 37 | + .resetvalue = cpu->isar.id_pfr1, |
104 | @@ -XXX,XX +XXX,XX @@ static void tosa_gpio_setup(PXA2xxState *cpu, | 38 | +#else |
105 | qemu_irq_invert(qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_nSD_DETECT))); | 39 | + .type = ARM_CP_NO_RAW, |
106 | 40 | + .accessfn = access_aa32_tid3, | |
107 | /* Handle reset */ | 41 | .readfn = id_pfr1_read, |
108 | - reset = qemu_allocate_irq(tosa_reset, cpu, 0); | 42 | - .writefn = arm_cp_write_ignore }, |
109 | - qdev_connect_gpio_out(cpu->gpio, TOSA_GPIO_ON_RESET, reset); | 43 | + .writefn = arm_cp_write_ignore |
110 | + qdev_connect_gpio_out(cpu->gpio, TOSA_GPIO_ON_RESET, | 44 | +#endif |
111 | + qdev_get_gpio_in_named(misc_gpio, "reset", 0)); | 45 | + }, |
112 | 46 | { .name = "ID_DFR0", .state = ARM_CP_STATE_BOTH, | |
113 | /* PCMCIA signals: card's IRQ and Card-Detect */ | 47 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 1, .opc2 = 2, |
114 | pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0], | 48 | .access = PL1_R, .type = ARM_CP_CONST, |
115 | @@ -XXX,XX +XXX,XX @@ static void tosa_gpio_setup(PXA2xxState *cpu, | ||
116 | qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_JC_CF_IRQ), | ||
117 | NULL); | ||
118 | |||
119 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_BT_LED, outsignals[0]); | ||
120 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_NOTE_LED, outsignals[1]); | ||
121 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_CHRG_ERR_LED, outsignals[2]); | ||
122 | - qdev_connect_gpio_out(scp1, TOSA_GPIO_WLAN_LED, outsignals[3]); | ||
123 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_BT_LED, | ||
124 | + qdev_get_gpio_in_named(misc_gpio, "leds", 0)); | ||
125 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_NOTE_LED, | ||
126 | + qdev_get_gpio_in_named(misc_gpio, "leds", 1)); | ||
127 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_CHRG_ERR_LED, | ||
128 | + qdev_get_gpio_in_named(misc_gpio, "leds", 2)); | ||
129 | + qdev_connect_gpio_out(scp1, TOSA_GPIO_WLAN_LED, | ||
130 | + qdev_get_gpio_in_named(misc_gpio, "leds", 3)); | ||
131 | |||
132 | qdev_connect_gpio_out(scp1, TOSA_GPIO_TC6393XB_L3V_ON, tc6393xb_l3v_get(tmio)); | ||
133 | |||
134 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo tosa_ssp_info = { | ||
135 | .class_init = tosa_ssp_class_init, | ||
136 | }; | ||
137 | |||
138 | +static const TypeInfo tosa_misc_gpio_info = { | ||
139 | + .name = "tosa-misc-gpio", | ||
140 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
141 | + .instance_size = sizeof(TosaMiscGPIOState), | ||
142 | + .instance_init = tosa_misc_gpio_init, | ||
143 | + /* | ||
144 | + * No class init required: device has no internal state so does not | ||
145 | + * need to set up reset or vmstate, and has no realize method. | ||
146 | + */ | ||
147 | +}; | ||
148 | + | ||
149 | static void tosa_register_types(void) | ||
150 | { | ||
151 | type_register_static(&tosa_dac_info); | ||
152 | type_register_static(&tosa_ssp_info); | ||
153 | + type_register_static(&tosa_misc_gpio_info); | ||
154 | } | ||
155 | |||
156 | type_init(tosa_register_types) | ||
157 | -- | 49 | -- |
158 | 2.20.1 | 50 | 2.34.1 |
159 | 51 | ||
160 | 52 | diff view generated by jsdifflib |
1 | Remove the hardcoded tabs from hw/arm/tosa.c. There aren't | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | many, but since they're all in constant #defines they're not | ||
3 | going to go away with our usual "only when we touch a function" | ||
4 | policy on reformatting. | ||
5 | 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 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20200628203748.14250-2-peter.maydell@linaro.org | ||
9 | --- | 8 | --- |
10 | hw/arm/tosa.c | 44 ++++++++++++++++++++++---------------------- | 9 | linux-user/user-internals.h | 2 +- |
11 | 1 file changed, 22 insertions(+), 22 deletions(-) | 10 | target/arm/cpu.h | 2 +- |
11 | linux-user/arm/cpu_loop.c | 4 ++-- | ||
12 | 3 files changed, 4 insertions(+), 4 deletions(-) | ||
12 | 13 | ||
13 | diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c | 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/hw/arm/tosa.c | 16 | --- a/linux-user/user-internals.h |
16 | +++ b/hw/arm/tosa.c | 17 | +++ b/linux-user/user-internals.h |
17 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ void print_termios(void *arg); |
18 | #include "hw/sysbus.h" | 19 | #ifdef TARGET_ARM |
19 | #include "exec/address-spaces.h" | 20 | static inline int regpairs_aligned(CPUArchState *cpu_env, int num) |
20 | |||
21 | -#define TOSA_RAM 0x04000000 | ||
22 | -#define TOSA_ROM 0x00800000 | ||
23 | +#define TOSA_RAM 0x04000000 | ||
24 | +#define TOSA_ROM 0x00800000 | ||
25 | |||
26 | -#define TOSA_GPIO_USB_IN (5) | ||
27 | -#define TOSA_GPIO_nSD_DETECT (9) | ||
28 | -#define TOSA_GPIO_ON_RESET (19) | ||
29 | -#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ | ||
30 | -#define TOSA_GPIO_CF_CD (13) | ||
31 | -#define TOSA_GPIO_TC6393XB_INT (15) | ||
32 | -#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ | ||
33 | +#define TOSA_GPIO_USB_IN (5) | ||
34 | +#define TOSA_GPIO_nSD_DETECT (9) | ||
35 | +#define TOSA_GPIO_ON_RESET (19) | ||
36 | +#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ | ||
37 | +#define TOSA_GPIO_CF_CD (13) | ||
38 | +#define TOSA_GPIO_TC6393XB_INT (15) | ||
39 | +#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ | ||
40 | |||
41 | -#define TOSA_SCOOP_GPIO_BASE 1 | ||
42 | -#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) | ||
43 | -#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3) | ||
44 | -#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4) | ||
45 | +#define TOSA_SCOOP_GPIO_BASE 1 | ||
46 | +#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) | ||
47 | +#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3) | ||
48 | +#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4) | ||
49 | |||
50 | -#define TOSA_SCOOP_JC_GPIO_BASE 1 | ||
51 | -#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0) | ||
52 | -#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) | ||
53 | -#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) | ||
54 | -#define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5) | ||
55 | -#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7) | ||
56 | +#define TOSA_SCOOP_JC_GPIO_BASE 1 | ||
57 | +#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0) | ||
58 | +#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) | ||
59 | +#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) | ||
60 | +#define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5) | ||
61 | +#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7) | ||
62 | |||
63 | -#define DAC_BASE 0x4e | ||
64 | -#define DAC_CH1 0 | ||
65 | -#define DAC_CH2 1 | ||
66 | +#define DAC_BASE 0x4e | ||
67 | +#define DAC_CH1 0 | ||
68 | +#define DAC_CH2 1 | ||
69 | |||
70 | static void tosa_microdrive_attach(PXA2xxState *cpu) | ||
71 | { | 21 | { |
22 | - return cpu_env->eabi == 1; | ||
23 | + return cpu_env->eabi; | ||
24 | } | ||
25 | #elif defined(TARGET_MIPS) && defined(TARGET_ABI_MIPSO32) | ||
26 | static inline int regpairs_aligned(CPUArchState *cpu_env, int num) { return 1; } | ||
27 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/target/arm/cpu.h | ||
30 | +++ b/target/arm/cpu.h | ||
31 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { | ||
32 | |||
33 | #if defined(CONFIG_USER_ONLY) | ||
34 | /* For usermode syscall translation. */ | ||
35 | - int eabi; | ||
36 | + bool eabi; | ||
37 | #endif | ||
38 | |||
39 | struct CPUBreakpoint *cpu_breakpoint[16]; | ||
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 | } | ||
61 | |||
72 | -- | 62 | -- |
73 | 2.20.1 | 63 | 2.34.1 |
74 | 64 | ||
75 | 65 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Regularize our handling of <sys/signal.h>: currently we include it in | 3 | Although the 'eabi' field is only used in user emulation where |
4 | osdep.h, but only for OpenBSD, and we include it without an ifdef | 4 | CPU reset doesn't occur, it doesn't belong to the area to reset. |
5 | guard in a couple of C files. This causes problems for Haiku, which | 5 | Move it after the 'end_reset_fields' for consistency. |
6 | doesn't have that header. | ||
7 | 6 | ||
8 | Instead, check in configure whether sys/signal.h exists, and if it | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | does then always include it from osdep.h. | 8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | 9 | Message-id: 20230206223502.25122-7-philmd@linaro.org | |
11 | Signed-off-by: David Carlier <devnexen@gmail.com> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Message-id: 20200703145614.16684-5-peter.maydell@linaro.org | ||
17 | [PMM: Expanded commit message; rename to HAVE_SYS_SIGNAL_H] | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 11 | --- |
21 | configure | 10 ++++++++++ | 12 | target/arm/cpu.h | 9 ++++----- |
22 | include/qemu/osdep.h | 2 +- | 13 | 1 file changed, 4 insertions(+), 5 deletions(-) |
23 | hw/xen/xen-legacy-backend.c | 1 - | ||
24 | util/oslib-posix.c | 1 - | ||
25 | 4 files changed, 11 insertions(+), 3 deletions(-) | ||
26 | 14 | ||
27 | diff --git a/configure b/configure | 15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
28 | index XXXXXXX..XXXXXXX 100755 | ||
29 | --- a/configure | ||
30 | +++ b/configure | ||
31 | @@ -XXX,XX +XXX,XX @@ if check_include "libdrm/drm.h" ; then | ||
32 | have_drm_h=yes | ||
33 | fi | ||
34 | |||
35 | +######################################### | ||
36 | +# sys/signal.h check | ||
37 | +have_sys_signal_h=no | ||
38 | +if check_include "sys/signal.h" ; then | ||
39 | + have_sys_signal_h=yes | ||
40 | +fi | ||
41 | + | ||
42 | ########################################## | ||
43 | # VTE probe | ||
44 | |||
45 | @@ -XXX,XX +XXX,XX @@ fi | ||
46 | if test "$have_openpty" = "yes" ; then | ||
47 | echo "HAVE_OPENPTY=y" >> $config_host_mak | ||
48 | fi | ||
49 | +if test "$have_sys_signal_h" = "yes" ; then | ||
50 | + echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak | ||
51 | +fi | ||
52 | |||
53 | # Work around a system header bug with some kernel/XFS header | ||
54 | # versions where they both try to define 'struct fsxattr': | ||
55 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
56 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
57 | --- a/include/qemu/osdep.h | 17 | --- a/target/arm/cpu.h |
58 | +++ b/include/qemu/osdep.h | 18 | +++ b/target/arm/cpu.h |
59 | @@ -XXX,XX +XXX,XX @@ extern int daemon(int, int); | 19 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
60 | #include <setjmp.h> | 20 | ARMVectorReg zarray[ARM_MAX_VQ * 16]; |
61 | #include <signal.h> | ||
62 | |||
63 | -#ifdef __OpenBSD__ | ||
64 | +#ifdef HAVE_SYS_SIGNAL_H | ||
65 | #include <sys/signal.h> | ||
66 | #endif | 21 | #endif |
67 | 22 | ||
68 | diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c | 23 | -#if defined(CONFIG_USER_ONLY) |
69 | index XXXXXXX..XXXXXXX 100644 | 24 | - /* For usermode syscall translation. */ |
70 | --- a/hw/xen/xen-legacy-backend.c | 25 | - bool eabi; |
71 | +++ b/hw/xen/xen-legacy-backend.c | 26 | -#endif |
72 | @@ -XXX,XX +XXX,XX @@ | 27 | - |
73 | */ | 28 | struct CPUBreakpoint *cpu_breakpoint[16]; |
74 | 29 | struct CPUWatchpoint *cpu_watchpoint[16]; | |
75 | #include "qemu/osdep.h" | 30 | |
76 | -#include <sys/signal.h> | 31 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
77 | 32 | const struct arm_boot_info *boot_info; | |
78 | #include "hw/sysbus.h" | 33 | /* Store GICv3CPUState to access from this struct */ |
79 | #include "hw/boards.h" | 34 | void *gicv3state; |
80 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 35 | +#if defined(CONFIG_USER_ONLY) |
81 | index XXXXXXX..XXXXXXX 100644 | 36 | + /* For usermode syscall translation. */ |
82 | --- a/util/oslib-posix.c | 37 | + bool eabi; |
83 | +++ b/util/oslib-posix.c | 38 | +#endif /* CONFIG_USER_ONLY */ |
84 | @@ -XXX,XX +XXX,XX @@ | 39 | |
85 | #include "qemu/sockets.h" | 40 | #ifdef TARGET_TAGGED_ADDRESSES |
86 | #include "qemu/thread.h" | 41 | /* Linux syscall tagged address support */ |
87 | #include <libgen.h> | ||
88 | -#include <sys/signal.h> | ||
89 | #include "qemu/cutils.h" | ||
90 | |||
91 | #ifdef CONFIG_LINUX | ||
92 | -- | 42 | -- |
93 | 2.20.1 | 43 | 2.34.1 |
94 | 44 | ||
95 | 45 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Only when guest code is unmasking interrupts, terminate the excution | 3 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
4 | of translated code and exit to the main CPU loop to handle previous | 4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | pended interrupts because of the interrupts mask by guest code. | 5 | Message-id: 20230206223502.25122-8-philmd@linaro.org |
6 | |||
7 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | ||
8 | Message-id: 20200710233433.19729-4-wentong.wu@intel.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | hw/nios2/cpu_pic.c | 3 ++- | 8 | target/arm/cpu.h | 3 ++- |
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | 9 | 1 file changed, 2 insertions(+), 1 deletion(-) |
14 | 10 | ||
15 | diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c | 11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/nios2/cpu_pic.c | 13 | --- a/target/arm/cpu.h |
18 | +++ b/hw/nios2/cpu_pic.c | 14 | +++ b/target/arm/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ static void nios2_pic_cpu_handler(void *opaque, int irq, int level) | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
20 | 16 | ||
21 | void nios2_check_interrupts(CPUNios2State *env) | 17 | void *nvic; |
22 | { | 18 | const struct arm_boot_info *boot_info; |
23 | - if (env->irq_pending) { | 19 | +#if !defined(CONFIG_USER_ONLY) |
24 | + if (env->irq_pending && | 20 | /* Store GICv3CPUState to access from this struct */ |
25 | + (env->regs[CR_STATUS] & CR_STATUS_PIE)) { | 21 | void *gicv3state; |
26 | env->irq_pending = 0; | 22 | -#if defined(CONFIG_USER_ONLY) |
27 | cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD); | 23 | +#else /* CONFIG_USER_ONLY */ |
28 | } | 24 | /* For usermode syscall translation. */ |
25 | bool eabi; | ||
26 | #endif /* CONFIG_USER_ONLY */ | ||
29 | -- | 27 | -- |
30 | 2.20.1 | 28 | 2.34.1 |
31 | 29 | ||
32 | 30 | diff view generated by jsdifflib |
1 | From: Wentong Wu <wentong.wu@intel.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | In line the semantics of DISAS_UPDATE on nios2 target with other targets | ||
4 | which is to explicitly write the PC back into the cpu state before doing | ||
5 | a tcg_gen_exit_tb(). | ||
6 | |||
7 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | ||
8 | Message-id: 20200710233433.19729-2-wentong.wu@intel.com | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
4 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
5 | Message-id: 20230206223502.25122-9-philmd@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | target/nios2/translate.c | 2 +- | 8 | target/arm/cpu.h | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 10 | ||
15 | diff --git a/target/nios2/translate.c b/target/nios2/translate.c | 11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/nios2/translate.c | 13 | --- a/target/arm/cpu.h |
18 | +++ b/target/nios2/translate.c | 14 | +++ b/target/arm/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
20 | /* Indicate where the next block should start */ | 16 | } sau; |
21 | switch (dc->is_jmp) { | 17 | |
22 | case DISAS_NEXT: | 18 | void *nvic; |
23 | + case DISAS_UPDATE: | 19 | - const struct arm_boot_info *boot_info; |
24 | /* Save the current PC back into the CPU register */ | 20 | #if !defined(CONFIG_USER_ONLY) |
25 | tcg_gen_movi_tl(cpu_R[R_PC], dc->pc); | 21 | + const struct arm_boot_info *boot_info; |
26 | tcg_gen_exit_tb(NULL, 0); | 22 | /* Store GICv3CPUState to access from this struct */ |
27 | @@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns) | 23 | void *gicv3state; |
28 | 24 | #else /* CONFIG_USER_ONLY */ | |
29 | default: | ||
30 | case DISAS_JUMP: | ||
31 | - case DISAS_UPDATE: | ||
32 | /* The jump will already have updated the PC register */ | ||
33 | tcg_gen_exit_tb(NULL, 0); | ||
34 | break; | ||
35 | -- | 25 | -- |
36 | 2.20.1 | 26 | 2.34.1 |
37 | 27 | ||
38 | 28 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The mtedesc that was constructed was not actually passed in. | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | Found by Coverity (CID 1429996). | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | 5 | Message-id: 20230206223502.25122-10-philmd@linaro.org | |
6 | Fixes: d28d12f008e | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20200706202345.193676-1-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 7 | --- |
12 | target/arm/translate-sve.c | 2 +- | 8 | target/arm/cpu.h | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 10 | ||
15 | diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c | 11 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/translate-sve.c | 13 | --- a/target/arm/cpu.h |
18 | +++ b/target/arm/translate-sve.c | 14 | +++ b/target/arm/cpu.h |
19 | @@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, | 15 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState { |
20 | desc = FIELD_DP32(desc, MTEDESC, ESIZE, 1 << msz); | 16 | uint32_t ctrl; |
21 | desc <<= SVE_MTEDESC_SHIFT; | 17 | } sau; |
22 | } | 18 | |
23 | - desc = simd_desc(vsz, vsz, scale); | 19 | - void *nvic; |
24 | + desc = simd_desc(vsz, vsz, desc | scale); | 20 | #if !defined(CONFIG_USER_ONLY) |
25 | t_desc = tcg_const_i32(desc); | 21 | + void *nvic; |
26 | 22 | const struct arm_boot_info *boot_info; | |
27 | tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); | 23 | /* Store GICv3CPUState to access from this struct */ |
24 | void *gicv3state; | ||
28 | -- | 25 | -- |
29 | 2.20.1 | 26 | 2.34.1 |
30 | 27 | ||
31 | 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 |
1 | From: Wentong Wu <wentong.wu@intel.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | wrctl instruction on nios2 target will cause checking cpu | 3 | While dozens of files include "cpu.h", only 3 files require |
4 | interrupt but tcg_handle_interrupt() will call cpu_abort() | 4 | these NVIC helper declarations. |
5 | if the CPU gets an interrupt while it's not in 'can do IO' | 5 | |
6 | state, so add gen_io_start around wrctl instruction. Also | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | at the same time, end the onging TB with DISAS_UPDATE. | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | 8 | Message-id: 20230206223502.25122-12-philmd@linaro.org | |
9 | Signed-off-by: Wentong Wu <wentong.wu@intel.com> | ||
10 | Message-id: 20200710233433.19729-3-wentong.wu@intel.com | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 10 | --- |
14 | target/nios2/translate.c | 5 +++++ | 11 | include/hw/intc/armv7m_nvic.h | 123 ++++++++++++++++++++++++++++++++++ |
15 | 1 file changed, 5 insertions(+) | 12 | target/arm/cpu.h | 123 ---------------------------------- |
16 | 13 | target/arm/cpu.c | 4 +- | |
17 | diff --git a/target/nios2/translate.c b/target/nios2/translate.c | 14 | target/arm/cpu_tcg.c | 3 + |
18 | index XXXXXXX..XXXXXXX 100644 | 15 | target/arm/m_helper.c | 3 + |
19 | --- a/target/nios2/translate.c | 16 | 5 files changed, 132 insertions(+), 124 deletions(-) |
20 | +++ b/target/nios2/translate.c | 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 | ||
21 | @@ -XXX,XX +XXX,XX @@ | 318 | @@ -XXX,XX +XXX,XX @@ |
22 | #include "exec/cpu_ldst.h" | 319 | #include "exec/cpu_ldst.h" |
23 | #include "exec/translator.h" | 320 | #include "semihosting/common-semi.h" |
24 | #include "qemu/qemu-print.h" | ||
25 | +#include "exec/gen-icount.h" | ||
26 | |||
27 | /* is_jmp field values */ | ||
28 | #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ | ||
29 | @@ -XXX,XX +XXX,XX @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags) | ||
30 | /* If interrupts were enabled using WRCTL, trigger them. */ | ||
31 | #if !defined(CONFIG_USER_ONLY) | ||
32 | if ((instr.imm5 + CR_BASE) == CR_STATUS) { | ||
33 | + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) { | ||
34 | + gen_io_start(); | ||
35 | + } | ||
36 | gen_helper_check_interrupts(dc->cpu_env); | ||
37 | + dc->is_jmp = DISAS_UPDATE; | ||
38 | } | ||
39 | #endif | 321 | #endif |
40 | } | 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) | ||
41 | -- | 328 | -- |
42 | 2.20.1 | 329 | 2.34.1 |
43 | 330 | ||
44 | 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 |
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | 1 | From: Mostafa Saleh <smostafa@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | 3 | GBPA register can be used to globally abort all |
4 | Message-id: c850187322be9930e47c8b234c385a7d0da245cb.1593806826.git.jcd@tribudubois.net | 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 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 25 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | [PMM: updated for object_property_set_uint() argument reordering] | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 27 | --- |
9 | include/hw/arm/fsl-imx7.h | 1 + | 28 | hw/arm/smmuv3-internal.h | 7 +++++++ |
10 | hw/arm/fsl-imx7.c | 9 +++++++++ | 29 | include/hw/arm/smmuv3.h | 1 + |
11 | 2 files changed, 10 insertions(+) | 30 | hw/arm/smmuv3.c | 43 +++++++++++++++++++++++++++++++++++++++- |
31 | 3 files changed, 50 insertions(+), 1 deletion(-) | ||
12 | 32 | ||
13 | diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h | 33 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
14 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/fsl-imx7.h | 35 | --- a/hw/arm/smmuv3-internal.h |
16 | +++ b/include/hw/arm/fsl-imx7.h | 36 | +++ b/hw/arm/smmuv3-internal.h |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX7State { | 37 | @@ -XXX,XX +XXX,XX @@ REG32(CR0ACK, 0x24) |
18 | IMX7GPRState gpr; | 38 | REG32(CR1, 0x28) |
19 | ChipideaState usb[FSL_IMX7_NUM_USBS]; | 39 | REG32(CR2, 0x2c) |
20 | DesignwarePCIEHost pcie; | 40 | REG32(STATUSR, 0x40) |
21 | + uint32_t phy_num[FSL_IMX7_NUM_ETHS]; | 41 | +REG32(GBPA, 0x44) |
22 | } FslIMX7State; | 42 | + FIELD(GBPA, ABORT, 20, 1) |
23 | 43 | + FIELD(GBPA, UPDATE, 31, 1) | |
24 | enum FslIMX7MemoryMap { | 44 | + |
25 | diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c | 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 | ||
26 | index XXXXXXX..XXXXXXX 100644 | 52 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/hw/arm/fsl-imx7.c | 53 | --- a/include/hw/arm/smmuv3.h |
28 | +++ b/hw/arm/fsl-imx7.c | 54 | +++ b/include/hw/arm/smmuv3.h |
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | 55 | @@ -XXX,XX +XXX,XX @@ struct SMMUv3State { |
30 | FSL_IMX7_ENET2_ADDR, | 56 | uint32_t cr[3]; |
31 | }; | 57 | uint32_t cr0ack; |
32 | 58 | uint32_t statusr; | |
33 | + object_property_set_uint(OBJECT(&s->eth[i]), "phy-num", | 59 | + uint32_t gbpa; |
34 | + s->phy_num[i], &error_abort); | 60 | uint32_t irq_ctrl; |
35 | object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", | 61 | uint32_t gerror; |
36 | FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort); | 62 | uint32_t gerrorn; |
37 | qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); | 63 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c |
38 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) | 64 | index XXXXXXX..XXXXXXX 100644 |
39 | FSL_IMX7_PCIE_PHY_SIZE); | 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; | ||
40 | } | 72 | } |
41 | 73 | ||
42 | +static Property fsl_imx7_properties[] = { | 74 | static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr, STE *buf, |
43 | + DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0), | 75 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, |
44 | + DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1), | 76 | qemu_mutex_lock(&s->mutex); |
45 | + DEFINE_PROP_END_OF_LIST(), | 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 | + } | ||
46 | +}; | 136 | +}; |
47 | + | 137 | + |
48 | static void fsl_imx7_class_init(ObjectClass *oc, void *data) | 138 | static const VMStateDescription vmstate_smmuv3 = { |
49 | { | 139 | .name = "smmuv3", |
50 | DeviceClass *dc = DEVICE_CLASS(oc); | 140 | .version_id = 1, |
51 | 141 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_smmuv3 = { | |
52 | + device_class_set_props(dc, fsl_imx7_properties); | 142 | |
53 | dc->realize = fsl_imx7_realize; | 143 | VMSTATE_END_OF_LIST(), |
54 | 144 | }, | |
55 | /* Reason: Uses serial_hds and nd_table in realize() directly */ | 145 | + .subsections = (const VMStateDescription * []) { |
146 | + &vmstate_gbpa, | ||
147 | + NULL | ||
148 | + } | ||
149 | }; | ||
150 | |||
151 | static void smmuv3_instance_init(Object *obj) | ||
56 | -- | 152 | -- |
57 | 2.20.1 | 153 | 2.34.1 |
58 | |||
59 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Coverity points out (CID 1430180) that the new case is missing | 3 | Since commit acc0b8b05a when running the ZynqMP ZCU102 board with |
4 | break or a /* fallthrough */ comment. Break is the right thing to | 4 | a QEMU configured using --without-default-devices, we get: |
5 | do as in that case, tail is not used. | ||
6 | 5 | ||
7 | Fixes 1733eebb9e ("virtio-iommu: Implement RESV_MEM probe request") | 6 | $ qemu-system-aarch64 -M xlnx-zcu102 |
8 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 7 | qemu-system-aarch64: missing object type 'usb_dwc3' |
9 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Abort trap: 6 |
10 | Message-id: 20200708160147.18426-1-eric.auger@redhat.com | 9 | |
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 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> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 17 | --- |
14 | hw/virtio/virtio-iommu.c | 1 + | 18 | hw/arm/Kconfig | 1 + |
15 | 1 file changed, 1 insertion(+) | 19 | 1 file changed, 1 insertion(+) |
16 | 20 | ||
17 | diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c | 21 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
18 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/virtio/virtio-iommu.c | 23 | --- a/hw/arm/Kconfig |
20 | +++ b/hw/virtio/virtio-iommu.c | 24 | +++ b/hw/arm/Kconfig |
21 | @@ -XXX,XX +XXX,XX @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq) | 25 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM |
22 | ptail = (struct virtio_iommu_req_tail *) | 26 | select XLNX_CSU_DMA |
23 | (buf + s->config.probe_size); | 27 | select XLNX_ZYNQMP |
24 | ptail->status = virtio_iommu_handle_probe(s, iov, iov_cnt, buf); | 28 | select XLNX_ZDMA |
25 | + break; | 29 | + select USB_DWC3 |
26 | } | 30 | |
27 | default: | 31 | config XLNX_VERSAL |
28 | tail.status = VIRTIO_IOMMU_S_UNSUPP; | 32 | bool |
29 | -- | 33 | -- |
30 | 2.20.1 | 34 | 2.34.1 |
31 | 35 | ||
32 | 36 | diff view generated by jsdifflib |
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | 1 | From: Cornelia Huck <cohuck@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | 3 | Just use current_accel_name() directly. |
4 | Message-id: 9f8923ecd974160ae8f634c275b1100c2cbe66d7.1593806826.git.jcd@tribudubois.net | 4 | |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Cornelia Huck <cohuck@redhat.com> |
6 | [PMM: updated for object_property_set_uint() argument reordering] | 6 | Reviewed-by: Eric Auger <eric.auger@redhat.com> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 9 | --- |
9 | include/hw/arm/fsl-imx25.h | 1 + | 10 | hw/arm/virt.c | 6 +++--- |
10 | hw/arm/fsl-imx25.c | 7 +++++++ | 11 | 1 file changed, 3 insertions(+), 3 deletions(-) |
11 | 2 files changed, 8 insertions(+) | ||
12 | 12 | ||
13 | diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h | 13 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
14 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/fsl-imx25.h | 15 | --- a/hw/arm/virt.c |
16 | +++ b/include/hw/arm/fsl-imx25.h | 16 | +++ b/hw/arm/virt.c |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX25State { | 17 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) |
18 | MemoryRegion rom[2]; | 18 | if (vms->secure && (kvm_enabled() || hvf_enabled())) { |
19 | MemoryRegion iram; | 19 | error_report("mach-virt: %s does not support providing " |
20 | MemoryRegion iram_alias; | 20 | "Security extensions (TrustZone) to the guest CPU", |
21 | + uint32_t phy_num; | 21 | - kvm_enabled() ? "KVM" : "HVF"); |
22 | } FslIMX25State; | 22 | + current_accel_name()); |
23 | 23 | exit(1); | |
24 | /** | ||
25 | diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/fsl-imx25.c | ||
28 | +++ b/hw/arm/fsl-imx25.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) | ||
30 | epit_table[i].irq)); | ||
31 | } | 24 | } |
32 | 25 | ||
33 | + object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &err); | 26 | if (vms->virt && (kvm_enabled() || hvf_enabled())) { |
34 | qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]); | 27 | error_report("mach-virt: %s does not support providing " |
35 | 28 | "Virtualization extensions to the guest CPU", | |
36 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) { | 29 | - kvm_enabled() ? "KVM" : "HVF"); |
37 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) | 30 | + current_accel_name()); |
38 | &s->iram_alias); | 31 | exit(1); |
39 | } | 32 | } |
40 | 33 | ||
41 | +static Property fsl_imx25_properties[] = { | 34 | if (vms->mte && (kvm_enabled() || hvf_enabled())) { |
42 | + DEFINE_PROP_UINT32("fec-phy-num", FslIMX25State, phy_num, 0), | 35 | error_report("mach-virt: %s does not support providing " |
43 | + DEFINE_PROP_END_OF_LIST(), | 36 | "MTE to the guest CPU", |
44 | +}; | 37 | - kvm_enabled() ? "KVM" : "HVF"); |
45 | + | 38 | + current_accel_name()); |
46 | static void fsl_imx25_class_init(ObjectClass *oc, void *data) | 39 | exit(1); |
47 | { | 40 | } |
48 | DeviceClass *dc = DEVICE_CLASS(oc); | 41 | |
49 | |||
50 | + device_class_set_props(dc, fsl_imx25_properties); | ||
51 | dc->realize = fsl_imx25_realize; | ||
52 | dc->desc = "i.MX25 SOC"; | ||
53 | /* | ||
54 | -- | 42 | -- |
55 | 2.20.1 | 43 | 2.34.1 |
56 | |||
57 | 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 | From: Gerd Hoffmann <kraxel@redhat.com> | 1 | From: Hao Wu <wuhaotsh@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Given this isn't perforance critical at all lets avoid the non-portable | 3 | Nuvoton's PSPI is a general purpose SPI module which enables |
4 | d_type and use fstat instead to check whenever the file is a chardev. | 4 | connections to SPI-based peripheral devices. |
5 | 5 | ||
6 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
7 | Reported-by: David Carlier <devnexen@gmail.com> | 7 | Reviewed-by: Chris Rauer <crauer@google.com> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Reviewed-by: Philippe Mathieu-Daude <philmd@linaro.org> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Message-id: 20230208235433.3989937-3-wuhaotsh@google.com |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Message-id: 20200703145614.16684-10-peter.maydell@linaro.org | ||
12 | Message-id: 20200701180302.14821-1-kraxel@redhat.com | ||
13 | [PMM: fixed comment style; tweaked subject line] | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 11 | --- |
17 | util/drm.c | 19 ++++++++++++++----- | 12 | MAINTAINERS | 6 +- |
18 | 1 file changed, 14 insertions(+), 5 deletions(-) | 13 | include/hw/ssi/npcm_pspi.h | 53 +++++++++ |
14 | hw/ssi/npcm_pspi.c | 221 +++++++++++++++++++++++++++++++++++++ | ||
15 | hw/ssi/meson.build | 2 +- | ||
16 | hw/ssi/trace-events | 5 + | ||
17 | 5 files changed, 283 insertions(+), 4 deletions(-) | ||
18 | create mode 100644 include/hw/ssi/npcm_pspi.h | ||
19 | create mode 100644 hw/ssi/npcm_pspi.c | ||
19 | 20 | ||
20 | diff --git a/util/drm.c b/util/drm.c | 21 | diff --git a/MAINTAINERS b/MAINTAINERS |
21 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/util/drm.c | 23 | --- a/MAINTAINERS |
23 | +++ b/util/drm.c | 24 | +++ b/MAINTAINERS |
24 | @@ -XXX,XX +XXX,XX @@ int qemu_drm_rendernode_open(const char *rendernode) | 25 | @@ -XXX,XX +XXX,XX @@ M: Tyrone Ting <kfting@nuvoton.com> |
25 | { | 26 | M: Hao Wu <wuhaotsh@google.com> |
26 | DIR *dir; | 27 | L: qemu-arm@nongnu.org |
27 | struct dirent *e; | 28 | S: Supported |
28 | - int r, fd; | 29 | -F: hw/*/npcm7xx* |
29 | + struct stat st; | 30 | -F: include/hw/*/npcm7xx* |
30 | + int r, fd, ret; | 31 | -F: tests/qtest/npcm7xx* |
31 | char *p; | 32 | +F: hw/*/npcm* |
32 | 33 | +F: include/hw/*/npcm* | |
33 | if (rendernode) { | 34 | +F: tests/qtest/npcm* |
34 | @@ -XXX,XX +XXX,XX @@ int qemu_drm_rendernode_open(const char *rendernode) | 35 | F: pc-bios/npcm7xx_bootrom.bin |
35 | 36 | F: roms/vbootrom | |
36 | fd = -1; | 37 | F: docs/system/arm/nuvoton.rst |
37 | while ((e = readdir(dir))) { | 38 | diff --git a/include/hw/ssi/npcm_pspi.h b/include/hw/ssi/npcm_pspi.h |
38 | - if (e->d_type != DT_CHR) { | 39 | new file mode 100644 |
39 | - continue; | 40 | index XXXXXXX..XXXXXXX |
40 | - } | 41 | --- /dev/null |
41 | - | 42 | +++ b/include/hw/ssi/npcm_pspi.h |
42 | if (strncmp(e->d_name, "renderD", 7)) { | 43 | @@ -XXX,XX +XXX,XX @@ |
43 | continue; | 44 | +/* |
44 | } | 45 | + * Nuvoton Peripheral SPI Module |
45 | @@ -XXX,XX +XXX,XX @@ int qemu_drm_rendernode_open(const char *rendernode) | 46 | + * |
46 | g_free(p); | 47 | + * Copyright 2023 Google LLC |
47 | continue; | 48 | + * |
48 | } | 49 | + * This program is free software; you can redistribute it and/or modify it |
49 | + | 50 | + * under the terms of the GNU General Public License as published by the |
50 | + /* | 51 | + * Free Software Foundation; either version 2 of the License, or |
51 | + * prefer fstat() over checking e->d_type == DT_CHR for | 52 | + * (at your option) any later version. |
52 | + * portability reasons | 53 | + * |
53 | + */ | 54 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
54 | + ret = fstat(r, &st); | 55 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
55 | + if (ret < 0 || (st.st_mode & S_IFMT) != S_IFCHR) { | 56 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
56 | + close(r); | 57 | + * for more details. |
57 | + g_free(p); | 58 | + */ |
58 | + continue; | 59 | +#ifndef NPCM_PSPI_H |
60 | +#define NPCM_PSPI_H | ||
61 | + | ||
62 | +#include "hw/ssi/ssi.h" | ||
63 | +#include "hw/sysbus.h" | ||
64 | + | ||
65 | +/* | ||
66 | + * Number of registers in our device state structure. Don't change this without | ||
67 | + * incrementing the version_id in the vmstate. | ||
68 | + */ | ||
69 | +#define NPCM_PSPI_NR_REGS 3 | ||
70 | + | ||
71 | +/** | ||
72 | + * NPCMPSPIState - Device state for one Flash Interface Unit. | ||
73 | + * @parent: System bus device. | ||
74 | + * @mmio: Memory region for register access. | ||
75 | + * @spi: The SPI bus mastered by this controller. | ||
76 | + * @regs: Register contents. | ||
77 | + * @irq: The interrupt request queue for this module. | ||
78 | + * | ||
79 | + * Each PSPI has a shared bank of registers, and controls up to four chip | ||
80 | + * selects. Each chip select has a dedicated memory region which may be used to | ||
81 | + * read and write the flash connected to that chip select as if it were memory. | ||
82 | + */ | ||
83 | +typedef struct NPCMPSPIState { | ||
84 | + SysBusDevice parent; | ||
85 | + | ||
86 | + MemoryRegion mmio; | ||
87 | + | ||
88 | + SSIBus *spi; | ||
89 | + uint16_t regs[NPCM_PSPI_NR_REGS]; | ||
90 | + qemu_irq irq; | ||
91 | +} NPCMPSPIState; | ||
92 | + | ||
93 | +#define TYPE_NPCM_PSPI "npcm-pspi" | ||
94 | +OBJECT_DECLARE_SIMPLE_TYPE(NPCMPSPIState, NPCM_PSPI) | ||
95 | + | ||
96 | +#endif /* NPCM_PSPI_H */ | ||
97 | diff --git a/hw/ssi/npcm_pspi.c b/hw/ssi/npcm_pspi.c | ||
98 | new file mode 100644 | ||
99 | index XXXXXXX..XXXXXXX | ||
100 | --- /dev/null | ||
101 | +++ b/hw/ssi/npcm_pspi.c | ||
102 | @@ -XXX,XX +XXX,XX @@ | ||
103 | +/* | ||
104 | + * Nuvoton NPCM Peripheral SPI Module (PSPI) | ||
105 | + * | ||
106 | + * Copyright 2023 Google LLC | ||
107 | + * | ||
108 | + * This program is free software; you can redistribute it and/or modify it | ||
109 | + * under the terms of the GNU General Public License as published by the | ||
110 | + * Free Software Foundation; either version 2 of the License, or | ||
111 | + * (at your option) any later version. | ||
112 | + * | ||
113 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
114 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
115 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
116 | + * for more details. | ||
117 | + */ | ||
118 | + | ||
119 | +#include "qemu/osdep.h" | ||
120 | + | ||
121 | +#include "hw/irq.h" | ||
122 | +#include "hw/registerfields.h" | ||
123 | +#include "hw/ssi/npcm_pspi.h" | ||
124 | +#include "migration/vmstate.h" | ||
125 | +#include "qapi/error.h" | ||
126 | +#include "qemu/error-report.h" | ||
127 | +#include "qemu/log.h" | ||
128 | +#include "qemu/module.h" | ||
129 | +#include "qemu/units.h" | ||
130 | + | ||
131 | +#include "trace.h" | ||
132 | + | ||
133 | +REG16(PSPI_DATA, 0x0) | ||
134 | +REG16(PSPI_CTL1, 0x2) | ||
135 | + FIELD(PSPI_CTL1, SPIEN, 0, 1) | ||
136 | + FIELD(PSPI_CTL1, MOD, 2, 1) | ||
137 | + FIELD(PSPI_CTL1, EIR, 5, 1) | ||
138 | + FIELD(PSPI_CTL1, EIW, 6, 1) | ||
139 | + FIELD(PSPI_CTL1, SCM, 7, 1) | ||
140 | + FIELD(PSPI_CTL1, SCIDL, 8, 1) | ||
141 | + FIELD(PSPI_CTL1, SCDV, 9, 7) | ||
142 | +REG16(PSPI_STAT, 0x4) | ||
143 | + FIELD(PSPI_STAT, BSY, 0, 1) | ||
144 | + FIELD(PSPI_STAT, RBF, 1, 1) | ||
145 | + | ||
146 | +static void npcm_pspi_update_irq(NPCMPSPIState *s) | ||
147 | +{ | ||
148 | + int level = 0; | ||
149 | + | ||
150 | + /* Only fire IRQ when the module is enabled. */ | ||
151 | + if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, SPIEN)) { | ||
152 | + /* Update interrupt as BSY is cleared. */ | ||
153 | + if ((!FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, BSY)) && | ||
154 | + FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIW)) { | ||
155 | + level = 1; | ||
59 | + } | 156 | + } |
60 | + | 157 | + |
61 | fd = r; | 158 | + /* Update interrupt as RBF is set. */ |
62 | g_free(p); | 159 | + if (FIELD_EX16(s->regs[R_PSPI_STAT], PSPI_STAT, RBF) && |
63 | break; | 160 | + FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, EIR)) { |
161 | + level = 1; | ||
162 | + } | ||
163 | + } | ||
164 | + qemu_set_irq(s->irq, level); | ||
165 | +} | ||
166 | + | ||
167 | +static uint16_t npcm_pspi_read_data(NPCMPSPIState *s) | ||
168 | +{ | ||
169 | + uint16_t value = s->regs[R_PSPI_DATA]; | ||
170 | + | ||
171 | + /* Clear stat bits as the value are read out. */ | ||
172 | + s->regs[R_PSPI_STAT] = 0; | ||
173 | + | ||
174 | + return value; | ||
175 | +} | ||
176 | + | ||
177 | +static void npcm_pspi_write_data(NPCMPSPIState *s, uint16_t data) | ||
178 | +{ | ||
179 | + uint16_t value = 0; | ||
180 | + | ||
181 | + if (FIELD_EX16(s->regs[R_PSPI_CTL1], PSPI_CTL1, MOD)) { | ||
182 | + value = ssi_transfer(s->spi, extract16(data, 8, 8)) << 8; | ||
183 | + } | ||
184 | + value |= ssi_transfer(s->spi, extract16(data, 0, 8)); | ||
185 | + s->regs[R_PSPI_DATA] = value; | ||
186 | + | ||
187 | + /* Mark data as available */ | ||
188 | + s->regs[R_PSPI_STAT] = R_PSPI_STAT_BSY_MASK | R_PSPI_STAT_RBF_MASK; | ||
189 | +} | ||
190 | + | ||
191 | +/* Control register read handler. */ | ||
192 | +static uint64_t npcm_pspi_ctrl_read(void *opaque, hwaddr addr, | ||
193 | + unsigned int size) | ||
194 | +{ | ||
195 | + NPCMPSPIState *s = opaque; | ||
196 | + uint16_t value; | ||
197 | + | ||
198 | + switch (addr) { | ||
199 | + case A_PSPI_DATA: | ||
200 | + value = npcm_pspi_read_data(s); | ||
201 | + break; | ||
202 | + | ||
203 | + case A_PSPI_CTL1: | ||
204 | + value = s->regs[R_PSPI_CTL1]; | ||
205 | + break; | ||
206 | + | ||
207 | + case A_PSPI_STAT: | ||
208 | + value = s->regs[R_PSPI_STAT]; | ||
209 | + break; | ||
210 | + | ||
211 | + default: | ||
212 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
213 | + "%s: write to invalid offset 0x%" PRIx64 "\n", | ||
214 | + DEVICE(s)->canonical_path, addr); | ||
215 | + return 0; | ||
216 | + } | ||
217 | + trace_npcm_pspi_ctrl_read(DEVICE(s)->canonical_path, addr, value); | ||
218 | + npcm_pspi_update_irq(s); | ||
219 | + | ||
220 | + return value; | ||
221 | +} | ||
222 | + | ||
223 | +/* Control register write handler. */ | ||
224 | +static void npcm_pspi_ctrl_write(void *opaque, hwaddr addr, uint64_t v, | ||
225 | + unsigned int size) | ||
226 | +{ | ||
227 | + NPCMPSPIState *s = opaque; | ||
228 | + uint16_t value = v; | ||
229 | + | ||
230 | + trace_npcm_pspi_ctrl_write(DEVICE(s)->canonical_path, addr, value); | ||
231 | + | ||
232 | + switch (addr) { | ||
233 | + case A_PSPI_DATA: | ||
234 | + npcm_pspi_write_data(s, value); | ||
235 | + break; | ||
236 | + | ||
237 | + case A_PSPI_CTL1: | ||
238 | + s->regs[R_PSPI_CTL1] = value; | ||
239 | + break; | ||
240 | + | ||
241 | + case A_PSPI_STAT: | ||
242 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
243 | + "%s: write to read-only register PSPI_STAT: 0x%08" | ||
244 | + PRIx64 "\n", DEVICE(s)->canonical_path, v); | ||
245 | + break; | ||
246 | + | ||
247 | + default: | ||
248 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
249 | + "%s: write to invalid offset 0x%" PRIx64 "\n", | ||
250 | + DEVICE(s)->canonical_path, addr); | ||
251 | + return; | ||
252 | + } | ||
253 | + npcm_pspi_update_irq(s); | ||
254 | +} | ||
255 | + | ||
256 | +static const MemoryRegionOps npcm_pspi_ctrl_ops = { | ||
257 | + .read = npcm_pspi_ctrl_read, | ||
258 | + .write = npcm_pspi_ctrl_write, | ||
259 | + .endianness = DEVICE_LITTLE_ENDIAN, | ||
260 | + .valid = { | ||
261 | + .min_access_size = 1, | ||
262 | + .max_access_size = 2, | ||
263 | + .unaligned = false, | ||
264 | + }, | ||
265 | + .impl = { | ||
266 | + .min_access_size = 2, | ||
267 | + .max_access_size = 2, | ||
268 | + .unaligned = false, | ||
269 | + }, | ||
270 | +}; | ||
271 | + | ||
272 | +static void npcm_pspi_enter_reset(Object *obj, ResetType type) | ||
273 | +{ | ||
274 | + NPCMPSPIState *s = NPCM_PSPI(obj); | ||
275 | + | ||
276 | + trace_npcm_pspi_enter_reset(DEVICE(obj)->canonical_path, type); | ||
277 | + memset(s->regs, 0, sizeof(s->regs)); | ||
278 | +} | ||
279 | + | ||
280 | +static void npcm_pspi_realize(DeviceState *dev, Error **errp) | ||
281 | +{ | ||
282 | + NPCMPSPIState *s = NPCM_PSPI(dev); | ||
283 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
284 | + Object *obj = OBJECT(dev); | ||
285 | + | ||
286 | + s->spi = ssi_create_bus(dev, "pspi"); | ||
287 | + memory_region_init_io(&s->mmio, obj, &npcm_pspi_ctrl_ops, s, | ||
288 | + "mmio", 4 * KiB); | ||
289 | + sysbus_init_mmio(sbd, &s->mmio); | ||
290 | + sysbus_init_irq(sbd, &s->irq); | ||
291 | +} | ||
292 | + | ||
293 | +static const VMStateDescription vmstate_npcm_pspi = { | ||
294 | + .name = "npcm-pspi", | ||
295 | + .version_id = 0, | ||
296 | + .minimum_version_id = 0, | ||
297 | + .fields = (VMStateField[]) { | ||
298 | + VMSTATE_UINT16_ARRAY(regs, NPCMPSPIState, NPCM_PSPI_NR_REGS), | ||
299 | + VMSTATE_END_OF_LIST(), | ||
300 | + }, | ||
301 | +}; | ||
302 | + | ||
303 | + | ||
304 | +static void npcm_pspi_class_init(ObjectClass *klass, void *data) | ||
305 | +{ | ||
306 | + ResettableClass *rc = RESETTABLE_CLASS(klass); | ||
307 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
308 | + | ||
309 | + dc->desc = "NPCM Peripheral SPI Module"; | ||
310 | + dc->realize = npcm_pspi_realize; | ||
311 | + dc->vmsd = &vmstate_npcm_pspi; | ||
312 | + rc->phases.enter = npcm_pspi_enter_reset; | ||
313 | +} | ||
314 | + | ||
315 | +static const TypeInfo npcm_pspi_types[] = { | ||
316 | + { | ||
317 | + .name = TYPE_NPCM_PSPI, | ||
318 | + .parent = TYPE_SYS_BUS_DEVICE, | ||
319 | + .instance_size = sizeof(NPCMPSPIState), | ||
320 | + .class_init = npcm_pspi_class_init, | ||
321 | + }, | ||
322 | +}; | ||
323 | +DEFINE_TYPES(npcm_pspi_types); | ||
324 | diff --git a/hw/ssi/meson.build b/hw/ssi/meson.build | ||
325 | index XXXXXXX..XXXXXXX 100644 | ||
326 | --- a/hw/ssi/meson.build | ||
327 | +++ b/hw/ssi/meson.build | ||
328 | @@ -XXX,XX +XXX,XX @@ | ||
329 | softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_smc.c')) | ||
330 | softmmu_ss.add(when: 'CONFIG_MSF2', if_true: files('mss-spi.c')) | ||
331 | -softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c')) | ||
332 | +softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_fiu.c', 'npcm_pspi.c')) | ||
333 | softmmu_ss.add(when: 'CONFIG_PL022', if_true: files('pl022.c')) | ||
334 | softmmu_ss.add(when: 'CONFIG_SIFIVE_SPI', if_true: files('sifive_spi.c')) | ||
335 | softmmu_ss.add(when: 'CONFIG_SSI', if_true: files('ssi.c')) | ||
336 | diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events | ||
337 | index XXXXXXX..XXXXXXX 100644 | ||
338 | --- a/hw/ssi/trace-events | ||
339 | +++ b/hw/ssi/trace-events | ||
340 | @@ -XXX,XX +XXX,XX @@ npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset: | ||
341 | npcm7xx_fiu_flash_read(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64 | ||
342 | npcm7xx_fiu_flash_write(const char *id, unsigned cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64 | ||
343 | |||
344 | +# npcm_pspi.c | ||
345 | +npcm_pspi_enter_reset(const char *id, int reset_type) "%s reset type: %d" | ||
346 | +npcm_pspi_ctrl_read(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16 | ||
347 | +npcm_pspi_ctrl_write(const char *id, uint64_t addr, uint16_t data) "%s offset: 0x%03" PRIx64 " value: 0x%04" PRIx16 | ||
348 | + | ||
349 | # ibex_spi_host.c | ||
350 | |||
351 | ibex_spi_host_reset(const char *msg) "%s" | ||
64 | -- | 352 | -- |
65 | 2.20.1 | 353 | 2.34.1 |
66 | |||
67 | diff view generated by jsdifflib |
1 | Remove hard-tabs from palm.c. | 1 | From: Hao Wu <wuhaotsh@google.com> |
---|---|---|---|
2 | 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 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Li Qiang <liq3ea@gmail.com> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Message-id: 20200628214230.2592-2-peter.maydell@linaro.org | ||
7 | --- | 8 | --- |
8 | hw/arm/palm.c | 64 +++++++++++++++++++++++++-------------------------- | 9 | docs/system/arm/nuvoton.rst | 2 +- |
9 | 1 file changed, 32 insertions(+), 32 deletions(-) | 10 | include/hw/arm/npcm7xx.h | 2 ++ |
11 | hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++-- | ||
12 | 3 files changed, 26 insertions(+), 3 deletions(-) | ||
10 | 13 | ||
11 | diff --git a/hw/arm/palm.c b/hw/arm/palm.c | 14 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/palm.c | 16 | --- a/docs/system/arm/nuvoton.rst |
14 | +++ b/hw/arm/palm.c | 17 | +++ b/docs/system/arm/nuvoton.rst |
15 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps static_ops = { | 18 | @@ -XXX,XX +XXX,XX @@ Supported devices |
16 | /* Palm Tunsgten|E support */ | 19 | * SMBus controller (SMBF) |
17 | 20 | * Ethernet controller (EMC) | |
18 | /* Shared GPIOs */ | 21 | * Tachometer |
19 | -#define PALMTE_USBDETECT_GPIO 0 | 22 | + * Peripheral SPI controller (PSPI) |
20 | -#define PALMTE_USB_OR_DC_GPIO 1 | 23 | |
21 | -#define PALMTE_TSC_GPIO 4 | 24 | Missing devices |
22 | -#define PALMTE_PINTDAV_GPIO 6 | 25 | --------------- |
23 | -#define PALMTE_MMC_WP_GPIO 8 | 26 | @@ -XXX,XX +XXX,XX @@ Missing devices |
24 | -#define PALMTE_MMC_POWER_GPIO 9 | 27 | |
25 | -#define PALMTE_HDQ_GPIO 11 | 28 | * Ethernet controller (GMAC) |
26 | -#define PALMTE_HEADPHONES_GPIO 14 | 29 | * USB device (USBD) |
27 | -#define PALMTE_SPEAKER_GPIO 15 | 30 | - * Peripheral SPI controller (PSPI) |
28 | +#define PALMTE_USBDETECT_GPIO 0 | 31 | * SD/MMC host |
29 | +#define PALMTE_USB_OR_DC_GPIO 1 | 32 | * PECI interface |
30 | +#define PALMTE_TSC_GPIO 4 | 33 | * PCI and PCIe root complex and bridges |
31 | +#define PALMTE_PINTDAV_GPIO 6 | 34 | diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h |
32 | +#define PALMTE_MMC_WP_GPIO 8 | 35 | index XXXXXXX..XXXXXXX 100644 |
33 | +#define PALMTE_MMC_POWER_GPIO 9 | 36 | --- a/include/hw/arm/npcm7xx.h |
34 | +#define PALMTE_HDQ_GPIO 11 | 37 | +++ b/include/hw/arm/npcm7xx.h |
35 | +#define PALMTE_HEADPHONES_GPIO 14 | 38 | @@ -XXX,XX +XXX,XX @@ |
36 | +#define PALMTE_SPEAKER_GPIO 15 | 39 | #include "hw/nvram/npcm7xx_otp.h" |
37 | /* MPU private GPIOs */ | 40 | #include "hw/timer/npcm7xx_timer.h" |
38 | -#define PALMTE_DC_GPIO 2 | 41 | #include "hw/ssi/npcm7xx_fiu.h" |
39 | -#define PALMTE_MMC_SWITCH_GPIO 4 | 42 | +#include "hw/ssi/npcm_pspi.h" |
40 | -#define PALMTE_MMC1_GPIO 6 | 43 | #include "hw/usb/hcd-ehci.h" |
41 | -#define PALMTE_MMC2_GPIO 7 | 44 | #include "hw/usb/hcd-ohci.h" |
42 | -#define PALMTE_MMC3_GPIO 11 | 45 | #include "target/arm/cpu.h" |
43 | +#define PALMTE_DC_GPIO 2 | 46 | @@ -XXX,XX +XXX,XX @@ struct NPCM7xxState { |
44 | +#define PALMTE_MMC_SWITCH_GPIO 4 | 47 | NPCM7xxFIUState fiu[2]; |
45 | +#define PALMTE_MMC1_GPIO 6 | 48 | NPCM7xxEMCState emc[2]; |
46 | +#define PALMTE_MMC2_GPIO 7 | 49 | NPCM7xxSDHCIState mmc; |
47 | +#define PALMTE_MMC3_GPIO 11 | 50 | + NPCMPSPIState pspi[2]; |
48 | |||
49 | static MouseTransformInfo palmte_pointercal = { | ||
50 | .x = 320, | ||
51 | @@ -XXX,XX +XXX,XX @@ static struct { | ||
52 | int column; | ||
53 | } palmte_keymap[0x80] = { | ||
54 | [0 ... 0x7f] = { -1, -1 }, | ||
55 | - [0x3b] = { 0, 0 }, /* F1 -> Calendar */ | ||
56 | - [0x3c] = { 1, 0 }, /* F2 -> Contacts */ | ||
57 | - [0x3d] = { 2, 0 }, /* F3 -> Tasks List */ | ||
58 | - [0x3e] = { 3, 0 }, /* F4 -> Note Pad */ | ||
59 | - [0x01] = { 4, 0 }, /* Esc -> Power */ | ||
60 | - [0x4b] = { 0, 1 }, /* Left */ | ||
61 | - [0x50] = { 1, 1 }, /* Down */ | ||
62 | - [0x48] = { 2, 1 }, /* Up */ | ||
63 | - [0x4d] = { 3, 1 }, /* Right */ | ||
64 | - [0x4c] = { 4, 1 }, /* Centre */ | ||
65 | - [0x39] = { 4, 1 }, /* Spc -> Centre */ | ||
66 | + [0x3b] = { 0, 0 }, /* F1 -> Calendar */ | ||
67 | + [0x3c] = { 1, 0 }, /* F2 -> Contacts */ | ||
68 | + [0x3d] = { 2, 0 }, /* F3 -> Tasks List */ | ||
69 | + [0x3e] = { 3, 0 }, /* F4 -> Note Pad */ | ||
70 | + [0x01] = { 4, 0 }, /* Esc -> Power */ | ||
71 | + [0x4b] = { 0, 1 }, /* Left */ | ||
72 | + [0x50] = { 1, 1 }, /* Down */ | ||
73 | + [0x48] = { 2, 1 }, /* Up */ | ||
74 | + [0x4d] = { 3, 1 }, /* Right */ | ||
75 | + [0x4c] = { 4, 1 }, /* Centre */ | ||
76 | + [0x39] = { 4, 1 }, /* Spc -> Centre */ | ||
77 | }; | 51 | }; |
78 | 52 | ||
79 | static void palmte_button_event(void *opaque, int keycode) | 53 | #define TYPE_NPCM7XX "npcm7xx" |
80 | @@ -XXX,XX +XXX,XX @@ static void palmte_gpio_setup(struct omap_mpu_state_s *cpu) | 54 | diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c |
81 | [PALMTE_MMC_SWITCH_GPIO])); | 55 | index XXXXXXX..XXXXXXX 100644 |
82 | 56 | --- a/hw/arm/npcm7xx.c | |
83 | misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7); | 57 | +++ b/hw/arm/npcm7xx.c |
84 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); | 58 | @@ -XXX,XX +XXX,XX @@ enum NPCM7xxInterrupt { |
85 | - qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); | 59 | NPCM7XX_EMC1RX_IRQ = 15, |
86 | - qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]); | 60 | NPCM7XX_EMC1TX_IRQ, |
87 | - qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]); | 61 | NPCM7XX_MMC_IRQ = 26, |
88 | - qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]); | 62 | + NPCM7XX_PSPI2_IRQ = 28, |
89 | - omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); | 63 | + NPCM7XX_PSPI1_IRQ = 31, |
90 | - omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); | 64 | NPCM7XX_TIMER0_IRQ = 32, /* Timer Module 0 */ |
91 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]); | 65 | NPCM7XX_TIMER1_IRQ, |
92 | + qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]); | 66 | NPCM7XX_TIMER2_IRQ, |
93 | + qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]); | 67 | @@ -XXX,XX +XXX,XX @@ static const hwaddr npcm7xx_emc_addr[] = { |
94 | + qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]); | 68 | 0xf0826000, |
95 | + qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]); | 69 | }; |
96 | + omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]); | 70 | |
97 | + omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]); | 71 | +/* Register base address for each PSPI Module */ |
98 | 72 | +static const hwaddr npcm7xx_pspi_addr[] = { | |
99 | /* Reset some inputs to initial state. */ | 73 | + 0xf0200000, |
100 | qemu_irq_lower(qdev_get_gpio_in(cpu->gpio, PALMTE_USBDETECT_GPIO)); | 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); | ||
101 | -- | 118 | -- |
102 | 2.20.1 | 119 | 2.34.1 |
103 | |||
104 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
1 | 2 | ||
3 | Addresses targeting the second translation table (TTB1) in the SMMU have | ||
4 | all upper bits set. Ensure the IOMMU region covers all 64 bits. | ||
5 | |||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Message-id: 20230214171921.1917916-2-jean-philippe@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | include/hw/arm/smmu-common.h | 2 -- | ||
13 | hw/arm/smmu-common.c | 2 +- | ||
14 | 2 files changed, 1 insertion(+), 3 deletions(-) | ||
15 | |||
16 | diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/include/hw/arm/smmu-common.h | ||
19 | +++ b/include/hw/arm/smmu-common.h | ||
20 | @@ -XXX,XX +XXX,XX @@ | ||
21 | #define SMMU_PCI_DEVFN_MAX 256 | ||
22 | #define SMMU_PCI_DEVFN(sid) (sid & 0xFF) | ||
23 | |||
24 | -#define SMMU_MAX_VA_BITS 48 | ||
25 | - | ||
26 | /* | ||
27 | * Page table walk error types | ||
28 | */ | ||
29 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/arm/smmu-common.c | ||
32 | +++ b/hw/arm/smmu-common.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static AddressSpace *smmu_find_add_as(PCIBus *bus, void *opaque, int devfn) | ||
34 | |||
35 | memory_region_init_iommu(&sdev->iommu, sizeof(sdev->iommu), | ||
36 | s->mrtypename, | ||
37 | - OBJECT(s), name, 1ULL << SMMU_MAX_VA_BITS); | ||
38 | + OBJECT(s), name, UINT64_MAX); | ||
39 | address_space_init(&sdev->as, | ||
40 | MEMORY_REGION(&sdev->iommu), name); | ||
41 | trace_smmu_add_mr(name); | ||
42 | -- | ||
43 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
1 | 2 | ||
3 | Addresses targeting the second translation table (TTB1) in the SMMU have | ||
4 | all upper bits set (except for the top byte when TBI is enabled). Fix | ||
5 | the TTB1 check. | ||
6 | |||
7 | Reported-by: Ola Hugosson <ola.hugosson@arm.com> | ||
8 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> | ||
11 | Message-id: 20230214171921.1917916-3-jean-philippe@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/smmu-common.c | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/smmu-common.c | ||
20 | +++ b/hw/arm/smmu-common.c | ||
21 | @@ -XXX,XX +XXX,XX @@ SMMUTransTableInfo *select_tt(SMMUTransCfg *cfg, dma_addr_t iova) | ||
22 | /* there is a ttbr0 region and we are in it (high bits all zero) */ | ||
23 | return &cfg->tt[0]; | ||
24 | } else if (cfg->tt[1].tsz && | ||
25 | - !extract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte)) { | ||
26 | + sextract64(iova, 64 - cfg->tt[1].tsz, cfg->tt[1].tsz - tbi_byte) == -1) { | ||
27 | /* there is a ttbr1 region and we are in it (high bits all one) */ | ||
28 | return &cfg->tt[1]; | ||
29 | } else if (!cfg->tt[0].tsz) { | ||
30 | -- | ||
31 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Aaron Lindsay <aaron@os.amperecomputing.com> | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Raw writes to this register when in KVM mode can cause interrupts to be | 3 | make it clearer from the name that this is a tcg-only function. |
4 | raised (even when the PMU is disabled). Because the underlying state is | ||
5 | already aliased to PMINTENSET (which already provides raw write | ||
6 | functions), we can safely disable raw accesses to PMINTENCLR entirely. | ||
7 | 4 | ||
8 | Signed-off-by: Aaron Lindsay <aaron@os.amperecomputing.com> | 5 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
9 | Message-id: 20200707152616.1917154-1-aaron@os.amperecomputing.com | 6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
9 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 11 | --- |
13 | target/arm/helper.c | 4 ++-- | 12 | target/arm/helper.c | 4 ++-- |
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | 13 | 1 file changed, 2 insertions(+), 2 deletions(-) |
15 | 14 | ||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper.c | 17 | --- a/target/arm/helper.c |
19 | +++ b/target/arm/helper.c | 18 | +++ b/target/arm/helper.c |
20 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = { | 19 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) |
21 | .resetvalue = 0x0 }, | 20 | * trapped to the hypervisor in KVM. |
22 | { .name = "PMINTENCLR", .cp = 15, .crn = 9, .crm = 14, .opc1 = 0, .opc2 = 2, | 21 | */ |
23 | .access = PL1_RW, .accessfn = access_tpm, | 22 | #ifdef CONFIG_TCG |
24 | - .type = ARM_CP_ALIAS | ARM_CP_IO, | 23 | -static void handle_semihosting(CPUState *cs) |
25 | + .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | 24 | +static void tcg_handle_semihosting(CPUState *cs) |
26 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | 25 | { |
27 | .writefn = pmintenclr_write, }, | 26 | ARMCPU *cpu = ARM_CPU(cs); |
28 | { .name = "PMINTENCLR_EL1", .state = ARM_CP_STATE_AA64, | 27 | CPUARMState *env = &cpu->env; |
29 | .opc0 = 3, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 2, | 28 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs) |
30 | .access = PL1_RW, .accessfn = access_tpm, | 29 | */ |
31 | - .type = ARM_CP_ALIAS | ARM_CP_IO, | 30 | #ifdef CONFIG_TCG |
32 | + .type = ARM_CP_ALIAS | ARM_CP_IO | ARM_CP_NO_RAW, | 31 | if (cs->exception_index == EXCP_SEMIHOST) { |
33 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pminten), | 32 | - handle_semihosting(cs); |
34 | .writefn = pmintenclr_write }, | 33 | + tcg_handle_semihosting(cs); |
35 | { .name = "CCSIDR", .state = ARM_CP_STATE_BOTH, | 34 | return; |
35 | } | ||
36 | #endif | ||
36 | -- | 37 | -- |
37 | 2.20.1 | 38 | 2.34.1 |
38 | 39 | ||
39 | 40 | diff view generated by jsdifflib |
1 | From: Jean-Christophe Dubois <jcd@tribudubois.net> | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> | 3 | for "all" builds (tcg + kvm), we want to avoid doing |
4 | Message-id: 05a64e83eb1c0c865ac077b22c599425c024c02c.1593806826.git.jcd@tribudubois.net | 4 | the psci check if tcg is built-in, but not enabled. |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 5 | |
6 | [PMM: updated for object_property_set_uint() argument reordering] | 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> | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 11 | --- |
9 | include/hw/arm/fsl-imx6.h | 1 + | 12 | target/arm/helper.c | 3 ++- |
10 | hw/arm/fsl-imx6.c | 7 +++++++ | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
11 | 2 files changed, 8 insertions(+) | ||
12 | 14 | ||
13 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | 15 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/fsl-imx6.h | 17 | --- a/target/arm/helper.c |
16 | +++ b/include/hw/arm/fsl-imx6.h | 18 | +++ b/target/arm/helper.c |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State { | 19 | @@ -XXX,XX +XXX,XX @@ |
18 | MemoryRegion caam; | 20 | #include "hw/irq.h" |
19 | MemoryRegion ocram; | 21 | #include "sysemu/cpu-timers.h" |
20 | MemoryRegion ocram_alias; | 22 | #include "sysemu/kvm.h" |
21 | + uint32_t phy_num; | 23 | +#include "sysemu/tcg.h" |
22 | } FslIMX6State; | 24 | #include "qapi/qapi-commands-machine-target.h" |
23 | 25 | #include "qapi/error.h" | |
24 | 26 | #include "qemu/guest-random.h" | |
25 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | 27 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs) |
26 | index XXXXXXX..XXXXXXX 100644 | 28 | env->exception.syndrome); |
27 | --- a/hw/arm/fsl-imx6.c | ||
28 | +++ b/hw/arm/fsl-imx6.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
30 | spi_table[i].irq)); | ||
31 | } | 29 | } |
32 | 30 | ||
33 | + object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &err); | 31 | - if (arm_is_psci_call(cpu, cs->exception_index)) { |
34 | qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]); | 32 | + if (tcg_enabled() && arm_is_psci_call(cpu, cs->exception_index)) { |
35 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) { | 33 | arm_handle_psci_call(cpu); |
34 | qemu_log_mask(CPU_LOG_INT, "...handled as PSCI call\n"); | ||
36 | return; | 35 | return; |
37 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) | ||
38 | &s->ocram_alias); | ||
39 | } | ||
40 | |||
41 | +static Property fsl_imx6_properties[] = { | ||
42 | + DEFINE_PROP_UINT32("fec-phy-num", FslIMX6State, phy_num, 0), | ||
43 | + DEFINE_PROP_END_OF_LIST(), | ||
44 | +}; | ||
45 | + | ||
46 | static void fsl_imx6_class_init(ObjectClass *oc, void *data) | ||
47 | { | ||
48 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
49 | |||
50 | + device_class_set_props(dc, fsl_imx6_properties); | ||
51 | dc->realize = fsl_imx6_realize; | ||
52 | dc->desc = "i.MX6 SOC"; | ||
53 | /* Reason: Uses serial_hd() in the realize() function */ | ||
54 | -- | 36 | -- |
55 | 2.20.1 | 37 | 2.34.1 |
56 | 38 | ||
57 | 39 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Claudio Fontana <cfontana@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Instead of using an OS-specific ifdef test to select the "openpty() | 3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> |
4 | is in pty.h" codepath, make configure check for the existence of | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | the header and use the new CONFIG_PTY instead. | 5 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
6 | 6 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
7 | This is necessary to build on Haiku, which also provides openpty() | ||
8 | via pty.h. | ||
9 | |||
10 | Signed-off-by: David Carlier <devnexen@gmail.com> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Message-id: 20200703145614.16684-3-peter.maydell@linaro.org | ||
14 | [PMM: Expanded commit message; rename to HAVE_PTY_H] | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 8 | --- |
18 | configure | 9 +++++++++ | 9 | target/arm/helper.c | 12 +++++++----- |
19 | util/qemu-openpty.c | 2 +- | 10 | 1 file changed, 7 insertions(+), 5 deletions(-) |
20 | 2 files changed, 10 insertions(+), 1 deletion(-) | ||
21 | 11 | ||
22 | diff --git a/configure b/configure | 12 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
23 | index XXXXXXX..XXXXXXX 100755 | ||
24 | --- a/configure | ||
25 | +++ b/configure | ||
26 | @@ -XXX,XX +XXX,XX @@ else | ||
27 | l2tpv3=no | ||
28 | fi | ||
29 | |||
30 | +if check_include "pty.h" ; then | ||
31 | + pty_h=yes | ||
32 | +else | ||
33 | + pty_h=no | ||
34 | +fi | ||
35 | + | ||
36 | ######################################### | ||
37 | # vhost interdependencies and host support | ||
38 | |||
39 | @@ -XXX,XX +XXX,XX @@ fi | ||
40 | if test "$sheepdog" = "yes" ; then | ||
41 | echo "CONFIG_SHEEPDOG=y" >> $config_host_mak | ||
42 | fi | ||
43 | +if test "$pty_h" = "yes" ; then | ||
44 | + echo "HAVE_PTY_H=y" >> $config_host_mak | ||
45 | +fi | ||
46 | if test "$fuzzing" = "yes" ; then | ||
47 | if test "$have_fuzzer" = "yes"; then | ||
48 | FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" | ||
49 | diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
51 | --- a/util/qemu-openpty.c | 14 | --- a/target/arm/helper.c |
52 | +++ b/util/qemu-openpty.c | 15 | +++ b/target/arm/helper.c |
53 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) |
54 | #include "qemu/osdep.h" | 17 | unsigned int cur_el = arm_current_el(env); |
55 | #include "qemu-common.h" | 18 | int rt; |
56 | 19 | ||
57 | -#if defined(__GLIBC__) | 20 | - /* |
58 | +#if defined HAVE_PTY_H | 21 | - * Note that new_el can never be 0. If cur_el is 0, then |
59 | # include <pty.h> | 22 | - * el0_a64 is is_a64(), else el0_a64 is ignored. |
60 | #elif defined CONFIG_BSD | 23 | - */ |
61 | # include <termios.h> | 24 | - aarch64_sve_change_el(env, cur_el, new_el, is_a64(env)); |
25 | + if (tcg_enabled()) { | ||
26 | + /* | ||
27 | + * Note that new_el can never be 0. If cur_el is 0, then | ||
28 | + * el0_a64 is is_a64(), else el0_a64 is ignored. | ||
29 | + */ | ||
30 | + aarch64_sve_change_el(env, cur_el, new_el, is_a64(env)); | ||
31 | + } | ||
32 | |||
33 | if (cur_el < new_el) { | ||
34 | /* | ||
62 | -- | 35 | -- |
63 | 2.20.1 | 36 | 2.34.1 |
64 | 37 | ||
65 | 38 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | The qemu_init_exec_dir() function is inherently non-portable; | 3 | Move this earlier to make the next patch diff cleaner. While here |
4 | provide an implementation for Haiku hosts. | 4 | update the comment slightly to not give the impression that the |
5 | misalignment affects only TCG. | ||
5 | 6 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
9 | Message-id: 20200703145614.16684-9-peter.maydell@linaro.org | 10 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | [PMM: Expanded commit message] | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 12 | --- |
14 | util/oslib-posix.c | 19 +++++++++++++++++++ | 13 | target/arm/machine.c | 18 +++++++++--------- |
15 | 1 file changed, 19 insertions(+) | 14 | 1 file changed, 9 insertions(+), 9 deletions(-) |
16 | 15 | ||
17 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 16 | diff --git a/target/arm/machine.c b/target/arm/machine.c |
18 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/util/oslib-posix.c | 18 | --- a/target/arm/machine.c |
20 | +++ b/util/oslib-posix.c | 19 | +++ b/target/arm/machine.c |
21 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
22 | #include <mach-o/dyld.h> | ||
23 | #endif | ||
24 | |||
25 | +#ifdef __HAIKU__ | ||
26 | +#include <kernel/image.h> | ||
27 | +#endif | ||
28 | + | ||
29 | #include "qemu/mmap-alloc.h" | ||
30 | |||
31 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
32 | @@ -XXX,XX +XXX,XX @@ void qemu_init_exec_dir(const char *argv0) | ||
33 | } | ||
34 | } | 21 | } |
35 | } | 22 | } |
36 | +#elif defined(__HAIKU__) | 23 | |
37 | + { | 24 | + /* |
38 | + image_info ii; | 25 | + * Misaligned thumb pc is architecturally impossible. Fail the |
39 | + int32_t c = 0; | 26 | + * incoming migration. For TCG it would trigger the assert in |
27 | + * thumb_tr_translate_insn(). | ||
28 | + */ | ||
29 | + if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { | ||
30 | + return -1; | ||
31 | + } | ||
40 | + | 32 | + |
41 | + *buf = '\0'; | 33 | hw_breakpoint_update_all(cpu); |
42 | + while (get_next_image_info(0, &c, &ii) == B_OK) { | 34 | hw_watchpoint_update_all(cpu); |
43 | + if (ii.type == B_APP_IMAGE) { | 35 | |
44 | + strncpy(buf, ii.name, sizeof(buf)); | 36 | @@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id) |
45 | + buf[sizeof(buf) - 1] = 0; | 37 | } |
46 | + p = buf; | 38 | } |
47 | + break; | 39 | |
48 | + } | 40 | - /* |
49 | + } | 41 | - * Misaligned thumb pc is architecturally impossible. |
50 | + } | 42 | - * We have an assert in thumb_tr_translate_insn to verify this. |
51 | #endif | 43 | - * Fail an incoming migrate to avoid this assert. |
52 | /* If we don't have any way of figuring out the actual executable | 44 | - */ |
53 | location then try argv[0]. */ | 45 | - if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) { |
46 | - return -1; | ||
47 | - } | ||
48 | - | ||
49 | if (!kvm_enabled()) { | ||
50 | pmu_op_finish(&cpu->env); | ||
51 | } | ||
54 | -- | 52 | -- |
55 | 2.20.1 | 53 | 2.34.1 |
56 | 54 | ||
57 | 55 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | util/compatfd.c includes <sys/syscall.h> so that the CONFIG_SIGNALFD | 3 | Since commit cf7c6d1004 ("target/arm: Split out cpregs.h") we now have |
4 | code can use SYS_signalfd. Guard the #include with CONFIG_SIGNALFD | 4 | a cpregs.h header which is more suitable for this code. |
5 | to avoid portability issues on hosts like Haiku which do not | 5 | |
6 | provide that header file. | 6 | Code moved verbatim. |
7 | 7 | ||
8 | Signed-off-by: David Carlier <devnexen@gmail.com> | 8 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | Message-id: 20200703145614.16684-8-peter.maydell@linaro.org | ||
13 | [PMM: Expanded commit message] | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 13 | --- |
17 | util/compatfd.c | 2 ++ | 14 | target/arm/cpregs.h | 98 +++++++++++++++++++++++++++++++++++++++++++++ |
18 | 1 file changed, 2 insertions(+) | 15 | target/arm/cpu.h | 91 ----------------------------------------- |
19 | 16 | 2 files changed, 98 insertions(+), 91 deletions(-) | |
20 | diff --git a/util/compatfd.c b/util/compatfd.c | 17 | |
18 | diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/util/compatfd.c | 20 | --- a/target/arm/cpregs.h |
23 | +++ b/util/compatfd.c | 21 | +++ b/target/arm/cpregs.h |
24 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ enum { |
25 | #include "qemu/osdep.h" | 23 | ARM_CP_SME = 1 << 19, |
26 | #include "qemu/thread.h" | 24 | }; |
27 | 25 | ||
28 | +#if defined(CONFIG_SIGNALFD) | 26 | +/* |
29 | #include <sys/syscall.h> | 27 | + * Interface for defining coprocessor registers. |
30 | +#endif | 28 | + * Registers are defined in tables of arm_cp_reginfo structs |
31 | 29 | + * which are passed to define_arm_cp_regs(). | |
32 | struct sigfd_compat_info | 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) | ||
33 | { | 228 | { |
34 | -- | 229 | -- |
35 | 2.20.1 | 230 | 2.34.1 |
36 | 231 | ||
37 | 232 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Haiku puts the bswap* functions in <endian.h>; pull in that | 3 | If a test was tagged with the "accel" tag and the specified |
4 | include file on that platform. | 4 | accelerator it not present in the qemu binary, cancel the test. |
5 | 5 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 6 | We can now write tests without explicit calls to require_accelerator, |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | just the tag is enough. |
8 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 8 | |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | Message-id: 20200703145614.16684-7-peter.maydell@linaro.org | 11 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | [PMM: Expanded commit message] | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 13 | --- |
16 | include/qemu/bswap.h | 2 ++ | 14 | tests/avocado/avocado_qemu/__init__.py | 4 ++++ |
17 | 1 file changed, 2 insertions(+) | 15 | 1 file changed, 4 insertions(+) |
18 | 16 | ||
19 | diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h | 17 | diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py |
20 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/qemu/bswap.h | 19 | --- a/tests/avocado/avocado_qemu/__init__.py |
22 | +++ b/include/qemu/bswap.h | 20 | +++ b/tests/avocado/avocado_qemu/__init__.py |
23 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ def setUp(self): |
24 | # include <machine/bswap.h> | 22 | |
25 | #elif defined(__FreeBSD__) | 23 | super().setUp('qemu-system-') |
26 | # include <sys/endian.h> | 24 | |
27 | +#elif defined(__HAIKU__) | 25 | + accel_required = self._get_unique_tag_val('accel') |
28 | +# include <endian.h> | 26 | + if accel_required: |
29 | #elif defined(CONFIG_BYTESWAP_H) | 27 | + self.require_accelerator(accel_required) |
30 | # include <byteswap.h> | 28 | + |
29 | self.machine = self.params.get('machine', | ||
30 | default=self._get_unique_tag_val('machine')) | ||
31 | 31 | ||
32 | -- | 32 | -- |
33 | 2.20.1 | 33 | 2.34.1 |
34 | 34 | ||
35 | 35 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | The 'cpu_type' has been moved from BCM283XState to BCM283XClass | 3 | This allows the test to be skipped when TCG is not present in the QEMU |
4 | in commit 210f47840d, but we forgot to remove the old variable. | 4 | binary. |
5 | Do it now. | ||
6 | 5 | ||
7 | Fixes: 210f47840d ("hw/arm/bcm2836: Hardcode correct CPU type") | 6 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
10 | Message-id: 20200703200459.23294-1-f4bug@amsat.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | include/hw/arm/bcm2836.h | 1 - | 11 | tests/avocado/boot_linux_console.py | 1 + |
14 | 1 file changed, 1 deletion(-) | 12 | tests/avocado/reverse_debugging.py | 8 ++++++++ |
13 | 2 files changed, 9 insertions(+) | ||
15 | 14 | ||
16 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | 15 | diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py |
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/arm/bcm2836.h | 17 | --- a/tests/avocado/boot_linux_console.py |
19 | +++ b/include/hw/arm/bcm2836.h | 18 | +++ b/tests/avocado/boot_linux_console.py |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct BCM283XState { | 19 | @@ -XXX,XX +XXX,XX @@ def test_arm_orangepi_uboot_netbsd9(self): |
21 | DeviceState parent_obj; | 20 | |
22 | /*< public >*/ | 21 | def test_aarch64_raspi3_atf(self): |
23 | 22 | """ | |
24 | - char *cpu_type; | 23 | + :avocado: tags=accel:tcg |
25 | uint32_t enabled_cpus; | 24 | :avocado: tags=arch:aarch64 |
26 | 25 | :avocado: tags=machine:raspi3b | |
27 | struct { | 26 | :avocado: tags=cpu:cortex-a53 |
27 | diff --git a/tests/avocado/reverse_debugging.py b/tests/avocado/reverse_debugging.py | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/tests/avocado/reverse_debugging.py | ||
30 | +++ b/tests/avocado/reverse_debugging.py | ||
31 | @@ -XXX,XX +XXX,XX @@ def reverse_debugging(self, shift=7, args=None): | ||
32 | vm.shutdown() | ||
33 | |||
34 | class ReverseDebugging_X86_64(ReverseDebugging): | ||
35 | + """ | ||
36 | + :avocado: tags=accel:tcg | ||
37 | + """ | ||
38 | + | ||
39 | REG_PC = 0x10 | ||
40 | REG_CS = 0x12 | ||
41 | def get_pc(self, g): | ||
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 | ||
28 | -- | 53 | -- |
29 | 2.20.1 | 54 | 2.34.1 |
30 | 55 | ||
31 | 56 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Haiku doesn't provide SIGIO; fix this up in osdep.h by defining it as | 3 | Now that the cortex-a15 is under CONFIG_TCG, use as default CPU for a |
4 | equal to SIGPOLL. | 4 | KVM-only build the 'max' cpu. |
5 | 5 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 6 | Note that we cannot use 'host' here because the qtests can run without |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 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> | ||
8 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 12 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Message-id: 20200703145614.16684-6-peter.maydell@linaro.org | ||
11 | [PMM: Expanded commit message] | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | 14 | --- |
15 | include/qemu/osdep.h | 4 ++++ | 15 | hw/arm/virt.c | 4 ++++ |
16 | 1 file changed, 4 insertions(+) | 16 | 1 file changed, 4 insertions(+) |
17 | 17 | ||
18 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | 18 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c |
19 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/qemu/osdep.h | 20 | --- a/hw/arm/virt.c |
21 | +++ b/include/qemu/osdep.h | 21 | +++ b/hw/arm/virt.c |
22 | @@ -XXX,XX +XXX,XX @@ void qemu_anon_ram_free(void *ptr, size_t size); | 22 | @@ -XXX,XX +XXX,XX @@ static void virt_machine_class_init(ObjectClass *oc, void *data) |
23 | #define HAVE_CHARDEV_PARPORT 1 | 23 | mc->minimum_page_bits = 12; |
24 | #endif | 24 | mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; |
25 | 25 | mc->cpu_index_to_instance_props = virt_cpu_index_to_props; | |
26 | +#if defined(__HAIKU__) | 26 | +#ifdef CONFIG_TCG |
27 | +#define SIGIO SIGPOLL | 27 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); |
28 | +#else | ||
29 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("max"); | ||
28 | +#endif | 30 | +#endif |
29 | + | 31 | mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; |
30 | #if defined(CONFIG_LINUX) | 32 | mc->kvm_type = virt_kvm_type; |
31 | #ifndef BUS_MCEERR_AR | 33 | assert(!mc->get_hotplug_handler); |
32 | #define BUS_MCEERR_AR 4 | ||
33 | -- | 34 | -- |
34 | 2.20.1 | 35 | 2.34.1 |
35 | |||
36 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Instead of assuming that all POSIX platforms provide mlockall(), | 3 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
4 | test for it in configure. If the host doesn't provide this platform | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | then os_mlock() will fail -ENOSYS, as it does already on Windows. | 5 | Acked-by: Thomas Huth <thuth@redhat.com> |
6 | |||
7 | This is necessary for Haiku, which does not have mlockall(). | ||
8 | |||
9 | Signed-off-by: David Carlier <devnexen@gmail.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Message-id: 20200703145614.16684-4-peter.maydell@linaro.org | ||
13 | [PMM: Expanded commit message; rename to HAVE_MLOCKALL] | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 7 | --- |
17 | configure | 15 +++++++++++++++ | 8 | tests/qtest/arm-cpu-features.c | 28 ++++++++++++++++++---------- |
18 | os-posix.c | 4 ++++ | 9 | 1 file changed, 18 insertions(+), 10 deletions(-) |
19 | 2 files changed, 19 insertions(+) | ||
20 | 10 | ||
21 | diff --git a/configure b/configure | 11 | diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c |
22 | index XXXXXXX..XXXXXXX 100755 | 12 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/configure | 13 | --- a/tests/qtest/arm-cpu-features.c |
24 | +++ b/configure | 14 | +++ b/tests/qtest/arm-cpu-features.c |
25 | @@ -XXX,XX +XXX,XX @@ else | 15 | @@ -XXX,XX +XXX,XX @@ |
26 | pty_h=no | 16 | #define SVE_MAX_VQ 16 |
27 | fi | 17 | |
28 | 18 | #define MACHINE "-machine virt,gic-version=max -accel tcg " | |
29 | +cat > $TMPC <<EOF | 19 | -#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg " |
30 | +#include <sys/mman.h> | 20 | +#define MACHINE_KVM "-machine virt,gic-version=max -accel kvm " |
31 | +int main(int argc, char *argv[]) { | 21 | #define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \ |
32 | + return mlockall(MCL_FUTURE); | 22 | " 'arguments': { 'type': 'full', " |
33 | +} | 23 | #define QUERY_TAIL "}}" |
34 | +EOF | 24 | @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) |
35 | +if compile_prog "" "" ; then | 25 | { |
36 | + have_mlockall=yes | 26 | g_test_init(&argc, &argv, NULL); |
37 | +else | 27 | |
38 | + have_mlockall=no | 28 | - qtest_add_data_func("/arm/query-cpu-model-expansion", |
39 | +fi | 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 | + } | ||
40 | + | 34 | + |
41 | ######################################### | 35 | + if (!g_str_equal(qtest_get_arch(), "aarch64")) { |
42 | # vhost interdependencies and host support | 36 | + goto out; |
43 | 37 | + } | |
44 | @@ -XXX,XX +XXX,XX @@ fi | 38 | |
45 | if test "$pty_h" = "yes" ; then | 39 | /* |
46 | echo "HAVE_PTY_H=y" >> $config_host_mak | 40 | * For now we only run KVM specific tests with AArch64 QEMU in |
47 | fi | 41 | * order avoid attempting to run an AArch32 QEMU with KVM on |
48 | +if test "$have_mlockall" = "yes" ; then | 42 | * AArch64 hosts. That won't work and isn't easy to detect. |
49 | + echo "HAVE_MLOCKALL=y" >> $config_host_mak | 43 | */ |
50 | +fi | 44 | - if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) { |
51 | if test "$fuzzing" = "yes" ; then | 45 | + if (qtest_has_accel("kvm")) { |
52 | if test "$have_fuzzer" = "yes"; then | 46 | /* |
53 | FUZZ_LDFLAGS=" -fsanitize=address,fuzzer" | 47 | * This tests target the 'host' CPU type, so register it only if |
54 | diff --git a/os-posix.c b/os-posix.c | 48 | * KVM is available. |
55 | index XXXXXXX..XXXXXXX 100644 | 49 | */ |
56 | --- a/os-posix.c | 50 | qtest_add_data_func("/arm/kvm/query-cpu-model-expansion", |
57 | +++ b/os-posix.c | 51 | NULL, test_query_cpu_model_expansion_kvm); |
58 | @@ -XXX,XX +XXX,XX @@ bool is_daemonized(void) | 52 | - } |
59 | 53 | ||
60 | int os_mlock(void) | 54 | - if (g_str_equal(qtest_get_arch(), "aarch64")) { |
61 | { | 55 | - qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8", |
62 | +#ifdef HAVE_MLOCKALL | 56 | - NULL, sve_tests_sve_max_vq_8); |
63 | int ret = 0; | 57 | - qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-off", |
64 | 58 | - NULL, sve_tests_sve_off); | |
65 | ret = mlockall(MCL_CURRENT | MCL_FUTURE); | 59 | qtest_add_data_func("/arm/kvm/query-cpu-model-expansion/sve-off", |
66 | @@ -XXX,XX +XXX,XX @@ int os_mlock(void) | 60 | NULL, sve_tests_sve_off_kvm); |
67 | } | 61 | } |
68 | 62 | ||
69 | return ret; | 63 | + if (qtest_has_accel("tcg")) { |
70 | +#else | 64 | + qtest_add_data_func("/arm/max/query-cpu-model-expansion/sve-max-vq-8", |
71 | + return -ENOSYS; | 65 | + NULL, sve_tests_sve_max_vq_8); |
72 | +#endif | 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(); | ||
73 | } | 72 | } |
74 | -- | 73 | -- |
75 | 2.20.1 | 74 | 2.34.1 |
76 | |||
77 | diff view generated by jsdifflib |
1 | From: David CARLIER <devnexen@gmail.com> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | Tell Haiku to provide various BSD functions by setting BSD_SOURCE | 3 | These tests set -accel tcg, so restrict them to when TCG is present. |
4 | and linking libbsd. | ||
5 | 4 | ||
6 | Signed-off-by: David Carlier <devnexen@gmail.com> | 5 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Acked-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
9 | Message-id: 20200703145614.16684-2-peter.maydell@linaro.org | ||
10 | [PMM: expanded commit message] | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 9 | --- |
14 | configure | 4 ++-- | 10 | tests/qtest/meson.build | 4 ++-- |
15 | 1 file changed, 2 insertions(+), 2 deletions(-) | 11 | 1 file changed, 2 insertions(+), 2 deletions(-) |
16 | 12 | ||
17 | diff --git a/configure b/configure | 13 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build |
18 | index XXXXXXX..XXXXXXX 100755 | 14 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/configure | 15 | --- a/tests/qtest/meson.build |
20 | +++ b/configure | 16 | +++ b/tests/qtest/meson.build |
21 | @@ -XXX,XX +XXX,XX @@ SunOS) | 17 | @@ -XXX,XX +XXX,XX @@ qtests_arm = \ |
22 | ;; | 18 | # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional |
23 | Haiku) | 19 | qtests_aarch64 = \ |
24 | haiku="yes" | 20 | (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) + \ |
25 | - QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" | 21 | - (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-test'] : []) + \ |
26 | - LIBS="-lposix_error_mapper -lnetwork $LIBS" | 22 | - (config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? ['tpm-tis-device-swtpm-test'] : []) + \ |
27 | + QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" | 23 | + (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ? \ |
28 | + LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS" | 24 | + ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ |
29 | ;; | 25 | (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ |
30 | Linux) | 26 | (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ |
31 | audio_drv_list="try-pa oss" | 27 | ['arm-cpu-features', |
32 | -- | 28 | -- |
33 | 2.20.1 | 29 | 2.34.1 |
34 | |||
35 | diff view generated by jsdifflib |