amd-drm-next-6.6-2023-07-28:
amdgpu: - Lots of checkpatch cleanups - GFX 9.4.3 updates - Add USB PD and IFWI flashing documentation - GPUVM updates - RAS fixes - DRR fixes - FAMS fixes - Virtual display fixes - Soft IH fixes - SMU13 fixes - Rework PSP firmware loading for other IPs - Kernel doc fixes - DCN 3.0.1 fixes - LTTPR fixes - DP MST fixes - DCN 3.1.6 fixes - SubVP fixes - Display bandwidth calculation fixes - VCN4 secure submission fixes - Allow building DC on RISC-V - Add visible FB info to bo_print_info - HBR3 fixes - Add PSP 14.0 support - GFX9 MCBP fix - GMC10 vmhub index fix - GMC11 vmhub index fix - Create a new doorbell manager - SR-IOV fixes amdkfd: - Cleanup CRIU dma-buf handling - Use KIQ to unmap HIQ - GFX 9.4.3 debugger updates - GFX 9.4.2 debugger fixes - Enable cooperative groups fof gfx11 - SVM fixes radeon: - Lots of checkpatch cleanups -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCZMQ0vAAKCRC93/aFa7yZ 2EOOAQCrsNf1IEynXVj0gVYOWFDpBCdaDkw+gXR73nOlwBeZzgD8DAoismXYDY95 pkKlx/HL5O8qyZ25Lc9ZlgsJnTpnpw4= =c/Jk -----END PGP SIGNATURE----- Merge tag 'amd-drm-next-6.6-2023-07-28' of https://gitlab.freedesktop.org/agd5f/linux into drm-next amd-drm-next-6.6-2023-07-28: amdgpu: - Lots of checkpatch cleanups - GFX 9.4.3 updates - Add USB PD and IFWI flashing documentation - GPUVM updates - RAS fixes - DRR fixes - FAMS fixes - Virtual display fixes - Soft IH fixes - SMU13 fixes - Rework PSP firmware loading for other IPs - Kernel doc fixes - DCN 3.0.1 fixes - LTTPR fixes - DP MST fixes - DCN 3.1.6 fixes - SubVP fixes - Display bandwidth calculation fixes - VCN4 secure submission fixes - Allow building DC on RISC-V - Add visible FB info to bo_print_info - HBR3 fixes - Add PSP 14.0 support - GFX9 MCBP fix - GMC10 vmhub index fix - GMC11 vmhub index fix - Create a new doorbell manager - SR-IOV fixes amdkfd: - Cleanup CRIU dma-buf handling - Use KIQ to unmap HIQ - GFX 9.4.3 debugger updates - GFX 9.4.2 debugger fixes - Enable cooperative groups fof gfx11 - SVM fixes radeon: - Lots of checkpatch cleanups Merge conflicts: - drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c The switch to drm eu helpers in 8a206685d36f ("drm/amdgpu: use drm_exec for GEM and CSA handling v2") clashed with the cosmetic cleanups from 30953c4d000b ("drm/amdgpu: Fix style issues in amdgpu_gem.c"). I kept the former since the cleanup up code is gone. - drivers/gpu/drm/amd/amdgpu/atom.c. adf64e214280 ("drm/amd: Avoid reading the VBIOS part number twice") removed code that 992b8fe106ab ("drm/radeon: Replace all non-returning strlcpy with strscpy") polished. From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230728214228.8102-1-alexander.deucher@amd.com [sima: some merge conflict wrangling as noted] Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
commit
3d00c59d14
33
Documentation/gpu/amdgpu/flashing.rst
Normal file
33
Documentation/gpu/amdgpu/flashing.rst
Normal file
@ -0,0 +1,33 @@
|
||||
=======================
|
||||
dGPU firmware flashing
|
||||
=======================
|
||||
|
||||
IFWI
|
||||
----
|
||||
Flashing the dGPU integrated firmware image (IFWI) is supported by GPUs that
|
||||
use the PSP to orchestrate the update (Navi3x or newer GPUs).
|
||||
For supported GPUs, `amdgpu` will export a series of sysfs files that can be
|
||||
used for the flash process.
|
||||
|
||||
The IFWI flash process is:
|
||||
|
||||
1. Ensure the IFWI image is intended for the dGPU on the system.
|
||||
2. "Write" the IFWI image to the sysfs file `psp_vbflash`. This will stage the IFWI in memory.
|
||||
3. "Read" from the `psp_vbflash` sysfs file to initiate the flash process.
|
||||
4. Poll the `psp_vbflash_status` sysfs file to determine when the flash process completes.
|
||||
|
||||
USB-C PD F/W
|
||||
------------
|
||||
On GPUs that support flashing an updated USB-C PD firmware image, the process
|
||||
is done using the `usbc_pd_fw` sysfs file.
|
||||
|
||||
* Reading the file will provide the current firmware version.
|
||||
* Writing the name of a firmware payload stored in `/lib/firmware/amdgpu` to the sysfs file will initiate the flash process.
|
||||
|
||||
The firmware payload stored in `/lib/firmware/amdgpu` can be named any name
|
||||
as long as it doesn't conflict with other existing binaries that are used by
|
||||
`amdgpu`.
|
||||
|
||||
sysfs files
|
||||
-----------
|
||||
.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
|
@ -10,6 +10,7 @@ Next (GCN), Radeon DNA (RDNA), and Compute DNA (CDNA) architectures.
|
||||
module-parameters
|
||||
driver-core
|
||||
display/index
|
||||
flashing
|
||||
xgmi
|
||||
ras
|
||||
thermal
|
||||
|
@ -62,7 +62,7 @@ subdir-ccflags-$(CONFIG_DRM_AMDGPU_WERROR) += -Werror
|
||||
amdgpu-y := amdgpu_drv.o
|
||||
|
||||
# add KMS driver
|
||||
amdgpu-y += amdgpu_device.o amdgpu_kms.o \
|
||||
amdgpu-y += amdgpu_device.o amdgpu_doorbell_mgr.o amdgpu_kms.o \
|
||||
amdgpu_atombios.o atombios_crtc.o amdgpu_connectors.o \
|
||||
atom.o amdgpu_fence.o amdgpu_ttm.o amdgpu_object.o amdgpu_gart.o \
|
||||
amdgpu_encoders.o amdgpu_display.o amdgpu_i2c.o \
|
||||
@ -98,7 +98,7 @@ amdgpu-y += \
|
||||
vega20_reg_init.o nbio_v7_4.o nbio_v2_3.o nv.o arct_reg_init.o mxgpu_nv.o \
|
||||
nbio_v7_2.o hdp_v4_0.o hdp_v5_0.o aldebaran_reg_init.o aldebaran.o soc21.o \
|
||||
sienna_cichlid.o smu_v13_0_10.o nbio_v4_3.o hdp_v6_0.o nbio_v7_7.o hdp_v5_2.o lsdma_v6_0.o \
|
||||
nbio_v7_9.o aqua_vanjaram_reg_init.o
|
||||
nbio_v7_9.o aqua_vanjaram.o
|
||||
|
||||
# add DF block
|
||||
amdgpu-y += \
|
||||
|
@ -1033,7 +1033,6 @@ struct amdgpu_device {
|
||||
bool has_pr3;
|
||||
|
||||
bool ucode_sysfs_en;
|
||||
bool psp_sysfs_en;
|
||||
|
||||
/* Chip product information */
|
||||
char product_number[20];
|
||||
@ -1128,7 +1127,7 @@ void amdgpu_device_wreg(struct amdgpu_device *adev,
|
||||
void amdgpu_device_indirect_wreg_ext(struct amdgpu_device *adev,
|
||||
u64 reg_addr, u32 reg_data);
|
||||
void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev,
|
||||
uint32_t reg, uint32_t v);
|
||||
uint32_t reg, uint32_t v, uint32_t xcc_id);
|
||||
void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value);
|
||||
uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset);
|
||||
|
||||
@ -1506,4 +1505,8 @@ static inline bool amdgpu_is_tmz(struct amdgpu_device *adev)
|
||||
|
||||
int amdgpu_in_reset(struct amdgpu_device *adev);
|
||||
|
||||
extern const struct attribute_group amdgpu_vram_mgr_attr_group;
|
||||
extern const struct attribute_group amdgpu_gtt_mgr_attr_group;
|
||||
extern const struct attribute_group amdgpu_flash_attr_group;
|
||||
|
||||
#endif
|
||||
|
@ -868,7 +868,7 @@ static struct amdgpu_numa_info *amdgpu_acpi_get_numa_info(uint32_t pxm)
|
||||
if (!numa_info) {
|
||||
struct sysinfo info;
|
||||
|
||||
numa_info = kzalloc(sizeof *numa_info, GFP_KERNEL);
|
||||
numa_info = kzalloc(sizeof(*numa_info), GFP_KERNEL);
|
||||
if (!numa_info)
|
||||
return NULL;
|
||||
|
||||
|
@ -830,3 +830,53 @@ u64 amdgpu_amdkfd_xcp_memory_size(struct amdgpu_device *adev, int xcp_id)
|
||||
return adev->gmc.real_vram_size;
|
||||
}
|
||||
}
|
||||
|
||||
int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off,
|
||||
u32 inst)
|
||||
{
|
||||
struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst];
|
||||
struct amdgpu_ring *kiq_ring = &kiq->ring;
|
||||
struct amdgpu_ring_funcs *ring_funcs;
|
||||
struct amdgpu_ring *ring;
|
||||
int r = 0;
|
||||
|
||||
if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues)
|
||||
return -EINVAL;
|
||||
|
||||
ring_funcs = kzalloc(sizeof(*ring_funcs), GFP_KERNEL);
|
||||
if (!ring_funcs)
|
||||
return -ENOMEM;
|
||||
|
||||
ring = kzalloc(sizeof(*ring), GFP_KERNEL);
|
||||
if (!ring) {
|
||||
r = -ENOMEM;
|
||||
goto free_ring_funcs;
|
||||
}
|
||||
|
||||
ring_funcs->type = AMDGPU_RING_TYPE_COMPUTE;
|
||||
ring->doorbell_index = doorbell_off;
|
||||
ring->funcs = ring_funcs;
|
||||
|
||||
spin_lock(&kiq->ring_lock);
|
||||
|
||||
if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size)) {
|
||||
spin_unlock(&kiq->ring_lock);
|
||||
r = -ENOMEM;
|
||||
goto free_ring;
|
||||
}
|
||||
|
||||
kiq->pmf->kiq_unmap_queues(kiq_ring, ring, RESET_QUEUES, 0, 0);
|
||||
|
||||
if (kiq_ring->sched.ready && !adev->job_hang)
|
||||
r = amdgpu_ring_test_helper(kiq_ring);
|
||||
|
||||
spin_unlock(&kiq->ring_lock);
|
||||
|
||||
free_ring:
|
||||
kfree(ring);
|
||||
|
||||
free_ring_funcs:
|
||||
kfree(ring_funcs);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -251,6 +251,8 @@ int amdgpu_amdkfd_get_xgmi_bandwidth_mbytes(struct amdgpu_device *dst,
|
||||
int amdgpu_amdkfd_get_pcie_bandwidth_mbytes(struct amdgpu_device *adev, bool is_min);
|
||||
int amdgpu_amdkfd_send_close_event_drain_irq(struct amdgpu_device *adev,
|
||||
uint32_t *payload);
|
||||
int amdgpu_amdkfd_unmap_hiq(struct amdgpu_device *adev, u32 doorbell_off,
|
||||
u32 inst);
|
||||
|
||||
/* Read user wptr from a specified user address space with page fault
|
||||
* disabled. The memory must be pinned and mapped to the hardware when
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "amdgpu_amdkfd.h"
|
||||
#include "amdgpu_amdkfd_arcturus.h"
|
||||
#include "amdgpu_amdkfd_gfx_v9.h"
|
||||
#include "amdgpu_amdkfd_aldebaran.h"
|
||||
#include "gc/gc_9_4_2_offset.h"
|
||||
#include "gc/gc_9_4_2_sh_mask.h"
|
||||
#include <uapi/linux/kfd_ioctl.h>
|
||||
@ -36,7 +37,7 @@
|
||||
* initialize the debug mode registers after it has disabled GFX off during the
|
||||
* debug session.
|
||||
*/
|
||||
static uint32_t kgd_aldebaran_enable_debug_trap(struct amdgpu_device *adev,
|
||||
uint32_t kgd_aldebaran_enable_debug_trap(struct amdgpu_device *adev,
|
||||
bool restore_dbg_registers,
|
||||
uint32_t vmid)
|
||||
{
|
||||
@ -107,7 +108,7 @@ static uint32_t kgd_aldebaran_set_wave_launch_trap_override(struct amdgpu_device
|
||||
return data;
|
||||
}
|
||||
|
||||
static uint32_t kgd_aldebaran_set_wave_launch_mode(struct amdgpu_device *adev,
|
||||
uint32_t kgd_aldebaran_set_wave_launch_mode(struct amdgpu_device *adev,
|
||||
uint8_t wave_launch_mode,
|
||||
uint32_t vmid)
|
||||
{
|
||||
@ -125,7 +126,8 @@ static uint32_t kgd_gfx_aldebaran_set_address_watch(
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid)
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst)
|
||||
{
|
||||
uint32_t watch_address_high;
|
||||
uint32_t watch_address_low;
|
||||
|
27
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.h
Normal file
27
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2023 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.
|
||||
*/
|
||||
uint32_t kgd_aldebaran_enable_debug_trap(struct amdgpu_device *adev,
|
||||
bool restore_dbg_registers,
|
||||
uint32_t vmid);
|
||||
uint32_t kgd_aldebaran_set_wave_launch_mode(struct amdgpu_device *adev,
|
||||
uint8_t wave_launch_mode,
|
||||
uint32_t vmid);
|
@ -22,6 +22,7 @@
|
||||
#include "amdgpu.h"
|
||||
#include "amdgpu_amdkfd.h"
|
||||
#include "amdgpu_amdkfd_gfx_v9.h"
|
||||
#include "amdgpu_amdkfd_aldebaran.h"
|
||||
#include "gc/gc_9_4_3_offset.h"
|
||||
#include "gc/gc_9_4_3_sh_mask.h"
|
||||
#include "athub/athub_1_8_0_offset.h"
|
||||
@ -32,6 +33,7 @@
|
||||
#include "soc15.h"
|
||||
#include "sdma/sdma_4_4_2_offset.h"
|
||||
#include "sdma/sdma_4_4_2_sh_mask.h"
|
||||
#include <uapi/linux/kfd_ioctl.h>
|
||||
|
||||
static inline struct v9_sdma_mqd *get_sdma_mqd(void *mqd)
|
||||
{
|
||||
@ -361,6 +363,156 @@ static int kgd_gfx_v9_4_3_hqd_load(struct amdgpu_device *adev, void *mqd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* returns TRAP_EN, EXCP_EN and EXCP_REPLACE. */
|
||||
static uint32_t kgd_gfx_v9_4_3_disable_debug_trap(struct amdgpu_device *adev,
|
||||
bool keep_trap_enabled,
|
||||
uint32_t vmid)
|
||||
{
|
||||
uint32_t data = 0;
|
||||
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, 1);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_EN, 0);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_REPLACE, 0);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static int kgd_gfx_v9_4_3_validate_trap_override_request(
|
||||
struct amdgpu_device *adev,
|
||||
uint32_t trap_override,
|
||||
uint32_t *trap_mask_supported)
|
||||
{
|
||||
*trap_mask_supported &= KFD_DBG_TRAP_MASK_FP_INVALID |
|
||||
KFD_DBG_TRAP_MASK_FP_INPUT_DENORMAL |
|
||||
KFD_DBG_TRAP_MASK_FP_DIVIDE_BY_ZERO |
|
||||
KFD_DBG_TRAP_MASK_FP_OVERFLOW |
|
||||
KFD_DBG_TRAP_MASK_FP_UNDERFLOW |
|
||||
KFD_DBG_TRAP_MASK_FP_INEXACT |
|
||||
KFD_DBG_TRAP_MASK_INT_DIVIDE_BY_ZERO |
|
||||
KFD_DBG_TRAP_MASK_DBG_ADDRESS_WATCH |
|
||||
KFD_DBG_TRAP_MASK_DBG_MEMORY_VIOLATION |
|
||||
KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_START |
|
||||
KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_END;
|
||||
|
||||
if (trap_override != KFD_DBG_TRAP_OVERRIDE_OR &&
|
||||
trap_override != KFD_DBG_TRAP_OVERRIDE_REPLACE)
|
||||
return -EPERM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t trap_mask_map_sw_to_hw(uint32_t mask)
|
||||
{
|
||||
uint32_t trap_on_start = (mask & KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_START) ? 1 : 0;
|
||||
uint32_t trap_on_end = (mask & KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_END) ? 1 : 0;
|
||||
uint32_t excp_en = mask & (KFD_DBG_TRAP_MASK_FP_INVALID |
|
||||
KFD_DBG_TRAP_MASK_FP_INPUT_DENORMAL |
|
||||
KFD_DBG_TRAP_MASK_FP_DIVIDE_BY_ZERO |
|
||||
KFD_DBG_TRAP_MASK_FP_OVERFLOW |
|
||||
KFD_DBG_TRAP_MASK_FP_UNDERFLOW |
|
||||
KFD_DBG_TRAP_MASK_FP_INEXACT |
|
||||
KFD_DBG_TRAP_MASK_INT_DIVIDE_BY_ZERO |
|
||||
KFD_DBG_TRAP_MASK_DBG_ADDRESS_WATCH |
|
||||
KFD_DBG_TRAP_MASK_DBG_MEMORY_VIOLATION);
|
||||
uint32_t ret;
|
||||
|
||||
ret = REG_SET_FIELD(0, SPI_GDBG_PER_VMID_CNTL, EXCP_EN, excp_en);
|
||||
ret = REG_SET_FIELD(ret, SPI_GDBG_PER_VMID_CNTL, TRAP_ON_START, trap_on_start);
|
||||
ret = REG_SET_FIELD(ret, SPI_GDBG_PER_VMID_CNTL, TRAP_ON_END, trap_on_end);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint32_t trap_mask_map_hw_to_sw(uint32_t mask)
|
||||
{
|
||||
uint32_t ret = REG_GET_FIELD(mask, SPI_GDBG_PER_VMID_CNTL, EXCP_EN);
|
||||
|
||||
if (REG_GET_FIELD(mask, SPI_GDBG_PER_VMID_CNTL, TRAP_ON_START))
|
||||
ret |= KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_START;
|
||||
|
||||
if (REG_GET_FIELD(mask, SPI_GDBG_PER_VMID_CNTL, TRAP_ON_END))
|
||||
ret |= KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_END;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* returns TRAP_EN, EXCP_EN and EXCP_REPLACE. */
|
||||
static uint32_t kgd_gfx_v9_4_3_set_wave_launch_trap_override(
|
||||
struct amdgpu_device *adev,
|
||||
uint32_t vmid,
|
||||
uint32_t trap_override,
|
||||
uint32_t trap_mask_bits,
|
||||
uint32_t trap_mask_request,
|
||||
uint32_t *trap_mask_prev,
|
||||
uint32_t kfd_dbg_trap_cntl_prev)
|
||||
|
||||
{
|
||||
uint32_t data = 0;
|
||||
|
||||
*trap_mask_prev = trap_mask_map_hw_to_sw(kfd_dbg_trap_cntl_prev);
|
||||
|
||||
data = (trap_mask_bits & trap_mask_request) |
|
||||
(*trap_mask_prev & ~trap_mask_request);
|
||||
data = trap_mask_map_sw_to_hw(data);
|
||||
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, 1);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_REPLACE, trap_override);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#define TCP_WATCH_STRIDE (regTCP_WATCH1_ADDR_H - regTCP_WATCH0_ADDR_H)
|
||||
static uint32_t kgd_gfx_v9_4_3_set_address_watch(
|
||||
struct amdgpu_device *adev,
|
||||
uint64_t watch_address,
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst)
|
||||
{
|
||||
uint32_t watch_address_high;
|
||||
uint32_t watch_address_low;
|
||||
uint32_t watch_address_cntl;
|
||||
|
||||
watch_address_cntl = 0;
|
||||
watch_address_low = lower_32_bits(watch_address);
|
||||
watch_address_high = upper_32_bits(watch_address) & 0xffff;
|
||||
|
||||
watch_address_cntl = REG_SET_FIELD(watch_address_cntl,
|
||||
TCP_WATCH0_CNTL,
|
||||
MODE,
|
||||
watch_mode);
|
||||
|
||||
watch_address_cntl = REG_SET_FIELD(watch_address_cntl,
|
||||
TCP_WATCH0_CNTL,
|
||||
MASK,
|
||||
watch_address_mask >> 7);
|
||||
|
||||
watch_address_cntl = REG_SET_FIELD(watch_address_cntl,
|
||||
TCP_WATCH0_CNTL,
|
||||
VALID,
|
||||
1);
|
||||
|
||||
WREG32_RLC((SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
|
||||
regTCP_WATCH0_ADDR_H) +
|
||||
(watch_id * TCP_WATCH_STRIDE)),
|
||||
watch_address_high);
|
||||
|
||||
WREG32_RLC((SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
|
||||
regTCP_WATCH0_ADDR_L) +
|
||||
(watch_id * TCP_WATCH_STRIDE)),
|
||||
watch_address_low);
|
||||
|
||||
return watch_address_cntl;
|
||||
}
|
||||
|
||||
static uint32_t kgd_gfx_v9_4_3_clear_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_id)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct kfd2kgd_calls gc_9_4_3_kfd2kgd = {
|
||||
.program_sh_mem_settings = kgd_gfx_v9_program_sh_mem_settings,
|
||||
.set_pasid_vmid_mapping = kgd_gfx_v9_4_3_set_pasid_vmid_mapping,
|
||||
@ -379,6 +531,19 @@ const struct kfd2kgd_calls gc_9_4_3_kfd2kgd = {
|
||||
kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
|
||||
.set_vm_context_page_table_base =
|
||||
kgd_gfx_v9_set_vm_context_page_table_base,
|
||||
.get_cu_occupancy = kgd_gfx_v9_get_cu_occupancy,
|
||||
.program_trap_handler_settings =
|
||||
kgd_gfx_v9_program_trap_handler_settings
|
||||
kgd_gfx_v9_program_trap_handler_settings,
|
||||
.build_grace_period_packet_info =
|
||||
kgd_gfx_v9_build_grace_period_packet_info,
|
||||
.get_iq_wait_times = kgd_gfx_v9_get_iq_wait_times,
|
||||
.enable_debug_trap = kgd_aldebaran_enable_debug_trap,
|
||||
.disable_debug_trap = kgd_gfx_v9_4_3_disable_debug_trap,
|
||||
.validate_trap_override_request =
|
||||
kgd_gfx_v9_4_3_validate_trap_override_request,
|
||||
.set_wave_launch_trap_override =
|
||||
kgd_gfx_v9_4_3_set_wave_launch_trap_override,
|
||||
.set_wave_launch_mode = kgd_aldebaran_set_wave_launch_mode,
|
||||
.set_address_watch = kgd_gfx_v9_4_3_set_address_watch,
|
||||
.clear_address_watch = kgd_gfx_v9_4_3_clear_address_watch
|
||||
};
|
||||
|
@ -886,7 +886,8 @@ uint32_t kgd_gfx_v10_set_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid)
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst)
|
||||
{
|
||||
uint32_t watch_address_high;
|
||||
uint32_t watch_address_low;
|
||||
@ -968,7 +969,8 @@ uint32_t kgd_gfx_v10_clear_address_watch(struct amdgpu_device *adev,
|
||||
* deq_retry_wait_time -- Wait Count for Global Wave Syncs.
|
||||
*/
|
||||
void kgd_gfx_v10_get_iq_wait_times(struct amdgpu_device *adev,
|
||||
uint32_t *wait_times)
|
||||
uint32_t *wait_times,
|
||||
uint32_t inst)
|
||||
|
||||
{
|
||||
*wait_times = RREG32(SOC15_REG_OFFSET(GC, 0, mmCP_IQ_WAIT_TIME2));
|
||||
@ -978,7 +980,8 @@ void kgd_gfx_v10_build_grace_period_packet_info(struct amdgpu_device *adev,
|
||||
uint32_t wait_times,
|
||||
uint32_t grace_period,
|
||||
uint32_t *reg_offset,
|
||||
uint32_t *reg_data)
|
||||
uint32_t *reg_data,
|
||||
uint32_t inst)
|
||||
{
|
||||
*reg_data = wait_times;
|
||||
|
||||
|
@ -44,12 +44,16 @@ uint32_t kgd_gfx_v10_set_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid);
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst);
|
||||
uint32_t kgd_gfx_v10_clear_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_id);
|
||||
void kgd_gfx_v10_get_iq_wait_times(struct amdgpu_device *adev, uint32_t *wait_times);
|
||||
void kgd_gfx_v10_get_iq_wait_times(struct amdgpu_device *adev,
|
||||
uint32_t *wait_times,
|
||||
uint32_t inst);
|
||||
void kgd_gfx_v10_build_grace_period_packet_info(struct amdgpu_device *adev,
|
||||
uint32_t wait_times,
|
||||
uint32_t grace_period,
|
||||
uint32_t *reg_offset,
|
||||
uint32_t *reg_data);
|
||||
uint32_t *reg_data,
|
||||
uint32_t inst);
|
||||
|
@ -637,7 +637,7 @@ static uint32_t kgd_gfx_v11_disable_debug_trap(struct amdgpu_device *adev,
|
||||
{
|
||||
uint32_t data = 0;
|
||||
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, keep_trap_enabled);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, 1);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_EN, 0);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, EXCP_REPLACE, 0);
|
||||
|
||||
@ -743,7 +743,8 @@ static uint32_t kgd_gfx_v11_set_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid)
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst)
|
||||
{
|
||||
uint32_t watch_address_high;
|
||||
uint32_t watch_address_low;
|
||||
|
@ -822,7 +822,8 @@ uint32_t kgd_gfx_v9_set_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid)
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst)
|
||||
{
|
||||
uint32_t watch_address_high;
|
||||
uint32_t watch_address_low;
|
||||
@ -903,10 +904,12 @@ uint32_t kgd_gfx_v9_clear_address_watch(struct amdgpu_device *adev,
|
||||
* deq_retry_wait_time -- Wait Count for Global Wave Syncs.
|
||||
*/
|
||||
void kgd_gfx_v9_get_iq_wait_times(struct amdgpu_device *adev,
|
||||
uint32_t *wait_times)
|
||||
uint32_t *wait_times,
|
||||
uint32_t inst)
|
||||
|
||||
{
|
||||
*wait_times = RREG32(SOC15_REG_OFFSET(GC, 0, mmCP_IQ_WAIT_TIME2));
|
||||
*wait_times = RREG32(SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
|
||||
mmCP_IQ_WAIT_TIME2));
|
||||
}
|
||||
|
||||
void kgd_gfx_v9_set_vm_context_page_table_base(struct amdgpu_device *adev,
|
||||
@ -1100,12 +1103,13 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev,
|
||||
uint32_t wait_times,
|
||||
uint32_t grace_period,
|
||||
uint32_t *reg_offset,
|
||||
uint32_t *reg_data)
|
||||
uint32_t *reg_data,
|
||||
uint32_t inst)
|
||||
{
|
||||
*reg_data = wait_times;
|
||||
|
||||
/*
|
||||
* The CP cannont handle a 0 grace period input and will result in
|
||||
* The CP cannot handle a 0 grace period input and will result in
|
||||
* an infinite grace period being set so set to 1 to prevent this.
|
||||
*/
|
||||
if (grace_period == 0)
|
||||
@ -1116,7 +1120,8 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev,
|
||||
SCH_WAVE,
|
||||
grace_period);
|
||||
|
||||
*reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_IQ_WAIT_TIME2);
|
||||
*reg_offset = SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
|
||||
mmCP_IQ_WAIT_TIME2);
|
||||
}
|
||||
|
||||
void kgd_gfx_v9_program_trap_handler_settings(struct amdgpu_device *adev,
|
||||
|
@ -89,12 +89,16 @@ uint32_t kgd_gfx_v9_set_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_address_mask,
|
||||
uint32_t watch_id,
|
||||
uint32_t watch_mode,
|
||||
uint32_t debug_vmid);
|
||||
uint32_t debug_vmid,
|
||||
uint32_t inst);
|
||||
uint32_t kgd_gfx_v9_clear_address_watch(struct amdgpu_device *adev,
|
||||
uint32_t watch_id);
|
||||
void kgd_gfx_v9_get_iq_wait_times(struct amdgpu_device *adev, uint32_t *wait_times);
|
||||
void kgd_gfx_v9_get_iq_wait_times(struct amdgpu_device *adev,
|
||||
uint32_t *wait_times,
|
||||
uint32_t inst);
|
||||
void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev,
|
||||
uint32_t wait_times,
|
||||
uint32_t grace_period,
|
||||
uint32_t *reg_offset,
|
||||
uint32_t *reg_data);
|
||||
uint32_t *reg_data,
|
||||
uint32_t inst);
|
||||
|
@ -1662,7 +1662,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
|
||||
alloc_flags |= (flags & KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC) ?
|
||||
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED : 0;
|
||||
}
|
||||
xcp_id = fpriv->xcp_id == ~0 ? 0 : fpriv->xcp_id;
|
||||
xcp_id = fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION ?
|
||||
0 : fpriv->xcp_id;
|
||||
} else if (flags & KFD_IOC_ALLOC_MEM_FLAGS_GTT) {
|
||||
domain = alloc_domain = AMDGPU_GEM_DOMAIN_GTT;
|
||||
alloc_flags = 0;
|
||||
|
@ -1776,7 +1776,7 @@ static ssize_t amdgpu_atombios_get_vbios_version(struct device *dev,
|
||||
struct amdgpu_device *adev = drm_to_adev(ddev);
|
||||
struct atom_context *ctx = adev->mode_info.atom_context;
|
||||
|
||||
return sysfs_emit(buf, "%s\n", ctx->vbios_version);
|
||||
return sysfs_emit(buf, "%s\n", ctx->vbios_pn);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(vbios_version, 0444, amdgpu_atombios_get_vbios_version,
|
||||
|
@ -74,24 +74,29 @@ struct atpx_mux {
|
||||
u16 mux;
|
||||
} __packed;
|
||||
|
||||
bool amdgpu_has_atpx(void) {
|
||||
bool amdgpu_has_atpx(void)
|
||||
{
|
||||
return amdgpu_atpx_priv.atpx_detected;
|
||||
}
|
||||
|
||||
bool amdgpu_has_atpx_dgpu_power_cntl(void) {
|
||||
bool amdgpu_has_atpx_dgpu_power_cntl(void)
|
||||
{
|
||||
return amdgpu_atpx_priv.atpx.functions.power_cntl;
|
||||
}
|
||||
|
||||
bool amdgpu_is_atpx_hybrid(void) {
|
||||
bool amdgpu_is_atpx_hybrid(void)
|
||||
{
|
||||
return amdgpu_atpx_priv.atpx.is_hybrid;
|
||||
}
|
||||
|
||||
bool amdgpu_atpx_dgpu_req_power_for_displays(void) {
|
||||
bool amdgpu_atpx_dgpu_req_power_for_displays(void)
|
||||
{
|
||||
return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ACPI)
|
||||
void *amdgpu_atpx_get_dhandle(void) {
|
||||
void *amdgpu_atpx_get_dhandle(void)
|
||||
{
|
||||
return amdgpu_atpx_priv.dhandle;
|
||||
}
|
||||
#endif
|
||||
@ -113,6 +118,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
|
||||
union acpi_object atpx_arg_elements[2];
|
||||
struct acpi_object_list atpx_arg;
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
struct acpi_device *adev = container_of(handle, struct acpi_device, handle);
|
||||
struct device *dev = &adev->dev;
|
||||
|
||||
atpx_arg.count = 2;
|
||||
atpx_arg.pointer = &atpx_arg_elements[0];
|
||||
@ -134,8 +141,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
|
||||
|
||||
/* Fail only if calling the method fails and ATPX is supported */
|
||||
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||
printk("failed to evaluate ATPX got %s\n",
|
||||
acpi_format_exception(status));
|
||||
dev_err(dev, "failed to evaluate ATPX got %s\n",
|
||||
acpi_format_exception(status));
|
||||
kfree(buffer.pointer);
|
||||
return NULL;
|
||||
}
|
||||
@ -176,6 +183,8 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas
|
||||
static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
|
||||
{
|
||||
u32 valid_bits = 0;
|
||||
struct acpi_device *adev = container_of(atpx->handle, struct acpi_device, handle);
|
||||
struct device *dev = &adev->dev;
|
||||
|
||||
if (atpx->functions.px_params) {
|
||||
union acpi_object *info;
|
||||
@ -190,7 +199,7 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
|
||||
|
||||
size = *(u16 *) info->buffer.pointer;
|
||||
if (size < 10) {
|
||||
printk("ATPX buffer is too small: %zu\n", size);
|
||||
dev_err(dev, "ATPX buffer is too small: %zu\n", size);
|
||||
kfree(info);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -223,11 +232,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
|
||||
atpx->is_hybrid = false;
|
||||
if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
|
||||
if (amdgpu_atpx_priv.quirks & AMDGPU_PX_QUIRK_FORCE_ATPX) {
|
||||
printk("ATPX Hybrid Graphics, forcing to ATPX\n");
|
||||
dev_info(dev, "ATPX Hybrid Graphics, forcing to ATPX\n");
|
||||
atpx->functions.power_cntl = true;
|
||||
atpx->is_hybrid = false;
|
||||
} else {
|
||||
printk("ATPX Hybrid Graphics\n");
|
||||
dev_info(dev, "ATPX Hybrid Graphics\n");
|
||||
/*
|
||||
* Disable legacy PM methods only when pcie port PM is usable,
|
||||
* otherwise the device might fail to power off or power on.
|
||||
@ -260,6 +269,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
|
||||
struct atpx_verify_interface output;
|
||||
size_t size;
|
||||
int err = 0;
|
||||
struct acpi_device *adev = container_of(atpx->handle, struct acpi_device, handle);
|
||||
struct device *dev = &adev->dev;
|
||||
|
||||
info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL);
|
||||
if (!info)
|
||||
@ -278,8 +289,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
|
||||
memcpy(&output, info->buffer.pointer, size);
|
||||
|
||||
/* TODO: check version? */
|
||||
printk("ATPX version %u, functions 0x%08x\n",
|
||||
output.version, output.function_bits);
|
||||
dev_info(dev, "ATPX version %u, functions 0x%08x\n",
|
||||
output.version, output.function_bits);
|
||||
|
||||
amdgpu_atpx_parse_functions(&atpx->functions, output.function_bits);
|
||||
|
||||
|
@ -154,7 +154,7 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f,
|
||||
} else {
|
||||
r = get_user(value, (uint32_t *)buf);
|
||||
if (!r)
|
||||
amdgpu_mm_wreg_mmio_rlc(adev, *pos >> 2, value);
|
||||
amdgpu_mm_wreg_mmio_rlc(adev, *pos >> 2, value, 0);
|
||||
}
|
||||
if (r) {
|
||||
result = r;
|
||||
@ -283,7 +283,7 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off
|
||||
} else {
|
||||
r = get_user(value, (uint32_t *)buf);
|
||||
if (!r)
|
||||
amdgpu_mm_wreg_mmio_rlc(adev, offset >> 2, value);
|
||||
amdgpu_mm_wreg_mmio_rlc(adev, offset >> 2, value, rd->id.xcc_id);
|
||||
}
|
||||
if (r) {
|
||||
result = r;
|
||||
|
@ -159,7 +159,7 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev,
|
||||
return sysfs_emit(buf, "%llu\n", cnt);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(pcie_replay_count, S_IRUGO,
|
||||
static DEVICE_ATTR(pcie_replay_count, 0444,
|
||||
amdgpu_device_get_pcie_replay_count, NULL);
|
||||
|
||||
static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev);
|
||||
@ -183,7 +183,7 @@ static ssize_t amdgpu_device_get_product_name(struct device *dev,
|
||||
return sysfs_emit(buf, "%s\n", adev->product_name);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(product_name, S_IRUGO,
|
||||
static DEVICE_ATTR(product_name, 0444,
|
||||
amdgpu_device_get_product_name, NULL);
|
||||
|
||||
/**
|
||||
@ -205,7 +205,7 @@ static ssize_t amdgpu_device_get_product_number(struct device *dev,
|
||||
return sysfs_emit(buf, "%s\n", adev->product_number);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(product_number, S_IRUGO,
|
||||
static DEVICE_ATTR(product_number, 0444,
|
||||
amdgpu_device_get_product_number, NULL);
|
||||
|
||||
/**
|
||||
@ -227,7 +227,7 @@ static ssize_t amdgpu_device_get_serial_number(struct device *dev,
|
||||
return sysfs_emit(buf, "%s\n", adev->serial);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(serial_number, S_IRUGO,
|
||||
static DEVICE_ATTR(serial_number, 0444,
|
||||
amdgpu_device_get_serial_number, NULL);
|
||||
|
||||
/**
|
||||
@ -481,8 +481,7 @@ uint32_t amdgpu_device_rreg(struct amdgpu_device *adev,
|
||||
/*
|
||||
* MMIO register read with bytes helper functions
|
||||
* @offset:bytes offset from MMIO start
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* amdgpu_mm_rreg8 - read a memory mapped IO register
|
||||
@ -506,8 +505,8 @@ uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset)
|
||||
* MMIO register write with bytes helper functions
|
||||
* @offset:bytes offset from MMIO start
|
||||
* @value: the value want to be written to the register
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* amdgpu_mm_wreg8 - read a memory mapped IO register
|
||||
*
|
||||
@ -571,7 +570,8 @@ void amdgpu_device_wreg(struct amdgpu_device *adev,
|
||||
* this function is invoked only for the debugfs register access
|
||||
*/
|
||||
void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev,
|
||||
uint32_t reg, uint32_t v)
|
||||
uint32_t reg, uint32_t v,
|
||||
uint32_t xcc_id)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return;
|
||||
@ -580,7 +580,7 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev,
|
||||
adev->gfx.rlc.funcs &&
|
||||
adev->gfx.rlc.funcs->is_rlcg_access_range) {
|
||||
if (adev->gfx.rlc.funcs->is_rlcg_access_range(adev, reg))
|
||||
return amdgpu_sriov_wreg(adev, reg, v, 0, 0);
|
||||
return amdgpu_sriov_wreg(adev, reg, v, 0, 0, xcc_id);
|
||||
} else if ((reg * 4) >= adev->rmmio_size) {
|
||||
adev->pcie_wreg(adev, reg * 4, v);
|
||||
} else {
|
||||
@ -588,94 +588,6 @@ void amdgpu_mm_wreg_mmio_rlc(struct amdgpu_device *adev,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_rdoorbell - read a doorbell dword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
*
|
||||
* Returns the value in the doorbell aperture at the
|
||||
* requested doorbell index (CIK).
|
||||
*/
|
||||
u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return 0;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells) {
|
||||
return readl(adev->doorbell.ptr + index);
|
||||
} else {
|
||||
DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", index);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_wdoorbell - write a doorbell dword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
* @v: value to write
|
||||
*
|
||||
* Writes @v to the doorbell aperture at the
|
||||
* requested doorbell index (CIK).
|
||||
*/
|
||||
void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells) {
|
||||
writel(v, adev->doorbell.ptr + index);
|
||||
} else {
|
||||
DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_rdoorbell64 - read a doorbell Qword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
*
|
||||
* Returns the value in the doorbell aperture at the
|
||||
* requested doorbell index (VEGA10+).
|
||||
*/
|
||||
u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return 0;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells) {
|
||||
return atomic64_read((atomic64_t *)(adev->doorbell.ptr + index));
|
||||
} else {
|
||||
DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", index);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_wdoorbell64 - write a doorbell Qword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
* @v: value to write
|
||||
*
|
||||
* Writes @v to the doorbell aperture at the
|
||||
* requested doorbell index (VEGA10+).
|
||||
*/
|
||||
void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells) {
|
||||
atomic64_set((atomic64_t *)(adev->doorbell.ptr + index), v);
|
||||
} else {
|
||||
DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_indirect_rreg - read an indirect register
|
||||
*
|
||||
@ -1078,7 +990,7 @@ static void amdgpu_device_mem_scratch_fini(struct amdgpu_device *adev)
|
||||
* @registers: pointer to the register array
|
||||
* @array_size: size of the register array
|
||||
*
|
||||
* Programs an array or registers with and and or masks.
|
||||
* Programs an array or registers with and or masks.
|
||||
* This is a helper for setting golden registers.
|
||||
*/
|
||||
void amdgpu_device_program_register_sequence(struct amdgpu_device *adev,
|
||||
@ -1135,83 +1047,6 @@ int amdgpu_device_pci_reset(struct amdgpu_device *adev)
|
||||
return pci_reset_function(adev->pdev);
|
||||
}
|
||||
|
||||
/*
|
||||
* GPU doorbell aperture helpers function.
|
||||
*/
|
||||
/**
|
||||
* amdgpu_device_doorbell_init - Init doorbell driver information.
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
*
|
||||
* Init doorbell driver information (CIK)
|
||||
* Returns 0 on success, error on failure.
|
||||
*/
|
||||
static int amdgpu_device_doorbell_init(struct amdgpu_device *adev)
|
||||
{
|
||||
|
||||
/* No doorbell on SI hardware generation */
|
||||
if (adev->asic_type < CHIP_BONAIRE) {
|
||||
adev->doorbell.base = 0;
|
||||
adev->doorbell.size = 0;
|
||||
adev->doorbell.num_kernel_doorbells = 0;
|
||||
adev->doorbell.ptr = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pci_resource_flags(adev->pdev, 2) & IORESOURCE_UNSET)
|
||||
return -EINVAL;
|
||||
|
||||
amdgpu_asic_init_doorbell_index(adev);
|
||||
|
||||
/* doorbell bar mapping */
|
||||
adev->doorbell.base = pci_resource_start(adev->pdev, 2);
|
||||
adev->doorbell.size = pci_resource_len(adev->pdev, 2);
|
||||
|
||||
if (adev->enable_mes) {
|
||||
adev->doorbell.num_kernel_doorbells =
|
||||
adev->doorbell.size / sizeof(u32);
|
||||
} else {
|
||||
adev->doorbell.num_kernel_doorbells =
|
||||
min_t(u32, adev->doorbell.size / sizeof(u32),
|
||||
adev->doorbell_index.max_assignment+1);
|
||||
if (adev->doorbell.num_kernel_doorbells == 0)
|
||||
return -EINVAL;
|
||||
|
||||
/* For Vega, reserve and map two pages on doorbell BAR since SDMA
|
||||
* paging queue doorbell use the second page. The
|
||||
* AMDGPU_DOORBELL64_MAX_ASSIGNMENT definition assumes all the
|
||||
* doorbells are in the first page. So with paging queue enabled,
|
||||
* the max num_kernel_doorbells should + 1 page (0x400 in dword)
|
||||
*/
|
||||
if (adev->ip_versions[SDMA0_HWIP][0] >= IP_VERSION(4, 0, 0) &&
|
||||
adev->ip_versions[SDMA0_HWIP][0] < IP_VERSION(4, 2, 0))
|
||||
adev->doorbell.num_kernel_doorbells += 0x400;
|
||||
}
|
||||
|
||||
adev->doorbell.ptr = ioremap(adev->doorbell.base,
|
||||
adev->doorbell.num_kernel_doorbells *
|
||||
sizeof(u32));
|
||||
if (adev->doorbell.ptr == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_doorbell_fini - Tear down doorbell driver information.
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
*
|
||||
* Tear down doorbell driver information (CIK)
|
||||
*/
|
||||
static void amdgpu_device_doorbell_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
iounmap(adev->doorbell.ptr);
|
||||
adev->doorbell.ptr = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* amdgpu_device_wb_*()
|
||||
* Writeback is the method by which the GPU updates special pages in memory
|
||||
@ -1321,10 +1156,13 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
|
||||
int rbar_size = pci_rebar_bytes_to_size(adev->gmc.real_vram_size);
|
||||
struct pci_bus *root;
|
||||
struct resource *res;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
u16 cmd;
|
||||
int r;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT))
|
||||
return 0;
|
||||
|
||||
/* Bypass for VF */
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
@ -1359,7 +1197,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
|
||||
cmd & ~PCI_COMMAND_MEMORY);
|
||||
|
||||
/* Free the VRAM and doorbell BAR, we most likely need to move both. */
|
||||
amdgpu_device_doorbell_fini(adev);
|
||||
amdgpu_doorbell_fini(adev);
|
||||
if (adev->asic_type >= CHIP_BONAIRE)
|
||||
pci_release_resource(adev->pdev, 2);
|
||||
|
||||
@ -1376,7 +1214,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
|
||||
/* When the doorbell or fb BAR isn't available we have no chance of
|
||||
* using the device.
|
||||
*/
|
||||
r = amdgpu_device_doorbell_init(adev);
|
||||
r = amdgpu_doorbell_init(adev);
|
||||
if (r || (pci_resource_flags(adev->pdev, 0) & IORESOURCE_UNSET))
|
||||
return -ENODEV;
|
||||
|
||||
@ -1387,9 +1225,8 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
|
||||
|
||||
static bool amdgpu_device_read_bios(struct amdgpu_device *adev)
|
||||
{
|
||||
if (hweight32(adev->aid_mask) && (adev->flags & AMD_IS_APU)) {
|
||||
if (hweight32(adev->aid_mask) && (adev->flags & AMD_IS_APU))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1425,6 +1262,7 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
|
||||
if (adev->asic_type == CHIP_FIJI) {
|
||||
int err;
|
||||
uint32_t fw_ver;
|
||||
|
||||
err = request_firmware(&adev->pm.fw, "amdgpu/fiji_smc.bin", adev->dev);
|
||||
/* force vPost if error occured */
|
||||
if (err)
|
||||
@ -1527,6 +1365,7 @@ static unsigned int amdgpu_device_vga_set_decode(struct pci_dev *pdev,
|
||||
bool state)
|
||||
{
|
||||
struct amdgpu_device *adev = drm_to_adev(pci_get_drvdata(pdev));
|
||||
|
||||
amdgpu_asic_set_vga_state(adev, state);
|
||||
if (state)
|
||||
return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
|
||||
@ -1549,7 +1388,8 @@ static void amdgpu_device_check_block_size(struct amdgpu_device *adev)
|
||||
{
|
||||
/* defines number of bits in page table versus page directory,
|
||||
* a page is 4KB so we have 12 bits offset, minimum 9 bits in the
|
||||
* page table and the remaining bits are in the page directory */
|
||||
* page table and the remaining bits are in the page directory
|
||||
*/
|
||||
if (amdgpu_vm_block_size == -1)
|
||||
return;
|
||||
|
||||
@ -1781,7 +1621,7 @@ static bool amdgpu_switcheroo_can_switch(struct pci_dev *pdev)
|
||||
{
|
||||
struct drm_device *dev = pci_get_drvdata(pdev);
|
||||
|
||||
/*
|
||||
/*
|
||||
* FIXME: open_count is protected by drm_global_mutex but that would lead to
|
||||
* locking inversion with the driver load path. And the access here is
|
||||
* completely racy anyway. So don't bother with locking for now.
|
||||
@ -3426,7 +3266,7 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
|
||||
*
|
||||
* Main resume function for hardware IPs. The hardware IPs
|
||||
* are split into two resume functions because they are
|
||||
* are also used in in recovering from a GPU reset and some additional
|
||||
* also used in recovering from a GPU reset and some additional
|
||||
* steps need to be take between them. In this case (S3/S4) they are
|
||||
* run sequentially.
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
@ -3528,8 +3368,7 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
|
||||
#else
|
||||
default:
|
||||
if (amdgpu_dc > 0)
|
||||
DRM_INFO_ONCE("Display Core has been requested via kernel parameter "
|
||||
"but isn't supported by ASIC, ignoring\n");
|
||||
DRM_INFO_ONCE("Display Core has been requested via kernel parameter but isn't supported by ASIC, ignoring\n");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@ -3777,7 +3616,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
pdev->subsystem_vendor, pdev->subsystem_device, pdev->revision);
|
||||
|
||||
/* mutex initialization are all done here so we
|
||||
* can recall function without having locking issues */
|
||||
* can recall function without having locking issues
|
||||
*/
|
||||
mutex_init(&adev->firmware.mutex);
|
||||
mutex_init(&adev->pm.mutex);
|
||||
mutex_init(&adev->gfx.gpu_clock_mutex);
|
||||
@ -3854,11 +3694,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
atomic_set(&adev->pm.pwr_state[i], POWER_STATE_UNKNOWN);
|
||||
|
||||
adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size);
|
||||
if (adev->rmmio == NULL) {
|
||||
if (!adev->rmmio)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base);
|
||||
DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size);
|
||||
DRM_INFO("register mmio size: %u\n", (unsigned int)adev->rmmio_size);
|
||||
|
||||
/*
|
||||
* Reset domain needs to be present early, before XGMI hive discovered
|
||||
@ -3926,7 +3766,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
dev_info(adev->dev, "PCIE atomic ops is not supported\n");
|
||||
|
||||
/* doorbell bar mapping and doorbell index init*/
|
||||
amdgpu_device_doorbell_init(adev);
|
||||
amdgpu_doorbell_init(adev);
|
||||
|
||||
if (amdgpu_emu_mode == 1) {
|
||||
/* post the asic on emulation mode */
|
||||
@ -4069,14 +3909,6 @@ fence_driver_init:
|
||||
} else
|
||||
adev->ucode_sysfs_en = true;
|
||||
|
||||
r = amdgpu_psp_sysfs_init(adev);
|
||||
if (r) {
|
||||
adev->psp_sysfs_en = false;
|
||||
if (!amdgpu_sriov_vf(adev))
|
||||
DRM_ERROR("Creating psp sysfs failed\n");
|
||||
} else
|
||||
adev->psp_sysfs_en = true;
|
||||
|
||||
/*
|
||||
* Register gpu instance before amdgpu_device_enable_mgpu_fan_boost.
|
||||
* Otherwise the mgpu fan boost feature will be skipped due to the
|
||||
@ -4120,7 +3952,8 @@ fence_driver_init:
|
||||
|
||||
/* if we have > 1 VGA cards, then disable the amdgpu VGA resources */
|
||||
/* this will fail for cards that aren't VGA class devices, just
|
||||
* ignore it */
|
||||
* ignore it
|
||||
*/
|
||||
if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
|
||||
vga_client_register(adev->pdev, amdgpu_device_vga_set_decode);
|
||||
|
||||
@ -4172,7 +4005,7 @@ static void amdgpu_device_unmap_mmio(struct amdgpu_device *adev)
|
||||
unmap_mapping_range(adev->ddev.anon_inode->i_mapping, 0, 0, 1);
|
||||
|
||||
/* Unmap all mapped bars - Doorbell, registers and VRAM */
|
||||
amdgpu_device_doorbell_fini(adev);
|
||||
amdgpu_doorbell_fini(adev);
|
||||
|
||||
iounmap(adev->rmmio);
|
||||
adev->rmmio = NULL;
|
||||
@ -4203,7 +4036,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
|
||||
|
||||
/* make sure IB test finished before entering exclusive mode
|
||||
* to avoid preemption on IB test
|
||||
* */
|
||||
*/
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
amdgpu_virt_request_full_gpu(adev, false);
|
||||
amdgpu_virt_fini_data_exchange(adev);
|
||||
@ -4226,8 +4059,6 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
|
||||
amdgpu_pm_sysfs_fini(adev);
|
||||
if (adev->ucode_sysfs_en)
|
||||
amdgpu_ucode_sysfs_fini(adev);
|
||||
if (adev->psp_sysfs_en)
|
||||
amdgpu_psp_sysfs_fini(adev);
|
||||
sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
|
||||
|
||||
/* disable ras feature must before hw fini */
|
||||
@ -4286,7 +4117,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
||||
|
||||
iounmap(adev->rmmio);
|
||||
adev->rmmio = NULL;
|
||||
amdgpu_device_doorbell_fini(adev);
|
||||
amdgpu_doorbell_fini(adev);
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
@ -4746,6 +4577,9 @@ retry:
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
/* some sw clean up VF needs to do before recover */
|
||||
amdgpu_virt_post_reset(adev);
|
||||
|
||||
/* Resume IP prior to SMC */
|
||||
r = amdgpu_device_ip_reinit_early_sriov(adev);
|
||||
if (r)
|
||||
@ -4939,8 +4773,9 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
|
||||
if (!ring || !ring->sched.thread)
|
||||
continue;
|
||||
|
||||
/*clear job fence from fence drv to avoid force_completion
|
||||
*leave NULL and vm flush fence in fence drv */
|
||||
/* Clear job fence from fence drv to avoid force_completion
|
||||
* leave NULL and vm flush fence in fence drv
|
||||
*/
|
||||
amdgpu_fence_driver_clear_job_fences(ring);
|
||||
|
||||
/* after all hw jobs are reset, hw fence is meaningless, so force_completion */
|
||||
@ -4954,7 +4789,7 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
|
||||
|
||||
r = amdgpu_reset_prepare_hwcontext(adev, reset_context);
|
||||
/* If reset handler not implemented, continue; otherwise return */
|
||||
if (r == -ENOSYS)
|
||||
if (r == -EOPNOTSUPP)
|
||||
r = 0;
|
||||
else
|
||||
return r;
|
||||
@ -5072,7 +4907,7 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
|
||||
reset_context->reset_device_list = device_list_handle;
|
||||
r = amdgpu_reset_perform_reset(tmp_adev, reset_context);
|
||||
/* If reset handler not implemented, continue; otherwise return */
|
||||
if (r == -ENOSYS)
|
||||
if (r == -EOPNOTSUPP)
|
||||
r = 0;
|
||||
else
|
||||
return r;
|
||||
@ -5561,9 +5396,8 @@ skip_hw_reset:
|
||||
if (adev->enable_mes && adev->ip_versions[GC_HWIP][0] != IP_VERSION(11, 0, 3))
|
||||
amdgpu_mes_self_test(tmp_adev);
|
||||
|
||||
if (!drm_drv_uses_atomic_modeset(adev_to_drm(tmp_adev)) && !job_signaled) {
|
||||
if (!drm_drv_uses_atomic_modeset(adev_to_drm(tmp_adev)) && !job_signaled)
|
||||
drm_helper_resume_force_mode(adev_to_drm(tmp_adev));
|
||||
}
|
||||
|
||||
if (tmp_adev->asic_reset_res)
|
||||
r = tmp_adev->asic_reset_res;
|
||||
|
@ -1750,6 +1750,7 @@ static int amdgpu_discovery_set_psp_ip_blocks(struct amdgpu_device *adev)
|
||||
case IP_VERSION(13, 0, 8):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
case IP_VERSION(13, 0, 11):
|
||||
case IP_VERSION(14, 0, 0):
|
||||
amdgpu_device_ip_block_add(adev, &psp_v13_0_ip_block);
|
||||
break;
|
||||
case IP_VERSION(13, 0, 4):
|
||||
|
@ -124,7 +124,7 @@ static void amdgpu_display_flip_work_func(struct work_struct *__work)
|
||||
|
||||
struct drm_crtc *crtc = &amdgpu_crtc->base;
|
||||
unsigned long flags;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int vpos, hpos;
|
||||
|
||||
for (i = 0; i < work->shared_count; ++i)
|
||||
@ -201,7 +201,7 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
|
||||
u64 tiling_flags;
|
||||
int i, r;
|
||||
|
||||
work = kzalloc(sizeof *work, GFP_KERNEL);
|
||||
work = kzalloc(sizeof(*work), GFP_KERNEL);
|
||||
if (work == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -332,13 +332,15 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
|
||||
|
||||
adev = drm_to_adev(dev);
|
||||
/* if we have active crtcs and we don't have a power ref,
|
||||
take the current one */
|
||||
* take the current one
|
||||
*/
|
||||
if (active && !adev->have_disp_power_ref) {
|
||||
adev->have_disp_power_ref = true;
|
||||
return ret;
|
||||
}
|
||||
/* if we have no active crtcs, then drop the power ref
|
||||
we got before */
|
||||
* we got before
|
||||
*/
|
||||
if (!active && adev->have_disp_power_ref) {
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
adev->have_disp_power_ref = false;
|
||||
@ -507,11 +509,10 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
|
||||
if (amdgpu_connector->router.ddc_valid)
|
||||
amdgpu_i2c_router_select_ddc_port(amdgpu_connector);
|
||||
|
||||
if (use_aux) {
|
||||
if (use_aux)
|
||||
ret = i2c_transfer(&amdgpu_connector->ddc_bus->aux.ddc, msgs, 2);
|
||||
} else {
|
||||
else
|
||||
ret = i2c_transfer(&amdgpu_connector->ddc_bus->adapter, msgs, 2);
|
||||
}
|
||||
|
||||
if (ret != 2)
|
||||
/* Couldn't find an accessible DDC on this connector */
|
||||
@ -520,10 +521,12 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
|
||||
* EDID header starts with:
|
||||
* 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00.
|
||||
* Only the first 6 bytes must be valid as
|
||||
* drm_edid_block_valid() can fix the last 2 bytes */
|
||||
* drm_edid_block_valid() can fix the last 2 bytes
|
||||
*/
|
||||
if (drm_edid_header_is_valid(buf) < 6) {
|
||||
/* Couldn't find an accessible EDID on this
|
||||
* connector */
|
||||
* connector
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1216,8 +1219,10 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
|
||||
|
||||
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]);
|
||||
if (obj == NULL) {
|
||||
drm_dbg_kms(dev, "No GEM object associated to handle 0x%08X, "
|
||||
"can't create framebuffer\n", mode_cmd->handles[0]);
|
||||
drm_dbg_kms(dev,
|
||||
"No GEM object associated to handle 0x%08X, can't create framebuffer\n",
|
||||
mode_cmd->handles[0]);
|
||||
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
|
||||
@ -1410,6 +1415,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
||||
}
|
||||
if (amdgpu_crtc->rmx_type != RMX_OFF) {
|
||||
fixed20_12 a, b;
|
||||
|
||||
a.full = dfixed_const(src_v);
|
||||
b.full = dfixed_const(dst_v);
|
||||
amdgpu_crtc->vsc.full = dfixed_div(a, b);
|
||||
@ -1429,7 +1435,7 @@ bool amdgpu_display_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
||||
*
|
||||
* \param dev Device to query.
|
||||
* \param pipe Crtc to query.
|
||||
* \param flags Flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* \param flags from caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* For driver internal use only also supports these flags:
|
||||
*
|
||||
* USE_REAL_VBLANKSTART to use the real start of vblank instead
|
||||
@ -1504,8 +1510,8 @@ int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
|
||||
|
||||
/* Called from driver internal vblank counter query code? */
|
||||
if (flags & GET_DISTANCE_TO_VBLANKSTART) {
|
||||
/* Caller wants distance from real vbl_start in *hpos */
|
||||
*hpos = *vpos - vbl_start;
|
||||
/* Caller wants distance from real vbl_start in *hpos */
|
||||
*hpos = *vpos - vbl_start;
|
||||
}
|
||||
|
||||
/* Fudge vblank to start a few scanlines earlier to handle the
|
||||
@ -1527,7 +1533,7 @@ int amdgpu_display_get_crtc_scanoutpos(struct drm_device *dev,
|
||||
|
||||
/* In vblank? */
|
||||
if (in_vbl)
|
||||
ret |= DRM_SCANOUTPOS_IN_VBLANK;
|
||||
ret |= DRM_SCANOUTPOS_IN_VBLANK;
|
||||
|
||||
/* Called from driver internal vblank counter query code? */
|
||||
if (flags & GET_DISTANCE_TO_VBLANKSTART) {
|
||||
@ -1635,6 +1641,7 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
|
||||
|
||||
if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) {
|
||||
struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
|
||||
|
||||
r = amdgpu_bo_reserve(aobj, true);
|
||||
if (r == 0) {
|
||||
amdgpu_bo_unpin(aobj);
|
||||
@ -1642,9 +1649,9 @@ int amdgpu_display_suspend_helper(struct amdgpu_device *adev)
|
||||
}
|
||||
}
|
||||
|
||||
if (fb == NULL || fb->obj[0] == NULL) {
|
||||
if (!fb || !fb->obj[0])
|
||||
continue;
|
||||
}
|
||||
|
||||
robj = gem_to_amdgpu_bo(fb->obj[0]);
|
||||
if (!amdgpu_display_robj_is_fb(adev, robj)) {
|
||||
r = amdgpu_bo_reserve(robj, true);
|
||||
@ -1671,6 +1678,7 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev)
|
||||
|
||||
if (amdgpu_crtc->cursor_bo && !adev->enable_virtual_display) {
|
||||
struct amdgpu_bo *aobj = gem_to_amdgpu_bo(amdgpu_crtc->cursor_bo);
|
||||
|
||||
r = amdgpu_bo_reserve(aobj, true);
|
||||
if (r == 0) {
|
||||
r = amdgpu_bo_pin(aobj, AMDGPU_GEM_DOMAIN_VRAM);
|
||||
|
@ -90,8 +90,7 @@ struct amdgpu_doorbell_index {
|
||||
uint32_t xcc_doorbell_range;
|
||||
};
|
||||
|
||||
typedef enum _AMDGPU_DOORBELL_ASSIGNMENT
|
||||
{
|
||||
enum AMDGPU_DOORBELL_ASSIGNMENT {
|
||||
AMDGPU_DOORBELL_KIQ = 0x000,
|
||||
AMDGPU_DOORBELL_HIQ = 0x001,
|
||||
AMDGPU_DOORBELL_DIQ = 0x002,
|
||||
@ -109,10 +108,10 @@ typedef enum _AMDGPU_DOORBELL_ASSIGNMENT
|
||||
AMDGPU_DOORBELL_IH = 0x1E8,
|
||||
AMDGPU_DOORBELL_MAX_ASSIGNMENT = 0x3FF,
|
||||
AMDGPU_DOORBELL_INVALID = 0xFFFF
|
||||
} AMDGPU_DOORBELL_ASSIGNMENT;
|
||||
};
|
||||
|
||||
enum AMDGPU_VEGA20_DOORBELL_ASSIGNMENT {
|
||||
|
||||
typedef enum _AMDGPU_VEGA20_DOORBELL_ASSIGNMENT
|
||||
{
|
||||
/* Compute + GFX: 0~255 */
|
||||
AMDGPU_VEGA20_DOORBELL_KIQ = 0x000,
|
||||
AMDGPU_VEGA20_DOORBELL_HIQ = 0x001,
|
||||
@ -176,10 +175,10 @@ typedef enum _AMDGPU_VEGA20_DOORBELL_ASSIGNMENT
|
||||
|
||||
AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT = 0x1F7,
|
||||
AMDGPU_VEGA20_DOORBELL_INVALID = 0xFFFF
|
||||
} AMDGPU_VEGA20_DOORBELL_ASSIGNMENT;
|
||||
};
|
||||
|
||||
enum AMDGPU_NAVI10_DOORBELL_ASSIGNMENT {
|
||||
|
||||
typedef enum _AMDGPU_NAVI10_DOORBELL_ASSIGNMENT
|
||||
{
|
||||
/* Compute + GFX: 0~255 */
|
||||
AMDGPU_NAVI10_DOORBELL_KIQ = 0x000,
|
||||
AMDGPU_NAVI10_DOORBELL_HIQ = 0x001,
|
||||
@ -227,13 +226,12 @@ typedef enum _AMDGPU_NAVI10_DOORBELL_ASSIGNMENT
|
||||
|
||||
AMDGPU_NAVI10_DOORBELL_MAX_ASSIGNMENT = 0x18F,
|
||||
AMDGPU_NAVI10_DOORBELL_INVALID = 0xFFFF
|
||||
} AMDGPU_NAVI10_DOORBELL_ASSIGNMENT;
|
||||
};
|
||||
|
||||
/*
|
||||
* 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space
|
||||
*/
|
||||
typedef enum _AMDGPU_DOORBELL64_ASSIGNMENT
|
||||
{
|
||||
enum AMDGPU_DOORBELL64_ASSIGNMENT {
|
||||
/*
|
||||
* All compute related doorbells: kiq, hiq, diq, traditional compute queue, user queue, should locate in
|
||||
* a continues range so that programming CP_MEC_DOORBELL_RANGE_LOWER/UPPER can cover this range.
|
||||
@ -309,9 +307,10 @@ typedef enum _AMDGPU_DOORBELL64_ASSIGNMENT
|
||||
|
||||
AMDGPU_DOORBELL64_MAX_ASSIGNMENT = 0xFF,
|
||||
AMDGPU_DOORBELL64_INVALID = 0xFFFF
|
||||
} AMDGPU_DOORBELL64_ASSIGNMENT;
|
||||
};
|
||||
|
||||
enum AMDGPU_DOORBELL_ASSIGNMENT_LAYOUT1 {
|
||||
|
||||
typedef enum _AMDGPU_DOORBELL_ASSIGNMENT_LAYOUT1 {
|
||||
/* XCC0: 0x00 ~20, XCC1: 20 ~ 2F ... */
|
||||
|
||||
/* KIQ/HIQ/DIQ */
|
||||
@ -339,13 +338,19 @@ typedef enum _AMDGPU_DOORBELL_ASSIGNMENT_LAYOUT1 {
|
||||
|
||||
AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT = 0x1D4,
|
||||
AMDGPU_DOORBELL_LAYOUT1_INVALID = 0xFFFF
|
||||
} AMDGPU_DOORBELL_ASSIGNMENT_LAYOUT1;
|
||||
};
|
||||
|
||||
u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index);
|
||||
void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v);
|
||||
u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index);
|
||||
void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v);
|
||||
|
||||
/*
|
||||
* GPU doorbell aperture helpers function.
|
||||
*/
|
||||
int amdgpu_doorbell_init(struct amdgpu_device *adev);
|
||||
void amdgpu_doorbell_fini(struct amdgpu_device *adev);
|
||||
|
||||
#define RDOORBELL32(index) amdgpu_mm_rdoorbell(adev, (index))
|
||||
#define WDOORBELL32(index, v) amdgpu_mm_wdoorbell(adev, (index), (v))
|
||||
#define RDOORBELL64(index) amdgpu_mm_rdoorbell64(adev, (index))
|
||||
|
183
drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
Normal file
183
drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
Normal file
@ -0,0 +1,183 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright 2022 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
||||
/**
|
||||
* amdgpu_mm_rdoorbell - read a doorbell dword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
*
|
||||
* Returns the value in the doorbell aperture at the
|
||||
* requested doorbell index (CIK).
|
||||
*/
|
||||
u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return 0;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells)
|
||||
return readl(adev->doorbell.ptr + index);
|
||||
|
||||
DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_wdoorbell - write a doorbell dword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
* @v: value to write
|
||||
*
|
||||
* Writes @v to the doorbell aperture at the
|
||||
* requested doorbell index (CIK).
|
||||
*/
|
||||
void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells)
|
||||
writel(v, adev->doorbell.ptr + index);
|
||||
else
|
||||
DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index);
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_rdoorbell64 - read a doorbell Qword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
*
|
||||
* Returns the value in the doorbell aperture at the
|
||||
* requested doorbell index (VEGA10+).
|
||||
*/
|
||||
u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return 0;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells)
|
||||
return atomic64_read((atomic64_t *)(adev->doorbell.ptr + index));
|
||||
|
||||
DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_mm_wdoorbell64 - write a doorbell Qword
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @index: doorbell index
|
||||
* @v: value to write
|
||||
*
|
||||
* Writes @v to the doorbell aperture at the
|
||||
* requested doorbell index (VEGA10+).
|
||||
*/
|
||||
void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v)
|
||||
{
|
||||
if (amdgpu_device_skip_hw_access(adev))
|
||||
return;
|
||||
|
||||
if (index < adev->doorbell.num_kernel_doorbells)
|
||||
atomic64_set((atomic64_t *)(adev->doorbell.ptr + index), v);
|
||||
else
|
||||
DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index);
|
||||
}
|
||||
|
||||
/*
|
||||
* GPU doorbell aperture helpers function.
|
||||
*/
|
||||
/**
|
||||
* amdgpu_doorbell_init - Init doorbell driver information.
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
*
|
||||
* Init doorbell driver information (CIK)
|
||||
* Returns 0 on success, error on failure.
|
||||
*/
|
||||
int amdgpu_doorbell_init(struct amdgpu_device *adev)
|
||||
{
|
||||
|
||||
/* No doorbell on SI hardware generation */
|
||||
if (adev->asic_type < CHIP_BONAIRE) {
|
||||
adev->doorbell.base = 0;
|
||||
adev->doorbell.size = 0;
|
||||
adev->doorbell.num_kernel_doorbells = 0;
|
||||
adev->doorbell.ptr = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pci_resource_flags(adev->pdev, 2) & IORESOURCE_UNSET)
|
||||
return -EINVAL;
|
||||
|
||||
amdgpu_asic_init_doorbell_index(adev);
|
||||
|
||||
/* doorbell bar mapping */
|
||||
adev->doorbell.base = pci_resource_start(adev->pdev, 2);
|
||||
adev->doorbell.size = pci_resource_len(adev->pdev, 2);
|
||||
|
||||
if (adev->enable_mes) {
|
||||
adev->doorbell.num_kernel_doorbells =
|
||||
adev->doorbell.size / sizeof(u32);
|
||||
} else {
|
||||
adev->doorbell.num_kernel_doorbells =
|
||||
min_t(u32, adev->doorbell.size / sizeof(u32),
|
||||
adev->doorbell_index.max_assignment+1);
|
||||
if (adev->doorbell.num_kernel_doorbells == 0)
|
||||
return -EINVAL;
|
||||
|
||||
/* For Vega, reserve and map two pages on doorbell BAR since SDMA
|
||||
* paging queue doorbell use the second page. The
|
||||
* AMDGPU_DOORBELL64_MAX_ASSIGNMENT definition assumes all the
|
||||
* doorbells are in the first page. So with paging queue enabled,
|
||||
* the max num_kernel_doorbells should + 1 page (0x400 in dword)
|
||||
*/
|
||||
if (adev->asic_type >= CHIP_VEGA10)
|
||||
adev->doorbell.num_kernel_doorbells += 0x400;
|
||||
}
|
||||
|
||||
adev->doorbell.ptr = ioremap(adev->doorbell.base,
|
||||
adev->doorbell.num_kernel_doorbells *
|
||||
sizeof(u32));
|
||||
if (adev->doorbell.ptr == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_doorbell_fini - Tear down doorbell driver information.
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
*
|
||||
* Tear down doorbell driver information (CIK)
|
||||
*/
|
||||
void amdgpu_doorbell_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
iounmap(adev->doorbell.ptr);
|
||||
adev->doorbell.ptr = NULL;
|
||||
}
|
@ -313,9 +313,7 @@ module_param_named(msi, amdgpu_msi, int, 0444);
|
||||
* jobs is 10000. The timeout for compute is 60000.
|
||||
*/
|
||||
MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default: for bare metal 10000 for non-compute jobs and 60000 for compute jobs; "
|
||||
"for passthrough or sriov, 10000 for all jobs."
|
||||
" 0: keep default value. negative: infinity timeout), "
|
||||
"format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
|
||||
"for passthrough or sriov, 10000 for all jobs. 0: keep default value. negative: infinity timeout), format: for bare metal [Non-Compute] or [GFX,Compute,SDMA,Video]; "
|
||||
"for passthrough or sriov [all jobs] or [GFX,Compute,SDMA,Video].");
|
||||
module_param_string(lockup_timeout, amdgpu_lockup_timeout, sizeof(amdgpu_lockup_timeout), 0444);
|
||||
|
||||
@ -584,7 +582,7 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);
|
||||
*/
|
||||
#ifdef CONFIG_DRM_AMDGPU_SI
|
||||
|
||||
#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
|
||||
#if IS_ENABLED(CONFIG_DRM_RADEON) || IS_ENABLED(CONFIG_DRM_RADEON_MODULE)
|
||||
int amdgpu_si_support = 0;
|
||||
MODULE_PARM_DESC(si_support, "SI support (1 = enabled, 0 = disabled (default))");
|
||||
#else
|
||||
@ -603,7 +601,7 @@ module_param_named(si_support, amdgpu_si_support, int, 0444);
|
||||
*/
|
||||
#ifdef CONFIG_DRM_AMDGPU_CIK
|
||||
|
||||
#if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE)
|
||||
#if IS_ENABLED(CONFIG_DRM_RADEON) || IS_ENABLED(CONFIG_DRM_RADEON_MODULE)
|
||||
int amdgpu_cik_support = 0;
|
||||
MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled, 0 = disabled (default))");
|
||||
#else
|
||||
@ -620,8 +618,7 @@ module_param_named(cik_support, amdgpu_cik_support, int, 0444);
|
||||
* E.g. 0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte. The default is 0 (disabled).
|
||||
*/
|
||||
MODULE_PARM_DESC(smu_memory_pool_size,
|
||||
"reserve gtt for smu debug usage, 0 = disable,"
|
||||
"0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
|
||||
"reserve gtt for smu debug usage, 0 = disable,0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
|
||||
module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
|
||||
|
||||
/**
|
||||
@ -791,9 +788,9 @@ module_param(hws_gws_support, bool, 0444);
|
||||
MODULE_PARM_DESC(hws_gws_support, "Assume MEC2 FW supports GWS barriers (false = rely on FW version check (Default), true = force supported)");
|
||||
|
||||
/**
|
||||
* DOC: queue_preemption_timeout_ms (int)
|
||||
* queue preemption timeout in ms (1 = Minimum, 9000 = default)
|
||||
*/
|
||||
* DOC: queue_preemption_timeout_ms (int)
|
||||
* queue preemption timeout in ms (1 = Minimum, 9000 = default)
|
||||
*/
|
||||
int queue_preemption_timeout_ms = 9000;
|
||||
module_param(queue_preemption_timeout_ms, int, 0644);
|
||||
MODULE_PARM_DESC(queue_preemption_timeout_ms, "queue preemption timeout in ms (1 = Minimum, 9000 = default)");
|
||||
@ -2417,7 +2414,6 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)
|
||||
amdgpu_amdkfd_device_init(adev);
|
||||
amdgpu_ttm_set_buffer_funcs_status(adev, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static int amdgpu_pmops_prepare(struct device *dev)
|
||||
@ -2614,6 +2610,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
|
||||
/* wait for all rings to drain before suspending */
|
||||
for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
|
||||
struct amdgpu_ring *ring = adev->rings[i];
|
||||
|
||||
if (ring && ring->sched.ready) {
|
||||
ret = amdgpu_fence_wait_empty(ring);
|
||||
if (ret)
|
||||
@ -2738,6 +2735,7 @@ long amdgpu_drm_ioctl(struct file *filp,
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
struct drm_device *dev;
|
||||
long ret;
|
||||
|
||||
dev = file_priv->minor->dev;
|
||||
ret = pm_runtime_get_sync(dev->dev);
|
||||
if (ret < 0)
|
||||
@ -2802,9 +2800,8 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
|
||||
if (!filp)
|
||||
return -EINVAL;
|
||||
|
||||
if (filp->f_op != &amdgpu_driver_kms_fops) {
|
||||
if (filp->f_op != &amdgpu_driver_kms_fops)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
file = filp->private_data;
|
||||
*fpriv = file->driver_priv;
|
||||
@ -2891,16 +2888,13 @@ static struct pci_error_handlers amdgpu_pci_err_handler = {
|
||||
.resume = amdgpu_pci_resume,
|
||||
};
|
||||
|
||||
extern const struct attribute_group amdgpu_vram_mgr_attr_group;
|
||||
extern const struct attribute_group amdgpu_gtt_mgr_attr_group;
|
||||
|
||||
static const struct attribute_group *amdgpu_sysfs_groups[] = {
|
||||
&amdgpu_vram_mgr_attr_group,
|
||||
&amdgpu_gtt_mgr_attr_group,
|
||||
&amdgpu_flash_attr_group,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
static struct pci_driver amdgpu_kms_pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = pciidlist,
|
||||
|
@ -183,6 +183,8 @@ static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
|
||||
{
|
||||
const struct i2c_adapter_quirks *quirks = i2c_adap->quirks;
|
||||
u16 limit;
|
||||
u16 ps; /* Partial size */
|
||||
int res = 0, r;
|
||||
|
||||
if (!quirks)
|
||||
limit = 0;
|
||||
@ -200,28 +202,25 @@ static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
|
||||
eeprom_addr, buf_size,
|
||||
read ? "read" : "write", EEPROM_OFFSET_SIZE);
|
||||
return -EINVAL;
|
||||
} else {
|
||||
u16 ps; /* Partial size */
|
||||
int res = 0, r;
|
||||
|
||||
/* The "limit" includes all data bytes sent/received,
|
||||
* which would include the EEPROM_OFFSET_SIZE bytes.
|
||||
* Account for them here.
|
||||
*/
|
||||
limit -= EEPROM_OFFSET_SIZE;
|
||||
for ( ; buf_size > 0;
|
||||
buf_size -= ps, eeprom_addr += ps, eeprom_buf += ps) {
|
||||
ps = min(limit, buf_size);
|
||||
|
||||
r = __amdgpu_eeprom_xfer(i2c_adap, eeprom_addr,
|
||||
eeprom_buf, ps, read);
|
||||
if (r < 0)
|
||||
return r;
|
||||
res += r;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* The "limit" includes all data bytes sent/received,
|
||||
* which would include the EEPROM_OFFSET_SIZE bytes.
|
||||
* Account for them here.
|
||||
*/
|
||||
limit -= EEPROM_OFFSET_SIZE;
|
||||
for ( ; buf_size > 0;
|
||||
buf_size -= ps, eeprom_addr += ps, eeprom_buf += ps) {
|
||||
ps = min(limit, buf_size);
|
||||
|
||||
r = __amdgpu_eeprom_xfer(i2c_adap, eeprom_addr,
|
||||
eeprom_buf, ps, read);
|
||||
if (r < 0)
|
||||
return r;
|
||||
res += r;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int amdgpu_eeprom_read(struct i2c_adapter *i2c_adap,
|
||||
|
@ -89,7 +89,7 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
|
||||
drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
|
||||
drm_printf(p, "drm-driver:\t%s\n", file->minor->dev->driver->name);
|
||||
drm_printf(p, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
|
||||
drm_printf(p, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
|
||||
drm_printf(p, "drm-client-id:\t%llu\n", vm->immediate.fence_context);
|
||||
drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
|
||||
drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
|
||||
drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
|
||||
@ -109,7 +109,7 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
|
||||
if (!usage[hw_ip])
|
||||
continue;
|
||||
|
||||
drm_printf(p, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip],
|
||||
drm_printf(p, "drm-engine-%s:\t%lld ns\n", amdgpu_ip_name[hw_ip],
|
||||
ktime_to_ns(usage[hw_ip]));
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev, u32 *fru_addr)
|
||||
switch (adev->asic_type) {
|
||||
case CHIP_VEGA20:
|
||||
/* D161 and D163 are the VG20 server SKUs */
|
||||
if (strnstr(atom_ctx->vbios_version, "D161",
|
||||
sizeof(atom_ctx->vbios_version)) ||
|
||||
strnstr(atom_ctx->vbios_version, "D163",
|
||||
sizeof(atom_ctx->vbios_version))) {
|
||||
if (strnstr(atom_ctx->vbios_pn, "D161",
|
||||
sizeof(atom_ctx->vbios_pn)) ||
|
||||
strnstr(atom_ctx->vbios_pn, "D163",
|
||||
sizeof(atom_ctx->vbios_pn))) {
|
||||
if (fru_addr)
|
||||
*fru_addr = FRU_EEPROM_MADDR_6;
|
||||
return true;
|
||||
@ -72,22 +72,23 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev, u32 *fru_addr)
|
||||
}
|
||||
case CHIP_ALDEBARAN:
|
||||
/* All Aldebaran SKUs have an FRU */
|
||||
if (!strnstr(atom_ctx->vbios_version, "D673",
|
||||
sizeof(atom_ctx->vbios_version)))
|
||||
if (!strnstr(atom_ctx->vbios_pn, "D673",
|
||||
sizeof(atom_ctx->vbios_pn)))
|
||||
if (fru_addr)
|
||||
*fru_addr = FRU_EEPROM_MADDR_6;
|
||||
return true;
|
||||
case CHIP_SIENNA_CICHLID:
|
||||
if (strnstr(atom_ctx->vbios_version, "D603",
|
||||
sizeof(atom_ctx->vbios_version))) {
|
||||
if (strnstr(atom_ctx->vbios_version, "D603GLXE",
|
||||
sizeof(atom_ctx->vbios_version))) {
|
||||
if (strnstr(atom_ctx->vbios_pn, "D603",
|
||||
sizeof(atom_ctx->vbios_pn))) {
|
||||
if (strnstr(atom_ctx->vbios_pn, "D603GLXE",
|
||||
sizeof(atom_ctx->vbios_pn))) {
|
||||
return false;
|
||||
} else {
|
||||
if (fru_addr)
|
||||
*fru_addr = FRU_EEPROM_MADDR_6;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fru_addr)
|
||||
*fru_addr = FRU_EEPROM_MADDR_6;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -32,17 +32,15 @@
|
||||
#include "soc15_common.h"
|
||||
|
||||
#define FW_ATTESTATION_DB_COOKIE 0x143b6a37
|
||||
#define FW_ATTESTATION_RECORD_VALID 1
|
||||
#define FW_ATTESTATION_RECORD_VALID 1
|
||||
#define FW_ATTESTATION_MAX_SIZE 4096
|
||||
|
||||
typedef struct FW_ATT_DB_HEADER
|
||||
{
|
||||
struct FW_ATT_DB_HEADER {
|
||||
uint32_t AttDbVersion; /* version of the fwar feature */
|
||||
uint32_t AttDbCookie; /* cookie as an extra check for corrupt data */
|
||||
} FW_ATT_DB_HEADER;
|
||||
};
|
||||
|
||||
typedef struct FW_ATT_RECORD
|
||||
{
|
||||
struct FW_ATT_RECORD {
|
||||
uint16_t AttFwIdV1; /* Legacy FW Type field */
|
||||
uint16_t AttFwIdV2; /* V2 FW ID field */
|
||||
uint32_t AttFWVersion; /* FW Version */
|
||||
@ -50,7 +48,7 @@ typedef struct FW_ATT_RECORD
|
||||
uint8_t AttSource; /* FW source indicator */
|
||||
uint8_t RecordValid; /* Indicates whether the record is a valid entry */
|
||||
uint32_t AttFwTaId; /* Ta ID (only in TA Attestation Table) */
|
||||
} FW_ATT_RECORD;
|
||||
};
|
||||
|
||||
static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
|
||||
char __user *buf,
|
||||
@ -60,15 +58,15 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
|
||||
uint64_t records_addr = 0;
|
||||
uint64_t vram_pos = 0;
|
||||
FW_ATT_DB_HEADER fw_att_hdr = {0};
|
||||
FW_ATT_RECORD fw_att_record = {0};
|
||||
struct FW_ATT_DB_HEADER fw_att_hdr = {0};
|
||||
struct FW_ATT_RECORD fw_att_record = {0};
|
||||
|
||||
if (size < sizeof(FW_ATT_RECORD)) {
|
||||
if (size < sizeof(struct FW_ATT_RECORD)) {
|
||||
DRM_WARN("FW attestation input buffer not enough memory");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((*pos + sizeof(FW_ATT_DB_HEADER)) >= FW_ATTESTATION_MAX_SIZE) {
|
||||
if ((*pos + sizeof(struct FW_ATT_DB_HEADER)) >= FW_ATTESTATION_MAX_SIZE) {
|
||||
DRM_WARN("FW attestation out of bounds");
|
||||
return 0;
|
||||
}
|
||||
@ -83,8 +81,8 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
|
||||
if (*pos == 0) {
|
||||
amdgpu_device_vram_access(adev,
|
||||
vram_pos,
|
||||
(uint32_t*)&fw_att_hdr,
|
||||
sizeof(FW_ATT_DB_HEADER),
|
||||
(uint32_t *)&fw_att_hdr,
|
||||
sizeof(struct FW_ATT_DB_HEADER),
|
||||
false);
|
||||
|
||||
if (fw_att_hdr.AttDbCookie != FW_ATTESTATION_DB_COOKIE) {
|
||||
@ -96,20 +94,20 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
|
||||
}
|
||||
|
||||
amdgpu_device_vram_access(adev,
|
||||
vram_pos + sizeof(FW_ATT_DB_HEADER) + *pos,
|
||||
(uint32_t*)&fw_att_record,
|
||||
sizeof(FW_ATT_RECORD),
|
||||
vram_pos + sizeof(struct FW_ATT_DB_HEADER) + *pos,
|
||||
(uint32_t *)&fw_att_record,
|
||||
sizeof(struct FW_ATT_RECORD),
|
||||
false);
|
||||
|
||||
if (fw_att_record.RecordValid != FW_ATTESTATION_RECORD_VALID)
|
||||
return 0;
|
||||
|
||||
if (copy_to_user(buf, (void*)&fw_att_record, sizeof(FW_ATT_RECORD)))
|
||||
if (copy_to_user(buf, (void *)&fw_att_record, sizeof(struct FW_ATT_RECORD)))
|
||||
return -EINVAL;
|
||||
|
||||
*pos += sizeof(FW_ATT_RECORD);
|
||||
*pos += sizeof(struct FW_ATT_RECORD);
|
||||
|
||||
return sizeof(FW_ATT_RECORD);
|
||||
return sizeof(struct FW_ATT_RECORD);
|
||||
}
|
||||
|
||||
static const struct file_operations amdgpu_fw_attestation_debugfs_ops = {
|
||||
@ -136,7 +134,7 @@ void amdgpu_fw_attestation_debugfs_init(struct amdgpu_device *adev)
|
||||
return;
|
||||
|
||||
debugfs_create_file("amdgpu_fw_attestation",
|
||||
S_IRUSR,
|
||||
0400,
|
||||
adev_to_drm(adev)->primary->debugfs_root,
|
||||
adev,
|
||||
&amdgpu_fw_attestation_debugfs_ops);
|
||||
|
@ -182,11 +182,10 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj,
|
||||
return r;
|
||||
|
||||
bo_va = amdgpu_vm_bo_find(vm, abo);
|
||||
if (!bo_va) {
|
||||
if (!bo_va)
|
||||
bo_va = amdgpu_vm_bo_add(adev, vm, abo);
|
||||
} else {
|
||||
else
|
||||
++bo_va->ref_count;
|
||||
}
|
||||
amdgpu_bo_unreserve(abo);
|
||||
return 0;
|
||||
}
|
||||
@ -461,9 +460,9 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
|
||||
struct amdgpu_bo *robj;
|
||||
|
||||
gobj = drm_gem_object_lookup(filp, handle);
|
||||
if (gobj == NULL) {
|
||||
if (!gobj)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
robj = gem_to_amdgpu_bo(gobj);
|
||||
if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) ||
|
||||
(robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
|
||||
@ -480,6 +479,7 @@ int amdgpu_gem_mmap_ioctl(struct drm_device *dev, void *data,
|
||||
{
|
||||
union drm_amdgpu_gem_mmap *args = data;
|
||||
uint32_t handle = args->in.handle;
|
||||
|
||||
memset(args, 0, sizeof(*args));
|
||||
return amdgpu_mode_dumb_mmap(filp, dev, handle, &args->out.addr_ptr);
|
||||
}
|
||||
@ -506,7 +506,7 @@ unsigned long amdgpu_gem_timeout(uint64_t timeout_ns)
|
||||
|
||||
timeout_jiffies = nsecs_to_jiffies(ktime_to_ns(timeout));
|
||||
/* clamp timeout to avoid unsigned-> signed overflow */
|
||||
if (timeout_jiffies > MAX_SCHEDULE_TIMEOUT )
|
||||
if (timeout_jiffies > MAX_SCHEDULE_TIMEOUT)
|
||||
return MAX_SCHEDULE_TIMEOUT - 1;
|
||||
|
||||
return timeout_jiffies;
|
||||
@ -524,9 +524,9 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
|
||||
long ret;
|
||||
|
||||
gobj = drm_gem_object_lookup(filp, handle);
|
||||
if (gobj == NULL) {
|
||||
if (!gobj)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
robj = gem_to_amdgpu_bo(gobj);
|
||||
ret = dma_resv_wait_timeout(robj->tbo.base.resv, DMA_RESV_USAGE_READ,
|
||||
true, timeout);
|
||||
@ -553,7 +553,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
|
||||
struct amdgpu_bo *robj;
|
||||
int r = -1;
|
||||
|
||||
DRM_DEBUG("%d \n", args->handle);
|
||||
DRM_DEBUG("%d\n", args->handle);
|
||||
gobj = drm_gem_object_lookup(filp, args->handle);
|
||||
if (gobj == NULL)
|
||||
return -ENOENT;
|
||||
@ -680,7 +680,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
|
||||
|
||||
if (args->va_address < AMDGPU_VA_RESERVED_SIZE) {
|
||||
dev_dbg(dev->dev,
|
||||
"va_address 0x%LX is in reserved area 0x%LX\n",
|
||||
"va_address 0x%llx is in reserved area 0x%llx\n",
|
||||
args->va_address, AMDGPU_VA_RESERVED_SIZE);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -688,7 +688,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
|
||||
if (args->va_address >= AMDGPU_GMC_HOLE_START &&
|
||||
args->va_address < AMDGPU_GMC_HOLE_END) {
|
||||
dev_dbg(dev->dev,
|
||||
"va_address 0x%LX is in VA hole 0x%LX-0x%LX\n",
|
||||
"va_address 0x%llx is in VA hole 0x%llx-0x%llx\n",
|
||||
args->va_address, AMDGPU_GMC_HOLE_START,
|
||||
AMDGPU_GMC_HOLE_END);
|
||||
return -EINVAL;
|
||||
@ -808,9 +808,9 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
|
||||
int r;
|
||||
|
||||
gobj = drm_gem_object_lookup(filp, args->handle);
|
||||
if (gobj == NULL) {
|
||||
if (!gobj)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
robj = gem_to_amdgpu_bo(gobj);
|
||||
|
||||
r = amdgpu_bo_reserve(robj, false);
|
||||
@ -936,9 +936,9 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
|
||||
r = drm_gem_handle_create(file_priv, gobj, &handle);
|
||||
/* drop reference from allocate - handle holds it now */
|
||||
drm_gem_object_put(gobj);
|
||||
if (r) {
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
args->handle = handle;
|
||||
return 0;
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ bool amdgpu_gfx_is_me_queue_enabled(struct amdgpu_device *adev,
|
||||
* The bitmask of CUs to be disabled in the shader array determined by se and
|
||||
* sh is stored in mask[se * max_sh + sh].
|
||||
*/
|
||||
void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh)
|
||||
void amdgpu_gfx_parse_disable_cu(unsigned int *mask, unsigned int max_se, unsigned int max_sh)
|
||||
{
|
||||
unsigned se, sh, cu;
|
||||
unsigned int se, sh, cu;
|
||||
const char *p;
|
||||
|
||||
memset(mask, 0, sizeof(*mask) * max_se * max_sh);
|
||||
@ -124,6 +124,7 @@ void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_s
|
||||
for (;;) {
|
||||
char *next;
|
||||
int ret = sscanf(p, "%u.%u.%u", &se, &sh, &cu);
|
||||
|
||||
if (ret < 3) {
|
||||
DRM_ERROR("amdgpu: could not parse disable_cu\n");
|
||||
return;
|
||||
@ -349,7 +350,7 @@ void amdgpu_gfx_kiq_fini(struct amdgpu_device *adev, int xcc_id)
|
||||
}
|
||||
|
||||
int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
|
||||
unsigned hpd_size, int xcc_id)
|
||||
unsigned int hpd_size, int xcc_id)
|
||||
{
|
||||
int r;
|
||||
u32 *hpd;
|
||||
@ -376,7 +377,7 @@ int amdgpu_gfx_kiq_init(struct amdgpu_device *adev,
|
||||
|
||||
/* create MQD for each compute/gfx queue */
|
||||
int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
|
||||
unsigned mqd_size, int xcc_id)
|
||||
unsigned int mqd_size, int xcc_id)
|
||||
{
|
||||
int r, i, j;
|
||||
struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
|
||||
@ -407,8 +408,11 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
|
||||
|
||||
/* prepare MQD backup */
|
||||
kiq->mqd_backup = kmalloc(mqd_size, GFP_KERNEL);
|
||||
if (!kiq->mqd_backup)
|
||||
dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
|
||||
if (!kiq->mqd_backup) {
|
||||
dev_warn(adev->dev,
|
||||
"no memory to create MQD backup for ring %s\n", ring->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
if (adev->asic_type >= CHIP_NAVI10 && amdgpu_async_gfx_ring) {
|
||||
@ -427,8 +431,10 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
|
||||
ring->mqd_size = mqd_size;
|
||||
/* prepare MQD backup */
|
||||
adev->gfx.me.mqd_backup[i] = kmalloc(mqd_size, GFP_KERNEL);
|
||||
if (!adev->gfx.me.mqd_backup[i])
|
||||
if (!adev->gfx.me.mqd_backup[i]) {
|
||||
dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -449,8 +455,10 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
|
||||
ring->mqd_size = mqd_size;
|
||||
/* prepare MQD backup */
|
||||
adev->gfx.mec.mqd_backup[j] = kmalloc(mqd_size, GFP_KERNEL);
|
||||
if (!adev->gfx.mec.mqd_backup[j])
|
||||
if (!adev->gfx.mec.mqd_backup[j]) {
|
||||
dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1281,11 +1289,11 @@ static ssize_t amdgpu_gfx_get_available_compute_partition(struct device *dev,
|
||||
return sysfs_emit(buf, "%s\n", supported_partition);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(current_compute_partition, S_IRUGO | S_IWUSR,
|
||||
static DEVICE_ATTR(current_compute_partition, 0644,
|
||||
amdgpu_gfx_get_current_compute_partition,
|
||||
amdgpu_gfx_set_compute_partition);
|
||||
|
||||
static DEVICE_ATTR(available_compute_partition, S_IRUGO,
|
||||
static DEVICE_ATTR(available_compute_partition, 0444,
|
||||
amdgpu_gfx_get_available_compute_partition, NULL);
|
||||
|
||||
int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev)
|
||||
|
@ -331,6 +331,8 @@ struct amdgpu_gmc {
|
||||
u64 VM_CONTEXT_PAGE_TABLE_END_ADDR_LO32[16];
|
||||
u64 VM_CONTEXT_PAGE_TABLE_END_ADDR_HI32[16];
|
||||
u64 MC_VM_MX_L1_TLB_CNTL;
|
||||
|
||||
u64 noretry_flags;
|
||||
};
|
||||
|
||||
#define amdgpu_gmc_flush_gpu_tlb(adev, vmid, vmhub, type) ((adev)->gmc.gmc_funcs->flush_gpu_tlb((adev), (vmid), (vmhub), (type)))
|
||||
|
@ -62,7 +62,7 @@
|
||||
* Returns 0 on success, error on failure.
|
||||
*/
|
||||
int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
unsigned size, enum amdgpu_ib_pool_type pool_type,
|
||||
unsigned int size, enum amdgpu_ib_pool_type pool_type,
|
||||
struct amdgpu_ib *ib)
|
||||
{
|
||||
int r;
|
||||
@ -123,7 +123,7 @@ void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib,
|
||||
* a CONST_IB), it will be put on the ring prior to the DE IB. Prior
|
||||
* to SI there was just a DE IB.
|
||||
*/
|
||||
int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
|
||||
int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned int num_ibs,
|
||||
struct amdgpu_ib *ibs, struct amdgpu_job *job,
|
||||
struct dma_fence **f)
|
||||
{
|
||||
@ -131,16 +131,16 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
|
||||
struct amdgpu_ib *ib = &ibs[0];
|
||||
struct dma_fence *tmp = NULL;
|
||||
bool need_ctx_switch;
|
||||
unsigned patch_offset = ~0;
|
||||
unsigned int patch_offset = ~0;
|
||||
struct amdgpu_vm *vm;
|
||||
uint64_t fence_ctx;
|
||||
uint32_t status = 0, alloc_size;
|
||||
unsigned fence_flags = 0;
|
||||
unsigned int fence_flags = 0;
|
||||
bool secure, init_shadow;
|
||||
u64 shadow_va, csa_va, gds_va;
|
||||
int vmid = AMDGPU_JOB_GET_VMID(job);
|
||||
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int r = 0;
|
||||
bool need_pipe_sync = false;
|
||||
|
||||
@ -282,7 +282,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
|
||||
amdgpu_ring_emit_gfx_shadow(ring, 0, 0, 0, false, 0);
|
||||
|
||||
if (ring->funcs->init_cond_exec) {
|
||||
unsigned ce_offset = ~0;
|
||||
unsigned int ce_offset = ~0;
|
||||
|
||||
ce_offset = amdgpu_ring_init_cond_exec(ring);
|
||||
if (ce_offset != ~0 && ring->funcs->patch_cond_exec)
|
||||
@ -385,7 +385,7 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
|
||||
{
|
||||
long tmo_gfx, tmo_mm;
|
||||
int r, ret = 0;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
tmo_mm = tmo_gfx = AMDGPU_IB_TEST_TIMEOUT;
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
@ -402,7 +402,7 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
|
||||
/* for CP & SDMA engines since they are scheduled together so
|
||||
* need to make the timeout width enough to cover the time
|
||||
* cost waiting for it coming back under RUNTIME only
|
||||
*/
|
||||
*/
|
||||
tmo_gfx = 8 * AMDGPU_IB_TEST_TIMEOUT;
|
||||
} else if (adev->gmc.xgmi.hive_id) {
|
||||
tmo_gfx = AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT;
|
||||
@ -465,13 +465,13 @@ static int amdgpu_debugfs_sa_info_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct amdgpu_device *adev = m->private;
|
||||
|
||||
seq_printf(m, "--------------------- DELAYED --------------------- \n");
|
||||
seq_puts(m, "--------------------- DELAYED ---------------------\n");
|
||||
amdgpu_sa_bo_dump_debug_info(&adev->ib_pools[AMDGPU_IB_POOL_DELAYED],
|
||||
m);
|
||||
seq_printf(m, "-------------------- IMMEDIATE -------------------- \n");
|
||||
seq_puts(m, "-------------------- IMMEDIATE --------------------\n");
|
||||
amdgpu_sa_bo_dump_debug_info(&adev->ib_pools[AMDGPU_IB_POOL_IMMEDIATE],
|
||||
m);
|
||||
seq_printf(m, "--------------------- DIRECT ---------------------- \n");
|
||||
seq_puts(m, "--------------------- DIRECT ----------------------\n");
|
||||
amdgpu_sa_bo_dump_debug_info(&adev->ib_pools[AMDGPU_IB_POOL_DIRECT], m);
|
||||
|
||||
return 0;
|
||||
|
@ -138,6 +138,7 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih)
|
||||
/**
|
||||
* amdgpu_ih_ring_write - write IV to the ring buffer
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @ih: ih ring to write to
|
||||
* @iv: the iv to write
|
||||
* @num_dw: size of the iv in dw
|
||||
@ -145,8 +146,8 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih)
|
||||
* Writes an IV to the ring buffer using the CPU and increment the wptr.
|
||||
* Used for testing and delegating IVs to a software ring.
|
||||
*/
|
||||
void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv,
|
||||
unsigned int num_dw)
|
||||
void amdgpu_ih_ring_write(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih,
|
||||
const uint32_t *iv, unsigned int num_dw)
|
||||
{
|
||||
uint32_t wptr = le32_to_cpu(*ih->wptr_cpu) >> 2;
|
||||
unsigned int i;
|
||||
@ -161,6 +162,9 @@ void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv,
|
||||
if (wptr != READ_ONCE(ih->rptr)) {
|
||||
wmb();
|
||||
WRITE_ONCE(*ih->wptr_cpu, cpu_to_le32(wptr));
|
||||
} else if (adev->irq.retry_cam_enabled) {
|
||||
dev_warn_once(adev->dev, "IH soft ring buffer overflow 0x%X, 0x%X\n",
|
||||
wptr, ih->rptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,9 @@
|
||||
/* Maximum number of IVs processed at once */
|
||||
#define AMDGPU_IH_MAX_NUM_IVS 32
|
||||
|
||||
#define IH_RING_SIZE (256 * 1024)
|
||||
#define IH_SW_RING_SIZE (8 * 1024) /* enough for 256 CAM entries */
|
||||
|
||||
struct amdgpu_device;
|
||||
struct amdgpu_iv_entry;
|
||||
|
||||
@ -97,8 +100,8 @@ struct amdgpu_ih_funcs {
|
||||
int amdgpu_ih_ring_init(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih,
|
||||
unsigned ring_size, bool use_bus_addr);
|
||||
void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih);
|
||||
void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv,
|
||||
unsigned int num_dw);
|
||||
void amdgpu_ih_ring_write(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih,
|
||||
const uint32_t *iv, unsigned int num_dw);
|
||||
int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev,
|
||||
struct amdgpu_ih_ring *ih);
|
||||
int amdgpu_ih_process(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih);
|
||||
|
@ -493,7 +493,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev,
|
||||
struct amdgpu_iv_entry *entry,
|
||||
unsigned int num_dw)
|
||||
{
|
||||
amdgpu_ih_ring_write(&adev->irq.ih_soft, entry->iv_entry, num_dw);
|
||||
amdgpu_ih_ring_write(adev, &adev->irq.ih_soft, entry->iv_entry, num_dw);
|
||||
schedule_work(&adev->irq.ih_soft_work);
|
||||
}
|
||||
|
||||
|
@ -557,6 +557,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||
crtc = (struct drm_crtc *)minfo->crtcs[i];
|
||||
if (crtc && crtc->base.id == info->mode_crtc.id) {
|
||||
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||
|
||||
ui32 = amdgpu_crtc->crtc_id;
|
||||
found = 1;
|
||||
break;
|
||||
@ -575,7 +576,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = copy_to_user(out, &ip, min((size_t)size, sizeof(ip)));
|
||||
ret = copy_to_user(out, &ip, min_t(size_t, size, sizeof(ip)));
|
||||
return ret ? -EFAULT : 0;
|
||||
}
|
||||
case AMDGPU_INFO_HW_IP_COUNT: {
|
||||
@ -721,17 +722,18 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||
? -EFAULT : 0;
|
||||
}
|
||||
case AMDGPU_INFO_READ_MMR_REG: {
|
||||
unsigned n, alloc_size;
|
||||
unsigned int n, alloc_size;
|
||||
uint32_t *regs;
|
||||
unsigned se_num = (info->read_mmr_reg.instance >>
|
||||
unsigned int se_num = (info->read_mmr_reg.instance >>
|
||||
AMDGPU_INFO_MMR_SE_INDEX_SHIFT) &
|
||||
AMDGPU_INFO_MMR_SE_INDEX_MASK;
|
||||
unsigned sh_num = (info->read_mmr_reg.instance >>
|
||||
unsigned int sh_num = (info->read_mmr_reg.instance >>
|
||||
AMDGPU_INFO_MMR_SH_INDEX_SHIFT) &
|
||||
AMDGPU_INFO_MMR_SH_INDEX_MASK;
|
||||
|
||||
/* set full masks if the userspace set all bits
|
||||
* in the bitfields */
|
||||
* in the bitfields
|
||||
*/
|
||||
if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK)
|
||||
se_num = 0xffffffff;
|
||||
else if (se_num >= AMDGPU_GFX_MAX_SE)
|
||||
@ -896,7 +898,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||
return ret;
|
||||
}
|
||||
case AMDGPU_INFO_VCE_CLOCK_TABLE: {
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
struct drm_amdgpu_info_vce_clock_table vce_clk_table = {};
|
||||
struct amd_vce_state *vce_state;
|
||||
|
||||
@ -1102,6 +1104,9 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
|
||||
struct drm_amdgpu_info_video_caps *caps;
|
||||
int r;
|
||||
|
||||
if (!adev->asic_funcs->query_video_codecs)
|
||||
return -EINVAL;
|
||||
|
||||
switch (info->video_cap.type) {
|
||||
case AMDGPU_INFO_VIDEO_CAPS_DECODE:
|
||||
r = amdgpu_asic_query_video_codecs(adev, false, &codecs);
|
||||
@ -1229,13 +1234,13 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
|
||||
pasid = 0;
|
||||
}
|
||||
|
||||
r = amdgpu_vm_init(adev, &fpriv->vm);
|
||||
r = amdgpu_xcp_open_device(adev, fpriv, file_priv);
|
||||
if (r)
|
||||
goto error_pasid;
|
||||
|
||||
r = amdgpu_xcp_open_device(adev, fpriv, file_priv);
|
||||
r = amdgpu_vm_init(adev, &fpriv->vm, fpriv->xcp_id);
|
||||
if (r)
|
||||
goto error_vm;
|
||||
goto error_pasid;
|
||||
|
||||
r = amdgpu_vm_set_pasid(adev, &fpriv->vm, pasid);
|
||||
if (r)
|
||||
@ -1719,7 +1724,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
|
||||
seq_printf(m, "MES feature version: %u, firmware version: 0x%08x\n",
|
||||
fw_info.feature, fw_info.ver);
|
||||
|
||||
seq_printf(m, "VBIOS version: %s\n", ctx->vbios_version);
|
||||
seq_printf(m, "VBIOS version: %s\n", ctx->vbios_pn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -643,6 +643,8 @@ int amdgpu_mes_add_hw_queue(struct amdgpu_device *adev, int gang_id,
|
||||
unsigned long flags;
|
||||
int r;
|
||||
|
||||
memset(&queue_input, 0, sizeof(struct mes_add_queue_input));
|
||||
|
||||
/* allocate the mes queue buffer */
|
||||
queue = kzalloc(sizeof(struct amdgpu_mes_queue), GFP_KERNEL);
|
||||
if (!queue) {
|
||||
@ -1378,7 +1380,7 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)
|
||||
goto error_pasid;
|
||||
}
|
||||
|
||||
r = amdgpu_vm_init(adev, vm);
|
||||
r = amdgpu_vm_init(adev, vm, -1);
|
||||
if (r) {
|
||||
DRM_ERROR("failed to initialize vm\n");
|
||||
goto error_pasid;
|
||||
|
@ -224,6 +224,7 @@ struct mes_add_queue_input {
|
||||
uint32_t is_kfd_process;
|
||||
uint32_t is_aql_queue;
|
||||
uint32_t queue_size;
|
||||
uint32_t exclusively_scheduled;
|
||||
};
|
||||
|
||||
struct mes_remove_queue_input {
|
||||
|
@ -1575,23 +1575,31 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)
|
||||
{
|
||||
struct dma_buf_attachment *attachment;
|
||||
struct dma_buf *dma_buf;
|
||||
unsigned int domain;
|
||||
const char *placement;
|
||||
unsigned int pin_count;
|
||||
u64 size;
|
||||
|
||||
domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
|
||||
switch (domain) {
|
||||
case AMDGPU_GEM_DOMAIN_VRAM:
|
||||
placement = "VRAM";
|
||||
break;
|
||||
case AMDGPU_GEM_DOMAIN_GTT:
|
||||
placement = " GTT";
|
||||
break;
|
||||
case AMDGPU_GEM_DOMAIN_CPU:
|
||||
default:
|
||||
placement = " CPU";
|
||||
break;
|
||||
if (dma_resv_trylock(bo->tbo.base.resv)) {
|
||||
unsigned int domain;
|
||||
domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
|
||||
switch (domain) {
|
||||
case AMDGPU_GEM_DOMAIN_VRAM:
|
||||
if (amdgpu_bo_in_cpu_visible_vram(bo))
|
||||
placement = "VRAM VISIBLE";
|
||||
else
|
||||
placement = "VRAM";
|
||||
break;
|
||||
case AMDGPU_GEM_DOMAIN_GTT:
|
||||
placement = "GTT";
|
||||
break;
|
||||
case AMDGPU_GEM_DOMAIN_CPU:
|
||||
default:
|
||||
placement = "CPU";
|
||||
break;
|
||||
}
|
||||
dma_resv_unlock(bo->tbo.base.resv);
|
||||
} else {
|
||||
placement = "UNKNOWN";
|
||||
}
|
||||
|
||||
size = amdgpu_bo_size(bo);
|
||||
|
@ -45,9 +45,6 @@
|
||||
|
||||
#define AMD_VBIOS_FILE_MAX_SIZE_B (1024*1024*3)
|
||||
|
||||
static int psp_sysfs_init(struct amdgpu_device *adev);
|
||||
static void psp_sysfs_fini(struct amdgpu_device *adev);
|
||||
|
||||
static int psp_load_smu_fw(struct psp_context *psp);
|
||||
static int psp_rap_terminate(struct psp_context *psp);
|
||||
static int psp_securedisplay_terminate(struct psp_context *psp);
|
||||
@ -180,9 +177,11 @@ static int psp_early_init(void *handle)
|
||||
psp->autoload_supported = false;
|
||||
break;
|
||||
case IP_VERSION(11, 0, 0):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
adev->psp.sup_pd_fw_up = !amdgpu_sriov_vf(adev);
|
||||
fallthrough;
|
||||
case IP_VERSION(11, 0, 5):
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
case IP_VERSION(11, 0, 11):
|
||||
case IP_VERSION(11, 5, 0):
|
||||
case IP_VERSION(11, 0, 12):
|
||||
@ -202,8 +201,8 @@ static int psp_early_init(void *handle)
|
||||
case IP_VERSION(13, 0, 3):
|
||||
case IP_VERSION(13, 0, 5):
|
||||
case IP_VERSION(13, 0, 8):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
case IP_VERSION(13, 0, 11):
|
||||
case IP_VERSION(14, 0, 0):
|
||||
psp_v13_0_set_psp_funcs(psp);
|
||||
psp->autoload_supported = true;
|
||||
break;
|
||||
@ -215,8 +214,10 @@ static int psp_early_init(void *handle)
|
||||
break;
|
||||
case IP_VERSION(13, 0, 0):
|
||||
case IP_VERSION(13, 0, 7):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
psp_v13_0_set_psp_funcs(psp);
|
||||
psp->autoload_supported = true;
|
||||
adev->psp.sup_ifwi_up = !amdgpu_sriov_vf(adev);
|
||||
break;
|
||||
case IP_VERSION(13, 0, 4):
|
||||
psp_v13_0_4_set_psp_funcs(psp);
|
||||
@ -462,13 +463,6 @@ static int psp_sw_init(void *handle)
|
||||
}
|
||||
}
|
||||
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7)) {
|
||||
ret = psp_sysfs_init(adev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
|
||||
amdgpu_sriov_vf(adev) ?
|
||||
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT,
|
||||
@ -498,11 +492,11 @@ static int psp_sw_init(void *handle)
|
||||
return 0;
|
||||
|
||||
failed2:
|
||||
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
|
||||
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
|
||||
failed1:
|
||||
amdgpu_bo_free_kernel(&psp->fence_buf_bo,
|
||||
&psp->fence_buf_mc_addr, &psp->fence_buf);
|
||||
failed1:
|
||||
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
|
||||
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -520,10 +514,6 @@ static int psp_sw_fini(void *handle)
|
||||
amdgpu_ucode_release(&psp->cap_fw);
|
||||
amdgpu_ucode_release(&psp->toc_fw);
|
||||
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||
|
||||
adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))
|
||||
psp_sysfs_fini(adev);
|
||||
|
||||
kfree(cmd);
|
||||
cmd = NULL;
|
||||
|
||||
@ -2459,8 +2449,8 @@ static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int psp_execute_non_psp_fw_load(struct psp_context *psp,
|
||||
struct amdgpu_firmware_info *ucode)
|
||||
int psp_execute_ip_fw_load(struct psp_context *psp,
|
||||
struct amdgpu_firmware_info *ucode)
|
||||
{
|
||||
int ret = 0;
|
||||
struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
|
||||
@ -2503,7 +2493,7 @@ static int psp_load_smu_fw(struct psp_context *psp)
|
||||
DRM_WARN("Failed to set MP1 state prepare for reload\n");
|
||||
}
|
||||
|
||||
ret = psp_execute_non_psp_fw_load(psp, ucode);
|
||||
ret = psp_execute_ip_fw_load(psp, ucode);
|
||||
|
||||
if (ret)
|
||||
DRM_ERROR("PSP load smu failed!\n");
|
||||
@ -2545,7 +2535,7 @@ int psp_load_fw_list(struct psp_context *psp,
|
||||
for (i = 0; i < ucode_count; ++i) {
|
||||
ucode = ucode_list[i];
|
||||
psp_print_fw_hdr(psp, ucode);
|
||||
ret = psp_execute_non_psp_fw_load(psp, ucode);
|
||||
ret = psp_execute_ip_fw_load(psp, ucode);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@ -2592,7 +2582,7 @@ static int psp_load_non_psp_fw(struct psp_context *psp)
|
||||
|
||||
psp_print_fw_hdr(psp, ucode);
|
||||
|
||||
ret = psp_execute_non_psp_fw_load(psp, ucode);
|
||||
ret = psp_execute_ip_fw_load(psp, ucode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -2931,19 +2921,6 @@ int psp_rlc_autoload_start(struct psp_context *psp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx,
|
||||
uint64_t cmd_gpu_addr, int cmd_size)
|
||||
{
|
||||
struct amdgpu_firmware_info ucode = {0};
|
||||
|
||||
ucode.ucode_id = inst_idx ? AMDGPU_UCODE_ID_VCN1_RAM :
|
||||
AMDGPU_UCODE_ID_VCN0_RAM;
|
||||
ucode.mc_addr = cmd_gpu_addr;
|
||||
ucode.ucode_size = cmd_size;
|
||||
|
||||
return psp_execute_non_psp_fw_load(&adev->psp, &ucode);
|
||||
}
|
||||
|
||||
int psp_ring_cmd_submit(struct psp_context *psp,
|
||||
uint64_t cmd_buf_mc_addr,
|
||||
uint64_t fence_mc_addr,
|
||||
@ -3584,6 +3561,11 @@ void psp_copy_fw(struct psp_context *psp, uint8_t *start_addr, uint32_t bin_size
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC: usbc_pd_fw
|
||||
* Reading from this file will retrieve the USB-C PD firmware version. Writing to
|
||||
* this file will trigger the update process.
|
||||
*/
|
||||
static DEVICE_ATTR(usbc_pd_fw, 0644,
|
||||
psp_usbc_pd_fw_sysfs_read,
|
||||
psp_usbc_pd_fw_sysfs_write);
|
||||
@ -3624,7 +3606,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
|
||||
adev->psp.vbflash_image_size += count;
|
||||
mutex_unlock(&adev->psp.mutex);
|
||||
|
||||
dev_info(adev->dev, "VBIOS flash write PSP done");
|
||||
dev_dbg(adev->dev, "IFWI staged for update");
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -3644,7 +3626,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,
|
||||
if (adev->psp.vbflash_image_size == 0)
|
||||
return -EINVAL;
|
||||
|
||||
dev_info(adev->dev, "VBIOS flash to PSP started");
|
||||
dev_dbg(adev->dev, "PSP IFWI flash process initiated");
|
||||
|
||||
ret = amdgpu_bo_create_kernel(adev, adev->psp.vbflash_image_size,
|
||||
AMDGPU_GPU_PAGE_SIZE,
|
||||
@ -3669,14 +3651,32 @@ rel_buf:
|
||||
adev->psp.vbflash_image_size = 0;
|
||||
|
||||
if (ret) {
|
||||
dev_err(adev->dev, "Failed to load VBIOS FW, err = %d", ret);
|
||||
dev_err(adev->dev, "Failed to load IFWI, err = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_info(adev->dev, "VBIOS flash to PSP done");
|
||||
dev_dbg(adev->dev, "PSP IFWI flash process done");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC: psp_vbflash
|
||||
* Writing to this file will stage an IFWI for update. Reading from this file
|
||||
* will trigger the update process.
|
||||
*/
|
||||
static struct bin_attribute psp_vbflash_bin_attr = {
|
||||
.attr = {.name = "psp_vbflash", .mode = 0660},
|
||||
.size = 0,
|
||||
.write = amdgpu_psp_vbflash_write,
|
||||
.read = amdgpu_psp_vbflash_read,
|
||||
};
|
||||
|
||||
/**
|
||||
* DOC: psp_vbflash_status
|
||||
* The status of the flash process.
|
||||
* 0: IFWI flash not complete.
|
||||
* 1: IFWI flash complete.
|
||||
*/
|
||||
static ssize_t amdgpu_psp_vbflash_status(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
@ -3693,39 +3693,49 @@ static ssize_t amdgpu_psp_vbflash_status(struct device *dev,
|
||||
|
||||
return sysfs_emit(buf, "0x%x\n", vbflash_status);
|
||||
}
|
||||
|
||||
static const struct bin_attribute psp_vbflash_bin_attr = {
|
||||
.attr = {.name = "psp_vbflash", .mode = 0660},
|
||||
.size = 0,
|
||||
.write = amdgpu_psp_vbflash_write,
|
||||
.read = amdgpu_psp_vbflash_read,
|
||||
};
|
||||
|
||||
static DEVICE_ATTR(psp_vbflash_status, 0440, amdgpu_psp_vbflash_status, NULL);
|
||||
|
||||
int amdgpu_psp_sysfs_init(struct amdgpu_device *adev)
|
||||
static struct bin_attribute *bin_flash_attrs[] = {
|
||||
&psp_vbflash_bin_attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute *flash_attrs[] = {
|
||||
&dev_attr_psp_vbflash_status.attr,
|
||||
&dev_attr_usbc_pd_fw.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static umode_t amdgpu_flash_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
|
||||
{
|
||||
int ret = 0;
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct drm_device *ddev = dev_get_drvdata(dev);
|
||||
struct amdgpu_device *adev = drm_to_adev(ddev);
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return -EINVAL;
|
||||
if (attr == &dev_attr_usbc_pd_fw.attr)
|
||||
return adev->psp.sup_pd_fw_up ? 0660 : 0;
|
||||
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 0):
|
||||
case IP_VERSION(13, 0, 7):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
ret = sysfs_create_bin_file(&adev->dev->kobj, &psp_vbflash_bin_attr);
|
||||
if (ret)
|
||||
dev_err(adev->dev, "Failed to create device file psp_vbflash");
|
||||
ret = device_create_file(adev->dev, &dev_attr_psp_vbflash_status);
|
||||
if (ret)
|
||||
dev_err(adev->dev, "Failed to create device file psp_vbflash_status");
|
||||
return ret;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return adev->psp.sup_ifwi_up ? 0440 : 0;
|
||||
}
|
||||
|
||||
static umode_t amdgpu_bin_flash_attr_is_visible(struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
int idx)
|
||||
{
|
||||
struct device *dev = kobj_to_dev(kobj);
|
||||
struct drm_device *ddev = dev_get_drvdata(dev);
|
||||
struct amdgpu_device *adev = drm_to_adev(ddev);
|
||||
|
||||
return adev->psp.sup_ifwi_up ? 0660 : 0;
|
||||
}
|
||||
|
||||
const struct attribute_group amdgpu_flash_attr_group = {
|
||||
.attrs = flash_attrs,
|
||||
.bin_attrs = bin_flash_attrs,
|
||||
.is_bin_visible = amdgpu_bin_flash_attr_is_visible,
|
||||
.is_visible = amdgpu_flash_attr_is_visible,
|
||||
};
|
||||
|
||||
const struct amd_ip_funcs psp_ip_funcs = {
|
||||
.name = "psp",
|
||||
.early_init = psp_early_init,
|
||||
@ -3744,27 +3754,6 @@ const struct amd_ip_funcs psp_ip_funcs = {
|
||||
.set_powergating_state = psp_set_powergating_state,
|
||||
};
|
||||
|
||||
static int psp_sysfs_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int ret = device_create_file(adev->dev, &dev_attr_usbc_pd_fw);
|
||||
|
||||
if (ret)
|
||||
DRM_ERROR("Failed to create USBC PD FW control file!");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void amdgpu_psp_sysfs_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
sysfs_remove_bin_file(&adev->dev->kobj, &psp_vbflash_bin_attr);
|
||||
device_remove_file(adev->dev, &dev_attr_psp_vbflash_status);
|
||||
}
|
||||
|
||||
static void psp_sysfs_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
device_remove_file(adev->dev, &dev_attr_usbc_pd_fw);
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version psp_v3_1_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_PSP,
|
||||
.major = 3,
|
||||
|
@ -309,8 +309,8 @@ struct psp_runtime_scpm_entry {
|
||||
|
||||
struct psp_context
|
||||
{
|
||||
struct amdgpu_device *adev;
|
||||
struct psp_ring km_ring;
|
||||
struct amdgpu_device *adev;
|
||||
struct psp_ring km_ring;
|
||||
struct psp_gfx_cmd_resp *cmd;
|
||||
|
||||
const struct psp_funcs *funcs;
|
||||
@ -339,7 +339,7 @@ struct psp_context
|
||||
uint64_t tmr_mc_addr;
|
||||
|
||||
/* asd firmware */
|
||||
const struct firmware *asd_fw;
|
||||
const struct firmware *asd_fw;
|
||||
|
||||
/* toc firmware */
|
||||
const struct firmware *toc_fw;
|
||||
@ -384,9 +384,13 @@ struct psp_context
|
||||
|
||||
uint32_t boot_cfg_bitmask;
|
||||
|
||||
char *vbflash_tmp_buf;
|
||||
size_t vbflash_image_size;
|
||||
bool vbflash_done;
|
||||
/* firmware upgrades supported */
|
||||
bool sup_pd_fw_up;
|
||||
bool sup_ifwi_up;
|
||||
|
||||
char *vbflash_tmp_buf;
|
||||
size_t vbflash_image_size;
|
||||
bool vbflash_done;
|
||||
};
|
||||
|
||||
struct amdgpu_psp_funcs {
|
||||
@ -458,9 +462,10 @@ extern int psp_wait_for(struct psp_context *psp, uint32_t reg_index,
|
||||
extern int psp_wait_for_spirom_update(struct psp_context *psp, uint32_t reg_index,
|
||||
uint32_t field_val, uint32_t mask, uint32_t msec_timeout);
|
||||
|
||||
int psp_execute_ip_fw_load(struct psp_context *psp,
|
||||
struct amdgpu_firmware_info *ucode);
|
||||
|
||||
int psp_gpu_reset(struct amdgpu_device *adev);
|
||||
int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx,
|
||||
uint64_t cmd_gpu_addr, int cmd_size);
|
||||
|
||||
int psp_ta_init_shared_buf(struct psp_context *psp,
|
||||
struct ta_mem_context *mem_ctx);
|
||||
@ -525,6 +530,4 @@ int psp_spatial_partition(struct psp_context *psp, int mode);
|
||||
|
||||
int is_psp_fw_valid(struct psp_bin_desc bin);
|
||||
|
||||
int amdgpu_psp_sysfs_init(struct amdgpu_device *adev);
|
||||
void amdgpu_psp_sysfs_fini(struct amdgpu_device *adev);
|
||||
#endif
|
||||
|
@ -1159,7 +1159,8 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
/* Calculate XGMI relative offset */
|
||||
if (adev->gmc.xgmi.num_physical_nodes > 1) {
|
||||
if (adev->gmc.xgmi.num_physical_nodes > 1 &&
|
||||
info->head.block != AMDGPU_RAS_BLOCK__GFX) {
|
||||
block_info.address =
|
||||
amdgpu_xgmi_get_relative_phy_addr(adev,
|
||||
block_info.address);
|
||||
@ -2414,6 +2415,7 @@ static bool amdgpu_ras_asic_supported(struct amdgpu_device *adev)
|
||||
if (adev->asic_type == CHIP_IP_DISCOVERY) {
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
case IP_VERSION(13, 0, 0):
|
||||
case IP_VERSION(13, 0, 6):
|
||||
case IP_VERSION(13, 0, 10):
|
||||
return true;
|
||||
default:
|
||||
@ -2440,10 +2442,10 @@ static void amdgpu_ras_get_quirks(struct amdgpu_device *adev)
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
if (strnstr(ctx->vbios_version, "D16406",
|
||||
sizeof(ctx->vbios_version)) ||
|
||||
strnstr(ctx->vbios_version, "D36002",
|
||||
sizeof(ctx->vbios_version)))
|
||||
if (strnstr(ctx->vbios_pn, "D16406",
|
||||
sizeof(ctx->vbios_pn)) ||
|
||||
strnstr(ctx->vbios_pn, "D36002",
|
||||
sizeof(ctx->vbios_pn)))
|
||||
adev->ras_hw_enabled |= (1 << AMDGPU_RAS_BLOCK__GFX);
|
||||
}
|
||||
|
||||
@ -2515,8 +2517,18 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev)
|
||||
/* hw_supported needs to be aligned with RAS block mask. */
|
||||
adev->ras_hw_enabled &= AMDGPU_RAS_BLOCK_MASK;
|
||||
|
||||
adev->ras_enabled = amdgpu_ras_enable == 0 ? 0 :
|
||||
adev->ras_hw_enabled & amdgpu_ras_mask;
|
||||
|
||||
/*
|
||||
* Disable ras feature for aqua vanjaram
|
||||
* by default on apu platform.
|
||||
*/
|
||||
if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 6) &&
|
||||
adev->gmc.is_app_apu)
|
||||
adev->ras_enabled = amdgpu_ras_enable != 1 ? 0 :
|
||||
adev->ras_hw_enabled & amdgpu_ras_mask;
|
||||
else
|
||||
adev->ras_enabled = amdgpu_ras_enable == 0 ? 0 :
|
||||
adev->ras_hw_enabled & amdgpu_ras_mask;
|
||||
}
|
||||
|
||||
static void amdgpu_ras_counte_dw(struct work_struct *work)
|
||||
|
@ -194,9 +194,9 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
||||
/* VEGA20 and ARCTURUS */
|
||||
if (adev->asic_type == CHIP_VEGA20)
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
else if (strnstr(atom_ctx->vbios_version,
|
||||
else if (strnstr(atom_ctx->vbios_pn,
|
||||
"D342",
|
||||
sizeof(atom_ctx->vbios_version)))
|
||||
sizeof(atom_ctx->vbios_pn)))
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
@ -205,8 +205,8 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
return true;
|
||||
case IP_VERSION(13, 0, 2):
|
||||
if (strnstr(atom_ctx->vbios_version, "D673",
|
||||
sizeof(atom_ctx->vbios_version)))
|
||||
if (strnstr(atom_ctx->vbios_pn, "D673",
|
||||
sizeof(atom_ctx->vbios_pn)))
|
||||
control->i2c_address = EEPROM_I2C_MADDR_4;
|
||||
else
|
||||
control->i2c_address = EEPROM_I2C_MADDR_0;
|
||||
|
@ -87,7 +87,7 @@ int amdgpu_reset_prepare_hwcontext(struct amdgpu_device *adev,
|
||||
reset_handler = adev->reset_cntl->get_reset_handler(
|
||||
adev->reset_cntl, reset_context);
|
||||
if (!reset_handler)
|
||||
return -ENOSYS;
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return reset_handler->prepare_hwcontext(adev->reset_cntl,
|
||||
reset_context);
|
||||
@ -103,7 +103,7 @@ int amdgpu_reset_perform_reset(struct amdgpu_device *adev,
|
||||
reset_handler = adev->reset_cntl->get_reset_handler(
|
||||
adev->reset_cntl, reset_context);
|
||||
if (!reset_handler)
|
||||
return -ENOSYS;
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ret = reset_handler->perform_reset(adev->reset_cntl, reset_context);
|
||||
if (ret)
|
||||
|
@ -56,6 +56,15 @@ enum amdgpu_ring_mux_offset_type {
|
||||
AMDGPU_MUX_OFFSET_TYPE_CE,
|
||||
};
|
||||
|
||||
enum ib_complete_status {
|
||||
/* IB not started/reset value, default value. */
|
||||
IB_COMPLETION_STATUS_DEFAULT = 0,
|
||||
/* IB preempted, started but not completed. */
|
||||
IB_COMPLETION_STATUS_PREEMPTED = 1,
|
||||
/* IB completed. */
|
||||
IB_COMPLETION_STATUS_COMPLETED = 2,
|
||||
};
|
||||
|
||||
struct amdgpu_ring_mux {
|
||||
struct amdgpu_ring *real_ring;
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
#include "clearstate_defs.h"
|
||||
|
||||
#define AMDGPU_MAX_RLC_INSTANCES 8
|
||||
|
||||
/* firmware ID used in rlc toc */
|
||||
typedef enum _FIRMWARE_ID_ {
|
||||
FIRMWARE_ID_INVALID = 0,
|
||||
@ -201,7 +203,7 @@ struct amdgpu_rlc {
|
||||
u32 cp_table_size;
|
||||
|
||||
/* safe mode for updating CG/PG state */
|
||||
bool in_safe_mode[8];
|
||||
bool in_safe_mode[AMDGPU_MAX_RLC_INSTANCES];
|
||||
const struct amdgpu_rlc_funcs *funcs;
|
||||
|
||||
/* for firmware data */
|
||||
@ -257,7 +259,7 @@ struct amdgpu_rlc {
|
||||
|
||||
bool rlcg_reg_access_supported;
|
||||
/* registers for rlcg indirect reg access */
|
||||
struct amdgpu_rlcg_reg_access_ctrl reg_access_ctrl;
|
||||
struct amdgpu_rlcg_reg_access_ctrl reg_access_ctrl[AMDGPU_MAX_RLC_INSTANCES];
|
||||
};
|
||||
|
||||
void amdgpu_gfx_rlc_enter_safe_mode(struct amdgpu_device *adev, int xcc_id);
|
||||
|
@ -239,9 +239,6 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,
|
||||
sizeof(struct amdgpu_sdma_instance));
|
||||
}
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return 0;
|
||||
|
||||
DRM_DEBUG("psp_load == '%s'\n",
|
||||
adev->firmware.load_type == AMDGPU_FW_LOAD_PSP ? "true" : "false");
|
||||
|
||||
|
@ -1239,3 +1239,18 @@ int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amdgpu_vcn_psp_update_sram(struct amdgpu_device *adev, int inst_idx,
|
||||
enum AMDGPU_UCODE_ID ucode_id)
|
||||
{
|
||||
struct amdgpu_firmware_info ucode = {
|
||||
.ucode_id = (ucode_id ? ucode_id :
|
||||
(inst_idx ? AMDGPU_UCODE_ID_VCN1_RAM :
|
||||
AMDGPU_UCODE_ID_VCN0_RAM)),
|
||||
.mc_addr = adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
|
||||
.ucode_size = ((uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_curr_addr -
|
||||
(uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr),
|
||||
};
|
||||
|
||||
return psp_execute_ip_fw_load(&adev->psp, &ucode);
|
||||
}
|
||||
|
@ -161,6 +161,7 @@
|
||||
} while (0)
|
||||
|
||||
#define AMDGPU_FW_SHARED_FLAG_0_UNIFIED_QUEUE (1 << 2)
|
||||
#define AMDGPU_FW_SHARED_FLAG_0_DRM_KEY_INJECT (1 << 4)
|
||||
#define AMDGPU_VCN_FW_SHARED_FLAG_0_RB (1 << 6)
|
||||
#define AMDGPU_VCN_MULTI_QUEUE_FLAG (1 << 8)
|
||||
#define AMDGPU_VCN_SW_RING_FLAG (1 << 9)
|
||||
@ -180,6 +181,8 @@
|
||||
#define AMDGPU_VCN_SMU_DPM_INTERFACE_DGPU (0)
|
||||
#define AMDGPU_VCN_SMU_DPM_INTERFACE_APU (1)
|
||||
|
||||
#define AMDGPU_DRM_KEY_INJECT_WORKAROUND_VCNFW_ASD_HANDSHAKING 2
|
||||
|
||||
enum fw_queue_mode {
|
||||
FW_QUEUE_RING_RESET = 1,
|
||||
FW_QUEUE_DPG_HOLD_OFF = 2,
|
||||
@ -343,6 +346,11 @@ struct amdgpu_fw_shared_rb_setup {
|
||||
uint32_t reserved[6];
|
||||
};
|
||||
|
||||
struct amdgpu_fw_shared_drm_key_wa {
|
||||
uint8_t method;
|
||||
uint8_t reserved[3];
|
||||
};
|
||||
|
||||
struct amdgpu_vcn4_fw_shared {
|
||||
uint32_t present_flag_0;
|
||||
uint8_t pad[12];
|
||||
@ -352,6 +360,7 @@ struct amdgpu_vcn4_fw_shared {
|
||||
uint8_t pad2[20];
|
||||
struct amdgpu_fw_shared_rb_setup rb_setup;
|
||||
struct amdgpu_fw_shared_smu_interface_info smu_dpm_interface;
|
||||
struct amdgpu_fw_shared_drm_key_wa drm_key_wa;
|
||||
};
|
||||
|
||||
struct amdgpu_vcn_fwlog {
|
||||
@ -414,4 +423,7 @@ int amdgpu_vcn_ras_late_init(struct amdgpu_device *adev,
|
||||
struct ras_common_if *ras_block);
|
||||
int amdgpu_vcn_ras_sw_init(struct amdgpu_device *adev);
|
||||
|
||||
int amdgpu_vcn_psp_update_sram(struct amdgpu_device *adev, int inst_idx,
|
||||
enum AMDGPU_UCODE_ID ucode_id);
|
||||
|
||||
#endif
|
||||
|
@ -835,6 +835,16 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *ad
|
||||
return mode;
|
||||
}
|
||||
|
||||
void amdgpu_virt_post_reset(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(11, 0, 3)) {
|
||||
/* force set to GFXOFF state after reset,
|
||||
* to avoid some invalid operation before GC enable
|
||||
*/
|
||||
adev->gfx.is_poweron = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool amdgpu_virt_fw_load_skip_check(struct amdgpu_device *adev, uint32_t ucode_id)
|
||||
{
|
||||
switch (adev->ip_versions[MP0_HWIP][0]) {
|
||||
@ -845,6 +855,17 @@ bool amdgpu_virt_fw_load_skip_check(struct amdgpu_device *adev, uint32_t ucode_i
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
case IP_VERSION(11, 0, 9):
|
||||
case IP_VERSION(11, 0, 7):
|
||||
/* black list for CHIP_NAVI12 and CHIP_SIENNA_CICHLID */
|
||||
if (ucode_id == AMDGPU_UCODE_ID_RLC_G
|
||||
|| ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL
|
||||
|| ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM
|
||||
|| ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM
|
||||
|| ucode_id == AMDGPU_UCODE_ID_SMC)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
case IP_VERSION(13, 0, 10):
|
||||
/* white list */
|
||||
if (ucode_id == AMDGPU_UCODE_ID_CAP
|
||||
@ -954,7 +975,7 @@ static bool amdgpu_virt_get_rlcg_reg_access_flag(struct amdgpu_device *adev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 flag)
|
||||
static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 flag, u32 xcc_id)
|
||||
{
|
||||
struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
|
||||
uint32_t timeout = 50000;
|
||||
@ -972,7 +993,12 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
|
||||
return 0;
|
||||
}
|
||||
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
|
||||
if (adev->gfx.xcc_mask && (((1 << xcc_id) & adev->gfx.xcc_mask) == 0)) {
|
||||
dev_err(adev->dev, "invalid xcc\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[xcc_id];
|
||||
scratch_reg0 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg0;
|
||||
scratch_reg1 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg1;
|
||||
scratch_reg2 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg2;
|
||||
@ -1037,13 +1063,13 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
|
||||
|
||||
void amdgpu_sriov_wreg(struct amdgpu_device *adev,
|
||||
u32 offset, u32 value,
|
||||
u32 acc_flags, u32 hwip)
|
||||
u32 acc_flags, u32 hwip, u32 xcc_id)
|
||||
{
|
||||
u32 rlcg_flag;
|
||||
|
||||
if (!amdgpu_sriov_runtime(adev) &&
|
||||
amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, true, &rlcg_flag)) {
|
||||
amdgpu_virt_rlcg_reg_rw(adev, offset, value, rlcg_flag);
|
||||
amdgpu_virt_rlcg_reg_rw(adev, offset, value, rlcg_flag, xcc_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1054,13 +1080,13 @@ void amdgpu_sriov_wreg(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
|
||||
u32 offset, u32 acc_flags, u32 hwip)
|
||||
u32 offset, u32 acc_flags, u32 hwip, u32 xcc_id)
|
||||
{
|
||||
u32 rlcg_flag;
|
||||
|
||||
if (!amdgpu_sriov_runtime(adev) &&
|
||||
amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, false, &rlcg_flag))
|
||||
return amdgpu_virt_rlcg_reg_rw(adev, offset, 0, rlcg_flag);
|
||||
return amdgpu_virt_rlcg_reg_rw(adev, offset, 0, rlcg_flag, xcc_id);
|
||||
|
||||
if (acc_flags & AMDGPU_REGS_NO_KIQ)
|
||||
return RREG32_NO_KIQ(offset);
|
||||
|
@ -355,9 +355,10 @@ void amdgpu_virt_update_sriov_video_codec(struct amdgpu_device *adev,
|
||||
struct amdgpu_video_codec_info *decode, uint32_t decode_array_size);
|
||||
void amdgpu_sriov_wreg(struct amdgpu_device *adev,
|
||||
u32 offset, u32 value,
|
||||
u32 acc_flags, u32 hwip);
|
||||
u32 acc_flags, u32 hwip, u32 xcc_id);
|
||||
u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
|
||||
u32 offset, u32 acc_flags, u32 hwip);
|
||||
u32 offset, u32 acc_flags, u32 hwip, u32 xcc_id);
|
||||
bool amdgpu_virt_fw_load_skip_check(struct amdgpu_device *adev,
|
||||
uint32_t ucode_id);
|
||||
void amdgpu_virt_post_reset(struct amdgpu_device *adev);
|
||||
#endif
|
||||
|
@ -55,8 +55,9 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer)
|
||||
DRM_WARN("%s: vblank timer overrun\n", __func__);
|
||||
|
||||
ret = drm_crtc_handle_vblank(crtc);
|
||||
/* Don't queue timer again when vblank is disabled. */
|
||||
if (!ret)
|
||||
DRM_ERROR("amdgpu_vkms failure on handling vblank");
|
||||
return HRTIMER_NORESTART;
|
||||
|
||||
return HRTIMER_RESTART;
|
||||
}
|
||||
@ -81,7 +82,7 @@ static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc)
|
||||
{
|
||||
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||
|
||||
hrtimer_cancel(&amdgpu_crtc->vblank_timer);
|
||||
hrtimer_try_to_cancel(&amdgpu_crtc->vblank_timer);
|
||||
}
|
||||
|
||||
static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc,
|
||||
@ -500,8 +501,6 @@ static int amdgpu_vkms_sw_init(void *handle)
|
||||
|
||||
adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
|
||||
|
||||
adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
|
||||
|
||||
r = amdgpu_display_modeset_create_props(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
@ -112,9 +112,9 @@ struct amdgpu_prt_cb {
|
||||
};
|
||||
|
||||
/**
|
||||
* struct amdgpu_vm_tlb_seq_cb - Helper to increment the TLB flush sequence
|
||||
* struct amdgpu_vm_tlb_seq_struct - Helper to increment the TLB flush sequence
|
||||
*/
|
||||
struct amdgpu_vm_tlb_seq_cb {
|
||||
struct amdgpu_vm_tlb_seq_struct {
|
||||
/**
|
||||
* @vm: pointer to the amdgpu_vm structure to set the fence sequence on
|
||||
*/
|
||||
@ -829,7 +829,7 @@ error:
|
||||
static void amdgpu_vm_tlb_seq_cb(struct dma_fence *fence,
|
||||
struct dma_fence_cb *cb)
|
||||
{
|
||||
struct amdgpu_vm_tlb_seq_cb *tlb_cb;
|
||||
struct amdgpu_vm_tlb_seq_struct *tlb_cb;
|
||||
|
||||
tlb_cb = container_of(cb, typeof(*tlb_cb), cb);
|
||||
atomic64_inc(&tlb_cb->vm->tlb_seq);
|
||||
@ -867,7 +867,7 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
struct dma_fence **fence)
|
||||
{
|
||||
struct amdgpu_vm_update_params params;
|
||||
struct amdgpu_vm_tlb_seq_cb *tlb_cb;
|
||||
struct amdgpu_vm_tlb_seq_struct *tlb_cb;
|
||||
struct amdgpu_res_cursor cursor;
|
||||
enum amdgpu_sync_mode sync_mode;
|
||||
int r, idx;
|
||||
@ -2117,13 +2117,14 @@ long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout)
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @vm: requested vm
|
||||
* @xcp_id: GPU partition selection id
|
||||
*
|
||||
* Init @vm fields.
|
||||
*
|
||||
* Returns:
|
||||
* 0 for success, error for failure.
|
||||
*/
|
||||
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
|
||||
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int32_t xcp_id)
|
||||
{
|
||||
struct amdgpu_bo *root_bo;
|
||||
struct amdgpu_bo_vm *root;
|
||||
@ -2173,7 +2174,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
|
||||
vm->evicting = false;
|
||||
|
||||
r = amdgpu_vm_pt_create(adev, vm, adev->vm_manager.root_level,
|
||||
false, &root);
|
||||
false, &root, xcp_id);
|
||||
if (r)
|
||||
goto error_free_delayed;
|
||||
root_bo = &root->bo;
|
||||
@ -2275,16 +2276,13 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
|
||||
goto unreserve_bo;
|
||||
|
||||
vm->update_funcs = &amdgpu_vm_cpu_funcs;
|
||||
r = amdgpu_vm_pt_map_tables(adev, vm);
|
||||
if (r)
|
||||
goto unreserve_bo;
|
||||
|
||||
} else {
|
||||
vm->update_funcs = &amdgpu_vm_sdma_funcs;
|
||||
}
|
||||
/*
|
||||
* Make sure root PD gets mapped. As vm_update_mode could be changed
|
||||
* when turning a GFX VM into a compute VM.
|
||||
*/
|
||||
r = vm->update_funcs->map_table(to_amdgpu_bo_vm(vm->root.bo));
|
||||
if (r)
|
||||
goto unreserve_bo;
|
||||
|
||||
dma_fence_put(vm->last_update);
|
||||
vm->last_update = dma_fence_get_stub();
|
||||
@ -2600,7 +2598,7 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
|
||||
/* Intentionally setting invalid PTE flag
|
||||
* combination to force a no-retry-fault
|
||||
*/
|
||||
flags = AMDGPU_PTE_SNOOPED | AMDGPU_PTE_PRT;
|
||||
flags = AMDGPU_VM_NORETRY_FLAGS;
|
||||
value = 0;
|
||||
} else if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_NEVER) {
|
||||
/* Redirect the access to the dummy page */
|
||||
|
@ -86,7 +86,13 @@ struct amdgpu_mem_stats;
|
||||
/* PDE Block Fragment Size for VEGA10 */
|
||||
#define AMDGPU_PDE_BFS(a) ((uint64_t)a << 59)
|
||||
|
||||
/* Flag combination to set no-retry with TF disabled */
|
||||
#define AMDGPU_VM_NORETRY_FLAGS (AMDGPU_PTE_EXECUTABLE | AMDGPU_PDE_PTE | \
|
||||
AMDGPU_PTE_TF)
|
||||
|
||||
/* Flag combination to set no-retry with TF enabled */
|
||||
#define AMDGPU_VM_NORETRY_FLAGS_TF (AMDGPU_PTE_VALID | AMDGPU_PTE_SYSTEM | \
|
||||
AMDGPU_PTE_PRT)
|
||||
/* For GFX9 */
|
||||
#define AMDGPU_PTE_MTYPE_VG10(a) ((uint64_t)(a) << 57)
|
||||
#define AMDGPU_PTE_MTYPE_VG10_MASK AMDGPU_PTE_MTYPE_VG10(3ULL)
|
||||
@ -394,7 +400,7 @@ int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
u32 pasid);
|
||||
|
||||
long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout);
|
||||
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm);
|
||||
int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int32_t xcp_id);
|
||||
int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
|
||||
void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
|
||||
void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
|
||||
@ -476,7 +482,8 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm,
|
||||
int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
struct amdgpu_bo_vm *vmbo, bool immediate);
|
||||
int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
int level, bool immediate, struct amdgpu_bo_vm **vmbo);
|
||||
int level, bool immediate, struct amdgpu_bo_vm **vmbo,
|
||||
int32_t xcp_id);
|
||||
void amdgpu_vm_pt_free_root(struct amdgpu_device *adev, struct amdgpu_vm *vm);
|
||||
bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,
|
||||
struct amdgpu_vm *vm);
|
||||
@ -492,6 +499,8 @@ void amdgpu_vm_pt_free_work(struct work_struct *work);
|
||||
void amdgpu_debugfs_vm_bo_info(struct amdgpu_vm *vm, struct seq_file *m);
|
||||
#endif
|
||||
|
||||
int amdgpu_vm_pt_map_tables(struct amdgpu_device *adev, struct amdgpu_vm *vm);
|
||||
|
||||
/**
|
||||
* amdgpu_vm_tlb_seq - return tlb flush sequence number
|
||||
* @vm: the amdgpu_vm structure to query
|
||||
|
@ -31,6 +31,7 @@
|
||||
*/
|
||||
static int amdgpu_vm_cpu_map_table(struct amdgpu_bo_vm *table)
|
||||
{
|
||||
table->bo.flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
|
||||
return amdgpu_bo_kmap(&table->bo, NULL);
|
||||
}
|
||||
|
||||
|
@ -498,11 +498,12 @@ exit:
|
||||
* @level: the page table level
|
||||
* @immediate: use a immediate update
|
||||
* @vmbo: pointer to the buffer object pointer
|
||||
* @xcp_id: GPU partition id
|
||||
*/
|
||||
int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
int level, bool immediate, struct amdgpu_bo_vm **vmbo)
|
||||
int level, bool immediate, struct amdgpu_bo_vm **vmbo,
|
||||
int32_t xcp_id)
|
||||
{
|
||||
struct amdgpu_fpriv *fpriv = container_of(vm, struct amdgpu_fpriv, vm);
|
||||
struct amdgpu_bo_param bp;
|
||||
struct amdgpu_bo *bo;
|
||||
struct dma_resv *resv;
|
||||
@ -535,7 +536,7 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
|
||||
bp.type = ttm_bo_type_kernel;
|
||||
bp.no_wait_gpu = immediate;
|
||||
bp.xcp_id_plus1 = fpriv->xcp_id == ~0 ? 0 : fpriv->xcp_id + 1;
|
||||
bp.xcp_id_plus1 = xcp_id + 1;
|
||||
|
||||
if (vm->root.bo)
|
||||
bp.resv = vm->root.bo->tbo.base.resv;
|
||||
@ -561,7 +562,7 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
|
||||
bp.type = ttm_bo_type_kernel;
|
||||
bp.resv = bo->tbo.base.resv;
|
||||
bp.bo_ptr_size = sizeof(struct amdgpu_bo);
|
||||
bp.xcp_id_plus1 = fpriv->xcp_id == ~0 ? 0 : fpriv->xcp_id + 1;
|
||||
bp.xcp_id_plus1 = xcp_id + 1;
|
||||
|
||||
r = amdgpu_bo_create(adev, &bp, &(*vmbo)->shadow);
|
||||
|
||||
@ -606,7 +607,8 @@ static int amdgpu_vm_pt_alloc(struct amdgpu_device *adev,
|
||||
return 0;
|
||||
|
||||
amdgpu_vm_eviction_unlock(vm);
|
||||
r = amdgpu_vm_pt_create(adev, vm, cursor->level, immediate, &pt);
|
||||
r = amdgpu_vm_pt_create(adev, vm, cursor->level, immediate, &pt,
|
||||
vm->root.bo->xcp_id);
|
||||
amdgpu_vm_eviction_lock(vm);
|
||||
if (r)
|
||||
return r;
|
||||
@ -778,6 +780,27 @@ int amdgpu_vm_pde_update(struct amdgpu_vm_update_params *params,
|
||||
1, 0, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_vm_pte_update_noretry_flags - Update PTE no-retry flags
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @flags: pointer to PTE flags
|
||||
*
|
||||
* Update PTE no-retry flags when TF is enabled.
|
||||
*/
|
||||
static void amdgpu_vm_pte_update_noretry_flags(struct amdgpu_device *adev,
|
||||
uint64_t *flags)
|
||||
{
|
||||
/*
|
||||
* Update no-retry flags with the corresponding TF
|
||||
* no-retry combination.
|
||||
*/
|
||||
if ((*flags & AMDGPU_VM_NORETRY_FLAGS) == AMDGPU_VM_NORETRY_FLAGS) {
|
||||
*flags &= ~AMDGPU_VM_NORETRY_FLAGS;
|
||||
*flags |= adev->gmc.noretry_flags;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* amdgpu_vm_pte_update_flags - figure out flags for PTE updates
|
||||
*
|
||||
@ -804,6 +827,16 @@ static void amdgpu_vm_pte_update_flags(struct amdgpu_vm_update_params *params,
|
||||
flags |= AMDGPU_PTE_EXECUTABLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update no-retry flags to use the no-retry flag combination
|
||||
* with TF enabled. The AMDGPU_VM_NORETRY_FLAGS flag combination
|
||||
* does not work when TF is enabled. So, replace them with
|
||||
* AMDGPU_VM_NORETRY_FLAGS_TF flag combination which works for
|
||||
* all cases.
|
||||
*/
|
||||
if (level == AMDGPU_VM_PTB)
|
||||
amdgpu_vm_pte_update_noretry_flags(adev, &flags);
|
||||
|
||||
/* APUs mapping system memory may need different MTYPEs on different
|
||||
* NUMA nodes. Only do this for contiguous ranges that can be assumed
|
||||
* to be on the same NUMA node.
|
||||
@ -1044,3 +1077,31 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_vm_pt_map_tables - have bo of root PD cpu accessible
|
||||
* @adev: amdgpu device structure
|
||||
* @vm: amdgpu vm structure
|
||||
*
|
||||
* make root page directory and everything below it cpu accessible.
|
||||
*/
|
||||
int amdgpu_vm_pt_map_tables(struct amdgpu_device *adev, struct amdgpu_vm *vm)
|
||||
{
|
||||
struct amdgpu_vm_pt_cursor cursor;
|
||||
struct amdgpu_vm_bo_base *entry;
|
||||
|
||||
for_each_amdgpu_vm_pt_dfs_safe(adev, vm, NULL, cursor, entry) {
|
||||
|
||||
struct amdgpu_bo_vm *bo;
|
||||
int r;
|
||||
|
||||
if (entry->bo) {
|
||||
bo = to_amdgpu_bo_vm(entry->bo);
|
||||
r = vm->update_funcs->map_table(bo);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,
|
||||
if (!adev->xcp_mgr)
|
||||
return 0;
|
||||
|
||||
fpriv->xcp_id = ~0;
|
||||
fpriv->xcp_id = AMDGPU_XCP_NO_PARTITION;
|
||||
for (i = 0; i < MAX_XCP; ++i) {
|
||||
if (!adev->xcp_mgr->xcp[i].ddev)
|
||||
break;
|
||||
@ -381,7 +381,7 @@ int amdgpu_xcp_open_device(struct amdgpu_device *adev,
|
||||
}
|
||||
}
|
||||
|
||||
fpriv->vm.mem_id = fpriv->xcp_id == ~0 ? -1 :
|
||||
fpriv->vm.mem_id = fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION ? -1 :
|
||||
adev->xcp_mgr->xcp[fpriv->xcp_id].mem_id;
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@
|
||||
#define AMDGPU_XCP_FL_NONE 0
|
||||
#define AMDGPU_XCP_FL_LOCKED (1 << 0)
|
||||
|
||||
#define AMDGPU_XCP_NO_PARTITION (~0)
|
||||
|
||||
struct amdgpu_fpriv;
|
||||
|
||||
enum AMDGPU_XCP_IP_BLOCK {
|
||||
|
@ -500,6 +500,7 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
|
||||
hive = kzalloc(sizeof(*hive), GFP_KERNEL);
|
||||
if (!hive) {
|
||||
dev_err(adev->dev, "XGMI: allocation failed\n");
|
||||
ret = -ENOMEM;
|
||||
hive = NULL;
|
||||
goto pro_end;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ static void aqua_vanjaram_set_xcp_id(struct amdgpu_device *adev,
|
||||
enum AMDGPU_XCP_IP_BLOCK ip_blk;
|
||||
uint32_t inst_mask;
|
||||
|
||||
ring->xcp_id = ~0;
|
||||
ring->xcp_id = AMDGPU_XCP_NO_PARTITION;
|
||||
if (adev->xcp_mgr->mode == AMDGPU_XCP_MODE_NONE)
|
||||
return;
|
||||
|
||||
@ -134,7 +134,7 @@ static int aqua_vanjaram_xcp_sched_list_update(
|
||||
|
||||
for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
|
||||
ring = adev->rings[i];
|
||||
if (!ring || !ring->sched.ready)
|
||||
if (!ring || !ring->sched.ready || ring->no_scheduler)
|
||||
continue;
|
||||
|
||||
aqua_vanjaram_xcp_gpu_sched_update(adev, ring, ring->xcp_id);
|
||||
@ -177,7 +177,7 @@ static int aqua_vanjaram_select_scheds(
|
||||
u32 sel_xcp_id;
|
||||
int i;
|
||||
|
||||
if (fpriv->xcp_id == ~0) {
|
||||
if (fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION) {
|
||||
u32 least_ref_cnt = ~0;
|
||||
|
||||
fpriv->xcp_id = 0;
|
@ -1438,6 +1438,8 @@ static void atom_get_vbios_pn(struct atom_context *ctx)
|
||||
|
||||
ctx->vbios_pn[count] = 0;
|
||||
}
|
||||
|
||||
pr_info("ATOM BIOS: %s\n", ctx->vbios_pn);
|
||||
}
|
||||
|
||||
static void atom_get_vbios_version(struct atom_context *ctx)
|
||||
@ -1460,11 +1462,9 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
|
||||
int base;
|
||||
struct atom_context *ctx =
|
||||
kzalloc(sizeof(struct atom_context), GFP_KERNEL);
|
||||
char *str;
|
||||
struct _ATOM_ROM_HEADER *atom_rom_header;
|
||||
struct _ATOM_MASTER_DATA_TABLE *master_table;
|
||||
struct _ATOM_FIRMWARE_INFO *atom_fw_info;
|
||||
u16 idx;
|
||||
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
@ -1502,16 +1502,6 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
idx = CU16(ATOM_ROM_PART_NUMBER_PTR);
|
||||
if (idx == 0)
|
||||
idx = 0x80;
|
||||
|
||||
str = CSTR(idx);
|
||||
if (*str != '\0') {
|
||||
pr_info("ATOM BIOS: %s\n", str);
|
||||
strscpy(ctx->vbios_version, str, sizeof(ctx->vbios_version));
|
||||
}
|
||||
|
||||
atom_rom_header = (struct _ATOM_ROM_HEADER *)CSTR(base);
|
||||
if (atom_rom_header->usMasterDataTableOffset != 0) {
|
||||
master_table = (struct _ATOM_MASTER_DATA_TABLE *)
|
||||
|
@ -33,7 +33,6 @@ struct drm_device;
|
||||
#define ATOM_ATI_MAGIC_PTR 0x30
|
||||
#define ATOM_ATI_MAGIC " 761295520"
|
||||
#define ATOM_ROM_TABLE_PTR 0x48
|
||||
#define ATOM_ROM_PART_NUMBER_PTR 0x6E
|
||||
|
||||
#define ATOM_ROM_MAGIC "ATOM"
|
||||
#define ATOM_ROM_MAGIC_PTR 4
|
||||
@ -143,7 +142,6 @@ struct atom_context {
|
||||
int io_mode;
|
||||
uint32_t *scratch;
|
||||
int scratch_size_bytes;
|
||||
char vbios_version[20];
|
||||
|
||||
uint8_t name[STRLEN_LONG];
|
||||
uint8_t vbios_pn[STRLEN_LONG];
|
||||
|
@ -271,8 +271,7 @@ MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec.bin");
|
||||
MODULE_FIRMWARE("amdgpu/gc_10_3_7_mec2.bin");
|
||||
MODULE_FIRMWARE("amdgpu/gc_10_3_7_rlc.bin");
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x00400014),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_CPF_CLK_CTRL, 0xfcff8fff, 0xf8000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CLK_CTRL, 0xcd000000, 0x0d000100),
|
||||
@ -315,13 +314,11 @@ static const struct soc15_reg_golden golden_settings_gc_10_1[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x00c00000, 0x00c00000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_0_nv10[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_0_nv10[] = {
|
||||
/* Pending on emulation bring up */
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_0_nv10[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_0_nv10[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xe0000000, 0x0),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xffffff, 0x0),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmRLC_SPM_GLB_SAMPLEDELAY_IND_ADDR, 0xFFFFFFFF, 0x28),
|
||||
@ -1376,8 +1373,7 @@ static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_0_nv10[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xFFFFFFFF, 0xe0000000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_1[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_1[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0xffffffff, 0x003c0014),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_IA_CLK_CTRL, 0xffff0fff, 0xffff0100),
|
||||
@ -1418,8 +1414,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_1[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x00c00000, 0x00c00000),
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_2[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_2[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_4, 0x003e001f, 0x003c0014),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_GS_NGG_CLK_CTRL, 0xffff8fff, 0xffff8100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_IA_CLK_CTRL, 0xffff0fff, 0xffff0100),
|
||||
@ -1464,13 +1459,11 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00c00000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_nv14[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_nv14[] = {
|
||||
/* Pending on emulation bring up */
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_nv14[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_nv14[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xE0000000L, 0x0),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xffffff, 0x0),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmRLC_SPM_GLB_SAMPLEDELAY_IND_ADDR, 0xFFFFFFFF, 0x28),
|
||||
@ -2093,13 +2086,11 @@ static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_nv14[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xFFFFFFFF, 0xe0000000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_2_nv12[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_1_2_nv12[] = {
|
||||
/* Pending on emulation bring up */
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_2_nv12[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_2_nv12[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xe0000000L, 0x0),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xffffff, 0x0),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmRLC_SPM_GLB_SAMPLEDELAY_IND_ADDR, 0xFFFFFFFF, 0x28),
|
||||
@ -3154,8 +3145,7 @@ static const struct soc15_reg_golden golden_settings_gc_rlc_spm_10_1_2_nv12[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGRBM_GFX_INDEX, 0xFFFFFFFF, 0xe0000000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0x78000000, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_PS_CLK_CTRL, 0xff7f0fff, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA0_CLK_CTRL, 0xff7f0fff, 0x30000100),
|
||||
@ -3164,7 +3154,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG3, 0xffffffff, 0x00000280),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_DEBUG4, 0xffffffff, 0x00800000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmDB_EXCEPTION_CONTROL, 0x7fff0f1f, 0x00b80000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0 ,mmGCEA_SDP_TAG_RESERVE0, 0xffffffff, 0x10100100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCEA_SDP_TAG_RESERVE0, 0xffffffff, 0x10100100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCEA_SDP_TAG_RESERVE1, 0xffffffff, 0x17000088),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCR_GENERAL_CNTL_Sienna_Cichlid, 0x1ff1ffff, 0x00000500),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmGCUTCL2_CGTT_CLK_CTRL_Sienna_Cichlid, 0xff000000, 0xff008080),
|
||||
@ -3201,13 +3191,11 @@ static const struct soc15_reg_golden golden_settings_gc_10_3[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffbfffff, 0x00a00000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_sienna_cichlid[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_sienna_cichlid[] = {
|
||||
/* Pending on emulation bring up */
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_2[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_2[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0xff7f0fff, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_PS_CLK_CTRL, 0xff7f0fff, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA0_CLK_CTRL, 0xff7f0fff, 0x30000100),
|
||||
@ -3254,8 +3242,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3_2[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x00000020, 0x00000020),
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_vangogh[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_vangogh[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA0_CLK_CTRL, 0xff7f0fff, 0x30000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA1_CLK_CTRL, 0xff7f0fff, 0x7e000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_PIPE_STEER, 0x000000ff, 0x000000e4),
|
||||
@ -3285,8 +3272,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3_vangogh[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmLDS_CONFIG, 0x00000020, 0x00000020),
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_3[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_3[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0xff7f0fff, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_PIPE_STEER, 0x000000ff, 0x000000e4),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCPF_GCR_CNTL, 0x0007ffff, 0x0000c200),
|
||||
@ -3309,8 +3295,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3_3[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffffffff, 0x00100000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_4[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_4[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0x78000000, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA0_CLK_CTRL, 0x30000000, 0x30000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_RA1_CLK_CTRL, 0x7e000000, 0x7e000100),
|
||||
@ -3380,7 +3365,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_3_5[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER7_SELECT, 0xf0f001ff, 0x00000000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER8_SELECT, 0xf0f001ff, 0x00000000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmSQ_PERFCOUNTER9_SELECT, 0xf0f001ff, 0x00000000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX,0xfff7ffff, 0x01030000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmTA_CNTL_AUX, 0xfff7ffff, 0x01030000),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0xffbfffff, 0x00a00000)
|
||||
};
|
||||
|
||||
@ -3421,8 +3406,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_0_cyan_skillfish[] =
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmUTCL1_CTRL, 0x00800000, 0x00800000)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_6[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_gc_10_3_6[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCGTT_SPI_CS_CLK_CTRL, 0xff7f0fff, 0x78000100),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCH_PIPE_STEER, 0x000000ff, 0x00000044),
|
||||
SOC15_REG_GOLDEN_VALUE(GC, 0, mmCPF_GCR_CNTL, 0x0007ffff, 0x0000c200),
|
||||
@ -3506,6 +3490,8 @@ static void gfx_v10_3_set_power_brake_sequence(struct amdgpu_device *adev);
|
||||
static void gfx_v10_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,
|
||||
uint16_t pasid, uint32_t flush_type,
|
||||
bool all_hub, uint8_t dst_sel);
|
||||
static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
||||
unsigned int vmid);
|
||||
|
||||
static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queue_mask)
|
||||
{
|
||||
@ -3714,8 +3700,8 @@ static void gfx_v10_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
break;
|
||||
case IP_VERSION(10, 3, 4):
|
||||
soc15_program_register_sequence(adev,
|
||||
golden_settings_gc_10_3_4,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_4));
|
||||
golden_settings_gc_10_3_4,
|
||||
(const u32)ARRAY_SIZE(golden_settings_gc_10_3_4));
|
||||
break;
|
||||
case IP_VERSION(10, 3, 5):
|
||||
soc15_program_register_sequence(adev,
|
||||
@ -3782,7 +3768,7 @@ static int gfx_v10_0_ring_test_ring(struct amdgpu_ring *ring)
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
uint32_t scratch = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0);
|
||||
uint32_t tmp = 0;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
int r;
|
||||
|
||||
WREG32(scratch, 0xCAFEDEAD);
|
||||
@ -3820,7 +3806,7 @@ static int gfx_v10_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
struct amdgpu_ib ib;
|
||||
struct dma_fence *f = NULL;
|
||||
unsigned index;
|
||||
unsigned int index;
|
||||
uint64_t gpu_addr;
|
||||
volatile uint32_t *cpu_ptr;
|
||||
long r;
|
||||
@ -3951,7 +3937,7 @@ static bool gfx_v10_0_navi10_gfxoff_should_enable(struct amdgpu_device *adev)
|
||||
break;
|
||||
}
|
||||
|
||||
return ret ;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev)
|
||||
@ -4151,7 +4137,7 @@ static void gfx_v10_0_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
|
||||
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[0];
|
||||
reg_access_ctrl->scratch_reg0 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0);
|
||||
reg_access_ctrl->scratch_reg1 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG1);
|
||||
reg_access_ctrl->scratch_reg2 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG2);
|
||||
@ -4159,14 +4145,14 @@ static void gfx_v10_0_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
|
||||
reg_access_ctrl->grbm_cntl = SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_CNTL);
|
||||
reg_access_ctrl->grbm_idx = SOC15_REG_OFFSET(GC, 0, mmGRBM_GFX_INDEX);
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
reg_access_ctrl->spare_int =
|
||||
SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT_0_Sienna_Cichlid);
|
||||
break;
|
||||
default:
|
||||
reg_access_ctrl->spare_int =
|
||||
SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT);
|
||||
break;
|
||||
case IP_VERSION(10, 3, 0):
|
||||
reg_access_ctrl->spare_int =
|
||||
SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT_0_Sienna_Cichlid);
|
||||
break;
|
||||
default:
|
||||
reg_access_ctrl->spare_int =
|
||||
SOC15_REG_OFFSET(GC, 0, mmRLC_SPARE_INT);
|
||||
break;
|
||||
}
|
||||
adev->gfx.rlc.rlcg_reg_access_supported = true;
|
||||
}
|
||||
@ -4187,11 +4173,6 @@ static int gfx_v10_0_rlc_init(struct amdgpu_device *adev)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* init spm vmid with 0xf */
|
||||
if (adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4213,7 +4194,7 @@ static int gfx_v10_0_mec_init(struct amdgpu_device *adev)
|
||||
int r;
|
||||
u32 *hpd;
|
||||
const __le32 *fw_data = NULL;
|
||||
unsigned fw_size;
|
||||
unsigned int fw_size;
|
||||
u32 *fw = NULL;
|
||||
size_t mec_hpd_size;
|
||||
|
||||
@ -4295,7 +4276,8 @@ static void gfx_v10_0_read_wave_data(struct amdgpu_device *adev, uint32_t xcc_id
|
||||
{
|
||||
/* in gfx10 the SIMD_ID is specified as part of the INSTANCE
|
||||
* field when performing a select_se_sh so it should be
|
||||
* zero here */
|
||||
* zero here
|
||||
*/
|
||||
WARN_ON(simd != 0);
|
||||
|
||||
/* type 2 wave data */
|
||||
@ -4474,7 +4456,7 @@ static int gfx_v10_0_gfx_ring_init(struct amdgpu_device *adev, int ring_id,
|
||||
static int gfx_v10_0_compute_ring_init(struct amdgpu_device *adev, int ring_id,
|
||||
int mec, int pipe, int queue)
|
||||
{
|
||||
unsigned irq_type;
|
||||
unsigned int irq_type;
|
||||
struct amdgpu_ring *ring;
|
||||
unsigned int hw_prio;
|
||||
|
||||
@ -4795,7 +4777,8 @@ static u32 gfx_v10_0_init_pa_sc_tile_steering_override(struct amdgpu_device *ade
|
||||
uint32_t pa_sc_tile_steering_override;
|
||||
|
||||
/* for ASICs that integrates GFX v10.3
|
||||
* pa_sc_tile_steering_override should be set to 0 */
|
||||
* pa_sc_tile_steering_override should be set to 0
|
||||
*/
|
||||
if (adev->ip_versions[GC_HWIP][0] >= IP_VERSION(10, 3, 0))
|
||||
return 0;
|
||||
|
||||
@ -4871,8 +4854,10 @@ static void gfx_v10_0_init_compute_vmid(struct amdgpu_device *adev)
|
||||
nv_grbm_select(adev, 0, 0, 0, 0);
|
||||
mutex_unlock(&adev->srbm_mutex);
|
||||
|
||||
/* Initialize all compute VMIDs to have no GDS, GWS, or OA
|
||||
access. These should be enabled by FW for target VMIDs. */
|
||||
/*
|
||||
* Initialize all compute VMIDs to have no GDS, GWS, or OA
|
||||
* access. These should be enabled by FW for target VMIDs.
|
||||
*/
|
||||
for (i = adev->vm_manager.first_kfd_vmid; i < AMDGPU_NUM_VMID; i++) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_BASE, 2 * i, 0);
|
||||
WREG32_SOC15_OFFSET(GC, 0, mmGDS_VMID0_SIZE, 2 * i, 0);
|
||||
@ -5108,8 +5093,10 @@ static void gfx_v10_0_rlc_smu_handshake_cntl(struct amdgpu_device *adev,
|
||||
|
||||
static void gfx_v10_0_rlc_start(struct amdgpu_device *adev)
|
||||
{
|
||||
/* TODO: enable rlc & smu handshake until smu
|
||||
* and gfxoff feature works as expected */
|
||||
/*
|
||||
* TODO: enable rlc & smu handshake until smu
|
||||
* and gfxoff feature works as expected
|
||||
*/
|
||||
if (!(amdgpu_pp_feature_mask & PP_GFXOFF_MASK))
|
||||
gfx_v10_0_rlc_smu_handshake_cntl(adev, false);
|
||||
|
||||
@ -5132,7 +5119,7 @@ static int gfx_v10_0_rlc_load_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct rlc_firmware_header_v2_0 *hdr;
|
||||
const __le32 *fw_data;
|
||||
unsigned i, fw_size;
|
||||
unsigned int i, fw_size;
|
||||
|
||||
if (!adev->gfx.rlc_fw)
|
||||
return -EINVAL;
|
||||
@ -5169,6 +5156,8 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)
|
||||
|
||||
gfx_v10_0_init_csb(adev);
|
||||
|
||||
gfx_v10_0_update_spm_vmid_internal(adev, 0xf);
|
||||
|
||||
if (!amdgpu_sriov_vf(adev)) /* enable RLC SRM */
|
||||
gfx_v10_0_rlc_enable_srm(adev);
|
||||
} else {
|
||||
@ -5199,6 +5188,8 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)
|
||||
|
||||
gfx_v10_0_init_csb(adev);
|
||||
|
||||
gfx_v10_0_update_spm_vmid_internal(adev, 0xf);
|
||||
|
||||
adev->gfx.rlc.funcs->start(adev);
|
||||
|
||||
if (adev->firmware.load_type == AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO) {
|
||||
@ -5207,6 +5198,7 @@ static int gfx_v10_0_rlc_resume(struct amdgpu_device *adev)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5674,11 +5666,10 @@ static int gfx_v10_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable)
|
||||
tmp = REG_SET_FIELD(tmp, CP_ME_CNTL, PFP_HALT, enable ? 0 : 1);
|
||||
tmp = REG_SET_FIELD(tmp, CP_ME_CNTL, CE_HALT, enable ? 0 : 1);
|
||||
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 2)) {
|
||||
if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 2))
|
||||
WREG32_SOC15_RLC(GC, 0, mmCP_ME_CNTL, tmp);
|
||||
} else {
|
||||
else
|
||||
WREG32_SOC15(GC, 0, mmCP_ME_CNTL, tmp);
|
||||
}
|
||||
|
||||
if (adev->job_hang && !enable)
|
||||
return 0;
|
||||
@ -5700,7 +5691,7 @@ static int gfx_v10_0_cp_gfx_load_pfp_microcode(struct amdgpu_device *adev)
|
||||
int r;
|
||||
const struct gfx_firmware_header_v1_0 *pfp_hdr;
|
||||
const __le32 *fw_data;
|
||||
unsigned i, fw_size;
|
||||
unsigned int i, fw_size;
|
||||
uint32_t tmp;
|
||||
uint32_t usec_timeout = 50000; /* wait for 50ms */
|
||||
|
||||
@ -5778,7 +5769,7 @@ static int gfx_v10_0_cp_gfx_load_ce_microcode(struct amdgpu_device *adev)
|
||||
int r;
|
||||
const struct gfx_firmware_header_v1_0 *ce_hdr;
|
||||
const __le32 *fw_data;
|
||||
unsigned i, fw_size;
|
||||
unsigned int i, fw_size;
|
||||
uint32_t tmp;
|
||||
uint32_t usec_timeout = 50000; /* wait for 50ms */
|
||||
|
||||
@ -5855,7 +5846,7 @@ static int gfx_v10_0_cp_gfx_load_me_microcode(struct amdgpu_device *adev)
|
||||
int r;
|
||||
const struct gfx_firmware_header_v1_0 *me_hdr;
|
||||
const __le32 *fw_data;
|
||||
unsigned i, fw_size;
|
||||
unsigned int i, fw_size;
|
||||
uint32_t tmp;
|
||||
uint32_t usec_timeout = 50000; /* wait for 50ms */
|
||||
|
||||
@ -6243,7 +6234,7 @@ static int gfx_v10_0_cp_compute_load_microcode(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct gfx_firmware_header_v1_0 *mec_hdr;
|
||||
const __le32 *fw_data;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
u32 tmp;
|
||||
u32 usec_timeout = 50000; /* Wait for 50 ms */
|
||||
|
||||
@ -6922,8 +6913,10 @@ static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t data, pattern = 0xDEADBEEF;
|
||||
|
||||
/* check if mmVGT_ESGS_RING_SIZE_UMD
|
||||
* has been remapped to mmVGT_ESGS_RING_SIZE */
|
||||
/*
|
||||
* check if mmVGT_ESGS_RING_SIZE_UMD
|
||||
* has been remapped to mmVGT_ESGS_RING_SIZE
|
||||
*/
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(10, 3, 0):
|
||||
case IP_VERSION(10, 3, 2):
|
||||
@ -6934,12 +6927,10 @@ static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, pattern);
|
||||
|
||||
if (RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid) == pattern) {
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD , data);
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, data);
|
||||
return true;
|
||||
} else {
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid, data);
|
||||
return false;
|
||||
}
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_Sienna_Cichlid, data);
|
||||
break;
|
||||
case IP_VERSION(10, 3, 1):
|
||||
case IP_VERSION(10, 3, 3):
|
||||
@ -6954,12 +6945,12 @@ static bool gfx_v10_0_check_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
if (RREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE) == pattern) {
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE_UMD, data);
|
||||
return true;
|
||||
} else {
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE, data);
|
||||
return false;
|
||||
}
|
||||
WREG32_SOC15(GC, 0, mmVGT_ESGS_RING_SIZE, data);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gfx_v10_0_setup_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
@ -6969,8 +6960,10 @@ static void gfx_v10_0_setup_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
return;
|
||||
|
||||
/* initialize cam_index to 0
|
||||
* index will auto-inc after each data writting */
|
||||
/*
|
||||
* Initialize cam_index to 0
|
||||
* index will auto-inc after each data writing
|
||||
*/
|
||||
WREG32_SOC15(GC, 0, mmGRBM_CAM_INDEX, 0);
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
@ -7100,6 +7093,7 @@ static void gfx_v10_0_setup_grbm_cam_remapping(struct amdgpu_device *adev)
|
||||
static void gfx_v10_0_disable_gpa_mode(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t data;
|
||||
|
||||
data = RREG32_SOC15(GC, 0, mmCPC_PSP_DEBUG);
|
||||
data |= CPC_PSP_DEBUG__GPA_OVERRIDE_MASK;
|
||||
WREG32_SOC15(GC, 0, mmCPC_PSP_DEBUG, data);
|
||||
@ -7216,7 +7210,7 @@ static bool gfx_v10_0_is_idle(void *handle)
|
||||
|
||||
static int gfx_v10_0_wait_for_idle(void *handle)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
u32 tmp;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
@ -7471,7 +7465,7 @@ static bool gfx_v10_0_is_rlc_enabled(struct amdgpu_device *adev)
|
||||
static void gfx_v10_0_set_safe_mode(struct amdgpu_device *adev, int xcc_id)
|
||||
{
|
||||
uint32_t data;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
data = RLC_SAFE_MODE__CMD_MASK;
|
||||
data |= (1 << RLC_SAFE_MODE__MESSAGE__SHIFT);
|
||||
@ -7900,12 +7894,11 @@ static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
||||
unsigned int vmid)
|
||||
{
|
||||
u32 reg, data;
|
||||
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
/* not for *_SOC15 */
|
||||
reg = SOC15_REG_OFFSET(GC, 0, mmRLC_SPM_MC_CNTL);
|
||||
if (amdgpu_sriov_is_pp_one_vf(adev))
|
||||
@ -7920,6 +7913,13 @@ static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
WREG32_SOC15_NO_KIQ(GC, 0, mmRLC_SPM_MC_CNTL, data);
|
||||
else
|
||||
WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
|
||||
}
|
||||
|
||||
static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, unsigned int vmid)
|
||||
{
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
gfx_v10_0_update_spm_vmid_internal(adev, vmid);
|
||||
|
||||
amdgpu_gfx_off_ctrl(adev, true);
|
||||
}
|
||||
@ -8297,7 +8297,7 @@ static void gfx_v10_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
|
||||
struct amdgpu_ib *ib,
|
||||
uint32_t flags)
|
||||
{
|
||||
unsigned vmid = AMDGPU_JOB_GET_VMID(job);
|
||||
unsigned int vmid = AMDGPU_JOB_GET_VMID(job);
|
||||
u32 header, control = 0;
|
||||
|
||||
if (ib->flags & AMDGPU_IB_FLAG_CE)
|
||||
@ -8338,7 +8338,7 @@ static void gfx_v10_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
|
||||
struct amdgpu_ib *ib,
|
||||
uint32_t flags)
|
||||
{
|
||||
unsigned vmid = AMDGPU_JOB_GET_VMID(job);
|
||||
unsigned int vmid = AMDGPU_JOB_GET_VMID(job);
|
||||
u32 control = INDIRECT_BUFFER_VALID | ib->length_dw | (vmid << 24);
|
||||
|
||||
if (ring->is_mes_queue)
|
||||
@ -8373,7 +8373,7 @@ static void gfx_v10_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
|
||||
}
|
||||
|
||||
static void gfx_v10_0_ring_emit_fence(struct amdgpu_ring *ring, u64 addr,
|
||||
u64 seq, unsigned flags)
|
||||
u64 seq, unsigned int flags)
|
||||
{
|
||||
bool write64bit = flags & AMDGPU_FENCE_FLAG_64BIT;
|
||||
bool int_sel = flags & AMDGPU_FENCE_FLAG_INT;
|
||||
@ -8429,7 +8429,7 @@ static void gfx_v10_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,
|
||||
}
|
||||
|
||||
static void gfx_v10_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
if (ring->is_mes_queue)
|
||||
gfx_v10_0_ring_invalidate_tlbs(ring, 0, 0, false, 0);
|
||||
@ -8511,9 +8511,9 @@ static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring,
|
||||
amdgpu_ring_write(ring, 0);
|
||||
}
|
||||
|
||||
static unsigned gfx_v10_0_ring_emit_init_cond_exec(struct amdgpu_ring *ring)
|
||||
static unsigned int gfx_v10_0_ring_emit_init_cond_exec(struct amdgpu_ring *ring)
|
||||
{
|
||||
unsigned ret;
|
||||
unsigned int ret;
|
||||
|
||||
amdgpu_ring_write(ring, PACKET3(PACKET3_COND_EXEC, 3));
|
||||
amdgpu_ring_write(ring, lower_32_bits(ring->cond_exe_gpu_addr));
|
||||
@ -8525,9 +8525,10 @@ static unsigned gfx_v10_0_ring_emit_init_cond_exec(struct amdgpu_ring *ring)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void gfx_v10_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigned offset)
|
||||
static void gfx_v10_0_ring_emit_patch_cond_exec(struct amdgpu_ring *ring, unsigned int offset)
|
||||
{
|
||||
unsigned cur;
|
||||
unsigned int cur;
|
||||
|
||||
BUG_ON(offset > ring->buf_mask);
|
||||
BUG_ON(ring->ring[offset] != 0x55aa55aa);
|
||||
|
||||
@ -8750,7 +8751,7 @@ static void gfx_v10_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
|
||||
}
|
||||
|
||||
static void gfx_v10_0_ring_soft_recovery(struct amdgpu_ring *ring,
|
||||
unsigned vmid)
|
||||
unsigned int vmid)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
uint32_t value = 0;
|
||||
@ -8859,7 +8860,7 @@ static void gfx_v10_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev
|
||||
|
||||
static int gfx_v10_0_set_eop_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
switch (type) {
|
||||
@ -8956,7 +8957,7 @@ static int gfx_v10_0_eop_irq(struct amdgpu_device *adev,
|
||||
|
||||
static int gfx_v10_0_set_priv_reg_fault_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *source,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
switch (state) {
|
||||
@ -8975,7 +8976,7 @@ static int gfx_v10_0_set_priv_reg_fault_state(struct amdgpu_device *adev,
|
||||
|
||||
static int gfx_v10_0_set_priv_inst_fault_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *source,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
switch (state) {
|
||||
@ -9342,7 +9343,7 @@ static void gfx_v10_0_set_rlc_funcs(struct amdgpu_device *adev)
|
||||
|
||||
static void gfx_v10_0_set_gds_init(struct amdgpu_device *adev)
|
||||
{
|
||||
unsigned total_cu = adev->gfx.config.max_cu_per_sh *
|
||||
unsigned int total_cu = adev->gfx.config.max_cu_per_sh *
|
||||
adev->gfx.config.max_sh_per_se *
|
||||
adev->gfx.config.max_shader_engines;
|
||||
|
||||
@ -9423,7 +9424,7 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev,
|
||||
{
|
||||
int i, j, k, counter, active_cu_number = 0;
|
||||
u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
|
||||
unsigned disable_masks[4 * 2];
|
||||
unsigned int disable_masks[4 * 2];
|
||||
|
||||
if (!adev || !cu_info)
|
||||
return -EINVAL;
|
||||
@ -9540,8 +9541,7 @@ static void gfx_v10_3_set_power_brake_sequence(struct amdgpu_device *adev)
|
||||
(0x1 << DIDT_SQ_THROTTLE_CTRL__PWRBRK_STALL_EN__SHIFT));
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version gfx_v10_0_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gfx_v10_0_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GFX,
|
||||
.major = 10,
|
||||
.minor = 0,
|
||||
|
@ -663,7 +663,7 @@ static void gfx_v11_0_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
|
||||
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[0];
|
||||
reg_access_ctrl->scratch_reg0 = SOC15_REG_OFFSET(GC, 0, regSCRATCH_REG0);
|
||||
reg_access_ctrl->scratch_reg1 = SOC15_REG_OFFSET(GC, 0, regSCRATCH_REG1);
|
||||
reg_access_ctrl->scratch_reg2 = SOC15_REG_OFFSET(GC, 0, regSCRATCH_REG2);
|
||||
|
@ -762,6 +762,8 @@ static void gfx_v9_0_query_ras_error_count(struct amdgpu_device *adev,
|
||||
static int gfx_v9_0_ras_error_inject(struct amdgpu_device *adev,
|
||||
void *inject_if, uint32_t instance_mask);
|
||||
static void gfx_v9_0_reset_ras_error_count(struct amdgpu_device *adev);
|
||||
static void gfx_v9_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
||||
unsigned int vmid);
|
||||
|
||||
static void gfx_v9_0_kiq_set_resources(struct amdgpu_ring *kiq_ring,
|
||||
uint64_t queue_mask)
|
||||
@ -1632,7 +1634,7 @@ static void gfx_v9_0_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
|
||||
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl;
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[0];
|
||||
reg_access_ctrl->scratch_reg0 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0);
|
||||
reg_access_ctrl->scratch_reg1 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG1);
|
||||
reg_access_ctrl->scratch_reg2 = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG2);
|
||||
@ -1667,22 +1669,6 @@ static int gfx_v9_0_rlc_init(struct amdgpu_device *adev)
|
||||
return r;
|
||||
}
|
||||
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
gfx_v9_0_init_lbpw(adev);
|
||||
break;
|
||||
case IP_VERSION(9, 4, 0):
|
||||
gfx_v9_4_init_lbpw(adev);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* init spm vmid with 0xf */
|
||||
if (adev->gfx.rlc.funcs->update_spm_vmid)
|
||||
adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2942,12 +2928,14 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
|
||||
switch (adev->ip_versions[GC_HWIP][0]) {
|
||||
case IP_VERSION(9, 2, 2):
|
||||
case IP_VERSION(9, 1, 0):
|
||||
gfx_v9_0_init_lbpw(adev);
|
||||
if (amdgpu_lbpw == 0)
|
||||
gfx_v9_0_enable_lbpw(adev, false);
|
||||
else
|
||||
gfx_v9_0_enable_lbpw(adev, true);
|
||||
break;
|
||||
case IP_VERSION(9, 4, 0):
|
||||
gfx_v9_4_init_lbpw(adev);
|
||||
if (amdgpu_lbpw > 0)
|
||||
gfx_v9_0_enable_lbpw(adev, true);
|
||||
else
|
||||
@ -2957,6 +2945,8 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev)
|
||||
break;
|
||||
}
|
||||
|
||||
gfx_v9_0_update_spm_vmid_internal(adev, 0xf);
|
||||
|
||||
adev->gfx.rlc.funcs->start(adev);
|
||||
|
||||
return 0;
|
||||
@ -4881,12 +4871,11 @@ static int gfx_v9_0_update_gfx_clock_gating(struct amdgpu_device *adev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
static void gfx_v9_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
||||
unsigned int vmid)
|
||||
{
|
||||
u32 reg, data;
|
||||
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
reg = SOC15_REG_OFFSET(GC, 0, mmRLC_SPM_MC_CNTL);
|
||||
if (amdgpu_sriov_is_pp_one_vf(adev))
|
||||
data = RREG32_NO_KIQ(reg);
|
||||
@ -4900,6 +4889,13 @@ static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid)
|
||||
WREG32_SOC15_NO_KIQ(GC, 0, mmRLC_SPM_MC_CNTL, data);
|
||||
else
|
||||
WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
|
||||
}
|
||||
|
||||
static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, unsigned int vmid)
|
||||
{
|
||||
amdgpu_gfx_off_ctrl(adev, false);
|
||||
|
||||
gfx_v9_0_update_spm_vmid_internal(adev, vmid);
|
||||
|
||||
amdgpu_gfx_off_ctrl(adev, true);
|
||||
}
|
||||
@ -5230,6 +5226,9 @@ static void gfx_v9_0_ring_patch_de_meta(struct amdgpu_ring *ring,
|
||||
de_payload_cpu_addr = adev->virt.csa_cpu_addr + payload_offset;
|
||||
}
|
||||
|
||||
((struct v9_de_ib_state *)de_payload_cpu_addr)->ib_completion_status =
|
||||
IB_COMPLETION_STATUS_PREEMPTED;
|
||||
|
||||
if (offset + (payload_size >> 2) <= ring->buf_mask + 1) {
|
||||
memcpy((void *)&ring->ring[offset], de_payload_cpu_addr, payload_size);
|
||||
} else {
|
||||
|
@ -46,6 +46,7 @@ MODULE_FIRMWARE("amdgpu/gc_9_4_3_rlc.bin");
|
||||
#define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L
|
||||
|
||||
#define GOLDEN_GB_ADDR_CONFIG 0x2a114042
|
||||
#define CP_HQD_PERSISTENT_STATE_DEFAULT 0xbe05301
|
||||
|
||||
struct amdgpu_gfx_ras gfx_v9_4_3_ras;
|
||||
|
||||
@ -195,14 +196,11 @@ static void gfx_v9_4_3_init_golden_registers(struct amdgpu_device *adev)
|
||||
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
|
||||
for (i = 0; i < num_xcc; i++) {
|
||||
dev_inst = GET_INST(GC, i);
|
||||
if (dev_inst >= 2)
|
||||
WREG32_SOC15(GC, dev_inst, regGRBM_MCM_ADDR, 0x4);
|
||||
|
||||
WREG32_SOC15(GC, dev_inst, regGB_ADDR_CONFIG,
|
||||
GOLDEN_GB_ADDR_CONFIG);
|
||||
/* Golden settings applied by driver for ASIC with rev_id 0 */
|
||||
if (adev->rev_id == 0) {
|
||||
WREG32_SOC15(GC, dev_inst, regGB_ADDR_CONFIG,
|
||||
GOLDEN_GB_ADDR_CONFIG);
|
||||
|
||||
WREG32_FIELD15_PREREG(GC, dev_inst, TCP_UTCL1_CNTL1,
|
||||
REDUCE_FIFO_DEPTH_BY_2, 2);
|
||||
}
|
||||
@ -624,7 +622,7 @@ static int gfx_v9_4_3_switch_compute_partition(struct amdgpu_device *adev,
|
||||
int num_xccs_per_xcp)
|
||||
{
|
||||
int ret, i, num_xcc;
|
||||
u32 tmp = 0;
|
||||
u32 tmp = 0, regval;
|
||||
|
||||
if (adev->psp.funcs) {
|
||||
ret = psp_spatial_partition(&adev->psp,
|
||||
@ -632,23 +630,24 @@ static int gfx_v9_4_3_switch_compute_partition(struct amdgpu_device *adev,
|
||||
num_xccs_per_xcp);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else {
|
||||
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_xcc; i++) {
|
||||
tmp = REG_SET_FIELD(tmp, CP_HYP_XCP_CTL, NUM_XCC_IN_XCP,
|
||||
num_xccs_per_xcp);
|
||||
tmp = REG_SET_FIELD(tmp, CP_HYP_XCP_CTL, VIRTUAL_XCC_ID,
|
||||
i % num_xccs_per_xcp);
|
||||
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
|
||||
|
||||
for (i = 0; i < num_xcc; i++) {
|
||||
tmp = REG_SET_FIELD(tmp, CP_HYP_XCP_CTL, NUM_XCC_IN_XCP,
|
||||
num_xccs_per_xcp);
|
||||
tmp = REG_SET_FIELD(tmp, CP_HYP_XCP_CTL, VIRTUAL_XCC_ID,
|
||||
i % num_xccs_per_xcp);
|
||||
regval = RREG32_SOC15(GC, GET_INST(GC, i), regCP_HYP_XCP_CTL);
|
||||
if (regval != tmp)
|
||||
WREG32_SOC15(GC, GET_INST(GC, i), regCP_HYP_XCP_CTL,
|
||||
tmp);
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
adev->gfx.num_xcc_per_xcp = num_xccs_per_xcp;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gfx_v9_4_3_ih_to_xcc_inst(struct amdgpu_device *adev, int ih_node)
|
||||
@ -900,6 +899,7 @@ static void gfx_v9_4_3_xcc_init_compute_vmid(struct amdgpu_device *adev,
|
||||
int i;
|
||||
uint32_t sh_mem_config;
|
||||
uint32_t sh_mem_bases;
|
||||
uint32_t data;
|
||||
|
||||
/*
|
||||
* Configure apertures:
|
||||
@ -919,6 +919,11 @@ static void gfx_v9_4_3_xcc_init_compute_vmid(struct amdgpu_device *adev,
|
||||
/* CP and shaders */
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regSH_MEM_CONFIG, sh_mem_config);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regSH_MEM_BASES, sh_mem_bases);
|
||||
|
||||
/* Enable trap for each kfd vmid. */
|
||||
data = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regSPI_GDBG_PER_VMID_CNTL);
|
||||
data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, 1);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regSPI_GDBG_PER_VMID_CNTL, data);
|
||||
}
|
||||
soc15_grbm_select(adev, 0, 0, 0, 0, GET_INST(GC, xcc_id));
|
||||
mutex_unlock(&adev->srbm_mutex);
|
||||
@ -1037,32 +1042,6 @@ static void gfx_v9_4_3_xcc_disable_gpa_mode(struct amdgpu_device *adev, int xcc_
|
||||
WREG32_SOC15(GC, GET_INST(GC, xcc_id), regCPC_PSP_DEBUG, data);
|
||||
}
|
||||
|
||||
static void gfx_v9_4_3_xcc_program_xcc_id(struct amdgpu_device *adev,
|
||||
int xcc_id)
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
int num_xcc;
|
||||
|
||||
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
|
||||
switch (num_xcc) {
|
||||
/* directly config VIRTUAL_XCC_ID to 0 for 1-XCC */
|
||||
case 1:
|
||||
WREG32_SOC15(GC, GET_INST(GC, xcc_id), regCP_HYP_XCP_CTL, 0x8);
|
||||
break;
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
tmp = (xcc_id % adev->gfx.num_xcc_per_xcp) << REG_FIELD_SHIFT(CP_HYP_XCP_CTL, VIRTUAL_XCC_ID);
|
||||
tmp = tmp | (adev->gfx.num_xcc_per_xcp << REG_FIELD_SHIFT(CP_HYP_XCP_CTL, NUM_XCC_IN_XCP));
|
||||
WREG32_SOC15(GC, GET_INST(GC, xcc_id), regCP_HYP_XCP_CTL, tmp);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool gfx_v9_4_3_is_rlc_enabled(struct amdgpu_device *adev)
|
||||
{
|
||||
uint32_t rlc_setting;
|
||||
@ -1101,6 +1080,24 @@ static void gfx_v9_4_3_xcc_unset_safe_mode(struct amdgpu_device *adev,
|
||||
WREG32_SOC15(GC, GET_INST(GC, xcc_id), regRLC_SAFE_MODE, data);
|
||||
}
|
||||
|
||||
static void gfx_v9_4_3_init_rlcg_reg_access_ctrl(struct amdgpu_device *adev)
|
||||
{
|
||||
int xcc_id, num_xcc;
|
||||
struct amdgpu_rlcg_reg_access_ctrl *reg_access_ctrl;
|
||||
|
||||
num_xcc = NUM_XCC(adev->gfx.xcc_mask);
|
||||
for (xcc_id = 0; xcc_id < num_xcc; xcc_id++) {
|
||||
reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[GET_INST(GC, xcc_id)];
|
||||
reg_access_ctrl->scratch_reg0 = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regSCRATCH_REG0);
|
||||
reg_access_ctrl->scratch_reg1 = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regSCRATCH_REG1);
|
||||
reg_access_ctrl->scratch_reg2 = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regSCRATCH_REG2);
|
||||
reg_access_ctrl->scratch_reg3 = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regSCRATCH_REG3);
|
||||
reg_access_ctrl->grbm_cntl = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regGRBM_GFX_CNTL);
|
||||
reg_access_ctrl->grbm_idx = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regGRBM_GFX_INDEX);
|
||||
reg_access_ctrl->spare_int = SOC15_REG_OFFSET(GC, GET_INST(GC, xcc_id), regRLC_SPARE_INT);
|
||||
}
|
||||
}
|
||||
|
||||
static int gfx_v9_4_3_rlc_init(struct amdgpu_device *adev)
|
||||
{
|
||||
/* init spm vmid with 0xf */
|
||||
@ -1736,7 +1733,7 @@ static int gfx_v9_4_3_xcc_q_fini_register(struct amdgpu_ring *ring,
|
||||
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_IQ_TIMER, 0);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_IB_CONTROL, 0);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_PERSISTENT_STATE, 0);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_PERSISTENT_STATE, CP_HQD_PERSISTENT_STATE_DEFAULT);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_PQ_DOORBELL_CONTROL, 0x40000000);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_PQ_DOORBELL_CONTROL, 0);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, xcc_id), regCP_HQD_PQ_RPTR, 0);
|
||||
@ -1920,9 +1917,6 @@ static int gfx_v9_4_3_xcc_cp_resume(struct amdgpu_device *adev, int xcc_id)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* set the virtual and physical id based on partition_mode */
|
||||
gfx_v9_4_3_xcc_program_xcc_id(adev, xcc_id);
|
||||
|
||||
r = gfx_v9_4_3_xcc_kiq_resume(adev, xcc_id);
|
||||
if (r)
|
||||
return r;
|
||||
@ -2181,6 +2175,9 @@ static int gfx_v9_4_3_early_init(void *handle)
|
||||
gfx_v9_4_3_set_gds_init(adev);
|
||||
gfx_v9_4_3_set_rlc_funcs(adev);
|
||||
|
||||
/* init rlcg reg access ctrl */
|
||||
gfx_v9_4_3_init_rlcg_reg_access_ctrl(adev);
|
||||
|
||||
return gfx_v9_4_3_init_microcode(adev);
|
||||
}
|
||||
|
||||
@ -2197,6 +2194,10 @@ static int gfx_v9_4_3_late_init(void *handle)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (adev->gfx.ras &&
|
||||
adev->gfx.ras->enable_watchdog_timer)
|
||||
adev->gfx.ras->enable_watchdog_timer(adev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4043,6 +4044,34 @@ static void gfx_v9_4_3_inst_reset_ras_err_status(struct amdgpu_device *adev,
|
||||
gfx_v9_4_3_inst_reset_sq_timeout_status(adev, xcc_id);
|
||||
}
|
||||
|
||||
static void gfx_v9_4_3_inst_enable_watchdog_timer(struct amdgpu_device *adev,
|
||||
void *ras_error_status, int xcc_id)
|
||||
{
|
||||
uint32_t i;
|
||||
uint32_t data;
|
||||
|
||||
data = REG_SET_FIELD(0, SQ_TIMEOUT_CONFIG, TIMEOUT_FATAL_DISABLE,
|
||||
amdgpu_watchdog_timer.timeout_fatal_disable ? 1 : 0);
|
||||
|
||||
if (amdgpu_watchdog_timer.timeout_fatal_disable &&
|
||||
(amdgpu_watchdog_timer.period < 1 ||
|
||||
amdgpu_watchdog_timer.period > 0x23)) {
|
||||
dev_warn(adev->dev, "Watchdog period range is 1 to 0x23\n");
|
||||
amdgpu_watchdog_timer.period = 0x23;
|
||||
}
|
||||
data = REG_SET_FIELD(data, SQ_TIMEOUT_CONFIG, PERIOD_SEL,
|
||||
amdgpu_watchdog_timer.period);
|
||||
|
||||
mutex_lock(&adev->grbm_idx_mutex);
|
||||
for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
|
||||
gfx_v9_4_3_xcc_select_se_sh(adev, i, 0xffffffff, 0xffffffff, xcc_id);
|
||||
WREG32_SOC15(GC, GET_INST(GC, xcc_id), regSQ_TIMEOUT_CONFIG, data);
|
||||
}
|
||||
gfx_v9_4_3_xcc_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff,
|
||||
xcc_id);
|
||||
mutex_unlock(&adev->grbm_idx_mutex);
|
||||
}
|
||||
|
||||
static void gfx_v9_4_3_query_ras_error_count(struct amdgpu_device *adev,
|
||||
void *ras_error_status)
|
||||
{
|
||||
@ -4065,6 +4094,11 @@ static void gfx_v9_4_3_reset_ras_error_status(struct amdgpu_device *adev)
|
||||
amdgpu_gfx_ras_error_func(adev, NULL, gfx_v9_4_3_inst_reset_ras_err_status);
|
||||
}
|
||||
|
||||
static void gfx_v9_4_3_enable_watchdog_timer(struct amdgpu_device *adev)
|
||||
{
|
||||
amdgpu_gfx_ras_error_func(adev, NULL, gfx_v9_4_3_inst_enable_watchdog_timer);
|
||||
}
|
||||
|
||||
static const struct amd_ip_funcs gfx_v9_4_3_ip_funcs = {
|
||||
.name = "gfx_v9_4_3",
|
||||
.early_init = gfx_v9_4_3_early_init,
|
||||
@ -4393,4 +4427,5 @@ struct amdgpu_gfx_ras gfx_v9_4_3_ras = {
|
||||
.ras_block = {
|
||||
.hw_ops = &gfx_v9_4_3_ras_ops,
|
||||
},
|
||||
.enable_watchdog_timer = &gfx_v9_4_3_enable_watchdog_timer,
|
||||
};
|
||||
|
@ -103,7 +103,7 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
|
||||
min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
|
||||
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
/*
|
||||
/*
|
||||
* Raven2 has a HW issue that it is unable to use the
|
||||
* vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
|
||||
* So here is the workaround that increase system
|
||||
@ -248,7 +248,7 @@ static void gfxhub_v1_0_disable_identity_aperture(struct amdgpu_device *adev)
|
||||
static void gfxhub_v1_0_setup_vmid_config(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
|
||||
unsigned num_level, block_size;
|
||||
unsigned int num_level, block_size;
|
||||
uint32_t tmp;
|
||||
int i;
|
||||
|
||||
@ -308,7 +308,7 @@ static void gfxhub_v1_0_setup_vmid_config(struct amdgpu_device *adev)
|
||||
static void gfxhub_v1_0_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, mmVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
@ -375,6 +375,7 @@ static void gfxhub_v1_0_set_fault_enable_default(struct amdgpu_device *adev,
|
||||
bool value)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmVM_L2_PROTECTION_FAULT_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, VM_L2_PROTECTION_FAULT_CNTL,
|
||||
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
|
@ -140,7 +140,7 @@ gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev,
|
||||
min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
|
||||
|
||||
if (adev->apu_flags & AMD_APU_IS_RAVEN2)
|
||||
/*
|
||||
/*
|
||||
* Raven2 has a HW issue that it is unable to use the
|
||||
* vram which is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR.
|
||||
* So here is the workaround that increase system
|
||||
@ -315,7 +315,7 @@ static void gfxhub_v1_2_xcc_setup_vmid_config(struct amdgpu_device *adev,
|
||||
uint32_t xcc_mask)
|
||||
{
|
||||
struct amdgpu_vmhub *hub;
|
||||
unsigned num_level, block_size;
|
||||
unsigned int num_level, block_size;
|
||||
uint32_t tmp;
|
||||
int i, j;
|
||||
|
||||
@ -402,18 +402,15 @@ static void gfxhub_v1_2_xcc_program_invalidation(struct amdgpu_device *adev,
|
||||
static int gfxhub_v1_2_xcc_gart_enable(struct amdgpu_device *adev,
|
||||
uint32_t xcc_mask)
|
||||
{
|
||||
uint32_t tmp_mask;
|
||||
int i;
|
||||
|
||||
tmp_mask = xcc_mask;
|
||||
/*
|
||||
* MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, because they are
|
||||
* VF copy registers so vbios post doesn't program them, for
|
||||
* SRIOV driver need to program them
|
||||
*/
|
||||
if (amdgpu_sriov_vf(adev)) {
|
||||
for_each_inst(i, tmp_mask) {
|
||||
i = ffs(tmp_mask) - 1;
|
||||
for_each_inst(i, xcc_mask) {
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_BASE,
|
||||
adev->gmc.vram_start >> 24);
|
||||
WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_TOP,
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "soc15_common.h"
|
||||
|
||||
static const char *gfxhub_client_ids[] = {
|
||||
static const char * const gfxhub_client_ids[] = {
|
||||
"CB/DB",
|
||||
"Reserved",
|
||||
"GE1",
|
||||
@ -332,7 +332,7 @@ static void gfxhub_v2_0_setup_vmid_config(struct amdgpu_device *adev)
|
||||
static void gfxhub_v2_0_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, mmGCVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
@ -393,6 +393,7 @@ static void gfxhub_v2_0_set_fault_enable_default(struct amdgpu_device *adev,
|
||||
bool value)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = RREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_CNTL);
|
||||
tmp = REG_SET_FIELD(tmp, GCVM_L2_PROTECTION_FAULT_CNTL,
|
||||
RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, value);
|
||||
|
@ -34,7 +34,7 @@
|
||||
#define mmGCUTCL2_HARVEST_BYPASS_GROUPS_YELLOW_CARP 0x16f8
|
||||
#define mmGCUTCL2_HARVEST_BYPASS_GROUPS_YELLOW_CARP_BASE_IDX 0
|
||||
|
||||
static const char *gfxhub_client_ids[] = {
|
||||
static const char * const gfxhub_client_ids[] = {
|
||||
"CB/DB",
|
||||
"Reserved",
|
||||
"GE1",
|
||||
@ -341,7 +341,7 @@ static void gfxhub_v2_1_setup_vmid_config(struct amdgpu_device *adev)
|
||||
static void gfxhub_v2_1_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, mmGCVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
@ -582,6 +582,7 @@ static void gfxhub_v2_1_utcl2_harvest(struct amdgpu_device *adev)
|
||||
static void gfxhub_v2_1_save_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
int i;
|
||||
|
||||
adev->gmc.VM_L2_CNTL = RREG32_SOC15(GC, 0, mmGCVM_L2_CNTL);
|
||||
adev->gmc.VM_L2_CNTL2 = RREG32_SOC15(GC, 0, mmGCVM_L2_CNTL2);
|
||||
adev->gmc.VM_DUMMY_PAGE_FAULT_CNTL = RREG32_SOC15(GC, 0, mmGCVM_DUMMY_PAGE_FAULT_CNTL);
|
||||
@ -616,6 +617,7 @@ static void gfxhub_v2_1_save_regs(struct amdgpu_device *adev)
|
||||
static void gfxhub_v2_1_restore_regs(struct amdgpu_device *adev)
|
||||
{
|
||||
int i;
|
||||
|
||||
WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL, adev->gmc.VM_L2_CNTL);
|
||||
WREG32_SOC15(GC, 0, mmGCVM_L2_CNTL2, adev->gmc.VM_L2_CNTL2);
|
||||
WREG32_SOC15(GC, 0, mmGCVM_DUMMY_PAGE_FAULT_CNTL, adev->gmc.VM_DUMMY_PAGE_FAULT_CNTL);
|
||||
@ -679,9 +681,8 @@ static void gfxhub_v2_1_halt(struct amdgpu_device *adev)
|
||||
tmp = RREG32_SOC15(GC, 0, mmGRBM_STATUS2);
|
||||
}
|
||||
|
||||
if (!time) {
|
||||
if (!time)
|
||||
DRM_WARN("failed to wait for GRBM(EA) idle\n");
|
||||
}
|
||||
}
|
||||
|
||||
const struct amdgpu_gfxhub_funcs gfxhub_v2_1_funcs = {
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "navi10_enum.h"
|
||||
#include "soc15_common.h"
|
||||
|
||||
static const char *gfxhub_client_ids[] = {
|
||||
static const char * const gfxhub_client_ids[] = {
|
||||
"CB/DB",
|
||||
"Reserved",
|
||||
"GE1",
|
||||
@ -340,7 +340,7 @@ static void gfxhub_v3_0_setup_vmid_config(struct amdgpu_device *adev)
|
||||
static void gfxhub_v3_0_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, regGCVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
|
@ -33,7 +33,7 @@
|
||||
#define regGCVM_L2_CNTL4_DEFAULT 0x000000c1
|
||||
#define regGCVM_L2_CNTL5_DEFAULT 0x00003fe0
|
||||
|
||||
static const char *gfxhub_client_ids[] = {
|
||||
static const char * const gfxhub_client_ids[] = {
|
||||
"CB/DB",
|
||||
"Reserved",
|
||||
"GE1",
|
||||
@ -345,7 +345,7 @@ static void gfxhub_v3_0_3_setup_vmid_config(struct amdgpu_device *adev)
|
||||
static void gfxhub_v3_0_3_program_invalidation(struct amdgpu_device *adev)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_GFXHUB(0)];
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; i < 18; ++i) {
|
||||
WREG32_SOC15_OFFSET(GC, 0, regGCVM_INVALIDATE_ENG0_ADDR_RANGE_LO32,
|
||||
|
@ -53,16 +53,9 @@
|
||||
|
||||
#include "amdgpu_reset.h"
|
||||
|
||||
#if 0
|
||||
static const struct soc15_reg_golden golden_settings_navi10_hdp[] =
|
||||
{
|
||||
/* TODO add golden setting for hdp */
|
||||
};
|
||||
#endif
|
||||
|
||||
static int gmc_v10_0_ecc_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
return 0;
|
||||
@ -70,7 +63,7 @@ static int gmc_v10_0_ecc_interrupt_state(struct amdgpu_device *adev,
|
||||
|
||||
static int
|
||||
gmc_v10_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src, unsigned type,
|
||||
struct amdgpu_irq_src *src, unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
switch (state) {
|
||||
@ -109,9 +102,11 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *source,
|
||||
struct amdgpu_iv_entry *entry)
|
||||
{
|
||||
uint32_t vmhub_index = entry->client_id == SOC15_IH_CLIENTID_VMC ?
|
||||
AMDGPU_MMHUB0(0) : AMDGPU_GFXHUB(0);
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[vmhub_index];
|
||||
bool retry_fault = !!(entry->src_data[1] & 0x80);
|
||||
bool write_fault = !!(entry->src_data[1] & 0x20);
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[entry->vmid_src];
|
||||
struct amdgpu_task_info task_info;
|
||||
uint32_t status = 0;
|
||||
u64 addr;
|
||||
@ -164,8 +159,7 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev,
|
||||
amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
|
||||
|
||||
dev_err(adev->dev,
|
||||
"[%s] page fault (src_id:%u ring:%u vmid:%u pasid:%u, "
|
||||
"for process %s pid %d thread %s pid %d)\n",
|
||||
"[%s] page fault (src_id:%u ring:%u vmid:%u pasid:%u, for process %s pid %d thread %s pid %d)\n",
|
||||
entry->vmid_src ? "mmhub" : "gfxhub",
|
||||
entry->src_id, entry->ring_id, entry->vmid,
|
||||
entry->pasid, task_info.process_name, task_info.tgid,
|
||||
@ -244,7 +238,7 @@ static void gmc_v10_0_flush_vm_hub(struct amdgpu_device *adev, uint32_t vmid,
|
||||
u32 inv_req = hub->vmhub_funcs->get_invalidate_req(vmid, flush_type);
|
||||
u32 tmp;
|
||||
/* Use register 17 for GART */
|
||||
const unsigned eng = 17;
|
||||
const unsigned int eng = 17;
|
||||
unsigned int i;
|
||||
unsigned char hub_ip = 0;
|
||||
|
||||
@ -346,7 +340,7 @@ static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
(amdgpu_sriov_runtime(adev) || !amdgpu_sriov_vf(adev)) &&
|
||||
down_read_trylock(&adev->reset_domain->sem)) {
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[vmhub];
|
||||
const unsigned eng = 17;
|
||||
const unsigned int eng = 17;
|
||||
u32 inv_req = hub->vmhub_funcs->get_invalidate_req(vmid, flush_type);
|
||||
u32 req = hub->vm_inv_eng0_req + hub->eng_distance * eng;
|
||||
u32 ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
|
||||
@ -477,12 +471,12 @@ static int gmc_v10_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
bool use_semaphore = gmc_v10_0_use_invalidate_semaphore(ring->adev, ring->vm_hub);
|
||||
struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->vm_hub];
|
||||
uint32_t req = hub->vmhub_funcs->get_invalidate_req(vmid, 0);
|
||||
unsigned eng = ring->vm_inv_eng;
|
||||
unsigned int eng = ring->vm_inv_eng;
|
||||
|
||||
/*
|
||||
* It may lose gpuvm invalidate acknowldege state across power-gating
|
||||
@ -524,8 +518,8 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
return pd_addr;
|
||||
}
|
||||
|
||||
static void gmc_v10_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned vmid,
|
||||
unsigned pasid)
|
||||
static void gmc_v10_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned int vmid,
|
||||
unsigned int pasid)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
uint32_t reg;
|
||||
@ -645,10 +639,10 @@ static void gmc_v10_0_get_vm_pte(struct amdgpu_device *adev,
|
||||
AMDGPU_PTE_MTYPE_NV10(MTYPE_UC);
|
||||
}
|
||||
|
||||
static unsigned gmc_v10_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
static unsigned int gmc_v10_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
|
||||
if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
|
||||
size = AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
@ -751,6 +745,7 @@ static int gmc_v10_0_early_init(void *handle)
|
||||
adev->gmc.private_aperture_start = 0x1000000000000000ULL;
|
||||
adev->gmc.private_aperture_end =
|
||||
adev->gmc.private_aperture_start + (4ULL << 30) - 1;
|
||||
adev->gmc.noretry_flags = AMDGPU_VM_NORETRY_FLAGS_TF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -972,7 +967,7 @@ static int gmc_v10_0_sw_init(void *handle)
|
||||
|
||||
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
|
||||
if (r) {
|
||||
printk(KERN_WARNING "amdgpu: No suitable DMA available.\n");
|
||||
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1081,7 +1076,7 @@ static int gmc_v10_0_gart_enable(struct amdgpu_device *adev)
|
||||
gmc_v10_0_flush_gpu_tlb(adev, 0, AMDGPU_GFXHUB(0), 0);
|
||||
|
||||
DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
|
||||
(unsigned)(adev->gmc.gart_size >> 20),
|
||||
(unsigned int)(adev->gmc.gart_size >> 20),
|
||||
(unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo));
|
||||
|
||||
return 0;
|
||||
@ -1255,8 +1250,7 @@ const struct amd_ip_funcs gmc_v10_0_ip_funcs = {
|
||||
.get_clockgating_state = gmc_v10_0_get_clockgating_state,
|
||||
};
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v10_0_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v10_0_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 10,
|
||||
.minor = 0,
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
static int gmc_v11_0_ecc_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
return 0;
|
||||
@ -58,7 +58,7 @@ static int gmc_v11_0_ecc_interrupt_state(struct amdgpu_device *adev,
|
||||
|
||||
static int
|
||||
gmc_v11_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src, unsigned type,
|
||||
struct amdgpu_irq_src *src, unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
switch (state) {
|
||||
@ -97,7 +97,9 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *source,
|
||||
struct amdgpu_iv_entry *entry)
|
||||
{
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[entry->vmid_src];
|
||||
uint32_t vmhub_index = entry->client_id == SOC21_IH_CLIENTID_VMC ?
|
||||
AMDGPU_MMHUB0(0) : AMDGPU_GFXHUB(0);
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[vmhub_index];
|
||||
uint32_t status = 0;
|
||||
u64 addr;
|
||||
|
||||
@ -124,8 +126,7 @@ static int gmc_v11_0_process_interrupt(struct amdgpu_device *adev,
|
||||
amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
|
||||
|
||||
dev_err(adev->dev,
|
||||
"[%s] page fault (src_id:%u ring:%u vmid:%u pasid:%u, "
|
||||
"for process %s pid %d thread %s pid %d)\n",
|
||||
"[%s] page fault (src_id:%u ring:%u vmid:%u pasid:%u, for process %s pid %d thread %s pid %d)\n",
|
||||
entry->vmid_src ? "mmhub" : "gfxhub",
|
||||
entry->src_id, entry->ring_id, entry->vmid,
|
||||
entry->pasid, task_info.process_name, task_info.tgid,
|
||||
@ -198,7 +199,7 @@ static void gmc_v11_0_flush_vm_hub(struct amdgpu_device *adev, uint32_t vmid,
|
||||
u32 inv_req = hub->vmhub_funcs->get_invalidate_req(vmid, flush_type);
|
||||
u32 tmp;
|
||||
/* Use register 17 for GART */
|
||||
const unsigned eng = 17;
|
||||
const unsigned int eng = 17;
|
||||
unsigned int i;
|
||||
unsigned char hub_ip = 0;
|
||||
|
||||
@ -296,7 +297,7 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
if ((adev->gfx.kiq[0].ring.sched.ready || adev->mes.ring.sched.ready) &&
|
||||
(amdgpu_sriov_runtime(adev) || !amdgpu_sriov_vf(adev))) {
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[vmhub];
|
||||
const unsigned eng = 17;
|
||||
const unsigned int eng = 17;
|
||||
u32 inv_req = hub->vmhub_funcs->get_invalidate_req(vmid, flush_type);
|
||||
u32 req = hub->vm_inv_eng0_req + hub->eng_distance * eng;
|
||||
u32 ack = hub->vm_inv_eng0_ack + hub->eng_distance * eng;
|
||||
@ -309,7 +310,6 @@ static void gmc_v11_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
mutex_lock(&adev->mman.gtt_window_lock);
|
||||
gmc_v11_0_flush_vm_hub(adev, vmid, vmhub, 0);
|
||||
mutex_unlock(&adev->mman.gtt_window_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -379,12 +379,12 @@ static int gmc_v11_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
static uint64_t gmc_v11_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
bool use_semaphore = gmc_v11_0_use_invalidate_semaphore(ring->adev, ring->vm_hub);
|
||||
struct amdgpu_vmhub *hub = &ring->adev->vmhub[ring->vm_hub];
|
||||
uint32_t req = hub->vmhub_funcs->get_invalidate_req(vmid, 0);
|
||||
unsigned eng = ring->vm_inv_eng;
|
||||
unsigned int eng = ring->vm_inv_eng;
|
||||
|
||||
/*
|
||||
* It may lose gpuvm invalidate acknowldege state across power-gating
|
||||
@ -426,8 +426,8 @@ static uint64_t gmc_v11_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
return pd_addr;
|
||||
}
|
||||
|
||||
static void gmc_v11_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned vmid,
|
||||
unsigned pasid)
|
||||
static void gmc_v11_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned int vmid,
|
||||
unsigned int pasid)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
uint32_t reg;
|
||||
@ -547,10 +547,10 @@ static void gmc_v11_0_get_vm_pte(struct amdgpu_device *adev,
|
||||
AMDGPU_PTE_MTYPE_NV10(MTYPE_UC);
|
||||
}
|
||||
|
||||
static unsigned gmc_v11_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
static unsigned int gmc_v11_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 d1vga_control = RREG32_SOC15(DCE, 0, regD1VGA_CONTROL);
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
|
||||
if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
|
||||
size = AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
@ -651,6 +651,7 @@ static int gmc_v11_0_early_init(void *handle)
|
||||
adev->gmc.private_aperture_start = 0x1000000000000000ULL;
|
||||
adev->gmc.private_aperture_end =
|
||||
adev->gmc.private_aperture_start + (4ULL << 30) - 1;
|
||||
adev->gmc.noretry_flags = AMDGPU_VM_NORETRY_FLAGS_TF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -727,9 +728,9 @@ static int gmc_v11_0_mc_init(struct amdgpu_device *adev)
|
||||
adev->gmc.visible_vram_size = adev->gmc.real_vram_size;
|
||||
|
||||
/* set the gart size */
|
||||
if (amdgpu_gart_size == -1) {
|
||||
if (amdgpu_gart_size == -1)
|
||||
adev->gmc.gart_size = 512ULL << 20;
|
||||
} else
|
||||
else
|
||||
adev->gmc.gart_size = (u64)amdgpu_gart_size << 20;
|
||||
|
||||
gmc_v11_0_vram_gtt_location(adev, &adev->gmc);
|
||||
@ -823,7 +824,7 @@ static int gmc_v11_0_sw_init(void *handle)
|
||||
|
||||
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
|
||||
if (r) {
|
||||
printk(KERN_WARNING "amdgpu: No suitable DMA available.\n");
|
||||
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -926,7 +927,7 @@ static int gmc_v11_0_gart_enable(struct amdgpu_device *adev)
|
||||
gmc_v11_0_flush_gpu_tlb(adev, 0, AMDGPU_MMHUB0(0), 0);
|
||||
|
||||
DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
|
||||
(unsigned)(adev->gmc.gart_size >> 20),
|
||||
(unsigned int)(adev->gmc.gart_size >> 20),
|
||||
(unsigned long long)amdgpu_bo_gpu_offset(adev->gart.bo));
|
||||
|
||||
return 0;
|
||||
|
@ -120,7 +120,8 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev)
|
||||
case CHIP_HAINAN:
|
||||
chip_name = "hainan";
|
||||
break;
|
||||
default: BUG();
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
/* this memory configuration requires special firmware */
|
||||
@ -178,9 +179,8 @@ static int gmc_v6_0_mc_load_microcode(struct amdgpu_device *adev)
|
||||
WREG32(mmMC_SEQ_IO_DEBUG_DATA, le32_to_cpup(new_io_mc_regs++));
|
||||
}
|
||||
/* load the MC ucode */
|
||||
for (i = 0; i < ucode_size; i++) {
|
||||
for (i = 0; i < ucode_size; i++)
|
||||
WREG32(mmMC_SEQ_SUP_PGM, le32_to_cpup(new_fw_data++));
|
||||
}
|
||||
|
||||
/* put the engine back into the active state */
|
||||
WREG32(mmMC_SEQ_SUP_CNTL, 0x00000008);
|
||||
@ -208,6 +208,7 @@ static void gmc_v6_0_vram_gtt_location(struct amdgpu_device *adev,
|
||||
struct amdgpu_gmc *mc)
|
||||
{
|
||||
u64 base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
|
||||
|
||||
base <<= 24;
|
||||
|
||||
amdgpu_gmc_vram_location(adev, mc, base);
|
||||
@ -228,9 +229,8 @@ static void gmc_v6_0_mc_program(struct amdgpu_device *adev)
|
||||
}
|
||||
WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0);
|
||||
|
||||
if (gmc_v6_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v6_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for MC idle timedout !\n");
|
||||
}
|
||||
|
||||
if (adev->mode_info.num_crtc) {
|
||||
u32 tmp;
|
||||
@ -256,9 +256,8 @@ static void gmc_v6_0_mc_program(struct amdgpu_device *adev)
|
||||
WREG32(mmMC_VM_AGP_TOP, 0x0FFFFFFF);
|
||||
WREG32(mmMC_VM_AGP_BOT, 0x0FFFFFFF);
|
||||
|
||||
if (gmc_v6_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v6_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for MC idle timedout !\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
|
||||
@ -269,13 +268,13 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
|
||||
int r;
|
||||
|
||||
tmp = RREG32(mmMC_ARB_RAMCFG);
|
||||
if (tmp & (1 << 11)) {
|
||||
if (tmp & (1 << 11))
|
||||
chansize = 16;
|
||||
} else if (tmp & MC_ARB_RAMCFG__CHANSIZE_MASK) {
|
||||
else if (tmp & MC_ARB_RAMCFG__CHANSIZE_MASK)
|
||||
chansize = 64;
|
||||
} else {
|
||||
else
|
||||
chansize = 32;
|
||||
}
|
||||
|
||||
tmp = RREG32(mmMC_SHARED_CHMAP);
|
||||
switch ((tmp & MC_SHARED_CHMAP__NOOFCHAN_MASK) >> MC_SHARED_CHMAP__NOOFCHAN__SHIFT) {
|
||||
case 0:
|
||||
@ -352,7 +351,7 @@ static void gmc_v6_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
}
|
||||
|
||||
static uint64_t gmc_v6_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
@ -405,11 +404,11 @@ static void gmc_v6_0_set_fault_enable_default(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
/**
|
||||
+ * gmc_v8_0_set_prt - set PRT VM fault
|
||||
+ *
|
||||
+ * @adev: amdgpu_device pointer
|
||||
+ * @enable: enable/disable VM fault handling for PRT
|
||||
+*/
|
||||
* gmc_v8_0_set_prt() - set PRT VM fault
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @enable: enable/disable VM fault handling for PRT
|
||||
*/
|
||||
static void gmc_v6_0_set_prt(struct amdgpu_device *adev, bool enable)
|
||||
{
|
||||
u32 tmp;
|
||||
@ -547,7 +546,7 @@ static int gmc_v6_0_gart_enable(struct amdgpu_device *adev)
|
||||
|
||||
gmc_v6_0_flush_gpu_tlb(adev, 0, 0, 0);
|
||||
dev_info(adev->dev, "PCIE GART of %uM enabled (table at 0x%016llX).\n",
|
||||
(unsigned)(adev->gmc.gart_size >> 20),
|
||||
(unsigned int)(adev->gmc.gart_size >> 20),
|
||||
(unsigned long long)table_addr);
|
||||
return 0;
|
||||
}
|
||||
@ -787,15 +786,16 @@ static int gmc_v6_0_late_init(void *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned gmc_v6_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
static unsigned int gmc_v6_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 d1vga_control = RREG32(mmD1VGA_CONTROL);
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
|
||||
if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
|
||||
size = AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
} else {
|
||||
u32 viewport = RREG32(mmVIEWPORT_SIZE);
|
||||
|
||||
size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
|
||||
REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_WIDTH) *
|
||||
4);
|
||||
@ -814,6 +814,7 @@ static int gmc_v6_0_sw_init(void *handle)
|
||||
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN;
|
||||
} else {
|
||||
u32 tmp = RREG32(mmMC_SEQ_MISC0);
|
||||
|
||||
tmp &= MC_SEQ_MISC0__MT__MASK;
|
||||
adev->gmc.vram_type = gmc_v6_0_convert_vram_type(tmp);
|
||||
}
|
||||
@ -964,7 +965,7 @@ static bool gmc_v6_0_is_idle(void *handle)
|
||||
|
||||
static int gmc_v6_0_wait_for_idle(void *handle)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
for (i = 0; i < adev->usec_timeout; i++) {
|
||||
@ -995,10 +996,8 @@ static int gmc_v6_0_soft_reset(void *handle)
|
||||
|
||||
if (srbm_soft_reset) {
|
||||
gmc_v6_0_mc_stop(adev);
|
||||
if (gmc_v6_0_wait_for_idle(adev)) {
|
||||
if (gmc_v6_0_wait_for_idle(adev))
|
||||
dev_warn(adev->dev, "Wait for GMC idle timed out !\n");
|
||||
}
|
||||
|
||||
|
||||
tmp = RREG32(mmSRBM_SOFT_RESET);
|
||||
tmp |= srbm_soft_reset;
|
||||
@ -1023,7 +1022,7 @@ static int gmc_v6_0_soft_reset(void *handle)
|
||||
|
||||
static int gmc_v6_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
u32 tmp;
|
||||
@ -1141,8 +1140,7 @@ static void gmc_v6_0_set_irq_funcs(struct amdgpu_device *adev)
|
||||
adev->gmc.vm_fault.funcs = &gmc_v6_0_irq_funcs;
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v6_0_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v6_0_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 6,
|
||||
.minor = 0,
|
||||
|
@ -58,16 +58,14 @@ MODULE_FIRMWARE("amdgpu/bonaire_mc.bin");
|
||||
MODULE_FIRMWARE("amdgpu/hawaii_mc.bin");
|
||||
MODULE_FIRMWARE("amdgpu/topaz_mc.bin");
|
||||
|
||||
static const u32 golden_settings_iceland_a11[] =
|
||||
{
|
||||
static const u32 golden_settings_iceland_a11[] = {
|
||||
mmVM_PRT_APERTURE0_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE1_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE2_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE3_LOW_ADDR, 0x0fffffff, 0x0fffffff
|
||||
};
|
||||
|
||||
static const u32 iceland_mgcg_cgcg_init[] =
|
||||
{
|
||||
static const u32 iceland_mgcg_cgcg_init[] = {
|
||||
mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
|
||||
};
|
||||
|
||||
@ -151,7 +149,8 @@ static int gmc_v7_0_init_microcode(struct amdgpu_device *adev)
|
||||
case CHIP_KABINI:
|
||||
case CHIP_MULLINS:
|
||||
return 0;
|
||||
default: BUG();
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name);
|
||||
@ -237,6 +236,7 @@ static void gmc_v7_0_vram_gtt_location(struct amdgpu_device *adev,
|
||||
struct amdgpu_gmc *mc)
|
||||
{
|
||||
u64 base = RREG32(mmMC_VM_FB_LOCATION) & 0xFFFF;
|
||||
|
||||
base <<= 24;
|
||||
|
||||
amdgpu_gmc_vram_location(adev, mc, base);
|
||||
@ -266,9 +266,9 @@ static void gmc_v7_0_mc_program(struct amdgpu_device *adev)
|
||||
}
|
||||
WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0);
|
||||
|
||||
if (gmc_v7_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v7_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for MC idle timedout !\n");
|
||||
}
|
||||
|
||||
if (adev->mode_info.num_crtc) {
|
||||
/* Lockout access through VGA aperture*/
|
||||
tmp = RREG32(mmVGA_HDP_CONTROL);
|
||||
@ -290,9 +290,8 @@ static void gmc_v7_0_mc_program(struct amdgpu_device *adev)
|
||||
WREG32(mmMC_VM_AGP_BASE, 0);
|
||||
WREG32(mmMC_VM_AGP_TOP, 0x0FFFFFFF);
|
||||
WREG32(mmMC_VM_AGP_BOT, 0x0FFFFFFF);
|
||||
if (gmc_v7_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v7_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for MC idle timedout !\n");
|
||||
}
|
||||
|
||||
WREG32(mmBIF_FB_EN, BIF_FB_EN__FB_READ_EN_MASK | BIF_FB_EN__FB_WRITE_EN_MASK);
|
||||
|
||||
@ -324,11 +323,11 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
|
||||
|
||||
/* Get VRAM informations */
|
||||
tmp = RREG32(mmMC_ARB_RAMCFG);
|
||||
if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE)) {
|
||||
if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE))
|
||||
chansize = 64;
|
||||
} else {
|
||||
else
|
||||
chansize = 32;
|
||||
}
|
||||
|
||||
tmp = RREG32(mmMC_SHARED_CHMAP);
|
||||
switch (REG_GET_FIELD(tmp, MC_SHARED_CHMAP, NOOFCHAN)) {
|
||||
case 0:
|
||||
@ -472,7 +471,7 @@ static void gmc_v7_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
}
|
||||
|
||||
static uint64_t gmc_v7_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
@ -488,8 +487,8 @@ static uint64_t gmc_v7_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
return pd_addr;
|
||||
}
|
||||
|
||||
static void gmc_v7_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned vmid,
|
||||
unsigned pasid)
|
||||
static void gmc_v7_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned int vmid,
|
||||
unsigned int pasid)
|
||||
{
|
||||
amdgpu_ring_emit_wreg(ring, mmIH_VMID_0_LUT + vmid, pasid);
|
||||
}
|
||||
@ -700,7 +699,7 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
|
||||
|
||||
gmc_v7_0_flush_gpu_tlb(adev, 0, 0, 0);
|
||||
DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
|
||||
(unsigned)(adev->gmc.gart_size >> 20),
|
||||
(unsigned int)(adev->gmc.gart_size >> 20),
|
||||
(unsigned long long)table_addr);
|
||||
return 0;
|
||||
}
|
||||
@ -761,7 +760,7 @@ static void gmc_v7_0_gart_disable(struct amdgpu_device *adev)
|
||||
* Print human readable fault information (CIK).
|
||||
*/
|
||||
static void gmc_v7_0_vm_decode_fault(struct amdgpu_device *adev, u32 status,
|
||||
u32 addr, u32 mc_client, unsigned pasid)
|
||||
u32 addr, u32 mc_client, unsigned int pasid)
|
||||
{
|
||||
u32 vmid = REG_GET_FIELD(status, VM_CONTEXT1_PROTECTION_FAULT_STATUS, VMID);
|
||||
u32 protections = REG_GET_FIELD(status, VM_CONTEXT1_PROTECTION_FAULT_STATUS,
|
||||
@ -942,6 +941,7 @@ static int gmc_v7_0_early_init(void *handle)
|
||||
adev->gmc.shared_aperture_end + 1;
|
||||
adev->gmc.private_aperture_end =
|
||||
adev->gmc.private_aperture_start + (4ULL << 30) - 1;
|
||||
adev->gmc.noretry_flags = AMDGPU_VM_NORETRY_FLAGS_TF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -956,15 +956,16 @@ static int gmc_v7_0_late_init(void *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned gmc_v7_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
static unsigned int gmc_v7_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 d1vga_control = RREG32(mmD1VGA_CONTROL);
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
|
||||
if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
|
||||
size = AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
} else {
|
||||
u32 viewport = RREG32(mmVIEWPORT_SIZE);
|
||||
|
||||
size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
|
||||
REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_WIDTH) *
|
||||
4);
|
||||
@ -984,6 +985,7 @@ static int gmc_v7_0_sw_init(void *handle)
|
||||
adev->gmc.vram_type = AMDGPU_VRAM_TYPE_UNKNOWN;
|
||||
} else {
|
||||
u32 tmp = RREG32(mmMC_SEQ_MISC0);
|
||||
|
||||
tmp &= MC_SEQ_MISC0__MT__MASK;
|
||||
adev->gmc.vram_type = gmc_v7_0_convert_vram_type(tmp);
|
||||
}
|
||||
@ -1152,7 +1154,7 @@ static bool gmc_v7_0_is_idle(void *handle)
|
||||
|
||||
static int gmc_v7_0_wait_for_idle(void *handle)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
u32 tmp;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
@ -1190,10 +1192,8 @@ static int gmc_v7_0_soft_reset(void *handle)
|
||||
|
||||
if (srbm_soft_reset) {
|
||||
gmc_v7_0_mc_stop(adev);
|
||||
if (gmc_v7_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v7_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for GMC idle timed out !\n");
|
||||
}
|
||||
|
||||
|
||||
tmp = RREG32(mmSRBM_SOFT_RESET);
|
||||
tmp |= srbm_soft_reset;
|
||||
@ -1219,7 +1219,7 @@ static int gmc_v7_0_soft_reset(void *handle)
|
||||
|
||||
static int gmc_v7_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
u32 tmp;
|
||||
@ -1383,8 +1383,7 @@ static void gmc_v7_0_set_irq_funcs(struct amdgpu_device *adev)
|
||||
adev->gmc.vm_fault.funcs = &gmc_v7_0_irq_funcs;
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v7_0_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v7_0_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 7,
|
||||
.minor = 0,
|
||||
@ -1392,8 +1391,7 @@ const struct amdgpu_ip_block_version gmc_v7_0_ip_block =
|
||||
.funcs = &gmc_v7_0_ip_funcs,
|
||||
};
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v7_4_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v7_4_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 7,
|
||||
.minor = 4,
|
||||
|
@ -64,8 +64,7 @@ MODULE_FIRMWARE("amdgpu/polaris11_k_mc.bin");
|
||||
MODULE_FIRMWARE("amdgpu/polaris10_k_mc.bin");
|
||||
MODULE_FIRMWARE("amdgpu/polaris12_k_mc.bin");
|
||||
|
||||
static const u32 golden_settings_tonga_a11[] =
|
||||
{
|
||||
static const u32 golden_settings_tonga_a11[] = {
|
||||
mmMC_ARB_WTM_GRPWT_RD, 0x00000003, 0x00000000,
|
||||
mmMC_HUB_RDREQ_DMIF_LIMIT, 0x0000007f, 0x00000028,
|
||||
mmMC_HUB_WDP_UMC, 0x00007fb6, 0x00000991,
|
||||
@ -75,34 +74,29 @@ static const u32 golden_settings_tonga_a11[] =
|
||||
mmVM_PRT_APERTURE3_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
};
|
||||
|
||||
static const u32 tonga_mgcg_cgcg_init[] =
|
||||
{
|
||||
static const u32 tonga_mgcg_cgcg_init[] = {
|
||||
mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
|
||||
};
|
||||
|
||||
static const u32 golden_settings_fiji_a10[] =
|
||||
{
|
||||
static const u32 golden_settings_fiji_a10[] = {
|
||||
mmVM_PRT_APERTURE0_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE1_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE2_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE3_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
};
|
||||
|
||||
static const u32 fiji_mgcg_cgcg_init[] =
|
||||
{
|
||||
static const u32 fiji_mgcg_cgcg_init[] = {
|
||||
mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
|
||||
};
|
||||
|
||||
static const u32 golden_settings_polaris11_a11[] =
|
||||
{
|
||||
static const u32 golden_settings_polaris11_a11[] = {
|
||||
mmVM_PRT_APERTURE0_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE1_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE2_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE3_LOW_ADDR, 0x0fffffff, 0x0fffffff
|
||||
};
|
||||
|
||||
static const u32 golden_settings_polaris10_a11[] =
|
||||
{
|
||||
static const u32 golden_settings_polaris10_a11[] = {
|
||||
mmMC_ARB_WTM_GRPWT_RD, 0x00000003, 0x00000000,
|
||||
mmVM_PRT_APERTURE0_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
mmVM_PRT_APERTURE1_LOW_ADDR, 0x0fffffff, 0x0fffffff,
|
||||
@ -110,19 +104,16 @@ static const u32 golden_settings_polaris10_a11[] =
|
||||
mmVM_PRT_APERTURE3_LOW_ADDR, 0x0fffffff, 0x0fffffff
|
||||
};
|
||||
|
||||
static const u32 cz_mgcg_cgcg_init[] =
|
||||
{
|
||||
static const u32 cz_mgcg_cgcg_init[] = {
|
||||
mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
|
||||
};
|
||||
|
||||
static const u32 stoney_mgcg_cgcg_init[] =
|
||||
{
|
||||
static const u32 stoney_mgcg_cgcg_init[] = {
|
||||
mmATC_MISC_CG, 0xffffffff, 0x000c0200,
|
||||
mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
|
||||
};
|
||||
|
||||
static const u32 golden_settings_stoney_common[] =
|
||||
{
|
||||
static const u32 golden_settings_stoney_common[] = {
|
||||
mmMC_HUB_RDREQ_UVD, MC_HUB_RDREQ_UVD__PRESCALE_MASK, 0x00000004,
|
||||
mmMC_RD_GRP_OTH, MC_RD_GRP_OTH__UVD_MASK, 0x00600000
|
||||
};
|
||||
@ -260,7 +251,8 @@ static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
|
||||
case CHIP_STONEY:
|
||||
case CHIP_VEGAM:
|
||||
return 0;
|
||||
default: BUG();
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin", chip_name);
|
||||
@ -448,9 +440,9 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev)
|
||||
}
|
||||
WREG32(mmHDP_REG_COHERENCY_FLUSH_CNTL, 0);
|
||||
|
||||
if (gmc_v8_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v8_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for MC idle timedout !\n");
|
||||
}
|
||||
|
||||
if (adev->mode_info.num_crtc) {
|
||||
/* Lockout access through VGA aperture*/
|
||||
tmp = RREG32(mmVGA_HDP_CONTROL);
|
||||
@ -483,9 +475,8 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev)
|
||||
WREG32(mmMC_VM_AGP_BASE, 0);
|
||||
WREG32(mmMC_VM_AGP_TOP, 0x0FFFFFFF);
|
||||
WREG32(mmMC_VM_AGP_BOT, 0x0FFFFFFF);
|
||||
if (gmc_v8_0_wait_for_idle((void *)adev)) {
|
||||
if (gmc_v8_0_wait_for_idle((void *)adev))
|
||||
dev_warn(adev->dev, "Wait for MC idle timedout !\n");
|
||||
}
|
||||
|
||||
WREG32(mmBIF_FB_EN, BIF_FB_EN__FB_READ_EN_MASK | BIF_FB_EN__FB_WRITE_EN_MASK);
|
||||
|
||||
@ -517,11 +508,11 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
|
||||
|
||||
/* Get VRAM informations */
|
||||
tmp = RREG32(mmMC_ARB_RAMCFG);
|
||||
if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE)) {
|
||||
if (REG_GET_FIELD(tmp, MC_ARB_RAMCFG, CHANSIZE))
|
||||
chansize = 64;
|
||||
} else {
|
||||
else
|
||||
chansize = 32;
|
||||
}
|
||||
|
||||
tmp = RREG32(mmMC_SHARED_CHMAP);
|
||||
switch (REG_GET_FIELD(tmp, MC_SHARED_CHMAP, NOOFCHAN)) {
|
||||
case 0:
|
||||
@ -671,7 +662,7 @@ static void gmc_v8_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
}
|
||||
|
||||
static uint64_t gmc_v8_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
@ -687,8 +678,8 @@ static uint64_t gmc_v8_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
return pd_addr;
|
||||
}
|
||||
|
||||
static void gmc_v8_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned vmid,
|
||||
unsigned pasid)
|
||||
static void gmc_v8_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned int vmid,
|
||||
unsigned int pasid)
|
||||
{
|
||||
amdgpu_ring_emit_wreg(ring, mmIH_VMID_0_LUT + vmid, pasid);
|
||||
}
|
||||
@ -759,11 +750,11 @@ static void gmc_v8_0_set_fault_enable_default(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
/**
|
||||
* gmc_v8_0_set_prt - set PRT VM fault
|
||||
* gmc_v8_0_set_prt() - set PRT VM fault
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @enable: enable/disable VM fault handling for PRT
|
||||
*/
|
||||
*/
|
||||
static void gmc_v8_0_set_prt(struct amdgpu_device *adev, bool enable)
|
||||
{
|
||||
u32 tmp;
|
||||
@ -940,7 +931,7 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
|
||||
|
||||
gmc_v8_0_flush_gpu_tlb(adev, 0, 0, 0);
|
||||
DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n",
|
||||
(unsigned)(adev->gmc.gart_size >> 20),
|
||||
(unsigned int)(adev->gmc.gart_size >> 20),
|
||||
(unsigned long long)table_addr);
|
||||
return 0;
|
||||
}
|
||||
@ -1001,7 +992,7 @@ static void gmc_v8_0_gart_disable(struct amdgpu_device *adev)
|
||||
* Print human readable fault information (VI).
|
||||
*/
|
||||
static void gmc_v8_0_vm_decode_fault(struct amdgpu_device *adev, u32 status,
|
||||
u32 addr, u32 mc_client, unsigned pasid)
|
||||
u32 addr, u32 mc_client, unsigned int pasid)
|
||||
{
|
||||
u32 vmid = REG_GET_FIELD(status, VM_CONTEXT1_PROTECTION_FAULT_STATUS, VMID);
|
||||
u32 protections = REG_GET_FIELD(status, VM_CONTEXT1_PROTECTION_FAULT_STATUS,
|
||||
@ -1056,6 +1047,7 @@ static int gmc_v8_0_early_init(void *handle)
|
||||
adev->gmc.shared_aperture_end + 1;
|
||||
adev->gmc.private_aperture_end =
|
||||
adev->gmc.private_aperture_start + (4ULL << 30) - 1;
|
||||
adev->gmc.noretry_flags = AMDGPU_VM_NORETRY_FLAGS_TF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1070,15 +1062,16 @@ static int gmc_v8_0_late_init(void *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned gmc_v8_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
static unsigned int gmc_v8_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 d1vga_control = RREG32(mmD1VGA_CONTROL);
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
|
||||
if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
|
||||
size = AMDGPU_VBIOS_VGA_ALLOCATION;
|
||||
} else {
|
||||
u32 viewport = RREG32(mmVIEWPORT_SIZE);
|
||||
|
||||
size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
|
||||
REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_WIDTH) *
|
||||
4);
|
||||
@ -1282,7 +1275,7 @@ static bool gmc_v8_0_is_idle(void *handle)
|
||||
|
||||
static int gmc_v8_0_wait_for_idle(void *handle)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
u32 tmp;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
@ -1318,13 +1311,15 @@ static bool gmc_v8_0_check_soft_reset(void *handle)
|
||||
srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
|
||||
SRBM_SOFT_RESET, SOFT_RESET_MC, 1);
|
||||
}
|
||||
|
||||
if (srbm_soft_reset) {
|
||||
adev->gmc.srbm_soft_reset = srbm_soft_reset;
|
||||
return true;
|
||||
} else {
|
||||
adev->gmc.srbm_soft_reset = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
adev->gmc.srbm_soft_reset = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int gmc_v8_0_pre_soft_reset(void *handle)
|
||||
@ -1335,9 +1330,8 @@ static int gmc_v8_0_pre_soft_reset(void *handle)
|
||||
return 0;
|
||||
|
||||
gmc_v8_0_mc_stop(adev);
|
||||
if (gmc_v8_0_wait_for_idle(adev)) {
|
||||
if (gmc_v8_0_wait_for_idle(adev))
|
||||
dev_warn(adev->dev, "Wait for GMC idle timed out !\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1386,7 +1380,7 @@ static int gmc_v8_0_post_soft_reset(void *handle)
|
||||
|
||||
static int gmc_v8_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
u32 tmp;
|
||||
@ -1747,8 +1741,7 @@ static void gmc_v8_0_set_irq_funcs(struct amdgpu_device *adev)
|
||||
adev->gmc.vm_fault.funcs = &gmc_v8_0_irq_funcs;
|
||||
}
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v8_0_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v8_0_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 8,
|
||||
.minor = 0,
|
||||
@ -1756,8 +1749,7 @@ const struct amdgpu_ip_block_version gmc_v8_0_ip_block =
|
||||
.funcs = &gmc_v8_0_ip_funcs,
|
||||
};
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v8_1_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v8_1_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 8,
|
||||
.minor = 1,
|
||||
@ -1765,8 +1757,7 @@ const struct amdgpu_ip_block_version gmc_v8_1_ip_block =
|
||||
.funcs = &gmc_v8_0_ip_funcs,
|
||||
};
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v8_5_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v8_5_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 8,
|
||||
.minor = 5,
|
||||
|
@ -81,7 +81,7 @@
|
||||
|
||||
#define MAX_MEM_RANGES 8
|
||||
|
||||
static const char *gfxhub_client_ids[] = {
|
||||
static const char * const gfxhub_client_ids[] = {
|
||||
"CB",
|
||||
"DB",
|
||||
"IA",
|
||||
@ -332,14 +332,12 @@ static const char *mmhub_client_ids_aldebaran[][2] = {
|
||||
[384+0][1] = "OSS",
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_mmhub_1_0_0[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_mmhub_1_0_0[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(MMHUB, 0, mmDAGB1_WRCLI2, 0x00000007, 0xfe5fe0fa),
|
||||
SOC15_REG_GOLDEN_VALUE(MMHUB, 0, mmMMEA1_DRAM_WR_CLI2GRP_MAP0, 0x00000030, 0x55555565)
|
||||
};
|
||||
|
||||
static const struct soc15_reg_golden golden_settings_athub_1_0_0[] =
|
||||
{
|
||||
static const struct soc15_reg_golden golden_settings_athub_1_0_0[] = {
|
||||
SOC15_REG_GOLDEN_VALUE(ATHUB, 0, mmRPB_ARB_CNTL, 0x0000ff00, 0x00000800),
|
||||
SOC15_REG_GOLDEN_VALUE(ATHUB, 0, mmRPB_ARB_CNTL2, 0x00ff00ff, 0x00080008)
|
||||
};
|
||||
@ -416,13 +414,14 @@ static const uint32_t ecc_umc_mcumc_ctrl_mask_addrs[] = {
|
||||
|
||||
static int gmc_v9_0_ecc_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
u32 bits, i, tmp, reg;
|
||||
|
||||
/* Devices newer then VEGA10/12 shall have these programming
|
||||
sequences performed by PSP BL */
|
||||
* sequences performed by PSP BL
|
||||
*/
|
||||
if (adev->asic_type >= CHIP_VEGA20)
|
||||
return 0;
|
||||
|
||||
@ -466,7 +465,7 @@ static int gmc_v9_0_ecc_interrupt_state(struct amdgpu_device *adev,
|
||||
|
||||
static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
|
||||
struct amdgpu_irq_src *src,
|
||||
unsigned type,
|
||||
unsigned int type,
|
||||
enum amdgpu_interrupt_state state)
|
||||
{
|
||||
struct amdgpu_vmhub *hub;
|
||||
@ -631,8 +630,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
|
||||
amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
|
||||
|
||||
dev_err(adev->dev,
|
||||
"[%s] %s page fault (src_id:%u ring:%u vmid:%u "
|
||||
"pasid:%u, for process %s pid %d thread %s pid %d)\n",
|
||||
"[%s] %s page fault (src_id:%u ring:%u vmid:%u pasid:%u, for process %s pid %d thread %s pid %d)\n",
|
||||
hub_name, retry_fault ? "retry" : "no-retry",
|
||||
entry->src_id, entry->ring_id, entry->vmid,
|
||||
entry->pasid, task_info.process_name, task_info.tgid,
|
||||
@ -816,7 +814,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid,
|
||||
uint32_t vmhub, uint32_t flush_type)
|
||||
{
|
||||
bool use_semaphore = gmc_v9_0_use_invalidate_semaphore(adev, vmhub);
|
||||
const unsigned eng = 17;
|
||||
const unsigned int eng = 17;
|
||||
u32 j, inv_req, inv_req2, tmp;
|
||||
struct amdgpu_vmhub *hub;
|
||||
|
||||
@ -1033,13 +1031,13 @@ static int gmc_v9_0_flush_gpu_tlb_pasid(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
unsigned vmid, uint64_t pd_addr)
|
||||
unsigned int vmid, uint64_t pd_addr)
|
||||
{
|
||||
bool use_semaphore = gmc_v9_0_use_invalidate_semaphore(ring->adev, ring->vm_hub);
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
struct amdgpu_vmhub *hub = &adev->vmhub[ring->vm_hub];
|
||||
uint32_t req = gmc_v9_0_get_invalidate_req(vmid, 0);
|
||||
unsigned eng = ring->vm_inv_eng;
|
||||
unsigned int eng = ring->vm_inv_eng;
|
||||
|
||||
/*
|
||||
* It may lose gpuvm invalidate acknowldege state across power-gating
|
||||
@ -1081,8 +1079,8 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
|
||||
return pd_addr;
|
||||
}
|
||||
|
||||
static void gmc_v9_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned vmid,
|
||||
unsigned pasid)
|
||||
static void gmc_v9_0_emit_pasid_mapping(struct amdgpu_ring *ring, unsigned int vmid,
|
||||
unsigned int pasid)
|
||||
{
|
||||
struct amdgpu_device *adev = ring->adev;
|
||||
uint32_t reg;
|
||||
@ -1373,10 +1371,10 @@ static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev,
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
static unsigned int gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
|
||||
{
|
||||
u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
|
||||
unsigned size;
|
||||
unsigned int size;
|
||||
|
||||
/* TODO move to DC so GMC doesn't need to hard-code DCN registers */
|
||||
|
||||
@ -1622,6 +1620,7 @@ static int gmc_v9_0_early_init(void *handle)
|
||||
adev->gmc.private_aperture_start = 0x1000000000000000ULL;
|
||||
adev->gmc.private_aperture_end =
|
||||
adev->gmc.private_aperture_start + (4ULL << 30) - 1;
|
||||
adev->gmc.noretry_flags = AMDGPU_VM_NORETRY_FLAGS_TF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2150,7 +2149,7 @@ static int gmc_v9_0_sw_init(void *handle)
|
||||
dma_addr_bits = adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 4, 2) ? 48:44;
|
||||
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(dma_addr_bits));
|
||||
if (r) {
|
||||
printk(KERN_WARNING "amdgpu: No suitable DMA available.\n");
|
||||
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
|
||||
return r;
|
||||
}
|
||||
adev->need_swiotlb = drm_need_swiotlb(dma_addr_bits);
|
||||
@ -2304,7 +2303,7 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev)
|
||||
return r;
|
||||
|
||||
DRM_INFO("PCIE GART of %uM enabled.\n",
|
||||
(unsigned)(adev->gmc.gart_size >> 20));
|
||||
(unsigned int)(adev->gmc.gart_size >> 20));
|
||||
if (adev->gmc.pdb0_bo)
|
||||
DRM_INFO("PDB0 located at 0x%016llX\n",
|
||||
(unsigned long long)amdgpu_bo_gpu_offset(adev->gmc.pdb0_bo));
|
||||
@ -2490,8 +2489,7 @@ const struct amd_ip_funcs gmc_v9_0_ip_funcs = {
|
||||
.get_clockgating_state = gmc_v9_0_get_clockgating_state,
|
||||
};
|
||||
|
||||
const struct amdgpu_ip_block_version gmc_v9_0_ip_block =
|
||||
{
|
||||
const struct amdgpu_ip_block_version gmc_v9_0_ip_block = {
|
||||
.type = AMD_IP_BLOCK_TYPE_GMC,
|
||||
.major = 9,
|
||||
.minor = 0,
|
||||
|
@ -535,7 +535,7 @@ static int ih_v6_0_sw_init(void *handle)
|
||||
* use bus address for ih ring by psp bl */
|
||||
use_bus_addr =
|
||||
(adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) ? false : true;
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, 256 * 1024, use_bus_addr);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, IH_RING_SIZE, use_bus_addr);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
@ -548,7 +548,7 @@ static int ih_v6_0_sw_init(void *handle)
|
||||
/* initialize ih control register offset */
|
||||
ih_v6_0_init_register_offset(adev);
|
||||
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, PAGE_SIZE, true);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, IH_SW_RING_SIZE, true);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
@ -909,10 +909,12 @@ static int mes_v10_1_mqd_sw_init(struct amdgpu_device *adev,
|
||||
|
||||
/* prepare MQD backup */
|
||||
adev->mes.mqd_backup[pipe] = kmalloc(mqd_size, GFP_KERNEL);
|
||||
if (!adev->mes.mqd_backup[pipe])
|
||||
if (!adev->mes.mqd_backup[pipe]) {
|
||||
dev_warn(adev->dev,
|
||||
"no memory to create MQD backup for ring %s\n",
|
||||
ring->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -210,9 +210,7 @@ static int mes_v11_0_add_hw_queue(struct amdgpu_mes *mes,
|
||||
mes_add_queue_pkt.is_aql_queue = input->is_aql_queue;
|
||||
mes_add_queue_pkt.gds_size = input->queue_size;
|
||||
|
||||
/* For KFD, gds_size is re-used for queue size (needed in MES for AQL queues) */
|
||||
mes_add_queue_pkt.is_aql_queue = input->is_aql_queue;
|
||||
mes_add_queue_pkt.gds_size = input->queue_size;
|
||||
mes_add_queue_pkt.exclusively_scheduled = input->exclusively_scheduled;
|
||||
|
||||
return mes_v11_0_submit_pkt_and_poll_completion(mes,
|
||||
&mes_add_queue_pkt, sizeof(mes_add_queue_pkt),
|
||||
@ -1019,10 +1017,12 @@ static int mes_v11_0_mqd_sw_init(struct amdgpu_device *adev,
|
||||
|
||||
/* prepare MQD backup */
|
||||
adev->mes.mqd_backup[pipe] = kmalloc(mqd_size, GFP_KERNEL);
|
||||
if (!adev->mes.mqd_backup[pipe])
|
||||
if (!adev->mes.mqd_backup[pipe]) {
|
||||
dev_warn(adev->dev,
|
||||
"no memory to create MQD backup for ring %s\n",
|
||||
ring->name);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ static int navi10_ih_sw_init(void *handle)
|
||||
use_bus_addr = false;
|
||||
else
|
||||
use_bus_addr = true;
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, 256 * 1024, use_bus_addr);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, IH_RING_SIZE, use_bus_addr);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
@ -578,7 +578,7 @@ static int navi10_ih_sw_init(void *handle)
|
||||
/* initialize ih control registers offset */
|
||||
navi10_ih_init_register_offset(adev);
|
||||
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, PAGE_SIZE, true);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, IH_SW_RING_SIZE, true);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
@ -49,6 +49,9 @@ MODULE_FIRMWARE("amdgpu/psp_13_0_10_ta.bin");
|
||||
MODULE_FIRMWARE("amdgpu/psp_13_0_11_toc.bin");
|
||||
MODULE_FIRMWARE("amdgpu/psp_13_0_11_ta.bin");
|
||||
MODULE_FIRMWARE("amdgpu/psp_13_0_6_sos.bin");
|
||||
MODULE_FIRMWARE("amdgpu/psp_13_0_6_ta.bin");
|
||||
MODULE_FIRMWARE("amdgpu/psp_14_0_0_toc.bin");
|
||||
MODULE_FIRMWARE("amdgpu/psp_14_0_0_ta.bin");
|
||||
|
||||
/* For large FW files the time to complete can be very long */
|
||||
#define USBC_PD_POLLING_LIMIT_S 240
|
||||
@ -93,6 +96,7 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)
|
||||
case IP_VERSION(13, 0, 5):
|
||||
case IP_VERSION(13, 0, 8):
|
||||
case IP_VERSION(13, 0, 11):
|
||||
case IP_VERSION(14, 0, 0):
|
||||
err = psp_init_toc_microcode(psp, ucode_prefix);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -237,17 +237,15 @@ static void sdma_v5_0_init_golden_registers(struct amdgpu_device *adev)
|
||||
// emulation only, won't work on real chip
|
||||
// navi10 real chip need to use PSP to load firmware
|
||||
static int sdma_v5_0_init_microcode(struct amdgpu_device *adev)
|
||||
{ int ret, i;
|
||||
|
||||
if (amdgpu_sriov_vf(adev) && (adev->ip_versions[SDMA0_HWIP][0] == IP_VERSION(5, 0, 5)))
|
||||
return 0;
|
||||
{
|
||||
int ret, i;
|
||||
|
||||
for (i = 0; i < adev->sdma.num_instances; i++) {
|
||||
ret = amdgpu_sdma_init_microcode(adev, i, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -37,65 +37,65 @@
|
||||
#define SOC15_REG_OFFSET1(ip, inst, reg, offset) \
|
||||
(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + (reg)+(offset))
|
||||
|
||||
#define __WREG32_SOC15_RLC__(reg, value, flag, hwip) \
|
||||
#define __WREG32_SOC15_RLC__(reg, value, flag, hwip, inst) \
|
||||
((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.rlcg_reg_access_supported) ? \
|
||||
amdgpu_sriov_wreg(adev, reg, value, flag, hwip) : \
|
||||
amdgpu_sriov_wreg(adev, reg, value, flag, hwip, inst) : \
|
||||
WREG32(reg, value))
|
||||
|
||||
#define __RREG32_SOC15_RLC__(reg, flag, hwip) \
|
||||
#define __RREG32_SOC15_RLC__(reg, flag, hwip, inst) \
|
||||
((amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs && adev->gfx.rlc.rlcg_reg_access_supported) ? \
|
||||
amdgpu_sriov_rreg(adev, reg, flag, hwip) : \
|
||||
amdgpu_sriov_rreg(adev, reg, flag, hwip, inst) : \
|
||||
RREG32(reg))
|
||||
|
||||
#define WREG32_FIELD15(ip, idx, reg, field, val) \
|
||||
__WREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg, \
|
||||
(__RREG32_SOC15_RLC__( \
|
||||
adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg, \
|
||||
0, ip##_HWIP) & \
|
||||
0, ip##_HWIP, idx) & \
|
||||
~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field), \
|
||||
0, ip##_HWIP)
|
||||
0, ip##_HWIP, idx)
|
||||
|
||||
#define WREG32_FIELD15_PREREG(ip, idx, reg_name, field, val) \
|
||||
__WREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][idx][reg##reg_name##_BASE_IDX] + reg##reg_name, \
|
||||
(__RREG32_SOC15_RLC__( \
|
||||
adev->reg_offset[ip##_HWIP][idx][reg##reg_name##_BASE_IDX] + reg##reg_name, \
|
||||
0, ip##_HWIP) & \
|
||||
0, ip##_HWIP, idx) & \
|
||||
~REG_FIELD_MASK(reg_name, field)) | (val) << REG_FIELD_SHIFT(reg_name, field), \
|
||||
0, ip##_HWIP)
|
||||
0, ip##_HWIP, idx)
|
||||
|
||||
#define RREG32_SOC15(ip, inst, reg) \
|
||||
__RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
|
||||
0, ip##_HWIP)
|
||||
0, ip##_HWIP, inst)
|
||||
|
||||
#define RREG32_SOC15_IP(ip, reg) __RREG32_SOC15_RLC__(reg, 0, ip##_HWIP)
|
||||
#define RREG32_SOC15_IP(ip, reg) __RREG32_SOC15_RLC__(reg, 0, ip##_HWIP, 0)
|
||||
|
||||
#define RREG32_SOC15_IP_NO_KIQ(ip, reg) __RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ, ip##_HWIP)
|
||||
#define RREG32_SOC15_IP_NO_KIQ(ip, reg) __RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ, ip##_HWIP, 0)
|
||||
|
||||
#define RREG32_SOC15_NO_KIQ(ip, inst, reg) \
|
||||
__RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
|
||||
AMDGPU_REGS_NO_KIQ, ip##_HWIP)
|
||||
AMDGPU_REGS_NO_KIQ, ip##_HWIP, inst)
|
||||
|
||||
#define RREG32_SOC15_OFFSET(ip, inst, reg, offset) \
|
||||
__RREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + (reg)) + \
|
||||
(offset), 0, ip##_HWIP)
|
||||
(offset), 0, ip##_HWIP, inst)
|
||||
|
||||
#define WREG32_SOC15(ip, inst, reg, value) \
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg), \
|
||||
value, 0, ip##_HWIP)
|
||||
value, 0, ip##_HWIP, inst)
|
||||
|
||||
#define WREG32_SOC15_IP(ip, reg, value) \
|
||||
__WREG32_SOC15_RLC__(reg, value, 0, ip##_HWIP)
|
||||
__WREG32_SOC15_RLC__(reg, value, 0, ip##_HWIP, 0)
|
||||
|
||||
#define WREG32_SOC15_IP_NO_KIQ(ip, reg, value) \
|
||||
__WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ, ip##_HWIP)
|
||||
__WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ, ip##_HWIP, 0)
|
||||
|
||||
#define WREG32_SOC15_NO_KIQ(ip, inst, reg, value) \
|
||||
__WREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \
|
||||
value, AMDGPU_REGS_NO_KIQ, ip##_HWIP)
|
||||
value, AMDGPU_REGS_NO_KIQ, ip##_HWIP, inst)
|
||||
|
||||
#define WREG32_SOC15_OFFSET(ip, inst, reg, offset, value) \
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg) + offset, \
|
||||
value, 0, ip##_HWIP)
|
||||
value, 0, ip##_HWIP, inst)
|
||||
|
||||
#define SOC15_WAIT_ON_RREG(ip, inst, reg, expected_value, mask) \
|
||||
amdgpu_device_wait_on_rreg(adev, inst, \
|
||||
@ -108,16 +108,16 @@
|
||||
#reg, expected_value, mask)
|
||||
|
||||
#define WREG32_RLC(reg, value) \
|
||||
__WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_RLC, GC_HWIP)
|
||||
__WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_RLC, GC_HWIP, 0)
|
||||
|
||||
#define WREG32_RLC_EX(prefix, reg, value) \
|
||||
#define WREG32_RLC_EX(prefix, reg, value, inst) \
|
||||
do { \
|
||||
if (amdgpu_sriov_fullaccess(adev)) { \
|
||||
uint32_t i = 0; \
|
||||
uint32_t retries = 50000; \
|
||||
uint32_t r0 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG0_BASE_IDX] + prefix##SCRATCH_REG0; \
|
||||
uint32_t r1 = adev->reg_offset[GC_HWIP][0][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG1; \
|
||||
uint32_t spare_int = adev->reg_offset[GC_HWIP][0][prefix##RLC_SPARE_INT_BASE_IDX] + prefix##RLC_SPARE_INT; \
|
||||
uint32_t r0 = adev->reg_offset[GC_HWIP][inst][prefix##SCRATCH_REG0_BASE_IDX] + prefix##SCRATCH_REG0; \
|
||||
uint32_t r1 = adev->reg_offset[GC_HWIP][inst][prefix##SCRATCH_REG1_BASE_IDX] + prefix##SCRATCH_REG1; \
|
||||
uint32_t spare_int = adev->reg_offset[GC_HWIP][inst][prefix##RLC_SPARE_INT_BASE_IDX] + prefix##RLC_SPARE_INT; \
|
||||
WREG32(r0, value); \
|
||||
WREG32(r1, (reg | 0x80000000)); \
|
||||
WREG32(spare_int, 0x1); \
|
||||
@ -136,17 +136,17 @@
|
||||
|
||||
/* shadow the registers in the callback function */
|
||||
#define WREG32_SOC15_RLC_SHADOW(ip, inst, reg, value) \
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg), value, AMDGPU_REGS_RLC, GC_HWIP)
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg), value, AMDGPU_REGS_RLC, GC_HWIP, inst)
|
||||
|
||||
/* for GC only */
|
||||
#define RREG32_RLC(reg) \
|
||||
__RREG32_SOC15_RLC__(reg, AMDGPU_REGS_RLC, GC_HWIP)
|
||||
|
||||
#define WREG32_RLC_NO_KIQ(reg, value, hwip) \
|
||||
__WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ | AMDGPU_REGS_RLC, hwip)
|
||||
__WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ | AMDGPU_REGS_RLC, hwip, 0)
|
||||
|
||||
#define RREG32_RLC_NO_KIQ(reg, hwip) \
|
||||
__RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ | AMDGPU_REGS_RLC, hwip)
|
||||
__RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ | AMDGPU_REGS_RLC, hwip, 0)
|
||||
|
||||
#define WREG32_SOC15_RLC_SHADOW_EX(prefix, ip, inst, reg, value) \
|
||||
do { \
|
||||
@ -167,32 +167,32 @@
|
||||
} while (0)
|
||||
|
||||
#define RREG32_SOC15_RLC(ip, inst, reg) \
|
||||
__RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, AMDGPU_REGS_RLC, ip##_HWIP)
|
||||
__RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, AMDGPU_REGS_RLC, ip##_HWIP, inst)
|
||||
|
||||
#define WREG32_SOC15_RLC(ip, inst, reg, value) \
|
||||
do { \
|
||||
uint32_t target_reg = adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg;\
|
||||
__WREG32_SOC15_RLC__(target_reg, value, AMDGPU_REGS_RLC, ip##_HWIP); \
|
||||
__WREG32_SOC15_RLC__(target_reg, value, AMDGPU_REGS_RLC, ip##_HWIP, inst); \
|
||||
} while (0)
|
||||
|
||||
#define WREG32_SOC15_RLC_EX(prefix, ip, inst, reg, value) \
|
||||
do { \
|
||||
uint32_t target_reg = adev->reg_offset[GC_HWIP][inst][reg##_BASE_IDX] + reg;\
|
||||
WREG32_RLC_EX(prefix, target_reg, value); \
|
||||
WREG32_RLC_EX(prefix, target_reg, value, inst); \
|
||||
} while (0)
|
||||
|
||||
#define WREG32_FIELD15_RLC(ip, idx, reg, field, val) \
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg), \
|
||||
(__RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][idx][mm##reg##_BASE_IDX] + mm##reg, \
|
||||
AMDGPU_REGS_RLC, ip##_HWIP) & \
|
||||
AMDGPU_REGS_RLC, ip##_HWIP, idx) & \
|
||||
~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field), \
|
||||
AMDGPU_REGS_RLC, ip##_HWIP)
|
||||
AMDGPU_REGS_RLC, ip##_HWIP, idx)
|
||||
|
||||
#define WREG32_SOC15_OFFSET_RLC(ip, inst, reg, offset, value) \
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg) + offset, value, AMDGPU_REGS_RLC, ip##_HWIP)
|
||||
__WREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg) + offset, value, AMDGPU_REGS_RLC, ip##_HWIP, inst)
|
||||
|
||||
#define RREG32_SOC15_OFFSET_RLC(ip, inst, reg, offset) \
|
||||
__RREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg) + offset, AMDGPU_REGS_RLC, ip##_HWIP)
|
||||
__RREG32_SOC15_RLC__((adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg) + offset, AMDGPU_REGS_RLC, ip##_HWIP, inst)
|
||||
|
||||
/* inst equals to ext for some IPs */
|
||||
#define RREG32_SOC15_EXT(ip, inst, reg, ext) \
|
||||
|
@ -881,9 +881,7 @@ static int vcn_v2_0_start_dpg_mode(struct amdgpu_device *adev, bool indirect)
|
||||
UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect);
|
||||
|
||||
if (indirect)
|
||||
psp_update_vcn_sram(adev, 0, adev->vcn.inst->dpg_sram_gpu_addr,
|
||||
(uint32_t)((uintptr_t)adev->vcn.inst->dpg_sram_curr_addr -
|
||||
(uintptr_t)adev->vcn.inst->dpg_sram_cpu_addr));
|
||||
amdgpu_vcn_psp_update_sram(adev, 0, 0);
|
||||
|
||||
/* force RBC into idle state */
|
||||
rb_bufsz = order_base_2(ring->ring_size);
|
||||
|
@ -912,9 +912,7 @@ static int vcn_v2_5_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, boo
|
||||
UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect);
|
||||
|
||||
if (indirect)
|
||||
psp_update_vcn_sram(adev, inst_idx, adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
|
||||
(uint32_t)((uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_curr_addr -
|
||||
(uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr));
|
||||
amdgpu_vcn_psp_update_sram(adev, inst_idx, 0);
|
||||
|
||||
ring = &adev->vcn.inst[inst_idx].ring_dec;
|
||||
/* force RBC into idle state */
|
||||
|
@ -1037,9 +1037,7 @@ static int vcn_v3_0_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, boo
|
||||
VCN, inst_idx, mmUVD_VCPU_CNTL), tmp, 0, indirect);
|
||||
|
||||
if (indirect)
|
||||
psp_update_vcn_sram(adev, inst_idx, adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
|
||||
(uint32_t)((uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_curr_addr -
|
||||
(uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr));
|
||||
amdgpu_vcn_psp_update_sram(adev, inst_idx, 0);
|
||||
|
||||
ring = &adev->vcn.inst[inst_idx].ring_dec;
|
||||
/* force RBC into idle state */
|
||||
|
@ -169,6 +169,12 @@ static int vcn_v4_0_sw_init(void *handle)
|
||||
fw_shared->smu_dpm_interface.smu_interface_type = (adev->flags & AMD_IS_APU) ?
|
||||
AMDGPU_VCN_SMU_DPM_INTERFACE_APU : AMDGPU_VCN_SMU_DPM_INTERFACE_DGPU;
|
||||
|
||||
if (adev->ip_versions[VCN_HWIP][0] == IP_VERSION(4, 0, 2)) {
|
||||
fw_shared->present_flag_0 |= AMDGPU_FW_SHARED_FLAG_0_DRM_KEY_INJECT;
|
||||
fw_shared->drm_key_wa.method =
|
||||
AMDGPU_DRM_KEY_INJECT_WORKAROUND_VCNFW_ASD_HANDSHAKING;
|
||||
}
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
fw_shared->present_flag_0 |= cpu_to_le32(AMDGPU_VCN_VF_RB_SETUP_FLAG);
|
||||
|
||||
@ -993,9 +999,7 @@ static int vcn_v4_0_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, boo
|
||||
|
||||
|
||||
if (indirect)
|
||||
psp_update_vcn_sram(adev, inst_idx, adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
|
||||
(uint32_t)((uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_curr_addr -
|
||||
(uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr));
|
||||
amdgpu_vcn_psp_update_sram(adev, inst_idx, 0);
|
||||
|
||||
ring = &adev->vcn.inst[inst_idx].ring_enc[0];
|
||||
|
||||
@ -1800,7 +1804,7 @@ static int vcn_v4_0_ring_patch_cs_in_place(struct amdgpu_cs_parser *p,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = {
|
||||
static struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = {
|
||||
.type = AMDGPU_RING_TYPE_VCN_ENC,
|
||||
.align_mask = 0x3f,
|
||||
.nop = VCN_ENC_CMD_NO_OP,
|
||||
@ -1845,7 +1849,11 @@ static void vcn_v4_0_set_unified_ring_funcs(struct amdgpu_device *adev)
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
|
||||
adev->vcn.inst[i].ring_enc[0].funcs = &vcn_v4_0_unified_ring_vm_funcs;
|
||||
if (adev->ip_versions[VCN_HWIP][0] == IP_VERSION(4, 0, 2))
|
||||
vcn_v4_0_unified_ring_vm_funcs.secure_submission_supported = true;
|
||||
|
||||
adev->vcn.inst[i].ring_enc[0].funcs =
|
||||
(const struct amdgpu_ring_funcs *)&vcn_v4_0_unified_ring_vm_funcs;
|
||||
adev->vcn.inst[i].ring_enc[0].me = i;
|
||||
|
||||
DRM_INFO("VCN(%d) encode/decode are enabled in VM mode\n", i);
|
||||
|
@ -778,9 +778,7 @@ static int vcn_v4_0_3_start_dpg_mode(struct amdgpu_device *adev, int inst_idx, b
|
||||
UVD_MASTINT_EN__VCPU_EN_MASK, 0, indirect);
|
||||
|
||||
if (indirect)
|
||||
psp_update_vcn_sram(adev, 0, adev->vcn.inst[inst_idx].dpg_sram_gpu_addr,
|
||||
(uint32_t)((uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_curr_addr -
|
||||
(uintptr_t)adev->vcn.inst[inst_idx].dpg_sram_cpu_addr));
|
||||
amdgpu_vcn_psp_update_sram(adev, inst_idx, AMDGPU_UCODE_ID_VCN0_RAM);
|
||||
|
||||
ring = &adev->vcn.inst[inst_idx].ring_enc[0];
|
||||
|
||||
|
@ -485,7 +485,7 @@ static int vega10_ih_sw_init(void *handle)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, 256 * 1024, true);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, IH_RING_SIZE, true);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
@ -510,7 +510,7 @@ static int vega10_ih_sw_init(void *handle)
|
||||
/* initialize ih control registers offset */
|
||||
vega10_ih_init_register_offset(adev);
|
||||
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, PAGE_SIZE, true);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, IH_SW_RING_SIZE, true);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
@ -539,7 +539,7 @@ static int vega20_ih_sw_init(void *handle)
|
||||
(adev->ip_versions[OSSSYS_HWIP][0] == IP_VERSION(4, 4, 2)))
|
||||
use_bus_addr = false;
|
||||
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, 256 * 1024, use_bus_addr);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih, IH_RING_SIZE, use_bus_addr);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
@ -565,7 +565,7 @@ static int vega20_ih_sw_init(void *handle)
|
||||
/* initialize ih control registers offset */
|
||||
vega20_ih_init_register_offset(adev);
|
||||
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, PAGE_SIZE, use_bus_addr);
|
||||
r = amdgpu_ih_ring_init(adev, &adev->irq.ih_soft, IH_SW_RING_SIZE, use_bus_addr);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
@ -1487,7 +1487,8 @@ static int kfd_ioctl_alloc_queue_gws(struct file *filep,
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (!kfd_dbg_has_gws_support(dev) && p->debug_trap_enabled) {
|
||||
if (p->debug_trap_enabled && (!kfd_dbg_has_gws_support(dev) ||
|
||||
kfd_dbg_has_cwsr_workaround(dev))) {
|
||||
retval = -EBUSY;
|
||||
goto out_unlock;
|
||||
}
|
||||
@ -1845,22 +1846,21 @@ static uint32_t get_process_num_bos(struct kfd_process *p)
|
||||
idr_for_each_entry(&pdd->alloc_idr, mem, id) {
|
||||
struct kgd_mem *kgd_mem = (struct kgd_mem *)mem;
|
||||
|
||||
if ((uint64_t)kgd_mem->va > pdd->gpuvm_base)
|
||||
if (!kgd_mem->va || kgd_mem->va > pdd->gpuvm_base)
|
||||
num_of_bos++;
|
||||
}
|
||||
}
|
||||
return num_of_bos;
|
||||
}
|
||||
|
||||
static int criu_get_prime_handle(struct drm_gem_object *gobj, int flags,
|
||||
static int criu_get_prime_handle(struct kgd_mem *mem, int flags,
|
||||
u32 *shared_fd)
|
||||
{
|
||||
struct dma_buf *dmabuf;
|
||||
int ret;
|
||||
|
||||
dmabuf = amdgpu_gem_prime_export(gobj, flags);
|
||||
if (IS_ERR(dmabuf)) {
|
||||
ret = PTR_ERR(dmabuf);
|
||||
ret = amdgpu_amdkfd_gpuvm_export_dmabuf(mem, &dmabuf);
|
||||
if (ret) {
|
||||
pr_err("dmabuf export failed for the BO\n");
|
||||
return ret;
|
||||
}
|
||||
@ -1918,7 +1918,11 @@ static int criu_checkpoint_bos(struct kfd_process *p,
|
||||
kgd_mem = (struct kgd_mem *)mem;
|
||||
dumper_bo = kgd_mem->bo;
|
||||
|
||||
if ((uint64_t)kgd_mem->va <= pdd->gpuvm_base)
|
||||
/* Skip checkpointing BOs that are used for Trap handler
|
||||
* code and state. Currently, these BOs have a VA that
|
||||
* is less GPUVM Base
|
||||
*/
|
||||
if (kgd_mem->va && kgd_mem->va <= pdd->gpuvm_base)
|
||||
continue;
|
||||
|
||||
bo_bucket = &bo_buckets[bo_index];
|
||||
@ -1940,7 +1944,7 @@ static int criu_checkpoint_bos(struct kfd_process *p,
|
||||
}
|
||||
if (bo_bucket->alloc_flags
|
||||
& (KFD_IOC_ALLOC_MEM_FLAGS_VRAM | KFD_IOC_ALLOC_MEM_FLAGS_GTT)) {
|
||||
ret = criu_get_prime_handle(&dumper_bo->tbo.base,
|
||||
ret = criu_get_prime_handle(kgd_mem,
|
||||
bo_bucket->alloc_flags &
|
||||
KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ? DRM_RDWR : 0,
|
||||
&bo_bucket->dmabuf_fd);
|
||||
@ -2402,7 +2406,7 @@ static int criu_restore_bo(struct kfd_process *p,
|
||||
/* create the dmabuf object and export the bo */
|
||||
if (bo_bucket->alloc_flags
|
||||
& (KFD_IOC_ALLOC_MEM_FLAGS_VRAM | KFD_IOC_ALLOC_MEM_FLAGS_GTT)) {
|
||||
ret = criu_get_prime_handle(&kgd_mem->bo->tbo.base, DRM_RDWR,
|
||||
ret = criu_get_prime_handle(kgd_mem, DRM_RDWR,
|
||||
&bo_bucket->dmabuf_fd);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -2755,6 +2759,16 @@ static int runtime_enable(struct kfd_process *p, uint64_t r_debug,
|
||||
|
||||
if (pdd->qpd.queue_count)
|
||||
return -EEXIST;
|
||||
|
||||
/*
|
||||
* Setup TTMPs by default.
|
||||
* Note that this call must remain here for MES ADD QUEUE to
|
||||
* skip_process_ctx_clear unconditionally as the first call to
|
||||
* SET_SHADER_DEBUGGER clears any stale process context data
|
||||
* saved in MES.
|
||||
*/
|
||||
if (pdd->dev->kfd->shared_resources.enable_mes)
|
||||
kfd_dbg_set_mes_debug_mode(pdd, !kfd_dbg_has_cwsr_workaround(pdd->dev));
|
||||
}
|
||||
|
||||
p->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED;
|
||||
@ -2848,7 +2862,8 @@ static int runtime_disable(struct kfd_process *p)
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
kfd_dbg_set_mes_debug_mode(pdd);
|
||||
kfd_dbg_set_mes_debug_mode(pdd,
|
||||
!kfd_dbg_has_cwsr_workaround(pdd->dev));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,8 +302,7 @@ static int kfd_dbg_set_queue_workaround(struct queue *q, bool enable)
|
||||
if (!q)
|
||||
return 0;
|
||||
|
||||
if (KFD_GC_VERSION(q->device) < IP_VERSION(11, 0, 0) ||
|
||||
KFD_GC_VERSION(q->device) >= IP_VERSION(12, 0, 0))
|
||||
if (!kfd_dbg_has_cwsr_workaround(q->device))
|
||||
return 0;
|
||||
|
||||
if (enable && q->properties.is_user_cu_masked)
|
||||
@ -345,11 +344,10 @@ unwind:
|
||||
return r;
|
||||
}
|
||||
|
||||
int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd)
|
||||
int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en)
|
||||
{
|
||||
uint32_t spi_dbg_cntl = pdd->spi_dbg_override | pdd->spi_dbg_launch_mode;
|
||||
uint32_t flags = pdd->process->dbg_flags;
|
||||
bool sq_trap_en = !!spi_dbg_cntl;
|
||||
|
||||
if (!kfd_dbg_is_per_vmid_supported(pdd->dev))
|
||||
return 0;
|
||||
@ -433,7 +431,7 @@ int kfd_dbg_trap_clear_dev_address_watch(struct kfd_process_device *pdd,
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
r = debug_map_and_unlock(pdd->dev->dqm);
|
||||
else
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd);
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
|
||||
kfd_dbg_clear_dev_watch_id(pdd, watch_id);
|
||||
|
||||
@ -446,7 +444,8 @@ int kfd_dbg_trap_set_dev_address_watch(struct kfd_process_device *pdd,
|
||||
uint32_t *watch_id,
|
||||
uint32_t watch_mode)
|
||||
{
|
||||
int r = kfd_dbg_get_dev_watch_id(pdd, watch_id);
|
||||
int xcc_id, r = kfd_dbg_get_dev_watch_id(pdd, watch_id);
|
||||
uint32_t xcc_mask = pdd->dev->xcc_mask;
|
||||
|
||||
if (r)
|
||||
return r;
|
||||
@ -460,19 +459,21 @@ int kfd_dbg_trap_set_dev_address_watch(struct kfd_process_device *pdd,
|
||||
}
|
||||
|
||||
amdgpu_gfx_off_ctrl(pdd->dev->adev, false);
|
||||
pdd->watch_points[*watch_id] = pdd->dev->kfd2kgd->set_address_watch(
|
||||
for_each_inst(xcc_id, xcc_mask)
|
||||
pdd->watch_points[*watch_id] = pdd->dev->kfd2kgd->set_address_watch(
|
||||
pdd->dev->adev,
|
||||
watch_address,
|
||||
watch_address_mask,
|
||||
*watch_id,
|
||||
watch_mode,
|
||||
pdd->dev->vm_info.last_vmid_kfd);
|
||||
pdd->dev->vm_info.last_vmid_kfd,
|
||||
xcc_id);
|
||||
amdgpu_gfx_off_ctrl(pdd->dev->adev, true);
|
||||
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
r = debug_map_and_unlock(pdd->dev->dqm);
|
||||
else
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd);
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
|
||||
/* HWS is broken so no point in HW rollback but release the watchpoint anyways */
|
||||
if (r)
|
||||
@ -514,7 +515,7 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
r = debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd);
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
|
||||
if (r) {
|
||||
target->dbg_flags = prev_flags;
|
||||
@ -537,7 +538,7 @@ int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
kfd_dbg_set_mes_debug_mode(pdd);
|
||||
kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +600,7 @@ void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
kfd_dbg_set_mes_debug_mode(pdd);
|
||||
kfd_dbg_set_mes_debug_mode(pdd, !kfd_dbg_has_cwsr_workaround(pdd->dev));
|
||||
}
|
||||
|
||||
kfd_dbg_set_workaround(target, false);
|
||||
@ -715,7 +716,7 @@ int kfd_dbg_trap_activate(struct kfd_process *target)
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
r = debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd);
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
|
||||
if (r) {
|
||||
target->runtime_info.runtime_state =
|
||||
@ -751,7 +752,8 @@ int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd,
|
||||
if (!KFD_IS_SOC15(pdd->dev))
|
||||
return -ENODEV;
|
||||
|
||||
if (!kfd_dbg_has_gws_support(pdd->dev) && pdd->qpd.num_gws)
|
||||
if (pdd->qpd.num_gws && (!kfd_dbg_has_gws_support(pdd->dev) ||
|
||||
kfd_dbg_has_cwsr_workaround(pdd->dev)))
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@ -848,7 +850,7 @@ int kfd_dbg_trap_set_wave_launch_override(struct kfd_process *target,
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
r = debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd);
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
|
||||
if (r)
|
||||
break;
|
||||
@ -880,7 +882,7 @@ int kfd_dbg_trap_set_wave_launch_mode(struct kfd_process *target,
|
||||
if (!pdd->dev->kfd->shared_resources.enable_mes)
|
||||
r = debug_refresh_runlist(pdd->dev->dqm);
|
||||
else
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd);
|
||||
r = kfd_dbg_set_mes_debug_mode(pdd, true);
|
||||
|
||||
if (r)
|
||||
break;
|
||||
|
@ -76,8 +76,9 @@ int kfd_dbg_send_exception_to_runtime(struct kfd_process *p,
|
||||
|
||||
static inline bool kfd_dbg_is_per_vmid_supported(struct kfd_node *dev)
|
||||
{
|
||||
return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
|
||||
KFD_GC_VERSION(dev) >= IP_VERSION(11, 0, 0);
|
||||
return (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
|
||||
KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) ||
|
||||
KFD_GC_VERSION(dev) >= IP_VERSION(11, 0, 0));
|
||||
}
|
||||
|
||||
void debug_event_write_work_handler(struct work_struct *work);
|
||||
@ -100,6 +101,12 @@ static inline bool kfd_dbg_is_rlc_restore_supported(struct kfd_node *dev)
|
||||
KFD_GC_VERSION(dev) == IP_VERSION(10, 1, 1));
|
||||
}
|
||||
|
||||
static inline bool kfd_dbg_has_cwsr_workaround(struct kfd_node *dev)
|
||||
{
|
||||
return KFD_GC_VERSION(dev) >= IP_VERSION(11, 0, 0) &&
|
||||
KFD_GC_VERSION(dev) <= IP_VERSION(11, 0, 3);
|
||||
}
|
||||
|
||||
static inline bool kfd_dbg_has_gws_support(struct kfd_node *dev)
|
||||
{
|
||||
if ((KFD_GC_VERSION(dev) == IP_VERSION(9, 0, 1)
|
||||
@ -119,5 +126,14 @@ static inline bool kfd_dbg_has_gws_support(struct kfd_node *dev)
|
||||
return true;
|
||||
}
|
||||
|
||||
int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd);
|
||||
int kfd_dbg_set_mes_debug_mode(struct kfd_process_device *pdd, bool sq_trap_en);
|
||||
|
||||
static inline bool kfd_dbg_has_ttmps_always_setup(struct kfd_node *dev)
|
||||
{
|
||||
return (KFD_GC_VERSION(dev) < IP_VERSION(11, 0, 0) &&
|
||||
KFD_GC_VERSION(dev) != IP_VERSION(9, 4, 2)) ||
|
||||
(KFD_GC_VERSION(dev) >= IP_VERSION(11, 0, 0) &&
|
||||
KFD_GC_VERSION(dev) < IP_VERSION(12, 0, 0) &&
|
||||
(dev->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK) >= 70);
|
||||
}
|
||||
#endif
|
||||
|
@ -508,6 +508,7 @@ static int kfd_gws_init(struct kfd_node *node)
|
||||
{
|
||||
int ret = 0;
|
||||
struct kfd_dev *kfd = node->kfd;
|
||||
uint32_t mes_rev = node->adev->mes.sched_version & AMDGPU_MES_VERSION_MASK;
|
||||
|
||||
if (node->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS)
|
||||
return 0;
|
||||
@ -524,7 +525,10 @@ static int kfd_gws_init(struct kfd_node *node)
|
||||
(KFD_GC_VERSION(node) == IP_VERSION(9, 4, 3)) ||
|
||||
(KFD_GC_VERSION(node) >= IP_VERSION(10, 3, 0)
|
||||
&& KFD_GC_VERSION(node) < IP_VERSION(11, 0, 0)
|
||||
&& kfd->mec2_fw_version >= 0x6b))))
|
||||
&& kfd->mec2_fw_version >= 0x6b) ||
|
||||
(KFD_GC_VERSION(node) >= IP_VERSION(11, 0, 0)
|
||||
&& KFD_GC_VERSION(node) < IP_VERSION(12, 0, 0)
|
||||
&& mes_rev >= 68))))
|
||||
ret = amdgpu_amdkfd_alloc_gws(node->adev,
|
||||
node->adev->gds.gws_size, &node->gws);
|
||||
|
||||
|
@ -226,9 +226,10 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
|
||||
queue_input.paging = false;
|
||||
queue_input.tba_addr = qpd->tba_addr;
|
||||
queue_input.tma_addr = qpd->tma_addr;
|
||||
queue_input.trap_en = KFD_GC_VERSION(q->device) < IP_VERSION(11, 0, 0) ||
|
||||
KFD_GC_VERSION(q->device) > IP_VERSION(11, 0, 3);
|
||||
queue_input.trap_en = !kfd_dbg_has_cwsr_workaround(q->device);
|
||||
queue_input.skip_process_ctx_clear = qpd->pqm->process->debug_trap_enabled;
|
||||
queue_input.skip_process_ctx_clear = qpd->pqm->process->debug_trap_enabled ||
|
||||
kfd_dbg_has_ttmps_always_setup(q->device);
|
||||
|
||||
queue_type = convert_to_mes_queue_type(q->properties.type);
|
||||
if (queue_type < 0) {
|
||||
@ -238,10 +239,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
|
||||
}
|
||||
queue_input.queue_type = (uint32_t)queue_type;
|
||||
|
||||
if (q->gws) {
|
||||
queue_input.gws_base = 0;
|
||||
queue_input.gws_size = qpd->num_gws;
|
||||
}
|
||||
queue_input.exclusively_scheduled = q->properties.is_gws;
|
||||
|
||||
amdgpu_mes_lock(&adev->mes);
|
||||
r = adev->mes.funcs->add_hw_queue(&adev->mes, &queue_input);
|
||||
@ -251,7 +249,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q,
|
||||
q->properties.doorbell_off);
|
||||
pr_err("MES might be in unrecoverable state, issue a GPU reset\n");
|
||||
kfd_hws_hang(dqm);
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -1621,7 +1619,8 @@ static int initialize_cpsch(struct device_queue_manager *dqm)
|
||||
|
||||
if (dqm->dev->kfd2kgd->get_iq_wait_times)
|
||||
dqm->dev->kfd2kgd->get_iq_wait_times(dqm->dev->adev,
|
||||
&dqm->wait_times);
|
||||
&dqm->wait_times,
|
||||
ffs(dqm->dev->xcc_mask) - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1663,6 +1662,26 @@ static int start_cpsch(struct device_queue_manager *dqm)
|
||||
|
||||
if (!dqm->dev->kfd->shared_resources.enable_mes)
|
||||
execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, USE_DEFAULT_GRACE_PERIOD);
|
||||
|
||||
/* Set CWSR grace period to 1x1000 cycle for GFX9.4.3 APU */
|
||||
if (amdgpu_emu_mode == 0 && dqm->dev->adev->gmc.is_app_apu &&
|
||||
(KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 3))) {
|
||||
uint32_t reg_offset = 0;
|
||||
uint32_t grace_period = 1;
|
||||
|
||||
retval = pm_update_grace_period(&dqm->packet_mgr,
|
||||
grace_period);
|
||||
if (retval)
|
||||
pr_err("Setting grace timeout failed\n");
|
||||
else if (dqm->dev->kfd2kgd->build_grace_period_packet_info)
|
||||
/* Update dqm->wait_times maintained in software */
|
||||
dqm->dev->kfd2kgd->build_grace_period_packet_info(
|
||||
dqm->dev->adev, dqm->wait_times,
|
||||
grace_period, ®_offset,
|
||||
&dqm->wait_times,
|
||||
ffs(dqm->dev->xcc_mask) - 1);
|
||||
}
|
||||
|
||||
dqm_unlock(dqm);
|
||||
|
||||
return 0;
|
||||
@ -1806,8 +1825,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
|
||||
*/
|
||||
q->properties.is_evicted = !!qpd->evicted;
|
||||
q->properties.is_dbg_wa = qpd->pqm->process->debug_trap_enabled &&
|
||||
KFD_GC_VERSION(q->device) >= IP_VERSION(11, 0, 0) &&
|
||||
KFD_GC_VERSION(q->device) <= IP_VERSION(11, 0, 3);
|
||||
kfd_dbg_has_cwsr_workaround(q->device);
|
||||
|
||||
if (qd)
|
||||
mqd_mgr->restore_mqd(mqd_mgr, &q->mqd, q->mqd_mem_obj, &q->gart_mqd_addr,
|
||||
|
@ -318,6 +318,26 @@ static void init_mqd_hiq(struct mqd_manager *mm, void **mqd,
|
||||
1 << CP_HQD_PQ_CONTROL__KMD_QUEUE__SHIFT;
|
||||
}
|
||||
|
||||
static int destroy_hiq_mqd(struct mqd_manager *mm, void *mqd,
|
||||
enum kfd_preempt_type type, unsigned int timeout,
|
||||
uint32_t pipe_id, uint32_t queue_id)
|
||||
{
|
||||
int err;
|
||||
struct v10_compute_mqd *m;
|
||||
u32 doorbell_off;
|
||||
|
||||
m = get_mqd(mqd);
|
||||
|
||||
doorbell_off = m->cp_hqd_pq_doorbell_control >>
|
||||
CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT;
|
||||
|
||||
err = amdgpu_amdkfd_unmap_hiq(mm->dev->adev, doorbell_off, 0);
|
||||
if (err)
|
||||
pr_debug("Destroy HIQ MQD failed: %d\n", err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void init_mqd_sdma(struct mqd_manager *mm, void **mqd,
|
||||
struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
|
||||
struct queue_properties *q)
|
||||
@ -460,7 +480,7 @@ struct mqd_manager *mqd_manager_init_v10(enum KFD_MQD_TYPE type,
|
||||
mqd->free_mqd = free_mqd_hiq_sdma;
|
||||
mqd->load_mqd = kfd_hiq_load_mqd_kiq;
|
||||
mqd->update_mqd = update_mqd;
|
||||
mqd->destroy_mqd = kfd_destroy_mqd_cp;
|
||||
mqd->destroy_mqd = destroy_hiq_mqd;
|
||||
mqd->is_occupied = kfd_is_occupied_cp;
|
||||
mqd->mqd_size = sizeof(struct v10_compute_mqd);
|
||||
mqd->mqd_stride = kfd_mqd_stride;
|
||||
|
@ -335,6 +335,26 @@ static void init_mqd_hiq(struct mqd_manager *mm, void **mqd,
|
||||
1 << CP_HQD_PQ_CONTROL__KMD_QUEUE__SHIFT;
|
||||
}
|
||||
|
||||
static int destroy_hiq_mqd(struct mqd_manager *mm, void *mqd,
|
||||
enum kfd_preempt_type type, unsigned int timeout,
|
||||
uint32_t pipe_id, uint32_t queue_id)
|
||||
{
|
||||
int err;
|
||||
struct v11_compute_mqd *m;
|
||||
u32 doorbell_off;
|
||||
|
||||
m = get_mqd(mqd);
|
||||
|
||||
doorbell_off = m->cp_hqd_pq_doorbell_control >>
|
||||
CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT;
|
||||
|
||||
err = amdgpu_amdkfd_unmap_hiq(mm->dev->adev, doorbell_off, 0);
|
||||
if (err)
|
||||
pr_debug("Destroy HIQ MQD failed: %d\n", err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void init_mqd_sdma(struct mqd_manager *mm, void **mqd,
|
||||
struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
|
||||
struct queue_properties *q)
|
||||
@ -449,7 +469,7 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type,
|
||||
mqd->free_mqd = free_mqd_hiq_sdma;
|
||||
mqd->load_mqd = kfd_hiq_load_mqd_kiq;
|
||||
mqd->update_mqd = update_mqd;
|
||||
mqd->destroy_mqd = kfd_destroy_mqd_cp;
|
||||
mqd->destroy_mqd = destroy_hiq_mqd;
|
||||
mqd->is_occupied = kfd_is_occupied_cp;
|
||||
mqd->mqd_size = sizeof(struct v11_compute_mqd);
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user