The patch titled KVM: Expose interrupt bitmap has been added to the -mm tree. Its filename is kvm-expose-interrupt-bitmap.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: KVM: Expose interrupt bitmap From: Uri Lublin <uril@xxxxxxxxxxxx> Expose all not-yet-delivered interrupts to userspace. This allows a guest to be saved and resumed even if some interrupts are yet pending. Signed-off-by: Uri Lublin <uril@xxxxxxxxxxxx> Signed-off-by: Avi Kivity <avi@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/kvm/kvm.h | 3 ++- drivers/kvm/kvm_main.c | 12 +++++++++++- include/linux/kvm.h | 14 ++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff -puN drivers/kvm/kvm.h~kvm-expose-interrupt-bitmap drivers/kvm/kvm.h --- a/drivers/kvm/kvm.h~kvm-expose-interrupt-bitmap +++ a/drivers/kvm/kvm.h @@ -8,6 +8,7 @@ #include <linux/mm.h> #include "vmx.h" +#include <linux/kvm.h> #define CR0_PE_MASK (1ULL << 0) #define CR0_TS_MASK (1ULL << 3) @@ -159,7 +160,7 @@ struct kvm_vcpu { int cpu; int launched; unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */ -#define NR_IRQ_WORDS (256 / BITS_PER_LONG) +#define NR_IRQ_WORDS KVM_IRQ_BITMAP_SIZE(unsigned long) unsigned long irq_pending[NR_IRQ_WORDS]; unsigned long regs[NR_VCPU_REGS]; /* for rsp: vcpu_load_rsp_rip() */ unsigned long rip; /* needs vcpu_load_rsp_rip() */ diff -puN drivers/kvm/kvm_main.c~kvm-expose-interrupt-bitmap drivers/kvm/kvm_main.c --- a/drivers/kvm/kvm_main.c~kvm-expose-interrupt-bitmap +++ a/drivers/kvm/kvm_main.c @@ -2997,7 +2997,8 @@ static int kvm_dev_ioctl_get_sregs(struc sregs->efer = vcpu->shadow_efer; sregs->apic_base = vcpu->apic_base; - sregs->pending_int = vcpu->irq_summary != 0; + memcpy(sregs->interrupt_bitmap, vcpu->irq_pending, + sizeof sregs->interrupt_bitmap); vcpu_put(vcpu); @@ -3031,6 +3032,7 @@ static int kvm_dev_ioctl_set_sregs(struc { struct kvm_vcpu *vcpu; int mmu_reset_needed = 0; + int i; if (sregs->vcpu < 0 || sregs->vcpu >= KVM_MAX_VCPUS) return -EINVAL; @@ -3080,6 +3082,14 @@ static int kvm_dev_ioctl_set_sregs(struc if (mmu_reset_needed) kvm_mmu_reset_context(vcpu); + + memcpy(vcpu->irq_pending, sregs->interrupt_bitmap, + sizeof vcpu->irq_pending); + vcpu->irq_summary = 0; + for (i = 0; i < NR_IRQ_WORDS; ++i) + if (vcpu->irq_pending[i]) + __set_bit(i, &vcpu->irq_summary); + vcpu_put(vcpu); return 0; diff -puN include/linux/kvm.h~kvm-expose-interrupt-bitmap include/linux/kvm.h --- a/include/linux/kvm.h~kvm-expose-interrupt-bitmap +++ a/include/linux/kvm.h @@ -11,6 +11,15 @@ #include <asm/types.h> #include <linux/ioctl.h> +/* + * Architectural interrupt line count, and the size of the bitmap needed + * to hold them. + */ +#define KVM_NR_INTERRUPTS 256 +#define KVM_IRQ_BITMAP_SIZE_BYTES ((KVM_NR_INTERRUPTS + 7) / 8) +#define KVM_IRQ_BITMAP_SIZE(type) (KVM_IRQ_BITMAP_SIZE_BYTES / sizeof(type)) + + /* for KVM_CREATE_MEMORY_REGION */ struct kvm_memory_region { __u32 slot; @@ -129,10 +138,7 @@ struct kvm_sregs { __u64 cr0, cr2, cr3, cr4, cr8; __u64 efer; __u64 apic_base; - - /* out (KVM_GET_SREGS) */ - __u32 pending_int; - __u32 padding2; + __u64 interrupt_bitmap[KVM_IRQ_BITMAP_SIZE(__u64)]; }; /* for KVM_TRANSLATE */ _ Patches currently in -mm which might be from uril@xxxxxxxxxxxx are kvm-expose-interrupt-bitmap.patch kvm-add-time-stamp-counter-msr-and-accessors.patch kvm-expose-msrs-to-userspace.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html