From patchwork Wed May 4 15:18:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9016001 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 A89A79F39D for ; Wed, 4 May 2016 15:21:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0AF3203A0 for ; Wed, 4 May 2016 15:21:42 +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 CCD6A203AB for ; Wed, 4 May 2016 15:21:41 +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 1axyae-0000t4-Eo; Wed, 04 May 2016 15:19:52 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1axyZm-0000B1-W4 for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2016 15:19:00 +0000 Received: by mail-wm0-x233.google.com with SMTP id g17so100241007wme.1 for ; Wed, 04 May 2016 08:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5KPAV/8SjWfN0X6H8BcEn1R8MR04bxg7IBUHfrOVMqs=; b=O5bri79GLEPZvNQS/ANuTcrIjQpz4anLk2YS1VMD1JoaxFG1EgQgRD9lxfpUfqPRIH VraJ9cN2zuJM7vuSdpdAeymvFV9l//gLKQUJw3sejrPblLDGJn76C7PSf9476XG9lzIi HIUlsx7yS8wahk9NAd1biIMsJoR0gbYxxfF/4= 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=5KPAV/8SjWfN0X6H8BcEn1R8MR04bxg7IBUHfrOVMqs=; b=kvYkpOvyIeZ1Md9is1FYbUa1ZAyTfXvYGBAiBRnihKNBESVC4w2V60tAplel89p5jI bDoqfYhmBhtHALEFY8998tYA026EI7qiyQqRblNTSGrTVYtTK3aHsMi84MgdwLDpX3mO cJe1heJOqgbgxZyPF/ThMvrjTUsuY2A3Ud4m2I6UKVuF9wey+U3rG50+vmYVe17icOvm EHOnFDtepLKr6ZbCKnVSgNDj5oeNJ5J02sPObeIbgDLpH2JVtPCYxC2W6KRfdlUqmNmz eTmAlfcB6G9ZzHBUIFFqcj8c43jSHS5G/60oGUYBsllfFSOUjfpQ+487u/HM7GxUiAm6 gNJA== X-Gm-Message-State: AOPr4FXE+GX9QYw+Aap23uND/Bs9FlQVsAtnLV1GacnFWa9O6+wSshvJ9i0xpb+6mX65tSvs X-Received: by 10.28.72.132 with SMTP id v126mr9848403wma.49.1462375117251; Wed, 04 May 2016 08:18:37 -0700 (PDT) Received: from new-host-57.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id c4sm4773821wjm.24.2016.05.04.08.18.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 May 2016 08:18:36 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, robin.murphy@arm.com, alex.williamson@redhat.com, will.deacon@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, christoffer.dall@linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 6/8] irqchip/gicv2m: implement msi_doorbell_info callback Date: Wed, 4 May 2016 15:18:12 +0000 Message-Id: <1462375094-2390-7-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462375094-2390-1-git-send-email-eric.auger@linaro.org> References: <1462375094-2390-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160504_081859_204222_27518545 X-CRM114-Status: GOOD ( 15.16 ) X-Spam-Score: -2.7 (--) 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: julien.grall@arm.com, patches@linaro.org, Jean-Philippe.Brucker@arm.com, p.fedin@samsung.com, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, iommu@lists.linux-foundation.org, pranav.sawargaonkar@gmail.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-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 This patch implements the msi_doorbell_info callback in the gicv2m driver. The driver now is able to return its doorbell characteristics (base, size, prot). A single doorbell is exposed. This will allow the msi layer to iommu_map this doorbell when requested. Signed-off-by: Eric Auger --- v8 -> v9: - use global_doorbell instead of percpu_doorbells v7 -> v8: - gicv2m_msi_doorbell_info does not return a pointer to const - remove spurious !v2m check - add IOMMU_MMIO flag v7: creation --- drivers/irqchip/irq-gic-v2m.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index 28f047c..c77c41f 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -24,6 +24,7 @@ #include #include #include +#include /* * MSI_TYPER: @@ -64,6 +65,7 @@ struct v2m_data { u32 nr_spis; /* The number of SPIs for MSIs */ unsigned long *bm; /* MSI vector bitmap */ u32 flags; /* v2m flags for specific implementation */ + struct irq_chip_msi_doorbell_info doorbell_info; }; static void gicv2m_mask_msi_irq(struct irq_data *d) @@ -105,6 +107,14 @@ static void gicv2m_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) msg->data -= v2m->spi_start; } +static struct irq_chip_msi_doorbell_info * +gicv2m_msi_doorbell_info(struct irq_data *data) +{ + struct v2m_data *v2m = irq_data_get_irq_chip_data(data); + + return &v2m->doorbell_info; +} + static struct irq_chip gicv2m_irq_chip = { .name = "GICv2m", .irq_mask = irq_chip_mask_parent, @@ -112,6 +122,7 @@ static struct irq_chip gicv2m_irq_chip = { .irq_eoi = irq_chip_eoi_parent, .irq_set_affinity = irq_chip_set_affinity_parent, .irq_compose_msi_msg = gicv2m_compose_msi_msg, + .msi_doorbell_info = gicv2m_msi_doorbell_info, }; static int gicv2m_irq_gic_domain_alloc(struct irq_domain *domain, @@ -311,6 +322,11 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode, memcpy(&v2m->res, res, sizeof(struct resource)); + v2m->doorbell_info.global_doorbell = v2m->res.start; + v2m->doorbell_info.doorbell_is_percpu = false; + v2m->doorbell_info.size = sizeof(u32); + v2m->doorbell_info.prot = IOMMU_WRITE | IOMMU_MMIO; + v2m->base = ioremap(v2m->res.start, resource_size(&v2m->res)); if (!v2m->base) { pr_err("Failed to map GICv2m resource\n");