summaryrefslogtreecommitdiffstats
path: root/sys/arch/arm/include
AgeCommit message (Collapse)AuthorFilesLines
2021-03-11spellingjsg1-2/+2
2021-02-25Add some infrastructure in the PCI chipset tag for pci_probe_device_hook()patrick1-2/+4
so that we can provide IOMMU-hooked bus DMA tags for each PCI device. ok kettenis@
2020-08-14Remove "for all XXX platforms" from comment. Fixes the issue pointed outkettenis1-2/+2
by miod@ where the powerpc64 claimed to be "for all AArch64 platforms". ok patrick@
2020-07-14Implement pci_intr_establish_cpu() on arm64 and armv7. The function pointerpatrick1-3/+8
in the chipset tag for establishing interrupts now takes a struct cpu_info *. The normal pci_intr_establish() macro passes NULL as ci, which indicates that the primary CPU is to be used. The PCI controller drivers can then simply pass the ci on to our arm64/armv7 interrupt establish "framework". Prompted by dlg@ ok kettenis@
2020-07-14Extend the interrupt API on arm64 and armv7 to be able to pass aroundpatrick1-1/+5
a struct cpu_info *. From a driver point of view the fdt_intr_establish_* API now also exist same functions with a *_cpu suffix. Internally the "old" functions now call their *_cpu counterparts, passing NULL as ci. NULL will be interpreted as primary CPU in the interrupt controller code. The internal framework for interrupt controllers has been changed so that the establish methods provided by an interrupt controller function always takes a struct cpu_info *. Some drivers, like imxgpio(4) and rkgpio(4), only have a single interrupt line for multiple pins. On those we simply disallow trying to establish an interrupt on a non-primary CPU, returning NULL. Since we do not have MP yet on armv7, all armv7 interrupt controllers do return NULL if an attempt is made to establish an interrupt on a different CPU. That said, so far there's no way this can happen. If we ever gain MP support, this is a reminder that the interrupt controller drivers have to be adjusted. Prompted by dlg@ ok kettenis@
2020-07-08do not need these versions of timetc.hderaadt1-23/+0
2020-07-06Add support for timeconting in userland.pirofti1-0/+23
This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
2020-06-30Remove obsolete <machine/stdarg.h> header. Nowadays the varargvisa1-56/+0
functionality is provided by <sys/stdarg.h> using compiler builtins. Tested in a ports bulk build on amd64 by naddy@ OK naddy@ mpi@
2020-05-31introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.dlg1-1/+3
rnd.c uses nanotime to get access to some bits that change quickly between events that it can mix into the entropy pool. it doesn't use nanotime to get a monotonically increasing set or ordered and accurate timestamps, it just wants something with bits that change. there's been discussions for years about letting rnd use a clock that's super fast to read, but not necessarily accurate, but it wasn't until recently that i figured out it wasn't interested in time at all, so things like keeping a fast clock coherent between cpu cores or correct according to ntp is unecessary. this means we can just let rnd read the cycle counters on cpus and things will be fine. cpus with cycle counters that vary in their speed and arent kept consistent between cores may even be desirable in this context. so this is the first step in converting rnd.c to reading cycle counter. it copies the nanotime backend to each arch, and they can replace it with something MD as a second step later on. djm@ suggested rnd_messybytes, but we landed on cpu_rnd_messybits. thanks to visa for his eyes. ok deraadt@ visa@ deraadt@ says he will help handle any MD fallout that occurs.
2020-05-17Add machdep.compatible.kettenis1-2/+4
ok jsg@
2020-04-29Let the armv7 bus_dma layer and simplebus(4) implementation deal withkettenis1-24/+5
DMA remapping in the same way as arm64. This relies on the dma-ranges property in the device tree and allows us to get rid of the hack for the Raspberry Pi in the dwctwo(4) driver. Note that this does not include the hack in simplebus(4) that we have on arm64 since firmware that has the dma-ranges is in widespread use now. ok patrick@
2020-01-12Implement cpu_kick() and cpu_unidle().kettenis1-2/+4
2019-12-19Convert boolean_t/TRUE/FALSE to int/1/0 for coherency with the rest ofmpi1-5/+5
the kernel. ok patrick@
2019-11-07Remove get_pc_str_offset(), which has been unused since we switchedpatrick1-7/+1
to clang, where the stack frame format changed significantly. Prompted by guenther@ noticing deprecated ASM warnings ok drahn@
2019-11-07Convert db_addr_t -> vaddr_t but leave the typedef for now.mpi1-3/+3
2019-10-27Add code to spin up secondary CPUs.kettenis1-1/+9
ok jsg@
2019-09-30Synch the cpu match/attach/identify code with arm64. This drops somekettenis2-22/+62
information from dmesg that is no longer relevant to ARMv7 CPUs in favour of printing the full architected cache hierarchy in the same way as we do on arm64. It also is another small step towards SMP support on armv7. ok patrick@
2019-09-23Implement DVFS support.kettenis1-1/+8
ok patrick@
2019-03-13Store whether or not the VFP was active on entering the unhandledpatrick2-3/+3
instruction trap and pass it to the VFP fault handler, so that it knows if we faulted with the VFP active or disabled. Reading the status in the VFP fault handler does not work since at that point the VFP already got disabled. ok kettenis@
2019-01-22flense more trailing whitespacephessler1-5/+5
2019-01-22remove trailing whitespace in the Laptop Package part of the license text.phessler1-4/+4
no words or punctation were modified.
2018-12-05Include srp.h where struct cpu_info uses srp to avoid erroring out whenjsg1-1/+2
including cpu.h machine/intr.h etc without first including param.h when MULTIPROCESSOR is defined. ok visa@
2018-10-02Unify the MD byteswapping code as much as possible across architectures.naddy1-25/+20
Use inline functions instead of GNU C statement expressions, and make them available to userland. With clues from guenther@. ok guenther@ kettenis@
2018-09-14Unify and bump some of the NMBCLUSTERS defines. Some archs had it set toclaudio1-2/+2
4MB which is far too low especially when the platform is able to run MP. New limits are, amd64 = 256M; arm64, mips64, sparc64 = 64M; alpha, arm, hppa, i386, powerpc = 32M; m88k, sh = 8M Still rather conservative numbers but much better than before. At least some hangs of arm64 build boxes was caused by this. OK kettenis@, visa@
2018-08-08Extend the FDT interrupt API to support masking and unmasking IRQs.patrick1-1/+3
Discussed with kettenis@
2018-08-06Make it possible to build a MULTIPROCESSOR kernel on armv7. While thiskettenis2-35/+39
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 thepatrick1-1/+11
arm_intr_* prefix with fdt_intr_*. ok kettenis@
2018-07-09Add PCI machdep headers based on the arm64 port.patrick1-47/+37
ok kettenis@
2018-06-30Remove strange /* End of file */ style.deraadt6-18/+6
2018-06-23Save and restore FPU registers around signal handlers.kettenis1-1/+5
Fixes the random crashes in sh(1). ok guenther@
2018-06-22Save and restore the relevant FPU state on armv7.kettenis1-35/+27
ok deraadt@
2018-05-07Use speed from device tree for serial console on armv7 too.kettenis1-1/+2
ok visa@, patrick@
2018-03-20To allow sharing more code between armv7 and arm64 platforms, introducepatrick1-1/+2
a common bus space tag that can be used for early console attachment. ok kettenis@
2018-03-16Make FPU registers available in core dumps and through ptrace(2).kettenis1-1/+1
ok visa@, patrick@
2018-03-05Do not redefine PAGE_SHIFT/PAGE_SIZE/PAGE_MASK in vmparam.h; thosederaadt1-9/+1
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 archderaadt1-1/+2
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 wekettenis1-2/+2
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-10Convert armv7 to MI mutex.mpi1-72/+2
Tested by jsg@, ok patrick@
2018-01-26Add kernel support for the VFP FPU/SIMD unit. Based on a diff by drahn@.kettenis4-19/+144
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-D32kettenis1-5/+3
state. ok patrick@
2018-01-15Improve defense against branch predictor target injection (Spectre "variant 2")kettenis2-2/+7
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@
2017-10-01set MAXSSIZ to the same value as on all other architectures (32MB)naddy1-2/+2
ok deraadt@
2017-09-05Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther1-5/+1
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" propertykettenis1-1/+5
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@
2017-08-20Add Cortex-A55 and Cortex-A75 part numbers.jsg1-1/+5
2017-08-12remove apmwarn sysctl which is not usedtedu1-3/+3
2017-07-31Use unsigned long instead of uint32_t, which is the appropriate integerkettenis1-3/+3
type for storing pointers in our universe. Avoids an implicit dependence on <sys/types.h>. ok tom@
2017-07-12remove CPU_LIDSUSPEND/machdep.lidsuspendnatano1-3/+3
"fire away!" tedu
2017-06-29kill RCSID macros; discussed with millertderaadt1-5/+1
2017-06-23Unbreak profiling assembly functions in userland by defining thempi1-2/+2
correct prologue if compiled with -DPROF. ok deraadt@