Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1702110ybh; Tue, 14 Jul 2020 05:14:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRkzfatdw83/8B7637PpS1g8JBecPM8SVBaAB7a9eS8nDN57+btb/Asfe68ptiwxCv8Feq X-Received: by 2002:a17:907:42d0:: with SMTP id nz24mr4463514ejb.135.1594728856903; Tue, 14 Jul 2020 05:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594728856; cv=none; d=google.com; s=arc-20160816; b=UEi7QcumIEEyij/AIaI1lOiYhZn8tN1M2l21bvBnAlRGnVXCUPQXcndCWu9e7ooTNb XGF4xhM9pbCAz3urtF/JHktJmLSakjH+XtjbKvGOFZYsOnO2/Xcm+WW+o7V2JhsDJh7m olytGdX+YDAFLwpRuWylBmlc5SMJ/5uGc/uAjpCFkl7zsWJSnWTyC7nYPsUgp3Su9HpC 2XvS6i0+P2Mlvr142pMCdUTsfJg+drcz1HGcCJlrcdeZHkmvIwxlCoX3J2HHpnnf21eD nk6Pi8b0almv+xFF8VJkFs27i256vF5NVmQ3hJ7J3JY3hu2DGHXp7F8+ti/jlvu6a2Wm BKqw== 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=Wt1XxSEaYLGFMZ8mHI8Gdc5vMrgvTCYws1NngOednCI=; b=B4TzOdyNQzik8bEtYNeZzsESmOACEw5tCMlHJhTWQJ66VGJO3WTeNGnXdv5QKGUmTY B2Vz6j09rm+skDGNVfBcVjo7zZI9xtPdM9ARyqHCfNTrDx7IyLnKAKd4c6QR3ts4oH2G rzQ+hfXByyW14IoggkkvGKM8m+p41lNIRUdKi6mIIzGo6SqJswfxCR9k/1l1sSM2pK9Q m34wbVUlfuW5TIHClYCFUVSGfRWHRCGqOCnjatyFKUCYHQkm1sdlgV6CMV6ZwFdBqptQ xFMDAMvlyvU08JuL+va9l80O8iFE6uHrO25phsDtl9rurbUoBJ7xDz9vdCZlEtPTqASp k37w== 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 p1si10996723edm.302.2020.07.14.05.13.52; Tue, 14 Jul 2020 05:14:16 -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 S1728828AbgGNMMv (ORCPT + 99 others); Tue, 14 Jul 2020 08:12:51 -0400 Received: from 8bytes.org ([81.169.241.247]:52886 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728530AbgGNMLN (ORCPT ); Tue, 14 Jul 2020 08:11:13 -0400 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 33239FD7; Tue, 14 Jul 2020 14:11:06 +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 60/75] x86/sev-es: Handle MWAIT/MWAITX Events Date: Tue, 14 Jul 2020 14:09:02 +0200 Message-Id: <20200714120917.11253-61-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 MWAIT and MWAITX instructions. Signed-off-by: Tom Lendacky [ jroedel@suse.de: Adapt to #VC handling infrastructure ] Co-developed-by: Joerg Roedel Signed-off-by: Joerg Roedel --- arch/x86/kernel/sev-es.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/sev-es.c b/arch/x86/kernel/sev-es.c index c0977bdc400e..541f8994eb21 100644 --- a/arch/x86/kernel/sev-es.c +++ b/arch/x86/kernel/sev-es.c @@ -888,6 +888,13 @@ static enum es_result vc_handle_monitor(struct ghcb *ghcb, return ES_OK; } +static enum es_result vc_handle_mwait(struct ghcb *ghcb, + struct es_em_ctxt *ctxt) +{ + /* Treat the same as MONITOR/MONITORX */ + return ES_OK; +} + static enum es_result vc_handle_exitcode(struct es_em_ctxt *ctxt, struct ghcb *ghcb, unsigned long exit_code) @@ -927,6 +934,9 @@ static enum es_result vc_handle_exitcode(struct es_em_ctxt *ctxt, case SVM_EXIT_MONITOR: result = vc_handle_monitor(ghcb, ctxt); break; + case SVM_EXIT_MWAIT: + result = vc_handle_mwait(ghcb, ctxt); + break; case SVM_EXIT_NPF: result = vc_handle_mmio(ghcb, ctxt); break; -- 2.27.0