I agree, I will fix it.
On 03/20/2018 06:58 PM, Tony Krowiak wrote:
I spoke with Christian this morning and he made a suggestion which I think would provide the best solution here.There is one thing you missed, otherwise I'm *very* satisfied with this
This is my proposal:
1. Get rid of the KVM_S390_VM_CRYPTO_INTERPRET_AP device attribute and return to setting ECA.28 from the
mdev device open callback.
2. Since there may be vcpus online at the time the mdev device open is called, we must first take all running vcpus out of
SIE and block them. Christian suggested the kvm_s390_vcpu_block_all(struct kvm *kvm) function will do the trick. So I
propose introducing a function like the following to be called during mdev open:
proposal.
What you have missed IMHO is vcpu hottplug. So IMHO you should keep
kvm->arch.crypto.apie, and update it accordingly ...
Yep
int kvm_ap_set_interpretive_exec(struct kvm *kvm, bool enable)... let's say here.
{
int i;
struct kvm_vcpu *vcpu;
if (!test_kvm_cpu_feat(kvm, KVM_S390_VM_CPU_FEAT_AP))
return -EOPNOTSUPP;
mutex_lock(&kvm->lock);
kvm_s390_vcpu_block_all(kvm);
Sounds good to me.
kvm_for_each_vcpu(i, vcpu, kvm) {And here you can call kvm_s390_vcpu_crypto_setup(vcpu) (the changes to
this function will be required for hotplug) if you like
I'll call the kvm_s390_vcpu_crypto_setup(vcpu) to set ECA_APIE.
if (enable)or keep this stuff, it does not really matter to me.
vcpu->arch.sie_block->eca |= ECA_APIE;
else
vcpu->arch.sie_block->eca &= ~ECA_APIE;
That will no longer be a part of this patch series. We can revisit that as
}I tend to agree. I will give it a proper review when this gets more
kvm_s390_vcpu_unblock_all(kvm);
mutex_unlock(&kvm->lock);
return 0;
}
This interface allows us to set ECA.28 even if vcpus are running
formal (e.g. v4 (preferably) or patches to be fixed up to this series).
Please don't forget to revisit the discussion on kvm_s390_vm_set_crypto:
if the mechanism there isn't right for ECA.28 I think you should tell
us why it's OK for the other attributes if it's OK. If it is not then
I guess you will want to do a stand alone patch for that.