From patchwork Mon Apr 29 14:44:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 163035 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp1973484ill; Mon, 29 Apr 2019 07:44:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaswMCKsWhdXkbd1C6+AhX7pQrM4ElMzncayY+RQ3x8z9TC61MpKoxtRZ981JQzfcgL/JR X-Received: by 2002:aa7:924a:: with SMTP id 10mr17321963pfp.15.1556549097755; Mon, 29 Apr 2019 07:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556549097; cv=none; d=google.com; s=arc-20160816; b=GnjWgAL1StuBnyUL99PL7XBOmV9nUXqUs+O8P2pqNgTgM5BD01YXxTKqtW2fTFosCa xGZAqo7ZhkObLuADaOVvpDv8G3Blixg6GlgtkbVAc3Xf8MQHP8q3S3M686nyg1ijZ3zz zKMP+Tk2pi4WAFRgnqnhyOMYxhGHdjgx2dIj6qOi49s3U2raRj/YxUIoLKGaIoCQVPKM eFFBLIMhBsKkXV0P8b4cPgv9L1LgmhDXdmlCYwGGuaVnTsL++FlGluN4YtYYvp8afE75 gBp3gR8ChzfZGphrLQ64QKDHGLMqKN3NAIezk0xnHQ1gGdtLRHNSMKbc1wek/P6U0o+i e6nw== 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=uzqyA+bKdBr/hIfN5LuvcYGAEemJADHxYF/AoQmcboacz08pFMyR5/+0dq6JgwUT/C 7V3TJnc1/8AUy/m6voKCYxqinpDPhBbOp8fhNdzTPg0O5NcPIj0XxY4Vk2J/qepac495 zNioMIotWpw4hiALH1hEUs+HL07wHBo74N24xfeKWkKcrhLU4yreyZQlGn8DrPNi1iMT TLEaUCRV90wqOcDx7/gC6yXhLznpqQngrhOAaojKJ4e3PuuxDFEVTsOd+wjnzquRQeij COYR/GGPPyKonhdkIYvbwwcxnEcMr3RmOLI2vhW2EEi/LrWt9lwAvAK9CHCxF16qpOvI dFMw== 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 h19si589630pgg.125.2019.04.29.07.44.57; Mon, 29 Apr 2019 07:44:57 -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 S1728358AbfD2Oo4 (ORCPT + 30 others); Mon, 29 Apr 2019 10:44:56 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728480AbfD2Oov (ORCPT ); Mon, 29 Apr 2019 10:44:51 -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 99DD3165C; Mon, 29 Apr 2019 07:44:50 -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 4AE1D3F5C1; Mon, 29 Apr 2019 07:44:48 -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 5/7] irqchip/ls-scfg-msi: Don't map the MSI page in ls_scfg_msi_compose_msg() Date: Mon, 29 Apr 2019 15:44:26 +0100 Message-Id: <20190429144428.29254-6-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 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);