tools/libs/guest: fix max_pfn setting in map_p2m()
authorJuergen Gross <jgross@suse.com>
Fri, 4 Jun 2021 06:02:09 +0000 (08:02 +0200)
committerJulien Grall <jgrall@amazon.com>
Fri, 4 Jun 2021 17:56:46 +0000 (18:56 +0100)
When setting the highest pfn used in the guest, don't subtract 1 from
the value read from the shared_info data. The value read already is
the correct pfn.

Fixes: 91e204d37f449 ("libxc: try to find last used pfn when migrating")
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wl@xen.org>
tools/libs/guest/xg_sr_save_x86_pv.c

index 4964f1f7b8e1ef903191ada130df6b6fd35fa5c1..dae7f2817f725361f36264be3c78a863f29c264a 100644 (file)
@@ -468,7 +468,7 @@ static int map_p2m(struct xc_sr_context *ctx)
 
     ctx->x86.pv.p2m_generation = ~0ULL;
     ctx->x86.pv.max_pfn = GET_FIELD(ctx->x86.pv.shinfo, arch.max_pfn,
-                                    ctx->x86.pv.width) - 1;
+                                    ctx->x86.pv.width);
     p2m_cr3 = GET_FIELD(ctx->x86.pv.shinfo, arch.p2m_cr3, ctx->x86.pv.width);
 
     return p2m_cr3 ? map_p2m_list(ctx, p2m_cr3) : map_p2m_tree(ctx);