[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] iommu: fix PVH dom0 settings


  • To: Paul Durrant <paul.durrant@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 27 Sep 2019 14:28:14 +0200
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 27 Sep 2019 12:28:36 +0000
  • Ironport-sdr: SynCtswvl+aC+1xElJfQJjm8HzsdgioieuWIgKqun9r6iBp/NWnoYt72SXiMtCN1C4GXS7BdmN QTkAeA8+dtc6CVRmvFvVOFdrG1ODydv+lCDI3FrRfICtrMsp9+S6cBOBkhPtOROqS6gVSuSu4b rVf4po/ckA38eK1QcGTMxYuZZYHiunls8sqUimDFvvH/+byptRV7SJb0N3YjL0dDyvQ0SnEkqO +CpIJd69mVmDLd6HC64lXFVBsRIrIPvXs1XhRiIeKoHrXvM58oKfRMbcfbgWxUCLvm+spAXJl3 Vfg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Sep 27, 2019 at 12:45:54PM +0100, Paul Durrant wrote:
> PVH dom0 must operate with the iommu settings in 'strict' mode i.e. only the
> domain's own pages will be mapped in the IOMMU. The check_hwdom_reqs() is
> supposed to ensure this. Unfortunately the test for a PVH dom0 is made
> using paging_mode_translate() and, when commit f89f5558 "remove late
> (on-demand) construction of IOMMU page tables" moved the call of
> check_hwdom_reqs() from iommu_hwdom_init() to iommu_domain_init(), that
> test became ineffective (because iommu_domain_init() is called before
> paging_enable()).
> 
> This patch replaces the test of paging_mode_translate() with a test of
> hap_enabled(), and also verifies 'strict' mode is turned on in
> arch_iommu_check_autotranslated_hwdom().
> 
> Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
> Reported-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> ---
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> ---
>  xen/drivers/passthrough/iommu.c     | 6 +++---
>  xen/drivers/passthrough/x86/iommu.c | 3 +++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
> index 2733b320ec..8b550f909b 100644
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -154,13 +154,13 @@ custom_param("dom0-iommu", parse_dom0_iommu_param);
>  
>  static void __hwdom_init check_hwdom_reqs(struct domain *d)
>  {
> -    if ( iommu_hwdom_none || !paging_mode_translate(d) )
> +    if ( iommu_hwdom_none || !hap_enabled(d) )

Since dom0 PVH can also be used with shadow paging (not sure how
useful that is TBH), I'm not sure explicitly checking for hap is fine.
What about using is_hvm_domain instead?

That ought to cover both shadow and hap, and a classic PV dom0 won't
be affected by it (which is the intention).

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.