aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2013-04-25 10:11:24 -0400
committerAlexander Graf <agraf@suse.de>2013-04-26 14:27:28 -0400
commit91194919a6b07d70081fe185a79b129efee84fff (patch)
treeaa4b2df5f59b5965777dadc08373727aa753f992 /arch/powerpc/kvm
parent07f0a7bdec5c4039cfb9b836482c45004d4c21cc (diff)
kvm/ppc/mpic: Eliminate mmio_mapped
We no longer need to keep track of this now that MPIC destruction always happens either during VM destruction (after MMIO has been destroyed) or during a failed creation (before the fd has been exposed to userspace, and thus before the MMIO region could have been registered). Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/mpic.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index 795ca0c9ae69..f3148f8cdc12 100644
--- a/arch/powerpc/kvm/mpic.c
+++ b/arch/powerpc/kvm/mpic.c
@@ -190,7 +190,6 @@ struct openpic {
190 struct kvm_io_device mmio; 190 struct kvm_io_device mmio;
191 struct list_head mmio_regions; 191 struct list_head mmio_regions;
192 atomic_t users; 192 atomic_t users;
193 bool mmio_mapped;
194 193
195 gpa_t reg_base; 194 gpa_t reg_base;
196 spinlock_t lock; 195 spinlock_t lock;
@@ -1428,24 +1427,13 @@ static int kvm_mpic_write(struct kvm_io_device *this, gpa_t addr,
1428 return ret; 1427 return ret;
1429} 1428}
1430 1429
1431static void kvm_mpic_dtor(struct kvm_io_device *this)
1432{
1433 struct openpic *opp = container_of(this, struct openpic, mmio);
1434
1435 opp->mmio_mapped = false;
1436}
1437
1438static const struct kvm_io_device_ops mpic_mmio_ops = { 1430static const struct kvm_io_device_ops mpic_mmio_ops = {
1439 .read = kvm_mpic_read, 1431 .read = kvm_mpic_read,
1440 .write = kvm_mpic_write, 1432 .write = kvm_mpic_write,
1441 .destructor = kvm_mpic_dtor,
1442}; 1433};
1443 1434
1444static void map_mmio(struct openpic *opp) 1435static void map_mmio(struct openpic *opp)
1445{ 1436{
1446 BUG_ON(opp->mmio_mapped);
1447 opp->mmio_mapped = true;
1448
1449 kvm_iodevice_init(&opp->mmio, &mpic_mmio_ops); 1437 kvm_iodevice_init(&opp->mmio, &mpic_mmio_ops);
1450 1438
1451 kvm_io_bus_register_dev(opp->kvm, KVM_MMIO_BUS, 1439 kvm_io_bus_register_dev(opp->kvm, KVM_MMIO_BUS,
@@ -1455,10 +1443,7 @@ static void map_mmio(struct openpic *opp)
1455 1443
1456static void unmap_mmio(struct openpic *opp) 1444static void unmap_mmio(struct openpic *opp)
1457{ 1445{
1458 if (opp->mmio_mapped) { 1446 kvm_io_bus_unregister_dev(opp->kvm, KVM_MMIO_BUS, &opp->mmio);
1459 opp->mmio_mapped = false;
1460 kvm_io_bus_unregister_dev(opp->kvm, KVM_MMIO_BUS, &opp->mmio);
1461 }
1462} 1447}
1463 1448
1464static int set_base_addr(struct openpic *opp, struct kvm_device_attr *attr) 1449static int set_base_addr(struct openpic *opp, struct kvm_device_attr *attr)
@@ -1637,18 +1622,6 @@ static void mpic_destroy(struct kvm_device *dev)
1637{ 1622{
1638 struct openpic *opp = dev->private; 1623 struct openpic *opp = dev->private;
1639 1624
1640 if (opp->mmio_mapped) {
1641 /*
1642 * Normally we get unmapped by kvm_io_bus_destroy(),
1643 * which happens before the VCPUs release their references.
1644 *
1645 * Thus, we should only get here if no VCPUs took a reference
1646 * to us in the first place.
1647 */
1648 WARN_ON(opp->nb_cpus != 0);
1649 unmap_mmio(opp);
1650 }
1651
1652 dev->kvm->arch.mpic = NULL; 1625 dev->kvm->arch.mpic = NULL;
1653 kfree(opp); 1626 kfree(opp);
1654} 1627}