Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1185340iof; Mon, 6 Jun 2022 23:40:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9mIbxsixu5PupUFeLVtmY4vJsupwH5Ngl4rxwisgFPBvPKFwzEM0kL0iqkWFfYGrXpbLa X-Received: by 2002:a05:6402:348e:b0:42e:2e1a:817c with SMTP id v14-20020a056402348e00b0042e2e1a817cmr24669940edc.23.1654584025385; Mon, 06 Jun 2022 23:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654584025; cv=none; d=google.com; s=arc-20160816; b=kX6uT2hPe3Qrb38XUHoY/P7+Nkg1ZOfUVziaQw25g6Dd+2WsTO00O7zS+svua9TGgD P1xgkVyVQxGy4jB3jlm2UWpLWLEOrVUJ9EdZUupZ9meQjKCU6N0XAsFAotqt5Sy9dGno tpjf984alWXcgnrZ1hkaLq5STwgkpiGDhxsWicxG0TRb/Qq4dJOLUhk739P2w9hhh4tW KmJcRV24lyYZXJlSroKm8QT6Qwlg4t/PbJe2k2ASlnpmS9d27sRchEf4EyMR+66ApGk6 5GkklFORlIcCIXqHlPNJ1pjrEVZtp/s+gnhiXV9XFrzGsLJJ+sUKAqb5dNg/t4WbboRg Qrtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=fvJVapmaiR5ta4tTtII1xFa6y7+0Xioffnfwf7wnw+o=; b=jOkZaulGd+MZVLC5AOnCAcqq0Fglgp2F08EzygVCQGmgO3nsmgkFgRtufbGgZbszF9 fO0eEtZMua0ilD07JvTVoG2tThwegvlTa/BeV6cjg3ynbl6yqrBx8bbEjH8RnEy64hoL gPcSydSu3UGHUDM1TlmENA9UmVKjHoO3DcNnzXH7yXSvoWXwDUfnZn/gbzDSHPBIL0ro acf3z7W80fKqyZk+Y5yO6rltZoHOFudqrEb8YcgKq1g3PEwQxY9ctB+lkLmCQbSvrqRd H/exeVOFx2e00hFI3Xg+V84eIYmc2Zlw7HK+jcwlcW4ufdaT+W/hENP537r77QxHT+Mq DSow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=HwC38GPi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170906794700b006fe8c58b721si13235332ejo.881.2022.06.06.23.39.58; Mon, 06 Jun 2022 23:40:25 -0700 (PDT) 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=@google.com header.s=20210112 header.b=HwC38GPi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235203AbiFFXBu (ORCPT + 99 others); Mon, 6 Jun 2022 19:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235192AbiFFXBs (ORCPT ); Mon, 6 Jun 2022 19:01:48 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F48F9E9E1 for ; Mon, 6 Jun 2022 16:01:47 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-edeb6c3642so21007392fac.3 for ; Mon, 06 Jun 2022 16:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fvJVapmaiR5ta4tTtII1xFa6y7+0Xioffnfwf7wnw+o=; b=HwC38GPisP9Qe5N9Dxjshw2xLsFj/bl7lBR3ynQu0FQ7+euFbaZ4T5LHEJTbtOy9nP BxVGWlZjVH9N61c1ipVWuELIgXqPdtkyFpp5mvrcgbRHH43iQlWFwO3gQt8ZJmCgafGX XbkDBMefGP17Rwm0IO0esP26Irjo99G+nZfW/Y9GtdQXArM9KHm1+qU1rWAkDq+tca8C WcfaNA0aDM1QPVoF0AHIQrQoj1rXtqsxwqzoxJDD7cLFncOZesV0lidUDmsw+2thVrrk 58Px0WoB3DMhAR4Bx5fCtrWY/SSkfvMt7nMO2zI99Ptey5kl5gUXfA9gwoP101qMDhLB tBHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fvJVapmaiR5ta4tTtII1xFa6y7+0Xioffnfwf7wnw+o=; b=RmTx3jXKMv+imMl25yQVKOUMwMUxyJV74pwWSH/xcw6LRaEO5Aw8sQ2a4NFgU4gyn9 TbGoOLaTXt+nV3auYMaCPy9NhFYBYH6zPTtQOq3fOp5HQ08UMEMLg5WAAQJA+6bIXHIP aGIY9M5wC4hGdsOWMIpek5URsu1u5IuyL3kdPTtFHzZgoZAwB/1JNQSDBTBB4EkZ71+x RIpQr3SWlAO7HsYU+clqTiPtD5mrScvaTBuzdI8yslQIV7hGZc8HWk4y9qZCDMj4LEpN Mc893ZP7OnJU2+WivbFk2lsiaqDWe7jTRDzW+1gfO7Kidt+0JgHtY+94qGJoy5NVZZ8s k1HQ== X-Gm-Message-State: AOAM532hZNmpPUDXM7rRCX2LY3PJZwIRm1Whlz+fhuYwiLRjxU51SDt1 uaDTey4l0IGrJeQvO5klseFsWyFzb41iRYU9AH8c5Q== X-Received: by 2002:a05:6870:891f:b0:f3:3811:3e30 with SMTP id i31-20020a056870891f00b000f338113e30mr24252893oao.269.1654556506633; Mon, 06 Jun 2022 16:01:46 -0700 (PDT) MIME-Version: 1.0 References: <20220602142620.3196-1-santosh.shukla@amd.com> In-Reply-To: <20220602142620.3196-1-santosh.shukla@amd.com> From: Jim Mattson Date: Mon, 6 Jun 2022 16:01:35 -0700 Message-ID: Subject: Re: [PATCH 0/7] Virtual NMI feature To: Santosh Shukla Cc: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Joerg Roedel , Tom Lendacky , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 On Thu, Jun 2, 2022 at 7:26 AM Santosh Shukla wrote: > > Currently, NMI is delivered to the guest using the Event Injection > mechanism [1]. The Event Injection mechanism does not block the delivery > of subsequent NMIs. So the Hypervisor needs to track the NMI delivery > and its completion(by intercepting IRET) before sending a new NMI. > > Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the guest > w/o using Event Injection mechanism meaning not required to track the > guest NMI and intercepting the IRET. To achieve that, > VNMI feature provides virtualized NMI and NMI_MASK capability bits in > VMCB intr_control - > V_NMI(11) - Indicates whether a virtual NMI is pending in the guest. > V_NMI_MASK(12) - Indicates whether virtual NMI is masked in the guest. > V_NMI_ENABLE(26) - Enables the NMI virtualization feature for the guest. > > When Hypervisor wants to inject NMI, it will set V_NMI bit, Processor will > clear the V_NMI bit and Set the V_NMI_MASK which means the Guest is > handling NMI, After the guest handled the NMI, The processor will clear > the V_NMI_MASK on the successful completion of IRET instruction > Or if VMEXIT occurs while delivering the virtual NMI. > > To enable the VNMI capability, Hypervisor need to program > V_NMI_ENABLE bit 1. > > The presence of this feature is indicated via the CPUID function > 0x8000000A_EDX[25]. > > Testing - > * Used qemu's `inject_nmi` for testing. > * tested with and w/o AVIC case. > * tested with kvm-unit-test > > Thanks, > Santosh > [1] https://www.amd.com/system/files/TechDocs/40332.pdf - APM Vol2, > ch-15.20 - "Event Injection". > > Santosh Shukla (7): > x86/cpu: Add CPUID feature bit for VNMI > KVM: SVM: Add VNMI bit definition > KVM: SVM: Add VNMI support in get/set_nmi_mask > KVM: SVM: Report NMI not allowed when Guest busy handling VNMI > KVM: SVM: Add VNMI support in inject_nmi > KVM: nSVM: implement nested VNMI > KVM: SVM: Enable VNMI feature > > arch/x86/include/asm/cpufeatures.h | 1 + > arch/x86/include/asm/svm.h | 7 +++++ > arch/x86/kvm/svm/nested.c | 8 +++++ > arch/x86/kvm/svm/svm.c | 47 ++++++++++++++++++++++++++++-- > arch/x86/kvm/svm/svm.h | 1 + > 5 files changed, 62 insertions(+), 2 deletions(-) > > -- > 2.25.1 When will we see vNMI support in silicon? Genoa? Where is this feature officially documented? Is there an AMD64 equivalent of the "Intel Architecture Instruction Set Extensions and Future Features" manual?