Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2168559rwb; Thu, 17 Nov 2022 07:23:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf50eY4cn9qd0gBvS8jPt+2VUusVXrC4Q3MIAiGyypD47bt3Pzi5T4VKX4bKwR74n14RtePM X-Received: by 2002:a63:f254:0:b0:456:4f9a:fbb6 with SMTP id d20-20020a63f254000000b004564f9afbb6mr2504206pgk.318.1668698583304; Thu, 17 Nov 2022 07:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668698583; cv=none; d=google.com; s=arc-20160816; b=P6VK0UzOz4oszHdc2vKGcYi3XzZ8Yo8Laj64FE5qLmXVx9p1yctDzKQNdjSUIML25u 7IY/Cc6ZoK8JYHyZkZYTF5iSK7QrSSE/oZNW6qDrUROXBCpO/EvY+BsEXQ+dksdj+3qC mqwKoEOdxiebtLQ5u9/SVTPmoqvxt9QdrJMPujUIiuJj//Kib9nXOpq2ox2Gsr9BnZxx WWuSojwJ7wMee3n77W+1gEHO+oUtHY8xY7zxLksGho4JHxFzXzikvqpkaqvLLknS2xJn 4s1FsjZ3o4vX9FN9dcW9He6EjyvigAuSK7qpNhqmZBQgqhi7qpQUoAu4B8hF/t8Za+DF zhZg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=lbVyA8e03/oayhLH0NTwSULaemKUfym9WQ80/S7gmjE=; b=ROFrCJlWvMYWopOG36E1FnLlxRBYVtJu9cJd0qNdYKRToUPkYTugXa3wossWk9nTZN 5RSqW2Qq4Apm2KCm/BEsd6CbXaIZmA2Y9Fnf1wM/FR95wLJ6ekPCFP50BMc+2kd/s4zm tI3nt+LHkM4D/uhEKnGKbuSE5aQiPt7qAZUV7nApIaqy99WIbYdYOZfxz3+4hItAStZ8 WaTIdQdB/tFMjPM23r+f6lYWrzI35G/fRJ+9S4ZbuA453dIJ2aqJsyEXcg7Uu4YA/dxn aij3j0HcQr0XH9rLDbP148V1GDOcqJq1aFhVU4jtjB4k6y3jzL/h122U0YDVG2xahIXi Zjew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VmGpBY5Z; 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 n4-20020a170902d2c400b00186b287bd57si1296696plc.190.2022.11.17.07.22.49; Thu, 17 Nov 2022 07:23:03 -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=VmGpBY5Z; 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 S240338AbiKQOeI (ORCPT + 92 others); Thu, 17 Nov 2022 09:34:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239977AbiKQOdt (ORCPT ); Thu, 17 Nov 2022 09:33:49 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5C57720D for ; Thu, 17 Nov 2022 06:32:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668695574; 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; bh=lbVyA8e03/oayhLH0NTwSULaemKUfym9WQ80/S7gmjE=; b=VmGpBY5Zb39Te2De3CUjIguLByth9+l2tjUufTC4E74jWvR/WKmKUfjJgwo/+4mvO35T1J vDRGLiiRObjJXg5oLw1xC1e6kdxLn0DO6Ft20iXLa3pSA/GUTp/6a3+wbv9qjYDOtrjumg j36SwKukWIAs9Am2V5kiJItzI8516r0= 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-79-IWHx6XvEM62PLM7C-VCOpw-1; Thu, 17 Nov 2022 09:32:48 -0500 X-MC-Unique: IWHx6XvEM62PLM7C-VCOpw-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 7AD0F85A5A6; Thu, 17 Nov 2022 14:32:47 +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 DCC2A2166B29; Thu, 17 Nov 2022 14:32:43 +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 00/13] SVM: vNMI (with my fixes) Date: Thu, 17 Nov 2022 16:32:29 +0200 Message-Id: <20221117143242.102721-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Hi!=0D =0D This is the vNMI patch series from Santosh Shukla with few=0D small fixes from me:=0D =0D 1. When a vNMI injection is pending, then to allow to not=0D delay for an unbounded time the injection of another NMI that could=0D arrive before the first vNMI injection is done, I added the code=0D that would intercept IRET/RSM/STGI and then try the injection again.=0D =0D 2. I slighlty modified the 'KVM: SVM: Add VNMI support in get/set_nmi_mask'= =0D to have WARN_ON in vNMI functions when called without vNMI enabled.=0D Also NMI mask/unmask should be allowed regardless if SMM is active,=0D to support migration.=0D =0D 3. I did some refactoring in the code which updates the int_ctl in vmcb12=0D on nested VM exit, and updated the patch 'KVM: nSVM: implement nested VN= MI'=0D to use this.=0D =0D 4. I added my reviewed-by to all the patches which I didn't change.=0D =0D I only tested this on a machine which doesn't have vNMI, so this does need= =0D some testing to ensure that nothing is broken.=0D =0D Another thing I haven't looked at in depth yet is migration, I think there = is a bug=0D because with vNMI, now in practise we can have 2 NMIs injected to the guest= ,=0D one in service, one 'pending injection' but no longer pending from KVM poin= t of view,=0D and the KVM doesn't take this in account in kvm_vcpu_ioctl_x86_get_vcpu_eve= nts,a=0D and maybe more.=0D =0D Best regards,=0D Maxim Levitsky=0D =0D Maxim Levitsky (5):=0D KVM: nSVM: don't sync back tlb_ctl on nested VM exit=0D KVM: nSVM: don't call nested_sync_control_from_vmcb02 on each VM exit=0D KVM: nSVM: rename nested_sync_control_from_vmcb02 to=0D nested_sync_int_ctl_from_vmcb02=0D KVM: nSVM: clean up copying of int_ctl fields back to vmcb01/vmcb12=0D KVM: SVM: allow NMI window with vNMI=0D =0D Santosh Shukla (8):=0D x86/cpu: Add CPUID feature bit for VNMI=0D KVM: SVM: Add VNMI bit definition=0D KVM: SVM: Add VNMI support in get/set_nmi_mask=0D KVM: SVM: Report NMI not allowed when Guest busy handling VNMI=0D KVM: SVM: Add VNMI support in inject_nmi=0D KVM: nSVM: implement nested VNMI=0D KVM: nSVM: emulate VMEXIT_INVALID case for nested VNMI=0D KVM: SVM: Enable VNMI feature=0D =0D arch/x86/include/asm/cpufeatures.h | 1 +=0D arch/x86/include/asm/svm.h | 7 +++=0D arch/x86/kvm/svm/nested.c | 84 +++++++++++++++++++++---------=0D arch/x86/kvm/svm/svm.c | 60 ++++++++++++++++++---=0D arch/x86/kvm/svm/svm.h | 70 ++++++++++++++++++++++++-=0D 5 files changed, 189 insertions(+), 33 deletions(-)=0D =0D -- =0D 2.34.3=0D =0D