From patchwork Mon Aug 3 15:31:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 51869 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 46FDB229FD for ; Mon, 3 Aug 2015 15:32:39 +0000 (UTC) Received: by wijp15 with SMTP id p15sf15098707wij.3 for ; Mon, 03 Aug 2015 08:32:38 -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=7edvv7jYTuTDyXbxDmGEfjSXGitGFE9AdZO8YUise5s=; b=durA6rSX/W8ZBMjkWHM6KkkJ0sRqOJ08g1XmIZxFD27Gg4UCi+tQXN98fo8BPflix6 6vI1Flw5spTFAuzGaSbmWKhrLy/0xpKez5pJmFRA39PhOlFlV/vIePm1hdT/bLnGNKOV 6EeuSWRPI9QNyc3FjihRTOtj3RSIYoJJShThVnylhSp5p6i1WuUjx+cHIe+Co0c4NPR6 wlyEsxBFQUfeuUXSfX0nWivtbsgxIdn8oYEoaaKzPwyccY6/S7SbqG9D2OrMj7G0jBHz D2A1va3bdsxyrabUlwhVcijiL1rvAxOJXQEc8jt0WrsW1vkFmt6wXUjwJ+tnsi6RMmYu dwQA== X-Gm-Message-State: ALoCoQlqd9QMVkJp8oY1tVRIzuODDH4hNAv23QiaagGRs0o7lBjz3nXlbXytY888ABrJQ91GgpXN X-Received: by 10.112.125.71 with SMTP id mo7mr1269084lbb.2.1438615958436; Mon, 03 Aug 2015 08:32:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.163 with SMTP id z3ls292060laj.32.gmail; Mon, 03 Aug 2015 08:32:38 -0700 (PDT) X-Received: by 10.112.142.196 with SMTP id ry4mr17640708lbb.68.1438615957976; Mon, 03 Aug 2015 08:32:37 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id r10si12268170lar.147.2015.08.03.08.32.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 08:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbyj8 with SMTP id yj8so79827834lbb.0 for ; Mon, 03 Aug 2015 08:32:37 -0700 (PDT) X-Received: by 10.112.160.42 with SMTP id xh10mr5436446lbb.88.1438615957747; Mon, 03 Aug 2015 08:32:37 -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 l6csp1933253lba; Mon, 3 Aug 2015 08:32:37 -0700 (PDT) X-Received: by 10.194.122.200 with SMTP id lu8mr33505557wjb.83.1438615951326; Mon, 03 Aug 2015 08:32:31 -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 fz7si11446083wjc.198.2015.08.03.08.32.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 08:32:31 -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 wibud3 with SMTP id ud3so141110885wib.1 for ; Mon, 03 Aug 2015 08:32:31 -0700 (PDT) X-Received: by 10.194.87.102 with SMTP id w6mr33612943wjz.111.1438615951004; Mon, 03 Aug 2015 08:32:31 -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.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 08:32:30 -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 7/7] KVM: arm: enable KVM_SIGNAL_MSI and MSI routing Date: Mon, 3 Aug 2015 17:31:29 +0200 Message-Id: <1438615889-10892-8-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.217.179 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: , If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl and MSI routing for arm too. Signed-off-by: Eric Auger --- v2 -> v3: - reword the commit message - add sanity check about devid provision v1 -> v2: - introduce vgic_v2m_inject_msi in vgic-v2-emul.c following Andre's advice --- arch/arm/kvm/Kconfig | 1 + virt/kvm/arm/vgic-v2-emul.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index 151e710..0f58baf 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD + select HAVE_KVM_MSI select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQ_ROUTING depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER diff --git a/virt/kvm/arm/vgic-v2-emul.c b/virt/kvm/arm/vgic-v2-emul.c index 8faa28c..ba2b393 100644 --- a/virt/kvm/arm/vgic-v2-emul.c +++ b/virt/kvm/arm/vgic-v2-emul.c @@ -478,6 +478,21 @@ static bool vgic_v2_queue_sgi(struct kvm_vcpu *vcpu, int irq) } /** + * vgic_v2m_inject_msi: emulates GICv2M MSI injection by injecting + * the SPI ID matching the msi data + * + * @kvm: pointer to the kvm struct + * @msi: the msi struct handle + */ +static int vgic_v2m_inject_msi(struct kvm *kvm, struct kvm_msi *msi) +{ + if (msi->flags & KVM_MSI_VALID_DEVID) + return -EINVAL; + + return kvm_vgic_inject_irq(kvm, 0, msi->data, 1); +} + +/** * kvm_vgic_map_resources - Configure global VGIC state before running any VCPUs * @kvm: pointer to the kvm struct * @@ -566,6 +581,7 @@ void vgic_v2_init_emulation(struct kvm *kvm) dist->vm_ops.add_sgi_source = vgic_v2_add_sgi_source; dist->vm_ops.init_model = vgic_v2_init_model; dist->vm_ops.map_resources = vgic_v2_map_resources; + dist->vm_ops.inject_msi = vgic_v2m_inject_msi; dist->vgic_cpu_base = VGIC_ADDR_UNDEF; dist->vgic_dist_base = VGIC_ADDR_UNDEF;