From: Paul Durrant <Paul.Durrant@citrix.com>
To: "suravee.suthikulpanit@amd.com" <suravee.suthikulpanit@amd.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
"jbeulich@suse.com" <jbeulich@suse.com>,
George Dunlap <George.Dunlap@citrix.com>
Cc: "Keir (Xen.org)" <keir@xen.org>
Subject: Re: [PATCH v3 2/3] svm: iommu: Only call guest_iommu_init() after initialized HVM domain
Date: Mon, 23 May 2016 08:21:49 +0000 [thread overview]
Message-ID: <a681cbaeeffd46feaf87c01a255869fa@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <1463874151-6950-3-git-send-email-suravee.suthikulpanit@amd.com>
> -----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
> Subject: [PATCH v3 2/3] svm: iommu: Only call guest_iommu_init() after
> initialized HVM domain
>
> From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>
> The guest_iommu_init() is currently called by the following code path:
>
> arch/x86/domain.c: arch_domain_create()
> ]- drivers/passthrough/iommu.c: iommu_domain_init()
> |- drivers/passthrough/amd/pci_amd_iommu.c:
> amd_iommu_domain_init();
> |- drivers/passthrough/amd/iommu_guest.c: guest_iommu_init()
>
> At this point, the hvm_domain_initialised() has not been called.
> So register_mmio_handler() in guest_iommu_init() silently fails.
> This patch moves the iommu_domain_init() to a later point after the
> hvm_domain_intialise() instead.
>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> xen/arch/x86/domain.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> index 5af2cc5..0260e01 100644
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -642,9 +642,6 @@ int arch_domain_create(struct domain *d, unsigned
> int domcr_flags,
>
> if ( (rc = init_domain_irq_mapping(d)) != 0 )
> goto fail;
> -
> - if ( (rc = iommu_domain_init(d)) != 0 )
> - goto fail;
> }
> spin_lock_init(&d->arch.e820_lock);
>
> @@ -660,6 +657,9 @@ int arch_domain_create(struct domain *d, unsigned
> int domcr_flags,
> /* 64-bit PV guest by default. */
> d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0;
>
> + if ( !is_idle_domain(d) && (rc = iommu_domain_init(d)) != 0 )
> + goto fail_1;
> +
> /* initialize default tsc behavior in case tools don't */
> tsc_set_info(d, TSC_MODE_DEFAULT, 0UL, 0, 0);
> spin_lock_init(&d->arch.vtsc_lock);
> @@ -675,6 +675,9 @@ int arch_domain_create(struct domain *d, unsigned
> int domcr_flags,
>
> return 0;
>
> + fail_1:
> + if ( has_hvm_container_domain(d) )
> + hvm_domain_destroy(d);
> fail:
> d->is_dying = DOMDYING_dead;
> psr_domain_free(d);
> --
> 1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-23 8:21 UTC|newest]
Thread overview: 19+ 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 [this message]
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 ` [PATCH v3 3/3] AMD IOMMU: Check io_handler before registering mmio handler suravee.suthikulpanit
2016-05-23 8:23 ` 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
-- strict thread matches above, loose matches on Subject: below --
2016-05-21 23:33 suravee.suthikulpanit
2016-05-21 23:33 ` [PATCH v3 2/3] svm: iommu: Only call guest_iommu_init() after initialized HVM domain 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=a681cbaeeffd46feaf87c01a255869fa@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=suravee.suthikulpanit@amd.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).