From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: [PATCH 08/13] allocation and free functions of virtual machine domain Date: Thu, 04 Dec 2008 17:13:00 +0000 Message-ID: <1228410780.3732.143.camel@blaa> References: <715D42877B251141A38726ABF5CABF2C018BF0598E@pdsmsx503.ccr.corp.intel.com> Reply-To: Mark McLoughlin Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: "'Avi Kivity'" , "Woodhouse, David" , "'Jesse Barnes'" , "Yu, Fenghua" , "'iommu@lists.linux-foundation.org'" , "'kvm@vger.kernel.org'" To: "Han, Weidong" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:35327 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753239AbYLDROd (ORCPT ); Thu, 4 Dec 2008 12:14:33 -0500 In-Reply-To: <715D42877B251141A38726ABF5CABF2C018BF0598E@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2008-12-02 at 22:22 +0800, Han, Weidong wrote: > Signed-off-by: Weidong Han > --- > drivers/pci/intel-iommu.c | 104 ++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 103 insertions(+), 1 deletions(-) > > diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c > index b00a8f2..e96b3bc 100644 > --- a/drivers/pci/intel-iommu.c > +++ b/drivers/pci/intel-iommu.c > @@ -947,6 +947,7 @@ static int iommu_init_domains(struct intel_iommu *iommu) > > > static void domain_exit(struct dmar_domain *domain); > +static void vm_domain_exit(struct dmar_domain *domain); > > void free_dmar_iommu(struct intel_iommu *iommu) > { > @@ -957,8 +958,13 @@ void free_dmar_iommu(struct intel_iommu *iommu) > for (; i < cap_ndoms(iommu->cap); ) { > domain = iommu->domains[i]; > clear_bit(i, iommu->domain_ids); > - if (--domain->iommu_count == 0) > + > + if (domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) { > + if (--domain->iommu_count == 0) > + vm_domain_exit(domain); > + } else > domain_exit(domain); > + Again, these new functions are copies of existing code with minor modifications. I'd much rather see the existing code refactored and then modified to handle the DOMAIN_FLAG_VIRTUAL_MACHINE case. Cheers, Mark.