Re: [Xen-devel] [PATCH v8 06/11] propagate IOMMU Device-TLB flush error up to EPT update (top level ones)

2016-06-13 Thread George Dunlap
On Mon, Jun 13, 2016 at 4:17 PM, Xu, Quan  wrote:
> From: Quan Xu 
>
> Propagate the IOMMU Device-TLB flush error up to the ept_set_entry(),
> when VT-d shares EPT page table.
>
> Signed-off-by: Quan Xu 
> Acked-by: Kevin Tian 
> Reviewed-by: Jan Beulich 

Acked-by: George Dunlap 

>
> CC: Jun Nakajima 
> CC: Kevin Tian 
> CC: George Dunlap 
> CC: Jan Beulich 
> CC: Andrew Cooper 
> CC: Feng Wu 
> ---
>  xen/arch/x86/mm/p2m-ept.c   | 2 +-
>  xen/drivers/passthrough/vtd/iommu.c | 6 --
>  xen/include/asm-x86/iommu.h | 3 ++-
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
> index a233194..3098c33 100644
> --- a/xen/arch/x86/mm/p2m-ept.c
> +++ b/xen/arch/x86/mm/p2m-ept.c
> @@ -832,7 +832,7 @@ out:
>   need_modify_vtd_table )
>  {
>  if ( iommu_hap_pt_share )
> -iommu_pte_flush(d, gfn, _entry->epte, order, 
> vtd_pte_present);
> +rc = iommu_pte_flush(d, gfn, _entry->epte, order, 
> vtd_pte_present);
>  else
>  {
>  if ( iommu_flags )
> diff --git a/xen/drivers/passthrough/vtd/iommu.c 
> b/xen/drivers/passthrough/vtd/iommu.c
> index e900019..5366267 100644
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1752,8 +1752,8 @@ static int __must_check intel_iommu_unmap_page(struct 
> domain *d,
>  return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
>  }
>
> -void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
> - int order, int present)
> +int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
> +int order, int present)
>  {
>  struct acpi_drhd_unit *drhd;
>  struct iommu *iommu = NULL;
> @@ -1778,6 +1778,8 @@ void iommu_pte_flush(struct domain *d, u64 gfn, u64 
> *pte,
> order, !present, flush_dev_iotlb) )
>  iommu_flush_write_buffer(iommu);
>  }
> +
> +return 0;
>  }
>
>  static int __init vtd_ept_page_compatible(struct iommu *iommu)
> diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
> index e82a2f0..815d77e 100644
> --- a/xen/include/asm-x86/iommu.h
> +++ b/xen/include/asm-x86/iommu.h
> @@ -27,7 +27,8 @@ int iommu_setup_hpet_msi(struct msi_desc *);
>
>  /* While VT-d specific, this must get declared in a generic header. */
>  int adjust_vtd_irq_affinities(void);
> -void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, int order, int 
> present);
> +int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
> + int order, int present);
>  bool_t iommu_supports_eim(void);
>  int iommu_enable_x2apic_IR(void);
>  void iommu_disable_x2apic_IR(void);
> --
> 1.9.1
>
>
> ___
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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


[Xen-devel] [PATCH v8 06/11] propagate IOMMU Device-TLB flush error up to EPT update (top level ones)

2016-06-13 Thread Xu, Quan
From: Quan Xu 

Propagate the IOMMU Device-TLB flush error up to the ept_set_entry(),
when VT-d shares EPT page table.

Signed-off-by: Quan Xu 
Acked-by: Kevin Tian 
Reviewed-by: Jan Beulich 

CC: Jun Nakajima 
CC: Kevin Tian 
CC: George Dunlap 
CC: Jan Beulich 
CC: Andrew Cooper 
CC: Feng Wu 
---
 xen/arch/x86/mm/p2m-ept.c   | 2 +-
 xen/drivers/passthrough/vtd/iommu.c | 6 --
 xen/include/asm-x86/iommu.h | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index a233194..3098c33 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -832,7 +832,7 @@ out:
  need_modify_vtd_table )
 {
 if ( iommu_hap_pt_share )
-iommu_pte_flush(d, gfn, _entry->epte, order, vtd_pte_present);
+rc = iommu_pte_flush(d, gfn, _entry->epte, order, 
vtd_pte_present);
 else
 {
 if ( iommu_flags )
diff --git a/xen/drivers/passthrough/vtd/iommu.c 
b/xen/drivers/passthrough/vtd/iommu.c
index e900019..5366267 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1752,8 +1752,8 @@ static int __must_check intel_iommu_unmap_page(struct 
domain *d,
 return dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
 }
 
-void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
- int order, int present)
+int iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
+int order, int present)
 {
 struct acpi_drhd_unit *drhd;
 struct iommu *iommu = NULL;
@@ -1778,6 +1778,8 @@ void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
order, !present, flush_dev_iotlb) )
 iommu_flush_write_buffer(iommu);
 }
+
+return 0;
 }
 
 static int __init vtd_ept_page_compatible(struct iommu *iommu)
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/asm-x86/iommu.h
index e82a2f0..815d77e 100644
--- a/xen/include/asm-x86/iommu.h
+++ b/xen/include/asm-x86/iommu.h
@@ -27,7 +27,8 @@ int iommu_setup_hpet_msi(struct msi_desc *);
 
 /* While VT-d specific, this must get declared in a generic header. */
 int adjust_vtd_irq_affinities(void);
-void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, int order, int 
present);
+int __must_check iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte,
+ int order, int present);
 bool_t iommu_supports_eim(void);
 int iommu_enable_x2apic_IR(void);
 void iommu_disable_x2apic_IR(void);
-- 
1.9.1


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