[PATCHv3 00/17] ARMv8.4 Secure EL2

Rémi Denis-Courmont posted 17 patches 3 years, 4 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/3333301.iIbC2pHGDl@basile.remlab.net
target/arm/cpu-param.h     |   2 +-
target/arm/cpu.c           |  10 +-
target/arm/cpu.h           |  93 ++++++++--
target/arm/cpu64.c         |   1 +
target/arm/helper-a64.c    |   8 +-
target/arm/helper.c        | 423 ++++++++++++++++++++++++++++++---------------
target/arm/internals.h     |  56 +++++-
target/arm/op_helper.c     |   4 +-
target/arm/tlb_helper.c    |   3 +
target/arm/translate-a64.c |   4 +
target/arm/translate.c     |   6 +-
target/arm/translate.h     |   1 +
12 files changed, 431 insertions(+), 180 deletions(-)
[PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Rémi Denis-Courmont 3 years, 4 months ago
The following changes since commit 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:

  Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122' into staging (2020-11-22 15:02:52 +0000)

follow.

Changes since version 2:
- Don't set HPFAR.NS in AT instruction in NS state.

----------------------------------------------------------------
Rémi Denis-Courmont (17):
      target/arm: remove redundant tests
      target/arm: add arm_is_el2_enabled() helper
      target/arm: use arm_is_el2_enabled() where applicable
      target/arm: use arm_hcr_el2_eff() where applicable
      target/arm: factor MDCR_EL2 common handling
      target/arm: declare new AA64PFR0 bit-fields
      target/arm: add 64-bit S-EL2 to EL exception table
      target/arm: return the stage 2 index for stage 1
      target/arm: add MMU stage 1 for Secure EL2
      target/arm: add ARMv8.4-SEL2 system registers
      target/arm: do S1_ptw_translate() before address space lookup
      target/arm: secure stage 2 translation regime
      target/arm: handle VMID change in secure state
      target/arm: set HPFAR_EL2.NS on secure stage 2 faults
      target/arm: add ARMv8.4-SEL2 extension
      target/arm: enable Secure EL2 in max CPU
      target/arm: refactor vae1_tlbmask()

 target/arm/cpu-param.h     |   2 +-
 target/arm/cpu.c           |  10 +-
 target/arm/cpu.h           |  93 ++++++++--
 target/arm/cpu64.c         |   1 +
 target/arm/helper-a64.c    |   8 +-
 target/arm/helper.c        | 423 ++++++++++++++++++++++++++++++---------------
 target/arm/internals.h     |  56 +++++-
 target/arm/op_helper.c     |   4 +-
 target/arm/tlb_helper.c    |   3 +
 target/arm/translate-a64.c |   4 +
 target/arm/translate.c     |   6 +-
 target/arm/translate.h     |   1 +
 12 files changed, 431 insertions(+), 180 deletions(-)

-- 
雷米‧德尼-库尔蒙




Re: [PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Peter Maydell 3 years, 4 months ago
On Mon, 23 Nov 2020 at 08:02, Rémi Denis-Courmont
<remi.denis.courmont@huawei.com> wrote:
>
> The following changes since commit 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
>
>   Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122' into staging (2020-11-22 15:02:52 +0000)
>
> follow.
>
> Changes since version 2:
> - Don't set HPFAR.NS in AT instruction in NS state.
>

This series seems to break the 'make check-acceptance' tests. Specifically
the vexpress-a9 image fails to boot:
 (20/40) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_vexpressa9:
INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred:
Timeout reached\nOriginal status: ERROR\n{'name':
'20-tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_vexpressa9',
'logdir': '/home/petmay01/linaro/qemu-from-laptop/qemu/build/arm-clang/tes...
(90.23 s)

The log shows the guest kernel booting partway and then hanging.

thanks
-- PMM

Re: [PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Rémi Denis-Courmont 3 years, 4 months ago
Le tiistaina 1. joulukuuta 2020, 18.54.36 EET Peter Maydell a écrit :
> On Mon, 23 Nov 2020 at 08:02, Rémi Denis-Courmont
> 
> <remi.denis.courmont@huawei.com> wrote:
> > The following changes since commit 
8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
> >   Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122'
> >   into staging (2020-11-22 15:02:52 +0000)> 
> > follow.
> > 
> > Changes since version 2:
> > - Don't set HPFAR.NS in AT instruction in NS state.
> 
> This series seems to break the 'make check-acceptance' tests. Specifically
> the vexpress-a9 image fails to boot:
>  (20/40)
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_vexpressa9
> : INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred:
> Timeout reached\nOriginal status: ERROR\n{'name':
> '20-tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_vexpres
> sa9', 'logdir':
> '/home/petmay01/linaro/qemu-from-laptop/qemu/build/arm-clang/tes... (90.23
> s)

The base tests fail without the patchset seem to assume an US American locale, 
which is frankly infuriatingly culturally insensitive.

As for the acceptance tests fail equally early without the patchset with a 
completely helpless diagnostic about unresolved references. Wiki does not help 
either.

So there you go: cannot reproduce.

-- 
Rémi Denis-Courmont



Re: [PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Peter Maydell 3 years, 4 months ago
On Tue, 1 Dec 2020 at 17:42, Rémi Denis-Courmont
<remi.denis.courmont@huawei.com> wrote:
>
> Le tiistaina 1. joulukuuta 2020, 18.54.36 EET Peter Maydell a écrit :
> > On Mon, 23 Nov 2020 at 08:02, Rémi Denis-Courmont
> >
> > <remi.denis.courmont@huawei.com> wrote:
> > > The following changes since commit
> 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
> > >   Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122'
> > >   into staging (2020-11-22 15:02:52 +0000)>
> > > follow.
> > >
> > > Changes since version 2:
> > > - Don't set HPFAR.NS in AT instruction in NS state.
> >
> > This series seems to break the 'make check-acceptance' tests. Specifically
> > the vexpress-a9 image fails to boot:
> >  (20/40)
> > tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_vexpressa9
> > : INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred:
> > Timeout reached\nOriginal status: ERROR\n{'name':
> > '20-tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_vexpres
> > sa9', 'logdir':
> > '/home/petmay01/linaro/qemu-from-laptop/qemu/build/arm-clang/tes... (90.23
> > s)
>
> The base tests fail without the patchset seem to assume an US American locale,
> which is frankly infuriatingly culturally insensitive.

I run them with en_GB.UTF-8, which works fine for me, but it's a bug
in the test suite if something's locale dependent and not ensuring
it is set correctly.

> As for the acceptance tests fail equally early without the patchset with a
> completely helpless diagnostic about unresolved references. Wiki does not help
> either.

I just run "make -C my-build-dir check-acceptance"; I don't know anything
about the internals. It would help if you quoted the error messages
you see.

FWIW, I also see a hang on a manual run of a different vexpress-a9
kernel, so the bug is not specific to the check-acceptance tests.

thanks
-- PMM

Re: [PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Rémi Denis-Courmont 3 years, 4 months ago
	Hi,

Le tiistaina 1. joulukuuta 2020, 20.23.46 EET Peter Maydell a écrit :
> > The base tests fail without the patchset seem to assume an US American
> > locale, which is frankly infuriatingly culturally insensitive.
> 
> I run them with en_GB.UTF-8, which works fine for me, but it's a bug
> in the test suite if something's locale dependent and not ensuring
> it is set correctly.

For a start, it seems to be barfing on strsignal() localisation by the shell, 
printing French instead of "Killed" on SIGKILL.

% locale
LANG=fr_FR.UTF-8
LANGUAGE=fr:en_GB:fi
LC_CTYPE="fi_FI.UTF-8"
...

> > As for the acceptance tests fail equally early without the patchset with a
> > completely helpless diagnostic about unresolved references. Wiki does not
> > help either.
> 
> I just run "make -C my-build-dir check-acceptance"; I don't know anything
> about the internals. It would help if you quoted the error messages
> you see.

 AVOCADO tests/acceptance
Unable to resolve reference(s) 'tests/acceptance' with plugins(s) 'file', 
'tap', 'external', try running 'avocado list -V tests/acceptance' to see the 
details.
make: *** [/home/remi/dev/qemu/tests/Makefile.include:125 : check-acceptance] 
Erreur 2

% avocado list -V tests/acceptance
bash: avocado : commande introuvable

% tests/venv/bin/avocado list -V tests/acceptance
usage: avocado list [-h] [--loaders [LIST.LOADERS ...]]

Wiki implies that dependencies are automatically installed, but I guess not?

Br,

-- 
Rémi Denis-Courmont



Re: [PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Alex Bennée 3 years, 4 months ago
Rémi Denis-Courmont <remi.denis.courmont@huawei.com> writes:

> 	Hi,
>
> Le tiistaina 1. joulukuuta 2020, 20.23.46 EET Peter Maydell a écrit :
>> > The base tests fail without the patchset seem to assume an US American
>> > locale, which is frankly infuriatingly culturally insensitive.
>> 
>> I run them with en_GB.UTF-8, which works fine for me, but it's a bug
>> in the test suite if something's locale dependent and not ensuring
>> it is set correctly.
>
> For a start, it seems to be barfing on strsignal() localisation by the shell, 
> printing French instead of "Killed" on SIGKILL.
>
> % locale
> LANG=fr_FR.UTF-8
> LANGUAGE=fr:en_GB:fi
> LC_CTYPE="fi_FI.UTF-8"
> ...
>
>> > As for the acceptance tests fail equally early without the patchset with a
>> > completely helpless diagnostic about unresolved references. Wiki does not
>> > help either.
>> 
>> I just run "make -C my-build-dir check-acceptance"; I don't know anything
>> about the internals. It would help if you quoted the error messages
>> you see.
>
>  AVOCADO tests/acceptance
> Unable to resolve reference(s) 'tests/acceptance' with plugins(s) 'file', 
> 'tap', 'external', try running 'avocado list -V tests/acceptance' to see the 
> details.
> make: *** [/home/remi/dev/qemu/tests/Makefile.include:125 : check-acceptance] 
> Erreur 2
>
> % avocado list -V tests/acceptance
> bash: avocado : commande introuvable
>
> % tests/venv/bin/avocado list -V tests/acceptance
> usage: avocado list [-h] [--loaders [LIST.LOADERS ...]]
>
> Wiki implies that dependencies are automatically installed, but I
> guess not?

They should be in the venv that is built when you run the test the first
time. Running the above command without the -V which it doesn't
recognise gives me a list:

  14:12:25 [alex@zen:~/l/q/b/all] xen/guest-loader-and-arm-build-cleanups-v2|✚3…(+5/-5) + ./tests/venv/bin/avocado list tests/acceptance/ | head -n 10
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_i440fx_tcg
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_i440fx_kvm
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_q35_tcg
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_q35_kvm
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxAarch64.test_virt_tcg
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxAarch64.test_virt_kvm_gicv2
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxAarch64.test_virt_kvm_gicv3
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxPPC64.test_pseries_tcg
  INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxS390X.test_s390_ccw_virtio_tcg
  INSTRUMENTED tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc
  Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
  BrokenPipeError: [Errno 32] Broken pipe

I wonder are you running an in-tree build?

>
> Br,


-- 
Alex Bennée

Re: [PATCHv3 00/17] ARMv8.4 Secure EL2
Posted by Rémi Denis-Courmont 3 years, 4 months ago
Le tiistaina 8. joulukuuta 2020, 16.11.15 EET Alex Bennée a écrit :
> > Wiki implies that dependencies are automatically installed, but I
> > guess not?
> 
> They should be in the venv that is built when you run the test the first
> time. Running the above command without the -V which it doesn't
> recognise gives me a list:
> 
>   14:12:25 [alex@zen:~/l/q/b/all]
> xen/guest-loader-and-arm-build-cleanups-v2|✚3…(+5/-5) +
> ./tests/venv/bin/avocado list tests/acceptance/ | head -n 10 INSTRUMENTED
> tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_i440fx_tcg
> INSTRUMENTED
> tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_i440fx_kvm
> INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_q35_tcg
> INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxX8664.test_pc_q35_kvm
> INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxAarch64.test_virt_tcg
> INSTRUMENTED
> tests/acceptance/boot_linux.py:BootLinuxAarch64.test_virt_kvm_gicv2
> INSTRUMENTED
> tests/acceptance/boot_linux.py:BootLinuxAarch64.test_virt_kvm_gicv3
> INSTRUMENTED tests/acceptance/boot_linux.py:BootLinuxPPC64.test_pseries_tcg
> INSTRUMENTED
> tests/acceptance/boot_linux.py:BootLinuxS390X.test_s390_ccw_virtio_tcg
> INSTRUMENTED
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc
> Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w'
> encoding='UTF-8'> BrokenPipeError: [Errno 32] Broken pipe
> 
> I wonder are you running an in-tree build?

Yes. I suppose somebody fixed something because I can run the test cases now 
and pinpoint the failing change, though I've yet to debug it succesfully.

-- 
Rémi Denis-Courmont