Skip to content

Commit 2fa462f

Browse files
committed
Merge tag 'kvm-arm-for-4.1-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master
KVM/ARM changes for v4.1, take linux4sam#2: Rather small this time: - a fix for a nasty bug with virtual IRQ injection - a fix for irqfd
2 parents 123857a + fd1d0dd commit 2fa462f

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

arch/arm/include/uapi/asm/kvm.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,14 @@ struct kvm_arch_memory_slot {
195195
#define KVM_ARM_IRQ_CPU_IRQ 0
196196
#define KVM_ARM_IRQ_CPU_FIQ 1
197197

198-
/* Highest supported SPI, from VGIC_NR_IRQS */
198+
/*
199+
* This used to hold the highest supported SPI, but it is now obsolete
200+
* and only here to provide source code level compatibility with older
201+
* userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS.
202+
*/
203+
#ifndef __KERNEL__
199204
#define KVM_ARM_IRQ_GIC_MAX 127
205+
#endif
200206

201207
/* One single KVM irqchip, ie. the VGIC */
202208
#define KVM_NR_IRQCHIPS 1

arch/arm/kvm/arm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
671671
if (!irqchip_in_kernel(kvm))
672672
return -ENXIO;
673673

674-
if (irq_num < VGIC_NR_PRIVATE_IRQS ||
675-
irq_num > KVM_ARM_IRQ_GIC_MAX)
674+
if (irq_num < VGIC_NR_PRIVATE_IRQS)
676675
return -EINVAL;
677676

678677
return kvm_vgic_inject_irq(kvm, 0, irq_num, level);

arch/arm64/include/uapi/asm/kvm.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,14 @@ struct kvm_arch_memory_slot {
188188
#define KVM_ARM_IRQ_CPU_IRQ 0
189189
#define KVM_ARM_IRQ_CPU_FIQ 1
190190

191-
/* Highest supported SPI, from VGIC_NR_IRQS */
191+
/*
192+
* This used to hold the highest supported SPI, but it is now obsolete
193+
* and only here to provide source code level compatibility with older
194+
* userland. The highest SPI number can be set via KVM_DEV_ARM_VGIC_GRP_NR_IRQS.
195+
*/
196+
#ifndef __KERNEL__
192197
#define KVM_ARM_IRQ_GIC_MAX 127
198+
#endif
193199

194200
/* One single KVM irqchip, ie. the VGIC */
195201
#define KVM_NR_IRQCHIPS 1

virt/kvm/arm/vgic.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,9 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
15611561
goto out;
15621562
}
15631563

1564+
if (irq_num >= kvm->arch.vgic.nr_irqs)
1565+
return -EINVAL;
1566+
15641567
vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level);
15651568
if (vcpu_id >= 0) {
15661569
/* kick the specified vcpu */
@@ -2141,7 +2144,7 @@ int kvm_irq_map_gsi(struct kvm *kvm,
21412144
struct kvm_kernel_irq_routing_entry *entries,
21422145
int gsi)
21432146
{
2144-
return gsi;
2147+
return 0;
21452148
}
21462149

21472150
int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin)

0 commit comments

Comments
 (0)