From bc80de986bda1b891a1106badf87587bb92dbbb3 Mon Sep 17 00:00:00 2001 From: Dorian Eikenberg Date: Thu, 9 Nov 2023 11:19:18 +0100 Subject: [PATCH] libkvmi: add view parameter to kvmi_change_gfn --- include/libkvmi.h | 2 +- include/linux/kvmi.h | 3 +++ src/kvmi.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/libkvmi.h b/include/libkvmi.h index 9341602..de7a43e 100644 --- a/include/libkvmi.h +++ b/include/libkvmi.h @@ -143,7 +143,7 @@ int kvmi_get_ept_view( void *dom, unsigned short vcpu, unsigned short *view int kvmi_control_ept_view( void *dom, unsigned short vcpu, unsigned short view, bool visible ); bool kvmi_remote_mapping_v2( void ); size_t kvmi_get_pending_events( void *dom ); -int kvmi_change_gfn( void *dom, unsigned short vcpu, __u64 old_gfn, __u64 new_gfn ); +int kvmi_change_gfn( void *dom, unsigned short vcpu, unsigned short view, __u64 old_gfn, __u64 new_gfn ); int kvmi_alloc_gfn( void *dom, __u64 gfn ); int kvmi_free_gfn( void *dom, __u64 gfn ); diff --git a/include/linux/kvmi.h b/include/linux/kvmi.h index fa799f5..5e2827f 100644 --- a/include/linux/kvmi.h +++ b/include/linux/kvmi.h @@ -343,6 +343,9 @@ struct kvmi_vcpu_translate_gva_reply { }; struct kvmi_vcpu_change_gfn { + __u16 view; + __u16 padding1; + __u32 padding2; __u64 old_gfn; __u64 new_gfn; }; diff --git a/src/kvmi.c b/src/kvmi.c index deec18e..b22c2a6 100644 --- a/src/kvmi.c +++ b/src/kvmi.c @@ -2705,12 +2705,12 @@ int kvmi_translate_gva( void *dom, unsigned short vcpu, __u64 gva, __u64 *gpa ) return err; } -int kvmi_change_gfn( void *dom, unsigned short vcpu, __u64 old_gfn, __u64 new_gfn ) +int kvmi_change_gfn( void *dom, unsigned short vcpu, unsigned short view, __u64 old_gfn, __u64 new_gfn ) { struct { struct kvmi_vcpu_hdr vcpu; struct kvmi_vcpu_change_gfn cmd; - } req = { .vcpu = { .vcpu = vcpu }, .cmd = { .old_gfn = old_gfn, .new_gfn = new_gfn } }; + } req = { .vcpu = { .vcpu = vcpu }, .cmd = { .view = view, .old_gfn = old_gfn, .new_gfn = new_gfn } }; return request( dom, KVMI_VCPU_CHANGE_GFN, &req, sizeof( req ), NULL, NULL ); }