OSDN Git Service

tomoyo/tomoyo-test1.git
6 years agodrm/amdgpu: Add support for reporting VRAM usage
Kent Russell [Sat, 9 Dec 2017 04:09:05 +0000 (23:09 -0500)]
drm/amdgpu: Add support for reporting VRAM usage

Add functions to report the vram_usage from the amdgpu_device

Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Ignore ACPI CRAT for non-APU systems
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:09:04 +0000 (23:09 -0500)]
drm/amdkfd: Ignore ACPI CRAT for non-APU systems

Some AMD motherboards without an APU have a broken CRAT table which
causes KFD initialization failures or incorrect information about
NUMA nodes, CPU cores or system memory. Ignore CRAT tables without
GPUs and rely on KFD's code to create a CRAT table for the CPU.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Module option to disable CRAT table
Felix Kuehling [Sat, 9 Dec 2017 04:09:03 +0000 (23:09 -0500)]
drm/amdkfd: Module option to disable CRAT table

Some systems have broken CRAT tables. Add a module option to ignore
a CRAT table.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add AQL Queue Memory flag on topology
Ben Goz [Sat, 9 Dec 2017 04:09:02 +0000 (23:09 -0500)]
drm/amdkfd: Add AQL Queue Memory flag on topology

This is needed for enabling a user-mode workaround for an AQL queue
wrapping HW bug on Tonga.

Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Fixup incorrect info in the CZ CRAT table
Philip Cox [Sat, 9 Dec 2017 04:09:01 +0000 (23:09 -0500)]
drm/amdkfd: Fixup incorrect info in the CZ CRAT table

* Wrong value for max_waves_per_simd
* Missing ATC capability bit

Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add perf counters to topology
Amber Lin [Sat, 9 Dec 2017 04:09:00 +0000 (23:09 -0500)]
drm/amdkfd: Add perf counters to topology

For hardware blocks whose performance counters are accessed via MMIO
registers, KFD provides the support for those privileged blocks.

IOMMU is one of those privileged blocks. Most performance counter properties
required by Thunk are available at /sys/bus/event_source/devices/amd_iommu.

This patch adds properties to topology in KFD sysfs for information not
available in /sys/bus/event_source/devices/amd_iommu. They are shown at
/sys/devices/virtual/kfd/kfd/topology/nodes/0/perf/iommu/ formatted as
/sys/devices/virtual/kfd/kfd/topology/nodes/0/perf/<block>/<property>, i.e.
/sys/devices/virtual/kfd/kfd/topology/nodes/0/perf/iommu/max_concurrent.

For dGPUs, who don't have IOMMU, nothing appears under
/sys/devices/virtual/kfd/kfd/topology/nodes/0/perf.

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add topology support for dGPUs
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:59 +0000 (23:08 -0500)]
drm/amdkfd: Add topology support for dGPUs

Generate and parse VCRAT tables for dGPUs in kfd_topology_add_device.

Some information that isn't available in the CRAT table is patched
into the topology after parsing.

HSA_CAP_DOORBELL_TYPE_1_0 is dependent on the ASIC feature
CP_HQD_PQ_CONTROL.SLOT_BASED_WPTR, which was not introduced in VI
until Carrizo. Report HSA_CAP_DOORBELL_TYPE_PRE_1_0 on Tonga ASICs.

v2: Added #include <linux/pci.h> to kfd_crat.c to make it compile

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add topology support for CPUs
Felix Kuehling [Sat, 9 Dec 2017 04:08:58 +0000 (23:08 -0500)]
drm/amdkfd: Add topology support for CPUs

Currently, the KFD topology information is generated by parsing the CRAT
(ACPI) table. However, at present CRAT table is available only for AMD
APUs. To support CPUs on systems without a CRAT table, the KFD driver will
create a Virtual CRAT (VCRAT) table and then the existing code will parse
that table to generate topology.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Fix sibling_map[] size
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:57 +0000 (23:08 -0500)]
drm/amdkfd: Fix sibling_map[] size

Change kfd_cache_properties.sibling_map[256] to
kfd_cache_properties.sibling_map[32]. Since, CRAT uses bitmap for
sibling_map, it is more efficient to use bitmap in the kfd structure
also.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Simplify counting of memory banks
Felix Kuehling [Sat, 9 Dec 2017 04:08:56 +0000 (23:08 -0500)]
drm/amdkfd: Simplify counting of memory banks

Only count memory banks in one place. Ignore redundant num_banks
entry in crat_subtype_computeunit.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Turn verbose topology messages into pr_debug
Felix Kuehling [Sat, 9 Dec 2017 04:08:55 +0000 (23:08 -0500)]
drm/amdkfd: Turn verbose topology messages into pr_debug

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: sync IOLINK defines to thunk spec
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:54 +0000 (23:08 -0500)]
drm/amdkfd: sync IOLINK defines to thunk spec

Current thunk spec v1.07 dated Feb 1, 2016

v2: fix indentation

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Support enumerating non-GPU devices
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:53 +0000 (23:08 -0500)]
drm/amdkfd: Support enumerating non-GPU devices

Modify kfd_topology_enum_kfd_devices(..) function to support non-GPU
nodes. The function returned NULL when it encountered non-GPU (say CPU)
nodes. This caused kfd_ioctl_create_event and kfd_init_apertures to fail
for Intel + Tonga.

kfd_topology_enum_kfd_devices will now parse all the nodes and return
valid kfd_dev for nodes with GPU.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Decouple CRAT parsing from device list update
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:52 +0000 (23:08 -0500)]
drm/amdkfd: Decouple CRAT parsing from device list update

Currently, CRAT parsing is intertwined with topology_device_list and
hence repeated calls to kfd_parse_crat_table() will fail. Decouple
kfd_parse_crat_table() and topology_device_list.

kfd_parse_crat_table() will parse CRAT and add topology devices to a
temporary list temp_topology_device_list and then
kfd_topology_update_device_list will move contents from temporary list to
master list.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Reorganize CRAT fetching from ACPI
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:51 +0000 (23:08 -0500)]
drm/amdkfd: Reorganize CRAT fetching from ACPI

Reorganize and rename kfd_topology_get_crat_acpi function. In this way
acpi_get_table(..) needs to be called only once. This will also aid in
dGPU topology implementation.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Group up CRAT related functions
Felix Kuehling [Sat, 9 Dec 2017 04:08:49 +0000 (23:08 -0500)]
drm/amdkfd: Group up CRAT related functions

Take CRAT related functions out of kfd_topology.c and place them in
kfd_crat.c. This is the initial step of supporting more CRAT features,
i.e. creating virtual CRAT table for KFD devices without CRAT.

v2: Minor cleanup that was missed previously because code moved around

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Fix memory leaks in kfd topology
Yong Zhao [Sat, 9 Dec 2017 04:08:48 +0000 (23:08 -0500)]
drm/amdkfd: Fix memory leaks in kfd topology

Kobject created using kobject_create_and_add() can be freed using
kobject_put() when there is no referenece any more. However,
kobject memory allocated with kzalloc() has to set up a release
callback in order to free it when the counter decreases to 0.
Otherwise it causes memory leak.

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Topology: Fix location_id
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:47 +0000 (23:08 -0500)]
drm/amdkfd: Topology: Fix location_id

Fix location_id format to match Thunk specification.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Update number of compute unit from KGD
Flora Cui [Sat, 9 Dec 2017 04:08:46 +0000 (23:08 -0500)]
drm/amdkfd: Update number of compute unit from KGD

Overwrite the active simd_count from KGD at driver loading time. This is
based on assumption that register GC_USER_SHADER_ARRAY_CONFIG won’t get
changed.

V2: remove the incorrect simd_count reported at loading module.

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed by: Yair Shachar< yair.shachar@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amd: Remove get_vmem_size from KGD-KFD interface
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:45 +0000 (23:08 -0500)]
drm/amd: Remove get_vmem_size from KGD-KFD interface

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Remove deprecated get_vmem_size
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:44 +0000 (23:08 -0500)]
drm/amdkfd: Remove deprecated get_vmem_size

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Stop using get_vmem_size KGD-KFD interface
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:43 +0000 (23:08 -0500)]
drm/amdkfd: Stop using get_vmem_size KGD-KFD interface

get_vmem_size() is deprecated. Instead use get_local_mem_info().

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Implement get_local_mem_info
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:42 +0000 (23:08 -0500)]
drm/amdgpu: Implement get_local_mem_info

Implement new kgd-kfd interface function get_local_mem_info.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amd: Add get_local_mem_info to KGD-KFD interface
Harish Kasiviswanathan [Sat, 9 Dec 2017 04:08:41 +0000 (23:08 -0500)]
drm/amd: Add get_local_mem_info to KGD-KFD interface

Add get_local_mem_info which provides more information about local
memory than get_vmem_size:
- public and private framebuffer size
- memory clock

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: add amdgpu interface to query cu info
Flora Cui [Sat, 9 Dec 2017 04:08:40 +0000 (23:08 -0500)]
drm/amdgpu: add amdgpu interface to query cu info

Signed-off-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amd: add new interface to query cu info
Flora Cui [Sat, 9 Dec 2017 04:08:39 +0000 (23:08 -0500)]
drm/amd: add new interface to query cu info

Signed-off-by: Flora Cui <flora.cui@amd.com>
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Simplify locking during process creation
Yong Zhao [Mon, 27 Nov 2017 23:29:56 +0000 (18:29 -0500)]
drm/amdkfd: Simplify locking during process creation

Also fixes error handling if kfd_process_init_cwsr fails.

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Factor PDD destruction out of kfd_process_wq_release
Felix Kuehling [Mon, 27 Nov 2017 23:29:55 +0000 (18:29 -0500)]
drm/amdkfd: Factor PDD destruction out of kfd_process_wq_release

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Reduce nesting in kfd_create_process_device_data
Felix Kuehling [Mon, 27 Nov 2017 23:29:54 +0000 (18:29 -0500)]
drm/amdkfd: Reduce nesting in kfd_create_process_device_data

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Return NULL if kfd_lookup_process_by_pasid fails
Yong Zhao [Mon, 27 Nov 2017 23:29:53 +0000 (18:29 -0500)]
drm/amdkfd: Return NULL if kfd_lookup_process_by_pasid fails

If no matching process is found, return NULL instead of a pointer
to the last process in the kfd_processes_table.

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Use ref count to prevent kfd_process destruction
Felix Kuehling [Mon, 27 Nov 2017 23:29:52 +0000 (18:29 -0500)]
drm/amdkfd: Use ref count to prevent kfd_process destruction

Use a reference counter instead of a lock to prevent process
destruction while functions running out of process context are using
the kfd_process structure. In many cases these functions don't need
the structure to be locked. In the few cases that really do need the
process lock, take it explicitly.

This helps simplify lock dependencies between the process lock and
other locks, particularly amdgpu and mm_struct locks. This will be
important when amdgpu calls back to amdkfd for memory evictions.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Make kfd_process reference counted
Felix Kuehling [Mon, 27 Nov 2017 23:29:51 +0000 (18:29 -0500)]
drm/amdkfd: Make kfd_process reference counted

This will be used to elliminate the use of the process lock for
preventing concurrent process destruction. This will simplify lock
dependencies between KFD and KGD.

This also simplifies the process destruction in a few ways:
* Don't allocate work struct dynamically
* Remove unnecessary hack that increments mm reference counter
* Remove unnecessary process locking during destruction

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Get reference to lead_thread task struct
Felix Kuehling [Mon, 27 Nov 2017 23:29:50 +0000 (18:29 -0500)]
drm/amdkfd: Get reference to lead_thread task struct

Increment the kfd_process.lead_thread's reference counter to make
it safe to dereference. This is needed for getting a safe reference
to the process' mm_struct.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add debugfs support to KFD
Felix Kuehling [Mon, 27 Nov 2017 23:29:49 +0000 (18:29 -0500)]
drm/amdkfd: Add debugfs support to KFD

This commit adds several debugfs entries for kfd:

kfd/hqds: dumps all HQDs on all GPUs for KFD-controlled compute and
    SDMA RLC queues

kfd/mqds: dumps all MQDs of all KFD processes on all GPUs

kfd/rls: dumps HWS runlists on all GPUs

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Add kfd2kgd APIs for dumping HQDs
Felix Kuehling [Mon, 27 Nov 2017 23:29:48 +0000 (18:29 -0500)]
drm/amdgpu: Add kfd2kgd APIs for dumping HQDs

This can be used by KFD for debugging features, such as dumping
HQDs in debugfs.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Fix definition of KFD_CIK_SDMA_QUEUE_OFFSET
Felix Kuehling [Mon, 27 Nov 2017 23:29:47 +0000 (18:29 -0500)]
drm/amdgpu: Fix definition of KFD_CIK_SDMA_QUEUE_OFFSET

This counts the queue offset in register index, not register address.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Fix oversubscription accounting
Felix Kuehling [Mon, 27 Nov 2017 23:29:46 +0000 (18:29 -0500)]
drm/amdkfd: Fix oversubscription accounting

Don't count SDMA queues towards compute HQD oversubscription when
deciding whether to create a chained runlist.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: map multiple processes to HW scheduler
Felix Kuehling [Mon, 27 Nov 2017 23:29:45 +0000 (18:29 -0500)]
drm/amdkfd: map multiple processes to HW scheduler

Allow HWS to to execute multiple processes on the hardware
concurrently. The number of concurrent processes is limited by
the number of VMIDs allocated to the HWS.

A module parameter can be used for limiting this further or turn
it off altogether (mainly for debugging purposes).

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Fix printing pointer cast
Kent Russell [Mon, 4 Dec 2017 11:50:17 +0000 (06:50 -0500)]
drm/amdkfd: Fix printing pointer cast

Just print a pointer instead of casting

v2: Remove the 0x prefix, since %p prints that automatically, and remove
it from one other spot as well

Signed-off-by: Kent Russell <kent.russell@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add crash protection in debugger register path
Philip Yang [Mon, 27 Nov 2017 23:29:44 +0000 (18:29 -0500)]
drm/amdkfd: Add crash protection in debugger register path

After debugger is registered, the pqm_destroy_queue fails because is_debug
is true, the queue should not be removed from process_queue_list since
the count is not reduced.

Test application calls debugger unregister without register debugger, add
null pointer check protection to avoid crash for this case

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: fix get_max_engine_clock_in_mhz
Felix Kuehling [Mon, 27 Nov 2017 23:29:43 +0000 (18:29 -0500)]
drm/amdgpu: fix get_max_engine_clock_in_mhz

Use proper powerplay function. This fixes OpenCL initialization
problems.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Delete a useless parameter from create_queue function pointer
Yong Zhao [Fri, 24 Nov 2017 23:10:54 +0000 (18:10 -0500)]
drm/amdkfd: Delete a useless parameter from create_queue function pointer

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add support for user-mode trap handlers
Felix Kuehling [Tue, 14 Nov 2017 21:41:20 +0000 (16:41 -0500)]
drm/amdkfd: Add support for user-mode trap handlers

A second-level user mode trap handler can be installed. The CWSR trap
handler jumps to the secondary trap handler conditionally for any
conditions not handled by it. This can be used e.g. for debugging or
catching math exceptions.

When CWSR is disabled, the user mode trap handler is installed as
first level trap handler.

Signed-off-by: Shaoyun.liu <shaoyun.liu@amd.com>
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add CWSR support
Felix Kuehling [Tue, 14 Nov 2017 21:41:19 +0000 (16:41 -0500)]
drm/amdkfd: Add CWSR support

This hardware feature allows the GPU to preempt shader execution in
the middle of a compute wave, save the state and restore it later
to resume execution.

Memory for saving the state is allocated per queue in user mode and
the address and size passed to the create_queue ioctl. The size
depends on the number of waves that can be in flight simultaneously
on a given ASIC.

Signed-off-by: Shaoyun.liu <shaoyun.liu@amd.com>
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add trap handler for CWSR
Felix Kuehling [Tue, 14 Nov 2017 21:41:18 +0000 (16:41 -0500)]
drm/amdkfd: Add trap handler for CWSR

The trap handler is like an interrupt handler running on the GPU
compute unit. It is needed for supporting CWSR (compute wave
save/restore).

This file defines an array with the pre-compiled GFXv8 shader ISA.
The assembly code is included for reference in #if 0 ... #endif.

Signed-off-by: Shaoyun.liu <shaoyun.liu@amd.com>
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Cleanup qpd.pqm initialization
Felix Kuehling [Tue, 14 Nov 2017 21:41:17 +0000 (16:41 -0500)]
drm/amdkfd: Cleanup qpd.pqm initialization

The PQM doesn't change after process creation. So initialize it in
kfd_create_process_device_data.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Use order_base_2 to get log2 of buffes sizes
Felix Kuehling [Mon, 6 Nov 2017 19:52:28 +0000 (14:52 -0500)]
drm/amdkfd: Use order_base_2 to get log2 of buffes sizes

Replace (ffs(size) - 1) with order_base_2(size) as a more straight
forward way to get log2 of buffer sizes.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Hardware DWORD size is 4 bytes
Felix Kuehling [Mon, 6 Nov 2017 19:52:27 +0000 (14:52 -0500)]
drm/amdkfd: Hardware DWORD size is 4 bytes

Don't use sizeof(uint32_t) or similar types for hardware or firmware
DWORD size. The hardware and firmware don't care about Linux types.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Implement amdkfd SDMA functions for VI
Philip Cox [Wed, 1 Nov 2017 23:22:02 +0000 (19:22 -0400)]
drm/amdkfd: Implement amdkfd SDMA functions for VI

Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Signed-off-by: shaoyun liu <shaoyun.liu@amd.com>
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Use ASIC-specific SDMA MQD type
Felix Kuehling [Wed, 1 Nov 2017 23:22:01 +0000 (19:22 -0400)]
drm/amdkfd: Use ASIC-specific SDMA MQD type

Signed-off-by: shaoyun liu <shaoyun.liu@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Implement amdgpu SDMA functions for VI
Philip Cox [Wed, 1 Nov 2017 23:22:00 +0000 (19:22 -0400)]
drm/amdgpu: Implement amdgpu SDMA functions for VI

Signed-off-by: Philip Cox <Philip.Cox@amd.com>
Signed-off-by: shaoyun liu <shaoyun.liu@amd.com>
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Add support for resuming SDMA queues w/o HWS
Felix Kuehling [Wed, 1 Nov 2017 23:21:59 +0000 (19:21 -0400)]
drm/amdgpu: Add support for resuming SDMA queues w/o HWS

Save wptr in hqd_sdma_destroy, restore it in hqd_sdma_load. Also
read updated wptr from user mode when resuming an SDMA queue.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amd: Update kgd_kfd interface for resuming SDMA queues
Felix Kuehling [Wed, 1 Nov 2017 23:21:58 +0000 (19:21 -0400)]
drm/amd: Update kgd_kfd interface for resuming SDMA queues

Add wptr and mm parameters to hqd_sdma_load and pass these parameters
from device_queue_manager through the mqd_manager.

SDMA doesn't support polling while the engine believes it's idle. The
driver must update the wptr. The new parameters will be used for looking
up the updated value from the specified mm when SDMA queues are resumed
after being disabled.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agoMerge branch 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 21 Dec 2017 01:17:45 +0000 (11:17 +1000)]
Merge branch 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux into drm-next

* 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux: (171 commits)
  drm/amdgpu: fix test for shadow page tables
  drm/amd/display: Expose dpp1_set_cursor_attributes
  drm/amd/display: Update FMT and OPPBUF functions
  drm/amd/display: check for null before calling is_blanked
  drm/amd/display: dal 3.1.27
  drm/amd/display: Fix unused variable warnings.
  drm/amd/display: Only blank DCN when we have set_blank implementation
  drm/amd/display: Put dcn_mi_registers with other structs
  drm/amd/display: hubp refactor
  drm/amd/display: integrating optc pseudocode
  drm/amd/display: Call validate_fbc should_enable_fbc
  drm/amd/display: Clean up DCN cursor code
  drm/amd/display: fix 180 full screen pipe split
  drm/amd/display: reprogram surface config on scaling change
  drm/amd/display: Remove dwbc from pipe_ctx
  drm/amd/display: Use the maximum link setting which EDP reported.
  drm/amd/display: Add hdr_supported flag
  drm/amd/display: fix global sync param retrieval when not pipe splitting
  drm/amd/display: Update HUBP
  drm/amd/display: fix rotated surface scaling
  ...

6 years agoMerge tag 'omapdrm-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux...
Dave Airlie [Thu, 21 Dec 2017 01:10:35 +0000 (11:10 +1000)]
Merge tag 'omapdrm-4.16' of git://git./linux/kernel/git/tomba/linux into drm-next

omapdrm changes for v4.16

* support memory bandwidth limits
* DSI command mode panel cleanups for N9
* DMM error handling

* tag 'omapdrm-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (27 commits)
  drm: omapdrm: Simplify platform registration
  drm: omapdrm: Remove filename from header and fix copyright tag
  drm/omap: DMM: Check for DMM readiness after successful transaction commit
  drm/omap: DMM: Print information if we received an error interrupt
  drm/omap: DMM: In case of error/timeout in wait_status() print the reason
  drm/omap: DMM: Fix DMM_IRQSTAT_ERR_MASK definition
  drm: omapdrm: Deconstruct the omap_drv.h header.
  drm: omapdrm: venc: Return error code on OF parsing failure
  drm: omapdrm: dpi: Remove dpi_data port_initialized field
  drm: omapdrm: dss: Make dss_dump_clocks() function static
  drm: omapdrm: dss: Set the DMA coherent mask
  drm: omapdrm: Remove unused omap_dss_find_device() function
  drm: omapdrm: Pass drm_device to omap_gem_resume()
  drm: omapdrm: dpi: Don't treat GPIO probe deferral as an error
  drm/omap: panel-dsi-cm: switch to gpiod
  drm/omap: panel-dsi-cm: add external backlight support
  drm/omap: panel-dsi-cm: add physical size support
  drm/omap: panel-dsi-cm: add regulator support
  drm/omap: panel-dsi-cm: fix driver
  drm/omap: add support for physical size hints from display drivers
  ...

6 years agoMerge tag 'tilcdc-4.16' of https://github.com/jsarha/linux into drm-next
Dave Airlie [Thu, 21 Dec 2017 01:10:20 +0000 (11:10 +1000)]
Merge tag 'tilcdc-4.16' of https://github.com/jsarha/linux into drm-next

drm/tilcdc changes for 4.16

* tag 'tilcdc-4.16' of https://github.com/jsarha/linux:
  drm/tilcdc: make tilcdc_mode_hvtotal() static
  drm/tilcdc: Remove drm_framebuffer_get() and *_put() calls
  drm/tilcdc: ensure nonatomic iowrite64 is not used

6 years agoMerge tag 'drm-intel-next-2017-12-14' of git://anongit.freedesktop.org/drm/drm-intel...
Dave Airlie [Thu, 21 Dec 2017 01:08:30 +0000 (11:08 +1000)]
Merge tag 'drm-intel-next-2017-12-14' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

- Fix documentation build issues (Randy, Markus)
- Fix timestamp frequency calculation for perf on CNL (Lionel)
- New DMC firmware for Skylake (Anusha)
- GTT flush fixes and other GGTT write track and refactors (Chris)
- Taint kernel when GPU reset fails (Chris)
- Display workarounds organization (Lucas)
- GuC and HuC initialization clean-up and fixes (Michal)
- Other fixes around GuC submission (Michal)
- Execlist clean-ups like caching ELSP reg offset and improving log readability (Chri\
s)
- Many other improvements on our logs and dumps (Chris)
- Restore GT performance in headless mode with DMC loaded (Tvrtko)
- Stop updating legacy fb parameters since FBC is not using anymore (Daniel)
- More selftest improvements (Chris)
- Preemption fixes and improvements (Chris)
- x86/early-quirks improvements for Intel graphics stolen memory. (Joonas, Matthew)
- Other improvements on Stolen Memory code to be resource centric. (Matthew)
- Improvements and fixes on fence allocation/release (Chris).

GVT:

- fixes for two coverity scan errors (Colin)
- mmio switch code refine (Changbin)
- more virtual display dmabuf fixes (Tina/Gustavo)
- misc cleanups (Pei)
- VFIO mdev display dmabuf interface and gvt support (Tina)
- VFIO mdev opregion support/fixes (Tina/Xiong/Chris)
- workload scheduling optimization (Changbin)
- preemption fix and temporal workaround (Zhenyu)
- and misc fixes after refactor (Chris)

* tag 'drm-intel-next-2017-12-14' of git://anongit.freedesktop.org/drm/drm-intel: (87 commits)
  drm/i915: Update DRIVER_DATE to 20171214
  drm/i915: properly init lockdep class
  drm/i915: Show engine state when hangcheck detects a stall
  drm/i915: make CS frequency read support missing more obvious
  drm/i915/guc: Extract doorbell verification into a function
  drm/i915/guc: Extract clients allocation to submission_init
  drm/i915/guc: Extract doorbell creation from client allocation
  drm/i915/guc: Call invalidate after changing the vfunc
  drm/i915/guc: Extract guc_init from guc_init_hw
  drm/i915/guc: Move GuC workqueue allocations outside of the mutex
  drm/i915/guc: Move shared data allocation away from submission path
  drm/i915: Unwind i915_gem_init() failure
  drm/i915: Ratelimit request allocation under oom
  drm/i915: Allow fence allocations to fail
  drm/i915: Mark up potential allocation paths within i915_sw_fence as might_sleep
  drm/i915: Don't check #active_requests from i915_gem_wait_for_idle()
  drm/i915/fence: Use rcu to defer freeing of irq_work
  drm/i915: Dump the engine state before declaring wedged from wait_for_engines()
  drm/i915: Bump timeout for wait_for_engines()
  drm/i915: Downgrade misleading "Memory usable" message
  ...

6 years agodrm/amdgpu: fix test for shadow page tables
Christian König [Wed, 20 Dec 2017 13:21:25 +0000 (14:21 +0100)]
drm/amdgpu: fix test for shadow page tables

They don't work 100% correctly at the moment.

Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Expose dpp1_set_cursor_attributes
Yue Hin Lau [Fri, 24 Nov 2017 21:35:52 +0000 (16:35 -0500)]
drm/amd/display: Expose dpp1_set_cursor_attributes

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Update FMT and OPPBUF functions
Eric Bernstein [Tue, 12 Dec 2017 19:14:10 +0000 (14:14 -0500)]
drm/amd/display: Update FMT and OPPBUF functions

Updates to FMT and OPPBUF programming from HW team
pseudocode review.

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: check for null before calling is_blanked
Yue Hin Lau [Tue, 12 Dec 2017 19:34:30 +0000 (14:34 -0500)]
drm/amd/display: check for null before calling is_blanked

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: dal 3.1.27
Andrew Jiang [Tue, 12 Dec 2017 17:34:47 +0000 (12:34 -0500)]
drm/amd/display: dal 3.1.27

Signed-off-by: Andrew Jiang <Andrew.Jiang@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix unused variable warnings.
Leo (Sunpeng) Li [Tue, 12 Dec 2017 15:48:50 +0000 (10:48 -0500)]
drm/amd/display: Fix unused variable warnings.

... since linux kernel compile treats warnings as errors.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Only blank DCN when we have set_blank implementation
Yue Hin Lau [Mon, 4 Dec 2017 21:58:11 +0000 (16:58 -0500)]
drm/amd/display: Only blank DCN when we have set_blank implementation

Also rename timing_generator to optc

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Put dcn_mi_registers with other structs
Eric Bernstein [Thu, 7 Dec 2017 20:49:43 +0000 (15:49 -0500)]
drm/amd/display: Put dcn_mi_registers with other structs

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: hubp refactor
Yue Hin Lau [Fri, 8 Dec 2017 20:57:44 +0000 (15:57 -0500)]
drm/amd/display: hubp refactor

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: integrating optc pseudocode
Yue Hin Lau [Thu, 7 Dec 2017 19:43:24 +0000 (14:43 -0500)]
drm/amd/display: integrating optc pseudocode

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Call validate_fbc should_enable_fbc
Harry Wentland [Fri, 1 Dec 2017 14:49:46 +0000 (09:49 -0500)]
drm/amd/display: Call validate_fbc should_enable_fbc

validate_fbc never fails a modeset. It's simply used to decide whether
to use FBC or not. Calling it validate_fbc might be confusing to some so
rename it to should_enable_fbc.

With that let's also remove the DC_STATUS return code and return bool
and make enable_fbc a void function since we never check it's return
value and probably never want to anyways.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Clean up DCN cursor code
Eric Bernstein [Tue, 5 Dec 2017 21:48:30 +0000 (16:48 -0500)]
drm/amd/display: Clean up DCN cursor code

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix 180 full screen pipe split
Dmytro Laktyushkin [Thu, 7 Dec 2017 20:48:15 +0000 (15:48 -0500)]
drm/amd/display: fix 180 full screen pipe split

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: reprogram surface config on scaling change
Eric Yang [Thu, 7 Dec 2017 15:42:33 +0000 (10:42 -0500)]
drm/amd/display: reprogram surface config on scaling change

When plane size changes, we need to reprogram surface pitch in addition
to viewport and scaler. This change is a conservative way to make this happen.
However it could be more optimized to move pitch programming into
mem_program_viewport.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Andrew Jiang <Andrew.Jiang@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove dwbc from pipe_ctx
Eric Bernstein [Thu, 23 Nov 2017 21:38:52 +0000 (16:38 -0500)]
drm/amd/display: Remove dwbc from pipe_ctx

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Use the maximum link setting which EDP reported.
Hugo Hu [Thu, 7 Dec 2017 07:33:22 +0000 (15:33 +0800)]
drm/amd/display: Use the maximum link setting which EDP reported.

Signed-off-by: Hugo Hu <hugo.hu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add hdr_supported flag
Yongqiang Sun [Wed, 6 Dec 2017 21:29:21 +0000 (16:29 -0500)]
drm/amd/display: Add hdr_supported flag

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix global sync param retrieval when not pipe splitting
Dmytro Laktyushkin [Mon, 4 Dec 2017 20:48:13 +0000 (15:48 -0500)]
drm/amd/display: fix global sync param retrieval when not pipe splitting

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Update HUBP
Eric Bernstein [Tue, 5 Dec 2017 15:51:35 +0000 (10:51 -0500)]
drm/amd/display: Update HUBP

Signed-off-by: Eric Bernstein <eric.bernstein@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix rotated surface scaling
Dmytro Laktyushkin [Wed, 29 Nov 2017 22:42:08 +0000 (17:42 -0500)]
drm/amd/display: fix rotated surface scaling

This is a resubmit with the errors fixed

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: clean up dcn soc params
Dmytro Laktyushkin [Tue, 28 Nov 2017 16:22:15 +0000 (11:22 -0500)]
drm/amd/display: clean up dcn soc params

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: dal 3.1.26
Eric Yang [Tue, 5 Dec 2017 19:34:56 +0000 (14:34 -0500)]
drm/amd/display: dal 3.1.26

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Andrew Jiang <Andrew.Jiang@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix rehook MST display not light back on
Jerry (Fangzhi) Zuo [Fri, 1 Dec 2017 18:26:05 +0000 (13:26 -0500)]
drm/amd/display: Fix rehook MST display not light back on

Original applied dm_restore_drm_connector_state() has got removed.
Set link status to BAD before hotplug() event could trigger
another modeset from userspace.

The fix "Fix MST daisy chain SST not light up" commit makes so it is trying
to create a stream prior to dc_sink. That makes dc_sink is not present in
create_stream_for_sink().

Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix check for whether dmcu fw is running
Anthony Koo [Fri, 24 Nov 2017 20:43:05 +0000 (15:43 -0500)]
drm/amd/display: Fix check for whether dmcu fw is running

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Declare and share color space types for dcn's
Vitaly Prosyak [Fri, 1 Dec 2017 17:42:18 +0000 (11:42 -0600)]
drm/amd/display: Declare and share color space types for dcn's

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Do DC mode-change check after stream creation
Leo (Sunpeng) Li [Tue, 21 Nov 2017 18:19:04 +0000 (13:19 -0500)]
drm/amd/display: Do DC mode-change check after stream creation

Do DC level mode change checks (via dc_stream_state) only when creating
a new stream, as this check is uneccessary without a new dc_stream_state
anyways. Doing so better demonstrates the intent of this mode-change
check, in comparison to guarding it with the 'enable' flag.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Define BLNDGAM_CONFIG_STATUS
Vitaly Prosyak [Wed, 29 Nov 2017 18:54:53 +0000 (12:54 -0600)]
drm/amd/display: Define BLNDGAM_CONFIG_STATUS

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Don't spam debug log on long reg waits
Harry Wentland [Mon, 27 Nov 2017 21:12:43 +0000 (16:12 -0500)]
drm/amd/display: Don't spam debug log on long reg waits

Certain reg waits take up to a frame. Don't spam the log when this
happens.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Error print when ATOM BIOS implementation is missing
Harry Wentland [Mon, 27 Nov 2017 14:50:01 +0000 (09:50 -0500)]
drm/amd/display: Error print when ATOM BIOS implementation is missing

We fail apply_ctx_to_hw when crtc_source_select is missing. This isn't
really helpful at this point. It would aid ASIC bringup if we log an error
when we can't find the implementation for the ATOM version.

Do the same for all other function points in the command table that do a
NULL check before being called.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove dead enable_plane function definition and call
Harry Wentland [Mon, 27 Nov 2017 14:30:48 +0000 (09:30 -0500)]
drm/amd/display: Remove dead enable_plane function definition and call

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Jordan Lazare <Jordan.Lazare@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Print type if we get wrong ObjectID from bios
Harry Wentland [Fri, 24 Nov 2017 14:11:23 +0000 (09:11 -0500)]
drm/amd/display: Print type if we get wrong ObjectID from bios

We've seen a bunch of issues where we can't get the connector from vbios
for what we think should be a valid connector id. Print some more info
when this happens.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/radeon: Remove KFD_CIK_SDMA_QUEUE_OFFSET
Michel Dänzer [Wed, 20 Dec 2017 09:45:36 +0000 (10:45 +0100)]
drm/radeon: Remove KFD_CIK_SDMA_QUEUE_OFFSET

Leftover from recently removed amdkfd support.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/radeon: reduce number of free VMIDs and pipes in KV"
Michel Dänzer [Wed, 20 Dec 2017 09:45:36 +0000 (10:45 +0100)]
Revert "drm/radeon: reduce number of free VMIDs and pipes in KV"

This reverts the remaining changes of commit
62a7b7fbd08ef745bb51e8728e89125a0ba6327e, because radeon doesn't support
amdkfd anymore. The number of VMIDs was already changed back when amdkfd
support was removed.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/radeon/cik: Don't touch int of pipes 1-7"
Michel Dänzer [Wed, 20 Dec 2017 09:45:36 +0000 (10:45 +0100)]
Revert "drm/radeon/cik: Don't touch int of pipes 1-7"

This reverts commit 28b57b856b635ea0d44f1281e2efdc963c100ea3. radeon
doesn't support amdkfd anymore, so the latter doesn't set up interrupts
for pipes 1-7.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/radeon: Report doorbell configuration to amdkfd"
Michel Dänzer [Wed, 20 Dec 2017 09:45:36 +0000 (10:45 +0100)]
Revert "drm/radeon: Report doorbell configuration to amdkfd"

This reverts commit ebff8453d3a57a2405c4d96d9f9c4f4acc7d4d79. Unused
since amdkfd is no longer supported with radeon.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/radeon: adding synchronization for GRBM GFX"
Michel Dänzer [Wed, 20 Dec 2017 09:45:35 +0000 (10:45 +0100)]
Revert "drm/radeon: adding synchronization for GRBM GFX"

This reverts commit 1c0a46255f8d7daf5b601668836e185fd1294e94. Not needed
anymore, since amdkfd is no longer supported with radeon.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Implement force_dpm_level on Rv
Rex Zhu [Wed, 13 Dec 2017 07:28:06 +0000 (15:28 +0800)]
drm/amd/pp: Implement force_dpm_level on Rv

user can change dpm level on Rv through sysfs

v3: add smu version check
v2: fix no return statement

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: Get and save Rv smu version
Rex Zhu [Tue, 19 Dec 2017 06:08:54 +0000 (14:08 +0800)]
drm/amd/pp: Get and save Rv smu version

The smu firmware is loaded by the sbios on APUs, so query it
from the smu and save the smu fw version info that is reported
to userspace.

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: update smu_version value for CI/VI
Rex Zhu [Tue, 19 Dec 2017 06:07:09 +0000 (14:07 +0800)]
drm/amd/pp: update smu_version value for CI/VI

Set the new common smu firmware version for smu7 parts (CI and VI).

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: Move smu_version to common code
Rex Zhu [Tue, 19 Dec 2017 06:04:24 +0000 (14:04 +0800)]
drm/amd/pp: Move smu_version to common code

Move the smu_version to struct hwmgr, so it can be shared
by other 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/amdgpu: use defines for mmBIF_IOV_FUNC_IDENTIFIER fields
Alex Deucher [Tue, 19 Dec 2017 14:57:53 +0000 (09:57 -0500)]
drm/amdgpu: use defines for mmBIF_IOV_FUNC_IDENTIFIER fields

Rather than magic numbers.

Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: only check mmBIF_IOV_FUNC_IDENTIFIER on tonga/fiji
Alex Deucher [Tue, 19 Dec 2017 14:52:31 +0000 (09:52 -0500)]
drm/amdgpu: only check mmBIF_IOV_FUNC_IDENTIFIER on tonga/fiji

We only support SR-IOV on tonga/fiji.  Don't check this register
on other VI parts.

Fixes: 048765ad5af7c89 (amdgpu: fix asic initialization for virtualized environments (v2))
Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/pp: export more smu message on Rv
Rex Zhu [Wed, 13 Dec 2017 07:26:15 +0000 (15:26 +0800)]
drm/amd/pp: export more smu message on Rv

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>