Commit 40184ece authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie
Browse files

drm/nouveau/ce/gv100-: move method buffer to ce ctx



Didn't really know what this buffer was when initially implemented,
but these days we do, so move it somewhere more appropriate.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 097d56cd
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,

	/* destroy channel object, all children will be killed too */
	if (chan->chan) {
		nvif_object_dtor(&chan->ce);
		nouveau_channel_idle(chan->chan);
		nouveau_channel_del(&chan->chan);
	}
@@ -325,6 +326,31 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
		init->nr_subchan = 2;
	}

	/* Workaround "nvc0" gallium driver using classes it doesn't allocate on
	 * Kepler and above.  NVKM no longer always sets CE_CTX_VALID as part of
	 * channel init, now we know what that stuff actually is.
	 *
	 * Doesn't matter for Kepler/Pascal, CE context stored in NV_RAMIN.
	 *
	 * Userspace was fixed prior to adding Ampere support.
	 */
	switch (device->info.family) {
	case NV_DEVICE_INFO_V0_VOLTA:
		ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", 0, VOLTA_DMA_COPY_A,
				       NULL, 0, &chan->ce);
		if (ret)
			goto done;
		break;
	case NV_DEVICE_INFO_V0_TURING:
		ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", 0, TURING_DMA_COPY_A,
				       NULL, 0, &chan->ce);
		if (ret)
			goto done;
		break;
	default:
		break;
	}

	/* Named memory object area */
	ret = nouveau_gem_new(cli, PAGE_SIZE, 0, NOUVEAU_GEM_DOMAIN_GART,
			      0, 0, &chan->ntfy);
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ struct nouveau_abi16_ntfy {
struct nouveau_abi16_chan {
	struct list_head head;
	struct nouveau_channel *chan;
	struct nvif_object ce;
	struct list_head notifiers;
	struct nouveau_bo *ntfy;
	struct nouveau_vma *ntfy_vma;
+24 −0
Original line number Diff line number Diff line
@@ -21,11 +21,35 @@
 */
#include "priv.h"

#include <core/gpuobj.h>
#include <core/object.h>

#include <nvif/class.h>

static int
gv100_ce_cclass_bind(struct nvkm_object *object, struct nvkm_gpuobj *parent, int align,
		     struct nvkm_gpuobj **pgpuobj)
{
	struct nvkm_device *device = object->engine->subdev.device;
	u32 size;

	/* Allocate fault method buffer (magics come from nvgpu). */
	size = nvkm_rd32(device, 0x104028); /* NV_PCE_PCE_MAP */
	size = 27 * 5 * (((9 + 1 + 3) * hweight32(size)) + 2);
	size = roundup(size, PAGE_SIZE);

	return nvkm_gpuobj_new(device, size, align, true, parent, pgpuobj);
}

const struct nvkm_object_func
gv100_ce_cclass = {
	.bind = gv100_ce_cclass_bind,
};

static const struct nvkm_engine_func
gv100_ce = {
	.intr = gp100_ce_intr,
	.cclass = &gv100_ce_cclass,
	.sclass = {
		{ -1, -1, VOLTA_DMA_COPY_A },
		{}
+2 −0
Original line number Diff line number Diff line
@@ -6,4 +6,6 @@
void gt215_ce_intr(struct nvkm_falcon *, struct nvkm_fifo_chan *);
void gk104_ce_intr(struct nvkm_engine *);
void gp100_ce_intr(struct nvkm_engine *);

extern const struct nvkm_object_func gv100_ce_cclass;
#endif
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
static const struct nvkm_engine_func
tu102_ce = {
	.intr = gp100_ce_intr,
	.cclass = &gv100_ce_cclass,
	.sclass = {
		{ -1, -1, TURING_DMA_COPY_A },
		{}
Loading