Commit d6e44a85 authored by Ben Skeggs's avatar Ben Skeggs Committed by Danilo Krummrich

drm/nouveau/nvif: remove route/token

These were a cludge used to prevent userspace's nvif ioctl from
accessing objects created by the kernel for the same client.

That interface was removed in a previous patch, so these are no
longer useful for anything.
Signed-off-by: default avatarBen Skeggs <bskeggs@nvidia.com>
Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240726043828.58966-16-bskeggs@nvidia.com
parent ca6eef9b
...@@ -8,7 +8,6 @@ struct nvif_client { ...@@ -8,7 +8,6 @@ struct nvif_client {
struct nvif_object object; struct nvif_object object;
const struct nvif_driver *driver; const struct nvif_driver *driver;
u64 version; u64 version;
u8 route;
}; };
int nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device, int nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
......
...@@ -15,8 +15,6 @@ struct nvkm_object { ...@@ -15,8 +15,6 @@ struct nvkm_object {
struct list_head head; struct list_head head;
struct list_head tree; struct list_head tree;
u8 route;
u64 token;
u64 object; u64 object;
struct rb_node node; struct rb_node node;
}; };
......
...@@ -21,8 +21,6 @@ struct nvkm_oclass { ...@@ -21,8 +21,6 @@ struct nvkm_oclass {
const void *priv; const void *priv;
const void *engn; const void *engn;
u32 handle; u32 handle;
u8 route;
u64 token;
u64 object; u64 object;
struct nvkm_client *client; struct nvkm_client *client;
struct nvkm_object *parent; struct nvkm_object *parent;
......
...@@ -530,7 +530,6 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) ...@@ -530,7 +530,6 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv); struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv);
struct nouveau_abi16_chan *chan; struct nouveau_abi16_chan *chan;
struct nouveau_abi16_ntfy *ntfy; struct nouveau_abi16_ntfy *ntfy;
struct nvif_client *client;
struct nvif_sclass *sclass; struct nvif_sclass *sclass;
s32 oclass = 0; s32 oclass = 0;
int ret, i; int ret, i;
...@@ -540,7 +539,6 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) ...@@ -540,7 +539,6 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
if (init->handle == ~0) if (init->handle == ~0)
return nouveau_abi16_put(abi16, -EINVAL); return nouveau_abi16_put(abi16, -EINVAL);
client = &abi16->cli->base;
chan = nouveau_abi16_chan(abi16, init->channel); chan = nouveau_abi16_chan(abi16, init->channel);
if (!chan) if (!chan)
...@@ -605,10 +603,8 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS) ...@@ -605,10 +603,8 @@ nouveau_abi16_ioctl_grobj_alloc(ABI16_IOCTL_ARGS)
list_add(&ntfy->head, &chan->notifiers); list_add(&ntfy->head, &chan->notifiers);
client->route = NVDRM_OBJECT_ABI16;
ret = nvif_object_ctor(&chan->chan->user, "abi16EngObj", init->handle, ret = nvif_object_ctor(&chan->chan->user, "abi16EngObj", init->handle,
oclass, NULL, 0, &ntfy->object); oclass, NULL, 0, &ntfy->object);
client->route = NVDRM_OBJECT_NVIF;
if (ret) if (ret)
nouveau_abi16_ntfy_fini(chan, ntfy); nouveau_abi16_ntfy_fini(chan, ntfy);
...@@ -624,7 +620,6 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -624,7 +620,6 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
struct nouveau_abi16_chan *chan; struct nouveau_abi16_chan *chan;
struct nouveau_abi16_ntfy *ntfy; struct nouveau_abi16_ntfy *ntfy;
struct nvif_device *device; struct nvif_device *device;
struct nvif_client *client;
struct nv_dma_v0 args = {}; struct nv_dma_v0 args = {};
int ret; int ret;
...@@ -635,7 +630,6 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -635,7 +630,6 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
/* completely unnecessary for these chipsets... */ /* completely unnecessary for these chipsets... */
if (unlikely(device->info.family >= NV_DEVICE_INFO_V0_FERMI)) if (unlikely(device->info.family >= NV_DEVICE_INFO_V0_FERMI))
return nouveau_abi16_put(abi16, -EINVAL); return nouveau_abi16_put(abi16, -EINVAL);
client = &abi16->cli->base;
chan = nouveau_abi16_chan(abi16, info->channel); chan = nouveau_abi16_chan(abi16, info->channel);
if (!chan) if (!chan)
...@@ -672,11 +666,9 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) ...@@ -672,11 +666,9 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
args.limit += chan->ntfy->offset; args.limit += chan->ntfy->offset;
} }
client->route = NVDRM_OBJECT_ABI16;
ret = nvif_object_ctor(&chan->chan->user, "abi16Ntfy", info->handle, ret = nvif_object_ctor(&chan->chan->user, "abi16Ntfy", info->handle,
NV_DMA_IN_MEMORY, &args, sizeof(args), NV_DMA_IN_MEMORY, &args, sizeof(args),
&ntfy->object); &ntfy->object);
client->route = NVDRM_OBJECT_NVIF;
if (ret) if (ret)
goto done; goto done;
......
...@@ -79,7 +79,6 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device, ...@@ -79,7 +79,6 @@ nvif_client_ctor(struct nvif_client *parent, const char *name, u64 device,
client->object.client = client; client->object.client = client;
client->object.handle = ~0; client->object.handle = ~0;
client->route = NVIF_IOCTL_V0_ROUTE_NVIF;
client->driver = parent->driver; client->driver = parent->driver;
if (ret == 0) { if (ret == 0) {
......
...@@ -40,7 +40,6 @@ nvif_object_ioctl(struct nvif_object *object, void *data, u32 size, void **hack) ...@@ -40,7 +40,6 @@ nvif_object_ioctl(struct nvif_object *object, void *data, u32 size, void **hack)
args->v0.object = nvif_handle(object); args->v0.object = nvif_handle(object);
else else
args->v0.object = 0; args->v0.object = 0;
args->v0.owner = NVIF_IOCTL_V0_OWNER_ANY;
} else } else
return -ENOSYS; return -ENOSYS;
...@@ -286,8 +285,6 @@ nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle, ...@@ -286,8 +285,6 @@ nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle,
args->ioctl.version = 0; args->ioctl.version = 0;
args->ioctl.type = NVIF_IOCTL_V0_NEW; args->ioctl.type = NVIF_IOCTL_V0_NEW;
args->new.version = 0; args->new.version = 0;
args->new.route = parent->client->route;
args->new.token = nvif_handle(object);
args->new.object = nvif_handle(object); args->new.object = nvif_handle(object);
args->new.handle = handle; args->new.handle = handle;
args->new.oclass = oclass; args->new.oclass = oclass;
......
...@@ -51,8 +51,6 @@ nvkm_uclient_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, ...@@ -51,8 +51,6 @@ nvkm_uclient_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
client->object.client = oclass->client; client->object.client = oclass->client;
client->object.handle = oclass->handle; client->object.handle = oclass->handle;
client->object.route = oclass->route;
client->object.token = oclass->token;
client->object.object = oclass->object; client->object.object = oclass->object;
client->debug = oclass->client->debug; client->debug = oclass->client->debug;
*pobject = &client->object; *pobject = &client->object;
......
...@@ -112,10 +112,9 @@ nvkm_ioctl_new(struct nvkm_client *client, ...@@ -112,10 +112,9 @@ nvkm_ioctl_new(struct nvkm_client *client,
nvif_ioctl(parent, "new size %d\n", size); nvif_ioctl(parent, "new size %d\n", size);
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
nvif_ioctl(parent, "new vers %d handle %08x class %08x " nvif_ioctl(parent, "new vers %d handle %08x class %08x object %016llx\n",
"route %02x token %llx object %016llx\n",
args->v0.version, args->v0.handle, args->v0.oclass, args->v0.version, args->v0.handle, args->v0.oclass,
args->v0.route, args->v0.token, args->v0.object); args->v0.object);
} else } else
return ret; return ret;
...@@ -127,8 +126,6 @@ nvkm_ioctl_new(struct nvkm_client *client, ...@@ -127,8 +126,6 @@ nvkm_ioctl_new(struct nvkm_client *client,
do { do {
memset(&oclass, 0x00, sizeof(oclass)); memset(&oclass, 0x00, sizeof(oclass));
oclass.handle = args->v0.handle; oclass.handle = args->v0.handle;
oclass.route = args->v0.route;
oclass.token = args->v0.token;
oclass.object = args->v0.object; oclass.object = args->v0.object;
oclass.client = client; oclass.client = client;
oclass.parent = parent; oclass.parent = parent;
...@@ -331,7 +328,7 @@ nvkm_ioctl_v0[] = { ...@@ -331,7 +328,7 @@ nvkm_ioctl_v0[] = {
static int static int
nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type, nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type,
void *data, u32 size, u8 owner, u8 *route, u64 *token) void *data, u32 size)
{ {
struct nvkm_object *object; struct nvkm_object *object;
int ret; int ret;
...@@ -342,13 +339,6 @@ nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type, ...@@ -342,13 +339,6 @@ nvkm_ioctl_path(struct nvkm_client *client, u64 handle, u32 type,
return PTR_ERR(object); return PTR_ERR(object);
} }
if (owner != NVIF_IOCTL_V0_OWNER_ANY && owner != object->route) {
nvif_ioctl(&client->object, "route != owner\n");
return -EACCES;
}
*route = object->route;
*token = object->token;
if (ret = -EINVAL, type < ARRAY_SIZE(nvkm_ioctl_v0)) { if (ret = -EINVAL, type < ARRAY_SIZE(nvkm_ioctl_v0)) {
if (nvkm_ioctl_v0[type].version == 0) if (nvkm_ioctl_v0[type].version == 0)
ret = nvkm_ioctl_v0[type].func(client, object, data, size); ret = nvkm_ioctl_v0[type].func(client, object, data, size);
...@@ -374,8 +364,7 @@ nvkm_ioctl(struct nvkm_client *client, void *data, u32 size, void **hack) ...@@ -374,8 +364,7 @@ nvkm_ioctl(struct nvkm_client *client, void *data, u32 size, void **hack)
args->v0.version, args->v0.type, args->v0.object, args->v0.version, args->v0.type, args->v0.object,
args->v0.owner); args->v0.owner);
ret = nvkm_ioctl_path(client, args->v0.object, args->v0.type, ret = nvkm_ioctl_path(client, args->v0.object, args->v0.type,
data, size, args->v0.owner, data, size);
&args->v0.route, &args->v0.token);
} }
if (ret != 1) { if (ret != 1) {
......
...@@ -313,8 +313,6 @@ nvkm_object_ctor(const struct nvkm_object_func *func, ...@@ -313,8 +313,6 @@ nvkm_object_ctor(const struct nvkm_object_func *func,
object->engine = nvkm_engine_ref(oclass->engine); object->engine = nvkm_engine_ref(oclass->engine);
object->oclass = oclass->base.oclass; object->oclass = oclass->base.oclass;
object->handle = oclass->handle; object->handle = oclass->handle;
object->route = oclass->route;
object->token = oclass->token;
object->object = oclass->object; object->object = oclass->object;
INIT_LIST_HEAD(&object->head); INIT_LIST_HEAD(&object->head);
INIT_LIST_HEAD(&object->tree); INIT_LIST_HEAD(&object->tree);
......
...@@ -116,9 +116,9 @@ nvkm_uevent_ntfy(struct nvkm_event_ntfy *ntfy, u32 bits) ...@@ -116,9 +116,9 @@ nvkm_uevent_ntfy(struct nvkm_event_ntfy *ntfy, u32 bits)
struct nvkm_client *client = uevent->object.client; struct nvkm_client *client = uevent->object.client;
if (uevent->func) if (uevent->func)
return uevent->func(uevent->parent, uevent->object.token, bits); return uevent->func(uevent->parent, uevent->object.object, bits);
return client->event(uevent->object.token, NULL, 0); return client->event(uevent->object.object, NULL, 0);
} }
int int
......
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