Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp768542iof; Mon, 6 Jun 2022 12:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9EvocrCp73j5cTihLLhPMf9+2DT7+7wzsYA8FwNsYXtgaFPnoDspgNBniWoWjOIIb6n1e X-Received: by 2002:a17:90b:3a87:b0:1e8:8740:43e7 with SMTP id om7-20020a17090b3a8700b001e8874043e7mr6267093pjb.41.1654542461433; Mon, 06 Jun 2022 12:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654542461; cv=none; d=google.com; s=arc-20160816; b=pazxb4ldPwbxj6K2fwMeo24w/PRxZwgub6Cxv7GECoOnvGBynY1UFredbT7jfOq8wG xWvQETV1MKctnEPjjXwMI8dkJ+vk8mKZeZjkQqUIYHo21iQN2fmRYsPAclWvLsaInEyE 7k8j6jPE7OFgDhSsPR0FU4Z+LK0HZrSf7CRkN9mMLymgssN93XZf9hmYIo3jtmsbgEGq VxlOpHZGJVisLoTiuZ2QnVE8aSqezJOb52NYH39nVXpMH6TlwsGFW7kVZsZQj5KQRueB xgvabFSkFG0CY1pvu6+2m6BPXUr4uYkUOIOWYDceqEkJOkubRGgA9i6iE9nRJETa1NKg 8hZQ== 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=SPSXt1XSzzkippZ/X9Z436U7ru2Jelf5JT0BkruxIf4=; b=EIGeGNkxKAZmOzZqitwl6ACZEQ9mOZeL0N47+LEHl3J01ZDMcegOIAlPP6tODCo1UD GNbg12KjrFXysJewmUhzmIKAqh1/jHdcbHR7tWa5y0wxUFnhERkClcV4IrPevreCqIjE 1puN4ViTtZDKLyJrWy3qwBa5j0APyRaJFC7JADMD8EHRQ45w1OpfngxLYphRKPmiQ8ia 9vv3A93/Sj/0bd8vKdvOLgAiK0zihtBah784q22Y3zoN9qfJYqbr2i0xUqngZ+QlDj0f VsfoyHHDi5CRQclcTKTjwu402bzewy9tw7V0jwnfyyVmvn8sM/6Znvq4Xbrfo1IVvTak a7QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XZFJkHK/"; 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 q3-20020a170902dac300b00163fc66aa07si24728669plx.9.2022.06.06.12.07.26; Mon, 06 Jun 2022 12:07:41 -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=@redhat.com header.s=mimecast20190719 header.b="XZFJkHK/"; 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 S231204AbiFFSIs (ORCPT + 99 others); Mon, 6 Jun 2022 14:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231183AbiFFSIq (ORCPT ); Mon, 6 Jun 2022 14:08:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 37D21703D1 for ; Mon, 6 Jun 2022 11:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654538924; 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=SPSXt1XSzzkippZ/X9Z436U7ru2Jelf5JT0BkruxIf4=; b=XZFJkHK/R9IweCxubLW8jVvjeEJ+wLRtblD5F+CBjkMg3E0yyJQ89v/OxrB0SWGDWiQn5a V7tkNYXiTM3abWdP4c1c2+Jk99Bem+is1nyrFI1DhSMRSXUUnJqkSBwLwjkdBlvOMq/vlT yRh3RTaUC9M6IqTXVJ7o1nUGZxyT00A= 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-583-bv9FlcHRPKeBOZ_6uK9ObQ-1; Mon, 06 Jun 2022 14:08:39 -0400 X-MC-Unique: bv9FlcHRPKeBOZ_6uK9ObQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 56A19811E75; Mon, 6 Jun 2022 18:08:38 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id E30B11121314; Mon, 6 Jun 2022 18:08:34 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , Jim Mattson , "H. Peter Anvin" , Joerg Roedel , Dave Hansen , Ingo Molnar , Suravee Suthikulpanit , linux-kernel@vger.kernel.org, Maxim Levitsky , Thomas Gleixner , x86@kernel.org, Borislav Petkov , Paolo Bonzini Subject: [PATCH 1/7] KVM: x86: document AVIC/APICv inhibit reasons Date: Mon, 6 Jun 2022 21:08:23 +0300 Message-Id: <20220606180829.102503-2-mlevitsk@redhat.com> In-Reply-To: <20220606180829.102503-1-mlevitsk@redhat.com> References: <20220606180829.102503-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 These days there are too many AVIC/APICv inhibit reasons, and it doesn't hurt to have some documentation for them. Signed-off-by: Maxim Levitsky --- arch/x86/include/asm/kvm_host.h | 59 +++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 6cf5d77d78969..d7fb3ade44501 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1065,14 +1065,69 @@ struct kvm_x86_msr_filter { }; enum kvm_apicv_inhibit { + + /********************************************************************/ + /* INHIBITs that are relevant to both Intel's APICv and AMD's AVIC. */ + /********************************************************************/ + + /* + * APIC acceleration is disabled by a module parameter + * and/or not supported in hardware. + */ APICV_INHIBIT_REASON_DISABLE, + + /* + * APIC acceleration is inhibited because AutoEOI feature is + * being used by a HyperV guest. + */ APICV_INHIBIT_REASON_HYPERV, + + /* + * APIC acceleration is inhibited because the userspace didn't yet + * enable the kernel/split irqchip. + */ + APICV_INHIBIT_REASON_ABSENT, + + /* APIC acceleration is inhibited because KVM_GUESTDBG_BLOCKIRQ + * (out of band, debug measure of blocking all interrupts on this vCPU) + * was enabled, to avoid AVIC/APICv bypassing it. + */ + APICV_INHIBIT_REASON_BLOCKIRQ, + + /******************************************************/ + /* INHIBITs that are relevant only to the AMD's AVIC. */ + /******************************************************/ + + /* + * AVIC is inhibited on a vCPU because it runs a nested guest. + * + * This is needed because unlike APICv, the peers of this vCPU + * cannot use the doorbell mechanism to signal interrupts via AVIC when + * a vCPU runs nested. + */ APICV_INHIBIT_REASON_NESTED, + + /* + * On SVM, the wait for the IRQ window is implemented with pending vIRQ, + * which cannot be injected when the AVIC is enabled, thus AVIC + * is inhibited while KVM waits for IRQ window. + */ APICV_INHIBIT_REASON_IRQWIN, + + /* + * PIT (i8254) 're-inject' mode, relies on EOI intercept, + * which AVIC doesn't support for edge triggered interrupts. + */ APICV_INHIBIT_REASON_PIT_REINJ, + + /* + * AVIC is inhibited because the guest has x2apic in its CPUID. + */ APICV_INHIBIT_REASON_X2APIC, - APICV_INHIBIT_REASON_BLOCKIRQ, - APICV_INHIBIT_REASON_ABSENT, + + /* + * AVIC is disabled because SEV doesn't support it. + */ APICV_INHIBIT_REASON_SEV, }; -- 2.26.3