aboutsummaryrefslogtreecommitdiffstats
path: root/arch/nios2/mm (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-05-19mm/fault, arch: Use pagefault_disable() to check for disabled pagefaults in the handlerDavid Hildenbrand1-1/+1
Introduce faulthandler_disabled() and use it to check for irq context and disabled pagefaults (via pagefault_disable()) in the pagefault handlers. Please note that we keep the in_atomic() checks in place - to detect whether in irq context (in which case preemption is always properly disabled). In contrast, preempt_disable() should never be used to disable pagefaults. With !CONFIG_PREEMPT_COUNT, preempt_disable() doesn't modify the preempt counter, and therefore the result of in_atomic() differs. We validate that condition by using might_fault() checks when calling might_sleep(). Therefore, add a comment to faulthandler_disabled(), describing why this is needed. faulthandler_disabled() and pagefault_disable() are defined in linux/uaccess.h, so let's properly add that include to all relevant files. This patch is based on a patch from Thomas Gleixner. Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: David.Laight@ACULAB.COM Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: airlied@linux.ie Cc: akpm@linux-foundation.org Cc: benh@kernel.crashing.org Cc: bigeasy@linutronix.de Cc: borntraeger@de.ibm.com Cc: daniel.vetter@intel.com Cc: heiko.carstens@de.ibm.com Cc: herbert@gondor.apana.org.au Cc: hocko@suse.cz Cc: hughd@google.com Cc: mst@redhat.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: schwidefsky@de.ibm.com Cc: yang.shi@windriver.com Link: http://lkml.kernel.org/r/1431359540-32227-7-git-send-email-dahi@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-04-24nios2: rework cacheLey Foon Tan1-16/+36
- flush dcache before flush instruction cache - remork update_mmu_cache and flush_dcache_page - add shmparam.h Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-20nios2: remove end address checking for initdaLey Foon Tan1-3/+0
Remove the end address checking for initda function. We need to invalidate each address line for initda instruction, from start to end address. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-04-10nios2: fix cache coherency issue when debug with gdbLey Foon Tan1-3/+0
Remove the end address checking for flushda function. We need to flush each address line for flushda instruction, from start to end address. This is because flushda instruction only flush the cache if tag and line fields are matched. Change to use ldwio instruction (bypass cache) to load the instruction that causing trap. Our interest is the actual instruction that executed by the processor, this should be uncached. Note, EA address might be an userspace cached address. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-03-16nios2: mm: do not invoke OOM killer on kernel fault OOMLey Foon Tan1-6/+0
Follow commit 871341023c771ad. Kernel faults are expected to handle OOM conditions gracefully (gup, uaccess etc.), so they should never invoke the OOM killer. Reserve this for faults triggered in user context when it is the only option. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-02-09nios2: Port OOM changes to do_page_fault()Ley Foon Tan1-5/+32
Commit d065bd810b6d ("mm: retry page fault when blocking on disk transfer") and and commit 37b23e0525d3 ("x86,mm: make pagefault killable") The above commits introduced changes into the nios2 pagefault handler for making the page fault handler retryable as well as killable. These changes reduce the mmap_sem hold time, which is crucial during OOM killer invocation. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2015-02-09nios2: fix unhandled signalsChung-Ling Tang1-3/+5
Follow other architectures for user fault handling. Signed-off-by: Chung-Ling Tang <cltang@codesourcery.com> Acked-by: Ley Foon Tan <lftan@altera.com>
2015-01-29vm: add VM_FAULT_SIGSEGV handling supportLinus Torvalds1-0/+2
The core VM already knows about VM_FAULT_SIGBUS, but cannot return a "you should SIGSEGV" error, because the SIGSEGV case was generally handled by the caller - usually the architecture fault handler. That results in lots of duplication - all the architecture fault handlers end up doing very similar "look up vma, check permissions, do retries etc" - but it generally works. However, there are cases where the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV. In particular, when accessing the stack guard page, libsigsegv expects a SIGSEGV. And it usually got one, because the stack growth is handled by that duplicated architecture fault handler. However, when the generic VM layer started propagating the error return from the stack expansion in commit fee7e49d4514 ("mm: propagate error from stack expansion even for guard page"), that now exposed the existing VM_FAULT_SIGBUS result to user space. And user space really expected SIGSEGV, not SIGBUS. To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those duplicate architecture fault handlers about it. They all already have the code to handle SIGSEGV, so it's about just tying that new return value to the existing code, but it's all a bit annoying. This is the mindless minimal patch to do this. A more extensive patch would be to try to gather up the mostly shared fault handling logic into one generic helper routine, and long-term we really should do that cleanup. Just from this patch, you can generally see that most architectures just copied (directly or indirectly) the old x86 way of doing things, but in the meantime that original x86 model has been improved to hold the VM semaphore for shorter times etc and to handle VM_FAULT_RETRY and other "newer" things, so it would be a good idea to bring all those improvements to the generic case and teach other architectures about them too. Reported-and-tested-by: Takashi Iwai <tiwai@suse.de> Tested-by: Jan Engelhardt <jengelh@inai.de> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # "s390 still compiles and boots" Cc: linux-arch@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-08nios2: Build infrastructureLey Foon Tan1-0/+14
This patch adds Makefile and Kconfig files required for building a nios2 kernel. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: DMA mapping APILey Foon Tan1-0/+186
This patch adds support for the DMA mapping API. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: TLB handlingLey Foon Tan1-0/+275
This patch adds the TLB maintenance functions. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: Cache handlingLey Foon Tan1-0/+271
This patch adds functionality required for cache maintenance. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: Process managementLey Foon Tan1-0/+116
This patch adds support for thread creation and context switching. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: Page table managementLey Foon Tan1-0/+74
This patch adds support for page table management. Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: MMU Fault handlingLey Foon Tan2-0/+276
This patch adds support for the handling of the MMU faults (exception entry code introduced by a previous patch, kernel/entry.S). Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: I/O MappingLey Foon Tan1-0/+187
This patch adds several definitions for I/O accessors and ioremap(). Signed-off-by: Ley Foon Tan <lftan@altera.com>
2014-12-08nios2: Memory managementLey Foon Tan2-0/+305
This patch contains the initialisation of the memory blocks, MMU attributes and the memory map. Signed-off-by: Ley Foon Tan <lftan@altera.com>