1
Nothing too exciting, but does include the last bits of v8.1M support work.
1
The following changes since commit 4cc10cae64c51e17844dc4358481c393d7bf1ed4:
2
2
3
-- PMM
3
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging (2021-05-06 18:56:17 +0100)
4
5
The following changes since commit e79de63ab1bd1f6550e7b915e433bec1ad1a870a:
6
7
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210107' into staging (2021-01-07 20:34:05 +0000)
8
4
9
are available in the Git repository at:
5
are available in the Git repository at:
10
6
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210108
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210510
12
8
13
for you to fetch changes up to c9f8511ea8d2b80723af0fea1f716d752c1b5208:
9
for you to fetch changes up to 8f96812baa53005f32aece3e30b140826c20aa19:
14
10
15
docs/system: arm: Add sabrelite board description (2021-01-08 15:13:39 +0000)
11
hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 (2021-05-10 13:24:09 +0100)
16
12
17
----------------------------------------------------------------
13
----------------------------------------------------------------
18
target-arm queue:
14
target-arm queue:
19
* intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs
15
* docs: fix link in sbsa description
20
* target/arm: Fix MTE0_ACTIVE
16
* linux-user/aarch64: Enable hwcap for RND, BTI, and MTE
21
* target/arm: Implement v8.1M and Cortex-M55 model
17
* target/arm: Fix tlbbits calculation in tlbi_aa64_vae2is_write()
22
* hw/arm/highbank: Drop dead KVM support code
18
* target/arm: Split neon and vfp translation to their own
23
* util/qemu-timer: Make timer_free() imply timer_del()
19
compilation units
24
* various devices: Use ptimer_free() in finalize function
20
* target/arm: Make WFI a NOP for userspace emulators
25
* docs/system: arm: Add sabrelite board description
21
* hw/sd/omap_mmc: Use device_cold_reset() instead of
26
* sabrelite: Minor fixes to allow booting U-Boot
22
device_legacy_reset()
23
* include: More fixes for 'extern "C"' block use
24
* hw/arm/imx25_pdk: Fix error message for invalid RAM size
25
* hw/arm/mps2-tz: Implement AN524 memory remapping via machine property
26
* hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
27
27
28
----------------------------------------------------------------
28
----------------------------------------------------------------
29
Andrew Jones (1):
29
Alex Bennée (1):
30
hw/arm/virt: Remove virt machine state 'smp_cpus'
30
docs: fix link in sbsa description
31
31
32
Bin Meng (4):
32
Guenter Roeck (1):
33
hw/misc: imx6_ccm: Update PMU_MISC0 reset value
33
hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
34
hw/msic: imx6_ccm: Correct register value for silicon type
35
hw/arm: sabrelite: Connect the Ethernet PHY at address 6
36
docs/system: arm: Add sabrelite board description
37
34
38
Edgar E. Iglesias (1):
35
Peter Maydell (22):
39
intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs
36
target/arm: Fix tlbbits calculation in tlbi_aa64_vae2is_write()
37
target/arm: Move constant expanders to translate.h
38
target/arm: Share unallocated_encoding() and gen_exception_insn()
39
target/arm: Make functions used by m-nocp global
40
target/arm: Split m-nocp trans functions into their own file
41
target/arm: Move gen_aa32 functions to translate-a32.h
42
target/arm: Move vfp_{load, store}_reg{32, 64} to translate-vfp.c.inc
43
target/arm: Make functions used by translate-vfp global
44
target/arm: Make translate-vfp.c.inc its own compilation unit
45
target/arm: Move vfp_reg_ptr() to translate-neon.c.inc
46
target/arm: Delete unused typedef
47
target/arm: Move NeonGenThreeOpEnvFn typedef to translate.h
48
target/arm: Make functions used by translate-neon global
49
target/arm: Make translate-neon.c.inc its own compilation unit
50
target/arm: Make WFI a NOP for userspace emulators
51
hw/sd/omap_mmc: Use device_cold_reset() instead of device_legacy_reset()
52
osdep: Make os-win32.h and os-posix.h handle 'extern "C"' themselves
53
include/qemu/bswap.h: Handle being included outside extern "C" block
54
include/disas/dis-asm.h: Handle being included outside 'extern "C"'
55
hw/misc/mps2-scc: Add "QEMU interface" comment
56
hw/misc/mps2-scc: Support using CFG0 bit 0 for remapping
57
hw/arm/mps2-tz: Implement AN524 memory remapping via machine property
40
58
41
Gan Qixin (7):
59
Philippe Mathieu-Daudé (1):
42
digic-timer: Use ptimer_free() in the finalize function to avoid memleaks
60
hw/arm/imx25_pdk: Fix error message for invalid RAM size
43
allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks
44
exynos4210_rtc: Use ptimer_free() in the finalize function to avoid memleaks
45
exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks
46
mss-timer: Use ptimer_free() in the finalize function to avoid memleaks
47
musicpal: Use ptimer_free() in the finalize function to avoid memleaks
48
exynos4210_mct: Use ptimer_free() in the finalize function to avoid memleaks
49
50
Peter Maydell (9):
51
hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN
52
target/arm: Correct store of FPSCR value via FPCXT_S
53
target/arm: Implement FPCXT_NS fp system register
54
target/arm: Implement Cortex-M55 model
55
hw/arm/highbank: Drop dead KVM support code
56
util/qemu-timer: Make timer_free() imply timer_del()
57
scripts/coccinelle: New script to remove unnecessary timer_del() calls
58
Remove superfluous timer_del() calls
59
target/arm: Remove timer_del()/timer_deinit() before timer_free()
60
61
61
Richard Henderson (1):
62
Richard Henderson (1):
62
target/arm: Fix MTE0_ACTIVE
63
linux-user/aarch64: Enable hwcap for RND, BTI, and MTE
63
64
64
docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++
65
docs/system/arm/mps2.rst | 10 +
65
docs/system/target-arm.rst | 1 +
66
docs/system/arm/sbsa.rst | 2 +-
66
scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++
67
include/disas/dis-asm.h | 12 +-
67
include/hw/arm/virt.h | 3 +-
68
include/hw/misc/mps2-scc.h | 21 ++
68
include/qemu/timer.h | 24 +++---
69
include/qemu/bswap.h | 26 ++-
69
block/iscsi.c | 2 -
70
include/qemu/osdep.h | 8 +-
70
block/nbd.c | 1 -
71
include/sysemu/os-posix.h | 8 +
71
block/qcow2.c | 1 -
72
include/sysemu/os-win32.h | 8 +
72
hw/arm/highbank.c | 14 +--
73
target/arm/translate-a32.h | 144 +++++++++++++
73
hw/arm/musicpal.c | 12 +++
74
target/arm/translate-a64.h | 2 -
74
hw/arm/sabrelite.c | 4 +
75
target/arm/translate.h | 29 +++
75
hw/arm/virt-acpi-build.c | 9 +-
76
hw/arm/imx25_pdk.c | 5 +-
76
hw/arm/virt.c | 21 +++--
77
hw/arm/mps2-tz.c | 108 +++++++++-
77
hw/block/nvme.c | 2 -
78
hw/arm/xilinx_zynq.c | 2 +-
78
hw/char/serial.c | 2 -
79
hw/misc/mps2-scc.c | 13 +-
79
hw/char/virtio-serial-bus.c | 2 -
80
hw/sd/omap_mmc.c | 2 +-
80
hw/ide/core.c | 1 -
81
linux-user/elfload.c | 13 ++
81
hw/input/hid.c | 1 -
82
target/arm/helper.c | 2 +-
82
hw/intc/apic.c | 1 -
83
target/arm/op_helper.c | 12 ++
83
hw/intc/arm_gic.c | 4 +-
84
target/arm/translate-a64.c | 15 --
84
hw/intc/armv7m_nvic.c | 15 ++++
85
target/arm/translate-m-nocp.c | 221 ++++++++++++++++++++
85
hw/intc/ioapic.c | 1 -
86
.../arm/{translate-neon.c.inc => translate-neon.c} | 19 +-
86
hw/ipmi/ipmi_bmc_extern.c | 1 -
87
.../arm/{translate-vfp.c.inc => translate-vfp.c} | 230 +++------------------
87
hw/misc/imx6_ccm.c | 4 +-
88
target/arm/translate.c | 200 ++++--------------
88
hw/net/e1000.c | 3 -
89
disas/arm-a64.cc | 2 -
89
hw/net/e1000e_core.c | 8 --
90
disas/nanomips.cpp | 2 -
90
hw/net/pcnet-pci.c | 1 -
91
target/arm/meson.build | 15 +-
91
hw/net/rtl8139.c | 1 -
92
27 files changed, 718 insertions(+), 413 deletions(-)
92
hw/net/spapr_llan.c | 1 -
93
create mode 100644 target/arm/translate-a32.h
93
hw/net/virtio-net.c | 2 -
94
create mode 100644 target/arm/translate-m-nocp.c
94
hw/rtc/exynos4210_rtc.c | 9 ++
95
rename target/arm/{translate-neon.c.inc => translate-neon.c} (99%)
95
hw/s390x/s390-pci-inst.c | 1 -
96
rename target/arm/{translate-vfp.c.inc => translate-vfp.c} (94%)
96
hw/sd/sd.c | 1 -
97
hw/sd/sdhci.c | 2 -
98
hw/timer/allwinner-a10-pit.c | 11 +++
99
hw/timer/digic-timer.c | 8 ++
100
hw/timer/exynos4210_mct.c | 14 +++
101
hw/timer/exynos4210_pwm.c | 11 +++
102
hw/timer/mss-timer.c | 13 +++
103
hw/usb/dev-hub.c | 1 -
104
hw/usb/hcd-ehci.c | 1 -
105
hw/usb/hcd-ohci-pci.c | 1 -
106
hw/usb/hcd-uhci.c | 1 -
107
hw/usb/hcd-xhci.c | 1 -
108
hw/usb/redirect.c | 1 -
109
hw/vfio/display.c | 1 -
110
hw/virtio/vhost-vsock-common.c | 1 -
111
hw/virtio/virtio-balloon.c | 1 -
112
hw/virtio/virtio-rng.c | 1 -
113
hw/watchdog/wdt_diag288.c | 1 -
114
hw/watchdog/wdt_i6300esb.c | 1 -
115
migration/colo.c | 1 -
116
monitor/hmp-cmds.c | 1 -
117
net/announce.c | 1 -
118
net/colo-compare.c | 1 -
119
net/slirp.c | 1 -
120
replay/replay-debugging.c | 1 -
121
target/arm/cpu.c | 2 -
122
target/arm/cpu_tcg.c | 42 +++++++++
123
target/arm/helper.c | 2 +-
124
target/s390x/cpu.c | 2 -
125
ui/console.c | 1 -
126
ui/spice-core.c | 1 -
127
util/throttle.c | 1 -
128
target/arm/translate-vfp.c.inc | 114 ++++++++++++++++++++++--
129
65 files changed, 421 insertions(+), 111 deletions(-)
130
create mode 100644 docs/system/arm/sabrelite.rst
131
create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci
132
97
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Currently when U-Boot boots, it prints "??" for i.MX processor:
3
A trailing _ makes all the difference to the rendered link.
4
4
5
CPU: Freescale i.MX?? rev1.0 at 792 MHz
5
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6
6
Message-id: 20210428131316.31390-1-alex.bennee@linaro.org
7
The register that was used to determine the silicon type is
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
undocumented in the latest IMX6DQRM (Rev. 6, 05/2020), but we
9
can refer to get_cpu_rev() in arch/arm/mach-imx/mx6/soc.c in
10
the U-Boot source codes that USB_ANALOG_DIGPROG is used.
11
12
Update its reset value to indicate i.MX6Q.
13
14
Signed-off-by: Bin Meng <bin.meng@windriver.com>
15
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
16
Message-id: 20210106063504.10841-3-bmeng.cn@gmail.com
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
9
---
19
hw/misc/imx6_ccm.c | 2 +-
10
docs/system/arm/sbsa.rst | 2 +-
20
1 file changed, 1 insertion(+), 1 deletion(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
21
12
22
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
13
diff --git a/docs/system/arm/sbsa.rst b/docs/system/arm/sbsa.rst
23
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/misc/imx6_ccm.c
15
--- a/docs/system/arm/sbsa.rst
25
+++ b/hw/misc/imx6_ccm.c
16
+++ b/docs/system/arm/sbsa.rst
26
@@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev)
17
@@ -XXX,XX +XXX,XX @@ Arm Server Base System Architecture Reference board (``sbsa-ref``)
27
s->analog[USB_ANALOG_USB2_VBUS_DETECT] = 0x00000004;
18
While the `virt` board is a generic board platform that doesn't match
28
s->analog[USB_ANALOG_USB2_CHRG_DETECT] = 0x00000000;
19
any real hardware the `sbsa-ref` board intends to look like real
29
s->analog[USB_ANALOG_USB2_MISC] = 0x00000002;
20
hardware. The `Server Base System Architecture
30
- s->analog[USB_ANALOG_DIGPROG] = 0x00000000;
21
-<https://developer.arm.com/documentation/den0029/latest>` defines a
31
+ s->analog[USB_ANALOG_DIGPROG] = 0x00630000;
22
+<https://developer.arm.com/documentation/den0029/latest>`_ defines a
32
23
minimum base line of hardware support and importantly how the firmware
33
/* all PLLs need to be locked */
24
reports that to any operating system. It is a static system that
34
s->analog[CCM_ANALOG_PLL_ARM] |= CCM_ANALOG_PLL_LOCK;
25
reports a very minimal DT to the firmware for non-discoverable
35
--
26
--
36
2.20.1
27
2.20.1
37
28
38
29
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
When running device-introspect-test, a memory leak occurred in the
3
These three features are already enabled by TCG, but are missing
4
mss_timer_init function, so use ptimer_free() in the finalize function to avoid
4
their hwcap bits. Update HWCAP2 from linux v5.12.
5
it.
6
5
7
ASAN shows memory leak stack:
6
Cc: qemu-stable@nongnu.org (for 6.0.1)
8
7
Buglink: https://bugs.launchpad.net/bugs/1926044
9
Indirect leak of 192 byte(s) in 2 object(s) allocated from:
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
9
Message-id: 20210427214108.88503-1-richard.henderson@linaro.org
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf58a0010 in mss_timer_init /qemu/hw/timer/mss-timer.c:235
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564
16
#6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547
17
#7 0xaaabf5b8316c in m2sxxx_soc_initfn /qemu/hw/arm/msf2-soc.c:70
18
#8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
19
#9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
20
#10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
21
#11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
22
#12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
11
---
29
hw/timer/mss-timer.c | 13 +++++++++++++
12
linux-user/elfload.c | 13 +++++++++++++
30
1 file changed, 13 insertions(+)
13
1 file changed, 13 insertions(+)
31
14
32
diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c
15
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
33
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/mss-timer.c
17
--- a/linux-user/elfload.c
35
+++ b/hw/timer/mss-timer.c
18
+++ b/linux-user/elfload.c
36
@@ -XXX,XX +XXX,XX @@ static void mss_timer_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ enum {
37
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &t->mmio);
20
ARM_HWCAP2_A64_SVESM4 = 1 << 6,
21
ARM_HWCAP2_A64_FLAGM2 = 1 << 7,
22
ARM_HWCAP2_A64_FRINT = 1 << 8,
23
+ ARM_HWCAP2_A64_SVEI8MM = 1 << 9,
24
+ ARM_HWCAP2_A64_SVEF32MM = 1 << 10,
25
+ ARM_HWCAP2_A64_SVEF64MM = 1 << 11,
26
+ ARM_HWCAP2_A64_SVEBF16 = 1 << 12,
27
+ ARM_HWCAP2_A64_I8MM = 1 << 13,
28
+ ARM_HWCAP2_A64_BF16 = 1 << 14,
29
+ ARM_HWCAP2_A64_DGH = 1 << 15,
30
+ ARM_HWCAP2_A64_RNG = 1 << 16,
31
+ ARM_HWCAP2_A64_BTI = 1 << 17,
32
+ ARM_HWCAP2_A64_MTE = 1 << 18,
33
};
34
35
#define ELF_HWCAP get_elf_hwcap()
36
@@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap2(void)
37
GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP);
38
GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2);
39
GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT);
40
+ GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG);
41
+ GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI);
42
+ GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE);
43
44
return hwcaps;
38
}
45
}
39
40
+static void mss_timer_finalize(Object *obj)
41
+{
42
+ MSSTimerState *t = MSS_TIMER(obj);
43
+ int i;
44
+
45
+ for (i = 0; i < NUM_TIMERS; i++) {
46
+ struct Msf2Timer *st = &t->timers[i];
47
+
48
+ ptimer_free(st->ptimer);
49
+ }
50
+}
51
+
52
static const VMStateDescription vmstate_timers = {
53
.name = "mss-timer-block",
54
.version_id = 1,
55
@@ -XXX,XX +XXX,XX @@ static const TypeInfo mss_timer_info = {
56
.parent = TYPE_SYS_BUS_DEVICE,
57
.instance_size = sizeof(MSSTimerState),
58
.instance_init = mss_timer_init,
59
+ .instance_finalize = mss_timer_finalize,
60
.class_init = mss_timer_class_init,
61
};
62
63
--
46
--
64
2.20.1
47
2.20.1
65
48
66
49
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In tlbi_aa64_vae2is_write() the calculation
2
bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_E2 : ARMMMUIdx_SE2,
3
pageaddr)
2
4
3
In 50244cc76abc we updated mte_check_fail to match the ARM
5
has the two arms of the ?: expression reversed. Fix the bug.
4
pseudocode, using the correct EL to select the TCF field.
5
But we failed to update MTE0_ACTIVE the same way, which led
6
to g_assert_not_reached().
7
6
8
Cc: qemu-stable@nongnu.org
7
Fixes: b6ad6062f1e5
9
Buglink: https://bugs.launchpad.net/bugs/1907137
8
Reported-by: Rebecca Cran <rebecca@nuviainc.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20201221204426.88514-1-richard.henderson@linaro.org
12
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>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Reviewed-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
12
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
13
Message-id: 20210420123106.10861-1-peter.maydell@linaro.org
14
---
14
---
15
target/arm/helper.c | 2 +-
15
target/arm/helper.c | 2 +-
16
1 file changed, 1 insertion(+), 1 deletion(-)
16
1 file changed, 1 insertion(+), 1 deletion(-)
17
17
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/helper.c
20
--- a/target/arm/helper.c
21
+++ b/target/arm/helper.c
21
+++ b/target/arm/helper.c
22
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
22
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae2is_write(CPUARMState *env, const ARMCPRegInfo *ri,
23
if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV)
23
uint64_t pageaddr = sextract64(value << 12, 0, 56);
24
&& tbid
24
bool secure = arm_is_secure_below_el3(env);
25
&& !(env->pstate & PSTATE_TCO)
25
int mask = secure ? ARMMMUIdxBit_SE2 : ARMMMUIdxBit_E2;
26
- && (sctlr & SCTLR_TCF0)
26
- int bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_E2 : ARMMMUIdx_SE2,
27
+ && (sctlr & SCTLR_TCF)
27
+ int bits = tlbbits_for_regime(env, secure ? ARMMMUIdx_SE2 : ARMMMUIdx_E2,
28
&& allocation_tag_access_enabled(env, 0, sctlr)) {
28
pageaddr);
29
flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1);
29
30
}
30
tlb_flush_page_bits_by_mmuidx_all_cpus_synced(cs, pageaddr, mask, bits);
31
--
31
--
32
2.20.1
32
2.20.1
33
33
34
34
diff view generated by jsdifflib
New patch
1
Some of the constant expanders defined in translate.c are generically
2
useful and will be used by the separate C files for VFP and Neon once
3
they are created; move the expander definitions to translate.h.
1
4
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20210430132740.10391-2-peter.maydell@linaro.org
9
---
10
target/arm/translate.h | 24 ++++++++++++++++++++++++
11
target/arm/translate.c | 24 ------------------------
12
2 files changed, 24 insertions(+), 24 deletions(-)
13
14
diff --git a/target/arm/translate.h b/target/arm/translate.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.h
17
+++ b/target/arm/translate.h
18
@@ -XXX,XX +XXX,XX @@ extern TCGv_i32 cpu_NF, cpu_ZF, cpu_CF, cpu_VF;
19
extern TCGv_i64 cpu_exclusive_addr;
20
extern TCGv_i64 cpu_exclusive_val;
21
22
+/*
23
+ * Constant expanders for the decoders.
24
+ */
25
+
26
+static inline int negate(DisasContext *s, int x)
27
+{
28
+ return -x;
29
+}
30
+
31
+static inline int plus_2(DisasContext *s, int x)
32
+{
33
+ return x + 2;
34
+}
35
+
36
+static inline int times_2(DisasContext *s, int x)
37
+{
38
+ return x * 2;
39
+}
40
+
41
+static inline int times_4(DisasContext *s, int x)
42
+{
43
+ return x * 4;
44
+}
45
+
46
static inline int arm_dc_feature(DisasContext *dc, int feature)
47
{
48
return (dc->features & (1ULL << feature)) != 0;
49
diff --git a/target/arm/translate.c b/target/arm/translate.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/translate.c
52
+++ b/target/arm/translate.c
53
@@ -XXX,XX +XXX,XX @@ static void arm_gen_condlabel(DisasContext *s)
54
}
55
}
56
57
-/*
58
- * Constant expanders for the decoders.
59
- */
60
-
61
-static int negate(DisasContext *s, int x)
62
-{
63
- return -x;
64
-}
65
-
66
-static int plus_2(DisasContext *s, int x)
67
-{
68
- return x + 2;
69
-}
70
-
71
-static int times_2(DisasContext *s, int x)
72
-{
73
- return x * 2;
74
-}
75
-
76
-static int times_4(DisasContext *s, int x)
77
-{
78
- return x * 4;
79
-}
80
-
81
/* Flags for the disas_set_da_iss info argument:
82
* lower bits hold the Rt register number, higher bits are flags.
83
*/
84
--
85
2.20.1
86
87
diff view generated by jsdifflib
New patch
1
The unallocated_encoding() function is the same in both
2
translate-a64.c and translate.c; make the translate.c function global
3
and drop the translate-a64.c version. To do this we need to also
4
share gen_exception_insn(), which currently exists in two slightly
5
different versions for A32 and A64: merge those into a single
6
function that can work for both.
1
7
8
This will be useful for splitting up translate.c, which will require
9
unallocated_encoding() to no longer be file-local. It's also
10
hopefully less confusing to have only one version of the function
11
rather than two.
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20210430132740.10391-3-peter.maydell@linaro.org
16
---
17
target/arm/translate-a64.h | 2 --
18
target/arm/translate.h | 3 +++
19
target/arm/translate-a64.c | 15 ---------------
20
target/arm/translate.c | 14 +++++++++-----
21
4 files changed, 12 insertions(+), 22 deletions(-)
22
23
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/translate-a64.h
26
+++ b/target/arm/translate-a64.h
27
@@ -XXX,XX +XXX,XX @@
28
#ifndef TARGET_ARM_TRANSLATE_A64_H
29
#define TARGET_ARM_TRANSLATE_A64_H
30
31
-void unallocated_encoding(DisasContext *s);
32
-
33
#define unsupported_encoding(s, insn) \
34
do { \
35
qemu_log_mask(LOG_UNIMP, \
36
diff --git a/target/arm/translate.h b/target/arm/translate.h
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/translate.h
39
+++ b/target/arm/translate.h
40
@@ -XXX,XX +XXX,XX @@ void arm_free_cc(DisasCompare *cmp);
41
void arm_jump_cc(DisasCompare *cmp, TCGLabel *label);
42
void arm_gen_test_cc(int cc, TCGLabel *label);
43
MemOp pow2_align(unsigned i);
44
+void unallocated_encoding(DisasContext *s);
45
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
46
+ uint32_t syn, uint32_t target_el);
47
48
/* Return state of Alternate Half-precision flag, caller frees result */
49
static inline TCGv_i32 get_ahp_flag(void)
50
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/translate-a64.c
53
+++ b/target/arm/translate-a64.c
54
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp)
55
s->base.is_jmp = DISAS_NORETURN;
56
}
57
58
-static void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
59
- uint32_t syndrome, uint32_t target_el)
60
-{
61
- gen_a64_set_pc_im(pc);
62
- gen_exception(excp, syndrome, target_el);
63
- s->base.is_jmp = DISAS_NORETURN;
64
-}
65
-
66
static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syndrome)
67
{
68
TCGv_i32 tcg_syn;
69
@@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
70
}
71
}
72
73
-void unallocated_encoding(DisasContext *s)
74
-{
75
- /* Unallocated and reserved encodings are uncategorized */
76
- gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
77
- default_exception_el(s));
78
-}
79
-
80
static void init_tmp_a64_array(DisasContext *s)
81
{
82
#ifdef CONFIG_DEBUG_TCG
83
diff --git a/target/arm/translate.c b/target/arm/translate.c
84
index XXXXXXX..XXXXXXX 100644
85
--- a/target/arm/translate.c
86
+++ b/target/arm/translate.c
87
@@ -XXX,XX +XXX,XX @@ static void gen_exception_internal_insn(DisasContext *s, uint32_t pc, int excp)
88
s->base.is_jmp = DISAS_NORETURN;
89
}
90
91
-static void gen_exception_insn(DisasContext *s, uint32_t pc, int excp,
92
- int syn, uint32_t target_el)
93
+void gen_exception_insn(DisasContext *s, uint64_t pc, int excp,
94
+ uint32_t syn, uint32_t target_el)
95
{
96
- gen_set_condexec(s);
97
- gen_set_pc_im(s, pc);
98
+ if (s->aarch64) {
99
+ gen_a64_set_pc_im(pc);
100
+ } else {
101
+ gen_set_condexec(s);
102
+ gen_set_pc_im(s, pc);
103
+ }
104
gen_exception(excp, syn, target_el);
105
s->base.is_jmp = DISAS_NORETURN;
106
}
107
@@ -XXX,XX +XXX,XX @@ static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn)
108
s->base.is_jmp = DISAS_NORETURN;
109
}
110
111
-static void unallocated_encoding(DisasContext *s)
112
+void unallocated_encoding(DisasContext *s)
113
{
114
/* Unallocated and reserved encodings are uncategorized */
115
gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(),
116
--
117
2.20.1
118
119
diff view generated by jsdifflib
1
In commit 64f863baeedc8659 we implemented the v8.1M FPCXT_S register,
1
We want to split out the .c.inc files which are currently included
2
but we got the write behaviour wrong. On read, this register reads
2
into translate.c so they are separate compilation units. To do this
3
bits [27:0] of FPSCR plus the CONTROL.SFPA bit. On write, it doesn't
3
we need to make some functions which are currently file-local to
4
just write back those bits -- it writes a value to the whole FPSCR,
4
translate.c have global scope; create a translate-a32.h paralleling
5
whose upper 4 bits are zeroes.
5
the existing translate-a64.h as a place for these declarations to
6
6
live, so that code moved into the new compilation units can call
7
We also incorrectly implemented the write-to-FPSCR as a simple store
7
them.
8
to vfp.xregs; this skips the "update the softfloat flags" part of
8
9
the vfp_set_fpscr helper so the value would read back correctly but
9
The functions made global here are those required by the
10
not actually take effect.
10
m-nocp.decode functions, except that I have converted the whole
11
11
family of {read,write}_neon_element* and also both the load_cpu and
12
Fix both of these things by doing a complete write to the FPSCR
12
store_cpu functions for consistency, even though m-nocp only wants a
13
using the helper function.
13
few functions from each.
14
14
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20201210201433.26262-3-peter.maydell@linaro.org
17
Message-id: 20210430132740.10391-4-peter.maydell@linaro.org
18
---
18
---
19
target/arm/translate-vfp.c.inc | 12 ++++++------
19
target/arm/translate-a32.h | 57 ++++++++++++++++++++++++++++++++++
20
1 file changed, 6 insertions(+), 6 deletions(-)
20
target/arm/translate.c | 39 +++++------------------
21
21
target/arm/translate-vfp.c.inc | 2 +-
22
3 files changed, 65 insertions(+), 33 deletions(-)
23
create mode 100644 target/arm/translate-a32.h
24
25
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
26
new file mode 100644
27
index XXXXXXX..XXXXXXX
28
--- /dev/null
29
+++ b/target/arm/translate-a32.h
30
@@ -XXX,XX +XXX,XX @@
31
+/*
32
+ * AArch32 translation, common definitions.
33
+ *
34
+ * Copyright (c) 2021 Linaro, Ltd.
35
+ *
36
+ * This library is free software; you can redistribute it and/or
37
+ * modify it under the terms of the GNU Lesser General Public
38
+ * License as published by the Free Software Foundation; either
39
+ * version 2.1 of the License, or (at your option) any later version.
40
+ *
41
+ * This library 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 GNU
44
+ * Lesser General Public License for more details.
45
+ *
46
+ * You should have received a copy of the GNU Lesser General Public
47
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
48
+ */
49
+
50
+#ifndef TARGET_ARM_TRANSLATE_A64_H
51
+#define TARGET_ARM_TRANSLATE_A64_H
52
+
53
+void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
54
+void arm_gen_condlabel(DisasContext *s);
55
+bool vfp_access_check(DisasContext *s);
56
+void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop);
57
+void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop);
58
+void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop);
59
+void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop);
60
+
61
+static inline TCGv_i32 load_cpu_offset(int offset)
62
+{
63
+ TCGv_i32 tmp = tcg_temp_new_i32();
64
+ tcg_gen_ld_i32(tmp, cpu_env, offset);
65
+ return tmp;
66
+}
67
+
68
+#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
69
+
70
+static inline void store_cpu_offset(TCGv_i32 var, int offset)
71
+{
72
+ tcg_gen_st_i32(var, cpu_env, offset);
73
+ tcg_temp_free_i32(var);
74
+}
75
+
76
+#define store_cpu_field(var, name) \
77
+ store_cpu_offset(var, offsetof(CPUARMState, name))
78
+
79
+/* Create a new temporary and set it to the value of a CPU register. */
80
+static inline TCGv_i32 load_reg(DisasContext *s, int reg)
81
+{
82
+ TCGv_i32 tmp = tcg_temp_new_i32();
83
+ load_reg_var(s, tmp, reg);
84
+ return tmp;
85
+}
86
+
87
+#endif
88
diff --git a/target/arm/translate.c b/target/arm/translate.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/target/arm/translate.c
91
+++ b/target/arm/translate.c
92
@@ -XXX,XX +XXX,XX @@
93
#define ENABLE_ARCH_8 arm_dc_feature(s, ARM_FEATURE_V8)
94
95
#include "translate.h"
96
+#include "translate-a32.h"
97
98
#if defined(CONFIG_USER_ONLY)
99
#define IS_USER(s) 1
100
@@ -XXX,XX +XXX,XX @@ void arm_translate_init(void)
101
}
102
103
/* Generate a label used for skipping this instruction */
104
-static void arm_gen_condlabel(DisasContext *s)
105
+void arm_gen_condlabel(DisasContext *s)
106
{
107
if (!s->condjmp) {
108
s->condlabel = gen_new_label();
109
@@ -XXX,XX +XXX,XX @@ static inline int get_a32_user_mem_index(DisasContext *s)
110
}
111
}
112
113
-static inline TCGv_i32 load_cpu_offset(int offset)
114
-{
115
- TCGv_i32 tmp = tcg_temp_new_i32();
116
- tcg_gen_ld_i32(tmp, cpu_env, offset);
117
- return tmp;
118
-}
119
-
120
-#define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
121
-
122
-static inline void store_cpu_offset(TCGv_i32 var, int offset)
123
-{
124
- tcg_gen_st_i32(var, cpu_env, offset);
125
- tcg_temp_free_i32(var);
126
-}
127
-
128
-#define store_cpu_field(var, name) \
129
- store_cpu_offset(var, offsetof(CPUARMState, name))
130
-
131
/* The architectural value of PC. */
132
static uint32_t read_pc(DisasContext *s)
133
{
134
@@ -XXX,XX +XXX,XX @@ static uint32_t read_pc(DisasContext *s)
135
}
136
137
/* Set a variable to the value of a CPU register. */
138
-static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
139
+void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
140
{
141
if (reg == 15) {
142
tcg_gen_movi_i32(var, read_pc(s));
143
@@ -XXX,XX +XXX,XX @@ static void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
144
}
145
}
146
147
-/* Create a new temporary and set it to the value of a CPU register. */
148
-static inline TCGv_i32 load_reg(DisasContext *s, int reg)
149
-{
150
- TCGv_i32 tmp = tcg_temp_new_i32();
151
- load_reg_var(s, tmp, reg);
152
- return tmp;
153
-}
154
-
155
/*
156
* Create a new temp, REG + OFS, except PC is ALIGN(PC, 4).
157
* This is used for load/store for which use of PC implies (literal),
158
@@ -XXX,XX +XXX,XX @@ static inline void vfp_store_reg32(TCGv_i32 var, int reg)
159
tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
160
}
161
162
-static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
163
+void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
164
{
165
long off = neon_element_offset(reg, ele, memop);
166
167
@@ -XXX,XX +XXX,XX @@ static void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
168
}
169
}
170
171
-static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
172
+void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
173
{
174
long off = neon_element_offset(reg, ele, memop);
175
176
@@ -XXX,XX +XXX,XX @@ static void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop)
177
}
178
}
179
180
-static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
181
+void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
182
{
183
long off = neon_element_offset(reg, ele, memop);
184
185
@@ -XXX,XX +XXX,XX @@ static void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop)
186
}
187
}
188
189
-static void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
190
+void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
191
{
192
long off = neon_element_offset(reg, ele, memop);
193
22
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
194
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
23
index XXXXXXX..XXXXXXX 100644
195
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/translate-vfp.c.inc
196
--- a/target/arm/translate-vfp.c.inc
25
+++ b/target/arm/translate-vfp.c.inc
197
+++ b/target/arm/translate-vfp.c.inc
26
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
198
@@ -XXX,XX +XXX,XX @@ static bool full_vfp_access_check(DisasContext *s, bool ignore_vfp_enabled)
27
}
199
* The most usual kind of VFP access check, for everything except
28
case ARM_VFP_FPCXT_S:
200
* FMXR/FMRX to the always-available special registers.
29
{
201
*/
30
- TCGv_i32 sfpa, control, fpscr;
202
-static bool vfp_access_check(DisasContext *s)
31
- /* Set FPSCR[27:0] and CONTROL.SFPA from value */
203
+bool vfp_access_check(DisasContext *s)
32
+ TCGv_i32 sfpa, control;
204
{
33
+ /*
205
return full_vfp_access_check(s, false);
34
+ * Set FPSCR and CONTROL.SFPA from value; the new FPSCR takes
206
}
35
+ * bits [27:0] from value and zeroes bits [31:28].
36
+ */
37
tmp = loadfn(s, opaque);
38
sfpa = tcg_temp_new_i32();
39
tcg_gen_shri_i32(sfpa, tmp, 31);
40
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
41
tcg_gen_deposit_i32(control, control, sfpa,
42
R_V7M_CONTROL_SFPA_SHIFT, 1);
43
store_cpu_field(control, v7m.control[M_REG_S]);
44
- fpscr = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]);
45
- tcg_gen_andi_i32(fpscr, fpscr, FPCR_NZCV_MASK);
46
tcg_gen_andi_i32(tmp, tmp, ~FPCR_NZCV_MASK);
47
- tcg_gen_or_i32(fpscr, fpscr, tmp);
48
- store_cpu_field(fpscr, vfp.xregs[ARM_VFP_FPSCR]);
49
+ gen_helper_vfp_set_fpscr(cpu_env, tmp);
50
tcg_temp_free_i32(tmp);
51
tcg_temp_free_i32(sfpa);
52
break;
53
--
207
--
54
2.20.1
208
2.20.1
55
209
56
210
diff view generated by jsdifflib
1
Implement the v8.1M FPCXT_NS floating-point system register. This is
1
Currently the trans functions for m-nocp.decode all live in
2
a little more complicated than FPCXT_S, because it has specific
2
translate-vfp.inc.c; move them out into their own translation unit,
3
handling for "current FP state is inactive", and it only wants to do
3
translate-m-nocp.c.
4
PreserveFPState(), not the full set of actions done by
4
5
ExecuteFPCheck() which vfp_access_check() implements.
5
The trans_* functions here are pure code motion with no changes.
6
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201210201433.26262-4-peter.maydell@linaro.org
9
Message-id: 20210430132740.10391-5-peter.maydell@linaro.org
10
---
10
---
11
target/arm/translate-vfp.c.inc | 102 ++++++++++++++++++++++++++++++++-
11
target/arm/translate-a32.h | 3 +
12
1 file changed, 99 insertions(+), 3 deletions(-)
12
target/arm/translate-m-nocp.c | 221 +++++++++++++++++++++++++++++++++
13
target/arm/translate.c | 1 -
14
target/arm/translate-vfp.c.inc | 196 -----------------------------
15
target/arm/meson.build | 3 +-
16
5 files changed, 226 insertions(+), 198 deletions(-)
17
create mode 100644 target/arm/translate-m-nocp.c
13
18
19
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate-a32.h
22
+++ b/target/arm/translate-a32.h
23
@@ -XXX,XX +XXX,XX @@
24
#ifndef TARGET_ARM_TRANSLATE_A64_H
25
#define TARGET_ARM_TRANSLATE_A64_H
26
27
+/* Prototypes for autogenerated disassembler functions */
28
+bool disas_m_nocp(DisasContext *dc, uint32_t insn);
29
+
30
void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
31
void arm_gen_condlabel(DisasContext *s);
32
bool vfp_access_check(DisasContext *s);
33
diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c
34
new file mode 100644
35
index XXXXXXX..XXXXXXX
36
--- /dev/null
37
+++ b/target/arm/translate-m-nocp.c
38
@@ -XXX,XX +XXX,XX @@
39
+/*
40
+ * ARM translation: M-profile NOCP special-case instructions
41
+ *
42
+ * Copyright (c) 2020 Linaro, Ltd.
43
+ *
44
+ * This library is free software; you can redistribute it and/or
45
+ * modify it under the terms of the GNU Lesser General Public
46
+ * License as published by the Free Software Foundation; either
47
+ * version 2.1 of the License, or (at your option) any later version.
48
+ *
49
+ * This library is distributed in the hope that it will be useful,
50
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
51
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
52
+ * Lesser General Public License for more details.
53
+ *
54
+ * You should have received a copy of the GNU Lesser General Public
55
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
56
+ */
57
+
58
+#include "qemu/osdep.h"
59
+#include "tcg/tcg-op.h"
60
+#include "translate.h"
61
+#include "translate-a32.h"
62
+
63
+#include "decode-m-nocp.c.inc"
64
+
65
+/*
66
+ * Decode VLLDM and VLSTM are nonstandard because:
67
+ * * if there is no FPU then these insns must NOP in
68
+ * Secure state and UNDEF in Nonsecure state
69
+ * * if there is an FPU then these insns do not have
70
+ * the usual behaviour that vfp_access_check() provides of
71
+ * being controlled by CPACR/NSACR enable bits or the
72
+ * lazy-stacking logic.
73
+ */
74
+static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a)
75
+{
76
+ TCGv_i32 fptr;
77
+
78
+ if (!arm_dc_feature(s, ARM_FEATURE_M) ||
79
+ !arm_dc_feature(s, ARM_FEATURE_V8)) {
80
+ return false;
81
+ }
82
+
83
+ if (a->op) {
84
+ /*
85
+ * T2 encoding ({D0-D31} reglist): v8.1M and up. We choose not
86
+ * to take the IMPDEF option to make memory accesses to the stack
87
+ * slots that correspond to the D16-D31 registers (discarding
88
+ * read data and writing UNKNOWN values), so for us the T2
89
+ * encoding behaves identically to the T1 encoding.
90
+ */
91
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
92
+ return false;
93
+ }
94
+ } else {
95
+ /*
96
+ * T1 encoding ({D0-D15} reglist); undef if we have 32 Dregs.
97
+ * This is currently architecturally impossible, but we add the
98
+ * check to stay in line with the pseudocode. Note that we must
99
+ * emit code for the UNDEF so it takes precedence over the NOCP.
100
+ */
101
+ if (dc_isar_feature(aa32_simd_r32, s)) {
102
+ unallocated_encoding(s);
103
+ return true;
104
+ }
105
+ }
106
+
107
+ /*
108
+ * If not secure, UNDEF. We must emit code for this
109
+ * rather than returning false so that this takes
110
+ * precedence over the m-nocp.decode NOCP fallback.
111
+ */
112
+ if (!s->v8m_secure) {
113
+ unallocated_encoding(s);
114
+ return true;
115
+ }
116
+ /* If no fpu, NOP. */
117
+ if (!dc_isar_feature(aa32_vfp, s)) {
118
+ return true;
119
+ }
120
+
121
+ fptr = load_reg(s, a->rn);
122
+ if (a->l) {
123
+ gen_helper_v7m_vlldm(cpu_env, fptr);
124
+ } else {
125
+ gen_helper_v7m_vlstm(cpu_env, fptr);
126
+ }
127
+ tcg_temp_free_i32(fptr);
128
+
129
+ /* End the TB, because we have updated FP control bits */
130
+ s->base.is_jmp = DISAS_UPDATE_EXIT;
131
+ return true;
132
+}
133
+
134
+static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a)
135
+{
136
+ int btmreg, topreg;
137
+ TCGv_i64 zero;
138
+ TCGv_i32 aspen, sfpa;
139
+
140
+ if (!dc_isar_feature(aa32_m_sec_state, s)) {
141
+ /* Before v8.1M, fall through in decode to NOCP check */
142
+ return false;
143
+ }
144
+
145
+ /* Explicitly UNDEF because this takes precedence over NOCP */
146
+ if (!arm_dc_feature(s, ARM_FEATURE_M_MAIN) || !s->v8m_secure) {
147
+ unallocated_encoding(s);
148
+ return true;
149
+ }
150
+
151
+ if (!dc_isar_feature(aa32_vfp_simd, s)) {
152
+ /* NOP if we have neither FP nor MVE */
153
+ return true;
154
+ }
155
+
156
+ /*
157
+ * If FPCCR.ASPEN != 0 && CONTROL_S.SFPA == 0 then there is no
158
+ * active floating point context so we must NOP (without doing
159
+ * any lazy state preservation or the NOCP check).
160
+ */
161
+ aspen = load_cpu_field(v7m.fpccr[M_REG_S]);
162
+ sfpa = load_cpu_field(v7m.control[M_REG_S]);
163
+ tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
164
+ tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
165
+ tcg_gen_andi_i32(sfpa, sfpa, R_V7M_CONTROL_SFPA_MASK);
166
+ tcg_gen_or_i32(sfpa, sfpa, aspen);
167
+ arm_gen_condlabel(s);
168
+ tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel);
169
+
170
+ if (s->fp_excp_el != 0) {
171
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
172
+ syn_uncategorized(), s->fp_excp_el);
173
+ return true;
174
+ }
175
+
176
+ topreg = a->vd + a->imm - 1;
177
+ btmreg = a->vd;
178
+
179
+ /* Convert to Sreg numbers if the insn specified in Dregs */
180
+ if (a->size == 3) {
181
+ topreg = topreg * 2 + 1;
182
+ btmreg *= 2;
183
+ }
184
+
185
+ if (topreg > 63 || (topreg > 31 && !(topreg & 1))) {
186
+ /* UNPREDICTABLE: we choose to undef */
187
+ unallocated_encoding(s);
188
+ return true;
189
+ }
190
+
191
+ /* Silently ignore requests to clear D16-D31 if they don't exist */
192
+ if (topreg > 31 && !dc_isar_feature(aa32_simd_r32, s)) {
193
+ topreg = 31;
194
+ }
195
+
196
+ if (!vfp_access_check(s)) {
197
+ return true;
198
+ }
199
+
200
+ /* Zero the Sregs from btmreg to topreg inclusive. */
201
+ zero = tcg_const_i64(0);
202
+ if (btmreg & 1) {
203
+ write_neon_element64(zero, btmreg >> 1, 1, MO_32);
204
+ btmreg++;
205
+ }
206
+ for (; btmreg + 1 <= topreg; btmreg += 2) {
207
+ write_neon_element64(zero, btmreg >> 1, 0, MO_64);
208
+ }
209
+ if (btmreg == topreg) {
210
+ write_neon_element64(zero, btmreg >> 1, 0, MO_32);
211
+ btmreg++;
212
+ }
213
+ assert(btmreg == topreg + 1);
214
+ /* TODO: when MVE is implemented, zero VPR here */
215
+ return true;
216
+}
217
+
218
+static bool trans_NOCP(DisasContext *s, arg_nocp *a)
219
+{
220
+ /*
221
+ * Handle M-profile early check for disabled coprocessor:
222
+ * all we need to do here is emit the NOCP exception if
223
+ * the coprocessor is disabled. Otherwise we return false
224
+ * and the real VFP/etc decode will handle the insn.
225
+ */
226
+ assert(arm_dc_feature(s, ARM_FEATURE_M));
227
+
228
+ if (a->cp == 11) {
229
+ a->cp = 10;
230
+ }
231
+ if (arm_dc_feature(s, ARM_FEATURE_V8_1M) &&
232
+ (a->cp == 8 || a->cp == 9 || a->cp == 14 || a->cp == 15)) {
233
+ /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */
234
+ a->cp = 10;
235
+ }
236
+
237
+ if (a->cp != 10) {
238
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
239
+ syn_uncategorized(), default_exception_el(s));
240
+ return true;
241
+ }
242
+
243
+ if (s->fp_excp_el != 0) {
244
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
245
+ syn_uncategorized(), s->fp_excp_el);
246
+ return true;
247
+ }
248
+
249
+ return false;
250
+}
251
+
252
+static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a)
253
+{
254
+ /* This range needs a coprocessor check for v8.1M and later only */
255
+ if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
256
+ return false;
257
+ }
258
+ return trans_NOCP(s, a);
259
+}
260
diff --git a/target/arm/translate.c b/target/arm/translate.c
261
index XXXXXXX..XXXXXXX 100644
262
--- a/target/arm/translate.c
263
+++ b/target/arm/translate.c
264
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
265
#define ARM_CP_RW_BIT (1 << 20)
266
267
/* Include the VFP and Neon decoders */
268
-#include "decode-m-nocp.c.inc"
269
#include "translate-vfp.c.inc"
270
#include "translate-neon.c.inc"
271
14
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
272
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
15
index XXXXXXX..XXXXXXX 100644
273
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-vfp.c.inc
274
--- a/target/arm/translate-vfp.c.inc
17
+++ b/target/arm/translate-vfp.c.inc
275
+++ b/target/arm/translate-vfp.c.inc
18
@@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno)
276
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
19
}
20
break;
21
case ARM_VFP_FPCXT_S:
22
+ case ARM_VFP_FPCXT_NS:
23
if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
24
return false;
25
}
26
@@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno)
27
return FPSysRegCheckFailed;
28
}
29
30
- if (!vfp_access_check(s)) {
31
+ /*
32
+ * FPCXT_NS is a special case: it has specific handling for
33
+ * "current FP state is inactive", and must do the PreserveFPState()
34
+ * but not the usual full set of actions done by ExecuteFPCheck().
35
+ * So we don't call vfp_access_check() and the callers must handle this.
36
+ */
37
+ if (regno != ARM_VFP_FPCXT_NS && !vfp_access_check(s)) {
38
return FPSysRegCheckDone;
39
}
40
-
41
return FPSysRegCheckContinue;
42
}
43
44
+static void gen_branch_fpInactive(DisasContext *s, TCGCond cond,
45
+ TCGLabel *label)
46
+{
47
+ /*
48
+ * FPCXT_NS is a special case: it has specific handling for
49
+ * "current FP state is inactive", and must do the PreserveFPState()
50
+ * but not the usual full set of actions done by ExecuteFPCheck().
51
+ * We don't have a TB flag that matches the fpInactive check, so we
52
+ * do it at runtime as we don't expect FPCXT_NS accesses to be frequent.
53
+ *
54
+ * Emit code that checks fpInactive and does a conditional
55
+ * branch to label based on it:
56
+ * if cond is TCG_COND_NE then branch if fpInactive != 0 (ie if inactive)
57
+ * if cond is TCG_COND_EQ then branch if fpInactive == 0 (ie if active)
58
+ */
59
+ assert(cond == TCG_COND_EQ || cond == TCG_COND_NE);
60
+
61
+ /* fpInactive = FPCCR_NS.ASPEN == 1 && CONTROL.FPCA == 0 */
62
+ TCGv_i32 aspen, fpca;
63
+ aspen = load_cpu_field(v7m.fpccr[M_REG_NS]);
64
+ fpca = load_cpu_field(v7m.control[M_REG_S]);
65
+ tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
66
+ tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
67
+ tcg_gen_andi_i32(fpca, fpca, R_V7M_CONTROL_FPCA_MASK);
68
+ tcg_gen_or_i32(fpca, fpca, aspen);
69
+ tcg_gen_brcondi_i32(tcg_invert_cond(cond), fpca, 0, label);
70
+ tcg_temp_free_i32(aspen);
71
+ tcg_temp_free_i32(fpca);
72
+}
73
+
74
static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
75
76
fp_sysreg_loadfn *loadfn,
77
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
78
{
79
/* Do a write to an M-profile floating point system register */
80
TCGv_i32 tmp;
81
+ TCGLabel *lab_end = NULL;
82
83
switch (fp_sysreg_checks(s, regno)) {
84
case FPSysRegCheckFailed:
85
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
86
tcg_temp_free_i32(tmp);
87
break;
88
}
89
+ case ARM_VFP_FPCXT_NS:
90
+ lab_end = gen_new_label();
91
+ /* fpInactive case: write is a NOP, so branch to end */
92
+ gen_branch_fpInactive(s, TCG_COND_NE, lab_end);
93
+ /* !fpInactive: PreserveFPState(), and reads same as FPCXT_S */
94
+ gen_preserve_fp_state(s);
95
+ /* fall through */
96
case ARM_VFP_FPCXT_S:
97
{
98
TCGv_i32 sfpa, control;
99
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
100
default:
101
g_assert_not_reached();
102
}
103
+ if (lab_end) {
104
+ gen_set_label(lab_end);
105
+ }
106
return true;
277
return true;
107
}
278
}
108
279
109
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno,
280
-/*
281
- * Decode VLLDM and VLSTM are nonstandard because:
282
- * * if there is no FPU then these insns must NOP in
283
- * Secure state and UNDEF in Nonsecure state
284
- * * if there is an FPU then these insns do not have
285
- * the usual behaviour that vfp_access_check() provides of
286
- * being controlled by CPACR/NSACR enable bits or the
287
- * lazy-stacking logic.
288
- */
289
-static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a)
290
-{
291
- TCGv_i32 fptr;
292
-
293
- if (!arm_dc_feature(s, ARM_FEATURE_M) ||
294
- !arm_dc_feature(s, ARM_FEATURE_V8)) {
295
- return false;
296
- }
297
-
298
- if (a->op) {
299
- /*
300
- * T2 encoding ({D0-D31} reglist): v8.1M and up. We choose not
301
- * to take the IMPDEF option to make memory accesses to the stack
302
- * slots that correspond to the D16-D31 registers (discarding
303
- * read data and writing UNKNOWN values), so for us the T2
304
- * encoding behaves identically to the T1 encoding.
305
- */
306
- if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
307
- return false;
308
- }
309
- } else {
310
- /*
311
- * T1 encoding ({D0-D15} reglist); undef if we have 32 Dregs.
312
- * This is currently architecturally impossible, but we add the
313
- * check to stay in line with the pseudocode. Note that we must
314
- * emit code for the UNDEF so it takes precedence over the NOCP.
315
- */
316
- if (dc_isar_feature(aa32_simd_r32, s)) {
317
- unallocated_encoding(s);
318
- return true;
319
- }
320
- }
321
-
322
- /*
323
- * If not secure, UNDEF. We must emit code for this
324
- * rather than returning false so that this takes
325
- * precedence over the m-nocp.decode NOCP fallback.
326
- */
327
- if (!s->v8m_secure) {
328
- unallocated_encoding(s);
329
- return true;
330
- }
331
- /* If no fpu, NOP. */
332
- if (!dc_isar_feature(aa32_vfp, s)) {
333
- return true;
334
- }
335
-
336
- fptr = load_reg(s, a->rn);
337
- if (a->l) {
338
- gen_helper_v7m_vlldm(cpu_env, fptr);
339
- } else {
340
- gen_helper_v7m_vlstm(cpu_env, fptr);
341
- }
342
- tcg_temp_free_i32(fptr);
343
-
344
- /* End the TB, because we have updated FP control bits */
345
- s->base.is_jmp = DISAS_UPDATE_EXIT;
346
- return true;
347
-}
348
-
349
-static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a)
350
-{
351
- int btmreg, topreg;
352
- TCGv_i64 zero;
353
- TCGv_i32 aspen, sfpa;
354
-
355
- if (!dc_isar_feature(aa32_m_sec_state, s)) {
356
- /* Before v8.1M, fall through in decode to NOCP check */
357
- return false;
358
- }
359
-
360
- /* Explicitly UNDEF because this takes precedence over NOCP */
361
- if (!arm_dc_feature(s, ARM_FEATURE_M_MAIN) || !s->v8m_secure) {
362
- unallocated_encoding(s);
363
- return true;
364
- }
365
-
366
- if (!dc_isar_feature(aa32_vfp_simd, s)) {
367
- /* NOP if we have neither FP nor MVE */
368
- return true;
369
- }
370
-
371
- /*
372
- * If FPCCR.ASPEN != 0 && CONTROL_S.SFPA == 0 then there is no
373
- * active floating point context so we must NOP (without doing
374
- * any lazy state preservation or the NOCP check).
375
- */
376
- aspen = load_cpu_field(v7m.fpccr[M_REG_S]);
377
- sfpa = load_cpu_field(v7m.control[M_REG_S]);
378
- tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
379
- tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
380
- tcg_gen_andi_i32(sfpa, sfpa, R_V7M_CONTROL_SFPA_MASK);
381
- tcg_gen_or_i32(sfpa, sfpa, aspen);
382
- arm_gen_condlabel(s);
383
- tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel);
384
-
385
- if (s->fp_excp_el != 0) {
386
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
387
- syn_uncategorized(), s->fp_excp_el);
388
- return true;
389
- }
390
-
391
- topreg = a->vd + a->imm - 1;
392
- btmreg = a->vd;
393
-
394
- /* Convert to Sreg numbers if the insn specified in Dregs */
395
- if (a->size == 3) {
396
- topreg = topreg * 2 + 1;
397
- btmreg *= 2;
398
- }
399
-
400
- if (topreg > 63 || (topreg > 31 && !(topreg & 1))) {
401
- /* UNPREDICTABLE: we choose to undef */
402
- unallocated_encoding(s);
403
- return true;
404
- }
405
-
406
- /* Silently ignore requests to clear D16-D31 if they don't exist */
407
- if (topreg > 31 && !dc_isar_feature(aa32_simd_r32, s)) {
408
- topreg = 31;
409
- }
410
-
411
- if (!vfp_access_check(s)) {
412
- return true;
413
- }
414
-
415
- /* Zero the Sregs from btmreg to topreg inclusive. */
416
- zero = tcg_const_i64(0);
417
- if (btmreg & 1) {
418
- write_neon_element64(zero, btmreg >> 1, 1, MO_32);
419
- btmreg++;
420
- }
421
- for (; btmreg + 1 <= topreg; btmreg += 2) {
422
- write_neon_element64(zero, btmreg >> 1, 0, MO_64);
423
- }
424
- if (btmreg == topreg) {
425
- write_neon_element64(zero, btmreg >> 1, 0, MO_32);
426
- btmreg++;
427
- }
428
- assert(btmreg == topreg + 1);
429
- /* TODO: when MVE is implemented, zero VPR here */
430
- return true;
431
-}
432
-
433
-static bool trans_NOCP(DisasContext *s, arg_nocp *a)
434
-{
435
- /*
436
- * Handle M-profile early check for disabled coprocessor:
437
- * all we need to do here is emit the NOCP exception if
438
- * the coprocessor is disabled. Otherwise we return false
439
- * and the real VFP/etc decode will handle the insn.
440
- */
441
- assert(arm_dc_feature(s, ARM_FEATURE_M));
442
-
443
- if (a->cp == 11) {
444
- a->cp = 10;
445
- }
446
- if (arm_dc_feature(s, ARM_FEATURE_V8_1M) &&
447
- (a->cp == 8 || a->cp == 9 || a->cp == 14 || a->cp == 15)) {
448
- /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */
449
- a->cp = 10;
450
- }
451
-
452
- if (a->cp != 10) {
453
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
454
- syn_uncategorized(), default_exception_el(s));
455
- return true;
456
- }
457
-
458
- if (s->fp_excp_el != 0) {
459
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
460
- syn_uncategorized(), s->fp_excp_el);
461
- return true;
462
- }
463
-
464
- return false;
465
-}
466
-
467
-static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a)
468
-{
469
- /* This range needs a coprocessor check for v8.1M and later only */
470
- if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
471
- return false;
472
- }
473
- return trans_NOCP(s, a);
474
-}
475
-
476
static bool trans_VINS(DisasContext *s, arg_VINS *a)
110
{
477
{
111
/* Do a read from an M-profile floating point system register */
478
TCGv_i32 rd, rm;
112
TCGv_i32 tmp;
479
diff --git a/target/arm/meson.build b/target/arm/meson.build
113
+ TCGLabel *lab_end = NULL;
480
index XXXXXXX..XXXXXXX 100644
114
+ bool lookup_tb = false;
481
--- a/target/arm/meson.build
115
482
+++ b/target/arm/meson.build
116
switch (fp_sysreg_checks(s, regno)) {
483
@@ -XXX,XX +XXX,XX @@ gen = [
117
case FPSysRegCheckFailed:
484
decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
118
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno,
485
decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'),
119
fpscr = load_cpu_field(v7m.fpdscr[M_REG_NS]);
486
decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'),
120
gen_helper_vfp_set_fpscr(cpu_env, fpscr);
487
- decodetree.process('m-nocp.decode', extra_args: '--static-decode=disas_m_nocp'),
121
tcg_temp_free_i32(fpscr);
488
+ decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
122
- gen_lookup_tb(s);
489
decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'),
123
+ lookup_tb = true;
490
decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'),
124
+ break;
491
decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'),
125
+ }
492
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
126
+ case ARM_VFP_FPCXT_NS:
493
'op_helper.c',
127
+ {
494
'tlb_helper.c',
128
+ TCGv_i32 control, sfpa, fpscr, fpdscr, zero;
495
'translate.c',
129
+ TCGLabel *lab_active = gen_new_label();
496
+ 'translate-m-nocp.c',
130
+
497
'vec_helper.c',
131
+ lookup_tb = true;
498
'vfp_helper.c',
132
+
499
'cpu_tcg.c',
133
+ gen_branch_fpInactive(s, TCG_COND_EQ, lab_active);
134
+ /* fpInactive case: reads as FPDSCR_NS */
135
+ TCGv_i32 tmp = load_cpu_field(v7m.fpdscr[M_REG_NS]);
136
+ storefn(s, opaque, tmp);
137
+ lab_end = gen_new_label();
138
+ tcg_gen_br(lab_end);
139
+
140
+ gen_set_label(lab_active);
141
+ /* !fpInactive: Reads the same as FPCXT_S, but side effects differ */
142
+ gen_preserve_fp_state(s);
143
+ tmp = tcg_temp_new_i32();
144
+ sfpa = tcg_temp_new_i32();
145
+ fpscr = tcg_temp_new_i32();
146
+ gen_helper_vfp_get_fpscr(fpscr, cpu_env);
147
+ tcg_gen_andi_i32(tmp, fpscr, ~FPCR_NZCV_MASK);
148
+ control = load_cpu_field(v7m.control[M_REG_S]);
149
+ tcg_gen_andi_i32(sfpa, control, R_V7M_CONTROL_SFPA_MASK);
150
+ tcg_gen_shli_i32(sfpa, sfpa, 31 - R_V7M_CONTROL_SFPA_SHIFT);
151
+ tcg_gen_or_i32(tmp, tmp, sfpa);
152
+ tcg_temp_free_i32(control);
153
+ /* Store result before updating FPSCR, in case it faults */
154
+ storefn(s, opaque, tmp);
155
+ /* If SFPA is zero then set FPSCR from FPDSCR_NS */
156
+ fpdscr = load_cpu_field(v7m.fpdscr[M_REG_NS]);
157
+ zero = tcg_const_i32(0);
158
+ tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, zero, fpdscr, fpscr);
159
+ gen_helper_vfp_set_fpscr(cpu_env, fpscr);
160
+ tcg_temp_free_i32(zero);
161
+ tcg_temp_free_i32(sfpa);
162
+ tcg_temp_free_i32(fpdscr);
163
+ tcg_temp_free_i32(fpscr);
164
break;
165
}
166
default:
167
g_assert_not_reached();
168
}
169
+
170
+ if (lab_end) {
171
+ gen_set_label(lab_end);
172
+ }
173
+ if (lookup_tb) {
174
+ gen_lookup_tb(s);
175
+ }
176
return true;
177
}
178
179
--
500
--
180
2.20.1
501
2.20.1
181
502
182
503
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
Move the various gen_aa32* functions and macros out of translate.c
2
and into translate-a32.h.
2
3
3
When running device-introspect-test, a memory leak occurred in the
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
exynos4210_mct_init function, so use ptimer_free() in the finalize function to
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
avoid it.
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20210430132740.10391-6-peter.maydell@linaro.org
8
---
9
target/arm/translate-a32.h | 53 ++++++++++++++++++++++++++++++++++++++
10
target/arm/translate.c | 51 ++++++++++++------------------------
11
2 files changed, 69 insertions(+), 35 deletions(-)
6
12
7
ASAN shows memory leak stack:
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
8
9
Indirect leak of 96 byte(s) in 1 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf56b01a0 in exynos4210_mct_init /qemu/hw/timer/exynos4210_mct.c:1505
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
16
#6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
17
#7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
18
#8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
19
#9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136
20
#10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164
21
#11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381
22
#12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/timer/exynos4210_mct.c | 14 ++++++++++++++
30
1 file changed, 14 insertions(+)
31
32
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
33
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/exynos4210_mct.c
15
--- a/target/arm/translate-a32.h
35
+++ b/hw/timer/exynos4210_mct.c
16
+++ b/target/arm/translate-a32.h
36
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_init(Object *obj)
17
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg)
37
sysbus_init_mmio(dev, &s->iomem);
18
return tmp;
38
}
19
}
39
20
40
+static void exynos4210_mct_finalize(Object *obj)
21
+void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
22
+ TCGv_i32 a32, int index, MemOp opc);
23
+void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
24
+ TCGv_i32 a32, int index, MemOp opc);
25
+void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
26
+ TCGv_i32 a32, int index, MemOp opc);
27
+void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
28
+ TCGv_i32 a32, int index, MemOp opc);
29
+void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
30
+ int index, MemOp opc);
31
+void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
32
+ int index, MemOp opc);
33
+void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
34
+ int index, MemOp opc);
35
+void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
36
+ int index, MemOp opc);
37
+
38
+#define DO_GEN_LD(SUFF, OPC) \
39
+ static inline void gen_aa32_ld##SUFF(DisasContext *s, TCGv_i32 val, \
40
+ TCGv_i32 a32, int index) \
41
+ { \
42
+ gen_aa32_ld_i32(s, val, a32, index, OPC); \
43
+ }
44
+
45
+#define DO_GEN_ST(SUFF, OPC) \
46
+ static inline void gen_aa32_st##SUFF(DisasContext *s, TCGv_i32 val, \
47
+ TCGv_i32 a32, int index) \
48
+ { \
49
+ gen_aa32_st_i32(s, val, a32, index, OPC); \
50
+ }
51
+
52
+static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val,
53
+ TCGv_i32 a32, int index)
41
+{
54
+{
42
+ int i;
55
+ gen_aa32_ld_i64(s, val, a32, index, MO_Q);
43
+ Exynos4210MCTState *s = EXYNOS4210_MCT(obj);
44
+
45
+ ptimer_free(s->g_timer.ptimer_frc);
46
+
47
+ for (i = 0; i < 2; i++) {
48
+ ptimer_free(s->l_timer[i].tick_timer.ptimer_tick);
49
+ ptimer_free(s->l_timer[i].ptimer_frc);
50
+ }
51
+}
56
+}
52
+
57
+
53
static void exynos4210_mct_class_init(ObjectClass *klass, void *data)
58
+static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val,
59
+ TCGv_i32 a32, int index)
60
+{
61
+ gen_aa32_st_i64(s, val, a32, index, MO_Q);
62
+}
63
+
64
+DO_GEN_LD(8u, MO_UB)
65
+DO_GEN_LD(16u, MO_UW)
66
+DO_GEN_LD(32u, MO_UL)
67
+DO_GEN_ST(8, MO_UB)
68
+DO_GEN_ST(16, MO_UW)
69
+DO_GEN_ST(32, MO_UL)
70
+
71
+#undef DO_GEN_LD
72
+#undef DO_GEN_ST
73
+
74
#endif
75
diff --git a/target/arm/translate.c b/target/arm/translate.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/translate.c
78
+++ b/target/arm/translate.c
79
@@ -XXX,XX +XXX,XX @@ static TCGv gen_aa32_addr(DisasContext *s, TCGv_i32 a32, MemOp op)
80
* Internal routines are used for NEON cases where the endianness
81
* and/or alignment has already been taken into account and manipulated.
82
*/
83
-static void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
84
- TCGv_i32 a32, int index, MemOp opc)
85
+void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
86
+ TCGv_i32 a32, int index, MemOp opc)
54
{
87
{
55
DeviceClass *dc = DEVICE_CLASS(klass);
88
TCGv addr = gen_aa32_addr(s, a32, opc);
56
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_mct_info = {
89
tcg_gen_qemu_ld_i32(val, addr, index, opc);
57
.parent = TYPE_SYS_BUS_DEVICE,
90
tcg_temp_free(addr);
58
.instance_size = sizeof(Exynos4210MCTState),
91
}
59
.instance_init = exynos4210_mct_init,
92
60
+ .instance_finalize = exynos4210_mct_finalize,
93
-static void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
61
.class_init = exynos4210_mct_class_init,
94
- TCGv_i32 a32, int index, MemOp opc)
62
};
95
+void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
63
96
+ TCGv_i32 a32, int index, MemOp opc)
97
{
98
TCGv addr = gen_aa32_addr(s, a32, opc);
99
tcg_gen_qemu_st_i32(val, addr, index, opc);
100
tcg_temp_free(addr);
101
}
102
103
-static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
104
- TCGv_i32 a32, int index, MemOp opc)
105
+void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
106
+ TCGv_i32 a32, int index, MemOp opc)
107
{
108
TCGv addr = gen_aa32_addr(s, a32, opc);
109
110
@@ -XXX,XX +XXX,XX @@ static void gen_aa32_ld_internal_i64(DisasContext *s, TCGv_i64 val,
111
tcg_temp_free(addr);
112
}
113
114
-static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
115
- TCGv_i32 a32, int index, MemOp opc)
116
+void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
117
+ TCGv_i32 a32, int index, MemOp opc)
118
{
119
TCGv addr = gen_aa32_addr(s, a32, opc);
120
121
@@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_internal_i64(DisasContext *s, TCGv_i64 val,
122
tcg_temp_free(addr);
123
}
124
125
-static void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
126
- int index, MemOp opc)
127
+void gen_aa32_ld_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
128
+ int index, MemOp opc)
129
{
130
gen_aa32_ld_internal_i32(s, val, a32, index, finalize_memop(s, opc));
131
}
132
133
-static void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
134
- int index, MemOp opc)
135
+void gen_aa32_st_i32(DisasContext *s, TCGv_i32 val, TCGv_i32 a32,
136
+ int index, MemOp opc)
137
{
138
gen_aa32_st_internal_i32(s, val, a32, index, finalize_memop(s, opc));
139
}
140
141
-static void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
142
- int index, MemOp opc)
143
+void gen_aa32_ld_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
144
+ int index, MemOp opc)
145
{
146
gen_aa32_ld_internal_i64(s, val, a32, index, finalize_memop(s, opc));
147
}
148
149
-static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
150
- int index, MemOp opc)
151
+void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
152
+ int index, MemOp opc)
153
{
154
gen_aa32_st_internal_i64(s, val, a32, index, finalize_memop(s, opc));
155
}
156
@@ -XXX,XX +XXX,XX @@ static void gen_aa32_st_i64(DisasContext *s, TCGv_i64 val, TCGv_i32 a32,
157
gen_aa32_st_i32(s, val, a32, index, OPC); \
158
}
159
160
-static inline void gen_aa32_ld64(DisasContext *s, TCGv_i64 val,
161
- TCGv_i32 a32, int index)
162
-{
163
- gen_aa32_ld_i64(s, val, a32, index, MO_Q);
164
-}
165
-
166
-static inline void gen_aa32_st64(DisasContext *s, TCGv_i64 val,
167
- TCGv_i32 a32, int index)
168
-{
169
- gen_aa32_st_i64(s, val, a32, index, MO_Q);
170
-}
171
-
172
-DO_GEN_LD(8u, MO_UB)
173
-DO_GEN_LD(16u, MO_UW)
174
-DO_GEN_LD(32u, MO_UL)
175
-DO_GEN_ST(8, MO_UB)
176
-DO_GEN_ST(16, MO_UW)
177
-DO_GEN_ST(32, MO_UL)
178
-
179
static inline void gen_hvc(DisasContext *s, int imm16)
180
{
181
/* The pre HVC helper handles cases when HVC gets trapped
64
--
182
--
65
2.20.1
183
2.20.1
66
184
67
185
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
The functions vfp_load_reg32(), vfp_load_reg64(), vfp_store_reg32()
2
and vfp_store_reg64() are used only in translate-vfp.c.inc. Move
3
them to that file.
2
4
3
When running device-introspect-test, a memory leak occurred in the
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
exynos4210_pwm_init function, so use ptimer_free() in the finalize function to
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
avoid it.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20210430132740.10391-7-peter.maydell@linaro.org
9
---
10
target/arm/translate.c | 20 --------------------
11
target/arm/translate-vfp.c.inc | 20 ++++++++++++++++++++
12
2 files changed, 20 insertions(+), 20 deletions(-)
6
13
7
ASAN shows memory leak stack:
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
8
9
Indirect leak of 240 byte(s) in 5 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523
13
#3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544
14
#4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562
15
#5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433
16
#6 0xaaabf56a36cc in exynos4210_pwm_init /qemu/hw/timer/exynos4210_pwm.c:401
17
#7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
18
#8 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
19
#9 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
20
#10 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
21
#11 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
22
#12 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/timer/exynos4210_pwm.c | 11 +++++++++++
30
1 file changed, 11 insertions(+)
31
32
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
33
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/exynos4210_pwm.c
16
--- a/target/arm/translate.c
35
+++ b/hw/timer/exynos4210_pwm.c
17
+++ b/target/arm/translate.c
36
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_init(Object *obj)
18
@@ -XXX,XX +XXX,XX @@ static long vfp_reg_offset(bool dp, unsigned reg)
37
sysbus_init_mmio(dev, &s->iomem);
19
}
38
}
20
}
39
21
40
+static void exynos4210_pwm_finalize(Object *obj)
22
-static inline void vfp_load_reg64(TCGv_i64 var, int reg)
23
-{
24
- tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg));
25
-}
26
-
27
-static inline void vfp_store_reg64(TCGv_i64 var, int reg)
28
-{
29
- tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg));
30
-}
31
-
32
-static inline void vfp_load_reg32(TCGv_i32 var, int reg)
33
-{
34
- tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg));
35
-}
36
-
37
-static inline void vfp_store_reg32(TCGv_i32 var, int reg)
38
-{
39
- tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
40
-}
41
-
42
void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop)
43
{
44
long off = neon_element_offset(reg, ele, memop);
45
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
46
index XXXXXXX..XXXXXXX 100644
47
--- a/target/arm/translate-vfp.c.inc
48
+++ b/target/arm/translate-vfp.c.inc
49
@@ -XXX,XX +XXX,XX @@
50
#include "decode-vfp.c.inc"
51
#include "decode-vfp-uncond.c.inc"
52
53
+static inline void vfp_load_reg64(TCGv_i64 var, int reg)
41
+{
54
+{
42
+ Exynos4210PWMState *s = EXYNOS4210_PWM(obj);
55
+ tcg_gen_ld_i64(var, cpu_env, vfp_reg_offset(true, reg));
43
+ int i;
44
+
45
+ for (i = 0; i < EXYNOS4210_PWM_TIMERS_NUM; i++) {
46
+ ptimer_free(s->timer[i].ptimer);
47
+ }
48
+}
56
+}
49
+
57
+
50
static void exynos4210_pwm_class_init(ObjectClass *klass, void *data)
58
+static inline void vfp_store_reg64(TCGv_i64 var, int reg)
51
{
59
+{
52
DeviceClass *dc = DEVICE_CLASS(klass);
60
+ tcg_gen_st_i64(var, cpu_env, vfp_reg_offset(true, reg));
53
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_pwm_info = {
61
+}
54
.parent = TYPE_SYS_BUS_DEVICE,
62
+
55
.instance_size = sizeof(Exynos4210PWMState),
63
+static inline void vfp_load_reg32(TCGv_i32 var, int reg)
56
.instance_init = exynos4210_pwm_init,
64
+{
57
+ .instance_finalize = exynos4210_pwm_finalize,
65
+ tcg_gen_ld_i32(var, cpu_env, vfp_reg_offset(false, reg));
58
.class_init = exynos4210_pwm_class_init,
66
+}
59
};
67
+
60
68
+static inline void vfp_store_reg32(TCGv_i32 var, int reg)
69
+{
70
+ tcg_gen_st_i32(var, cpu_env, vfp_reg_offset(false, reg));
71
+}
72
+
73
/*
74
* The imm8 encodes the sign bit, enough bits to represent an exponent in
75
* the range 01....1xx to 10....0xx, and the most significant 4 bits of
61
--
76
--
62
2.20.1
77
2.20.1
63
78
64
79
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
Make the remaining functions which are needed by translate-vfp.c.inc
2
global.
2
3
3
When running device-introspect-test, a memory leak occurred in the
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
exynos4210_rtc_init function, so use ptimer_free() in the finalize function to
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
avoid it.
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20210430132740.10391-8-peter.maydell@linaro.org
8
---
9
target/arm/translate-a32.h | 18 ++++++++++++++++++
10
target/arm/translate.c | 25 ++++++++-----------------
11
2 files changed, 26 insertions(+), 17 deletions(-)
6
12
7
ASAN shows memory leak stack:
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
8
9
Indirect leak of 96 byte(s) in 1 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf57b3934 in exynos4210_rtc_init /qemu/hw/rtc/exynos4210_rtc.c:567
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
16
#6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
17
#7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
18
#8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
19
#9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136
20
#10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164
21
#11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381
22
#12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/rtc/exynos4210_rtc.c | 9 +++++++++
30
1 file changed, 9 insertions(+)
31
32
diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c
33
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/rtc/exynos4210_rtc.c
15
--- a/target/arm/translate-a32.h
35
+++ b/hw/rtc/exynos4210_rtc.c
16
+++ b/target/arm/translate-a32.h
36
@@ -XXX,XX +XXX,XX @@ static void exynos4210_rtc_init(Object *obj)
17
@@ -XXX,XX +XXX,XX @@ void read_neon_element32(TCGv_i32 dest, int reg, int ele, MemOp memop);
37
sysbus_init_mmio(dev, &s->iomem);
18
void read_neon_element64(TCGv_i64 dest, int reg, int ele, MemOp memop);
19
void write_neon_element32(TCGv_i32 src, int reg, int ele, MemOp memop);
20
void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop);
21
+TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs);
22
+void gen_set_cpsr(TCGv_i32 var, uint32_t mask);
23
+void gen_set_condexec(DisasContext *s);
24
+void gen_set_pc_im(DisasContext *s, target_ulong val);
25
+void gen_lookup_tb(DisasContext *s);
26
+long vfp_reg_offset(bool dp, unsigned reg);
27
+long neon_full_reg_offset(unsigned reg);
28
29
static inline TCGv_i32 load_cpu_offset(int offset)
30
{
31
@@ -XXX,XX +XXX,XX @@ static inline TCGv_i32 load_reg(DisasContext *s, int reg)
32
return tmp;
38
}
33
}
39
34
40
+static void exynos4210_rtc_finalize(Object *obj)
35
+void store_reg(DisasContext *s, int reg, TCGv_i32 var);
41
+{
42
+ Exynos4210RTCState *s = EXYNOS4210_RTC(obj);
43
+
36
+
44
+ ptimer_free(s->ptimer);
37
void gen_aa32_ld_internal_i32(DisasContext *s, TCGv_i32 val,
45
+ ptimer_free(s->ptimer_1Hz);
38
TCGv_i32 a32, int index, MemOp opc);
46
+}
39
void gen_aa32_st_internal_i32(DisasContext *s, TCGv_i32 val,
40
@@ -XXX,XX +XXX,XX @@ DO_GEN_ST(32, MO_UL)
41
#undef DO_GEN_LD
42
#undef DO_GEN_ST
43
44
+#if defined(CONFIG_USER_ONLY)
45
+#define IS_USER(s) 1
46
+#else
47
+#define IS_USER(s) (s->user)
48
+#endif
47
+
49
+
48
static void exynos4210_rtc_class_init(ObjectClass *klass, void *data)
50
+/* Set NZCV flags from the high 4 bits of var. */
51
+#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)
52
+
53
#endif
54
diff --git a/target/arm/translate.c b/target/arm/translate.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/translate.c
57
+++ b/target/arm/translate.c
58
@@ -XXX,XX +XXX,XX @@
59
#include "translate.h"
60
#include "translate-a32.h"
61
62
-#if defined(CONFIG_USER_ONLY)
63
-#define IS_USER(s) 1
64
-#else
65
-#define IS_USER(s) (s->user)
66
-#endif
67
-
68
/* These are TCG temporaries used only by the legacy iwMMXt decoder */
69
static TCGv_i64 cpu_V0, cpu_V1, cpu_M0;
70
/* These are TCG globals which alias CPUARMState fields */
71
@@ -XXX,XX +XXX,XX @@ void load_reg_var(DisasContext *s, TCGv_i32 var, int reg)
72
* This is used for load/store for which use of PC implies (literal),
73
* or ADD that implies ADR.
74
*/
75
-static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
76
+TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
49
{
77
{
50
DeviceClass *dc = DEVICE_CLASS(klass);
78
TCGv_i32 tmp = tcg_temp_new_i32();
51
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_rtc_info = {
79
52
.parent = TYPE_SYS_BUS_DEVICE,
80
@@ -XXX,XX +XXX,XX @@ static TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs)
53
.instance_size = sizeof(Exynos4210RTCState),
81
54
.instance_init = exynos4210_rtc_init,
82
/* Set a CPU register. The source must be a temporary and will be
55
+ .instance_finalize = exynos4210_rtc_finalize,
83
marked as dead. */
56
.class_init = exynos4210_rtc_class_init,
84
-static void store_reg(DisasContext *s, int reg, TCGv_i32 var)
57
};
85
+void store_reg(DisasContext *s, int reg, TCGv_i32 var)
58
86
{
87
if (reg == 15) {
88
/* In Thumb mode, we must ignore bit 0.
89
@@ -XXX,XX +XXX,XX @@ static void store_sp_checked(DisasContext *s, TCGv_i32 var)
90
#define gen_sxtb16(var) gen_helper_sxtb16(var, var)
91
#define gen_uxtb16(var) gen_helper_uxtb16(var, var)
92
93
-
94
-static inline void gen_set_cpsr(TCGv_i32 var, uint32_t mask)
95
+void gen_set_cpsr(TCGv_i32 var, uint32_t mask)
96
{
97
TCGv_i32 tmp_mask = tcg_const_i32(mask);
98
gen_helper_cpsr_write(cpu_env, var, tmp_mask);
99
tcg_temp_free_i32(tmp_mask);
100
}
101
-/* Set NZCV flags from the high 4 bits of var. */
102
-#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)
103
104
static void gen_exception_internal(int excp)
105
{
106
@@ -XXX,XX +XXX,XX @@ void arm_gen_test_cc(int cc, TCGLabel *label)
107
arm_free_cc(&cmp);
108
}
109
110
-static inline void gen_set_condexec(DisasContext *s)
111
+void gen_set_condexec(DisasContext *s)
112
{
113
if (s->condexec_mask) {
114
uint32_t val = (s->condexec_cond << 4) | (s->condexec_mask >> 1);
115
@@ -XXX,XX +XXX,XX @@ static inline void gen_set_condexec(DisasContext *s)
116
}
117
}
118
119
-static inline void gen_set_pc_im(DisasContext *s, target_ulong val)
120
+void gen_set_pc_im(DisasContext *s, target_ulong val)
121
{
122
tcg_gen_movi_i32(cpu_R[15], val);
123
}
124
@@ -XXX,XX +XXX,XX @@ static void gen_exception_el(DisasContext *s, int excp, uint32_t syn,
125
}
126
127
/* Force a TB lookup after an instruction that changes the CPU state. */
128
-static inline void gen_lookup_tb(DisasContext *s)
129
+void gen_lookup_tb(DisasContext *s)
130
{
131
tcg_gen_movi_i32(cpu_R[15], s->base.pc_next);
132
s->base.is_jmp = DISAS_EXIT;
133
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
134
/*
135
* Return the offset of a "full" NEON Dreg.
136
*/
137
-static long neon_full_reg_offset(unsigned reg)
138
+long neon_full_reg_offset(unsigned reg)
139
{
140
return offsetof(CPUARMState, vfp.zregs[reg >> 1].d[reg & 1]);
141
}
142
@@ -XXX,XX +XXX,XX @@ static long neon_element_offset(int reg, int element, MemOp memop)
143
}
144
145
/* Return the offset of a VFP Dreg (dp = true) or VFP Sreg (dp = false). */
146
-static long vfp_reg_offset(bool dp, unsigned reg)
147
+long vfp_reg_offset(bool dp, unsigned reg)
148
{
149
if (dp) {
150
return neon_element_offset(reg, 0, MO_64);
59
--
151
--
60
2.20.1
152
2.20.1
61
153
62
154
diff view generated by jsdifflib
New patch
1
Switch translate-vfp.c.inc from being #included into translate.c
2
to being its own compilation unit.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20210430132740.10391-9-peter.maydell@linaro.org
8
---
9
target/arm/translate-a32.h | 2 ++
10
target/arm/{translate-vfp.c.inc => translate-vfp.c} | 12 +++++++-----
11
target/arm/translate.c | 3 +--
12
target/arm/meson.build | 5 +++--
13
4 files changed, 13 insertions(+), 9 deletions(-)
14
rename target/arm/{translate-vfp.c.inc => translate-vfp.c} (99%)
15
16
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-a32.h
19
+++ b/target/arm/translate-a32.h
20
@@ -XXX,XX +XXX,XX @@
21
22
/* Prototypes for autogenerated disassembler functions */
23
bool disas_m_nocp(DisasContext *dc, uint32_t insn);
24
+bool disas_vfp(DisasContext *s, uint32_t insn);
25
+bool disas_vfp_uncond(DisasContext *s, uint32_t insn);
26
27
void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
28
void arm_gen_condlabel(DisasContext *s);
29
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c
30
similarity index 99%
31
rename from target/arm/translate-vfp.c.inc
32
rename to target/arm/translate-vfp.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/translate-vfp.c.inc
35
+++ b/target/arm/translate-vfp.c
36
@@ -XXX,XX +XXX,XX @@
37
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
38
*/
39
40
-/*
41
- * This file is intended to be included from translate.c; it uses
42
- * some macros and definitions provided by that file.
43
- * It might be possible to convert it to a standalone .c file eventually.
44
- */
45
+#include "qemu/osdep.h"
46
+#include "tcg/tcg-op.h"
47
+#include "tcg/tcg-op-gvec.h"
48
+#include "exec/exec-all.h"
49
+#include "exec/gen-icount.h"
50
+#include "translate.h"
51
+#include "translate-a32.h"
52
53
/* Include the generated VFP decoder */
54
#include "decode-vfp.c.inc"
55
diff --git a/target/arm/translate.c b/target/arm/translate.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/target/arm/translate.c
58
+++ b/target/arm/translate.c
59
@@ -XXX,XX +XXX,XX @@ static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
60
61
#define ARM_CP_RW_BIT (1 << 20)
62
63
-/* Include the VFP and Neon decoders */
64
-#include "translate-vfp.c.inc"
65
+/* Include the Neon decoder */
66
#include "translate-neon.c.inc"
67
68
static inline void iwmmxt_load_reg(TCGv_i64 var, int reg)
69
diff --git a/target/arm/meson.build b/target/arm/meson.build
70
index XXXXXXX..XXXXXXX 100644
71
--- a/target/arm/meson.build
72
+++ b/target/arm/meson.build
73
@@ -XXX,XX +XXX,XX @@ gen = [
74
decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'),
75
decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'),
76
decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
77
- decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'),
78
- decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'),
79
+ decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'),
80
+ decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'),
81
decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
82
decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'),
83
decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'),
84
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
85
'tlb_helper.c',
86
'translate.c',
87
'translate-m-nocp.c',
88
+ 'translate-vfp.c',
89
'vec_helper.c',
90
'vfp_helper.c',
91
'cpu_tcg.c',
92
--
93
2.20.1
94
95
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
The function vfp_reg_ptr() is used only in translate-neon.c.inc;
2
move it there.
2
3
3
When running device-introspect-test, a memory leak occurred in the a10_pit_init
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
function, so use ptimer_free() in the finalize function to avoid it.
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20210430132740.10391-10-peter.maydell@linaro.org
8
---
9
target/arm/translate.c | 7 -------
10
target/arm/translate-neon.c.inc | 7 +++++++
11
2 files changed, 7 insertions(+), 7 deletions(-)
5
12
6
ASAN shows memory leak stack:
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
7
8
Indirect leak of 288 byte(s) in 6 object(s) allocated from:
9
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
10
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
11
#2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523
12
#3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544
13
#4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562
14
#5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433
15
#6 0xaaabf57415e8 in a10_pit_init /qemu/hw/timer/allwinner-a10-pit.c:278
16
#7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
17
#8 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564
18
#9 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547
19
#10 0xaaabf5b94680 in aw_a10_init /qemu/hw/arm/allwinner-a10.c:49
20
#11 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
21
#12 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
22
23
Reported-by: Euler Robot <euler.robot@huawei.com>
24
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
---
28
hw/timer/allwinner-a10-pit.c | 11 +++++++++++
29
1 file changed, 11 insertions(+)
30
31
diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
32
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/timer/allwinner-a10-pit.c
15
--- a/target/arm/translate.c
34
+++ b/hw/timer/allwinner-a10-pit.c
16
+++ b/target/arm/translate.c
35
@@ -XXX,XX +XXX,XX @@ static void a10_pit_init(Object *obj)
17
@@ -XXX,XX +XXX,XX @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
36
}
18
}
37
}
19
}
38
20
39
+static void a10_pit_finalize(Object *obj)
21
-static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
22
-{
23
- TCGv_ptr ret = tcg_temp_new_ptr();
24
- tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg));
25
- return ret;
26
-}
27
-
28
#define ARM_CP_RW_BIT (1 << 20)
29
30
/* Include the Neon decoder */
31
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c.inc
32
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/translate-neon.c.inc
34
+++ b/target/arm/translate-neon.c.inc
35
@@ -XXX,XX +XXX,XX @@ static inline int neon_3same_fp_size(DisasContext *s, int x)
36
#include "decode-neon-ls.c.inc"
37
#include "decode-neon-shared.c.inc"
38
39
+static TCGv_ptr vfp_reg_ptr(bool dp, int reg)
40
+{
40
+{
41
+ AwA10PITState *s = AW_A10_PIT(obj);
41
+ TCGv_ptr ret = tcg_temp_new_ptr();
42
+ int i;
42
+ tcg_gen_addi_ptr(ret, cpu_env, vfp_reg_offset(dp, reg));
43
+
43
+ return ret;
44
+ for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
45
+ ptimer_free(s->timer[i]);
46
+ }
47
+}
44
+}
48
+
45
+
49
static void a10_pit_class_init(ObjectClass *klass, void *data)
46
static void neon_load_element(TCGv_i32 var, int reg, int ele, MemOp mop)
50
{
47
{
51
DeviceClass *dc = DEVICE_CLASS(klass);
48
long offset = neon_element_offset(reg, ele, mop & MO_SIZE);
52
@@ -XXX,XX +XXX,XX @@ static const TypeInfo a10_pit_info = {
53
.parent = TYPE_SYS_BUS_DEVICE,
54
.instance_size = sizeof(AwA10PITState),
55
.instance_init = a10_pit_init,
56
+ .instance_finalize = a10_pit_finalize,
57
.class_init = a10_pit_class_init,
58
};
59
60
--
49
--
61
2.20.1
50
2.20.1
62
51
63
52
diff view generated by jsdifflib
1
The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(),
1
The VFPGenFixPointFn typedef is unused; delete it.
2
timer_free() to free the timer. The timer_deinit() step in this was always
3
unnecessary, and now the timer_del() is implied by timer_free(), so we can
4
collapse this down to simply calling timer_free().
5
2
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201215154107.3255-5-peter.maydell@linaro.org
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Message-id: 20210430132740.10391-11-peter.maydell@linaro.org
10
---
7
---
11
target/arm/cpu.c | 2 --
8
target/arm/translate.c | 2 --
12
1 file changed, 2 deletions(-)
9
1 file changed, 2 deletions(-)
13
10
14
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
11
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.c
13
--- a/target/arm/translate.c
17
+++ b/target/arm/cpu.c
14
+++ b/target/arm/translate.c
18
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_finalizefn(Object *obj)
15
@@ -XXX,XX +XXX,XX @@ static const char * const regnames[] =
19
}
16
/* Function prototypes for gen_ functions calling Neon helpers. */
20
#ifndef CONFIG_USER_ONLY
17
typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32,
21
if (cpu->pmu_timer) {
18
TCGv_i32, TCGv_i32);
22
- timer_del(cpu->pmu_timer);
19
-/* Function prototypes for gen_ functions for fix point conversions */
23
- timer_deinit(cpu->pmu_timer);
20
-typedef void VFPGenFixPointFn(TCGv_i32, TCGv_i32, TCGv_i32, TCGv_ptr);
24
timer_free(cpu->pmu_timer);
21
25
}
22
/* initialize TCG globals. */
26
#endif
23
void arm_translate_init(void)
27
--
24
--
28
2.20.1
25
2.20.1
29
26
30
27
diff view generated by jsdifflib
1
Support for running KVM on 32-bit Arm hosts was removed in commit
1
Move the NeonGenThreeOpEnvFn typedef to translate.h together
2
82bf7ae84ce739e. You can still run a 32-bit guest on a 64-bit Arm
2
with the other similar typedefs.
3
host CPU, but because Arm KVM requires the host and guest CPU types
4
to match, it is not possible to run a guest that requires a Cortex-A9
5
or Cortex-A15 CPU there. That means that the code in the
6
highbank/midway board models to support KVM is no longer used, and we
7
can delete it.
8
3
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Message-id: 20201215144215.28482-1-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-12-peter.maydell@linaro.org
13
---
8
---
14
hw/arm/highbank.c | 14 ++++----------
9
target/arm/translate.h | 2 ++
15
1 file changed, 4 insertions(+), 10 deletions(-)
10
target/arm/translate.c | 3 ---
11
2 files changed, 2 insertions(+), 3 deletions(-)
16
12
17
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
13
diff --git a/target/arm/translate.h b/target/arm/translate.h
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/highbank.c
15
--- a/target/arm/translate.h
20
+++ b/hw/arm/highbank.c
16
+++ b/target/arm/translate.h
21
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ typedef void NeonGenOneOpFn(TCGv_i32, TCGv_i32);
22
#include "hw/arm/boot.h"
18
typedef void NeonGenOneOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32);
23
#include "hw/loader.h"
19
typedef void NeonGenTwoOpFn(TCGv_i32, TCGv_i32, TCGv_i32);
24
#include "net/net.h"
20
typedef void NeonGenTwoOpEnvFn(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32);
25
-#include "sysemu/kvm.h"
21
+typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32,
26
#include "sysemu/runstate.h"
22
+ TCGv_i32, TCGv_i32);
27
#include "sysemu/sysemu.h"
23
typedef void NeonGenTwo64OpFn(TCGv_i64, TCGv_i64, TCGv_i64);
28
#include "hw/boards.h"
24
typedef void NeonGenTwo64OpEnvFn(TCGv_i64, TCGv_ptr, TCGv_i64, TCGv_i64);
29
@@ -XXX,XX +XXX,XX @@
25
typedef void NeonGenNarrowFn(TCGv_i32, TCGv_i64);
30
#include "hw/cpu/a15mpcore.h"
26
diff --git a/target/arm/translate.c b/target/arm/translate.c
31
#include "qemu/log.h"
27
index XXXXXXX..XXXXXXX 100644
32
#include "qom/object.h"
28
--- a/target/arm/translate.c
33
+#include "cpu.h"
29
+++ b/target/arm/translate.c
34
30
@@ -XXX,XX +XXX,XX @@ static const char * const regnames[] =
35
#define SMP_BOOT_ADDR 0x100
31
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
36
#define SMP_BOOT_REG 0x40
32
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" };
37
@@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
33
38
highbank_binfo.loader_start = 0;
34
-/* Function prototypes for gen_ functions calling Neon helpers. */
39
highbank_binfo.write_secondary_boot = hb_write_secondary;
35
-typedef void NeonGenThreeOpEnvFn(TCGv_i32, TCGv_env, TCGv_i32,
40
highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary;
36
- TCGv_i32, TCGv_i32);
41
- if (!kvm_enabled()) {
37
42
- highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
38
/* initialize TCG globals. */
43
- highbank_binfo.write_board_setup = hb_write_board_setup;
39
void arm_translate_init(void)
44
- highbank_binfo.secure_board_setup = true;
45
- } else {
46
- warn_report("cannot load built-in Monitor support "
47
- "if KVM is enabled. Some guests (such as Linux) "
48
- "may not boot.");
49
- }
50
+ highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
51
+ highbank_binfo.write_board_setup = hb_write_board_setup;
52
+ highbank_binfo.secure_board_setup = true;
53
54
arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo);
55
}
56
--
40
--
57
2.20.1
41
2.20.1
58
42
59
43
diff view generated by jsdifflib
1
Currently timer_free() is a simple wrapper for g_free(). This means
1
Make the remaining functions needed by the translate-neon code
2
that the timer being freed must not be currently active, as otherwise
2
global.
3
QEMU might crash later when the active list is processed and still
4
has a pointer to freed memory on it. As a result almost all calls to
5
timer_free() are preceded by a timer_del() call, as can be seen in
6
the output of
7
git grep -B1 '\<timer_free\>'
8
9
This is unfortunate API design as it makes it easy to accidentally
10
misuse (by forgetting the timer_del()), and the correct use is
11
annoyingly verbose.
12
13
Make timer_free() imply a timer_del().
14
3
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 20201215154107.3255-2-peter.maydell@linaro.org
7
Message-id: 20210430132740.10391-13-peter.maydell@linaro.org
19
---
8
---
20
include/qemu/timer.h | 24 +++++++++++++-----------
9
target/arm/translate-a32.h | 8 ++++++++
21
1 file changed, 13 insertions(+), 11 deletions(-)
10
target/arm/translate.c | 10 ++--------
11
2 files changed, 10 insertions(+), 8 deletions(-)
22
12
23
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
13
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
24
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
25
--- a/include/qemu/timer.h
15
--- a/target/arm/translate-a32.h
26
+++ b/include/qemu/timer.h
16
+++ b/target/arm/translate-a32.h
27
@@ -XXX,XX +XXX,XX @@ static inline QEMUTimer *timer_new_ms(QEMUClockType type, QEMUTimerCB *cb,
17
@@ -XXX,XX +XXX,XX @@ void gen_set_pc_im(DisasContext *s, target_ulong val);
28
*/
18
void gen_lookup_tb(DisasContext *s);
29
void timer_deinit(QEMUTimer *ts);
19
long vfp_reg_offset(bool dp, unsigned reg);
30
20
long neon_full_reg_offset(unsigned reg);
31
-/**
21
+long neon_element_offset(int reg, int element, MemOp memop);
32
- * timer_free:
22
+void gen_rev16(TCGv_i32 dest, TCGv_i32 var);
33
- * @ts: the timer
23
34
- *
24
static inline TCGv_i32 load_cpu_offset(int offset)
35
- * Free a timer (it must not be on the active list)
25
{
36
- */
26
@@ -XXX,XX +XXX,XX @@ DO_GEN_ST(32, MO_UL)
37
-static inline void timer_free(QEMUTimer *ts)
27
/* Set NZCV flags from the high 4 bits of var. */
28
#define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)
29
30
+/* Swap low and high halfwords. */
31
+static inline void gen_swap_half(TCGv_i32 dest, TCGv_i32 var)
32
+{
33
+ tcg_gen_rotri_i32(dest, var, 16);
34
+}
35
+
36
#endif
37
diff --git a/target/arm/translate.c b/target/arm/translate.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/translate.c
40
+++ b/target/arm/translate.c
41
@@ -XXX,XX +XXX,XX @@ static void gen_smul_dual(TCGv_i32 a, TCGv_i32 b)
42
}
43
44
/* Byteswap each halfword. */
45
-static void gen_rev16(TCGv_i32 dest, TCGv_i32 var)
46
+void gen_rev16(TCGv_i32 dest, TCGv_i32 var)
47
{
48
TCGv_i32 tmp = tcg_temp_new_i32();
49
TCGv_i32 mask = tcg_const_i32(0x00ff00ff);
50
@@ -XXX,XX +XXX,XX @@ static void gen_revsh(TCGv_i32 dest, TCGv_i32 var)
51
tcg_gen_ext16s_i32(dest, var);
52
}
53
54
-/* Swap low and high halfwords. */
55
-static void gen_swap_half(TCGv_i32 dest, TCGv_i32 var)
38
-{
56
-{
39
- g_free(ts);
57
- tcg_gen_rotri_i32(dest, var, 16);
40
-}
58
-}
41
-
59
-
42
/**
60
/* Dual 16-bit add. Result placed in t0 and t1 is marked as dead.
43
* timer_del:
61
tmp = (t0 ^ t1) & 0x8000;
44
* @ts: the timer
62
t0 &= ~0x8000;
45
@@ -XXX,XX +XXX,XX @@ static inline void timer_free(QEMUTimer *ts)
63
@@ -XXX,XX +XXX,XX @@ long neon_full_reg_offset(unsigned reg)
64
* Return the offset of a 2**SIZE piece of a NEON register, at index ELE,
65
* where 0 is the least significant end of the register.
46
*/
66
*/
47
void timer_del(QEMUTimer *ts);
67
-static long neon_element_offset(int reg, int element, MemOp memop)
48
68
+long neon_element_offset(int reg, int element, MemOp memop)
49
+/**
69
{
50
+ * timer_free:
70
int element_size = 1 << (memop & MO_SIZE);
51
+ * @ts: the timer
71
int ofs = element * element_size;
52
+ *
53
+ * Free a timer. This will call timer_del() for you to remove
54
+ * the timer from the active list if it was still active.
55
+ */
56
+static inline void timer_free(QEMUTimer *ts)
57
+{
58
+ timer_del(ts);
59
+ g_free(ts);
60
+}
61
+
62
/**
63
* timer_mod_ns:
64
* @ts: the timer
65
--
72
--
66
2.20.1
73
2.20.1
67
74
68
75
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
Switch translate-neon.c.inc from being #included into translate.c
2
to being its own compilation unit.
2
3
3
This adds the target guide for SABRE Lite board, and documents how
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
to boot a Linux kernel and U-Boot bootloader.
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20210430132740.10391-14-peter.maydell@linaro.org
8
---
9
target/arm/translate-a32.h | 3 +++
10
.../arm/{translate-neon.c.inc => translate-neon.c} | 12 +++++++-----
11
target/arm/translate.c | 3 ---
12
target/arm/meson.build | 7 ++++---
13
4 files changed, 14 insertions(+), 11 deletions(-)
14
rename target/arm/{translate-neon.c.inc => translate-neon.c} (99%)
5
15
6
Signed-off-by: Bin Meng <bin.meng@windriver.com>
16
diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
17
index XXXXXXX..XXXXXXX 100644
8
Message-id: 20210106063504.10841-5-bmeng.cn@gmail.com
18
--- a/target/arm/translate-a32.h
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
+++ b/target/arm/translate-a32.h
10
---
11
docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++++++++++
12
docs/system/target-arm.rst | 1 +
13
2 files changed, 120 insertions(+)
14
create mode 100644 docs/system/arm/sabrelite.rst
15
16
diff --git a/docs/system/arm/sabrelite.rst b/docs/system/arm/sabrelite.rst
17
new file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- /dev/null
20
+++ b/docs/system/arm/sabrelite.rst
21
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@
22
+Boundary Devices SABRE Lite (``sabrelite``)
21
bool disas_m_nocp(DisasContext *dc, uint32_t insn);
23
+===========================================
22
bool disas_vfp(DisasContext *s, uint32_t insn);
24
+
23
bool disas_vfp_uncond(DisasContext *s, uint32_t insn);
25
+Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost development
24
+bool disas_neon_dp(DisasContext *s, uint32_t insn);
26
+platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad
25
+bool disas_neon_ls(DisasContext *s, uint32_t insn);
27
+Applications Processor.
26
+bool disas_neon_shared(DisasContext *s, uint32_t insn);
28
+
27
29
+Supported devices
28
void load_reg_var(DisasContext *s, TCGv_i32 var, int reg);
30
+-----------------
29
void arm_gen_condlabel(DisasContext *s);
31
+
30
diff --git a/target/arm/translate-neon.c.inc b/target/arm/translate-neon.c
32
+The SABRE Lite machine supports the following devices:
31
similarity index 99%
33
+
32
rename from target/arm/translate-neon.c.inc
34
+ * Up to 4 Cortex A9 cores
33
rename to target/arm/translate-neon.c
35
+ * Generic Interrupt Controller
36
+ * 1 Clock Controller Module
37
+ * 1 System Reset Controller
38
+ * 5 UARTs
39
+ * 2 EPIC timers
40
+ * 1 GPT timer
41
+ * 2 Watchdog timers
42
+ * 1 FEC Ethernet controller
43
+ * 3 I2C controllers
44
+ * 7 GPIO controllers
45
+ * 4 SDHC storage controllers
46
+ * 4 USB 2.0 host controllers
47
+ * 5 ECSPI controllers
48
+ * 1 SST 25VF016B flash
49
+
50
+Please note above list is a complete superset the QEMU SABRE Lite machine can
51
+support. For a normal use case, a device tree blob that represents a real world
52
+SABRE Lite board, only exposes a subset of devices to the guest software.
53
+
54
+Boot options
55
+------------
56
+
57
+The SABRE Lite machine can start using the standard -kernel functionality
58
+for loading a Linux kernel, U-Boot bootloader or ELF executable.
59
+
60
+Running Linux kernel
61
+--------------------
62
+
63
+Linux mainline v5.10 release is tested at the time of writing. To build a Linux
64
+mainline kernel that can be booted by the SABRE Lite machine, simply configure
65
+the kernel using the imx_v6_v7_defconfig configuration:
66
+
67
+.. code-block:: bash
68
+
69
+ $ export ARCH=arm
70
+ $ export CROSS_COMPILE=arm-linux-gnueabihf-
71
+ $ make imx_v6_v7_defconfig
72
+ $ make
73
+
74
+To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, use:
75
+
76
+.. code-block:: bash
77
+
78
+ $ qemu-system-arm -M sabrelite -smp 4 -m 1G \
79
+ -display none -serial null -serial stdio \
80
+ -kernel arch/arm/boot/zImage \
81
+ -dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \
82
+ -initrd /path/to/rootfs.ext4 \
83
+ -append "root=/dev/ram"
84
+
85
+Running U-Boot
86
+--------------
87
+
88
+U-Boot mainline v2020.10 release is tested at the time of writing. To build a
89
+U-Boot mainline bootloader that can be booted by the SABRE Lite machine, use
90
+the mx6qsabrelite_defconfig with similar commands as described above for Linux:
91
+
92
+.. code-block:: bash
93
+
94
+ $ export CROSS_COMPILE=arm-linux-gnueabihf-
95
+ $ make mx6qsabrelite_defconfig
96
+
97
+Note we need to adjust settings by:
98
+
99
+.. code-block:: bash
100
+
101
+ $ make menuconfig
102
+
103
+then manually select the following configuration in U-Boot:
104
+
105
+ Device Tree Control > Provider of DTB for DT Control > Embedded DTB
106
+
107
+To start U-Boot using the SABRE Lite machine, provide the u-boot binary to
108
+the -kernel argument, along with an SD card image with rootfs:
109
+
110
+.. code-block:: bash
111
+
112
+ $ qemu-system-arm -M sabrelite -smp 4 -m 1G \
113
+ -display none -serial null -serial stdio \
114
+ -kernel u-boot
115
+
116
+The following example shows booting Linux kernel from dhcp, and uses the
117
+rootfs on an SD card. This requires some additional command line parameters
118
+for QEMU:
119
+
120
+.. code-block:: none
121
+
122
+ -nic user,tftp=/path/to/kernel/zImage \
123
+ -drive file=sdcard.img,id=rootfs -device sd-card,drive=rootfs
124
+
125
+The directory for the built-in TFTP server should also contain the device tree
126
+blob of the SABRE Lite board. The sample SD card image was populated with the
127
+root file system with one single partition. You may adjust the kernel "root="
128
+boot parameter accordingly.
129
+
130
+After U-Boot boots, type the following commands in the U-Boot command shell to
131
+boot the Linux kernel:
132
+
133
+.. code-block:: none
134
+
135
+ => setenv ethaddr 00:11:22:33:44:55
136
+ => setenv bootfile zImage
137
+ => dhcp
138
+ => tftpboot 14000000 imx6q-sabrelite.dtb
139
+ => setenv bootargs root=/dev/mmcblk3p1
140
+ => bootz 12000000 - 14000000
141
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
142
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
143
--- a/docs/system/target-arm.rst
35
--- a/target/arm/translate-neon.c.inc
144
+++ b/docs/system/target-arm.rst
36
+++ b/target/arm/translate-neon.c
145
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
37
@@ -XXX,XX +XXX,XX @@
146
arm/versatile
38
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
147
arm/vexpress
39
*/
148
arm/aspeed
40
149
+ arm/sabrelite
41
-/*
150
arm/digic
42
- * This file is intended to be included from translate.c; it uses
151
arm/musicpal
43
- * some macros and definitions provided by that file.
152
arm/gumstix
44
- * It might be possible to convert it to a standalone .c file eventually.
45
- */
46
+#include "qemu/osdep.h"
47
+#include "tcg/tcg-op.h"
48
+#include "tcg/tcg-op-gvec.h"
49
+#include "exec/exec-all.h"
50
+#include "exec/gen-icount.h"
51
+#include "translate.h"
52
+#include "translate-a32.h"
53
54
static inline int plus1(DisasContext *s, int x)
55
{
56
diff --git a/target/arm/translate.c b/target/arm/translate.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/target/arm/translate.c
59
+++ b/target/arm/translate.c
60
@@ -XXX,XX +XXX,XX @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop)
61
62
#define ARM_CP_RW_BIT (1 << 20)
63
64
-/* Include the Neon decoder */
65
-#include "translate-neon.c.inc"
66
-
67
static inline void iwmmxt_load_reg(TCGv_i64 var, int reg)
68
{
69
tcg_gen_ld_i64(var, cpu_env, offsetof(CPUARMState, iwmmxt.regs[reg]));
70
diff --git a/target/arm/meson.build b/target/arm/meson.build
71
index XXXXXXX..XXXXXXX 100644
72
--- a/target/arm/meson.build
73
+++ b/target/arm/meson.build
74
@@ -XXX,XX +XXX,XX @@
75
gen = [
76
decodetree.process('sve.decode', extra_args: '--decode=disas_sve'),
77
- decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'),
78
- decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'),
79
- decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
80
+ decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'),
81
+ decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'),
82
+ decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'),
83
decodetree.process('vfp.decode', extra_args: '--decode=disas_vfp'),
84
decodetree.process('vfp-uncond.decode', extra_args: '--decode=disas_vfp_uncond'),
85
decodetree.process('m-nocp.decode', extra_args: '--decode=disas_m_nocp'),
86
@@ -XXX,XX +XXX,XX @@ arm_ss.add(files(
87
'tlb_helper.c',
88
'translate.c',
89
'translate-m-nocp.c',
90
+ 'translate-neon.c',
91
'translate-vfp.c',
92
'vec_helper.c',
93
'vfp_helper.c',
153
--
94
--
154
2.20.1
95
2.20.1
155
96
156
97
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
The WFI insn is not system-mode only, though it doesn't usually make
2
a huge amount of sense for userspace code to execute it. Currently
3
if you try it in qemu-arm then the helper function will raise an
4
EXCP_HLT exception, which is not covered by the switch in cpu_loop()
5
and results in an abort:
2
6
3
When running device-introspect-test, a memory leak occurred in the
7
qemu: unhandled CPU exception 0x10001 - aborting
4
mv88w8618_pit_init function, so use ptimer_free() in the finalize function to
8
R00=00000001 R01=408003e4 R02=408003ec R03=000102ec
5
avoid it.
9
R04=00010a28 R05=00010158 R06=00087460 R07=00010158
10
R08=00000000 R09=00000000 R10=00085b7c R11=408002a4
11
R12=408002b8 R13=408002a0 R14=0001057c R15=000102f8
12
PSR=60000010 -ZC- A usr32
13
qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7fcbfa4f0a12
6
14
7
ASAN shows memory leak stack:
15
Make the WFI helper function return immediately in the usermode
16
emulator. This turns WFI into a NOP, which is OK because:
17
* architecturally "WFI is a NOP" is a permitted implementation
18
* aarch64 Linux kernels use the SCTLR_EL1.nTWI bit to trap
19
userspace WFI and NOP it (though aarch32 kernels currently
20
just let WFI do whatever it would do)
8
21
9
Indirect leak of 192 byte(s) in 4 object(s) allocated from:
22
We could in theory make the translate.c code special case user-mode
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
23
emulation and NOP the insn entirely rather than making the helper
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
24
do nothing, but because no real world code will be trying to
12
#2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523
25
execute WFI we don't care about efficiency and the helper provides
13
#3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544
26
a single place where we can make the change rather than having
14
#4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562
27
to touch multiple places in translate.c and translate-a64.c.
15
#5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433
16
#6 0xaaabf5bb2290 in mv88w8618_timer_init /qemu/hw/arm/musicpal.c:862
17
#7 0xaaabf5bb2290 in mv88w8618_pit_init /qemu/hw/arm/musicpal.c:954
18
#8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
19
#9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
20
#10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
21
#11 0xaaabf5a95540 in qdev_device_help /qemu/softmmu/qdev-monitor.c:283
22
#12 0xaaabf5a96940 in qmp_device_add /qemu/softmmu/qdev-monitor.c:801
23
28
24
Reported-by: Euler Robot <euler.robot@huawei.com>
29
Fixes: https://bugs.launchpad.net/qemu/+bug/1926759
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
32
Message-id: 20210430162212.825-1-peter.maydell@linaro.org
28
---
33
---
29
hw/arm/musicpal.c | 12 ++++++++++++
34
target/arm/op_helper.c | 12 ++++++++++++
30
1 file changed, 12 insertions(+)
35
1 file changed, 12 insertions(+)
31
36
32
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
37
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
33
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/musicpal.c
39
--- a/target/arm/op_helper.c
35
+++ b/hw/arm/musicpal.c
40
+++ b/target/arm/op_helper.c
36
@@ -XXX,XX +XXX,XX @@ static void mv88w8618_pit_init(Object *obj)
41
@@ -XXX,XX +XXX,XX @@ static inline int check_wfx_trap(CPUARMState *env, bool is_wfe)
37
sysbus_init_mmio(dev, &s->iomem);
42
43
void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
44
{
45
+#ifdef CONFIG_USER_ONLY
46
+ /*
47
+ * WFI in the user-mode emulator is technically permitted but not
48
+ * something any real-world code would do. AArch64 Linux kernels
49
+ * trap it via SCTRL_EL1.nTWI and make it an (expensive) NOP;
50
+ * AArch32 kernels don't trap it so it will delay a bit.
51
+ * For QEMU, make it NOP here, because trying to raise EXCP_HLT
52
+ * would trigger an abort.
53
+ */
54
+ return;
55
+#else
56
CPUState *cs = env_cpu(env);
57
int target_el = check_wfx_trap(env, false);
58
59
@@ -XXX,XX +XXX,XX @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
60
cs->exception_index = EXCP_HLT;
61
cs->halted = 1;
62
cpu_loop_exit(cs);
63
+#endif
38
}
64
}
39
65
40
+static void mv88w8618_pit_finalize(Object *obj)
66
void HELPER(wfe)(CPUARMState *env)
41
+{
42
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
43
+ mv88w8618_pit_state *s = MV88W8618_PIT(dev);
44
+ int i;
45
+
46
+ for (i = 0; i < 4; i++) {
47
+ ptimer_free(s->timer[i].ptimer);
48
+ }
49
+}
50
+
51
static const VMStateDescription mv88w8618_timer_vmsd = {
52
.name = "timer",
53
.version_id = 1,
54
@@ -XXX,XX +XXX,XX @@ static const TypeInfo mv88w8618_pit_info = {
55
.parent = TYPE_SYS_BUS_DEVICE,
56
.instance_size = sizeof(mv88w8618_pit_state),
57
.instance_init = mv88w8618_pit_init,
58
+ .instance_finalize = mv88w8618_pit_finalize,
59
.class_init = mv88w8618_pit_class_init,
60
};
61
62
--
67
--
63
2.20.1
68
2.20.1
64
69
65
70
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
The omap_mmc_reset() function resets its SD card via
2
device_legacy_reset(). We know that the SD card does not have a qbus
3
of its own, so the new device_cold_reset() function (which resets
4
both the device and its child buses) is equivalent here to
5
device_legacy_reset() and we can just switch to the new API.
2
6
3
When running device-introspect-test, a memory leak occurred in the
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
digic_timer_init function, so use ptimer_free() in the finalize function to
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
avoid it.
9
Message-id: 20210430222348.8514-1-peter.maydell@linaro.org
10
---
11
hw/sd/omap_mmc.c | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
6
13
7
ASAN shows memory leak stack:
14
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
8
9
Indirect leak of 288 byte(s) in 3 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf5b04084 in digic_timer_init /qemu/hw/timer/digic-timer.c:142
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564
16
#6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547
17
#7 0xaaabf5b40e84 in digic_init /qemu/hw/arm/digic.c:46
18
#8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
19
#9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
20
#10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
21
#11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
22
#12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/timer/digic-timer.c | 8 ++++++++
30
1 file changed, 8 insertions(+)
31
32
diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c
33
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/digic-timer.c
16
--- a/hw/sd/omap_mmc.c
35
+++ b/hw/timer/digic-timer.c
17
+++ b/hw/sd/omap_mmc.c
36
@@ -XXX,XX +XXX,XX @@ static void digic_timer_init(Object *obj)
18
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
37
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
19
* into any bus, and we must reset it manually. When omap_mmc is
20
* QOMified this must move into the QOM reset function.
21
*/
22
- device_legacy_reset(DEVICE(host->card));
23
+ device_cold_reset(DEVICE(host->card));
38
}
24
}
39
25
40
+static void digic_timer_finalize(Object *obj)
26
static uint64_t omap_mmc_read(void *opaque, hwaddr offset,
41
+{
42
+ DigicTimerState *s = DIGIC_TIMER(obj);
43
+
44
+ ptimer_free(s->ptimer);
45
+}
46
+
47
static void digic_timer_class_init(ObjectClass *klass, void *class_data)
48
{
49
DeviceClass *dc = DEVICE_CLASS(klass);
50
@@ -XXX,XX +XXX,XX @@ static const TypeInfo digic_timer_info = {
51
.parent = TYPE_SYS_BUS_DEVICE,
52
.instance_size = sizeof(DigicTimerState),
53
.instance_init = digic_timer_init,
54
+ .instance_finalize = digic_timer_finalize,
55
.class_init = digic_timer_class_init,
56
};
57
58
--
27
--
59
2.20.1
28
2.20.1
60
29
61
30
diff view generated by jsdifflib
1
Now that we have implemented all the features needed by the v8.1M
1
Both os-win32.h and os-posix.h include system header files. Instead
2
architecture, we can add the model of the Cortex-M55. This is the
2
of having osdep.h include them inside its 'extern "C"' block, make
3
configuration without MVE support; we'll add MVE later.
3
these headers handle that themselves, so that we don't include the
4
system headers inside 'extern "C"'.
5
6
This doesn't fix any current problems, but it's conceptually the
7
right way to handle system headers.
4
8
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201210201433.26262-5-peter.maydell@linaro.org
8
---
11
---
9
target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++
12
include/qemu/osdep.h | 8 ++++----
10
1 file changed, 42 insertions(+)
13
include/sysemu/os-posix.h | 8 ++++++++
14
include/sysemu/os-win32.h | 8 ++++++++
15
3 files changed, 20 insertions(+), 4 deletions(-)
11
16
12
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
17
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
13
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpu_tcg.c
19
--- a/include/qemu/osdep.h
15
+++ b/target/arm/cpu_tcg.c
20
+++ b/include/qemu/osdep.h
16
@@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj)
21
@@ -XXX,XX +XXX,XX @@ QEMU_EXTERN_C int daemon(int, int);
17
cpu->ctr = 0x8000c000;
22
*/
23
#include "glib-compat.h"
24
25
-#ifdef __cplusplus
26
-extern "C" {
27
-#endif
28
-
29
#ifdef _WIN32
30
#include "sysemu/os-win32.h"
31
#endif
32
@@ -XXX,XX +XXX,XX @@ extern "C" {
33
#include "sysemu/os-posix.h"
34
#endif
35
36
+#ifdef __cplusplus
37
+extern "C" {
38
+#endif
39
+
40
#include "qemu/typedefs.h"
41
42
/*
43
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
44
index XXXXXXX..XXXXXXX 100644
45
--- a/include/sysemu/os-posix.h
46
+++ b/include/sysemu/os-posix.h
47
@@ -XXX,XX +XXX,XX @@
48
#include <sys/sysmacros.h>
49
#endif
50
51
+#ifdef __cplusplus
52
+extern "C" {
53
+#endif
54
+
55
void os_set_line_buffering(void);
56
void os_set_proc_name(const char *s);
57
void os_setup_signal_handling(void);
58
@@ -XXX,XX +XXX,XX @@ static inline void qemu_funlockfile(FILE *f)
59
funlockfile(f);
18
}
60
}
19
61
20
+static void cortex_m55_initfn(Object *obj)
62
+#ifdef __cplusplus
21
+{
63
+}
22
+ ARMCPU *cpu = ARM_CPU(obj);
64
+#endif
23
+
65
+
24
+ set_feature(&cpu->env, ARM_FEATURE_V8);
66
#endif
25
+ set_feature(&cpu->env, ARM_FEATURE_V8_1M);
67
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h
26
+ set_feature(&cpu->env, ARM_FEATURE_M);
68
index XXXXXXX..XXXXXXX 100644
27
+ set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
69
--- a/include/sysemu/os-win32.h
28
+ set_feature(&cpu->env, ARM_FEATURE_M_SECURITY);
70
+++ b/include/sysemu/os-win32.h
29
+ set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
71
@@ -XXX,XX +XXX,XX @@
30
+ cpu->midr = 0x410fd221; /* r0p1 */
72
#include <windows.h>
31
+ cpu->revidr = 0;
73
#include <ws2tcpip.h>
32
+ cpu->pmsav7_dregion = 16;
74
33
+ cpu->sau_sregion = 8;
75
+#ifdef __cplusplus
34
+ /*
76
+extern "C" {
35
+ * These are the MVFR* values for the FPU, no MVE configuration;
77
+#endif
36
+ * we will update them later when we implement MVE
78
+
37
+ */
79
#if defined(_WIN64)
38
+ cpu->isar.mvfr0 = 0x10110221;
80
/* On w64, setjmp is implemented by _setjmp which needs a second parameter.
39
+ cpu->isar.mvfr1 = 0x12100011;
81
* If this parameter is NULL, longjump does no stack unwinding.
40
+ cpu->isar.mvfr2 = 0x00000040;
82
@@ -XXX,XX +XXX,XX @@ ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t len, int flags);
41
+ cpu->isar.id_pfr0 = 0x20000030;
83
ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags,
42
+ cpu->isar.id_pfr1 = 0x00000230;
84
struct sockaddr *addr, socklen_t *addrlen);
43
+ cpu->isar.id_dfr0 = 0x10200000;
85
44
+ cpu->id_afr0 = 0x00000000;
86
+#ifdef __cplusplus
45
+ cpu->isar.id_mmfr0 = 0x00111040;
46
+ cpu->isar.id_mmfr1 = 0x00000000;
47
+ cpu->isar.id_mmfr2 = 0x01000000;
48
+ cpu->isar.id_mmfr3 = 0x00000011;
49
+ cpu->isar.id_isar0 = 0x01103110;
50
+ cpu->isar.id_isar1 = 0x02212000;
51
+ cpu->isar.id_isar2 = 0x20232232;
52
+ cpu->isar.id_isar3 = 0x01111131;
53
+ cpu->isar.id_isar4 = 0x01310132;
54
+ cpu->isar.id_isar5 = 0x00000000;
55
+ cpu->isar.id_isar6 = 0x00000000;
56
+ cpu->clidr = 0x00000000; /* caches not implemented */
57
+ cpu->ctr = 0x8303c003;
58
+}
87
+}
88
+#endif
59
+
89
+
60
static const ARMCPRegInfo cortexr5_cp_reginfo[] = {
90
#endif
61
/* Dummy the TCM region regs for the moment */
62
{ .name = "ATCM", .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 0,
63
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = {
64
.class_init = arm_v7m_class_init },
65
{ .name = "cortex-m33", .initfn = cortex_m33_initfn,
66
.class_init = arm_v7m_class_init },
67
+ { .name = "cortex-m55", .initfn = cortex_m55_initfn,
68
+ .class_init = arm_v7m_class_init },
69
{ .name = "cortex-r5", .initfn = cortex_r5_initfn },
70
{ .name = "cortex-r5f", .initfn = cortex_r5f_initfn },
71
{ .name = "ti925t", .initfn = ti925t_initfn },
72
--
91
--
73
2.20.1
92
2.20.1
74
93
75
94
diff view generated by jsdifflib
1
Now that timer_free() implicitly calls timer_del(), sequences
1
Make bswap.h handle being included outside an 'extern "C"' block:
2
timer_del(mytimer);
2
all system headers are included first, then all declarations are
3
timer_free(mytimer);
3
put inside an 'extern "C"' block.
4
4
5
can be simplified to just
5
This requires a little rearrangement as currently we have an ifdef
6
timer_free(mytimer);
6
ladder that has some system includes and some local declarations
7
or definitions, and we need to separate those out.
7
8
8
Add a Coccinelle script to do this transformation.
9
We want to do this because dis-asm.h includes bswap.h, dis-asm.h
10
may need to be included from C++ files, and system headers should
11
not be included within 'extern "C"' blocks.
9
12
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20201215154107.3255-3-peter.maydell@linaro.org
15
---
15
---
16
scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++
16
include/qemu/bswap.h | 26 ++++++++++++++++++++++----
17
1 file changed, 18 insertions(+)
17
1 file changed, 22 insertions(+), 4 deletions(-)
18
create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci
19
18
20
diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccinelle/timer-del-timer-free.cocci
19
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
21
new file mode 100644
20
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX
21
--- a/include/qemu/bswap.h
23
--- /dev/null
22
+++ b/include/qemu/bswap.h
24
+++ b/scripts/coccinelle/timer-del-timer-free.cocci
25
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@
26
+// Remove superfluous timer_del() calls
24
#ifndef BSWAP_H
27
+//
25
#define BSWAP_H
28
+// Copyright Linaro Limited 2020
26
29
+// This work is licensed under the terms of the GNU GPLv2 or later.
27
-#include "fpu/softfloat-types.h"
30
+//
28
-
31
+// spatch --macro-file scripts/cocci-macro-file.h \
29
#ifdef CONFIG_MACHINE_BSWAP_H
32
+// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \
30
# include <sys/endian.h>
33
+// --in-place --dir .
31
# include <machine/bswap.h>
34
+//
32
@@ -XXX,XX +XXX,XX @@
35
+// The timer_free() function now implicitly calls timer_del()
33
# include <endian.h>
36
+// for you, so calls to timer_del() immediately before the
34
#elif defined(CONFIG_BYTESWAP_H)
37
+// timer_free() of the same timer can be deleted.
35
# include <byteswap.h>
36
+#define BSWAP_FROM_BYTESWAP
37
+# else
38
+#define BSWAP_FROM_FALLBACKS
39
+#endif /* ! CONFIG_MACHINE_BSWAP_H */
40
41
+#ifdef __cplusplus
42
+extern "C" {
43
+#endif
38
+
44
+
39
+@@
45
+#include "fpu/softfloat-types.h"
40
+expression T;
46
+
41
+@@
47
+#ifdef BSWAP_FROM_BYTESWAP
42
+-timer_del(T);
48
static inline uint16_t bswap16(uint16_t x)
43
+ timer_free(T);
49
{
50
return bswap_16(x);
51
@@ -XXX,XX +XXX,XX @@ static inline uint64_t bswap64(uint64_t x)
52
{
53
return bswap_64(x);
54
}
55
-# else
56
+#endif
57
+
58
+#ifdef BSWAP_FROM_FALLBACKS
59
static inline uint16_t bswap16(uint16_t x)
60
{
61
return (((x & 0x00ff) << 8) |
62
@@ -XXX,XX +XXX,XX @@ static inline uint64_t bswap64(uint64_t x)
63
((x & 0x00ff000000000000ULL) >> 40) |
64
((x & 0xff00000000000000ULL) >> 56));
65
}
66
-#endif /* ! CONFIG_MACHINE_BSWAP_H */
67
+#endif
68
+
69
+#undef BSWAP_FROM_BYTESWAP
70
+#undef BSWAP_FROM_FALLBACKS
71
72
static inline void bswap16s(uint16_t *s)
73
{
74
@@ -XXX,XX +XXX,XX @@ DO_STN_LDN_P(be)
75
#undef le_bswaps
76
#undef be_bswaps
77
78
+#ifdef __cplusplus
79
+}
80
+#endif
81
+
82
#endif /* BSWAP_H */
44
--
83
--
45
2.20.1
84
2.20.1
46
85
47
86
diff view generated by jsdifflib
1
The CCR is a register most of whose bits are banked between security
1
Make dis-asm.h handle being included outside an 'extern "C"' block;
2
states but where BFHFNMIGN is not, and we keep it in the non-secure
2
this allows us to remove the 'extern "C"' blocks that our two C++
3
entry of the v7m.ccr[] array. The logic which tries to handle this
3
files that include it are using.
4
bit fails to implement the "RAZ/WI from Nonsecure if AIRCR.BFHFNMINS
5
is zero" requirement; correct the omission.
6
4
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201210201433.26262-2-peter.maydell@linaro.org
10
---
7
---
11
hw/intc/armv7m_nvic.c | 15 +++++++++++++++
8
include/disas/dis-asm.h | 12 ++++++++++--
12
1 file changed, 15 insertions(+)
9
disas/arm-a64.cc | 2 --
10
disas/nanomips.cpp | 2 --
11
3 files changed, 10 insertions(+), 6 deletions(-)
13
12
14
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
13
diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/armv7m_nvic.c
15
--- a/include/disas/dis-asm.h
17
+++ b/hw/intc/armv7m_nvic.c
16
+++ b/include/disas/dis-asm.h
18
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
17
@@ -XXX,XX +XXX,XX @@
19
*/
18
#ifndef DISAS_DIS_ASM_H
20
val = cpu->env.v7m.ccr[attrs.secure];
19
#define DISAS_DIS_ASM_H
21
val |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
20
22
+ /* BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0 */
21
+#include "qemu/bswap.h"
23
+ if (!attrs.secure) {
22
+
24
+ if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {
23
+#ifdef __cplusplus
25
+ val &= ~R_V7M_CCR_BFHFNMIGN_MASK;
24
+extern "C" {
26
+ }
25
+#endif
27
+ }
26
+
28
return val;
27
typedef void *PTR;
29
case 0xd24: /* System Handler Control and State (SHCSR) */
28
typedef uint64_t bfd_vma;
30
if (!arm_feature(&cpu->env, ARM_FEATURE_V7)) {
29
typedef int64_t bfd_signed_vma;
31
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
30
@@ -XXX,XX +XXX,XX @@ bool cap_disas_plugin(disassemble_info *info, uint64_t pc, size_t size);
32
(cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK)
31
33
| (value & R_V7M_CCR_BFHFNMIGN_MASK);
32
/* from libbfd */
34
value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
33
35
+ } else {
34
-#include "qemu/bswap.h"
36
+ /*
35
-
37
+ * BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0, so
36
static inline bfd_vma bfd_getl64(const bfd_byte *addr)
38
+ * preserve the state currently in the NS element of the array
37
{
39
+ */
38
return ldq_le_p(addr);
40
+ if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {
39
@@ -XXX,XX +XXX,XX @@ static inline bfd_vma bfd_getb16(const bfd_byte *addr)
41
+ value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
40
42
+ value |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
41
typedef bool bfd_boolean;
43
+ }
42
44
}
43
+#ifdef __cplusplus
45
44
+}
46
cpu->env.v7m.ccr[attrs.secure] = value;
45
+#endif
46
+
47
#endif /* DISAS_DIS_ASM_H */
48
diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
49
index XXXXXXX..XXXXXXX 100644
50
--- a/disas/arm-a64.cc
51
+++ b/disas/arm-a64.cc
52
@@ -XXX,XX +XXX,XX @@
53
*/
54
55
#include "qemu/osdep.h"
56
-extern "C" {
57
#include "disas/dis-asm.h"
58
-}
59
60
#include "vixl/a64/disasm-a64.h"
61
62
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
63
index XXXXXXX..XXXXXXX 100644
64
--- a/disas/nanomips.cpp
65
+++ b/disas/nanomips.cpp
66
@@ -XXX,XX +XXX,XX @@
67
*/
68
69
#include "qemu/osdep.h"
70
-extern "C" {
71
#include "disas/dis-asm.h"
72
-}
73
74
#include <cstring>
75
#include <stdexcept>
47
--
76
--
48
2.20.1
77
2.20.1
49
78
50
79
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
At present, when booting U-Boot on QEMU sabrelite, we see:
3
The i.MX25 PDK board has 2 banks for SDRAM, each can
4
address up to 256 MiB. So the total RAM usable for this
5
board is 512M. When we ask for more we get a misleading
6
error message:
4
7
5
Net: Board Net Initialization Failed
8
$ qemu-system-arm -M imx25-pdk -m 513M
6
No ethernet found.
9
qemu-system-arm: Invalid RAM size, should be 128 MiB
7
10
8
U-Boot scans PHY at address 4/5/6/7 (see board_eth_init() in the
11
Update the error message to better match the reality:
9
U-Boot source: board/boundary/nitrogen6x/nitrogen6x.c). On the real
10
board, the Ethernet PHY is at address 6. Adjust this by updating the
11
"fec-phy-num" property of the fsl_imx6 SoC object.
12
12
13
With this change, U-Boot sees the PHY but complains MAC address:
13
$ qemu-system-arm -M imx25-pdk -m 513M
14
qemu-system-arm: RAM size more than 512 MiB is not supported
14
15
15
Net: using phy at 6
16
Fixes: bf350daae02 ("arm/imx25_pdk: drop RAM size fixup")
16
FEC [PRIME]
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
Error: FEC address not set.
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
19
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
19
This is due to U-Boot tries to read the MAC address from the fuse,
20
Message-id: 20210407225608.1882855-1-f4bug@amsat.org
20
which QEMU does not have any valid content filled in. However this
21
does not prevent the Ethernet from working in QEMU. We just need to
22
set up the MAC address later in the U-Boot command shell, by:
23
24
=> setenv ethaddr 00:11:22:33:44:55
25
26
Signed-off-by: Bin Meng <bin.meng@windriver.com>
27
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
28
Message-id: 20210106063504.10841-4-bmeng.cn@gmail.com
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
30
---
22
---
31
hw/arm/sabrelite.c | 4 ++++
23
hw/arm/imx25_pdk.c | 5 ++---
32
1 file changed, 4 insertions(+)
24
1 file changed, 2 insertions(+), 3 deletions(-)
33
25
34
diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
26
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
35
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/sabrelite.c
28
--- a/hw/arm/imx25_pdk.c
37
+++ b/hw/arm/sabrelite.c
29
+++ b/hw/arm/imx25_pdk.c
38
@@ -XXX,XX +XXX,XX @@ static void sabrelite_init(MachineState *machine)
30
@@ -XXX,XX +XXX,XX @@ static struct arm_boot_info imx25_pdk_binfo;
39
31
40
s = FSL_IMX6(object_new(TYPE_FSL_IMX6));
32
static void imx25_pdk_init(MachineState *machine)
41
object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
33
{
42
+
34
- MachineClass *mc = MACHINE_GET_CLASS(machine);
43
+ /* Ethernet PHY address is 6 */
35
IMX25PDK *s = g_new0(IMX25PDK, 1);
44
+ object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal);
36
unsigned int ram_size;
45
+
37
unsigned int alias_offset;
46
qdev_realize(DEVICE(s), NULL, &error_fatal);
38
@@ -XXX,XX +XXX,XX @@ static void imx25_pdk_init(MachineState *machine)
47
39
48
memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,
40
/* We need to initialize our memory */
41
if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE)) {
42
- char *sz = size_to_str(mc->default_ram_size);
43
- error_report("Invalid RAM size, should be %s", sz);
44
+ char *sz = size_to_str(FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE);
45
+ error_report("RAM size more than %s is not supported", sz);
46
g_free(sz);
47
exit(EXIT_FAILURE);
48
}
49
--
49
--
50
2.20.1
50
2.20.1
51
51
52
52
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
The MPS2 SCC device doesn't have any documentation of its properties;
2
add a "QEMU interface" format comment describing them.
2
3
3
Correct the indexing into s->cpu_ctlr for vCPUs.
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20210504120912.23094-2-peter.maydell@linaro.org
7
---
8
include/hw/misc/mps2-scc.h | 12 ++++++++++++
9
1 file changed, 12 insertions(+)
4
10
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
11
diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
8
Message-id: 20201214222154.3480243-2-edgar.iglesias@gmail.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
hw/intc/arm_gic.c | 4 +++-
12
1 file changed, 3 insertions(+), 1 deletion(-)
13
14
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
15
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/arm_gic.c
13
--- a/include/hw/misc/mps2-scc.h
17
+++ b/hw/intc/arm_gic.c
14
+++ b/include/hw/misc/mps2-scc.h
18
@@ -XXX,XX +XXX,XX @@ static inline void gic_get_best_virq(GICState *s, int cpu,
15
@@ -XXX,XX +XXX,XX @@
19
static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt,
16
* (at your option) any later version.
20
int group_mask)
17
*/
21
{
18
22
+ int cpu_iface = virt ? (cpu + GIC_NCPU) : cpu;
19
+/*
23
+
20
+ * This is a model of the Serial Communication Controller (SCC)
24
if (!virt && !(s->ctlr & group_mask)) {
21
+ * block found in most MPS FPGA images.
25
return false;
22
+ *
26
}
23
+ * QEMU interface:
27
@@ -XXX,XX +XXX,XX @@ static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt,
24
+ * + sysbus MMIO region 0: the register bank
28
return false;
25
+ * + QOM property "scc-cfg4": value of the read-only CFG4 register
29
}
26
+ * + QOM property "scc-aid": value of the read-only SCC_AID register
30
27
+ * + QOM property "scc-id": value of the read-only SCC_ID register
31
- if (!(s->cpu_ctlr[cpu] & group_mask)) {
28
+ * + QOM property array "oscclk": reset values of the OSCCLK registers
32
+ if (!(s->cpu_ctlr[cpu_iface] & group_mask)) {
29
+ * (which are accessed via the SYS_CFG channel provided by this device)
33
return false;
30
+ */
34
}
31
#ifndef MPS2_SCC_H
32
#define MPS2_SCC_H
35
33
36
--
34
--
37
2.20.1
35
2.20.1
38
36
39
37
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
On some boards, SCC config register CFG0 bit 0 controls whether
2
parts of the board memory map are remapped. Support this with:
3
* a device property scc-cfg0 so the board can specify the
4
initial value of the CFG0 register
5
* an outbound GPIO line which tracks bit 0 and which the board
6
can wire up to provide the remapping
2
7
3
virt machine's 'smp_cpus' and machine->smp.cpus must always have the
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
same value. And, anywhere we have virt machine state we have machine
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
state. So let's remove the redundancy. Also, to make it easier to see
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
that machine->smp is the true source for "smp_cpus" and "max_cpus",
11
Message-id: 20210504120912.23094-3-peter.maydell@linaro.org
7
avoid passing them in function parameters, preferring instead to get
12
---
8
them from the state.
13
include/hw/misc/mps2-scc.h | 9 +++++++++
14
hw/misc/mps2-scc.c | 13 ++++++++++---
15
2 files changed, 19 insertions(+), 3 deletions(-)
9
16
10
No functional change intended.
17
diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h
11
12
Signed-off-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
14
Reviewed-by: Ying Fang <fangying1@huawei.com>
15
Message-id: 20201215174815.51520-1-drjones@redhat.com
16
[PMM: minor formatting tweak to smp_cpus variable declaration]
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
19
include/hw/arm/virt.h | 3 +--
20
hw/arm/virt-acpi-build.c | 9 +++++----
21
hw/arm/virt.c | 21 ++++++++++-----------
22
3 files changed, 16 insertions(+), 17 deletions(-)
23
24
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
25
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/arm/virt.h
19
--- a/include/hw/misc/mps2-scc.h
27
+++ b/include/hw/arm/virt.h
20
+++ b/include/hw/misc/mps2-scc.h
28
@@ -XXX,XX +XXX,XX @@ struct VirtMachineState {
21
@@ -XXX,XX +XXX,XX @@
29
MemMapEntry *memmap;
22
* + QOM property "scc-cfg4": value of the read-only CFG4 register
30
char *pciehb_nodename;
23
* + QOM property "scc-aid": value of the read-only SCC_AID register
31
const int *irqmap;
24
* + QOM property "scc-id": value of the read-only SCC_ID register
32
- int smp_cpus;
25
+ * + QOM property "scc-cfg0": reset value of the CFG0 register
33
void *fdt;
26
* + QOM property array "oscclk": reset values of the OSCCLK registers
34
int fdt_size;
27
* (which are accessed via the SYS_CFG channel provided by this device)
35
uint32_t clock_phandle;
28
+ * + named GPIO output "remap": this tracks the value of CFG0 register
36
@@ -XXX,XX +XXX,XX @@ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms)
29
+ * bit 0. Boards where this bit controls memory remapping should
37
30
+ * connect this GPIO line to a function performing that mapping.
38
assert(vms->gic_version == VIRT_GIC_VERSION_3);
31
+ * Boards where bit 0 has no special function should leave the GPIO
39
32
+ * output disconnected.
40
- return vms->smp_cpus > redist0_capacity ? 2 : 1;
33
*/
41
+ return MACHINE(vms)->smp.cpus > redist0_capacity ? 2 : 1;
34
#ifndef MPS2_SCC_H
35
#define MPS2_SCC_H
36
@@ -XXX,XX +XXX,XX @@ struct MPS2SCC {
37
uint32_t num_oscclk;
38
uint32_t *oscclk;
39
uint32_t *oscclk_reset;
40
+ uint32_t cfg0_reset;
41
+
42
+ qemu_irq remap;
43
};
44
45
#endif
46
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/misc/mps2-scc.c
49
+++ b/hw/misc/mps2-scc.c
50
@@ -XXX,XX +XXX,XX @@
51
#include "qemu/bitops.h"
52
#include "trace.h"
53
#include "hw/sysbus.h"
54
+#include "hw/irq.h"
55
#include "migration/vmstate.h"
56
#include "hw/registerfields.h"
57
#include "hw/misc/mps2-scc.h"
58
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value,
59
switch (offset) {
60
case A_CFG0:
61
/*
62
- * TODO on some boards bit 0 controls RAM remapping;
63
- * on others bit 1 is CPU_WAIT.
64
+ * On some boards bit 0 controls board-specific remapping;
65
+ * we always reflect bit 0 in the 'remap' GPIO output line,
66
+ * and let the board wire it up or not as it chooses.
67
+ * TODO on some boards bit 1 is CPU_WAIT.
68
*/
69
s->cfg0 = value;
70
+ qemu_set_irq(s->remap, s->cfg0 & 1);
71
break;
72
case A_CFG1:
73
s->cfg1 = value;
74
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_reset(DeviceState *dev)
75
int i;
76
77
trace_mps2_scc_reset();
78
- s->cfg0 = 0;
79
+ s->cfg0 = s->cfg0_reset;
80
s->cfg1 = 0;
81
s->cfg2 = 0;
82
s->cfg5 = 0;
83
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_init(Object *obj)
84
85
memory_region_init_io(&s->iomem, obj, &mps2_scc_ops, s, "mps2-scc", 0x1000);
86
sysbus_init_mmio(sbd, &s->iomem);
87
+ qdev_init_gpio_out_named(DEVICE(obj), &s->remap, "remap", 1);
42
}
88
}
43
89
44
#endif /* QEMU_ARM_VIRT_H */
90
static void mps2_scc_realize(DeviceState *dev, Error **errp)
45
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
91
@@ -XXX,XX +XXX,XX @@ static Property mps2_scc_properties[] = {
46
index XXXXXXX..XXXXXXX 100644
92
DEFINE_PROP_UINT32("scc-cfg4", MPS2SCC, cfg4, 0),
47
--- a/hw/arm/virt-acpi-build.c
93
DEFINE_PROP_UINT32("scc-aid", MPS2SCC, aid, 0),
48
+++ b/hw/arm/virt-acpi-build.c
94
DEFINE_PROP_UINT32("scc-id", MPS2SCC, id, 0),
49
@@ -XXX,XX +XXX,XX @@
95
+ /* Reset value for CFG0 register */
50
96
+ DEFINE_PROP_UINT32("scc-cfg0", MPS2SCC, cfg0_reset, 0),
51
#define ACPI_BUILD_TABLE_SIZE 0x20000
52
53
-static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
54
+static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms)
55
{
56
+ MachineState *ms = MACHINE(vms);
57
uint16_t i;
58
59
- for (i = 0; i < smp_cpus; i++) {
60
+ for (i = 0; i < ms->smp.cpus; i++) {
61
Aml *dev = aml_device("C%.03X", i);
62
aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
63
aml_append(dev, aml_name_decl("_UID", aml_int(i)));
64
@@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
65
gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
66
gicd->version = vms->gic_version;
67
68
- for (i = 0; i < vms->smp_cpus; i++) {
69
+ for (i = 0; i < MACHINE(vms)->smp.cpus; i++) {
70
AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
71
sizeof(*gicc));
72
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
73
@@ -XXX,XX +XXX,XX @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
74
* the RTC ACPI device at all when using UEFI.
75
*/
76
scope = aml_scope("\\_SB");
77
- acpi_dsdt_add_cpus(scope, vms->smp_cpus);
78
+ acpi_dsdt_add_cpus(scope, vms);
79
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
80
(irqmap[VIRT_UART] + ARM_SPI_BASE));
81
if (vmc->acpi_expose_flash) {
82
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/hw/arm/virt.c
85
+++ b/hw/arm/virt.c
86
@@ -XXX,XX +XXX,XX @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
87
if (vms->gic_version == VIRT_GIC_VERSION_2) {
88
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
89
GIC_FDT_IRQ_PPI_CPU_WIDTH,
90
- (1 << vms->smp_cpus) - 1);
91
+ (1 << MACHINE(vms)->smp.cpus) - 1);
92
}
93
94
qemu_fdt_add_subnode(vms->fdt, "/timer");
95
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
96
int cpu;
97
int addr_cells = 1;
98
const MachineState *ms = MACHINE(vms);
99
+ int smp_cpus = ms->smp.cpus;
100
101
/*
97
/*
102
* From Documentation/devicetree/bindings/arm/cpus.txt
98
* These are the initial settings for the source clocks on the board.
103
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
99
* In hardware they can be configured via a config file read by the
104
* The simplest way to go is to examine affinity IDs of all our CPUs. If
105
* at least one of them has Aff3 populated, we set #address-cells to 2.
106
*/
107
- for (cpu = 0; cpu < vms->smp_cpus; cpu++) {
108
+ for (cpu = 0; cpu < smp_cpus; cpu++) {
109
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
110
111
if (armcpu->mp_affinity & ARM_AFF3_MASK) {
112
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
113
qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#address-cells", addr_cells);
114
qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#size-cells", 0x0);
115
116
- for (cpu = vms->smp_cpus - 1; cpu >= 0; cpu--) {
117
+ for (cpu = smp_cpus - 1; cpu >= 0; cpu--) {
118
char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
119
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
120
CPUState *cs = CPU(armcpu);
121
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
122
qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
123
armcpu->dtb_compatible);
124
125
- if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED
126
- && vms->smp_cpus > 1) {
127
+ if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) {
128
qemu_fdt_setprop_string(vms->fdt, nodename,
129
"enable-method", "psci");
130
}
131
@@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
132
if (vms->gic_version == VIRT_GIC_VERSION_2) {
133
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
134
GIC_FDT_IRQ_PPI_CPU_WIDTH,
135
- (1 << vms->smp_cpus) - 1);
136
+ (1 << MACHINE(vms)->smp.cpus) - 1);
137
}
138
139
qemu_fdt_add_subnode(vms->fdt, "/pmu");
140
@@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms)
141
* virt_cpu_post_init() must be called after the CPUs have
142
* been realized and the GIC has been created.
143
*/
144
-static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus,
145
- MemoryRegion *sysmem)
146
+static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
147
{
148
+ int max_cpus = MACHINE(vms)->smp.max_cpus;
149
bool aarch64, pmu, steal_time;
150
CPUState *cpu;
151
152
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
153
exit(1);
154
}
155
156
- vms->smp_cpus = smp_cpus;
157
-
158
if (vms->virt && kvm_enabled()) {
159
error_report("mach-virt: KVM does not support providing "
160
"Virtualization extensions to the guest CPU");
161
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
162
create_fdt(vms);
163
164
possible_cpus = mc->possible_cpu_arch_ids(machine);
165
+ assert(possible_cpus->len == max_cpus);
166
for (n = 0; n < possible_cpus->len; n++) {
167
Object *cpuobj;
168
CPUState *cs;
169
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
170
171
create_gic(vms);
172
173
- virt_cpu_post_init(vms, possible_cpus->len, sysmem);
174
+ virt_cpu_post_init(vms, sysmem);
175
176
fdt_add_pmu_nodes(vms);
177
178
--
100
--
179
2.20.1
101
2.20.1
180
102
181
103
diff view generated by jsdifflib
1
This commit is the result of running the timer-del-timer-free.cocci
1
The AN524 FPGA image supports two memory maps, which differ in where
2
script on the whole source tree.
2
the QSPI and BRAM are. In the default map, the BRAM is at
3
0x0000_0000, and the QSPI at 0x2800_0000. In the second map, they
4
are the other way around.
5
6
In hardware, the initial mapping can be selected by the user by
7
writing either "REMAP: BRAM" (the default) or "REMAP: QSPI" in the
8
board configuration file. The board config file is acted on by the
9
"Motherboard Configuration Controller", which is an entirely separate
10
microcontroller on the dev board but outside the FPGA.
11
12
The guest can also dynamically change the mapping via the SCC
13
CFG_REG0 register.
14
15
Implement this functionality for QEMU, using a machine property
16
"remap" with valid values "BRAM" and "QSPI" to allow the user to set
17
the initial mapping, in the same way they can on the FPGA, and
18
wiring up the bit from the SCC register to also switch the mapping.
3
19
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Acked-by: Corey Minyard <cminyard@mvista.com>
6
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201215154107.3255-4-peter.maydell@linaro.org
22
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
23
Message-id: 20210504120912.23094-4-peter.maydell@linaro.org
10
---
24
---
11
block/iscsi.c | 2 --
25
docs/system/arm/mps2.rst | 10 ++++
12
block/nbd.c | 1 -
26
hw/arm/mps2-tz.c | 108 ++++++++++++++++++++++++++++++++++++++-
13
block/qcow2.c | 1 -
27
2 files changed, 117 insertions(+), 1 deletion(-)
14
hw/block/nvme.c | 2 --
28
15
hw/char/serial.c | 2 --
29
diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst
16
hw/char/virtio-serial-bus.c | 2 --
17
hw/ide/core.c | 1 -
18
hw/input/hid.c | 1 -
19
hw/intc/apic.c | 1 -
20
hw/intc/ioapic.c | 1 -
21
hw/ipmi/ipmi_bmc_extern.c | 1 -
22
hw/net/e1000.c | 3 ---
23
hw/net/e1000e_core.c | 8 --------
24
hw/net/pcnet-pci.c | 1 -
25
hw/net/rtl8139.c | 1 -
26
hw/net/spapr_llan.c | 1 -
27
hw/net/virtio-net.c | 2 --
28
hw/s390x/s390-pci-inst.c | 1 -
29
hw/sd/sd.c | 1 -
30
hw/sd/sdhci.c | 2 --
31
hw/usb/dev-hub.c | 1 -
32
hw/usb/hcd-ehci.c | 1 -
33
hw/usb/hcd-ohci-pci.c | 1 -
34
hw/usb/hcd-uhci.c | 1 -
35
hw/usb/hcd-xhci.c | 1 -
36
hw/usb/redirect.c | 1 -
37
hw/vfio/display.c | 1 -
38
hw/virtio/vhost-vsock-common.c | 1 -
39
hw/virtio/virtio-balloon.c | 1 -
40
hw/virtio/virtio-rng.c | 1 -
41
hw/watchdog/wdt_diag288.c | 1 -
42
hw/watchdog/wdt_i6300esb.c | 1 -
43
migration/colo.c | 1 -
44
monitor/hmp-cmds.c | 1 -
45
net/announce.c | 1 -
46
net/colo-compare.c | 1 -
47
net/slirp.c | 1 -
48
replay/replay-debugging.c | 1 -
49
target/s390x/cpu.c | 2 --
50
ui/console.c | 1 -
51
ui/spice-core.c | 1 -
52
util/throttle.c | 1 -
53
42 files changed, 58 deletions(-)
54
55
diff --git a/block/iscsi.c b/block/iscsi.c
56
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
57
--- a/block/iscsi.c
31
--- a/docs/system/arm/mps2.rst
58
+++ b/block/iscsi.c
32
+++ b/docs/system/arm/mps2.rst
59
@@ -XXX,XX +XXX,XX @@ static void iscsi_detach_aio_context(BlockDriverState *bs)
33
@@ -XXX,XX +XXX,XX @@ Differences between QEMU and real hardware:
60
iscsilun->events = 0;
34
flash, but only as simple ROM, so attempting to rewrite the flash
61
35
from the guest will fail
62
if (iscsilun->nop_timer) {
36
- QEMU does not model the USB controller in MPS3 boards
63
- timer_del(iscsilun->nop_timer);
37
+
64
timer_free(iscsilun->nop_timer);
38
+Machine-specific options
65
iscsilun->nop_timer = NULL;
39
+""""""""""""""""""""""""
66
}
40
+
67
if (iscsilun->event_timer) {
41
+The following machine-specific options are supported:
68
- timer_del(iscsilun->event_timer);
42
+
69
timer_free(iscsilun->event_timer);
43
+remap
70
iscsilun->event_timer = NULL;
44
+ Supported for ``mps3-an524`` only.
71
}
45
+ Set ``BRAM``/``QSPI`` to select the initial memory mapping. The
72
diff --git a/block/nbd.c b/block/nbd.c
46
+ default is ``BRAM``.
47
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
73
index XXXXXXX..XXXXXXX 100644
48
index XXXXXXX..XXXXXXX 100644
74
--- a/block/nbd.c
49
--- a/hw/arm/mps2-tz.c
75
+++ b/block/nbd.c
50
+++ b/hw/arm/mps2-tz.c
76
@@ -XXX,XX +XXX,XX @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *s)
51
@@ -XXX,XX +XXX,XX @@
77
static void reconnect_delay_timer_del(BDRVNBDState *s)
52
#include "hw/boards.h"
78
{
53
#include "exec/address-spaces.h"
79
if (s->reconnect_delay_timer) {
54
#include "sysemu/sysemu.h"
80
- timer_del(s->reconnect_delay_timer);
55
+#include "sysemu/reset.h"
81
timer_free(s->reconnect_delay_timer);
56
#include "hw/misc/unimp.h"
82
s->reconnect_delay_timer = NULL;
57
#include "hw/char/cmsdk-apb-uart.h"
83
}
58
#include "hw/timer/cmsdk-apb-timer.h"
84
diff --git a/block/qcow2.c b/block/qcow2.c
59
@@ -XXX,XX +XXX,XX @@
85
index XXXXXXX..XXXXXXX 100644
60
#include "hw/core/split-irq.h"
86
--- a/block/qcow2.c
61
#include "hw/qdev-clock.h"
87
+++ b/block/qcow2.c
62
#include "qom/object.h"
88
@@ -XXX,XX +XXX,XX @@ static void cache_clean_timer_del(BlockDriverState *bs)
63
+#include "hw/irq.h"
89
{
64
90
BDRVQcow2State *s = bs->opaque;
65
#define MPS2TZ_NUMIRQ_MAX 96
91
if (s->cache_clean_timer) {
66
#define MPS2TZ_RAM_MAX 5
92
- timer_del(s->cache_clean_timer);
67
@@ -XXX,XX +XXX,XX @@ struct MPS2TZMachineState {
93
timer_free(s->cache_clean_timer);
68
SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ_MAX];
94
s->cache_clean_timer = NULL;
69
Clock *sysclk;
95
}
70
Clock *s32kclk;
96
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
71
+
97
index XXXXXXX..XXXXXXX 100644
72
+ bool remap;
98
--- a/hw/block/nvme.c
73
+ qemu_irq remap_irq;
99
+++ b/hw/block/nvme.c
74
};
100
@@ -XXX,XX +XXX,XX @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
75
101
static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n)
76
#define TYPE_MPS2TZ_MACHINE "mps2tz"
102
{
77
@@ -XXX,XX +XXX,XX @@ static const RAMInfo an505_raminfo[] = { {
103
n->sq[sq->sqid] = NULL;
78
},
104
- timer_del(sq->timer);
79
};
105
timer_free(sq->timer);
80
106
g_free(sq->io_req);
81
+/*
107
if (sq->sqid) {
82
+ * Note that the addresses and MPC numbering here should match up
108
@@ -XXX,XX +XXX,XX @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest *req)
83
+ * with those used in remap_memory(), which can swap the BRAM and QSPI.
109
static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n)
84
+ */
110
{
85
static const RAMInfo an524_raminfo[] = { {
111
n->cq[cq->cqid] = NULL;
86
.name = "bram",
112
- timer_del(cq->timer);
87
.base = 0x00000000,
113
timer_free(cq->timer);
88
@@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_scc(MPS2TZMachineState *mms, void *opaque,
114
msix_vector_unuse(&n->parent_obj, cq->vector);
89
115
if (cq->cqid) {
90
object_initialize_child(OBJECT(mms), "scc", scc, TYPE_MPS2_SCC);
116
diff --git a/hw/char/serial.c b/hw/char/serial.c
91
sccdev = DEVICE(scc);
117
index XXXXXXX..XXXXXXX 100644
92
+ qdev_prop_set_uint32(sccdev, "scc-cfg0", mms->remap ? 1 : 0);
118
--- a/hw/char/serial.c
93
qdev_prop_set_uint32(sccdev, "scc-cfg4", 0x2);
119
+++ b/hw/char/serial.c
94
qdev_prop_set_uint32(sccdev, "scc-aid", 0x00200008);
120
@@ -XXX,XX +XXX,XX @@ static void serial_unrealize(DeviceState *dev)
95
qdev_prop_set_uint32(sccdev, "scc-id", mmc->scc_id);
121
96
@@ -XXX,XX +XXX,XX @@ static MemoryRegion *make_mpc(MPS2TZMachineState *mms, void *opaque,
122
qemu_chr_fe_deinit(&s->chr, false);
97
return sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 0);
123
98
}
124
- timer_del(s->modem_status_poll);
99
125
timer_free(s->modem_status_poll);
100
+static hwaddr boot_mem_base(MPS2TZMachineState *mms)
126
101
+{
127
- timer_del(s->fifo_timeout_timer);
102
+ /*
128
timer_free(s->fifo_timeout_timer);
103
+ * Return the canonical address of the block which will be mapped
129
104
+ * at address 0x0 (i.e. where the vector table is).
130
fifo8_destroy(&s->recv_fifo);
105
+ * This is usually 0, but if the AN524 alternate memory map is
131
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
106
+ * enabled it will be the base address of the QSPI block.
132
index XXXXXXX..XXXXXXX 100644
107
+ */
133
--- a/hw/char/virtio-serial-bus.c
108
+ return mms->remap ? 0x28000000 : 0;
134
+++ b/hw/char/virtio-serial-bus.c
109
+}
135
@@ -XXX,XX +XXX,XX @@ static void virtio_serial_post_load_timer_cb(void *opaque)
110
+
111
+static void remap_memory(MPS2TZMachineState *mms, int map)
112
+{
113
+ /*
114
+ * Remap the memory for the AN524. 'map' is the value of
115
+ * SCC CFG_REG0 bit 0, i.e. 0 for the default map and 1
116
+ * for the "option 1" mapping where QSPI is at address 0.
117
+ *
118
+ * Effectively we need to swap around the "upstream" ends of
119
+ * MPC 0 and MPC 1.
120
+ */
121
+ MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms);
122
+ int i;
123
+
124
+ if (mmc->fpga_type != FPGA_AN524) {
125
+ return;
126
+ }
127
+
128
+ memory_region_transaction_begin();
129
+ for (i = 0; i < 2; i++) {
130
+ TZMPC *mpc = &mms->mpc[i];
131
+ MemoryRegion *upstream = sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 1);
132
+ hwaddr addr = (i ^ map) ? 0x28000000 : 0;
133
+
134
+ memory_region_set_address(upstream, addr);
135
+ }
136
+ memory_region_transaction_commit();
137
+}
138
+
139
+static void remap_irq_fn(void *opaque, int n, int level)
140
+{
141
+ MPS2TZMachineState *mms = opaque;
142
+
143
+ remap_memory(mms, level);
144
+}
145
+
146
static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque,
147
const char *name, hwaddr size,
148
const int *irqs)
149
@@ -XXX,XX +XXX,XX @@ static uint32_t boot_ram_size(MPS2TZMachineState *mms)
150
MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms);
151
152
for (p = mmc->raminfo; p->name; p++) {
153
- if (p->base == 0) {
154
+ if (p->base == boot_mem_base(mms)) {
155
return p->size;
136
}
156
}
137
}
157
}
138
g_free(s->post_load->connected);
158
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
139
- timer_del(s->post_load->timer);
159
140
timer_free(s->post_load->timer);
160
create_non_mpc_ram(mms);
141
g_free(s->post_load);
161
142
s->post_load = NULL;
162
+ if (mmc->fpga_type == FPGA_AN524) {
143
@@ -XXX,XX +XXX,XX @@ static void virtio_serial_device_unrealize(DeviceState *dev)
163
+ /*
144
g_free(vser->ports_map);
164
+ * Connect the line from the SCC so that we can remap when the
145
if (vser->post_load) {
165
+ * guest updates that register.
146
g_free(vser->post_load->connected);
166
+ */
147
- timer_del(vser->post_load->timer);
167
+ mms->remap_irq = qemu_allocate_irq(remap_irq_fn, mms, 0);
148
timer_free(vser->post_load->timer);
168
+ qdev_connect_gpio_out_named(DEVICE(&mms->scc), "remap", 0,
149
g_free(vser->post_load);
169
+ mms->remap_irq);
150
}
170
+ }
151
diff --git a/hw/ide/core.c b/hw/ide/core.c
171
+
152
index XXXXXXX..XXXXXXX 100644
172
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
153
--- a/hw/ide/core.c
173
boot_ram_size(mms));
154
+++ b/hw/ide/core.c
174
}
155
@@ -XXX,XX +XXX,XX @@ void ide_init2(IDEBus *bus, qemu_irq irq)
175
@@ -XXX,XX +XXX,XX @@ static void mps2_tz_idau_check(IDAUInterface *ii, uint32_t address,
156
176
*iregion = region;
157
void ide_exit(IDEState *s)
177
}
178
179
+static char *mps2_get_remap(Object *obj, Error **errp)
180
+{
181
+ MPS2TZMachineState *mms = MPS2TZ_MACHINE(obj);
182
+ const char *val = mms->remap ? "QSPI" : "BRAM";
183
+ return g_strdup(val);
184
+}
185
+
186
+static void mps2_set_remap(Object *obj, const char *value, Error **errp)
187
+{
188
+ MPS2TZMachineState *mms = MPS2TZ_MACHINE(obj);
189
+
190
+ if (!strcmp(value, "BRAM")) {
191
+ mms->remap = false;
192
+ } else if (!strcmp(value, "QSPI")) {
193
+ mms->remap = true;
194
+ } else {
195
+ error_setg(errp, "Invalid remap value");
196
+ error_append_hint(errp, "Valid values are BRAM and QSPI.\n");
197
+ }
198
+}
199
+
200
+static void mps2_machine_reset(MachineState *machine)
201
+{
202
+ MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine);
203
+
204
+ /*
205
+ * Set the initial memory mapping before triggering the reset of
206
+ * the rest of the system, so that the guest image loader and CPU
207
+ * reset see the correct mapping.
208
+ */
209
+ remap_memory(mms, mms->remap);
210
+ qemu_devices_reset();
211
+}
212
+
213
static void mps2tz_class_init(ObjectClass *oc, void *data)
158
{
214
{
159
- timer_del(s->sector_write_timer);
215
MachineClass *mc = MACHINE_CLASS(oc);
160
timer_free(s->sector_write_timer);
216
IDAUInterfaceClass *iic = IDAU_INTERFACE_CLASS(oc);
161
qemu_vfree(s->smart_selftest_data);
217
162
qemu_vfree(s->io_buffer);
218
mc->init = mps2tz_common_init;
163
diff --git a/hw/input/hid.c b/hw/input/hid.c
219
+ mc->reset = mps2_machine_reset;
164
index XXXXXXX..XXXXXXX 100644
220
iic->check = mps2_tz_idau_check;
165
--- a/hw/input/hid.c
221
}
166
+++ b/hw/input/hid.c
222
167
@@ -XXX,XX +XXX,XX @@ static void hid_idle_timer(void *opaque)
223
@@ -XXX,XX +XXX,XX @@ static void mps3tz_an524_class_init(ObjectClass *oc, void *data)
168
static void hid_del_idle_timer(HIDState *hs)
224
mmc->raminfo = an524_raminfo;
169
{
225
mmc->armsse_type = TYPE_SSE200;
170
if (hs->idle_timer) {
226
mps2tz_set_default_ram_info(mmc);
171
- timer_del(hs->idle_timer);
227
+
172
timer_free(hs->idle_timer);
228
+ object_class_property_add_str(oc, "remap", mps2_get_remap, mps2_set_remap);
173
hs->idle_timer = NULL;
229
+ object_class_property_set_description(oc, "remap",
174
}
230
+ "Set memory mapping. Valid values "
175
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
231
+ "are BRAM (default) and QSPI.");
176
index XXXXXXX..XXXXXXX 100644
232
}
177
--- a/hw/intc/apic.c
233
178
+++ b/hw/intc/apic.c
234
static void mps3tz_an547_class_init(ObjectClass *oc, void *data)
179
@@ -XXX,XX +XXX,XX @@ static void apic_unrealize(DeviceState *dev)
180
{
181
APICCommonState *s = APIC(dev);
182
183
- timer_del(s->timer);
184
timer_free(s->timer);
185
local_apics[s->id] = NULL;
186
}
187
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
188
index XXXXXXX..XXXXXXX 100644
189
--- a/hw/intc/ioapic.c
190
+++ b/hw/intc/ioapic.c
191
@@ -XXX,XX +XXX,XX @@ static void ioapic_unrealize(DeviceState *dev)
192
{
193
IOAPICCommonState *s = IOAPIC_COMMON(dev);
194
195
- timer_del(s->delayed_ioapic_service_timer);
196
timer_free(s->delayed_ioapic_service_timer);
197
}
198
199
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
200
index XXXXXXX..XXXXXXX 100644
201
--- a/hw/ipmi/ipmi_bmc_extern.c
202
+++ b/hw/ipmi/ipmi_bmc_extern.c
203
@@ -XXX,XX +XXX,XX @@ static void ipmi_bmc_extern_finalize(Object *obj)
204
{
205
IPMIBmcExtern *ibe = IPMI_BMC_EXTERN(obj);
206
207
- timer_del(ibe->extern_timer);
208
timer_free(ibe->extern_timer);
209
}
210
211
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
212
index XXXXXXX..XXXXXXX 100644
213
--- a/hw/net/e1000.c
214
+++ b/hw/net/e1000.c
215
@@ -XXX,XX +XXX,XX @@ pci_e1000_uninit(PCIDevice *dev)
216
{
217
E1000State *d = E1000(dev);
218
219
- timer_del(d->autoneg_timer);
220
timer_free(d->autoneg_timer);
221
- timer_del(d->mit_timer);
222
timer_free(d->mit_timer);
223
- timer_del(d->flush_queue_timer);
224
timer_free(d->flush_queue_timer);
225
qemu_del_nic(d->nic);
226
}
227
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
228
index XXXXXXX..XXXXXXX 100644
229
--- a/hw/net/e1000e_core.c
230
+++ b/hw/net/e1000e_core.c
231
@@ -XXX,XX +XXX,XX @@ e1000e_intrmgr_pci_unint(E1000ECore *core)
232
{
233
int i;
234
235
- timer_del(core->radv.timer);
236
timer_free(core->radv.timer);
237
- timer_del(core->rdtr.timer);
238
timer_free(core->rdtr.timer);
239
- timer_del(core->raid.timer);
240
timer_free(core->raid.timer);
241
242
- timer_del(core->tadv.timer);
243
timer_free(core->tadv.timer);
244
- timer_del(core->tidv.timer);
245
timer_free(core->tidv.timer);
246
247
- timer_del(core->itr.timer);
248
timer_free(core->itr.timer);
249
250
for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) {
251
- timer_del(core->eitr[i].timer);
252
timer_free(core->eitr[i].timer);
253
}
254
}
255
@@ -XXX,XX +XXX,XX @@ e1000e_core_pci_uninit(E1000ECore *core)
256
{
257
int i;
258
259
- timer_del(core->autoneg_timer);
260
timer_free(core->autoneg_timer);
261
262
e1000e_intrmgr_pci_unint(core);
263
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
264
index XXXXXXX..XXXXXXX 100644
265
--- a/hw/net/pcnet-pci.c
266
+++ b/hw/net/pcnet-pci.c
267
@@ -XXX,XX +XXX,XX @@ static void pci_pcnet_uninit(PCIDevice *dev)
268
PCIPCNetState *d = PCI_PCNET(dev);
269
270
qemu_free_irq(d->state.irq);
271
- timer_del(d->state.poll_timer);
272
timer_free(d->state.poll_timer);
273
qemu_del_nic(d->state.nic);
274
}
275
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
276
index XXXXXXX..XXXXXXX 100644
277
--- a/hw/net/rtl8139.c
278
+++ b/hw/net/rtl8139.c
279
@@ -XXX,XX +XXX,XX @@ static void pci_rtl8139_uninit(PCIDevice *dev)
280
281
g_free(s->cplus_txbuffer);
282
s->cplus_txbuffer = NULL;
283
- timer_del(s->timer);
284
timer_free(s->timer);
285
qemu_del_nic(s->nic);
286
}
287
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
288
index XXXXXXX..XXXXXXX 100644
289
--- a/hw/net/spapr_llan.c
290
+++ b/hw/net/spapr_llan.c
291
@@ -XXX,XX +XXX,XX @@ static void spapr_vlan_instance_finalize(Object *obj)
292
}
293
294
if (dev->rxp_timer) {
295
- timer_del(dev->rxp_timer);
296
timer_free(dev->rxp_timer);
297
}
298
}
299
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
300
index XXXXXXX..XXXXXXX 100644
301
--- a/hw/net/virtio-net.c
302
+++ b/hw/net/virtio-net.c
303
@@ -XXX,XX +XXX,XX @@ static void virtio_net_rsc_cleanup(VirtIONet *n)
304
g_free(seg);
305
}
306
307
- timer_del(chain->drain_timer);
308
timer_free(chain->drain_timer);
309
QTAILQ_REMOVE(&n->rsc_chains, chain, next);
310
g_free(chain);
311
@@ -XXX,XX +XXX,XX @@ static void virtio_net_del_queue(VirtIONet *n, int index)
312
313
virtio_del_queue(vdev, index * 2);
314
if (q->tx_timer) {
315
- timer_del(q->tx_timer);
316
timer_free(q->tx_timer);
317
q->tx_timer = NULL;
318
} else {
319
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
320
index XXXXXXX..XXXXXXX 100644
321
--- a/hw/s390x/s390-pci-inst.c
322
+++ b/hw/s390x/s390-pci-inst.c
323
@@ -XXX,XX +XXX,XX @@ void pci_dereg_ioat(S390PCIIOMMU *iommu)
324
void fmb_timer_free(S390PCIBusDevice *pbdev)
325
{
326
if (pbdev->fmb_timer) {
327
- timer_del(pbdev->fmb_timer);
328
timer_free(pbdev->fmb_timer);
329
pbdev->fmb_timer = NULL;
330
}
331
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
332
index XXXXXXX..XXXXXXX 100644
333
--- a/hw/sd/sd.c
334
+++ b/hw/sd/sd.c
335
@@ -XXX,XX +XXX,XX @@ static void sd_instance_finalize(Object *obj)
336
{
337
SDState *sd = SD_CARD(obj);
338
339
- timer_del(sd->ocr_power_timer);
340
timer_free(sd->ocr_power_timer);
341
}
342
343
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
344
index XXXXXXX..XXXXXXX 100644
345
--- a/hw/sd/sdhci.c
346
+++ b/hw/sd/sdhci.c
347
@@ -XXX,XX +XXX,XX @@ void sdhci_initfn(SDHCIState *s)
348
349
void sdhci_uninitfn(SDHCIState *s)
350
{
351
- timer_del(s->insert_timer);
352
timer_free(s->insert_timer);
353
- timer_del(s->transfer_timer);
354
timer_free(s->transfer_timer);
355
356
g_free(s->fifo_buffer);
357
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
358
index XXXXXXX..XXXXXXX 100644
359
--- a/hw/usb/dev-hub.c
360
+++ b/hw/usb/dev-hub.c
361
@@ -XXX,XX +XXX,XX @@ static void usb_hub_unrealize(USBDevice *dev)
362
&s->ports[i].port);
363
}
364
365
- timer_del(s->port_timer);
366
timer_free(s->port_timer);
367
}
368
369
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
370
index XXXXXXX..XXXXXXX 100644
371
--- a/hw/usb/hcd-ehci.c
372
+++ b/hw/usb/hcd-ehci.c
373
@@ -XXX,XX +XXX,XX @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *dev)
374
trace_usb_ehci_unrealize();
375
376
if (s->frame_timer) {
377
- timer_del(s->frame_timer);
378
timer_free(s->frame_timer);
379
s->frame_timer = NULL;
380
}
381
diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c
382
index XXXXXXX..XXXXXXX 100644
383
--- a/hw/usb/hcd-ohci-pci.c
384
+++ b/hw/usb/hcd-ohci-pci.c
385
@@ -XXX,XX +XXX,XX @@ static void usb_ohci_exit(PCIDevice *dev)
386
usb_bus_release(&s->bus);
387
}
388
389
- timer_del(s->eof_timer);
390
timer_free(s->eof_timer);
391
}
392
393
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
394
index XXXXXXX..XXXXXXX 100644
395
--- a/hw/usb/hcd-uhci.c
396
+++ b/hw/usb/hcd-uhci.c
397
@@ -XXX,XX +XXX,XX @@ static void usb_uhci_exit(PCIDevice *dev)
398
trace_usb_uhci_exit();
399
400
if (s->frame_timer) {
401
- timer_del(s->frame_timer);
402
timer_free(s->frame_timer);
403
s->frame_timer = NULL;
404
}
405
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
406
index XXXXXXX..XXXXXXX 100644
407
--- a/hw/usb/hcd-xhci.c
408
+++ b/hw/usb/hcd-xhci.c
409
@@ -XXX,XX +XXX,XX @@ static void usb_xhci_unrealize(DeviceState *dev)
410
}
411
412
if (xhci->mfwrap_timer) {
413
- timer_del(xhci->mfwrap_timer);
414
timer_free(xhci->mfwrap_timer);
415
xhci->mfwrap_timer = NULL;
416
}
417
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
418
index XXXXXXX..XXXXXXX 100644
419
--- a/hw/usb/redirect.c
420
+++ b/hw/usb/redirect.c
421
@@ -XXX,XX +XXX,XX @@ static void usbredir_unrealize(USBDevice *udev)
422
qemu_bh_delete(dev->chardev_close_bh);
423
qemu_bh_delete(dev->device_reject_bh);
424
425
- timer_del(dev->attach_timer);
426
timer_free(dev->attach_timer);
427
428
usbredir_cleanup_device_queues(dev);
429
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
430
index XXXXXXX..XXXXXXX 100644
431
--- a/hw/vfio/display.c
432
+++ b/hw/vfio/display.c
433
@@ -XXX,XX +XXX,XX @@ static void vfio_display_edid_exit(VFIODisplay *dpy)
434
435
g_free(dpy->edid_regs);
436
g_free(dpy->edid_blob);
437
- timer_del(dpy->edid_link_timer);
438
timer_free(dpy->edid_link_timer);
439
}
440
441
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
442
index XXXXXXX..XXXXXXX 100644
443
--- a/hw/virtio/vhost-vsock-common.c
444
+++ b/hw/virtio/vhost-vsock-common.c
445
@@ -XXX,XX +XXX,XX @@ static void vhost_vsock_common_post_load_timer_cleanup(VHostVSockCommon *vvc)
446
return;
447
}
448
449
- timer_del(vvc->post_load_timer);
450
timer_free(vvc->post_load_timer);
451
vvc->post_load_timer = NULL;
452
}
453
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
454
index XXXXXXX..XXXXXXX 100644
455
--- a/hw/virtio/virtio-balloon.c
456
+++ b/hw/virtio/virtio-balloon.c
457
@@ -XXX,XX +XXX,XX @@ static bool balloon_stats_enabled(const VirtIOBalloon *s)
458
static void balloon_stats_destroy_timer(VirtIOBalloon *s)
459
{
460
if (balloon_stats_enabled(s)) {
461
- timer_del(s->stats_timer);
462
timer_free(s->stats_timer);
463
s->stats_timer = NULL;
464
s->stats_poll_interval = 0;
465
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
466
index XXXXXXX..XXXXXXX 100644
467
--- a/hw/virtio/virtio-rng.c
468
+++ b/hw/virtio/virtio-rng.c
469
@@ -XXX,XX +XXX,XX @@ static void virtio_rng_device_unrealize(DeviceState *dev)
470
VirtIORNG *vrng = VIRTIO_RNG(dev);
471
472
qemu_del_vm_change_state_handler(vrng->vmstate);
473
- timer_del(vrng->rate_limit_timer);
474
timer_free(vrng->rate_limit_timer);
475
virtio_del_queue(vdev, 0);
476
virtio_cleanup(vdev);
477
diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c
478
index XXXXXXX..XXXXXXX 100644
479
--- a/hw/watchdog/wdt_diag288.c
480
+++ b/hw/watchdog/wdt_diag288.c
481
@@ -XXX,XX +XXX,XX @@ static void wdt_diag288_unrealize(DeviceState *dev)
482
{
483
DIAG288State *diag288 = DIAG288(dev);
484
485
- timer_del(diag288->timer);
486
timer_free(diag288->timer);
487
}
488
489
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
490
index XXXXXXX..XXXXXXX 100644
491
--- a/hw/watchdog/wdt_i6300esb.c
492
+++ b/hw/watchdog/wdt_i6300esb.c
493
@@ -XXX,XX +XXX,XX @@ static void i6300esb_exit(PCIDevice *dev)
494
{
495
I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
496
497
- timer_del(d->timer);
498
timer_free(d->timer);
499
}
500
501
diff --git a/migration/colo.c b/migration/colo.c
502
index XXXXXXX..XXXXXXX 100644
503
--- a/migration/colo.c
504
+++ b/migration/colo.c
505
@@ -XXX,XX +XXX,XX @@ out:
506
* error.
507
*/
508
colo_compare_unregister_notifier(&packets_compare_notifier);
509
- timer_del(s->colo_delay_timer);
510
timer_free(s->colo_delay_timer);
511
qemu_event_destroy(&s->colo_checkpoint_event);
512
513
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
514
index XXXXXXX..XXXXXXX 100644
515
--- a/monitor/hmp-cmds.c
516
+++ b/monitor/hmp-cmds.c
517
@@ -XXX,XX +XXX,XX @@ static void hmp_migrate_status_cb(void *opaque)
518
error_report("%s", info->error_desc);
519
}
520
monitor_resume(status->mon);
521
- timer_del(status->timer);
522
timer_free(status->timer);
523
g_free(status);
524
}
525
diff --git a/net/announce.c b/net/announce.c
526
index XXXXXXX..XXXXXXX 100644
527
--- a/net/announce.c
528
+++ b/net/announce.c
529
@@ -XXX,XX +XXX,XX @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named)
530
{
531
bool free_timer = false;
532
if (timer->tm) {
533
- timer_del(timer->tm);
534
timer_free(timer->tm);
535
timer->tm = NULL;
536
}
537
diff --git a/net/colo-compare.c b/net/colo-compare.c
538
index XXXXXXX..XXXXXXX 100644
539
--- a/net/colo-compare.c
540
+++ b/net/colo-compare.c
541
@@ -XXX,XX +XXX,XX @@ static void colo_compare_timer_init(CompareState *s)
542
static void colo_compare_timer_del(CompareState *s)
543
{
544
if (s->packet_check_timer) {
545
- timer_del(s->packet_check_timer);
546
timer_free(s->packet_check_timer);
547
s->packet_check_timer = NULL;
548
}
549
diff --git a/net/slirp.c b/net/slirp.c
550
index XXXXXXX..XXXXXXX 100644
551
--- a/net/slirp.c
552
+++ b/net/slirp.c
553
@@ -XXX,XX +XXX,XX @@ static void *net_slirp_timer_new(SlirpTimerCb cb,
554
555
static void net_slirp_timer_free(void *timer, void *opaque)
556
{
557
- timer_del(timer);
558
timer_free(timer);
559
}
560
561
diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c
562
index XXXXXXX..XXXXXXX 100644
563
--- a/replay/replay-debugging.c
564
+++ b/replay/replay-debugging.c
565
@@ -XXX,XX +XXX,XX @@ static void replay_delete_break(void)
566
assert(replay_mutex_locked());
567
568
if (replay_break_timer) {
569
- timer_del(replay_break_timer);
570
timer_free(replay_break_timer);
571
replay_break_timer = NULL;
572
}
573
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
574
index XXXXXXX..XXXXXXX 100644
575
--- a/target/s390x/cpu.c
576
+++ b/target/s390x/cpu.c
577
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_finalize(Object *obj)
578
#if !defined(CONFIG_USER_ONLY)
579
S390CPU *cpu = S390_CPU(obj);
580
581
- timer_del(cpu->env.tod_timer);
582
timer_free(cpu->env.tod_timer);
583
- timer_del(cpu->env.cpu_timer);
584
timer_free(cpu->env.cpu_timer);
585
586
qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu);
587
diff --git a/ui/console.c b/ui/console.c
588
index XXXXXXX..XXXXXXX 100644
589
--- a/ui/console.c
590
+++ b/ui/console.c
591
@@ -XXX,XX +XXX,XX @@ static void gui_setup_refresh(DisplayState *ds)
592
timer_mod(ds->gui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
593
}
594
if (!need_timer && ds->gui_timer != NULL) {
595
- timer_del(ds->gui_timer);
596
timer_free(ds->gui_timer);
597
ds->gui_timer = NULL;
598
}
599
diff --git a/ui/spice-core.c b/ui/spice-core.c
600
index XXXXXXX..XXXXXXX 100644
601
--- a/ui/spice-core.c
602
+++ b/ui/spice-core.c
603
@@ -XXX,XX +XXX,XX @@ static void timer_cancel(SpiceTimer *timer)
604
605
static void timer_remove(SpiceTimer *timer)
606
{
607
- timer_del(timer->timer);
608
timer_free(timer->timer);
609
g_free(timer);
610
}
611
diff --git a/util/throttle.c b/util/throttle.c
612
index XXXXXXX..XXXXXXX 100644
613
--- a/util/throttle.c
614
+++ b/util/throttle.c
615
@@ -XXX,XX +XXX,XX @@ static void throttle_timer_destroy(QEMUTimer **timer)
616
{
617
assert(*timer != NULL);
618
619
- timer_del(*timer);
620
timer_free(*timer);
621
*timer = NULL;
622
}
623
--
235
--
624
2.20.1
236
2.20.1
625
237
626
238
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Guenter Roeck <linux@roeck-us.net>
2
2
3
U-Boot expects PMU_MISC0 register bit 7 is set (see init_bandgap()
3
Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
4
in arch/arm/mach-imx/mx6/soc.c) during boot. This bit indicates the
4
property value to 23") configured the PHY address for xilinx-zynq-a9
5
bandgap has stabilized.
5
to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
6
zynq-zc706.dtb, this results in the following error message when
7
trying to use the Ethernet interface.
6
8
7
With this change, the latest upstream U-Boot (v2021.01-rc3) for imx6
9
macb e000b000.ethernet eth0: Could not attach PHY (-19)
8
sabrelite board (mx6qsabrelite_defconfig), with a slight change made
9
by switching CONFIG_OF_SEPARATE to CONFIG_OF_EMBED, boots to U-Boot
10
shell on QEMU with the following command:
11
10
12
$ qemu-system-arm -M sabrelite -smp 4 -m 1G -kernel u-boot \
11
The devicetree files for ZC702 and ZC706 configure PHY address 7. The
13
-display none -serial null -serial stdio
12
documentation for the ZC702 and ZC706 evaluation boards suggest that the
13
PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
14
I was unable to find a documentation or a devicetree file suggesting
15
or using PHY address 23. The Ethernet interface starts working with
16
zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
17
so let's use it.
14
18
15
Boot log below:
19
Cc: Bin Meng <bin.meng@windriver.com>
16
20
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
17
U-Boot 2021.01-rc3 (Dec 12 2020 - 17:40:02 +0800)
21
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
18
22
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
19
CPU: Freescale i.MX?? rev1.0 at 792 MHz
23
Message-id: 20210504124140.1100346-1-linux@roeck-us.net
20
Reset cause: POR
21
Model: Freescale i.MX6 Quad SABRE Lite Board
22
Board: SABRE Lite
23
I2C: ready
24
DRAM: 1 GiB
25
force_idle_bus: sda=0 scl=0 sda.gp=0x5c scl.gp=0x55
26
force_idle_bus: failed to clear bus, sda=0 scl=0
27
force_idle_bus: sda=0 scl=0 sda.gp=0x6d scl.gp=0x6c
28
force_idle_bus: failed to clear bus, sda=0 scl=0
29
force_idle_bus: sda=0 scl=0 sda.gp=0xcb scl.gp=0x5
30
force_idle_bus: failed to clear bus, sda=0 scl=0
31
MMC: FSL_SDHC: 0, FSL_SDHC: 1
32
Loading Environment from MMC... *** Warning - No block device, using default environment
33
34
In: serial
35
Out: serial
36
Err: serial
37
Net: Board Net Initialization Failed
38
No ethernet found.
39
starting USB...
40
Bus usb@2184000: usb dr_mode not found
41
USB EHCI 1.00
42
Bus usb@2184200: USB EHCI 1.00
43
scanning bus usb@2184000 for devices... 1 USB Device(s) found
44
scanning bus usb@2184200 for devices... 1 USB Device(s) found
45
scanning usb for storage devices... 0 Storage Device(s) found
46
scanning usb for ethernet devices... 0 Ethernet Device(s) found
47
Hit any key to stop autoboot: 0
48
=>
49
50
Signed-off-by: Bin Meng <bin.meng@windriver.com>
51
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
52
Message-id: 20210106063504.10841-2-bmeng.cn@gmail.com
53
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
54
---
25
---
55
hw/misc/imx6_ccm.c | 2 +-
26
hw/arm/xilinx_zynq.c | 2 +-
56
1 file changed, 1 insertion(+), 1 deletion(-)
27
1 file changed, 1 insertion(+), 1 deletion(-)
57
28
58
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
29
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
59
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
60
--- a/hw/misc/imx6_ccm.c
31
--- a/hw/arm/xilinx_zynq.c
61
+++ b/hw/misc/imx6_ccm.c
32
+++ b/hw/arm/xilinx_zynq.c
62
@@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev)
33
@@ -XXX,XX +XXX,XX @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
63
s->analog[PMU_REG_3P0] = 0x00000F74;
34
qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
64
s->analog[PMU_REG_2P5] = 0x00005071;
35
qdev_set_nic_properties(dev, nd);
65
s->analog[PMU_REG_CORE] = 0x00402010;
36
}
66
- s->analog[PMU_MISC0] = 0x04000000;
37
- object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
67
+ s->analog[PMU_MISC0] = 0x04000080;
38
+ object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
68
s->analog[PMU_MISC1] = 0x00000000;
39
s = SYS_BUS_DEVICE(dev);
69
s->analog[PMU_MISC2] = 0x00272727;
40
sysbus_realize_and_unref(s, &error_fatal);
70
41
sysbus_mmio_map(s, 0, base);
71
--
42
--
72
2.20.1
43
2.20.1
73
44
74
45
diff view generated by jsdifflib