提交 2f770192 编写于 作者: G Guanghui Zhou 提交者: Xie XiuQi

mm: insert hugepage pte by pa

scend inclusion
category: feature
bugzilla: NA
CVE: NA

-------------------

The cross OS sdma copy needs to map the OS's physical address
to the tx-atu of the remote device through PCIE.
However, the sdma copy only receives the virtual address,
thus a page table is necessary to provide mapping between
tx-atu and the virtual address.
Signed-off-by: NGuanghui Zhou <zhouguanghui1@huawei.com>
Signed-off-by: NLI Heng <liheng40@huawei.com>
Signed-off-by: NLijun Fang <fanglijun3@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3a5b6495
...@@ -5196,4 +5196,28 @@ int hugetlb_insert_hugepage_pte(struct mm_struct *mm, unsigned long addr, ...@@ -5196,4 +5196,28 @@ int hugetlb_insert_hugepage_pte(struct mm_struct *mm, unsigned long addr,
} }
EXPORT_SYMBOL_GPL(hugetlb_insert_hugepage_pte); EXPORT_SYMBOL_GPL(hugetlb_insert_hugepage_pte);
int hugetlb_insert_hugepage_pte_by_pa(struct mm_struct *mm,
unsigned long vir_addr,
pgprot_t prot, unsigned long phy_addr)
{
pte_t *ptep, entry;
struct hstate *h = &default_hstate;
ptep = hugetlb_huge_pte_alloc(mm, vir_addr, huge_page_size(h));
if (!ptep)
return -ENXIO;
WARN_ON(ptep && !pte_none(*ptep) && !pte_huge(*ptep));
entry = pfn_pte(phy_addr >> PAGE_SHIFT, prot);
entry = huge_pte_mkdirty(entry);
entry = huge_pte_mkwrite(entry);
entry = pte_mkyoung(entry);
entry = pte_mkhuge(entry);
entry = pte_mkspecial(entry);
set_huge_pte_at(mm, vir_addr, ptep, entry);
return 0;
}
EXPORT_SYMBOL_GPL(hugetlb_insert_hugepage_pte_by_pa);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册