Subject: linux-next: manual merge of the tip tree with the mm-unstable tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 15 May 2025 15:11:02 +1000

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  arch/x86/mm/pat/memtype.c

between commit:

  f387f960a89a ("x86/mm/pat: factor out setting cachemode into pgprot_set_cachemode()")

from the mm-unstable tree and commit:

  1b3f2bd04d90 ("x86/devmem: Remove duplicate range_is_allowed() definition")

from the tip tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/mm/pat/memtype.c
index ccc55c00b4c8,c97b527c66fe..000000000000
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@@ -773,39 -775,6 +775,12 @@@ pgprot_t phys_mem_access_prot(struct fi
  	return vma_prot;
  }
  
- #ifdef CONFIG_STRICT_DEVMEM
- /* This check is done in drivers/char/mem.c in case of STRICT_DEVMEM */
- static inline int range_is_allowed(unsigned long pfn, unsigned long size)
- {
- 	return 1;
- }
- #else
- /* This check is needed to avoid cache aliasing when PAT is enabled */
- static inline int range_is_allowed(unsigned long pfn, unsigned long size)
- {
- 	u64 from = ((u64)pfn) << PAGE_SHIFT;
- 	u64 to = from + size;
- 	u64 cursor = from;
- 
- 	if (!pat_enabled())
- 		return 1;
- 
- 	while (cursor < to) {
- 		if (!devmem_is_allowed(pfn))
- 			return 0;
- 		cursor += PAGE_SIZE;
- 		pfn++;
- 	}
- 	return 1;
- }
- #endif /* CONFIG_STRICT_DEVMEM */
- 
 +static inline void pgprot_set_cachemode(pgprot_t *prot, enum page_cache_mode pcm)
 +{
 +	*prot = __pgprot((pgprot_val(*prot) & ~_PAGE_CACHE_MASK) |
 +			 cachemode2protval(pcm));
 +}
 +
  int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
  				unsigned long size, pgprot_t *vma_prot)
  {