1 | target-arm queue: this time around is all small fixes | 1 | Patches for rc1: nothing major, just some minor bugfixes and |
---|---|---|---|
2 | and changes. | 2 | code cleanups. |
3 | 3 | ||
4 | thanks | ||
5 | -- PMM | 4 | -- PMM |
6 | 5 | ||
7 | The following changes since commit fec105c2abda8567ec15230429c41429b5ee307c: | 6 | The following changes since commit f7e1914adad8885a5d4c70239ab90d901ed97e9f: |
8 | 7 | ||
9 | Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190828-pull-request' into staging (2019-09-03 14:03:15 +0100) | 8 | Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201109' into staging (2020-11-10 09:24:56 +0000) |
10 | 9 | ||
11 | are available in the Git repository at: | 10 | are available in the Git repository at: |
12 | 11 | ||
13 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190903 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201110 |
14 | 13 | ||
15 | for you to fetch changes up to 5e5584c89f36b302c666bc6db535fd3f7ff35ad2: | 14 | for you to fetch changes up to b6c56c8a9a4064ea783f352f43c5df6231a110fa: |
16 | 15 | ||
17 | target/arm: Don't abort on M-profile exception return in linux-user mode (2019-09-03 16:20:35 +0100) | 16 | target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check (2020-11-10 11:03:48 +0000) |
18 | 17 | ||
19 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
20 | target-arm queue: | 19 | target-arm queue: |
21 | * Revert and correctly fix refactoring of unallocated_encoding() | 20 | * hw/arm/Kconfig: ARM_V7M depends on PTIMER |
22 | * Take exceptions on ATS instructions when needed | 21 | * Minor coding style fixes |
23 | * aspeed/timer: Provide back-pressure information for short periods | 22 | * docs: add some notes on the sbsa-ref machine |
24 | * memory: Remove unused memory_region_iommu_replay_all() | 23 | * hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals |
25 | * hw/arm/smmuv3: Log a guest error when decoding an invalid STE | 24 | * target/arm: Fix neon VTBL/VTBX for len > 1 |
26 | * hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations | 25 | * hw/arm/armsse: Correct expansion MPC interrupt lines |
27 | * target/arm: Fix SMMLS argument order | 26 | * hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ |
28 | * hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate | 27 | * hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup() |
29 | * hw/arm: Correct reference counting for creation of various objects | 28 | * hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input |
30 | * includes: remove stale [smp|max]_cpus externs | 29 | * hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary |
31 | * tcg/README: fix typo | 30 | * hw/arm/nseries: Check return value from load_image_targphys() |
32 | * atomic_template: fix indentation in GEN_ATOMIC_HELPER | 31 | * tests/qtest/npcm7xx_rng-test: count runs properly |
33 | * include/exec/cpu-defs.h: fix typo | 32 | * target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check |
34 | * target/arm: Free TCG temps in trans_VMOV_64_sp() | ||
35 | * target/arm: Don't abort on M-profile exception return in linux-user mode | ||
36 | 33 | ||
37 | ---------------------------------------------------------------- | 34 | ---------------------------------------------------------------- |
38 | Alex Bennée (2): | 35 | Alex Bennée (1): |
39 | includes: remove stale [smp|max]_cpus externs | 36 | docs: add some notes on the sbsa-ref machine |
40 | include/exec/cpu-defs.h: fix typo | ||
41 | 37 | ||
42 | Andrew Jeffery (1): | 38 | AlexChen (1): |
43 | aspeed/timer: Provide back-pressure information for short periods | 39 | ssi: Fix bad printf format specifiers |
44 | 40 | ||
45 | Emilio G. Cota (2): | 41 | Andrew Jones (1): |
46 | tcg/README: fix typo s/afterwise/afterwards/ | 42 | hw/arm/Kconfig: ARM_V7M depends on PTIMER |
47 | atomic_template: fix indentation in GEN_ATOMIC_HELPER | ||
48 | 43 | ||
49 | Eric Auger (3): | 44 | Havard Skinnemoen (1): |
50 | memory: Remove unused memory_region_iommu_replay_all() | 45 | tests/qtest/npcm7xx_rng-test: count runs properly |
51 | hw/arm/smmuv3: Log a guest error when decoding an invalid STE | ||
52 | hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations | ||
53 | 46 | ||
54 | Peter Maydell (4): | 47 | Peter Maydell (2): |
55 | target/arm: Allow ARMCPRegInfo read/write functions to throw exceptions | 48 | hw/arm/nseries: Check return value from load_image_targphys() |
56 | target/arm: Take exceptions on ATS instructions when needed | 49 | target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check |
57 | target/arm: Free TCG temps in trans_VMOV_64_sp() | ||
58 | target/arm: Don't abort on M-profile exception return in linux-user mode | ||
59 | 50 | ||
60 | Philippe Mathieu-Daudé (6): | 51 | Philippe Mathieu-Daudé (6): |
61 | hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate | 52 | hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals |
62 | hw/arm: Use object_initialize_child for correct reference counting | 53 | hw/arm/armsse: Correct expansion MPC interrupt lines |
63 | hw/arm: Use sysbus_init_child_obj for correct reference counting | 54 | hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ |
64 | hw/arm/fsl-imx: Add the cpu as child of the SoC object | 55 | hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup() |
65 | hw/dma/xilinx_axi: Use object_initialize_child for correct ref. counting | 56 | hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input |
66 | hw/net/xilinx_axi: Use object_initialize_child for correct ref. counting | 57 | hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary |
67 | 58 | ||
68 | Richard Henderson (3): | 59 | Richard Henderson (1): |
69 | Revert "target/arm: Use unallocated_encoding for aarch32" | 60 | target/arm: Fix neon VTBL/VTBX for len > 1 |
70 | target/arm: Factor out unallocated_encoding for aarch32 | ||
71 | target/arm: Fix SMMLS argument order | ||
72 | 61 | ||
73 | accel/tcg/atomic_template.h | 2 +- | 62 | Xinhao Zhang (3): |
74 | hw/arm/smmuv3-internal.h | 1 + | 63 | target/arm: add spaces around operator |
75 | include/exec/cpu-defs.h | 2 +- | 64 | target/arm: Don't use '#' flag of printf format |
76 | include/exec/memory.h | 10 ---- | 65 | target/arm: add space before the open parenthesis '(' |
77 | include/sysemu/sysemu.h | 2 - | ||
78 | target/arm/cpu.h | 6 ++- | ||
79 | target/arm/translate-a64.h | 2 + | ||
80 | target/arm/translate.h | 2 - | ||
81 | hw/arm/allwinner-a10.c | 3 +- | ||
82 | hw/arm/cubieboard.c | 3 +- | ||
83 | hw/arm/digic.c | 3 +- | ||
84 | hw/arm/exynos4_boards.c | 4 +- | ||
85 | hw/arm/fsl-imx25.c | 4 +- | ||
86 | hw/arm/fsl-imx31.c | 4 +- | ||
87 | hw/arm/fsl-imx6.c | 3 +- | ||
88 | hw/arm/fsl-imx6ul.c | 2 +- | ||
89 | hw/arm/mcimx7d-sabre.c | 9 ++-- | ||
90 | hw/arm/mps2-tz.c | 15 +++--- | ||
91 | hw/arm/musca.c | 9 ++-- | ||
92 | hw/arm/smmuv3.c | 18 ++++--- | ||
93 | hw/arm/xlnx-zynqmp.c | 8 +-- | ||
94 | hw/dma/xilinx_axidma.c | 16 +++--- | ||
95 | hw/net/xilinx_axienet.c | 17 +++---- | ||
96 | hw/timer/aspeed_timer.c | 17 ++++++- | ||
97 | memory.c | 9 ---- | ||
98 | target/arm/helper.c | 107 +++++++++++++++++++++++++++++++++++------ | ||
99 | target/arm/translate-a64.c | 13 +++++ | ||
100 | target/arm/translate-vfp.inc.c | 2 + | ||
101 | target/arm/translate.c | 50 +++++++++++++++++-- | ||
102 | tcg/README | 2 +- | ||
103 | 30 files changed, 244 insertions(+), 101 deletions(-) | ||
104 | 66 | ||
67 | docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++ | ||
68 | docs/system/target-arm.rst | 1 + | ||
69 | include/hw/misc/stm32f2xx_syscfg.h | 2 -- | ||
70 | target/arm/helper.h | 2 +- | ||
71 | hw/arm/armsse.c | 3 +- | ||
72 | hw/arm/musicpal.c | 40 +++++++++++++++++---------- | ||
73 | hw/arm/nseries.c | 26 ++++++++---------- | ||
74 | hw/arm/stm32f205_soc.c | 1 - | ||
75 | hw/misc/stm32f2xx_syscfg.c | 2 -- | ||
76 | hw/ssi/imx_spi.c | 2 +- | ||
77 | hw/ssi/xilinx_spi.c | 2 +- | ||
78 | target/arm/arch_dump.c | 8 +++--- | ||
79 | target/arm/arm-semi.c | 8 +++--- | ||
80 | target/arm/helper.c | 2 +- | ||
81 | target/arm/op_helper.c | 23 +++++++++------- | ||
82 | target/arm/translate-a64.c | 4 +-- | ||
83 | target/arm/translate.c | 2 +- | ||
84 | tests/qtest/npcm7xx_rng-test.c | 2 +- | ||
85 | hw/arm/Kconfig | 3 +- | ||
86 | target/arm/translate-neon.c.inc | 56 ++++++++++++++------------------------ | ||
87 | 20 files changed, 123 insertions(+), 98 deletions(-) | ||
88 | create mode 100644 docs/system/arm/sbsa.rst | ||
89 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Log a guest error when encountering an invalid STE. | 3 | commit 32bd322a0134 ("hw/timer/armv7m_systick: Rewrite to use ptimers") |
4 | changed armv7m_systick to build on ptimers. Make sure we have ptimers | ||
5 | in the build when building armv7m_systick. | ||
4 | 6 | ||
5 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 7 | Signed-off-by: Andrew Jones <drjones@redhat.com> |
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
7 | Message-id: 20190822172350.12008-5-eric.auger@redhat.com | 9 | Message-id: 20201104103343.30392-1-drjones@redhat.com |
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 11 | --- |
10 | hw/arm/smmuv3.c | 1 + | 12 | hw/arm/Kconfig | 1 + |
11 | 1 file changed, 1 insertion(+) | 13 | 1 file changed, 1 insertion(+) |
12 | 14 | ||
13 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 15 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
14 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/smmuv3.c | 17 | --- a/hw/arm/Kconfig |
16 | +++ b/hw/arm/smmuv3.c | 18 | +++ b/hw/arm/Kconfig |
17 | @@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg, | 19 | @@ -XXX,XX +XXX,XX @@ config ZYNQ |
18 | uint32_t config; | 20 | |
19 | 21 | config ARM_V7M | |
20 | if (!STE_VALID(ste)) { | 22 | bool |
21 | + qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n"); | 23 | + select PTIMER |
22 | goto bad_ste; | 24 | |
23 | } | 25 | config ALLWINNER_A10 |
24 | 26 | bool | |
25 | -- | 27 | -- |
26 | 2.20.1 | 28 | 2.20.1 |
27 | 29 | ||
28 | 30 | diff view generated by jsdifflib |
1 | An attempt to do an exception-return (branch to one of the magic | 1 | From: AlexChen <alex.chen@huawei.com> |
---|---|---|---|
2 | addresses) in linux-user mode for M-profile should behave like | ||
3 | a normal branch, because linux-user mode is always going to be | ||
4 | in 'handler' mode. This used to work, but we broke it when we added | ||
5 | support for the M-profile security extension in commit d02a8698d7ae2bfed. | ||
6 | 2 | ||
7 | In that commit we allowed even handler-mode calls to magic return | 3 | We should use printf format specifier "%u" instead of "%d" for |
8 | values to be checked for and dealt with by causing an | 4 | argument of type "unsigned int". |
9 | EXCP_EXCEPTION_EXIT exception to be taken, because this is | ||
10 | needed for the FNC_RETURN return-from-non-secure-function-call | ||
11 | handling. For system mode we added a check in do_v7m_exception_exit() | ||
12 | to make any spurious calls from Handler mode behave correctly, but | ||
13 | forgot that linux-user mode would also be affected. | ||
14 | 5 | ||
15 | How an attempted return-from-non-secure-function-call in linux-user | 6 | Reported-by: Euler Robot <euler.robot@huawei.com> |
16 | mode should be handled is not clear -- on real hardware it would | 7 | Signed-off-by: Alex Chen <alex.chen@huawei.com> |
17 | result in return to secure code (not to the Linux kernel) which | 8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
18 | could then handle the error in any way it chose. For QEMU we take | 9 | Message-id: 5FA280F5.8060902@huawei.com |
19 | the simple approach of treating this erroneous return the same way | ||
20 | it would be handled on a CPU without the security extensions -- | ||
21 | treat it as a normal branch. | ||
22 | |||
23 | The upshot of all this is that for linux-user mode we should never | ||
24 | do any of the bx_excret magic, so the code change is simple. | ||
25 | |||
26 | This ought to be a weird corner case that only affects broken guest | ||
27 | code (because Linux user processes should never be attempting to do | ||
28 | exception returns or NS function returns), except that the code that | ||
29 | assigns addresses in RAM for the process and stack in our linux-user | ||
30 | code does not attempt to avoid this magic address range, so | ||
31 | legitimate code attempting to return to a trampoline routine on the | ||
32 | stack can fall into this case. This change fixes those programs, | ||
33 | but we should also look at restricting the range of memory we | ||
34 | use for M-profile linux-user guests to the area that would be | ||
35 | real RAM in hardware. | ||
36 | |||
37 | Cc: qemu-stable@nongnu.org | ||
38 | Reported-by: Christophe Lyon <christophe.lyon@linaro.org> | ||
39 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
40 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
41 | Message-id: 20190822131534.16602-1-peter.maydell@linaro.org | ||
42 | Fixes: https://bugs.launchpad.net/qemu/+bug/1840922 | ||
43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
44 | --- | 11 | --- |
45 | target/arm/translate.c | 21 ++++++++++++++++++++- | 12 | hw/ssi/imx_spi.c | 2 +- |
46 | 1 file changed, 20 insertions(+), 1 deletion(-) | 13 | hw/ssi/xilinx_spi.c | 2 +- |
14 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
47 | 15 | ||
48 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 16 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
49 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/target/arm/translate.c | 18 | --- a/hw/ssi/imx_spi.c |
51 | +++ b/target/arm/translate.c | 19 | +++ b/hw/ssi/imx_spi.c |
52 | @@ -XXX,XX +XXX,XX @@ static inline void gen_bx(DisasContext *s, TCGv_i32 var) | 20 | @@ -XXX,XX +XXX,XX @@ static const char *imx_spi_reg_name(uint32_t reg) |
53 | store_cpu_field(var, thumb); | 21 | case ECSPI_MSGDATA: |
22 | return "ECSPI_MSGDATA"; | ||
23 | default: | ||
24 | - sprintf(unknown, "%d ?", reg); | ||
25 | + sprintf(unknown, "%u ?", reg); | ||
26 | return unknown; | ||
27 | } | ||
54 | } | 28 | } |
55 | 29 | diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c | |
56 | -/* Set PC and Thumb state from var. var is marked as dead. | 30 | index XXXXXXX..XXXXXXX 100644 |
57 | +/* | 31 | --- a/hw/ssi/xilinx_spi.c |
58 | + * Set PC and Thumb state from var. var is marked as dead. | 32 | +++ b/hw/ssi/xilinx_spi.c |
59 | * For M-profile CPUs, include logic to detect exception-return | 33 | @@ -XXX,XX +XXX,XX @@ static void xlx_spi_update_irq(XilinxSPI *s) |
60 | * branches and handle them. This is needed for Thumb POP/LDM to PC, LDR to PC, | 34 | irq chain unless things really changed. */ |
61 | * and BX reg, and no others, and happens only for code in Handler mode. | 35 | if (pending != s->irqline) { |
62 | + * The Security Extension also requires us to check for the FNC_RETURN | 36 | s->irqline = pending; |
63 | + * which signals a function return from non-secure state; this can happen | 37 | - DB_PRINT("irq_change of state %d ISR:%x IER:%X\n", |
64 | + * in both Handler and Thread mode. | 38 | + DB_PRINT("irq_change of state %u ISR:%x IER:%X\n", |
65 | + * To avoid having to do multiple comparisons in inline generated code, | 39 | pending, s->regs[R_IPISR], s->regs[R_IPIER]); |
66 | + * we make the check we do here loose, so it will match for EXC_RETURN | 40 | qemu_set_irq(s->irq, pending); |
67 | + * in Thread mode. For system emulation do_v7m_exception_exit() checks | ||
68 | + * for these spurious cases and returns without doing anything (giving | ||
69 | + * the same behaviour as for a branch to a non-magic address). | ||
70 | + * | ||
71 | + * In linux-user mode it is unclear what the right behaviour for an | ||
72 | + * attempted FNC_RETURN should be, because in real hardware this will go | ||
73 | + * directly to Secure code (ie not the Linux kernel) which will then treat | ||
74 | + * the error in any way it chooses. For QEMU we opt to make the FNC_RETURN | ||
75 | + * attempt behave the way it would on a CPU without the security extension, | ||
76 | + * which is to say "like a normal branch". That means we can simply treat | ||
77 | + * all branches as normal with no magic address behaviour. | ||
78 | */ | ||
79 | static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var) | ||
80 | { | ||
81 | @@ -XXX,XX +XXX,XX @@ static inline void gen_bx_excret(DisasContext *s, TCGv_i32 var) | ||
82 | * s->base.is_jmp that we need to do the rest of the work later. | ||
83 | */ | ||
84 | gen_bx(s, var); | ||
85 | +#ifndef CONFIG_USER_ONLY | ||
86 | if (arm_dc_feature(s, ARM_FEATURE_M_SECURITY) || | ||
87 | (s->v7m_handler_mode && arm_dc_feature(s, ARM_FEATURE_M))) { | ||
88 | s->base.is_jmp = DISAS_BX_EXCRET; | ||
89 | } | 41 | } |
90 | +#endif | ||
91 | } | ||
92 | |||
93 | static inline void gen_bx_excret_final_code(DisasContext *s) | ||
94 | -- | 42 | -- |
95 | 2.20.1 | 43 | 2.20.1 |
96 | 44 | ||
97 | 45 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Make this a static function private to translate.c. | 3 | Fix code style. Operator needs spaces both sides. |
4 | Thus we can use the same idiom between aarch64 and aarch32 | ||
5 | without actually sharing function implementations. | ||
6 | 4 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> |
8 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 6 | Signed-off-by: Kai Deng <dengkai1@huawei.com> |
9 | Message-id: 20190826151536.6771-3-richard.henderson@linaro.org | 7 | Message-id: 20201103114529.638233-1-zhangxinhao1@huawei.com |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | target/arm/translate-vfp.inc.c | 3 +-- | 11 | target/arm/arch_dump.c | 8 ++++---- |
13 | target/arm/translate.c | 22 ++++++++++++---------- | 12 | target/arm/arm-semi.c | 8 ++++---- |
14 | 2 files changed, 13 insertions(+), 12 deletions(-) | 13 | target/arm/helper.c | 2 +- |
14 | 3 files changed, 9 insertions(+), 9 deletions(-) | ||
15 | 15 | ||
16 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | 16 | diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/translate-vfp.inc.c | 18 | --- a/target/arm/arch_dump.c |
19 | +++ b/target/arm/translate-vfp.inc.c | 19 | +++ b/target/arm/arch_dump.c |
20 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | 20 | @@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, |
21 | 21 | ||
22 | if (!s->vfp_enabled && !ignore_vfp_enabled) { | 22 | for (i = 0; i < 32; ++i) { |
23 | assert(!arm_dc_feature(s, ARM_FEATURE_M)); | 23 | uint64_t *q = aa64_vfp_qreg(env, i); |
24 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | 24 | - note.vfp.vregs[2*i + 0] = cpu_to_dump64(s, q[0]); |
25 | - default_exception_el(s)); | 25 | - note.vfp.vregs[2*i + 1] = cpu_to_dump64(s, q[1]); |
26 | + unallocated_encoding(s); | 26 | + note.vfp.vregs[2 * i + 0] = cpu_to_dump64(s, q[0]); |
27 | return false; | 27 | + note.vfp.vregs[2 * i + 1] = cpu_to_dump64(s, q[1]); |
28 | } | 28 | } |
29 | 29 | ||
30 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 30 | if (s->dump_info.d_endian == ELFDATA2MSB) { |
31 | index XXXXXXX..XXXXXXX 100644 | 31 | @@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, |
32 | --- a/target/arm/translate.c | 32 | */ |
33 | +++ b/target/arm/translate.c | 33 | for (i = 0; i < 32; ++i) { |
34 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) | 34 | uint64_t tmp = note.vfp.vregs[2*i]; |
35 | s->base.is_jmp = DISAS_NORETURN; | 35 | - note.vfp.vregs[2*i] = note.vfp.vregs[2*i+1]; |
36 | } | 36 | - note.vfp.vregs[2*i+1] = tmp; |
37 | 37 | + note.vfp.vregs[2 * i] = note.vfp.vregs[2 * i + 1]; | |
38 | +static void unallocated_encoding(DisasContext *s) | 38 | + note.vfp.vregs[2 * i + 1] = tmp; |
39 | +{ | ||
40 | + /* Unallocated and reserved encodings are uncategorized */ | ||
41 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
42 | + default_exception_el(s)); | ||
43 | +} | ||
44 | + | ||
45 | /* Force a TB lookup after an instruction that changes the CPU state. */ | ||
46 | static inline void gen_lookup_tb(DisasContext *s) | ||
47 | { | ||
48 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) | ||
49 | return; | ||
50 | } | ||
51 | |||
52 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
53 | - default_exception_el(s)); | ||
54 | + unallocated_encoding(s); | ||
55 | } | ||
56 | |||
57 | static inline void gen_add_data_offset(DisasContext *s, unsigned int insn, | ||
58 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
59 | } | ||
60 | |||
61 | if (undef) { | ||
62 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
63 | - default_exception_el(s)); | ||
64 | + unallocated_encoding(s); | ||
65 | return; | ||
66 | } | ||
67 | |||
68 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
69 | break; | ||
70 | default: | ||
71 | illegal_op: | ||
72 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
73 | - default_exception_el(s)); | ||
74 | + unallocated_encoding(s); | ||
75 | break; | ||
76 | } | 39 | } |
77 | } | 40 | } |
78 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | 41 | |
79 | } | 42 | diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c |
80 | return; | 43 | index XXXXXXX..XXXXXXX 100644 |
81 | illegal_op: | 44 | --- a/target/arm/arm-semi.c |
82 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | 45 | +++ b/target/arm/arm-semi.c |
83 | - default_exception_el(s)); | 46 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) |
84 | + unallocated_encoding(s); | 47 | if (use_gdb_syscalls()) { |
48 | arm_semi_open_guestfd = guestfd; | ||
49 | ret = arm_gdb_syscall(cpu, arm_semi_open_cb, "open,%s,%x,1a4", arg0, | ||
50 | - (int)arg2+1, gdb_open_modeflags[arg1]); | ||
51 | + (int)arg2 + 1, gdb_open_modeflags[arg1]); | ||
52 | } else { | ||
53 | ret = set_swi_errno(env, open(s, open_modeflags[arg1], 0644)); | ||
54 | if (ret == (uint32_t)-1) { | ||
55 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) | ||
56 | GET_ARG(1); | ||
57 | if (use_gdb_syscalls()) { | ||
58 | ret = arm_gdb_syscall(cpu, arm_semi_cb, "unlink,%s", | ||
59 | - arg0, (int)arg1+1); | ||
60 | + arg0, (int)arg1 + 1); | ||
61 | } else { | ||
62 | s = lock_user_string(arg0); | ||
63 | if (!s) { | ||
64 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) | ||
65 | GET_ARG(3); | ||
66 | if (use_gdb_syscalls()) { | ||
67 | return arm_gdb_syscall(cpu, arm_semi_cb, "rename,%s,%s", | ||
68 | - arg0, (int)arg1+1, arg2, (int)arg3+1); | ||
69 | + arg0, (int)arg1 + 1, arg2, (int)arg3 + 1); | ||
70 | } else { | ||
71 | char *s2; | ||
72 | s = lock_user_string(arg0); | ||
73 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) | ||
74 | GET_ARG(1); | ||
75 | if (use_gdb_syscalls()) { | ||
76 | return arm_gdb_syscall(cpu, arm_semi_cb, "system,%s", | ||
77 | - arg0, (int)arg1+1); | ||
78 | + arg0, (int)arg1 + 1); | ||
79 | } else { | ||
80 | s = lock_user_string(arg0); | ||
81 | if (!s) { | ||
82 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
83 | index XXXXXXX..XXXXXXX 100644 | ||
84 | --- a/target/arm/helper.c | ||
85 | +++ b/target/arm/helper.c | ||
86 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(usad8)(uint32_t a, uint32_t b) | ||
87 | uint32_t sum; | ||
88 | sum = do_usad(a, b); | ||
89 | sum += do_usad(a >> 8, b >> 8); | ||
90 | - sum += do_usad(a >> 16, b >>16); | ||
91 | + sum += do_usad(a >> 16, b >> 16); | ||
92 | sum += do_usad(a >> 24, b >> 24); | ||
93 | return sum; | ||
85 | } | 94 | } |
86 | |||
87 | static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
88 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
89 | return; | ||
90 | illegal_op: | ||
91 | undef: | ||
92 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
93 | - default_exception_el(s)); | ||
94 | + unallocated_encoding(s); | ||
95 | } | ||
96 | |||
97 | static bool insn_crosses_page(CPUARMState *env, DisasContext *s) | ||
98 | -- | 95 | -- |
99 | 2.20.1 | 96 | 2.20.1 |
100 | 97 | ||
101 | 98 | diff view generated by jsdifflib |
1 | Currently the only part of an ARMCPRegInfo which is allowed to cause | 1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> |
---|---|---|---|
2 | a CPU exception is the access function, which returns a value indicating | ||
3 | that some flavour of UNDEF should be generated. | ||
4 | 2 | ||
5 | For the ATS system instructions, we would like to conditionally | 3 | Fix code style. Don't use '#' flag of printf format ('%#') in |
6 | generate exceptions as part of the writefn, because some faults | 4 | format strings, use '0x' prefix instead |
7 | during the page table walk (like external aborts) should cause | ||
8 | an exception to be raised rather than returning a value. | ||
9 | 5 | ||
10 | There are several ways we could do this: | 6 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> |
11 | * plumb the GETPC() value from the top level set_cp_reg/get_cp_reg | 7 | Signed-off-by: Kai Deng <dengkai1@huawei.com> |
12 | helper functions through into the readfn and writefn hooks | 8 | Message-id: 20201103114529.638233-2-zhangxinhao1@huawei.com |
13 | * add extra readfn_with_ra/writefn_with_ra hooks that take the GETPC() | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | value | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | * require the ATS instructions to provide a dummy accessfn, | 11 | --- |
16 | which serves no purpose except to cause the code generation | 12 | target/arm/translate-a64.c | 4 ++-- |
17 | to emit TCG ops to sync the CPU state | 13 | 1 file changed, 2 insertions(+), 2 deletions(-) |
18 | * add an ARM_CP_ flag to mark the ARMCPRegInfo as possibly | ||
19 | throwing an exception in its read/write hooks, and make the | ||
20 | codegen sync the CPU state before calling the hooks if the | ||
21 | flag is set | ||
22 | 14 | ||
23 | This patch opts for the last of these, as it is fairly simple | ||
24 | to implement and doesn't require invasive changes like updating | ||
25 | the readfn/writefn hook function prototype signature. | ||
26 | |||
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
28 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
29 | Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
30 | Message-id: 20190816125802.25877-2-peter.maydell@linaro.org | ||
31 | --- | ||
32 | target/arm/cpu.h | 6 +++++- | ||
33 | target/arm/translate-a64.c | 6 ++++++ | ||
34 | target/arm/translate.c | 7 +++++++ | ||
35 | 3 files changed, 18 insertions(+), 1 deletion(-) | ||
36 | |||
37 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/cpu.h | ||
40 | +++ b/target/arm/cpu.h | ||
41 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) | ||
42 | * IO indicates that this register does I/O and therefore its accesses | ||
43 | * need to be surrounded by gen_io_start()/gen_io_end(). In particular, | ||
44 | * registers which implement clocks or timers require this. | ||
45 | + * RAISES_EXC is for when the read or write hook might raise an exception; | ||
46 | + * the generated code will synchronize the CPU state before calling the hook | ||
47 | + * so that it is safe for the hook to call raise_exception(). | ||
48 | */ | ||
49 | #define ARM_CP_SPECIAL 0x0001 | ||
50 | #define ARM_CP_CONST 0x0002 | ||
51 | @@ -XXX,XX +XXX,XX @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) | ||
52 | #define ARM_CP_FPU 0x1000 | ||
53 | #define ARM_CP_SVE 0x2000 | ||
54 | #define ARM_CP_NO_GDB 0x4000 | ||
55 | +#define ARM_CP_RAISES_EXC 0x8000 | ||
56 | /* Used only as a terminator for ARMCPRegInfo lists */ | ||
57 | #define ARM_CP_SENTINEL 0xffff | ||
58 | /* Mask of only the flag bits in a type field */ | ||
59 | -#define ARM_CP_FLAG_MASK 0x70ff | ||
60 | +#define ARM_CP_FLAG_MASK 0xf0ff | ||
61 | |||
62 | /* Valid values for ARMCPRegInfo state field, indicating which of | ||
63 | * the AArch32 and AArch64 execution states this register is visible in. | ||
64 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
65 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
66 | --- a/target/arm/translate-a64.c | 17 | --- a/target/arm/translate-a64.c |
67 | +++ b/target/arm/translate-a64.c | 18 | +++ b/target/arm/translate-a64.c |
68 | @@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, | 19 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) |
69 | tcg_temp_free_ptr(tmpptr); | 20 | gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst); |
70 | tcg_temp_free_i32(tcg_syn); | 21 | break; |
71 | tcg_temp_free_i32(tcg_isread); | 22 | default: |
72 | + } else if (ri->type & ARM_CP_RAISES_EXC) { | 23 | - fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n", |
73 | + /* | 24 | + fprintf(stderr, "%s: insn 0x%04x, fpop 0x%2x @ 0x%" PRIx64 "\n", |
74 | + * The readfn or writefn might raise an exception; | 25 | __func__, insn, fpopcode, s->pc_curr); |
75 | + * synchronize the CPU state in case it does. | 26 | g_assert_not_reached(); |
76 | + */ | 27 | } |
77 | + gen_a64_set_pc_im(s->pc_curr); | 28 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) |
29 | case 0x7f: /* FSQRT (vector) */ | ||
30 | break; | ||
31 | default: | ||
32 | - fprintf(stderr, "%s: insn %#04x fpop %#2x\n", __func__, insn, fpop); | ||
33 | + fprintf(stderr, "%s: insn 0x%04x fpop 0x%2x\n", __func__, insn, fpop); | ||
34 | g_assert_not_reached(); | ||
78 | } | 35 | } |
79 | 36 | ||
80 | /* Handle special cases first */ | ||
81 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | ||
83 | --- a/target/arm/translate.c | ||
84 | +++ b/target/arm/translate.c | ||
85 | @@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn) | ||
86 | tcg_temp_free_ptr(tmpptr); | ||
87 | tcg_temp_free_i32(tcg_syn); | ||
88 | tcg_temp_free_i32(tcg_isread); | ||
89 | + } else if (ri->type & ARM_CP_RAISES_EXC) { | ||
90 | + /* | ||
91 | + * The readfn or writefn might raise an exception; | ||
92 | + * synchronize the CPU state in case it does. | ||
93 | + */ | ||
94 | + gen_set_condexec(s); | ||
95 | + gen_set_pc_im(s, s->pc_curr); | ||
96 | } | ||
97 | |||
98 | /* Handle special cases first */ | ||
99 | -- | 37 | -- |
100 | 2.20.1 | 38 | 2.20.1 |
101 | 39 | ||
102 | 40 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The previous simplification got the order of operands to the | 3 | Fix code style. Space required before the open parenthesis '('. |
4 | subtraction wrong. Since the 64-bit product is the subtrahend, | ||
5 | we must use a 64-bit subtract to properly compute the borrow | ||
6 | from the low-part of the product. | ||
7 | 4 | ||
8 | Fixes: 5f8cd06ebcf5 ("target/arm: Simplify SMMLA, SMMLAR, SMMLS, SMMLSR") | 5 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> |
9 | Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 6 | Signed-off-by: Kai Deng <dengkai1@huawei.com> |
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Message-id: 20201103114529.638233-3-zhangxinhao1@huawei.com |
11 | Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
12 | Message-id: 20190829013258.16102-1-richard.henderson@linaro.org | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 10 | --- |
16 | target/arm/translate.c | 20 ++++++++++++++++++-- | 11 | target/arm/translate.c | 2 +- |
17 | 1 file changed, 18 insertions(+), 2 deletions(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
18 | 13 | ||
19 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 14 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/translate.c | 16 | --- a/target/arm/translate.c |
22 | +++ b/target/arm/translate.c | 17 | +++ b/target/arm/translate.c |
23 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | 18 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
24 | if (rd != 15) { | 19 | - Hardware watchpoints. |
25 | tmp3 = load_reg(s, rd); | 20 | Hardware breakpoints have already been handled and skip this code. |
26 | if (insn & (1 << 6)) { | 21 | */ |
27 | - tcg_gen_sub_i32(tmp, tmp, tmp3); | 22 | - switch(dc->base.is_jmp) { |
28 | + /* | 23 | + switch (dc->base.is_jmp) { |
29 | + * For SMMLS, we need a 64-bit subtract. | 24 | case DISAS_NEXT: |
30 | + * Borrow caused by a non-zero multiplicand | 25 | case DISAS_TOO_MANY: |
31 | + * lowpart, and the correct result lowpart | 26 | gen_goto_tb(dc, 1, dc->base.pc_next); |
32 | + * for rounding. | ||
33 | + */ | ||
34 | + TCGv_i32 zero = tcg_const_i32(0); | ||
35 | + tcg_gen_sub2_i32(tmp2, tmp, zero, tmp3, | ||
36 | + tmp2, tmp); | ||
37 | + tcg_temp_free_i32(zero); | ||
38 | } else { | ||
39 | tcg_gen_add_i32(tmp, tmp, tmp3); | ||
40 | } | ||
41 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
42 | if (insn & (1 << 20)) { | ||
43 | tcg_gen_add_i32(tmp, tmp, tmp3); | ||
44 | } else { | ||
45 | - tcg_gen_sub_i32(tmp, tmp, tmp3); | ||
46 | + /* | ||
47 | + * For SMMLS, we need a 64-bit subtract. | ||
48 | + * Borrow caused by a non-zero multiplicand lowpart, | ||
49 | + * and the correct result lowpart for rounding. | ||
50 | + */ | ||
51 | + TCGv_i32 zero = tcg_const_i32(0); | ||
52 | + tcg_gen_sub2_i32(tmp2, tmp, zero, tmp3, tmp2, tmp); | ||
53 | + tcg_temp_free_i32(zero); | ||
54 | } | ||
55 | tcg_temp_free_i32(tmp3); | ||
56 | } | ||
57 | -- | 27 | -- |
58 | 2.20.1 | 28 | 2.20.1 |
59 | 29 | ||
60 | 30 | diff view generated by jsdifflib |
1 | From: Alex Bennée <alex.bennee@linaro.org> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We should at least document what this machine is about. | ||
4 | |||
5 | Reviewed-by: Graeme Gregory <graeme@nuviainc.com> | ||
3 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Message-id: 20201104165254.24822-1-alex.bennee@linaro.org |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 8 | Cc: Leif Lindholm <leif@nuviainc.com> |
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Cc: Shashi Mallela <shashi.mallela@linaro.org> |
7 | Message-id: 20190828165307.18321-10-alex.bennee@linaro.org | 10 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
11 | [PMM: fixed filename mismatch] | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | --- | 13 | --- |
10 | include/exec/cpu-defs.h | 2 +- | 14 | docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++++++++++++ |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | docs/system/target-arm.rst | 1 + |
16 | 2 files changed, 33 insertions(+) | ||
17 | create mode 100644 docs/system/arm/sbsa.rst | ||
12 | 18 | ||
13 | diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h | 19 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst |
20 | new file mode 100644 | ||
21 | index XXXXXXX..XXXXXXX | ||
22 | --- /dev/null | ||
23 | +++ b/docs/system/arm/sbsa.rst | ||
24 | @@ -XXX,XX +XXX,XX @@ | ||
25 | +Arm Server Base System Architecture Reference board (``sbsa-ref``) | ||
26 | +================================================================== | ||
27 | + | ||
28 | +While the `virt` board is a generic board platform that doesn't match | ||
29 | +any real hardware the `sbsa-ref` board intends to look like real | ||
30 | +hardware. The `Server Base System Architecture | ||
31 | +<https://developer.arm.com/documentation/den0029/latest>` defines a | ||
32 | +minimum base line of hardware support and importantly how the firmware | ||
33 | +reports that to any operating system. It is a static system that | ||
34 | +reports a very minimal DT to the firmware for non-discoverable | ||
35 | +information about components affected by the qemu command line (i.e. | ||
36 | +cpus and memory). As a result it must have a firmware specifically | ||
37 | +built to expect a certain hardware layout (as you would in a real | ||
38 | +machine). | ||
39 | + | ||
40 | +It is intended to be a machine for developing firmware and testing | ||
41 | +standards compliance with operating systems. | ||
42 | + | ||
43 | +Supported devices | ||
44 | +""""""""""""""""" | ||
45 | + | ||
46 | +The sbsa-ref board supports: | ||
47 | + | ||
48 | + - A configurable number of AArch64 CPUs | ||
49 | + - GIC version 3 | ||
50 | + - System bus AHCI controller | ||
51 | + - System bus EHCI controller | ||
52 | + - CDROM and hard disc on AHCI bus | ||
53 | + - E1000E ethernet card on PCIe bus | ||
54 | + - VGA display adaptor on PCIe bus | ||
55 | + - A generic SBSA watchdog device | ||
56 | + | ||
57 | diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst | ||
14 | index XXXXXXX..XXXXXXX 100644 | 58 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/exec/cpu-defs.h | 59 | --- a/docs/system/target-arm.rst |
16 | +++ b/include/exec/cpu-defs.h | 60 | +++ b/docs/system/target-arm.rst |
17 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUTLB { } CPUTLB; | 61 | @@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running |
18 | #endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ | 62 | arm/mps2 |
19 | 63 | arm/musca | |
20 | /* | 64 | arm/realview |
21 | - * This structure must be placed in ArchCPU immedately | 65 | + arm/sbsa |
22 | + * This structure must be placed in ArchCPU immediately | 66 | arm/versatile |
23 | * before CPUArchState, as a field named "neg". | 67 | arm/vexpress |
24 | */ | 68 | arm/aspeed |
25 | typedef struct CPUNegativeOffsetState { | ||
26 | -- | 69 | -- |
27 | 2.20.1 | 70 | 2.20.1 |
28 | 71 | ||
29 | 72 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | As explained in commit aff39be0ed97: | 3 | When using a Cortex-A15, the Virt machine does not use any |
4 | MPCore peripherals. Remove the dependency. | ||
4 | 5 | ||
5 | Both functions, object_initialize() and object_property_add_child() | 6 | Fixes: 7951c7b7c05 ("hw/arm: Express dependencies of the virt machine with Kconfig") |
6 | increase the reference counter of the new object, so one of the | 7 | Reported-by: Miroslav Rezanina <mrezanin@redhat.com> |
7 | references has to be dropped afterwards to get the reference | ||
8 | counting right. Otherwise the child object will not be properly | ||
9 | cleaned up when the parent gets destroyed. | ||
10 | Thus let's use now object_initialize_child() instead to get the | ||
11 | reference counting here right. | ||
12 | |||
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
15 | Reviewed-by: Thomas Huth <thuth@redhat.com> | 9 | Message-id: 20201107114852.271922-1-philmd@redhat.com |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Message-id: 20190823143249.8096-7-philmd@redhat.com | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 12 | --- |
20 | hw/net/xilinx_axienet.c | 17 ++++++++--------- | 13 | hw/arm/Kconfig | 1 - |
21 | 1 file changed, 8 insertions(+), 9 deletions(-) | 14 | 1 file changed, 1 deletion(-) |
22 | 15 | ||
23 | diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c | 16 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
24 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/hw/net/xilinx_axienet.c | 18 | --- a/hw/arm/Kconfig |
26 | +++ b/hw/net/xilinx_axienet.c | 19 | +++ b/hw/arm/Kconfig |
27 | @@ -XXX,XX +XXX,XX @@ static void xilinx_enet_init(Object *obj) | 20 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
28 | XilinxAXIEnet *s = XILINX_AXI_ENET(obj); | 21 | imply VFIO_PLATFORM |
29 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 22 | imply VFIO_XGMAC |
30 | 23 | imply TPM_TIS_SYSBUS | |
31 | - object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev), | 24 | - select A15MPCORE |
32 | - TYPE_XILINX_AXI_ENET_DATA_STREAM); | 25 | select ACPI |
33 | - object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev), | 26 | select ARM_SMMUV3 |
34 | - TYPE_XILINX_AXI_ENET_CONTROL_STREAM); | 27 | select GPIO_KEY |
35 | - object_property_add_child(OBJECT(s), "axistream-connected-target", | ||
36 | - (Object *)&s->rx_data_dev, &error_abort); | ||
37 | - object_property_add_child(OBJECT(s), "axistream-control-connected-target", | ||
38 | - (Object *)&s->rx_control_dev, &error_abort); | ||
39 | - | ||
40 | + object_initialize_child(OBJECT(s), "axistream-connected-target", | ||
41 | + &s->rx_data_dev, sizeof(s->rx_data_dev), | ||
42 | + TYPE_XILINX_AXI_ENET_DATA_STREAM, &error_abort, | ||
43 | + NULL); | ||
44 | + object_initialize_child(OBJECT(s), "axistream-control-connected-target", | ||
45 | + &s->rx_control_dev, sizeof(s->rx_control_dev), | ||
46 | + TYPE_XILINX_AXI_ENET_CONTROL_STREAM, &error_abort, | ||
47 | + NULL); | ||
48 | sysbus_init_irq(sbd, &s->irq); | ||
49 | |||
50 | memory_region_init_io(&s->iomem, OBJECT(s), &enet_ops, s, "enet", 0x40000); | ||
51 | -- | 28 | -- |
52 | 2.20.1 | 29 | 2.20.1 |
53 | 30 | ||
54 | 31 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This reverts commit 3cb36637157088892e9e33ddb1034bffd1251d3b. | 3 | The helper function did not get updated when we reorganized |
4 | the vector register file for SVE. Since then, the neon dregs | ||
5 | are non-sequential and cannot be simply indexed. | ||
4 | 6 | ||
5 | Despite the fact that the text for the call to gen_exception_insn | 7 | At the same time, make the helper function operate on 64-bit |
6 | is identical for aarch64 and aarch32, the implementation inside | 8 | quantities so that we do not have to call it twice. |
7 | gen_exception_insn is totally different. | ||
8 | 9 | ||
9 | This fixes exceptions raised from aarch64. | 10 | Fixes: c39c2b9043e |
10 | 11 | Reported-by: Ard Biesheuvel <ardb@kernel.org> | |
11 | Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> | 13 | [PMM: use aa32_vfp_dreg() rather than opencoding] |
14 | Message-id: 20190826151536.6771-2-richard.henderson@linaro.org | 14 | Message-id: 20201105171126.88014-1-richard.henderson@linaro.org |
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 17 | --- |
17 | target/arm/translate-a64.h | 2 ++ | 18 | target/arm/helper.h | 2 +- |
18 | target/arm/translate.h | 2 -- | 19 | target/arm/op_helper.c | 23 +++++++++-------- |
19 | target/arm/translate-a64.c | 7 +++++++ | 20 | target/arm/translate-neon.c.inc | 44 +++++++++++---------------------- |
20 | target/arm/translate-vfp.inc.c | 3 ++- | 21 | 3 files changed, 29 insertions(+), 40 deletions(-) |
21 | target/arm/translate.c | 22 ++++++++++------------ | ||
22 | 5 files changed, 21 insertions(+), 15 deletions(-) | ||
23 | 22 | ||
24 | diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h | 23 | diff --git a/target/arm/helper.h b/target/arm/helper.h |
25 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/target/arm/translate-a64.h | 25 | --- a/target/arm/helper.h |
27 | +++ b/target/arm/translate-a64.h | 26 | +++ b/target/arm/helper.h |
28 | @@ -XXX,XX +XXX,XX @@ | 27 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr) |
29 | #ifndef TARGET_ARM_TRANSLATE_A64_H | 28 | DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr) |
30 | #define TARGET_ARM_TRANSLATE_A64_H | 29 | DEF_HELPER_FLAGS_1(recpe_u32, TCG_CALL_NO_RWG, i32, i32) |
31 | 30 | DEF_HELPER_FLAGS_1(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32) | |
32 | +void unallocated_encoding(DisasContext *s); | 31 | -DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i32, i32, i32, ptr, i32) |
33 | + | 32 | +DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i64, env, i32, i64, i64) |
34 | #define unsupported_encoding(s, insn) \ | 33 | |
35 | do { \ | 34 | DEF_HELPER_3(shl_cc, i32, env, i32, i32) |
36 | qemu_log_mask(LOG_UNIMP, \ | 35 | DEF_HELPER_3(shr_cc, i32, env, i32, i32) |
37 | diff --git a/target/arm/translate.h b/target/arm/translate.h | 36 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
38 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate.h | 38 | --- a/target/arm/op_helper.c |
40 | +++ b/target/arm/translate.h | 39 | +++ b/target/arm/op_helper.c |
41 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasCompare { | 40 | @@ -XXX,XX +XXX,XX @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, |
42 | bool value_global; | 41 | cpu_loop_exit_restore(cs, ra); |
43 | } DisasCompare; | 42 | } |
44 | 43 | ||
45 | -void unallocated_encoding(DisasContext *s); | 44 | -uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn, |
46 | - | 45 | - uint32_t maxindex) |
47 | /* Share the TCG temporaries common between 32 and 64 bit modes. */ | 46 | +uint64_t HELPER(neon_tbl)(CPUARMState *env, uint32_t desc, |
48 | extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF; | 47 | + uint64_t ireg, uint64_t def) |
49 | extern TCGv_i64 cpu_exclusive_addr; | 48 | { |
50 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 49 | - uint32_t val, shift; |
50 | - uint64_t *table = vn; | ||
51 | + uint64_t tmp, val = 0; | ||
52 | + uint32_t maxindex = ((desc & 3) + 1) * 8; | ||
53 | + uint32_t base_reg = desc >> 2; | ||
54 | + uint32_t shift, index, reg; | ||
55 | |||
56 | - val = 0; | ||
57 | - for (shift = 0; shift < 32; shift += 8) { | ||
58 | - uint32_t index = (ireg >> shift) & 0xff; | ||
59 | + for (shift = 0; shift < 64; shift += 8) { | ||
60 | + index = (ireg >> shift) & 0xff; | ||
61 | if (index < maxindex) { | ||
62 | - uint32_t tmp = (table[index >> 3] >> ((index & 7) << 3)) & 0xff; | ||
63 | - val |= tmp << shift; | ||
64 | + reg = base_reg + (index >> 3); | ||
65 | + tmp = *aa32_vfp_dreg(env, reg); | ||
66 | + tmp = ((tmp >> ((index & 7) << 3)) & 0xff) << shift; | ||
67 | } else { | ||
68 | - val |= def & (0xff << shift); | ||
69 | + tmp = def & (0xffull << shift); | ||
70 | } | ||
71 | + val |= tmp; | ||
72 | } | ||
73 | return val; | ||
74 | } | ||
75 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
51 | index XXXXXXX..XXXXXXX 100644 | 76 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/target/arm/translate-a64.c | 77 | --- a/target/arm/translate-neon.c.inc |
53 | +++ b/target/arm/translate-a64.c | 78 | +++ b/target/arm/translate-neon.c.inc |
54 | @@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest) | 79 | @@ -XXX,XX +XXX,XX @@ static bool trans_VEXT(DisasContext *s, arg_VEXT *a) |
80 | |||
81 | static bool trans_VTBL(DisasContext *s, arg_VTBL *a) | ||
82 | { | ||
83 | - int n; | ||
84 | - TCGv_i32 tmp, tmp2, tmp3, tmp4; | ||
85 | - TCGv_ptr ptr1; | ||
86 | + TCGv_i64 val, def; | ||
87 | + TCGv_i32 desc; | ||
88 | |||
89 | if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { | ||
90 | return false; | ||
91 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) | ||
92 | return true; | ||
55 | } | 93 | } |
56 | } | 94 | |
57 | 95 | - n = a->len + 1; | |
58 | +void unallocated_encoding(DisasContext *s) | 96 | - if ((a->vn + n) > 32) { |
59 | +{ | 97 | + if ((a->vn + a->len + 1) > 32) { |
60 | + /* Unallocated and reserved encodings are uncategorized */ | 98 | /* |
61 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | 99 | * This is UNPREDICTABLE; we choose to UNDEF to avoid the |
62 | + default_exception_el(s)); | 100 | * helper function running off the end of the register file. |
63 | +} | 101 | */ |
64 | + | ||
65 | static void init_tmp_a64_array(DisasContext *s) | ||
66 | { | ||
67 | #ifdef CONFIG_DEBUG_TCG | ||
68 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/target/arm/translate-vfp.inc.c | ||
71 | +++ b/target/arm/translate-vfp.inc.c | ||
72 | @@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled) | ||
73 | |||
74 | if (!s->vfp_enabled && !ignore_vfp_enabled) { | ||
75 | assert(!arm_dc_feature(s, ARM_FEATURE_M)); | ||
76 | - unallocated_encoding(s); | ||
77 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
78 | + default_exception_el(s)); | ||
79 | return false; | 102 | return false; |
80 | } | 103 | } |
81 | 104 | - n <<= 3; | |
82 | diff --git a/target/arm/translate.c b/target/arm/translate.c | 105 | - tmp = tcg_temp_new_i32(); |
83 | index XXXXXXX..XXXXXXX 100644 | 106 | - if (a->op) { |
84 | --- a/target/arm/translate.c | 107 | - read_neon_element32(tmp, a->vd, 0, MO_32); |
85 | +++ b/target/arm/translate.c | 108 | - } else { |
86 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) | 109 | - tcg_gen_movi_i32(tmp, 0); |
87 | s->base.is_jmp = DISAS_NORETURN; | 110 | - } |
111 | - tmp2 = tcg_temp_new_i32(); | ||
112 | - read_neon_element32(tmp2, a->vm, 0, MO_32); | ||
113 | - ptr1 = vfp_reg_ptr(true, a->vn); | ||
114 | - tmp4 = tcg_const_i32(n); | ||
115 | - gen_helper_neon_tbl(tmp2, tmp2, tmp, ptr1, tmp4); | ||
116 | |||
117 | + desc = tcg_const_i32((a->vn << 2) | a->len); | ||
118 | + def = tcg_temp_new_i64(); | ||
119 | if (a->op) { | ||
120 | - read_neon_element32(tmp, a->vd, 1, MO_32); | ||
121 | + read_neon_element64(def, a->vd, 0, MO_64); | ||
122 | } else { | ||
123 | - tcg_gen_movi_i32(tmp, 0); | ||
124 | + tcg_gen_movi_i64(def, 0); | ||
125 | } | ||
126 | - tmp3 = tcg_temp_new_i32(); | ||
127 | - read_neon_element32(tmp3, a->vm, 1, MO_32); | ||
128 | - gen_helper_neon_tbl(tmp3, tmp3, tmp, ptr1, tmp4); | ||
129 | - tcg_temp_free_i32(tmp); | ||
130 | - tcg_temp_free_i32(tmp4); | ||
131 | - tcg_temp_free_ptr(ptr1); | ||
132 | + val = tcg_temp_new_i64(); | ||
133 | + read_neon_element64(val, a->vm, 0, MO_64); | ||
134 | |||
135 | - write_neon_element32(tmp2, a->vd, 0, MO_32); | ||
136 | - write_neon_element32(tmp3, a->vd, 1, MO_32); | ||
137 | - tcg_temp_free_i32(tmp2); | ||
138 | - tcg_temp_free_i32(tmp3); | ||
139 | + gen_helper_neon_tbl(val, cpu_env, desc, val, def); | ||
140 | + write_neon_element64(val, a->vd, 0, MO_64); | ||
141 | + | ||
142 | + tcg_temp_free_i64(def); | ||
143 | + tcg_temp_free_i64(val); | ||
144 | + tcg_temp_free_i32(desc); | ||
145 | return true; | ||
88 | } | 146 | } |
89 | 147 | ||
90 | -void unallocated_encoding(DisasContext *s) | ||
91 | -{ | ||
92 | - /* Unallocated and reserved encodings are uncategorized */ | ||
93 | - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
94 | - default_exception_el(s)); | ||
95 | -} | ||
96 | - | ||
97 | /* Force a TB lookup after an instruction that changes the CPU state. */ | ||
98 | static inline void gen_lookup_tb(DisasContext *s) | ||
99 | { | ||
100 | @@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm) | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | - unallocated_encoding(s); | ||
105 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
106 | + default_exception_el(s)); | ||
107 | } | ||
108 | |||
109 | static inline void gen_add_data_offset(DisasContext *s, unsigned int insn, | ||
110 | @@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s, | ||
111 | } | ||
112 | |||
113 | if (undef) { | ||
114 | - unallocated_encoding(s); | ||
115 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
116 | + default_exception_el(s)); | ||
117 | return; | ||
118 | } | ||
119 | |||
120 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
121 | break; | ||
122 | default: | ||
123 | illegal_op: | ||
124 | - unallocated_encoding(s); | ||
125 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
126 | + default_exception_el(s)); | ||
127 | break; | ||
128 | } | ||
129 | } | ||
130 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn) | ||
131 | } | ||
132 | return; | ||
133 | illegal_op: | ||
134 | - unallocated_encoding(s); | ||
135 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
136 | + default_exception_el(s)); | ||
137 | } | ||
138 | |||
139 | static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
140 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
141 | return; | ||
142 | illegal_op: | ||
143 | undef: | ||
144 | - unallocated_encoding(s); | ||
145 | + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), | ||
146 | + default_exception_el(s)); | ||
147 | } | ||
148 | |||
149 | static bool insn_crosses_page(CPUARMState *env, DisasContext *s) | ||
150 | -- | 148 | -- |
151 | 2.20.1 | 149 | 2.20.1 |
152 | 150 | ||
153 | 151 | diff view generated by jsdifflib |
1 | From: "Emilio G. Cota" <cota@braap.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 3 | We can use one MPC per SRAM bank, but we currently only wire the |
4 | Signed-off-by: Emilio G. Cota <cota@braap.org> | 4 | IRQ from the first expansion MPC to the IRQ splitter. Fix that. |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | |
6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Fixes: bb75e16d5e6 ("hw/arm/iotkit: Wire up MPC interrupt lines") |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Message-id: 20190828165307.18321-8-alex.bennee@linaro.org | 8 | Message-id: 20201107193403.436146-2-f4bug@amsat.org |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 11 | --- |
11 | accel/tcg/atomic_template.h | 2 +- | 12 | hw/arm/armsse.c | 3 ++- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
13 | 14 | ||
14 | diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h | 15 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/accel/tcg/atomic_template.h | 17 | --- a/hw/arm/armsse.c |
17 | +++ b/accel/tcg/atomic_template.h | 18 | +++ b/hw/arm/armsse.c |
18 | @@ -XXX,XX +XXX,XX @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, | 19 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) |
19 | 20 | qdev_get_gpio_in(dev_splitter, 0)); | |
20 | #define GEN_ATOMIC_HELPER(X) \ | 21 | qdev_connect_gpio_out(dev_splitter, 0, |
21 | ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \ | 22 | qdev_get_gpio_in_named(dev_secctl, |
22 | - ABI_TYPE val EXTRA_ARGS) \ | 23 | - "mpc_status", 0)); |
23 | + ABI_TYPE val EXTRA_ARGS) \ | 24 | + "mpc_status", |
24 | { \ | 25 | + i - IOTS_NUM_EXP_MPC)); |
25 | ATOMIC_MMU_DECLS; \ | 26 | } |
26 | DATA_TYPE *haddr = ATOMIC_MMU_LOOKUP; \ | 27 | |
28 | qdev_connect_gpio_out(dev_splitter, 1, | ||
27 | -- | 29 | -- |
28 | 2.20.1 | 30 | 2.20.1 |
29 | 31 | ||
30 | 32 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | First up: This is not the way the hardware behaves. | 3 | The system configuration controller (SYSCFG) doesn't have |
4 | any output IRQ (and the INTC input #71 belongs to the UART6). | ||
5 | Remove the invalid code. | ||
4 | 6 | ||
5 | However, it helps resolve real-world problems with short periods being | 7 | Fixes: db635521a02 ("stm32f205: Add the stm32f205 SoC") |
6 | used under Linux. Commit 4451d3f59f2a ("clocksource/drivers/fttmr010: | 8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Fix set_next_event handler") in Linux fixed the timer driver to | 9 | Message-id: 20201107193403.436146-3-f4bug@amsat.org |
8 | correctly schedule the next event for the Aspeed controller, and in | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | combination with 5daa8212c08e ("ARM: dts: aspeed: Describe random number | ||
10 | device") Linux will now set a timer with a period as low as 1us. | ||
11 | |||
12 | Configuring a qemu timer with such a short period results in spending | ||
13 | time handling the interrupt in the model rather than executing guest | ||
14 | code, leading to noticeable "sticky" behaviour in the guest. | ||
15 | |||
16 | The behaviour of Linux is correct with respect to the hardware, so we | ||
17 | need to improve our handling under emulation. The approach chosen is to | ||
18 | provide back-pressure information by calculating an acceptable minimum | ||
19 | number of ticks to be set on the model. Under Linux an additional read | ||
20 | is added in the timer configuration path to detect back-pressure, which | ||
21 | will never occur on hardware. However if back-pressure is observed, the | ||
22 | driver alerts the clock event subsystem, which then performs its own | ||
23 | next event dilation via a config option - d1748302f70b ("clockevents: | ||
24 | Make minimum delay adjustments configurable") | ||
25 | |||
26 | A minimum period of 5us was experimentally determined on a Lenovo | ||
27 | T480s, which I've increased to 20us for "safety". | ||
28 | |||
29 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | ||
30 | Reviewed-by: Joel Stanley <joel@jms.id.au> | ||
31 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
32 | Tested-by: Joel Stanley <joel@jms.id.au> | ||
33 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
34 | Message-id: 20190704055150.4899-1-clg@kaod.org | ||
35 | [clg: - changed the computation of min_ticks to be done each time the | ||
36 | timer value is reloaded. It removes the ordering issue of the | ||
37 | timer and scu reset handlers but is slightly slower ] | ||
38 | - introduced TIMER_MIN_NS | ||
39 | - introduced calculate_min_ticks() ] | ||
40 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
42 | --- | 12 | --- |
43 | hw/timer/aspeed_timer.c | 17 ++++++++++++++++- | 13 | include/hw/misc/stm32f2xx_syscfg.h | 2 -- |
44 | 1 file changed, 16 insertions(+), 1 deletion(-) | 14 | hw/arm/stm32f205_soc.c | 1 - |
15 | hw/misc/stm32f2xx_syscfg.c | 2 -- | ||
16 | 3 files changed, 5 deletions(-) | ||
45 | 17 | ||
46 | diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c | 18 | diff --git a/include/hw/misc/stm32f2xx_syscfg.h b/include/hw/misc/stm32f2xx_syscfg.h |
47 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
48 | --- a/hw/timer/aspeed_timer.c | 20 | --- a/include/hw/misc/stm32f2xx_syscfg.h |
49 | +++ b/hw/timer/aspeed_timer.c | 21 | +++ b/include/hw/misc/stm32f2xx_syscfg.h |
50 | @@ -XXX,XX +XXX,XX @@ enum timer_ctrl_op { | 22 | @@ -XXX,XX +XXX,XX @@ struct STM32F2XXSyscfgState { |
51 | op_pulse_enable | 23 | uint32_t syscfg_exticr3; |
24 | uint32_t syscfg_exticr4; | ||
25 | uint32_t syscfg_cmpcr; | ||
26 | - | ||
27 | - qemu_irq irq; | ||
52 | }; | 28 | }; |
53 | 29 | ||
54 | +/* | 30 | #endif /* HW_STM32F2XX_SYSCFG_H */ |
55 | + * Minimum value of the reload register to filter out short period | 31 | diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c |
56 | + * timers which have a noticeable impact in emulation. 5us should be | 32 | index XXXXXXX..XXXXXXX 100644 |
57 | + * enough, use 20us for "safety". | 33 | --- a/hw/arm/stm32f205_soc.c |
58 | + */ | 34 | +++ b/hw/arm/stm32f205_soc.c |
59 | +#define TIMER_MIN_NS (20 * SCALE_US) | 35 | @@ -XXX,XX +XXX,XX @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) |
60 | + | 36 | } |
61 | /** | 37 | busdev = SYS_BUS_DEVICE(dev); |
62 | * Avoid mutual references between AspeedTimerCtrlState and AspeedTimer | 38 | sysbus_mmio_map(busdev, 0, 0x40013800); |
63 | * structs, as it's a waste of memory. The ptimer BH callback needs to know | 39 | - sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, 71)); |
64 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t calculate_ticks(struct AspeedTimer *t, uint64_t now_ns) | 40 | |
65 | return t->reload - MIN(t->reload, ticks); | 41 | /* Attach UART (uses USART registers) and USART controllers */ |
66 | } | 42 | for (i = 0; i < STM_NUM_USARTS; i++) { |
67 | 43 | diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c | |
68 | +static uint32_t calculate_min_ticks(AspeedTimer *t, uint32_t value) | 44 | index XXXXXXX..XXXXXXX 100644 |
69 | +{ | 45 | --- a/hw/misc/stm32f2xx_syscfg.c |
70 | + uint32_t rate = calculate_rate(t); | 46 | +++ b/hw/misc/stm32f2xx_syscfg.c |
71 | + uint32_t min_ticks = muldiv64(TIMER_MIN_NS, rate, NANOSECONDS_PER_SECOND); | 47 | @@ -XXX,XX +XXX,XX @@ static void stm32f2xx_syscfg_init(Object *obj) |
72 | + | ||
73 | + return value < min_ticks ? min_ticks : value; | ||
74 | +} | ||
75 | + | ||
76 | static inline uint64_t calculate_time(struct AspeedTimer *t, uint32_t ticks) | ||
77 | { | 48 | { |
78 | uint64_t delta_ns; | 49 | STM32F2XXSyscfgState *s = STM32F2XX_SYSCFG(obj); |
79 | @@ -XXX,XX +XXX,XX @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg, | 50 | |
80 | switch (reg) { | 51 | - sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); |
81 | case TIMER_REG_RELOAD: | 52 | - |
82 | old_reload = t->reload; | 53 | memory_region_init_io(&s->mmio, obj, &stm32f2xx_syscfg_ops, s, |
83 | - t->reload = value; | 54 | TYPE_STM32F2XX_SYSCFG, 0x400); |
84 | + t->reload = calculate_min_ticks(t, value); | 55 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); |
85 | |||
86 | /* If the reload value was not previously set, or zero, and | ||
87 | * the current value is valid, try to start the timer if it is | ||
88 | -- | 56 | -- |
89 | 2.20.1 | 57 | 2.20.1 |
90 | 58 | ||
91 | 59 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | memory_region_iommu_replay_all is not used. Remove it. | 3 | omap2420_mpu_init() introduced in commit 827df9f3c5f ("Add basic |
4 | OMAP2 chip support") takes care of creating the 3 UARTs. | ||
4 | 5 | ||
5 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | 6 | Then commit 58a26b477e9 ("Emulate a serial bluetooth HCI with H4+ |
6 | Reported-by: Peter Maydell <peter.maydell@linaro.org> | 7 | extensions and attach to n8x0's UART") added n8x0_uart_setup() |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | which create the UART and connects it to an IRQ output, |
8 | Reviewed-by: Peter Xu <peterx@redhat.com> | 9 | overwritting the existing peripheral and its IRQ connection. |
9 | Message-id: 20190822172350.12008-2-eric.auger@redhat.com | 10 | This is incorrect. |
11 | |||
12 | Fortunately we don't need to fix this, because commit 6da68df7f9b | ||
13 | ("hw/arm/nseries: Replace the bluetooth chardev with a "null" | ||
14 | chardev") removed the use of this peripheral. We can simply | ||
15 | remove the code. | ||
16 | |||
17 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Message-id: 20201107193403.436146-4-f4bug@amsat.org | ||
19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 21 | --- |
12 | include/exec/memory.h | 10 ---------- | 22 | hw/arm/nseries.c | 11 ----------- |
13 | memory.c | 9 --------- | 23 | 1 file changed, 11 deletions(-) |
14 | 2 files changed, 19 deletions(-) | ||
15 | 24 | ||
16 | diff --git a/include/exec/memory.h b/include/exec/memory.h | 25 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
17 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/exec/memory.h | 27 | --- a/hw/arm/nseries.c |
19 | +++ b/include/exec/memory.h | 28 | +++ b/hw/arm/nseries.c |
20 | @@ -XXX,XX +XXX,XX @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, | 29 | @@ -XXX,XX +XXX,XX @@ static void n8x0_cbus_setup(struct n800_s *s) |
21 | */ | 30 | cbus_attach(cbus, s->tahvo = tahvo_init(tahvo_irq, 1)); |
22 | void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n); | ||
23 | |||
24 | -/** | ||
25 | - * memory_region_iommu_replay_all: replay existing IOMMU translations | ||
26 | - * to all the notifiers registered. | ||
27 | - * | ||
28 | - * Note: this is not related to record-and-replay functionality. | ||
29 | - * | ||
30 | - * @iommu_mr: the memory region to observe | ||
31 | - */ | ||
32 | -void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr); | ||
33 | - | ||
34 | /** | ||
35 | * memory_region_unregister_iommu_notifier: unregister a notifier for | ||
36 | * changes to IOMMU translation entries. | ||
37 | diff --git a/memory.c b/memory.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/memory.c | ||
40 | +++ b/memory.c | ||
41 | @@ -XXX,XX +XXX,XX @@ void memory_region_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n) | ||
42 | } | ||
43 | } | 31 | } |
44 | 32 | ||
45 | -void memory_region_iommu_replay_all(IOMMUMemoryRegion *iommu_mr) | 33 | -static void n8x0_uart_setup(struct n800_s *s) |
46 | -{ | 34 | -{ |
47 | - IOMMUNotifier *notifier; | 35 | - Chardev *radio = qemu_chr_new("bt-dummy-uart", "null", NULL); |
48 | - | 36 | - /* |
49 | - IOMMU_NOTIFIER_FOREACH(notifier, iommu_mr) { | 37 | - * Note: We used to connect N8X0_BT_RESET_GPIO and N8X0_BT_WKUP_GPIO |
50 | - memory_region_iommu_replay(iommu_mr, notifier); | 38 | - * here, but this code has been removed with the bluetooth backend. |
51 | - } | 39 | - */ |
40 | - omap_uart_attach(s->mpu->uart[BT_UART], radio); | ||
52 | -} | 41 | -} |
53 | - | 42 | - |
54 | void memory_region_unregister_iommu_notifier(MemoryRegion *mr, | 43 | static void n8x0_usb_setup(struct n800_s *s) |
55 | IOMMUNotifier *n) | ||
56 | { | 44 | { |
45 | SysBusDevice *dev; | ||
46 | @@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine, | ||
47 | n8x0_spi_setup(s); | ||
48 | n8x0_dss_setup(s); | ||
49 | n8x0_cbus_setup(s); | ||
50 | - n8x0_uart_setup(s); | ||
51 | if (machine_usb(machine)) { | ||
52 | n8x0_usb_setup(s); | ||
53 | } | ||
57 | -- | 54 | -- |
58 | 2.20.1 | 55 | 2.20.1 |
59 | 56 | ||
60 | 57 | diff view generated by jsdifflib |
1 | From: Alex Bennée <alex.bennee@linaro.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Commit a5e0b3311 removed these in favour of querying machine | 3 | The MusicPal board code connects both of the IRQ outputs of the UART |
4 | properties. Remove the extern declarations as well. | 4 | to the same INTC qemu_irq. Connecting two qemu_irqs outputs directly |
5 | to the same input is not valid as it produces subtly wrong behaviour | ||
6 | (for instance if both the IRQ lines are high, and then one goes | ||
7 | low, the INTC input will see this as a high-to-low transition | ||
8 | even though the second IRQ line should still be holding it high). | ||
5 | 9 | ||
6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 10 | This kind of wiring needs an explicitly created OR gate; add one. |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 11 | |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 12 | Inspired-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20190828165307.18321-6-alex.bennee@linaro.org | 13 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Cc: Like Xu <like.xu@linux.intel.com> | 14 | Message-id: 20201107193403.436146-5-f4bug@amsat.org |
11 | Message-Id: <20190711130546.18578-1-alex.bennee@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 17 | --- |
14 | include/sysemu/sysemu.h | 2 -- | 18 | hw/arm/musicpal.c | 17 +++++++++++++---- |
15 | 1 file changed, 2 deletions(-) | 19 | hw/arm/Kconfig | 1 + |
20 | 2 files changed, 14 insertions(+), 4 deletions(-) | ||
16 | 21 | ||
17 | diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h | 22 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
18 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/sysemu/sysemu.h | 24 | --- a/hw/arm/musicpal.c |
20 | +++ b/include/sysemu/sysemu.h | 25 | +++ b/hw/arm/musicpal.c |
21 | @@ -XXX,XX +XXX,XX @@ extern const char *keyboard_layout; | 26 | @@ -XXX,XX +XXX,XX @@ |
22 | extern int win2k_install_hack; | 27 | #include "ui/console.h" |
23 | extern int alt_grab; | 28 | #include "hw/i2c/i2c.h" |
24 | extern int ctrl_grab; | 29 | #include "hw/irq.h" |
25 | -extern int smp_cpus; | 30 | +#include "hw/or-irq.h" |
26 | -extern unsigned int max_cpus; | 31 | #include "hw/audio/wm8750.h" |
27 | extern int cursor_hide; | 32 | #include "sysemu/block-backend.h" |
28 | extern int graphic_rotate; | 33 | #include "sysemu/runstate.h" |
29 | extern int no_quit; | 34 | @@ -XXX,XX +XXX,XX @@ |
35 | #define MP_TIMER4_IRQ 7 | ||
36 | #define MP_EHCI_IRQ 8 | ||
37 | #define MP_ETH_IRQ 9 | ||
38 | -#define MP_UART1_IRQ 11 | ||
39 | -#define MP_UART2_IRQ 11 | ||
40 | +#define MP_UART_SHARED_IRQ 11 | ||
41 | #define MP_GPIO_IRQ 12 | ||
42 | #define MP_RTC_IRQ 28 | ||
43 | #define MP_AUDIO_IRQ 30 | ||
44 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | ||
45 | ARMCPU *cpu; | ||
46 | qemu_irq pic[32]; | ||
47 | DeviceState *dev; | ||
48 | + DeviceState *uart_orgate; | ||
49 | DeviceState *i2c_dev; | ||
50 | DeviceState *lcd_dev; | ||
51 | DeviceState *key_dev; | ||
52 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | ||
53 | pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], | ||
54 | pic[MP_TIMER4_IRQ], NULL); | ||
55 | |||
56 | - serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ], | ||
57 | + /* Logically OR both UART IRQs together */ | ||
58 | + uart_orgate = DEVICE(object_new(TYPE_OR_IRQ)); | ||
59 | + object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal); | ||
60 | + qdev_realize_and_unref(uart_orgate, NULL, &error_fatal); | ||
61 | + qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]); | ||
62 | + | ||
63 | + serial_mm_init(address_space_mem, MP_UART1_BASE, 2, | ||
64 | + qdev_get_gpio_in(uart_orgate, 0), | ||
65 | 1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN); | ||
66 | - serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ], | ||
67 | + serial_mm_init(address_space_mem, MP_UART2_BASE, 2, | ||
68 | + qdev_get_gpio_in(uart_orgate, 1), | ||
69 | 1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN); | ||
70 | |||
71 | /* Register flash */ | ||
72 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/hw/arm/Kconfig | ||
75 | +++ b/hw/arm/Kconfig | ||
76 | @@ -XXX,XX +XXX,XX @@ config MUSCA | ||
77 | |||
78 | config MUSICPAL | ||
79 | bool | ||
80 | + select OR_IRQ | ||
81 | select BITBANG_I2C | ||
82 | select MARVELL_88W8618 | ||
83 | select PTIMER | ||
30 | -- | 84 | -- |
31 | 2.20.1 | 85 | 2.20.1 |
32 | 86 | ||
33 | 87 | diff view generated by jsdifflib |
1 | From: Eric Auger <eric.auger@redhat.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | An IOVA/ASID invalidation is notified to all IOMMU Memory Regions | 3 | We don't need to fill the full pic[] array if we only use |
4 | through smmuv3_inv_notifiers_iova/smmuv3_notify_iova. | 4 | few of the interrupt lines. Directly call qdev_get_gpio_in() |
5 | when necessary. | ||
5 | 6 | ||
6 | When the notification occurs it is possible that some of the | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | PCIe devices associated to the notified regions do not have a | 8 | Message-id: 20201107193403.436146-6-f4bug@amsat.org |
8 | valid stream table entry. In that case we output a LOG_GUEST_ERROR | ||
9 | message, for example: | ||
10 | |||
11 | invalid sid=<SID> (L1STD span=0) | ||
12 | "smmuv3_notify_iova error decoding the configuration for iommu mr=<MR> | ||
13 | |||
14 | This is unfortunate as the user gets the impression that there | ||
15 | are some translation decoding errors whereas there are not. | ||
16 | |||
17 | This patch adds a new field in SMMUEventInfo that tells whether | ||
18 | the detection of an invalid STE must lead to an error report. | ||
19 | invalid_ste_allowed is set before doing the invalidations and | ||
20 | kept unset on actual translation. | ||
21 | |||
22 | The other configuration decoding error messages are kept since if the | ||
23 | STE is valid then the rest of the config must be correct. | ||
24 | |||
25 | Signed-off-by: Eric Auger <eric.auger@redhat.com> | ||
26 | Message-id: 20190822172350.12008-6-eric.auger@redhat.com | ||
27 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | --- | 11 | --- |
30 | hw/arm/smmuv3-internal.h | 1 + | 12 | hw/arm/musicpal.c | 25 +++++++++++++------------ |
31 | hw/arm/smmuv3.c | 19 +++++++++++-------- | 13 | 1 file changed, 13 insertions(+), 12 deletions(-) |
32 | 2 files changed, 12 insertions(+), 8 deletions(-) | ||
33 | 14 | ||
34 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h | 15 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
35 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/hw/arm/smmuv3-internal.h | 17 | --- a/hw/arm/musicpal.c |
37 | +++ b/hw/arm/smmuv3-internal.h | 18 | +++ b/hw/arm/musicpal.c |
38 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUEventInfo { | 19 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info musicpal_binfo = { |
39 | uint32_t sid; | 20 | static void musicpal_init(MachineState *machine) |
40 | bool recorded; | ||
41 | bool record_trans_faults; | ||
42 | + bool inval_ste_allowed; | ||
43 | union { | ||
44 | struct { | ||
45 | uint32_t ssid; | ||
46 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/arm/smmuv3.c | ||
49 | +++ b/hw/arm/smmuv3.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static int decode_ste(SMMUv3State *s, SMMUTransCfg *cfg, | ||
51 | uint32_t config; | ||
52 | |||
53 | if (!STE_VALID(ste)) { | ||
54 | - qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n"); | ||
55 | + if (!event->inval_ste_allowed) { | ||
56 | + qemu_log_mask(LOG_GUEST_ERROR, "invalid STE\n"); | ||
57 | + } | ||
58 | goto bad_ste; | ||
59 | } | ||
60 | |||
61 | @@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, | ||
62 | |||
63 | if (!span) { | ||
64 | /* l2ptr is not valid */ | ||
65 | - qemu_log_mask(LOG_GUEST_ERROR, | ||
66 | - "invalid sid=%d (L1STD span=0)\n", sid); | ||
67 | + if (!event->inval_ste_allowed) { | ||
68 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
69 | + "invalid sid=%d (L1STD span=0)\n", sid); | ||
70 | + } | ||
71 | event->type = SMMU_EVT_C_BAD_STREAMID; | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | @@ -XXX,XX +XXX,XX @@ static IOMMUTLBEntry smmuv3_translate(IOMMUMemoryRegion *mr, hwaddr addr, | ||
75 | SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu); | ||
76 | SMMUv3State *s = sdev->smmu; | ||
77 | uint32_t sid = smmu_get_sid(sdev); | ||
78 | - SMMUEventInfo event = {.type = SMMU_EVT_NONE, .sid = sid}; | ||
79 | + SMMUEventInfo event = {.type = SMMU_EVT_NONE, | ||
80 | + .sid = sid, | ||
81 | + .inval_ste_allowed = false}; | ||
82 | SMMUPTWEventInfo ptw_info = {}; | ||
83 | SMMUTranslationStatus status; | ||
84 | SMMUState *bs = ARM_SMMU(s); | ||
85 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, | ||
86 | dma_addr_t iova) | ||
87 | { | 21 | { |
88 | SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu); | 22 | ARMCPU *cpu; |
89 | - SMMUEventInfo event = {}; | 23 | - qemu_irq pic[32]; |
90 | + SMMUEventInfo event = {.inval_ste_allowed = true}; | 24 | DeviceState *dev; |
91 | SMMUTransTableInfo *tt; | 25 | + DeviceState *pic; |
92 | SMMUTransCfg *cfg; | 26 | DeviceState *uart_orgate; |
93 | IOMMUTLBEntry entry; | 27 | DeviceState *i2c_dev; |
94 | 28 | DeviceState *lcd_dev; | |
95 | cfg = smmuv3_get_config(sdev, &event); | 29 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) |
96 | if (!cfg) { | 30 | &error_fatal); |
97 | - qemu_log_mask(LOG_GUEST_ERROR, | 31 | memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram); |
98 | - "%s error decoding the configuration for iommu mr=%s\n", | 32 | |
99 | - __func__, mr->parent_obj.name); | 33 | - dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE, |
100 | return; | 34 | + pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE, |
101 | } | 35 | qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); |
102 | 36 | - for (i = 0; i < 32; i++) { | |
37 | - pic[i] = qdev_get_gpio_in(dev, i); | ||
38 | - } | ||
39 | - sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, pic[MP_TIMER1_IRQ], | ||
40 | - pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], | ||
41 | - pic[MP_TIMER4_IRQ], NULL); | ||
42 | + sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, | ||
43 | + qdev_get_gpio_in(pic, MP_TIMER1_IRQ), | ||
44 | + qdev_get_gpio_in(pic, MP_TIMER2_IRQ), | ||
45 | + qdev_get_gpio_in(pic, MP_TIMER3_IRQ), | ||
46 | + qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL); | ||
47 | |||
48 | /* Logically OR both UART IRQs together */ | ||
49 | uart_orgate = DEVICE(object_new(TYPE_OR_IRQ)); | ||
50 | object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal); | ||
51 | qdev_realize_and_unref(uart_orgate, NULL, &error_fatal); | ||
52 | - qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]); | ||
53 | + qdev_connect_gpio_out(DEVICE(uart_orgate), 0, | ||
54 | + qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ)); | ||
55 | |||
56 | serial_mm_init(address_space_mem, MP_UART1_BASE, 2, | ||
57 | qdev_get_gpio_in(uart_orgate, 0), | ||
58 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | ||
59 | OBJECT(get_system_memory()), &error_fatal); | ||
60 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
61 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE); | ||
62 | - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[MP_ETH_IRQ]); | ||
63 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, | ||
64 | + qdev_get_gpio_in(pic, MP_ETH_IRQ)); | ||
65 | |||
66 | sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL); | ||
67 | |||
68 | sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL); | ||
69 | |||
70 | dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE, | ||
71 | - pic[MP_GPIO_IRQ]); | ||
72 | + qdev_get_gpio_in(pic, MP_GPIO_IRQ)); | ||
73 | i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL); | ||
74 | i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c"); | ||
75 | |||
76 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | ||
77 | NULL); | ||
78 | sysbus_realize_and_unref(s, &error_fatal); | ||
79 | sysbus_mmio_map(s, 0, MP_AUDIO_BASE); | ||
80 | - sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]); | ||
81 | + sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ)); | ||
82 | |||
83 | musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE; | ||
84 | arm_load_kernel(cpu, machine, &musicpal_binfo); | ||
103 | -- | 85 | -- |
104 | 2.20.1 | 86 | 2.20.1 |
105 | 87 | ||
106 | 88 | diff view generated by jsdifflib |
1 | The function neon_store_reg32() doesn't free the TCG temp that it | 1 | The nseries machines have a codepath that allows them to load a |
---|---|---|---|
2 | is passed, so the caller must do that. We got this right in most | 2 | secondary bootloader. This code wasn't checking that the |
3 | places but forgot to free the TCG temps in trans_VMOV_64_sp(). | 3 | load_image_targphys() succeeded. Check the return value and report |
4 | the error to the user. | ||
4 | 5 | ||
5 | Cc: qemu-stable@nongnu.org | 6 | While we're in the vicinity, fix the comment style of the |
7 | comment documenting what this image load is doing. | ||
8 | |||
9 | Fixes: Coverity CID 1192904 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 12 | Message-id: 20201103114918.11807-1-peter.maydell@linaro.org |
9 | Message-id: 20190827121931.26836-1-peter.maydell@linaro.org | ||
10 | --- | 13 | --- |
11 | target/arm/translate-vfp.inc.c | 2 ++ | 14 | hw/arm/nseries.c | 15 +++++++++++---- |
12 | 1 file changed, 2 insertions(+) | 15 | 1 file changed, 11 insertions(+), 4 deletions(-) |
13 | 16 | ||
14 | diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c | 17 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-vfp.inc.c | 19 | --- a/hw/arm/nseries.c |
17 | +++ b/target/arm/translate-vfp.inc.c | 20 | +++ b/hw/arm/nseries.c |
18 | @@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a) | 21 | @@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine, |
19 | /* gpreg to fpreg */ | 22 | /* No, wait, better start at the ROM. */ |
20 | tmp = load_reg(s, a->rt); | 23 | s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000; |
21 | neon_store_reg32(tmp, a->vm); | 24 | |
22 | + tcg_temp_free_i32(tmp); | 25 | - /* This is intended for loading the `secondary.bin' program from |
23 | tmp = load_reg(s, a->rt2); | 26 | + /* |
24 | neon_store_reg32(tmp, a->vm + 1); | 27 | + * This is intended for loading the `secondary.bin' program from |
25 | + tcg_temp_free_i32(tmp); | 28 | * Nokia images (the NOLO bootloader). The entry point seems |
26 | } | 29 | * to be at OMAP2_Q2_BASE + 0x400000. |
27 | 30 | * | |
28 | return true; | 31 | @@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine, |
32 | * for them the entry point needs to be set to OMAP2_SRAM_BASE. | ||
33 | * | ||
34 | * The code above is for loading the `zImage' file from Nokia | ||
35 | - * images. */ | ||
36 | - load_image_targphys(option_rom[0].name, OMAP2_Q2_BASE + 0x400000, | ||
37 | - machine->ram_size - 0x400000); | ||
38 | + * images. | ||
39 | + */ | ||
40 | + if (load_image_targphys(option_rom[0].name, | ||
41 | + OMAP2_Q2_BASE + 0x400000, | ||
42 | + machine->ram_size - 0x400000) < 0) { | ||
43 | + error_report("Failed to load secondary bootloader %s", | ||
44 | + option_rom[0].name); | ||
45 | + exit(EXIT_FAILURE); | ||
46 | + } | ||
47 | |||
48 | n800_setup_nolo_tags(nolo_tags); | ||
49 | cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000); | ||
29 | -- | 50 | -- |
30 | 2.20.1 | 51 | 2.20.1 |
31 | 52 | ||
32 | 53 | diff view generated by jsdifflib |
1 | From: "Emilio G. Cota" <cota@braap.org> | 1 | From: Havard Skinnemoen <hskinnemoen@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Afterwise is "wise after the fact", as in "hindsight". | 3 | The number of runs is equal to the number of 0-1 and 1-0 transitions, |
4 | Here we meant "afterwards" (as in "subsequently"). Fix it. | 4 | plus one. Currently, it's counting the number of times these transitions |
5 | do _not_ happen, plus one. | ||
5 | 6 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 7 | Source: |
7 | Signed-off-by: Emilio G. Cota <cota@braap.org> | 8 | https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 9 | section 2.3.4 point (3). |
9 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 10 | |
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 11 | Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com> |
11 | Message-id: 20190828165307.18321-7-alex.bennee@linaro.org | 12 | Message-id: 20201103011457.2959989-2-hskinnemoen@google.com |
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 15 | --- |
14 | tcg/README | 2 +- | 16 | tests/qtest/npcm7xx_rng-test.c | 2 +- |
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
16 | 18 | ||
17 | diff --git a/tcg/README b/tcg/README | 19 | diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c |
18 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/tcg/README | 21 | --- a/tests/qtest/npcm7xx_rng-test.c |
20 | +++ b/tcg/README | 22 | +++ b/tests/qtest/npcm7xx_rng-test.c |
21 | @@ -XXX,XX +XXX,XX @@ This can be overridden using the following function modifiers: | 23 | @@ -XXX,XX +XXX,XX @@ static double calc_runs_p(const unsigned long *buf, unsigned int nr_bits) |
22 | canonical locations before calling the helper. | 24 | pi = (double)nr_ones / nr_bits; |
23 | - TCG_CALL_NO_WRITE_GLOBALS means that the helper does not modify any globals. | 25 | |
24 | They will only be saved to their canonical location before calling helpers, | 26 | for (k = 0; k < nr_bits - 1; k++) { |
25 | - but they won't be reloaded afterwise. | 27 | - vn_obs += !(test_bit(k, buf) ^ test_bit(k + 1, buf)); |
26 | + but they won't be reloaded afterwards. | 28 | + vn_obs += (test_bit(k, buf) ^ test_bit(k + 1, buf)); |
27 | - TCG_CALL_NO_SIDE_EFFECTS means that the call to the function is removed if | 29 | } |
28 | the return value is not used. | 30 | vn_obs += 1; |
29 | 31 | ||
30 | -- | 32 | -- |
31 | 2.20.1 | 33 | 2.20.1 |
32 | 34 | ||
33 | 35 | diff view generated by jsdifflib |
1 | The translation table walk for an ATS instruction can result in | 1 | Checks for UNDEF cases should go before the "is VFP enabled?" access |
---|---|---|---|
2 | various faults. In general these are just reported back via the | 2 | check, except in special cases. Move a stray UNDEF check in the VTBL |
3 | PAR_EL1 fault status fields, but in some cases the architecture | 3 | trans function up above the access check. |
4 | requires that the fault is turned into an exception: | ||
5 | * synchronous stage 2 faults of any kind during AT S1E0* and | ||
6 | AT S1E1* instructions executed from NS EL1 fault to EL2 or EL3 | ||
7 | * synchronous external aborts are taken as Data Abort exceptions | ||
8 | |||
9 | (This is documented in the v8A Arm ARM DDI0487A.e D5.2.11 and | ||
10 | G5.13.4.) | ||
11 | 4 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 7 | Message-id: 20201109145324.2859-1-peter.maydell@linaro.org |
15 | Message-id: 20190816125802.25877-3-peter.maydell@linaro.org | ||
16 | --- | 8 | --- |
17 | target/arm/helper.c | 107 +++++++++++++++++++++++++++++++++++++------- | 9 | target/arm/translate-neon.c.inc | 8 ++++---- |
18 | 1 file changed, 92 insertions(+), 15 deletions(-) | 10 | 1 file changed, 4 insertions(+), 4 deletions(-) |
19 | 11 | ||
20 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 12 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc |
21 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/helper.c | 14 | --- a/target/arm/translate-neon.c.inc |
23 | +++ b/target/arm/helper.c | 15 | +++ b/target/arm/translate-neon.c.inc |
24 | @@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, | 16 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) |
25 | ret = get_phys_addr(env, value, access_type, mmu_idx, &phys_addr, &attrs, | 17 | return false; |
26 | &prot, &page_size, &fi, &cacheattrs); | 18 | } |
27 | 19 | ||
28 | + if (ret) { | 20 | - if (!vfp_access_check(s)) { |
29 | + /* | 21 | - return true; |
30 | + * Some kinds of translation fault must cause exceptions rather | 22 | - } |
31 | + * than being reported in the PAR. | 23 | - |
32 | + */ | 24 | if ((a->vn + a->len + 1) > 32) { |
33 | + int current_el = arm_current_el(env); | 25 | /* |
34 | + int target_el; | 26 | * This is UNPREDICTABLE; we choose to UNDEF to avoid the |
35 | + uint32_t syn, fsr, fsc; | 27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) |
36 | + bool take_exc = false; | 28 | return false; |
37 | + | 29 | } |
38 | + if (fi.s1ptw && current_el == 1 && !arm_is_secure(env) | 30 | |
39 | + && (mmu_idx == ARMMMUIdx_S1NSE1 || mmu_idx == ARMMMUIdx_S1NSE0)) { | 31 | + if (!vfp_access_check(s)) { |
40 | + /* | 32 | + return true; |
41 | + * Synchronous stage 2 fault on an access made as part of the | ||
42 | + * translation table walk for AT S1E0* or AT S1E1* insn | ||
43 | + * executed from NS EL1. If this is a synchronous external abort | ||
44 | + * and SCR_EL3.EA == 1, then we take a synchronous external abort | ||
45 | + * to EL3. Otherwise the fault is taken as an exception to EL2, | ||
46 | + * and HPFAR_EL2 holds the faulting IPA. | ||
47 | + */ | ||
48 | + if (fi.type == ARMFault_SyncExternalOnWalk && | ||
49 | + (env->cp15.scr_el3 & SCR_EA)) { | ||
50 | + target_el = 3; | ||
51 | + } else { | ||
52 | + env->cp15.hpfar_el2 = extract64(fi.s2addr, 12, 47) << 4; | ||
53 | + target_el = 2; | ||
54 | + } | ||
55 | + take_exc = true; | ||
56 | + } else if (fi.type == ARMFault_SyncExternalOnWalk) { | ||
57 | + /* | ||
58 | + * Synchronous external aborts during a translation table walk | ||
59 | + * are taken as Data Abort exceptions. | ||
60 | + */ | ||
61 | + if (fi.stage2) { | ||
62 | + if (current_el == 3) { | ||
63 | + target_el = 3; | ||
64 | + } else { | ||
65 | + target_el = 2; | ||
66 | + } | ||
67 | + } else { | ||
68 | + target_el = exception_target_el(env); | ||
69 | + } | ||
70 | + take_exc = true; | ||
71 | + } | ||
72 | + | ||
73 | + if (take_exc) { | ||
74 | + /* Construct FSR and FSC using same logic as arm_deliver_fault() */ | ||
75 | + if (target_el == 2 || arm_el_is_aa64(env, target_el) || | ||
76 | + arm_s1_regime_using_lpae_format(env, mmu_idx)) { | ||
77 | + fsr = arm_fi_to_lfsc(&fi); | ||
78 | + fsc = extract32(fsr, 0, 6); | ||
79 | + } else { | ||
80 | + fsr = arm_fi_to_sfsc(&fi); | ||
81 | + fsc = 0x3f; | ||
82 | + } | ||
83 | + /* | ||
84 | + * Report exception with ESR indicating a fault due to a | ||
85 | + * translation table walk for a cache maintenance instruction. | ||
86 | + */ | ||
87 | + syn = syn_data_abort_no_iss(current_el == target_el, | ||
88 | + fi.ea, 1, fi.s1ptw, 1, fsc); | ||
89 | + env->exception.vaddress = value; | ||
90 | + env->exception.fsr = fsr; | ||
91 | + raise_exception(env, EXCP_DATA_ABORT, syn, target_el); | ||
92 | + } | ||
93 | + } | 33 | + } |
94 | + | 34 | + |
95 | if (is_a64(env)) { | 35 | desc = tcg_const_i32((a->vn << 2) | a->len); |
96 | format64 = true; | 36 | def = tcg_temp_new_i64(); |
97 | } else if (arm_feature(env, ARM_FEATURE_LPAE)) { | 37 | if (a->op) { |
98 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vapa_cp_reginfo[] = { | ||
99 | /* This underdecoding is safe because the reginfo is NO_RAW. */ | ||
100 | { .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY, | ||
101 | .access = PL1_W, .accessfn = ats_access, | ||
102 | - .writefn = ats_write, .type = ARM_CP_NO_RAW }, | ||
103 | + .writefn = ats_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC }, | ||
104 | #endif | ||
105 | REGINFO_SENTINEL | ||
106 | }; | ||
107 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
108 | /* 64 bit address translation operations */ | ||
109 | { .name = "AT_S1E1R", .state = ARM_CP_STATE_AA64, | ||
110 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 0, | ||
111 | - .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
112 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
113 | + .writefn = ats_write64 }, | ||
114 | { .name = "AT_S1E1W", .state = ARM_CP_STATE_AA64, | ||
115 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 1, | ||
116 | - .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
117 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
118 | + .writefn = ats_write64 }, | ||
119 | { .name = "AT_S1E0R", .state = ARM_CP_STATE_AA64, | ||
120 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 2, | ||
121 | - .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
122 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
123 | + .writefn = ats_write64 }, | ||
124 | { .name = "AT_S1E0W", .state = ARM_CP_STATE_AA64, | ||
125 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 8, .opc2 = 3, | ||
126 | - .access = PL1_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
127 | + .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
128 | + .writefn = ats_write64 }, | ||
129 | { .name = "AT_S12E1R", .state = ARM_CP_STATE_AA64, | ||
130 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 4, | ||
131 | - .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
132 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
133 | + .writefn = ats_write64 }, | ||
134 | { .name = "AT_S12E1W", .state = ARM_CP_STATE_AA64, | ||
135 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 5, | ||
136 | - .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
137 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
138 | + .writefn = ats_write64 }, | ||
139 | { .name = "AT_S12E0R", .state = ARM_CP_STATE_AA64, | ||
140 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 6, | ||
141 | - .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
142 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
143 | + .writefn = ats_write64 }, | ||
144 | { .name = "AT_S12E0W", .state = ARM_CP_STATE_AA64, | ||
145 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 7, | ||
146 | - .access = PL2_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
147 | + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
148 | + .writefn = ats_write64 }, | ||
149 | /* AT S1E2* are elsewhere as they UNDEF from EL3 if EL2 is not present */ | ||
150 | { .name = "AT_S1E3R", .state = ARM_CP_STATE_AA64, | ||
151 | .opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 0, | ||
152 | - .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
153 | + .access = PL3_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
154 | + .writefn = ats_write64 }, | ||
155 | { .name = "AT_S1E3W", .state = ARM_CP_STATE_AA64, | ||
156 | .opc0 = 1, .opc1 = 6, .crn = 7, .crm = 8, .opc2 = 1, | ||
157 | - .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
158 | + .access = PL3_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, | ||
159 | + .writefn = ats_write64 }, | ||
160 | { .name = "PAR_EL1", .state = ARM_CP_STATE_AA64, | ||
161 | .type = ARM_CP_ALIAS, | ||
162 | .opc0 = 3, .opc1 = 0, .crn = 7, .crm = 4, .opc2 = 0, | ||
163 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
164 | { .name = "AT_S1E2R", .state = ARM_CP_STATE_AA64, | ||
165 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0, | ||
166 | .access = PL2_W, .accessfn = at_s1e2_access, | ||
167 | - .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
168 | + .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, | ||
169 | { .name = "AT_S1E2W", .state = ARM_CP_STATE_AA64, | ||
170 | .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1, | ||
171 | .access = PL2_W, .accessfn = at_s1e2_access, | ||
172 | - .type = ARM_CP_NO_RAW, .writefn = ats_write64 }, | ||
173 | + .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, | ||
174 | /* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE | ||
175 | * if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3 | ||
176 | * with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose | ||
177 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
178 | */ | ||
179 | { .name = "ATS1HR", .cp = 15, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0, | ||
180 | .access = PL2_W, | ||
181 | - .writefn = ats1h_write, .type = ARM_CP_NO_RAW }, | ||
182 | + .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC }, | ||
183 | { .name = "ATS1HW", .cp = 15, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1, | ||
184 | .access = PL2_W, | ||
185 | - .writefn = ats1h_write, .type = ARM_CP_NO_RAW }, | ||
186 | + .writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC }, | ||
187 | { .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH, | ||
188 | .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0, | ||
189 | /* ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the | ||
190 | -- | 38 | -- |
191 | 2.20.1 | 39 | 2.20.1 |
192 | 40 | ||
193 | 41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | Commit ba1ba5cca introduce the ARM_CPU_TYPE_NAME() macro. | ||
4 | Unify the code base by use it in all places. | ||
5 | |||
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20190823143249.8096-2-philmd@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/allwinner-a10.c | 3 ++- | ||
13 | hw/arm/cubieboard.c | 3 ++- | ||
14 | hw/arm/digic.c | 3 ++- | ||
15 | hw/arm/fsl-imx25.c | 2 +- | ||
16 | hw/arm/fsl-imx31.c | 2 +- | ||
17 | hw/arm/fsl-imx6.c | 3 ++- | ||
18 | hw/arm/fsl-imx6ul.c | 2 +- | ||
19 | hw/arm/xlnx-zynqmp.c | 8 ++++---- | ||
20 | 8 files changed, 15 insertions(+), 11 deletions(-) | ||
21 | |||
22 | diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/hw/arm/allwinner-a10.c | ||
25 | +++ b/hw/arm/allwinner-a10.c | ||
26 | @@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj) | ||
27 | AwA10State *s = AW_A10(obj); | ||
28 | |||
29 | object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu), | ||
30 | - "cortex-a8-" TYPE_ARM_CPU, &error_abort, NULL); | ||
31 | + ARM_CPU_TYPE_NAME("cortex-a8"), | ||
32 | + &error_abort, NULL); | ||
33 | |||
34 | sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc), | ||
35 | TYPE_AW_A10_PIC); | ||
36 | diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/hw/arm/cubieboard.c | ||
39 | +++ b/hw/arm/cubieboard.c | ||
40 | @@ -XXX,XX +XXX,XX @@ static void cubieboard_init(MachineState *machine) | ||
41 | |||
42 | static void cubieboard_machine_init(MachineClass *mc) | ||
43 | { | ||
44 | - mc->desc = "cubietech cubieboard"; | ||
45 | + mc->desc = "cubietech cubieboard (Cortex-A9)"; | ||
46 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); | ||
47 | mc->init = cubieboard_init; | ||
48 | mc->block_default_type = IF_IDE; | ||
49 | mc->units_per_default_bus = 1; | ||
50 | diff --git a/hw/arm/digic.c b/hw/arm/digic.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/arm/digic.c | ||
53 | +++ b/hw/arm/digic.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void digic_init(Object *obj) | ||
55 | int i; | ||
56 | |||
57 | object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu), | ||
58 | - "arm946-" TYPE_ARM_CPU, &error_abort, NULL); | ||
59 | + ARM_CPU_TYPE_NAME("arm946"), | ||
60 | + &error_abort, NULL); | ||
61 | |||
62 | for (i = 0; i < DIGIC4_NB_TIMERS; i++) { | ||
63 | #define DIGIC_TIMER_NAME_MLEN 11 | ||
64 | diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c | ||
65 | index XXXXXXX..XXXXXXX 100644 | ||
66 | --- a/hw/arm/fsl-imx25.c | ||
67 | +++ b/hw/arm/fsl-imx25.c | ||
68 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj) | ||
69 | FslIMX25State *s = FSL_IMX25(obj); | ||
70 | int i; | ||
71 | |||
72 | - object_initialize(&s->cpu, sizeof(s->cpu), "arm926-" TYPE_ARM_CPU); | ||
73 | + object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm926")); | ||
74 | |||
75 | sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic), | ||
76 | TYPE_IMX_AVIC); | ||
77 | diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/hw/arm/fsl-imx31.c | ||
80 | +++ b/hw/arm/fsl-imx31.c | ||
81 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj) | ||
82 | FslIMX31State *s = FSL_IMX31(obj); | ||
83 | int i; | ||
84 | |||
85 | - object_initialize(&s->cpu, sizeof(s->cpu), "arm1136-" TYPE_ARM_CPU); | ||
86 | + object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm1136")); | ||
87 | |||
88 | sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic), | ||
89 | TYPE_IMX_AVIC); | ||
90 | diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/hw/arm/fsl-imx6.c | ||
93 | +++ b/hw/arm/fsl-imx6.c | ||
94 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj) | ||
95 | for (i = 0; i < MIN(ms->smp.cpus, FSL_IMX6_NUM_CPUS); i++) { | ||
96 | snprintf(name, NAME_SIZE, "cpu%d", i); | ||
97 | object_initialize_child(obj, name, &s->cpu[i], sizeof(s->cpu[i]), | ||
98 | - "cortex-a9-" TYPE_ARM_CPU, &error_abort, NULL); | ||
99 | + ARM_CPU_TYPE_NAME("cortex-a9"), | ||
100 | + &error_abort, NULL); | ||
101 | } | ||
102 | |||
103 | sysbus_init_child_obj(obj, "a9mpcore", &s->a9mpcore, sizeof(s->a9mpcore), | ||
104 | diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/hw/arm/fsl-imx6ul.c | ||
107 | +++ b/hw/arm/fsl-imx6ul.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_init(Object *obj) | ||
109 | int i; | ||
110 | |||
111 | object_initialize_child(obj, "cpu0", &s->cpu, sizeof(s->cpu), | ||
112 | - "cortex-a7-" TYPE_ARM_CPU, &error_abort, NULL); | ||
113 | + ARM_CPU_TYPE_NAME("cortex-a7"), &error_abort, NULL); | ||
114 | |||
115 | /* | ||
116 | * A7MPCORE | ||
117 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
118 | index XXXXXXX..XXXXXXX 100644 | ||
119 | --- a/hw/arm/xlnx-zynqmp.c | ||
120 | +++ b/hw/arm/xlnx-zynqmp.c | ||
121 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s, | ||
122 | |||
123 | object_initialize_child(OBJECT(&s->rpu_cluster), "rpu-cpu[*]", | ||
124 | &s->rpu_cpu[i], sizeof(s->rpu_cpu[i]), | ||
125 | - "cortex-r5f-" TYPE_ARM_CPU, &error_abort, | ||
126 | - NULL); | ||
127 | + ARM_CPU_TYPE_NAME("cortex-r5f"), | ||
128 | + &error_abort, NULL); | ||
129 | |||
130 | name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i])); | ||
131 | if (strcmp(name, boot_cpu)) { | ||
132 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(Object *obj) | ||
133 | for (i = 0; i < num_apus; i++) { | ||
134 | object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]", | ||
135 | &s->apu_cpu[i], sizeof(s->apu_cpu[i]), | ||
136 | - "cortex-a53-" TYPE_ARM_CPU, &error_abort, | ||
137 | - NULL); | ||
138 | + ARM_CPU_TYPE_NAME("cortex-a53"), | ||
139 | + &error_abort, NULL); | ||
140 | } | ||
141 | |||
142 | sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), | ||
143 | -- | ||
144 | 2.20.1 | ||
145 | |||
146 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | As explained in commit aff39be0ed97: | ||
4 | |||
5 | Both functions, object_initialize() and object_property_add_child() | ||
6 | increase the reference counter of the new object, so one of the | ||
7 | references has to be dropped afterwards to get the reference | ||
8 | counting right. Otherwise the child object will not be properly | ||
9 | cleaned up when the parent gets destroyed. | ||
10 | Thus let's use now object_initialize_child() instead to get the | ||
11 | reference counting here right. | ||
12 | |||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20190823143249.8096-3-philmd@redhat.com | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | hw/arm/mcimx7d-sabre.c | 9 ++++----- | ||
21 | hw/arm/mps2-tz.c | 15 +++++++-------- | ||
22 | hw/arm/musca.c | 9 +++++---- | ||
23 | 3 files changed, 16 insertions(+), 17 deletions(-) | ||
24 | |||
25 | diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/arm/mcimx7d-sabre.c | ||
28 | +++ b/hw/arm/mcimx7d-sabre.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine) | ||
30 | { | ||
31 | static struct arm_boot_info boot_info; | ||
32 | MCIMX7Sabre *s = g_new0(MCIMX7Sabre, 1); | ||
33 | - Object *soc; | ||
34 | int i; | ||
35 | |||
36 | if (machine->ram_size > FSL_IMX7_MMDC_SIZE) { | ||
37 | @@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine) | ||
38 | .nb_cpus = machine->smp.cpus, | ||
39 | }; | ||
40 | |||
41 | - object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX7); | ||
42 | - soc = OBJECT(&s->soc); | ||
43 | - object_property_add_child(OBJECT(machine), "soc", soc, &error_fatal); | ||
44 | - object_property_set_bool(soc, true, "realized", &error_fatal); | ||
45 | + object_initialize_child(OBJECT(machine), "soc", | ||
46 | + &s->soc, sizeof(s->soc), | ||
47 | + TYPE_FSL_IMX7, &error_fatal, NULL); | ||
48 | + object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); | ||
49 | |||
50 | memory_region_allocate_system_memory(&s->ram, NULL, "mcimx7d-sabre.ram", | ||
51 | machine->ram_size); | ||
52 | diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/hw/arm/mps2-tz.c | ||
55 | +++ b/hw/arm/mps2-tz.c | ||
56 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
57 | /* The sec_resp_cfg output from the IoTKit must be split into multiple | ||
58 | * lines, one for each of the PPCs we create here, plus one per MSC. | ||
59 | */ | ||
60 | - object_initialize(&mms->sec_resp_splitter, sizeof(mms->sec_resp_splitter), | ||
61 | - TYPE_SPLIT_IRQ); | ||
62 | - object_property_add_child(OBJECT(machine), "sec-resp-splitter", | ||
63 | - OBJECT(&mms->sec_resp_splitter), &error_abort); | ||
64 | + object_initialize_child(OBJECT(machine), "sec-resp-splitter", | ||
65 | + &mms->sec_resp_splitter, | ||
66 | + sizeof(mms->sec_resp_splitter), | ||
67 | + TYPE_SPLIT_IRQ, &error_abort, NULL); | ||
68 | object_property_set_int(OBJECT(&mms->sec_resp_splitter), | ||
69 | ARRAY_SIZE(mms->ppc) + ARRAY_SIZE(mms->msc), | ||
70 | "num-lines", &error_fatal); | ||
71 | @@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine) | ||
72 | * Tx, Rx and "combined" IRQs are sent to the NVIC separately. | ||
73 | * Create the OR gate for this. | ||
74 | */ | ||
75 | - object_initialize(&mms->uart_irq_orgate, sizeof(mms->uart_irq_orgate), | ||
76 | - TYPE_OR_IRQ); | ||
77 | - object_property_add_child(OBJECT(mms), "uart-irq-orgate", | ||
78 | - OBJECT(&mms->uart_irq_orgate), &error_abort); | ||
79 | + object_initialize_child(OBJECT(mms), "uart-irq-orgate", | ||
80 | + &mms->uart_irq_orgate, sizeof(mms->uart_irq_orgate), | ||
81 | + TYPE_OR_IRQ, &error_abort, NULL); | ||
82 | object_property_set_int(OBJECT(&mms->uart_irq_orgate), 10, "num-lines", | ||
83 | &error_fatal); | ||
84 | object_property_set_bool(OBJECT(&mms->uart_irq_orgate), true, | ||
85 | diff --git a/hw/arm/musca.c b/hw/arm/musca.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/hw/arm/musca.c | ||
88 | +++ b/hw/arm/musca.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine) | ||
90 | * The sec_resp_cfg output from the SSE-200 must be split into multiple | ||
91 | * lines, one for each of the PPCs we create here. | ||
92 | */ | ||
93 | - object_initialize(&mms->sec_resp_splitter, sizeof(mms->sec_resp_splitter), | ||
94 | - TYPE_SPLIT_IRQ); | ||
95 | - object_property_add_child(OBJECT(machine), "sec-resp-splitter", | ||
96 | - OBJECT(&mms->sec_resp_splitter), &error_fatal); | ||
97 | + object_initialize_child(OBJECT(machine), "sec-resp-splitter", | ||
98 | + &mms->sec_resp_splitter, | ||
99 | + sizeof(mms->sec_resp_splitter), | ||
100 | + TYPE_SPLIT_IRQ, &error_fatal, NULL); | ||
101 | + | ||
102 | object_property_set_int(OBJECT(&mms->sec_resp_splitter), | ||
103 | ARRAY_SIZE(mms->ppc), "num-lines", &error_fatal); | ||
104 | object_property_set_bool(OBJECT(&mms->sec_resp_splitter), true, | ||
105 | -- | ||
106 | 2.20.1 | ||
107 | |||
108 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | Both object_initialize() and qdev_set_parent_bus() increase the | ||
4 | reference counter of the new object, so one of the references has | ||
5 | to be dropped afterwards to get the reference counting right. | ||
6 | In machine model code this refcount leak is not particularly | ||
7 | problematic because (unlike devices) machines will never be | ||
8 | created on demand via QMP, and they are never destroyed. | ||
9 | But in any case let's use the new sysbus_init_child_obj() instead | ||
10 | to get the reference counting here right. | ||
11 | |||
12 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20190823143249.8096-4-philmd@redhat.com | ||
15 | [PMM: rewrote commit message] | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | hw/arm/exynos4_boards.c | 4 ++-- | ||
19 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/arm/exynos4_boards.c | ||
24 | +++ b/hw/arm/exynos4_boards.c | ||
25 | @@ -XXX,XX +XXX,XX @@ exynos4_boards_init_common(MachineState *machine, | ||
26 | exynos4_boards_init_ram(s, get_system_memory(), | ||
27 | exynos4_board_ram_size[board_type]); | ||
28 | |||
29 | - object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); | ||
30 | - qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default()); | ||
31 | + sysbus_init_child_obj(OBJECT(machine), "soc", | ||
32 | + &s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC); | ||
33 | object_property_set_bool(OBJECT(&s->soc), true, "realized", | ||
34 | &error_fatal); | ||
35 | |||
36 | -- | ||
37 | 2.20.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | Child properties form the composition tree. All objects need to be | ||
4 | a child of another object. Objects can only be a child of one object. | ||
5 | |||
6 | Respect this with the i.MX SoC, to get a cleaner composition tree. | ||
7 | |||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20190823143249.8096-5-philmd@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/fsl-imx25.c | 4 +++- | ||
14 | hw/arm/fsl-imx31.c | 4 +++- | ||
15 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/fsl-imx25.c | ||
20 | +++ b/hw/arm/fsl-imx25.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx25_init(Object *obj) | ||
22 | FslIMX25State *s = FSL_IMX25(obj); | ||
23 | int i; | ||
24 | |||
25 | - object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm926")); | ||
26 | + object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu), | ||
27 | + ARM_CPU_TYPE_NAME("arm926"), | ||
28 | + &error_abort, NULL); | ||
29 | |||
30 | sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic), | ||
31 | TYPE_IMX_AVIC); | ||
32 | diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/hw/arm/fsl-imx31.c | ||
35 | +++ b/hw/arm/fsl-imx31.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void fsl_imx31_init(Object *obj) | ||
37 | FslIMX31State *s = FSL_IMX31(obj); | ||
38 | int i; | ||
39 | |||
40 | - object_initialize(&s->cpu, sizeof(s->cpu), ARM_CPU_TYPE_NAME("arm1136")); | ||
41 | + object_initialize_child(obj, "cpu", &s->cpu, sizeof(s->cpu), | ||
42 | + ARM_CPU_TYPE_NAME("arm1136"), | ||
43 | + &error_abort, NULL); | ||
44 | |||
45 | sysbus_init_child_obj(obj, "avic", &s->avic, sizeof(s->avic), | ||
46 | TYPE_IMX_AVIC); | ||
47 | -- | ||
48 | 2.20.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | As explained in commit aff39be0ed97: | ||
4 | |||
5 | Both functions, object_initialize() and object_property_add_child() | ||
6 | increase the reference counter of the new object, so one of the | ||
7 | references has to be dropped afterwards to get the reference | ||
8 | counting right. Otherwise the child object will not be properly | ||
9 | cleaned up when the parent gets destroyed. | ||
10 | Thus let's use now object_initialize_child() instead to get the | ||
11 | reference counting here right. | ||
12 | |||
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Message-id: 20190823143249.8096-6-philmd@redhat.com | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | hw/dma/xilinx_axidma.c | 16 ++++++++-------- | ||
21 | 1 file changed, 8 insertions(+), 8 deletions(-) | ||
22 | |||
23 | diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/hw/dma/xilinx_axidma.c | ||
26 | +++ b/hw/dma/xilinx_axidma.c | ||
27 | @@ -XXX,XX +XXX,XX @@ static void xilinx_axidma_init(Object *obj) | ||
28 | XilinxAXIDMA *s = XILINX_AXI_DMA(obj); | ||
29 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | ||
30 | |||
31 | - object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev), | ||
32 | - TYPE_XILINX_AXI_DMA_DATA_STREAM); | ||
33 | - object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev), | ||
34 | - TYPE_XILINX_AXI_DMA_CONTROL_STREAM); | ||
35 | - object_property_add_child(OBJECT(s), "axistream-connected-target", | ||
36 | - (Object *)&s->rx_data_dev, &error_abort); | ||
37 | - object_property_add_child(OBJECT(s), "axistream-control-connected-target", | ||
38 | - (Object *)&s->rx_control_dev, &error_abort); | ||
39 | + object_initialize_child(OBJECT(s), "axistream-connected-target", | ||
40 | + &s->rx_data_dev, sizeof(s->rx_data_dev), | ||
41 | + TYPE_XILINX_AXI_DMA_DATA_STREAM, &error_abort, | ||
42 | + NULL); | ||
43 | + object_initialize_child(OBJECT(s), "axistream-control-connected-target", | ||
44 | + &s->rx_control_dev, sizeof(s->rx_control_dev), | ||
45 | + TYPE_XILINX_AXI_DMA_CONTROL_STREAM, &error_abort, | ||
46 | + NULL); | ||
47 | |||
48 | sysbus_init_irq(sbd, &s->streams[0].irq); | ||
49 | sysbus_init_irq(sbd, &s->streams[1].irq); | ||
50 | -- | ||
51 | 2.20.1 | ||
52 | |||
53 | diff view generated by jsdifflib |