From: "Jan Beulich" Subject: [PATCH] x86/MSI: fix 2nd S3 resume with interrupt remapping enabled Date: Fri, 07 Sep 2012 13:49:22 +0100 Message-ID: <504A09720200007800099CBD@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartDEEFCA42.0__=" 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 List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartDEEFCA42.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The first resume from S3 was corrupting internal data structures (in that pci_restore_msi_state() updated the globally stored MSI message from traditional to interrupt remapped format, which would then be translated a second time during the second resume, breaking interrupt delivery). Signed-off-by: Jan Beulich --- 2012-08-08.orig/xen/arch/x86/msi.c 2012-09-07 13:39:02.000000000 = +0200 +++ 2012-08-08/xen/arch/x86/msi.c 2012-09-06 12:04:11.000000000 = +0200 @@ -210,7 +210,10 @@ static void write_msi_msg(struct msi_des entry->msg =3D *msg; =20 if ( iommu_enabled ) + { + ASSERT(msg !=3D &entry->msg); iommu_update_ire_from_msi(entry, msg); + } =20 switch ( entry->msi_attrib.type ) { @@ -996,6 +999,7 @@ int pci_restore_msi_state(struct pci_dev int ret; struct msi_desc *entry, *tmp; struct irq_desc *desc; + struct msi_msg msg; =20 ASSERT(spin_is_locked(&pcidevs_lock)); =20 @@ -1030,7 +1034,8 @@ int pci_restore_msi_state(struct pci_dev else if ( entry->msi_attrib.type =3D=3D PCI_CAP_ID_MSIX ) msix_set_enable(pdev, 0); =20 - write_msi_msg(entry, &entry->msg); + msg =3D entry->msg; + write_msi_msg(entry, &msg); =20 msi_set_mask_bit(desc, entry->msi_attrib.masked); =20 --=__PartDEEFCA42.0__= Content-Type: text/plain; name="x86-S3-MSI-resume.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-S3-MSI-resume.patch" x86/MSI: fix 2nd S3 resume with interrupt remapping enabled=0A=0AThe first = resume from S3 was corrupting internal data structures (in=0Athat = pci_restore_msi_state() updated the globally stored MSI message=0Afrom = traditional to interrupt remapped format, which would then be=0Atranslated = a second time during the second resume, breaking interrupt=0Adelivery).=0A= =0ASigned-off-by: Jan Beulich =0A=0A--- 2012-08-08.orig/= xen/arch/x86/msi.c 2012-09-07 13:39:02.000000000 +0200=0A+++ = 2012-08-08/xen/arch/x86/msi.c 2012-09-06 12:04:11.000000000 +0200=0A@@ = -210,7 +210,10 @@ static void write_msi_msg(struct msi_des=0A = entry->msg =3D *msg;=0A =0A if ( iommu_enabled )=0A+ {=0A+ = ASSERT(msg !=3D &entry->msg);=0A iommu_update_ire_from_msi(entry, = msg);=0A+ }=0A =0A switch ( entry->msi_attrib.type )=0A {=0A@@ = -996,6 +999,7 @@ int pci_restore_msi_state(struct pci_dev=0A int = ret;=0A struct msi_desc *entry, *tmp;=0A struct irq_desc *desc;=0A+= struct msi_msg msg;=0A =0A ASSERT(spin_is_locked(&pcidevs_lock));= =0A =0A@@ -1030,7 +1034,8 @@ int pci_restore_msi_state(struct pci_dev=0A = else if ( entry->msi_attrib.type =3D=3D PCI_CAP_ID_MSIX )=0A = msix_set_enable(pdev, 0);=0A =0A- write_msi_msg(entry, = &entry->msg);=0A+ msg =3D entry->msg;=0A+ write_msi_msg(entry= , &msg);=0A =0A msi_set_mask_bit(desc, entry->msi_attrib.masked);= =0A =0A --=__PartDEEFCA42.0__= 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 --=__PartDEEFCA42.0__=--