Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2167423rwb; Thu, 17 Nov 2022 07:22:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TopUb40i+yD63TdMEP/oFS/+r+x2fFCsz1guIB9pEV2HH137mWMcGKzO554CPE7wQNX6Y X-Received: by 2002:a63:e411:0:b0:45f:b2a7:2659 with SMTP id a17-20020a63e411000000b0045fb2a72659mr2565184pgi.132.1668698534646; Thu, 17 Nov 2022 07:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668698534; cv=none; d=google.com; s=arc-20160816; b=P0Z+7/NpvNr8RwmSIldtvglgQrju9SBjEJ4LtBdTHQ6HHc0K7V87dUkNCASwMmVxWM yZhRR2YyhytKeDNGnvFvzQUg0HV54aO7E0QafQNJHNHpt4VHNOYCtrVt1+E+YKq+0iTr JokZ8b6ojMpk04Y0Ie1HAI27m1f0dQXKmW/aBklxz2E04WOWC0xFwxHvbY7IN1jIctJ0 izuMiGykycP/UJuhWg73JqdSVMtrIs0E2DmlCHbHwyVPFesgmE4/agdOQsgoNX8ubnP/ QrAd+YcQqqXdiZ5G+5uT9/BPOV5eeo5cNTO0MlFgQF8dFhSTrMUvIfy9RCKHeYMkirf/ /ugg== 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=Frw/bhnQ/fgaTcwMRmhjoEhY2NlH0mLgodVAsiEeP10=; b=QzawRF5wAQvH2Ezv31zl7sO9yB+dClr6K13Gd2ykJ/rVKhWcfmeEdZ7HfJOjo9hZZW 1F4TWvOq9lqlhsDpwpKy0NUcgDohlg/bpM7qylR9TnKCtnsEUyyUnLPsPcXHBRAWy0BI Waj7hhok6C6rUGMBCfcysgvYFysnmoYQP52sjQuRSFtQ9ocYeSCGkHWtlPtad7jiBoOR 9NL6K2GpS2xlJMJlstDb23Fujz43i9XpuzdPoF+lh0fQATybsTCwqDBXejRv8VGjGCbG LiIEjGqdGwe79CY0wtoTpJrlYr1FhfHH3AdYFC/IQbtVBlwm9gpL6F1cwJO8Yy10W+TG wDJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M/egedW2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 133-20020a63038b000000b004403d4f1f70si1209351pgd.455.2022.11.17.07.21.50; Thu, 17 Nov 2022 07:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M/egedW2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240439AbiKQOed (ORCPT + 92 others); Thu, 17 Nov 2022 09:34:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240248AbiKQOeI (ORCPT ); Thu, 17 Nov 2022 09:34:08 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ED7279E36 for ; Thu, 17 Nov 2022 06:33:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668695584; 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=Frw/bhnQ/fgaTcwMRmhjoEhY2NlH0mLgodVAsiEeP10=; b=M/egedW2fnnIy0yipWmUtvABP2vtOkGAO6qEYiDOhmWTslB7Ugruek72D2hacJgiVbALrB Hh092ZfONnzmAYAMzLxErfO8/sg8NVJNpMTp9PLphckw3+Ocv+ny3lzxjiP6Wh6JaGuVtx b9sojq7TQnNBgE5/f7ef2LNx0S1vLLM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-274-CYSwL3jhOAizB5te_RPptQ-1; Thu, 17 Nov 2022 09:32:59 -0500 X-MC-Unique: CYSwL3jhOAizB5te_RPptQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F9D2185A794; Thu, 17 Nov 2022 14:32:58 +0000 (UTC) Received: from amdlaptop.tlv.redhat.com (dhcp-4-238.tlv.redhat.com [10.35.4.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19A852166B29; Thu, 17 Nov 2022 14:32:54 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Paolo Bonzini , Ingo Molnar , "H. Peter Anvin" , Dave Hansen , linux-kernel@vger.kernel.org, Peter Zijlstra , Thomas Gleixner , Sandipan Das , Daniel Sneddon , Jing Liu , Josh Poimboeuf , Wyes Karny , Borislav Petkov , Babu Moger , Pawan Gupta , Sean Christopherson , Jim Mattson , x86@kernel.org, Maxim Levitsky Subject: [PATCH 03/13] KVM: nSVM: rename nested_sync_control_from_vmcb02 to nested_sync_int_ctl_from_vmcb02 Date: Thu, 17 Nov 2022 16:32:32 +0200 Message-Id: <20221117143242.102721-4-mlevitsk@redhat.com> In-Reply-To: <20221117143242.102721-1-mlevitsk@redhat.com> References: <20221117143242.102721-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nested_sync_control_from_vmcb02 name is misleading as there are many fields which are modified by the CPU and need to be written back to vmcb12. This function only copies some int_ctl bits and thecevent_inj* fields. Make it copy only these int_ctl bits and rename the function. Signed-off-by: Maxim Levitsky --- arch/x86/kvm/svm/nested.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 91a51e75717dca..54eb152e2b60b6 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -404,15 +404,13 @@ void nested_copy_vmcb_save_to_cache(struct vcpu_svm *svm, } /* - * Synchronize fields that are written by the processor, so that + * Synchronize int_ctl fields that are written by the processor, so that * they can be copied back into the vmcb12. */ -static void nested_sync_control_from_vmcb02(struct vcpu_svm *svm, +static void nested_sync_int_ctl_from_vmcb02(struct vcpu_svm *svm, struct vmcb *vmcb12) { u32 mask; - vmcb12->control.event_inj = svm->vmcb->control.event_inj; - vmcb12->control.event_inj_err = svm->vmcb->control.event_inj_err; /* Only a few fields of int_ctl are written by the processor. */ mask = V_IRQ_MASK | V_TPR_MASK; @@ -986,7 +984,10 @@ int nested_svm_vmexit(struct vcpu_svm *svm) if (vmcb12->control.exit_code != SVM_EXIT_ERR) nested_save_pending_event_to_vmcb12(svm, vmcb12); - nested_sync_control_from_vmcb02(svm, vmcb12); + nested_sync_int_ctl_from_vmcb02(svm, vmcb12); + + vmcb12->control.event_inj = svm->vmcb->control.event_inj; + vmcb12->control.event_inj_err = svm->vmcb->control.event_inj_err; if (svm->nrips_enabled) vmcb12->control.next_rip = vmcb02->control.next_rip; -- 2.34.3