From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Tim Deegan <tim@xen.org>,
Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH 1/3] iommu: set correct IOMMU entries when iommu_hap_pt_share == 0
Date: Mon, 7 Apr 2014 12:49:20 -0400 [thread overview]
Message-ID: <20140407164920.GA3239@phenom.dumpdata.com> (raw)
In-Reply-To: <1396886524-16921-2-git-send-email-roger.pau@citrix.com>
On Mon, Apr 07, 2014 at 06:02:02PM +0200, Roger Pau Monne wrote:
> If the memory map is not shared between HAP and IOMMU we fails to set
we fail
> correct IOMMU mappings for memory types different than p2m_ram_rw.
s/different/other/
>
> This patchs adds IOMMU support for the following memory types:
> p2m_grant_map_rw, p2m_map_foreign, p2m_ram_ro and p2m_grant_map_ro.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Tim Deegan <tim@xen.org>
> Cc: Jan Beulich <jbeulich@suse.com>
> ---
> xen/arch/x86/mm/p2m-ept.c | 24 +++++++++++++++++++++---
> xen/arch/x86/mm/p2m-pt.c | 23 ++++++++++++++++++++---
> 2 files changed, 41 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
> index beb7288..cf11a34 100644
> --- a/xen/arch/x86/mm/p2m-ept.c
> +++ b/xen/arch/x86/mm/p2m-ept.c
> @@ -475,18 +475,36 @@ out:
> iommu_pte_flush(d, gfn, (u64*)ept_entry, order, vtd_pte_present);
> else
> {
> - if ( p2mt == p2m_ram_rw )
> + unsigned int flags;
> +
> + switch( p2mt )
> + {
> + case p2m_ram_rw:
> + case p2m_grant_map_rw:
> + case p2m_map_foreign:
> + flags = IOMMUF_readable | IOMMUF_writable;
> + break;
> + case p2m_ram_ro:
> + case p2m_grant_map_ro:
> + flags = IOMMUF_readable;
> + break;
> + default:
> + flags = 0;
> + break;
> + }
> +
> + if ( flags != 0 )
> {
> if ( order > 0 )
> {
> for ( i = 0; i < (1 << order); i++ )
> iommu_map_page(
> p2m->domain, gfn - offset + i, mfn_x(mfn) - offset + i,
> - IOMMUF_readable | IOMMUF_writable);
> + flags);
> }
> else if ( !order )
> iommu_map_page(
> - p2m->domain, gfn, mfn_x(mfn), IOMMUF_readable | IOMMUF_writable);
> + p2m->domain, gfn, mfn_x(mfn), flags);
> }
> else
> {
> diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
> index 766fd67..749f7eb 100644
> --- a/xen/arch/x86/mm/p2m-pt.c
> +++ b/xen/arch/x86/mm/p2m-pt.c
> @@ -450,10 +450,27 @@ p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
> }
> else
> {
> - if ( p2mt == p2m_ram_rw )
> + unsigned int flags;
> +
> + switch( p2mt )
> + {
> + case p2m_ram_rw:
> + case p2m_grant_map_rw:
> + case p2m_map_foreign:
> + flags = IOMMUF_readable | IOMMUF_writable;
> + break;
> + case p2m_ram_ro:
> + case p2m_grant_map_ro:
> + flags = IOMMUF_readable;
> + break;
> + default:
> + flags = 0;
> + break;
> + }
> +
> + if ( flags != 0 )
> for ( i = 0; i < (1UL << page_order); i++ )
> - iommu_map_page(p2m->domain, gfn+i, mfn_x(mfn)+i,
> - IOMMUF_readable|IOMMUF_writable);
> + iommu_map_page(p2m->domain, gfn+i, mfn_x(mfn)+i, flags);
> else
> for ( int i = 0; i < (1UL << page_order); i++ )
> iommu_unmap_page(p2m->domain, gfn+i);
> --
> 1.7.7.5 (Apple Git-26)
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-04-07 16:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-07 16:02 [PATCH 0/3] Fix grant map/unmap with auto-translated guests Roger Pau Monne
2014-04-07 16:02 ` [PATCH 1/3] iommu: set correct IOMMU entries when iommu_hap_pt_share == 0 Roger Pau Monne
2014-04-07 16:49 ` Konrad Rzeszutek Wilk [this message]
2014-04-08 8:30 ` Jan Beulich
2014-04-08 9:19 ` Roger Pau Monné
2014-04-08 9:55 ` Jan Beulich
2014-04-08 14:12 ` Tim Deegan
2014-04-08 15:15 ` Roger Pau Monné
2014-04-08 15:29 ` Jan Beulich
2014-04-13 20:27 ` Tim Deegan
2014-04-16 14:36 ` Roger Pau Monné
2014-04-16 14:41 ` Jan Beulich
2014-04-07 16:02 ` [PATCH 2/3] amd-iommu: disable iommu_hap_pt_share with AMD IOMMUs Roger Pau Monne
2014-04-07 16:51 ` Konrad Rzeszutek Wilk
2014-04-07 16:54 ` George Dunlap
2014-04-08 7:29 ` Roger Pau Monné
2014-04-08 8:52 ` Jan Beulich
2014-04-08 14:16 ` Tim Deegan
2014-04-08 14:36 ` Jan Beulich
2014-04-08 15:39 ` Roger Pau Monné
2014-04-07 16:02 ` [PATCH 3/3] xen: expose that grant table mappings update the IOMMU Roger Pau Monne
2014-04-08 8:34 ` Ian Campbell
2014-04-08 8:56 ` Jan Beulich
2014-04-08 8:58 ` Ian Campbell
2014-04-08 9:53 ` Jan Beulich
2014-04-08 9:57 ` Ian Campbell
2014-04-08 10:05 ` Jan Beulich
2014-04-08 10:26 ` Ian Campbell
2014-04-08 10:31 ` Jan Beulich
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=20140407164920.GA3239@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=tim@xen.org \
--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 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.