linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>,
	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
Subject: Re: [PATCH v11 1/9] iommu: Introduce a callback to struct iommu_resv_region
Date: Sat, 23 Apr 2022 10:04:39 +0800	[thread overview]
Message-ID: <03e94ba9-f558-954f-e84b-cd8a9e693aea@linux.intel.com> (raw)
In-Reply-To: <20220422162907.1276-2-shameerali.kolothum.thodi@huawei.com>

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

  reply	other threads:[~2022-04-23  2:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 16:28 [PATCH v11 0/9] ACPI/IORT: Support for IORT RMR node Shameer Kolothum
2022-04-22 16:28 ` [PATCH v11 1/9] iommu: Introduce a callback to struct iommu_resv_region Shameer Kolothum
2022-04-23  2:04   ` Lu Baolu [this message]
2022-04-23  5:14     ` Christoph Hellwig
2022-04-23  6:39       ` Lu Baolu
2022-04-23  5:14   ` Christoph Hellwig
2022-04-22 16:29 ` [PATCH v11 2/9] ACPI/IORT: Make iort_iommu_msi_get_resv_regions() return void Shameer Kolothum
2022-04-22 16:29 ` [PATCH v11 3/9] ACPI/IORT: Provide a generic helper to retrieve reserve regions Shameer Kolothum
2022-04-22 16:29 ` [PATCH v11 4/9] ACPI/IORT: Add support to retrieve IORT RMR reserved regions Shameer Kolothum
2022-04-23  9:50   ` kernel test robot
2022-04-26 11:43     ` Shameerali Kolothum Thodi
2022-04-23 12:14   ` kernel test robot
2022-04-26 15:29   ` Lorenzo Pieralisi
2022-04-28 13:44     ` Shameerali Kolothum Thodi
2022-04-22 16:29 ` [PATCH v11 5/9] ACPI/IORT: Add a helper to retrieve RMR info directly Shameer Kolothum
2022-04-22 16:29 ` [PATCH v11 6/9] iommu/arm-smmu-v3: Introduce strtab init helper Shameer Kolothum
2022-04-22 16:29 ` [PATCH v11 7/9] iommu/arm-smmu-v3: Refactor arm_smmu_init_bypass_stes() to force bypass Shameer Kolothum
2022-04-22 16:29 ` [PATCH v11 8/9] iommu/arm-smmu-v3: Get associated RMR info and install bypass STE Shameer Kolothum
2022-04-22 16:29 ` [PATCH v11 9/9] iommu/arm-smmu: Get associated RMR info and install bypass SMR Shameer Kolothum
2022-04-28 14:43 ` [PATCH v11 0/9] ACPI/IORT: Support for IORT RMR node Steven Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03e94ba9-f558-954f-e84b-cd8a9e693aea@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=Sami.Mujawar@arm.com \
    --cc=guohanjun@huawei.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jon@solid-run.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=steven.price@arm.com \
    --cc=wanghuiqiang@huawei.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).