From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUoey-0007WI-27 for qemu-devel@nongnu.org; Wed, 03 Aug 2016 01:24:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUoeu-0008C9-Rg for qemu-devel@nongnu.org; Wed, 03 Aug 2016 01:24:03 -0400 From: David Gibson Date: Wed, 3 Aug 2016 15:25:51 +1000 Message-Id: <1470201951-19288-3-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1470201951-19288-1-git-send-email-david@gibson.dropbear.id.au> References: <1470201951-19288-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 2/2] kvm-irqchip: only commit route when irqchip is used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, pbonzini@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Peter Xu , David Gibson From: Peter Xu Reported from Alexey Kardashevskiy: 3f1fea0fb5bf "kvm-irqchip: do explicit commit when update irq" produces a crash on pseries guest running with VFIO on POWER8 machine as it does not support KVM_CAP_IRQCHIP (KVM_CAP_IRQ_XICS is there instead). At the result, KVMState::irq_routes is NULL when VFIO calls kvm_irqchip_commit_routes. This makes the routing update conditional. Reported-by: Alexey Kardashevskiy Tested-by: Alexey Kardashevskiy Signed-off-by: Peter Xu Signed-off-by: David Gibson --- kvm-all.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kvm-all.c b/kvm-all.c index ef81ca5..65608de 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1047,6 +1047,14 @@ void kvm_irqchip_commit_routes(KVMState *s) { int ret; + if (kvm_gsi_direct_mapping()) { + return; + } + + if (!kvm_gsi_routing_enabled()) { + return; + } + s->irq_routes->flags = 0; trace_kvm_irqchip_commit_routes(); ret = kvm_vm_ioctl(s, KVM_SET_GSI_ROUTING, s->irq_routes); -- 2.7.4