From patchwork Tue Aug 2 17:23:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9259373 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 8DBE76077C for ; Tue, 2 Aug 2016 17:26:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B28428407 for ; Tue, 2 Aug 2016 17:26:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F9D1284DE; Tue, 2 Aug 2016 17:26:53 +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=ham 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 D234C28407 for ; Tue, 2 Aug 2016 17:26:52 +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 1bUdRG-00071s-35; Tue, 02 Aug 2016 17:25:10 +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 1bUdQW-0006HG-0J for linux-arm-kernel@lists.infradead.org; Tue, 02 Aug 2016 17:24:27 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 77711C03070B; Tue, 2 Aug 2016 17:24:03 +0000 (UTC) Received: from localhost.redhat.com (vpn1-7-179.ams2.redhat.com [10.36.7.179]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u72HNgIO017433; Tue, 2 Aug 2016 13:23:58 -0400 From: Eric Auger To: eric.auger@redhat.com, eric.auger.pro@gmail.com, christoffer.dall@linaro.org, marc.zyngier@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 v12 03/11] genirq: Introduce irq_get_msi_doorbell_info Date: Tue, 2 Aug 2016 17:23:29 +0000 Message-Id: <1470158617-7022-4-git-send-email-eric.auger@redhat.com> In-Reply-To: <1470158617-7022-1-git-send-email-eric.auger@redhat.com> References: <1470158617-7022-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 02 Aug 2016 17:24:03 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160802_102424_455445_32B5BDA3 X-CRM114-Status: GOOD ( 14.67 ) 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, dennis.chen@arm.com, 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 From: Eric Auger The purpose is to be able to retrieve the MSI doorbells of an irqchip. This is now needed since on some platforms those doorbells must be iommu mapped (in case the MSIs transit through an IOMMU that do not bypass those transactions). The assumption is there is a maximum of one doorbell region per cpu. The doorbell can be global or per cpu. A doorbell region is characterized by its physical address base, size, IOMMU protection flag and whether it implements IRQ remapping (aka. IRQ translation). Those characteristics are shared among all doorbells. irq_get_msi_doorbell_info callback enables to retrieve the doorbells of the irqchip. Signed-off-by: Eric Auger --- v11 -> v12: - remove tail comments and do proper kernel doc ones - align struct members - rename msi_doorbell_info into irq_get_msi_doorbell_info - remove line break v10 -> v11: - disappeared in V10 and restored now. struct irq_chip_msi_doorbell_info is identifical to the one in V10 (union, irq_remapping field). v7 -> v8: - size and prot now are shared among all doorbells - doorbells now directly points to a percpu phys_addr_t v7: creation --- include/linux/irq.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/include/linux/irq.h b/include/linux/irq.h index 4d758a7..27a6cd0 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -313,6 +313,26 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) } /** + * struct msi_doorbell_info - MSI doorbell region descriptor + * @percpu_doorbells: per cpu doorbell base address + * @global_doorbell: base address of the doorbell + * @doorbell_is_percpu: is the doorbell per cpu or global? + * @irq_remapping: is irq_remapping implemented? + * @size: size of the doorbell + * @prot: iommu protection flag + */ +struct msi_doorbell_info { + union { + phys_addr_t __percpu *percpu_doorbells; + phys_addr_t global_doorbell; + }; + bool doorbell_is_percpu; + bool irq_remapping; + size_t size; + int prot; +}; + +/** * struct irq_chip - hardware interrupt chip descriptor * * @name: name for /proc/interrupts @@ -349,6 +369,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) * @irq_get_irqchip_state: return the internal state of an interrupt * @irq_set_irqchip_state: set the internal state of a interrupt * @irq_set_vcpu_affinity: optional to target a vCPU in a virtual machine + * @irq_get_msi_doorbell_info: return the MSI doorbell info * @ipi_send_single: send a single IPI to destination cpus * @ipi_send_mask: send an IPI to destination cpus in cpumask * @flags: chip specific flags @@ -394,7 +415,7 @@ struct irq_chip { int (*irq_set_irqchip_state)(struct irq_data *data, enum irqchip_irq_state which, bool state); int (*irq_set_vcpu_affinity)(struct irq_data *data, void *vcpu_info); - + struct msi_doorbell_info *(*irq_get_msi_doorbell_info)(struct irq_data *data); void (*ipi_send_single)(struct irq_data *data, unsigned int cpu); void (*ipi_send_mask)(struct irq_data *data, const struct cpumask *dest);