File tree Expand file tree Collapse file tree 5 files changed +22
-33
lines changed
Expand file tree Collapse file tree 5 files changed +22
-33
lines changed Original file line number Diff line number Diff line change @@ -109,4 +109,20 @@ extern unsigned long vm_map_base;
109109 */
110110#define PHYSADDR (a ) ((_ACAST64_(a)) & TO_PHYS_MASK)
111111
112+ /*
113+ * On LoongArch, I/O ports mappring is following:
114+ *
115+ * | .... |
116+ * |-----------------------|
117+ * | pci io ports(16K~32M) |
118+ * |-----------------------|
119+ * | isa io ports(0 ~16K) |
120+ * PCI_IOBASE ->|-----------------------|
121+ * | .... |
122+ */
123+ #define PCI_IOBASE ((void __iomem *)(vm_map_base + (2 * PAGE_SIZE)))
124+ #define PCI_IOSIZE SZ_32M
125+ #define ISA_IOSIZE SZ_16K
126+ #define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
127+
112128#endif /* _ASM_ADDRSPACE_H */
Original file line number Diff line number Diff line change 77
88#define ARCH_HAS_IOREMAP_WC
99
10- #include <linux/compiler.h>
1110#include <linux/kernel.h>
1211#include <linux/types.h>
1312
1413#include <asm/addrspace.h>
15- #include <asm/bug.h>
16- #include <asm/byteorder.h>
1714#include <asm/cpu.h>
1815#include <asm/page.h>
1916#include <asm/pgtable-bits.h>
2017#include <asm/string.h>
2118
22- /*
23- * On LoongArch, I/O ports mappring is following:
24- *
25- * | .... |
26- * |-----------------------|
27- * | pci io ports(64K~32M) |
28- * |-----------------------|
29- * | isa io ports(0 ~16K) |
30- * PCI_IOBASE ->|-----------------------|
31- * | .... |
32- */
33- #define PCI_IOBASE ((void __iomem *)(vm_map_base + (2 * PAGE_SIZE)))
34- #define PCI_IOSIZE SZ_32M
35- #define ISA_IOSIZE SZ_16K
36- #define IO_SPACE_LIMIT (PCI_IOSIZE - 1)
37-
3819/*
3920 * Change "struct page" to physical address.
4021 */
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ static inline int pfn_valid(unsigned long pfn)
9595
9696#endif
9797
98- #define virt_to_pfn (kaddr ) PFN_DOWN(virt_to_phys((void *)( kaddr) ))
98+ #define virt_to_pfn (kaddr ) PFN_DOWN(PHYSADDR( kaddr))
9999#define virt_to_page (kaddr ) pfn_to_page(virt_to_pfn(kaddr))
100100
101101extern int __virt_addr_valid (volatile void * kaddr );
Original file line number Diff line number Diff line change 5959#include <linux/mm_types.h>
6060#include <linux/mmzone.h>
6161#include <asm/fixmap.h>
62- #include <asm/io.h>
6362
6463struct mm_struct ;
6564struct vm_area_struct ;
@@ -145,7 +144,7 @@ static inline void set_p4d(p4d_t *p4d, p4d_t p4dval)
145144 * p4d = p4dval ;
146145}
147146
148- #define p4d_phys (p4d ) virt_to_phys((void *) p4d_val(p4d))
147+ #define p4d_phys (p4d ) PHYSADDR( p4d_val(p4d))
149148#define p4d_page (p4d ) (pfn_to_page(p4d_phys(p4d) >> PAGE_SHIFT))
150149
151150#endif
@@ -188,7 +187,7 @@ static inline pmd_t *pud_pgtable(pud_t pud)
188187
189188#define set_pud (pudptr , pudval ) do { *(pudptr) = (pudval); } while (0)
190189
191- #define pud_phys (pud ) virt_to_phys((void *) pud_val(pud))
190+ #define pud_phys (pud ) PHYSADDR( pud_val(pud))
192191#define pud_page (pud ) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
193192
194193#endif
@@ -221,7 +220,7 @@ static inline void pmd_clear(pmd_t *pmdp)
221220
222221#define set_pmd (pmdptr , pmdval ) do { *(pmdptr) = (pmdval); } while (0)
223222
224- #define pmd_phys (pmd ) virt_to_phys((void *) pmd_val(pmd))
223+ #define pmd_phys (pmd ) PHYSADDR( pmd_val(pmd))
225224
226225#ifndef CONFIG_TRANSPARENT_HUGEPAGE
227226#define pmd_page (pmd ) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
Original file line number Diff line number Diff line change 22/*
33 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
44 */
5- #include <linux/compiler.h>
6- #include <linux/elf-randomize.h>
7- #include <linux/errno.h>
5+ #include <linux/export.h>
86#include <linux/mm.h>
97#include <linux/mman.h>
10- #include <linux/export.h>
11- #include <linux/personality.h>
12- #include <linux/random.h>
13- #include <linux/sched/signal.h>
14- #include <linux/sched/mm.h>
158
169unsigned long shm_align_mask = PAGE_SIZE - 1 ; /* Sane caches */
1710EXPORT_SYMBOL (shm_align_mask );
@@ -120,6 +113,6 @@ int __virt_addr_valid(volatile void *kaddr)
120113 if ((vaddr < PAGE_OFFSET ) || (vaddr >= vm_map_base ))
121114 return 0 ;
122115
123- return pfn_valid (PFN_DOWN (virt_to_phys (kaddr )));
116+ return pfn_valid (PFN_DOWN (PHYSADDR (kaddr )));
124117}
125118EXPORT_SYMBOL_GPL (__virt_addr_valid );
You can’t perform that action at this time.
0 commit comments