Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp377652imn; Wed, 3 Aug 2022 07:42:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR7tvemBTmxBeOkarRJFyBB+iCbtvn8N+TXbr2xgAkwIr4df6LNzLXMljQTXKEVv+SazDMOC X-Received: by 2002:a17:907:97d2:b0:730:657f:bef5 with SMTP id js18-20020a17090797d200b00730657fbef5mr14684672ejc.757.1659537738510; Wed, 03 Aug 2022 07:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659537738; cv=none; d=google.com; s=arc-20160816; b=zeoH/0WB4V8B8YB5uahw+bLvlvamyQodV7HZdoZ4JbYgjfUqokExpqJFiEPAseJc2I lXhoYyD1SFLQI8Dt1UEQjAhmaL9ahAonUqCNxsiGjkRgfKdIIqwy+B9+3FNYRrbg6A4W 7nZWshzuj5BiEOza0iLmBuVwGrWMIR8yeX6FKX/BCiNWkCfBUUbPBL12q+Uo2IHR7rn7 ao+r9RzmehL8bYUMLlEVya/sBPA5JuCUlcLZd9N8UzM8cCnRqkjRmabM3gVnA0SPMpZb h4pNcuZ5BsKk/k9IciWxoSKKulrYF3RHGuLgXh0zsRHU68f5tdHDE4BU7/m6MbSzk/WI pIMg== 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=G++FS+DjCJsLWf4hV6Pt4bOXXflDeCfyi8qX/H02/SU=; b=QodBi8d5M0vdxv7xgXDvmCbfQcpjmn3cUl1rSQV/lItBG1BqIJ+AAB1KdExYMZaosr a2YbThpX2Fw08pGxRGVTaeoBtJjp9L2aTRi1ybHfM4uf1pSgR3EnAMxvgnRnPOYUu/W7 NdpwuaJlxVhEKXzJGS0bzyhM1fqV5DNLz/9Yg/wHuvoNUbop5zHQaLJ9DchMuWEvbQdU TLDdYkryYmVGlSxkr30mgqbxb5NlzF1KhG3Cdw5YiUPLJNbgS02zLnpCAY6Zjx3MSuIH +DV+syP/NnOtxIwFrLLg5U2tAE1gG7TUY4wv+oIKFxkDiEqyMvPsybhQ2Xg2tZtmqsgs DCbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="W/iohiNb"; 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 dn2-20020a17090794c200b00711fd60fa17si16626301ejc.34.2022.08.03.07.41.41; Wed, 03 Aug 2022 07:42:18 -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="W/iohiNb"; 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 S238222AbiHCNsi (ORCPT + 99 others); Wed, 3 Aug 2022 09:48:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238465AbiHCNr4 (ORCPT ); Wed, 3 Aug 2022 09:47:56 -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 821D320F44 for ; Wed, 3 Aug 2022 06:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659534411; 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=G++FS+DjCJsLWf4hV6Pt4bOXXflDeCfyi8qX/H02/SU=; b=W/iohiNbMSW815LaZqjbgHU41rnBJiMvUGGqbLtEMvL0nKLlZJjboYjaAfiT+AtFlkY14v V+gudo+WRbEzpMwXXFCvboI7ytQNatieQ6nnH5NZRXo2sIY+3Drk6O8SYI+R6uF4gZd+N+ ZgShD8xHetP8t0ewEGPoD0RVD/KLRAg= 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-149-R6JmVFSsOhOLmlKRixSoUg-1; Wed, 03 Aug 2022 09:46:46 -0400 X-MC-Unique: R6JmVFSsOhOLmlKRixSoUg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0850811767; Wed, 3 Aug 2022 13:46:45 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.195.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5EF4141510F; Wed, 3 Aug 2022 13:46:43 +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 v9 30/40] KVM: selftests: Export _vm_get_page_table_entry() Date: Wed, 3 Aug 2022 15:46:43 +0200 Message-Id: <20220803134643.399471-1-vkuznets@redhat.com> In-Reply-To: <20220803134110.397885-1-vkuznets@redhat.com> References: <20220803134110.397885-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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 Make it possible for tests to mangle guest's page table entries in addition to just getting them (available with vm_get_page_table_entry()). Signed-off-by: Vitaly Kuznetsov --- tools/testing/selftests/kvm/include/x86_64/processor.h | 2 ++ tools/testing/selftests/kvm/lib/x86_64/processor.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index 73add423aa11..7b7ebaea3b4d 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -827,6 +827,8 @@ static inline uint8_t wrmsr_safe(uint32_t msr, uint64_t val) return kvm_asm_safe("wrmsr", "a"(val & -1u), "d"(val >> 32), "c"(msr)); } +uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, struct kvm_vcpu *vcpu, + uint64_t vaddr); uint64_t vm_get_page_table_entry(struct kvm_vm *vm, struct kvm_vcpu *vcpu, uint64_t vaddr); void vm_set_page_table_entry(struct kvm_vm *vm, struct kvm_vcpu *vcpu, diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index f35626df1dea..6ca1f14fac7a 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -214,9 +214,8 @@ void virt_arch_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr) __virt_pg_map(vm, vaddr, paddr, PG_LEVEL_4K); } -static uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, - struct kvm_vcpu *vcpu, - uint64_t vaddr) +uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, struct kvm_vcpu *vcpu, + uint64_t vaddr) { uint16_t index[4]; uint64_t *pml4e, *pdpe, *pde; -- 2.35.3