From nobody Thu Apr 2 19:33:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C0FEC6FA91 for ; Wed, 21 Sep 2022 15:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbiIUP2q (ORCPT ); Wed, 21 Sep 2022 11:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiIUP1i (ORCPT ); Wed, 21 Sep 2022 11:27:38 -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 1381399B66 for ; Wed, 21 Sep 2022 08:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663773959; 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=GPt2tkrKXWKpG7wVIcNFw8vCyoG3zywLN+qot9q1LhY=; b=V3r1JLMPl1wqyRraQRQWTcdTzuBnlnOuW1OaJg+v9n80kJRd3pLKs0jkZ49phU1bW6b+MK q1e6w0/ZLb6dG6gPebOHgnLRrAQM2GsjByNGo1pJwBbK8qzP/5NUxijZfqaoTzlDsF/JmP IqpncISWyw40cOQEdDCCLBbW2fPqK2g= 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-518-PIk8FtZKPbyjACcK745ZxQ-1; Wed, 21 Sep 2022 11:25:55 -0400 X-MC-Unique: PIk8FtZKPbyjACcK745ZxQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F974101A52A; Wed, 21 Sep 2022 15:25:55 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.194.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19C8A2166B26; Wed, 21 Sep 2022 15:25:52 +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 v10 29/39] KVM: selftests: Export _vm_get_page_table_entry() Date: Wed, 21 Sep 2022 17:24:26 +0200 Message-Id: <20220921152436.3673454-30-vkuznets@redhat.com> In-Reply-To: <20220921152436.3673454-1-vkuznets@redhat.com> References: <20220921152436.3673454-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 1c7805de8c27..500d711eb989 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)); } =20 +uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, struct kvm_vcpu *vcp= u, + 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/tes= ting/selftests/kvm/lib/x86_64/processor.c index 2e6e61bbe81b..5c135f896ada 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); } =20 -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 *vcp= u, + uint64_t vaddr) { uint16_t index[4]; uint64_t *pml4e, *pdpe, *pde; --=20 2.37.3