On 04/10/2018 11:45, Paul Durrant wrote:
> This patch adds a new method to the VT-d IOMMU implementation to find the
> MFN currently mapped by the specified DFN along with a wrapper function
> in generic IOMMU code to call the implementation if it exists.
>
> NOTE: This patch only adds a Xen-internal interface. This will be used by
>       a subsequent patch.
>       Another subsequent patch will add similar functionality for AMD
>       IOMMUs.
>
> Signed-off-by: Paul Durrant <[email protected]>
> Reviewed-by: Jan Beulich <[email protected]>
> Reviewed-by: Kevin Tian <[email protected]>
> ---
> Cc: Wei Liu <[email protected]>
> Cc: George Dunlap <[email protected]>
>
> v11:
>  - Fold in patch to change failure semantics (already ack-ed by Kevin).
>
> v10:
>  - Adjust the locking comment.
>
> v9:
>  - Add comment about locking in xen/iommu.h.
>
> v8:
>  - Remove clean-up as this is now done by a prior patch.
>  - Make intel_iommu_lookup_page() return dfn value if using shared EPT
>    or iommu_passthrough is set, as requested by Kevin.
>
> v7:
>  - Re-base and re-name BFN -> DFN.
>  - Add missing checks for shared EPT and iommu_passthrough.
>  - Remove unnecessary initializers and use array-style dereference.
>  - Drop Wei's R-b because of code churn.
>
> v3:
>  - Addressed comments from George.
>
> v2:
>  - Addressed some comments from Jan.
> ---
>  xen/drivers/passthrough/iommu.c     | 11 ++++++++++
>  xen/drivers/passthrough/vtd/iommu.c | 41 
> +++++++++++++++++++++++++++++++++++++
>  xen/drivers/passthrough/vtd/iommu.h |  3 +++
>  xen/include/xen/iommu.h             | 10 +++++++++
>  4 files changed, 65 insertions(+)
>
> diff --git a/xen/drivers/passthrough/vtd/iommu.c 
> b/xen/drivers/passthrough/vtd/iommu.c
> index 9187d50730..f94b522c73 100644
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1833,6 +1833,46 @@ static int __must_check intel_iommu_unmap_page(struct 
> domain *d,
>      return dma_pte_clear_one(d, dfn_to_daddr(dfn));
>  }
>  
> +static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
> +                                   unsigned int *flags)
> +{
> +    struct domain_iommu *hd = dom_iommu(d);
> +    struct dma_pte *page, val;
> +    u64 pg_maddr;
> +
> +    /*
> +     * If VT-d shares EPT page table or if the domain is the hardware
> +     * domain and iommu_passthrough is set then pass back the dfn.
> +     */
> +    if ( iommu_use_hap_pt(d) ||
> +         (iommu_hwdom_passthrough && is_hardware_domain(d)) )
> +        return -EOPNOTSUPP;

The patch as commented no longer behaves in the way described in the
comment, or the v8 requested change.

What is the verdict WRT returning dfn ?

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to