From patchwork Mon Aug 3 15:31:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 51867 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 4555E229FD for ; Mon, 3 Aug 2015 15:32:34 +0000 (UTC) Received: by labjm1 with SMTP id jm1sf13260540lab.0 for ; Mon, 03 Aug 2015 08:32:33 -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=F+tOjuhXJMHfCg9HE4y9vHLokf4vW21Hpc7mNZyI7mI=; b=U2h8Ot49zIUM1xMf7ZojXUXKB5hJzRzdid+VxS/g6h7jjljVY1rHS6N4GGPlalH7qB IYnlUb7xAvqE0MW/a0U97TO7UZWk+Soy4q3OFQd7TECM0M29IbkmO+Qf8KbB5SXuls8L VkZaweMZgACPeJ7BZ/u6JjlM5Q3pGN635RCacd5W3uWfFtdPIr3x4uWW5n6YmchB4U34 Q4reAWb2Jcu9TQGpI7qkaaL3oGceNXkrELQ7jISrMjq8aeznFOLewQAS7z2MAkEIeEDK NEyepc+thwIhprEJkOeEQxicsMvC6kmISZ1m2c28RfdesgOLLd8a0phytX1gPFrUXvuP Ip3A== X-Gm-Message-State: ALoCoQlxuvKMDBWLk6KekUIoZqM9TVZAaDMX66rn8LOqFHqxq0047PhjIQpR9bKvw9yF+t3wqTJ7 X-Received: by 10.180.7.201 with SMTP id l9mr1830866wia.0.1438615953189; Mon, 03 Aug 2015 08:32:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.165 with SMTP id p5ls510943lal.68.gmail; Mon, 03 Aug 2015 08:32:32 -0700 (PDT) X-Received: by 10.112.142.105 with SMTP id rv9mr17275790lbb.11.1438615952963; Mon, 03 Aug 2015 08:32:32 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id ll10si12300442lac.26.2015.08.03.08.32.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 08:32:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labgo9 with SMTP id go9so30455485lab.3 for ; Mon, 03 Aug 2015 08:32:32 -0700 (PDT) X-Received: by 10.112.125.34 with SMTP id mn2mr15888887lbb.76.1438615952850; Mon, 03 Aug 2015 08:32:32 -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.7.198 with SMTP id l6csp1933219lba; Mon, 3 Aug 2015 08:32:32 -0700 (PDT) X-Received: by 10.194.9.102 with SMTP id y6mr34722244wja.91.1438615947869; Mon, 03 Aug 2015 08:32:27 -0700 (PDT) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com. [209.85.212.172]) by mx.google.com with ESMTPS id hg7si14725887wib.66.2015.08.03.08.32.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 08:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.172 as permitted sender) client-ip=209.85.212.172; Received: by wibud3 with SMTP id ud3so141108721wib.1 for ; Mon, 03 Aug 2015 08:32:27 -0700 (PDT) X-Received: by 10.180.83.101 with SMTP id p5mr34004657wiy.52.1438615947463; Mon, 03 Aug 2015 08:32:27 -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 ny7sm14134420wic.11.2015.08.03.08.32.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 08:32:26 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, marc.zyngier@arm.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, pbonzini@redhat.com, andre.przywara@arm.com, p.fedin@samsung.com Subject: [PATCH v3 5/7] KVM: arm/arm64: build a default routing table Date: Mon, 3 Aug 2015 17:31:27 +0200 Message-Id: <1438615889-10892-6-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438615889-10892-1-git-send-email-eric.auger@linaro.org> References: <1438615889-10892-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.43 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 8114235..1b092e3 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1785,6 +1785,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; @@ -2266,6 +2268,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; +} + /** * kvm_set_msi: inject the MSI corresponding to the * MSI routing entry