From patchwork Wed May 1 13:58:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 163218 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp4554675ill; Wed, 1 May 2019 06:58:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCcyWjHhgvUpHKXELSB4hQ2BcRDZN+5hOsjy9iJV3kfNbFMNb6Q01Yah3ErZIZ8z94QciU X-Received: by 2002:a17:902:e485:: with SMTP id cj5mr52276683plb.280.1556719133617; Wed, 01 May 2019 06:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556719133; cv=none; d=google.com; s=arc-20160816; b=CawsyYwbkRmJqidv9AHiBsXyTKbej5lNcryeSoUgjRtThlEjP6tugXR0EIfrnONajx u/d8Kt7g6pj+AcbdGHubNSMOQUM1CZ6ef+hfAvyuGzCyIrdNmOgKQ24+V0yr4bULxLRm U3v23VA+iXDlMjXn1xEP5+oUD763ofqy09fmbvafVmTV32opNeMShcrWBUSzQ0h4Y9mw wV3X1ptsA60ocVWm62a3H3QoCtn3Te5PngCzI/nmzNAXXeIWKXz9yBC1tEhJr+abe2hx s/DaevyfJwlpJtCsHJYy/fdkIlYIsPy9NahcpaarT4kuMfqtJW2+NukAM8IqLSqsZxg8 OYfQ== 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=4uyD06VnI+K4/O4nwGLyapphiM4GHbUIcL0mkfvEJmY=; b=PDRq92UNC9m6xt+QP/nZV1jcY9LY4YPGAjeRsB1raKJeXnRwSR22amhgnfhNxGaX8G oGZgA/UqZvAQA1+dcPbphP+s1pqXel9o+EfOjdRZAsfL0uNBWx7lb5B7kTSZNRm2iYZb 4w+wzZjj1k4MWCdULNttNSxmHzdgyHCiyIFev0YRj+SsxLvaMsJ+hpcB5f63czVjrqj4 Twp/OgiNvV5DKp5779zFrUHC9gTEn2P1gxHxvFTRsmHY9ATjd7Qoif6zJMpYy4v64oDH 8qT1xUcuS/J0V4K0hfpbb3Xt/wDBya72UHGyJladiO4w7ySDwXPlbBc9xlqNeDYryn7L oEzQ== 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 u4si39884444pga.245.2019.05.01.06.58.53; Wed, 01 May 2019 06:58:53 -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 S1726703AbfEAN6v (ORCPT + 30 others); Wed, 1 May 2019 09:58:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59716 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfEAN6t (ORCPT ); Wed, 1 May 2019 09:58:49 -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 2366215AD; Wed, 1 May 2019 06:58:49 -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 C884F3F5AF; Wed, 1 May 2019 06:58:46 -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 v3 5/7] irqchip/ls-scfg-msi: Don't map the MSI page in ls_scfg_msi_compose_msg() Date: Wed, 1 May 2019 14:58:22 +0100 Message-Id: <20190501135824.25586-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190501135824.25586-1-julien.grall@arm.com> References: <20190501135824.25586-1-julien.grall@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ls_scfg_msi_compose_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 iommu_dma_map_msi_msg() in two new functions: one that should be called in preemptible context, the other does not have any requirement. The FreeScale SCFG MSI driver is reworked to avoid executing preemptible code in non-preemptible context. This can be achieved by preparing the MSI maping when allocating the MSI interrupt. Signed-off-by: Julien Grall --- Changes in v2: - Rework the commit message to use imperative mood --- drivers/irqchip/irq-ls-scfg-msi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c index c671b3212010..669d29105772 100644 --- a/drivers/irqchip/irq-ls-scfg-msi.c +++ b/drivers/irqchip/irq-ls-scfg-msi.c @@ -100,7 +100,7 @@ static void ls_scfg_msi_compose_msg(struct irq_data *data, struct msi_msg *msg) msg->data |= cpumask_first(mask); } - iommu_dma_map_msi_msg(data->irq, msg); + iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), msg); } static int ls_scfg_msi_set_affinity(struct irq_data *irq_data, @@ -141,6 +141,7 @@ static int ls_scfg_msi_domain_irq_alloc(struct irq_domain *domain, unsigned int nr_irqs, void *args) { + msi_alloc_info_t *info = args; struct ls_scfg_msi *msi_data = domain->host_data; int pos, err = 0; @@ -157,6 +158,10 @@ static int ls_scfg_msi_domain_irq_alloc(struct irq_domain *domain, if (err) return err; + err = iommu_dma_prepare_msi(info->desc, msi_data->msiir_addr); + if (err) + return err; + irq_domain_set_info(domain, virq, pos, &ls_scfg_msi_parent_chip, msi_data, handle_simple_irq, NULL, NULL);