From patchwork Thu Apr 18 17:26:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162508 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1013514jan; Thu, 18 Apr 2019 10:26:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyG5EGz1fCuo/FYDC4ajUG/7oc5Ppbiz2smUJv7lV8U4kE9vjpG5osS9G40V07D2q833vGm X-Received: by 2002:a17:902:263:: with SMTP id 90mr43802414plc.257.1555608387942; Thu, 18 Apr 2019 10:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555608387; cv=none; d=google.com; s=arc-20160816; b=aDGbrm9JQTZy7AfurDPA9FpmvmJznAKJg8X75RMIa5cIajf8Sth6QEN394c2x9B8Ss 2gkv7F0iPad6LM0KoGtiyQGoV5BLCSWxaHkiv0HVvIObICWdEBEldxjlyGjOUC9kBhgn vd6an4ZP+LUTfZStbRSirZlzEGmicpxcr8RQiSPcwuGIHt8ATf+FygF0GDZCAzJqGvXP VLYGRyf4qjqI/JqyzWIgFDSd4jsww3gzt2berfDSBEvqRcMF4ojyiG0IiEKt/ZVrzvBj 8pD+9eYxvevQaJPNafgmKY0wPSBJupJiqCH0mxs+wmM55aTlQOVuumYdlIwWu43k1HET eGGw== 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=rt48lGQ09H92LmV3kHxSdTiClsiJUaMbQSG7qf7zVJQ=; b=qxjPJV0H+djdPRVSvbu6n1XLWNiSnD2mIst1JPxGR1PI4Nj9zqBCdM+6fe9TaxzKkw VLSXOBmbZAAjITinkr7G26HbDcd2aNa4z2Y8JBV5Hyqm3VWOVl4XdLYFttXGrfWMjyRy XplbAQE2vYC7h3f44ePAqK44A75v8slfdobCv3PiZhybYnxw+Wyp+XpxnM6LzGCd/Z5Z Vle2VuzGtYW+OPJx14OCdFMhHffgVEqpQMvjH5Yb1H34X+ULDXzBp0MtIXFTZK+kJ/PG oivuikMYsV6YFKaEWXTnX6acLR7ngnXJVGzlpy42xWvHrpyhaiqQ+H00szsFol8fG5L5 6Wzw== 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 d8si2566052plo.157.2019.04.18.10.26.27; Thu, 18 Apr 2019 10:26:27 -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 S2389829AbfDRR00 (ORCPT + 30 others); Thu, 18 Apr 2019 13:26:26 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731317AbfDRR0Y (ORCPT ); Thu, 18 Apr 2019 13:26:24 -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 97BA71688; Thu, 18 Apr 2019 10:26:23 -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 604463F557; Thu, 18 Apr 2019 10:26:21 -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 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie Date: Thu, 18 Apr 2019 18:26:05 +0100 Message-Id: <20190418172611.21561-2-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 When an MSI doorbell is located downstream of an IOMMU, it is required to swizzle the physical address with an appropriately-mapped IOVA for any device attached to one of our DMA ops domain. At the moment, the allocation of the mapping may be done when composing the message. However, the composing may be done in non-preemtible context while the allocation requires to be called from preemptible context. A follow-up patch will split the current logic in two functions requiring to keep an IOMMU cookie per MSI. This patch introduces a new field in msi_desc to store an IOMMU cookie when CONFIG_IOMMU_DMA is selected. Signed-off-by: Julien Grall --- include/linux/msi.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 diff --git a/include/linux/msi.h b/include/linux/msi.h index 7e9b81c3b50d..d7907feef1bb 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -77,6 +77,9 @@ struct msi_desc { struct device *dev; struct msi_msg msg; struct irq_affinity_desc *affinity; +#ifdef CONFIG_IOMMU_DMA + const void *iommu_cookie; +#endif union { /* PCI MSI/X specific data */