[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] FIXME question



Hi,

When I read IOMMU code,
In xen/drivers/passthrough/vtd/intremap.c : pi_update_irte()..
There are a FIXME --
''
* FIXME: For performance reasons we should store the 'iommu' pointer in
* 'struct msi_desc' in some other place, so we don't need to waste
* time searching it here.
"

IMO, we are better to store the 'iommu' pointer in pci_dev, then
could I fix it as:

1. save a void *iommu  in pci_dev structure:

--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -83,6 +83,8 @@ struct pci_dev {
 #define PT_FAULT_THRESHOLD 10
     } fault;
     u64 vf_rlen[6];
+
+   void *iommu; /* No common IOMMU struct so use void pointer */
 };



2. Save iommu pointer in 'struct pci_dev' when to add device:

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1994,6 +1994,7 @@ static int intel_iommu_enable_device(struct pci_dev *pdev)
     if ( ret <= 0 )
         return ret;

+    pdev->iommu = drhd->iommu;
     ret = enable_ats_device(pdev->seg, pdev->bus, pdev->devfn, drhd->iommu);

3. use iommu pointer from pci_dev instead of calling 
acpi_find_matched_drhd_unit each time (also fix the related code).


-Quan
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.