aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm
AgeCommit message (Collapse)AuthorFilesLines
2014-08-09Merge branch 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6Linus Torvalds2-5/+10
Pull nouveau drm updates from Ben Skeggs: "Apologies for not getting this done in time for Dave's drm-next merge window. As he mentioned, a pre-existing bug reared its head a lot more obviously after this lot of changes. It took quite a bit of time to track it down. In any case, Dave suggested I try my luck by sending directly to you this time. Overview: - more code for Tegra GK20A from NVIDIA - probing, reclockig - better fix for Kepler GPUs that have the graphics engine powered off on startup, method courtesy of info provided by NVIDIA - unhardcoding of a bunch of graphics engine setup on Fermi/Kepler/Maxwell, will hopefully solve some issues people have noticed on higher-end models - support for "Zero Bandwidth Clear" on Fermi/Kepler/Maxwell, needs userspace support in general, but some lucky apps will benefit automagically - reviewed/exposed the full object APIs to userspace (finally), gives it access to perfctrs, ZBC controls, various events. More to come in the future. - various other fixes" Acked-by: Dave Airlie <[email protected]> * 'linux-3.17' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (87 commits) drm/nouveau: expose the full object/event interfaces to userspace drm/nouveau: fix headless mode drm/nouveau: hide sysfs pstate file behind an option again drm/nv50/disp: shhh compiler drm/gf100-/gr: implement the proper SetShaderExceptions method drm/gf100-/gr: remove some broken ltc bashing, for now drm/gf100-/gr: unhardcode attribute cb config drm/gf100-/gr: fetch tpcs-per-ppc info on startup drm/gf100-/gr: unhardcode pagepool config drm/gf100-/gr: unhardcode bundle cb config drm/gf100-/gr: improve initial context patch list helpers drm/gf100-/gr: add support for zero bandwidth clear drm/nouveau/ltc: add zbc drivers drm/nouveau/ltc: s/ltcg/ltc/ + cleanup drm/nouveau: use ram info from nvif_device drm/nouveau/disp: implement nvif event sources for vblank/connector notifiers drm/nouveau/disp: allow user direct access to channel control registers drm/nouveau/disp: audit and version display classes drm/nouveau/disp: audit and version SCANOUTPOS method drm/nv50-/disp: audit and version PIOR_PWR method ...
2014-08-10drm/ttm: expose CPU address of DMA-allocated pagesAlexandre Courbot2-5/+10
Pages allocated using the DMA API have a coherent memory mapping. Make this mapping visible to drivers so they can decide to use it instead of creating their own redundant one. Signed-off-by: Alexandre Courbot <[email protected]> Acked-by: David Airlie <[email protected]> Signed-off-by: Ben Skeggs <[email protected]>
2014-08-07Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linuxLinus Torvalds6-41/+51
Pull DRM updates from Dave Airlie: "Like all good pull reqs this ends with a revert, so it must mean we tested it, [ Ed. That's _one_ way of looking at it ] This pull is missing nouveau, Ben has been stuck trying to track down a very longstanding bug that revealed itself due to some other changes. I've asked him to send you a direct pull request for nouveau once he cleans things up. I'm away until Monday so don't want to delay things, you can make a decision on that when he sends it, I have my phone so I can ack things just not really merge much. It has one trivial conflict with your tree in armada_drv.c, and also the pull request contains some component changes that are already in your tree, the base tree from Russell went via Greg's tree already, but some stuff still shows up in here that doesn't when I merge my tree into yours. Otherwise all pretty standard graphics fare, one new driver and changes all over the place. New drivers: - sti kms driver for STMicroelectronics chipsets stih416 and stih407. core: - lots of cleanups to the drm core - DP MST helper code merged - universal cursor planes. - render nodes enabled by default panel: - better panel interfaces - new panel support - non-continuous cock advertising ability ttm: - shrinker fixes i915: - hopefully ditched UMS support - runtime pm fixes - psr tracking and locking - now enabled by default - userptr fixes - backlight brightness fixes - MST support merged - runtime PM for dpms - primary planes locking fixes - gen8 hw semaphore support - fbc fixes - runtime PM on SOix sleep state hw. - mmio base page flipping - lots of vlv/chv fixes. - universal cursor planes radeon: - Hawaii fixes - display scalar support for non-fixed mode displays - new firmware format support - dpm on more asics by default - GPUVM improvements - uncached and wc GTT buffers - BOs > visible VRAM exynos: - i80 interface support - module auto-loading - ipp driver consolidated. armada: - irq handling in crtc layer only - crtc renumbering - add component support - DT interaction changes. tegra: - load as module fixes - eDP bpp and sync polarity fixed - DSI non-continuous clock mode support - better support for importing buffers from nouveau msm: - mdp5/adq8084 v1.3 hw enablement - devicetree clk changse - ifc6410 board working tda998x: - component support - DT documentation update vmwgfx: - fix compat shader namespace" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (551 commits) Revert "drm: drop redundant drm_file->is_master" drm/panel: simple: Use devm_gpiod_get_optional() drm/dsi: Replace upcasting macro by function drm/panel: ld9040: Replace upcasting macro by function drm/exynos: dp: Modify driver to support drm_panel drm/exynos: Move DP setup into commit() drm/panel: simple: Add AUO B133HTN01 panel support drm/panel: simple: Support delays in panel functions drm/panel: simple: Add proper definition for prepare and unprepare drm/panel: s6e8aa0: Add proper definition for prepare and unprepare drm/panel: ld9040: Add proper definition for prepare and unprepare drm/tegra: Add support for panel prepare and unprepare routines drm/exynos: dsi: Add support for panel prepare and unprepare routines drm/exynos: dpi: Add support for panel prepare and unprepare routines drm/panel: simple: Add dummy prepare and unprepare routines drm/panel: s6e8aa0: Add dummy prepare and unprepare routines drm/panel: ld9040: Add dummy prepare and unprepare routines drm/panel: Provide convenience wrapper for .get_modes() drm/panel: add .prepare() and .unprepare() functions drm/panel: simple: Remove simple-panel compatible ...
2014-08-05drm/ttm: Pass GFP flags in order to avoid deadlock.Tetsuo Handa2-19/+19
Commit 7dc19d5a "drivers: convert shrinkers to new count/scan API" added deadlock warnings that ttm_page_pool_free() and ttm_dma_page_pool_free() are currently doing GFP_KERNEL allocation. But these functions did not get updated to receive gfp_t argument. This patch explicitly passes sc->gfp_mask or GFP_KERNEL to these functions, and removes the deadlock warning. Signed-off-by: Tetsuo Handa <[email protected]> Cc: stable <[email protected]> [2.6.35+] Signed-off-by: Dave Airlie <[email protected]>
2014-08-05drm/ttm: Fix possible stack overflow by recursive shrinker calls.Tetsuo Handa1-3/+7
While ttm_dma_pool_shrink_scan() tries to take mutex before doing GFP_KERNEL allocation, ttm_pool_shrink_scan() does not do it. This can result in stack overflow if kmalloc() in ttm_page_pool_free() triggered recursion due to memory pressure. shrink_slab() => ttm_pool_shrink_scan() => ttm_page_pool_free() => kmalloc(GFP_KERNEL) => shrink_slab() => ttm_pool_shrink_scan() => ttm_page_pool_free() => kmalloc(GFP_KERNEL) Change ttm_pool_shrink_scan() to do like ttm_dma_pool_shrink_scan() does. Signed-off-by: Tetsuo Handa <[email protected]> Cc: stable <[email protected]> [2.6.35+] Signed-off-by: Dave Airlie <[email protected]>
2014-08-05drm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.Tetsuo Handa1-2/+4
I can observe that RHEL7 environment stalls with 100% CPU usage when a certain type of memory pressure is given. While the shrinker functions are called by shrink_slab() before the OOM killer is triggered, the stall lasts for many minutes. One of reasons of this stall is that ttm_dma_pool_shrink_count()/ttm_dma_pool_shrink_scan() are called and are blocked at mutex_lock(&_manager->lock). GFP_KERNEL allocation with _manager->lock held causes someone (including kswapd) to deadlock when these functions are called due to memory pressure. This patch changes "mutex_lock();" to "if (!mutex_trylock()) return ...;" in order to avoid deadlock. Signed-off-by: Tetsuo Handa <[email protected]> Cc: stable <[email protected]> [3.3+] Signed-off-by: Dave Airlie <[email protected]>
2014-08-05drm/ttm: Choose a pool to shrink correctly in ttm_dma_pool_shrink_scan().Tetsuo Handa1-3/+3
We can use "unsigned int" instead of "atomic_t" by updating start_pool variable under _manager->lock. This patch will make it possible to avoid skipping when choosing a pool to shrink in round-robin style, after next patch changes mutex_lock(_manager->lock) to !mutex_trylock(_manager->lork). Signed-off-by: Tetsuo Handa <[email protected]> Cc: stable <[email protected]> [3.3+] Signed-off-by: Dave Airlie <[email protected]>
2014-08-05drm/ttm: Fix possible division by 0 in ttm_dma_pool_shrink_scan().Tetsuo Handa1-0/+3
list_empty(&_manager->pools) being false before taking _manager->lock does not guarantee that _manager->npools != 0 after taking _manager->lock because _manager->npools is updated under _manager->lock. Signed-off-by: Tetsuo Handa <[email protected]> Cc: stable <[email protected]> [3.3+] Signed-off-by: Dave Airlie <[email protected]>
2014-07-22drm/ttm: make device_released staticDave Airlie1-1/+1
fixes sparse warning, and removes potentially dangerous name from namespace. Signed-off-by: Dave Airlie <[email protected]>
2014-07-22drm/ttm: use gfp_t instead of int for flags.Dave Airlie1-1/+1
fixes sparse warning. Signed-off-by: Dave Airlie <[email protected]>
2014-07-08dma-buf: use reservation objectsMaarten Lankhorst1-1/+1
This allows reservation objects to be used in dma-buf. it's required for implementing polling support on the fences that belong to a dma-buf. Signed-off-by: Maarten Lankhorst <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> #drivers/media/v4l2-core/ Acked-by: Thomas Hellstrom <[email protected]> #drivers/gpu/drm/ttm Acked-by: Sumit Semwal <[email protected]> Acked-by: Daniel Vetter <[email protected]> Signed-off-by: Vincent Stehlé <[email protected]> #drivers/gpu/drm/armada/ Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-07-08ttm: use NULL instead of 0 for ttm_bo_reserve()'s pointer arg.Martin Kepplinger1-7/+7
Fix a sparse warning: ttm_bo_reserve()'s last argument is a pointer to a struct, so use NULL as nullpointer. Signed-off-by: Martin Kepplinger <[email protected]> Reviewed-by: Jingoo Han <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2014-07-08drm/ttm: fix handling of TTM_PL_FLAG_TOPDOWN v2Christian König2-4/+5
bo->mem.placement is not initialized when ttm_bo_man_get_node is called, so the flag had no effect at all. v2: change nouveau and vmwgfx as well Signed-off-by: Christian König <[email protected]> Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
2014-07-08drm/ttm: recognize ARM arch in ioprot handlerLucas Stach1-1/+1
Nouveau can now be used on ARM, so add an ioprot handler for this architecture. Signed-off-by: Lucas Stach <[email protected]> Signed-off-by: Alexandre Courbot <[email protected]> Signed-off-by: David Herrmann <[email protected]>
2014-04-05Merge tag 'ttm-next-2014-04-04' of ↵Dave Airlie2-17/+17
git://people.freedesktop.org/~thomash/linux into drm-next Pull request of 2014-04-04 Currently only a single patch fixing up mixed use of the ttm_bo_reserve and ww_mutex APIs * tag 'ttm-next-2014-04-04' of git://people.freedesktop.org/~thomash/linux: drm/ttm: Hide the implementation details of reservation
2014-04-04drm/ttm: Hide the implementation details of reservationThomas Hellstrom2-17/+17
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-04-04drm: Add support for two-ended allocation, v3Lauri Kasanen1-3/+8
Clients like i915 need to segregate cache domains within the GTT which can lead to small amounts of fragmentation. By allocating the uncached buffers from the bottom and the cacheable buffers from the top, we can reduce the amount of wasted space and also optimize allocation of the mappable portion of the GTT to only those buffers that require CPU access through the GTT. For other drivers, allocating small bos from one end and large ones from the other helps improve the quality of fragmentation. Based on drm_mm work by Chris Wilson. v3: Changed to use a TTM placement flag v2: Updated kerneldoc Cc: Chris Wilson <[email protected]> Cc: Ben Widawsky <[email protected]> Cc: Christian König <[email protected]> Signed-off-by: Lauri Kasanen <[email protected]> Signed-off-by: David Airlie <[email protected]>
2014-03-28drm/ttm: Add a ttm_ref_object_exists functionThomas Hellstrom1-0/+46
A function to be used to check whether a caller has put a ref object (opened) a struct ttm_base_object Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-03-18Merge branch 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux into ↵Dave Airlie1-1/+2
drm-next This is the 3rd respin of the drm-anon patches. They allow module unloading, use the pin_fs_* helpers recommended by Al and are rebased on top of drm-next. Note that there are minor conflicts with the "drm-minor" branch. * 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux: drm: init TTM dev_mapping in ttm_bo_device_init() drm: use anon-inode instead of relying on cdevs drm: add pseudo filesystem for shared inodes
2014-03-16drm: init TTM dev_mapping in ttm_bo_device_init()David Herrmann1-1/+2
With dev->anon_inode we have a global address_space ready for operation right from the beginning. Therefore, there is no need to do a delayed setup with TTM. Instead, set dev_mapping during initialization in ttm_bo_device_init() and remove any "if (dev_mapping)" conditions. Cc: Dave Airlie <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Thomas Hellstrom <[email protected]> Signed-off-by: David Herrmann <[email protected]>
2014-03-12drm/ttm: don't oops if no invalidate_caches()Rob Clark1-3/+5
A few of the simpler TTM drivers (cirrus, ast, mgag200) do not implement this function. Yet can end up somehow with an evicted bo: BUG: unable to handle kernel NULL pointer dereference at (null) IP: [< (null)>] (null) PGD 16e761067 PUD 16e6cf067 PMD 0 Oops: 0010 [#1] SMP Modules linked in: bnep bluetooth rfkill fuse ip6t_rpfilter ip6t_REJECT ipt_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw iptable_filter ip_tables sg btrfs zlib_deflate raid6_pq xor dm_queue_length iTCO_wdt iTCO_vendor_support coretemp kvm dcdbas dm_service_time microcode serio_raw pcspkr lpc_ich mfd_core i7core_edac edac_core ses enclosure ipmi_si ipmi_msghandler shpchp acpi_power_meter mperf nfsd auth_rpcgss nfs_acl lockd uinput sunrpc dm_multipath xfs libcrc32c ata_generic pata_acpi sr_mod cdrom sd_mod usb_storage mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit lpfc drm_kms_helper ttm crc32c_intel ata_piix bfa drm ixgbe libata i2c_core mdio crc_t10dif ptp crct10dif_common pps_core scsi_transport_fc dca scsi_tgt megaraid_sas bnx2 dm_mirror dm_region_hash dm_log dm_mod CPU: 16 PID: 2572 Comm: X Not tainted 3.10.0-86.el7.x86_64 #1 Hardware name: Dell Inc. PowerEdge R810/0H235N, BIOS 0.3.0 11/14/2009 task: ffff8801799dabc0 ti: ffff88016c884000 task.ti: ffff88016c884000 RIP: 0010:[<0000000000000000>] [< (null)>] (null) RSP: 0018:ffff88016c885ad8 EFLAGS: 00010202 RAX: ffffffffa04e94c0 RBX: ffff880178937a20 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000240004 RDI: ffff880178937a00 RBP: ffff88016c885b60 R08: 00000000000171a0 R09: ffff88007cf171a0 R10: ffffea0005842540 R11: ffffffff810487b9 R12: ffff880178937b30 R13: ffff880178937a00 R14: ffff88016c885b78 R15: ffff880179929400 FS: 00007f81ba2ef980(0000) GS:ffff88007cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000016e763000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Stack: ffffffffa0306fae ffff8801799295c0 0000000000260004 0000000000000001 ffff88016c885b60 ffffffffa0307669 00ff88007cf17738 ffff88017cf17700 ffff880178937a00 ffff880100000000 ffff880100000000 0000000079929400 Call Trace: [<ffffffffa0306fae>] ? ttm_bo_handle_move_mem+0x54e/0x5b0 [ttm] [<ffffffffa0307669>] ? ttm_bo_mem_space+0x169/0x340 [ttm] [<ffffffffa0307bd7>] ttm_bo_move_buffer+0x117/0x130 [ttm] [<ffffffff81130001>] ? perf_event_init_context+0x141/0x220 [<ffffffffa0307cb1>] ttm_bo_validate+0xc1/0x130 [ttm] [<ffffffffa04e7377>] mgag200_bo_pin+0x87/0xc0 [mgag200] [<ffffffffa04e56c4>] mga_crtc_cursor_set+0x474/0xbb0 [mgag200] [<ffffffff811971d2>] ? __mem_cgroup_commit_charge+0x152/0x3b0 [<ffffffff815c4182>] ? mutex_lock+0x12/0x2f [<ffffffffa0201433>] drm_mode_cursor_common+0x123/0x170 [drm] [<ffffffffa0205231>] drm_mode_cursor_ioctl+0x41/0x50 [drm] [<ffffffffa01f5ca2>] drm_ioctl+0x502/0x630 [drm] [<ffffffff815cbab4>] ? __do_page_fault+0x1f4/0x510 [<ffffffff8101cb68>] ? __restore_xstate_sig+0x218/0x4f0 [<ffffffff811b4445>] do_vfs_ioctl+0x2e5/0x4d0 [<ffffffff8124488e>] ? file_has_perm+0x8e/0xa0 [<ffffffff811b46b1>] SyS_ioctl+0x81/0xa0 [<ffffffff815d05d9>] system_call_fastpath+0x16/0x1b Code: Bad RIP value. RIP [< (null)>] (null) RSP <ffff88016c885ad8> CR2: 0000000000000000 Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jérôme Glisse <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]> Cc: [email protected]
2014-03-12drm/ttm: Work around performance regression with VM_PFNMAPThomas Hellstrom1-5/+7
A performance regression was introduced in TTM in linux 3.13 when we started using VM_PFNMAP for shared mappings. In theory this should've been faster due to less page book-keeping but it appears like VM_PFNMAP + x86 PAT + write-combine is a particularly cpu-hungry combination, as seen by largely increased cpu-usage on r200 GL video playback. Until we've sorted out why, revert to always use VM_MIXEDMAP. Reference: freedesktop.org bugzilla bug #75719 Reported-and-tested-by: <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Cc: [email protected]
2014-02-18drm/ttm: Fix memory leak in ttm_agp_backend.cMasanari Iida1-0/+1
This patch fix a memory leak found by cppcheck. [drivers/gpu/drm/ttm/ttm_agp_backend.c:129]: (error) Memory leak: agp_be Signed-off-by: Masanari Iida <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2014-02-05drm/ttm: Don't clear page metadata of imported sg pagesThomas Hellstrom1-0/+3
These page pointers shouldn't be visible to TTM in the first place, but until we fix that up, don't clear the page metadata because that will upset the exporter. Reported-and-tested-by: Cristoph Haag <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-05drm/ttm: Fix TTM object open regressionThomas Hellstrom1-1/+1
Commit drm/ttm: ttm object security fixes for render nodes introduced a regression where, if a TTM object was opened multiple times from the same open file, the caller would spin uninterruptibly in the kernel. Fix this. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-01-20Merge branch 'drm-intel-next' of ↵Dave Airlie2-4/+5
git://people.freedesktop.org/~danvet/drm-intel into drm-next drm-intel-next-2014-01-10: - final bits for runtime D3 on Haswell from Paul (now enabled fully) - parse the backlight modulation freq information in the VBT from Jani (but not yet used) - more watermark improvements from Ville for ilk-ivb and bdw - bugfixes for fastboot from Jesse - watermark fix for i830M (but not yet everything) - vlv vga hotplug w/a (Imre) - piles of other small improvements, cleanups and fixes all over Note that the pull request includes a backmerge of the last drm-fixes pulled into Linus' tree - things where getting a bit too messy. So the shortlog also contains a bunch of patches from Linus tree. Please yell if you want me to frob it for you a bit. * 'drm-intel-next' of git://people.freedesktop.org/~danvet/drm-intel: (609 commits) drm/i915/bdw: make sure south port interrupts are enabled properly v2 drm/i915: Include more information in disabled hotplug interrupt warning drm/i915: Only complain about a rogue hotplug IRQ after disabling drm/i915: Only WARN about a stuck hotplug irq ONCE drm/i915: s/hotplugt_status_gen4/hotplug_status_g4x/
2014-01-14Merge tag 'vmwgfx-next-2014-01-13' of ↵Dave Airlie1-36/+54
git://people.freedesktop.org/~thomash/linux into drm-next Anyway, nothing big here, Three more code cleanup patches from Rashika Kheria, and one TTM/vmwgfx patch from me that tightens security around TTM objects enough for them to opened using prime objects from render nodes: Previously any client could access a shared buffer using the "name", also without actually opening it. Now a reference is required, and for render nodes such a reference is intended to only be obtainable using a prime fd. vmwgfx-next 2014-01-13 pull request * tag 'vmwgfx-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux: drivers: gpu: Mark functions as static in vmwgfx_fence.c drivers: gpu: Mark functions as static in vmwgfx_buffer.c drivers: gpu: Mark functions as static in vmwgfx_kms.c drm/ttm: ttm object security fixes for render nodes
2014-01-08drivers: gpu: Remove unused function in ttm_lock.cRashika Kheria1-8/+0
Remove unused function ttm_write_lock_downgrade() from drm/ttm/ttm_lock.c. This eliminates the following warning in drm/ttm/ttm_lock.c: drivers/gpu/drm/ttm/ttm_lock.c:189:6: warning: no previous prototype for ‘ttm_write_lock_downgrade’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria <[email protected]> Reviewed-by: Josh Triplett <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2014-01-08drivers: gpu: Mark function as static in ttm_bo_util.cRashika Kheria1-2/+2
Mark functions as static because they are not used outside the file drm/ttm/ttm_bo_util.c. This eliminates the following warnings in drm/ttm/ttm_bo_util.c: drivers/gpu/drm/ttm/ttm_bo_util.c:190:5: warning: no previous prototype for ‘ttm_mem_reg_ioremap’ [-Wmissing-prototypes] drivers/gpu/drm/ttm/ttm_bo_util.c:222:6: warning: no previous prototype for ‘ttm_mem_reg_iounmap’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria <[email protected]> Reviewed-by: Josh Triplett <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2014-01-08drivers: gpu: Mark function as static in ttm_bo.cRashika Kheria1-1/+1
Mark function as static because it is not used outside file drm/ttm/ttm_bo.c. This eliminates the following warning in drm/ttm/ttm_bo.c: drivers/gpu/drm/ttm/ttm_bo.c:960:5: warning: no previous prototype for ‘ttm_bo_move_buffer’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria <[email protected]> Reviewed-by: Josh Triplett <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2014-01-08drm/ttm: ttm object security fixes for render nodesThomas Hellstrom1-36/+54
When a client looks up a ttm object, don't look it up through the device hash table, but rather from the file hash table. That makes sure that the client has indeed put a reference on the object, or in gem terms, has opened the object; either using prime or using the global "name". To avoid a performance loss, make sure the file hash table entries can be looked up from under an RCU lock, and as a consequence, replace the rwlock with a spinlock, since we never need to take it in read mode only anymore. Finally add a ttm object lookup function for the device hash table, that is intended to be used when we put a ref object on a base object or, in gem terms, when we open the object. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-01-08drm/ttm: Correctly set page mapping and -index membersThomas Hellstrom2-4/+28
Needed for some vm operations; most notably unmap_mapping_range() with even_cows = 0. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-01-08drm/ttm: Refuse to fault (prime-) imported pagesThomas Hellstrom1-0/+9
This is illegal for at least two reasons: 1) While it may work on some platforms / iommus, obtaining page pointers from mapped sg-lists is illegal, since the DMA API allows page pointer information to be destroyed in the sg mapping process. 2) TTM has no way of determining the linear kernel map caching state of the underlying pages. PTEs with conflicting caching state pointing to the same pfn is not allowed. TTM operations touching pages of imported sg-tables should be redirected through the proper dma-buf operations. Signed-off-by: Thomas Hellstrom <[email protected]> Acked-by: Daniel Vetter <[email protected]>
2014-01-08drm/ttm: Use VM_PFNMAP for shared bo mapsThomas Hellstrom1-3/+15
VM_PFNMAP is faster than VM_MIXEDMAP due to reduced page administration so use it for shared maps where we don't have any Copy-On-Write pages. For private maps, we continue to use VM_MIXEDMAP. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-12-23drm/ttm: Fix swapin regressionThomas Hellstrom1-1/+2
Commit "drm/ttm: Don't move non-existing data" didn't take the swapped-out corner case into account. This patch corrects that. Fixes blank screen after attempted suspend / hibernate on vmwgfx. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-12-18drm: Kill DRM_SUSERDaniel Vetter1-1/+1
Checking directly for the right capability is simpler. Also this rids us of a few places that use DRM_CURRENTPID. Signed-off-by: Daniel Vetter <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2013-12-16drm/ttm: Fix accesses through vmas with only partial coverageThomas Hellstrom1-3/+3
VMAs covering a bo but that didn't start at the same address space offset as the bo they were mapping were incorrectly generating SEGFAULT errors in the fault handler. Reported-by: Joseph Dolinak <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Cc: [email protected]
2013-11-21Merge branch 'ttm-fixes-3.13' of git://people.freedesktop.org/~thomash/linux ↵Dave Airlie3-9/+59
into drm-fixes The set_need_resched() removal fix and yet another fix in ttm_bo_move_memcpy(). * 'ttm-fixes-3.13' of git://people.freedesktop.org/~thomash/linux: drm/ttm: Remove set_need_resched from the ttm fault handler drm/ttm: Don't move non-existing data
2013-11-20drm/ttm: Remove set_need_resched from the ttm fault handlerThomas Hellstrom2-7/+54
Addresses "[BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE". In the first occurence it was used to try to be nice while releasing the mmap_sem and retrying the fault to work around a locking inversion. The second occurence was never used. There has been some discussion whether we should change the locking order to mmap_sem -> bo_reserve. This patch doesn't address that issue, and leaves that locking order undefined. The solution that we release the mmap_sem if tryreserve fails and wait for the buffer to become unreserved is something we want in any case, and follows how the core vm system waits for pages to be come unlocked while releasing the mmap_sem. The code also outlines what needs to be changed if we want to establish the locking order as mmap_sem -> bo::reserve. One slight issue that remains with this code is that the fault handler might be prone to starvation if another thread countinously reserves the buffer. IMO that usage pattern is highly unlikely. Signed-off-by: Thomas Hellstrom <[email protected]>
2013-11-20drm/ttm: Don't move non-existing dataThomas Hellstrom1-2/+5
If ttm_bo_move_memcpy was instructed to move a non-populated ttm to io memory, it would first populate the ttm, then move the data and then destroy the ttm. That's stupid. However, some drivers might have relied on this to clear io memory from old stuff. So instead of a NOP, which would be the most efficient, just clear the destination. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-11-18drm/ttm: Add a minimal prime implementation for ttm base objectsThomas Hellstrom1-6/+248
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-11-18drm/ttm: Allow execbuf util reserves without ticketThomas Hellstrom1-13/+19
If no reservation ticket is given to the execbuf reservation utilities, try reservation with non-blocking semantics. This is intended for eviction paths that use the execbuf reservation utilities for convenience rather than for deadlock avoidance. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-11-14Merge branch 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux ↵Dave Airlie1-17/+13
into drm-next The page-prot bit fix. * 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux: drm/ttm: Fix vma page_prot bit manipulation
2013-11-12drm/ttm: Fix vma page_prot bit manipulationThomas Hellstrom1-17/+13
Fix a long-standing TTM issue where we manipulated the vma page_prot bits while mmap_sem was taken in read mode only. We now make a local copy of the vma structure which we pass when we set the ptes. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jerome Glisse <[email protected]>
2013-11-07Merge branch 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux ↵Dave Airlie3-36/+102
into drm-next - A couple of fixes that never made it into fixes-3.12 - Make NO_EVICT bo's available for shrinkers when on delayed-delete list - Allow retrying page-faults that need to wait for GPU. * 'ttm-next-3.13' of git://people.freedesktop.org/~thomash/linux: drm/ttm: Fix memory type compatibility check drm/ttm: Fix ttm_bo_move_memcpy drm/ttm: Handle in-memory region copies drm/ttm: Make NO_EVICT bos available to shrinkers pending destruction drm/ttm: Allow vm fault retries
2013-11-06drm/ttm: Fix memory type compatibility checkThomas Hellstrom1-12/+20
Also check the busy placements before deciding to move a buffer object. Failing to do this may result in a completely unneccessary move within a single memory type. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Cc: [email protected]
2013-11-06drm/ttm: Fix ttm_bo_move_memcpyThomas Hellstrom1-11/+17
All error paths will want to keep the mm node, so handle this at the function exit. This fixes an ioremap failure error path. Also add some comments to make the function a bit easier to understand. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Cc: [email protected]
2013-11-06drm/ttm: Handle in-memory region copiesJakob Bornecrantz1-1/+3
Fix the case where the ttm pointer may be NULL causing a NULL pointer dereference. Signed-off-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Thomas Hellström <[email protected]> Cc: [email protected]
2013-11-06drm/ttm: Make NO_EVICT bos available to shrinkers pending destructionThomas Hellstrom1-1/+13
NO_EVICT bos that are not idle when all references are dropped are put on the delayed destroy list. However, since they are not on LRU lists, they are not available to shrinkers at that point, and buffers on the delayed destroy list are not checked very often for idle. So when these buffers are put on the delayed destroy list, clear the NO_EVICT flag and put them on the right LRU list. This way they are immediately available for eviction or shrinkers and will not cause false OOMS. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2013-11-06drm/ttm: Allow vm fault retriesThomas Hellstrom1-12/+50
Make use of the FAULT_FLAG_ALLOW_RETRY flag to allow dropping the mmap_sem while waiting for bo idle. FAULT_FLAG_ALLOW_RETRY appears to be primarily designed for disk waits but should work just as fine for GPU waits.. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>