Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp229873iof; Mon, 6 Jun 2022 02:10:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmbAq7Ert6njfwGnIpyXWU+ETLnf219tAZE5NOIEj7yVVwHN+UnHH2Dr0HlAJbZ8Qw+5MN X-Received: by 2002:a65:6a15:0:b0:3fd:c66:eb3d with SMTP id m21-20020a656a15000000b003fd0c66eb3dmr16311387pgu.111.1654506609382; Mon, 06 Jun 2022 02:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654506609; cv=none; d=google.com; s=arc-20160816; b=SDFbt03uBxvhdR6Tu3dlMscasnO+43kcLCuB6JTiHKQIvHiYx4g85nt0o7HxZElCyD Cm+wuFYYvcLCn1Qu0Y+umEzRQcCKSwdPjIqnkaFQokD2rORhRcSRvcAcQaN2PqDOHEek NeD0Ojaoee5NmLA1lmXVZNvAHvvZUkV1OVGf3VqtAUwwMMfE1/q5fIStOurFYvvlBHYd TjtUsySj4dFhrTx1vay4nC1RWufKgyqe0ddPtMqk7a1XDhwlE/Y3zydAHw3tM3Lcl9IE ni2QegwViHMuE9pzI+hD2iUXPuv8UxPA7LDfC9LlxSGBPMxSfZkvz3JSxp8BKl4BG/3C Pwuw== 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=0KF+8ImE87X/jRor6TysxHRJbU1o17Pa9uwwIhivVEs=; b=ZF6+8So+CiE47RyLXqx6L1SQtAn2sWINXV3bztfD53gFs9OGNZoK7RZK0ge1GUVE0j UzO8X+C9hU33MTqJrOv2C3KlcTqRbm0n5e+BlqsJDnqnrGwoOWgHC4DkmULOLBfuVW78 H/ucwtA+tLA2mZmqFHTUxBtfpU4/AathQL7lsjUz5XPPL+OyutmruIx2SA9wykAIXdfi 5JosKgQ55shGl8VtIaditCElVESSIcY8uObfmo+XA4op13OrNxit9dQG5vrPbU6Ot51t b88eivYHufsXd5MGDqtAzcxANoLlpWaZURo0AzGZOP2grgQnFd2RVU1IOCmQ0EDoEK2Z DaoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GcOErvsd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f189-20020a636ac6000000b003fd679770adsi8260180pgc.694.2022.06.06.02.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 02:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GcOErvsd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 14B7214ACBD; Mon, 6 Jun 2022 01:43:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232545AbiFFIlN (ORCPT + 99 others); Mon, 6 Jun 2022 04:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbiFFIic (ORCPT ); Mon, 6 Jun 2022 04:38:32 -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 766E3326D2 for ; Mon, 6 Jun 2022 01:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654504706; 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=0KF+8ImE87X/jRor6TysxHRJbU1o17Pa9uwwIhivVEs=; b=GcOErvsdwlWbrqaN6XbbEk4vAAic9aP6GmeDoSrA5s313lqwxJ63bGcD0QYSongO6tAG+M kIX/fq5vsVaUWHlCphc/PklIZkuWlu+14/9Ba6B7zcC/KZLlc1VL1WrsXH1CasmHPbTQEh SNT8uZ22KGOYH8SkPaQjnf6KMVr6i5w= 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-653-edu4CYwdO5WYVqYam7JHQg-1; Mon, 06 Jun 2022 04:38:19 -0400 X-MC-Unique: edu4CYwdO5WYVqYam7JHQg-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 F01C23C19021; Mon, 6 Jun 2022 08:38:18 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.193.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id C86D31121314; Mon, 6 Jun 2022 08:38:16 +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 34/38] KVM: selftests: nSVM: Allocate Hyper-V partition assist and VP assist pages Date: Mon, 6 Jun 2022 10:36:51 +0200 Message-Id: <20220606083655.2014609-35-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 In preparation to testing Hyper-V L2 TLB flush hypercalls, allocate VP assist and Partition assist pages and link them to 'struct svm_test_data'. Reviewed-by: Maxim Levitsky Signed-off-by: Vitaly Kuznetsov --- tools/testing/selftests/kvm/include/x86_64/svm_util.h | 10 ++++++++++ tools/testing/selftests/kvm/lib/x86_64/svm.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86_64/svm_util.h b/tools/testing/selftests/kvm/include/x86_64/svm_util.h index 136ba6a5d027..3922e4842c68 100644 --- a/tools/testing/selftests/kvm/include/x86_64/svm_util.h +++ b/tools/testing/selftests/kvm/include/x86_64/svm_util.h @@ -36,6 +36,16 @@ struct svm_test_data { void *msr; /* gva */ void *msr_hva; uint64_t msr_gpa; + + /* Hyper-V VP assist page */ + void *vp_assist; /* gva */ + void *vp_assist_hva; + uint64_t vp_assist_gpa; + + /* Hyper-V Partition assist page */ + void *partition_assist; /* gva */ + void *partition_assist_hva; + uint64_t partition_assist_gpa; }; #define stgi() \ diff --git a/tools/testing/selftests/kvm/lib/x86_64/svm.c b/tools/testing/selftests/kvm/lib/x86_64/svm.c index 736ee4a23df6..c284e8f87f5c 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/svm.c +++ b/tools/testing/selftests/kvm/lib/x86_64/svm.c @@ -48,6 +48,16 @@ vcpu_alloc_svm(struct kvm_vm *vm, vm_vaddr_t *p_svm_gva) svm->msr_gpa = addr_gva2gpa(vm, (uintptr_t)svm->msr); memset(svm->msr_hva, 0, getpagesize()); + svm->vp_assist = (void *)vm_vaddr_alloc_page(vm); + svm->vp_assist_hva = addr_gva2hva(vm, (uintptr_t)svm->vp_assist); + svm->vp_assist_gpa = addr_gva2gpa(vm, (uintptr_t)svm->vp_assist); + memset(svm->vp_assist_hva, 0, getpagesize()); + + svm->partition_assist = (void *)vm_vaddr_alloc_page(vm); + svm->partition_assist_hva = addr_gva2hva(vm, (uintptr_t)svm->partition_assist); + svm->partition_assist_gpa = addr_gva2gpa(vm, (uintptr_t)svm->partition_assist); + memset(svm->partition_assist_hva, 0, getpagesize()); + *p_svm_gva = svm_gva; return svm; } -- 2.35.3