Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2933476pxy; Mon, 3 May 2021 11:11:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf0NSSIMH4TUJNpwIYMyO2ZkDjoho8qbvmxEO1YwYpYSJH04G8KrwiNbNkxqt3Ot81tu16 X-Received: by 2002:a17:902:7882:b029:ee:afd8:7586 with SMTP id q2-20020a1709027882b02900eeafd87586mr15459457pll.20.1620065465939; Mon, 03 May 2021 11:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065465; cv=none; d=google.com; s=arc-20160816; b=RLaiKDnSF2EIssCEPlxOj/qsGunLgqQqxSTH0I6DLixTN9ZUBT37BeMG9BQPwmI75o aCh46W+aEi+9EPkDxxurF6Amz3Xt9os4RU2+KUZzuAgYk/yd7UxtZHi0UpS6/VoG2nnp 4kYL4p2G/jWep2HBmXbh/fRmkfNj2d4Y0NAQB2bYNHqKUi11p1VEqSvpCMHubjT/s8oJ axNoiTiU0iwUv2Zwvm7zxGZagH697wqNKrTblf2cslILKCSRhDNSd75lp8QVesucjNl2 76uOXTEItHQtw+i+OOCwO3JJnNEZj+7QL+LmOERt3Oqi1sosECMrQ8GcdTytnuRlqW0r zwdQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SBgP2q+jMXRjW+m5Dci4J74cvlT/I0xwnXsUOeHMQjA=; b=n4IUeqdrDH4AGxQr83JuLmPUYLHjR205zShOaMRrUmAwJSg6RQub3LLgoJP3Vx2Psm qhwEPF6BRZHzyzb28ae8AwGfqJ1ij6c4dXjm5a4xKmeBfcR498Z8KJJb/nyi6PeXVYPw US97yjwBo/9K2CZT0MkL1+ZF+olLPMtVwhXXsmbit0HFZ5RbBAVK5sbUuSXNnDsEVRVV pJ2ZPbpGV0fEzhkkJmfdg3fex04R8Qd8xfHwCkni9SDLfVRP/hbhHpNwDSMSY9jqNIPW QJli15at1eeRwfxGz/mq0voM5u+Bi4aTBjxMptnpwuhTIGeRaTqLmxSFEBuBoPV2t86K 48ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IpeIaA7+; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si5561329pjt.40.2021.05.03.11.10.52; Mon, 03 May 2021 11:11:05 -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=@redhat.com header.s=mimecast20190719 header.b=IpeIaA7+; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbhECPKM (ORCPT + 99 others); Mon, 3 May 2021 11:10:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25942 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbhECPKC (ORCPT ); Mon, 3 May 2021 11:10:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620054548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SBgP2q+jMXRjW+m5Dci4J74cvlT/I0xwnXsUOeHMQjA=; b=IpeIaA7+JOmKimIynNNrEOywMoWHLWvYBe9V5taCp4au/yZ2QtD8DNbx+fuW3Rus/A48XJ i63X5h4sEdmc0ECam35vFvBtmf50saHj2wV12A/jndCkRvFsZiwdS7rm6nFMKuemj4wFAg jSp4pqCClOHkWW0dbMVz54Ev/8Vjglc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-Z_JRf-feNcCjMWrnSnpyIA-1; Mon, 03 May 2021 11:09:06 -0400 X-MC-Unique: Z_JRf-feNcCjMWrnSnpyIA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC6621006708; Mon, 3 May 2021 15:09:05 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.40.194.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B57F19C45; Mon, 3 May 2021 15:09:03 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Maxim Levitsky , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] KVM: nVMX: Introduce __nested_vmx_handle_enlightened_vmptrld() Date: Mon, 3 May 2021 17:08:53 +0200 Message-Id: <20210503150854.1144255-4-vkuznets@redhat.com> In-Reply-To: <20210503150854.1144255-1-vkuznets@redhat.com> References: <20210503150854.1144255-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As a preparation to mapping eVMCS from vmx_set_nested_state() split the actual eVMCS mappign from aquiring eVMCS GPA. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/vmx/nested.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 2febb1dd68e8..37fdc34f7afc 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -1972,18 +1972,11 @@ static int copy_vmcs12_to_enlightened(struct vcpu_vmx *vmx) * This is an equivalent of the nested hypervisor executing the vmptrld * instruction. */ -static enum nested_evmptrld_status nested_vmx_handle_enlightened_vmptrld( - struct kvm_vcpu *vcpu, bool from_launch) +static enum nested_evmptrld_status __nested_vmx_handle_enlightened_vmptrld( + struct kvm_vcpu *vcpu, u64 evmcs_gpa, bool from_launch) { struct vcpu_vmx *vmx = to_vmx(vcpu); bool evmcs_gpa_changed = false; - u64 evmcs_gpa; - - if (likely(!vmx->nested.enlightened_vmcs_enabled)) - return EVMPTRLD_DISABLED; - - if (!nested_enlightened_vmentry(vcpu, &evmcs_gpa)) - return EVMPTRLD_DISABLED; if (unlikely(!vmx->nested.hv_evmcs || evmcs_gpa != vmx->nested.hv_evmcs_vmptr)) { @@ -2055,6 +2048,21 @@ static enum nested_evmptrld_status nested_vmx_handle_enlightened_vmptrld( return EVMPTRLD_SUCCEEDED; } +static enum nested_evmptrld_status nested_vmx_handle_enlightened_vmptrld( + struct kvm_vcpu *vcpu, bool from_launch) +{ + struct vcpu_vmx *vmx = to_vmx(vcpu); + u64 evmcs_gpa; + + if (likely(!vmx->nested.enlightened_vmcs_enabled)) + return EVMPTRLD_DISABLED; + + if (!nested_enlightened_vmentry(vcpu, &evmcs_gpa)) + return EVMPTRLD_DISABLED; + + return __nested_vmx_handle_enlightened_vmptrld(vcpu, evmcs_gpa, from_launch); +} + void nested_sync_vmcs12_to_shadow(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); -- 2.30.2