All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: David Brazdil <dbrazdil@google.com>
Cc: kvm@vger.kernel.org, kernel-team@android.com,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 2/2] KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV3=1 if the CPUs are Meltdown-safe
Date: Mon, 30 Nov 2020 15:40:16 +0000	[thread overview]
Message-ID: <4a398347b173c5c1a7a0ebd4b54a64bd@kernel.org> (raw)
In-Reply-To: <20201130152655.oyzs2l4qg2pfzxmv@google.com>

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...
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: David Brazdil <dbrazdil@google.com>
Cc: kvm@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com>,
	kernel-team@android.com, James Morse <james.morse@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	Julien Thierry <julien.thierry.kdev@gmail.com>
Subject: Re: [PATCH 2/2] KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV3=1 if the CPUs are Meltdown-safe
Date: Mon, 30 Nov 2020 15:40:16 +0000	[thread overview]
Message-ID: <4a398347b173c5c1a7a0ebd4b54a64bd@kernel.org> (raw)
In-Reply-To: <20201130152655.oyzs2l4qg2pfzxmv@google.com>

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...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: David Brazdil <dbrazdil@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
	Julien Thierry <julien.thierry.kdev@gmail.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	kernel-team@android.com
Subject: Re: [PATCH 2/2] KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV3=1 if the CPUs are Meltdown-safe
Date: Mon, 30 Nov 2020 15:40:16 +0000	[thread overview]
Message-ID: <4a398347b173c5c1a7a0ebd4b54a64bd@kernel.org> (raw)
In-Reply-To: <20201130152655.oyzs2l4qg2pfzxmv@google.com>

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...

  reply	other threads:[~2020-11-30 15:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 12:46 [PATCH 0/2] KVM: arm64: Expose CSV3 to guests on running on Meltdown-safe HW Marc Zyngier
2020-11-28 12:46 ` Marc Zyngier
2020-11-28 12:46 ` Marc Zyngier
2020-11-28 12:46 ` [PATCH 1/2] arm64: Make the Meltdown mitigation state available Marc Zyngier
2020-11-28 12:46   ` Marc Zyngier
2020-11-28 12:46   ` Marc Zyngier
2020-11-28 12:46 ` [PATCH 2/2] KVM: arm64: Advertise ID_AA64PFR0_EL1.CSV3=1 if the CPUs are Meltdown-safe Marc Zyngier
2020-11-28 12:46   ` Marc Zyngier
2020-11-28 12:46   ` Marc Zyngier
2020-11-30 15:26   ` David Brazdil
2020-11-30 15:26     ` David Brazdil
2020-11-30 15:26     ` David Brazdil
2020-11-30 15:40     ` Marc Zyngier [this message]
2020-11-30 15:40       ` Marc Zyngier
2020-11-30 15:40       ` Marc Zyngier

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=4a398347b173c5c1a7a0ebd4b54a64bd@kernel.org \
    --to=maz@kernel.org \
    --cc=dbrazdil@google.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=will@kernel.org \
    /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.