summaryrefslogtreecommitdiffstats
path: root/sys/arch/arm (follow)
Commit message (Collapse)AuthorAgeFilesLines
* remove uneeded includes in md armv7 filesjsg2021-03-2527-129/+29
| | | | based on include-what-you-use suggestions
* spellingjsg2021-03-113-8/+8
|
* Add some infrastructure in the PCI chipset tag for pci_probe_device_hook()patrick2021-02-251-2/+4
| | | | | | so that we can provide IOMMU-hooked bus DMA tags for each PCI device. ok kettenis@
* remove some unused includesjsg2021-02-231-1/+0
|
* timecounting: use C99-style initialization for all timecounter structscheloha2021-02-232-4/+17
| | | | | | | | | | | | | | | | | | The timecounter struct is large and I think it may change in the future. Changing it later will be easier if we use C99-style initialization for all timecounter structs. It also makes reading the code a bit easier. For reasons I cannot explain, switching to C99-style initialization sometimes changes the hash of the resulting object file, even though the resulting struct should be the same. So there is a binary change here, but only sometimes. No behavior should change in either case. I can't compile-test this everywhere but I have been staring at the diff for days now and I'm relatively confident this will not break compilation. Fingers crossed. ok gnezdo@
* handle "simple-pm-bus" in simplebusjsg2021-02-181-5/+10
| | | | | | | Enables a clock and/or power domain for a group of devices. Required to use linux 5.11 dtbs on am335x and omap4. ok kettenis@
* introduce ujoy(4), a restricted subset of uhid(4) for gamecontrollers.thfr2021-01-231-1/+3
| | | | | | | | This includes ujoy_hid_is_collection() to work around limitations of hid_is_collection() until this can be combined without fallout. input, testing with 8bitdo controller, and ok brynet@ PS4 controller testing, fix for hid_is_collection, and ok mglocker@
* s/KHZ/kHz/ and reduce dmesg spam a bitkettenis2021-01-192-8/+8
| | | | ok tb@, deraadt@
* In case of failure, call sigexit() from trapsignal instead of sensig().mpi2020-11-081-11/+7
| | | | | | | Simplify MD code and reduce the amount of recursion into the signal code which helps when dealing with locks. ok cheloha@, deraadt@
* uvm_grow() no longer needs the KERNEL_LOCK, bring it back to justderaadt2020-10-271-16/+11
| | | | | | around uvm_fault(), and slightly refactor code to be more like on other architectures in snaps for 2 weeks
* replace ad-hoc illegal instruction with the architecturally defined onenaddy2020-10-191-2/+2
| | | | | ("permanently undefined") ok deraadt@ kettenis@
* Set %r0 to EFAULT instead of the return value from uvm_fault() when itkettenis2020-10-191-2/+2
| | | | | | | | | fails and we're doing a copyin/copyout. Fixes a buf where systems calls would return EACCESS instead of EFAULT when accessing userland memory that can't be accessed. ok patrick@
* Add missing calls to uvm_grow(9).phessler2020-09-251-1/+5
| | | | OK deraadt@ kettenis@
* perform the uvm_map_inentry() after the data_aborts handlers are executedderaadt2020-09-141-5/+8
| | | | | | as there is little purpose running them excessively. studied with kettenis while searching for "system registers read after sleeping in trap()"
* Include <sys/systm.h> directly instead of relying on hidden UVM includes.mpi2020-09-113-4/+6
| | | | The header is being pulled via db_machdep.h -> uvm_extern.h -> uvm_map.h
* Declare hw_{prod,serial,uuid,vendor,ver} in <sys/systm.h>.visa2020-08-261-3/+1
| | | | OK deraadt@, mpi@
* Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().mpi2020-08-192-14/+2
| | | | ok kettenis@, visa@
* Remove "for all XXX platforms" from comment. Fixes the issue pointed outkettenis2020-08-141-2/+2
| | | | | | by miod@ where the powerpc64 claimed to be "for all AArch64 platforms". ok patrick@
* Implement pci_intr_establish_cpu() on arm64 and armv7. The function pointerpatrick2020-07-141-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@
* Extend the interrupt API on arm64 and armv7 to be able to pass aroundpatrick2020-07-143-21/+31
| | | | | | | | | | | | | | | | | | | | | | | | 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@
* Use the full 32 bits for the miscellaneous armv7 timecounters.naddy2020-07-122-4/+4
| | | | | | | | | Checked against * ARM Architecture Reference Manual (agtimer) * ARM Cortex-A9 MPCore Technical Reference Manual (amptimer) * OMAP35x Applications Processor Technical Reference Manual (gptimer) Artturi Alm had independently suggested this in the past.
* do not need these versions of timetc.hderaadt2020-07-081-23/+0
|
* IEEE1275 (Open Firmware) defines that parameter name strings can have akettenis2020-07-061-53/+11
| | | | | | | | | | | | | | | | | | | | | | length of up to 31 characters. This limit is also present in the flattened device tree specification/ Unfortunately this limit isn't enforced by the tooling and there are systems in the wild that use longer strings. This includes the device trees used on POWER9 systems and has been seen on some ARM systems as well. So bump the buffer size from 32 bytes (31 + terminating NUL) to 64 bytes. Centrally define OFMAXPARAM to this value (in <dev/ofw/openfirm.h>) replacing the various OPROMMAXPARAM definition scattered around the tree to make sure the FDT implementation of OF_nextprop() uses the same buffer size as its consumers. Eliminate the static buffer in various openprom(4) implementations on FDT systems. Makes it possible to dump the full device tree on POWER9 systems using eeprom -p. ok deraadt@, visa@
* Add support for timeconting in userland.pirofti2020-07-062-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* wire up kstat(4)dlg2020-07-061-2/+3
| | | | "looks right" deraadt@
* Remove obsolete <machine/stdarg.h> header. Nowadays the varargvisa2020-06-301-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@
* introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.dlg2020-05-311-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.
* Oops, DDB wrapper around setjmp/longjmp was misplacedderaadt2020-05-181-2/+2
|
* Add machdep.compatible.kettenis2020-05-172-3/+20
| | | | ok jsg@
* Put setjmp+longjmp inside #ifdef DDB the only kernel-side user.deraadt2020-05-171-1/+3
| | | | This shrinks the ramdisks a tiny bit.
* Fix WITNESS buildkn2020-05-171-2/+3
| | | | | | | | | | | | | | sparc64 (and arm mem.c) are the only architectures/places where RWLOCK_INITIALIZER() is used with static function variables, all other (mem.c) usages place it into the global scope. Fix builds with WITNESS enabled for sparc64 and arm by moving physlock into global scope: mem.c:93: error: initializer element is not constant mem.c:93: error: (near initialization for 'physlock.rwl_lock_obj.lo_type') OK visa
* Make inittodr() and resettodr() MI.kettenis2020-05-161-93/+1
| | | | | ok deraadt@, mpi@, visa@ ok cheloha@ as well (would have preferred in new file for this code)
* Initialize the timeval passed to todr_gettime() with the base time fromkettenis2020-05-111-1/+4
| | | | | | | the file system such that implementations can use it to guess the right century. ok mpi@
* Let the armv7 bus_dma layer and simplebus(4) implementation deal withkettenis2020-04-296-185/+103
| | | | | | | | | | | 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@
* Bring inittodr()/resettodr() in line with arm64 and move it tokettenis2020-04-271-1/+90
| | | | | | arrm32_machdep.c. ok mpi@
* Remove an unnecessary type cast.visa2020-03-191-2/+2
| | | | OK kettenis@
* Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt2020-03-132-3/+11
| | | | | | | problems as 64-bit models. All syscall instructions ("swi 0") now have a nop;nop after them. We make the kernel skip over these when returning, so that we can (soon) change the nops into a speculation barrier. ok kettenis
* Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt2020-03-113-3/+9
| | | | | | | | | | problems as 64-bit models. "movs pc, lr" is the pre-VM legacy eret and as such also requires speculation blockers. Idiomatically spray "dsb nsh; ish" after each such occurance because it is cheap. (I find it very interesting 2/3 of these occur at end of a .o, so the instructions speculatively executed are from a randomly different .o file after each kernel relink...) ok kettenis
* In the sigtramp the fallback SYS_exit always works, there is no reasonderaadt2020-03-111-6/+2
| | | | | to spin trying things. ok kettenis
* Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt2020-03-111-1/+3
| | | | | | problems as 64-bit models. After every eret, there must be a speculation barrier. ok kettenis
* correct data 16-bit aligned block of in4_cksum()jsg2020-02-281-2/+2
| | | | | | | | alex14fr at gmail reported qemu-system-arm -M virt with vio(4) failed rx checksums. The mi netinet/in4_cksum.c and the xscale path removed in in_cksum_arm.S 1.6 worked, for now just fix one line of assembly. ok kettenis@
* wire up pppac(4) to some majors on each arch.dlg2020-01-231-1/+2
| | | | | | | | i was lazy and just put them at the end of the existing set. fyi, i think major 51 is free on all archs if anyone is looking for another one. ok claudio@
* Import dt(4) a driver and framework for Dynamic Profiling.mpi2020-01-211-2/+3
| | | | | | | | | | | The design is fairly simple: events, in the form of descriptors on a ring, are being produced in any kernel context and being consumed by a userland process reading /dev/dt. Code and hooks are all guarded under '#if NDT > 0' so this commit shouldn't introduce any change as long as dt(4) is disable in GENERIC. ok kettenis@, visa@, jasper@, deraadt@
* Implement cpu_kick() and cpu_unidle().kettenis2020-01-122-3/+25
|
* Remove redundant BPIALL instructions (since ICIALLU already invalidates thekettenis2020-01-061-4/+1
| | | | | | BP cache if necessary). ok patrick@
* Rewrite the armv7 context switch code. The new code is much closer to thekettenis2020-01-061-131/+36
| | | | | | | arm64 version and fixes some (but not all) remaining issues with SMP support on armv7. ok visa@, patrick@
* Convert boolean_t/TRUE/FALSE to int/1/0 for coherency with the rest ofmpi2019-12-192-38/+37
| | | | | | the kernel. ok patrick@
* typoderaadt2019-12-181-2/+2
|
* Add fido(4), a HID driver for FIDO/U2F security keysreyk2019-12-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | While FIDO/U2F keys were already supported by the generic uhid(4) driver, this driver adds the first step to tighten the security of FIDO/U2F access. Specifically, users don't need read/write access to all USB/HID devices anymore and the driver also improves integration with pledge(2) and unveil(2): It is pledge-friendly because it doesn't require any ioctls to discover the device and unveil-friendly because it uses a single /dev/fido/* directory for its device nodes. It also allows to support FIDO/U2F in firefox without further weakening the "sandbox" of the browser. Firefox does not have a proper privsep design and many operations, such as U2F access, are handled directly by the main process. This means that the browser's "fat" main process needs direct read/write access to all USB HID devices, at least on other operating systems. With fido(4) we can support security keys in Firefox under OpenBSD without such a compromise. With this change, libfido2 stops using the ioctl to query the device vendor/product and just assumes "OpenBSD" "fido(4)" instead. The ioctl is still supported but there was no benefit in obtaining the vendor product or name; it also allows to use libfido2 under pledge. With feedback from deraadt@ and many others OK kettenis@ djm@ and jmc@ for the manpage bits
* Retguard will start using sections named ".openbsd.randomdata.retguard.*"guenther2019-11-091-2/+6
| | | | | | | | | | | | | and not just ".openbsd.randomdata.retguard". Accept both in the kernel ldscripts so that they're placed together between the __retguard_{start,end} symbols. Similarly, match not just ".openbsd.randomdata" but also ".openbsd.randomdata.*" to pick up other random (pun intended) items. While here, stub in those retguard bits into all the ldscripts. ok deraadt@