From patchwork Tue Jul 18 23:45:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13317887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38D72EB64DC for ; Tue, 18 Jul 2023 23:49:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ACA51280010; Tue, 18 Jul 2023 19:49:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A72738D0012; Tue, 18 Jul 2023 19:49:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EC39280010; Tue, 18 Jul 2023 19:49:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 75F248D0012 for ; Tue, 18 Jul 2023 19:49:09 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 52877B0DFC for ; Tue, 18 Jul 2023 23:49:09 +0000 (UTC) X-FDA: 81026376018.13.4A5967D Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf21.hostedemail.com (Postfix) with ESMTP id 7CE221C0021 for ; Tue, 18 Jul 2023 23:49:07 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=S9i20yQ7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of 38iS3ZAYKCEUzlhuqjnvvnsl.jvtspu14-ttr2hjr.vyn@flex--seanjc.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=38iS3ZAYKCEUzlhuqjnvvnsl.jvtspu14-ttr2hjr.vyn@flex--seanjc.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689724147; h=from:from:sender:reply-to: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jNVa/iQ+AVctjdypzscw/wZ/omqP7xdpmmirAsZhWLw=; b=o48UVVUhAlCkDlHE9ig79XCqeANsOi2nDm5BMI94LR6gE4tb1i9GC33afvGKEuuzuF6Am6 KUYbgMCiK51obCIFQt8/mFF7o/I/225jWdfOygVULqCGyunkt1TaNZ5ik9dZfUxwvC/9FG iHfqgsEBBIQs+BB++D/mSg7Q5kPYUTk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=S9i20yQ7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of 38iS3ZAYKCEUzlhuqjnvvnsl.jvtspu14-ttr2hjr.vyn@flex--seanjc.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=38iS3ZAYKCEUzlhuqjnvvnsl.jvtspu14-ttr2hjr.vyn@flex--seanjc.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689724147; a=rsa-sha256; cv=none; b=qa6YzlbfVbZooyj3DCLqAWfn1ncH/SkdXpAvqX5VTVCl25+HCeRKy1/SJ4dXTO9JrBFC7f XSe0KaW7OBHrwm9fw6iKN7vAuExQWgJkhlozT42Lxr4FVcu1RGb8TPsWUxYsW0R1SL21Rt VPfF7AwCphTtU14mYSXdmRxCvoYggt4= Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-1b9de3e7fb1so32328035ad.1 for ; Tue, 18 Jul 2023 16:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689724146; x=1692316146; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=jNVa/iQ+AVctjdypzscw/wZ/omqP7xdpmmirAsZhWLw=; b=S9i20yQ7jB4hVddDMJ4CkO5T1TWmd4hfWWkq8Xl9LowlAEQdj2ZBN4AmHJWPyNUeoT CkrrWKNwK4ZqQLVQM2y6BQWzimiT4YCPNLG/XY2OgxS9elbM94AeEwd6oVkZtS5CMdNQ enYmJItt+taFRfJF03P5U3tsXYvhEykGsai5MRAd/rpILORWE8Nwwq/35e1lrZlSdKCf nnux/I5fy00kI9O4nAFwoaKQfkECwHaMBer7UN6aWCOBJCp2NOyFIamjX8g6Muuevcj+ zN2G8rzvgNhVTfZL/D1gpgeoLq9Z9aveGPtzRcTPzuDzimSMVNdowxyXn99BRYpLpXYL a5VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689724146; x=1692316146; h=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; bh=jNVa/iQ+AVctjdypzscw/wZ/omqP7xdpmmirAsZhWLw=; b=W2o3y2UVufv81j2XYbXQZXQkEE9PuSJh5Bv/FGxPMkvFHAgKPkFAEpv3GbRxldP8TP ZoVO/SFu1nU5rwAKv7Okf/IoDa9iFjkCEhCynIwRnjGeNvGAev3T5VTK78zicf9e50SN FqMw2UDDv8rFmjxGyZLx3UcbHhEAJCx7hkNQOALhBtfdc5QjZk40YypmDliypHOk/+4f n1cR+ZUyb2MQJFbncsaLC+lJb1DW6yCTaHFc4GAYvgmCSKZHu0nZhknc/6Llkq355CJN ivjZthE5PpF2CIxDGAXNb/JTRf/oDeYOsmYyc5Bc0y7xv6jZ9389D7ZvwdSvBrjCVf9g ihHw== X-Gm-Message-State: ABy/qLaz/Qfq4ax8pcdO6aAcmVpey9B1qM5boW7Mg6rnyybuVapJ7DKv hSj1A6m5UjdPdCJ4bJsLHHL84SWoUN0= X-Google-Smtp-Source: APBJJlG/sMr3G/sYhFjIAPMZFMzUGPYNnqDIC48VMqcoxoy+9ZQXw2cmdVjFEV6r5k/FZaKWiRT4xFOW180= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:d503:b0:1b8:8c7:31e6 with SMTP id b3-20020a170902d50300b001b808c731e6mr17710plg.1.1689724146247; Tue, 18 Jul 2023 16:49:06 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 18 Jul 2023 16:45:01 -0700 In-Reply-To: <20230718234512.1690985-1-seanjc@google.com> Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230718234512.1690985-19-seanjc@google.com> Subject: [RFC PATCH v11 18/29] KVM: selftests: Drop unused kvm_userspace_memory_region_find() helper From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" Cc: 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-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" X-Rspamd-Queue-Id: 7CE221C0021 X-Rspam-User: X-Rspamd-Server: rspam04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LkR3RAK1HZkVYKcqiE1bWdD475i9Wv8Rw/myfnEixUfA/C5w9fNm+rbWE5QKSAHIbavRLO56aI9Ds0zfcFWp8Tynu/VUcken7bekD8W9vCL9M5Zbz9Ro2FTgA7uywRoIHkRPKIhr2rmywQgDavn6umVCw/A8FlW/wQvE9r7xVayZVoKThnyMR3647o1mF4DVfOWtXNxnXZ/RnW+Gqf1XwX+U5QtVMAGJkXmOQ9tyXjwEGKe68iYwml/0Kt6TjgRYrMki1DJ1vkM/XojW1P81TLUnWQQBxfKEChCLBXTG7PzvWkVSEZnXzENkn2nvcFxao6UqOkBcLy7auK3VZ3eMzBvJ1KUxu29AnwI2Bd2WvUr/LYCsFiO2hEm56uDlkIsWAmOLYK34VUreZZ8lGHNkhXGnQCR2r8aAgxJypOOEVhrwuteqDKXPo3YJ3SqOHrOC3XrAVn5BdLexwX3dAb9KKlxY14cMqAz3rPIHL7PlmtMk+kVpGDu/LHuKlmB1WhSJYC7B6ri3rwlnCdbfJDnK1IyvO6QV1DCQIryyFz45yjZ+RbTKPItbELBi7MQPLK1Ih3j1bopNdWTP/QGiVokWe37UZ5BZeXjg1kb0B2BxyZpAXyWSVgEUimlUy1751zFXYNZFMmQ91s1XkBIIMrFAuGFmxIfs0RqJykpO4lHL/ICCgupDI48IpB1dzcFPfX6YeSAlyjVA6xkBxkc3Z9/jva8pFmdmnhPB3NglQYdWPoGnWCKQPNRJHlgVgjoLlPyTkrTo+Wfe2smcaU54F1LTyiXsXhV1CEYPe9H/r8iolOMyg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Drop kvm_userspace_memory_region_find(), it's unused and a terrible API (probably why it's unused). If anything outside of kvm_util.c needs to get at the memslot, userspace_mem_region_find() can be exposed to give others full access to all memory region/slot information. Signed-off-by: Sean Christopherson --- .../selftests/kvm/include/kvm_util_base.h | 4 --- tools/testing/selftests/kvm/lib/kvm_util.c | 29 ------------------- 2 files changed, 33 deletions(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index 07732a157ccd..6aeb008dd668 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -753,10 +753,6 @@ vm_adjust_num_guest_pages(enum vm_guest_mode mode, unsigned int num_guest_pages) return n; } -struct kvm_userspace_memory_region * -kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, - uint64_t end); - #define sync_global_to_guest(vm, g) ({ \ typeof(g) *_p = addr_gva2hva(vm, (vm_vaddr_t)&(g)); \ memcpy(_p, &(g), sizeof(g)); \ diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 9741a7ff6380..45d21e052db0 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -586,35 +586,6 @@ userspace_mem_region_find(struct kvm_vm *vm, uint64_t start, uint64_t end) return NULL; } -/* - * KVM Userspace Memory Region Find - * - * Input Args: - * vm - Virtual Machine - * start - Starting VM physical address - * end - Ending VM physical address, inclusive. - * - * Output Args: None - * - * Return: - * Pointer to overlapping region, NULL if no such region. - * - * Public interface to userspace_mem_region_find. Allows tests to look up - * the memslot datastructure for a given range of guest physical memory. - */ -struct kvm_userspace_memory_region * -kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, - uint64_t end) -{ - struct userspace_mem_region *region; - - region = userspace_mem_region_find(vm, start, end); - if (!region) - return NULL; - - return ®ion->region; -} - __weak void vcpu_arch_free(struct kvm_vcpu *vcpu) {