Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp265342pxy; Wed, 5 May 2021 01:26:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzICHh2YX/SKHo0M3l9XJkgsbCfB9i5YaI7RsGyUdxzWO9Sq2lJJkCWzDNukQhfMKUROcIc X-Received: by 2002:a63:e1d:: with SMTP id d29mr28117712pgl.175.1620203190156; Wed, 05 May 2021 01:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620203190; cv=none; d=google.com; s=arc-20160816; b=G2iCM1JdArP9AAGOnKoH9doqs00Pg8ixjINty/Ibv4InxQiypODmcdD4ywS5f3VgzM raBvkOMMhME+9C3KJl3ljUoNPty+XhRz8IUKgx8qEXV9oIvZsmWsFcfMxE/Ciy61BvW6 610XSEjHEf5ZE7/FxdGJhEs1TYq77fTrEtHtyEuLJyZu80BDFWesJV/tdeRaumhSMPNp vkt3eQOQc7Dm7X/hkxr3nCvDjNQX0OdQOw4GD+c+/V9NgJLDHjUSedWL1p7nNA04sF0L shDrljyEukmdUhVMIYml9xgv0OLYwsZdYpkHNES4ZBFubFSKLWv1JdjiPR/V4g7q56Xw Bowg== 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:date:cc:to:from:subject :message-id:dkim-signature; bh=8wZ6XP6OkIUA9lJMeKzZLCGEWjnWoB/ZPPsPtnXehl4=; b=04SqVxUKlcASfk4TiCOrYK/dkNhmB5NF4q82h24ua7CptYlL4PQP9CXQ/YCQ0W5I34 DvxWn4WWnxFSPFv9GRsen0DAhCnih28cW36EaHP4fLGPk2gca9U9KFPmP+vkrN6mLnB6 CcKlT6EfDhKMkEeznq5xyRsdlTj8dhkm1HrFpr/Ih4Mb+jrs6RjHvxCoH1KzB8bC03lz XBD9DKpWVuwgWXSu0FsXwke4+YGZ8p7AjNPweVx00wqlO/O2PdQXurL1Y+MbbbhqateX yrZnur8gKcF62Vvt1AAHdwtfkUkNkCiFZK6oX/i37dOriQRRj+LzpJ5tBEfM+b7+9mq8 mtBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KK9pdnav; 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 n14si6690287plp.207.2021.05.05.01.26.17; Wed, 05 May 2021 01:26:30 -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=KK9pdnav; 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 S231958AbhEEIZl (ORCPT + 99 others); Wed, 5 May 2021 04:25:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42540 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231636AbhEEIZh (ORCPT ); Wed, 5 May 2021 04:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620203081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8wZ6XP6OkIUA9lJMeKzZLCGEWjnWoB/ZPPsPtnXehl4=; b=KK9pdnavETSJYuOkXahkuTTF5qOZwHMvRg5pBOd+Tbyym7RvHeuZamNXCngqNWZuROvTep WO4fQdY1cNbcQTOmUVfpHDbrvBUmKr0Lo2CXFWJbg5wjTzRe5q4VQ79yNE8VOr8fWh+TlF OAdEAA67pSFmCOIXBhWjlp6ChQsrcSA= 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-498-JEfIPDrIMYmwsIlNDiiB0g-1; Wed, 05 May 2021 04:24:39 -0400 X-MC-Unique: JEfIPDrIMYmwsIlNDiiB0g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6FCF584A5E7; Wed, 5 May 2021 08:24:38 +0000 (UTC) Received: from starship (unknown [10.40.192.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CEFE60C17; Wed, 5 May 2021 08:24:36 +0000 (UTC) Message-ID: <634edad3ff66e3a63bbfd0b1728a29010d3dbff8.camel@redhat.com> Subject: Re: [PATCH 3/4] KVM: nVMX: Introduce __nested_vmx_handle_enlightened_vmptrld() From: Maxim Levitsky To: Vitaly Kuznetsov , kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , linux-kernel@vger.kernel.org Date: Wed, 05 May 2021 11:24:35 +0300 In-Reply-To: <20210503150854.1144255-4-vkuznets@redhat.com> References: <20210503150854.1144255-1-vkuznets@redhat.com> <20210503150854.1144255-4-vkuznets@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-05-03 at 17:08 +0200, Vitaly Kuznetsov wrote: > 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); Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky