diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c index f4831f51a5ca3622ec9be92acdf7eb01d5730322..db987978c185605e7a5d4c918091b1746bc8ef97 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c @@ -365,7 +365,8 @@ gm200_gr = { { -1, -1, MAXWELL_B, &gf100_fermi }, { -1, -1, MAXWELL_COMPUTE_B }, {} - } + }, + .clkgate_pack = gm200_clkgate_pack, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c index 361c6a1fef8695f6bbf6d9533b67e06e60ebfd4c..b6e3ef26c36f60c6f10d8a4408adcca8ae4ac2be 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c @@ -25,6 +25,7 @@ #include "gf100.h" #include "gk104.h" #include "gk110.h" +#include "gm107.h" #include "ram.h" /* @@ -76,7 +77,7 @@ gm107_fb_clkgate_blcg_init_unk_1[] = { {} }; -static const struct nvkm_therm_clkgate_pack +const struct nvkm_therm_clkgate_pack gm107_fb_clkgate_pack[] = { { gm107_fb_clkgate_slcg_init_unk_0 }, { gm107_fb_clkgate_slcg_init_vm_0 }, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.h b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.h new file mode 100644 index 0000000000000000000000000000000000000000..20b0564d3410aff330c7b54b1e5325bfaf54960f --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.h @@ -0,0 +1,32 @@ +/* + * Copyright 2018 Red Hat Inc. + * + * 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: Lyude Paul + */ + +#ifndef GM107_H +#define GM107_H + +#include <subdev/therm.h> + +extern const struct nvkm_therm_clkgate_pack gm107_fb_clkgate_pack[]; + +#endif /* !GM107_H */ diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c index d3b8c3367152b4b18b58ecc38770c3cf4279d962..4a1dc426cf3c2b7e8cb22055f4ecb93c7512c4e3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c @@ -22,10 +22,30 @@ * Authors: Ben Skeggs */ #include "gf100.h" +#include "gm107.h" #include "ram.h" #include <core/memory.h> +/* XXX FIXME: Clockgate pack for fb appears to be identical between maxwell 1 + * and 2, but there's an idle filter in the middle. Make sure that not having + * this included is OK */ +/*static const struct nvkm_therm_clkgate_pack*/ +/*gm200_fb_clkgate_pack[] = {*/ + /*{ gm107_fb_clkgate_slcg_init_unk_0 },*/ + /*{ gm107_fb_clkgate_slcg_init_vm_0 },*/ + /*{ gm107_fb_clkgate_slcg_init_bcast_0 },*/ + /*{ gm107_fb_clkgate_slcg_init_pxbar_0 },*/ + /* FIXME: /IN THEORY/ this should not matter if we have a proper + * understanding of the clockgating enable sequence, but this is the + * point where the blob appears to program an idle filter. We need to + * find a GPU with a different idle filter programmed in the vbios and + * see if programming this late causes any issues. Karol kerbst maybe? + */ + /*{ gk110_fb_clkgate_blcg_init_unk_0 },*/ + /*{ gk104_fb_clkgate_blcg_init_vm_0 },*/ +/*};*/ + int gm200_fb_init_page(struct nvkm_fb *fb) { @@ -64,6 +84,7 @@ gm200_fb = { .intr = gf100_fb_intr, .ram_new = gm200_ram_new, .default_bigpage = 0 /* per-instance. */, + .clkgate_pack = gm107_fb_clkgate_pack, }; int diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c index efc8a23b55f86ad486f4ede149b9a40f76d614e9..5ae5f16657ce35f18f20a17afa755fbc118a8d9e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c @@ -25,6 +25,7 @@ #include "priv.h" #include "gk104.h" +#include "gm107.h" void gk104_clkgate_enable(struct nvkm_therm *base) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c index 2ad3b2bf57385f348daeb5e6c1b8a2832b6e69c0..11e76eafcbc786104e1660fbc50a401b2e766b41 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c @@ -23,6 +23,7 @@ */ #include "priv.h" #include "gk104.h" +#include "gm107.h" void gm107_clkgate_enable(struct nvkm_therm *base) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.h b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.h new file mode 100644 index 0000000000000000000000000000000000000000..fa012733ea9a9df129404d28f54e74fa5fc1b328 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.h @@ -0,0 +1,32 @@ +/* + * Copyright 2018 Red Hat + * + * 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: Lyude Paul + */ + +#ifndef GM107_H +#define GM107_H + +#include "gf100.h" + +extern const struct gf100_idle_filter gm107_idle_filter; + +#endif /* !GM107_H */ diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm200.c index 73dc78093d5d5b55fec453075623b65a86e57f05..d07d9469e34ae007930c1d711d8cec222519fc10 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm200.c @@ -22,6 +22,8 @@ * Authors: Karol Herbst */ #include "priv.h" +#include "gk104.h" +#include "gm107.h" static const struct nvkm_therm_func gm200_therm = { @@ -29,11 +31,16 @@ gm200_therm = { .fini = g84_therm_fini, .temp_get = g84_temp_get, .program_alarms = nvkm_therm_program_alarms_polling, + .clkgate_init = gf100_clkgate_init, + .clkgate_enable = gm107_clkgate_enable, + .clkgate_fini = gk104_clkgate_fini, }; int gm200_therm_new(struct nvkm_device *device, int index, struct nvkm_therm **ptherm) { - return nvkm_therm_new_(&gm200_therm, device, index, ptherm); + return gk104_therm_new_(&gm200_therm, device, index, + gk104_clkgate_engine_info, &gm107_idle_filter, + ptherm); } diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/priv.h index 21659daf18649c827aff2369dab63fb0230cd87e..24aaa12781fc3925dde846a4989db5ff37ef4a12 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/priv.h @@ -131,6 +131,8 @@ void gk104_therm_init(struct nvkm_therm *); void gk104_clkgate_enable(struct nvkm_therm *); void gk104_clkgate_fini(struct nvkm_therm *, bool); +void gm107_clkgate_enable(struct nvkm_therm *); + int nvkm_fanpwm_create(struct nvkm_therm *, struct dcb_gpio_func *); int nvkm_fantog_create(struct nvkm_therm *, struct dcb_gpio_func *); int nvkm_fannil_create(struct nvkm_therm *);