From patchwork Wed Jul 19 10:48:15 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: 9851475 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 BBBED60388 for ; Wed, 19 Jul 2017 10:49:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9A7B2861F for ; Wed, 19 Jul 2017 10:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE0322863E; Wed, 19 Jul 2017 10:49:19 +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 autolearn=unavailable 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 387F02861F for ; Wed, 19 Jul 2017 10:49:19 +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:In-Reply-To:References: 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=POFKa/d/Exq4/xuqmmx5RdsFai/rYlaOeXYC7R4vEt4=; b=eEup9W/1ALjkyC uAPUkf+uZy18K873Vr9D+BZegg2Je1IYJDOOiGhOZDuVKrPwp26715q4RuCQRISJIyo+8Fgfi1liC i1xVrwy5pDos8jwKxU6BBXQmBfetfx3R+2hs3nPYdJSqttfWf3z5tp3kn9xd3iakaE8UaE6PO4TVr FRucClEt9V+rh7Fv4vszum8Xt+O6rw8XVJ7I97/v4fDpvPfnzrsJD3JLFBnBUKZRwoBmXGd7N5deY E9g3GE4e0RkIK4EdbjjNAHmazJWBFPPH6zq6HnVOCSUdJjvrLAN0UDEPw1luQ8ZNULKxJzh3tdw4k Zk1gATxRcGud3n2TwxZw==; 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 1dXmXb-0004Kn-AM; Wed, 19 Jul 2017 10:49:15 +0000 Received: from lhrrgout.huawei.com ([194.213.3.17]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXmXX-0004JY-MZ for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2017 10:49:14 +0000 Received: from 172.18.7.190 (EHLO lhreml706-cah.china.huawei.com) ([172.18.7.190]) by lhrrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DKV54279; Wed, 19 Jul 2017 10:48:28 +0000 (GMT) Received: from FRAEML703-CAH.china.huawei.com (10.206.14.34) by lhreml706-cah.china.huawei.com (10.201.108.47) with Microsoft SMTP Server (TLS) id 14.3.301.0; Wed, 19 Jul 2017 11:48:25 +0100 Received: from FRAEML521-MBX.china.huawei.com ([169.254.1.170]) by fraeml703-cah.china.huawei.com ([10.206.14.34]) with mapi id 14.03.0301.000; Wed, 19 Jul 2017 12:48:15 +0200 From: Shameerali Kolothum Thodi To: Will Deacon Subject: RE: [PATCH v3 2/2] iommu/arm-smmu-v3:Enable ACPI based HiSilicon erratum 161010801 Thread-Topic: [PATCH v3 2/2] iommu/arm-smmu-v3:Enable ACPI based HiSilicon erratum 161010801 Thread-Index: AQHS7DFFi7c0p4udAkG6ulfdE+85P6JD3r6AgAEooOCADq7UgIAHaT9A Date: Wed, 19 Jul 2017 10:48:15 +0000 Message-ID: <5FC3163CFD30C246ABAA99954A238FA8383B9D5A@FRAEML521-MBX.china.huawei.com> References: <20170623145801.325244-1-shameerali.kolothum.thodi@huawei.com> <20170623145801.325244-3-shameerali.kolothum.thodi@huawei.com> <20170704173820.GO22175@arm.com> <5FC3163CFD30C246ABAA99954A238FA83839DB59@FRAEML521-MBX.china.huawei.com> <20170714193322.GH26488@arm.com> In-Reply-To: <20170714193322.GH26488@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.203.177.212] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.596F38FF.0029, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=169.254.1.170, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 5d3a4de8e57cf8094a22f1e171481096 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170719_034912_068028_09770B4C X-CRM114-Status: GOOD ( 17.47 ) 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: "lorenzo.pieralisi@arm.com" , Gabriele Paoloni , "marc.zyngier@arm.com" , John Garry , "Guohanjun \(Hanjun Guo\)" , Linuxarm , "linux-acpi@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "hanjun.guo@linaro.org" , "Wangzhou \(B\)" , "sudeep.holla@arm.com" , "robin.murphy@arm.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 > -----Original Message----- > From: Will Deacon [mailto:will.deacon@arm.com] > Sent: Friday, July 14, 2017 8:33 PM > To: Shameerali Kolothum Thodi > Cc: lorenzo.pieralisi@arm.com; marc.zyngier@arm.com; > sudeep.holla@arm.com; robin.murphy@arm.com; hanjun.guo@linaro.org; > Gabriele Paoloni; John Garry; Linuxarm; linux-acpi@vger.kernel.org; > iommu@lists.linux-foundation.org; Wangzhou (B); Guohanjun (Hanjun Guo); > linux-arm-kernel@lists.infradead.org; devel@acpica.org > Subject: Re: [PATCH v3 2/2] iommu/arm-smmu-v3:Enable ACPI based > HiSilicon erratum 161010801 > [...] > > > > - list_add_tail(®ion->list, head); > > > > + if ((smmu->options & ARM_SMMU_OPT_RESV_HW_MSI)) { > > > > + > > > > + if (!is_of_node(smmu->dev->fwnode)) > > > > + resv = iort_iommu_its_get_resv_regions(dev, head); > > > > > > How does this work when we're not using ACPI? Shouldn't of vs ACPI > > > be abstracted from the driver? > > > > At present ARM_SMMU_OPT_RESV_HW_MSI is only set for ACPI and DT > > support for this is a low priority for us at the moment. Is the > > suggestion is to have a common function outside the smmu driver for > > _iommu_its_get_resv_regions() ? I am not sure what is the best way here. > > Right, something like that. The driver shouldn't need to care whether or not > it's using ACPI or DT when setting these options. Below is what I have in mind for the common function for msi reserve. But just wondering invoking iort_ functions from iommu code is acceptable or not . Could you please take a look and let me know. Many thanks, Shameer http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --- 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 @@ -198,6 +199,24 @@ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) } EXPORT_SYMBOL(iommu_dma_get_resv_regions); +/** + * iommu_dma_get_msi_resv_regions - Reserved region driver helper + * @dev: Device from iommu_get_resv_regions() + * @list: Reserved region list from iommu_get_resv_regions() + * + * IOMMU drivers can use this to implement their .get_resv_regions + * callback for HW MSI specific reservations. For now, this only + * covers ITS MSI region reservation using ACPI IORT helper function. + */ +int iommu_dma_get_msi_resv_regions(struct device *dev, struct list_head *list) +{ + if (!is_of_node(dev->iommu_fwspec->iommu_fwnode)) + return iort_iommu_its_get_resv_regions(dev, list); + + return -ENODEV; +} +EXPORT_SYMBOL(iommu_dma_get_msi_resv_regions); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org