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

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

 



On Sat, Jul 17, 2021 at 02:07:12PM +0300, Dmitry Osipenko wrote:
> 16.07.2021 17:41, Rob Herring пишет:
> > On Fri, Jul 2, 2021 at 8:05 AM Dmitry Osipenko <digetx@xxxxxxxxx> wrote:
> >>
> >> 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.
> > 
> > Generally, new ones are _GPL. Old ones probably predate _GPL.
> > 
> > This one is up to the IOMMU maintainers.
> 
> Thank you.

I prefer EXPORT_SYMBOL_GPL(). That's aligned with the symbols exported by
iommu.c, with the *single* exception of generic_iommu_put_resv_regions(),
which I think should be changed to _GPL() as well.

Will



[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