From: Christoffer Dall <christoffer.dall@linaro.org>
To: qemu-devel@nongnu.org
Cc: kvmarm@lists.cs.columbia.edu,
Christoffer Dall <christoffer.dall@linaro.org>,
patches@linaro.org
Subject: [Qemu-devel] [RFC PATCH v2 2/4] kvm: Introduce kvm_arch_irqchip_create
Date: Thu, 26 Sep 2013 12:56:11 -0700 [thread overview]
Message-ID: <1380225373-22132-3-git-send-email-christoffer.dall@linaro.org> (raw)
In-Reply-To: <1380225373-22132-1-git-send-email-christoffer.dall@linaro.org>
Introduce kvm_arch_irqchip_create an arch-specific hook in preparation
for architecture-specific use of the device control API to create IRQ
chips.
Following patches will implement the ARM irqchip create method to prefer
the device control API over the older KVM_CREATE_IRQCHIP API.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
Changelog[v2]:
- Proper formatted function comments
- Use QEMU's stubs mechanism for KVM stubs
---
include/sysemu/kvm.h | 12 ++++++++++++
kvm-all.c | 11 +++++++++--
stubs/Makefile.objs | 1 +
stubs/kvm.c | 7 +++++++
4 files changed, 29 insertions(+), 2 deletions(-)
create mode 100644 stubs/kvm.c
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index de74411..fbb2776 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -314,4 +314,16 @@ int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq);
void kvm_pc_gsi_handler(void *opaque, int n, int level);
void kvm_pc_setup_irq_routing(bool pci_enabled);
void kvm_init_irq_routing(KVMState *s);
+
+/**
+ * kvm_arch_irqchip_create:
+ * @KVMState: The KVMState pointer
+ *
+ * Allow architectures to create an in-kernel irq chip themselves.
+ *
+ * Returns: < 0: error
+ * 0: irq chip was not created
+ * > 0: irq chip was created
+ */
+int kvm_arch_irqchip_create(KVMState *s);
#endif
diff --git a/kvm-all.c b/kvm-all.c
index 716860f..fe64f3b 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1295,10 +1295,17 @@ static int kvm_irqchip_create(KVMState *s)
return 0;
}
- ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
+ /* First probe and see if there's a arch-specific hook to create the
+ * in-kernel irqchip for us */
+ ret = kvm_arch_irqchip_create(s);
if (ret < 0) {
- fprintf(stderr, "Create kernel irqchip failed\n");
return ret;
+ } else if (ret == 0) {
+ ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
+ if (ret < 0) {
+ fprintf(stderr, "Create kernel irqchip failed\n");
+ return ret;
+ }
}
kvm_kernel_irqchip = true;
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index f306cba..f3eba26 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -26,3 +26,4 @@ stub-obj-y += vm-stop.o
stub-obj-y += vmstate.o
stub-obj-$(CONFIG_WIN32) += fd-register.o
stub-obj-y += cpus.o
+stub-obj-y += kvm.o
diff --git a/stubs/kvm.c b/stubs/kvm.c
new file mode 100644
index 0000000..e7c60b6
--- /dev/null
+++ b/stubs/kvm.c
@@ -0,0 +1,7 @@
+#include "qemu-common.h"
+#include "sysemu/kvm.h"
+
+int kvm_arch_irqchip_create(KVMState *s)
+{
+ return 0;
+}
--
1.7.10.4
next prev parent reply other threads:[~2013-09-26 19:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 19:56 [Qemu-devel] [RFC PATCH v2 0/4] Create ARM KVM VGIC with device control API Christoffer Dall
2013-09-26 19:56 ` [Qemu-devel] [RFC PATCH v2 1/4] kvm: Update headers for device control api Christoffer Dall
2013-09-26 19:56 ` Christoffer Dall [this message]
2013-10-14 13:34 ` [Qemu-devel] [RFC PATCH v2 2/4] kvm: Introduce kvm_arch_irqchip_create Peter Maydell
2013-09-26 19:56 ` [Qemu-devel] [RFC PATCH v2 3/4] kvm: Common device control API functions Christoffer Dall
2013-10-14 13:36 ` Peter Maydell
2013-09-26 19:56 ` [Qemu-devel] [RFC PATCH v2 4/4] arm: vgic device control api support Christoffer Dall
2013-10-14 13:49 ` Peter Maydell
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=1380225373-22132-3-git-send-email-christoffer.dall@linaro.org \
--to=christoffer.dall@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=patches@linaro.org \
--cc=qemu-devel@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).