Sheng Yang wrote:
Avi's purpose, to use single kvm_set_irq() to deal with all interrupt, including
MSI. So here is it.
struct gsi_msg is a mapping from a special gsi(with KVM_GSI_MSG_MASK) to
MSI/MSI-X message address/data.
Now we support up to 256 gsi_msg mapping, and gsi_msg is allocated by kernel and
provide two ioctls to userspace, which is more flexiable.
+#define KVM_REQUEST_GSI_MSG _IOWR(KVMIO, 0x71, struct kvm_assigned_gsi_msg)
+#define KVM_FREE_GSI_MSG _IOR(KVMIO, 0x72, struct kvm_assigned_gsi_msg)
We will also need a pair for PIC and a pair for IOAPIC routing.
How about a single ioctl to set the entire routing table? It would take
an array of structures:
struct {
__u32 gsi;
__u32 type;
__u32 flags;
__u32 reserved;
union {
struct {
__u32 irq;
} pic;
struct {
__u32 ioapic; // can have >1 ioapic
__u32 inti;
} ioapic;
struct {
...
} msi;
__u32 reserved[8];
};
};
This way we can solve the HPET irq0/inti2 mess, and also have a simpler
way of setting MSI. All the mess in one ioctl.
+
+/* Call with kvm->gsi_msg_lock hold */
+struct kvm_gsi_msg *kvm_find_gsi_msg(struct kvm *kvm, u32 gsi)
+{
+ struct kvm_gsi_msg *gsi_msg;
+ struct hlist_node *n;
+
+ if (!(gsi & KVM_GSI_MSG_MASK))
+ return NULL;
+ hlist_for_each_entry(gsi_msg, n, &kvm->gsi_msg_list, link)
+ if (gsi_msg->gsi == gsi)
+ goto out;
+ gsi_msg = NULL;
+out:
+ return gsi_msg;
+}
Linear search is a bit sad but fine for now. Later we can add an array
indexed by gsi.
--
error compiling committee.c: too many arguments to function
--
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