1
The big thing in here is RTH's caching-of-tb-flags patchset
1
The following changes since commit e670f6d825d4dee248b311197fd4048469d6772b:
2
which should improve TCG performance.
3
2
4
thanks
3
Merge remote-tracking branch 'remotes/legoater/tags/pull-ppc-20220218' into staging (2022-02-20 15:05:41 +0000)
5
-- PMM
6
7
The following changes since commit 2152e740a8938b3bad73bfe1a01f8b94dab02d41:
8
9
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-10-22 12:03:03 +0100)
10
4
11
are available in the Git repository at:
5
are available in the Git repository at:
12
6
13
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191022
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220221
14
8
15
for you to fetch changes up to 833043a060f7d0e95ded88e61e992466305c0345:
9
for you to fetch changes up to d6333e2543fa41aed4d33f77c808168373e39bff:
16
10
17
hw/arm/digic4: Inline digic4_board_setup_ram() function (2019-10-22 14:21:57 +0100)
11
ui/cocoa: Fix the leak of qemu_console_get_label (2022-02-21 09:12:18 +0000)
18
12
19
----------------------------------------------------------------
13
----------------------------------------------------------------
20
target-arm queue:
14
arm, cocoa and misc:
21
* Fix sign-extension for SMLAL* instructions
15
* MAINTAINERS file updates
22
* aspeed: Add an AST2600 eval board
16
* Mark remaining global TypeInfo instances as const
23
* Various ptimer device conversions to new transaction API
17
* checkpatch: Ensure that TypeInfos are const
24
* Cache TB flags to avoid expensively recomputing them every time
18
* tests/qtest: add qtests for npcm7xx sdhci
25
* Add a dummy Samsung SDHCI controller model to exynos4 boards
19
* arm hvf: Handle unknown ID registers as RES0
26
* Minor refactorings of RAM creation for some arm boards
20
* Make KVM -cpu max exactly like -cpu host
21
* Fix '-cpu max' for HVF
22
* Support PAuth extension for hvf
23
* Kconfig: Add I2C_DEVICES device group
24
* Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus
25
* hw/arm/armv7m: Handle disconnected clock inputs
26
* osdep.h: pull out various things into new header files
27
* hw/timer: fix a9gtimer vmstate
28
* hw/arm: add initial mori-bmc board
29
* ui/cocoa: Remove allowedFileTypes restriction in SavePanel
30
* ui/cocoa: Do not alert even without block devices
31
* ui/cocoa: Fix the leak of qemu_console_get_label
27
32
28
----------------------------------------------------------------
33
----------------------------------------------------------------
29
Cédric Le Goater (1):
34
Akihiko Odaki (3):
30
aspeed: Add an AST2600 eval board
35
MAINTAINERS: Add Akihiko Odaki to macOS-relateds
36
ui/cocoa: Do not alert even without block devices
37
ui/cocoa: Fix the leak of qemu_console_get_label
31
38
32
Guenter Roeck (1):
39
Alexander Graf (2):
33
hw/timer/exynos4210_mct: Initialize ptimer before starting it
40
hvf: arm: Use macros for sysreg shift/masking
41
hvf: arm: Handle unknown ID registers as RES0
34
42
35
Peter Maydell (7):
43
Ani Sinha (1):
36
hw/timer/arm_mptimer.c: Undo accidental rename of arm_mptimer_init()
44
MAINTAINERS: Adding myself as a reviewer of some components
37
hw/timer/puv3_ost.c: Switch to transaction-based ptimer API
38
hw/timer/sh_timer: Switch to transaction-based ptimer API
39
hw/timer/lm32_timer: Switch to transaction-based ptimer API
40
hw/timer/altera_timer.c: Switch to transaction-based ptimer API
41
hw/watchdog/etraxfs_timer.c: Switch to transaction-based ptimer API
42
hw/m68k/mcf5208.c: Switch to transaction-based ptimer API
43
45
44
Philippe Mathieu-Daudé (9):
46
Bernhard Beschow (2):
45
hw/sd/sdhci: Add a comment to distinct the i.MX eSDHC functions
47
Mark remaining global TypeInfo instances as const
46
hw/sd/sdhci: Add dummy Samsung SDHCI controller
48
checkpatch: Ensure that TypeInfos are const
47
hw/arm/exynos4210: Use the Samsung s3c SDHCI controller
48
hw/arm/xilinx_zynq: Use the IEC binary prefix definitions
49
hw/arm/mps2: Use the IEC binary prefix definitions
50
hw/arm/collie: Create the RAM in the board
51
hw/arm/omap2: Create the RAM in the board
52
hw/arm/omap1: Create the RAM in the board
53
hw/arm/digic4: Inline digic4_board_setup_ram() function
54
49
55
Richard Henderson (23):
50
Patrick Venture (1):
56
target/arm: Fix sign-extension for SMLAL*
51
hw/arm: add initial mori-bmc board
57
target/arm: Split out rebuild_hflags_common
58
target/arm: Split out rebuild_hflags_a64
59
target/arm: Split out rebuild_hflags_common_32
60
target/arm: Split arm_cpu_data_is_big_endian
61
target/arm: Split out rebuild_hflags_m32
62
target/arm: Reduce tests vs M-profile in cpu_get_tb_cpu_state
63
target/arm: Split out rebuild_hflags_a32
64
target/arm: Split out rebuild_hflags_aprofile
65
target/arm: Hoist XSCALE_CPAR, VECLEN, VECSTRIDE in cpu_get_tb_cpu_state
66
target/arm: Simplify set of PSTATE_SS in cpu_get_tb_cpu_state
67
target/arm: Hoist computation of TBFLAG_A32.VFPEN
68
target/arm: Add arm_rebuild_hflags
69
target/arm: Split out arm_mmu_idx_el
70
target/arm: Hoist store to cs_base in cpu_get_tb_cpu_state
71
target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32})
72
target/arm: Rebuild hflags at EL changes
73
target/arm: Rebuild hflags at MSR writes
74
target/arm: Rebuild hflags at CPSR writes
75
target/arm: Rebuild hflags at Xscale SCTLR writes
76
target/arm: Rebuild hflags for M-profile
77
target/arm: Rebuild hflags for M-profile NVIC
78
target/arm: Rely on hflags correct in cpu_get_tb_cpu_state
79
52
80
hw/arm/strongarm.h | 4 +-
53
Pavel Dovgalyuk (1):
81
include/hw/arm/aspeed.h | 1 +
54
hw/timer: fix a9gtimer vmstate
82
include/hw/arm/omap.h | 10 +-
83
include/hw/sd/sdhci.h | 2 +
84
target/arm/cpu.h | 84 ++++++----
85
target/arm/helper.h | 4 +
86
target/arm/internals.h | 9 ++
87
hw/arm/aspeed.c | 23 +++
88
hw/arm/collie.c | 8 +-
89
hw/arm/digic_boards.c | 9 +-
90
hw/arm/exynos4210.c | 2 +-
91
hw/arm/mps2-tz.c | 3 +-
92
hw/arm/mps2.c | 3 +-
93
hw/arm/nseries.c | 10 +-
94
hw/arm/omap1.c | 12 +-
95
hw/arm/omap2.c | 13 +-
96
hw/arm/omap_sx1.c | 8 +-
97
hw/arm/palm.c | 8 +-
98
hw/arm/strongarm.c | 7 +-
99
hw/arm/xilinx_zynq.c | 3 +-
100
hw/intc/armv7m_nvic.c | 22 +--
101
hw/m68k/mcf5208.c | 9 +-
102
hw/sd/sdhci.c | 68 +++++++-
103
hw/timer/altera_timer.c | 13 +-
104
hw/timer/arm_mptimer.c | 4 +-
105
hw/timer/etraxfs_timer.c | 23 +--
106
hw/timer/exynos4210_mct.c | 2 +-
107
hw/timer/lm32_timer.c | 13 +-
108
hw/timer/puv3_ost.c | 9 +-
109
hw/timer/sh_timer.c | 13 +-
110
linux-user/syscall.c | 1 +
111
target/arm/cpu.c | 1 +
112
target/arm/helper-a64.c | 3 +
113
target/arm/helper.c | 393 +++++++++++++++++++++++++++++----------------
114
target/arm/m_helper.c | 6 +
115
target/arm/machine.c | 1 +
116
target/arm/op_helper.c | 4 +
117
target/arm/translate-a64.c | 13 +-
118
target/arm/translate.c | 37 ++++-
119
39 files changed, 588 insertions(+), 270 deletions(-)
120
55
56
Peter Maydell (14):
57
target/arm: Move '-cpu host' code to cpu64.c
58
target/arm: Use aarch64_cpu_register() for 'host' CPU type
59
target/arm: Make KVM -cpu max exactly like -cpu host
60
target/arm: Unindent unnecessary else-clause
61
target/arm: Fix '-cpu max' for HVF
62
target/arm: Support PAuth extension for hvf
63
Kconfig: Add I2C_DEVICES device group
64
Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus
65
hw/arm/armv7m: Handle disconnected clock inputs
66
include: Move qemu_madvise() and related #defines to new qemu/madvise.h
67
include: Move qemu_mprotect_*() to new qemu/mprotect.h
68
include: Move QEMU_MAP_* constants to mmap-alloc.h
69
include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h
70
include: Move hardware version declarations to new qemu/hw-version.h
71
72
Philippe Mathieu-Daudé (1):
73
ui/cocoa: Remove allowedFileTypes restriction in SavePanel
74
75
Shengtan Mao (1):
76
tests/qtest: add qtests for npcm7xx sdhci
77
78
docs/devel/kconfig.rst | 8 +-
79
docs/system/arm/nuvoton.rst | 1 +
80
include/qemu/cacheinfo.h | 21 +++
81
include/qemu/hw-version.h | 27 ++++
82
include/qemu/madvise.h | 95 +++++++++++
83
include/qemu/mmap-alloc.h | 23 +++
84
include/qemu/mprotect.h | 14 ++
85
include/qemu/osdep.h | 132 ----------------
86
accel/tcg/translate-all.c | 1 +
87
backends/hostmem-file.c | 1 +
88
backends/hostmem.c | 1 +
89
hw/arm/armv7m.c | 26 ++-
90
hw/arm/npcm7xx_boards.c | 32 ++++
91
hw/arm/nseries.c | 1 +
92
hw/core/generic-loader.c | 2 +-
93
hw/core/guest-loader.c | 2 +-
94
hw/display/bcm2835_fb.c | 2 +-
95
hw/display/i2c-ddc.c | 2 +-
96
hw/display/macfb.c | 4 +-
97
hw/display/virtio-vga.c | 2 +-
98
hw/dma/bcm2835_dma.c | 2 +-
99
hw/i386/pc_piix.c | 2 +-
100
hw/i386/sgx-epc.c | 2 +-
101
hw/ide/core.c | 1 +
102
hw/intc/bcm2835_ic.c | 2 +-
103
hw/intc/bcm2836_control.c | 2 +-
104
hw/ipmi/ipmi.c | 4 +-
105
hw/mem/nvdimm.c | 2 +-
106
hw/mem/pc-dimm.c | 2 +-
107
hw/misc/bcm2835_mbox.c | 2 +-
108
hw/misc/bcm2835_powermgt.c | 2 +-
109
hw/misc/bcm2835_property.c | 2 +-
110
hw/misc/bcm2835_rng.c | 2 +-
111
hw/misc/pvpanic-isa.c | 2 +-
112
hw/misc/pvpanic-pci.c | 2 +-
113
hw/net/fsl_etsec/etsec.c | 2 +-
114
hw/ppc/prep_systemio.c | 2 +-
115
hw/ppc/spapr_iommu.c | 2 +-
116
hw/s390x/s390-pci-bus.c | 2 +-
117
hw/s390x/sclp.c | 2 +-
118
hw/s390x/tod-kvm.c | 2 +-
119
hw/s390x/tod-tcg.c | 2 +-
120
hw/s390x/tod.c | 2 +-
121
hw/scsi/lsi53c895a.c | 2 +-
122
hw/scsi/megasas.c | 1 +
123
hw/scsi/scsi-bus.c | 1 +
124
hw/scsi/scsi-disk.c | 1 +
125
hw/sd/allwinner-sdhost.c | 2 +-
126
hw/sd/aspeed_sdhci.c | 2 +-
127
hw/sd/bcm2835_sdhost.c | 2 +-
128
hw/sd/cadence_sdhci.c | 2 +-
129
hw/sd/npcm7xx_sdhci.c | 2 +-
130
hw/timer/a9gtimer.c | 21 +++
131
hw/usb/dev-mtp.c | 2 +-
132
hw/usb/host-libusb.c | 2 +-
133
hw/vfio/igd.c | 2 +-
134
hw/virtio/virtio-balloon.c | 1 +
135
hw/virtio/virtio-pmem.c | 2 +-
136
migration/postcopy-ram.c | 1 +
137
migration/qemu-file.c | 1 +
138
migration/ram.c | 1 +
139
plugins/loader.c | 1 +
140
qom/object.c | 4 +-
141
softmmu/physmem.c | 1 +
142
softmmu/vl.c | 1 +
143
target/arm/cpu.c | 30 ----
144
target/arm/cpu64.c | 331 +++++++++++++++++++++------------------
145
target/arm/hvf/hvf.c | 83 +++++++---
146
target/i386/cpu.c | 1 +
147
target/s390x/cpu_models.c | 1 +
148
tcg/region.c | 3 +
149
tcg/tcg.c | 1 +
150
tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++
151
util/atomic64.c | 1 +
152
util/cacheflush.c | 1 +
153
util/cacheinfo.c | 1 +
154
util/osdep.c | 3 +
155
util/oslib-posix.c | 1 +
156
MAINTAINERS | 5 +
157
hw/arm/Kconfig | 10 ++
158
hw/i2c/Kconfig | 5 +
159
hw/rtc/Kconfig | 2 +
160
hw/sensor/Kconfig | 5 +
161
scripts/checkpatch.pl | 1 +
162
tests/qtest/meson.build | 1 +
163
ui/cocoa.m | 15 +-
164
86 files changed, 822 insertions(+), 393 deletions(-)
165
create mode 100644 include/qemu/cacheinfo.h
166
create mode 100644 include/qemu/hw-version.h
167
create mode 100644 include/qemu/madvise.h
168
create mode 100644 include/qemu/mprotect.h
169
create mode 100644 tests/qtest/npcm7xx_sdhci-test.c
170
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
The 32-bit product should be sign-extended, not zero-extended.
4
5
Fixes: ea96b374641b
6
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
10
Message-id: 20190912183058.17947-1-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/translate.c | 4 +++-
14
1 file changed, 3 insertions(+), 1 deletion(-)
15
16
diff --git a/target/arm/translate.c b/target/arm/translate.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate.c
19
+++ b/target/arm/translate.c
20
@@ -XXX,XX +XXX,XX @@ static bool op_smlaxxx(DisasContext *s, arg_rrrr *a,
21
case 2:
22
tl = load_reg(s, a->ra);
23
th = load_reg(s, a->rd);
24
- t1 = tcg_const_i32(0);
25
+ /* Sign-extend the 32-bit product to 64 bits. */
26
+ t1 = tcg_temp_new_i32();
27
+ tcg_gen_sari_i32(t1, t0, 31);
28
tcg_gen_add2_i32(tl, th, tl, th, t0, t1);
29
tcg_temp_free_i32(t0);
30
tcg_temp_free_i32(t1);
31
--
32
2.20.1
33
34
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Ani Sinha <ani@anisinha.ca>
2
2
3
Continue setting, but not relying upon, env->hflags.
3
Added myself as a reviewer of vmgenid, unimplemented device and empty slot.
4
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Ani Sinha <ani@anisinha.ca>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20191018174431.1784-19-richard.henderson@linaro.org
7
Message-id: 20220131122001.1476101-1-ani@anisinha.ca
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
9
---
10
target/arm/op_helper.c | 3 +++
10
MAINTAINERS | 3 +++
11
1 file changed, 3 insertions(+)
11
1 file changed, 3 insertions(+)
12
12
13
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
13
diff --git a/MAINTAINERS b/MAINTAINERS
14
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/op_helper.c
15
--- a/MAINTAINERS
16
+++ b/target/arm/op_helper.c
16
+++ b/MAINTAINERS
17
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(usat16)(CPUARMState *env, uint32_t x, uint32_t shift)
17
@@ -XXX,XX +XXX,XX @@ F: tests/qtest/prom-env-test.c
18
void HELPER(setend)(CPUARMState *env)
18
19
{
19
VM Generation ID
20
env->uncached_cpsr ^= CPSR_E;
20
S: Orphan
21
+ arm_rebuild_hflags(env);
21
+R: Ani Sinha <ani@anisinha.ca>
22
}
22
F: hw/acpi/vmgenid.c
23
23
F: include/hw/acpi/vmgenid.h
24
/* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped.
24
F: docs/specs/vmgenid.txt
25
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(cpsr_read)(CPUARMState *env)
25
@@ -XXX,XX +XXX,XX @@ F: hw/misc/led.c
26
void HELPER(cpsr_write)(CPUARMState *env, uint32_t val, uint32_t mask)
26
Unimplemented device
27
{
27
M: Peter Maydell <peter.maydell@linaro.org>
28
cpsr_write(env, val, mask, CPSRWriteByInstr);
28
R: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
+ /* TODO: Not all cpsr bits are relevant to hflags. */
29
+R: Ani Sinha <ani@anisinha.ca>
30
+ arm_rebuild_hflags(env);
30
S: Maintained
31
}
31
F: include/hw/misc/unimp.h
32
32
F: hw/misc/unimp.c
33
/* Write the CPSR for a 32-bit exception return */
33
@@ -XXX,XX +XXX,XX @@ F: hw/misc/unimp.c
34
Empty slot
35
M: Artyom Tarasenko <atar4qemu@gmail.com>
36
R: Philippe Mathieu-Daudé <f4bug@amsat.org>
37
+R: Ani Sinha <ani@anisinha.ca>
38
S: Maintained
39
F: include/hw/misc/empty_slot.h
40
F: hw/misc/empty_slot.c
34
--
41
--
35
2.20.1
42
2.25.1
36
43
37
44
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Shengtan Mao <stmao@google.com>
2
2
3
Create a function to compute the values of the TBFLAG_A64 bits
3
Reviewed-by: Hao Wu <wuhaotsh@google.com>
4
that will be cached. For now, the env->hflags variable is not
4
Reviewed-by: Chris Rauer <crauer@google.com>
5
used, and the results are fed back to cpu_get_tb_cpu_state.
5
Signed-off-by: Shengtan Mao <stmao@google.com>
6
6
Signed-off-by: Patrick Venture <venture@google.com>
7
Note that not all BTI related flags are cached, so we have to
7
Message-id: 20220208181843.4003568-1-venture@google.com
8
test the BTI feature twice -- once for those bits moved out to
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
rebuild_hflags_a64 and once for those bits that remain in
10
cpu_get_tb_cpu_state.
11
12
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20191018174431.1784-3-richard.henderson@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
target/arm/helper.c | 131 +++++++++++++++++++++++---------------------
11
tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++++++++
18
1 file changed, 69 insertions(+), 62 deletions(-)
12
tests/qtest/meson.build | 1 +
19
13
2 files changed, 216 insertions(+)
20
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
create mode 100644 tests/qtest/npcm7xx_sdhci-test.c
21
index XXXXXXX..XXXXXXX 100644
15
22
--- a/target/arm/helper.c
16
diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c
23
+++ b/target/arm/helper.c
17
new file mode 100644
24
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,
18
index XXXXXXX..XXXXXXX
25
return flags;
19
--- /dev/null
26
}
20
+++ b/tests/qtest/npcm7xx_sdhci-test.c
27
21
@@ -XXX,XX +XXX,XX @@
28
+static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
22
+/*
29
+ ARMMMUIdx mmu_idx)
23
+ * QTests for NPCM7xx SD-3.0 / MMC-4.51 Host Controller
30
+{
24
+ *
31
+ ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx);
25
+ * Copyright (c) 2022 Google LLC
32
+ ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1);
26
+ *
33
+ uint32_t flags = 0;
27
+ * This program is free software; you can redistribute it and/or modify it
34
+ uint64_t sctlr;
28
+ * under the terms of the GNU General Public License as published by the
35
+ int tbii, tbid;
29
+ * Free Software Foundation; either version 2 of the License, or
36
+
30
+ * (at your option) any later version.
37
+ flags = FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1);
31
+ *
38
+
32
+ * This program is distributed in the hope that it will be useful, but WITHOUT
39
+ /* FIXME: ARMv8.1-VHE S2 translation regime. */
33
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
40
+ if (regime_el(env, stage1) < 2) {
34
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
41
+ ARMVAParameters p1 = aa64_va_parameters_both(env, -1, stage1);
35
+ * for more details.
42
+ tbid = (p1.tbi << 1) | p0.tbi;
36
+ */
43
+ tbii = tbid & ~((p1.tbid << 1) | p0.tbid);
37
+
44
+ } else {
38
+#include "qemu/osdep.h"
45
+ tbid = p0.tbi;
39
+#include "hw/sd/npcm7xx_sdhci.h"
46
+ tbii = tbid & !p0.tbid;
40
+
47
+ }
41
+#include "libqos/libqtest.h"
48
+
42
+#include "libqtest-single.h"
49
+ flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii);
43
+#include "libqos/sdhci-cmd.h"
50
+ flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid);
44
+
51
+
45
+#define NPCM7XX_REG_SIZE 0x100
52
+ if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
46
+#define NPCM7XX_MMC_BA 0xF0842000
53
+ int sve_el = sve_exception_el(env, el);
47
+#define NPCM7XX_BLK_SIZE 512
54
+ uint32_t zcr_len;
48
+#define NPCM7XX_TEST_IMAGE_SIZE (1 << 30)
55
+
49
+
56
+ /*
50
+char *sd_path;
57
+ * If SVE is disabled, but FP is enabled,
51
+
58
+ * then the effective len is 0.
52
+static QTestState *setup_sd_card(void)
59
+ */
53
+{
60
+ if (sve_el != 0 && fp_el == 0) {
54
+ QTestState *qts = qtest_initf(
61
+ zcr_len = 0;
55
+ "-machine kudo-bmc "
62
+ } else {
56
+ "-device sd-card,drive=drive0 "
63
+ zcr_len = sve_zcr_len_for_el(env, el);
57
+ "-drive id=drive0,if=none,file=%s,format=raw,auto-read-only=off",
64
+ }
58
+ sd_path);
65
+ flags = FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el);
59
+
66
+ flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len);
60
+ qtest_writew(qts, NPCM7XX_MMC_BA + SDHC_SWRST, SDHC_RESET_ALL);
67
+ }
61
+ qtest_writew(qts, NPCM7XX_MMC_BA + SDHC_CLKCON,
68
+
62
+ SDHC_CLOCK_SDCLK_EN | SDHC_CLOCK_INT_STABLE |
69
+ sctlr = arm_sctlr(env, el);
63
+ SDHC_CLOCK_INT_EN);
70
+
64
+ sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_APP_CMD);
71
+ if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) {
65
+ sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x41200000, 0, (41 << 8));
72
+ /*
66
+ sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_ALL_SEND_CID);
73
+ * In order to save space in flags, we record only whether
67
+ sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR);
74
+ * pauth is "inactive", meaning all insns are implemented as
68
+ sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0,
75
+ * a nop, or "active" when some action must be performed.
69
+ SDHC_SELECT_DESELECT_CARD);
76
+ * The decision of which action to take is left to a helper.
70
+
77
+ */
71
+ return qts;
78
+ if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) {
72
+}
79
+ flags = FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1);
73
+
74
+static void write_sdread(QTestState *qts, const char *msg)
75
+{
76
+ int fd, ret;
77
+ size_t len = strlen(msg);
78
+ char *rmsg = g_malloc(len);
79
+
80
+ /* write message to sd */
81
+ fd = open(sd_path, O_WRONLY);
82
+ g_assert(fd >= 0);
83
+ ret = write(fd, msg, len);
84
+ close(fd);
85
+ g_assert(ret == len);
86
+
87
+ /* read message using sdhci */
88
+ ret = sdhci_read_cmd(qts, NPCM7XX_MMC_BA, rmsg, len);
89
+ g_assert(ret == len);
90
+ g_assert(!strcmp(rmsg, msg));
91
+
92
+ g_free(rmsg);
93
+}
94
+
95
+/* Check MMC can read values from sd */
96
+static void test_read_sd(void)
97
+{
98
+ QTestState *qts = setup_sd_card();
99
+
100
+ write_sdread(qts, "hello world");
101
+ write_sdread(qts, "goodbye");
102
+
103
+ qtest_quit(qts);
104
+}
105
+
106
+static void sdwrite_read(QTestState *qts, const char *msg)
107
+{
108
+ int fd, ret;
109
+ size_t len = strlen(msg);
110
+ char *rmsg = g_malloc(len);
111
+
112
+ /* write message using sdhci */
113
+ sdhci_write_cmd(qts, NPCM7XX_MMC_BA, msg, len, NPCM7XX_BLK_SIZE);
114
+
115
+ /* read message from sd */
116
+ fd = open(sd_path, O_RDONLY);
117
+ g_assert(fd >= 0);
118
+ ret = read(fd, rmsg, len);
119
+ close(fd);
120
+ g_assert(ret == len);
121
+
122
+ g_assert(!strcmp(rmsg, msg));
123
+
124
+ g_free(rmsg);
125
+}
126
+
127
+/* Check MMC can write values to sd */
128
+static void test_write_sd(void)
129
+{
130
+ QTestState *qts = setup_sd_card();
131
+
132
+ sdwrite_read(qts, "hello world");
133
+ sdwrite_read(qts, "goodbye");
134
+
135
+ qtest_quit(qts);
136
+}
137
+
138
+/* Check SDHCI has correct default values. */
139
+static void test_reset(void)
140
+{
141
+ QTestState *qts = qtest_init("-machine kudo-bmc");
142
+ uint64_t addr = NPCM7XX_MMC_BA;
143
+ uint64_t end_addr = addr + NPCM7XX_REG_SIZE;
144
+ uint16_t prstvals_resets[] = {NPCM7XX_PRSTVALS_0_RESET,
145
+ NPCM7XX_PRSTVALS_1_RESET,
146
+ 0,
147
+ NPCM7XX_PRSTVALS_3_RESET,
148
+ 0,
149
+ 0};
150
+ int i;
151
+ uint32_t mask;
152
+
153
+ while (addr < end_addr) {
154
+ switch (addr - NPCM7XX_MMC_BA) {
155
+ case SDHC_PRNSTS:
156
+ /*
157
+ * ignores bits 20 to 24: they are changed when reading registers
158
+ */
159
+ mask = 0x1f00000;
160
+ g_assert_cmphex(qtest_readl(qts, addr) | mask, ==,
161
+ NPCM7XX_PRSNTS_RESET | mask);
162
+ addr += 4;
163
+ break;
164
+ case SDHC_BLKGAP:
165
+ g_assert_cmphex(qtest_readb(qts, addr), ==, NPCM7XX_BLKGAP_RESET);
166
+ addr += 1;
167
+ break;
168
+ case SDHC_CAPAB:
169
+ g_assert_cmphex(qtest_readq(qts, addr), ==, NPCM7XX_CAPAB_RESET);
170
+ addr += 8;
171
+ break;
172
+ case SDHC_MAXCURR:
173
+ g_assert_cmphex(qtest_readq(qts, addr), ==, NPCM7XX_MAXCURR_RESET);
174
+ addr += 8;
175
+ break;
176
+ case SDHC_HCVER:
177
+ g_assert_cmphex(qtest_readw(qts, addr), ==, NPCM7XX_HCVER_RESET);
178
+ addr += 2;
179
+ break;
180
+ case NPCM7XX_PRSTVALS:
181
+ for (i = 0; i < NPCM7XX_PRSTVALS_SIZE; ++i) {
182
+ g_assert_cmphex(qtest_readw(qts, addr + 2 * i), ==,
183
+ prstvals_resets[i]);
184
+ }
185
+ addr += NPCM7XX_PRSTVALS_SIZE * 2;
186
+ break;
187
+ default:
188
+ g_assert_cmphex(qtest_readb(qts, addr), ==, 0);
189
+ addr += 1;
80
+ }
190
+ }
81
+ }
191
+ }
82
+
192
+
83
+ if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
193
+ qtest_quit(qts);
84
+ /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */
194
+}
85
+ if (sctlr & (el == 0 ? SCTLR_BT0 : SCTLR_BT1)) {
195
+
86
+ flags = FIELD_DP32(flags, TBFLAG_A64, BT, 1);
196
+static void drive_destroy(void)
87
+ }
197
+{
198
+ unlink(sd_path);
199
+ g_free(sd_path);
200
+}
201
+
202
+static void drive_create(void)
203
+{
204
+ int fd, ret;
205
+ GError *error = NULL;
206
+
207
+ /* Create a temporary raw image */
208
+ fd = g_file_open_tmp("sdhci_XXXXXX", &sd_path, &error);
209
+ if (fd == -1) {
210
+ fprintf(stderr, "unable to create sdhci file: %s\n", error->message);
211
+ g_error_free(error);
88
+ }
212
+ }
89
+
213
+ g_assert(sd_path != NULL);
90
+ return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
214
+
91
+}
215
+ ret = ftruncate(fd, NPCM7XX_TEST_IMAGE_SIZE);
92
+
216
+ g_assert_cmpint(ret, ==, 0);
93
void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
217
+ g_message("%s", sd_path);
94
target_ulong *cs_base, uint32_t *pflags)
218
+ close(fd);
95
{
219
+}
96
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
220
+
97
uint32_t flags = 0;
221
+int main(int argc, char **argv)
98
222
+{
99
if (is_a64(env)) {
223
+ int ret;
100
- ARMCPU *cpu = env_archcpu(env);
224
+
101
- uint64_t sctlr;
225
+ drive_create();
102
-
226
+
103
*pc = env->pc;
227
+ g_test_init(&argc, &argv, NULL);
104
- flags = FIELD_DP32(flags, TBFLAG_ANY, AARCH64_STATE, 1);
228
+
105
-
229
+ qtest_add_func("npcm7xx_sdhci/reset", test_reset);
106
- /* Get control bits for tagged addresses. */
230
+ qtest_add_func("npcm7xx_sdhci/write_sd", test_write_sd);
107
- {
231
+ qtest_add_func("npcm7xx_sdhci/read_sd", test_read_sd);
108
- ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx);
232
+
109
- ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1);
233
+ ret = g_test_run();
110
- int tbii, tbid;
234
+ drive_destroy();
111
-
235
+ return ret;
112
- /* FIXME: ARMv8.1-VHE S2 translation regime. */
236
+}
113
- if (regime_el(env, stage1) < 2) {
237
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
114
- ARMVAParameters p1 = aa64_va_parameters_both(env, -1, stage1);
238
index XXXXXXX..XXXXXXX 100644
115
- tbid = (p1.tbi << 1) | p0.tbi;
239
--- a/tests/qtest/meson.build
116
- tbii = tbid & ~((p1.tbid << 1) | p0.tbid);
240
+++ b/tests/qtest/meson.build
117
- } else {
241
@@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \
118
- tbid = p0.tbi;
242
'npcm7xx_gpio-test',
119
- tbii = tbid & !p0.tbid;
243
'npcm7xx_pwm-test',
120
- }
244
'npcm7xx_rng-test',
121
-
245
+ 'npcm7xx_sdhci-test',
122
- flags = FIELD_DP32(flags, TBFLAG_A64, TBII, tbii);
246
'npcm7xx_smbus-test',
123
- flags = FIELD_DP32(flags, TBFLAG_A64, TBID, tbid);
247
'npcm7xx_timer-test',
124
- }
248
'npcm7xx_watchdog_timer-test'] + \
125
-
126
- if (cpu_isar_feature(aa64_sve, cpu)) {
127
- int sve_el = sve_exception_el(env, current_el);
128
- uint32_t zcr_len;
129
-
130
- /* If SVE is disabled, but FP is enabled,
131
- * then the effective len is 0.
132
- */
133
- if (sve_el != 0 && fp_el == 0) {
134
- zcr_len = 0;
135
- } else {
136
- zcr_len = sve_zcr_len_for_el(env, current_el);
137
- }
138
- flags = FIELD_DP32(flags, TBFLAG_A64, SVEEXC_EL, sve_el);
139
- flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len);
140
- }
141
-
142
- sctlr = arm_sctlr(env, current_el);
143
-
144
- if (cpu_isar_feature(aa64_pauth, cpu)) {
145
- /*
146
- * In order to save space in flags, we record only whether
147
- * pauth is "inactive", meaning all insns are implemented as
148
- * a nop, or "active" when some action must be performed.
149
- * The decision of which action to take is left to a helper.
150
- */
151
- if (sctlr & (SCTLR_EnIA | SCTLR_EnIB | SCTLR_EnDA | SCTLR_EnDB)) {
152
- flags = FIELD_DP32(flags, TBFLAG_A64, PAUTH_ACTIVE, 1);
153
- }
154
- }
155
-
156
- if (cpu_isar_feature(aa64_bti, cpu)) {
157
- /* Note that SCTLR_EL[23].BT == SCTLR_BT1. */
158
- if (sctlr & (current_el == 0 ? SCTLR_BT0 : SCTLR_BT1)) {
159
- flags = FIELD_DP32(flags, TBFLAG_A64, BT, 1);
160
- }
161
+ flags = rebuild_hflags_a64(env, current_el, fp_el, mmu_idx);
162
+ if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
163
flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype);
164
}
165
} else {
166
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
167
flags = FIELD_DP32(flags, TBFLAG_A32,
168
XSCALE_CPAR, env->cp15.c15_cpar);
169
}
170
- }
171
172
- flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags);
173
+ flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags);
174
+ }
175
176
/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
177
* states defined in the ARM ARM for software singlestep:
178
--
249
--
179
2.20.1
250
2.25.1
180
251
181
252
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Alexander Graf <agraf@csgraf.de>
2
2
3
Having the RAM creation code in a separate function is not
3
We are parsing the syndrome field for sysregs in multiple places across
4
very helpful. Move this code directly inside the board_init()
4
the hvf code, but repeat shift/mask operations with hard coded constants
5
function, this will later allow the board to have the QOM
5
every time. This is an error prone approach and makes it harder to reason
6
ownership of the RAM.
6
about the correctness of these operations.
7
7
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Let's introduce macros that allow us to unify the constants used as well
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
as create new helpers to extract fields from the sysreg value.
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
11
Message-id: 20191021190653.9511-7-philmd@redhat.com
11
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Alexander Graf <agraf@csgraf.de>
13
Reviewed-by: Cameron Esfahani <dirty@apple.com <mailto:dirty@apple.com>>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Message-id: 20220209124135.69183-1-agraf@csgraf.de
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
17
---
14
hw/arm/digic_boards.c | 9 ++-------
18
target/arm/hvf/hvf.c | 69 ++++++++++++++++++++++++++++++--------------
15
1 file changed, 2 insertions(+), 7 deletions(-)
19
1 file changed, 47 insertions(+), 22 deletions(-)
16
20
17
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
21
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
18
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/digic_boards.c
23
--- a/target/arm/hvf/hvf.c
20
+++ b/hw/arm/digic_boards.c
24
+++ b/target/arm/hvf/hvf.c
21
@@ -XXX,XX +XXX,XX @@ typedef struct DigicBoard {
25
@@ -XXX,XX +XXX,XX @@
22
const char *rom1_def_filename;
26
ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, crn, crm, op0, op1, op2)
23
} DigicBoard;
27
#define PL1_WRITE_MASK 0x4
24
28
25
-static void digic4_board_setup_ram(DigicBoardState *s, hwaddr ram_size)
29
+#define SYSREG_OP0_SHIFT 20
26
-{
30
+#define SYSREG_OP0_MASK 0x3
27
- memory_region_allocate_system_memory(&s->ram, NULL, "ram", ram_size);
31
+#define SYSREG_OP0(sysreg) ((sysreg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK)
28
- memory_region_add_subregion(get_system_memory(), 0, &s->ram);
32
+#define SYSREG_OP1_SHIFT 14
29
-}
33
+#define SYSREG_OP1_MASK 0x7
30
-
34
+#define SYSREG_OP1(sysreg) ((sysreg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK)
31
static void digic4_board_init(DigicBoard *board)
35
+#define SYSREG_CRN_SHIFT 10
32
{
36
+#define SYSREG_CRN_MASK 0xf
33
Error *err = NULL;
37
+#define SYSREG_CRN(sysreg) ((sysreg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK)
34
@@ -XXX,XX +XXX,XX @@ static void digic4_board_init(DigicBoard *board)
38
+#define SYSREG_CRM_SHIFT 1
35
exit(1);
39
+#define SYSREG_CRM_MASK 0xf
40
+#define SYSREG_CRM(sysreg) ((sysreg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK)
41
+#define SYSREG_OP2_SHIFT 17
42
+#define SYSREG_OP2_MASK 0x7
43
+#define SYSREG_OP2(sysreg) ((sysreg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK)
44
+
45
#define SYSREG(op0, op1, crn, crm, op2) \
46
- ((op0 << 20) | (op2 << 17) | (op1 << 14) | (crn << 10) | (crm << 1))
47
-#define SYSREG_MASK SYSREG(0x3, 0x7, 0xf, 0xf, 0x7)
48
+ ((op0 << SYSREG_OP0_SHIFT) | \
49
+ (op1 << SYSREG_OP1_SHIFT) | \
50
+ (crn << SYSREG_CRN_SHIFT) | \
51
+ (crm << SYSREG_CRM_SHIFT) | \
52
+ (op2 << SYSREG_OP2_SHIFT))
53
+#define SYSREG_MASK \
54
+ SYSREG(SYSREG_OP0_MASK, \
55
+ SYSREG_OP1_MASK, \
56
+ SYSREG_CRN_MASK, \
57
+ SYSREG_CRM_MASK, \
58
+ SYSREG_OP2_MASK)
59
#define SYSREG_OSLAR_EL1 SYSREG(2, 0, 1, 0, 4)
60
#define SYSREG_OSLSR_EL1 SYSREG(2, 0, 1, 1, 4)
61
#define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4)
62
@@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt)
63
default:
64
cpu_synchronize_state(cpu);
65
trace_hvf_unhandled_sysreg_read(env->pc, reg,
66
- (reg >> 20) & 0x3,
67
- (reg >> 14) & 0x7,
68
- (reg >> 10) & 0xf,
69
- (reg >> 1) & 0xf,
70
- (reg >> 17) & 0x7);
71
+ SYSREG_OP0(reg),
72
+ SYSREG_OP1(reg),
73
+ SYSREG_CRN(reg),
74
+ SYSREG_CRM(reg),
75
+ SYSREG_OP2(reg));
76
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized());
77
return 1;
36
}
78
}
37
79
38
- digic4_board_setup_ram(s, board->ram_size);
80
trace_hvf_sysreg_read(reg,
39
+ memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_size);
81
- (reg >> 20) & 0x3,
40
+ memory_region_add_subregion(get_system_memory(), 0, &s->ram);
82
- (reg >> 14) & 0x7,
41
83
- (reg >> 10) & 0xf,
42
if (board->add_rom0) {
84
- (reg >> 1) & 0xf,
43
board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename);
85
- (reg >> 17) & 0x7,
86
+ SYSREG_OP0(reg),
87
+ SYSREG_OP1(reg),
88
+ SYSREG_CRN(reg),
89
+ SYSREG_CRM(reg),
90
+ SYSREG_OP2(reg),
91
val);
92
hvf_set_reg(cpu, rt, val);
93
94
@@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
95
CPUARMState *env = &arm_cpu->env;
96
97
trace_hvf_sysreg_write(reg,
98
- (reg >> 20) & 0x3,
99
- (reg >> 14) & 0x7,
100
- (reg >> 10) & 0xf,
101
- (reg >> 1) & 0xf,
102
- (reg >> 17) & 0x7,
103
+ SYSREG_OP0(reg),
104
+ SYSREG_OP1(reg),
105
+ SYSREG_CRN(reg),
106
+ SYSREG_CRM(reg),
107
+ SYSREG_OP2(reg),
108
val);
109
110
switch (reg) {
111
@@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
112
default:
113
cpu_synchronize_state(cpu);
114
trace_hvf_unhandled_sysreg_write(env->pc, reg,
115
- (reg >> 20) & 0x3,
116
- (reg >> 14) & 0x7,
117
- (reg >> 10) & 0xf,
118
- (reg >> 1) & 0xf,
119
- (reg >> 17) & 0x7);
120
+ SYSREG_OP0(reg),
121
+ SYSREG_OP1(reg),
122
+ SYSREG_CRN(reg),
123
+ SYSREG_CRM(reg),
124
+ SYSREG_OP2(reg));
125
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized());
126
return 1;
127
}
44
--
128
--
45
2.20.1
129
2.25.1
46
130
47
131
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Alexander Graf <agraf@csgraf.de>
2
2
3
This functions are given the mode and el state of the cpu
3
Recent Linux versions added support to read ID_AA64ISAR2_EL1. On M1,
4
and writes the computed value to env->hflags.
4
those reads trap into QEMU which handles them as faults.
5
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
However, AArch64 ID registers should always read as RES0. Let's
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
handle them accordingly.
8
Message-id: 20191018174431.1784-16-richard.henderson@linaro.org
8
9
This fixes booting Linux 5.17 guests.
10
11
Cc: qemu-stable@nongnu.org
12
Reported-by: Ivan Babrou <ivan@cloudflare.com>
13
Signed-off-by: Alexander Graf <agraf@csgraf.de>
14
Message-id: 20220209124135.69183-2-agraf@csgraf.de
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
17
---
11
target/arm/helper.h | 4 ++++
18
target/arm/hvf/hvf.c | 14 ++++++++++++++
12
target/arm/helper.c | 24 ++++++++++++++++++++++++
19
1 file changed, 14 insertions(+)
13
2 files changed, 28 insertions(+)
14
20
15
diff --git a/target/arm/helper.h b/target/arm/helper.h
21
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.h
23
--- a/target/arm/hvf/hvf.c
18
+++ b/target/arm/helper.h
24
+++ b/target/arm/hvf/hvf.c
19
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_4(msr_banked, void, env, i32, i32, i32)
25
@@ -XXX,XX +XXX,XX @@ static bool hvf_handle_psci_call(CPUState *cpu)
20
DEF_HELPER_2(get_user_reg, i32, env, i32)
26
return true;
21
DEF_HELPER_3(set_user_reg, void, env, i32, i32)
22
23
+DEF_HELPER_FLAGS_2(rebuild_hflags_m32, TCG_CALL_NO_RWG, void, env, int)
24
+DEF_HELPER_FLAGS_2(rebuild_hflags_a32, TCG_CALL_NO_RWG, void, env, int)
25
+DEF_HELPER_FLAGS_2(rebuild_hflags_a64, TCG_CALL_NO_RWG, void, env, int)
26
+
27
DEF_HELPER_1(vfp_get_fpscr, i32, env)
28
DEF_HELPER_2(vfp_set_fpscr, void, env, i32)
29
30
diff --git a/target/arm/helper.c b/target/arm/helper.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/helper.c
33
+++ b/target/arm/helper.c
34
@@ -XXX,XX +XXX,XX @@ void arm_rebuild_hflags(CPUARMState *env)
35
env->hflags = rebuild_hflags_internal(env);
36
}
27
}
37
28
38
+void HELPER(rebuild_hflags_m32)(CPUARMState *env, int el)
29
+static bool is_id_sysreg(uint32_t reg)
39
+{
30
+{
40
+ int fp_el = fp_exception_el(env, el);
31
+ return SYSREG_OP0(reg) == 3 &&
41
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
32
+ SYSREG_OP1(reg) == 0 &&
42
+
33
+ SYSREG_CRN(reg) == 0 &&
43
+ env->hflags = rebuild_hflags_m32(env, fp_el, mmu_idx);
34
+ SYSREG_CRM(reg) >= 1 &&
35
+ SYSREG_CRM(reg) < 8;
44
+}
36
+}
45
+
37
+
46
+void HELPER(rebuild_hflags_a32)(CPUARMState *env, int el)
38
static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt)
47
+{
48
+ int fp_el = fp_exception_el(env, el);
49
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
50
+
51
+ env->hflags = rebuild_hflags_a32(env, fp_el, mmu_idx);
52
+}
53
+
54
+void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el)
55
+{
56
+ int fp_el = fp_exception_el(env, el);
57
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
58
+
59
+ env->hflags = rebuild_hflags_a64(env, el, fp_el, mmu_idx);
60
+}
61
+
62
void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
63
target_ulong *cs_base, uint32_t *pflags)
64
{
39
{
40
ARMCPU *arm_cpu = ARM_CPU(cpu);
41
@@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt)
42
/* Dummy register */
43
break;
44
default:
45
+ if (is_id_sysreg(reg)) {
46
+ /* ID system registers read as RES0 */
47
+ val = 0;
48
+ break;
49
+ }
50
cpu_synchronize_state(cpu);
51
trace_hvf_unhandled_sysreg_read(env->pc, reg,
52
SYSREG_OP0(reg),
65
--
53
--
66
2.20.1
54
2.25.1
67
55
68
56
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Set TBFLAG_ANY.BE_DATA in rebuild_hflags_common_32 and
3
More than 1k of TypeInfo instances are already marked as const. Mark the
4
rebuild_hflags_a64 instead of rebuild_hflags_common, where we do
4
remaining ones, too.
5
not need to re-test is_a64() nor re-compute the various inputs.
6
5
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
This commit was created with:
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
git grep -z -l 'static TypeInfo' -- '*.c' | \
9
Message-id: 20191018174431.1784-5-richard.henderson@linaro.org
8
xargs -0 sed -i 's/static TypeInfo/static const TypeInfo/'
9
10
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
11
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
Reviewed-by: Thomas Huth <thuth@redhat.com>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
16
Acked-by: Corey Minyard <cminyard@mvista.com>
17
Message-id: 20220117145805.173070-2-shentey@gmail.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
19
---
12
target/arm/cpu.h | 49 +++++++++++++++++++++++++++------------------
20
hw/core/generic-loader.c | 2 +-
13
target/arm/helper.c | 16 +++++++++++----
21
hw/core/guest-loader.c | 2 +-
14
2 files changed, 42 insertions(+), 23 deletions(-)
22
hw/display/bcm2835_fb.c | 2 +-
23
hw/display/i2c-ddc.c | 2 +-
24
hw/display/macfb.c | 4 ++--
25
hw/display/virtio-vga.c | 2 +-
26
hw/dma/bcm2835_dma.c | 2 +-
27
hw/i386/pc_piix.c | 2 +-
28
hw/i386/sgx-epc.c | 2 +-
29
hw/intc/bcm2835_ic.c | 2 +-
30
hw/intc/bcm2836_control.c | 2 +-
31
hw/ipmi/ipmi.c | 4 ++--
32
hw/mem/nvdimm.c | 2 +-
33
hw/mem/pc-dimm.c | 2 +-
34
hw/misc/bcm2835_mbox.c | 2 +-
35
hw/misc/bcm2835_powermgt.c | 2 +-
36
hw/misc/bcm2835_property.c | 2 +-
37
hw/misc/bcm2835_rng.c | 2 +-
38
hw/misc/pvpanic-isa.c | 2 +-
39
hw/misc/pvpanic-pci.c | 2 +-
40
hw/net/fsl_etsec/etsec.c | 2 +-
41
hw/ppc/prep_systemio.c | 2 +-
42
hw/ppc/spapr_iommu.c | 2 +-
43
hw/s390x/s390-pci-bus.c | 2 +-
44
hw/s390x/sclp.c | 2 +-
45
hw/s390x/tod-kvm.c | 2 +-
46
hw/s390x/tod-tcg.c | 2 +-
47
hw/s390x/tod.c | 2 +-
48
hw/scsi/lsi53c895a.c | 2 +-
49
hw/sd/allwinner-sdhost.c | 2 +-
50
hw/sd/aspeed_sdhci.c | 2 +-
51
hw/sd/bcm2835_sdhost.c | 2 +-
52
hw/sd/cadence_sdhci.c | 2 +-
53
hw/sd/npcm7xx_sdhci.c | 2 +-
54
hw/usb/dev-mtp.c | 2 +-
55
hw/usb/host-libusb.c | 2 +-
56
hw/vfio/igd.c | 2 +-
57
hw/virtio/virtio-pmem.c | 2 +-
58
qom/object.c | 4 ++--
59
39 files changed, 42 insertions(+), 42 deletions(-)
15
60
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
61
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
17
index XXXXXXX..XXXXXXX 100644
62
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
63
--- a/hw/core/generic-loader.c
19
+++ b/target/arm/cpu.h
64
+++ b/hw/core/generic-loader.c
20
@@ -XXX,XX +XXX,XX @@ static inline uint64_t arm_sctlr(CPUARMState *env, int el)
65
@@ -XXX,XX +XXX,XX @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
66
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
67
}
68
69
-static TypeInfo generic_loader_info = {
70
+static const TypeInfo generic_loader_info = {
71
.name = TYPE_GENERIC_LOADER,
72
.parent = TYPE_DEVICE,
73
.instance_size = sizeof(GenericLoaderState),
74
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/core/guest-loader.c
77
+++ b/hw/core/guest-loader.c
78
@@ -XXX,XX +XXX,XX @@ static void guest_loader_class_init(ObjectClass *klass, void *data)
79
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
80
}
81
82
-static TypeInfo guest_loader_info = {
83
+static const TypeInfo guest_loader_info = {
84
.name = TYPE_GUEST_LOADER,
85
.parent = TYPE_DEVICE,
86
.instance_size = sizeof(GuestLoaderState),
87
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
88
index XXXXXXX..XXXXXXX 100644
89
--- a/hw/display/bcm2835_fb.c
90
+++ b/hw/display/bcm2835_fb.c
91
@@ -XXX,XX +XXX,XX @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data)
92
dc->vmsd = &vmstate_bcm2835_fb;
93
}
94
95
-static TypeInfo bcm2835_fb_info = {
96
+static const TypeInfo bcm2835_fb_info = {
97
.name = TYPE_BCM2835_FB,
98
.parent = TYPE_SYS_BUS_DEVICE,
99
.instance_size = sizeof(BCM2835FBState),
100
diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/display/i2c-ddc.c
103
+++ b/hw/display/i2c-ddc.c
104
@@ -XXX,XX +XXX,XX @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data)
105
isc->send = i2c_ddc_tx;
106
}
107
108
-static TypeInfo i2c_ddc_info = {
109
+static const TypeInfo i2c_ddc_info = {
110
.name = TYPE_I2CDDC,
111
.parent = TYPE_I2C_SLAVE,
112
.instance_size = sizeof(I2CDDCState),
113
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/hw/display/macfb.c
116
+++ b/hw/display/macfb.c
117
@@ -XXX,XX +XXX,XX @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data)
118
device_class_set_props(dc, macfb_nubus_properties);
119
}
120
121
-static TypeInfo macfb_sysbus_info = {
122
+static const TypeInfo macfb_sysbus_info = {
123
.name = TYPE_MACFB,
124
.parent = TYPE_SYS_BUS_DEVICE,
125
.instance_size = sizeof(MacfbSysBusState),
126
.class_init = macfb_sysbus_class_init,
127
};
128
129
-static TypeInfo macfb_nubus_info = {
130
+static const TypeInfo macfb_nubus_info = {
131
.name = TYPE_NUBUS_MACFB,
132
.parent = TYPE_NUBUS_DEVICE,
133
.instance_size = sizeof(MacfbNubusState),
134
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
135
index XXXXXXX..XXXXXXX 100644
136
--- a/hw/display/virtio-vga.c
137
+++ b/hw/display/virtio-vga.c
138
@@ -XXX,XX +XXX,XX @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
139
virtio_vga_set_big_endian_fb);
140
}
141
142
-static TypeInfo virtio_vga_base_info = {
143
+static const TypeInfo virtio_vga_base_info = {
144
.name = TYPE_VIRTIO_VGA_BASE,
145
.parent = TYPE_VIRTIO_PCI,
146
.instance_size = sizeof(VirtIOVGABase),
147
diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
148
index XXXXXXX..XXXXXXX 100644
149
--- a/hw/dma/bcm2835_dma.c
150
+++ b/hw/dma/bcm2835_dma.c
151
@@ -XXX,XX +XXX,XX @@ static void bcm2835_dma_class_init(ObjectClass *klass, void *data)
152
dc->vmsd = &vmstate_bcm2835_dma;
153
}
154
155
-static TypeInfo bcm2835_dma_info = {
156
+static const TypeInfo bcm2835_dma_info = {
157
.name = TYPE_BCM2835_DMA,
158
.parent = TYPE_SYS_BUS_DEVICE,
159
.instance_size = sizeof(BCM2835DMAState),
160
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
161
index XXXXXXX..XXXXXXX 100644
162
--- a/hw/i386/pc_piix.c
163
+++ b/hw/i386/pc_piix.c
164
@@ -XXX,XX +XXX,XX @@ static void isa_bridge_class_init(ObjectClass *klass, void *data)
165
k->class_id = PCI_CLASS_BRIDGE_ISA;
166
};
167
168
-static TypeInfo isa_bridge_info = {
169
+static const TypeInfo isa_bridge_info = {
170
.name = "igd-passthrough-isa-bridge",
171
.parent = TYPE_PCI_DEVICE,
172
.instance_size = sizeof(PCIDevice),
173
diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
174
index XXXXXXX..XXXXXXX 100644
175
--- a/hw/i386/sgx-epc.c
176
+++ b/hw/i386/sgx-epc.c
177
@@ -XXX,XX +XXX,XX @@ static void sgx_epc_class_init(ObjectClass *oc, void *data)
178
mdc->fill_device_info = sgx_epc_md_fill_device_info;
179
}
180
181
-static TypeInfo sgx_epc_info = {
182
+static const TypeInfo sgx_epc_info = {
183
.name = TYPE_SGX_EPC,
184
.parent = TYPE_DEVICE,
185
.instance_size = sizeof(SGXEPCDevice),
186
diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
187
index XXXXXXX..XXXXXXX 100644
188
--- a/hw/intc/bcm2835_ic.c
189
+++ b/hw/intc/bcm2835_ic.c
190
@@ -XXX,XX +XXX,XX @@ static void bcm2835_ic_class_init(ObjectClass *klass, void *data)
191
dc->vmsd = &vmstate_bcm2835_ic;
192
}
193
194
-static TypeInfo bcm2835_ic_info = {
195
+static const TypeInfo bcm2835_ic_info = {
196
.name = TYPE_BCM2835_IC,
197
.parent = TYPE_SYS_BUS_DEVICE,
198
.instance_size = sizeof(BCM2835ICState),
199
diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
200
index XXXXXXX..XXXXXXX 100644
201
--- a/hw/intc/bcm2836_control.c
202
+++ b/hw/intc/bcm2836_control.c
203
@@ -XXX,XX +XXX,XX @@ static void bcm2836_control_class_init(ObjectClass *klass, void *data)
204
dc->vmsd = &vmstate_bcm2836_control;
205
}
206
207
-static TypeInfo bcm2836_control_info = {
208
+static const TypeInfo bcm2836_control_info = {
209
.name = TYPE_BCM2836_CONTROL,
210
.parent = TYPE_SYS_BUS_DEVICE,
211
.instance_size = sizeof(BCM2836ControlState),
212
diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
213
index XXXXXXX..XXXXXXX 100644
214
--- a/hw/ipmi/ipmi.c
215
+++ b/hw/ipmi/ipmi.c
216
@@ -XXX,XX +XXX,XX @@ static void ipmi_interface_class_init(ObjectClass *class, void *data)
217
ik->do_hw_op = ipmi_do_hw_op;
218
}
219
220
-static TypeInfo ipmi_interface_type_info = {
221
+static const TypeInfo ipmi_interface_type_info = {
222
.name = TYPE_IPMI_INTERFACE,
223
.parent = TYPE_INTERFACE,
224
.class_size = sizeof(IPMIInterfaceClass),
225
@@ -XXX,XX +XXX,XX @@ static void bmc_class_init(ObjectClass *oc, void *data)
226
device_class_set_props(dc, ipmi_bmc_properties);
227
}
228
229
-static TypeInfo ipmi_bmc_type_info = {
230
+static const TypeInfo ipmi_bmc_type_info = {
231
.name = TYPE_IPMI_BMC,
232
.parent = TYPE_DEVICE,
233
.instance_size = sizeof(IPMIBmc),
234
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
235
index XXXXXXX..XXXXXXX 100644
236
--- a/hw/mem/nvdimm.c
237
+++ b/hw/mem/nvdimm.c
238
@@ -XXX,XX +XXX,XX @@ static void nvdimm_class_init(ObjectClass *oc, void *data)
239
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
240
}
241
242
-static TypeInfo nvdimm_info = {
243
+static const TypeInfo nvdimm_info = {
244
.name = TYPE_NVDIMM,
245
.parent = TYPE_PC_DIMM,
246
.class_size = sizeof(NVDIMMClass),
247
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
248
index XXXXXXX..XXXXXXX 100644
249
--- a/hw/mem/pc-dimm.c
250
+++ b/hw/mem/pc-dimm.c
251
@@ -XXX,XX +XXX,XX @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
252
mdc->fill_device_info = pc_dimm_md_fill_device_info;
253
}
254
255
-static TypeInfo pc_dimm_info = {
256
+static const TypeInfo pc_dimm_info = {
257
.name = TYPE_PC_DIMM,
258
.parent = TYPE_DEVICE,
259
.instance_size = sizeof(PCDIMMDevice),
260
diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
261
index XXXXXXX..XXXXXXX 100644
262
--- a/hw/misc/bcm2835_mbox.c
263
+++ b/hw/misc/bcm2835_mbox.c
264
@@ -XXX,XX +XXX,XX @@ static void bcm2835_mbox_class_init(ObjectClass *klass, void *data)
265
dc->vmsd = &vmstate_bcm2835_mbox;
266
}
267
268
-static TypeInfo bcm2835_mbox_info = {
269
+static const TypeInfo bcm2835_mbox_info = {
270
.name = TYPE_BCM2835_MBOX,
271
.parent = TYPE_SYS_BUS_DEVICE,
272
.instance_size = sizeof(BCM2835MboxState),
273
diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c
274
index XXXXXXX..XXXXXXX 100644
275
--- a/hw/misc/bcm2835_powermgt.c
276
+++ b/hw/misc/bcm2835_powermgt.c
277
@@ -XXX,XX +XXX,XX @@ static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data)
278
dc->vmsd = &vmstate_bcm2835_powermgt;
279
}
280
281
-static TypeInfo bcm2835_powermgt_info = {
282
+static const TypeInfo bcm2835_powermgt_info = {
283
.name = TYPE_BCM2835_POWERMGT,
284
.parent = TYPE_SYS_BUS_DEVICE,
285
.instance_size = sizeof(BCM2835PowerMgtState),
286
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
287
index XXXXXXX..XXXXXXX 100644
288
--- a/hw/misc/bcm2835_property.c
289
+++ b/hw/misc/bcm2835_property.c
290
@@ -XXX,XX +XXX,XX @@ static void bcm2835_property_class_init(ObjectClass *klass, void *data)
291
dc->vmsd = &vmstate_bcm2835_property;
292
}
293
294
-static TypeInfo bcm2835_property_info = {
295
+static const TypeInfo bcm2835_property_info = {
296
.name = TYPE_BCM2835_PROPERTY,
297
.parent = TYPE_SYS_BUS_DEVICE,
298
.instance_size = sizeof(BCM2835PropertyState),
299
diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c
300
index XXXXXXX..XXXXXXX 100644
301
--- a/hw/misc/bcm2835_rng.c
302
+++ b/hw/misc/bcm2835_rng.c
303
@@ -XXX,XX +XXX,XX @@ static void bcm2835_rng_class_init(ObjectClass *klass, void *data)
304
dc->vmsd = &vmstate_bcm2835_rng;
305
}
306
307
-static TypeInfo bcm2835_rng_info = {
308
+static const TypeInfo bcm2835_rng_info = {
309
.name = TYPE_BCM2835_RNG,
310
.parent = TYPE_SYS_BUS_DEVICE,
311
.instance_size = sizeof(BCM2835RngState),
312
diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
313
index XXXXXXX..XXXXXXX 100644
314
--- a/hw/misc/pvpanic-isa.c
315
+++ b/hw/misc/pvpanic-isa.c
316
@@ -XXX,XX +XXX,XX @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
317
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
318
}
319
320
-static TypeInfo pvpanic_isa_info = {
321
+static const TypeInfo pvpanic_isa_info = {
322
.name = TYPE_PVPANIC_ISA_DEVICE,
323
.parent = TYPE_ISA_DEVICE,
324
.instance_size = sizeof(PVPanicISAState),
325
diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
326
index XXXXXXX..XXXXXXX 100644
327
--- a/hw/misc/pvpanic-pci.c
328
+++ b/hw/misc/pvpanic-pci.c
329
@@ -XXX,XX +XXX,XX @@ static void pvpanic_pci_class_init(ObjectClass *klass, void *data)
330
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
331
}
332
333
-static TypeInfo pvpanic_pci_info = {
334
+static const TypeInfo pvpanic_pci_info = {
335
.name = TYPE_PVPANIC_PCI_DEVICE,
336
.parent = TYPE_PCI_DEVICE,
337
.instance_size = sizeof(PVPanicPCIState),
338
diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
339
index XXXXXXX..XXXXXXX 100644
340
--- a/hw/net/fsl_etsec/etsec.c
341
+++ b/hw/net/fsl_etsec/etsec.c
342
@@ -XXX,XX +XXX,XX @@ static void etsec_class_init(ObjectClass *klass, void *data)
343
dc->user_creatable = true;
344
}
345
346
-static TypeInfo etsec_info = {
347
+static const TypeInfo etsec_info = {
348
.name = TYPE_ETSEC_COMMON,
349
.parent = TYPE_SYS_BUS_DEVICE,
350
.instance_size = sizeof(eTSEC),
351
diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
352
index XXXXXXX..XXXXXXX 100644
353
--- a/hw/ppc/prep_systemio.c
354
+++ b/hw/ppc/prep_systemio.c
355
@@ -XXX,XX +XXX,XX @@ static void prep_systemio_class_initfn(ObjectClass *klass, void *data)
356
device_class_set_props(dc, prep_systemio_properties);
357
}
358
359
-static TypeInfo prep_systemio800_info = {
360
+static const TypeInfo prep_systemio800_info = {
361
.name = TYPE_PREP_SYSTEMIO,
362
.parent = TYPE_ISA_DEVICE,
363
.instance_size = sizeof(PrepSystemIoState),
364
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
365
index XXXXXXX..XXXXXXX 100644
366
--- a/hw/ppc/spapr_iommu.c
367
+++ b/hw/ppc/spapr_iommu.c
368
@@ -XXX,XX +XXX,XX @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
369
spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce);
370
}
371
372
-static TypeInfo spapr_tce_table_info = {
373
+static const TypeInfo spapr_tce_table_info = {
374
.name = TYPE_SPAPR_TCE_TABLE,
375
.parent = TYPE_DEVICE,
376
.instance_size = sizeof(SpaprTceTable),
377
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
378
index XXXXXXX..XXXXXXX 100644
379
--- a/hw/s390x/s390-pci-bus.c
380
+++ b/hw/s390x/s390-pci-bus.c
381
@@ -XXX,XX +XXX,XX @@ static const TypeInfo s390_pci_device_info = {
382
.class_init = s390_pci_device_class_init,
383
};
384
385
-static TypeInfo s390_pci_iommu_info = {
386
+static const TypeInfo s390_pci_iommu_info = {
387
.name = TYPE_S390_PCI_IOMMU,
388
.parent = TYPE_OBJECT,
389
.instance_size = sizeof(S390PCIIOMMU),
390
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
391
index XXXXXXX..XXXXXXX 100644
392
--- a/hw/s390x/sclp.c
393
+++ b/hw/s390x/sclp.c
394
@@ -XXX,XX +XXX,XX @@ static void sclp_class_init(ObjectClass *oc, void *data)
395
sc->service_interrupt = service_interrupt;
396
}
397
398
-static TypeInfo sclp_info = {
399
+static const TypeInfo sclp_info = {
400
.name = TYPE_SCLP,
401
.parent = TYPE_DEVICE,
402
.instance_init = sclp_init,
403
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
404
index XXXXXXX..XXXXXXX 100644
405
--- a/hw/s390x/tod-kvm.c
406
+++ b/hw/s390x/tod-kvm.c
407
@@ -XXX,XX +XXX,XX @@ static void kvm_s390_tod_init(Object *obj)
408
td->stopped = false;
409
}
410
411
-static TypeInfo kvm_s390_tod_info = {
412
+static const TypeInfo kvm_s390_tod_info = {
413
.name = TYPE_KVM_S390_TOD,
414
.parent = TYPE_S390_TOD,
415
.instance_size = sizeof(S390TODState),
416
diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c
417
index XXXXXXX..XXXXXXX 100644
418
--- a/hw/s390x/tod-tcg.c
419
+++ b/hw/s390x/tod-tcg.c
420
@@ -XXX,XX +XXX,XX @@ static void qemu_s390_tod_init(Object *obj)
21
}
421
}
22
}
422
}
23
423
24
+static inline bool arm_cpu_data_is_big_endian_a32(CPUARMState *env,
424
-static TypeInfo qemu_s390_tod_info = {
25
+ bool sctlr_b)
425
+static const TypeInfo qemu_s390_tod_info = {
26
+{
426
.name = TYPE_QEMU_S390_TOD,
27
+#ifdef CONFIG_USER_ONLY
427
.parent = TYPE_S390_TOD,
28
+ /*
428
.instance_size = sizeof(S390TODState),
29
+ * In system mode, BE32 is modelled in line with the
429
diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c
30
+ * architecture (as word-invariant big-endianness), where loads
430
index XXXXXXX..XXXXXXX 100644
31
+ * and stores are done little endian but from addresses which
431
--- a/hw/s390x/tod.c
32
+ * are adjusted by XORing with the appropriate constant. So the
432
+++ b/hw/s390x/tod.c
33
+ * endianness to use for the raw data access is not affected by
433
@@ -XXX,XX +XXX,XX @@ static void s390_tod_class_init(ObjectClass *oc, void *data)
34
+ * SCTLR.B.
434
dc->user_creatable = false;
35
+ * In user mode, however, we model BE32 as byte-invariant
435
}
36
+ * big-endianness (because user-only code cannot tell the
436
37
+ * difference), and so we need to use a data access endianness
437
-static TypeInfo s390_tod_info = {
38
+ * that depends on SCTLR.B.
438
+static const TypeInfo s390_tod_info = {
39
+ */
439
.name = TYPE_S390_TOD,
40
+ if (sctlr_b) {
440
.parent = TYPE_DEVICE,
41
+ return true;
441
.instance_size = sizeof(S390TODState),
42
+ }
442
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
43
+#endif
443
index XXXXXXX..XXXXXXX 100644
44
+ /* In 32bit endianness is determined by looking at CPSR's E bit */
444
--- a/hw/scsi/lsi53c895a.c
45
+ return env->uncached_cpsr & CPSR_E;
445
+++ b/hw/scsi/lsi53c895a.c
46
+}
446
@@ -XXX,XX +XXX,XX @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
47
+
447
k->device_id = PCI_DEVICE_ID_LSI_53C810;
48
+static inline bool arm_cpu_data_is_big_endian_a64(int el, uint64_t sctlr)
448
}
49
+{
449
50
+ return sctlr & (el ? SCTLR_EE : SCTLR_E0E);
450
-static TypeInfo lsi53c810_info = {
51
+}
451
+static const TypeInfo lsi53c810_info = {
52
452
.name = TYPE_LSI53C810,
53
/* Return true if the processor is in big-endian mode. */
453
.parent = TYPE_LSI53C895A,
54
static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
454
.class_init = lsi53c810_class_init,
455
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
456
index XXXXXXX..XXXXXXX 100644
457
--- a/hw/sd/allwinner-sdhost.c
458
+++ b/hw/sd/allwinner-sdhost.c
459
@@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data)
460
sc->max_desc_size = 64 * KiB;
461
}
462
463
-static TypeInfo allwinner_sdhost_info = {
464
+static const TypeInfo allwinner_sdhost_info = {
465
.name = TYPE_AW_SDHOST,
466
.parent = TYPE_SYS_BUS_DEVICE,
467
.instance_init = allwinner_sdhost_init,
468
diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
469
index XXXXXXX..XXXXXXX 100644
470
--- a/hw/sd/aspeed_sdhci.c
471
+++ b/hw/sd/aspeed_sdhci.c
472
@@ -XXX,XX +XXX,XX @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data)
473
device_class_set_props(dc, aspeed_sdhci_properties);
474
}
475
476
-static TypeInfo aspeed_sdhci_info = {
477
+static const TypeInfo aspeed_sdhci_info = {
478
.name = TYPE_ASPEED_SDHCI,
479
.parent = TYPE_SYS_BUS_DEVICE,
480
.instance_size = sizeof(AspeedSDHCIState),
481
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
482
index XXXXXXX..XXXXXXX 100644
483
--- a/hw/sd/bcm2835_sdhost.c
484
+++ b/hw/sd/bcm2835_sdhost.c
485
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_class_init(ObjectClass *klass, void *data)
486
dc->vmsd = &vmstate_bcm2835_sdhost;
487
}
488
489
-static TypeInfo bcm2835_sdhost_info = {
490
+static const TypeInfo bcm2835_sdhost_info = {
491
.name = TYPE_BCM2835_SDHOST,
492
.parent = TYPE_SYS_BUS_DEVICE,
493
.instance_size = sizeof(BCM2835SDHostState),
494
diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c
495
index XXXXXXX..XXXXXXX 100644
496
--- a/hw/sd/cadence_sdhci.c
497
+++ b/hw/sd/cadence_sdhci.c
498
@@ -XXX,XX +XXX,XX @@ static void cadence_sdhci_class_init(ObjectClass *classp, void *data)
499
dc->vmsd = &vmstate_cadence_sdhci;
500
}
501
502
-static TypeInfo cadence_sdhci_info = {
503
+static const TypeInfo cadence_sdhci_info = {
504
.name = TYPE_CADENCE_SDHCI,
505
.parent = TYPE_SYS_BUS_DEVICE,
506
.instance_size = sizeof(CadenceSDHCIState),
507
diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c
508
index XXXXXXX..XXXXXXX 100644
509
--- a/hw/sd/npcm7xx_sdhci.c
510
+++ b/hw/sd/npcm7xx_sdhci.c
511
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_sdhci_instance_init(Object *obj)
512
TYPE_SYSBUS_SDHCI);
513
}
514
515
-static TypeInfo npcm7xx_sdhci_info = {
516
+static const TypeInfo npcm7xx_sdhci_info = {
517
.name = TYPE_NPCM7XX_SDHCI,
518
.parent = TYPE_SYS_BUS_DEVICE,
519
.instance_size = sizeof(NPCM7xxSDHCIState),
520
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
521
index XXXXXXX..XXXXXXX 100644
522
--- a/hw/usb/dev-mtp.c
523
+++ b/hw/usb/dev-mtp.c
524
@@ -XXX,XX +XXX,XX @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data)
525
device_class_set_props(dc, mtp_properties);
526
}
527
528
-static TypeInfo mtp_info = {
529
+static const TypeInfo mtp_info = {
530
.name = TYPE_USB_MTP,
531
.parent = TYPE_USB_DEVICE,
532
.instance_size = sizeof(MTPState),
533
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
534
index XXXXXXX..XXXXXXX 100644
535
--- a/hw/usb/host-libusb.c
536
+++ b/hw/usb/host-libusb.c
537
@@ -XXX,XX +XXX,XX @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
538
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
539
}
540
541
-static TypeInfo usb_host_dev_info = {
542
+static const TypeInfo usb_host_dev_info = {
543
.name = TYPE_USB_HOST_DEVICE,
544
.parent = TYPE_USB_DEVICE,
545
.instance_size = sizeof(USBHostDevice),
546
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
547
index XXXXXXX..XXXXXXX 100644
548
--- a/hw/vfio/igd.c
549
+++ b/hw/vfio/igd.c
550
@@ -XXX,XX +XXX,XX @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data)
551
k->class_id = PCI_CLASS_BRIDGE_ISA;
552
}
553
554
-static TypeInfo vfio_pci_igd_lpc_bridge_info = {
555
+static const TypeInfo vfio_pci_igd_lpc_bridge_info = {
556
.name = "vfio-pci-igd-lpc-bridge",
557
.parent = TYPE_PCI_DEVICE,
558
.class_init = vfio_pci_igd_lpc_bridge_class_init,
559
diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
560
index XXXXXXX..XXXXXXX 100644
561
--- a/hw/virtio/virtio-pmem.c
562
+++ b/hw/virtio/virtio-pmem.c
563
@@ -XXX,XX +XXX,XX @@ static void virtio_pmem_class_init(ObjectClass *klass, void *data)
564
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
565
}
566
567
-static TypeInfo virtio_pmem_info = {
568
+static const TypeInfo virtio_pmem_info = {
569
.name = TYPE_VIRTIO_PMEM,
570
.parent = TYPE_VIRTIO_DEVICE,
571
.class_size = sizeof(VirtIOPMEMClass),
572
diff --git a/qom/object.c b/qom/object.c
573
index XXXXXXX..XXXXXXX 100644
574
--- a/qom/object.c
575
+++ b/qom/object.c
576
@@ -XXX,XX +XXX,XX @@ static void object_class_init(ObjectClass *klass, void *data)
577
578
static void register_types(void)
55
{
579
{
56
- /* In 32bit endianness is determined by looking at CPSR's E bit */
580
- static TypeInfo interface_info = {
57
if (!is_a64(env)) {
581
+ static const TypeInfo interface_info = {
58
- return
582
.name = TYPE_INTERFACE,
59
-#ifdef CONFIG_USER_ONLY
583
.class_size = sizeof(InterfaceClass),
60
- /* In system mode, BE32 is modelled in line with the
584
.abstract = true,
61
- * architecture (as word-invariant big-endianness), where loads
585
};
62
- * and stores are done little endian but from addresses which
586
63
- * are adjusted by XORing with the appropriate constant. So the
587
- static TypeInfo object_info = {
64
- * endianness to use for the raw data access is not affected by
588
+ static const TypeInfo object_info = {
65
- * SCTLR.B.
589
.name = TYPE_OBJECT,
66
- * In user mode, however, we model BE32 as byte-invariant
590
.instance_size = sizeof(Object),
67
- * big-endianness (because user-only code cannot tell the
591
.class_init = object_class_init,
68
- * difference), and so we need to use a data access endianness
69
- * that depends on SCTLR.B.
70
- */
71
- arm_sctlr_b(env) ||
72
-#endif
73
- ((env->uncached_cpsr & CPSR_E) ? 1 : 0);
74
+ return arm_cpu_data_is_big_endian_a32(env, arm_sctlr_b(env));
75
} else {
76
int cur_el = arm_current_el(env);
77
uint64_t sctlr = arm_sctlr(env, cur_el);
78
-
79
- return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) != 0;
80
+ return arm_cpu_data_is_big_endian_a64(cur_el, sctlr);
81
}
82
}
83
84
diff --git a/target/arm/helper.c b/target/arm/helper.c
85
index XXXXXXX..XXXXXXX 100644
86
--- a/target/arm/helper.c
87
+++ b/target/arm/helper.c
88
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,
89
flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX,
90
arm_to_core_mmu_idx(mmu_idx));
91
92
- if (arm_cpu_data_is_big_endian(env)) {
93
- flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1);
94
- }
95
if (arm_singlestep_active(env)) {
96
flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1);
97
}
98
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,
99
static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el,
100
ARMMMUIdx mmu_idx, uint32_t flags)
101
{
102
- flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env));
103
+ bool sctlr_b = arm_sctlr_b(env);
104
+
105
+ if (sctlr_b) {
106
+ flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, 1);
107
+ }
108
+ if (arm_cpu_data_is_big_endian_a32(env, sctlr_b)) {
109
+ flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1);
110
+ }
111
flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env));
112
113
return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
114
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
115
116
sctlr = arm_sctlr(env, el);
117
118
+ if (arm_cpu_data_is_big_endian_a64(el, sctlr)) {
119
+ flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1);
120
+ }
121
+
122
if (cpu_isar_feature(aa64_pauth, env_archcpu(env))) {
123
/*
124
* In order to save space in flags, we record only whether
125
--
592
--
126
2.20.1
593
2.25.1
127
594
128
595
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
The SDRAM is incorrectly created in the OMAP310 SoC.
3
Now that all static TypeInfo instances are declared const, prevent that
4
Move its creation in the board code, this will later allow the
4
new non-const instances are created.
5
board to have the QOM ownership of the RAM.
6
5
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 20220117145805.173070-3-shentey@gmail.com
10
Message-id: 20191021190653.9511-6-philmd@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
10
---
13
include/hw/arm/omap.h | 6 ++----
11
scripts/checkpatch.pl | 1 +
14
hw/arm/omap1.c | 12 +++++-------
12
1 file changed, 1 insertion(+)
15
hw/arm/omap_sx1.c | 8 ++++++--
16
hw/arm/palm.c | 8 ++++++--
17
4 files changed, 19 insertions(+), 15 deletions(-)
18
13
19
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
14
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
20
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100755
21
--- a/include/hw/arm/omap.h
16
--- a/scripts/checkpatch.pl
22
+++ b/include/hw/arm/omap.h
17
+++ b/scripts/checkpatch.pl
23
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s {
18
@@ -XXX,XX +XXX,XX @@ sub process {
24
MemoryRegion mpui_io_iomem;
19
                SCSIBusInfo|
25
MemoryRegion tap_iomem;
20
                SCSIReqOps|
26
MemoryRegion imif_ram;
21
                Spice[A-Z][a-zA-Z0-9]*Interface|
27
- MemoryRegion emiff_ram;
22
+                TypeInfo|
28
MemoryRegion sram;
23
                USBDesc[A-Z][a-zA-Z0-9]*|
29
24
                VhostOps|
30
struct omap_dma_port_if_s {
25
                VMStateDescription|
31
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s {
32
hwaddr addr);
33
} port[__omap_dma_port_last];
34
35
- unsigned long sdram_size;
36
+ uint64_t sdram_size;
37
unsigned long sram_size;
38
39
/* MPUI-TIPB peripherals */
40
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s {
41
};
42
43
/* omap1.c */
44
-struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
45
- unsigned long sdram_size,
46
+struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *sdram,
47
const char *core);
48
49
/* omap2.c */
50
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/omap1.c
53
+++ b/hw/arm/omap1.c
54
@@ -XXX,XX +XXX,XX @@
55
#include "qapi/error.h"
56
#include "qemu-common.h"
57
#include "cpu.h"
58
+#include "exec/address-spaces.h"
59
#include "hw/boards.h"
60
#include "hw/hw.h"
61
#include "hw/irq.h"
62
@@ -XXX,XX +XXX,XX @@ static int omap_validate_tipb_mpui_addr(struct omap_mpu_state_s *s,
63
return range_covers_byte(0xe1010000, 0xe1020004 - 0xe1010000, addr);
64
}
65
66
-struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
67
- unsigned long sdram_size,
68
+struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
69
const char *cpu_type)
70
{
71
int i;
72
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
73
qemu_irq dma_irqs[6];
74
DriveInfo *dinfo;
75
SysBusDevice *busdev;
76
+ MemoryRegion *system_memory = get_system_memory();
77
78
/* Core */
79
s->mpu_model = omap310;
80
s->cpu = ARM_CPU(cpu_create(cpu_type));
81
- s->sdram_size = sdram_size;
82
+ s->sdram_size = memory_region_size(dram);
83
s->sram_size = OMAP15XX_SRAM_SIZE;
84
85
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
86
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
87
omap_clk_init(s);
88
89
/* Memory-mapped stuff */
90
- memory_region_allocate_system_memory(&s->emiff_ram, NULL, "omap1.dram",
91
- s->sdram_size);
92
- memory_region_add_subregion(system_memory, OMAP_EMIFF_BASE, &s->emiff_ram);
93
memory_region_init_ram(&s->imif_ram, NULL, "omap1.sram", s->sram_size,
94
&error_fatal);
95
memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram);
96
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
97
s->port[tipb_mpui].addr_valid = omap_validate_tipb_mpui_addr;
98
99
/* Register SDRAM and SRAM DMA ports for fast transfers. */
100
- soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->emiff_ram),
101
+ soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(dram),
102
OMAP_EMIFF_BASE, s->sdram_size);
103
soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->imif_ram),
104
OMAP_IMIF_BASE, s->sram_size);
105
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/hw/arm/omap_sx1.c
108
+++ b/hw/arm/omap_sx1.c
109
@@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version)
110
{
111
struct omap_mpu_state_s *mpu;
112
MemoryRegion *address_space = get_system_memory();
113
+ MemoryRegion *dram = g_new(MemoryRegion, 1);
114
MemoryRegion *flash = g_new(MemoryRegion, 1);
115
MemoryRegion *cs = g_new(MemoryRegion, 4);
116
static uint32_t cs0val = 0x00213090;
117
@@ -XXX,XX +XXX,XX @@ static void sx1_init(MachineState *machine, const int version)
118
flash_size = flash2_size;
119
}
120
121
- mpu = omap310_mpu_init(address_space, sx1_binfo.ram_size,
122
- machine->cpu_type);
123
+ memory_region_allocate_system_memory(dram, NULL, "omap1.dram",
124
+ sx1_binfo.ram_size);
125
+ memory_region_add_subregion(address_space, OMAP_EMIFF_BASE, dram);
126
+
127
+ mpu = omap310_mpu_init(dram, machine->cpu_type);
128
129
/* External Flash (EMIFS) */
130
memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size,
131
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
132
index XXXXXXX..XXXXXXX 100644
133
--- a/hw/arm/palm.c
134
+++ b/hw/arm/palm.c
135
@@ -XXX,XX +XXX,XX @@ static void palmte_init(MachineState *machine)
136
MemoryRegion *address_space_mem = get_system_memory();
137
struct omap_mpu_state_s *mpu;
138
int flash_size = 0x00800000;
139
- int sdram_size = palmte_binfo.ram_size;
140
static uint32_t cs0val = 0xffffffff;
141
static uint32_t cs1val = 0x0000e1a0;
142
static uint32_t cs2val = 0x0000e1a0;
143
static uint32_t cs3val = 0xe1a0e1a0;
144
int rom_size, rom_loaded = 0;
145
+ MemoryRegion *dram = g_new(MemoryRegion, 1);
146
MemoryRegion *flash = g_new(MemoryRegion, 1);
147
MemoryRegion *cs = g_new(MemoryRegion, 4);
148
149
- mpu = omap310_mpu_init(address_space_mem, sdram_size, machine->cpu_type);
150
+ memory_region_allocate_system_memory(dram, NULL, "omap1.dram",
151
+ palmte_binfo.ram_size);
152
+ memory_region_add_subregion(address_space_mem, OMAP_EMIFF_BASE, dram);
153
+
154
+ mpu = omap310_mpu_init(dram, machine->cpu_type);
155
156
/* External Flash (EMIFS) */
157
memory_region_init_ram(flash, NULL, "palmte.flash", flash_size,
158
--
26
--
159
2.20.1
27
2.25.1
160
28
161
29
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Now that KVM has dropped AArch32 host support, the 'host' CPU type is
2
always AArch64, and we can move it to cpu64.c. This move will allow
3
us to share code between it and '-cpu max', which should behave
4
the same as '-cpu host' when using KVM or HVF.
2
5
3
Begin setting, but not relying upon, env->hflags.
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Alexander Graf <agraf@csgraf.de>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20220204165506.2846058-2-peter.maydell@linaro.org
12
---
13
target/arm/cpu.c | 30 ------------------------------
14
target/arm/cpu64.c | 30 ++++++++++++++++++++++++++++++
15
2 files changed, 30 insertions(+), 30 deletions(-)
4
16
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20191018174431.1784-17-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
linux-user/syscall.c | 1 +
11
target/arm/cpu.c | 1 +
12
target/arm/helper-a64.c | 3 +++
13
target/arm/helper.c | 2 ++
14
target/arm/machine.c | 1 +
15
target/arm/op_helper.c | 1 +
16
6 files changed, 9 insertions(+)
17
18
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/linux-user/syscall.c
21
+++ b/linux-user/syscall.c
22
@@ -XXX,XX +XXX,XX @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
23
aarch64_sve_narrow_vq(env, vq);
24
}
25
env->vfp.zcr_el[1] = vq - 1;
26
+ arm_rebuild_hflags(env);
27
ret = vq * 16;
28
}
29
return ret;
30
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
17
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
31
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/cpu.c
19
--- a/target/arm/cpu.c
33
+++ b/target/arm/cpu.c
20
+++ b/target/arm/cpu.c
34
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
21
@@ -XXX,XX +XXX,XX @@
35
22
#include "sysemu/tcg.h"
36
hw_breakpoint_update_all(cpu);
23
#include "sysemu/hw_accel.h"
37
hw_watchpoint_update_all(cpu);
24
#include "kvm_arm.h"
38
+ arm_rebuild_hflags(env);
25
-#include "hvf_arm.h"
26
#include "disas/capstone.h"
27
#include "fpu/softfloat.h"
28
29
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
30
#endif /* CONFIG_TCG */
39
}
31
}
40
32
41
bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
33
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
42
diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c
34
-static void arm_host_initfn(Object *obj)
35
-{
36
- ARMCPU *cpu = ARM_CPU(obj);
37
-
38
-#ifdef CONFIG_KVM
39
- kvm_arm_set_cpu_features_from_host(cpu);
40
- if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
41
- aarch64_add_sve_properties(obj);
42
- aarch64_add_pauth_properties(obj);
43
- }
44
-#else
45
- hvf_arm_set_cpu_features_from_host(cpu);
46
-#endif
47
- arm_cpu_post_init(obj);
48
-}
49
-
50
-static const TypeInfo host_arm_cpu_type_info = {
51
- .name = TYPE_ARM_HOST_CPU,
52
- .parent = TYPE_AARCH64_CPU,
53
- .instance_init = arm_host_initfn,
54
-};
55
-
56
-#endif
57
-
58
static void arm_cpu_instance_init(Object *obj)
59
{
60
ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj);
61
@@ -XXX,XX +XXX,XX @@ static const TypeInfo arm_cpu_type_info = {
62
static void arm_cpu_register_types(void)
63
{
64
type_register_static(&arm_cpu_type_info);
65
-
66
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
67
- type_register_static(&host_arm_cpu_type_info);
68
-#endif
69
}
70
71
type_init(arm_cpu_register_types)
72
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
43
index XXXXXXX..XXXXXXX 100644
73
index XXXXXXX..XXXXXXX 100644
44
--- a/target/arm/helper-a64.c
74
--- a/target/arm/cpu64.c
45
+++ b/target/arm/helper-a64.c
75
+++ b/target/arm/cpu64.c
46
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
76
@@ -XXX,XX +XXX,XX @@
47
} else {
77
#endif
48
env->regs[15] = new_pc & ~0x3;
78
#include "sysemu/kvm.h"
49
}
79
#include "kvm_arm.h"
50
+ helper_rebuild_hflags_a32(env, new_el);
80
+#include "hvf_arm.h"
51
qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to "
81
#include "qapi/visitor.h"
52
"AArch32 EL%d PC 0x%" PRIx32 "\n",
82
#include "hw/qdev-properties.h"
53
cur_el, new_el, env->regs[15]);
83
54
@@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
84
@@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj)
55
}
85
}
56
aarch64_restore_sp(env, new_el);
86
}
57
env->pc = new_pc;
87
58
+ helper_rebuild_hflags_a64(env, new_el);
88
+#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
59
qemu_log_mask(CPU_LOG_INT, "Exception return from AArch64 EL%d to "
89
+static void arm_host_initfn(Object *obj)
60
"AArch64 EL%d PC 0x%" PRIx64 "\n",
90
+{
61
cur_el, new_el, env->pc);
91
+ ARMCPU *cpu = ARM_CPU(obj);
92
+
93
+#ifdef CONFIG_KVM
94
+ kvm_arm_set_cpu_features_from_host(cpu);
95
+ if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
96
+ aarch64_add_sve_properties(obj);
97
+ aarch64_add_pauth_properties(obj);
98
+ }
99
+#else
100
+ hvf_arm_set_cpu_features_from_host(cpu);
101
+#endif
102
+ arm_cpu_post_init(obj);
103
+}
104
+
105
+static const TypeInfo host_arm_cpu_type_info = {
106
+ .name = TYPE_ARM_HOST_CPU,
107
+ .parent = TYPE_AARCH64_CPU,
108
+ .instance_init = arm_host_initfn,
109
+};
110
+
111
+#endif
112
+
113
/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
114
* otherwise, a CPU with as many features enabled as our emulation supports.
115
* The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
116
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_register_types(void)
117
for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) {
118
aarch64_cpu_register(&aarch64_cpus[i]);
62
}
119
}
63
+
120
+
64
/*
121
+#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
65
* Note that cur_el can never be 0. If new_el is 0, then
122
+ type_register_static(&host_arm_cpu_type_info);
66
* el0_a64 is return_to_aa64, else el0_a64 is ignored.
123
+#endif
67
diff --git a/target/arm/helper.c b/target/arm/helper.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/target/arm/helper.c
70
+++ b/target/arm/helper.c
71
@@ -XXX,XX +XXX,XX @@ static void take_aarch32_exception(CPUARMState *env, int new_mode,
72
env->regs[14] = env->regs[15] + offset;
73
}
74
env->regs[15] = newpc;
75
+ arm_rebuild_hflags(env);
76
}
124
}
77
125
78
static void arm_cpu_do_interrupt_aarch32_hyp(CPUState *cs)
126
type_init(aarch64_cpu_register_types)
79
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
80
pstate_write(env, PSTATE_DAIF | new_mode);
81
env->aarch64 = 1;
82
aarch64_restore_sp(env, new_el);
83
+ helper_rebuild_hflags_a64(env, new_el);
84
85
env->pc = addr;
86
87
diff --git a/target/arm/machine.c b/target/arm/machine.c
88
index XXXXXXX..XXXXXXX 100644
89
--- a/target/arm/machine.c
90
+++ b/target/arm/machine.c
91
@@ -XXX,XX +XXX,XX @@ static int cpu_post_load(void *opaque, int version_id)
92
if (!kvm_enabled()) {
93
pmu_op_finish(&cpu->env);
94
}
95
+ arm_rebuild_hflags(&cpu->env);
96
97
return 0;
98
}
99
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
100
index XXXXXXX..XXXXXXX 100644
101
--- a/target/arm/op_helper.c
102
+++ b/target/arm/op_helper.c
103
@@ -XXX,XX +XXX,XX @@ void HELPER(cpsr_write_eret)(CPUARMState *env, uint32_t val)
104
* state. Do the masking now.
105
*/
106
env->regs[15] &= (env->thumb ? ~1 : ~3);
107
+ arm_rebuild_hflags(env);
108
109
qemu_mutex_lock_iothread();
110
arm_call_el_change_hook(env_archcpu(env));
111
--
127
--
112
2.20.1
128
2.25.1
113
129
114
130
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Use the aarch64_cpu_register() machinery to register the 'host' CPU
2
type. This doesn't gain us anything functionally, but it does mean
3
that the code for initializing it looks more like that for the other
4
CPU types, in that its initfn then doesn't need to call
5
arm_cpu_post_init() (because aarch64_cpu_instance_init() does that
6
for it).
2
7
3
The Linux kernel access few S3C-specific registers [1] to set some
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
clock. We don't care about this part for device emulation [2]. Add
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
a dummy device to properly ignore these accesses, so we can focus
10
Reviewed-by: Andrew Jones <drjones@redhat.com>
6
on the important registers missing.
11
Reviewed-by: Alexander Graf <agraf@csgraf.de>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20220204165506.2846058-3-peter.maydell@linaro.org
14
---
15
target/arm/cpu64.c | 17 ++++-------------
16
1 file changed, 4 insertions(+), 13 deletions(-)
7
17
8
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/sdhci-s3c-regs.h?h=cc014f3
18
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/sdhci-s3c.c?h=v5.3#n263
10
11
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
13
Message-id: 20191005154748.21718-4-f4bug@amsat.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
include/hw/sd/sdhci.h | 2 ++
17
hw/sd/sdhci.c | 65 +++++++++++++++++++++++++++++++++++++++++++
18
2 files changed, 67 insertions(+)
19
20
diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
21
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/sd/sdhci.h
20
--- a/target/arm/cpu64.c
23
+++ b/include/hw/sd/sdhci.h
21
+++ b/target/arm/cpu64.c
24
@@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState {
22
@@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj)
25
23
}
26
#define TYPE_IMX_USDHC "imx-usdhc"
24
27
25
#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
28
+#define TYPE_S3C_SDHCI "s3c-sdhci"
26
-static void arm_host_initfn(Object *obj)
29
+
27
+static void aarch64_host_initfn(Object *obj)
30
#endif /* SDHCI_H */
28
{
31
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
29
ARMCPU *cpu = ARM_CPU(obj);
32
index XXXXXXX..XXXXXXX 100644
30
33
--- a/hw/sd/sdhci.c
31
@@ -XXX,XX +XXX,XX @@ static void arm_host_initfn(Object *obj)
34
+++ b/hw/sd/sdhci.c
32
#else
35
@@ -XXX,XX +XXX,XX @@ static const TypeInfo imx_usdhc_info = {
33
hvf_arm_set_cpu_features_from_host(cpu);
36
.instance_init = imx_usdhc_init,
34
#endif
35
- arm_cpu_post_init(obj);
36
}
37
-
38
-static const TypeInfo host_arm_cpu_type_info = {
39
- .name = TYPE_ARM_HOST_CPU,
40
- .parent = TYPE_AARCH64_CPU,
41
- .instance_init = arm_host_initfn,
42
-};
43
-
44
#endif
45
46
/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
47
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = {
48
{ .name = "cortex-a72", .initfn = aarch64_a72_initfn },
49
{ .name = "a64fx", .initfn = aarch64_a64fx_initfn },
50
{ .name = "max", .initfn = aarch64_max_initfn },
51
+#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
52
+ { .name = "host", .initfn = aarch64_host_initfn },
53
+#endif
37
};
54
};
38
55
39
+/* --- qdev Samsung s3c --- */
56
static bool aarch64_cpu_get_aarch64(Object *obj, Error **errp)
40
+
57
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_register_types(void)
41
+#define S3C_SDHCI_CONTROL2 0x80
58
for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) {
42
+#define S3C_SDHCI_CONTROL3 0x84
59
aarch64_cpu_register(&aarch64_cpus[i]);
43
+#define S3C_SDHCI_CONTROL4 0x8c
60
}
44
+
61
-
45
+static uint64_t sdhci_s3c_read(void *opaque, hwaddr offset, unsigned size)
62
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
46
+{
63
- type_register_static(&host_arm_cpu_type_info);
47
+ uint64_t ret;
64
-#endif
48
+
49
+ switch (offset) {
50
+ case S3C_SDHCI_CONTROL2:
51
+ case S3C_SDHCI_CONTROL3:
52
+ case S3C_SDHCI_CONTROL4:
53
+ /* ignore */
54
+ ret = 0;
55
+ break;
56
+ default:
57
+ ret = sdhci_read(opaque, offset, size);
58
+ break;
59
+ }
60
+
61
+ return ret;
62
+}
63
+
64
+static void sdhci_s3c_write(void *opaque, hwaddr offset, uint64_t val,
65
+ unsigned size)
66
+{
67
+ switch (offset) {
68
+ case S3C_SDHCI_CONTROL2:
69
+ case S3C_SDHCI_CONTROL3:
70
+ case S3C_SDHCI_CONTROL4:
71
+ /* ignore */
72
+ break;
73
+ default:
74
+ sdhci_write(opaque, offset, val, size);
75
+ break;
76
+ }
77
+}
78
+
79
+static const MemoryRegionOps sdhci_s3c_mmio_ops = {
80
+ .read = sdhci_s3c_read,
81
+ .write = sdhci_s3c_write,
82
+ .valid = {
83
+ .min_access_size = 1,
84
+ .max_access_size = 4,
85
+ .unaligned = false
86
+ },
87
+ .endianness = DEVICE_LITTLE_ENDIAN,
88
+};
89
+
90
+static void sdhci_s3c_init(Object *obj)
91
+{
92
+ SDHCIState *s = SYSBUS_SDHCI(obj);
93
+
94
+ s->io_ops = &sdhci_s3c_mmio_ops;
95
+}
96
+
97
+static const TypeInfo sdhci_s3c_info = {
98
+ .name = TYPE_S3C_SDHCI ,
99
+ .parent = TYPE_SYSBUS_SDHCI,
100
+ .instance_init = sdhci_s3c_init,
101
+};
102
+
103
static void sdhci_register_types(void)
104
{
105
type_register_static(&sdhci_sysbus_info);
106
type_register_static(&sdhci_bus_info);
107
type_register_static(&imx_usdhc_info);
108
+ type_register_static(&sdhci_s3c_info);
109
}
65
}
110
66
111
type_init(sdhci_register_types)
67
type_init(aarch64_cpu_register_types)
112
--
68
--
113
2.20.1
69
2.25.1
114
70
115
71
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Currently for KVM the intention is that '-cpu max' and '-cpu host'
2
are the same thing, but because we did this with two separate
3
pieces of code they have got a little bit out of sync. Specifically,
4
'max' has a 'sve-max-vq' property, and 'host' does not.
2
5
3
This file keeps the various QDev blocks separated by comments.
6
Bring the two together by having the initfn for 'max' actually
7
call the initfn for 'host'. This will result in 'max' no longer
8
exposing the 'sve-max-vq' property when using KVM.
4
9
5
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Cleber Rosa <crosa@redhat.com>
7
Message-id: 20191005154748.21718-3-f4bug@amsat.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: Alexander Graf <agraf@csgraf.de>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20220204165506.2846058-4-peter.maydell@linaro.org
9
---
16
---
10
hw/sd/sdhci.c | 3 ++-
17
target/arm/cpu64.c | 14 ++++++++------
11
1 file changed, 2 insertions(+), 1 deletion(-)
18
1 file changed, 8 insertions(+), 6 deletions(-)
12
19
13
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
20
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/sd/sdhci.c
22
--- a/target/arm/cpu64.c
16
+++ b/hw/sd/sdhci.c
23
+++ b/target/arm/cpu64.c
17
@@ -XXX,XX +XXX,XX @@ static const TypeInfo sdhci_bus_info = {
24
@@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj)
18
.class_init = sdhci_bus_class_init,
19
};
20
21
+/* --- qdev i.MX eSDHC --- */
22
+
23
static uint64_t usdhc_read(void *opaque, hwaddr offset, unsigned size)
24
{
25
SDHCIState *s = SYSBUS_SDHCI(opaque);
26
@@ -XXX,XX +XXX,XX @@ usdhc_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
27
}
25
}
28
}
26
}
29
27
28
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
29
static void aarch64_host_initfn(Object *obj)
30
{
31
+#if defined(CONFIG_KVM)
32
ARMCPU *cpu = ARM_CPU(obj);
30
-
33
-
31
static const MemoryRegionOps usdhc_mmio_ops = {
34
-#ifdef CONFIG_KVM
32
.read = usdhc_read,
35
kvm_arm_set_cpu_features_from_host(cpu);
33
.write = usdhc_write,
36
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
37
aarch64_add_sve_properties(obj);
38
aarch64_add_pauth_properties(obj);
39
}
40
-#else
41
+#elif defined(CONFIG_HVF)
42
+ ARMCPU *cpu = ARM_CPU(obj);
43
hvf_arm_set_cpu_features_from_host(cpu);
44
+#else
45
+ g_assert_not_reached();
46
#endif
47
}
48
-#endif
49
50
/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
51
* otherwise, a CPU with as many features enabled as our emulation supports.
52
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
53
ARMCPU *cpu = ARM_CPU(obj);
54
55
if (kvm_enabled()) {
56
- kvm_arm_set_cpu_features_from_host(cpu);
57
+ /* With KVM, '-cpu max' is identical to '-cpu host' */
58
+ aarch64_host_initfn(obj);
59
+ return;
60
} else {
61
uint64_t t;
62
uint32_t u;
34
--
63
--
35
2.20.1
64
2.25.1
36
65
37
66
diff view generated by jsdifflib
1
Switch the sh_timer code away from bottom-half based ptimers to the
1
Now that the if() branch of the condition in aarch64_max_initfn()
2
new transaction-based ptimer API. This just requires adding
2
returns early, we don't need to keep the rest of the code in
3
begin/commit calls around the various places that modify the ptimer
3
the function inside an else block. Remove the else, unindenting
4
state, and using the new ptimer_init() function to create the timer.
4
that code.
5
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Alexander Graf <agraf@csgraf.de>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20220204165506.2846058-5-peter.maydell@linaro.org
9
Message-id: 20191017132905.5604-3-peter.maydell@linaro.org
10
---
12
---
11
hw/timer/sh_timer.c | 13 +++++++++----
13
target/arm/cpu64.c | 289 +++++++++++++++++++++++----------------------
12
1 file changed, 9 insertions(+), 4 deletions(-)
14
1 file changed, 146 insertions(+), 143 deletions(-)
13
15
14
diff --git a/hw/timer/sh_timer.c b/hw/timer/sh_timer.c
16
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/timer/sh_timer.c
18
--- a/target/arm/cpu64.c
17
+++ b/hw/timer/sh_timer.c
19
+++ b/target/arm/cpu64.c
18
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj)
19
#include "hw/irq.h"
21
static void aarch64_max_initfn(Object *obj)
20
#include "hw/sh4/sh.h"
22
{
21
#include "qemu/timer.h"
23
ARMCPU *cpu = ARM_CPU(obj);
22
-#include "qemu/main-loop.h"
24
+ uint64_t t;
23
#include "hw/ptimer.h"
25
+ uint32_t u;
24
26
25
//#define DEBUG_TIMER
27
if (kvm_enabled()) {
26
@@ -XXX,XX +XXX,XX @@ static void sh_timer_write(void *opaque, hwaddr offset,
28
/* With KVM, '-cpu max' is identical to '-cpu host' */
27
switch (offset >> 2) {
29
aarch64_host_initfn(obj);
28
case OFFSET_TCOR:
30
return;
29
s->tcor = value;
31
- } else {
30
+ ptimer_transaction_begin(s->timer);
32
- uint64_t t;
31
ptimer_set_limit(s->timer, s->tcor, 0);
33
- uint32_t u;
32
+ ptimer_transaction_commit(s->timer);
34
- aarch64_a57_initfn(obj);
33
break;
35
+ }
34
case OFFSET_TCNT:
36
35
s->tcnt = value;
37
- /*
36
+ ptimer_transaction_begin(s->timer);
38
- * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real
37
ptimer_set_count(s->timer, s->tcnt);
39
- * one and try to apply errata workarounds or use impdef features we
38
+ ptimer_transaction_commit(s->timer);
40
- * don't provide.
39
break;
41
- * An IMPLEMENTER field of 0 means "reserved for software use";
40
case OFFSET_TCR:
42
- * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers
41
+ ptimer_transaction_begin(s->timer);
43
- * to see which features are present";
42
if (s->enabled) {
44
- * the VARIANT, PARTNUM and REVISION fields are all implementation
43
/* Pause the timer if it is running. This may cause some
45
- * defined and we choose to define PARTNUM just in case guest
44
inaccuracy dure to rounding, but avoids a whole lot of other
46
- * code needs to distinguish this QEMU CPU from other software
45
@@ -XXX,XX +XXX,XX @@ static void sh_timer_write(void *opaque, hwaddr offset,
47
- * implementations, though this shouldn't be needed.
46
/* Restart the timer if still enabled. */
48
- */
47
ptimer_run(s->timer, 0);
49
- t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0);
48
}
50
- t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf);
49
+ ptimer_transaction_commit(s->timer);
51
- t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q');
50
break;
52
- t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0);
51
case OFFSET_TCPR:
53
- t = FIELD_DP64(t, MIDR_EL1, REVISION, 0);
52
if (s->feat & TIMER_FEAT_CAPT) {
54
- cpu->midr = t;
53
@@ -XXX,XX +XXX,XX @@ static void sh_timer_start_stop(void *opaque, int enable)
55
+ /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
54
printf("sh_timer_start_stop %d (%d)\n", enable, s->enabled);
56
57
- t = cpu->isar.id_aa64isar0;
58
- t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */
59
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1);
60
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */
61
- t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1);
62
- t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2);
63
- t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1);
64
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1);
65
- t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1);
66
- t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1);
67
- t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1);
68
- t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1);
69
- t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */
70
- t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
71
- t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1);
72
- cpu->isar.id_aa64isar0 = t;
73
+ aarch64_a57_initfn(obj);
74
75
- t = cpu->isar.id_aa64isar1;
76
- t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2);
77
- t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1);
78
- t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1);
79
- t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
80
- t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
81
- t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1);
82
- t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
83
- t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */
84
- t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1);
85
- cpu->isar.id_aa64isar1 = t;
86
+ /*
87
+ * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real
88
+ * one and try to apply errata workarounds or use impdef features we
89
+ * don't provide.
90
+ * An IMPLEMENTER field of 0 means "reserved for software use";
91
+ * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers
92
+ * to see which features are present";
93
+ * the VARIANT, PARTNUM and REVISION fields are all implementation
94
+ * defined and we choose to define PARTNUM just in case guest
95
+ * code needs to distinguish this QEMU CPU from other software
96
+ * implementations, though this shouldn't be needed.
97
+ */
98
+ t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0);
99
+ t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf);
100
+ t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q');
101
+ t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0);
102
+ t = FIELD_DP64(t, MIDR_EL1, REVISION, 0);
103
+ cpu->midr = t;
104
105
- t = cpu->isar.id_aa64pfr0;
106
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
107
- t = FIELD_DP64(t, ID_AA64PFR0, FP, 1);
108
- t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
109
- t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1);
110
- t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1);
111
- cpu->isar.id_aa64pfr0 = t;
112
+ t = cpu->isar.id_aa64isar0;
113
+ t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */
114
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1);
115
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */
116
+ t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1);
117
+ t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2);
118
+ t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1);
119
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1);
120
+ t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1);
121
+ t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1);
122
+ t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1);
123
+ t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1);
124
+ t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */
125
+ t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
126
+ t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1);
127
+ cpu->isar.id_aa64isar0 = t;
128
129
- t = cpu->isar.id_aa64pfr1;
130
- t = FIELD_DP64(t, ID_AA64PFR1, BT, 1);
131
- t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2);
132
- /*
133
- * Begin with full support for MTE. This will be downgraded to MTE=0
134
- * during realize if the board provides no tag memory, much like
135
- * we do for EL2 with the virtualization=on property.
136
- */
137
- t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3);
138
- cpu->isar.id_aa64pfr1 = t;
139
+ t = cpu->isar.id_aa64isar1;
140
+ t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2);
141
+ t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1);
142
+ t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1);
143
+ t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
144
+ t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
145
+ t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1);
146
+ t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
147
+ t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */
148
+ t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1);
149
+ cpu->isar.id_aa64isar1 = t;
150
151
- t = cpu->isar.id_aa64mmfr0;
152
- t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */
153
- cpu->isar.id_aa64mmfr0 = t;
154
+ t = cpu->isar.id_aa64pfr0;
155
+ t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
156
+ t = FIELD_DP64(t, ID_AA64PFR0, FP, 1);
157
+ t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
158
+ t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1);
159
+ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1);
160
+ cpu->isar.id_aa64pfr0 = t;
161
162
- t = cpu->isar.id_aa64mmfr1;
163
- t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
164
- t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1);
165
- t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
166
- t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
167
- t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
168
- t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
169
- cpu->isar.id_aa64mmfr1 = t;
170
+ t = cpu->isar.id_aa64pfr1;
171
+ t = FIELD_DP64(t, ID_AA64PFR1, BT, 1);
172
+ t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2);
173
+ /*
174
+ * Begin with full support for MTE. This will be downgraded to MTE=0
175
+ * during realize if the board provides no tag memory, much like
176
+ * we do for EL2 with the virtualization=on property.
177
+ */
178
+ t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3);
179
+ cpu->isar.id_aa64pfr1 = t;
180
181
- t = cpu->isar.id_aa64mmfr2;
182
- t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1);
183
- t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */
184
- t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */
185
- cpu->isar.id_aa64mmfr2 = t;
186
+ t = cpu->isar.id_aa64mmfr0;
187
+ t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */
188
+ cpu->isar.id_aa64mmfr0 = t;
189
190
- t = cpu->isar.id_aa64zfr0;
191
- t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1);
192
- t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */
193
- t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1);
194
- t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1);
195
- t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1);
196
- t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1);
197
- t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1);
198
- t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1);
199
- t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1);
200
- cpu->isar.id_aa64zfr0 = t;
201
+ t = cpu->isar.id_aa64mmfr1;
202
+ t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
203
+ t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1);
204
+ t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
205
+ t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
206
+ t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
207
+ t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
208
+ cpu->isar.id_aa64mmfr1 = t;
209
210
- /* Replicate the same data to the 32-bit id registers. */
211
- u = cpu->isar.id_isar5;
212
- u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
213
- u = FIELD_DP32(u, ID_ISAR5, SHA1, 1);
214
- u = FIELD_DP32(u, ID_ISAR5, SHA2, 1);
215
- u = FIELD_DP32(u, ID_ISAR5, CRC32, 1);
216
- u = FIELD_DP32(u, ID_ISAR5, RDM, 1);
217
- u = FIELD_DP32(u, ID_ISAR5, VCMA, 1);
218
- cpu->isar.id_isar5 = u;
219
+ t = cpu->isar.id_aa64mmfr2;
220
+ t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1);
221
+ t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */
222
+ t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */
223
+ cpu->isar.id_aa64mmfr2 = t;
224
225
- u = cpu->isar.id_isar6;
226
- u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1);
227
- u = FIELD_DP32(u, ID_ISAR6, DP, 1);
228
- u = FIELD_DP32(u, ID_ISAR6, FHM, 1);
229
- u = FIELD_DP32(u, ID_ISAR6, SB, 1);
230
- u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1);
231
- u = FIELD_DP32(u, ID_ISAR6, BF16, 1);
232
- u = FIELD_DP32(u, ID_ISAR6, I8MM, 1);
233
- cpu->isar.id_isar6 = u;
234
+ t = cpu->isar.id_aa64zfr0;
235
+ t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1);
236
+ t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */
237
+ t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1);
238
+ t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1);
239
+ t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1);
240
+ t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1);
241
+ t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1);
242
+ t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1);
243
+ t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1);
244
+ cpu->isar.id_aa64zfr0 = t;
245
246
- u = cpu->isar.id_pfr0;
247
- u = FIELD_DP32(u, ID_PFR0, DIT, 1);
248
- cpu->isar.id_pfr0 = u;
249
+ /* Replicate the same data to the 32-bit id registers. */
250
+ u = cpu->isar.id_isar5;
251
+ u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
252
+ u = FIELD_DP32(u, ID_ISAR5, SHA1, 1);
253
+ u = FIELD_DP32(u, ID_ISAR5, SHA2, 1);
254
+ u = FIELD_DP32(u, ID_ISAR5, CRC32, 1);
255
+ u = FIELD_DP32(u, ID_ISAR5, RDM, 1);
256
+ u = FIELD_DP32(u, ID_ISAR5, VCMA, 1);
257
+ cpu->isar.id_isar5 = u;
258
259
- u = cpu->isar.id_pfr2;
260
- u = FIELD_DP32(u, ID_PFR2, SSBS, 1);
261
- cpu->isar.id_pfr2 = u;
262
+ u = cpu->isar.id_isar6;
263
+ u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1);
264
+ u = FIELD_DP32(u, ID_ISAR6, DP, 1);
265
+ u = FIELD_DP32(u, ID_ISAR6, FHM, 1);
266
+ u = FIELD_DP32(u, ID_ISAR6, SB, 1);
267
+ u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1);
268
+ u = FIELD_DP32(u, ID_ISAR6, BF16, 1);
269
+ u = FIELD_DP32(u, ID_ISAR6, I8MM, 1);
270
+ cpu->isar.id_isar6 = u;
271
272
- u = cpu->isar.id_mmfr3;
273
- u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */
274
- cpu->isar.id_mmfr3 = u;
275
+ u = cpu->isar.id_pfr0;
276
+ u = FIELD_DP32(u, ID_PFR0, DIT, 1);
277
+ cpu->isar.id_pfr0 = u;
278
279
- u = cpu->isar.id_mmfr4;
280
- u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
281
- u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
282
- u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
283
- u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
284
- cpu->isar.id_mmfr4 = u;
285
+ u = cpu->isar.id_pfr2;
286
+ u = FIELD_DP32(u, ID_PFR2, SSBS, 1);
287
+ cpu->isar.id_pfr2 = u;
288
289
- t = cpu->isar.id_aa64dfr0;
290
- t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
291
- cpu->isar.id_aa64dfr0 = t;
292
+ u = cpu->isar.id_mmfr3;
293
+ u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */
294
+ cpu->isar.id_mmfr3 = u;
295
296
- u = cpu->isar.id_dfr0;
297
- u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
298
- cpu->isar.id_dfr0 = u;
299
+ u = cpu->isar.id_mmfr4;
300
+ u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
301
+ u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
302
+ u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
303
+ u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
304
+ cpu->isar.id_mmfr4 = u;
305
306
- u = cpu->isar.mvfr1;
307
- u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */
308
- u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
309
- cpu->isar.mvfr1 = u;
310
+ t = cpu->isar.id_aa64dfr0;
311
+ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
312
+ cpu->isar.id_aa64dfr0 = t;
313
+
314
+ u = cpu->isar.id_dfr0;
315
+ u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
316
+ cpu->isar.id_dfr0 = u;
317
+
318
+ u = cpu->isar.mvfr1;
319
+ u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */
320
+ u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
321
+ cpu->isar.mvfr1 = u;
322
323
#ifdef CONFIG_USER_ONLY
324
- /* For usermode -cpu max we can use a larger and more efficient DCZ
325
- * blocksize since we don't have to follow what the hardware does.
326
- */
327
- cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
328
- cpu->dcz_blocksize = 7; /* 512 bytes */
329
+ /*
330
+ * For usermode -cpu max we can use a larger and more efficient DCZ
331
+ * blocksize since we don't have to follow what the hardware does.
332
+ */
333
+ cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
334
+ cpu->dcz_blocksize = 7; /* 512 bytes */
55
#endif
335
#endif
56
336
57
+ ptimer_transaction_begin(s->timer);
337
- bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ);
58
if (s->enabled && !enable) {
338
- }
59
ptimer_stop(s->timer);
339
+ bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ);
60
}
340
61
if (!s->enabled && enable) {
341
aarch64_add_pauth_properties(obj);
62
ptimer_run(s->timer, 0);
342
aarch64_add_sve_properties(obj);
63
}
64
+ ptimer_transaction_commit(s->timer);
65
s->enabled = !!enable;
66
67
#ifdef DEBUG_TIMER
68
@@ -XXX,XX +XXX,XX @@ static void sh_timer_tick(void *opaque)
69
static void *sh_timer_init(uint32_t freq, int feat, qemu_irq irq)
70
{
71
sh_timer_state *s;
72
- QEMUBH *bh;
73
74
s = (sh_timer_state *)g_malloc0(sizeof(sh_timer_state));
75
s->freq = freq;
76
@@ -XXX,XX +XXX,XX @@ static void *sh_timer_init(uint32_t freq, int feat, qemu_irq irq)
77
s->enabled = 0;
78
s->irq = irq;
79
80
- bh = qemu_bh_new(sh_timer_tick, s);
81
- s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT);
82
+ s->timer = ptimer_init(sh_timer_tick, s, PTIMER_POLICY_DEFAULT);
83
84
sh_timer_write(s, OFFSET_TCOR >> 2, s->tcor);
85
sh_timer_write(s, OFFSET_TCNT >> 2, s->tcnt);
86
--
343
--
87
2.20.1
344
2.25.1
88
345
89
346
diff view generated by jsdifflib
1
Switch the altera_timer code away from bottom-half based ptimers to
1
Currently when using hvf we mishandle '-cpu max': we fall through to
2
the new transaction-based ptimer API. This just requires adding
2
the TCG version of its initfn, which then sets a lot of feature bits
3
begin/commit calls around the various places that modify the ptimer
3
that the real host CPU doesn't have. The hvf accelerator code then
4
state, and using the new ptimer_init() function to create the timer.
4
exposes these bogus ID register values to the guest because it
5
doesn't check that the host really has the features.
6
7
Make '-cpu host' be like '-cpu max' for hvf, as we do with kvm.
5
8
6
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: Andrew Jones <drjones@redhat.com>
12
Reviewed-by: Alexander Graf <agraf@csgraf.de>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Message-id: 20220204165506.2846058-6-peter.maydell@linaro.org
9
Message-id: 20191017132905.5604-6-peter.maydell@linaro.org
10
---
15
---
11
hw/timer/altera_timer.c | 13 +++++++++----
16
target/arm/cpu64.c | 5 +++--
12
1 file changed, 9 insertions(+), 4 deletions(-)
17
1 file changed, 3 insertions(+), 2 deletions(-)
13
18
14
diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c
19
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/timer/altera_timer.c
21
--- a/target/arm/cpu64.c
17
+++ b/hw/timer/altera_timer.c
22
+++ b/target/arm/cpu64.c
18
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@
19
*/
24
#include "hw/loader.h"
20
25
#endif
21
#include "qemu/osdep.h"
26
#include "sysemu/kvm.h"
22
-#include "qemu/main-loop.h"
27
+#include "sysemu/hvf.h"
23
#include "qemu/module.h"
28
#include "kvm_arm.h"
24
#include "qapi/error.h"
29
#include "hvf_arm.h"
25
30
#include "qapi/visitor.h"
26
@@ -XXX,XX +XXX,XX @@ typedef struct AlteraTimer {
31
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
27
MemoryRegion mmio;
32
uint64_t t;
28
qemu_irq irq;
33
uint32_t u;
29
uint32_t freq_hz;
34
30
- QEMUBH *bh;
35
- if (kvm_enabled()) {
31
ptimer_state *ptimer;
36
- /* With KVM, '-cpu max' is identical to '-cpu host' */
32
uint32_t regs[R_MAX];
37
+ if (kvm_enabled() || hvf_enabled()) {
33
} AlteraTimer;
38
+ /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
34
@@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr,
39
aarch64_host_initfn(obj);
35
break;
36
37
case R_CONTROL:
38
+ ptimer_transaction_begin(t->ptimer);
39
t->regs[R_CONTROL] = value & (CONTROL_ITO | CONTROL_CONT);
40
if ((value & CONTROL_START) &&
41
!(t->regs[R_STATUS] & STATUS_RUN)) {
42
@@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr,
43
ptimer_stop(t->ptimer);
44
t->regs[R_STATUS] &= ~STATUS_RUN;
45
}
46
+ ptimer_transaction_commit(t->ptimer);
47
break;
48
49
case R_PERIODL:
50
case R_PERIODH:
51
+ ptimer_transaction_begin(t->ptimer);
52
t->regs[addr] = value & 0xFFFF;
53
if (t->regs[R_STATUS] & STATUS_RUN) {
54
ptimer_stop(t->ptimer);
55
@@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr,
56
}
57
tvalue = (t->regs[R_PERIODH] << 16) | t->regs[R_PERIODL];
58
ptimer_set_limit(t->ptimer, tvalue + 1, 1);
59
+ ptimer_transaction_commit(t->ptimer);
60
break;
61
62
case R_SNAPL:
63
@@ -XXX,XX +XXX,XX @@ static void altera_timer_realize(DeviceState *dev, Error **errp)
64
return;
40
return;
65
}
41
}
66
67
- t->bh = qemu_bh_new(timer_hit, t);
68
- t->ptimer = ptimer_init_with_bh(t->bh, PTIMER_POLICY_DEFAULT);
69
+ t->ptimer = ptimer_init(timer_hit, t, PTIMER_POLICY_DEFAULT);
70
+ ptimer_transaction_begin(t->ptimer);
71
ptimer_set_freq(t->ptimer, t->freq_hz);
72
+ ptimer_transaction_commit(t->ptimer);
73
74
memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
75
TYPE_ALTERA_TIMER, R_MAX * sizeof(uint32_t));
76
@@ -XXX,XX +XXX,XX @@ static void altera_timer_reset(DeviceState *dev)
77
{
78
AlteraTimer *t = ALTERA_TIMER(dev);
79
80
+ ptimer_transaction_begin(t->ptimer);
81
ptimer_stop(t->ptimer);
82
ptimer_set_limit(t->ptimer, 0xffffffff, 1);
83
+ ptimer_transaction_commit(t->ptimer);
84
memset(t->regs, 0, sizeof(t->regs));
85
}
86
87
--
42
--
88
2.20.1
43
2.25.1
89
44
90
45
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Currently we don't allow guests under hvf to use the PAuth extension,
2
because we didn't have any special code to handle that, and therefore
3
in arm_cpu_pauth_finalize() we will sanitize the ID_AA64ISAR1 value
4
the guest sees to clear the PAuth related fields.
2
5
3
There are 3 conditions that each enable this flag. M-profile always
6
Add support for this in the same way that KVM does it, by defaulting
4
enables; A-profile with EL1 as AA64 always enables. Both of these
7
to "PAuth enabled" if the host CPU has it and allowing the user to
5
conditions can easily be cached. The final condition relies on the
8
disable it via '-cpu pauth=no' on the command line.
6
FPEXC register which we are not prepared to cache.
7
9
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20191018174431.1784-12-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: Alexander Graf <agraf@csgraf.de>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20220204165506.2846058-7-peter.maydell@linaro.org
12
---
16
---
13
target/arm/cpu.h | 2 +-
17
target/arm/cpu64.c | 14 ++++++++++----
14
target/arm/helper.c | 14 ++++++++++----
18
1 file changed, 10 insertions(+), 4 deletions(-)
15
2 files changed, 11 insertions(+), 5 deletions(-)
16
19
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
20
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
18
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
22
--- a/target/arm/cpu64.c
20
+++ b/target/arm/cpu.h
23
+++ b/target/arm/cpu64.c
21
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2)
24
@@ -XXX,XX +XXX,XX @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
22
* the same thing as the current security state of the processor!
25
uint64_t t;
23
*/
26
24
FIELD(TBFLAG_A32, NS, 6, 1)
27
/* Exit early if PAuth is enabled, and fall through to disable it */
25
-FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */
28
- if (kvm_enabled() && cpu->prop_pauth) {
26
+FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Partially cached, minus FPEXC. */
29
+ if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) {
27
FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */
30
if (!cpu_isar_feature(aa64_pauth, cpu)) {
28
FIELD(TBFLAG_A32, SCTLR_B, 16, 1)
31
- error_setg(errp, "'pauth' feature not supported by KVM on this host");
29
/* For M profile only, set if FPCCR.LSPACT is set */
32
+ error_setg(errp, "'pauth' feature not supported by %s on this host",
30
diff --git a/target/arm/helper.c b/target/arm/helper.c
33
+ kvm_enabled() ? "KVM" : "hvf");
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/helper.c
33
+++ b/target/arm/helper.c
34
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el,
35
{
36
uint32_t flags = 0;
37
38
+ /* v8M always enables the fpu. */
39
+ flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
40
+
41
if (arm_v7m_is_handler_mode(env)) {
42
flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1);
43
}
44
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el,
45
ARMMMUIdx mmu_idx)
46
{
47
uint32_t flags = rebuild_hflags_aprofile(env);
48
+
49
+ if (arm_el_is_aa64(env, 1)) {
50
+ flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
51
+ }
52
return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
53
}
54
55
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
56
flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE,
57
env->vfp.vec_stride);
58
}
59
+ if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)) {
60
+ flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
61
+ }
62
}
34
}
63
35
64
flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb);
36
return;
65
flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits);
37
@@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj)
66
- if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)
38
67
- || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) {
39
/* Default to PAUTH on, with the architected algorithm on TCG. */
68
- flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
40
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
69
- }
41
- if (kvm_enabled()) {
70
pstate_for_ss = env->uncached_cpsr;
42
+ if (kvm_enabled() || hvf_enabled()) {
71
}
43
/*
72
44
* Mirror PAuth support from the probed sysregs back into the
45
- * property for KVM. Is it just a bit backward? Yes it is!
46
+ * property for KVM or hvf. Is it just a bit backward? Yes it is!
47
+ * Note that prop_pauth is true whether the host CPU supports the
48
+ * architected QARMA5 algorithm or the IMPDEF one. We don't
49
+ * provide the separate pauth-impdef property for KVM or hvf,
50
+ * only for TCG.
51
*/
52
cpu->prop_pauth = cpu_isar_feature(aa64_pauth, cpu);
53
} else {
54
@@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj)
55
#elif defined(CONFIG_HVF)
56
ARMCPU *cpu = ARM_CPU(obj);
57
hvf_arm_set_cpu_features_from_host(cpu);
58
+ aarch64_add_pauth_properties(obj);
59
#else
60
g_assert_not_reached();
61
#endif
73
--
62
--
74
2.20.1
63
2.25.1
75
64
76
65
diff view generated by jsdifflib
1
Switch the etraxfs_timer code away from bottom-half based ptimers to
1
Currently there is no way for a board model's Kconfig stanza to
2
the new transaction-based ptimer API. This just requires adding
2
say "I have an i2c bus which the user can plug an i2c device into,
3
begin/commit calls around the various places that modify the ptimer
3
build all the free-standing i2c devices". The Kconfig mechanism
4
state, and using the new ptimer_init() function to create the timer.
4
for this is the "device group". Add an I2C_DEVICES group along
5
the same lines as the existing PCI_DEVICES. Simple free-standing
6
i2c devices which a user might plausibly want to be able to
7
plug in on the QEMU commandline should have
8
default y if I2C_DEVICES
9
and board models which have an i2c bus that is user-accessible
10
should use
11
imply I2C_DEVICES
12
to cause those pluggable devices to be built.
13
14
In this commit we mark only a fairly conservative set of i2c devices
15
as belonging to the I2C_DEVICES group: the simple sensors and RTCs
16
(not including PMBus devices or devices which need GPIO lines to be
17
connected).
5
18
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
21
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Message-id: 20191017132905.5604-7-peter.maydell@linaro.org
22
Reviewed-by: Hao Wu <wuhaotsh@google.com>
23
Message-id: 20220208155911.3408455-2-peter.maydell@linaro.org
10
---
24
---
11
hw/timer/etraxfs_timer.c | 23 +++++++++++++----------
25
docs/devel/kconfig.rst | 8 ++++++--
12
1 file changed, 13 insertions(+), 10 deletions(-)
26
hw/i2c/Kconfig | 5 +++++
27
hw/rtc/Kconfig | 2 ++
28
hw/sensor/Kconfig | 5 +++++
29
4 files changed, 18 insertions(+), 2 deletions(-)
13
30
14
diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
31
diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
15
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/timer/etraxfs_timer.c
33
--- a/docs/devel/kconfig.rst
17
+++ b/hw/timer/etraxfs_timer.c
34
+++ b/docs/devel/kconfig.rst
35
@@ -XXX,XX +XXX,XX @@ declares its dependencies in different ways:
36
no directive and are not used in the Makefile either; they only appear
37
as conditions for ``default y`` directives.
38
39
- QEMU currently has two device groups, ``PCI_DEVICES`` and
40
- ``TEST_DEVICES``. PCI devices usually have a ``default y if
41
+ QEMU currently has three device groups, ``PCI_DEVICES``, ``I2C_DEVICES``,
42
+ and ``TEST_DEVICES``. PCI devices usually have a ``default y if
43
PCI_DEVICES`` directive rather than just ``default y``. This lets
44
some boards (notably s390) easily support a subset of PCI devices,
45
for example only VFIO (passthrough) and virtio-pci devices.
46
+ ``I2C_DEVICES`` is similar to ``PCI_DEVICES``. It contains i2c devices
47
+ that users might reasonably want to plug in to an i2c bus on any
48
+ board (and not ones which are very board-specific or that need
49
+ to be wired up in a way that can't be done on the command line).
50
``TEST_DEVICES`` instead is used for devices that are rarely used on
51
production virtual machines, but provide useful hooks to test QEMU
52
or KVM.
53
diff --git a/hw/i2c/Kconfig b/hw/i2c/Kconfig
54
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/i2c/Kconfig
56
+++ b/hw/i2c/Kconfig
18
@@ -XXX,XX +XXX,XX @@
57
@@ -XXX,XX +XXX,XX @@
19
#include "hw/sysbus.h"
58
config I2C
20
#include "sysemu/reset.h"
59
bool
21
#include "sysemu/runstate.h"
60
22
-#include "qemu/main-loop.h"
61
+config I2C_DEVICES
23
#include "qemu/module.h"
62
+ # Device group for i2c devices which can reasonably be user-plugged
24
#include "qemu/timer.h"
63
+ # to any board's i2c bus
25
#include "hw/irq.h"
64
+ bool
26
@@ -XXX,XX +XXX,XX @@ typedef struct ETRAXTimerState {
65
+
27
qemu_irq irq;
66
config SMBUS
28
qemu_irq nmi;
67
bool
29
68
select I2C
30
- QEMUBH *bh_t0;
69
diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig
31
- QEMUBH *bh_t1;
70
index XXXXXXX..XXXXXXX 100644
32
- QEMUBH *bh_wd;
71
--- a/hw/rtc/Kconfig
33
ptimer_state *ptimer_t0;
72
+++ b/hw/rtc/Kconfig
34
ptimer_state *ptimer_t1;
73
@@ -XXX,XX +XXX,XX @@
35
ptimer_state *ptimer_wd;
74
config DS1338
36
@@ -XXX,XX +XXX,XX @@ static void update_ctrl(ETRAXTimerState *t, int tnum)
75
bool
37
}
76
depends on I2C
38
77
+ default y if I2C_DEVICES
39
D(printf ("freq_hz=%d div=%d\n", freq_hz, div));
78
40
+ ptimer_transaction_begin(timer);
79
config M41T80
41
ptimer_set_freq(timer, freq_hz);
80
bool
42
ptimer_set_limit(timer, div, 0);
81
depends on I2C
43
82
+ default y if I2C_DEVICES
44
@@ -XXX,XX +XXX,XX @@ static void update_ctrl(ETRAXTimerState *t, int tnum)
83
45
abort();
84
config M48T59
46
break;
85
bool
47
}
86
diff --git a/hw/sensor/Kconfig b/hw/sensor/Kconfig
48
+ ptimer_transaction_commit(timer);
87
index XXXXXXX..XXXXXXX 100644
49
}
88
--- a/hw/sensor/Kconfig
50
89
+++ b/hw/sensor/Kconfig
51
static void timer_update_irq(ETRAXTimerState *t)
90
@@ -XXX,XX +XXX,XX @@
52
@@ -XXX,XX +XXX,XX @@ static inline void timer_watchdog_update(ETRAXTimerState *t, uint32_t value)
91
config TMP105
53
92
bool
54
t->wd_hits = 0;
93
depends on I2C
55
94
+ default y if I2C_DEVICES
56
+ ptimer_transaction_begin(t->ptimer_wd);
95
57
ptimer_set_freq(t->ptimer_wd, 760);
96
config TMP421
58
if (wd_cnt == 0)
97
bool
59
wd_cnt = 256;
98
depends on I2C
60
@@ -XXX,XX +XXX,XX @@ static inline void timer_watchdog_update(ETRAXTimerState *t, uint32_t value)
99
+ default y if I2C_DEVICES
61
ptimer_stop(t->ptimer_wd);
100
62
101
config DPS310
63
t->rw_wd_ctrl = value;
102
bool
64
+ ptimer_transaction_commit(t->ptimer_wd);
103
depends on I2C
65
}
104
+ default y if I2C_DEVICES
66
105
67
static void
106
config EMC141X
68
@@ -XXX,XX +XXX,XX @@ static void etraxfs_timer_reset(void *opaque)
107
bool
69
{
108
depends on I2C
70
ETRAXTimerState *t = opaque;
109
+ default y if I2C_DEVICES
71
110
72
+ ptimer_transaction_begin(t->ptimer_t0);
111
config ADM1272
73
ptimer_stop(t->ptimer_t0);
112
bool
74
+ ptimer_transaction_commit(t->ptimer_t0);
113
@@ -XXX,XX +XXX,XX @@ config MAX34451
75
+ ptimer_transaction_begin(t->ptimer_t1);
114
config LSM303DLHC_MAG
76
ptimer_stop(t->ptimer_t1);
115
bool
77
+ ptimer_transaction_commit(t->ptimer_t1);
116
depends on I2C
78
+ ptimer_transaction_begin(t->ptimer_wd);
117
+ default y if I2C_DEVICES
79
ptimer_stop(t->ptimer_wd);
80
+ ptimer_transaction_commit(t->ptimer_wd);
81
t->rw_wd_ctrl = 0;
82
t->r_intr = 0;
83
t->rw_intr_mask = 0;
84
@@ -XXX,XX +XXX,XX @@ static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
85
ETRAXTimerState *t = ETRAX_TIMER(dev);
86
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
87
88
- t->bh_t0 = qemu_bh_new(timer0_hit, t);
89
- t->bh_t1 = qemu_bh_new(timer1_hit, t);
90
- t->bh_wd = qemu_bh_new(watchdog_hit, t);
91
- t->ptimer_t0 = ptimer_init_with_bh(t->bh_t0, PTIMER_POLICY_DEFAULT);
92
- t->ptimer_t1 = ptimer_init_with_bh(t->bh_t1, PTIMER_POLICY_DEFAULT);
93
- t->ptimer_wd = ptimer_init_with_bh(t->bh_wd, PTIMER_POLICY_DEFAULT);
94
+ t->ptimer_t0 = ptimer_init(timer0_hit, t, PTIMER_POLICY_DEFAULT);
95
+ t->ptimer_t1 = ptimer_init(timer1_hit, t, PTIMER_POLICY_DEFAULT);
96
+ t->ptimer_wd = ptimer_init(watchdog_hit, t, PTIMER_POLICY_DEFAULT);
97
98
sysbus_init_irq(sbd, &t->irq);
99
sysbus_init_irq(sbd, &t->nmi);
100
--
118
--
101
2.20.1
119
2.25.1
102
120
103
121
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
For arm boards with an i2c bus which a user could reasonably
2
want to plug arbitrary devices, add 'imply I2C_DEVICES' to the
3
Kconfig stanza.
2
4
3
Continue setting, but not relying upon, env->hflags.
4
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20191018174431.1784-20-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Hao Wu <wuhaotsh@google.com>
9
Message-id: 20220208155911.3408455-3-peter.maydell@linaro.org
9
---
10
---
10
target/arm/helper.c | 10 ++++++++++
11
hw/arm/Kconfig | 10 ++++++++++
11
1 file changed, 10 insertions(+)
12
1 file changed, 10 insertions(+)
12
13
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
16
--- a/hw/arm/Kconfig
16
+++ b/target/arm/helper.c
17
+++ b/hw/arm/Kconfig
17
@@ -XXX,XX +XXX,XX @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,
18
@@ -XXX,XX +XXX,XX @@ config DIGIC
18
/* ??? Lots of these bits are not implemented. */
19
19
/* This may enable/disable the MMU, so do a TLB flush. */
20
config EXYNOS4
20
tlb_flush(CPU(cpu));
21
bool
21
+
22
+ imply I2C_DEVICES
22
+ if (ri->type & ARM_CP_SUPPRESS_TB_END) {
23
select A9MPCORE
23
+ /*
24
select I2C
24
+ * Normally we would always end the TB on an SCTLR write; see the
25
select LAN9118
25
+ * comment in ARMCPRegInfo sctlr initialization below for why Xscale
26
@@ -XXX,XX +XXX,XX @@ config REALVIEW
26
+ * is special. Setting ARM_CP_SUPPRESS_TB_END also stops the rebuild
27
bool
27
+ * of hflags from the translator, so do it here.
28
imply PCI_DEVICES
28
+ */
29
imply PCI_TESTDEV
29
+ arm_rebuild_hflags(env);
30
+ imply I2C_DEVICES
30
+ }
31
select SMC91C111
31
}
32
select LAN9118
32
33
select A9MPCORE
33
static CPAccessResult fpexc32_access(CPUARMState *env, const ARMCPRegInfo *ri,
34
@@ -XXX,XX +XXX,XX @@ config SABRELITE
35
36
config STELLARIS
37
bool
38
+ imply I2C_DEVICES
39
select ARM_V7M
40
select CMSDK_APB_WATCHDOG
41
select I2C
42
@@ -XXX,XX +XXX,XX @@ config NPCM7XX
43
44
config FSL_IMX25
45
bool
46
+ imply I2C_DEVICES
47
select IMX
48
select IMX_FEC
49
select IMX_I2C
50
@@ -XXX,XX +XXX,XX @@ config FSL_IMX25
51
52
config FSL_IMX31
53
bool
54
+ imply I2C_DEVICES
55
select SERIAL
56
select IMX
57
select IMX_I2C
58
@@ -XXX,XX +XXX,XX @@ config FSL_IMX31
59
60
config FSL_IMX6
61
bool
62
+ imply I2C_DEVICES
63
select A9MPCORE
64
select IMX
65
select IMX_FEC
66
@@ -XXX,XX +XXX,XX @@ config ASPEED_SOC
67
68
config MPS2
69
bool
70
+ imply I2C_DEVICES
71
select ARMSSE
72
select LAN9118
73
select MPS2_FPGAIO
74
@@ -XXX,XX +XXX,XX @@ config FSL_IMX7
75
bool
76
imply PCI_DEVICES
77
imply TEST_DEVICES
78
+ imply I2C_DEVICES
79
select A15MPCORE
80
select PCI
81
select IMX
82
@@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3
83
84
config FSL_IMX6UL
85
bool
86
+ imply I2C_DEVICES
87
select A15MPCORE
88
select IMX
89
select IMX_FEC
90
@@ -XXX,XX +XXX,XX @@ config MICROBIT
91
92
config NRF51_SOC
93
bool
94
+ imply I2C_DEVICES
95
select I2C
96
select ARM_V7M
97
select UNIMP
34
--
98
--
35
2.20.1
99
2.25.1
36
100
37
101
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In the armv7m object, handle clock inputs that aren't connected.
2
This is always an error for 'cpuclk'. For 'refclk' it is OK for this
3
to be disconnected, but we need to handle it by not trying to connect
4
a sourceless-clock to the systick device.
2
5
3
Hoist the computation of some TBFLAG_A32 bits that only apply to
6
This fixes a bug where on the mps2-an521 and similar boards (which
4
M-profile under a single test for ARM_FEATURE_M.
7
do not have a refclk) the systick device incorrectly reset with
8
SYST_CSR.CLKSOURCE 0 ("use refclk") rather than 1 ("use CPU clock").
5
9
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Cc: qemu-stable@nongnu.org
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Reported-by: Richard Petri <git@rpls.de>
8
Message-id: 20191018174431.1784-7-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20220208171643.3486277-1-peter.maydell@linaro.org
10
---
16
---
11
target/arm/helper.c | 49 +++++++++++++++++++++------------------------
17
hw/arm/armv7m.c | 26 ++++++++++++++++++++++----
12
1 file changed, 23 insertions(+), 26 deletions(-)
18
1 file changed, 22 insertions(+), 4 deletions(-)
13
19
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
15
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
22
--- a/hw/arm/armv7m.c
17
+++ b/target/arm/helper.c
23
+++ b/hw/arm/armv7m.c
18
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
24
@@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp)
19
25
return;
20
if (arm_feature(env, ARM_FEATURE_M)) {
26
}
21
flags = rebuild_hflags_m32(env, fp_el, mmu_idx);
27
28
+ /* cpuclk must be connected; refclk is optional */
29
+ if (!clock_has_source(s->cpuclk)) {
30
+ error_setg(errp, "armv7m: cpuclk must be connected");
31
+ return;
32
+ }
22
+
33
+
23
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY) &&
34
memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1);
24
+ FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S)
35
25
+ != env->v7m.secure) {
36
s->cpu = ARM_CPU(object_new_with_props(s->cpu_type, OBJECT(s), "cpu",
26
+ flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1);
37
@@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp)
27
+ }
38
&s->sysreg_ns_mem);
28
+
29
+ if ((env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) &&
30
+ (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) ||
31
+ (env->v7m.secure &&
32
+ !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) {
33
+ /*
34
+ * ASPEN is set, but FPCA/SFPA indicate that there is no
35
+ * active FP context; we must create a new FP context before
36
+ * executing any FP insn.
37
+ */
38
+ flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1);
39
+ }
40
+
41
+ bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK;
42
+ if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) {
43
+ flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1);
44
+ }
45
} else {
46
flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
47
}
48
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
49
}
50
}
39
}
51
40
52
- if (arm_feature(env, ARM_FEATURE_M_SECURITY) &&
41
- /* Create and map the systick devices */
53
- FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) {
42
- qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk", s->refclk);
54
- flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1);
43
+ /*
55
- }
44
+ * Create and map the systick devices. Note that we only connect
56
-
45
+ * refclk if it has been connected to us; otherwise the systick
57
- if (arm_feature(env, ARM_FEATURE_M) &&
46
+ * device gets the wrong answer for clock_has_source(refclk), because
58
- (env->v7m.fpccr[env->v7m.secure] & R_V7M_FPCCR_ASPEN_MASK) &&
47
+ * it has an immediate source (the ARMv7M's clock object) but not
59
- (!(env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK) ||
48
+ * an ultimate source, and then it won't correctly auto-select the
60
- (env->v7m.secure &&
49
+ * CPU clock as its only possible clock source.
61
- !(env->v7m.control[M_REG_S] & R_V7M_CONTROL_SFPA_MASK)))) {
50
+ */
62
- /*
51
+ if (clock_has_source(s->refclk)) {
63
- * ASPEN is set, but FPCA/SFPA indicate that there is no active
52
+ qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk",
64
- * FP context; we must create a new FP context before executing
53
+ s->refclk);
65
- * any FP insn.
54
+ }
66
- */
55
qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "cpuclk", s->cpuclk);
67
- flags = FIELD_DP32(flags, TBFLAG_A32, NEW_FP_CTXT_NEEDED, 1);
56
if (!sysbus_realize(SYS_BUS_DEVICE(&s->systick[M_REG_NS]), errp)) {
68
- }
57
return;
69
-
58
@@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp)
70
- if (arm_feature(env, ARM_FEATURE_M)) {
59
*/
71
- bool is_secure = env->v7m.fpccr[M_REG_S] & R_V7M_FPCCR_S_MASK;
60
object_initialize_child(OBJECT(dev), "systick-reg-s",
72
-
61
&s->systick[M_REG_S], TYPE_SYSTICK);
73
- if (env->v7m.fpccr[is_secure] & R_V7M_FPCCR_LSPACT_MASK) {
62
- qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk",
74
- flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1);
63
- s->refclk);
75
- }
64
+ if (clock_has_source(s->refclk)) {
76
- }
65
+ qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk",
77
-
66
+ s->refclk);
78
if (!arm_feature(env, ARM_FEATURE_M)) {
67
+ }
79
int target_el = arm_debug_target_el(env);
68
qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "cpuclk",
69
s->cpuclk);
80
70
81
--
71
--
82
2.20.1
72
2.25.1
83
73
84
74
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
The function qemu_madvise() and the QEMU_MADV_* constants associated
2
with it are used in only 10 files. Move them out of osdep.h to a new
3
qemu/madvise.h header that is included where it is needed.
2
4
3
IEC binary prefixes ease code review: the unit is explicit.
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: 20220208200856.3558249-2-peter.maydell@linaro.org
9
---
10
include/qemu/madvise.h | 95 ++++++++++++++++++++++++++++++++++++++
11
include/qemu/osdep.h | 82 --------------------------------
12
backends/hostmem-file.c | 1 +
13
backends/hostmem.c | 1 +
14
hw/virtio/virtio-balloon.c | 1 +
15
migration/postcopy-ram.c | 1 +
16
migration/qemu-file.c | 1 +
17
migration/ram.c | 1 +
18
softmmu/physmem.c | 1 +
19
tcg/region.c | 1 +
20
util/osdep.c | 1 +
21
util/oslib-posix.c | 1 +
22
12 files changed, 105 insertions(+), 82 deletions(-)
23
create mode 100644 include/qemu/madvise.h
4
24
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
diff --git a/include/qemu/madvise.h b/include/qemu/madvise.h
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
26
new file mode 100644
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
27
index XXXXXXX..XXXXXXX
8
Message-id: 20191021190653.9511-3-philmd@redhat.com
28
--- /dev/null
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
+++ b/include/qemu/madvise.h
10
---
30
@@ -XXX,XX +XXX,XX @@
11
hw/arm/mps2-tz.c | 3 ++-
31
+/*
12
hw/arm/mps2.c | 3 ++-
32
+ * QEMU madvise wrapper functions
13
2 files changed, 4 insertions(+), 2 deletions(-)
33
+ *
14
34
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
15
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
35
+ * See the COPYING file in the top-level directory.
16
index XXXXXXX..XXXXXXX 100644
36
+ */
17
--- a/hw/arm/mps2-tz.c
37
+
18
+++ b/hw/arm/mps2-tz.c
38
+#ifndef QEMU_MADVISE_H
19
@@ -XXX,XX +XXX,XX @@
39
+#define QEMU_MADVISE_H
20
*/
40
+
21
41
+#define QEMU_MADV_INVALID -1
22
#include "qemu/osdep.h"
42
+
23
+#include "qemu/units.h"
43
+#if defined(CONFIG_MADVISE)
44
+
45
+#define QEMU_MADV_WILLNEED MADV_WILLNEED
46
+#define QEMU_MADV_DONTNEED MADV_DONTNEED
47
+#ifdef MADV_DONTFORK
48
+#define QEMU_MADV_DONTFORK MADV_DONTFORK
49
+#else
50
+#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
51
+#endif
52
+#ifdef MADV_MERGEABLE
53
+#define QEMU_MADV_MERGEABLE MADV_MERGEABLE
54
+#else
55
+#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
56
+#endif
57
+#ifdef MADV_UNMERGEABLE
58
+#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE
59
+#else
60
+#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
61
+#endif
62
+#ifdef MADV_DODUMP
63
+#define QEMU_MADV_DODUMP MADV_DODUMP
64
+#else
65
+#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
66
+#endif
67
+#ifdef MADV_DONTDUMP
68
+#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
69
+#else
70
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
71
+#endif
72
+#ifdef MADV_HUGEPAGE
73
+#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
74
+#else
75
+#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
76
+#endif
77
+#ifdef MADV_NOHUGEPAGE
78
+#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE
79
+#else
80
+#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
81
+#endif
82
+#ifdef MADV_REMOVE
83
+#define QEMU_MADV_REMOVE MADV_REMOVE
84
+#else
85
+#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
86
+#endif
87
+#ifdef MADV_POPULATE_WRITE
88
+#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE
89
+#else
90
+#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
91
+#endif
92
+
93
+#elif defined(CONFIG_POSIX_MADVISE)
94
+
95
+#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED
96
+#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
97
+#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
98
+#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
99
+#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
100
+#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
101
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
102
+#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
103
+#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
104
+#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
105
+#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
106
+
107
+#else /* no-op */
108
+
109
+#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID
110
+#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
111
+#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
112
+#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
113
+#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
114
+#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
115
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
116
+#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
117
+#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
118
+#define QEMU_MADV_REMOVE QEMU_MADV_INVALID
119
+#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
120
+
121
+#endif
122
+
123
+int qemu_madvise(void *addr, size_t len, int advice);
124
+
125
+#endif
126
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
127
index XXXXXXX..XXXXXXX 100644
128
--- a/include/qemu/osdep.h
129
+++ b/include/qemu/osdep.h
130
@@ -XXX,XX +XXX,XX @@ static inline void qemu_cleanup_generic_vfree(void *p)
131
#define QEMU_MAP_NORESERVE (1 << 3)
132
133
134
-#define QEMU_MADV_INVALID -1
135
-
136
-#if defined(CONFIG_MADVISE)
137
-
138
-#define QEMU_MADV_WILLNEED MADV_WILLNEED
139
-#define QEMU_MADV_DONTNEED MADV_DONTNEED
140
-#ifdef MADV_DONTFORK
141
-#define QEMU_MADV_DONTFORK MADV_DONTFORK
142
-#else
143
-#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
144
-#endif
145
-#ifdef MADV_MERGEABLE
146
-#define QEMU_MADV_MERGEABLE MADV_MERGEABLE
147
-#else
148
-#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
149
-#endif
150
-#ifdef MADV_UNMERGEABLE
151
-#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE
152
-#else
153
-#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
154
-#endif
155
-#ifdef MADV_DODUMP
156
-#define QEMU_MADV_DODUMP MADV_DODUMP
157
-#else
158
-#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
159
-#endif
160
-#ifdef MADV_DONTDUMP
161
-#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
162
-#else
163
-#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
164
-#endif
165
-#ifdef MADV_HUGEPAGE
166
-#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
167
-#else
168
-#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
169
-#endif
170
-#ifdef MADV_NOHUGEPAGE
171
-#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE
172
-#else
173
-#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
174
-#endif
175
-#ifdef MADV_REMOVE
176
-#define QEMU_MADV_REMOVE MADV_REMOVE
177
-#else
178
-#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
179
-#endif
180
-#ifdef MADV_POPULATE_WRITE
181
-#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE
182
-#else
183
-#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
184
-#endif
185
-
186
-#elif defined(CONFIG_POSIX_MADVISE)
187
-
188
-#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED
189
-#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
190
-#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
191
-#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
192
-#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
193
-#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
194
-#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
195
-#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
196
-#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
197
-#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
198
-#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
199
-
200
-#else /* no-op */
201
-
202
-#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID
203
-#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
204
-#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
205
-#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
206
-#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
207
-#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
208
-#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
209
-#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
210
-#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
211
-#define QEMU_MADV_REMOVE QEMU_MADV_INVALID
212
-#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
213
-
214
-#endif
215
216
#ifdef _WIN32
217
#define HAVE_CHARDEV_SERIAL 1
218
@@ -XXX,XX +XXX,XX @@ void sigaction_invoke(struct sigaction *action,
219
struct qemu_signalfd_siginfo *info);
220
#endif
221
222
-int qemu_madvise(void *addr, size_t len, int advice);
223
int qemu_mprotect_rw(void *addr, size_t size);
224
int qemu_mprotect_rwx(void *addr, size_t size);
225
int qemu_mprotect_none(void *addr, size_t size);
226
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
227
index XXXXXXX..XXXXXXX 100644
228
--- a/backends/hostmem-file.c
229
+++ b/backends/hostmem-file.c
230
@@ -XXX,XX +XXX,XX @@
24
#include "qapi/error.h"
231
#include "qapi/error.h"
25
#include "qemu/error-report.h"
232
#include "qemu/error-report.h"
26
#include "hw/arm/boot.h"
233
#include "qemu/module.h"
27
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
234
+#include "qemu/madvise.h"
28
* call the 16MB our "system memory", as it's the largest lump.
235
#include "sysemu/hostmem.h"
29
*/
236
#include "qom/object_interfaces.h"
30
memory_region_allocate_system_memory(&mms->psram,
237
#include "qom/object.h"
31
- NULL, "mps.ram", 0x01000000);
238
diff --git a/backends/hostmem.c b/backends/hostmem.c
32
+ NULL, "mps.ram", 16 * MiB);
239
index XXXXXXX..XXXXXXX 100644
33
memory_region_add_subregion(system_memory, 0x80000000, &mms->psram);
240
--- a/backends/hostmem.c
34
241
+++ b/backends/hostmem.c
35
/* The overflow IRQs for all UARTs are ORed together.
242
@@ -XXX,XX +XXX,XX @@
36
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
243
#include "qemu/config-file.h"
37
index XXXXXXX..XXXXXXX 100644
244
#include "qom/object_interfaces.h"
38
--- a/hw/arm/mps2.c
245
#include "qemu/mmap-alloc.h"
39
+++ b/hw/arm/mps2.c
246
+#include "qemu/madvise.h"
247
248
#ifdef CONFIG_NUMA
249
#include <numaif.h>
250
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
251
index XXXXXXX..XXXXXXX 100644
252
--- a/hw/virtio/virtio-balloon.c
253
+++ b/hw/virtio/virtio-balloon.c
254
@@ -XXX,XX +XXX,XX @@
255
#include "qemu/iov.h"
256
#include "qemu/module.h"
257
#include "qemu/timer.h"
258
+#include "qemu/madvise.h"
259
#include "hw/virtio/virtio.h"
260
#include "hw/mem/pc-dimm.h"
261
#include "hw/qdev-properties.h"
262
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
263
index XXXXXXX..XXXXXXX 100644
264
--- a/migration/postcopy-ram.c
265
+++ b/migration/postcopy-ram.c
266
@@ -XXX,XX +XXX,XX @@
267
268
#include "qemu/osdep.h"
269
#include "qemu/rcu.h"
270
+#include "qemu/madvise.h"
271
#include "exec/target_page.h"
272
#include "migration.h"
273
#include "qemu-file.h"
274
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
275
index XXXXXXX..XXXXXXX 100644
276
--- a/migration/qemu-file.c
277
+++ b/migration/qemu-file.c
40
@@ -XXX,XX +XXX,XX @@
278
@@ -XXX,XX +XXX,XX @@
41
*/
279
*/
42
43
#include "qemu/osdep.h"
280
#include "qemu/osdep.h"
44
+#include "qemu/units.h"
281
#include <zlib.h>
282
+#include "qemu/madvise.h"
283
#include "qemu/error-report.h"
284
#include "qemu/iov.h"
285
#include "migration.h"
286
diff --git a/migration/ram.c b/migration/ram.c
287
index XXXXXXX..XXXXXXX 100644
288
--- a/migration/ram.c
289
+++ b/migration/ram.c
290
@@ -XXX,XX +XXX,XX @@
291
#include "qemu/cutils.h"
292
#include "qemu/bitops.h"
293
#include "qemu/bitmap.h"
294
+#include "qemu/madvise.h"
295
#include "qemu/main-loop.h"
296
#include "xbzrle.h"
297
#include "ram.h"
298
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
299
index XXXXXXX..XXXXXXX 100644
300
--- a/softmmu/physmem.c
301
+++ b/softmmu/physmem.c
302
@@ -XXX,XX +XXX,XX @@
303
304
#include "qemu/cutils.h"
305
#include "qemu/cacheflush.h"
306
+#include "qemu/madvise.h"
307
308
#ifdef CONFIG_TCG
309
#include "hw/core/tcg-cpu-ops.h"
310
diff --git a/tcg/region.c b/tcg/region.c
311
index XXXXXXX..XXXXXXX 100644
312
--- a/tcg/region.c
313
+++ b/tcg/region.c
314
@@ -XXX,XX +XXX,XX @@
315
316
#include "qemu/osdep.h"
317
#include "qemu/units.h"
318
+#include "qemu/madvise.h"
319
#include "qapi/error.h"
320
#include "exec/exec-all.h"
321
#include "tcg/tcg.h"
322
diff --git a/util/osdep.c b/util/osdep.c
323
index XXXXXXX..XXXXXXX 100644
324
--- a/util/osdep.c
325
+++ b/util/osdep.c
326
@@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int);
327
#include "qemu/cutils.h"
328
#include "qemu/sockets.h"
329
#include "qemu/error-report.h"
330
+#include "qemu/madvise.h"
331
#include "monitor/monitor.h"
332
333
static bool fips_enabled = false;
334
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
335
index XXXXXXX..XXXXXXX 100644
336
--- a/util/oslib-posix.c
337
+++ b/util/oslib-posix.c
338
@@ -XXX,XX +XXX,XX @@
339
#include "trace.h"
45
#include "qapi/error.h"
340
#include "qapi/error.h"
46
#include "qemu/error-report.h"
341
#include "qemu/error-report.h"
47
#include "hw/arm/boot.h"
342
+#include "qemu/madvise.h"
48
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
343
#include "qemu/sockets.h"
49
* zbt_boot_ctrl is always zero).
344
#include "qemu/thread.h"
50
*/
345
#include <libgen.h>
51
memory_region_allocate_system_memory(&mms->psram,
52
- NULL, "mps.ram", 0x1000000);
53
+ NULL, "mps.ram", 16 * MiB);
54
memory_region_add_subregion(system_memory, 0x21000000, &mms->psram);
55
56
switch (mmc->fpga_type) {
57
--
346
--
58
2.20.1
347
2.25.1
59
348
60
349
diff view generated by jsdifflib
1
Switch the mcf5208 code away from bottom-half based ptimers to
1
The qemu_mprotect_*() family of functions are used in very few files;
2
the new transaction-based ptimer API. This just requires adding
2
move them from osdep.h to a new qemu/mprotect.h.
3
begin/commit calls around the various places that modify the ptimer
4
state, and using the new ptimer_init() function to create the timer.
5
3
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20220208200856.3558249-3-peter.maydell@linaro.org
9
Tested-by: Thomas Huth <huth@tuxfamily.org>
10
Message-id: 20191017132905.5604-9-peter.maydell@linaro.org
11
---
8
---
12
hw/m68k/mcf5208.c | 9 +++++----
9
include/qemu/mprotect.h | 14 ++++++++++++++
13
1 file changed, 5 insertions(+), 4 deletions(-)
10
include/qemu/osdep.h | 4 ----
11
tcg/region.c | 1 +
12
util/osdep.c | 1 +
13
4 files changed, 16 insertions(+), 4 deletions(-)
14
create mode 100644 include/qemu/mprotect.h
14
15
15
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
16
diff --git a/include/qemu/mprotect.h b/include/qemu/mprotect.h
17
new file mode 100644
18
index XXXXXXX..XXXXXXX
19
--- /dev/null
20
+++ b/include/qemu/mprotect.h
21
@@ -XXX,XX +XXX,XX @@
22
+/*
23
+ * QEMU mprotect functions
24
+ *
25
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
26
+ * See the COPYING file in the top-level directory.
27
+ */
28
+#ifndef QEMU_MPROTECT_H
29
+#define QEMU_MPROTECT_H
30
+
31
+int qemu_mprotect_rw(void *addr, size_t size);
32
+int qemu_mprotect_rwx(void *addr, size_t size);
33
+int qemu_mprotect_none(void *addr, size_t size);
34
+
35
+#endif
36
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
16
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/m68k/mcf5208.c
38
--- a/include/qemu/osdep.h
18
+++ b/hw/m68k/mcf5208.c
39
+++ b/include/qemu/osdep.h
40
@@ -XXX,XX +XXX,XX @@ void sigaction_invoke(struct sigaction *action,
41
struct qemu_signalfd_siginfo *info);
42
#endif
43
44
-int qemu_mprotect_rw(void *addr, size_t size);
45
-int qemu_mprotect_rwx(void *addr, size_t size);
46
-int qemu_mprotect_none(void *addr, size_t size);
47
-
48
/*
49
* Don't introduce new usage of this function, prefer the following
50
* qemu_open/qemu_create that take an "Error **errp"
51
diff --git a/tcg/region.c b/tcg/region.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/tcg/region.c
54
+++ b/tcg/region.c
19
@@ -XXX,XX +XXX,XX @@
55
@@ -XXX,XX +XXX,XX @@
20
#include "qemu/osdep.h"
56
#include "qemu/osdep.h"
21
#include "qemu/units.h"
57
#include "qemu/units.h"
58
#include "qemu/madvise.h"
59
+#include "qemu/mprotect.h"
60
#include "qapi/error.h"
61
#include "exec/exec-all.h"
62
#include "tcg/tcg.h"
63
diff --git a/util/osdep.c b/util/osdep.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/util/osdep.c
66
+++ b/util/osdep.c
67
@@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int);
68
#include "qemu/sockets.h"
22
#include "qemu/error-report.h"
69
#include "qemu/error-report.h"
23
-#include "qemu/main-loop.h"
70
#include "qemu/madvise.h"
24
#include "qapi/error.h"
71
+#include "qemu/mprotect.h"
25
#include "qemu-common.h"
72
#include "monitor/monitor.h"
26
#include "cpu.h"
73
27
@@ -XXX,XX +XXX,XX @@ static void m5208_timer_write(void *opaque, hwaddr offset,
74
static bool fips_enabled = false;
28
return;
29
}
30
31
+ ptimer_transaction_begin(s->timer);
32
if (s->pcsr & PCSR_EN)
33
ptimer_stop(s->timer);
34
35
@@ -XXX,XX +XXX,XX @@ static void m5208_timer_write(void *opaque, hwaddr offset,
36
37
if (s->pcsr & PCSR_EN)
38
ptimer_run(s->timer, 0);
39
+ ptimer_transaction_commit(s->timer);
40
break;
41
case 2:
42
+ ptimer_transaction_begin(s->timer);
43
s->pmr = value;
44
s->pcsr &= ~PCSR_PIF;
45
if ((s->pcsr & PCSR_RLD) == 0) {
46
@@ -XXX,XX +XXX,XX @@ static void m5208_timer_write(void *opaque, hwaddr offset,
47
} else {
48
ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
49
}
50
+ ptimer_transaction_commit(s->timer);
51
break;
52
case 4:
53
break;
54
@@ -XXX,XX +XXX,XX @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
55
{
56
MemoryRegion *iomem = g_new(MemoryRegion, 1);
57
m5208_timer_state *s;
58
- QEMUBH *bh;
59
int i;
60
61
/* SDRAMC. */
62
@@ -XXX,XX +XXX,XX @@ static void mcf5208_sys_init(MemoryRegion *address_space, qemu_irq *pic)
63
/* Timers. */
64
for (i = 0; i < 2; i++) {
65
s = g_new0(m5208_timer_state, 1);
66
- bh = qemu_bh_new(m5208_timer_trigger, s);
67
- s->timer = ptimer_init_with_bh(bh, PTIMER_POLICY_DEFAULT);
68
+ s->timer = ptimer_init(m5208_timer_trigger, s, PTIMER_POLICY_DEFAULT);
69
memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s,
70
"m5208-timer", 0x00004000);
71
memory_region_add_subregion(address_space, 0xfc080000 + 0x4000 * i,
72
--
75
--
73
2.20.1
76
2.25.1
74
77
75
78
diff view generated by jsdifflib
1
Switch the lm32_timer code away from bottom-half based ptimers to the
1
The QEMU_MAP_* constants are used only as arguments to the
2
new transaction-based ptimer API. This just requires adding
2
qemu_ram_mmap() function. Move them to mmap-alloc.h, where that
3
begin/commit calls around the various places that modify the ptimer
3
function's prototype is defined.
4
state, and using the new ptimer_init() function to create the ytimer.
5
4
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20220208200856.3558249-4-peter.maydell@linaro.org
9
Message-id: 20191017132905.5604-4-peter.maydell@linaro.org
10
---
9
---
11
hw/timer/lm32_timer.c | 13 +++++++++----
10
include/qemu/mmap-alloc.h | 23 +++++++++++++++++++++++
12
1 file changed, 9 insertions(+), 4 deletions(-)
11
include/qemu/osdep.h | 25 -------------------------
12
2 files changed, 23 insertions(+), 25 deletions(-)
13
13
14
diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c
14
diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/timer/lm32_timer.c
16
--- a/include/qemu/mmap-alloc.h
17
+++ b/hw/timer/lm32_timer.c
17
+++ b/include/qemu/mmap-alloc.h
18
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ void *qemu_ram_mmap(int fd,
19
#include "hw/ptimer.h"
19
20
#include "hw/qdev-properties.h"
20
void qemu_ram_munmap(int fd, void *ptr, size_t size);
21
#include "qemu/error-report.h"
21
22
-#include "qemu/main-loop.h"
22
+/*
23
#include "qemu/module.h"
23
+ * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example,
24
24
+ * consumed by qemu_ram_mmap().
25
#define DEFAULT_FREQUENCY (50*1000000)
25
+ */
26
@@ -XXX,XX +XXX,XX @@ struct LM32TimerState {
26
+
27
27
+/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */
28
MemoryRegion iomem;
28
+#define QEMU_MAP_READONLY (1 << 0)
29
29
+
30
- QEMUBH *bh;
30
+/* Use MAP_SHARED instead of MAP_PRIVATE. */
31
ptimer_state *ptimer;
31
+#define QEMU_MAP_SHARED (1 << 1)
32
32
+
33
qemu_irq irq;
33
+/*
34
@@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr,
34
+ * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without
35
s->regs[R_SR] &= ~SR_TO;
35
+ * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC.
36
break;
36
+ */
37
case R_CR:
37
+#define QEMU_MAP_SYNC (1 << 2)
38
+ ptimer_transaction_begin(s->ptimer);
38
+
39
s->regs[R_CR] = value;
39
+/*
40
if (s->regs[R_CR] & CR_START) {
40
+ * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if
41
ptimer_run(s->ptimer, 1);
41
+ * applicable). Bail out if not supported/effective.
42
@@ -XXX,XX +XXX,XX @@ static void timer_write(void *opaque, hwaddr addr,
42
+ */
43
if (s->regs[R_CR] & CR_STOP) {
43
+#define QEMU_MAP_NORESERVE (1 << 3)
44
ptimer_stop(s->ptimer);
44
+
45
}
45
#endif
46
+ ptimer_transaction_commit(s->ptimer);
46
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
47
break;
47
index XXXXXXX..XXXXXXX 100644
48
case R_PERIOD:
48
--- a/include/qemu/osdep.h
49
s->regs[R_PERIOD] = value;
49
+++ b/include/qemu/osdep.h
50
+ ptimer_transaction_begin(s->ptimer);
50
@@ -XXX,XX +XXX,XX @@ static inline void qemu_cleanup_generic_vfree(void *p)
51
ptimer_set_count(s->ptimer, value);
51
*/
52
+ ptimer_transaction_commit(s->ptimer);
52
#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)))
53
break;
53
54
case R_SNAPSHOT:
54
-/*
55
error_report("lm32_timer: write access to read only register 0x"
55
- * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example,
56
@@ -XXX,XX +XXX,XX @@ static void timer_reset(DeviceState *d)
56
- * consumed by qemu_ram_mmap().
57
for (i = 0; i < R_MAX; i++) {
57
- */
58
s->regs[i] = 0;
58
-
59
}
59
-/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */
60
+ ptimer_transaction_begin(s->ptimer);
60
-#define QEMU_MAP_READONLY (1 << 0)
61
ptimer_stop(s->ptimer);
61
-
62
+ ptimer_transaction_commit(s->ptimer);
62
-/* Use MAP_SHARED instead of MAP_PRIVATE. */
63
}
63
-#define QEMU_MAP_SHARED (1 << 1)
64
64
-
65
static void lm32_timer_init(Object *obj)
65
-/*
66
@@ -XXX,XX +XXX,XX @@ static void lm32_timer_realize(DeviceState *dev, Error **errp)
66
- * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without
67
{
67
- * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC.
68
LM32TimerState *s = LM32_TIMER(dev);
68
- */
69
69
-#define QEMU_MAP_SYNC (1 << 2)
70
- s->bh = qemu_bh_new(timer_hit, s);
70
-
71
- s->ptimer = ptimer_init_with_bh(s->bh, PTIMER_POLICY_DEFAULT);
71
-/*
72
+ s->ptimer = ptimer_init(timer_hit, s, PTIMER_POLICY_DEFAULT);
72
- * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if
73
73
- * applicable). Bail out if not supported/effective.
74
+ ptimer_transaction_begin(s->ptimer);
74
- */
75
ptimer_set_freq(s->ptimer, s->freq_hz);
75
-#define QEMU_MAP_NORESERVE (1 << 3)
76
+ ptimer_transaction_commit(s->ptimer);
76
-
77
}
77
-
78
78
-
79
static const VMStateDescription vmstate_lm32_timer = {
79
#ifdef _WIN32
80
#define HAVE_CHARDEV_SERIAL 1
81
#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
80
--
82
--
81
2.20.1
83
2.25.1
82
84
83
85
diff view generated by jsdifflib
1
Switch the puv3_ost code away from bottom-half based ptimers to the
1
The qemu_icache_linesize, qemu_icache_linesize_log,
2
new transaction-based ptimer API. This just requires adding
2
qemu_dcache_linesize, and qemu_dcache_linesize_log variables are not
3
begin/commit calls around the various places that modify the ptimer
3
used in many files. Move them out of osdep.h to a new
4
state, and using the new ptimer_init() function to create the timer.
4
qemu/cacheinfo.h, and document them.
5
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Message-id: 20220208200856.3558249-5-peter.maydell@linaro.org
9
Message-id: 20191017132905.5604-2-peter.maydell@linaro.org
10
---
10
---
11
hw/timer/puv3_ost.c | 9 +++++----
11
include/qemu/cacheinfo.h | 21 +++++++++++++++++++++
12
1 file changed, 5 insertions(+), 4 deletions(-)
12
include/qemu/osdep.h | 5 -----
13
accel/tcg/translate-all.c | 1 +
14
plugins/loader.c | 1 +
15
tcg/region.c | 1 +
16
tcg/tcg.c | 1 +
17
util/atomic64.c | 1 +
18
util/cacheflush.c | 1 +
19
util/cacheinfo.c | 1 +
20
9 files changed, 28 insertions(+), 5 deletions(-)
21
create mode 100644 include/qemu/cacheinfo.h
13
22
14
diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c
23
diff --git a/include/qemu/cacheinfo.h b/include/qemu/cacheinfo.h
24
new file mode 100644
25
index XXXXXXX..XXXXXXX
26
--- /dev/null
27
+++ b/include/qemu/cacheinfo.h
28
@@ -XXX,XX +XXX,XX @@
29
+/*
30
+ * QEMU host cacheinfo information
31
+ *
32
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
33
+ * See the COPYING file in the top-level directory.
34
+ */
35
+#ifndef QEMU_CACHEINFO_H
36
+#define QEMU_CACHEINFO_H
37
+
38
+/*
39
+ * These variables represent our best guess at the host icache and
40
+ * dcache sizes, expressed both as the size in bytes and as the
41
+ * base-2 log of the size in bytes. They are initialized at startup
42
+ * (via an attribute 'constructor' function).
43
+ */
44
+extern int qemu_icache_linesize;
45
+extern int qemu_icache_linesize_log;
46
+extern int qemu_dcache_linesize;
47
+extern int qemu_dcache_linesize_log;
48
+
49
+#endif
50
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
15
index XXXXXXX..XXXXXXX 100644
51
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/timer/puv3_ost.c
52
--- a/include/qemu/osdep.h
17
+++ b/hw/timer/puv3_ost.c
53
+++ b/include/qemu/osdep.h
54
@@ -XXX,XX +XXX,XX @@ pid_t qemu_fork(Error **errp);
55
extern uintptr_t qemu_real_host_page_size;
56
extern intptr_t qemu_real_host_page_mask;
57
58
-extern int qemu_icache_linesize;
59
-extern int qemu_icache_linesize_log;
60
-extern int qemu_dcache_linesize;
61
-extern int qemu_dcache_linesize_log;
62
-
63
/*
64
* After using getopt or getopt_long, if you need to parse another set
65
* of options, then you must reset optind. Unfortunately the way to
66
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/accel/tcg/translate-all.c
69
+++ b/accel/tcg/translate-all.c
18
@@ -XXX,XX +XXX,XX @@
70
@@ -XXX,XX +XXX,XX @@
19
#include "hw/sysbus.h"
71
#include "qemu/qemu-print.h"
20
#include "hw/irq.h"
72
#include "qemu/timer.h"
21
#include "hw/ptimer.h"
73
#include "qemu/main-loop.h"
22
-#include "qemu/main-loop.h"
74
+#include "qemu/cacheinfo.h"
23
#include "qemu/module.h"
75
#include "exec/log.h"
24
76
#include "sysemu/cpus.h"
25
#undef DEBUG_PUV3
77
#include "sysemu/cpu-timers.h"
26
@@ -XXX,XX +XXX,XX @@ typedef struct PUV3OSTState {
78
diff --git a/plugins/loader.c b/plugins/loader.c
27
SysBusDevice parent_obj;
79
index XXXXXXX..XXXXXXX 100644
28
80
--- a/plugins/loader.c
29
MemoryRegion iomem;
81
+++ b/plugins/loader.c
30
- QEMUBH *bh;
82
@@ -XXX,XX +XXX,XX @@
31
qemu_irq irq;
83
#include "qemu/rcu_queue.h"
32
ptimer_state *ptimer;
84
#include "qemu/qht.h"
33
85
#include "qemu/bitmap.h"
34
@@ -XXX,XX +XXX,XX @@ static void puv3_ost_write(void *opaque, hwaddr offset,
86
+#include "qemu/cacheinfo.h"
35
DPRINTF("offset 0x%x, value 0x%x\n", offset, value);
87
#include "qemu/xxhash.h"
36
switch (offset) {
88
#include "qemu/plugin.h"
37
case 0x00: /* Match Register 0 */
89
#include "hw/core/cpu.h"
38
+ ptimer_transaction_begin(s->ptimer);
90
diff --git a/tcg/region.c b/tcg/region.c
39
s->reg_OSMR0 = value;
91
index XXXXXXX..XXXXXXX 100644
40
if (s->reg_OSMR0 > s->reg_OSCR) {
92
--- a/tcg/region.c
41
ptimer_set_count(s->ptimer, s->reg_OSMR0 - s->reg_OSCR);
93
+++ b/tcg/region.c
42
@@ -XXX,XX +XXX,XX @@ static void puv3_ost_write(void *opaque, hwaddr offset,
94
@@ -XXX,XX +XXX,XX @@
43
(0xffffffff - s->reg_OSCR));
95
#include "qemu/units.h"
44
}
96
#include "qemu/madvise.h"
45
ptimer_run(s->ptimer, 2);
97
#include "qemu/mprotect.h"
46
+ ptimer_transaction_commit(s->ptimer);
98
+#include "qemu/cacheinfo.h"
47
break;
99
#include "qapi/error.h"
48
case 0x14: /* Status Register */
100
#include "exec/exec-all.h"
49
assert(value == 0);
101
#include "tcg/tcg.h"
50
@@ -XXX,XX +XXX,XX @@ static void puv3_ost_realize(DeviceState *dev, Error **errp)
102
diff --git a/tcg/tcg.c b/tcg/tcg.c
51
103
index XXXXXXX..XXXXXXX 100644
52
sysbus_init_irq(sbd, &s->irq);
104
--- a/tcg/tcg.c
53
105
+++ b/tcg/tcg.c
54
- s->bh = qemu_bh_new(puv3_ost_tick, s);
106
@@ -XXX,XX +XXX,XX @@
55
- s->ptimer = ptimer_init_with_bh(s->bh, PTIMER_POLICY_DEFAULT);
107
#include "qemu/qemu-print.h"
56
+ s->ptimer = ptimer_init(puv3_ost_tick, s, PTIMER_POLICY_DEFAULT);
108
#include "qemu/timer.h"
57
+ ptimer_transaction_begin(s->ptimer);
109
#include "qemu/cacheflush.h"
58
ptimer_set_freq(s->ptimer, 50 * 1000 * 1000);
110
+#include "qemu/cacheinfo.h"
59
+ ptimer_transaction_commit(s->ptimer);
111
60
112
/* Note: the long term plan is to reduce the dependencies on the QEMU
61
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_ost_ops, s, "puv3_ost",
113
CPU definitions. Currently they are used for qemu_ld/st
62
PUV3_REGS_OFFSET);
114
diff --git a/util/atomic64.c b/util/atomic64.c
115
index XXXXXXX..XXXXXXX 100644
116
--- a/util/atomic64.c
117
+++ b/util/atomic64.c
118
@@ -XXX,XX +XXX,XX @@
119
#include "qemu/osdep.h"
120
#include "qemu/atomic.h"
121
#include "qemu/thread.h"
122
+#include "qemu/cacheinfo.h"
123
124
#ifdef CONFIG_ATOMIC64
125
#error This file must only be compiled if !CONFIG_ATOMIC64
126
diff --git a/util/cacheflush.c b/util/cacheflush.c
127
index XXXXXXX..XXXXXXX 100644
128
--- a/util/cacheflush.c
129
+++ b/util/cacheflush.c
130
@@ -XXX,XX +XXX,XX @@
131
132
#include "qemu/osdep.h"
133
#include "qemu/cacheflush.h"
134
+#include "qemu/cacheinfo.h"
135
#include "qemu/bitops.h"
136
137
138
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
139
index XXXXXXX..XXXXXXX 100644
140
--- a/util/cacheinfo.c
141
+++ b/util/cacheinfo.c
142
@@ -XXX,XX +XXX,XX @@
143
#include "qemu/osdep.h"
144
#include "qemu/host-utils.h"
145
#include "qemu/atomic.h"
146
+#include "qemu/cacheinfo.h"
147
148
int qemu_icache_linesize = 0;
149
int qemu_icache_linesize_log;
63
--
150
--
64
2.20.1
151
2.25.1
65
152
66
153
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
The "hardware version" machinery (qemu_set_hw_version(),
2
qemu_hw_version(), and the QEMU_HW_VERSION define) is used by fewer
3
than 10 files. Move it out from osdep.h into a new
4
qemu/hw-version.h.
2
5
3
The SDRAM is incorrectly created in the OMAP2420 SoC.
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Move its creation in the board code, this will later allow the
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
board to have the QOM ownership of the RAM.
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220208200856.3558249-6-peter.maydell@linaro.org
10
---
11
include/qemu/hw-version.h | 27 +++++++++++++++++++++++++++
12
include/qemu/osdep.h | 16 ----------------
13
hw/arm/nseries.c | 1 +
14
hw/ide/core.c | 1 +
15
hw/scsi/megasas.c | 1 +
16
hw/scsi/scsi-bus.c | 1 +
17
hw/scsi/scsi-disk.c | 1 +
18
softmmu/vl.c | 1 +
19
target/i386/cpu.c | 1 +
20
target/s390x/cpu_models.c | 1 +
21
util/osdep.c | 1 +
22
11 files changed, 36 insertions(+), 16 deletions(-)
23
create mode 100644 include/qemu/hw-version.h
6
24
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
diff --git a/include/qemu/hw-version.h b/include/qemu/hw-version.h
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
26
new file mode 100644
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
27
index XXXXXXX..XXXXXXX
10
Message-id: 20191021190653.9511-5-philmd@redhat.com
28
--- /dev/null
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
+++ b/include/qemu/hw-version.h
12
---
30
@@ -XXX,XX +XXX,XX @@
13
include/hw/arm/omap.h | 4 +---
31
+/*
14
hw/arm/nseries.c | 10 +++++++---
32
+ * QEMU "hardware version" machinery
15
hw/arm/omap2.c | 13 +++++--------
33
+ *
16
3 files changed, 13 insertions(+), 14 deletions(-)
34
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
17
35
+ * See the COPYING file in the top-level directory.
18
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
36
+ */
37
+#ifndef QEMU_HW_VERSION_H
38
+#define QEMU_HW_VERSION_H
39
+
40
+/*
41
+ * Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default
42
+ * instead of QEMU_VERSION, so setting hw_version on MachineClass
43
+ * is no longer mandatory.
44
+ *
45
+ * Do NOT change this string, or it will break compatibility on all
46
+ * machine classes that don't set hw_version.
47
+ */
48
+#define QEMU_HW_VERSION "2.5+"
49
+
50
+/* QEMU "hardware version" setting. Used to replace code that exposed
51
+ * QEMU_VERSION to guests in the past and need to keep compatibility.
52
+ * Do not use qemu_hw_version() in new code.
53
+ */
54
+void qemu_set_hw_version(const char *);
55
+const char *qemu_hw_version(void);
56
+
57
+#endif
58
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
19
index XXXXXXX..XXXXXXX 100644
59
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/arm/omap.h
60
--- a/include/qemu/osdep.h
21
+++ b/include/hw/arm/omap.h
61
+++ b/include/qemu/osdep.h
22
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s {
62
@@ -XXX,XX +XXX,XX @@ static inline void qemu_timersub(const struct timeval *val1,
23
MemoryRegion tap_iomem;
63
24
MemoryRegion imif_ram;
64
void qemu_set_cloexec(int fd);
25
MemoryRegion emiff_ram;
65
26
- MemoryRegion sdram;
66
-/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default
27
MemoryRegion sram;
67
- * instead of QEMU_VERSION, so setting hw_version on MachineClass
28
68
- * is no longer mandatory.
29
struct omap_dma_port_if_s {
69
- *
30
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
70
- * Do NOT change this string, or it will break compatibility on all
31
const char *core);
71
- * machine classes that don't set hw_version.
32
72
- */
33
/* omap2.c */
73
-#define QEMU_HW_VERSION "2.5+"
34
-struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
74
-
35
- unsigned long sdram_size,
75
-/* QEMU "hardware version" setting. Used to replace code that exposed
36
+struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
76
- * QEMU_VERSION to guests in the past and need to keep compatibility.
37
const char *core);
77
- * Do not use qemu_hw_version() in new code.
38
78
- */
39
uint32_t omap_badwidth_read8(void *opaque, hwaddr addr);
79
-void qemu_set_hw_version(const char *);
80
-const char *qemu_hw_version(void);
81
-
82
void fips_set_state(bool requested);
83
bool fips_get_state(void);
84
40
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
85
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
41
index XXXXXXX..XXXXXXX 100644
86
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/arm/nseries.c
87
--- a/hw/arm/nseries.c
43
+++ b/hw/arm/nseries.c
88
+++ b/hw/arm/nseries.c
44
@@ -XXX,XX +XXX,XX @@
89
@@ -XXX,XX +XXX,XX @@
45
90
#include "chardev/char.h"
46
/* Nokia N8x0 support */
91
#include "qemu/cutils.h"
47
struct n800_s {
92
#include "qemu/bswap.h"
48
+ MemoryRegion sdram;
93
+#include "qemu/hw-version.h"
49
struct omap_mpu_state_s *mpu;
94
#include "sysemu/reset.h"
50
95
#include "sysemu/runstate.h"
51
struct rfbi_chip_s blizzard;
96
#include "sysemu/sysemu.h"
52
@@ -XXX,XX +XXX,XX @@ static int n810_atag_setup(const struct arm_boot_info *info, void *p)
97
diff --git a/hw/ide/core.c b/hw/ide/core.c
53
static void n8x0_init(MachineState *machine,
54
struct arm_boot_info *binfo, int model)
55
{
56
- MemoryRegion *sysmem = get_system_memory();
57
struct n800_s *s = (struct n800_s *) g_malloc0(sizeof(*s));
58
- int sdram_size = binfo->ram_size;
59
+ uint64_t sdram_size = binfo->ram_size;
60
61
- s->mpu = omap2420_mpu_init(sysmem, sdram_size, machine->cpu_type);
62
+ memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram",
63
+ sdram_size);
64
+ memory_region_add_subregion(get_system_memory(), OMAP2_Q2_BASE, &s->sdram);
65
+
66
+ s->mpu = omap2420_mpu_init(&s->sdram, machine->cpu_type);
67
68
/* Setup peripherals
69
*
70
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
71
index XXXXXXX..XXXXXXX 100644
98
index XXXXXXX..XXXXXXX 100644
72
--- a/hw/arm/omap2.c
99
--- a/hw/ide/core.c
73
+++ b/hw/arm/omap2.c
100
+++ b/hw/ide/core.c
74
@@ -XXX,XX +XXX,XX @@
101
@@ -XXX,XX +XXX,XX @@
75
#include "qemu/error-report.h"
102
#include "qemu/error-report.h"
103
#include "qemu/main-loop.h"
104
#include "qemu/timer.h"
105
+#include "qemu/hw-version.h"
106
#include "sysemu/sysemu.h"
107
#include "sysemu/blockdev.h"
108
#include "sysemu/dma.h"
109
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
110
index XXXXXXX..XXXXXXX 100644
111
--- a/hw/scsi/megasas.c
112
+++ b/hw/scsi/megasas.c
113
@@ -XXX,XX +XXX,XX @@
114
#include "hw/pci/msix.h"
115
#include "qemu/iov.h"
116
#include "qemu/module.h"
117
+#include "qemu/hw-version.h"
118
#include "hw/scsi/scsi.h"
119
#include "scsi/constants.h"
120
#include "trace.h"
121
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
122
index XXXXXXX..XXXXXXX 100644
123
--- a/hw/scsi/scsi-bus.c
124
+++ b/hw/scsi/scsi-bus.c
125
@@ -XXX,XX +XXX,XX @@
126
#include "qemu/error-report.h"
127
#include "qemu/module.h"
128
#include "qemu/option.h"
129
+#include "qemu/hw-version.h"
130
#include "hw/qdev-properties.h"
131
#include "hw/scsi/scsi.h"
132
#include "migration/qemu-file-types.h"
133
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
134
index XXXXXXX..XXXXXXX 100644
135
--- a/hw/scsi/scsi-disk.c
136
+++ b/hw/scsi/scsi-disk.c
137
@@ -XXX,XX +XXX,XX @@
138
#include "qemu/error-report.h"
139
#include "qemu/main-loop.h"
140
#include "qemu/module.h"
141
+#include "qemu/hw-version.h"
142
#include "hw/scsi/scsi.h"
143
#include "migration/qemu-file-types.h"
144
#include "migration/vmstate.h"
145
diff --git a/softmmu/vl.c b/softmmu/vl.c
146
index XXXXXXX..XXXXXXX 100644
147
--- a/softmmu/vl.c
148
+++ b/softmmu/vl.c
149
@@ -XXX,XX +XXX,XX @@
150
#include "qemu-version.h"
151
#include "qemu/cutils.h"
152
#include "qemu/help_option.h"
153
+#include "qemu/hw-version.h"
154
#include "qemu/uuid.h"
155
#include "sysemu/reset.h"
156
#include "sysemu/runstate.h"
157
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
158
index XXXXXXX..XXXXXXX 100644
159
--- a/target/i386/cpu.c
160
+++ b/target/i386/cpu.c
161
@@ -XXX,XX +XXX,XX @@
162
#include "qemu/units.h"
163
#include "qemu/cutils.h"
164
#include "qemu/qemu-print.h"
165
+#include "qemu/hw-version.h"
166
#include "cpu.h"
167
#include "tcg/helper-tcg.h"
168
#include "sysemu/reset.h"
169
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
170
index XXXXXXX..XXXXXXX 100644
171
--- a/target/s390x/cpu_models.c
172
+++ b/target/s390x/cpu_models.c
173
@@ -XXX,XX +XXX,XX @@
76
#include "qapi/error.h"
174
#include "qapi/error.h"
77
#include "cpu.h"
175
#include "qapi/visitor.h"
78
+#include "exec/address-spaces.h"
176
#include "qemu/module.h"
79
#include "sysemu/blockdev.h"
177
+#include "qemu/hw-version.h"
80
#include "sysemu/qtest.h"
178
#include "qemu/qemu-print.h"
81
#include "sysemu/reset.h"
179
#ifndef CONFIG_USER_ONLY
82
@@ -XXX,XX +XXX,XX @@ static const struct dma_irq_map omap2_dma_irq_map[] = {
180
#include "sysemu/sysemu.h"
83
{ 0, OMAP_INT_24XX_SDMA_IRQ3 },
181
diff --git a/util/osdep.c b/util/osdep.c
84
};
182
index XXXXXXX..XXXXXXX 100644
85
183
--- a/util/osdep.c
86
-struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
184
+++ b/util/osdep.c
87
- unsigned long sdram_size,
185
@@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int);
88
+struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
186
#include "qemu/error-report.h"
89
const char *cpu_type)
187
#include "qemu/madvise.h"
90
{
188
#include "qemu/mprotect.h"
91
struct omap_mpu_state_s *s = g_new0(struct omap_mpu_state_s, 1);
189
+#include "qemu/hw-version.h"
92
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
190
#include "monitor/monitor.h"
93
int i;
191
94
SysBusDevice *busdev;
192
static bool fips_enabled = false;
95
struct omap_target_agent_s *ta;
96
+ MemoryRegion *sysmem = get_system_memory();
97
98
/* Core */
99
s->mpu_model = omap2420;
100
s->cpu = ARM_CPU(cpu_create(cpu_type));
101
- s->sdram_size = sdram_size;
102
s->sram_size = OMAP242X_SRAM_SIZE;
103
104
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
105
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
106
omap_clk_init(s);
107
108
/* Memory-mapped stuff */
109
- memory_region_allocate_system_memory(&s->sdram, NULL, "omap2.dram",
110
- s->sdram_size);
111
- memory_region_add_subregion(sysmem, OMAP2_Q2_BASE, &s->sdram);
112
memory_region_init_ram(&s->sram, NULL, "omap2.sram", s->sram_size,
113
&error_fatal);
114
memory_region_add_subregion(sysmem, OMAP2_SRAM_BASE, &s->sram);
115
@@ -XXX,XX +XXX,XX @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
116
s->port->addr_valid = omap2_validate_addr;
117
118
/* Register SDRAM and SRAM ports for fast DMA transfers. */
119
- soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sdram),
120
- OMAP2_Q2_BASE, s->sdram_size);
121
+ soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(sdram),
122
+ OMAP2_Q2_BASE, memory_region_size(sdram));
123
soc_dma_port_add_mem(s->dma, memory_region_get_ram_ptr(&s->sram),
124
OMAP2_SRAM_BASE, s->sram_size);
125
126
--
193
--
127
2.20.1
194
2.25.1
128
195
129
196
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Akihiko Odaki <akihiko.odaki@gmail.com>
2
2
3
IEC binary prefixes ease code review: the unit is explicit.
3
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
4
4
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Message-id: 20220213021215.1974-1-akihiko.odaki@gmail.com
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 20191021190653.9511-2-philmd@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
8
---
11
hw/arm/xilinx_zynq.c | 3 ++-
9
MAINTAINERS | 2 ++
12
1 file changed, 2 insertions(+), 1 deletion(-)
10
1 file changed, 2 insertions(+)
13
11
14
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
12
diff --git a/MAINTAINERS b/MAINTAINERS
15
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/xilinx_zynq.c
14
--- a/MAINTAINERS
17
+++ b/hw/arm/xilinx_zynq.c
15
+++ b/MAINTAINERS
18
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@ F: audio/alsaaudio.c
19
*/
17
Core Audio framework backend
20
18
M: Gerd Hoffmann <kraxel@redhat.com>
21
#include "qemu/osdep.h"
19
R: Christian Schoenebeck <qemu_oss@crudebyte.com>
22
+#include "qemu/units.h"
20
+R: Akihiko Odaki <akihiko.odaki@gmail.com>
23
#include "qapi/error.h"
21
S: Odd Fixes
24
#include "cpu.h"
22
F: audio/coreaudio.c
25
#include "hw/sysbus.h"
23
26
@@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine)
24
@@ -XXX,XX +XXX,XX @@ F: util/drm.c
27
memory_region_add_subregion(address_space_mem, 0, ext_ram);
25
28
26
Cocoa graphics
29
/* 256K of on-chip memory */
27
M: Peter Maydell <peter.maydell@linaro.org>
30
- memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 << 10,
28
+R: Akihiko Odaki <akihiko.odaki@gmail.com>
31
+ memory_region_init_ram(ocm_ram, NULL, "zynq.ocm_ram", 256 * KiB,
29
S: Odd Fixes
32
&error_fatal);
30
F: ui/cocoa.m
33
memory_region_add_subregion(address_space_mem, 0xFFFC0000, ocm_ram);
34
31
35
--
32
--
36
2.20.1
33
2.25.1
37
34
38
35
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
2
2
3
Avoid calling arm_current_el() twice.
3
A9 gtimer includes global control field and number of per-cpu fields.
4
But only per-cpu ones are migrated. This patch adds a subsection for
5
global control field migration.
4
6
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 164422345976.2186660.1104517592452494510.stgit@pasha-ThinkPad-X280
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20191018174431.1784-14-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
target/arm/internals.h | 9 +++++++++
12
hw/timer/a9gtimer.c | 21 +++++++++++++++++++++
12
target/arm/helper.c | 12 +++++++-----
13
1 file changed, 21 insertions(+)
13
2 files changed, 16 insertions(+), 5 deletions(-)
14
14
15
diff --git a/target/arm/internals.h b/target/arm/internals.h
15
diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c
16
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/internals.h
17
--- a/hw/timer/a9gtimer.c
18
+++ b/target/arm/internals.h
18
+++ b/hw/timer/a9gtimer.c
19
@@ -XXX,XX +XXX,XX @@ void arm_cpu_update_virq(ARMCPU *cpu);
19
@@ -XXX,XX +XXX,XX @@ static void a9_gtimer_realize(DeviceState *dev, Error **errp)
20
*/
21
void arm_cpu_update_vfiq(ARMCPU *cpu);
22
23
+/**
24
+ * arm_mmu_idx_el:
25
+ * @env: The cpu environment
26
+ * @el: The EL to use.
27
+ *
28
+ * Return the full ARMMMUIdx for the translation regime for EL.
29
+ */
30
+ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el);
31
+
32
/**
33
* arm_mmu_idx:
34
* @env: The cpu environment
35
diff --git a/target/arm/helper.c b/target/arm/helper.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/helper.c
38
+++ b/target/arm/helper.c
39
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate)
40
}
41
#endif
42
43
-ARMMMUIdx arm_mmu_idx(CPUARMState *env)
44
+ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el)
45
{
46
- int el;
47
-
48
if (arm_feature(env, ARM_FEATURE_M)) {
49
return arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure);
50
}
51
52
- el = arm_current_el(env);
53
if (el < 2 && arm_is_secure_below_el3(env)) {
54
return ARMMMUIdx_S1SE0 + el;
55
} else {
56
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env)
57
}
20
}
58
}
21
}
59
22
60
+ARMMMUIdx arm_mmu_idx(CPUARMState *env)
23
+static bool vmstate_a9_gtimer_control_needed(void *opaque)
61
+{
24
+{
62
+ return arm_mmu_idx_el(env, arm_current_el(env));
25
+ A9GTimerState *s = opaque;
26
+ return s->control != 0;
63
+}
27
+}
64
+
28
+
65
int cpu_mmu_index(CPUARMState *env, bool ifetch)
29
static const VMStateDescription vmstate_a9_gtimer_per_cpu = {
66
{
30
.name = "arm.cortex-a9-global-timer.percpu",
67
return arm_to_core_mmu_idx(arm_mmu_idx(env));
31
.version_id = 1,
68
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_internal(CPUARMState *env)
32
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_a9_gtimer_per_cpu = {
69
{
33
}
70
int el = arm_current_el(env);
34
};
71
int fp_el = fp_exception_el(env, el);
35
72
- ARMMMUIdx mmu_idx = arm_mmu_idx(env);
36
+static const VMStateDescription vmstate_a9_gtimer_control = {
73
+ ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el);
37
+ .name = "arm.cortex-a9-global-timer.control",
74
38
+ .version_id = 1,
75
if (is_a64(env)) {
39
+ .minimum_version_id = 1,
76
return rebuild_hflags_a64(env, el, fp_el, mmu_idx);
40
+ .needed = vmstate_a9_gtimer_control_needed,
41
+ .fields = (VMStateField[]) {
42
+ VMSTATE_UINT32(control, A9GTimerState),
43
+ VMSTATE_END_OF_LIST()
44
+ }
45
+};
46
+
47
static const VMStateDescription vmstate_a9_gtimer = {
48
.name = "arm.cortex-a9-global-timer",
49
.version_id = 1,
50
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_a9_gtimer = {
51
1, vmstate_a9_gtimer_per_cpu,
52
A9GTimerPerCPU),
53
VMSTATE_END_OF_LIST()
54
+ },
55
+ .subsections = (const VMStateDescription*[]) {
56
+ &vmstate_a9_gtimer_control,
57
+ NULL
58
}
59
};
60
77
--
61
--
78
2.20.1
62
2.25.1
79
63
80
64
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Patrick Venture <venture@google.com>
2
2
3
Define the board with 1 GiB of RAM but some boards can have up to 2
3
This is the BMC attached to the OpenBMC Mori board.
4
GiB.
5
4
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
5
Signed-off-by: Patrick Venture <venture@google.com>
7
Reviewed-by: Joel Stanley <joel@jms.id.au>
6
Reviewed-by: Chris Rauer <crauer@google.com>
8
Message-id: 20191016090745.15334-1-clg@kaod.org
7
Reviewed-by: Ilkyun Choi <ikchoi@google.com>
8
Message-id: 20220208233104.284425-1-venture@google.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
include/hw/arm/aspeed.h | 1 +
12
docs/system/arm/nuvoton.rst | 1 +
12
hw/arm/aspeed.c | 23 +++++++++++++++++++++++
13
hw/arm/npcm7xx_boards.c | 32 ++++++++++++++++++++++++++++++++
13
2 files changed, 24 insertions(+)
14
2 files changed, 33 insertions(+)
14
15
15
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
16
diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/aspeed.h
18
--- a/docs/system/arm/nuvoton.rst
18
+++ b/include/hw/arm/aspeed.h
19
+++ b/docs/system/arm/nuvoton.rst
19
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedBoardConfig {
20
@@ -XXX,XX +XXX,XX @@ Hyperscale applications. The following machines are based on this chip :
20
const char *desc;
21
- ``quanta-gbs-bmc`` Quanta GBS server BMC
21
const char *soc_name;
22
- ``quanta-gsj`` Quanta GSJ server BMC
22
uint32_t hw_strap1;
23
- ``kudo-bmc`` Fii USA Kudo server BMC
23
+ uint32_t hw_strap2;
24
+- ``mori-bmc`` Fii USA Mori server BMC
24
const char *fmc_model;
25
25
const char *spi_model;
26
There are also two more SoCs, NPCM710 and NPCM705, which are single-core
26
uint32_t num_cs;
27
variants of NPCM750 and NPCM730, respectively. These are currently not
27
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
28
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
28
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/arm/aspeed.c
30
--- a/hw/arm/npcm7xx_boards.c
30
+++ b/hw/arm/aspeed.c
31
+++ b/hw/arm/npcm7xx_boards.c
31
@@ -XXX,XX +XXX,XX @@ struct AspeedBoardState {
32
@@ -XXX,XX +XXX,XX @@
32
/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
33
#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff
33
#define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
34
#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff
34
35
#define KUDO_BMC_POWER_ON_STRAPS 0x00001fff
35
+/* AST2600 evb hardware value */
36
+#define MORI_BMC_POWER_ON_STRAPS 0x00001fff
36
+#define AST2600_EVB_HW_STRAP1 0x000000C0
37
37
+#define AST2600_EVB_HW_STRAP2 0x00000003
38
static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin";
39
40
@@ -XXX,XX +XXX,XX @@ static void kudo_bmc_init(MachineState *machine)
41
npcm7xx_load_kernel(machine, soc);
42
}
43
44
+static void mori_bmc_init(MachineState *machine)
45
+{
46
+ NPCM7xxState *soc;
38
+
47
+
39
/*
48
+ soc = npcm7xx_create_soc(machine, MORI_BMC_POWER_ON_STRAPS);
40
* The max ram region is for firmwares that scan the address space
49
+ npcm7xx_connect_dram(soc, machine->ram);
41
* with load/store to guess how much RAM the SoC has.
50
+ qdev_realize(DEVICE(soc), NULL, &error_fatal);
42
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
51
+
43
&error_abort);
52
+ npcm7xx_load_bootrom(machine, soc);
44
object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
53
+ npcm7xx_connect_flash(&soc->fiu[1], 0, "mx66u51235f",
45
&error_abort);
54
+ drive_get(IF_MTD, 3, 0));
46
+ object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap2, "hw-strap2",
55
+
47
+ &error_abort);
56
+ npcm7xx_load_kernel(machine, soc);
48
object_property_set_int(OBJECT(&bmc->soc), cfg->num_cs, "num-cs",
49
&error_abort);
50
object_property_set_int(OBJECT(&bmc->soc), machine->smp.cpus, "num-cpus",
51
@@ -XXX,XX +XXX,XX @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc)
52
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
53
}
54
55
+static void ast2600_evb_i2c_init(AspeedBoardState *bmc)
56
+{
57
+ /* Start with some devices on our I2C busses */
58
+ ast2500_evb_i2c_init(bmc);
59
+}
57
+}
60
+
58
+
61
static void romulus_bmc_i2c_init(AspeedBoardState *bmc)
59
static void npcm7xx_set_soc_type(NPCM7xxMachineClass *nmc, const char *type)
62
{
60
{
63
AspeedSoCState *soc = &bmc->soc;
61
NPCM7xxClass *sc = NPCM7XX_CLASS(object_class_by_name(type));
64
@@ -XXX,XX +XXX,XX @@ static const AspeedBoardConfig aspeed_boards[] = {
62
@@ -XXX,XX +XXX,XX @@ static void kudo_bmc_machine_class_init(ObjectClass *oc, void *data)
65
.num_cs = 2,
63
mc->default_ram_size = 1 * GiB;
66
.i2c_init = witherspoon_bmc_i2c_init,
64
};
67
.ram = 512 * MiB,
65
66
+static void mori_bmc_machine_class_init(ObjectClass *oc, void *data)
67
+{
68
+ NPCM7xxMachineClass *nmc = NPCM7XX_MACHINE_CLASS(oc);
69
+ MachineClass *mc = MACHINE_CLASS(oc);
70
+
71
+ npcm7xx_set_soc_type(nmc, TYPE_NPCM730);
72
+
73
+ mc->desc = "Mori BMC (Cortex-A9)";
74
+ mc->init = mori_bmc_init;
75
+ mc->default_ram_size = 1 * GiB;
76
+}
77
+
78
static const TypeInfo npcm7xx_machine_types[] = {
79
{
80
.name = TYPE_NPCM7XX_MACHINE,
81
@@ -XXX,XX +XXX,XX @@ static const TypeInfo npcm7xx_machine_types[] = {
82
.name = MACHINE_TYPE_NAME("kudo-bmc"),
83
.parent = TYPE_NPCM7XX_MACHINE,
84
.class_init = kudo_bmc_machine_class_init,
68
+ }, {
85
+ }, {
69
+ .name = MACHINE_TYPE_NAME("ast2600-evb"),
86
+ .name = MACHINE_TYPE_NAME("mori-bmc"),
70
+ .desc = "Aspeed AST2600 EVB (Cortex A7)",
87
+ .parent = TYPE_NPCM7XX_MACHINE,
71
+ .soc_name = "ast2600-a0",
88
+ .class_init = mori_bmc_machine_class_init,
72
+ .hw_strap1 = AST2600_EVB_HW_STRAP1,
73
+ .hw_strap2 = AST2600_EVB_HW_STRAP2,
74
+ .fmc_model = "w25q512jv",
75
+ .spi_model = "mx66u51235f",
76
+ .num_cs = 1,
77
+ .i2c_init = ast2600_evb_i2c_init,
78
+ .ram = 1 * GiB,
79
},
89
},
80
};
90
};
81
91
82
--
92
--
83
2.20.1
93
2.25.1
84
94
85
95
diff view generated by jsdifflib
Deleted patch
1
From: Guenter Roeck <linux@roeck-us.net>
2
1
3
When booting a recent Linux kernel, the qemu message "Timer with delta
4
zero, disabling" is seen, apparently because a ptimer is started before
5
being initialized. Fix the problem by initializing the offending ptimer
6
before starting it.
7
8
The bug is effectively harmless in the old QEMUBH setup
9
because the sequence of events is:
10
* the delta zero means the timer expires immediately
11
* ptimer_reload() arranges for exynos4210_gfrc_event() to be called
12
* ptimer_reload() notices the zero delta and disables the timer
13
* later, the QEMUBH runs, and exynos4210_gfrc_event() correctly
14
configures the timer and restarts it
15
16
In the new transaction based API the bug is still harmless,
17
but differences of when the callback function runs mean the
18
message is not printed any more:
19
* ptimer_run() does nothing as it's inside a transaction block
20
* ptimer_transaction_commit() sees it has work to do and
21
calls ptimer_reload()
22
* the zero delta means the timer expires immediately
23
* ptimer_reload() calls exynos4210_gfrc_event() directly
24
* exynos4210_gfrc_event() configures the timer
25
* the delta is no longer zero so ptimer_reload() doesn't complain
26
(the zero-delta test is after the trigger-callback in
27
the ptimer_reload() function)
28
29
Regardless, the behaviour here was not intentional, and we should
30
just program the ptimer correctly to start with.
31
32
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
33
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
34
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
36
Message-id: 20191018143149.9216-1-peter.maydell@linaro.org
37
[PMM: Expansion/clarification of the commit message:
38
the message is about a zero delta, not a zero period;
39
added detail to the commit message of the analysis of what
40
is happening and why the kernel boots even with the message;
41
added note that the message goes away with the new ptimer API]
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
43
---
44
hw/timer/exynos4210_mct.c | 2 +-
45
1 file changed, 1 insertion(+), 1 deletion(-)
46
47
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/timer/exynos4210_mct.c
50
+++ b/hw/timer/exynos4210_mct.c
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,
52
/* Start FRC if transition from disabled to enabled */
53
if ((value & G_TCON_TIMER_ENABLE) > (old_val &
54
G_TCON_TIMER_ENABLE)) {
55
- exynos4210_gfrc_start(&s->g_timer);
56
+ exynos4210_gfrc_restart(s);
57
}
58
if ((value & G_TCON_TIMER_ENABLE) < (old_val &
59
G_TCON_TIMER_ENABLE)) {
60
--
61
2.20.1
62
63
diff view generated by jsdifflib
Deleted patch
1
In commit b01422622b we did an automated rename of the ptimer_init()
2
function to ptimer_init_with_bh(). Unfortunately this caught the
3
unrelated arm_mptimer_init() function. Undo that accidental
4
renaming.
5
1
6
Fixes: b01422622b7c7293196fdaf1dbb4f495af44ecf9
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Message-id: 20191017133331.5901-1-peter.maydell@linaro.org
11
---
12
hw/timer/arm_mptimer.c | 4 ++--
13
1 file changed, 2 insertions(+), 2 deletions(-)
14
15
diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/timer/arm_mptimer.c
18
+++ b/hw/timer/arm_mptimer.c
19
@@ -XXX,XX +XXX,XX @@ static void arm_mptimer_reset(DeviceState *dev)
20
}
21
}
22
23
-static void arm_mptimer_init_with_bh(Object *obj)
24
+static void arm_mptimer_init(Object *obj)
25
{
26
ARMMPTimerState *s = ARM_MPTIMER(obj);
27
28
@@ -XXX,XX +XXX,XX @@ static const TypeInfo arm_mptimer_info = {
29
.name = TYPE_ARM_MPTIMER,
30
.parent = TYPE_SYS_BUS_DEVICE,
31
.instance_size = sizeof(ARMMPTimerState),
32
- .instance_init = arm_mptimer_init_with_bh,
33
+ .instance_init = arm_mptimer_init,
34
.class_init = arm_mptimer_class_init,
35
};
36
37
--
38
2.20.1
39
40
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Create a function to compute the values of the TBFLAG_ANY bits
4
that will be cached. For now, the env->hflags variable is not
5
used, and the results are fed back to cpu_get_tb_cpu_state.
6
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20191018174431.1784-2-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/cpu.h | 29 ++++++++++++++++++-----------
13
target/arm/helper.c | 26 +++++++++++++++++++-------
14
2 files changed, 37 insertions(+), 18 deletions(-)
15
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
19
+++ b/target/arm/cpu.h
20
@@ -XXX,XX +XXX,XX @@ typedef struct CPUARMState {
21
uint32_t pstate;
22
uint32_t aarch64; /* 1 if CPU is in aarch64 state; inverse of PSTATE.nRW */
23
24
+ /* Cached TBFLAGS state. See below for which bits are included. */
25
+ uint32_t hflags;
26
+
27
/* Frequently accessed CPSR bits are stored separately for efficiency.
28
This contains all the other bits. Use cpsr_{read,write} to access
29
the whole CPSR. */
30
@@ -XXX,XX +XXX,XX @@ typedef ARMCPU ArchCPU;
31
32
#include "exec/cpu-all.h"
33
34
-/* Bit usage in the TB flags field: bit 31 indicates whether we are
35
+/*
36
+ * Bit usage in the TB flags field: bit 31 indicates whether we are
37
* in 32 or 64 bit mode. The meaning of the other bits depends on that.
38
* We put flags which are shared between 32 and 64 bit mode at the top
39
* of the word, and flags which apply to only one mode at the bottom.
40
+ *
41
+ * Unless otherwise noted, these bits are cached in env->hflags.
42
*/
43
FIELD(TBFLAG_ANY, AARCH64_STATE, 31, 1)
44
FIELD(TBFLAG_ANY, MMUIDX, 28, 3)
45
FIELD(TBFLAG_ANY, SS_ACTIVE, 27, 1)
46
-FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1)
47
+FIELD(TBFLAG_ANY, PSTATE_SS, 26, 1) /* Not cached. */
48
/* Target EL if we take a floating-point-disabled exception */
49
FIELD(TBFLAG_ANY, FPEXC_EL, 24, 2)
50
FIELD(TBFLAG_ANY, BE_DATA, 23, 1)
51
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_ANY, BE_DATA, 23, 1)
52
FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 21, 2)
53
54
/* Bit usage when in AArch32 state: */
55
-FIELD(TBFLAG_A32, THUMB, 0, 1)
56
-FIELD(TBFLAG_A32, VECLEN, 1, 3)
57
-FIELD(TBFLAG_A32, VECSTRIDE, 4, 2)
58
+FIELD(TBFLAG_A32, THUMB, 0, 1) /* Not cached. */
59
+FIELD(TBFLAG_A32, VECLEN, 1, 3) /* Not cached. */
60
+FIELD(TBFLAG_A32, VECSTRIDE, 4, 2) /* Not cached. */
61
/*
62
* We store the bottom two bits of the CPAR as TB flags and handle
63
* checks on the other bits at runtime. This shares the same bits as
64
* VECSTRIDE, which is OK as no XScale CPU has VFP.
65
+ * Not cached, because VECLEN+VECSTRIDE are not cached.
66
*/
67
FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2)
68
/*
69
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A32, XSCALE_CPAR, 4, 2)
70
* the same thing as the current security state of the processor!
71
*/
72
FIELD(TBFLAG_A32, NS, 6, 1)
73
-FIELD(TBFLAG_A32, VFPEN, 7, 1)
74
-FIELD(TBFLAG_A32, CONDEXEC, 8, 8)
75
+FIELD(TBFLAG_A32, VFPEN, 7, 1) /* Not cached. */
76
+FIELD(TBFLAG_A32, CONDEXEC, 8, 8) /* Not cached. */
77
FIELD(TBFLAG_A32, SCTLR_B, 16, 1)
78
/* For M profile only, set if FPCCR.LSPACT is set */
79
-FIELD(TBFLAG_A32, LSPACT, 18, 1)
80
+FIELD(TBFLAG_A32, LSPACT, 18, 1) /* Not cached. */
81
/* For M profile only, set if we must create a new FP context */
82
-FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1)
83
+FIELD(TBFLAG_A32, NEW_FP_CTXT_NEEDED, 19, 1) /* Not cached. */
84
/* For M profile only, set if FPCCR.S does not match current security state */
85
-FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1)
86
+FIELD(TBFLAG_A32, FPCCR_S_WRONG, 20, 1) /* Not cached. */
87
/* For M profile only, Handler (ie not Thread) mode */
88
FIELD(TBFLAG_A32, HANDLER, 21, 1)
89
/* For M profile only, whether we should generate stack-limit checks */
90
@@ -XXX,XX +XXX,XX @@ FIELD(TBFLAG_A64, SVEEXC_EL, 2, 2)
91
FIELD(TBFLAG_A64, ZCR_LEN, 4, 4)
92
FIELD(TBFLAG_A64, PAUTH_ACTIVE, 8, 1)
93
FIELD(TBFLAG_A64, BT, 9, 1)
94
-FIELD(TBFLAG_A64, BTYPE, 10, 2)
95
+FIELD(TBFLAG_A64, BTYPE, 10, 2) /* Not cached. */
96
FIELD(TBFLAG_A64, TBID, 12, 2)
97
98
static inline bool bswap_code(bool sctlr_b)
99
diff --git a/target/arm/helper.c b/target/arm/helper.c
100
index XXXXXXX..XXXXXXX 100644
101
--- a/target/arm/helper.c
102
+++ b/target/arm/helper.c
103
@@ -XXX,XX +XXX,XX @@ ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env)
104
}
105
#endif
106
107
+static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,
108
+ ARMMMUIdx mmu_idx, uint32_t flags)
109
+{
110
+ flags = FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el);
111
+ flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX,
112
+ arm_to_core_mmu_idx(mmu_idx));
113
+
114
+ if (arm_cpu_data_is_big_endian(env)) {
115
+ flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1);
116
+ }
117
+ if (arm_singlestep_active(env)) {
118
+ flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1);
119
+ }
120
+ return flags;
121
+}
122
+
123
void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
124
target_ulong *cs_base, uint32_t *pflags)
125
{
126
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
127
}
128
}
129
130
- flags = FIELD_DP32(flags, TBFLAG_ANY, MMUIDX, arm_to_core_mmu_idx(mmu_idx));
131
+ flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags);
132
133
/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
134
* states defined in the ARM ARM for software singlestep:
135
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
136
* 0 x Inactive (the TB flag for SS is always 0)
137
* 1 0 Active-pending
138
* 1 1 Active-not-pending
139
+ * SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB.
140
*/
141
- if (arm_singlestep_active(env)) {
142
- flags = FIELD_DP32(flags, TBFLAG_ANY, SS_ACTIVE, 1);
143
+ if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE)) {
144
if (is_a64(env)) {
145
if (env->pstate & PSTATE_SS) {
146
flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1);
147
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
148
}
149
}
150
}
151
- if (arm_cpu_data_is_big_endian(env)) {
152
- flags = FIELD_DP32(flags, TBFLAG_ANY, BE_DATA, 1);
153
- }
154
- flags = FIELD_DP32(flags, TBFLAG_ANY, FPEXC_EL, fp_el);
155
156
if (arm_v7m_is_handler_mode(env)) {
157
flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1);
158
--
159
2.20.1
160
161
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Create a function to compute the values of the TBFLAG_A32 bits
4
that will be cached, and are used by all profiles.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20191018174431.1784-4-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/helper.c | 16 +++++++++++-----
12
1 file changed, 11 insertions(+), 5 deletions(-)
13
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
17
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el,
19
return flags;
20
}
21
22
+static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el,
23
+ ARMMMUIdx mmu_idx, uint32_t flags)
24
+{
25
+ flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env));
26
+ flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env));
27
+
28
+ return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
29
+}
30
+
31
static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
32
ARMMMUIdx mmu_idx)
33
{
34
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
35
ARMMMUIdx mmu_idx = arm_mmu_idx(env);
36
int current_el = arm_current_el(env);
37
int fp_el = fp_exception_el(env, current_el);
38
- uint32_t flags = 0;
39
+ uint32_t flags;
40
41
if (is_a64(env)) {
42
*pc = env->pc;
43
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
44
}
45
} else {
46
*pc = env->regs[15];
47
+ flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
48
flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb);
49
flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len);
50
flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride);
51
flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits);
52
- flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env));
53
- flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env));
54
if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)
55
|| arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) {
56
flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
57
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
58
flags = FIELD_DP32(flags, TBFLAG_A32,
59
XSCALE_CPAR, env->cp15.c15_cpar);
60
}
61
-
62
- flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags);
63
}
64
65
/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
66
--
67
2.20.1
68
69
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Create a function to compute the values of the TBFLAG_A32 bits
4
that will be cached, and are used by M-profile.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20191018174431.1784-6-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/helper.c | 45 ++++++++++++++++++++++++++++++---------------
12
1 file changed, 30 insertions(+), 15 deletions(-)
13
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
17
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el,
19
return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
20
}
21
22
+static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el,
23
+ ARMMMUIdx mmu_idx)
24
+{
25
+ uint32_t flags = 0;
26
+
27
+ if (arm_v7m_is_handler_mode(env)) {
28
+ flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1);
29
+ }
30
+
31
+ /*
32
+ * v8M always applies stack limit checks unless CCR.STKOFHFNMIGN
33
+ * is suppressing them because the requested execution priority
34
+ * is less than 0.
35
+ */
36
+ if (arm_feature(env, ARM_FEATURE_V8) &&
37
+ !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) &&
38
+ (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) {
39
+ flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1);
40
+ }
41
+
42
+ return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
43
+}
44
+
45
static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
46
ARMMMUIdx mmu_idx)
47
{
48
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
49
}
50
} else {
51
*pc = env->regs[15];
52
- flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
53
+
54
+ if (arm_feature(env, ARM_FEATURE_M)) {
55
+ flags = rebuild_hflags_m32(env, fp_el, mmu_idx);
56
+ } else {
57
+ flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
58
+ }
59
+
60
flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb);
61
flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len);
62
flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride);
63
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
64
}
65
}
66
67
- if (arm_v7m_is_handler_mode(env)) {
68
- flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1);
69
- }
70
-
71
- /* v8M always applies stack limit checks unless CCR.STKOFHFNMIGN is
72
- * suppressing them because the requested execution priority is less than 0.
73
- */
74
- if (arm_feature(env, ARM_FEATURE_V8) &&
75
- arm_feature(env, ARM_FEATURE_M) &&
76
- !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) &&
77
- (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) {
78
- flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1);
79
- }
80
-
81
if (arm_feature(env, ARM_FEATURE_M_SECURITY) &&
82
FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) {
83
flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1);
84
--
85
2.20.1
86
87
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Currently a trivial wrapper for rebuild_hflags_common_32.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20191018174431.1784-8-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/helper.c | 8 +++++++-
11
1 file changed, 7 insertions(+), 1 deletion(-)
12
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el,
18
return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
19
}
20
21
+static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el,
22
+ ARMMMUIdx mmu_idx)
23
+{
24
+ return rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
25
+}
26
+
27
static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
28
ARMMMUIdx mmu_idx)
29
{
30
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
31
flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1);
32
}
33
} else {
34
- flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
35
+ flags = rebuild_hflags_a32(env, fp_el, mmu_idx);
36
}
37
38
flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb);
39
--
40
2.20.1
41
42
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Create a function to compute the values of the TBFLAG_ANY bits
4
that will be cached, and are used by A-profile.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20191018174431.1784-9-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/helper.c | 20 ++++++++++++--------
12
1 file changed, 12 insertions(+), 8 deletions(-)
13
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
17
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el,
19
return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
20
}
21
22
+static uint32_t rebuild_hflags_aprofile(CPUARMState *env)
23
+{
24
+ int flags = 0;
25
+
26
+ flags = FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL,
27
+ arm_debug_target_el(env));
28
+ return flags;
29
+}
30
+
31
static uint32_t rebuild_hflags_a32(CPUARMState *env, int fp_el,
32
ARMMMUIdx mmu_idx)
33
{
34
- return rebuild_hflags_common_32(env, fp_el, mmu_idx, 0);
35
+ uint32_t flags = rebuild_hflags_aprofile(env);
36
+ return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
37
}
38
39
static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
40
ARMMMUIdx mmu_idx)
41
{
42
+ uint32_t flags = rebuild_hflags_aprofile(env);
43
ARMMMUIdx stage1 = stage_1_mmu_idx(mmu_idx);
44
ARMVAParameters p0 = aa64_va_parameters_both(env, 0, stage1);
45
- uint32_t flags = 0;
46
uint64_t sctlr;
47
int tbii, tbid;
48
49
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
50
}
51
}
52
53
- if (!arm_feature(env, ARM_FEATURE_M)) {
54
- int target_el = arm_debug_target_el(env);
55
-
56
- flags = FIELD_DP32(flags, TBFLAG_ANY, DEBUG_TARGET_EL, target_el);
57
- }
58
-
59
*pflags = flags;
60
*cs_base = 0;
61
}
62
--
63
2.20.1
64
65
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
We do not need to compute any of these values for M-profile.
4
Further, XSCALE_CPAR overlaps VECSTRIDE so obviously the two
5
sets must be mutually exclusive.
6
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20191018174431.1784-10-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
target/arm/helper.c | 21 ++++++++++++++-------
13
1 file changed, 14 insertions(+), 7 deletions(-)
14
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
18
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
20
}
21
} else {
22
flags = rebuild_hflags_a32(env, fp_el, mmu_idx);
23
+
24
+ /*
25
+ * Note that XSCALE_CPAR shares bits with VECSTRIDE.
26
+ * Note that VECLEN+VECSTRIDE are RES0 for M-profile.
27
+ */
28
+ if (arm_feature(env, ARM_FEATURE_XSCALE)) {
29
+ flags = FIELD_DP32(flags, TBFLAG_A32,
30
+ XSCALE_CPAR, env->cp15.c15_cpar);
31
+ } else {
32
+ flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN,
33
+ env->vfp.vec_len);
34
+ flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE,
35
+ env->vfp.vec_stride);
36
+ }
37
}
38
39
flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb);
40
- flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len);
41
- flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride);
42
flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits);
43
if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30)
44
|| arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) {
45
flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
46
}
47
- /* Note that XSCALE_CPAR shares bits with VECSTRIDE */
48
- if (arm_feature(env, ARM_FEATURE_XSCALE)) {
49
- flags = FIELD_DP32(flags, TBFLAG_A32,
50
- XSCALE_CPAR, env->cp15.c15_cpar);
51
- }
52
}
53
54
/* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
55
--
56
2.20.1
57
58
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Hoist the variable load for PSTATE into the existing test vs is_a64.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20191018174431.1784-11-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/helper.c | 20 ++++++++------------
11
1 file changed, 8 insertions(+), 12 deletions(-)
12
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
18
ARMMMUIdx mmu_idx = arm_mmu_idx(env);
19
int current_el = arm_current_el(env);
20
int fp_el = fp_exception_el(env, current_el);
21
- uint32_t flags;
22
+ uint32_t flags, pstate_for_ss;
23
24
if (is_a64(env)) {
25
*pc = env->pc;
26
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
27
if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
28
flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype);
29
}
30
+ pstate_for_ss = env->pstate;
31
} else {
32
*pc = env->regs[15];
33
34
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
35
|| arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) {
36
flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1);
37
}
38
+ pstate_for_ss = env->uncached_cpsr;
39
}
40
41
- /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
42
+ /*
43
+ * The SS_ACTIVE and PSTATE_SS bits correspond to the state machine
44
* states defined in the ARM ARM for software singlestep:
45
* SS_ACTIVE PSTATE.SS State
46
* 0 x Inactive (the TB flag for SS is always 0)
47
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
48
* 1 1 Active-not-pending
49
* SS_ACTIVE is set in hflags; PSTATE_SS is computed every TB.
50
*/
51
- if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE)) {
52
- if (is_a64(env)) {
53
- if (env->pstate & PSTATE_SS) {
54
- flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1);
55
- }
56
- } else {
57
- if (env->uncached_cpsr & PSTATE_SS) {
58
- flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1);
59
- }
60
- }
61
+ if (FIELD_EX32(flags, TBFLAG_ANY, SS_ACTIVE) &&
62
+ (pstate_for_ss & PSTATE_SS)) {
63
+ flags = FIELD_DP32(flags, TBFLAG_ANY, PSTATE_SS, 1);
64
}
65
66
*pflags = flags;
67
--
68
2.20.1
69
70
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
This function assumes nothing about the current state of the cpu,
4
and writes the computed value to env->hflags.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20191018174431.1784-13-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 6 ++++++
12
target/arm/helper.c | 30 ++++++++++++++++++++++--------
13
2 files changed, 28 insertions(+), 8 deletions(-)
14
15
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu.h
18
+++ b/target/arm/cpu.h
19
@@ -XXX,XX +XXX,XX @@ void arm_register_pre_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
20
void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, void
21
*opaque);
22
23
+/**
24
+ * arm_rebuild_hflags:
25
+ * Rebuild the cached TBFLAGS for arbitrary changed processor state.
26
+ */
27
+void arm_rebuild_hflags(CPUARMState *env);
28
+
29
/**
30
* aa32_vfp_dreg:
31
* Return a pointer to the Dn register within env in 32-bit mode.
32
diff --git a/target/arm/helper.c b/target/arm/helper.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/helper.c
35
+++ b/target/arm/helper.c
36
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
37
return rebuild_hflags_common(env, fp_el, mmu_idx, flags);
38
}
39
40
+static uint32_t rebuild_hflags_internal(CPUARMState *env)
41
+{
42
+ int el = arm_current_el(env);
43
+ int fp_el = fp_exception_el(env, el);
44
+ ARMMMUIdx mmu_idx = arm_mmu_idx(env);
45
+
46
+ if (is_a64(env)) {
47
+ return rebuild_hflags_a64(env, el, fp_el, mmu_idx);
48
+ } else if (arm_feature(env, ARM_FEATURE_M)) {
49
+ return rebuild_hflags_m32(env, fp_el, mmu_idx);
50
+ } else {
51
+ return rebuild_hflags_a32(env, fp_el, mmu_idx);
52
+ }
53
+}
54
+
55
+void arm_rebuild_hflags(CPUARMState *env)
56
+{
57
+ env->hflags = rebuild_hflags_internal(env);
58
+}
59
+
60
void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
61
target_ulong *cs_base, uint32_t *pflags)
62
{
63
- ARMMMUIdx mmu_idx = arm_mmu_idx(env);
64
- int current_el = arm_current_el(env);
65
- int fp_el = fp_exception_el(env, current_el);
66
uint32_t flags, pstate_for_ss;
67
68
+ flags = rebuild_hflags_internal(env);
69
+
70
if (is_a64(env)) {
71
*pc = env->pc;
72
- flags = rebuild_hflags_a64(env, current_el, fp_el, mmu_idx);
73
if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
74
flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype);
75
}
76
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
77
*pc = env->regs[15];
78
79
if (arm_feature(env, ARM_FEATURE_M)) {
80
- flags = rebuild_hflags_m32(env, fp_el, mmu_idx);
81
-
82
if (arm_feature(env, ARM_FEATURE_M_SECURITY) &&
83
FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S)
84
!= env->v7m.secure) {
85
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
86
flags = FIELD_DP32(flags, TBFLAG_A32, LSPACT, 1);
87
}
88
} else {
89
- flags = rebuild_hflags_a32(env, fp_el, mmu_idx);
90
-
91
/*
92
* Note that XSCALE_CPAR shares bits with VECSTRIDE.
93
* Note that VECLEN+VECSTRIDE are RES0 for M-profile.
94
--
95
2.20.1
96
97
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
By performing this store early, we avoid having to save and restore
4
the register holding the address around any function calls.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20191018174431.1784-15-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/helper.c | 2 +-
12
1 file changed, 1 insertion(+), 1 deletion(-)
13
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
17
+++ b/target/arm/helper.c
18
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
19
{
20
uint32_t flags, pstate_for_ss;
21
22
+ *cs_base = 0;
23
flags = rebuild_hflags_internal(env);
24
25
if (is_a64(env)) {
26
@@ -XXX,XX +XXX,XX @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
27
}
28
29
*pflags = flags;
30
- *cs_base = 0;
31
}
32
33
#ifdef TARGET_AARCH64
34
--
35
2.20.1
36
37
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Continue setting, but not relying upon, env->hflags.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20191018174431.1784-18-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/translate-a64.c | 13 +++++++++++--
11
target/arm/translate.c | 28 +++++++++++++++++++++++-----
12
2 files changed, 34 insertions(+), 7 deletions(-)
13
14
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-a64.c
17
+++ b/target/arm/translate-a64.c
18
@@ -XXX,XX +XXX,XX @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
19
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
20
/* I/O operations must end the TB here (whether read or write) */
21
s->base.is_jmp = DISAS_UPDATE;
22
- } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
23
- /* We default to ending the TB on a coprocessor register write,
24
+ }
25
+ if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
26
+ /*
27
+ * A write to any coprocessor regiser that ends a TB
28
+ * must rebuild the hflags for the next TB.
29
+ */
30
+ TCGv_i32 tcg_el = tcg_const_i32(s->current_el);
31
+ gen_helper_rebuild_hflags_a64(cpu_env, tcg_el);
32
+ tcg_temp_free_i32(tcg_el);
33
+ /*
34
+ * We default to ending the TB on a coprocessor register write,
35
* but allow this to be suppressed by the register definition
36
* (usually only necessary to work around guest bugs).
37
*/
38
diff --git a/target/arm/translate.c b/target/arm/translate.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/target/arm/translate.c
41
+++ b/target/arm/translate.c
42
@@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn)
43
ri = get_arm_cp_reginfo(s->cp_regs,
44
ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2));
45
if (ri) {
46
+ bool need_exit_tb;
47
+
48
/* Check access permissions */
49
if (!cp_access_ok(s->current_el, ri, isread)) {
50
return 1;
51
@@ -XXX,XX +XXX,XX @@ static int disas_coproc_insn(DisasContext *s, uint32_t insn)
52
}
53
}
54
55
- if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
56
- /* I/O operations must end the TB here (whether read or write) */
57
- gen_lookup_tb(s);
58
- } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
59
- /* We default to ending the TB on a coprocessor register write,
60
+ /* I/O operations must end the TB here (whether read or write) */
61
+ need_exit_tb = ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) &&
62
+ (ri->type & ARM_CP_IO));
63
+
64
+ if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
65
+ /*
66
+ * A write to any coprocessor regiser that ends a TB
67
+ * must rebuild the hflags for the next TB.
68
+ */
69
+ TCGv_i32 tcg_el = tcg_const_i32(s->current_el);
70
+ if (arm_dc_feature(s, ARM_FEATURE_M)) {
71
+ gen_helper_rebuild_hflags_m32(cpu_env, tcg_el);
72
+ } else {
73
+ gen_helper_rebuild_hflags_a32(cpu_env, tcg_el);
74
+ }
75
+ tcg_temp_free_i32(tcg_el);
76
+ /*
77
+ * We default to ending the TB on a coprocessor register write,
78
* but allow this to be suppressed by the register definition
79
* (usually only necessary to work around guest bugs).
80
*/
81
+ need_exit_tb = true;
82
+ }
83
+ if (need_exit_tb) {
84
gen_lookup_tb(s);
85
}
86
87
--
88
2.20.1
89
90
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
The Exynos SoC has specific SDHCI registers. Use the s3c SDHCI
3
setAllowedFileTypes is deprecated in macOS 12.
4
model which handle these specific registers.
5
4
6
This silents the following "SDHC ... not implemented" warnings so
5
Per Akihiko Odaki [*]:
7
we can focus on the important registers missing:
8
6
9
$ qemu-system-arm ... -d unimp \
7
An image file, which is being chosen by the panel, can be a
10
-append "... root=/dev/mmcblk0 rootfstype=ext4 rw rootwait" \
8
raw file and have a variety of file extensions and many are not
11
-drive file=linux-build-test/rootfs/arm/rootfs-armv5.ext2,if=sd,format=raw
9
covered by the provided list (e.g. "udf"). Other platforms like
12
[...]
10
GTK can provide an option to open a file with an extension not
13
[ 25.744858] sdhci: Secure Digital Host Controller Interface driver
11
listed, but Cocoa can't. It forces the user to rename the file
14
[ 25.745862] sdhci: Copyright(c) Pierre Ossman
12
to give an extension in the list. Moreover, Cocoa does not tell
15
[ 25.783188] s3c-sdhci 12530000.sdhci: clock source 2: mmc_busclk.2 (12000000 Hz)
13
which extensions are in the list so the user needs to read the
16
SDHC rd_4b @0x80 not implemented
14
source code, which is pretty bad.
17
SDHC wr_4b @0x80 <- 0x00000020 not implemented
18
SDHC wr_4b @0x8c <- 0x00030000 not implemented
19
SDHC rd_4b @0x80 not implemented
20
SDHC wr_4b @0x80 <- 0xc0004100 not implemented
21
SDHC wr_4b @0x84 <- 0x80808080 not implemented
22
[ 26.013318] mmc0: SDHCI controller on samsung-hsmmc [12530000.sdhci] using ADMA
23
[ 26.032318] Synopsys Designware Multimedia Card Interface Driver
24
[ 42.024885] Waiting for root device /dev/mmcblk0...
25
15
16
Since this code is harming the usability rather than improving it,
17
simply remove the [NSSavePanel allowedFileTypes:] call, fixing:
18
19
[2789/6622] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o
20
ui/cocoa.m:1411:16: error: 'setAllowedFileTypes:' is deprecated: first deprecated in macOS 12.0 - Use -allowedContentTypes instead [-Werror,-Wdeprecated-declarations]
21
[openPanel setAllowedFileTypes: supportedImageFileTypes];
22
^
23
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: property 'allowedFileTypes' is declared deprecated here
24
@property (nullable, copy) NSArray<NSString *> *allowedFileTypes API_DEPRECATED("Use -allowedContentTypes instead", macos(10.3,12.0));
25
^
26
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: 'setAllowedFileTypes:' has been explicitly marked deprecated here
27
FAILED: libcommon.fa.p/ui_cocoa.m.o
28
29
[*] https://lore.kernel.org/qemu-devel/4dde2e66-63cb-4390-9538-c032310db3e3@gmail.com/
30
31
Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
32
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
33
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
34
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
26
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
35
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
27
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
36
Message-id: 20220215080307.69550-11-f4bug@amsat.org
28
Message-id: 20191005154748.21718-5-f4bug@amsat.org
37
Reviewed by: Cameron Esfahani <dirty@apple.com>
38
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
39
Tested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
40
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
41
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
30
---
42
---
31
hw/arm/exynos4210.c | 2 +-
43
ui/cocoa.m | 6 ------
32
1 file changed, 1 insertion(+), 1 deletion(-)
44
1 file changed, 6 deletions(-)
33
45
34
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
46
diff --git a/ui/cocoa.m b/ui/cocoa.m
35
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/exynos4210.c
48
--- a/ui/cocoa.m
37
+++ b/hw/arm/exynos4210.c
49
+++ b/ui/cocoa.m
38
@@ -XXX,XX +XXX,XX @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
50
@@ -XXX,XX +XXX,XX @@ static int gArgc;
39
* public datasheet which is very similar (implementing
51
static char **gArgv;
40
* MMC Specification Version 4.0 being the only difference noted)
52
static bool stretch_video;
41
*/
53
static NSTextField *pauseLabel;
42
- dev = qdev_create(NULL, TYPE_SYSBUS_SDHCI);
54
-static NSArray * supportedImageFileTypes;
43
+ dev = qdev_create(NULL, TYPE_S3C_SDHCI);
55
44
qdev_prop_set_uint64(dev, "capareg", EXYNOS4210_SDHCI_CAPABILITIES);
56
static QemuSemaphore display_init_sem;
45
qdev_init_nofail(dev);
57
static QemuSemaphore app_started_sem;
46
58
@@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView;
59
[pauseLabel setTextColor: [NSColor blackColor]];
60
[pauseLabel sizeToFit];
61
62
- // set the supported image file types that can be opened
63
- supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso", @"dmg",
64
- @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr",
65
- @"toast", nil];
66
[self make_about_window];
67
}
68
return self;
69
@@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView;
70
openPanel = [NSOpenPanel openPanel];
71
[openPanel setCanChooseFiles: YES];
72
[openPanel setAllowsMultipleSelection: NO];
73
- [openPanel setAllowedFileTypes: supportedImageFileTypes];
74
if([openPanel runModal] == NSModalResponseOK) {
75
NSString * file = [[[openPanel URLs] objectAtIndex: 0] path];
76
if(file == nil) {
47
--
77
--
48
2.20.1
78
2.25.1
49
79
50
80
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Akihiko Odaki <akihiko.odaki@gmail.com>
2
2
3
Continue setting, but not relying upon, env->hflags.
3
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
4
4
Message-id: 20220215080307.69550-13-f4bug@amsat.org
5
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-Id: <20220213021418.2155-1-akihiko.odaki@gmail.com>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20191018174431.1784-22-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
8
---
11
hw/intc/armv7m_nvic.c | 22 +++++++++++++---------
9
ui/cocoa.m | 5 -----
12
1 file changed, 13 insertions(+), 9 deletions(-)
10
1 file changed, 5 deletions(-)
13
11
14
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
12
diff --git a/ui/cocoa.m b/ui/cocoa.m
15
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/armv7m_nvic.c
14
--- a/ui/cocoa.m
17
+++ b/hw/intc/armv7m_nvic.c
15
+++ b/ui/cocoa.m
18
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
16
@@ -XXX,XX +XXX,XX @@ static void addRemovableDevicesMenuItems(void)
19
}
17
20
}
18
currentDevice = qmp_query_block(NULL);
21
nvic_irq_update(s);
19
pointerToFree = currentDevice;
22
- return MEMTX_OK;
20
- if(currentDevice == NULL) {
23
+ goto exit_ok;
21
- NSBeep();
24
case 0x200 ... 0x23f: /* NVIC Set pend */
22
- QEMU_Alert(@"Failed to query for block devices!");
25
/* the special logic in armv7m_nvic_set_pending()
23
- return;
26
* is not needed since IRQs are never escalated
24
- }
27
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
25
28
}
26
menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu];
29
}
30
nvic_irq_update(s);
31
- return MEMTX_OK;
32
+ goto exit_ok;
33
case 0x300 ... 0x33f: /* NVIC Active */
34
- return MEMTX_OK; /* R/O */
35
+ goto exit_ok; /* R/O */
36
case 0x400 ... 0x5ef: /* NVIC Priority */
37
startvec = (offset - 0x400) + NVIC_FIRST_IRQ; /* vector # */
38
39
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
40
}
41
}
42
nvic_irq_update(s);
43
- return MEMTX_OK;
44
+ goto exit_ok;
45
case 0xd18 ... 0xd1b: /* System Handler Priority (SHPR1) */
46
if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) {
47
- return MEMTX_OK;
48
+ goto exit_ok;
49
}
50
/* fall through */
51
case 0xd1c ... 0xd23: /* System Handler Priority (SHPR2, SHPR3) */
52
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
53
set_prio(s, hdlidx, sbank, newprio);
54
}
55
nvic_irq_update(s);
56
- return MEMTX_OK;
57
+ goto exit_ok;
58
case 0xd28 ... 0xd2b: /* Configurable Fault Status (CFSR) */
59
if (!arm_feature(&s->cpu->env, ARM_FEATURE_M_MAIN)) {
60
- return MEMTX_OK;
61
+ goto exit_ok;
62
}
63
/* All bits are W1C, so construct 32 bit value with 0s in
64
* the parts not written by the access size
65
@@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr,
66
*/
67
s->cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK);
68
}
69
- return MEMTX_OK;
70
+ goto exit_ok;
71
}
72
if (size == 4) {
73
nvic_writel(s, offset, value, attrs);
74
- return MEMTX_OK;
75
+ goto exit_ok;
76
}
77
qemu_log_mask(LOG_GUEST_ERROR,
78
"NVIC: Bad write of size %d at offset 0x%x\n", size, offset);
79
/* This is UNPREDICTABLE; treat as RAZ/WI */
80
+
81
+ exit_ok:
82
+ /* Ensure any changes made are reflected in the cached hflags. */
83
+ arm_rebuild_hflags(&s->cpu->env);
84
return MEMTX_OK;
85
}
86
27
87
--
28
--
88
2.20.1
29
2.25.1
89
30
90
31
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Akihiko Odaki <akihiko.odaki@gmail.com>
2
2
3
Continue setting, but not relying upon, env->hflags.
3
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
4
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Message-id: 20220215080307.69550-14-f4bug@amsat.org
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-Id: <20220213021329.2066-1-akihiko.odaki@gmail.com>
7
Message-id: 20191018174431.1784-21-richard.henderson@linaro.org
7
[PMD: Use g_autofree, suggested by Zoltan BALATON]
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
target/arm/m_helper.c | 6 ++++++
11
ui/cocoa.m | 4 +++-
11
target/arm/translate.c | 5 ++++-
12
1 file changed, 3 insertions(+), 1 deletion(-)
12
2 files changed, 10 insertions(+), 1 deletion(-)
13
13
14
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
14
diff --git a/ui/cocoa.m b/ui/cocoa.m
15
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/m_helper.c
16
--- a/ui/cocoa.m
17
+++ b/target/arm/m_helper.c
17
+++ b/ui/cocoa.m
18
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
18
@@ -XXX,XX +XXX,XX @@ static void create_initial_menus(void)
19
switch_v7m_security_state(env, dest & 1);
19
/* Returns a name for a given console */
20
env->thumb = 1;
20
static NSString * getConsoleName(QemuConsole * console)
21
env->regs[15] = dest & ~1;
21
{
22
+ arm_rebuild_hflags(env);
22
- return [NSString stringWithFormat: @"%s", qemu_console_get_label(console)];
23
+ g_autofree char *label = qemu_console_get_label(console);
24
+
25
+ return [NSString stringWithUTF8String:label];
23
}
26
}
24
27
25
void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
28
/* Add an entry to the View menu for each console */
26
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
27
switch_v7m_security_state(env, 0);
28
env->thumb = 1;
29
env->regs[15] = dest;
30
+ arm_rebuild_hflags(env);
31
}
32
33
static uint32_t *get_v7m_sp_ptr(CPUARMState *env, bool secure, bool threadmode,
34
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
35
env->regs[14] = lr;
36
env->regs[15] = addr & 0xfffffffe;
37
env->thumb = addr & 1;
38
+ arm_rebuild_hflags(env);
39
}
40
41
static void v7m_update_fpccr(CPUARMState *env, uint32_t frameptr,
42
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
43
44
/* Otherwise, we have a successful exception exit. */
45
arm_clear_exclusive(env);
46
+ arm_rebuild_hflags(env);
47
qemu_log_mask(CPU_LOG_INT, "...successful exception return\n");
48
}
49
50
@@ -XXX,XX +XXX,XX @@ static bool do_v7m_function_return(ARMCPU *cpu)
51
xpsr_write(env, 0, XPSR_IT);
52
env->thumb = newpc & 1;
53
env->regs[15] = newpc & ~1;
54
+ arm_rebuild_hflags(env);
55
56
qemu_log_mask(CPU_LOG_INT, "...function return successful\n");
57
return true;
58
@@ -XXX,XX +XXX,XX @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu)
59
switch_v7m_security_state(env, true);
60
xpsr_write(env, 0, XPSR_IT);
61
env->regs[15] += 4;
62
+ arm_rebuild_hflags(env);
63
return true;
64
65
gen_invep:
66
diff --git a/target/arm/translate.c b/target/arm/translate.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/target/arm/translate.c
69
+++ b/target/arm/translate.c
70
@@ -XXX,XX +XXX,XX @@ static bool trans_MRS_v7m(DisasContext *s, arg_MRS_v7m *a)
71
72
static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a)
73
{
74
- TCGv_i32 addr, reg;
75
+ TCGv_i32 addr, reg, el;
76
77
if (!arm_dc_feature(s, ARM_FEATURE_M)) {
78
return false;
79
@@ -XXX,XX +XXX,XX @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a)
80
gen_helper_v7m_msr(cpu_env, addr, reg);
81
tcg_temp_free_i32(addr);
82
tcg_temp_free_i32(reg);
83
+ el = tcg_const_i32(s->current_el);
84
+ gen_helper_rebuild_hflags_m32(cpu_env, el);
85
+ tcg_temp_free_i32(el);
86
gen_lookup_tb(s);
87
return true;
88
}
89
--
29
--
90
2.20.1
30
2.25.1
91
31
92
32
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
This is the payoff.
4
5
From perf record -g data of ubuntu 18 boot and shutdown:
6
7
BEFORE:
8
9
- 23.02% 2.82% qemu-system-aar [.] helper_lookup_tb_ptr
10
- 20.22% helper_lookup_tb_ptr
11
+ 10.05% tb_htable_lookup
12
- 9.13% cpu_get_tb_cpu_state
13
3.20% aa64_va_parameters_both
14
0.55% fp_exception_el
15
16
- 11.66% 4.74% qemu-system-aar [.] cpu_get_tb_cpu_state
17
- 6.96% cpu_get_tb_cpu_state
18
3.63% aa64_va_parameters_both
19
0.60% fp_exception_el
20
0.53% sve_exception_el
21
22
AFTER:
23
24
- 16.40% 3.40% qemu-system-aar [.] helper_lookup_tb_ptr
25
- 13.03% helper_lookup_tb_ptr
26
+ 11.19% tb_htable_lookup
27
0.55% cpu_get_tb_cpu_state
28
29
0.98% 0.71% qemu-system-aar [.] cpu_get_tb_cpu_state
30
31
0.87% 0.24% qemu-system-aar [.] rebuild_hflags_a64
32
33
Before, helper_lookup_tb_ptr is the second hottest function in the
34
application, consuming almost a quarter of the runtime. Within the
35
entire execution, cpu_get_tb_cpu_state consumes about 12%.
36
37
After, helper_lookup_tb_ptr has dropped to the fourth hottest function,
38
with consumption dropping to a sixth of the runtime. Within the
39
entire execution, cpu_get_tb_cpu_state has dropped below 1%, and the
40
supporting function to rebuild hflags also consumes about 1%.
41
42
Assertions are retained for --enable-debug-tcg.
43
44
Tested-by: Alex Bennée <alex.bennee@linaro.org>
45
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
46
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
47
Message-id: 20191018174431.1784-23-richard.henderson@linaro.org
48
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
49
---
50
target/arm/helper.c | 9 ++++++---
51
1 file changed, 6 insertions(+), 3 deletions(-)
52
53
diff --git a/target/arm/helper.c b/target/arm/helper.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/target/arm/helper.c
56
+++ b/target/arm/helper.c
57
@@ -XXX,XX +XXX,XX @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env, int el)
58
void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
59
target_ulong *cs_base, uint32_t *pflags)
60
{
61
- uint32_t flags, pstate_for_ss;
62
+ uint32_t flags = env->hflags;
63
+ uint32_t pstate_for_ss;
64
65
*cs_base = 0;
66
- flags = rebuild_hflags_internal(env);
67
+#ifdef CONFIG_DEBUG_TCG
68
+ assert(flags == rebuild_hflags_internal(env));
69
+#endif
70
71
- if (is_a64(env)) {
72
+ if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) {
73
*pc = env->pc;
74
if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
75
flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype);
76
--
77
2.20.1
78
79
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
The SDRAM is incorrectly created in the SA1110 SoC.
4
Move its creation in the board code, this will later allow the
5
board to have the QOM ownership of the RAM.
6
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20191021190653.9511-4-philmd@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/strongarm.h | 4 +---
14
hw/arm/collie.c | 8 ++++++--
15
hw/arm/strongarm.c | 7 +------
16
3 files changed, 8 insertions(+), 11 deletions(-)
17
18
diff --git a/hw/arm/strongarm.h b/hw/arm/strongarm.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/strongarm.h
21
+++ b/hw/arm/strongarm.h
22
@@ -XXX,XX +XXX,XX @@ enum {
23
24
typedef struct {
25
ARMCPU *cpu;
26
- MemoryRegion sdram;
27
DeviceState *pic;
28
DeviceState *gpio;
29
DeviceState *ppc;
30
@@ -XXX,XX +XXX,XX @@ typedef struct {
31
SSIBus *ssp_bus;
32
} StrongARMState;
33
34
-StrongARMState *sa1110_init(MemoryRegion *sysmem,
35
- unsigned int sdram_size, const char *rev);
36
+StrongARMState *sa1110_init(const char *cpu_type);
37
38
#endif
39
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/hw/arm/collie.c
42
+++ b/hw/arm/collie.c
43
@@ -XXX,XX +XXX,XX @@ static void collie_init(MachineState *machine)
44
{
45
StrongARMState *s;
46
DriveInfo *dinfo;
47
- MemoryRegion *sysmem = get_system_memory();
48
+ MemoryRegion *sdram = g_new(MemoryRegion, 1);
49
50
- s = sa1110_init(sysmem, collie_binfo.ram_size, machine->cpu_type);
51
+ s = sa1110_init(machine->cpu_type);
52
+
53
+ memory_region_allocate_system_memory(sdram, NULL, "strongarm.sdram",
54
+ collie_binfo.ram_size);
55
+ memory_region_add_subregion(get_system_memory(), SA_SDCS0, sdram);
56
57
dinfo = drive_get(IF_PFLASH, 0, 0);
58
pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000,
59
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/hw/arm/strongarm.c
62
+++ b/hw/arm/strongarm.c
63
@@ -XXX,XX +XXX,XX @@ static const TypeInfo strongarm_ssp_info = {
64
};
65
66
/* Main CPU functions */
67
-StrongARMState *sa1110_init(MemoryRegion *sysmem,
68
- unsigned int sdram_size, const char *cpu_type)
69
+StrongARMState *sa1110_init(const char *cpu_type)
70
{
71
StrongARMState *s;
72
int i;
73
@@ -XXX,XX +XXX,XX @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,
74
75
s->cpu = ARM_CPU(cpu_create(cpu_type));
76
77
- memory_region_allocate_system_memory(&s->sdram, NULL, "strongarm.sdram",
78
- sdram_size);
79
- memory_region_add_subregion(sysmem, SA_SDCS0, &s->sdram);
80
-
81
s->pic = sysbus_create_varargs("strongarm_pic", 0x90050000,
82
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_IRQ),
83
qdev_get_gpio_in(DEVICE(s->cpu), ARM_CPU_FIQ),
84
--
85
2.20.1
86
87
diff view generated by jsdifflib