1
Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code.
1
The following changes since commit efcd0ec14b0fe9ee0ee70277763b2d538d19238d:
2
2
3
-- PMM
3
Merge tag 'misc-fixes-20230330' of https://github.com/philmd/qemu into staging (2023-03-30 14:22:29 +0100)
4
5
The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236:
6
7
Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700)
8
4
9
are available in the Git repository at:
5
are available in the Git repository at:
10
6
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230403
12
8
13
for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc:
9
for you to fetch changes up to a0eaa126af3c5a43937a22c58cfb9bb36e4a5001:
14
10
15
target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100)
11
hw/ssi: Fix Linux driver init issue with xilinx_spi (2023-04-03 16:12:30 +0100)
16
12
17
----------------------------------------------------------------
13
----------------------------------------------------------------
18
target-arm queue:
14
* target/arm: Fix non-TCG build failure by inlining pauth_ptr_mask()
19
* Fix KVM SVE ID register probe code
15
* hw/arm: do not free machine->fdt in arm_load_dtb()
16
* target/arm: Fix generated code for cpreg reads when HSTR is active
17
* hw/ssi: Fix Linux driver init issue with xilinx_spi
20
18
21
----------------------------------------------------------------
19
----------------------------------------------------------------
22
Richard Henderson (3):
20
Chris Rauer (1):
23
target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features
21
hw/ssi: Fix Linux driver init issue with xilinx_spi
24
target/arm: Set KVM_ARM_VCPU_SVE while probing the host
25
target/arm: Move sve probe inside kvm >= 4.15 branch
26
22
27
target/arm/kvm64.c | 45 ++++++++++++++++++++++-----------------------
23
Markus Armbruster (1):
28
1 file changed, 22 insertions(+), 23 deletions(-)
24
hw/arm: do not free machine->fdt in arm_load_dtb()
25
26
Peter Maydell (1):
27
target/arm: Fix generated code for cpreg reads when HSTR is active
28
29
Philippe Mathieu-Daudé (1):
30
target/arm: Fix non-TCG build failure by inlining pauth_ptr_mask()
31
32
target/arm/internals.h | 15 ++++++++++-----
33
hw/arm/boot.c | 5 ++++-
34
hw/ssi/xilinx_spi.c | 1 +
35
target/arm/gdbstub64.c | 7 +++++--
36
target/arm/tcg/pauth_helper.c | 18 +-----------------
37
target/arm/tcg/translate.c | 6 ++++++
38
6 files changed, 27 insertions(+), 25 deletions(-)
39
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
2
3
aarch64_gdb_get_pauth_reg() -- although disabled since commit
4
5787d17a42 ("target/arm: Don't advertise aarch64-pauth.xml to
5
gdb") is still compiled in. It calls pauth_ptr_mask() which is
6
located in target/arm/tcg/pauth_helper.c, a TCG specific helper.
7
8
To avoid a linking error when TCG is not enabled:
9
10
Undefined symbols for architecture arm64:
11
"_pauth_ptr_mask", referenced from:
12
_aarch64_gdb_get_pauth_reg in target_arm_gdbstub64.c.o
13
ld: symbol(s) not found for architecture arm64
14
clang: error: linker command failed with exit code 1 (use -v to see invocation)
15
16
- Inline pauth_ptr_mask() in aarch64_gdb_get_pauth_reg()
17
(this is the single user),
18
- Rename pauth_ptr_mask_internal() as pauth_ptr_mask() and
19
inline it in "internals.h",
20
21
Fixes: e995d5cce4 ("target/arm: Implement gdbstub pauth extension")
22
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Fabiano Rosas <farosas@suse.de>
24
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
26
Message-id: 20230328212516.29592-1-philmd@linaro.org
27
[PMM: reinstated doc comment]
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
---
30
target/arm/internals.h | 15 ++++++++++-----
31
target/arm/gdbstub64.c | 7 +++++--
32
target/arm/tcg/pauth_helper.c | 18 +-----------------
33
3 files changed, 16 insertions(+), 24 deletions(-)
34
35
diff --git a/target/arm/internals.h b/target/arm/internals.h
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/internals.h
38
+++ b/target/arm/internals.h
39
@@ -XXX,XX +XXX,XX @@ bool arm_generate_debug_exceptions(CPUARMState *env);
40
41
/**
42
* pauth_ptr_mask:
43
- * @env: cpu context
44
- * @ptr: selects between TTBR0 and TTBR1
45
- * @data: selects between TBI and TBID
46
+ * @param: parameters defining the MMU setup
47
*
48
- * Return a mask of the bits of @ptr that contain the authentication code.
49
+ * Return a mask of the address bits that contain the authentication code,
50
+ * given the MMU config defined by @param.
51
*/
52
-uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t ptr, bool data);
53
+static inline uint64_t pauth_ptr_mask(ARMVAParameters param)
54
+{
55
+ int bot_pac_bit = 64 - param.tsz;
56
+ int top_pac_bit = 64 - 8 * param.tbi;
57
+
58
+ return MAKE_64BIT_MASK(bot_pac_bit, top_pac_bit - bot_pac_bit);
59
+}
60
61
/* Add the cpreg definitions for debug related system registers */
62
void define_debug_regs(ARMCPU *cpu);
63
diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/gdbstub64.c
66
+++ b/target/arm/gdbstub64.c
67
@@ -XXX,XX +XXX,XX @@ int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg)
68
{
69
bool is_data = !(reg & 1);
70
bool is_high = reg & 2;
71
- uint64_t mask = pauth_ptr_mask(env, -is_high, is_data);
72
- return gdb_get_reg64(buf, mask);
73
+ ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
74
+ ARMVAParameters param;
75
+
76
+ param = aa64_va_parameters(env, -is_high, mmu_idx, is_data);
77
+ return gdb_get_reg64(buf, pauth_ptr_mask(param));
78
}
79
default:
80
return 0;
81
diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/tcg/pauth_helper.c
84
+++ b/target/arm/tcg/pauth_helper.c
85
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
86
return pac | ext | ptr;
87
}
88
89
-static uint64_t pauth_ptr_mask_internal(ARMVAParameters param)
90
-{
91
- int bot_pac_bit = 64 - param.tsz;
92
- int top_pac_bit = 64 - 8 * param.tbi;
93
-
94
- return MAKE_64BIT_MASK(bot_pac_bit, top_pac_bit - bot_pac_bit);
95
-}
96
-
97
static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param)
98
{
99
- uint64_t mask = pauth_ptr_mask_internal(param);
100
+ uint64_t mask = pauth_ptr_mask(param);
101
102
/* Note that bit 55 is used whether or not the regime has 2 ranges. */
103
if (extract64(ptr, 55, 1)) {
104
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param)
105
}
106
}
107
108
-uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t ptr, bool data)
109
-{
110
- ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
111
- ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data);
112
-
113
- return pauth_ptr_mask_internal(param);
114
-}
115
-
116
static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier,
117
ARMPACKey *key, bool data, int keynumber)
118
{
119
--
120
2.34.1
121
122
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Markus Armbruster <armbru@redhat.com>
2
2
3
The test for the IF block indicates no ID registers are exposed, much
3
At this moment, arm_load_dtb() can free machine->fdt when
4
less host support for SVE. Move the SVE probe into the ELSE block.
4
binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be
5
retrieved by binfo->get_dtb(). If get_dtb() returns machine->fdt, as is
6
the case of machvirt_dtb() from hw/arm/virt.c, fdt now has a pointer to
7
machine->fdt. And, in that case, the existing g_free(fdt) at the end of
8
arm_load_dtb() will make machine->fdt point to an invalid memory region.
5
9
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Since monitor command 'dumpdtb' was introduced a couple of releases
7
Message-id: 20220726045828.53697-4-richard.henderson@linaro.org
11
ago, running it with any ARM machine that uses arm_load_dtb() will
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
crash QEMU.
13
14
Let's enable all arm_load_dtb() callers to use dumpdtb properly. Instead
15
of freeing 'fdt', assign it back to ms->fdt.
16
17
Cc: Peter Maydell <peter.maydell@linaro.org>
18
Cc: qemu-arm@nongnu.org
19
Fixes: bf353ad55590f ("qmp/hmp, device_tree.c: introduce dumpdtb")
20
Reported-by: Markus Armbruster <armbru@redhat.com>
21
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
22
Signed-off-by: Markus Armbruster <armbru@redhat.com>
23
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
24
Message-id: 20230328165935.1512846-1-armbru@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
26
---
11
target/arm/kvm64.c | 22 +++++++++++-----------
27
hw/arm/boot.c | 5 ++++-
12
1 file changed, 11 insertions(+), 11 deletions(-)
28
1 file changed, 4 insertions(+), 1 deletion(-)
13
29
14
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
30
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
15
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/kvm64.c
32
--- a/hw/arm/boot.c
17
+++ b/target/arm/kvm64.c
33
+++ b/hw/arm/boot.c
18
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
34
@@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
19
err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0,
35
qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
20
ARM64_SYS_REG(3, 3, 9, 12, 0));
36
rom_ptr_for_as(as, addr, size));
21
}
37
22
- }
38
- g_free(fdt);
23
39
+ if (fdt != ms->fdt) {
24
- if (sve_supported) {
40
+ g_free(ms->fdt);
25
- /*
41
+ ms->fdt = fdt;
26
- * There is a range of kernels between kernel commit 73433762fcae
42
+ }
27
- * and f81cb2c3ad41 which have a bug where the kernel doesn't expose
43
28
- * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled
44
return size;
29
- * SVE support, which resulted in an error rather than RAZ.
45
30
- * So only read the register if we set KVM_ARM_VCPU_SVE above.
31
- */
32
- err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
33
- ARM64_SYS_REG(3, 0, 0, 4, 4));
34
+ if (sve_supported) {
35
+ /*
36
+ * There is a range of kernels between kernel commit 73433762fcae
37
+ * and f81cb2c3ad41 which have a bug where the kernel doesn't
38
+ * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has
39
+ * enabled SVE support, which resulted in an error rather than RAZ.
40
+ * So only read the register if we set KVM_ARM_VCPU_SVE above.
41
+ */
42
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
43
+ ARM64_SYS_REG(3, 0, 0, 4, 4));
44
+ }
45
}
46
47
kvm_arm_destroy_scratch_host_vcpu(fdarray);
48
--
46
--
49
2.25.1
47
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In commit 049edada we added some code to handle HSTR_EL2 traps, which
2
we did as an inline "conditionally branch over a
3
gen_exception_insn()". Unfortunately this fails to take account of
4
the fact that gen_exception_insn() will set s->base.is_jmp to
5
DISAS_NORETURN. That means that at the end of the TB we won't
6
generate the necessary code to handle the "branched over the trap and
7
continued normal execution" codepath. The result is that the TCG
8
main loop thinks that we stopped execution of the TB due to a
9
situation that only happens when icount is enabled, and hits an
10
assertion. Explicitly set is_jmp back to DISAS_NEXT so we generate
11
the correct code for when execution continues past this insn.
2
12
3
Because we weren't setting this flag, our probe of ID_AA64ZFR0
13
Note that this only happens for cpreg reads; writes will call
4
was always returning zero. This also obviates the adjustment
14
gen_lookup_tb() which generates a valid end-of-TB.
5
of ID_AA64PFR0, which had sanitized the SVE field.
6
15
7
The effects of the bug are not visible, because the only thing that
16
Fixes: 049edada ("target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1")
8
ID_AA64ZFR0 is used for within qemu at present is tcg translation.
17
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1551
9
The other tests for SVE within KVM are via ID_AA64PFR0.SVE.
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Message-id: 20230330101900.2320380-1-peter.maydell@linaro.org
21
---
22
target/arm/tcg/translate.c | 6 ++++++
23
1 file changed, 6 insertions(+)
10
24
11
Reported-by: Zenghui Yu <yuzenghui@huawei.com>
25
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20220726045828.53697-3-richard.henderson@linaro.org
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
target/arm/kvm64.c | 27 +++++++++++++--------------
18
1 file changed, 13 insertions(+), 14 deletions(-)
19
20
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
21
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/kvm64.c
27
--- a/target/arm/tcg/translate.c
23
+++ b/target/arm/kvm64.c
28
+++ b/target/arm/tcg/translate.c
24
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
29
@@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,
25
bool sve_supported;
30
tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label);
26
bool pmu_supported = false;
31
27
uint64_t features = 0;
32
gen_exception_insn(s, 0, EXCP_UDEF, syndrome);
28
- uint64_t t;
33
+ /*
29
int err;
34
+ * gen_exception_insn() will set is_jmp to DISAS_NORETURN,
30
35
+ * but since we're conditionally branching over it, we want
31
/* Old kernels may not know about the PREFERRED_TARGET ioctl: however
36
+ * to assume continue-to-next-instruction.
32
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
37
+ */
33
struct kvm_vcpu_init init = { .target = -1, };
38
+ s->base.is_jmp = DISAS_NEXT;
34
39
set_disas_label(s, over);
35
/*
36
- * Ask for Pointer Authentication if supported. We can't play the
37
- * SVE trick of synthesising the ID reg as KVM won't tell us
38
- * whether we have the architected or IMPDEF version of PAuth, so
39
- * we have to use the actual ID regs.
40
+ * Ask for SVE if supported, so that we can query ID_AA64ZFR0,
41
+ * which is otherwise RAZ.
42
+ */
43
+ sve_supported = kvm_arm_sve_supported();
44
+ if (sve_supported) {
45
+ init.features[0] |= 1 << KVM_ARM_VCPU_SVE;
46
+ }
47
+
48
+ /*
49
+ * Ask for Pointer Authentication if supported, so that we get
50
+ * the unsanitized field values for AA64ISAR1_EL1.
51
*/
52
if (kvm_arm_pauth_supported()) {
53
init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS |
54
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
55
}
40
}
56
}
41
}
57
58
- sve_supported = kvm_arm_sve_supported();
59
-
60
- /* Add feature bits that can't appear until after VCPU init. */
61
if (sve_supported) {
62
- t = ahcf->isar.id_aa64pfr0;
63
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
64
- ahcf->isar.id_aa64pfr0 = t;
65
-
66
/*
67
* There is a range of kernels between kernel commit 73433762fcae
68
* and f81cb2c3ad41 which have a bug where the kernel doesn't expose
69
* SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled
70
- * SVE support, so we only read it here, rather than together with all
71
- * the other ID registers earlier.
72
+ * SVE support, which resulted in an error rather than RAZ.
73
+ * So only read the register if we set KVM_ARM_VCPU_SVE above.
74
*/
75
err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
76
ARM64_SYS_REG(3, 0, 0, 4, 4));
77
--
42
--
78
2.25.1
43
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Chris Rauer <crauer@google.com>
2
2
3
Indication for support for SVE will not depend on whether we
3
The problem is that the Linux driver expects the master transaction inhibit
4
perform the query on the main kvm_state or the temp vcpu.
4
bit(R_SPICR_MTI) to be set during driver initialization so that it can
5
detect the fifo size but QEMU defaults it to zero out of reset. The
6
datasheet indicates this bit is active on reset.
5
7
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
See page 25, SPI Control Register section:
7
Message-id: 20220726045828.53697-2-richard.henderson@linaro.org
9
https://www.xilinx.com/content/dam/xilinx/support/documents/ip_documentation/axi_quad_spi/v3_2/pg153-axi-quad-spi.pdf
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
11
Signed-off-by: Chris Rauer <crauer@google.com>
12
Message-id: 20230323182811.2641044-1-crauer@google.com
13
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
15
---
11
target/arm/kvm64.c | 2 +-
16
hw/ssi/xilinx_spi.c | 1 +
12
1 file changed, 1 insertion(+), 1 deletion(-)
17
1 file changed, 1 insertion(+)
13
18
14
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
19
diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c
15
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/kvm64.c
21
--- a/hw/ssi/xilinx_spi.c
17
+++ b/target/arm/kvm64.c
22
+++ b/hw/ssi/xilinx_spi.c
18
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
23
@@ -XXX,XX +XXX,XX @@ static void xlx_spi_do_reset(XilinxSPI *s)
19
}
24
txfifo_reset(s);
20
}
25
21
26
s->regs[R_SPISSR] = ~0;
22
- sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0;
27
+ s->regs[R_SPICR] = R_SPICR_MTI;
23
+ sve_supported = kvm_arm_sve_supported();
28
xlx_spi_update_irq(s);
24
29
xlx_spi_update_cs(s);
25
/* Add feature bits that can't appear until after VCPU init. */
30
}
26
if (sve_supported) {
27
--
31
--
28
2.25.1
32
2.34.1
diff view generated by jsdifflib