Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: cleanup fixup_bigphys_addr handling

fixup_bigphys_addr is only provided by the alchemy platform. Remove
all the stubs, and ensure we only call it if it is actually implemented.

Also don't bother implementing io_remap_pfn_range if we don't have to,
and move the remaining implementation to alchemy platform code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Christoph Hellwig and committed by
Thomas Bogendoerfer
d3991572 b604d497

+27 -93
+4
arch/mips/Kconfig
··· 92 92 select SYSCTL_EXCEPTION_TRACE 93 93 select VIRT_TO_BUS 94 94 95 + config MIPS_FIXUP_BIGPHYS_ADDR 96 + bool 97 + 95 98 menu "Machine selection" 96 99 97 100 choice ··· 160 157 select CSRC_R4K 161 158 select IRQ_MIPS_CPU 162 159 select DMA_MAYBE_COHERENT # Au1000,1500,1100 aren't, rest is 160 + select MIPS_FIXUP_BIGPHYS_ADDR if PCI 163 161 select SYS_HAS_CPU_MIPS32_R1 164 162 select SYS_SUPPORTS_32BIT_KERNEL 165 163 select SYS_SUPPORTS_APM_EMULATION
+12 -4
arch/mips/alchemy/common/setup.c
··· 72 72 iomem_resource.end = IOMEM_RESOURCE_END; 73 73 } 74 74 75 - #if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_PCI) 75 + #ifdef CONFIG_MIPS_FIXUP_BIGPHYS_ADDR 76 76 /* This routine should be valid for all Au1x based boards */ 77 - phys_addr_t __fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 77 + phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 78 78 { 79 79 unsigned long start = ALCHEMY_PCI_MEMWIN_START; 80 80 unsigned long end = ALCHEMY_PCI_MEMWIN_END; ··· 90 90 /* default nop */ 91 91 return phys_addr; 92 92 } 93 - EXPORT_SYMBOL(__fixup_bigphys_addr); 94 - #endif 93 + 94 + int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long vaddr, 95 + unsigned long pfn, unsigned long size, pgprot_t prot) 96 + { 97 + phys_addr_t phys_addr = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); 98 + 99 + return remap_pfn_range(vma, vaddr, phys_addr >> PAGE_SHIFT, size, prot); 100 + } 101 + EXPORT_SYMBOL(io_remap_pfn_range); 102 + #endif /* CONFIG_MIPS_FIXUP_BIGPHYS_ADDR */
-38
arch/mips/include/asm/mach-au1x00/ioremap.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * include/asm-mips/mach-au1x00/ioremap.h 4 - */ 5 - #ifndef __ASM_MACH_AU1X00_IOREMAP_H 6 - #define __ASM_MACH_AU1X00_IOREMAP_H 7 - 8 - #include <linux/types.h> 9 - 10 - #if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_PCI) 11 - extern phys_addr_t __fixup_bigphys_addr(phys_addr_t, phys_addr_t); 12 - #else 13 - static inline phys_addr_t __fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 14 - { 15 - return phys_addr; 16 - } 17 - #endif 18 - 19 - /* 20 - * Allow physical addresses to be fixed up to help 36-bit peripherals. 21 - */ 22 - static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 23 - { 24 - return __fixup_bigphys_addr(phys_addr, size); 25 - } 26 - 27 - static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size, 28 - unsigned long flags) 29 - { 30 - return NULL; 31 - } 32 - 33 - static inline int plat_iounmap(const volatile void __iomem *addr) 34 - { 35 - return 0; 36 - } 37 - 38 - #endif /* __ASM_MACH_AU1X00_IOREMAP_H */
-5
arch/mips/include/asm/mach-bcm63xx/ioremap.h
··· 4 4 5 5 #include <bcm63xx_cpu.h> 6 6 7 - static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 8 - { 9 - return phys_addr; 10 - } 11 - 12 7 static inline int is_bcm63xx_internal_registers(phys_addr_t offset) 13 8 { 14 9 switch (bcm63xx_get_cpu_id()) {
-5
arch/mips/include/asm/mach-bmips/ioremap.h
··· 4 4 5 5 #include <linux/types.h> 6 6 7 - static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 8 - { 9 - return phys_addr; 10 - } 11 - 12 7 static inline int is_bmips_internal_registers(phys_addr_t offset) 13 8 { 14 9 if (offset >= 0xfff80000)
-9
arch/mips/include/asm/mach-generic/ioremap.h
··· 7 7 8 8 #include <linux/types.h> 9 9 10 - /* 11 - * Allow physical addresses to be fixed up to help peripherals located 12 - * outside the low 32-bit range -- generic pass-through version. 13 - */ 14 - static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 15 - { 16 - return phys_addr; 17 - } 18 - 19 10 static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size, 20 11 unsigned long flags) 21 12 {
-9
arch/mips/include/asm/mach-tx39xx/ioremap.h
··· 7 7 8 8 #include <linux/types.h> 9 9 10 - /* 11 - * Allow physical addresses to be fixed up to help peripherals located 12 - * outside the low 32-bit range -- generic pass-through version. 13 - */ 14 - static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 15 - { 16 - return phys_addr; 17 - } 18 - 19 10 static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size, 20 11 unsigned long flags) 21 12 {
-9
arch/mips/include/asm/mach-tx49xx/ioremap.h
··· 7 7 8 8 #include <linux/types.h> 9 9 10 - /* 11 - * Allow physical addresses to be fixed up to help peripherals located 12 - * outside the low 32-bit range -- generic pass-through version. 13 - */ 14 - static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size) 15 - { 16 - return phys_addr; 17 - } 18 - 19 10 static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size, 20 11 unsigned long flags) 21 12 {
+10 -13
arch/mips/include/asm/pgtable.h
··· 507 507 508 508 #define kern_addr_valid(addr) (1) 509 509 510 - #ifdef CONFIG_PHYS_ADDR_T_64BIT 511 - extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); 512 - 513 - static inline int io_remap_pfn_range(struct vm_area_struct *vma, 514 - unsigned long vaddr, 515 - unsigned long pfn, 516 - unsigned long size, 517 - pgprot_t prot) 518 - { 519 - phys_addr_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); 520 - return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot); 521 - } 510 + /* 511 + * Allow physical addresses to be fixed up to help 36-bit peripherals. 512 + */ 513 + #ifdef CONFIG_MIPS_FIXUP_BIGPHYS_ADDR 514 + phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size); 515 + int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long vaddr, 516 + unsigned long pfn, unsigned long size, pgprot_t prot); 522 517 #define io_remap_pfn_range io_remap_pfn_range 523 - #endif 518 + #else 519 + #define fixup_bigphys_addr(addr, size) (addr) 520 + #endif /* CONFIG_MIPS_FIXUP_BIGPHYS_ADDR */ 524 521 525 522 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 526 523
+1 -1
arch/mips/pci/pci-alchemy.c
··· 52 52 static struct alchemy_pci_context *__alchemy_pci_ctx; 53 53 54 54 55 - /* IO/MEM resources for PCI. Keep the memres in sync with __fixup_bigphys_addr 55 + /* IO/MEM resources for PCI. Keep the memres in sync with fixup_bigphys_addr 56 56 * in arch/mips/alchemy/common/setup.c 57 57 */ 58 58 static struct resource alchemy_pci_def_memres = {