[PATCH v2 06/16] KVM: arm64: Compute shareability for LPA2

Oliver Upton oliver.upton at linux.dev
Fri Sep 19 14:58:14 PDT 2025


On Mon, Sep 15, 2025 at 12:44:41PM +0100, Marc Zyngier wrote:
> +static u8 compute_s1_sh(struct s1_walk_info *wi, struct s1_walk_result *wr,
> +			u8 attr)
> +{
> +	u8 sh;
> +
> +	/*
> +	 * non-52bit and LPA have their basic shareability described in the
> +	 * descriptor. LPA2 gets it from the corresponding field in TCR,
> +	 * conveniently recorded in the walk info.
> +	 */
> +	if (!wi->pa52bit || BIT(wi->pgshift) == SZ_64K)
> +		sh = FIELD_GET(PTE_SHARED, wr->desc);

nit: s/PTE_SHARED/KVM_PTE_LEAF_ATTR_LO_S1_SH/ makes it a bit more
obvious what field is being used here (even though it was like this
before).

> @@ -798,11 +819,13 @@ static u64 compute_par_s12(struct kvm_vcpu *vcpu, u64 s1_par,
>  	    !MEMATTR_IS_DEVICE(final_attr))
>  		final_attr = MEMATTR(NC, NC);
>  
> +	s2_sh = FIELD_GET(PTE_SHARED, tr->desc);
> +

s/PTE_SHARED/KVM_PTE_LEAF_ATTR_LO_S2_SH/

Thanks,
Oliver



More information about the linux-arm-kernel mailing list