Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5516599rwb; Wed, 21 Sep 2022 08:48:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Jgz+vBWPsMw7OUXSI5tV+Pzy56VVFMYApHavbMusXjAldrroPrWXdOLuYRJmB4Kr/nLHC X-Received: by 2002:aa7:8c4f:0:b0:54d:14d5:d0c9 with SMTP id e15-20020aa78c4f000000b0054d14d5d0c9mr20555430pfd.13.1663775335934; Wed, 21 Sep 2022 08:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663775335; cv=none; d=google.com; s=arc-20160816; b=k1WOkSSnCb7/sIX4jjylePL8GRwIVOT/hM5nFQMgB8AkgpcNkbX09pS0wb5+QzupdL kAPgY+Qdnn4wq7Z68WpWSNwM3cE6cbufm5ThRHWN4ZPAG5uAo+BOaYl96XZMnR2/cgx/ ksgI2Pt8Wtpch/QPwfzwoAXtR1Lo5gnxf0R4kCVwGjsrSIrQJ1N41dMvXJRQIWWqRBGM DtVeGAbZRIs91iff7IzTu/JeAiTgHbMDtmXZ0EqxZNZHvRe6T9AbkrTp5C38Kop/0W/u sVFS+lsQvI2ms8R4nOpXReyZHnAJAab8cFSsb9U6mpH1nOJWZFXiSyFudF8mcq4M+rKf eg6Q== 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=GPt2tkrKXWKpG7wVIcNFw8vCyoG3zywLN+qot9q1LhY=; b=LNatYBI7kPY4FATN2hXm5eRZO1NDGZ3pMdVgCerqYtq0EU1A+9deVHnrd5rJYhMQ1B KdOZL1l72G3tJeotuUw7lHug1s8xzVTYVBeRQUbvYRImgFeLkKBX5gZvG59bBGpd5Vl9 az+8hYqRpIQdNMf3WWcEZKFBibxuc4kZbBEX6+bMaevJ/xo5GF6vmCdlvqmuPxbw0PUo aAqjD8j2YGWpu7xQdkYl9ThAdFbcl/WAFa8cnHxGPPfTpv4K05vwILTuFT6wtqQeFIgn IjRZNYe+SM0tfABvXeuaK9oQy5C+JWll3YxWbDgeRKOq9+ixhtB/HkMu7MW/gjPPMtBH aMlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V3r1JLMP; 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 x8-20020a17090abc8800b001fd9335c499si2843824pjr.186.2022.09.21.08.48.44; Wed, 21 Sep 2022 08:48:55 -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=V3r1JLMP; 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 S230463AbiIUP2p (ORCPT + 99 others); Wed, 21 Sep 2022 11:28:45 -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-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.8 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=ham 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 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)); } +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 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); } -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.37.3