openwrt/staging/blogic.git
6 years agodrm/i915: Fix hibernation with ACPI S0 target state
Imre Deak [Thu, 22 Mar 2018 14:36:42 +0000 (16:36 +0200)]
drm/i915: Fix hibernation with ACPI S0 target state

After

commit dd9f31c7a3887950cbd0d49eb9d43f7a1518a356
Author: Imre Deak <imre.deak@intel.com>
Date:   Wed Aug 16 17:46:07 2017 +0300

    drm/i915/gen9+: Set same power state before hibernation image
    save/restore

during hibernation/suspend the power domain functionality got disabled,
after which resume could leave it incorrectly disabled if the ACPI
target state was S0 during suspend and i915 was not loaded by the loader
kernel.

This was caused by not considering if we resumed from hibernation as the
condition for power domains reiniting.

Fix this by simply tracking if we suspended power domains during system
suspend and reinit power domains accordingly during resume. This will
result in reiniting power domains always when resuming from hibernation,
regardless of the platform and whether or not i915 is loaded by the
loader kernel.

The reason we didn't catch this earlier is that the enabled/disabled
state of power domains during PMSG_FREEZE/PMSG_QUIESCE is platform
and kernel config dependent: on my SKL the target state is S4
during PMSG_FREEZE and (with the driver loaded in the loader kernel)
S0 during PMSG_QUIESCE. On the reporter's machine it's S0 during
PMSG_FREEZE but (contrary to this) power domains are not initialized
during PMSG_QUIESCE since i915 is not loaded in the loader kernel, or
it's loaded but without the DMC firmware being available.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105196
Reported-and-tested-by: amn-bas@hotmail.com
Fixes: dd9f31c7a388 ("drm/i915/gen9+: Set same power state before hibernation image save/restore")
Cc: amn-bas@hotmail.com
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180322143642.26883-1-imre.deak@intel.com
(cherry picked from commit 0f90603c33bdf6575cfdc81edd53f3f13ba166fb)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
6 years agodrm/i915/execlists: Use a locked clear_bit() for synchronisation with interrupt
Chris Wilson [Wed, 21 Mar 2018 09:10:27 +0000 (09:10 +0000)]
drm/i915/execlists: Use a locked clear_bit() for synchronisation with interrupt

We were relying on the uncached reads when processing the CSB to provide
ourselves with the serialisation with the interrupt handler (so we could
detect new interrupts in the middle of processing the old one). However,
in commit 767a983ab255 ("drm/i915/execlists: Read the context-status HEAD
from the HWSP") those uncached reads were eliminated (on one path at
least) and along with them our serialisation. The result is that we
would very rarely miss notification of a new interrupt and leave a
context-switch unprocessed, hanging the GPU.

Fixes: 767a983ab255 ("drm/i915/execlists: Read the context-status HEAD from the HWSP")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180321091027.21034-1-chris@chris-wilson.co.uk
(cherry picked from commit 9153e6b7c85edbc89e874e5c83f86217c53dcfaf)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
6 years agodrm/i915: Specify which engines to reset following semaphore/event lockups
Chris Wilson [Tue, 20 Mar 2018 10:04:48 +0000 (10:04 +0000)]
drm/i915: Specify which engines to reset following semaphore/event lockups

If the GPU is stuck waiting for an event or for a semaphore, we need to
reset the GPU in order to recover. We have to tell the reset routine
which engines we want reset, but we were still using the old interface
and declaring it as "not-fatal".

Fixes: 14b730fcb8d9 ("drm/i915/tdr: Prepare error handler to accept mask of hung engines")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Michel Thierry <michel.thierry@intel.com>
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180320100449.1360-1-chris@chris-wilson.co.uk
(cherry picked from commit ca98317b89428e6ac17be0938b467ed78654dd56)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
6 years agodrm/i915/dp: Write to SET_POWER dpcd to enable MST hub.
Dhinakaran Pandiyan [Wed, 14 Mar 2018 05:48:25 +0000 (22:48 -0700)]
drm/i915/dp: Write to SET_POWER dpcd to enable MST hub.

If bios sets up an MST output and hardware state readout code sees this is
an SST configuration, when disabling the encoder we end up calling
->post_disable_dp() hook instead of the MST version. Consequently, we write
to the DP_SET_POWER dpcd to set it D3 state. Further along when we try
enable the encoder in MST mode, POWER_UP_PHY transaction fails to power up
the MST hub. This results in continuous link training failures which keep
the system busy delaying boot. We could identify bios MST boot discrepancy
and handle it accordingly but a simple way to solve this is to write to the
DP_SET_POWER dpcd for MST too.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105470
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reported-by: Laura Abbott <labbott@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 5ea2355a100a ("drm/i915/mst: Use MST sideband message transactions for dpms control")
Tested-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180314054825.1718-1-dhinakaran.pandiyan@intel.com
(cherry picked from commit ad260ab32a4d94fa974f58262f8000472d34fd5b)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
6 years agoMerge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Mon, 26 Mar 2018 00:01:11 +0000 (10:01 +1000)]
Merge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm-next

Last pull for 4.17.  Highlights:
- Vega12 support
- A few more bug fixes and cleanups for powerplay

* 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux: (77 commits)
  drm/amd/pp: clean header file hwmgr.h
  drm/amd/pp: use mlck_table.count for array loop index limit
  drm/amdgpu: Add an ATPX quirk for hybrid laptop
  drm/amdgpu: fix spelling mistake: "asssert" -> "assert"
  drm/amd/pp: Add new asic support in pp_psm.c
  drm/amd/pp: Clean up powerplay code on Vega12
  drm/amd/pp: Add smu irq handlers for legacy asics
  drm/amd/pp: Fix set wrong temperature range on smu7
  drm/amdgpu: Don't change preferred domian when fallback GTT v5
  drm/amdgpu: Fix NULL ptr on driver unload due to init failure.
  drm/amdgpu: fix "mitigate workaround for i915"
  drm/amd/pp: Add smu irq handlers in sw_init instand of hw_init
  drm/amd/pp: Refine register_thermal_interrupt function
  drm/amdgpu: Remove wrapper layer of cgs irq handling
  drm/amd/powerplay: Return per DPM level clock
  drm/amd/powerplay: Remove the SOC floor voltage setting
  drm/amdgpu: no job timeout setting on compute queues
  drm/amdgpu: add vega12 pci ids (v2)
  drm/amd/powerplay: add the hw manager for vega12 (v4)
  drm/amd/powerplay: add the smu manager for vega12 (v4)
  ...

6 years agodrm/amd/pp: clean header file hwmgr.h
Rex Zhu [Thu, 22 Mar 2018 06:38:37 +0000 (14:38 +0800)]
drm/amd/pp: clean header file hwmgr.h

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: use mlck_table.count for array loop index limit
Colin Ian King [Wed, 21 Mar 2018 18:26:53 +0000 (18:26 +0000)]
drm/amd/pp: use mlck_table.count for array loop index limit

v2: use temporaries to trivially reduces object size.

The for-loops process data in the mclk_table but use slck_table.count
as the loop index limit.  I believe these are cut-n-paste errors from
the previous almost identical loops as indicated by static analysis.
Fix these.

Detected by CoverityScan, CID#1466001 ("Copy-paste error")

Fixes: 5d97cf39ff24 ("drm/amd/pp: Add and initialize OD_dpm_table for CI/VI.")
Fixes: 5e4d4fbea557 ("drm/amd/pp: Implement edit_dpm_table on smu7")
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add an ATPX quirk for hybrid laptop
Alex Deucher [Thu, 22 Mar 2018 02:05:46 +0000 (21:05 -0500)]
drm/amdgpu: Add an ATPX quirk for hybrid laptop

_PR3 doesn't seem to work properly, use ATPX instead.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104064
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agoMerge tag 'drm-intel-next-fixes-2018-03-22' of git://anongit.freedesktop.org/drm...
Dave Airlie [Thu, 22 Mar 2018 20:19:27 +0000 (06:19 +1000)]
Merge tag 'drm-intel-next-fixes-2018-03-22' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

GVT regression fix that caused guest VM GPU hang.
Fix for race conditions in declaring GPU wedged (hit in CI).

* tag 'drm-intel-next-fixes-2018-03-22' of git://anongit.freedesktop.org/drm/drm-intel:
  drm/i915/gvt: force to set all context control bits from guest
  drm/i915/gvt: Update PDPs after a vGPU mm object is pinned.
  drm/i915/gvt: Invalidate vGPU PPGTT mm objects during a vGPU reset.
  drm/i915/kvmgt: Handle kzalloc failure
  drm/i915/gvt: fix spelling mistake: "destoried" -> "destroyed"
  drm/i915/gvt: Remove reduntant printing of untracked mmio
  drm/i915/pmu: Work around compiler warnings on some kernel configs
  drm/i915: Only call tasklet_kill() on the first prepare_reset
  drm/i915: Wrap engine->schedule in RCU locks for set-wedge protection
  drm/i915/icl: do not save DDI A/E sharing bit for ICL

6 years agoMerge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm...
Dave Airlie [Thu, 22 Mar 2018 20:18:48 +0000 (06:18 +1000)]
Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next

A relative large set of various improvements for vmwgfx. Some of them
have been around for a while, some are relatively new, but functionality
should have been tested in our standalone repo.

* 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Bump version patchlevel and date
  drm/vmwgfx: use monotonic event timestamps
  drm/vmwgfx: Unpin the screen object backup buffer when not used
  drm/vmwgfx: Stricter count of legacy surface device resources
  drm/vmwgfx: Use kasprintf
  drm/vmwgfx: Get rid of the device-private suspended member
  drm/vmwgfx: Improve on hibernation
  drm/vmwgfx: Avoid pinning fbdev framebuffers
  drm/vmwgfx: Fix multiple command buffer context use
  drm/vmwgfx: Use the cpu blit utility for framebuffer to screen target blits
  drm/vmwgfx: Add a cpu blit utility that can be used for page-backed bos
  drm/ttm: Export the ttm_k[un]map_atomic_prot API.
  drm/ttm: Clean up kmap_atomic_prot selection code
  drm/vmwgfx: Cursor update fixes
  drm/vmwgfx: Send the correct nonblock option for atomic_commit
  drm/vmwgfx: Move the stdu vblank event to atomic function
  drm/vmwgfx: Move screen object page flip to atomic function
  drm/vmwgfx: Remove drm_crtc_arm_vblank_event from atomic flush
  drm/vmwgfx: Move surface copy cmd to atomic function
  drm/vmwgfx: Avoid iterating over display unit if crtc is available

6 years agoMerge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
Dave Airlie [Thu, 22 Mar 2018 20:16:51 +0000 (06:16 +1000)]
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next

Changes this time mostly come down to:
- hook up the DRM GPU scheduler
- prep work for GC7000L support, to be completed in the next cycle

* 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux: (22 commits)
  drm/etnaviv: bump HW job limit to 4
  drm/etnaviv: etnaviv_sched: Staticize functions when possible
  drm/etnaviv: add PTA handling to MMUv2
  drm/etnaviv: add function to load the initial PTA state
  drm/etnaviv: handle security states
  drm/etnaviv: add security handling mode enum
  drm/etnaviv: add hardware database
  drm/etnaviv: add more minor features fields
  drm/etnaviv: update hardware headers from rnndb
  drm/etnaviv: add support for slave interface clock
  drm/etnaviv: split out and optimize MMU fault dumping
  drm/etnaviv: remove the need for a gpu-subsystem DT node
  dt-bindings: etnaviv: add slave interface clock
  drm/etnaviv: use correct format specifier for size_t
  drm/etnaviv: replace hangcheck with scheduler timeout
  drm/etnaviv: lock BOs after all other submit work is done
  drm/etnaviv: move dependency handling to scheduler
  drm/etnaviv: hook up DRM GPU scheduler
  drm/etnaviv: track fences by IDR instead of seqno
  drm/etnaviv: add missing major features field to debugfs
  ...

6 years agodrm/amdgpu: fix spelling mistake: "asssert" -> "assert"
Colin Ian King [Thu, 22 Mar 2018 15:41:44 +0000 (15:41 +0000)]
drm/amdgpu: fix spelling mistake: "asssert" -> "assert"

Trivial fix to spelling mistake in pr_err error message text

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add new asic support in pp_psm.c
Rex Zhu [Wed, 21 Mar 2018 10:36:50 +0000 (18:36 +0800)]
drm/amd/pp: Add new asic support in pp_psm.c

In new asics(vega12), no power state management in driver,
So no need to implement related callback functions.
and add some ps checks in pp_psm.c

Revert "drm/amd/powerplay: add new pp_psm infrastructure for vega12 (v2)"
This reverts commit 7d1a63f3aa331b853e41f92d0e7890ed31de8c13.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Clean up powerplay code on Vega12
Rex Zhu [Wed, 21 Mar 2018 09:25:07 +0000 (17:25 +0800)]
drm/amd/pp: Clean up powerplay code on Vega12

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add smu irq handlers for legacy asics
Rex Zhu [Wed, 21 Mar 2018 08:19:21 +0000 (16:19 +0800)]
drm/amd/pp: Add smu irq handlers for legacy asics

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix set wrong temperature range on smu7
Rex Zhu [Wed, 21 Mar 2018 07:48:36 +0000 (15:48 +0800)]
drm/amd/pp: Fix set wrong temperature range on smu7

Fix the issue thermal irq was always triggered
as GPU under temperature range detected

The low temp in default thermal policy
was set to -273. so need to use int type for the low temp.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Don't change preferred domian when fallback GTT v5
Chunming Zhou [Fri, 16 Mar 2018 04:29:38 +0000 (12:29 +0800)]
drm/amdgpu: Don't change preferred domian when fallback GTT v5

v2: add sanity checking
v3: make code open
v4: also handle visible to invisible fallback
v5: Since two fallback cases, re-use goto retry

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/vmwgfx: Bump version patchlevel and date
Thomas Hellstrom [Thu, 22 Mar 2018 10:14:34 +0000 (11:14 +0100)]
drm/vmwgfx: Bump version patchlevel and date

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: use monotonic event timestamps
Arnd Bergmann [Tue, 16 Jan 2018 17:18:43 +0000 (18:18 +0100)]
drm/vmwgfx: use monotonic event timestamps

DRM_VMW_EVENT_FENCE_SIGNALED (struct drm_vmw_event_fence) and
DRM_EVENT_VBLANK (struct drm_event_vblank) pass timestamps in 32-bit
seconds/microseconds format.

As of commit c61eef726a78 ("drm: add support for monotonic vblank
timestamps"), other DRM drivers use monotonic times for drm_event_vblank,
but vmwgfx still uses CLOCK_REALTIME for both events, which suffers from
the y2038/y2106 overflow as well as time jumps.

For consistency, this changes vmwgfx to use ktime_get_ts64 as well,
which solves those problems and avoids the deprecated do_gettimeofday()
function.

This should be transparent to to user space, as long as it doesn't
compare the time against the result of gettimeofday().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Unpin the screen object backup buffer when not used
Thomas Hellstrom [Thu, 22 Mar 2018 09:35:18 +0000 (10:35 +0100)]
drm/vmwgfx: Unpin the screen object backup buffer when not used

We were relying on the pinned screen object backup buffer to be destroyed
when not used. But if we hold a copy of the atomic state, like when
hibernating, the backup buffer might not be destroyed since it's
refcounted by the atomic state. This causes us to hibernate with a
buffer pinned in VRAM.

Fix this by only having the buffer pinned when it is actually used by a
screen object.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Stricter count of legacy surface device resources
Thomas Hellstrom [Thu, 22 Mar 2018 09:34:00 +0000 (10:34 +0100)]
drm/vmwgfx: Stricter count of legacy surface device resources

For legacy surfaces, they were previously registered as device resources
when the driver resources were created. Since they are evictable we instead
register them as device resources once they are created on the device,
just like for guest-backed surfaces. This has implications during
hibernation where we can't hibernate with device resources active.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Use kasprintf
Himanshu Jha [Thu, 22 Mar 2018 09:33:03 +0000 (10:33 +0100)]
drm/vmwgfx: Use kasprintf

Use kasprintf instead of combination of kmalloc and sprintf. Also,
remove the local variables used for storing the string length as they
are not required now.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Get rid of the device-private suspended member
Thomas Hellstrom [Thu, 22 Mar 2018 09:30:19 +0000 (10:30 +0100)]
drm/vmwgfx: Get rid of the device-private suspended member

It was used to early block fbdev dirty processing. Replace it with an
unprotected check of the par->dirty.active field. While this might
race with the vmw_fb_off() function, we do a protected check later so
the race will at worst lead to grabbing and releasing a couple of locks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Improve on hibernation
Thomas Hellstrom [Thu, 22 Mar 2018 09:26:37 +0000 (10:26 +0100)]
drm/vmwgfx: Improve on hibernation

Make it possible to hibernate also with masters that don't switch VT at
hibernation time. We save and restore modesetting state unless fbdev is
active and enabled at hibernation time.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
6 years agodrm/vmwgfx: Avoid pinning fbdev framebuffers
Thomas Hellstrom [Thu, 22 Mar 2018 09:19:01 +0000 (10:19 +0100)]
drm/vmwgfx: Avoid pinning fbdev framebuffers

fbdev framebuffers were previously pinned to be able to keep them mapped
across updates.

This commit introduces a mechanism that instead revalidates the map on
each update, keeping the map cached across updates. The cached map is torn
down if the underlying pages change. Typically on buffer object moves and
swapouts.

This should be nicer to the system when we have resource contention.

Testing done: Basic fbdev functionality under Fedora 27.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
6 years agodrm/vmwgfx: Fix multiple command buffer context use
Thomas Hellstrom [Thu, 22 Mar 2018 09:15:23 +0000 (10:15 +0100)]
drm/vmwgfx: Fix multiple command buffer context use

The start / stop and preempt commands don't honor the context argument
but rather acts on all available contexts.

Also add detection for context 1 availability.

Note that currently there's no driver interface for submitting buffers
using the high-priority command queue (context 1).

Testing done:
Change the default context for command submission to 1 instead of 0,
verify basic desktop functionality including faulty command injection and
recovery.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
6 years agodrm/vmwgfx: Use the cpu blit utility for framebuffer to screen target blits
Thomas Hellstrom [Tue, 16 Jan 2018 10:07:30 +0000 (11:07 +0100)]
drm/vmwgfx: Use the cpu blit utility for framebuffer to screen target blits

This blit was previously performed using two large vmaps, one of which
was teared down and remapped on each blit. Use the more resource-
conserving TTM cpu blit instead.

The blit is used in boundary-box computing mode which makes it possible
to minimize the bounding box used in host operations.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agodrm/vmwgfx: Add a cpu blit utility that can be used for page-backed bos
Thomas Hellstrom [Tue, 16 Jan 2018 08:33:27 +0000 (09:33 +0100)]
drm/vmwgfx: Add a cpu blit utility that can be used for page-backed bos

The utility uses kmap_atomic() instead of vmapping the whole buffer
object. As a result there will be more book-keeping but on some
architectures this will help avoid exhausting vmalloc space and also
avoid expensive TLB flushes.

The blit utility also adds a provision to compute a bounding box of
changed content, which is very useful to optimize presentation speed
of ill-behaved applications that don't supply proper damage regions, and
for page-flips. The cost of computing the bounding box is not that
expensive when done in a cpu-blit utility like this.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agodrm/ttm: Export the ttm_k[un]map_atomic_prot API.
Thomas Hellstrom [Tue, 16 Jan 2018 08:12:05 +0000 (09:12 +0100)]
drm/ttm: Export the ttm_k[un]map_atomic_prot API.

It will be used by vmwgfx cpu blit.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/ttm: Clean up kmap_atomic_prot selection code
Thomas Hellstrom [Tue, 16 Jan 2018 08:02:03 +0000 (09:02 +0100)]
drm/ttm: Clean up kmap_atomic_prot selection code

Use helpers to perform the kmap_atomic_prot() functionality to
a) Avoid in-function ifdefs that violate the kernel coding policy,
b) Facilitate exporting the functionality.

This commit should not change any functionality.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/etnaviv: bump HW job limit to 4
Lucas Stach [Fri, 9 Mar 2018 13:29:26 +0000 (14:29 +0100)]
drm/etnaviv: bump HW job limit to 4

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>
6 years agodrm/vmwgfx: Cursor update fixes
Thomas Hellstrom [Tue, 16 Jan 2018 07:54:30 +0000 (08:54 +0100)]
drm/vmwgfx: Cursor update fixes

Use drm_plane_helper_check_update also for the cursor plane.
Some applications, like gdm on gnome shell still uses cursor front-buffer
like rendering without notifying the kernel. We do need some kind of
noficiation, but work around this for now by updating the cursor image on
every cursor move.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agodrm/vmwgfx: Send the correct nonblock option for atomic_commit
Deepak Rawat [Tue, 16 Jan 2018 07:48:09 +0000 (08:48 +0100)]
drm/vmwgfx: Send the correct nonblock option for atomic_commit

Page flip can be slow for vmwgfx in some cases, like need to do surface
copy to different surface or waiting for IN_FENCE_FD. Enabling
nonblocking commits for vmwgfx in case userspace request it.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Move the stdu vblank event to atomic function
Deepak Rawat [Tue, 16 Jan 2018 07:44:42 +0000 (08:44 +0100)]
drm/vmwgfx: Move the stdu vblank event to atomic function

Atomic ioctl can also send the same page flip flags as legacy ioctl.
In those cases also need to send the vblank event to userspace.

vmwgfx does not support flag DRM_MODE_PAGE_FLIP_ASYNC, so this flag is
never expected.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Move screen object page flip to atomic function
Deepak Rawat [Tue, 16 Jan 2018 07:31:04 +0000 (08:31 +0100)]
drm/vmwgfx: Move screen object page flip to atomic function

The dmabuf_dirty/surface_dirty in case of screen object is moved to
plane atomic update, so that page flip in atomic ioctl also works.

vmwgfx does not support DRM_MODE_PAGE_FLIP_ASYNC, so this flag is never
expected.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Remove drm_crtc_arm_vblank_event from atomic flush
Deepak Rawat [Tue, 16 Jan 2018 07:27:17 +0000 (08:27 +0100)]
drm/vmwgfx: Remove drm_crtc_arm_vblank_event from atomic flush

The function drm_crtc_arm_vblank_event should be used for the driver
which have vblank interrupt support. In case of vmwgfx we do not have
vblank interrupt.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Move surface copy cmd to atomic function
Deepak Rawat [Tue, 16 Jan 2018 07:25:55 +0000 (08:25 +0100)]
drm/vmwgfx: Move surface copy cmd to atomic function

When display surface is different than the framebuffer surface, atomic
path do not copy the surface data. This commit moved the code to copy
surface from legacy to atomic path.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/vmwgfx: Avoid iterating over display unit if crtc is available
Deepak Rawat [Tue, 16 Jan 2018 07:24:17 +0000 (08:24 +0100)]
drm/vmwgfx: Avoid iterating over display unit if crtc is available

In case of page flip there is no need to iterate over all display unit
in the function "vmw_kms_helper_dirty". If crtc is available then
dirty commands is performed on that crtc only.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agodrm/amdgpu: Fix NULL ptr on driver unload due to init failure.
Andrey Grodzovsky [Wed, 21 Mar 2018 18:17:25 +0000 (14:17 -0400)]
drm/amdgpu: Fix NULL ptr on driver unload due to init failure.

Problem:
When unloading due to failure amdgpu_device_fini was called twice
which was leading to NULL ptr in amdgpu_irq_disable_all.

Fix:
Call amdgpu_device_fini only once from amdgpu_driver_unload_kms.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix "mitigate workaround for i915"
Christian König [Wed, 21 Mar 2018 12:58:05 +0000 (13:58 +0100)]
drm/amdgpu: fix "mitigate workaround for i915"

Mixed up exporter and importer here. E.g. while mapping the BO we need
to check the importer not the exporter.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105633
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add smu irq handlers in sw_init instand of hw_init
Rex Zhu [Wed, 21 Mar 2018 05:10:11 +0000 (13:10 +0800)]
drm/amd/pp: Add smu irq handlers in sw_init instand of hw_init

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Refine register_thermal_interrupt function
Rex Zhu [Wed, 21 Mar 2018 05:11:27 +0000 (13:11 +0800)]
drm/amd/pp: Refine register_thermal_interrupt function

v2: add Vega12 support

1. delete useless argument in function register_thermal_interrupt
2. rename function name register_thermal_interrupt to register_irq_handlers

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Remove wrapper layer of cgs irq handling
Rex Zhu [Tue, 20 Mar 2018 11:19:44 +0000 (19:19 +0800)]
drm/amdgpu: Remove wrapper layer of cgs irq handling

v2: add Vega12 support

1. remove struct cgs_os_ops
2. delete cgs_linux.h
3. refine the irq code for vega10, can fix set pp table
   failed issue.
4. add common smu irq process function

Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Return per DPM level clock
Kenneth Feng [Tue, 20 Mar 2018 06:02:07 +0000 (14:02 +0800)]
drm/amd/powerplay: Return per DPM level clock

Add change to return per DPM level clock in DAL interface

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Remove the SOC floor voltage setting
Kenneth Feng [Tue, 20 Mar 2018 03:39:52 +0000 (11:39 +0800)]
drm/amd/powerplay: Remove the SOC floor voltage setting

Remove W/A carried over from VG10 to set VDDSOC Floor Voltage
prior to enabling DPM since the VBIOS covers the floor voltage
setting now

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: no job timeout setting on compute queues
Evan Quan [Thu, 15 Mar 2018 01:49:01 +0000 (09:49 +0800)]
drm/amdgpu: no job timeout setting on compute queues

Under some heavy computing environment(e.g. dgemm test), it
takes the asic over 10+ seconds to finish the dispatched job
which will trigger the timeout.

It's quite confusing although it does not seem to bring any
real problems. As a quick workround, we choose to not enfoce
the timeout setting on compute queues.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add vega12 pci ids (v2)
Alex Deucher [Fri, 1 Sep 2017 20:28:27 +0000 (16:28 -0400)]
drm/amdgpu: add vega12 pci ids (v2)

v2: add additional pci ids

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add the hw manager for vega12 (v4)
Evan Quan [Mon, 19 Mar 2018 19:23:57 +0000 (14:23 -0500)]
drm/amd/powerplay: add the hw manager for vega12 (v4)

handles the driver power state setup

v2: squash in the following:
- handle negative temperature ranges
- add vega12 thermal ranges
- use ffs/fls
- remove ACG code
- resend NumOfDisplays message
- correct max dpm levels
- remove power containment settings
- fix warnings
- add sensors interface
- delete unused overdrive arbiter
- drop get_temperature callback
- smu table cleanup
- atomfirmware smu dpm table updates
v3: rebase
v4: rebase

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add the smu manager for vega12 (v4)
Evan Quan [Mon, 19 Mar 2018 19:18:23 +0000 (14:18 -0500)]
drm/amd/powerplay: add the smu manager for vega12 (v4)

handles the driver interaction with the smu firmware

v2: squash in:
- s3 fix for firmware loading
- smu loading through the psp
- unecessary calls to is_smc_ram_running()
- smu table cleanups
v3: rebase
v4: rebase, smu bo allocation fixes, add dpm running callback

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add new pp_psm infrastructure for vega12 (v2)
Evan Quan [Mon, 19 Mar 2018 19:16:14 +0000 (14:16 -0500)]
drm/amd/powerplay: add new pp_psm infrastructure for vega12 (v2)

New psm infrastructure for vega12.

v2: rebase (Alex)

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: update ppatomfwctl (v2)
Evan Quan [Mon, 25 Dec 2017 02:21:12 +0000 (10:21 +0800)]
drm/amd/powerplay: update ppatomfwctl (v2)

Add new get_smc_dpm_information api to fetch the smu dpm
info from the vbios.

v2: deal with updated table format.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add vega12_pptable.h
Evan Quan [Mon, 25 Dec 2017 02:18:54 +0000 (10:18 +0800)]
drm/amd/powerplay: add vega12_pptable.h

Defines the power table format in the vbios.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add vega12_ppsmc.h
Evan Quan [Mon, 25 Dec 2017 02:17:57 +0000 (10:17 +0800)]
drm/amd/powerplay: add vega12_ppsmc.h

Defines the smc message interface with the driver.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add new smu9_driver_if.h for vega12 (v2)
Evan Quan [Mon, 25 Dec 2017 02:17:04 +0000 (10:17 +0800)]
drm/amd/powerplay: add new smu9_driver_if.h for vega12 (v2)

Add driver firmware interface header.

v2: squash in interface updates.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: update atomfirmware.h (v2)
Evan Quan [Mon, 25 Dec 2017 02:13:31 +0000 (10:13 +0800)]
drm/amd/powerplay: update atomfirmware.h (v2)

Add new smu_info table.

v2: update table format.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add vega12_inc.h
Evan Quan [Mon, 25 Dec 2017 02:12:44 +0000 (10:12 +0800)]
drm/amd/powerplay: add vega12_inc.h

Used for the powerplay implementation.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/soc15: initialize reg base for vega12
Hawking Zhang [Mon, 12 Mar 2018 10:25:15 +0000 (18:25 +0800)]
drm/amdgpu/soc15: initialize reg base for vega12

Initialize the IP offsets for vega12.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/soc15: Add external_rev_id for vega12.
Feifei Xu [Thu, 14 Dec 2017 11:02:47 +0000 (19:02 +0800)]
drm/amd/soc15: Add external_rev_id for vega12.

Add external_rev_id for vega12.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/soc15: update vega12 cg_flags
Evan Quan [Mon, 25 Dec 2017 05:16:11 +0000 (13:16 +0800)]
drm/amdgpu/soc15: update vega12 cg_flags

Add the appropriate clockgating flags for vega12

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/soc15: add support for vega12
Alex Deucher [Wed, 7 Mar 2018 03:35:19 +0000 (22:35 -0500)]
drm/amdgpu/soc15: add support for vega12

Add the IP blocks, clock and powergating flags, and
common clockgating support.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/gfx9: add golden setting for vega12 (v3)
Hawking Zhang [Mon, 12 Mar 2018 06:55:48 +0000 (14:55 +0800)]
drm/amdgpu/gfx9: add golden setting for vega12 (v3)

Add gfx9_2_1 golden setting.

v2: switch to soc15_program_register_sequence for
golden setting programming
v3: squash in additional golden updates

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Ken Wang <ken.wang@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gfx9: add clockgating support for vega12
Alex Deucher [Sat, 2 Sep 2017 06:26:50 +0000 (02:26 -0400)]
drm/amdgpu/gfx9: add clockgating support for vega12

Same as vega10 and raven.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/gfx9: add support for vega12
Alex Deucher [Sat, 2 Sep 2017 06:26:09 +0000 (02:26 -0400)]
drm/amdgpu/gfx9: add support for vega12

Same as vega10 and raven.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/gfx9: add gfx config for vega12
Alex Deucher [Sat, 2 Sep 2017 06:24:39 +0000 (02:24 -0400)]
drm/amdgpu/gfx9: add gfx config for vega12

Just a place holder for now.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/gfx9: Add placeholder for vega12 golden settings
Alex Deucher [Sat, 2 Sep 2017 06:22:49 +0000 (02:22 -0400)]
drm/amdgpu/gfx9: Add placeholder for vega12 golden settings

Fill these in when we get them.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/gfx9: add support for vega12 firmware
Alex Deucher [Sat, 2 Sep 2017 06:10:18 +0000 (02:10 -0400)]
drm/amdgpu/gfx9: add support for vega12 firmware

Declare and fetch the appriopriate files.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/sdma4: Update vega12 sdma golden setting.
Feifei Xu [Wed, 7 Mar 2018 03:47:18 +0000 (22:47 -0500)]
drm/amdgpu/sdma4: Update vega12 sdma golden setting.

Update vega12 sdma golden setting.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Ken Wang <ken.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/sdma4: add sdma4_0_1 support for vega12 (v3)
Hawking Zhang [Mon, 12 Mar 2018 06:45:38 +0000 (14:45 +0800)]
drm/amdgpu/sdma4: add sdma4_0_1 support for vega12 (v3)

Add sdma golden setting for vega12.

v2: switch to soc15_program_register_sequence for
golden register programming
v3: squash in unused declaration fix

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/sdma4: add clockgating support for vega12
Alex Deucher [Fri, 1 Sep 2017 20:50:28 +0000 (16:50 -0400)]
drm/amdgpu/sdma4: add clockgating support for vega12

Same as vega10 for now.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/sdma4: Add placeholder for vega12 golden settings
Alex Deucher [Fri, 1 Sep 2017 20:43:47 +0000 (16:43 -0400)]
drm/amdgpu/sdma4: Add placeholder for vega12 golden settings

Fill these in when we get them.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/sdma4: specify vega12 firmware
Alex Deucher [Fri, 1 Sep 2017 20:41:07 +0000 (16:41 -0400)]
drm/amdgpu/sdma4: specify vega12 firmware

Declare the firmware and fetch the proper file.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/mmhub: add clockgating support for vega12
Alex Deucher [Fri, 1 Sep 2017 20:39:10 +0000 (16:39 -0400)]
drm/amdgpu/mmhub: add clockgating support for vega12

Treat it the same as vega10 for now.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/gmc9: add vega12 support (v2)
Alex Deucher [Wed, 14 Mar 2018 01:25:08 +0000 (20:25 -0500)]
drm/amdgpu/gmc9: add vega12 support (v2)

Same as vega10.

v2: squash in golden regs fix from Feifei

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agoMerge tag 'drm-misc-next-2018-03-21' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Wed, 21 Mar 2018 19:36:14 +0000 (05:36 +1000)]
Merge tag 'drm-misc-next-2018-03-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 4.17:

Cross-subsystem Changes:
 dt-bindings: Add emtrion vendor prefix (Jan)

Core Changes:
 drm_print: More object size reductions (Joe)

Driver Changes:
 vc4: Fix alpha blending on bottom plane (Stefan)
 panel: Add Raydium RM68200 panel support (Phillipe)
 panel: Add AUO G104SN02 V2 panel support (Christoph)
 panel: Add KEO TX31D200VM0BAA panel support (Jagan)
 vga_switcheroo: Use device link to bookkeep HDA runtime pm (Lukas)
 rockchip: More CrOS kevin patches trickling in (various
 sun4i: Add A80 support (Chen-Yu)
 sun4i: Add YUV plane support (Maxime)
 meson: Multiple (mostly error-path) fixups (Christophe/Wei)

Cc: Stefan Schake <stschake@gmail.com>
Cc: Philippe CORNU <philippe.cornu@st.com>
Cc: jan.tuerk@emtrion.com
Cc: Christoph Fritz <chf.fritz@googlemail.com>
Cc: Jagan Teki <jagannadh.teki@gmail.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Joe Perches <joe@perches.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
* tag 'drm-misc-next-2018-03-21' of git://anongit.freedesktop.org/drm/drm-misc: (70 commits)
  drm/qxl: Replace drm_gem_object_reference/unreference() with _get/put()
  drm/meson: Fix potential NULL dereference in meson_drv_bind_master()
  drm/sun4i: backend: Support YUV planes
  drm/sun4i: backend: Check that we only have a single YUV plane
  drm/sun4i: Add driver support for A80 display pipeline
  drm/sun4i: Add compatible strings for the A80 display pipeline
  drm/sun4i: Add support for A80 TCONs
  drm/sun4i: Add DT binding for Detail Enhancement Unit in Allwinner A80 SoC
  drm/sun4i: Add compatible strings for A80 TCONs
  drm: Reduce object size of DRM_DEV_<LEVEL> uses
  drm/doc: Put all driver docs into a separate chapter
  drm: dma_bufs: Fixed checkpatch issues
  drm: remove drm_mode_object_{un/reference} aliases
  drm: Add PSR version 3 macro
  drm/vc4_validate: Remove VLA usage
  drm: Make drm_mode_vrefresh() a bit more accurate
  drm: Nuke the useless 'ret' variable from drm_mode_convert_umode()
  drm/i915: Use drm_color_lut_size()
  drm/i915: Remove the blob->data casts
  drm: Introduce drm_color_lut_size()
  ...

6 years agodrm/amdgpu: add vega12 to dc support check
Alex Deucher [Sat, 2 Sep 2017 06:05:29 +0000 (02:05 -0400)]
drm/amdgpu: add vega12 to dc support check

DC is used for modesetting on vega12.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amd/display: Add bios firmware info version for VG12
Jerry (Fangzhi) Zuo [Wed, 22 Nov 2017 19:16:13 +0000 (14:16 -0500)]
drm/amd/display: Add bios firmware info version for VG12

VG12 shows minor revision version of 2 which is not handled in
bios_parser_get_firmware_info() routine.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display/dm: add vega12 support
Alex Deucher [Sat, 2 Sep 2017 06:01:55 +0000 (02:01 -0400)]
drm/amd/display/dm: add vega12 support

Add support for vega12 to the display manager.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu/virtual_dce: add vega12 support
Alex Deucher [Fri, 1 Sep 2017 20:37:59 +0000 (16:37 -0400)]
drm/amdgpu/virtual_dce: add vega12 support

Add virtual dce support for vega12.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: specify vega12 vce firmware
Alex Deucher [Fri, 1 Sep 2017 20:37:21 +0000 (16:37 -0400)]
drm/amdgpu: specify vega12 vce firmware

Declare firmware and add support for the file.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: specify vega12 uvd firmware
Alex Deucher [Fri, 1 Sep 2017 20:35:30 +0000 (16:35 -0400)]
drm/amdgpu: specify vega12 uvd firmware

Declare firmware and add support for the file.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: add vega12 ucode loading method
Feifei Xu [Fri, 20 Oct 2017 02:25:55 +0000 (10:25 +0800)]
drm/amdgpu: add vega12 ucode loading method

Same as vega10.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
6 years agodrm/amdgpu: initilize vega12 psp firmwares
Evan Quan [Wed, 7 Feb 2018 01:34:22 +0000 (09:34 +0800)]
drm/amdgpu: initilize vega12 psp firmwares

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/psp: initial vega12 support
Alex Deucher [Wed, 7 Mar 2018 03:18:09 +0000 (22:18 -0500)]
drm/amdgpu/psp: initial vega12 support

Same as vega10 for now.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: vega12 to smu firmware
Hawking Zhang [Mon, 19 Mar 2018 19:11:09 +0000 (14:11 -0500)]
drm/amdgpu: vega12 to smu firmware

Add the cgs interface to query the smu firmware for vega12
and declare the firmware.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
6 years agodrm/amdgpu: set asic family and ip blocks for vega12
Alex Deucher [Fri, 1 Sep 2017 20:22:35 +0000 (16:22 -0400)]
drm/amdgpu: set asic family and ip blocks for vega12

soc15 just like vega10 and raven.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: add gpu_info firmware for vega12
Alex Deucher [Fri, 1 Sep 2017 20:20:53 +0000 (16:20 -0400)]
drm/amdgpu: add gpu_info firmware for vega12

Stores gpu configuration details.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
6 years agodrm/amdgpu: add vega12 to asic_type enum
Feifei Xu [Thu, 19 Oct 2017 09:04:54 +0000 (17:04 +0800)]
drm/amdgpu: add vega12 to asic_type enum

Add vega12 to amd_asic_type enum and amdgpu_asic_name[].

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
6 years agodrm/amd/include: Add ip header files for vega12.
Feifei Xu [Mon, 16 Oct 2017 10:09:14 +0000 (18:09 +0800)]
drm/amd/include: Add ip header files for vega12.

Add ip header files for IPs with a delta for vg12:
GC, MMHUB, OSS

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-By: Ken Wang <ken.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoMerge tag 'gvt-next-fixes-2018-03-20' of https://github.com/intel/gvt-linux into...
Joonas Lahtinen [Wed, 21 Mar 2018 14:25:15 +0000 (16:25 +0200)]
Merge tag 'gvt-next-fixes-2018-03-20' of https://github.com/intel/gvt-linux into drm-intel-next-fixes

gvt-next-fixes-2018-03-20

- No need warning on untracked regs (Colin)
- Error handling fix for dma unmap (Changbin)
- invalidate shadow ppgtt for vGPU reset (Zhi)
- ensure to update shadow ppgtt after pinned (Zhi)
- force guest ctx ctrl update for sanity (Zhenyu/Xiong)
- one typo fix (Colin)

Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180320024108.f3fdwunm55zhk6gw@zhen-hp.sh.intel.com
6 years agoMerge airlied/drm-next into drm-misc-next
Sean Paul [Wed, 21 Mar 2018 13:40:55 +0000 (09:40 -0400)]
Merge airlied/drm-next into drm-misc-next

Refresh -misc-next

Signed-off-by: Sean Paul <seanpaul@chromium.org>
6 years agodrm/qxl: Replace drm_gem_object_reference/unreference() with _get/put()
Santha Meena Ramamoorthy [Tue, 20 Mar 2018 18:29:27 +0000 (11:29 -0700)]
drm/qxl: Replace drm_gem_object_reference/unreference() with _get/put()

Replace drm_gem_object_reference/unreference function with *_get/put()
suffixes, because it is shorter and consistent with the kernel
kref_get/put() functions. The following Coccinelle script was used:

@@
expression e;
@@

(
-drm_gem_object_reference(e);
+drm_gem_object_get(e);
|
-drm_gem_object_unreference(e);
+drm_gem_object_put(e);
|
-drm_gem_object_unreference_unlocked(e);
+drm_gem_object_put_unlocked(e);
)

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1521570567-22519-1-git-send-email-santhameena13@gmail.com
6 years agodrm/amd/pp: Fix unable to handle kernel paging request
Rex Zhu [Wed, 21 Mar 2018 03:04:21 +0000 (11:04 +0800)]
drm/amd/pp: Fix unable to handle kernel paging request
when set pp table

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix gfx ring test failed on Fiji without hw avfs support
Rex Zhu [Tue, 20 Mar 2018 09:04:46 +0000 (17:04 +0800)]
drm/amd/pp: Fix gfx ring test failed on Fiji without hw avfs support

caused by
'commit ca82cec868d1 ("drm/amd/pp: Simplified the avfs btc state on smu7")'

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix kernel NULL pointer dereference in dpm functions
Rex Zhu [Tue, 20 Mar 2018 08:32:07 +0000 (16:32 +0800)]
drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions

caused by
'commit 83e3c4615872 ("drm/amdgpu: Remove wrapper layer of smu ip functions")'

BUG: unable to handle kernel NULL pointer dereference at 00000000000005d8
[  313.241459] IP: ci_dpm_read_sensor+0x37/0xf0 [amdgpu]

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix kernel NULL pointer dereference when amdgpu fini
Rex Zhu [Tue, 20 Mar 2018 08:28:56 +0000 (16:28 +0800)]
drm/amdgpu: Fix kernel NULL pointer dereference when amdgpu fini

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu - Disable all irqs before disabling all CRTCs
Mikita Lipski [Thu, 15 Mar 2018 20:53:08 +0000 (16:53 -0400)]
drm/amdgpu - Disable all irqs before disabling all CRTCs

By moving amdgpu_irq_disable_all earlier in the sequence
fixes an issue with disabling pflip interrupts:

*ERROR* dal_irq_service_dummy_ack: called for non-implemented irq source

Earlier patch fixed a memory corruption and revealed irq
warnings.This way it seems to be there no obvious issues
with unloading the module.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Disable irq on device before destroying it
Mikita Lipski [Thu, 15 Mar 2018 13:37:08 +0000 (09:37 -0400)]
drm/amdgpu: Disable irq on device before destroying it

Disable irq on devices before destroying them. That prevents
use-after-free memory access when unloading the driver.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Use atomic function to disable crtcs with dc enabled
Mikita Lipski [Wed, 14 Mar 2018 17:41:29 +0000 (13:41 -0400)]
drm/amdgpu: Use atomic function to disable crtcs with dc enabled

This change fixes the deadlock when unloading the driver with displays
connected.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/amdgpu: fix offset into page with amdgpu_iomem debugfs file
Tom St Denis [Tue, 20 Mar 2018 13:13:08 +0000 (09:13 -0400)]
drm/amd/amdgpu: fix offset into page with amdgpu_iomem debugfs file

The offset inside the page wasn't included in the copy call meaning
the start of the page was being read/written instead.

Reported-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/nbio6: Correct PCIE_INDEX/DATA pair used for smn register accessing
Hawking Zhang [Mon, 19 Mar 2018 09:28:28 +0000 (17:28 +0800)]
drm/amdgpu/nbio6: Correct PCIE_INDEX/DATA pair used for smn register accessing

PCIE_INDEX2/DATA2 pair will be used for smn register accessing since from vega.
PCIE_INDEX/DATA pair should be reserved for smu

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>