Commit 0f60bde1 authored by Tom Lendacky's avatar Tom Lendacky Committed by Paolo Bonzini

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: default avatarTom Lendacky <thomas.lendacky@amd.com>
Message-Id: <664172c53a5fb4959914e1a45d88e805649af0ad.1607620209.git.thomas.lendacky@amd.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 916391a2
...@@ -379,6 +379,16 @@ struct vmcb { ...@@ -379,6 +379,16 @@ struct vmcb {
(unsigned long *)&ghcb->save.valid_bitmap); \ (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) \ static inline void ghcb_set_##field(struct ghcb *ghcb, u64 value) \
{ \ { \
__set_bit(GHCB_BITMAP_IDX(field), \ __set_bit(GHCB_BITMAP_IDX(field), \
......
...@@ -501,12 +501,12 @@ static bool vmware_sev_es_hcall_finish(struct ghcb *ghcb, struct pt_regs *regs) ...@@ -501,12 +501,12 @@ static bool vmware_sev_es_hcall_finish(struct ghcb *ghcb, struct pt_regs *regs)
ghcb_rbp_is_valid(ghcb))) ghcb_rbp_is_valid(ghcb)))
return false; return false;
regs->bx = ghcb->save.rbx; regs->bx = ghcb_get_rbx(ghcb);
regs->cx = ghcb->save.rcx; regs->cx = ghcb_get_rcx(ghcb);
regs->dx = ghcb->save.rdx; regs->dx = ghcb_get_rdx(ghcb);
regs->si = ghcb->save.rsi; regs->si = ghcb_get_rsi(ghcb);
regs->di = ghcb->save.rdi; regs->di = ghcb_get_rdi(ghcb);
regs->bp = ghcb->save.rbp; regs->bp = ghcb_get_rbp(ghcb);
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment