Re: [Nouveau] [PATCH] drm/nouveau/therm: ack any pending IRQ at init v2

2013-09-08 Thread Martin Peres

On 04/09/2013 03:52, Ben Skeggs wrote:

On Sat, Aug 31, 2013 at 10:06 AM, Martin Peres  wrote:

From: Martin Peres 

This is safe because ptherm hasn't been configured yet and will be a
little further down the initialization path. Ptherm should be safe
regarding to runtime reconfiguration.

Any objections to instead sticking the ACK in a single fini() hook
(along with additional code to disable all therm interrupts), and
having the IRQ handle silently ignore any non-requested IRQs (see what
the copy engine irq handler does, for example)?

Ben.


Hi Ben,

Sorry for the late answer. This all perfectly make sense. Please have a 
look at the patches I've just sent.


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


Re: [Nouveau] [PATCH] drm/nouveau/therm: ack any pending IRQ at init v2

2013-09-03 Thread Ben Skeggs
On Sat, Aug 31, 2013 at 10:06 AM, Martin Peres  wrote:
> From: Martin Peres 
>
> This is safe because ptherm hasn't been configured yet and will be a
> little further down the initialization path. Ptherm should be safe
> regarding to runtime reconfiguration.
Any objections to instead sticking the ACK in a single fini() hook
(along with additional code to disable all therm interrupts), and
having the IRQ handle silently ignore any non-requested IRQs (see what
the copy engine irq handler does, for example)?

Ben.
>
> v2:
> - do not limit this patch to nv84-a3 and make it nv84+
>
> Signed-off-by: Martin Peres 
> ---
>  drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c | 19 ++-
>  drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c |  4 
>  drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c |  4 
>  3 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c 
> b/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
> index 42ba633..8615d62 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
> @@ -209,13 +209,30 @@ nv84_therm_ctor(struct nouveau_object *parent,
> return nouveau_therm_preinit(&priv->base.base);
>  }
>
> +static int
> +nv84_therm_init(struct nouveau_object *object)
> +{
> +   struct nv84_therm_priv *priv = (void *)object;
> +   int ret;
> +
> +   ret = nouveau_therm_init(&priv->base.base);
> +   if (ret)
> +   return ret;
> +
> +   /* ACK ptherm IRQs */
> +   nv_wr32(object, 0x20100, 0x);
> +   nv_wr32(object, 0x1100, 0x1); /* PBUS */
> +
> +   return 0;
> +}
> +
>  struct nouveau_oclass
>  nv84_therm_oclass = {
> .handle = NV_SUBDEV(THERM, 0x84),
> .ofuncs = &(struct nouveau_ofuncs) {
> .ctor = nv84_therm_ctor,
> .dtor = _nouveau_therm_dtor,
> -   .init = _nouveau_therm_init,
> +   .init = nv84_therm_init,
> .fini = _nouveau_therm_fini,
> },
>  };
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c 
> b/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
> index d11a7c4..f740eeb 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
> @@ -60,6 +60,10 @@ nva3_therm_init(struct nouveau_object *object)
> }
> nv_mask(priv, 0x00e720, 0x0002, 0x);
>
> +   /* ACK ptherm IRQs */
> +   nv_wr32(object, 0x20100, 0x);
> +   nv_wr32(object, 0x1100, 0x1); /* PBUS */
> +
> return 0;
>  }
>
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c 
> b/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
> index 54c28bd..d9b5103 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
> @@ -114,6 +114,10 @@ nvd0_therm_init(struct nouveau_object *object)
> }
> nv_mask(priv, 0x00e720, 0x0002, 0x);
>
> +   /* ACK ptherm IRQs */
> +   nv_wr32(object, 0x20100, 0x);
> +   nv_wr32(object, 0x1100, 0x1); /* PBUS */
> +
> return 0;
>  }
>
> --
> 1.8.4
>
> ___
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH] drm/nouveau/therm: ack any pending IRQ at init v2

2013-08-30 Thread Martin Peres
From: Martin Peres 

This is safe because ptherm hasn't been configured yet and will be a
little further down the initialization path. Ptherm should be safe
regarding to runtime reconfiguration.

v2:
- do not limit this patch to nv84-a3 and make it nv84+

Signed-off-by: Martin Peres 
---
 drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c | 19 ++-
 drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c |  4 
 drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c |  4 
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c 
b/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
index 42ba633..8615d62 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv84.c
@@ -209,13 +209,30 @@ nv84_therm_ctor(struct nouveau_object *parent,
return nouveau_therm_preinit(&priv->base.base);
 }
 
+static int
+nv84_therm_init(struct nouveau_object *object)
+{
+   struct nv84_therm_priv *priv = (void *)object;
+   int ret;
+
+   ret = nouveau_therm_init(&priv->base.base);
+   if (ret)
+   return ret;
+
+   /* ACK ptherm IRQs */
+   nv_wr32(object, 0x20100, 0x);
+   nv_wr32(object, 0x1100, 0x1); /* PBUS */
+
+   return 0;
+}
+
 struct nouveau_oclass
 nv84_therm_oclass = {
.handle = NV_SUBDEV(THERM, 0x84),
.ofuncs = &(struct nouveau_ofuncs) {
.ctor = nv84_therm_ctor,
.dtor = _nouveau_therm_dtor,
-   .init = _nouveau_therm_init,
+   .init = nv84_therm_init,
.fini = _nouveau_therm_fini,
},
 };
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c 
b/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
index d11a7c4..f740eeb 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nva3.c
@@ -60,6 +60,10 @@ nva3_therm_init(struct nouveau_object *object)
}
nv_mask(priv, 0x00e720, 0x0002, 0x);
 
+   /* ACK ptherm IRQs */
+   nv_wr32(object, 0x20100, 0x);
+   nv_wr32(object, 0x1100, 0x1); /* PBUS */
+
return 0;
 }
 
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c 
b/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
index 54c28bd..d9b5103 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nvd0.c
@@ -114,6 +114,10 @@ nvd0_therm_init(struct nouveau_object *object)
}
nv_mask(priv, 0x00e720, 0x0002, 0x);
 
+   /* ACK ptherm IRQs */
+   nv_wr32(object, 0x20100, 0x);
+   nv_wr32(object, 0x1100, 0x1); /* PBUS */
+
return 0;
 }
 
-- 
1.8.4

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