Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mshv: handle gpa intercepts for arm64

The mshv driver now uses movable pages for guests. For arm64 guests
to be functional, handle gpa intercepts for arm64 too (the current
code implements handling only for x86).

Move some arch-agnostic functions out of #ifdefs so that they can be
re-used.

Fixes: b9a66cd5ccbb ("mshv: Add support for movable memory regions")
Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Anirudh Rayabharam (Microsoft) and committed by
Wei Liu
12ffd561 69c88a6a

+8 -7
+8 -7
drivers/hv/mshv_root_main.c
··· 611 611 return NULL; 612 612 } 613 613 614 - #ifdef CONFIG_X86_64 615 614 static struct mshv_mem_region * 616 615 mshv_partition_region_by_gfn_get(struct mshv_partition *p, u64 gfn) 617 616 { ··· 642 643 { 643 644 struct mshv_partition *p = vp->vp_partition; 644 645 struct mshv_mem_region *region; 645 - struct hv_x64_memory_intercept_message *msg; 646 646 bool ret; 647 647 u64 gfn; 648 - 649 - msg = (struct hv_x64_memory_intercept_message *) 648 + #if defined(CONFIG_X86_64) 649 + struct hv_x64_memory_intercept_message *msg = 650 + (struct hv_x64_memory_intercept_message *) 650 651 vp->vp_intercept_msg_page->u.payload; 652 + #elif defined(CONFIG_ARM64) 653 + struct hv_arm64_memory_intercept_message *msg = 654 + (struct hv_arm64_memory_intercept_message *) 655 + vp->vp_intercept_msg_page->u.payload; 656 + #endif 651 657 652 658 gfn = HVPFN_DOWN(msg->guest_physical_address); 653 659 ··· 670 666 671 667 return ret; 672 668 } 673 - #else /* CONFIG_X86_64 */ 674 - static bool mshv_handle_gpa_intercept(struct mshv_vp *vp) { return false; } 675 - #endif /* CONFIG_X86_64 */ 676 669 677 670 static bool mshv_vp_handle_intercept(struct mshv_vp *vp) 678 671 {