summaryrefslogtreecommitdiff
path: root/sys/arch/arm
AgeCommit message (Collapse)Author
2018-08-08Extend the FDT interrupt API to support masking and unmasking IRQs.Patrick Wildt
Discussed with kettenis@
2018-08-06Make it possible to build a MULTIPROCESSOR kernel on armv7. While thisMark Kettenis
doesn't actually spin up any secondary CPUs, it does run. Mostly a cleanup of <machine/cpu.h> along the lines of what I did earlier on arm64. Makes armv7 use the MI mplock implementation and implements copyin32. ok patrick@
2018-08-06Give the FDT interrupt API a more generic naming by replacing thePatrick Wildt
arm_intr_* prefix with fdt_intr_*. ok kettenis@
2018-07-10Move from sendsig() to its callers the initsiginfo() calls andPhilip Guenther
instead of passing sendsig() the code+type+val, pass a siginfo_t* to copy from. Eliminate the indirection through struct emul for sendsig(); we no longer have a SunOS4-compat version of sendsig() ok deraadt@
2018-07-09Add PCI machdep headers based on the arm64 port.Patrick Wildt
ok kettenis@
2018-07-09Implement ampintcmsi(4) in ampintc(4) to support MSI. The GICv2M is anPatrick Wildt
extension to the GIC controller, which is represented as subnode in the device tree. There can be multiple GICv2Ms, so it makes sense to attach those to ampintc(4) as some kind of simplebus. The GICv2M is simply an interrupt generator that can be used by PCIe devices to ring the door bell. There is no need for further configuration, we only need to find out which SPIs we are allowed to use for MSI and to register an edge triggered interrupt on a (randomly) allocated SPI. Implement support for interrupt types. The GIC only seems to support level triggered active-high or egdge triggered low-to-high interrupts. We currently always configure them to be level triggered, which is a sane default for most controllers. Since MSI interupts on the GIC are edge triggered, we need to be able to parse the type information and to configure the interrupt correspondingly. ok kettenis@
2018-06-30Remove strange /* End of file */ style.Theo de Raadt
2018-06-26Make ast() call refreshcreds(). Tweak this code to be similar to the amd64.Mark Kettenis
ok phessler@, guenther@
2018-06-23Save and restore FPU registers around signal handlers.Mark Kettenis
Fixes the random crashes in sh(1). ok guenther@
2018-06-22Move up the setting of pcb_tf, refreshcreds(), and stack check so thatPhilip Guenther
we can be sure signals posted from userret() are based on the correct information ok kettenis@
2018-06-22Update the pointer to the trapframe in the PCB when handling an AST.Mark Kettenis
From drahn@, ok guenther@
2018-06-22Save and restore the relevant FPU state on armv7.Mark Kettenis
ok deraadt@
2018-06-04Remove the cpu_reset_needs_v4_MMU_disable flag; it's always true for hardwareMark Kettenis
that OpenBSD runs on. ok patrick@
2018-06-03Remove #ifdef __XSCALE__ bits. No binary change.Mark Kettenis
ok deraadt@
2018-05-15Remove a4x bus space hack.Mark Kettenis
ok patrick@
2018-05-07Use speed from device tree for serial console on armv7 too.Mark Kettenis
ok visa@, patrick@
2018-05-04Add a common rules file for ofw sources to help keep the configurationsVisa Hankala
of fdt-enabled platforms in sync. OK deraadt@
2018-04-12Implement MAP_STACK option for mmap(). Synchronous faults (pagefault andTheo de Raadt
syscall) confirm the stack register points at MAP_STACK memory, otherwise SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified to create a MAP_STACK sub-region which satisfies alignment requirements. Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the contents of the region -- there is no mprotect() equivalent operation, so there is no MAP_STACK-adding gadget. This opportunistic software-emulation of a stack protection bit makes stack-pivot operations during ROPchain fragile (kind of like removing a tool from the toolbox). original discussion with tedu, uvm work by stefan, testing by mortimer ok kettenis
2018-03-20To allow sharing more code between armv7 and arm64 platforms, introducePatrick Wildt
a common bus space tag that can be used for early console attachment. ok kettenis@
2018-03-20Do not panic from ddb(4) when a lock requirement isn't fulfilled.Martin Pieuchot
Extend the logic already present for panic() to any DDB-related operation such that if ddb(4) is entered because of a fault or other trap it is still possible to call 'boot reboot'. While here stop printing splassert() messages as well, to not fill the buffer. ok visa@, deraadt@
2018-03-16Make FPU registers available in core dumps and through ptrace(2).Mark Kettenis
ok visa@, patrick@
2018-03-08Rework and cleanup the linker script for armv7. The main feature isPatrick Wildt
that it gives us a read-only data section. In addition the linker script is now easily diffable to arm64 and we also stop mapping some unnecessary space before the kernel. Prompted by deraadt@ ok kettenis@
2018-03-05Do not redefine PAGE_SHIFT/PAGE_SIZE/PAGE_MASK in vmparam.h; thoseTheo de Raadt
definitions are already found in param.h ok jsg
2018-03-05#define _MAX_PAGE_SHIFT in MD _types.h as the maximum pagesize an archTheo de Raadt
needs (looking at you sgi, but others required this before). This is for the circumstances we need pagesize known at compile time, not getpagesize() runtime. Use it for malloc storage sizes, for shm, and to set pthread stack default sizes. The stack sizes were a mess, and pushing them towards page-aligned is healthy move (which will also be needed by the coming stack register checker) ok guenther kettenis, discussion with stefan
2018-03-01AAPCS requires 8-byte alignment for 64-bit types. We missed this when weMark Kettenis
did the big EABI switch. Do it now before we get into trouble with using floating-point and vector instructions that actually require things to be properly aligned. This breaks the ABI. In particular, file descriptor passing will be broken if kernel and userland are not in sync. Upgrading from a snap is highly recommended. ok otto@, patrick@, jsg@, phessler@, deraadt@
2018-02-28Explicitly align svcstack and esym. Finally fixes the problem whereMark Kettenis
kernels wouldn't boot because the random order in which we happened to link it would cause these symbols to be misaligned. Thanks to Brandon Bergren for figuring out the problem.
2018-02-25Typo: auxilliary -> auxiliaryPhilip Guenther
2018-02-23Get rid of the cpu_on_fn hook and call the psci(4) functions directly insteadMark Kettenis
like we already do in the code that flushes the BTB. ok jsg@
2018-02-19Remove almost unused `flags' argument of suser().Martin Pieuchot
The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
2018-02-11Rework the DDB trace handling for armv7. By switching to clang thePatrick Wildt
stack frame format has changed. Apparently AAPCS doesn't specify at all what a stack frame looks like. We end up with much simpler code, but also with a lot less information in the trace. ok kettenis@
2018-02-10Convert armv7 to MI mutex.Martin Pieuchot
Tested by jsg@, ok patrick@
2018-02-10Replace two spaces indents with tabs. Makes it easier to read andPatrick Wildt
especially makes it easier to diff against our other linker scripts. ok jsg@
2018-02-10Supplying entropy from etext has created a regression on arm where wePatrick Wildt
get an alignment fault while copying the data. Turns out that since we have .rodata in the text segment, it's very easily possible that etext remains unaligned. Work around this by word-aligning etext. The next step is to split .rodata out of the text segment. ok deraadt@
2018-02-10Put the ldscript parts into a single file instead of storing it as headPatrick Wildt
and tail and cat(1) it together. It was maybe needed when ports needed different contents, but now it's just a headache. ok deraadt@
2018-02-06Make sure sigfillsiz is word aligned.Patrick Wildt
ok kettenis@
2018-01-26Add kernel support for the VFP FPU/SIMD unit. Based on a diff by drahn@.Mark Kettenis
This allows us to use floating-pointer and vector instructions in userland code. The current implementation assumes all 32 VFP registers are present. This should be the case on all armv7 hardware currently supported by OpenBSD. ok patrick@
2018-01-23Revise 'struct fpreg' such that it can actually represent the full VFPv3-D32Mark Kettenis
state. ok patrick@
2018-01-15Improve defense against branch predictor target injection (Spectre "variant 2")Mark Kettenis
attacks. OpenBSD/armv7 is already in pretty good shape as we have always been flushing the branch predictor cache on context switches. This diff adds additional flushes to page faults in kernel address space. The impact on performance should be minimal as these page faults should only happen when userland (deliberately or accidentally) tries to access kernel addres space which would lead to a fatal signal (SIGSEGV or SIGBUS). Loosely based on changes made by Marc Zyngier in Linux and based on information in Arm Trusted Firmware Security Advisory TFV 6. Note that for Cortex-A15 (and Cortex-A72) you will need firmware that sets the ACTRL[0] bit for this diff to be effective. Also note that with this diff Cortex-A57 is still vulnerable. ok jsg@
2018-01-11Add size for free.Visa Hankala
OK mpi@
2017-12-30Delete unnecessary <sys/file.h> includesPhilip Guenther
ok millert@ krw@
2017-12-29Use register_t instead of uint32_t in smc/hmc calls such that argumentsMark Kettenis
to SMC64 functions don't get truncated. Implement support for the CPU_ON call.
2017-12-24For systems where the cpu node in the device tree has a "clocks" property,Mark Kettenis
implement hw.cpuspeed using the clock framework. ok patrick@
2017-12-14fcntl(F_SETFL) invokes the FIONBIO and FIOASYNC ioctls internally, soPhilip Guenther
the memory devices (/dev/null, /dev/zero, etc) need to permit them. problem noted, tweak, and testing by jeremy@ ok deraadt@
2017-12-11In uvm Chuck decided backing store would not be allocated proactivelyTheo de Raadt
for blocks re-fetchable from the filesystem. However at reboot time, filesystems are unmounted, and since processes lack backing store they are killed. Since the scheduler is still running, in some cases init is killed... which drops us to ddb [noted by bluhm]. Solution is to convert filesystems to read-only [proposed by kettenis]. The tale follows: sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT() with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a copyin() late... so store the sizes in vfsconflist[] and move the copyin() to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill legacy struct nfs_args3. Next we learn ffs_mount()'s MNT_UPDATE code is sharp and rusty especially wrt softdep, so fix some bugs adn add ~MNT_SOFTDEP to the downgrade. Some vnodes need a little more help, so tie them to &dead_vnops. ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but this issue is seperate and will be dealt with in time. couple hundred reboots by bluhm and myself, advice from guenther and others at the hut
2017-10-26Discard exception handling information as we do on other architectures.Mark Kettenis
ok patrick@, deraadt@
2017-10-01set MAXSSIZ to the same value as on all other architectures (32MB)Christian Weisgerber
ok deraadt@
2017-09-11Remove whitespace in inline assembly output constraint strings. WhileJonathan Gray
gcc is documented as ignoring whitespace in any position but the first clang gives "error: invalid output constraint '=r ' in asm".
2017-09-08If you use sys/param.h, you don't need sys/types.hTheo de Raadt
2017-09-05Move mutex, condvar, and thread-specific data routes, pthread_once, andPhilip Guenther
pthread_exit from libpthread to libc, along with low-level bits to support them. Major bump to both libc and libpthread. Requested by libressl team. Ports testing by naddy@ ok kettenis@
2017-08-27Add glass console support for arm64. This uses the "stdout-path" propertyMark Kettenis
of the /chosen node in the device tree to decide whether the framebuffer should be used as the console device. Most, if not all, machines will have that set to use a serial console and there is no easy way yet to change that. ok jsg@