Skip to content

Commit 12ffd56

Browse files
Anirudh Rayabharam (Microsoft)liuw
authored andcommitted
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: b9a66cd ("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>
1 parent 69c88a6 commit 12ffd56

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

drivers/hv/mshv_root_main.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ mshv_partition_region_by_gfn(struct mshv_partition *partition, u64 gfn)
611611
return NULL;
612612
}
613613

614-
#ifdef CONFIG_X86_64
615614
static struct mshv_mem_region *
616615
mshv_partition_region_by_gfn_get(struct mshv_partition *p, u64 gfn)
617616
{
@@ -643,12 +642,17 @@ static bool mshv_handle_gpa_intercept(struct mshv_vp *vp)
643642
{
644643
struct mshv_partition *p = vp->vp_partition;
645644
struct mshv_mem_region *region;
646-
struct hv_x64_memory_intercept_message *msg;
647645
bool ret;
648646
u64 gfn;
649-
650-
msg = (struct hv_x64_memory_intercept_message *)
647+
#if defined(CONFIG_X86_64)
648+
struct hv_x64_memory_intercept_message *msg =
649+
(struct hv_x64_memory_intercept_message *)
650+
vp->vp_intercept_msg_page->u.payload;
651+
#elif defined(CONFIG_ARM64)
652+
struct hv_arm64_memory_intercept_message *msg =
653+
(struct hv_arm64_memory_intercept_message *)
651654
vp->vp_intercept_msg_page->u.payload;
655+
#endif
652656

653657
gfn = HVPFN_DOWN(msg->guest_physical_address);
654658

@@ -666,9 +670,6 @@ static bool mshv_handle_gpa_intercept(struct mshv_vp *vp)
666670

667671
return ret;
668672
}
669-
#else /* CONFIG_X86_64 */
670-
static bool mshv_handle_gpa_intercept(struct mshv_vp *vp) { return false; }
671-
#endif /* CONFIG_X86_64 */
672673

673674
static bool mshv_vp_handle_intercept(struct mshv_vp *vp)
674675
{

0 commit comments

Comments
 (0)