From: Bjorn Helgaas <helgaas@kernel.org>
To: Sui Jingfeng <suijingfeng@loongson.cn>
Cc: Sui Jingfeng <15330273260@189.cn>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
etnaviv@lists.freedesktop.org,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH v7 7/7] drm/etnaviv: add support for the dma coherent device
Date: Tue, 6 Jun 2023 14:01:02 -0500 [thread overview]
Message-ID: <20230606190102.GA1134540@bhelgaas> (raw)
In-Reply-To: <234586a0-995c-b4c4-3b7b-35afeea1a797@loongson.cn>
On Wed, Jun 07, 2023 at 02:43:27AM +0800, Sui Jingfeng wrote:
> On 2023/6/7 00:56, Bjorn Helgaas wrote:
> > On Sat, Jun 03, 2023 at 06:59:43PM +0800, Sui Jingfeng wrote:
> > > From: Sui Jingfeng <suijingfeng@loongson.cn>
> > >
> > > Loongson CPUs maintain cache coherency by hardware, which means that the
> > > data in the CPU cache is identical to the data in main system memory. As
> > > for the peripheral device, most of Loongson chips chose to define the
> > > peripherals as DMA coherent by default, device drivers do not need to
> > > maintain the coherency between a processor and an I/O device manually.
> > ...
> > I guess the only way to discover this coherency attribute is via the
> > DT "vivante,gc" property? Seems a little weird but I'm really not a
> > DT person.
>
> I'm not sure it is *only*, but it is very convenient to achieve such a thing
> with DT.
I don't know if this is a property of the PCI device, or a property of
the system as a whole. I asked because PCI devices should be
self-describing (the Device/Vendor ID should be enough to identify the
correct driver, and the driver should know how to learn anything else
it needs to know about the device from PCI config space) and should
not require extra DT properties.
But if this is a CPU or system property, you probably have to use a
firmware interface like DT or ACPI.
> > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > > @@ -8,6 +8,7 @@
> > > #include <linux/delay.h>
> > > #include <linux/dma-fence.h>
> > > #include <linux/dma-mapping.h>
> > > +#include <linux/dma-map-ops.h>
> >
> > It looks like this #include might not be needed?
>
> No, the dev_is_dma_coherent() function is declared and defined in
> dma-map-ops.h. if remove it, gcc will complain:
>
> drivers/gpu/drm/etnaviv/etnaviv_drv.c: In function
> ‘etnaviv_is_dma_coherent’:
> drivers/gpu/drm/etnaviv/etnaviv_drv.c:56:14: error: implicit declaration of
> function ‘dev_is_dma_coherent’; did you mean ‘etnaviv_is_dma_coherent’?
> [-Werror=implicit-function-declaration]
> 56 | coherent = dev_is_dma_coherent(dev);
> | ^~~~~~~~~~~~~~~~~~~
Of course, but that warning is for etnaviv_drv.c, not for
etnaviv_gpu.c. So etnaviv_drv.c needs to include dma-map-ops.h, but I
don't think etnaviv_gpu.c does. I removed this #include from
etnaviv_gpu.c and it still built without errors.
> > You're only adding a
> > new reference to priv->dma_coherent, which looks like it was added to
> > etnaviv_drv.h.
next prev parent reply other threads:[~2023-06-06 19:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 10:59 [PATCH v7 0/7] drm/etnaviv: add pci device driver support Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 1/7] drm/etnaviv: add a dedicated function to register an irq handler Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 2/7] drm/etnaviv: add a dedicated function to get various clocks Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 3/7] drm/etnaviv: add dedicated functions to create and destroy platform devices Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 4/7] drm/etnaviv: add helpers for private data construction and destruction Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 5/7] drm/etnaviv: allow bypass component framework Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 6/7] drm/etnaviv: add driver support for the PCI devices Sui Jingfeng
2023-06-03 10:59 ` [PATCH v7 7/7] drm/etnaviv: add support for the dma coherent device Sui Jingfeng
2023-06-06 16:56 ` Bjorn Helgaas
2023-06-06 18:43 ` Sui Jingfeng
2023-06-06 19:01 ` Bjorn Helgaas [this message]
2023-06-03 11:20 ` [PATCH v7 0/7] drm/etnaviv: add pci device driver support Sui Jingfeng
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=20230606190102.GA1134540@bhelgaas \
--to=helgaas@kernel.org \
--cc=15330273260@189.cn \
--cc=bhelgaas@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suijingfeng@loongson.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox