From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 662154AA3FB for ; Wed, 2 Sep 2026 16:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788367299; cv=none; b=nsZrVYUd/0ZnsEgsgqLVzXyjNk4bvg2VuH3Kes/BwWhxzn/+cIRTDNT7BX9jUrL2cGIKrV+hWNRAto15W6chwUQfxbK7vXHbmB74YxIvopkCerffZr360AegJHzdiTAyTLEcLsd14TimpQ2jkXV+gEiwaTMKQcW+VSNnGxG8KRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788367299; c=relaxed/simple; bh=1FneJM9N+iD2yZ+x4/1fexUijXDgNuTpisnHzVWEp+8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pAjuezUv7F2DQ3+TU0gplEYCXW2eWoAYBTzDGa7+ntkLqcQYWFv7CWwTB6PkEYDa/lTpnv87fBD1qJMMe36E+86h5yLPwdtKZIQOcY1vToIB4UIUuZzL2C6BtO9c5pGOqcFu30LVdTCY+6+C+NkXklZr3aAYwFf+9qBBqptgdcM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GatGxHCF; arc=none smtp.client-ip=209.85.210.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GatGxHCF" Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-84a67b16217so2213102b3a.3 for ; Wed, 02 Sep 2026 09:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1788367294; x=1788972094; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:from:to:cc:subject:date:message-id :reply-to:content-type; bh=xxl3R2RxR/fdY+CE5Gsyx1FXrQJglfzt8OPnA5rO56k=; b=GatGxHCFoh9C6FLxC39Jkic2Fy5vrFcHN1t9eS9vQgo4T02M7smHGOdcc5k2p+7eQW yjcR1rytA2lwGEI+Ht2KuEOSNVZviuunCoyHbjn5rFIYa/lpnht30UY1P87W8ya0ksYL 9Ziw1eOMsmd72w0moY8eCBvYpBUzYXzKJML2euxy5CPZKI5wgJLf0vl5MkOjJ8mmojr/ IvSp/7othvVfCqF1VvYrcxwEy+Dpww2WwtmQHS5HpCXQNIKGRLtiRBtwOjQM5etEvtex SuZ3AzGe1UvtpK1NE3bKqy3ejnx+CMyzyx/Vky56b+QdxpgGCSr7b183JrQb+agABpRV Gyhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788367294; x=1788972094; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=xxl3R2RxR/fdY+CE5Gsyx1FXrQJglfzt8OPnA5rO56k=; b=ZO+a5rNWl2B2kzwWCtPBqMrxlDWfwSrMQ/41bPpWvN0QxvLNSxq0m6a2wraWFT3f+E 5urKGGvJp4kUS+O4/uWqNC2+wKPvty4J5IP3iFY6ltMfteZjWaiFFRkgbXei1KcnsmJL OJ75sE/r1t+cXwqbf7eM0Hs4ki4Wlt3HSV/s3oraNw6zelGhf6k+Hged3F4GNdMuk6Ty ExoQtfoEZdiZtfL5GroPoEao0LY3FBfNI/tURvWUgOhu7mnG4eqeQ3dhiO0D8aGQdO7D p9I0N7+dEOLfd2w3FOGFcifTAGJUqFFfe3t8zx+ECD/0y9iWWLQuuYEXINIMJsDfT0Ij ylIw== X-Forwarded-Encrypted: i=1; AKwUvBwt10b+I0sbZ99+RnAXCok9Ovy1HosXlowFay6Or9sYCMQufk5HWzVsdKBlDTJ5iBKpKQZrtlr2uueGj9U=@vger.kernel.org X-Gm-Message-State: AFuF++mTYstJmELJSyCfaNOIfVYsx5TTliMWicnIYWARCxCSz+DC0NoM pgO07jHrlVBOYUNddc+X9KbrJajYjIXhK32ZwEADY3tSr5F1e9/eSbM2jSXiJqZYASCbQzqCJf0 2aMnpgA== X-Received: from pfmy23.prod.google.com ([2002:aa7:8057:0:b0:847:7f5d:6b90]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:4fce:b0:845:e9e8:645c with SMTP id d2e1a72fcca58-85ed7d1ddf1mr9648289b3a.6.1788367293421; Wed, 02 Sep 2026 09:41:33 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 2 Sep 2026 09:41:10 -0700 In-Reply-To: <20260902164123.2546762-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260902164123.2546762-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.966.g6673acef38-goog Message-ID: <20260902164123.2546762-8-seanjc@google.com> Subject: [PATCH v2 07/20] KVM: selftests: Make the single-page allocator APIs static inline From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Sean Christopherson , Paolo Bonzini , Tianrui Zhao , Bibo Mao , Huacai Chen , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Atish Patra , Alexandre Ghiti , David Hildenbrand , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, loongarch@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Itaru Kitayama , Nicholas Piggin , Ritesh Harjani Content-Type: text/plain; charset="UTF-8" Move the single-page allocator APIs to kvm_util.h as inline functions, as the are trivial wrappers, and unlike __vm_phy_pages_alloc(), are expected to remain that way for the foreseeable future. No functional change intended. Tested-by: Itaru Kitayama Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/include/kvm_util.h | 14 ++++++++++++-- tools/testing/selftests/kvm/lib/kvm_util.c | 11 ----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index 4732b9528812..d9d39a8894e2 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -990,12 +990,10 @@ void kvm_gsi_routing_write(struct kvm_vm *vm, struct kvm_irq_routing *routing); const char *exit_reason_str(unsigned int exit_reason); -gpa_t vm_phy_page_alloc(struct kvm_vm *vm, gpa_t min_gpa, u32 memslot); gpa_t ____vm_phy_pages_alloc(struct kvm_vm *vm, size_t nr_pages, gpa_t min_gpa, u32 memslot, bool protected, bool naturally_aligned); gpa_t __vm_phy_pages_alloc(struct kvm_vm *vm, size_t nr_pages, gpa_t min_gpa, u32 memslot, bool protected); -gpa_t vm_alloc_page_table(struct kvm_vm *vm); static inline gpa_t vm_phy_pages_alloc(struct kvm_vm *vm, size_t nr_pages, gpa_t min_gpa, u32 memslot) @@ -1009,6 +1007,18 @@ static inline gpa_t vm_phy_pages_alloc(struct kvm_vm *vm, size_t nr_pages, vm_arch_has_protected_memory(vm)); } +static inline gpa_t vm_phy_page_alloc(struct kvm_vm *vm, gpa_t min_gpa, + u32 memslot) +{ + return vm_phy_pages_alloc(vm, 1, min_gpa, memslot); +} + +static inline gpa_t vm_alloc_page_table(struct kvm_vm *vm) +{ + return vm_phy_page_alloc(vm, KVM_GUEST_PAGE_TABLE_MIN_PADDR, + vm->memslots[MEM_REGION_PT]); +} + /* * ____vm_create() does KVM_CREATE_VM and little else. __vm_create() also * loads the test binary into guest memory and creates an IRQ chip (x86 only). diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 896da440659e..ce0d8fba4624 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -2086,17 +2086,6 @@ gpa_t __vm_phy_pages_alloc(struct kvm_vm *vm, size_t nr_pages, gpa_t min_gpa, return ____vm_phy_pages_alloc(vm, nr_pages, min_gpa, memslot, protected, false); } -gpa_t vm_phy_page_alloc(struct kvm_vm *vm, gpa_t min_gpa, u32 memslot) -{ - return vm_phy_pages_alloc(vm, 1, min_gpa, memslot); -} - -gpa_t vm_alloc_page_table(struct kvm_vm *vm) -{ - return vm_phy_page_alloc(vm, KVM_GUEST_PAGE_TABLE_MIN_PADDR, - vm->memslots[MEM_REGION_PT]); -} - /* * Address Guest Virtual to Host Virtual * -- 2.55.0.966.g6673acef38-goog