aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc/mm/srmmu.c
AgeCommit message (Collapse)Author
2013-03-31sparc/srmmu: clear trailing edge of bitmap properlyAkinobu Mita
srmmu_nocache_bitmap is cleared by bit_map_init(). But bit_map_init() attempts to clear by memset(), so it can't clear the trailing edge of bitmap properly on big-endian architecture if the number of bits is not a multiple of BITS_PER_LONG. Actually, the number of bits in srmmu_nocache_bitmap is not always a multiple of BITS_PER_LONG. It is calculated as below: bitmap_bits = srmmu_nocache_size >> SRMMU_NOCACHE_BITMAP_SHIFT; srmmu_nocache_size is decided proportionally by the amount of system RAM and it is rounded to a multiple of PAGE_SIZE. SRMMU_NOCACHE_BITMAP_SHIFT is defined as (PAGE_SHIFT - 4). So it can only be said that bitmap_bits is a multiple of 16. This fixes the problem by using bitmap_clear() instead of memset() in bit_map_init() and this also uses BITS_TO_LONGS() to calculate correct size at bitmap allocation time. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: move probe_memory() to srmmu.cSam Ravnborg
Only one user so move it to the file using it. It had nothing to do in fault_32. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: centralize all mmu context handling in srmmu.cSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: beautify srmmu_inherit_prom_mappings()Sam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: use void * in nocache get/freeSam Ravnborg
This allowed to us to kill a lot of casts, with no loss of readability in any places Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: fix coding-style in srmmu.cSam Ravnborg
Fix the most annoying issues that distracts me: - whitespace - missing space after "if" and "while" - spaces around operators and similar simple things. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: sort includes in srmmu.cSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-26sparc32: define a few srmmu functions __initSam Ravnborg
They are only used during early init so lets get rid of them after init to save some RAM. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-27sparc32: srmmu_probe now knows about leon tooSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Daniel Hellstrom <daniel@gaisler.com> Cc: Konrad Eisele <konrad@gaisler.com>
2012-05-22sparc32: use the common implementation of alloc_thread_info_node()Sam Ravnborg
With sun4c removed we can fall-back to the common implementation. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Thomas Gleixner <tglx@linutronix.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-19sparc32: drop unused inline functions in srmmu.cSam Ravnborg
When decelared inline the compiler does not warn about unused functions. But they are not used so drop them. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-19sparc32,leon: move leon mmu functions to leon_mm.cSam Ravnborg
We already have a leaon specific file - so keep all the laon stuff in one place. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Konrad Eisele <konrad@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-15sparc32: Remove cypress cpu support.David S. Miller
It's the one aberration in v8, the only cpu that didn't actually have hardware multiply and divide instructions. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Sam Ravnborg <sam@ravnborg.org>
2012-05-14sparc32: remove runtime btfix supportSam Ravnborg
- remove all uses of btfixup header - remove the btfixup header - remove the btfixup code Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: Move cache and TLB flushes over to method ops.David S. Miller
This eliminated most of the remaining users of btfixup. There are some complications because of the special cases we have for sun4d, leon, and some flavors of viking. It was found that there are no cases where a flush_page_for_dma method was not hooked up to something, so the "noflush" iommu methods were removed. Add some documentation to the viking_sun4d_smp_ops to describe exactly the hardware bug which causes us to need special TLB flushing on sun4d. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: Remove unused declarations in srmmu.cDavid S. Miller
Uses of these went away with the sun4c removal. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: Un-btfixup update_mmu_cache().David S. Miller
The magic Swift SRMMU code in question has not been enabled for something on the order of a decade, and it as well as it's comment is there in the history in case we ever need it again. Therefore all implementations are NOPs and we can kill this stuff off. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: Kill btfixup for xchg()'s 'swap' instruction.David S. Miller
We always have this instruction available, so no need to use btfixup for it any more. This also eradicates the whole of atomic_32.S and thus the __atomic_begin and __atomic_end symbols completely. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: drop btfixup in mmu_context_32.hSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: drop btfixup in pgtable_32.hSam Ravnborg
Only one function left using btfixup. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-13sparc32: drop btfixup in pgalloc_32.hSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup more PTE constants and PTE ops.David S. Miller
pte_{filei,wrprotecti,mkcleani,mkoldi} pte_{mkwrite,mkdirty,mkyoung} Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup pte_{write,dirty,young}iDavid S. Miller
And we can certainly get rid of the const function attributes, there is no way that's needed any longer and no other arch uses this kind of annotation here. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup set_pte, pte_present, mk_pte{_phys,_io}().David S. Miller
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: drop loadmmuSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup pmd_{bad,present}().David S. Miller
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup pgd_{none,bad,present}.David S. Miller
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup PAGE_{NONE,COPY,READONLY,SHARED,KERNEL}.David S. Miller
That lets us also get rid of the run-time initialization of protection_map[] and all the ugly module workarounds for PAGE_KERNEL and PAGE_SHARED to deal with the fact that we can't do btfixups for modular code. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup pmd_page and pte_pfn.David S. Miller
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup {pte,pmd,pgd}_clear().David S. Miller
Also we can remove BTFIXUPCALL_SWAPO0G0 as that is no longer used. This was rather amusing, we were setting the btfixup vectors based upon cpu type but all to the same exact generic srmmu routines. Furthermore, we were inconsistently marking the fixup as either BTFIXUPCALL_SWAPO0G0 or BTFIXUPCALL_NORM. What a mess, glad we could untangle this stuff. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Un-btfixup PGDIR_{SHIFT,SIZE,MASK} {USER_,}PTRS_PER_{PGD,PMD}David S. Miller
Only one set of values exist, the SRMMU ones. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: drop btfixup for check_pgt_cacheSam Ravnborg
It is a noop for srmmu - so use a define as sparc64 does. And drop all sparc callers - no need to confuse our-self be calling a noop function. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: drop btfixup for switch_mmSam Ravnborg
This revealed that the implementation of switch_mm had a bogus extra argument. No harm as said argument was never used - but confusing. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-12sparc32: Trivial removal of sun4c references in comments.David S. Miller
I left some around, like the ones in the openprom headers, since we need to think about which pieces of those datastructures and code we can completely toss now. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: use inline versions of pgprot_noncached, pte_to_pgoff and pgoff_to_pteSam Ravnborg
We no longer have different versions of these so use a few simple static inline functions. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: drop btfixup for alloc_thread_info_node/free_thread_infoSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: drop sun4c user stack checking routineSam Ravnborg
With this we no longer do any run-time patchings of traps. So drop the function + macro to support this. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: drop sun4c stack checking routineSam Ravnborg
And drop run-time patching too. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: drop sun4c window overflow stack checking routineSam Ravnborg
Also drop run-time patching for srmmu Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: drop sun4c specific stack validationSam Ravnborg
This allows us to kill run-time patching for this function too Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-11sparc32: remove sun4c trapsSam Ravnborg
We used to runtime patch the trap table for srmmu. With the removal of sun4c support this is no longer required. With the sun4c trap removed we can remove all the referenced trap handling which is sun4c specific. This also allows us to get rid of the nosun4c.c file that contained only dummy functions/data. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-02-28sparc: Use vsprintf extention %pf with builtin_return_addressJoe Perches
Emit the function name not the address when possible. builtin_return_address() gives an address. When building a kernel with CONFIG_KALLSYMS, emit the actual function name not the address. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-07sparc: Remove unnecessary semicolonsJoe Perches
Semicolons are not necessary after switch/while/for/if braces so remove them. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-03-22mm: NUMA aware alloc_thread_info_node()Eric Dumazet
Add a node parameter to alloc_thread_info(), and change its name to alloc_thread_info_node() This change is needed to allow NUMA aware kthread_create_on_cpu() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: David S. Miller <davem@davemloft.net> Reviewed-by: Andi Kleen <ak@linux.intel.com> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Tejun Heo <tj@kernel.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: David Howells <dhowells@redhat.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-10-09of/sparc: convert various prom_* functions to use phandleAndres Salomon
Rather than passing around ints everywhere, use the phandle type where appropriate for the various functions that talk to the PROM. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-05-25sparc32: Kill none_mask, it's bogus.David S. Miller
For some reason, the pte_none() calculation for srmmu sparc32 chips was masking out the top 4 bits. That doesn't make any sense, as those are just some of the physical bits of the PTE encoding. Furthermore, this mistake breaks things when the offset of of a swap entry has a large enough offset as reported by Тхай Кирилл. Sun4c always set it to zero, so it's really completely useless, kill it. Reported-by: Тхай Кирилл <tkhai@yandex.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-02-20MM: Pass a PTE pointer to update_mmu_cache() rather than the PTE itselfRussell King
On VIVT ARM, when we have multiple shared mappings of the same file in the same MM, we need to ensure that we have coherency across all copies. We do this via make_coherent() by making the pages uncacheable. This used to work fine, until we allowed highmem with highpte - we now have a page table which is mapped as required, and is not available for modification via update_mmu_cache(). Ralf Beache suggested getting rid of the PTE value passed to update_mmu_cache(): On MIPS update_mmu_cache() calls __update_tlb() which walks pagetables to construct a pointer to the pte again. Passing a pte_t * is much more elegant. Maybe we might even replace the pte argument with the pte_t? Ben Herrenschmidt would also like the pte pointer for PowerPC: Passing the ptep in there is exactly what I want. I want that -instead- of the PTE value, because I have issue on some ppc cases, for I$/D$ coherency, where set_pte_at() may decide to mask out the _PAGE_EXEC. So, pass in the mapped page table pointer into update_mmu_cache(), and remove the PTE value, updating all implementations and call sites to suit. Includes a fix from Stephen Rothwell: sparc: fix fallout from update_mmu_cache API change Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-12-02sparc,leon: init_leon srmmu cleanupKristoffer Glembo
Removed unused assignment and capitalized srmmu name for sparc_leon Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-02sparc,leon: Sparc-Leon SMP supportKonrad Eisele
Support SMP for a Sparc-Leon multiprocessor system. Add Leon specific SMP code to arch/sparc/kernel/leon_smp.c. Signed-off-by: Konrad Eisele <konrad@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>