Path: blob/master/drivers/gpu/drm/amd/amdkfd/kfd_migrate.h
26516 views
/* SPDX-License-Identifier: GPL-2.0 OR MIT */1/*2* Copyright 2020-2021 Advanced Micro Devices, Inc.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be included in12* all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR18* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,19* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR20* OTHER DEALINGS IN THE SOFTWARE.21*22*/2324#ifndef KFD_MIGRATE_H_25#define KFD_MIGRATE_H_2627#if IS_ENABLED(CONFIG_HSA_AMD_SVM)2829#include <linux/rwsem.h>30#include <linux/list.h>31#include <linux/mutex.h>32#include <linux/sched/mm.h>33#include <linux/hmm.h>34#include "kfd_priv.h"35#include "kfd_svm.h"3637enum MIGRATION_COPY_DIR {38FROM_RAM_TO_VRAM = 0,39FROM_VRAM_TO_RAM40};4142int svm_migrate_to_vram(struct svm_range *prange, uint32_t best_loc,43unsigned long start, unsigned long last,44struct mm_struct *mm, uint32_t trigger);4546int svm_migrate_vram_to_ram(struct svm_range *prange, struct mm_struct *mm,47unsigned long start, unsigned long last,48uint32_t trigger, struct page *fault_page);4950unsigned long51svm_migrate_addr_to_pfn(struct amdgpu_device *adev, unsigned long addr);5253#endif /* IS_ENABLED(CONFIG_HSA_AMD_SVM) */5455#endif /* KFD_MIGRATE_H_ */565758