From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE89D2BF002 for ; Tue, 23 Dec 2025 19:37:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766518666; cv=none; b=pJhbNVxzLshA2HVvItdVyQ7lnVXLaZQnqXf1ahe0/jSf9M0QK4BmCDUNYYReQcJaxwHEPJKm/B0bwctG2VZG8hINVxDw207q16Gar0NZ5aGofnhpF1myH0k6ZgoDw7Re+Bhu8wddUi2npngBjRv0iz5ozOQGmLB/uQkqPaZrgho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766518666; c=relaxed/simple; bh=ln/VbRia+w4cejCBZYJ0Aic1cDCWAri8br6Ajm6FYT8=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=sritp3lr/2Hh/UMbYR8daC4KUW1ZoAgYAHwczBzcpDHpOtD3UbfPsSi79bEQ/HCWdT7OA619US1h6mtMQxTRI0p3u6DVwcR06NsqtPQX5w+UtS3LjPrFao4dV1UNUj0ap2HWGrkxiI1do9GrmS2f1V8fCFXuwetzI1+ESRWGn6o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--pekangas.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=qup9wT9f; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--pekangas.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qup9wT9f" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2a0c495fc7aso77135995ad.3 for ; Tue, 23 Dec 2025 11:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766518664; x=1767123464; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=mpE2cHSu7VEJSV8o9XAdCC+Pqd8elvYLdca31NEtq6Y=; b=qup9wT9fsxQgPHHmT/z15JGZK2hd5PheJtF/47BaeX6Ko9IlYBXoIMmbI4uqlOKSxn SneL479AzsrcxVNOTERjzlOTA60hvVFt/OOvVHLt2Nzmd85Nq2S6CD6nxV9RvVmSaz7I isgwMsN4oLhkzgofQFv5iNxsHID4an8seOrpq/4NkLARb/yMdque+Xom3tCrVmKAkCrt dzdrjyFLfBTwvilE1ZwvRXvp6fTIRzikIE3MWjkgUVGdKyo4QWB9C4DRBwdO8EOWiEUc I78VNUvJtU4g2BWQUhhkazKnAtJG36924Mhpr/t6JhrHmlTnG5Y9UddivcFKmXoaH+Mi EgWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766518664; x=1767123464; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mpE2cHSu7VEJSV8o9XAdCC+Pqd8elvYLdca31NEtq6Y=; b=riyOxjLbjepBU5c81gCcPF3GX+WLXwgT40jheTv+nViCqnZJRk2JGS6RWSje3Vb0TB n9lfPm7ifUmNlwtYehy+YgP1O/IaRQeIT3KXyV7kicH2Vqsx29d5L+56uoB3igIEAkJm 7nrRrZoqYMAPDtJ+Sw+MNEPBbOXzbDwsIVN1ltGqn1dt8GTFRr042doSGANwmW8PfuH1 TmMZ2QSUxJsdE/Z6BkXh6o9Kk7Uvyy1qawgwJaUjdE4YRcbPDfyAwhywtOQgB5wkZ/TW gL732kUNLgWa8nCIcvz140rN0LN/+IU+azPXVhv3R2zoL81b6jgvNvNJdTFE9mwnj+6J 7KOA== X-Forwarded-Encrypted: i=1; AJvYcCV4T4emMSgGciNZezP0ifGBpA4poyO8jmuq1+zphdaH0ZCnFdo9sNr9/PVrDSI8dtLfGnkxnq14rjGXymQ=@vger.kernel.org X-Gm-Message-State: AOJu0YymEqbZYKfa1GxVjh4wJbt2SGuc2drnSRP5rxZ4vETPJW9RuZ8C vQsUy80P/A6Tu3su+r6IcY4JrEUP/TNYvufynOIeyPVbl7Eqqab0T9mZt6hd7F0Z0yOEBcpsQzr q88LYnbCNGMgSEA== X-Google-Smtp-Source: AGHT+IF83L91Gh8tBV6+mxWodX8HXmAQvfSbCEAss+zVjQUMiFCvaVUUpvJKxJPo6RfJA6Fdt7OWobxVaK6jag== X-Received: from dlbto10.prod.google.com ([2002:a05:7022:3b0a:b0:121:7a50:e97b]) (user=pekangas job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:2214:b0:11a:23fb:16e2 with SMTP id a92af1059eb24-121721aab8fmr17386955c88.9.1766518663824; Tue, 23 Dec 2025 11:37:43 -0800 (PST) Date: Tue, 23 Dec 2025 19:34:39 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog Message-ID: <20251223193440.1441657-1-pekangas@google.com> Subject: [PATCH 0/1] KVM: arm64: Fix hyp VA size between layout and MMU From: Petteri Kangaslampi To: kvmarm@lists.linux.dev Cc: Marc Zyngier , 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, Petteri Kangaslampi Content-Type: text/plain; charset="UTF-8" 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. Petteri Kangaslampi (1): KVM: arm64: Fix hyp VA size between layout and MMU arch/arm64/kvm/va_layout.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) -- 2.52.0.351.gbe84eed79e-goog