[PATCH v1 1/3] KVM: arm64: Initialize HCRX_EL2 traps in pKVM
Oliver Upton
oliver.upton at linux.dev
Wed Feb 26 02:07:56 PST 2025
Hi Fuad,
Series LGTM overall, one comment:
On Fri, Feb 14, 2025 at 03:02:56PM +0000, Fuad Tabba wrote:
> Initialize and set the traps controlled by the HCRX_EL2 in pKVM
> when the register is supported by the system.
>
> Signed-off-by: Fuad Tabba <tabba at google.com>
> ---
> arch/arm64/kvm/hyp/nvhe/pkvm.c | 46 ++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> index 3927fe52a3dd..668ebec27f1b 100644
> --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
> +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> @@ -58,6 +58,30 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu)
> vcpu->arch.hcr_el2 |= HCR_ATA;
> }
>
> +static void pkvm_vcpu_reset_hcrx(struct pkvm_hyp_vcpu *hyp_vcpu)
> +{
> + struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu;
> + struct kvm_vcpu *vcpu = &hyp_vcpu->vcpu;
> +
> + if (!cpus_have_final_cap(ARM64_HAS_HCX))
> + return;
> +
> + /*
> + * In general, all HCRX_EL2 bits are gated by a feature.
> + * The only reason we can set SMPME without checking any
> + * feature is that its effects are not directly observable
> + * from the guest.
> + */
> + vcpu->arch.hcrx_el2 = HCRX_EL2_SMPME;
> +
The comment isn't wrong, but we don't support SME at all in KVM at this
point.
Any objection to dropping this bit? I can fix it when applying the
series, no need to respin.
Thanks,
Oliver
More information about the linux-arm-kernel
mailing list