Most 5XX targets have GPMU (Graphics Power Management Unit) that
handles a lot of the heavy lifting for power management including
thermal and limits management and dynamic power collapse. While
the GPMU itself is optional, it is usually nessesary to hit
aggressive power targets.
If the GPMU is to be used a filename and minimum version are
defined in the device tree. The GPMU firmware needs to be loaded
into the GPMU at init time via a shared hardware block of registers.
Using the GPU to write the microcode is more efficient than using the
CPU so at first load create an indirect buffer that can be executed
during subsequent initalization sequences.
After loading the GPMU gets initalized through a shared register
interface and then we mostly get out of its way and let it do
its thing.
Change-Id: Ic0dedbad8d899177919b71500f2e944b187e87c0
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Add support for the A5XX family of Adreno GPUs.
Change-Id: Ic0dedbad665ef9d0f2cdb32a33eef9fe3fd7aa5c
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Verify that the GPU is valid before calling any ioctl functions
that might need the priv->gpu member. Standardize the return
code (-ENXIO).
Change-Id: Ic0dedbad015a531b792e0b94cb61e0570b691de8
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Currently the value written to CP_RB_WPTR is calculated on the fly as
(rb->next - rb->start). But as the code is designed rb->next is wrapped
before writing the commands so if a series of commands happened to
fit perfectly in the ringbuffer, rb->next would end up being equal to
rb->size / 4 and thus result in an out of bounds address to CP_RB_WPTR.
The easiest way to fix this is to mask WPTR when writing it to the
hardware; it makes the hardware happy and the rest of the ringbuffer
math appears to work and there isn't any point in messing with things.
Change-Id: Ic0dedbade543a2253b88acf46a8f8e062ae7faf9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
For every submission buffer object one of MSM_SUBMIT_BO_WRITE
and MSM_SUBMIT_BO_READ must be set (and nothing else). If we
allowed zero then the buffer object would never get queued to
be unreferenced.
Change-Id: Ic0dedbad8a4543428372fe3fef9503cedd1eef6e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
The upstream DT model presumes that the iommu phandle is in the main
GPU device node. The downstream model defines sub-nodes for the
IOMMU devices. In order to get the right device to attach the IOMMU
domain to we need to do a bit of searching.
First, check in the top level node. If that fails, then start walking
the port list passed in the attached function - hopefully one of those
will have the right device - if found, use that to attach the domain
and breathe normally.
Change-Id: Ic0dedbad4a1852d2ff204031bd360e0b7960805a
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Newer Adreno GPUs are able to support 64 bit virtual addressing. To
prepare for this brave new world switch all IOVA related variables
and members to a uint64_t container. This is harmless for the
display and older targets that do not have 64 bit addressing because
a 32 bit address is just a 64 bit address with lots of zeros. To
avoid ambiguity and compiler oddness make sure to use
lower_32_bits() and upper_32_bits() everywhere the IOVA is used to
ensure that you get what you expect.
Change-Id: Ic0dedbad23322fae32509c1f4d75d9b4e2863081
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
In the future we won't have a fixed set of addresses spaces.
Instead of going through the effort of assigning a ID for each
address space just use the address space itself as a token for
getting / putting an iova.
This forces a few changes in the gem object however: instead
of using a simple index into a list of domains, we need to
maintain a list of them. Luckily the list will be pretty small;
even with dynamic address spaces we wouldn't ever see more than
two or three.
Change-Id: Ic0dedbad4495f02a21135217f3605b93f8b8dfea
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
PM_QOS will put the interrupt where it wants to and we're okay
with that.
Change-Id: Ic0dedbad5294d51a55125a0021f7dcc3b185de02
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Disable the interrupt during the init sequence to avoid having
interrupts fired for errors and other things that we are not
ready to handle while initializing.
Change-Id: Ic0dedbad972f25586e792478f9c96c4af7c31d17
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Add some new functions to manipulate GPU registers. gpu_read64 and
gpu_write64 can read/write a 64 bit value to two 32 bit registers.
For 4XX and older these are normally perfcounter registers, but
future targets will use 64 bit addressing so there will be many
more spots where a 64 bit read and write are needed.
gpu_rmw() does a read/modify/write on a 32 bit register given a mask
and bits to OR in.
Change-Id: Ic0dedbadb83d3ac46f7e463c9c901d4f94a7bb58
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
There are very few register accesses in the common code. Cut down
the list of common registers to just those that are used. This
saves const space and saves us the effort of maintaining registers
for A3XX and A4XX that don't exist or are unused.
Change-Id: Ic0dedbadb4dccbba284e9badf2f52f3a72594581
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Add helper functions for TYPE4 and TYPE7 ME opcodes that replace
TYPE0 and TYPE3 starting on the A5XX targets.
Change-Id: Ic0dedbad114e28bdbcba55a788c6307b48e14675
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Bring in refreshed register definitions from the rnndb database.
Change-Id: Ic0dedbaddd22f6ac0b8cfb6184073968569de22d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Matt reported that we have a NULL pointer dereference
in ppp_pernet() from ppp_connect_channel(),
i.e. pch->chan_net is NULL.
This is due to that a parallel ppp_unregister_channel()
could happen while we are in ppp_connect_channel(), during
which pch->chan_net set to NULL. Since we need a reference
to net per channel, it makes sense to sync the refcnt
with the life time of the channel, therefore we should
release this reference when we destroy it.
Fixes: 1f461dcdd296 ("ppp: take reference on channels netns")
Reported-by: Matt Bennett <Matt.Bennett@alliedtelesis.co.nz>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linux-ppp@vger.kernel.org
Cc: Guillaume Nault <g.nault@alphalink.fr>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Git-repo:https://source.codeaurora.org/quic/la/kernel/msm-4.4
Git-commit: 205e1e255c479f3fd77446415706463b282f94e4
Change-Id: Ic7ce3be365ebdc1505ed8ce68df981c855638a3c
Signed-off-by: Srinivasa Rao Kuppala <srkupp@codeaurora.org>
When the GPU hardware init function fails (like say, ME_INIT timed
out) return error instead of blindly continuing on. This gives us
a small chance of saving the system before it goes boom.
Change-Id: Ic0dedbad142efbc9bd93e8531b40c391ec15f557
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Make sure to detach the MMU device before destroying the address
space.
Change-Id: Ic0dedbadff27fed017840a61ec5e0d55ce0c71e6
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
SDE and the GPU have different requirements for the SMMU backends - the
SDE generates its own iova addresses and needs special support for DMA
buffers and the GPU does its own IOMMU operations. Add a shim layer to
aspace to break out the address generation and call the appropriate
SMMU functions. There is probably consolidation that can be done, but for
now this is the best way to deal with the two use cases.
Change-Id: Ic0dedbadc6dc03504ef7dffded18ba09fb3ef291
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
We can have various combinations of 64b and 32b address space, ie. 64b
CPU but 32b display and gpu, or 64b CPU and GPU but 32b display. So
best to decouple the device iova's from mmap offset.
Change-Id: Ic0dedbad2b36b535df3e8fb2ddddc20add592cea
Signed-off-by: Rob Clark <robdclark@gmail.com>
Git-commit: 22877bcbdacd50d076f9b2f829e6a3753aa9821f
Git-repo: https://github.com/freedreno/kernel-msm.git
[jcrouse@codeaurora.org: Fix merge conflicts, remove mdp5 due to large
infrastructure changes, compile fixes]
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Currently, IPA driver asserts if IPA FW loading
fails. Some environments do not have IPA FW
integrated and we should not crash at these cases.
CRs-fixed: 2005599
Change-Id: I78b9f2cadb8c35ab455f4514c7efc9cee4cf4542
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>