aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/coalesced_mmio.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-12-23 11:35:26 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:45 -0500
commit79fac95ecfa3969aab8119d37ccd7226165f933a (patch)
tree4103169c7fd2b7fb1ba95dae2db6b3f365476b9d /virt/kvm/coalesced_mmio.c
parentf656ce0185cabbbb0cf96877306879661297c7ad (diff)
KVM: convert slots_lock to a mutex
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/coalesced_mmio.c')
-rw-r--r--virt/kvm/coalesced_mmio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index a736a93ca7b7..5de6594260cb 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -110,9 +110,9 @@ int kvm_coalesced_mmio_init(struct kvm *kvm)
110 dev->kvm = kvm; 110 dev->kvm = kvm;
111 kvm->coalesced_mmio_dev = dev; 111 kvm->coalesced_mmio_dev = dev;
112 112
113 down_write(&kvm->slots_lock); 113 mutex_lock(&kvm->slots_lock);
114 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &dev->dev); 114 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &dev->dev);
115 up_write(&kvm->slots_lock); 115 mutex_unlock(&kvm->slots_lock);
116 if (ret < 0) 116 if (ret < 0)
117 goto out_free_dev; 117 goto out_free_dev;
118 118
@@ -140,16 +140,16 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
140 if (dev == NULL) 140 if (dev == NULL)
141 return -EINVAL; 141 return -EINVAL;
142 142
143 down_write(&kvm->slots_lock); 143 mutex_lock(&kvm->slots_lock);
144 if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) { 144 if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) {
145 up_write(&kvm->slots_lock); 145 mutex_unlock(&kvm->slots_lock);
146 return -ENOBUFS; 146 return -ENOBUFS;
147 } 147 }
148 148
149 dev->zone[dev->nb_zones] = *zone; 149 dev->zone[dev->nb_zones] = *zone;
150 dev->nb_zones++; 150 dev->nb_zones++;
151 151
152 up_write(&kvm->slots_lock); 152 mutex_unlock(&kvm->slots_lock);
153 return 0; 153 return 0;
154} 154}
155 155
@@ -163,7 +163,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
163 if (dev == NULL) 163 if (dev == NULL)
164 return -EINVAL; 164 return -EINVAL;
165 165
166 down_write(&kvm->slots_lock); 166 mutex_lock(&kvm->slots_lock);
167 167
168 i = dev->nb_zones; 168 i = dev->nb_zones;
169 while(i) { 169 while(i) {
@@ -181,7 +181,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
181 i--; 181 i--;
182 } 182 }
183 183
184 up_write(&kvm->slots_lock); 184 mutex_unlock(&kvm->slots_lock);
185 185
186 return 0; 186 return 0;
187} 187}