Commit Graph

2302 Commits

Author SHA1 Message Date
riastradh
06ace998ef Take a mutex around mode config logic as the comment advises.
XXX pullup
2020-02-27 15:41:47 +00:00
ad
d2a0ebb67a UVM locking changes, proposed on tech-kern:
- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart.  v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap.  Others to follow later.
2020-02-23 15:46:38 +00:00
chs
d80ed5957c do not wait for memory in pgo_fault methods, just return ENOMEM
and let the uvm_fault code wait if it is appropriate.
2020-02-22 19:46:48 +00:00
jmcneill
5f76fbf667 build fix 2020-02-22 19:37:31 +00:00
skrll
f7f69ae002 Define pinctrl-names for sdhci to fix it. From Harold Gutch and discussed
on port-arm.

http://mail-index.netbsd.org/port-arm/2020/02/13/msg006497.html
2020-02-22 09:54:27 +00:00
skrll
71d602f2c7 Fix a memory leak. Spotted by nat@ 2020-02-21 12:41:29 +00:00
joerg
ce578dfc2b Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.
2020-02-21 00:26:21 +00:00
mrg
acd38f9259 in bus_dmamap_load_pglist() try a 32-element array of
bus_dma_segment_t's before attempting to allocate.

this hopefully avoids hangs i've had in X since updating
from netbsd-8 to netbsd-9 that i've tracked down to this
function failing with ENOMEM.

XXX: maybe can avoid the alloc entirely by batching these
calls in 32 segments each.

XXX pullup-9
2020-02-20 09:07:39 +00:00
riastradh
55d2c2b3f5 Move another file from drm2 to common for <linux/kernel.h>. 2020-02-16 07:29:48 +00:00
riastradh
36e6f0b2b9 Missed a drm2 -> common move. 2020-02-16 06:50:14 +00:00
riastradh
6d732fd468 #ifdef DIAGNOSTIC --> __diagused 2020-02-15 14:05:06 +00:00
riastradh
b4488d07f0 Fix non-DIAGNOSTIC builds. 2020-02-15 13:56:55 +00:00
riastradh
73c7d65210 Fix mistakes in previous sloppy change with root intr xfers.
- Make sure ux_status is set to USBD_IN_PROGRESS when started.
  Otherwise, if it is still in flight when we abort the pipe,
  usbd_ar_pipe will skip calling upm_abort.

- Initialize ux_status under the lock; in principle a completion
  interrupt (or a delay) could race with the initialization.

- KASSERT that the xfer is in progress when we're about to complete
  it.

Candidate fix for PR kern/54963 for other HCI drivers than uhci.

ok nick
ok phone

(This is the change that nick evidently MEANT to ok when he ok'd the
previous one!)
2020-02-15 01:21:56 +00:00
tnn
0d3298ace5 FENCE_TRACE is __printflike 2020-02-14 18:17:23 +00:00
tnn
1b2d042a0f fix a typo, caught by -Werror,-Wheader-guard 2020-02-14 16:02:41 +00:00
maya
d22e779193 Reduce diffs by side-loading some header files like Linux.
From riastradh
2020-02-14 14:34:57 +00:00
riastradh
b5fe40105e Nix another conditional ALIGN. 2020-02-14 09:39:57 +00:00
riastradh
946853f36d Reduce some more cosmetic diffs. 2020-02-14 09:39:37 +00:00
riastradh
a8a369201f Fix undoing of -Wpointer-arith workaround. 2020-02-14 09:38:51 +00:00
riastradh
adecb000bc Placate -Wsign-compare. 2020-02-14 09:35:40 +00:00
riastradh
eee0296c87 Add LIST_HEAD to <linux/nbsd-namespace.h> too. 2020-02-14 04:38:48 +00:00
riastradh
84d717f389 Implement (obsolete) simple_strtol stub; reduce diff. 2020-02-14 04:38:36 +00:00
riastradh
1639185478 Implement drm userptr with uvm_vslock & bus_dmamap_load_uio. 2020-02-14 04:38:23 +00:00
riastradh
6474d4fa28 Revert unnecessary change.
The only way this logic can reach the reference to stat is if repcnt
goes to zero, which -- since it starts at 4 -- can only happen if we
go through several iterations of the loop, which in turn implies that
stat is initialized.

If GCC still complains about this, it's wrong and should be dealt
with some other way.
2020-02-14 04:38:13 +00:00
riastradh
162adb80ef DRM_HZ -> HZ, to reduce diffs. 2020-02-14 04:37:43 +00:00
riastradh
2a6b34eda7 Revert cosmetic changes. 2020-02-14 04:37:27 +00:00
riastradh
5768324bc4 Stub out console_lock/unlock and drm_fb_helper_set_suspend.
Reduce some more diffs.
2020-02-14 04:37:09 +00:00
riastradh
01df274799 Reduce diffs by nixing DRM_SUSER macro, deleted upstream long ago.
Instead stub Linux capable(CAP_SYS_ADMIN).
2020-02-14 04:36:55 +00:00
riastradh
64d223f552 Undo the enum pipe' -> enum i915_pipe' rename. 2020-02-14 04:36:11 +00:00
riastradh
1b46a69af0 Use a header file hack to cope with Linux/NetBSD namespace clashes.
Currently serves for:

ALIGN
mutex_init
mutex_destroy
2020-02-14 04:35:19 +00:00
riastradh
e66da3d6e2 Eliminate -Wpointer-arith patches; use -Wno-pointer-arith instead. 2020-02-14 04:30:04 +00:00
riastradh
fca250d9c1 We use -Wno-shadow for radeon; remove unused diff. 2020-02-14 04:29:42 +00:00
riastradh
9396b0ac41 New stub to reduce diff. 2020-02-14 04:29:19 +00:00
jdolecek
61142bb294 adjust the PCI interrupt allocation code to work the same as
drm_pci_request_irq(), now the driver successfully allocates MSI interrupt

[   3.6619808] nouveau0: info: NVIDIA GK208B (b06070b1)
[   3.7685336] nouveau0: info: bios: version 80.28.78.00.4b
[   3.7785491] nouveau0: interrupting at msi8 vec 0 (nouveau0)

related to PR kern/52440 by John D. Baker
2020-02-12 22:34:51 +00:00
jdolecek
299e2a1cf6 remove superfluous static variable used only to zero attach args 2020-02-12 20:31:46 +00:00
jdolecek
19ea73f56e don't consider it error when nouveaufbbus fails to attach, it currently
can happen only not configured into the kernel
2020-02-12 20:25:48 +00:00
jdolecek
9d78a3f162 mark case fallthrough to avoid warning 2020-02-12 20:22:37 +00:00
jdolecek
8f993c709e fix error path when nouveaufb fails to attach (such as when it's not
actually configured into the kernel), the gem was not released
properly leading to:
panic: LOCKDEBUG: Reader / writer lock error: kmem_intr_free,289: allocation contains active lock
2020-02-12 20:08:31 +00:00
jdolecek
5fb21da818 re-enable MSI - this actually enables MSI only for intel/radeon/generic
which are reported to work fine, while nouveau (which breaks with
MSI) still uses INTx

see the thread
http://mail-index.netbsd.org/current-users/2020/02/06/msg037661.html
2020-02-12 18:35:01 +00:00
riastradh
73dc35407f Fix steady state of root intr xfers.
Why?

- Avoid completing a root intr xfer multiple times in races.
- Avoid potential use-after-free in poll_hub callouts (uhci, ahci).

How?

- Use sc->sc_intr_xfer or equivalent to store only a pending xfer
  that has not yet completed -- whether successfully, by timeout, or
  by synchronous abort.  When any of those happens, set it to null
  under the lock, so the xfer is completed only once.

- For hci drivers that use a callout to poll the root hub (uhci, ahci):

  . Pass the softc pointer, not the xfer, to the callout, so the
    callout is not even tempted to use xfer after free -- if the
    callout fires, but the xfer is synchronously aborted before the
    callout can do anything, the xfer might be freed by the time the
    callout starts to examine it.

  . Teach the callout to do nothing if it is callout_pending after it
    has fired.  This way:

    1. completion or synchronous abort can just callout_stop
    2. start can just callout_schedule

    If the callout had already fired before (1), and doesn't acquire
    the bus lock until after (2), it may be tempted to abort the new
    root intr xfer just after submission, which would be wrong -- so
    instead we just have the callout do nothing if it notices it has
    been rescheduled, since it will fire again after the appropriate
    time has elapsed.
2020-02-12 16:02:01 +00:00
riastradh
87858756ca Factor out HCI-independent xfer completion logic.
New API for HCI drivers to synchronize hardware completion
interrupts, synchronous aborts, and asynchronous timeouts:

- When submitting an xfer to hardware, call
  usbd_xfer_schedule_timeout(xfer).

- On HCI completion interrupt for xfer completion:

	if (!usbd_xfer_trycomplete(xfer))
		return;		/* timed out or aborted, ignore it */

- In upm_abort methods, call usbd_xfer_abort(xfer).

For HCI drivers that use this API (not needed in drivers that don't,
or for xfers like root intr xfers that don't use it):

- New ubm_abortx method serves role of former *hci_abort_xfer, but
  without any logic for wrangling timeouts/callouts/tasks -- caller
  in usbd_xfer_abort has already handled them.

- New ubm_dying method, returns true if the device is in the process
  of detaching, used by the timeout logic.

Converted and tested:
- ehci
- ohci

Converted and compile-tested:
- ahci (XXX did this ever work?)
- dwc2
- motg (XXX missing usbd_xfer_schedule_timeout in motg_*_start?)
- uhci
- xhci

Not changed:

- slhci (sys/dev/ic/sl811hs.c) -- doesn't use a separate per-xfer
  callout for timeouts (XXX but maybe should?)

- ugenhc (sys/rump/dev/lib/libugenhc/ugenhc.c) -- doesn't manage its
  own transfer timeouts

- vhci -- times transfers out only on detach; could be adapted easily
  if we wanted to use the xfer->ux_callout
2020-02-12 16:01:00 +00:00
maya
6845a8bf6d Use a closer equivalent to MEMREMAP_WB: BUS_SPACE_MAP_CACHEABLE
Not a fix for PR port-amd64/54808
2020-02-10 21:54:26 +00:00
jmcneill
5cdcfc1bf5 Turn MSI off again. 2020-02-07 18:13:33 +00:00
jmcneill
8300cfb1cb Disable simplefb if nouveau attaches 2020-02-03 16:52:13 +00:00
jmcneill
e88c29857d Re-enable PCI MSI for DRM devices 2020-02-03 16:22:52 +00:00
jmcneill
41013ffdf4 Use the correct PCI interrupt type based on what the driver has configured 2020-02-03 16:22:25 +00:00
riastradh
285f2419ce Fix abuse of TAILQ_CONCAT.
Other parts of this expect that the entries will be on wq->wq_queue
or wq->wq_dqueue, so we can't just move a batch of entries onto a
temporary queue.  Instead, use a marker node to delimit when the
batch ends.

XXX pullup
2020-02-01 22:38:05 +00:00
kamil
c67f09e237 Fix the build of LLVM sanitizers after the urio(4) removal
Cherry-pick a part of the upstream commit:

    [compiler-rt] Fix build on NetBSD 9.99.44

    Fix build on >= 9.99.44 after the removal of urio(4).
    Add compat code for the device as NetBSD-9.0 is supported.

3a200f3f2e
2020-01-31 14:01:36 +00:00
jmcneill
cfe3c0c500 Do not extract mmap flags from the bus_space_mmap cookie as they may
conflict with the bo's existing protection flags. This caused VRAM to
be incorrectly mapped as Device-nGnRE on Arm64 instead of Normal-NC. Ok
riastradh@.
2020-01-28 23:24:09 +00:00
jmcneill
6d7752e1d5 ttm_io_prot: follow linux semantics and set either PMAP_WRITE_COMBINE or
PMAP_NOCACHE when existing cache flags are not set
2020-01-28 23:21:05 +00:00