From patchwork Thu Nov 19 14:53:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7657951 Return-Path: X-Original-To: patchwork-kvm@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 8F5C09F2E2 for ; Thu, 19 Nov 2015 14:57:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5E832063C for ; Thu, 19 Nov 2015 14:57:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D09D3204D9 for ; Thu, 19 Nov 2015 14:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161012AbbKSO5M (ORCPT ); Thu, 19 Nov 2015 09:57:12 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:35319 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758602AbbKSOy0 (ORCPT ); Thu, 19 Nov 2015 09:54:26 -0500 Received: by wmdw130 with SMTP id w130so243643356wmd.0 for ; Thu, 19 Nov 2015 06:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qpV5/oXDcyb9Xv9DQ64gDETz4JnZodG4Tk1ZXxOtFz8=; b=cFWz1LOmTscCoHYF41YHAFjaHjb5o+tagJ6QImHyXk8p1KmpJcd2rd5XqQqPocHUup PnzK/xbawpnPc48K/ZrYne2aiJbyQ18OPVIRfzyS6GzJdX5T3iMRJBx/f+tMumYSFvk6 d1sPR/LtF06ZsHtBetZr3L2dGk1S4scyDaOla/iek0OvUKlX3FS3NYDaBIibuU6Cnebn 7LcSYyP3kg5BabI+5RgWEF5N2A0jtJ/7qFaj0hUJkiaPdhinzmewBI6OPERlC01fVAGk Ag/4v1xJhSoQOmmY5UZQu/GBKzAQlsLp5J7voWvJbj/trqbWrohvHCd2x4WORxn1Cbot iTNQ== 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=qpV5/oXDcyb9Xv9DQ64gDETz4JnZodG4Tk1ZXxOtFz8=; b=WbfTZlNhJxH05Fgujo+gHFQ8ps02B0moIuGN1hAMJe4xArJ1mhjwHF01XZ1XS6RCpI PQZ3L349Z2wYKqHFHCYffrp/AkhpKfQC49+0v3aq1b88e5rrVpMLw0/KumiSIl8P0VgL fvONOb9Xb7upatabyHuVBrBnMzGYlspdRsKaxuNN9/SQifkBQkATQvLQIXZUdz2sa6AG LiEU6ZGFUa5Fc3q8l+owcWyuDR60rQpYsjKldBKOaHYtAgsnYgvyk60WbKmPtsffbKjH iJJjMD0+i7DImrQPOsYCPNwDTIYh1LmyGuKizoKXa1+Bt/dEN9uV/JkuR9YCmcXFeWhZ cQFQ== X-Gm-Message-State: ALoCoQmq2Q6PUWwz0MT7HOFdfcvBZfYgqAgNs5Qiq250sSPWOcFvlPxrWmbiMhox3KaN2nLjKKIb X-Received: by 10.28.6.142 with SMTP id 136mr17172027wmg.9.1447944865652; Thu, 19 Nov 2015 06:54:25 -0800 (PST) Received: from new-host-3.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id h67sm34493865wmf.17.2015.11.19.06.54.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 06:54:24 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: andre.przywara@arm.com, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v4 09/13] KVM: arm/arm64: vgic: support irqfd injection of a mapped IRQ Date: Thu, 19 Nov 2015 14:53:59 +0000 Message-Id: <1447944843-17731-10-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447944843-17731-1-git-send-email-eric.auger@linaro.org> References: <1447944843-17731-1-git-send-email-eric.auger@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Up to now irqfd injection was only possible for unmapped IRQ. This patch adds support for injecting mapped interrupts. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index dba8eb6..e96f79e 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2476,13 +2476,21 @@ 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 vgic_dist *dist = &kvm->arch.vgic; unsigned int spi = irq + VGIC_NR_PRIVATE_IRQS; + struct irq_phys_map *map; + int vcpu_id; trace_kvm_set_irq(irq, level, irq_source_id); BUG_ON(!vgic_initialized(kvm)); - return kvm_vgic_inject_irq(kvm, 0, spi, level); + vcpu_id = dist->irq_spi_cpu[irq]; + map = vgic_irq_map_search(kvm_get_vcpu(kvm, vcpu_id), spi); + if (!map) + return kvm_vgic_inject_irq(kvm, vcpu_id, spi, level); + else + return kvm_vgic_inject_mapped_irq(kvm, vcpu_id, map, level); } /* MSI not implemented yet */