KVM: arm/arm64: VGIC/ITS save/restore: protect kvm_read_guest() calls

kvm_read_guest() will eventually look up in kvm_memslots(), which requires
either to hold the kvm->slots_lock or to be inside a kvm->srcu critical
section.
In contrast to x86 and s390 we don't take the SRCU lock on every guest
exit, so we have to do it individually for each kvm_read_guest() call.
Use the newly introduced wrapper for that.

Cc: Stable <stable@vger.kernel.org> # 4.12+
Reported-by: Jan Glauber <jan.glauber@caviumnetworks.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by Andre Przywara and committed by Paolo Bonzini 711702b5 bf308242

+4 -4
+2 -2
virt/kvm/arm/vgic/vgic-its.c
··· 1897 int next_offset; 1898 size_t byte_offset; 1899 1900 - ret = kvm_read_guest(kvm, gpa, entry, esz); 1901 if (ret) 1902 return ret; 1903 ··· 2267 int ret; 2268 2269 BUG_ON(esz > sizeof(val)); 2270 - ret = kvm_read_guest(kvm, gpa, &val, esz); 2271 if (ret) 2272 return ret; 2273 val = le64_to_cpu(val);
··· 1897 int next_offset; 1898 size_t byte_offset; 1899 1900 + ret = kvm_read_guest_lock(kvm, gpa, entry, esz); 1901 if (ret) 1902 return ret; 1903 ··· 2267 int ret; 2268 2269 BUG_ON(esz > sizeof(val)); 2270 + ret = kvm_read_guest_lock(kvm, gpa, &val, esz); 2271 if (ret) 2272 return ret; 2273 val = le64_to_cpu(val);
+2 -2
virt/kvm/arm/vgic/vgic-v3.c
··· 344 bit_nr = irq->intid % BITS_PER_BYTE; 345 ptr = pendbase + byte_offset; 346 347 - ret = kvm_read_guest(kvm, ptr, &val, 1); 348 if (ret) 349 return ret; 350 ··· 397 ptr = pendbase + byte_offset; 398 399 if (byte_offset != last_byte_offset) { 400 - ret = kvm_read_guest(kvm, ptr, &val, 1); 401 if (ret) 402 return ret; 403 last_byte_offset = byte_offset;
··· 344 bit_nr = irq->intid % BITS_PER_BYTE; 345 ptr = pendbase + byte_offset; 346 347 + ret = kvm_read_guest_lock(kvm, ptr, &val, 1); 348 if (ret) 349 return ret; 350 ··· 397 ptr = pendbase + byte_offset; 398 399 if (byte_offset != last_byte_offset) { 400 + ret = kvm_read_guest_lock(kvm, ptr, &val, 1); 401 if (ret) 402 return ret; 403 last_byte_offset = byte_offset;