All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Bertrand Marquis <bertrand.marquis@arm.com>,
	xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v3 4/7] xen/arm: Add handler for ID registers on arm64
Date: Wed, 9 Dec 2020 23:13:23 +0000	[thread overview]
Message-ID: <8a154f7c-f700-5b6f-5645-a122fec45d19@xen.org> (raw)
In-Reply-To: <e991b05af11d00627709caf847c5de99f487cab0.1607524536.git.bertrand.marquis@arm.com>



On 09/12/2020 16:30, Bertrand Marquis wrote:
> Add vsysreg emulation for registers trapped when TID3 bit is activated
> in HSR.
> The emulation is returning the value stored in cpuinfo_guest structure
> for know registers and is handling reserved registers as RAZ.
> 
> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
> ---
> Changes in V2: Rebase
> Changes in V3:
>    Fix commit message
>    Fix code style for GENERATE_TID3_INFO declaration
>    Add handling of reserved registers as RAZ.
> 
> ---
>   xen/arch/arm/arm64/vsysreg.c | 53 ++++++++++++++++++++++++++++++++++++
>   1 file changed, 53 insertions(+)
> 
> diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c
> index 8a85507d9d..ef7a11dbdd 100644
> --- a/xen/arch/arm/arm64/vsysreg.c
> +++ b/xen/arch/arm/arm64/vsysreg.c
> @@ -69,6 +69,14 @@ TVM_REG(CONTEXTIDR_EL1)
>           break;                                                          \
>       }
>   
> +/* Macro to generate easily case for ID co-processor emulation */
> +#define GENERATE_TID3_INFO(reg, field, offset)                          \
> +    case HSR_SYSREG_##reg:                                              \
> +    {                                                                   \
> +        return handle_ro_read_val(regs, regidx, hsr.sysreg.read, hsr,   \
> +                          1, guest_cpuinfo.field.bits[offset]);         \

The indentation looks wrong here. The "1" should be aligned with "regs".

> +    }
> +
>   void do_sysreg(struct cpu_user_regs *regs,
>                  const union hsr hsr)
>   {
> @@ -259,6 +267,51 @@ void do_sysreg(struct cpu_user_regs *regs,
>            */
>           return handle_raz_wi(regs, regidx, hsr.sysreg.read, hsr, 1);
>   
> +    /*
> +     * HCR_EL2.TID3
> +     *
> +     * This is trapping most Identification registers used by a guest
> +     * to identify the processor features
> +     */
> +    GENERATE_TID3_INFO(ID_PFR0_EL1, pfr32, 0)
> +    GENERATE_TID3_INFO(ID_PFR1_EL1, pfr32, 1)
> +    GENERATE_TID3_INFO(ID_PFR2_EL1, pfr32, 2)
> +    GENERATE_TID3_INFO(ID_DFR0_EL1, dbg32, 0)
> +    GENERATE_TID3_INFO(ID_DFR1_EL1, dbg32, 1)
> +    GENERATE_TID3_INFO(ID_AFR0_EL1, aux32, 0)
> +    GENERATE_TID3_INFO(ID_MMFR0_EL1, mm32, 0)
> +    GENERATE_TID3_INFO(ID_MMFR1_EL1, mm32, 1)
> +    GENERATE_TID3_INFO(ID_MMFR2_EL1, mm32, 2)
> +    GENERATE_TID3_INFO(ID_MMFR3_EL1, mm32, 3)
> +    GENERATE_TID3_INFO(ID_MMFR4_EL1, mm32, 4)
> +    GENERATE_TID3_INFO(ID_MMFR5_EL1, mm32, 5)
> +    GENERATE_TID3_INFO(ID_ISAR0_EL1, isa32, 0)
> +    GENERATE_TID3_INFO(ID_ISAR1_EL1, isa32, 1)
> +    GENERATE_TID3_INFO(ID_ISAR2_EL1, isa32, 2)
> +    GENERATE_TID3_INFO(ID_ISAR3_EL1, isa32, 3)
> +    GENERATE_TID3_INFO(ID_ISAR4_EL1, isa32, 4)
> +    GENERATE_TID3_INFO(ID_ISAR5_EL1, isa32, 5)
> +    GENERATE_TID3_INFO(ID_ISAR6_EL1, isa32, 6)
> +    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)
> +    GENERATE_TID3_INFO(ID_AA64PFR1_EL1, pfr64, 1)
> +    GENERATE_TID3_INFO(ID_AA64DFR0_EL1, dbg64, 0)
> +    GENERATE_TID3_INFO(ID_AA64DFR1_EL1, dbg64, 1)
> +    GENERATE_TID3_INFO(ID_AA64ISAR0_EL1, isa64, 0)
> +    GENERATE_TID3_INFO(ID_AA64ISAR1_EL1, isa64, 1)
> +    GENERATE_TID3_INFO(ID_AA64MMFR0_EL1, mm64, 0)
> +    GENERATE_TID3_INFO(ID_AA64MMFR1_EL1, mm64, 1)
> +    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)
> +
> +    HSR_SYSREG_TID3_RESERVED_CASE:
> +        /* Handle all reserved registers as RAZ */
> +        return handle_ro_raz(regs, regidx, hsr.sysreg.read, hsr, 1);
> +
>       /*
>        * HCR_EL2.TIDCP
>        *
> 

-- 
Julien Grall


  parent reply	other threads:[~2020-12-09 23:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 16:30 [PATCH v3 0/7] xen/arm: Emulate ID registers Bertrand Marquis
2020-12-09 16:30 ` [PATCH v3 1/7] xen/arm: Add ID registers and complete cpuinfo Bertrand Marquis
2020-12-09 21:05   ` Stefano Stabellini
2020-12-09 23:03   ` Julien Grall
2020-12-10 15:14     ` Bertrand Marquis
2020-12-10 15:45       ` Julien Grall
2020-12-10 15:58         ` Bertrand Marquis
2020-12-09 16:30 ` [PATCH v3 2/7] xen/arm: Add arm64 ID registers definitions Bertrand Marquis
2020-12-09 21:06   ` Stefano Stabellini
2020-12-09 23:06   ` Julien Grall
2020-12-10  2:30     ` Stefano Stabellini
2020-12-10 15:46       ` Julien Grall
2020-12-10 15:59         ` Bertrand Marquis
2020-12-09 16:30 ` [PATCH v3 3/7] xen/arm: create a cpuinfo structure for guest Bertrand Marquis
2020-12-09 21:06   ` Stefano Stabellini
2020-12-09 23:09   ` Julien Grall
2020-12-10 15:48     ` Bertrand Marquis
2020-12-10 16:05       ` Julien Grall
2020-12-10 16:17         ` Bertrand Marquis
2020-12-10 16:30           ` Julien Grall
2020-12-10 16:37             ` Bertrand Marquis
2020-12-09 23:22   ` Julien Grall
2020-12-10 15:49     ` Bertrand Marquis
2020-12-09 16:30 ` [PATCH v3 4/7] xen/arm: Add handler for ID registers on arm64 Bertrand Marquis
2020-12-09 19:38   ` Stefano Stabellini
2020-12-10 15:18     ` Bertrand Marquis
2020-12-10 22:29       ` Stefano Stabellini
2020-12-11 17:00         ` Bertrand Marquis
2020-12-11 19:00           ` Stefano Stabellini
2020-12-09 23:13   ` Julien Grall [this message]
2020-12-10 15:21     ` Bertrand Marquis
2020-12-09 16:30 ` [PATCH v3 5/7] xen/arm: Add handler for cp15 ID registers Bertrand Marquis
2020-12-09 19:54   ` Stefano Stabellini
2020-12-10 15:09     ` Bertrand Marquis
2020-12-10 22:32       ` Stefano Stabellini
2020-12-09 16:30 ` [PATCH v3 6/7] xen/arm: Add CP10 exception support to handle MVFR Bertrand Marquis
2020-12-09 21:04   ` Stefano Stabellini
2020-12-10 15:24     ` Bertrand Marquis
2020-12-09 23:15   ` Julien Grall
2020-12-10 15:27     ` Bertrand Marquis
2020-12-09 16:31 ` [PATCH v3 7/7] xen/arm: Activate TID3 in HCR_EL2 Bertrand Marquis
2020-12-09 21:06   ` Stefano Stabellini
2020-12-09 23:17   ` Julien Grall
2020-12-10 15:36     ` Bertrand Marquis

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=8a154f7c-f700-5b6f-5645-a122fec45d19@xen.org \
    --to=julien@xen.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --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.