From: Dave Airlie <airlied@xxxxxxxxxx> These will be used by drivers to reserve/free WC memory in the PAT tracking tables, for VRAM BARs. Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx> --- drivers/gpu/drm/ttm/ttm_bo_util.c | 24 ++++++++++++++++++++++++ include/drm/ttm/ttm_bo_driver.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index bf6e216..192c003 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -39,6 +39,13 @@ #include <linux/module.h> #include <linux/reservation.h> +#ifdef CONFIG_X86 +#include <asm/pat.h> +#else +#define io_reserve_memtype(start, end, pcm) (0) +#define io_free_memtype(start, end) +#endif + void ttm_bo_free_old_node(struct ttm_buffer_object *bo) { ttm_bo_mem_put(bo, &bo->mem); @@ -796,3 +803,20 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo, return 0; } EXPORT_SYMBOL(ttm_bo_pipeline_move); + +int ttm_io_reserve_memtype_wc(resource_size_t start, resource_size_t end) +{ + enum page_cache_mode pcm = _PAGE_CACHE_MODE_WC; + int ret; + ret = io_reserve_memtype(start, end, &pcm); + if (ret) + return ret; + return 0; +} +EXPORT_SYMBOL(ttm_io_reserve_memtype_wc); + +void ttm_io_free_memtype(resource_size_t start, resource_size_t end) +{ + io_free_memtype(start, end); +} +EXPORT_SYMBOL(ttm_io_free_memtype); diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 4f0a921..6b2d24e 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -1054,6 +1054,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo, */ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); +int ttm_io_reserve_memtype_wc(resource_size_t start, resource_size_t end); +void ttm_io_free_memtype(resource_size_t start, resource_size_t end); extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; #if IS_ENABLED(CONFIG_AGP) -- 2.5.5 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel