From: Jim MacArthur <jim.macarthur@linaro.org>
To: qemu-devel@nongnu.org
Cc: richard.henderson@linaro.org
Subject: Re: [PATCH 2/4] target/arm: Allow writes to FNG1, FNG0, A2
Date: Tue, 9 Dec 2025 15:04:39 +0000 [thread overview]
Message-ID: <64beb7f0-5406-433a-9cca-f94c5f4164ff@linaro.org> (raw)
In-Reply-To: <59cb24e2-699e-4511-84e5-ad5d3ee90b58@linaro.org>
On 12/5/25 15:30, Richard Henderson wrote:
> On 12/4/25 12:04, Jim MacArthur wrote:
>> @@ -6121,8 +6131,16 @@ static void tcr2_el2_write(CPUARMState *env,
>> const ARMCPRegInfo *ri,
>> if (cpu_isar_feature(aa64_mec, cpu)) {
>> valid_mask |= TCR2_AMEC0 | TCR2_AMEC1;
>> }
>> + if (cpu_isar_feature(aa64_asid2, cpu)) {
>> + valid_mask |= TCR2_FNG1 | TCR2_FNG0 | TCR2_A2;
>> + require_flush = true;
>> + }
>> value &= valid_mask;
>> raw_write(env, ri, value);
>> +
>> + if (require_flush) {
>> + tlb_flush(CPU(cpu));
>> + }
>
> Just because A2 is valid doesn't mean the A2 bit changed.
>
> Compare, for instance, vmsa_ttbr_write, where we notice if the ASID
> has changed before performing the flush.
>
> Note as well that we don't need to flush all tlbs. In tcr2_el1_write
> we know that we are only affecting the EL1&0 regime (alle1_tlbmask).
> In tcr2_el2_write, we know that we are only affecting the EL2&0 regime
> (see the E2H part of vae2_tlbmask).
>
>
> r~
>
Before I make a full patch series, can I check this looks correct?
In tcr2_el1_write:
if (cpu_isar_feature(aa64_asid2, cpu)) {
uint64_t asid_nonglobal_flags = TCR2_FNG1 | TCR2_FNG0 | TCR2_A2;
valid_mask |= asid_nonglobal_flags;
require_flush = ((raw_read(env, ri) ^ value) &
asid_nonglobal_flags) != 0;
}
value &= valid_mask;
raw_write(env, ri, value);
if (require_flush) {
tlb_flush_by_mmuidx(CPU(cpu), alle1_tlbmask(env));
}
And then in tcr_el2_write, the same check but flushing by:
ARMMMUIdxBit_E20_2 |ARMMMUIdxBit_E20_2_PAN | ARMMMUIdxBit_E20_2_GCS |
ARMMMUIdxBit_E20_0 | ARMMMUIdxBit_E20_0_GCS, as used in
vmsa_tcr_ttbr_el2_write. This could be factored out into a constant
function like alle1_tlbmask.
Jim
next prev parent reply other threads:[~2025-12-09 15:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 18:04 [PATCH V5 0/4] Basic ASID2 support Jim MacArthur
2025-12-04 18:04 ` [PATCH 1/4] target/arm: Enable ID_AA64MMFR4_EL1 register Jim MacArthur
2025-12-04 18:04 ` [PATCH 2/4] target/arm: Allow writes to FNG1, FNG0, A2 Jim MacArthur
2025-12-05 15:30 ` Richard Henderson
2025-12-09 15:04 ` Jim MacArthur [this message]
2025-12-09 15:39 ` Richard Henderson
2025-12-04 18:04 ` [PATCH 3/4] target/arm/tcg/cpu64.c: Enable ASID2 for cpu_max Jim MacArthur
2025-12-04 18:04 ` [PATCH 4/4] tests: Add test for ASID2 and write/read of feature bits Jim MacArthur
2025-12-04 18:30 ` [PATCH V5 0/4] Basic ASID2 support Alex Bennée
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=64beb7f0-5406-433a-9cca-f94c5f4164ff@linaro.org \
--to=jim.macarthur@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).