Oleksandr,

Oleksandr Tyshchenko <[email protected]> writes:

> From: Oleksandr Tyshchenko <[email protected]>
>
> All IOMMU drivers on Arm perform almost the same generic actions in
> hwdom_init callback. Move this code to common arch_iommu_hwdom_init()
> in order to get rid of code duplication.
>
> Signed-off-by: Oleksandr Tyshchenko <[email protected]>

Reviewed-by: Volodymyr Babchuk <[email protected]>

> ---
>  xen/drivers/passthrough/arm/iommu.c      |  7 +++++++
>  xen/drivers/passthrough/arm/ipmmu-vmsa.c |  8 --------
>  xen/drivers/passthrough/arm/smmu-v3.c    | 10 ----------
>  xen/drivers/passthrough/arm/smmu.c       | 10 ----------
>  4 files changed, 7 insertions(+), 28 deletions(-)
>
> diff --git a/xen/drivers/passthrough/arm/iommu.c 
> b/xen/drivers/passthrough/arm/iommu.c
> index ee653a9..fc45318 100644
> --- a/xen/drivers/passthrough/arm/iommu.c
> +++ b/xen/drivers/passthrough/arm/iommu.c
> @@ -134,6 +134,13 @@ void arch_iommu_domain_destroy(struct domain *d)
>  
>  void __hwdom_init arch_iommu_hwdom_init(struct domain *d)
>  {
> +    /* Set to false options not supported on ARM. */
> +    if ( iommu_hwdom_inclusive )
> +        printk(XENLOG_WARNING "map-inclusive dom0-iommu option is not 
> supported on ARM\n");
> +    iommu_hwdom_inclusive = false;
> +    if ( iommu_hwdom_reserved == 1 )
> +        printk(XENLOG_WARNING "map-reserved dom0-iommu option is not 
> supported on ARM\n");
> +    iommu_hwdom_reserved = 0;
>  }
>  
>  /*
> diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c 
> b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> index 32609f8..451fc21 100644
> --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> @@ -1336,14 +1336,6 @@ static int ipmmu_iommu_domain_init(struct domain *d)
>  
>  static void __hwdom_init ipmmu_iommu_hwdom_init(struct domain *d)
>  {
> -    /* Set to false options not supported on ARM. */
> -    if ( iommu_hwdom_inclusive )
> -        printk(XENLOG_WARNING "ipmmu: map-inclusive dom0-iommu option is not 
> supported on ARM\n");
> -    iommu_hwdom_inclusive = false;
> -    if ( iommu_hwdom_reserved == 1 )
> -        printk(XENLOG_WARNING "ipmmu: map-reserved dom0-iommu option is not 
> supported on ARM\n");
> -    iommu_hwdom_reserved = 0;
> -
>      arch_iommu_hwdom_init(d);
>  }
>  
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> b/xen/drivers/passthrough/arm/smmu-v3.c
> index d115df7..ca8b5c7 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -3404,16 +3404,6 @@ static int arm_smmu_iommu_xen_domain_init(struct 
> domain *d)
>  
>  static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d)
>  {
> -     /* Set to false options not supported on ARM. */
> -     if (iommu_hwdom_inclusive)
> -             printk(XENLOG_WARNING
> -             "map-inclusive dom0-iommu option is not supported on ARM\n");
> -     iommu_hwdom_inclusive = false;
> -     if (iommu_hwdom_reserved == 1)
> -             printk(XENLOG_WARNING
> -             "map-reserved dom0-iommu option is not supported on ARM\n");
> -     iommu_hwdom_reserved = 0;
> -
>       arch_iommu_hwdom_init(d);
>  }
>  
> diff --git a/xen/drivers/passthrough/arm/smmu.c 
> b/xen/drivers/passthrough/arm/smmu.c
> index c9dfc4c..ec18df7 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -2851,16 +2851,6 @@ static int arm_smmu_iommu_domain_init(struct domain *d)
>  
>  static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d)
>  {
> -     /* Set to false options not supported on ARM. */
> -     if ( iommu_hwdom_inclusive )
> -             printk(XENLOG_WARNING
> -             "map-inclusive dom0-iommu option is not supported on ARM\n");
> -     iommu_hwdom_inclusive = false;
> -     if ( iommu_hwdom_reserved == 1 )
> -             printk(XENLOG_WARNING
> -             "map-reserved dom0-iommu option is not supported on ARM\n");
> -     iommu_hwdom_reserved = 0;
> -
>       arch_iommu_hwdom_init(d);
>  }


-- 
Volodymyr Babchuk at EPAM

Reply via email to