All of lore.kernel.org
 help / color / mirror / Atom feed
* Testers needed for NVAA/NVAC kernel patch
@ 2014-12-02 22:29 Pierre Moreau
  2014-12-03 15:56 ` poma
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Moreau @ 2014-12-02 22:29 UTC (permalink / raw)
  To: Nouveau List

Hello everyone,

I would need testers to check that this patch doesn't break working
NVAA/NVAC configurations. It fixes an issue where some NVAC would hang on boot;
if similar issues exist on NVAA, it may fix them too.
You will find the patch below in two different versions: one will apply on Ben
Skeggs' repository, the other one will apply on a regular Linux tree.

Thanks in advance,

Pierre Moreau


If you are using Ben Skeggs' repository:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
diff --git a/drm/core/subdev/fb/nvaa.h b/drm/core/subdev/fb/nvaa.h
new file mode 120000
index 0000000..b450e8c
--- /dev/null
+++ b/drm/core/subdev/fb/nvaa.h
@@ -0,0 +1 @@
+../../../../nvkm/subdev/fb/nvaa.h
\ No newline at end of file
diff --git a/nvkm/subdev/fb/nv50.h b/nvkm/subdev/fb/nv50.h
index c5e5a88..0b20975 100644
--- a/nvkm/subdev/fb/nv50.h
+++ b/nvkm/subdev/fb/nv50.h
@@ -9,6 +9,10 @@ struct nv50_fb_priv {
 	dma_addr_t r100c08;
 };
 
+#define nv50_fb_create(p,e,c,d,o)                                              \
+	nv50_fb_ctor((p), (e), (c), (d), sizeof(**o),                          \
+			(struct nouveau_object **)o)
+
 int  nv50_fb_ctor(struct nouveau_object *, struct nouveau_object *,
 		  struct nouveau_oclass *, void *, u32,
 		  struct nouveau_object **);
diff --git a/nvkm/subdev/fb/nvaa.c b/nvkm/subdev/fb/nvaa.c
index cba8e68..b70ab2f 100644
--- a/nvkm/subdev/fb/nvaa.c
+++ b/nvkm/subdev/fb/nvaa.c
@@ -22,15 +22,81 @@
  * Authors: Ben Skeggs
  */
 
-#include "nv50.h"
+#include "nvaa.h"
+
+int
+nvaa_fb_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 nvaa_fb_priv *priv;
+	int ret;
+
+	ret = nv50_fb_create(parent, engine, oclass, data, &priv);
+	*pobject = nv_object(priv);
+	if (ret)
+		return ret;
+
+	priv = (struct nvaa_fb_priv *)(*pobject);
+
+	priv->r100c18_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+	if (priv->r100c18_page) {
+		priv->r100c18 = dma_map_page(nv_device_base(device),
+					     priv->r100c18_page, 0, PAGE_SIZE,
+					     DMA_BIDIRECTIONAL);
+		if (dma_mapping_error(nv_device_base(device), priv->r100c18))
+			return -EFAULT;
+	} else {
+		nv_warn(priv, "failed 0x100c18 page alloc\n");
+	}
+	return 0;
+}
+
+void
+nvaa_fb_dtor(struct nouveau_object *object)
+{
+	struct nouveau_device *device = nv_device(object);
+	struct nvaa_fb_priv *priv = (void *)object;
+
+	if (priv->r100c18_page) {
+		dma_unmap_page(nv_device_base(device), priv->r100c18, PAGE_SIZE,
+			       DMA_BIDIRECTIONAL);
+		__free_page(priv->r100c18_page);
+	}
+
+	nv50_fb_dtor(object);
+}
+
+int
+nvaa_fb_init(struct nouveau_object *object)
+{
+	struct nvaa_fb_priv *priv = (void *)object;
+	int ret;
+
+	ret = nv50_fb_init(object);
+	if (ret)
+		return ret;
+
+	/* Enable NISO poller for various clients and set their associated
+	 * read address, only for MCP77/78 and MCP79/7A. (fd#25701)
+	 */
+	nv_wr32(priv, 0x100c18, priv->r100c18 >> 8);
+	nv_mask(priv, 0x100c14, 0x00000000, 0x00000001);
+	nv_wr32(priv, 0x100c1c, (priv->r100c18 >> 8) + 1);
+	nv_mask(priv, 0x100c14, 0x00000000, 0x00000002);
+	nv_wr32(priv, 0x100c24, (priv->r100c18 >> 8) + 2);
+	nv_mask(priv, 0x100c14, 0x00000000, 0x00010000);
+	return 0;
+}
 
 struct nouveau_oclass *
 nvaa_fb_oclass = &(struct nv50_fb_impl) {
 	.base.base.handle = NV_SUBDEV(FB, 0xaa),
 	.base.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv50_fb_ctor,
-		.dtor = nv50_fb_dtor,
-		.init = nv50_fb_init,
+		.ctor = nvaa_fb_ctor,
+		.dtor = nvaa_fb_dtor,
+		.init = nvaa_fb_init,
 		.fini = _nouveau_fb_fini,
 	},
 	.base.memtype = nv50_fb_memtype_valid,
diff --git a/nvkm/subdev/fb/nvaa.h b/nvkm/subdev/fb/nvaa.h
new file mode 100644
index 0000000..84e1eca
--- /dev/null
+++ b/nvkm/subdev/fb/nvaa.h
@@ -0,0 +1,19 @@
+#ifndef __NVKM_FB_NVAA_H__
+#define __NVKM_FB_NVAA_H__
+
+#include "nv50.h"
+
+struct nvaa_fb_priv {
+	struct nv50_fb_priv base;
+	struct page *r100c18_page;
+	dma_addr_t r100c18;
+};
+
+int  nvaa_fb_ctor(struct nouveau_object *, struct nouveau_object *,
+		  struct nouveau_oclass *, void *, u32,
+		  struct nouveau_object **);
+void nvaa_fb_dtor(struct nouveau_object *);
+int  nvaa_fb_init(struct nouveau_object *);
+
+
+#endif
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/


Or if you are using the regular tree:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h
index c5e5a88..0b20975 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h
@@ -9,6 +9,10 @@ struct nv50_fb_priv {
 	dma_addr_t r100c08;
 };
 
+#define nv50_fb_create(p,e,c,d,o)                                              \
+	nv50_fb_ctor((p), (e), (c), (d), sizeof(**o),                          \
+			(struct nouveau_object **)o)
+
 int  nv50_fb_ctor(struct nouveau_object *, struct nouveau_object *,
 		  struct nouveau_oclass *, void *, u32,
 		  struct nouveau_object **);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c
index cba8e68..b70ab2f 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c
@@ -22,15 +22,81 @@
  * Authors: Ben Skeggs
  */
 
-#include "nv50.h"
+#include "nvaa.h"
+
+int
+nvaa_fb_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 nvaa_fb_priv *priv;
+	int ret;
+
+	ret = nv50_fb_create(parent, engine, oclass, data, &priv);
+	*pobject = nv_object(priv);
+	if (ret)
+		return ret;
+
+	priv = (struct nvaa_fb_priv *)(*pobject);
+
+	priv->r100c18_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+	if (priv->r100c18_page) {
+		priv->r100c18 = dma_map_page(nv_device_base(device),
+					     priv->r100c18_page, 0, PAGE_SIZE,
+					     DMA_BIDIRECTIONAL);
+		if (dma_mapping_error(nv_device_base(device), priv->r100c18))
+			return -EFAULT;
+	} else {
+		nv_warn(priv, "failed 0x100c18 page alloc\n");
+	}
+	return 0;
+}
+
+void
+nvaa_fb_dtor(struct nouveau_object *object)
+{
+	struct nouveau_device *device = nv_device(object);
+	struct nvaa_fb_priv *priv = (void *)object;
+
+	if (priv->r100c18_page) {
+		dma_unmap_page(nv_device_base(device), priv->r100c18, PAGE_SIZE,
+			       DMA_BIDIRECTIONAL);
+		__free_page(priv->r100c18_page);
+	}
+
+	nv50_fb_dtor(object);
+}
+
+int
+nvaa_fb_init(struct nouveau_object *object)
+{
+	struct nvaa_fb_priv *priv = (void *)object;
+	int ret;
+
+	ret = nv50_fb_init(object);
+	if (ret)
+		return ret;
+
+	/* Enable NISO poller for various clients and set their associated
+	 * read address, only for MCP77/78 and MCP79/7A. (fd#25701)
+	 */
+	nv_wr32(priv, 0x100c18, priv->r100c18 >> 8);
+	nv_mask(priv, 0x100c14, 0x00000000, 0x00000001);
+	nv_wr32(priv, 0x100c1c, (priv->r100c18 >> 8) + 1);
+	nv_mask(priv, 0x100c14, 0x00000000, 0x00000002);
+	nv_wr32(priv, 0x100c24, (priv->r100c18 >> 8) + 2);
+	nv_mask(priv, 0x100c14, 0x00000000, 0x00010000);
+	return 0;
+}
 
 struct nouveau_oclass *
 nvaa_fb_oclass = &(struct nv50_fb_impl) {
 	.base.base.handle = NV_SUBDEV(FB, 0xaa),
 	.base.base.ofuncs = &(struct nouveau_ofuncs) {
-		.ctor = nv50_fb_ctor,
-		.dtor = nv50_fb_dtor,
-		.init = nv50_fb_init,
+		.ctor = nvaa_fb_ctor,
+		.dtor = nvaa_fb_dtor,
+		.init = nvaa_fb_init,
 		.fini = _nouveau_fb_fini,
 	},
 	.base.memtype = nv50_fb_memtype_valid,
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.h b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.h
new file mode 100644
index 0000000..84e1eca
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.h
@@ -0,0 +1,19 @@
+#ifndef __NVKM_FB_NVAA_H__
+#define __NVKM_FB_NVAA_H__
+
+#include "nv50.h"
+
+struct nvaa_fb_priv {
+	struct nv50_fb_priv base;
+	struct page *r100c18_page;
+	dma_addr_t r100c18;
+};
+
+int  nvaa_fb_ctor(struct nouveau_object *, struct nouveau_object *,
+		  struct nouveau_oclass *, void *, u32,
+		  struct nouveau_object **);
+void nvaa_fb_dtor(struct nouveau_object *);
+int  nvaa_fb_init(struct nouveau_object *);
+
+
+#endif
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Testers needed for NVAA/NVAC kernel patch
  2014-12-02 22:29 Testers needed for NVAA/NVAC kernel patch Pierre Moreau
@ 2014-12-03 15:56 ` poma
  0 siblings, 0 replies; 2+ messages in thread
From: poma @ 2014-12-03 15:56 UTC (permalink / raw)
  To: Nouveau List

On 02.12.2014 23:29, Pierre Moreau wrote:
> Hello everyone,
> 
> I would need testers to check that this patch doesn't break working
> NVAA/NVAC configurations. It fixes an issue where some NVAC would hang on boot;
> if similar issues exist on NVAA, it may fix them too.
> You will find the patch below in two different versions: one will apply on Ben
> Skeggs' repository, the other one will apply on a regular Linux tree.
> 
> Thanks in advance,
> 
> Pierre Moreau
> 


git://people.freedesktop.org/~darktama/nouveau
commented the following "dumb" lines & patched with "If you are using Ben Skeggs' repository"

/NV/nouveau/drm/nouveau_gem.c: In function ‘validate_list’:
/NV/nouveau/drm/nouveau_gem.c:447:22: error: ‘struct drm_gem_object’ has no member named ‘dumb’
   WARN_ONCE(nvbo->gem.dumb,
                      ^
include/asm-generic/bug.h:121:27: note: in definition of macro ‘WARN_ONCE’
  int __ret_warn_once = !!(condition);   \
                           ^
/NV/nouveau/drm/nouveau_display.c: In function ‘nouveau_display_dumb_create’:
/NV/nouveau/drm/nouveau_display.c:879:9: error: ‘struct drm_gem_object’ has no member named ‘dumb’
  bo->gem.dumb = true;
         ^
/NV/nouveau/drm/nouveau_display.c: In function ‘nouveau_display_dumb_map_offset’:
/NV/nouveau/drm/nouveau_display.c:900:18: error: ‘struct drm_gem_object’ has no member named ‘dumb’
   WARN_ONCE(!(gem->dumb || gem->import_attach),
                  ^
include/asm-generic/bug.h:121:27: note: in definition of macro ‘WARN_ONCE’
  int __ret_warn_once = !!(condition);   \
                           ^
/NV/nouveau/drm/nouveau_display.c: In function ‘nouveau_display_dumb_create’:
/NV/nouveau/drm/nouveau_display.c:879:9: error: ‘struct drm_gem_object’ has no member named ‘dumb’
  bo->gem.dumb = true;
         ^

# dmesg | grep nouveau
[   25.348109] nouveau: module verification failed: signature and/or  required key missing - tainting kernel
[   25.392337] fb: switching to nouveaufb from VESA VGA
[   25.410386] nouveau  [  DEVICE][0000:01:00.0] BOOT0  : 0x0ace80b1
[   25.410408] nouveau  [  DEVICE][0000:01:00.0] Chipset: MCP79/MCP7A (NVAC)
[   25.410419] nouveau  [  DEVICE][0000:01:00.0] Family : NV50
[   25.426804] nouveau  [   VBIOS][0000:01:00.0] using image from PRAMIN
[   25.427343] nouveau  [   VBIOS][0000:01:00.0] BIT signature found
[   25.427361] nouveau  [   VBIOS][0000:01:00.0] version 62.79.78.00.00
[   25.450604] nouveau 0000:01:00.0: irq 26 for MSI/MSI-X
[   25.450635] nouveau  [     PMC][0000:01:00.0] MSI interrupts enabled
[   25.450698] nouveau  [     PFB][0000:01:00.0] RAM type: stolen system memory
[   25.450710] nouveau  [     PFB][0000:01:00.0] RAM size: 256 MiB
[   25.450719] nouveau  [     PFB][0000:01:00.0]    ZCOMP: 0 tags
[   25.482512] nouveau  [  PTHERM][0000:01:00.0] FAN control: none / external
[   25.482581] nouveau  [  PTHERM][0000:01:00.0] fan management: automatic
[   25.482602] nouveau  [  PTHERM][0000:01:00.0] internal sensor: yes
[   25.502658] nouveau  [     CLK][0000:01:00.0] 03: core 200 MHz shader 400 MHz vdec 200 MHz
[   25.502684] nouveau  [     CLK][0000:01:00.0] 05: core 300 MHz shader 600 MHz vdec 300 MHz
[   25.502701] nouveau  [     CLK][0000:01:00.0] 07: core 350 MHz shader 800 MHz vdec 350 MHz
[   25.502717] nouveau  [     CLK][0000:01:00.0] 0f: core 450 MHz shader 1100 MHz vdec 450 MHz
[   25.502753] nouveau  [     CLK][0000:01:00.0] --: core 450 MHz shader 1100 MHz vdec 450 MHz
[   25.503536] nouveau  [     DRM] VRAM: 256 MiB
[   25.503550] nouveau  [     DRM] GART: 1048576 MiB
[   25.503570] nouveau  [     DRM] TMDS table version 2.0
[   25.503584] nouveau  [     DRM] DCB version 4.0
[   25.503599] nouveau  [     DRM] DCB outp 00: 02000300 0000001e
[   25.503616] nouveau  [     DRM] DCB outp 01: 01011322 00000030
[   25.503631] nouveau  [     DRM] DCB outp 02: 02022332 00020010
[   25.503645] nouveau  [     DRM] DCB conn 00: 00000000
[   25.503659] nouveau  [     DRM] DCB conn 01: 00001131
[   25.503672] nouveau  [     DRM] DCB conn 02: 00002261
[   25.548615] nouveau  [     DRM] MM: using M2MF for buffer copies
[   25.637542] nouveau  [     DRM] allocated 800x600 fb: 0x50000, bo ffff8800bc6d3c00
[   25.637949] fbcon: nouveaufb (fb0) is primary device
[   25.705760] nouveau 0000:01:00.0: fb0: nouveaufb frame buffer device
[   25.705791] [drm] Initialized nouveau 1.2.1 20120801 for 0000:01:00.0 on minor 1

# grep -w connected /var/log/Xorg.0.log
[    34.783] (II) NOUVEAU(0): Output HDMI-1 connected

# modinfo nouveau -n
/lib/modules/3.18.0-0.rc7.git0.1.fc22.x86_64/updates/nouveau.ko


_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-03 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-02 22:29 Testers needed for NVAA/NVAC kernel patch Pierre Moreau
2014-12-03 15:56 ` poma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.