libkern: Change idr_replace() return value to align with Linux
The Linux implementation of idr_replace() returns -ENOENT when the `id`
could not be found. Change our implementation to do the same to be
compatible with Linux's.
In addition, Linux's documentation says idr_replace() would return
-EINVAL if the given pointer was not valid [1]. This should be checked
in the future.
[1] https://www.kernel.org/doc/html/v4.20/core-api/idr.html#c.idr_replace
man: Add unr(9) manpage for the kernel unit number allocator
Obtained from FreeBSD but modified to match our code status.
Added 'SEE ALSO' section to refer to idr(9).
idr.9: Reorder the idr_alloc() description to read more logical
Move the idr_alloc() description to between idr_destroy() and idr_find()
so the whole description reads more logic.
Noted-by: mneumann
config.8: Tweak the wording and remove the now wrong 60MB number
At this point, the debug info of kernel and modules takes ~550MB of disk
space. Tweak the wording and no longer mention the exact used space.
amdgpu - Build in optional support for "CIK" architecture GPUs.
This builds in support for the KAVERI, BONAIRE, HAWAII, KABINI, and MULLINS,
GPU versions.
The newly added source files were taken from Linux 4.20.17 to match the
rest of the amdgpu driver's current state.
By default, amdgpu(4) is not going to match these models.
In order to make amdgpu(4) match and attach to these GPUs, you have to set
the drm.amdgpu.cik_support=1 tunable in /boot/loader.conf.
Until we have 8bit colormapped mode support in syscons(4), you may also
need to force the driver to setup the console framebuffer in 16bpp or 32bpp
mode, using the `drm.video.<connector>' tunable documented in drm(4).
amdgpu - Avoid spamming with powersaving log messages in regular use.
Unfortunately all the log messages going through the dev_printk() linux
API at the moment get printed without regards to the specified log level.
Hence turning these regular benign logs to use the DRM_DEBUG_DRIVER()
call, which can be optionally turned on via the `hw.drm.debug' sysctl.
syscons - Use vtophys() for mmap-ing the framebuffer.
With this change, the xf86-video-scrb Xorg/XLibre driver works reliably
on machines using the amdgpu(4) KMS driver.
With amdgpu(4), the framebuffer may be allocated from GTT memory (managed
by TTM and accessed by the GPU through its own IOMMU), and hence is not
contiguous in physical memory.
Using vtophys() in the .d_mmap handler effectively determines the correct
physical address one-by-one for each page of the framebuffer, based on the
kernel's virtual memory mapping.
More optimally, we would call into the correct drm/ttm function to handle
these mmap requests in a more efficient way, however that will require some
more changes to how we pass the framebuffer information on to syscons.
Or alternatively we figure out how to tell amdgpu(4) to always use VRAM for
the framebuffer.
KERN_PROC - Fix KERN_PROC_ARGS and KERN_PROC_CWD to return length if oldptr==NULL.
Sysctl handlers still have to compute the full output, even when
oldptr == NULL. This is necessary to implement the behavior documented in
sysctl(3), that it will return the required buffer length in "oldlenp", if
"oldptr" is NULL and "oldlenp" is not NULL.
procfs - Don't reset fd offset when reading regs, fpregs, or dbregs files.
* For repeated reads, we can simply use pread(2). And this way, we allow for
normal shell tooling to work correctly on these procfs files.
* This also matches the behavior on NetBSD.
drm - Revive hw.dri.vblank_offdelay and hw.dri.timestamp_precision sysctls.
* The hw.dri.vblank_offdelay sysctl can be useful to prevent the vblank IRQ
from constantly firing in some scenarios. Also adjusting this may still be
beneficial in combination with PSR (Panel self refresh) on i915(4).