summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
AgeCommit message (Collapse)Author
2016-09-15all pools have their ipl set via pool_setipl, so fold it into pool_init.David Gwynne
the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
2016-09-10take it one step further and bring the message inline with arm/sparc64Jasper Lievisse Adriaanse
pointed out by guenther@
2016-09-09don't hardcode the filename in an error message; use the function name insteadJasper Lievisse Adriaanse
ok jsg@ (who spotted the powerpc straggler too) millert@
2016-09-04Telling gcc the TCB pointer is in %r2 via the 'register asm' extensionPhilip Guenther
tests out on powerpc and generates slightly better code
2016-09-03Increase the number of mbufs on most architectures. This is basedAlexander Bluhm
on a guess how much memory a typical machine has. If the value is too high, users may run out of kernel memory. Then we will have to adjust this again. OK claudio@ deraadt@
2016-06-07consistently set ipls on pmap pools.David Gwynne
this is a step toward making ipls unconditionaly on pools. ok deraadt@ kettenis@
2016-05-10SROP mitigation. sendsig() stores a (per-process ^ &sigcontext) cookieTheo de Raadt
inside the sigcontext. sigreturn(2) checks syscall entry was from the exact PC addr in the (per-process ASLR) sigtramp, verifies the cookie, and clears it to prevent sigcontext reuse. not yet tested on landisk, sparc, *88k, socppc. ok kettenis
2016-05-07Flush page (through the direct map) before mapping it into AGP. FixesMark Kettenis
artifacts seen in X on some G5 machines. Unfortunately not enough to fix G4 machines. With help from Marcus Glocker. ok mpi@
2016-05-07Use a Thread Information Block in both single and multi-threaded programs.Philip Guenther
This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
2016-04-27G/C DDB_REGS.Martin Pieuchot
2016-03-19Reduces the noise around the global ``ticks'' variable by renamingMartin Pieuchot
all the local ones to ``nticks''. ok stefan@, deraadt@
2016-03-06DDB_REGS -> ddb_regsMartin Pieuchot
2016-03-05One ddb interface is enough for ppc.Martin Pieuchot
2016-03-05Define db_reg_t like the other archs by typedef'ing "struct trapframe".Martin Pieuchot
This will allow us to use some of the DDB macros on trapframe which are not DDB_REGS.
2016-03-02DDB_REGS -> ddb_regs in db_regs[], no reason to be different.Martin Pieuchot
2015-11-24The only network driver needing <net/if_types.h> is upl(4) for IFT_OTHER.Martin Pieuchot
2015-10-08Add a per-page flag to indicate that all mappings of that page should beMark Kettenis
uncached. To be used in the drm code. ok mpi@
2015-09-26lint is dead and C99 may be old enough to drive a car: delete LONGLONGPhilip Guenther
comments ok millert@
2015-09-21Fix membar positioning in mtx_enter_try() and (critically!) mtx_leave()Mark Kettenis
Same diff as guenther@ committed for alpha. ok guenther@
2015-09-13intr_barrier(9) for macppc and socppc.Mark Kettenis
2015-09-11Make the powerpc pmap (more) mpsafe by protecting both the pmap itself and theMark Kettenis
pv lists with a mutex. This should make pmap_enter(9), pmap_remove(9) and pmap_page_protect(9) safe to use without holding the kernel lock. ok visa@, mpi@, deraadt@
2015-09-08Give the pool page allocator backends more sensible names. We now have:Mark Kettenis
* pool_allocator_single: single page allocator, always interrupt safe * pool_allocator_multi: multi-page allocator, interrupt safe * pool_allocator_multi_ni: multi-page allocator, not interrupt-safe ok deraadt@, dlg@
2015-09-06size for free()Theo de Raadt
2015-09-01Sync bus_dmamap_load_raw(9) with amd64/i386 in order to respect theMartin Pieuchot
segement size constraint. Make xhci(4) work on my G5. ok dlg@
2015-08-30Provide remaining arch with END() macro for setting calculated size onPhilip Guenther
symbols in ASM ok deraadt@ mpi@
2015-08-29_NLIST_DO_ELF is no longer needed: it's the only optionPhilip Guenther
ok deraadt@
2015-08-23Add support for the Secure-PLT ABI variant. This will give us better W^XMark Kettenis
support on powerpc as it uses a non-executable GOT and PLT. "start slamming stuff in" deraadt@
2015-08-14replace the asm mutexes with a c implementation.David Gwynne
there's no real functional advantage to this, except that it will make it easier to add deadlock detection to the code. this is modelled on the c mutex implementation thats on alpha, mips64, and hppa. ok mpi@ kettenis@
2015-07-2917 years ago, setfault() was modified to save the status register in theMiod Vallat
faultbuf. But 1/ sr was only restored for machine check exceptions, and 2/ the way it was saved was unsafe if interrupts were enabled, and could cause %r2 to be lost. Discussing this with deraadt@ at the end of c2k15, this was probably needed for the old VI boards which were the target of the original powerpc port, came with a worse-than-Genesi openfirmware. Since then, machine check exceptions have been unheard of; or, if they happen, they do not need the status register to be restored. ok mpi@ deraadt@
2015-07-20Make pmap_remove() grab the kernel lock. This is a big hammer but makes MPMark Kettenis
machines work again with the unlocked reaper. ok mpi@, deraadt@ no objection from miod@
2015-07-17remove obsolete INET kernel optionTed Unangst
2015-07-02introduce srp, which according to the manpage i wrote is short forDavid Gwynne
"shared reference pointers". srp allows concurrent access to a data structure by multiple cpus while avoiding interlocking cpu opcodes. it manages its own reference counts and the garbage collection of those data structure to avoid use after frees. internally srp is a twisted version of hazard pointers, which are a relative of RCU. jmatthew wrote the bulk of a hazard pointer implementation and changed bpf to use it to allow mpsafe access to bpfilters. however, at s2k15 we were trying to apply it to other data structures but the memory overhead of every hazard pointer would have blown out significantly in several uses cases. a bulk of our time at s2k15 was spent reworking hazard pointers into srp. this diff adds the srp api and adds the necessary metadata to struct cpuinfo on our MP architectures. srp on uniprocessor platforms has alternate code that is optimised because it knows there'll be no concurrent access to data by multiple cpus. srp is made available to the system via param.h, so it should be available everywhere in the kernel. the docs likely need improvement cos im too close to the implementation. ok mpi@
2015-06-26remove __cpu_cas and use atomic_cas_ulong instead.David Gwynne
ok mpi@
2015-06-26rename the guard #define from _MACHINE_MPLOCK_H_ to _POWERPC_MPLOCK_H_David Gwynne
2015-06-26move the ppc mplock implementation from macppc to powerpc.David Gwynne
ok mpi@
2015-06-24IPL_MPSAFE bits for macppc with openpic(4).Martin Pieuchot
2015-06-05Add bits missed in previous... I suck at cvs.Martin Pieuchot
2015-06-05Finally protect VP lookups to guarantee that a pted won't be freed orMartin Pieuchot
reused by a CPU while another CPU is manipulating it. This races occurs because the virtual spill handlers are run without taking the KERNEL_LOCK for obvious reasons. So use a per-pmap mutex that CPUs must hold when modifying a pted in order to guarantee the atomicity of operations *and* the coherence between pmap VPs tree and what's in the HASH. Thanks to dlg@ for assisting me debugging this. This change ends your PowerPC pmap SMP show of the week. GENERIC.MP on macppc should now be stable enough to build ports without corrupting its own memory. ok kettenis@, deraadt@, dlg@
2015-06-05Don't try to be clever when unrolling the loop in pmap_remove().Martin Pieuchot
Needed for upcoming locking.
2015-06-05Replace the per-entry locks by a global HASH lock.Martin Pieuchot
Since this lock is recursive we can now guarantee the atomicity of pte_inser{32,64}() when a pted has to be removed first. This fixes one of the races. Using a __mp_lock here also allowed dlg@ to provide me useful traces to fix the next race. Thanks for your help! ok kettenis@, deraadt@, dlg@
2015-06-05Call pte_spill_v() from the real mode fault handler instead of rerollingMartin Pieuchot
it. This will reduce the number of places to audit for locking. Note that for profiling purposes pte_spill_v() is now marked a __noprof since per-CPU profiling buffers are not guaranteed to be 1:1 mapped and cannot be accessed from the real mode fault handler. ok kettenis@, deraadt@, dlg@
2015-06-05Rewrite PTE manipulation routines to better match the PEM.Martin Pieuchot
Document every operation, make sure to call "sync" when appropriate so that other CPUs see the bit changes and finally grab a lock where it was missing to grantee atomicity. ok kettenis@, deraadt@, dlg@
2015-06-05Split pteclrbits() into pmap_{test,clear}_attrs().Martin Pieuchot
This should not introduce any behavior change but makes the code easier to read and later easier to protect. This also brings this pmap closer to what others do. Thanks to kettenis@ for spotting a bad typo! ok kettenis@, deraadt@, dlg@
2015-06-05More usages of pmap_ptedinhash().Martin Pieuchot
If you wonder why pte_insert{32,64}() is not using pmap_hash_remove() if it finds a conflicting PTE in the HASH, it's because in the current state trying to grab the same lock a second time would lead to a deadlock. This is much easier to reproduce on G5 (or G4 with BAT disabled). ok kettenis@, deraadt@, dlg@
2015-06-05Remove DEBUG stuff.Martin Pieuchot
2015-06-05Make use of ptesr() instead of rerolling it.Martin Pieuchot
2015-06-05Merge various copies of the same code into a new function to determineMartin Pieuchot
if a PTE is present in the HASH. Note that atomicity is currently not guaranteed between this check and the following operations. ok kettenis@, deraadt@, dlg@
2015-06-05Introduce pmap_pted_ro() a simple wrapper for the 32/64 bits versionsMartin Pieuchot
that does not call pmap_vp_lookup(). Carreful readers would have notice the removal of the bits on the virtual address with a page mask, this change allows me to find the 13 years old bug fixed in r1.145. ok kettenis@, deraadt@, dlg@
2015-06-05Do only one VP lookup when removing a page.Martin Pieuchot
This simplify pmap_remove() & friends by re-using an already fetched PTE descriptor. There's currently a race on MP system where one CPU can reuse a pted while another one is still trying to insert it in the HASH. This commit starts reducing the number of pmap_vp_lookup() calls to help fix this race. ok kettenis@, deraadt@, dlg@
2015-06-05Remove the MANAGED flag when removing a PV entry.Martin Pieuchot
Even if this change is not strickly needed, because the memory will be returned to the pool it helped me track the use-after-free.