Message ID | 20221021153521.1216911-23-vkuznets@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp765647wrr; Fri, 21 Oct 2022 08:40:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oFoTIvWhEt24EHG/81xWwc+6k5jBxwbjVF4eTHZ+i+xD7XikvLxvT3Y2EG9XcJF8L+xpl X-Received: by 2002:a17:906:fe45:b0:791:9624:9e9f with SMTP id wz5-20020a170906fe4500b0079196249e9fmr16122966ejb.86.1666366802158; Fri, 21 Oct 2022 08:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666366802; cv=none; d=google.com; s=arc-20160816; b=XLyLOTFeFXEz0BhU8+EVYtmIBIGzLt4ESyTcgSDHzGZYGbazcX3vA0uqi/fNVGjZyq DH0T47htRXc1W79zPuc+Zggxvyqy7byrh97KTOmqBi40loZmwQ/HwS3gDVg41+anqsqm f5yZNO+cpe4P5pl+NIyUw9SR+R2ezCCG12OBwQk1lgBhdEZDpoeOUm31IFv0jYYj9wCh G1WCnmB/vNCUIzIfkjP9muZ+Atb76PgF6OCXihNJYclkO1JEpCky77FUyKXqrykOq7EW 59TW9IWJRhoOefu4Vq7rJ3+oVvJvJ2RtvFvfsz86Bh9YRQAzpce9eOU6xt76ukvlplUL 8Biw== 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=J44m1zrnsXj2NTYmfLovLeehy4tqB8pplS/SWuroEOI=; b=GX7PTi0N8bj29UUmjXz626/LX3QCK6dg3Tt3CPOOF6ZMbegA4j/sbWElRH1zaqzxUQ LlR+PPTvtSeMTfqEzPlcH8z0DM8rXJ/kDq2VALxbapaqnq+olXFCdJX6QqE/cbuubDwz /5TULKIqsKx7XKRFPAIqxPNkzZa/kymvnTFXp7YU5Q8A6nCHuOr/GiUOd0fAgkckOiIX 28uF6oJrElzmRaz8CSDuvc2756vIiKaRfkvMd9l3aZ2IZ95usy/b+BUkPMc38wamDNNL EUaRwnMP91ICHGtopVpmBBgbdeeJfvQnTXiREgQOhbw1mZDCouGwVnPQcRftPvSQRhTK b13w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="geGVzk/z"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp20-20020a170906c15400b0078ded36fa42si20789736ejc.292.2022.10.21.08.39.35; Fri, 21 Oct 2022 08:40:02 -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="geGVzk/z"; 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 S230477AbiJUPiO (ORCPT <rfc822;mntrajkot1@gmail.com> + 99 others); Fri, 21 Oct 2022 11:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbiJUPgx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Oct 2022 11:36:53 -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 ESMTPS id 4C57A71BD5 for <linux-kernel@vger.kernel.org>; Fri, 21 Oct 2022 08:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666366591; 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=J44m1zrnsXj2NTYmfLovLeehy4tqB8pplS/SWuroEOI=; b=geGVzk/zf6NOZ4naG0xBXBxgBg1TevW8QtRizLfPpRDPArjYUekFxJCf76o9Kk3ORP17oJ 7ZyD3wcNvxsiZXfIdFjHiErPOfjERnc6YqRD517+xKCfoi99m5q0qfF02gnEdXF6fM1TtG fyJyJoiITX9DxN5aXTkL5DkkxnfbvdY= 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-311-EOU0QBEeM1OJNgALsbwhrg-1; Fri, 21 Oct 2022 11:36:27 -0400 X-MC-Unique: EOU0QBEeM1OJNgALsbwhrg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DF1A6886479; Fri, 21 Oct 2022 15:36:19 +0000 (UTC) Received: from ovpn-192-65.brq.redhat.com (ovpn-192-65.brq.redhat.com [10.40.192.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA1DA40CA41F; Fri, 21 Oct 2022 15:36:17 +0000 (UTC) From: Vitaly Kuznetsov <vkuznets@redhat.com> To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com> Cc: Wanpeng Li <wanpengli@tencent.com>, Jim Mattson <jmattson@google.com>, Michael Kelley <mikelley@microsoft.com>, Siddharth Chandrasekaran <sidcha@amazon.de>, Yuan Yao <yuan.yao@linux.intel.com>, Maxim Levitsky <mlevitsk@redhat.com>, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v12 22/46] KVM: x86: hyper-v: Introduce kvm_hv_is_tlb_flush_hcall() Date: Fri, 21 Oct 2022 17:34:57 +0200 Message-Id: <20221021153521.1216911-23-vkuznets@redhat.com> In-Reply-To: <20221021153521.1216911-1-vkuznets@redhat.com> References: <20221021153521.1216911-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.3 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747312235830144514?= X-GMAIL-MSGID: =?utf-8?q?1747312235830144514?= |
Series |
KVM: x86: hyper-v: Fine-grained TLB flush + L2 TLB flush features
|
|
Commit Message
Vitaly Kuznetsov
Oct. 21, 2022, 3:34 p.m. UTC
The newly introduced helper checks whether vCPU is performing a Hyper-V TLB flush hypercall. This is required to filter out L2 TLB flush hypercalls for processing. Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- arch/x86/kvm/hyperv.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h index 8942e8c6c912..5f9c76b45f46 100644 --- a/arch/x86/kvm/hyperv.h +++ b/arch/x86/kvm/hyperv.h @@ -177,6 +177,23 @@ static inline void kvm_hv_vcpu_purge_flush_tlb(struct kvm_vcpu *vcpu) kfifo_reset_out(&tlb_flush_fifo->entries); } +static inline bool kvm_hv_is_tlb_flush_hcall(struct kvm_vcpu *vcpu) +{ + struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(vcpu); + u16 code; + + if (!hv_vcpu) + return false; + + code = is_64_bit_hypercall(vcpu) ? kvm_rcx_read(vcpu) : + kvm_rax_read(vcpu); + + return (code == HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE || + code == HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST || + code == HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX || + code == HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX); +} + int kvm_hv_vcpu_flush_tlb(struct kvm_vcpu *vcpu); #endif