1
Mostly just bug fixes. The important one here is
1
Hi; here's the first target-arm pullreq for the 8.1 cycle.
2
hw/intc/arm_gic: Fix interrupt ID in GICD_SGIR register
2
Nothing particularly huge in here, just the various things
3
which fixes a buffer overrun that's a security issue if you're running
3
that had accumulated during the freeze.
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).
7
4
5
thanks
8
-- PMM
6
-- PMM
9
7
10
The following changes since commit cf7ca7d5b9faca13f1f8e3ea92cfb2f741eb0c0e:
8
The following changes since commit 2d82c32b2ceaca3dc3da5e36e10976f34bfcb598:
11
9
12
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/tracing-pull-request' into staging (2021-02-01 16:28:00 +0000)
10
Open 8.1 development tree (2023-04-20 10:05:25 +0100)
13
11
14
are available in the Git repository at:
12
are available in the Git repository at:
15
13
16
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210202-1
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230420
17
15
18
for you to fetch changes up to 14657850c9cc10948551fbb884c30eb5a3a7370a:
16
for you to fetch changes up to 1ed1f338520cda0574b7e04f5e8e85e049740548:
19
17
20
hw/arm: Display CPU type in machine description (2021-02-02 17:53:44 +0000)
18
arm/mcimx7d-sabre: Set fec2-phy-connected property to false (2023-04-20 10:46:43 +0100)
21
19
22
----------------------------------------------------------------
20
----------------------------------------------------------------
23
target-arm queue:
21
target-arm queue:
24
* hw/intc/arm_gic: Allow to use QTest without crashing
22
* hw/arm: Fix some typos in comments (most found by codespell)
25
* hw/char/exynos4210_uart: Fix buffer size reporting with FIFO disabled
23
* exynos: Fix out-of-bounds access in exynos4210_gcomp_find debug printf
26
* hw/char/exynos4210_uart: Fix missing call to report ready for input
24
* Orangepi-PC, Cubieboard: add Allwinner WDT watchdog emulation
27
* hw/arm/smmuv3: Fix addr_mask for range-based invalidation
25
* tests/avocado: Add reboot tests to Cubieboard
28
* hw/ssi/imx_spi: Fix various minor bugs
26
* hw/timer/imx_epit: Fix bugs in timer limit checking
29
* hw/intc/arm_gic: Fix interrupt ID in GICD_SGIR register
27
* target/arm: Remove KVM AArch32 CPU definitions
30
* hw/arm: Add missing Kconfig dependencies
28
* hw/arm/virt: Restrict Cortex-A7 check to TCG
31
* hw/arm: Display CPU type in machine description
29
* target/arm: Initialize debug capabilities only once
30
* target/arm: Implement FEAT_PAN3
31
* docs/devel/kconfig.rst: Fix incorrect markup
32
* target/arm: Report pauth information to gdb as 'pauth_v2'
33
* mcimxd7-sabre, mcimx6ul-evk: Correctly model the way the PHY
34
on the second ethernet device must be configured via the
35
first one
32
36
33
----------------------------------------------------------------
37
----------------------------------------------------------------
34
Bin Meng (5):
38
Akihiko Odaki (1):
35
hw/ssi: imx_spi: Use a macro for number of chip selects supported
39
target/arm: Initialize debug capabilities only once
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
40
40
41
Iris Johnson (2):
41
Axel Heider (2):
42
hw/char/exynos4210_uart: Fix buffer size reporting with FIFO disabled
42
hw/timer/imx_epit: don't shadow variable
43
hw/char/exynos4210_uart: Fix missing call to report ready for input
43
hw/timer/imx_epit: fix limit check
44
44
45
Philippe Mathieu-Daudé (12):
45
Feng Jiang (1):
46
hw/intc/arm_gic: Allow to use QTest without crashing
46
exynos: Fix out-of-bounds access in exynos4210_gcomp_find debug printf
47
hw/ssi: imx_spi: Remove pointless variable initialization
48
hw/ssi: imx_spi: Rework imx_spi_reset() to keep CONREG register value
49
hw/ssi: imx_spi: Rework imx_spi_read() to handle block disabled
50
hw/ssi: imx_spi: Rework imx_spi_write() to handle block disabled
51
hw/intc/arm_gic: Fix interrupt ID in GICD_SGIR register
52
hw/arm/stm32f405_soc: Add missing dependency on OR_IRQ
53
hw/arm/exynos4210: Add missing dependency on OR_IRQ
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
58
47
59
Xuzhou Cheng (1):
48
Guenter Roeck (5):
60
hw/ssi: imx_spi: Disable chip selects when controller is disabled
49
hw/net/imx_fec: Support two Ethernet interfaces connected to single MDIO bus
50
fsl-imx6ul: Add fec[12]-phy-connected properties
51
arm/mcimx6ul-evk: Set fec1-phy-connected property to false
52
fsl-imx7: Add fec[12]-phy-connected properties
53
arm/mcimx7d-sabre: Set fec2-phy-connected property to false
61
54
62
Zenghui Yu (1):
55
Peter Maydell (5):
63
hw/arm/smmuv3: Fix addr_mask for range-based invalidation
56
target/arm: Pass ARMMMUFaultInfo to merge_syn_data_abort()
57
target/arm: Don't set ISV when reporting stage 1 faults in ESR_EL2
58
target/arm: Implement FEAT_PAN3
59
docs/devel/kconfig.rst: Fix incorrect markup
60
target/arm: Report pauth information to gdb as 'pauth_v2'
64
61
65
include/hw/ssi/imx_spi.h | 5 +-
62
Philippe Mathieu-Daudé (2):
66
hw/arm/digic_boards.c | 2 +-
63
target/arm: Remove KVM AArch32 CPU definitions
67
hw/arm/microbit.c | 2 +-
64
hw/arm/virt: Restrict Cortex-A7 check to TCG
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
65
66
Stefan Weil (1):
67
hw/arm: Fix some typos in comments (most found by codespell)
68
69
Strahinja Jankovic (4):
70
hw/watchdog: Allwinner WDT emulation for system reset
71
hw/arm: Add WDT to Allwinner-A10 and Cubieboard
72
hw/arm: Add WDT to Allwinner-H3 and Orangepi-PC
73
tests/avocado: Add reboot tests to Cubieboard
74
75
docs/devel/kconfig.rst | 2 +-
76
docs/system/arm/cubieboard.rst | 1 +
77
docs/system/arm/emulation.rst | 1 +
78
docs/system/arm/orangepi.rst | 1 +
79
include/hw/arm/allwinner-a10.h | 2 +
80
include/hw/arm/allwinner-h3.h | 5 +-
81
include/hw/arm/fsl-imx6ul.h | 1 +
82
include/hw/arm/fsl-imx7.h | 1 +
83
include/hw/net/imx_fec.h | 2 +
84
include/hw/watchdog/allwinner-wdt.h | 123 +++++++++++
85
target/arm/cpu.h | 5 +
86
target/arm/kvm-consts.h | 9 +-
87
target/arm/kvm_arm.h | 8 +
88
hw/arm/allwinner-a10.c | 7 +
89
hw/arm/allwinner-h3.c | 8 +
90
hw/arm/exynos4210.c | 4 +-
91
hw/arm/fsl-imx6ul.c | 20 ++
92
hw/arm/fsl-imx7.c | 20 ++
93
hw/arm/mcimx6ul-evk.c | 2 +
94
hw/arm/mcimx7d-sabre.c | 2 +
95
hw/arm/musicpal.c | 2 +-
96
hw/arm/omap1.c | 2 +-
97
hw/arm/omap2.c | 2 +-
98
hw/arm/virt-acpi-build.c | 2 +-
99
hw/arm/virt.c | 4 +-
100
hw/arm/xlnx-versal-virt.c | 2 +-
101
hw/net/imx_fec.c | 27 ++-
102
hw/timer/exynos4210_mct.c | 13 +-
103
hw/timer/imx_epit.c | 2 +-
104
hw/watchdog/allwinner-wdt.c | 416 ++++++++++++++++++++++++++++++++++++
105
target/arm/cpu64.c | 2 +-
106
target/arm/cpu_tcg.c | 2 -
107
target/arm/gdbstub.c | 9 +-
108
target/arm/kvm.c | 2 +
109
target/arm/kvm64.c | 18 +-
110
target/arm/ptw.c | 14 +-
111
target/arm/tcg/tlb_helper.c | 26 ++-
112
gdb-xml/aarch64-pauth.xml | 2 +-
113
hw/arm/Kconfig | 4 +-
114
hw/watchdog/Kconfig | 4 +
115
hw/watchdog/meson.build | 1 +
116
hw/watchdog/trace-events | 7 +
117
tests/avocado/boot_linux_console.py | 15 +-
118
43 files changed, 738 insertions(+), 64 deletions(-)
119
create mode 100644 include/hw/watchdog/allwinner-wdt.h
120
create mode 100644 hw/watchdog/allwinner-wdt.c
121
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Stefan Weil <sw@weilnetz.de>
2
2
3
The STM32F405 SoC uses an OR gate on its ADC IRQs.
3
Signed-off-by: Stefan Weil <sw@weilnetz.de>
4
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Fixes: 529fc5fd3e1 ("hw/arm: Add the STM32F4xx SoC")
5
Message-id: 20230409200526.1156456-1-sw@weilnetz.de
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>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
7
---
11
hw/arm/Kconfig | 1 +
8
hw/arm/exynos4210.c | 4 ++--
12
1 file changed, 1 insertion(+)
9
hw/arm/musicpal.c | 2 +-
10
hw/arm/omap1.c | 2 +-
11
hw/arm/omap2.c | 2 +-
12
hw/arm/virt-acpi-build.c | 2 +-
13
hw/arm/virt.c | 2 +-
14
hw/arm/xlnx-versal-virt.c | 2 +-
15
hw/arm/Kconfig | 2 +-
16
8 files changed, 9 insertions(+), 9 deletions(-)
13
17
18
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/exynos4210.c
21
+++ b/hw/arm/exynos4210.c
22
@@ -XXX,XX +XXX,XX @@ static int mapline_size(const int *mapline)
23
24
/*
25
* Initialize board IRQs.
26
- * These IRQs contain splitted Int/External Combiner and External Gic IRQs.
27
+ * These IRQs contain split Int/External Combiner and External Gic IRQs.
28
*/
29
static void exynos4210_init_board_irqs(Exynos4210State *s)
30
{
31
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
32
* - SDMA
33
* - ADMA2
34
*
35
- * As this part of the Exynos4210 is not publically available,
36
+ * As this part of the Exynos4210 is not publicly available,
37
* we used the "HS-MMC Controller S3C2416X RISC Microprocessor"
38
* public datasheet which is very similar (implementing
39
* MMC Specification Version 4.0 being the only difference noted)
40
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/arm/musicpal.c
43
+++ b/hw/arm/musicpal.c
44
@@ -XXX,XX +XXX,XX @@
45
#define MP_LCD_SPI_CMD 0x00104011
46
#define MP_LCD_SPI_INVALID 0x00000000
47
48
-/* Commmands */
49
+/* Commands */
50
#define MP_LCD_INST_SETPAGE0 0xB0
51
/* ... */
52
#define MP_LCD_INST_SETPAGE7 0xB7
53
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/arm/omap1.c
56
+++ b/hw/arm/omap1.c
57
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
58
s->led[1] = omap_lpg_init(system_memory,
59
0xfffbd800, omap_findclk(s, "clk32-kHz"));
60
61
- /* Register mappings not currenlty implemented:
62
+ /* Register mappings not currently implemented:
63
* MCSI2 Comm    fffb2000 - fffb27ff (not mapped on OMAP310)
64
* MCSI1 Bluetooth    fffb2800 - fffb2fff (not mapped on OMAP310)
65
* USB W2FC        fffb4000 - fffb47ff
66
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/hw/arm/omap2.c
69
+++ b/hw/arm/omap2.c
70
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
71
omap_findclk(s, "func_96m_clk"),
72
omap_findclk(s, "core_l4_iclk"));
73
74
- /* All register mappings (includin those not currenlty implemented):
75
+ /* All register mappings (including those not currently implemented):
76
* SystemControlMod    48000000 - 48000fff
77
* SystemControlL4    48001000 - 48001fff
78
* 32kHz Timer Mod    48004000 - 48004fff
79
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/hw/arm/virt-acpi-build.c
82
+++ b/hw/arm/virt-acpi-build.c
83
@@ -XXX,XX +XXX,XX @@ static void build_append_gicr(GArray *table_data, uint64_t base, uint32_t size)
84
build_append_int_noprefix(table_data, 0xE, 1); /* Type */
85
build_append_int_noprefix(table_data, 16, 1); /* Length */
86
build_append_int_noprefix(table_data, 0, 2); /* Reserved */
87
- /* Discovery Range Base Addres */
88
+ /* Discovery Range Base Address */
89
build_append_int_noprefix(table_data, base, 8);
90
build_append_int_noprefix(table_data, size, 4); /* Discovery Range Length */
91
}
92
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
93
index XXXXXXX..XXXXXXX 100644
94
--- a/hw/arm/virt.c
95
+++ b/hw/arm/virt.c
96
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
97
int pa_bits;
98
99
/*
100
- * Instanciate a temporary CPU object to find out about what
101
+ * Instantiate a temporary CPU object to find out about what
102
* we are about to deal with. Once this is done, get rid of
103
* the object.
104
*/
105
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/hw/arm/xlnx-versal-virt.c
108
+++ b/hw/arm/xlnx-versal-virt.c
109
@@ -XXX,XX +XXX,XX @@ static void versal_virt_init(MachineState *machine)
110
fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
111
112
/* Make the APU cpu address space visible to virtio and other
113
- * modules unaware of muliple address-spaces. */
114
+ * modules unaware of multiple address-spaces. */
115
memory_region_add_subregion_overlap(get_system_memory(),
116
0, &s->soc.fpd.apu.mr, 0);
117
14
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
118
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
15
index XXXXXXX..XXXXXXX 100644
119
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/Kconfig
120
--- a/hw/arm/Kconfig
17
+++ b/hw/arm/Kconfig
121
+++ b/hw/arm/Kconfig
18
@@ -XXX,XX +XXX,XX @@ config STM32F205_SOC
122
@@ -XXX,XX +XXX,XX @@ config OLIMEX_STM32_H405
19
config STM32F405_SOC
123
config NSERIES
20
bool
124
bool
21
select ARM_V7M
125
select OMAP
22
+ select OR_IRQ
126
- select TMP105 # tempature sensor
23
select STM32F4XX_SYSCFG
127
+ select TMP105 # temperature sensor
24
select STM32F4XX_EXTI
128
select BLIZZARD # LCD/TV controller
25
129
select ONENAND
130
select TSC210X # touchscreen/sensors/audio
26
--
131
--
27
2.20.1
132
2.34.1
28
133
29
134
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Feng Jiang <jiangfeng@kylinos.cn>
2
2
3
'burst_length' is cleared in imx_spi_reset(), which is called
3
One of the debug printfs in exynos4210_gcomp_find() will
4
after imx_spi_realize(). Remove the initialization to simplify.
4
access outside the 's->g_timer.reg.comp[]' array if there
5
was no active comparator and 'res' is -1. Add a conditional
6
to avoid this.
5
7
6
Reviewed-by: Juan Quintela <quintela@redhat.com>
8
This doesn't happen in normal use because the debug printfs
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
are by default not compiled in.
8
Reviewed-by: Bin Meng <bin.meng@windriver.com>
10
9
Signed-off-by: Bin Meng <bin.meng@windriver.com>
11
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
10
Message-id: 20210129132323.30946-4-bmeng.cn@gmail.com
12
Message-id: 20230404074506.112615-1-jiangfeng@kylinos.cn
11
Message-Id: <20210115153049.3353008-3-f4bug@amsat.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Bin Meng <bin.meng@windriver.com>
14
[PMM: Adjusted commit message to clarify that the overrun
13
Signed-off-by: Bin Meng <bin.meng@windriver.com>
15
only happens if you've enabled debug printfs]
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
17
---
16
hw/ssi/imx_spi.c | 2 --
18
hw/timer/exynos4210_mct.c | 13 ++++++++-----
17
1 file changed, 2 deletions(-)
19
1 file changed, 8 insertions(+), 5 deletions(-)
18
20
19
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
21
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
20
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/ssi/imx_spi.c
23
--- a/hw/timer/exynos4210_mct.c
22
+++ b/hw/ssi/imx_spi.c
24
+++ b/hw/timer/exynos4210_mct.c
23
@@ -XXX,XX +XXX,XX @@ static void imx_spi_realize(DeviceState *dev, Error **errp)
25
@@ -XXX,XX +XXX,XX @@ static int32_t exynos4210_gcomp_find(Exynos4210MCTState *s)
24
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->cs_lines[i]);
26
res = min_comp_i;
25
}
27
}
26
28
27
- s->burst_length = 0;
29
- DPRINTF("found comparator %d: comp 0x%llx distance 0x%llx, gfrc 0x%llx\n",
28
-
30
- res,
29
fifo32_create(&s->tx_fifo, ECSPI_FIFO_SIZE);
31
- s->g_timer.reg.comp[res],
30
fifo32_create(&s->rx_fifo, ECSPI_FIFO_SIZE);
32
- distance_min,
33
- gfrc);
34
+ if (res >= 0) {
35
+ DPRINTF("found comparator %d: "
36
+ "comp 0x%llx distance 0x%llx, gfrc 0x%llx\n",
37
+ res,
38
+ s->g_timer.reg.comp[res],
39
+ distance_min,
40
+ gfrc);
41
+ }
42
43
return res;
31
}
44
}
32
--
45
--
33
2.20.1
46
2.34.1
34
35
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Strahinja Jankovic <strahinjapjankovic@gmail.com>
2
2
3
Most of ARM machines display their CPU when QEMU list the available
3
This patch adds basic support for Allwinner WDT.
4
machines (-M help). Some machines do not. Fix to unify the help
4
Both sun4i and sun6i variants are supported.
5
output.
5
However, interrupt generation is not supported, so WDT can be used only to trigger system reset.
6
6
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
8
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
8
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
10
Message-id: 20210131184449.382425-7-f4bug@amsat.org
10
Message-id: 20230326202256.22980-2-strahinja.p.jankovic@gmail.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
12
---
14
hw/arm/digic_boards.c | 2 +-
13
include/hw/watchdog/allwinner-wdt.h | 123 ++++++++
15
hw/arm/microbit.c | 2 +-
14
hw/watchdog/allwinner-wdt.c | 416 ++++++++++++++++++++++++++++
16
hw/arm/netduino2.c | 2 +-
15
hw/watchdog/Kconfig | 4 +
17
hw/arm/netduinoplus2.c | 2 +-
16
hw/watchdog/meson.build | 1 +
18
hw/arm/orangepi.c | 2 +-
17
hw/watchdog/trace-events | 7 +
19
hw/arm/stellaris.c | 4 ++--
18
5 files changed, 551 insertions(+)
20
6 files changed, 7 insertions(+), 7 deletions(-)
19
create mode 100644 include/hw/watchdog/allwinner-wdt.h
20
create mode 100644 hw/watchdog/allwinner-wdt.c
21
21
22
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
22
diff --git a/include/hw/watchdog/allwinner-wdt.h b/include/hw/watchdog/allwinner-wdt.h
23
new file mode 100644
24
index XXXXXXX..XXXXXXX
25
--- /dev/null
26
+++ b/include/hw/watchdog/allwinner-wdt.h
27
@@ -XXX,XX +XXX,XX @@
28
+/*
29
+ * Allwinner Watchdog emulation
30
+ *
31
+ * Copyright (C) 2023 Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
32
+ *
33
+ * This file is derived from Allwinner RTC,
34
+ * by Niek Linnenbank.
35
+ *
36
+ * This program is free software: you can redistribute it and/or modify
37
+ * it under the terms of the GNU General Public License as published by
38
+ * the Free Software Foundation, either version 2 of the License, or
39
+ * (at your option) any later version.
40
+ *
41
+ * This program is distributed in the hope that it will be useful,
42
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
43
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44
+ * GNU General Public License for more details.
45
+ *
46
+ * You should have received a copy of the GNU General Public License
47
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
48
+ */
49
+
50
+#ifndef HW_WATCHDOG_ALLWINNER_WDT_H
51
+#define HW_WATCHDOG_ALLWINNER_WDT_H
52
+
53
+#include "qom/object.h"
54
+#include "hw/ptimer.h"
55
+#include "hw/sysbus.h"
56
+
57
+/*
58
+ * This is a model of the Allwinner watchdog.
59
+ * Since watchdog registers belong to the timer module (and are shared with the
60
+ * RTC module), the interrupt line from watchdog is not handled right now.
61
+ * In QEMU, we just wire up the watchdog reset to watchdog_perform_action(),
62
+ * at least for the moment.
63
+ */
64
+
65
+#define TYPE_AW_WDT "allwinner-wdt"
66
+
67
+/** Allwinner WDT sun4i family (A10, A12), also sun7i (A20) */
68
+#define TYPE_AW_WDT_SUN4I TYPE_AW_WDT "-sun4i"
69
+
70
+/** Allwinner WDT sun6i family and newer (A31, H2+, H3, etc) */
71
+#define TYPE_AW_WDT_SUN6I TYPE_AW_WDT "-sun6i"
72
+
73
+/** Number of WDT registers */
74
+#define AW_WDT_REGS_NUM (5)
75
+
76
+OBJECT_DECLARE_TYPE(AwWdtState, AwWdtClass, AW_WDT)
77
+
78
+/**
79
+ * Allwinner WDT object instance state.
80
+ */
81
+struct AwWdtState {
82
+ /*< private >*/
83
+ SysBusDevice parent_obj;
84
+
85
+ /*< public >*/
86
+ MemoryRegion iomem;
87
+ struct ptimer_state *timer;
88
+
89
+ uint32_t regs[AW_WDT_REGS_NUM];
90
+};
91
+
92
+/**
93
+ * Allwinner WDT class-level struct.
94
+ *
95
+ * This struct is filled by each sunxi device specific code
96
+ * such that the generic code can use this struct to support
97
+ * all devices.
98
+ */
99
+struct AwWdtClass {
100
+ /*< private >*/
101
+ SysBusDeviceClass parent_class;
102
+ /*< public >*/
103
+
104
+ /** Defines device specific register map */
105
+ const uint8_t *regmap;
106
+
107
+ /** Size of the regmap in bytes */
108
+ size_t regmap_size;
109
+
110
+ /**
111
+ * Read device specific register
112
+ *
113
+ * @offset: register offset to read
114
+ * @return true if register read successful, false otherwise
115
+ */
116
+ bool (*read)(AwWdtState *s, uint32_t offset);
117
+
118
+ /**
119
+ * Write device specific register
120
+ *
121
+ * @offset: register offset to write
122
+ * @data: value to set in register
123
+ * @return true if register write successful, false otherwise
124
+ */
125
+ bool (*write)(AwWdtState *s, uint32_t offset, uint32_t data);
126
+
127
+ /**
128
+ * Check if watchdog can generate system reset
129
+ *
130
+ * @return true if watchdog can generate system reset
131
+ */
132
+ bool (*can_reset_system)(AwWdtState *s);
133
+
134
+ /**
135
+ * Check if provided key is valid
136
+ *
137
+ * @value: value written to register
138
+ * @return true if key is valid, false otherwise
139
+ */
140
+ bool (*is_key_valid)(AwWdtState *s, uint32_t val);
141
+
142
+ /**
143
+ * Get current INTV_VALUE setting
144
+ *
145
+ * @return current INTV_VALUE (0-15)
146
+ */
147
+ uint8_t (*get_intv_value)(AwWdtState *s);
148
+};
149
+
150
+#endif /* HW_WATCHDOG_ALLWINNER_WDT_H */
151
diff --git a/hw/watchdog/allwinner-wdt.c b/hw/watchdog/allwinner-wdt.c
152
new file mode 100644
153
index XXXXXXX..XXXXXXX
154
--- /dev/null
155
+++ b/hw/watchdog/allwinner-wdt.c
156
@@ -XXX,XX +XXX,XX @@
157
+/*
158
+ * Allwinner Watchdog emulation
159
+ *
160
+ * Copyright (C) 2023 Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
161
+ *
162
+ * This file is derived from Allwinner RTC,
163
+ * by Niek Linnenbank.
164
+ *
165
+ * This program is free software: you can redistribute it and/or modify
166
+ * it under the terms of the GNU General Public License as published by
167
+ * the Free Software Foundation, either version 2 of the License, or
168
+ * (at your option) any later version.
169
+ *
170
+ * This program is distributed in the hope that it will be useful,
171
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
172
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
173
+ * GNU General Public License for more details.
174
+ *
175
+ * You should have received a copy of the GNU General Public License
176
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
177
+ */
178
+
179
+#include "qemu/osdep.h"
180
+#include "qemu/log.h"
181
+#include "qemu/units.h"
182
+#include "qemu/module.h"
183
+#include "trace.h"
184
+#include "hw/sysbus.h"
185
+#include "hw/registerfields.h"
186
+#include "hw/watchdog/allwinner-wdt.h"
187
+#include "sysemu/watchdog.h"
188
+#include "migration/vmstate.h"
189
+
190
+/* WDT registers */
191
+enum {
192
+ REG_IRQ_EN = 0, /* Watchdog interrupt enable */
193
+ REG_IRQ_STA, /* Watchdog interrupt status */
194
+ REG_CTRL, /* Watchdog control register */
195
+ REG_CFG, /* Watchdog configuration register */
196
+ REG_MODE, /* Watchdog mode register */
197
+};
198
+
199
+/* Universal WDT register flags */
200
+#define WDT_RESTART_MASK (1 << 0)
201
+#define WDT_EN_MASK (1 << 0)
202
+
203
+/* sun4i specific WDT register flags */
204
+#define RST_EN_SUN4I_MASK (1 << 1)
205
+#define INTV_VALUE_SUN4I_SHIFT (3)
206
+#define INTV_VALUE_SUN4I_MASK (0xfu << INTV_VALUE_SUN4I_SHIFT)
207
+
208
+/* sun6i specific WDT register flags */
209
+#define RST_EN_SUN6I_MASK (1 << 0)
210
+#define KEY_FIELD_SUN6I_SHIFT (1)
211
+#define KEY_FIELD_SUN6I_MASK (0xfffu << KEY_FIELD_SUN6I_SHIFT)
212
+#define KEY_FIELD_SUN6I (0xA57u)
213
+#define INTV_VALUE_SUN6I_SHIFT (4)
214
+#define INTV_VALUE_SUN6I_MASK (0xfu << INTV_VALUE_SUN6I_SHIFT)
215
+
216
+/* Map of INTV_VALUE to 0.5s units. */
217
+static const uint8_t allwinner_wdt_count_map[] = {
218
+ 1,
219
+ 2,
220
+ 4,
221
+ 6,
222
+ 8,
223
+ 10,
224
+ 12,
225
+ 16,
226
+ 20,
227
+ 24,
228
+ 28,
229
+ 32
230
+};
231
+
232
+/* WDT sun4i register map (offset to name) */
233
+const uint8_t allwinner_wdt_sun4i_regmap[] = {
234
+ [0x0000] = REG_CTRL,
235
+ [0x0004] = REG_MODE,
236
+};
237
+
238
+/* WDT sun6i register map (offset to name) */
239
+const uint8_t allwinner_wdt_sun6i_regmap[] = {
240
+ [0x0000] = REG_IRQ_EN,
241
+ [0x0004] = REG_IRQ_STA,
242
+ [0x0010] = REG_CTRL,
243
+ [0x0014] = REG_CFG,
244
+ [0x0018] = REG_MODE,
245
+};
246
+
247
+static bool allwinner_wdt_sun4i_read(AwWdtState *s, uint32_t offset)
248
+{
249
+ /* no sun4i specific registers currently implemented */
250
+ return false;
251
+}
252
+
253
+static bool allwinner_wdt_sun4i_write(AwWdtState *s, uint32_t offset,
254
+ uint32_t data)
255
+{
256
+ /* no sun4i specific registers currently implemented */
257
+ return false;
258
+}
259
+
260
+static bool allwinner_wdt_sun4i_can_reset_system(AwWdtState *s)
261
+{
262
+ if (s->regs[REG_MODE] & RST_EN_SUN4I_MASK) {
263
+ return true;
264
+ } else {
265
+ return false;
266
+ }
267
+}
268
+
269
+static bool allwinner_wdt_sun4i_is_key_valid(AwWdtState *s, uint32_t val)
270
+{
271
+ /* sun4i has no key */
272
+ return true;
273
+}
274
+
275
+static uint8_t allwinner_wdt_sun4i_get_intv_value(AwWdtState *s)
276
+{
277
+ return ((s->regs[REG_MODE] & INTV_VALUE_SUN4I_MASK) >>
278
+ INTV_VALUE_SUN4I_SHIFT);
279
+}
280
+
281
+static bool allwinner_wdt_sun6i_read(AwWdtState *s, uint32_t offset)
282
+{
283
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
284
+
285
+ switch (c->regmap[offset]) {
286
+ case REG_IRQ_EN:
287
+ case REG_IRQ_STA:
288
+ case REG_CFG:
289
+ return true;
290
+ default:
291
+ break;
292
+ }
293
+ return false;
294
+}
295
+
296
+static bool allwinner_wdt_sun6i_write(AwWdtState *s, uint32_t offset,
297
+ uint32_t data)
298
+{
299
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
300
+
301
+ switch (c->regmap[offset]) {
302
+ case REG_IRQ_EN:
303
+ case REG_IRQ_STA:
304
+ case REG_CFG:
305
+ return true;
306
+ default:
307
+ break;
308
+ }
309
+ return false;
310
+}
311
+
312
+static bool allwinner_wdt_sun6i_can_reset_system(AwWdtState *s)
313
+{
314
+ if (s->regs[REG_CFG] & RST_EN_SUN6I_MASK) {
315
+ return true;
316
+ } else {
317
+ return false;
318
+ }
319
+}
320
+
321
+static bool allwinner_wdt_sun6i_is_key_valid(AwWdtState *s, uint32_t val)
322
+{
323
+ uint16_t key = (val & KEY_FIELD_SUN6I_MASK) >> KEY_FIELD_SUN6I_SHIFT;
324
+ return (key == KEY_FIELD_SUN6I);
325
+}
326
+
327
+static uint8_t allwinner_wdt_sun6i_get_intv_value(AwWdtState *s)
328
+{
329
+ return ((s->regs[REG_MODE] & INTV_VALUE_SUN6I_MASK) >>
330
+ INTV_VALUE_SUN6I_SHIFT);
331
+}
332
+
333
+static void allwinner_wdt_update_timer(AwWdtState *s)
334
+{
335
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
336
+ uint8_t count = c->get_intv_value(s);
337
+
338
+ ptimer_transaction_begin(s->timer);
339
+ ptimer_stop(s->timer);
340
+
341
+ /* Use map to convert. */
342
+ if (count < sizeof(allwinner_wdt_count_map)) {
343
+ ptimer_set_count(s->timer, allwinner_wdt_count_map[count]);
344
+ } else {
345
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: incorrect INTV_VALUE 0x%02x\n",
346
+ __func__, count);
347
+ }
348
+
349
+ ptimer_run(s->timer, 1);
350
+ ptimer_transaction_commit(s->timer);
351
+
352
+ trace_allwinner_wdt_update_timer(count);
353
+}
354
+
355
+static uint64_t allwinner_wdt_read(void *opaque, hwaddr offset,
356
+ unsigned size)
357
+{
358
+ AwWdtState *s = AW_WDT(opaque);
359
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
360
+ uint64_t r;
361
+
362
+ if (offset >= c->regmap_size) {
363
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: out-of-bounds offset 0x%04x\n",
364
+ __func__, (uint32_t)offset);
365
+ return 0;
366
+ }
367
+
368
+ switch (c->regmap[offset]) {
369
+ case REG_CTRL:
370
+ case REG_MODE:
371
+ r = s->regs[c->regmap[offset]];
372
+ break;
373
+ default:
374
+ if (!c->read(s, offset)) {
375
+ qemu_log_mask(LOG_UNIMP, "%s: unimplemented register 0x%04x\n",
376
+ __func__, (uint32_t)offset);
377
+ return 0;
378
+ }
379
+ r = s->regs[c->regmap[offset]];
380
+ break;
381
+ }
382
+
383
+ trace_allwinner_wdt_read(offset, r, size);
384
+
385
+ return r;
386
+}
387
+
388
+static void allwinner_wdt_write(void *opaque, hwaddr offset,
389
+ uint64_t val, unsigned size)
390
+{
391
+ AwWdtState *s = AW_WDT(opaque);
392
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
393
+ uint32_t old_val;
394
+
395
+ if (offset >= c->regmap_size) {
396
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: out-of-bounds offset 0x%04x\n",
397
+ __func__, (uint32_t)offset);
398
+ return;
399
+ }
400
+
401
+ trace_allwinner_wdt_write(offset, val, size);
402
+
403
+ switch (c->regmap[offset]) {
404
+ case REG_CTRL:
405
+ if (c->is_key_valid(s, val)) {
406
+ if (val & WDT_RESTART_MASK) {
407
+ /* Kick timer */
408
+ allwinner_wdt_update_timer(s);
409
+ }
410
+ }
411
+ break;
412
+ case REG_MODE:
413
+ old_val = s->regs[REG_MODE];
414
+ s->regs[REG_MODE] = (uint32_t)val;
415
+
416
+ /* Check for rising edge on WDOG_MODE_EN */
417
+ if ((s->regs[REG_MODE] & ~old_val) & WDT_EN_MASK) {
418
+ allwinner_wdt_update_timer(s);
419
+ }
420
+ break;
421
+ default:
422
+ if (!c->write(s, offset, val)) {
423
+ qemu_log_mask(LOG_UNIMP, "%s: unimplemented register 0x%04x\n",
424
+ __func__, (uint32_t)offset);
425
+ }
426
+ s->regs[c->regmap[offset]] = (uint32_t)val;
427
+ break;
428
+ }
429
+}
430
+
431
+static const MemoryRegionOps allwinner_wdt_ops = {
432
+ .read = allwinner_wdt_read,
433
+ .write = allwinner_wdt_write,
434
+ .endianness = DEVICE_NATIVE_ENDIAN,
435
+ .valid = {
436
+ .min_access_size = 4,
437
+ .max_access_size = 4,
438
+ },
439
+ .impl.min_access_size = 4,
440
+};
441
+
442
+static void allwinner_wdt_expired(void *opaque)
443
+{
444
+ AwWdtState *s = AW_WDT(opaque);
445
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
446
+
447
+ bool enabled = s->regs[REG_MODE] & WDT_EN_MASK;
448
+ bool reset_enabled = c->can_reset_system(s);
449
+
450
+ trace_allwinner_wdt_expired(enabled, reset_enabled);
451
+
452
+ /* Perform watchdog action if watchdog is enabled and can trigger reset */
453
+ if (enabled && reset_enabled) {
454
+ watchdog_perform_action();
455
+ }
456
+}
457
+
458
+static void allwinner_wdt_reset_enter(Object *obj, ResetType type)
459
+{
460
+ AwWdtState *s = AW_WDT(obj);
461
+
462
+ trace_allwinner_wdt_reset_enter();
463
+
464
+ /* Clear registers */
465
+ memset(s->regs, 0, sizeof(s->regs));
466
+}
467
+
468
+static const VMStateDescription allwinner_wdt_vmstate = {
469
+ .name = "allwinner-wdt",
470
+ .version_id = 1,
471
+ .minimum_version_id = 1,
472
+ .fields = (VMStateField[]) {
473
+ VMSTATE_PTIMER(timer, AwWdtState),
474
+ VMSTATE_UINT32_ARRAY(regs, AwWdtState, AW_WDT_REGS_NUM),
475
+ VMSTATE_END_OF_LIST()
476
+ }
477
+};
478
+
479
+static void allwinner_wdt_init(Object *obj)
480
+{
481
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
482
+ AwWdtState *s = AW_WDT(obj);
483
+ const AwWdtClass *c = AW_WDT_GET_CLASS(s);
484
+
485
+ /* Memory mapping */
486
+ memory_region_init_io(&s->iomem, OBJECT(s), &allwinner_wdt_ops, s,
487
+ TYPE_AW_WDT, c->regmap_size * 4);
488
+ sysbus_init_mmio(sbd, &s->iomem);
489
+}
490
+
491
+static void allwinner_wdt_realize(DeviceState *dev, Error **errp)
492
+{
493
+ AwWdtState *s = AW_WDT(dev);
494
+
495
+ s->timer = ptimer_init(allwinner_wdt_expired, s,
496
+ PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
497
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
498
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
499
+
500
+ ptimer_transaction_begin(s->timer);
501
+ /* Set to 2Hz (0.5s period); other periods are multiples of 0.5s. */
502
+ ptimer_set_freq(s->timer, 2);
503
+ ptimer_set_limit(s->timer, 0xff, 1);
504
+ ptimer_transaction_commit(s->timer);
505
+}
506
+
507
+static void allwinner_wdt_class_init(ObjectClass *klass, void *data)
508
+{
509
+ DeviceClass *dc = DEVICE_CLASS(klass);
510
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
511
+
512
+ rc->phases.enter = allwinner_wdt_reset_enter;
513
+ dc->realize = allwinner_wdt_realize;
514
+ dc->vmsd = &allwinner_wdt_vmstate;
515
+}
516
+
517
+static void allwinner_wdt_sun4i_class_init(ObjectClass *klass, void *data)
518
+{
519
+ AwWdtClass *awc = AW_WDT_CLASS(klass);
520
+
521
+ awc->regmap = allwinner_wdt_sun4i_regmap;
522
+ awc->regmap_size = sizeof(allwinner_wdt_sun4i_regmap);
523
+ awc->read = allwinner_wdt_sun4i_read;
524
+ awc->write = allwinner_wdt_sun4i_write;
525
+ awc->can_reset_system = allwinner_wdt_sun4i_can_reset_system;
526
+ awc->is_key_valid = allwinner_wdt_sun4i_is_key_valid;
527
+ awc->get_intv_value = allwinner_wdt_sun4i_get_intv_value;
528
+}
529
+
530
+static void allwinner_wdt_sun6i_class_init(ObjectClass *klass, void *data)
531
+{
532
+ AwWdtClass *awc = AW_WDT_CLASS(klass);
533
+
534
+ awc->regmap = allwinner_wdt_sun6i_regmap;
535
+ awc->regmap_size = sizeof(allwinner_wdt_sun6i_regmap);
536
+ awc->read = allwinner_wdt_sun6i_read;
537
+ awc->write = allwinner_wdt_sun6i_write;
538
+ awc->can_reset_system = allwinner_wdt_sun6i_can_reset_system;
539
+ awc->is_key_valid = allwinner_wdt_sun6i_is_key_valid;
540
+ awc->get_intv_value = allwinner_wdt_sun6i_get_intv_value;
541
+}
542
+
543
+static const TypeInfo allwinner_wdt_info = {
544
+ .name = TYPE_AW_WDT,
545
+ .parent = TYPE_SYS_BUS_DEVICE,
546
+ .instance_init = allwinner_wdt_init,
547
+ .instance_size = sizeof(AwWdtState),
548
+ .class_init = allwinner_wdt_class_init,
549
+ .class_size = sizeof(AwWdtClass),
550
+ .abstract = true,
551
+};
552
+
553
+static const TypeInfo allwinner_wdt_sun4i_info = {
554
+ .name = TYPE_AW_WDT_SUN4I,
555
+ .parent = TYPE_AW_WDT,
556
+ .class_init = allwinner_wdt_sun4i_class_init,
557
+};
558
+
559
+static const TypeInfo allwinner_wdt_sun6i_info = {
560
+ .name = TYPE_AW_WDT_SUN6I,
561
+ .parent = TYPE_AW_WDT,
562
+ .class_init = allwinner_wdt_sun6i_class_init,
563
+};
564
+
565
+static void allwinner_wdt_register(void)
566
+{
567
+ type_register_static(&allwinner_wdt_info);
568
+ type_register_static(&allwinner_wdt_sun4i_info);
569
+ type_register_static(&allwinner_wdt_sun6i_info);
570
+}
571
+
572
+type_init(allwinner_wdt_register)
573
diff --git a/hw/watchdog/Kconfig b/hw/watchdog/Kconfig
23
index XXXXXXX..XXXXXXX 100644
574
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/arm/digic_boards.c
575
--- a/hw/watchdog/Kconfig
25
+++ b/hw/arm/digic_boards.c
576
+++ b/hw/watchdog/Kconfig
26
@@ -XXX,XX +XXX,XX @@ static void canon_a1100_init(MachineState *machine)
577
@@ -XXX,XX +XXX,XX @@ config WDT_IMX2
27
578
28
static void canon_a1100_machine_init(MachineClass *mc)
579
config WDT_SBSA
29
{
580
bool
30
- mc->desc = "Canon PowerShot A1100 IS";
581
+
31
+ mc->desc = "Canon PowerShot A1100 IS (ARM946)";
582
+config ALLWINNER_WDT
32
mc->init = &canon_a1100_init;
583
+ bool
33
mc->ignore_memory_transaction_failures = true;
584
+ select PTIMER
34
mc->default_ram_size = 64 * MiB;
585
diff --git a/hw/watchdog/meson.build b/hw/watchdog/meson.build
35
diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c
36
index XXXXXXX..XXXXXXX 100644
586
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/arm/microbit.c
587
--- a/hw/watchdog/meson.build
38
+++ b/hw/arm/microbit.c
588
+++ b/hw/watchdog/meson.build
39
@@ -XXX,XX +XXX,XX @@ static void microbit_machine_class_init(ObjectClass *oc, void *data)
589
@@ -XXX,XX +XXX,XX @@
40
{
590
softmmu_ss.add(files('watchdog.c'))
41
MachineClass *mc = MACHINE_CLASS(oc);
591
+softmmu_ss.add(when: 'CONFIG_ALLWINNER_WDT', if_true: files('allwinner-wdt.c'))
42
592
softmmu_ss.add(when: 'CONFIG_CMSDK_APB_WATCHDOG', if_true: files('cmsdk-apb-watchdog.c'))
43
- mc->desc = "BBC micro:bit";
593
softmmu_ss.add(when: 'CONFIG_WDT_IB6300ESB', if_true: files('wdt_i6300esb.c'))
44
+ mc->desc = "BBC micro:bit (Cortex-M0)";
594
softmmu_ss.add(when: 'CONFIG_WDT_IB700', if_true: files('wdt_ib700.c'))
45
mc->init = microbit_init;
595
diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events
46
mc->max_cpus = 1;
47
}
48
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
49
index XXXXXXX..XXXXXXX 100644
596
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/arm/netduino2.c
597
--- a/hw/watchdog/trace-events
51
+++ b/hw/arm/netduino2.c
598
+++ b/hw/watchdog/trace-events
52
@@ -XXX,XX +XXX,XX @@ static void netduino2_init(MachineState *machine)
599
@@ -XXX,XX +XXX,XX @@
53
600
# See docs/devel/tracing.rst for syntax documentation.
54
static void netduino2_machine_init(MachineClass *mc)
601
55
{
602
+# allwinner-wdt.c
56
- mc->desc = "Netduino 2 Machine";
603
+allwinner_wdt_read(uint64_t offset, uint64_t data, unsigned size) "Allwinner watchdog read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
57
+ mc->desc = "Netduino 2 Machine (Cortex-M3)";
604
+allwinner_wdt_write(uint64_t offset, uint64_t data, unsigned size) "Allwinner watchdog write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
58
mc->init = netduino2_init;
605
+allwinner_wdt_reset_enter(void) "Allwinner watchdog: reset"
59
mc->ignore_memory_transaction_failures = true;
606
+allwinner_wdt_update_timer(uint8_t count) "Allwinner watchdog: count %" PRIu8
60
}
607
+allwinner_wdt_expired(bool enabled, bool reset_enabled) "Allwinner watchdog: enabled %u reset_enabled %u"
61
diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c
608
+
62
index XXXXXXX..XXXXXXX 100644
609
# cmsdk-apb-watchdog.c
63
--- a/hw/arm/netduinoplus2.c
610
cmsdk_apb_watchdog_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
64
+++ b/hw/arm/netduinoplus2.c
611
cmsdk_apb_watchdog_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
65
@@ -XXX,XX +XXX,XX @@ static void netduinoplus2_init(MachineState *machine)
66
67
static void netduinoplus2_machine_init(MachineClass *mc)
68
{
69
- mc->desc = "Netduino Plus 2 Machine";
70
+ mc->desc = "Netduino Plus 2 Machine (Cortex-M4)";
71
mc->init = netduinoplus2_init;
72
}
73
74
diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/arm/orangepi.c
77
+++ b/hw/arm/orangepi.c
78
@@ -XXX,XX +XXX,XX @@ static void orangepi_init(MachineState *machine)
79
80
static void orangepi_machine_init(MachineClass *mc)
81
{
82
- mc->desc = "Orange Pi PC";
83
+ mc->desc = "Orange Pi PC (Cortex-A7)";
84
mc->init = orangepi_init;
85
mc->block_default_type = IF_SD;
86
mc->units_per_default_bus = 1;
87
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
88
index XXXXXXX..XXXXXXX 100644
89
--- a/hw/arm/stellaris.c
90
+++ b/hw/arm/stellaris.c
91
@@ -XXX,XX +XXX,XX @@ static void lm3s811evb_class_init(ObjectClass *oc, void *data)
92
{
93
MachineClass *mc = MACHINE_CLASS(oc);
94
95
- mc->desc = "Stellaris LM3S811EVB";
96
+ mc->desc = "Stellaris LM3S811EVB (Cortex-M3)";
97
mc->init = lm3s811evb_init;
98
mc->ignore_memory_transaction_failures = true;
99
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3");
100
@@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_class_init(ObjectClass *oc, void *data)
101
{
102
MachineClass *mc = MACHINE_CLASS(oc);
103
104
- mc->desc = "Stellaris LM3S6965EVB";
105
+ mc->desc = "Stellaris LM3S6965EVB (Cortex-M3)";
106
mc->init = lm3s6965evb_init;
107
mc->ignore_memory_transaction_failures = true;
108
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3");
109
--
612
--
110
2.20.1
613
2.34.1
111
112
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Strahinja Jankovic <strahinjapjankovic@gmail.com>
2
2
3
The Versal SoC instantiates the TYPE_XLNX_ZYNQMP_RTC object in
3
This patch adds WDT to Allwinner-A10 and Cubieboard.
4
versal_create_rtc()(). Select CONFIG_XLNX_ZYNQMP to fix:
4
WDT is added as an overlay to the Timer module memory map.
5
5
6
$ make check-qtest-aarch64
6
Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
7
...
7
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
8
Running test qtest-aarch64/qom-test
8
Message-id: 20230326202256.22980-3-strahinja.p.jankovic@gmail.com
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
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
hw/arm/Kconfig | 1 +
11
docs/system/arm/cubieboard.rst | 1 +
18
1 file changed, 1 insertion(+)
12
include/hw/arm/allwinner-a10.h | 2 ++
13
hw/arm/allwinner-a10.c | 7 +++++++
14
hw/arm/Kconfig | 1 +
15
4 files changed, 11 insertions(+)
19
16
17
diff --git a/docs/system/arm/cubieboard.rst b/docs/system/arm/cubieboard.rst
18
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/system/arm/cubieboard.rst
20
+++ b/docs/system/arm/cubieboard.rst
21
@@ -XXX,XX +XXX,XX @@ Emulated devices:
22
- USB controller
23
- SATA controller
24
- TWI (I2C) controller
25
+- Watchdog timer
26
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
27
index XXXXXXX..XXXXXXX 100644
28
--- a/include/hw/arm/allwinner-a10.h
29
+++ b/include/hw/arm/allwinner-a10.h
30
@@ -XXX,XX +XXX,XX @@
31
#include "hw/misc/allwinner-a10-ccm.h"
32
#include "hw/misc/allwinner-a10-dramc.h"
33
#include "hw/i2c/allwinner-i2c.h"
34
+#include "hw/watchdog/allwinner-wdt.h"
35
#include "sysemu/block-backend.h"
36
37
#include "target/arm/cpu.h"
38
@@ -XXX,XX +XXX,XX @@ struct AwA10State {
39
AwSdHostState mmc0;
40
AWI2CState i2c0;
41
AwRtcState rtc;
42
+ AwWdtState wdt;
43
MemoryRegion sram_a;
44
EHCISysBusState ehci[AW_A10_NUM_USB];
45
OHCISysBusState ohci[AW_A10_NUM_USB];
46
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/arm/allwinner-a10.c
49
+++ b/hw/arm/allwinner-a10.c
50
@@ -XXX,XX +XXX,XX @@
51
#define AW_A10_EHCI_BASE 0x01c14000
52
#define AW_A10_OHCI_BASE 0x01c14400
53
#define AW_A10_SATA_BASE 0x01c18000
54
+#define AW_A10_WDT_BASE 0x01c20c90
55
#define AW_A10_RTC_BASE 0x01c20d00
56
#define AW_A10_I2C0_BASE 0x01c2ac00
57
58
@@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj)
59
object_initialize_child(obj, "mmc0", &s->mmc0, TYPE_AW_SDHOST_SUN4I);
60
61
object_initialize_child(obj, "rtc", &s->rtc, TYPE_AW_RTC_SUN4I);
62
+
63
+ object_initialize_child(obj, "wdt", &s->wdt, TYPE_AW_WDT_SUN4I);
64
}
65
66
static void aw_a10_realize(DeviceState *dev, Error **errp)
67
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
68
sysbus_realize(SYS_BUS_DEVICE(&s->i2c0), &error_fatal);
69
sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c0), 0, AW_A10_I2C0_BASE);
70
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c0), 0, qdev_get_gpio_in(dev, 7));
71
+
72
+ /* WDT */
73
+ sysbus_realize(SYS_BUS_DEVICE(&s->wdt), &error_fatal);
74
+ sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->wdt), 0, AW_A10_WDT_BASE, 1);
75
}
76
77
static void aw_a10_class_init(ObjectClass *oc, void *data)
20
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
78
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
21
index XXXXXXX..XXXXXXX 100644
79
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/Kconfig
80
--- a/hw/arm/Kconfig
23
+++ b/hw/arm/Kconfig
81
+++ b/hw/arm/Kconfig
24
@@ -XXX,XX +XXX,XX @@ config XLNX_VERSAL
82
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_A10
25
select VIRTIO_MMIO
83
select ALLWINNER_A10_PIC
26
select UNIMP
84
select ALLWINNER_A10_CCM
27
select XLNX_ZDMA
85
select ALLWINNER_A10_DRAMC
28
+ select XLNX_ZYNQMP
86
+ select ALLWINNER_WDT
29
87
select ALLWINNER_EMAC
30
config NPCM7XX
88
select ALLWINNER_I2C
31
bool
89
select AXP209_PMU
32
--
90
--
33
2.20.1
91
2.34.1
34
35
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Strahinja Jankovic <strahinjapjankovic@gmail.com>
2
2
3
The Versal SoC instantiates the TYPE_XLNX_ZDMA object in
3
This patch adds WDT to Allwinner-H3 and Orangepi-PC.
4
versal_create_admas(). Introduce the XLNX_ZDMA configuration
4
WDT is added as an overlay to the Timer module memory area.
5
and select it to fix:
6
5
7
$ qemu-system-aarch64 -M xlnx-versal-virt ...
6
Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
8
qemu-system-aarch64: missing object type 'xlnx.zdma'
7
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
9
8
Message-id: 20230326202256.22980-4-strahinja.p.jankovic@gmail.com
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
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
10
---
15
hw/arm/Kconfig | 2 ++
11
docs/system/arm/orangepi.rst | 1 +
16
hw/dma/Kconfig | 3 +++
12
include/hw/arm/allwinner-h3.h | 5 ++++-
17
hw/dma/meson.build | 2 +-
13
hw/arm/allwinner-h3.c | 8 ++++++++
18
3 files changed, 6 insertions(+), 1 deletion(-)
14
hw/arm/Kconfig | 1 +
15
4 files changed, 14 insertions(+), 1 deletion(-)
19
16
17
diff --git a/docs/system/arm/orangepi.rst b/docs/system/arm/orangepi.rst
18
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/system/arm/orangepi.rst
20
+++ b/docs/system/arm/orangepi.rst
21
@@ -XXX,XX +XXX,XX @@ The Orange Pi PC machine supports the following devices:
22
* System Control module
23
* Security Identifier device
24
* TWI (I2C)
25
+ * Watchdog timer
26
27
Limitations
28
"""""""""""
29
diff --git a/include/hw/arm/allwinner-h3.h b/include/hw/arm/allwinner-h3.h
30
index XXXXXXX..XXXXXXX 100644
31
--- a/include/hw/arm/allwinner-h3.h
32
+++ b/include/hw/arm/allwinner-h3.h
33
@@ -XXX,XX +XXX,XX @@
34
#include "hw/net/allwinner-sun8i-emac.h"
35
#include "hw/rtc/allwinner-rtc.h"
36
#include "hw/i2c/allwinner-i2c.h"
37
+#include "hw/watchdog/allwinner-wdt.h"
38
#include "target/arm/cpu.h"
39
#include "sysemu/block-backend.h"
40
41
@@ -XXX,XX +XXX,XX @@ enum {
42
AW_H3_DEV_RTC,
43
AW_H3_DEV_CPUCFG,
44
AW_H3_DEV_R_TWI,
45
- AW_H3_DEV_SDRAM
46
+ AW_H3_DEV_SDRAM,
47
+ AW_H3_DEV_WDT
48
};
49
50
/** Total number of CPU cores in the H3 SoC */
51
@@ -XXX,XX +XXX,XX @@ struct AwH3State {
52
AWI2CState r_twi;
53
AwSun8iEmacState emac;
54
AwRtcState rtc;
55
+ AwWdtState wdt;
56
GICState gic;
57
MemoryRegion sram_a1;
58
MemoryRegion sram_a2;
59
diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/hw/arm/allwinner-h3.c
62
+++ b/hw/arm/allwinner-h3.c
63
@@ -XXX,XX +XXX,XX @@ const hwaddr allwinner_h3_memmap[] = {
64
[AW_H3_DEV_OHCI3] = 0x01c1d400,
65
[AW_H3_DEV_CCU] = 0x01c20000,
66
[AW_H3_DEV_PIT] = 0x01c20c00,
67
+ [AW_H3_DEV_WDT] = 0x01c20ca0,
68
[AW_H3_DEV_UART0] = 0x01c28000,
69
[AW_H3_DEV_UART1] = 0x01c28400,
70
[AW_H3_DEV_UART2] = 0x01c28800,
71
@@ -XXX,XX +XXX,XX @@ static void allwinner_h3_init(Object *obj)
72
object_initialize_child(obj, "twi1", &s->i2c1, TYPE_AW_I2C_SUN6I);
73
object_initialize_child(obj, "twi2", &s->i2c2, TYPE_AW_I2C_SUN6I);
74
object_initialize_child(obj, "r_twi", &s->r_twi, TYPE_AW_I2C_SUN6I);
75
+
76
+ object_initialize_child(obj, "wdt", &s->wdt, TYPE_AW_WDT_SUN6I);
77
}
78
79
static void allwinner_h3_realize(DeviceState *dev, Error **errp)
80
@@ -XXX,XX +XXX,XX @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)
81
sysbus_connect_irq(SYS_BUS_DEVICE(&s->r_twi), 0,
82
qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_R_TWI));
83
84
+ /* WDT */
85
+ sysbus_realize(SYS_BUS_DEVICE(&s->wdt), &error_fatal);
86
+ sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->wdt), 0,
87
+ s->memmap[AW_H3_DEV_WDT], 1);
88
+
89
/* Unimplemented devices */
90
for (i = 0; i < ARRAY_SIZE(unimplemented); i++) {
91
create_unimplemented_device(unimplemented[i].device_name,
20
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
92
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
21
index XXXXXXX..XXXXXXX 100644
93
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/Kconfig
94
--- a/hw/arm/Kconfig
23
+++ b/hw/arm/Kconfig
95
+++ b/hw/arm/Kconfig
24
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM
96
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3
25
select XILINX_AXI
97
select ALLWINNER_A10_PIT
26
select XILINX_SPIPS
98
select ALLWINNER_SUN8I_EMAC
27
select XLNX_ZYNQMP
99
select ALLWINNER_I2C
28
+ select XLNX_ZDMA
100
+ select ALLWINNER_WDT
29
101
select SERIAL
30
config XLNX_VERSAL
102
select ARM_TIMER
31
bool
103
select ARM_GIC
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
50
+
51
config STP2000
52
bool
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'))
67
--
104
--
68
2.20.1
105
2.34.1
69
70
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Strahinja Jankovic <strahinjapjankovic@gmail.com>
2
2
3
Add a dependency XLNX_ZYNQMP -> PTIMER to fix:
3
Cubieboard tests end with comment "reboot not functioning; omit test".
4
Fix this so reboot is done at the end of each test.
4
5
5
/usr/bin/ld:
6
Signed-off-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
6
libcommon.fa.p/hw_net_can_xlnx-zynqmp-can.c.o: in function `xlnx_zynqmp_can_realize':
7
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
7
hw/net/can/xlnx-zynqmp-can.c:1082: undefined reference to `ptimer_init'
8
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
8
hw/net/can/xlnx-zynqmp-can.c:1085: undefined reference to `ptimer_transaction_begin'
9
Message-id: 20230326202256.22980-5-strahinja.p.jankovic@gmail.com
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
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
11
---
20
hw/Kconfig | 1 +
12
tests/avocado/boot_linux_console.py | 15 ++++++++++++---
21
1 file changed, 1 insertion(+)
13
1 file changed, 12 insertions(+), 3 deletions(-)
22
14
23
diff --git a/hw/Kconfig b/hw/Kconfig
15
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
24
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/Kconfig
17
--- a/tests/avocado/boot_linux_console.py
26
+++ b/hw/Kconfig
18
+++ b/tests/avocado/boot_linux_console.py
27
@@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP
19
@@ -XXX,XX +XXX,XX @@ def test_arm_cubieboard_initrd(self):
28
bool
20
'Allwinner sun4i/sun5i')
29
select REGISTER
21
exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
30
select CAN_BUS
22
'system-control@1c00000')
31
+ select PTIMER
23
- # cubieboard's reboot is not functioning; omit reboot test.
24
+ exec_command_and_wait_for_pattern(self, 'reboot',
25
+ 'reboot: Restarting system')
26
+ # Wait for VM to shut down gracefully
27
+ self.vm.wait()
28
29
def test_arm_cubieboard_sata(self):
30
"""
31
@@ -XXX,XX +XXX,XX @@ def test_arm_cubieboard_sata(self):
32
'Allwinner sun4i/sun5i')
33
exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
34
'sda')
35
- # cubieboard's reboot is not functioning; omit reboot test.
36
+ exec_command_and_wait_for_pattern(self, 'reboot',
37
+ 'reboot: Restarting system')
38
+ # Wait for VM to shut down gracefully
39
+ self.vm.wait()
40
41
@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
42
def test_arm_cubieboard_openwrt_22_03_2(self):
43
@@ -XXX,XX +XXX,XX @@ def test_arm_cubieboard_openwrt_22_03_2(self):
44
45
exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
46
'Allwinner sun4i/sun5i')
47
- # cubieboard's reboot is not functioning; omit reboot test.
48
+ exec_command_and_wait_for_pattern(self, 'reboot',
49
+ 'reboot: Restarting system')
50
+ # Wait for VM to shut down gracefully
51
+ self.vm.wait()
52
53
@skipUnless(os.getenv('AVOCADO_TIMEOUT_EXPECTED'), 'Test might timeout')
54
def test_arm_quanta_gsj(self):
32
--
55
--
33
2.20.1
56
2.34.1
34
35
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
The Exynos4210 SoC uses an OR gate on the PL330 IRQ lines.
3
Fix issue reported by Coverity.
4
4
5
Fixes: dab15fbe2ab ("hw/arm/exynos4210: Fix DMA initialization")
5
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
6
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Message-id: 168070611775.20412.2883242077302841473-1@git.sr.ht
7
Message-id: 20210131184449.382425-3-f4bug@amsat.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
hw/arm/Kconfig | 1 +
10
hw/timer/imx_epit.c | 2 +-
12
1 file changed, 1 insertion(+)
11
1 file changed, 1 insertion(+), 1 deletion(-)
13
12
14
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
13
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/Kconfig
15
--- a/hw/timer/imx_epit.c
17
+++ b/hw/arm/Kconfig
16
+++ b/hw/timer/imx_epit.c
18
@@ -XXX,XX +XXX,XX @@ config EXYNOS4
17
@@ -XXX,XX +XXX,XX @@ static void imx_epit_update_compare_timer(IMXEPITState *s)
19
select PTIMER
18
* the compare value. Otherwise it may fire at most once in the
20
select SDHCI
19
* current round.
21
select USB_EHCI_SYSBUS
20
*/
22
+ select OR_IRQ
21
- bool is_oneshot = (limit >= s->cmp);
23
22
+ is_oneshot = (limit >= s->cmp);
24
config HIGHBANK
23
if (counter >= s->cmp) {
25
bool
24
/* The compare timer fires in the current round. */
25
counter -= s->cmp;
26
--
26
--
27
2.20.1
27
2.34.1
28
29
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
Per the ARM Generic Interrupt Controller Architecture specification
3
Fix the limit check. If the limit is less than the compare value,
4
(document "ARM IHI 0048B.b (ID072613)"), the SGIINTID field is 4 bit,
4
the timer can never reach this value, thus it will never fire.
5
not 10:
6
5
7
- 4.3 Distributor register descriptions
6
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1491
8
- 4.3.15 Software Generated Interrupt Register, GICD_SG
7
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
9
8
Message-id: 168070611775.20412.2883242077302841473-2@git.sr.ht
10
- Table 4-21 GICD_SGIR bit assignments
11
12
The Interrupt ID of the SGI to forward to the specified CPU
13
interfaces. The value of this field is the Interrupt ID, in
14
the range 0-15, for example a value of 0b0011 specifies
15
Interrupt ID 3.
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
37
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
38
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
39
---
11
---
40
hw/intc/arm_gic.c | 2 +-
12
hw/timer/imx_epit.c | 2 +-
41
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
42
14
43
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
15
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
44
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/intc/arm_gic.c
17
--- a/hw/timer/imx_epit.c
46
+++ b/hw/intc/arm_gic.c
18
+++ b/hw/timer/imx_epit.c
47
@@ -XXX,XX +XXX,XX @@ static void gic_dist_writel(void *opaque, hwaddr offset,
19
@@ -XXX,XX +XXX,XX @@ static void imx_epit_update_compare_timer(IMXEPITState *s)
48
int target_cpu;
20
* the compare value. Otherwise it may fire at most once in the
49
21
* current round.
50
cpu = gic_get_current_cpu(s);
22
*/
51
- irq = value & 0x3ff;
23
- is_oneshot = (limit >= s->cmp);
52
+ irq = value & 0xf;
24
+ is_oneshot = (limit < s->cmp);
53
switch ((value >> 24) & 3) {
25
if (counter >= s->cmp) {
54
case 0:
26
/* The compare timer fires in the current round. */
55
mask = (value >> 16) & ALL_CPU_MASK;
27
counter -= s->cmp;
56
--
28
--
57
2.20.1
29
2.34.1
58
59
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The endianness of data exchange between tx and rx fifo is incorrect.
3
Missed in commit 80485d88f9 ("target/arm: Restrict
4
Earlier bytes are supposed to show up on MSB and later bytes on LSB,
4
v7A TCG cpus to TCG accel").
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
5
9
With this change, U-Boot read from / write to SPI flash tests pass.
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
=> sf test 1ff000 1000
8
Message-id: 20230405100848.76145-2-philmd@linaro.org
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>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
10
---
29
hw/ssi/imx_spi.c | 7 ++-----
11
target/arm/kvm-consts.h | 9 +++------
30
1 file changed, 2 insertions(+), 5 deletions(-)
12
target/arm/cpu_tcg.c | 2 --
13
2 files changed, 3 insertions(+), 8 deletions(-)
31
14
32
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
15
diff --git a/target/arm/kvm-consts.h b/target/arm/kvm-consts.h
33
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/ssi/imx_spi.c
17
--- a/target/arm/kvm-consts.h
35
+++ b/hw/ssi/imx_spi.c
18
+++ b/target/arm/kvm-consts.h
36
@@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s)
19
@@ -XXX,XX +XXX,XX @@ MISMATCH_CHECK(QEMU_PSCI_RET_INTERNAL_FAILURE, PSCI_RET_INTERNAL_FAILURE);
37
20
MISMATCH_CHECK(QEMU_PSCI_RET_NOT_PRESENT, PSCI_RET_NOT_PRESENT);
38
while (!fifo32_is_empty(&s->tx_fifo)) {
21
MISMATCH_CHECK(QEMU_PSCI_RET_DISABLED, PSCI_RET_DISABLED);
39
int tx_burst = 0;
22
40
- int index = 0;
23
-/* Note that KVM uses overlapping values for AArch32 and AArch64
41
24
- * target CPU numbers. AArch32 targets:
42
if (s->burst_length <= 0) {
25
+/*
43
s->burst_length = imx_spi_burst_length(s);
26
+ * Note that KVM uses overlapping values for AArch32 and AArch64
44
@@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s)
27
+ * target CPU numbers. AArch64 targets:
45
rx = 0;
28
*/
46
29
-#define QEMU_KVM_ARM_TARGET_CORTEX_A15 0
47
while (tx_burst > 0) {
30
-#define QEMU_KVM_ARM_TARGET_CORTEX_A7 1
48
- uint8_t byte = tx & 0xff;
31
-
49
+ uint8_t byte = tx >> (tx_burst - 8);
32
-/* AArch64 targets: */
50
33
#define QEMU_KVM_ARM_TARGET_AEM_V8 0
51
DPRINTF("writing 0x%02x\n", (uint32_t)byte);
34
#define QEMU_KVM_ARM_TARGET_FOUNDATION_V8 1
52
35
#define QEMU_KVM_ARM_TARGET_CORTEX_A57 2
53
@@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s)
36
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
54
37
index XXXXXXX..XXXXXXX 100644
55
DPRINTF("0x%02x read\n", (uint32_t)byte);
38
--- a/target/arm/cpu_tcg.c
56
39
+++ b/target/arm/cpu_tcg.c
57
- tx = tx >> 8;
40
@@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj)
58
- rx |= (byte << (index * 8));
41
set_feature(&cpu->env, ARM_FEATURE_EL2);
59
+ rx = (rx << 8) | byte;
42
set_feature(&cpu->env, ARM_FEATURE_EL3);
60
43
set_feature(&cpu->env, ARM_FEATURE_PMU);
61
/* Remove 8 bits from the actual burst */
44
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A7;
62
tx_burst -= 8;
45
cpu->midr = 0x410fc075;
63
s->burst_length -= 8;
46
cpu->reset_fpsid = 0x41023075;
64
- index++;
47
cpu->isar.mvfr0 = 0x10110222;
65
}
48
@@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj)
66
49
set_feature(&cpu->env, ARM_FEATURE_EL2);
67
DPRINTF("data rx:0x%08x\n", rx);
50
set_feature(&cpu->env, ARM_FEATURE_EL3);
51
set_feature(&cpu->env, ARM_FEATURE_PMU);
52
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A15;
53
/* r4p0 cpu, not requiring expensive tlb flush errata */
54
cpu->midr = 0x414fc0f0;
55
cpu->revidr = 0x0;
68
--
56
--
69
2.20.1
57
2.34.1
70
58
71
59
diff view generated by jsdifflib
1
From: Xuzhou Cheng <xuzhou.cheng@windriver.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
When a write to ECSPI_CONREG register to disable the SPI controller,
3
The Cortex-A7 core is only available when TCG is enabled (see
4
imx_spi_soft_reset() is called to reset the controller, but chip
4
commit 80485d88f9 "target/arm: Restrict v7A TCG cpus to TCG accel").
5
select lines should have been disabled, otherwise the state machine
6
of any devices (e.g.: SPI flashes) connected to the SPI master is
7
stuck to its last state and responds incorrectly to any follow-up
8
commands.
9
5
10
Fixes: c906a3a01582 ("i.MX: Add the Freescale SPI Controller")
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Bin Meng <bin.meng@windriver.com>
8
Message-id: 20230405100848.76145-3-philmd@linaro.org
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-id: 20210129132323.30946-8-bmeng.cn@gmail.com
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
hw/ssi/imx_spi.c | 6 ++++++
11
hw/arm/virt.c | 2 ++
18
1 file changed, 6 insertions(+)
12
1 file changed, 2 insertions(+)
19
13
20
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
14
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/ssi/imx_spi.c
16
--- a/hw/arm/virt.c
23
+++ b/hw/ssi/imx_spi.c
17
+++ b/hw/arm/virt.c
24
@@ -XXX,XX +XXX,XX @@ static void imx_spi_common_reset(IMXSPIState *s)
18
@@ -XXX,XX +XXX,XX @@ static const int a15irqmap[] = {
25
19
};
26
static void imx_spi_soft_reset(IMXSPIState *s)
20
27
{
21
static const char *valid_cpus[] = {
28
+ int i;
22
+#ifdef CONFIG_TCG
29
+
23
ARM_CPU_TYPE_NAME("cortex-a7"),
30
imx_spi_common_reset(s);
24
+#endif
31
25
ARM_CPU_TYPE_NAME("cortex-a15"),
32
imx_spi_update_irq(s);
26
ARM_CPU_TYPE_NAME("cortex-a35"),
33
+
27
ARM_CPU_TYPE_NAME("cortex-a53"),
34
+ for (i = 0; i < ECSPI_NUM_CS; i++) {
35
+ qemu_set_irq(s->cs_lines[i], 1);
36
+ }
37
}
38
39
static void imx_spi_reset(DeviceState *dev)
40
--
28
--
41
2.20.1
29
2.34.1
42
30
43
31
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Akihiko Odaki <akihiko.odaki@daynix.com>
2
2
3
When the block is disabled, it stay it is 'internal reset logic'
3
kvm_arm_init_debug() used to be called several times on a SMP system as
4
(internal clocks are gated off). Reading any register returns
4
kvm_arch_init_vcpu() calls it. Move the call to kvm_arch_init() to make
5
its reset value. Only update this value if the device is enabled.
5
sure it will be called only once; otherwise it will overwrite pointers
6
to memory allocated with the previous call and leak it.
6
7
7
Ref: i.MX 6DQ Applications Processor Reference Manual (IMX6DQRM),
8
Fixes: e4482ab7e3 ("target-arm: kvm - add support for HW assisted debug")
8
chapter 21.7.3: Control Register (ECSPIx_CONREG)
9
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
10
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
10
Reviewed-by: Juan Quintela <quintela@redhat.com>
11
Message-id: 20230405153644.25300-1-akihiko.odaki@daynix.com
11
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.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>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
14
---
20
hw/ssi/imx_spi.c | 60 +++++++++++++++++++++++-------------------------
15
target/arm/kvm_arm.h | 8 ++++++++
21
1 file changed, 29 insertions(+), 31 deletions(-)
16
target/arm/kvm.c | 2 ++
17
target/arm/kvm64.c | 18 ++++--------------
18
3 files changed, 14 insertions(+), 14 deletions(-)
22
19
23
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
20
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
24
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/ssi/imx_spi.c
22
--- a/target/arm/kvm_arm.h
26
+++ b/hw/ssi/imx_spi.c
23
+++ b/target/arm/kvm_arm.h
27
@@ -XXX,XX +XXX,XX @@ static uint64_t imx_spi_read(void *opaque, hwaddr offset, unsigned size)
24
@@ -XXX,XX +XXX,XX @@
28
return 0;
25
#define KVM_ARM_VGIC_V2 (1 << 0)
26
#define KVM_ARM_VGIC_V3 (1 << 1)
27
28
+/**
29
+ * kvm_arm_init_debug() - initialize guest debug capabilities
30
+ * @s: KVMState
31
+ *
32
+ * Should be called only once before using guest debug capabilities.
33
+ */
34
+void kvm_arm_init_debug(KVMState *s);
35
+
36
/**
37
* kvm_arm_vcpu_init:
38
* @cs: CPUState
39
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/kvm.c
42
+++ b/target/arm/kvm.c
43
@@ -XXX,XX +XXX,XX @@ int kvm_arch_init(MachineState *ms, KVMState *s)
44
}
29
}
45
}
30
46
31
- switch (index) {
47
+ kvm_arm_init_debug(s);
32
- case ECSPI_RXDATA:
33
- if (!imx_spi_is_enabled(s)) {
34
- value = 0;
35
- } else if (fifo32_is_empty(&s->rx_fifo)) {
36
- /* value is undefined */
37
- value = 0xdeadbeef;
38
- } else {
39
- /* read from the RX FIFO */
40
- value = fifo32_pop(&s->rx_fifo);
41
+ value = s->regs[index];
42
+
48
+
43
+ if (imx_spi_is_enabled(s)) {
49
return ret;
44
+ switch (index) {
50
}
45
+ case ECSPI_RXDATA:
51
46
+ if (fifo32_is_empty(&s->rx_fifo)) {
52
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
47
+ /* value is undefined */
53
index XXXXXXX..XXXXXXX 100644
48
+ value = 0xdeadbeef;
54
--- a/target/arm/kvm64.c
49
+ } else {
55
+++ b/target/arm/kvm64.c
50
+ /* read from the RX FIFO */
56
@@ -XXX,XX +XXX,XX @@ GArray *hw_breakpoints, *hw_watchpoints;
51
+ value = fifo32_pop(&s->rx_fifo);
57
#define get_hw_bp(i) (&g_array_index(hw_breakpoints, HWBreakpoint, i))
52
+ }
58
#define get_hw_wp(i) (&g_array_index(hw_watchpoints, HWWatchpoint, i))
53
+ break;
59
54
+ case ECSPI_TXDATA:
60
-/**
55
+ qemu_log_mask(LOG_GUEST_ERROR,
61
- * kvm_arm_init_debug() - check for guest debug capabilities
56
+ "[%s]%s: Trying to read from TX FIFO\n",
62
- * @cs: CPUState
57
+ TYPE_IMX_SPI, __func__);
63
- *
58
+
64
- * kvm_check_extension returns the number of debug registers we have
59
+ /* Reading from TXDATA gives 0 */
65
- * or 0 if we have none.
60
+ break;
66
- *
61
+ case ECSPI_MSGDATA:
67
- */
62
+ qemu_log_mask(LOG_GUEST_ERROR,
68
-static void kvm_arm_init_debug(CPUState *cs)
63
+ "[%s]%s: Trying to read from MSG FIFO\n",
69
+void kvm_arm_init_debug(KVMState *s)
64
+ TYPE_IMX_SPI, __func__);
70
{
65
+ /* Reading from MSGDATA gives 0 */
71
- have_guest_debug = kvm_check_extension(cs->kvm_state,
66
+ break;
72
+ have_guest_debug = kvm_check_extension(s,
67
+ default:
73
KVM_CAP_SET_GUEST_DEBUG);
68
+ break;
74
69
}
75
- max_hw_wps = kvm_check_extension(cs->kvm_state, KVM_CAP_GUEST_DEBUG_HW_WPS);
70
76
+ max_hw_wps = kvm_check_extension(s, KVM_CAP_GUEST_DEBUG_HW_WPS);
71
- break;
77
hw_watchpoints = g_array_sized_new(true, true,
72
- case ECSPI_TXDATA:
78
sizeof(HWWatchpoint), max_hw_wps);
73
- qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Trying to read from TX FIFO\n",
79
74
- TYPE_IMX_SPI, __func__);
80
- max_hw_bps = kvm_check_extension(cs->kvm_state, KVM_CAP_GUEST_DEBUG_HW_BPS);
81
+ max_hw_bps = kvm_check_extension(s, KVM_CAP_GUEST_DEBUG_HW_BPS);
82
hw_breakpoints = g_array_sized_new(true, true,
83
sizeof(HWBreakpoint), max_hw_bps);
84
return;
85
@@ -XXX,XX +XXX,XX @@ int kvm_arch_init_vcpu(CPUState *cs)
86
}
87
cpu->mp_affinity = mpidr & ARM64_AFFINITY_MASK;
88
89
- kvm_arm_init_debug(cs);
75
-
90
-
76
- /* Reading from TXDATA gives 0 */
91
/* Check whether user space can specify guest syndrome value */
77
-
92
kvm_arm_init_serror_injection(cs);
78
- break;
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;
97
}
98
93
99
--
94
--
100
2.20.1
95
2.34.1
101
96
102
97
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
We already pass merge_syn_data_abort() two fields from the
2
ARMMMUFaultInfo struct, and we're about to want to use a third field.
3
Refactor to just pass a pointer to the fault info.
2
4
3
When the block is disabled, all registers are reset with the
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
exception of the ECSPI_CONREG. It is initialized to zero
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
when the instance is created.
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Message-id: 20230331145045.2584941-2-peter.maydell@linaro.org
9
---
10
target/arm/tcg/tlb_helper.c | 15 +++++++--------
11
1 file changed, 7 insertions(+), 8 deletions(-)
6
12
7
Ref: i.MX 6DQ Applications Processor Reference Manual (IMX6DQRM),
13
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
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
14
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/ssi/imx_spi.c
15
--- a/target/arm/tcg/tlb_helper.c
24
+++ b/hw/ssi/imx_spi.c
16
+++ b/target/arm/tcg/tlb_helper.c
25
@@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s)
17
@@ -XXX,XX +XXX,XX @@ bool arm_s1_regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx)
26
fifo32_num_used(&s->tx_fifo), fifo32_num_used(&s->rx_fifo));
27
}
18
}
28
19
29
-static void imx_spi_reset(DeviceState *dev)
20
static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
30
+static void imx_spi_common_reset(IMXSPIState *s)
21
+ ARMMMUFaultInfo *fi,
22
unsigned int target_el,
23
- bool same_el, bool ea,
24
- bool s1ptw, bool is_write,
25
+ bool same_el, bool is_write,
26
int fsc)
31
{
27
{
32
- IMXSPIState *s = IMX_SPI(dev);
28
uint32_t syn;
33
+ int i;
29
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
34
30
* ISS encoding for an exception from a Data Abort, the
35
- DPRINTF("\n");
31
* ISV field.
36
-
32
*/
37
- memset(s->regs, 0, sizeof(s->regs));
33
- if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) {
38
-
34
+ if (!(template_syn & ARM_EL_ISV) || target_el != 2 || fi->s1ptw) {
39
- s->regs[ECSPI_STATREG] = 0x00000003;
35
syn = syn_data_abort_no_iss(same_el, 0,
40
+ for (i = 0; i < ARRAY_SIZE(s->regs); i++) {
36
- ea, 0, s1ptw, is_write, fsc);
41
+ switch (i) {
37
+ fi->ea, 0, fi->s1ptw, is_write, fsc);
42
+ case ECSPI_CONREG:
38
} else {
43
+ /* CONREG is not updated on soft reset */
39
/*
44
+ break;
40
* Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template
45
+ case ECSPI_STATREG:
41
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
46
+ s->regs[i] = 0x00000003;
42
*/
47
+ break;
43
syn = syn_data_abort_with_iss(same_el,
48
+ default:
44
0, 0, 0, 0, 0,
49
+ s->regs[i] = 0;
45
- ea, 0, s1ptw, is_write, fsc,
50
+ break;
46
+ fi->ea, 0, fi->s1ptw, is_write, fsc,
51
+ }
47
true);
52
+ }
48
/* Merge the runtime syndrome with the template syndrome. */
53
49
syn |= template_syn;
54
imx_spi_rxfifo_reset(s);
50
@@ -XXX,XX +XXX,XX @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr,
55
imx_spi_txfifo_reset(s);
51
syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
56
@@ -XXX,XX +XXX,XX @@ static void imx_spi_reset(DeviceState *dev)
52
exc = EXCP_PREFETCH_ABORT;
57
53
} else {
58
static void imx_spi_soft_reset(IMXSPIState *s)
54
- syn = merge_syn_data_abort(env->exception.syndrome, target_el,
59
{
55
- same_el, fi->ea, fi->s1ptw,
60
- imx_spi_reset(DEVICE(s));
56
- access_type == MMU_DATA_STORE,
61
+ imx_spi_common_reset(s);
57
+ syn = merge_syn_data_abort(env->exception.syndrome, fi, target_el,
62
58
+ same_el, access_type == MMU_DATA_STORE,
63
imx_spi_update_irq(s);
59
fsc);
64
}
60
if (access_type == MMU_DATA_STORE
65
61
&& arm_feature(env, ARM_FEATURE_V6)) {
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
--
62
--
78
2.20.1
63
2.34.1
79
64
80
65
diff view generated by jsdifflib
1
From: Zenghui Yu <yuzenghui@huawei.com>
1
The syndrome value reported to ESR_EL2 should only contain the
2
detailed instruction syndrome information when the fault has been
3
caused by a stage 2 abort, not when the fault was a stage 1 abort
4
(i.e. caused by execution at EL2). We were getting this wrong and
5
reporting the detailed ISV information all the time.
2
6
3
When handling guest range-based IOTLB invalidation, we should decode the TG
7
Fix the bug by checking fi->stage2. Add a TODO comment noting the
4
field into the corresponding translation granule size so that we can pass
8
cases where we'll have to come back and revisit this when we
5
the correct invalidation range to backend. Set @granule to (tg * 2 + 10) to
9
implement FEAT_LS64 and friends.
6
properly emulate the architecture.
7
10
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>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20230331145045.2584941-3-peter.maydell@linaro.org
13
---
14
---
14
hw/arm/smmuv3.c | 4 +++-
15
target/arm/tcg/tlb_helper.c | 13 ++++++++++---
15
1 file changed, 3 insertions(+), 1 deletion(-)
16
1 file changed, 10 insertions(+), 3 deletions(-)
16
17
17
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
18
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
18
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/smmuv3.c
20
--- a/target/arm/tcg/tlb_helper.c
20
+++ b/hw/arm/smmuv3.c
21
+++ b/target/arm/tcg/tlb_helper.c
21
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
22
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
22
{
23
uint32_t syn;
23
SMMUDevice *sdev = container_of(mr, SMMUDevice, iommu);
24
24
IOMMUTLBEvent event;
25
/*
25
- uint8_t granule = tg;
26
- * ISV is only set for data aborts routed to EL2 and
26
+ uint8_t granule;
27
- * never for stage-1 page table walks faulting on stage 2.
27
28
+ * ISV is only set for stage-2 data aborts routed to EL2 and
28
if (!tg) {
29
+ * never for stage-1 page table walks faulting on stage 2
29
SMMUEventInfo event = {.inval_ste_allowed = true};
30
+ * or for stage-1 faults.
30
@@ -XXX,XX +XXX,XX @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr,
31
*
31
return;
32
* Furthermore, ISV is only set for certain kinds of load/stores.
32
}
33
* If the template syndrome does not have ISV set, we should leave
33
granule = tt->granule_sz;
34
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
34
+ } else {
35
* See ARMv8 specs, D7-1974:
35
+ granule = tg * 2 + 10;
36
* ISS encoding for an exception from a Data Abort, the
36
}
37
* ISV field.
37
38
+ *
38
event.type = IOMMU_NOTIFIER_UNMAP;
39
+ * TODO: FEAT_LS64/FEAT_LS64_V/FEAT_SL64_ACCDATA: Translation,
40
+ * Access Flag, and Permission faults caused by LD64B, ST64B,
41
+ * ST64BV, or ST64BV0 insns report syndrome info even for stage-1
42
+ * faults and regardless of the target EL.
43
*/
44
- if (!(template_syn & ARM_EL_ISV) || target_el != 2 || fi->s1ptw) {
45
+ if (!(template_syn & ARM_EL_ISV) || target_el != 2
46
+ || fi->s1ptw || !fi->stage2) {
47
syn = syn_data_abort_no_iss(same_el, 0,
48
fi->ea, 0, fi->s1ptw, is_write, fsc);
49
} else {
39
--
50
--
40
2.20.1
51
2.34.1
41
42
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
FEAT_PAN3 adds an EPAN bit to SCTLR_EL1 and SCTLR_EL2, which allows
2
the PAN bit to make memory non-privileged-read/write if it is
3
user-executable as well as if it is user-read/write.
2
4
3
Usually the approach is that the device on the other end of the line
5
Implement this feature and enable it in the AArch64 'max' CPU.
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
6
7
Move imx_spi_update_irq() out of imx_spi_reset(), to a new function
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
imx_spi_soft_reset() that is called when the controller is disabled.
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20230331145045.2584941-4-peter.maydell@linaro.org
10
---
11
docs/system/arm/emulation.rst | 1 +
12
target/arm/cpu.h | 5 +++++
13
target/arm/cpu64.c | 2 +-
14
target/arm/ptw.c | 14 +++++++++++++-
15
4 files changed, 20 insertions(+), 2 deletions(-)
9
16
10
Signed-off-by: Bin Meng <bin.meng@windriver.com>
17
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 20210129132323.30946-3-bmeng.cn@gmail.com
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
hw/ssi/imx_spi.c | 14 ++++++++++----
16
1 file changed, 10 insertions(+), 4 deletions(-)
17
18
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/hw/ssi/imx_spi.c
19
--- a/docs/system/arm/emulation.rst
21
+++ b/hw/ssi/imx_spi.c
20
+++ b/docs/system/arm/emulation.rst
22
@@ -XXX,XX +XXX,XX @@ static void imx_spi_reset(DeviceState *dev)
21
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
23
imx_spi_rxfifo_reset(s);
22
- FEAT_MTE3 (MTE Asymmetric Fault Handling)
24
imx_spi_txfifo_reset(s);
23
- FEAT_PAN (Privileged access never)
25
24
- FEAT_PAN2 (AT S1E1R and AT S1E1W instruction variants affected by PSTATE.PAN)
26
- imx_spi_update_irq(s);
25
+- FEAT_PAN3 (Support for SCTLR_ELx.EPAN)
27
-
26
- FEAT_PAuth (Pointer authentication)
28
s->burst_length = 0;
27
- FEAT_PMULL (PMULL, PMULL2 instructions)
28
- FEAT_PMUv3p1 (PMU Extensions v3.1)
29
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
30
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/cpu.h
32
+++ b/target/arm/cpu.h
33
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_ats1e1(const ARMISARegisters *id)
34
return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 2;
29
}
35
}
30
36
31
+static void imx_spi_soft_reset(IMXSPIState *s)
37
+static inline bool isar_feature_aa64_pan3(const ARMISARegisters *id)
32
+{
38
+{
33
+ imx_spi_reset(DEVICE(s));
39
+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, PAN) >= 3;
34
+
35
+ imx_spi_update_irq(s);
36
+}
40
+}
37
+
41
+
38
static uint64_t imx_spi_read(void *opaque, hwaddr offset, unsigned size)
42
static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id)
39
{
43
{
40
uint32_t value = 0;
44
return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HCX) != 0;
41
@@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value,
45
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
42
s->regs[ECSPI_CONREG] = value;
46
index XXXXXXX..XXXXXXX 100644
43
47
--- a/target/arm/cpu64.c
44
if (!imx_spi_is_enabled(s)) {
48
+++ b/target/arm/cpu64.c
45
- /* device is disabled, so this is a reset */
49
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
46
- imx_spi_reset(DEVICE(s));
50
t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */
47
+ /* device is disabled, so this is a soft reset */
51
t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */
48
+ imx_spi_soft_reset(s);
52
t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); /* FEAT_LOR */
49
+
53
- t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* FEAT_PAN2 */
50
return;
54
+ t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 3); /* FEAT_PAN3 */
51
}
55
t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */
52
56
t = FIELD_DP64(t, ID_AA64MMFR1, ETS, 1); /* FEAT_ETS */
57
t = FIELD_DP64(t, ID_AA64MMFR1, HCX, 1); /* FEAT_HCX */
58
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/ptw.c
61
+++ b/target/arm/ptw.c
62
@@ -XXX,XX +XXX,XX @@ static int get_S2prot(CPUARMState *env, int s2ap, int xn, bool s1_is_el0)
63
static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64,
64
int ap, int ns, int xn, int pxn)
65
{
66
+ ARMCPU *cpu = env_archcpu(env);
67
bool is_user = regime_is_user(env, mmu_idx);
68
int prot_rw, user_rw;
69
bool have_wxn;
70
@@ -XXX,XX +XXX,XX @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64,
71
if (is_user) {
72
prot_rw = user_rw;
73
} else {
74
+ /*
75
+ * PAN controls can forbid data accesses but don't affect insn fetch.
76
+ * Plain PAN forbids data accesses if EL0 has data permissions;
77
+ * PAN3 forbids data accesses if EL0 has either data or exec perms.
78
+ * Note that for AArch64 the 'user can exec' case is exactly !xn.
79
+ * We make the IMPDEF choices that SCR_EL3.SIF and Realm EL2&0
80
+ * do not affect EPAN.
81
+ */
82
if (user_rw && regime_is_pan(env, mmu_idx)) {
83
- /* PAN forbids data accesses but doesn't affect insn fetch */
84
+ prot_rw = 0;
85
+ } else if (cpu_isar_feature(aa64_pan3, cpu) && is_aa64 &&
86
+ regime_is_pan(env, mmu_idx) &&
87
+ (regime_sctlr(env, mmu_idx) & SCTLR_EPAN) && !xn) {
88
prot_rw = 0;
89
} else {
90
prot_rw = simple_ap_to_rw_prot_is_user(ap, false);
53
--
91
--
54
2.20.1
92
2.34.1
55
56
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
In rST markup syntax, the inline markup (*italics*, **bold** and
2
``monospaced``) must be separated from the surrending text by
3
non-word characters, otherwise it is not interpreted as markup.
4
To force interpretation as markup in the middle of a word,
5
you need to use a backslash-escaped space (which will not
6
appear as a space in the output).
2
7
3
For the ECSPIx_CONREG register BURST_LENGTH field, the manual says:
8
Fix a missing backslash-space in this file, which meant that the ``
9
after "select" was output literally and the monospacing was
10
incorrectly extended all the way to the end of the next monospaced
11
word.
4
12
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
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
16
Message-id: 20230411105424.3994585-1-peter.maydell@linaro.org
27
---
17
---
28
hw/ssi/imx_spi.c | 2 +-
18
docs/devel/kconfig.rst | 2 +-
29
1 file changed, 1 insertion(+), 1 deletion(-)
19
1 file changed, 1 insertion(+), 1 deletion(-)
30
20
31
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
21
diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
32
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/ssi/imx_spi.c
23
--- a/docs/devel/kconfig.rst
34
+++ b/hw/ssi/imx_spi.c
24
+++ b/docs/devel/kconfig.rst
35
@@ -XXX,XX +XXX,XX @@ static void imx_spi_flush_txfifo(IMXSPIState *s)
25
@@ -XXX,XX +XXX,XX @@ or commenting out lines in the second group.
36
26
37
DPRINTF("data tx:0x%08x\n", tx);
27
It is also possible to run QEMU's configure script with the
38
28
``--without-default-devices`` option. When this is done, everything defaults
39
- tx_burst = MIN(s->burst_length, 32);
29
-to ``n`` unless it is ``select``ed or explicitly switched on in the
40
+ tx_burst = (s->burst_length % 32) ? : 32;
30
+to ``n`` unless it is ``select``\ ed or explicitly switched on in the
41
31
``.mak`` files. In other words, ``default`` and ``imply`` directives
42
rx = 0;
32
are disabled. When QEMU is built with this option, the user will probably
43
33
want to change some lines in the first group, for example like this::
44
--
34
--
45
2.20.1
35
2.34.1
46
36
47
37
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
So that we can avoid the "older gdb crashes" problem described in
2
commit 5787d17a42f7af4 and which caused us to disable reporting pauth
3
information via the gdbstub, newer gdb is going to implement support
4
for recognizing the pauth information via a new feature name:
5
org.gnu.gdb.aarch64.pauth_v2
2
6
3
Alexander reported an issue in gic_get_current_cpu() using the
7
Older gdb won't recognize this feature name, so we can re-enable the
4
fuzzer. Yet another "deref current_cpu with QTest" bug, reproducible
8
pauth support under the new name without risking them crashing.
5
doing:
6
9
7
$ echo readb 0xf03ff000 | qemu-system-arm -M npcm750-evb,accel=qtest -qtest stdio
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
[I 1611849440.651452] OPENED
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
[R +0.242498] readb 0xf03ff000
12
Message-id: 20230406150827.3322670-1-peter.maydell@linaro.org
10
hw/intc/arm_gic.c:63:29: runtime error: member access within null pointer of type 'CPUState' (aka 'struct CPUState')
13
---
11
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior hw/intc/arm_gic.c:63:29 in
14
target/arm/gdbstub.c | 9 ++++-----
12
AddressSanitizer:DEADLYSIGNAL
15
gdb-xml/aarch64-pauth.xml | 2 +-
13
=================================================================
16
2 files changed, 5 insertions(+), 6 deletions(-)
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
17
31
current_cpu is NULL because QTest accelerator does not use CPU.
18
diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c
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
19
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/intc/arm_gic.c
20
--- a/target/arm/gdbstub.c
50
+++ b/hw/intc/arm_gic.c
21
+++ b/target/arm/gdbstub.c
22
@@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
23
aarch64_gdb_set_fpu_reg,
24
34, "aarch64-fpu.xml", 0);
25
}
26
-#if 0
27
/*
28
- * GDB versions 9 through 12 have a bug which means they will
29
- * crash if they see this XML from QEMU; disable it for the 8.0
30
- * release, pending a better solution.
31
+ * Note that we report pauth information via the feature name
32
+ * org.gnu.gdb.aarch64.pauth_v2, not org.gnu.gdb.aarch64.pauth.
33
+ * GDB versions 9 through 12 have a bug where they will crash
34
+ * if they see the latter XML from QEMU.
35
*/
36
if (isar_feature_aa64_pauth(&cpu->isar)) {
37
gdb_register_coprocessor(cs, aarch64_gdb_get_pauth_reg,
38
aarch64_gdb_set_pauth_reg,
39
4, "aarch64-pauth.xml", 0);
40
}
41
-#endif
42
#endif
43
} else {
44
if (arm_feature(env, ARM_FEATURE_NEON)) {
45
diff --git a/gdb-xml/aarch64-pauth.xml b/gdb-xml/aarch64-pauth.xml
46
index XXXXXXX..XXXXXXX 100644
47
--- a/gdb-xml/aarch64-pauth.xml
48
+++ b/gdb-xml/aarch64-pauth.xml
51
@@ -XXX,XX +XXX,XX @@
49
@@ -XXX,XX +XXX,XX @@
52
#include "qemu/module.h"
50
notice and this notice are preserved. -->
53
#include "trace.h"
51
54
#include "sysemu/kvm.h"
52
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
55
+#include "sysemu/qtest.h"
53
-<feature name="org.gnu.gdb.aarch64.pauth">
56
54
+<feature name="org.gnu.gdb.aarch64.pauth_v2">
57
/* #define DEBUG_GIC */
55
<reg name="pauth_dmask" bitsize="64"/>
58
56
<reg name="pauth_cmask" bitsize="64"/>
59
@@ -XXX,XX +XXX,XX @@ static const uint8_t gic_id_gicv2[] = {
57
<reg name="pauth_dmask_high" bitsize="64"/>
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
--
58
--
69
2.20.1
59
2.34.1
70
71
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
When the block is disabled, only the ECSPI_CONREG register can
3
The SOC on i.MX6UL and i.MX7 has 2 Ethernet interfaces. The PHY on each may
4
be modified. Setting the EN bit enabled the device, clearing it
4
be connected to separate MDIO busses, or both may be connected on the same
5
"disables the block and resets the internal logic with the
5
MDIO bus using different PHY addresses. Commit 461c51ad4275 ("Add a phy-num
6
exception of the ECSPI_CONREG" register.
6
property to the i.MX FEC emulator") added support for specifying PHY
7
addresses, but it did not provide support for linking the second PHY on
8
a given MDIO bus to the other Ethernet interface.
7
9
8
Ignore all other registers write except ECSPI_CONREG when the
10
To be able to support two PHY instances on a single MDIO bus, two properties
9
block is disabled.
11
are needed: First, there needs to be a flag indicating if the MDIO bus on
12
a given Ethernet interface is connected. If not, attempts to read from this
13
bus must always return 0xffff. Implement this property as phy-connected.
14
Second, if the MDIO bus on an interface is active, it needs a link to the
15
consumer interface to be able to provide PHY access for it. Implement this
16
property as phy-consumer.
10
17
11
Ref: i.MX 6DQ Applications Processor Reference Manual (IMX6DQRM),
18
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12
chapter 21.7.3: Control Register (ECSPIx_CONREG)
19
Message-id: 20230315145248.1639364-2-linux@roeck-us.net
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>
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
22
---
23
hw/ssi/imx_spi.c | 13 +++++++++----
23
include/hw/net/imx_fec.h | 2 ++
24
1 file changed, 9 insertions(+), 4 deletions(-)
24
hw/net/imx_fec.c | 27 +++++++++++++++++++++++----
25
2 files changed, 25 insertions(+), 4 deletions(-)
25
26
26
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
27
diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h
27
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/ssi/imx_spi.c
29
--- a/include/hw/net/imx_fec.h
29
+++ b/hw/ssi/imx_spi.c
30
+++ b/include/hw/net/imx_fec.h
30
@@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value,
31
@@ -XXX,XX +XXX,XX @@ struct IMXFECState {
31
DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx_spi_reg_name(index),
32
uint32_t phy_int;
32
(uint32_t)value);
33
uint32_t phy_int_mask;
33
34
uint32_t phy_num;
34
+ if (!imx_spi_is_enabled(s)) {
35
+ bool phy_connected;
35
+ /* Block is disabled */
36
+ struct IMXFECState *phy_consumer;
36
+ if (index != ECSPI_CONREG) {
37
37
+ /* Ignore access */
38
bool is_fec;
39
40
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/net/imx_fec.c
43
+++ b/hw/net/imx_fec.c
44
@@ -XXX,XX +XXX,XX @@ static uint32_t imx_phy_read(IMXFECState *s, int reg)
45
uint32_t val;
46
uint32_t phy = reg / 32;
47
48
- if (phy != s->phy_num) {
49
- trace_imx_phy_read_num(phy, s->phy_num);
50
+ if (!s->phy_connected) {
51
return 0xffff;
52
}
53
54
+ if (phy != s->phy_num) {
55
+ if (s->phy_consumer && phy == s->phy_consumer->phy_num) {
56
+ s = s->phy_consumer;
57
+ } else {
58
+ trace_imx_phy_read_num(phy, s->phy_num);
59
+ return 0xffff;
60
+ }
61
+ }
62
+
63
reg %= 32;
64
65
switch (reg) {
66
@@ -XXX,XX +XXX,XX @@ static void imx_phy_write(IMXFECState *s, int reg, uint32_t val)
67
{
68
uint32_t phy = reg / 32;
69
70
- if (phy != s->phy_num) {
71
- trace_imx_phy_write_num(phy, s->phy_num);
72
+ if (!s->phy_connected) {
73
return;
74
}
75
76
+ if (phy != s->phy_num) {
77
+ if (s->phy_consumer && phy == s->phy_consumer->phy_num) {
78
+ s = s->phy_consumer;
79
+ } else {
80
+ trace_imx_phy_write_num(phy, s->phy_num);
38
+ return;
81
+ return;
39
+ }
82
+ }
40
+ }
83
+ }
41
+
84
+
42
change_mask = s->regs[index] ^ value;
85
reg %= 32;
43
86
44
switch (index) {
87
trace_imx_phy_write(val, phy, reg);
45
@@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value,
88
@@ -XXX,XX +XXX,XX @@ static Property imx_eth_properties[] = {
46
TYPE_IMX_SPI, __func__);
89
DEFINE_NIC_PROPERTIES(IMXFECState, conf),
47
break;
90
DEFINE_PROP_UINT32("tx-ring-num", IMXFECState, tx_ring_num, 1),
48
case ECSPI_TXDATA:
91
DEFINE_PROP_UINT32("phy-num", IMXFECState, phy_num, 0),
49
- if (!imx_spi_is_enabled(s)) {
92
+ DEFINE_PROP_BOOL("phy-connected", IMXFECState, phy_connected, true),
50
- /* Ignore writes if device is disabled */
93
+ DEFINE_PROP_LINK("phy-consumer", IMXFECState, phy_consumer, TYPE_IMX_FEC,
51
- break;
94
+ IMXFECState *),
52
- } else if (fifo32_is_full(&s->tx_fifo)) {
95
DEFINE_PROP_END_OF_LIST(),
53
+ if (fifo32_is_full(&s->tx_fifo)) {
96
};
54
/* Ignore writes if queue is full */
97
55
break;
56
}
57
--
98
--
58
2.20.1
99
2.34.1
59
60
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
Current implementation of the imx spi controller expects the burst
3
Add fec[12]-phy-connected properties and use it to set phy-connected
4
length to be multiple of 8, which is the most common use case.
4
and phy-consumer properties for imx_fec.
5
5
6
In case the burst length is not what we expect, log it to give user
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
a chance to notice it, and round it up to be multiple of 8.
7
Message-id: 20230315145248.1639364-3-linux@roeck-us.net
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>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
hw/ssi/imx_spi.c | 17 ++++++++++++++++-
11
include/hw/arm/fsl-imx6ul.h | 1 +
15
1 file changed, 16 insertions(+), 1 deletion(-)
12
hw/arm/fsl-imx6ul.c | 20 ++++++++++++++++++++
13
2 files changed, 21 insertions(+)
16
14
17
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
15
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/ssi/imx_spi.c
17
--- a/include/hw/arm/fsl-imx6ul.h
20
+++ b/hw/ssi/imx_spi.c
18
+++ b/include/hw/arm/fsl-imx6ul.h
21
@@ -XXX,XX +XXX,XX @@ static uint8_t imx_spi_selected_channel(IMXSPIState *s)
19
@@ -XXX,XX +XXX,XX @@ struct FslIMX6ULState {
22
20
MemoryRegion ocram_alias;
23
static uint32_t imx_spi_burst_length(IMXSPIState *s)
21
24
{
22
uint32_t phy_num[FSL_IMX6UL_NUM_ETHS];
25
- return EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + 1;
23
+ bool phy_connected[FSL_IMX6UL_NUM_ETHS];
26
+ uint32_t burst;
24
};
27
+
25
28
+ burst = EXTRACT(s->regs[ECSPI_CONREG], ECSPI_CONREG_BURST_LENGTH) + 1;
26
enum FslIMX6ULMemoryMap {
29
+ if (burst % 8) {
27
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
30
+ burst = ROUND_UP(burst, 8);
28
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/arm/fsl-imx6ul.c
30
+++ b/hw/arm/fsl-imx6ul.c
31
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
32
33
/*
34
* Ethernet
35
+ *
36
+ * We must use two loops since phy_connected affects the other interface
37
+ * and we have to set all properties before calling sysbus_realize().
38
*/
39
+ for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) {
40
+ object_property_set_bool(OBJECT(&s->eth[i]), "phy-connected",
41
+ s->phy_connected[i], &error_abort);
42
+ /*
43
+ * If the MDIO bus on this controller is not connected, assume the
44
+ * other controller provides support for it.
45
+ */
46
+ if (!s->phy_connected[i]) {
47
+ object_property_set_link(OBJECT(&s->eth[1 - i]), "phy-consumer",
48
+ OBJECT(&s->eth[i]), &error_abort);
49
+ }
31
+ }
50
+ }
32
+
51
+
33
+ return burst;
52
for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) {
34
}
53
static const hwaddr FSL_IMX6UL_ENETn_ADDR[FSL_IMX6UL_NUM_ETHS] = {
35
54
FSL_IMX6UL_ENET1_ADDR,
36
static bool imx_spi_is_enabled(IMXSPIState *s)
55
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
37
@@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value,
56
static Property fsl_imx6ul_properties[] = {
38
IMXSPIState *s = opaque;
57
DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0),
39
uint32_t index = offset >> 2;
58
DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1),
40
uint32_t change_mask;
59
+ DEFINE_PROP_BOOL("fec1-phy-connected", FslIMX6ULState, phy_connected[0],
41
+ uint32_t burst;
60
+ true),
42
61
+ DEFINE_PROP_BOOL("fec2-phy-connected", FslIMX6ULState, phy_connected[1],
43
if (index >= ECSPI_MAX) {
62
+ true),
44
qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
63
DEFINE_PROP_END_OF_LIST(),
45
@@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value,
64
};
46
case ECSPI_CONREG:
65
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);
54
+ }
55
+
56
if (!imx_spi_is_enabled(s)) {
57
/* device is disabled, so this is a soft reset */
58
imx_spi_soft_reset(s);
59
--
66
--
60
2.20.1
67
2.34.1
61
62
diff view generated by jsdifflib
1
From: Iris Johnson <iris@modwiz.com>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
When the frontend device has no space for a read the fd is removed
3
On mcimx6ul-evk, the MDIO bus is connected to the second Ethernet
4
from polling to allow time for the guest to read and clear the buffer.
4
interface. Set fec1-phy-connected to false to reflect this.
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
5
9
Buglink: https://bugs.launchpad.net/qemu/+bug/1913341
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
10
Signed-off-by: Iris Johnson <iris@modwiz.com>
7
Message-id: 20230315145248.1639364-4-linux@roeck-us.net
11
Message-id: 20210130184016.1787097-1-iris@modwiz.com
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
10
---
15
hw/char/exynos4210_uart.c | 1 +
11
hw/arm/mcimx6ul-evk.c | 2 ++
16
1 file changed, 1 insertion(+)
12
1 file changed, 2 insertions(+)
17
13
18
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
14
diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c
19
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/char/exynos4210_uart.c
16
--- a/hw/arm/mcimx6ul-evk.c
21
+++ b/hw/char/exynos4210_uart.c
17
+++ b/hw/arm/mcimx6ul-evk.c
22
@@ -XXX,XX +XXX,XX @@ static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
18
@@ -XXX,XX +XXX,XX @@ static void mcimx6ul_evk_init(MachineState *machine)
23
s->reg[I_(UTRSTAT)] &= ~UTRSTAT_Rx_BUFFER_DATA_READY;
19
object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
24
res = s->reg[I_(URXH)];
20
object_property_set_uint(OBJECT(s), "fec1-phy-num", 2, &error_fatal);
25
}
21
object_property_set_uint(OBJECT(s), "fec2-phy-num", 1, &error_fatal);
26
+ qemu_chr_fe_accept_input(&s->chr);
22
+ object_property_set_bool(OBJECT(s), "fec1-phy-connected", false,
27
exynos4210_uart_update_dmabusy(s);
23
+ &error_fatal);
28
trace_exynos_uart_read(s->channel, offset,
24
qdev_realize(DEVICE(s), NULL, &error_fatal);
29
exynos4210_uart_regname(offset), res);
25
26
memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR,
30
--
27
--
31
2.20.1
28
2.34.1
32
33
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
Avoid using a magic number (4) everywhere for the number of chip
3
Add fec[12]-phy-connected properties and use it to set phy-connected
4
selects supported.
4
and phy-consumer properties for imx_fec.
5
5
6
Signed-off-by: Bin Meng <bin.meng@windriver.com>
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-id: 20230315145248.1639364-5-linux@roeck-us.net
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Juan Quintela <quintela@redhat.com>
10
Message-id: 20210129132323.30946-2-bmeng.cn@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
10
---
13
include/hw/ssi/imx_spi.h | 5 ++++-
11
include/hw/arm/fsl-imx7.h | 1 +
14
hw/ssi/imx_spi.c | 4 ++--
12
hw/arm/fsl-imx7.c | 20 ++++++++++++++++++++
15
2 files changed, 6 insertions(+), 3 deletions(-)
13
2 files changed, 21 insertions(+)
16
14
17
diff --git a/include/hw/ssi/imx_spi.h b/include/hw/ssi/imx_spi.h
15
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/ssi/imx_spi.h
17
--- a/include/hw/arm/fsl-imx7.h
20
+++ b/include/hw/ssi/imx_spi.h
18
+++ b/include/hw/arm/fsl-imx7.h
21
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ struct FslIMX7State {
22
20
ChipideaState usb[FSL_IMX7_NUM_USBS];
23
#define EXTRACT(value, name) extract32(value, name##_SHIFT, name##_LENGTH)
21
DesignwarePCIEHost pcie;
24
22
uint32_t phy_num[FSL_IMX7_NUM_ETHS];
25
+/* number of chip selects supported */
23
+ bool phy_connected[FSL_IMX7_NUM_ETHS];
26
+#define ECSPI_NUM_CS 4
24
};
25
26
enum FslIMX7MemoryMap {
27
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/arm/fsl-imx7.c
30
+++ b/hw/arm/fsl-imx7.c
31
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
32
33
/*
34
* Ethernet
35
+ *
36
+ * We must use two loops since phy_connected affects the other interface
37
+ * and we have to set all properties before calling sysbus_realize().
38
*/
39
+ for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) {
40
+ object_property_set_bool(OBJECT(&s->eth[i]), "phy-connected",
41
+ s->phy_connected[i], &error_abort);
42
+ /*
43
+ * If the MDIO bus on this controller is not connected, assume the
44
+ * other controller provides support for it.
45
+ */
46
+ if (!s->phy_connected[i]) {
47
+ object_property_set_link(OBJECT(&s->eth[1 - i]), "phy-consumer",
48
+ OBJECT(&s->eth[i]), &error_abort);
49
+ }
50
+ }
27
+
51
+
28
#define TYPE_IMX_SPI "imx.spi"
52
for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) {
29
OBJECT_DECLARE_SIMPLE_TYPE(IMXSPIState, IMX_SPI)
53
static const hwaddr FSL_IMX7_ENETn_ADDR[FSL_IMX7_NUM_ETHS] = {
30
54
FSL_IMX7_ENET1_ADDR,
31
@@ -XXX,XX +XXX,XX @@ struct IMXSPIState {
55
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
32
56
static Property fsl_imx7_properties[] = {
33
qemu_irq irq;
57
DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0),
34
58
DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1),
35
- qemu_irq cs_lines[4];
59
+ DEFINE_PROP_BOOL("fec1-phy-connected", FslIMX7State, phy_connected[0],
36
+ qemu_irq cs_lines[ECSPI_NUM_CS];
60
+ true),
37
61
+ DEFINE_PROP_BOOL("fec2-phy-connected", FslIMX7State, phy_connected[1],
38
SSIBus *bus;
62
+ true),
39
63
DEFINE_PROP_END_OF_LIST(),
40
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
64
};
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/ssi/imx_spi.c
43
+++ b/hw/ssi/imx_spi.c
44
@@ -XXX,XX +XXX,XX @@ static void imx_spi_write(void *opaque, hwaddr offset, uint64_t value,
45
46
/* We are in master mode */
47
48
- for (i = 0; i < 4; i++) {
49
+ for (i = 0; i < ECSPI_NUM_CS; i++) {
50
qemu_set_irq(s->cs_lines[i],
51
i == imx_spi_selected_channel(s) ? 0 : 1);
52
}
53
@@ -XXX,XX +XXX,XX @@ static void imx_spi_realize(DeviceState *dev, Error **errp)
54
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
55
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
56
57
- for (i = 0; i < 4; ++i) {
58
+ for (i = 0; i < ECSPI_NUM_CS; ++i) {
59
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->cs_lines[i]);
60
}
61
65
62
--
66
--
63
2.20.1
67
2.34.1
64
65
diff view generated by jsdifflib
1
From: Iris Johnson <iris@modwiz.com>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
Currently the Exynos 4210 UART code always reports available FIFO space
3
On mcimx7d-sabre, the MDIO bus is connected to the first Ethernet
4
when the backend checks for buffer space. When the FIFO is disabled this
4
interface. Set fec2-phy-connected to false to reflect this.
5
is behavior causes the backend chardev code to replace the data before the
6
guest can read it.
7
5
8
This patch changes adds the logic to report the capacity properly when the
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
FIFO is not being used.
7
Message-id: 20230315145248.1639364-6-linux@roeck-us.net
10
11
Buglink: https://bugs.launchpad.net/qemu/+bug/1913344
12
Signed-off-by: Iris Johnson <iris@modwiz.com>
13
Message-id: 20210128033655.1029577-1-iris@modwiz.com
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
hw/char/exynos4210_uart.c | 6 +++++-
11
hw/arm/mcimx7d-sabre.c | 2 ++
18
1 file changed, 5 insertions(+), 1 deletion(-)
12
1 file changed, 2 insertions(+)
19
13
20
diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
14
diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/char/exynos4210_uart.c
16
--- a/hw/arm/mcimx7d-sabre.c
23
+++ b/hw/char/exynos4210_uart.c
17
+++ b/hw/arm/mcimx7d-sabre.c
24
@@ -XXX,XX +XXX,XX @@ static int exynos4210_uart_can_receive(void *opaque)
18
@@ -XXX,XX +XXX,XX @@ static void mcimx7d_sabre_init(MachineState *machine)
25
{
19
26
Exynos4210UartState *s = (Exynos4210UartState *)opaque;
20
s = FSL_IMX7(object_new(TYPE_FSL_IMX7));
27
21
object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
28
- return fifo_empty_elements_number(&s->rx);
22
+ object_property_set_bool(OBJECT(s), "fec2-phy-connected", false,
29
+ if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
23
+ &error_fatal);
30
+ return fifo_empty_elements_number(&s->rx);
24
qdev_realize(DEVICE(s), NULL, &error_fatal);
31
+ } else {
25
32
+ return !(s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY);
26
memory_region_add_subregion(get_system_memory(), FSL_IMX7_MMDC_ADDR,
33
+ }
34
}
35
36
static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int size)
37
--
27
--
38
2.20.1
28
2.34.1
39
40
diff view generated by jsdifflib