@@ -349,15 +349,26 @@ struct vmcb {
#define DEFINE_GHCB_ACCESSORS(field) \
static inline bool ghcb_##field##_is_valid(const struct ghcb *ghcb) \
{ \
+ const struct vmcb_save_area *vmsa = &ghcb->save; \
+ \
return test_bit(GHCB_BITMAP_IDX(field), \
- (unsigned long *)&ghcb->save.valid_bitmap); \
+ (unsigned long *)vmsa->valid_bitmap); \
+ } \
+ \
+ static inline u64 ghcb_get_##field(struct ghcb *ghcb) \
+ { \
+ const struct vmcb_save_area *vmsa = &ghcb->save; \
+ \
+ return vmsa->field; \
} \
\
static inline void ghcb_set_##field(struct ghcb *ghcb, u64 value) \
{ \
+ struct vmcb_save_area *vmsa = &ghcb->save; \
+ \
__set_bit(GHCB_BITMAP_IDX(field), \
(unsigned long *)&ghcb->save.valid_bitmap); \
- ghcb->save.field = value; \
+ vmsa->field = value; \
}
DEFINE_GHCB_ACCESSORS(cpl)
@@ -501,12 +501,12 @@ static bool vmware_sev_es_hcall_finish(struct ghcb *ghcb, struct pt_regs *regs)
ghcb_rbp_is_valid(ghcb)))
return false;
- regs->bx = ghcb->save.rbx;
- regs->cx = ghcb->save.rcx;
- regs->dx = ghcb->save.rdx;
- regs->si = ghcb->save.rsi;
- regs->di = ghcb->save.rdi;
- regs->bp = ghcb->save.rbp;
+ regs->bx = ghcb_get_rbx(ghcb);
+ regs->cx = ghcb_get_rcx(ghcb);
+ regs->dx = ghcb_get_rdx(ghcb);
+ regs->si = ghcb_get_rsi(ghcb);
+ regs->di = ghcb_get_rdi(ghcb);
+ regs->bp = ghcb_get_rbp(ghcb);
return true;
}