From patchwork Thu Jul 9 08:22: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: 6754091 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 BC9E19F380 for ; Thu, 9 Jul 2015 08:25:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D4688205D8 for ; Thu, 9 Jul 2015 08:25:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 09351205E3 for ; Thu, 9 Jul 2015 08:25:23 +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 1ZD77R-0004xZ-Ci; Thu, 09 Jul 2015 08:23:45 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZD76w-0004QK-NL for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2015 08:23:15 +0000 Received: by wiwl6 with SMTP id l6so11103400wiw.0 for ; Thu, 09 Jul 2015 01:22:53 -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=i/bnf5MpgYcPFu3WYI30ccRgs0RfoRQ4DPbk5ugfby8=; b=MstJfQz9j3hzYvNFhQsBA6zZL/+vjfNoOook25jPE06Z6ZLc306+SO4I1PQevyvRmI cZ3UZ+NV38ujYX21fJL5Q6jY+bJroa+MU7geH4qh6fk9x2vjZnhfDogZOFqhIg4g3e+A Z+YTRHKIoRTF77EpXNMwpW2WFEHNSOcqu0RPAUBXK9MpxZYXHieYpgRg4aSCaRO+nzQE LYJBvBlFdcLjQPI1A4frfrM2LY0Gb+KH5ru/DC+e45UB+T0rz+xxlNiFH7u6fRE/Ir+T FMk60ZRNT4/kbPWiESl23l0HtiKh8lJvLGDTzMg1FFoYjspit8Ol/ie3C7VZGCzZAy0H H/zQ== X-Gm-Message-State: ALoCoQleQ+JHUwOkEZANGrjcluec3JHXMRersadpT/3mixJVGDdyXls/QJOkIpW1ggkXpZ178BAL X-Received: by 10.194.59.98 with SMTP id y2mr28510726wjq.42.1436430173093; Thu, 09 Jul 2015 01:22:53 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id ib9sm7522108wjb.2.2015.07.09.01.22.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 01:22:51 -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, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v2 5/7] KVM: arm/arm64: build a default routing table Date: Thu, 9 Jul 2015 10:22:15 +0200 Message-Id: <1436430137-24205-6-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436430137-24205-1-git-send-email-eric.auger@linaro.org> References: <1436430137-24205-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150709_012314_909742_4502BB13 X-CRM114-Status: GOOD ( 12.69 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, pbonzini@redhat.com, p.fedin@samsung.com, patches@linaro.org 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.5 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 6c6c25e..63be67e 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1781,6 +1781,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; @@ -2258,6 +2260,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)