Qi Zheng
14c2ac3681
LoongArch: update local TLB if PTE entry exists
...
Currently, the implementation of update_mmu_tlb() is empty if
__HAVE_ARCH_UPDATE_MMU_TLB is not defined. Then if two threads
concurrently fault at the same page, the second thread that did not win
the race will give up and do nothing. In the LoongArch architecture, this
second thread will trigger another fault, and only updates its local TLB.
Instead of triggering another fault, it's better to implement
update_mmu_tlb() to directly update the local TLB of the second thread.
Just do it.
Link: https://lkml.kernel.org/r/20220929112318.32393-3-zhengqi.arch@bytedance.com
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com >
Suggested-by: Bibo Mao <maobibo@loongson.cn >
Acked-by: Huacai Chen <chenhuacai@loongson.cn >
Cc: Chris Zankel <chris@zankel.net >
Cc: David Hildenbrand <david@redhat.com >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Muchun Song <songmuchun@bytedance.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-10-12 18:51:50 -07:00
Huacai Chen
092e9ebe52
LoongArch: Cleanup headers to avoid circular dependency
...
When enable GENERIC_IOREMAP, there will be circular dependency to cause
build errors. The root cause is that pgtable.h shouldn't include io.h
but pgtable.h need some macros defined in io.h. So cleanup those macros
and remove the unnecessary inclusions, as other architectures do.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn >
2022-08-25 19:34:59 +08:00
Mike Rapoport
418d5dadaf
loongarch: drop definition of PGD_ORDER
...
This is the order of the page table allocation, not the order of a PGD.
Since its always hardwired to 0, simply drop it.
[rppt@linux.ibm.com: drop extra BLANK() line in arch/loongarch/kernel/asm-offsets.c]
Link: https://lkml.kernel.org/r/20220705154708.181258-13-rppt@kernel.org
Link: https://lkml.kernel.org/r/20220703141203.147893-13-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com >
Acked-by: Huacai Chen <chenhuacai@kernel.org >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Dinh Nguyen <dinguyen@kernel.org >
Cc: Guo Ren <guoren@kernel.org >
Cc: Helge Deller <deller@gmx.de >
Cc: James Bottomley <James.Bottomley@HansenPartnership.com >
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Cc: Xuerui Wang <kernel@xen0n.name >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-07-17 17:14:43 -07:00
Mike Rapoport
f05ecc6869
loongarch: drop definition of PUD_ORDER
...
This is the order of the page table allocation, not the order of a PUD.
Since its always hardwired to 0, simply drop it.
Link: https://lkml.kernel.org/r/20220703141203.147893-12-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Dinh Nguyen <dinguyen@kernel.org >
Cc: Guo Ren <guoren@kernel.org >
Cc: Helge Deller <deller@gmx.de >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: James Bottomley <James.Bottomley@HansenPartnership.com >
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Cc: Xuerui Wang <kernel@xen0n.name >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-07-17 17:14:43 -07:00
Mike Rapoport
b7c0f2d454
loongarch: drop definition of PMD_ORDER
...
This is the order of the page table allocation, not the order of a PMD.
Since its always hardwired to 0, simply drop it.
Link: https://lkml.kernel.org/r/20220703141203.147893-11-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Dinh Nguyen <dinguyen@kernel.org >
Cc: Guo Ren <guoren@kernel.org >
Cc: Helge Deller <deller@gmx.de >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: James Bottomley <James.Bottomley@HansenPartnership.com >
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Cc: Xuerui Wang <kernel@xen0n.name >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-07-17 17:14:43 -07:00
Mike Rapoport
1721b412fc
loongarch: drop definition of PTE_ORDER
...
This is the order of the page table allocation, not the order of a PTE.
Since its always hardwired to 0, simply drop it.
Link: https://lkml.kernel.org/r/20220703141203.147893-10-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Dinh Nguyen <dinguyen@kernel.org >
Cc: Guo Ren <guoren@kernel.org >
Cc: Helge Deller <deller@gmx.de >
Cc: Huacai Chen <chenhuacai@kernel.org >
Cc: James Bottomley <James.Bottomley@HansenPartnership.com >
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Cc: Xuerui Wang <kernel@xen0n.name >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-07-17 17:14:43 -07:00
Huacai Chen
501dcbe495
LoongArch: Fix the !THP build
...
Fix the !THP build by making pmd_pfn() available in all configurations.
Because pmd_pfn() is used in mm/page_vma_mapped.c whether or not THP is
configured.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn >
2022-06-25 18:05:58 +08:00
Huacai Chen
d4b6f1562a
LoongArch: Add Non-Uniform Memory Access (NUMA) support
...
Add Non-Uniform Memory Access (NUMA) support for LoongArch. LoongArch
has 48-bit physical address, but the HyperTransport I/O bus only support
40-bit address, so we need a custom phys_to_dma() and dma_to_phys() to
extract the 4-bit node id (bit 44~47) from Loongson-3's 48-bit physical
address space and embed it into 40-bit. In the 40-bit dma address, node
id offset can be read from the LS7A_DMA_CFG register.
Reviewed-by: WANG Xuerui <git@xen0n.name >
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com >
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn >
2022-06-03 20:09:29 +08:00
Huacai Chen
46859ac8af
LoongArch: Add multi-processor (SMP) support
...
LoongArch-based procesors have 4, 8 or 16 cores per package. This patch
adds multi-processor (SMP) support for LoongArch.
Reviewed-by: WANG Xuerui <git@xen0n.name >
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com >
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn >
2022-06-03 20:09:29 +08:00
Huacai Chen
09cfefb7fa
LoongArch: Add memory management
...
Add memory management support for LoongArch, including: cache and tlb
management, page fault handling and ioremap/mmap support.
Reviewed-by: WANG Xuerui <git@xen0n.name >
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com >
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn >
2022-06-03 20:09:28 +08:00