Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp225634iof; Mon, 6 Jun 2022 02:03:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycGKgdH4tEpX/HUO7cSVPxWKVA8tT1+eYgVYMe3CMYqpE7ocp12YoAJ452L8M0swpx0L12 X-Received: by 2002:a17:90a:aa8a:b0:1c9:bfd8:9a90 with SMTP id l10-20020a17090aaa8a00b001c9bfd89a90mr25635407pjq.118.1654506220008; Mon, 06 Jun 2022 02:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654506220; cv=none; d=google.com; s=arc-20160816; b=PLg6vXlqHGn92VlOzJU7ajh6htrfZYLpgyIQG+VipG+G/nZRDpXZ/ppjfv7vK/UkWq DO7Q9TKS30L1aPSZ59Z3qK9/tD/8BzGEq+QW6kyKLzEhWk7jfga1pogtDMXhLsRAcRpO RcsdRG+uQEiA1Uamhdlq40ioq5iuvH+B16lUJmrM916q9wzPjsWAAYE/YBOgiIsIq1DP 7es6/MjiBOmHDOihSxVv4liYoCRdBvKBRdUGmwFSpwgnYpznA3n7Uj2j6s7gCriTFPqo qmggv+N+KU4s2z67jRSJvBVj9muQZK849pVx7dvIcpFTQd/c/CdNKrNnl6PdD5JFZiSV d7BA== 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=RZJZWfsaByLj0ij8xQqPbsK2IaQ+e2uUS77uqtBhMFM=; b=RkQua3TWRvIkIcvaBhobzZfFWNP3jNJlaZ5DAU8yozdp8YWSWxunKh5nlJotzfmo6G ON5UM7BAzudjuhMP+bekz87b5xnnW+5LtriLF0+M2UmxK1PlUCt0uzymKKoyoDSuWKBS aq6vivTZWPFeYEylioOIXw8CzsiLovManXjosUeydfrsq7XDKPINSWFxFIiLslzINuRX Nayby+i+OCRuUl7ZA7SuxbT4P9Ssnf+02lhLgLqBjqnDWxfDXVSbk5NL8k8vxsRCjqUj WZ3l+oDjVvUSlvEeYP/nsKYJhcVnJnO5AmuWzZspZ09aLStT/6Jq6F5oVp6N23btx4/r 9mWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fwQhnWvb; 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 d13-20020a056a00244d00b0051b3a927ad4si19436669pfj.289.2022.06.06.02.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 02:03:39 -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=fwQhnWvb; 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 8A780CCA4C; Mon, 6 Jun 2022 01:41:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232388AbiFFIko (ORCPT + 99 others); Mon, 6 Jun 2022 04:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232080AbiFFIiS (ORCPT ); Mon, 6 Jun 2022 04:38:18 -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 8E58021E11 for ; Mon, 6 Jun 2022 01:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654504695; 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=RZJZWfsaByLj0ij8xQqPbsK2IaQ+e2uUS77uqtBhMFM=; b=fwQhnWvbVBwdPZwkYU/UBUSgb8eGQfmXjMhkVIH4InugRWs2uqZrg4BynJA1CZ83RZ78Bn JKN+pkvxPwP077rNVrmzwsnYloMv+eulQAHMkrRexei3amN4hvM+uk1WepXXgE2xxf6FzV cqAytFlvvvwhceuwRo1mhS+GLHBGGhA= 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-433-5GYF89LiM7aLbvJ8mBhZoA-1; Mon, 06 Jun 2022 04:38:09 -0400 X-MC-Unique: 5GYF89LiM7aLbvJ8mBhZoA-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 E4F328027EE; Mon, 6 Jun 2022 08:38:08 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.193.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id D78241121314; Mon, 6 Jun 2022 08:38:06 +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 30/38] KVM: selftests: Export _vm_get_page_table_entry() Date: Mon, 6 Jun 2022 10:36:47 +0200 Message-Id: <20220606083655.2014609-31-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 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 | 1 + tools/testing/selftests/kvm/lib/x86_64/processor.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index 9ac244fdce73..76cfd7f70add 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -475,6 +475,7 @@ void vcpu_init_descriptor_tables(struct kvm_vm *vm, uint32_t vcpuid); void vm_install_exception_handler(struct kvm_vm *vm, int vector, void (*handler)(struct ex_regs *)); +uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr); uint64_t vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr); void vm_set_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr, uint64_t pte); diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index 33ea5e9955d9..dfe54a970410 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -246,8 +246,7 @@ void virt_pg_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr) __virt_pg_map(vm, vaddr, paddr, X86_PAGE_SIZE_4K); } -static uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, - uint64_t vaddr) +uint64_t *_vm_get_page_table_entry(struct kvm_vm *vm, int vcpuid, uint64_t vaddr) { uint16_t index[4]; uint64_t *pml4e, *pdpe, *pde; -- 2.35.3