]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
10 years agodrm/radeon: use packet3 for nop on hawaii with new firmware
Alex Deucher [Fri, 1 Aug 2014 18:05:31 +0000 (20:05 +0200)]
drm/radeon: use packet3 for nop on hawaii with new firmware

Older firmware didn't support the new nop packet.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
10 years agodrm/radeon: tweak ACCEL_WORKING2 query for hawaii
Alex Deucher [Fri, 1 Aug 2014 18:05:30 +0000 (20:05 +0200)]
drm/radeon: tweak ACCEL_WORKING2 query for hawaii

Return 2 so we can be sure the kernel has the necessary
changes for acceleration to work.

Note: This patch depends on these two commits:
 - drm/radeon: fix cut and paste issue for hawaii.
 - drm/radeon: use packet2 for nop on hawaii with old firmware

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: use packet2 for nop on hawaii with old firmware
Alex Deucher [Fri, 1 Aug 2014 18:05:29 +0000 (20:05 +0200)]
drm/radeon: use packet2 for nop on hawaii with old firmware

Older firmware didn't support the new nop packet.

v2 (Andreas Boll):
 - Drop usage of packet3 for new firmware

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: update IB size estimation for VM
Christian König [Wed, 30 Jul 2014 19:05:18 +0000 (21:05 +0200)]
drm/radeon: update IB size estimation for VM

That should allow us to allocate bigger BOs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: split PT setup in more functions
Christian König [Wed, 30 Jul 2014 19:05:17 +0000 (21:05 +0200)]
drm/radeon: split PT setup in more functions

Move the decision what to use into the common VM code.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add VM GART copy optimization to NI as well
Christian König [Wed, 30 Jul 2014 19:05:16 +0000 (21:05 +0200)]
drm/radeon: add VM GART copy optimization to NI as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: take a BO reference on VM cleanup
Christian König [Wed, 30 Jul 2014 19:04:57 +0000 (21:04 +0200)]
drm/radeon: take a BO reference on VM cleanup

This closes a small window where the GPU might have accessed freed up memory.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add radeon_bo_ref function
Christian König [Wed, 30 Jul 2014 19:04:56 +0000 (21:04 +0200)]
drm/radeon: add radeon_bo_ref function

To be consistent with radeon_bo_unref, needed in the following patch.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: remove taking mclk_lock from radeon_bo_unref
Christian König [Wed, 30 Jul 2014 19:04:55 +0000 (21:04 +0200)]
drm/radeon: remove taking mclk_lock from radeon_bo_unref

It's causing lockdep warnings and why should
we access the memory that is freed up?

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: adjust default radeon_vm_block_size v2
Christian König [Sat, 19 Jul 2014 11:55:58 +0000 (13:55 +0200)]
drm/radeon: adjust default radeon_vm_block_size v2

v2: rebase on vm_size scale change. Adjust vm_size default to 8,
    Better handle the default and smaller values.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: try to enable VM flushing once more
Christian König [Fri, 18 Jul 2014 07:24:56 +0000 (09:24 +0200)]
drm/radeon: try to enable VM flushing once more

Let's try to fix bugs related to this instead of just disabling it.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: use an intervall tree to manage the VMA v2
Alex Deucher [Wed, 30 Jul 2014 15:49:56 +0000 (11:49 -0400)]
drm/radeon: use an intervall tree to manage the VMA v2

Scales much better than scanning the address range linearly.

v2: store pfn instead of address

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: remove radeon_bo_clear_va
Christian König [Fri, 18 Jul 2014 07:24:54 +0000 (09:24 +0200)]
drm/radeon: remove radeon_bo_clear_va

Won't work anyway, instead WARN_ON if the VA list isn't
empty when we free the BO.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: invalidate moved BOs in the VM (v2)
Christian König [Fri, 18 Jul 2014 07:24:53 +0000 (09:24 +0200)]
drm/radeon: invalidate moved BOs in the VM (v2)

Don't wait for the BO to be used again, just
update the PT on the next VM use.

v2: remove stray semicolon.

Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: re-enable dpm by default on BTC
Alex Deucher [Mon, 14 Jul 2014 16:01:40 +0000 (12:01 -0400)]
drm/radeon: re-enable dpm by default on BTC

This patch depends on:
e07929810f0a19ddd756558290c7d72827cbfcd9
(drm/radeon/dpm: fix typo in vddci setup for eg/btc)

bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=73053
https://bugzilla.kernel.org/show_bug.cgi?id=68571

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: re-enable dpm by default on cayman
Alex Deucher [Mon, 7 Jul 2014 21:13:37 +0000 (17:13 -0400)]
drm/radeon: re-enable dpm by default on cayman

This patch depends on:
b0880e87c1fd038b84498944f52e52c3e86ebe59
(drm/radeon/dpm: fix vddci setup typo on cayman)

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=69723

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: Only flush HDP cache from idle ioctl if BO is in VRAM
Michel Dänzer [Fri, 1 Aug 2014 08:22:09 +0000 (17:22 +0900)]
drm/radeon: Only flush HDP cache from idle ioctl if BO is in VRAM

The HDP cache only applies to CPU access to VRAM.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon/dpm: handle voltage info fetching on hawaii
Alex Deucher [Thu, 31 Jul 2014 22:07:17 +0000 (18:07 -0400)]
drm/radeon/dpm: handle voltage info fetching on hawaii

Some hawaii cards use a different method to fetch the
voltage info from the vbios.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=74250

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon/atom: add new voltage fetch function for hawaii
Alex Deucher [Thu, 31 Jul 2014 21:57:42 +0000 (17:57 -0400)]
drm/radeon/atom: add new voltage fetch function for hawaii

Some hawaii boards use a different method for fetching the
voltage information from the vbios.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: Always flush the HDP cache before submitting a CS to the GPU
Michel Dänzer [Thu, 31 Jul 2014 09:43:49 +0000 (18:43 +0900)]
drm/radeon: Always flush the HDP cache before submitting a CS to the GPU

This ensures the GPU sees all previous CPU writes to VRAM, which makes it
safe:

* For userspace to stream data from CPU to GPU via VRAM instead of GTT
* For IBs to be stored in VRAM instead of GTT
* For ring buffers to be stored in VRAM instead of GTT, if the HPD flush
  is performed via MMIO

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: s/ioctl_wait_idle/mmio_hpd_flush/
Michel Dänzer [Thu, 31 Jul 2014 09:43:48 +0000 (18:43 +0900)]
drm/radeon: s/ioctl_wait_idle/mmio_hpd_flush/

And clean up the function comment a little.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: separate ring and IB handling
Christian König [Thu, 31 Jul 2014 11:44:03 +0000 (13:44 +0200)]
drm/radeon: separate ring and IB handling

Both on their own are complex enough.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: fix reversed logic in evergreen_mc_resume
Alex Deucher [Wed, 30 Jul 2014 21:57:28 +0000 (17:57 -0400)]
drm/radeon: fix reversed logic in evergreen_mc_resume

Need to unblank the display when resuming the MC.  No
functional change as this code path is not currently
hit.  We always disable the displays entirely rather
than just blanking them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: set VM base addr using the PFP v2
Christian König [Wed, 30 Jul 2014 15:18:12 +0000 (17:18 +0200)]
drm/radeon: set VM base addr using the PFP v2

Seems to make VM flushes more stable on SI and CIK.

v2: only use the PFP on the GFX ring on CIK

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon/cik: Read back SDMA WPTR register after writing it
Michel Dänzer [Tue, 29 Jul 2014 09:47:22 +0000 (18:47 +0900)]
drm/radeon/cik: Read back SDMA WPTR register after writing it

For symmetry with other *_set_wptr hooks.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Use write-combined CPU mappings of IBs on >= CIK
Michel Dänzer [Tue, 29 Jul 2014 09:47:21 +0000 (18:47 +0900)]
drm/radeon: Use write-combined CPU mappings of IBs on >= CIK

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Use write-combined CPU mappings of ring buffers with PCIe
Michel Dänzer [Tue, 29 Jul 2014 09:47:20 +0000 (18:47 +0900)]
drm/radeon: Use write-combined CPU mappings of ring buffers with PCIe

PCI GART doesn't support unsnooped access. AGP GART already uses
write-combined CPU mappings.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: load the lm63 driver for an lm64 thermal chip.
Alex Deucher [Mon, 28 Jul 2014 03:21:50 +0000 (23:21 -0400)]
drm/radeon: load the lm63 driver for an lm64 thermal chip.

Looks like the lm63 driver supports the lm64 as well.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
10 years agodrm/radeon: make radeon_connector_encoder_is_hbr2 static
Alex Deucher [Thu, 24 Jul 2014 20:06:57 +0000 (16:06 -0400)]
drm/radeon: make radeon_connector_encoder_is_hbr2 static

It's only used in radeon_connectors.c.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add trace_radeon_vm_flush
Christian König [Tue, 22 Jul 2014 15:42:34 +0000 (17:42 +0200)]
drm/radeon: add trace_radeon_vm_flush

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: fix R600_PTE_GART handling
Christian König [Tue, 22 Jul 2014 15:42:20 +0000 (17:42 +0200)]
drm/radeon: fix R600_PTE_GART handling

That didn't worked correctly any more and opened up a security problem.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: remove discardable flag from radeon_gem_object_create
Christian König [Mon, 21 Jul 2014 11:27:27 +0000 (13:27 +0200)]
drm/radeon: remove discardable flag from radeon_gem_object_create

Unused and unimplemented. Also fix specifying the
kernel flag incorrectly at one occasion.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add a PX quirk list
Alex Deucher [Fri, 18 Jul 2014 15:54:20 +0000 (11:54 -0400)]
drm/radeon: add a PX quirk list

Some PX laptops seems to have problems turning the dGPU on/off.
Add a quirk list to disable runpm by default on those systems.
Also convert the current PX d3 delay handling to a quirk.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=51381
https://bugzilla.kernel.org/show_bug.cgi?id=74551

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: remove visible vram size limit on bo allocation (v4)
Alex Deucher [Thu, 17 Jul 2014 16:26:29 +0000 (12:26 -0400)]
drm/radeon: remove visible vram size limit on bo allocation (v4)

Now that fallback to gtt is fixed for cpu access, we can
remove this limit.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=78717

v2: use new gart_pin_size to accurately track available gtt.
v3: fix comment
v4: clarify comment

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agodrm/radeon: use vram/gart pinned size in radeon_do_test_moves
Alex Deucher [Thu, 17 Jul 2014 16:20:32 +0000 (12:20 -0400)]
drm/radeon: use vram/gart pinned size in radeon_do_test_moves

Gives more accurate count and prevents failures when we can't
allocate memory for the tests.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agodrm/radeon: use vram/gart pinned size in radeon_gem_info_ioctl
Alex Deucher [Thu, 17 Jul 2014 16:16:20 +0000 (12:16 -0400)]
drm/radeon: use vram/gart pinned size in radeon_gem_info_ioctl

Gives a more accurate limit than the previous code.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agodrm/radeon: track pinned memory (v2)
Alex Deucher [Thu, 17 Jul 2014 16:09:25 +0000 (12:09 -0400)]
drm/radeon: track pinned memory (v2)

So we know how large an allocation we can allow.

v2: incorporate Michel's comments

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agodrm/radeon: Allow write-combined CPU mappings of BOs in GTT (v2)
Michel Dänzer [Thu, 17 Jul 2014 10:01:08 +0000 (19:01 +0900)]
drm/radeon: Allow write-combined CPU mappings of BOs in GTT (v2)

v2: fix rebase onto drm-fixes

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Pass GART page flags to radeon_gart_set_page() explicitly
Michel Dänzer [Thu, 17 Jul 2014 10:01:07 +0000 (19:01 +0900)]
drm/radeon: Pass GART page flags to radeon_gart_set_page() explicitly

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Remove radeon_gart_restore()
Michel Dänzer [Wed, 9 Jul 2014 18:15:42 +0000 (20:15 +0200)]
drm/radeon: Remove radeon_gart_restore()

Doesn't seem necessary, the GART table memory should be persistent.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Demote 'BO allocation size too large' message to debug only
Michel Dänzer [Wed, 16 Jul 2014 09:40:32 +0000 (18:40 +0900)]
drm/radeon: Demote 'BO allocation size too large' message to debug only

These clutter up dmesg during piglit runs. Userspace generally deals
gracefully with this failure.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: use a fetch function to get the edid
Alex Deucher [Tue, 15 Jul 2014 15:00:47 +0000 (11:00 -0400)]
drm/radeon: use a fetch function to get the edid

We keep a cached version of the edid in radeon_connector which
we use for determining connectedness and when to enable certain
features like hdmi audio, etc.  When the user uses the firmware
interface to override the driver with some other edid the driver's
copy is never updated.  The fetch function will check if there
is a user supplied edid and update the driver's copy if there
is.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=80691

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: restructure edid fetching
Alex Deucher [Tue, 15 Jul 2014 14:38:10 +0000 (10:38 -0400)]
drm/radeon: restructure edid fetching

Split radeon_ddc_get_modes() and move it into
radeon_connectors.c since that is the only place
that uses it.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon/audio: break out of loops once we match connector
Stefan Brüns [Sat, 12 Jul 2014 23:47:15 +0000 (01:47 +0200)]
drm/radeon/audio: break out of loops once we match connector

No need to continue with the loops once we've matched
the appropriate connector.
See commit 8a992ee14551eae53fd3ab6c2dc8e06ba6fff174

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Use correct value for unknown audio/video latency
Stefan Brüns [Sat, 12 Jul 2014 23:47:14 +0000 (01:47 +0200)]
drm/radeon: Use correct value for unknown audio/video latency

Valid values are 1 to 251 for 0 to 500 ms latency, 0 for unknown
and 255 for audio/video unsupported by sink, according to HDMI 1.3 spec.
Also matches Radeon HDA verb 0xf7b documentation.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Inline r100_mm_rreg, -wreg, v3
Lauri Kasanen [Sun, 20 Apr 2014 17:29:33 +0000 (20:29 +0300)]
drm/radeon: Inline r100_mm_rreg, -wreg, v3

This was originally un-inlined by Andi Kleen in 2011 citing size concerns.
Indeed, a first attempt at inlining it grew radeon.ko by 7%.

However, 2% of cpu is spent in this function. Simply inlining it gave 1% more fps
in Urban Terror.

v2: We know the minimum MMIO size. Adding it to the if allows the compiler to
optimize the branch out, improving both performance and size.

The v2 patch decreases radeon.ko size by 2%. I didn't re-benchmark, but common sense
says perf is now more than 1% better.

v3: Also change _wreg, make the threshold a define.

Inlining _wreg increased the size a bit compared to v2, so now radeon.ko
is only 1% smaller.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: consolidate vga and dvi get_modes functions (v2)
Alex Deucher [Thu, 10 Jul 2014 17:07:19 +0000 (13:07 -0400)]
drm/radeon: consolidate vga and dvi get_modes functions (v2)

They are identical.

v2: rebase

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: enable display scaling on all connectors (v2)
Alex Deucher [Wed, 9 Jul 2014 17:21:59 +0000 (13:21 -0400)]
drm/radeon: enable display scaling on all connectors (v2)

This enables the display scaler on all connectors for r5xx
and newer asics.  Previously we only enabled the scaler for
fixed mode displays (eDP or LVDS) since they have to use the
scaler to support non-native modes.  Most other displays
are multi-sync or have a built in scaler to support non-native
modes.  The default scaling mode for non-fixed displays is
none which will use the scaler in the monitor.  Note that
we do not populate any fake modes like we do for fixed
displays so it will only use the modes in the edid.  For
other modes, you'll need to populate them manually.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=80868

v2: properly handle scaling with no modes defined

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: remove null test before kfree
Fabian Frederick [Fri, 4 Jul 2014 19:37:09 +0000 (21:37 +0200)]
drm/radeon: remove null test before kfree

Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon/cik: Add support for new ucode format (v5)
Alex Deucher [Wed, 25 Jun 2014 23:32:36 +0000 (19:32 -0400)]
drm/radeon/cik: Add support for new ucode format (v5)

This adds CIK support for the new ucode format.

v2: add size validation, integrate debug info
v3: add support for MEC2 on KV
v4: fix typos
v4: update to latest format

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon/si: Add support for new ucode format (v3)
Alex Deucher [Wed, 25 Jun 2014 22:41:34 +0000 (18:41 -0400)]
drm/radeon/si: Add support for new ucode format (v3)

This adds SI support for the new ucode format.

v2: add size validation, integrate debug info
v3: update to latest version

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add new firmware header definitions (v3)
Alex Deucher [Wed, 25 Jun 2014 19:54:46 +0000 (15:54 -0400)]
drm/radeon: add new firmware header definitions (v3)

These are needed to properly handle more frequently
updated firmware.

v2: add new firmware helper functions as well.
v3: update to latest format

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: disable gfx cgcg on cik
Alex Deucher [Thu, 26 Jun 2014 22:36:24 +0000 (18:36 -0400)]
drm/radeon: disable gfx cgcg on cik

This needs some tweaking to be stable with newer
ucode versions.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon/dpm: add support for SVI2 voltage for SI
Alex Deucher [Fri, 6 Jun 2014 22:43:45 +0000 (18:43 -0400)]
drm/radeon/dpm: add support for SVI2 voltage for SI

Some newer boards use SVI2 for voltage control rather
than GPIO.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/ttm: Pass GFP flags in order to avoid deadlock.
Tetsuo Handa [Sun, 3 Aug 2014 11:02:31 +0000 (20:02 +0900)]
drm/ttm: Pass GFP flags in order to avoid deadlock.

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: stable <stable@kernel.org> [2.6.35+]
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/ttm: Fix possible stack overflow by recursive shrinker calls.
Tetsuo Handa [Sun, 3 Aug 2014 11:02:03 +0000 (20:02 +0900)]
drm/ttm: Fix possible stack overflow by recursive shrinker calls.

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: stable <stable@kernel.org> [2.6.35+]
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.
Tetsuo Handa [Sun, 3 Aug 2014 11:01:10 +0000 (20:01 +0900)]
drm/ttm: Use mutex_trylock() to avoid deadlock inside shrinker functions.

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: stable <stable@kernel.org> [3.3+]
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/ttm: Choose a pool to shrink correctly in ttm_dma_pool_shrink_scan().
Tetsuo Handa [Sun, 3 Aug 2014 11:00:40 +0000 (20:00 +0900)]
drm/ttm: Choose a pool to shrink correctly in ttm_dma_pool_shrink_scan().

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: stable <stable@kernel.org> [3.3+]
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/ttm: Fix possible division by 0 in ttm_dma_pool_shrink_scan().
Tetsuo Handa [Sun, 3 Aug 2014 10:59:35 +0000 (19:59 +0900)]
drm/ttm: Fix possible division by 0 in ttm_dma_pool_shrink_scan().

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 <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: stable <stable@kernel.org> [3.3+]
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/tda998x: update for new drm connector APIs.
Dave Airlie [Tue, 5 Aug 2014 00:34:33 +0000 (10:34 +1000)]
drm/tda998x: update for new drm connector APIs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/sti: fix warning in build.
Dave Airlie [Mon, 4 Aug 2014 23:41:42 +0000 (09:41 +1000)]
drm/sti: fix warning in build.

Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm_kms_for_next-v8' of git://git.linaro.org/people/benjamin.gaignard...
Dave Airlie [Mon, 4 Aug 2014 23:28:37 +0000 (09:28 +1000)]
Merge branch 'drm_kms_for_next-v8' of git://git.linaro.org/people/benjamin.gaignard/kernel into drm-next

This series of patches add the support of DRM/KMS drivers for STMicroelectronics
chipsets stih416 and stih407.

Hardware is split in two main blocks: Compositor and TVout. Each of them
includes specific hardware IPs and the display timing are controlled by a specific
Video Timing Generator hardware IP (VTG).

Compositor is made of the follow hardware IPs:
 - GDP (Generic Display Pipeline) which is an entry point for graphic (RGB)
   buffers
 - VDP (Video Diplay Pipeline) which is an entry point for video (YUV) buffers
 - HQVDP (High Quality Video Display Processor) that supports scaling,
   deinterlacing and some miscellaneous image quality improvements.
   It fetches the Video decoded buffers from memory, processes them and pushes
   them to the Compositor through a HW dedicated bus.
 - Mixer is responsible of mixing all the entries depending of their
   respective z-order and layout

TVout is divided in 3 parts:
 - HDMI to generate HDMI signals, depending of chipset version HDMI phy can
   change.
 - HDA to generate signals for HD analog TV
 - VIP to control/switch data path coming from Compositor

On stih416 compositor and Tvout are on different dies so a Video Trafic Advance
inter-die Communication mechanism (VTAC) is needed.

+---------------------------------------------+   +----------------------------------------+
| +-------------------------------+   +----+  |   |  +----+   +--------------------------+ |
| |                               |   |    |  |   |  |    |   |  +---------+     +----+  | |
| | +----+              +------+  |   |    |  |   |  |    |   |  | VIP     |---->|HDMI|  | |
| | |GPD +------------->|      |  |   |    |  |   |  |    |   |  |         |     +----+  | |
| | +----+              |Mixer |--|-->|    |  |   |  |    |---|->| switcher|             | |
| |                     |      |  |   |    |  |   |  |    |   |  |         |     +----+  | |
| |                     |      |  |   |    |  |   |  |    |   |  |         |---->|HDA |  | |
| |                     +------+  |   |VTAC|========>|VTAC|   |  +---------+     +----+  | |
| |                               |   |    |  |   |  |    |   |                          | |
| |         Compositor            |   |    |  |   |  |    |   |           TVout          | |
| +-------------------------------+   |    |  |   |  |    |   +--------------------------+ |
|                      ^              |    |  |   |  |    |             ^                  |
|                      |              |    |  |   |  |    |             |                  |
|               +--------------+      |    |  |   |  |    |      +-------------+           |
|               | VTG (master) |----->|    |  |   |  |    |----->| VTG (slave) |           |
|               +--------------+      +----+  |   |  +----+      +-------------+           |
|Digital die                                  |   |                              Analog Die|
+---------------------------------------------+   +----------------------------------------+

On stih407 Compositor and Tvout are on the same die

+-----------------------------------------------------------------+
| +-------------------------------+  +--------------------------+ |
| |                               |  |  +---------+     +----+  | |
| | +----+              +------+  |  |  | VIP     |---->|HDMI|  | |
| | |GPD +------------->|      |  |  |  |         |     +----+  | |
| | +----+              |Mixer |--|--|->| switcher|             | |
| | +----+   +-----+    |      |  |  |  |         |     +----+  | |
| | |VDP +-->+HQVDP+--->|      |  |  |  |         |---->|HDA |  | |
| | +----+   +-----+    +------+  |  |  +---------+     +----+  | |
| |                               |  |                          | |
| |         Compositor            |  |           TVout          | |
| +-------------------------------+  +--------------------------+ |
|                              ^        ^                         |
|                              |        |                         |
|                           +--------------+                      |
|                           |     VTG      |                      |
|                           +--------------+                      |
|Digital die                                                      |
+-----------------------------------------------------------------+

In addition of the drivers for the IPs listed before a thin I2C driver (hdmiddc) is used
by HDMI driver to retrieve EDID for monitor.

To unify interfaces of GDP and VDP we create a "layer" interface called by
compositor to control both GPD and VDP.

Hardware have memory contraints (alignment, contiguous) so we use CMA drm helpers functions
to allocate frame buffer.

File naming convention is:
 - sti_* for IPs drivers
 - sti_drm_* for drm functions implementation.

* 'drm_kms_for_next-v8' of git://git.linaro.org/people/benjamin.gaignard/kernel:
  drm: sti: Add DRM driver itself
  drm: sti: add Compositor
  drm: sti: add Mixer
  drm: sti: add VID layer
  drm: sti: add GDP layer
  drm: sti: add TVOut driver
  drm: sti: add HDA driver
  drm: sti: add HDMI driver
  drm: sti: add VTAC drivers
  drm: sti: add VTG driver
  drm: sti: add bindings for DRM driver

10 years agoMerge branch 'tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox into...
Dave Airlie [Mon, 4 Aug 2014 23:26:09 +0000 (09:26 +1000)]
Merge branch 'tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox into drm-next

This builds upon the previous set of fixes which were pulled on 6th July.
Included in this set are:
- an update from Jean-Francois to add the missing reg documentation entry
  to the device tree documentation.
- conversion of the tda998x driver to the component helpers.

* 'tda998x-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox:
  drm/i2c: tda998x: add component support
  drm/i2c: tda998x: allow re-use of tda998x support code
  drm/i2c: tda998x: fix lack of required reg in DT documentation

Conflicts:
drivers/gpu/drm/i2c/tda998x_drv.c

10 years agoMerge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
Dave Airlie [Mon, 4 Aug 2014 23:22:27 +0000 (09:22 +1000)]
Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

This time around we have a mix of new hw enablement (mdp5 v1.3 /
apq8084), plus devicetree and various upstream changes (mostly
adapting to CCF vs downstream clk driver differences) for mdp4 /
apq8064.  With these drm/msm patches plus a few other small patchsets
(from linaro qcom integration branch.. mostly stuff queued up for
3.17) we have the inforce ifc6410 board working, with gpu.  Much nicer
to work with than ancient vendor android branch :-)

* 'msm-next' of git://people.freedesktop.org/~robclark/linux:
  drm/msm/hdmi: fix HDMI_MUX_EN gpio request typo
  drm/msm/hdmi: enable lpm-mux if it is present
  drm/msm/mdp5: add support for MDP5 v1.3
  drm/msm: fix potential deadlock in gpu init
  drm/msm: use upstream iommu
  drm/msm: no mmu is only error if not using vram carveout
  drm/msm: fix BUG_ON() in error cleanup path
  drm/msm/mdp4: add mdp axi clk
  drm/msm: hdmi phy 8960 phy pll
  drm/msm: update generated headers
  drm/msm: DT support for 8960/8064 (v3)
  drm/msm: Implement msm drm fb_mmap callback function
  drm/msm: activate iommu support
  drm/msm: fix double struct_mutex acquire

10 years agoMerge tag 'v3.16' into drm-next
Dave Airlie [Mon, 4 Aug 2014 23:04:59 +0000 (09:04 +1000)]
Merge tag 'v3.16' into drm-next

Linux 3.16

backmerge requested by i915, nouveau and radeon authors

Conflicts:
drivers/gpu/drm/i915/i915_gem_render_state.c
drivers/gpu/drm/i915/intel_drv.h

10 years agodrm/msm/hdmi: fix HDMI_MUX_EN gpio request typo
Beeresh Gopal [Thu, 31 Jul 2014 15:48:50 +0000 (11:48 -0400)]
drm/msm/hdmi: fix HDMI_MUX_EN gpio request typo

HDMI_MUX_EN gpio is requested. If an error occurs, the same name
should be printed (HDMI_MUX_EN) instead of HDMI_MUX_SEL (typo).

Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/hdmi: enable lpm-mux if it is present
Beeresh Gopal [Thu, 31 Jul 2014 15:48:49 +0000 (11:48 -0400)]
drm/msm/hdmi: enable lpm-mux if it is present

lpm-mux is programmed to enable HDMI connector
on the docking station for S805 chipset based
devices.

Signed-off-by: Beeresh Gopal <gbeeresh@codeaurora.org>
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/mdp5: add support for MDP5 v1.3
Stephane Viau [Mon, 7 Jul 2014 14:34:01 +0000 (10:34 -0400)]
drm/msm/mdp5: add support for MDP5 v1.3

MDP5 has several functional blocks (ie: VIG/RGB pipes, LMs, ...).
From one revision to another, these blocks' base addresses might
change due to the number of instances present in the MDP5 hw.
A way of dealing with these offset changes is to introduce
dynamic offsets 'per block'.

This change adds support for the new revision of MDP5: v1.3.
The idea is to define one hw config per MDP version and select
either one of them at runtime, after reading the MDP5 version.

Once the MDP version is known, 'per block' dynamic offsets
are initialized through a global pointer, which is then used for
read/write register access.

Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: fix potential deadlock in gpu init
Rob Clark [Fri, 11 Jul 2014 15:59:22 +0000 (11:59 -0400)]
drm/msm: fix potential deadlock in gpu init

Somewhere along the way, the firmware loader sprouted another lock
dependency, resulting in possible deadlock scenario:

 &dev->struct_mutex --> &sb->s_type->i_mutex_key#2 --> &mm->mmap_sem

which is problematic vs things like gem mmap.

So introduce a separate mutex to synchronize gpu init.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: use upstream iommu
Rob Clark [Thu, 10 Jul 2014 02:08:15 +0000 (22:08 -0400)]
drm/msm: use upstream iommu

Downstream kernel IOMMU had a non-standard way of dealing with multiple
devices and multiple ports/contexts.  We don't need that on upstream
kernel, so rip out the crazy.

Note that we have to move the pinning of the ringbuffer to after the
IOMMU is attached.  No idea how that managed to work properly on the
downstream kernel.

For now, I am leaving the IOMMU port name stuff in place, to simplify
things for folks trying to backport latest drm/msm to device kernels.
Once we no longer have to care about pre-DT kernels, we can drop this
and instead backport upstream IOMMU driver.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: no mmu is only error if not using vram carveout
Rob Clark [Tue, 1 Jul 2014 18:49:55 +0000 (14:49 -0400)]
drm/msm: no mmu is only error if not using vram carveout

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: fix BUG_ON() in error cleanup path
Rob Clark [Tue, 1 Jul 2014 18:49:25 +0000 (14:49 -0400)]
drm/msm: fix BUG_ON() in error cleanup path

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/mdp4: add mdp axi clk
Rob Clark [Mon, 30 Jun 2014 22:50:51 +0000 (18:50 -0400)]
drm/msm/mdp4: add mdp axi clk

Downstream kernel holds this clk via a fake-parent relationship.
Upstream clock framework requires that we hold it explicitly.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: hdmi phy 8960 phy pll
Rob Clark [Wed, 25 Jun 2014 13:54:36 +0000 (09:54 -0400)]
drm/msm: hdmi phy 8960 phy pll

On downstream kernel the clk driver directly bangs hdmi phy registers.
For upstream kernel, we need to model this as a clock and register with
the clock framework.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: update generated headers
Rob Clark [Wed, 25 Jun 2014 13:01:19 +0000 (09:01 -0400)]
drm/msm: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: DT support for 8960/8064 (v3)
Rob Clark [Sun, 15 Dec 2013 21:23:05 +0000 (16:23 -0500)]
drm/msm: DT support for 8960/8064 (v3)

Now that we (almost) have enough dependencies in place (MMCC, RPM, etc),
add necessary DT support so that we can use drm/msm on upstream kernel.

v2: update for review comments
v3: rebase on component helper changes

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: Implement msm drm fb_mmap callback function
Hai Li [Wed, 18 Jun 2014 20:55:27 +0000 (16:55 -0400)]
drm/msm: Implement msm drm fb_mmap callback function

This change implements msm drm specific fb_mmap function for fb device
to properly map the fb address to userspace.

Signed-off-by: Hai Li <hali@codeaurora.org>
Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com> (+ minor comment tweak)
10 years agodrm/msm: activate iommu support
Stephane Viau [Tue, 17 Jun 2014 14:32:38 +0000 (10:32 -0400)]
drm/msm: activate iommu support

This changes activates the iommu support for MDP5, through the
platform config structure.

Signed-off-by: Stephane Viau <sviau@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: fix double struct_mutex acquire
Rob Clark [Sat, 28 Jun 2014 15:11:34 +0000 (11:11 -0400)]
drm/msm: fix double struct_mutex acquire

Mutex is already grabbed in show_locked().. somehow this slipped
through.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agoMerge tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm...
Dave Airlie [Mon, 4 Aug 2014 07:57:34 +0000 (17:57 +1000)]
Merge tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel into drm-next

Final feature pull for 3.17.

drm-intel-next-2014-07-25:
- Ditch UMS support (well just the config option for now)
- Prep work for future platforms (Sonika Jindal, Damien)
- runtime pm/soix fixes (Paulo, Jesse)
- psr tracking improvements, locking fixes, now enabled by default!
- rps fixes for chv (Deepak, Ville)
- drm core patches for rotation support (Ville, Sagar Kamble) - the i915 parts
  unfortunately didn't make it yet
- userptr fixes (Chris)
- minimum backlight brightness (Jani), acked long ago by Matthew Garret on irc -
  I've forgotten about this patch :(

QA is a bit unhappy about the DP MST stuff since it broke hpd testing a
bit, but otherwise looks sane. I've backmerged drm-next to resolve
conflicts with the mst stuff, which means the new tag itself doesn't
contain the overview as usual.

* tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel: (75 commits)
  drm/i915/userptr: Keep spin_lock/unlock in the same block
  drm/i915: Allow overlapping userptr objects
  drm/i915: Ditch UMS config option
  drm/i915: respect the VBT minimum backlight brightness
  drm/i915: extract backlight minimum brightness from VBT
  drm/i915: Replace HAS_PCH_SPLIT which incorrectly lets some platforms in
  drm/i915: Returning from increase/decrease of pllclock when invalid
  drm/i915: Setting legacy palette correctly for different platforms
  drm/i915: Avoid incorrect returning for some platforms
  drm/i915: Writing proper check for reading of pipe status reg
  drm/i915: Returning the right VGA control reg for platforms
  drm/i915: Allowing changing of wm latencies for valid platforms
  drm/i915: Adding HAS_GMCH_DISPLAY macro
  drm/i915: Fix possible overflow when recording semaphore states.
  drm/i915: Do not unmap object unless no other VMAs reference it
  drm/i915: remove plane/cursor/pipe assertions from intel_crtc_disable
  drm/i915: Reorder ctx unref on ppgtt cleanup
  drm/i915/error: Check the potential ctx obj's vm
  drm/i915: Fix printing proper min/min/rpe values in debugfs
  drm/i915: BDW can also detect unclaimed registers
  ...

10 years agodrm: close race in connector registration (v2)
Dave Airlie [Thu, 24 Jul 2014 01:53:45 +0000 (11:53 +1000)]
drm: close race in connector registration (v2)

Daniel pointed out with hotplug that userspace could be trying to oops us
as root for lols, and that to be correct we shouldn't register the object
with the idr before we have fully set the connector object up.

His proposed solution was a lot more life changing, this seemed like a simpler
proposition to me, get the connector object id from the idr, but don't
register the object until the drm_connector_register callback.

The open question is whether the drm_mode_object_register needs a bigger lock
than just the idr one, but I can't see why it would, but I can be locking
challenged.

v2: fix bool noreg into sane - add comment.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/i915: only hook up hpd pulse for DP outputs
Chris Wilson [Mon, 4 Aug 2014 06:15:09 +0000 (07:15 +0100)]
drm/i915: only hook up hpd pulse for DP outputs

On HSW+, the digital encoders are shared between HDMI and DP outputs,
with one encoder masquerading as both. The VBT should tell us if we need
to have DP or HDMI support on a particular port, but if we don't have DP
support and we enable the DP hpd pulse handler then we cause an oops.

Don't hook up the DP hpd handling if we don't have a DP port.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81856
Reported-by: Intel QA Team.
Signed-off-by: Dave Airlie <airlied@redhat.com> # v1
[ickle: Fix the error handling after a malloc failure]
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daein...
Dave Airlie [Mon, 4 Aug 2014 05:07:21 +0000 (15:07 +1000)]
Merge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

   This pull request includes i80 interface support, module auto-loading
   ipp consolidation, and trivail fixups and cleanups.

Summary:
- Add i80 interface support. For this, we added some features to
  Exynos drm framework, which don't affect any other SoC and common
  framework because they are specific to Exynos drm.
- Add module auto-loading support. For this, sub drivers of Exynos drm
  exports their of match tables to userspace. This allows modules to be
  loaded automatically based on devicetree information
- Consolidate ipp driver. This patch just just includes cleanups and
  a littl bit refactoring codes.

If there is any problem, please kindly let me know.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: (38 commits)
  drm/exynos: g2d: let exynos_g2d_get_ver_ioctl fail
  drm/exynos: g2d: make ioctls more robust
  drm/exynos: hdmi: add null check for hdmiphy_port
  drm/exynos: control blending of mixer graphic layer 0
  drm/exynos: Add MODULE_DEVICE_TABLE entries for various components
  Subject: Revert "drm/exynos: remove MODULE_DEVICE_TABLE definitions"
  Subject: Revert "drm/exynos: fix module build error"
  drm/exynos/ipp: simplify ipp_find_driver
  drm/exynos/ipp: simplify ipp_create_id
  drm/exynos/ipp: remove redundant messages
  drm/exynos/ipp: simplify ipp_find_obj
  drm/exynos/ipp: remove useless registration checks
  drm/exynos/ipp: simplify memory check function
  drm/exynos/ipp: remove incorrect checks of list_first_entry result
  drm/exynos/ipp: remove temporary variable
  drm/exynos/ipp: correct address type
  drm/exynos/ipp: remove struct exynos_drm_ipp_private
  drm/exynos/ipp: remove unused field from exynos_drm_ipp_private
  drm/exynos/ipp: remove type casting
  drm/exynos: g2d: add exynos4212 as a compatible device.
  ...

10 years agodrm/exynos: g2d: let exynos_g2d_get_ver_ioctl fail
Tobias Jakobi [Wed, 23 Jul 2014 14:57:13 +0000 (16:57 +0200)]
drm/exynos: g2d: let exynos_g2d_get_ver_ioctl fail

Currently the DRM_IOCTL_EXYNOS_G2D_GET_VER ioctl always succeeds, even
if no G2D support is available. Let the ioctl fail when this is the
case, so that userspace can accurately probe for G2D support.

This also fixes the exynos tests in libdrm. There 'g2d_init' doesn't
fail when G2D is absent, leading to a segfault later.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: INki Dae <inki.dae@samsung.com>
10 years agodrm/exynos: g2d: make ioctls more robust
Tobias Jakobi [Wed, 23 Jul 2014 14:57:12 +0000 (16:57 +0200)]
drm/exynos: g2d: make ioctls more robust

Both exynos_g2d_set_cmdlist_ioctl and exynos_g2d_exec_ioctl don't check
if the G2D was succesfully probe. If that is not the case, then g2d_priv
is just NULL and extracting 'dev' from it in the next step  is going to
produce a kernel oops.

Add proper checks and return ENODEV if the G2D is not available.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: INki Dae <inki.dae@samsung.com>
10 years agodrm/exynos: hdmi: add null check for hdmiphy_port
Seung-Woo Kim [Mon, 28 Jul 2014 08:15:22 +0000 (17:15 +0900)]
drm/exynos: hdmi: add null check for hdmiphy_port

The hdmiphy can be apb and hdmiphy_port can be null. So before
accessing hdmiphy_port, it should be checked.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos: control blending of mixer graphic layer 0
Joonyoung Shim [Fri, 25 Jul 2014 10:59:10 +0000 (19:59 +0900)]
drm/exynos: control blending of mixer graphic layer 0

The mixer graphic layer 0 isn't blended as default by commit
0377f4ed9f1aed30292c4e3c87f24e028ae26f36(drm/exynos: Don't blend mixer
layer 0). But it needs to be blended with graphic layer 0 if video layer
is enabled by vp because video layer is bottom.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos: Add MODULE_DEVICE_TABLE entries for various components
Sjoerd Simons [Fri, 18 Jul 2014 20:36:41 +0000 (22:36 +0200)]
drm/exynos: Add MODULE_DEVICE_TABLE entries for various components

Add MODULE_DEVICE_TABLE calls for the various OF match tables that
currently don't have one. This allows the module to be
autoloaded based on devicetree information.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agoSubject: Revert "drm/exynos: remove MODULE_DEVICE_TABLE definitions"
Sjoerd Simons [Wed, 30 Jul 2014 02:29:41 +0000 (11:29 +0900)]
Subject: Revert "drm/exynos: remove MODULE_DEVICE_TABLE definitions"

This reverts commit d089621896c3530a9bd309f96e9c9124d07f6c3f was
original to prevent multiple MODULE_DEVICE_TABLE in one module.
Which, as a side-effect broke autoloading of the module.

Since 21bdd17b21b45ea48e06e23918d681afbe0622e9 it is possible to have
multiple calls to MODULE_DEVICE_TABLE, so the patch can be
reverted to restore support for autoloading

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agoSubject: Revert "drm/exynos: fix module build error"
Sjoerd Simons [Wed, 30 Jul 2014 02:28:31 +0000 (11:28 +0900)]
Subject: Revert "drm/exynos: fix module build error"

Since 21bdd17b21b45ea48e06e23918d681afbe0622e9 it is possible to have
multiple calls to MODULE_DEVICE_TABLE, so the patch can be
reverted to restore support for autoloading

Conflicts:
drivers/gpu/drm/exynos/exynos_drm_fimd.c
drivers/gpu/drm/exynos/exynos_drm_g2d.c

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agoLinux 3.16
Linus Torvalds [Sun, 3 Aug 2014 22:25:02 +0000 (15:25 -0700)]
Linux 3.16

10 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 3 Aug 2014 16:58:20 +0000 (09:58 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
 "Two fixes in the timer area:
   - a long-standing lock inversion due to a printk
   - suspend-related hrtimer corruption in sched_clock"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks
  sched_clock: Avoid corrupting hrtimer tree during suspend

10 years agodrm/exynos/ipp: simplify ipp_find_driver
Andrzej Hajda [Thu, 3 Jul 2014 13:10:37 +0000 (15:10 +0200)]
drm/exynos/ipp: simplify ipp_find_driver

The patch puts repeated code sequence into one function, removes verbose
comments and decreases log verbosity.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: simplify ipp_create_id
Andrzej Hajda [Thu, 3 Jul 2014 13:10:36 +0000 (15:10 +0200)]
drm/exynos/ipp: simplify ipp_create_id

There is no gain in passing id by pointer to be filled.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: remove redundant messages
Andrzej Hajda [Thu, 3 Jul 2014 13:10:35 +0000 (15:10 +0200)]
drm/exynos/ipp: remove redundant messages

In case of error callback prints already corresponding message.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: simplify ipp_find_obj
Andrzej Hajda [Thu, 3 Jul 2014 13:10:34 +0000 (15:10 +0200)]
drm/exynos/ipp: simplify ipp_find_obj

The patch simplifies ipp_find_obj and removes debug messages.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: remove useless registration checks
Andrzej Hajda [Thu, 3 Jul 2014 13:10:33 +0000 (15:10 +0200)]
drm/exynos/ipp: remove useless registration checks

Argument checks are redundant, clients always check ippdrv before calling
these functions.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: simplify memory check function
Andrzej Hajda [Thu, 3 Jul 2014 13:10:32 +0000 (15:10 +0200)]
drm/exynos/ipp: simplify memory check function

The only thing function should check is if there are buffers in respective
queues.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: remove incorrect checks of list_first_entry result
Andrzej Hajda [Thu, 3 Jul 2014 13:10:31 +0000 (15:10 +0200)]
drm/exynos/ipp: remove incorrect checks of list_first_entry result

list_first_entry does not return NULL on empty list so this check
does not make sense. Moreover there is already code which prevents calling
list_first_entry on empty lists.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
10 years agodrm/exynos/ipp: remove temporary variable
Andrzej Hajda [Thu, 3 Jul 2014 13:10:30 +0000 (15:10 +0200)]
drm/exynos/ipp: remove temporary variable

There is no reason to allocate intermediate variable.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>