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

Re: [Xen-devel] [PATCH 1/6] AMD IOMMU: allocate IRTE entries instead of using a static mapping



On 4/19/2013 5:57 AM, Jan Beulich wrote:
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c

@@ -691,14 +694,16 @@ static u16 __init parse_ivhd_device_spec
                  ioapic_sbdf[special->handle].bdf = bdf;
                  ioapic_sbdf[special->handle].seg = seg;
- ioapic_sbdf[special->handle].pin_setup = xzalloc_array(
-                    unsigned long, BITS_TO_LONGS(nr_ioapic_entries[apic]));
+                ioapic_sbdf[special->handle].pin_2_idx = xmalloc_array(
+                    u16, nr_ioapic_entries[apic]);
                  if ( nr_ioapic_entries[apic] &&
-                     !ioapic_sbdf[IO_APIC_ID(apic)].pin_setup )
+                     !ioapic_sbdf[IO_APIC_ID(apic)].pin_2_idx )
                  {
                      printk(XENLOG_ERR "IVHD Error: Out of memory\n");
                      return 0;
                  }
+                memset(ioapic_sbdf[IO_APIC_ID(apic)].pin_2_idx, -1,
+                       nr_ioapic_entries[apic]);
              }

Jan,

Ok.. here is why the (offset >= INTREMAP_ENTRIES) in 
update_intremap_entry_from_ioapic failed.

+                memset(ioapic_sbdf[IO_APIC_ID(apic)].pin_2_idx, -1,
+                       nr_ioapic_entries[apic]);

should have been

+                memset(ioapic_sbdf[IO_APIC_ID(apic)].pin_2_idx, -1,
+                       (nr_ioapic_entries[apic] * sizeof(u16)));

Since nr_ioapic_entries[apic] = 24, only pin_2_idx[0 to 11] is set to 0xffff.  
This causes the pin_2_idx[12-23] to fail the check.

Suravee.





_______________________________________________
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®.