This patch removes the 8 byte length limit on ioeventfds. The consequences are that any write in the provided region which is contained entierly by the region and matches datamatch (if specified) will trigger an event.
Cc: Avi Kivity <a...@redhat.com> Cc: Ingo Molnar <mi...@elte.hu> Cc: Marcelo Tosatti <mtosa...@redhat.com> Cc: Michael S. Tsirkin <m...@redhat.com> Cc: Pekka Enberg <penb...@kernel.org> Signed-off-by: Sasha Levin <levinsasha...@gmail.com> --- Documentation/virtual/kvm/api.txt | 4 ++-- include/linux/kvm.h | 4 ++-- virt/kvm/eventfd.c | 15 ++------------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index b251136..7994840 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -1334,8 +1334,8 @@ provided event instead of triggering an exit. struct kvm_ioeventfd { __u64 datamatch; - __u64 addr; /* legal pio/mmio address */ - __u32 len; /* 1, 2, 4, or 8 bytes */ + __u64 addr; + __u32 len; __s32 fd; __u32 flags; __u8 pad[36]; diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 9c9ca7c..81cd295 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -398,8 +398,8 @@ enum { struct kvm_ioeventfd { __u64 datamatch; - __u64 addr; /* legal pio/mmio address */ - __u32 len; /* 1, 2, 4, or 8 bytes */ + __u64 addr; + __u32 len; __s32 fd; __u32 flags; __u8 pad[36]; diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 73358d2..5fb09b4 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -449,8 +449,8 @@ ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val) { u64 _val; - if (!(addr == p->addr && len == p->length)) - /* address-range must be precise for a hit */ + if (!((addr >= p->addr) && ((addr + len) <= (p->addr + p->length)))) + /* the entire address-range must be within the ioeventfd */ return false; if (p->wildcard) @@ -536,17 +536,6 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) struct eventfd_ctx *eventfd; int ret; - /* must be natural-word sized */ - switch (args->len) { - case 1: - case 2: - case 4: - case 8: - break; - default: - return -EINVAL; - } - /* check for range overflow */ if (args->addr + args->len < args->addr) return -EINVAL; -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html