From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: [PATCH 1/3] x86/AMD-Vi: Overrides special->handle in IVRS IOAPIC Date: Fri, 13 Sep 2013 18:30:29 -0500 Message-ID: <1379115031-1992-2-git-send-email-suravee.suthikulpanit@amd.com> References: <1379115031-1992-1-git-send-email-suravee.suthikulpanit@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1379115031-1992-1-git-send-email-suravee.suthikulpanit@amd.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: JBeulich@suse.com Cc: Suravee Suthikulpanit , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org From: Jan Beulich This patch handles the case when IVRS IOAPIC contains invalid special->handle, which mainly caused by firmware bugs. This allows users to override the invalid handle with command option ivrs_ioapic[]=. Acked-by: Suravee Suthikulpanit Signed-off-by: Suravee Suthikulpanit --- xen/drivers/passthrough/amd/iommu_acpi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c index 89b359c..50b4a44 100644 --- a/xen/drivers/passthrough/amd/iommu_acpi.c +++ b/xen/drivers/passthrough/amd/iommu_acpi.c @@ -708,6 +708,26 @@ static u16 __init parse_ivhd_device_special( case ACPI_IVHD_IOAPIC: if ( !iommu_intremap ) break; + + /* Handling the ivrs_ioapic overriding */ + 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; + } + /* * Some BIOSes have IOAPIC broken entries so we check for IVRS * consistency here --- whether entry's IOAPIC ID is valid and -- 1.8.1.2