Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-13 Thread Christoph Hellwig
On Tue, Apr 14, 2020 at 04:21:27PM +1000, Alexey Kardashevskiy wrote: > > Good points, I'll post revised version when you post your v3 of this. > > > > Any plans on posting v3 of this? Thanks, Just back from a long weekend. I'll take a stab at it soon. _

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-13 Thread Alexey Kardashevskiy
On 07/04/2020 20:12, Alexey Kardashevskiy wrote: > > > On 07/04/2020 03:17, Christoph Hellwig wrote: >> On Mon, Apr 06, 2020 at 11:25:09PM +1000, Alexey Kardashevskiy wrote: > Do you see any serious problem with this approach? Thanks! Do you have a link to the whole branch? The

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-07 Thread Alexey Kardashevskiy
On 07/04/2020 03:17, Christoph Hellwig wrote: > On Mon, Apr 06, 2020 at 11:25:09PM +1000, Alexey Kardashevskiy wrote: Do you see any serious problem with this approach? Thanks! >>> >>> Do you have a link to the whole branch? The github UI is unfortunately >>> unusable for that (or I'm miss

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-06 Thread Christoph Hellwig
On Mon, Apr 06, 2020 at 11:25:09PM +1000, Alexey Kardashevskiy wrote: > >> Do you see any serious problem with this approach? Thanks! > > > > Do you have a link to the whole branch? The github UI is unfortunately > > unusable for that (or I'm missing something). > > The UI shows the branch but s

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-06 Thread Alexey Kardashevskiy
On 06/04/2020 21:50, Christoph Hellwig wrote: > On Fri, Apr 03, 2020 at 07:38:11PM +1100, Alexey Kardashevskiy wrote: >> >> >> On 26/03/2020 12:26, Alexey Kardashevskiy wrote: >>> >>> >>> On 25/03/2020 19:37, Christoph Hellwig wrote: On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashe

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-06 Thread Christoph Hellwig
On Fri, Apr 03, 2020 at 07:38:11PM +1100, Alexey Kardashevskiy wrote: > > > On 26/03/2020 12:26, Alexey Kardashevskiy wrote: > > > > > > On 25/03/2020 19:37, Christoph Hellwig wrote: > >> On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashevskiy wrote: > > This is for persistent memory

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-03 Thread Alexey Kardashevskiy
On 26/03/2020 12:26, Alexey Kardashevskiy wrote: > > > On 25/03/2020 19:37, Christoph Hellwig wrote: >> On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashevskiy wrote: > This is for persistent memory which you can DMA to/from but yet it does > not appear in the system as a normal

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-25 Thread Alexey Kardashevskiy
On 25/03/2020 19:37, Christoph Hellwig wrote: > On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashevskiy wrote: This is for persistent memory which you can DMA to/from but yet it does not appear in the system as a normal memory and therefore requires special handling anyway

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-25 Thread Christoph Hellwig
On Wed, Mar 25, 2020 at 03:51:36PM +1100, Alexey Kardashevskiy wrote: > >> This is for persistent memory which you can DMA to/from but yet it does > >> not appear in the system as a normal memory and therefore requires > >> special handling anyway (O_DIRECT or DAX, I do not know the exact > >> mech

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-24 Thread Alexey Kardashevskiy
On 24/03/2020 18:54, Christoph Hellwig wrote: > On Tue, Mar 24, 2020 at 02:05:54PM +1100, Alexey Kardashevskiy wrote: >> This is for persistent memory which you can DMA to/from but yet it does >> not appear in the system as a normal memory and therefore requires >> special handling anyway (O_DIR

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-24 Thread Christoph Hellwig
On Tue, Mar 24, 2020 at 12:00:09PM +0530, Aneesh Kumar K.V wrote: > dma_addr_t dma_direct_map_page(struct device *dev, struct page *page, > unsigned long offset, size_t size, enum dma_data_direction dir, > unsigned long attrs) > { > phys_addr_t phys = page_to_phys(

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-24 Thread Christoph Hellwig
On Tue, Mar 24, 2020 at 02:05:54PM +1100, Alexey Kardashevskiy wrote: > This is for persistent memory which you can DMA to/from but yet it does > not appear in the system as a normal memory and therefore requires > special handling anyway (O_DIRECT or DAX, I do not know the exact > mechanics). All

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-24 Thread Christoph Hellwig
On Tue, Mar 24, 2020 at 02:37:59PM +1100, Alexey Kardashevskiy wrote: > dma_alloc_direct() and dma_map_direct() do the same thing now which is > good, did I miss anything else? dma_alloc_direct looks at coherent_dma_mask, dma_map_direct looks at dma_mask. __

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Aneesh Kumar K.V
Alexey Kardashevskiy writes: > On 24/03/2020 04:22, Christoph Hellwig wrote: >> On Mon, Mar 23, 2020 at 09:07:38PM +0530, Aneesh Kumar K.V wrote: >>> >>> This is what I was trying, but considering I am new to DMA subsystem, I >>> am not sure I got all the details correct. The idea is to look at t

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Alexey Kardashevskiy
On 24/03/2020 14:37, Alexey Kardashevskiy wrote: > > > On 24/03/2020 04:20, Christoph Hellwig wrote: >> On Mon, Mar 23, 2020 at 07:58:01PM +1100, Alexey Kardashevskiy wrote: > 0x100.. .. 0x101.. > > 2x4G, each is 1TB aligned. And we can map directly only the first 4

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Alexey Kardashevskiy
On 24/03/2020 04:20, Christoph Hellwig wrote: > On Mon, Mar 23, 2020 at 07:58:01PM +1100, Alexey Kardashevskiy wrote: 0x100.. .. 0x101.. 2x4G, each is 1TB aligned. And we can map directly only the first 4GB (because of the maximum IOMMU table size) but not the

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Alexey Kardashevskiy
On 24/03/2020 04:22, Christoph Hellwig wrote: > On Mon, Mar 23, 2020 at 09:07:38PM +0530, Aneesh Kumar K.V wrote: >> >> This is what I was trying, but considering I am new to DMA subsystem, I >> am not sure I got all the details correct. The idea is to look at the >> cpu addr and see if that can

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Christoph Hellwig
On Mon, Mar 23, 2020 at 09:07:38PM +0530, Aneesh Kumar K.V wrote: > > This is what I was trying, but considering I am new to DMA subsystem, I > am not sure I got all the details correct. The idea is to look at the > cpu addr and see if that can be used in direct map fashion(is > bus_dma_limit the

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Christoph Hellwig
On Mon, Mar 23, 2020 at 07:58:01PM +1100, Alexey Kardashevskiy wrote: > >> 0x100.. .. 0x101.. > >> > >> 2x4G, each is 1TB aligned. And we can map directly only the first 4GB > >> (because of the maximum IOMMU table size) but not the other. And 1:1 on > >> that "pseries" is done with

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Aneesh Kumar K.V
Christoph Hellwig writes: > On Mon, Mar 23, 2020 at 09:37:05AM +0100, Christoph Hellwig wrote: >> > > +/* >> > > + * Allows IOMMU drivers to bypass dynamic translations if the >> > > DMA mask >> > > + * is large enough. >> > > + */ >> > > +if (dev->dma_ops

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Christoph Hellwig
On Mon, Mar 23, 2020 at 12:14:08PM +, Robin Murphy wrote: > On 2020-03-20 2:16 pm, Christoph Hellwig wrote: >> Several IOMMU drivers have a bypass mode where they can use a direct >> mapping if the devices DMA mask is large enough. Add generic support >> to the core dma-mapping code to do that

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Robin Murphy
On 2020-03-20 2:16 pm, Christoph Hellwig wrote: Several IOMMU drivers have a bypass mode where they can use a direct mapping if the devices DMA mask is large enough. Add generic support to the core dma-mapping code to do that to switch those drivers to a common solution. Hmm, this is _almost_,

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Alexey Kardashevskiy
On 23/03/2020 19:37, Christoph Hellwig wrote: > On Mon, Mar 23, 2020 at 12:28:34PM +1100, Alexey Kardashevskiy wrote: > > [full quote deleted, please follow proper quoting rules] > >>> +static bool dma_alloc_direct(struct device *dev, const struct dma_map_ops >>> *ops) >>> +{ >>> + if (!ops

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Christoph Hellwig
On Mon, Mar 23, 2020 at 09:37:05AM +0100, Christoph Hellwig wrote: > > > + /* > > > + * Allows IOMMU drivers to bypass dynamic translations if the DMA mask > > > + * is large enough. > > > + */ > > > + if (dev->dma_ops_bypass) { > > > + if (min_not_zero(dev->coherent_dma_mask, dev->bus_d

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-23 Thread Christoph Hellwig
On Mon, Mar 23, 2020 at 12:28:34PM +1100, Alexey Kardashevskiy wrote: [full quote deleted, please follow proper quoting rules] > > +static bool dma_alloc_direct(struct device *dev, const struct dma_map_ops > > *ops) > > +{ > > + if (!ops) > > + return true; > > + > > + /* > > +

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-22 Thread Alexey Kardashevskiy
On 21/03/2020 01:16, Christoph Hellwig wrote: > Several IOMMU drivers have a bypass mode where they can use a direct > mapping if the devices DMA mask is large enough. Add generic support > to the core dma-mapping code to do that to switch those drivers to > a common solution. > > Signed-off-b

Re: [PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-20 Thread Greg Kroah-Hartman
On Fri, Mar 20, 2020 at 03:16:39PM +0100, Christoph Hellwig wrote: > Several IOMMU drivers have a bypass mode where they can use a direct > mapping if the devices DMA mask is large enough. Add generic support > to the core dma-mapping code to do that to switch those drivers to > a common solution.

[PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2020-03-20 Thread Christoph Hellwig
Several IOMMU drivers have a bypass mode where they can use a direct mapping if the devices DMA mask is large enough. Add generic support to the core dma-mapping code to do that to switch those drivers to a common solution. Signed-off-by: Christoph Hellwig --- include/linux/device.h | 6 +

[PATCH 1/2] dma-mapping: add a dma_ops_bypass flag to struct device

2019-11-13 Thread Christoph Hellwig
Several IOMMU drivers have a bypass mode where they can use a direct mapping if the devices DMA mask is large enough. Add generic support to the core dma-mapping code to do that to switch those drivers to a common solution. Signed-off-by: Christoph Hellwig --- include/linux/device.h | 4 +