Message ID | 1463874151-6950-4-git-send-email-suravee.suthikulpanit@amd.com |
---|---|
State | New |
Headers | show |
On 5/23/2016 3:23 AM, Paul Durrant wrote: >> -----Original Message----- >> > From: suravee.suthikulpanit@amd.com >> > [mailto:suravee.suthikulpanit@amd.com] >> > Sent: 22 May 2016 00:43 >> > To: xen-devel@lists.xen.org; Paul Durrant; jbeulich@suse.com; George >> > Dunlap >> > Cc: Keir (Xen.org); Suravee Suthikulpanit; Suravee Suthikulapanit >> > Subject: [PATCH v3 3/3] AMD IOMMU: Check io_handler before registering >> > mmio handler >> > >> > From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> >> > >> > guest_iommu_init tries to register mmio handler before HVM domain >> > is initialized. This cause registration to silently failing. >> > This patch adds a sanitiy check and puts out error message. >> > >> > Signed-off-by: Suravee Suthikulapanit <suravee.suthikulpanit@amd.com> > This patch is now defunct isn't it? > > Paul > It is no longer required, but I think this is a good sanity check in case something changes in the future and causing this to be called before the HVM I/O handler initialized. Thanks, Suravee
diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c index f96fbf4..49f00de 100644 --- a/xen/drivers/passthrough/amd/iommu_guest.c +++ b/xen/drivers/passthrough/amd/iommu_guest.c @@ -890,6 +890,12 @@ int guest_iommu_init(struct domain* d) !has_viommu(d) ) return 0; + if ( d->arch.hvm_domain.io_handler == NULL ) + { + AMD_IOMMU_DEBUG("Error: uninitalized hvm io handler\n"); + return 1; + } + iommu = xzalloc(struct guest_iommu); if ( !iommu ) {