Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3741182yba; Mon, 29 Apr 2019 07:48:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1C4WmidXCCaz2j6HHNCVJedL48iJSkMBeT3/+q3k+GQBngFHFScxtJcVmAL1+0+wjOG5P X-Received: by 2002:a62:5795:: with SMTP id i21mr35290247pfj.194.1556549290615; Mon, 29 Apr 2019 07:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556549290; cv=none; d=google.com; s=arc-20160816; b=QuKnXDlSZTiIeJOdhiuEYvdaiKjQRF7mXoEtPYne/CueRzpImSnOCJdYe3XGvpUb7W Y58b71yaUtAYFYb6xuDfj2uex8A/YhBk2q0k/JbQMe9ECKv0LFBf4lWUh919cHWfOE/P /9Hsnl82owmF5A5CA0eof3t8AsMvpoHku7ursu2Pb9kvb63pi1MxFXJTZ/Bd+vmctXrI qEamQwhZZyV/9fvVhfm3WWeZwSbiEUr43sVU9uSdRP2u4qBQciIIAawWy4kmS+Ol8MuK f2qfBFfQD72fO26s+dSjqu4CHTq57fcRsq7QEPAmQpcjQN/Ef/9FT+biSA8QghWzTNw6 pe0g== 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=yu0plxhAFoD5sqOmylSICfzr57Gih8oh7V2n+duiSrE=; b=uZ86MEjiZqJLHCtN58rVC9NNfMzExg7V5oc0rKVsPVI2gBviuJyu7kXko1HUr36dCc mtHdeJGjourNbx2lmfpf/jF0AVU2Jc3ADLWZf0vI/xZVjg2/dx5o+jKZQEyKj/aYToK/ S/pMDkEmeSl4hx4uR+jVT3ADzUKTLrdJpmqoDSzKFLwQJclF18hbWhAsXKjZWaz7dyBn Rx2n4OX3GIe7rv7JRnv95vW0d0DPs/0/u3Sxdgb0awbvWOcjEOynwt2ZImQ9b/+OuO6+ 3FsWaypt/w5m0YJgvv4CHInRaXOQlVQVLy37IkeVzYbL17liWImsDwFitQuYCWNcG+/d /n5w== 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 z4si32464578plk.385.2019.04.29.07.47.54; Mon, 29 Apr 2019 07:48:10 -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 S1728476AbfD2Oou (ORCPT + 99 others); Mon, 29 Apr 2019 10:44:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59004 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728258AbfD2Oos (ORCPT ); Mon, 29 Apr 2019 10:44:48 -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 0A16DEBD; Mon, 29 Apr 2019 07:44:48 -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 AF5473F5C1; Mon, 29 Apr 2019 07:44:45 -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 v2 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg() Date: Mon, 29 Apr 2019 15:44:25 +0100 Message-Id: <20190429144428.29254-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190429144428.29254-1-julien.grall@arm.com> References: <20190429144428.29254-1-julien.grall@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 change 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 GICv3 ITS 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-gic-v3-its.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 7577755bdcf4..12ddbcfe1b1e 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(irq_data_get_msi_desc(d), 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) -- 2.11.0