virt: acrn: obtain pa from VMA with PFNMAP flag
authorYonghua Huang <yonghua.huang@intel.com>
Mon, 28 Feb 2022 02:22:12 +0000 (05:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:50 +0000 (14:23 +0200)
commitb9c43aa0b18da5619aac347d54cb67fe30d1f884
tree79fe2bc94bc26090583a89b94271bc1b2ca64964
parent16e3238047322c3967e601b2813a10837fb2acb9
virt: acrn: obtain pa from VMA with PFNMAP flag

[ Upstream commit 8a6e85f75a83d16a71077e41f2720c691f432002 ]

 acrn_vm_ram_map can't pin the user pages with VM_PFNMAP flag
 by calling get_user_pages_fast(), the PA(physical pages)
 may be mapped by kernel driver and set PFNMAP flag.

 This patch fixes logic to setup EPT mapping for PFN mapped RAM region
 by checking the memory attribute before adding EPT mapping for them.

Fixes: 88f537d5e8dd ("virt: acrn: Introduce EPT mapping management")
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Signed-off-by: Fei Li <fei1.li@intel.com>
Link: https://lore.kernel.org/r/20220228022212.419406-1-yonghua.huang@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/virt/acrn/mm.c