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

Re: [PATCH v4 2/3] xen/pci: solve compilation error on ARM with HAS_PCI enabled.


  • To: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 26 Nov 2020 09:05:23 +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=YSRjyHnXyIT9S45rnI/JgSQvqBdzuhnq3nM6vMo9T6w=; b=Q9rvL3SDEO512dWo5VsV3Nklps5hUPosYmUJUrH3EiT90+Dwk8otV6ZcaXal3ZWBv4gaBly6Fb2k8mOoS2J3Eov1aeSzPSKGcpUGz0Xd9dPUPJpxhJsQ+qc9vKrmhBNlTZPBBhtW9mrW4B/daz50zzzLVotqM3DZagdTU5RAAXhY6xdqqR9kZhBFiaAgZBZ0WhFrK/kcYMfwgtjRIIqMxY531v8eVrNrP4LJ4bZ7MEKARyxH7C4p7Wff93vmNCRD00WgpOpNHp+J+nW+boUcQvNFAtH4zb77/2MkcwS8siPAtCZCYZ+bM1UbljLVkYoAlNjHoi7Jd0Js0mmajhWgdg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LjDhftZzRStdlpwgVNv+ZYKkV6p1yjlA1IAaWDvHxYeuuH2JCYiL+1fAOqjVjkf26r2265tVnUccA3oeDWsdDxCSE5rAmgRE4b0UNkPHk8Ys0oelc5e61q3hVuybWFM1+cosR6Xa8vMMf+llz7LijUwvfV37yVLdqBPO6+wXedJ+w2YiRX+m2/fJ9S9nHEFyVg5p5PWCj1nBDz8LEVRa2X1RYxmb0jwqhC6fkECZF9rIgsAhMFoxFZ+CVWygApRHT2vxc0Mmvd1V/54CE7ZoAcaLL0v9kmyw1DgyX498OBDZVc1SiYqkWQplNeuKYrfDskY9AHxbhT+qI2ueenopZA==
  • 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: Thu, 26 Nov 2020 09:06:09 +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: AQHWw1cqKGlzLIMerka7j78FZA7vhanaH92A
  • Thread-topic: [PATCH v4 2/3] xen/pci: solve compilation error on ARM with HAS_PCI enabled.


> On 25 Nov 2020, at 18:16, Rahul Singh <Rahul.Singh@xxxxxxx> wrote:
> 
> If mem-sharing, mem-paging, or log-dirty functionality is not enabled
> for architecture when HAS_PCI is enabled, the compiler will throw an
> error.
> 
> Move code to x86 specific file to fix compilation error.
> 
> Also, modify the code to use likely() in place of unlikley() for each
> condition to make code more optimized.
> 
> No functional change intended.
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

I guess the small typo fix could be fixed by the commiter directly :-)

Cheers
Bertrand 


> ---
> 
> Changes in v4:
> - fixed minor comments
> 
> ---
> 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 3c6ab1bcb6..4c21655b7d 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -20,7 +20,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_use_permitted(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 f17b1820f4..cea1032b3d 100644
> --- a/xen/drivers/passthrough/x86/iommu.c
> +++ b/xen/drivers/passthrough/x86/iommu.c
> @@ -18,6 +18,7 @@
> #include <xen/guest_access.h>
> #include <xen/event.h>
> #include <xen/softirq.h>
> +#include <xen/vm_event.h>
> #include <xsm/xsm.h>
> 
> #include <asm/hvm/io.h>
> @@ -308,6 +309,18 @@ struct page_info *iommu_alloc_pgtable(struct domain *d)
>     return pg;
> }
> 
> +bool arch_iommu_use_permitted(const struct domain *d)
> +{
> +    /*
> +     * Prevent device assign if mem paging, mem sharing or log-dirty
> +     * have been enabled for this domain.
> +     */
> +    return d == dom_io ||
> +           (likely(!mem_sharing_enabled(d)) &&
> +            likely(!vm_event_check_ring(d->vm_event_paging)) &&
> +            likely(!p2m_get_hostp2m(d)->global_logdirty));
> +}
> +
> /*
>  * Local variables:
>  * mode: C
> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
> index 191021870f..056eaa09fc 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 arch_iommu_use_permitted(const 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®.