Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1036128ybb; Wed, 8 Apr 2020 15:09:26 -0700 (PDT) X-Google-Smtp-Source: APiQypK5F8NkKra4e7BEBIjkFuykYWdALAByNR6LVoH+yF9vprFzJTQSM04e70nfYY2nP+tPP15V X-Received: by 2002:a9d:5191:: with SMTP id y17mr7618394otg.267.1586383766405; Wed, 08 Apr 2020 15:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586383766; cv=none; d=google.com; s=arc-20160816; b=YMaSLeaFqauBfnAcGKFBTWS3dVTfsvuBpkY6mQe98XeQi1NIUGHZd4MLF2z98PaRjH n0y/17O2PjcDitfxcTaceD/JDjPjMNbA6lbziCPqskuF+7b5foGXONsvFtzk4fJxIT1h y8cGNCK0zsza7ZhjQMU55qby17rYDtsuRejqKzyPVm8Nxzna/polLJb3KK1d2I1KdD/N yPNiM8Nzri6cm8DLmjELyBkDvIQRhFD5HETMT7gYbfF1ARaBk/d3wDDPWzgnJGnbmT3H 75VpOC5dp0/ielghwnXsj7z4xXY/TWiIW2CpphoGzhD9ZeJZ+Lj9zOADFHcHbWAapL3Y qHmw== 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=ITn6JR5+on6fivGKnl9tOXiHYutZWfczywO2QlPUKInIASGHgQVgUWGVq/pL/Jiah9 YyT8SDgRAYEIX7+cgTK30mZhisPlzyLj2khIweghQ4rLA3Z0qnTT5/WJJIsQKpHwPeDZ XnW+wl8nuBwFsVkila4r4aSSLfurYmBmLuPVh+Ccb0p7ibPjs5nyfgSzcp5v1AX/fNMC aBeol9O19kwF+rk7JWMadAKcSi1LpVc/+BZ29ohaH+oWqe/7LDeO6gRvLRdIPULkoDJf rxyNFvvrQ+h/E+JJhn7tdOkfCCQN5c1gDI+uQrE8M3YDicE9xaTw0t4jF/NlE9HpgBhA jylw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hQ8jnXum; 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 b17si3119565ook.91.2020.04.08.15.09.14; Wed, 08 Apr 2020 15:09:26 -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=hQ8jnXum; 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 S1726594AbgDHWIj (ORCPT + 99 others); Wed, 8 Apr 2020 18:08:39 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46830 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726584AbgDHWIi (ORCPT ); Wed, 8 Apr 2020 18:08:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586383717; 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=hQ8jnXumJ6QOALq03bfUnFVS5Whnd0RqQJFY0Iih1xK1WHem74CuQ6D+O53cSmRRW0Oagn 40Cs7A1Y6yNA/QAQ8QrFVmcZPExrpnvaJ5YNfoHGI7zSyOKK2Bn/Y/bWbWCh1ug7B6JUMT maFJbBIyOYYWCodoIcD2WCpsOo1jwrc= 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-198-7EO6LfQqOSWiGnrI026uUQ-1; Wed, 08 Apr 2020 18:08:33 -0400 X-MC-Unique: 7EO6LfQqOSWiGnrI026uUQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C490313FB; Wed, 8 Apr 2020 22:08:32 +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 3FE88118F4A; Wed, 8 Apr 2020 22:08:26 +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 Subject: [PATCH v4 1/2] selftests: kvm: Add vm_get_fd() in kvm_util Date: Wed, 8 Apr 2020 19:08:17 -0300 Message-Id: <20200408220818.4306-2-wainersm@redhat.com> In-Reply-To: <20200408220818.4306-1-wainersm@redhat.com> References: <20200408220818.4306-1-wainersm@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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