[etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device

Sui Jingfeng posted 8 patches 1 year, 8 months ago
There is a newer version of this series
drivers/gpu/drm/etnaviv/Kconfig              |   8 +
drivers/gpu/drm/etnaviv/Makefile             |   2 +
drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 159 ++++++++++------
drivers/gpu/drm/etnaviv/etnaviv_drv.h        |  27 +++
drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  22 ++-
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |   2 +-
drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 144 +++++++++-----
drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |   4 +
drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |   4 +-
drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c    | 187 +++++++++++++++++++
drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h    |  18 ++
include/uapi/drm/etnaviv_drm.h               |   1 +
12 files changed, 468 insertions(+), 110 deletions(-)
create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c
create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h
[etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device
Posted by Sui Jingfeng 1 year, 8 months ago
drm/etnaviv use the component framework to bind multiple GPU cores to a
virtual master, the virtual master is manually create during driver load
time. This works well for various SoCs, yet there are some PCIe card has
the vivante GPU cores integrated. The driver lacks the support for PCIe
devices currently.

Adds PCIe driver wrapper on the top of what drm/etnaviv already has, the
component framework is still being used to bind subdevices, even though
there is only one GPU core. But the process is going to be reversed, we
create virtual platform device for each of the vivante GPU IP core shipped
by the PCIe master. The PCIe master is real, bind all the virtual child
to the master with component framework.


v6:
	* Fix build issue on system without CONFIG_PCI enabled
v7:
	* Add a separate patch for the platform driver rearrangement (Bjorn)
	* Switch to runtime check if the GPU is dma coherent or not (Lucas)
	* Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to query (Lucas)
	* Remove etnaviv_gpu.no_clk member (Lucas)
	* Fix Various typos and coding style fixed (Bjorn)
v8:
	* Fix typos and remove unnecessary header included (Bjorn).
	* Add a dedicated function to create the virtual master platform
	  device.
v9:
	* Use PCI_VDEVICE() macro (Bjorn)
	* Add trivial stubs for the PCI driver (Bjorn)
	* Remove a redundant dev_err() usage (Bjorn)
	* Clean up etnaviv_pdev_probe() with etnaviv_of_first_available_node()
v10:
	* Add one more cleanup patch
	* Resolve the conflict with a patch from Rob
	* Make the dummy PCI stub inlined
	* Print only if the platform is dma-coherrent
V11:
	* Drop unnecessary changes (Lucas)
	* Tweak according to other reviews of v10.

V12:
	* Create a virtual platform device for the subcomponent GPU cores
	* Bind all subordinate GPU cores to the real PCI master via component.

V13:
	* Drop the non-component code path, always use the component framework
	  to bind subcomponent GPU core. Even though there is only one core.
	* Defer the irq handler register.
	* Rebase and improve the commit message

V14:
	* Rebase onto etnaviv-next and improve commit message.

Tested with JD9230P GPU and LingJiu GP102 GPU.

Sui Jingfeng (8):
  drm/etnaviv: Add a dedicated helper function to get various clocks
  drm/etnaviv: Add constructor and destructor for the
    etnaviv_drm_private structure
  drm/etnaviv: Embed struct drm_device into struct etnaviv_drm_private
  drm/etnaviv: Fix wrong cache property being used for vmap()
  drm/etnaviv: Add support for cached coherent caching mode
  drm/etnaviv: Replace the '&pdev->dev' with 'dev'
  drm/etnaviv: Allow creating subdevices and pass platform specific data
  drm/etnaviv: Add support for vivante GPU cores attached via PCIe
    device

 drivers/gpu/drm/etnaviv/Kconfig              |   8 +
 drivers/gpu/drm/etnaviv/Makefile             |   2 +
 drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 159 ++++++++++------
 drivers/gpu/drm/etnaviv/etnaviv_drv.h        |  27 +++
 drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  22 ++-
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |   2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 144 +++++++++-----
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |   4 +
 drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |   4 +-
 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c    | 187 +++++++++++++++++++
 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h    |  18 ++
 include/uapi/drm/etnaviv_drm.h               |   1 +
 12 files changed, 468 insertions(+), 110 deletions(-)
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c
 create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h


base-commit: 52272bfff15ee70c7bd5be9368f175948fb8ecfd
-- 
2.34.1
Re: [etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device
Posted by Christian Gmeiner 1 year, 7 months ago
Hi

>
> drm/etnaviv use the component framework to bind multiple GPU cores to a
> virtual master, the virtual master is manually create during driver load
> time. This works well for various SoCs, yet there are some PCIe card has
> the vivante GPU cores integrated. The driver lacks the support for PCIe
> devices currently.
>
> Adds PCIe driver wrapper on the top of what drm/etnaviv already has, the
> component framework is still being used to bind subdevices, even though
> there is only one GPU core. But the process is going to be reversed, we
> create virtual platform device for each of the vivante GPU IP core shipped
> by the PCIe master. The PCIe master is real, bind all the virtual child
> to the master with component framework.
>
>
> v6:
>         * Fix build issue on system without CONFIG_PCI enabled
> v7:
>         * Add a separate patch for the platform driver rearrangement (Bjorn)
>         * Switch to runtime check if the GPU is dma coherent or not (Lucas)
>         * Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to query (Lucas)
>         * Remove etnaviv_gpu.no_clk member (Lucas)
>         * Fix Various typos and coding style fixed (Bjorn)
> v8:
>         * Fix typos and remove unnecessary header included (Bjorn).
>         * Add a dedicated function to create the virtual master platform
>           device.
> v9:
>         * Use PCI_VDEVICE() macro (Bjorn)
>         * Add trivial stubs for the PCI driver (Bjorn)
>         * Remove a redundant dev_err() usage (Bjorn)
>         * Clean up etnaviv_pdev_probe() with etnaviv_of_first_available_node()
> v10:
>         * Add one more cleanup patch
>         * Resolve the conflict with a patch from Rob
>         * Make the dummy PCI stub inlined
>         * Print only if the platform is dma-coherrent
> V11:
>         * Drop unnecessary changes (Lucas)
>         * Tweak according to other reviews of v10.
>
> V12:
>         * Create a virtual platform device for the subcomponent GPU cores
>         * Bind all subordinate GPU cores to the real PCI master via component.
>
> V13:
>         * Drop the non-component code path, always use the component framework
>           to bind subcomponent GPU core. Even though there is only one core.
>         * Defer the irq handler register.
>         * Rebase and improve the commit message
>
> V14:
>         * Rebase onto etnaviv-next and improve commit message.
>
> Tested with JD9230P GPU and LingJiu GP102 GPU.
>

I was able to test this series and will do a review in the next few
days. Hopefully this series will land anytime.

[    6.783267] etnaviv 0000:0c:00.0: enabling device (0000 -> 0003)
[    6.783324] etnaviv 0000:0c:00.0: JingJia Micro JM9100 has 1 GPU cores
[    6.783459] etnaviv 0000:0c:00.0: bound etnaviv-gpu,3d.0 (ops
gpu_ops [etnaviv])
[    6.783502] etnaviv-gpu etnaviv-gpu,3d.0: model: GC9200, revision: 6304
[    6.783635] [drm] Initialized etnaviv 1.4.0 20151214 for
0000:0c:00.0 on minor 1

Tested-by: Christian Gmeiner <cgmeiner@igalia.com>


> Sui Jingfeng (8):
>   drm/etnaviv: Add a dedicated helper function to get various clocks
>   drm/etnaviv: Add constructor and destructor for the
>     etnaviv_drm_private structure
>   drm/etnaviv: Embed struct drm_device into struct etnaviv_drm_private
>   drm/etnaviv: Fix wrong cache property being used for vmap()
>   drm/etnaviv: Add support for cached coherent caching mode
>   drm/etnaviv: Replace the '&pdev->dev' with 'dev'
>   drm/etnaviv: Allow creating subdevices and pass platform specific data
>   drm/etnaviv: Add support for vivante GPU cores attached via PCIe
>     device
>
>  drivers/gpu/drm/etnaviv/Kconfig              |   8 +
>  drivers/gpu/drm/etnaviv/Makefile             |   2 +
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 159 ++++++++++------
>  drivers/gpu/drm/etnaviv/etnaviv_drv.h        |  27 +++
>  drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  22 ++-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |   2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 144 +++++++++-----
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |   4 +
>  drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |   4 +-
>  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c    | 187 +++++++++++++++++++
>  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h    |  18 ++
>  include/uapi/drm/etnaviv_drm.h               |   1 +
>  12 files changed, 468 insertions(+), 110 deletions(-)
>  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c
>  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h
>
>
> base-commit: 52272bfff15ee70c7bd5be9368f175948fb8ecfd
> --
> 2.34.1
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
Re: [etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device
Posted by Icenowy Zheng 1 year, 7 months ago
在 2024-05-20星期一的 00:53 +0800,Sui Jingfeng写道:
> drm/etnaviv use the component framework to bind multiple GPU cores to
> a
> virtual master, the virtual master is manually create during driver
> load
> time. This works well for various SoCs, yet there are some PCIe card
> has
> the vivante GPU cores integrated. The driver lacks the support for
> PCIe
> devices currently.
> 
> Adds PCIe driver wrapper on the top of what drm/etnaviv already has,
> the
> component framework is still being used to bind subdevices, even
> though
> there is only one GPU core. But the process is going to be reversed,
> we
> create virtual platform device for each of the vivante GPU IP core
> shipped
> by the PCIe master. The PCIe master is real, bind all the virtual
> child
> to the master with component framework.
> 
> 
> v6:
>         * Fix build issue on system without CONFIG_PCI enabled
> v7:
>         * Add a separate patch for the platform driver rearrangement
> (Bjorn)
>         * Switch to runtime check if the GPU is dma coherent or not
> (Lucas)
>         * Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to query
> (Lucas)
>         * Remove etnaviv_gpu.no_clk member (Lucas)
>         * Fix Various typos and coding style fixed (Bjorn)
> v8:
>         * Fix typos and remove unnecessary header included (Bjorn).
>         * Add a dedicated function to create the virtual master
> platform
>           device.
> v9:
>         * Use PCI_VDEVICE() macro (Bjorn)
>         * Add trivial stubs for the PCI driver (Bjorn)
>         * Remove a redundant dev_err() usage (Bjorn)
>         * Clean up etnaviv_pdev_probe() with
> etnaviv_of_first_available_node()
> v10:
>         * Add one more cleanup patch
>         * Resolve the conflict with a patch from Rob
>         * Make the dummy PCI stub inlined
>         * Print only if the platform is dma-coherrent
> V11:
>         * Drop unnecessary changes (Lucas)
>         * Tweak according to other reviews of v10.
> 
> V12:
>         * Create a virtual platform device for the subcomponent GPU
> cores
>         * Bind all subordinate GPU cores to the real PCI master via
> component.
> 
> V13:
>         * Drop the non-component code path, always use the component
> framework
>           to bind subcomponent GPU core. Even though there is only
> one core.
>         * Defer the irq handler register.
>         * Rebase and improve the commit message
> 
> V14:
>         * Rebase onto etnaviv-next and improve commit message.
> 
> Tested with JD9230P GPU and LingJiu GP102 GPU.

BTW how should VRAM and displayed related parts be handled on these
dGPUs?

> 
> Sui Jingfeng (8):
>   drm/etnaviv: Add a dedicated helper function to get various clocks
>   drm/etnaviv: Add constructor and destructor for the
>     etnaviv_drm_private structure
>   drm/etnaviv: Embed struct drm_device into struct
> etnaviv_drm_private
>   drm/etnaviv: Fix wrong cache property being used for vmap()
>   drm/etnaviv: Add support for cached coherent caching mode
>   drm/etnaviv: Replace the '&pdev->dev' with 'dev'
>   drm/etnaviv: Allow creating subdevices and pass platform specific
> data
>   drm/etnaviv: Add support for vivante GPU cores attached via PCIe
>     device
> 
>  drivers/gpu/drm/etnaviv/Kconfig              |   8 +
>  drivers/gpu/drm/etnaviv/Makefile             |   2 +
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 159 ++++++++++------
>  drivers/gpu/drm/etnaviv/etnaviv_drv.h        |  27 +++
>  drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  22 ++-
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |   2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 144 +++++++++-----
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |   4 +
>  drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |   4 +-
>  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c    | 187
> +++++++++++++++++++
>  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h    |  18 ++
>  include/uapi/drm/etnaviv_drm.h               |   1 +
>  12 files changed, 468 insertions(+), 110 deletions(-)
>  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c
>  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h
> 
> 
> base-commit: 52272bfff15ee70c7bd5be9368f175948fb8ecfd
Re: [etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device
Posted by Lucas Stach 1 year, 7 months ago
Am Dienstag, dem 25.06.2024 um 11:18 +0800 schrieb Icenowy Zheng:
> 在 2024-05-20星期一的 00:53 +0800,Sui Jingfeng写道:
> > drm/etnaviv use the component framework to bind multiple GPU cores to
> > a
> > virtual master, the virtual master is manually create during driver
> > load
> > time. This works well for various SoCs, yet there are some PCIe card
> > has
> > the vivante GPU cores integrated. The driver lacks the support for
> > PCIe
> > devices currently.
> > 
> > Adds PCIe driver wrapper on the top of what drm/etnaviv already has,
> > the
> > component framework is still being used to bind subdevices, even
> > though
> > there is only one GPU core. But the process is going to be reversed,
> > we
> > create virtual platform device for each of the vivante GPU IP core
> > shipped
> > by the PCIe master. The PCIe master is real, bind all the virtual
> > child
> > to the master with component framework.
> > 
> > 
> > v6:
> >         * Fix build issue on system without CONFIG_PCI enabled
> > v7:
> >         * Add a separate patch for the platform driver rearrangement
> > (Bjorn)
> >         * Switch to runtime check if the GPU is dma coherent or not
> > (Lucas)
> >         * Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to query
> > (Lucas)
> >         * Remove etnaviv_gpu.no_clk member (Lucas)
> >         * Fix Various typos and coding style fixed (Bjorn)
> > v8:
> >         * Fix typos and remove unnecessary header included (Bjorn).
> >         * Add a dedicated function to create the virtual master
> > platform
> >           device.
> > v9:
> >         * Use PCI_VDEVICE() macro (Bjorn)
> >         * Add trivial stubs for the PCI driver (Bjorn)
> >         * Remove a redundant dev_err() usage (Bjorn)
> >         * Clean up etnaviv_pdev_probe() with
> > etnaviv_of_first_available_node()
> > v10:
> >         * Add one more cleanup patch
> >         * Resolve the conflict with a patch from Rob
> >         * Make the dummy PCI stub inlined
> >         * Print only if the platform is dma-coherrent
> > V11:
> >         * Drop unnecessary changes (Lucas)
> >         * Tweak according to other reviews of v10.
> > 
> > V12:
> >         * Create a virtual platform device for the subcomponent GPU
> > cores
> >         * Bind all subordinate GPU cores to the real PCI master via
> > component.
> > 
> > V13:
> >         * Drop the non-component code path, always use the component
> > framework
> >           to bind subcomponent GPU core. Even though there is only
> > one core.
> >         * Defer the irq handler register.
> >         * Rebase and improve the commit message
> > 
> > V14:
> >         * Rebase onto etnaviv-next and improve commit message.
> > 
> > Tested with JD9230P GPU and LingJiu GP102 GPU.
> 
> BTW how should VRAM and displayed related parts be handled on these
> dGPUs?
> 
The only way to handle VRAM properly would be to rewrite our GEM
internals using TTM.

Regards,
Lucas

> > 
> > Sui Jingfeng (8):
> >   drm/etnaviv: Add a dedicated helper function to get various clocks
> >   drm/etnaviv: Add constructor and destructor for the
> >     etnaviv_drm_private structure
> >   drm/etnaviv: Embed struct drm_device into struct
> > etnaviv_drm_private
> >   drm/etnaviv: Fix wrong cache property being used for vmap()
> >   drm/etnaviv: Add support for cached coherent caching mode
> >   drm/etnaviv: Replace the '&pdev->dev' with 'dev'
> >   drm/etnaviv: Allow creating subdevices and pass platform specific
> > data
> >   drm/etnaviv: Add support for vivante GPU cores attached via PCIe
> >     device
> > 
> >  drivers/gpu/drm/etnaviv/Kconfig              |   8 +
> >  drivers/gpu/drm/etnaviv/Makefile             |   2 +
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 159 ++++++++++------
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.h        |  27 +++
> >  drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  22 ++-
> >  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |   2 +-
> >  drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 144 +++++++++-----
> >  drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |   4 +
> >  drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |   4 +-
> >  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c    | 187
> > +++++++++++++++++++
> >  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h    |  18 ++
> >  include/uapi/drm/etnaviv_drm.h               |   1 +
> >  12 files changed, 468 insertions(+), 110 deletions(-)
> >  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c
> >  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h
> > 
> > 
> > base-commit: 52272bfff15ee70c7bd5be9368f175948fb8ecfd
> 
Re: [etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device
Posted by Icenowy Zheng 1 year, 7 months ago
在 2024-06-25星期二的 14:01 +0200,Lucas Stach写道:
> Am Dienstag, dem 25.06.2024 um 11:18 +0800 schrieb Icenowy Zheng:
> > 在 2024-05-20星期一的 00:53 +0800,Sui Jingfeng写道:
> > > drm/etnaviv use the component framework to bind multiple GPU
> > > cores to
> > > a
> > > virtual master, the virtual master is manually create during
> > > driver
> > > load
> > > time. This works well for various SoCs, yet there are some PCIe
> > > card
> > > has
> > > the vivante GPU cores integrated. The driver lacks the support
> > > for
> > > PCIe
> > > devices currently.
> > > 
> > > Adds PCIe driver wrapper on the top of what drm/etnaviv already
> > > has,
> > > the
> > > component framework is still being used to bind subdevices, even
> > > though
> > > there is only one GPU core. But the process is going to be
> > > reversed,
> > > we
> > > create virtual platform device for each of the vivante GPU IP
> > > core
> > > shipped
> > > by the PCIe master. The PCIe master is real, bind all the virtual
> > > child
> > > to the master with component framework.
> > > 
> > > 
> > > v6:
> > >         * Fix build issue on system without CONFIG_PCI enabled
> > > v7:
> > >         * Add a separate patch for the platform driver
> > > rearrangement
> > > (Bjorn)
> > >         * Switch to runtime check if the GPU is dma coherent or
> > > not
> > > (Lucas)
> > >         * Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to
> > > query
> > > (Lucas)
> > >         * Remove etnaviv_gpu.no_clk member (Lucas)
> > >         * Fix Various typos and coding style fixed (Bjorn)
> > > v8:
> > >         * Fix typos and remove unnecessary header included
> > > (Bjorn).
> > >         * Add a dedicated function to create the virtual master
> > > platform
> > >           device.
> > > v9:
> > >         * Use PCI_VDEVICE() macro (Bjorn)
> > >         * Add trivial stubs for the PCI driver (Bjorn)
> > >         * Remove a redundant dev_err() usage (Bjorn)
> > >         * Clean up etnaviv_pdev_probe() with
> > > etnaviv_of_first_available_node()
> > > v10:
> > >         * Add one more cleanup patch
> > >         * Resolve the conflict with a patch from Rob
> > >         * Make the dummy PCI stub inlined
> > >         * Print only if the platform is dma-coherrent
> > > V11:
> > >         * Drop unnecessary changes (Lucas)
> > >         * Tweak according to other reviews of v10.
> > > 
> > > V12:
> > >         * Create a virtual platform device for the subcomponent
> > > GPU
> > > cores
> > >         * Bind all subordinate GPU cores to the real PCI master
> > > via
> > > component.
> > > 
> > > V13:
> > >         * Drop the non-component code path, always use the
> > > component
> > > framework
> > >           to bind subcomponent GPU core. Even though there is
> > > only
> > > one core.
> > >         * Defer the irq handler register.
> > >         * Rebase and improve the commit message
> > > 
> > > V14:
> > >         * Rebase onto etnaviv-next and improve commit message.
> > > 
> > > Tested with JD9230P GPU and LingJiu GP102 GPU.
> > 
> > BTW how should VRAM and displayed related parts be handled on these
> > dGPUs?
> > 
> The only way to handle VRAM properly would be to rewrite our GEM
> internals using TTM.

I suggest for these kind of dGPU to create a brand new driver instead.

BTW, Jingfeng, what's the situation of the Loongson 7A1000 GPU? Do it
share the same address space with the CPU?

(The display of 7A is another virtual PCI device that is already
handled in loongson-drm driver and don't need to be worried)

> 
> Regards,
> Lucas
> 
> > > 
> > > Sui Jingfeng (8):
> > >   drm/etnaviv: Add a dedicated helper function to get various
> > > clocks
> > >   drm/etnaviv: Add constructor and destructor for the
> > >     etnaviv_drm_private structure
> > >   drm/etnaviv: Embed struct drm_device into struct
> > > etnaviv_drm_private
> > >   drm/etnaviv: Fix wrong cache property being used for vmap()
> > >   drm/etnaviv: Add support for cached coherent caching mode
> > >   drm/etnaviv: Replace the '&pdev->dev' with 'dev'
> > >   drm/etnaviv: Allow creating subdevices and pass platform
> > > specific
> > > data
> > >   drm/etnaviv: Add support for vivante GPU cores attached via
> > > PCIe
> > >     device
> > > 
> > >  drivers/gpu/drm/etnaviv/Kconfig              |   8 +
> > >  drivers/gpu/drm/etnaviv/Makefile             |   2 +
> > >  drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 159 ++++++++++---
> > > ---
> > >  drivers/gpu/drm/etnaviv/etnaviv_drv.h        |  27 +++
> > >  drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  22 ++-
> > >  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |   2 +-
> > >  drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 144 +++++++++----
> > > -
> > >  drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |   4 +
> > >  drivers/gpu/drm/etnaviv/etnaviv_mmu.c        |   4 +-
> > >  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c    | 187
> > > +++++++++++++++++++
> > >  drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h    |  18 ++
> > >  include/uapi/drm/etnaviv_drm.h               |   1 +
> > >  12 files changed, 468 insertions(+), 110 deletions(-)
> > >  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c
> > >  create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h
> > > 
> > > 
> > > base-commit: 52272bfff15ee70c7bd5be9368f175948fb8ecfd
> > 
> 
Re: [etnaviv-next v14 0/8] drm/etnaviv: Add driver wrapper for vivante GPUs attached on PCI(e) device
Posted by Sui Jingfeng 1 year, 7 months ago
Hi,

On 6/25/24 11:18, Icenowy Zheng wrote:
> 在 2024-05-20星期一的 00:53 +0800,Sui Jingfeng写道:
>> drm/etnaviv use the component framework to bind multiple GPU cores to
>> a
>> virtual master, the virtual master is manually create during driver
>> load
>> time. This works well for various SoCs, yet there are some PCIe card
>> has
>> the vivante GPU cores integrated. The driver lacks the support for
>> PCIe
>> devices currently.
>>
>> Adds PCIe driver wrapper on the top of what drm/etnaviv already has,
>> the
>> component framework is still being used to bind subdevices, even
>> though
>> there is only one GPU core. But the process is going to be reversed,
>> we
>> create virtual platform device for each of the vivante GPU IP core
>> shipped
>> by the PCIe master. The PCIe master is real, bind all the virtual
>> child
>> to the master with component framework.
>>
>>
>> v6:
>>          * Fix build issue on system without CONFIG_PCI enabled
>> v7:
>>          * Add a separate patch for the platform driver rearrangement
>> (Bjorn)
>>          * Switch to runtime check if the GPU is dma coherent or not
>> (Lucas)
>>          * Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to query
>> (Lucas)
>>          * Remove etnaviv_gpu.no_clk member (Lucas)
>>          * Fix Various typos and coding style fixed (Bjorn)
>> v8:
>>          * Fix typos and remove unnecessary header included (Bjorn).
>>          * Add a dedicated function to create the virtual master
>> platform
>>            device.
>> v9:
>>          * Use PCI_VDEVICE() macro (Bjorn)
>>          * Add trivial stubs for the PCI driver (Bjorn)
>>          * Remove a redundant dev_err() usage (Bjorn)
>>          * Clean up etnaviv_pdev_probe() with
>> etnaviv_of_first_available_node()
>> v10:
>>          * Add one more cleanup patch
>>          * Resolve the conflict with a patch from Rob
>>          * Make the dummy PCI stub inlined
>>          * Print only if the platform is dma-coherrent
>> V11:
>>          * Drop unnecessary changes (Lucas)
>>          * Tweak according to other reviews of v10.
>>
>> V12:
>>          * Create a virtual platform device for the subcomponent GPU
>> cores
>>          * Bind all subordinate GPU cores to the real PCI master via
>> component.
>>
>> V13:
>>          * Drop the non-component code path, always use the component
>> framework
>>            to bind subcomponent GPU core. Even though there is only
>> one core.
>>          * Defer the irq handler register.
>>          * Rebase and improve the commit message
>>
>> V14:
>>          * Rebase onto etnaviv-next and improve commit message.
>>
>> Tested with JD9230P GPU and LingJiu GP102 GPU.
> 
> BTW how should VRAM and displayed related parts be handled on these
> dGPUs?

Emm, I can only say I have no ideas.

Thanks for Christian's tested-by, but I'm a bit worry about if etnaviv
folks really like(or need) this. In the past, we started to contribute
before we know the policy/framework very well. I have to managed to
make things work before knowing the full picture. We developing drivers
in a rather rapid way and rather wild. Sometime, we do it just for fun. 
As the card don't has a usable driver, we want do something and we do
have already learned the framework and knowledge.

But now as we know a bit more, I actually don't intend to brings
concerns to other people. So only first 6 patch (or only part of them)
are requested to be merged, patch 0007 or patch 0008 can just leave it
there to be reviewed a bit longer if something is unsure.

Its totally up to etnaviv folks, I don't mind. Thanks for the nice
project.

-- 
Best regards
Sui