openwrt/staging/blogic.git
6 years agodrm/amdkfd: Add ioctls for GPUVM memory management
Felix Kuehling [Thu, 15 Mar 2018 21:27:51 +0000 (17:27 -0400)]
drm/amdkfd: Add ioctls for GPUVM memory management

v2:
* Fix error handling after kfd_bind_process_to_device in
  kfd_ioctl_map_memory_to_gpu
v3:
* Add ioctl to acquire VM from a DRM FD
v4:
* Return number of successful map/unmap operations in failure cases
* Facilitate partial retry after failed map/unmap
* Added comments with parameter descriptions to new APIs
* Defined AMDKFD_IOC_FREE_MEMORY_OF_GPU write-only

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add TC flush on VMID deallocation for Hawaii
Felix Kuehling [Thu, 15 Mar 2018 21:27:50 +0000 (17:27 -0400)]
drm/amdkfd: Add TC flush on VMID deallocation for Hawaii

On GFX7 the CP does not perform a TC flush when queues are unmapped.
To avoid TC eviction from accessing an invalid VMID, flush it
explicitly before releasing a VMID.

v2: Fix unnecessary list_for_each_entry_safe
v3: Moved allocation to kfd_process_device_init_vm

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Allocate CWSR trap handler memory for dGPUs
Felix Kuehling [Thu, 15 Mar 2018 21:27:49 +0000 (17:27 -0400)]
drm/amdkfd: Allocate CWSR trap handler memory for dGPUs

Add helpers for allocating GPUVM memory in kernel mode and use them
to allocate memory for the CWSR trap handler.

v2: Use dev instead of pdd->dev in kfd_process_free_gpuvm
v3:
* Cleaned up and simplified kfd_process_alloc_gpuvm
* Moved allocation for dGPU to kfd_process_device_init_vm

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add per-process IDR for buffer handles
Felix Kuehling [Thu, 15 Mar 2018 21:27:48 +0000 (17:27 -0400)]
drm/amdkfd: Add per-process IDR for buffer handles

Also used for cleaning up on process termination.

v2: Refactored cleanup on process termination

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Aperture setup for dGPUs
Felix Kuehling [Thu, 15 Mar 2018 21:27:47 +0000 (17:27 -0400)]
drm/amdkfd: Aperture setup for dGPUs

Set up the GPUVM aperture for SVM (shared virtual memory) that allows
sharing a part of virtual address space between GPUs and CPUs.

Report the size of the GPUVM aperture that is supported by KGD accurately.

The low part of the GPUVM aperture is reserved for kernel use. This is
for kernel-allocated buffers that are only accessed on the GPU:
- CWSR trap handler
- IB for submitting commands in user-mode context from kernel mode

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Remove limit on number of GPUs
Felix Kuehling [Thu, 15 Mar 2018 21:27:46 +0000 (17:27 -0400)]
drm/amdkfd: Remove limit on number of GPUs

Currently the number of GPUs is limited by aperture placement options
available on GFX7 and GFX8 hardware. This limitation is not necessary.
Scratch and LDS represent per-work-item and per-work-group storage
respectively. Different work-items and work-groups use the same virtual
address to access their own data. Work running on different GPUs is by
definition in different work-groups (different dispatches, in fact).
That means the same virtual addresses can be used for these apertures
on different GPUs.

Add a new AMDKFD_IOC_GET_PROCESS_APERTURES_NEW ioctl that removes the
artificial limitation on the number of GPUs that can be supported. The
new ioctl allows user mode to query the number of GPUs to allocate
enough memory for all GPUs to be reported.

This deprecates AMDKFD_IOC_GET_PROCESS_APERTURES.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Populate DRM render device minor
Oak Zeng [Thu, 15 Mar 2018 21:27:45 +0000 (17:27 -0400)]
drm/amdkfd: Populate DRM render device minor

Populate DRM render device minor in kfd topology

Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Create KFD VMs on demand
Felix Kuehling [Thu, 15 Mar 2018 21:27:44 +0000 (17:27 -0400)]
drm/amdkfd: Create KFD VMs on demand

Instead of creating all VMs on process creation, create them when
a process is bound to a device. This will later allow registering
an existing VM from a DRM render node FD at runtime, before the
process is bound to the device. This way the render node VM can be
used for KFD instead of creating our own redundant VM.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Add kfd2kgd interface to acquire an existing VM
Felix Kuehling [Thu, 15 Mar 2018 21:27:43 +0000 (17:27 -0400)]
drm/amdgpu: Add kfd2kgd interface to acquire an existing VM

This allows acquiring an existing VM from a render node FD to use it
for a compute process.

Such VMs get destroyed when the original file descriptor is released.
Added a callback from amdgpu_vm_fini to handle KFD VM destruction
correctly in this case.

v2:
* Removed vm->vm_context check in amdgpu_amdkfd_gpuvm_destroy_cb,
  check vm->process_info earlier instead

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Add helper to turn an existing VM into a compute VM
Felix Kuehling [Thu, 15 Mar 2018 21:27:42 +0000 (17:27 -0400)]
drm/amdgpu: Add helper to turn an existing VM into a compute VM

v2: Removed updating and checking of vm->vm_context
v3: Enable amdgpu_vm_clear_bo in amdgpu_vm_make_compute

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Fix initial validation of PD BO for KFD VMs
Felix Kuehling [Thu, 15 Mar 2018 21:27:41 +0000 (17:27 -0400)]
drm/amdgpu: Fix initial validation of PD BO for KFD VMs

Make sure the PD BO is valid and attach the eviction fence during VM
creation. This ensures that the pd_phys_address is actually valid
and an eviction that would invalidate it triggers a KFD process
eviction like it should.

v2: Use uninterruptible waiting in initial PD validation

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Move KFD-specific fields into struct amdgpu_vm
Felix Kuehling [Thu, 15 Mar 2018 21:27:40 +0000 (17:27 -0400)]
drm/amdgpu: Move KFD-specific fields into struct amdgpu_vm

Remove struct amdkfd_vm and move the fields into struct amdgpu_vm.
This will allow turning a VM created by a DRM render node into a
KFD VM.

v2: Removed vm_context field

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: fix uninitialized variable use
Arnd Bergmann [Thu, 15 Mar 2018 16:49:40 +0000 (17:49 +0100)]
drm/amdkfd: fix uninitialized variable use

When CONFIG_ACPI is disabled, we never initialize the acpi_table
structure in kfd_create_crat_image_virtual:

drivers/gpu/drm/amd/amdkfd/kfd_crat.c: In function 'kfd_create_crat_image_virtual':
drivers/gpu/drm/amd/amdkfd/kfd_crat.c:888:40: error: 'acpi_table' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The undefined behavior also happens for any other acpi_get_table()
failure, but then the compiler can't warn about it.

This adds an error check that prevents the structure from
being used in error, avoiding both the undefined behavior and
the warning about it.

Fixes: 520b8fb755cc ("drm/amdkfd: Add topology support for CPUs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: add missing include of mm.h
Oded Gabbay [Thu, 15 Mar 2018 08:08:35 +0000 (10:08 +0200)]
drm/amdkfd: add missing include of mm.h

This patch fixes kernel build in ARCH=frv

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.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>