KVM: s390: two fixes for sthyi emulation

- missing inline assembly constraint
 - wrong exception handling
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJZmuHdAAoJEBF7vIC1phx8dWEP/ilr5tP0+NZ57kmBGn/7/BpB
 toAqU20MRDaXj2mGfHBy5VCF5LU1acZGIor9M51KXaruXOcI/qIubze86tLvv5xI
 ts0RDwaQLrSysFrTAsn1b1DXeOzy65ZN7gvWlWab9Wq9gCdPjDerPsZ4gM3Q+vyH
 NrPnwAVvlkC9KeiqQWBSXBdEGd7saL/FU1h2r1wnFk05/b5h8ktl73JGN1uq6WBc
 c0RdElRQ+sa24NX1rI2qScuwfwoZMUiIuIzEvWXURaKSDN9hLR8RXTE1tf4BU+Ix
 jxyWej1MbA/kjGzW83xaeWansPyT6AgLZjdLsFnC+JDo1Qa0fnPntlBcCkrdkbd7
 oRYbj/VUJs4vkng0L/rlL3RbPt2K5UvaaoRDmaNqQAUJHopo+yQv4WsrOXA9nuuB
 cf74CLUpCwZiiGLonVAnVKlVRhUsj/DuzRdi6AB0DgCgf4iX36rHjBaFVzLuUWTU
 DasqpaGIX8vPJ4CiYTnJP4wAXvDwY19vrBA3CIgjlkF3JkDuBOcYLc7KXdif5azr
 +puBufI//NoV9xVX2cAxtn/ouKdH6LUwXhTkVjARQuz+nugiJ+FyHodWK/TCO0kz
 D51/+oR5BvwWxxXmxW7jwQvxenNbv95HNo60Z+Nzg2UbpqE1AYYt9PppJ0QU0P4k
 Z6+PYE2fcY127lOliLqy
 =Vvs+
 -----END PGP SIGNATURE-----

Merge tag 'kvm-s390-master-4.13-2' into kvms390/next

Additional fixes on top of these two
 - missing inline assembly constraint
 - wrong exception handling

are necessary
This commit is contained in:
Christian Borntraeger 2017-08-28 13:46:32 +02:00
commit ccc59f47b6
2 changed files with 11 additions and 4 deletions

View File

@ -1324,7 +1324,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
{
uint8_t *keys;
uint64_t hva;
int i, r = 0;
int srcu_idx, i, r = 0;
if (args->flags != 0)
return -EINVAL;
@ -1342,6 +1342,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
return -ENOMEM;
down_read(&current->mm->mmap_sem);
srcu_idx = srcu_read_lock(&kvm->srcu);
for (i = 0; i < args->count; i++) {
hva = gfn_to_hva(kvm, args->start_gfn + i);
if (kvm_is_error_hva(hva)) {
@ -1353,6 +1354,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
if (r)
break;
}
srcu_read_unlock(&kvm->srcu, srcu_idx);
up_read(&current->mm->mmap_sem);
if (!r) {
@ -1370,7 +1372,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
{
uint8_t *keys;
uint64_t hva;
int i, r = 0;
int srcu_idx, i, r = 0;
if (args->flags != 0)
return -EINVAL;
@ -1396,6 +1398,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
goto out;
down_read(&current->mm->mmap_sem);
srcu_idx = srcu_read_lock(&kvm->srcu);
for (i = 0; i < args->count; i++) {
hva = gfn_to_hva(kvm, args->start_gfn + i);
if (kvm_is_error_hva(hva)) {
@ -1413,6 +1416,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
if (r)
break;
}
srcu_read_unlock(&kvm->srcu, srcu_idx);
up_read(&current->mm->mmap_sem);
out:
kvfree(keys);

View File

@ -394,7 +394,7 @@ static int sthyi(u64 vaddr)
"srl %[cc],28\n"
: [cc] "=d" (cc)
: [code] "d" (code), [addr] "a" (addr)
: "memory", "cc");
: "3", "memory", "cc");
return cc;
}
@ -425,7 +425,7 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
VCPU_EVENT(vcpu, 3, "STHYI: fc: %llu addr: 0x%016llx", code, addr);
trace_kvm_s390_handle_sthyi(vcpu, code, addr);
if (reg1 == reg2 || reg1 & 1 || reg2 & 1 || addr & ~PAGE_MASK)
if (reg1 == reg2 || reg1 & 1 || reg2 & 1)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
if (code & 0xffff) {
@ -433,6 +433,9 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
goto out;
}
if (addr & ~PAGE_MASK)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
/*
* If the page has not yet been faulted in, we want to do that
* now and not after all the expensive calculations.