From patchwork Thu Sep 14 01:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13384029 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 48F5AEE0203 for ; Thu, 14 Sep 2023 01:56:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F8EA8D0005; Wed, 13 Sep 2023 21:56:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A68A8D0001; Wed, 13 Sep 2023 21:56:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1ABD08D0005; Wed, 13 Sep 2023 21:56:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 06EA78D0001 for ; Wed, 13 Sep 2023 21:56:22 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D6A22120F28 for ; Thu, 14 Sep 2023 01:56:21 +0000 (UTC) X-FDA: 81233538162.26.2F17E13 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf19.hostedemail.com (Postfix) with ESMTP id 269D71A0008 for ; Thu, 14 Sep 2023 01:56:19 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=zlo8Z5FV; spf=pass (imf19.hostedemail.com: domain of 3Q2gCZQYKCEw6so1xqu22uzs.q20zw18B-00y9oqy.25u@flex--seanjc.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3Q2gCZQYKCEw6so1xqu22uzs.q20zw18B-00y9oqy.25u@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694656580; 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=m3Tc/K++HKyC1JKw6ryTn8bhcHxW+fZqtY22WqzjI8E=; b=E1v7+n4U+RwIDxCJi2mKaCZZZDy3EqdOtHk53V1hGTgIWQjIIm/06Cj74VsEkducgJIOmZ PgW/e7O3xhN+CV6Mf11dG7KpxZ5IqkAeg3u/nBuM3DZ4ZGGGOEm+lfP7vT3bOnziNs0EYs 9pqacp00+FklUL1WxdiuATvUxwx434Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694656580; a=rsa-sha256; cv=none; b=8VFpUzFWyrCXaZNybWfFt4FkOaRG8b8Q4tQzkwE4jqaUS3ZHFt6PlakMIhozG0kyShUNd3 jn9Bw/c0CcLw44zQNt0BRNp775S5S+hTaMkBmEdJKhl466ckwlsWx8Cm7g20IxenOyCxU+ x1UyQCLNfaE8eu5BRGFDJ+s1ZnBJCeA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=zlo8Z5FV; spf=pass (imf19.hostedemail.com: domain of 3Q2gCZQYKCEw6so1xqu22uzs.q20zw18B-00y9oqy.25u@flex--seanjc.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3Q2gCZQYKCEw6so1xqu22uzs.q20zw18B-00y9oqy.25u@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-59b6a51f360so6489847b3.1 for ; Wed, 13 Sep 2023 18:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694656579; x=1695261379; darn=kvack.org; 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=m3Tc/K++HKyC1JKw6ryTn8bhcHxW+fZqtY22WqzjI8E=; b=zlo8Z5FV8fMMyklMB8EJbgG8ul4qRTs42F21ZfMI8Hqjd1o4605znGzAbNxek0Getn iWdPH91zlTTnKi3nsUXKZ8/0qerTN/7YcQIEBTxLUQoK7Ldw2/NjTLAvOg4P/dxhDo7g q+7HBaN2VCwjudvYF4+yf5twDabK7lq7lufpHV4c1xAKkn1zebuPNeJoC/O8uQWcupjJ Y+F2hiBpsPuQA6lz2WvNTxSdD76HSbY73GvOQWZBtRzb+hyBao9m14BmCB4WosEBlW0U g1MNUGewKuZsF5X69fN5BZMlXUdIRUQ++Td0UfiJnG1a6UMuR4I3jr7H4FD/jICV2r7e CS5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694656579; x=1695261379; 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=m3Tc/K++HKyC1JKw6ryTn8bhcHxW+fZqtY22WqzjI8E=; b=SKyFFf6wk0QxInwhPnMo/Q0yegAnp2ZVARM2WOUOPsM3h1W6qth7ml/RI0TRTrLple 3Puj8HkI8f2bysQSUr0mBjsin7tZnFZv45xAt80YcX8i0n5M+K8TkKDlRieLhmtXPrnk w2nt1VzQd6X32EEEsXgHJuCN1NsUhQHZH+It2/Xt7JHSRrd6No1fAf26UuZ1W3vluxy2 I2E8pM5qIFk7P9lHRS2pNFlkUIxg23HhfWX6Zph7w/eXCqjwUpzH1Tb8oAe6ak5bc6x8 srTj8o0CEB+ft/jacA+aQS7XWWuInGPT7EiplrqUtSNtfDo4sUmbVpt8viZt7s2qvbg7 LzLQ== X-Gm-Message-State: AOJu0YxlNbhPEqWWIjPJaKnnoXQ4DEIL+QGcr7fkgVsxDdm//PXQLKos cdVJt3drndmVJEBriOWUllC3iMitbS8= X-Google-Smtp-Source: AGHT+IFDxQWOII5kHYcZMuAOGuYKUEYlYg+M0lPpcGlC7jaodEdrBYecqjufioLD9d6AjHIxw5JvKtydhZY= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:ae59:0:b0:59b:e669:c940 with SMTP id g25-20020a81ae59000000b0059be669c940mr41958ywk.5.1694656579341; Wed, 13 Sep 2023 18:56:19 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 13 Sep 2023 18:55:20 -0700 In-Reply-To: <20230914015531.1419405-1-seanjc@google.com> Mime-Version: 1.0 References: <20230914015531.1419405-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230914015531.1419405-23-seanjc@google.com> Subject: [RFC PATCH v12 22/33] 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 , Anish Moorthy , Yu Zhang , Isaku Yamahata , Xu Yilun , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" X-Rspamd-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EOSyQ1/EeF9HZgsRQG Xx76WjJd 1Xhog8Ea84o46rDd6untKdcmb7gxVoeh+KGDSqX1qRdyCvYlW6dSY6+JKd99SqNbVT8yVnRTyVL6aWE2DV5AHWWWoZeK3D3yY8jk6H8BUxuQqYeXNIMzseoHpJT7tp4rqiPpHCQgNuM3FV7qD25HnhSYJnkduj5AU7iTBIS6DuApGLjHzJpjZC3818K13uAI9ggguBxXQuWvDHZBcFj8Fm0Kmtz8OOxn4Fc6yrwJpWC9o4EqCrMi4StYbQsX9xkBtM5Iceu2VckOCX4WMfWYpAz4Dh5yXGqiG15vuhebrVIp8HXqXbFTJj373kawlHZ7NfRibTjq8dRqFt3UGt9jgM0YctTk8TBEKd+RW7XWp+jzEMtm8pZXe0FNuLk/I+1SqJ3NY6FsAbr6ZrkHgzhjs7AnQwT4Hu337I5J7njcMhp7SlMET2eFPLKMB66H20jP2Zt2GUeIFwK7iTNVlfpysfnV+ClVGaYb4qEdWdhSBMXxmT5+7vxCWOFaWgN+AjhG/DaQ4kmfCXthSTctGiQ/HIyyYlCpkkXx2RUJjj4yXDWcmagcwPPNu17kh4LlRDNubKVBn05s6xM7fgWncP/MtVKd6nAlt2h1MrxhBjq8QnneSzXanp0xaqdfyNgdDjxtjbDICdUveajg+bAeQad4xK6N2PsfpkwJDhhEikPmlXaADVyb//KuD08sge/uS7CDctAluEUzIRVoOAnujOCdgq8GtPaJLQ2dgbmguCJeH5dttti6JISi9O7NMP4nNzk+Wrpj/mKjpCQTB/P5eVRjfAo4EpQfzktI+pMKTAJPCi+0HyBggDlU/I1b5ED0LyRSZ9KPR 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 a18db6a7b3cf..967eaaeacd75 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -776,10 +776,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 7a8af1821f5d..f09295d56c23 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -590,35 +590,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) {