From: Andrew Cooper Subject: [PATCH] [RFC] iommu/crash: Interrupt remapping is also disabled on crash Date: Mon, 15 Apr 2013 16:04:08 +0100 Message-ID: <4247933ebeaa4a00a942.1366038248@andrewcoop.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Xiantao Zhang , Keir Fraser , Suravee Suthikulpanit , Jan Beulich List-Id: xen-devel@lists.xenproject.org On the crash path in nmi_shootdown_cpus(), we shut down the IOMMU, then disable the IOAPIC. On systems which support interrupt remapping, the variable iommu_intremap remains set, meaning that disable_IO_APIC() issues interrupt remapping invalidate requests. Pre Sandy-Bridge Intel systems and AMD systems appear to cope with this (in so far as "they seem to work fine"), but Sandy-Bridge systems certainly do not, resulting in a panic() when the Queued Invalidation wait descriptor is not executed, and subsequent deadlock because of reentering the kexec_crash() path. This behaviour can be fixed by also indicating that interrupt remapping is not enabled after shutting down the IOMMU. Signed-off-by: Andrew Cooper -- This patch is RFC because of several concerns. * Do we want to turn off more of the IOMMU feature variables as well? I suspect so. * It looks to me as if this will also cause problems on the S3 path, as iommu_disable_x2apic_IR() is called after iommu_shutdown(), yet the variables cant change or iommu_resume() will leave things disabled. diff -r 98f80bf9e286 -r 4247933ebeaa xen/drivers/passthrough/iommu.c --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -601,7 +601,7 @@ void iommu_crash_shutdown(void) const struct iommu_ops *ops = iommu_get_ops(); if ( iommu_enabled ) ops->crash_shutdown(); - iommu_enabled = 0; + iommu_enabled = iommu_intremap = 0; } int iommu_do_domctl(