From patchwork Thu Apr 18 17:26:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162511 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1013624jan; Thu, 18 Apr 2019 10:26:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+vVSExO2baae5TMOCop2BF9UMrBIIaWdP0hjOy6CqFODWug0Ajh5C/uNqpFbJ/etjjgKP X-Received: by 2002:a63:5511:: with SMTP id j17mr6810718pgb.449.1555608394237; Thu, 18 Apr 2019 10:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555608394; cv=none; d=google.com; s=arc-20160816; b=sdYmm2hE9XnjYsRZcrqLUG2RrDgLxxhX3zINwF496RxoYifNKqiY+D3GlamDKEtcZb yEiM0JlbfrYyG5LaJBPhbC7aHNyqScugbD4MKeETbMczl4EKvLzu4WQ1Fo8HN5XmKWeA 3PgjjA4w1Cn2spvOXIFmyXBStyLIZT70HN+wTAr76WTgovAVZcAFJ3ebsJPaxAZ8mcJY u1/eUL/ytLwov0kYYVPuxVe5EsX7CP6ebo3WJBZiWkqsKQBxFJ8d8CO0I889birQgfh6 lqh4MEENJJdLio/UOtAifme4Lu6fO/ntCkHyoIKkwomX4PGcsKNeWfNEXsD32gSRlEnt xxSQ== 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=DkuAo2FPtKsFHGaxurxp3u9bAm1qg7ThklpdM7f4dpI=; b=KQaeX4Iz+WG6awXfafMX5eeSJpbSxdywRNPzFhweYMV+bzaL3bApRhcPnXSLLjaDo+ vHqGHk3oBtjFpUakq/IOTXaaPz49vhMCh18Ugp/HHEoLd7OwRiRbn6Gn9Ue6axJT76Ji bSPxGOWVY1eQw4EzpsLALtCSlVk9aDNNoT9TCLzTz58eOOGNp+FTkMyxt6mmphCR7t1w 3iVLP55W0gU5RKZzmVrinr8/aRB45Xi/3yAkbeJZJGPu8AzXoO2Mdei2K0LEMiLEjq1o Nm+QKOkTq360YbPjKLOBpFeyyXrZy+18ZBBxIt6kb8EydTBEwvMGyXThB15/TFsumBAw 4FYQ== 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 i37si2416807pgb.436.2019.04.18.10.26.33; Thu, 18 Apr 2019 10:26:34 -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 S2389871AbfDRR0c (ORCPT + 30 others); Thu, 18 Apr 2019 13:26:32 -0400 Received: from foss.arm.com ([217.140.101.70]:38102 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389856AbfDRR0b (ORCPT ); Thu, 18 Apr 2019 13:26:31 -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 1300580D; Thu, 18 Apr 2019 10:26:31 -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 CE0E93F557; Thu, 18 Apr 2019 10:26:28 -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 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg Date: Thu, 18 Apr 2019 18:26:08 +0100 Message-Id: <20190418172611.21561-5-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 its_irq_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 GICv3 ITS 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-v3-its.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 7577755bdcf4..1e8e01797d9b 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1179,7 +1179,7 @@ static void its_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *msg) msg->address_hi = upper_32_bits(addr); msg->data = its_get_event_id(d); - iommu_dma_map_msi_msg(d->irq, msg); + iommu_dma_compose_msi_msg(d->irq, msg); } static int its_irq_set_irqchip_state(struct irq_data *d, @@ -2566,6 +2566,7 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, { msi_alloc_info_t *info = args; struct its_device *its_dev = info->scratchpad[0].ptr; + struct its_node *its = its_dev->its; irq_hw_number_t hwirq; int err; int i; @@ -2574,6 +2575,8 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, if (err) return err; + err = iommu_dma_prepare_msi(info->desc, its->get_msi_base(its_dev)); + for (i = 0; i < nr_irqs; i++) { err = its_irq_gic_domain_alloc(domain, virq + i, hwirq + i); if (err)