From patchwork Tue Aug 1 10:49:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 9874231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 13D5F6038F for ; Tue, 1 Aug 2017 10:59:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ABDA285F9 for ; Tue, 1 Aug 2017 10:59:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F19E2867D; Tue, 1 Aug 2017 10:59:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8A0B0285F9 for ; Tue, 1 Aug 2017 10:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L1xIoaIyPnIoCPtYatRjVcgcwTWtYdw9ioA/A3vXFUM=; b=imuy0sA2QIM2ME reY3jK2A4BIuvaRbh/386j6zxNx5mvgAzZHfXJlHbrfZiBx0CGeQgZNVTPc1Rqb31vrf5cEypKa+D yD4jNlhZ6QqknbIsDh1dufJCbr1VnSdGvUpTzb86T4sm52P+vFEufIiXUBWf2YZbE+VI3XM8Q1vTq tkm3vP+C9+v56j2yfRu1iktfJCaJpJc5QTR0cXHlW9WZwPeUY4q5iaZePa/T1Y1t1+Jeiv+1HbmFc YH+4J1H5vUf8tiYoeIhFAwdC1mRwr2dmxl0BEjTVK59dL3i8DnTShR+/cAk01GCpEBMtRcsP9Qen5 R2O9cOdQllFIvfmGtRUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dcUtv-0000rz-7J; Tue, 01 Aug 2017 10:59:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcUti-0000T3-6M for linux-arm-kernel@bombadil.infradead.org; Tue, 01 Aug 2017 10:59:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Tl6wgWx6MmMV06wlFJZDfSP48n8rwG1MDIxmsxCcI8A=; b=GMg6xX2OD6ZM7uUIxEuemYIMx bVIJQfhYm4BZSqAvPR9uyv8uuLeDmKRH5BcyNUX3x6cPFNiCrN0xUlze3lT3jt7y9MwLavfxZxdJB o6k7zu7KYrnpUpu5q/Yp63aew3Iu40zpLNOlKoSzdxCqeT0nTQ8ACvchOVqabUgoWDksFhHOdqMVP XHQytDH4xM8srr175GSkxtQwPohwVZMr7/K/CauoEdezNRKWkf0EL5pPSKOqrpoU7+57kS3j+N2qL h1YrORCiBkBLzlC7DuqL/UaFLKhUW5QCi8abRVYpVUvQwEW/fpT0y/N3Lj1hdDjsOPFRacbyAE+IL Qr71gIgJw==; Received: from szxga02-in.huawei.com ([45.249.212.188]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcUnD-0003KM-Qa for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2017 10:52:55 +0000 Received: from 172.30.72.56 (EHLO dggeml406-hub.china.huawei.com) ([172.30.72.56]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ASO11134; Tue, 01 Aug 2017 18:51:49 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.203.177.212) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server id 14.3.301.0; Tue, 1 Aug 2017 18:51:40 +0800 From: Shameer Kolothum To: , , , , , Subject: [PATCH v5 2/2] iommu/dma: Add HW MSI address regions reservation Date: Tue, 1 Aug 2017 11:49:13 +0100 Message-ID: <20170801104913.71912-3-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20170801104913.71912-1-shameerali.kolothum.thodi@huawei.com> References: <20170801104913.71912-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.203.177.212] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.59805D45.0156, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1fcf839a1d2ac9029d2e0539db5ec465 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170801_115253_423473_FE77BA95 X-CRM114-Status: GOOD ( 12.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gabriele.paoloni@huawei.com, john.garry@huawei.com, linuxarm@huawei.com, Shameer Kolothum , linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, wangzhou1@hisilicon.com, guohanjun@huawei.com, linux-arm-kernel@lists.infradead.org, devel@acpica.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Modified iommu_dma_get_resv_regions() to include HW MSI (ARM GICv3 ITS MSI) specific reservations if available. Suggested-by: Robin Murphy Signed-off-by: Shameer Kolothum --- drivers/iommu/dma-iommu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 9d1cebe..44eca1e 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -19,6 +19,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -167,13 +168,18 @@ void iommu_put_dma_cookie(struct iommu_domain *domain) * * IOMMU drivers can use this to implement their .get_resv_regions callback * for general non-IOMMU-specific reservations. Currently, this covers host - * bridge windows for PCI devices. + * bridge windows for PCI devices and HW MSI(ARM GICv3 ITS MSI) region + * reservations if available. */ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) { struct pci_host_bridge *bridge; struct resource_entry *window; + if (!is_of_node(dev->iommu_fwspec->iommu_fwnode) && + iort_iommu_its_get_resv_regions(dev, list) < 0) + return; + if (!dev_is_pci(dev)) return;