{
struct kvm_vcpu *vcpu;
- if (ue->u.xen_evtchn.port >= max_evtchn_port(kvm))
- return -EINVAL;
+ /*
+ * No check for being within range of max_evtchn_port() here.
+ * Userspace can configure what ever targets it likes; they
+ * just won't be delivered if/while they're invalid. Just like
+ * userspace can configure MSIs which target non-existent APICs.
+ * This means that on Live Migration and Live Update, the IRQ
+ * routing table can be restored *independently* of other things
+ * like creating vCPUs without imposing an ordering dependency on
+ * userspace. In this particular case, the problematic ordering
+ * would be with setting the Xen 'long mode' flag which changes
+ * max_evtchn_port() to allow 4096 instead of 1024 event channels.
+ */
/* We only support 2 level event channels for now */
if (ue->u.xen_evtchn.priority != KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL)