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

Re: [PATCH v2 4/4] xen/pci: solve compilation error on ARM with HAS_PCI enabled.


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 4 Nov 2020 14:16:16 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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-SenderADCheck; bh=upmY6GkKu4VTBCTd9WqVCDvt18zRTVI/l3y6CIdNFAo=; b=GfqPt/y57mRPnofZxTKgznMvgK36DF3DlZdLgAPA90es6IyDGPGBbl8mkn44CtJB0mf+7NaO5uHBroupGvXpKUhdDF1i+R4CiqVLRcHBvvIDQnPT+OeeswUXITm69BffkOE8C+ccUoTq12tE8mmJs87iYmvCwFqWoVd6YoavFwxgDaxaeoa8Xyt2nyIG8Y5l+v+cNmZD6fpHFAUqKqChqY+crGER/MFlK8HARB76015G1+gDqtNz3uTcEylShd3OCGSXIFcuCs07LzUijMp9xay0ZCjECOl5g4bILHtM9RDS1KC5SMJkfqBxmgaadwauqT1k42cXFgE3l6Cv/2ryFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QRnIUVY1/7cWb+S6d0KgJVf2QpwyEEVmmMuSIkbxxZMHxcVKSQ98Yxpy5pDf3sKaD642trrMnKPwPJ3en1ZCsyo0VEQyPNSCOhdz1LJL7wHhcOUyc0wZUB0lr6yfnoSYTD5xlkzHGURCvd+kkLmABYHpHSkj9mATNZNCgVw7eKr+y3f1cmIbcOJr9monLlqnxwgg0LQ6OvPT2zXUR0vb1oDKyRb8xOdZ8AtghUnQ3wmNTyXlMNoSGJ88OdVxus0GKaJDIjeJUKVN4dE+f5VfshzKy/LxjJshxFO0Dsx6jEndzVnucEYF5P+vtgdSmOSOI/tOC6Blxk1QW15fryJbXg==
  • Authentication-results-original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Wed, 04 Nov 2020 14:16:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWsfqNTWzum2g39UK3EjJMrmB9Oam4BigA
  • Thread-topic: [PATCH v2 4/4] xen/pci: solve compilation error on ARM with HAS_PCI enabled.


> On 3 Nov 2020, at 15:59, Rahul Singh <Rahul.Singh@xxxxxxx> wrote:
> 
> If mem-sharing, mem-paging and log-dirty functionality is not enabled
> for architecture when HAS_PCI is enabled, compiler will throw an error.
> 
> Move code to x86 specific directory to fix compilation error.
> 
> No functional change.
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> 
> Changes in v2:
> - Move mem-sharing , men-paging and log-dirty specific code to x86 directory. 
> 
> ---
> xen/drivers/passthrough/pci.c       |  8 +-------
> xen/drivers/passthrough/x86/iommu.c | 13 +++++++++++++
> xen/include/xen/iommu.h             |  2 ++
> 3 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 04d3e2c0f9..433989e654 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -22,7 +22,6 @@
> #include <xen/iommu.h>
> #include <xen/irq.h>
> #include <xen/param.h>
> -#include <xen/vm_event.h>
> #include <xen/delay.h>
> #include <xen/keyhandler.h>
> #include <xen/event.h>
> @@ -1418,12 +1417,7 @@ static int assign_device(struct domain *d, u16 seg, u8 
> bus, u8 devfn, u32 flag)
>     if ( !is_iommu_enabled(d) )
>         return 0;
> 
> -    /* Prevent device assign if mem paging or mem sharing have been 
> -     * enabled for this domain */
> -    if ( d != dom_io &&
> -         unlikely(mem_sharing_enabled(d) ||
> -                  vm_event_check_ring(d->vm_event_paging) ||
> -                  p2m_get_hostp2m(d)->global_logdirty) )
> +    if( !arch_iommu_usable(d) )
>         return -EXDEV;
> 
>     /* device_assigned() should already have cleared the device for 
> assignment */
> diff --git a/xen/drivers/passthrough/x86/iommu.c 
> b/xen/drivers/passthrough/x86/iommu.c
> index 875e67b53b..b3d151a14c 100644
> --- a/xen/drivers/passthrough/x86/iommu.c
> +++ b/xen/drivers/passthrough/x86/iommu.c
> @@ -23,6 +23,7 @@
> #include <asm/hvm/io.h>
> #include <asm/io_apic.h>
> #include <asm/setup.h>
> +#include <xen/vm_event.h>
> 
> const struct iommu_init_ops *__initdata iommu_init_ops;
> struct iommu_ops __read_mostly iommu_ops;
> @@ -315,6 +316,18 @@ int iommu_update_ire_from_msi(
>            ? iommu_call(&iommu_ops, update_ire_from_msi, msi_desc, msg) : 0;
> }
> 
> +bool_t arch_iommu_usable(struct domain *d)
> +{
> +
> +    /* Prevent device assign if mem paging or mem sharing have been
> +     * enabled for this domain */
> +    if ( d != dom_io && unlikely(mem_sharing_enabled(d) ||
> +                        vm_event_check_ring(d->vm_event_paging) ||
> +                        p2m_get_hostp2m(d)->global_logdirty) )
> +        return false;
> +    else
> +        return true;
> +}
> /*
>  * Local variables:
>  * mode: C
> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
> index 191021870f..493528cee3 100644
> --- a/xen/include/xen/iommu.h
> +++ b/xen/include/xen/iommu.h
> @@ -381,6 +381,8 @@ DECLARE_PER_CPU(bool_t, iommu_dont_flush_iotlb);
> extern struct spinlock iommu_pt_cleanup_lock;
> extern struct page_list_head iommu_pt_cleanup_list;
> 
> +bool_t arch_iommu_usable(struct domain *d);
> +
> #endif /* _IOMMU_H_ */
> 
> /*
> -- 
> 2.17.1
> 




 


Rackspace

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