Re: [PATCH v2 2/5] iommu: Implement of_iommu_get_resv_regions()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



23.04.2021 19:32, Thierry Reding пишет:
> +void of_iommu_get_resv_regions(struct device *dev, struct list_head *list)
> +{
> +	struct of_phandle_iterator it;
> +	int err;
> +
> +	of_for_each_phandle(&it, err, dev->of_node, "memory-region", "#memory-region-cells", 0) {
> +		struct iommu_resv_region *region;
> +		struct of_phandle_args args;
> +		struct resource res;
> +
> +		args.args_count = of_phandle_iterator_args(&it, args.args, MAX_PHANDLE_ARGS);
> +
> +		err = of_address_to_resource(it.node, 0, &res);
> +		if (err < 0) {
> +			dev_err(dev, "failed to parse memory region %pOF: %d\n",
> +				it.node, err);
> +			continue;
> +		}
> +
> +		if (args.args_count > 0) {
> +			/*
> +			 * Active memory regions are expected to be accessed by hardware during
> +			 * boot and must therefore have an identity mapping created prior to the
> +			 * driver taking control of the hardware. This ensures that non-quiescent
> +			 * hardware doesn't cause IOMMU faults during boot.
> +			 */
> +			if (args.args[0] & MEMORY_REGION_IDENTITY_MAPPING) {
> +				region = iommu_alloc_resv_region(res.start, resource_size(&res),
> +								 IOMMU_READ | IOMMU_WRITE,
> +								 IOMMU_RESV_DIRECT_RELAXABLE);
> +				if (!region)
> +					continue;
> +
> +				list_add_tail(&region->list, list);
> +			}
> +		}
> +	}
> +}
> +EXPORT_SYMBOL(of_iommu_get_resv_regions);

Any reason why this is not EXPORT_SYMBOL_GPL? I'm curious what is the
logic behind the OF symbols in general since it looks like half of them
are GPL.



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux