public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/13] iommu coherency
@ 2008-12-02 14:22 Han, Weidong
  2008-12-04 17:12 ` Mark McLoughlin
  0 siblings, 1 reply; 3+ messages in thread
From: Han, Weidong @ 2008-12-02 14:22 UTC (permalink / raw)
  To: 'Avi Kivity', Woodhouse, David, 'Jesse Barnes'
  Cc: 'Joerg Roedel', Kay, Allen M, Yu, Fenghua,
	'kvm@vger.kernel.org',
	'iommu@lists.linux-foundation.org'

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

in dmar_domain, more than one iommus may be included in iommu_bmp. Due to "Coherency" capability may be different across iommus, set this variable to indicate iommu access is coherent or not. Only when all related iommus in a dmar_domain are all coherent, iommu access of this domain is coherent.

Signed-off-by: Weidong Han <weidong.han@intel.com>
---
 drivers/pci/intel-iommu.c     |    6 ++++++
 include/linux/dma_remapping.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index a18e0b4..fa1507b 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -982,6 +982,12 @@ static struct dmar_domain * iommu_alloc_domain(struct intel_iommu *iommu)
 	domain->id = num;
 	memset(&domain->iommu_bmp, 0, sizeof(unsigned long));
 	set_bit(iommu->seq_id, &domain->iommu_bmp);
+
+	if (ecap_coherent(iommu->ecap))
+		domain->iommu_coherency = 1;
+	else
+		domain->iommu_coherency = 0;
+
 	iommu->domains[num] = domain;
 	spin_unlock_irqrestore(&iommu->lock, flags);
 
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index c9d99c9..add2111 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -175,6 +175,8 @@ struct dmar_domain {
 
 #define DOMAIN_FLAG_MULTIPLE_DEVICES 1
 	int		flags;
+
+	int		iommu_coherency;/* iommu access is coherent or not */
 };
 
 /* PCI domain-device relationship */
-- 
1.5.1

[-- Attachment #2: 0004-iommu-coherency.patch --]
[-- Type: application/octet-stream, Size: 1634 bytes --]

From 306ef75fd396827592b823822da81568fe7dfc0b Mon Sep 17 00:00:00 2001
From: Weidong Han <weidong.han@intel.com>
Date: Tue, 2 Dec 2008 14:20:42 +0800
Subject: [PATCH] iommu coherency

in dmar_domain, more than one iommus may be included in iommu_bmp. Due to "Coherency" capability may be different across iommus, set this variable to indicate iommu access is coherent or not. Only when all related iommus in a dmar_domain are all coherent, iommu access of this domain is coherent.

Signed-off-by: Weidong Han <weidong.han@intel.com>
---
 drivers/pci/intel-iommu.c     |    6 ++++++
 include/linux/dma_remapping.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index a18e0b4..fa1507b 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -982,6 +982,12 @@ static struct dmar_domain * iommu_alloc_domain(struct intel_iommu *iommu)
 	domain->id = num;
 	memset(&domain->iommu_bmp, 0, sizeof(unsigned long));
 	set_bit(iommu->seq_id, &domain->iommu_bmp);
+
+	if (ecap_coherent(iommu->ecap))
+		domain->iommu_coherency = 1;
+	else
+		domain->iommu_coherency = 0;
+
 	iommu->domains[num] = domain;
 	spin_unlock_irqrestore(&iommu->lock, flags);
 
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index c9d99c9..add2111 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -175,6 +175,8 @@ struct dmar_domain {
 
 #define DOMAIN_FLAG_MULTIPLE_DEVICES 1
 	int		flags;
+
+	int		iommu_coherency;/* iommu access is coherent or not */
 };
 
 /* PCI domain-device relationship */
-- 
1.5.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-05  1:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 14:22 [PATCH 04/13] iommu coherency Han, Weidong
2008-12-04 17:12 ` Mark McLoughlin
2008-12-05  1:00   ` Han, Weidong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox