Skip to contentSkip to conversation

Patch "arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources" has been added to the 4.2-stable tree

PATCH [email protected] 1 participant 1 message Sep 23, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources

to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
arm-arm64-kvm-vgic-check-for-irqchip_in_kernel-when-mapping-resources.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From c2f58514cfb374d5368c9da945f1765cd48eb0da Mon Sep 17 00:00:00 2001

From: Pavel Fedin <[email protected]>
Date: Wed, 5 Aug 2015 11:53:57 +0100
Subject: arm/arm64: KVM: vgic: Check for !irqchip_in_kernel() when mapping resources

From: Pavel Fedin <[email protected]>

commit c2f58514cfb374d5368c9da945f1765cd48eb0da upstream.

Until b26e5fdac43c ("arm/arm64: KVM: introduce per-VM ops"), kvm_vgic_map_resources() used to include a check on irqchip_in_kernel(), and vgic_v2_map_resources() still has it.

But now vm_ops are not initialized until we call kvm_vgic_create(). Therefore kvm_vgic_map_resources() can being called without a VGIC, and we die because vm_ops.map_resources is NULL.

Fixing this restores QEMU's kernel-irqchip=off option to a working state, allowing to use GIC emulation in userspace.

Fixes b26e5fdac43c ("arm/arm64: KVM: introduce per-VM ops")
[maz: reworked commit message]
---
 arch/arm/kvm/arm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kvm/arm.c +1 -1
@@ -449,7 +449,7 @@ static int kvm_vcpu_first_run_init(struc
 	 * Map the VGIC hardware resources before running a vcpu the first
 	 * time on this VM.
 	 */
-	if (unlikely(!vgic_ready(kvm))) {
+	if (unlikely(irqchip_in_kernel(kvm) && !vgic_ready(kvm))) {
 		ret = kvm_vgic_map_resources(kvm);
 		if (ret)
 			return ret;

Patches currently in stable-queue which might be from [email protected] are

queue-4.2/arm-arm64-kvm-vgic-check-for-irqchip_in_kernel-when-mapping-resources.patch