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 772BA2C0F78 for ; Mon, 16 Mar 2026 20:17:19 +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=1773692239; cv=none; b=a06I0vEO4Nh2/AXI+Nj92G9D0B81gaNkwsVrRPDUgV+SwIviHqIncMFW7GfcUo/ezRAv6wgw/+aRRGPkGpfwjOvnUyGweIjEZbvYWT4/3/rAkgBvN1Ka1Jgw2z4M2oXC1fY9y7B/lamYc6BKcDkyNudTGoT6bNusANgs/kZUDXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773692239; c=relaxed/simple; bh=N9+JFwtOdLdvGPDv36ZRmN5eoODGs0E0lm3OxFBmIPI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YRgxNMqnZ/yJVf2+tS9bZooID1cTG/1QnF7VaQcjWe6p4GX+UW6bVva6Owj7cBqTIv8A5Wympkqo0x5sJPqO6w1vViLqnmKHBQYu2efFpNbylMto3G0VARu5mb6AyW9aG+iFkzzfXVAEg//8WB9d9vVfcTnpC5cIb0BHo7G1kkg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LrPNJ+l6; 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="LrPNJ+l6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D426C19421; Mon, 16 Mar 2026 20:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773692239; bh=N9+JFwtOdLdvGPDv36ZRmN5eoODGs0E0lm3OxFBmIPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrPNJ+l6YYM9smtg7sxfFlH4qgHUuRfwOHCsuAA1BxVplPS3sPyjMcG4IGjxfQe1E 7NB8z/lbvAa9ABxsQaw96yanCIe3HcD57N1FzahWjY+Xf8h31T0U3eKtH98rOb4aNp EddbTFdJdRzBwDYaKw2lomZ1fOSjkWqMDkJWPVPuW3laXqjfOp2w8748g/Ht3jbsOP qCX4/M6Ph8AH6pGX53rEw9yUd21sZKZPAymSpRWjur9pHgntWtKoZCY8dkpz1b0bUC 8xeSgV1aea+Tg9mxwuO/aTmgjA5bjABpOHgrqtKGiQKzKl0izTbX5p5ndWfm+CGFTR eKz46T//KcXXw== From: Sasha Levin To: stable@vger.kernel.org Cc: Sascha Bischoff , Sascha Bischoff , Jonathan Cameron , Marc Zyngier , Sasha Levin Subject: [PATCH 6.18.y 1/2] KVM: arm64: gic: Set vgic_model before initing private IRQs Date: Mon, 16 Mar 2026 16:17:15 -0400 Message-ID: <20260316201716.1375450-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026031608-gathering-rethink-9d83@gregkh> References: <2026031608-gathering-rethink-9d83@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sascha Bischoff [ Upstream commit 9435c1e1431003e23aa34ef8e46c30d09c3dbcb5 ] Different GIC types require the private IRQs to be initialised differently. GICv5 is the culprit as it supports both a different number of private IRQs, and all of these are PPIs (there are no SGIs). Moreover, as GICv5 uses the top bits of the interrupt ID to encode the type, the intid also needs to computed differently. Up until now, the GIC model has been set after initialising the private IRQs for a VCPU. Move this earlier to ensure that the GIC model is available when configuring the private IRQs. While we're at it, also move the setting of the in_kernel flag and implementation revision to keep them grouped together as before. Signed-off-by: Sascha Bischoff Reviewed-by: Jonathan Cameron Link: https://patch.msgid.link/20260128175919.3828384-7-sascha.bischoff@arm.com Signed-off-by: Marc Zyngier Stable-dep-of: ac6769c8f948 ("KVM: arm64: Eagerly init vgic dist/redist on vgic creation") Signed-off-by: Sasha Levin --- arch/arm64/kvm/vgic/vgic-init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c index da62edbc1205a..3ebd336f3af4d 100644 --- a/arch/arm64/kvm/vgic/vgic-init.c +++ b/arch/arm64/kvm/vgic/vgic-init.c @@ -140,6 +140,10 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) goto out_unlock; } + kvm->arch.vgic.in_kernel = true; + kvm->arch.vgic.vgic_model = type; + kvm->arch.vgic.implementation_rev = KVM_VGIC_IMP_REV_LATEST; + kvm_for_each_vcpu(i, vcpu, kvm) { ret = vgic_allocate_private_irqs_locked(vcpu, type); if (ret) @@ -156,10 +160,6 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) goto out_unlock; } - kvm->arch.vgic.in_kernel = true; - kvm->arch.vgic.vgic_model = type; - kvm->arch.vgic.implementation_rev = KVM_VGIC_IMP_REV_LATEST; - kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF; aa64pfr0 = kvm_read_vm_id_reg(kvm, SYS_ID_AA64PFR0_EL1) & ~ID_AA64PFR0_EL1_GIC; -- 2.51.0