qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Jim MacArthur <jim.macarthur@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] tests: Add test for ASID2 and write/read of feature bits
Date: Wed, 26 Nov 2025 10:31:48 +0000	[thread overview]
Message-ID: <87y0nt5bl7.fsf@draig.linaro.org> (raw)
In-Reply-To: <CAJfKr9W7DuFGkARhSYfT=aumHcZvFbp3pzV0VLxnqaDUn2JQAg@mail.gmail.com> (Jim MacArthur's message of "Tue, 25 Nov 2025 21:29:58 +0000")

Jim MacArthur <jim.macarthur@linaro.org> writes:

> On Mon, 24 Nov 2025 at 15:01, Alex Bennée <alex.bennee@linaro.org> wrote:
>> If we instead use this to test for the presence of the feature and then...
>>
>> > +
>> > +    asm("msr " TCR2_EL1 ", %[x0]\n\t"
>> > +        "mrs %[x1], " TCR2_EL1 "\n\t"
>> > +        : [x1] "=r" (out)
>> > +        : [x0] "r" (in));
>> > +
>> > +    if ((out & feature_mask) == in) {
>> > +        ml_printf("OK\n");
>> > +        return 0;
>> > +    } else {
>> > +        ml_printf("FAIL: read value %lx != written value %lx\n",
>> > +                  out & feature_mask, in);
>> > +        return 1;
>> > +    }
>>
>> extend this part to check the bits are behaving as the feature dictates
>> then we can add a second test like this (Makefile.softmmu-target):
>>
>>   run-asid2-oldcpu: asid2
>>           $(call run-test, $<, \
>>             $(QEMU) -monitor none -display none \
>>                     -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
>>                     $(QEMU_OPTS) $<)
>>
>>   run-asid2-oldcpu: QEMU_OPTS=-M virt -cpu cortex-a72 -display none $(QEMU_BASE_ARGS) -kernel
>>
>>   EXTRA_RUNS += run-asid2-oldcpu
>>
>> Although its a bit clunky - one day I'll get around to converting this
>> lot to meson.
>
> Good idea, but as far as I can see cortex-a72 doesn't implement
> FEAT_TCR2, and nor does anything other than cpu-max, so the write and
> read to TCR2_EL1 will be undefined behaviour (and causes an error in
> the test). I could (and probably should) add a test for FEAT_TCR2 as
> well, but it won't test anything more than my original test covers.

Ahh I see - until we have a new CPU type that has FEAT_TCR2 without
ASID2 there isn't much point jumping the hoops to test the edge case. I
think the most modern non-max CPU we have at the moment is the
neoverse-n2. We have TRMs for the -n3 and -v3's now so we could check
those to see if we have enough of the features to add them to the list
and if they meet the criteria of FEAT_TCR2 without FEAT_ASID2.

In the meantime no need to hold this up:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


>
> Jim

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2025-11-26 10:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 12:54 [PATCH v2 0/3] Basic ASID2 Support Jim MacArthur
2025-11-20 12:54 ` [PATCH 1/3] target/arm: Enable ID_AA64MMFR4_EL1 register Jim MacArthur
2025-11-24 13:50   ` Alex Bennée
2025-11-24 19:46   ` Richard Henderson
2025-11-20 12:54 ` [PATCH 2/3] target/arm: Enable ASID2 for cpu_max, allow writes to FNG1, FNG0, A2 Jim MacArthur
2025-11-24 13:52   ` Alex Bennée
2025-11-24 19:46   ` Richard Henderson
2025-11-20 12:54 ` [PATCH 3/3] tests: Add test for ASID2 and write/read of feature bits Jim MacArthur
2025-11-24 15:01   ` Alex Bennée
2025-11-25 21:29     ` Jim MacArthur
2025-11-26 10:31       ` Alex Bennée [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-11-12  9:17 [PATCH 0/3] Basic ASID2 support Jim MacArthur
2025-11-12  9:17 ` [PATCH 3/3] tests: Add test for ASID2 and write/read of feature bits Jim MacArthur
2025-11-15 12:21   ` 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=87y0nt5bl7.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=jim.macarthur@linaro.org \
    --cc=qemu-devel@nongnu.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).