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

[Xen-changelog] [xen-unstable] AMD IOMMU: fix find_iommu_from_bdf_cap()


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 16 Oct 2012 07:11:08 +0000
  • Delivery-date: Tue, 16 Oct 2012 07:11:39 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1350298754 -7200
# Node ID 137dfbd3190e849b3a498d8b2ea282ebbf12e77d
# Parent  e0e1350dfe9b7a6cacb1378f75d8e6536d22eb2d
AMD IOMMU: fix find_iommu_from_bdf_cap()

The arguments passed for the "cap_offset" parameter get read from 16-
bit fields, so the parameter should also have (at least) 16 bits.

While fixing this I also noticed that this was yet another case where
PCI segment information wasn't properly propagated, so a respective
first parameter gets added to the function at once.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Wei Wang <wei.wang2@xxxxxxx>
---


diff -r e0e1350dfe9b -r 137dfbd3190e xen/drivers/passthrough/amd/iommu_acpi.c
--- a/xen/drivers/passthrough/amd/iommu_acpi.c  Thu Oct 11 15:57:00 2012 +0100
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c  Mon Oct 15 12:59:14 2012 +0200
@@ -86,12 +86,13 @@ static void __init add_ivrs_mapping_entr
 }
 
 static struct amd_iommu * __init find_iommu_from_bdf_cap(
-    u16 bdf, u8 cap_offset)
+    u16 seg, u16 bdf, u16 cap_offset)
 {
     struct amd_iommu *iommu;
 
     for_each_amd_iommu ( iommu )
-        if ( (iommu->bdf == bdf) && (iommu->cap_offset == cap_offset) )
+        if ( (iommu->seg == seg) && (iommu->bdf == bdf) &&
+             (iommu->cap_offset == cap_offset) )
             return iommu;
 
     return NULL;
@@ -319,10 +320,11 @@ static int __init parse_ivmd_device_iomm
     const struct acpi_ivrs_memory *ivmd_block,
     unsigned long base, unsigned long limit, u8 iw, u8 ir)
 {
+    int seg = 0; /* XXX */
     struct amd_iommu *iommu;
 
     /* find target IOMMU */
-    iommu = find_iommu_from_bdf_cap(ivmd_block->header.device_id,
+    iommu = find_iommu_from_bdf_cap(seg, ivmd_block->header.device_id,
                                     ivmd_block->aux_data);
     if ( !iommu )
     {
@@ -669,7 +671,8 @@ static int __init parse_ivhd_block(const
         return -ENODEV;
     }
 
-    iommu = find_iommu_from_bdf_cap(ivhd_block->header.device_id,
+    iommu = find_iommu_from_bdf_cap(ivhd_block->pci_segment_group,
+                                    ivhd_block->header.device_id,
                                     ivhd_block->capability_offset);
     if ( !iommu )
     {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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