Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Fuad Tabba <tabba@google.com>
Cc: kvmarm@lists.linux.dev, maz@kernel.org, catalin.marinas@arm.com,
	james.morse@arm.com, suzuki.poulose@arm.com,
	yuzenghui@huawei.com, will@kernel.org
Subject: Re: [PATCH v1 3/5] KVM: arm64: Use the appropriate feature trap register when activating traps
Date: Wed, 19 Jul 2023 17:48:42 +0000	[thread overview]
Message-ID: <ZLgh+rPYxTjmD6xR@linux.dev> (raw)
In-Reply-To: <20230719150639.1968034-4-tabba@google.com>

On Wed, Jul 19, 2023 at 04:06:37PM +0100, Fuad Tabba wrote:
> Use the architectural feature trap/control register that
> corresponds to the current KVM mode, i.e., CPTR_EL2 or CPACR_EL1,
> when activating traps.
> 
> Signed-off-by: Fuad Tabba <tabba@google.com>
> ---
>  arch/arm64/kvm/hyp/nvhe/switch.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/switch.c
> index 0a6271052def..e5ea517bab9c 100644
> --- a/arch/arm64/kvm/hyp/nvhe/switch.c
> +++ b/arch/arm64/kvm/hyp/nvhe/switch.c
> @@ -63,7 +63,11 @@ static void __activate_traps(struct kvm_vcpu *vcpu)
>  		__activate_traps_fpsimd32(vcpu);
>  	}
>  
> -	write_sysreg(val, cptr_el2);
> +	if (has_hvhe())
> +		write_sysreg(val, cpacr_el1);
> +	else
> +		write_sysreg(val, cptr_el2);
> +

Does it make sense to have an accessor that's shared with
kvm_reset_cptr_el2()? Due to the lack of synchronization between the
aliases we really want to avoid inconsistently using one or the other.

-- 
Thanks,
Oliver

  reply	other threads:[~2023-07-19 17:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 15:06 [PATCH v1 0/5] Fix setting SVE and SME traps in (h)VHE Fuad Tabba
2023-07-19 15:06 ` [PATCH v1 1/5] KVM: arm64: Use the appropriate feature trap register for SVE at EL2 setup Fuad Tabba
2023-07-19 15:06 ` [PATCH v1 2/5] KVM: arm64: Disable SME Traps for (h)VHE at setup Fuad Tabba
2023-07-19 17:34   ` Oliver Upton
2023-07-20  8:03     ` Fuad Tabba
2023-07-20  8:36       ` Fuad Tabba
2023-07-19 15:06 ` [PATCH v1 3/5] KVM: arm64: Use the appropriate feature trap register when activating traps Fuad Tabba
2023-07-19 17:48   ` Oliver Upton [this message]
2023-07-19 18:40     ` Fuad Tabba
2023-07-19 15:06 ` [PATCH v1 4/5] KVM: arm64: Fix resetting SVE trap values on reset for hVHE Fuad Tabba
2023-07-19 15:06 ` [PATCH v1 5/5] KVM: arm64: Fix resetting SME trap values on reset for (h)VHE Fuad Tabba
2023-07-19 15:20 ` [PATCH v1 0/5] Fix setting SVE and SME traps in (h)VHE Marc Zyngier
2023-07-20  8:42   ` Fuad Tabba

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=ZLgh+rPYxTjmD6xR@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox