On 17/03/20 21:05, Krish Sadhukhan wrote: > Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> > --- > x86/svm.c | 16 ++++++++++++++++ > x86/svm.h | 2 ++ > 2 files changed, 18 insertions(+) I prefer to just make vmcb public in svm.h. Please check kvm-unit-tests.git's master branch and kvm.git's queue branch. Thanks for contributing to nested SVM tests as well! Paolo > diff --git a/x86/svm.c b/x86/svm.c > index 7ce33a6..3803032 100644 > --- a/x86/svm.c > +++ b/x86/svm.c > @@ -233,6 +233,22 @@ int svm_vmrun(void) > return (vmcb->control.exit_code); > } > > +u64 vmcb_save_read64(size_t offset) > +{ > + u64 *ptr = (u64 *) ((char *) vmcb + offsetof(struct vmcb, save) + > + offset); > + > + return (*ptr); > +} > + > +void vmcb_save_write64(size_t offset, u64 value) > +{ > + u64 *ptr = (u64 *) ((char *) vmcb + offsetof(struct vmcb, save) + > + offset); > + > + *ptr = value; > +} > + > static void test_run(struct svm_test *test) > { > u64 vmcb_phys = virt_to_phys(vmcb); > diff --git a/x86/svm.h b/x86/svm.h > index 25514de..3a6af6e 100644 > --- a/x86/svm.h > +++ b/x86/svm.h > @@ -380,5 +380,7 @@ struct regs get_regs(void); > void vmmcall(void); > int svm_vmrun(void); > void test_set_guest(test_guest_func func); > +u64 vmcb_save_read64(size_t offset); > +void vmcb_save_write64(size_t offset, u64 value); > > #endif >