From patchwork Wed Jul 31 19:40:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13749137 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82850C3DA64 for ; Wed, 31 Jul 2024 19:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sHL+YdtQQxieq1L5CjR6fCRcDQ3gPoP8CLkiZmQSGD4=; b=Qtwz4UKKtB9NEGzZjmYK0MiHJ7 pYWM7rMGW8qHuHspe8ew1EmV+e1knzWqyG/3UZmsjbOePRm5sbj7Rsner5A+VELx18SaUv0mAxqmk HsyUN5Y3NlvK07yDKOMnlq2GDOsRFbd16ghLhCHmDVYR0DAfd2mfIwyua1HhEtbjevCwy54zJ0ata lyYdM5sZeVMcJnh6BViFm3hadGJJRcTu4q3unnSSN9rSv+Lk4h8P057oJhRoxQv8+9K/RGoQRrhUF 8qkU/q0+Nn+bsIzfY9sxf9uEnmHjFPAkKbuVE7iDH+Kwns3tjNKs5Xn1LXBJsnPjD0pntHj+1/tyQ w/pGuAjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFGr-00000002LNh-04fv; Wed, 31 Jul 2024 19:46:01 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFBy-00000002JiD-3VQy for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 19:41:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 767D762611; Wed, 31 Jul 2024 19:40:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46BF8C4AF0B; Wed, 31 Jul 2024 19:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722454857; bh=anTP4GOgAa7/16Fbft5Apd2q5jNqO8ce2tAPvR+UTQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRGme0z4j5sVnaJ/9S4tPTS7bNmCNoIWdqV2dK5sYm7/F4bd9WMa8Sq+v0rugHlc8 BdduxbF+hRuryV/zLYvtTyj0epmu8OhB2a/xSxKCBBB0o8kb/ctdmCj6GddUhGIZTI Rcdi6rNOeL54qgO3v76YPPEf4zOvU9219rpRX93oBUng9dlXvzD1quk/wwLdAplAcJ kE66tONTTbKdXeXDMZStvw0LulSuQduVnfPE+v1viaMR50vnq3Zlge5OClC7LftSvT A4Shnkfy6kSrEr0s5rcgfHdV1a8YuzQYXqScRTTEcrLqBkBEXMZoaeQ7IB8Oqi/Bjr Xzg43fmfknOGQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sZFBv-00H6Gh-HY; Wed, 31 Jul 2024 20:40:55 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Alexandru Elisei , Anshuman Khandual , Przemyslaw Gaj Subject: [PATCH v2 12/17] KVM: arm64: nv: Make ps_to_output_size() generally available Date: Wed, 31 Jul 2024 20:40:25 +0100 Message-Id: <20240731194030.1991237-13-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240731194030.1991237-1-maz@kernel.org> References: <20240731194030.1991237-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, alexandru.elisei@arm.com, anshuman.khandual@arm.com, pgaj@cadence.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_124059_142862_0CA5D786 X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make this helper visible to at.c, we are going to need it. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_nested.h | 14 ++++++++++++++ arch/arm64/kvm/nested.c | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/arm64/include/asm/kvm_nested.h b/arch/arm64/include/asm/kvm_nested.h index b2fe759964d8..c7adbddbab33 100644 --- a/arch/arm64/include/asm/kvm_nested.h +++ b/arch/arm64/include/asm/kvm_nested.h @@ -205,4 +205,18 @@ static inline u64 kvm_encode_nested_level(struct kvm_s2_trans *trans) return FIELD_PREP(KVM_NV_GUEST_MAP_SZ, trans->level); } +static inline unsigned int ps_to_output_size(unsigned int ps) +{ + switch (ps) { + case 0: return 32; + case 1: return 36; + case 2: return 40; + case 3: return 42; + case 4: return 44; + case 5: + default: + return 48; + } +} + #endif /* __ARM64_KVM_NESTED_H */ diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index 3259f4fccdcd..695a1b774250 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -103,20 +103,6 @@ struct s2_walk_info { bool be; }; -static unsigned int ps_to_output_size(unsigned int ps) -{ - switch (ps) { - case 0: return 32; - case 1: return 36; - case 2: return 40; - case 3: return 42; - case 4: return 44; - case 5: - default: - return 48; - } -} - static u32 compute_fsc(int level, u32 fsc) { return fsc | (level & 0x3);