summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_ioc32.c
AgeCommit message (Collapse)AuthorFilesLines
2017-07-26Merge airlied/drm-next into drm-misc-nextDaniel Vetter1-460/+293
I need this to be able to apply the deferred fbdev setup patches, I need the relevant prep work that landed through the drm-intel tree. Also squash in conflict fixup from Laurent Pinchart. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-07-13drm: Add missing field copy in compat_drm_versionJeffy Chen1-0/+3
DRM_IOCTL_VERSION is supposed to update the name_len/date_len/desc_len fields to user. Fixes: 012c6741c6aa ("switch compat_drm_version() to drm_ioctl_kernel()") Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-06Fix trivial misannotationsAl Viro1-2/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04drm compat: ia64 is not biarchAl Viro1-2/+2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04drm_compat_ioctl(): tidy up a bitAl Viro1-13/+9
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04switch compat_drm_mapbufs() to drm_ioctl_kernel()Al Viro1-36/+34
Another horror like addbufs; this one is even uglier. With that done, drm_ioc32.c should be sane. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04switch compat_drm_rmmap() to drm_ioctl_kernel()Al Viro1-10/+4
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04switch compat_drm_mode_addfb2() to drm_ioctl_kernel()Al Viro1-28/+10
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04switch compat_drm_wait_vblank() to drm_ioctl_kernel()Al Viro1-16/+10
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04switch compat_drm_update_draw()Al Viro1-14/+3
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04compat_drm: switch sg ioctlsAl Viro1-18/+12
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-07-04compat_drm: switch AGP compat ioctls to drm_ioctl_kernel()Al Viro1-65/+44
[folded a fix from Colin King] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_dma() to drm_ioctl_kernel()Al Viro1-25/+13
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_resctx() to drm_ioctl_kernel()Al Viro1-13/+7
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_getsareactx() to drm_ioctl_kernel()Al Viro1-15/+8
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_setsareactx() to drm_ioctl_kernel()Al Viro1-11/+6
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_freebufs() to drm_ioctl_kernel()Al Viro1-11/+5
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_markbufs() to drm_ioctl_kernel()Al Viro1-11/+7
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_addmap() to drm_ioctl_kernel()Al Viro1-20/+13
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_getstats() to drm_ioctl_kernel()Al Viro1-18/+4
The reason we call drm_ioctl_kernel() at all is that we want error handling; conversions would be pointless there - user buffer is simply zeroed. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_getclient() to drm_ioctl_kernel()Al Viro1-17/+12
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_infobufs() to drm_ioctl_kernel()Al Viro1-34/+24
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_getmap() to drm_ioctl_kernel()Al Viro1-21/+12
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27compat_drm_setunique(): don't botherAl Viro1-16/+3
native equivalent would just fail with -EINVAL; do the same directly. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_getunique() to drm_ioctl_kernel()Al Viro1-13/+8
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_version() to drm_ioctl_kernel()Al Viro1-26/+16
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27switch compat_drm_addbufs() to drm_ioctl_kernel()Al Viro1-13/+17
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-05-27drm_compat_ioctl(): prepare for conversions to drm_ioctl_kernel()Al Viro1-34/+47
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-04-04drm: document drm_ioctl.[hc]Daniel Vetter1-36/+40
Also unify/merge with the existing stuff. I was a bit torn where to put this, but in the end I decided to put all the ioctl/sysfs/debugfs stuff into drm-uapi.rst. That means we have a bit a split with the other uapi related stuff used internally, like drm_file.[hc], but I think overall this makes more sense. If it's too confusing we can always add more cross-links to make it more discoverable. But the auto-sprinkling of links kernel-doc already does seems sufficient. Also for prettier docs and more cross-links, switch the internal defines over to an enum, as usual. v2: Update kerneldoc fro drm_compat_ioctl too (caught by 0day), plus a bit more drive-by polish. v3: Fix typo, spotted by xerpi on irc (Sergi). v4: Add missing space in comment (Neil). Cc: Sergi Granell <xerpi.g.12@gmail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170404095304.17599-4-daniel.vetter@ffwll.ch
2017-02-28gpu: drm: core: Convert printk(KERN_<LEVEL> to pr_<level>Joe Perches1-2/+1
Use a more common logging style. Miscellanea: o Coalesce formats and realign arguments Signed-off-by: Joe Perches <joe@perches.com> [danvet: Resolve minor conflict in drm_edid.c] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-09-19drm: drop obsolete drm_core.hDavid Herrmann1-1/+0
The drm_core.h header contains a set of constants meant to be used throughout DRM. However, as it turns out, they're each used just once and don't bring any benefit. They're also grossly mis-named and lack name-spacing. This patch inlines them, or moves them into drm_internal.h as appropriate: - CORE_AUTHOR and CORE_DESC are inlined into corresponding MODULE_*() macros. It's just confusing having to follow 2 pointers when trying to find the definition of these fields. Grep'ping for MODULE_AUTHOR() should reveal the full information, if there's no strong reason not to. - CORE_NAME, CORE_DATE, CORE_MAJOR, CORE_MINOR, and CORE_PATCHLEVEL are inlined into the sysfs 'version' attribute. They're stripped everywhere else (which is just some printk() statements). CORE_NAME just doesn't make *any* sense, as we hard-code it in many places, anyway. The other constants are outdated and just serve binary-compatibility purposes. Hence, inline them in 'version' sysfs attribute (we might even try dropping it..). - DRM_IF_MAJOR and DRM_IF_MINOR are moved into drm_internal.h as they're only used by the global ioctl handlers. Furthermore, versioning interfaces breaks backports and as such is deprecated, anyway. We just keep them for historic reasons. I doubt anyone will ever modify them again. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-6-dh.herrmann@gmail.com
2016-09-15drm: Only use compat ioctl for addfb2 on X86/IA64Kristian H. Kristensen1-0/+4
Similar to struct drm_update_draw, struct drm_mode_fb_cmd2 has an unaligned 64 bit field (modifier). This get packed differently between 32 bit and 64 bit modes on architectures that can handle unaligned 64 bit access (X86 and IA64). Other architectures pack the structs the same and don't need the compat wrapper. Use the same condition for drm_mode_fb_cmd2 as we use for drm_update_draw. Note that only the modifier will be packed differently between compat and non-compat versions. Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org> [seanpaul added not at bottom of commit msg re: modifier] Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: http://patchwork.freedesktop.org/patch/msgid/1473801645-116011-1-git-send-email-hoegsberg@chromium.org
2016-08-22drm: avoid exposing kernel stack in compat_drm_getstatsHeinrich Schuchardt1-0/+1
The C standard does not specify the size of the integer used to store an enum. Hence in structure drm_stats32_t alignment bytes may exist. To avoid exposing bytes from the kernel stack it is necessary to initialize variable s32 completely. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1471802179-2886-1-git-send-email-xypron.glpk@gmx.de
2015-09-30drm: Remove __OS_HAS_AGPDaniel Vetter1-3/+3
We already express the drm/agp depencies correctly in Kconfig, so we can rip this remnant from the shared drm core days. Aside: Pretty much all the #ifdefs in radeon/nouveau could be killed if ttm would provide dummy functions. I'm not going to volunteer for that though. v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville v3: Polish from Ville's review. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> (v2) Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-07-24Merge tag 'topic/drm-misc-2015-07-23' of ↵Dave Airlie1-29/+26
git://anongit.freedesktop.org/drm-intel into drm-next Update drm-misc pull request since the first one didn't go in yet. Few atomic helper patches, rejecting some old dri1 crap for modern drivers and a few trivial things on top. * tag 'topic/drm-misc-2015-07-23' of git://anongit.freedesktop.org/drm-intel: drm/mgag200: remove unneeded variable drm/mgag200: remove unused variables drm/atomic: Only update crtc->x/y if it's part of the state, v2. drm/fb: drop panic handling drm: Fix warning with make xmldocs caused by drm_irq.c drm/gem: rip out drm vma accounting for gem mmaps drm/fourcc: Add formats R8, RG88, GR88 drm/atomic: Cleanup on error properly in the atomic ioctl. drm: Update plane->fb also for page_flip drm: remove redundant code form drm_ioc32.c drm: reset empty state in transitional helpers drm/crtc-helper: Fixup error handling in drm_helper_crtc_mode_set drm/atomic: Update old_fb after setting a property. drm: Remove useless blank line drm: Reject DRI1 hw lock ioctl functions for kms drivers drm: Convert drm_legacy_ctxbitmap_init to void return type drm: Turn off Legacy Context Functions
2015-07-15drm: Provide compat ioctl for addfb2.1Tvrtko Ursulin1-0/+60
Frame buffer modifiers extensions provided in; commit e3eb3250d84ef97b766312345774367b6a310db8 Author: Rob Clark <robdclark@gmail.com> Date: Thu Feb 5 14:41:52 2015 +0000 drm: add support for tiled/compressed/etc modifier in addfb2 Missed the structure packing/alignment problem where 64-bit members were added after the odd number of 32-bit ones. This makes the compiler produce structures of different sizes under 32- and 64-bit x86 targets and makes the ioctl need explicit compat handling. v2: Removed the typedef. (Daniel Vetter) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: dri-devel@lists.freedesktop.org Cc: Rob Clark <robdclark@gmail.com> Cc: Daniel Stone <daniels@collabora.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: stable@vger.kernel.org [danvet: Squash in compile fix from Mika.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-07-03drm: remove redundant code form drm_ioc32.cJarkko Sakkinen1-29/+26
The compat ioctl handler ends up calling access_ok() twice: first indirectly inside compat_alloc_user_space() and then after returning from that function. This patch fixes issue. v2: there were three invalid removals of access_ok() that I've fixed. Also went through all the changes couple of times and verified that access_ok() is only removed when the buffer is allocated with compat_alloc_user_space(). My deepest apologies for this kind of sloppiness! Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-03-13drm: Silence sparse warningsVille Syrjälä1-1/+1
../drivers/gpu/drm/drm_vm.c:405:6: warning: symbol 'drm_vm_open_locked' was not declared. Should it be static? ../drivers/gpu/drm/drm_vm.c:431:6: warning: symbol 'drm_vm_close_locked' was not declared. Should it be static? ../drivers/gpu/drm/drm_vm.c:681:5: warning: symbol 'drm_vma_info' was not declared. Should it be static? ../drivers/gpu/drm/drm_pci.c:146:5: warning: symbol 'drm_pci_set_unique' was not declared. Should it be static? ../drivers/gpu/drm/drm_pci.c:216:5: warning: symbol 'drm_irq_by_busid' was not declared. Should it be static? ../drivers/gpu/drm/drm_info.c:47:5: warning: symbol 'drm_name_info' was not declared. Should it be static? ../drivers/gpu/drm/drm_info.c:72:5: warning: symbol 'drm_vm_info' was not declared. Should it be static? ../drivers/gpu/drm/drm_info.c:116:5: warning: symbol 'drm_bufs_info' was not declared. Should it be static? ../drivers/gpu/drm/drm_info.c:159:5: warning: symbol 'drm_clients_info' was not declared. Should it be static? ../drivers/gpu/drm/drm_info.c:209:5: warning: symbol 'drm_gem_name_info' was not declared. Should it be static? ../drivers/gpu/drm/drm_ioc32.c:1019:20: warning: symbol 'drm_compat_ioctls' was not declared. Should it be static? ../drivers/gpu/drm/drm_bridge.c:52:12: warning: function 'drm_bridge_attach' with external linkage has definition Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-10-02UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/David Howells1-2/+2
Convert #include "..." to #include <path/...> in drivers/gpu/. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Dave Airlie <airlied@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
2012-02-03drivers/gpu/drm/drm_ioc32.c: initialize all fieldsJulia Lawall1-1/+2
The c32 structure is allocated on the stack and its idx field is not initialized before copying it to user level. This patch takes the value from the result of the ioctl, as done for the other fields. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-01gpu: Add export.h as required to drivers/gpu files.Paul Gortmaker1-0/+1
They need this to get all the EXPORT_SYMBOL variants and THIS_MODULE Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-06-16drivers/gpu/drm: use printk_ratelimited instead of printk_ratelimitChristian Dietrich1-4/+5
Since printk_ratelimit() shouldn't be used anymore (see comment in include/linux/printk.h), replace it with printk_ratelimited. Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-18drm: convert drm_ioctl to unlocked_ioctlArnd Bergmann1-59/+30
drm_ioctl is called with the Big Kernel Lock held, which shows up very high in statistics on vfs_ioctl. Moving the lock into the drm_ioctl function itself makes sure we blame the right subsystem and it gets us one step closer to eliminating the locked version of fops->ioctl. Since drm_ioctl does not require the lock itself, we only need to hold it while calling the specific handler. The 32 bit conversion handlers do not interact with any other code, so they don't need the BKL here either and can just call drm_ioctl. As a bonus, this cleans up all the other users of drm_ioctl which now no longer have to find the inode or call lock_kernel. [airlied: squashed the non-driver bits of the second patch in here, this provides the flag for drivers to use to select unlocked ioctls - but doesn't modify any drivers]. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: David Airlie <airlied@linux.ie> Cc: dri-devel@lists.sourceforge.net Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-03-13drm: Only use DRM_IOCTL_UPDATE_DRAW compat wrapper for compat X86.David Miller1-0/+4
Only X86 32-bit uses a different alignment for "unsigned long long" than it's 64-bit counterpart. Therefore this compat translation is only correct, and only needed, when either CONFIG_X86 or CONFIG_IA64. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2008-10-23drm: Add 32-bit compatibility for DRM_IOCTL_UPDATE_DRAW.Eric Anholt1-0/+34
This fixes vblank support for a 32-bit X Server on a 64-bit kernel. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2008-07-14drm: reorganise drm tree to be more future proof.Dave Airlie1-0/+1073
With the coming of kernel based modesetting and the memory manager stuff, the everything in one directory approach was getting very ugly and starting to be unmanageable. This restructures the drm along the lines of other kernel components. It creates a drivers/gpu/drm directory and moves the hw drivers into subdirectores. It moves the includes into an include/drm, and sets up the unifdef for the userspace headers we should be exporting. Signed-off-by: Dave Airlie <airlied@redhat.com>