From patchwork Mon Jun 29 15:37:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50429 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97AD4228D9 for ; Mon, 29 Jun 2015 15:38:08 +0000 (UTC) Received: by wgbbj7 with SMTP id bj7sf48364770wgb.2 for ; Mon, 29 Jun 2015 08:38:07 -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=7lpfzTHon27siaUFID1R51SwG1VGtIRyhq0T8R1136k=; b=AFWZuMxF6l9L3YX2ir3RI+cFbM4FaTXMmuhksusbyc4/jmuLktprqDgn1FYrSAx2v8 Ku1XW/9ARCT0SK5/Tj13bGzS+cX6xyc76pNmktXBnShiOJY6atlwpexCYw5EDFrw7xz3 e5GjIbT6667KJj6rh186iTzeFZlB6ppDkYiCPnj8pC82j9kQAy5hPuFftWJv/arNF1v7 oXhYDa+KuGO0tngWYCKnRL1vnZeZRN+KPpqH9uEtg+kghXeXTKMiMbt6OzdRJK0nyc6+ 9burBaL7IEuDtyR0kMVpzQHgdt1hMv3VMduXATIgnNQL5TfKyHLr5TfxC9ol3vPJNj0j 3rqA== X-Gm-Message-State: ALoCoQmqmrNCsvdsxmlOMtkKJZJW1if468/SkYDgMPSPkYgkpO3YIlIHXQy1D3wGbwGqQdm9iObU X-Received: by 10.194.179.42 with SMTP id dd10mr11222725wjc.7.1435592287960; Mon, 29 Jun 2015 08:38:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.103 with SMTP id l7ls792452laf.35.gmail; Mon, 29 Jun 2015 08:38:07 -0700 (PDT) X-Received: by 10.112.162.38 with SMTP id xx6mr14759498lbb.110.1435592287672; Mon, 29 Jun 2015 08:38:07 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id lf11si3340510lac.117.2015.06.29.08.38.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 08:38:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by laar3 with SMTP id r3so68407037laa.0 for ; Mon, 29 Jun 2015 08:38:07 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr14653847lay.72.1435592287129; Mon, 29 Jun 2015 08:38:07 -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 hn6csp1790137lbb; Mon, 29 Jun 2015 08:38:06 -0700 (PDT) X-Received: by 10.112.146.97 with SMTP id tb1mr15149521lbb.12.1435592277161; Mon, 29 Jun 2015 08:37:57 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com. [209.85.212.176]) by mx.google.com with ESMTPS id p4si13705804wif.91.2015.06.29.08.37.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 08:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.176 as permitted sender) client-ip=209.85.212.176; Received: by wiwl6 with SMTP id l6so103859827wiw.0 for ; Mon, 29 Jun 2015 08:37:56 -0700 (PDT) X-Received: by 10.194.104.98 with SMTP id gd2mr27954401wjb.35.1435592276748; Mon, 29 Jun 2015 08:37:56 -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.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 08:37:56 -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 Cc: linux-kernel@vger.kernel.org, patches@linaro.org, p.fedin@samsung.com, pbonzini@redhat.com Subject: [PATCH 6/7] KVM: arm/arm64: enable MSI routing Date: Mon, 29 Jun 2015 17:37:16 +0200 Message-Id: <1435592237-17924-7-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-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.44 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: , Up to now, only irqchip routing entries could be set. This patch adds the capability to insert MSI routing entries, extended or standard ones. Although standard MSI entries can be set, their injection still is not supported. For ARM64, let's also increase KVM_MAX_IRQ_ROUTES to 4096: include SPI irqchip flat routes plus MSI routes. In the future this might be extended. Signed-off-by: Eric Auger --- RFC -> PATCH: - move api MSI routing updates into that patch file - use new devid field of user api struct --- Documentation/virtual/kvm/api.txt | 9 +++++++++ include/linux/kvm_host.h | 2 ++ virt/kvm/arm/vgic.c | 13 +++++++++++++ 3 files changed, 24 insertions(+) diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 1e0d5f5..b411232 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -1405,6 +1405,10 @@ Sets the GSI routing table entries, overwriting any previously set entries. On arm/arm64, GSI routing has the following limitation: - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD. +On arm/arm64, MSI routing through in-kernel GICv3 ITS must use +KVM_IRQ_ROUTING_EXTENDED_MSI routing type to specify additionnal device ID. +Otherwise, KVM_IRQ_ROUTING_MSI must be used. + struct kvm_irq_routing { __u32 nr; __u32 flags; @@ -2315,6 +2319,11 @@ On arm/arm64, gsi routing being supported, the following can happen: - in case no routing entry is associated to this gsi, injection fails - in case the gsi is associated to an irqchip routing entry, irqchip.pin + 32 corresponds to the injected SPI ID. +- in case the gsi is associated to an MSI routing entry, + * without GICv3 ITS in-kernel emulation, MSI data patches the SPI ID + of the injected SPI + * with GICv3 ITS in-kernel emulation, the MSI message and device ID + are translated into an LPI. 4.76 KVM_PPC_ALLOCATE_HTAB diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index e1c1c0d..4ca8f8e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -927,6 +927,8 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq) #ifdef CONFIG_S390 #define KVM_MAX_IRQ_ROUTES 4096 //FIXME: we can have more than that... +#elif defined(CONFIG_ARM64) +#define KVM_MAX_IRQ_ROUTES 4096 #else #define KVM_MAX_IRQ_ROUTES 1024 #endif diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 410fee1..0b4c48c 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2258,6 +2258,19 @@ int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e, (e->irqchip.irqchip >= KVM_NR_IRQCHIPS)) goto out; break; + case KVM_IRQ_ROUTING_MSI: + e->set = kvm_set_msi; + e->msi.address_lo = ue->u.msi.address_lo; + e->msi.address_hi = ue->u.msi.address_hi; + e->msi.data = ue->u.msi.data; + break; + case KVM_IRQ_ROUTING_EXTENDED_MSI: + e->set = kvm_set_msi; + e->ext_msi.address_lo = ue->u.msi.address_lo; + e->ext_msi.address_hi = ue->u.msi.address_hi; + e->ext_msi.data = ue->u.msi.data; + e->ext_msi.devid = ue->devid; + break; default: goto out; }