All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Yongqin Liu <yongqin.liu@linaro.org>,
	Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com,
	arnd@kernel.org, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, "Bajjuri,
	Praneeth" <praneeth@ti.com>,
	Sumit Semwal <sumit.semwal@linaro.org>
Subject: Re: [PATCH 0/3] More ARM DMA ops cleanup
Date: Tue, 30 Aug 2022 16:44:44 +0100	[thread overview]
Message-ID: <Yw4wbMeQqpMbTwBw@shell.armlinux.org.uk> (raw)
In-Reply-To: <5c617d66-f04b-df26-bf7a-7f479d081ac2@arm.com>

On Tue, Aug 30, 2022 at 04:36:19PM +0100, Robin Murphy wrote:
> On 2022-08-30 16:19, Yongqin Liu wrote:
> > Hi, Robin
> > 
> > Thanks for the kind reply!
> > 
> > On Tue, 30 Aug 2022 at 17:48, Robin Murphy <robin.murphy@arm.com> wrote:
> > > 
> > > On 2022-08-27 13:24, Yongqin Liu wrote:
> > > > Hi, Robin, Christoph
> > > > 
> > > > With the changes landed in the mainline kernel,
> > > > one problem is exposed with our out of tree pvr module.
> > > > Like the source here[1], arm_dma_ops.sync_single_for_cpu is called in
> > > > the format like the following:
> > > >       arm_dma_ops.sync_single_for_cpu(NULL, pStart, pEnd - pStart,
> > > > DMA_FROM_DEVICE);
> > > > 
> > > > Not sure if you could give some suggestions on what I should do next
> > > > to make the pvr module work again.
> > > 
> > > Wow, that driver reinvents so many standard APIs for no apparent reason
> > > it's not even funny.
> > > 
> > > Anyway, from a brief look it seemingly already knows how to call the DMA
> > > API semi-correctly, so WTF that's doing behind an #ifdef, who knows?
> > > However it's still so completely wrong in general - fundamentally broken
> > > AArch64 set/way cache maintenance!? - that it looks largely beyond help.
> > > "Throw CONFIG_DMA_API_DEBUG at it and cry" is about the extent of
> > > support I'm prepared to provide for that mess.
> > 
> > For the moment, I do not care about the AArch64 lines, like if we only
> > say the following two lines:
> >      arm_dma_ops.sync_single_for_device(NULL, pStart, pEnd - pStart,
> > DMA_TO_DEVICE);
> >      arm_dma_ops.sync_single_for_cpu(NULL, pStart, pEnd - pStart,
> > DMA_FROM_DEVICE);
> > 
> > Could you please give some suggestions for that?
> 
> Remove them. Then remove the #ifdef __arch64__ too, since the code under
> there is doing a passable impression of generic DMA API usage, as long as
> one ignores the bigger picture.
> 
> arm64 already uses dma-direct. To say you don't care about the arm64 code
> when asking how to deal with ARM having now been converted to use dma-direct
> as well is supremely missing the point.

It should also be pointed out that this culture of bodging around the
DMA API by graphics drivers is entirely their own problem. If they used
the proper interfaces that the kernel provides (like the DMA API) rather
than thinking "I need to flush the caches in such-and-such a way here"
so I need to find a function somewhere in the kernel's interfaces that
I can get to in order to achieve that, and I don't care how that's done
then maybe their code wouldn't keep breaking.

This is really not our problem to solve.

This is not limited to just PVR. I've seen it with other stuff as well,
and it's the reason I was not in favour of exposing the dmac_*
functions that we have in arch/arm/mm - which are part of the DMA API
implementation, being moved into a header file. One can see from PVR
that they also made use of these before I intentionally hid them from
driver modules.

Basically, out of tree graphics drivers will bodge around to get access
to the specific cache manangement that they want to use - even if it
means abusing stuff that may mean that their crappy drivers break when
we make later changes.

As I say, it's entirely _their_ problem to solve if they don't want to
use our official interfaces. Or, they can decide to use our official
interfaces, which would be nice.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Yongqin Liu <yongqin.liu@linaro.org>,
	Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com,
	arnd@kernel.org, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, "Bajjuri,
	Praneeth" <praneeth@ti.com>,
	Sumit Semwal <sumit.semwal@linaro.org>
Subject: Re: [PATCH 0/3] More ARM DMA ops cleanup
Date: Tue, 30 Aug 2022 16:44:44 +0100	[thread overview]
Message-ID: <Yw4wbMeQqpMbTwBw@shell.armlinux.org.uk> (raw)
In-Reply-To: <5c617d66-f04b-df26-bf7a-7f479d081ac2@arm.com>

On Tue, Aug 30, 2022 at 04:36:19PM +0100, Robin Murphy wrote:
> On 2022-08-30 16:19, Yongqin Liu wrote:
> > Hi, Robin
> > 
> > Thanks for the kind reply!
> > 
> > On Tue, 30 Aug 2022 at 17:48, Robin Murphy <robin.murphy@arm.com> wrote:
> > > 
> > > On 2022-08-27 13:24, Yongqin Liu wrote:
> > > > Hi, Robin, Christoph
> > > > 
> > > > With the changes landed in the mainline kernel,
> > > > one problem is exposed with our out of tree pvr module.
> > > > Like the source here[1], arm_dma_ops.sync_single_for_cpu is called in
> > > > the format like the following:
> > > >       arm_dma_ops.sync_single_for_cpu(NULL, pStart, pEnd - pStart,
> > > > DMA_FROM_DEVICE);
> > > > 
> > > > Not sure if you could give some suggestions on what I should do next
> > > > to make the pvr module work again.
> > > 
> > > Wow, that driver reinvents so many standard APIs for no apparent reason
> > > it's not even funny.
> > > 
> > > Anyway, from a brief look it seemingly already knows how to call the DMA
> > > API semi-correctly, so WTF that's doing behind an #ifdef, who knows?
> > > However it's still so completely wrong in general - fundamentally broken
> > > AArch64 set/way cache maintenance!? - that it looks largely beyond help.
> > > "Throw CONFIG_DMA_API_DEBUG at it and cry" is about the extent of
> > > support I'm prepared to provide for that mess.
> > 
> > For the moment, I do not care about the AArch64 lines, like if we only
> > say the following two lines:
> >      arm_dma_ops.sync_single_for_device(NULL, pStart, pEnd - pStart,
> > DMA_TO_DEVICE);
> >      arm_dma_ops.sync_single_for_cpu(NULL, pStart, pEnd - pStart,
> > DMA_FROM_DEVICE);
> > 
> > Could you please give some suggestions for that?
> 
> Remove them. Then remove the #ifdef __arch64__ too, since the code under
> there is doing a passable impression of generic DMA API usage, as long as
> one ignores the bigger picture.
> 
> arm64 already uses dma-direct. To say you don't care about the arm64 code
> when asking how to deal with ARM having now been converted to use dma-direct
> as well is supremely missing the point.

It should also be pointed out that this culture of bodging around the
DMA API by graphics drivers is entirely their own problem. If they used
the proper interfaces that the kernel provides (like the DMA API) rather
than thinking "I need to flush the caches in such-and-such a way here"
so I need to find a function somewhere in the kernel's interfaces that
I can get to in order to achieve that, and I don't care how that's done
then maybe their code wouldn't keep breaking.

This is really not our problem to solve.

This is not limited to just PVR. I've seen it with other stuff as well,
and it's the reason I was not in favour of exposing the dmac_*
functions that we have in arch/arm/mm - which are part of the DMA API
implementation, being moved into a header file. One can see from PVR
that they also made use of these before I intentionally hid them from
driver modules.

Basically, out of tree graphics drivers will bodge around to get access
to the specific cache manangement that they want to use - even if it
means abusing stuff that may mean that their crappy drivers break when
we make later changes.

As I say, it's entirely _their_ problem to solve if they don't want to
use our official interfaces. Or, they can decide to use our official
interfaces, which would be nice.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-08-30 15:45 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 11:36 [PATCH 0/3] More ARM DMA ops cleanup Robin Murphy
2022-04-21 11:36 ` Robin Murphy
2022-04-21 11:36 ` Robin Murphy
2022-04-21 11:36 ` [PATCH 1/3] ARM/dma-mapping: Drop .dma_supported for IOMMU ops Robin Murphy
2022-04-21 11:36   ` Robin Murphy
2022-04-21 11:36   ` Robin Murphy
2022-04-21 11:36 ` [PATCH 2/3] ARM/dma-mapping: Consolidate IOMMU ops callbacks Robin Murphy
2022-04-21 11:36   ` Robin Murphy
2022-04-21 11:36   ` Robin Murphy
2022-04-21 11:36 ` [PATCH 3/3] ARM/dma-mapping: Merge IOMMU ops Robin Murphy
2022-04-21 11:36   ` Robin Murphy
2022-04-21 11:36   ` Robin Murphy
2022-04-21 14:13 ` [PATCH 0/3] More ARM DMA ops cleanup Christoph Hellwig
2022-04-21 14:13   ` Christoph Hellwig
2022-04-21 14:13   ` Christoph Hellwig
2022-04-21 14:35   ` Robin Murphy
2022-04-21 14:35     ` Robin Murphy
2022-04-21 14:35     ` Robin Murphy
2022-08-27 12:24     ` Yongqin Liu
2022-08-27 12:24       ` Yongqin Liu
2022-08-30  9:48       ` Robin Murphy
2022-08-30  9:48         ` Robin Murphy
2022-08-30 15:19         ` Yongqin Liu
2022-08-30 15:19           ` Yongqin Liu
2022-08-30 15:36           ` Robin Murphy
2022-08-30 15:36             ` Robin Murphy
2022-08-30 15:44             ` Russell King (Oracle) [this message]
2022-08-30 15:44               ` Russell King (Oracle)
2022-08-31 16:41             ` Yongqin Liu
2022-08-31 16:41               ` Yongqin Liu
2022-08-31 17:09               ` Robin Murphy
2022-08-31 17:09                 ` Robin Murphy
2022-09-01  2:04                 ` Yongqin Liu
2022-09-01  2:04                   ` Yongqin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yw4wbMeQqpMbTwBw@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=arnd@kernel.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=praneeth@ti.com \
    --cc=robin.murphy@arm.com \
    --cc=sumit.semwal@linaro.org \
    --cc=yongqin.liu@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.