Re: [Nouveau] [PATCH 1/3] subdev: add a pfuse subdev
On Mon, Aug 25, 2014 at 9:35 AM, Emil Velikov wrote: > On 24/08/14 22:15, Martin Peres wrote: >> We will use this subdev to disable temperature reading on cards that did not >> get a sensor calibration in the factory. >> >> Signed-off-by: Martin Peres >> --- >> configure.ac | 1 + >> drm/Kbuild | 4 ++ >> drm/core/include/subdev/fuse.h | 1 + >> drm/core/subdev/fuse/base.c| 1 + >> drm/core/subdev/fuse/g80.c | 1 + >> drm/core/subdev/fuse/gf100.c | 1 + >> drm/core/subdev/fuse/gm107.c | 1 + >> drm/core/subdev/fuse/priv.h| 1 + >> nvkm/engine/device/gm100.c | 2 + >> nvkm/engine/device/nv50.c | 15 >> nvkm/engine/device/nvc0.c | 10 + >> nvkm/engine/device/nve0.c | 8 >> nvkm/include/core/device.h | 1 + >> nvkm/include/subdev/fuse.h | 30 +++ >> nvkm/subdev/Makefile.am| 3 +- >> nvkm/subdev/fuse/Makefile.am | 8 >> nvkm/subdev/fuse/base.c| 62 +++ >> nvkm/subdev/fuse/g80.c | 81 >> + >> nvkm/subdev/fuse/gf100.c | 83 >> ++ >> nvkm/subdev/fuse/gm107.c | 66 + >> nvkm/subdev/fuse/priv.h| 9 + >> 21 files changed, 388 insertions(+), 1 deletion(-) >> create mode 12 drm/core/include/subdev/fuse.h >> create mode 12 drm/core/subdev/fuse/base.c >> create mode 12 drm/core/subdev/fuse/g80.c >> create mode 12 drm/core/subdev/fuse/gf100.c >> create mode 12 drm/core/subdev/fuse/gm107.c >> create mode 12 drm/core/subdev/fuse/priv.h >> create mode 100644 nvkm/include/subdev/fuse.h >> create mode 100644 nvkm/subdev/fuse/Makefile.am >> create mode 100644 nvkm/subdev/fuse/base.c >> create mode 100644 nvkm/subdev/fuse/g80.c >> create mode 100644 nvkm/subdev/fuse/gf100.c >> create mode 100644 nvkm/subdev/fuse/gm107.c >> create mode 100644 nvkm/subdev/fuse/priv.h >> > [snip] >> diff --git a/nvkm/subdev/fuse/base.c b/nvkm/subdev/fuse/base.c >> new file mode 100644 >> index 000..d249f2b >> --- /dev/null >> +++ b/nvkm/subdev/fuse/base.c >> @@ -0,0 +1,62 @@ >> +/* >> + * Copyright 2014 Martin Peres >> + * >> + * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. >> + * >> + * Authors: Martin Peres >> + */ >> + >> +#include >> + >> +int >> +_nouveau_fuse_init(struct nouveau_object *object) >> +{ >> + struct nouveau_fuse *fuse = (void *)object; >> + int ret; >> + >> + ret = nouveau_subdev_init(&fuse->base); >> + if (ret) >> + return ret; >> + > If you want you can drop the check the extra variable. > >> + return 0; >> +} >> + >> +void >> +_nouveau_fuse_dtor(struct nouveau_object *object) >> +{ >> + struct nouveau_fuse *fuse = (void *)object; >> + nouveau_subdev_destroy(&fuse->base); >> +} >> + >> +int >> +nouveau_fuse_create_(struct nouveau_object *parent, >> + struct nouveau_object *engine, >> + struct nouveau_oclass *oclass, int length, void **pobject) >> +{ >> + struct nouveau_fuse *fuse; >> + int ret; >> + >> + ret = nouveau_subdev_create_(parent, engine, oclass, 0, "FUSE", >> + "fuse", length, pobject); > ^^^ > I think you want to use &fusehere ? > >> + fuse = *pobject; > Swap the assignment order and move it past the conditional ? > >> + if (ret) >> + return ret; >> + > > + *pobject = fuse; > > And perhaps return 0, to make it obvious and consistent with the second case > below. > >> + return ret; >> +} > [snip] >> diff --git a/nvkm/subdev/fuse/gm107.c b/nvkm/subdev/fuse/gm107.c >> new file mode 100644 >> index 000..4ade700 >> --- /dev/null >> +++ b/nvkm/subdev/fus
Re: [Nouveau] [PATCH 1/3] subdev: add a pfuse subdev
On 24/08/14 22:15, Martin Peres wrote: > We will use this subdev to disable temperature reading on cards that did not > get a sensor calibration in the factory. > > Signed-off-by: Martin Peres > --- > configure.ac | 1 + > drm/Kbuild | 4 ++ > drm/core/include/subdev/fuse.h | 1 + > drm/core/subdev/fuse/base.c| 1 + > drm/core/subdev/fuse/g80.c | 1 + > drm/core/subdev/fuse/gf100.c | 1 + > drm/core/subdev/fuse/gm107.c | 1 + > drm/core/subdev/fuse/priv.h| 1 + > nvkm/engine/device/gm100.c | 2 + > nvkm/engine/device/nv50.c | 15 > nvkm/engine/device/nvc0.c | 10 + > nvkm/engine/device/nve0.c | 8 > nvkm/include/core/device.h | 1 + > nvkm/include/subdev/fuse.h | 30 +++ > nvkm/subdev/Makefile.am| 3 +- > nvkm/subdev/fuse/Makefile.am | 8 > nvkm/subdev/fuse/base.c| 62 +++ > nvkm/subdev/fuse/g80.c | 81 + > nvkm/subdev/fuse/gf100.c | 83 > ++ > nvkm/subdev/fuse/gm107.c | 66 + > nvkm/subdev/fuse/priv.h| 9 + > 21 files changed, 388 insertions(+), 1 deletion(-) > create mode 12 drm/core/include/subdev/fuse.h > create mode 12 drm/core/subdev/fuse/base.c > create mode 12 drm/core/subdev/fuse/g80.c > create mode 12 drm/core/subdev/fuse/gf100.c > create mode 12 drm/core/subdev/fuse/gm107.c > create mode 12 drm/core/subdev/fuse/priv.h > create mode 100644 nvkm/include/subdev/fuse.h > create mode 100644 nvkm/subdev/fuse/Makefile.am > create mode 100644 nvkm/subdev/fuse/base.c > create mode 100644 nvkm/subdev/fuse/g80.c > create mode 100644 nvkm/subdev/fuse/gf100.c > create mode 100644 nvkm/subdev/fuse/gm107.c > create mode 100644 nvkm/subdev/fuse/priv.h > [snip] > diff --git a/nvkm/subdev/fuse/base.c b/nvkm/subdev/fuse/base.c > new file mode 100644 > index 000..d249f2b > --- /dev/null > +++ b/nvkm/subdev/fuse/base.c > @@ -0,0 +1,62 @@ > +/* > + * Copyright 2014 Martin Peres > + * > + * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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. > + * > + * Authors: Martin Peres > + */ > + > +#include > + > +int > +_nouveau_fuse_init(struct nouveau_object *object) > +{ > + struct nouveau_fuse *fuse = (void *)object; > + int ret; > + > + ret = nouveau_subdev_init(&fuse->base); > + if (ret) > + return ret; > + If you want you can drop the check the extra variable. > + return 0; > +} > + > +void > +_nouveau_fuse_dtor(struct nouveau_object *object) > +{ > + struct nouveau_fuse *fuse = (void *)object; > + nouveau_subdev_destroy(&fuse->base); > +} > + > +int > +nouveau_fuse_create_(struct nouveau_object *parent, > + struct nouveau_object *engine, > + struct nouveau_oclass *oclass, int length, void **pobject) > +{ > + struct nouveau_fuse *fuse; > + int ret; > + > + ret = nouveau_subdev_create_(parent, engine, oclass, 0, "FUSE", > + "fuse", length, pobject); ^^^ I think you want to use &fusehere ? > + fuse = *pobject; Swap the assignment order and move it past the conditional ? > + if (ret) > + return ret; > + + *pobject = fuse; And perhaps return 0, to make it obvious and consistent with the second case below. > + return ret; > +} [snip] > diff --git a/nvkm/subdev/fuse/gm107.c b/nvkm/subdev/fuse/gm107.c > new file mode 100644 > index 000..4ade700 > --- /dev/null > +++ b/nvkm/subdev/fuse/gm107.c > @@ -0,0 +1,66 @@ [snip] > +static int > +gm107_fuse_ctor(struct nouveau_object *parent, struct nouveau_object *engine, > +struct nouveau_oclass *oclass, void *data, u32 size, > +
Re: [Nouveau] [PATCH 1/3] subdev: add a pfuse subdev
On 25/08/2014 00:27, Christian Costa wrote: Hi Martin, I'm not very familiar with the function naming scheme but shouldn't nouveau_fuse_rd32 use the same prefix as _fuse_ctor instead of nouveau? Christian Hey Christian, You're right, I should have. It's not really a problem since the function is static. I'll send a v2 if Ben wants me to fix it :) Martin ___ Nouveau mailing list Nouveau@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 1/3] subdev: add a pfuse subdev
Hi Martin, I'm not very familiar with the function naming scheme but shouldn't nouveau_fuse_rd32 use the same prefix as _fuse_ctor instead of nouveau? Christian Le 24/08/2014 23:15, Martin Peres a écrit : We will use this subdev to disable temperature reading on cards that did not get a sensor calibration in the factory. Signed-off-by: Martin Peres --- configure.ac | 1 + drm/Kbuild | 4 ++ drm/core/include/subdev/fuse.h | 1 + drm/core/subdev/fuse/base.c| 1 + drm/core/subdev/fuse/g80.c | 1 + drm/core/subdev/fuse/gf100.c | 1 + drm/core/subdev/fuse/gm107.c | 1 + drm/core/subdev/fuse/priv.h| 1 + nvkm/engine/device/gm100.c | 2 + nvkm/engine/device/nv50.c | 15 nvkm/engine/device/nvc0.c | 10 + nvkm/engine/device/nve0.c | 8 nvkm/include/core/device.h | 1 + nvkm/include/subdev/fuse.h | 30 +++ nvkm/subdev/Makefile.am| 3 +- nvkm/subdev/fuse/Makefile.am | 8 nvkm/subdev/fuse/base.c| 62 +++ nvkm/subdev/fuse/g80.c | 81 + nvkm/subdev/fuse/gf100.c | 83 ++ nvkm/subdev/fuse/gm107.c | 66 + nvkm/subdev/fuse/priv.h| 9 + 21 files changed, 388 insertions(+), 1 deletion(-) create mode 12 drm/core/include/subdev/fuse.h create mode 12 drm/core/subdev/fuse/base.c create mode 12 drm/core/subdev/fuse/g80.c create mode 12 drm/core/subdev/fuse/gf100.c create mode 12 drm/core/subdev/fuse/gm107.c create mode 12 drm/core/subdev/fuse/priv.h create mode 100644 nvkm/include/subdev/fuse.h create mode 100644 nvkm/subdev/fuse/Makefile.am create mode 100644 nvkm/subdev/fuse/base.c create mode 100644 nvkm/subdev/fuse/g80.c create mode 100644 nvkm/subdev/fuse/gf100.c create mode 100644 nvkm/subdev/fuse/gm107.c create mode 100644 nvkm/subdev/fuse/priv.h diff --git a/configure.ac b/configure.ac index de27156..b4404a5 100644 --- a/configure.ac +++ b/configure.ac @@ -74,6 +74,7 @@ AC_OUTPUT( Makefile \ nvkm/subdev/clock/Makefile \ nvkm/subdev/devinit/Makefile \ nvkm/subdev/fb/Makefile \ + nvkm/subdev/fuse/Makefile \ nvkm/subdev/gpio/Makefile \ nvkm/subdev/i2c/Makefile \ nvkm/subdev/ibus/Makefile \ diff --git a/drm/Kbuild b/drm/Kbuild index c663181..37ab09b 100644 --- a/drm/Kbuild +++ b/drm/Kbuild @@ -127,6 +127,10 @@ 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 +nouveau-y += core/subdev/fuse/base.o +nouveau-y += core/subdev/fuse/g80.o +nouveau-y += core/subdev/fuse/gf100.o +nouveau-y += core/subdev/fuse/gm107.o nouveau-y += core/subdev/gpio/base.o nouveau-y += core/subdev/gpio/nv10.o nouveau-y += core/subdev/gpio/nv50.o diff --git a/drm/core/include/subdev/fuse.h b/drm/core/include/subdev/fuse.h new file mode 12 index 000..421fdd7 --- /dev/null +++ b/drm/core/include/subdev/fuse.h @@ -0,0 +1 @@ +../../../../nvkm/include/subdev/fuse.h \ No newline at end of file diff --git a/drm/core/subdev/fuse/base.c b/drm/core/subdev/fuse/base.c new file mode 12 index 000..b218313 --- /dev/null +++ b/drm/core/subdev/fuse/base.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/base.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/g80.c b/drm/core/subdev/fuse/g80.c new file mode 12 index 000..c805b0d --- /dev/null +++ b/drm/core/subdev/fuse/g80.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/g80.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/gf100.c b/drm/core/subdev/fuse/gf100.c new file mode 12 index 000..ad9411b --- /dev/null +++ b/drm/core/subdev/fuse/gf100.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/gf100.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/gm107.c b/drm/core/subdev/fuse/gm107.c new file mode 12 index 000..947b11c --- /dev/null +++ b/drm/core/subdev/fuse/gm107.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/gm107.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/priv.h b/drm/core/subdev/fuse/priv.h new file mode 12 index 000..b6dedaa --- /dev/null +++ b/drm/core/subdev/fuse/priv.h @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/priv.h \ No newline at end of file diff --git a/nvkm/engine/device/gm100.c b/nvkm/engine/device/gm100.c index 9e9f567..6295668 100644 --- a/nvkm/engine/device/gm100.c +++ b/nvkm/engine/device/gm100.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ gm100_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass;
[Nouveau] [PATCH 1/3] subdev: add a pfuse subdev
We will use this subdev to disable temperature reading on cards that did not get a sensor calibration in the factory. Signed-off-by: Martin Peres --- configure.ac | 1 + drm/Kbuild | 4 ++ drm/core/include/subdev/fuse.h | 1 + drm/core/subdev/fuse/base.c| 1 + drm/core/subdev/fuse/g80.c | 1 + drm/core/subdev/fuse/gf100.c | 1 + drm/core/subdev/fuse/gm107.c | 1 + drm/core/subdev/fuse/priv.h| 1 + nvkm/engine/device/gm100.c | 2 + nvkm/engine/device/nv50.c | 15 nvkm/engine/device/nvc0.c | 10 + nvkm/engine/device/nve0.c | 8 nvkm/include/core/device.h | 1 + nvkm/include/subdev/fuse.h | 30 +++ nvkm/subdev/Makefile.am| 3 +- nvkm/subdev/fuse/Makefile.am | 8 nvkm/subdev/fuse/base.c| 62 +++ nvkm/subdev/fuse/g80.c | 81 + nvkm/subdev/fuse/gf100.c | 83 ++ nvkm/subdev/fuse/gm107.c | 66 + nvkm/subdev/fuse/priv.h| 9 + 21 files changed, 388 insertions(+), 1 deletion(-) create mode 12 drm/core/include/subdev/fuse.h create mode 12 drm/core/subdev/fuse/base.c create mode 12 drm/core/subdev/fuse/g80.c create mode 12 drm/core/subdev/fuse/gf100.c create mode 12 drm/core/subdev/fuse/gm107.c create mode 12 drm/core/subdev/fuse/priv.h create mode 100644 nvkm/include/subdev/fuse.h create mode 100644 nvkm/subdev/fuse/Makefile.am create mode 100644 nvkm/subdev/fuse/base.c create mode 100644 nvkm/subdev/fuse/g80.c create mode 100644 nvkm/subdev/fuse/gf100.c create mode 100644 nvkm/subdev/fuse/gm107.c create mode 100644 nvkm/subdev/fuse/priv.h diff --git a/configure.ac b/configure.ac index de27156..b4404a5 100644 --- a/configure.ac +++ b/configure.ac @@ -74,6 +74,7 @@ AC_OUTPUT( Makefile \ nvkm/subdev/clock/Makefile \ nvkm/subdev/devinit/Makefile \ nvkm/subdev/fb/Makefile \ + nvkm/subdev/fuse/Makefile \ nvkm/subdev/gpio/Makefile \ nvkm/subdev/i2c/Makefile \ nvkm/subdev/ibus/Makefile \ diff --git a/drm/Kbuild b/drm/Kbuild index c663181..37ab09b 100644 --- a/drm/Kbuild +++ b/drm/Kbuild @@ -127,6 +127,10 @@ 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 +nouveau-y += core/subdev/fuse/base.o +nouveau-y += core/subdev/fuse/g80.o +nouveau-y += core/subdev/fuse/gf100.o +nouveau-y += core/subdev/fuse/gm107.o nouveau-y += core/subdev/gpio/base.o nouveau-y += core/subdev/gpio/nv10.o nouveau-y += core/subdev/gpio/nv50.o diff --git a/drm/core/include/subdev/fuse.h b/drm/core/include/subdev/fuse.h new file mode 12 index 000..421fdd7 --- /dev/null +++ b/drm/core/include/subdev/fuse.h @@ -0,0 +1 @@ +../../../../nvkm/include/subdev/fuse.h \ No newline at end of file diff --git a/drm/core/subdev/fuse/base.c b/drm/core/subdev/fuse/base.c new file mode 12 index 000..b218313 --- /dev/null +++ b/drm/core/subdev/fuse/base.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/base.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/g80.c b/drm/core/subdev/fuse/g80.c new file mode 12 index 000..c805b0d --- /dev/null +++ b/drm/core/subdev/fuse/g80.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/g80.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/gf100.c b/drm/core/subdev/fuse/gf100.c new file mode 12 index 000..ad9411b --- /dev/null +++ b/drm/core/subdev/fuse/gf100.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/gf100.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/gm107.c b/drm/core/subdev/fuse/gm107.c new file mode 12 index 000..947b11c --- /dev/null +++ b/drm/core/subdev/fuse/gm107.c @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/gm107.c \ No newline at end of file diff --git a/drm/core/subdev/fuse/priv.h b/drm/core/subdev/fuse/priv.h new file mode 12 index 000..b6dedaa --- /dev/null +++ b/drm/core/subdev/fuse/priv.h @@ -0,0 +1 @@ +../../../../nvkm/subdev/fuse/priv.h \ No newline at end of file diff --git a/nvkm/engine/device/gm100.c b/nvkm/engine/device/gm100.c index 9e9f567..6295668 100644 --- a/nvkm/engine/device/gm100.c +++ b/nvkm/engine/device/gm100.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ gm100_identify(struct nouveau_device *device) device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; device->oclass[NVDEV_SUBDEV_I2C] = nvd0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; device->oclass[NVDEV_SUBDEV_THERM ] =