summaryrefslogtreecommitdiff
path: root/sys/arch/loongson
AgeCommit message (Collapse)Author
2020-06-24kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)cheloha
time_second(9) and time_uptime(9) are widely used in the kernel to quickly get the system UTC or system uptime as a time_t. However, time_t is 64-bit everywhere, so it is not generally safe to use them on 32-bit platforms: you have a split-read problem if your hardware cannot perform atomic 64-bit reads. This patch replaces time_second(9) with gettime(9), a safer successor interface, throughout the kernel. Similarly, time_uptime(9) is replaced with getuptime(9). There is a performance cost on 32-bit platforms in exchange for eliminating the split-read problem: instead of two register reads you now have a lockless read loop to pull the values from the timehands. This is really not *too* bad in the grand scheme of things, but compared to what we were doing before it is several times slower. There is no performance cost on 64-bit (__LP64__) platforms. With input from visa@, dlg@, and tedu@. Several bugs squashed by visa@. ok kettenis@
2020-06-05cpu_rnd_messybits() for mips64Visa Hankala
Use CP0 Count as a basis. Also take noise from virtual memory activity by including BadVAddr. OK deraadt@ dlg@
2020-05-31introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.David Gwynne
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-29dev/rndvar.h no longer has statistical interfaces (removed during variousTheo de Raadt
conversion steps). it only contains kernel prototypes for 4 interfaces, all of which legitimately belong in sys/systm.h, which are already included by all enqueue_randomness() users.
2020-05-27Retire <machine/varargs.h>.Visa Hankala
Nothing uses the header anymore. OK deraadt@ mpi@
2020-05-27Fix pmon_iostrategy()Visa Hankala
If rsize is NULL, do not update the variable. Otherwise the bootloader will crash when it invokes libsa's fchmod(). This lets the bootloader work again after the recent loadrandom() change. The fix should also improve the chances of sysupgrade(8) on loongson. Note that pmon_iostrategy() does not allow writing. fchmod() will fail but does not prevent boot.
2009-07-31By popular demand and peer pressure, check-in work in progress work to supportMiod Vallat
the Yeelong Lemote mips-based netbook. Kernel bits only for now, needs polishing; most of this work done during h2k9 last month, although the porting effort started earlier this year.
2020-05-26increment version numbers, due to recent RB_GOODSEED and fchmod +T changesTheo de Raadt
2020-05-25Use <dev/clock_subr.h> in mcclock(4).Visa Hankala
Tested on Yeeloong. Looks good to miod@
2020-05-25Use <dev/clock_subr.h> in mfokclock(4).Visa Hankala
Looks good to miod@
2009-12-25By popular demand and peer pressure, check-in work in progress work to supportMiod Vallat
the Yeelong Lemote mips-based netbook. Kernel bits only for now, needs polishing; most of this work done during h2k9 last month, although the porting effort started earlier this year.
2009-11-26By popular demand and peer pressure, check-in work in progress work to supportMiod Vallat
the Yeelong Lemote mips-based netbook. Kernel bits only for now, needs polishing; most of this work done during h2k9 last month, although the porting effort started earlier this year.
2020-05-25change wsdisplay attribute type from long to uint32_tJonathan Gray
miod explained it was initially a long as it was thought drivers may need to allocate storage but in practice they don't need more than 32 bits for an attribute. suggested and reviewed by miod@
2020-05-25rename wsdisplay alloc_attr() to pack_attr()Jonathan Gray
Suggested by John Carmack. miod agrees a rename would make sense and explained it was initially thought drivers may need to allocate storage but in practice they don't need more than 32 bits for an attribute. ok mpi@
2020-04-14Fix some of the more esoteric bus_space functions. TheMark Kettenis
bus_space_read_region_n, bus_space_write_region_n and bus_space_set_region_n functions were all broken. Same fix as arm64; Thanks to patrick@ for noting that mips64 had the same code. ok visa@
2020-04-07Abstract the head of knote lists. This allows extending the lists,Visa Hankala
for example, with locking assertions. OK mpi@, anton@
2020-04-06Update my email address.Paul Irofti
2020-03-03Allow loongson boot(8) to read from an ffs2 filesystem. ok deraadt@ visa@Otto Moerbeek
2020-02-20Replace field f_isfd with field f_flags in struct filterops to allowVisa Hankala
adding more filter properties without cluttering the struct. OK mpi@, anton@
2020-02-16Send a resume event to apmd(8), like done by apm(4) and acpi(4)Jeremie Courreges-Anglas
Test & ok visa@. Sadly his Lemote doesn't come back from sleep, with or without this change.
2020-01-23wire up pppac(4) to some majors on each arch.David Gwynne
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@
2020-01-21Import dt(4) a driver and framework for Dynamic Profiling.Martin Pieuchot
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@
2019-12-31Use C99 designated initializers with struct filterops. In addition,Visa Hankala
make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
2019-12-20Convert various boolean_t/TRUE/FALSE to int/1/0 in mips64 memory code.Visa Hankala
OK mpi@
2019-12-20Fix build.Visa Hankala
2019-12-17Add fido(4), a HID driver for FIDO/U2F security keysReyk Floeter
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
2019-11-28Implement a hexdump command in the boot loader. This helps toAlexander Bluhm
inspect the memory layout that the firmware has created. It is especially useful for UEFI debugging. OK deraadt@ kettenis@
2019-11-09Retguard will start using sections named ".openbsd.randomdata.retguard.*"Philip Guenther
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@
2019-11-07The compiler -pg option implies -fno-ret-protector, as we want to disablePhilip Guenther
retguard and similar when profiling. However, that missed all the .S files, as ${PROF} wasn't added when ${NORMAL_S} was converted from direct invocation of ${AS} to instead use ${CC}. Similarly, mcount.o still had retguards as it cannot be built with -pg. So: pass ${PROF} when compiling .S files, and compile "no profiling" files with -fno-ret-protector on archs with retguard. feedback and ok mpi@ mortimer@
2019-10-29Use arc4 to bit-spread the 512-byte random buffer over the .openbsd.randomdataTheo de Raadt
section, which has grown a fair bit with the introduction of retguard. Mortimer discovered the repeated 512-byte sequence as retguard keys, and this resolves the issue. (Chacha does not fit on the media, so 1.5K early drop RC4 is hopefully sufficient in our KARL link universe) Version crank the bootblocks. sysupgrade -s will install new bootblocks. ok djm mortimer
2019-09-05Implement splassert() on mips64.Visa Hankala
2019-09-05Adjust interrupt priority levels on mips64 so that prioritiesVisa Hankala
of soft interrupts are lower than priorities of hard interrupts. This allows the delivery of hard interrupts while soft interrupts are masked.
2019-09-04Remove DST/TIMEZONE options(4) from kernel configs; ok jca@ deraadt@cheloha
2019-08-04crank version, following fchmod changeTheo de Raadt
2019-08-03In the bootblocks, after discovering and opening /bsd.upgrade, fchmod -xTheo de Raadt
so the file cannot be re-executed upon the next boot. This provides a stronger one-shot-upgrade model than the upgrade script's rm /bsd.upgrade. Now various forms of upgrade failure will reboot into /bsd, which is probably more recoverable. Performing fchmod -x depends on (1) use of MI boot.c (not alpha/macppc/sparc64/sgi/octeon) and (2) "can write blocks" functionality in the IO layer. Most architectures have this support now. Two diagnostics "fchmod a-x %s: failed" and "/bsd.upgrade is not u+x" will remain in the tree while refinements happen for some of the laggard architectures. based upon a discussion florian tested in snapshots for more than a week without any complaints
2019-06-21Further improve the filesystem stability of kernel installation by KARL.Theo de Raadt
Use install -F to instead of cp, for fsync(2). Coupled with the new sync(8) in the reorder_kernel script, the window for a incomplete /bsd file on-disk due to a crash has now shrunk substantially. Discussion with kettenis, millert and tedu
2019-05-08Enable ucrcom(4) on all architectures that have uslcom(4).Mark Kettenis
ok deraadt@
2019-04-20libsa's memcpy() is actually memmove(). make a proper memmove(), and giveTheo de Raadt
memcpy() correct behaviour. This also brings the bcopy() macro into line.
2019-04-14Instead of using COPTS=-Oz (and similar) in make environment to forceTheo de Raadt
tightly-built ramdisk kernels, set the option in per-arch Makefile.inc based upon SMALL_KERNEL
2019-04-14Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 toJonathan Gray
linux 4.19.34. Adds support for more Intel hardware: Broxton/Apollo Lake (was is_preliminary in 4.4) Amber Lake (another Kaby Lake refresh) Gemini Lake Coffee Lake Whiskey Lake Cannon Lake (though no hardware with Intel graphics ever shipped) Ice Lake (alpha support, hardware not released) This does not add support for new radeon hardware on the AMD side as newer radeons have a different kernel driver (amdgpu). Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for helping and a bunch of other developers for testing.
2019-04-10crank versionsTheo de Raadt
2019-04-10change marks[] array to uint64_t, so the code can track full 64-bitTheo de Raadt
details from the ELF header instead of faking it. Proposal from mlarkin, tested on most architectures already
2019-04-08crank version; looks good deraadtFlorian Obser
2019-04-01compile fix from visaTed Unangst
2019-04-01fast track ddb> reboot command to skip anything which might panic again.Ted Unangst
ok deraadt
2019-03-17Move intr_barrier(9) to the platform level so that it can be customized.Visa Hankala
2019-01-22flense more trailing whitespacePeter Hessler
2019-01-22remove trailing whitespace in the Laptop Package part of the license text.Peter Hessler
no words or punctation were modified.
2019-01-19Add a pwraction sysctl that controls what the power button does on acpi.Ted Unangst
By default, nothing changes -- shutdown is initiated. But allows turning power button into a sleep button if desired. (grudging) ok from a few parties
2019-01-14Remove obsolete symbols.sort target.Visa Hankala
OK deraadt@