Commit 8e0042d5 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/core/object: plumb the unmap ioctl through

MMU will be using this for BAR mappings.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 01326050
...@@ -32,6 +32,7 @@ struct nvkm_object_func { ...@@ -32,6 +32,7 @@ struct nvkm_object_func {
int (*ntfy)(struct nvkm_object *, u32 mthd, struct nvkm_event **); int (*ntfy)(struct nvkm_object *, u32 mthd, struct nvkm_event **);
int (*map)(struct nvkm_object *, void *argv, u32 argc, int (*map)(struct nvkm_object *, void *argv, u32 argc,
enum nvkm_object_map *, u64 *addr, u64 *size); enum nvkm_object_map *, u64 *addr, u64 *size);
int (*unmap)(struct nvkm_object *);
int (*rd08)(struct nvkm_object *, u64 addr, u8 *data); int (*rd08)(struct nvkm_object *, u64 addr, u8 *data);
int (*rd16)(struct nvkm_object *, u64 addr, u16 *data); int (*rd16)(struct nvkm_object *, u64 addr, u16 *data);
int (*rd32)(struct nvkm_object *, u64 addr, u32 *data); int (*rd32)(struct nvkm_object *, u64 addr, u32 *data);
...@@ -58,6 +59,7 @@ int nvkm_object_mthd(struct nvkm_object *, u32 mthd, void *data, u32 size); ...@@ -58,6 +59,7 @@ int nvkm_object_mthd(struct nvkm_object *, u32 mthd, void *data, u32 size);
int nvkm_object_ntfy(struct nvkm_object *, u32 mthd, struct nvkm_event **); int nvkm_object_ntfy(struct nvkm_object *, u32 mthd, struct nvkm_event **);
int nvkm_object_map(struct nvkm_object *, void *argv, u32 argc, int nvkm_object_map(struct nvkm_object *, void *argv, u32 argc,
enum nvkm_object_map *, u64 *addr, u64 *size); enum nvkm_object_map *, u64 *addr, u64 *size);
int nvkm_object_unmap(struct nvkm_object *);
int nvkm_object_rd08(struct nvkm_object *, u64 addr, u8 *data); int nvkm_object_rd08(struct nvkm_object *, u64 addr, u8 *data);
int nvkm_object_rd16(struct nvkm_object *, u64 addr, u16 *data); int nvkm_object_rd16(struct nvkm_object *, u64 addr, u16 *data);
int nvkm_object_rd32(struct nvkm_object *, u64 addr, u32 *data); int nvkm_object_rd32(struct nvkm_object *, u64 addr, u32 *data);
......
...@@ -287,6 +287,7 @@ nvkm_ioctl_unmap(struct nvkm_client *client, ...@@ -287,6 +287,7 @@ nvkm_ioctl_unmap(struct nvkm_client *client,
nvif_ioctl(object, "unmap size %d\n", size); nvif_ioctl(object, "unmap size %d\n", size);
if (!(ret = nvif_unvers(ret, &data, &size, args->none))) { if (!(ret = nvif_unvers(ret, &data, &size, args->none))) {
nvif_ioctl(object, "unmap\n"); nvif_ioctl(object, "unmap\n");
ret = nvkm_object_unmap(object);
} }
return ret; return ret;
......
...@@ -110,6 +110,14 @@ nvkm_object_map(struct nvkm_object *object, void *argv, u32 argc, ...@@ -110,6 +110,14 @@ nvkm_object_map(struct nvkm_object *object, void *argv, u32 argc,
return -ENODEV; return -ENODEV;
} }
int
nvkm_object_unmap(struct nvkm_object *object)
{
if (likely(object->func->unmap))
return object->func->unmap(object);
return -ENODEV;
}
int int
nvkm_object_rd08(struct nvkm_object *object, u64 addr, u8 *data) nvkm_object_rd08(struct nvkm_object *object, u64 addr, u8 *data)
{ {
...@@ -260,6 +268,7 @@ nvkm_object_dtor(struct nvkm_object *object) ...@@ -260,6 +268,7 @@ nvkm_object_dtor(struct nvkm_object *object)
} }
nvif_debug(object, "destroy running...\n"); nvif_debug(object, "destroy running...\n");
nvkm_object_unmap(object);
if (object->func->dtor) if (object->func->dtor)
data = object->func->dtor(object); data = object->func->dtor(object);
nvkm_engine_unref(&object->engine); nvkm_engine_unref(&object->engine);
......
...@@ -44,6 +44,12 @@ nvkm_oproxy_map(struct nvkm_object *object, void *argv, u32 argc, ...@@ -44,6 +44,12 @@ nvkm_oproxy_map(struct nvkm_object *object, void *argv, u32 argc,
return nvkm_object_map(oproxy->object, argv, argc, type, addr, size); return nvkm_object_map(oproxy->object, argv, argc, type, addr, size);
} }
static int
nvkm_oproxy_unmap(struct nvkm_object *object)
{
return nvkm_object_unmap(nvkm_oproxy(object)->object);
}
static int static int
nvkm_oproxy_rd08(struct nvkm_object *object, u64 addr, u8 *data) nvkm_oproxy_rd08(struct nvkm_object *object, u64 addr, u8 *data)
{ {
...@@ -173,6 +179,7 @@ nvkm_oproxy_func = { ...@@ -173,6 +179,7 @@ nvkm_oproxy_func = {
.mthd = nvkm_oproxy_mthd, .mthd = nvkm_oproxy_mthd,
.ntfy = nvkm_oproxy_ntfy, .ntfy = nvkm_oproxy_ntfy,
.map = nvkm_oproxy_map, .map = nvkm_oproxy_map,
.unmap = nvkm_oproxy_unmap,
.rd08 = nvkm_oproxy_rd08, .rd08 = nvkm_oproxy_rd08,
.rd16 = nvkm_oproxy_rd16, .rd16 = nvkm_oproxy_rd16,
.rd32 = nvkm_oproxy_rd32, .rd32 = nvkm_oproxy_rd32,
......
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