mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Julien Grall <julien.grall@citrix.com>
Cc: <xen-devel@lists.xenproject.org>,
	<linux-arm-kernel@lists.infradead.org>, <ian.campbell@citrix.com>,
	<stefano.stabellini@eu.citrix.com>,
	<linux-kernel@vger.kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	David Vrabel <david.vrabel@citrix.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	<x86@kernel.org>
Subject: Re: [PATCH 1/2] xen/swiotlb: Pass addresses rather than frame numbers to xen_arch_need_swiotlb
Date: Thu, 10 Sep 2015 17:29:52 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1509101718400.2672@kaball.uk.xensource.com> (raw)
In-Reply-To: <1441892562-22059-2-git-send-email-julien.grall@citrix.com>

On Thu, 10 Sep 2015, Julien Grall wrote:
> With 64KB page granularity support, the frame number will be different.
> 
> It will be easier to modify the behavior in a single place rather than
> in each caller.
> 
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
> 

Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> ---
>  arch/arm/include/asm/xen/page.h | 4 ++--
>  arch/arm/xen/mm.c               | 7 +++++--
>  arch/x86/include/asm/xen/page.h | 4 ++--
>  drivers/xen/swiotlb-xen.c       | 4 ++--
>  4 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
> index e3d94cf..415dbc6 100644
> --- a/arch/arm/include/asm/xen/page.h
> +++ b/arch/arm/include/asm/xen/page.h
> @@ -115,8 +115,8 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
>  #define xen_unmap(cookie) iounmap((cookie))
>  
>  bool xen_arch_need_swiotlb(struct device *dev,
> -			   unsigned long pfn,
> -			   unsigned long bfn);
> +			   phys_addr_t phys,
> +			   dma_addr_t dev_addr);
>  unsigned long xen_get_swiotlb_free_pages(unsigned int order);
>  
>  #endif /* _ASM_ARM_XEN_PAGE_H */
> diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
> index 6dd911d..7b517e91 100644
> --- a/arch/arm/xen/mm.c
> +++ b/arch/arm/xen/mm.c
> @@ -138,9 +138,12 @@ void __xen_dma_sync_single_for_device(struct device *hwdev,
>  }
>  
>  bool xen_arch_need_swiotlb(struct device *dev,
> -			   unsigned long pfn,
> -			   unsigned long bfn)
> +			   phys_addr_t phys,
> +			   dma_addr_t dev_addr)
>  {
> +	unsigned long pfn = PFN_DOWN(phys);
> +	unsigned long bfn = PFN_DOWN(dev_addr);
> +
>  	return (!hypercall_cflush && (pfn != bfn) && !is_device_dma_coherent(dev));
>  }
>  
> diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
> index 2a05e691..84c4757 100644
> --- a/arch/x86/include/asm/xen/page.h
> +++ b/arch/x86/include/asm/xen/page.h
> @@ -296,8 +296,8 @@ void make_lowmem_page_readwrite(void *vaddr);
>  #define xen_unmap(cookie) iounmap((cookie))
>  
>  static inline bool xen_arch_need_swiotlb(struct device *dev,
> -					 unsigned long pfn,
> -					 unsigned long bfn)
> +					 phys_addr_t phys,
> +					 dma_addr_t dev_addr);
>  {
>  	return false;
>  }
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index d757a3e..cfe755d 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -398,7 +398,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
>  	 */
>  	if (dma_capable(dev, dev_addr, size) &&
>  	    !range_straddles_page_boundary(phys, size) &&
> -		!xen_arch_need_swiotlb(dev, PFN_DOWN(phys), PFN_DOWN(dev_addr)) &&
> +		!xen_arch_need_swiotlb(dev, phys, dev_addr) &&
>  		!swiotlb_force) {
>  		/* we are not interested in the dma_addr returned by
>  		 * xen_dma_map_page, only in the potential cache flushes executed
> @@ -557,7 +557,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
>  		dma_addr_t dev_addr = xen_phys_to_bus(paddr);
>  
>  		if (swiotlb_force ||
> -		    xen_arch_need_swiotlb(hwdev, PFN_DOWN(paddr), PFN_DOWN(dev_addr)) ||
> +		    xen_arch_need_swiotlb(hwdev, paddr, dev_addr) ||
>  		    !dma_capable(hwdev, dev_addr, sg->length) ||
>  		    range_straddles_page_boundary(paddr, sg->length)) {
>  			phys_addr_t map = swiotlb_tbl_map_single(hwdev,
> -- 
> 2.1.4
> 

  reply	other threads:[~2015-09-10 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 13:42 [PATCH 0/2] xen/swiotlb: Add support for 64KB page granularity, Julien Grall
2015-09-10 13:42 ` [PATCH 1/2] xen/swiotlb: Pass addresses rather than frame numbers to xen_arch_need_swiotlb Julien Grall
2015-09-10 16:29   ` Stefano Stabellini [this message]
2015-09-10 13:42 ` [PATCH 2/2] xen/swiotlb: Add support for 64KB page granularity Julien Grall
2015-09-10 16:30   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1509101718400.2672@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®