Graphics workaround for AMD IOMMU systems

Joerg Roedel joerg.roedel at amd.com
Mon Jun 15 03:08:25 PDT 2009


On Sat, Jun 13, 2009 at 04:01:30PM -0700, Chris Wright wrote:
> * Joerg Roedel (joro at 8bytes.org) wrote:
> > On Fri, Jun 12, 2009 at 12:28:02PM -0700, Chris Wright wrote:
> > > * Bhavna Sarathy (bnagendr at redhat.com) wrote:
> > > > +#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
> > > 
> > > I think this is too permissive for upstream, and a blacklist would
> > > be better.  So more like:
> > 
> > Better would be if there were no workaround at all for this. Not for
> > VT-d and not for AMD IOMMU. But VT-d has it upstream and it doesn't look
> > like it will be removed anytime soon. This somehow forces such a nasty
> > workaround for AMD IOMMU in upstream code too :-(
> 
> I agree, it's nasty, you don't have to take it ;-)  I'm just looking for
> a way to  limit the damage if you want to accept a work around.

Having no one at all is also no way to go in this situation :)

> > > static const struct pci_device_id pci_broken_gfx_ids[] = {
> > > 	/* Add your favorite busted card here */	
> > > 	{ } /* terminate list */
> > > };
> > > 
> > > static inline bool is_broken_gfx_device(struct pci_device *pdev)
> > > {
> > > 	struct pci_device_id *broken = NULL
> > > 
> > > 	broken = pci_id_match(pci_broken_gfx_ids, pdev);
> > > 	WARN(broken, "IOMMU: graphics device %s is broken with IOMMU, "
> > > 		     "disabling IOMMU protection for this device\n", 
> > > 		     pci_name(pdev));
> > > 	return !!broken;
> > > }
> > > 
> > > This should be sharable between VT-d and AMD IOMMU.
> > 
> > I think its better to match against the driver name instead of device
> > ids because we only need this for crappy drivers.
> 
> Ah, you mean for devices where there's a reasonably functional open
> source driver as well as a busted proprietary driver?  Makes sense.

Yes, somehow this way. Current idea is to count the dma-mappings per
dma_ops domain to make sure there are no mappings pending when a broken
driver binds to the gfx device. Then we could check in the driver bind
path for the driver names on the blacklist and put the device into a
direct mapped domain if there are no mappings pending for the device.

	Joerg

-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632



More information about the iommu mailing list