From 11ad93f68195f68cc94d988f2aa50b4d190ee52a Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 26 Sep 2013 16:18:44 +1000 Subject: xics-kvm: Support for in-kernel XICS interrupt controller Recent (host) kernels support emulating the PAPR defined "XICS" interrupt controller system within KVM. This patch allows qemu to initialize and configure the in-kernel XICS, and keep its state in sync with qemu's XICS state as necessary. This should give considerable performance improvements. e.g. on a simple IPI ping-pong test between hardware threads, using qemu XICS gives us around 5,000 irqs/second, whereas the in-kernel XICS gives us around 70,000 irqs/s on the same hardware configuration. Signed-off-by: David Gibson [Mike Qiu : fixed mistype which caused ics_set_kvm_state() to fail] Signed-off-by: Alexey Kardashevskiy Reviewed-by: Alexander Graf Signed-off-by: Alexander Graf --- hw/ppc/spapr.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'hw/ppc/spapr.c') diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f65dadc356..c0613e467c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -168,7 +168,26 @@ static XICSState *xics_system_init(int nr_servers, int nr_irqs) { XICSState *icp = NULL; - icp = try_create_xics(TYPE_XICS, nr_servers, nr_irqs); + if (kvm_enabled()) { + QemuOpts *machine_opts = qemu_get_machine_opts(); + bool irqchip_allowed = qemu_opt_get_bool(machine_opts, + "kernel_irqchip", true); + bool irqchip_required = qemu_opt_get_bool(machine_opts, + "kernel_irqchip", false); + if (irqchip_allowed) { + icp = try_create_xics(TYPE_KVM_XICS, nr_servers, nr_irqs); + } + + if (irqchip_required && !icp) { + perror("Failed to create in-kernel XICS\n"); + abort(); + } + } + + if (!icp) { + icp = try_create_xics(TYPE_XICS, nr_servers, nr_irqs); + } + if (!icp) { perror("Failed to create XICS\n"); abort(); -- cgit v1.2.1