summaryrefslogtreecommitdiff
path: root/sys/arch
AgeCommit message (Collapse)Author
2020-09-12asmc0 -> asmc*Marcus Glocker
Now that asmc(4) attaches through acpi(4), other than with isa(4), acpi(4) could attach multiple SMC chips in theory, even though in practice there will be only one SMC chip per machine. Suggested and ok kettenis@
2020-09-12Make asmc(4) attach through acpi(4) instead of isa(4).Marcus Glocker
This e.g. makes the driver also work on iMac11,2. ok kettenis@, jung@
2020-09-11Include <sys/systm.h> directly instead of relying on hidden UVM includes.Martin Pieuchot
The header is being pulled via db_machdep.h -> uvm_extern.h -> uvm_map.h
2020-09-10Introduce a helper to find a VCPU.Martin Pieuchot
from jordan@
2020-09-10Add I2C bus scan routine for octiic(4)Visa Hankala
Unfortunately, machines tend to come with underpopulated device trees, and consequently this change is not very useful as is. The lack of good data is troublesome especially with things like I2C bus switches.
2020-09-10Register octiic(4) with the I2C frameworkVisa Hankala
This generally is an exercise in futility because the phandle of the controller node tends to be missing.
2020-09-09Make ogx(4)'s outbound bpf(4) tap actually workVisa Hankala
2020-09-08Clean up attachment of octgmx(4) a bitVisa Hankala
2020-09-08Handle AGL interfaceVisa Hankala
This makes certain machines' management network port usable.
2020-09-07Add a proper VSID allocation scheme for userland segments.Mark Kettenis
2020-09-06amd64: add tsc_delay(), a delay(9) implementation based on the TSCcheloha
In preparation for running the lapic timer in oneshot mode on amd64 we need a replacement for lapic_delay(). Using the lapic timer itself to implement delay(9) when the timer is not running in periodic mode is complicated if not outright impossible. Meanwhile, the i8254 provides our only other amd64 delay(9) implementation and it is an extremely slow clock. On my 2GHz machine, gettick() takes ~20 microseconds to complete *without* mutex contention. On a VM it is even slower, as you must exit the VM for each inb() and outb(). So, add tsc_delay() and use it when we have a constant/invariant TSC. The TSC is a 64-bit "up-counter" so the implementation is simple. Given how slow the i8254 is on modern machines, we may want to add an HPET delay(9) implementation as a fallback for machines where the TSC drifts. The HPET itself is pretty slow, but not as slow as the i8254. Discussed with kettenis@, Mike Larkin, and naddy@. Tweaked by kettenis@. ok kettenis@
2020-09-05Implement spilling of kernel SLB entries. Mostly from FreeBSD.Mark Kettenis
This makes it possible to use more SLB entries for the kernel than the hardware supports. The design is such that a subset of the hardware SLB entries can be replaced when needed. This makes sure the entries mapping kernel code and data and the page tables ar always present. Traps for missing SLB entries are handled in real-mode and on a special stack such that it doesn't have to rely on SLB entires mapping kernel stacks. With this in place we can increase KVA to 32GB. Hopefully that's enough to support large memory configurations.
2020-09-05Whitespace.Mark Kettenis
2020-09-05allow compile of kernels with DDB, in more cases.Theo de Raadt
from Matt Baulch discussed with kettenis and drahn
2020-09-05Add mpii(4).Mark Kettenis
2020-09-05Replace '32' with SID_SCSI2_ALEN (a.k.a. 31) when building emulated INQUIRYKenneth R Westerback
responses. This is what the SCSI specifications say is the correct value and already used in several cases.
2020-09-04Restrict the size of the page table to 2G such that it never occupies moreMark Kettenis
than 8 SLB entries.
2020-09-04Make the kernel address space a bit bigger.Mark Kettenis
2020-09-04Restrict the size of the page table to 2G such that it never occupies moreMark Kettenis
than 8 SLB entries.
2020-09-04Add kstat to cnmac(4)Visa Hankala
This makes various receive and transmit event counters readable. This additionally replaces the old, and somewhat unusual, way of updating error counters in ifp. Most of the hardware counters are 32 bits wide. Hence the code polls them periodically and adds the values to 64-bit software counters. The hardware counters are cleared when read.
2020-09-03amd64: lapic: refactor timer programmingcheloha
We reprogram the lapic timer by hand in three separate places. This is error-prone and difficult to read. To clean things up, introduce routines for reprogramming the lapic timer in a given mode. lapic_timer_oneshot() starts a oneshot countdown. lapic_timer_periodic() starts a repeating countdown. Both of these routines call lapic_timer_start(), wherein we actually write the lapic registers. With input from dlg@. Earlier version eyeballed by mlarkin@. Suspend/resume tested by gnezdo@.
2020-09-03Sprinkle some more eieio(); seems to avoid triggering the KASSERT(new > old).Mark Kettenis
2020-09-03Replace '.response_format = 2' with '.response_format = SID_SCSI2_RESPONSE'.Kenneth R Westerback
2020-09-02When building emulated INQUIRY results use the SCSI_REV_* #define's toKenneth R Westerback
initialize the 'version' field. Not numbers.
2020-09-02vfs_shutdown() is neccessary to ensure buffer cache drain before reexec()Theo de Raadt
ok kettenis visa
2020-09-01Fix signotify() for powerpc64 bsd.mpgkoehler
Copy signotify() from amd64, so that if proc *p is on another cpu, then signotify(p) notifies the correct cpu. ok kettenis@
2020-09-01Implement address translation for bus_space_mmap(9).Mark Kettenis
2020-09-01Store the device tree node in the pcitag_t.Mark Kettenis
2020-09-01Add PMAP_NOCACHE flag to the address returned by the genericMark Kettenis
bus_space_mmap(9) implementation to make sure we enter mappings with the right memory attributes.
2020-09-01Fix write un-protecting of kernel memory. p was used uninitializedPatrick Wildt
at the beginning of the loop. We need to use cr3 at the start of each iteration for the top level page directory. From and ok sf@
2020-09-01Rename [READ|WRITE]_BIG to [READ|WRITE]_10. Rename struct scsi_rw_big toKenneth R Westerback
struct scsi_rw_10. ok gnezdo@ jmatthew@ (who also did sparc64 compile test)
2020-09-01Use sysctl_bounded_args for simple cases in cpu_sysctl on loongsongnezdo
deraadt@: looks fine
2020-08-31crank to 6.8-betaTheo de Raadt
2020-08-30Reorganize the interrupt handler code to avoid a potential bogus KASSERT,Mark Kettenis
handle the priority levels better and guarantee ordering of restoring the priority level after running an interrupt handler and checking for a new interrupt.
2020-08-30Lock all kernel PTE entries into the page tables, even "managed" onesMark Kettenis
entered by pmap_enter(9). Otherwise kernel stack pages get evicted and that doesn't end well. We probably only need to lock in wired pages and I will probably revisit this at some later stage. tested by deraadt@
2020-08-29Only fall back on using the first potential root disk as the boot disk ifMark Kettenis
the boot kernel didn't hand us a valid bootduid. ok visa@
2020-08-29Mark certain sections with debug information as "allocated" such that theyMark Kettenis
get picked up by ddb. This makes the "pp" and "show struct" commands that depends on CTF work. ok gkoehler@
2020-08-28Make fdt root node's model property readable through sysctl hw.productVisa Hankala
2020-08-27Improve write un-protecting of kernel memory. For the Computrace modulePatrick Wildt
on the HP EliteBook 830 G6 we added a workaround which tries to re-map the pages where we want to place to kernel read-write. On some machines though this workaround causes a regression. Fix those by changing a few things: Only set the writeable bit if it isn't set yet. Un-protect write-protected page directories. Skip lower levels if large-page is set, since the next level is already a page. Don't do anything at all if paging is disabled. From Christian Ehrhardt ok bluhm@ tobhe@
2020-08-26Improve detection of the proper boot device by picking the disk thatMark Kettenis
matches the bootduid of the boot kernel. ok visa@
2020-08-26Declare hw_{prod,serial,uuid,vendor,ver} in <sys/systm.h>.Visa Hankala
OK deraadt@, mpi@
2020-08-25Clear user SLB upon context switch.Mark Kettenis
2020-08-24Enable xicp(4) here as well.Mark Kettenis
2020-08-24Add some USB HID devices.Mark Kettenis
2020-08-23Enable xicp(4).Mark Kettenis
2020-08-23amd64: TSC timecounter: prefix RDTSC with LFENCEcheloha
Regarding RDTSC, the Intel ISA reference says (Vol 2B. 4-545): > The RDTSC instruction is not a serializing instruction. > > It does not necessarily wait until all previous instructions > have been executed before reading the counter. > > Similarly, subsequent instructions may begin execution before the > read operation is performed. > > If software requires RDTSC to be executed only after all previous > instructions have completed locally, it can either use RDTSCP (if > the processor supports that instruction) or execute the sequence > LFENCE;RDTSC. To mitigate this problem, Linux and DragonFly use LFENCE. FreeBSD and NetBSD take a more complex route: they selectively use MFENCE, LFENCE, or CPUID depending on whether the CPU is AMD, Intel, VIA or something else. Let's start with just LFENCE. We only use the TSC as a timecounter on SSE2 systems so there is no need to conditionally compile the LFENCE. We can explore conditionally using MFENCE later. Microbenchmarking on my machine (Core i7-8650) suggests a penalty of about 7-10% over a "naked" RDTSC. This is acceptable. It's a bit of a moot point though: the alternative is a considerably weaker monotonicity guarantee when comparing timestamps between threads, which is not acceptable. It's worth noting that kernel timecounting is not *exactly* like userspace timecounting. However, they are similar enough that we can use userspace benchmarks to make conjectures about possible impacts on kernel performance. Concerns about kernel performance, in particular the network stack, were the blocking issue for this patch. Regarding networking performance, claudio@ says a 10% slower nanotime(9) or nanouptime(9) is acceptable and that shaving off "tens of cycles" is a micro-optimization. There are bigger optimizations to chase down before such a difference would matter. There is additional work to be done here. We could experiment with conditionally using MFENCE. Also, the userspace TSC timecounter doesn't have access to the adjustment skews available to the kernel timecounter. pirofti@ has suggested a scheme involving RDTSCP and an array of skews mapped into user memory. deraadt@ has suggested a scheme where the skew would be kept in the TCB. However it is done, access to the skews will improve monotonicity, which remains a problem with the TSC. First proposed by kettenis@ and pirofti@. With input from pirofti@, deraadt@, guenther@, naddy@, kettenis@, and claudio@. Based on similar changes in Linux, FreeBSD, NetBSD, and DragonFlyBSD. ok deraadt@ pirofti@ kettenis@ naddy@ claudio@
2020-08-23Add xicp(4), a driver for the interrupt control presenter hardware foundMark Kettenis
on POWER8 CPUs.
2020-08-23Add support for "normal" external interrupts. Needed for running on POWER8Mark Kettenis
and earlier CPUs.
2020-08-23Add OPAL_SET_XIVE and OPAL_GET_XIVE.Mark Kettenis
2020-08-23Add missing conversion from IPL to CPU priority.Mark Kettenis