From: "Jan Beulich" Subject: [PATCH] IOMMU: fail HPET MSI setup on AMD Date: Fri, 19 Oct 2012 10:17:33 +0100 Message-ID: <508136CD02000078000A2888@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1E2FC2BD.1__=" 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 Cc: Wei Wang 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. --=__Part1E2FC2BD.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline While the MSI message format doesn't need adjustment for AMD IOMMUs, the interrupt remapping tables still need updating. The respective code has to be able to determine the IOMMU responsible, which currently requires an associated PCI device. The absence of that device in the HPET case causes the code to crash, and the code determining the source ID to be used for HPETs (parse_ivhd_device_special() afaict) isn't even looking at whether it's dealing with an IO-APIC or a HPET (i.e. ignores the "variety" structure member). If I tried to fix that, I would have no way to test that I did things right, so all I can do to fix the crash is make the setup fail if the IOMMU did not provide a handler (which, considering the above, is the right thing anyway). Signed-off-by: Jan Beulich --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -498,7 +498,7 @@ unsigned int iommu_read_apic_from_ire(un int __init iommu_setup_hpet_msi(struct msi_desc *msi) { const struct iommu_ops *ops =3D iommu_get_ops(); - return ops->setup_hpet_msi ? ops->setup_hpet_msi(msi) : 0; + return ops->setup_hpet_msi ? ops->setup_hpet_msi(msi) : -ENODEV; } =20 void iommu_resume() --=__Part1E2FC2BD.1__= Content-Type: text/plain; name="x86-HPET-intremap-Intel-only.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-HPET-intremap-Intel-only.patch" IOMMU: fail HPET MSI setup on AMD=0A=0AWhile the MSI message format = doesn't need adjustment for AMD IOMMUs,=0Athe interrupt remapping tables = still need updating. The respective code=0Ahas to be able to determine the = IOMMU responsible, which currently=0Arequires an associated PCI device. = The absence of that device in the=0AHPET case causes the code to crash, = and the code determining the source=0AID to be used for HPETs (parse_ivhd_d= evice_special() afaict) isn't even=0Alooking at whether it's dealing with = an IO-APIC or a HPET (i.e. ignores=0Athe "variety" structure member). If I = tried to fix that, I would have=0Ano way to test that I did things right, = so all I can do to fix the=0Acrash is make the setup fail if the IOMMU did = not provide a handler=0A(which, considering the above, is the right thing = anyway).=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/drivers/passthrough/iommu.c=0A+++ b/xen/drivers/passthrough/iommu.c= =0A@@ -498,7 +498,7 @@ unsigned int iommu_read_apic_from_ire(un=0A int = __init iommu_setup_hpet_msi(struct msi_desc *msi)=0A {=0A const struct = iommu_ops *ops =3D iommu_get_ops();=0A- return ops->setup_hpet_msi ? = ops->setup_hpet_msi(msi) : 0;=0A+ return ops->setup_hpet_msi ? = ops->setup_hpet_msi(msi) : -ENODEV;=0A }=0A =0A void iommu_resume()=0A --=__Part1E2FC2BD.1__= 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 --=__Part1E2FC2BD.1__=--