From mboxrd@z Thu Jan 1 00:00:00 1970 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 77CB1EE020B for ; Tue, 30 Dec 2025 15:34:40 +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-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sHZNza5H0yo0+WpXCR20t4zu708adlm5RFd/Ch5En9c=; b=QJqgTZiD0cLj0XNTBWoLCmfCzr DAD8+Nyjs2zHFae/gsQr9Nyaoodw4zkX00CYHVOB68FsOksbFQrPZOAwA7KGrRON70f/4AGfoN5Du spLY7klo1fMAsxUzSKNH6H4pYfHNQ53SVpATPa1jHOxAHi3eLKquiwd9iVCmt4RgTKAvKNvslE1Oc MI3lOUfG5EwBZ/dxupPT+XhRRPlr1LkXBXuL3+st6VPf+QTTaviW8gehRAaQV8ze8FBNPByPrGHQv dKWnlhQHs/9lvdJFF7LITirmTwQusirpG1mHxyJk5dC/sDAEJJPnJaMoSeUKfP29pVork9T9CMV+p 09tyUxhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vabk3-00000005084-01Ag; Tue, 30 Dec 2025 15:34:35 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vabjz-0000000506P-2o2V for linux-arm-kernel@lists.infradead.org; Tue, 30 Dec 2025 15:34:33 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id F2297442C4; Tue, 30 Dec 2025 15:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9139C4CEFB; Tue, 30 Dec 2025 15:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767108868; bh=yjdh34Hmqne37G11Loiam1Ed+hhJrJ/NSB0q9oo+YsU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iTzabqQCHIVzDVkUuv8Shn2YZNuawMeUh8aV1N6CErDCet3+LEFPixMu+9bbrYIpb P9OJ8qNFVCsHn8c1ZH66hfK9Dv+3tC0sQ3xTN/niouoT7t+i5GVnmWhxmpydzTrLFT 3zvxyqIf0XbPXivH1j2TG5L7SbKQISmm9lMnEMlyFaatvbMcGlb6rVe48isAyLWXEu 2I+J2Wxv7BP8S3iSDhCCIPnF2Lexi3c2N7pFvXzfxbgRRsnaLCMkoL+jDByadCmcL5 EDVId8HE+fASLPwmFMPZ+oSKSzJC2woNESvh13YUSuLbyJZPNzlpihgkUrMPsL9RyM FjSwmdoy1zVNQ== Received: from lfbn-nan-1-2237-32.w92-139.abo.wanadoo.fr ([92.139.188.32] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vabju-0000000G12w-1N55; Tue, 30 Dec 2025 15:34:26 +0000 Date: Tue, 30 Dec 2025 15:34:25 +0000 Message-ID: <87qzscdlvi.wl-maz@kernel.org> From: Marc Zyngier To: Petteri Kangaslampi Cc: kvmarm@lists.linux.dev, Oliver Upton , Vincent Donnefort , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/1] KVM: arm64: Fix hyp VA size between layout and MMU In-Reply-To: <20251223193440.1441657-1-pekangas@google.com> References: <20251223193440.1441657-1-pekangas@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 92.139.188.32 X-SA-Exim-Rcpt-To: pekangas@google.com, kvmarm@lists.linux.dev, oliver.upton@linux.dev, vdonnefort@google.com, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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-20251230_073431_729971_3B6E92F0 X-CRM114-Status: GOOD ( 22.46 ) 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 On Tue, 23 Dec 2025 19:34:39 +0000, Petteri Kangaslampi wrote: > > All, > > In the KVM initialization code, kvm_mmu_init() and > kvm_compute_layout() use different logic when determining the > hypervisor's virtual address space size. Specifically, the MMU code > uses the larger of vabits_actual (the kernel's VA size) and > IDMAP_VA_BITS (48 bits), while the VA layout code just uses the > kernel's VA size. > > This means that if the kernel is configured with a VA size of less > than 48 bits (like happens in our environment), the assumptions used > to calculate hyp_physvirt_offset and the code that determines VA > ranges to use for mappings in hyp/nvhe/mm.c get out of sync, which can > results in mapping failures. > > The immediate fix is pretty obvious and attached here. This is against > 6.12 but I don't think this code has changed recently. I think longer > term refactoring knowledge of the hypervisor's address space into one > place might be helpful; currently it is a bit spread out. I'm sorry, but posting a patch against a kernel that is over a year old doesn't help. It may apply, but it doesn't mean it works. Please post a tested patch against the latest released kernel, or even better, the latest -rc. Thanks, M. -- Jazz isn't dead. It just smells funny.