Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp481481rwb; Tue, 4 Oct 2022 06:45:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tBwkDs6WJ7Im7tZfLhHXb1ZwaVbd6w8dtL0TNK90oimWbSrK7OrM7yOJF2ugjFqgnm9be X-Received: by 2002:a17:907:2c77:b0:77c:59aa:c011 with SMTP id ib23-20020a1709072c7700b0077c59aac011mr19848107ejc.724.1664891114144; Tue, 04 Oct 2022 06:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664891114; cv=none; d=google.com; s=arc-20160816; b=DA78s6818Q4OrkdOPopxi8g2ir08pmanMEzQT4Mvg4UtPCuXLL3mGO4bEqy/YllRpo AFGcwJtsLFM4b0hKoHf4VcldEctU64+g4zJSnwmYfHR3dW9PP2JewaWg0LkX6xwIQoBd 6XQCfBut3ixDu8jJ9RWhpo+QkDD0negx6FQStt9ykiEZM6Z3mIkzPFkCMd2f2sw1wdcm V9qVWkHbev5FrA6qTU5mmshoaW51tuQHv08duQyxjykxeZzl2TimgTnpC3MZ0Sl7swsq t9D7z1jMnKb7t6FDNTE5YD2JaIliN4hUBXhI9HRG0D7o/ThbBHj47I27vxPJhszm7TI3 35BQ== 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=eZGxgt0oprjgv5pOjok2Bjxxb0EJF9XEOurD7XpaAr4=; b=jpRN28CGNVnmF5dwucGtn/UpSq2RFdHCytybH0DBoXxLrtsYtLiAn7mcojilXVqQ93 0PXR3YOZ/7enW9xGmgsH2NtBQwPCSWHltOTo1cXx5q6JGWGwy14zAUzLIGBAAB/JjKdd RxXclPgIrq6LTfkB8Fo6z8qhRyk3RyaOqNEH5ftlYrT1U5Q+AIxDWjX/EJUq9Fe0ankz gi5zpTd14oSDJlH5nwt98fTb0iTIZTWEAulKYHDzY7lKf2MsKKvoHL8DtCAUyJlf/5Na 1n1Zo4qB0ao0seTRR9EurfcpzA+iI5Dzk6wPCHQwqhnDerTe1sMBKx07IZzu38+y1Fjq xLmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="hJ/ozjh+"; 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 r7-20020aa7d147000000b0044ce972297bsi1989417edo.561.2022.10.04.06.44.49; Tue, 04 Oct 2022 06:45:14 -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="hJ/ozjh+"; 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 S229904AbiJDMlx (ORCPT + 99 others); Tue, 4 Oct 2022 08:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbiJDMl1 (ORCPT ); Tue, 4 Oct 2022 08:41:27 -0400 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 3E96B29371 for ; Tue, 4 Oct 2022 05:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664887235; 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=eZGxgt0oprjgv5pOjok2Bjxxb0EJF9XEOurD7XpaAr4=; b=hJ/ozjh+pg/L7l1zh7tWMLZTSmrqBE0MrwjEaQn91QkSSQNLyMx3XvPNr+jxtbkUH0IKnp 3apU4L6x6DWqTlSDCaKLrsztZX3nwAlFDWUvaLD+EUv0AN7WNyxZgovJqSac3yYF/IXfui XRZu+hvCwjhkBOsajUvqsoiKMuT1fEw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-lp-SasHzNnS-47hT99GvlQ-1; Tue, 04 Oct 2022 08:40:30 -0400 X-MC-Unique: lp-SasHzNnS-47hT99GvlQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B675D1C08960; Tue, 4 Oct 2022 12:40:29 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id D54A135429; Tue, 4 Oct 2022 12:40:27 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v11 12/46] KVM: x86: hyper-v: Expose support for extended gva ranges for flush hypercalls Date: Tue, 4 Oct 2022 14:39:22 +0200 Message-Id: <20221004123956.188909-13-vkuznets@redhat.com> In-Reply-To: <20221004123956.188909-1-vkuznets@redhat.com> References: <20221004123956.188909-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.5 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, 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 Extended GVA ranges support bit seems to indicate whether lower 12 bits of GVA can be used to specify up to 4095 additional consequent GVAs to flush. This is somewhat described in TLFS. Previously, KVM was handling HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST{,EX} requests by flushing the whole VPID so technically, extended GVA ranges were already supported. As such requests are handled more gently now, advertizing support for extended ranges starts making sense to reduce the size of TLB flush requests. Reviewed-by: Maxim Levitsky Signed-off-by: Vitaly Kuznetsov --- arch/x86/include/asm/hyperv-tlfs.h | 2 ++ arch/x86/kvm/hyperv.c | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index c5e0e5a06c0d..6639979302ab 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -61,6 +61,8 @@ #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE BIT(10) /* Support for debug MSRs available */ #define HV_FEATURE_DEBUG_MSRS_AVAILABLE BIT(11) +/* Support for extended gva ranges for flush hypercalls available */ +#define HV_FEATURE_EXT_GVA_RANGES_FLUSH BIT(14) /* * Support for returning hypercall output block via XMM * registers is available diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 2119f6116766..9ede23e881b1 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -2636,6 +2636,7 @@ int kvm_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, ent->ebx |= HV_DEBUGGING; ent->edx |= HV_X64_GUEST_DEBUGGING_AVAILABLE; ent->edx |= HV_FEATURE_DEBUG_MSRS_AVAILABLE; + ent->edx |= HV_FEATURE_EXT_GVA_RANGES_FLUSH; /* * Direct Synthetic timers only make sense with in-kernel -- 2.37.3