Skip to content

Commit e8aa7fd

Browse files
committed
Merge tag 'pull-target-arm-20250113' of https://git.linaro.org/people/pmaydell/qemu-arm into staging
target-arm queue: * hw/arm_sysctl: fix extracting 31th bit of val * hw/misc: cast rpm to uint64_t * tests/qtest/boot-serial-test: Improve ASM * target/arm: Move minor arithmetic helpers out of helper.c * target/arm: change default pauth algorithm to impdef # -----BEGIN PGP SIGNATURE----- # # iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmeFGuUZHHBldGVyLm1h # eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3mFPEAChT9DR/+bNSt0Q28TsCv84 # dMMXle7c821NHTNeP/uBQ0i3aopmOJE145wMSoZza8l+EYjOdQwHpinjfu8J/rOS # mJUgAFRcgUoH77+k0p0x1tqKi7+669TznOMOF4RyudKju5SteVyOGgLNjzJlnItq # 3QRBiDTS+qXqAUhgQtzcuY6Xl5M2KA/cpSWYxQf/JPpZMX2c37V8AlSF/1GkLo6Z # 3afrasXUp+U0+03Pe3Ffknzx/LtkLc2hg2LVX8CeqMLRJSA0ohkSwa/xax+2hn+G # 9fKn92IpQOjEFw6qBTBvkerP2hr6yhDFTVFI9v+lsY4bf7tQGIE75HEGZ1EMr26b # LCIPSQvez9exZl/usLGkUq9MWAiEkhBMy99ajwg5X4IhcbS+oyFtH2teYpt9rd9N # 2dVS5qzErN7TCZQza9A7+bt8v5OtbJk2K8Qx9QhMFU/dIUSp0vOA3NwGu+qkciAb # wNdoXT22Hy0czDiQ/ln3aocmwWeVZN4+AxKNoigQhor+5oIR4lMn1P7yAmsCLeL8 # AaLXJdR4aLnYugh23qzv9wf9kAbxRBMvLbsNTKGG00DYQ0xoY4pQ2CmPAJoVVxpU # FjRydG9sC/6sMoJiOoDVpPW003VY2If8r0ObzqUd2gkw1HLf12yug+lij0LkcXKC # Au7ycaoHiTlluNxyQjsgPg== # =FGfo # -----END PGP SIGNATURE----- # gpg: Signature made Mon 13 Jan 2025 08:53:41 EST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "[email protected]" # gpg: Good signature from "Peter Maydell <[email protected]>" [full] # gpg: aka "Peter Maydell <[email protected]>" [full] # gpg: aka "Peter Maydell <[email protected]>" [full] # gpg: aka "Peter Maydell <[email protected]>" [unknown] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * tag 'pull-target-arm-20250113' of https://git.linaro.org/people/pmaydell/qemu-arm: docs/system/arm/virt: mention specific migration information target/arm: change default pauth algorithm to impdef tests/tcg/aarch64: force qarma5 for pauth-3 test target/arm: add new property to select pauth-qarma5 target/arm: Move minor arithmetic helpers out of helper.c tests/qtest/boot-serial-test: Initialize PL011 Control register tests/qtest/boot-serial-test: Reorder pair of instructions in PL011 test tests/qtest/boot-serial-test: Reduce for() loop in PL011 tests tests/qtest/boot-serial-test: Improve ASM comments of PL011 tests hw/misc: cast rpm to uint64_t hw/arm_sysctl: fix extracting 31th bit of val Signed-off-by: Stefan Hajnoczi <[email protected]>
2 parents dc26a2c + 435d260 commit e8aa7fd

File tree

17 files changed

+377
-316
lines changed

17 files changed

+377
-316
lines changed

docs/system/arm/cpu-features.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,11 @@ Below is the list of TCG VCPU features and their descriptions.
219219
``pauth-qarma3``
220220
When ``pauth`` is enabled, select the architected QARMA3 algorithm.
221221

222-
Without either ``pauth-impdef`` or ``pauth-qarma3`` enabled,
223-
the architected QARMA5 algorithm is used. The architected QARMA5
222+
``pauth-qarma5``
223+
When ``pauth`` is enabled, select the architected QARMA5 algorithm.
224+
225+
Without ``pauth-impdef``, ``pauth-qarma3`` or ``pauth-qarma5`` enabled,
226+
the QEMU impdef algorithm is used. The architected QARMA5
224227
and QARMA3 algorithms have good cryptographic properties, but can
225228
be quite slow to emulate. The impdef algorithm used by QEMU is
226229
non-cryptographic but significantly faster.

docs/system/arm/virt.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ of the 5.0 release and ``virt-5.0`` of the 5.1 release. Migration
1919
is not guaranteed to work between different QEMU releases for
2020
the non-versioned ``virt`` machine type.
2121

22+
VM migration is not guaranteed when using ``-cpu max``, as features
23+
supported may change between QEMU versions. To ensure your VM can be
24+
migrated, it is recommended to use another cpu model instead.
25+
2226
Supported devices
2327
"""""""""""""""""
2428

docs/system/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ would default to it anyway.
169169

170170
.. code::
171171
172-
-cpu max,pauth-impdef=on \
172+
-cpu max \
173173
-smp 4 \
174174
-accel tcg \
175175

hw/core/machine.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
#include "hw/virtio/virtio-iommu.h"
3737
#include "audio/audio.h"
3838

39-
GlobalProperty hw_compat_9_2[] = {};
39+
GlobalProperty hw_compat_9_2[] = {
40+
{"arm-cpu", "backcompat-pauth-default-use-qarma5", "true"},
41+
};
4042
const size_t hw_compat_9_2_len = G_N_ELEMENTS(hw_compat_9_2);
4143

4244
GlobalProperty hw_compat_9_1[] = {

hw/misc/arm_sysctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,
520520
* as zero.
521521
*/
522522
s->sys_cfgctrl = val & ~((3 << 18) | (1 << 31));
523-
if (val & (1 << 31)) {
523+
if (extract64(val, 31, 1)) {
524524
/* Start bit set -- actually do something */
525525
unsigned int dcc = extract32(s->sys_cfgctrl, 26, 4);
526526
unsigned int function = extract32(s->sys_cfgctrl, 20, 6);

hw/misc/npcm7xx_mft.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ static NPCM7xxMFTCaptureState npcm7xx_mft_compute_cnt(
172172
* RPM = revolution/min. The time for one revlution (in ns) is
173173
* MINUTE_TO_NANOSECOND / RPM.
174174
*/
175-
count = clock_ns_to_ticks(clock, (60 * NANOSECONDS_PER_SECOND) /
176-
(rpm * NPCM7XX_MFT_PULSE_PER_REVOLUTION));
175+
count = clock_ns_to_ticks(clock,
176+
(uint64_t)(60 * NANOSECONDS_PER_SECOND) /
177+
((uint64_t)rpm * NPCM7XX_MFT_PULSE_PER_REVOLUTION));
177178
}
178179

179180
if (count > NPCM7XX_MFT_MAX_CNT) {

target/arm/arm-qmp-cmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static const char *cpu_model_advertised_features[] = {
9494
"sve640", "sve768", "sve896", "sve1024", "sve1152", "sve1280",
9595
"sve1408", "sve1536", "sve1664", "sve1792", "sve1920", "sve2048",
9696
"kvm-no-adjvtime", "kvm-steal-time",
97-
"pauth", "pauth-impdef", "pauth-qarma3",
97+
"pauth", "pauth-impdef", "pauth-qarma3", "pauth-qarma5",
9898
NULL
9999
};
100100

target/arm/cpu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,6 +2653,8 @@ static const Property arm_cpu_properties[] = {
26532653
DEFINE_PROP_INT32("core-count", ARMCPU, core_count, -1),
26542654
/* True to default to the backward-compat old CNTFRQ rather than 1Ghz */
26552655
DEFINE_PROP_BOOL("backcompat-cntfrq", ARMCPU, backcompat_cntfrq, false),
2656+
DEFINE_PROP_BOOL("backcompat-pauth-default-use-qarma5", ARMCPU,
2657+
backcompat_pauth_default_use_qarma5, false),
26562658
};
26572659

26582660
static const gchar *arm_gdb_arch_name(CPUState *cs)

target/arm/cpu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,9 @@ struct ArchCPU {
972972
/* QOM property to indicate we should use the back-compat CNTFRQ default */
973973
bool backcompat_cntfrq;
974974

975+
/* QOM property to indicate we should use the back-compat QARMA5 default */
976+
bool backcompat_pauth_default_use_qarma5;
977+
975978
/* Specify the number of cores in this CPU cluster. Used for the L2CTLR
976979
* register.
977980
*/
@@ -1062,6 +1065,7 @@ struct ArchCPU {
10621065
bool prop_pauth;
10631066
bool prop_pauth_impdef;
10641067
bool prop_pauth_qarma3;
1068+
bool prop_pauth_qarma5;
10651069
bool prop_lpa2;
10661070

10671071
/* DCZ blocksize, in log_2(words), ie low 4 bits of DCZID_EL0 */

target/arm/cpu64.c

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -520,25 +520,40 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
520520
}
521521

522522
if (cpu->prop_pauth) {
523-
if (cpu->prop_pauth_impdef && cpu->prop_pauth_qarma3) {
523+
if ((cpu->prop_pauth_impdef && cpu->prop_pauth_qarma3) ||
524+
(cpu->prop_pauth_impdef && cpu->prop_pauth_qarma5) ||
525+
(cpu->prop_pauth_qarma3 && cpu->prop_pauth_qarma5)) {
524526
error_setg(errp,
525-
"cannot enable both pauth-impdef and pauth-qarma3");
527+
"cannot enable pauth-impdef, pauth-qarma3 and "
528+
"pauth-qarma5 at the same time");
526529
return;
527530
}
528531

529-
if (cpu->prop_pauth_impdef) {
530-
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, API, features);
531-
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, GPI, 1);
532+
bool use_default = !cpu->prop_pauth_qarma5 &&
533+
!cpu->prop_pauth_qarma3 &&
534+
!cpu->prop_pauth_impdef;
535+
536+
if (cpu->prop_pauth_qarma5 ||
537+
(use_default &&
538+
cpu->backcompat_pauth_default_use_qarma5)) {
539+
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, APA, features);
540+
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, GPA, 1);
532541
} else if (cpu->prop_pauth_qarma3) {
533542
isar2 = FIELD_DP64(isar2, ID_AA64ISAR2, APA3, features);
534543
isar2 = FIELD_DP64(isar2, ID_AA64ISAR2, GPA3, 1);
544+
} else if (cpu->prop_pauth_impdef ||
545+
(use_default &&
546+
!cpu->backcompat_pauth_default_use_qarma5)) {
547+
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, API, features);
548+
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, GPI, 1);
535549
} else {
536-
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, APA, features);
537-
isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, GPA, 1);
550+
g_assert_not_reached();
538551
}
539-
} else if (cpu->prop_pauth_impdef || cpu->prop_pauth_qarma3) {
540-
error_setg(errp, "cannot enable pauth-impdef or "
541-
"pauth-qarma3 without pauth");
552+
} else if (cpu->prop_pauth_impdef ||
553+
cpu->prop_pauth_qarma3 ||
554+
cpu->prop_pauth_qarma5) {
555+
error_setg(errp, "cannot enable pauth-impdef, pauth-qarma3 or "
556+
"pauth-qarma5 without pauth");
542557
error_append_hint(errp, "Add pauth=on to the CPU property list.\n");
543558
}
544559
}
@@ -553,6 +568,8 @@ static const Property arm_cpu_pauth_impdef_property =
553568
DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false);
554569
static const Property arm_cpu_pauth_qarma3_property =
555570
DEFINE_PROP_BOOL("pauth-qarma3", ARMCPU, prop_pauth_qarma3, false);
571+
static Property arm_cpu_pauth_qarma5_property =
572+
DEFINE_PROP_BOOL("pauth-qarma5", ARMCPU, prop_pauth_qarma5, false);
556573

557574
void aarch64_add_pauth_properties(Object *obj)
558575
{
@@ -573,6 +590,7 @@ void aarch64_add_pauth_properties(Object *obj)
573590
} else {
574591
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property);
575592
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_qarma3_property);
593+
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_qarma5_property);
576594
}
577595
}
578596

0 commit comments

Comments
 (0)