From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulanit Subject: Re: [PATCH 1/6] AMD IOMMU: allocate IRTE entries instead of using a static mapping Date: Fri, 26 Apr 2013 12:13:58 -0500 Message-ID: <517AB5D6.5030009@amd.com> References: <51713D8F02000078000CEEE6@nat28.tlf.novell.com> <51713F2D02000078000CEF05@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51713F2D02000078000CEF05@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Konrad Rzeszutek Wilk , Jacob Shin , xiantao.zhang@intel.com, xen-devel List-Id: xen-devel@lists.xenproject.org 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.