Skip to content

Commit

Permalink
default
Browse files Browse the repository at this point in the history
  • Loading branch information
pbo-linaro committed Dec 19, 2024
1 parent 526f8cc commit 79b1e3c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hw/core/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "audio/audio.h"

GlobalProperty hw_compat_10_0[] = {
{"arm-cpu", "pauth-default-use-qarma5", "true"},
{"arm-cpu", "backcompat-pauth-default-use-qarma5", "true"},
};
const size_t hw_compat_10_0_len = G_N_ELEMENTS(hw_compat_10_0);

Expand Down
2 changes: 2 additions & 0 deletions target/arm/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};

Expand Down
4 changes: 3 additions & 1 deletion target/arm/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -1060,7 +1063,6 @@ struct ArchCPU {
* Once finalized, the values should be read from ID_AA64*.
*/
bool prop_pauth;
bool prop_pauth_default_use_qarma5;
bool prop_pauth_impdef;
bool prop_pauth_qarma3;
bool prop_pauth_qarma5;
Expand Down
11 changes: 4 additions & 7 deletions target/arm/cpu64.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,16 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
!cpu->prop_pauth_impdef;

if (cpu->prop_pauth_qarma5 ||
(use_default && cpu->prop_pauth_default_use_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 if (cpu->prop_pauth_impdef ||
(use_default && !cpu->prop_pauth_default_use_qarma5)) {
(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 {
Expand All @@ -562,9 +564,6 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)

static const Property arm_cpu_pauth_property =
DEFINE_PROP_BOOL("pauth", ARMCPU, prop_pauth, true);
static const Property arm_cpu_pauth_default_use_qarma5_property =
DEFINE_PROP_BOOL("pauth-default-use-qarma5", ARMCPU,
prop_pauth_default_use_qarma5, true);
static const Property arm_cpu_pauth_impdef_property =
DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false);
static const Property arm_cpu_pauth_qarma3_property =
Expand All @@ -578,8 +577,6 @@ void aarch64_add_pauth_properties(Object *obj)

/* Default to PAUTH on, with the architected algorithm on TCG. */
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
qdev_property_add_static(DEVICE(obj),
&arm_cpu_pauth_default_use_qarma5_property);
if (kvm_enabled() || hvf_enabled()) {
/*
* Mirror PAuth support from the probed sysregs back into the
Expand Down

0 comments on commit 79b1e3c

Please sign in to comment.