mirror of https://gitee.com/openkylin/linux.git
KVM: SVM: Add GHCB accessor functions for retrieving fields
Update the GHCB accessor functions to add functions for retrieve GHCB fields by name. Update existing code to use the new accessor functions. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Message-Id: <664172c53a5fb4959914e1a45d88e805649af0ad.1607620209.git.thomas.lendacky@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
916391a2d1
commit
0f60bde15e
|
@ -379,6 +379,16 @@ struct vmcb {
|
|||
(unsigned long *)&ghcb->save.valid_bitmap); \
|
||||
} \
|
||||
\
|
||||
static inline u64 ghcb_get_##field(struct ghcb *ghcb) \
|
||||
{ \
|
||||
return ghcb->save.field; \
|
||||
} \
|
||||
\
|
||||
static inline u64 ghcb_get_##field##_if_valid(struct ghcb *ghcb) \
|
||||
{ \
|
||||
return ghcb_##field##_is_valid(ghcb) ? ghcb->save.field : 0; \
|
||||
} \
|
||||
\
|
||||
static inline void ghcb_set_##field(struct ghcb *ghcb, u64 value) \
|
||||
{ \
|
||||
__set_bit(GHCB_BITMAP_IDX(field), \
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue