xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/vtd: relax EPT page table sharing check
@ 2020-04-17 11:29 Roger Pau Monne
  2020-04-17 12:06 ` Jan Beulich
  2020-04-20  2:41 ` Tian, Kevin
  0 siblings, 2 replies; 3+ messages in thread
From: Roger Pau Monne @ 2020-04-17 11:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Kevin Tian, Jan Beulich, Roger Pau Monne

The EPT page tables can be shared with the IOMMU as long as the page
sizes supported by EPT are also supported by the IOMMU.

Current code checks that both the IOMMU and EPT support the same page
sizes, but this is not strictly required, the IOMMU supporting more
page sizes than EPT is fine and shouldn't block page table sharing.

This is likely not a common case (IOMMU supporting more page sizes
than EPT), but should still be fixed for correctness.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
---
Changes since v1:
 - Use <= to compare caps.
 - Reword subject/commit message.
---
 xen/drivers/passthrough/vtd/iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 07d40b37fe..208b33c0e4 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1914,8 +1914,8 @@ static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu)
     if ( rdmsr_safe(MSR_IA32_VMX_EPT_VPID_CAP, ept_cap) != 0 ) 
         return 0;
 
-    return (ept_has_2mb(ept_cap) && opt_hap_2mb) == cap_sps_2mb(vtd_cap) &&
-           (ept_has_1gb(ept_cap) && opt_hap_1gb) == cap_sps_1gb(vtd_cap);
+    return (ept_has_2mb(ept_cap) && opt_hap_2mb) <= cap_sps_2mb(vtd_cap) &&
+           (ept_has_1gb(ept_cap) && opt_hap_1gb) <= cap_sps_1gb(vtd_cap);
 }
 
 /*
-- 
2.26.0



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

* Re: [PATCH] x86/vtd: relax EPT page table sharing check
  2020-04-17 11:29 [PATCH] x86/vtd: relax EPT page table sharing check Roger Pau Monne
@ 2020-04-17 12:06 ` Jan Beulich
  2020-04-20  2:41 ` Tian, Kevin
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2020-04-17 12:06 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Kevin Tian

On 17.04.2020 13:29, Roger Pau Monne wrote:
> The EPT page tables can be shared with the IOMMU as long as the page
> sizes supported by EPT are also supported by the IOMMU.
> 
> Current code checks that both the IOMMU and EPT support the same page
> sizes, but this is not strictly required, the IOMMU supporting more
> page sizes than EPT is fine and shouldn't block page table sharing.
> 
> This is likely not a common case (IOMMU supporting more page sizes
> than EPT), but should still be fixed for correctness.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>


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

* RE: [PATCH] x86/vtd: relax EPT page table sharing check
  2020-04-17 11:29 [PATCH] x86/vtd: relax EPT page table sharing check Roger Pau Monne
  2020-04-17 12:06 ` Jan Beulich
@ 2020-04-20  2:41 ` Tian, Kevin
  1 sibling, 0 replies; 3+ messages in thread
From: Tian, Kevin @ 2020-04-20  2:41 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Jan Beulich

> From: Roger Pau Monne <roger.pau@citrix.com>
> Sent: Friday, April 17, 2020 7:30 PM
> 
> The EPT page tables can be shared with the IOMMU as long as the page
> sizes supported by EPT are also supported by the IOMMU.
> 
> Current code checks that both the IOMMU and EPT support the same page
> sizes, but this is not strictly required, the IOMMU supporting more
> page sizes than EPT is fine and shouldn't block page table sharing.
> 
> This is likely not a common case (IOMMU supporting more page sizes
> than EPT), but should still be fixed for correctness.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

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

end of thread, other threads:[~2020-04-20  2:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 11:29 [PATCH] x86/vtd: relax EPT page table sharing check Roger Pau Monne
2020-04-17 12:06 ` Jan Beulich
2020-04-20  2:41 ` Tian, Kevin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).