All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bertrand Marquis <Bertrand.Marquis@arm.com>
To: Luca Fancellu <Luca.Fancellu@arm.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Wei Chen <Wei.Chen@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v5 03/12] xen/arm: Expose SVE feature to the guest
Date: Thu, 13 Apr 2023 12:47:14 +0000	[thread overview]
Message-ID: <43CDAEBF-D406-4DD8-9C17-00971867B4B8@arm.com> (raw)
In-Reply-To: <20230412094938.2693890-4-luca.fancellu@arm.com>

Hi Luca,

> On 12 Apr 2023, at 11:49, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
> 
> When a guest is allowed to use SVE, expose the SVE features through
> the identification registers.
> 
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>

Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> CHanges from v4:
> - no changes
> Changes from v3:
> - no changes
> Changes from v2:
> - no changes
> Changes from v1:
> - No changes
> Changes from RFC:
> - No changes
> ---
> xen/arch/arm/arm64/vsysreg.c | 39 ++++++++++++++++++++++++++++++++++--
> 1 file changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c
> index 758750983c11..10048bb4d221 100644
> --- a/xen/arch/arm/arm64/vsysreg.c
> +++ b/xen/arch/arm/arm64/vsysreg.c
> @@ -18,6 +18,7 @@
> 
> #include <xen/sched.h>
> 
> +#include <asm/arm64/cpufeature.h>
> #include <asm/current.h>
> #include <asm/regs.h>
> #include <asm/traps.h>
> @@ -295,7 +296,28 @@ void do_sysreg(struct cpu_user_regs *regs,
>     GENERATE_TID3_INFO(MVFR0_EL1, mvfr, 0)
>     GENERATE_TID3_INFO(MVFR1_EL1, mvfr, 1)
>     GENERATE_TID3_INFO(MVFR2_EL1, mvfr, 2)
> -    GENERATE_TID3_INFO(ID_AA64PFR0_EL1, pfr64, 0)
> +
> +    case HSR_SYSREG_ID_AA64PFR0_EL1:
> +    {
> +        register_t guest_reg_value = guest_cpuinfo.pfr64.bits[0];
> +
> +        if ( is_sve_domain(v->domain) )
> +        {
> +            /* 4 is the SVE field width in id_aa64pfr0_el1 */
> +            uint64_t mask = GENMASK(ID_AA64PFR0_SVE_SHIFT + 4 - 1,
> +                                    ID_AA64PFR0_SVE_SHIFT);
> +            /* sysval is the sve field on the system */
> +            uint64_t sysval = cpuid_feature_extract_unsigned_field_width(
> +                                system_cpuinfo.pfr64.bits[0],
> +                                ID_AA64PFR0_SVE_SHIFT, 4);
> +            guest_reg_value &= ~mask;
> +            guest_reg_value |= (sysval << ID_AA64PFR0_SVE_SHIFT) & mask;
> +        }
> +
> +        return handle_ro_read_val(regs, regidx, hsr.sysreg.read, hsr, 1,
> +                                  guest_reg_value);
> +    }
> +
>     GENERATE_TID3_INFO(ID_AA64PFR1_EL1, pfr64, 1)
>     GENERATE_TID3_INFO(ID_AA64DFR0_EL1, dbg64, 0)
>     GENERATE_TID3_INFO(ID_AA64DFR1_EL1, dbg64, 1)
> @@ -306,7 +328,20 @@ void do_sysreg(struct cpu_user_regs *regs,
>     GENERATE_TID3_INFO(ID_AA64MMFR2_EL1, mm64, 2)
>     GENERATE_TID3_INFO(ID_AA64AFR0_EL1, aux64, 0)
>     GENERATE_TID3_INFO(ID_AA64AFR1_EL1, aux64, 1)
> -    GENERATE_TID3_INFO(ID_AA64ZFR0_EL1, zfr64, 0)
> +
> +    case HSR_SYSREG_ID_AA64ZFR0_EL1:
> +    {
> +        /*
> +         * When the guest has the SVE feature enabled, the whole id_aa64zfr0_el1
> +         * needs to be exposed.
> +         */
> +        register_t guest_reg_value = guest_cpuinfo.zfr64.bits[0];
> +        if ( is_sve_domain(v->domain) )
> +            guest_reg_value = system_cpuinfo.zfr64.bits[0];
> +
> +        return handle_ro_read_val(regs, regidx, hsr.sysreg.read, hsr, 1,
> +                                  guest_reg_value);
> +    }
> 
>     /*
>      * Those cases are catching all Reserved registers trapped by TID3 which
> -- 
> 2.34.1
> 



  reply	other threads:[~2023-04-13 12:47 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  9:49 [PATCH v5 00/12] SVE feature for arm guests Luca Fancellu
2023-04-12  9:49 ` [PATCH v5 01/12] xen/arm: enable SVE extension for Xen Luca Fancellu
2023-04-13 12:47   ` Bertrand Marquis
2023-04-14 13:28     ` Luca Fancellu
2023-04-14 13:38       ` Bertrand Marquis
2023-04-12  9:49 ` [PATCH v5 02/12] xen/arm: add SVE vector length field to the domain Luca Fancellu
2023-04-13 12:47   ` Bertrand Marquis
2023-04-17  9:20     ` Jan Beulich
2023-04-13 12:57   ` Julien Grall
2023-04-13 13:24     ` Luca Fancellu
2023-04-13 13:30       ` Julien Grall
2023-04-13 14:05         ` Luca Fancellu
2023-04-13 16:10           ` Luca Fancellu
2023-04-13 19:53             ` Julien Grall
2023-04-13 19:52           ` Julien Grall
2023-04-14 11:07             ` Luca Fancellu
2023-04-14 17:16               ` Julien Grall
2023-04-12  9:49 ` [PATCH v5 03/12] xen/arm: Expose SVE feature to the guest Luca Fancellu
2023-04-13 12:47   ` Bertrand Marquis [this message]
2023-04-12  9:49 ` [PATCH v5 04/12] xen/arm: add SVE exception class handling Luca Fancellu
2023-04-13 13:02   ` Julien Grall
2023-04-13 13:27     ` Luca Fancellu
2023-04-14  8:40   ` Bertrand Marquis
2023-04-12  9:49 ` [PATCH v5 05/12] arm/sve: save/restore SVE context switch Luca Fancellu
2023-04-13 13:11   ` Julien Grall
2023-04-13 14:35     ` Luca Fancellu
2023-04-13 19:54       ` Julien Grall
2023-04-18 12:40   ` Bertrand Marquis
2023-04-19  7:09     ` Luca Fancellu
2023-04-19  7:13       ` Bertrand Marquis
2023-04-20  7:43         ` Luca Fancellu
2023-04-20  7:55           ` Bertrand Marquis
2023-04-20  7:58             ` Luca Fancellu
2023-04-20  8:33               ` Bertrand Marquis
2023-04-12  9:49 ` [PATCH v5 06/12] xen/common: add dom0 xen command line argument for Arm Luca Fancellu
2023-04-14  8:47   ` Bertrand Marquis
2023-04-12  9:49 ` [PATCH v5 07/12] xen: enable Dom0 to use SVE feature Luca Fancellu
2023-04-17  9:41   ` Jan Beulich
2023-04-20  6:25     ` Luca Fancellu
2023-04-20  7:56       ` Jan Beulich
2023-04-18 12:47   ` Bertrand Marquis
2023-04-19  6:34     ` Jan Beulich
2023-04-19  7:15     ` Luca Fancellu
2023-04-19  7:21       ` Bertrand Marquis
2023-04-19  7:41         ` Luca Fancellu
2023-04-20  8:46           ` Luca Fancellu
2023-04-20 12:00             ` Bertrand Marquis
2023-04-20 12:29             ` Julien Grall
2023-04-20 12:43               ` Luca Fancellu
2023-04-20 13:08                 ` Julien Grall
2023-04-20 13:18                   ` Luca Fancellu
2023-04-12  9:49 ` [PATCH v5 08/12] xen/physinfo: encode Arm SVE vector length in arch_capabilities Luca Fancellu
2023-04-18 12:49   ` Bertrand Marquis
2023-04-12  9:49 ` [PATCH v5 09/12] tools: add physinfo arch_capabilities handling for Arm Luca Fancellu
2023-04-12  9:49 ` [PATCH v5 10/12] xen/tools: add sve parameter in XL configuration Luca Fancellu
2023-04-12  9:49 ` [PATCH v5 11/12] xen/arm: add sve property for dom0less domUs Luca Fancellu
2023-04-18 12:55   ` Bertrand Marquis
2023-04-18 13:21     ` Bertrand Marquis
2023-04-12  9:49 ` [PATCH v5 12/12] xen/changelog: Add SVE and "dom0" options to the changelog for Arm Luca Fancellu
2023-04-12  9:53   ` Henry Wang
2023-04-18 12:56   ` Bertrand Marquis
2023-04-19  7:11     ` Luca Fancellu
2023-04-19  7:16       ` Bertrand Marquis
2023-04-18 13:13 ` [PATCH v5 00/12] SVE feature for arm guests Bertrand Marquis
2023-04-18 14:25   ` Julien Grall
2023-04-18 14:38     ` Bertrand Marquis
2023-04-18 14:41       ` Luca Fancellu
2023-04-18 15:00         ` Bertrand Marquis
2023-04-19  6:28     ` Jan Beulich
2023-04-19  7:31       ` Bertrand Marquis
2023-04-19  7:46         ` Julien Grall
2023-04-19  7:52         ` Jan Beulich
2023-04-19  8:20           ` Bertrand Marquis
2023-04-20 12:30             ` Julien Grall

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=43CDAEBF-D406-4DD8-9C17-00971867B4B8@arm.com \
    --to=bertrand.marquis@arm.com \
    --cc=Luca.Fancellu@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=Wei.Chen@arm.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.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.