Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp3034265pxy; Wed, 4 Aug 2021 00:05:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUac7tnkCifcMnx4KMMYNb7Hu7q7dDkqjNU1J9a+m5zue/7hJ1vsAXxSfeoAEXZj5XrAXp X-Received: by 2002:a17:906:f15:: with SMTP id z21mr24698586eji.177.1628060745924; Wed, 04 Aug 2021 00:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628060745; cv=none; d=google.com; s=arc-20160816; b=UYyGfGu677A2gsHMmY6T9oCuDrvc9jnIxxpCrkBL7MSE5xwREMmutgqQrGQYY+mLS5 CBgbtUUsBqmB6C/Gr8lFacMhXRFQDDBWTLYtQKVTXNtJjAz46HSODa9oR7VFAzpYBccH VQoIcaXmmyp/M3MwvgaxMC5OR6ibe1iSdwYmpKvJWl9/t3T+ZwMqg+xN0Ij2jcNuR06w Pv7psnbPn/3g2B4NgvYMGYWKdesiyyAydG9AItG6PgtSigLI+US3wHhEJrhyiuYoU3FP ATZPuCYq4IljpcSx6uqltQfgD+MlP1JMfBaGKft9F2yUGEHGhqhqIyCjotbzA8wERwys kkpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=hPBcw4SGgAjzN/5+7g76di/aT7HvTLlp15QDxeWNtB8=; b=C+UvDPvueD/I0jnMEbGFek879MfVRueH+8frXizSW4QJM6X/9EC8it/6gY5t69DQ1h 9UuypXEy3Rib3+10H3oarJzU0qoHTwh/u+t0cTzpBSJrq8qfBTo9NTUUgjWL3MFuKYJ4 WUBK4mRFlwZOG01KKd++QRXXHE6O95XkPnBCM1uRnF701AGI27IG2zW6pNX1wtiNUe+/ e0S0OsBAh16bD6xp8JipjLMLL49dPptD0wb2YTwMhrPyBSyebdNdAl6/qwfrK/KRMrQU 5rEtpsqRhimTJqsc1C7OTxgInznuygU8SwUB8/M4hNklysNCll6E7KcTZTxsTND5y2T5 kOeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z25si1365289ejj.275.2021.08.04.00.05.20; Wed, 04 Aug 2021 00:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235520AbhHDGJr (ORCPT + 99 others); Wed, 4 Aug 2021 02:09:47 -0400 Received: from mga11.intel.com ([192.55.52.93]:42718 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbhHDGJq (ORCPT ); Wed, 4 Aug 2021 02:09:46 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10065"; a="210744639" X-IronPort-AV: E=Sophos;i="5.84,293,1620716400"; d="scan'208";a="210744639" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2021 23:09:34 -0700 X-IronPort-AV: E=Sophos;i="5.84,293,1620716400"; d="scan'208";a="511750613" Received: from xiaoyaol-mobl.ccr.corp.intel.com (HELO [10.239.13.122]) ([10.239.13.122]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2021 23:09:28 -0700 Subject: Re: [RFC PATCH 1/4] KVM: selftests: Add support for creating non-default type VMs To: Erdem Aktas , linux-kselftest@vger.kernel.org Cc: Sean Christopherson , Peter Gonda , Marc Orr , Sagi Shahar , Paolo Bonzini , Shuah Khan , Andrew Jones , Ben Gardon , Peter Xu , David Matlack , Emanuele Giuseppe Esposito , Christian Borntraeger , Ricardo Koller , Eric Auger , Yanan Wang , Aaron Lewis , Jim Mattson , Oliver Upton , Vitaly Kuznetsov , Peter Shier , Axel Rasmussen , Zhenzhong Duan , "Maciej S. Szmigiero" , Like Xu , open list , "open list:KERNEL VIRTUAL MACHINE (KVM)" References: <20210726183816.1343022-1-erdemaktas@google.com> <20210726183816.1343022-2-erdemaktas@google.com> From: Xiaoyao Li Message-ID: Date: Wed, 4 Aug 2021 14:09:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210726183816.1343022-2-erdemaktas@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/2021 2:37 AM, Erdem Aktas wrote: > Currently vm_create function only creates KVM_X86_LEGACY_VM type VMs. > Changing the vm_create function to accept type parameter to create > new VM types. > > Signed-off-by: Erdem Aktas > Reviewed-by: Sean Christopherson > Reviewed-by: Peter Gonda > Reviewed-by: Marc Orr > Reviewed-by: Sagi Shahar > --- > .../testing/selftests/kvm/include/kvm_util.h | 1 + > tools/testing/selftests/kvm/lib/kvm_util.c | 29 +++++++++++++++++-- > 2 files changed, 27 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index d53bfadd2..c63df42d6 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -88,6 +88,7 @@ int vcpu_enable_cap(struct kvm_vm *vm, uint32_t vcpu_id, > void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size); > > struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm); > +struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm, int type); > void kvm_vm_free(struct kvm_vm *vmp); > void kvm_vm_restart(struct kvm_vm *vmp, int perm); > void kvm_vm_release(struct kvm_vm *vmp); > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index e5fbf16f7..70caa3882 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -180,13 +180,36 @@ _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) > * Return: > * Pointer to opaque structure that describes the created VM. > * > - * Creates a VM with the mode specified by mode (e.g. VM_MODE_P52V48_4K). > + * Wrapper VM Create function to create a VM with default type (0). Can we pass KVM_X86_LEGACY_VM (whatever name when it's upstreamed) instead of 0? > + */ > +struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) > +{ > + return __vm_create(mode, phy_pages, perm, 0); > +} > +