From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (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 D5AE719644B for ; Tue, 13 Jan 2026 19:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768333457; cv=none; b=uUKEkQxec3oOP/6mVA82h8SP5EDdBtsDahpeGHij2K3P6HTQnxKoBxoOqHa8lR/cnLVPXfjDJERtmbIg1hW+tuyZdGMbeKm4vuc4wQEymCo482+MdQkMZWibJcnXRSAM0U1y2Oh5ujKGK/abOD1kykj8pMnUzsnb0D9hXJ23Gb8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768333457; c=relaxed/simple; bh=n24GXqBwqppxIfs2NYlKXmJaWJIje+KKZFhh6y/IuS8=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=IsY9KErSoKj3u81nTt7xGgZnRpE4kv6bfWzDzzylqSEWaajg6xid+1jkMyPAcrghLkKiP8ziNN8vjlns3vnWKL02PPwKuJzcBWG+K+XcdWJ+rakcMr8CjyXVIyYdPoZuQEhFoakQKj5QQBhPPG0t8EygfilgzqPOeuFvwSqwKsU= 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=oI4+dc2+; arc=none smtp.client-ip=74.125.82.74 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="oI4+dc2+" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-11b7dbce216so11488490c88.1 for ; Tue, 13 Jan 2026 11:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768333455; x=1768938255; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=RIhN6dRLokM9eZt/p8tgQxPQl4snplBSSr5i8hEn3SY=; b=oI4+dc2+mP9HgW7bOqVL0C925znF+I1EJqleolr2zuRURUw0JaTLS6TW4h5Rs0+T0a 94u4F3pu6U/VaH/+UoK4GqAlqrA2GwqJbXSswLz2cYUJ3rpB98/0Wh/H9MawAdDX+a4G OFtgHwnopIV2nAc1EHtZ4OPTVH+TPOJRTuaN60NUeML837aBzy4n0DDN20GjFoS2NfW0 hSQD41X2HVn6g/epA53S966okBU5QhgqfoQ7nWRU+EB2mGGOJEJv3aeXv6lLyQU8BXq4 SvRyf6GZogqM9T+uV3ydH0EZLLJW8jdUSECubbRKFwa87+lpcb7zQEWIvuDBUbjh/hUC Bmnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768333455; x=1768938255; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RIhN6dRLokM9eZt/p8tgQxPQl4snplBSSr5i8hEn3SY=; b=P6Thqo4tBJvkGBBVYSWabzygtBTjh9wvZnpTmeXYWBYjQC3cS4WdN1Zjy1K9kpoiYZ jonx5CWb6rpYuVPuYkw8tpb1u/JIFZFwNcBEqpSHOzJe2lsj62CorL3sRLOTziXFvY94 iRLZ50WMB7TbX2KAUw2KNRp50EOd00oxr4/I6nI8Ye2yE1LBJM06fyHZzbR2kLKsg8M9 8u/gPDnpVK+N0reA4hs21IbDSQPojQ/4CLWRj4JNCCuv66MldElMnVNds2WN7BhfSDhN SnxMCkcSv76mD0Llz+Wbm4Gwe0BIonRSPHaU0wVzCBnLysGuNybBAhv06Xv7oSfMYTYg l09g== X-Forwarded-Encrypted: i=1; AJvYcCXAzoN0k+w7J5jqZ9NRXMwl356IKlok5iPgD0Pir63IrTHG6XplJDi8gyZrVqSzRRCi+nyYFEDh2SVdaMM=@vger.kernel.org X-Gm-Message-State: AOJu0YwVhGcwXIwTjykEYDQmhDwCfpdc1a9ePUDMcbBmqg4A6fk5qqru g6NzEHt1NlocfqpL1OY5ocrhay9tGjT77cEYlBDN0UJsQ9g7+WixyJN2otH1LwPaR5M8RervH2z b0yTCpyNbC/Q6Bg== X-Received: from dlbrp10.prod.google.com ([2002:a05:7022:160a:b0:119:49ca:6b8b]) (user=pekangas job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:7f14:b0:11b:9386:8256 with SMTP id a92af1059eb24-12336a9084emr94672c88.43.1768333454899; Tue, 13 Jan 2026 11:44:14 -0800 (PST) Date: Tue, 13 Jan 2026 19:44:08 +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.457.g6b5491de43-goog Message-ID: <20260113194409.2970324-1-pekangas@google.com> Subject: [PATCH v2 0/1] KVM: arm64: Calculate hyp VA size only once 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, Here's a reworked fix to keep VA size calculations consistent between the MMU and layout initialization code paths. Previously, if the kernel was configured with a VA size of less than 48 bits (like happens in our environment), the assumptions used to calculate hyp_physvirt_offset in kvm_compute_layout() and the code that determines the VA size used in the rest of the system (calculated in kvm_mmu_init()) would get out of sync. This could eventually result in mapping failures. The patch here is against 6.19-rc4 and tested in default, nVHE, and pKVM configurations thanks to help from Vincent Donnefort. Detailed knowledge of the address map remains somewhat distributed inside the codebase, but at least everything now uses the same VA size, and further refactoring is probably best done if/when Will's pKVM changes have been merged. Petteri Kangaslampi (1): KVM: arm64: Calculate hyp VA size only once arch/arm64/include/asm/kvm_mmu.h | 3 ++- arch/arm64/kvm/arm.c | 4 ++-- arch/arm64/kvm/mmu.c | 28 ++++----------------------- arch/arm64/kvm/va_layout.c | 33 +++++++++++++++++++++++++++----- 4 files changed, 36 insertions(+), 32 deletions(-) -- 2.52.0.457.g6b5491de43-goog