Skip to content

Commit fea63d5

Browse files
tlendackysuryasaimadhu
authored andcommitted
x86/sev-es: Move sev_es_put_ghcb() in prep for follow on patch
Move the location of sev_es_put_ghcb() in preparation for an update to it in a follow-on patch. This will better highlight the changes being made to the function. No functional change. Fixes: 0786138 ("x86/sev-es: Add a Runtime #VC Exception Handler") Signed-off-by: Tom Lendacky <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/8c07662ec17d3d82e5c53841a1d9e766d3bdbab6.1621273353.git.thomas.lendacky@amd.com
1 parent d07f6ca commit fea63d5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

arch/x86/kernel/sev.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -221,24 +221,6 @@ static __always_inline struct ghcb *sev_es_get_ghcb(struct ghcb_state *state)
221221
return ghcb;
222222
}
223223

224-
static __always_inline void sev_es_put_ghcb(struct ghcb_state *state)
225-
{
226-
struct sev_es_runtime_data *data;
227-
struct ghcb *ghcb;
228-
229-
data = this_cpu_read(runtime_data);
230-
ghcb = &data->ghcb_page;
231-
232-
if (state->ghcb) {
233-
/* Restore GHCB from Backup */
234-
*ghcb = *state->ghcb;
235-
data->backup_ghcb_active = false;
236-
state->ghcb = NULL;
237-
} else {
238-
data->ghcb_active = false;
239-
}
240-
}
241-
242224
/* Needed in vc_early_forward_exception */
243225
void do_early_exception(struct pt_regs *regs, int trapnr);
244226

@@ -461,6 +443,24 @@ static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt
461443
/* Include code shared with pre-decompression boot stage */
462444
#include "sev-shared.c"
463445

446+
static __always_inline void sev_es_put_ghcb(struct ghcb_state *state)
447+
{
448+
struct sev_es_runtime_data *data;
449+
struct ghcb *ghcb;
450+
451+
data = this_cpu_read(runtime_data);
452+
ghcb = &data->ghcb_page;
453+
454+
if (state->ghcb) {
455+
/* Restore GHCB from Backup */
456+
*ghcb = *state->ghcb;
457+
data->backup_ghcb_active = false;
458+
state->ghcb = NULL;
459+
} else {
460+
data->ghcb_active = false;
461+
}
462+
}
463+
464464
void noinstr __sev_es_nmi_complete(void)
465465
{
466466
struct ghcb_state state;

0 commit comments

Comments
 (0)