diff options
-rw-r--r-- | arch/arm/include/uapi/asm/kvm.h | 8 | ||||
-rw-r--r-- | arch/arm/kvm/arm.c | 3 | ||||
-rw-r--r-- | arch/arm64/include/uapi/asm/kvm.h | 8 | ||||
-rw-r--r-- | virt/kvm/arm/vgic.c | 3 |
4 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h index 2499867dd0d8..df3f60cb1168 100644 --- a/arch/arm/include/uapi/asm/kvm.h +++ b/arch/arm/include/uapi/asm/kvm.h | |||
@@ -195,8 +195,14 @@ struct kvm_arch_memory_slot { | |||
195 | #define KVM_ARM_IRQ_CPU_IRQ 0 | 195 | #define KVM_ARM_IRQ_CPU_IRQ 0 |
196 | #define KVM_ARM_IRQ_CPU_FIQ 1 | 196 | #define KVM_ARM_IRQ_CPU_FIQ 1 |
197 | 197 | ||
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__ | ||
199 | #define KVM_ARM_IRQ_GIC_MAX 127 | 204 | #define KVM_ARM_IRQ_GIC_MAX 127 |
205 | #endif | ||
200 | 206 | ||
201 | /* One single KVM irqchip, ie. the VGIC */ | 207 | /* One single KVM irqchip, ie. the VGIC */ |
202 | #define KVM_NR_IRQCHIPS 1 | 208 | #define KVM_NR_IRQCHIPS 1 |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 6f536451ab78..d9631ecddd56 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -671,8 +671,7 @@ int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level, | |||
671 | if (!irqchip_in_kernel(kvm)) | 671 | if (!irqchip_in_kernel(kvm)) |
672 | return -ENXIO; | 672 | return -ENXIO; |
673 | 673 | ||
674 | if (irq_num < VGIC_NR_PRIVATE_IRQS || | 674 | if (irq_num < VGIC_NR_PRIVATE_IRQS) |
675 | irq_num > KVM_ARM_IRQ_GIC_MAX) | ||
676 | return -EINVAL; | 675 | return -EINVAL; |
677 | 676 | ||
678 | return kvm_vgic_inject_irq(kvm, 0, irq_num, level); | 677 | return kvm_vgic_inject_irq(kvm, 0, irq_num, level); |
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index c154c0b7eb60..d26832022127 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h | |||
@@ -188,8 +188,14 @@ struct kvm_arch_memory_slot { | |||
188 | #define KVM_ARM_IRQ_CPU_IRQ 0 | 188 | #define KVM_ARM_IRQ_CPU_IRQ 0 |
189 | #define KVM_ARM_IRQ_CPU_FIQ 1 | 189 | #define KVM_ARM_IRQ_CPU_FIQ 1 |
190 | 190 | ||
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__ | ||
192 | #define KVM_ARM_IRQ_GIC_MAX 127 | 197 | #define KVM_ARM_IRQ_GIC_MAX 127 |
198 | #endif | ||
193 | 199 | ||
194 | /* One single KVM irqchip, ie. the VGIC */ | 200 | /* One single KVM irqchip, ie. the VGIC */ |
195 | #define KVM_NR_IRQCHIPS 1 | 201 | #define KVM_NR_IRQCHIPS 1 |
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 7ed78735f611..78fb8201014f 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -1561,6 +1561,9 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num, | |||
1561 | goto out; | 1561 | goto out; |
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | if (irq_num >= kvm->arch.vgic.nr_irqs) | ||
1565 | return -EINVAL; | ||
1566 | |||
1564 | vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level); | 1567 | vcpu_id = vgic_update_irq_pending(kvm, cpuid, irq_num, level); |
1565 | if (vcpu_id >= 0) { | 1568 | if (vcpu_id >= 0) { |
1566 | /* kick the specified vcpu */ | 1569 | /* kick the specified vcpu */ |