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

drm/nouveau/gsp: add gpu hal stubs



With GSP-RM handling the majority of the HW programming, NVKM's usual
HALs are more elaborate than necessary, resulting in a fair amount of
duplicated boilerplate.

Adds 'nvkm_rm_gpu' which serves to provide GPU-specific constants and
functions in a more streamlined manner.

This is initially used in subsequent commits to store engine class IDs,
and replace the per-engine/engobj boilerplate with common code for all
GSP-RM supported engines - and is further extended when adding GH100,
GB10x and GB20x support.

Signed-off-by: default avatarBen Skeggs <bskeggs@nvidia.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: default avatarTimur Tabi <ttabi@nvidia.com>
Tested-by: default avatarTimur Tabi <ttabi@nvidia.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 0c6aa94f
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -209,9 +209,7 @@ struct nvkm_gsp {
		u8 tpcs;
	} gr;

	const struct nvkm_gsp_rm {
		const struct nvkm_rm_api *api;
	} *rm;
	struct nvkm_rm *rm;

	struct {
		struct mutex mutex;
@@ -467,7 +465,7 @@ static inline int
nvkm_gsp_device_event_ctor(struct nvkm_gsp_device *device, u32 handle, u32 id,
			   nvkm_gsp_event_func func, struct nvkm_gsp_event *event)
{
	const struct nvkm_gsp_rm *rm = device->object.client->gsp->rm;
	struct nvkm_rm *rm = device->object.client->gsp->rm;

	return rm->api->device->event.ctor(device, handle, id, func, event);
}
+3 −3
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include "priv.h"

static const struct nvkm_gsp_func
ad102_gsp_r535_113_01 = {
ad102_gsp = {
	.flcn = &ga102_gsp_flcn,
	.fwsec = &ga102_gsp_fwsec,

@@ -40,12 +40,12 @@ ad102_gsp_r535_113_01 = {
	.fini = tu102_gsp_fini,
	.reset = ga102_gsp_reset,

	.rm = &r535_gsp_rm,
	.rm.gpu = &ad10x_gpu,
};

static struct nvkm_gsp_fwif
ad102_gsps[] = {
	{ 0, tu102_gsp_load, &ad102_gsp_r535_113_01, "535.113.01", true },
	{ 0, tu102_gsp_load, &ad102_gsp, &r535_rm_ga102, "535.113.01", true },
	{}
};

+11 −1
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ nvkm_gsp_dtor(struct nvkm_subdev *subdev)
		gsp->func->dtor(gsp);

	nvkm_falcon_dtor(&gsp->falcon);
	kfree(gsp->rm);
	return gsp;
}

@@ -139,7 +140,16 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
		return PTR_ERR(fwif);

	gsp->func = fwif->func;
	gsp->rm = gsp->func->rm;

	if (fwif->rm) {
		gsp->rm = kzalloc(sizeof(*gsp->rm), GFP_KERNEL);
		if (!gsp->rm)
			return -ENOMEM;

		gsp->rm->device = device;
		gsp->rm->gpu = fwif->func->rm.gpu;
		gsp->rm->api = fwif->rm->api;
	}

	return nvkm_falcon_ctor(gsp->func->flcn, &gsp->subdev, gsp->subdev.name, 0x110000,
				&gsp->falcon);
+3 −3
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ ga100_gsp_flcn = {
};

static const struct nvkm_gsp_func
ga100_gsp_r535_113_01 = {
ga100_gsp = {
	.flcn = &ga100_gsp_flcn,
	.fwsec = &tu102_gsp_fwsec,

@@ -56,12 +56,12 @@ ga100_gsp_r535_113_01 = {
	.fini = tu102_gsp_fini,
	.reset = tu102_gsp_reset,

	.rm = &r535_gsp_rm,
	.rm.gpu = &ga100_gpu,
};

static struct nvkm_gsp_fwif
ga100_gsps[] = {
	{  0, tu102_gsp_load, &ga100_gsp_r535_113_01, "535.113.01" },
	{  0, tu102_gsp_load, &ga100_gsp, &r535_rm_tu102, "535.113.01" },
	{ -1, gv100_gsp_nofw, &gv100_gsp },
	{}
};
+3 −3
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ ga102_gsp_flcn = {
};

static const struct nvkm_gsp_func
ga102_gsp_r535_113_01 = {
ga102_gsp_r535 = {
	.flcn = &ga102_gsp_flcn,
	.fwsec = &ga102_gsp_fwsec,

@@ -168,7 +168,7 @@ ga102_gsp_r535_113_01 = {
	.fini = tu102_gsp_fini,
	.reset = ga102_gsp_reset,

	.rm = &r535_gsp_rm,
	.rm.gpu = &ga1xx_gpu,
};

static const struct nvkm_gsp_func
@@ -178,7 +178,7 @@ ga102_gsp = {

static struct nvkm_gsp_fwif
ga102_gsps[] = {
	{  0, tu102_gsp_load, &ga102_gsp_r535_113_01, "535.113.01" },
	{  0, tu102_gsp_load, &ga102_gsp_r535, &r535_rm_ga102, "535.113.01" },
	{ -1, gv100_gsp_nofw, &ga102_gsp },
	{}
};
Loading