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: Auger Eric X-Patchwork-Id: 50923 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E60A4213FD for ; Thu, 9 Jul 2015 08:22:54 +0000 (UTC) Received: by wgbbj7 with SMTP id bj7sf77256262wgb.2 for ; Thu, 09 Jul 2015 01:22:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=i/bnf5MpgYcPFu3WYI30ccRgs0RfoRQ4DPbk5ugfby8=; b=cxG5Vwz59EkuCYJmZgYDVl0I1EX/rf6U+eMjILCWlWkGisXiMPl1TmPdlOrmy52gnh qnWcea/Jq10khT8sIF49d+uXwfJHTP4ulv/64JbuTVLb2ropcFjyzMSLF5vlIY9hxiKL r3jQeIt9rS2EGHxJwmbeYno3mwfgr84nDxz+U0xavV9q/z4nCqAMqbyd8VGs523XFowx 47LsEcOUVQk3g+R1bx5y84TYPexw3KIJq0X56xTiPkeHTv+ZltIvyMl20BmxgBoO2HBG b9vezXTrV5dVtmgXqTuQvpH8I0rRav5PTzCB00ppnHiXqaY9QrZ+IvB8utzhQ23WYZKK 45oQ== X-Gm-Message-State: ALoCoQlazwG6ZGCztaO5CI+QFIZF2vhgaSCZcT9VsRhvHKc41kiAYbls0Clc6ivrSs+NWwn4VGOl X-Received: by 10.180.186.36 with SMTP id fh4mr2717174wic.7.1436430174249; Thu, 09 Jul 2015 01:22:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.168 with SMTP id kz8ls883151lac.105.gmail; Thu, 09 Jul 2015 01:22:54 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr11943073lak.56.1436430174084; Thu, 09 Jul 2015 01:22:54 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id an8si161511lac.79.2015.07.09.01.22.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 01:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lagc2 with SMTP id c2so238381300lag.3 for ; Thu, 09 Jul 2015 01:22:54 -0700 (PDT) X-Received: by 10.152.18.162 with SMTP id x2mr13551718lad.73.1436430173991; Thu, 09 Jul 2015 01:22:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp492463lbb; Thu, 9 Jul 2015 01:22:53 -0700 (PDT) X-Received: by 10.194.236.71 with SMTP id us7mr28160717wjc.90.1436430173341; Thu, 09 Jul 2015 01:22:53 -0700 (PDT) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com. [209.85.212.174]) by mx.google.com with ESMTPS id cs3si7781705wib.117.2015.07.09.01.22.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 01:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.174 as permitted sender) client-ip=209.85.212.174; Received: by wiwl6 with SMTP id l6so11103399wiw.0 for ; Thu, 09 Jul 2015 01:22:53 -0700 (PDT) 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 Cc: patches@linaro.org, andre.przywara@arm.com, p.fedin@samsung.com, pbonzini@redhat.com 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)