Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+23 −25
Original line number Diff line number Diff line
#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
+2 −4
Original line number Diff line number Diff line
#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
+17 −20
Original line number Diff line number Diff line
#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
+25 −28
Original line number Diff line number Diff line
#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
+24 −27
Original line number Diff line number Diff line
#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
Loading