Commit 5025407b authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/core: namespace + nvidia gpu names (no binary change)



The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver.  This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).

Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.

A comparison of objdump disassemblies proves no code changes.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 989aa5b7
#ifndef __NOUVEAU_CLIENT_H__
#define __NOUVEAU_CLIENT_H__
#ifndef __NVKM_CLIENT_H__
#define __NVKM_CLIENT_H__
#include <core/namedb.h>
struct nouveau_client {
struct nouveau_namedb namedb;
struct nouveau_handle *root;
struct nouveau_object *device;
struct nvkm_client {
struct nvkm_namedb namedb;
struct nvkm_handle *root;
struct nvkm_object *device;
char name[32];
u32 debug;
struct nouveau_vm *vm;
struct nvkm_vm *vm;
bool super;
void *data;
......@@ -17,7 +16,7 @@ struct nouveau_client {
struct nvkm_client_notify *notify[16];
};
static inline struct nouveau_client *
static inline struct nvkm_client *
nv_client(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
......@@ -27,31 +26,30 @@ nv_client(void *obj)
return obj;
}
static inline struct nouveau_client *
nouveau_client(void *obj)
static inline struct nvkm_client *
nvkm_client(void *obj)
{
struct nouveau_object *client = nv_object(obj);
struct nvkm_object *client = nv_object(obj);
while (client && !(nv_iclass(client, NV_CLIENT_CLASS)))
client = client->parent;
return (void *)client;
}
#define nouveau_client_create(n,c,oc,od,d) \
nouveau_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
#define nvkm_client_create(n,c,oc,od,d) \
nvkm_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
int nouveau_client_create_(const char *name, u64 device, const char *cfg,
int nvkm_client_create_(const char *name, u64 device, const char *cfg,
const char *dbg, int, void **);
#define nouveau_client_destroy(p) \
nouveau_namedb_destroy(&(p)->base)
#define nvkm_client_destroy(p) \
nvkm_namedb_destroy(&(p)->base)
int nouveau_client_init(struct nouveau_client *);
int nouveau_client_fini(struct nouveau_client *, bool suspend);
const char *nouveau_client_name(void *obj);
int nvkm_client_init(struct nvkm_client *);
int nvkm_client_fini(struct nvkm_client *, bool suspend);
const char *nvkm_client_name(void *obj);
int nvkm_client_notify_new(struct nouveau_object *, struct nvkm_event *,
int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
void *data, u32 size);
int nvkm_client_notify_del(struct nouveau_client *, int index);
int nvkm_client_notify_get(struct nouveau_client *, int index);
int nvkm_client_notify_put(struct nouveau_client *, int index);
int nvkm_client_notify_del(struct nvkm_client *, int index);
int nvkm_client_notify_get(struct nvkm_client *, int index);
int nvkm_client_notify_put(struct nvkm_client *, int index);
#endif
#ifndef __NOUVEAU_DEBUG_H__
#define __NOUVEAU_DEBUG_H__
#ifndef __NVKM_DEBUG_H__
#define __NVKM_DEBUG_H__
extern int nv_info_debug_level;
#define NV_DBG_FATAL 0
......@@ -16,5 +15,4 @@ extern int nv_info_debug_level;
#define NV_DBG_INFO_SILENT NV_DBG_DEBUG
#define nv_debug_level(a) nv_info_debug_level = NV_DBG_INFO_##a
#endif
#ifndef __NOUVEAU_DEVICE_H__
#define __NOUVEAU_DEVICE_H__
#include <core/object.h>
#include <core/subdev.h>
#ifndef __NVKM_DEVICE_H__
#define __NVKM_DEVICE_H__
#include <core/engine.h>
#include <core/event.h>
struct nouveau_device {
struct nouveau_engine engine;
struct nvkm_device {
struct nvkm_engine engine;
struct list_head head;
struct pci_dev *pdev;
......@@ -38,53 +35,53 @@ struct nouveau_device {
u8 chiprev;
u32 crystal;
struct nouveau_oclass *oclass[NVDEV_SUBDEV_NR];
struct nouveau_object *subdev[NVDEV_SUBDEV_NR];
struct nvkm_oclass *oclass[NVDEV_SUBDEV_NR];
struct nvkm_object *subdev[NVDEV_SUBDEV_NR];
struct {
struct notifier_block nb;
} acpi;
};
int nouveau_device_list(u64 *name, int size);
struct nvkm_device *nvkm_device_find(u64 name);
int nvkm_device_list(u64 *name, int size);
struct nouveau_device *nv_device(void *obj);
struct nvkm_device *nv_device(void *obj);
static inline bool
nv_device_match(struct nouveau_object *object, u16 dev, u16 ven, u16 sub)
nv_device_match(struct nvkm_object *object, u16 dev, u16 ven, u16 sub)
{
struct nouveau_device *device = nv_device(object);
struct nvkm_device *device = nv_device(object);
return device->pdev->device == dev &&
device->pdev->subsystem_vendor == ven &&
device->pdev->subsystem_device == sub;
}
static inline bool
nv_device_is_pci(struct nouveau_device *device)
nv_device_is_pci(struct nvkm_device *device)
{
return device->pdev != NULL;
}
static inline bool
nv_device_is_cpu_coherent(struct nouveau_device *device)
nv_device_is_cpu_coherent(struct nvkm_device *device)
{
return (!IS_ENABLED(CONFIG_ARM) && nv_device_is_pci(device));
}
static inline struct device *
nv_device_base(struct nouveau_device *device)
nv_device_base(struct nvkm_device *device)
{
return nv_device_is_pci(device) ? &device->pdev->dev :
&device->platformdev->dev;
}
resource_size_t
nv_device_resource_start(struct nouveau_device *device, unsigned int bar);
nv_device_resource_start(struct nvkm_device *device, unsigned int bar);
resource_size_t
nv_device_resource_len(struct nouveau_device *device, unsigned int bar);
nv_device_resource_len(struct nvkm_device *device, unsigned int bar);
int
nv_device_get_irq(struct nouveau_device *device, bool stall);
nv_device_get_irq(struct nvkm_device *device, bool stall);
#endif
#ifndef __NOUVEAU_ENGCTX_H__
#define __NOUVEAU_ENGCTX_H__
#include <core/object.h>
#ifndef __NVKM_ENGCTX_H__
#define __NVKM_ENGCTX_H__
#include <core/gpuobj.h>
#include <subdev/mmu.h>
......@@ -9,15 +7,15 @@
#define NV_ENGCTX_(eng,var) (NV_ENGCTX_CLASS | ((var) << 8) | (eng))
#define NV_ENGCTX(name,var) NV_ENGCTX_(NVDEV_ENGINE_##name, (var))
struct nouveau_engctx {
struct nouveau_gpuobj gpuobj;
struct nouveau_vma vma;
struct nvkm_engctx {
struct nvkm_gpuobj gpuobj;
struct nvkm_vma vma;
struct list_head head;
unsigned long save;
u64 addr;
};
static inline struct nouveau_engctx *
static inline struct nvkm_engctx *
nv_engctx(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
......@@ -27,28 +25,27 @@ nv_engctx(void *obj)
return obj;
}
#define nouveau_engctx_create(p,e,c,g,s,a,f,d) \
nouveau_engctx_create_((p), (e), (c), (g), (s), (a), (f), \
#define nvkm_engctx_create(p,e,c,g,s,a,f,d) \
nvkm_engctx_create_((p), (e), (c), (g), (s), (a), (f), \
sizeof(**d), (void **)d)
int nouveau_engctx_create_(struct nouveau_object *, struct nouveau_object *,
struct nouveau_oclass *, struct nouveau_object *,
int nvkm_engctx_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, struct nvkm_object *,
u32 size, u32 align, u32 flags,
int length, void **data);
void nouveau_engctx_destroy(struct nouveau_engctx *);
int nouveau_engctx_init(struct nouveau_engctx *);
int nouveau_engctx_fini(struct nouveau_engctx *, bool suspend);
int _nouveau_engctx_ctor(struct nouveau_object *, struct nouveau_object *,
struct nouveau_oclass *, void *, u32,
struct nouveau_object **);
void _nouveau_engctx_dtor(struct nouveau_object *);
int _nouveau_engctx_init(struct nouveau_object *);
int _nouveau_engctx_fini(struct nouveau_object *, bool suspend);
#define _nouveau_engctx_rd32 _nouveau_gpuobj_rd32
#define _nouveau_engctx_wr32 _nouveau_gpuobj_wr32
struct nouveau_object *nouveau_engctx_get(struct nouveau_engine *, u64 addr);
void nouveau_engctx_put(struct nouveau_object *);
void nvkm_engctx_destroy(struct nvkm_engctx *);
int nvkm_engctx_init(struct nvkm_engctx *);
int nvkm_engctx_fini(struct nvkm_engctx *, bool suspend);
int _nvkm_engctx_ctor(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, void *, u32,
struct nvkm_object **);
void _nvkm_engctx_dtor(struct nvkm_object *);
int _nvkm_engctx_init(struct nvkm_object *);
int _nvkm_engctx_fini(struct nvkm_object *, bool suspend);
#define _nvkm_engctx_rd32 _nvkm_gpuobj_rd32
#define _nvkm_engctx_wr32 _nvkm_gpuobj_wr32
struct nvkm_object *nvkm_engctx_get(struct nvkm_engine *, u64 addr);
void nvkm_engctx_put(struct nvkm_object *);
#endif
#ifndef __NOUVEAU_ENGINE_H__
#define __NOUVEAU_ENGINE_H__
#include <core/object.h>
#ifndef __NVKM_ENGINE_H__
#define __NVKM_ENGINE_H__
#include <core/subdev.h>
#define NV_ENGINE_(eng,var) (NV_ENGINE_CLASS | ((var) << 8) | (eng))
#define NV_ENGINE(name,var) NV_ENGINE_(NVDEV_ENGINE_##name, (var))
struct nouveau_engine {
struct nouveau_subdev subdev;
struct nouveau_oclass *cclass;
struct nouveau_oclass *sclass;
struct nvkm_engine {
struct nvkm_subdev subdev;
struct nvkm_oclass *cclass;
struct nvkm_oclass *sclass;
struct list_head contexts;
spinlock_t lock;
void (*tile_prog)(struct nouveau_engine *, int region);
int (*tlb_flush)(struct nouveau_engine *);
void (*tile_prog)(struct nvkm_engine *, int region);
int (*tlb_flush)(struct nvkm_engine *);
};
static inline struct nouveau_engine *
static inline struct nvkm_engine *
nv_engine(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
......@@ -30,30 +28,29 @@ nv_engine(void *obj)
}
static inline int
nv_engidx(struct nouveau_engine *engine)
nv_engidx(struct nvkm_engine *engine)
{
return nv_subidx(&engine->subdev);
}
struct nouveau_engine *nouveau_engine(void *obj, int idx);
struct nvkm_engine *nvkm_engine(void *obj, int idx);
#define nouveau_engine_create(p,e,c,d,i,f,r) \
nouveau_engine_create_((p), (e), (c), (d), (i), (f), \
#define nvkm_engine_create(p,e,c,d,i,f,r) \
nvkm_engine_create_((p), (e), (c), (d), (i), (f), \
sizeof(**r),(void **)r)
#define nouveau_engine_destroy(p) \
nouveau_subdev_destroy(&(p)->subdev)
#define nouveau_engine_init(p) \
nouveau_subdev_init(&(p)->subdev)
#define nouveau_engine_fini(p,s) \
nouveau_subdev_fini(&(p)->subdev, (s))
#define nvkm_engine_destroy(p) \
nvkm_subdev_destroy(&(p)->subdev)
#define nvkm_engine_init(p) \
nvkm_subdev_init(&(p)->subdev)
#define nvkm_engine_fini(p,s) \
nvkm_subdev_fini(&(p)->subdev, (s))
int nouveau_engine_create_(struct nouveau_object *, struct nouveau_object *,
struct nouveau_oclass *, bool, const char *,
int nvkm_engine_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, bool, const char *,
const char *, int, void **);
#define _nouveau_engine_dtor _nouveau_subdev_dtor
#define _nouveau_engine_init _nouveau_subdev_init
#define _nouveau_engine_fini _nouveau_subdev_fini
#define _nvkm_engine_dtor _nvkm_subdev_dtor
#define _nvkm_engine_init _nvkm_subdev_init
#define _nvkm_engine_fini _nvkm_subdev_fini
#endif
#ifndef __NOUVEAU_ENUM_H__
#define __NOUVEAU_ENUM_H__
#ifndef __NVKM_ENUM_H__
#define __NVKM_ENUM_H__
#include <core/os.h>
struct nouveau_enum {
struct nvkm_enum {
u32 value;
const char *name;
const void *data;
u32 data2;
};
const struct nouveau_enum *
nouveau_enum_find(const struct nouveau_enum *, u32 value);
const struct nvkm_enum *nvkm_enum_find(const struct nvkm_enum *, u32 value);
const struct nvkm_enum *nvkm_enum_print(const struct nvkm_enum *, u32 value);
const struct nouveau_enum *
nouveau_enum_print(const struct nouveau_enum *en, u32 value);
struct nouveau_bitfield {
struct nvkm_bitfield {
u32 mask;
const char *name;
};
void nouveau_bitfield_print(const struct nouveau_bitfield *, u32 value);
void nvkm_bitfield_print(const struct nvkm_bitfield *, u32 value);
#endif
#ifndef __NVKM_EVENT_H__
#define __NVKM_EVENT_H__
#include <core/notify.h>
struct nvkm_event_func {
int (*ctor)(struct nouveau_object *, void *data, u32 size,
struct nvkm_notify *);
void (*send)(void *data, u32 size, struct nvkm_notify *);
void (*init)(struct nvkm_event *, int type, int index);
void (*fini)(struct nvkm_event *, int type, int index);
};
#include <core/os.h>
struct nvkm_notify;
struct nvkm_object;
struct nvkm_event {
const struct nvkm_event_func *func;
......@@ -23,13 +16,19 @@ struct nvkm_event {
int *refs;
};
int nvkm_event_init(const struct nvkm_event_func *func,
int types_nr, int index_nr,
struct nvkm_event *);
struct nvkm_event_func {
int (*ctor)(struct nvkm_object *, void *data, u32 size,
struct nvkm_notify *);
void (*send)(void *data, u32 size, struct nvkm_notify *);
void (*init)(struct nvkm_event *, int type, int index);
void (*fini)(struct nvkm_event *, int type, int index);
};
int nvkm_event_init(const struct nvkm_event_func *func, int types_nr,
int index_nr, struct nvkm_event *);
void nvkm_event_fini(struct nvkm_event *);
void nvkm_event_get(struct nvkm_event *, u32 types, int index);
void nvkm_event_put(struct nvkm_event *, u32 types, int index);
void nvkm_event_send(struct nvkm_event *, u32 types, int index,
void *data, u32 size);
#endif
#ifndef __NOUVEAU_GPUOBJ_H__
#define __NOUVEAU_GPUOBJ_H__
#ifndef __NVKM_GPUOBJ_H__
#define __NVKM_GPUOBJ_H__
#include <core/object.h>
#include <core/device.h>
#include <core/parent.h>
#include <core/mm.h>
struct nouveau_vma;
struct nouveau_vm;
struct nvkm_vma;
struct nvkm_vm;
#define NVOBJ_FLAG_ZERO_ALLOC 0x00000001
#define NVOBJ_FLAG_ZERO_FREE 0x00000002
#define NVOBJ_FLAG_HEAP 0x00000004
struct nouveau_gpuobj {
struct nouveau_object object;
struct nouveau_object *parent;
struct nouveau_mm_node *node;
struct nouveau_mm heap;
struct nvkm_gpuobj {
struct nvkm_object object;
struct nvkm_object *parent;
struct nvkm_mm_node *node;
struct nvkm_mm heap;
u32 flags;
u64 addr;
u32 size;
};
static inline struct nouveau_gpuobj *
static inline struct nvkm_gpuobj *
nv_gpuobj(void *obj)
{
#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
......@@ -34,38 +30,35 @@ nv_gpuobj(void *obj)
return obj;
}
#define nouveau_gpuobj_create(p,e,c,v,g,s,a,f,d) \
nouveau_gpuobj_create_((p), (e), (c), (v), (g), (s), (a), (f), \
#define nvkm_gpuobj_create(p,e,c,v,g,s,a,f,d) \
nvkm_gpuobj_create_((p), (e), (c), (v), (g), (s), (a), (f), \
sizeof(**d), (void **)d)
#define nouveau_gpuobj_init(p) nouveau_object_init(&(p)->object)
#define nouveau_gpuobj_fini(p,s) nouveau_object_fini(&(p)->object, (s))
int nouveau_gpuobj_create_(struct nouveau_object *, struct nouveau_object *,
struct nouveau_oclass *, u32 pclass,
struct nouveau_object *, u32 size, u32 align,
#define nvkm_gpuobj_init(p) nvkm_object_init(&(p)->object)
#define nvkm_gpuobj_fini(p,s) nvkm_object_fini(&(p)->object, (s))
int nvkm_gpuobj_create_(struct nvkm_object *, struct nvkm_object *,
struct nvkm_oclass *, u32 pclass,
struct nvkm_object *, u32 size, u32 align,
u32 flags, int length, void **);
void nouveau_gpuobj_destroy(struct nouveau_gpuobj *);
void nvkm_gpuobj_destroy(struct nvkm_gpuobj *);
int nouveau_gpuobj_new(struct nouveau_object *, struct nouveau_object *,
u32 size, u32 align, u32 flags,
struct nouveau_gpuobj **);
int nouveau_gpuobj_dup(struct nouveau_object *, struct nouveau_gpuobj *,
struct nouveau_gpuobj **);
int nouveau_gpuobj_map(struct nouveau_gpuobj *, u32 acc, struct nouveau_vma *);
int nouveau_gpuobj_map_vm(struct nouveau_gpuobj *, struct nouveau_vm *,
u32 access, struct nouveau_vma *);
void nouveau_gpuobj_unmap(struct nouveau_vma *);
int nvkm_gpuobj_new(struct nvkm_object *, struct nvkm_object *, u32 size,
u32 align, u32 flags, struct nvkm_gpuobj **);
int nvkm_gpuobj_dup(struct nvkm_object *, struct nvkm_gpuobj *,
struct nvkm_gpuobj **);
int nvkm_gpuobj_map(struct nvkm_gpuobj *, u32 acc, struct nvkm_vma *);
int nvkm_gpuobj_map_vm(struct nvkm_gpuobj *, struct nvkm_vm *, u32 access,
struct nvkm_vma *);
void nvkm_gpuobj_unmap(struct nvkm_vma *);
static inline void
nouveau_gpuobj_ref(struct nouveau_gpuobj *obj, struct nouveau_gpuobj **ref)
nvkm_gpuobj_ref(struct nvkm_gpuobj *obj, struct nvkm_gpuobj **ref)
{
nouveau_object_ref(&obj->object, (struct nouveau_object **)ref);
nvkm_object_ref(&obj->object, (struct nvkm_object **)ref);
}
void _nouveau_gpuobj_dtor(struct nouveau_object *);
int _nouveau_gpuobj_init(struct nouveau_object *);
int _nouveau_gpuobj_fini(struct nouveau_object *, bool);
u32 _nouveau_gpuobj_rd32(struct nouveau_object *, u64);
void _nouveau_gpuobj_wr32(struct nouveau_object *, u64, u32);
void _nvkm_gpuobj_dtor(struct nvkm_object *);
int _nvkm_gpuobj_init(struct nvkm_object *);
int _nvkm_gpuobj_fini(struct nvkm_object *, bool);
u32 _nvkm_gpuobj_rd32(struct nvkm_object *, u64);
void _nvkm_gpuobj_wr32(struct nvkm_object *, u64, u32);
#endif
#ifndef __NOUVEAU_HANDLE_H__
#define __NOUVEAU_HANDLE_H__
#ifndef __NVKM_HANDLE_H__
#define __NVKM_HANDLE_H__
#include <core/os.h>
struct nvkm_object;
struct nouveau_handle {
struct nouveau_namedb *namedb;
struct nvkm_handle {
struct nvkm_namedb *namedb;
struct list_head node;
struct list_head head;
......@@ -13,22 +15,20 @@ struct nouveau_handle {
u8 route;
u64 token;
struct nouveau_handle *parent;
struct nouveau_object *object;
struct nvkm_handle *parent;
struct nvkm_object *object;
};
int nouveau_handle_create(struct nouveau_object *, u32 parent, u32 handle,
struct nouveau_object *, struct nouveau_handle **);
void nouveau_handle_destroy(struct nouveau_handle *);
int nouveau_handle_init(struct nouveau_handle *);
int nouveau_handle_fini(struct nouveau_handle *, bool suspend);
int nvkm_handle_create(struct nvkm_object *, u32 parent, u32 handle,
struct nvkm_object *, struct nvkm_handle **);
void nvkm_handle_destroy(struct nvkm_handle *);
int nvkm_handle_init(struct nvkm_handle *);
int nvkm_handle_fini(struct nvkm_handle *, bool suspend);
struct nouveau_object *
nouveau_handle_ref(struct nouveau_object *, u32 name);
struct nouveau_handle *nouveau_handle_get_class(struct nouveau_object *, u16);
struct nouveau_handle *nouveau_handle_get_vinst(struct nouveau_object *, u64);
struct nouveau_handle *nouveau_handle_get_cinst(struct nouveau_object *, u32);
void nouveau_handle_put(struct nouveau_handle *);
struct nvkm_object *nvkm_handle_ref(struct nvkm_object *, u32 name);
struct nvkm_handle *nvkm_handle_get_class(struct nvkm_object *, u16);
struct nvkm_handle *nvkm_handle_get_vinst(struct nvkm_object *, u64);
struct nvkm_handle *nvkm_handle_get_cinst(struct nvkm_object *, u32);
void nvkm_handle_put(struct nvkm_handle *);
#endif
#ifndef __NVKM_IOCTL_H__
#define __NVKM_IOCTL_H__
#include <core/os.h>
struct nvkm_client;
int nvkm_ioctl(struct nouveau_client *, bool, void *, u32, void **);
int nvkm_ioctl(struct nvkm_client *, bool, void *, u32, void **);
#endif
#ifndef __NOUVEAU_MM_H__
#define __NOUVEAU_MM_H__
#ifndef __NVKM_MM_H__
#define __NVKM_MM_H__
#include <core/os.h>
struct nouveau_mm_node {
struct nvkm_mm_node {
struct list_head nl_entry;
struct list_head fl_entry;
struct list_head rl_entry;
......@@ -15,7 +16,7 @@ struct nouveau_mm_node {
u32 length;
};
struct nouveau_mm {
struct nvkm_mm {
struct list_head nodes;
struct list_head free;
......@@ -24,17 +25,16 @@ struct nouveau_mm {
};