Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1703362ybh; Tue, 14 Jul 2020 05:16:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL5TX4GpYY/c86k5BgzuSq3YZzgFQYxL6H3P5gxADJ84JpBfatEuFfHGtf2NISYKR0sCi5 X-Received: by 2002:aa7:db53:: with SMTP id n19mr4247366edt.338.1594728970315; Tue, 14 Jul 2020 05:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594728970; cv=none; d=google.com; s=arc-20160816; b=G0hLMwIA2Lw5mM7DdmPWTZmQ6gS4etEIUNieivxDK8EYGnWODEbz7wxlsoqQxC7upM xYm0xLZfLBMyGDI0hrGNiDYybhgIJ0oJ3PlEWiurf/zYIacJmCWCv7wJO1syDh7E9QUX qqzDbTBVnpsr8ITk0AmWDgzp/5AGyiauKJ7qIGcEluzFVikHWjHHi+15kSCCb5DwPvt5 GnFvc6JxTUeKTOduCLTZeiAiwJAyXfw1pfMmcC5nHtODyrj9ezQkU5Btxu0FRGyv0msR jPCeNb3F6tENgMsL/NXgNhufwxHLOAjH6/+EWReOkC2j/NYL94Y4LuxePzNr7S0Rc4gI A6rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oTzWKOb7nAAkvybjXnUW7pcBaScORbPc6gmTKHDBDTI=; b=LnCXT/VqYtAbbU8Ta4hu/a0CvzrEKQ1HZ7Rg8FEDE6ebVF7LPCO4Q5TvAlpdyJH0Re lUf8ncbpJPul8t5XE5oF0fvrift00+S1NZSdxTLHKhulZdnapto18ul26HPsjDSo3E2p DQcRhQyJ08mlcuqSLEJKZo/ndscOQAnvufEPIkoEcRc1do1mtSo2FA5EOdhUwLnAIFjZ ZtuQw2Gz2QWPrx3OboLosm8GhCd3uNE7n0Dfp5jwJ9G+WiUEea4+hwWw1et099QPd6nf qhnrU3RQMyoXiucOE5KhpIi4mFJQkOUAmDA0SeF1BtZxs4JqkXXNayiICz12frUBfUQC bDug== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h22si11731236ejf.256.2020.07.14.05.15.45; Tue, 14 Jul 2020 05:16:10 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728562AbgGNMLS (ORCPT + 99 others); Tue, 14 Jul 2020 08:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728502AbgGNMLL (ORCPT ); Tue, 14 Jul 2020 08:11:11 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE26CC061755; Tue, 14 Jul 2020 05:11:10 -0700 (PDT) Received: from cap.home.8bytes.org (p5b006776.dip0.t-ipconnect.de [91.0.103.118]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 696DFFC3; Tue, 14 Jul 2020 14:11:03 +0200 (CEST) From: Joerg Roedel To: x86@kernel.org Cc: Joerg Roedel , Joerg Roedel , Tom Lendacky , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH v4 55/75] x86/sev-es: Handle WBINVD Events Date: Tue, 14 Jul 2020 14:08:57 +0200 Message-Id: <20200714120917.11253-56-joro@8bytes.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714120917.11253-1-joro@8bytes.org> References: <20200714120917.11253-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Lendacky Implement a handler for #VC exceptions caused by WBINVD instructions. Signed-off-by: Tom Lendacky [ jroedel@suse.de: Adapt to #VC handling framework ] Co-developed-by: Joerg Roedel Signed-off-by: Joerg Roedel --- arch/x86/kernel/sev-es.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c index 09738d6fe55e..aa117004fc2e 100644 --- a/arch/x86/kernel/sev-es.c +++ b/arch/x86/kernel/sev-es.c @@ -853,6 +853,12 @@ static enum es_result vc_handle_dr7_read(struct ghcb *ghcb, return ES_OK; } +static enum es_result vc_handle_wbinvd(struct ghcb *ghcb, + struct es_em_ctxt *ctxt) +{ + return sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_WBINVD, 0, 0); +} + static enum es_result vc_handle_exitcode(struct es_em_ctxt *ctxt, struct ghcb *ghcb, unsigned long exit_code) @@ -875,6 +881,9 @@ static enum es_result vc_handle_exitcode(struct es_em_ctxt *ctxt, case SVM_EXIT_MSR: result = vc_handle_msr(ghcb, ctxt); break; + case SVM_EXIT_WBINVD: + result = vc_handle_wbinvd(ghcb, ctxt); + break; case SVM_EXIT_NPF: result = vc_handle_mmio(ghcb, ctxt); break; -- 2.27.0