On 2020-11-05 22:44, Will Deacon wrote:
+ if (csv2 > vcpu->kvm->arch.pfr0_csv2)
+ return -EINVAL;
+ vcpu->kvm->arch.pfr0_csv2 = csv2;
+
+ /* This is what we mean by invariant: you can't change it. */
+ if (val != read_id_reg(vcpu, rd, false))
+ return -EINVAL;
I think it's quite confusing to return -EINVAL in the case that we have
actually updated arch.pfr0_csv2, as it's indistinguishable from the
case
when csv2 was invalid and the field wasn't updated.
-EINVAL is the right error code here (you're setting an invalid value
for
the whole register). The bug is that we have now changed CSV2 for
everyone.
I'll have a look at fixing this, though it might involve some locking.
M.
--
Jazz is not dead. It just smells funny...