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 22104C433F5 for ; Sat, 23 Apr 2022 02:06:20 +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=1VZBzb+B5PJZuYUUlRZK1gsvcSFv+dO6aRUZW8REWgw=; b=oVdbb50Gtnv9g3 n4jYr9H5z8A9mCB88CgoGZy3+oyg8t6hTslHFH/YOn0Y5xXJkiv/40cDqUY4OXxkn0ws2aCp1iI2/ Rxd63WP1ISZtJlGtMSvnWrsFnPsxFaXM/gsUxNHBQw3oY6iCiUHsChmuoT+oK1zhOWuWzHXWfNcFc Mnt/dOsMkEcz2z+gESAH6+3SkJkh+r100HgMo2vzxUzWbbjmYQquYTA2+9AFeLx8rZXVnH1JTcjjJ eKNcU1iBWkm1TUjJ++Fz4KlBPy75Q8MIGEDJrRl4wDm143iw57IpLGVOnaZk6VWrY8wemI1kTpStM jgmnCqsH2toNhLzkUY6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ni58x-003EA3-FT; Sat, 23 Apr 2022 02:05:03 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ni58u-003E8w-4k for linux-arm-kernel@lists.infradead.org; Sat, 23 Apr 2022 02:05:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650679500; x=1682215500; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=SgvVuK7l6aZvlPJGCsW/d8rxkK2pzgLzH+13/+UoEGw=; b=c21P0rjOHobekjPFnrmC/ZV/5fW3g7yYlvzKfT3oagqFDBfCDblA/bTb tT6IrHHu7LyTSnosWpCiuF7kkuUIpWEsw8DzV2gQE4pU9gP4KFN/uisXK jO3q2+meaI2AWKrydX2VjgjOReCYZz9hFBsmqXz00D2G70dGVwI4dUWMo /ThEiXsWG9d5l5RuC6AsrZiztn8hf5uaA5XBdZxGoxPKSt5CFsKzs2Kb9 F9ifNLALGaZ6gdgGsPRF3jFKqLvMhsCmoyBzY5VLbcDM79Ju7IJwZcfKt TqVOGNyL9iVeIKq818U7ihzIRS8iu5XKUcWqhnmib5L95W7NAw1reVsmL w==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="263682652" X-IronPort-AV: E=Sophos;i="5.90,283,1643702400"; d="scan'208";a="263682652" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 19:04:57 -0700 X-IronPort-AV: E=Sophos;i="5.90,283,1643702400"; d="scan'208";a="578208051" Received: from yjsun1-mobl.ccr.corp.intel.com (HELO [10.255.31.217]) ([10.255.31.217]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 19:04:54 -0700 Message-ID: <03e94ba9-f558-954f-e84b-cd8a9e693aea@linux.intel.com> Date: Sat, 23 Apr 2022 10:04:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v11 1/9] iommu: Introduce a callback to struct iommu_resv_region Content-Language: en-US To: Shameer Kolothum , linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org Cc: robin.murphy@arm.com, jon@solid-run.com, linuxarm@huawei.com, steven.price@arm.com, hch@infradead.org, guohanjun@huawei.com, Sami.Mujawar@arm.com, will@kernel.org, wanghuiqiang@huawei.com References: <20220422162907.1276-1-shameerali.kolothum.thodi@huawei.com> <20220422162907.1276-2-shameerali.kolothum.thodi@huawei.com> From: Lu Baolu In-Reply-To: <20220422162907.1276-2-shameerali.kolothum.thodi@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_190500_274281_25BA1502 X-CRM114-Status: GOOD ( 15.27 ) 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/4/23 00:28, Shameer Kolothum via iommu wrote: > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index f2c45b85b9fc..ffcfa684e80c 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -2597,16 +2597,22 @@ void iommu_put_resv_regions(struct device *dev, struct list_head *list) > * @list: reserved region list for device > * > * IOMMU drivers can use this to implement their .put_resv_regions() callback > - * for simple reservations. Memory allocated for each reserved region will be > - * freed. If an IOMMU driver allocates additional resources per region, it is > - * going to have to implement a custom callback. > + * for simple reservations. If a per region callback is provided that will be > + * used to free all memory allocations associated with the reserved region or > + * else just free up the memory for the regions. If an IOMMU driver allocates > + * additional resources per region, it is going to have to implement a custom > + * callback. > */ > void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list) > { > struct iommu_resv_region *entry, *next; > > - list_for_each_entry_safe(entry, next, list, list) > - kfree(entry); > + list_for_each_entry_safe(entry, next, list, list) { > + if (entry->free) > + entry->free(dev, entry); > + else > + kfree(entry); > + } > } > EXPORT_SYMBOL(generic_iommu_put_resv_regions); The generic_iommu_put_resv_regions() itself is a callback. Why bothering adding another callback from the same iommu driver in it? Or, you are going to remove the put_resv_regions from the iommu ops? Best regards, baolu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel