Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp141991pxt; Wed, 4 Aug 2021 07:46:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwet0PBQZeSOGCF4aLTn8JubhAp3TpXJepEav5xe3k1dI7WNjxsFSpsCmOpVAoyP83gf1RI X-Received: by 2002:a5e:9743:: with SMTP id h3mr159549ioq.52.1628088360632; Wed, 04 Aug 2021 07:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628088360; cv=none; d=google.com; s=arc-20160816; b=E3dp8JTWx6QDDkCy2weM+PYz4TA7QcZZTZDodbm67hxp6rzD/WcHJxunGzHXYtYRv2 GhblpJxyzbeZxM2ep0oVEViix1zAhNEO9tHS3E4a2nacfPlhU+kNGZ0nsLT8h5ZOrd4T z3NmEZYRQyD7j/jCfIP/GODucKXA35I7V53P9gNQ5Kz9nEGnjKczy7yRqYAIWfrCeYD0 xI2JX8YKscMogSkvVZjo0Z1oe3c+tOkXNOh6WcFcqLSwJbLY7ut9aYvornYLT1+wlnQ8 s0CzCxtDSIkV4l+viEWfvWMFjfehQAQ88eylSOZ/9BWtnbheNvaGf6tdOUVbxgjLKWOh n6Zw== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=ZAtcHDW/mFf86xkrq3751FwHHXupiXoVHWdcBKFMaoQ=; b=xTVz19VqG0qm61fBG4ZjO8bwebAmK3t7Ka4hK158Ck5R8x41UFQh81JOOlknPZSPku b690aUbPn4AaTaZ1Q8OXRSrPiuV0xE6+ZHjCNaZRgUxIseK86GSqwP2RKu4r66zsGB82 Plg5cQOfGDnSfgetvY1B1m7PtVv6MZld6TBUPwYw1I63kR+ysnnMgpXLXjayOyXvy/ta n5Rfgq/y+rHeP4mrAij7X8V8WytUgSOlyY+0uOW8KUzFTeLroOjm2D+XAwbKlucYlRpr ZLGvux45ZRi2vDVn+3x84inQgYbWU+7tb+MgtpbgkWp8qK6ieQqKyLr8fLu9ZqtfsT47 fGaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cyK0qlR5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si3378889ilu.53.2021.08.04.07.45.47; Wed, 04 Aug 2021 07:46:00 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cyK0qlR5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238730AbhHDOYn (ORCPT + 99 others); Wed, 4 Aug 2021 10:24:43 -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); > > +} > > + > >