Mostly the same as i915. We add a new hint for userspace to force an object into the mappable part of vram. We also need to tell userspace how large the mappable part is. In Vulkan for example, there will be two vram heaps for small-bar systems. And here the size of each heap needs to be known. Likewise the used/avail tracking needs to account for the mappable part. We also limit the available tracking going forward, such that we limit to privileged users only, since these values are system wide and are technically considered an info leak. v2 (Maarten): - s/NEEDS_CPU_ACCESS/NEEDS_VISIBLE_VRAM/ in the uapi. We also no longer require smem as an extra placement. This is more flexible, and lets us use this for clear-color surfaces, since we need CPU access there but we don't want to attach smem, since that effectively disables CCS from kernel pov. - Reject clear-color CCS buffers where NEEDS_VISIBLE_VRAM is not set, instead of migrating it behind the scenes. v3 (José): - Split the changes that limit the accounting for perfmon_capable() into a separate patch. - Use XE_BO_CREATE_VRAM_MASK. v4 (Gwan-gyeong Mun): - Add some kernel-doc for the query bits. v5: - One small kernel-doc correction. The cpu_visible_size and corresponding used tracking are always zero for non XE_MEM_REGION_CLASS_VRAM. v6: - Without perfmon_capable() it likely makes more sense to report as zero, instead of reporting as used == total size. This should give similar behaviour as i915 which rather tracks free instead of used. - Only enforce NEEDS_VISIBLE_VRAM on rc_ccs_cc_plane surfaces when the device is actually small-bar. Testcase: igt/tests/xe_query Testcase: igt/tests/xe_mmap@small-bar Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Cc: Filip Hazubski <filip.hazubski@intel.com> Cc: Carl Zhang <carl.zhang@intel.com> Cc: Effie Yu <effie.yu@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2022 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _XE_TTM_VRAM_MGR_H_
|
|
#define _XE_TTM_VRAM_MGR_H_
|
|
|
|
#include "xe_ttm_vram_mgr_types.h"
|
|
|
|
enum dma_data_direction;
|
|
struct xe_device;
|
|
struct xe_tile;
|
|
|
|
int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr,
|
|
u32 mem_type, u64 size, u64 io_size,
|
|
u64 default_page_size);
|
|
int xe_ttm_vram_mgr_init(struct xe_tile *tile, struct xe_ttm_vram_mgr *mgr);
|
|
int xe_ttm_vram_mgr_alloc_sgt(struct xe_device *xe,
|
|
struct ttm_resource *res,
|
|
u64 offset, u64 length,
|
|
struct device *dev,
|
|
enum dma_data_direction dir,
|
|
struct sg_table **sgt);
|
|
void xe_ttm_vram_mgr_free_sgt(struct device *dev, enum dma_data_direction dir,
|
|
struct sg_table *sgt);
|
|
|
|
u64 xe_ttm_vram_get_cpu_visible_size(struct ttm_resource_manager *man);
|
|
void xe_ttm_vram_get_used(struct ttm_resource_manager *man,
|
|
u64 *used, u64 *used_visible);
|
|
|
|
static inline struct xe_ttm_vram_mgr_resource *
|
|
to_xe_ttm_vram_mgr_resource(struct ttm_resource *res)
|
|
{
|
|
return container_of(res, struct xe_ttm_vram_mgr_resource, base);
|
|
}
|
|
|
|
static inline struct xe_ttm_vram_mgr *
|
|
to_xe_ttm_vram_mgr(struct ttm_resource_manager *man)
|
|
{
|
|
return container_of(man, struct xe_ttm_vram_mgr, manager);
|
|
}
|
|
|
|
#endif
|