summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-06-12 18:58:05 +1000
committerBen Skeggs <bskeggs@redhat.com>2014-08-05 09:08:28 +1000
commita0a60433f8e0f159077d59f5e4cbfc77f0f65606 (patch)
tree24e824112a6df143a29c8e38c653ee30db4f4ba8
parente14f7973e0a85352425393f9f9ffc2dc646c25b5 (diff)
downloadnouveau-a0a60433f8e0f159077d59f5e4cbfc77f0f65606.tar.gz
pwr/gk104: implement PGOB disable method
As documented at: ftp://download.nvidia.com/open-gpu-doc/gk104-disable-graphics-power-gating/1/gk104-disable-graphics-power-gating.txt NVIDIA were not able document the steps necessary to detect whether this is required or not at this time. However, they did confirm that this procedure is safe to perform unconditionally on GK104/6. GK107 does not have the power gating feature, and it was recommended that we do not perform these steps there as the effects were not verified. The disable path is from observing the binary driver, and not documented in the link above. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drm/Kbuild1
l---------drm/core/subdev/pwr/gk104.c1
-rw-r--r--nvkm/engine/device/nve0.c4
-rw-r--r--nvkm/include/subdev/pwr.h4
-rw-r--r--nvkm/subdev/pwr/Makefile.am1
-rw-r--r--nvkm/subdev/pwr/base.c9
-rw-r--r--nvkm/subdev/pwr/gk104.c69
-rw-r--r--nvkm/subdev/pwr/priv.h2
8 files changed, 88 insertions, 3 deletions
diff --git a/drm/Kbuild b/drm/Kbuild
index 8b307e143..8f0dd8e32 100644
--- a/drm/Kbuild
+++ b/drm/Kbuild
@@ -169,6 +169,7 @@ nouveau-y += core/subdev/pwr/memx.o
nouveau-y += core/subdev/pwr/nva3.o
nouveau-y += core/subdev/pwr/nvc0.o
nouveau-y += core/subdev/pwr/nvd0.o
+nouveau-y += core/subdev/pwr/gk104.o
nouveau-y += core/subdev/pwr/nv108.o
nouveau-y += core/subdev/therm/base.o
nouveau-y += core/subdev/therm/fan.o
diff --git a/drm/core/subdev/pwr/gk104.c b/drm/core/subdev/pwr/gk104.c
new file mode 120000
index 000000000..897396805
--- /dev/null
+++ b/drm/core/subdev/pwr/gk104.c
@@ -0,0 +1 @@
+../../../../nvkm/subdev/pwr/gk104.c \ No newline at end of file
diff --git a/nvkm/engine/device/nve0.c b/nvkm/engine/device/nve0.c
index e8958048f..7298438f9 100644
--- a/nvkm/engine/device/nve0.c
+++ b/nvkm/engine/device/nve0.c
@@ -75,7 +75,7 @@ nve0_identify(struct nouveau_device *device)
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_SUBDEV_PWR ] = nvd0_pwr_oclass;
+ device->oclass[NVDEV_SUBDEV_PWR ] = gk104_pwr_oclass;
device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass;
@@ -141,7 +141,7 @@ nve0_identify(struct nouveau_device *device)
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_SUBDEV_PWR ] = nvd0_pwr_oclass;
+ device->oclass[NVDEV_SUBDEV_PWR ] = gk104_pwr_oclass;
device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass;
device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
device->oclass[NVDEV_ENGINE_FIFO ] = nve0_fifo_oclass;
diff --git a/nvkm/include/subdev/pwr.h b/nvkm/include/subdev/pwr.h
index edf11182e..f73feec15 100644
--- a/nvkm/include/subdev/pwr.h
+++ b/nvkm/include/subdev/pwr.h
@@ -23,7 +23,8 @@ struct nouveau_pwr {
u32 data[2];
} recv;
- int (*message)(struct nouveau_pwr *, u32[2], u32, u32, u32, u32);
+ int (*message)(struct nouveau_pwr *, u32[2], u32, u32, u32, u32);
+ void (*pgob)(struct nouveau_pwr *, bool);
};
static inline struct nouveau_pwr *
@@ -35,6 +36,7 @@ nouveau_pwr(void *obj)
extern struct nouveau_oclass *nva3_pwr_oclass;
extern struct nouveau_oclass *nvc0_pwr_oclass;
extern struct nouveau_oclass *nvd0_pwr_oclass;
+extern struct nouveau_oclass *gk104_pwr_oclass;
extern struct nouveau_oclass *nv108_pwr_oclass;
/* interface to MEMX process running on PPWR */
diff --git a/nvkm/subdev/pwr/Makefile.am b/nvkm/subdev/pwr/Makefile.am
index c5ae6ea43..335deccad 100644
--- a/nvkm/subdev/pwr/Makefile.am
+++ b/nvkm/subdev/pwr/Makefile.am
@@ -11,6 +11,7 @@ libpwr_la_SOURCES = base.c \
nva3.c \
nvc0.c \
nvd0.c \
+ gk104.c \
nv108.c
FUC_COMMON = fuc/os.h \
diff --git a/nvkm/subdev/pwr/base.c b/nvkm/subdev/pwr/base.c
index 12baf8151..69f1f34f6 100644
--- a/nvkm/subdev/pwr/base.c
+++ b/nvkm/subdev/pwr/base.c
@@ -26,6 +26,14 @@
#include "priv.h"
+static void
+nouveau_pwr_pgob(struct nouveau_pwr *ppwr, bool enable)
+{
+ const struct nvkm_pwr_impl *impl = (void *)nv_oclass(ppwr);
+ if (impl->pgob)
+ impl->pgob(ppwr, enable);
+}
+
static int
nouveau_pwr_send(struct nouveau_pwr *ppwr, u32 reply[2],
u32 process, u32 message, u32 data0, u32 data1)
@@ -188,6 +196,7 @@ _nouveau_pwr_init(struct nouveau_object *object)
nv_subdev(ppwr)->intr = nouveau_pwr_intr;
ppwr->message = nouveau_pwr_send;
+ ppwr->pgob = nouveau_pwr_pgob;
/* prevent previous ucode from running, wait for idle, reset */
nv_wr32(ppwr, 0x10a014, 0x0000ffff); /* INTR_EN_CLR = ALL */
diff --git a/nvkm/subdev/pwr/gk104.c b/nvkm/subdev/pwr/gk104.c
new file mode 100644
index 000000000..d76612999
--- /dev/null
+++ b/nvkm/subdev/pwr/gk104.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2013 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: Ben Skeggs
+ */
+
+#include "priv.h"
+
+#define nvd0_pwr_code gk104_pwr_code
+#define nvd0_pwr_data gk104_pwr_data
+#include "fuc/nvd0.fuc.h"
+
+static void
+gk104_pwr_pgob(struct nouveau_pwr *ppwr, bool enable)
+{
+ nv_mask(ppwr, 0x000200, 0x00001000, 0x00000000);
+ nv_rd32(ppwr, 0x000200);
+ nv_mask(ppwr, 0x000200, 0x08000000, 0x08000000);
+ msleep(50);
+
+ nv_mask(ppwr, 0x10a78c, 0x00000002, 0x00000002);
+ nv_mask(ppwr, 0x10a78c, 0x00000001, 0x00000001);
+ nv_mask(ppwr, 0x10a78c, 0x00000001, 0x00000000);
+
+ nv_mask(ppwr, 0x020004, 0xc0000000, enable ? 0xc0000000 : 0x40000000);
+ msleep(50);
+
+ nv_mask(ppwr, 0x10a78c, 0x00000002, 0x00000000);
+ nv_mask(ppwr, 0x10a78c, 0x00000001, 0x00000001);
+ nv_mask(ppwr, 0x10a78c, 0x00000001, 0x00000000);
+
+ nv_mask(ppwr, 0x000200, 0x08000000, 0x00000000);
+ nv_mask(ppwr, 0x000200, 0x00001000, 0x00001000);
+ nv_rd32(ppwr, 0x000200);
+}
+
+struct nouveau_oclass *
+gk104_pwr_oclass = &(struct nvkm_pwr_impl) {
+ .base.handle = NV_SUBDEV(PWR, 0xe4),
+ .base.ofuncs = &(struct nouveau_ofuncs) {
+ .ctor = _nouveau_pwr_ctor,
+ .dtor = _nouveau_pwr_dtor,
+ .init = _nouveau_pwr_init,
+ .fini = _nouveau_pwr_fini,
+ },
+ .code.data = gk104_pwr_code,
+ .code.size = sizeof(gk104_pwr_code),
+ .data.data = gk104_pwr_data,
+ .data.size = sizeof(gk104_pwr_data),
+ .pgob = gk104_pwr_pgob,
+}.base;
diff --git a/nvkm/subdev/pwr/priv.h b/nvkm/subdev/pwr/priv.h
index ddc614f9a..3814a341d 100644
--- a/nvkm/subdev/pwr/priv.h
+++ b/nvkm/subdev/pwr/priv.h
@@ -37,6 +37,8 @@ struct nvkm_pwr_impl {
u32 *data;
u32 size;
} data;
+
+ void (*pgob)(struct nouveau_pwr *, bool);
};
#endif