All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 4.6] x86/mm: make {set, clear}_identity_p2m_mapping() work for HVM guests as well
@ 2015-09-14 14:24 Andrew Cooper
  2015-09-14 14:42 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2015-09-14 14:24 UTC (permalink / raw)
  To: Xen-devel
  Cc: George Dunlap, Andrew Cooper, Malcolm Crossley, Wei Liu,
	Jan Beulich

From: Malcolm Crossley <malcolm.crossley@citrix.com>

For Intel IGD passthrough, the guest driver programs the device to DMA
to/from its RMRR.

c/s 619ecf8 "make {set,clear}_identity_p2m_mapping() work for PV guests"
was incomplete for pre-Broadwell systems which did not support shared
EPT.

The correct check to use is iommu_use_hap_pt() not
paging_mode_translate() as IOMMU mappings also need to be created for
HVM guests with separate EPT and IOMMU tables.

Signed-off-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/mm/p2m.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index c4329d2..c7f437c 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -957,7 +957,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn,
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
 
-    if ( !paging_mode_translate(p2m->domain) )
+    if ( !iommu_use_hap_pt(d) )
     {
         if ( !need_iommu(d) )
             return 0;
@@ -1032,7 +1032,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn)
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret;
 
-    if ( !paging_mode_translate(d) )
+    if ( !iommu_use_hap_pt(d) )
     {
         if ( !need_iommu(d) )
             return 0;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for 4.6] x86/mm: make {set, clear}_identity_p2m_mapping() work for HVM guests as well
  2015-09-14 14:24 [PATCH for 4.6] x86/mm: make {set, clear}_identity_p2m_mapping() work for HVM guests as well Andrew Cooper
@ 2015-09-14 14:42 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2015-09-14 14:42 UTC (permalink / raw)
  To: Andrew Cooper, Malcolm Crossley; +Cc: George Dunlap, Wei Liu, Xen-devel

>>> On 14.09.15 at 16:24, <andrew.cooper3@citrix.com> wrote:
> For Intel IGD passthrough, the guest driver programs the device to DMA
> to/from its RMRR.
> 
> c/s 619ecf8 "make {set,clear}_identity_p2m_mapping() work for PV guests"
> was incomplete for pre-Broadwell systems which did not support shared
> EPT.
> 
> The correct check to use is iommu_use_hap_pt() not
> paging_mode_translate() as IOMMU mappings also need to be created for
> HVM guests with separate EPT and IOMMU tables.

No, at least not without a very good explanation:

> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -957,7 +957,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn,
>      struct p2m_domain *p2m = p2m_get_hostp2m(d);
>      int ret;
>  
> -    if ( !paging_mode_translate(p2m->domain) )
> +    if ( !iommu_use_hap_pt(d) )

Not only have these checks no reason to be in any way IOMMU
dependent (no other function around here does so), but also
both ept_set_entry() and p2m_pt_set_entry() take care to call
iommu_{,un}map_page() as needed (as I had already pointed
out back when we discussed the patch this one tries to complete).
If anything, it would be those low level functions that may need
tweaking (and which have a reason to consider IOMMU flags) if
for some reason they don't actually do the expected calls.

Jan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-14 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 14:24 [PATCH for 4.6] x86/mm: make {set, clear}_identity_p2m_mapping() work for HVM guests as well Andrew Cooper
2015-09-14 14:42 ` Jan Beulich

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.