From patchwork Fri Jul 26 23:51:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 1965497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=JNCyRto1; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=ju9p12X6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WW4lf5Zwfz1ybY for ; Sat, 27 Jul 2024 10:10:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dq+kwm/7pjdiMSV/xqFgYJoneDDIFQI8dqwiS33Kedw=; b=JNCyRto1/Fc+hE CminWc0xluDIJvZtuUeOywokbaahIyx4Br3TSND2iEjwY7my7V12ldFL2lEdZu2toNbfLJVK6OFdC OUQJLQXKFIe/yhT3m0IabKgKJr+7scA6U72fylhiJDWpdnvBcRFk3hzkZRVlsIQtgOM2bAeKOuRE1 Tt73AeJzQKUOKkrUpyHKrj6dytIrRI7G2QtkRsBYYY+wbWM8PYfRBcLJ+jw9HclBgsROPxKknR5qm vosjcztOxe90alZcUKqcFbccZkQ2oRMSz2ETrzpuhOIcBQNgwQ58wfdoDhz0CW+hX3gIa2BzfLOcM KNTwn4vEPfhcDS/aV1Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXV1R-00000005Zc5-2DAo; Sat, 27 Jul 2024 00:10:53 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUlB-00000005QI0-1kc6 for kvm-riscv@lists.infradead.org; Fri, 26 Jul 2024 23:54:07 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-66628e9ec89so6540307b3.1 for ; Fri, 26 Jul 2024 16:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722038044; x=1722642844; darn=lists.infradead.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=66tkjZePX8REZ4BHWwuGWSSOzSubgrfSmhtIFHX3PRM=; b=ju9p12X6+p/wDCj4zrSzx9/mhrb1zDVyOW9r7wxMqRb8NYmjAwtIFiJGGexQL5m4j0 ZIOPgjki2wu4af6yEX8NIcndPzvQE9VDNW9Z7f4BY2LZGpqhsZme6kf4Gona6LJeX7qU uVX3qdmF6zRPTkQ3ylh0O22ITk9LaixbXYH1xMAwQrYRaiRNhnhtT4CO49iIqChF184p aPFXcyQgmoG36OkGV2SU75GHbu9oSLMM7BM6YrMSdflBZSoxR8TwQLLOWv3l116AblTw giH3fB2yzx5rBumzR11mFuF60VCtpPI5VK53DdBSpDjPc898qju+AvC90enREb1a76pt IQKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722038044; x=1722642844; 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=66tkjZePX8REZ4BHWwuGWSSOzSubgrfSmhtIFHX3PRM=; b=vlRLphZC95jI/UmvXTiZvoRQdhPzz4xj3CQQg8ocpwy25v5/PkTFUq6IT+DUvGRmHR h8PmmMq8zrpfuI1cLWDjz+HzRaZLQ1UwE8E9L8ZA1TFFySAhjRTixN0zppOcM8NXaf4D WnmLkV0BSq0g28CvxI9YoZZjLc7GvDHJ9Tqg3KahJLsgpl5i/tIFr0TkArI82Bu9PLV5 bGVTmKYacXiUfZoD/tmoBTg9o6nmoi8XbhoWh/wulzaOt8aWfKU9J3gBUtzt8cQyyTya Ua/3DJvLbYoNQW+v8WPBXETPR+GS7xchLKapxxnHZ7SEB80sOQBo1FsSS0P3ePvwlLXf 7h7g== X-Forwarded-Encrypted: i=1; AJvYcCVKqJbW/DKpFt7SYP7IXOOMlnea+Krujwkx71uil/Es58rGa4ibdR+zTqVtzqKm5IpW6D39SuFttiwo3vtri3q0pksph1tLsJ8660VByA== X-Gm-Message-State: AOJu0Yxo1XOkvhx5d37b1itd44NZzAOTK8EpvreIvJEhU2u00wSfbOYs no4y5zbnPnDldF6asNoYGg1DRBD3wXbo1d07c+tVSuVDcSv0Rt24Ef8SOioLGTlK5HkArAOE+8j 3Uw== X-Google-Smtp-Source: AGHT+IEXCHhy0parcxZWaUKhAkA9z5ds6aScUvbMwsWWyatCr0tT87bBO0XasR4cX5mU+wgB/x+9BeJQnC8= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:690c:f92:b0:673:b39a:92f2 with SMTP id 00721157ae682-67a0a7fd778mr244297b3.7.1722038044118; Fri, 26 Jul 2024 16:54:04 -0700 (PDT) Date: Fri, 26 Jul 2024 16:51:51 -0700 In-Reply-To: <20240726235234.228822-1-seanjc@google.com> Mime-Version: 1.0 References: <20240726235234.228822-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog Message-ID: <20240726235234.228822-43-seanjc@google.com> Subject: [PATCH v12 42/84] KVM: Move declarations of memslot accessors up in kvm_host.h From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_165405_592548_3005166D X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -9.5 (---------) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Move the memslot lookup helpers further up in kvm_host.h so that they can be used by inlined "to pfn" wrappers. No functional change intended. Signed-off-by: Sean Christopherson --- include/linux/kvm_host.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) Content analysis details: (-9.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1149 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM welcome-list 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Move the memslot lookup helpers further up in kvm_host.h so that they can be used by inlined "to pfn" wrappers. No functional change intended. Signed-off-by: Sean Christopherson --- include/linux/kvm_host.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 5a572cef4adc..ef0277b77375 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1153,6 +1153,10 @@ static inline bool kvm_memslot_iter_is_valid(struct kvm_memslot_iter *iter, gfn_ kvm_memslot_iter_is_valid(iter, end); \ kvm_memslot_iter_next(iter)) +struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); +struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu); +struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn); + /* * KVM_SET_USER_MEMORY_REGION ioctl allows the following operations: * - create a new memory slot @@ -1290,15 +1294,13 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, }) int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); -struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); bool kvm_vcpu_is_visible_gfn(struct kvm_vcpu *vcpu, gfn_t gfn); unsigned long kvm_host_page_size(struct kvm_vcpu *vcpu, gfn_t gfn); void mark_page_dirty_in_slot(struct kvm *kvm, const struct kvm_memory_slot *memslot, gfn_t gfn); void mark_page_dirty(struct kvm *kvm, gfn_t gfn); -struct kvm_memslots *kvm_vcpu_memslots(struct kvm_vcpu *vcpu); -struct kvm_memory_slot *kvm_vcpu_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn); + kvm_pfn_t kvm_vcpu_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn); int __kvm_vcpu_map(struct kvm_vcpu *vcpu, gpa_t gpa, struct kvm_host_map *map,