Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3550353pxj; Mon, 24 May 2021 09:10:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSkkXLjlsV8T8FKhaAFbcfXIMIlfavZHBEjb5e4Yb8APqn0XBhwBTduLROFWynPEFyBILX X-Received: by 2002:a05:6638:22b4:: with SMTP id z20mr24545731jas.128.1621872615167; Mon, 24 May 2021 09:10:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872615; cv=none; d=google.com; s=arc-20160816; b=e826cBATgkDYpsBszuvFRBxMv1lGZk/3IsKLjzXNR7n5AWImW9rzB61Vs3R8Zb9/pm JLX6m03jyMXMtP8L+boN0BJBhWZEk40qxiIRgbUWIH5+stRGbh4okpj+3dDwm3jk3Q9P /cmm7oOE4RsAcLBUBRWoXBGt7DFFk1SstsWBLAa99sGHnsOcVXWB5b3mcLgZ0xqsZJtq 2eva9d+Q/zlOZNYr4J4jmSAVD+/d5h0tvf998tmlHUajbhz/RFl8+KmpJpJ+7OAwas2+ 8b65uhaFUbSWohss3aHHV9GkJnigEjMtjJEkO1tcDPvcuCjJtg6Yk6ltqAJQE7Jz8U+7 C29Q== 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=kJTxv4C2RAvdBoa7xfXvD/7Ne+3y+/zb2HlzkrZncbtzr37ssmuHg5RbeeOhi20Mbm 2jZSgRhcmi0ec+NWwaPBw+d032qkYz/YUjO6pvXW2wVbA2QahvBvRqTn9uwfj6tKpLK0 u+nz6RDdy44lr9rxRRlqjh86DhTvok4fFQzRSVb4wka+srEfzI4fKnM4aF2MxZNfGDaQ pMN3oDDB+uFwjNMwB1Tdfaeh81Dw96869BgFOXCBrfcxmrgshmlAoV4gFn4h/WqWxmDb Gifaiefm6ZuS0wXr/g/4XNeQkBmjE0FPnkIKZRKfJ1lZcmEw1nL0Qh4ogkAeUMfyKW81 CUfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ExB38X0p; 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 y3si1165997jad.12.2021.05.24.09.10.01; Mon, 24 May 2021 09:10:15 -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=ExB38X0p; 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 S236746AbhEXQIR (ORCPT + 99 others); Mon, 24 May 2021 12:08:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:46886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234649AbhEXQAQ (ORCPT ); Mon, 24 May 2021 12:00:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AEF2B6198D; Mon, 24 May 2021 15:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871166; bh=i4wAM3elN/z5Vsa8a3mnqbLfx3fRITuI3zFmbTOua8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ExB38X0pB1792kKpLSm6teNWKbwekWnlJyobP1nYgkEjh1j28keGeMabYreqiuDvQ bycq/tN4dYLvgjnXjd4FQzlVyC1WOHzJcj+nRurs+OsfcvOZHJhMvkoKsBTmOcU4OF DBHtYllSmdp2CnUACHUfFvQ3I7EzDvBJ1RG9Y8+g= 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.12 069/127] x86/sev-es: Move sev_es_put_ghcb() in prep for follow on patch Date: Mon, 24 May 2021 17:26:26 +0200 Message-Id: <20210524152337.182851186@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@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;