New driver: Cadence MHDP8546 DisplayPort bridge driver core: - cross-driver scatterlist cleanups - devm_drm conversions - remove drm_dev_init - devm_drm_dev_alloc conversion ttm: - lots of refactoring and cleanups bridges: - chained bridge support in more drivers panel: - misc new panels scheduler: - cleanup priority levels displayport: - refactor i915 code into helpers for nouveau i915: - split into display and GT trees - WW locking refactoring in GEM - execbuf2 extension mechanism - syncobj timeline support - GEN 12 HOBL display powersaving - Rocket Lake display additions - Disable FBC on Tigerlake - Tigerlake Type-C + DP improvements - Hotplug interrupt refactoring amdgpu: - Sienna Cichlid updates - Navy Flounder updates - DCE6 (SI) support for DC - Plane rotation enabled - TMZ state info ioctl - PCIe DPC recovery support - DC interrupt handling refactor - OLED panel fixes amdkfd: - add SMI events for thermal throttling - SMI interface events ioctl update - process eviction counters radeon: - move to dma_ for allocations - expose sclk via sysfs msm: - DSI support for sm8150/sm8250 - per-process GPU pagetable support - Displayport support mediatek: - move HDMI phy driver to PHY - convert mtk-dpi to bridge API - disable mt2701 tmds tegra: - bridge support exynos: - misc cleanups vc4: - dual display cleanups ast: - cleanups gma500: - conversion to GPIOd API hisilicon: - misc reworks ingenic: - clock handling and format improvements mcde: - DSI support mgag200: - desktop g200 support mxsfb: - i.MX7 + i.MX8M - alpha plane support panfrost: - devfreq support - amlogic SoC support ps8640: - EDID from eDP retrieval tidss: - AM65xx YUV workaround virtio: - virtio-gpu exported resources rcar-du: - R8A7742, R8A774E1 and R8A77961 support - YUV planar format fixes - non-visible plane handling - VSP device reference count fix - Kconfig fix to avoid displaying disabled options in .config -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJfh579AAoJEAx081l5xIa+GqoP/0amz+ZN7y/L7+f32CRinJ7/ 3e4xjXNDmtWG4Whe/WKjlYmbAcvSdWV/4HYpurW2BFJnOAB/5lIqYcS/PyqErPzA w4EpRoJ+ZdFgmlDH0vdsDwPLT/HFmhUN9AopNkoZpbSMxrManSj5QgmePXyiKReP Q+ZAK5UW5AdOVY4bgXUSEkVq2eilCLXf+bSBR/LrVQuNgu7GULX8SIy/Y1CuMtv8 LgzzjLKfIZaIWC+F/RU7BxJ7YnrVq7z7yXnUx8j2416+k/Wwe+BeSUCSZstT7q9G UkX8jWfR7ZKqhwP+UQeSwDbHkALz7lv88nyjQdxJZ3SrXRe4hy14YjxnR4maeNAj 3TAYSdcAMWyRHqeEZIZ7Hj5sQtTq5OZAoIjxzH3vpVdAnnAkcWoF77pqxV8XPqTC nw40DihAxQOshGwMkjd5DqkEwnMv43Hs1WTVYu9dPTOfOdqPNt+Vqp7Xl9Z46+kV k6PDcx60T9ayDW1QZ6MoIXHta9E7ixzu7gYBL3vP4LuporY0uNG3bzF3CMvof1BK sHYcYTdZkqbTD2d6rHV+TbpPQXgTtlej9qVlQM4SeX37Xtc7LxCYpnpUHKz2S/fK 1vyeGPgdytHblwlxwZOPZ4R2I/HTfnITdr4kMcJHhxAsEewfW1Rd4+stQqVJ2Mph Vz+CFP2BngivGFz5vuky =4H8J -----END PGP SIGNATURE----- Merge tag 'drm-next-2020-10-15' of git://anongit.freedesktop.org/drm/drm Pull drm updates from Dave Airlie: "Not a major amount of change, the i915 trees got split into display and gt trees to better facilitate higher level review, and there's a major refactoring of i915 GEM locking to use more core kernel concepts (like ww-mutexes). msm gets per-process pagetables, older AMD SI cards get DC support, nouveau got a bump in displayport support with common code extraction from i915. Outside of drm this contains a couple of patches for hexint moduleparams which you've acked, and a virtio common code tree that you should also get via it's regular path. New driver: - Cadence MHDP8546 DisplayPort bridge driver core: - cross-driver scatterlist cleanups - devm_drm conversions - remove drm_dev_init - devm_drm_dev_alloc conversion ttm: - lots of refactoring and cleanups bridges: - chained bridge support in more drivers panel: - misc new panels scheduler: - cleanup priority levels displayport: - refactor i915 code into helpers for nouveau i915: - split into display and GT trees - WW locking refactoring in GEM - execbuf2 extension mechanism - syncobj timeline support - GEN 12 HOBL display powersaving - Rocket Lake display additions - Disable FBC on Tigerlake - Tigerlake Type-C + DP improvements - Hotplug interrupt refactoring amdgpu: - Sienna Cichlid updates - Navy Flounder updates - DCE6 (SI) support for DC - Plane rotation enabled - TMZ state info ioctl - PCIe DPC recovery support - DC interrupt handling refactor - OLED panel fixes amdkfd: - add SMI events for thermal throttling - SMI interface events ioctl update - process eviction counters radeon: - move to dma_ for allocations - expose sclk via sysfs msm: - DSI support for sm8150/sm8250 - per-process GPU pagetable support - Displayport support mediatek: - move HDMI phy driver to PHY - convert mtk-dpi to bridge API - disable mt2701 tmds tegra: - bridge support exynos: - misc cleanups vc4: - dual display cleanups ast: - cleanups gma500: - conversion to GPIOd API hisilicon: - misc reworks ingenic: - clock handling and format improvements mcde: - DSI support mgag200: - desktop g200 support mxsfb: - i.MX7 + i.MX8M - alpha plane support panfrost: - devfreq support - amlogic SoC support ps8640: - EDID from eDP retrieval tidss: - AM65xx YUV workaround virtio: - virtio-gpu exported resources rcar-du: - R8A7742, R8A774E1 and R8A77961 support - YUV planar format fixes - non-visible plane handling - VSP device reference count fix - Kconfig fix to avoid displaying disabled options in .config" * tag 'drm-next-2020-10-15' of git://anongit.freedesktop.org/drm/drm: (1494 commits) drm/ingenic: Fix bad revert drm/amdgpu: Fix invalid number of character '{' in amdgpu_acpi_init drm/amdgpu: Remove warning for virtual_display drm/amdgpu: kfd_initialized can be static drm/amd/pm: setup APU dpm clock table in SMU HW initialization drm/amdgpu: prevent spurious warning drm/amdgpu/swsmu: fix ARC build errors drm/amd/display: Fix OPTC_DATA_FORMAT programming drm/amd/display: Don't allow pstate if no support in blank drm/panfrost: increase readl_relaxed_poll_timeout values MAINTAINERS: Update entry for st7703 driver after the rename Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" drm/amd/display: HDMI remote sink need mode validation for Linux drm/amd/display: Change to correct unit on audio rate drm/amd/display: Avoid set zero in the requested clk drm/amdgpu: align frag_end to covered address space drm/amdgpu: fix NULL pointer dereference for Renoir drm/vmwgfx: fix regression in thp code due to ttm init refactor. drm/amdgpu/swsmu: add interrupt work handler for smu11 parts drm/amdgpu/swsmu: add interrupt work function ...
304 lines
9.6 KiB
C
304 lines
9.6 KiB
C
/*
|
|
* Copyright 2014 Advanced Micro Devices, Inc.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
/*
|
|
* This file defines the private interface between the
|
|
* AMD kernel graphics drivers and the AMD KFD.
|
|
*/
|
|
|
|
#ifndef KGD_KFD_INTERFACE_H_INCLUDED
|
|
#define KGD_KFD_INTERFACE_H_INCLUDED
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/bitmap.h>
|
|
#include <linux/dma-fence.h>
|
|
|
|
struct pci_dev;
|
|
|
|
#define KGD_MAX_QUEUES 128
|
|
|
|
struct kfd_dev;
|
|
struct kgd_dev;
|
|
|
|
struct kgd_mem;
|
|
|
|
enum kfd_preempt_type {
|
|
KFD_PREEMPT_TYPE_WAVEFRONT_DRAIN = 0,
|
|
KFD_PREEMPT_TYPE_WAVEFRONT_RESET,
|
|
};
|
|
|
|
struct kfd_vm_fault_info {
|
|
uint64_t page_addr;
|
|
uint32_t vmid;
|
|
uint32_t mc_id;
|
|
uint32_t status;
|
|
bool prot_valid;
|
|
bool prot_read;
|
|
bool prot_write;
|
|
bool prot_exec;
|
|
};
|
|
|
|
struct kfd_cu_info {
|
|
uint32_t num_shader_engines;
|
|
uint32_t num_shader_arrays_per_engine;
|
|
uint32_t num_cu_per_sh;
|
|
uint32_t cu_active_number;
|
|
uint32_t cu_ao_mask;
|
|
uint32_t simd_per_cu;
|
|
uint32_t max_waves_per_simd;
|
|
uint32_t wave_front_size;
|
|
uint32_t max_scratch_slots_per_cu;
|
|
uint32_t lds_size;
|
|
uint32_t cu_bitmap[4][4];
|
|
};
|
|
|
|
/* For getting GPU local memory information from KGD */
|
|
struct kfd_local_mem_info {
|
|
uint64_t local_mem_size_private;
|
|
uint64_t local_mem_size_public;
|
|
uint32_t vram_width;
|
|
uint32_t mem_clk_max;
|
|
};
|
|
|
|
enum kgd_memory_pool {
|
|
KGD_POOL_SYSTEM_CACHEABLE = 1,
|
|
KGD_POOL_SYSTEM_WRITECOMBINE = 2,
|
|
KGD_POOL_FRAMEBUFFER = 3,
|
|
};
|
|
|
|
/**
|
|
* enum kfd_sched_policy
|
|
*
|
|
* @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp)
|
|
* scheduling. In this scheduling mode we're using the firmware code to
|
|
* schedule the user mode queues and kernel queues such as HIQ and DIQ.
|
|
* the HIQ queue is used as a special queue that dispatches the configuration
|
|
* to the cp and the user mode queues list that are currently running.
|
|
* the DIQ queue is a debugging queue that dispatches debugging commands to the
|
|
* firmware.
|
|
* in this scheduling mode user mode queues over subscription feature is
|
|
* enabled.
|
|
*
|
|
* @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over
|
|
* subscription feature disabled.
|
|
*
|
|
* @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly
|
|
* set the command processor registers and sets the queues "manually". This
|
|
* mode is used *ONLY* for debugging proposes.
|
|
*
|
|
*/
|
|
enum kfd_sched_policy {
|
|
KFD_SCHED_POLICY_HWS = 0,
|
|
KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
|
|
KFD_SCHED_POLICY_NO_HWS
|
|
};
|
|
|
|
struct kgd2kfd_shared_resources {
|
|
/* Bit n == 1 means VMID n is available for KFD. */
|
|
unsigned int compute_vmid_bitmap;
|
|
|
|
/* number of pipes per mec */
|
|
uint32_t num_pipe_per_mec;
|
|
|
|
/* number of queues per pipe */
|
|
uint32_t num_queue_per_pipe;
|
|
|
|
/* Bit n == 1 means Queue n is available for KFD */
|
|
DECLARE_BITMAP(cp_queue_bitmap, KGD_MAX_QUEUES);
|
|
|
|
/* SDMA doorbell assignments (SOC15 and later chips only). Only
|
|
* specific doorbells are routed to each SDMA engine. Others
|
|
* are routed to IH and VCN. They are not usable by the CP.
|
|
*/
|
|
uint32_t *sdma_doorbell_idx;
|
|
|
|
/* From SOC15 onward, the doorbell index range not usable for CP
|
|
* queues.
|
|
*/
|
|
uint32_t non_cp_doorbells_start;
|
|
uint32_t non_cp_doorbells_end;
|
|
|
|
/* Base address of doorbell aperture. */
|
|
phys_addr_t doorbell_physical_address;
|
|
|
|
/* Size in bytes of doorbell aperture. */
|
|
size_t doorbell_aperture_size;
|
|
|
|
/* Number of bytes at start of aperture reserved for KGD. */
|
|
size_t doorbell_start_offset;
|
|
|
|
/* GPUVM address space size in bytes */
|
|
uint64_t gpuvm_size;
|
|
|
|
/* Minor device number of the render node */
|
|
int drm_render_minor;
|
|
|
|
};
|
|
|
|
struct tile_config {
|
|
uint32_t *tile_config_ptr;
|
|
uint32_t *macro_tile_config_ptr;
|
|
uint32_t num_tile_configs;
|
|
uint32_t num_macro_tile_configs;
|
|
|
|
uint32_t gb_addr_config;
|
|
uint32_t num_banks;
|
|
uint32_t num_ranks;
|
|
};
|
|
|
|
#define KFD_MAX_NUM_OF_QUEUES_PER_DEVICE_DEFAULT 4096
|
|
|
|
/**
|
|
* struct kfd2kgd_calls
|
|
*
|
|
* @program_sh_mem_settings: A function that should initiate the memory
|
|
* properties such as main aperture memory type (cache / non cached) and
|
|
* secondary aperture base address, size and memory type.
|
|
* This function is used only for no cp scheduling mode.
|
|
*
|
|
* @set_pasid_vmid_mapping: Exposes pasid/vmid pair to the H/W for no cp
|
|
* scheduling mode. Only used for no cp scheduling mode.
|
|
*
|
|
* @hqd_load: Loads the mqd structure to a H/W hqd slot. used only for no cp
|
|
* sceduling mode.
|
|
*
|
|
* @hqd_sdma_load: Loads the SDMA mqd structure to a H/W SDMA hqd slot.
|
|
* used only for no HWS mode.
|
|
*
|
|
* @hqd_dump: Dumps CPC HQD registers to an array of address-value pairs.
|
|
* Array is allocated with kmalloc, needs to be freed with kfree by caller.
|
|
*
|
|
* @hqd_sdma_dump: Dumps SDMA HQD registers to an array of address-value pairs.
|
|
* Array is allocated with kmalloc, needs to be freed with kfree by caller.
|
|
*
|
|
* @hqd_is_occupies: Checks if a hqd slot is occupied.
|
|
*
|
|
* @hqd_destroy: Destructs and preempts the queue assigned to that hqd slot.
|
|
*
|
|
* @hqd_sdma_is_occupied: Checks if an SDMA hqd slot is occupied.
|
|
*
|
|
* @hqd_sdma_destroy: Destructs and preempts the SDMA queue assigned to that
|
|
* SDMA hqd slot.
|
|
*
|
|
* @set_scratch_backing_va: Sets VA for scratch backing memory of a VMID.
|
|
* Only used for no cp scheduling mode
|
|
*
|
|
* @set_vm_context_page_table_base: Program page table base for a VMID
|
|
*
|
|
* @invalidate_tlbs: Invalidate TLBs for a specific PASID
|
|
*
|
|
* @invalidate_tlbs_vmid: Invalidate TLBs for a specific VMID
|
|
*
|
|
* @read_vmid_from_vmfault_reg: On Hawaii the VMID is not set in the
|
|
* IH ring entry. This function allows the KFD ISR to get the VMID
|
|
* from the fault status register as early as possible.
|
|
*
|
|
* @get_cu_occupancy: Function pointer that returns to caller the number
|
|
* of wave fronts that are in flight for all of the queues of a process
|
|
* as identified by its pasid. It is important to note that the value
|
|
* returned by this function is a snapshot of current moment and cannot
|
|
* guarantee any minimum for the number of waves in-flight. This function
|
|
* is defined for devices that belong to GFX9 and later GFX families. Care
|
|
* must be taken in calling this function as it is not defined for devices
|
|
* that belong to GFX8 and below GFX families.
|
|
*
|
|
* This structure contains function pointers to services that the kgd driver
|
|
* provides to amdkfd driver.
|
|
*
|
|
*/
|
|
struct kfd2kgd_calls {
|
|
/* Register access functions */
|
|
void (*program_sh_mem_settings)(struct kgd_dev *kgd, uint32_t vmid,
|
|
uint32_t sh_mem_config, uint32_t sh_mem_ape1_base,
|
|
uint32_t sh_mem_ape1_limit, uint32_t sh_mem_bases);
|
|
|
|
int (*set_pasid_vmid_mapping)(struct kgd_dev *kgd, u32 pasid,
|
|
unsigned int vmid);
|
|
|
|
int (*init_interrupts)(struct kgd_dev *kgd, uint32_t pipe_id);
|
|
|
|
int (*hqd_load)(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
|
|
uint32_t queue_id, uint32_t __user *wptr,
|
|
uint32_t wptr_shift, uint32_t wptr_mask,
|
|
struct mm_struct *mm);
|
|
|
|
int (*hiq_mqd_load)(struct kgd_dev *kgd, void *mqd,
|
|
uint32_t pipe_id, uint32_t queue_id,
|
|
uint32_t doorbell_off);
|
|
|
|
int (*hqd_sdma_load)(struct kgd_dev *kgd, void *mqd,
|
|
uint32_t __user *wptr, struct mm_struct *mm);
|
|
|
|
int (*hqd_dump)(struct kgd_dev *kgd,
|
|
uint32_t pipe_id, uint32_t queue_id,
|
|
uint32_t (**dump)[2], uint32_t *n_regs);
|
|
|
|
int (*hqd_sdma_dump)(struct kgd_dev *kgd,
|
|
uint32_t engine_id, uint32_t queue_id,
|
|
uint32_t (**dump)[2], uint32_t *n_regs);
|
|
|
|
bool (*hqd_is_occupied)(struct kgd_dev *kgd, uint64_t queue_address,
|
|
uint32_t pipe_id, uint32_t queue_id);
|
|
|
|
int (*hqd_destroy)(struct kgd_dev *kgd, void *mqd, uint32_t reset_type,
|
|
unsigned int timeout, uint32_t pipe_id,
|
|
uint32_t queue_id);
|
|
|
|
bool (*hqd_sdma_is_occupied)(struct kgd_dev *kgd, void *mqd);
|
|
|
|
int (*hqd_sdma_destroy)(struct kgd_dev *kgd, void *mqd,
|
|
unsigned int timeout);
|
|
|
|
int (*address_watch_disable)(struct kgd_dev *kgd);
|
|
int (*address_watch_execute)(struct kgd_dev *kgd,
|
|
unsigned int watch_point_id,
|
|
uint32_t cntl_val,
|
|
uint32_t addr_hi,
|
|
uint32_t addr_lo);
|
|
int (*wave_control_execute)(struct kgd_dev *kgd,
|
|
uint32_t gfx_index_val,
|
|
uint32_t sq_cmd);
|
|
uint32_t (*address_watch_get_offset)(struct kgd_dev *kgd,
|
|
unsigned int watch_point_id,
|
|
unsigned int reg_offset);
|
|
bool (*get_atc_vmid_pasid_mapping_info)(
|
|
struct kgd_dev *kgd,
|
|
uint8_t vmid,
|
|
uint16_t *p_pasid);
|
|
|
|
/* No longer needed from GFXv9 onward. The scratch base address is
|
|
* passed to the shader by the CP. It's the user mode driver's
|
|
* responsibility.
|
|
*/
|
|
void (*set_scratch_backing_va)(struct kgd_dev *kgd,
|
|
uint64_t va, uint32_t vmid);
|
|
|
|
void (*set_vm_context_page_table_base)(struct kgd_dev *kgd,
|
|
uint32_t vmid, uint64_t page_table_base);
|
|
uint32_t (*read_vmid_from_vmfault_reg)(struct kgd_dev *kgd);
|
|
|
|
void (*get_cu_occupancy)(struct kgd_dev *kgd, int pasid, int *wave_cnt,
|
|
int *max_waves_per_cu);
|
|
};
|
|
|
|
#endif /* KGD_KFD_INTERFACE_H_INCLUDED */
|