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

Commit 6189f1b0 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/fifo: cosmetic changes



This is purely preparation for upcoming commits, there should be no
code changes here.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent a317aa21
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ struct nvkm_fifo_base {
#include <core/event.h>

struct nvkm_fifo {
	struct nvkm_engine base;
	struct nvkm_engine engine;

	struct nvkm_event cevent; /* channel creation event */
	struct nvkm_event uevent; /* async user trigger */
@@ -92,9 +92,9 @@ nvkm_fifo(void *obj)
#define nvkm_fifo_create(o,e,c,fc,lc,d)                                     \
	nvkm_fifo_create_((o), (e), (c), (fc), (lc), sizeof(**d), (void **)d)
#define nvkm_fifo_init(p)                                                   \
	nvkm_engine_init(&(p)->base)
	nvkm_engine_init(&(p)->engine)
#define nvkm_fifo_fini(p,s)                                                 \
	nvkm_engine_fini(&(p)->base, (s))
	nvkm_engine_fini(&(p)->engine, (s))

int nvkm_fifo_create_(struct nvkm_object *, struct nvkm_object *,
			 struct nvkm_oclass *, int min, int max,
+2 −2
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ nv84_fence_destroy(struct nouveau_drm *drm)
int
nv84_fence_create(struct nouveau_drm *drm)
{
	struct nvkm_fifo *pfifo = nvxx_fifo(&drm->device);
	struct nvkm_fifo *fifo = nvxx_fifo(&drm->device);
	struct nv84_fence_priv *priv;
	u32 domain;
	int ret;
@@ -228,7 +228,7 @@ nv84_fence_create(struct nouveau_drm *drm)
	priv->base.context_new = nv84_fence_context_new;
	priv->base.context_del = nv84_fence_context_del;

	priv->base.contexts = pfifo->max + 1;
	priv->base.contexts = fifo->max + 1;
	priv->base.context_base = fence_context_alloc(priv->base.contexts);
	priv->base.uevent = true;

+2 −2
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ gt215_ce_isr_error_name[] = {
void
gt215_ce_intr(struct nvkm_subdev *subdev)
{
	struct nvkm_fifo *pfifo = nvkm_fifo(subdev);
	struct nvkm_fifo *fifo = nvkm_fifo(subdev);
	struct nvkm_engine *engine = nv_engine(subdev);
	struct nvkm_falcon *falcon = (void *)subdev;
	struct nvkm_object *engctx;
@@ -87,7 +87,7 @@ gt215_ce_intr(struct nvkm_subdev *subdev)
	int chid;

	engctx = nvkm_engctx_get(engine, inst);
	chid   = pfifo->chid(pfifo, engctx);
	chid   = fifo->chid(fifo, engctx);

	if (stat & 0x00000040) {
		nv_error(falcon, "DISPATCH_ERROR [");
+2 −2
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ g84_cipher_intr_mask[] = {
static void
g84_cipher_intr(struct nvkm_subdev *subdev)
{
	struct nvkm_fifo *pfifo = nvkm_fifo(subdev);
	struct nvkm_fifo *fifo = nvkm_fifo(subdev);
	struct nvkm_engine *engine = nv_engine(subdev);
	struct nvkm_object *engctx;
	struct nvkm_engine *cipher = (void *)subdev;
@@ -115,7 +115,7 @@ g84_cipher_intr(struct nvkm_subdev *subdev)
	int chid;

	engctx = nvkm_engctx_get(engine, inst);
	chid   = pfifo->chid(pfifo, engctx);
	chid   = fifo->chid(fifo, engctx);

	if (stat) {
		nv_error(cipher, "%s", "");
+29 −29
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
			  u64 engmask, int len, void **ptr)
{
	struct nvkm_device *device = nv_device(engine);
	struct nvkm_fifo *priv = (void *)engine;
	struct nvkm_fifo *fifo = (void *)engine;
	struct nvkm_fifo_chan *chan;
	struct nvkm_dmaeng *dmaeng;
	unsigned long flags;
@@ -90,39 +90,39 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
		return ret;

	/* find a free fifo channel */
	spin_lock_irqsave(&priv->lock, flags);
	for (chan->chid = priv->min; chan->chid < priv->max; chan->chid++) {
		if (!priv->channel[chan->chid]) {
			priv->channel[chan->chid] = nv_object(chan);
	spin_lock_irqsave(&fifo->lock, flags);
	for (chan->chid = fifo->min; chan->chid < fifo->max; chan->chid++) {
		if (!fifo->channel[chan->chid]) {
			fifo->channel[chan->chid] = nv_object(chan);
			break;
		}
	}
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&fifo->lock, flags);

	if (chan->chid == priv->max) {
		nv_error(priv, "no free channels\n");
	if (chan->chid == fifo->max) {
		nv_error(fifo, "no free channels\n");
		return -ENOSPC;
	}

	chan->addr = nv_device_resource_start(device, bar) +
		     addr + size * chan->chid;
	chan->size = size;
	nvkm_event_send(&priv->cevent, 1, 0, NULL, 0);
	nvkm_event_send(&fifo->cevent, 1, 0, NULL, 0);
	return 0;
}

void
nvkm_fifo_channel_destroy(struct nvkm_fifo_chan *chan)
{
	struct nvkm_fifo *priv = (void *)nv_object(chan)->engine;
	struct nvkm_fifo *fifo = (void *)nv_object(chan)->engine;
	unsigned long flags;

	if (chan->user)
		iounmap(chan->user);

	spin_lock_irqsave(&priv->lock, flags);
	priv->channel[chan->chid] = NULL;
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_lock_irqsave(&fifo->lock, flags);
	fifo->channel[chan->chid] = NULL;
	spin_unlock_irqrestore(&fifo->lock, flags);

	nvkm_gpuobj_ref(NULL, &chan->pushgpu);
	nvkm_object_ref(NULL, (struct nvkm_object **)&chan->pushdma);
@@ -214,9 +214,9 @@ _nvkm_fifo_channel_ntfy(struct nvkm_object *object, u32 type,
}

static int
nvkm_fifo_chid(struct nvkm_fifo *priv, struct nvkm_object *object)
nvkm_fifo_chid(struct nvkm_fifo *fifo, struct nvkm_object *object)
{
	int engidx = nv_hclass(priv) & 0xff;
	int engidx = nv_hclass(fifo) & 0xff;

	while (object && object->parent) {
		if ( nv_iclass(object->parent, NV_ENGCTX_CLASS) &&
@@ -243,12 +243,12 @@ nvkm_client_name_for_fifo_chid(struct nvkm_fifo *fifo, u32 chid)
}

void
nvkm_fifo_destroy(struct nvkm_fifo *priv)
nvkm_fifo_destroy(struct nvkm_fifo *fifo)
{
	kfree(priv->channel);
	nvkm_event_fini(&priv->uevent);
	nvkm_event_fini(&priv->cevent);
	nvkm_engine_destroy(&priv->base);
	kfree(fifo->channel);
	nvkm_event_fini(&fifo->uevent);
	nvkm_event_fini(&fifo->cevent);
	nvkm_engine_destroy(&fifo->engine);
}

int
@@ -256,26 +256,26 @@ nvkm_fifo_create_(struct nvkm_object *parent, struct nvkm_object *engine,
		  struct nvkm_oclass *oclass,
		  int min, int max, int length, void **pobject)
{
	struct nvkm_fifo *priv;
	struct nvkm_fifo *fifo;
	int ret;

	ret = nvkm_engine_create_(parent, engine, oclass, true, "PFIFO",
				  "fifo", length, pobject);
	priv = *pobject;
	fifo = *pobject;
	if (ret)
		return ret;

	priv->min = min;
	priv->max = max;
	priv->channel = kzalloc(sizeof(*priv->channel) * (max + 1), GFP_KERNEL);
	if (!priv->channel)
	fifo->min = min;
	fifo->max = max;
	fifo->channel = kzalloc(sizeof(*fifo->channel) * (max + 1), GFP_KERNEL);
	if (!fifo->channel)
		return -ENOMEM;

	ret = nvkm_event_init(&nvkm_fifo_event_func, 1, 1, &priv->cevent);
	ret = nvkm_event_init(&nvkm_fifo_event_func, 1, 1, &fifo->cevent);
	if (ret)
		return ret;

	priv->chid = nvkm_fifo_chid;
	spin_lock_init(&priv->lock);
	fifo->chid = nvkm_fifo_chid;
	spin_lock_init(&fifo->lock);
	return 0;
}
Loading