From patchwork Fri Apr 26 00:11:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 2490451 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DF2A03FC64 for ; Fri, 26 Apr 2013 00:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932440Ab3DZALy (ORCPT ); Thu, 25 Apr 2013 20:11:54 -0400 Received: from ch1ehsobe006.messaging.microsoft.com ([216.32.181.186]:32982 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758367Ab3DZALx (ORCPT ); Thu, 25 Apr 2013 20:11:53 -0400 Received: from mail68-ch1-R.bigfish.com (10.43.68.243) by CH1EHSOBE003.bigfish.com (10.43.70.53) with Microsoft SMTP Server id 14.1.225.23; Fri, 26 Apr 2013 00:11:52 +0000 Received: from mail68-ch1 (localhost [127.0.0.1]) by mail68-ch1-R.bigfish.com (Postfix) with ESMTP id 381453E0573; Fri, 26 Apr 2013 00:11:52 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1155h) Received: from mail68-ch1 (localhost.localdomain [127.0.0.1]) by mail68-ch1 (MessageSwitch) id 1366935090248899_9460; Fri, 26 Apr 2013 00:11:30 +0000 (UTC) Received: from CH1EHSMHS015.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.242]) by mail68-ch1.bigfish.com (Postfix) with ESMTP id 30C1FC004B; Fri, 26 Apr 2013 00:11:30 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS015.bigfish.com (10.43.70.15) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 26 Apr 2013 00:11:28 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Fri, 26 Apr 2013 00:11:27 +0000 Received: from snotra.am.freescale.net ([10.214.83.91]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r3Q0BPnw031916; Thu, 25 Apr 2013 17:11:26 -0700 From: Scott Wood To: Alexander Graf CC: , , Scott Wood Subject: [PATCH 2/2] kvm/ppc/mpic: Eliminate mmio_mapped Date: Thu, 25 Apr 2013 19:11:24 -0500 Message-ID: <1366935084-20561-2-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366935084-20561-1-git-send-email-scottwood@freescale.com> References: <1366935084-20561-1-git-send-email-scottwood@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- arch/powerpc/kvm/mpic.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c index 4ac98d1..84e828e 100644 --- a/arch/powerpc/kvm/mpic.c +++ b/arch/powerpc/kvm/mpic.c @@ -190,7 +190,6 @@ struct openpic { struct kvm_io_device mmio; struct list_head mmio_regions; atomic_t users; - bool mmio_mapped; gpa_t reg_base; spinlock_t lock; @@ -1427,24 +1426,13 @@ static int kvm_mpic_write(struct kvm_io_device *this, gpa_t addr, return ret; } -static void kvm_mpic_dtor(struct kvm_io_device *this) -{ - struct openpic *opp = container_of(this, struct openpic, mmio); - - opp->mmio_mapped = false; -} - static const struct kvm_io_device_ops mpic_mmio_ops = { .read = kvm_mpic_read, .write = kvm_mpic_write, - .destructor = kvm_mpic_dtor, }; static void map_mmio(struct openpic *opp) { - BUG_ON(opp->mmio_mapped); - opp->mmio_mapped = true; - kvm_iodevice_init(&opp->mmio, &mpic_mmio_ops); kvm_io_bus_register_dev(opp->kvm, KVM_MMIO_BUS, @@ -1454,10 +1442,7 @@ static void map_mmio(struct openpic *opp) static void unmap_mmio(struct openpic *opp) { - if (opp->mmio_mapped) { - opp->mmio_mapped = false; - kvm_io_bus_unregister_dev(opp->kvm, KVM_MMIO_BUS, &opp->mmio); - } + kvm_io_bus_unregister_dev(opp->kvm, KVM_MMIO_BUS, &opp->mmio); } static int set_base_addr(struct openpic *opp, struct kvm_device_attr *attr) @@ -1636,18 +1621,6 @@ static void mpic_destroy(struct kvm_device *dev) { struct openpic *opp = dev->private; - if (opp->mmio_mapped) { - /* - * Normally we get unmapped by kvm_io_bus_destroy(), - * which happens before the VCPUs release their references. - * - * Thus, we should only get here if no VCPUs took a reference - * to us in the first place. - */ - WARN_ON(opp->nb_cpus != 0); - unmap_mmio(opp); - } - dev->kvm->arch.mpic = NULL; kfree(opp); }