Commit 6c320fef authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: pass flag to engine fini() method on suspend

It may not be necessary to fail in certain cases (such as failing to idle)
on module unload, whereas on suspend it's important to ensure a consistent
state can be restored on resume.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 70ad25ab
......@@ -214,10 +214,13 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
pfifo->unload_context(dev);
for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
if (dev_priv->eng[e]) {
ret = dev_priv->eng[e]->fini(dev, e);
if (ret)
goto out_abort;
if (!dev_priv->eng[e])
continue;
ret = dev_priv->eng[e]->fini(dev, e, true);
if (ret) {
NV_ERROR(dev, "... engine %d failed: %d\n", i, ret);
goto out_abort;
}
}
......
......@@ -312,7 +312,7 @@ struct nouveau_channel {
struct nouveau_exec_engine {
void (*destroy)(struct drm_device *, int engine);
int (*init)(struct drm_device *, int engine);
int (*fini)(struct drm_device *, int engine);
int (*fini)(struct drm_device *, int engine, bool suspend);
int (*context_new)(struct nouveau_channel *, int engine);
void (*context_del)(struct nouveau_channel *, int engine);
int (*object_new)(struct nouveau_channel *, int engine,
......
......@@ -695,7 +695,7 @@ nouveau_card_init(struct drm_device *dev)
for (e = e - 1; e >= 0; e--) {
if (!dev_priv->eng[e])
continue;
dev_priv->eng[e]->fini(dev, e);
dev_priv->eng[e]->fini(dev, e, false);
dev_priv->eng[e]->destroy(dev,e );
}
}
......@@ -747,7 +747,7 @@ static void nouveau_card_takedown(struct drm_device *dev)
engine->fifo.takedown(dev);
for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
if (dev_priv->eng[e]) {
dev_priv->eng[e]->fini(dev, e);
dev_priv->eng[e]->fini(dev, e, false);
dev_priv->eng[e]->destroy(dev,e );
}
}
......
......@@ -538,7 +538,7 @@ nv04_graph_init(struct drm_device *dev, int engine)
}
static int
nv04_graph_fini(struct drm_device *dev, int engine)
nv04_graph_fini(struct drm_device *dev, int engine, bool suspend)
{
nv04_graph_unload_context(dev);
nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
......
......@@ -957,7 +957,7 @@ nv10_graph_init(struct drm_device *dev, int engine)
}
static int
nv10_graph_fini(struct drm_device *dev, int engine)
nv10_graph_fini(struct drm_device *dev, int engine, bool suspend)
{
nv10_graph_unload_context(dev);
nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
......
......@@ -654,7 +654,7 @@ nv30_graph_init(struct drm_device *dev, int engine)
}
int
nv20_graph_fini(struct drm_device *dev, int engine)
nv20_graph_fini(struct drm_device *dev, int engine, bool suspend)
{
nv20_graph_unload_context(dev);
nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
......
......@@ -346,7 +346,7 @@ nv40_graph_init(struct drm_device *dev, int engine)
}
static int
nv40_graph_fini(struct drm_device *dev, int engine)
nv40_graph_fini(struct drm_device *dev, int engine, bool suspend)
{
u32 inst = nv_rd32(dev, 0x40032c);
if (inst & 0x01000000) {
......
......@@ -137,7 +137,7 @@ nv40_mpeg_init(struct drm_device *dev, int engine)
}
static int
nv40_mpeg_fini(struct drm_device *dev, int engine)
nv40_mpeg_fini(struct drm_device *dev, int engine, bool suspend)
{
/*XXX: context save? */
nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000);
......
......@@ -125,7 +125,6 @@ static void
nv50_graph_init_reset(struct drm_device *dev)
{
uint32_t pmc_e = NV_PMC_ENABLE_PGRAPH | (1 << 21);
NV_DEBUG(dev, "\n");
nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & ~pmc_e);
......@@ -255,9 +254,8 @@ nv50_graph_init(struct drm_device *dev, int engine)
}
static int
nv50_graph_fini(struct drm_device *dev, int engine)
nv50_graph_fini(struct drm_device *dev, int engine, bool suspend)
{
NV_DEBUG(dev, "\n");
nv50_graph_unload_context(dev);
nv_wr32(dev, 0x40013c, 0x00000000);
return 0;
......
......@@ -160,7 +160,7 @@ nv50_mpeg_init(struct drm_device *dev, int engine)
}
static int
nv50_mpeg_fini(struct drm_device *dev, int engine)
nv50_mpeg_fini(struct drm_device *dev, int engine, bool suspend)
{
/*XXX: context save for s/r */
nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000);
......
......@@ -138,7 +138,7 @@ nv84_crypt_isr(struct drm_device *dev)
}
static int
nv84_crypt_fini(struct drm_device *dev, int engine)
nv84_crypt_fini(struct drm_device *dev, int engine, bool suspend)
{
nv_wr32(dev, 0x102140, 0x00000000);
return 0;
......
......@@ -140,7 +140,7 @@ nva3_copy_init(struct drm_device *dev, int engine)
}
static int
nva3_copy_fini(struct drm_device *dev, int engine)
nva3_copy_fini(struct drm_device *dev, int engine, bool suspend)
{
nv_mask(dev, 0x104048, 0x00000003, 0x00000000);
......
......@@ -127,7 +127,7 @@ nvc0_copy_init(struct drm_device *dev, int engine)
}
static int
nvc0_copy_fini(struct drm_device *dev, int engine)
nvc0_copy_fini(struct drm_device *dev, int engine, bool suspend)
{
struct nvc0_copy_engine *pcopy = nv_engine(dev, engine);
......
......@@ -304,7 +304,7 @@ nvc0_graph_object_new(struct nouveau_channel *chan, int engine,
}
static int
nvc0_graph_fini(struct drm_device *dev, int engine)
nvc0_graph_fini(struct drm_device *dev, int engine, bool suspend)
{
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment