[PATCH 2/2] KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV3=1 if the CPUs are Meltdown-safe

David Brazdil dbrazdil at google.com
Mon Nov 30 10:26:55 EST 2020


> @@ -1227,9 +1229,16 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
>  	    (csv2 && arm64_get_spectre_v2_state() != SPECTRE_UNAFFECTED))
>  		return -EINVAL;
>  
> -	/* We can only differ with CSV2, and anything else is an error */
> +	/* Same thing for CSV3 */
> +	csv3 = cpuid_feature_extract_unsigned_field(val, ID_AA64PFR0_CSV3_SHIFT);
> +	if (csv3 > 1 ||
> +	    (csv3 && arm64_get_meltdown_state() != SPECTRE_UNAFFECTED))
> +		return -EINVAL;
> +
> +	/* We can only differ with CSV[23], and anything else is an error */
>  	val ^= read_id_reg(vcpu, rd, false);
> -	val &= ~(0xFUL << ID_AA64PFR0_CSV2_SHIFT);
> +	val &= ~((0xFUL << ID_AA64PFR0_CSV2_SHIFT) ||
> +		 (0xFUL << ID_AA64PFR0_CSV3_SHIFT));

That boolean OR looks like a typo.

David



More information about the linux-arm-kernel mailing list