Skip to contentSkip to conversation

drm/nouveau: support for GK20A, cont'd

PATCH Superseded Alexandre Courbot 6 participants 23 messages Apr 21, 2014 – May 2, 2014

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover drm/nouveau: support for GK20A, cont'd

Hi everyone,

Way overdue v2 of the final patches that enable basic GK20A support. Hopefully all the issues raised with v1 have been addressed.

Changes since v1:
- Use gk20a clock driver by Ben instead of twiddling nv04's
- Name new classes after gk20a instead of nvea
- Addressed comments about BAR initialization code factorization
- Removed non-essential code which only purpose was to avoid warnings
- Use nv_wait in ibus driver

Alexandre Courbot (10):
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 firmware drm/nouveau/graph: pad firmware code at load time drm/nouveau/graph: add GK20A support drm/nouveau: support GK20A in nouveau_accel_init() drm/nouveau: support for probing GK20A

 drivers/gpu/drm/nouveau/Makefile                   |   6 +
 drivers/gpu/drm/nouveau/core/engine/device/nve0.c  |  20 +++
 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   |  13 +-
 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  | 168 +++++++++++++++++++++
 drivers/gpu/drm/nouveau/core/subdev/ibus/gk20a.c   | 103 +++++++++++++
 drivers/gpu/drm/nouveau/nouveau_drm.c              |   5 +
 22 files changed, 592 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
#1 lore raw

PATCH v2 1/10 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
index bdf594116f3f..73b1ed20c8d5 100644
@@ -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
#2 lore raw

PATCH v2 2/10 drm/nouveau/bar/nvc0: support chips without BAR3

In reply to Alexandre Courbot

Adapt 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
index 3f30db62e656..ca8139b9ab27 100644
@@ -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
#3 lore raw

PATCH v2 3/10 drm/nouveau/ibus: add GK20A support

In reply to Alexandre Courbot

Add 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
index b7d216264775..bc5fb24630e6 100644
@@ -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
index 88814f159d89..31df634c0fdc 100644
@@ -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
#4 lore raw

PATCH v2 4/10 drm/nouveau/fb: add GK20A support

In reply to Alexandre Courbot

Add 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 | 168 ++++++++++++++++++++++
 5 files changed, 228 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
index bc5fb24630e6..34fef246e779 100644
@@ -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
index 58c7ccdebb01..871e73914b24 100644
@@ -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
index da74c889aed4..82273f832e42 100644
@@ -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 +168 -0

168 lines not on this page · raw message

Signature · 1 line
1.9.2
#5 lore raw

Re: [PATCH v2 04/10] drm/nouveau/fb: add GK20A support

On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote:
[...]

Quoted 1 line
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +0 -0

[...]

drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c line 120

Quoted 8 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +8 -0
+		pages = dma_alloc_from_contiguous(dev, ncmin, order);
+		if (!pages) {
+			gk20a_ram_put(pfb, &mem);
+			return -ENOMEM;
+		}
+
+		dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)),
+				      page_to_pfn(pages));

This breaks compilation on x86 because neither pfn_to_dma() nor dma_to_pfn() are available. Is there some other way this can be allocated so that these functions don't need to be called?

Thierry

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#6 lore raw

Re: [PATCH v2 04/10] drm/nouveau/fb: add GK20A support

Quoted 6 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote:
[...]

Quoted 1 line
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +0 -0

[...]

Quoted 12 lines

drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c line 120

Quoted 8 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +8 -0
+		pages = dma_alloc_from_contiguous(dev, ncmin, order);
+		if (!pages) {
+			gk20a_ram_put(pfb, &mem);
+			return -ENOMEM;
+		}
+
+		dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)),
+				      page_to_pfn(pages));

This breaks compilation on x86 because neither pfn_to_dma() nor dma_to_pfn() are available. Is there some other way this can be allocated so that these functions don't need to be called?

Mmm, this is bad. There is probably another more portable way to do this. Let me look for it.

Thanks,
Alex.

#7 lore raw

Re: [PATCH v2 04/10] drm/nouveau/fb: add GK20A support

Quoted 23 lines · Alexandre Courbot
Quoted 22 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote:
[...]

Quoted 3 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +0 -0

[...]

Quoted 9 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +8 -0
+               pages = dma_alloc_from_contiguous(dev, ncmin, order);
+               if (!pages) {
+                       gk20a_ram_put(pfb, &mem);
+                       return -ENOMEM;
+               }
+
+               dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)),
+                                     page_to_pfn(pages));
Quoted 7 lines
Quoted 3 lines

This breaks compilation on x86 because neither pfn_to_dma() nor dma_to_pfn() are available. Is there some other way this can be allocated so that these functions don't need to be called?

Mmm, this is bad. There is probably another more portable way to do this. Let me look for it.

page_to_phys()/phys_to_page() can be used by drivers and will work just fine here since the CPU and GPU use the same physical addresses to access memory.

Thanks,
Alex.

#8 lore raw

Re: [PATCH v2 04/10] drm/nouveau/fb: add GK20A support

Quoted 29 lines · Alexandre Courbot
Quoted 28 lines · Alexandre Courbot
Quoted 25 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote:
[...]

Quoted 3 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +0 -0

[...]

drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c line 120

Quoted 9 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +8 -0
+               pages = dma_alloc_from_contiguous(dev, ncmin, order);
+               if (!pages) {
+                       gk20a_ram_put(pfb, &mem);
+                       return -ENOMEM;
+               }
+
+               dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)),
+                                     page_to_pfn(pages));

This breaks compilation on x86 because neither pfn_to_dma() nor dma_to_pfn() are available. Is there some other way this can be allocated so that these functions don't need to be called?

Quoted 6 lines
Quoted 2 lines

Mmm, this is bad. There is probably another more portable way to do this. Let me look for it.

page_to_phys()/phys_to_page() can be used by drivers and will work just fine here since the CPU and GPU use the same physical addresses to access memory.

I'm wondering how this is going to pan out when we try adding IOMMU support. But I guess we can cross that bridge when we come to it.

Thierry

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#9 lore raw

Re: [PATCH v2 04/10] drm/nouveau/fb: add GK20A support

Quoted 33 lines · Thierry Reding
Quoted 32 lines · Alexandre Courbot
Quoted 30 lines · Alexandre Courbot
Quoted 22 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, Apr 21, 2014 at 03:02:16PM +0900, Alexandre Courbot wrote:
[...]

Quoted 3 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +0 -0

[...]

drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c line 120

Quoted 9 lines
drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +8 -0
+               pages = dma_alloc_from_contiguous(dev, ncmin, order);
+               if (!pages) {
+                       gk20a_ram_put(pfb, &mem);
+                       return -ENOMEM;
+               }
+
+               dma_addr = pfn_to_dma(nv_device_base(nv_device(pfb)),
+                                     page_to_pfn(pages));
Quoted 3 lines

This breaks compilation on x86 because neither pfn_to_dma() nor dma_to_pfn() are available. Is there some other way this can be allocated so that these functions don't need to be called?

Mmm, this is bad. There is probably another more portable way to do this. Let me look for it.

Quoted 6 lines
Quoted 3 lines

page_to_phys()/phys_to_page() can be used by drivers and will work just fine here since the CPU and GPU use the same physical addresses to access memory.

I'm wondering how this is going to pan out when we try adding IOMMU support. But I guess we can cross that bridge when we come to it.

Agreed. Besides I hope the day won't come where we have to go through 2 layers of memory translation for the GPU...

#10 lore raw

Re: [PATCH v2 04/10] drm/nouveau/fb: add GK20A support

Quoted 2 lines · Alexandre Courbot

Agreed. Besides I hope the day won't come where we have to go through 2 layers of memory translation for the GPU...

That's actually the method of operation that gives us the best performance. GPU likes big pages, and without IOMMU translation you'd have a hard time finding enough contiguous physical memory.

Terje

#11 lore raw

PATCH v2 5/10 drm/nouveau/fifo: add GK20A support

In reply to Alexandre Courbot

GK20A'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
index 34fef246e779..e6fe53bab593 100644
@@ -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
new file mode 100644
index 000000000000..327456eae963
@@ -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
index 014344ebee66..e96b32bb1bbc 100644
@@ -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
index 26b6b2bb1112..b639eb2c74ff 100644
@@ -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
#12 lore raw

PATCH v2 6/10 drm/nouveau/graph: enable when using external firmware

In reply to Alexandre Courbot

nvc0_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.

---
 drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +6 -3
index f3c7329da0a0..e5b75f189988 100644
@@ -1259,10 +1259,13 @@ 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", false);
+	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 +1275,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
#13 lore raw

PATCH v2 7/10 drm/nouveau/graph: pad firmware code at load time

In reply to Alexandre Courbot

Pad the microcode to a multiple of 0x40 bytes, 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
index e5b75f189988..013475c62986 100644
@@ -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 bytes */
+	for (; i & 0x3f; i++)
+		nv_wr32(priv, fuc_base + 0x0184, 0);
 }
 
 static void
Signature · 1 line
1.9.2
#14 lore raw

Re: [PATCH v2 07/10] drm/nouveau/graph: pad firmware code at load time

Quoted 1 line · Alexandre Courbot

Pad the microcode to a multiple of 0x40 bytes, otherwise firmware will

bytes or u32's? From the code, I'm guessing the latter. (Similar concern about comment in the code.)

Quoted 30 lines

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 -1
index e5b75f189988..013475c62986 100644
@@ -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 bytes */
+       for (; i & 0x3f; i++)
+               nv_wr32(priv, fuc_base + 0x0184, 0);
 }
 
 static void
--

1.9.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

Re: [PATCH v2 07/10] drm/nouveau/graph: pad firmware code at load time

Quoted 14 lines · Ilia Mirkin
Quoted 1 line · Alexandre Courbot

Pad the microcode to a multiple of 0x40 bytes, otherwise firmware will

bytes or u32's? From the code, I'm guessing the latter. (Similar concern about comment in the code.)

Quoted 8 lines

fail to run from non-prepadded firmware files.

---
 drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 12 lines

drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base, · line 900

Quoted 12 lines
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +4 -0
index e5b75f189988..013475c62986 100644
@@ -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 bytes */
+       for (; i & 0x3f; i++)
+               nv_wr32(priv, fuc_base + 0x0184, 0);

It's 256 bytes indeed.

Quoted 14 lines
Quoted 10 lines
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +0 -1
 }
 
 static void
--

1.9.2

_______________________________________________
dri-devel mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#16 lore raw

Re: [PATCH v2 07/10] drm/nouveau/graph: pad firmware code at load time

Quoted 15 lines · Ben Skeggs
Quoted 14 lines · Ilia Mirkin
Quoted 1 line · Alexandre Courbot

Pad the microcode to a multiple of 0x40 bytes, otherwise firmware will

bytes or u32's? From the code, I'm guessing the latter. (Similar concern about comment in the code.)

Quoted 8 lines

fail to run from non-prepadded firmware files.

---
  drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +0 -0
index e5b75f189988..013475c62986 100644
Quoted 8 lines

drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c nvc0_graph_init_fw(struct nvc0_graph_priv *priv, u32 fuc_base, · line 900

Quoted 8 lines
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 bytes */
+       for (; i & 0x3f; i++)
+               nv_wr32(priv, fuc_base + 0x0184, 0);

It's 256 bytes indeed.

Fixed, thanks!

#17 lore raw

PATCH v2 8/10 drm/nouveau/graph: add GK20A support

In reply to Alexandre Courbot

Add 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
index e6fe53bab593..1aaa2ef577d9 100644
@@ -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
index 9c815d1f99ef..8da8b627b9d0 100644
@@ -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
index 49a14b116a5f..c5b249238587 100644
@@ -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
index 90d44616c876..75203a99d902 100644
@@ -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
index f7c011217175..51e0c075ad34 100644
@@ -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
index 871edfdf3d5b..8c1d4772da0c 100644
@@ -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
#18 lore raw

PATCH v2 9/10 drm/nouveau: support GK20A in nouveau_accel_init()

In reply to Alexandre Courbot

Skip the creation of a software channel for GK20A as software methods are not yet supported.

---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +5 -0
index ddd83756b9a2..5b46148ffd32 100644
@@ -208,6 +208,10 @@ nouveau_accel_init(struct nouveau_drm *drm)
 		return;
 	}
 
+	/* Need to figure out how to handle sw for gk20a */
+	if (device->chipset == 0xea)
+		goto skip_sw_init;
+
 	ret = nouveau_object_new(nv_object(drm), NVDRM_CHAN, NVDRM_NVSW,
 				 nouveau_abi16_swclass(drm), NULL, 0, &object);
 	if (ret == 0) {
@@ -234,6 +238,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
 		return;
 	}
 
+skip_sw_init:
 	if (device->card_type < NV_C0) {
 		ret = nouveau_gpuobj_new(drm->device, NULL, 32, 0, 0,
 					&drm->notify);
Signature · 1 line
1.9.2
#19 lore raw

Re: [Nouveau] [PATCH v2 09/10] drm/nouveau: support GK20A in nouveau_accel_init()

Quoted 2 lines · Alexandre Courbot

Skip the creation of a software channel for GK20A as software methods are not yet supported.

How is GK20A different from a nvc0+ card that lacks PDISPLAY (like all the 3D Controller ones, and I guess even some that come up as VGA controller in PCI but don't have any outputs in their VBIOS)? i.e. what's wrong with just doing the same thing that GK1xx does? Note that there are sw methods that don't deal with display as well.

-ilia

Quoted 36 lines
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +5 -1
index ddd83756b9a2..5b46148ffd32 100644
@@ -208,6 +208,10 @@ nouveau_accel_init(struct nouveau_drm *drm)
                return;
        }
 
+       /* Need to figure out how to handle sw for gk20a */
+       if (device->chipset == 0xea)
+               goto skip_sw_init;
+
        ret = nouveau_object_new(nv_object(drm), NVDRM_CHAN, NVDRM_NVSW,
                                 nouveau_abi16_swclass(drm), NULL, 0, &object);
        if (ret == 0) {
@@ -234,6 +238,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
                return;
        }
 
+skip_sw_init:
        if (device->card_type < NV_C0) {
                ret = nouveau_gpuobj_new(drm->device, NULL, 32, 0, 0,
                                        &drm->notify);
--

1.9.2

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#20 lore raw

Re: [Nouveau] [PATCH v2 09/10] drm/nouveau: support GK20A in nouveau_accel_init()

Quoted 9 lines · Ilia Mirkin
Quoted 2 lines · Alexandre Courbot

Skip the creation of a software channel for GK20A as software methods are not yet supported.

How is GK20A different from a nvc0+ card that lacks PDISPLAY (like all the 3D Controller ones, and I guess even some that come up as VGA controller in PCI but don't have any outputs in their VBIOS)? i.e. what's wrong with just doing the same thing that GK1xx does? Note that there are sw methods that don't deal with display as well.

The mp_control() methods are the only ones I see, and, in my opinion, they should really have been implemented using reserved methods on a graphics class, and *not* in a purely software object.. If we need them on GK20A too, we should reimplement them in gr, and bump the minor version number so userspace knows.

Ben.

Quoted 43 lines

-ilia

Quoted 32 lines
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +5 -1
index ddd83756b9a2..5b46148ffd32 100644
@@ -208,6 +208,10 @@ nouveau_accel_init(struct nouveau_drm *drm)
                return;
        }
 
+       /* Need to figure out how to handle sw for gk20a */
+       if (device->chipset == 0xea)
+               goto skip_sw_init;
+
        ret = nouveau_object_new(nv_object(drm), NVDRM_CHAN, NVDRM_NVSW,
                                 nouveau_abi16_swclass(drm), NULL, 0, &object);
        if (ret == 0) {
@@ -234,6 +238,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
                return;
        }
 
+skip_sw_init:
        if (device->card_type < NV_C0) {
                ret = nouveau_gpuobj_new(drm->device, NULL, 32, 0, 0,
                                        &drm->notify);
--

1.9.2

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#21 lore raw

Re: [Nouveau] [PATCH v2 09/10] drm/nouveau: support GK20A in nouveau_accel_init()

In reply to Ilia Mirkin
Quoted 9 lines · Ilia Mirkin
Quoted 2 lines · Alexandre Courbot

Skip the creation of a software channel for GK20A as software methods are not yet supported.

How is GK20A different from a nvc0+ card that lacks PDISPLAY (like all the 3D Controller ones, and I guess even some that come up as VGA controller in PCI but don't have any outputs in their VBIOS)? i.e. what's wrong with just doing the same thing that GK1xx does? Note that there are sw methods that don't deal with display as well.

Well, as it turns out... I have tried reverting this patch and enabling nvc0_software_oclass for GK20A and things worked like a charm. 0_o

This is definitely different from when I first drafted this patch series, where a software class could not be used on GK20A due to hard dependencies on display. But it seems like today's code can accommodate much better with that situation.

That's great - this will allow us to get rid of this ungraceful patch. Thanks for making me check it again.

Probably a v3 will be necessary to enable the software class in patch 10 (and fix the byte/word typo in patch 7). I will just wait a bit to see if this v2 gets more comments before sending it.

Quoted 39 lines

-ilia

Quoted 36 lines
---
  drivers/gpu/drm/nouveau/nouveau_drm.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drm.c +5 -1
index ddd83756b9a2..5b46148ffd32 100644
@@ -208,6 +208,10 @@ nouveau_accel_init(struct nouveau_drm *drm)
                 return;
         }
 
+       /* Need to figure out how to handle sw for gk20a */
+       if (device->chipset == 0xea)
+               goto skip_sw_init;
+
         ret = nouveau_object_new(nv_object(drm), NVDRM_CHAN, NVDRM_NVSW,
                                  nouveau_abi16_swclass(drm), NULL, 0, &object);
         if (ret == 0) {
@@ -234,6 +238,7 @@ nouveau_accel_init(struct nouveau_drm *drm)
                 return;
         }
 
+skip_sw_init:
         if (device->card_type < NV_C0) {
                 ret = nouveau_gpuobj_new(drm->device, NULL, 32, 0, 0,
                                         &drm->notify);
--

1.9.2

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#22 lore raw

PATCH v2 10/10 drm/nouveau: support for probing GK20A

In reply to Alexandre Courbot

Set the correct subdev/engine classes when GK20A (0xea) is probed.

---
 drivers/gpu/drm/nouveau/core/engine/device/nve0.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/nouveau/core/engine/device/nve0.c +20 -0
index 9784cbf8a9d2..b014928286d6 100644
@@ -156,6 +156,26 @@ 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;
+		/* TODO will need an implementation for this at some point... */
+#if 0
+		device->oclass[NVDEV_ENGINE_SW     ] =  nvc0_software_oclass;
+#endif
+		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