Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3444744rwb; Fri, 20 Jan 2023 16:36:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXlsFhScHL8TZ4uMVi1/D0kMncTBn3+Ph0OV0KkgIFOpaBXdihOAHB0Hn5Cm5biGmKfM2u X-Received: by 2002:a05:6a20:a690:b0:af:758e:5923 with SMTP id ba16-20020a056a20a69000b000af758e5923mr18686179pzb.21.1674261378346; Fri, 20 Jan 2023 16:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674261378; cv=none; d=google.com; s=arc-20160816; b=VpheUXoriS+GHAfuonRwQlq+kX9eyAmcwGvlSeuNQL8BrwkwrXFQUo9ayaV7CrodTa aoHb+2zl4spN9eh5k7/ahqG2xsMAOlj1OVqpvS03B+N/Gm8PiiHu7mvqR+zu5n2BwObL xHOi+MP0Q/Ndpdhij0SgZMdWNy2RA7YphVv+6+3qrZD+8sbDIR+GyuwUYSog2nHz9izM SfmATSP0iTLoD3d5ItKEOWrp2No41AUvS/O2klsZ9ZMiLa8VzUW4qfTlh3kCS3hAfYzR c2IcygvDt16NXLOjDvUWZo6OTdW3qjOWV+oSJoukBJ9vHbBdx7ikKT9UkoRY0Qvci/i0 fzUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=k1cq5TEY5bFZVJppj5PKXCCtP6lFgiUZJ/1ln+dN3QA=; b=yPZuWR19WaydS/8HgTSrQnKxUT6I7lo1ymgzSLEC3J5VKafZ2ESsjlVX3XN9tikiwN xeNQPw0fvWGOneFci3zCrdvocY5Oe5DnymGDRNLtRDxNw1UNn47JdekAuRRtiNHSCRkh eqSFORhLjA/r/jaD1D3NAv8O4gj43vBe58JXQo14mUha5aiwahXf3AQHBhzX1v8FX7Fk estmMtf2SKw6tlSbIAn/2MoZP7asn00bGxEJrqiZQr154IYnrvspBi50A2cuzi0BVLr8 SjbINO2IMlZDVYUfG7nwVrnIotGU5D50Vgx03YCxUtrwPUB6h8aJOARVW1ZCmxfXBZGP HAaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d1BYzlQo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a6541ca000000b004822e22082esi44426370pgq.249.2023.01.20.16.36.11; Fri, 20 Jan 2023 16:36:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d1BYzlQo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230168AbjAUAUB (ORCPT + 50 others); Fri, 20 Jan 2023 19:20:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbjAUAT4 (ORCPT ); Fri, 20 Jan 2023 19:19:56 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87C8A73AE8 for ; Fri, 20 Jan 2023 16:19:27 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-4faa8f4bfb9so62585787b3.17 for ; Fri, 20 Jan 2023 16:19:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=k1cq5TEY5bFZVJppj5PKXCCtP6lFgiUZJ/1ln+dN3QA=; b=d1BYzlQoyUn3i39+FvKM79uWm+WNumy+bfjZlFFt/ZeDDVwQWpIuwDbs8iEHxMAwsW KemJHYCtN/DXYLLL7eQMUQ5YoGIbIKVJyQbpifPKbv5sHtgugbasOAGzialVGpfRPQBs h4GLFakYbatPvZVmKsx9xS1aKnfRLeWB6nL2XS489S1AQ0FPgdgYIeaomBRx5A/5KSq4 5zmugkm9l1T4am+6d1w08U/IbwUDhbYYWwsov9TNA0OnGuXEi3eq6lgMQXFz9PW276mF Eb19dt3W55wzwsgepb006ykB8rV/nTqzjPvPN8ndjJB2tcFRGQs2nt8kfwwiLKEajqtm 2wZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k1cq5TEY5bFZVJppj5PKXCCtP6lFgiUZJ/1ln+dN3QA=; b=rQfn6flSI2naafSEm/x+eG1RAqag7MoVNEf5P9GztyFYyRWJpJEP/jH0v9RgzFPYwE p/4fqrIB+0F9xY9X2kx36lg0zAbXSA9ChOj1hPh4x/QYqnRbjR2JgePlP31ZnHxZ+Cv8 UzTZsrhPxLIsFEhxaYbDCiOk39J3w73Q4cmnypPC/1cbqwIMEy4JGZtCGXgBwmOCVL2o xwOcfBEscrS/eXbrobNm5M4vgKO5LDQvolLmkwG11epQJMcfQNP8gDOSKsIOFgNyHfTs plQKd0v4ml8tTzUif3Kc7P/9+ebcu6U1kJl79RWGPdOWCsg4BmQ/mb+6rrYaX1TCjwVT VIaQ== X-Gm-Message-State: AFqh2kqSTLxnYCtfLF77gaXKkjxohfXVdm3+y70c5unWT2CeeOZuKLD1 o6VtpWYDMvUZ7xkt4JrW+caQKH5jiD2sb43Hng== X-Received: from ackerleytng-cloudtop-sg.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:b30]) (user=ackerleytng job=sendgmr) by 2002:a81:f908:0:b0:4fa:fa3a:72e with SMTP id x8-20020a81f908000000b004fafa3a072emr858885ywm.231.1674260290351; Fri, 20 Jan 2023 16:18:10 -0800 (PST) Date: Sat, 21 Jan 2023 00:15:38 +0000 In-Reply-To: <20230121001542.2472357-1-ackerleytng@google.com> Mime-Version: 1.0 References: <20230121001542.2472357-1-ackerleytng@google.com> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog Message-ID: <20230121001542.2472357-28-ackerleytng@google.com> Subject: [RFC PATCH v3 27/31] KVM: selftests: Expose _vm_vaddr_alloc From: Ackerley Tng To: linux-kselftest@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, isaku.yamahata@intel.com, sagis@google.com, erdemaktas@google.com, afranji@google.com, runanwang@google.com, shuah@kernel.org, drjones@redhat.com, maz@kernel.org, bgardon@google.com, jmattson@google.com, dmatlack@google.com, peterx@redhat.com, oupton@google.com, ricarkol@google.com, yang.zhong@intel.com, wei.w.wang@intel.com, xiaoyao.li@intel.com, pgonda@google.com, marcorr@google.com, eesposit@redhat.com, borntraeger@de.ibm.com, eric.auger@redhat.com, wangyanan55@huawei.com, aaronlewis@google.com, vkuznets@redhat.com, pshier@google.com, axelrasmussen@google.com, zhenzhong.duan@intel.com, maciej.szmigiero@oracle.com, like.xu@linux.intel.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Ackerley Tng Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vm_vaddr_alloc always allocates memory in memslot 0. This allows users of this function to choose which memslot to allocate virtual memory in. Signed-off-by: Ackerley Tng --- tools/testing/selftests/kvm/include/kvm_util_base.h | 3 +++ tools/testing/selftests/kvm/lib/kvm_util.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index 950fd337898e1..abeffa5a47e88 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -406,6 +406,9 @@ void vm_mem_region_set_flags(struct kvm_vm *vm, uint32_t slot, uint32_t flags); void vm_mem_region_move(struct kvm_vm *vm, uint32_t slot, uint64_t new_gpa); void vm_mem_region_delete(struct kvm_vm *vm, uint32_t slot); struct kvm_vcpu *__vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id); +vm_vaddr_t +_vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min, + vm_paddr_t paddr_min, uint32_t data_memslot, bool encrypt); vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min); vm_vaddr_t vm_vaddr_alloc_shared(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min); vm_vaddr_t vm_vaddr_alloc_1to1(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min, diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 4e5928fa71c44..2f1e592d29dfd 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1286,7 +1286,7 @@ static vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, * a unique set of pages, with the minimum real allocation being at least * a page. */ -static vm_vaddr_t +vm_vaddr_t _vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min, vm_paddr_t paddr_min, uint32_t data_memslot, bool encrypt) { -- 2.39.0.246.g2a6d74b583-goog