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 05C26C02198 for ; Wed, 12 Feb 2025 14:02:30 +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=0R4lDkq2K1TBSKA5CGJ3S9kgBVL3BKOCpYdVfO1XhEs=; b=ZmBhV4J86DWbdaAsKpmjTj6AkH o/6uJp3GpcMyIXrYGLxjtsWSgTXnjng4vdzoy2tTjDO5l3AQkGgL3uSuAIJzS/NYuRQCvthHnb/7x xXhb9H+BThVy++h4REcF68TpIvcdZJ0uIyppwKBVYxHWtlvVTMYTe5fvmkqAPOh6Hm//bKfpT4E24 Kuag0FfrjtIzWEsO0cvbBhP09S6ijWMkJHgnI5I8A8eIFy+NSHtLHPpD0FwILzP9VUqY1XQIfBVBI PwERhM9zWgVS443BKo6KgWROwABuS9+V+0WPxPXXv84ifHo5Lbf0Vtx1D0gwwwBYJEwIYoM8q7cer 1oTQRkvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tiDJj-00000007ahd-12Pz; Wed, 12 Feb 2025 14:02:19 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tiDI2-00000007aOr-3RYT for linux-arm-kernel@lists.infradead.org; Wed, 12 Feb 2025 14:00:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5673FA40278; Wed, 12 Feb 2025 13:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57979C4CEDF; Wed, 12 Feb 2025 14:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739368833; bh=ldu5Hug0iWK7d3nKUXsHU/BLDd11OVchE/dle+jdsu0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VE8ttz/g5kqAa2Z3NE9FsT/CQeN6jTNDvS0YE/U/ohrpJ/oI9ufmW6iJ1f42i7aEU RlaeIxfNXa+SOQ3E3f0zhZAzmg0yRIcxEDqZTVTvGEt3zfuFhHzT0qJPkbnf/YQBQs b2bIZ4w1lvO/YN7lVdI9zneqaVqCxYCYQTuhD/2NZ15b+iv5lbv8Hq0s5FGyrpweQ5 +2eSsy5j1atKS1s2mhQpLvomkuaEw9syJaTZrjDU4A10dzRaPLjrCJQ6krnDNI+XaA Audgze1EnkQvkcNTFLtKRFCOha9zAA5rJRWTwRMnWlyAKscP01LZuPDFjuEtfUuvkr oSj7PK5uUaXOw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-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 1tiDHy-003MNw-UQ; Wed, 12 Feb 2025 14:00:31 +0000 Date: Wed, 12 Feb 2025 14:00:30 +0000 Message-ID: <86wmdvs1oh.wl-maz@kernel.org> From: Marc Zyngier To: Dan Carpenter Cc: Naresh Kamboju , kvmarm@lists.linux.dev, Linux ARM , open list , virtualization@lists.linux.dev, Mark Brown , Catalin Marinas , Arnd Bergmann , Anders Roxell , Aishwarya TCV Subject: Re: kvm: nVHE hyp panic at: __kvm_nvhe_kvm_hyp_handle_sysre In-Reply-To: <3902208d-8814-46fe-ba98-3db833b9a886@stanley.mountain> References: <8634gku30g.wl-maz@kernel.org> <3902208d-8814-46fe-ba98-3db833b9a886@stanley.mountain> 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/29.4 (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: 185.219.108.64 X-SA-Exim-Rcpt-To: dan.carpenter@linaro.org, naresh.kamboju@linaro.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, broonie@kernel.org, catalin.marinas@arm.com, arnd@arndb.de, anders.roxell@linaro.org, Aishwarya.TCV@arm.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-20250212_060034_986920_8F495756 X-CRM114-Status: GOOD ( 17.30 ) 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 Wed, 12 Feb 2025 11:41:38 +0000, Dan Carpenter wrote: > > On Tue, Feb 11, 2025 at 11:36:31AM +0000, Marc Zyngier wrote: > > For the crash at hand, which clearly shows nVHE, can you report > > whether the following hack fixes it for you? > > > > M. > > No luck, I'm afraid. It still crashes the same way. Right. It was one level deeper. The following change fixes it for me. YMMV. M. diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h index f838a45665f26..b899d815d272f 100644 --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -501,9 +501,22 @@ static inline bool handle_tx2_tvm(struct kvm_vcpu *vcpu) return true; } +/* Open-coded version of timer_get_offset() to allow for kern_hyp_va() */ +static inline u64 hyp_timer_get_offset(struct arch_timer_context *ctxt) +{ + u64 offset = 0; + + if (ctxt->offset.vm_offset) + offset += *kern_hyp_va(ctxt->offset.vm_offset); + if (ctxt->offset.vcpu_offset) + offset += *kern_hyp_va(ctxt->offset.vcpu_offset); + + return offset; +} + static inline u64 compute_counter_value(struct arch_timer_context *ctxt) { - return arch_timer_read_cntpct_el0() - timer_get_offset(ctxt); + return arch_timer_read_cntpct_el0() - hyp_timer_get_offset(ctxt); } static bool kvm_handle_cntxct(struct kvm_vcpu *vcpu) -- Without deviation from the norm, progress is not possible.