public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] 2.6.34: simple IOMMU API extension to check safe interrupt remapping
@ 2010-07-01 21:24 Tom Lyon
  2010-07-02  9:26 ` Roedel, Joerg
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Lyon @ 2010-07-01 21:24 UTC (permalink / raw)
  To: linux-kernel, kvm, iommu, chrisw, mst, dwmw2, joerg.roedel
  Cc: aafabbri, scofeldm

This patch allows IOMMU users to determine whether the hardware and software
support safe, isolated interrupt remapping.  Not all Intel IOMMUs have the
hardware, and the software for AMD is not there yet.
	Signed-off-by: Tom Lyon <pugs@cisco.com>
---

Version 2: previous ifdefs not needed.

MST has convinced me that any user level driver for PCI master devices can't 
be safe unless there is an IOMMU protecting the APIC MSI/MSI-X interrupt 
addresses from device writes.  This interrupt remapping is not present in all
Intel IOMMUs and the code for the interrupt mapping in the AMD IOMMUs is not
implemented yet.

Needed by not-yet-accepted VFIO driver.

diff -uprN linux-2.6.34/drivers/pci/intel-iommu.c iommuapi-linux-2.6.34/drivers/pci/intel-iommu.c
--- linux-2.6.34/drivers/pci/intel-iommu.c	2010-05-16 14:17:36.000000000 -0700
+++ iommuapi-linux-2.6.34/drivers/pci/intel-iommu.c	2010-06-30 15:47:10.000000000 -0700
@@ -3705,6 +3705,10 @@ static int intel_iommu_domain_has_cap(st
 
 	if (cap == IOMMU_CAP_CACHE_COHERENCY)
 		return dmar_domain->iommu_snooping;
+	if (cap == IOMMU_CAP_SAFE_INTR_REMAP)
+		return intr_remapping_enabled;
 
 	return 0;
 }
diff -uprN linux-2.6.34/include/linux/iommu.h iommuapi-linux-2.6.34/include/linux/iommu.h
--- linux-2.6.34/include/linux/iommu.h	2010-05-16 14:17:36.000000000 -0700
+++ iommuapi-linux-2.6.34/include/linux/iommu.h	2010-06-30 15:47:34.000000000 -0700
@@ -30,6 +30,7 @@ struct iommu_domain {
 };
 
 #define IOMMU_CAP_CACHE_COHERENCY	0x1
+#define IOMMU_CAP_SAFE_INTR_REMAP	0x2	/* isolates device intrs */
 
 struct iommu_ops {
 	int (*domain_init)(struct iommu_domain *domain);

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

* Re: [PATCH V2] 2.6.34: simple IOMMU API extension to check safe interrupt remapping
  2010-07-01 21:24 [PATCH V2] 2.6.34: simple IOMMU API extension to check safe interrupt remapping Tom Lyon
@ 2010-07-02  9:26 ` Roedel, Joerg
  2010-07-02 19:33   ` Tom Lyon
  0 siblings, 1 reply; 3+ messages in thread
From: Roedel, Joerg @ 2010-07-02  9:26 UTC (permalink / raw)
  To: Tom Lyon
  Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	iommu@lists.linux-foundation.org, chrisw@sous-sol.org,
	mst@redhat.com, dwmw2@infradead.org, aafabbri@cisco.com,
	scofeldm@cisco.com

On Thu, Jul 01, 2010 at 05:24:32PM -0400, Tom Lyon wrote:
> This patch allows IOMMU users to determine whether the hardware and software
> support safe, isolated interrupt remapping.  Not all Intel IOMMUs have the
> hardware, and the software for AMD is not there yet.
> 	Signed-off-by: Tom Lyon <pugs@cisco.com>

It does not make a lot of sense to check for this feature in the
IOMMU-API currently because there is no support for intr-remapping in
there. But it will be there when intr-remapping support for AMD IOMMU is
implemented. So this change can be considered as a first step in that
direction. Please repost with the change requested below an I'll add
this one to my tree.

> Version 2: previous ifdefs not needed.
> 
> MST has convinced me that any user level driver for PCI master devices can't 
> be safe unless there is an IOMMU protecting the APIC MSI/MSI-X interrupt 
> addresses from device writes.  This interrupt remapping is not present in all
> Intel IOMMUs and the code for the interrupt mapping in the AMD IOMMUs is not
> implemented yet.
> 
> Needed by not-yet-accepted VFIO driver.
> 
> diff -uprN linux-2.6.34/drivers/pci/intel-iommu.c iommuapi-linux-2.6.34/drivers/pci/intel-iommu.c
> --- linux-2.6.34/drivers/pci/intel-iommu.c	2010-05-16 14:17:36.000000000 -0700
> +++ iommuapi-linux-2.6.34/drivers/pci/intel-iommu.c	2010-06-30 15:47:10.000000000 -0700
> @@ -3705,6 +3705,10 @@ static int intel_iommu_domain_has_cap(st
>  
>  	if (cap == IOMMU_CAP_CACHE_COHERENCY)
>  		return dmar_domain->iommu_snooping;
> +	if (cap == IOMMU_CAP_SAFE_INTR_REMAP)
> +		return intr_remapping_enabled;
>  
>  	return 0;
>  }
> diff -uprN linux-2.6.34/include/linux/iommu.h iommuapi-linux-2.6.34/include/linux/iommu.h
> --- linux-2.6.34/include/linux/iommu.h	2010-05-16 14:17:36.000000000 -0700
> +++ iommuapi-linux-2.6.34/include/linux/iommu.h	2010-06-30 15:47:34.000000000 -0700
> @@ -30,6 +30,7 @@ struct iommu_domain {
>  };
>  
>  #define IOMMU_CAP_CACHE_COHERENCY	0x1
> +#define IOMMU_CAP_SAFE_INTR_REMAP	0x2	/* isolates device intrs */

I think the SAFE_ is not necessary in the name. It is misleading because
it indicates that there is an unsafe variant of intr-remapping available
when this capability is not set. Just call it IOMMU_CAP_INTR_REMAPPING.


	Joerg

-- 
Joerg Roedel - AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


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

* Re: [PATCH V2] 2.6.34: simple IOMMU API extension to check safe interrupt remapping
  2010-07-02  9:26 ` Roedel, Joerg
@ 2010-07-02 19:33   ` Tom Lyon
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Lyon @ 2010-07-02 19:33 UTC (permalink / raw)
  To: Roedel, Joerg
  Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	iommu@lists.linux-foundation.org, chrisw@sous-sol.org,
	mst@redhat.com, dwmw2@infradead.org, aafabbri@cisco.com,
	scofeldm@cisco.com

On Friday 02 July 2010 02:26:46 am Roedel, Joerg wrote:
> On Thu, Jul 01, 2010 at 05:24:32PM -0400, Tom Lyon wrote:
> > This patch allows IOMMU users to determine whether the hardware and software
> > support safe, isolated interrupt remapping.  Not all Intel IOMMUs have the
> > hardware, and the software for AMD is not there yet.
> > 	Signed-off-by: Tom Lyon <pugs@cisco.com>
> 
> It does not make a lot of sense to check for this feature in the
> IOMMU-API currently because there is no support for intr-remapping in
> there. But it will be there when intr-remapping support for AMD IOMMU is
> implemented. So this change can be considered as a first step in that
> direction. Please repost with the change requested below an I'll add
> this one to my tree.
OK, but I'm not sure what you mean by the first sentence.  The Intel stuff
today does intr remapping as a side effect of X2APIC support.

> 
> > Version 2: previous ifdefs not needed.
> > 
> > MST has convinced me that any user level driver for PCI master devices can't 
> > be safe unless there is an IOMMU protecting the APIC MSI/MSI-X interrupt 
> > addresses from device writes.  This interrupt remapping is not present in all
> > Intel IOMMUs and the code for the interrupt mapping in the AMD IOMMUs is not
> > implemented yet.
> > 
> > Needed by not-yet-accepted VFIO driver.
> > 
> > diff -uprN linux-2.6.34/drivers/pci/intel-iommu.c iommuapi-linux-2.6.34/drivers/pci/intel-iommu.c
> > --- linux-2.6.34/drivers/pci/intel-iommu.c	2010-05-16 14:17:36.000000000 -0700
> > +++ iommuapi-linux-2.6.34/drivers/pci/intel-iommu.c	2010-06-30 15:47:10.000000000 -0700
> > @@ -3705,6 +3705,10 @@ static int intel_iommu_domain_has_cap(st
> >  
> >  	if (cap == IOMMU_CAP_CACHE_COHERENCY)
> >  		return dmar_domain->iommu_snooping;
> > +	if (cap == IOMMU_CAP_SAFE_INTR_REMAP)
> > +		return intr_remapping_enabled;
> >  
> >  	return 0;
> >  }
> > diff -uprN linux-2.6.34/include/linux/iommu.h iommuapi-linux-2.6.34/include/linux/iommu.h
> > --- linux-2.6.34/include/linux/iommu.h	2010-05-16 14:17:36.000000000 -0700
> > +++ iommuapi-linux-2.6.34/include/linux/iommu.h	2010-06-30 15:47:34.000000000 -0700
> > @@ -30,6 +30,7 @@ struct iommu_domain {
> >  };
> >  
> >  #define IOMMU_CAP_CACHE_COHERENCY	0x1
> > +#define IOMMU_CAP_SAFE_INTR_REMAP	0x2	/* isolates device intrs */
> 
> I think the SAFE_ is not necessary in the name. It is misleading because
> it indicates that there is an unsafe variant of intr-remapping available
> when this capability is not set. Just call it IOMMU_CAP_INTR_REMAPPING.
> 
> 
> 	Joerg
> 



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

end of thread, other threads:[~2010-07-02 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-01 21:24 [PATCH V2] 2.6.34: simple IOMMU API extension to check safe interrupt remapping Tom Lyon
2010-07-02  9:26 ` Roedel, Joerg
2010-07-02 19:33   ` Tom Lyon

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