[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH v5 3/5] Add functions for assigning ioeventfd an
From: |
Avi Kivity |
Subject: |
[Qemu-devel] Re: [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds. |
Date: |
Mon, 10 May 2010 13:43:19 +0300 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4 |
On 04/21/2010 08:53 PM, Cam Macdonell wrote:
Generic functions to assign irqfds and ioeventfds.
Signoff.
}
#ifdef KVM_IOEVENTFD
+int kvm_set_irqfd(int fd, uint16_t vector, uint32_t gsi)
+{
+ struct kvm_irqfd call = { };
+ int r;
+
+ call.fd = fd;
+ call.gsi = gsi;
+
+ if (!kvm_enabled())
+ return -ENOSYS;
Braces, here and elsewhere.
+ r = kvm_vm_ioctl(kvm_state, KVM_IRQFD,&call);
+
+ if (r< 0) {
+ return r;
-errno
+ }
+ return 0;
+}
+
+int kvm_set_ioeventfd_mmio_long(int fd, uint32_t addr, uint32_t val, bool
assign)
+{
+
+ int ret;
+ struct kvm_ioeventfd iofd;
+
+ iofd.datamatch = val;
+ iofd.addr = addr;
+ iofd.len = 4;
+ iofd.flags = KVM_IOEVENTFD_FLAG_DATAMATCH;
+ iofd.fd = fd;
+
+ if (!kvm_enabled())
+ return -ENOSYS;
+ if (!assign)
+ iofd.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN;
May be more usable to have separate assign and deassign functions (that
can call into a single internal implementation).
+
+ ret = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD,&iofd);
+
+ if (ret< 0) {
+ return ret;
-errno
+ }
+
+ return 0;
+}
+
--
error compiling committee.c: too many arguments to function
- [Qemu-devel] Re: [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds.,
Avi Kivity <=