summaryrefslogtreecommitdiff
path: root/sys/dev
AgeCommit message (Collapse)Author
2022-08-20x86: Split most of pmap.h into pmap_private.h or vmparam.h.riastradh
This way pmap.h only contains the MD definition of the MI pmap(9) API, which loads of things in the kernel rely on, so changing x86 pmap internals no longer requires recompiling the entire kernel every time. Callers needing these internals must now use machine/pmap_private.h. Note: This is not x86/pmap_private.h because it contains three parts: 1. CPU-specific (different for i386/amd64) definitions used by... 2. common definitions, including Xenisms like xpmap_ptetomach, further used by... 3. more CPU-specific inlines for pmap_pte_* operations So {amd64,i386}/pmap_private.h defines 1, includes x86/pmap_private.h for 2, and then defines 3. Maybe we should split that out into a new pmap_pte.h to reduce this trouble. No functional change intended, other than that some .c files must include machine/pmap_private.h when previously uvm/uvm_pmap.h polluted the namespace with pmap internals. Note: This migrates part of i386/pmap.h into i386/vmparam.h -- specifically the parts that are needed for several constants defined in vmparam.h: VM_MAXUSER_ADDRESS VM_MAX_ADDRESS VM_MAX_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS Since i386 needs PDP_SIZE in vmparam.h, I added it there on amd64 too, just to keep things parallel.
2022-08-20x86: Move page attribute table bits to x86/pat.h.riastradh
2022-08-20ural_start(): Replace "IFQ_DEQUEUE() -> IF_PREPEND() on failure" withthorpej
"IFQ_POLL() -> IFQ_DEQUEUE() on success". (This one was an even worse anti-pattern than the others!)
2022-08-20gfe_ifstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" withthorpej
"IF_POLL() -> IF_DEQUEUE() on success".
2022-08-20fwip_async_output(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" withthorpej
"IF_POLL() -> IF_DEQUEUE() on success".
2022-08-20udav(4): Prune dead branch: legacy IFF_ALLMULTI is never set here.riastradh
2022-08-20cue(4): Prune dead branch: IFF_BROADCAST is always set here.riastradh
2022-08-20usbnet(9): New usbnet_ispromisc(un).riastradh
Replaces ifp->if_flags & IFF_PROMISC in multicast filter updates.
2022-08-20usbnet(9): Rename core lock -> mii lock.riastradh
No functional change intended.
2022-08-20usbnet(9): Limit scope of core lock to mii and tick scheduling.riastradh
Bringing the interface up or down is serialized by IFNET_LOCK, and we prevent further mii callbacks with mii_down, so there's no need for another lock to serialize uno_init, uno_stop, and the mii callbacks.
2022-08-20usbnet(9): Call mii_down once we've finished with mii_tick.riastradh
2022-08-20usbnet(9): Simplify core lock use in usbnet_tick_task.riastradh
2022-08-20usbnet(9): Call uno_tick before mii stuff.riastradh
The one driver that uses it, cue(4), uses it just for statistics gathering; hard to imagine that order could be important here. But this will allow for some simplification of the surrounding code.
2022-08-20usbnet(9): Assert core lock is held on usbnet_set_link.riastradh
This is only allowed to be called via the uno_statchg callback, which in turn is called only with the core lock held. (usbnet_set_link is also called internally in usbnet(9) with the core lock held.)
2022-08-20usbnet(9): Split unp_stopping into stopped/txstopped/rxstopped.riastradh
In practical terms this could be done with one variable and an atomic store, but serializing all access with a lock makes reasoning easier, and the locks have to be taken by the logic that queries the variables anyway, and the variables are set only under heavy-weight configuration changes anyway. What this accomplishes is disentangling lock order between rxlock and txlock: they are never taken at the same time, so no order is needed. I renamed unp_stopping to unp_stopped for a compiler-assisted audit to make sure I reviewed every case of it.
2022-08-20usbnet(9): Don't touch unp_stopping in usbnet_pipe_intr.riastradh
This access was unprotected by a lock, but it's not necessary anyway: usbnet_stop aborts the pipes, and the xfer doesn't call usbd_transfer to reschedule itself -- it's an intr pipe, so it's rescheduled internally by usbdi(9) in a way that usbd_abort_pipe atomically prevents.
2022-08-20usbnet(9): Omit needless un->un_intr test in usbnet_pipe_intr.riastradh
un->un_intr can't change after attach, and we don't open the pipe if it's null. So no need to test it.
2022-08-20usbnet(9): Revert previous -- usbnet_media_upd does have IFNET_LOCK.riastradh
Not sure why I thought otherwise.
2022-08-20usbnet(9): Avoid ether_mediachange if stopped.riastradh
We are called without IFNET_LOCK held here, so touching ifp->if_flags is forbidden, but that's the first thing ether_mediachange does. XXX not right either, need to eliminate the check from ether_mediachange
2022-08-20sys/dev/Makefile: Split INCS onto separate lines for ease of sorting.riastradh
Also sort.
2022-08-20usbdi(9): Nix resurrected usbd_request_async.riastradh
We killed this back in 2013, but it came back from the dead on a driver imported from OpenBSD.
2022-08-20umb(4): Use usbd_do_request as drivers are intended to do.riastradh
2022-08-20nvme(4): Read cqe flags and cid in that order.riastradh
2022-08-20mii(4): Make mii_down wait for concurrent mii_phy_auto to finish.riastradh
This is important for callers in if_stop routines to guarantee that all concurrent access to the mii registers has ended. Drivers must not call this from softint context. Drivers with custom watchdog timers (not if_watchdog) that do if_stop from callout must defer to thread context instead, e.g. via workqueue(9) -- as they should be doing anyway for heavyweight operations like if_stop.
2022-08-20machine/efi.h: Migrate common definitions to dev/efi/efi.h.riastradh
2022-08-20It is possible to overflow the (low 32bit) HPET counter between hpet_attachmlelstv
and TSC calibration if the boot is delayed for more than ~430 seconds (or less, depending on HPET frequency). The result is a badly misconfigured timecounter. Change the measurement interval to ~1e6 HPET ticks (<100ms) during the calibration to avoid the overflow. This introduces an error of 1ppm, compared to the previous unspecified but typical error of 0.1ppm. But this is still much less than the guaranteed maximum frequency drift of the HPET counter itself, which is 500ppm.
2022-08-19Make bge_detaching a bool. NFC.skrll
2022-08-19softc member naming consistency with wm(4). (Taylor made me do it... notskrll
really)
2022-08-19Should be checking ifp->if_flags in bge_init and not sc->bge_if_flags.skrll
Spotted by Taylor.
2022-08-17uhci(4): Fix wrong lock in callout_halt in uhci_suspend.riastradh
Maybe this should just be unconditional and outside the lock to make it simpler. Found by code inspection. Maybe someone should test uhci suspend resume...
2022-08-16usbnet(9): Omit needless usbnet_core_mutex function.riastradh
While here, use inline, not __inline__, since this is not a header file where inline might be redefined by the user.
2022-08-15Remove stray debug line (already commented out)pgoyette
2022-08-15nuke pasto in gffb_init()macallan
2022-08-15nvme(4): KASSERT(A && B) -> KASSERT(A); KASSERT(B)riastradh
2022-08-14mii(4): Wait for MIIF_DOINGAUTO to clear with MIIF_AUTOTSLEEP too.riastradh
Otherwise mii_phy_detach may return while mii_phy_auto_timeout_locked is still in progress in another thread. Reuse the storage for mii_nway_ch, which is unused if MIIF_AUTOTSLEEP is set, for a new condvar in a union. This doesn't change the kernel ABI because sizeof(struct kcondvar) <= sizeof(struct callout) and both have the same alignment, for an array of void *.
2022-08-14mii(4): Sprinkle assertions in mii phy auto timeout.riastradh
2022-08-14nvme: Make sure that q_ccb_list is always accessed with the q lock held.jmcneill
2022-08-14virtio(4): Print numeric device type, even if unrecognized.riastradh
2022-08-14bge: Use BUS_DMA_WAITOK in attach routines.skrll
2022-08-14bge: Mirror the bus_dma RX buffer changes in the OpenBSD driverskrll
This change reduces the amount of work done in the interrupt handler.
2022-08-14Make bge(4) MP safeskrll
This started out as a fix so that LOCKDEBUG wouldn't explode with kernel lock spinout. LOCKDEBUG is too aggressive now and really should be relaxed.
2022-08-14Whitespaceskrll
2022-08-14bge: Fix bge_ring_map bus_dmamap_sync POST{READ,WRITE} operations.skrll
When the range of ring entries wraps around sync from the start of the ring to the last entry.
2022-08-13pciconf: Skip callbacks for reserved ranges if resource allocation fails.jmcneill
In the event that a BAR write is ignored, no need to notify the callback of any changes.
2022-08-13viocon(4): Omit unused sc_dmamap.riastradh
2022-08-13viocon(4): Fix bus_dmamap_sync after tx: POSTWRITE, not POSTREAD.riastradh
2022-08-13viocon(4): Fix $NetBSD$ rcsid.riastradh
2022-08-13viocon(4): Fix tty device number.riastradh
2022-08-13audio: Rework about usrbuf allocation.isaki
- Allocate the usrbuf from kmem(9) instead of uvm(9). The usrbuf has used uvm(9), in case mmap(2) might be issued later. However, despite the most apps don't use mmap(2), allocating (and reallocating) uvm(9) every time would be expensive. In addition, uvm(9) for recording usrbuf was totally pointless now. - For playback, the usrbuf memory will be allocated in pages. Because the usrbuf for playback is mostly near 64KB for backward compatibility. This will reduce reallocation especially from the initial ulaw to the most commonly used format like slinear16/2ch/48kHz. - When mmap(2) is called, it will replace the playback usrbuf from kmem(9) to uvm(9). - Prohibit changing playback format once mmap(2) is called. It follows netbsd-7. - For recording, the usrbuf memory will be allocated in the requested size every time as before. Because the usrbuf for recording is only one block and is enough small to the page in the most case. Inspired by PR kern/56947.
2022-08-12rum(4): Avoid uninitialized garbage in failed register read.riastradh
Reported-by: syzbot+f2cba71b1b1bc91029b3@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=7a01863d0fe34a4946516388c436991ba2beaa63