Skip to contentSkip to conversation

arm64: mm: move _PAGE_IOREMAP into pgtable-prot.h

PATCH NAK Kefeng Wang 2 participants 2 messages Jun 2, 2023 – Jun 5, 2023 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: mm: move _PAGE_IOREMAP into pgtable-prot.h

Szőke Kálmán Benjamin reported to me a build issue on an out-of-tree module(from Xilinx[1]), which directly include <asm-generic/io.h>,

"undefined reference" error for _PAGE_IOREMAP

In general, the module shouldn't include the low-level header file, it should be fixed, but _PAGE_IOREMAP definination is kind of pgtable prot, let's move it into pgtable-prot.h to put togethor with other prot.

[1] https://github.com/Xilinx/XilinxVirtualCable/blob/master/zynqMP/src/driver/xvc_driver.c

---
 arch/arm64/include/asm/io.h           | 2 --
 arch/arm64/include/asm/pgtable-prot.h | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm64/include/asm/io.h +0 -2
index 877495a0fd0c..0b0b12a95051 100644
@@ -142,8 +142,6 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
 bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot);
 #define ioremap_allowed ioremap_allowed
 
-#define _PAGE_IOREMAP PROT_DEVICE_nGnRE
-
 #define ioremap_wc(addr, size)	\
 	ioremap_prot((addr), (size), PROT_NORMAL_NC)
 #define ioremap_np(addr, size)	\
arch/arm64/include/asm/pgtable-prot.h +1 -0
index 9b165117a454..f79afbad26a0 100644
@@ -64,6 +64,7 @@ extern bool arm64_use_ng_mappings;
 #define PROT_SECT_NORMAL_EXEC	(PROT_SECT_DEFAULT | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))
 
 #define _PAGE_DEFAULT		(_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
+#define _PAGE_IOREMAP		PROT_DEVICE_nGnRE
 
 #define PAGE_KERNEL		__pgprot(PROT_NORMAL)
 #define PAGE_KERNEL_RO		__pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
Signature · 1 line
2.35.3
#1 lore raw
Quoted 2 lines · Kefeng Wang

Szőke Kálmán Benjamin reported to me a build issue on an out-of-tree module(from Xilinx[1]), which directly include <asm-generic/io.h>,

Err. Not one should do that, and we certainly should not cater to such crap.

NAK.

Quoted 42 lines

"undefined reference" error for _PAGE_IOREMAP

In general, the module shouldn't include the low-level header file, it should be fixed, but _PAGE_IOREMAP definination is kind of pgtable prot, let's move it into pgtable-prot.h to put togethor with other prot.

[1] https://github.com/Xilinx/XilinxVirtualCable/blob/master/zynqMP/src/driver/xvc_driver.c

---
 arch/arm64/include/asm/io.h           | 2 --
 arch/arm64/include/asm/pgtable-prot.h | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm64/include/asm/io.h +0 -2
index 877495a0fd0c..0b0b12a95051 100644
@@ -142,8 +142,6 @@ extern void __memset_io(volatile void __iomem *, int, size_t);
 bool ioremap_allowed(phys_addr_t phys_addr, size_t size, unsigned long prot);
 #define ioremap_allowed ioremap_allowed
 
-#define _PAGE_IOREMAP PROT_DEVICE_nGnRE
-
 #define ioremap_wc(addr, size)	\
 	ioremap_prot((addr), (size), PROT_NORMAL_NC)
 #define ioremap_np(addr, size)	\
arch/arm64/include/asm/pgtable-prot.h +1 -0
index 9b165117a454..f79afbad26a0 100644
@@ -64,6 +64,7 @@ extern bool arm64_use_ng_mappings;
 #define PROT_SECT_NORMAL_EXEC	(PROT_SECT_DEFAULT | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))
 
 #define _PAGE_DEFAULT		(_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
+#define _PAGE_IOREMAP		PROT_DEVICE_nGnRE
 
 #define PAGE_KERNEL		__pgprot(PROT_NORMAL)
 #define PAGE_KERNEL_RO		__pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
Signature · 1 line
2.35.3

---end quoted text---

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel