Commit ccc59f47 authored by Christian Borntraeger's avatar Christian Borntraeger

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
parents 962734fc 857b8de9
...@@ -1324,7 +1324,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) ...@@ -1324,7 +1324,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
{ {
uint8_t *keys; uint8_t *keys;
uint64_t hva; uint64_t hva;
int i, r = 0; int srcu_idx, i, r = 0;
if (args->flags != 0) if (args->flags != 0)
return -EINVAL; return -EINVAL;
...@@ -1342,6 +1342,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) ...@@ -1342,6 +1342,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
return -ENOMEM; return -ENOMEM;
down_read(&current->mm->mmap_sem); down_read(&current->mm->mmap_sem);
srcu_idx = srcu_read_lock(&kvm->srcu);
for (i = 0; i < args->count; i++) { for (i = 0; i < args->count; i++) {
hva = gfn_to_hva(kvm, args->start_gfn + i); hva = gfn_to_hva(kvm, args->start_gfn + i);
if (kvm_is_error_hva(hva)) { if (kvm_is_error_hva(hva)) {
...@@ -1353,6 +1354,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) ...@@ -1353,6 +1354,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
if (r) if (r)
break; break;
} }
srcu_read_unlock(&kvm->srcu, srcu_idx);
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
if (!r) { if (!r) {
...@@ -1370,7 +1372,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) ...@@ -1370,7 +1372,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
{ {
uint8_t *keys; uint8_t *keys;
uint64_t hva; uint64_t hva;
int i, r = 0; int srcu_idx, i, r = 0;
if (args->flags != 0) if (args->flags != 0)
return -EINVAL; return -EINVAL;
...@@ -1396,6 +1398,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) ...@@ -1396,6 +1398,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
goto out; goto out;
down_read(&current->mm->mmap_sem); down_read(&current->mm->mmap_sem);
srcu_idx = srcu_read_lock(&kvm->srcu);
for (i = 0; i < args->count; i++) { for (i = 0; i < args->count; i++) {
hva = gfn_to_hva(kvm, args->start_gfn + i); hva = gfn_to_hva(kvm, args->start_gfn + i);
if (kvm_is_error_hva(hva)) { if (kvm_is_error_hva(hva)) {
...@@ -1413,6 +1416,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) ...@@ -1413,6 +1416,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
if (r) if (r)
break; break;
} }
srcu_read_unlock(&kvm->srcu, srcu_idx);
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
out: out:
kvfree(keys); kvfree(keys);
......
...@@ -394,7 +394,7 @@ static int sthyi(u64 vaddr) ...@@ -394,7 +394,7 @@ static int sthyi(u64 vaddr)
"srl %[cc],28\n" "srl %[cc],28\n"
: [cc] "=d" (cc) : [cc] "=d" (cc)
: [code] "d" (code), [addr] "a" (addr) : [code] "d" (code), [addr] "a" (addr)
: "memory", "cc"); : "3", "memory", "cc");
return cc; return cc;
} }
...@@ -425,7 +425,7 @@ int handle_sthyi(struct kvm_vcpu *vcpu) ...@@ -425,7 +425,7 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
VCPU_EVENT(vcpu, 3, "STHYI: fc: %llu addr: 0x%016llx", code, addr); VCPU_EVENT(vcpu, 3, "STHYI: fc: %llu addr: 0x%016llx", code, addr);
trace_kvm_s390_handle_sthyi(vcpu, 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); return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
if (code & 0xffff) { if (code & 0xffff) {
...@@ -433,6 +433,9 @@ int handle_sthyi(struct kvm_vcpu *vcpu) ...@@ -433,6 +433,9 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
goto out; 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 * If the page has not yet been faulted in, we want to do that
* now and not after all the expensive calculations. * now and not after all the expensive calculations.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment