Commit Graph

297297 Commits

Author SHA1 Message Date
martin fd0206ff35 When we init the hardware's rx/tx ring configuration we need to
adjust our internal state, as this implicitly resets the current
descriptor pointer.
Previously "ifconfig eqos0 down; ifconfig eqos0 up" made the interface
non-functional.
2022-07-20 18:48:41 +00:00
thorpej 64b6590238 Fix a couple of nits with savectx():
- Note that this function is only used by dumpsys().
- Don't safe the PS word; there isn't actually a spot for it in the PCB.
- Don't bother returning anything; savectx() is declared void.
2022-07-20 18:25:10 +00:00
thorpej 0ce9a18f82 Localize direct refernces to kernel symbols into functions. NFC. 2022-07-20 17:03:10 +00:00
thorpej 7803b59a40 Make alpha_wmb() actually a WMB rather than an MB (all uses of
alpha_wmb() have been audited and fixed-up as necessary).
2022-07-20 15:52:47 +00:00
thorpej 1a8114347d In the Alpha tc_syncbus(), we need to issue a MB because WMB does not
order reads with respect to writes.  Remove now-redundant tc_wmb()
calls before tc_syncbus().

NFC on MIPS other than removing a redundant wbflush() (tc_wmb() followed
by tc_syncbus()).
2022-07-20 15:45:28 +00:00
thorpej 3c0153b8ab No need to test for __alpha__ || alpha ... just one will suffice. 2022-07-20 14:19:38 +00:00
riastradh 75c01b644e mips: Fix cpuids synchronization at boot. 2022-07-20 10:07:49 +00:00
riastradh 99d298e068 drm: Use CPPFLAGS.drmkms in all local drm drivers too.
This way we don't pollute the NetBSD kernel namespace with all the
Linux compat shim definitions needed to build drm, except for the
local drm drivers that need the API.
2022-07-20 10:01:10 +00:00
riastradh 7330e4c4c5 drm: Keep drm include flags in CPPFLAGS.drmkms after all.
Failures from this are much more obvious to debug than files with
missing #ifdefs, which sometimes lead to build failures but could
also just lead to silent miscompilation.
2022-07-20 10:01:01 +00:00
msaitoh 40c24d3de9 Modify comment. Use __BIT() a little. No functional change. 2022-07-20 06:43:37 +00:00
riastradh 289a0b495d drm: Restore pollution of CPPFLAGS with include directories.
Too much trouble to make this fine-grained.
2022-07-20 01:38:24 +00:00
riastradh 42eb3644f2 aarch64: Make cpufunc.h includable without sys/cpu.h first. 2022-07-20 01:35:25 +00:00
riastradh ba17231070 drm: Ifdef out alpha-specific logic in radeon.
Guessing this is handled transparently by bus_space(9) when we ask
for prefetchable linear mappings.  Need an alpha wizard to review!
2022-07-20 01:22:38 +00:00
riastradh 86a0f5fd03 drm: Use real pci segment number, not pciN device unit. 2022-07-20 01:20:20 +00:00
riastradh 9e854df856 drm/ttm: Handle io_mem_pfn, used by amdgpu. 2022-07-20 01:12:14 +00:00
riastradh c1ef505700 amdgpu: Write amdgpu_ttm_io_mem_pfn in terms of bus_space_mmap. 2022-07-20 01:11:54 +00:00
riastradh c086332808 drm: Undefine `alpha' in the module build too. 2022-07-20 01:11:39 +00:00
riastradh 460dbe1ed2 drm: Teach bus_dma_hacks.h about alpha.
Not sure if this is correct!  Someone who knows alpha should vet.
2022-07-19 23:19:44 +00:00
riastradh d86bfbc9a7 drm: Undefine `alpha' in CPPFLAGS. Causes lotsa trouble!
But don't undefine it outside drmkms; `#ifdef alpha' or equivalent is
used elsewhere in-tree.  (Maybe it should be replaced by __alpha__.)
2022-07-19 23:19:35 +00:00
riastradh 9cc2d37165 drm: Make drm_clflush_* noop on alpha.
As far as I know there is no need for this; the CPU has weak ordering
on loads and stores requiring ordering barriers, but I/O devices
participate in the CPU's cache protocol for access to main memory so
there's never any need for explicit cache flushes.
2022-07-19 23:19:27 +00:00
riastradh fb1b2cfb9f drm: Narrow scope of drm CPPLAGS just to drm files.
No need for various Linux compat definitions elsewhere in the kernel.
2022-07-19 23:19:17 +00:00
riastradh 3673c703ca drm: Propagate CPPFLAGS.drmkms into all the drm drivers. 2022-07-19 23:19:06 +00:00
riastradh 1c26109f65 drm: Note dependency on sysmon_power.
drm uses this for pswitch events to notify of hotplug.
2022-07-19 22:24:47 +00:00
riastradh 5fc7130c35 drm: Nix drm_agp_borrow.
This horrible kludge dates from before I understood the relation of
genfb_pci and pci drm drivers in the old and new worlds of drm.

The only user of it, in i915, was changed to use agp_i810_borrow
directly in the last drm update, so this hack can die.
2022-07-19 22:24:33 +00:00
riastradh 9e4a35dca6 alpha: Fix missing includes in pmap.h. 2022-07-19 22:04:14 +00:00
riastradh 8f46c04c6a linux: Add alpha definitions of mb/wmb/rmb too for fun.
Who wants to plug an amdgpu into their alpha?
2022-07-19 21:30:40 +00:00
riastradh 33066f4e03 linux: Clarify error message in asm/barrier.h. Not just for drm. 2022-07-19 16:40:26 +00:00
riastradh 6158e6a19b linux: Add mips definitions for mb, wmb, rmb. 2022-07-19 16:38:39 +00:00
riastradh afb7311592 linux: Use dsb(sy/st/ld) from arm/cpufunc.h for mb/wmb/rmb.
Works on more Arm CPU types this way.  From skrll.
2022-07-19 16:38:22 +00:00
riastradh d6a6fd4fb6 wm(4): Use CSR_WRITE_FLUSH, not bus_space_barrier.
The bus space is mapped non-prefetchable and non-cacheable, so there
is no need for bus_space_barrier and it might not even have any
effect -- bus_space_read/write are totally ordered for non-
prefetchable, non-cacheable mappings anyway.  Presumably the intent
here was to wait for acknowledgment of the write from the device --
which bus_space_barrier does not guarantee, and which I expect
requires a read transaction as CSR_WRITE_FLUSH performs.

ok msaitoh@, knakahara@
2022-07-19 08:22:34 +00:00
riastradh 2ec614670a wm(4): Use bus_dmamap_sync, not bus_space_barrier, for tx desc.
The newly written tx descriptor needs to be visible to the device
before the TDT register is set.  There's no bus space mappings that
need any barriers, though -- nothing mapped prefetchable or cacheable
here.  So bus_dmamap_sync (via wm_cdtxsync) is necessary, not
bus_space_barrier.  By accident, bus_space_barrier implies the same
barrier instructions as bus_dmamap_sync on some architectures, but it
wouldn't work at all if we were bouncing.

ok msaitoh@, knakahara@
2022-07-19 08:21:02 +00:00
skrll f37a4b1bb5 KNF 2022-07-19 06:50:34 +00:00
skrll 1d46de22ad Don't need sys/malloc.h so remove the #include 2022-07-19 06:47:34 +00:00
skrll d4ea7986c3 Turn a locking botch (shouldn't drop lock on error) into a KASSERT 2022-07-19 06:46:29 +00:00
thorpej 0153cca833 Fix a problem whereby detaching a device that has open kevent
registrations can result in a UAF: When a device detaches, it
calls seldestroy(), which calls knote_fini(), and when that
returns, the softc that contained the selinfo and klist are freed.
However, any knotes that were registered still linger on with the
kq descriptor they're were associated with, and when the file
descriptors close, those knotes will be f_detach'd, which will
call into the driver instance that no longer exists.

Address this problem by adding a "foplock" mutex to the knote.
This foplock must be held when calling into filter_attach(),
filter_detach(), and filter_event() (XXX not filter_touch();
see code for details).  Now, in klist_fini(), for each knote
that is on the klist that's about to be blown away, acquire
the foplock, replace the knote's filterops with a do-nothing
stub, and release the foplock.

The end result is that:
==> The foplock ensures that calls into filter_*() will get EITHER
    the real backing object's filterops OR the nop stubs.
==> Holing the foplock across the filter_*() calls ensures that
    klist_fini() will not complete until there are no callers inside
    the filterops that are about to be blown away.
2022-07-19 01:03:05 +00:00
thorpej 9578481361 Make some knote implementation details private to kern_event.c. NFC, and
no ABI change for kevent providers.
2022-07-19 00:46:00 +00:00
riastradh a53f11173a drm: Simplify async framebuffer child task attachment logic.
No need for scheduling the task to fail.  Nix needless error
branches.
2022-07-18 23:34:02 +00:00
riastradh b083d5b07b drm: Fix asynchronous attach logic for drm framebuffer devices.
The driver-specific sc_scheduled boolean flag was racy.  It is
necessary to use config_pending_incr/decr to hold up console
selection and userland start (and block detach, not that that works
yet) until the drmfb attach has completed.
2022-07-18 23:33:53 +00:00
rin 2316fa6ff0 Fix bug revealed by SIGINFO support; Do not treat short read(2)/write(2)
as error (*). This occurs typically when signal is received.

(*) For older version, we already deal with short read(2) from remote
host in sink(). But for other cases, i.e., write(2) to local file in
sink(), read(2)/write(2) in source(), error was raised.

This version of rcp(1) can successfully send/receive files with older
version, even if short read(2)/write(2) occurs by SIGINFO.

Also, when real error occurs, give up immediately instead of continue to
send/receive wrong data.

Clean up the mess a little bit as well...
2022-07-18 13:01:59 +00:00
martin c8e5dc73f7 Make it compile w/o warnings for !VCONS_DRAW_INTR 2022-07-18 11:09:22 +00:00
thorpej be4026be97 Regen for:
Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.
2022-07-18 04:32:35 +00:00
thorpej 75d451f371 Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.
2022-07-18 04:30:30 +00:00
riastradh 6c3e770ea9 drm: Fix missing barrier definitions on arm.
The definition will work on armv7; don't think we have any drmkms
drivers on armv<7.
2022-07-17 22:02:23 +00:00
riastradh a87987a626 wsdisplay(4): Make most of struct vcons_data private.
More importantly, make sizeof(struct vcons_data) independent of
whether VCONS_DRAW_INTR &c. is defined.

Allocate the private space with kmem rather than in the caller.

This still doesn't have very good separation between interface
parameters and internal state, but it's better than before, and is
necessary to make genfb usable in modules.

In arm_simplefb.c, this removes use of the use_intr member.  That
assignment became redundant with the introduction of vcons_earlyinit,
so there's no need to replace it by anything.
2022-07-17 20:23:17 +00:00
riastradh 326e20a431 drm: Comment *mb() vs smp_*mb() and omit default for *mb().
In general membar_*() is _not_ enough for *mb(), because membar_*()
is only for CPU/CPU synchronization on normal memory, and *mb()
requires machine-dependent I/O logic.  Leave it as an `#error' case
if the architecture isn't listed here.  But membar_*() is OK for
smp_*().

Fill in powerpc and sparc while here, as examples of what the
now-removed defaults failed to do.  If you want to use drm on a mips
or alpha system yer gonna hafta fill this in yourself.
2022-07-17 18:45:48 +00:00
riastradh 46131e3ba7 linux/ww_mutex: Make wwm_debug member unconditional.
This way LOCKDEBUG doesn't change any structure sizes.  Shuffle
members around to make better use of padding, on both LP32 and LP64.
2022-07-17 17:04:02 +00:00
riastradh 26428fb989 vmwgfx: Depend on drmkms_ttm module. 2022-07-17 15:37:10 +00:00
riastradh 5ffff9fc45 radeon: Depend on drmkms_ttm module. 2022-07-17 15:36:59 +00:00
riastradh 8d8a955729 nouveau: Depend on drmkms_ttm module. 2022-07-17 15:36:51 +00:00
riastradh eb43e76af5 amdgpu: Depend on drmkms_ttm module. 2022-07-17 15:36:15 +00:00