From patchwork Mon Jun 29 15:37:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6689871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A91389F39B for ; Mon, 29 Jun 2015 15:45:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDABA20462 for ; Mon, 29 Jun 2015 15:45:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1E092045B for ; Mon, 29 Jun 2015 15:45:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z9bCf-0007F5-Ev; Mon, 29 Jun 2015 15:42:37 +0000 Received: from mail-wi0-f182.google.com ([209.85.212.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z9b8T-0003TV-DR for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2015 15:38:18 +0000 Received: by wiga1 with SMTP id a1so74886631wig.0 for ; Mon, 29 Jun 2015 08:37:55 -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:in-reply-to :references; bh=57FZfsfzrkobPRPdJMDNWhwiG08NGSxnd/YdWozFFrU=; b=NTxdA0f/sVOoRI4iRhpd4x7TQBafLggtZ6KWA2P48hOGuCAM8cCQlrhMPNibdstRNp 1KMHKj1kMjYNGdBt6rPf5iNvIbSRhY1+Ngu6Uf9JXBTQQIz1S+Y84rUuL3hO5lXW5SX7 h6tu8KOf96+OOWCP8iJXqKCaj/dxanD2lHMEm0jeYivvKHKFNDwmyF/2wPG8uLRT1Rds RG6spjl63AqawdZ7PVnbeQ5DG/ln65l8IxD0YplNBswZf3ZB5gePqwZKhP5fVnjSI01g Bj/+xfP40oVz4ZCWRlI/hGl1CIt0/6xjdx4gC/YxtLCTlBKLy/XT8mKy6cX1Qo04PlXM fyKg== X-Gm-Message-State: ALoCoQn3CBrkF4DPIr0AdhjeLN1cc0NEUkYz7MqMSoun9svRJuDUtA5mwaFFeqWil8y4kdZA5Lfl X-Received: by 10.180.73.236 with SMTP id o12mr24059119wiv.56.1435592275288; Mon, 29 Jun 2015 08:37:55 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id lf4sm64675965wjb.42.2015.06.29.08.37.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 08:37:54 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, linux-arm-kernel@lists.infradead.org, marc.zyngier@arm.com, christoffer.dall@linaro.org, andre.przywara@arm.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH 5/7] KVM: arm/arm64: build a default routing table Date: Mon, 29 Jun 2015 17:37:15 +0200 Message-Id: <1435592237-17924-6-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435592237-17924-1-git-send-email-eric.auger@linaro.org> References: <1435592237-17924-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150629_083817_692934_CCF767D4 X-CRM114-Status: GOOD ( 13.49 ) X-Spam-Score: -2.6 (--) Cc: pbonzini@redhat.com, p.fedin@samsung.com, linux-kernel@vger.kernel.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Implement a default routing table made of flat irqchip routing entries (gsi = irqchip.pin) covering the VGIC SPI indexes. This routing table is overwritten by the first user-space call to KVM_SET_GSI_ROUTING ioctl. Signed-off-by: Eric Auger --- PATCH: creation --- virt/kvm/arm/vgic.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 212a5ff..410fee1 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1783,6 +1783,8 @@ int vgic_init(struct kvm *kvm) ret |= vgic_init_bitmap(&dist->irq_cfg, nr_cpus, nr_irqs); ret |= vgic_init_bytemap(&dist->irq_priority, nr_cpus, nr_irqs); + ret |= kvm_setup_default_irq_routing(kvm); + if (ret) goto out; @@ -2264,6 +2266,25 @@ out: return r; } +int kvm_setup_default_irq_routing(struct kvm *kvm) +{ + struct kvm_irq_routing_entry *entries; + u32 nr = kvm->arch.vgic.nr_irqs - VGIC_NR_PRIVATE_IRQS; + int i, ret; + + entries = kcalloc(nr, sizeof(struct kvm_kernel_irq_routing_entry), + GFP_KERNEL); + for (i = 0; i < nr; i++) { + entries[i].gsi = i; + entries[i].type = KVM_IRQ_ROUTING_IRQCHIP; + entries[i].u.irqchip.irqchip = 0; + entries[i].u.irqchip.pin = i; + } + ret = kvm_set_irq_routing(kvm, entries, nr, 0); + kfree(entries); + return ret; +} + int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, struct kvm *kvm, int irq_source_id, int level, bool line_status)