From patchwork Thu Jul 9 08:22:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50925 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0244213FD for ; Thu, 9 Jul 2015 08:22:59 +0000 (UTC) Received: by lbko2 with SMTP id o2sf8031016lbk.0 for ; Thu, 09 Jul 2015 01:22:58 -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=fWuAYhVN58deJeY9raJaiaB5cDqKzn4XcmJPsCJ3tUU=; b=Cz1ULKOeKXZv/p+AkqhNWBOQvMd+MSi55sDKcwZasYsB/8bW4Fe7U7Ce6Quj3nmIjH X4bZ274hLM3oe1+zbdPj3qBCryVEd3OjK8H184tqB2wIAfayiYNw7Vjxh4h9P1g9Pr2y BHUE4nVJ7om+i/x+nnt4IwjFnv7d4OoQ+zAMPvxu+LJfK26Ezw6qKRJn2kRwHAxAX8JD n1Yjz43vcoaJcibpmLx+bZAhoOUb+L84cNZZ5FHWysD+kR/EmPZgibzbt/7EfzSzVIms ttDAgl7dYHQSTGHoBg4kF8UFt137mVqKOr4LBbuIxg4ITDtOrulstYBjUAK23xfHizGT AiXQ== X-Gm-Message-State: ALoCoQm+Qqsz7kXngzdAMCgSkfiw9QWf4i7McDLFaSb4kAG3gg9WpzFfnLh2MiHr/ULIxhkxSzfD X-Received: by 10.112.255.66 with SMTP id ao2mr7176896lbd.15.1436430178772; Thu, 09 Jul 2015 01:22:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.36 with SMTP id g4ls1091602lah.33.gmail; Thu, 09 Jul 2015 01:22:58 -0700 (PDT) X-Received: by 10.112.205.1 with SMTP id lc1mr13536643lbc.94.1436430178632; Thu, 09 Jul 2015 01:22:58 -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 g10si3824836laf.177.2015.07.09.01.22.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 01:22:58 -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 lagx9 with SMTP id x9so241214802lag.1 for ; Thu, 09 Jul 2015 01:22:58 -0700 (PDT) X-Received: by 10.152.42.177 with SMTP id p17mr13418309lal.29.1436430178513; Thu, 09 Jul 2015 01:22:58 -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 hn6csp492512lbb; Thu, 9 Jul 2015 01:22:57 -0700 (PDT) X-Received: by 10.194.205.37 with SMTP id ld5mr29884485wjc.14.1436430177584; Thu, 09 Jul 2015 01:22:57 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com. [209.85.212.171]) by mx.google.com with ESMTPS id o3si7791088wic.109.2015.07.09.01.22.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 01:22:57 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by wiwl6 with SMTP id l6so11105087wiw.0 for ; Thu, 09 Jul 2015 01:22:57 -0700 (PDT) X-Received: by 10.180.72.76 with SMTP id b12mr19076542wiv.93.1436430177327; Thu, 09 Jul 2015 01:22:57 -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.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 01:22: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, 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 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping Date: Thu, 9 Jul 2015 10:22:17 +0200 Message-Id: <1436430137-24205-8-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.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: , 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 for arm too. Signed-off-by: Eric Auger --- 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 | 12 ++++++++++++ 2 files changed, 13 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 1390797..43013cc 100644 --- a/virt/kvm/arm/vgic-v2-emul.c +++ b/virt/kvm/arm/vgic-v2-emul.c @@ -478,6 +478,17 @@ static bool vgic_v2_queue_sgi(struct kvm_vcpu *vcpu, int irq) } /** + * 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) +{ + 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 +577,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; kvm->arch.max_vcpus = VGIC_V2_MAX_CPUS; }