From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A41B0C433FE for ; Wed, 23 Mar 2022 16:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234639AbiCWQHo (ORCPT ); Wed, 23 Mar 2022 12:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245366AbiCWQHn (ORCPT ); Wed, 23 Mar 2022 12:07:43 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53A97C7A6 for ; Wed, 23 Mar 2022 09:06:11 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KNtTZ0w8TzfZWm; Thu, 24 Mar 2022 00:04:34 +0800 (CST) Received: from dggpemm100005.china.huawei.com (7.185.36.231) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 00:06:07 +0800 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by dggpemm100005.china.huawei.com (7.185.36.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 00:06:06 +0800 Received: from lhreml710-chm.china.huawei.com ([169.254.81.184]) by lhreml710-chm.china.huawei.com ([169.254.81.184]) with mapi id 15.01.2308.021; Wed, 23 Mar 2022 16:06:04 +0000 From: Shameerali Kolothum Thodi To: Robin Murphy , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "iommu@lists.linux-foundation.org" CC: "jon@solid-run.com" , Linuxarm , "steven.price@arm.com" , "Guohanjun (Hanjun Guo)" , yangyicong , "Sami.Mujawar@arm.com" , "will@kernel.org" , wanghuiqiang Subject: RE: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Thread-Topic: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Thread-Index: AQHYJzoHyQwMkRcbbE6vVIIVTT4JpazL8g2AgAFXK+A= Date: Wed, 23 Mar 2022 16:06:04 +0000 Message-ID: References: <20220221154344.2126-1-shameerali.kolothum.thodi@huawei.com> <20220221154344.2126-6-shameerali.kolothum.thodi@huawei.com> <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> In-Reply-To: <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.227.178] Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogUm9iaW4gTXVycGh5IFtt YWlsdG86cm9iaW4ubXVycGh5QGFybS5jb21dDQo+IFNlbnQ6IDIyIE1hcmNoIDIwMjIgMTk6MDkN Cj4gVG86IFNoYW1lZXJhbGkgS29sb3RodW0gVGhvZGkgPHNoYW1lZXJhbGkua29sb3RodW0udGhv ZGlAaHVhd2VpLmNvbT47DQo+IGxpbnV4LWFybS1rZXJuZWxAbGlzdHMuaW5mcmFkZWFkLm9yZzsg bGludXgtYWNwaUB2Z2VyLmtlcm5lbC5vcmc7DQo+IGlvbW11QGxpc3RzLmxpbnV4LWZvdW5kYXRp b24ub3JnDQo+IENjOiBqb25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XN0X2hlYWQgKmhlYWQpIHsNCiAgICAgICAgc3RydWN0IGlvbW11X2Z3c3BlYyAqZndzcGVjID0g ZGV2X2lvbW11X2Z3c3BlY19nZXQoZGV2KTsNCg0KICAgICAgICBpb3J0X2lvbW11X21zaV9nZXRf cmVzdl9yZWdpb25zKGRldiwgaGVhZCk7DQogICAgICAgIGlvcnRfaW9tbXVfZ2V0X3JtcnMoZndz cGVjLT5pb21tdV9md25vZGUsIGRldiwgaGVhZCk7DQp9DQoNCnZvaWQgaW9ydF9pb21tdV9wdXRf cmVzdl9yZWdpb25zKHN0cnVjdCBkZXZpY2UgKmRldiwgc3RydWN0IGxpc3RfaGVhZCAqaGVhZCkg ew0KICAgLi8qRnJlZSBib3RoIFJNUnMgYW5kIEhXIE1TSSBvbmVzICovDQp9DQoNCi8qIFRoZSBi ZWxvdyBvbmVzIHdpbGwgYmUgZGlyZWN0bHkgY2FsbGVkIGZyb20gU01NVSBkcml2ZXJzIGR1cmlu ZyByZXNldCAqLw0Kdm9pZCBpb3J0X2dldF9ybXJfc2lkcyhzdHJ1Y3QgZndub2RlX2hhbmRsZSAq aW9tbXVfZndub2RlLCBzdHJ1Y3QgbGlzdF9oZWFkICpoZWFkKSB7DQogICAgICAgIGlvcnRfaW9t bXVfZ2V0X3JtcnMoaW9tbXVfZndub2RlLCBOVUxMLCBoZWFkKTsgfQ0KfQ0KDQp2b2lkIGlvcnRf cHV0X3Jtcl9zaWRzKHN0cnVjdCBmd25vZGVfaGFuZGxlICppb21tdV9md25vZGUsIHN0cnVjdCBs aXN0X2hlYWQgKmhlYWQpIHsNCiAgICAgICAgaW9ydF9pb21tdV9wdXRfcmVzdl9yZWdpb25zKE5V TEwsIGhlYWQpOw0KfQ0K From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8994BC433EF for ; Wed, 23 Mar 2022 16:06:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 370A441BAC; Wed, 23 Mar 2022 16:06:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yGT5aoDWRXnE; Wed, 23 Mar 2022 16:06:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id E5C80418E0; Wed, 23 Mar 2022 16:06:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B7CCAC0012; Wed, 23 Mar 2022 16:06:13 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 45B38C000B for ; Wed, 23 Mar 2022 16:06:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2AEC641BAC for ; Wed, 23 Mar 2022 16:06:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IhW1c41hAF7g for ; Wed, 23 Mar 2022 16:06:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by smtp4.osuosl.org (Postfix) with ESMTPS id 89891418E0 for ; Wed, 23 Mar 2022 16:06:11 +0000 (UTC) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KNtTZ0w8TzfZWm; Thu, 24 Mar 2022 00:04:34 +0800 (CST) Received: from dggpemm100005.china.huawei.com (7.185.36.231) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 00:06:07 +0800 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by dggpemm100005.china.huawei.com (7.185.36.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 00:06:06 +0800 Received: from lhreml710-chm.china.huawei.com ([169.254.81.184]) by lhreml710-chm.china.huawei.com ([169.254.81.184]) with mapi id 15.01.2308.021; Wed, 23 Mar 2022 16:06:04 +0000 To: Robin Murphy , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "iommu@lists.linux-foundation.org" Subject: RE: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Thread-Topic: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Thread-Index: AQHYJzoHyQwMkRcbbE6vVIIVTT4JpazL8g2AgAFXK+A= Date: Wed, 23 Mar 2022 16:06:04 +0000 Message-ID: References: <20220221154344.2126-1-shameerali.kolothum.thodi@huawei.com> <20220221154344.2126-6-shameerali.kolothum.thodi@huawei.com> <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> In-Reply-To: <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.227.178] MIME-Version: 1.0 X-CFilter-Loop: Reflected Cc: "jon@solid-run.com" , Linuxarm , "steven.price@arm.com" , "Guohanjun \(Hanjun Guo\)" , yangyicong , "Sami.Mujawar@arm.com" , "will@kernel.org" , wanghuiqiang X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Shameerali Kolothum Thodi via iommu Reply-To: Shameerali Kolothum Thodi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" > -----Original Message----- > From: Robin Murphy [mailto:robin.murphy@arm.com] > Sent: 22 March 2022 19:09 > To: Shameerali Kolothum Thodi ; > linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org; > iommu@lists.linux-foundation.org > Cc: jon@solid-run.com; Linuxarm ; > steven.price@arm.com; Guohanjun (Hanjun Guo) ; > yangyicong ; Sami.Mujawar@arm.com; > will@kernel.org; wanghuiqiang > Subject: Re: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR > memory regions > > On 2022-02-21 15:43, Shameer Kolothum via iommu wrote: > > Add helper functions (iort_iommu_get/put_rmrs()) that > > retrieves/releases RMR memory descriptors associated > > with a given IOMMU. This will be used by IOMMU drivers > > to set up necessary mappings. > > > > Invoke it from the generic iommu helper functions. > > iommu_dma_get_resv_regions() already exists - please extend that rather > than adding a parallel implementation of the same thing but different. > IORT should export a single get_resv_regions helper which combines the > new RMRs with the existing MSI workaround, and a separate "do I need to > bypass this StreamID" helper for the SMMU drivers to call directly at > reset time, since the latter isn't really an iommu-dma responsibility. Right. I actually had couple of back and forth on the interfaces and settled on this mainly because it just requires a single interface from IORT for both get_resv_regions() and SMMU driver reset bypass path. ie, iort_iommu_get/put_rmrs()). But agree the above comment is also valid. > I'm happy to do that just by shuffling wrappers around for now - we can > come back and streamline the code properly afterwards - but the sheer > amount of indirection currently at play here is so hard to follow that > it's not even all that easy to see how it's crossing abstraction levels > improperly. Please find below the revised ones. Please take a look and let me know. Thanks, Shameer iommu-dma: void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) { if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode)) iort_iommu_get_resv_regions(dev, list); } void iommu_dma_put_resv_regions(struct device *dev, struct list_head *list) { if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode)) iort_iommu_put_resv_regions(dev, list); generic_iommu_put_resv_regions(dev, list); } iort: void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head) { struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); iort_iommu_msi_get_resv_regions(dev, head); iort_iommu_get_rmrs(fwspec->iommu_fwnode, dev, head); } void iort_iommu_put_resv_regions(struct device *dev, struct list_head *head) { ./*Free both RMRs and HW MSI ones */ } /* The below ones will be directly called from SMMU drivers during reset */ void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode, struct list_head *head) { iort_iommu_get_rmrs(iommu_fwnode, NULL, head); } } void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode, struct list_head *head) { iort_iommu_put_resv_regions(NULL, head); } _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8594DC433EF for ; Wed, 23 Mar 2022 16:07:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h2DrJAZlqxtWpZiOHzdU2o/ZNlZcQbsDwyBuyD4DcVo=; b=bG3S8SVOJjkfPx 7vR6Cz0ZO0lIwFflkK0MFmZbHqhaehm3j4ousIWMgiTxS1jKjjNrceelt7Uzk2ry9GHnghNCfoQ1G ziny8YgYNWb9v87rLshEdn6TLDgY1AyMzX/5JOakSP3LCp2zl2ZtDT6674m/nOWn2txpIisyd5BvF vs7CSAE0D3INTVQXcgFOCSrYv9gpQPtYXvY99KDs7PwgBVyVLWs8aj1IwALG0RmDbjlpnS+tG0gAm U0x1nfScWtcsv+cbdpSRW2gM7h2ZhgtMDa7u67L19DVV65i5k4jY71Zx/e6u+TGip/TJYiZslIFnJ l9yAtjmdpNWo1H6W3tEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nX3V0-00ECRI-F3; Wed, 23 Mar 2022 16:06:14 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nX3Uw-00ECPp-Fj for linux-arm-kernel@lists.infradead.org; Wed, 23 Mar 2022 16:06:13 +0000 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KNtTZ0w8TzfZWm; Thu, 24 Mar 2022 00:04:34 +0800 (CST) Received: from dggpemm100005.china.huawei.com (7.185.36.231) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 00:06:07 +0800 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by dggpemm100005.china.huawei.com (7.185.36.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 00:06:06 +0800 Received: from lhreml710-chm.china.huawei.com ([169.254.81.184]) by lhreml710-chm.china.huawei.com ([169.254.81.184]) with mapi id 15.01.2308.021; Wed, 23 Mar 2022 16:06:04 +0000 From: Shameerali Kolothum Thodi To: Robin Murphy , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "iommu@lists.linux-foundation.org" CC: "jon@solid-run.com" , Linuxarm , "steven.price@arm.com" , "Guohanjun (Hanjun Guo)" , yangyicong , "Sami.Mujawar@arm.com" , "will@kernel.org" , wanghuiqiang Subject: RE: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Thread-Topic: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Thread-Index: AQHYJzoHyQwMkRcbbE6vVIIVTT4JpazL8g2AgAFXK+A= Date: Wed, 23 Mar 2022 16:06:04 +0000 Message-ID: References: <20220221154344.2126-1-shameerali.kolothum.thodi@huawei.com> <20220221154344.2126-6-shameerali.kolothum.thodi@huawei.com> <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> In-Reply-To: <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.227.178] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220323_090610_938846_8C459361 X-CRM114-Status: GOOD ( 19.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > -----Original Message----- > From: Robin Murphy [mailto:robin.murphy@arm.com] > Sent: 22 March 2022 19:09 > To: Shameerali Kolothum Thodi ; > linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org; > iommu@lists.linux-foundation.org > Cc: jon@solid-run.com; Linuxarm ; > steven.price@arm.com; Guohanjun (Hanjun Guo) ; > yangyicong ; Sami.Mujawar@arm.com; > will@kernel.org; wanghuiqiang > Subject: Re: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR > memory regions > > On 2022-02-21 15:43, Shameer Kolothum via iommu wrote: > > Add helper functions (iort_iommu_get/put_rmrs()) that > > retrieves/releases RMR memory descriptors associated > > with a given IOMMU. This will be used by IOMMU drivers > > to set up necessary mappings. > > > > Invoke it from the generic iommu helper functions. > > iommu_dma_get_resv_regions() already exists - please extend that rather > than adding a parallel implementation of the same thing but different. > IORT should export a single get_resv_regions helper which combines the > new RMRs with the existing MSI workaround, and a separate "do I need to > bypass this StreamID" helper for the SMMU drivers to call directly at > reset time, since the latter isn't really an iommu-dma responsibility. Right. I actually had couple of back and forth on the interfaces and settled on this mainly because it just requires a single interface from IORT for both get_resv_regions() and SMMU driver reset bypass path. ie, iort_iommu_get/put_rmrs()). But agree the above comment is also valid. > I'm happy to do that just by shuffling wrappers around for now - we can > come back and streamline the code properly afterwards - but the sheer > amount of indirection currently at play here is so hard to follow that > it's not even all that easy to see how it's crossing abstraction levels > improperly. Please find below the revised ones. Please take a look and let me know. Thanks, Shameer iommu-dma: void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) { if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode)) iort_iommu_get_resv_regions(dev, list); } void iommu_dma_put_resv_regions(struct device *dev, struct list_head *list) { if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode)) iort_iommu_put_resv_regions(dev, list); generic_iommu_put_resv_regions(dev, list); } iort: void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head) { struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); iort_iommu_msi_get_resv_regions(dev, head); iort_iommu_get_rmrs(fwspec->iommu_fwnode, dev, head); } void iort_iommu_put_resv_regions(struct device *dev, struct list_head *head) { ./*Free both RMRs and HW MSI ones */ } /* The below ones will be directly called from SMMU drivers during reset */ void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode, struct list_head *head) { iort_iommu_get_rmrs(iommu_fwnode, NULL, head); } } void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode, struct list_head *head) { iort_iommu_put_resv_regions(NULL, head); } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel