From patchwork Mon Aug 10 13:21:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6984101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 39FCE9F46B for ; Mon, 10 Aug 2015 13:25:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 605382070A for ; Mon, 10 Aug 2015 13:25:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F14720739 for ; Mon, 10 Aug 2015 13:25:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZOn3H-0001Vj-FS; Mon, 10 Aug 2015 13:23:43 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZOn24-0000lx-H8 for linux-arm-kernel@bombadil.infradead.org; Mon, 10 Aug 2015 13:22:28 +0000 Received: from mail-wi0-f176.google.com ([209.85.212.176]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZOn23-0005QU-AX for linux-arm-kernel@lists.infradead.org; Mon, 10 Aug 2015 13:22:27 +0000 Received: by wicja10 with SMTP id ja10so36951240wic.1 for ; Mon, 10 Aug 2015 06:22:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CY6Z5LELsKVuEzL/pEVYpNG46ENRzD1Eo1oFMX7wMeQ=; b=XCjiVviy2MX6WLv+vKc4HPP59TOw028CXcv19n3pkKZgVxN0AdJfJ4mPzdmSbxkI3z CDrAha2AIPp+g8V6mw9eSb0HpfTabf5RfJMAyTPRHakKPJT6GJbF5YFQIdAL4aeiO6Q0 cHpJynYsTumIzxL96sr326Crl3+CBtn5mbxHB6y+dg4i2eGTAJsYMuaumQ5WOJ/M9Ak1 IssUKozM5//HjpLDGWIdI3z0fhJUqENAYOxO42yNS0uqVVIabyxCj3KrHLeyltr6KHSW ZuRQ0MayOuaUTbcy8TN0ulYs7uVASKd2Btgmysn+gdlUb087iEJvuh33d4udRvWXBJ8L YhvQ== X-Gm-Message-State: ALoCoQkW/8RynrqxJDEQp1STW4jK2+cs3lKpuPZeFNAG0Ol89Of1tk94HqzZsa+Ba8Ezxg9pILjV X-Received: by 10.194.5.103 with SMTP id r7mr42570886wjr.47.1439212924948; Mon, 10 Aug 2015 06:22:04 -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 fq15sm29517024wjc.12.2015.08.10.06.22.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 06:22:04 -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, alex.williamson@redhat.com, feng.wu@intel.com Subject: [PATCH v3 08/10] KVM: arm/arm64: vgic: support irqfd injection of a forwarded IRQ Date: Mon, 10 Aug 2015 15:21:02 +0200 Message-Id: <1439212864-12954-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439212864-12954-1-git-send-email-eric.auger@linaro.org> References: <1439212864-12954-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150810_092227_488932_906F4A37 X-CRM114-Status: GOOD ( 14.03 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, linux-kernel@vger.kernel.org, patches@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently irqfd injection relies on kvm_vgic_inject_irq function. However this function cannot be used anymore for mapped IRQs. So let's change the implementation to use kvm_vgic_inject_mapped_irq when the IRQ is forwarded. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index fbd5ba5..03a85b3 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2529,13 +2529,19 @@ int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin) int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, bool line_status) { + struct irq_phys_map *map; unsigned int spi = irq + VGIC_NR_PRIVATE_IRQS; trace_kvm_set_irq(irq, level, irq_source_id); BUG_ON(!vgic_initialized(kvm)); - return kvm_vgic_inject_irq(kvm, 0, spi, level); + map = vgic_irq_map_search(kvm_get_vcpu(kvm, 0), spi); + + if (!map) + return kvm_vgic_inject_irq(kvm, 0, spi, level); + else + return kvm_vgic_inject_mapped_irq(kvm, 0, map, level); } /* MSI not implemented yet */