From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulpanit Subject: Re: [PATCH V2] x86/AMD-Vi: Add additional check for invalid special->handle Date: Thu, 12 Sep 2013 13:03:06 -0500 Message-ID: <523201DA.4010006@amd.com> References: <1377711297-2705-1-git-send-email-suravee.suthikulpanit@amd.com> <521F11B602000078000EF4ED@nat28.tlf.novell.com> <521FAE67.7080309@amd.com> <52206EA002000078000EFA11@nat28.tlf.novell.com> <52210208.9000809@amd.com> <5227204102000078000F0474@nat28.tlf.novell.com> <5227B8C3.2060802@amd.com> <52284B8502000078000F0A75@nat28.tlf.novell.com> <5230EF36.6030103@amd.com> <52319C6202000078000F2A45@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7937126681160880149==" Return-path: In-Reply-To: <52319C6202000078000F2A45@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: andrew.cooper3@citrix.com, xen-devel@lists.xen.org, keir@xen.org, linux@eikelenboom.it List-Id: xen-devel@lists.xenproject.org --===============7937126681160880149== Content-Type: multipart/alternative; boundary="------------080303010203050604060704" --------------080303010203050604060704 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit On 9/12/2013 3:50 AM, Jan Beulich wrote: > So how about the below then? > > Jan > > AMD IOMMU: also match IVRS overrides on device ID > > Signed-off-by: Jan Beulich > > --- a/xen/drivers/passthrough/amd/iommu_acpi.c > +++ b/xen/drivers/passthrough/amd/iommu_acpi.c > @@ -713,6 +713,24 @@ static u16 __init parse_ivhd_device_spec > * consistency here --- whether entry's IOAPIC ID is valid and > * whether there are conflicting/duplicated entries. > */ > + apic = find_first_bit(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf)); > + while ( apic < ARRAY_SIZE(ioapic_sbdf) ) > + { > + if ( ioapic_sbdf[apic].bdf == bdf && > + ioapic_sbdf[apic].seg == seg ) > + break; > + apic = find_next_bit(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf), > + apic + 1); > + } > + if ( apic < ARRAY_SIZE(ioapic_sbdf) ) > + { > + AMD_IOMMU_DEBUG("IVHD: Command line override present for IO-APIC %#x" > + "(IVRS: %#x devID %04x:%02x:%02x.%u)\n", > + apic, special->handle, seg, PCI_BUS(bdf), > + PCI_SLOT(bdf), PCI_FUNC(bdf)); > + break; > + } > + > for ( apic = 0; apic < nr_ioapics; apic++ ) > { > if ( IO_APIC_ID(apic) != special->handle ) > > > Jan, This looks good. I'm using it in the V3 that I am sending out. Suravee --------------080303010203050604060704 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
On 9/12/2013 3:50 AM, Jan Beulich wrote:
So how about the below then?

Jan

AMD IOMMU: also match IVRS overrides on device ID

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -713,6 +713,24 @@ static u16 __init parse_ivhd_device_spec
          * consistency here --- whether entry's IOAPIC ID is valid and
          * whether there are conflicting/duplicated entries.
          */
+        apic = find_first_bit(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf));
+        while ( apic < ARRAY_SIZE(ioapic_sbdf) )
+        {
+            if ( ioapic_sbdf[apic].bdf == bdf &&
+                 ioapic_sbdf[apic].seg == seg )
+                break;
+            apic = find_next_bit(ioapic_cmdline, ARRAY_SIZE(ioapic_sbdf),
+                                 apic + 1);
+        }
+        if ( apic < ARRAY_SIZE(ioapic_sbdf) )
+        {
+            AMD_IOMMU_DEBUG("IVHD: Command line override present for IO-APIC %#x"
+                            "(IVRS: %#x devID %04x:%02x:%02x.%u)\n",
+                            apic, special->handle, seg, PCI_BUS(bdf),
+                            PCI_SLOT(bdf), PCI_FUNC(bdf));
+            break;
+        }
+
         for ( apic = 0; apic < nr_ioapics; apic++ )
         {
             if ( IO_APIC_ID(apic) != special->handle )



Jan,

This looks good. I'm using it in the V3 that I am sending out.

Suravee
--------------080303010203050604060704-- --===============7937126681160880149== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============7937126681160880149==--