All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@kernel.org>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: Fuad Tabba <fuad.tabba@linux.dev>, Marc Zyngier <maz@kernel.org>,
	kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Fuad Tabba <tabba@google.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] KVM: arm64: Allocate a protected vCPU's SVE state at EL2
Date: Fri, 6 Nov 2026 10:59:05 -0800	[thread overview]
Message-ID: <au4jeecA_FIk_yPT@kernel.org> (raw)
In-Reply-To: <au4TsO50x7BcFYpi@google.com>

On Fri, Nov 06, 2026 at 05:51:44PM +0000, Vincent Donnefort wrote:
> > @@ -1243,6 +1253,9 @@ int pkvm_reset_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu)
> >  			    PSCI_0_2_AFFINITY_LEVEL_ON) != PSCI_0_2_AFFINITY_LEVEL_ON_PENDING)
> >  		return -ECANCELED;
> >  
> > +	if (vcpu_has_sve(&hyp_vcpu->vcpu))
> > +		memset(hyp_vcpu->vcpu.arch.sve_state, 0, vcpu_sve_state_size(&hyp_vcpu->vcpu));
> > +
> 
> Why wasn't this line around before?

Prior to this series SVE was only supported in non-protected guests, so
the host was responsible for resetting SVE state.

Now that we have pVM support we need to reset state for protected
vCPUs.

Thanks,
Oliver

> >  	kvm_reset_vcpu_core(&hyp_vcpu->vcpu);
> >  	kvm_reset_pvm_sys_regs(&hyp_vcpu->vcpu);
> >  
> > diff --git a/arch/arm64/kvm/hyp/nvhe/sys_regs.c b/arch/arm64/kvm/hyp/nvhe/sys_regs.c
> > index 32e82653ebf7e..06ea91415ad8b 100644
> > --- a/arch/arm64/kvm/hyp/nvhe/sys_regs.c
> > +++ b/arch/arm64/kvm/hyp/nvhe/sys_regs.c
> > @@ -570,6 +570,7 @@ static const struct sys_reg_desc_reset pvm_sys_reg_reset_vals[] = {
> >  	RESET_UNKNOWN(MAIR_EL1),
> >  	RESET_ZERO(AMAIR_EL1),
> >  	RESET_ZERO(MDSCR_EL1),
> > +	RESET_ZERO(ZCR_EL1),
> >  	RESET_ZERO(CNTV_CTL_EL0),
> >  	RESET_UNKNOWN(TTBR0_EL1),
> >  	RESET_UNKNOWN(TTBR1_EL1),
> > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
> > index 10eb7249aa9e8..aaaa1b8634ba4 100644
> > --- a/arch/arm64/kvm/reset.c
> > +++ b/arch/arm64/kvm/reset.c
> > @@ -52,6 +52,8 @@ int __init kvm_arm_init_sve(void)
> >  		if (WARN_ON(kvm_sve_max_vl > VL_ARCH_MAX))
> >  			kvm_sve_max_vl = VL_ARCH_MAX;
> >  
> > +		kvm_nvhe_sym(kvm_sve_max_vl) = kvm_sve_max_vl;
> > +
> >  		/*
> >  		 * Don't even try to make use of vector lengths that
> >  		 * aren't available on all CPUs, for now:
> > -- 
> > 2.47.3
> > 
> 
> -- 
> Vincent

  reply	other threads:[~2026-11-06 18:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 13:04 [PATCH 0/4] KVM: arm64: Support SVE in protected VMs Fuad Tabba
2026-11-05 13:04 ` [PATCH 1/4] KVM: arm64: Remove redundant kern_hyp_va() calls from the pKVM FP sync Fuad Tabba
2026-11-05 13:04 ` [PATCH 2/4] KVM: arm64: Allocate a protected vCPU's SVE state at EL2 Fuad Tabba
2026-11-06 17:51   ` Vincent Donnefort
2026-11-06 18:59     ` Oliver Upton [this message]
2026-11-05 13:04 ` [PATCH 3/4] KVM: arm64: Advertise ID_AA64ZFR0_EL1 to protected VMs Fuad Tabba
2026-11-05 13:04 ` [PATCH 4/4] KVM: arm64: Allow protected VMs to use SVE Fuad Tabba
2026-11-06 17:58 ` [PATCH 0/4] KVM: arm64: Support SVE in protected VMs Vincent Donnefort
2026-11-09  8:37 ` 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=au4jeecA_FIk_yPT@kernel.org \
    --to=oupton@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=vdonnefort@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 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.