1
A big pullreq by number of patches, but most of them are just docs
1
Hi; this is the latest target-arm queue. Most of the patches
2
updates or MAINTAINERS file fixes. The actual code changes are pretty
2
here are RTH's FEAT_HAFDBS finally landing. I've also included
3
minimal bugfixes.
3
the RNG-seed randomization patches from Jason, as well as a few
4
more minor things. The patches include a couple of regression
5
fixes:
6
* the resettable patch fixes a SCSI reset regression
7
* the 'do not re-randomize on snapshot load' patches fix
8
record-and-replay regressions
4
9
5
thanks
10
thanks
6
-- PMM
11
-- PMM
7
12
8
The following changes since commit 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
13
The following changes since commit e750a7ace492f0b450653d4ad368a77d6f660fb8:
9
14
10
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122' into staging (2020-11-22 15:02:52 +0000)
15
Merge tag 'pull-9p-20221024' of https://github.com/cschoenebeck/qemu into staging (2022-10-24 14:27:12 -0400)
11
16
12
are available in the Git repository at:
17
are available in the Git repository at:
13
18
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201123
19
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20221025
15
20
16
for you to fetch changes up to c6ff78563ad2971f289168c7cae6ecb0b4359516:
21
for you to fetch changes up to e2114f701c78f76246e4b1872639dad94a6bdd21:
17
22
18
docs/system/pr-manager.rst: Fix minor docs nits (2020-11-23 11:10:04 +0000)
23
rx: re-randomize rng-seed on reboot (2022-10-25 17:32:24 +0100)
19
24
20
----------------------------------------------------------------
25
----------------------------------------------------------------
21
target-arm queue:
26
target-arm queue:
22
* incorporate 'orphan' rST docs into manuals
27
* Implement FEAT_E0PD
23
* linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
28
* Implement FEAT_HAFDBS
24
* target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
29
* honor HCR_E2H and HCR_TGE in arm_excp_unmasked()
25
* document raspi boards and tosa
30
* hw/arm/virt: Fix devicetree warnings about the virtio-iommu node
26
* docs/system: Deprecate raspi2/raspi3 machine aliases
31
* hw/core/resettable: fix reset level counting
27
* docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
32
* hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset()
28
* MAINTAINERS: add lines for docs files for Arm boards
33
* imx: reload cmp timer outside of the reload ptimer transaction
29
* hw/intc: fix heap-buffer-overflow in rxicu_realize()
34
* x86: do not re-randomize RNG seed on snapshot load
30
* hw/arm: Fix bad print format specifiers
35
* m68k/virt: do not re-randomize RNG seed on snapshot load
31
* target/arm: fix stage 2 page-walks in 32-bit emulation
36
* m68k/q800: do not re-randomize RNG seed on snapshot load
37
* arm: re-randomize rng-seed on reboot
38
* riscv: re-randomize rng-seed on reboot
39
* mips/boston: re-randomize rng-seed on reboot
40
* openrisc: re-randomize rng-seed on reboot
41
* rx: re-randomize rng-seed on reboot
32
42
33
----------------------------------------------------------------
43
----------------------------------------------------------------
34
AlexChen (1):
44
Ake Koomsin (1):
35
hw/arm: Fix bad print format specifiers
45
target/arm: honor HCR_E2H and HCR_TGE in arm_excp_unmasked()
36
46
37
Chen Qun (1):
47
Axel Heider (1):
38
hw/intc: fix heap-buffer-overflow in rxicu_realize()
48
target/imx: reload cmp timer outside of the reload ptimer transaction
39
49
40
Peter Maydell (11):
50
Damien Hedde (1):
41
target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
51
hw/core/resettable: fix reset level counting
42
linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
43
docs: Move virtio-net-failover.rst into the system manual
44
docs: Move cpu-hotplug.rst into the system manual
45
docs: Move virtio-pmem.rst into the system manual
46
docs/system/virtio-pmem.rst: Fix minor style issues
47
docs: Split out 'pc' machine model docs into their own file
48
docs: Move microvm.rst into the system manual
49
docs: Move pr-manager.rst into the system manual
50
docs: Split qemu-pr-helper documentation into tools manual
51
docs/system/pr-manager.rst: Fix minor docs nits
52
52
53
Philippe Mathieu-Daudé (10):
53
Jason A. Donenfeld (10):
54
MAINTAINERS: Cover system/arm/cpu-features.rst with ARM TCG CPUs
54
reset: allow registering handlers that aren't called by snapshot loading
55
MAINTAINERS: Cover system/arm/aspeed.rst with ASPEED BMC machines
55
device-tree: add re-randomization helper function
56
MAINTAINERS: Cover system/arm/nuvoton.rst with Nuvoton NPCM7xx
56
x86: do not re-randomize RNG seed on snapshot load
57
MAINTAINERS: Fix system/arm/orangepi.rst path
57
arm: re-randomize rng-seed on reboot
58
MAINTAINERS: Cover system/arm/sbsa.rst with SBSA-REF machine
58
riscv: re-randomize rng-seed on reboot
59
MAINTAINERS: Cover system/arm/sx1.rst with OMAP machines
59
m68k/virt: do not re-randomize RNG seed on snapshot load
60
docs/system: Deprecate raspi2/raspi3 machine aliases
60
m68k/q800: do not re-randomize RNG seed on snapshot load
61
docs/system/arm: Document the various raspi boards
61
mips/boston: re-randomize rng-seed on reboot
62
docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
62
openrisc: re-randomize rng-seed on reboot
63
docs/system/arm: Document the Sharp Zaurus SL-6000
63
rx: re-randomize rng-seed on reboot
64
64
65
Rémi Denis-Courmont (1):
65
Jean-Philippe Brucker (1):
66
target/arm: fix stage 2 page-walks in 32-bit emulation
66
hw/arm/virt: Fix devicetree warnings about the virtio-iommu node
67
67
68
docs/meson.build | 1 +
68
Peter Maydell (2):
69
docs/system/arm/aspeed.rst | 1 +
69
target/arm: Implement FEAT_E0PD
70
docs/system/arm/raspi.rst | 43 +++++++++++++++
70
hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset()
71
docs/system/arm/xscale.rst | 20 ++++---
72
docs/{ => system}/cpu-hotplug.rst | 0
73
docs/system/deprecated.rst | 7 +++
74
docs/{ => system/i386}/microvm.rst | 5 +-
75
docs/system/i386/pc.rst | 7 +++
76
docs/system/index.rst | 4 ++
77
docs/{ => system}/pr-manager.rst | 44 +++------------
78
docs/system/target-arm.rst | 1 +
79
docs/system/target-i386.rst | 19 +++++--
80
docs/{ => system}/virtio-net-failover.rst | 0
81
docs/system/virtio-pmem.rst | 76 ++++++++++++++++++++++++++
82
docs/tools/conf.py | 2 +
83
docs/tools/index.rst | 1 +
84
docs/tools/qemu-pr-helper.rst | 90 +++++++++++++++++++++++++++++++
85
docs/virtio-pmem.rst | 76 --------------------------
86
hw/arm/pxa2xx.c | 2 +-
87
hw/arm/spitz.c | 2 +-
88
hw/arm/tosa.c | 2 +-
89
hw/intc/rx_icu.c | 18 +++----
90
linux-user/arm/cpu_loop.c | 28 ++++++++++
91
target/arm/arm-semi.c | 12 +++--
92
target/arm/helper.c | 4 +-
93
MAINTAINERS | 8 ++-
94
26 files changed, 326 insertions(+), 147 deletions(-)
95
create mode 100644 docs/system/arm/raspi.rst
96
rename docs/{ => system}/cpu-hotplug.rst (100%)
97
rename docs/{ => system/i386}/microvm.rst (98%)
98
create mode 100644 docs/system/i386/pc.rst
99
rename docs/{ => system}/pr-manager.rst (68%)
100
rename docs/{ => system}/virtio-net-failover.rst (100%)
101
create mode 100644 docs/system/virtio-pmem.rst
102
create mode 100644 docs/tools/qemu-pr-helper.rst
103
delete mode 100644 docs/virtio-pmem.rst
104
71
72
Richard Henderson (14):
73
target/arm: Introduce regime_is_stage2
74
target/arm: Add ptw_idx to S1Translate
75
target/arm: Add isar predicates for FEAT_HAFDBS
76
target/arm: Extract HA and HD in aa64_va_parameters
77
target/arm: Move S1_ptw_translate outside arm_ld[lq]_ptw
78
target/arm: Add ARMFault_UnsuppAtomicUpdate
79
target/arm: Remove loop from get_phys_addr_lpae
80
target/arm: Fix fault reporting in get_phys_addr_lpae
81
target/arm: Don't shift attrs in get_phys_addr_lpae
82
target/arm: Consider GP an attribute in get_phys_addr_lpae
83
target/arm: Tidy merging of attributes from descriptor and table
84
target/arm: Implement FEAT_HAFDBS, access flag portion
85
target/arm: Implement FEAT_HAFDBS, dirty bit portion
86
target/arm: Use the max page size in a 2-stage ptw
87
88
docs/devel/reset.rst | 8 +-
89
docs/system/arm/emulation.rst | 2 +
90
qapi/run-state.json | 6 +-
91
include/hw/boards.h | 2 +-
92
include/sysemu/device_tree.h | 9 +
93
include/sysemu/reset.h | 5 +-
94
target/arm/cpu.h | 15 ++
95
target/arm/internals.h | 30 +++
96
hw/arm/aspeed.c | 4 +-
97
hw/arm/boot.c | 2 +
98
hw/arm/mps2-tz.c | 4 +-
99
hw/arm/virt.c | 5 +-
100
hw/core/reset.c | 17 +-
101
hw/core/resettable.c | 3 +-
102
hw/hppa/machine.c | 4 +-
103
hw/hyperv/hyperv.c | 2 +-
104
hw/i386/microvm.c | 4 +-
105
hw/i386/pc.c | 6 +-
106
hw/i386/x86.c | 2 +-
107
hw/m68k/q800.c | 33 ++-
108
hw/m68k/virt.c | 20 +-
109
hw/mips/boston.c | 3 +
110
hw/openrisc/boot.c | 3 +
111
hw/ppc/pegasos2.c | 4 +-
112
hw/ppc/pnv.c | 4 +-
113
hw/ppc/spapr.c | 4 +-
114
hw/riscv/boot.c | 3 +
115
hw/rx/rx-gdbsim.c | 3 +
116
hw/s390x/s390-virtio-ccw.c | 4 +-
117
hw/timer/imx_epit.c | 9 +-
118
migration/savevm.c | 2 +-
119
softmmu/device_tree.c | 21 ++
120
softmmu/runstate.c | 11 +-
121
target/arm/cpu.c | 24 +-
122
target/arm/cpu64.c | 2 +
123
target/arm/helper.c | 31 ++-
124
target/arm/ptw.c | 524 +++++++++++++++++++++++++++---------------
125
37 files changed, 572 insertions(+), 263 deletions(-)
diff view generated by jsdifflib
1
The Linux kernel doesn't use the official bkpt insn for breakpoints;
1
FEAT_E0PD adds new bits E0PD0 and E0PD1 to TCR_EL1, which allow the
2
instead it uses three instructions in the guaranteed-to-UNDEF space,
2
OS to forbid EL0 access to half of the address space. Since this is
3
and generates SIGTRAP for these rather than the SIGILL that most
3
an EL0-specific variation on the existing TCR_ELx.{EPD0,EPD1}, we can
4
UNDEF insns generate:
4
implement it entirely in aa64_va_parameters().
5
5
6
https://elixir.bootlin.com/linux/v5.9.8/source/arch/arm/kernel/ptrace.c#L197
6
This requires moving the existing regime_is_user() to internals.h
7
so that the code in helper.c can get at it.
7
8
8
Make QEMU treat these insns specially too. The main benefit of this
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
is that if you're running a debugger on a guest program that runs
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
into a GCC __builtin_trap() or LLVM "trap because execution should
11
Message-id: 20221021160131.3531787-1-peter.maydell@linaro.org
11
never reach here" then you'll get the expected signal rather than a
12
---
12
SIGILL.
13
docs/system/arm/emulation.rst | 1 +
14
target/arm/cpu.h | 5 +++++
15
target/arm/internals.h | 19 +++++++++++++++++++
16
target/arm/cpu64.c | 1 +
17
target/arm/helper.c | 9 +++++++++
18
target/arm/ptw.c | 19 -------------------
19
6 files changed, 35 insertions(+), 19 deletions(-)
13
20
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20201117155634.6924-1-peter.maydell@linaro.org
17
---
18
linux-user/arm/cpu_loop.c | 28 ++++++++++++++++++++++++++++
19
1 file changed, 28 insertions(+)
20
21
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
22
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
23
--- a/linux-user/arm/cpu_loop.c
23
--- a/docs/system/arm/emulation.rst
24
+++ b/linux-user/arm/cpu_loop.c
24
+++ b/docs/system/arm/emulation.rst
25
@@ -XXX,XX +XXX,XX @@ do_kernel_trap(CPUARMState *env)
25
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
26
return 0;
26
- FEAT_Debugv8p4 (Debug changes for v8.4)
27
- FEAT_DotProd (Advanced SIMD dot product instructions)
28
- FEAT_DoubleFault (Double Fault Extension)
29
+- FEAT_E0PD (Preventing EL0 access to halves of address maps)
30
- FEAT_ETS (Enhanced Translation Synchronization)
31
- FEAT_FCMA (Floating-point complex number instructions)
32
- FEAT_FHM (Floating-point half-precision multiplication instructions)
33
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
34
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/cpu.h
36
+++ b/target/arm/cpu.h
37
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_lva(const ARMISARegisters *id)
38
return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, VARANGE) != 0;
27
}
39
}
28
40
29
+static bool insn_is_linux_bkpt(uint32_t opcode, bool is_thumb)
41
+static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id)
30
+{
42
+{
31
+ /*
43
+ return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0;
32
+ * Return true if this insn is one of the three magic UDF insns
44
+}
33
+ * which the kernel treats as breakpoint insns.
45
+
34
+ */
46
static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id)
35
+ if (!is_thumb) {
47
{
36
+ return (opcode & 0x0fffffff) == 0x07f001f0;
48
return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0;
37
+ } else {
49
diff --git a/target/arm/internals.h b/target/arm/internals.h
38
+ /*
50
index XXXXXXX..XXXXXXX 100644
39
+ * Note that we get the two halves of the 32-bit T32 insn
51
--- a/target/arm/internals.h
40
+ * in the opposite order to the value the kernel uses in
52
+++ b/target/arm/internals.h
41
+ * its undef_hook struct.
53
@@ -XXX,XX +XXX,XX @@ static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx)
42
+ */
54
}
43
+ return ((opcode & 0xffff) == 0xde01) || (opcode == 0xa000f7f0);
55
}
56
57
+static inline bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx)
58
+{
59
+ switch (mmu_idx) {
60
+ case ARMMMUIdx_E20_0:
61
+ case ARMMMUIdx_Stage1_E0:
62
+ case ARMMMUIdx_MUser:
63
+ case ARMMMUIdx_MSUser:
64
+ case ARMMMUIdx_MUserNegPri:
65
+ case ARMMMUIdx_MSUserNegPri:
66
+ return true;
67
+ default:
68
+ return false;
69
+ case ARMMMUIdx_E10_0:
70
+ case ARMMMUIdx_E10_1:
71
+ case ARMMMUIdx_E10_1_PAN:
72
+ g_assert_not_reached();
44
+ }
73
+ }
45
+}
74
+}
46
+
75
+
47
void cpu_loop(CPUARMState *env)
76
/* Return the SCTLR value which controls this address translation regime */
77
static inline uint64_t regime_sctlr(CPUARMState *env, ARMMMUIdx mmu_idx)
48
{
78
{
49
CPUState *cs = env_cpu(env);
79
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
50
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
80
index XXXXXXX..XXXXXXX 100644
51
/* FIXME - what to do if get_user() fails? */
81
--- a/target/arm/cpu64.c
52
get_user_code_u32(opcode, env->regs[15], env);
82
+++ b/target/arm/cpu64.c
53
83
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
54
+ /*
84
t = FIELD_DP64(t, ID_AA64MMFR2, FWB, 1); /* FEAT_S2FWB */
55
+ * The Linux kernel treats some UDF patterns specially
85
t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */
56
+ * to use as breakpoints (instead of the architectural
86
t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */
57
+ * bkpt insn). These should trigger a SIGTRAP rather
87
+ t = FIELD_DP64(t, ID_AA64MMFR2, E0PD, 1); /* FEAT_E0PD */
58
+ * than SIGILL.
88
cpu->isar.id_aa64mmfr2 = t;
59
+ */
89
60
+ if (insn_is_linux_bkpt(opcode, env->thumb)) {
90
t = cpu->isar.id_aa64zfr0;
61
+ goto excp_debug;
91
diff --git a/target/arm/helper.c b/target/arm/helper.c
62
+ }
92
index XXXXXXX..XXXXXXX 100644
93
--- a/target/arm/helper.c
94
+++ b/target/arm/helper.c
95
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
96
ps = extract32(tcr, 16, 3);
97
ds = extract64(tcr, 32, 1);
98
} else {
99
+ bool e0pd;
63
+
100
+
64
rc = EmulateAll(opcode, &ts->fpa, env);
101
/*
65
if (rc == 0) { /* illegal instruction */
102
* Bit 55 is always between the two regions, and is canonical for
66
info.si_signo = TARGET_SIGILL;
103
* determining if address tagging is enabled.
104
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
105
epd = extract32(tcr, 7, 1);
106
sh = extract32(tcr, 12, 2);
107
hpd = extract64(tcr, 41, 1);
108
+ e0pd = extract64(tcr, 55, 1);
109
} else {
110
tsz = extract32(tcr, 16, 6);
111
gran = tg1_to_gran_size(extract32(tcr, 30, 2));
112
epd = extract32(tcr, 23, 1);
113
sh = extract32(tcr, 28, 2);
114
hpd = extract64(tcr, 42, 1);
115
+ e0pd = extract64(tcr, 56, 1);
116
}
117
ps = extract64(tcr, 32, 3);
118
ds = extract64(tcr, 59, 1);
119
+
120
+ if (e0pd && cpu_isar_feature(aa64_e0pd, cpu) &&
121
+ regime_is_user(env, mmu_idx)) {
122
+ epd = true;
123
+ }
124
}
125
126
gran = sanitize_gran_size(cpu, gran, stage2);
127
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
128
index XXXXXXX..XXXXXXX 100644
129
--- a/target/arm/ptw.c
130
+++ b/target/arm/ptw.c
131
@@ -XXX,XX +XXX,XX @@ static bool regime_translation_big_endian(CPUARMState *env, ARMMMUIdx mmu_idx)
132
return (regime_sctlr(env, mmu_idx) & SCTLR_EE) != 0;
133
}
134
135
-static bool regime_is_user(CPUARMState *env, ARMMMUIdx mmu_idx)
136
-{
137
- switch (mmu_idx) {
138
- case ARMMMUIdx_E20_0:
139
- case ARMMMUIdx_Stage1_E0:
140
- case ARMMMUIdx_MUser:
141
- case ARMMMUIdx_MSUser:
142
- case ARMMMUIdx_MUserNegPri:
143
- case ARMMMUIdx_MSUserNegPri:
144
- return true;
145
- default:
146
- return false;
147
- case ARMMMUIdx_E10_0:
148
- case ARMMMUIdx_E10_1:
149
- case ARMMMUIdx_E10_1_PAN:
150
- g_assert_not_reached();
151
- }
152
-}
153
-
154
/* Return the TTBR associated with this translation regime */
155
static uint64_t regime_ttbr(CPUARMState *env, ARMMMUIdx mmu_idx, int ttbrn)
156
{
67
--
157
--
68
2.20.1
158
2.25.1
69
70
diff view generated by jsdifflib
New patch
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
1
2
3
The "PCI Bus Binding to: IEEE Std 1275-1994" defines the compatible
4
string for a PCIe bus or endpoint as "pci<vendorid>,<deviceid>" or
5
similar. Since the initial binding for PCI virtio-iommu didn't follow
6
this rule, it was modified to accept both strings and ensure backward
7
compatibility. Also, the unit-name for the node should be
8
"device,function".
9
10
Fix corresponding dt-validate and dtc warnings:
11
12
pcie@10000000: virtio_iommu@16:compatible: ['virtio,pci-iommu'] does not contain items matching the given schema
13
pcie@10000000: Unevaluated properties are not allowed (... 'virtio_iommu@16' were unexpected)
14
From schema: linux/Documentation/devicetree/bindings/pci/host-generic-pci.yaml
15
virtio_iommu@16: compatible: 'oneOf' conditional failed, one must be fixed:
16
['virtio,pci-iommu'] is too short
17
'pci1af4,1057' was expected
18
From schema: dtschema/schemas/pci/pci-bus.yaml
19
20
Warning (pci_device_reg): /pcie@10000000/virtio_iommu@16: PCI unit address format error, expected "2,0"
21
22
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
23
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
26
hw/arm/virt.c | 5 +++--
27
1 file changed, 3 insertions(+), 2 deletions(-)
28
29
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/arm/virt.c
32
+++ b/hw/arm/virt.c
33
@@ -XXX,XX +XXX,XX @@ static void create_smmu(const VirtMachineState *vms,
34
35
static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
36
{
37
- const char compat[] = "virtio,pci-iommu";
38
+ const char compat[] = "virtio,pci-iommu\0pci1af4,1057";
39
uint16_t bdf = vms->virtio_iommu_bdf;
40
MachineState *ms = MACHINE(vms);
41
char *node;
42
43
vms->iommu_phandle = qemu_fdt_alloc_phandle(ms->fdt);
44
45
- node = g_strdup_printf("%s/virtio_iommu@%d", vms->pciehb_nodename, bdf);
46
+ node = g_strdup_printf("%s/virtio_iommu@%x,%x", vms->pciehb_nodename,
47
+ PCI_SLOT(bdf), PCI_FUNC(bdf));
48
qemu_fdt_add_subnode(ms->fdt, node);
49
qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat));
50
qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg",
51
--
52
2.25.1
diff view generated by jsdifflib
New patch
1
From: Ake Koomsin <ake@igel.co.jp>
1
2
3
An exception targeting EL2 from lower EL is actually maskable when
4
HCR_E2H and HCR_TGE are both set. This applies to both secure and
5
non-secure Security state.
6
7
We can remove the conditions that try to suppress masking of
8
interrupts when we are Secure and the exception targets EL2 and
9
Secure EL2 is disabled. This is OK because in that situation
10
arm_phys_excp_target_el() will never return 2 as the target EL. The
11
'not if secure' check in this function was originally written before
12
arm_hcr_el2_eff(), and back then the target EL returned by
13
arm_phys_excp_target_el() could be 2 even if we were in Secure
14
EL0/EL1; but it is no longer needed.
15
16
Signed-off-by: Ake Koomsin <ake@igel.co.jp>
17
Message-id: 20221017092432.546881-1-ake@igel.co.jp
18
[PMM: Add commit message paragraph explaining why it's OK to
19
remove the checks on secure and SCR_EEL2]
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
23
target/arm/cpu.c | 24 +++++++++++++++++-------
24
1 file changed, 17 insertions(+), 7 deletions(-)
25
26
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/cpu.c
29
+++ b/target/arm/cpu.c
30
@@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
31
if ((target_el > cur_el) && (target_el != 1)) {
32
/* Exceptions targeting a higher EL may not be maskable */
33
if (arm_feature(env, ARM_FEATURE_AARCH64)) {
34
- /*
35
- * 64-bit masking rules are simple: exceptions to EL3
36
- * can't be masked, and exceptions to EL2 can only be
37
- * masked from Secure state. The HCR and SCR settings
38
- * don't affect the masking logic, only the interrupt routing.
39
- */
40
- if (target_el == 3 || !secure || (env->cp15.scr_el3 & SCR_EEL2)) {
41
+ switch (target_el) {
42
+ case 2:
43
+ /*
44
+ * According to ARM DDI 0487H.a, an interrupt can be masked
45
+ * when HCR_E2H and HCR_TGE are both set regardless of the
46
+ * current Security state. Note that we need to revisit this
47
+ * part again once we need to support NMI.
48
+ */
49
+ if ((hcr_el2 & (HCR_E2H | HCR_TGE)) != (HCR_E2H | HCR_TGE)) {
50
+ unmasked = true;
51
+ }
52
+ break;
53
+ case 3:
54
+ /* Interrupt cannot be masked when the target EL is 3 */
55
unmasked = true;
56
+ break;
57
+ default:
58
+ g_assert_not_reached();
59
}
60
} else {
61
/*
62
--
63
2.25.1
diff view generated by jsdifflib
1
Fix a couple of nits in pr-manager.rst:
1
From: Damien Hedde <damien.hedde@greensocs.com>
2
* the title marker for the top level heading is overlength
3
* stray capital 'R' in the middle of a sentence
4
2
3
The code for handling the reset level count in the Resettable code
4
has two issues:
5
6
The reset count is only decremented for the 1->0 case. This means
7
that if there's ever a nested reset that takes the count to 2 then it
8
will never again be decremented. Eventually the count will exceed
9
the '50' limit in resettable_phase_enter() and QEMU will trip over
10
the assertion failure. The repro case in issue 1266 is an example of
11
this that happens now the SCSI subsystem uses three-phase reset.
12
13
Secondly, the count is decremented only after the exit phase handler
14
is called. Moving the reset count decrement from "just after" to
15
"just before" calling the exit phase handler allows
16
resettable_is_in_reset() to return false during the handler
17
execution.
18
19
This simplifies reset handling in resettable devices. Typically, a
20
function that updates the device state will just need to read the
21
current reset state and not anymore treat the "in a reset-exit
22
transition" as a special case.
23
24
Note that the semantics change to the *_is_in_reset() functions
25
will have no effect on the current codebase, because only two
26
devices (hw/char/cadence_uart.c and hw/misc/zynq_sclr.c) currently
27
call those functions, and in neither case do they do it from the
28
device's exit phase methed.
29
30
Fixes: 4a5fc890 ("scsi: Use device_cold_reset() and bus_cold_reset()")
31
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1266
32
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
34
Reported-by: Michael Peter <michael.peter@hensoldt-cyber.com>
35
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
36
Message-id: 20221020142749.3357951-1-peter.maydell@linaro.org
37
Buglink: https://bugs.launchpad.net/qemu/+bug/1905297
38
Reported-by: Michael Peter <michael.peter@hensoldt-cyber.com>
39
[PMM: adjust the docs paragraph changed to get the name of the
40
'enter' phase right and to clarify exactly when the count is
41
adjusted; rewrite the commit message]
42
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
43
---
8
docs/system/pr-manager.rst | 6 +++---
44
docs/devel/reset.rst | 8 +++++---
9
1 file changed, 3 insertions(+), 3 deletions(-)
45
hw/core/resettable.c | 3 +--
46
2 files changed, 6 insertions(+), 5 deletions(-)
10
47
11
diff --git a/docs/system/pr-manager.rst b/docs/system/pr-manager.rst
48
diff --git a/docs/devel/reset.rst b/docs/devel/reset.rst
12
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
13
--- a/docs/system/pr-manager.rst
50
--- a/docs/devel/reset.rst
14
+++ b/docs/system/pr-manager.rst
51
+++ b/docs/devel/reset.rst
15
@@ -XXX,XX +XXX,XX @@
52
@@ -XXX,XX +XXX,XX @@ Polling the reset state
16
-======================================
53
Resettable interface provides the ``resettable_is_in_reset()`` function.
17
+===============================
54
This function returns true if the object parameter is currently under reset.
18
Persistent reservation managers
55
19
-======================================
56
-An object is under reset from the beginning of the *init* phase to the end of
20
+===============================
57
-the *exit* phase. During all three phases, the function will return that the
21
58
-object is in reset.
22
-SCSI persistent Reservations allow restricting access to block devices
59
+An object is under reset from the beginning of the *enter* phase (before
23
+SCSI persistent reservations allow restricting access to block devices
60
+either its children or its own enter method is called) to the *exit*
24
to specific initiators in a shared storage setup. When implementing
61
+phase. During *enter* and *hold* phase only, the function will return that the
25
clustering of virtual machines, it is a common requirement for virtual
62
+object is in reset. The state is changed after the *exit* is propagated to
26
machines to send persistent reservation SCSI commands. However,
63
+its children and just before calling the object's own *exit* method.
64
65
This function may be used if the object behavior has to be adapted
66
while in reset state. For example if a device has an irq input,
67
diff --git a/hw/core/resettable.c b/hw/core/resettable.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/hw/core/resettable.c
70
+++ b/hw/core/resettable.c
71
@@ -XXX,XX +XXX,XX @@ static void resettable_phase_exit(Object *obj, void *opaque, ResetType type)
72
resettable_child_foreach(rc, obj, resettable_phase_exit, NULL, type);
73
74
assert(s->count > 0);
75
- if (s->count == 1) {
76
+ if (--s->count == 0) {
77
trace_resettable_phase_exit_exec(obj, obj_typename, !!rc->phases.exit);
78
if (rc->phases.exit && !resettable_get_tr_func(rc, obj)) {
79
rc->phases.exit(obj);
80
}
81
- s->count = 0;
82
}
83
s->exit_phase_in_progress = false;
84
trace_resettable_phase_exit_end(obj, obj_typename, s->count);
27
--
85
--
28
2.20.1
86
2.25.1
29
87
30
88
diff view generated by jsdifflib
1
Currently target-i386.rst includes the documentation of the 'pc'
1
The semantic difference between the deprecated device_legacy_reset()
2
machine model inline. Split it out into its own file, in a
2
function and the newer device_cold_reset() function is that the new
3
similar way to target-i386.rst; this gives us a place to put
3
function resets both the device itself and any qbuses it owns,
4
documentation of other i386 machine models, such as 'microvm'.
4
whereas the legacy function resets just the device itself and nothing
5
else. In hyperv_synic_reset() we reset a SynICState, which has no
6
qbuses, so for this purpose the two functions behave identically and
7
we can stop using the deprecated one.
5
8
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
11
Message-id: 20221013171817.1447562-1-peter.maydell@linaro.org
8
---
12
---
9
docs/system/i386/pc.rst | 7 +++++++
13
hw/hyperv/hyperv.c | 2 +-
10
docs/system/target-i386.rst | 18 +++++++++++++-----
14
1 file changed, 1 insertion(+), 1 deletion(-)
11
2 files changed, 20 insertions(+), 5 deletions(-)
12
create mode 100644 docs/system/i386/pc.rst
13
15
14
diff --git a/docs/system/i386/pc.rst b/docs/system/i386/pc.rst
16
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
15
new file mode 100644
16
index XXXXXXX..XXXXXXX
17
--- /dev/null
18
+++ b/docs/system/i386/pc.rst
19
@@ -XXX,XX +XXX,XX @@
20
+i440fx PC (``pc-i440fx``, ``pc``)
21
+=================================
22
+
23
+Peripherals
24
+~~~~~~~~~~~
25
+
26
+.. include:: ../target-i386-desc.rst.inc
27
diff --git a/docs/system/target-i386.rst b/docs/system/target-i386.rst
28
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
29
--- a/docs/system/target-i386.rst
18
--- a/hw/hyperv/hyperv.c
30
+++ b/docs/system/target-i386.rst
19
+++ b/hw/hyperv/hyperv.c
31
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ void hyperv_synic_reset(CPUState *cs)
32
.. _QEMU-PC-System-emulator:
21
SynICState *synic = get_synic(cs);
33
22
34
-x86 (PC) System emulator
23
if (synic) {
35
-------------------------
24
- device_legacy_reset(DEVICE(synic));
36
+x86 System emulator
25
+ device_cold_reset(DEVICE(synic));
37
+-------------------
26
}
38
27
}
39
.. _pcsys_005fdevices:
40
41
-Peripherals
42
-~~~~~~~~~~~
43
+Board-specific documentation
44
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
46
-.. include:: target-i386-desc.rst.inc
47
+..
48
+ This table of contents should be kept sorted alphabetically
49
+ by the title text of each file, which isn't the same ordering
50
+ as an alphabetical sort by filename.
51
+
52
+.. toctree::
53
+ :maxdepth: 1
54
+
55
+ i386/pc
56
57
.. include:: cpu-models-x86.rst.inc
58
28
59
--
29
--
60
2.20.1
30
2.25.1
61
62
diff view generated by jsdifflib
New patch
1
From: Axel Heider <axel.heider@hensoldt.net>
1
2
3
When running seL4 tests (https://docs.sel4.systems/projects/sel4test)
4
on the sabrelight platform, the timer tests fail. The arm/imx6 EPIT
5
timer interrupt does not fire properly, instead of a e.g. second in
6
can take up to a minute to finally see the interrupt.
7
8
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1263
9
10
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
11
Message-id: 166663118138.13362.1229967229046092876-0@git.sr.ht
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
hw/timer/imx_epit.c | 9 +++++++--
16
1 file changed, 7 insertions(+), 2 deletions(-)
17
18
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/timer/imx_epit.c
21
+++ b/hw/timer/imx_epit.c
22
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
23
/* If IOVW bit is set then set the timer value */
24
ptimer_set_count(s->timer_reload, s->lr);
25
}
26
-
27
+ /*
28
+ * Commit the change to s->timer_reload, so it can propagate. Otherwise
29
+ * the timer interrupt may not fire properly. The commit must happen
30
+ * before calling imx_epit_reload_compare_timer(), which reads
31
+ * s->timer_reload internally again.
32
+ */
33
+ ptimer_transaction_commit(s->timer_reload);
34
imx_epit_reload_compare_timer(s);
35
ptimer_transaction_commit(s->timer_cmp);
36
- ptimer_transaction_commit(s->timer_reload);
37
break;
38
39
case 3: /* CMP */
40
--
41
2.25.1
diff view generated by jsdifflib
1
Split the documentation of the qemu-pr-helper binary into the tools
1
From: Richard Henderson <richard.henderson@linaro.org>
2
manual, and give it a manpage like our other standalone executables.
3
2
3
Reduce the amount of typing required for this check.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20221024051851.3074715-2-richard.henderson@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
---
10
---
7
docs/meson.build | 1 +
11
target/arm/internals.h | 5 +++++
8
docs/system/pr-manager.rst | 38 ++-------------
12
target/arm/helper.c | 14 +++++---------
9
docs/tools/conf.py | 2 +
13
target/arm/ptw.c | 14 ++++++--------
10
docs/tools/index.rst | 1 +
14
3 files changed, 16 insertions(+), 17 deletions(-)
11
docs/tools/qemu-pr-helper.rst | 90 +++++++++++++++++++++++++++++++++++
12
5 files changed, 99 insertions(+), 33 deletions(-)
13
create mode 100644 docs/tools/qemu-pr-helper.rst
14
15
15
diff --git a/docs/meson.build b/docs/meson.build
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/docs/meson.build
18
--- a/target/arm/internals.h
18
+++ b/docs/meson.build
19
+++ b/target/arm/internals.h
19
@@ -XXX,XX +XXX,XX @@ if build_docs
20
@@ -XXX,XX +XXX,XX @@ static inline bool regime_is_pan(CPUARMState *env, ARMMMUIdx mmu_idx)
20
'tools': {
21
}
21
'qemu-img.1': (have_tools ? 'man1' : ''),
22
}
22
'qemu-nbd.8': (have_tools ? 'man8' : ''),
23
23
+ 'qemu-pr-helper.8': (have_tools ? 'man8' : ''),
24
+static inline bool regime_is_stage2(ARMMMUIdx mmu_idx)
24
'qemu-trace-stap.1': (config_host.has_key('CONFIG_TRACE_SYSTEMTAP') ? 'man1' : ''),
25
+{
25
'virtfs-proxy-helper.1': (have_virtfs_proxy_helper ? 'man1' : ''),
26
+ return mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S;
26
'virtiofsd.1': (have_virtiofsd ? 'man1' : ''),
27
+}
27
diff --git a/docs/system/pr-manager.rst b/docs/system/pr-manager.rst
28
+
29
/* Return the exception level which controls this address translation regime */
30
static inline uint32_t regime_el(CPUARMState *env, ARMMMUIdx mmu_idx)
31
{
32
diff --git a/target/arm/helper.c b/target/arm/helper.c
28
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
29
--- a/docs/system/pr-manager.rst
34
--- a/target/arm/helper.c
30
+++ b/docs/system/pr-manager.rst
35
+++ b/target/arm/helper.c
31
@@ -XXX,XX +XXX,XX @@ Alternatively, using ``-blockdev``::
36
@@ -XXX,XX +XXX,XX @@ int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx)
32
-blockdev node-name=hd,driver=raw,file.driver=host_device,file.filename=/dev/sdb,file.pr-manager=helper0
37
{
33
-device scsi-block,drive=hd
38
if (regime_has_2_ranges(mmu_idx)) {
34
39
return extract64(tcr, 37, 2);
35
-----------------------------------
40
- } else if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) {
36
-Invoking :program:`qemu-pr-helper`
41
+ } else if (regime_is_stage2(mmu_idx)) {
37
-----------------------------------
42
return 0; /* VTCR_EL2 */
38
-
43
} else {
39
-QEMU provides an implementation of the persistent reservation helper,
44
/* Replicate the single TBI bit so we always have 2 bits. */
40
-called :program:`qemu-pr-helper`. The helper should be started as a
45
@@ -XXX,XX +XXX,XX @@ int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx)
41
-system service and supports the following option:
46
{
42
-
47
if (regime_has_2_ranges(mmu_idx)) {
43
--d, --daemon run in the background
48
return extract64(tcr, 51, 2);
44
--q, --quiet decrease verbosity
49
- } else if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) {
45
--v, --verbose increase verbosity
50
+ } else if (regime_is_stage2(mmu_idx)) {
46
--f, --pidfile=path PID file when running as a daemon
51
return 0; /* VTCR_EL2 */
47
--k, --socket=path path to the socket
52
} else {
48
--T, --trace=trace-opts tracing options
53
/* Replicate the single TBID bit so we always have 2 bits. */
49
-
54
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
50
-By default, the socket and PID file are placed in the runtime state
55
int select, tsz, tbi, max_tsz, min_tsz, ps, sh;
51
-directory, for example :file:`/var/run/qemu-pr-helper.sock` and
56
ARMGranuleSize gran;
52
-:file:`/var/run/qemu-pr-helper.pid`. The PID file is not created
57
ARMCPU *cpu = env_archcpu(env);
53
-unless :option:`-d` is passed too.
58
- bool stage2 = mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S;
54
-
59
+ bool stage2 = regime_is_stage2(mmu_idx);
55
-:program:`qemu-pr-helper` can also use the systemd socket activation
60
56
-protocol. In this case, the systemd socket unit should specify a
61
if (!regime_has_2_ranges(mmu_idx)) {
57
-Unix stream socket, like this::
62
select = 0;
58
-
63
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
59
- [Socket]
64
}
60
- ListenStream=/var/run/qemu-pr-helper.sock
65
ds = false;
61
-
66
} else if (ds) {
62
-After connecting to the socket, :program:`qemu-pr-helper`` can optionally drop
67
- switch (mmu_idx) {
63
-root privileges, except for those capabilities that are needed for
68
- case ARMMMUIdx_Stage2:
64
-its operation. To do this, add the following options:
69
- case ARMMMUIdx_Stage2_S:
65
-
70
+ if (regime_is_stage2(mmu_idx)) {
66
--u, --user=user user to drop privileges to
71
if (gran == Gran16K) {
67
--g, --group=group group to drop privileges to
72
ds = cpu_isar_feature(aa64_tgran16_2_lpa2, cpu);
68
+You will also need to ensure that the helper program
73
} else {
69
+:command:`qemu-pr-helper` is running, and that it has been
74
ds = cpu_isar_feature(aa64_tgran4_2_lpa2, cpu);
70
+set up to use the same socket filename as your QEMU commandline
75
}
71
+specifies. See the qemu-pr-helper documentation or manpage for
76
- break;
72
+further details.
77
- default:
73
78
+ } else {
74
---------------------------------------------
79
if (gran == Gran16K) {
75
Multipath devices and persistent reservations
80
ds = cpu_isar_feature(aa64_tgran16_lpa2, cpu);
76
diff --git a/docs/tools/conf.py b/docs/tools/conf.py
81
} else {
82
ds = cpu_isar_feature(aa64_tgran4_lpa2, cpu);
83
}
84
- break;
85
}
86
if (ds) {
87
min_tsz = 12;
88
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
77
index XXXXXXX..XXXXXXX 100644
89
index XXXXXXX..XXXXXXX 100644
78
--- a/docs/tools/conf.py
90
--- a/target/arm/ptw.c
79
+++ b/docs/tools/conf.py
91
+++ b/target/arm/ptw.c
80
@@ -XXX,XX +XXX,XX @@ man_pages = [
92
@@ -XXX,XX +XXX,XX @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64,
81
['Fabrice Bellard'], 1),
93
bool have_wxn;
82
('qemu-nbd', 'qemu-nbd', u'QEMU Disk Network Block Device Server',
94
int wxn = 0;
83
['Anthony Liguori <anthony@codemonkey.ws>'], 8),
95
84
+ ('qemu-pr-helper', 'qemu-pr-helper', 'QEMU persistent reservation helper',
96
- assert(mmu_idx != ARMMMUIdx_Stage2);
85
+ [], 8),
97
- assert(mmu_idx != ARMMMUIdx_Stage2_S);
86
('qemu-trace-stap', 'qemu-trace-stap', u'QEMU SystemTap trace tool',
98
+ assert(!regime_is_stage2(mmu_idx));
87
[], 1),
99
88
('virtfs-proxy-helper', 'virtfs-proxy-helper',
100
user_rw = simple_ap_to_rw_prot_is_user(ap, true);
89
diff --git a/docs/tools/index.rst b/docs/tools/index.rst
101
if (is_user) {
90
index XXXXXXX..XXXXXXX 100644
102
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
91
--- a/docs/tools/index.rst
103
goto do_fault;
92
+++ b/docs/tools/index.rst
104
}
93
@@ -XXX,XX +XXX,XX @@ Contents:
105
94
106
- if (mmu_idx != ARMMMUIdx_Stage2 && mmu_idx != ARMMMUIdx_Stage2_S) {
95
qemu-img
107
+ if (!regime_is_stage2(mmu_idx)) {
96
qemu-nbd
108
/*
97
+ qemu-pr-helper
109
* The starting level depends on the virtual address size (which can
98
qemu-trace-stap
110
* be up to 48 bits) and the translation granule size. It indicates
99
virtfs-proxy-helper
111
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
100
virtiofsd
112
attrs = extract64(descriptor, 2, 10)
101
diff --git a/docs/tools/qemu-pr-helper.rst b/docs/tools/qemu-pr-helper.rst
113
| (extract64(descriptor, 52, 12) << 10);
102
new file mode 100644
114
103
index XXXXXXX..XXXXXXX
115
- if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) {
104
--- /dev/null
116
+ if (regime_is_stage2(mmu_idx)) {
105
+++ b/docs/tools/qemu-pr-helper.rst
117
/* Stage 2 table descriptors do not include any attribute fields */
106
@@ -XXX,XX +XXX,XX @@
118
break;
107
+QEMU persistent reservation helper
119
}
108
+==================================
120
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
109
+
121
110
+Synopsis
122
ap = extract32(attrs, 4, 2);
111
+--------
123
112
+
124
- if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) {
113
+**qemu-pr-helper** [*OPTION*]
125
+ if (regime_is_stage2(mmu_idx)) {
114
+
126
ns = mmu_idx == ARMMMUIdx_Stage2;
115
+Description
127
xn = extract32(attrs, 11, 2);
116
+-----------
128
result->f.prot = get_S2prot(env, ap, xn, s1_is_el0);
117
+
129
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
118
+Implements the persistent reservation helper for QEMU.
130
result->f.guarded = guarded;
119
+
131
}
120
+SCSI persistent reservations allow restricting access to block devices
132
121
+to specific initiators in a shared storage setup. When implementing
133
- if (mmu_idx == ARMMMUIdx_Stage2 || mmu_idx == ARMMMUIdx_Stage2_S) {
122
+clustering of virtual machines, it is a common requirement for virtual
134
+ if (regime_is_stage2(mmu_idx)) {
123
+machines to send persistent reservation SCSI commands. However,
135
result->cacheattrs.is_s2_format = true;
124
+the operating system restricts sending these commands to unprivileged
136
result->cacheattrs.attrs = extract32(attrs, 0, 4);
125
+programs because incorrect usage can disrupt regular operation of the
137
} else {
126
+storage fabric. QEMU's SCSI passthrough devices ``scsi-block``
138
@@ -XXX,XX +XXX,XX @@ do_fault:
127
+and ``scsi-generic`` support passing guest persistent reservation
139
fi->type = fault_type;
128
+requests to a privileged external helper program. :program:`qemu-pr-helper`
140
fi->level = level;
129
+is that external helper; it creates a socket which QEMU can
141
/* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */
130
+connect to to communicate with it.
142
- fi->stage2 = fi->s1ptw || (mmu_idx == ARMMMUIdx_Stage2 ||
131
+
143
- mmu_idx == ARMMMUIdx_Stage2_S);
132
+If you want to run VMs in a setup like this, this helper should be
144
+ fi->stage2 = fi->s1ptw || regime_is_stage2(mmu_idx);
133
+started as a system service, and you should read the QEMU manual
145
fi->s1ns = mmu_idx == ARMMMUIdx_Stage2;
134
+section on "persistent reservation managers" to find out how to
146
return true;
135
+configure QEMU to connect to the socket created by
147
}
136
+:program:`qemu-pr-helper`.
137
+
138
+After connecting to the socket, :program:`qemu-pr-helper` can
139
+optionally drop root privileges, except for those capabilities that
140
+are needed for its operation.
141
+
142
+:program:`qemu-pr-helper` can also use the systemd socket activation
143
+protocol. In this case, the systemd socket unit should specify a
144
+Unix stream socket, like this::
145
+
146
+ [Socket]
147
+ ListenStream=/var/run/qemu-pr-helper.sock
148
+
149
+Options
150
+-------
151
+
152
+.. program:: qemu-pr-helper
153
+
154
+.. option:: -d, --daemon
155
+
156
+ run in the background (and create a PID file)
157
+
158
+.. option:: -q, --quiet
159
+
160
+ decrease verbosity
161
+
162
+.. option:: -v, --verbose
163
+
164
+ increase verbosity
165
+
166
+.. option:: -f, --pidfile=PATH
167
+
168
+ PID file when running as a daemon. By default the PID file
169
+ is created in the system runtime state directory, for example
170
+ :file:`/var/run/qemu-pr-helper.pid`.
171
+
172
+.. option:: -k, --socket=PATH
173
+
174
+ path to the socket. By default the socket is created in
175
+ the system runtime state directory, for example
176
+ :file:`/var/run/qemu-pr-helper.sock`.
177
+
178
+.. option:: -T, --trace [[enable=]PATTERN][,events=FILE][,file=FILE]
179
+
180
+ .. include:: ../qemu-option-trace.rst.inc
181
+
182
+.. option:: -u, --user=USER
183
+
184
+ user to drop privileges to
185
+
186
+.. option:: -g, --group=GROUP
187
+
188
+ group to drop privileges to
189
+
190
+.. option:: -h, --help
191
+
192
+ Display a help message and exit.
193
+
194
+.. option:: -V, --version
195
+
196
+ Display version information and exit.
197
--
148
--
198
2.20.1
149
2.25.1
199
150
200
151
diff view generated by jsdifflib
1
The virtio-pmem documentation has some minor style issues we hadn't
1
From: Richard Henderson <richard.henderson@linaro.org>
2
noticed since we weren't rendering it in our docs:
3
2
4
* Sphinx doesn't complain about overlong title-underlining the
3
Hoist the computation of the mmu_idx for the ptw up to
5
way it complains about too-short underlining, but it looks odd;
4
get_phys_addr_with_struct and get_phys_addr_twostage.
6
make the underlines of section headers the right length
5
This removes the duplicate check for stage2 disabled
6
from the middle of the walk, performing it only once.
7
7
8
* Indent of paragraphs makes them render as blockquotes;
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
remove the indent so they just render as normal text
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Tested-by: Alex Bennée <alex.bennee@linaro.org>
11
Message-id: 20221024051851.3074715-3-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/ptw.c | 71 ++++++++++++++++++++++++++++++++++++------------
15
1 file changed, 54 insertions(+), 17 deletions(-)
10
16
11
* Leading 'o' isn't rst markup, so it just renders as a literal
17
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
12
"o"; reformat as a subsection heading instead
13
14
* "QEMU" in the document title and section headings are a bit
15
odd and unnecessary since this is the QEMU manual; delete
16
or rephrase them
17
18
* There's no need to specify what QEMU version the device first
19
appeared in.
20
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
23
Reviewed-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
24
---
25
docs/system/virtio-pmem.rst | 60 ++++++++++++++++++-------------------
26
1 file changed, 30 insertions(+), 30 deletions(-)
27
28
diff --git a/docs/system/virtio-pmem.rst b/docs/system/virtio-pmem.rst
29
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
30
--- a/docs/system/virtio-pmem.rst
19
--- a/target/arm/ptw.c
31
+++ b/docs/system/virtio-pmem.rst
20
+++ b/target/arm/ptw.c
32
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@
33
22
34
-========================
23
typedef struct S1Translate {
35
-QEMU virtio pmem
24
ARMMMUIdx in_mmu_idx;
36
-========================
25
+ ARMMMUIdx in_ptw_idx;
37
+===========
26
bool in_secure;
38
+virtio pmem
27
bool in_debug;
39
+===========
28
bool out_secure;
40
29
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
41
- This document explains the setup and usage of the virtio pmem device
30
{
42
- which is available since QEMU v4.1.0.
31
bool is_secure = ptw->in_secure;
32
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
33
- ARMMMUIdx s2_mmu_idx = is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
34
- bool s2_phys = false;
35
+ ARMMMUIdx s2_mmu_idx = ptw->in_ptw_idx;
36
uint8_t pte_attrs;
37
bool pte_secure;
38
39
- if (!arm_mmu_idx_is_stage1_of_2(mmu_idx)
40
- || regime_translation_disabled(env, s2_mmu_idx, is_secure)) {
41
- s2_mmu_idx = is_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
42
- s2_phys = true;
43
- }
43
-
44
-
44
- The virtio pmem device is a paravirtualized persistent memory device
45
if (unlikely(ptw->in_debug)) {
45
- on regular (i.e non-NVDIMM) storage.
46
/*
46
+This document explains the setup and usage of the virtio pmem device.
47
* From gdbstub, do not use softmmu so that we don't modify the
47
+The virtio pmem device is a paravirtualized persistent memory device
48
* state of the cpu at all, including softmmu tlb contents.
48
+on regular (i.e non-NVDIMM) storage.
49
*/
49
50
- if (s2_phys) {
50
Usecase
51
- ptw->out_phys = addr;
51
---------
52
- pte_attrs = 0;
52
+-------
53
- pte_secure = is_secure;
53
54
- } else {
54
- Virtio pmem allows to bypass the guest page cache and directly use
55
+ if (regime_is_stage2(s2_mmu_idx)) {
55
- host page cache. This reduces guest memory footprint as the host can
56
S1Translate s2ptw = {
56
- make efficient memory reclaim decisions under memory pressure.
57
.in_mmu_idx = s2_mmu_idx,
57
+Virtio pmem allows to bypass the guest page cache and directly use
58
+ .in_ptw_idx = is_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS,
58
+host page cache. This reduces guest memory footprint as the host can
59
.in_secure = is_secure,
59
+make efficient memory reclaim decisions under memory pressure.
60
.in_debug = true,
60
61
};
61
-o How does virtio-pmem compare to the nvdimm emulation supported by QEMU?
62
GetPhysAddrResult s2 = { };
62
+How does virtio-pmem compare to the nvdimm emulation?
63
+-----------------------------------------------------
64
65
- NVDIMM emulation on regular (i.e. non-NVDIMM) host storage does not
66
- persist the guest writes as there are no defined semantics in the device
67
- specification. The virtio pmem device provides guest write persistence
68
- on non-NVDIMM host storage.
69
+NVDIMM emulation on regular (i.e. non-NVDIMM) host storage does not
70
+persist the guest writes as there are no defined semantics in the device
71
+specification. The virtio pmem device provides guest write persistence
72
+on non-NVDIMM host storage.
73
74
virtio pmem usage
75
-----------------
76
77
- A virtio pmem device backed by a memory-backend-file can be created on
78
- the QEMU command line as in the following example::
79
+A virtio pmem device backed by a memory-backend-file can be created on
80
+the QEMU command line as in the following example::
81
82
-object memory-backend-file,id=mem1,share,mem-path=./virtio_pmem.img,size=4G
83
-device virtio-pmem-pci,memdev=mem1,id=nv1
84
85
- where:
86
+where:
87
88
- "object memory-backend-file,id=mem1,share,mem-path=<image>, size=<image size>"
89
creates a backend file with the specified size.
90
@@ -XXX,XX +XXX,XX @@ virtio pmem usage
91
- "device virtio-pmem-pci,id=nvdimm1,memdev=mem1" creates a virtio pmem
92
pci device whose storage is provided by above memory backend device.
93
94
- Multiple virtio pmem devices can be created if multiple pairs of "-object"
95
- and "-device" are provided.
96
+Multiple virtio pmem devices can be created if multiple pairs of "-object"
97
+and "-device" are provided.
98
99
Hotplug
100
-------
101
@@ -XXX,XX +XXX,XX @@ the guest::
102
Guest Data Persistence
103
----------------------
104
105
- Guest data persistence on non-NVDIMM requires guest userspace applications
106
- to perform fsync/msync. This is different from a real nvdimm backend where
107
- no additional fsync/msync is required. This is to persist guest writes in
108
- host backing file which otherwise remains in host page cache and there is
109
- risk of losing the data in case of power failure.
110
+Guest data persistence on non-NVDIMM requires guest userspace applications
111
+to perform fsync/msync. This is different from a real nvdimm backend where
112
+no additional fsync/msync is required. This is to persist guest writes in
113
+host backing file which otherwise remains in host page cache and there is
114
+risk of losing the data in case of power failure.
115
116
- With virtio pmem device, MAP_SYNC mmap flag is not supported. This provides
117
- a hint to application to perform fsync for write persistence.
118
+With virtio pmem device, MAP_SYNC mmap flag is not supported. This provides
119
+a hint to application to perform fsync for write persistence.
120
121
Limitations
122
-------------
123
+-----------
124
+
63
+
125
- Real nvdimm device backend is not supported.
64
if (!get_phys_addr_lpae(env, &s2ptw, addr, MMU_DATA_LOAD,
126
- virtio pmem hotunplug is not supported.
65
false, &s2, fi)) {
127
- ACPI NVDIMM features like regions/namespaces are not supported.
66
goto fail;
67
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
68
ptw->out_phys = s2.f.phys_addr;
69
pte_attrs = s2.cacheattrs.attrs;
70
pte_secure = s2.f.attrs.secure;
71
+ } else {
72
+ /* Regime is physical. */
73
+ ptw->out_phys = addr;
74
+ pte_attrs = 0;
75
+ pte_secure = is_secure;
76
}
77
ptw->out_host = NULL;
78
} else {
79
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
80
pte_secure = full->attrs.secure;
81
}
82
83
- if (!s2_phys) {
84
+ if (regime_is_stage2(s2_mmu_idx)) {
85
uint64_t hcr = arm_hcr_el2_eff_secstate(env, is_secure);
86
87
if ((hcr & HCR_PTW) && S2_attrs_are_device(hcr, pte_attrs)) {
88
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
89
descaddr |= (address >> (stride * (4 - level))) & indexmask;
90
descaddr &= ~7ULL;
91
nstable = extract32(tableattrs, 4, 1);
92
- ptw->in_secure = !nstable;
93
+ if (!nstable) {
94
+ /*
95
+ * Stage2_S -> Stage2 or Phys_S -> Phys_NS
96
+ * Assert that the non-secure idx are even, and relative order.
97
+ */
98
+ QEMU_BUILD_BUG_ON((ARMMMUIdx_Phys_NS & 1) != 0);
99
+ QEMU_BUILD_BUG_ON((ARMMMUIdx_Stage2 & 1) != 0);
100
+ QEMU_BUILD_BUG_ON(ARMMMUIdx_Phys_NS + 1 != ARMMMUIdx_Phys_S);
101
+ QEMU_BUILD_BUG_ON(ARMMMUIdx_Stage2 + 1 != ARMMMUIdx_Stage2_S);
102
+ ptw->in_ptw_idx &= ~1;
103
+ ptw->in_secure = false;
104
+ }
105
descriptor = arm_ldq_ptw(env, ptw, descaddr, fi);
106
if (fi->type != ARMFault_None) {
107
goto do_fault;
108
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
109
110
is_el0 = ptw->in_mmu_idx == ARMMMUIdx_Stage1_E0;
111
ptw->in_mmu_idx = s2walk_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
112
+ ptw->in_ptw_idx = s2walk_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
113
ptw->in_secure = s2walk_secure;
114
115
/*
116
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_with_struct(CPUARMState *env, S1Translate *ptw,
117
ARMMMUFaultInfo *fi)
118
{
119
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
120
- ARMMMUIdx s1_mmu_idx = stage_1_mmu_idx(mmu_idx);
121
bool is_secure = ptw->in_secure;
122
+ ARMMMUIdx s1_mmu_idx;
123
124
- if (mmu_idx != s1_mmu_idx) {
125
+ switch (mmu_idx) {
126
+ case ARMMMUIdx_Phys_S:
127
+ case ARMMMUIdx_Phys_NS:
128
+ /* Checking Phys early avoids special casing later vs regime_el. */
129
+ return get_phys_addr_disabled(env, address, access_type, mmu_idx,
130
+ is_secure, result, fi);
131
+
132
+ case ARMMMUIdx_Stage1_E0:
133
+ case ARMMMUIdx_Stage1_E1:
134
+ case ARMMMUIdx_Stage1_E1_PAN:
135
+ /* First stage lookup uses second stage for ptw. */
136
+ ptw->in_ptw_idx = is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2;
137
+ break;
138
+
139
+ case ARMMMUIdx_E10_0:
140
+ s1_mmu_idx = ARMMMUIdx_Stage1_E0;
141
+ goto do_twostage;
142
+ case ARMMMUIdx_E10_1:
143
+ s1_mmu_idx = ARMMMUIdx_Stage1_E1;
144
+ goto do_twostage;
145
+ case ARMMMUIdx_E10_1_PAN:
146
+ s1_mmu_idx = ARMMMUIdx_Stage1_E1_PAN;
147
+ do_twostage:
148
/*
149
* Call ourselves recursively to do the stage 1 and then stage 2
150
* translations if mmu_idx is a two-stage regime, and EL2 present.
151
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_with_struct(CPUARMState *env, S1Translate *ptw,
152
return get_phys_addr_twostage(env, ptw, address, access_type,
153
result, fi);
154
}
155
+ /* fall through */
156
+
157
+ default:
158
+ /* Single stage and second stage uses physical for ptw. */
159
+ ptw->in_ptw_idx = is_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;
160
+ break;
161
}
162
163
/*
128
--
164
--
129
2.20.1
165
2.25.1
130
166
131
167
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
The MMFR1 field may indicate support for hardware update of
4
access flag alone, or access flag and dirty bit.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20221024051851.3074715-4-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 10 ++++++++++
12
1 file changed, 10 insertions(+)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_e0pd(const ARMISARegisters *id)
19
return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, E0PD) != 0;
20
}
21
22
+static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id)
23
+{
24
+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) != 0;
25
+}
26
+
27
+static inline bool isar_feature_aa64_hdbs(const ARMISARegisters *id)
28
+{
29
+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, HAFDBS) >= 2;
30
+}
31
+
32
static inline bool isar_feature_aa64_tts2uxn(const ARMISARegisters *id)
33
{
34
return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, XNX) != 0;
35
--
36
2.25.1
diff view generated by jsdifflib
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Using a target unsigned long would limit the Input Address to a LPAE
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
page-walk to 32 bits on AArch32 and 64 bits on AArch64. This is okay
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
for stage 1 or on AArch64, but it is insufficient for stage 2 on
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
AArch32. In that later case, the Input Address can have up to 40 bits.
6
Message-id: 20221024051851.3074715-5-richard.henderson@linaro.org
7
8
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20201118150414.18360-1-remi@remlab.net
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
8
---
13
target/arm/helper.c | 4 ++--
9
target/arm/internals.h | 2 ++
14
1 file changed, 2 insertions(+), 2 deletions(-)
10
target/arm/helper.c | 8 +++++++-
11
2 files changed, 9 insertions(+), 1 deletion(-)
15
12
13
diff --git a/target/arm/internals.h b/target/arm/internals.h
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/internals.h
16
+++ b/target/arm/internals.h
17
@@ -XXX,XX +XXX,XX @@ typedef struct ARMVAParameters {
18
bool hpd : 1;
19
bool tsz_oob : 1; /* tsz has been clamped to legal range */
20
bool ds : 1;
21
+ bool ha : 1;
22
+ bool hd : 1;
23
ARMGranuleSize gran : 2;
24
} ARMVAParameters;
25
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
28
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
29
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@
30
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
21
31
ARMMMUIdx mmu_idx, bool data)
22
#ifndef CONFIG_USER_ONLY
32
{
23
33
uint64_t tcr = regime_tcr(env, mmu_idx);
24
-static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
34
- bool epd, hpd, tsz_oob, ds;
25
+static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address,
35
+ bool epd, hpd, tsz_oob, ds, ha, hd;
26
MMUAccessType access_type, ARMMMUIdx mmu_idx,
36
int select, tsz, tbi, max_tsz, min_tsz, ps, sh;
27
bool s1_is_el0,
37
ARMGranuleSize gran;
28
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
38
ARMCPU *cpu = env_archcpu(env);
29
@@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va,
39
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
30
* @fi: set to fault info if the translation fails
40
epd = false;
31
* @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes
41
sh = extract32(tcr, 12, 2);
32
*/
42
ps = extract32(tcr, 16, 3);
33
-static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
43
+ ha = extract32(tcr, 21, 1) && cpu_isar_feature(aa64_hafs, cpu);
34
+static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address,
44
+ hd = extract32(tcr, 22, 1) && cpu_isar_feature(aa64_hdbs, cpu);
35
MMUAccessType access_type, ARMMMUIdx mmu_idx,
45
ds = extract64(tcr, 32, 1);
36
bool s1_is_el0,
46
} else {
37
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
47
bool e0pd;
48
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
49
e0pd = extract64(tcr, 56, 1);
50
}
51
ps = extract64(tcr, 32, 3);
52
+ ha = extract64(tcr, 39, 1) && cpu_isar_feature(aa64_hafs, cpu);
53
+ hd = extract64(tcr, 40, 1) && cpu_isar_feature(aa64_hdbs, cpu);
54
ds = extract64(tcr, 59, 1);
55
56
if (e0pd && cpu_isar_feature(aa64_e0pd, cpu) &&
57
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
58
.hpd = hpd,
59
.tsz_oob = tsz_oob,
60
.ds = ds,
61
+ .ha = ha,
62
+ .hd = ha && hd,
63
.gran = gran,
64
};
65
}
38
--
66
--
39
2.20.1
67
2.25.1
40
68
41
69
diff view generated by jsdifflib
New patch
1
From: Richard Henderson <richard.henderson@linaro.org>
1
2
3
Separate S1 translation from the actual lookup.
4
Will enable lpae hardware updates.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20221024051851.3074715-6-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/ptw.c | 41 ++++++++++++++++++++++-------------------
12
1 file changed, 22 insertions(+), 19 deletions(-)
13
14
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/ptw.c
17
+++ b/target/arm/ptw.c
18
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
19
}
20
21
/* All loads done in the course of a page table walk go through here. */
22
-static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw, hwaddr addr,
23
+static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw,
24
ARMMMUFaultInfo *fi)
25
{
26
CPUState *cs = env_cpu(env);
27
uint32_t data;
28
29
- if (!S1_ptw_translate(env, ptw, addr, fi)) {
30
- /* Failure. */
31
- assert(fi->s1ptw);
32
- return 0;
33
- }
34
-
35
if (likely(ptw->out_host)) {
36
/* Page tables are in RAM, and we have the host address. */
37
if (ptw->out_be) {
38
@@ -XXX,XX +XXX,XX @@ static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw, hwaddr addr,
39
return data;
40
}
41
42
-static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw, hwaddr addr,
43
+static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw,
44
ARMMMUFaultInfo *fi)
45
{
46
CPUState *cs = env_cpu(env);
47
uint64_t data;
48
49
- if (!S1_ptw_translate(env, ptw, addr, fi)) {
50
- /* Failure. */
51
- assert(fi->s1ptw);
52
- return 0;
53
- }
54
-
55
if (likely(ptw->out_host)) {
56
/* Page tables are in RAM, and we have the host address. */
57
if (ptw->out_be) {
58
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, S1Translate *ptw,
59
fi->type = ARMFault_Translation;
60
goto do_fault;
61
}
62
- desc = arm_ldl_ptw(env, ptw, table, fi);
63
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
64
+ goto do_fault;
65
+ }
66
+ desc = arm_ldl_ptw(env, ptw, fi);
67
if (fi->type != ARMFault_None) {
68
goto do_fault;
69
}
70
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, S1Translate *ptw,
71
/* Fine pagetable. */
72
table = (desc & 0xfffff000) | ((address >> 8) & 0xffc);
73
}
74
- desc = arm_ldl_ptw(env, ptw, table, fi);
75
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
76
+ goto do_fault;
77
+ }
78
+ desc = arm_ldl_ptw(env, ptw, fi);
79
if (fi->type != ARMFault_None) {
80
goto do_fault;
81
}
82
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, S1Translate *ptw,
83
fi->type = ARMFault_Translation;
84
goto do_fault;
85
}
86
- desc = arm_ldl_ptw(env, ptw, table, fi);
87
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
88
+ goto do_fault;
89
+ }
90
+ desc = arm_ldl_ptw(env, ptw, fi);
91
if (fi->type != ARMFault_None) {
92
goto do_fault;
93
}
94
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, S1Translate *ptw,
95
ns = extract32(desc, 3, 1);
96
/* Lookup l2 entry. */
97
table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc);
98
- desc = arm_ldl_ptw(env, ptw, table, fi);
99
+ if (!S1_ptw_translate(env, ptw, table, fi)) {
100
+ goto do_fault;
101
+ }
102
+ desc = arm_ldl_ptw(env, ptw, fi);
103
if (fi->type != ARMFault_None) {
104
goto do_fault;
105
}
106
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
107
ptw->in_ptw_idx &= ~1;
108
ptw->in_secure = false;
109
}
110
- descriptor = arm_ldq_ptw(env, ptw, descaddr, fi);
111
+ if (!S1_ptw_translate(env, ptw, descaddr, fi)) {
112
+ goto do_fault;
113
+ }
114
+ descriptor = arm_ldq_ptw(env, ptw, fi);
115
if (fi->type != ARMFault_None) {
116
goto do_fault;
117
}
118
--
119
2.25.1
diff view generated by jsdifflib
1
Move the pr-manager documentation into the system manual.
1
From: Richard Henderson <richard.henderson@linaro.org>
2
Some of it (the documentation of the pr-manager-helper tool)
3
should be in tools, but we will split it up after moving it.
4
2
3
This fault type is to be used with FEAT_HAFDBS when
4
the guest enables hw updates, but places the tables
5
in memory where atomic updates are unsupported.
6
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Message-id: 20221024051851.3074715-7-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
---
12
---
8
docs/system/index.rst | 1 +
13
target/arm/internals.h | 4 ++++
9
docs/{ => system}/pr-manager.rst | 0
14
1 file changed, 4 insertions(+)
10
2 files changed, 1 insertion(+)
11
rename docs/{ => system}/pr-manager.rst (100%)
12
15
13
diff --git a/docs/system/index.rst b/docs/system/index.rst
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
14
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/index.rst
18
--- a/target/arm/internals.h
16
+++ b/docs/system/index.rst
19
+++ b/target/arm/internals.h
17
@@ -XXX,XX +XXX,XX @@ Contents:
20
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFaultType {
18
managed-startup
21
ARMFault_AsyncExternal,
19
cpu-hotplug
22
ARMFault_Debug,
20
virtio-pmem
23
ARMFault_TLBConflict,
21
+ pr-manager
24
+ ARMFault_UnsuppAtomicUpdate,
22
targets
25
ARMFault_Lockdown,
23
security
26
ARMFault_Exclusive,
24
deprecated
27
ARMFault_ICacheMaint,
25
diff --git a/docs/pr-manager.rst b/docs/system/pr-manager.rst
28
@@ -XXX,XX +XXX,XX @@ static inline uint32_t arm_fi_to_lfsc(ARMMMUFaultInfo *fi)
26
similarity index 100%
29
case ARMFault_TLBConflict:
27
rename from docs/pr-manager.rst
30
fsc = 0x30;
28
rename to docs/system/pr-manager.rst
31
break;
32
+ case ARMFault_UnsuppAtomicUpdate:
33
+ fsc = 0x31;
34
+ break;
35
case ARMFault_Lockdown:
36
fsc = 0x34;
37
break;
29
--
38
--
30
2.20.1
39
2.25.1
31
40
32
41
diff view generated by jsdifflib
New patch
1
1
From: Richard Henderson <richard.henderson@linaro.org>
2
3
The unconditional loop was used both to iterate over levels
4
and to control parsing of attributes. Use an explicit goto
5
in both cases.
6
7
While this appears less clean for iterating over levels, we
8
will need to jump back into the middle of this loop for
9
atomic updates, which is even uglier.
10
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20221024051851.3074715-8-richard.henderson@linaro.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
target/arm/ptw.c | 192 +++++++++++++++++++++++------------------------
17
1 file changed, 96 insertions(+), 96 deletions(-)
18
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/ptw.c
22
+++ b/target/arm/ptw.c
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
24
uint64_t descaddrmask;
25
bool aarch64 = arm_el_is_aa64(env, el);
26
bool guarded = false;
27
+ uint64_t descriptor;
28
+ bool nstable;
29
30
/* TODO: This code does not support shareability levels. */
31
if (aarch64) {
32
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
33
* bits at each step.
34
*/
35
tableattrs = is_secure ? 0 : (1 << 4);
36
- for (;;) {
37
- uint64_t descriptor;
38
- bool nstable;
39
-
40
- descaddr |= (address >> (stride * (4 - level))) & indexmask;
41
- descaddr &= ~7ULL;
42
- nstable = extract32(tableattrs, 4, 1);
43
- if (!nstable) {
44
- /*
45
- * Stage2_S -> Stage2 or Phys_S -> Phys_NS
46
- * Assert that the non-secure idx are even, and relative order.
47
- */
48
- QEMU_BUILD_BUG_ON((ARMMMUIdx_Phys_NS & 1) != 0);
49
- QEMU_BUILD_BUG_ON((ARMMMUIdx_Stage2 & 1) != 0);
50
- QEMU_BUILD_BUG_ON(ARMMMUIdx_Phys_NS + 1 != ARMMMUIdx_Phys_S);
51
- QEMU_BUILD_BUG_ON(ARMMMUIdx_Stage2 + 1 != ARMMMUIdx_Stage2_S);
52
- ptw->in_ptw_idx &= ~1;
53
- ptw->in_secure = false;
54
- }
55
- if (!S1_ptw_translate(env, ptw, descaddr, fi)) {
56
- goto do_fault;
57
- }
58
- descriptor = arm_ldq_ptw(env, ptw, fi);
59
- if (fi->type != ARMFault_None) {
60
- goto do_fault;
61
- }
62
-
63
- if (!(descriptor & 1) ||
64
- (!(descriptor & 2) && (level == 3))) {
65
- /* Invalid, or the Reserved level 3 encoding */
66
- goto do_fault;
67
- }
68
-
69
- descaddr = descriptor & descaddrmask;
70
71
+ next_level:
72
+ descaddr |= (address >> (stride * (4 - level))) & indexmask;
73
+ descaddr &= ~7ULL;
74
+ nstable = extract32(tableattrs, 4, 1);
75
+ if (!nstable) {
76
/*
77
- * For FEAT_LPA and PS=6, bits [51:48] of descaddr are in [15:12]
78
- * of descriptor. For FEAT_LPA2 and effective DS, bits [51:50] of
79
- * descaddr are in [9:8]. Otherwise, if descaddr is out of range,
80
- * raise AddressSizeFault.
81
+ * Stage2_S -> Stage2 or Phys_S -> Phys_NS
82
+ * Assert that the non-secure idx are even, and relative order.
83
*/
84
- if (outputsize > 48) {
85
- if (param.ds) {
86
- descaddr |= extract64(descriptor, 8, 2) << 50;
87
- } else {
88
- descaddr |= extract64(descriptor, 12, 4) << 48;
89
- }
90
- } else if (descaddr >> outputsize) {
91
- fault_type = ARMFault_AddressSize;
92
- goto do_fault;
93
- }
94
-
95
- if ((descriptor & 2) && (level < 3)) {
96
- /*
97
- * Table entry. The top five bits are attributes which may
98
- * propagate down through lower levels of the table (and
99
- * which are all arranged so that 0 means "no effect", so
100
- * we can gather them up by ORing in the bits at each level).
101
- */
102
- tableattrs |= extract64(descriptor, 59, 5);
103
- level++;
104
- indexmask = indexmask_grainsize;
105
- continue;
106
- }
107
- /*
108
- * Block entry at level 1 or 2, or page entry at level 3.
109
- * These are basically the same thing, although the number
110
- * of bits we pull in from the vaddr varies. Note that although
111
- * descaddrmask masks enough of the low bits of the descriptor
112
- * to give a correct page or table address, the address field
113
- * in a block descriptor is smaller; so we need to explicitly
114
- * clear the lower bits here before ORing in the low vaddr bits.
115
- */
116
- page_size = (1ULL << ((stride * (4 - level)) + 3));
117
- descaddr &= ~(hwaddr)(page_size - 1);
118
- descaddr |= (address & (page_size - 1));
119
- /* Extract attributes from the descriptor */
120
- attrs = extract64(descriptor, 2, 10)
121
- | (extract64(descriptor, 52, 12) << 10);
122
-
123
- if (regime_is_stage2(mmu_idx)) {
124
- /* Stage 2 table descriptors do not include any attribute fields */
125
- break;
126
- }
127
- /* Merge in attributes from table descriptors */
128
- attrs |= nstable << 3; /* NS */
129
- guarded = extract64(descriptor, 50, 1); /* GP */
130
- if (param.hpd) {
131
- /* HPD disables all the table attributes except NSTable. */
132
- break;
133
- }
134
- attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */
135
- /*
136
- * The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
137
- * means "force PL1 access only", which means forcing AP[1] to 0.
138
- */
139
- attrs &= ~(extract32(tableattrs, 2, 1) << 4); /* !APT[0] => AP[1] */
140
- attrs |= extract32(tableattrs, 3, 1) << 5; /* APT[1] => AP[2] */
141
- break;
142
+ QEMU_BUILD_BUG_ON((ARMMMUIdx_Phys_NS & 1) != 0);
143
+ QEMU_BUILD_BUG_ON((ARMMMUIdx_Stage2 & 1) != 0);
144
+ QEMU_BUILD_BUG_ON(ARMMMUIdx_Phys_NS + 1 != ARMMMUIdx_Phys_S);
145
+ QEMU_BUILD_BUG_ON(ARMMMUIdx_Stage2 + 1 != ARMMMUIdx_Stage2_S);
146
+ ptw->in_ptw_idx &= ~1;
147
+ ptw->in_secure = false;
148
}
149
+ if (!S1_ptw_translate(env, ptw, descaddr, fi)) {
150
+ goto do_fault;
151
+ }
152
+ descriptor = arm_ldq_ptw(env, ptw, fi);
153
+ if (fi->type != ARMFault_None) {
154
+ goto do_fault;
155
+ }
156
+
157
+ if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) {
158
+ /* Invalid, or the Reserved level 3 encoding */
159
+ goto do_fault;
160
+ }
161
+
162
+ descaddr = descriptor & descaddrmask;
163
+
164
+ /*
165
+ * For FEAT_LPA and PS=6, bits [51:48] of descaddr are in [15:12]
166
+ * of descriptor. For FEAT_LPA2 and effective DS, bits [51:50] of
167
+ * descaddr are in [9:8]. Otherwise, if descaddr is out of range,
168
+ * raise AddressSizeFault.
169
+ */
170
+ if (outputsize > 48) {
171
+ if (param.ds) {
172
+ descaddr |= extract64(descriptor, 8, 2) << 50;
173
+ } else {
174
+ descaddr |= extract64(descriptor, 12, 4) << 48;
175
+ }
176
+ } else if (descaddr >> outputsize) {
177
+ fault_type = ARMFault_AddressSize;
178
+ goto do_fault;
179
+ }
180
+
181
+ if ((descriptor & 2) && (level < 3)) {
182
+ /*
183
+ * Table entry. The top five bits are attributes which may
184
+ * propagate down through lower levels of the table (and
185
+ * which are all arranged so that 0 means "no effect", so
186
+ * we can gather them up by ORing in the bits at each level).
187
+ */
188
+ tableattrs |= extract64(descriptor, 59, 5);
189
+ level++;
190
+ indexmask = indexmask_grainsize;
191
+ goto next_level;
192
+ }
193
+
194
+ /*
195
+ * Block entry at level 1 or 2, or page entry at level 3.
196
+ * These are basically the same thing, although the number
197
+ * of bits we pull in from the vaddr varies. Note that although
198
+ * descaddrmask masks enough of the low bits of the descriptor
199
+ * to give a correct page or table address, the address field
200
+ * in a block descriptor is smaller; so we need to explicitly
201
+ * clear the lower bits here before ORing in the low vaddr bits.
202
+ */
203
+ page_size = (1ULL << ((stride * (4 - level)) + 3));
204
+ descaddr &= ~(hwaddr)(page_size - 1);
205
+ descaddr |= (address & (page_size - 1));
206
+ /* Extract attributes from the descriptor */
207
+ attrs = extract64(descriptor, 2, 10)
208
+ | (extract64(descriptor, 52, 12) << 10);
209
+
210
+ if (regime_is_stage2(mmu_idx)) {
211
+ /* Stage 2 table descriptors do not include any attribute fields */
212
+ goto skip_attrs;
213
+ }
214
+ /* Merge in attributes from table descriptors */
215
+ attrs |= nstable << 3; /* NS */
216
+ guarded = extract64(descriptor, 50, 1); /* GP */
217
+ if (param.hpd) {
218
+ /* HPD disables all the table attributes except NSTable. */
219
+ goto skip_attrs;
220
+ }
221
+ attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */
222
+ /*
223
+ * The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
224
+ * means "force PL1 access only", which means forcing AP[1] to 0.
225
+ */
226
+ attrs &= ~(extract32(tableattrs, 2, 1) << 4); /* !APT[0] => AP[1] */
227
+ attrs |= extract32(tableattrs, 3, 1) << 5; /* APT[1] => AP[2] */
228
+ skip_attrs:
229
+
230
/*
231
* Here descaddr is the final physical address, and attributes
232
* are all in attrs.
233
--
234
2.25.1
diff view generated by jsdifflib
1
Now that target-i386.rst has a place to list documentation of
1
From: Richard Henderson <richard.henderson@linaro.org>
2
machines other than the 'pc' machine, we have a place we can
3
move the microvm documentation to.
4
2
3
Always overriding fi->type was incorrect, as we would not properly
4
propagate the fault type from S1_ptw_translate, or arm_ldq_ptw.
5
Simplify things by providing a new label for a translation fault.
6
For other faults, store into fi directly.
7
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Message-id: 20221024051851.3074715-9-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
---
13
---
8
docs/{ => system/i386}/microvm.rst | 5 ++---
14
target/arm/ptw.c | 31 +++++++++++++------------------
9
docs/system/target-i386.rst | 1 +
15
1 file changed, 13 insertions(+), 18 deletions(-)
10
2 files changed, 3 insertions(+), 3 deletions(-)
11
rename docs/{ => system/i386}/microvm.rst (98%)
12
16
13
diff --git a/docs/microvm.rst b/docs/system/i386/microvm.rst
17
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
14
similarity index 98%
15
rename from docs/microvm.rst
16
rename to docs/system/i386/microvm.rst
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/microvm.rst
19
--- a/target/arm/ptw.c
19
+++ b/docs/system/i386/microvm.rst
20
+++ b/target/arm/ptw.c
20
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
21
-====================
22
ARMCPU *cpu = env_archcpu(env);
22
-microvm Machine Type
23
ARMMMUIdx mmu_idx = ptw->in_mmu_idx;
23
-====================
24
bool is_secure = ptw->in_secure;
24
+'microvm' virtual platform (``microvm``)
25
- /* Read an LPAE long-descriptor translation table. */
25
+========================================
26
- ARMFaultType fault_type = ARMFault_Translation;
26
27
uint32_t level;
27
``microvm`` is a machine type inspired by ``Firecracker`` and
28
ARMVAParameters param;
28
constructed after its machine model.
29
uint64_t ttbr;
29
diff --git a/docs/system/target-i386.rst b/docs/system/target-i386.rst
30
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
30
index XXXXXXX..XXXXXXX 100644
31
* so our choice is to always raise the fault.
31
--- a/docs/system/target-i386.rst
32
*/
32
+++ b/docs/system/target-i386.rst
33
if (param.tsz_oob) {
33
@@ -XXX,XX +XXX,XX @@ Board-specific documentation
34
- fault_type = ARMFault_Translation;
34
.. toctree::
35
- goto do_fault;
35
:maxdepth: 1
36
+ goto do_translation_fault;
36
37
}
37
+ i386/microvm
38
38
i386/pc
39
addrsize = 64 - 8 * param.tbi;
39
40
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
40
.. include:: cpu-models-x86.rst.inc
41
addrsize - inputsize);
42
if (-top_bits != param.select) {
43
/* The gap between the two regions is a Translation fault */
44
- fault_type = ARMFault_Translation;
45
- goto do_fault;
46
+ goto do_translation_fault;
47
}
48
}
49
50
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
51
* Translation table walk disabled => Translation fault on TLB miss
52
* Note: This is always 0 on 64-bit EL2 and EL3.
53
*/
54
- goto do_fault;
55
+ goto do_translation_fault;
56
}
57
58
if (!regime_is_stage2(mmu_idx)) {
59
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
60
if (param.ds && stride == 9 && sl2) {
61
if (sl0 != 0) {
62
level = 0;
63
- fault_type = ARMFault_Translation;
64
- goto do_fault;
65
+ goto do_translation_fault;
66
}
67
startlevel = -1;
68
} else if (!aarch64 || stride == 9) {
69
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
70
ok = check_s2_mmu_setup(cpu, aarch64, startlevel,
71
inputsize, stride, outputsize);
72
if (!ok) {
73
- fault_type = ARMFault_Translation;
74
- goto do_fault;
75
+ goto do_translation_fault;
76
}
77
level = startlevel;
78
}
79
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
80
descaddr |= extract64(ttbr, 2, 4) << 48;
81
} else if (descaddr >> outputsize) {
82
level = 0;
83
- fault_type = ARMFault_AddressSize;
84
+ fi->type = ARMFault_AddressSize;
85
goto do_fault;
86
}
87
88
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
89
90
if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) {
91
/* Invalid, or the Reserved level 3 encoding */
92
- goto do_fault;
93
+ goto do_translation_fault;
94
}
95
96
descaddr = descriptor & descaddrmask;
97
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
98
descaddr |= extract64(descriptor, 12, 4) << 48;
99
}
100
} else if (descaddr >> outputsize) {
101
- fault_type = ARMFault_AddressSize;
102
+ fi->type = ARMFault_AddressSize;
103
goto do_fault;
104
}
105
106
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
107
* Here descaddr is the final physical address, and attributes
108
* are all in attrs.
109
*/
110
- fault_type = ARMFault_AccessFlag;
111
if ((attrs & (1 << 8)) == 0) {
112
/* Access flag */
113
+ fi->type = ARMFault_AccessFlag;
114
goto do_fault;
115
}
116
117
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
118
result->f.prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn);
119
}
120
121
- fault_type = ARMFault_Permission;
122
if (!(result->f.prot & (1 << access_type))) {
123
+ fi->type = ARMFault_Permission;
124
goto do_fault;
125
}
126
127
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
128
result->f.lg_page_size = ctz64(page_size);
129
return false;
130
131
-do_fault:
132
- fi->type = fault_type;
133
+ do_translation_fault:
134
+ fi->type = ARMFault_Translation;
135
+ do_fault:
136
fi->level = level;
137
/* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */
138
fi->stage2 = fi->s1ptw || regime_is_stage2(mmu_idx);
41
--
139
--
42
2.20.1
140
2.25.1
43
141
44
142
diff view generated by jsdifflib
1
The cpu-hotplug.rst documentation is currently orphan and not
1
From: Richard Henderson <richard.henderson@linaro.org>
2
included in any manual; move it into the system manual.
3
2
3
Leave the upper and lower attributes in the place they originate
4
from in the descriptor. Shifting them around is confusing, since
5
one cannot read the bit numbers out of the manual. Also, new
6
attributes have been added which would alter the shifts.
7
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20221024051851.3074715-10-richard.henderson@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
---
13
---
7
docs/{ => system}/cpu-hotplug.rst | 0
14
target/arm/ptw.c | 31 +++++++++++++++----------------
8
docs/system/index.rst | 1 +
15
1 file changed, 15 insertions(+), 16 deletions(-)
9
2 files changed, 1 insertion(+)
10
rename docs/{ => system}/cpu-hotplug.rst (100%)
11
16
12
diff --git a/docs/cpu-hotplug.rst b/docs/system/cpu-hotplug.rst
17
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
13
similarity index 100%
14
rename from docs/cpu-hotplug.rst
15
rename to docs/system/cpu-hotplug.rst
16
diff --git a/docs/system/index.rst b/docs/system/index.rst
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/system/index.rst
19
--- a/target/arm/ptw.c
19
+++ b/docs/system/index.rst
20
+++ b/target/arm/ptw.c
20
@@ -XXX,XX +XXX,XX @@ Contents:
21
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
21
tls
22
hwaddr descaddr, indexmask, indexmask_grainsize;
22
gdb
23
uint32_t tableattrs;
23
managed-startup
24
target_ulong page_size;
24
+ cpu-hotplug
25
- uint32_t attrs;
25
targets
26
+ uint64_t attrs;
26
security
27
int32_t stride;
27
deprecated
28
int addrsize, inputsize, outputsize;
29
uint64_t tcr = regime_tcr(env, mmu_idx);
30
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
31
descaddr &= ~(hwaddr)(page_size - 1);
32
descaddr |= (address & (page_size - 1));
33
/* Extract attributes from the descriptor */
34
- attrs = extract64(descriptor, 2, 10)
35
- | (extract64(descriptor, 52, 12) << 10);
36
+ attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(52, 12));
37
38
if (regime_is_stage2(mmu_idx)) {
39
/* Stage 2 table descriptors do not include any attribute fields */
40
goto skip_attrs;
41
}
42
/* Merge in attributes from table descriptors */
43
- attrs |= nstable << 3; /* NS */
44
+ attrs |= nstable << 5; /* NS */
45
guarded = extract64(descriptor, 50, 1); /* GP */
46
if (param.hpd) {
47
/* HPD disables all the table attributes except NSTable. */
48
goto skip_attrs;
49
}
50
- attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */
51
+ attrs |= extract64(tableattrs, 0, 2) << 53; /* XN, PXN */
52
/*
53
* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
54
* means "force PL1 access only", which means forcing AP[1] to 0.
55
*/
56
- attrs &= ~(extract32(tableattrs, 2, 1) << 4); /* !APT[0] => AP[1] */
57
- attrs |= extract32(tableattrs, 3, 1) << 5; /* APT[1] => AP[2] */
58
+ attrs &= ~(extract64(tableattrs, 2, 1) << 6); /* !APT[0] => AP[1] */
59
+ attrs |= extract32(tableattrs, 3, 1) << 7; /* APT[1] => AP[2] */
60
skip_attrs:
61
62
/*
63
* Here descaddr is the final physical address, and attributes
64
* are all in attrs.
65
*/
66
- if ((attrs & (1 << 8)) == 0) {
67
+ if ((attrs & (1 << 10)) == 0) {
68
/* Access flag */
69
fi->type = ARMFault_AccessFlag;
70
goto do_fault;
71
}
72
73
- ap = extract32(attrs, 4, 2);
74
+ ap = extract32(attrs, 6, 2);
75
76
if (regime_is_stage2(mmu_idx)) {
77
ns = mmu_idx == ARMMMUIdx_Stage2;
78
- xn = extract32(attrs, 11, 2);
79
+ xn = extract64(attrs, 53, 2);
80
result->f.prot = get_S2prot(env, ap, xn, s1_is_el0);
81
} else {
82
- ns = extract32(attrs, 3, 1);
83
- xn = extract32(attrs, 12, 1);
84
- pxn = extract32(attrs, 11, 1);
85
+ ns = extract32(attrs, 5, 1);
86
+ xn = extract64(attrs, 54, 1);
87
+ pxn = extract64(attrs, 53, 1);
88
result->f.prot = get_S1prot(env, mmu_idx, aarch64, ap, ns, xn, pxn);
89
}
90
91
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
92
93
if (regime_is_stage2(mmu_idx)) {
94
result->cacheattrs.is_s2_format = true;
95
- result->cacheattrs.attrs = extract32(attrs, 0, 4);
96
+ result->cacheattrs.attrs = extract32(attrs, 2, 4);
97
} else {
98
/* Index into MAIR registers for cache attributes */
99
- uint8_t attrindx = extract32(attrs, 0, 3);
100
+ uint8_t attrindx = extract32(attrs, 2, 3);
101
uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)];
102
assert(attrindx <= 7);
103
result->cacheattrs.is_s2_format = false;
104
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
105
if (param.ds) {
106
result->cacheattrs.shareability = param.sh;
107
} else {
108
- result->cacheattrs.shareability = extract32(attrs, 6, 2);
109
+ result->cacheattrs.shareability = extract32(attrs, 8, 2);
110
}
111
112
result->f.phys_addr = descaddr;
28
--
113
--
29
2.20.1
114
2.25.1
30
115
31
116
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
2
3
Both GP and DBM are in the upper attribute block.
4
Extend the computation of attrs to include them,
5
then simplify the setting of guarded.
6
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Message-id: 20221024051851.3074715-11-richard.henderson@linaro.org
1
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
---
13
---
4
docs/system/index.rst | 1 +
14
target/arm/ptw.c | 6 ++----
5
docs/{ => system}/virtio-pmem.rst | 0
15
1 file changed, 2 insertions(+), 4 deletions(-)
6
2 files changed, 1 insertion(+)
7
rename docs/{ => system}/virtio-pmem.rst (100%)
8
16
9
diff --git a/docs/system/index.rst b/docs/system/index.rst
17
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
10
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
11
--- a/docs/system/index.rst
19
--- a/target/arm/ptw.c
12
+++ b/docs/system/index.rst
20
+++ b/target/arm/ptw.c
13
@@ -XXX,XX +XXX,XX @@ Contents:
21
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
14
gdb
22
uint32_t el = regime_el(env, mmu_idx);
15
managed-startup
23
uint64_t descaddrmask;
16
cpu-hotplug
24
bool aarch64 = arm_el_is_aa64(env, el);
17
+ virtio-pmem
25
- bool guarded = false;
18
targets
26
uint64_t descriptor;
19
security
27
bool nstable;
20
deprecated
28
21
diff --git a/docs/virtio-pmem.rst b/docs/system/virtio-pmem.rst
29
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
22
similarity index 100%
30
descaddr &= ~(hwaddr)(page_size - 1);
23
rename from docs/virtio-pmem.rst
31
descaddr |= (address & (page_size - 1));
24
rename to docs/system/virtio-pmem.rst
32
/* Extract attributes from the descriptor */
33
- attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(52, 12));
34
+ attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
35
36
if (regime_is_stage2(mmu_idx)) {
37
/* Stage 2 table descriptors do not include any attribute fields */
38
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
39
}
40
/* Merge in attributes from table descriptors */
41
attrs |= nstable << 5; /* NS */
42
- guarded = extract64(descriptor, 50, 1); /* GP */
43
if (param.hpd) {
44
/* HPD disables all the table attributes except NSTable. */
45
goto skip_attrs;
46
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
47
48
/* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */
49
if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) {
50
- result->f.guarded = guarded;
51
+ result->f.guarded = extract64(attrs, 50, 1); /* GP */
52
}
53
54
if (regime_is_stage2(mmu_idx)) {
25
--
55
--
26
2.20.1
56
2.25.1
27
57
28
58
diff view generated by jsdifflib
1
The virtio-net-failover documentation is currently orphan and
1
From: Richard Henderson <richard.henderson@linaro.org>
2
not included in any manual; move it into the system manual,
3
immediately following the general network emulation section.
4
2
3
Replace some gotos with some nested if statements.
4
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-id: 20221024051851.3074715-12-richard.henderson@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
---
9
---
8
docs/system/index.rst | 1 +
10
target/arm/ptw.c | 34 ++++++++++++++++------------------
9
docs/{ => system}/virtio-net-failover.rst | 0
11
1 file changed, 16 insertions(+), 18 deletions(-)
10
2 files changed, 1 insertion(+)
11
rename docs/{ => system}/virtio-net-failover.rst (100%)
12
12
13
diff --git a/docs/system/index.rst b/docs/system/index.rst
13
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
14
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/index.rst
15
--- a/target/arm/ptw.c
16
+++ b/docs/system/index.rst
16
+++ b/target/arm/ptw.c
17
@@ -XXX,XX +XXX,XX @@ Contents:
17
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
18
monitor
18
page_size = (1ULL << ((stride * (4 - level)) + 3));
19
images
19
descaddr &= ~(hwaddr)(page_size - 1);
20
net
20
descaddr |= (address & (page_size - 1));
21
+ virtio-net-failover
21
- /* Extract attributes from the descriptor */
22
usb
22
- attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
23
ivshmem
23
24
linuxboot
24
- if (regime_is_stage2(mmu_idx)) {
25
diff --git a/docs/virtio-net-failover.rst b/docs/system/virtio-net-failover.rst
25
- /* Stage 2 table descriptors do not include any attribute fields */
26
similarity index 100%
26
- goto skip_attrs;
27
rename from docs/virtio-net-failover.rst
27
- }
28
rename to docs/system/virtio-net-failover.rst
28
- /* Merge in attributes from table descriptors */
29
- attrs |= nstable << 5; /* NS */
30
- if (param.hpd) {
31
- /* HPD disables all the table attributes except NSTable. */
32
- goto skip_attrs;
33
- }
34
- attrs |= extract64(tableattrs, 0, 2) << 53; /* XN, PXN */
35
/*
36
- * The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
37
- * means "force PL1 access only", which means forcing AP[1] to 0.
38
+ * Extract attributes from the descriptor, and apply table descriptors.
39
+ * Stage 2 table descriptors do not include any attribute fields.
40
+ * HPD disables all the table attributes except NSTable.
41
*/
42
- attrs &= ~(extract64(tableattrs, 2, 1) << 6); /* !APT[0] => AP[1] */
43
- attrs |= extract32(tableattrs, 3, 1) << 7; /* APT[1] => AP[2] */
44
- skip_attrs:
45
+ attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
46
+ if (!regime_is_stage2(mmu_idx)) {
47
+ attrs |= nstable << 5; /* NS */
48
+ if (!param.hpd) {
49
+ attrs |= extract64(tableattrs, 0, 2) << 53; /* XN, PXN */
50
+ /*
51
+ * The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1
52
+ * means "force PL1 access only", which means forcing AP[1] to 0.
53
+ */
54
+ attrs &= ~(extract64(tableattrs, 2, 1) << 6); /* !APT[0] => AP[1] */
55
+ attrs |= extract32(tableattrs, 3, 1) << 7; /* APT[1] => AP[2] */
56
+ }
57
+ }
58
59
/*
60
* Here descaddr is the final physical address, and attributes
29
--
61
--
30
2.20.1
62
2.25.1
31
63
32
64
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Document the following Raspberry Pi models:
3
Perform the atomic update for hardware management of the access flag.
4
5
- raspi0 Raspberry Pi Zero (revision 1.2)
6
- raspi1ap Raspberry Pi A+ (revision 1.1)
7
- raspi2b Raspberry Pi 2B (revision 1.1)
8
- raspi3ap Raspberry Pi 3A+ (revision 1.0)
9
- raspi3b Raspberry Pi 3B (revision 1.2)
10
4
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20201120173953.2539469-3-f4bug@amsat.org
7
Message-id: 20221024051851.3074715-13-richard.henderson@linaro.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
9
---
16
docs/system/arm/raspi.rst | 43 ++++++++++++++++++++++++++++++++++++++
10
docs/system/arm/emulation.rst | 1 +
17
docs/system/target-arm.rst | 1 +
11
target/arm/cpu64.c | 1 +
18
MAINTAINERS | 1 +
12
target/arm/ptw.c | 176 +++++++++++++++++++++++++++++-----
19
3 files changed, 45 insertions(+)
13
3 files changed, 156 insertions(+), 22 deletions(-)
20
create mode 100644 docs/system/arm/raspi.rst
21
14
22
diff --git a/docs/system/arm/raspi.rst b/docs/system/arm/raspi.rst
15
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
23
new file mode 100644
24
index XXXXXXX..XXXXXXX
25
--- /dev/null
26
+++ b/docs/system/arm/raspi.rst
27
@@ -XXX,XX +XXX,XX @@
28
+Raspberry Pi boards (``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b``)
29
+======================================================================================
30
+
31
+
32
+QEMU provides models of the following Raspberry Pi boards:
33
+
34
+``raspi0`` and ``raspi1ap``
35
+ ARM1176JZF-S core, 512 MiB of RAM
36
+``raspi2b``
37
+ Cortex-A7 (4 cores), 1 GiB of RAM
38
+``raspi3ap``
39
+ Cortex-A53 (4 cores), 512 MiB of RAM
40
+``raspi3b``
41
+ Cortex-A53 (4 cores), 1 GiB of RAM
42
+
43
+
44
+Implemented devices
45
+-------------------
46
+
47
+ * ARM1176JZF-S, Cortex-A7 or Cortex-A53 CPU
48
+ * Interrupt controller
49
+ * DMA controller
50
+ * Clock and reset controller (CPRMAN)
51
+ * System Timer
52
+ * GPIO controller
53
+ * Serial ports (BCM2835 AUX - 16550 based - and PL011)
54
+ * Random Number Generator (RNG)
55
+ * Frame Buffer
56
+ * USB host (USBH)
57
+ * GPIO controller
58
+ * SD/MMC host controller
59
+ * SoC thermal sensor
60
+ * USB2 host controller (DWC2 and MPHI)
61
+ * MailBox controller (MBOX)
62
+ * VideoCore firmware (property)
63
+
64
+
65
+Missing devices
66
+---------------
67
+
68
+ * Peripheral SPI controller (SPI)
69
+ * Analog to Digital Converter (ADC)
70
+ * Pulse Width Modulation (PWM)
71
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
72
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
73
--- a/docs/system/target-arm.rst
17
--- a/docs/system/arm/emulation.rst
74
+++ b/docs/system/target-arm.rst
18
+++ b/docs/system/arm/emulation.rst
75
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
19
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
76
arm/nuvoton
20
- FEAT_FlagM (Flag manipulation instructions v2)
77
arm/orangepi
21
- FEAT_FlagM2 (Enhancements to flag manipulation instructions)
78
arm/palm
22
- FEAT_GTG (Guest translation granule size)
79
+ arm/raspi
23
+- FEAT_HAFDBS (Hardware management of the access flag and dirty bit state)
80
arm/xscale
24
- FEAT_HCX (Support for the HCRX_EL2 register)
81
arm/collie
25
- FEAT_HPDS (Hierarchical permission disables)
82
arm/sx1
26
- FEAT_I8MM (AArch64 Int8 matrix multiplication instructions)
83
diff --git a/MAINTAINERS b/MAINTAINERS
27
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
84
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
85
--- a/MAINTAINERS
29
--- a/target/arm/cpu64.c
86
+++ b/MAINTAINERS
30
+++ b/target/arm/cpu64.c
87
@@ -XXX,XX +XXX,XX @@ F: hw/arm/raspi_platform.h
31
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
88
F: hw/*/bcm283*
32
cpu->isar.id_aa64mmfr0 = t;
89
F: include/hw/arm/raspi*
33
90
F: include/hw/*/bcm283*
34
t = cpu->isar.id_aa64mmfr1;
91
+F: docs/system/arm/raspi.rst
35
+ t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 1); /* FEAT_HAFDBS, AF only */
92
36
t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */
93
Real View
37
t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */
94
M: Peter Maydell <peter.maydell@linaro.org>
38
t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */
39
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/ptw.c
42
+++ b/target/arm/ptw.c
43
@@ -XXX,XX +XXX,XX @@ typedef struct S1Translate {
44
bool in_secure;
45
bool in_debug;
46
bool out_secure;
47
+ bool out_rw;
48
bool out_be;
49
+ hwaddr out_virt;
50
hwaddr out_phys;
51
void *out_host;
52
} S1Translate;
53
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
54
uint8_t pte_attrs;
55
bool pte_secure;
56
57
+ ptw->out_virt = addr;
58
+
59
if (unlikely(ptw->in_debug)) {
60
/*
61
* From gdbstub, do not use softmmu so that we don't modify the
62
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
63
pte_secure = is_secure;
64
}
65
ptw->out_host = NULL;
66
+ ptw->out_rw = false;
67
} else {
68
CPUTLBEntryFull *full;
69
int flags;
70
@@ -XXX,XX +XXX,XX @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw,
71
goto fail;
72
}
73
ptw->out_phys = full->phys_addr;
74
+ ptw->out_rw = full->prot & PROT_WRITE;
75
pte_attrs = full->pte_attrs;
76
pte_secure = full->attrs.secure;
77
}
78
@@ -XXX,XX +XXX,XX @@ static uint32_t arm_ldl_ptw(CPUARMState *env, S1Translate *ptw,
79
ARMMMUFaultInfo *fi)
80
{
81
CPUState *cs = env_cpu(env);
82
+ void *host = ptw->out_host;
83
uint32_t data;
84
85
- if (likely(ptw->out_host)) {
86
+ if (likely(host)) {
87
/* Page tables are in RAM, and we have the host address. */
88
+ data = qatomic_read((uint32_t *)host);
89
if (ptw->out_be) {
90
- data = ldl_be_p(ptw->out_host);
91
+ data = be32_to_cpu(data);
92
} else {
93
- data = ldl_le_p(ptw->out_host);
94
+ data = le32_to_cpu(data);
95
}
96
} else {
97
/* Page tables are in MMIO. */
98
@@ -XXX,XX +XXX,XX @@ static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw,
99
ARMMMUFaultInfo *fi)
100
{
101
CPUState *cs = env_cpu(env);
102
+ void *host = ptw->out_host;
103
uint64_t data;
104
105
- if (likely(ptw->out_host)) {
106
+ if (likely(host)) {
107
/* Page tables are in RAM, and we have the host address. */
108
+#ifdef CONFIG_ATOMIC64
109
+ data = qatomic_read__nocheck((uint64_t *)host);
110
if (ptw->out_be) {
111
- data = ldq_be_p(ptw->out_host);
112
+ data = be64_to_cpu(data);
113
} else {
114
- data = ldq_le_p(ptw->out_host);
115
+ data = le64_to_cpu(data);
116
}
117
+#else
118
+ if (ptw->out_be) {
119
+ data = ldq_be_p(host);
120
+ } else {
121
+ data = ldq_le_p(host);
122
+ }
123
+#endif
124
} else {
125
/* Page tables are in MMIO. */
126
MemTxAttrs attrs = { .secure = ptw->out_secure };
127
@@ -XXX,XX +XXX,XX @@ static uint64_t arm_ldq_ptw(CPUARMState *env, S1Translate *ptw,
128
return data;
129
}
130
131
+static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
132
+ uint64_t new_val, S1Translate *ptw,
133
+ ARMMMUFaultInfo *fi)
134
+{
135
+ uint64_t cur_val;
136
+ void *host = ptw->out_host;
137
+
138
+ if (unlikely(!host)) {
139
+ fi->type = ARMFault_UnsuppAtomicUpdate;
140
+ fi->s1ptw = true;
141
+ return 0;
142
+ }
143
+
144
+ /*
145
+ * Raising a stage2 Protection fault for an atomic update to a read-only
146
+ * page is delayed until it is certain that there is a change to make.
147
+ */
148
+ if (unlikely(!ptw->out_rw)) {
149
+ int flags;
150
+ void *discard;
151
+
152
+ env->tlb_fi = fi;
153
+ flags = probe_access_flags(env, ptw->out_virt, MMU_DATA_STORE,
154
+ arm_to_core_mmu_idx(ptw->in_ptw_idx),
155
+ true, &discard, 0);
156
+ env->tlb_fi = NULL;
157
+
158
+ if (unlikely(flags & TLB_INVALID_MASK)) {
159
+ assert(fi->type != ARMFault_None);
160
+ fi->s2addr = ptw->out_virt;
161
+ fi->stage2 = true;
162
+ fi->s1ptw = true;
163
+ fi->s1ns = !ptw->in_secure;
164
+ return 0;
165
+ }
166
+
167
+ /* In case CAS mismatches and we loop, remember writability. */
168
+ ptw->out_rw = true;
169
+ }
170
+
171
+#ifdef CONFIG_ATOMIC64
172
+ if (ptw->out_be) {
173
+ old_val = cpu_to_be64(old_val);
174
+ new_val = cpu_to_be64(new_val);
175
+ cur_val = qatomic_cmpxchg__nocheck((uint64_t *)host, old_val, new_val);
176
+ cur_val = be64_to_cpu(cur_val);
177
+ } else {
178
+ old_val = cpu_to_le64(old_val);
179
+ new_val = cpu_to_le64(new_val);
180
+ cur_val = qatomic_cmpxchg__nocheck((uint64_t *)host, old_val, new_val);
181
+ cur_val = le64_to_cpu(cur_val);
182
+ }
183
+#else
184
+ /*
185
+ * We can't support the full 64-bit atomic cmpxchg on the host.
186
+ * Because this is only used for FEAT_HAFDBS, which is only for AA64,
187
+ * we know that TCG_OVERSIZED_GUEST is set, which means that we are
188
+ * running in round-robin mode and could only race with dma i/o.
189
+ */
190
+#ifndef TCG_OVERSIZED_GUEST
191
+# error "Unexpected configuration"
192
+#endif
193
+ bool locked = qemu_mutex_iothread_locked();
194
+ if (!locked) {
195
+ qemu_mutex_lock_iothread();
196
+ }
197
+ if (ptw->out_be) {
198
+ cur_val = ldq_be_p(host);
199
+ if (cur_val == old_val) {
200
+ stq_be_p(host, new_val);
201
+ }
202
+ } else {
203
+ cur_val = ldq_le_p(host);
204
+ if (cur_val == old_val) {
205
+ stq_le_p(host, new_val);
206
+ }
207
+ }
208
+ if (!locked) {
209
+ qemu_mutex_unlock_iothread();
210
+ }
211
+#endif
212
+
213
+ return cur_val;
214
+}
215
+
216
static bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,
217
uint32_t *table, uint32_t address)
218
{
219
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
220
uint32_t el = regime_el(env, mmu_idx);
221
uint64_t descaddrmask;
222
bool aarch64 = arm_el_is_aa64(env, el);
223
- uint64_t descriptor;
224
+ uint64_t descriptor, new_descriptor;
225
bool nstable;
226
227
/* TODO: This code does not support shareability levels. */
228
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
229
if (fi->type != ARMFault_None) {
230
goto do_fault;
231
}
232
+ new_descriptor = descriptor;
233
234
+ restart_atomic_update:
235
if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) {
236
/* Invalid, or the Reserved level 3 encoding */
237
goto do_translation_fault;
238
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
239
* to give a correct page or table address, the address field
240
* in a block descriptor is smaller; so we need to explicitly
241
* clear the lower bits here before ORing in the low vaddr bits.
242
+ *
243
+ * Afterward, descaddr is the final physical address.
244
*/
245
page_size = (1ULL << ((stride * (4 - level)) + 3));
246
descaddr &= ~(hwaddr)(page_size - 1);
247
descaddr |= (address & (page_size - 1));
248
249
+ if (likely(!ptw->in_debug)) {
250
+ /*
251
+ * Access flag.
252
+ * If HA is enabled, prepare to update the descriptor below.
253
+ * Otherwise, pass the access fault on to software.
254
+ */
255
+ if (!(descriptor & (1 << 10))) {
256
+ if (param.ha) {
257
+ new_descriptor |= 1 << 10; /* AF */
258
+ } else {
259
+ fi->type = ARMFault_AccessFlag;
260
+ goto do_fault;
261
+ }
262
+ }
263
+ }
264
+
265
/*
266
- * Extract attributes from the descriptor, and apply table descriptors.
267
- * Stage 2 table descriptors do not include any attribute fields.
268
- * HPD disables all the table attributes except NSTable.
269
+ * Extract attributes from the (modified) descriptor, and apply
270
+ * table descriptors. Stage 2 table descriptors do not include
271
+ * any attribute fields. HPD disables all the table attributes
272
+ * except NSTable.
273
*/
274
- attrs = descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
275
+ attrs = new_descriptor & (MAKE_64BIT_MASK(2, 10) | MAKE_64BIT_MASK(50, 14));
276
if (!regime_is_stage2(mmu_idx)) {
277
attrs |= nstable << 5; /* NS */
278
if (!param.hpd) {
279
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
280
}
281
}
282
283
- /*
284
- * Here descaddr is the final physical address, and attributes
285
- * are all in attrs.
286
- */
287
- if ((attrs & (1 << 10)) == 0) {
288
- /* Access flag */
289
- fi->type = ARMFault_AccessFlag;
290
- goto do_fault;
291
- }
292
-
293
ap = extract32(attrs, 6, 2);
294
-
295
if (regime_is_stage2(mmu_idx)) {
296
ns = mmu_idx == ARMMMUIdx_Stage2;
297
xn = extract64(attrs, 53, 2);
298
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
299
goto do_fault;
300
}
301
302
+ /* If FEAT_HAFDBS has made changes, update the PTE. */
303
+ if (new_descriptor != descriptor) {
304
+ new_descriptor = arm_casq_ptw(env, descriptor, new_descriptor, ptw, fi);
305
+ if (fi->type != ARMFault_None) {
306
+ goto do_fault;
307
+ }
308
+ /*
309
+ * I_YZSVV says that if the in-memory descriptor has changed,
310
+ * then we must use the information in that new value
311
+ * (which might include a different output address, different
312
+ * attributes, or generate a fault).
313
+ * Restart the handling of the descriptor value from scratch.
314
+ */
315
+ if (new_descriptor != descriptor) {
316
+ descriptor = new_descriptor;
317
+ goto restart_atomic_update;
318
+ }
319
+ }
320
+
321
if (ns) {
322
/*
323
* The NS bit will (as required by the architecture) have no effect if
95
--
324
--
96
2.20.1
325
2.25.1
97
98
diff view generated by jsdifflib
1
The semihosting SYS_HEAPINFO call is supposed to return an array
1
From: Richard Henderson <richard.henderson@linaro.org>
2
of four guest addresses:
3
* base of heap memory
4
* limit of heap memory
5
* base of stack memory
6
* limit of stack memory
7
2
8
Some semihosting programs (including those compiled to use the
3
Perform the atomic update for hardware management of the dirty bit.
9
'newlib' embedded C library) use this call to work out where they
10
should initialize themselves to.
11
4
12
QEMU's implementation when in system emulation mode is very
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
simplistic: we say that the heap starts halfway into RAM and
6
Message-id: 20221024051851.3074715-14-richard.henderson@linaro.org
14
continues to the end of RAM, and the stack starts at the top of RAM
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
and works down to the bottom. Unfortunately the code assumes that
8
---
16
the base address of RAM is at address 0, so on boards like 'virt'
9
target/arm/cpu64.c | 2 +-
17
where this is not true the addresses returned will all be wrong and
10
target/arm/ptw.c | 16 ++++++++++++++++
18
the guest application will usually crash.
11
2 files changed, 17 insertions(+), 1 deletion(-)
19
12
20
Conveniently since all Arm boards call arm_load_kernel() we have the
13
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
21
base address of the main RAM block in the arm_boot_info struct which
22
is accessible via the CPU object. Use this to return sensible values
23
from SYS_HEAPINFO.
24
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
27
Message-id: 20201119092346.32356-1-peter.maydell@linaro.org
28
---
29
target/arm/arm-semi.c | 12 ++++++++----
30
1 file changed, 8 insertions(+), 4 deletions(-)
31
32
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
33
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/arm-semi.c
15
--- a/target/arm/cpu64.c
35
+++ b/target/arm/arm-semi.c
16
+++ b/target/arm/cpu64.c
36
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
37
#else
18
cpu->isar.id_aa64mmfr0 = t;
38
#include "exec/gdbstub.h"
19
39
#include "qemu/cutils.h"
20
t = cpu->isar.id_aa64mmfr1;
40
+#include "hw/arm/boot.h"
21
- t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 1); /* FEAT_HAFDBS, AF only */
41
#endif
22
+ t = FIELD_DP64(t, ID_AA64MMFR1, HAFDBS, 2); /* FEAT_HAFDBS */
42
23
t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */
43
#define TARGET_SYS_OPEN 0x01
24
t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */
44
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
25
t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */
45
int i;
26
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
46
#ifdef CONFIG_USER_ONLY
27
index XXXXXXX..XXXXXXX 100644
47
TaskState *ts = cs->opaque;
28
--- a/target/arm/ptw.c
48
+#else
29
+++ b/target/arm/ptw.c
49
+ const struct arm_boot_info *info = env->boot_info;
30
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
50
+ target_ulong rambase = info->loader_start;
31
goto do_fault;
51
#endif
32
}
52
33
}
53
GET_ARG(0);
34
+
54
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
35
+ /*
55
#else
36
+ * Dirty Bit.
56
limit = ram_size;
37
+ * If HD is enabled, pre-emptively set/clear the appropriate AP/S2AP
57
/* TODO: Make this use the limit of the loaded application. */
38
+ * bit for writeback. The actual write protection test may still be
58
- retvals[0] = limit / 2;
39
+ * overridden by tableattrs, to be merged below.
59
- retvals[1] = limit;
40
+ */
60
- retvals[2] = limit; /* Stack base */
41
+ if (param.hd
61
- retvals[3] = 0; /* Stack limit. */
42
+ && extract64(descriptor, 51, 1) /* DBM */
62
+ retvals[0] = rambase + limit / 2;
43
+ && access_type == MMU_DATA_STORE) {
63
+ retvals[1] = rambase + limit;
44
+ if (regime_is_stage2(mmu_idx)) {
64
+ retvals[2] = rambase + limit; /* Stack base */
45
+ new_descriptor |= 1ull << 7; /* set S2AP[1] */
65
+ retvals[3] = rambase; /* Stack limit. */
46
+ } else {
66
#endif
47
+ new_descriptor &= ~(1ull << 7); /* clear AP[2] */
67
48
+ }
68
for (i = 0; i < ARRAY_SIZE(retvals); i++) {
49
+ }
50
}
51
52
/*
69
--
53
--
70
2.20.1
54
2.25.1
71
72
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Document the 3 front LEDs modeled on the OpenPOWER Witherspoon BMC
3
We had only been reporting the stage2 page size. This causes
4
(see commit 7cfbde5ea1c "hw/arm/aspeed: Add the 3 front LEDs drived
4
problems if stage1 is using a larger page size (16k, 2M, etc),
5
by the PCA9552 #1").
5
but stage2 is using a smaller page size, because cputlb does
6
not set large_page_{addr,mask} properly.
6
7
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Fix by using the max of the two page sizes.
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
9
Message-id: 20201120173953.2539469-4-f4bug@amsat.org
10
Reported-by: Marc Zyngier <maz@kernel.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20221024051851.3074715-15-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
15
---
12
docs/system/arm/aspeed.rst | 1 +
16
target/arm/ptw.c | 11 ++++++++++-
13
1 file changed, 1 insertion(+)
17
1 file changed, 10 insertions(+), 1 deletion(-)
14
18
15
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
19
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/docs/system/arm/aspeed.rst
21
--- a/target/arm/ptw.c
18
+++ b/docs/system/arm/aspeed.rst
22
+++ b/target/arm/ptw.c
19
@@ -XXX,XX +XXX,XX @@ Supported devices
23
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
20
* GPIO Controller (Master only)
24
ARMMMUFaultInfo *fi)
21
* UART
25
{
22
* Ethernet controllers
26
hwaddr ipa;
23
+ * Front LEDs (PCA9552 on I2C bus)
27
- int s1_prot;
24
28
+ int s1_prot, s1_lgpgsz;
25
29
bool is_secure = ptw->in_secure;
26
Missing devices
30
bool ret, ipa_secure, s2walk_secure;
31
ARMCacheAttrs cacheattrs1;
32
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
33
* Save the stage1 results so that we may merge prot and cacheattrs later.
34
*/
35
s1_prot = result->f.prot;
36
+ s1_lgpgsz = result->f.lg_page_size;
37
cacheattrs1 = result->cacheattrs;
38
memset(result, 0, sizeof(*result));
39
40
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
41
return ret;
42
}
43
44
+ /*
45
+ * Use the maximum of the S1 & S2 page size, so that invalidation
46
+ * of pages > TARGET_PAGE_SIZE works correctly.
47
+ */
48
+ if (result->f.lg_page_size < s1_lgpgsz) {
49
+ result->f.lg_page_size = s1_lgpgsz;
50
+ }
51
+
52
/* Combine the S1 and S2 cache attributes. */
53
hcr = arm_hcr_el2_eff_secstate(env, is_secure);
54
if (hcr & HCR_DC) {
27
--
55
--
28
2.20.1
56
2.25.1
29
30
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
List the 'tosa' machine with the XScale-based PDAs models.
3
Snapshot loading only expects to call deterministic handlers, not
4
non-deterministic ones. So introduce a way of registering handlers that
5
won't be called when reseting for snapshots.
4
6
5
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6
Message-id: 20201120173953.2539469-5-f4bug@amsat.org
8
Message-id: 20221025004327.568476-2-Jason@zx2c4.com
9
[PMM: updated json doc comment with Markus' text; fixed
10
checkpatch style nit]
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
13
---
10
docs/system/arm/xscale.rst | 20 +++++++++++++-------
14
qapi/run-state.json | 6 +++++-
11
1 file changed, 13 insertions(+), 7 deletions(-)
15
include/hw/boards.h | 2 +-
16
include/sysemu/reset.h | 5 ++++-
17
hw/arm/aspeed.c | 4 ++--
18
hw/arm/mps2-tz.c | 4 ++--
19
hw/core/reset.c | 17 ++++++++++++++++-
20
hw/hppa/machine.c | 4 ++--
21
hw/i386/microvm.c | 4 ++--
22
hw/i386/pc.c | 6 +++---
23
hw/ppc/pegasos2.c | 4 ++--
24
hw/ppc/pnv.c | 4 ++--
25
hw/ppc/spapr.c | 4 ++--
26
hw/s390x/s390-virtio-ccw.c | 4 ++--
27
migration/savevm.c | 2 +-
28
softmmu/runstate.c | 11 ++++++++---
29
15 files changed, 54 insertions(+), 27 deletions(-)
12
30
13
diff --git a/docs/system/arm/xscale.rst b/docs/system/arm/xscale.rst
31
diff --git a/qapi/run-state.json b/qapi/run-state.json
14
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/arm/xscale.rst
33
--- a/qapi/run-state.json
16
+++ b/docs/system/arm/xscale.rst
34
+++ b/qapi/run-state.json
17
@@ -XXX,XX +XXX,XX @@
35
@@ -XXX,XX +XXX,XX @@
18
-Sharp XScale-based PDA models (``akita``, ``borzoi``, ``spitz``, ``terrier``)
36
# ignores --no-reboot. This is useful for sanitizing
19
-=============================================================================
37
# hypercalls on s390 that are used during kexec/kdump/boot
20
+Sharp XScale-based PDA models (``akita``, ``borzoi``, ``spitz``, ``terrier``, ``tosa``)
38
#
21
+=======================================================================================
39
+# @snapshot-load: A snapshot is being loaded by the record & replay
22
40
+# subsystem. This value is used only within QEMU. It
23
-The XScale-based clamshell PDA models (\"Spitz\", \"Akita\", \"Borzoi\"
41
+# doesn't occur in QMP. (since 7.2)
24
-and \"Terrier\") emulation includes the following peripherals:
42
+#
25
+The Sharp Zaurus are PDAs based on XScale, able to run Linux ('SL series').
43
##
26
44
{ 'enum': 'ShutdownCause',
27
-- Intel PXA270 System-on-chip (ARMv5TE core)
45
# Beware, shutdown_caused_by_guest() depends on enumeration order
28
+The SL-6000 (\"Tosa\"), released in 2005, uses a PXA255 System-on-chip.
46
'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
29
47
'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
30
-- NAND Flash memory
48
- 'guest-panic', 'subsystem-reset'] }
31
+The SL-C3000 (\"Spitz\"), SL-C1000 (\"Akita\"), SL-C3100 (\"Borzoi\") and
49
+ 'guest-panic', 'subsystem-reset', 'snapshot-load'] }
32
+SL-C3200 (\"Terrier\") use a PXA270.
50
51
##
52
# @StatusInfo:
53
diff --git a/include/hw/boards.h b/include/hw/boards.h
54
index XXXXXXX..XXXXXXX 100644
55
--- a/include/hw/boards.h
56
+++ b/include/hw/boards.h
57
@@ -XXX,XX +XXX,XX @@ struct MachineClass {
58
const char *deprecation_reason;
59
60
void (*init)(MachineState *state);
61
- void (*reset)(MachineState *state);
62
+ void (*reset)(MachineState *state, ShutdownCause reason);
63
void (*wakeup)(MachineState *state);
64
int (*kvm_type)(MachineState *machine, const char *arg);
65
66
diff --git a/include/sysemu/reset.h b/include/sysemu/reset.h
67
index XXXXXXX..XXXXXXX 100644
68
--- a/include/sysemu/reset.h
69
+++ b/include/sysemu/reset.h
70
@@ -XXX,XX +XXX,XX @@
71
#ifndef QEMU_SYSEMU_RESET_H
72
#define QEMU_SYSEMU_RESET_H
73
74
+#include "qapi/qapi-events-run-state.h"
33
+
75
+
34
+The clamshell PDA models emulation includes the following peripherals:
76
typedef void QEMUResetHandler(void *opaque);
77
78
void qemu_register_reset(QEMUResetHandler *func, void *opaque);
79
+void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque);
80
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
81
-void qemu_devices_reset(void);
82
+void qemu_devices_reset(ShutdownCause reason);
83
84
#endif
85
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/hw/arm/aspeed.c
88
+++ b/hw/arm/aspeed.c
89
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data)
90
aspeed_soc_num_cpus(amc->soc_name);
91
}
92
93
-static void fby35_reset(MachineState *state)
94
+static void fby35_reset(MachineState *state, ShutdownCause reason)
95
{
96
AspeedMachineState *bmc = ASPEED_MACHINE(state);
97
AspeedGPIOState *gpio = &bmc->soc.gpio;
98
99
- qemu_devices_reset();
100
+ qemu_devices_reset(reason);
101
102
/* Board ID: 7 (Class-1, 4 slots) */
103
object_property_set_bool(OBJECT(gpio), "gpioV4", true, &error_fatal);
104
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
105
index XXXXXXX..XXXXXXX 100644
106
--- a/hw/arm/mps2-tz.c
107
+++ b/hw/arm/mps2-tz.c
108
@@ -XXX,XX +XXX,XX @@ static void mps2_set_remap(Object *obj, const char *value, Error **errp)
109
}
110
}
111
112
-static void mps2_machine_reset(MachineState *machine)
113
+static void mps2_machine_reset(MachineState *machine, ShutdownCause reason)
114
{
115
MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine);
116
117
@@ -XXX,XX +XXX,XX @@ static void mps2_machine_reset(MachineState *machine)
118
* reset see the correct mapping.
119
*/
120
remap_memory(mms, mms->remap);
121
- qemu_devices_reset();
122
+ qemu_devices_reset(reason);
123
}
124
125
static void mps2tz_class_init(ObjectClass *oc, void *data)
126
diff --git a/hw/core/reset.c b/hw/core/reset.c
127
index XXXXXXX..XXXXXXX 100644
128
--- a/hw/core/reset.c
129
+++ b/hw/core/reset.c
130
@@ -XXX,XX +XXX,XX @@ typedef struct QEMUResetEntry {
131
QTAILQ_ENTRY(QEMUResetEntry) entry;
132
QEMUResetHandler *func;
133
void *opaque;
134
+ bool skip_on_snapshot_load;
135
} QEMUResetEntry;
136
137
static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers =
138
@@ -XXX,XX +XXX,XX @@ void qemu_register_reset(QEMUResetHandler *func, void *opaque)
139
QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
140
}
141
142
+void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque)
143
+{
144
+ QEMUResetEntry *re = g_new0(QEMUResetEntry, 1);
35
+
145
+
36
+- Intel PXA255/PXA270 System-on-chip (ARMv5TE core)
146
+ re->func = func;
147
+ re->opaque = opaque;
148
+ re->skip_on_snapshot_load = true;
149
+ QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
150
+}
37
+
151
+
38
+- NAND Flash memory - not in \"Tosa\"
152
void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
39
153
{
40
- IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in \"Akita\"
154
QEMUResetEntry *re;
41
155
@@ -XXX,XX +XXX,XX @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
42
-- On-chip OHCI USB controller
156
}
43
+- On-chip OHCI USB controller - not in \"Tosa\"
157
}
44
158
45
- On-chip LCD controller
159
-void qemu_devices_reset(void)
46
160
+void qemu_devices_reset(ShutdownCause reason)
161
{
162
QEMUResetEntry *re, *nre;
163
164
/* reset all devices */
165
QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
166
+ if (reason == SHUTDOWN_CAUSE_SNAPSHOT_LOAD &&
167
+ re->skip_on_snapshot_load) {
168
+ continue;
169
+ }
170
re->func(re->opaque);
171
}
172
}
173
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
174
index XXXXXXX..XXXXXXX 100644
175
--- a/hw/hppa/machine.c
176
+++ b/hw/hppa/machine.c
177
@@ -XXX,XX +XXX,XX @@ static void machine_hppa_init(MachineState *machine)
178
cpu[0]->env.gr[19] = FW_CFG_IO_BASE;
179
}
180
181
-static void hppa_machine_reset(MachineState *ms)
182
+static void hppa_machine_reset(MachineState *ms, ShutdownCause reason)
183
{
184
unsigned int smp_cpus = ms->smp.cpus;
185
int i;
186
187
- qemu_devices_reset();
188
+ qemu_devices_reset(reason);
189
190
/* Start all CPUs at the firmware entry point.
191
* Monarch CPU will initialize firmware, secondary CPUs
192
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
193
index XXXXXXX..XXXXXXX 100644
194
--- a/hw/i386/microvm.c
195
+++ b/hw/i386/microvm.c
196
@@ -XXX,XX +XXX,XX @@ static void microvm_machine_state_init(MachineState *machine)
197
microvm_devices_init(mms);
198
}
199
200
-static void microvm_machine_reset(MachineState *machine)
201
+static void microvm_machine_reset(MachineState *machine, ShutdownCause reason)
202
{
203
MicrovmMachineState *mms = MICROVM_MACHINE(machine);
204
CPUState *cs;
205
@@ -XXX,XX +XXX,XX @@ static void microvm_machine_reset(MachineState *machine)
206
mms->kernel_cmdline_fixed = true;
207
}
208
209
- qemu_devices_reset();
210
+ qemu_devices_reset(reason);
211
212
CPU_FOREACH(cs) {
213
cpu = X86_CPU(cs);
214
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
215
index XXXXXXX..XXXXXXX 100644
216
--- a/hw/i386/pc.c
217
+++ b/hw/i386/pc.c
218
@@ -XXX,XX +XXX,XX @@ static void pc_machine_initfn(Object *obj)
219
cxl_machine_init(obj, &pcms->cxl_devices_state);
220
}
221
222
-static void pc_machine_reset(MachineState *machine)
223
+static void pc_machine_reset(MachineState *machine, ShutdownCause reason)
224
{
225
CPUState *cs;
226
X86CPU *cpu;
227
228
- qemu_devices_reset();
229
+ qemu_devices_reset(reason);
230
231
/* Reset APIC after devices have been reset to cancel
232
* any changes that qemu_devices_reset() might have done.
233
@@ -XXX,XX +XXX,XX @@ static void pc_machine_reset(MachineState *machine)
234
static void pc_machine_wakeup(MachineState *machine)
235
{
236
cpu_synchronize_all_states();
237
- pc_machine_reset(machine);
238
+ pc_machine_reset(machine, SHUTDOWN_CAUSE_NONE);
239
cpu_synchronize_all_post_reset();
240
}
241
242
diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
243
index XXXXXXX..XXXXXXX 100644
244
--- a/hw/ppc/pegasos2.c
245
+++ b/hw/ppc/pegasos2.c
246
@@ -XXX,XX +XXX,XX @@ static void pegasos2_pci_config_write(Pegasos2MachineState *pm, int bus,
247
pegasos2_mv_reg_write(pm, pcicfg + 4, len, val);
248
}
249
250
-static void pegasos2_machine_reset(MachineState *machine)
251
+static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason)
252
{
253
Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine);
254
void *fdt;
255
uint64_t d[2];
256
int sz;
257
258
- qemu_devices_reset();
259
+ qemu_devices_reset(reason);
260
if (!pm->vof) {
261
return; /* Firmware should set up machine so nothing to do */
262
}
263
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
264
index XXXXXXX..XXXXXXX 100644
265
--- a/hw/ppc/pnv.c
266
+++ b/hw/ppc/pnv.c
267
@@ -XXX,XX +XXX,XX @@ static void pnv_powerdown_notify(Notifier *n, void *opaque)
268
}
269
}
270
271
-static void pnv_reset(MachineState *machine)
272
+static void pnv_reset(MachineState *machine, ShutdownCause reason)
273
{
274
PnvMachineState *pnv = PNV_MACHINE(machine);
275
IPMIBmc *bmc;
276
void *fdt;
277
278
- qemu_devices_reset();
279
+ qemu_devices_reset(reason);
280
281
/*
282
* The machine should provide by default an internal BMC simulator.
283
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
284
index XXXXXXX..XXXXXXX 100644
285
--- a/hw/ppc/spapr.c
286
+++ b/hw/ppc/spapr.c
287
@@ -XXX,XX +XXX,XX @@ void spapr_check_mmu_mode(bool guest_radix)
288
}
289
}
290
291
-static void spapr_machine_reset(MachineState *machine)
292
+static void spapr_machine_reset(MachineState *machine, ShutdownCause reason)
293
{
294
SpaprMachineState *spapr = SPAPR_MACHINE(machine);
295
PowerPCCPU *first_ppc_cpu;
296
@@ -XXX,XX +XXX,XX @@ static void spapr_machine_reset(MachineState *machine)
297
spapr_setup_hpt(spapr);
298
}
299
300
- qemu_devices_reset();
301
+ qemu_devices_reset(reason);
302
303
spapr_ovec_cleanup(spapr->ov5_cas);
304
spapr->ov5_cas = spapr_ovec_new();
305
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
306
index XXXXXXX..XXXXXXX 100644
307
--- a/hw/s390x/s390-virtio-ccw.c
308
+++ b/hw/s390x/s390-virtio-ccw.c
309
@@ -XXX,XX +XXX,XX @@ static void s390_pv_prepare_reset(S390CcwMachineState *ms)
310
s390_pv_prep_reset();
311
}
312
313
-static void s390_machine_reset(MachineState *machine)
314
+static void s390_machine_reset(MachineState *machine, ShutdownCause reason)
315
{
316
S390CcwMachineState *ms = S390_CCW_MACHINE(machine);
317
enum s390_reset reset_type;
318
@@ -XXX,XX +XXX,XX @@ static void s390_machine_reset(MachineState *machine)
319
s390_machine_unprotect(ms);
320
}
321
322
- qemu_devices_reset();
323
+ qemu_devices_reset(reason);
324
s390_crypto_reset();
325
326
/* configure and start the ipl CPU only */
327
diff --git a/migration/savevm.c b/migration/savevm.c
328
index XXXXXXX..XXXXXXX 100644
329
--- a/migration/savevm.c
330
+++ b/migration/savevm.c
331
@@ -XXX,XX +XXX,XX @@ bool load_snapshot(const char *name, const char *vmstate,
332
goto err_drain;
333
}
334
335
- qemu_system_reset(SHUTDOWN_CAUSE_NONE);
336
+ qemu_system_reset(SHUTDOWN_CAUSE_SNAPSHOT_LOAD);
337
mis->from_src_file = f;
338
339
if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) {
340
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
341
index XXXXXXX..XXXXXXX 100644
342
--- a/softmmu/runstate.c
343
+++ b/softmmu/runstate.c
344
@@ -XXX,XX +XXX,XX @@ void qemu_system_reset(ShutdownCause reason)
345
cpu_synchronize_all_states();
346
347
if (mc && mc->reset) {
348
- mc->reset(current_machine);
349
+ mc->reset(current_machine, reason);
350
} else {
351
- qemu_devices_reset();
352
+ qemu_devices_reset(reason);
353
}
354
- if (reason && reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
355
+ switch (reason) {
356
+ case SHUTDOWN_CAUSE_NONE:
357
+ case SHUTDOWN_CAUSE_SUBSYSTEM_RESET:
358
+ case SHUTDOWN_CAUSE_SNAPSHOT_LOAD:
359
+ break;
360
+ default:
361
qapi_event_send_reset(shutdown_caused_by_guest(reason), reason);
362
}
363
cpu_synchronize_all_post_reset();
47
--
364
--
48
2.20.1
365
2.25.1
49
50
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Since commit aa35ec2213b ("hw/arm/raspi: Use more specific
3
When the system reboots, the rng-seed that the FDT has should be
4
machine names") the raspi2/raspi3 machines have been renamed
4
re-randomized, so that the new boot gets a new seed. Several
5
as raspi2b/raspi3b.
5
architectures require this functionality, so export a function for
6
injecting a new seed into the given FDT.
6
7
7
Note, rather than the raspi3b, the raspi3ap introduced in
8
Cc: Alistair Francis <alistair.francis@wdc.com>
8
commit 5be94252d34 ("hw/arm/raspi: Add the Raspberry Pi 3
9
Cc: David Gibson <david@gibson.dropbear.id.au>
9
model A+") is a closer match to what QEMU models, but only
10
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
10
provides 512 MB of RAM.
11
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
12
Message-id: 20221025004327.568476-3-Jason@zx2c4.com
12
As more Raspberry Pi 2/3 models are emulated, in order
13
to avoid confusion, deprecate the raspi2/raspi3 machine
14
aliases.
15
16
ACKed-by: Peter Krempa <pkrempa@redhat.com>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
19
Message-id: 20201120173953.2539469-2-f4bug@amsat.org
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
---
14
---
22
docs/system/deprecated.rst | 7 +++++++
15
include/sysemu/device_tree.h | 9 +++++++++
23
1 file changed, 7 insertions(+)
16
softmmu/device_tree.c | 21 +++++++++++++++++++++
17
2 files changed, 30 insertions(+)
24
18
25
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
19
diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h
26
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
27
--- a/docs/system/deprecated.rst
21
--- a/include/sysemu/device_tree.h
28
+++ b/docs/system/deprecated.rst
22
+++ b/include/sysemu/device_tree.h
29
@@ -XXX,XX +XXX,XX @@ This machine has been renamed ``fuloong2e``.
23
@@ -XXX,XX +XXX,XX @@ int qemu_fdt_setprop_sized_cells_from_array(void *fdt,
30
These machine types are very old and likely can not be used for live migration
24
qdt_tmp); \
31
from old QEMU versions anymore. A newer machine type should be used instead.
25
})
32
26
33
+Raspberry Pi ``raspi2`` and ``raspi3`` machines (since 5.2)
34
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
35
+
27
+
36
+The Raspberry Pi machines come in various models (A, A+, B, B+). To be able
28
+/**
37
+to distinguish which model QEMU is implementing, the ``raspi2`` and ``raspi3``
29
+ * qemu_fdt_randomize_seeds:
38
+machines have been renamed ``raspi2b`` and ``raspi3b``.
30
+ * @fdt: device tree blob
31
+ *
32
+ * Re-randomize all "rng-seed" properties with new seeds.
33
+ */
34
+void qemu_fdt_randomize_seeds(void *fdt);
39
+
35
+
40
Device options
36
#define FDT_PCI_RANGE_RELOCATABLE 0x80000000
41
--------------
37
#define FDT_PCI_RANGE_PREFETCHABLE 0x40000000
42
38
#define FDT_PCI_RANGE_ALIASED 0x20000000
39
diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c
40
index XXXXXXX..XXXXXXX 100644
41
--- a/softmmu/device_tree.c
42
+++ b/softmmu/device_tree.c
43
@@ -XXX,XX +XXX,XX @@
44
#include "qemu/option.h"
45
#include "qemu/bswap.h"
46
#include "qemu/cutils.h"
47
+#include "qemu/guest-random.h"
48
#include "sysemu/device_tree.h"
49
#include "hw/loader.h"
50
#include "hw/boards.h"
51
@@ -XXX,XX +XXX,XX @@ void hmp_dumpdtb(Monitor *mon, const QDict *qdict)
52
53
info_report("dtb dumped to %s", filename);
54
}
55
+
56
+void qemu_fdt_randomize_seeds(void *fdt)
57
+{
58
+ int noffset, poffset, len;
59
+ const char *name;
60
+ uint8_t *data;
61
+
62
+ for (noffset = fdt_next_node(fdt, 0, NULL);
63
+ noffset >= 0;
64
+ noffset = fdt_next_node(fdt, noffset, NULL)) {
65
+ for (poffset = fdt_first_property_offset(fdt, noffset);
66
+ poffset >= 0;
67
+ poffset = fdt_next_property_offset(fdt, poffset)) {
68
+ data = (uint8_t *)fdt_getprop_by_offset(fdt, poffset, &name, &len);
69
+ if (!data || strcmp(name, "rng-seed"))
70
+ continue;
71
+ qemu_guest_getrandom_nofail(data, len);
72
+ }
73
+ }
74
+}
43
--
75
--
44
2.20.1
76
2.25.1
45
46
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Fixes: 0553ef42571 ("docs: add Orange Pi PC document")
3
Snapshot loading is supposed to be deterministic, so we shouldn't
4
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
re-randomize the various seeds used.
5
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
5
6
Message-id: 20201120154545.2504625-5-f4bug@amsat.org
6
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7
Message-id: 20221025004327.568476-4-Jason@zx2c4.com
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
MAINTAINERS | 2 +-
11
hw/i386/x86.c | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
12
13
13
diff --git a/MAINTAINERS b/MAINTAINERS
14
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/MAINTAINERS
16
--- a/hw/i386/x86.c
16
+++ b/MAINTAINERS
17
+++ b/hw/i386/x86.c
17
@@ -XXX,XX +XXX,XX @@ S: Maintained
18
@@ -XXX,XX +XXX,XX @@ void x86_load_linux(X86MachineState *x86ms,
18
F: hw/*/allwinner-h3*
19
setup_data->type = cpu_to_le32(SETUP_RNG_SEED);
19
F: include/hw/*/allwinner-h3*
20
setup_data->len = cpu_to_le32(RNG_SEED_LENGTH);
20
F: hw/arm/orangepi.c
21
qemu_guest_getrandom_nofail(setup_data->data, RNG_SEED_LENGTH);
21
-F: docs/system/orangepi.rst
22
- qemu_register_reset(reset_rng_seed, setup_data);
22
+F: docs/system/arm/orangepi.rst
23
+ qemu_register_reset_nosnapshotload(reset_rng_seed, setup_data);
23
24
fw_cfg_add_bytes_callback(fw_cfg, FW_CFG_KERNEL_DATA, reset_rng_seed, NULL,
24
ARM PrimeCell and CMSDK devices
25
setup_data, kernel, kernel_size, true);
25
M: Peter Maydell <peter.maydell@linaro.org>
26
} else {
26
--
27
--
27
2.20.1
28
2.25.1
28
29
diff view generated by jsdifflib
1
From: AlexChen <alex.chen@huawei.com>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
We should use printf format specifier "%u" instead of "%i" for
3
When the system reboots, the rng-seed that the FDT has should be
4
argument of type "unsigned int".
4
re-randomized, so that the new boot gets a new seed. Since the FDT is in
5
the ROM region at this point, we add a hook right after the ROM has been
6
added, so that we have a pointer to that copy of the FDT.
5
7
6
Reported-by: Euler Robot <euler.robot@huawei.com>
8
Cc: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
9
Cc: qemu-arm@nongnu.org
8
Message-id: 5F9FD78B.8000300@huawei.com
10
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11
Message-id: 20221025004327.568476-5-Jason@zx2c4.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
14
---
12
hw/arm/pxa2xx.c | 2 +-
15
hw/arm/boot.c | 2 ++
13
hw/arm/spitz.c | 2 +-
16
1 file changed, 2 insertions(+)
14
hw/arm/tosa.c | 2 +-
15
3 files changed, 3 insertions(+), 3 deletions(-)
16
17
17
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
18
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
18
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/pxa2xx.c
20
--- a/hw/arm/boot.c
20
+++ b/hw/arm/pxa2xx.c
21
+++ b/hw/arm/boot.c
21
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_ssp_write(void *opaque, hwaddr addr,
22
@@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
22
if (value & SSCR0_MOD)
23
* the DTB is copied again upon reset, even if addr points into RAM.
23
printf("%s: Attempt to use network mode\n", __func__);
24
*/
24
if (s->enable && SSCR0_DSS(value) < 4)
25
rom_add_blob_fixed_as("dtb", fdt, size, addr, as);
25
- printf("%s: Wrong data size: %i bits\n", __func__,
26
+ qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
26
+ printf("%s: Wrong data size: %u bits\n", __func__,
27
+ rom_ptr_for_as(as, addr, size));
27
SSCR0_DSS(value));
28
28
if (!(value & SSCR0_SSE)) {
29
g_free(fdt);
29
s->sssr = 0;
30
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/arm/spitz.c
33
+++ b/hw/arm/spitz.c
34
@@ -XXX,XX +XXX,XX @@ struct SpitzLCDTG {
35
static void spitz_bl_update(SpitzLCDTG *s)
36
{
37
if (s->bl_power && s->bl_intensity)
38
- zaurus_printf("LCD Backlight now at %i/63\n", s->bl_intensity);
39
+ zaurus_printf("LCD Backlight now at %u/63\n", s->bl_intensity);
40
else
41
zaurus_printf("LCD Backlight now off\n");
42
}
43
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/arm/tosa.c
46
+++ b/hw/arm/tosa.c
47
@@ -XXX,XX +XXX,XX @@ static void tosa_gpio_setup(PXA2xxState *cpu,
48
49
static uint32_t tosa_ssp_tansfer(SSISlave *dev, uint32_t value)
50
{
51
- fprintf(stderr, "TG: %d %02x\n", value >> 5, value & 0x1f);
52
+ fprintf(stderr, "TG: %u %02x\n", value >> 5, value & 0x1f);
53
return 0;
54
}
55
30
56
--
31
--
57
2.20.1
32
2.25.1
58
59
diff view generated by jsdifflib
1
From: Chen Qun <kuhn.chenqun@huawei.com>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
When 'j = icu->nr_sense – 1', the 'j < icu->nr_sense' condition is true,
3
When the system reboots, the rng-seed that the FDT has should be
4
then 'j = icu->nr_sense', the'icu->init_sense[j]' has out-of-bounds access.
4
re-randomized, so that the new boot gets a new seed. Since the FDT is in
5
the ROM region at this point, we add a hook right after the ROM has been
6
added, so that we have a pointer to that copy of the FDT.
5
7
6
The asan showed stack:
8
Cc: Palmer Dabbelt <palmer@dabbelt.com>
7
ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000004d7d at pc 0x55852cd26a76 bp 0x7ffe39f26200 sp 0x7ffe39f261f0
9
Cc: Alistair Francis <alistair.francis@wdc.com>
8
READ of size 1 at 0x604000004d7d thread T0
10
Cc: Bin Meng <bin.meng@windriver.com>
9
#0 0x55852cd26a75 in rxicu_realize ../hw/intc/rx_icu.c:311
11
Cc: qemu-riscv@nongnu.org
10
#1 0x55852cf075f7 in device_set_realized ../hw/core/qdev.c:886
12
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
11
#2 0x55852cd4a32f in property_set_bool ../qom/object.c:2251
13
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
12
#3 0x55852cd4f9bb in object_property_set ../qom/object.c:1398
14
Message-id: 20221025004327.568476-6-Jason@zx2c4.com
13
#4 0x55852cd54f3f in object_property_set_qobject ../qom/qom-qobject.c:28
14
#5 0x55852cd4fc3f in object_property_set_bool ../qom/object.c:1465
15
#6 0x55852cbf0b27 in register_icu ../hw/rx/rx62n.c:156
16
#7 0x55852cbf12a6 in rx62n_realize ../hw/rx/rx62n.c:261
17
#8 0x55852cf075f7 in device_set_realized ../hw/core/qdev.c:886
18
#9 0x55852cd4a32f in property_set_bool ../qom/object.c:2251
19
#10 0x55852cd4f9bb in object_property_set ../qom/object.c:1398
20
#11 0x55852cd54f3f in object_property_set_qobject ../qom/qom-qobject.c:28
21
#12 0x55852cd4fc3f in object_property_set_bool ../qom/object.c:1465
22
#13 0x55852cbf1a85 in rx_gdbsim_init ../hw/rx/rx-gdbsim.c:109
23
#14 0x55852cd22de0 in qemu_init ../softmmu/vl.c:4380
24
#15 0x55852ca57088 in main ../softmmu/main.c:49
25
#16 0x7feefafa5d42 in __libc_start_main (/lib64/libc.so.6+0x26d42)
26
27
Add the 'ice->src[i].sense' initialize to the default value, and then
28
process init_sense array to identify which irqs should be level-triggered.
29
30
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
31
Reported-by: Euler Robot <euler.robot@huawei.com>
32
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
33
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
34
Message-id: 20201111141733.2358800-1-kuhn.chenqun@huawei.com
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
36
---
16
---
37
hw/intc/rx_icu.c | 18 ++++++++----------
17
hw/riscv/boot.c | 3 +++
38
1 file changed, 8 insertions(+), 10 deletions(-)
18
1 file changed, 3 insertions(+)
39
19
40
diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c
20
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
41
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/intc/rx_icu.c
22
--- a/hw/riscv/boot.c
43
+++ b/hw/intc/rx_icu.c
23
+++ b/hw/riscv/boot.c
44
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps icu_ops = {
24
@@ -XXX,XX +XXX,XX @@
45
static void rxicu_realize(DeviceState *dev, Error **errp)
25
#include "sysemu/device_tree.h"
46
{
26
#include "sysemu/qtest.h"
47
RXICUState *icu = RX_ICU(dev);
27
#include "sysemu/kvm.h"
48
- int i, j;
28
+#include "sysemu/reset.h"
49
+ int i;
29
50
30
#include <libfdt.h>
51
if (icu->init_sense == NULL) {
31
52
qemu_log_mask(LOG_GUEST_ERROR,
32
@@ -XXX,XX +XXX,XX @@ uint64_t riscv_load_fdt(hwaddr dram_base, uint64_t mem_size, void *fdt)
53
"rx_icu: trigger-level property must be set.");
33
54
return;
34
rom_add_blob_fixed_as("fdt", fdt, fdtsize, fdt_addr,
55
}
35
&address_space_memory);
56
- for (i = j = 0; i < NR_IRQS; i++) {
36
+ qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
57
- if (icu->init_sense[j] == i) {
37
+ rom_ptr_for_as(&address_space_memory, fdt_addr, fdtsize));
58
- icu->src[i].sense = TRG_LEVEL;
38
59
- if (j < icu->nr_sense) {
39
return fdt_addr;
60
- j++;
61
- }
62
- } else {
63
- icu->src[i].sense = TRG_PEDGE;
64
- }
65
+
66
+ for (i = 0; i < NR_IRQS; i++) {
67
+ icu->src[i].sense = TRG_PEDGE;
68
+ }
69
+ for (i = 0; i < icu->nr_sense; i++) {
70
+ uint8_t irqno = icu->init_sense[i];
71
+ icu->src[irqno].sense = TRG_LEVEL;
72
}
73
icu->req_irq = -1;
74
}
40
}
75
--
41
--
76
2.20.1
42
2.25.1
77
78
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
Snapshot loading is supposed to be deterministic, so we shouldn't
4
Message-id: 20201120154545.2504625-7-f4bug@amsat.org
4
re-randomize the various seeds used.
5
6
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7
Message-id: 20221025004327.568476-7-Jason@zx2c4.com
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
10
---
8
MAINTAINERS | 1 +
11
hw/m68k/virt.c | 20 +++++++++++---------
9
1 file changed, 1 insertion(+)
12
1 file changed, 11 insertions(+), 9 deletions(-)
10
13
11
diff --git a/MAINTAINERS b/MAINTAINERS
14
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
12
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
16
--- a/hw/m68k/virt.c
14
+++ b/MAINTAINERS
17
+++ b/hw/m68k/virt.c
15
@@ -XXX,XX +XXX,XX @@ L: qemu-arm@nongnu.org
18
@@ -XXX,XX +XXX,XX @@ typedef struct {
16
S: Maintained
19
M68kCPU *cpu;
17
F: hw/*/omap*
20
hwaddr initial_pc;
18
F: include/hw/arm/omap.h
21
hwaddr initial_stack;
19
+F: docs/system/arm/sx1.rst
22
- struct bi_record *rng_seed;
20
23
} ResetInfo;
21
IPack
24
22
M: Alberto Garcia <berto@igalia.com>
25
static void main_cpu_reset(void *opaque)
26
@@ -XXX,XX +XXX,XX @@ static void main_cpu_reset(void *opaque)
27
M68kCPU *cpu = reset_info->cpu;
28
CPUState *cs = CPU(cpu);
29
30
- if (reset_info->rng_seed) {
31
- qemu_guest_getrandom_nofail((void *)reset_info->rng_seed->data + 2,
32
- be16_to_cpu(*(uint16_t *)reset_info->rng_seed->data));
33
- }
34
-
35
cpu_reset(cs);
36
cpu->env.aregs[7] = reset_info->initial_stack;
37
cpu->env.pc = reset_info->initial_pc;
38
}
39
40
+static void rerandomize_rng_seed(void *opaque)
41
+{
42
+ struct bi_record *rng_seed = opaque;
43
+ qemu_guest_getrandom_nofail((void *)rng_seed->data + 2,
44
+ be16_to_cpu(*(uint16_t *)rng_seed->data));
45
+}
46
+
47
static void virt_init(MachineState *machine)
48
{
49
M68kCPU *cpu = NULL;
50
@@ -XXX,XX +XXX,XX @@ static void virt_init(MachineState *machine)
51
BOOTINFO0(param_ptr, BI_LAST);
52
rom_add_blob_fixed_as("bootinfo", param_blob, param_ptr - param_blob,
53
parameters_base, cs->as);
54
- reset_info->rng_seed = rom_ptr_for_as(cs->as, parameters_base,
55
- param_ptr - param_blob) +
56
- (param_rng_seed - param_blob);
57
+ qemu_register_reset_nosnapshotload(rerandomize_rng_seed,
58
+ rom_ptr_for_as(cs->as, parameters_base,
59
+ param_ptr - param_blob) +
60
+ (param_rng_seed - param_blob));
61
g_free(param_blob);
62
}
63
}
23
--
64
--
24
2.20.1
65
2.25.1
25
26
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
Snapshot loading is supposed to be deterministic, so we shouldn't
4
Message-id: 20201120154545.2504625-6-f4bug@amsat.org
4
re-randomize the various seeds used.
5
6
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7
Message-id: 20221025004327.568476-8-Jason@zx2c4.com
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
10
---
8
MAINTAINERS | 1 +
11
hw/m68k/q800.c | 33 +++++++++++++--------------------
9
1 file changed, 1 insertion(+)
12
1 file changed, 13 insertions(+), 20 deletions(-)
10
13
11
diff --git a/MAINTAINERS b/MAINTAINERS
14
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
12
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
16
--- a/hw/m68k/q800.c
14
+++ b/MAINTAINERS
17
+++ b/hw/m68k/q800.c
15
@@ -XXX,XX +XXX,XX @@ R: Leif Lindholm <leif@nuviainc.com>
18
@@ -XXX,XX +XXX,XX @@ static const TypeInfo glue_info = {
16
L: qemu-arm@nongnu.org
19
},
17
S: Maintained
20
};
18
F: hw/arm/sbsa-ref.c
21
19
+F: docs/system/arm/sbsa.rst
22
-typedef struct {
20
23
- M68kCPU *cpu;
21
Sharp SL-5500 (Collie) PDA
24
- struct bi_record *rng_seed;
22
M: Peter Maydell <peter.maydell@linaro.org>
25
-} ResetInfo;
26
-
27
static void main_cpu_reset(void *opaque)
28
{
29
- ResetInfo *reset_info = opaque;
30
- M68kCPU *cpu = reset_info->cpu;
31
+ M68kCPU *cpu = opaque;
32
CPUState *cs = CPU(cpu);
33
34
- if (reset_info->rng_seed) {
35
- qemu_guest_getrandom_nofail((void *)reset_info->rng_seed->data + 2,
36
- be16_to_cpu(*(uint16_t *)reset_info->rng_seed->data));
37
- }
38
-
39
cpu_reset(cs);
40
cpu->env.aregs[7] = ldl_phys(cs->as, 0);
41
cpu->env.pc = ldl_phys(cs->as, 4);
42
}
43
44
+static void rerandomize_rng_seed(void *opaque)
45
+{
46
+ struct bi_record *rng_seed = opaque;
47
+ qemu_guest_getrandom_nofail((void *)rng_seed->data + 2,
48
+ be16_to_cpu(*(uint16_t *)rng_seed->data));
49
+}
50
+
51
static uint8_t fake_mac_rom[] = {
52
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53
54
@@ -XXX,XX +XXX,XX @@ static void q800_init(MachineState *machine)
55
NubusBus *nubus;
56
DeviceState *glue;
57
DriveInfo *dinfo;
58
- ResetInfo *reset_info;
59
uint8_t rng_seed[32];
60
61
linux_boot = (kernel_filename != NULL);
62
@@ -XXX,XX +XXX,XX @@ static void q800_init(MachineState *machine)
63
exit(1);
64
}
65
66
- reset_info = g_new0(ResetInfo, 1);
67
-
68
/* init CPUs */
69
cpu = M68K_CPU(cpu_create(machine->cpu_type));
70
- reset_info->cpu = cpu;
71
- qemu_register_reset(main_cpu_reset, reset_info);
72
+ qemu_register_reset(main_cpu_reset, cpu);
73
74
/* RAM */
75
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
76
@@ -XXX,XX +XXX,XX @@ static void q800_init(MachineState *machine)
77
BOOTINFO0(param_ptr, BI_LAST);
78
rom_add_blob_fixed_as("bootinfo", param_blob, param_ptr - param_blob,
79
parameters_base, cs->as);
80
- reset_info->rng_seed = rom_ptr_for_as(cs->as, parameters_base,
81
- param_ptr - param_blob) +
82
- (param_rng_seed - param_blob);
83
+ qemu_register_reset_nosnapshotload(rerandomize_rng_seed,
84
+ rom_ptr_for_as(cs->as, parameters_base,
85
+ param_ptr - param_blob) +
86
+ (param_rng_seed - param_blob));
87
g_free(param_blob);
88
} else {
89
uint8_t *ptr;
23
--
90
--
24
2.20.1
91
2.25.1
25
26
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
When the system reboots, the rng-seed that the FDT has should be
4
Message-id: 20201120154545.2504625-4-f4bug@amsat.org
4
re-randomized, so that the new boot gets a new seed. Since the FDT is in
5
the ROM region at this point, we add a hook right after the ROM has been
6
added, so that we have a pointer to that copy of the FDT.
7
8
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>
9
Cc: Paul Burton <paulburton@kernel.org>
10
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
12
Message-id: 20221025004327.568476-9-Jason@zx2c4.com
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
15
---
8
MAINTAINERS | 1 +
16
hw/mips/boston.c | 3 +++
9
1 file changed, 1 insertion(+)
17
1 file changed, 3 insertions(+)
10
18
11
diff --git a/MAINTAINERS b/MAINTAINERS
19
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
12
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
21
--- a/hw/mips/boston.c
14
+++ b/MAINTAINERS
22
+++ b/hw/mips/boston.c
15
@@ -XXX,XX +XXX,XX @@ F: include/hw/*/npcm7xx*
23
@@ -XXX,XX +XXX,XX @@
16
F: tests/qtest/npcm7xx*
24
#include "sysemu/sysemu.h"
17
F: pc-bios/npcm7xx_bootrom.bin
25
#include "sysemu/qtest.h"
18
F: roms/vbootrom
26
#include "sysemu/runstate.h"
19
+F: docs/system/arm/nuvoton.rst
27
+#include "sysemu/reset.h"
20
28
21
nSeries
29
#include <libfdt.h>
22
M: Andrzej Zaborowski <balrogg@gmail.com>
30
#include "qom/object.h"
31
@@ -XXX,XX +XXX,XX @@ static void boston_mach_init(MachineState *machine)
32
/* Calculate real fdt size after filter */
33
dt_size = fdt_totalsize(dtb_load_data);
34
rom_add_blob_fixed("dtb", dtb_load_data, dt_size, dtb_paddr);
35
+ qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
36
+ rom_ptr(dtb_paddr, dt_size));
37
} else {
38
/* Try to load file as FIT */
39
fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, s);
23
--
40
--
24
2.20.1
41
2.25.1
25
42
26
43
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
When the system reboots, the rng-seed that the FDT has should be
4
Reviewed-by: Cédric Le Goater <clg@kaod.org>
4
re-randomized, so that the new boot gets a new seed. Since the FDT is in
5
Message-id: 20201120154545.2504625-3-f4bug@amsat.org
5
the ROM region at this point, we add a hook right after the ROM has been
6
added, so that we have a pointer to that copy of the FDT.
7
8
Cc: Stafford Horne <shorne@gmail.com>
9
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
10
Message-id: 20221025004327.568476-11-Jason@zx2c4.com
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
13
---
9
MAINTAINERS | 1 +
14
hw/openrisc/boot.c | 3 +++
10
1 file changed, 1 insertion(+)
15
1 file changed, 3 insertions(+)
11
16
12
diff --git a/MAINTAINERS b/MAINTAINERS
17
diff --git a/hw/openrisc/boot.c b/hw/openrisc/boot.c
13
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
14
--- a/MAINTAINERS
19
--- a/hw/openrisc/boot.c
15
+++ b/MAINTAINERS
20
+++ b/hw/openrisc/boot.c
16
@@ -XXX,XX +XXX,XX @@ F: include/hw/*/*aspeed*
21
@@ -XXX,XX +XXX,XX @@
17
F: include/hw/misc/pca9552*.h
22
#include "hw/openrisc/boot.h"
18
F: hw/net/ftgmac100.c
23
#include "sysemu/device_tree.h"
19
F: include/hw/net/ftgmac100.h
24
#include "sysemu/qtest.h"
20
+F: docs/system/arm/aspeed.rst
25
+#include "sysemu/reset.h"
21
26
22
NRF51
27
#include <libfdt.h>
23
M: Joel Stanley <joel@jms.id.au>
28
29
@@ -XXX,XX +XXX,XX @@ uint32_t openrisc_load_fdt(void *fdt, hwaddr load_start,
30
31
rom_add_blob_fixed_as("fdt", fdt, fdtsize, fdt_addr,
32
&address_space_memory);
33
+ qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
34
+ rom_ptr_for_as(&address_space_memory, fdt_addr, fdtsize));
35
36
return fdt_addr;
37
}
24
--
38
--
25
2.20.1
39
2.25.1
26
27
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
When the system reboots, the rng-seed that the FDT has should be
4
Message-id: 20201120154545.2504625-2-f4bug@amsat.org
4
re-randomized, so that the new boot gets a new seed. Since the FDT is in
5
the ROM region at this point, we add a hook right after the ROM has been
6
added, so that we have a pointer to that copy of the FDT.
7
8
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
9
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
10
Message-id: 20221025004327.568476-12-Jason@zx2c4.com
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
13
---
8
MAINTAINERS | 1 +
14
hw/rx/rx-gdbsim.c | 3 +++
9
1 file changed, 1 insertion(+)
15
1 file changed, 3 insertions(+)
10
16
11
diff --git a/MAINTAINERS b/MAINTAINERS
17
diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
12
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
19
--- a/hw/rx/rx-gdbsim.c
14
+++ b/MAINTAINERS
20
+++ b/hw/rx/rx-gdbsim.c
15
@@ -XXX,XX +XXX,XX @@ F: disas/arm.c
21
@@ -XXX,XX +XXX,XX @@
16
F: disas/arm-a64.cc
22
#include "hw/rx/rx62n.h"
17
F: disas/libvixl/
23
#include "sysemu/qtest.h"
18
F: docs/system/target-arm.rst
24
#include "sysemu/device_tree.h"
19
+F: docs/system/arm/cpu-features.rst
25
+#include "sysemu/reset.h"
20
26
#include "hw/boards.h"
21
ARM SMMU
27
#include "qom/object.h"
22
M: Eric Auger <eric.auger@redhat.com>
28
29
@@ -XXX,XX +XXX,XX @@ static void rx_gdbsim_init(MachineState *machine)
30
dtb_offset = ROUND_DOWN(machine->ram_size - dtb_size, 16);
31
rom_add_blob_fixed("dtb", dtb, dtb_size,
32
SDRAM_BASE + dtb_offset);
33
+ qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
34
+ rom_ptr(SDRAM_BASE + dtb_offset, dtb_size));
35
/* Set dtb address to R1 */
36
RX_CPU(first_cpu)->env.regs[1] = SDRAM_BASE + dtb_offset;
37
}
23
--
38
--
24
2.20.1
39
2.25.1
25
26
diff view generated by jsdifflib