From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Malcolm Crossley <malcolm.crossley@citrix.com>
Cc: jbeulich@suse.com, xen-devel@lists.xen.org
Subject: Re: [RFC PATCH 2/7] iommu: add iommu_lookup_page to lookup guest gfn for a particular IOMMU mapping
Date: Wed, 17 Feb 2016 15:22:39 -0500 [thread overview]
Message-ID: <20160217202239.GC25726@char.us.oracle.com> (raw)
In-Reply-To: <1455099035-17649-3-git-send-email-malcolm.crossley@citrix.com>
On Wed, Feb 10, 2016 at 10:10:30AM +0000, Malcolm Crossley wrote:
> If IOMMU driver does not implement lookup_page function then it returns -ENOMEM.
That is a very odd return code. Could you explain why -ENOMEM?
>
> Returns 0 on success and any other value on failure.
>
> Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
> --
> Cc: jbeulich@suse.com
> Cc: xen-devel@lists.xen.org
> ---
> xen/drivers/passthrough/iommu.c | 21 +++++++++++++++++++++
> xen/include/xen/iommu.h | 2 ++
> 2 files changed, 23 insertions(+)
>
> diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
> index 0b2abf4..06f21ee 100644
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -257,6 +257,27 @@ int iommu_unmap_page(struct domain *d, unsigned long gfn)
> return hd->platform_ops->unmap_page(d, gfn);
> }
>
> +int iommu_lookup_page(struct domain *d, unsigned long bfn, unsigned long *gfn)
> +{
> + struct hvm_iommu *hd = domain_hvm_iommu(d);
> +
> + /*
> + * BFN maps 1:1 to GFN when iommu passthrough is enabled or
> + * when IOMMU shared page tables is in use
Missing full stop.
> + */
> + if ( iommu_use_hap_pt(d) || (iommu_passthrough && is_hardware_domain(d)) )
The comment is not in sync with the code. But what I am curious - if
the dom0 is PVH and the shared EPT is disabled, what path should we take?
I would think we would need to skip this and go to the ->lookup_page?
> + {
> + *gfn = bfn;
> + return 0;
> + }
> +
> + if ( !iommu_enabled || !hd->platform_ops ||
> + !hd->platform_ops->lookup_page )
> + return -ENOMEM;
-ENOMEM ? ENXIO ? Or maybe -ENOSYS for the case when hd->platform_ops
is not set nor ->lookup_page?
> +
> + return hd->platform_ops->lookup_page(d, bfn, gfn);
> +}
> +
> static void iommu_free_pagetables(unsigned long unused)
> {
> do {
> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
> index 8217cb7..49ca087 100644
> --- a/xen/include/xen/iommu.h
> +++ b/xen/include/xen/iommu.h
> @@ -77,6 +77,7 @@ void iommu_teardown(struct domain *d);
> int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn,
> unsigned int flags);
> int iommu_unmap_page(struct domain *d, unsigned long gfn);
> +int iommu_lookup_page(struct domain *d, unsigned long bfn, unsigned long *gfn);
>
> enum iommu_feature
> {
> @@ -151,6 +152,7 @@ struct iommu_ops {
> int (*map_page)(struct domain *d, unsigned long gfn, unsigned long mfn,
> unsigned int flags);
> int (*unmap_page)(struct domain *d, unsigned long gfn);
> + int (*lookup_page)(struct domain *d, unsigned long bfn, unsigned long *gfn);
> void (*free_page_table)(struct page_info *);
> #ifdef CONFIG_X86
> void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value);
> --
> 1.7.12.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-02-17 20:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1455099035-17649-1-git-send-email-malcolm.crossley@citrix.com>
2016-02-10 10:10 ` [RFC PATCH 1/7] common/pv-iommu: Add stub hypercall for PV-IOMMU Malcolm Crossley
2016-02-10 10:36 ` Malcolm Crossley
2016-02-17 20:09 ` Konrad Rzeszutek Wilk
2016-02-10 10:10 ` [RFC PATCH 2/7] iommu: add iommu_lookup_page to lookup guest gfn for a particular IOMMU mapping Malcolm Crossley
2016-02-17 20:22 ` Konrad Rzeszutek Wilk [this message]
2016-02-24 15:08 ` George Dunlap
2016-02-24 15:10 ` Andrew Cooper
2016-02-10 10:10 ` [RFC PATCH 3/7] VT-d: Add iommu_lookup_page support Malcolm Crossley
2016-02-17 20:32 ` Konrad Rzeszutek Wilk
2016-02-10 10:10 ` [RFC PATCH 4/7] common/pv-iommu: Add query, map and unmap ops Malcolm Crossley
2016-02-17 21:05 ` Konrad Rzeszutek Wilk
2016-02-17 21:07 ` Konrad Rzeszutek Wilk
2016-02-10 10:10 ` [RFC PATCH 5/7] x86/m2b: Add a tracking structure for mfn to bfn mappings per page Malcolm Crossley
2016-02-24 17:07 ` George Dunlap
2016-02-10 10:10 ` [RFC PATCH 6/7] common/pv-iommu: Add foreign ops to PV-IOMMU interface Malcolm Crossley
2016-02-17 21:11 ` Konrad Rzeszutek Wilk
2016-02-10 10:10 ` [RFC PATCH 7/7] common/pv-iommu: Allow hardware_domain to pre IOMMU map foreign memory Malcolm Crossley
2016-02-10 10:33 ` [RFC PATCH 0/7] Implement Xen PV-IOMMU interface Malcolm Crossley
2016-02-17 20:12 ` Konrad Rzeszutek Wilk
2016-02-24 18:08 ` George Dunlap
2016-11-22 16:21 ` Martin Cerveny
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=20160217202239.GC25726@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=jbeulich@suse.com \
--cc=malcolm.crossley@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.