1 | Patches for rc1: nothing major, just some minor bugfixes and | 1 | Just a collection of bug fixes this time around... |
---|---|---|---|
2 | code cleanups. | ||
3 | 2 | ||
3 | thanks | ||
4 | -- PMM | 4 | -- PMM |
5 | 5 | ||
6 | The following changes since commit f7e1914adad8885a5d4c70239ab90d901ed97e9f: | 6 | The following changes since commit 2a6ae69154542caa91dd17c40fd3f5ffbec300de: |
7 | 7 | ||
8 | Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201109' into staging (2020-11-10 09:24:56 +0000) | 8 | Merge tag 'pull-maintainer-ominbus-030723-1' of https://gitlab.com/stsquad/qemu into staging (2023-07-04 08:36:44 +0200) |
9 | 9 | ||
10 | are available in the Git repository at: | 10 | are available in the Git repository at: |
11 | 11 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201110 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230704 |
13 | 13 | ||
14 | for you to fetch changes up to b6c56c8a9a4064ea783f352f43c5df6231a110fa: | 14 | for you to fetch changes up to 86a78272f094857b4eda79d721c116e93942aa9a: |
15 | 15 | ||
16 | target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check (2020-11-10 11:03:48 +0000) | 16 | target/xtensa: Assert that interrupt level is within bounds (2023-07-04 14:27:08 +0100) |
17 | 17 | ||
18 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | target-arm queue: | 19 | target-arm queue: |
20 | * hw/arm/Kconfig: ARM_V7M depends on PTIMER | 20 | * Add raw_writes ops for register whose write induce TLB maintenance |
21 | * Minor coding style fixes | 21 | * hw/arm/sbsa-ref: use XHCI to replace EHCI |
22 | * docs: add some notes on the sbsa-ref machine | 22 | * Avoid splitting Zregs across lines in dump |
23 | * hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals | 23 | * Dump ZA[] when active |
24 | * target/arm: Fix neon VTBL/VTBX for len > 1 | 24 | * Fix SME full tile indexing |
25 | * hw/arm/armsse: Correct expansion MPC interrupt lines | 25 | * Handle IC IVAU to improve compatibility with JITs |
26 | * hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ | 26 | * xlnx-canfd-test: Fix code coverity issues |
27 | * hw/arm/nseries: Remove invalid/unnecessary n8x0_uart_setup() | 27 | * gdbstub: Guard M-profile code with CONFIG_TCG |
28 | * hw/arm/musicpal: Don't connect two qemu_irqs directly to the same input | 28 | * allwinner-sramc: Set class_size |
29 | * hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary | 29 | * target/xtensa: Assert that interrupt level is within bounds |
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 | ||
33 | 30 | ||
34 | ---------------------------------------------------------------- | 31 | ---------------------------------------------------------------- |
35 | Alex Bennée (1): | 32 | Akihiko Odaki (1): |
36 | docs: add some notes on the sbsa-ref machine | 33 | hw: arm: allwinner-sramc: Set class_size |
37 | 34 | ||
38 | AlexChen (1): | 35 | Eric Auger (1): |
39 | ssi: Fix bad printf format specifiers | 36 | target/arm: Add raw_writes ops for register whose write induce TLB maintenance |
40 | 37 | ||
41 | Andrew Jones (1): | 38 | Fabiano Rosas (1): |
42 | hw/arm/Kconfig: ARM_V7M depends on PTIMER | 39 | target/arm: gdbstub: Guard M-profile code with CONFIG_TCG |
43 | 40 | ||
44 | Havard Skinnemoen (1): | 41 | John Högberg (2): |
45 | tests/qtest/npcm7xx_rng-test: count runs properly | 42 | target/arm: Handle IC IVAU to improve compatibility with JITs |
43 | tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code | ||
46 | 44 | ||
47 | Peter Maydell (2): | 45 | Peter Maydell (1): |
48 | hw/arm/nseries: Check return value from load_image_targphys() | 46 | target/xtensa: Assert that interrupt level is within bounds |
49 | target/arm/translate-neon.c: Handle VTBL UNDEF case before VFP access check | ||
50 | 47 | ||
51 | Philippe Mathieu-Daudé (6): | 48 | Richard Henderson (3): |
52 | hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals | 49 | target/arm: Avoid splitting Zregs across lines in dump |
53 | hw/arm/armsse: Correct expansion MPC interrupt lines | 50 | target/arm: Dump ZA[] when active |
54 | hw/misc/stm32f2xx_syscfg: Remove extraneous IRQ | 51 | target/arm: Fix SME full tile indexing |
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 | 52 | ||
59 | Richard Henderson (1): | 53 | Vikram Garhwal (1): |
60 | target/arm: Fix neon VTBL/VTBX for len > 1 | 54 | tests/qtest: xlnx-canfd-test: Fix code coverity issues |
61 | 55 | ||
62 | Xinhao Zhang (3): | 56 | Yuquan Wang (1): |
63 | target/arm: add spaces around operator | 57 | hw/arm/sbsa-ref: use XHCI to replace EHCI |
64 | target/arm: Don't use '#' flag of printf format | ||
65 | target/arm: add space before the open parenthesis '(' | ||
66 | 58 | ||
67 | docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++ | 59 | docs/system/arm/sbsa.rst | 5 +- |
68 | docs/system/target-arm.rst | 1 + | 60 | hw/arm/sbsa-ref.c | 23 +++-- |
69 | include/hw/misc/stm32f2xx_syscfg.h | 2 -- | 61 | hw/misc/allwinner-sramc.c | 1 + |
70 | target/arm/helper.h | 2 +- | 62 | target/arm/cpu.c | 65 ++++++++----- |
71 | hw/arm/armsse.c | 3 +- | 63 | target/arm/gdbstub.c | 4 + |
72 | hw/arm/musicpal.c | 40 +++++++++++++++++---------- | 64 | target/arm/helper.c | 70 +++++++++++--- |
73 | hw/arm/nseries.c | 26 ++++++++---------- | 65 | target/arm/tcg/translate-sme.c | 24 +++-- |
74 | hw/arm/stm32f205_soc.c | 1 - | 66 | target/xtensa/exc_helper.c | 3 + |
75 | hw/misc/stm32f2xx_syscfg.c | 2 -- | 67 | tests/qtest/xlnx-canfd-test.c | 33 +++---- |
76 | hw/ssi/imx_spi.c | 2 +- | 68 | tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++++++++++ |
77 | hw/ssi/xilinx_spi.c | 2 +- | 69 | tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++ |
78 | target/arm/arch_dump.c | 8 +++--- | 70 | hw/arm/Kconfig | 2 +- |
79 | target/arm/arm-semi.c | 8 +++--- | 71 | tests/tcg/aarch64/Makefile.target | 13 ++- |
80 | target/arm/helper.c | 2 +- | 72 | 13 files changed, 436 insertions(+), 79 deletions(-) |
81 | target/arm/op_helper.c | 23 +++++++++------- | 73 | create mode 100644 tests/tcg/aarch64/icivau.c |
82 | target/arm/translate-a64.c | 4 +-- | 74 | create mode 100644 tests/tcg/aarch64/sme-outprod1.c |
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 | 75 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Eric Auger <eric.auger@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | The system configuration controller (SYSCFG) doesn't have | 3 | Some registers whose 'cooked' writefns induce TLB maintenance do |
4 | any output IRQ (and the INTC input #71 belongs to the UART6). | 4 | not have raw_writefn ops defined. If only the writefn ops is set |
5 | Remove the invalid code. | 5 | (ie. no raw_writefn is provided), it is assumed the cooked also |
6 | work as the raw one. For those registers it is not obvious the | ||
7 | tlb_flush works on KVM mode so better/safer setting the raw write. | ||
6 | 8 | ||
7 | Fixes: db635521a02 ("stm32f205: Add the stm32f205 SoC") | 9 | Signed-off-by: Eric Auger <eric.auger@redhat.com> |
8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20201107193403.436146-3-f4bug@amsat.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 13 | --- |
13 | include/hw/misc/stm32f2xx_syscfg.h | 2 -- | 14 | target/arm/helper.c | 23 +++++++++++++---------- |
14 | hw/arm/stm32f205_soc.c | 1 - | 15 | 1 file changed, 13 insertions(+), 10 deletions(-) |
15 | hw/misc/stm32f2xx_syscfg.c | 2 -- | ||
16 | 3 files changed, 5 deletions(-) | ||
17 | 16 | ||
18 | diff --git a/include/hw/misc/stm32f2xx_syscfg.h b/include/hw/misc/stm32f2xx_syscfg.h | 17 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
19 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/hw/misc/stm32f2xx_syscfg.h | 19 | --- a/target/arm/helper.c |
21 | +++ b/include/hw/misc/stm32f2xx_syscfg.h | 20 | +++ b/target/arm/helper.c |
22 | @@ -XXX,XX +XXX,XX @@ struct STM32F2XXSyscfgState { | 21 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
23 | uint32_t syscfg_exticr3; | 22 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 0, |
24 | uint32_t syscfg_exticr4; | 23 | .access = PL1_RW, .accessfn = access_tvm_trvm, |
25 | uint32_t syscfg_cmpcr; | 24 | .fgt = FGT_TTBR0_EL1, |
26 | - | 25 | - .writefn = vmsa_ttbr_write, .resetvalue = 0, |
27 | - qemu_irq irq; | 26 | + .writefn = vmsa_ttbr_write, .resetvalue = 0, .raw_writefn = raw_write, |
27 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), | ||
28 | offsetof(CPUARMState, cp15.ttbr0_ns) } }, | ||
29 | { .name = "TTBR1_EL1", .state = ARM_CP_STATE_BOTH, | ||
30 | .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 1, | ||
31 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
32 | .fgt = FGT_TTBR1_EL1, | ||
33 | - .writefn = vmsa_ttbr_write, .resetvalue = 0, | ||
34 | + .writefn = vmsa_ttbr_write, .resetvalue = 0, .raw_writefn = raw_write, | ||
35 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), | ||
36 | offsetof(CPUARMState, cp15.ttbr1_ns) } }, | ||
37 | { .name = "TCR_EL1", .state = ARM_CP_STATE_AA64, | ||
38 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { | ||
39 | .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
40 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s), | ||
41 | offsetof(CPUARMState, cp15.ttbr0_ns) }, | ||
42 | - .writefn = vmsa_ttbr_write, }, | ||
43 | + .writefn = vmsa_ttbr_write, .raw_writefn = raw_write }, | ||
44 | { .name = "TTBR1", .cp = 15, .crm = 2, .opc1 = 1, | ||
45 | .access = PL1_RW, .accessfn = access_tvm_trvm, | ||
46 | .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
47 | .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), | ||
48 | offsetof(CPUARMState, cp15.ttbr1_ns) }, | ||
49 | - .writefn = vmsa_ttbr_write, }, | ||
50 | + .writefn = vmsa_ttbr_write, .raw_writefn = raw_write }, | ||
28 | }; | 51 | }; |
29 | 52 | ||
30 | #endif /* HW_STM32F2XX_SYSCFG_H */ | 53 | static uint64_t aa64_fpcr_read(CPUARMState *env, const ARMCPRegInfo *ri) |
31 | diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c | 54 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { |
32 | index XXXXXXX..XXXXXXX 100644 | 55 | .type = ARM_CP_IO, |
33 | --- a/hw/arm/stm32f205_soc.c | 56 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, |
34 | +++ b/hw/arm/stm32f205_soc.c | 57 | .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hcr_el2), |
35 | @@ -XXX,XX +XXX,XX @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) | 58 | - .writefn = hcr_write }, |
36 | } | 59 | + .writefn = hcr_write, .raw_writefn = raw_write }, |
37 | busdev = SYS_BUS_DEVICE(dev); | 60 | { .name = "HCR", .state = ARM_CP_STATE_AA32, |
38 | sysbus_mmio_map(busdev, 0, 0x40013800); | 61 | .type = ARM_CP_ALIAS | ARM_CP_IO, |
39 | - sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m, 71)); | 62 | .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, |
40 | 63 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | |
41 | /* Attach UART (uses USART registers) and USART controllers */ | 64 | { .name = "TCR_EL2", .state = ARM_CP_STATE_BOTH, |
42 | for (i = 0; i < STM_NUM_USARTS; i++) { | 65 | .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 2, |
43 | diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c | 66 | .access = PL2_RW, .writefn = vmsa_tcr_el12_write, |
44 | index XXXXXXX..XXXXXXX 100644 | 67 | + .raw_writefn = raw_write, |
45 | --- a/hw/misc/stm32f2xx_syscfg.c | 68 | .fieldoffset = offsetof(CPUARMState, cp15.tcr_el[2]) }, |
46 | +++ b/hw/misc/stm32f2xx_syscfg.c | 69 | { .name = "VTCR", .state = ARM_CP_STATE_AA32, |
47 | @@ -XXX,XX +XXX,XX @@ static void stm32f2xx_syscfg_init(Object *obj) | 70 | .cp = 15, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2, |
48 | { | 71 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { |
49 | STM32F2XXSyscfgState *s = STM32F2XX_SYSCFG(obj); | 72 | .type = ARM_CP_64BIT | ARM_CP_ALIAS, |
50 | 73 | .access = PL2_RW, .accessfn = access_el3_aa32ns, | |
51 | - sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); | 74 | .fieldoffset = offsetof(CPUARMState, cp15.vttbr_el2), |
52 | - | 75 | - .writefn = vttbr_write }, |
53 | memory_region_init_io(&s->mmio, obj, &stm32f2xx_syscfg_ops, s, | 76 | + .writefn = vttbr_write, .raw_writefn = raw_write }, |
54 | TYPE_STM32F2XX_SYSCFG, 0x400); | 77 | { .name = "VTTBR_EL2", .state = ARM_CP_STATE_AA64, |
55 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); | 78 | .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 0, |
79 | - .access = PL2_RW, .writefn = vttbr_write, | ||
80 | + .access = PL2_RW, .writefn = vttbr_write, .raw_writefn = raw_write, | ||
81 | .fieldoffset = offsetof(CPUARMState, cp15.vttbr_el2) }, | ||
82 | { .name = "SCTLR_EL2", .state = ARM_CP_STATE_BOTH, | ||
83 | .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 0, | ||
84 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
85 | .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el[2]) }, | ||
86 | { .name = "TTBR0_EL2", .state = ARM_CP_STATE_AA64, | ||
87 | .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0, | ||
88 | - .access = PL2_RW, .resetvalue = 0, .writefn = vmsa_tcr_ttbr_el2_write, | ||
89 | + .access = PL2_RW, .resetvalue = 0, | ||
90 | + .writefn = vmsa_tcr_ttbr_el2_write, .raw_writefn = raw_write, | ||
91 | .fieldoffset = offsetof(CPUARMState, cp15.ttbr0_el[2]) }, | ||
92 | { .name = "HTTBR", .cp = 15, .opc1 = 4, .crm = 2, | ||
93 | .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_ALIAS, | ||
94 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_cp_reginfo[] = { | ||
95 | { .name = "SCR_EL3", .state = ARM_CP_STATE_AA64, | ||
96 | .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 0, | ||
97 | .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.scr_el3), | ||
98 | - .resetfn = scr_reset, .writefn = scr_write }, | ||
99 | + .resetfn = scr_reset, .writefn = scr_write, .raw_writefn = raw_write }, | ||
100 | { .name = "SCR", .type = ARM_CP_ALIAS | ARM_CP_NEWEL, | ||
101 | .cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 0, | ||
102 | .access = PL1_RW, .accessfn = access_trap_aa32s_el1, | ||
103 | .fieldoffset = offsetoflow32(CPUARMState, cp15.scr_el3), | ||
104 | - .writefn = scr_write }, | ||
105 | + .writefn = scr_write, .raw_writefn = raw_write }, | ||
106 | { .name = "SDER32_EL3", .state = ARM_CP_STATE_AA64, | ||
107 | .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 1, | ||
108 | .access = PL3_RW, .resetvalue = 0, | ||
109 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vhe_reginfo[] = { | ||
110 | { .name = "TTBR1_EL2", .state = ARM_CP_STATE_AA64, | ||
111 | .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 1, | ||
112 | .access = PL2_RW, .writefn = vmsa_tcr_ttbr_el2_write, | ||
113 | + .raw_writefn = raw_write, | ||
114 | .fieldoffset = offsetof(CPUARMState, cp15.ttbr1_el[2]) }, | ||
115 | #ifndef CONFIG_USER_ONLY | ||
116 | { .name = "CNTHV_CVAL_EL2", .state = ARM_CP_STATE_AA64, | ||
56 | -- | 117 | -- |
57 | 2.20.1 | 118 | 2.34.1 |
58 | |||
59 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Yuquan Wang <wangyuquan1236@phytium.com.cn> |
---|---|---|---|
2 | 2 | ||
3 | The MusicPal board code connects both of the IRQ outputs of the UART | 3 | The current sbsa-ref cannot use EHCI controller which is only |
4 | to the same INTC qemu_irq. Connecting two qemu_irqs outputs directly | 4 | able to do 32-bit DMA, since sbsa-ref doesn't have RAM below 4GB. |
5 | to the same input is not valid as it produces subtly wrong behaviour | 5 | Hence, this uses XHCI to provide a usb controller with 64-bit |
6 | (for instance if both the IRQ lines are high, and then one goes | 6 | DMA capablity instead of EHCI. |
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). | ||
9 | 7 | ||
10 | This kind of wiring needs an explicitly created OR gate; add one. | 8 | We bump the platform version to 0.3 with this change. Although the |
9 | hardware at the USB controller address changes, the firmware and | ||
10 | Linux can both cope with this -- on an older non-XHCI-aware | ||
11 | firmware/kernel setup the probe routine simply fails and the guest | ||
12 | proceeds without any USB. (This isn't a loss of functionality, | ||
13 | because the old USB controller never worked in the first place.) So | ||
14 | we can call this a backwards-compatible change and only bump the | ||
15 | minor version. | ||
11 | 16 | ||
12 | Inspired-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn> |
13 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 18 | Message-id: 20230621103847.447508-2-wangyuquan1236@phytium.com.cn |
14 | Message-id: 20201107193403.436146-5-f4bug@amsat.org | 19 | [PMM: tweaked commit message; add line to docs about what |
20 | changes in platform version 0.3] | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 23 | --- |
18 | hw/arm/musicpal.c | 17 +++++++++++++---- | 24 | docs/system/arm/sbsa.rst | 5 ++++- |
19 | hw/arm/Kconfig | 1 + | 25 | hw/arm/sbsa-ref.c | 23 +++++++++++++---------- |
20 | 2 files changed, 14 insertions(+), 4 deletions(-) | 26 | hw/arm/Kconfig | 2 +- |
27 | 3 files changed, 18 insertions(+), 12 deletions(-) | ||
21 | 28 | ||
22 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | 29 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst |
23 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/hw/arm/musicpal.c | 31 | --- a/docs/system/arm/sbsa.rst |
25 | +++ b/hw/arm/musicpal.c | 32 | +++ b/docs/system/arm/sbsa.rst |
33 | @@ -XXX,XX +XXX,XX @@ The ``sbsa-ref`` board supports: | ||
34 | - A configurable number of AArch64 CPUs | ||
35 | - GIC version 3 | ||
36 | - System bus AHCI controller | ||
37 | - - System bus EHCI controller | ||
38 | + - System bus XHCI controller | ||
39 | - CDROM and hard disc on AHCI bus | ||
40 | - E1000E ethernet card on PCIe bus | ||
41 | - Bochs display adapter on PCIe bus | ||
42 | @@ -XXX,XX +XXX,XX @@ Platform version changes: | ||
43 | |||
44 | 0.2 | ||
45 | GIC ITS information is present in devicetree. | ||
46 | + | ||
47 | +0.3 | ||
48 | + The USB controller is an XHCI device, not EHCI | ||
49 | diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/hw/arm/sbsa-ref.c | ||
52 | +++ b/hw/arm/sbsa-ref.c | ||
26 | @@ -XXX,XX +XXX,XX @@ | 53 | @@ -XXX,XX +XXX,XX @@ |
27 | #include "ui/console.h" | 54 | #include "hw/pci-host/gpex.h" |
28 | #include "hw/i2c/i2c.h" | 55 | #include "hw/qdev-properties.h" |
29 | #include "hw/irq.h" | 56 | #include "hw/usb.h" |
30 | +#include "hw/or-irq.h" | 57 | +#include "hw/usb/xhci.h" |
31 | #include "hw/audio/wm8750.h" | 58 | #include "hw/char/pl011.h" |
32 | #include "sysemu/block-backend.h" | 59 | #include "hw/watchdog/sbsa_gwdt.h" |
33 | #include "sysemu/runstate.h" | 60 | #include "net/net.h" |
34 | @@ -XXX,XX +XXX,XX @@ | 61 | @@ -XXX,XX +XXX,XX @@ enum { |
35 | #define MP_TIMER4_IRQ 7 | 62 | SBSA_SECURE_UART_MM, |
36 | #define MP_EHCI_IRQ 8 | 63 | SBSA_SECURE_MEM, |
37 | #define MP_ETH_IRQ 9 | 64 | SBSA_AHCI, |
38 | -#define MP_UART1_IRQ 11 | 65 | - SBSA_EHCI, |
39 | -#define MP_UART2_IRQ 11 | 66 | + SBSA_XHCI, |
40 | +#define MP_UART_SHARED_IRQ 11 | 67 | }; |
41 | #define MP_GPIO_IRQ 12 | 68 | |
42 | #define MP_RTC_IRQ 28 | 69 | struct SBSAMachineState { |
43 | #define MP_AUDIO_IRQ 30 | 70 | @@ -XXX,XX +XXX,XX @@ static const MemMapEntry sbsa_ref_memmap[] = { |
44 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | 71 | [SBSA_SMMU] = { 0x60050000, 0x00020000 }, |
45 | ARMCPU *cpu; | 72 | /* Space here reserved for more SMMUs */ |
46 | qemu_irq pic[32]; | 73 | [SBSA_AHCI] = { 0x60100000, 0x00010000 }, |
47 | DeviceState *dev; | 74 | - [SBSA_EHCI] = { 0x60110000, 0x00010000 }, |
48 | + DeviceState *uart_orgate; | 75 | + [SBSA_XHCI] = { 0x60110000, 0x00010000 }, |
49 | DeviceState *i2c_dev; | 76 | /* Space here reserved for other devices */ |
50 | DeviceState *lcd_dev; | 77 | [SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 }, |
51 | DeviceState *key_dev; | 78 | /* 32-bit address PCIE MMIO space */ |
52 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | 79 | @@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = { |
53 | pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], | 80 | [SBSA_SECURE_UART] = 8, |
54 | pic[MP_TIMER4_IRQ], NULL); | 81 | [SBSA_SECURE_UART_MM] = 9, |
55 | 82 | [SBSA_AHCI] = 10, | |
56 | - serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ], | 83 | - [SBSA_EHCI] = 11, |
57 | + /* Logically OR both UART IRQs together */ | 84 | + [SBSA_XHCI] = 11, |
58 | + uart_orgate = DEVICE(object_new(TYPE_OR_IRQ)); | 85 | [SBSA_SMMU] = 12, /* ... to 15 */ |
59 | + object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal); | 86 | [SBSA_GWDT_WS0] = 16, |
60 | + qdev_realize_and_unref(uart_orgate, NULL, &error_fatal); | 87 | }; |
61 | + qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]); | 88 | @@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms) |
62 | + | 89 | * fw compatibility. |
63 | + serial_mm_init(address_space_mem, MP_UART1_BASE, 2, | 90 | */ |
64 | + qdev_get_gpio_in(uart_orgate, 0), | 91 | qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0); |
65 | 1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN); | 92 | - qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 2); |
66 | - serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ], | 93 | + qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 3); |
67 | + serial_mm_init(address_space_mem, MP_UART2_BASE, 2, | 94 | |
68 | + qdev_get_gpio_in(uart_orgate, 1), | 95 | if (ms->numa_state->have_numa_distance) { |
69 | 1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN); | 96 | int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); |
70 | 97 | @@ -XXX,XX +XXX,XX @@ static void create_ahci(const SBSAMachineState *sms) | |
71 | /* Register flash */ | 98 | } |
99 | } | ||
100 | |||
101 | -static void create_ehci(const SBSAMachineState *sms) | ||
102 | +static void create_xhci(const SBSAMachineState *sms) | ||
103 | { | ||
104 | - hwaddr base = sbsa_ref_memmap[SBSA_EHCI].base; | ||
105 | - int irq = sbsa_ref_irqmap[SBSA_EHCI]; | ||
106 | + hwaddr base = sbsa_ref_memmap[SBSA_XHCI].base; | ||
107 | + int irq = sbsa_ref_irqmap[SBSA_XHCI]; | ||
108 | + DeviceState *dev = qdev_new(TYPE_XHCI_SYSBUS); | ||
109 | |||
110 | - sysbus_create_simple("platform-ehci-usb", base, | ||
111 | - qdev_get_gpio_in(sms->gic, irq)); | ||
112 | + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
113 | + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); | ||
114 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(sms->gic, irq)); | ||
115 | } | ||
116 | |||
117 | static void create_smmu(const SBSAMachineState *sms, PCIBus *bus) | ||
118 | @@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine) | ||
119 | |||
120 | create_ahci(sms); | ||
121 | |||
122 | - create_ehci(sms); | ||
123 | + create_xhci(sms); | ||
124 | |||
125 | create_pcie(sms); | ||
126 | |||
72 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 127 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
73 | index XXXXXXX..XXXXXXX 100644 | 128 | index XXXXXXX..XXXXXXX 100644 |
74 | --- a/hw/arm/Kconfig | 129 | --- a/hw/arm/Kconfig |
75 | +++ b/hw/arm/Kconfig | 130 | +++ b/hw/arm/Kconfig |
76 | @@ -XXX,XX +XXX,XX @@ config MUSCA | 131 | @@ -XXX,XX +XXX,XX @@ config SBSA_REF |
77 | 132 | select PL011 # UART | |
78 | config MUSICPAL | 133 | select PL031 # RTC |
79 | bool | 134 | select PL061 # GPIO |
80 | + select OR_IRQ | 135 | - select USB_EHCI_SYSBUS |
81 | select BITBANG_I2C | 136 | + select USB_XHCI_SYSBUS |
82 | select MARVELL_88W8618 | 137 | select WDT_SBSA |
83 | select PTIMER | 138 | select BOCHS_DISPLAY |
139 | |||
84 | -- | 140 | -- |
85 | 2.20.1 | 141 | 2.34.1 |
86 | |||
87 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | We can use one MPC per SRAM bank, but we currently only wire the | 3 | Allow the line length to extend to 548 columns. While annoyingly wide, |
4 | IRQ from the first expansion MPC to the IRQ splitter. Fix that. | 4 | it's still less confusing than the continuations we print. Also, the |
5 | default VL used by Linux (and max for A64FX) uses only 140 columns. | ||
5 | 6 | ||
6 | Fixes: bb75e16d5e6 ("hw/arm/iotkit: Wire up MPC interrupt lines") | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Message-id: 20230622151201.1578522-2-richard.henderson@linaro.org |
8 | Message-id: 20201107193403.436146-2-f4bug@amsat.org | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | hw/arm/armsse.c | 3 ++- | 12 | target/arm/cpu.c | 36 ++++++++++++++---------------------- |
13 | 1 file changed, 2 insertions(+), 1 deletion(-) | 13 | 1 file changed, 14 insertions(+), 22 deletions(-) |
14 | 14 | ||
15 | diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c | 15 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/armsse.c | 17 | --- a/target/arm/cpu.c |
18 | +++ b/hw/arm/armsse.c | 18 | +++ b/target/arm/cpu.c |
19 | @@ -XXX,XX +XXX,XX @@ static void armsse_realize(DeviceState *dev, Error **errp) | 19 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) |
20 | qdev_get_gpio_in(dev_splitter, 0)); | 20 | ARMCPU *cpu = ARM_CPU(cs); |
21 | qdev_connect_gpio_out(dev_splitter, 0, | 21 | CPUARMState *env = &cpu->env; |
22 | qdev_get_gpio_in_named(dev_secctl, | 22 | uint32_t psr = pstate_read(env); |
23 | - "mpc_status", 0)); | 23 | - int i; |
24 | + "mpc_status", | 24 | + int i, j; |
25 | + i - IOTS_NUM_EXP_MPC)); | 25 | int el = arm_current_el(env); |
26 | const char *ns_status; | ||
27 | bool sve; | ||
28 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) | ||
29 | } | ||
30 | |||
31 | if (sve) { | ||
32 | - int j, zcr_len = sve_vqm1_for_el(env, el); | ||
33 | + int zcr_len = sve_vqm1_for_el(env, el); | ||
34 | |||
35 | for (i = 0; i <= FFR_PRED_NUM; i++) { | ||
36 | bool eol; | ||
37 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) | ||
38 | } | ||
26 | } | 39 | } |
27 | 40 | ||
28 | qdev_connect_gpio_out(dev_splitter, 1, | 41 | - for (i = 0; i < 32; i++) { |
42 | - if (zcr_len == 0) { | ||
43 | + if (zcr_len == 0) { | ||
44 | + /* | ||
45 | + * With vl=16, there are only 37 columns per register, | ||
46 | + * so output two registers per line. | ||
47 | + */ | ||
48 | + for (i = 0; i < 32; i++) { | ||
49 | qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s", | ||
50 | i, env->vfp.zregs[i].d[1], | ||
51 | env->vfp.zregs[i].d[0], i & 1 ? "\n" : " "); | ||
52 | - } else if (zcr_len == 1) { | ||
53 | - qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 | ||
54 | - ":%016" PRIx64 ":%016" PRIx64 "\n", | ||
55 | - i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2], | ||
56 | - env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]); | ||
57 | - } else { | ||
58 | + } | ||
59 | + } else { | ||
60 | + for (i = 0; i < 32; i++) { | ||
61 | + qemu_fprintf(f, "Z%02d=", i); | ||
62 | for (j = zcr_len; j >= 0; j--) { | ||
63 | - bool odd = (zcr_len - j) % 2 != 0; | ||
64 | - if (j == zcr_len) { | ||
65 | - qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1); | ||
66 | - } else if (!odd) { | ||
67 | - if (j > 0) { | ||
68 | - qemu_fprintf(f, " [%x-%x]=", j, j - 1); | ||
69 | - } else { | ||
70 | - qemu_fprintf(f, " [%x]=", j); | ||
71 | - } | ||
72 | - } | ||
73 | qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s", | ||
74 | env->vfp.zregs[i].d[j * 2 + 1], | ||
75 | - env->vfp.zregs[i].d[j * 2], | ||
76 | - odd || j == 0 ? "\n" : ":"); | ||
77 | + env->vfp.zregs[i].d[j * 2 + 0], | ||
78 | + j ? ":" : "\n"); | ||
79 | } | ||
80 | } | ||
81 | } | ||
29 | -- | 82 | -- |
30 | 2.20.1 | 83 | 2.34.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | From: Havard Skinnemoen <hskinnemoen@google.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The number of runs is equal to the number of 0-1 and 1-0 transitions, | 3 | Always print each matrix row whole, one per line, so that we |
4 | plus one. Currently, it's counting the number of times these transitions | 4 | get the entire matrix in the proper shape. |
5 | do _not_ happen, plus one. | ||
6 | 5 | ||
7 | Source: | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf | 7 | Message-id: 20230622151201.1578522-3-richard.henderson@linaro.org |
9 | section 2.3.4 point (3). | ||
10 | |||
11 | Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com> | ||
12 | Message-id: 20201103011457.2959989-2-hskinnemoen@google.com | ||
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 | tests/qtest/npcm7xx_rng-test.c | 2 +- | 11 | target/arm/cpu.c | 18 ++++++++++++++++++ |
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 18 insertions(+) |
18 | 13 | ||
19 | diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c | 14 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/tests/qtest/npcm7xx_rng-test.c | 16 | --- a/target/arm/cpu.c |
22 | +++ b/tests/qtest/npcm7xx_rng-test.c | 17 | +++ b/target/arm/cpu.c |
23 | @@ -XXX,XX +XXX,XX @@ static double calc_runs_p(const unsigned long *buf, unsigned int nr_bits) | 18 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) |
24 | pi = (double)nr_ones / nr_bits; | 19 | i, q[1], q[0], (i & 1 ? "\n" : " ")); |
25 | 20 | } | |
26 | for (k = 0; k < nr_bits - 1; k++) { | ||
27 | - vn_obs += !(test_bit(k, buf) ^ test_bit(k + 1, buf)); | ||
28 | + vn_obs += (test_bit(k, buf) ^ test_bit(k + 1, buf)); | ||
29 | } | 21 | } |
30 | vn_obs += 1; | 22 | + |
31 | 23 | + if (cpu_isar_feature(aa64_sme, cpu) && | |
24 | + FIELD_EX64(env->svcr, SVCR, ZA) && | ||
25 | + sme_exception_el(env, el) == 0) { | ||
26 | + int zcr_len = sve_vqm1_for_el_sm(env, el, true); | ||
27 | + int svl = (zcr_len + 1) * 16; | ||
28 | + int svl_lg10 = svl < 100 ? 2 : 3; | ||
29 | + | ||
30 | + for (i = 0; i < svl; i++) { | ||
31 | + qemu_fprintf(f, "ZA[%0*d]=", svl_lg10, i); | ||
32 | + for (j = zcr_len; j >= 0; --j) { | ||
33 | + qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%c", | ||
34 | + env->zarray[i].d[2 * j + 1], | ||
35 | + env->zarray[i].d[2 * j], | ||
36 | + j ? ':' : '\n'); | ||
37 | + } | ||
38 | + } | ||
39 | + } | ||
40 | } | ||
41 | |||
42 | #else | ||
32 | -- | 43 | -- |
33 | 2.20.1 | 44 | 2.34.1 |
34 | |||
35 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The helper function did not get updated when we reorganized | 3 | For the outer product set of insns, which take an entire matrix |
4 | the vector register file for SVE. Since then, the neon dregs | 4 | tile as output, the argument is not a combined tile+column. |
5 | are non-sequential and cannot be simply indexed. | 5 | Therefore using get_tile_rowcol was incorrect, as we extracted |
6 | 6 | the tile number from itself. | |
7 | At the same time, make the helper function operate on 64-bit | 7 | |
8 | quantities so that we do not have to call it twice. | 8 | The test case relies only on assembler support for SME, since |
9 | 9 | no release of GCC recognizes -march=armv9-a+sme yet. | |
10 | Fixes: c39c2b9043e | 10 | |
11 | Reported-by: Ard Biesheuvel <ardb@kernel.org> | 11 | Cc: qemu-stable@nongnu.org |
12 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1620 | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | [PMM: use aa32_vfp_dreg() rather than opencoding] | 14 | Message-id: 20230622151201.1578522-5-richard.henderson@linaro.org |
14 | Message-id: 20201105171126.88014-1-richard.henderson@linaro.org | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 17 | --- |
18 | target/arm/helper.h | 2 +- | 18 | target/arm/tcg/translate-sme.c | 24 ++++++--- |
19 | target/arm/op_helper.c | 23 +++++++++-------- | 19 | tests/tcg/aarch64/sme-outprod1.c | 83 +++++++++++++++++++++++++++++++ |
20 | target/arm/translate-neon.c.inc | 44 +++++++++++---------------------- | 20 | tests/tcg/aarch64/Makefile.target | 10 ++-- |
21 | 3 files changed, 29 insertions(+), 40 deletions(-) | 21 | 3 files changed, 108 insertions(+), 9 deletions(-) |
22 | 22 | create mode 100644 tests/tcg/aarch64/sme-outprod1.c | |
23 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 23 | |
24 | diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c | ||
24 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/arm/helper.h | 26 | --- a/target/arm/tcg/translate-sme.c |
26 | +++ b/target/arm/helper.h | 27 | +++ b/target/arm/tcg/translate-sme.c |
27 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(rsqrte_f32, TCG_CALL_NO_RWG, f32, f32, ptr) | 28 | @@ -XXX,XX +XXX,XX @@ static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs, |
28 | DEF_HELPER_FLAGS_2(rsqrte_f64, TCG_CALL_NO_RWG, f64, f64, ptr) | 29 | return addr; |
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 | } | 30 | } |
43 | 31 | ||
44 | -uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn, | 32 | +/* |
45 | - uint32_t maxindex) | 33 | + * Resolve tile.size[0] to a host pointer. |
46 | +uint64_t HELPER(neon_tbl)(CPUARMState *env, uint32_t desc, | 34 | + * Used by e.g. outer product insns where we require the entire tile. |
47 | + uint64_t ireg, uint64_t def) | 35 | + */ |
36 | +static TCGv_ptr get_tile(DisasContext *s, int esz, int tile) | ||
37 | +{ | ||
38 | + TCGv_ptr addr = tcg_temp_new_ptr(); | ||
39 | + int offset; | ||
40 | + | ||
41 | + offset = tile * sizeof(ARMVectorReg) + offsetof(CPUARMState, zarray); | ||
42 | + | ||
43 | + tcg_gen_addi_ptr(addr, cpu_env, offset); | ||
44 | + return addr; | ||
45 | +} | ||
46 | + | ||
47 | static bool trans_ZERO(DisasContext *s, arg_ZERO *a) | ||
48 | { | 48 | { |
49 | - uint32_t val, shift; | 49 | if (!dc_isar_feature(aa64_sme, s)) { |
50 | - uint64_t *table = vn; | 50 | @@ -XXX,XX +XXX,XX @@ static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz, |
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 | ||
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; | 51 | return true; |
93 | } | 52 | } |
94 | 53 | ||
95 | - n = a->len + 1; | 54 | - /* Sum XZR+zad to find ZAd. */ |
96 | - if ((a->vn + n) > 32) { | 55 | - za = get_tile_rowcol(s, esz, 31, a->zad, false); |
97 | + if ((a->vn + a->len + 1) > 32) { | 56 | + za = get_tile(s, esz, a->zad); |
98 | /* | 57 | zn = vec_full_reg_ptr(s, a->zn); |
99 | * This is UNPREDICTABLE; we choose to UNDEF to avoid the | 58 | pn = pred_full_reg_ptr(s, a->pn); |
100 | * helper function running off the end of the register file. | 59 | pm = pred_full_reg_ptr(s, a->pm); |
101 | */ | 60 | @@ -XXX,XX +XXX,XX @@ static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz, |
102 | return false; | 61 | return true; |
103 | } | 62 | } |
104 | - n <<= 3; | 63 | |
105 | - tmp = tcg_temp_new_i32(); | 64 | - /* Sum XZR+zad to find ZAd. */ |
106 | - if (a->op) { | 65 | - za = get_tile_rowcol(s, esz, 31, a->zad, false); |
107 | - read_neon_element32(tmp, a->vd, 0, MO_32); | 66 | + za = get_tile(s, esz, a->zad); |
108 | - } else { | 67 | zn = vec_full_reg_ptr(s, a->zn); |
109 | - tcg_gen_movi_i32(tmp, 0); | 68 | zm = vec_full_reg_ptr(s, a->zm); |
110 | - } | 69 | pn = pred_full_reg_ptr(s, a->pn); |
111 | - tmp2 = tcg_temp_new_i32(); | 70 | @@ -XXX,XX +XXX,XX @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz, |
112 | - read_neon_element32(tmp2, a->vm, 0, MO_32); | 71 | return true; |
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 | } | 72 | } |
126 | - tmp3 = tcg_temp_new_i32(); | 73 | |
127 | - read_neon_element32(tmp3, a->vm, 1, MO_32); | 74 | - /* Sum XZR+zad to find ZAd. */ |
128 | - gen_helper_neon_tbl(tmp3, tmp3, tmp, ptr1, tmp4); | 75 | - za = get_tile_rowcol(s, esz, 31, a->zad, false); |
129 | - tcg_temp_free_i32(tmp); | 76 | + za = get_tile(s, esz, a->zad); |
130 | - tcg_temp_free_i32(tmp4); | 77 | zn = vec_full_reg_ptr(s, a->zn); |
131 | - tcg_temp_free_ptr(ptr1); | 78 | zm = vec_full_reg_ptr(s, a->zm); |
132 | + val = tcg_temp_new_i64(); | 79 | pn = pred_full_reg_ptr(s, a->pn); |
133 | + read_neon_element64(val, a->vm, 0, MO_64); | 80 | diff --git a/tests/tcg/aarch64/sme-outprod1.c b/tests/tcg/aarch64/sme-outprod1.c |
134 | 81 | new file mode 100644 | |
135 | - write_neon_element32(tmp2, a->vd, 0, MO_32); | 82 | index XXXXXXX..XXXXXXX |
136 | - write_neon_element32(tmp3, a->vd, 1, MO_32); | 83 | --- /dev/null |
137 | - tcg_temp_free_i32(tmp2); | 84 | +++ b/tests/tcg/aarch64/sme-outprod1.c |
138 | - tcg_temp_free_i32(tmp3); | 85 | @@ -XXX,XX +XXX,XX @@ |
139 | + gen_helper_neon_tbl(val, cpu_env, desc, val, def); | 86 | +/* |
140 | + write_neon_element64(val, a->vd, 0, MO_64); | 87 | + * SME outer product, 1 x 1. |
141 | + | 88 | + * SPDX-License-Identifier: GPL-2.0-or-later |
142 | + tcg_temp_free_i64(def); | 89 | + */ |
143 | + tcg_temp_free_i64(val); | 90 | + |
144 | + tcg_temp_free_i32(desc); | 91 | +#include <stdio.h> |
145 | return true; | 92 | + |
146 | } | 93 | +extern void foo(float *dst); |
147 | 94 | + | |
95 | +asm( | ||
96 | +" .arch_extension sme\n" | ||
97 | +" .type foo, @function\n" | ||
98 | +"foo:\n" | ||
99 | +" stp x29, x30, [sp, -80]!\n" | ||
100 | +" mov x29, sp\n" | ||
101 | +" stp d8, d9, [sp, 16]\n" | ||
102 | +" stp d10, d11, [sp, 32]\n" | ||
103 | +" stp d12, d13, [sp, 48]\n" | ||
104 | +" stp d14, d15, [sp, 64]\n" | ||
105 | +" smstart\n" | ||
106 | +" ptrue p0.s, vl4\n" | ||
107 | +" fmov z0.s, #1.0\n" | ||
108 | +/* | ||
109 | + * An outer product of a vector of 1.0 by itself should be a matrix of 1.0. | ||
110 | + * Note that we are using tile 1 here (za1.s) rather than tile 0. | ||
111 | + */ | ||
112 | +" zero {za}\n" | ||
113 | +" fmopa za1.s, p0/m, p0/m, z0.s, z0.s\n" | ||
114 | +/* | ||
115 | + * Read the first 4x4 sub-matrix of elements from tile 1: | ||
116 | + * Note that za1h should be interchangable here. | ||
117 | + */ | ||
118 | +" mov w12, #0\n" | ||
119 | +" mova z0.s, p0/m, za1v.s[w12, #0]\n" | ||
120 | +" mova z1.s, p0/m, za1v.s[w12, #1]\n" | ||
121 | +" mova z2.s, p0/m, za1v.s[w12, #2]\n" | ||
122 | +" mova z3.s, p0/m, za1v.s[w12, #3]\n" | ||
123 | +/* | ||
124 | + * And store them to the input pointer (dst in the C code): | ||
125 | + */ | ||
126 | +" st1w {z0.s}, p0, [x0]\n" | ||
127 | +" add x0, x0, #16\n" | ||
128 | +" st1w {z1.s}, p0, [x0]\n" | ||
129 | +" add x0, x0, #16\n" | ||
130 | +" st1w {z2.s}, p0, [x0]\n" | ||
131 | +" add x0, x0, #16\n" | ||
132 | +" st1w {z3.s}, p0, [x0]\n" | ||
133 | +" smstop\n" | ||
134 | +" ldp d8, d9, [sp, 16]\n" | ||
135 | +" ldp d10, d11, [sp, 32]\n" | ||
136 | +" ldp d12, d13, [sp, 48]\n" | ||
137 | +" ldp d14, d15, [sp, 64]\n" | ||
138 | +" ldp x29, x30, [sp], 80\n" | ||
139 | +" ret\n" | ||
140 | +" .size foo, . - foo" | ||
141 | +); | ||
142 | + | ||
143 | +int main() | ||
144 | +{ | ||
145 | + float dst[16]; | ||
146 | + int i, j; | ||
147 | + | ||
148 | + foo(dst); | ||
149 | + | ||
150 | + for (i = 0; i < 16; i++) { | ||
151 | + if (dst[i] != 1.0f) { | ||
152 | + break; | ||
153 | + } | ||
154 | + } | ||
155 | + | ||
156 | + if (i == 16) { | ||
157 | + return 0; /* success */ | ||
158 | + } | ||
159 | + | ||
160 | + /* failure */ | ||
161 | + for (i = 0; i < 4; ++i) { | ||
162 | + for (j = 0; j < 4; ++j) { | ||
163 | + printf("%f ", (double)dst[i * 4 + j]); | ||
164 | + } | ||
165 | + printf("\n"); | ||
166 | + } | ||
167 | + return 1; | ||
168 | +} | ||
169 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/tests/tcg/aarch64/Makefile.target | ||
172 | +++ b/tests/tcg/aarch64/Makefile.target | ||
173 | @@ -XXX,XX +XXX,XX @@ config-cc.mak: Makefile | ||
174 | $(call cc-option,-march=armv8.5-a, CROSS_CC_HAS_ARMV8_5); \ | ||
175 | $(call cc-option,-mbranch-protection=standard, CROSS_CC_HAS_ARMV8_BTI); \ | ||
176 | $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE); \ | ||
177 | - $(call cc-option,-march=armv9-a+sme, CROSS_CC_HAS_ARMV9_SME)) 3> config-cc.mak | ||
178 | + $(call cc-option,-Wa$(COMMA)-march=armv9-a+sme, CROSS_AS_HAS_ARMV9_SME)) 3> config-cc.mak | ||
179 | -include config-cc.mak | ||
180 | |||
181 | ifneq ($(CROSS_CC_HAS_ARMV8_2),) | ||
182 | @@ -XXX,XX +XXX,XX @@ AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 mte-7 | ||
183 | mte-%: CFLAGS += -march=armv8.5-a+memtag | ||
184 | endif | ||
185 | |||
186 | +ifneq ($(CROSS_AS_HAS_ARMV9_SME),) | ||
187 | +AARCH64_TESTS += sme-outprod1 | ||
188 | +endif | ||
189 | + | ||
190 | ifneq ($(CROSS_CC_HAS_SVE),) | ||
191 | # System Registers Tests | ||
192 | AARCH64_TESTS += sysregs | ||
193 | -ifneq ($(CROSS_CC_HAS_ARMV9_SME),) | ||
194 | -sysregs: CFLAGS+=-march=armv9-a+sme -DHAS_ARMV9_SME | ||
195 | +ifneq ($(CROSS_AS_HAS_ARMV9_SME),) | ||
196 | +sysregs: CFLAGS+=-Wa,-march=armv9-a+sme -DHAS_ARMV9_SME | ||
197 | else | ||
198 | sysregs: CFLAGS+=-march=armv8.1-a+sve | ||
199 | endif | ||
148 | -- | 200 | -- |
149 | 2.20.1 | 201 | 2.34.1 |
150 | |||
151 | diff view generated by jsdifflib |
1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> | 1 | From: John Högberg <john.hogberg@ericsson.com> |
---|---|---|---|
2 | 2 | ||
3 | Fix code style. Operator needs spaces both sides. | 3 | Unlike architectures with precise self-modifying code semantics |
4 | (e.g. x86) ARM processors do not maintain coherency for instruction | ||
5 | execution and memory, requiring an instruction synchronization | ||
6 | barrier on every core that will execute the new code, and on many | ||
7 | models also the explicit use of cache management instructions. | ||
4 | 8 | ||
5 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> | 9 | While this is required to make JITs work on actual hardware, QEMU |
6 | Signed-off-by: Kai Deng <dengkai1@huawei.com> | 10 | has gotten away with not handling this since it does not emulate |
7 | Message-id: 20201103114529.638233-1-zhangxinhao1@huawei.com | 11 | caches, and unconditionally invalidates code whenever the softmmu |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 12 | or the user-mode page protection logic detects that code has been |
13 | modified. | ||
14 | |||
15 | Unfortunately the latter does not work in the face of dual-mapped | ||
16 | code (a common W^X workaround), where one page is executable and | ||
17 | the other is writable: user-mode has no way to connect one with the | ||
18 | other as that is only known to the kernel and the emulated | ||
19 | application. | ||
20 | |||
21 | This commit works around the issue by telling software that | ||
22 | instruction cache invalidation is required by clearing the | ||
23 | CPR_EL0.DIC flag (regardless of whether the emulated processor | ||
24 | needs it), and then invalidating code in IC IVAU instructions. | ||
25 | |||
26 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1034 | ||
27 | |||
28 | Co-authored-by: Richard Henderson <richard.henderson@linaro.org> | ||
29 | Signed-off-by: John Högberg <john.hogberg@ericsson.com> | ||
30 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
31 | Message-id: 168778890374.24232.3402138851538068785-1@git.sr.ht | ||
32 | [PMM: removed unnecessary AArch64 feature check; moved | ||
33 | "clear CTR_EL1.DIC" code up a bit so it's not in the middle | ||
34 | of the vfp/neon related tests] | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 36 | --- |
11 | target/arm/arch_dump.c | 8 ++++---- | 37 | target/arm/cpu.c | 11 +++++++++++ |
12 | target/arm/arm-semi.c | 8 ++++---- | 38 | target/arm/helper.c | 47 ++++++++++++++++++++++++++++++++++++++++++--- |
13 | target/arm/helper.c | 2 +- | 39 | 2 files changed, 55 insertions(+), 3 deletions(-) |
14 | 3 files changed, 9 insertions(+), 9 deletions(-) | ||
15 | 40 | ||
16 | diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c | 41 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
17 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/arch_dump.c | 43 | --- a/target/arm/cpu.c |
19 | +++ b/target/arm/arch_dump.c | 44 | +++ b/target/arm/cpu.c |
20 | @@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, | 45 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) |
21 | 46 | return; | |
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]); | ||
28 | } | 47 | } |
29 | 48 | ||
30 | if (s->dump_info.d_endian == ELFDATA2MSB) { | 49 | +#ifdef CONFIG_USER_ONLY |
31 | @@ -XXX,XX +XXX,XX @@ static int aarch64_write_elf64_prfpreg(WriteCoreDumpFunction f, | 50 | + /* |
32 | */ | 51 | + * User mode relies on IC IVAU instructions to catch modification of |
33 | for (i = 0; i < 32; ++i) { | 52 | + * dual-mapped code. |
34 | uint64_t tmp = note.vfp.vregs[2*i]; | 53 | + * |
35 | - note.vfp.vregs[2*i] = note.vfp.vregs[2*i+1]; | 54 | + * Clear CTR_EL0.DIC to ensure that software that honors these flags uses |
36 | - note.vfp.vregs[2*i+1] = tmp; | 55 | + * IC IVAU even if the emulated processor does not normally require it. |
37 | + note.vfp.vregs[2 * i] = note.vfp.vregs[2 * i + 1]; | 56 | + */ |
38 | + note.vfp.vregs[2 * i + 1] = tmp; | 57 | + cpu->ctr = FIELD_DP64(cpu->ctr, CTR_EL0, DIC, 0); |
39 | } | 58 | +#endif |
40 | } | 59 | + |
41 | 60 | if (arm_feature(env, ARM_FEATURE_AARCH64) && | |
42 | diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c | 61 | cpu->has_vfp != cpu->has_neon) { |
43 | index XXXXXXX..XXXXXXX 100644 | 62 | /* |
44 | --- a/target/arm/arm-semi.c | ||
45 | +++ b/target/arm/arm-semi.c | ||
46 | @@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env) | ||
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 | 63 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
83 | index XXXXXXX..XXXXXXX 100644 | 64 | index XXXXXXX..XXXXXXX 100644 |
84 | --- a/target/arm/helper.c | 65 | --- a/target/arm/helper.c |
85 | +++ b/target/arm/helper.c | 66 | +++ b/target/arm/helper.c |
86 | @@ -XXX,XX +XXX,XX @@ uint32_t HELPER(usad8)(uint32_t a, uint32_t b) | 67 | @@ -XXX,XX +XXX,XX @@ static void mdcr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri, |
87 | uint32_t sum; | 68 | } |
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; | ||
94 | } | 69 | } |
70 | |||
71 | +#ifdef CONFIG_USER_ONLY | ||
72 | +/* | ||
73 | + * `IC IVAU` is handled to improve compatibility with JITs that dual-map their | ||
74 | + * code to get around W^X restrictions, where one region is writable and the | ||
75 | + * other is executable. | ||
76 | + * | ||
77 | + * Since the executable region is never written to we cannot detect code | ||
78 | + * changes when running in user mode, and rely on the emulated JIT telling us | ||
79 | + * that the code has changed by executing this instruction. | ||
80 | + */ | ||
81 | +static void ic_ivau_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
82 | + uint64_t value) | ||
83 | +{ | ||
84 | + uint64_t icache_line_mask, start_address, end_address; | ||
85 | + const ARMCPU *cpu; | ||
86 | + | ||
87 | + cpu = env_archcpu(env); | ||
88 | + | ||
89 | + icache_line_mask = (4 << extract32(cpu->ctr, 0, 4)) - 1; | ||
90 | + start_address = value & ~icache_line_mask; | ||
91 | + end_address = value | icache_line_mask; | ||
92 | + | ||
93 | + mmap_lock(); | ||
94 | + | ||
95 | + tb_invalidate_phys_range(start_address, end_address); | ||
96 | + | ||
97 | + mmap_unlock(); | ||
98 | +} | ||
99 | +#endif | ||
100 | + | ||
101 | static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
102 | /* | ||
103 | * Minimal set of EL0-visible registers. This will need to be expanded | ||
104 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
105 | { .name = "CURRENTEL", .state = ARM_CP_STATE_AA64, | ||
106 | .opc0 = 3, .opc1 = 0, .opc2 = 2, .crn = 4, .crm = 2, | ||
107 | .access = PL1_R, .type = ARM_CP_CURRENTEL }, | ||
108 | - /* Cache ops: all NOPs since we don't emulate caches */ | ||
109 | + /* | ||
110 | + * Instruction cache ops. All of these except `IC IVAU` NOP because we | ||
111 | + * don't emulate caches. | ||
112 | + */ | ||
113 | { .name = "IC_IALLUIS", .state = ARM_CP_STATE_AA64, | ||
114 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 1, .opc2 = 0, | ||
115 | .access = PL1_W, .type = ARM_CP_NOP, | ||
116 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = { | ||
117 | .accessfn = access_tocu }, | ||
118 | { .name = "IC_IVAU", .state = ARM_CP_STATE_AA64, | ||
119 | .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 5, .opc2 = 1, | ||
120 | - .access = PL0_W, .type = ARM_CP_NOP, | ||
121 | + .access = PL0_W, | ||
122 | .fgt = FGT_ICIVAU, | ||
123 | - .accessfn = access_tocu }, | ||
124 | + .accessfn = access_tocu, | ||
125 | +#ifdef CONFIG_USER_ONLY | ||
126 | + .type = ARM_CP_NO_RAW, | ||
127 | + .writefn = ic_ivau_write | ||
128 | +#else | ||
129 | + .type = ARM_CP_NOP | ||
130 | +#endif | ||
131 | + }, | ||
132 | + /* Cache ops: all NOPs since we don't emulate caches */ | ||
133 | { .name = "DC_IVAC", .state = ARM_CP_STATE_AA64, | ||
134 | .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 6, .opc2 = 1, | ||
135 | .access = PL1_W, .accessfn = aa64_cacheop_poc_access, | ||
95 | -- | 136 | -- |
96 | 2.20.1 | 137 | 2.34.1 |
97 | 138 | ||
98 | 139 | diff view generated by jsdifflib |
1 | From: Alex Bennée <alex.bennee@linaro.org> | 1 | From: John Högberg <john.hogberg@ericsson.com> |
---|---|---|---|
2 | 2 | ||
3 | We should at least document what this machine is about. | 3 | https://gitlab.com/qemu-project/qemu/-/issues/1034 |
4 | 4 | ||
5 | Reviewed-by: Graeme Gregory <graeme@nuviainc.com> | 5 | Signed-off-by: John Högberg <john.hogberg@ericsson.com> |
6 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Message-id: 168778890374.24232.3402138851538068785-2@git.sr.ht |
7 | Message-id: 20201104165254.24822-1-alex.bennee@linaro.org | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Cc: Leif Lindholm <leif@nuviainc.com> | 8 | [PMM: fixed typo in comment] |
9 | Cc: Shashi Mallela <shashi.mallela@linaro.org> | ||
10 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
11 | [PMM: fixed filename mismatch] | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 10 | --- |
14 | docs/system/arm/sbsa.rst | 32 ++++++++++++++++++++++++++++++++ | 11 | tests/tcg/aarch64/icivau.c | 189 ++++++++++++++++++++++++++++++ |
15 | docs/system/target-arm.rst | 1 + | 12 | tests/tcg/aarch64/Makefile.target | 3 +- |
16 | 2 files changed, 33 insertions(+) | 13 | 2 files changed, 191 insertions(+), 1 deletion(-) |
17 | create mode 100644 docs/system/arm/sbsa.rst | 14 | create mode 100644 tests/tcg/aarch64/icivau.c |
18 | 15 | ||
19 | diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst | 16 | diff --git a/tests/tcg/aarch64/icivau.c b/tests/tcg/aarch64/icivau.c |
20 | new file mode 100644 | 17 | new file mode 100644 |
21 | index XXXXXXX..XXXXXXX | 18 | index XXXXXXX..XXXXXXX |
22 | --- /dev/null | 19 | --- /dev/null |
23 | +++ b/docs/system/arm/sbsa.rst | 20 | +++ b/tests/tcg/aarch64/icivau.c |
24 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
25 | +Arm Server Base System Architecture Reference board (``sbsa-ref``) | 22 | +/* |
26 | +================================================================== | 23 | + * Tests the IC IVAU-driven workaround for catching changes made to dual-mapped |
27 | + | 24 | + * code that would otherwise go unnoticed in user mode. |
28 | +While the `virt` board is a generic board platform that doesn't match | 25 | + * |
29 | +any real hardware the `sbsa-ref` board intends to look like real | 26 | + * Copyright (c) 2023 Ericsson AB |
30 | +hardware. The `Server Base System Architecture | 27 | + * SPDX-License-Identifier: GPL-2.0-or-later |
31 | +<https://developer.arm.com/documentation/den0029/latest>` defines a | 28 | + */ |
32 | +minimum base line of hardware support and importantly how the firmware | 29 | + |
33 | +reports that to any operating system. It is a static system that | 30 | +#include <sys/mman.h> |
34 | +reports a very minimal DT to the firmware for non-discoverable | 31 | +#include <sys/stat.h> |
35 | +information about components affected by the qemu command line (i.e. | 32 | +#include <string.h> |
36 | +cpus and memory). As a result it must have a firmware specifically | 33 | +#include <stdint.h> |
37 | +built to expect a certain hardware layout (as you would in a real | 34 | +#include <stdlib.h> |
38 | +machine). | 35 | +#include <unistd.h> |
39 | + | 36 | +#include <fcntl.h> |
40 | +It is intended to be a machine for developing firmware and testing | 37 | + |
41 | +standards compliance with operating systems. | 38 | +#define MAX_CODE_SIZE 128 |
42 | + | 39 | + |
43 | +Supported devices | 40 | +typedef int (SelfModTest)(uint32_t, uint32_t*); |
44 | +""""""""""""""""" | 41 | +typedef int (BasicTest)(int); |
45 | + | 42 | + |
46 | +The sbsa-ref board supports: | 43 | +static void mark_code_modified(const uint32_t *exec_data, size_t length) |
47 | + | 44 | +{ |
48 | + - A configurable number of AArch64 CPUs | 45 | + int dc_required, ic_required; |
49 | + - GIC version 3 | 46 | + unsigned long ctr_el0; |
50 | + - System bus AHCI controller | 47 | + |
51 | + - System bus EHCI controller | 48 | + /* |
52 | + - CDROM and hard disc on AHCI bus | 49 | + * Clear the data/instruction cache, as indicated by the CTR_ELO.{DIC,IDC} |
53 | + - E1000E ethernet card on PCIe bus | 50 | + * flags. |
54 | + - VGA display adaptor on PCIe bus | 51 | + * |
55 | + - A generic SBSA watchdog device | 52 | + * For completeness we might be tempted to assert that we should fail when |
56 | + | 53 | + * the whole code update sequence is omitted, but that would make the test |
57 | diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst | 54 | + * flaky as it can succeed by coincidence on actual hardware. |
55 | + */ | ||
56 | + asm ("mrs %0, ctr_el0\n" : "=r"(ctr_el0)); | ||
57 | + | ||
58 | + /* CTR_EL0.IDC */ | ||
59 | + dc_required = !((ctr_el0 >> 28) & 1); | ||
60 | + | ||
61 | + /* CTR_EL0.DIC */ | ||
62 | + ic_required = !((ctr_el0 >> 29) & 1); | ||
63 | + | ||
64 | + if (dc_required) { | ||
65 | + size_t dcache_stride, i; | ||
66 | + | ||
67 | + /* | ||
68 | + * Step according to the minimum cache size, as the cache maintenance | ||
69 | + * instructions operate on the cache line of the given address. | ||
70 | + * | ||
71 | + * We assume that exec_data is properly aligned. | ||
72 | + */ | ||
73 | + dcache_stride = (4 << ((ctr_el0 >> 16) & 0xF)); | ||
74 | + | ||
75 | + for (i = 0; i < length; i += dcache_stride) { | ||
76 | + const char *dc_addr = &((const char *)exec_data)[i]; | ||
77 | + asm volatile ("dc cvau, %x[dc_addr]\n" | ||
78 | + : /* no outputs */ | ||
79 | + : [dc_addr] "r"(dc_addr) | ||
80 | + : "memory"); | ||
81 | + } | ||
82 | + | ||
83 | + asm volatile ("dmb ish\n"); | ||
84 | + } | ||
85 | + | ||
86 | + if (ic_required) { | ||
87 | + size_t icache_stride, i; | ||
88 | + | ||
89 | + icache_stride = (4 << (ctr_el0 & 0xF)); | ||
90 | + | ||
91 | + for (i = 0; i < length; i += icache_stride) { | ||
92 | + const char *ic_addr = &((const char *)exec_data)[i]; | ||
93 | + asm volatile ("ic ivau, %x[ic_addr]\n" | ||
94 | + : /* no outputs */ | ||
95 | + : [ic_addr] "r"(ic_addr) | ||
96 | + : "memory"); | ||
97 | + } | ||
98 | + | ||
99 | + asm volatile ("dmb ish\n"); | ||
100 | + } | ||
101 | + | ||
102 | + asm volatile ("isb sy\n"); | ||
103 | +} | ||
104 | + | ||
105 | +static int basic_test(uint32_t *rw_data, const uint32_t *exec_data) | ||
106 | +{ | ||
107 | + /* | ||
108 | + * As user mode only misbehaved for dual-mapped code when previously | ||
109 | + * translated code had been changed, we'll start off with this basic test | ||
110 | + * function to ensure that there's already some translated code at | ||
111 | + * exec_data before the next test. This should cause the next test to fail | ||
112 | + * if `mark_code_modified` fails to invalidate the code. | ||
113 | + * | ||
114 | + * Note that the payload is in binary form instead of inline assembler | ||
115 | + * because we cannot use __attribute__((naked)) on this platform and the | ||
116 | + * workarounds are at least as ugly as this is. | ||
117 | + */ | ||
118 | + static const uint32_t basic_payload[] = { | ||
119 | + 0xD65F03C0 /* 0x00: RET */ | ||
120 | + }; | ||
121 | + | ||
122 | + BasicTest *copied_ptr = (BasicTest *)exec_data; | ||
123 | + | ||
124 | + memcpy(rw_data, basic_payload, sizeof(basic_payload)); | ||
125 | + mark_code_modified(exec_data, sizeof(basic_payload)); | ||
126 | + | ||
127 | + return copied_ptr(1234) == 1234; | ||
128 | +} | ||
129 | + | ||
130 | +static int self_modification_test(uint32_t *rw_data, const uint32_t *exec_data) | ||
131 | +{ | ||
132 | + /* | ||
133 | + * This test is self-modifying in an attempt to cover an edge case where | ||
134 | + * the IC IVAU instruction invalidates itself. | ||
135 | + * | ||
136 | + * Note that the IC IVAU instruction is 16 bytes into the function, in what | ||
137 | + * will be the same cache line as the modified instruction on machines with | ||
138 | + * a cache line size >= 16 bytes. | ||
139 | + */ | ||
140 | + static const uint32_t self_mod_payload[] = { | ||
141 | + /* Overwrite the placeholder instruction with the new one. */ | ||
142 | + 0xB9001C20, /* 0x00: STR w0, [x1, 0x1C] */ | ||
143 | + | ||
144 | + /* Get the executable address of the modified instruction. */ | ||
145 | + 0x100000A8, /* 0x04: ADR x8, <0x1C> */ | ||
146 | + | ||
147 | + /* Mark the modified instruction as updated. */ | ||
148 | + 0xD50B7B28, /* 0x08: DC CVAU x8 */ | ||
149 | + 0xD5033BBF, /* 0x0C: DMB ISH */ | ||
150 | + 0xD50B7528, /* 0x10: IC IVAU x8 */ | ||
151 | + 0xD5033BBF, /* 0x14: DMB ISH */ | ||
152 | + 0xD5033FDF, /* 0x18: ISB */ | ||
153 | + | ||
154 | + /* Placeholder instruction, overwritten above. */ | ||
155 | + 0x52800000, /* 0x1C: MOV w0, 0 */ | ||
156 | + | ||
157 | + 0xD65F03C0 /* 0x20: RET */ | ||
158 | + }; | ||
159 | + | ||
160 | + SelfModTest *copied_ptr = (SelfModTest *)exec_data; | ||
161 | + int i; | ||
162 | + | ||
163 | + memcpy(rw_data, self_mod_payload, sizeof(self_mod_payload)); | ||
164 | + mark_code_modified(exec_data, sizeof(self_mod_payload)); | ||
165 | + | ||
166 | + for (i = 1; i < 10; i++) { | ||
167 | + /* Replace the placeholder instruction with `MOV w0, i` */ | ||
168 | + uint32_t new_instr = 0x52800000 | (i << 5); | ||
169 | + | ||
170 | + if (copied_ptr(new_instr, rw_data) != i) { | ||
171 | + return 0; | ||
172 | + } | ||
173 | + } | ||
174 | + | ||
175 | + return 1; | ||
176 | +} | ||
177 | + | ||
178 | +int main(int argc, char **argv) | ||
179 | +{ | ||
180 | + const char *shm_name = "qemu-test-tcg-aarch64-icivau"; | ||
181 | + int fd; | ||
182 | + | ||
183 | + fd = shm_open(shm_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); | ||
184 | + | ||
185 | + if (fd < 0) { | ||
186 | + return EXIT_FAILURE; | ||
187 | + } | ||
188 | + | ||
189 | + /* Unlink early to avoid leaving garbage in case the test crashes. */ | ||
190 | + shm_unlink(shm_name); | ||
191 | + | ||
192 | + if (ftruncate(fd, MAX_CODE_SIZE) == 0) { | ||
193 | + const uint32_t *exec_data; | ||
194 | + uint32_t *rw_data; | ||
195 | + | ||
196 | + rw_data = mmap(0, MAX_CODE_SIZE, PROT_READ | PROT_WRITE, | ||
197 | + MAP_SHARED, fd, 0); | ||
198 | + exec_data = mmap(0, MAX_CODE_SIZE, PROT_READ | PROT_EXEC, | ||
199 | + MAP_SHARED, fd, 0); | ||
200 | + | ||
201 | + if (rw_data && exec_data) { | ||
202 | + if (basic_test(rw_data, exec_data) && | ||
203 | + self_modification_test(rw_data, exec_data)) { | ||
204 | + return EXIT_SUCCESS; | ||
205 | + } | ||
206 | + } | ||
207 | + } | ||
208 | + | ||
209 | + return EXIT_FAILURE; | ||
210 | +} | ||
211 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
58 | index XXXXXXX..XXXXXXX 100644 | 212 | index XXXXXXX..XXXXXXX 100644 |
59 | --- a/docs/system/target-arm.rst | 213 | --- a/tests/tcg/aarch64/Makefile.target |
60 | +++ b/docs/system/target-arm.rst | 214 | +++ b/tests/tcg/aarch64/Makefile.target |
61 | @@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running | 215 | @@ -XXX,XX +XXX,XX @@ AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64 |
62 | arm/mps2 | 216 | VPATH += $(AARCH64_SRC) |
63 | arm/musca | 217 | |
64 | arm/realview | 218 | # Base architecture tests |
65 | + arm/sbsa | 219 | -AARCH64_TESTS=fcvt pcalign-a64 |
66 | arm/versatile | 220 | +AARCH64_TESTS=fcvt pcalign-a64 icivau |
67 | arm/vexpress | 221 | |
68 | arm/aspeed | 222 | fcvt: LDFLAGS+=-lm |
223 | +icivau: LDFLAGS+=-lrt | ||
224 | |||
225 | run-fcvt: fcvt | ||
226 | $(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)") | ||
69 | -- | 227 | -- |
70 | 2.20.1 | 228 | 2.34.1 |
71 | 229 | ||
72 | 230 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Vikram Garhwal <vikram.garhwal@amd.com> |
---|---|---|---|
2 | 2 | ||
3 | We don't need to fill the full pic[] array if we only use | 3 | Following are done to fix the coverity issues: |
4 | few of the interrupt lines. Directly call qdev_get_gpio_in() | 4 | 1. Change read_data to fix the CID 1512899: Out-of-bounds access (OVERRUN) |
5 | when necessary. | 5 | 2. Fix match_rx_tx_data to fix CID 1512900: Logically dead code (DEADCODE) |
6 | 3. Replace rand() in generate_random_data() with g_rand_int() | ||
6 | 7 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | Signed-off-by: Vikram Garhwal <vikram.garhwal@amd.com> |
8 | Message-id: 20201107193403.436146-6-f4bug@amsat.org | 9 | Message-id: 20230628202758.16398-1-vikram.garhwal@amd.com |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 12 | --- |
12 | hw/arm/musicpal.c | 25 +++++++++++++------------ | 13 | tests/qtest/xlnx-canfd-test.c | 33 +++++++++++---------------------- |
13 | 1 file changed, 13 insertions(+), 12 deletions(-) | 14 | 1 file changed, 11 insertions(+), 22 deletions(-) |
14 | 15 | ||
15 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | 16 | diff --git a/tests/qtest/xlnx-canfd-test.c b/tests/qtest/xlnx-canfd-test.c |
16 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/musicpal.c | 18 | --- a/tests/qtest/xlnx-canfd-test.c |
18 | +++ b/hw/arm/musicpal.c | 19 | +++ b/tests/qtest/xlnx-canfd-test.c |
19 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info musicpal_binfo = { | 20 | @@ -XXX,XX +XXX,XX @@ static void generate_random_data(uint32_t *buf_tx, bool is_canfd_frame) |
20 | static void musicpal_init(MachineState *machine) | 21 | /* Generate random TX data for CANFD frame. */ |
22 | if (is_canfd_frame) { | ||
23 | for (int i = 0; i < CANFD_FRAME_SIZE - 2; i++) { | ||
24 | - buf_tx[2 + i] = rand(); | ||
25 | + buf_tx[2 + i] = g_random_int(); | ||
26 | } | ||
27 | } else { | ||
28 | /* Generate random TX data for CAN frame. */ | ||
29 | for (int i = 0; i < CAN_FRAME_SIZE - 2; i++) { | ||
30 | - buf_tx[2 + i] = rand(); | ||
31 | + buf_tx[2 + i] = g_random_int(); | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | -static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx) | ||
37 | +static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx, | ||
38 | + uint32_t frame_size) | ||
21 | { | 39 | { |
22 | ARMCPU *cpu; | 40 | uint32_t int_status; |
23 | - qemu_irq pic[32]; | 41 | uint32_t fifo_status_reg_value; |
24 | DeviceState *dev; | 42 | /* At which RX FIFO the received data is stored. */ |
25 | + DeviceState *pic; | 43 | uint8_t store_ind = 0; |
26 | DeviceState *uart_orgate; | 44 | - bool is_canfd_frame = false; |
27 | DeviceState *i2c_dev; | 45 | |
28 | DeviceState *lcd_dev; | 46 | /* Read the interrupt on CANFD rx. */ |
29 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | 47 | int_status = qtest_readl(qts, can_base_addr + R_ISR_OFFSET) & ISR_RXOK; |
30 | &error_fatal); | 48 | @@ -XXX,XX +XXX,XX @@ static void read_data(QTestState *qts, uint64_t can_base_addr, uint32_t *buf_rx) |
31 | memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram); | 49 | buf_rx[0] = qtest_readl(qts, can_base_addr + R_RX0_ID_OFFSET); |
32 | 50 | buf_rx[1] = qtest_readl(qts, can_base_addr + R_RX0_DLC_OFFSET); | |
33 | - dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE, | 51 | |
34 | + pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE, | 52 | - is_canfd_frame = (buf_rx[1] >> DLC_FD_BIT_SHIFT) & 1; |
35 | qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ)); | 53 | - |
36 | - for (i = 0; i < 32; i++) { | 54 | - if (is_canfd_frame) { |
37 | - pic[i] = qdev_get_gpio_in(dev, i); | 55 | - for (int i = 0; i < CANFD_FRAME_SIZE - 2; i++) { |
38 | - } | 56 | - buf_rx[i + 2] = qtest_readl(qts, |
39 | - sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, pic[MP_TIMER1_IRQ], | 57 | - can_base_addr + R_RX0_DATA1_OFFSET + 4 * i); |
40 | - pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], | 58 | - } |
41 | - pic[MP_TIMER4_IRQ], NULL); | 59 | - } else { |
42 | + sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, | 60 | - buf_rx[2] = qtest_readl(qts, can_base_addr + R_RX0_DATA1_OFFSET); |
43 | + qdev_get_gpio_in(pic, MP_TIMER1_IRQ), | 61 | - buf_rx[3] = qtest_readl(qts, can_base_addr + R_RX0_DATA2_OFFSET); |
44 | + qdev_get_gpio_in(pic, MP_TIMER2_IRQ), | 62 | + for (int i = 0; i < frame_size - 2; i++) { |
45 | + qdev_get_gpio_in(pic, MP_TIMER3_IRQ), | 63 | + buf_rx[i + 2] = qtest_readl(qts, |
46 | + qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL); | 64 | + can_base_addr + R_RX0_DATA1_OFFSET + 4 * i); |
47 | 65 | } | |
48 | /* Logically OR both UART IRQs together */ | 66 | |
49 | uart_orgate = DEVICE(object_new(TYPE_OR_IRQ)); | 67 | /* Clear the RX interrupt. */ |
50 | object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal); | 68 | @@ -XXX,XX +XXX,XX @@ static void match_rx_tx_data(const uint32_t *buf_tx, const uint32_t *buf_rx, |
51 | qdev_realize_and_unref(uart_orgate, NULL, &error_fatal); | 69 | g_assert_cmpint((buf_rx[size] & DLC_FD_BIT_MASK), ==, |
52 | - qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]); | 70 | (buf_tx[size] & DLC_FD_BIT_MASK)); |
53 | + qdev_connect_gpio_out(DEVICE(uart_orgate), 0, | 71 | } else { |
54 | + qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ)); | 72 | - if (!is_canfd_frame && size == 4) { |
55 | 73 | - break; | |
56 | serial_mm_init(address_space_mem, MP_UART1_BASE, 2, | 74 | - } |
57 | qdev_get_gpio_in(uart_orgate, 0), | 75 | - |
58 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | 76 | g_assert_cmpint(buf_rx[size], ==, buf_tx[size]); |
59 | OBJECT(get_system_memory()), &error_fatal); | 77 | } |
60 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | 78 | |
61 | sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE); | 79 | @@ -XXX,XX +XXX,XX @@ static void test_can_data_transfer(void) |
62 | - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[MP_ETH_IRQ]); | 80 | write_data(qts, CANFD0_BASE_ADDR, buf_tx, false); |
63 | + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, | 81 | |
64 | + qdev_get_gpio_in(pic, MP_ETH_IRQ)); | 82 | send_data(qts, CANFD0_BASE_ADDR); |
65 | 83 | - read_data(qts, CANFD1_BASE_ADDR, buf_rx); | |
66 | sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL); | 84 | + read_data(qts, CANFD1_BASE_ADDR, buf_rx, CAN_FRAME_SIZE); |
67 | 85 | match_rx_tx_data(buf_tx, buf_rx, false); | |
68 | sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL); | 86 | |
69 | 87 | qtest_quit(qts); | |
70 | dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE, | 88 | @@ -XXX,XX +XXX,XX @@ static void test_canfd_data_transfer(void) |
71 | - pic[MP_GPIO_IRQ]); | 89 | write_data(qts, CANFD0_BASE_ADDR, buf_tx, true); |
72 | + qdev_get_gpio_in(pic, MP_GPIO_IRQ)); | 90 | |
73 | i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL); | 91 | send_data(qts, CANFD0_BASE_ADDR); |
74 | i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c"); | 92 | - read_data(qts, CANFD1_BASE_ADDR, buf_rx); |
75 | 93 | + read_data(qts, CANFD1_BASE_ADDR, buf_rx, CANFD_FRAME_SIZE); | |
76 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | 94 | match_rx_tx_data(buf_tx, buf_rx, true); |
77 | NULL); | 95 | |
78 | sysbus_realize_and_unref(s, &error_fatal); | 96 | qtest_quit(qts); |
79 | sysbus_mmio_map(s, 0, MP_AUDIO_BASE); | 97 | @@ -XXX,XX +XXX,XX @@ static void test_can_loopback(void) |
80 | - sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]); | 98 | write_data(qts, CANFD0_BASE_ADDR, buf_tx, true); |
81 | + sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ)); | 99 | |
82 | 100 | send_data(qts, CANFD0_BASE_ADDR); | |
83 | musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE; | 101 | - read_data(qts, CANFD0_BASE_ADDR, buf_rx); |
84 | arm_load_kernel(cpu, machine, &musicpal_binfo); | 102 | + read_data(qts, CANFD0_BASE_ADDR, buf_rx, CANFD_FRAME_SIZE); |
103 | match_rx_tx_data(buf_tx, buf_rx, true); | ||
104 | |||
105 | generate_random_data(buf_tx, true); | ||
106 | @@ -XXX,XX +XXX,XX @@ static void test_can_loopback(void) | ||
107 | write_data(qts, CANFD1_BASE_ADDR, buf_tx, true); | ||
108 | |||
109 | send_data(qts, CANFD1_BASE_ADDR); | ||
110 | - read_data(qts, CANFD1_BASE_ADDR, buf_rx); | ||
111 | + read_data(qts, CANFD1_BASE_ADDR, buf_rx, CANFD_FRAME_SIZE); | ||
112 | match_rx_tx_data(buf_tx, buf_rx, true); | ||
113 | |||
114 | qtest_quit(qts); | ||
85 | -- | 115 | -- |
86 | 2.20.1 | 116 | 2.34.1 |
87 | |||
88 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Fabiano Rosas <farosas@suse.de> |
---|---|---|---|
2 | 2 | ||
3 | omap2420_mpu_init() introduced in commit 827df9f3c5f ("Add basic | 3 | This code is only relevant when TCG is present in the build. Building |
4 | OMAP2 chip support") takes care of creating the 3 UARTs. | 4 | with --disable-tcg --enable-xen on an x86 host we get: |
5 | 5 | ||
6 | Then commit 58a26b477e9 ("Emulate a serial bluetooth HCI with H4+ | 6 | $ ../configure --target-list=x86_64-softmmu,aarch64-softmmu --disable-tcg --enable-xen |
7 | extensions and attach to n8x0's UART") added n8x0_uart_setup() | 7 | $ make -j$(nproc) |
8 | which create the UART and connects it to an IRQ output, | 8 | ... |
9 | overwritting the existing peripheral and its IRQ connection. | 9 | libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub.c.o: in function `m_sysreg_ptr': |
10 | This is incorrect. | 10 | ../target/arm/gdbstub.c:358: undefined reference to `arm_v7m_get_sp_ptr' |
11 | ../target/arm/gdbstub.c:361: undefined reference to `arm_v7m_get_sp_ptr' | ||
11 | 12 | ||
12 | Fortunately we don't need to fix this, because commit 6da68df7f9b | 13 | libqemu-aarch64-softmmu.fa.p/target_arm_gdbstub.c.o: in function `arm_gdb_get_m_systemreg': |
13 | ("hw/arm/nseries: Replace the bluetooth chardev with a "null" | 14 | ../target/arm/gdbstub.c:405: undefined reference to `arm_v7m_mrs_control' |
14 | chardev") removed the use of this peripheral. We can simply | ||
15 | remove the code. | ||
16 | 15 | ||
17 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 16 | Signed-off-by: Fabiano Rosas <farosas@suse.de> |
18 | Message-id: 20201107193403.436146-4-f4bug@amsat.org | 17 | Message-id: 20230628164821.16771-1-farosas@suse.de |
19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | --- | 20 | --- |
22 | hw/arm/nseries.c | 11 ----------- | 21 | target/arm/gdbstub.c | 4 ++++ |
23 | 1 file changed, 11 deletions(-) | 22 | 1 file changed, 4 insertions(+) |
24 | 23 | ||
25 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | 24 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c |
26 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/hw/arm/nseries.c | 26 | --- a/target/arm/gdbstub.c |
28 | +++ b/hw/arm/nseries.c | 27 | +++ b/target/arm/gdbstub.c |
29 | @@ -XXX,XX +XXX,XX @@ static void n8x0_cbus_setup(struct n800_s *s) | 28 | @@ -XXX,XX +XXX,XX @@ static int arm_gen_dynamic_sysreg_xml(CPUState *cs, int base_reg) |
30 | cbus_attach(cbus, s->tahvo = tahvo_init(tahvo_irq, 1)); | 29 | return cpu->dyn_sysreg_xml.num; |
31 | } | 30 | } |
32 | 31 | ||
33 | -static void n8x0_uart_setup(struct n800_s *s) | 32 | +#ifdef CONFIG_TCG |
34 | -{ | 33 | typedef enum { |
35 | - Chardev *radio = qemu_chr_new("bt-dummy-uart", "null", NULL); | 34 | M_SYSREG_MSP, |
36 | - /* | 35 | M_SYSREG_PSP, |
37 | - * Note: We used to connect N8X0_BT_RESET_GPIO and N8X0_BT_WKUP_GPIO | 36 | @@ -XXX,XX +XXX,XX @@ static int arm_gen_dynamic_m_secextreg_xml(CPUState *cs, int orig_base_reg) |
38 | - * here, but this code has been removed with the bluetooth backend. | 37 | return cpu->dyn_m_secextreg_xml.num; |
39 | - */ | 38 | } |
40 | - omap_uart_attach(s->mpu->uart[BT_UART], radio); | 39 | #endif |
41 | -} | 40 | +#endif /* CONFIG_TCG */ |
42 | - | 41 | |
43 | static void n8x0_usb_setup(struct n800_s *s) | 42 | const char *arm_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) |
44 | { | 43 | { |
45 | SysBusDevice *dev; | 44 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) |
46 | @@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine, | 45 | arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs), |
47 | n8x0_spi_setup(s); | 46 | "system-registers.xml", 0); |
48 | n8x0_dss_setup(s); | 47 | |
49 | n8x0_cbus_setup(s); | 48 | +#ifdef CONFIG_TCG |
50 | - n8x0_uart_setup(s); | 49 | if (arm_feature(env, ARM_FEATURE_M) && tcg_enabled()) { |
51 | if (machine_usb(machine)) { | 50 | gdb_register_coprocessor(cs, |
52 | n8x0_usb_setup(s); | 51 | arm_gdb_get_m_systemreg, arm_gdb_set_m_systemreg, |
52 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) | ||
53 | } | ||
54 | #endif | ||
53 | } | 55 | } |
56 | +#endif /* CONFIG_TCG */ | ||
57 | } | ||
54 | -- | 58 | -- |
55 | 2.20.1 | 59 | 2.34.1 |
56 | |||
57 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Akihiko Odaki <akihiko.odaki@daynix.com> |
---|---|---|---|
2 | 2 | ||
3 | commit 32bd322a0134 ("hw/timer/armv7m_systick: Rewrite to use ptimers") | 3 | AwSRAMCClass is larger than SysBusDeviceClass so the class size must be |
4 | changed armv7m_systick to build on ptimers. Make sure we have ptimers | 4 | advertised accordingly. |
5 | in the build when building armv7m_systick. | ||
6 | 5 | ||
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 6 | Fixes: 05def917e1 ("hw: arm: allwinner-sramc: Add SRAM Controller support for R40") |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> |
9 | Message-id: 20201104103343.30392-1-drjones@redhat.com | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20230628110905.38125-1-akihiko.odaki@daynix.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 12 | --- |
12 | hw/arm/Kconfig | 1 + | 13 | hw/misc/allwinner-sramc.c | 1 + |
13 | 1 file changed, 1 insertion(+) | 14 | 1 file changed, 1 insertion(+) |
14 | 15 | ||
15 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 16 | diff --git a/hw/misc/allwinner-sramc.c b/hw/misc/allwinner-sramc.c |
16 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/Kconfig | 18 | --- a/hw/misc/allwinner-sramc.c |
18 | +++ b/hw/arm/Kconfig | 19 | +++ b/hw/misc/allwinner-sramc.c |
19 | @@ -XXX,XX +XXX,XX @@ config ZYNQ | 20 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo allwinner_sramc_info = { |
20 | 21 | .parent = TYPE_SYS_BUS_DEVICE, | |
21 | config ARM_V7M | 22 | .instance_init = allwinner_sramc_init, |
22 | bool | 23 | .instance_size = sizeof(AwSRAMCState), |
23 | + select PTIMER | 24 | + .class_size = sizeof(AwSRAMCClass), |
24 | 25 | .class_init = allwinner_sramc_class_init, | |
25 | config ALLWINNER_A10 | 26 | }; |
26 | bool | 27 | |
27 | -- | 28 | -- |
28 | 2.20.1 | 29 | 2.34.1 |
29 | 30 | ||
30 | 31 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: AlexChen <alex.chen@huawei.com> | ||
2 | 1 | ||
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 |
Deleted patch | |||
---|---|---|---|
1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> | ||
2 | 1 | ||
3 | Fix code style. Don't use '#' flag of printf format ('%#') in | ||
4 | format strings, use '0x' prefix instead | ||
5 | |||
6 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> | ||
7 | Signed-off-by: Kai Deng <dengkai1@huawei.com> | ||
8 | Message-id: 20201103114529.638233-2-zhangxinhao1@huawei.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | target/arm/translate-a64.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/arm/translate-a64.c | ||
18 | +++ b/target/arm/translate-a64.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_three_reg_same_fp16(DisasContext *s, uint32_t insn) | ||
20 | gen_helper_advsimd_acgt_f16(tcg_res, tcg_op1, tcg_op2, fpst); | ||
21 | break; | ||
22 | default: | ||
23 | - fprintf(stderr, "%s: insn %#04x, fpop %#2x @ %#" PRIx64 "\n", | ||
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(); | ||
35 | } | ||
36 | |||
37 | -- | ||
38 | 2.20.1 | ||
39 | |||
40 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Xinhao Zhang <zhangxinhao1@huawei.com> | ||
2 | 1 | ||
3 | Fix code style. Space required before the open parenthesis '('. | ||
4 | |||
5 | Signed-off-by: Xinhao Zhang <zhangxinhao1@huawei.com> | ||
6 | Signed-off-by: Kai Deng <dengkai1@huawei.com> | ||
7 | Message-id: 20201103114529.638233-3-zhangxinhao1@huawei.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | target/arm/translate.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/target/arm/translate.c | ||
17 | +++ b/target/arm/translate.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
19 | - Hardware watchpoints. | ||
20 | Hardware breakpoints have already been handled and skip this code. | ||
21 | */ | ||
22 | - switch(dc->base.is_jmp) { | ||
23 | + switch (dc->base.is_jmp) { | ||
24 | case DISAS_NEXT: | ||
25 | case DISAS_TOO_MANY: | ||
26 | gen_goto_tb(dc, 1, dc->base.pc_next); | ||
27 | -- | ||
28 | 2.20.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
2 | 1 | ||
3 | When using a Cortex-A15, the Virt machine does not use any | ||
4 | MPCore peripherals. Remove the dependency. | ||
5 | |||
6 | Fixes: 7951c7b7c05 ("hw/arm: Express dependencies of the virt machine with Kconfig") | ||
7 | Reported-by: Miroslav Rezanina <mrezanin@redhat.com> | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 20201107114852.271922-1-philmd@redhat.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/Kconfig | 1 - | ||
14 | 1 file changed, 1 deletion(-) | ||
15 | |||
16 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/Kconfig | ||
19 | +++ b/hw/arm/Kconfig | ||
20 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | ||
21 | imply VFIO_PLATFORM | ||
22 | imply VFIO_XGMAC | ||
23 | imply TPM_TIS_SYSBUS | ||
24 | - select A15MPCORE | ||
25 | select ACPI | ||
26 | select ARM_SMMUV3 | ||
27 | select GPIO_KEY | ||
28 | -- | ||
29 | 2.20.1 | ||
30 | |||
31 | diff view generated by jsdifflib |
Deleted 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. | ||
5 | 1 | ||
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 | Checks for UNDEF cases should go before the "is VFP enabled?" access | 1 | In handle_interrupt() we use level as an index into the interrupt_vector[] |
---|---|---|---|
2 | check, except in special cases. Move a stray UNDEF check in the VTBL | 2 | array. This is safe because we have checked it against env->config->nlevel, |
3 | trans function up above the access check. | 3 | but Coverity can't see that (and it is only true because each CPU config |
4 | sets its XCHAL_NUM_INTLEVELS to something less than MAX_NLEVELS), so it | ||
5 | complains about a possible array overrun (CID 1507131) | ||
6 | |||
7 | Add an assert() which will make Coverity happy and catch the unlikely | ||
8 | case of a mis-set XCHAL_NUM_INTLEVELS in future. | ||
4 | 9 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Acked-by: Max Filippov <jcmvbkbc@gmail.com> |
7 | Message-id: 20201109145324.2859-1-peter.maydell@linaro.org | 12 | Message-id: 20230623154135.1930261-1-peter.maydell@linaro.org |
8 | --- | 13 | --- |
9 | target/arm/translate-neon.c.inc | 8 ++++---- | 14 | target/xtensa/exc_helper.c | 3 +++ |
10 | 1 file changed, 4 insertions(+), 4 deletions(-) | 15 | 1 file changed, 3 insertions(+) |
11 | 16 | ||
12 | diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc | 17 | diff --git a/target/xtensa/exc_helper.c b/target/xtensa/exc_helper.c |
13 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/translate-neon.c.inc | 19 | --- a/target/xtensa/exc_helper.c |
15 | +++ b/target/arm/translate-neon.c.inc | 20 | +++ b/target/xtensa/exc_helper.c |
16 | @@ -XXX,XX +XXX,XX @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) | 21 | @@ -XXX,XX +XXX,XX @@ static void handle_interrupt(CPUXtensaState *env) |
17 | return false; | 22 | CPUState *cs = env_cpu(env); |
18 | } | 23 | |
19 | 24 | if (level > 1) { | |
20 | - if (!vfp_access_check(s)) { | 25 | + /* env->config->nlevel check should have ensured this */ |
21 | - return true; | 26 | + assert(level < sizeof(env->config->interrupt_vector)); |
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 | + | 27 | + |
35 | desc = tcg_const_i32((a->vn << 2) | a->len); | 28 | env->sregs[EPC1 + level - 1] = env->pc; |
36 | def = tcg_temp_new_i64(); | 29 | env->sregs[EPS2 + level - 2] = env->sregs[PS]; |
37 | if (a->op) { | 30 | env->sregs[PS] = |
38 | -- | 31 | -- |
39 | 2.20.1 | 32 | 2.34.1 |
40 | |||
41 | diff view generated by jsdifflib |