1 | Arm patch queue -- these are all bug fix patches but we might | 1 | Mostly just bug fixes. The important one here is |
---|---|---|---|
2 | as well put them in to rc0... | 2 | hw/intc/arm_gic: Fix interrupt ID in GICD_SGIR register |
3 | which fixes a buffer overrun that's a security issue if you're running | ||
4 | KVM on Arm with kernel-irqchip=off (which hopefully nobody is doing in | ||
5 | a security context, because kernel-irqchip=on is the default and the | ||
6 | sensible choice for performance). | ||
3 | 7 | ||
4 | thanks | ||
5 | -- PMM | 8 | -- PMM |
6 | 9 | ||
7 | The following changes since commit 2c8cfc0b52b5a4d123c26c0b5fdf941be24805be: | 10 | The following changes since commit cf7ca7d5b9faca13f1f8e3ea92cfb2f741eb0c0e: |
8 | 11 | ||
9 | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2018-03-19 11:44:26 +0000) | 12 | Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/tracing-pull-request' into staging (2021-02-01 16:28:00 +0000) |
10 | 13 | ||
11 | are available in the Git repository at: | 14 | are available in the Git repository at: |
12 | 15 | ||
13 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180319 | 16 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210202-1 |
14 | 17 | ||
15 | for you to fetch changes up to ff72cb6b46b95bb530787add5277c211af3d31c6: | 18 | for you to fetch changes up to 14657850c9cc10948551fbb884c30eb5a3a7370a: |
16 | 19 | ||
17 | hw/arm/raspi: Provide spin-loop code for AArch64 CPUs (2018-03-19 18:23:24 +0000) | 20 | hw/arm: Display CPU type in machine description (2021-02-02 17:53:44 +0000) |
18 | 21 | ||
19 | ---------------------------------------------------------------- | 22 | ---------------------------------------------------------------- |
20 | target-arm queue: | 23 | target-arm queue: |
21 | * fsl-imx6: Fix incorrect Ethernet interrupt defines | 24 | * hw/intc/arm_gic: Allow to use QTest without crashing |
22 | * dump: Update correct kdump phys_base field for AArch64 | 25 | * hw/char/exynos4210_uart: Fix buffer size reporting with FIFO disabled |
23 | * char: i.MX: Add support for "TX complete" interrupt | 26 | * hw/char/exynos4210_uart: Fix missing call to report ready for input |
24 | * bcm2836/raspi: Fix various bugs resulting in panics trying | 27 | * hw/arm/smmuv3: Fix addr_mask for range-based invalidation |
25 | to boot a Debian Linux kernel on raspi3 | 28 | * hw/ssi/imx_spi: Fix various minor bugs |
29 | * hw/intc/arm_gic: Fix interrupt ID in GICD_SGIR register | ||
30 | * hw/arm: Add missing Kconfig dependencies | ||
31 | * hw/arm: Display CPU type in machine description | ||
26 | 32 | ||
27 | ---------------------------------------------------------------- | 33 | ---------------------------------------------------------------- |
28 | Andrey Smirnov (2): | 34 | Bin Meng (5): |
29 | char: i.MX: Simplify imx_update() | 35 | hw/ssi: imx_spi: Use a macro for number of chip selects supported |
30 | char: i.MX: Add support for "TX complete" interrupt | 36 | hw/ssi: imx_spi: Remove imx_spi_update_irq() in imx_spi_reset() |
37 | hw/ssi: imx_spi: Round up the burst length to be multiple of 8 | ||
38 | hw/ssi: imx_spi: Correct the burst length > 32 bit transfer logic | ||
39 | hw/ssi: imx_spi: Correct tx and rx fifo endianness | ||
31 | 40 | ||
32 | Guenter Roeck (1): | 41 | Iris Johnson (2): |
33 | fsl-imx6: Swap Ethernet interrupt defines | 42 | hw/char/exynos4210_uart: Fix buffer size reporting with FIFO disabled |
43 | hw/char/exynos4210_uart: Fix missing call to report ready for input | ||
34 | 44 | ||
35 | Peter Maydell (9): | 45 | Philippe Mathieu-Daudé (12): |
36 | hw/arm/raspi: Don't do board-setup or secure-boot for raspi3 | 46 | hw/intc/arm_gic: Allow to use QTest without crashing |
37 | hw/arm/boot: assert that secure_boot and secure_board_setup are false for AArch64 | 47 | hw/ssi: imx_spi: Remove pointless variable initialization |
38 | hw/arm/boot: If booting a kernel in EL2, set SCR_EL3.HCE | 48 | hw/ssi: imx_spi: Rework imx_spi_reset() to keep CONREG register value |
39 | hw/arm/bcm2386: Fix parent type of bcm2386 | 49 | hw/ssi: imx_spi: Rework imx_spi_read() to handle block disabled |
40 | hw/arm/bcm2836: Rename bcm2836 type/struct to bcm283x | 50 | hw/ssi: imx_spi: Rework imx_spi_write() to handle block disabled |
41 | hw/arm/bcm2836: Create proper bcm2837 device | 51 | hw/intc/arm_gic: Fix interrupt ID in GICD_SGIR register |
42 | hw/arm/bcm2836: Use correct affinity values for BCM2837 | 52 | hw/arm/stm32f405_soc: Add missing dependency on OR_IRQ |
43 | hw/arm/bcm2836: Hardcode correct CPU type | 53 | hw/arm/exynos4210: Add missing dependency on OR_IRQ |
44 | hw/arm/raspi: Provide spin-loop code for AArch64 CPUs | 54 | hw/arm/xlnx-versal: Versal SoC requires ZDMA |
55 | hw/arm/xlnx-versal: Versal SoC requires ZynqMP peripherals | ||
56 | hw/net/can: ZynqMP CAN device requires PTIMER | ||
57 | hw/arm: Display CPU type in machine description | ||
45 | 58 | ||
46 | Wei Huang (1): | 59 | Xuzhou Cheng (1): |
47 | dump: Update correct kdump phys_base field for AArch64 | 60 | hw/ssi: imx_spi: Disable chip selects when controller is disabled |
48 | 61 | ||
49 | include/hw/arm/bcm2836.h | 31 +++++++++++++--- | 62 | Zenghui Yu (1): |
50 | include/hw/arm/fsl-imx6.h | 4 +- | 63 | hw/arm/smmuv3: Fix addr_mask for range-based invalidation |
51 | include/hw/char/imx_serial.h | 3 ++ | ||
52 | dump.c | 14 +++++-- | ||
53 | hw/arm/bcm2836.c | 87 +++++++++++++++++++++++++++++++------------- | ||
54 | hw/arm/boot.c | 12 ++++++ | ||
55 | hw/arm/raspi.c | 77 +++++++++++++++++++++++++++++++-------- | ||
56 | hw/char/imx_serial.c | 44 ++++++++++++++++------ | ||
57 | hw/net/imx_fec.c | 28 +++++++++++++- | ||
58 | 9 files changed, 237 insertions(+), 63 deletions(-) | ||
59 | 64 | ||
65 | include/hw/ssi/imx_spi.h | 5 +- | ||
66 | hw/arm/digic_boards.c | 2 +- | ||
67 | hw/arm/microbit.c | 2 +- | ||
68 | hw/arm/netduino2.c | 2 +- | ||
69 | hw/arm/netduinoplus2.c | 2 +- | ||
70 | hw/arm/orangepi.c | 2 +- | ||
71 | hw/arm/smmuv3.c | 4 +- | ||
72 | hw/arm/stellaris.c | 4 +- | ||
73 | hw/char/exynos4210_uart.c | 7 ++- | ||
74 | hw/intc/arm_gic.c | 5 +- | ||
75 | hw/ssi/imx_spi.c | 153 +++++++++++++++++++++++++++++----------------- | ||
76 | hw/Kconfig | 1 + | ||
77 | hw/arm/Kconfig | 5 ++ | ||
78 | hw/dma/Kconfig | 3 + | ||
79 | hw/dma/meson.build | 2 +- | ||
80 | 15 files changed, 130 insertions(+), 69 deletions(-) | ||
81 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
1 | 2 | ||
3 | Alexander reported an issue in gic_get_current_cpu() using the | ||
4 | fuzzer. Yet another "deref current_cpu with QTest" bug, reproducible | ||
5 | doing: | ||
6 | |||
7 | $ echo readb 0xf03ff000 | qemu-system-arm -M npcm750-evb,accel=qtest -qtest stdio | ||
8 | [I 1611849440.651452] OPENED | ||
9 | [R +0.242498] readb 0xf03ff000 | ||
10 | hw/intc/arm_gic.c:63:29: runtime error: member access within null pointer of type 'CPUState' (aka 'struct CPUState') | ||
11 | SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior hw/intc/arm_gic.c:63:29 in | ||
12 | AddressSanitizer:DEADLYSIGNAL | ||
13 | ================================================================= | ||
14 | ==3719691==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000082a0 (pc 0x5618790ac882 bp 0x7ffca946f4f0 sp 0x7ffca946f4a0 T0) | ||
15 | ==3719691==The signal is caused by a READ memory access. | ||
16 | #0 0x5618790ac882 in gic_get_current_cpu hw/intc/arm_gic.c:63:29 | ||
17 | #1 0x5618790a8901 in gic_dist_readb hw/intc/arm_gic.c:955:11 | ||
18 | #2 0x5618790a7489 in gic_dist_read hw/intc/arm_gic.c:1158:17 | ||
19 | #3 0x56187adc573b in memory_region_read_with_attrs_accessor softmmu/memory.c:464:9 | ||
20 | #4 0x56187ad7903a in access_with_adjusted_size softmmu/memory.c:552:18 | ||
21 | #5 0x56187ad766d6 in memory_region_dispatch_read1 softmmu/memory.c:1426:16 | ||
22 | #6 0x56187ad758a8 in memory_region_dispatch_read softmmu/memory.c:1449:9 | ||
23 | #7 0x56187b09e84c in flatview_read_continue softmmu/physmem.c:2822:23 | ||
24 | #8 0x56187b0a0115 in flatview_read softmmu/physmem.c:2862:12 | ||
25 | #9 0x56187b09fc9e in address_space_read_full softmmu/physmem.c:2875:18 | ||
26 | #10 0x56187aa88633 in address_space_read include/exec/memory.h:2489:18 | ||
27 | #11 0x56187aa88633 in qtest_process_command softmmu/qtest.c:558:13 | ||
28 | #12 0x56187aa81881 in qtest_process_inbuf softmmu/qtest.c:797:9 | ||
29 | #13 0x56187aa80e02 in qtest_read softmmu/qtest.c:809:5 | ||
30 | |||
31 | current_cpu is NULL because QTest accelerator does not use CPU. | ||
32 | |||
33 | Fix by skipping the check and returning the first CPU index when | ||
34 | QTest accelerator is used, similarly to commit c781a2cc423 | ||
35 | ("hw/i386/vmport: Allow QTest use without crashing"). | ||
36 | |||
37 | Reported-by: Alexander Bulekov <alxndr@bu.edu> | ||
38 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
39 | Reviewed-by: Darren Kenny <darren.kenny@oracle.com> | ||
40 | Reviewed-by: Alexander Bulekov <alxndr@bu.edu> | ||
41 | Message-id: 20210128161417.3726358-1-philmd@redhat.com | ||
42 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
43 | --- | ||
44 | hw/intc/arm_gic.c | 3 ++- | ||
45 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
46 | |||
47 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | ||
48 | index XXXXXXX..XXXXXXX 100644 | ||
49 | --- a/hw/intc/arm_gic.c | ||
50 | +++ b/hw/intc/arm_gic.c | ||
51 | @@ -XXX,XX +XXX,XX @@ | ||
52 | #include "qemu/module.h" | ||
53 | #include "trace.h" | ||
54 | #include "sysemu/kvm.h" | ||
55 | +#include "sysemu/qtest.h" | ||
56 | |||
57 | /* #define DEBUG_GIC */ | ||
58 | |||
59 | @@ -XXX,XX +XXX,XX @@ static const uint8_t gic_id_gicv2[] = { | ||
60 | |||
61 | static inline int gic_get_current_cpu(GICState *s) | ||
62 | { | ||
63 | - if (s->num_cpu > 1) { | ||
64 | + if (!qtest_enabled() && s->num_cpu > 1) { | ||
65 | return current_cpu->cpu_index; | ||
66 | } | ||
67 | return 0; | ||
68 | -- | ||
69 | 2.20.1 | ||
70 | |||
71 | diff view generated by jsdifflib |
1 | From: Andrey Smirnov <andrew.smirnov@gmail.com> | 1 | From: Iris Johnson <iris@modwiz.com> |
---|---|---|---|
2 | 2 | ||
3 | Code of imx_update() is slightly confusing since the "flags" variable | 3 | Currently the Exynos 4210 UART code always reports available FIFO space |
4 | doesn't really corespond to anything in real hardware and server as a | 4 | when the backend checks for buffer space. When the FIFO is disabled this |
5 | kitchensink accumulating events normally reported via USR1 and USR2 | 5 | is behavior causes the backend chardev code to replace the data before the |
6 | registers. | 6 | guest can read it. |
7 | 7 | ||
8 | Change the code to explicitly evaluate state of interrupts reported | 8 | This patch changes adds the logic to report the capacity properly when the |
9 | via USR1 and USR2 against corresponding masking bits and use the to | 9 | FIFO is not being used. |
10 | detemine if IRQ line should be asserted or not. | ||
11 | 10 | ||
12 | NOTE: Check for UTS1_TXEMPTY being set has been dropped for two | 11 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913344 |
13 | reasons: | 12 | Signed-off-by: Iris Johnson <iris@modwiz.com> |
14 | 13 | Message-id: 20210128033655.1029577-1-iris@modwiz.com | |
15 | 1. Emulation code implements a single character FIFO, so this flag | ||
16 | will always be set since characters are trasmitted as a part of | ||
17 | the code emulating "push" into the FIFO | ||
18 | |||
19 | 2. imx_update() is really just a function doing ORing and maksing | ||
20 | of reported events, so checking for UTS1_TXEMPTY should happen, | ||
21 | if it's ever really needed should probably happen outside of | ||
22 | it. | ||
23 | |||
24 | Cc: qemu-devel@nongnu.org | ||
25 | Cc: qemu-arm@nongnu.org | ||
26 | Cc: Bill Paul <wpaul@windriver.com> | ||
27 | Cc: Peter Maydell <peter.maydell@linaro.org> | ||
28 | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
29 | Message-id: 20180315191141.6789-1-andrew.smirnov@gmail.com | ||
30 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
31 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
32 | --- | 16 | --- |
33 | hw/char/imx_serial.c | 24 ++++++++++++++++-------- | 17 | hw/char/exynos4210_uart.c | 6 +++++- |
34 | 1 file changed, 16 insertions(+), 8 deletions(-) | 18 | 1 file changed, 5 insertions(+), 1 deletion(-) |
35 | 19 | ||
36 | diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c | 20 | diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c |
37 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/hw/char/imx_serial.c | 22 | --- a/hw/char/exynos4210_uart.c |
39 | +++ b/hw/char/imx_serial.c | 23 | +++ b/hw/char/exynos4210_uart.c |
40 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = { | 24 | @@ -XXX,XX +XXX,XX @@ static int exynos4210_uart_can_receive(void *opaque) |
41 | |||
42 | static void imx_update(IMXSerialState *s) | ||
43 | { | 25 | { |
44 | - uint32_t flags; | 26 | Exynos4210UartState *s = (Exynos4210UartState *)opaque; |
45 | + uint32_t usr1; | 27 | |
46 | + uint32_t usr2; | 28 | - return fifo_empty_elements_number(&s->rx); |
47 | + uint32_t mask; | 29 | + if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) { |
48 | 30 | + return fifo_empty_elements_number(&s->rx); | |
49 | - flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY); | 31 | + } else { |
50 | - if (s->ucr1 & UCR1_TXMPTYEN) { | 32 | + return !(s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY); |
51 | - flags |= (s->uts1 & UTS1_TXEMPTY); | 33 | + } |
52 | - } else { | ||
53 | - flags &= ~USR1_TRDY; | ||
54 | - } | ||
55 | + /* | ||
56 | + * Lucky for us TRDY and RRDY has the same offset in both USR1 and | ||
57 | + * UCR1, so we can get away with something as simple as the | ||
58 | + * following: | ||
59 | + */ | ||
60 | + usr1 = s->usr1 & s->ucr1 & (USR1_TRDY | USR1_RRDY); | ||
61 | + /* | ||
62 | + * Bits that we want in USR2 are not as conveniently laid out, | ||
63 | + * unfortunately. | ||
64 | + */ | ||
65 | + mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0; | ||
66 | + usr2 = s->usr2 & mask; | ||
67 | |||
68 | - qemu_set_irq(s->irq, !!flags); | ||
69 | + qemu_set_irq(s->irq, usr1 || usr2); | ||
70 | } | 34 | } |
71 | 35 | ||
72 | static void imx_serial_reset(IMXSerialState *s) | 36 | static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int size) |
73 | -- | 37 | -- |
74 | 2.16.2 | 38 | 2.20.1 |
75 | 39 | ||
76 | 40 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Iris Johnson <iris@modwiz.com> | ||
1 | 2 | ||
3 | When the frontend device has no space for a read the fd is removed | ||
4 | from polling to allow time for the guest to read and clear the buffer. | ||
5 | Without the call to qemu_chr_fe_accept_input(), the poll will not be | ||
6 | broken out of when the guest has cleared the buffer causing significant | ||
7 | IO delays that get worse with smaller buffers. | ||
8 | |||
9 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913341 | ||
10 | Signed-off-by: Iris Johnson <iris@modwiz.com> | ||
11 | Message-id: 20210130184016.1787097-1-iris@modwiz.com | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/char/exynos4210_uart.c | 1 + | ||
16 | 1 file changed, 1 insertion(+) | ||
17 | |||
18 | diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/char/exynos4210_uart.c | ||
21 | +++ b/hw/char/exynos4210_uart.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset, | ||
23 | s->reg[I_(UTRSTAT)] &= ~UTRSTAT_Rx_BUFFER_DATA_READY; | ||
24 | res = s->reg[I_(URXH)]; | ||
25 | } | ||
26 | + qemu_chr_fe_accept_input(&s->chr); | ||
27 | exynos4210_uart_update_dmabusy(s); | ||
28 | trace_exynos_uart_read(s->channel, offset, | ||
29 | exynos4210_uart_regname(offset), res); | ||
30 | -- | ||
31 | 2.20.1 | ||
32 | |||
33 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Zenghui Yu <yuzenghui@huawei.com> | ||
1 | 2 | ||
3 | When handling guest range-based IOTLB invalidation, we should decode the TG | ||
4 | field into the corresponding translation granule size so that we can pass | ||
5 | the correct invalidation range to backend. Set @granule to (tg * 2 + 10) to | ||
6 | properly emulate the architecture. | ||
7 | |||
8 | Fixes: d52915616c05 ("hw/arm/smmuv3: Get prepared for range invalidation") | ||
9 | Signed-off-by: Zenghui Yu <yuzenghui@huawei.com> | ||
10 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
11 | Message-id: 20210130043220.1345-1-yuzenghui@huawei.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/smmuv3.c | 4 +++- | ||
15 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/arm/smmuv3.c | ||
20 | +++ b/hw/arm/smmuv3.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, | ||
22 | { | ||
23 | SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu); | ||
24 | IOMMUTLBEvent event; | ||
25 | - uint8_t granule = tg; | ||
26 | + uint8_t granule; | ||
27 | |||
28 | if (!tg) { | ||
29 | SMMUEventInfo event = {.inval_ste_allowed = true}; | ||
30 | @@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, | ||
31 | return; | ||
32 | } | ||
33 | granule = tt->granule_sz; | ||
34 | + } else { | ||
35 | + granule = tg * 2 + 10; | ||
36 | } | ||
37 | |||
38 | event.type = IOMMU_NOTIFIER_UNMAP; | ||
39 | -- | ||
40 | 2.20.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
1 | The BCM2837 sets the Aff1 field of the MPIDR affinity values for the | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | CPUs to 0, whereas the BCM2836 uses 0xf. Set this correctly, as it | ||
3 | is required for Linux to boot. | ||
4 | 2 | ||
3 | Avoid using a magic number (4) everywhere for the number of chip | ||
4 | selects supported. | ||
5 | |||
6 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||
10 | Message-id: 20210129132323.30946-2-bmeng.cn@gmail.com | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20180313153458.26822-8-peter.maydell@linaro.org | ||
9 | --- | 12 | --- |
10 | hw/arm/bcm2836.c | 11 +++++++---- | 13 | include/hw/ssi/imx_spi.h | 5 ++++- |
11 | 1 file changed, 7 insertions(+), 4 deletions(-) | 14 | hw/ssi/imx_spi.c | 4 ++-- |
15 | 2 files changed, 6 insertions(+), 3 deletions(-) | ||
12 | 16 | ||
13 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | 17 | diff --git a/include/hw/ssi/imx_spi.h b/include/hw/ssi/imx_spi.h |
14 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/bcm2836.c | 19 | --- a/include/hw/ssi/imx_spi.h |
16 | +++ b/hw/arm/bcm2836.c | 20 | +++ b/include/hw/ssi/imx_spi.h |
17 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
18 | 22 | ||
19 | struct BCM283XInfo { | 23 | #define EXTRACT(value, name) extract32(value, name##_SHIFT, name##_LENGTH) |
20 | const char *name; | 24 | |
21 | + int clusterid; | 25 | +/* number of chip selects supported */ |
22 | }; | 26 | +#define ECSPI_NUM_CS 4 |
23 | 27 | + | |
24 | static const BCM283XInfo bcm283x_socs[] = { | 28 | #define TYPE_IMX_SPI "imx.spi" |
25 | { | 29 | OBJECT_DECLARE_SIMPLE_TYPE(IMXSPIState, IMX_SPI) |
26 | .name = TYPE_BCM2836, | 30 | |
27 | + .clusterid = 0xf, | 31 | @@ -XXX,XX +XXX,XX @@ struct IMXSPIState { |
28 | }, | 32 | |
29 | { | 33 | qemu_irq irq; |
30 | .name = TYPE_BCM2837, | 34 | |
31 | + .clusterid = 0x0, | 35 | - qemu_irq cs_lines[4]; |
32 | }, | 36 | + qemu_irq cs_lines[ECSPI_NUM_CS]; |
33 | }; | 37 | |
34 | 38 | SSIBus *bus; | |
35 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj) | 39 | |
36 | static void bcm2836_realize(DeviceState *dev, Error **errp) | 40 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
37 | { | 41 | index XXXXXXX..XXXXXXX 100644 |
38 | BCM283XState *s = BCM283X(dev); | 42 | --- a/hw/ssi/imx_spi.c |
39 | + BCM283XClass *bc = BCM283X_GET_CLASS(dev); | 43 | +++ b/hw/ssi/imx_spi.c |
40 | + const BCM283XInfo *info = bc->info; | 44 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value, |
41 | Object *obj; | 45 | |
42 | Error *err = NULL; | 46 | /* We are in master mode */ |
43 | int n; | 47 | |
44 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp) | 48 | - for (i = 0; i < 4; i++) { |
45 | qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0)); | 49 | + for (i = 0; i < ECSPI_NUM_CS; i++) { |
46 | 50 | qemu_set_irq(s->cs_lines[i], | |
47 | for (n = 0; n < BCM283X_NCPUS; n++) { | 51 | i == imx_spi_selected_channel(s) ? 0 : 1); |
48 | - /* Mirror bcm2836, which has clusterid set to 0xf | 52 | } |
49 | - * TODO: this should be converted to a property of ARM_CPU | 53 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_realize(DeviceState *dev, Error **errp) |
50 | - */ | 54 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); |
51 | - s->cpus[n].mp_affinity = 0xF00 | n; | 55 | sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); |
52 | + /* TODO: this should be converted to a property of ARM_CPU */ | 56 | |
53 | + s->cpus[n].mp_affinity = (info->clusterid << 8) | n; | 57 | - for (i = 0; i < 4; ++i) { |
54 | 58 | + for (i = 0; i < ECSPI_NUM_CS; ++i) { | |
55 | /* set periphbase/CBAR value for CPU-local registers */ | 59 | sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->cs_lines[i]); |
56 | object_property_set_int(OBJECT(&s->cpus[n]), | 60 | } |
61 | |||
57 | -- | 62 | -- |
58 | 2.16.2 | 63 | 2.20.1 |
59 | 64 | ||
60 | 65 | diff view generated by jsdifflib |
1 | The raspi3 has AArch64 CPUs, which means that our smpboot | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | code for keeping the secondary CPUs in a pen needs to have | ||
3 | a version for A64 as well as A32. Without this, the | ||
4 | secondary CPUs go into an infinite loop of taking undefined | ||
5 | instruction exceptions. | ||
6 | 2 | ||
3 | Usually the approach is that the device on the other end of the line | ||
4 | is going to reset its state anyway, so there's no need to actively | ||
5 | signal an irq line change during the reset hook. | ||
6 | |||
7 | Move imx_spi_update_irq() out of imx_spi_reset(), to a new function | ||
8 | imx_spi_soft_reset() that is called when the controller is disabled. | ||
9 | |||
10 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Message-id: 20210129132323.30946-3-bmeng.cn@gmail.com | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20180313153458.26822-10-peter.maydell@linaro.org | ||
10 | --- | 14 | --- |
11 | hw/arm/raspi.c | 41 ++++++++++++++++++++++++++++++++++++++++- | 15 | hw/ssi/imx_spi.c | 14 ++++++++++---- |
12 | 1 file changed, 40 insertions(+), 1 deletion(-) | 16 | 1 file changed, 10 insertions(+), 4 deletions(-) |
13 | 17 | ||
14 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 18 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
15 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/raspi.c | 20 | --- a/hw/ssi/imx_spi.c |
17 | +++ b/hw/arm/raspi.c | 21 | +++ b/hw/ssi/imx_spi.c |
18 | @@ -XXX,XX +XXX,XX @@ | 22 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_reset(DeviceState *dev) |
19 | #define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */ | 23 | imx_spi_rxfifo_reset(s); |
20 | #define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */ | 24 | imx_spi_txfifo_reset(s); |
21 | #define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */ | 25 | |
22 | +#define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */ | 26 | - imx_spi_update_irq(s); |
23 | 27 | - | |
24 | /* Table of Linux board IDs for different Pi versions */ | 28 | s->burst_length = 0; |
25 | static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44}; | ||
26 | @@ -XXX,XX +XXX,XX @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) | ||
27 | info->smp_loader_start); | ||
28 | } | 29 | } |
29 | 30 | ||
30 | +static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info) | 31 | +static void imx_spi_soft_reset(IMXSPIState *s) |
31 | +{ | 32 | +{ |
32 | + /* Unlike the AArch32 version we don't need to call the board setup hook. | 33 | + imx_spi_reset(DEVICE(s)); |
33 | + * The mechanism for doing the spin-table is also entirely different. | ||
34 | + * We must have four 64-bit fields at absolute addresses | ||
35 | + * 0xd8, 0xe0, 0xe8, 0xf0 in RAM, which are the flag variables for | ||
36 | + * our CPUs, and which we must ensure are zero initialized before | ||
37 | + * the primary CPU goes into the kernel. We put these variables inside | ||
38 | + * a rom blob, so that the reset for ROM contents zeroes them for us. | ||
39 | + */ | ||
40 | + static const uint32_t smpboot[] = { | ||
41 | + 0xd2801b05, /* mov x5, 0xd8 */ | ||
42 | + 0xd53800a6, /* mrs x6, mpidr_el1 */ | ||
43 | + 0x924004c6, /* and x6, x6, #0x3 */ | ||
44 | + 0xd503205f, /* spin: wfe */ | ||
45 | + 0xf86678a4, /* ldr x4, [x5,x6,lsl #3] */ | ||
46 | + 0xb4ffffc4, /* cbz x4, spin */ | ||
47 | + 0xd2800000, /* mov x0, #0x0 */ | ||
48 | + 0xd2800001, /* mov x1, #0x0 */ | ||
49 | + 0xd2800002, /* mov x2, #0x0 */ | ||
50 | + 0xd2800003, /* mov x3, #0x0 */ | ||
51 | + 0xd61f0080, /* br x4 */ | ||
52 | + }; | ||
53 | + | 34 | + |
54 | + static const uint64_t spintables[] = { | 35 | + imx_spi_update_irq(s); |
55 | + 0, 0, 0, 0 | ||
56 | + }; | ||
57 | + | ||
58 | + rom_add_blob_fixed("raspi_smpboot", smpboot, sizeof(smpboot), | ||
59 | + info->smp_loader_start); | ||
60 | + rom_add_blob_fixed("raspi_spintables", spintables, sizeof(spintables), | ||
61 | + SPINTABLE_ADDR); | ||
62 | +} | 36 | +} |
63 | + | 37 | + |
64 | static void write_board_setup(ARMCPU *cpu, const struct arm_boot_info *info) | 38 | static uint64_t imx_spi_read(void *opaque, hwaddr offset, unsigned size) |
65 | { | 39 | { |
66 | arm_write_secure_board_setup_dummy_smc(cpu, info, MVBAR_ADDR); | 40 | uint32_t value = 0; |
67 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | 41 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value, |
68 | /* Pi2 and Pi3 requires SMP setup */ | 42 | s->regs[ECSPI_CONREG] = value; |
69 | if (version >= 2) { | 43 | |
70 | binfo.smp_loader_start = SMPBOOT_ADDR; | 44 | if (!imx_spi_is_enabled(s)) { |
71 | - binfo.write_secondary_boot = write_smpboot; | 45 | - /* device is disabled, so this is a reset */ |
72 | + if (version == 2) { | 46 | - imx_spi_reset(DEVICE(s)); |
73 | + binfo.write_secondary_boot = write_smpboot; | 47 | + /* device is disabled, so this is a soft reset */ |
74 | + } else { | 48 | + imx_spi_soft_reset(s); |
75 | + binfo.write_secondary_boot = write_smpboot64; | 49 | + |
76 | + } | 50 | return; |
77 | binfo.secondary_cpu_reset_hook = reset_secondary; | 51 | } |
78 | } | ||
79 | 52 | ||
80 | -- | 53 | -- |
81 | 2.16.2 | 54 | 2.20.1 |
82 | 55 | ||
83 | 56 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | 'burst_length' is cleared in imx_spi_reset(), which is called | ||
4 | after imx_spi_realize(). Remove the initialization to simplify. | ||
5 | |||
6 | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Bin Meng <bin.meng@windriver.com> | ||
9 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
10 | Message-id: 20210129132323.30946-4-bmeng.cn@gmail.com | ||
11 | Message-Id: <20210115153049.3353008-3-f4bug@amsat.org> | ||
12 | Reviewed-by: Bin Meng <bin.meng@windriver.com> | ||
13 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/ssi/imx_spi.c | 2 -- | ||
17 | 1 file changed, 2 deletions(-) | ||
18 | |||
19 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/ssi/imx_spi.c | ||
22 | +++ b/hw/ssi/imx_spi.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_realize(DeviceState *dev, Error **errp) | ||
24 | sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->cs_lines[i]); | ||
25 | } | ||
26 | |||
27 | - s->burst_length = 0; | ||
28 | - | ||
29 | fifo32_create(&s->tx_fifo, ECSPI_FIFO_SIZE); | ||
30 | fifo32_create(&s->rx_fifo, ECSPI_FIFO_SIZE); | ||
31 | } | ||
32 | -- | ||
33 | 2.20.1 | ||
34 | |||
35 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | When the block is disabled, all registers are reset with the | ||
4 | exception of the ECSPI_CONREG. It is initialized to zero | ||
5 | when the instance is created. | ||
6 | |||
7 | Ref: i.MX 6DQ Applications Processor Reference Manual (IMX6DQRM), | ||
8 | chapter 21.7.3: Control Register (ECSPIx_CONREG) | ||
9 | |||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20210129132323.30946-5-bmeng.cn@gmail.com | ||
14 | [bmeng: add a 'common_reset' function that does most of reset operation] | ||
15 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | hw/ssi/imx_spi.c | 32 ++++++++++++++++++++++++-------- | ||
19 | 1 file changed, 24 insertions(+), 8 deletions(-) | ||
20 | |||
21 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/ssi/imx_spi.c | ||
24 | +++ b/hw/ssi/imx_spi.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s) | ||
26 | fifo32_num_used(&s->tx_fifo), fifo32_num_used(&s->rx_fifo)); | ||
27 | } | ||
28 | |||
29 | -static void imx_spi_reset(DeviceState *dev) | ||
30 | +static void imx_spi_common_reset(IMXSPIState *s) | ||
31 | { | ||
32 | - IMXSPIState *s = IMX_SPI(dev); | ||
33 | + int i; | ||
34 | |||
35 | - DPRINTF("\n"); | ||
36 | - | ||
37 | - memset(s->regs, 0, sizeof(s->regs)); | ||
38 | - | ||
39 | - s->regs[ECSPI_STATREG] = 0x00000003; | ||
40 | + for (i = 0; i < ARRAY_SIZE(s->regs); i++) { | ||
41 | + switch (i) { | ||
42 | + case ECSPI_CONREG: | ||
43 | + /* CONREG is not updated on soft reset */ | ||
44 | + break; | ||
45 | + case ECSPI_STATREG: | ||
46 | + s->regs[i] = 0x00000003; | ||
47 | + break; | ||
48 | + default: | ||
49 | + s->regs[i] = 0; | ||
50 | + break; | ||
51 | + } | ||
52 | + } | ||
53 | |||
54 | imx_spi_rxfifo_reset(s); | ||
55 | imx_spi_txfifo_reset(s); | ||
56 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_reset(DeviceState *dev) | ||
57 | |||
58 | static void imx_spi_soft_reset(IMXSPIState *s) | ||
59 | { | ||
60 | - imx_spi_reset(DEVICE(s)); | ||
61 | + imx_spi_common_reset(s); | ||
62 | |||
63 | imx_spi_update_irq(s); | ||
64 | } | ||
65 | |||
66 | +static void imx_spi_reset(DeviceState *dev) | ||
67 | +{ | ||
68 | + IMXSPIState *s = IMX_SPI(dev); | ||
69 | + | ||
70 | + imx_spi_common_reset(s); | ||
71 | + s->regs[ECSPI_CONREG] = 0; | ||
72 | +} | ||
73 | + | ||
74 | static uint64_t imx_spi_read(void *opaque, hwaddr offset, unsigned size) | ||
75 | { | ||
76 | uint32_t value = 0; | ||
77 | -- | ||
78 | 2.20.1 | ||
79 | |||
80 | diff view generated by jsdifflib |
1 | Now we have separate types for BCM2386 and BCM2387, we might as well | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | just hard-code the CPU type they use rather than having it passed | ||
3 | through as an object property. This then lets us put the initialization | ||
4 | of the CPU object in init rather than realize. | ||
5 | 2 | ||
6 | Note that this change means that it's no longer possible on | 3 | When the block is disabled, it stay it is 'internal reset logic' |
7 | the command line to use -cpu to ask for a different kind of | 4 | (internal clocks are gated off). Reading any register returns |
8 | CPU than the SoC supports. This was never a supported thing to | 5 | its reset value. Only update this value if the device is enabled. |
9 | do anyway; we were just not sanity-checking the command line. | ||
10 | 6 | ||
11 | This does require us to only build the bcm2837 object on | 7 | Ref: i.MX 6DQ Applications Processor Reference Manual (IMX6DQRM), |
12 | TARGET_AARCH64 configs, since otherwise it won't instantiate | 8 | chapter 21.7.3: Control Register (ECSPIx_CONREG) |
13 | due to the missing cortex-a53 device and "make check" will fail. | ||
14 | 9 | ||
10 | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||
11 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Reviewed-by: Bin Meng <bin.meng@windriver.com> | ||
13 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
14 | Message-id: 20210129132323.30946-6-bmeng.cn@gmail.com | ||
15 | Message-Id: <20210115153049.3353008-5-f4bug@amsat.org> | ||
16 | Reviewed-by: Bin Meng <bin.meng@windriver.com> | ||
17 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
17 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
18 | Message-id: 20180313153458.26822-9-peter.maydell@linaro.org | ||
19 | --- | 19 | --- |
20 | hw/arm/bcm2836.c | 24 +++++++++++++++--------- | 20 | hw/ssi/imx_spi.c | 60 +++++++++++++++++++++++------------------------- |
21 | hw/arm/raspi.c | 2 -- | 21 | 1 file changed, 29 insertions(+), 31 deletions(-) |
22 | 2 files changed, 15 insertions(+), 11 deletions(-) | ||
23 | 22 | ||
24 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | 23 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
25 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/arm/bcm2836.c | 25 | --- a/hw/ssi/imx_spi.c |
27 | +++ b/hw/arm/bcm2836.c | 26 | +++ b/hw/ssi/imx_spi.c |
28 | @@ -XXX,XX +XXX,XX @@ | 27 | @@ -XXX,XX +XXX,XX @@ static uint64_t imx_spi_read(void *opaque, hwaddr offset, unsigned size) |
29 | 28 | return 0; | |
30 | struct BCM283XInfo { | 29 | } |
31 | const char *name; | 30 | |
32 | + const char *cpu_type; | 31 | - switch (index) { |
33 | int clusterid; | 32 | - case ECSPI_RXDATA: |
34 | }; | 33 | - if (!imx_spi_is_enabled(s)) { |
35 | 34 | - value = 0; | |
36 | static const BCM283XInfo bcm283x_socs[] = { | 35 | - } else if (fifo32_is_empty(&s->rx_fifo)) { |
37 | { | 36 | - /* value is undefined */ |
38 | .name = TYPE_BCM2836, | 37 | - value = 0xdeadbeef; |
39 | + .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"), | 38 | - } else { |
40 | .clusterid = 0xf, | 39 | - /* read from the RX FIFO */ |
41 | }, | 40 | - value = fifo32_pop(&s->rx_fifo); |
42 | +#ifdef TARGET_AARCH64 | 41 | + value = s->regs[index]; |
43 | { | ||
44 | .name = TYPE_BCM2837, | ||
45 | + .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"), | ||
46 | .clusterid = 0x0, | ||
47 | }, | ||
48 | +#endif | ||
49 | }; | ||
50 | |||
51 | static void bcm2836_init(Object *obj) | ||
52 | { | ||
53 | BCM283XState *s = BCM283X(obj); | ||
54 | + BCM283XClass *bc = BCM283X_GET_CLASS(obj); | ||
55 | + const BCM283XInfo *info = bc->info; | ||
56 | + int n; | ||
57 | + | 42 | + |
58 | + for (n = 0; n < BCM283X_NCPUS; n++) { | 43 | + if (imx_spi_is_enabled(s)) { |
59 | + object_initialize(&s->cpus[n], sizeof(s->cpus[n]), | 44 | + switch (index) { |
60 | + info->cpu_type); | 45 | + case ECSPI_RXDATA: |
61 | + object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]), | 46 | + if (fifo32_is_empty(&s->rx_fifo)) { |
62 | + &error_abort); | 47 | + /* value is undefined */ |
63 | + } | 48 | + value = 0xdeadbeef; |
64 | 49 | + } else { | |
65 | object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL); | 50 | + /* read from the RX FIFO */ |
66 | object_property_add_child(obj, "control", OBJECT(&s->control), NULL); | 51 | + value = fifo32_pop(&s->rx_fifo); |
67 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp) | 52 | + } |
68 | 53 | + break; | |
69 | /* common peripherals from bcm2835 */ | 54 | + case ECSPI_TXDATA: |
70 | 55 | + qemu_log_mask(LOG_GUEST_ERROR, | |
71 | - obj = OBJECT(dev); | 56 | + "[%s]%s: Trying to read from TX FIFO\n", |
72 | - for (n = 0; n < BCM283X_NCPUS; n++) { | 57 | + TYPE_IMX_SPI, __func__); |
73 | - object_initialize(&s->cpus[n], sizeof(s->cpus[n]), | 58 | + |
74 | - s->cpu_type); | 59 | + /* Reading from TXDATA gives 0 */ |
75 | - object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]), | 60 | + break; |
76 | - &error_abort); | 61 | + case ECSPI_MSGDATA: |
77 | - } | 62 | + qemu_log_mask(LOG_GUEST_ERROR, |
63 | + "[%s]%s: Trying to read from MSG FIFO\n", | ||
64 | + TYPE_IMX_SPI, __func__); | ||
65 | + /* Reading from MSGDATA gives 0 */ | ||
66 | + break; | ||
67 | + default: | ||
68 | + break; | ||
69 | } | ||
70 | |||
71 | - break; | ||
72 | - case ECSPI_TXDATA: | ||
73 | - qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Trying to read from TX FIFO\n", | ||
74 | - TYPE_IMX_SPI, __func__); | ||
78 | - | 75 | - |
79 | obj = object_property_get_link(OBJECT(dev), "ram", &err); | 76 | - /* Reading from TXDATA gives 0 */ |
80 | if (obj == NULL) { | 77 | - |
81 | error_setg(errp, "%s: required ram link not found: %s", | 78 | - break; |
82 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp) | 79 | - case ECSPI_MSGDATA: |
80 | - qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Trying to read from MSG FIFO\n", | ||
81 | - TYPE_IMX_SPI, __func__); | ||
82 | - | ||
83 | - /* Reading from MSGDATA gives 0 */ | ||
84 | - | ||
85 | - break; | ||
86 | - default: | ||
87 | - value = s->regs[index]; | ||
88 | - break; | ||
89 | + imx_spi_update_irq(s); | ||
90 | } | ||
91 | - | ||
92 | DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx_spi_reg_name(index), value); | ||
93 | |||
94 | - imx_spi_update_irq(s); | ||
95 | - | ||
96 | return (uint64_t)value; | ||
83 | } | 97 | } |
84 | 98 | ||
85 | static Property bcm2836_props[] = { | ||
86 | - DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type), | ||
87 | DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus, | ||
88 | BCM283X_NCPUS), | ||
89 | DEFINE_PROP_END_OF_LIST() | ||
90 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/hw/arm/raspi.c | ||
93 | +++ b/hw/arm/raspi.c | ||
94 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version) | ||
95 | /* Setup the SOC */ | ||
96 | object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), | ||
97 | &error_abort); | ||
98 | - object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type", | ||
99 | - &error_abort); | ||
100 | object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus", | ||
101 | &error_abort); | ||
102 | int board_rev = version == 3 ? 0xa02082 : 0xa21041; | ||
103 | -- | 99 | -- |
104 | 2.16.2 | 100 | 2.20.1 |
105 | 101 | ||
106 | 102 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | When the block is disabled, only the ECSPI_CONREG register can | ||
4 | be modified. Setting the EN bit enabled the device, clearing it | ||
5 | "disables the block and resets the internal logic with the | ||
6 | exception of the ECSPI_CONREG" register. | ||
7 | |||
8 | Ignore all other registers write except ECSPI_CONREG when the | ||
9 | block is disabled. | ||
10 | |||
11 | Ref: i.MX 6DQ Applications Processor Reference Manual (IMX6DQRM), | ||
12 | chapter 21.7.3: Control Register (ECSPIx_CONREG) | ||
13 | |||
14 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Message-id: 20210129132323.30946-7-bmeng.cn@gmail.com | ||
18 | Message-Id: <20210115153049.3353008-6-f4bug@amsat.org> | ||
19 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
20 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | --- | ||
23 | hw/ssi/imx_spi.c | 13 +++++++++---- | ||
24 | 1 file changed, 9 insertions(+), 4 deletions(-) | ||
25 | |||
26 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/hw/ssi/imx_spi.c | ||
29 | +++ b/hw/ssi/imx_spi.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value, | ||
31 | DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx_spi_reg_name(index), | ||
32 | (uint32_t)value); | ||
33 | |||
34 | + if (!imx_spi_is_enabled(s)) { | ||
35 | + /* Block is disabled */ | ||
36 | + if (index != ECSPI_CONREG) { | ||
37 | + /* Ignore access */ | ||
38 | + return; | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | change_mask = s->regs[index] ^ value; | ||
43 | |||
44 | switch (index) { | ||
45 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value, | ||
46 | TYPE_IMX_SPI, __func__); | ||
47 | break; | ||
48 | case ECSPI_TXDATA: | ||
49 | - if (!imx_spi_is_enabled(s)) { | ||
50 | - /* Ignore writes if device is disabled */ | ||
51 | - break; | ||
52 | - } else if (fifo32_is_full(&s->tx_fifo)) { | ||
53 | + if (fifo32_is_full(&s->tx_fifo)) { | ||
54 | /* Ignore writes if queue is full */ | ||
55 | break; | ||
56 | } | ||
57 | -- | ||
58 | 2.20.1 | ||
59 | |||
60 | diff view generated by jsdifflib |
1 | The bcm2837 is pretty similar to the bcm2836, but it does have | 1 | From: Xuzhou Cheng <xuzhou.cheng@windriver.com> |
---|---|---|---|
2 | some differences. Notably, the MPIDR affinity aff1 values it | ||
3 | sets for the CPUs are 0x0, rather than the 0xf that the bcm2836 | ||
4 | uses, and if this is wrong Linux will not boot. | ||
5 | 2 | ||
6 | Rather than trying to have one device with properties that | 3 | When a write to ECSPI_CONREG register to disable the SPI controller, |
7 | configure it differently for the two cases, create two | 4 | imx_spi_soft_reset() is called to reset the controller, but chip |
8 | separate QOM devices for the two SoCs. We use the same approach | 5 | select lines should have been disabled, otherwise the state machine |
9 | as hw/arm/aspeed_soc.c and share code and have a data table | 6 | of any devices (e.g.: SPI flashes) connected to the SPI master is |
10 | that might differ per-SoC. For the moment the two types don't | 7 | stuck to its last state and responds incorrectly to any follow-up |
11 | actually have different behaviour. | 8 | commands. |
12 | 9 | ||
10 | Fixes: c906a3a01582 ("i.MX: Add the Freescale SPI Controller") | ||
11 | Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com> | ||
12 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20210129132323.30946-8-bmeng.cn@gmail.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20180313153458.26822-7-peter.maydell@linaro.org | ||
16 | --- | 16 | --- |
17 | include/hw/arm/bcm2836.h | 19 +++++++++++++++++++ | 17 | hw/ssi/imx_spi.c | 6 ++++++ |
18 | hw/arm/bcm2836.c | 37 ++++++++++++++++++++++++++++++++----- | 18 | 1 file changed, 6 insertions(+) |
19 | hw/arm/raspi.c | 3 ++- | ||
20 | 3 files changed, 53 insertions(+), 6 deletions(-) | ||
21 | 19 | ||
22 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | 20 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
23 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/arm/bcm2836.h | 22 | --- a/hw/ssi/imx_spi.c |
25 | +++ b/include/hw/arm/bcm2836.h | 23 | +++ b/hw/ssi/imx_spi.c |
26 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_common_reset(IMXSPIState *s) |
27 | 25 | ||
28 | #define BCM283X_NCPUS 4 | 26 | static void imx_spi_soft_reset(IMXSPIState *s) |
29 | |||
30 | +/* These type names are for specific SoCs; other than instantiating | ||
31 | + * them, code using these devices should always handle them via the | ||
32 | + * BCM283x base class, so they have no BCM2836(obj) etc macros. | ||
33 | + */ | ||
34 | +#define TYPE_BCM2836 "bcm2836" | ||
35 | +#define TYPE_BCM2837 "bcm2837" | ||
36 | + | ||
37 | typedef struct BCM283XState { | ||
38 | /*< private >*/ | ||
39 | DeviceState parent_obj; | ||
40 | @@ -XXX,XX +XXX,XX @@ typedef struct BCM283XState { | ||
41 | BCM2835PeripheralState peripherals; | ||
42 | } BCM283XState; | ||
43 | |||
44 | +typedef struct BCM283XInfo BCM283XInfo; | ||
45 | + | ||
46 | +typedef struct BCM283XClass { | ||
47 | + DeviceClass parent_class; | ||
48 | + const BCM283XInfo *info; | ||
49 | +} BCM283XClass; | ||
50 | + | ||
51 | +#define BCM283X_CLASS(klass) \ | ||
52 | + OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X) | ||
53 | +#define BCM283X_GET_CLASS(obj) \ | ||
54 | + OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) | ||
55 | + | ||
56 | #endif /* BCM2836_H */ | ||
57 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | ||
58 | index XXXXXXX..XXXXXXX 100644 | ||
59 | --- a/hw/arm/bcm2836.c | ||
60 | +++ b/hw/arm/bcm2836.c | ||
61 | @@ -XXX,XX +XXX,XX @@ | ||
62 | /* "QA7" (Pi2) interrupt controller and mailboxes etc. */ | ||
63 | #define BCM2836_CONTROL_BASE 0x40000000 | ||
64 | |||
65 | +struct BCM283XInfo { | ||
66 | + const char *name; | ||
67 | +}; | ||
68 | + | ||
69 | +static const BCM283XInfo bcm283x_socs[] = { | ||
70 | + { | ||
71 | + .name = TYPE_BCM2836, | ||
72 | + }, | ||
73 | + { | ||
74 | + .name = TYPE_BCM2837, | ||
75 | + }, | ||
76 | +}; | ||
77 | + | ||
78 | static void bcm2836_init(Object *obj) | ||
79 | { | 27 | { |
80 | BCM283XState *s = BCM283X(obj); | ||
81 | @@ -XXX,XX +XXX,XX @@ static Property bcm2836_props[] = { | ||
82 | DEFINE_PROP_END_OF_LIST() | ||
83 | }; | ||
84 | |||
85 | -static void bcm2836_class_init(ObjectClass *oc, void *data) | ||
86 | +static void bcm283x_class_init(ObjectClass *oc, void *data) | ||
87 | { | ||
88 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
89 | + BCM283XClass *bc = BCM283X_CLASS(oc); | ||
90 | |||
91 | - dc->props = bcm2836_props; | ||
92 | + bc->info = data; | ||
93 | dc->realize = bcm2836_realize; | ||
94 | + dc->props = bcm2836_props; | ||
95 | } | ||
96 | |||
97 | -static const TypeInfo bcm2836_type_info = { | ||
98 | +static const TypeInfo bcm283x_type_info = { | ||
99 | .name = TYPE_BCM283X, | ||
100 | .parent = TYPE_DEVICE, | ||
101 | .instance_size = sizeof(BCM283XState), | ||
102 | .instance_init = bcm2836_init, | ||
103 | - .class_init = bcm2836_class_init, | ||
104 | + .class_size = sizeof(BCM283XClass), | ||
105 | + .abstract = true, | ||
106 | }; | ||
107 | |||
108 | static void bcm2836_register_types(void) | ||
109 | { | ||
110 | - type_register_static(&bcm2836_type_info); | ||
111 | + int i; | 28 | + int i; |
112 | + | 29 | + |
113 | + type_register_static(&bcm283x_type_info); | 30 | imx_spi_common_reset(s); |
114 | + for (i = 0; i < ARRAY_SIZE(bcm283x_socs); i++) { | 31 | |
115 | + TypeInfo ti = { | 32 | imx_spi_update_irq(s); |
116 | + .name = bcm283x_socs[i].name, | 33 | + |
117 | + .parent = TYPE_BCM283X, | 34 | + for (i = 0; i < ECSPI_NUM_CS; i++) { |
118 | + .class_init = bcm283x_class_init, | 35 | + qemu_set_irq(s->cs_lines[i], 1); |
119 | + .class_data = (void *) &bcm283x_socs[i], | ||
120 | + }; | ||
121 | + type_register(&ti); | ||
122 | + } | 36 | + } |
123 | } | 37 | } |
124 | 38 | ||
125 | type_init(bcm2836_register_types) | 39 | static void imx_spi_reset(DeviceState *dev) |
126 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
127 | index XXXXXXX..XXXXXXX 100644 | ||
128 | --- a/hw/arm/raspi.c | ||
129 | +++ b/hw/arm/raspi.c | ||
130 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version) | ||
131 | BusState *bus; | ||
132 | DeviceState *carddev; | ||
133 | |||
134 | - object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X); | ||
135 | + object_initialize(&s->soc, sizeof(s->soc), | ||
136 | + version == 3 ? TYPE_BCM2837 : TYPE_BCM2836); | ||
137 | object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc), | ||
138 | &error_abort); | ||
139 | |||
140 | -- | 40 | -- |
141 | 2.16.2 | 41 | 2.20.1 |
142 | 42 | ||
143 | 43 | diff view generated by jsdifflib |
1 | From: Wei Huang <wei@redhat.com> | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | 2 | ||
3 | For guest kernel that supports KASLR, the load address can change every | 3 | Current implementation of the imx spi controller expects the burst |
4 | time when guest VM runs. To find the physical base address correctly, | 4 | length to be multiple of 8, which is the most common use case. |
5 | current QEMU dump searches VMCOREINFO for the string "NUMBER(phys_base)=". | ||
6 | However this string pattern is only available on x86_64. AArch64 uses a | ||
7 | different field, called "NUMBER(PHYS_OFFSET)=". This patch makes sure | ||
8 | QEMU dump uses the correct string on AArch64. | ||
9 | 5 | ||
10 | Signed-off-by: Wei Huang <wei@redhat.com> | 6 | In case the burst length is not what we expect, log it to give user |
11 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | 7 | a chance to notice it, and round it up to be multiple of 8. |
12 | Message-id: 1520615003-20869-1-git-send-email-wei@redhat.com | 8 | |
9 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
10 | Message-id: 20210129132323.30946-9-bmeng.cn@gmail.com | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 13 | --- |
15 | dump.c | 14 +++++++++++--- | 14 | hw/ssi/imx_spi.c | 17 ++++++++++++++++- |
16 | 1 file changed, 11 insertions(+), 3 deletions(-) | 15 | 1 file changed, 16 insertions(+), 1 deletion(-) |
17 | 16 | ||
18 | diff --git a/dump.c b/dump.c | 17 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
19 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/dump.c | 19 | --- a/hw/ssi/imx_spi.c |
21 | +++ b/dump.c | 20 | +++ b/hw/ssi/imx_spi.c |
22 | @@ -XXX,XX +XXX,XX @@ static void vmcoreinfo_update_phys_base(DumpState *s) | 21 | @@ -XXX,XX +XXX,XX @@ static uint8_t imx_spi_selected_channel(IMXSPIState *s) |
23 | 22 | ||
24 | lines = g_strsplit((char *)vmci, "\n", -1); | 23 | static uint32_t imx_spi_burst_length(IMXSPIState *s) |
25 | for (i = 0; lines[i]; i++) { | 24 | { |
26 | - if (g_str_has_prefix(lines[i], "NUMBER(phys_base)=")) { | 25 | - return EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + 1; |
27 | - if (qemu_strtou64(lines[i] + 18, NULL, 16, | 26 | + uint32_t burst; |
28 | + const char *prefix = NULL; | ||
29 | + | 27 | + |
30 | + if (s->dump_info.d_machine == EM_X86_64) { | 28 | + burst = EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + 1; |
31 | + prefix = "NUMBER(phys_base)="; | 29 | + if (burst % 8) { |
32 | + } else if (s->dump_info.d_machine == EM_AARCH64) { | 30 | + burst = ROUND_UP(burst, 8); |
33 | + prefix = "NUMBER(PHYS_OFFSET)="; | 31 | + } |
32 | + | ||
33 | + return burst; | ||
34 | } | ||
35 | |||
36 | static bool imx_spi_is_enabled(IMXSPIState *s) | ||
37 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value, | ||
38 | IMXSPIState *s = opaque; | ||
39 | uint32_t index = offset >> 2; | ||
40 | uint32_t change_mask; | ||
41 | + uint32_t burst; | ||
42 | |||
43 | if (index >= ECSPI_MAX) { | ||
44 | qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" | ||
45 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value, | ||
46 | case ECSPI_CONREG: | ||
47 | s->regs[ECSPI_CONREG] = value; | ||
48 | |||
49 | + burst = EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + 1; | ||
50 | + if (burst % 8) { | ||
51 | + qemu_log_mask(LOG_UNIMP, | ||
52 | + "[%s]%s: burst length %d not supported: rounding up to next multiple of 8\n", | ||
53 | + TYPE_IMX_SPI, __func__, burst); | ||
34 | + } | 54 | + } |
35 | + | 55 | + |
36 | + if (prefix && g_str_has_prefix(lines[i], prefix)) { | 56 | if (!imx_spi_is_enabled(s)) { |
37 | + if (qemu_strtou64(lines[i] + strlen(prefix), NULL, 16, | 57 | /* device is disabled, so this is a soft reset */ |
38 | &phys_base) < 0) { | 58 | imx_spi_soft_reset(s); |
39 | - warn_report("Failed to read NUMBER(phys_base)="); | ||
40 | + warn_report("Failed to read %s", prefix); | ||
41 | } else { | ||
42 | s->dump_info.phys_base = phys_base; | ||
43 | } | ||
44 | -- | 59 | -- |
45 | 2.16.2 | 60 | 2.20.1 |
46 | 61 | ||
47 | 62 | diff view generated by jsdifflib |
1 | The TypeInfo and state struct for bcm2386 disagree about what the | 1 | From: Bin Meng <bin.meng@windriver.com> |
---|---|---|---|
2 | parent class is -- the TypeInfo says it's TYPE_SYS_BUS_DEVICE, | ||
3 | but the BCM2386State struct only defines the parent_obj field | ||
4 | as DeviceState. This would have caused problems if anything | ||
5 | actually tried to treat the object as a TYPE_SYS_BUS_DEVICE. | ||
6 | Fix the TypeInfo to use TYPE_DEVICE as the parent, since we don't | ||
7 | need any of the additional functionality TYPE_SYS_BUS_DEVICE | ||
8 | provides. | ||
9 | 2 | ||
3 | For the ECSPIx_CONREG register BURST_LENGTH field, the manual says: | ||
4 | |||
5 | 0x020 A SPI burst contains the 1 LSB in first word and all 32 bits in second word. | ||
6 | 0x021 A SPI burst contains the 2 LSB in first word and all 32 bits in second word. | ||
7 | |||
8 | Current logic uses either s->burst_length or 32, whichever smaller, | ||
9 | to determine how many bits it should read from the tx fifo each time. | ||
10 | For example, for a 48 bit burst length, current logic transfers the | ||
11 | first 32 bit from the first word in the tx fifo, followed by a 16 | ||
12 | bit from the second word in the tx fifo, which is wrong. The correct | ||
13 | logic should be: transfer the first 16 bit from the first word in | ||
14 | the tx fifo, followed by a 32 bit from the second word in the tx fifo. | ||
15 | |||
16 | With this change, SPI flash can be successfully probed by U-Boot on | ||
17 | imx6 sabrelite board. | ||
18 | |||
19 | => sf probe | ||
20 | SF: Detected sst25vf016b with page size 256 Bytes, erase size 4 KiB, total 2 MiB | ||
21 | |||
22 | Fixes: c906a3a01582 ("i.MX: Add the Freescale SPI Controller") | ||
23 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
24 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
25 | Message-id: 20210129132323.30946-10-bmeng.cn@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180313153458.26822-5-peter.maydell@linaro.org | ||
14 | --- | 27 | --- |
15 | hw/arm/bcm2836.c | 2 +- | 28 | hw/ssi/imx_spi.c | 2 +- |
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | 29 | 1 file changed, 1 insertion(+), 1 deletion(-) |
17 | 30 | ||
18 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | 31 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c |
19 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/bcm2836.c | 33 | --- a/hw/ssi/imx_spi.c |
21 | +++ b/hw/arm/bcm2836.c | 34 | +++ b/hw/ssi/imx_spi.c |
22 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data) | 35 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s) |
23 | 36 | ||
24 | static const TypeInfo bcm2836_type_info = { | 37 | DPRINTF("data tx:0x%08x\n", tx); |
25 | .name = TYPE_BCM2836, | 38 | |
26 | - .parent = TYPE_SYS_BUS_DEVICE, | 39 | - tx_burst = MIN(s->burst_length, 32); |
27 | + .parent = TYPE_DEVICE, | 40 | + tx_burst = (s->burst_length % 32) ? : 32; |
28 | .instance_size = sizeof(BCM2836State), | 41 | |
29 | .instance_init = bcm2836_init, | 42 | rx = 0; |
30 | .class_init = bcm2836_class_init, | 43 | |
31 | -- | 44 | -- |
32 | 2.16.2 | 45 | 2.20.1 |
33 | 46 | ||
34 | 47 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Bin Meng <bin.meng@windriver.com> | ||
1 | 2 | ||
3 | The endianness of data exchange between tx and rx fifo is incorrect. | ||
4 | Earlier bytes are supposed to show up on MSB and later bytes on LSB, | ||
5 | ie: in big endian. The manual does not explicitly say this, but the | ||
6 | U-Boot and Linux driver codes have a swap on the data transferred | ||
7 | to tx fifo and from rx fifo. | ||
8 | |||
9 | With this change, U-Boot read from / write to SPI flash tests pass. | ||
10 | |||
11 | => sf test 1ff000 1000 | ||
12 | SPI flash test: | ||
13 | 0 erase: 0 ticks, 4096000 KiB/s 32768.000 Mbps | ||
14 | 1 check: 3 ticks, 1333 KiB/s 10.664 Mbps | ||
15 | 2 write: 235 ticks, 17 KiB/s 0.136 Mbps | ||
16 | 3 read: 2 ticks, 2000 KiB/s 16.000 Mbps | ||
17 | Test passed | ||
18 | 0 erase: 0 ticks, 4096000 KiB/s 32768.000 Mbps | ||
19 | 1 check: 3 ticks, 1333 KiB/s 10.664 Mbps | ||
20 | 2 write: 235 ticks, 17 KiB/s 0.136 Mbps | ||
21 | 3 read: 2 ticks, 2000 KiB/s 16.000 Mbps | ||
22 | |||
23 | Fixes: c906a3a01582 ("i.MX: Add the Freescale SPI Controller") | ||
24 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | ||
25 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
26 | Message-id: 20210129132323.30946-11-bmeng.cn@gmail.com | ||
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
28 | --- | ||
29 | hw/ssi/imx_spi.c | 7 ++----- | ||
30 | 1 file changed, 2 insertions(+), 5 deletions(-) | ||
31 | |||
32 | diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/hw/ssi/imx_spi.c | ||
35 | +++ b/hw/ssi/imx_spi.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s) | ||
37 | |||
38 | while (!fifo32_is_empty(&s->tx_fifo)) { | ||
39 | int tx_burst = 0; | ||
40 | - int index = 0; | ||
41 | |||
42 | if (s->burst_length <= 0) { | ||
43 | s->burst_length = imx_spi_burst_length(s); | ||
44 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s) | ||
45 | rx = 0; | ||
46 | |||
47 | while (tx_burst > 0) { | ||
48 | - uint8_t byte = tx & 0xff; | ||
49 | + uint8_t byte = tx >> (tx_burst - 8); | ||
50 | |||
51 | DPRINTF("writing 0x%02x\n", (uint32_t)byte); | ||
52 | |||
53 | @@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s) | ||
54 | |||
55 | DPRINTF("0x%02x read\n", (uint32_t)byte); | ||
56 | |||
57 | - tx = tx >> 8; | ||
58 | - rx |= (byte << (index * 8)); | ||
59 | + rx = (rx << 8) | byte; | ||
60 | |||
61 | /* Remove 8 bits from the actual burst */ | ||
62 | tx_burst -= 8; | ||
63 | s->burst_length -= 8; | ||
64 | - index++; | ||
65 | } | ||
66 | |||
67 | DPRINTF("data rx:0x%08x\n", rx); | ||
68 | -- | ||
69 | 2.20.1 | ||
70 | |||
71 | diff view generated by jsdifflib |
1 | From: Andrey Smirnov <andrew.smirnov@gmail.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Add support for "TX complete"/TXDC interrupt generate by real HW since | 3 | Per the ARM Generic Interrupt Controller Architecture specification |
4 | it is needed to support guests other than Linux. | 4 | (document "ARM IHI 0048B.b (ID072613)"), the SGIINTID field is 4 bit, |
5 | not 10: | ||
5 | 6 | ||
6 | Based on the patch by Bill Paul as found here: | 7 | - 4.3 Distributor register descriptions |
7 | https://bugs.launchpad.net/qemu/+bug/1753314 | 8 | - 4.3.15 Software Generated Interrupt Register, GICD_SG |
8 | 9 | ||
9 | Cc: qemu-devel@nongnu.org | 10 | - Table 4-21 GICD_SGIR bit assignments |
10 | Cc: qemu-arm@nongnu.org | 11 | |
11 | Cc: Bill Paul <wpaul@windriver.com> | 12 | The Interrupt ID of the SGI to forward to the specified CPU |
12 | Cc: Peter Maydell <peter.maydell@linaro.org> | 13 | interfaces. The value of this field is the Interrupt ID, in |
13 | Signed-off-by: Bill Paul <wpaul@windriver.com> | 14 | the range 0-15, for example a value of 0b0011 specifies |
14 | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> | 15 | Interrupt ID 3. |
15 | Message-id: 20180315191141.6789-2-andrew.smirnov@gmail.com | 16 | |
17 | Correct the irq mask to fix an undefined behavior (which eventually | ||
18 | lead to a heap-buffer-overflow, see [Buglink]): | ||
19 | |||
20 | $ echo 'writel 0x8000f00 0xff4affb0' | qemu-system-aarch64 -M virt,accel=qtest -qtest stdio | ||
21 | [I 1612088147.116987] OPENED | ||
22 | [R +0.278293] writel 0x8000f00 0xff4affb0 | ||
23 | ../hw/intc/arm_gic.c:1498:13: runtime error: index 944 out of bounds for type 'uint8_t [16][8]' | ||
24 | SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../hw/intc/arm_gic.c:1498:13 | ||
25 | |||
26 | This fixes a security issue when running with KVM on Arm with | ||
27 | kernel-irqchip=off. (The default is kernel-irqchip=on, which is | ||
28 | unaffected, and which is also the correct choice for performance.) | ||
29 | |||
30 | Cc: qemu-stable@nongnu.org | ||
31 | Fixes: 9ee6e8bb853 ("ARMv7 support.") | ||
32 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913916 | ||
33 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913917 | ||
34 | Reported-by: Alexander Bulekov <alxndr@bu.edu> | ||
35 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
36 | Message-id: 20210131103401.217160-1-f4bug@amsat.org | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 37 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 38 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 39 | --- |
19 | include/hw/char/imx_serial.h | 3 +++ | 40 | hw/intc/arm_gic.c | 2 +- |
20 | hw/char/imx_serial.c | 20 +++++++++++++++++--- | 41 | 1 file changed, 1 insertion(+), 1 deletion(-) |
21 | 2 files changed, 20 insertions(+), 3 deletions(-) | ||
22 | 42 | ||
23 | diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h | 43 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c |
24 | index XXXXXXX..XXXXXXX 100644 | 44 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/include/hw/char/imx_serial.h | 45 | --- a/hw/intc/arm_gic.c |
26 | +++ b/include/hw/char/imx_serial.h | 46 | +++ b/hw/intc/arm_gic.c |
27 | @@ -XXX,XX +XXX,XX @@ | 47 | @@ -XXX,XX +XXX,XX @@ static void gic_dist_writel(void *opaque, hwaddr offset, |
28 | #define UCR2_RXEN (1<<1) /* Receiver enable */ | 48 | int target_cpu; |
29 | #define UCR2_SRST (1<<0) /* Reset complete */ | 49 | |
30 | 50 | cpu = gic_get_current_cpu(s); | |
31 | +#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */ | 51 | - irq = value & 0x3ff; |
32 | + | 52 | + irq = value & 0xf; |
33 | #define UTS1_TXEMPTY (1<<6) | 53 | switch ((value >> 24) & 3) { |
34 | #define UTS1_RXEMPTY (1<<5) | 54 | case 0: |
35 | #define UTS1_TXFULL (1<<4) | 55 | mask = (value >> 16) & ALL_CPU_MASK; |
36 | @@ -XXX,XX +XXX,XX @@ typedef struct IMXSerialState { | ||
37 | uint32_t ubmr; | ||
38 | uint32_t ubrc; | ||
39 | uint32_t ucr3; | ||
40 | + uint32_t ucr4; | ||
41 | |||
42 | qemu_irq irq; | ||
43 | CharBackend chr; | ||
44 | diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/hw/char/imx_serial.c | ||
47 | +++ b/hw/char/imx_serial.c | ||
48 | @@ -XXX,XX +XXX,XX @@ | ||
49 | |||
50 | static const VMStateDescription vmstate_imx_serial = { | ||
51 | .name = TYPE_IMX_SERIAL, | ||
52 | - .version_id = 1, | ||
53 | - .minimum_version_id = 1, | ||
54 | + .version_id = 2, | ||
55 | + .minimum_version_id = 2, | ||
56 | .fields = (VMStateField[]) { | ||
57 | VMSTATE_INT32(readbuff, IMXSerialState), | ||
58 | VMSTATE_UINT32(usr1, IMXSerialState), | ||
59 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_serial = { | ||
60 | VMSTATE_UINT32(ubmr, IMXSerialState), | ||
61 | VMSTATE_UINT32(ubrc, IMXSerialState), | ||
62 | VMSTATE_UINT32(ucr3, IMXSerialState), | ||
63 | + VMSTATE_UINT32(ucr4, IMXSerialState), | ||
64 | VMSTATE_END_OF_LIST() | ||
65 | }, | ||
66 | }; | ||
67 | @@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s) | ||
68 | * unfortunately. | ||
69 | */ | ||
70 | mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0; | ||
71 | + /* | ||
72 | + * TCEN and TXDC are both bit 3 | ||
73 | + */ | ||
74 | + mask |= s->ucr4 & UCR4_TCEN; | ||
75 | + | ||
76 | usr2 = s->usr2 & mask; | ||
77 | |||
78 | qemu_set_irq(s->irq, usr1 || usr2); | ||
79 | @@ -XXX,XX +XXX,XX @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset, | ||
80 | return s->ucr3; | ||
81 | |||
82 | case 0x23: /* UCR4 */ | ||
83 | + return s->ucr4; | ||
84 | + | ||
85 | case 0x29: /* BRM Incremental */ | ||
86 | return 0x0; /* TODO */ | ||
87 | |||
88 | @@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset, | ||
89 | * qemu_chr_fe_write and background I/O callbacks */ | ||
90 | qemu_chr_fe_write_all(&s->chr, &ch, 1); | ||
91 | s->usr1 &= ~USR1_TRDY; | ||
92 | + s->usr2 &= ~USR2_TXDC; | ||
93 | imx_update(s); | ||
94 | s->usr1 |= USR1_TRDY; | ||
95 | + s->usr2 |= USR2_TXDC; | ||
96 | imx_update(s); | ||
97 | } | ||
98 | break; | ||
99 | @@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset, | ||
100 | s->ucr3 = value & 0xffff; | ||
101 | break; | ||
102 | |||
103 | - case 0x2d: /* UTS1 */ | ||
104 | case 0x23: /* UCR4 */ | ||
105 | + s->ucr4 = value & 0xffff; | ||
106 | + imx_update(s); | ||
107 | + break; | ||
108 | + | ||
109 | + case 0x2d: /* UTS1 */ | ||
110 | qemu_log_mask(LOG_UNIMP, "[%s]%s: Unimplemented reg 0x%" | ||
111 | HWADDR_PRIx "\n", TYPE_IMX_SERIAL, __func__, offset); | ||
112 | /* TODO */ | ||
113 | -- | 56 | -- |
114 | 2.16.2 | 57 | 2.20.1 |
115 | 58 | ||
116 | 59 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
1 | 2 | ||
3 | The STM32F405 SoC uses an OR gate on its ADC IRQs. | ||
4 | |||
5 | Fixes: 529fc5fd3e1 ("hw/arm: Add the STM32F4xx SoC") | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20210131184449.382425-2-f4bug@amsat.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/Kconfig | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/Kconfig | ||
17 | +++ b/hw/arm/Kconfig | ||
18 | @@ -XXX,XX +XXX,XX @@ config STM32F205_SOC | ||
19 | config STM32F405_SOC | ||
20 | bool | ||
21 | select ARM_V7M | ||
22 | + select OR_IRQ | ||
23 | select STM32F4XX_SYSCFG | ||
24 | select STM32F4XX_EXTI | ||
25 | |||
26 | -- | ||
27 | 2.20.1 | ||
28 | |||
29 | diff view generated by jsdifflib |
1 | From: Guenter Roeck <linux@roeck-us.net> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | The sabrelite machine model used by qemu-system-arm is based on the | 3 | The Exynos4210 SoC uses an OR gate on the PL330 IRQ lines. |
4 | Freescale/NXP i.MX6Q processor. This SoC has an on-board ethernet | ||
5 | controller which is supported in QEMU using the imx_fec.c module | ||
6 | (actually called imx.enet for this model.) | ||
7 | 4 | ||
8 | The include/hw/arm/fsm-imx6.h file defines the interrupt vectors for the | 5 | Fixes: dab15fbe2ab ("hw/arm/exynos4210: Fix DMA initialization") |
9 | imx.enet device like this: | 6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | 7 | Message-id: 20210131184449.382425-3-f4bug@amsat.org | |
11 | #define FSL_IMX6_ENET_MAC_1588_IRQ 118 | ||
12 | #define FSL_IMX6_ENET_MAC_IRQ 119 | ||
13 | |||
14 | According to https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf, | ||
15 | page 225, in Table 3-1. ARM Cortex A9 domain interrupt summary, | ||
16 | interrupts are as follows. | ||
17 | |||
18 | 150 ENET MAC 0 IRQ | ||
19 | 151 ENET MAC 0 1588 Timer interrupt | ||
20 | |||
21 | where | ||
22 | |||
23 | 150 - 32 == 118 | ||
24 | 151 - 32 == 119 | ||
25 | |||
26 | In other words, the vector definitions in the fsl-imx6.h file are reversed. | ||
27 | |||
28 | Fixing the interrupts alone causes problems with older Linux kernels: | ||
29 | The Ethernet interface will fail to probe with Linux v4.9 and earlier. | ||
30 | Linux v4.1 and earlier will crash due to a bug in Ethernet driver probe | ||
31 | error handling. This is a Linux kernel problem, not a qemu problem: | ||
32 | the Linux kernel only worked by accident since it requested both interrupts. | ||
33 | |||
34 | For backward compatibility, generate the Ethernet interrupt on both interrupt | ||
35 | lines. This was shown to work from all Linux kernel releases starting with | ||
36 | v3.16. | ||
37 | |||
38 | Link: https://bugs.launchpad.net/qemu/+bug/1753309 | ||
39 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
40 | Message-id: 1520723090-22130-1-git-send-email-linux@roeck-us.net | ||
41 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
42 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
43 | --- | 10 | --- |
44 | include/hw/arm/fsl-imx6.h | 4 ++-- | 11 | hw/arm/Kconfig | 1 + |
45 | hw/net/imx_fec.c | 28 +++++++++++++++++++++++++++- | 12 | 1 file changed, 1 insertion(+) |
46 | 2 files changed, 29 insertions(+), 3 deletions(-) | ||
47 | 13 | ||
48 | diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h | 14 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
49 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
50 | --- a/include/hw/arm/fsl-imx6.h | 16 | --- a/hw/arm/Kconfig |
51 | +++ b/include/hw/arm/fsl-imx6.h | 17 | +++ b/hw/arm/Kconfig |
52 | @@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State { | 18 | @@ -XXX,XX +XXX,XX @@ config EXYNOS4 |
53 | #define FSL_IMX6_HDMI_MASTER_IRQ 115 | 19 | select PTIMER |
54 | #define FSL_IMX6_HDMI_CEC_IRQ 116 | 20 | select SDHCI |
55 | #define FSL_IMX6_MLB150_LOW_IRQ 117 | 21 | select USB_EHCI_SYSBUS |
56 | -#define FSL_IMX6_ENET_MAC_1588_IRQ 118 | 22 | + select OR_IRQ |
57 | -#define FSL_IMX6_ENET_MAC_IRQ 119 | 23 | |
58 | +#define FSL_IMX6_ENET_MAC_IRQ 118 | 24 | config HIGHBANK |
59 | +#define FSL_IMX6_ENET_MAC_1588_IRQ 119 | 25 | bool |
60 | #define FSL_IMX6_PCIE1_IRQ 120 | ||
61 | #define FSL_IMX6_PCIE2_IRQ 121 | ||
62 | #define FSL_IMX6_PCIE3_IRQ 122 | ||
63 | diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/hw/net/imx_fec.c | ||
66 | +++ b/hw/net/imx_fec.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static void imx_enet_write_bd(IMXENETBufDesc *bd, dma_addr_t addr) | ||
68 | |||
69 | static void imx_eth_update(IMXFECState *s) | ||
70 | { | ||
71 | - if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] & ENET_INT_TS_TIMER) { | ||
72 | + /* | ||
73 | + * Previous versions of qemu had the ENET_INT_MAC and ENET_INT_TS_TIMER | ||
74 | + * interrupts swapped. This worked with older versions of Linux (4.14 | ||
75 | + * and older) since Linux associated both interrupt lines with Ethernet | ||
76 | + * MAC interrupts. Specifically, | ||
77 | + * - Linux 4.15 and later have separate interrupt handlers for the MAC and | ||
78 | + * timer interrupts. Those versions of Linux fail with versions of QEMU | ||
79 | + * with swapped interrupt assignments. | ||
80 | + * - In linux 4.14, both interrupt lines were registered with the Ethernet | ||
81 | + * MAC interrupt handler. As a result, all versions of qemu happen to | ||
82 | + * work, though that is accidental. | ||
83 | + * - In Linux 4.9 and older, the timer interrupt was registered directly | ||
84 | + * with the Ethernet MAC interrupt handler. The MAC interrupt was | ||
85 | + * redirected to a GPIO interrupt to work around erratum ERR006687. | ||
86 | + * This was implemented using the SOC's IOMUX block. In qemu, this GPIO | ||
87 | + * interrupt never fired since IOMUX is currently not supported in qemu. | ||
88 | + * Linux instead received MAC interrupts on the timer interrupt. | ||
89 | + * As a result, qemu versions with the swapped interrupt assignment work, | ||
90 | + * albeit accidentally, but qemu versions with the correct interrupt | ||
91 | + * assignment fail. | ||
92 | + * | ||
93 | + * To ensure that all versions of Linux work, generate ENET_INT_MAC | ||
94 | + * interrrupts on both interrupt lines. This should be changed if and when | ||
95 | + * qemu supports IOMUX. | ||
96 | + */ | ||
97 | + if (s->regs[ENET_EIR] & s->regs[ENET_EIMR] & | ||
98 | + (ENET_INT_MAC | ENET_INT_TS_TIMER)) { | ||
99 | qemu_set_irq(s->irq[1], 1); | ||
100 | } else { | ||
101 | qemu_set_irq(s->irq[1], 0); | ||
102 | -- | 26 | -- |
103 | 2.16.2 | 27 | 2.20.1 |
104 | 28 | ||
105 | 29 | diff view generated by jsdifflib |
1 | If we're directly booting a Linux kernel and the CPU supports both | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | EL3 and EL2, we start the kernel in EL2, as it expects. We must also | ||
3 | set the SCR_EL3.HCE bit in this situation, so that the HVC | ||
4 | instruction is enabled rather than UNDEFing. Otherwise at least some | ||
5 | kernels will panic when trying to initialize KVM in the guest. | ||
6 | 2 | ||
3 | The Versal SoC instantiates the TYPE_XLNX_ZDMA object in | ||
4 | versal_create_admas(). Introduce the XLNX_ZDMA configuration | ||
5 | and select it to fix: | ||
6 | |||
7 | $ qemu-system-aarch64 -M xlnx-versal-virt ... | ||
8 | qemu-system-aarch64: missing object type 'xlnx.zdma' | ||
9 | |||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
12 | Message-id: 20210131184449.382425-4-f4bug@amsat.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Message-id: 20180313153458.26822-4-peter.maydell@linaro.org | ||
9 | --- | 14 | --- |
10 | hw/arm/boot.c | 5 +++++ | 15 | hw/arm/Kconfig | 2 ++ |
11 | 1 file changed, 5 insertions(+) | 16 | hw/dma/Kconfig | 3 +++ |
17 | hw/dma/meson.build | 2 +- | ||
18 | 3 files changed, 6 insertions(+), 1 deletion(-) | ||
12 | 19 | ||
13 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 20 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
14 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/boot.c | 22 | --- a/hw/arm/Kconfig |
16 | +++ b/hw/arm/boot.c | 23 | +++ b/hw/arm/Kconfig |
17 | @@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque) | 24 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM |
18 | assert(!info->secure_board_setup); | 25 | select XILINX_AXI |
19 | } | 26 | select XILINX_SPIPS |
20 | 27 | select XLNX_ZYNQMP | |
21 | + if (arm_feature(env, ARM_FEATURE_EL2)) { | 28 | + select XLNX_ZDMA |
22 | + /* If we have EL2 then Linux expects the HVC insn to work */ | 29 | |
23 | + env->cp15.scr_el3 |= SCR_HCE; | 30 | config XLNX_VERSAL |
24 | + } | 31 | bool |
32 | @@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL | ||
33 | select CADENCE | ||
34 | select VIRTIO_MMIO | ||
35 | select UNIMP | ||
36 | + select XLNX_ZDMA | ||
37 | |||
38 | config NPCM7XX | ||
39 | bool | ||
40 | diff --git a/hw/dma/Kconfig b/hw/dma/Kconfig | ||
41 | index XXXXXXX..XXXXXXX 100644 | ||
42 | --- a/hw/dma/Kconfig | ||
43 | +++ b/hw/dma/Kconfig | ||
44 | @@ -XXX,XX +XXX,XX @@ config ZYNQ_DEVCFG | ||
45 | bool | ||
46 | select REGISTER | ||
47 | |||
48 | +config XLNX_ZDMA | ||
49 | + bool | ||
25 | + | 50 | + |
26 | /* Set to non-secure if not a secure boot */ | 51 | config STP2000 |
27 | if (!info->secure_boot && | 52 | bool |
28 | (cs != first_cpu || !info->secure_board_setup)) { | 53 | |
54 | diff --git a/hw/dma/meson.build b/hw/dma/meson.build | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/hw/dma/meson.build | ||
57 | +++ b/hw/dma/meson.build | ||
58 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ZYNQ_DEVCFG', if_true: files('xlnx-zynq-devcfg.c')) | ||
59 | softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_dma.c')) | ||
60 | softmmu_ss.add(when: 'CONFIG_STP2000', if_true: files('sparc32_dma.c')) | ||
61 | softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx_dpdma.c')) | ||
62 | -softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zdma.c')) | ||
63 | +softmmu_ss.add(when: 'CONFIG_XLNX_ZDMA', if_true: files('xlnx-zdma.c')) | ||
64 | softmmu_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_dma.c', 'soc_dma.c')) | ||
65 | softmmu_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_dma.c')) | ||
66 | softmmu_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_dma.c')) | ||
29 | -- | 67 | -- |
30 | 2.16.2 | 68 | 2.20.1 |
31 | 69 | ||
32 | 70 | diff view generated by jsdifflib |
1 | Add some assertions that if we're about to boot an AArch64 kernel, | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | the board code has not mistakenly set either secure_boot or | ||
3 | secure_board_setup. It doesn't make sense to set secure_boot, | ||
4 | because all AArch64 kernels must be booted in non-secure mode. | ||
5 | 2 | ||
6 | It might in theory make sense to set secure_board_setup, but | 3 | The Versal SoC instantiates the TYPE_XLNX_ZYNQMP_RTC object in |
7 | we don't currently support that, because only the AArch32 | 4 | versal_create_rtc()(). Select CONFIG_XLNX_ZYNQMP to fix: |
8 | bootloader[] code calls this hook; bootloader_aarch64[] does not. | ||
9 | Since we don't have a current need for this functionality, just | ||
10 | assert that we don't try to use it. If it's needed we'll add | ||
11 | it later. | ||
12 | 5 | ||
6 | $ make check-qtest-aarch64 | ||
7 | ... | ||
8 | Running test qtest-aarch64/qom-test | ||
9 | qemu-system-aarch64: missing object type 'xlnx-zynmp.rtc' | ||
10 | Broken pipe | ||
11 | |||
12 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Message-id: 20210131184449.382425-5-f4bug@amsat.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20180313153458.26822-3-peter.maydell@linaro.org | ||
16 | --- | 16 | --- |
17 | hw/arm/boot.c | 7 +++++++ | 17 | hw/arm/Kconfig | 1 + |
18 | 1 file changed, 7 insertions(+) | 18 | 1 file changed, 1 insertion(+) |
19 | 19 | ||
20 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | 20 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
21 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/boot.c | 22 | --- a/hw/arm/Kconfig |
23 | +++ b/hw/arm/boot.c | 23 | +++ b/hw/arm/Kconfig |
24 | @@ -XXX,XX +XXX,XX @@ static void do_cpu_reset(void *opaque) | 24 | @@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL |
25 | } else { | 25 | select VIRTIO_MMIO |
26 | env->pstate = PSTATE_MODE_EL1h; | 26 | select UNIMP |
27 | } | 27 | select XLNX_ZDMA |
28 | + /* AArch64 kernels never boot in secure mode */ | 28 | + select XLNX_ZYNQMP |
29 | + assert(!info->secure_boot); | 29 | |
30 | + /* This hook is only supported for AArch32 currently: | 30 | config NPCM7XX |
31 | + * bootloader_aarch64[] will not call the hook, and | 31 | bool |
32 | + * the code above has already dropped us into EL2 or EL1. | ||
33 | + */ | ||
34 | + assert(!info->secure_board_setup); | ||
35 | } | ||
36 | |||
37 | /* Set to non-secure if not a secure boot */ | ||
38 | -- | 32 | -- |
39 | 2.16.2 | 33 | 2.20.1 |
40 | 34 | ||
41 | 35 | diff view generated by jsdifflib |
1 | For the rpi1 and 2 we want to boot the Linux kernel via some | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | custom setup code that makes sure that the SMC instruction | ||
3 | acts as a no-op, because it's used for cache maintenance. | ||
4 | The rpi3 boots AArch64 kernels, which don't need SMC for | ||
5 | cache maintenance and always expect to be booted non-secure. | ||
6 | Don't fill in the aarch32-specific parts of the binfo struct. | ||
7 | 2 | ||
3 | Add a dependency XLNX_ZYNQMP -> PTIMER to fix: | ||
4 | |||
5 | /usr/bin/ld: | ||
6 | libcommon.fa.p/hw_net_can_xlnx-zynqmp-can.c.o: in function `xlnx_zynqmp_can_realize': | ||
7 | hw/net/can/xlnx-zynqmp-can.c:1082: undefined reference to `ptimer_init' | ||
8 | hw/net/can/xlnx-zynqmp-can.c:1085: undefined reference to `ptimer_transaction_begin' | ||
9 | hw/net/can/xlnx-zynqmp-can.c:1087: undefined reference to `ptimer_set_freq' | ||
10 | hw/net/can/xlnx-zynqmp-can.c:1088: undefined reference to `ptimer_set_limit' | ||
11 | hw/net/can/xlnx-zynqmp-can.c:1089: undefined reference to `ptimer_run' | ||
12 | hw/net/can/xlnx-zynqmp-can.c:1090: undefined reference to `ptimer_transaction_commit' | ||
13 | libcommon.fa.p/hw_net_can_xlnx-zynqmp-can.c.o:(.data.rel+0x2c8): undefined reference to `vmstate_ptimer' | ||
14 | |||
15 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
17 | Message-id: 20210131184449.382425-6-f4bug@amsat.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 20180313153458.26822-2-peter.maydell@linaro.org | ||
12 | --- | 19 | --- |
13 | hw/arm/raspi.c | 17 +++++++++++++---- | 20 | hw/Kconfig | 1 + |
14 | 1 file changed, 13 insertions(+), 4 deletions(-) | 21 | 1 file changed, 1 insertion(+) |
15 | 22 | ||
16 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 23 | diff --git a/hw/Kconfig b/hw/Kconfig |
17 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/raspi.c | 25 | --- a/hw/Kconfig |
19 | +++ b/hw/arm/raspi.c | 26 | +++ b/hw/Kconfig |
20 | @@ -XXX,XX +XXX,XX @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) | 27 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP |
21 | binfo.board_id = raspi_boardid[version]; | 28 | bool |
22 | binfo.ram_size = ram_size; | 29 | select REGISTER |
23 | binfo.nb_cpus = smp_cpus; | 30 | select CAN_BUS |
24 | - binfo.board_setup_addr = BOARDSETUP_ADDR; | 31 | + select PTIMER |
25 | - binfo.write_board_setup = write_board_setup; | ||
26 | - binfo.secure_board_setup = true; | ||
27 | - binfo.secure_boot = true; | ||
28 | + | ||
29 | + if (version <= 2) { | ||
30 | + /* The rpi1 and 2 require some custom setup code to run in Secure | ||
31 | + * mode before booting a kernel (to set up the SMC vectors so | ||
32 | + * that we get a no-op SMC; this is used by Linux to call the | ||
33 | + * firmware for some cache maintenance operations. | ||
34 | + * The rpi3 doesn't need this. | ||
35 | + */ | ||
36 | + binfo.board_setup_addr = BOARDSETUP_ADDR; | ||
37 | + binfo.write_board_setup = write_board_setup; | ||
38 | + binfo.secure_board_setup = true; | ||
39 | + binfo.secure_boot = true; | ||
40 | + } | ||
41 | |||
42 | /* Pi2 and Pi3 requires SMP setup */ | ||
43 | if (version >= 2) { | ||
44 | -- | 32 | -- |
45 | 2.16.2 | 33 | 2.20.1 |
46 | 34 | ||
47 | 35 | diff view generated by jsdifflib |
1 | Our BCM2836 type is really a generic one that can be any of | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | the bcm283x family. Rename it accordingly. We change only | ||
3 | the names which are visible via the header file to the | ||
4 | rest of the QEMU code, leaving private function names | ||
5 | in bcm2836.c as they are. | ||
6 | 2 | ||
7 | This is a preliminary to making bcm283x be an abstract | 3 | Most of ARM machines display their CPU when QEMU list the available |
8 | parent class to specific types for the bcm2836 and bcm2837. | 4 | machines (-M help). Some machines do not. Fix to unify the help |
5 | output. | ||
9 | 6 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com> | ||
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-id: 20210131184449.382425-7-f4bug@amsat.org | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180313153458.26822-6-peter.maydell@linaro.org | ||
14 | --- | 13 | --- |
15 | include/hw/arm/bcm2836.h | 12 ++++++------ | 14 | hw/arm/digic_boards.c | 2 +- |
16 | hw/arm/bcm2836.c | 17 +++++++++-------- | 15 | hw/arm/microbit.c | 2 +- |
17 | hw/arm/raspi.c | 16 ++++++++-------- | 16 | hw/arm/netduino2.c | 2 +- |
18 | 3 files changed, 23 insertions(+), 22 deletions(-) | 17 | hw/arm/netduinoplus2.c | 2 +- |
18 | hw/arm/orangepi.c | 2 +- | ||
19 | hw/arm/stellaris.c | 4 ++-- | ||
20 | 6 files changed, 7 insertions(+), 7 deletions(-) | ||
19 | 21 | ||
20 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | 22 | diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c |
21 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/hw/arm/bcm2836.h | 24 | --- a/hw/arm/digic_boards.c |
23 | +++ b/include/hw/arm/bcm2836.h | 25 | +++ b/hw/arm/digic_boards.c |
24 | @@ -XXX,XX +XXX,XX @@ | 26 | @@ -XXX,XX +XXX,XX @@ static void canon_a1100_init(MachineState *machine) |
25 | #include "hw/arm/bcm2835_peripherals.h" | 27 | |
26 | #include "hw/intc/bcm2836_control.h" | 28 | static void canon_a1100_machine_init(MachineClass *mc) |
27 | 29 | { | |
28 | -#define TYPE_BCM2836 "bcm2836" | 30 | - mc->desc = "Canon PowerShot A1100 IS"; |
29 | -#define BCM2836(obj) OBJECT_CHECK(BCM2836State, (obj), TYPE_BCM2836) | 31 | + mc->desc = "Canon PowerShot A1100 IS (ARM946)"; |
30 | +#define TYPE_BCM283X "bcm283x" | 32 | mc->init = &canon_a1100_init; |
31 | +#define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X) | 33 | mc->ignore_memory_transaction_failures = true; |
32 | 34 | mc->default_ram_size = 64 * MiB; | |
33 | -#define BCM2836_NCPUS 4 | 35 | diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c |
34 | +#define BCM283X_NCPUS 4 | ||
35 | |||
36 | -typedef struct BCM2836State { | ||
37 | +typedef struct BCM283XState { | ||
38 | /*< private >*/ | ||
39 | DeviceState parent_obj; | ||
40 | /*< public >*/ | ||
41 | @@ -XXX,XX +XXX,XX @@ typedef struct BCM2836State { | ||
42 | char *cpu_type; | ||
43 | uint32_t enabled_cpus; | ||
44 | |||
45 | - ARMCPU cpus[BCM2836_NCPUS]; | ||
46 | + ARMCPU cpus[BCM283X_NCPUS]; | ||
47 | BCM2836ControlState control; | ||
48 | BCM2835PeripheralState peripherals; | ||
49 | -} BCM2836State; | ||
50 | +} BCM283XState; | ||
51 | |||
52 | #endif /* BCM2836_H */ | ||
53 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/hw/arm/bcm2836.c | 37 | --- a/hw/arm/microbit.c |
56 | +++ b/hw/arm/bcm2836.c | 38 | +++ b/hw/arm/microbit.c |
57 | @@ -XXX,XX +XXX,XX @@ | 39 | @@ -XXX,XX +XXX,XX @@ static void microbit_machine_class_init(ObjectClass *oc, void *data) |
58 | |||
59 | static void bcm2836_init(Object *obj) | ||
60 | { | 40 | { |
61 | - BCM2836State *s = BCM2836(obj); | 41 | MachineClass *mc = MACHINE_CLASS(oc); |
62 | + BCM283XState *s = BCM283X(obj); | 42 | |
63 | 43 | - mc->desc = "BBC micro:bit"; | |
64 | object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTROL); | 44 | + mc->desc = "BBC micro:bit (Cortex-M0)"; |
65 | object_property_add_child(obj, "control", OBJECT(&s->control), NULL); | 45 | mc->init = microbit_init; |
66 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_init(Object *obj) | 46 | mc->max_cpus = 1; |
67 | 47 | } | |
68 | static void bcm2836_realize(DeviceState *dev, Error **errp) | 48 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c |
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/netduino2.c | ||
51 | +++ b/hw/arm/netduino2.c | ||
52 | @@ -XXX,XX +XXX,XX @@ static void netduino2_init(MachineState *machine) | ||
53 | |||
54 | static void netduino2_machine_init(MachineClass *mc) | ||
69 | { | 55 | { |
70 | - BCM2836State *s = BCM2836(dev); | 56 | - mc->desc = "Netduino 2 Machine"; |
71 | + BCM283XState *s = BCM283X(dev); | 57 | + mc->desc = "Netduino 2 Machine (Cortex-M3)"; |
72 | Object *obj; | 58 | mc->init = netduino2_init; |
73 | Error *err = NULL; | 59 | mc->ignore_memory_transaction_failures = true; |
74 | int n; | ||
75 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp) | ||
76 | /* common peripherals from bcm2835 */ | ||
77 | |||
78 | obj = OBJECT(dev); | ||
79 | - for (n = 0; n < BCM2836_NCPUS; n++) { | ||
80 | + for (n = 0; n < BCM283X_NCPUS; n++) { | ||
81 | object_initialize(&s->cpus[n], sizeof(s->cpus[n]), | ||
82 | s->cpu_type); | ||
83 | object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]), | ||
84 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp) | ||
85 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, | ||
86 | qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0)); | ||
87 | |||
88 | - for (n = 0; n < BCM2836_NCPUS; n++) { | ||
89 | + for (n = 0; n < BCM283X_NCPUS; n++) { | ||
90 | /* Mirror bcm2836, which has clusterid set to 0xf | ||
91 | * TODO: this should be converted to a property of ARM_CPU | ||
92 | */ | ||
93 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_realize(DeviceState *dev, Error **errp) | ||
94 | } | 60 | } |
95 | 61 | diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c | |
96 | static Property bcm2836_props[] = { | 62 | index XXXXXXX..XXXXXXX 100644 |
97 | - DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type), | 63 | --- a/hw/arm/netduinoplus2.c |
98 | - DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836_NCPUS), | 64 | +++ b/hw/arm/netduinoplus2.c |
99 | + DEFINE_PROP_STRING("cpu-type", BCM283XState, cpu_type), | 65 | @@ -XXX,XX +XXX,XX @@ static void netduinoplus2_init(MachineState *machine) |
100 | + DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus, | 66 | |
101 | + BCM283X_NCPUS), | 67 | static void netduinoplus2_machine_init(MachineClass *mc) |
102 | DEFINE_PROP_END_OF_LIST() | 68 | { |
103 | }; | 69 | - mc->desc = "Netduino Plus 2 Machine"; |
104 | 70 | + mc->desc = "Netduino Plus 2 Machine (Cortex-M4)"; | |
105 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_class_init(ObjectClass *oc, void *data) | 71 | mc->init = netduinoplus2_init; |
106 | } | 72 | } |
107 | 73 | ||
108 | static const TypeInfo bcm2836_type_info = { | 74 | diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c |
109 | - .name = TYPE_BCM2836, | ||
110 | + .name = TYPE_BCM283X, | ||
111 | .parent = TYPE_DEVICE, | ||
112 | - .instance_size = sizeof(BCM2836State), | ||
113 | + .instance_size = sizeof(BCM283XState), | ||
114 | .instance_init = bcm2836_init, | ||
115 | .class_init = bcm2836_class_init, | ||
116 | }; | ||
117 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
118 | index XXXXXXX..XXXXXXX 100644 | 75 | index XXXXXXX..XXXXXXX 100644 |
119 | --- a/hw/arm/raspi.c | 76 | --- a/hw/arm/orangepi.c |
120 | +++ b/hw/arm/raspi.c | 77 | +++ b/hw/arm/orangepi.c |
121 | @@ -XXX,XX +XXX,XX @@ | 78 | @@ -XXX,XX +XXX,XX @@ static void orangepi_init(MachineState *machine) |
122 | static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44}; | 79 | |
123 | 80 | static void orangepi_machine_init(MachineClass *mc) | |
124 | typedef struct RasPiState { | 81 | { |
125 | - BCM2836State soc; | 82 | - mc->desc = "Orange Pi PC"; |
126 | + BCM283XState soc; | 83 | + mc->desc = "Orange Pi PC (Cortex-A7)"; |
127 | MemoryRegion ram; | 84 | mc->init = orangepi_init; |
128 | } RasPiState; | 85 | mc->block_default_type = IF_SD; |
129 | 86 | mc->units_per_default_bus = 1; | |
130 | @@ -XXX,XX +XXX,XX @@ static void raspi_init(MachineState *machine, int version) | 87 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
131 | BusState *bus; | 88 | index XXXXXXX..XXXXXXX 100644 |
132 | DeviceState *carddev; | 89 | --- a/hw/arm/stellaris.c |
133 | 90 | +++ b/hw/arm/stellaris.c | |
134 | - object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM2836); | 91 | @@ -XXX,XX +XXX,XX @@ static void lm3s811evb_class_init(ObjectClass *oc, void *data) |
135 | + object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X); | 92 | { |
136 | object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc), | 93 | MachineClass *mc = MACHINE_CLASS(oc); |
137 | &error_abort); | 94 | |
138 | 95 | - mc->desc = "Stellaris LM3S811EVB"; | |
139 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc) | 96 | + mc->desc = "Stellaris LM3S811EVB (Cortex-M3)"; |
140 | mc->no_floppy = 1; | 97 | mc->init = lm3s811evb_init; |
141 | mc->no_cdrom = 1; | ||
142 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); | ||
143 | - mc->max_cpus = BCM2836_NCPUS; | ||
144 | - mc->min_cpus = BCM2836_NCPUS; | ||
145 | - mc->default_cpus = BCM2836_NCPUS; | ||
146 | + mc->max_cpus = BCM283X_NCPUS; | ||
147 | + mc->min_cpus = BCM283X_NCPUS; | ||
148 | + mc->default_cpus = BCM283X_NCPUS; | ||
149 | mc->default_ram_size = 1024 * 1024 * 1024; | ||
150 | mc->ignore_memory_transaction_failures = true; | 98 | mc->ignore_memory_transaction_failures = true; |
151 | }; | 99 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3"); |
152 | @@ -XXX,XX +XXX,XX @@ static void raspi3_machine_init(MachineClass *mc) | 100 | @@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_class_init(ObjectClass *oc, void *data) |
153 | mc->no_floppy = 1; | 101 | { |
154 | mc->no_cdrom = 1; | 102 | MachineClass *mc = MACHINE_CLASS(oc); |
155 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); | 103 | |
156 | - mc->max_cpus = BCM2836_NCPUS; | 104 | - mc->desc = "Stellaris LM3S6965EVB"; |
157 | - mc->min_cpus = BCM2836_NCPUS; | 105 | + mc->desc = "Stellaris LM3S6965EVB (Cortex-M3)"; |
158 | - mc->default_cpus = BCM2836_NCPUS; | 106 | mc->init = lm3s6965evb_init; |
159 | + mc->max_cpus = BCM283X_NCPUS; | 107 | mc->ignore_memory_transaction_failures = true; |
160 | + mc->min_cpus = BCM283X_NCPUS; | 108 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3"); |
161 | + mc->default_cpus = BCM283X_NCPUS; | ||
162 | mc->default_ram_size = 1024 * 1024 * 1024; | ||
163 | } | ||
164 | DEFINE_MACHINE("raspi3", raspi3_machine_init) | ||
165 | -- | 109 | -- |
166 | 2.16.2 | 110 | 2.20.1 |
167 | 111 | ||
168 | 112 | diff view generated by jsdifflib |