mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Sui Jingfeng <suijingfeng@loongson.cn>,
	Bjorn Helgaas <helgaas@kernel.org>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>,
	Christian Gmeiner <christian.gmeiner@gmail.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	loongson-kernel@lists.loongnix.cn, Li Yi <liyi@loongson.cn>
Subject: Re: [PATCH v6 5/6] drm/etnaviv: add driver support for the PCI devices
Date: Wed, 31 May 2023 18:23:12 +0200	[thread overview]
Message-ID: <5e0b34054ca6fa540e481d93f3c1d9fbdd2defcd.camel@pengutronix.de> (raw)
In-Reply-To: <950fdaaa-b62c-7f36-a499-9eca71c8bc47@loongson.cn>

Hi Sui Jingfeng,

Am Donnerstag, dem 01.06.2023 um 00:08 +0800 schrieb Sui Jingfeng:
> Hi,
> 
> On 2023/5/31 03:02, Bjorn Helgaas wrote:
> > On Wed, May 31, 2023 at 12:06:42AM +0800, Sui Jingfeng wrote:
> > > This patch adds PCI driver support on top of what already have. Take the
> > > GC1000 in LS7A1000/LS2K1000 as the first instance of the PCI device driver.
> > > There is only one GPU core for the GC1000 in the LS7A1000 and LS2K1000.
> > > Therefore, component frameworks can be avoided. Because we want to bind the
> > > DRM driver service to the PCI driver manually.
> > > +	 * Loongson Mips and LoongArch CPU(ls3a5000, ls3a4000, ls2k1000la)
> > > +	 * maintain cache coherency by hardware
> > > +	 */
> > > +	if (IS_ENABLED(CONFIG_CPU_LOONGSON64) || IS_ENABLED(CONFIG_LOONGARCH))
> > > +		priv->has_cached_coherent = true;
> > This looks like something that should be a runtime check, not a
> > compile-time check.
> > 
> > If it's possible to build a single kernel image that runs on Loongson
> > MIPS or LoongArch CPU and, in addition, runs on other platforms, you
> > cannot assume that all the others maintain this cache coherency.
> 
> Nice catch! I don't even realize this!
> 
> 
> LS3A4000 is mips64r2 with MSA SIMD, while LS3A5000 is LoongArch,
> 
> instruction set, compiler, and binary interface are totally changed.
> 
> Therefore, it's impossible to build a single kernel image that runs on 
> all Loongson CPUs.
> 
> Currently, I can guarantee that this works on the Loongson platform.
> 
> My initial intent here is to let priv->has_cached_coherent be *true* on 
> the Loongson platform (both mips and loongarch).
> 
> I do know there are some other vendors who bought GPU IP from Vivante.
> 
> say GC7000, and integrate it into their discrete GPU product.
> 
> But it is also a PCI device, but this is another story; it deserves 
> another patch.
> 
> I don't know if Etnaviv folk find some similar hardware on Arm Arch,
> 
> Some Arm CPUs do not maintain cached coherency on hardware.
> 
> The has_cached_coherent member can be set to false on such hardware.
> 
> For us, it seems that there is no need to do runtime checking,
> 
> because they are all cached coherent by default.
> 
> 
> Can I improve this in the future, currently I don't have a good idea.

I think I mentioned before that this needs to be a runtime check. What
does dev_is_dma_coherent() return for the Vivante GPU device on your
platform?

Regards,
Lucas

  reply	other threads:[~2023-05-31 16:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 16:06 [PATCH v6 0/6] drm/etnaviv: add pci device driver support Sui Jingfeng
2023-05-30 16:06 ` [PATCH v6 1/6] drm/etnaviv: add a dedicated function to register an irq handler Sui Jingfeng
2023-05-30 16:06 ` [PATCH v6 2/6] drm/etnaviv: add a dedicated function to get various clocks Sui Jingfeng
2023-05-31 18:07   ` Lucas Stach
2023-06-01 10:09     ` Sui Jingfeng
2023-06-01 13:21     ` Sui Jingfeng
2023-05-30 16:06 ` [PATCH v6 3/6] drm/etnaviv: add dedicated functions to create and destroy platform devices Sui Jingfeng
2023-05-30 16:06 ` [PATCH v6 4/6] drm/etnaviv: add helpers for private data construction and destruction Sui Jingfeng
2023-05-30 16:06 ` [PATCH v6 5/6] drm/etnaviv: add driver support for the PCI devices Sui Jingfeng
2023-05-30 19:02   ` Bjorn Helgaas
2023-05-31 16:08     ` Sui Jingfeng
2023-05-31 16:23       ` Lucas Stach [this message]
2023-05-31 16:32         ` Sui Jingfeng
2023-05-31 17:12         ` Sui Jingfeng
2023-05-30 16:06 ` [PATCH v6 6/6] drm/etnaviv: allow usperspace create cached coherent bo Sui Jingfeng
2023-05-30 18:58   ` Bjorn Helgaas
2023-05-31 14:22     ` Sui Jingfeng
2023-05-31 16:33   ` Lucas Stach
     [not found]     ` <5c2faf7e-002c-dad0-c4fe-63aab04f7e87@loongson.cn>
     [not found]       ` <e0b35447ef41b2dfc92ebba6f841f996b43ef42d.camel@pengutronix.de>
2023-06-01 10:13         ` Sui Jingfeng
  -- strict thread matches above, loose matches on Subject: below --
2023-05-30 16:01 [PATCH v6 0/6] drm/etnaviv: add pci device driver support Sui Jingfeng
2023-05-30 16:01 ` [PATCH v6 5/6] drm/etnaviv: add driver support for the PCI devices 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=5e0b34054ca6fa540e481d93f3c1d9fbdd2defcd.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=airlied@gmail.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=helgaas@kernel.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liyi@loongson.cn \
    --cc=loongson-kernel@lists.loongnix.cn \
    --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

all inboxes | Powered by JetHome®