Skip to content

Commit

Permalink
drm/nouveau/secboot: move code to boot LS falcons to subdevs
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Jan 15, 2020
1 parent 91a4e83 commit 7a4dde7
Show file tree
Hide file tree
Showing 24 changed files with 77 additions and 517 deletions.
20 changes: 20 additions & 0 deletions drivers/gpu/drm/nouveau/include/nvfw/pmu.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#ifndef __NVFW_PMU_H__
#define __NVFW_PMU_H__

struct nv_pmu_args {
u32 reserved;
u32 freq_hz;
u32 trace_size;
u32 trace_dma_base;
u16 trace_dma_base1;
u8 trace_dma_offset;
u32 trace_dma_idx;
bool secure_mode;
bool raise_priv_sec;
struct {
u32 dma_base;
u16 dma_base1;
u8 dma_offset;
u16 fb_size;
u8 dma_idx;
} gc6_ctx;
u8 pad;
};

#define NV_PMU_UNIT_INIT 0x07
#define NV_PMU_UNIT_ACR 0x0a

Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/nouveau/include/nvfw/sec2.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#ifndef __NVFW_SEC2_H__
#define __NVFW_SEC2_H__

struct nv_sec2_args {
u32 freq_hz;
u32 falc_trace_size;
u32 falc_trace_dma_base;
u32 falc_trace_dma_idx;
bool secure_mode;
};

#define NV_SEC2_UNIT_INIT 0x01
#define NV_SEC2_UNIT_ACR 0x08

Expand Down
10 changes: 0 additions & 10 deletions drivers/gpu/drm/nouveau/include/nvkm/core/msgqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@

#ifndef __NVKM_CORE_MSGQUEUE_H
#define __NVKM_CORE_MSGQUEUE_H
#include <subdev/secboot.h>
struct nvkm_msgqueue;

/* Hopefully we will never have firmware arguments larger than that... */
#define NVKM_MSGQUEUE_CMDLINE_SIZE 0x100

int nvkm_msgqueue_new(u32, struct nvkm_falcon *, const struct nvkm_secboot *,
struct nvkm_msgqueue **);
void nvkm_msgqueue_del(struct nvkm_msgqueue **);

/* useful if we run a NVIDIA-signed firmware */
void nvkm_msgqueue_write_cmdline(struct nvkm_msgqueue *, void *);

#endif
1 change: 0 additions & 1 deletion drivers/gpu/drm/nouveau/include/nvkm/engine/sec2.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ struct nvkm_sec2 {
struct nvkm_falcon_qmgr *qmgr;
struct nvkm_falcon_cmdq *cmdq;
struct nvkm_falcon_msgq *msgq;
struct nvkm_msgqueue *queue;

struct work_struct work;
bool initmsg_received;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/include/nvkm/subdev/acr.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct nvkm_acr_lsfw {
};

struct nvkm_acr_lsf_func {
int (*boot)(struct nvkm_falcon *);
int (*bootstrap_falcon)(struct nvkm_falcon *, enum nvkm_acr_lsf_id);
int (*bootstrap_multiple_falcons)(struct nvkm_falcon *, u32 mask);
};
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/nouveau/include/nvkm/subdev/pmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct nvkm_pmu {
struct nvkm_falcon_cmdq *lpq;
struct nvkm_falcon_msgq *msgq;
bool initmsg_received;
struct nvkm_msgqueue *queue;

struct completion wpr_ready;

Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/nouveau/nvkm/engine/sec2/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "priv.h"

#include <core/firmware.h>
#include <core/msgqueue.h>
#include <subdev/top.h>

static void
Expand Down Expand Up @@ -70,7 +69,6 @@ static void *
nvkm_sec2_dtor(struct nvkm_engine *engine)
{
struct nvkm_sec2 *sec2 = nvkm_sec2(engine);
nvkm_msgqueue_del(&sec2->queue);
nvkm_falcon_msgq_del(&sec2->msgq);
nvkm_falcon_cmdq_del(&sec2->cmdq);
nvkm_falcon_qmgr_del(&sec2->qmgr);
Expand Down
12 changes: 12 additions & 0 deletions drivers/gpu/drm/nouveau/nvkm/engine/sec2/gp102.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ gp102_sec2_acr_bootstrap_falcon(struct nvkm_falcon *falcon,
msecs_to_jiffies(1000));
}

static int
gp102_sec2_acr_boot(struct nvkm_falcon *falcon)
{
struct nv_sec2_args args = {};
nvkm_falcon_load_dmem(falcon, &args,
falcon->func->emem_addr, sizeof(args), 0);
nvkm_falcon_start(falcon);
return 0;
}

static const struct nvkm_acr_lsf_func
gp102_sec2_acr_0 = {
.boot = gp102_sec2_acr_boot,
.bootstrap_falcon = gp102_sec2_acr_bootstrap_falcon,
};

Expand Down Expand Up @@ -210,6 +221,7 @@ MODULE_FIRMWARE("nvidia/gp107/sec2/sig.bin");

const struct nvkm_acr_lsf_func
gp102_sec2_acr_1 = {
.boot = gp102_sec2_acr_boot,
.bootstrap_falcon = gp102_sec2_acr_bootstrap_falcon,
};

Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/nouveau/nvkm/falcon/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ nvkm-y += nvkm/falcon/cmdq.o
nvkm-y += nvkm/falcon/msgq.o
nvkm-y += nvkm/falcon/qmgr.o
nvkm-y += nvkm/falcon/v1.o
nvkm-y += nvkm/falcon/msgqueue.o
nvkm-y += nvkm/falcon/msgqueue_0137c63d.o
nvkm-y += nvkm/falcon/msgqueue_0148cdec.o
87 changes: 0 additions & 87 deletions drivers/gpu/drm/nouveau/nvkm/falcon/msgqueue.c

This file was deleted.

95 changes: 0 additions & 95 deletions drivers/gpu/drm/nouveau/nvkm/falcon/msgqueue.h

This file was deleted.

Loading

0 comments on commit 7a4dde7

Please sign in to comment.