From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5397378C91 for ; Wed, 2 Apr 2025 21:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743630823; cv=none; b=FZ4oucxNAcgcgwsGJe5mlWUNxgxVapAQ9nmGLSvfsMoGD6WPL5CAl98Q2505Y0qlY5vboc3f+RZkEnryI7GlCwYkeRtF6QwtRQDuHZoxhl7g2PGQpgvPfFSSb6qCyVuRUmFClGZvyOrPC/M1tfLN5W/GilTN8MI+eKS1a77cfqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743630823; c=relaxed/simple; bh=JpDanlXe9QegmnfPomoDUIn66C3MOHKWrm8lVtqS3fk=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=hbCge3nM0iUtnRW1Su14pZFaJMOqdNc25fHDRirEjIBLAJ74k1gBLJ79j+BTTlHuGI1v7b7yMWUhb/c8BVyIcF4k9gXwA40j0u3jXnkyqKtHYWf8XkMxt0JoihtFcpI49g0zJyszdoRxdAD+wZI4nzADCCGwSabPAX+UCwOn9LA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MD4MyFHc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MD4MyFHc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDF6AC4CEDD; Wed, 2 Apr 2025 21:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743630821; bh=JpDanlXe9QegmnfPomoDUIn66C3MOHKWrm8lVtqS3fk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MD4MyFHcowHmbcA1fmtPy2lihfIGJmhMo/MRCLRSfUJJEzkDidU+ubv0fqe1CeQpr c542DkmsulRsWypYKU7ToJ5NhSBClDCVSHkJPev+4w0l/b/on+3Ktspbv7Pmj22wQU fauTp9nSPecSymwmnYce3nLsmZQNFUm24sRlltGSzNSCTQiE0DT8gDsQnlCUR8c8Of WMw33dSllUF8Pt4u6NQGG74XWEcED2egwOZd4VtUbjnwLOyGi5Ce1gQytprL8G/XTr 162FsJHKCUFNEvqXUtyNVUfB6QDTOumIprg7HZt173d0w33UEVnt+ihTrtn0ghNCFF xHw5EZguh3cLg== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] 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.95) (envelope-from ) id 1u061j-001nEA-EG; Wed, 02 Apr 2025 22:53:39 +0100 Date: Wed, 02 Apr 2025 22:53:15 +0100 Message-ID: <87bjtez0vo.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, Joey Gouly , Suzuki K Poulose , Jiaqi Yan Subject: Re: [PATCH v2 0/3] KVM: arm64: Fixes for resolving the fault IPA In-Reply-To: <20250402201725.2963645-1-oliver.upton@linux.dev> References: <20250402201725.2963645-1-oliver.upton@linux.dev> 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) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.104.136.29 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, jiaqiyan@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 02 Apr 2025 21:17:22 +0100, Oliver Upton wrote: > > KVM's heuristics for determining the fault IPA are a bit shaky and don't > necessarily align with the letter of the architecture. On top of that, > HPFAR_EL2 is UNKNOWN if an SEA occurred during a table walk. Re-walking > the page tables will replay the SEA at EL2, becoming a panic in the hyp. > > v1: https://lore.kernel.org/kvmarm/20250401224234.2906739-1-oliver.upton@linux.dev/ > > v1 -> v2 (addressed Marc's feedback): > - Drop section reference in favor of the rule for HPFAR_EL2 validity > - Fold test for Address size fault into helper, reuse existing > definitions > - Get rid of 'magic' shift for transforming FIPA field to an actual IPA > - Add BUG_ON() to handle_host_mem_abort() if we fail to resolve the > fault IPA. > > Oliver Upton (3): > KVM: arm64: Only read HPFAR_EL2 when value is architecturally valid > arm64: Convert HPFAR_EL2 to sysreg table > KVM: arm64: Don't translate FAR if invalid/unsafe > > arch/arm64/include/asm/esr.h | 44 +++++++++++++++- > arch/arm64/include/asm/kvm_emulate.h | 7 ++- > arch/arm64/include/asm/kvm_ras.h | 2 +- > arch/arm64/kvm/hyp/include/hyp/fault.h | 70 ++++++++++++++++++-------- > arch/arm64/kvm/hyp/nvhe/mem_protect.c | 9 +++- > arch/arm64/kvm/mmu.c | 31 +++++++----- > arch/arm64/tools/sysreg | 7 +++ > 7 files changed, 131 insertions(+), 39 deletions(-) > > > base-commit: 369c0122682c4468a69f2454614eded71c5348f3 My comment on patch #1 notwithstanding, this looks pretty good. Reviewed-by: Marc Zyngier M. -- Jazz isn't dead. It just smells funny.