From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: [PATCH 07/13] add domain_flush_cache Date: Thu, 04 Dec 2008 17:12:57 +0000 Message-ID: <1228410777.3732.142.camel@blaa> References: <715D42877B251141A38726ABF5CABF2C018BF0598D@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]:35323 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753232AbYLDRO3 (ORCPT ); Thu, 4 Dec 2008 12:14:29 -0500 In-Reply-To: <715D42877B251141A38726ABF5CABF2C018BF0598D@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: > For some common low level functions which will be also used by virtual > machine usage, use domain_flush_cache instead of __iommu_flush_cache. > > Signed-off-by: Weidong Han > --- > drivers/pci/intel-iommu.c | 40 ++++++++++++++++++++++++---------------- > 1 files changed, 24 insertions(+), 16 deletions(-) > > diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c > index 429aff4..b00a8f2 100644 > --- a/drivers/pci/intel-iommu.c > +++ b/drivers/pci/intel-iommu.c > @@ -200,6 +200,13 @@ static struct intel_iommu *domain_get_iommu(struct dmar_domain *domain) > return NULL; > } > > +static void domain_flush_cache(struct dmar_domain *domain, > + void *addr, int size) > +{ > + if (!domain->iommu_coherency) > + clflush_cache_range(addr, size); > +} This is quite unfortunate; __iommu_flush_cache() is essentially identical: static inline void __iommu_flush_cache( struct intel_iommu *iommu, void *addr, int size) { if (!ecap_coherent(iommu->ecap)) clflush_cache_range(addr, size); } Is there no way we can use a single function for both purposes? Cheers, Mark.