mbox series

[v5,00/20] target/arm: Implement FEAT_RME

Message ID 20230620124418.805717-1-richard.henderson@linaro.org
Headers show
Series target/arm: Implement FEAT_RME | expand

Message

Richard Henderson June 20, 2023, 12:43 p.m. UTC
Changes for v5:
  * Enabled only by cpu property x-rme=on, not -cpu max.
  * Rebase vs SecEL2 fixes, now in master.

This doesn't have the magic RMM memory, which previous patch sets
included for booting Huawei's forked TF-A.  Upstream TF-A does not
have sufficient code to build either PLAT={qemu,qemu_sbsa} with
the RMM enabled, so that can't be tested either at the moment.

All I can say is that this doesn't appear to break anything else
with x-rme=on.  Which is less than satisfying.


r~


Richard Henderson (20):
  target/arm: Add isar_feature_aa64_rme
  target/arm: Update SCR and HCR for RME
  target/arm: SCR_EL3.NS may be RES1
  target/arm: Add RME cpregs
  target/arm: Introduce ARMSecuritySpace
  include/exec/memattrs: Add two bits of space to MemTxAttrs
  target/arm: Adjust the order of Phys and Stage2 ARMMMUIdx
  target/arm: Introduce ARMMMUIdx_Phys_{Realm,Root}
  target/arm: Remove __attribute__((nonnull)) from ptw.c
  target/arm: Pipe ARMSecuritySpace through ptw.c
  target/arm: NSTable is RES0 for the RME EL3 regime
  target/arm: Handle Block and Page bits for security space
  target/arm: Handle no-execute for Realm and Root regimes
  target/arm: Use get_phys_addr_with_struct in S1_ptw_translate
  target/arm: Move s1_is_el0 into S1Translate
  target/arm: Use get_phys_addr_with_struct for stage2
  target/arm: Add GPC syndrome
  target/arm: Implement GPC exceptions
  target/arm: Implement the granule protection check
  target/arm: Add cpu properties for enabling FEAT_RME

 include/exec/memattrs.h     |   9 +-
 target/arm/cpu.h            | 151 ++++++++--
 target/arm/internals.h      |  27 ++
 target/arm/syndrome.h       |  10 +
 target/arm/cpu.c            |   4 +
 target/arm/helper.c         | 162 +++++++++-
 target/arm/ptw.c            | 570 +++++++++++++++++++++++++++++-------
 target/arm/tcg/cpu64.c      |  53 ++++
 target/arm/tcg/tlb_helper.c |  96 +++++-
 9 files changed, 935 insertions(+), 147 deletions(-)

Comments

Peter Maydell June 20, 2023, 3:57 p.m. UTC | #1
On Tue, 20 Jun 2023 at 13:46, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Changes for v5:
>   * Enabled only by cpu property x-rme=on, not -cpu max.
>   * Rebase vs SecEL2 fixes, now in master.
>
> This doesn't have the magic RMM memory, which previous patch sets
> included for booting Huawei's forked TF-A.  Upstream TF-A does not
> have sufficient code to build either PLAT={qemu,qemu_sbsa} with
> the RMM enabled, so that can't be tested either at the moment.
>
> All I can say is that this doesn't appear to break anything else
> with x-rme=on.  Which is less than satisfying.

Have you tried 'make check-tcg' ? I get:

make: Leaving directory
'/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
make: Entering directory
'/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
  BUILD   arm-softmmu guest-tests
  RUN     arm-softmmu guest-tests
  TEST    test-armv6m-undef on arm
  BUILD   arm-linux-user guest-tests
  RUN     arm-linux-user guest-tests
  TEST    semihosting on arm
  SKIPPED semiconsole on arm because MANUAL ONLY
  TEST    convd on arm
  DIFF    float_convd.out with
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_convd.ref
  TEST    convs on arm
  DIFF    float_convs.out with
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_convs.ref
  TEST    madds on arm
  DIFF    float_madds.out with
/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_madds.ref
  TEST    munmap-pthread on arm
**
ERROR:../../plugins/core.c:221:qemu_plugin_vcpu_init_hook: assertion
failed: (success)
make[1]: *** [Makefile:174: run-munmap-pthread] Error 124
make: *** [/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/Makefile.include:56:
run-tcg-tests-arm-linux-user] Error 2
make: Leaving directory
'/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'

But I haven't run 'check-tcg' recently, so maybe that's an
existing bug rather than something in this series.

-- PMM
Richard Henderson June 20, 2023, 4:28 p.m. UTC | #2
On 6/20/23 17:57, Peter Maydell wrote:
> On Tue, 20 Jun 2023 at 13:46, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Changes for v5:
>>    * Enabled only by cpu property x-rme=on, not -cpu max.
>>    * Rebase vs SecEL2 fixes, now in master.
>>
>> This doesn't have the magic RMM memory, which previous patch sets
>> included for booting Huawei's forked TF-A.  Upstream TF-A does not
>> have sufficient code to build either PLAT={qemu,qemu_sbsa} with
>> the RMM enabled, so that can't be tested either at the moment.
>>
>> All I can say is that this doesn't appear to break anything else
>> with x-rme=on.  Which is less than satisfying.
> 
> Have you tried 'make check-tcg' ? I get:
> 
> make: Leaving directory
> '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
> make: Entering directory
> '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
>    BUILD   arm-softmmu guest-tests
>    RUN     arm-softmmu guest-tests
>    TEST    test-armv6m-undef on arm
>    BUILD   arm-linux-user guest-tests
>    RUN     arm-linux-user guest-tests
>    TEST    semihosting on arm
>    SKIPPED semiconsole on arm because MANUAL ONLY
>    TEST    convd on arm
>    DIFF    float_convd.out with
> /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_convd.ref
>    TEST    convs on arm
>    DIFF    float_convs.out with
> /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_convs.ref
>    TEST    madds on arm
>    DIFF    float_madds.out with
> /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_madds.ref
>    TEST    munmap-pthread on arm
> **
> ERROR:../../plugins/core.c:221:qemu_plugin_vcpu_init_hook: assertion
> failed: (success)
> make[1]: *** [Makefile:174: run-munmap-pthread] Error 124
> make: *** [/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/Makefile.include:56:
> run-tcg-tests-arm-linux-user] Error 2
> make: Leaving directory
> '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
> 
> But I haven't run 'check-tcg' recently, so maybe that's an
> existing bug rather than something in this series.

Not today -- I only tried system mode because, obviously.  :-)
Let me double-check...

r~
Peter Maydell June 20, 2023, 4:41 p.m. UTC | #3
On Tue, 20 Jun 2023 at 17:28, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 6/20/23 17:57, Peter Maydell wrote:
> > On Tue, 20 Jun 2023 at 13:46, Richard Henderson
> > <richard.henderson@linaro.org> wrote:
> >>
> >> Changes for v5:
> >>    * Enabled only by cpu property x-rme=on, not -cpu max.
> >>    * Rebase vs SecEL2 fixes, now in master.
> >>
> >> This doesn't have the magic RMM memory, which previous patch sets
> >> included for booting Huawei's forked TF-A.  Upstream TF-A does not
> >> have sufficient code to build either PLAT={qemu,qemu_sbsa} with
> >> the RMM enabled, so that can't be tested either at the moment.
> >>
> >> All I can say is that this doesn't appear to break anything else
> >> with x-rme=on.  Which is less than satisfying.
> >
> > Have you tried 'make check-tcg' ? I get:
> >
> > make: Leaving directory
> > '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
> > make: Entering directory
> > '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
> >    BUILD   arm-softmmu guest-tests
> >    RUN     arm-softmmu guest-tests
> >    TEST    test-armv6m-undef on arm
> >    BUILD   arm-linux-user guest-tests
> >    RUN     arm-linux-user guest-tests
> >    TEST    semihosting on arm
> >    SKIPPED semiconsole on arm because MANUAL ONLY
> >    TEST    convd on arm
> >    DIFF    float_convd.out with
> > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_convd.ref
> >    TEST    convs on arm
> >    DIFF    float_convs.out with
> > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_convs.ref
> >    TEST    madds on arm
> >    DIFF    float_madds.out with
> > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/arm/float_madds.ref
> >    TEST    munmap-pthread on arm
> > **
> > ERROR:../../plugins/core.c:221:qemu_plugin_vcpu_init_hook: assertion
> > failed: (success)
> > make[1]: *** [Makefile:174: run-munmap-pthread] Error 124
> > make: *** [/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/Makefile.include:56:
> > run-tcg-tests-arm-linux-user] Error 2
> > make: Leaving directory
> > '/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang'
> >
> > But I haven't run 'check-tcg' recently, so maybe that's an
> > existing bug rather than something in this series.
>
> Not today -- I only tried system mode because, obviously.  :-)
> Let me double-check...

I get the same error on current head-of-git, so whatever it
is it's not this patchset's fault.

thanks
-- PMM
Peter Maydell June 22, 2023, 12:45 p.m. UTC | #4
On Tue, 20 Jun 2023 at 13:46, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Changes for v5:
>   * Enabled only by cpu property x-rme=on, not -cpu max.
>   * Rebase vs SecEL2 fixes, now in master.
>
> This doesn't have the magic RMM memory, which previous patch sets
> included for booting Huawei's forked TF-A.  Upstream TF-A does not
> have sufficient code to build either PLAT={qemu,qemu_sbsa} with
> the RMM enabled, so that can't be tested either at the moment.
>
> All I can say is that this doesn't appear to break anything else
> with x-rme=on.  Which is less than satisfying.

I'm going to apply this to target-arm.next, since it's all
reviewed. I've added this to the patch 20 commit message:

# We're not currently completely sure whether FEAT_RME will
# be OK to enable purely as a CPU-level property, or if it will
# need board co-operation, so we're making these experimental
# x- properties, so that the people developing the system
# level software for RME can try to start using this and let
# us know how it goes. The command line syntax for enabling
# this will change in future, without backwards-compatibility.

If you can send an extra patch that does the documentation
changes that would be great; I figured we didn't need to
hold this up or apply only 1-19 and not 20 just for the
docs update.

thanks
-- PMM