[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210106185241.GA109735@localhost.localdomain>
Date: Wed, 6 Jan 2021 13:52:41 -0500
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: Claire Chang <tientzu@...omium.org>
Cc: robh+dt@...nel.org, mpe@...erman.id.au, benh@...nel.crashing.org,
paulus@...ba.org, joro@...tes.org, will@...nel.org,
frowand.list@...il.com, boris.ostrovsky@...cle.com,
jgross@...e.com, sstabellini@...nel.org, hch@....de,
m.szyprowski@...sung.com, robin.murphy@....com,
grant.likely@....com, xypron.glpk@....de, treding@...dia.com,
mingo@...nel.org, bauerman@...ux.ibm.com, peterz@...radead.org,
gregkh@...uxfoundation.org, saravanak@...gle.com,
rafael.j.wysocki@...el.com, heikki.krogerus@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, rdunlap@...radead.org,
dan.j.williams@...el.com, bgolaszewski@...libre.com,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, iommu@...ts.linux-foundation.org,
xen-devel@...ts.xenproject.org, tfiga@...omium.org,
drinkcat@...omium.org
Subject: Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool
Hello!
In this file:
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index e4368159f88a..7fb2ac087d23 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
..
> +static const struct reserved_mem_ops rmem_swiotlb_ops = {
> + .device_init = rmem_swiotlb_device_init,
> + .device_release = rmem_swiotlb_device_release,
> +};
> +
> +static int __init rmem_swiotlb_setup(struct reserved_mem *rmem)
> +{
> + unsigned long node = rmem->fdt_node;
> +
> + if (of_get_flat_dt_prop(node, "reusable", NULL) ||
> + of_get_flat_dt_prop(node, "linux,cma-default", NULL) ||
> + of_get_flat_dt_prop(node, "linux,dma-default", NULL) ||
> + of_get_flat_dt_prop(node, "no-map", NULL))
> + return -EINVAL;
> +
> + rmem->ops = &rmem_swiotlb_ops;
> + pr_info("Reserved memory: created device swiotlb memory pool at %pa, size %ld MiB\n",
> + &rmem->base, (unsigned long)rmem->size / SZ_1M);
> + return 0;
> +}
> +
> +RESERVEDMEM_OF_DECLARE(dma, "restricted-dma-pool", rmem_swiotlb_setup);
The code should be as much as possible arch-agnostic. That is why there
are multiple -swiotlb files scattered in arch directories that own the
architecture specific code.
Would it be possible to move the code there and perhaps have a ARM
specific front-end for this DMA restricted pool there? See for example
the xen-swiotlb code.
Cheers!
Konrad
Powered by blists - more mailing lists