mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge remote-tracking branch 'drm/drm-next' into drm-misc-next
Backmerge to prevent getting out of sync with drm-next too much. Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
This commit is contained in:
@@ -37,7 +37,8 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
|
||||
-I$(FULL_AMD_DISPLAY_PATH)/modules/inc \
|
||||
-I$(FULL_AMD_DISPLAY_PATH)/dc \
|
||||
-I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \
|
||||
-I$(FULL_AMD_PATH)/amdkfd
|
||||
-I$(FULL_AMD_PATH)/amdkfd \
|
||||
-I$(FULL_AMD_PATH)/ras/ras_mgr
|
||||
|
||||
# Locally disable W=1 warnings enabled in drm subsystem Makefile
|
||||
subdir-ccflags-y += -Wno-override-init
|
||||
@@ -324,4 +325,9 @@ amdgpu-y += \
|
||||
isp_v4_1_1.o
|
||||
endif
|
||||
|
||||
AMD_GPU_RAS_PATH := ../ras
|
||||
AMD_GPU_RAS_FULL_PATH := $(FULL_AMD_PATH)/ras
|
||||
include $(AMD_GPU_RAS_FULL_PATH)/Makefile
|
||||
amdgpu-y += $(AMD_GPU_RAS_FILES)
|
||||
|
||||
obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o
|
||||
|
||||
@@ -88,6 +88,10 @@ static int aldebaran_mode2_suspend_ip(struct amdgpu_device *adev)
|
||||
uint32_t ip_block;
|
||||
int r, i;
|
||||
|
||||
/* Skip suspend of SDMA IP versions >= 4.4.2. They are multi-aid */
|
||||
if (adev->aid_mask)
|
||||
ip_block_mask &= ~BIT(AMD_IP_BLOCK_TYPE_SDMA);
|
||||
|
||||
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
|
||||
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
|
||||
|
||||
|
||||
@@ -372,13 +372,15 @@ void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev,
|
||||
u64 *flags);
|
||||
int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev,
|
||||
enum amd_ip_block_type block_type);
|
||||
bool amdgpu_device_ip_is_hw(struct amdgpu_device *adev,
|
||||
enum amd_ip_block_type block_type);
|
||||
bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev,
|
||||
enum amd_ip_block_type block_type);
|
||||
int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
|
||||
|
||||
int amdgpu_ip_block_resume(struct amdgpu_ip_block *ip_block);
|
||||
|
||||
#define AMDGPU_MAX_IP_NUM 16
|
||||
#define AMDGPU_MAX_IP_NUM AMD_IP_BLOCK_TYPE_NUM
|
||||
|
||||
struct amdgpu_ip_block_status {
|
||||
bool valid;
|
||||
@@ -839,8 +841,6 @@ struct amd_powerplay {
|
||||
const struct amd_pm_funcs *pp_funcs;
|
||||
};
|
||||
|
||||
struct ip_discovery_top;
|
||||
|
||||
/* polaris10 kickers */
|
||||
#define ASICID_IS_P20(did, rid) (((did == 0x67DF) && \
|
||||
((rid == 0xE3) || \
|
||||
@@ -972,8 +972,7 @@ struct amdgpu_device {
|
||||
struct notifier_block acpi_nb;
|
||||
struct notifier_block pm_nb;
|
||||
struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS];
|
||||
struct debugfs_blob_wrapper debugfs_vbios_blob;
|
||||
struct debugfs_blob_wrapper debugfs_discovery_blob;
|
||||
struct debugfs_blob_wrapper debugfs_vbios_blob;
|
||||
struct mutex srbm_mutex;
|
||||
/* GRBM index mutex. Protects concurrent access to GRBM index */
|
||||
struct mutex grbm_idx_mutex;
|
||||
@@ -1063,6 +1062,9 @@ struct amdgpu_device {
|
||||
u32 log2_max_MBps;
|
||||
} mm_stats;
|
||||
|
||||
/* discovery*/
|
||||
struct amdgpu_discovery_info discovery;
|
||||
|
||||
/* display */
|
||||
bool enable_virtual_display;
|
||||
struct amdgpu_vkms_output *amdgpu_vkms_output;
|
||||
@@ -1174,6 +1176,12 @@ struct amdgpu_device {
|
||||
* queue fence.
|
||||
*/
|
||||
struct xarray userq_xa;
|
||||
/**
|
||||
* @userq_doorbell_xa: Global user queue map (doorbell index → queue)
|
||||
* Key: doorbell_index (unique global identifier for the queue)
|
||||
* Value: struct amdgpu_usermode_queue
|
||||
*/
|
||||
struct xarray userq_doorbell_xa;
|
||||
|
||||
/* df */
|
||||
struct amdgpu_df df;
|
||||
@@ -1265,8 +1273,6 @@ struct amdgpu_device {
|
||||
|
||||
struct list_head ras_list;
|
||||
|
||||
struct ip_discovery_top *ip_top;
|
||||
|
||||
struct amdgpu_reset_domain *reset_domain;
|
||||
|
||||
struct mutex benchmark_mutex;
|
||||
@@ -1309,8 +1315,6 @@ struct amdgpu_device {
|
||||
*/
|
||||
bool apu_prefer_gtt;
|
||||
|
||||
struct list_head userq_mgr_list;
|
||||
struct mutex userq_mutex;
|
||||
bool userq_halt_for_enforce_isolation;
|
||||
struct amdgpu_uid *uid_info;
|
||||
|
||||
@@ -1638,7 +1642,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
|
||||
struct drm_file *file_priv);
|
||||
void amdgpu_driver_release_kms(struct drm_device *dev);
|
||||
|
||||
int amdgpu_device_ip_suspend(struct amdgpu_device *adev);
|
||||
int amdgpu_device_prepare(struct drm_device *dev);
|
||||
void amdgpu_device_complete(struct drm_device *dev);
|
||||
int amdgpu_device_suspend(struct drm_device *dev, bool fbcon);
|
||||
|
||||
@@ -507,7 +507,6 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
|
||||
pm_runtime_get_sync(adev_to_drm(adev)->dev);
|
||||
/* Just fire off a uevent and let userspace tell us what to do */
|
||||
drm_helper_hpd_irq_event(adev_to_drm(adev));
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "amdgpu_ras.h"
|
||||
#include "amdgpu_umc.h"
|
||||
#include "amdgpu_reset.h"
|
||||
#include "amdgpu_ras_mgr.h"
|
||||
|
||||
/* Total memory size in system memory and all GPU VRAM. Used to
|
||||
* estimate worst case amount of memory to reserve for page tables
|
||||
@@ -746,6 +747,20 @@ void amdgpu_amdkfd_ras_pasid_poison_consumption_handler(struct amdgpu_device *ad
|
||||
enum amdgpu_ras_block block, uint16_t pasid,
|
||||
pasid_notify pasid_fn, void *data, uint32_t reset)
|
||||
{
|
||||
|
||||
if (amdgpu_uniras_enabled(adev)) {
|
||||
struct ras_ih_info ih_info;
|
||||
|
||||
memset(&ih_info, 0, sizeof(ih_info));
|
||||
ih_info.block = block;
|
||||
ih_info.pasid = pasid;
|
||||
ih_info.reset = reset;
|
||||
ih_info.pasid_fn = pasid_fn;
|
||||
ih_info.data = data;
|
||||
amdgpu_ras_mgr_handle_consumer_interrupt(adev, &ih_info);
|
||||
return;
|
||||
}
|
||||
|
||||
amdgpu_umc_pasid_poison_handler(adev, block, pasid, pasid_fn, data, reset);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ struct kgd_mem {
|
||||
struct mutex lock;
|
||||
struct amdgpu_bo *bo;
|
||||
struct dma_buf *dmabuf;
|
||||
struct hmm_range *range;
|
||||
struct amdgpu_hmm_range *range;
|
||||
struct list_head attachments;
|
||||
/* protected by amdkfd_process_info.lock */
|
||||
struct list_head validate_list;
|
||||
|
||||
@@ -1057,7 +1057,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
|
||||
struct amdkfd_process_info *process_info = mem->process_info;
|
||||
struct amdgpu_bo *bo = mem->bo;
|
||||
struct ttm_operation_ctx ctx = { true, false };
|
||||
struct hmm_range *range;
|
||||
struct amdgpu_hmm_range *range;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&process_info->lock);
|
||||
@@ -1089,8 +1089,15 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = amdgpu_ttm_tt_get_user_pages(bo, &range);
|
||||
range = amdgpu_hmm_range_alloc(NULL);
|
||||
if (unlikely(!range)) {
|
||||
ret = -ENOMEM;
|
||||
goto unregister_out;
|
||||
}
|
||||
|
||||
ret = amdgpu_ttm_tt_get_user_pages(bo, range);
|
||||
if (ret) {
|
||||
amdgpu_hmm_range_free(range);
|
||||
if (ret == -EAGAIN)
|
||||
pr_debug("Failed to get user pages, try again\n");
|
||||
else
|
||||
@@ -1113,7 +1120,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
|
||||
amdgpu_bo_unreserve(bo);
|
||||
|
||||
release_out:
|
||||
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, range);
|
||||
amdgpu_hmm_range_free(range);
|
||||
unregister_out:
|
||||
if (ret)
|
||||
amdgpu_hmm_unregister(bo);
|
||||
@@ -1916,7 +1923,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
|
||||
if (amdgpu_ttm_tt_get_usermm(mem->bo->tbo.ttm)) {
|
||||
amdgpu_hmm_unregister(mem->bo);
|
||||
mutex_lock(&process_info->notifier_lock);
|
||||
amdgpu_ttm_tt_discard_user_pages(mem->bo->tbo.ttm, mem->range);
|
||||
amdgpu_hmm_range_free(mem->range);
|
||||
mutex_unlock(&process_info->notifier_lock);
|
||||
}
|
||||
|
||||
@@ -1954,9 +1961,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
|
||||
*/
|
||||
if (size) {
|
||||
if (!is_imported &&
|
||||
(mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM ||
|
||||
(adev->apu_prefer_gtt &&
|
||||
mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)))
|
||||
mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
|
||||
*size = bo_size;
|
||||
else
|
||||
*size = 0;
|
||||
@@ -2542,7 +2547,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
|
||||
|
||||
bo = mem->bo;
|
||||
|
||||
amdgpu_ttm_tt_discard_user_pages(bo->tbo.ttm, mem->range);
|
||||
amdgpu_hmm_range_free(mem->range);
|
||||
mem->range = NULL;
|
||||
|
||||
/* BO reservations and getting user pages (hmm_range_fault)
|
||||
@@ -2566,9 +2571,14 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
|
||||
}
|
||||
}
|
||||
|
||||
mem->range = amdgpu_hmm_range_alloc(NULL);
|
||||
if (unlikely(!mem->range))
|
||||
return -ENOMEM;
|
||||
/* Get updated user pages */
|
||||
ret = amdgpu_ttm_tt_get_user_pages(bo, &mem->range);
|
||||
ret = amdgpu_ttm_tt_get_user_pages(bo, mem->range);
|
||||
if (ret) {
|
||||
amdgpu_hmm_range_free(mem->range);
|
||||
mem->range = NULL;
|
||||
pr_debug("Failed %d to get user pages\n", ret);
|
||||
|
||||
/* Return -EFAULT bad address error as success. It will
|
||||
@@ -2741,8 +2751,8 @@ static int confirm_valid_user_pages_locked(struct amdkfd_process_info *process_i
|
||||
continue;
|
||||
|
||||
/* Only check mem with hmm range associated */
|
||||
valid = amdgpu_ttm_tt_get_user_pages_done(
|
||||
mem->bo->tbo.ttm, mem->range);
|
||||
valid = amdgpu_hmm_range_valid(mem->range);
|
||||
amdgpu_hmm_range_free(mem->range);
|
||||
|
||||
mem->range = NULL;
|
||||
if (!valid) {
|
||||
|
||||
@@ -181,19 +181,22 @@ int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev)
|
||||
u8 frev, crev;
|
||||
int usage_bytes = 0;
|
||||
|
||||
if (amdgpu_atom_parse_data_header(ctx, index, NULL, &frev, &crev, &data_offset)) {
|
||||
if (frev == 2 && crev == 1) {
|
||||
fw_usage_v2_1 =
|
||||
(struct vram_usagebyfirmware_v2_1 *)(ctx->bios + data_offset);
|
||||
amdgpu_atomfirmware_allocate_fb_v2_1(adev,
|
||||
fw_usage_v2_1,
|
||||
&usage_bytes);
|
||||
} else if (frev >= 2 && crev >= 2) {
|
||||
fw_usage_v2_2 =
|
||||
(struct vram_usagebyfirmware_v2_2 *)(ctx->bios + data_offset);
|
||||
amdgpu_atomfirmware_allocate_fb_v2_2(adev,
|
||||
fw_usage_v2_2,
|
||||
&usage_bytes);
|
||||
/* Skip atomfirmware allocation for SRIOV VFs when dynamic crit regn is enabled */
|
||||
if (!(amdgpu_sriov_vf(adev) && adev->virt.is_dynamic_crit_regn_enabled)) {
|
||||
if (amdgpu_atom_parse_data_header(ctx, index, NULL, &frev, &crev, &data_offset)) {
|
||||
if (frev == 2 && crev == 1) {
|
||||
fw_usage_v2_1 =
|
||||
(struct vram_usagebyfirmware_v2_1 *)(ctx->bios + data_offset);
|
||||
amdgpu_atomfirmware_allocate_fb_v2_1(adev,
|
||||
fw_usage_v2_1,
|
||||
&usage_bytes);
|
||||
} else if (frev >= 2 && crev >= 2) {
|
||||
fw_usage_v2_2 =
|
||||
(struct vram_usagebyfirmware_v2_2 *)(ctx->bios + data_offset);
|
||||
amdgpu_atomfirmware_allocate_fb_v2_2(adev,
|
||||
fw_usage_v2_2,
|
||||
&usage_bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,13 +96,14 @@ void amdgpu_bios_release(struct amdgpu_device *adev)
|
||||
* part of the system bios. On boot, the system bios puts a
|
||||
* copy of the igp rom at the start of vram if a discrete card is
|
||||
* present.
|
||||
* For SR-IOV, the vbios image is also put in VRAM in the VF.
|
||||
* For SR-IOV, if dynamic critical region is not enabled,
|
||||
* the vbios image is also put at the start of VRAM in the VF.
|
||||
*/
|
||||
static bool amdgpu_read_bios_from_vram(struct amdgpu_device *adev)
|
||||
{
|
||||
uint8_t __iomem *bios;
|
||||
uint8_t __iomem *bios = NULL;
|
||||
resource_size_t vram_base;
|
||||
resource_size_t size = 256 * 1024; /* ??? */
|
||||
u32 size = 256U * 1024U; /* ??? */
|
||||
|
||||
if (!(adev->flags & AMD_IS_APU))
|
||||
if (amdgpu_device_need_post(adev))
|
||||
@@ -114,18 +115,33 @@ static bool amdgpu_read_bios_from_vram(struct amdgpu_device *adev)
|
||||
|
||||
adev->bios = NULL;
|
||||
vram_base = pci_resource_start(adev->pdev, 0);
|
||||
bios = ioremap_wc(vram_base, size);
|
||||
if (!bios)
|
||||
return false;
|
||||
|
||||
adev->bios = kmalloc(size, GFP_KERNEL);
|
||||
if (!adev->bios) {
|
||||
iounmap(bios);
|
||||
if (!adev->bios)
|
||||
return false;
|
||||
|
||||
/* For SRIOV with dynamic critical region is enabled,
|
||||
* the vbios image is put at a dynamic offset of VRAM in the VF.
|
||||
* If dynamic critical region is disabled, follow the existing logic as on baremetal.
|
||||
*/
|
||||
if (amdgpu_sriov_vf(adev) && adev->virt.is_dynamic_crit_regn_enabled) {
|
||||
if (amdgpu_virt_get_dynamic_data_info(adev,
|
||||
AMD_SRIOV_MSG_VBIOS_IMG_TABLE_ID, adev->bios, &size)) {
|
||||
amdgpu_bios_release(adev);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
bios = ioremap_wc(vram_base, size);
|
||||
if (!bios) {
|
||||
amdgpu_bios_release(adev);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy_fromio(adev->bios, bios, size);
|
||||
iounmap(bios);
|
||||
}
|
||||
|
||||
adev->bios_size = size;
|
||||
memcpy_fromio(adev->bios, bios, size);
|
||||
iounmap(bios);
|
||||
|
||||
if (!check_atom_bios(adev, size)) {
|
||||
amdgpu_bios_release(adev);
|
||||
|
||||
@@ -38,7 +38,7 @@ struct amdgpu_bo_list_entry {
|
||||
struct amdgpu_bo *bo;
|
||||
struct amdgpu_bo_va *bo_va;
|
||||
uint32_t priority;
|
||||
struct hmm_range *range;
|
||||
struct amdgpu_hmm_range *range;
|
||||
bool user_invalidated;
|
||||
};
|
||||
|
||||
|
||||
@@ -734,10 +734,8 @@ amdgpu_connector_lvds_detect(struct drm_connector *connector, bool force)
|
||||
|
||||
amdgpu_connector_update_scratch_regs(connector, ret);
|
||||
|
||||
if (!drm_kms_helper_is_poll_worker()) {
|
||||
pm_runtime_mark_last_busy(connector->dev->dev);
|
||||
if (!drm_kms_helper_is_poll_worker())
|
||||
pm_runtime_put_autosuspend(connector->dev->dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -919,10 +917,8 @@ amdgpu_connector_vga_detect(struct drm_connector *connector, bool force)
|
||||
amdgpu_connector_update_scratch_regs(connector, ret);
|
||||
|
||||
out:
|
||||
if (!drm_kms_helper_is_poll_worker()) {
|
||||
pm_runtime_mark_last_busy(connector->dev->dev);
|
||||
if (!drm_kms_helper_is_poll_worker())
|
||||
pm_runtime_put_autosuspend(connector->dev->dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1146,10 +1142,8 @@ out:
|
||||
amdgpu_connector_update_scratch_regs(connector, ret);
|
||||
|
||||
exit:
|
||||
if (!drm_kms_helper_is_poll_worker()) {
|
||||
pm_runtime_mark_last_busy(connector->dev->dev);
|
||||
if (!drm_kms_helper_is_poll_worker())
|
||||
pm_runtime_put_autosuspend(connector->dev->dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1486,10 +1480,8 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
|
||||
|
||||
amdgpu_connector_update_scratch_regs(connector, ret);
|
||||
out:
|
||||
if (!drm_kms_helper_is_poll_worker()) {
|
||||
pm_runtime_mark_last_busy(connector->dev->dev);
|
||||
if (!drm_kms_helper_is_poll_worker())
|
||||
pm_runtime_put_autosuspend(connector->dev->dev);
|
||||
}
|
||||
|
||||
if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
|
||||
connector->connector_type == DRM_MODE_CONNECTOR_eDP)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright 2025 Advanced Micro Devices, Inc.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
/*
|
||||
* Copyright 2025 Advanced Micro Devices, Inc.
|
||||
*
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/sync_file.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <linux/hmm.h>
|
||||
|
||||
#include <drm/amdgpu_drm.h>
|
||||
#include <drm/drm_syncobj.h>
|
||||
@@ -41,6 +40,7 @@
|
||||
#include "amdgpu_gmc.h"
|
||||
#include "amdgpu_gem.h"
|
||||
#include "amdgpu_ras.h"
|
||||
#include "amdgpu_hmm.h"
|
||||
|
||||
static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p,
|
||||
struct amdgpu_device *adev,
|
||||
@@ -891,12 +891,17 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
|
||||
bool userpage_invalidated = false;
|
||||
struct amdgpu_bo *bo = e->bo;
|
||||
|
||||
r = amdgpu_ttm_tt_get_user_pages(bo, &e->range);
|
||||
e->range = amdgpu_hmm_range_alloc(NULL);
|
||||
if (unlikely(!e->range))
|
||||
return -ENOMEM;
|
||||
|
||||
r = amdgpu_ttm_tt_get_user_pages(bo, e->range);
|
||||
if (r)
|
||||
goto out_free_user_pages;
|
||||
|
||||
for (i = 0; i < bo->tbo.ttm->num_pages; i++) {
|
||||
if (bo->tbo.ttm->pages[i] != hmm_pfn_to_page(e->range->hmm_pfns[i])) {
|
||||
if (bo->tbo.ttm->pages[i] !=
|
||||
hmm_pfn_to_page(e->range->hmm_range.hmm_pfns[i])) {
|
||||
userpage_invalidated = true;
|
||||
break;
|
||||
}
|
||||
@@ -990,9 +995,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
|
||||
|
||||
out_free_user_pages:
|
||||
amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
|
||||
struct amdgpu_bo *bo = e->bo;
|
||||
|
||||
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, e->range);
|
||||
amdgpu_hmm_range_free(e->range);
|
||||
e->range = NULL;
|
||||
}
|
||||
mutex_unlock(&p->bo_list->bo_list_mutex);
|
||||
@@ -1323,8 +1326,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
|
||||
*/
|
||||
r = 0;
|
||||
amdgpu_bo_list_for_each_userptr_entry(e, p->bo_list) {
|
||||
r |= !amdgpu_ttm_tt_get_user_pages_done(e->bo->tbo.ttm,
|
||||
e->range);
|
||||
r |= !amdgpu_hmm_range_valid(e->range);
|
||||
amdgpu_hmm_range_free(e->range);
|
||||
e->range = NULL;
|
||||
}
|
||||
if (r) {
|
||||
|
||||
@@ -129,7 +129,6 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f,
|
||||
if (use_bank) {
|
||||
if ((sh_bank != 0xFFFFFFFF && sh_bank >= adev->gfx.config.max_sh_per_se) ||
|
||||
(se_bank != 0xFFFFFFFF && se_bank >= adev->gfx.config.max_shader_engines)) {
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return -EINVAL;
|
||||
@@ -179,7 +178,6 @@ end:
|
||||
if (pm_pg_lock)
|
||||
mutex_unlock(&adev->pm.mutex);
|
||||
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
@@ -255,7 +253,6 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off
|
||||
if (rd->id.use_grbm) {
|
||||
if ((rd->id.grbm.sh != 0xFFFFFFFF && rd->id.grbm.sh >= adev->gfx.config.max_sh_per_se) ||
|
||||
(rd->id.grbm.se != 0xFFFFFFFF && rd->id.grbm.se >= adev->gfx.config.max_shader_engines)) {
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
mutex_unlock(&rd->lock);
|
||||
@@ -310,7 +307,6 @@ end:
|
||||
|
||||
mutex_unlock(&rd->lock);
|
||||
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
@@ -446,7 +442,6 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, siz
|
||||
amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, rd->id.xcc_id);
|
||||
mutex_unlock(&adev->grbm_idx_mutex);
|
||||
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
if (!x) {
|
||||
@@ -557,7 +552,6 @@ static ssize_t amdgpu_debugfs_regs_pcie_read(struct file *f, char __user *buf,
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return r;
|
||||
@@ -617,7 +611,6 @@ static ssize_t amdgpu_debugfs_regs_pcie_write(struct file *f, const char __user
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return r;
|
||||
@@ -676,7 +669,6 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf,
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return r;
|
||||
@@ -736,7 +728,6 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __user
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return r;
|
||||
@@ -795,7 +786,6 @@ static ssize_t amdgpu_debugfs_regs_smc_read(struct file *f, char __user *buf,
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return r;
|
||||
@@ -855,7 +845,6 @@ static ssize_t amdgpu_debugfs_regs_smc_write(struct file *f, const char __user *
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
amdgpu_virt_disable_access_debugfs(adev);
|
||||
return r;
|
||||
@@ -1003,7 +992,6 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,
|
||||
|
||||
r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);
|
||||
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
if (r) {
|
||||
@@ -1094,7 +1082,6 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf,
|
||||
amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0);
|
||||
mutex_unlock(&adev->grbm_idx_mutex);
|
||||
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
if (!x) {
|
||||
@@ -1192,7 +1179,6 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
|
||||
amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0);
|
||||
mutex_unlock(&adev->grbm_idx_mutex);
|
||||
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
while (size) {
|
||||
@@ -1266,7 +1252,6 @@ static ssize_t amdgpu_debugfs_gfxoff_residency_read(struct file *f, char __user
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return r;
|
||||
@@ -1315,7 +1300,6 @@ static ssize_t amdgpu_debugfs_gfxoff_residency_write(struct file *f, const char
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return r;
|
||||
@@ -1365,7 +1349,6 @@ static ssize_t amdgpu_debugfs_gfxoff_count_read(struct file *f, char __user *buf
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return r;
|
||||
@@ -1414,7 +1397,6 @@ static ssize_t amdgpu_debugfs_gfxoff_write(struct file *f, const char __user *bu
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return r;
|
||||
@@ -1460,7 +1442,6 @@ static ssize_t amdgpu_debugfs_gfxoff_read(struct file *f, char __user *buf,
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return r;
|
||||
@@ -1501,7 +1482,6 @@ static ssize_t amdgpu_debugfs_gfxoff_status_read(struct file *f, char __user *bu
|
||||
|
||||
r = result;
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return r;
|
||||
@@ -1701,7 +1681,6 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused)
|
||||
|
||||
up_write(&adev->reset_domain->sem);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
|
||||
return 0;
|
||||
@@ -1721,7 +1700,6 @@ static int amdgpu_debugfs_evict_vram(void *data, u64 *val)
|
||||
|
||||
*val = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
|
||||
return 0;
|
||||
@@ -1742,7 +1720,6 @@ static int amdgpu_debugfs_evict_gtt(void *data, u64 *val)
|
||||
|
||||
*val = amdgpu_ttm_evict_resources(adev, TTM_PL_TT);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
|
||||
return 0;
|
||||
@@ -1762,7 +1739,6 @@ static int amdgpu_debugfs_benchmark(void *data, u64 val)
|
||||
|
||||
r = amdgpu_benchmark(adev, val);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
|
||||
return r;
|
||||
@@ -1902,7 +1878,7 @@ no_preempt:
|
||||
continue;
|
||||
}
|
||||
job = to_amdgpu_job(s_job);
|
||||
if (preempted && (&job->hw_fence.base) == fence)
|
||||
if (preempted && (&job->hw_fence->base) == fence)
|
||||
/* mark the job as preempted */
|
||||
job->preemption_status |= AMDGPU_IB_PREEMPTED;
|
||||
}
|
||||
@@ -2014,7 +1990,6 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val)
|
||||
ret = -EINVAL;
|
||||
|
||||
out:
|
||||
pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
|
||||
pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
|
||||
|
||||
return ret;
|
||||
@@ -2123,10 +2098,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
|
||||
debugfs_create_blob("amdgpu_vbios", 0444, root,
|
||||
&adev->debugfs_vbios_blob);
|
||||
|
||||
adev->debugfs_discovery_blob.data = adev->mman.discovery_bin;
|
||||
adev->debugfs_discovery_blob.size = adev->mman.discovery_tmr_size;
|
||||
debugfs_create_blob("amdgpu_discovery", 0444, root,
|
||||
&adev->debugfs_discovery_blob);
|
||||
if (adev->discovery.debugfs_blob.size)
|
||||
debugfs_create_blob("amdgpu_discovery", 0444, root,
|
||||
&adev->discovery.debugfs_blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2387,7 +2387,7 @@ int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev,
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_ip_is_valid - is the hardware IP enabled
|
||||
* amdgpu_device_ip_is_hw - is the hardware IP enabled
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @block_type: Type of hardware IP (SMU, GFX, UVD, etc.)
|
||||
@@ -2395,6 +2395,27 @@ int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev,
|
||||
* Check if the hardware IP is enable or not.
|
||||
* Returns true if it the IP is enable, false if not.
|
||||
*/
|
||||
bool amdgpu_device_ip_is_hw(struct amdgpu_device *adev,
|
||||
enum amd_ip_block_type block_type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < adev->num_ip_blocks; i++) {
|
||||
if (adev->ip_blocks[i].version->type == block_type)
|
||||
return adev->ip_blocks[i].status.hw;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_ip_is_valid - is the hardware IP valid
|
||||
*
|
||||
* @adev: amdgpu_device pointer
|
||||
* @block_type: Type of hardware IP (SMU, GFX, UVD, etc.)
|
||||
*
|
||||
* Check if the hardware IP is valid or not.
|
||||
* Returns true if it the IP is valid, false if not.
|
||||
*/
|
||||
bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev,
|
||||
enum amd_ip_block_type block_type)
|
||||
{
|
||||
@@ -2633,7 +2654,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
|
||||
chip_name = "arcturus";
|
||||
break;
|
||||
case CHIP_NAVI12:
|
||||
if (adev->mman.discovery_bin)
|
||||
if (adev->discovery.bin)
|
||||
return 0;
|
||||
chip_name = "navi12";
|
||||
break;
|
||||
@@ -2761,6 +2782,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
|
||||
r = amdgpu_virt_request_full_gpu(adev, true);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_virt_init_critical_region(adev);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
switch (adev->asic_type) {
|
||||
@@ -3780,7 +3805,6 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
|
||||
if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_DCE)
|
||||
continue;
|
||||
|
||||
/* XXX handle errors */
|
||||
r = amdgpu_ip_block_suspend(&adev->ip_blocks[i]);
|
||||
if (r)
|
||||
return r;
|
||||
@@ -3863,9 +3887,9 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
|
||||
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP)
|
||||
continue;
|
||||
|
||||
/* XXX handle errors */
|
||||
r = amdgpu_ip_block_suspend(&adev->ip_blocks[i]);
|
||||
adev->ip_blocks[i].status.hw = false;
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
/* handle putting the SMC in the appropriate state */
|
||||
if (!amdgpu_sriov_vf(adev)) {
|
||||
@@ -3895,7 +3919,7 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
|
||||
* in each IP into a state suitable for suspend.
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
|
||||
static int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -4191,7 +4215,6 @@ bool amdgpu_device_asic_has_dc_support(struct pci_dev *pdev,
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case CHIP_BONAIRE:
|
||||
case CHIP_KAVERI:
|
||||
case CHIP_KABINI:
|
||||
case CHIP_MULLINS:
|
||||
@@ -4285,58 +4308,53 @@ static int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
|
||||
long timeout;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* By default timeout for jobs is 10 sec
|
||||
*/
|
||||
adev->compute_timeout = adev->gfx_timeout = msecs_to_jiffies(10000);
|
||||
adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
|
||||
/* By default timeout for all queues is 2 sec */
|
||||
adev->gfx_timeout = adev->compute_timeout = adev->sdma_timeout =
|
||||
adev->video_timeout = msecs_to_jiffies(2000);
|
||||
|
||||
if (strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENGTH)) {
|
||||
while ((timeout_setting = strsep(&input, ",")) &&
|
||||
strnlen(timeout_setting, AMDGPU_MAX_TIMEOUT_PARAM_LENGTH)) {
|
||||
ret = kstrtol(timeout_setting, 0, &timeout);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENGTH))
|
||||
return 0;
|
||||
|
||||
if (timeout == 0) {
|
||||
index++;
|
||||
continue;
|
||||
} else if (timeout < 0) {
|
||||
timeout = MAX_SCHEDULE_TIMEOUT;
|
||||
dev_warn(adev->dev, "lockup timeout disabled");
|
||||
add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
|
||||
} else {
|
||||
timeout = msecs_to_jiffies(timeout);
|
||||
}
|
||||
while ((timeout_setting = strsep(&input, ",")) &&
|
||||
strnlen(timeout_setting, AMDGPU_MAX_TIMEOUT_PARAM_LENGTH)) {
|
||||
ret = kstrtol(timeout_setting, 0, &timeout);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
adev->gfx_timeout = timeout;
|
||||
break;
|
||||
case 1:
|
||||
adev->compute_timeout = timeout;
|
||||
break;
|
||||
case 2:
|
||||
adev->sdma_timeout = timeout;
|
||||
break;
|
||||
case 3:
|
||||
adev->video_timeout = timeout;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (timeout == 0) {
|
||||
index++;
|
||||
continue;
|
||||
} else if (timeout < 0) {
|
||||
timeout = MAX_SCHEDULE_TIMEOUT;
|
||||
dev_warn(adev->dev, "lockup timeout disabled");
|
||||
add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
|
||||
} else {
|
||||
timeout = msecs_to_jiffies(timeout);
|
||||
}
|
||||
/*
|
||||
* There is only one value specified and
|
||||
* it should apply to all non-compute jobs.
|
||||
*/
|
||||
if (index == 1) {
|
||||
adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
|
||||
if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
|
||||
adev->compute_timeout = adev->gfx_timeout;
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
adev->gfx_timeout = timeout;
|
||||
break;
|
||||
case 1:
|
||||
adev->compute_timeout = timeout;
|
||||
break;
|
||||
case 2:
|
||||
adev->sdma_timeout = timeout;
|
||||
break;
|
||||
case 3:
|
||||
adev->video_timeout = timeout;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* When only one value specified apply it to all queues. */
|
||||
if (index == 1)
|
||||
adev->gfx_timeout = adev->compute_timeout = adev->sdma_timeout =
|
||||
adev->video_timeout = timeout;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -4391,6 +4409,55 @@ static void amdgpu_device_set_mcbp(struct amdgpu_device *adev)
|
||||
dev_info(adev->dev, "MCBP is enabled\n");
|
||||
}
|
||||
|
||||
static int amdgpu_device_sys_interface_init(struct amdgpu_device *adev)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = amdgpu_atombios_sysfs_init(adev);
|
||||
if (r)
|
||||
drm_err(&adev->ddev,
|
||||
"registering atombios sysfs failed (%d).\n", r);
|
||||
|
||||
r = amdgpu_pm_sysfs_init(adev);
|
||||
if (r)
|
||||
dev_err(adev->dev, "registering pm sysfs failed (%d).\n", r);
|
||||
|
||||
r = amdgpu_ucode_sysfs_init(adev);
|
||||
if (r) {
|
||||
adev->ucode_sysfs_en = false;
|
||||
dev_err(adev->dev, "Creating firmware sysfs failed (%d).\n", r);
|
||||
} else
|
||||
adev->ucode_sysfs_en = true;
|
||||
|
||||
r = amdgpu_device_attr_sysfs_init(adev);
|
||||
if (r)
|
||||
dev_err(adev->dev, "Could not create amdgpu device attr\n");
|
||||
|
||||
r = devm_device_add_group(adev->dev, &amdgpu_board_attrs_group);
|
||||
if (r)
|
||||
dev_err(adev->dev,
|
||||
"Could not create amdgpu board attributes\n");
|
||||
|
||||
amdgpu_fru_sysfs_init(adev);
|
||||
amdgpu_reg_state_sysfs_init(adev);
|
||||
amdgpu_xcp_sysfs_init(adev);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void amdgpu_device_sys_interface_fini(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->pm.sysfs_initialized)
|
||||
amdgpu_pm_sysfs_fini(adev);
|
||||
if (adev->ucode_sysfs_en)
|
||||
amdgpu_ucode_sysfs_fini(adev);
|
||||
amdgpu_device_attr_sysfs_fini(adev);
|
||||
amdgpu_fru_sysfs_fini(adev);
|
||||
|
||||
amdgpu_reg_state_sysfs_fini(adev);
|
||||
amdgpu_xcp_sysfs_fini(adev);
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_init - initialize the driver
|
||||
*
|
||||
@@ -4490,7 +4557,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
mutex_init(&adev->gfx.userq_sch_mutex);
|
||||
mutex_init(&adev->gfx.workload_profile_mutex);
|
||||
mutex_init(&adev->vcn.workload_profile_mutex);
|
||||
mutex_init(&adev->userq_mutex);
|
||||
|
||||
amdgpu_device_init_apu_flags(adev);
|
||||
|
||||
@@ -4518,7 +4584,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
|
||||
|
||||
INIT_LIST_HEAD(&adev->pm.od_kobj_list);
|
||||
|
||||
INIT_LIST_HEAD(&adev->userq_mgr_list);
|
||||
xa_init(&adev->userq_doorbell_xa);
|
||||
|
||||
INIT_DELAYED_WORK(&adev->delayed_init_work,
|
||||
amdgpu_device_delayed_init_work_handler);
|
||||
@@ -4814,39 +4880,14 @@ fence_driver_init:
|
||||
flush_delayed_work(&adev->delayed_init_work);
|
||||
}
|
||||
|
||||
if (adev->init_lvl->level == AMDGPU_INIT_LEVEL_MINIMAL_XGMI)
|
||||
amdgpu_xgmi_reset_on_init(adev);
|
||||
/*
|
||||
* Place those sysfs registering after `late_init`. As some of those
|
||||
* operations performed in `late_init` might affect the sysfs
|
||||
* interfaces creating.
|
||||
*/
|
||||
r = amdgpu_atombios_sysfs_init(adev);
|
||||
if (r)
|
||||
drm_err(&adev->ddev,
|
||||
"registering atombios sysfs failed (%d).\n", r);
|
||||
|
||||
r = amdgpu_pm_sysfs_init(adev);
|
||||
if (r)
|
||||
dev_err(adev->dev, "registering pm sysfs failed (%d).\n", r);
|
||||
|
||||
r = amdgpu_ucode_sysfs_init(adev);
|
||||
if (r) {
|
||||
adev->ucode_sysfs_en = false;
|
||||
dev_err(adev->dev, "Creating firmware sysfs failed (%d).\n", r);
|
||||
} else
|
||||
adev->ucode_sysfs_en = true;
|
||||
|
||||
r = amdgpu_device_attr_sysfs_init(adev);
|
||||
if (r)
|
||||
dev_err(adev->dev, "Could not create amdgpu device attr\n");
|
||||
|
||||
r = devm_device_add_group(adev->dev, &amdgpu_board_attrs_group);
|
||||
if (r)
|
||||
dev_err(adev->dev,
|
||||
"Could not create amdgpu board attributes\n");
|
||||
|
||||
amdgpu_fru_sysfs_init(adev);
|
||||
amdgpu_reg_state_sysfs_init(adev);
|
||||
amdgpu_xcp_sysfs_init(adev);
|
||||
r = amdgpu_device_sys_interface_init(adev);
|
||||
|
||||
if (IS_ENABLED(CONFIG_PERF_EVENTS))
|
||||
r = amdgpu_pmu_init(adev);
|
||||
@@ -4874,9 +4915,6 @@ fence_driver_init:
|
||||
if (px)
|
||||
vga_switcheroo_init_domain_pm_ops(adev->dev, &adev->vga_pm_domain);
|
||||
|
||||
if (adev->init_lvl->level == AMDGPU_INIT_LEVEL_MINIMAL_XGMI)
|
||||
amdgpu_xgmi_reset_on_init(adev);
|
||||
|
||||
amdgpu_device_check_iommu_direct_map(adev);
|
||||
|
||||
adev->pm_nb.notifier_call = amdgpu_device_pm_notifier;
|
||||
@@ -4968,15 +5006,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
|
||||
}
|
||||
amdgpu_fence_driver_hw_fini(adev);
|
||||
|
||||
if (adev->pm.sysfs_initialized)
|
||||
amdgpu_pm_sysfs_fini(adev);
|
||||
if (adev->ucode_sysfs_en)
|
||||
amdgpu_ucode_sysfs_fini(adev);
|
||||
amdgpu_device_attr_sysfs_fini(adev);
|
||||
amdgpu_fru_sysfs_fini(adev);
|
||||
|
||||
amdgpu_reg_state_sysfs_fini(adev);
|
||||
amdgpu_xcp_sysfs_fini(adev);
|
||||
amdgpu_device_sys_interface_fini(adev);
|
||||
|
||||
/* disable ras feature must before hw fini */
|
||||
amdgpu_ras_pre_fini(adev);
|
||||
@@ -5051,7 +5081,7 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
|
||||
|
||||
if (IS_ENABLED(CONFIG_PERF_EVENTS))
|
||||
amdgpu_pmu_fini(adev);
|
||||
if (adev->mman.discovery_bin)
|
||||
if (adev->discovery.bin)
|
||||
amdgpu_discovery_fini(adev);
|
||||
|
||||
amdgpu_reset_put_reset_domain(adev->reset_domain);
|
||||
@@ -5225,10 +5255,14 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
|
||||
|
||||
amdgpu_ras_suspend(adev);
|
||||
|
||||
amdgpu_device_ip_suspend_phase1(adev);
|
||||
r = amdgpu_device_ip_suspend_phase1(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
amdgpu_amdkfd_suspend(adev, !amdgpu_sriov_vf(adev) && !adev->in_runpm);
|
||||
amdgpu_userq_suspend(adev);
|
||||
r = amdgpu_userq_suspend(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_device_evict_resources(adev);
|
||||
if (r)
|
||||
@@ -5238,7 +5272,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
|
||||
|
||||
amdgpu_fence_driver_hw_fini(adev);
|
||||
|
||||
amdgpu_device_ip_suspend_phase2(adev);
|
||||
r = amdgpu_device_ip_suspend_phase2(adev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
amdgpu_virt_release_full_gpu(adev, false);
|
||||
@@ -5809,11 +5845,6 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
|
||||
if (!amdgpu_ring_sched_ready(ring))
|
||||
continue;
|
||||
|
||||
/* 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 */
|
||||
amdgpu_fence_driver_force_completion(ring);
|
||||
}
|
||||
@@ -6542,7 +6573,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
|
||||
*
|
||||
* job->base holds a reference to parent fence
|
||||
*/
|
||||
if (job && dma_fence_is_signaled(&job->hw_fence.base)) {
|
||||
if (job && dma_fence_is_signaled(&job->hw_fence->base)) {
|
||||
job_signaled = true;
|
||||
dev_info(adev->dev, "Guilty job already signaled, skipping HW reset");
|
||||
goto skip_hw_reset;
|
||||
@@ -7286,10 +7317,17 @@ void amdgpu_device_flush_hdp(struct amdgpu_device *adev,
|
||||
if (adev->gmc.xgmi.connected_to_cpu)
|
||||
return;
|
||||
|
||||
if (ring && ring->funcs->emit_hdp_flush)
|
||||
if (ring && ring->funcs->emit_hdp_flush) {
|
||||
amdgpu_ring_emit_hdp_flush(ring);
|
||||
else
|
||||
amdgpu_asic_flush_hdp(adev, ring);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ring && amdgpu_sriov_runtime(adev)) {
|
||||
if (!amdgpu_kiq_hdp_flush(adev))
|
||||
return;
|
||||
}
|
||||
|
||||
amdgpu_asic_flush_hdp(adev, ring);
|
||||
}
|
||||
|
||||
void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,9 +24,21 @@
|
||||
#ifndef __AMDGPU_DISCOVERY__
|
||||
#define __AMDGPU_DISCOVERY__
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#define DISCOVERY_TMR_SIZE (10 << 10)
|
||||
#define DISCOVERY_TMR_OFFSET (64 << 10)
|
||||
|
||||
struct ip_discovery_top;
|
||||
|
||||
struct amdgpu_discovery_info {
|
||||
struct debugfs_blob_wrapper debugfs_blob;
|
||||
struct ip_discovery_top *ip_top;
|
||||
uint32_t size;
|
||||
uint8_t *bin;
|
||||
bool reserve_tmr;
|
||||
};
|
||||
|
||||
void amdgpu_discovery_fini(struct amdgpu_device *adev);
|
||||
int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev);
|
||||
|
||||
|
||||
@@ -332,8 +332,6 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
|
||||
if (crtc->enabled)
|
||||
active = true;
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
|
||||
adev = drm_to_adev(dev);
|
||||
/* if we have active crtcs and we don't have a power ref,
|
||||
* take the current one
|
||||
@@ -1365,6 +1363,64 @@ static const struct drm_prop_enum_list amdgpu_dither_enum_list[] = {
|
||||
{ AMDGPU_FMT_DITHER_ENABLE, "on" },
|
||||
};
|
||||
|
||||
/**
|
||||
* DOC: property for adaptive backlight modulation
|
||||
*
|
||||
* The 'adaptive backlight modulation' property is used for the compositor to
|
||||
* directly control the adaptive backlight modulation power savings feature
|
||||
* that is part of DCN hardware.
|
||||
*
|
||||
* The property will be attached specifically to eDP panels that support it.
|
||||
*
|
||||
* The property is by default set to 'sysfs' to allow the sysfs file 'panel_power_savings'
|
||||
* to be able to control it.
|
||||
* If set to 'off' the compositor will ensure it stays off.
|
||||
* The other values 'min', 'bias min', 'bias max', and 'max' will control the
|
||||
* intensity of the power savings.
|
||||
*
|
||||
* Modifying this value can have implications on color accuracy, so tread
|
||||
* carefully.
|
||||
*/
|
||||
static int amdgpu_display_setup_abm_prop(struct amdgpu_device *adev)
|
||||
{
|
||||
const struct drm_prop_enum_list props[] = {
|
||||
{ ABM_SYSFS_CONTROL, "sysfs" },
|
||||
{ ABM_LEVEL_OFF, "off" },
|
||||
{ ABM_LEVEL_MIN, "min" },
|
||||
{ ABM_LEVEL_BIAS_MIN, "bias min" },
|
||||
{ ABM_LEVEL_BIAS_MAX, "bias max" },
|
||||
{ ABM_LEVEL_MAX, "max" },
|
||||
};
|
||||
struct drm_property *prop;
|
||||
int i;
|
||||
|
||||
if (!adev->dc_enabled)
|
||||
return 0;
|
||||
|
||||
prop = drm_property_create(adev_to_drm(adev), DRM_MODE_PROP_ENUM,
|
||||
"adaptive backlight modulation",
|
||||
6);
|
||||
if (!prop)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
int ret;
|
||||
|
||||
ret = drm_property_add_enum(prop, props[i].type,
|
||||
props[i].name);
|
||||
|
||||
if (ret) {
|
||||
drm_property_destroy(adev_to_drm(adev), prop);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
adev->mode_info.abm_level_property = prop;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amdgpu_display_modeset_create_props(struct amdgpu_device *adev)
|
||||
{
|
||||
int sz;
|
||||
@@ -1411,7 +1467,7 @@ int amdgpu_display_modeset_create_props(struct amdgpu_device *adev)
|
||||
"dither",
|
||||
amdgpu_dither_enum_list, sz);
|
||||
|
||||
return 0;
|
||||
return amdgpu_display_setup_abm_prop(adev);
|
||||
}
|
||||
|
||||
void amdgpu_display_update_priority(struct amdgpu_device *adev)
|
||||
|
||||
@@ -55,4 +55,11 @@ int amdgpu_display_resume_helper(struct amdgpu_device *adev);
|
||||
int amdgpu_display_get_scanout_buffer(struct drm_plane *plane,
|
||||
struct drm_scanout_buffer *sb);
|
||||
|
||||
#define ABM_SYSFS_CONTROL -1
|
||||
#define ABM_LEVEL_OFF 0
|
||||
#define ABM_LEVEL_MIN 1
|
||||
#define ABM_LEVEL_BIAS_MIN 2
|
||||
#define ABM_LEVEL_BIAS_MAX 3
|
||||
#define ABM_LEVEL_MAX 4
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user