From: Tiejun Chen <tiejun.chen@intel.com>
To: pbonzini@redhat.com
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH] kvm_irqchip_assign_irqfd: just set irqfd in case of kvm_irqfds_enabled()
Date: Fri, 26 Dec 2014 16:05:26 +0800 [thread overview]
Message-ID: <1419581126-12927-1-git-send-email-tiejun.chen@intel.com> (raw)
We should avoid to set irqfd{} unconditionally.
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
kvm-all.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 18cc6b4..5b9786b 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1257,21 +1257,21 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg)
static int kvm_irqchip_assign_irqfd(KVMState *s, int fd, int rfd, int virq,
bool assign)
{
- struct kvm_irqfd irqfd = {
- .fd = fd,
- .gsi = virq,
- .flags = assign ? 0 : KVM_IRQFD_FLAG_DEASSIGN,
- };
+ struct kvm_irqfd irqfd = {};
+
+ if (!kvm_irqfds_enabled()) {
+ return -ENOSYS;
+ }
+
+ irqfd.fd = fd;
+ irqfd.gsi = virq;
+ irqfd.flags = assign ? 0 : KVM_IRQFD_FLAG_DEASSIGN;
if (rfd != -1) {
irqfd.flags |= KVM_IRQFD_FLAG_RESAMPLE;
irqfd.resamplefd = rfd;
}
- if (!kvm_irqfds_enabled()) {
- return -ENOSYS;
- }
-
return kvm_vm_ioctl(s, KVM_IRQFD, &irqfd);
}
--
1.9.1
next reply other threads:[~2014-12-26 8:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-26 8:05 Tiejun Chen [this message]
2014-12-26 10:00 ` [Qemu-devel] [PATCH] kvm_irqchip_assign_irqfd: just set irqfd in case of kvm_irqfds_enabled() Peter Maydell
2014-12-26 10:16 ` Denis V. Lunev
2014-12-26 17:59 ` Peter Maydell
2014-12-27 14:52 ` Paolo Bonzini
2014-12-29 1:31 ` Chen, Tiejun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1419581126-12927-1-git-send-email-tiejun.chen@intel.com \
--to=tiejun.chen@intel.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).