Unknown ioctl code errors are supposed to be ENOIOCTLCMD,
not EINVAL.
Change-Id: Id38529e4ec70d63091a9273a780585aea6ae9d9a
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
The sysfs code was reading the wrong entry in the stats
array, so it printed the wrong value.
Change-Id: I26ce8bbca152a98e3dac53a9c154e52b020d5532
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
The timestamp of 2D core should not be set to 0 on startup if the
device has previously been started and is waking up from a suspend call.
This can cause processes to wait indefinitely for the 2D core if
they received a timestamp before the device went into suspend
Change-Id: Ida5dbdcb89ea7e0cf86110ecc2bd7d568123c364
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
For msm8x25, the adreno version returned by hardware is incorrect. Patch
the version to return the correct one.
Change-Id: Ie47ff55a5196442545f5adc60f4c7ce833ba458d
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Clients need to be able to do cache operations
on ION buffers in the kernel. Add API to
flush, invalidate, or invalidate and flush the
cache of an ION buffer.
Change-Id: I2b676dbe32372b3c17e4aaf39f51878b105a699c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Cached IOMMU mapping is not supported.
Add check for clients trying to map buffers
into IOMMU as cached and return error.
Change-Id: Ic63a24bf651d613933633cd81143701f66df566c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Return the reset status of the GPU unit when
IOCTL_KGSL_DEVICE_GETPROPERTY is called with
type KGSL_PROP_GPU_RESET_STAT
Change-Id: I4bb17be959eadba3ba491d94c6fd4f5824442e92
Signed-off-by: Shubhraprakash Das<sadas@codeaurora.org>
Add /sys/kernel/debug/kgsl/kgsl-3d0/postmortem/ib_enabled to debugfs,
to control whether IBs are dumped by postmortem dump. Add check to
postmortem dump to dump registers if register dump is enabled.
By default ib dump and register dump during postmortem dump are
disabled.
Change-Id: I71b0b0c97be0753f88f6f57a1cbc6b5ee93aaffc
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
When searching for indirect buffers to dump in the snapshot, look for
all of the variations for the indirect buffer opcode, not just the
most commonly used one. This picks up many IB2 buffers that were
previously left behind.
Change-Id: Ic0dedbad0fef91bf21a5de6d1928f350d2ad2009
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
In the vast majority of cases the only interesting indirect buffers (IBs)
to dump in a shapshot are the ones that are in the current context
because they are the ones that probably contributed to the hang. Limit
the IBs that are dumped to the range between the start of context and
the RB read pointer. If the start of context can't be found, then dump
from the start of the ringbuffer dump to read pointer. Also, since
buffers can be reused (though typically not in the same context), use the
most recent parsed size when dumping the IB to make sure we get the right
buffer contents for the most recent usage of said buffer.
Change-Id: Ic0dedbad090156d69b964e229806aa45242de6fd
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Add the VBIF registers that we modify to the snapshot dump so they
can be properly verified after a hang.
Change-Id: Ic0dedbad07ab62cbd96a0c2e7343b38779163e24
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
PMEM uses buffered mappings when PMEM device is
opened with O_SYNC flag. ION should have the same
behavior as PMEM.
Change ION to provide buffered mappings instead
of uncached when the O_DSYNC flag is used when
opening the ION device.
CRs-fixed: 335827
Change-Id: I369a35a2ff68adc8339380dfbb7721e3d361ee69
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
The pt pointer was being checked against NULL value after it was
dereferenced
Change-Id: Ifbdeb7bec5e3f28396196d8f55356e5dbf1a2e55
CRs-Fixed: 336516
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
The wrap around value while comparing timestamps determines whether
the smaller timestamp value has wrapped around or not. Increase this
value as we are hitting cases where we detect a wrap around condition but
in reality the timestamp has not yet wrapped around.
Change-Id: I2dfbebf94468ec8895536214c81fc22ef62212ae
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Use the recommended VBIF settings to set up dual AXI port access and
better and faster timings.
Change-Id: Ic0dedbad5394d1a04a6e480e4a4ccb45c307ab17
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
APQ8064 has two AXI ports attached to the GPU with an IOMMU on both.
The VBIF can be programmed to use a round-robin arbitration to access
the ports equally, so we need to program both IOMMUs with the same
pagetable to make sure that the GPU can get where it needs to go.
All this involves a board file infrastructure change that affects 8960
too, but no functional changes are happening for that platform.
Change-Id: Ic0dedbad5198ed9c453711e58a3f1220ef5d5b4e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Version 29 of the PM4 firmware for A3XX modified the format of the
REG_TO_MEM opcode by changing the bit shift of one the fields.
Modify the legacy context switch code accordingly. This will break
users of older firmware, but the old firmware shouldn't ever be in
wide use anyway, so backwards compatibility is not a concern.
Change-Id: Ic0dedbad9a6d50077a0001c95d2a0dcd30c4f070
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Video hardware has the following requirements for
ION heaps:
1. MM heap must be at a higher address than FW heap.
2. MFC heap must at a higher address than FW
3. MM heap must be adjacent to FW heap.
(There cannot be another heap between FW and MM heap)
4. MM and MFC heap cannot be more than 256MB away
from the base address of the FW heap.
MM heap is configured as a reusable heap (FMEM heap) and FMEM
is carved out at a much higher address than the other heaps breaking
the above requirements. To support the above requirements the
MFC heap together with the FW heap must be carved out at the same
location as MM heap.
Change-Id: Ie0acb4b267d4307190ea3cd9ff23c710ffa1a538
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
* changes:
msm: kgsl: change timestamp frees to use kgsl_event
msm: kgsl: cancel events from kgsl_release
msm: kgsl: remove readl/writel use for dma memory
The timestamp memqueue was unsorted, which could cause
memory to not be freed soon enough. The kgsl_event
list is sorted and does almost exactly the same thing
as the memqueue did, so freememontimestamp is now
implemented using the kgsl_event list.
CRs-Fixed: 327647
Change-Id: Ia93431bc5f31a9286cc78a92271b43a3a6ac9baf
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Events need to be cancelled when an fd is released,
to avoid possible memory leaks or use after free.
When the event is cancelled, its callback is called.
Currently this is sufficient since events are used for
resource management and we have no option but to
release the lock or memory. If future uses need to
distinguish between the callback firing and
a cancel, they can look at the timestamp passed to
the callback, which will be before the timestamp they
expected. Otherwise a separate cancel callback can
be added.
CRs-Fixed: 327647
Change-Id: I49f8f58aea6366344d1c82613f73881a169834b3
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
For dma_alloc_coherent() you don't need writel/readl because
it's just a plain old void *. Linux tries very hard to make a
distinction between io memory (void __iomem *) and memory
(void *) so that drivers are portable to architectures that
don't have a way to access registers via pointer dereferences.
You can see http://lwn.net/Articles/102232/ and the Linus rant
http://lwn.net/Articles/102240/ here for more details behind
the motivation.
Change-Id: I3da075c30304e4adf321cfb3edb1baa4a93fc2ce
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
There are a some workloads where interrupts do not
always get generated, and as a result the timestamp
work was not triggered often enough.
Queue timestamp expired work from adreno_waittimestamp(),
when the timestamp expires while we are not waiting.
It is possible in this case that no interrupt fired
because no processes were waiting.
Queue timestamp expired work when freememontimestamp
is called, which reduces the amount of memory
built up by applications that use this api often.
CRs-Fixed: 336057
Change-Id: Ib4610dfa53af04b5a7b1eb51281d32d0e5be8471
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
commit 23bd15ec662344dc10e9918fdd0dbc58bc71526d upstream.
TV Out refresh rate was half of the specification for almost all modes.
Due to this reason pixel clock was so low for some modes causing flickering screen.
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 097354eb14fa94d31a09c64d640643f58e4a5a9a upstream.
Otherwise hangcheck spuriously fires when running blitter/bsd-only
workloads.
Contrary to a similar patch by Ben Widawsky this does not check
INSTDONE of the other rings. Chris Wilson implied that in a failure to
detect a hang, most likely because INSTDONE was fluctuating. Thus only
check ACTHD, which as far as I know is rather reliable. Also, blitter
and bsd rings can't launch complex tasks from a single instruction
(like 3D_PRIM on the render with complex or even infinite shaders).
This fixes spurious gpu hang detection when running
tests/gem_hangcheck_forcewake on snb/ivb.
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 832afda6a7d7235ef0e09f4ec46736861540da6d upstream.
On DP monitor hot remove, clear DP_AUDIO_OUTPUT_ENABLE accordingly,
so that the audio driver will receive hot plug events and take action
to refresh its device state and ELD contents.
Note that the DP_AUDIO_OUTPUT_ENABLE bit may be enabled or disabled
only when the link training is complete and set to "Normal".
Tested OK for both hot plug/remove and DPMS on/off.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 2deed761188d7480eb5f7efbfe7aa77f09322ed8 upstream.
On HDMI monitor hot remove, clear SDVO_AUDIO_ENABLE accordingly, so that
the audio driver will receive hot plug events and take action to refresh
its device state and ELD contents.
The cleared SDVO_AUDIO_ENABLE bit needs to be restored to prevent losing
HDMI audio after DPMS on.
CC: Wang Zhenyu <zhenyu.z.wang@intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 86698c20f71d488b32c49ed4687fb3cf8a88a5ca upstream.
Polling the outputs when the device is suspended can result in erroneous
status updates. Disable output polling during suspend to prevent this
from happening.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
commit 1b61925061660009f5b8047f93c5297e04541273 upstream.
The value of this register is transferred to the V_COUNTER register at the
beginning of vertical blank. V_COUNTER is the reference for VLINE waits and
goes from VIEWPORT_Y_START to VIEWPORT_Y_START+VIEWPORT_HEIGHT during scanout,
so if VIEWPORT_Y_START is not 0, V_COUNTER actually went backwards at the
beginning of vertical blank, and VLINE waits excluding the whole scanout area
could never finish (possibly only if VIEWPORT_Y_START is larger than the length
of vertical blank in scanlines). Setting DESKTOP_HEIGHT to the framebuffer
height should prevent this for any kind of VLINE wait.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45329 .
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Idle the core before changing the gpu clock as instability
is caused on some platforms on changing the clock freq when
core is busy.
CRs-fixed: 328249
Change-Id: I5f6a507eaad383bde646001d2e10c2b62880515b
Signed-off-by: Kedar Joshi <kjoshi@codeaurora.org>
Poking once during adreno_idle is not enough; a GPU hang may still happen.
Seen on 7x27A. Write a few times during the wait timeout, to ensure that
the WPTR is updated properly.
Change-Id: Id704e187a05540afa6ef4b0542d16c7bb9a6372d
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
* changes:
msm: kgsl: Disable ME, PFP split timeout and VFD interrupts.
msm: kgsl: Context switch fixes for A3XX
msm: board-8064: Fix 8064 GPU clk at 192 Mhz
msm: kgsl: Use the right physical addresses in NOMMU mode
msm: kgsl: Only use the setstate slowpath for A3XX
msm: kgsl: Set the default MMU to 'none' for APQ8064
msm: kgsl: Fix the A3XX debugbus snapshot code
msm: kgsl: Enable A3XX GPU hang detection
msm: kgsl: A3XX GMEM save/restore was never executed
msm: kgsl: Correct the microcode sizes in the GPU snapshot
msm: kgsl: Update the GMEM and istore size for A320
The ME and PFP split timeout interrupts are fired when a wait for
idle does not get a response within the specified time limit, which
happens to be far too low for this revision of the hardware. The VFD
interrupt is harmless since we aways set the VFD range to the maximum
addressible size. All these interrupts can be safely removed.
Change-Id: I32e714782a3c5a042b64360c1f6bcb7f8a9750db
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
In A3xx GPU state during context switching is saved from shadow RAM.
Changed to use correct shadow ram base address by default.
Gmem quad restore height and width is fixed to right values.
Fixed A3XX_GRAS_SC_CONTROL to right value.
Change-Id: I8589545183d2c4f5081c290bf453a86693542c79
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
In NOMMU mode the gpuaddr was set to the physaddr
for the memdesc which worked great until the memory
wasn't allocated by KGSL, at which point it blew up.
We already went through the due dilligence to turn
all memdescs into sglists, so use the sglist to get the
physaddr (and thus the gpuaddr). Check to make sure
that we're not trying to map a real sglist (more than one
entry) and if we are, then loudly fail.
Change-Id: Ic0dedbad5d401c505949c92d9a7795f3260dbabb
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
The setstate fastpath only works on A2XX, so completely
skip it for A3XX.
Change-Id: Ic0dedbad9c0dac16ea28b6f615f5d07fb5059980
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
A3XX targets (8064 and greater) have no GPU MMU, so default
to no MMU when the IOMMU isn't available or configured.
Change-Id: Ic0dedbad90e2762663349ad055d818416290a164
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>