From patchwork Mon Nov 20 13:10:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13461279 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 EBB8FC54E76 for ; Mon, 20 Nov 2023 13:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jpKxYmDVtLMbDlLv7b72yqPb2RSbv+6RsqIJ2c+XRpI=; b=KaX8myFIbOH1ED gdyakd1/r3Qxiqfrcax9DY8bD85zSxPXbSkU+xExCBV0mmqvKgx/nru8+YgnjCx4LdXVCvKMju17s KyJ0b+sJexAP/nv9ijDD0z9xIe9UqkaIFU6F9quO2OtTDtDBxvMUrhKgqDuGbpHRBuV6bmKRj3wX7 1lK5fg7VLl6wDKXywtu75a5eI0NbPtX5xIDmw4qU52srt2OUW6nbtAnmmtE9hpMnSBW/tmnmfkskP xOYzbAWiu2tK1YJjBe3cwjDdJDRgWgHzvtmHoyuPcbUTSCQvPLx/0zL/qXeASVZmTKBk+8lU/uaPM 5G74yZpAb0WdxGvqI7HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r548F-00C6qq-2N; Mon, 20 Nov 2023 13:16:07 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r543Y-00C4nC-1i for linux-arm-kernel@bombadil.infradead.org; Mon, 20 Nov 2023 13:11:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zBW87ZqrPl9VB7sMEpuEx4o1ryiTNd2ChoQTaX3ciSM=; b=ooN8eyxwv6vsvSnEd/gFQtnt2i An84e5eG404VOjvX/kOFM5XYBGnvC4bF9ilPFOFJMPT1+/VmoKitRJZgOEQlmhLxMsfsSCAaNOiQQ u02B4BofqXHX7m43Ig0d8EKJrprcbDciBW3iQ6pfaM0fX0Vbe4cwp7s45t/6djizOeSl3P3ayhVyg hq3n2a0ysdbVrRCNTjW0tfNhFGmG2XPf54wEoEuantLT8al6wtaP6ePRcDDHYoZYS3k1Nw4eZdxsJ zNsvvvA560cwUISLYRTPgzu2d/02YfeKOKSujzmc+gL/YgtbMuj/TooBNFKbmn6MRnN4s+Kf61zVQ d335NqhQ==; Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r543R-00AyE4-2p for linux-arm-kernel@lists.infradead.org; Mon, 20 Nov 2023 13:11:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7A379CE12C3; Mon, 20 Nov 2023 13:11:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ADFBC433D9; Mon, 20 Nov 2023 13:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700485858; bh=bP83ftsypEW2Jn7uyd2J7ARa9PjWnGRMdQv8sDbZHW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j3ecHGFthTrUTiekBw61jyJsizSd+CqNfr/HAgt1YMLxVJrnghn+m8M2UvDctqKLP Dgy1z+zvrEPlZRqI+iCimLga4UXMa7/ZLpTbgD5s3uzKBrirMcTk4+HOJdq5rvde8G clmEM0bq2QOSv5M5QRxbnfifiCSRnhGAXKwqiqBln/Opmf9TQ2qoaV105u7zEZyV3u shiEzt2Y78mceFxa/EMiMV+MklIMXIHiSFyjwqUw5alFX9RbiXYPbMSDPZyAvWfYjy sg+g6ag0DFGcfeHAlIoSYVMXbpD8VfXEvJ5Pv2cHKzJUEi7GE9pSSBN1z145dgQI1R S4A2R2ApzTkGw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r543E-00EjnU-Hn; Mon, 20 Nov 2023 13:10:56 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Alexandru Elisei , Andre Przywara , Chase Conklin , Christoffer Dall , Ganapatrao Kulkarni , Darren Hart , Jintack Lim , Russell King , Miguel Luis , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH v11 29/43] KVM: arm64: nv: Load timer before the GIC Date: Mon, 20 Nov 2023 13:10:13 +0000 Message-Id: <20231120131027.854038-30-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120131027.854038-1-maz@kernel.org> References: <20231120131027.854038-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, alexandru.elisei@arm.com, andre.przywara@arm.com, chase.conklin@arm.com, christoffer.dall@arm.com, gankulkarni@os.amperecomputing.com, darren@os.amperecomputing.com, jintack@cs.columbia.edu, rmk+kernel@armlinux.org.uk, miguel.luis@oracle.com, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.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-20231120_131110_621224_8529D6DE X-CRM114-Status: GOOD ( 13.83 ) 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 In order for vgic_v3_load_nested to be able to observe which timer interrupts have the HW bit set for the current context, the timers must have been loaded in the new mode and the right timer mapped to their corresponding HW IRQs. At the moment, we load the GIC first, meaning that timer interrupts injected to an L2 guest will never have the HW bit set (we see the old configuration). Swapping the two loads solves this particular problem. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 35f079c3026c..683a2e6ec799 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -453,8 +453,8 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) vcpu->cpu = cpu; - kvm_vgic_load(vcpu); kvm_timer_vcpu_load(vcpu); + kvm_vgic_load(vcpu); if (has_vhe()) kvm_vcpu_load_vhe(vcpu); kvm_arch_vcpu_load_fp(vcpu);