mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
amd-drm-fixes-6.10-2024-05-22:
amdgpu: - Handle vbios table integrated info v2.3 amdkfd: - Handle duplicate BOs in reserve_bo_and_cond_vms - Handle memory limitations on small APUs -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQgO5Idg2tXNTSZAr293/aFa7yZ2AUCZk4+IwAKCRC93/aFa7yZ 2NsbAP9XLe8Qk8zIr1lZQNe7dRgm2LkgzzVTEbFMFhU1qzSrLAEA/LIxahAkYduP xhKCyuwlCqkTdmRyEjUdRo4bF8hfUgQ= =lwR8 -----END PGP SIGNATURE----- Merge tag 'amd-drm-fixes-6.10-2024-05-22' of https://gitlab.freedesktop.org/agd5f/linux into drm-next amd-drm-fixes-6.10-2024-05-22: amdgpu: - Handle vbios table integrated info v2.3 amdkfd: - Handle duplicate BOs in reserve_bo_and_cond_vms - Handle memory limitations on small APUs Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240522185346.16716-1-alexander.deucher@amd.com
This commit is contained in:
commit
c99eb9cc2a
@ -455,6 +455,9 @@ void amdgpu_amdkfd_get_local_mem_info(struct amdgpu_device *adev,
|
||||
else
|
||||
mem_info->local_mem_size_private =
|
||||
KFD_XCP_MEMORY_SIZE(adev, xcp->id);
|
||||
} else if (adev->flags & AMD_IS_APU) {
|
||||
mem_info->local_mem_size_public = (ttm_tt_pages_limit() << PAGE_SHIFT);
|
||||
mem_info->local_mem_size_private = 0;
|
||||
} else {
|
||||
mem_info->local_mem_size_public = adev->gmc.visible_vram_size;
|
||||
mem_info->local_mem_size_private = adev->gmc.real_vram_size -
|
||||
@ -824,6 +827,8 @@ u64 amdgpu_amdkfd_xcp_memory_size(struct amdgpu_device *adev, int xcp_id)
|
||||
}
|
||||
do_div(tmp, adev->xcp_mgr->num_xcp_per_mem_partition);
|
||||
return ALIGN_DOWN(tmp, PAGE_SIZE);
|
||||
} else if (adev->flags & AMD_IS_APU) {
|
||||
return (ttm_tt_pages_limit() << PAGE_SHIFT);
|
||||
} else {
|
||||
return adev->gmc.real_vram_size;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
|
||||
return -EINVAL;
|
||||
|
||||
vram_size = KFD_XCP_MEMORY_SIZE(adev, xcp_id);
|
||||
if (adev->gmc.is_app_apu) {
|
||||
if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) {
|
||||
system_mem_needed = size;
|
||||
ttm_mem_needed = size;
|
||||
}
|
||||
@ -232,7 +232,8 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
|
||||
"adev reference can't be null when vram is used");
|
||||
if (adev && xcp_id >= 0) {
|
||||
adev->kfd.vram_used[xcp_id] += vram_needed;
|
||||
adev->kfd.vram_used_aligned[xcp_id] += adev->gmc.is_app_apu ?
|
||||
adev->kfd.vram_used_aligned[xcp_id] +=
|
||||
(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ?
|
||||
vram_needed :
|
||||
ALIGN(vram_needed, VRAM_AVAILABLITY_ALIGN);
|
||||
}
|
||||
@ -260,7 +261,7 @@ void amdgpu_amdkfd_unreserve_mem_limit(struct amdgpu_device *adev,
|
||||
|
||||
if (adev) {
|
||||
adev->kfd.vram_used[xcp_id] -= size;
|
||||
if (adev->gmc.is_app_apu) {
|
||||
if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) {
|
||||
adev->kfd.vram_used_aligned[xcp_id] -= size;
|
||||
kfd_mem_limit.system_mem_used -= size;
|
||||
kfd_mem_limit.ttm_mem_used -= size;
|
||||
@ -889,7 +890,7 @@ static int kfd_mem_attach(struct amdgpu_device *adev, struct kgd_mem *mem,
|
||||
* if peer device has large BAR. In contrast, access over xGMI is
|
||||
* allowed for both small and large BAR configurations of peer device
|
||||
*/
|
||||
if ((adev != bo_adev && !adev->gmc.is_app_apu) &&
|
||||
if ((adev != bo_adev && !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU)) &&
|
||||
((mem->domain == AMDGPU_GEM_DOMAIN_VRAM) ||
|
||||
(mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL) ||
|
||||
(mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP))) {
|
||||
@ -1188,7 +1189,8 @@ static int reserve_bo_and_cond_vms(struct kgd_mem *mem,
|
||||
int ret;
|
||||
|
||||
ctx->sync = &mem->sync;
|
||||
drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT, 0);
|
||||
drm_exec_init(&ctx->exec, DRM_EXEC_INTERRUPTIBLE_WAIT |
|
||||
DRM_EXEC_IGNORE_DUPLICATES, 0);
|
||||
drm_exec_until_all_locked(&ctx->exec) {
|
||||
ctx->n_vms = 0;
|
||||
list_for_each_entry(entry, &mem->attachments, list) {
|
||||
@ -1656,7 +1658,7 @@ size_t amdgpu_amdkfd_get_available_memory(struct amdgpu_device *adev,
|
||||
- atomic64_read(&adev->vram_pin_size)
|
||||
- reserved_for_pt;
|
||||
|
||||
if (adev->gmc.is_app_apu) {
|
||||
if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) {
|
||||
system_mem_available = no_system_mem_limit ?
|
||||
kfd_mem_limit.max_system_mem_limit :
|
||||
kfd_mem_limit.max_system_mem_limit -
|
||||
@ -1704,7 +1706,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
|
||||
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) {
|
||||
domain = alloc_domain = AMDGPU_GEM_DOMAIN_VRAM;
|
||||
|
||||
if (adev->gmc.is_app_apu) {
|
||||
if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) {
|
||||
domain = AMDGPU_GEM_DOMAIN_GTT;
|
||||
alloc_domain = AMDGPU_GEM_DOMAIN_GTT;
|
||||
alloc_flags = 0;
|
||||
@ -1951,7 +1953,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
|
||||
if (size) {
|
||||
if (!is_imported &&
|
||||
(mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM ||
|
||||
(adev->gmc.is_app_apu &&
|
||||
((adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) &&
|
||||
mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)))
|
||||
*size = bo_size;
|
||||
else
|
||||
@ -2373,8 +2375,9 @@ static int import_obj_create(struct amdgpu_device *adev,
|
||||
(*mem)->dmabuf = dma_buf;
|
||||
(*mem)->bo = bo;
|
||||
(*mem)->va = va;
|
||||
(*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) && !adev->gmc.is_app_apu ?
|
||||
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
|
||||
(*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) &&
|
||||
!(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ?
|
||||
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
|
||||
|
||||
(*mem)->mapped_to_gpu_memory = 0;
|
||||
(*mem)->process_info = avm->process_info;
|
||||
|
@ -212,6 +212,7 @@ union igp_info {
|
||||
struct atom_integrated_system_info_v1_11 v11;
|
||||
struct atom_integrated_system_info_v1_12 v12;
|
||||
struct atom_integrated_system_info_v2_1 v21;
|
||||
struct atom_integrated_system_info_v2_3 v23;
|
||||
};
|
||||
|
||||
union umc_info {
|
||||
@ -360,6 +361,20 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
|
||||
if (vram_type)
|
||||
*vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
|
||||
break;
|
||||
case 3:
|
||||
mem_channel_number = igp_info->v23.umachannelnumber;
|
||||
if (!mem_channel_number)
|
||||
mem_channel_number = 1;
|
||||
mem_type = igp_info->v23.memorytype;
|
||||
if (mem_type == LpDdr5MemType)
|
||||
mem_channel_width = 32;
|
||||
else
|
||||
mem_channel_width = 64;
|
||||
if (vram_width)
|
||||
*vram_width = mem_channel_number * mem_channel_width;
|
||||
if (vram_type)
|
||||
*vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
|
||||
if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 0, 1))
|
||||
return -EINVAL;
|
||||
|
||||
if (adev->gmc.is_app_apu)
|
||||
if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU)
|
||||
return 0;
|
||||
|
||||
pgmap = &kfddev->pgmap;
|
||||
|
@ -2619,7 +2619,8 @@ svm_range_best_restore_location(struct svm_range *prange,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (node->adev->gmc.is_app_apu)
|
||||
if (node->adev->gmc.is_app_apu ||
|
||||
node->adev->flags & AMD_IS_APU)
|
||||
return 0;
|
||||
|
||||
if (prange->preferred_loc == gpuid ||
|
||||
@ -3337,7 +3338,8 @@ svm_range_best_prefetch_location(struct svm_range *prange)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (bo_node->adev->gmc.is_app_apu) {
|
||||
if (bo_node->adev->gmc.is_app_apu ||
|
||||
bo_node->adev->flags & AMD_IS_APU) {
|
||||
best_loc = 0;
|
||||
goto out;
|
||||
}
|
||||
|
@ -201,7 +201,8 @@ void svm_range_list_lock_and_flush_work(struct svm_range_list *svms, struct mm_s
|
||||
* is initialized to not 0 when page migration register device memory.
|
||||
*/
|
||||
#define KFD_IS_SVM_API_SUPPORTED(adev) ((adev)->kfd.pgmap.type != 0 ||\
|
||||
(adev)->gmc.is_app_apu)
|
||||
(adev)->gmc.is_app_apu ||\
|
||||
((adev)->flags & AMD_IS_APU))
|
||||
|
||||
void svm_range_bo_unref_async(struct svm_range_bo *svm_bo);
|
||||
|
||||
|
@ -1657,6 +1657,49 @@ struct atom_integrated_system_info_v2_2
|
||||
uint32_t reserved4[189];
|
||||
};
|
||||
|
||||
struct uma_carveout_option {
|
||||
char optionName[29]; //max length of string is 28chars + '\0'. Current design is for "minimum", "Medium", "High". This makes entire struct size 64bits
|
||||
uint8_t memoryCarvedGb; //memory carved out with setting
|
||||
uint8_t memoryRemainingGb; //memory remaining on system
|
||||
union {
|
||||
struct _flags {
|
||||
uint8_t Auto : 1;
|
||||
uint8_t Custom : 1;
|
||||
uint8_t Reserved : 6;
|
||||
} flags;
|
||||
uint8_t all8;
|
||||
} uma_carveout_option_flags;
|
||||
};
|
||||
|
||||
struct atom_integrated_system_info_v2_3 {
|
||||
struct atom_common_table_header table_header;
|
||||
uint32_t vbios_misc; // enum of atom_system_vbiosmisc_def
|
||||
uint32_t gpucapinfo; // enum of atom_system_gpucapinf_def
|
||||
uint32_t system_config;
|
||||
uint32_t cpucapinfo;
|
||||
uint16_t gpuclk_ss_percentage; // unit of 0.001%, 1000 mean 1%
|
||||
uint16_t gpuclk_ss_type;
|
||||
uint16_t dpphy_override; // bit vector, enum of atom_sysinfo_dpphy_override_def
|
||||
uint8_t memorytype; // enum of atom_dmi_t17_mem_type_def, APU memory type indication.
|
||||
uint8_t umachannelnumber; // number of memory channels
|
||||
uint8_t htc_hyst_limit;
|
||||
uint8_t htc_tmp_limit;
|
||||
uint8_t reserved1; // dp_ss_control
|
||||
uint8_t gpu_package_id;
|
||||
struct edp_info_table edp1_info;
|
||||
struct edp_info_table edp2_info;
|
||||
uint32_t reserved2[8];
|
||||
struct atom_external_display_connection_info extdispconninfo;
|
||||
uint8_t UMACarveoutVersion;
|
||||
uint8_t UMACarveoutIndexMax;
|
||||
uint8_t UMACarveoutTypeDefault;
|
||||
uint8_t UMACarveoutIndexDefault;
|
||||
uint8_t UMACarveoutType; //Auto or Custom
|
||||
uint8_t UMACarveoutIndex;
|
||||
struct uma_carveout_option UMASizeControlOption[20];
|
||||
uint8_t reserved3[110];
|
||||
};
|
||||
|
||||
// system_config
|
||||
enum atom_system_vbiosmisc_def{
|
||||
INTEGRATED_SYSTEM_INFO__GET_EDID_CALLBACK_FUNC_SUPPORT = 0x01,
|
||||
|
Loading…
Reference in New Issue
Block a user