Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2064409rdf; Mon, 6 Nov 2023 03:56:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKE9bn3QnpfVCoeNTijGRcl+iSsJviKmQtJy6pa+kEdMwR8phuWl16W9XcfP3fimHtoNbd X-Received: by 2002:a05:6358:6f1d:b0:168:e46a:b63 with SMTP id r29-20020a0563586f1d00b00168e46a0b63mr16011591rwn.1.1699271779575; Mon, 06 Nov 2023 03:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699271779; cv=none; d=google.com; s=arc-20160816; b=D4Xdw6SRspilD5sQw6N/78Dk5wu2x5UsvJ4aN6dM/VBym+JwJ21iJMiCplDNVVQIFt uF1WkYnEr4tVfcooai91cGd/XApHeVAmvQLaHYvBkqRCt5LHETc1yGoC/2VDtBnXlfHR KflNP9BwW1mnZRDRmxmIbkCp6FKDrVpftzv2uhQtvguu+Kfdw7aG2dEA4uUiWlPtWqIR cBEPWy238RWvPGHPOEaqxit6uH5I1bNDy8bWsxb5gLWJptPm7Q+o1Ruhyb0e6infpMmZ /CztGWrcO7ME1RrmrqaCKoP7CbT+YD7sUaH/YoWRxMd5Ry1V624bGw8iJSnISnGoVv6g TFTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=c8NELU8K0U+724gQqgT5wy1Wri3ftccwsyaGDd96txU=; fh=6NDLbPegWN39ihzRI+XD38qv7OUBTPlYZUUvtWMZU2Q=; b=u7Bo/vGAkVw+wjs54hi5UWmH5ssMwMHYHsyrX5VhkiNfsykmR9F+S/p5uPVy+Djgcp 6y6lCGUcdfxB5Bku1YegfS9R5FU/BalP6cWK2xwq6NrpfQyoQSp2YkYEsEVRVkKtia5F /piVdS0ela5AFa6a0gj3xqMq5vi+yXQ+MIMDleqvS2YfRVbh9iUMXFYUBYke3WtGRU18 QlelRNtppYgVmoF3Z2XfdbfO++SKBGmc3likLeYB95DgcdQrHgQJ5rNgLOLpF2M3Ca8D OFSBeMukX3OOBUHxMWRByyzLB3HwPQHVgNQLJaaRfO8Ooxbp+NKnqkq1omnYryoj/1eO OMvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=jA7a9Q5u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id w123-20020a636281000000b005b8ebaa2937si7728720pgb.47.2023.11.06.03.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 03:56:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=jA7a9Q5u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 389D88078326; Mon, 6 Nov 2023 03:56:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231558AbjKFLzZ (ORCPT + 99 others); Mon, 6 Nov 2023 06:55:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231458AbjKFLzX (ORCPT ); Mon, 6 Nov 2023 06:55:23 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 089ED13E for ; Mon, 6 Nov 2023 03:55:19 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-77896da2118so279377185a.1 for ; Mon, 06 Nov 2023 03:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699271718; x=1699876518; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=c8NELU8K0U+724gQqgT5wy1Wri3ftccwsyaGDd96txU=; b=jA7a9Q5u3tTa1uK+1x+C7dQVcnvnVJCLDCx9vVeyIoTZ6qw54qwmdGSo/CNWcdGrT2 q2szNqZW2ag86DEgyroZQDG7h123QypnstzbmS42QahAynLFUEqo9GQJaNoHaidGG8am c1/3X85PwjNO2HEEuCskg0eeo5XOA9okoYedeZWY1U+tA4q7Bd53Sz2SwpjVWqJlne4S VItwsHz8bMlhwejLoG+d41aA5kYtMNwr6owvMfONdpxrptuq3+eO4bSO87krtyKkZAW0 btZEd+teTJXkYtJuPVCX1o83AQ8FIKAGoXh5UZ/VVsaMR4LgIArF4S/wFP0+QObZt4iJ hHHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699271718; x=1699876518; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c8NELU8K0U+724gQqgT5wy1Wri3ftccwsyaGDd96txU=; b=DB4qlL6rScpa9Puq6qsR+6+hzkuhtC2VFt26teVkJAu+wm6MIyv9bCdaT/pcCvUMLO zr3pCFbsFI4ZeOaeRWavEEAfNzed0UaVLlkNm/sw8wXaOyQZnQGeI2ng4hqIC7ftzSLU UosNZFO8GMj7iF2xkpTZDKcfK3+nqbnADSQJ3DxcOr2QYSaX7beVZ7qgsLQlG4qbF+Vc xXxIKORvtwJgH1MDfIjuH0U1U0rh1hOkZWUYcDb6BSYnNSD4wpPw/CK0v3Qr7nNH9hJF r0tezo56VaKjAzoxqrfAfc/VOyEOB+98QBb3QEqKUc3Nd2kUivhBz6113s0iGzhX8AgT LIMg== X-Gm-Message-State: AOJu0Yxiy8eFabbjmxyFBKZLIVkGiCjf2jGHyGGB+IrMMTPLau2MYh7y Dm16yAn3xqIe/NWdUy5umwUehoq/kLC+ui4lu2KCRA== X-Received: by 2002:ad4:574b:0:b0:66d:775:d1af with SMTP id q11-20020ad4574b000000b0066d0775d1afmr35284081qvx.59.1699271717922; Mon, 06 Nov 2023 03:55:17 -0800 (PST) MIME-Version: 1.0 References: <20231105163040.14904-1-pbonzini@redhat.com> <20231105163040.14904-28-pbonzini@redhat.com> In-Reply-To: <20231105163040.14904-28-pbonzini@redhat.com> From: Fuad Tabba Date: Mon, 6 Nov 2023 11:54:42 +0000 Message-ID: Subject: Re: [PATCH 27/34] KVM: selftests: Introduce VM "shape" to allow tests to specify the VM type To: Paolo Bonzini Cc: Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , Alexander Viro , Christian Brauner , "Matthew Wilcox (Oracle)" , Andrew Morton , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Xiaoyao Li , Xu Yilun , Chao Peng , Jarkko Sakkinen , Anish Moorthy , David Matlack , Yu Zhang , Isaku Yamahata , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 06 Nov 2023 03:56:15 -0800 (PST) On Sun, Nov 5, 2023 at 4:34=E2=80=AFPM Paolo Bonzini = wrote: > > From: Sean Christopherson > > Add a "vm_shape" structure to encapsulate the selftests-defined "mode", > along with the KVM-defined "type" for use when creating a new VM. "mode" > tracks physical and virtual address properties, as well as the preferred > backing memory type, while "type" corresponds to the VM type. > > Taking the VM type will allow adding tests for KVM_CREATE_GUEST_MEMFD, > a.k.a. guest private memory, without needing an entirely separate set of > helpers. Guest private memory is effectively usable only by confidential > VM types, and it's expected that x86 will double down and require unique > VM types for TDX and SNP guests. > > Signed-off-by: Sean Christopherson > Message-Id: <20231027182217.3615211-30-seanjc@google.com> > Signed-off-by: Paolo Bonzini > --- nit: as in a prior selftest commit messages, references in the commit message to guest _private_ memory. Should these be changed to just guest memory? Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Cheers, /fuad > tools/testing/selftests/kvm/dirty_log_test.c | 2 +- > .../selftests/kvm/include/kvm_util_base.h | 54 +++++++++++++++---- > .../selftests/kvm/kvm_page_table_test.c | 2 +- > tools/testing/selftests/kvm/lib/kvm_util.c | 43 +++++++-------- > tools/testing/selftests/kvm/lib/memstress.c | 3 +- > .../kvm/x86_64/ucna_injection_test.c | 2 +- > 6 files changed, 72 insertions(+), 34 deletions(-) > > diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing= /selftests/kvm/dirty_log_test.c > index 936f3a8d1b83..6cbecf499767 100644 > --- a/tools/testing/selftests/kvm/dirty_log_test.c > +++ b/tools/testing/selftests/kvm/dirty_log_test.c > @@ -699,7 +699,7 @@ static struct kvm_vm *create_vm(enum vm_guest_mode mo= de, struct kvm_vcpu **vcpu, > > pr_info("Testing guest mode: %s\n", vm_guest_mode_string(mode)); > > - vm =3D __vm_create(mode, 1, extra_mem_pages); > + vm =3D __vm_create(VM_SHAPE(mode), 1, extra_mem_pages); > > log_mode_create_vm_done(vm); > *vcpu =3D vm_vcpu_add(vm, 0, guest_code); > diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/= testing/selftests/kvm/include/kvm_util_base.h > index 1441fca6c273..157508c071f3 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util_base.h > +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h > @@ -188,6 +188,23 @@ enum vm_guest_mode { > NUM_VM_MODES, > }; > > +struct vm_shape { > + enum vm_guest_mode mode; > + unsigned int type; > +}; > + > +#define VM_TYPE_DEFAULT 0 > + > +#define VM_SHAPE(__mode) \ > +({ \ > + struct vm_shape shape =3D { \ > + .mode =3D (__mode), \ > + .type =3D VM_TYPE_DEFAULT \ > + }; \ > + \ > + shape; \ > +}) > + > #if defined(__aarch64__) > > extern enum vm_guest_mode vm_mode_default; > @@ -220,6 +237,8 @@ extern enum vm_guest_mode vm_mode_default; > > #endif > > +#define VM_SHAPE_DEFAULT VM_SHAPE(VM_MODE_DEFAULT) > + > #define MIN_PAGE_SIZE (1U << MIN_PAGE_SHIFT) > #define PTES_PER_MIN_PAGE ptes_per_page(MIN_PAGE_SIZE) > > @@ -784,21 +803,21 @@ vm_paddr_t vm_alloc_page_table(struct kvm_vm *vm); > * __vm_create() does NOT create vCPUs, @nr_runnable_vcpus is used purel= y to > * calculate the amount of memory needed for per-vCPU data, e.g. stacks. > */ > -struct kvm_vm *____vm_create(enum vm_guest_mode mode); > -struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint32_t nr_runnable= _vcpus, > +struct kvm_vm *____vm_create(struct vm_shape shape); > +struct kvm_vm *__vm_create(struct vm_shape shape, uint32_t nr_runnable_v= cpus, > uint64_t nr_extra_pages); > > static inline struct kvm_vm *vm_create_barebones(void) > { > - return ____vm_create(VM_MODE_DEFAULT); > + return ____vm_create(VM_SHAPE_DEFAULT); > } > > static inline struct kvm_vm *vm_create(uint32_t nr_runnable_vcpus) > { > - return __vm_create(VM_MODE_DEFAULT, nr_runnable_vcpus, 0); > + return __vm_create(VM_SHAPE_DEFAULT, nr_runnable_vcpus, 0); > } > > -struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t = nr_vcpus, > +struct kvm_vm *__vm_create_with_vcpus(struct vm_shape shape, uint32_t nr= _vcpus, > uint64_t extra_mem_pages, > void *guest_code, struct kvm_vcpu *= vcpus[]); > > @@ -806,17 +825,27 @@ static inline struct kvm_vm *vm_create_with_vcpus(u= int32_t nr_vcpus, > void *guest_code, > struct kvm_vcpu *vcpus[= ]) > { > - return __vm_create_with_vcpus(VM_MODE_DEFAULT, nr_vcpus, 0, > + return __vm_create_with_vcpus(VM_SHAPE_DEFAULT, nr_vcpus, 0, > guest_code, vcpus); > } > > + > +struct kvm_vm *__vm_create_shape_with_one_vcpu(struct vm_shape shape, > + struct kvm_vcpu **vcpu, > + uint64_t extra_mem_pages, > + void *guest_code); > + > /* > * Create a VM with a single vCPU with reasonable defaults and @extra_me= m_pages > * additional pages of guest memory. Returns the VM and vCPU (via out p= aram). > */ > -struct kvm_vm *__vm_create_with_one_vcpu(struct kvm_vcpu **vcpu, > - uint64_t extra_mem_pages, > - void *guest_code); > +static inline struct kvm_vm *__vm_create_with_one_vcpu(struct kvm_vcpu *= *vcpu, > + uint64_t extra_mem= _pages, > + void *guest_code) > +{ > + return __vm_create_shape_with_one_vcpu(VM_SHAPE_DEFAULT, vcpu, > + extra_mem_pages, guest_cod= e); > +} > > static inline struct kvm_vm *vm_create_with_one_vcpu(struct kvm_vcpu **v= cpu, > void *guest_code) > @@ -824,6 +853,13 @@ static inline struct kvm_vm *vm_create_with_one_vcpu= (struct kvm_vcpu **vcpu, > return __vm_create_with_one_vcpu(vcpu, 0, guest_code); > } > > +static inline struct kvm_vm *vm_create_shape_with_one_vcpu(struct vm_sha= pe shape, > + struct kvm_vcp= u **vcpu, > + void *guest_co= de) > +{ > + return __vm_create_shape_with_one_vcpu(shape, vcpu, 0, guest_code= ); > +} > + > struct kvm_vcpu *vm_recreate_with_one_vcpu(struct kvm_vm *vm); > > void kvm_pin_this_task_to_pcpu(uint32_t pcpu); > diff --git a/tools/testing/selftests/kvm/kvm_page_table_test.c b/tools/te= sting/selftests/kvm/kvm_page_table_test.c > index 69f26d80c821..e37dc9c21888 100644 > --- a/tools/testing/selftests/kvm/kvm_page_table_test.c > +++ b/tools/testing/selftests/kvm/kvm_page_table_test.c > @@ -254,7 +254,7 @@ static struct kvm_vm *pre_init_before_test(enum vm_gu= est_mode mode, void *arg) > > /* Create a VM with enough guest pages */ > guest_num_pages =3D test_mem_size / guest_page_size; > - vm =3D __vm_create_with_vcpus(mode, nr_vcpus, guest_num_pages, > + vm =3D __vm_create_with_vcpus(VM_SHAPE(mode), nr_vcpus, guest_num= _pages, > guest_code, test_args.vcpus); > > /* Align down GPA of the testing memslot */ > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/s= elftests/kvm/lib/kvm_util.c > index 95a553400ea9..1c74310f1d44 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -209,7 +209,7 @@ __weak void vm_vaddr_populate_bitmap(struct kvm_vm *v= m) > (1ULL << (vm->va_bits - 1)) >> vm->page_shift); > } > > -struct kvm_vm *____vm_create(enum vm_guest_mode mode) > +struct kvm_vm *____vm_create(struct vm_shape shape) > { > struct kvm_vm *vm; > > @@ -221,13 +221,13 @@ struct kvm_vm *____vm_create(enum vm_guest_mode mod= e) > vm->regions.hva_tree =3D RB_ROOT; > hash_init(vm->regions.slot_hash); > > - vm->mode =3D mode; > - vm->type =3D 0; > + vm->mode =3D shape.mode; > + vm->type =3D shape.type; > > - vm->pa_bits =3D vm_guest_mode_params[mode].pa_bits; > - vm->va_bits =3D vm_guest_mode_params[mode].va_bits; > - vm->page_size =3D vm_guest_mode_params[mode].page_size; > - vm->page_shift =3D vm_guest_mode_params[mode].page_shift; > + vm->pa_bits =3D vm_guest_mode_params[vm->mode].pa_bits; > + vm->va_bits =3D vm_guest_mode_params[vm->mode].va_bits; > + vm->page_size =3D vm_guest_mode_params[vm->mode].page_size; > + vm->page_shift =3D vm_guest_mode_params[vm->mode].page_shift; > > /* Setup mode specific traits. */ > switch (vm->mode) { > @@ -265,7 +265,7 @@ struct kvm_vm *____vm_create(enum vm_guest_mode mode) > /* > * Ignore KVM support for 5-level paging (vm->va_bits =3D= =3D 57), > * it doesn't take effect unless a CR4.LA57 is set, which= it > - * isn't for this VM_MODE. > + * isn't for this mode (48-bit virtual address space). > */ > TEST_ASSERT(vm->va_bits =3D=3D 48 || vm->va_bits =3D=3D 5= 7, > "Linear address width (%d bits) not supported= ", > @@ -285,10 +285,11 @@ struct kvm_vm *____vm_create(enum vm_guest_mode mod= e) > vm->pgtable_levels =3D 5; > break; > default: > - TEST_FAIL("Unknown guest mode, mode: 0x%x", mode); > + TEST_FAIL("Unknown guest mode: 0x%x", vm->mode); > } > > #ifdef __aarch64__ > + TEST_ASSERT(!vm->type, "ARM doesn't support test-provided types")= ; > if (vm->pa_bits !=3D 40) > vm->type =3D KVM_VM_TYPE_ARM_IPA_SIZE(vm->pa_bits); > #endif > @@ -347,19 +348,19 @@ static uint64_t vm_nr_pages_required(enum vm_guest_= mode mode, > return vm_adjust_num_guest_pages(mode, nr_pages); > } > > -struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint32_t nr_runnable= _vcpus, > +struct kvm_vm *__vm_create(struct vm_shape shape, uint32_t nr_runnable_v= cpus, > uint64_t nr_extra_pages) > { > - uint64_t nr_pages =3D vm_nr_pages_required(mode, nr_runnable_vcpu= s, > + uint64_t nr_pages =3D vm_nr_pages_required(shape.mode, nr_runnabl= e_vcpus, > nr_extra_pages); > struct userspace_mem_region *slot0; > struct kvm_vm *vm; > int i; > > - pr_debug("%s: mode=3D'%s' pages=3D'%ld'\n", __func__, > - vm_guest_mode_string(mode), nr_pages); > + pr_debug("%s: mode=3D'%s' type=3D'%d', pages=3D'%ld'\n", __func__= , > + vm_guest_mode_string(shape.mode), shape.type, nr_pages); > > - vm =3D ____vm_create(mode); > + vm =3D ____vm_create(shape); > > vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, 0, 0, nr_pa= ges, 0); > for (i =3D 0; i < NR_MEM_REGIONS; i++) > @@ -400,7 +401,7 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, u= int32_t nr_runnable_vcpus, > * extra_mem_pages is only used to calculate the maximum page table size= , > * no real memory allocation for non-slot0 memory in this function. > */ > -struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t = nr_vcpus, > +struct kvm_vm *__vm_create_with_vcpus(struct vm_shape shape, uint32_t nr= _vcpus, > uint64_t extra_mem_pages, > void *guest_code, struct kvm_vcpu *= vcpus[]) > { > @@ -409,7 +410,7 @@ struct kvm_vm *__vm_create_with_vcpus(enum vm_guest_m= ode mode, uint32_t nr_vcpus > > TEST_ASSERT(!nr_vcpus || vcpus, "Must provide vCPU array"); > > - vm =3D __vm_create(mode, nr_vcpus, extra_mem_pages); > + vm =3D __vm_create(shape, nr_vcpus, extra_mem_pages); > > for (i =3D 0; i < nr_vcpus; ++i) > vcpus[i] =3D vm_vcpu_add(vm, i, guest_code); > @@ -417,15 +418,15 @@ struct kvm_vm *__vm_create_with_vcpus(enum vm_guest= _mode mode, uint32_t nr_vcpus > return vm; > } > > -struct kvm_vm *__vm_create_with_one_vcpu(struct kvm_vcpu **vcpu, > - uint64_t extra_mem_pages, > - void *guest_code) > +struct kvm_vm *__vm_create_shape_with_one_vcpu(struct vm_shape shape, > + struct kvm_vcpu **vcpu, > + uint64_t extra_mem_pages, > + void *guest_code) > { > struct kvm_vcpu *vcpus[1]; > struct kvm_vm *vm; > > - vm =3D __vm_create_with_vcpus(VM_MODE_DEFAULT, 1, extra_mem_pages= , > - guest_code, vcpus); > + vm =3D __vm_create_with_vcpus(shape, 1, extra_mem_pages, guest_co= de, vcpus); > > *vcpu =3D vcpus[0]; > return vm; > diff --git a/tools/testing/selftests/kvm/lib/memstress.c b/tools/testing/= selftests/kvm/lib/memstress.c > index df457452d146..d05487e5a371 100644 > --- a/tools/testing/selftests/kvm/lib/memstress.c > +++ b/tools/testing/selftests/kvm/lib/memstress.c > @@ -168,7 +168,8 @@ struct kvm_vm *memstress_create_vm(enum vm_guest_mode= mode, int nr_vcpus, > * The memory is also added to memslot 0, but that's a benign sid= e > * effect as KVM allows aliasing HVAs in meslots. > */ > - vm =3D __vm_create_with_vcpus(mode, nr_vcpus, slot0_pages + guest= _num_pages, > + vm =3D __vm_create_with_vcpus(VM_SHAPE(mode), nr_vcpus, > + slot0_pages + guest_num_pages, > memstress_guest_code, vcpus); > > args->vm =3D vm; > diff --git a/tools/testing/selftests/kvm/x86_64/ucna_injection_test.c b/t= ools/testing/selftests/kvm/x86_64/ucna_injection_test.c > index 85f34ca7e49e..0ed32ec903d0 100644 > --- a/tools/testing/selftests/kvm/x86_64/ucna_injection_test.c > +++ b/tools/testing/selftests/kvm/x86_64/ucna_injection_test.c > @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) > > kvm_check_cap(KVM_CAP_MCE); > > - vm =3D __vm_create(VM_MODE_DEFAULT, 3, 0); > + vm =3D __vm_create(VM_SHAPE_DEFAULT, 3, 0); > > kvm_ioctl(vm->kvm_fd, KVM_X86_GET_MCE_CAP_SUPPORTED, > &supported_mcg_caps); > -- > 2.39.1 > >