From patchwork Tue Jul 19 13:02:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9237307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A245E60574 for ; Tue, 19 Jul 2016 13:14:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92DDB1FF8F for ; Tue, 19 Jul 2016 13:14:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8761E26C2F; Tue, 19 Jul 2016 13:14:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 890B81FF8F for ; Tue, 19 Jul 2016 13:14:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPUpE-0001W1-Vs; Tue, 19 Jul 2016 13:12:41 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPUgm-0000UP-Si for linux-arm-kernel@lists.infradead.org; Tue, 19 Jul 2016 13:04:02 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE529C04D284; Tue, 19 Jul 2016 13:03:39 +0000 (UTC) Received: from localhost.redhat.com (vpn1-4-201.ams2.redhat.com [10.36.4.201]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6JD2omX022501; Tue, 19 Jul 2016 09:03:34 -0400 From: Eric Auger To: eric.auger@redhat.com, eric.auger.pro@gmail.com, marc.zyngier@arm.com, christoffer.dall@linaro.org, andre.przywara@arm.com, robin.murphy@arm.com, alex.williamson@redhat.com, will.deacon@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, linux-arm-kernel@lists.infradead.org Subject: [PATCH v11 08/10] irqchip/gicv3-its: register the MSI global doorbell Date: Tue, 19 Jul 2016 13:02:45 +0000 Message-Id: <1468933367-23159-9-git-send-email-eric.auger@redhat.com> In-Reply-To: <1468933367-23159-1-git-send-email-eric.auger@redhat.com> References: <1468933367-23159-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 19 Jul 2016 13:03:39 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160719_060357_404117_CEC1AD15 X-CRM114-Status: GOOD ( 14.61 ) 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: drjones@redhat.com, kvm@vger.kernel.org, Jean-Philippe.Brucker@arm.com, Manish.Jaggi@caviumnetworks.com, p.fedin@samsung.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, iommu@lists.linux-foundation.org, pranav.sawargaonkar@gmail.com, pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu, robert.richter@caviumnetworks.com, yehuday@marvell.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds the registration of the MSI global doorbell in gicv3-its driver plus the implementation for irq_chip msi_doorbell_info ops. This will allow the msi layer to iommu_map this doorbell when requested. Signed-off-by: Eric Auger --- v10 -> v11: - adapt to new doorbell registration API and implement msi_doorbell_info --- drivers/irqchip/irq-gic-v3-its.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 5eb1f9e..23102e3 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -84,6 +86,7 @@ struct its_node { u32 ite_size; u32 device_ids; int numa_node; + struct irq_chip_msi_doorbell_info *doorbell_info; }; #define ITS_ITT_ALIGN SZ_256 @@ -656,6 +659,16 @@ static void its_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *msg) msg->data = its_get_event_id(d); } +static struct irq_chip_msi_doorbell_info * +its_msi_doorbell_info(struct irq_data *d) +{ + struct its_device *its_dev = irq_data_get_irq_chip_data(d); + struct its_node *its = its_dev->its; + + return its->doorbell_info; +} + + static struct irq_chip its_irq_chip = { .name = "ITS", .irq_mask = its_mask_irq, @@ -663,6 +676,7 @@ static struct irq_chip its_irq_chip = { .irq_eoi = irq_chip_eoi_parent, .irq_set_affinity = its_set_affinity, .irq_compose_msi_msg = its_irq_compose_msi_msg, + .msi_doorbell_info = its_msi_doorbell_info, }; /* @@ -1607,6 +1621,7 @@ static int __init its_probe(struct device_node *node, if (of_property_read_bool(node, "msi-controller")) { struct msi_domain_info *info; + phys_addr_t translater; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { @@ -1614,10 +1629,23 @@ static int __init its_probe(struct device_node *node, goto out_free_tables; } + translater = its->phys_base + GITS_TRANSLATER; + its->doorbell_info = + msi_doorbell_register_global(translater, sizeof(u32), + IOMMU_WRITE | IOMMU_MMIO, + true); + + if (IS_ERR_OR_NULL(its->doorbell_info)) { + kfree(info); + goto out_free_tables; + } + + inner_domain = irq_domain_add_tree(node, &its_domain_ops, its); if (!inner_domain) { err = -ENOMEM; kfree(info); + msi_doorbell_unregister_global(its->doorbell_info); goto out_free_tables; }