Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp245666rwb; Tue, 25 Jul 2023 15:16:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFwPtmCVwM7q4MbBQOLbWDYZdkqH7zbkqHhgFaYCl10ptxicufX3ia8tOCFKN/jsjvUlvQ1 X-Received: by 2002:a17:907:7883:b0:99b:4bab:2838 with SMTP id ku3-20020a170907788300b0099b4bab2838mr149222ejc.0.1690323393295; Tue, 25 Jul 2023 15:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690323393; cv=none; d=google.com; s=arc-20160816; b=wgbfNP41UCiLuJhkrL2LJLfuapQpVo5PctfOdgehFb+JA3AnF3X/erY/VdmxjTEK/I Ggkl028HJohR6ep3tNDyixVkIrRHpCbyKA6mD2jqXxxMISh4WPm0H+ZwlQR9cJwXwZ5T o+F9qzZXh1lCct0wtUZFR49NBWDPOFj3/Bib71xbHNnqA1QVBkgb181eXn9n6vqe6L8X QR4RvQV9IIb76ONtIisG+5qlzSjYnmfB/iblavjf8eYCUNv75GKJnsF1r9PZ+ckElj7I mFGpfduLc1RbYmRHQlghcM7aFtJaT5ZvPPoYMSaNMvWQSBgZgqf6mYHPUf9FGi/rgcKE UfoQ== 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=WsBS7k8bBReIl/gHH9kbfcLhxHw1lqqyuWyKVcuOGx4=; fh=1/sgOwi5AuU8IZymeFKs1Rjnf4QELnrK+C7GntqU2hA=; b=gBkXqhIeJqyz47akzXatFooX88n5Gs7iXjkhpNYM7dPibhsJXrLu8GWiSig0QXHafX tkWv5AsOvHHdztNXrBGAIx/9xP5hiLLuCeqR6YrK3hChoEec8T6gkwH1WKdrbms+ugJn aTmIJAGtnGA5b9TUcoi56USjfd62II3v83EZEBBdT8tuT7R0fUK5M/blSePqz0K2cghh 071N+YgM94HcfgOMpmFn+VNyG8tC2xU/nh3u2hg/kJRxFxPj6oNXy8mLguctaxhMiWkF H9imKgAYFQ9p2wHMJB+/RERdDsZEu27qRLJZiAPi41RZpLHzNT+sDcykFS/76UKhcaKF yrAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=e5iRB7Hb; 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 qc11-20020a170906d8ab00b00992e26642ddsi8655449ejb.251.2023.07.25.15.16.08; Tue, 25 Jul 2023 15:16:33 -0700 (PDT) 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=20221208 header.b=e5iRB7Hb; 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 S231552AbjGYWEf (ORCPT + 99 others); Tue, 25 Jul 2023 18:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbjGYWDJ (ORCPT ); Tue, 25 Jul 2023 18:03:09 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3CF33A81 for ; Tue, 25 Jul 2023 15:02:44 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-55c475c6da6so2794849a12.2 for ; Tue, 25 Jul 2023 15:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690322555; x=1690927355; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=WsBS7k8bBReIl/gHH9kbfcLhxHw1lqqyuWyKVcuOGx4=; b=e5iRB7HbY0HCZBIgKoiJvs6hXr3F1dZh9Vqp9ysCQoH4sFqmNeYyYZIoneskM/b2UZ KRkXQ+0os9CNXTLr9DJf6yZFGc8ncDPoU8RdJTOOtu4LLMMTgu9t7khqF1FmcdG4ncBR 74QSRxpYBnaMb68bqn8yyfjfCd3XanDr7a+bEZ5/nhcEkV2aKsbvrCvijBq42VBcToy2 PAlp/Q/RAKe+DE6ULklvTY5fxMlO+aAc23Da+F9mZ0dqqAPib3BzgS3on/B8V0BRwmUW /3VSEF4rSux0iZeMUEO4EeFL7xWfnd2GGMgsZW09mJhdy7kKGI9Cny5iyLqEnSOKreef jL6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690322555; x=1690927355; 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=WsBS7k8bBReIl/gHH9kbfcLhxHw1lqqyuWyKVcuOGx4=; b=i4bjIAlxtiVIGvLRHOYYv24KBsINYaz68G96QydDXRiEObv6vwntRiDYA+dvrQxo27 fwW3nYUsGQd39Tj+5H7m7n+BIt2LFAGQEMW1Ek93VtkTs/vKKw5Geqt0fey98XsNUFyj QtxWnBTSnAm3C1i9NKhHn0fKnUhgdCGCEzEzZBF+h+0/zQTfBb8K4VRrxUZQsghYr8bf nS01tZpNm5/BsZrkGOZyh4XpXLGnniWHEjRadqlC7FPxnvv3vbENllhsw9xE04Llbwm7 2/pNLPO6Yj7HinUC8QWECj8CY5HH74hy1GwGfg1j4PMBsY+WXlbBWiGvGb2YpD1Dmn17 hdzw== X-Gm-Message-State: ABy/qLZPtQF3j5rXFqsVNYvoZuSmk4F8hXF+laq6Ul+oMcVUpK61O0kS aAnP3MpCyIGSH6m99f+cA2kL8f29CX6g X-Received: from afranji.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:47f1]) (user=afranji job=sendgmr) by 2002:a63:7d1a:0:b0:55b:4887:9e99 with SMTP id y26-20020a637d1a000000b0055b48879e99mr2179pgc.1.1690322554792; Tue, 25 Jul 2023 15:02:34 -0700 (PDT) Date: Tue, 25 Jul 2023 22:01:17 +0000 In-Reply-To: <20230725220132.2310657-1-afranji@google.com> Mime-Version: 1.0 References: <20230725220132.2310657-1-afranji@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230725220132.2310657-25-afranji@google.com> Subject: [PATCH v4 24/28] KVM: selftests: Expose _vm_vaddr_alloc From: Ryan Afranji 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, 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, ackerleytng@google.com 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,T_SCC_BODY_TEXT_LINE,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 From: Ackerley Tng 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 Change-Id: I2755287f0c0c2983d278094776a3c51d1c9ce448 Signed-off-by: Ryan Afranji --- 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 d793355599e1..4d02d1e6eb53 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -511,6 +511,9 @@ 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); void vm_populate_vaddr_bitmap(struct kvm_vm *vm); vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min); +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(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min, enum kvm_mem_region_type type); diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 7db9437505d7..bed218c4f8b4 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1393,7 +1393,7 @@ vm_vaddr_t __vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min, * 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.41.0.487.g6d72f3e995-goog