summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/etnaviv
Commit message (Collapse)AuthorAgeFilesLines
* drm/etnaviv: add missing failure path to destroy suballocLucas Stach2019-07-101-2/+5
| | | | | | | | | | | | | | commit be132e1375c1fffe48801296279079f8a59a9ed3 upstream. When something goes wrong in the GPU init after the cmdbuf suballocator has been constructed, we fail to destroy it properly. This causes havok later when the GPU is unbound due to a module unload or similar. Fixes: e66774dd6f6a (drm/etnaviv: add cmdbuf suballocator) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* drm/etnaviv: lock MMU while dumping coreLucas Stach2019-06-221-0/+5
| | | | | | | | | | | | | | | | [ Upstream commit 1396500d673bd027683a0609ff84dca7eb6ea2e7 ] The devcoredump needs to operate on a stable state of the MMU while it is writing the MMU state to the coredump. The missing lock allowed both the userspace submit, as well as the GPU job finish paths to mutate the MMU state while a coredump is under way. Fixes: a8c21a5451d8 (drm/etnaviv: add initial etnaviv DRM driver) Reported-by: David Jander <david@protonic.nl> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: David Jander <david@protonic.nl> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
* drm: etnaviv: avoid DMA API warning when importing buffersRussell King2019-05-312-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ Upstream commit 1262cc8893ecb0eb2c21e042d0d268cc180edb61 ] During boot, I get this kernel warning: WARNING: CPU: 0 PID: 19001 at kernel/dma/debug.c:1301 debug_dma_map_sg+0x284/0x3dc etnaviv etnaviv: DMA-API: mapping sg segment longer than device claims to support [len=3145728] [max=65536] Modules linked in: ip6t_REJECT nf_reject_ipv6 ip6t_rpfilter xt_tcpudp ipt_REJECT nf_reject_ipv4 xt_conntrack ip_set nfnetlink ebtable_broute ebtable_nat ip6table_raw ip6table_nat nf_nat_ipv6 ip6table_mangle iptable_raw iptable_nat nf_nat_ipv4 nf_nat nf_conntrack nf_defrag_ipv4 nf_defrag_ipv6 libcrc32c iptable_mangle ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter caam_jr error snd_soc_imx_spdif imx_thermal snd_soc_imx_audmux nvmem_imx_ocotp snd_soc_sgtl5000 caam imx_sdma virt_dma coda rc_cec v4l2_mem2mem snd_soc_fsl_ssi snd_soc_fsl_spdif imx_vdoa imx_pcm_dma videobuf2_dma_contig etnaviv dw_hdmi_cec gpu_sched dw_hdmi_ahb_audio imx6q_cpufreq nfsd sch_fq_codel ip_tables x_tables CPU: 0 PID: 19001 Comm: Xorg Not tainted 4.20.0+ #307 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [<c0019658>] (unwind_backtrace) from [<c001489c>] (show_stack+0x10/0x14) [<c001489c>] (show_stack) from [<c07fb420>] (dump_stack+0x9c/0xd4) [<c07fb420>] (dump_stack) from [<c00312dc>] (__warn+0xf8/0x124) [<c00312dc>] (__warn) from [<c00313d0>] (warn_slowpath_fmt+0x38/0x48) [<c00313d0>] (warn_slowpath_fmt) from [<c00b14e8>] (debug_dma_map_sg+0x284/0x3dc) [<c00b14e8>] (debug_dma_map_sg) from [<c046eb40>] (drm_gem_map_dma_buf+0xc4/0x13c) [<c046eb40>] (drm_gem_map_dma_buf) from [<c04c3314>] (dma_buf_map_attachment+0x38/0x5c) [<c04c3314>] (dma_buf_map_attachment) from [<c046e728>] (drm_gem_prime_import_dev+0x74/0x104) [<c046e728>] (drm_gem_prime_import_dev) from [<c046e5bc>] (drm_gem_prime_fd_to_handle+0x84/0x17c) [<c046e5bc>] (drm_gem_prime_fd_to_handle) from [<c046edd0>] (drm_prime_fd_to_handle_ioctl+0x38/0x4c) [<c046edd0>] (drm_prime_fd_to_handle_ioctl) from [<c0460efc>] (drm_ioctl_kernel+0x90/0xc8) [<c0460efc>] (drm_ioctl_kernel) from [<c0461114>] (drm_ioctl+0x1e0/0x3b0) [<c0461114>] (drm_ioctl) from [<c01cae20>] (do_vfs_ioctl+0x90/0xa48) [<c01cae20>] (do_vfs_ioctl) from [<c01cb80c>] (ksys_ioctl+0x34/0x60) [<c01cb80c>] (ksys_ioctl) from [<c0009000>] (ret_fast_syscall+0x0/0x28) Exception stack(0xd81a9fa8 to 0xd81a9ff0) 9fa0: b6c69c88 bec613f8 00000009 c00c642e bec613f8 b86c4600 9fc0: b6c69c88 bec613f8 c00c642e 00000036 012762e0 01276348 00000300 012d91f8 9fe0: b6989f18 bec613dc b697185c b667be5c irq event stamp: 47905 hardirqs last enabled at (47913): [<c0098824>] console_unlock+0x46c/0x680 hardirqs last disabled at (47922): [<c0098470>] console_unlock+0xb8/0x680 softirqs last enabled at (47754): [<c000a484>] __do_softirq+0x344/0x540 softirqs last disabled at (47701): [<c0038700>] irq_exit+0x124/0x144 ---[ end trace af477747acbcc642 ]--- The reason is the contiguous buffer exceeds the default maximum segment size of 64K as specified by dma_get_max_seg_size() in linux/dma-mapping.h. Fix this by providing our own segment size, which is set to 2GiB to cover the window found in MMUv1 GPUs. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
* drm/etnaviv: fix bogus fence complete check in timeout handlerLucas Stach2018-11-211-1/+1
| | | | | | | | | | | | | | commit 6fce3a406108ee6c8a61e2a33e52e9198a626ea0 upstream. The GPU hardware fences and the job out-fences are on different timelines so it's wrong to compare them. Fix this by only looking at the out-fence. Cc: <stable@vger.kernel.org> Fixes: 2c83a726d6fb (drm/etnaviv: bring back progress check in job timeout handler) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* drm/etnaviv: add DMA configuration for etnaviv platform deviceLucas Stach2018-09-141-6/+21
| | | | | | | | | | | | | | | | | | | | | The etnaviv device is a virtual device backing the DRM device, which may drive multiple hardware GPU core devices. As most of the dma-mapping handling is done through the virtual device, we need to make sure that a proper DMA setup is in place. The easiest way to get a reasonable configuration is to let the virtual device share the DMA configuration with one of the GPU devices, so call of_dma_configure() with the right parameters manually. This assumes that all etnaviv driven GPU devices in the system share the same DMA configuration. If we ever encounter a SoC where the GPUs are on busses with different offsets or behind different IOMMUs that will require much deeper changes to the driver, as we would need to implement etnaviv specific versions of most of the DRM helper functions. For now we should be fine with this solution. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Guido Günther <agx@sigxcpu.org> Tested-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
* Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into ↵Dave Airlie2018-08-077-45/+37Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | drm-next From: Lucas Stach <l.stach@pengutronix.de> "not much to de-stage this time. Changes from Philipp and Souptick to use memset32 more and switch the fault handler to the new vm_fault_t and two small fixes for issues that can be hit in rare corner cases from me." Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/1533563808.2809.7.camel@pengutronix.de
| * drm/etnaviv: fix crash in GPU suspend when init failed due to buffer placementLucas Stach2018-08-061-0/+1
| | | | | | | | | | | | | | | | | | | | When the suballocator was unable to provide a suitable buffer for the MMUv1 linear window, we roll back the GPU initialization. As the GPU is runtime resumed at that point we need to clear the kernel cmdbuf suballoc entry to properly skip any attempt to manipulate the cmdbuf when the GPU gets shut down in the runtime suspend later on. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * drm/etnaviv: change return type to vm_fault_tSouptick Joarder2018-08-062-29/+11Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use new return type vm_fault_t for fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type. Ref- commit 1c8f422059ae ("mm: change return type to vm_fault_t") Previously vm_insert_page() returns err which driver mapped into VM_FAULT_* type. The new function vmf_insert_page() will replace this inefficiency by returning VM_FAULT_* type. vmf_error() is the newly introduce inline function in 4.17-rc6. Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * drm/etnaviv: protect sched job submission with fence mutexLucas Stach2018-08-064-11/+21
| | | | | | | | | | | | | | | | | | | | The documentation of drm_sched_job_init and drm_sched_entity_push_job has been clarified. Both functions should be called under a shared lock, to avoid jobs getting pushed into the scheduler queue in a different order than their sched_fence seqnos, which will confuse checks that are looking at the seqnos to infer information about completion order. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * drm/etnaviv: mmuv2: use memset32 to init scratch pagePhilipp Zabel2018-08-061-5/+4Star
| | | | | | | | | | | | | | Replace the open-coded scratch page initialization loop with memset32 Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* | BackMerge v4.18-rc7 into drm-nextDave Airlie2018-07-303-4/+47
|\| | | | | | | | | | | | | rmk requested this for armada and I think we've had a few conflicts build up. Signed-off-by: Dave Airlie <airlied@redhat.com>
| * drm/etnaviv: bring back progress check in job timeout handlerLucas Stach2018-07-052-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the hangcheck handler was replaced by the DRM scheduler timeout handling we dropped the forward progress check, as this might allow clients to hog the GPU for a long time with a big job. It turns out that even reasonably well behaved clients like the Armada Xorg driver occasionally trip over the 500ms timeout. Bring back the forward progress check to get rid of the userspace regression. We would still like to fix userspace to submit smaller batches if possible, but that is for another day. Cc: <stable@vger.kernel.org> Fixes: 6d7a20c07760 (drm/etnaviv: replace hangcheck with scheduler timeout) Reported-by: Russell King <linux@armlinux.org.uk> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Eric Anholt <eric@anholt.net>
| * drm/etnaviv: Fix driver unregisteringFabio Estevam2018-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Russell King reported: "When removing and reloading the etnaviv module, the following splat occurs: sysfs: cannot create duplicate filename '/devices/platform/etnaviv' CPU: 0 PID: 1471 Comm: modprobe Not tainted 4.17.0+ #1608 Hardware name: Marvell Dove (Cubox) Backtrace: [<c00157d4>] (dump_backtrace) from [<c0015b8c>] (show_stack+0x18/0x1c) r6:ef033e38 r5:ee07b340 r4:edb9d000 r3:00000000 [<c0015b74>] (show_stack) from [<c0620784>] (dump_stack+0x20/0x28) [<c0620764>] (dump_stack) from [<c01bcd24>] (sysfs_warn_dup+0x5c/0x70) [<c01bccc8>] (sysfs_warn_dup) from [<c01bce14>] (sysfs_create_dir_ns+0x90/0x98) ..." Commit 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node") introduced DRM registration via platform_device_register_simple(), but missed to call platform_device_unregister() inside etnaviv_exit(). Fix the problem by calling platform_device_unregister() inside etnaviv_exit(). While at it, also rearrange the function calls in the exit path to make them happen in the opposite order of registration. Tested on a imx6-sabresd board. Cc: <stable@vger.kernel.org> Fixes: 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node") Reported-by: Russell King <linux@armlinux.org.uk> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * drm/etnaviv: Check for platform_device_register_simple() failureFabio Estevam2018-06-271-3/+18
| | | | | | | | | | | | | | | | | | | | | | platform_device_register_simple() may fail, so we should better check its return value and propagate it in the case of error. Cc: <stable@vger.kernel.org> Fixes: 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node") Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* | drm/scheduler: modify API to avoid redundancyNayan Deshmukh2018-07-252-4/+3Star
| | | | | | | | | | | | | | | | | | | | entity has a scheduler field and we don't need the sched argument in any of the functions where entity is provided. Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* | drm/scheduler: modify args of drm_sched_entity_initNayan Deshmukh2018-07-131-4/+4
| | | | | | | | | | | | | | | | | | | | replace run queue by a list of run queues and remove the sched arg as that is part of run queue itself Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* | Merge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux ↵Dave Airlie2018-07-101-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into drm-next More features for 4.19: - Use core pcie functionality rather than duplicating our own for pcie gens and lanes - Scheduler function naming cleanups - More documentation - Reworked DC/Powerplay interfaces to improve power savings - Initial stutter mode support for RV (power feature) - Vega12 powerplay updates - GFXOFF fixes - Misc fixes Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180705221447.2807-1-alexander.deucher@amd.com
| * | drm/scheduler: Rename cleanup functions v2.Andrey Grodzovsky2018-07-051-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Everything in the flush code path (i.e. waiting for SW queue to become empty) names with *_flush() and everything in the release code path names *_fini() This patch also effect the amdgpu and etnaviv drivers which use those functions. v2: Also pplay the change to vd3. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Suggested-by: Christian König <christian.koenig@amd.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* / drm/etnaviv: Remove unecessary dma_fence_opsDaniel Vetter2018-07-031-7/+0Star
|/ | | | | | | | | | | | | | dma_fence_default_wait is the default now, same for the trivial enable_signaling implementation. Acked-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Russell King <linux+etnaviv@armlinux.org.uk> Cc: Christian Gmeiner <christian.gmeiner@gmail.com> Cc: etnaviv@lists.freedesktop.org Link: https://patchwork.freedesktop.org/patch/msgid/20180503142603.28513-8-daniel.vetter@ffwll.ch
* Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into ↵Dave Airlie2018-05-2224-469/+143Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | drm-next So what we have for this cycle is a bit of spring cleaning with removal of unused register logging code and getting rid of the license text in favor of SPDX, a few smaller MMU handling improvements and a timeout calculation change, fixing premature fence wait timeouts after 50 days of uptime. Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/1526652437.28565.2.camel@pengutronix.de
| * drm/etnaviv: replace license text with SPDX tagsLucas Stach2018-05-1823-296/+40Star
| | | | | | | | | | | | | | | | | | This replaces the repetitive GPL-2.0 license text in code and header files with the SPDX tags. Generated hardware headers aren't changed, as any changes there need to be done in the upstream rnndb repository. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
| * drm/etnaviv: mmuv2: support 40 bit phys addressLucas Stach2018-05-181-1/+4
| | | | | | | | | | | | | | MMUv2 supports up to 40 bits of physical address by folding the upper 8 bits into bits [4:11] of the PTE. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * drm/etnaviv: mmuv2: allocate 2nd level page tables on demandLucas Stach2018-05-181-28/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With etnaviv not being tied into the IOMMU framework anymore, the MMU functions will only be called under sleeping locks. Thus we are able to allocate the memory for the 2nd level page tables on demand without having to deal with memory allocation in atomic context. This speeds up driver intitialization on MMUv2 GPU cores, as we don't need to preallocate all the page table memory and also reduces memory consumption for most workloads, as most of them won't use the full GPU virtual address space. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
| * drm/etnaviv: switch MMU page tables to writecombine memoryLucas Stach2018-05-182-59/+49Star
| | | | | | | | | | | | | | | | | | We are likely to write multiple page entries at once and already ensure proper write buffer flushing before GPU submit, so this improves CPU time usage in the submit path without any downsides. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
| * drm/etnaviv: remove register loggingLucas Stach2018-05-185-67/+5Star
| | | | | | | | | | | | | | | | | | I'm not aware of any case where tracing GPU register manipulation at the kernel level would have been useful. It only adds more indirections and adds to the code size. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
| * drm/etnaviv: remove cycling through MMU address spaceLucas Stach2018-05-182-16/+1Star
| | | | | | | | | | | | | | | | | | | | This was useful on MMUv1 GPUs, which don't generate proper faults, when the GPU write caches weren't fully understood and not properly handled by the kernel driver. As this has been fixed for quite some time, the cycling though the MMU address space needlessly spreads out the MMU mappings. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * drm/etnaviv: correct timeout calculationRussell King2018-05-181-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old way did clamp the jiffy conversion and thus caused the timeouts to become negative after some time. Also it didn't work with userspace which actually fills the upper 32bits of the 64bit timestamp value. clock_gettime() is 32-bit on 32-bit architectures. Using 64-bit timespec math, like we do in this commit, means that when a wrap occurs, the specified timeout goes into the past and we can't request a timeout in the future. As the Linux implementation of CLOCK_MONOTONIC is reasonable and starts at 0, the first such timer wrap will occur after approx. 68 years of system uptime. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* | drm/scheduler: remove unused parameterNayan Deshmukh2018-05-151-1/+1
|/ | | | | | | | | | | this patch also effect the amdgpu and etnaviv drivers which use the function drm_sched_entity_init Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> Suggested-by: Christian König <christian.koenig@amd.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm/etnaviv: bump HW job limit to 4Lucas Stach2018-03-221-1/+1
| | | | | | | | | | | The current limit of 2 leads to some GPU idle times, as the usual IRQ latency leads to up to 3 jobs getting signaled at once with some standard workloads. A larger HW job limit might lead to slightly worse QoS, but we accept that to not sacrifice GPU throughput in the common case. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: etnaviv_sched: Staticize functions when possibleFabio Estevam2018-03-091-3/+4
| | | | | | | | | | | | | etnaviv_sched_dependency() and etnaviv_sched_run_job() are only used in this file, so make them static. This fixes the following sparse warnings: drivers/gpu/drm/etnaviv/etnaviv_sched.c:30:18: warning: symbol 'etnaviv_sched_dependency' was not declared. Should it be static? drivers/gpu/drm/etnaviv/etnaviv_sched.c:81:18: warning: symbol 'etnaviv_sched_run_job' was not declared. Should it be static? Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: add PTA handling to MMUv2Lucas Stach2018-03-091-1/+75
| | | | | | | | The Page Table Array is a new first level structure above the MTLB availabale on GPUs with the security feature. Use the PTa to set up the MMU when the security related states are handled by the kernel driver. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: add function to load the initial PTA stateLucas Stach2018-03-092-0/+19
| | | | | | | On GPUs with the security feature the MTLB config is stored in the PTA. Add a function to trigger the initial PTA load through the FE. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: handle security statesLucas Stach2018-03-091-5/+43
| | | | | | | GPUs with support for the security features need some additional setup to get the frontend started. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: add security handling mode enumLucas Stach2018-03-091-0/+7
| | | | | | | | | | | | With the introduction of GPU security we have 3 different modes of GPU operation: - GPU core doesn't have security features -> no handling required - the security related states are handled by the kernel driver - the security related states are handled by a TrustZone application Add a enum to differentiate between the different operation modes. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: add hardware databaseLucas Stach2018-03-094-0/+74
| | | | | | | | | | | | New versions of the Vivante kernel driver don't trust the hardware feature bits anymore, but use an internal hardware database. This also includes more feature fields than are available in hardware. As we can't trust the hardware feature bits to be correct anymore, we need to replicate the HWDB in etanviv. For now only the GC7000L as found on the i.MX8M is supported. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: add more minor features fieldsLucas Stach2018-03-092-10/+42
| | | | | | | Newer GPU cores added yet more feature bits. Make room for them and let userspace query them. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: update hardware headers from rnndbLucas Stach2018-03-095-127/+617
| | | | | | | Update the state HI and common header from rnndb commit 8478eef32fd9 (rnndb: document secure GPU reset bit). Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: add support for slave interface clockLucas Stach2018-03-092-0/+14
| | | | | | | | The slave interface clock is a clock input found on newer cores to gate the register interface. For now we simply ungate it when the GPU is in active state. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: split out and optimize MMU fault dumpingLucas Stach2018-03-091-14/+17
| | | | | | | | Split out the fault dumping, as this will get more complex in the future. Also there is no need to read and dump the fault address from MMUs that didn't signal a fault. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: remove the need for a gpu-subsystem DT nodeLucas Stach2018-02-122-17/+20
| | | | | | | | | | The module autoloading can be triggered through the GPU core nodes and the necessary platform device for the DRM toplevel device will be instantiated on module init. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Rob Herring <robh@kernel.org>
* drm/etnaviv: use correct format specifier for size_tLucas Stach2018-02-121-2/+2
| | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: replace hangcheck with scheduler timeoutLucas Stach2018-02-125-114/+51Star
| | | | | | | | | | | | | | This replaces the etnaviv internal hangcheck logic with the job timeout handling provided by the DRM scheduler. This simplifies the driver further and allows to replay jobs after a GPU reset, so only minimal state is lost. This introduces a user-visible change in that we don't allow jobs to run indefinitely as long as they make progress anymore, as this introduces quality of service issues when multiple processes are using the GPU. Userspace is now responsible to flush jobs in a way that the finish in a reasonable time, where reasonable is currently defined as less than 500ms. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: lock BOs after all other submit work is doneLucas Stach2018-02-121-8/+8
| | | | | | | | Populating objects, adding them to the GPU VM and patching/validating the command stream might take a lot of CPU time. There is no reason to hold all object reservations during that time. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: move dependency handling to schedulerLucas Stach2018-02-125-68/+69
| | | | | | | | Move the fence dependency handling to the scheduler where it belongs. Jobs with unsignaled dependencies just get to sit in the scheduler queue without holding any locks. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: hook up DRM GPU schedulerLucas Stach2018-02-1210-91/+235
| | | | | | | | | | | This hooks in the DRM GPU scheduler. No improvement yet, as all the dependency handling is still done in etnaviv_gem_submit. This just replaces the actual GPU submit by passing through the scheduler. Allows to get rid of the retire worker, as this is now driven by the scheduler. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: track fences by IDR instead of seqnoLucas Stach2018-02-124-18/+42
| | | | | | | | | This moves away from using the internal seqno as the userspace fence reference. By moving to a generic ID, we can later replace the internal fence by something different than the etnaviv seqno fence. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
* drm/etnaviv: add missing major features field to debugfsLucas Stach2018-02-121-0/+2
| | | | | | This can be useful when dealing with a new GPU core. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: don't fail to build on arches without PHYS_OFFSETLucas Stach2018-02-121-0/+4
| | | | | | | | Some architecture ports like ARC don't provide the PHYS_OFFSET symbol. Define it to 0 in that case, which is the most conservative default in the usage context of the etnaviv driver. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: make local symbols staticWei Yongjun2018-02-122-2/+2
| | | | | | | | | | | | Fixes the following sparse warnings: drivers/gpu/drm/etnaviv/etnaviv_iommu.c:161:39: warning: symbol 'etnaviv_iommuv1_ops' was not declared. Should it be static? drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c:239:39: warning: symbol 'etnaviv_iommuv2_ops' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* drm/etnaviv: use memset32 to init pagetableLucas Stach2018-01-021-3/+2Star
| | | | | | | Now that memset32 is available, the open-coded pagetable initialization loop can be replaced. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>