summaryrefslogtreecommitdiff
path: root/sys/dev/drm
AgeCommit message (Collapse)Author
2019-02-19Per discussions on arch@ and elsewhere, retire drm module / drives.Warner Losh
Retire the drm modules / drivers. These are now handled by the drm-legacy-kmod port and/or the drm-kmod port. All future development and maintanace will be handled there. Approved by: graphics team Reviewed by: manu@, mmel@ Differential Revision: https://reviews.freebsd.org/D19196 Notes: svn path=/head/; revision=344297
2019-01-15[drm] Fix off-by-one error when accessing driver-specific ioctl handlers arrayOleksandr Tymoshenko
PR: 231513 Submitted by: Young_X <YangX92@hotmail.com> Approved by: imp MFC after: 1 week Notes: svn path=/head/; revision=343060
2018-08-28Add big, nasty abandonware tags to this code.Warner Losh
This code works for some people, but hasn't been updated in a long time. Still allow people to use this code for the moment, but put a big, nasty obsolete message to inform and encourage people to move to the port. Approved by: re@ (gjb) Differential Review: https://reviews.freebsd.org/D16894 Notes: svn path=/head/; revision=338348
2018-08-25Eliminate the arena parameter to kmem_free(). Implicitly this corrects anAlan Cox
error in the function hypercall_memfree(), where the wrong arena was being passed to kmem_free(). Introduce a per-page flag, VPO_KMEM_EXEC, to mark physical pages that are mapped in kmem with execute permissions. Use this flag to determine which arena the kmem virtual addresses are returned to. Eliminate UMA_SLAB_KRWX. The introduction of VPO_KMEM_EXEC makes it redundant. Update the nearby comment for UMA_SLAB_KERNEL. Reviewed by: kib, markj Discussed with: jeff Approved by: re (marius) Differential Revision: https://reviews.freebsd.org/D16845 Notes: svn path=/head/; revision=338318
2018-08-24Revert drm2 removal.Warner Losh
Revert r338177, r338176, r338175, r338174, r338172 After long consultations with re@, core members and mmacy, revert these changes. Followup changes will be made to mark them as deprecated and prent a message about where to find the up-to-date driver. Followup commits will be made to make this clear in the installer. Followup commits to reduce POLA in ways we're still exploring. It's anticipated that after the freeze, this will be removed in 13-current (with the residual of the drm2 code copied to sys/arm/dev/drm2 for the TEGRA port's use w/o the intel or radeon drivers). Due to the impending freeze, there was no formal core vote for this. I've been talking to different core members all day, as well as Matt Macey and Glen Barber. Nobody is completely happy, all are grudgingly going along with this. Work is in progress to mitigate the negative effects as much as possible. Requested by: re@ (gjb, rgrimes) Notes: svn path=/head/; revision=338285
2018-08-22Remove legacy drm and drm2 from treeMatt Macy
As discussed on the MLs drm2 conflicts with the ports' version and there is no upstream for most if not all of drm. Both have been merged in to a single port. Users on powerpc, 32-bit hardware, or with GPUs predating Radeon and i915 will need to install the graphics/drm-legacy-kmod. All other users should be able to use one of the LinuxKPI-based ports: graphics/drm-stable-kmod, graphics/drm-next-kmod, graphics/drm-devel-kmod. MFC: never Approved by: core@ Notes: svn path=/head/; revision=338172
2018-08-18Eliminate the unused arena parameter from kmem_alloc_attr().Alan Cox
Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D16793 Notes: svn path=/head/; revision=338030
2018-05-28drm: fix memory leak on error pathEric van Gyzen
Reported by: Coverity CID: 1368753 MFC after: 3 days Sponsored by: Dell EMC Notes: svn path=/head/; revision=334269
2018-03-22Correct signedness bug in drm_modeset_ctlEd Maste
drm_modeset_ctl() takes a signed in from userland, does a boundscheck, and then uses it to index into a structure and write to it. The boundscheck only checks upper bound, and never checks for nagative values. If the int coming from userland is negative [after conversion] it will bypass the boundscheck, perform a negative index into an array and write to it, causing memory corruption. Note that this is in the "old" drm driver; this issue does not exist in drm2. Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Reviewed by: cem MFC after: 1 day Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=331339
2018-03-21Fix kernel memory disclosure in drm_infobufsEd Maste
drm_infobufs() has a structure on the stack, fills it out and copies it to userland. There are 2 elements in the struct that are not filled out and left uninitialized. This will leak uninitialized kernel stack data to userland. Submitted by: Domagoj Stolfa <ds815@cam.ac.uk> Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> MFC after: 1 day Security: Kernel memory disclosure (798) Notes: svn path=/head/; revision=331333
2017-12-27kernel: Fix several typos and minor errorsEitan Adler
- duplicate words - typos - references to old versions of FreeBSD Reviewed by: imp, benno Notes: svn path=/head/; revision=327231
2017-09-26Add PNP metadata to more driversConrad Meyer
GPUs: radeonkms, i915kms NICs: if_em, if_igb, if_bnxt This metadata isn't used yet, but it will be handy to have later to implement automatic module loading. Reviewed by: imp, mmacy Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12488 Notes: svn path=/head/; revision=324038
2017-07-10Include opt files in the kernel with "" instead of <>.Warner Losh
Notes: svn path=/head/; revision=320860
2017-07-09Switch prison check from PROV_DRIVER to PRIV_KMEM_WRITE (like /dev/mem).Alexander Leidinger
Access to the dri device gives effectively access to the entire memory of the machine (you can program the graphic card to do DMA). For current/stable/release this is a NOP, as access to memory is not allowed in a jail. This puts the dri device into the same (in)security class than /dev/mem for future use. Discussed with: anholt(?) several years ago Sponsored by: Hackathon Essen 2017 Notes: svn path=/head/; revision=320827
2017-04-17All these files need sys/vmmeter.h, but now they got it implicitlyGleb Smirnoff
included via sys/pcpu.h. Notes: svn path=/head/; revision=317055
2017-03-14Use atop() instead of OFF_TO_IDX() for convertion of addresses orKonstantin Belousov
addresses offsets, as intended. Suggested and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=315281
2017-03-11drm(old): Remove i915 and radeon driversEmmanuel Vadot
They cannot be used anymore with the userland bits we provide. Furthermore, their KMS versions support the same hardware. Submitted by: dumbbell Reviewed by: emaste, manu Sponsored by: AsiaBSDCon Differential Revision: https://reviews.freebsd.org/D5614 Notes: svn path=/head/; revision=315045
2016-05-03sys/dev: minor spelling fixes.Pedro F. Giffuni
Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
2016-02-22As <machine/param.h> is included from <sys/param.h>, there is no needSvatopluk Kraus
to include it explicitly when <sys/param.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5378 Notes: svn path=/head/; revision=295881
2016-02-22As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toSvatopluk Kraus
include it explicitly when <vm/pmap.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373 Notes: svn path=/head/; revision=295880
2015-08-11Instead of defining the actualy user and group id in the drmP.h filesKoop Mast
define GID_VIDEO in sys/conf.h, and use it together with UID_ROOT to define DRM_DEV_UID and DRM_DEV_GID in the drmP.h files. So there is one place where the UID's and GID's are defined. Submitted by: ed@ Reviewed by: ed@, dumbbell@ Differential Revision: https://reviews.freebsd.org/D3360 Notes: svn path=/head/; revision=286640
2015-08-09Add a new group named 'video' with the id of 44. And make drm createKoop Mast
devices in /dev/dri/ with this new group. This will allow ports and users to more easily access to these devices for OpenGL and OpenCL support. Reviewed by: dumbbell@ Approved by: dumbbell@ Differential Revision: https://reviews.freebsd.org/D1260 Notes: svn path=/head/; revision=286524
2015-06-04Remove compatibility shims for FreeBSD versions older than 8.0.John Baldwin
Notes: svn path=/head/; revision=283999
2015-06-04Add a new file operations hook for mmap operations. File type-specificJohn Baldwin
logic is now placed in the mmap hook implementation rather than requiring it to be placed in sys/vm/vm_mmap.c. This hook allows new file types to support mmap() as well as potentially allowing mmap() for existing file types that do not currently support any mapping. The vm_mmap() function is now split up into two functions. A new vm_mmap_object() function handles the "back half" of vm_mmap() and accepts a referenced VM object to map rather than a (handle, handle_type) tuple. vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a a VM object and then calling vm_mmap_object() to handle the actual mapping. The vm_mmap() function remains for use by other parts of the kernel (e.g. device drivers and exec) but now only supports mapping vnodes, character devices, and anonymous memory. The mmap() system call invokes vm_mmap_object() directly with a NULL object for anonymous mappings. For mappings using a file descriptor, the descriptors fo_mmap() hook is invoked instead. The fo_mmap() hook is responsible for performing type-specific checks and adjustments to arguments as well as possibly modifying mapping parameters such as flags or the object offset. The fo_mmap() hook routines then call vm_mmap_object() to handle the actual mapping. The fo_mmap() hook is optional. If it is not set, then fo_mmap() will fail with ENODEV. A fo_mmap() hook is implemented for regular files, character devices, and shared memory objects (created via shm_open()). While here, consistently use the VM_PROT_* constants for the vm_prot_t type for the 'prot' variable passed to vm_mmap() and vm_mmap_object() as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines. Previously some places were using the mmap()-specific PROT_* constants instead. While this happens to work because PROT_xx == VM_PROT_xx, using VM_PROT_* is more correct. Differential Revision: https://reviews.freebsd.org/D2658 Reviewed by: alc (glanced over), kib MFC after: 1 month Sponsored by: Chelsio Notes: svn path=/head/; revision=283998
2014-12-17Adjust printf format specifiers for dev_t and ino_t in kernel.Gleb Kurtsou
ino_t and dev_t are about to become uint64_t. Reviewed by: kib, mckusick Notes: svn path=/head/; revision=275856
2014-09-03Remove always false comparison.Gleb Smirnoff
Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=271013
2014-07-07Remove ia64.Marcel Moolenaar
This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan Notes: svn path=/head/; revision=268351
2014-06-28Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky
Notes: svn path=/head/; revision=267992
2014-06-27Revert r267961, r267973:Glen Barber
These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory Notes: svn path=/head/; revision=267985
2014-06-27Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky
there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=267961
2014-06-16- Modify vm_page_unwire() and vm_page_enqueue() to directly acceptAttilio Rao
the queue where to enqueue pages that are going to be unwired. - Add stronger checks to the enqueue/dequeue for the pagequeues when adding and removing pages to them. Of course, for unmanaged pages the queue parameter of vm_page_unwire() will be ignored, just as the active parameter today. This makes adding new pagequeues quicker. This change effectively modifies the KPI. __FreeBSD_version will be, however, bumped just when the full cache of free pages will be evicted. Sponsored by: EMC / Isilon storage division Reviewed by: alc Tested by: pho Notes: svn path=/head/; revision=267548
2014-06-13Add missing calls to bus_dmamap_unload() when freeing static DMAJohn Baldwin
allocations. Reviewed by: scottl Notes: svn path=/head/; revision=267446
2014-01-31Back out r261266 pending security buy-in.Jamie Gritton
r261266: Add a jail parameter, allow.kmem, which lets jailed processes access /dev/kmem and related devices (i.e. grants PRIV_IO and PRIV_KMEM_WRITE). This in conjunction with changing the drm driver's permission check from PRIV_DRIVER to PRIV_KMEM_WRITE will allow a jailed Xorg server. Notes: svn path=/head/; revision=261326
2014-01-29Add a jail parameter, allow.kmem, which lets jailed processes accessJamie Gritton
/dev/kmem and related devices (i.e. grants PRIV_IO and PRIV_KMEM_WRITE). This in conjunction with changing the drm driver's permission check from PRIV_DRIVER to PRIV_KMEM_WRITE will allow a jailed Xorg server. Submitted by: netchild MFC after: 1 week Notes: svn path=/head/; revision=261266
2013-12-26In sys/dev/drm/mach64_dma.c, remove static function mach64_set_dma_eol(),Dimitry Andric
which has never been used, even by upstream, since its initial upstream commit (see http://cgit.freedesktop.org/mesa/drm/commit/?id=873e1c4d ) MFC after: 3 days Notes: svn path=/head/; revision=259902
2013-11-30Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler
shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva Notes: svn path=/head/; revision=258780
2013-11-30Similar to the (1 << 31) case it is not defined to do (2 << 30).Eitan Adler
Notes: svn path=/head/; revision=258779
2013-08-07Replace kernel virtual address space allocation with vmem. This providesJeff Roberson
transparent layering and better fragmentation. - Normalize functions that allocate memory to use kmem_* - Those that allocate address space are named kva_* - Those that operate on maps are named kmap_* - Implement recursive allocation handling for kmem_arena in vmem. Reviewed by: alc Tested by: pho Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=254025
2013-04-23Fix white spaces.Jung-uk Kim
Notes: svn path=/head/; revision=249816
2013-04-23Remove always-true conditions from if statement.Eitan Adler
PR: kern/176712 Submitted by: Hiren Panchasara <hiren.panchasara@gmail.com> Approved by: cperciva (mentor) Notes: svn path=/head/; revision=249799
2013-03-09Switch the vm_object mutex to be a rwlock. This will enable in theAttilio Rao
future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes. The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs. The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example). Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho Notes: svn path=/head/; revision=248084
2012-11-09Cast VIA_READ to (void) where the result is unused.Roman Divacky
Notes: svn path=/head/; revision=242825
2012-10-26Make sure to define __BIG_ENDIAN and __LITTLE_ENDIAN with the appropriateNathan Whitehorn
number of underscores for Linux compatibility in drm(4). Submitted by: sendtomatt at gmail dot com MFC after: 2 weeks Notes: svn path=/head/; revision=242132
2012-08-15Streamline use of cdevpriv and correct some corner cases.Hans Petter Selasky
1) It is not useful to call "devfs_clear_cdevpriv()" from "d_close" callbacks, hence for example read, write, ioctl and so on might be sleeping at the time of "d_close" being called and then then freed private data can still be accessed. Examples: dtrace, linux_compat, ksyms (all fixed by this patch) 2) In sys/dev/drm* there are some cases in which memory will be freed twice, if open fails, first by code in the open routine, secondly by the cdevpriv destructor. Move registration of the cdevpriv to the end of the drm open routines. 3) devfs_clear_cdevpriv() is not called if the "d_open" callback registered cdevpriv data and the "d_open" callback function returned an error. Fix this. Discussed with: phk MFC after: 2 weeks Notes: svn path=/head/; revision=239303
2011-12-30In sys/dev/drm/radeon_state.c, use the correct printf length modifiersDimitry Andric
for ints. MFC after: 1 week Notes: svn path=/head/; revision=228979
2011-12-16Fix format string Z --> z, since the former is a deprecated and (in FreeBSD)Stefan Eßer
unsupported form of the latter. This change has been reviewed and accepted in the -hackers list. Submitted by: Alexander Best Reviewed by: David Schulz Notes: svn path=/head/; revision=228572
2011-12-12Do not define bool/true/false if the symbols already exist.Matthew D Fleming
MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Notes: svn path=/head/; revision=228443
2011-04-23Fix display of the drm sysctls.Konstantin Belousov
Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=220979
2011-03-23Do a sweep of the tree replacing calls to pci_find_extcap() with calls toJohn Baldwin
pci_find_cap() instead. Notes: svn path=/head/; revision=219902
2011-02-22- Remove no longer in useMartin Wilke
PR: kern/152354 Submitted by: vehemens <vehemens@verizon.net> Discussion with:kib Approved by: rwatson (mentor) Notes: svn path=/head/; revision=218937