Subject: Re: linux-next: Fixes tags need some work in the dma-mapping-fixes tree

From: Thierry Reding <[email-masked]>
Date: Wed, 23 Jan 2019 11:50:47 +0100

On Wed, Jan 23, 2019 at 07:47:47AM +1100, Stephen Rothwell wrote:
> Hi Christoph,
> 
> In commit
> 
>   702e8ed37bed ("arm64/xen: fix xen-swiotlb cache flushing")

Hi Christoph,

I'm not subscribed to any of the mailing list that the above patch was
reviewed on, so I'm replying here because it is the only reference that
I have.

The above commit breaks the build on 64-bit ARM, like so:

	  CC      drivers/xen/swiotlb-xen.o
	In file included from drivers/xen/swiotlb-xen.c:47:
	arch/arm64/include/asm/xen/page-coherent.h: In function 'xen_dma_map_page':
	arch/arm64/include/asm/xen/page-coherent.h:53:16: error: 'pfn' undeclared (first use in this function)
	  if (pfn_valid(pfn))
			^~~
	arch/arm64/include/asm/xen/page-coherent.h:53:16: note: each undeclared identifier is reported only once for each function it appears in
	arch/arm64/include/asm/xen/page-coherent.h:50:7: warning: unused variable 'local' [-Wunused-variable]
	  bool local = (page_pfn <= dev_pfn) &&
	       ^~~~~

Given that the "local" variable is unused, it seems like maybe a chunk
is missing from the commit and it may have been meant to look like this:

diff --git a/arch/arm64/include/asm/xen/page-coherent.h b/arch/arm64/include/asm/xen/page-coherent.h
index 77e36decc50c..d88e56b90b93 100644
--- a/arch/arm64/include/asm/xen/page-coherent.h
+++ b/arch/arm64/include/asm/xen/page-coherent.h
@@ -50,7 +50,7 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page,
  bool local = (page_pfn <= dev_pfn) &&
   (dev_pfn - page_pfn < compound_pages);

- if (pfn_valid(pfn))
+ if (local)
   dma_direct_map_page(hwdev, page, offset, size, dir, attrs);
  else
   __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs);

Thierry