Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6150621yba; Wed, 1 May 2019 07:00:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5ZIClkthAxr7rNlkc4og2X7DQzQWmTq2hrbpPvdYXwWFXwoGoeuXGe65gz5a65mafjI9q X-Received: by 2002:a17:902:3324:: with SMTP id a33mr13041268plc.18.1556719219306; Wed, 01 May 2019 07:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556719219; cv=none; d=google.com; s=arc-20160816; b=awlIxScgnh65CSOnBaVuM/qVN4C7m+Op0CzAuoEyCGHD7f/xI7cvn9DpvIFiad84Eh Y0ocMx5OeU3qQS6oFpw/B4KwOAPjn2Dq74HTw238cxl52kxpBkrXYWutVk1D64ydOcKH fGf2G3AMQMr2T4sZSnokYOSfYqv0FEoDTo/881Rls6s3bdP1CV5oBxlIx8wwv0HvkkqL iGjx8nghdd37TECcJoNg61qzwJ/BcTlSKbGMhwUn5k3UU1MRydB1z7oI91QTLaI/GoUs 8DZ/jYsxzaPhrTzGExqfhW6QhVk2pH5oIDaoKHvTFk+iy7rSAixNOrw75v/E/v/0/OJ9 eB4g== 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 l18si42562443pfi.117.2019.05.01.07.00.03; Wed, 01 May 2019 07:00:19 -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 S1726698AbfEAN6v (ORCPT + 99 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(-) 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); -- 2.11.0