Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp224906iof; Mon, 6 Jun 2022 02:02:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7EsP+PokEufowVZGzlIPk/c/3ei6swwtbNqRrntjo/Rv2mMB37i/SaJzw7u45lQECVavW X-Received: by 2002:a17:902:dac7:b0:166:3dfe:f4b8 with SMTP id q7-20020a170902dac700b001663dfef4b8mr22443787plx.55.1654506152633; Mon, 06 Jun 2022 02:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654506152; cv=none; d=google.com; s=arc-20160816; b=yPKC0Ev0fKN2tr3t+mC62m7KfAoAy9PlTatCv6dqxEjAp8H4cSF/6zZv2Kug538rS/ THXvPKklqSt8CfT92L1sr5pTz5cBBRMz5K751gjNVlFAF3ff2H8K5HgbgmJbLlEJ6OvT XghKi9dddp+Fyt4beu/NOQvA2BxL+zEIMKRMCvIT+809+UBAfJbK9S6UQ257hZyGUb/L uQhqGlfwr3zuAc7Sd14rrdFJ68Pl3txSA3K52wNuV++81vA+RAtNIUbvyUsv4FxQ1LtB kX5Yi/1CwJ/uZ2tb/wRyNOY78fi+nnfpcdwM+NmFsY9A1vCflpUMnM4+Pl5DgZ8ef0AK Aaag== 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=eLxWOZacrIGpFiZb3ufXFWMB2lMJmfCQH3rWuoVHSk4=; b=CiX0DL0016oAEXPf4FdLs/efu8voLlLpov3L9hWNrftazb0D5brAtQdqMu2DwFhB3e YKsQJzxQLMIK3aRv+kyayy39Se+yDJB7IB2qY4j5zYSqVieYleQ+Ry0tSuWKN5VUGkdH lpEcWaHtMrtWC21G5TO4Et1qDNxMq8I9tU+ERCvlIPZie8O8e7BZtsiZNSkvf5HySyKm Gy0h+Tmm10OUP3Cb806criMP7Z0+9SjnpOAQHWd5PcqhOcGmYpdnO3TPVZCIxXMOXE4y vNLEcFVONi5GTbpHk3btwbcM0OcP/1esyGNAuZ/FFNVYCdKT0M59+be5OZiCLVohePMa x/EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JDwbxME7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x35-20020a056a0018a300b004fa8832da6dsi10718322pfh.76.2022.06.06.02.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 02:02:32 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JDwbxME7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D724933A23; Mon, 6 Jun 2022 01:38:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbiFFIiC (ORCPT + 99 others); Mon, 6 Jun 2022 04:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231918AbiFFIhV (ORCPT ); Mon, 6 Jun 2022 04:37:21 -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 D2D221263B for ; Mon, 6 Jun 2022 01:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654504637; 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=eLxWOZacrIGpFiZb3ufXFWMB2lMJmfCQH3rWuoVHSk4=; b=JDwbxME73cmGBMK0KCdVLi6A9G5Vb0KH9xh73quj+egMpWaUVn8f/nh+sS+C+uFZ3/t2LU ZQGJnwmYpGhiTSwpxSFpvQfPnXVJ335W6+3JBZhcjUHaXwzP3Hw5ks9rr0jASApMD+TNb7 1EEi2eInNAv7MVMZK8NDIQk9wCl6Aus= 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-UTg7grFFPOS6VhR-sutpZg-1; Mon, 06 Jun 2022 04:37:14 -0400 X-MC-Unique: UTg7grFFPOS6VhR-sutpZg-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 D1B67801228; Mon, 6 Jun 2022 08:37:13 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.193.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 036EE1121314; Mon, 6 Jun 2022 08:37:11 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 06/38] KVM: x86: hyper-v: Expose support for extended gva ranges for flush hypercalls Date: Mon, 6 Jun 2022 10:36:23 +0200 Message-Id: <20220606083655.2014609-7-vkuznets@redhat.com> In-Reply-To: <20220606083655.2014609-1-vkuznets@redhat.com> References: <20220606083655.2014609-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_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 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 0a9407dc0859..5225a85c08c3 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 956072592e2f..d6abc5265f55 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -2642,6 +2642,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.35.3