drm/nouveau: support for GK20A, cont'd
Subsystems (4)
v4 cover drm/nouveau: support for GK20A, cont'd
Latest patches for GK20A, taking comments received for v3 into account.
Changes since v3:
- use only pfn_to_page() and page_to_pfn() in GK20A's FB. These functions are present on every arch and the physical address to page frame number conversion is also consistently a shift of PAGE_SHIFT. This part will probably be replaced by something nicer in the future anyway.
- fixed a warning on 64-bit architectures when printing a dma_addr_t
- tested compilation on x86_64 and ensured there was no error! ;)
- in graph, always use external firmware if no microcode is linked for the graph class (instead of only relying on the NvGrUseFW parameter).
Alexandre Courbot (9):
drm/nouveau/bar: only ioremap BAR3 if it exists drm/nouveau/bar/nvc0: support chips without BAR3 drm/nouveau/ibus: add GK20A support drm/nouveau/fb: add GK20A support drm/nouveau/fifo: add GK20A support drm/nouveau/graph: enable when using external fw drm/nouveau/graph: pad firmware code at load time drm/nouveau/graph: add GK20A support drm/nouveau: support for probing GK20A
drivers/gpu/drm/nouveau/Makefile | 6 + drivers/gpu/drm/nouveau/core/engine/device/nve0.c | 17 +++ drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c | 35 +++++ drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h | 1 + .../gpu/drm/nouveau/core/engine/graph/ctxgk20a.c | 53 +++++++ .../gpu/drm/nouveau/core/engine/graph/ctxnvc0.h | 9 ++ .../gpu/drm/nouveau/core/engine/graph/ctxnve4.c | 14 +- drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c | 47 ++++++ drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 14 +- drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | 2 + drivers/gpu/drm/nouveau/core/engine/graph/nve4.c | 4 +- drivers/gpu/drm/nouveau/core/include/engine/fifo.h | 1 + .../gpu/drm/nouveau/core/include/engine/graph.h | 1 + drivers/gpu/drm/nouveau/core/include/subdev/fb.h | 1 + drivers/gpu/drm/nouveau/core/include/subdev/ibus.h | 1 + drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 6 +- drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | 114 +++++++------- drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c | 56 +++++++ drivers/gpu/drm/nouveau/core/subdev/fb/priv.h | 1 + drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 167 +++++++++++++++++++++ drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c | 103 +++++++++++++ 21 files changed, 584 insertions(+), 69 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c
Signature · 1 line
1.9.2
PATCH v4 1/9 drm/nouveau/bar: only ioremap BAR3 if it exists
Some chips that use system memory exclusively (e.g. GK20A) do not expose 2 BAR regions. For them only BAR1 exists, and it should be used for USERD mapping. Do not map BAR3 if its resource does not exist.
--- drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/bar/base.c +4 -2
@@ -118,8 +118,10 @@ nouveau_bar_create_(struct nouveau_object *parent,if (ret)return ret; - bar->iomem =ioremap (nv_device_resource_start (device,3 ), -nv_device_resource_len (device,3 )); +if (nv_device_resource_len (device,3 ) !=0 ) + bar->iomem =ioremap (nv_device_resource_start (device,3 ), +nv_device_resource_len (device,3 )); +return 0 ; }
Signature · 1 line
1.9.2
PATCH v4 2/9 drm/nouveau/bar/nvc0: support chips without BAR3
In reply to Alexandre CourbotAdapt the NVC0 BAR driver to make it able to support chips that do not expose a BAR3. When this happens, BAR1 is then used for USERD mapping and the BAR alloc() functions is disabled, making GPU objects unable to rely on BAR for data access and falling back to PRAMIN.
--- drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | 114 +++++++++++++------------ 1 file changed, 59 insertions(+), 55 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c +59 -55
@@ -30,14 +30,16 @@#include "priv.h" +struct nvc0_bar_priv_vm { +struct nouveau_gpuobj *mem; +struct nouveau_gpuobj *pgd; +struct nouveau_vm *vm; +}; +struct nvc0_bar_priv {struct nouveau_bar base;spinlock_t lock; -struct { -struct nouveau_gpuobj *mem; -struct nouveau_gpuobj *pgd; -struct nouveau_vm *vm; - } bar[2 ]; +struct nvc0_bar_priv_vm bar[2 ]; }; static int
@@ -79,87 +81,87 @@ nvc0_bar_unmap(struct nouveau_bar *bar, struct nouveau_vma *vma) }static int -nvc0_bar_ctor (struct nouveau_object *parent,struct nouveau_object *engine, -struct nouveau_oclass *oclass,void *data,u32 size, -struct nouveau_object **pobject) +nvc0_bar_init_vm (struct nvc0_bar_priv *priv,struct nvc0_bar_priv_vm *bar_vm, +int bar_nr) { -struct nouveau_device *device =nv_device (parent); -struct nvc0_bar_priv *priv; -struct nouveau_gpuobj *mem; +struct nouveau_device *device =nv_device (&priv->base);struct nouveau_vm *vm; +resource_size_t bar_len;int ret; - ret =nouveau_bar_create (parent, engine, oclass, &priv); - *pobject =nv_object (priv); -if (ret) -return ret; - -/* BAR3 */ ret =nouveau_gpuobj_new (nv_object (priv),NULL ,0x1000 ,0 ,0 , - &priv->bar[0 ].mem); - mem = priv->bar[0 ].mem; + &bar_vm->mem);if (ret)return ret; ret =nouveau_gpuobj_new (nv_object (priv),NULL ,0x8000 ,0 ,0 , - &priv->bar[0 ].pgd); + &bar_vm->pgd);if (ret)return ret; - ret =nouveau_vm_new (device,0 ,nv_device_resource_len (device,3 ),0 , &vm); + bar_len =nv_device_resource_len (device, bar_nr); + + ret =nouveau_vm_new (device,0 , bar_len,0 , &vm);if (ret)return ret;atomic_inc (&vm->engref[NVDEV_SUBDEV_BAR ]); - ret =nouveau_gpuobj_new (nv_object (priv),NULL , - (nv_device_resource_len (device,3 ) >>12 ) *8 , -0x1000 ,NVOBJ_FLAG_ZERO_ALLOC , - &vm->pgt[0 ].obj[0 ]); - vm->pgt[0 ].refcount[0 ] =1 ; -if (ret) -return ret; +/* +* Bootstrap page table lookup. +*/ +if (bar_nr ==3 ) { + ret =nouveau_gpuobj_new (nv_object (priv),NULL , + (bar_len >>12 ) *8 ,0x1000 , +NVOBJ_FLAG_ZERO_ALLOC , + &vm->pgt[0 ].obj[0 ]); + vm->pgt[0 ].refcount[0 ] =1 ; +if (ret) +return ret; + } - ret =nouveau_vm_ref (vm, &priv->bar[0 ].vm, priv->bar[0 ].pgd); + ret =nouveau_vm_ref (vm, &bar_vm->vm, bar_vm->pgd);nouveau_vm_ref (NULL , &vm,NULL );if (ret)return ret; -nv_wo32 (mem,0x0200 ,lower_32_bits (priv->bar[0 ].pgd->addr)); -nv_wo32 (mem,0x0204 ,upper_32_bits (priv->bar[0 ].pgd->addr)); -nv_wo32 (mem,0x0208 ,lower_32_bits (nv_device_resource_len (device,3 ) -1 )); -nv_wo32 (mem,0x020c ,upper_32_bits (nv_device_resource_len (device,3 ) -1 )); +nv_wo32 (bar_vm->mem,0x0200 ,lower_32_bits (bar_vm->pgd->addr)); +nv_wo32 (bar_vm->mem,0x0204 ,upper_32_bits (bar_vm->pgd->addr)); +nv_wo32 (bar_vm->mem,0x0208 ,lower_32_bits (bar_len -1 )); +nv_wo32 (bar_vm->mem,0x020c ,upper_32_bits (bar_len -1 )); -/* BAR1 */ - ret =nouveau_gpuobj_new (nv_object (priv),NULL ,0x1000 ,0 ,0 , - &priv->bar[1 ].mem); - mem = priv->bar[1 ].mem; -if (ret) -return ret; +return 0 ; +} - ret =nouveau_gpuobj_new (nv_object (priv),NULL ,0x8000 ,0 ,0 , - &priv->bar[1 ].pgd); -if (ret) -return ret; +static int +nvc0_bar_ctor (struct nouveau_object *parent,struct nouveau_object *engine, +struct nouveau_oclass *oclass,void *data,u32 size, +struct nouveau_object **pobject) +{ +struct nouveau_device *device =nv_device (parent); +struct nvc0_bar_priv *priv; +bool has_bar3 =nv_device_resource_len (device,3 ) !=0 ; +int ret; - ret =nouveau_vm_new (device,0 ,nv_device_resource_len (device,1 ),0 , &vm); + ret =nouveau_bar_create (parent, engine, oclass, &priv); + *pobject =nv_object (priv);if (ret)return ret; -atomic_inc (&vm->engref[NVDEV_SUBDEV_BAR ]); +/* BAR3 */ +if (has_bar3) { + ret =nvc0_bar_init_vm (priv, &priv->bar[0 ],3 ); +if (ret) +return ret; + priv->base.alloc = nouveau_bar_alloc; + priv->base.kmap = nvc0_bar_kmap; + } - ret =nouveau_vm_ref (vm, &priv->bar[1 ].vm, priv->bar[1 ].pgd); -nouveau_vm_ref (NULL , &vm,NULL ); +/* BAR1 */ + ret =nvc0_bar_init_vm (priv, &priv->bar[1 ],1 );if (ret)return ret; -nv_wo32 (mem,0x0200 ,lower_32_bits (priv->bar[1 ].pgd->addr)); -nv_wo32 (mem,0x0204 ,upper_32_bits (priv->bar[1 ].pgd->addr)); -nv_wo32 (mem,0x0208 ,lower_32_bits (nv_device_resource_len (device,1 ) -1 )); -nv_wo32 (mem,0x020c ,upper_32_bits (nv_device_resource_len (device,1 ) -1 )); - - priv->base.alloc = nouveau_bar_alloc; - priv->base.kmap = nvc0_bar_kmap; priv->base.umap = nvc0_bar_umap; priv->base.unmap = nvc0_bar_unmap; priv->base.flush = nv84_bar_flush;
@@ -201,7 +203,9 @@ nvc0_bar_init(struct nouveau_object *object)nv_mask (priv,0x100c80 ,0x00000001 ,0x00000000 );nv_wr32 (priv,0x001704 ,0x80000000 | priv->bar[1 ].mem->addr >>12 ); -nv_wr32 (priv,0x001714 ,0xc0000000 | priv->bar[0 ].mem->addr >>12 ); +if (priv->bar[0 ].mem) +nv_wr32 (priv,0x001714 , +0xc0000000 | priv->bar[0 ].mem->addr >>12 );return 0 ; }
Signature · 1 line
1.9.2
PATCH v4 3/9 drm/nouveau/ibus: add GK20A support
In reply to Alexandre CourbotAdd support for initializing the priv ring of GK20A. This is done by the BIOS on desktop GPUs, but needs to be done by hand on Tegra.
--- drivers/gpu/drm/nouveau/Makefile | 1 + drivers/gpu/drm/nouveau/core/include/subdev/ibus.h | 1 + drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c | 103 +++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c
drivers/gpu/drm/nouveau/Makefile +1 -0
@@ -136,6 +136,7 @@ nouveau-y += core/subdev/i2c/nv94.o nouveau-y += core/subdev/i2c/nvd0.o nouveau-y += core/subdev/ibus/nvc0.o nouveau-y += core/subdev/ibus/nve0.o +nouveau-y += core/subdev/ibus/gk20a.o nouveau-y += core/subdev/instmem/base.o nouveau-y += core/subdev/instmem/nv04.o nouveau-y += core/subdev/instmem/nv40.o
drivers/gpu/drm/nouveau/core/include/subdev/ibus.h +1 -0
@@ -30,5 +30,6 @@ nouveau_ibus(void *obj)extern struct nouveau_oclass nvc0_ibus_oclass;extern struct nouveau_oclass nve0_ibus_oclass; +extern struct nouveau_oclass gk20a_ibus_oclass;#endif
drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.9.2
PATCH v4 4/9 drm/nouveau/fb: add GK20A support
In reply to Alexandre CourbotAdd a simple FB device for GK20A, as well as a RAM implementation based on contiguous DMA memory allocations suitable for chips that use system memory as video RAM.
--- drivers/gpu/drm/nouveau/Makefile | 2 + drivers/gpu/drm/nouveau/core/include/subdev/fb.h | 1 + drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c | 56 ++++++++ drivers/gpu/drm/nouveau/core/subdev/fb/priv.h | 1 + drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 167 ++++++++++++++++++++++ 5 files changed, 227 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
drivers/gpu/drm/nouveau/Makefile +2 -0
@@ -102,6 +102,7 @@ nouveau-y += core/subdev/fb/nvaa.o nouveau-y += core/subdev/fb/nvaf.o nouveau-y += core/subdev/fb/nvc0.o nouveau-y += core/subdev/fb/nve0.o +nouveau-y += core/subdev/fb/gk20a.o nouveau-y += core/subdev/fb/gm107.o nouveau-y += core/subdev/fb/ramnv04.o nouveau-y += core/subdev/fb/ramnv10.o
@@ -117,6 +118,7 @@ nouveau-y += core/subdev/fb/ramnva3.o nouveau-y += core/subdev/fb/ramnvaa.o nouveau-y += core/subdev/fb/ramnvc0.o nouveau-y += core/subdev/fb/ramnve0.o +nouveau-y += core/subdev/fb/ramgk20a.o nouveau-y += core/subdev/fb/ramgm107.o nouveau-y += core/subdev/fb/sddr3.o nouveau-y += core/subdev/fb/gddr5.o
drivers/gpu/drm/nouveau/core/include/subdev/fb.h +1 -0
@@ -105,6 +105,7 @@ extern struct nouveau_oclass *nvaa_fb_oclass;extern struct nouveau_oclass *nvaf_fb_oclass;extern struct nouveau_oclass *nvc0_fb_oclass;extern struct nouveau_oclass *nve0_fb_oclass; +extern struct nouveau_oclass *gk20a_fb_oclass;extern struct nouveau_oclass *gm107_fb_oclass;#include <subdev/bios/ramcfg.h>
drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c new file +56 -0
56 lines not on this page · raw message
drivers/gpu/drm/nouveau/core/subdev/fb/priv.h +1 -0
@@ -32,6 +32,7 @@ extern struct nouveau_oclass nva3_ram_oclass;extern struct nouveau_oclass nvaa_ram_oclass;extern struct nouveau_oclass nvc0_ram_oclass;extern struct nouveau_oclass nve0_ram_oclass; +extern struct nouveau_oclass gk20a_ram_oclass;extern struct nouveau_oclass gm107_ram_oclass;int nouveau_sddr3_calc (struct nouveau_ram *ram);
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
1.9.2
PATCH v4 5/9 drm/nouveau/fifo: add GK20A support
In reply to Alexandre CourbotGK20A's FIFO is compatible with NVE0, but only features 128 channels and 1 runlist.
--- drivers/gpu/drm/nouveau/Makefile | 1 + drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c | 35 ++++++++++++++++++++++ drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h | 1 + drivers/gpu/drm/nouveau/core/include/engine/fifo.h | 1 + 4 files changed, 38 insertions(+) create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c
drivers/gpu/drm/nouveau/Makefile +1 -0
@@ -248,6 +248,7 @@ nouveau-y += core/engine/fifo/nv50.o nouveau-y += core/engine/fifo/nv84.o nouveau-y += core/engine/fifo/nvc0.o nouveau-y += core/engine/fifo/nve0.o +nouveau-y += core/engine/fifo/gk20a.o nouveau-y += core/engine/fifo/nv108.o nouveau-y += core/engine/graph/ctxnv40.o nouveau-y += core/engine/graph/ctxnv50.o
drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "nve0.h" + +struct nouveau_oclass * +gk20a_fifo_oclass = &(struct nve0_fifo_impl ) { + .base.handle =NV_ENGINE (FIFO ,0xea ), + .base.ofuncs = &(struct nouveau_ofuncs ) { + .ctor = nve0_fifo_ctor, + .dtor = nve0_fifo_dtor, + .init = nve0_fifo_init, + .fini = nve0_fifo_fini, + }, + .channels =128 , +}.base;
drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h +1 -0
@@ -8,6 +8,7 @@ int nve0_fifo_ctor(struct nouveau_object *, struct nouveau_object *, struct nouveau_object **); void nve0_fifo_dtor(struct nouveau_object *);int nve0_fifo_init (struct nouveau_object *); +int nve0_fifo_fini (struct nouveau_object *,bool );struct nve0_fifo_impl {struct nouveau_oclass base;
drivers/gpu/drm/nouveau/core/include/engine/fifo.h +1 -0
@@ -109,6 +109,7 @@ extern struct nouveau_oclass *nv50_fifo_oclass;extern struct nouveau_oclass *nv84_fifo_oclass;extern struct nouveau_oclass *nvc0_fifo_oclass;extern struct nouveau_oclass *nve0_fifo_oclass; +extern struct nouveau_oclass *gk20a_fifo_oclass;extern struct nouveau_oclass *nv108_fifo_oclass;void nv04_fifo_intr (struct nouveau_subdev *);
Signature · 1 line
1.9.2
PATCH v4 6/9 drm/nouveau/graph: enable when using external fw
In reply to Alexandre Courbotnvc0_graph_ctor() would only let the graphics engine be enabled if its oclass has a proper microcode linked to it. This prevents GR from being enabled at all on chips that rely exclusively on external firmware, even though such a use-case is valid.
Relax the conditions enabling the GR engine to also include the case where an external firmware has also been loaded.
Also switch to external firmware if the graph class has no microcode linked to it.
--- drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +7 -3
@@ -1259,10 +1259,14 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,struct nvc0_graph_oclass *oclass = (void *)bclass;struct nouveau_device *device =nv_device (parent);struct nvc0_graph_priv *priv; +bool use_ext_fw, enable;int ret, i; - ret =nouveau_graph_create (parent, engine, bclass, - (oclass->fecs.ucode !=NULL ), &priv); + use_ext_fw =nouveau_boolopt (device->cfgopt,"NvGrUseFW" , + oclass->fecs.ucode ==NULL ); + enable = use_ext_fw || oclass->fecs.ucode !=NULL ; + + ret =nouveau_graph_create (parent, engine, bclass, enable, &priv); *pobject =nv_object (priv);if (ret)return ret;
@@ -1272,7 +1276,7 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine, priv->base.units = nvc0_graph_units; -if (nouveau_boolopt (device->cfgopt,"NvGrUseFW" , false)) { +if (use_ext_fw) {nv_info (priv,"using external firmware\n" ); if (nvc0_graph_ctor_fw(priv, "fuc409c", &priv->fuc409c) || nvc0_graph_ctor_fw(priv, "fuc409d", &priv->fuc409d) ||
Signature · 1 line
1.9.2
PATCH v4 7/9 drm/nouveau/graph: pad firmware code at load time
In reply to Alexandre CourbotPad the microcode to a multiple of 0x40 words, otherwise firmware will fail to run from non-prepadded firmware files.
--- drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +4 -0
@@ -894,6 +894,10 @@ nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base,nv_wr32 (priv, fuc_base +0x0188 , i >>6 );nv_wr32 (priv, fuc_base +0x0184 , code->data[i]); } + +/* code must be padded to 0x40 words */ +for (; i &0x3f ; i++) +nv_wr32 (priv, fuc_base +0x0184 ,0 ); } static void
Signature · 1 line
1.9.2
PATCH v4 8/9 drm/nouveau/graph: add GK20A support
In reply to Alexandre CourbotAdd a GR device for GK20A based on NVE4, with the correct classes definitions (GK20A's 3D class is 0xa297).
Most of the NVE4 code can be used on GK20A, so make relevant bits of NVE4 available to other chips as well.
--- drivers/gpu/drm/nouveau/Makefile | 2 + .../gpu/drm/nouveau/core/engine/graph/ctxgk20a.c | 53 ++++++++++++++++++++++ .../gpu/drm/nouveau/core/engine/graph/ctxnvc0.h | 9 ++++ .../gpu/drm/nouveau/core/engine/graph/ctxnve4.c | 14 +++--- drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c | 47 +++++++++++++++++++ drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | 2 + drivers/gpu/drm/nouveau/core/engine/graph/nve4.c | 4 +- .../gpu/drm/nouveau/core/include/engine/graph.h | 1 + 8 files changed, 123 insertions(+), 9 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c
drivers/gpu/drm/nouveau/Makefile +2 -0
@@ -259,6 +259,7 @@ nouveau-y += core/engine/graph/ctxnvc8.o nouveau-y += core/engine/graph/ctxnvd7.o nouveau-y += core/engine/graph/ctxnvd9.o nouveau-y += core/engine/graph/ctxnve4.o +nouveau-y += core/engine/graph/ctxgk20a.o nouveau-y += core/engine/graph/ctxnvf0.o nouveau-y += core/engine/graph/ctxnv108.o nouveau-y += core/engine/graph/ctxgm107.o
@@ -279,6 +280,7 @@ nouveau-y += core/engine/graph/nvc8.o nouveau-y += core/engine/graph/nvd7.o nouveau-y += core/engine/graph/nvd9.o nouveau-y += core/engine/graph/nve4.o +nouveau-y += core/engine/graph/gk20a.o nouveau-y += core/engine/graph/nvf0.o nouveau-y += core/engine/graph/nv108.o nouveau-y += core/engine/graph/gm107.o
drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c new file +53 -0
53 lines not on this page · raw message
drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h +9 -0
@@ -69,7 +69,9 @@ extern struct nouveau_oclass *nvd7_grctx_oclass;extern struct nouveau_oclass *nvd9_grctx_oclass;extern struct nouveau_oclass *nve4_grctx_oclass; +extern struct nouveau_oclass *gk20a_grctx_oclass;void nve4_grctx_generate_main (struct nvc0_graph_priv *,struct nvc0_grctx *); +void nve4_grctx_generate_mods (struct nvc0_graph_priv *,struct nvc0_grctx *);void nve4_grctx_generate_unkn (struct nvc0_graph_priv *);void nve4_grctx_generate_r418bb8 (struct nvc0_graph_priv *);
@@ -151,6 +153,13 @@ extern const struct nvc0_graph_init nve4_grctx_init_gpm_0[];extern const struct nvc0_graph_init nve4_grctx_init_pes_0[]; +extern const struct nvc0_graph_pack nve4_grctx_pack_hub[]; +extern const struct nvc0_graph_pack nve4_grctx_pack_gpc[]; +extern const struct nvc0_graph_pack nve4_grctx_pack_tpc[]; +extern const struct nvc0_graph_pack nve4_grctx_pack_ppc[]; +extern const struct nvc0_graph_pack nve4_grctx_pack_icmd[]; +extern const struct nvc0_graph_init nve4_grctx_init_a097_0[]; +extern const struct nvc0_graph_pack nvf0_grctx_pack_mthd[];extern const struct nvc0_graph_init nvf0_grctx_init_pri_0[];
drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c +7 -7
@@ -272,13 +272,13 @@ nve4_grctx_init_icmd_0[] = { {} }; -static const struct nvc0_graph_pack +const struct nvc0_graph_pack nve4_grctx_pack_icmd[] = { { nve4_grctx_init_icmd_0 }, {} }; -static const struct nvc0_graph_init +const struct nvc0_graph_init nve4_grctx_init_a097_0[] = { {0x000800 ,8 ,0x40 ,0x00000000 }, {0x000804 ,8 ,0x40 ,0x00000000 },
@@ -697,7 +697,7 @@ nve4_grctx_init_be_0[] = { {} }; -static const struct nvc0_graph_pack +const struct nvc0_graph_pack nve4_grctx_pack_hub[] = { { nvc0_grctx_init_main_0 }, { nve4_grctx_init_fe_0 },
@@ -737,7 +737,7 @@ nve4_grctx_init_gpm_0[] = { {} }; -static const struct nvc0_graph_pack +const struct nvc0_graph_pack nve4_grctx_pack_gpc[] = { { nvc0_grctx_init_gpc_unk_0 }, { nvd9_grctx_init_prop_0 },
@@ -802,7 +802,7 @@ nve4_grctx_init_sm_0[] = { {} }; -static const struct nvc0_graph_pack +const struct nvc0_graph_pack nve4_grctx_pack_tpc[] = { { nvd7_grctx_init_pe_0 }, { nve4_grctx_init_tex_0 },
@@ -826,7 +826,7 @@ nve4_grctx_init_cbm_0[] = { {} }; -static const struct nvc0_graph_pack +const struct nvc0_graph_pack nve4_grctx_pack_ppc[] = { { nve4_grctx_init_pes_0 }, { nve4_grctx_init_cbm_0 },
@@ -838,7 +838,7 @@ nve4_grctx_pack_ppc[] = {* PGRAPH context implementation ******************************************************************************/ -static void +void nve4_grctx_generate_mods (struct nvc0_graph_priv *priv,struct nvc0_grctx *info) {u32 magic[GPC_MAX ][2 ];
drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c new file +47 -0
47 lines not on this page · raw message
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h +2 -0
@@ -116,6 +116,7 @@ int nvc0_graph_ctor(struct nouveau_object *, struct nouveau_object *, struct nouveau_object **); void nvc0_graph_dtor(struct nouveau_object *);int nvc0_graph_init (struct nouveau_object *); +int nve4_graph_fini (struct nouveau_object *,bool );int nve4_graph_init (struct nouveau_object *);extern struct nouveau_oclass nvc0_graph_sclass[];
@@ -217,6 +218,7 @@ extern const struct nvc0_graph_init nve4_graph_init_main_0[];extern const struct nvc0_graph_init nve4_graph_init_tpccs_0[];extern const struct nvc0_graph_init nve4_graph_init_pe_0[];extern const struct nvc0_graph_init nve4_graph_init_be_0[]; +extern const struct nvc0_graph_pack nve4_graph_pack_mmio[];extern const struct nvc0_graph_init nvf0_graph_init_fe_0[];extern const struct nvc0_graph_init nvf0_graph_init_sked_0[];
drivers/gpu/drm/nouveau/core/engine/graph/nve4.c +2 -2
@@ -151,7 +151,7 @@ nve4_graph_init_be_0[] = { {} }; -static const struct nvc0_graph_pack +const struct nvc0_graph_pack nve4_graph_pack_mmio[] = { { nve4_graph_init_main_0 }, { nvc0_graph_init_fe_0 },
@@ -189,7 +189,7 @@ nve4_graph_pack_mmio[] = {* PGRAPH engine/subdev functions ******************************************************************************/ -static int +int nve4_graph_fini (struct nouveau_object *object,bool suspend) {struct nvc0_graph_priv *priv = (void *)object;
drivers/gpu/drm/nouveau/core/include/engine/graph.h +1 -0
@@ -68,6 +68,7 @@ extern struct nouveau_oclass *nvc8_graph_oclass;extern struct nouveau_oclass *nvd7_graph_oclass;extern struct nouveau_oclass *nvd9_graph_oclass;extern struct nouveau_oclass *nve4_graph_oclass; +extern struct nouveau_oclass *gk20a_graph_oclass;extern struct nouveau_oclass *nvf0_graph_oclass;extern struct nouveau_oclass *nv108_graph_oclass;extern struct nouveau_oclass *gm107_graph_oclass;
Signature · 1 line
1.9.2
PATCH v4 9/9 drm/nouveau: support for probing GK20A
In reply to Alexandre CourbotSet the correct subdev/engine classes when GK20A (0xea) is probed.
--- drivers/gpu/drm/nouveau/core/engine/device/nve0.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/nouveau/core/engine/device/nve0.c +17 -0
@@ -156,6 +156,23 @@ nve0_identify(struct nouveau_device *device) device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; device->oclass[NVDEV_ENGINE_PERFMON ] = &nve0_perfmon_oclass;break ; +case 0xea : + device->cname ="GK20A" ; + device->oclass[NVDEV_SUBDEV_MC ] = nvc3_mc_oclass; + device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; + device->oclass[NVDEV_SUBDEV_TIMER ] = &gk20a_timer_oclass; + device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass; + device->oclass[NVDEV_SUBDEV_IBUS ] = &gk20a_ibus_oclass; + device->oclass[NVDEV_SUBDEV_INSTMEM ] = nv50_instmem_oclass; + device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; + device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass; + device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; + device->oclass[NVDEV_ENGINE_FIFO ] = gk20a_fifo_oclass; + device->oclass[NVDEV_ENGINE_SW ] = nvc0_software_oclass; + device->oclass[NVDEV_ENGINE_GR ] = gk20a_graph_oclass; + device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass; + device->oclass[NVDEV_ENGINE_PERFMON ] = &nve0_perfmon_oclass; +break ;case 0xf0 : device->cname ="GK110" ; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
Signature · 1 line
1.9.2
Quoted 11 lines · Alexandre Courbot
Latest patches for GK20A, taking comments received for v3 into account.
Changes since v3:
- use onlypfn_to_page()andpage_to_pfn()in GK20A's FB. These functions are present on every arch and the physical address to page frame number conversion is also consistently a shift ofPAGE_SHIFT. This part will probably be replaced by something nicer in the future anyway.
- fixed a warning on 64-bit architectures when printing adma_addr_t
- tested compilation onx86_64and ensured there was no error! ;)
- in graph, always use external firmware if no microcode is linked for the graph class (instead of only relying on the NvGrUseFW parameter).
Hey Alex,
I've merged all the patches and they'll make it into the merge window for 3.16.
Thanks again,
Ben.
Quoted 48 lines
Alexandre Courbot (9):
drm/nouveau/bar: only ioremap BAR3 if it exists drm/nouveau/bar/nvc0: support chips without BAR3 drm/nouveau/ibus: add GK20A support drm/nouveau/fb: add GK20A support drm/nouveau/fifo: add GK20A support drm/nouveau/graph: enable when using external fw drm/nouveau/graph: pad firmware code at load time drm/nouveau/graph: add GK20A support drm/nouveau: support for probing GK20Adrivers/gpu/drm/nouveau/Makefile | 6 + drivers/gpu/drm/nouveau/core/engine/device/nve0.c | 17 +++ drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c | 35 +++++ drivers/gpu/drm/nouveau/core/engine/fifo/nve0.h | 1 + .../gpu/drm/nouveau/core/engine/graph/ctxgk20a.c | 53 +++++++ .../gpu/drm/nouveau/core/engine/graph/ctxnvc0.h | 9 ++ .../gpu/drm/nouveau/core/engine/graph/ctxnve4.c | 14 +- drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c | 47 ++++++ drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 14 +- drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | 2 + drivers/gpu/drm/nouveau/core/engine/graph/nve4.c | 4 +- drivers/gpu/drm/nouveau/core/include/engine/fifo.h | 1 + .../gpu/drm/nouveau/core/include/engine/graph.h | 1 + drivers/gpu/drm/nouveau/core/include/subdev/fb.h | 1 + drivers/gpu/drm/nouveau/core/include/subdev/ibus.h | 1 + drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 6 +- drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | 114 +++++++------- drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c | 56 +++++++ drivers/gpu/drm/nouveau/core/subdev/fb/priv.h | 1 + drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 167 +++++++++++++++++++++ drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c | 103 +++++++++++++ 21 files changed, 584 insertions(+), 69 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/core/engine/fifo/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/engine/graph/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c create mode 100644 drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c--
1.9.2_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau