xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: <suravee.suthikulpanit@amd.com>
To: xen-devel@lists.xen.org, paul.durrant@citrix.com,
	jbeulich@suse.com, george.dunlap@citrix.com
Cc: keir@xen.org, Suravee Suthikulapanit <suravee.suthikulpanit@amd.com>
Subject: [PATCH v3 3/3] AMD IOMMU: Check io_handler before registering mmio handler
Date: Sat, 21 May 2016 18:42:31 -0500	[thread overview]
Message-ID: <1463874151-6950-4-git-send-email-suravee.suthikulpanit@amd.com> (raw)
In-Reply-To: <1463874151-6950-1-git-send-email-suravee.suthikulpanit@amd.com>

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>
---
 xen/drivers/passthrough/amd/iommu_guest.c | 6 ++++++
 1 file changed, 6 insertions(+)

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 )
     {
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-05-21 23:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-21 23:42 [PATCH v3 0/3] Fix xen crash when starting HVM guest due to missing io handler suravee.suthikulpanit
2016-05-21 23:42 ` [PATCH v3 1/3] x86/hvm: Add check when register " suravee.suthikulpanit
2016-05-23  8:17   ` Paul Durrant
2016-05-23 11:46   ` Jan Beulich
2016-05-25 19:04     ` Suravee Suthikulanit
2016-05-21 23:42 ` [PATCH v3 2/3] svm: iommu: Only call guest_iommu_init() after initialized HVM domain suravee.suthikulpanit
2016-05-23  8:21   ` Paul Durrant
2016-05-23 11:54   ` Jan Beulich
2016-05-25 19:00     ` Suravee Suthikulanit
2016-05-26 15:44       ` Jan Beulich
2016-05-31 21:11         ` Suravee Suthikulanit
2016-06-01  7:55           ` Jan Beulich
2016-05-21 23:42 ` suravee.suthikulpanit [this message]
2016-05-23  8:23   ` [PATCH v3 3/3] AMD IOMMU: Check io_handler before registering mmio handler Paul Durrant
2016-05-25 18:52     ` Suravee Suthikulanit
2016-05-26  8:28       ` Paul Durrant
2016-05-26 15:47       ` Jan Beulich
2016-05-21 23:47 ` [PATCH v3 0/3] Fix xen crash when starting HVM guest due to missing io handler Suravee Suthikulpanit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463874151-6950-4-git-send-email-suravee.suthikulpanit@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=paul.durrant@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).