From: Richard Henderson <richard.henderson@linaro.org>
To: "Aaron Lindsay" <aaron@os.amperecomputing.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Vincent Dehors" <vincent.dehors@smile.fr>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [PATCH v2 1/7] target/arm: v8.3 PAC ID_AA64ISAR[12] feature-detection
Date: Wed, 22 Feb 2023 10:27:11 -1000 [thread overview]
Message-ID: <82e90bc7-8883-62f2-a6a1-9b90e032c667@linaro.org> (raw)
In-Reply-To: <20230222193544.3392713-2-aaron@os.amperecomputing.com>
On 2/22/23 09:35, Aaron Lindsay wrote:
> +static inline bool isar_feature_aa64_pauth_arch_qarma3(const ARMISARegisters *id)
> +{
> + /*
> + * Return true if pauth is enabled with the architected QARMA3 algorithm.
> + * QEMU will always set APA3+GPA3 to the same value.
> + */
This language isn't quite right, since GPA3 only defines values 0 and 1.
Perhaps "to the same result"?
> +static inline uint8_t isar_feature_pauth_get_features(const ARMISARegisters *id)
'int' is a better generic result, as 'uint8_t' is 'unsigned char' to the debugger and
generally printed as such.
> + if (isar_feature_aa64_pauth_arch_qarma5(id))
> + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, APA);
> + else if (isar_feature_aa64_pauth_arch_qarma3(id))
> + return FIELD_EX64(id->id_aa64isar2, ID_AA64ISAR2, APA3);
> + else
> + return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, API);
Braces with if+else, always.
That said, exactly one of these fields is allowed to be non-zero, so we can just
unconditionally OR them all together.
> +static inline bool isar_feature_aa64_pauth_epac(const ARMISARegisters *id)
> +{
> + /*
> + * Note that unlike most AArch64 features, EPAC is treated (in the ARM
> + * psedocode, at least) as not being implemented by larger values of this
> + * field. Our usage of '>=' rather than '==' here causes our implementation
> + * of PAC logic to diverge slightly from ARM pseudocode.
> + */
I find this comment scary -- "diverge slightly"?
All I need is once sentence to indicate how this is mitigated (by testing pauth2 first
where required?), or "See function_foo" (where there is more commentary), or something.
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 72b37b7cf1..448ebf8301 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -8028,11 +8028,11 @@ void register_cp_regs_for_features(ARMCPU *cpu)
> .access = PL1_R, .type = ARM_CP_CONST,
> .accessfn = access_aa64_tid3,
> .resetvalue = cpu->isar.id_aa64isar1 },
> - { .name = "ID_AA64ISAR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64,
> + { .name = "ID_AA64ISAR2_EL1", .state = ARM_CP_STATE_AA64,
> .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 2,
> .access = PL1_R, .type = ARM_CP_CONST,
> .accessfn = access_aa64_tid3,
> - .resetvalue = 0 },
> + .resetvalue = cpu->isar.id_aa64isar2 },
All the code adding aa64isar2 should be a separate patch.
You've missed initializing it in kvm_arm_get_host_cpu_features and
hvf_arm_get_host_cpu_features.
r~
next prev parent reply other threads:[~2023-02-22 20:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 19:35 [PATCH v2 0/7] Implement Most ARMv8.3 Pointer Authentication Features Aaron Lindsay
2023-02-22 19:35 ` [PATCH v2 1/7] target/arm: v8.3 PAC ID_AA64ISAR[12] feature-detection Aaron Lindsay
2023-02-22 20:27 ` Richard Henderson [this message]
2023-02-23 14:02 ` Peter Maydell
2023-02-22 19:35 ` [PATCH v2 2/7] target/arm: Implement v8.3 QARMA3 PAC cipher Aaron Lindsay
2023-02-22 20:35 ` Richard Henderson
2023-02-22 19:35 ` [PATCH v2 3/7] target/arm: Implement v8.3 EnhancedPAC Aaron Lindsay
2023-02-22 20:39 ` Richard Henderson
2023-02-22 20:41 ` Richard Henderson
2023-02-22 19:35 ` [PATCH v2 4/7] target/arm: Implement v8.3 Pauth2 Aaron Lindsay
2023-02-22 20:50 ` Richard Henderson
2023-02-22 19:35 ` [PATCH v2 5/7] targer/arm: Inform helpers whether a PAC instruction is 'combined' Aaron Lindsay
2023-02-22 20:56 ` Richard Henderson
2023-02-22 19:35 ` [PATCH v2 6/7] target/arm: Implement v8.3 FPAC and FPACCOMBINE Aaron Lindsay
2023-02-22 21:37 ` Richard Henderson
2023-03-22 20:33 ` Aaron Lindsay
2023-03-22 22:39 ` Richard Henderson
2023-02-22 19:35 ` [PATCH v2 7/7] target/arm: Add CPU properties for most v8.3 PAC features Aaron Lindsay
2023-02-22 22:14 ` Richard Henderson
2023-02-24 11:23 ` Peter Maydell
2023-03-22 20:36 ` Aaron Lindsay
2023-03-22 23:01 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82e90bc7-8883-62f2-a6a1-9b90e032c667@linaro.org \
--to=richard.henderson@linaro.org \
--cc=aaron@os.amperecomputing.com \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vincent.dehors@smile.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).