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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2828C433EF for ; Thu, 16 Sep 2021 07:26:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB31260F6C for ; Thu, 16 Sep 2021 07:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234735AbhIPH2F (ORCPT ); Thu, 16 Sep 2021 03:28:05 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3833 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbhIPH2E (ORCPT ); Thu, 16 Sep 2021 03:28:04 -0400 Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H97rF22wjz67PNJ; Thu, 16 Sep 2021 15:24:29 +0800 (CST) Received: from lhreml711-chm.china.huawei.com (10.201.108.62) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 09:26:42 +0200 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml711-chm.china.huawei.com (10.201.108.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 08:26:42 +0100 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.008; Thu, 16 Sep 2021 08:26:41 +0100 From: Shameerali Kolothum Thodi To: Jon Nettleton , Robin Murphy CC: Lorenzo Pieralisi , Shameerali Kolothum Thodi , Laurentiu Tudor , linux-arm-kernel , ACPI Devel Maling List , Linux IOMMU , Joerg Roedel , Will Deacon , wanghuiqiang , "Guohanjun (Hanjun Guo)" , Steven Price , Sami Mujawar , Eric Auger , yangyicong Subject: RE: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Thread-Topic: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Thread-Index: AQHXidEiKr58723PTUGGkSglF1QKPatlAmqAgDJmwoCAACN+gIAO55og Date: Thu, 16 Sep 2021 07:26:41 +0000 Message-ID: References: <20210805080724.480-1-shameerali.kolothum.thodi@huawei.com> <20210805080724.480-3-shameerali.kolothum.thodi@huawei.com> <20210805160319.GB23085@lpieralisi> <5d9bebdf-6eb5-49a0-2e8f-490df2d6754d@arm.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.83.177] 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 DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogSm9uIE5ldHRsZXRvbiBb bWFpbHRvOmpvbkBzb2xpZC1ydW4uY29tXQ0KPiBTZW50OiAwNiBTZXB0ZW1iZXIgMjAyMSAyMDo1 MQ0KPiBUbzogUm9iaW4gTXVycGh5IDxyb2Jpbi5tdXJwaHlAYXJtLmNvbT4NCj4gQ2M6IExvcmVu em8gUGllcmFsaXNpIDxsb3JlbnpvLnBpZXJhbGlzaUBhcm0uY29tPjsgU2hhbWVlcmFsaSBLb2xv dG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AwMDAwODAwMDAwMCAweDAwMDAwMDAwMDgwZmZmZmYgbXNpDQo+IDB4 MDAwMDAwMDgwYzAwMDAwMCAweDAwMDAwMDA4MWJmZmZmZmYgZGlyZWN0LXJlbGF4YWJsZQ0KPiAw eDAwMDAwMDFjMDAwMDAwMDAgMHgwMDAwMDAxYzAwMWZmZmZmIGRpcmVjdC1yZWxheGFibGUNCj4g MHgwMDAwMDAyMDgwMDAwMDAwIDB4MDAwMDAwMjA5ZmZmZmZmZiBkaXJlY3QtcmVsYXhhYmxlDQo+ IA0KPiAtSm9uDQo+IA0KPiA+DQo+ID4gUm9iaW4uDQo= 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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F05D4C433EF for ; Thu, 16 Sep 2021 07:26:51 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 777D560F6B for ; Thu, 16 Sep 2021 07:26:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 777D560F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2F72C82FE7; Thu, 16 Sep 2021 07:26:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 47muUMNT_r1O; Thu, 16 Sep 2021 07:26:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1408282FEA; Thu, 16 Sep 2021 07:26:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D95CCC000F; Thu, 16 Sep 2021 07:26:49 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3D4EAC000D for ; Thu, 16 Sep 2021 07:26:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1FE7F82FEA for ; Thu, 16 Sep 2021 07:26:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r1Uah5EiyhPB for ; Thu, 16 Sep 2021 07:26:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 7668B82FE7 for ; Thu, 16 Sep 2021 07:26:46 +0000 (UTC) Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H97rF22wjz67PNJ; Thu, 16 Sep 2021 15:24:29 +0800 (CST) Received: from lhreml711-chm.china.huawei.com (10.201.108.62) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 09:26:42 +0200 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml711-chm.china.huawei.com (10.201.108.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 08:26:42 +0100 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.008; Thu, 16 Sep 2021 08:26:41 +0100 From: Shameerali Kolothum Thodi To: Jon Nettleton , Robin Murphy Subject: RE: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Thread-Topic: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Thread-Index: AQHXidEiKr58723PTUGGkSglF1QKPatlAmqAgDJmwoCAACN+gIAO55og Date: Thu, 16 Sep 2021 07:26:41 +0000 Message-ID: References: <20210805080724.480-1-shameerali.kolothum.thodi@huawei.com> <20210805080724.480-3-shameerali.kolothum.thodi@huawei.com> <20210805160319.GB23085@lpieralisi> <5d9bebdf-6eb5-49a0-2e8f-490df2d6754d@arm.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.83.177] MIME-Version: 1.0 X-CFilter-Loop: Reflected Cc: Steven Price , ACPI Devel Maling List , Linux IOMMU , wanghuiqiang , "Guohanjun \(Hanjun Guo\)" , yangyicong , Sami Mujawar , Will Deacon , linux-arm-kernel 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" > -----Original Message----- > From: Jon Nettleton [mailto:jon@solid-run.com] > Sent: 06 September 2021 20:51 > To: Robin Murphy > Cc: Lorenzo Pieralisi ; Shameerali Kolothum Thodi > ; Laurentiu Tudor > ; linux-arm-kernel > ; ACPI Devel Maling List > ; Linux IOMMU > ; Linuxarm ; > Joerg Roedel ; Will Deacon ; > wanghuiqiang ; Guohanjun (Hanjun Guo) > ; Steven Price ; Sami > Mujawar ; Eric Auger ; > yangyicong > Subject: Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing > [...] > > > > > > On the prot value assignment based on the remapping flag, I'd like > > > to hear Robin/Joerg's opinion, I'd avoid being in a situation where > > > "normally" this would work but then we have to quirk it. > > > > > > Is this a valid assumption _always_ ? > > > > No. Certainly applying IOMMU_CACHE without reference to the device's > > _CCA attribute or how CPUs may be accessing a shared buffer could lead > > to a loss of coherency. At worst, applying IOMMU_MMIO to a > > device-private buffer *could* cause the device to lose coherency with > > itself if the memory underlying the RMR may have allocated into system > > caches. Note that the expected use for non-remappable RMRs is the > > device holding some sort of long-lived private data in system RAM - > > the MSI doorbell trick is far more of a niche hack really. > > > > At the very least I think we need to refer to the device's memory > > access properties here. > > > > Jon, Laurentiu - how do RMRs correspond to the EFI memory map on your > > firmware? I'm starting to think that as long as the underlying memory > > is described appropriately there then we should be able to infer > > correct attributes from the EFI memory type and flags. > > The devices are all cache coherent and marked as _CCA, 1. The Memory > regions are in the virt table as ARM_MEMORY_REGION_ATTRIBUTE_DEVICE. > > The current chicken and egg problem we have is that during the fsl-mc-bus > initialization we call > > error = acpi_dma_configure_id(&pdev->dev, DEV_DMA_COHERENT, > &mc_stream_id); > > which gets deferred because the SMMU has not been initialized yet. Then we > initialize the RMR tables but there is no device reference there to be able to > query device properties, only the stream id. After the IORT tables are parsed > and the SMMU is setup, on the second device probe we associate everything > based on the stream id and the fsl-mc-bus device is able to claim its 1-1 DMA > mappings. Can we solve this order problem by delaying the iommu_alloc_resv_region() to the iommu_dma_get_rmr_resv_regions(dev, list) ? We could invoke device_get_dma_attr() from there which I believe will return the _CCA attribute. Or is that still early to invoke that? Thanks, Shameer > cat /sys/kernel/iommu_groups/0/reserved_regions > 0x0000000001000000 0x0000000010ffffff direct-relaxable > 0x0000000008000000 0x00000000080fffff msi > 0x000000080c000000 0x000000081bffffff direct-relaxable > 0x0000001c00000000 0x0000001c001fffff direct-relaxable > 0x0000002080000000 0x000000209fffffff direct-relaxable > > -Jon > > > > > Robin. _______________________________________________ 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 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FBCBC433F5 for ; Thu, 16 Sep 2021 07:29:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C3E4E61164 for ; Thu, 16 Sep 2021 07:29:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C3E4E61164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=23jKqWjh4ffQqu5ziQbd4sQvSUao0zJcbDqLDXgsyTw=; b=L4TKUD7wEpiHHW uliXGeBUziVQEdou7sIHJbd9/42/S60QWkbbXkunNi0wi4fOI3oBnSpvOcpu7HeW39gdq4b4HY+9o DawJlnptz2p9dTTJJ38K5jdVyDBsXz7693iUq4eyVZa2fT6hS3GpeO6fgwmyhcienkJK5JMZIqCsy PjVfyVDeYy+ES3sEMpaclzoThZn6mvdSK8U5AhP/RF3DE5gX1lj9SYkuVEGO0efj4sLt9a0h4ZBLe IFn0fCtkbSaYDUAuS9oxudaVYnhU0oXIfYNFpm0tiGBimwG2MBSQG0IpnyU0N0MM6ayQ0YGLvJO2s UD/P2bmHSyFrkMLMHKyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQlnO-00ASzG-2S; Thu, 16 Sep 2021 07:26:58 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQlnJ-00ASyV-DO for linux-arm-kernel@lists.infradead.org; Thu, 16 Sep 2021 07:26:55 +0000 Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H97rF22wjz67PNJ; Thu, 16 Sep 2021 15:24:29 +0800 (CST) Received: from lhreml711-chm.china.huawei.com (10.201.108.62) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 09:26:42 +0200 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by lhreml711-chm.china.huawei.com (10.201.108.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 08:26:42 +0100 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.008; Thu, 16 Sep 2021 08:26:41 +0100 From: Shameerali Kolothum Thodi To: Jon Nettleton , Robin Murphy CC: Lorenzo Pieralisi , Shameerali Kolothum Thodi , Laurentiu Tudor , linux-arm-kernel , ACPI Devel Maling List , Linux IOMMU , Joerg Roedel , Will Deacon , wanghuiqiang , "Guohanjun (Hanjun Guo)" , Steven Price , Sami Mujawar , Eric Auger , yangyicong Subject: RE: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Thread-Topic: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing Thread-Index: AQHXidEiKr58723PTUGGkSglF1QKPatlAmqAgDJmwoCAACN+gIAO55og Date: Thu, 16 Sep 2021 07:26:41 +0000 Message-ID: References: <20210805080724.480-1-shameerali.kolothum.thodi@huawei.com> <20210805080724.480-3-shameerali.kolothum.thodi@huawei.com> <20210805160319.GB23085@lpieralisi> <5d9bebdf-6eb5-49a0-2e8f-490df2d6754d@arm.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.83.177] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210916_002653_792156_FDBFB14D X-CRM114-Status: GOOD ( 27.58 ) 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: Jon Nettleton [mailto:jon@solid-run.com] > Sent: 06 September 2021 20:51 > To: Robin Murphy > Cc: Lorenzo Pieralisi ; Shameerali Kolothum Thodi > ; Laurentiu Tudor > ; linux-arm-kernel > ; ACPI Devel Maling List > ; Linux IOMMU > ; Linuxarm ; > Joerg Roedel ; Will Deacon ; > wanghuiqiang ; Guohanjun (Hanjun Guo) > ; Steven Price ; Sami > Mujawar ; Eric Auger ; > yangyicong > Subject: Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing > [...] > > > > > > On the prot value assignment based on the remapping flag, I'd like > > > to hear Robin/Joerg's opinion, I'd avoid being in a situation where > > > "normally" this would work but then we have to quirk it. > > > > > > Is this a valid assumption _always_ ? > > > > No. Certainly applying IOMMU_CACHE without reference to the device's > > _CCA attribute or how CPUs may be accessing a shared buffer could lead > > to a loss of coherency. At worst, applying IOMMU_MMIO to a > > device-private buffer *could* cause the device to lose coherency with > > itself if the memory underlying the RMR may have allocated into system > > caches. Note that the expected use for non-remappable RMRs is the > > device holding some sort of long-lived private data in system RAM - > > the MSI doorbell trick is far more of a niche hack really. > > > > At the very least I think we need to refer to the device's memory > > access properties here. > > > > Jon, Laurentiu - how do RMRs correspond to the EFI memory map on your > > firmware? I'm starting to think that as long as the underlying memory > > is described appropriately there then we should be able to infer > > correct attributes from the EFI memory type and flags. > > The devices are all cache coherent and marked as _CCA, 1. The Memory > regions are in the virt table as ARM_MEMORY_REGION_ATTRIBUTE_DEVICE. > > The current chicken and egg problem we have is that during the fsl-mc-bus > initialization we call > > error = acpi_dma_configure_id(&pdev->dev, DEV_DMA_COHERENT, > &mc_stream_id); > > which gets deferred because the SMMU has not been initialized yet. Then we > initialize the RMR tables but there is no device reference there to be able to > query device properties, only the stream id. After the IORT tables are parsed > and the SMMU is setup, on the second device probe we associate everything > based on the stream id and the fsl-mc-bus device is able to claim its 1-1 DMA > mappings. Can we solve this order problem by delaying the iommu_alloc_resv_region() to the iommu_dma_get_rmr_resv_regions(dev, list) ? We could invoke device_get_dma_attr() from there which I believe will return the _CCA attribute. Or is that still early to invoke that? Thanks, Shameer > cat /sys/kernel/iommu_groups/0/reserved_regions > 0x0000000001000000 0x0000000010ffffff direct-relaxable > 0x0000000008000000 0x00000000080fffff msi > 0x000000080c000000 0x000000081bffffff direct-relaxable > 0x0000001c00000000 0x0000001c001fffff direct-relaxable > 0x0000002080000000 0x000000209fffffff direct-relaxable > > -Jon > > > > > Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel