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: Auger Eric X-Patchwork-Id: 67158 Delivered-To: patches@linaro.org Received: by 10.140.92.199 with SMTP id b65csp242035qge; Wed, 4 May 2016 08:18:41 -0700 (PDT) X-Received: by 10.28.87.6 with SMTP id l6mr10386861wmb.48.1462375117496; Wed, 04 May 2016 08:18:37 -0700 (PDT) Return-Path: Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com. [2a00:1450:400c:c09::22e]) by mx.google.com with ESMTPS id gx6si5488730wjb.76.2016.05.04.08.18.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 08:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::22e as permitted sender) client-ip=2a00:1450:400c:c09::22e; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of eric.auger@linaro.org designates 2a00:1450:400c:c09::22e as permitted sender) smtp.mailfrom=eric.auger@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x22e.google.com with SMTP id a17so100417210wme.0 for ; Wed, 04 May 2016 08:18:37 -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=STtVH+xj05dhTlHhwqGi7E9ykFBhiSr2EZk1uzJt7A5PWTs1uj2cB06hQ2qbgQNbRA VxL+x9+OpiIqj6VX5X2ru5dgkBgMysKJsWD1yx9JKtQE0o4KEwKUpWLoYajh40gNW7Lr V7CJSezVOzvfMSIB2Jte4gPIGP7nzABCvw/AnRl30/lSHHyS8CmJyWrtmb6GwKyfz+uT JEglHziYpWF+EBCSov650h1e4/ZhbTcfM2JowBDBRaTvOpRMgIRDixZRP0qx/haxsMRD OePXpfEDq/yFCnfiTYZqt6JCGgOWbTLY0cBBUj6F1xHuVrMskIPsM+7jdHAU55bEef8L Uv6g== X-Gm-Message-State: AOPr4FVyAzeQ3hQpa/wC+TnEZtU0wTKpaDTkzWEAtgJpRLn2xX/JlVrZCcBUR332eK2dYzeuVBA= X-Received: by 10.28.72.132 with SMTP id v126mr9848403wma.49.1462375117251; Wed, 04 May 2016 08:18:37 -0700 (PDT) Return-Path: 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 Cc: patches@linaro.org, linux-kernel@vger.kernel.org, Bharat.Bhushan@freescale.com, pranav.sawargaonkar@gmail.com, p.fedin@samsung.com, iommu@lists.linux-foundation.org, Jean-Philippe.Brucker@arm.com, julien.grall@arm.com, yehuday@marvell.com 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> 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(+) -- 1.9.1 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");