1 | One last arm pullreq before I stop work for the end of the year... | 1 | Patches for rc1: nothing major, just some minor bugfixes and |
---|---|---|---|
2 | code cleanups. | ||
2 | 3 | ||
3 | -- PMM | 4 | -- PMM |
4 | 5 | ||
5 | The following changes since commit 8e5943260a8f765216674ee87ce8588cc4e7463e: | 6 | The following changes since commit f7e1914adad8885a5d4c70239ab90d901ed97e9f: |
6 | 7 | ||
7 | Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-12-20 12:46:10 +0000) | 8 | Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201109' into staging (2020-11-10 09:24:56 +0000) |
8 | 9 | ||
9 | are available in the Git repository at: | 10 | are available in the Git repository at: |
10 | 11 | ||
11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191220 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201110 |
12 | 13 | ||
13 | for you to fetch changes up to c8fa6079eb35888587f1be27c1590da4edcc5098: | 14 | for you to fetch changes up to b6c56c8a9a4064ea783f352f43c5df6231a110fa: |
14 | 15 | ||
15 | arm/arm-powerctl: rebuild hflags after setting CP15 bits in arm_set_cpu_on() (2019-12-20 14:03:00 +0000) | 16 | target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check (2020-11-10 11:03:48 +0000) |
16 | 17 | ||
17 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
18 | target-arm queue: | 19 | target-arm queue: |
19 | * Support emulating the generic timers at frequencies other than 62.5MHz | 20 | * hw/arm/Kconfig: ARM_V7M depends on PTIMER |
20 | * Various fixes for SMMUv3 emulation bugs | 21 | * Minor coding style fixes |
21 | * Improve assert error message for hflags mismatches | 22 | * docs: add some notes on the sbsa-ref machine |
22 | * arm-powerctl: rebuild hflags after setting CP15 bits in arm_set_cpu_on() | 23 | * hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals |
24 | * target/arm: Fix neon VTBL/VTBX for len > 1 | ||
25 | * hw/arm/armsse: Correct expansion MPC interrupt lines | ||
26 | * hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ | ||
27 | * hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup() | ||
28 | * hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input | ||
29 | * hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary | ||
30 | * hw/arm/nseries: Check return value from load_image_targphys() | ||
31 | * tests/qtest/npcm7xx_rng-test: count runs properly | ||
32 | * target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check | ||
23 | 33 | ||
24 | ---------------------------------------------------------------- | 34 | ---------------------------------------------------------------- |
25 | Andrew Jeffery (4): | 35 | Alex Bennée (1): |
26 | target/arm: Remove redundant scaling of nexttick | 36 | docs: add some notes on the sbsa-ref machine |
27 | target/arm: Abstract the generic timer frequency | ||
28 | target/arm: Prepare generic timer for per-platform CNTFRQ | ||
29 | ast2600: Configure CNTFRQ at 1125MHz | ||
30 | 37 | ||
31 | Niek Linnenbank (1): | 38 | AlexChen (1): |
32 | arm/arm-powerctl: rebuild hflags after setting CP15 bits in arm_set_cpu_on() | 39 | ssi: Fix bad printf format specifiers |
33 | 40 | ||
34 | Philippe Mathieu-Daudé (1): | 41 | Andrew Jones (1): |
35 | target/arm: Display helpful message when hflags mismatch | 42 | hw/arm/Kconfig: ARM_V7M depends on PTIMER |
36 | 43 | ||
37 | Simon Veith (6): | 44 | Havard Skinnemoen (1): |
38 | hw/arm/smmuv3: Apply address mask to linear strtab base address | 45 | tests/qtest/npcm7xx_rng-test: count runs properly |
39 | hw/arm/smmuv3: Correct SMMU_BASE_ADDR_MASK value | ||
40 | hw/arm/smmuv3: Check stream IDs against actual table LOG2SIZE | ||
41 | hw/arm/smmuv3: Align stream table base address to table size | ||
42 | hw/arm/smmuv3: Use correct bit positions in EVT_SET_ADDR2 macro | ||
43 | hw/arm/smmuv3: Report F_STE_FETCH fault address in correct word position | ||
44 | 46 | ||
45 | hw/arm/smmuv3-internal.h | 6 ++--- | 47 | Peter Maydell (2): |
46 | target/arm/cpu.h | 5 ++++ | 48 | hw/arm/nseries: Check return value from load_image_targphys() |
47 | hw/arm/aspeed_ast2600.c | 3 +++ | 49 | target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check |
48 | hw/arm/smmuv3.c | 28 +++++++++++++++----- | ||
49 | target/arm/arm-powerctl.c | 3 +++ | ||
50 | target/arm/cpu.c | 65 +++++++++++++++++++++++++++++++++++++++++------ | ||
51 | target/arm/helper.c | 42 +++++++++++++++++++++++------- | ||
52 | 7 files changed, 125 insertions(+), 27 deletions(-) | ||
53 | 50 | ||
51 | Philippe Mathieu-Daudé (6): | ||
52 | hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals | ||
53 | hw/arm/armsse: Correct expansion MPC interrupt lines | ||
54 | hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ | ||
55 | hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup() | ||
56 | hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input | ||
57 | hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary | ||
58 | |||
59 | Richard Henderson (1): | ||
60 | target/arm: Fix neon VTBL/VTBX for len > 1 | ||
61 | |||
62 | Xinhao Zhang (3): | ||
63 | target/arm: add spaces around operator | ||
64 | target/arm: Don't use '#' flag of printf format | ||
65 | target/arm: add space before the open parenthesis '(' | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Andrew Jones <drjones@redhat.com> | ||
1 | 2 | ||
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. | ||
6 | |||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20201104103343.30392-1-drjones@redhat.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/Kconfig | 1 + | ||
13 | 1 file changed, 1 insertion(+) | ||
14 | |||
15 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/Kconfig | ||
18 | +++ b/hw/arm/Kconfig | ||
19 | @@ -XXX,XX +XXX,XX @@ config ZYNQ | ||
20 | |||
21 | config ARM_V7M | ||
22 | bool | ||
23 | + select PTIMER | ||
24 | |||
25 | config ALLWINNER_A10 | ||
26 | bool | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: AlexChen <alex.chen@huawei.com> | ||
1 | 2 | ||
3 | We should use printf format specifier "%u" instead of "%d" for | ||
4 | argument of type "unsigned int". | ||
5 | |||
6 | Reported-by: Euler Robot <euler.robot@huawei.com> | ||
7 | Signed-off-by: Alex Chen <alex.chen@huawei.com> | ||
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 5FA280F5.8060902@huawei.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/ssi/imx_spi.c | 2 +- | ||
13 | hw/ssi/xilinx_spi.c | 2 +- | ||
14 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/ssi/imx_spi.c | ||
19 | +++ b/hw/ssi/imx_spi.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static const char *imx_spi_reg_name(uint32_t reg) | ||
21 | case ECSPI_MSGDATA: | ||
22 | return "ECSPI_MSGDATA"; | ||
23 | default: | ||
24 | - sprintf(unknown, "%d ?", reg); | ||
25 | + sprintf(unknown, "%u ?", reg); | ||
26 | return unknown; | ||
27 | } | ||
28 | } | ||
29 | diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/hw/ssi/xilinx_spi.c | ||
32 | +++ b/hw/ssi/xilinx_spi.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void xlx_spi_update_irq(XilinxSPI *s) | ||
34 | irq chain unless things really changed. */ | ||
35 | if (pending != s->irqline) { | ||
36 | s->irqline = pending; | ||
37 | - DB_PRINT("irq_change of state %d ISR:%x IER:%X\n", | ||
38 | + DB_PRINT("irq_change of state %u ISR:%x IER:%X\n", | ||
39 | pending, s->regs[R_IPISR], s->regs[R_IPIER]); | ||
40 | qemu_set_irq(s->irq, pending); | ||
41 | } | ||
42 | -- | ||
43 | 2.20.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The ASPEED AST2600 clocks the generic timer at the rate of HPLL. On | 3 | Fix code style. Operator needs spaces both sides. |
4 | recent firmwares this is at 1125MHz, which is considerably quicker than | ||
5 | the assumed 62.5MHz of the current generic timer implementation. The | ||
6 | delta between the value as read from CNTFRQ and the true rate of the | ||
7 | underlying QEMUTimer leads to sticky behaviour in AST2600 guests. | ||
8 | 4 | ||
9 | Add a feature-gated property exposing CNTFRQ for ARM CPUs providing the | 5 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> |
10 | generic timer. This allows platforms to configure CNTFRQ (and the | 6 | Signed-off-by: Kai Deng <dengkai1@huawei.com> |
11 | associated QEMUTimer) to the appropriate frequency prior to starting the | 7 | Message-id: 20201103114529.638233-1-zhangxinhao1@huawei.com |
12 | guest. | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | |||
14 | As the platform can now determine the rate of CNTFRQ we're exposed to | ||
15 | limitations of QEMUTimer that didn't previously materialise: In the | ||
16 | course of emulation we need to arbitrarily and accurately convert | ||
17 | between guest ticks and time, but we're constrained by QEMUTimer's use | ||
18 | of an integer scaling factor. The effect is QEMUTimer cannot exactly | ||
19 | capture the period of frequencies that do not cleanly divide | ||
20 | NANOSECONDS_PER_SECOND for scaling ticks to time. As such, provide an | ||
21 | equally inaccurate scaling factor for scaling time to ticks so at least | ||
22 | a self-consistent inverse relationship holds. | ||
23 | |||
24 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | ||
25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
26 | Message-id: a22db9325f96e39f76e3c2baddcb712149f46bf2.1576215453.git-series.andrew@aj.id.au | ||
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | --- | 10 | --- |
29 | target/arm/cpu.c | 61 +++++++++++++++++++++++++++++++++++++-------- | 11 | target/arm/arch_dump.c | 8 ++++---- |
30 | target/arm/helper.c | 9 ++++++- | 12 | target/arm/arm-semi.c | 8 ++++---- |
31 | 2 files changed, 59 insertions(+), 11 deletions(-) | 13 | target/arm/helper.c | 2 +- |
14 | 3 files changed, 9 insertions(+), 9 deletions(-) | ||
32 | 15 | ||
33 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 16 | diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c |
34 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/target/arm/cpu.c | 18 | --- a/target/arm/arch_dump.c |
36 | +++ b/target/arm/cpu.c | 19 | +++ b/target/arm/arch_dump.c |
37 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj) | 20 | @@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, |
38 | if (tcg_enabled()) { | 21 | |
39 | cpu->psci_version = 2; /* TCG implements PSCI 0.2 */ | 22 | for (i = 0; i < 32; ++i) { |
23 | uint64_t *q = aa64_vfp_qreg(env, i); | ||
24 | - note.vfp.vregs[2*i + 0] = cpu_to_dump64(s, q[0]); | ||
25 | - note.vfp.vregs[2*i + 1] = cpu_to_dump64(s, q[1]); | ||
26 | + note.vfp.vregs[2 * i + 0] = cpu_to_dump64(s, q[0]); | ||
27 | + note.vfp.vregs[2 * i + 1] = cpu_to_dump64(s, q[1]); | ||
40 | } | 28 | } |
41 | - | 29 | |
42 | - cpu->gt_cntfrq_hz = NANOSECONDS_PER_SECOND / GTIMER_SCALE; | 30 | if (s->dump_info.d_endian == ELFDATA2MSB) { |
43 | } | 31 | @@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, |
44 | 32 | */ | |
45 | +static Property arm_cpu_gt_cntfrq_property = | 33 | for (i = 0; i < 32; ++i) { |
46 | + DEFINE_PROP_UINT64("cntfrq", ARMCPU, gt_cntfrq_hz, | 34 | uint64_t tmp = note.vfp.vregs[2*i]; |
47 | + NANOSECONDS_PER_SECOND / GTIMER_SCALE); | 35 | - note.vfp.vregs[2*i] = note.vfp.vregs[2*i+1]; |
48 | + | 36 | - note.vfp.vregs[2*i+1] = tmp; |
49 | static Property arm_cpu_reset_cbar_property = | 37 | + note.vfp.vregs[2 * i] = note.vfp.vregs[2 * i + 1]; |
50 | DEFINE_PROP_UINT64("reset-cbar", ARMCPU, reset_cbar, 0); | 38 | + note.vfp.vregs[2 * i + 1] = tmp; |
51 | |||
52 | @@ -XXX,XX +XXX,XX @@ static void arm_set_init_svtor(Object *obj, Visitor *v, const char *name, | ||
53 | |||
54 | unsigned int gt_cntfrq_period_ns(ARMCPU *cpu) | ||
55 | { | ||
56 | + /* | ||
57 | + * The exact approach to calculating guest ticks is: | ||
58 | + * | ||
59 | + * muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), cpu->gt_cntfrq_hz, | ||
60 | + * NANOSECONDS_PER_SECOND); | ||
61 | + * | ||
62 | + * We don't do that. Rather we intentionally use integer division | ||
63 | + * truncation below and in the caller for the conversion of host monotonic | ||
64 | + * time to guest ticks to provide the exact inverse for the semantics of | ||
65 | + * the QEMUTimer scale factor. QEMUTimer's scale facter is an integer, so | ||
66 | + * it loses precision when representing frequencies where | ||
67 | + * `(NANOSECONDS_PER_SECOND % cpu->gt_cntfrq) > 0` holds. Failing to | ||
68 | + * provide an exact inverse leads to scheduling timers with negative | ||
69 | + * periods, which in turn leads to sticky behaviour in the guest. | ||
70 | + * | ||
71 | + * Finally, CNTFRQ is effectively capped at 1GHz to ensure our scale factor | ||
72 | + * cannot become zero. | ||
73 | + */ | ||
74 | return NANOSECONDS_PER_SECOND > cpu->gt_cntfrq_hz ? | ||
75 | NANOSECONDS_PER_SECOND / cpu->gt_cntfrq_hz : 1; | ||
76 | } | ||
77 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj) | ||
78 | |||
79 | qdev_property_add_static(DEVICE(obj), &arm_cpu_cfgend_property, | ||
80 | &error_abort); | ||
81 | + | ||
82 | + if (arm_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER)) { | ||
83 | + qdev_property_add_static(DEVICE(cpu), &arm_cpu_gt_cntfrq_property, | ||
84 | + &error_abort); | ||
85 | + } | ||
86 | } | ||
87 | |||
88 | static void arm_cpu_finalizefn(Object *obj) | ||
89 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | ||
90 | } | 39 | } |
91 | } | 40 | } |
92 | 41 | ||
93 | - cpu->gt_timer[GTIMER_PHYS] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE, | 42 | diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c |
94 | - arm_gt_ptimer_cb, cpu); | 43 | index XXXXXXX..XXXXXXX 100644 |
95 | - cpu->gt_timer[GTIMER_VIRT] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE, | 44 | --- a/target/arm/arm-semi.c |
96 | - arm_gt_vtimer_cb, cpu); | 45 | +++ b/target/arm/arm-semi.c |
97 | - cpu->gt_timer[GTIMER_HYP] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE, | 46 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) |
98 | - arm_gt_htimer_cb, cpu); | 47 | if (use_gdb_syscalls()) { |
99 | - cpu->gt_timer[GTIMER_SEC] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE, | 48 | arm_semi_open_guestfd = guestfd; |
100 | - arm_gt_stimer_cb, cpu); | 49 | ret = arm_gdb_syscall(cpu, arm_semi_open_cb, "open,%s,%x,1a4", arg0, |
101 | + | 50 | - (int)arg2+1, gdb_open_modeflags[arg1]); |
102 | + { | 51 | + (int)arg2 + 1, gdb_open_modeflags[arg1]); |
103 | + uint64_t scale; | 52 | } else { |
104 | + | 53 | ret = set_swi_errno(env, open(s, open_modeflags[arg1], 0644)); |
105 | + if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) { | 54 | if (ret == (uint32_t)-1) { |
106 | + if (!cpu->gt_cntfrq_hz) { | 55 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) |
107 | + error_setg(errp, "Invalid CNTFRQ: %"PRId64"Hz", | 56 | GET_ARG(1); |
108 | + cpu->gt_cntfrq_hz); | 57 | if (use_gdb_syscalls()) { |
109 | + return; | 58 | ret = arm_gdb_syscall(cpu, arm_semi_cb, "unlink,%s", |
110 | + } | 59 | - arg0, (int)arg1+1); |
111 | + scale = gt_cntfrq_period_ns(cpu); | 60 | + arg0, (int)arg1 + 1); |
112 | + } else { | 61 | } else { |
113 | + scale = GTIMER_SCALE; | 62 | s = lock_user_string(arg0); |
114 | + } | 63 | if (!s) { |
115 | + | 64 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) |
116 | + cpu->gt_timer[GTIMER_PHYS] = timer_new(QEMU_CLOCK_VIRTUAL, scale, | 65 | GET_ARG(3); |
117 | + arm_gt_ptimer_cb, cpu); | 66 | if (use_gdb_syscalls()) { |
118 | + cpu->gt_timer[GTIMER_VIRT] = timer_new(QEMU_CLOCK_VIRTUAL, scale, | 67 | return arm_gdb_syscall(cpu, arm_semi_cb, "rename,%s,%s", |
119 | + arm_gt_vtimer_cb, cpu); | 68 | - arg0, (int)arg1+1, arg2, (int)arg3+1); |
120 | + cpu->gt_timer[GTIMER_HYP] = timer_new(QEMU_CLOCK_VIRTUAL, scale, | 69 | + arg0, (int)arg1 + 1, arg2, (int)arg3 + 1); |
121 | + arm_gt_htimer_cb, cpu); | 70 | } else { |
122 | + cpu->gt_timer[GTIMER_SEC] = timer_new(QEMU_CLOCK_VIRTUAL, scale, | 71 | char *s2; |
123 | + arm_gt_stimer_cb, cpu); | 72 | s = lock_user_string(arg0); |
124 | + } | 73 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) |
125 | #endif | 74 | GET_ARG(1); |
126 | 75 | if (use_gdb_syscalls()) { | |
127 | cpu_exec_realizefn(cs, &local_err); | 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) { | ||
128 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 82 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
129 | index XXXXXXX..XXXXXXX 100644 | 83 | index XXXXXXX..XXXXXXX 100644 |
130 | --- a/target/arm/helper.c | 84 | --- a/target/arm/helper.c |
131 | +++ b/target/arm/helper.c | 85 | +++ b/target/arm/helper.c |
132 | @@ -XXX,XX +XXX,XX @@ void arm_gt_stimer_cb(void *opaque) | 86 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(usad8)(uint32_t a, uint32_t b) |
133 | gt_recalc_timer(cpu, GTIMER_SEC); | 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; | ||
134 | } | 94 | } |
135 | |||
136 | +static void arm_gt_cntfrq_reset(CPUARMState *env, const ARMCPRegInfo *opaque) | ||
137 | +{ | ||
138 | + ARMCPU *cpu = env_archcpu(env); | ||
139 | + | ||
140 | + cpu->env.cp15.c14_cntfrq = cpu->gt_cntfrq_hz; | ||
141 | +} | ||
142 | + | ||
143 | static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
144 | /* Note that CNTFRQ is purely reads-as-written for the benefit | ||
145 | * of software; writing it doesn't actually change the timer frequency. | ||
146 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
147 | .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 0, | ||
148 | .access = PL1_RW | PL0_R, .accessfn = gt_cntfrq_access, | ||
149 | .fieldoffset = offsetof(CPUARMState, cp15.c14_cntfrq), | ||
150 | - .resetvalue = (1000 * 1000 * 1000) / GTIMER_SCALE, | ||
151 | + .resetfn = arm_gt_cntfrq_reset, | ||
152 | }, | ||
153 | /* overall control: mostly access permissions */ | ||
154 | { .name = "CNTKCTL", .state = ARM_CP_STATE_BOTH, | ||
155 | -- | 95 | -- |
156 | 2.20.1 | 96 | 2.20.1 |
157 | 97 | ||
158 | 98 | diff view generated by jsdifflib |
1 | From: Simon Veith <sveith@amazon.de> | 1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | In the SMMU_STRTAB_BASE register, the stream table base address only | 3 | Fix code style. Don't use '#' flag of printf format ('%#') in |
4 | occupies bits [51:6]. Other bits, such as RA (bit [62]), must be masked | 4 | format strings, use '0x' prefix instead |
5 | out to obtain the base address. | ||
6 | 5 | ||
7 | The branch for 2-level stream tables correctly applies this mask by way | 6 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> |
8 | of SMMU_BASE_ADDR_MASK, but the one for linear stream tables does not. | 7 | Signed-off-by: Kai Deng <dengkai1@huawei.com> |
9 | 8 | Message-id: 20201103114529.638233-2-zhangxinhao1@huawei.com | |
10 | Apply the missing mask in that case as well so that the correct stream | ||
11 | base address is used by guests which configure a linear stream table. | ||
12 | |||
13 | Linux guests are unaffected by this change because they choose a 2-level | ||
14 | stream table layout for the QEMU SMMUv3, based on the size of its stream | ||
15 | ID space. | ||
16 | |||
17 | ref. ARM IHI 0070C, section 6.3.23. | ||
18 | |||
19 | Signed-off-by: Simon Veith <sveith@amazon.de> | ||
20 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
21 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
22 | Message-id: 1576509312-13083-2-git-send-email-sveith@amazon.de | ||
23 | Cc: Eric Auger <eric.auger@redhat.com> | ||
24 | Cc: qemu-devel@nongnu.org | ||
25 | Cc: qemu-arm@nongnu.org | ||
26 | Acked-by: Eric Auger <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.c | 2 +- | 12 | target/arm/translate-a64.c | 4 ++-- |
31 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 2 insertions(+), 2 deletions(-) |
32 | 14 | ||
33 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
34 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
35 | --- a/hw/arm/smmuv3.c | 17 | --- a/target/arm/translate-a64.c |
36 | +++ b/hw/arm/smmuv3.c | 18 | +++ b/target/arm/translate-a64.c |
37 | @@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, | 19 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) |
38 | } | 20 | gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst); |
39 | addr = l2ptr + l2_ste_offset * sizeof(*ste); | 21 | break; |
40 | } else { | 22 | default: |
41 | - addr = s->strtab_base + sid * sizeof(*ste); | 23 | - fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n", |
42 | + addr = (s->strtab_base & SMMU_BASE_ADDR_MASK) + sid * sizeof(*ste); | 24 | + fprintf(stderr, "%s: insn 0x%04x, fpop 0x%2x @ 0x%" PRIx64 "\n", |
25 | __func__, insn, fpopcode, s->pc_curr); | ||
26 | g_assert_not_reached(); | ||
27 | } | ||
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(); | ||
43 | } | 35 | } |
44 | 36 | ||
45 | if (smmu_get_ste(s, addr, ste, event)) { | ||
46 | -- | 37 | -- |
47 | 2.20.1 | 38 | 2.20.1 |
48 | 39 | ||
49 | 40 | diff view generated by jsdifflib |
1 | From: Simon Veith <sveith@amazon.de> | 1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The smmuv3_record_event() function that generates the F_STE_FETCH error | 3 | Fix code style. Space required before the open parenthesis '('. |
4 | uses the EVT_SET_ADDR macro to record the fetch address, placing it in | ||
5 | 32-bit words 4 and 5. | ||
6 | 4 | ||
7 | The correct position for this address is in words 6 and 7, per the | 5 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> |
8 | SMMUv3 Architecture Specification. | 6 | Signed-off-by: Kai Deng <dengkai1@huawei.com> |
9 | 7 | Message-id: 20201103114529.638233-3-zhangxinhao1@huawei.com | |
10 | Update the function to use the EVT_SET_ADDR2 macro instead, which is the | ||
11 | macro intended for writing to these words. | ||
12 | |||
13 | ref. ARM IHI 0070C, section 7.3.4. | ||
14 | |||
15 | Signed-off-by: Simon Veith <sveith@amazon.de> | ||
16 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
17 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
18 | Message-id: 1576509312-13083-7-git-send-email-sveith@amazon.de | ||
19 | Cc: Eric Auger <eric.auger@redhat.com> | ||
20 | Cc: qemu-devel@nongnu.org | ||
21 | Cc: qemu-arm@nongnu.org | ||
22 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 10 | --- |
26 | hw/arm/smmuv3.c | 2 +- | 11 | target/arm/translate.c | 2 +- |
27 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+), 1 deletion(-) |
28 | 13 | ||
29 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 14 | diff --git a/target/arm/translate.c b/target/arm/translate.c |
30 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/arm/smmuv3.c | 16 | --- a/target/arm/translate.c |
32 | +++ b/hw/arm/smmuv3.c | 17 | +++ b/target/arm/translate.c |
33 | @@ -XXX,XX +XXX,XX @@ void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info) | 18 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
34 | case SMMU_EVT_F_STE_FETCH: | 19 | - Hardware watchpoints. |
35 | EVT_SET_SSID(&evt, info->u.f_ste_fetch.ssid); | 20 | Hardware breakpoints have already been handled and skip this code. |
36 | EVT_SET_SSV(&evt, info->u.f_ste_fetch.ssv); | 21 | */ |
37 | - EVT_SET_ADDR(&evt, info->u.f_ste_fetch.addr); | 22 | - switch(dc->base.is_jmp) { |
38 | + EVT_SET_ADDR2(&evt, info->u.f_ste_fetch.addr); | 23 | + switch (dc->base.is_jmp) { |
39 | break; | 24 | case DISAS_NEXT: |
40 | case SMMU_EVT_C_BAD_STE: | 25 | case DISAS_TOO_MANY: |
41 | EVT_SET_SSID(&evt, info->u.c_bad_ste.ssid); | 26 | gen_goto_tb(dc, 1, dc->base.pc_next); |
42 | -- | 27 | -- |
43 | 2.20.1 | 28 | 2.20.1 |
44 | 29 | ||
45 | 30 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Alex Bennée <alex.bennee@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | This matches the configuration set by u-boot on the AST2600. | 3 | We should at least document what this machine is about. |
4 | 4 | ||
5 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | 5 | Reviewed-by: Graeme Gregory <graeme@nuviainc.com> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> |
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 7 | Message-id: 20201104165254.24822-1-alex.bennee@linaro.org |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Cc: Leif Lindholm <leif@nuviainc.com> |
9 | Message-id: 080ca1267a09381c43cf3c50d434fb6c186f2b6e.1576215453.git-series.andrew@aj.id.au | 9 | Cc: Shashi Mallela <shashi.mallela@linaro.org> |
10 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
11 | [PMM: fixed filename mismatch] | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 13 | --- |
12 | hw/arm/aspeed_ast2600.c | 3 +++ | 14 | docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++++++++++++ |
13 | 1 file changed, 3 insertions(+) | 15 | docs/system/target-arm.rst | 1 + |
16 | 2 files changed, 33 insertions(+) | ||
17 | create mode 100644 docs/system/arm/sbsa.rst | ||
14 | 18 | ||
15 | diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c | 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 | ||
16 | index XXXXXXX..XXXXXXX 100644 | 58 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/aspeed_ast2600.c | 59 | --- a/docs/system/target-arm.rst |
18 | +++ b/hw/arm/aspeed_ast2600.c | 60 | +++ b/docs/system/target-arm.rst |
19 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | 61 | @@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running |
20 | object_property_set_int(OBJECT(&s->cpu[i]), aspeed_calc_affinity(i), | 62 | arm/mps2 |
21 | "mp-affinity", &error_abort); | 63 | arm/musca |
22 | 64 | arm/realview | |
23 | + object_property_set_int(OBJECT(&s->cpu[i]), 1125000000, "cntfrq", | 65 | + arm/sbsa |
24 | + &error_abort); | 66 | arm/versatile |
25 | + | 67 | arm/vexpress |
26 | /* | 68 | arm/aspeed |
27 | * TODO: the secondary CPUs are started and a boot helper | ||
28 | * is needed when using -kernel | ||
29 | -- | 69 | -- |
30 | 2.20.1 | 70 | 2.20.1 |
31 | 71 | ||
32 | 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 | Instead of crashing in a confuse way, give some hint to the user | 3 | When using a Cortex-A15, the Virt machine does not use any |
4 | about why we aborted. He might report the issue without having | 4 | MPCore peripherals. Remove the dependency. |
5 | to use a debugger. | ||
6 | 5 | ||
6 | Fixes: 7951c7b7c05 ("hw/arm: Express dependencies of the virt machine with Kconfig") | ||
7 | Reported-by: Miroslav Rezanina <mrezanin@redhat.com> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
8 | Message-id: 20191209134552.27733-1-philmd@redhat.com | 9 | Message-id: 20201107114852.271922-1-philmd@redhat.com |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 12 | --- |
13 | target/arm/helper.c | 18 +++++++++++++++--- | 13 | hw/arm/Kconfig | 1 - |
14 | 1 file changed, 15 insertions(+), 3 deletions(-) | 14 | 1 file changed, 1 deletion(-) |
15 | 15 | ||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 16 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper.c | 18 | --- a/hw/arm/Kconfig |
19 | +++ b/target/arm/helper.c | 19 | +++ b/hw/arm/Kconfig |
20 | @@ -XXX,XX +XXX,XX @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el) | 20 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
21 | env->hflags = rebuild_hflags_a64(env, el, fp_el, mmu_idx); | 21 | imply VFIO_PLATFORM |
22 | } | 22 | imply VFIO_XGMAC |
23 | 23 | imply TPM_TIS_SYSBUS | |
24 | +static inline void assert_hflags_rebuild_correctly(CPUARMState *env) | 24 | - select A15MPCORE |
25 | +{ | 25 | select ACPI |
26 | +#ifdef CONFIG_DEBUG_TCG | 26 | select ARM_SMMUV3 |
27 | + uint32_t env_flags_current = env->hflags; | 27 | select GPIO_KEY |
28 | + uint32_t env_flags_rebuilt = rebuild_hflags_internal(env); | ||
29 | + | ||
30 | + if (unlikely(env_flags_current != env_flags_rebuilt)) { | ||
31 | + fprintf(stderr, "TCG hflags mismatch (current:0x%08x rebuilt:0x%08x)\n", | ||
32 | + env_flags_current, env_flags_rebuilt); | ||
33 | + abort(); | ||
34 | + } | ||
35 | +#endif | ||
36 | +} | ||
37 | + | ||
38 | void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
39 | target_ulong *cs_base, uint32_t *pflags) | ||
40 | { | ||
41 | @@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, | ||
42 | uint32_t pstate_for_ss; | ||
43 | |||
44 | *cs_base = 0; | ||
45 | -#ifdef CONFIG_DEBUG_TCG | ||
46 | - assert(flags == rebuild_hflags_internal(env)); | ||
47 | -#endif | ||
48 | + assert_hflags_rebuild_correctly(env); | ||
49 | |||
50 | if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { | ||
51 | *pc = env->pc; | ||
52 | -- | 28 | -- |
53 | 2.20.1 | 29 | 2.20.1 |
54 | 30 | ||
55 | 31 | diff view generated by jsdifflib |
1 | From: Niek Linnenbank <nieklinnenbank@gmail.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | After setting CP15 bits in arm_set_cpu_on() the cached hflags must | 3 | The helper function did not get updated when we reorganized |
4 | be rebuild to reflect the changed processor state. Without rebuilding, | 4 | the vector register file for SVE. Since then, the neon dregs |
5 | the cached hflags would be inconsistent until the next call to | 5 | are non-sequential and cannot be simply indexed. |
6 | arm_rebuild_hflags(). When QEMU is compiled with debugging enabled | ||
7 | (--enable-debug), this problem is captured shortly after the first | ||
8 | call to arm_set_cpu_on() for CPUs running in ARM 32-bit non-secure mode: | ||
9 | 6 | ||
10 | qemu-system-arm: target/arm/helper.c:11359: cpu_get_tb_cpu_state: | 7 | At the same time, make the helper function operate on 64-bit |
11 | Assertion `flags == rebuild_hflags_internal(env)' failed. | 8 | quantities so that we do not have to call it twice. |
12 | Aborted (core dumped) | ||
13 | 9 | ||
14 | Fixes: 0c7f8c43daf65 | 10 | Fixes: c39c2b9043e |
15 | Cc: qemu-stable@nongnu.org | 11 | Reported-by: Ard Biesheuvel <ardb@kernel.org> |
16 | Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> | 12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 13 | [PMM: use aa32_vfp_dreg() rather than opencoding] |
14 | Message-id: 20201105171126.88014-1-richard.henderson@linaro.org | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
19 | --- | 17 | --- |
20 | target/arm/arm-powerctl.c | 3 +++ | 18 | target/arm/helper.h | 2 +- |
21 | 1 file changed, 3 insertions(+) | 19 | target/arm/op_helper.c | 23 +++++++++-------- |
20 | target/arm/translate-neon.c.inc | 44 +++++++++++---------------------- | ||
21 | 3 files changed, 29 insertions(+), 40 deletions(-) | ||
22 | 22 | ||
23 | diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c | 23 | diff --git a/target/arm/helper.h b/target/arm/helper.h |
24 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/arm-powerctl.c | 25 | --- a/target/arm/helper.h |
26 | +++ b/target/arm/arm-powerctl.c | 26 | +++ b/target/arm/helper.h |
27 | @@ -XXX,XX +XXX,XX @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state, | 27 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr) |
28 | target_cpu->env.regs[0] = info->context_id; | 28 | DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr) |
29 | DEF_HELPER_FLAGS_1(recpe_u32, TCG_CALL_NO_RWG, i32, i32) | ||
30 | DEF_HELPER_FLAGS_1(rsqrte_u32, TCG_CALL_NO_RWG, i32, i32) | ||
31 | -DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i32, i32, i32, ptr, i32) | ||
32 | +DEF_HELPER_FLAGS_4(neon_tbl, TCG_CALL_NO_RWG, i64, env, i32, i64, i64) | ||
33 | |||
34 | DEF_HELPER_3(shl_cc, i32, env, i32, i32) | ||
35 | DEF_HELPER_3(shr_cc, i32, env, i32, i32) | ||
36 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/target/arm/op_helper.c | ||
39 | +++ b/target/arm/op_helper.c | ||
40 | @@ -XXX,XX +XXX,XX @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, | ||
41 | cpu_loop_exit_restore(cs, ra); | ||
42 | } | ||
43 | |||
44 | -uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn, | ||
45 | - uint32_t maxindex) | ||
46 | +uint64_t HELPER(neon_tbl)(CPUARMState *env, uint32_t desc, | ||
47 | + uint64_t ireg, uint64_t def) | ||
48 | { | ||
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; | ||
29 | } | 72 | } |
30 | 73 | return val; | |
31 | + /* CP15 update requires rebuilding hflags */ | 74 | } |
32 | + arm_rebuild_hflags(&target_cpu->env); | 75 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc |
76 | index XXXXXXX..XXXXXXX 100644 | ||
77 | --- a/target/arm/translate-neon.c.inc | ||
78 | +++ b/target/arm/translate-neon.c.inc | ||
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; | ||
93 | } | ||
94 | |||
95 | - n = a->len + 1; | ||
96 | - if ((a->vn + n) > 32) { | ||
97 | + if ((a->vn + a->len + 1) > 32) { | ||
98 | /* | ||
99 | * This is UNPREDICTABLE; we choose to UNDEF to avoid the | ||
100 | * helper function running off the end of the register file. | ||
101 | */ | ||
102 | return false; | ||
103 | } | ||
104 | - n <<= 3; | ||
105 | - tmp = tcg_temp_new_i32(); | ||
106 | - if (a->op) { | ||
107 | - read_neon_element32(tmp, a->vd, 0, MO_32); | ||
108 | - } else { | ||
109 | - tcg_gen_movi_i32(tmp, 0); | ||
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); | ||
33 | + | 141 | + |
34 | /* Start the new CPU at the requested address */ | 142 | + tcg_temp_free_i64(def); |
35 | cpu_set_pc(target_cpu_state, info->entry); | 143 | + tcg_temp_free_i64(val); |
144 | + tcg_temp_free_i32(desc); | ||
145 | return true; | ||
146 | } | ||
36 | 147 | ||
37 | -- | 148 | -- |
38 | 2.20.1 | 149 | 2.20.1 |
39 | 150 | ||
40 | 151 | diff view generated by jsdifflib |
1 | From: Simon Veith <sveith@amazon.de> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | The bit offsets in the EVT_SET_ADDR2 macro do not match those specified | 3 | We can use one MPC per SRAM bank, but we currently only wire the |
4 | in the ARM SMMUv3 Architecture Specification. In all events that use | 4 | IRQ from the first expansion MPC to the IRQ splitter. Fix that. |
5 | this macro, e.g. F_WALK_EABT, the faulting fetch address or IPA actually | ||
6 | occupies the 32-bit words 6 and 7 in the event record contiguously, with | ||
7 | the upper and lower unused bits clear due to alignment or maximum | ||
8 | supported address bits. How many bits are clear depends on the | ||
9 | individual event type. | ||
10 | 5 | ||
11 | Update the macro to write to the correct words in the event record so | 6 | Fixes: bb75e16d5e6 ("hw/arm/iotkit: Wire up MPC interrupt lines") |
12 | that guest drivers can obtain accurate address information on events. | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
13 | 8 | Message-id: 20201107193403.436146-2-f4bug@amsat.org | |
14 | ref. ARM IHI 0070C, sections 7.3.12 through 7.3.16. | ||
15 | |||
16 | Signed-off-by: Simon Veith <sveith@amazon.de> | ||
17 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
18 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
19 | Message-id: 1576509312-13083-6-git-send-email-sveith@amazon.de | ||
20 | Cc: Eric Auger <eric.auger@redhat.com> | ||
21 | Cc: qemu-devel@nongnu.org | ||
22 | Cc: qemu-arm@nongnu.org | ||
23 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
24 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
26 | --- | 11 | --- |
27 | hw/arm/smmuv3-internal.h | 4 ++-- | 12 | hw/arm/armsse.c | 3 ++- |
28 | 1 file changed, 2 insertions(+), 2 deletions(-) | 13 | 1 file changed, 2 insertions(+), 1 deletion(-) |
29 | 14 | ||
30 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h | 15 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c |
31 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/arm/smmuv3-internal.h | 17 | --- a/hw/arm/armsse.c |
33 | +++ b/hw/arm/smmuv3-internal.h | 18 | +++ b/hw/arm/armsse.c |
34 | @@ -XXX,XX +XXX,XX @@ typedef struct SMMUEventInfo { | 19 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) |
35 | } while (0) | 20 | qdev_get_gpio_in(dev_splitter, 0)); |
36 | #define EVT_SET_ADDR2(x, addr) \ | 21 | qdev_connect_gpio_out(dev_splitter, 0, |
37 | do { \ | 22 | qdev_get_gpio_in_named(dev_secctl, |
38 | - (x)->word[7] = deposit32((x)->word[7], 3, 29, addr >> 16); \ | 23 | - "mpc_status", 0)); |
39 | - (x)->word[7] = deposit32((x)->word[7], 0, 16, addr & 0xffff);\ | 24 | + "mpc_status", |
40 | + (x)->word[7] = (uint32_t)(addr >> 32); \ | 25 | + i - IOTS_NUM_EXP_MPC)); |
41 | + (x)->word[6] = (uint32_t)(addr & 0xffffffff); \ | 26 | } |
42 | } while (0) | 27 | |
43 | 28 | qdev_connect_gpio_out(dev_splitter, 1, | |
44 | void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *event); | ||
45 | -- | 29 | -- |
46 | 2.20.1 | 30 | 2.20.1 |
47 | 31 | ||
48 | 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 | Prepare for SoCs such as the ASPEED AST2600 whose firmware configures | 3 | The system configuration controller (SYSCFG) doesn't have |
4 | CNTFRQ to values significantly larger than the static 62.5MHz value | 4 | any output IRQ (and the INTC input #71 belongs to the UART6). |
5 | currently derived from GTIMER_SCALE. As the OS potentially derives its | 5 | Remove the invalid code. |
6 | timer periods from the CNTFRQ value the lack of support for running | ||
7 | QEMUTimers at the appropriate rate leads to sticky behaviour in the | ||
8 | guest. | ||
9 | 6 | ||
10 | Substitute the GTIMER_SCALE constant with use of a helper to derive the | 7 | Fixes: db635521a02 ("stm32f205: Add the stm32f205 SoC") |
11 | period from gt_cntfrq_hz stored in struct ARMCPU. Initially set | 8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | gt_cntfrq_hz to the frequency associated with GTIMER_SCALE so current | 9 | Message-id: 20201107193403.436146-3-f4bug@amsat.org |
13 | behaviour is maintained. | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | |||
15 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | ||
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
17 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
18 | Message-id: 40bd8df043f66e1ccfb3e9482999d099ac72bb2e.1576215453.git-series.andrew@aj.id.au | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 12 | --- |
21 | target/arm/cpu.h | 5 +++++ | 13 | include/hw/misc/stm32f2xx_syscfg.h | 2 -- |
22 | target/arm/cpu.c | 8 ++++++++ | 14 | hw/arm/stm32f205_soc.c | 1 - |
23 | target/arm/helper.c | 10 +++++++--- | 15 | hw/misc/stm32f2xx_syscfg.c | 2 -- |
24 | 3 files changed, 20 insertions(+), 3 deletions(-) | 16 | 3 files changed, 5 deletions(-) |
25 | 17 | ||
26 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 18 | diff --git a/include/hw/misc/stm32f2xx_syscfg.h b/include/hw/misc/stm32f2xx_syscfg.h |
27 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/target/arm/cpu.h | 20 | --- a/include/hw/misc/stm32f2xx_syscfg.h |
29 | +++ b/target/arm/cpu.h | 21 | +++ b/include/hw/misc/stm32f2xx_syscfg.h |
30 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 22 | @@ -XXX,XX +XXX,XX @@ struct STM32F2XXSyscfgState { |
31 | */ | 23 | uint32_t syscfg_exticr3; |
32 | DECLARE_BITMAP(sve_vq_map, ARM_MAX_VQ); | 24 | uint32_t syscfg_exticr4; |
33 | DECLARE_BITMAP(sve_vq_init, ARM_MAX_VQ); | 25 | uint32_t syscfg_cmpcr; |
34 | + | 26 | - |
35 | + /* Generic timer counter frequency, in Hz */ | 27 | - qemu_irq irq; |
36 | + uint64_t gt_cntfrq_hz; | ||
37 | }; | 28 | }; |
38 | 29 | ||
39 | +unsigned int gt_cntfrq_period_ns(ARMCPU *cpu); | 30 | #endif /* HW_STM32F2XX_SYSCFG_H */ |
40 | + | 31 | diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c |
41 | void arm_cpu_post_init(Object *obj); | ||
42 | |||
43 | uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz); | ||
44 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
46 | --- a/target/arm/cpu.c | 33 | --- a/hw/arm/stm32f205_soc.c |
47 | +++ b/target/arm/cpu.c | 34 | +++ b/hw/arm/stm32f205_soc.c |
48 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_initfn(Object *obj) | 35 | @@ -XXX,XX +XXX,XX @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) |
49 | if (tcg_enabled()) { | ||
50 | cpu->psci_version = 2; /* TCG implements PSCI 0.2 */ | ||
51 | } | 36 | } |
52 | + | 37 | busdev = SYS_BUS_DEVICE(dev); |
53 | + cpu->gt_cntfrq_hz = NANOSECONDS_PER_SECOND / GTIMER_SCALE; | 38 | sysbus_mmio_map(busdev, 0, 0x40013800); |
54 | } | 39 | - sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, 71)); |
55 | 40 | ||
56 | static Property arm_cpu_reset_cbar_property = | 41 | /* Attach UART (uses USART registers) and USART controllers */ |
57 | @@ -XXX,XX +XXX,XX @@ static void arm_set_init_svtor(Object *obj, Visitor *v, const char *name, | 42 | for (i = 0; i < STM_NUM_USARTS; i++) { |
58 | visit_type_uint32(v, name, &cpu->init_svtor, errp); | 43 | diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c |
59 | } | 44 | index XXXXXXX..XXXXXXX 100644 |
60 | 45 | --- a/hw/misc/stm32f2xx_syscfg.c | |
61 | +unsigned int gt_cntfrq_period_ns(ARMCPU *cpu) | 46 | +++ b/hw/misc/stm32f2xx_syscfg.c |
62 | +{ | 47 | @@ -XXX,XX +XXX,XX @@ static void stm32f2xx_syscfg_init(Object *obj) |
63 | + return NANOSECONDS_PER_SECOND > cpu->gt_cntfrq_hz ? | ||
64 | + NANOSECONDS_PER_SECOND / cpu->gt_cntfrq_hz : 1; | ||
65 | +} | ||
66 | + | ||
67 | void arm_cpu_post_init(Object *obj) | ||
68 | { | 48 | { |
69 | ARMCPU *cpu = ARM_CPU(obj); | 49 | STM32F2XXSyscfgState *s = STM32F2XX_SYSCFG(obj); |
70 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 50 | |
71 | index XXXXXXX..XXXXXXX 100644 | 51 | - sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); |
72 | --- a/target/arm/helper.c | 52 | - |
73 | +++ b/target/arm/helper.c | 53 | memory_region_init_io(&s->mmio, obj, &stm32f2xx_syscfg_ops, s, |
74 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gt_stimer_access(CPUARMState *env, | 54 | TYPE_STM32F2XX_SYSCFG, 0x400); |
75 | 55 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); | |
76 | static uint64_t gt_get_countervalue(CPUARMState *env) | ||
77 | { | ||
78 | - return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / GTIMER_SCALE; | ||
79 | + ARMCPU *cpu = env_archcpu(env); | ||
80 | + | ||
81 | + return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / gt_cntfrq_period_ns(cpu); | ||
82 | } | ||
83 | |||
84 | static void gt_recalc_timer(ARMCPU *cpu, int timeridx) | ||
85 | @@ -XXX,XX +XXX,XX @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx) | ||
86 | * set the timer for as far in the future as possible. When the | ||
87 | * timer expires we will reset the timer for any remaining period. | ||
88 | */ | ||
89 | - if (nexttick > INT64_MAX / GTIMER_SCALE) { | ||
90 | + if (nexttick > INT64_MAX / gt_cntfrq_period_ns(cpu)) { | ||
91 | timer_mod_ns(cpu->gt_timer[timeridx], INT64_MAX); | ||
92 | } else { | ||
93 | timer_mod(cpu->gt_timer[timeridx], nexttick); | ||
94 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
95 | |||
96 | static uint64_t gt_virt_cnt_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
97 | { | ||
98 | + ARMCPU *cpu = env_archcpu(env); | ||
99 | + | ||
100 | /* Currently we have no support for QEMUTimer in linux-user so we | ||
101 | * can't call gt_get_countervalue(env), instead we directly | ||
102 | * call the lower level functions. | ||
103 | */ | ||
104 | - return cpu_get_clock() / GTIMER_SCALE; | ||
105 | + return cpu_get_clock() / gt_cntfrq_period_ns(cpu); | ||
106 | } | ||
107 | |||
108 | static const ARMCPRegInfo generic_timer_cp_reginfo[] = { | ||
109 | -- | 56 | -- |
110 | 2.20.1 | 57 | 2.20.1 |
111 | 58 | ||
112 | 59 | diff view generated by jsdifflib |
1 | From: Simon Veith <sveith@amazon.de> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | When checking whether a stream ID is in range of the stream table, we | 3 | omap2420_mpu_init() introduced in commit 827df9f3c5f ("Add basic |
4 | have so far been only checking it against our implementation limit | 4 | OMAP2 chip support") takes care of creating the 3 UARTs. |
5 | (SMMU_IDR1_SIDSIZE). However, the guest can program the | ||
6 | STRTAB_BASE_CFG.LOG2SIZE field to a size that is smaller than this | ||
7 | limit. | ||
8 | 5 | ||
9 | Check the stream ID against this limit as well to match the hardware | 6 | Then commit 58a26b477e9 ("Emulate a serial bluetooth HCI with H4+ |
10 | behavior of raising C_BAD_STREAMID events in case the limit is exceeded. | 7 | extensions and attach to n8x0's UART") added n8x0_uart_setup() |
11 | Also, ensure that we do not go one entry beyond the end of the table by | 8 | which create the UART and connects it to an IRQ output, |
12 | checking that its index is strictly smaller than the table size. | 9 | overwritting the existing peripheral and its IRQ connection. |
10 | This is incorrect. | ||
13 | 11 | ||
14 | ref. ARM IHI 0070C, section 6.3.24. | 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. | ||
15 | 16 | ||
16 | Signed-off-by: Simon Veith <sveith@amazon.de> | 17 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
17 | Acked-by: Eric Auger <eric.auger@redhat.com> | 18 | Message-id: 20201107193403.436146-4-f4bug@amsat.org |
18 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
19 | Message-id: 1576509312-13083-4-git-send-email-sveith@amazon.de | ||
20 | Cc: Eric Auger <eric.auger@redhat.com> | ||
21 | Cc: qemu-devel@nongnu.org | ||
22 | Cc: qemu-arm@nongnu.org | ||
23 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | --- | 21 | --- |
26 | hw/arm/smmuv3.c | 8 ++++++-- | 22 | hw/arm/nseries.c | 11 ----------- |
27 | 1 file changed, 6 insertions(+), 2 deletions(-) | 23 | 1 file changed, 11 deletions(-) |
28 | 24 | ||
29 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 25 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c |
30 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
31 | --- a/hw/arm/smmuv3.c | 27 | --- a/hw/arm/nseries.c |
32 | +++ b/hw/arm/smmuv3.c | 28 | +++ b/hw/arm/nseries.c |
33 | @@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, | 29 | @@ -XXX,XX +XXX,XX @@ static void n8x0_cbus_setup(struct n800_s *s) |
34 | SMMUEventInfo *event) | 30 | cbus_attach(cbus, s->tahvo = tahvo_init(tahvo_irq, 1)); |
31 | } | ||
32 | |||
33 | -static void n8x0_uart_setup(struct n800_s *s) | ||
34 | -{ | ||
35 | - Chardev *radio = qemu_chr_new("bt-dummy-uart", "null", NULL); | ||
36 | - /* | ||
37 | - * Note: We used to connect N8X0_BT_RESET_GPIO and N8X0_BT_WKUP_GPIO | ||
38 | - * here, but this code has been removed with the bluetooth backend. | ||
39 | - */ | ||
40 | - omap_uart_attach(s->mpu->uart[BT_UART], radio); | ||
41 | -} | ||
42 | - | ||
43 | static void n8x0_usb_setup(struct n800_s *s) | ||
35 | { | 44 | { |
36 | dma_addr_t addr; | 45 | SysBusDevice *dev; |
37 | + uint32_t log2size; | 46 | @@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine, |
38 | int ret; | 47 | n8x0_spi_setup(s); |
39 | 48 | n8x0_dss_setup(s); | |
40 | trace_smmuv3_find_ste(sid, s->features, s->sid_split); | 49 | n8x0_cbus_setup(s); |
41 | - /* Check SID range */ | 50 | - n8x0_uart_setup(s); |
42 | - if (sid > (1 << SMMU_IDR1_SIDSIZE)) { | 51 | if (machine_usb(machine)) { |
43 | + log2size = FIELD_EX32(s->strtab_base_cfg, STRTAB_BASE_CFG, LOG2SIZE); | 52 | n8x0_usb_setup(s); |
44 | + /* | ||
45 | + * Check SID range against both guest-configured and implementation limits | ||
46 | + */ | ||
47 | + if (sid >= (1 << MIN(log2size, SMMU_IDR1_SIDSIZE))) { | ||
48 | event->type = SMMU_EVT_C_BAD_STREAMID; | ||
49 | return -EINVAL; | ||
50 | } | 53 | } |
51 | -- | 54 | -- |
52 | 2.20.1 | 55 | 2.20.1 |
53 | 56 | ||
54 | 57 | diff view generated by jsdifflib |
1 | From: Simon Veith <sveith@amazon.de> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Per the specification, and as observed in hardware, the SMMUv3 aligns | 3 | The MusicPal board code connects both of the IRQ outputs of the UART |
4 | the SMMU_STRTAB_BASE address to the size of the table by masking out the | 4 | to the same INTC qemu_irq. Connecting two qemu_irqs outputs directly |
5 | respective least significant bits in the ADDR field. | 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). | ||
6 | 9 | ||
7 | Apply this masking logic to our smmu_find_ste() lookup function per the | 10 | This kind of wiring needs an explicitly created OR gate; add one. |
8 | specification. | ||
9 | 11 | ||
10 | ref. ARM IHI 0070C, section 6.3.23. | 12 | Inspired-by: Peter Maydell <peter.maydell@linaro.org> |
11 | 13 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | |
12 | Signed-off-by: Simon Veith <sveith@amazon.de> | 14 | Message-id: 20201107193403.436146-5-f4bug@amsat.org |
13 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
14 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
15 | Message-id: 1576509312-13083-5-git-send-email-sveith@amazon.de | ||
16 | Cc: Eric Auger <eric.auger@redhat.com> | ||
17 | Cc: qemu-devel@nongnu.org | ||
18 | Cc: qemu-arm@nongnu.org | ||
19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | --- | 17 | --- |
22 | hw/arm/smmuv3.c | 18 ++++++++++++++---- | 18 | hw/arm/musicpal.c | 17 +++++++++++++---- |
23 | 1 file changed, 14 insertions(+), 4 deletions(-) | 19 | hw/arm/Kconfig | 1 + |
20 | 2 files changed, 14 insertions(+), 4 deletions(-) | ||
24 | 21 | ||
25 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | 22 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
26 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/hw/arm/smmuv3.c | 24 | --- a/hw/arm/musicpal.c |
28 | +++ b/hw/arm/smmuv3.c | 25 | +++ b/hw/arm/musicpal.c |
29 | @@ -XXX,XX +XXX,XX @@ bad_ste: | 26 | @@ -XXX,XX +XXX,XX @@ |
30 | static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, | 27 | #include "ui/console.h" |
31 | SMMUEventInfo *event) | 28 | #include "hw/i2c/i2c.h" |
32 | { | 29 | #include "hw/irq.h" |
33 | - dma_addr_t addr; | 30 | +#include "hw/or-irq.h" |
34 | + dma_addr_t addr, strtab_base; | 31 | #include "hw/audio/wm8750.h" |
35 | uint32_t log2size; | 32 | #include "sysemu/block-backend.h" |
36 | + int strtab_size_shift; | 33 | #include "sysemu/runstate.h" |
37 | int ret; | 34 | @@ -XXX,XX +XXX,XX @@ |
38 | 35 | #define MP_TIMER4_IRQ 7 | |
39 | trace_smmuv3_find_ste(sid, s->features, s->sid_split); | 36 | #define MP_EHCI_IRQ 8 |
40 | @@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, | 37 | #define MP_ETH_IRQ 9 |
41 | } | 38 | -#define MP_UART1_IRQ 11 |
42 | if (s->features & SMMU_FEATURE_2LVL_STE) { | 39 | -#define MP_UART2_IRQ 11 |
43 | int l1_ste_offset, l2_ste_offset, max_l2_ste, span; | 40 | +#define MP_UART_SHARED_IRQ 11 |
44 | - dma_addr_t strtab_base, l1ptr, l2ptr; | 41 | #define MP_GPIO_IRQ 12 |
45 | + dma_addr_t l1ptr, l2ptr; | 42 | #define MP_RTC_IRQ 28 |
46 | STEDesc l1std; | 43 | #define MP_AUDIO_IRQ 30 |
47 | 44 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | |
48 | - strtab_base = s->strtab_base & SMMU_BASE_ADDR_MASK; | 45 | ARMCPU *cpu; |
49 | + /* | 46 | qemu_irq pic[32]; |
50 | + * Align strtab base address to table size. For this purpose, assume it | 47 | DeviceState *dev; |
51 | + * is not bounded by SMMU_IDR1_SIDSIZE. | 48 | + DeviceState *uart_orgate; |
52 | + */ | 49 | DeviceState *i2c_dev; |
53 | + strtab_size_shift = MAX(5, (int)log2size - s->sid_split - 1 + 3); | 50 | DeviceState *lcd_dev; |
54 | + strtab_base = s->strtab_base & SMMU_BASE_ADDR_MASK & | 51 | DeviceState *key_dev; |
55 | + ~MAKE_64BIT_MASK(0, strtab_size_shift); | 52 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) |
56 | l1_ste_offset = sid >> s->sid_split; | 53 | pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], |
57 | l2_ste_offset = sid & ((1 << s->sid_split) - 1); | 54 | pic[MP_TIMER4_IRQ], NULL); |
58 | l1ptr = (dma_addr_t)(strtab_base + l1_ste_offset * sizeof(l1std)); | 55 | |
59 | @@ -XXX,XX +XXX,XX @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, STE *ste, | 56 | - serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ], |
60 | } | 57 | + /* Logically OR both UART IRQs together */ |
61 | addr = l2ptr + l2_ste_offset * sizeof(*ste); | 58 | + uart_orgate = DEVICE(object_new(TYPE_OR_IRQ)); |
62 | } else { | 59 | + object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal); |
63 | - addr = (s->strtab_base & SMMU_BASE_ADDR_MASK) + sid * sizeof(*ste); | 60 | + qdev_realize_and_unref(uart_orgate, NULL, &error_fatal); |
64 | + strtab_size_shift = log2size + 5; | 61 | + qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]); |
65 | + strtab_base = s->strtab_base & SMMU_BASE_ADDR_MASK & | 62 | + |
66 | + ~MAKE_64BIT_MASK(0, strtab_size_shift); | 63 | + serial_mm_init(address_space_mem, MP_UART1_BASE, 2, |
67 | + addr = strtab_base + sid * sizeof(*ste); | 64 | + qdev_get_gpio_in(uart_orgate, 0), |
68 | } | 65 | 1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN); |
69 | 66 | - serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ], | |
70 | if (smmu_get_ste(s, addr, ste, event)) { | 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 | ||
71 | -- | 84 | -- |
72 | 2.20.1 | 85 | 2.20.1 |
73 | 86 | ||
74 | 87 | diff view generated by jsdifflib |
1 | From: Andrew Jeffery <andrew@aj.id.au> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | The corner-case codepath was adjusting nexttick such that overflow | 3 | We don't need to fill the full pic[] array if we only use |
4 | wouldn't occur when timer_mod() scaled the value back up. Remove a use | 4 | few of the interrupt lines. Directly call qdev_get_gpio_in() |
5 | of GTIMER_SCALE and avoid unnecessary operations by calling | 5 | when necessary. |
6 | timer_mod_ns() directly. | ||
7 | 6 | ||
8 | Signed-off-by: Andrew Jeffery <andrew@aj.id.au> | 7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Message-id: 20201107193403.436146-6-f4bug@amsat.org |
10 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Message-id: f8c680720e3abe55476e6d9cb604ad27fdbeb2e0.1576215453.git-series.andrew@aj.id.au | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 11 | --- |
14 | target/arm/helper.c | 5 +++-- | 12 | hw/arm/musicpal.c | 25 +++++++++++++------------ |
15 | 1 file changed, 3 insertions(+), 2 deletions(-) | 13 | 1 file changed, 13 insertions(+), 12 deletions(-) |
16 | 14 | ||
17 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 15 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/helper.c | 17 | --- a/hw/arm/musicpal.c |
20 | +++ b/target/arm/helper.c | 18 | +++ b/hw/arm/musicpal.c |
21 | @@ -XXX,XX +XXX,XX @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx) | 19 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info musicpal_binfo = { |
22 | * timer expires we will reset the timer for any remaining period. | 20 | static void musicpal_init(MachineState *machine) |
23 | */ | 21 | { |
24 | if (nexttick > INT64_MAX / GTIMER_SCALE) { | 22 | ARMCPU *cpu; |
25 | - nexttick = INT64_MAX / GTIMER_SCALE; | 23 | - qemu_irq pic[32]; |
26 | + timer_mod_ns(cpu->gt_timer[timeridx], INT64_MAX); | 24 | DeviceState *dev; |
27 | + } else { | 25 | + DeviceState *pic; |
28 | + timer_mod(cpu->gt_timer[timeridx], nexttick); | 26 | DeviceState *uart_orgate; |
29 | } | 27 | DeviceState *i2c_dev; |
30 | - timer_mod(cpu->gt_timer[timeridx], nexttick); | 28 | DeviceState *lcd_dev; |
31 | trace_arm_gt_recalc(timeridx, irqstate, nexttick); | 29 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) |
32 | } else { | 30 | &error_fatal); |
33 | /* Timer disabled: ISTATUS and timer output always clear */ | 31 | memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram); |
32 | |||
33 | - dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE, | ||
34 | + pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE, | ||
35 | qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); | ||
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); | ||
34 | -- | 85 | -- |
35 | 2.20.1 | 86 | 2.20.1 |
36 | 87 | ||
37 | 88 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The nseries machines have a codepath that allows them to load a | ||
2 | secondary bootloader. This code wasn't checking that the | ||
3 | load_image_targphys() succeeded. Check the return value and report | ||
4 | the error to the user. | ||
1 | 5 | ||
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 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20201103114918.11807-1-peter.maydell@linaro.org | ||
13 | --- | ||
14 | hw/arm/nseries.c | 15 +++++++++++---- | ||
15 | 1 file changed, 11 insertions(+), 4 deletions(-) | ||
16 | |||
17 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/nseries.c | ||
20 | +++ b/hw/arm/nseries.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine, | ||
22 | /* No, wait, better start at the ROM. */ | ||
23 | s->mpu->cpu->env.regs[15] = OMAP2_Q2_BASE + 0x400000; | ||
24 | |||
25 | - /* This is intended for loading the `secondary.bin' program from | ||
26 | + /* | ||
27 | + * This is intended for loading the `secondary.bin' program from | ||
28 | * Nokia images (the NOLO bootloader). The entry point seems | ||
29 | * to be at OMAP2_Q2_BASE + 0x400000. | ||
30 | * | ||
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); | ||
50 | -- | ||
51 | 2.20.1 | ||
52 | |||
53 | diff view generated by jsdifflib |
1 | From: Simon Veith <sveith@amazon.de> | 1 | From: Havard Skinnemoen <hskinnemoen@google.com> |
---|---|---|---|
2 | 2 | ||
3 | There are two issues with the current value of SMMU_BASE_ADDR_MASK: | 3 | The number of runs is equal to the number of 0-1 and 1-0 transitions, |
4 | plus one. Currently, it's counting the number of times these transitions | ||
5 | do _not_ happen, plus one. | ||
4 | 6 | ||
5 | - At the lower end, we are clearing bits [4:0]. Per the SMMUv3 spec, | 7 | Source: |
6 | we should also be treating bit 5 as zero in the base address. | 8 | https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf |
7 | - At the upper end, we are clearing bits [63:48]. Per the SMMUv3 spec, | 9 | section 2.3.4 point (3). |
8 | only bits [63:52] must be explicitly treated as zero. | ||
9 | 10 | ||
10 | Update the SMMU_BASE_ADDR_MASK value to mask out bits [63:52] and [5:0]. | 11 | Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com> |
11 | 12 | Message-id: 20201103011457.2959989-2-hskinnemoen@google.com | |
12 | ref. ARM IHI 0070C, section 6.3.23. | ||
13 | |||
14 | Signed-off-by: Simon Veith <sveith@amazon.de> | ||
15 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
16 | Tested-by: Eric Auger <eric.auger@redhat.com> | ||
17 | Message-id: 1576509312-13083-3-git-send-email-sveith@amazon.de | ||
18 | Cc: Eric Auger <eric.auger@redhat.com> | ||
19 | Cc: qemu-devel@nongnu.org | ||
20 | Cc: qemu-arm@nongnu.org | ||
21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
23 | --- | 15 | --- |
24 | hw/arm/smmuv3-internal.h | 2 +- | 16 | tests/qtest/npcm7xx_rng-test.c | 2 +- |
25 | 1 file changed, 1 insertion(+), 1 deletion(-) | 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
26 | 18 | ||
27 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h | 19 | diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c |
28 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/hw/arm/smmuv3-internal.h | 21 | --- a/tests/qtest/npcm7xx_rng-test.c |
30 | +++ b/hw/arm/smmuv3-internal.h | 22 | +++ b/tests/qtest/npcm7xx_rng-test.c |
31 | @@ -XXX,XX +XXX,XX @@ REG32(GERROR_IRQ_CFG2, 0x74) | 23 | @@ -XXX,XX +XXX,XX @@ static double calc_runs_p(const unsigned long *buf, unsigned int nr_bits) |
32 | 24 | pi = (double)nr_ones / nr_bits; | |
33 | #define A_STRTAB_BASE 0x80 /* 64b */ | 25 | |
34 | 26 | for (k = 0; k < nr_bits - 1; k++) { | |
35 | -#define SMMU_BASE_ADDR_MASK 0xffffffffffe0 | 27 | - vn_obs += !(test_bit(k, buf) ^ test_bit(k + 1, buf)); |
36 | +#define SMMU_BASE_ADDR_MASK 0xfffffffffffc0 | 28 | + vn_obs += (test_bit(k, buf) ^ test_bit(k + 1, buf)); |
37 | 29 | } | |
38 | REG32(STRTAB_BASE_CFG, 0x88) | 30 | vn_obs += 1; |
39 | FIELD(STRTAB_BASE_CFG, FMT, 16, 2) | 31 | |
40 | -- | 32 | -- |
41 | 2.20.1 | 33 | 2.20.1 |
42 | 34 | ||
43 | 35 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Checks for UNDEF cases should go before the "is VFP enabled?" access | ||
2 | check, except in special cases. Move a stray UNDEF check in the VTBL | ||
3 | trans function up above the access check. | ||
1 | 4 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20201109145324.2859-1-peter.maydell@linaro.org | ||
8 | --- | ||
9 | target/arm/translate-neon.c.inc | 8 ++++---- | ||
10 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
11 | |||
12 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/arm/translate-neon.c.inc | ||
15 | +++ b/target/arm/translate-neon.c.inc | ||
16 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) | ||
17 | return false; | ||
18 | } | ||
19 | |||
20 | - if (!vfp_access_check(s)) { | ||
21 | - return true; | ||
22 | - } | ||
23 | - | ||
24 | if ((a->vn + a->len + 1) > 32) { | ||
25 | /* | ||
26 | * This is UNPREDICTABLE; we choose to UNDEF to avoid the | ||
27 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) | ||
28 | return false; | ||
29 | } | ||
30 | |||
31 | + if (!vfp_access_check(s)) { | ||
32 | + return true; | ||
33 | + } | ||
34 | + | ||
35 | desc = tcg_const_i32((a->vn << 2) | a->len); | ||
36 | def = tcg_temp_new_i64(); | ||
37 | if (a->op) { | ||
38 | -- | ||
39 | 2.20.1 | ||
40 | |||
41 | diff view generated by jsdifflib |