diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 333eaf67ea336..a11a88df27a3b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3356,6 +3356,7 @@ type_init(machvirt_machine_init); static void virt_machine_10_0_options(MachineClass *mc) { + compat_props_add(mc->compat_props, hw_compat_10_0, hw_compat_10_0_len); } DEFINE_VIRT_MACHINE_AS_LATEST(10, 0) diff --git a/hw/core/machine.c b/hw/core/machine.c index d970f753e3702..f50e44f9e45f4 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -36,6 +36,11 @@ #include "hw/virtio/virtio-iommu.h" #include "audio/audio.h" +GlobalProperty hw_compat_10_0[] = { + {"arm-cpu", "backcompat-pauth-default-use-qarma5", "true"}, +}; +const size_t hw_compat_10_0_len = G_N_ELEMENTS(hw_compat_10_0); + GlobalProperty hw_compat_9_2[] = {}; const size_t hw_compat_9_2_len = G_N_ELEMENTS(hw_compat_9_2); diff --git a/include/hw/boards.h b/include/hw/boards.h index 5723ee76bdea6..91ec6f94adbdc 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -757,6 +757,9 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) +extern GlobalProperty hw_compat_10_0[]; +extern const size_t hw_compat_10_0_len; + extern GlobalProperty hw_compat_9_2[]; extern const size_t hw_compat_9_2_len; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 1afa07511e38e..68f1ab639b88d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2652,6 +2652,8 @@ static const Property arm_cpu_properties[] = { DEFINE_PROP_INT32("core-count", ARMCPU, core_count, -1), /* True to default to the backward-compat old CNTFRQ rather than 1Ghz */ DEFINE_PROP_BOOL("backcompat-cntfrq", ARMCPU, backcompat_cntfrq, false), + DEFINE_PROP_BOOL("backcompat-pauth-default-use-qarma5", ARMCPU, + backcompat_pauth_default_use_qarma5, false), DEFINE_PROP_END_OF_LIST() }; diff --git a/target/arm/cpu.h b/target/arm/cpu.h index b7500bebd7f11..276a7a557bace 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -972,6 +972,9 @@ struct ArchCPU { /* QOM property to indicate we should use the back-compat CNTFRQ default */ bool backcompat_cntfrq; + /* QOM property to indicate we should use the back-compat QARMA5 default */ + bool backcompat_pauth_default_use_qarma5; + /* Specify the number of cores in this CPU cluster. Used for the L2CTLR * register. */ diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 4eff05a622eef..045b94fcb4d73 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -529,15 +529,25 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) return; } - if (cpu->prop_pauth_qarma5) { + bool use_default = !cpu->prop_pauth_qarma5 && + !cpu->prop_pauth_qarma3 && + !cpu->prop_pauth_impdef; + + if (cpu->prop_pauth_qarma5 || + (use_default && + cpu->backcompat_pauth_default_use_qarma5)) { isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, APA, features); isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, GPA, 1); } else if (cpu->prop_pauth_qarma3) { isar2 = FIELD_DP64(isar2, ID_AA64ISAR2, APA3, features); isar2 = FIELD_DP64(isar2, ID_AA64ISAR2, GPA3, 1); - } else { /* default is pauth-impdef */ + } else if (cpu->prop_pauth_impdef || + (use_default && + !cpu->backcompat_pauth_default_use_qarma5)) { isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, API, features); isar1 = FIELD_DP64(isar1, ID_AA64ISAR1, GPI, 1); + } else { + g_assert_not_reached(); } } else if (cpu->prop_pauth_impdef || cpu->prop_pauth_qarma3 ||