All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Fancellu <luca.fancellu@arm.com>
To: xen-devel@lists.xenproject.org
Cc: bertrand.marquis@arm.com, wei.chen@arm.com,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>, "Wei Liu" <wl@xen.org>,
	"Nick Rosbrook" <rosbrookn@gmail.com>,
	"Anthony PERARD" <anthony.perard@citrix.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Christian Lindig" <christian.lindig@citrix.com>,
	"David Scott" <dave@recoil.org>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: [PATCH v3 00/10] SVE feature for arm guests
Date: Fri, 17 Mar 2023 13:19:39 +0000	[thread overview]
Message-ID: <20230317131949.4031014-1-luca.fancellu@arm.com> (raw)

This serie is introducing the possibility for Dom0 and DomU guests to use
sve/sve2 instructions.

SVE feature introduces new instruction and registers to improve performances on
floating point operations.

The SVE feature is advertised using the ID_AA64PFR0_EL1 register, SVE field, and
when available the ID_AA64ZFR0_EL1 register provides additional information
about the implemented version and other SVE feature.

New registers added by the SVE feature are Z0-Z31, P0-P15, FFR, ZCR_ELx.

Z0-Z31 are scalable vector register whose size is implementation defined and
goes from 128 bits to maximum 2048, the term vector length will be used to refer
to this quantity.
P0-P15 are predicate registers and the size is the vector length divided by 8,
same size is the FFR (First Fault Register).
ZCR_ELx is a register that can control and restrict the maximum vector length
used by the <x> exception level and all the lower exception levels, so for
example EL3 can restrict the vector length usable by EL3,2,1,0.

The platform has a maximum implemented vector length, so for every value
written in ZCR register, if this value is above the implemented length, then the
lower value will be used. The RDVL instruction can be used to check what vector
length is the HW using after setting ZCR.

For an SVE guest, the V0-V31 registers are part of the Z0-Z31, so there is no
need to save them separately, saving Z0-Z31 will save implicitly also V0-V31.

SVE usage can be trapped using a flag in CPTR_EL2, hence in this serie the
register is added to the domain state, to be able to trap only the guests that
are not allowed to use SVE.

This serie is introducing a command line parameter to enable Dom0 to use SVE and
to set its maximum vector length that by default is 0 which means the guest is
not allowed to use SVE. Values from 128 to 2048 mean the guest can use SVE with
the selected value used as maximum allowed vector length (which could be lower
if the implemented one is lower).
For DomUs, an XL parameter with the same way of use is introduced and a dom0less
DTB binding is created.

The context switch is the most critical part because there can be big registers
to be saved, in this serie an easy approach is used and the context is
saved/restored every time for the guests that are allowed to use SVE.

Luca Fancellu (10):
  xen/arm: enable SVE extension for Xen
  xen/arm: add SVE vector length field to the domain
  xen/arm: Expose SVE feature to the guest
  xen/arm: add SVE exception class handling
  arm/sve: save/restore SVE context switch
  xen/arm: enable Dom0 to use SVE feature
  xen/physinfo: encode Arm SVE vector length in arch_capabilities
  tools: add physinfo arch_capabilities handling for Arm
  xen/tools: add sve parameter in XL configuration
  xen/arm: add sve property for dom0less domUs

 docs/man/xl.cfg.5.pod.in                 |  11 ++
 docs/misc/arm/device-tree/booting.txt    |   9 ++
 docs/misc/xen-command-line.pandoc        |  13 ++
 tools/golang/xenlight/helpers.gen.go     |   4 +
 tools/golang/xenlight/types.gen.go       |   2 +
 tools/include/arm-arch-capabilities.h    |  33 ++++
 tools/include/libxl.h                    |   5 +
 tools/include/xen-tools/libs.h           |   2 +
 tools/libs/light/libxl.c                 |   1 +
 tools/libs/light/libxl_arm.c             |   2 +
 tools/libs/light/libxl_internal.h        |   1 -
 tools/libs/light/libxl_types.idl         |   2 +
 tools/ocaml/libs/xc/xenctrl.ml           |   4 +-
 tools/ocaml/libs/xc/xenctrl.mli          |   4 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c      |   8 +-
 tools/python/xen/lowlevel/xc/xc.c        |   8 +-
 tools/xl/xl_info.c                       |   8 +
 tools/xl/xl_parse.c                      |  26 +++-
 xen/arch/arm/Kconfig                     |  10 +-
 xen/arch/arm/arm64/Makefile              |   1 +
 xen/arch/arm/arm64/cpufeature.c          |   7 +-
 xen/arch/arm/arm64/sve-asm.S             | 189 +++++++++++++++++++++++
 xen/arch/arm/arm64/sve.c                 | 131 ++++++++++++++++
 xen/arch/arm/arm64/vfp.c                 |  79 ++++++----
 xen/arch/arm/arm64/vsysreg.c             |  39 ++++-
 xen/arch/arm/cpufeature.c                |   6 +-
 xen/arch/arm/domain.c                    |  48 +++++-
 xen/arch/arm/domain_build.c              |  11 ++
 xen/arch/arm/include/asm/arm64/sve.h     |  85 ++++++++++
 xen/arch/arm/include/asm/arm64/sysregs.h |   4 +
 xen/arch/arm/include/asm/arm64/vfp.h     |  10 ++
 xen/arch/arm/include/asm/cpufeature.h    |  14 ++
 xen/arch/arm/include/asm/domain.h        |   8 +
 xen/arch/arm/include/asm/processor.h     |   3 +
 xen/arch/arm/setup.c                     |   5 +-
 xen/arch/arm/sysctl.c                    |   3 +
 xen/arch/arm/traps.c                     |  40 +++--
 xen/include/public/arch-arm.h            |   2 +
 xen/include/public/domctl.h              |   2 +-
 xen/include/public/sysctl.h              |   4 +
 40 files changed, 769 insertions(+), 75 deletions(-)
 create mode 100644 tools/include/arm-arch-capabilities.h
 create mode 100644 xen/arch/arm/arm64/sve-asm.S
 create mode 100644 xen/arch/arm/arm64/sve.c
 create mode 100644 xen/arch/arm/include/asm/arm64/sve.h

-- 
2.34.1



             reply	other threads:[~2023-03-17 13:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 13:19 Luca Fancellu [this message]
2023-03-17 13:19 ` [PATCH v3 01/10] xen/arm: enable SVE extension for Xen Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 02/10] xen/arm: add SVE vector length field to the domain Luca Fancellu
2023-03-20  9:09   ` Jan Beulich
2023-03-22  7:07     ` Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 03/10] xen/arm: Expose SVE feature to the guest Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 04/10] xen/arm: add SVE exception class handling Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 05/10] arm/sve: save/restore SVE context switch Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 06/10] xen/arm: enable Dom0 to use SVE feature Luca Fancellu
2023-03-20  9:13   ` Jan Beulich
2023-03-22  7:32     ` Luca Fancellu
2023-03-22  7:51       ` Jan Beulich
2023-03-17 13:19 ` [PATCH v3 07/10] xen/physinfo: encode Arm SVE vector length in arch_capabilities Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 08/10] tools: add physinfo arch_capabilities handling for Arm Luca Fancellu
2023-03-20 10:30   ` George Dunlap
2023-03-20 11:01   ` Christian Lindig
2023-03-22  7:02     ` Luca Fancellu
2023-03-22  8:47       ` Christian Lindig
2023-03-17 13:19 ` [PATCH v3 09/10] xen/tools: add sve parameter in XL configuration Luca Fancellu
2023-03-17 13:19 ` [PATCH v3 10/10] xen/arm: add sve property for dom0less domUs Luca Fancellu

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=20230317131949.4031014-1-luca.fancellu@arm.com \
    --to=luca.fancellu@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=christian.lindig@citrix.com \
    --cc=dave@recoil.org \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=marmarek@invisiblethingslab.com \
    --cc=rosbrookn@gmail.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.chen@arm.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.