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

Re: [PATCH V3 2/2] iommu/arm: Remove code duplication in all IOMMU drivers


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Fri, 28 Jan 2022 10:11:22 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fuG/PccR1TLXTUgY3vQA/s5khnbwFBufd/AeSVguk7Y=; b=jmB3AzJc5MrDYdT3GCqDMbn033AJxEQS35BFh1E4SmZVCaIE25ilyw5wKiRkivUX3i8phtnvRyujNzjeFVNX+SUWdBns+DPtiXzsjgScVbxfOYz7oyk47Z5QDLDlNtPbUUpTiPSgXaaH+UyZHlxpvmgtdPQ5M+39b5u0DzjfsK1XsbxBXvq8UGyR+S5cmOl16OzOMV2I6C88SUohLDxlJEM+Q6EuiRg9kTzvM3a6GMDoWEBMp5avHboQPv43QvCGRDJw1CiIZZ6e5HtOsZ62zGFhCQ7pyYK3nd5pH5pmz5yrlXkrtRUg/vI70Z6AWzrTvy6tv3sulI0pkVBH4iXU1Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k/jTVvhz3Eyw3kIzXZ6OmjYlOtE02bXufzAAb86WNPChiLvwS88sAl4QSUgY/Ni7ZEssFzuOuFP9D59mVHGkOzfJijU840+k8HsiHp0hDUUpxWd706LSmMKJabgH9SzcM4umsdWt/X5yrtfSVDeFlVyorU+ZtFU6VFla5L/mA4koKdu/wUGIHi5z65L0A7D7k+s1wpNRJFn8425JukpYsNqWRL+1qDCN/lYMug4u74UCx58tRhxZEETF9In9X4paCISPsToLGba+vAj2hegIlmbYCPtF+7zm2/2tb0HK5rR92PUy02EIdDnY7q9LDtsR+T5Mk0kGIt79Epl7/n/Pgw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
  • Delivery-date: Fri, 28 Jan 2022 10:12:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYE7gPNcv17HiKsEavKTW33N9/cqx4N1uA
  • Thread-topic: [PATCH V3 2/2] iommu/arm: Remove code duplication in all IOMMU drivers

Hi Oleksandr,

> On 27 Jan 2022, at 7:55 pm, Oleksandr Tyshchenko <olekstysh@xxxxxxxxx> wrote:
> 
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> 
> 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 <oleksandr_tyshchenko@xxxxxxxx>
> Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>

Acked-by:: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul
> ---
> Changes V1 -> V2:
>   - add R-b
> 
> Changes V2 -> V3:
>   - drop platform specific *_iommu_hwdom_init(), make .hwdom_init
>     to directly point to the common arch_iommu_hwdom_init()
> ---
> xen/drivers/passthrough/arm/iommu.c      |  7 +++++++
> xen/drivers/passthrough/arm/ipmmu-vmsa.c | 15 +--------------
> xen/drivers/passthrough/arm/smmu-v3.c    | 17 +----------------
> xen/drivers/passthrough/arm/smmu.c       | 17 +----------------
> 4 files changed, 10 insertions(+), 46 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 c912120..d2572bc 100644
> --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> @@ -1329,19 +1329,6 @@ static int ipmmu_iommu_domain_init(struct domain *d)
>     return 0;
> }
> 
> -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);
> -}
> -
> static void ipmmu_iommu_domain_teardown(struct domain *d)
> {
>     struct ipmmu_vmsa_xen_domain *xen_domain = dom_iommu(d)->arch.priv;
> @@ -1369,7 +1356,7 @@ static void ipmmu_iommu_domain_teardown(struct domain 
> *d)
> static const struct iommu_ops ipmmu_iommu_ops =
> {
>     .init            = ipmmu_iommu_domain_init,
> -    .hwdom_init      = ipmmu_iommu_hwdom_init,
> +    .hwdom_init      = arch_iommu_hwdom_init,
>     .teardown        = ipmmu_iommu_domain_teardown,
>     .iotlb_flush     = ipmmu_iotlb_flush,
>     .iotlb_flush_all = ipmmu_iotlb_flush_all,
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> b/xen/drivers/passthrough/arm/smmu-v3.c
> index d115df7..71b022f 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -3402,21 +3402,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);
> -}
> -
> static void arm_smmu_iommu_xen_domain_teardown(struct domain *d)
> {
>       struct arm_smmu_xen_domain *xen_domain = dom_iommu(d)->arch.priv;
> @@ -3427,7 +3412,7 @@ static void arm_smmu_iommu_xen_domain_teardown(struct 
> domain *d)
> 
> static const struct iommu_ops arm_smmu_iommu_ops = {
>       .init           = arm_smmu_iommu_xen_domain_init,
> -     .hwdom_init             = arm_smmu_iommu_hwdom_init,
> +     .hwdom_init             = arch_iommu_hwdom_init,
>       .teardown               = arm_smmu_iommu_xen_domain_teardown,
>       .iotlb_flush            = arm_smmu_iotlb_flush,
>       .iotlb_flush_all        = arm_smmu_iotlb_flush_all,
> diff --git a/xen/drivers/passthrough/arm/smmu.c 
> b/xen/drivers/passthrough/arm/smmu.c
> index c9dfc4c..b186c28 100644
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -2849,21 +2849,6 @@ static int arm_smmu_iommu_domain_init(struct domain *d)
>       return 0;
> }
> 
> -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);
> -}
> -
> static void arm_smmu_iommu_domain_teardown(struct domain *d)
> {
>       struct arm_smmu_xen_domain *xen_domain = dom_iommu(d)->arch.priv;
> @@ -2874,7 +2859,7 @@ static void arm_smmu_iommu_domain_teardown(struct 
> domain *d)
> 
> static const struct iommu_ops arm_smmu_iommu_ops = {
>     .init = arm_smmu_iommu_domain_init,
> -    .hwdom_init = arm_smmu_iommu_hwdom_init,
> +    .hwdom_init = arch_iommu_hwdom_init,
>     .add_device = arm_smmu_dt_add_device_generic,
>     .teardown = arm_smmu_iommu_domain_teardown,
>     .iotlb_flush = arm_smmu_iotlb_flush,
> -- 
> 2.7.4
> 
> 




 


Rackspace

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