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

Marc Zyngier maz at kernel.org
Mon Nov 30 10:40:16 EST 2020


Hi David,

On 2020-11-30 15:26, David Brazdil wrote:
>> @@ -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.

It definitely is. Who the hell is writing this code?

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...



More information about the linux-arm-kernel mailing list