summaryrefslogtreecommitdiff
path: root/sys/external/bsd/drm2/linux
AgeCommit message (Collapse)Author
2023-02-21drm: Teach dmabuf to handle lseek.riastradh
Needed by libdrm_amdgpu. Based on patch from Jeff Frasca -- thanks! XXX pullup-10
2022-10-17add pcie capability and read request size linux compat, some pci root supportmrg
implement support for: - pcie_capability_read_dword() - pcie_capability_read_word() - pcie_capability_write_dword() - pcie_capability_write_word() - pcie_get_readrq() - pcie_set_readrq() implement the "struct pci_dev" bus->self member by creating a minimal fake "struct pci_dev" for the pci bus itself. this is kind of gross. it checks that the current device's parent is a netbsd "pci" device, and that it has a (grand) parent "ppb" device, and then fills in the fake device based upon the pci and ppb devices. add some PCIE_LCSR2_TGT_LSPEED encodings, and map them to linux names. map several other PCIE_LCSR and PCIE_LCAP names. uncomment several pcie code segments in radeon and amdgpu. (not sure that we can test the amdgpu_si.c change, as we use the radeon version and the amdgpu version hangs on the one machine i have.) tested on amdgpu (RX550) and radeon (7750 & 3650). ok @riastradh
2022-09-20fill out more of the linux pci API compatmrg
- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and pci_is_root_bus(). - expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds. - add "enum pcie_link_width". - add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW (negotiated lane width) to pcireg.h - enable amdgpu_device_get_pcie_info() code now it works. ok riastradh@
2022-09-01drm: Fix dma fence stub fix so the lock is actually initialized.riastradh
Tested but forgot to amend change before exporting to CVS again.
2022-09-01drm: Fix dma fence stub so it works with locking operations.riastradh
2022-07-20drm: Use real pci segment number, not pciN device unit.riastradh
2022-07-19drm: Nix drm_agp_borrow.riastradh
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-10linux/hdmi: Fix size of product id.riastradh
2022-07-10linux/hdmi: Fix return value in unpack.riastradh
2022-07-09linux/hdmi: Fix hdmi_infoframe_unpack to record the unpacked header.riastradh
2022-07-09linux/hdmi: Handle audio infoframes in hdmi_infoframe_pack.riastradh
Sort cases by type number.
2022-07-09linux/hdmi: Convert failure branch to kassert for internal invariant.riastradh
2022-07-09linux/hdmi: Use ssize_t for all hdmi_*_infoframe_pack functions.riastradh
2022-07-09linux/hdmi: Zero entire union hdmi_infoframe on unpack.riastradh
Don't just zero the part that we're about to initialize -- i915 does memcmp on the whole structure.
2022-07-09linux/hdmi: Handle unpacking audio frames too. Sort by number.riastradh
2022-07-09linux/hdmi: Make some private functions static.riastradh
2022-07-09linux/hdmi.h: Split out logic into .c file.riastradh
Shoulda done this ages ago.
2022-05-22linux: Repeat i2c transfer if driver fails with EAGAIN.riastradh
The Intel GMBUS (graphics management bus, i2c controller) relies on this now to fall back from interrupt-driven xfers to bit-banging.
2022-04-09drm: Convert membar_enter/exit stragglers to membar_acquire/release.riastradh
2022-04-09sys: Use membar_release/acquire around reference drop.riastradh
This just goes through my recent reference count membar audit and changes membar_exit to membar_release and membar_enter to membar_acquire -- this should make everything cheaper on most CPUs without hurting correctness, because membar_acquire is generally cheaper than membar_enter.
2022-03-18drm: In ww_mutex_unlock, do lockdebug check first.riastradh
This way we get a full lockdebug dump when LOCKDEBUG is enabled, instead of just the panic message (which includes the lock address you could pass to `show lock' in ddb, but let's get the dump by default even if you don't enter ddb). Also in the KASSERT print the mutex.
2022-03-12sys: Membar audit around reference count releases.riastradh
If two threads are using an object that is freed when the reference count goes to zero, we need to ensure that all memory operations related to the object happen before freeing the object. Using an atomic_dec_uint_nv(&refcnt) == 0 ensures that only one thread takes responsibility for freeing, but it's not enough to ensure that the other thread's memory operations happen before the freeing. Consider: Thread A Thread B obj->foo = 42; obj->baz = 73; mumble(&obj->bar); grumble(&obj->quux); /* membar_exit(); */ /* membar_exit(); */ atomic_dec -- not last atomic_dec -- last /* membar_enter(); */ KASSERT(invariant(obj->foo, obj->bar)); free_stuff(obj); The memory barriers ensure that obj->foo = 42; mumble(&obj->bar); in thread A happens before KASSERT(invariant(obj->foo, obj->bar)); free_stuff(obj); in thread B. Without them, this ordering is not guaranteed. So in general it is necessary to do membar_exit(); if (atomic_dec_uint_nv(&obj->refcnt) != 0) return; membar_enter(); to release a reference, for the `last one out hit the lights' style of reference counting. (This is in contrast to the style where one thread blocks new references and then waits under a lock for existing ones to drain with a condvar -- no membar needed thanks to mutex(9).) I searched for atomic_dec to find all these. Obviously we ought to have a better abstraction for this because there's so much copypasta. This is a stop-gap measure to fix actual bugs until we have that. It would be nice if an abstraction could gracefully handle the different styles of reference counting in use -- some years ago I drafted an API for this, but making it cover everything got a little out of hand (particularly with struct vnode::v_usecount) and I ended up setting it aside to work on psref/localcount instead for better scalability. I got bored of adding #ifdef __HAVE_ATOMIC_AS_MEMBAR everywhere, so I only put it on things that look performance-critical on 5sec review. We should really adopt membar_enter_preatomic/membar_exit_postatomic or something (except they are applicable only to atomic r/m/w, not to atomic_load/store_*, making the naming annoying) and get rid of all the ifdefs.
2022-02-28drm: Fix ACPI crud in ALL kernel build.riastradh
2022-02-27only build linux_acpi.c if we have acpi(4) in the kerneljakllsch
2022-02-27drm: Move acpi_check_dsm &c. from intel_acpi.c to new linux_acpi.c.riastradh
2022-02-27drm: Deconditionalize pci_get_segment.riastradh
2022-02-17drm: Fix membars around dma_buf_put reference count release.riastradh
2022-02-15drm: Use KM_SLEEP to allocate reservation fence arrays.riastradh
Except as a fast path in an RCU reader. The array sizes appear to be reasonably small and not trivially controlled by userland, from what I can tell, so if my impression is accurate, it is reasonable to sleep for allocation here.
2022-02-12Add inline functions to manipulate the klists that link up knotesthorpej
via kn_selnext: - klist_init() - klist_fini() - klist_insert() - klist_remove() These provide some API insulation from the implementation details of these lists (but not completely; see vn_knote_attach() and vn_knote_detach()). Currently just a wrapper around SLIST(9). This will make it significantly easier to switch kn_selnext linkage to a different kind of list.
2021-12-26drm: Allow ww_mutex_lock after ww_acquire_done if we already hold it.riastradh
In other words, if ww_mutex_lock would return -EALREADY, that's OK and does not warrant an assertion. PR kern/56557
2021-12-24Revert "drm: Fix missing newline in DRM_WARN."riastradh
Accidentally included more than I intended here.
2021-12-24drm: Fix missing newline in DRM_WARN.riastradh
2021-12-24drm: Sprinkle some assertions into sg dma logic.riastradh
2021-12-19drm: Work around busted kthread_join.riastradh
2021-12-19drm: Fix error return for kthread_run: error pointer, not null.riastradh
2021-12-19drm: Take advantage of kthread interlock to reduce diff.riastradh
2021-12-19drm: Rework Linux `kthread' abstraction to avoid race to sleep.riastradh
Requires passing in the caller's lock and condvar to kthread_run, but for the one user that appears not to be an onerous requirement.
2021-12-19drm: Trigger `spurious' wakeup for kthread_stop too.riastradh
2021-12-19drm: Make dma fence array name strings match Linux.riastradh
2021-12-19drm: Use atomic_load_consume/relaxed to simplify code.riastradh
2021-12-19drm: Implement dma fence chains.riastradh
2021-12-19drm: Support 64-bit fence context and sequence numbers.riastradh
2021-12-19drm: Release fence in dma_fence_chain_walk.riastradh
2021-12-19linux: In kthread_park, wake thread to re-check kthread_shouldpark.riastradh
Otherwise, the thread to pakr may be sleeping on some condvar not noticing it has to notify kthread_park --> deadlock.
2021-12-19drm: Make sure dma_fence_wait gets traced too. Deduplicate.riastradh
2021-12-19drm: Add dtrace probes to fences.riastradh
2021-12-19drm: Fix signalling return value if no enable_signaling op.riastradh
2021-12-19drm: Spruce up ww_mutex comments. Audit return values.riastradh
2021-12-19linux: Fix wait_bit semantics.riastradh
- wait_on_bit is supposed to wait until the bit is cleared, not set. - wait_on_bit_timeout is supposed to return 0 on success, -EAGAIN on faiure. Omit wake_up_bit; nothing uses it and clear_and_wake_up_bit is a more semantically coherent operation.
2021-12-19drm: Fix comment about dma_resv_lock_* return values.riastradh