Re: [PATCH v3 1/2] iommu: Add iommu_get_pci_resv_windows() helper
From: Jason Gunthorpe
Date: Thu Oct 22 2026 - 15:38:12 EST
On Mon, Oct 05, 2026 at 12:22:12AM +0800, Guanghui Feng wrote:
> +int iommu_get_pci_resv_windows(struct pci_dev *dev, struct list_head *head)
> +{
> + struct pci_host_bridge *bridge = pci_find_host_bridge(dev->bus);
> + struct iommu_resv_region *region, *next;
> + struct resource_entry *window;
> + LIST_HEAD(resv_windows);
> + int ret;
> +
> + if (!bridge)
> + return -ENODEV;
> +
> + resource_list_for_each_entry(window, &bridge->windows) {
> + struct iommu_resv_region tmp = {
> + .type = IOMMU_RESV_RESERVED,
> + };
I didn't try to look, but if you are going to add a function to the
iommu core then dma-iommu.c should also use it so we are sharing the
same algorithm.
Maybe a callback function would work better to that end than returning
a linked list?
Jason