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 9D5D5C433EF for ; Fri, 25 Mar 2022 19:01:44 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BBtWNnbXnnWuvRkKvdRD2bK/HDJTVMQaSSiD2MVRfxI=; b=1SY2g6WAIAFj56 J54Fgdnq6jXLYYJTsPhrZX4FST0hYs0CzfsRLIoGkDn2zjoliqw+qvv/EwlUhIuZYmgt1i3HeePBY 4Ru4hOAw0l4FfK/iKNOOpgU8MGd6TeWPNN2gACxNA0L3pySesdzYP3s8Cml+BP8DLxxfW8tT3d29h bT7dEb5G0mzF6AR0ZuzS0D/QPWHXlSYVdlPzzfNeq9lW8NIVN6Xsk3o7BWzhFAAF7lbpRJN6wg0m5 AHEUDBdCZBbv+DdkiH7nPExJpKygOJJI42EBb03OCdDOPzwCFLKBWHmOdiHRUB+zrWzxiYob1RNTU +W3fuThfixBt3OG9n1Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXpB4-0032iS-Lm; Fri, 25 Mar 2022 19:00:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXo4O-002w4e-Jx for linux-arm-kernel@lists.infradead.org; Fri, 25 Mar 2022 17:49:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 54000D6E; Fri, 25 Mar 2022 10:49:48 -0700 (PDT) Received: from [10.57.41.19] (unknown [10.57.41.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4619F3F73D; Fri, 25 Mar 2022 10:49:46 -0700 (PDT) Message-ID: Date: Fri, 25 Mar 2022 17:49:39 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v8 05/11] ACPI/IORT: Add a helper to retrieve RMR memory regions Content-Language: en-GB 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 References: <20220221154344.2126-1-shameerali.kolothum.thodi@huawei.com> <20220221154344.2126-6-shameerali.kolothum.thodi@huawei.com> <479ae561-e03e-163e-f945-d0c8fdf8dcea@arm.com> From: Robin Murphy In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220325_104952_803836_DED472EB X-CRM114-Status: GOOD ( 18.91 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-03-23 16:06, Shameerali Kolothum Thodi wrote: > > >> -----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. Yeah, that looks like it should work! Cheers, Robin. > > 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