aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d6351a34b297..4901ec5061ba 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -834,7 +834,7 @@ EXPORT_SYMBOL_GPL(kvm_is_error_hva);
834struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *kvm, gfn_t gfn) 834struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *kvm, gfn_t gfn)
835{ 835{
836 int i; 836 int i;
837 struct kvm_memslots *slots = rcu_dereference(kvm->memslots); 837 struct kvm_memslots *slots = kvm_memslots(kvm);
838 838
839 for (i = 0; i < slots->nmemslots; ++i) { 839 for (i = 0; i < slots->nmemslots; ++i) {
840 struct kvm_memory_slot *memslot = &slots->memslots[i]; 840 struct kvm_memory_slot *memslot = &slots->memslots[i];
@@ -856,7 +856,7 @@ struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn)
856int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn) 856int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
857{ 857{
858 int i; 858 int i;
859 struct kvm_memslots *slots = rcu_dereference(kvm->memslots); 859 struct kvm_memslots *slots = kvm_memslots(kvm);
860 860
861 gfn = unalias_gfn_instantiation(kvm, gfn); 861 gfn = unalias_gfn_instantiation(kvm, gfn);
862 for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { 862 for (i = 0; i < KVM_MEMORY_SLOTS; ++i) {
@@ -900,7 +900,7 @@ out:
900int memslot_id(struct kvm *kvm, gfn_t gfn) 900int memslot_id(struct kvm *kvm, gfn_t gfn)
901{ 901{
902 int i; 902 int i;
903 struct kvm_memslots *slots = rcu_dereference(kvm->memslots); 903 struct kvm_memslots *slots = kvm_memslots(kvm);
904 struct kvm_memory_slot *memslot = NULL; 904 struct kvm_memory_slot *memslot = NULL;
905 905
906 gfn = unalias_gfn(kvm, gfn); 906 gfn = unalias_gfn(kvm, gfn);
@@ -1994,7 +1994,9 @@ int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
1994 int len, const void *val) 1994 int len, const void *val)
1995{ 1995{
1996 int i; 1996 int i;
1997 struct kvm_io_bus *bus = rcu_dereference(kvm->buses[bus_idx]); 1997 struct kvm_io_bus *bus;
1998
1999 bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
1998 for (i = 0; i < bus->dev_count; i++) 2000 for (i = 0; i < bus->dev_count; i++)
1999 if (!kvm_iodevice_write(bus->devs[i], addr, len, val)) 2001 if (!kvm_iodevice_write(bus->devs[i], addr, len, val))
2000 return 0; 2002 return 0;
@@ -2006,8 +2008,9 @@ int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
2006 int len, void *val) 2008 int len, void *val)
2007{ 2009{
2008 int i; 2010 int i;
2009 struct kvm_io_bus *bus = rcu_dereference(kvm->buses[bus_idx]); 2011 struct kvm_io_bus *bus;
2010 2012
2013 bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
2011 for (i = 0; i < bus->dev_count; i++) 2014 for (i = 0; i < bus->dev_count; i++)
2012 if (!kvm_iodevice_read(bus->devs[i], addr, len, val)) 2015 if (!kvm_iodevice_read(bus->devs[i], addr, len, val))
2013 return 0; 2016 return 0;