From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4A73C4338F for ; Wed, 4 Aug 2021 14:24:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4DE660EBC for ; Wed, 4 Aug 2021 14:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238766AbhHDOYq (ORCPT ); Wed, 4 Aug 2021 10:24:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55425 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238733AbhHDOYk (ORCPT ); Wed, 4 Aug 2021 10:24:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087067; 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=ZAtcHDW/mFf86xkrq3751FwHHXupiXoVHWdcBKFMaoQ=; b=cyK0qlR5l1smunPMqGfEVkmTL16TCPMRLV6taQsNRgcO/P1PV4oOrHNaXJELNotuBp8TFk AteEoUQNTuXuU/Kr7E45Hbl+G6uu7oe34tZ2qg4K2m8DZ2Y21e21W9cbsJJjjNy2uCyNx3 Xkutfk9Lc4XFdMHDYBq3ilCrrWACq9s= 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-439-JR4VXxsROT-XT_dNg1l5Gw-1; Wed, 04 Aug 2021 10:24:26 -0400 X-MC-Unique: JR4VXxsROT-XT_dNg1l5Gw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EBAD1932482; Wed, 4 Aug 2021 14:24:23 +0000 (UTC) Received: from starship (unknown [10.35.206.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF0B860CA0; Wed, 4 Aug 2021 14:24:08 +0000 (UTC) Message-ID: Subject: Re: [RFC PATCH 1/4] KVM: selftests: Add support for creating non-default type VMs From: Maxim Levitsky To: Xiaoyao Li , 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)" Date: Wed, 04 Aug 2021 17:24:07 +0300 In-Reply-To: References: <20210726183816.1343022-1-erdemaktas@google.com> <20210726183816.1343022-2-erdemaktas@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-08-04 at 14:09 +0800, Xiaoyao Li wrote: > 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? To be honest I would prefer this to be called something like KVM_X86_STANDARD_VM, or something. I don't think that normal unencrypted virtualization is already legacy, even if TDX docs claim that. Just my personal opinion. Best regards, Maxim Levitsky > > > + */ > > +struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) > > +{ > > + return __vm_create(mode, phy_pages, perm, 0); > > +} > > + > >