Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 0786138c78e79 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/8c07662ec17d3d82e5c53841a1d9e766d3bdbab6.1621273353.git.thomas.lendacky@amd.com

authored by

Tom Lendacky and committed by
Borislav Petkov
fea63d54 d07f6ca9

+18 -18
+18 -18
arch/x86/kernel/sev.c
··· 221 221 return ghcb; 222 222 } 223 223 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 - 242 224 /* Needed in vc_early_forward_exception */ 243 225 void do_early_exception(struct pt_regs *regs, int trapnr); 244 226 ··· 442 460 443 461 /* Include code shared with pre-decompression boot stage */ 444 462 #include "sev-shared.c" 463 + 464 + static __always_inline void sev_es_put_ghcb(struct ghcb_state *state) 465 + { 466 + struct sev_es_runtime_data *data; 467 + struct ghcb *ghcb; 468 + 469 + data = this_cpu_read(runtime_data); 470 + ghcb = &data->ghcb_page; 471 + 472 + if (state->ghcb) { 473 + /* Restore GHCB from Backup */ 474 + *ghcb = *state->ghcb; 475 + data->backup_ghcb_active = false; 476 + state->ghcb = NULL; 477 + } else { 478 + data->ghcb_active = false; 479 + } 480 + } 445 481 446 482 void noinstr __sev_es_nmi_complete(void) 447 483 {