|
27 | 27 | #include <core/memory.h> |
28 | 28 | #include <subdev/bar.h> |
29 | 29 | #include <subdev/fb.h> |
| 30 | +#include <subdev/gsp.h> |
30 | 31 | #include <subdev/mmu.h> |
31 | 32 |
|
32 | 33 | struct nv50_instmem { |
@@ -394,24 +395,44 @@ nv50_instmem_fini(struct nvkm_instmem *base) |
394 | 395 | nv50_instmem(base)->addr = ~0ULL; |
395 | 396 | } |
396 | 397 |
|
| 398 | +static void * |
| 399 | +nv50_instmem_dtor(struct nvkm_instmem *base) |
| 400 | +{ |
| 401 | + return nv50_instmem(base); |
| 402 | +} |
| 403 | + |
397 | 404 | static const struct nvkm_instmem_func |
398 | 405 | nv50_instmem = { |
| 406 | + .dtor = nv50_instmem_dtor, |
399 | 407 | .fini = nv50_instmem_fini, |
| 408 | + .suspend = nv04_instmem_suspend, |
| 409 | + .resume = nv04_instmem_resume, |
400 | 410 | .memory_new = nv50_instobj_new, |
401 | 411 | .memory_wrap = nv50_instobj_wrap, |
402 | 412 | .zero = false, |
403 | 413 | }; |
404 | 414 |
|
405 | 415 | int |
406 | | -nv50_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, |
407 | | - struct nvkm_instmem **pimem) |
| 416 | +nv50_instmem_new_(const struct nvkm_instmem_func *func, |
| 417 | + struct nvkm_device *device, enum nvkm_subdev_type type, int inst, |
| 418 | + struct nvkm_instmem **pimem) |
408 | 419 | { |
409 | 420 | struct nv50_instmem *imem; |
410 | 421 |
|
411 | 422 | if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL))) |
412 | 423 | return -ENOMEM; |
413 | | - nvkm_instmem_ctor(&nv50_instmem, device, type, inst, &imem->base); |
| 424 | + nvkm_instmem_ctor(func, device, type, inst, &imem->base); |
414 | 425 | INIT_LIST_HEAD(&imem->lru); |
415 | 426 | *pimem = &imem->base; |
416 | 427 | return 0; |
417 | 428 | } |
| 429 | + |
| 430 | +int |
| 431 | +nv50_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, |
| 432 | + struct nvkm_instmem **pimem) |
| 433 | +{ |
| 434 | + if (nvkm_gsp_rm(device->gsp)) |
| 435 | + return -ENODEV; |
| 436 | + |
| 437 | + return nv50_instmem_new_(&nv50_instmem, device, type, inst, pimem); |
| 438 | +} |
0 commit comments