From patchwork Fri Jul 31 15:56:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 502680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 57CEC1402BB for ; Sat, 1 Aug 2015 01:57:51 +1000 (AEST) Received: from localhost ([::1]:44894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCgv-0007Wq-Jn for incoming@patchwork.ozlabs.org; Fri, 31 Jul 2015 11:57:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCgI-00061A-Fv for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:57:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLCgC-0007Ox-DU for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:57:10 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:38684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLCgC-0007OZ-8T for qemu-devel@nongnu.org; Fri, 31 Jul 2015 11:57:04 -0400 Received: by wibxm9 with SMTP id xm9so37775780wib.1 for ; Fri, 31 Jul 2015 08:57:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PgUGZHAySeKp17cEyvBj7BWo4oMJKbmj3+32MCJnMfo=; b=bvGePX/MbgnTZC5okhq4UJzCIvP2E6NGYIyKP6Efr+MvPNxonYHXtIbmbit6ALhq5w K/tr16jIbvIVp6+OC/WJW2ZBg9dyiS4tZAlQAtAaqeUc5eMOo7SdbbW655otZFngEJJK TXH9bHpj+JppNWTibKEYiKmwlxelwuLF5SLvsZM9G3IPQSyvb3oiIq2XsgXbmJAiP/3m HxO/BZtdMpGRz8euv9WmvQchtEmeW9i5pJbX5WHoNCrDb2gF78QweV27lVWCXcsoaWmB VnofE5ZDMUDsLX/SmRymrZ1uX5BwmesI+W8V3hSekwyLFEoz1Hgmta3+y5bALENLb+5T 8Mgg== X-Gm-Message-State: ALoCoQn7T6w7ti1Gsd4HY71LoaSWpIxEpxYVlEf2AfEwZNQvH0Iq0eGiDGICboX1aBx5BpnKPLkK X-Received: by 10.194.89.5 with SMTP id bk5mr7537141wjb.144.1438358223188; Fri, 31 Jul 2015 08:57:03 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by smtp.gmail.com with ESMTPSA id h9sm7810299wjx.20.2015.07.31.08.57.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jul 2015 08:57:02 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, pbonzini@redhat.com Date: Fri, 31 Jul 2015 16:56:45 +0100 Message-Id: <1438358205-7395-1-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.178 Cc: p.fedin@samsung.com, christoffer.dall@linaro.org, patches@linaro.org Subject: [Qemu-devel] [PATCH for-2.5] hw/intc/arm_gic_kvm: set up a flat irqchip routing table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In case the kernel supports GSI routing, we set up irqchip routing entries for GIC SPIs. This is not mandated as long as MSI routing is not used (because the kernel sets a default irqchip routing table). However once MSI routing gets used (for VIRTIO-PCI vhost for example), the first call to KVM_SET_GSI_ROUTING overrides the kernel default irqchip table. If no routing entry exists for the GSI, any IRQFD signaling for this GSI will fail. Signed-off-by: Eric Auger --- gsi routing for ARM is functional but needs to be maturated. The API for MSI routing still is in discussion. See http://www.spinics.net/lists/kvm/msg118792.html --- hw/intc/arm_gic_kvm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c index f56bff1..58d8303 100644 --- a/hw/intc/arm_gic_kvm.c +++ b/hw/intc/arm_gic_kvm.c @@ -631,6 +631,18 @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp) KVM_DEV_ARM_VGIC_GRP_ADDR, KVM_VGIC_V2_ADDR_TYPE_CPU, s->dev_fd); + + if (kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) { + /* set up irq routing */ + kvm_init_irq_routing(kvm_state); + for (i = 0; i < s->num_irq - GIC_INTERNAL; ++i) { + kvm_irqchip_add_irq_route(kvm_state, i, 0, i); + } + + kvm_gsi_routing_allowed = true; + + kvm_irqchip_commit_routes(kvm_state); + } } static void kvm_arm_gic_class_init(ObjectClass *klass, void *data)