From: Julien Grall <julien.grall@arm.com>
To: Oleksandr Tyshchenko <olekstysh@gmail.com>,
xen-devel@lists.xenproject.org
Cc: wei.liu2@citrix.com, sstabellini@kernel.org,
ian.jackson@eu.citrix.com, jbeulich@suse.com
Subject: Re: [PATCH v1 09/10] xen/arm: Add use_iommu flag to xen_arch_domainconfig
Date: Thu, 11 May 2017 12:42:25 +0100 [thread overview]
Message-ID: <bae4cdae-9b9b-ea32-26d7-3d41717d155a@arm.com> (raw)
In-Reply-To: <1494424994-26232-10-git-send-email-olekstysh@gmail.com>
Hi Oleksandr,
On 10/05/17 15:03, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>
> This flag is intended to let Xen know that the guest has devices
> which will most likely be used for passthrough and as the result
> the use of IOMMU is expected for this domain.
> The primary aim of this knowledge is to help the IOMMUs that don't
> share page tables with the CPU on ARM be ready before P2M code starts
> updating IOMMU mapping.
> So, if this flag is set the non-shared IOMMUs will populate
> their page tables at the domain creation time and thereby will be able
> to handle IOMMU mapping updates from *the very beginning*.
>
> In order to retain the current behavior for x86 still call
> iommu_domain_init() with use_iommu flag being forced to false.
>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Julien Grall <julien.grall@arm.com>
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
>
> ---
> Changes in V1:
> - Treat use_iommu flag as the ARM decision only. Don't use
> common domain creation flag for it, use ARM config instead.
> - Clarify patch subject/description.
> ---
> tools/libxl/libxl_arm.c | 10 ++++++++++
> xen/arch/arm/domain.c | 2 +-
> xen/include/public/arch-arm.h | 5 +++++
> 3 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index d842d88..9c4705e 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -78,6 +78,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
> return ERROR_FAIL;
> }
>
> + /* TODO Are these assumptions enough to make decision about using IOMMU? */
> + if ((d_config->num_dtdevs && d_config->dtdevs) ||
> + (d_config->num_pcidevs && d_config->pcidevs))
Checking num_dtdevs and num_pcidevs is enough. It would be a bug if
dtdevs and pcidevs are not null.
> + xc_config->use_iommu = 1;
> + else
> + xc_config->use_iommu = 0;
> +
> + LOG(DEBUG, "The use of IOMMU %s expected for this domain",
> + xc_config->use_iommu ? "is" : "isn't");
> +
> return 0;
> }
>
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index ec19310..81c4b90 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -569,7 +569,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
> ASSERT(config != NULL);
>
> /* p2m_init relies on some value initialized by the IOMMU subsystem */
> - if ( (rc = iommu_domain_init(d, false)) != 0 )
> + if ( (rc = iommu_domain_init(d, config->use_iommu ? true : false)) != 0 )
!!config->use_iommu is enough.
> goto fail;
>
> if ( (rc = p2m_init(d)) != 0 )
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index bd974fb..cb33f75 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -322,6 +322,11 @@ struct xen_arch_domainconfig {
> *
> */
> uint32_t clock_frequency;
> + /*
> + * IN
> + * Inform the hypervisor that the use of IOMMU is expected for this domain.
I would simplify to : "IOMMU is expected to be used for this domain".
> + */
> + uint8_t use_iommu;
> };
> #endif /* __XEN__ || __XEN_TOOLS__ */
>
>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-05-11 11:42 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 14:03 [PATCH v1 00/10] "Non-shared" IOMMU support on ARM Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 01/10] xen/device-tree: Add dt_count_phandle_with_args helper Oleksandr Tyshchenko
2017-05-10 14:50 ` Jan Beulich
2017-05-10 15:06 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 02/10] iommu: Add extra order argument to the IOMMU APIs and platform callbacks Oleksandr Tyshchenko
2017-05-12 14:23 ` Jan Beulich
2017-05-12 15:50 ` Oleksandr Tyshchenko
2017-05-12 16:17 ` Jan Beulich
2017-05-12 16:25 ` Oleksandr Tyshchenko
2017-05-15 7:22 ` Jan Beulich
2017-05-15 10:43 ` Oleksandr Tyshchenko
2017-05-15 12:33 ` Jan Beulich
2017-05-16 12:48 ` Oleksandr Tyshchenko
2017-05-16 13:11 ` Jan Beulich
2017-05-17 15:28 ` Oleksandr Tyshchenko
2017-05-17 15:39 ` Jan Beulich
2017-05-17 18:49 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 03/10] xen/arm: p2m: Add helper to convert p2m type to IOMMU flags Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 04/10] xen/arm: p2m: Update IOMMU mapping whenever possible if page table is not shared Oleksandr Tyshchenko
2017-05-11 11:24 ` Julien Grall
2017-05-11 14:19 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 05/10] iommu/arm: Re-define iommu_use_hap_pt(d) as iommu_hap_pt_share Oleksandr Tyshchenko
2017-05-11 11:28 ` Julien Grall
2017-05-11 14:38 ` Oleksandr Tyshchenko
2017-05-11 17:58 ` Julien Grall
2017-05-11 18:21 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 06/10] iommu: Add extra use_iommu argument to iommu_domain_init() Oleksandr Tyshchenko
2017-05-12 14:31 ` Jan Beulich
2017-05-12 17:00 ` Oleksandr Tyshchenko
2017-05-15 7:27 ` Jan Beulich
2017-05-17 19:52 ` Julien Grall
2017-05-18 8:38 ` Jan Beulich
2017-05-18 17:41 ` Oleksandr Tyshchenko
2017-05-19 6:30 ` Jan Beulich
2017-05-19 8:56 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 07/10] iommu/arm: Add alloc_page_table platform callback Oleksandr Tyshchenko
2017-05-11 11:38 ` Julien Grall
2017-05-11 14:00 ` Oleksandr Tyshchenko
2017-05-11 18:06 ` Julien Grall
2017-05-11 18:43 ` Oleksandr Tyshchenko
2017-05-12 14:36 ` Jan Beulich
2017-05-10 14:03 ` [PATCH v1 08/10] iommu: Split iommu_hwdom_init() into arch specific parts Oleksandr Tyshchenko
2017-05-12 14:41 ` Jan Beulich
2017-05-12 15:25 ` Oleksandr Tyshchenko
2017-05-12 15:34 ` Jan Beulich
2017-05-15 7:20 ` Jan Beulich
2017-05-15 7:42 ` Julien Grall
2017-05-15 8:19 ` Jan Beulich
2017-05-15 11:45 ` Julien Grall
2017-05-15 12:43 ` Jan Beulich
2017-05-17 15:45 ` Oleksandr Tyshchenko
2017-05-17 16:01 ` Jan Beulich
2017-05-17 18:51 ` Oleksandr Tyshchenko
2017-05-17 20:30 ` Julien Grall
2017-05-18 8:53 ` Jan Beulich
2017-05-18 18:06 ` Oleksandr Tyshchenko
2017-05-19 6:33 ` Jan Beulich
2017-05-10 14:03 ` [PATCH v1 09/10] xen/arm: Add use_iommu flag to xen_arch_domainconfig Oleksandr Tyshchenko
2017-05-11 11:42 ` Julien Grall [this message]
2017-05-11 14:04 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 10/10] xen/arm: domain_build: Don't expose the "iommus" property to the guest Oleksandr Tyshchenko
2017-05-11 11:58 ` Julien Grall
2017-05-11 14:15 ` Oleksandr Tyshchenko
2017-05-11 18:07 ` Julien Grall
2017-05-11 18:19 ` Oleksandr Tyshchenko
2017-05-11 18:19 ` Julien Grall
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=bae4cdae-9b9b-ea32-26d7-3d41717d155a@arm.com \
--to=julien.grall@arm.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=olekstysh@gmail.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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).