Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2113393ybb; Thu, 9 Apr 2020 15:34:09 -0700 (PDT) X-Google-Smtp-Source: APiQypJDdQ44sapUJrlJv7uezemW5WYT6RwHOtTYL7ecbi910Bqb5B5DfZsgeuH1QB7R1SsfPqRU X-Received: by 2002:a05:620a:a41:: with SMTP id j1mr1272218qka.86.1586471649694; Thu, 09 Apr 2020 15:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586471649; cv=none; d=google.com; s=arc-20160816; b=KupLtMIkPBU98qpI9zqAmIt4rQZ+B1MJGdBcCQJP7AdjqDEwokPvJfGMa+nTUUnNdt MwWgSR60L5BgvyJi/hg91J2j9xcBLuc4kZYd3ChohoUM3mLuB4Uap4UKbvKptJv9+IMk skSEtLadNe7+XV2sWwCAI/sz9EoeCh7sB4kJMbH0JXjsR7wfP/1QrYrjlhd8SsLrPOG0 qBI8FIdpysY6scsQr2WuTkP0PEU/zWB5AQ2UqzsAI+9VhpCK/ly4rfAJUBkL6SS0btcm IoYJItyoOOaScAGLjroA/a+M4kh6ipo4ybt6+IrrDwmFvUcr8ZAJ4a3eoVWrAUex64Wy AQ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=YBQ+zxeaLD0yw/RzmwmvvS9Gvxa0mxHzlEt+c4z9U6U=; b=tys06Q1kCdWENFTUAYgeSrn90dKc+Yu9wPNczsYgHR7XUWKLKRiYCQDOK4HX/vkYNK J4VgHuTh2lcQlHCsWr3vftAJbod0xtB1adsDYcP3EbjA6WkoM7P6SiJ4hbpRE52lmLAm ejSw6Bo8rE05CPsy7xC16VkxRmd61XFTGEwPDB85krPglVD0e9muQNNMrE1vETRYEK8B 3xkJpQNoyVFHa0nhmrtT1TyOJYQYhUwzll6phlSUQrLBnKKiE7AqXFa/0gKBaB9k4cGA GpmMr/atZOoV0fjUJF9MvBq5AMiEhbbNkMKnA7jQHgeivrWvS/kcilpt3AfRv/MqebmF /zpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dlCID5rM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a40si78160qtk.15.2020.04.09.15.33.53; Thu, 09 Apr 2020 15:34:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dlCID5rM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726979AbgDIWJW (ORCPT + 99 others); Thu, 9 Apr 2020 18:09:22 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34093 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726952AbgDIWJV (ORCPT ); Thu, 9 Apr 2020 18:09:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586470161; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=YBQ+zxeaLD0yw/RzmwmvvS9Gvxa0mxHzlEt+c4z9U6U=; b=dlCID5rMz2icPvp7qB96Tv1qC16xZHq9yrzWsln//97PN1Z72wL5864uy5aGMXfSeeGBEd YaZnWFp1zzLRelXPKPrIXoLPJ8b+F7GVpNGaU12MS7QQ48dv4s8w+t64ui8cz40VSgIWdc gfftQlTEXvhCtIoqDa5c4sS65dTUcFw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-pjkdSrLXN1O_qtpWNWJNfg-1; Thu, 09 Apr 2020 18:09:20 -0400 X-MC-Unique: pjkdSrLXN1O_qtpWNWJNfg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD5C613FD; Thu, 9 Apr 2020 22:09:18 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-15.gru2.redhat.com [10.97.116.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A6A59D348; Thu, 9 Apr 2020 22:09:15 +0000 (UTC) From: Wainer dos Santos Moschetta To: pbonzini@redhat.com, kvm@vger.kernel.org Cc: drjones@redhat.com, david@redhat.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, krish.sadhukhan@oracle.com Subject: [PATCH v5 1/2] selftests: kvm: Add vm_get_fd() in kvm_util Date: Thu, 9 Apr 2020 19:09:04 -0300 Message-Id: <20200409220905.26573-2-wainersm@redhat.com> In-Reply-To: <20200409220905.26573-1-wainersm@redhat.com> References: <20200409220905.26573-1-wainersm@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduces the vm_get_fd() function in kvm_util which returns the VM file descriptor. Reviewed-by: Andrew Jones Signed-off-by: Wainer dos Santos Moschetta --- tools/testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index a99b875f50d2..4e122819ee24 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -254,6 +254,7 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm); unsigned int vm_get_page_size(struct kvm_vm *vm); unsigned int vm_get_page_shift(struct kvm_vm *vm); unsigned int vm_get_max_gfn(struct kvm_vm *vm); +int vm_get_fd(struct kvm_vm *vm); unsigned int vm_calc_num_guest_pages(enum vm_guest_mode mode, size_t size); unsigned int vm_num_host_pages(enum vm_guest_mode mode, unsigned int num_guest_pages); diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 8a3523d4434f..3e36a1eb8771 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1734,6 +1734,11 @@ unsigned int vm_get_max_gfn(struct kvm_vm *vm) return vm->max_gfn; } +int vm_get_fd(struct kvm_vm *vm) +{ + return vm->fd; +} + static unsigned int vm_calc_num_pages(unsigned int num_pages, unsigned int page_shift, unsigned int new_page_shift, -- 2.17.2