From patchwork Thu Apr 18 17:26:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162510 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1013597jan; Thu, 18 Apr 2019 10:26:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqymPw6p8OEnxuBw+pLzaNi6apgMiPqQPh5LuLbAMuoeW4r7QMwVrRGyXHTSe3Pj7QkRatF8 X-Received: by 2002:a17:902:442:: with SMTP id 60mr97697277ple.107.1555608392691; Thu, 18 Apr 2019 10:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555608392; cv=none; d=google.com; s=arc-20160816; b=fxd1nxEM1ECbo3NDvZ69jeOH10mwyhwhky66TSOUKOud8fYafnh0rgX9rNT9Qd4/qU 8skCFngyKhtioqtdBqr1aRCdhBBXqgw+8htrd+NA9ebYZV57ydpeTZe5PNvgNhvdwOXD tCQUGbINk5Z2mdQMw7uFHL8RMBiNNsyAmwxBgvb5YlrnKxZBNYIIfW/4ZJHTgt+prOMZ w0bx7KsBeVPfl+Vq/Lsex1T9lmmCqb5H3GZpx+JaypdJoftL4nDcNR8zpfrYL0WZCOrN 2+Zd+C9PXINuHqWeo83RI67lMiVmUFz7xHY8GPv0pbtlJ/Kj1eh7f7xtNBo5abE917p/ qpeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Irtig9TKUvmintWUz2Hf9Y4P6x83TxNzcS5xAQZQ0bc=; b=Z09evpdbQ1AIJBq8IIt6cAwax1Z7nbmnmpcjdqBK/8kevrOILWWHOkuAmx1A/SxcDo wZpqRNFSnMrq8C04c7Z2XUctdAGnlvdYky6T2AI1SP/gbHpMYj63gQLu+d/QD5huQNb3 UbpznZVYxk2Hdf8pPAvGCe9ffU5PX/V74NCGa1JbRJYk/xfhqadIs5Vg4ySm1HU/zYze DNkw3r2D+KzbvhaJAzLBM22PBn7NsOj260si+2rX+K8SmNSuPwsNagLODB2xbf4sNVcO hEGYQgxpuNiaC/xK5WwoT2I3fnkDd+x4n7uMs/6k0jxUXkb4SRICzT0ZaQctRDYWqlI6 Y7Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si2566052plo.157.2019.04.18.10.26.32; Thu, 18 Apr 2019 10:26:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389858AbfDRR0b (ORCPT + 30 others); Thu, 18 Apr 2019 13:26:31 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38084 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389841AbfDRR03 (ORCPT ); Thu, 18 Apr 2019 13:26:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8FB4516A3; Thu, 18 Apr 2019 10:26:28 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 57B6C3F557; Thu, 18 Apr 2019 10:26:26 -0700 (PDT) From: Julien Grall To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Cc: logang@deltatee.com, douliyangs@gmail.com, miquel.raynal@bootlin.com, marc.zyngier@arm.com, jason@lakedaemon.net, tglx@linutronix.de, joro@8bytes.org, robin.murphy@arm.com, bigeasy@linutronix.de, linux-rt-users@vger.kernel.org, Julien Grall Subject: [PATCH 3/7] irqchip/gicv2m: Don't map the MSI page in gicv2m_compose_msi_msg Date: Thu, 18 Apr 2019 18:26:07 +0100 Message-Id: <20190418172611.21561-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190418172611.21561-1-julien.grall@arm.com> References: <20190418172611.21561-1-julien.grall@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function gicv2m_compose_msi_msg may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg requires to be called from a preemptible context. A recent patch split the function iommu_dma_map_msi_msg in 2 functions: one that should be called in preemptible context, the other does not have any requirement. This patch reworks the gicv2m driver to avoid executing preemptible code in non-preemptible context by preparing the MSI mapping when allocating the MSI interrupt. Signed-off-by: Julien Grall --- drivers/irqchip/irq-gic-v2m.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index f5fe0100f9ff..e5372acd92c9 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -110,7 +110,7 @@ static void gicv2m_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) if (v2m->flags & GICV2M_NEEDS_SPI_OFFSET) msg->data -= v2m->spi_offset; - iommu_dma_map_msi_msg(data->irq, msg); + iommu_dma_compose_msi_msg(data->irq, msg); } static struct irq_chip gicv2m_irq_chip = { @@ -167,6 +167,7 @@ static void gicv2m_unalloc_msi(struct v2m_data *v2m, unsigned int hwirq, static int gicv2m_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *args) { + msi_alloc_info_t *info = args; struct v2m_data *v2m = NULL, *tmp; int hwirq, offset, i, err = 0; @@ -186,6 +187,11 @@ static int gicv2m_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, hwirq = v2m->spi_start + offset; + err = iommu_dma_prepare_msi(info->desc, + v2m->res.start + V2M_MSI_SETSPI_NS); + if (err) + return err; + for (i = 0; i < nr_irqs; i++) { err = gicv2m_irq_gic_domain_alloc(domain, virq + i, hwirq + i); if (err)