All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/passthrough: share_p2m: fix build failure on ARM
@ 2015-03-11 11:23 Julien Grall
  2015-03-11 11:50 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Grall @ 2015-03-11 11:23 UTC (permalink / raw)
  To: xen-devel
  Cc: Kevin Tian, ian.campbell, Julien Grall, tim, Jan Beulich,
	Aravind Gopalakrishnan, Suravee Suthikulpanit, Yang Zhang,
	stefano.stabellini, Roger Pau Monné

The commit 7978429 "iommu: fix usage of shared EPT/IOMMU page tables on
PVH guests" breaks the hypervisor compilation on ARM.

This is because the macro hap_enabled is not defined on ARM.

On x86, the P2M can only be shared when hap is enabled and the user
didn't deny it (via the command line). Those checks are done by
iommu_use_hap_pt().

On ARM, the macro iommu_use_hap_pt() is also defined. So move the
if ( iommu_use_hap_pt(d) ) from the IOMMU drivers up to
iommu_share_p2m_table.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Yang Zhang <yang.z.zhang@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/amd/iommu_map.c | 3 ---
 xen/drivers/passthrough/iommu.c         | 3 +--
 xen/drivers/passthrough/vtd/iommu.c     | 3 ---
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index 31dc05d..495ff5c 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -785,9 +785,6 @@ void amd_iommu_share_p2m(struct domain *d)
     struct page_info *p2m_table;
     mfn_t pgd_mfn;
 
-    if ( !iommu_use_hap_pt(d) )
-        return;
-
     pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
     p2m_table = mfn_to_page(mfn_x(pgd_mfn));
 
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 7fcbbb1..92ea26f 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -332,8 +332,7 @@ void iommu_share_p2m_table(struct domain* d)
 {
     const struct iommu_ops *ops = iommu_get_ops();
 
-    ASSERT( hap_enabled(d) );
-    if ( iommu_enabled )
+    if ( iommu_enabled && iommu_use_hap_pt(d) )
         ops->share_p2m(d);
 }
 
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 48676c5..891b9e3 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1789,9 +1789,6 @@ static void iommu_set_pgd(struct domain *d)
     struct hvm_iommu *hd  = domain_hvm_iommu(d);
     mfn_t pgd_mfn;
 
-    if ( !iommu_use_hap_pt(d) )
-        return;
-
     pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
     hd->arch.pgd_maddr = pagetable_get_paddr(pagetable_from_mfn(pgd_mfn));
 }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH] xen/passthrough: share_p2m: fix build failure on ARM
  2015-03-11 11:23 [PATCH] xen/passthrough: share_p2m: fix build failure on ARM Julien Grall
@ 2015-03-11 11:50 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2015-03-11 11:50 UTC (permalink / raw)
  To: Julien Grall
  Cc: Kevin Tian, Suravee Suthikulpanit, tim, stefano.stabellini,
	Aravind Gopalakrishnan, Jan Beulich, Yang Zhang, xen-devel,
	Roger Pau Monné

On Wed, 2015-03-11 at 11:23 +0000, Julien Grall wrote:
> The commit 7978429 "iommu: fix usage of shared EPT/IOMMU page tables on
> PVH guests" breaks the hypervisor compilation on ARM.
> 
> This is because the macro hap_enabled is not defined on ARM.
> 
> On x86, the P2M can only be shared when hap is enabled and the user
> didn't deny it (via the command line). Those checks are done by
> iommu_use_hap_pt().
> 
> On ARM, the macro iommu_use_hap_pt() is also defined. So move the
> if ( iommu_use_hap_pt(d) ) from the IOMMU drivers up to
> iommu_share_p2m_table.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Yang Zhang <yang.z.zhang@intel.com>
> Cc: Kevin Tian <kevin.tian@intel.com>
> Cc: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Ian Campbell <ian.campbell@citrix.com>

Since this is breaking the arm build (as I suppose osstest will tell us
shortly) it would be good to get this into the tree ASAP.



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

end of thread, other threads:[~2015-03-11 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11 11:23 [PATCH] xen/passthrough: share_p2m: fix build failure on ARM Julien Grall
2015-03-11 11:50 ` Ian Campbell

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.