summaryrefslogtreecommitdiff
path: root/sys/dev/drm
Commit message (Collapse)AuthorAgeFilesLines
* MFC r331333: Fix kernel memory disclosure in drm_infobufsEd Maste2018-03-231-0/+1
| | | | | | | | | | | | | | 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> Security: Kernel memory disclosure (798) Notes: svn path=/stable/11/; revision=331411
* MFC r331339: Correct signedness bug in drm_modeset_ctlEd Maste2018-03-231-1/+1
| | | | | | | | | | | | | | | | | | | 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 Sponsored by: The FreeBSD Foundation Notes: svn path=/stable/11/; revision=331409
* MFC r317055,r317056 (glebius): Include sys/vmmeter.h as includedKyle Evans2018-03-151-0/+1
| | | | | | | | | | r317055: All these files need sys/vmmeter.h, but now they got it implicitly included via sys/pcpu.h. r317056: Typo! Notes: svn path=/stable/11/; revision=331017
* MFC r327231,r327232:Eitan Adler2018-03-051-2/+2
| | | | | | | | | | | | kernel: Fix several typos and minor errors lib: Fix several typos and minor errors - duplicate words - typos - references to old versions of FreeBSD Notes: svn path=/stable/11/; revision=330446
* MFC r315281:Konstantin Belousov2017-03-281-1/+1
| | | | | | | | | | | | | Use atop() instead of OFF_TO_IDX() for convertion of addresses or addresses offsets, as intended. MFC r315580 (by alc): Simplify the logic for clipping the range returned by the pager to fit within the map entry. Use atop() rather than OFF_TO_IDX() on addresses. Notes: svn path=/stable/11/; revision=316073
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-0313-15/+15
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* As <machine/param.h> is included from <sys/param.h>, there is no needSvatopluk Kraus2016-02-221-1/+0
| | | | | | | | | | 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
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toSvatopluk Kraus2016-02-221-1/+0
| | | | | | | | | | 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
* Instead of defining the actualy user and group id in the drmP.h filesKoop Mast2015-08-111-2/+2
| | | | | | | | | | | | | | 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
* Add a new group named 'video' with the id of 44. And make drm createKoop Mast2015-08-091-1/+1
| | | | | | | | | | | | | | 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
* Remove compatibility shims for FreeBSD versions older than 8.0.John Baldwin2015-06-0413-119/+0
| | | | Notes: svn path=/head/; revision=283999
* Add a new file operations hook for mmap operations. File type-specificJohn Baldwin2015-06-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Adjust printf format specifiers for dev_t and ino_t in kernel.Gleb Kurtsou2014-12-171-2/+3
| | | | | | | | | ino_t and dev_t are about to become uint64_t. Reviewed by: kib, mckusick Notes: svn path=/head/; revision=275856
* Remove always false comparison.Gleb Smirnoff2014-09-031-1/+1
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=271013
* Remove ia64.Marcel Moolenaar2014-07-072-3/+1
| | | | | | | | | | | | | | | | | | | | 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
* Pull in r267961 and r267973 again. Fix for issues reported will follow.Hans Petter Selasky2014-06-282-2/+1
| | | | Notes: svn path=/head/; revision=267992
* Revert r267961, r267973:Glen Barber2014-06-272-1/+2
| | | | | | | | | | | | | 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
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifHans Petter Selasky2014-06-272-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* - Modify vm_page_unwire() and vm_page_enqueue() to directly acceptAttilio Rao2014-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Add missing calls to bus_dmamap_unload() when freeing static DMAJohn Baldwin2014-06-132-0/+2
| | | | | | | | | allocations. Reviewed by: scottl Notes: svn path=/head/; revision=267446
* Back out r261266 pending security buy-in.Jamie Gritton2014-01-311-3/+1
| | | | | | | | | | | 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
* Add a jail parameter, allow.kmem, which lets jailed processes accessJamie Gritton2014-01-291-1/+3
| | | | | | | | | | | | /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
* In sys/dev/drm/mach64_dma.c, remove static function mach64_set_dma_eol(),Dimitry Andric2013-12-261-48/+0
| | | | | | | | | | 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
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thisEitan Adler2013-11-309-47/+47
| | | | | | | | | | | | | | | | 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
* Similar to the (1 << 31) case it is not defined to do (2 << 30).Eitan Adler2013-11-301-2/+2
| | | | Notes: svn path=/head/; revision=258779
* Replace kernel virtual address space allocation with vmem. This providesJeff Roberson2013-08-071-2/+2
| | | | | | | | | | | | | | | | 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
* Fix white spaces.Jung-uk Kim2013-04-231-2/+2
| | | | Notes: svn path=/head/; revision=249816
* Remove always-true conditions from if statement.Eitan Adler2013-04-231-2/+2
| | | | | | | | | PR: kern/176712 Submitted by: Hiren Panchasara <hiren.panchasara@gmail.com> Approved by: cperciva (mentor) Notes: svn path=/head/; revision=249799
* Switch the vm_object mutex to be a rwlock. This will enable in theAttilio Rao2013-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Cast VIA_READ to (void) where the result is unused.Roman Divacky2012-11-092-3/+3
| | | | Notes: svn path=/head/; revision=242825
* Make sure to define __BIG_ENDIAN and __LITTLE_ENDIAN with the appropriateNathan Whitehorn2012-10-261-0/+5
| | | | | | | | | | 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
* Streamline use of cdevpriv and correct some corner cases.Hans Petter Selasky2012-08-151-8/+6
| | | | | | | | | | | | | | | | | | | | | | | 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
* In sys/dev/drm/radeon_state.c, use the correct printf length modifiersDimitry Andric2011-12-301-1/+1
| | | | | | | | | for ints. MFC after: 1 week Notes: svn path=/head/; revision=228979
* Fix format string Z --> z, since the former is a deprecated and (in FreeBSD)Stefan Eßer2011-12-161-2/+2
| | | | | | | | | | | 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
* Do not define bool/true/false if the symbols already exist.Matthew D Fleming2011-12-121-1/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Notes: svn path=/head/; revision=228443
* Fix display of the drm sysctls.Konstantin Belousov2011-04-231-1/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=220979
* Do a sweep of the tree replacing calls to pci_find_extcap() with calls toJohn Baldwin2011-03-231-1/+1
| | | | | | | pci_find_cap() instead. Notes: svn path=/head/; revision=219902
* - Remove no longer in useMartin Wilke2011-02-222-87/+0
| | | | | | | | | | PR: kern/152354 Submitted by: vehemens <vehemens@verizon.net> Discussion with:kib Approved by: rwatson (mentor) Notes: svn path=/head/; revision=218937
* Fix typos - remove duplicate "the".Rebecca Cran2011-02-212-2/+2
| | | | | | | | | PR: bin/154928 Submitted by: Eitan Adler <lists at eitanadler.com> MFC after: 3 days Notes: svn path=/head/; revision=218909
* Introduce and use a new VM interface for temporarily pinning pages. ThisAlan Cox2010-12-251-25/+14
| | | | | | | | | | new interface replaces the combined use of vm_fault_quick() and pmap_extract_and_hold() throughout the kernel. In collaboration with: kib@ Notes: svn path=/head/; revision=216699
* fix atomic_set_xxx misuse in drmAndriy Gapon2010-12-111-1/+1
| | | | | | | | | | It seems that atomic_set_xxx and atomic_store_xxx were confused. Reviewed by: jhb MFC after: 3 weeks Notes: svn path=/head/; revision=216374
* Make drm(4) build, if not work reliably, on PowerPC.Nathan Whitehorn2010-11-166-11/+13
| | | | Notes: svn path=/head/; revision=215367
* Fix typos.Rebecca Cran2010-11-091-6/+6
| | | | | | | | PR: bin/148894 Submitted by: olgeni Notes: svn path=/head/; revision=215034
* Add support for ATI Radeon HD 4250.Oliver Fromme2010-08-031-0/+1
| | | | | | | | | | | PR: kern/149041 Submitted by: olli Reviewed by: rnoland Approved by: des (mentor) MFC after: 1 week Notes: svn path=/head/; revision=210819
* Push down the acquisition of the page queues lock into vm_page_unwire().Alan Cox2010-05-051-2/+0
| | | | Notes: svn path=/head/; revision=207648
* Add page locking to the vm_page_cow* functions.Alan Cox2010-05-041-2/+0
| | | | | | | | | | Push down the acquisition and release of the page queues lock into vm_page_wire(). Reviewed by: kib Notes: svn path=/head/; revision=207617
* Acquire the page lock around vm_page_unwire(). For consistency, extend theAlan Cox2010-05-031-0/+2
| | | | | | | | | | | scope of the object lock in agp_i810.c. (In this specific case, the scope of the object lock shouldn't matter, but I don't want to create a bad example that might be copied to a case where it did matter.) Reviewed by: kib Notes: svn path=/head/; revision=207574
* On Alan's advice, rather than do a wholesale conversion on a singleKip Macy2010-04-301-0/+2
| | | | | | | | | | | | | | | architecture from page queue lock to a hashed array of page locks (based on a patch by Jeff Roberson), I've implemented page lock support in the MI code and have only moved vm_page's hold_count out from under page queue mutex to page lock. This changes pmap_extract_and_hold on all pmaps. Supported by: Bitgravity Inc. Discussed with: alc, jeffr, and kib Notes: svn path=/head/; revision=207410
* fx->lock is used as an index, correct test case.Robert Noland2010-04-281-1/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=207318
* remove vm obect tracker that slipped in from prior work.Robert Noland2010-04-241-1/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=207156