Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3542200pxj; Mon, 24 May 2021 09:01:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo3rvpCwfMyudn0u7fHctzIUHWbJTFurWm7ZoNVt4uwRwj443Vuk1tbrldzFjbZ59mwXGU X-Received: by 2002:a5d:6683:: with SMTP id l3mr22512948wru.398.1621872097491; Mon, 24 May 2021 09:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872097; cv=none; d=google.com; s=arc-20160816; b=Mm3IrUYvpvPRUwoVYarzxgXPvWspowZ2XjHHmQNjqvZtnC06mCX15jPKDx0J3sf1jz hkg8A19Jcz1NS3AEp+3HfgOi5BvPsCChYzwlMup5m2jRBUSfQy1hdMT3ORkGi42pMmWd FDsqg9MrkTnEB5fvxLjERrPLoP68FUjrOdr3hKtTOpj11LTZJLWb6Lwy/8WLk1NpK6hQ FhUrN1zYBf41CUkLdZXGuEcNlllRXZXAKv1gCZz9+BjI931HexKGk3OCXqHzHre34ubc vSNFcamLZ/5c70vFHUDK+M9AfQSw+ZwMhwFcxU10RvPL7JrRG4zIxL718GsnuqJIZ/8F YMbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k0j+Hn/WQzLRB5fMI//csmMnt3hzDNvMufZkbQK0ftY=; b=yd9/k4XBZUdkv76v9qQwRuV3v8ZR2+naQQTUG5JPemdYlohx+mE1k8a7Ga7NLwm8Qb UO8GnoemzW55y0IXySqD5R/2uK2DPI1PBMWr4uGmLph7KquQJKGF7i6BoK50HMc6ZmzA MmMAh8xJ74j7Bq3qL4WWYZnh7R8PjiJeGZx9LF3WVUOrgN2dROl8Urt32frEjEdzJ/o9 bFm8a/08SlZ9Pj1d5M/YsIuCSqgilh7Pz9aCIyOWVN5F/Xtg0pHixpr6lfUMqX1Rh/Ec Cy7oRgy1PuI3Zfs86iaG3flCkoON+nJLCe5tjwqND/MNZUlL/k6VDTA/eP9NvM97zmW6 KxNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DwyZvqo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id le4si12576277ejc.650.2021.05.24.09.01.12; Mon, 24 May 2021 09:01:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DwyZvqo0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235535AbhEXQBs (ORCPT + 99 others); Mon, 24 May 2021 12:01:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234318AbhEXPz2 (ORCPT ); Mon, 24 May 2021 11:55:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A8DE613FC; Mon, 24 May 2021 15:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870907; bh=i4wAM3elN/z5Vsa8a3mnqbLfx3fRITuI3zFmbTOua8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DwyZvqo0Bq7Smx1Aza6kzsYWa+xR1ReWFlUKzuVQYdGfb3K0sME5mcIEBiMh3oMNL kQQxnpUs/ajYjJdmBlfhlunRjMylgEhEcirFlgWsGuSKeKsys/2+jd7835oOCyCWg8 B8ZxqQtWZE+R8ZOfigpbMoAnK/loWxxCIr5XX9rw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Borislav Petkov Subject: [PATCH 5.10 055/104] x86/sev-es: Move sev_es_put_ghcb() in prep for follow on patch Date: Mon, 24 May 2021 17:25:50 +0200 Message-Id: <20210524152334.676899619@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Lendacky commit fea63d54f7a3e74f8ab489a8b82413a29849a594 upstream. 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 Signed-off-by: Borislav Petkov Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/8c07662ec17d3d82e5c53841a1d9e766d3bdbab6.1621273353.git.thomas.lendacky@amd.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/sev-es.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) --- a/arch/x86/kernel/sev-es.c +++ b/arch/x86/kernel/sev-es.c @@ -209,24 +209,6 @@ static __always_inline struct ghcb *sev_ return ghcb; } -static __always_inline void sev_es_put_ghcb(struct ghcb_state *state) -{ - struct sev_es_runtime_data *data; - struct ghcb *ghcb; - - data = this_cpu_read(runtime_data); - ghcb = &data->ghcb_page; - - if (state->ghcb) { - /* Restore GHCB from Backup */ - *ghcb = *state->ghcb; - data->backup_ghcb_active = false; - state->ghcb = NULL; - } else { - data->ghcb_active = false; - } -} - /* Needed in vc_early_forward_exception */ void do_early_exception(struct pt_regs *regs, int trapnr); @@ -434,6 +416,24 @@ static enum es_result vc_slow_virt_to_ph /* Include code shared with pre-decompression boot stage */ #include "sev-es-shared.c" +static __always_inline void sev_es_put_ghcb(struct ghcb_state *state) +{ + struct sev_es_runtime_data *data; + struct ghcb *ghcb; + + data = this_cpu_read(runtime_data); + ghcb = &data->ghcb_page; + + if (state->ghcb) { + /* Restore GHCB from Backup */ + *ghcb = *state->ghcb; + data->backup_ghcb_active = false; + state->ghcb = NULL; + } else { + data->ghcb_active = false; + } +} + void noinstr __sev_es_nmi_complete(void) { struct ghcb_state state;