cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

priv.h (4606B)


      1#ifndef __NVKM_ACR_PRIV_H__
      2#define __NVKM_ACR_PRIV_H__
      3#include <subdev/acr.h>
      4struct lsb_header_tail;
      5
      6struct nvkm_acr_fwif {
      7	int version;
      8	int (*load)(struct nvkm_acr *, int version,
      9		    const struct nvkm_acr_fwif *);
     10	const struct nvkm_acr_func *func;
     11};
     12
     13int gm200_acr_nofw(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
     14int gm20b_acr_load(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
     15int gp102_acr_load(struct nvkm_acr *, int, const struct nvkm_acr_fwif *);
     16
     17struct nvkm_acr_lsf;
     18struct nvkm_acr_func {
     19	const struct nvkm_acr_hsf_fwif *load;
     20	const struct nvkm_acr_hsf_fwif *ahesasc;
     21	const struct nvkm_acr_hsf_fwif *asb;
     22	const struct nvkm_acr_hsf_fwif *unload;
     23	int (*wpr_parse)(struct nvkm_acr *);
     24	u32 (*wpr_layout)(struct nvkm_acr *);
     25	int (*wpr_alloc)(struct nvkm_acr *, u32 wpr_size);
     26	int (*wpr_build)(struct nvkm_acr *, struct nvkm_acr_lsf *rtos);
     27	void (*wpr_patch)(struct nvkm_acr *, s64 adjust);
     28	void (*wpr_check)(struct nvkm_acr *, u64 *start, u64 *limit);
     29	int (*init)(struct nvkm_acr *);
     30	void (*fini)(struct nvkm_acr *);
     31	u64 bootstrap_falcons;
     32};
     33
     34extern const struct nvkm_acr_func gm200_acr;
     35int gm200_acr_wpr_parse(struct nvkm_acr *);
     36u32 gm200_acr_wpr_layout(struct nvkm_acr *);
     37int gm200_acr_wpr_build(struct nvkm_acr *, struct nvkm_acr_lsf *);
     38void gm200_acr_wpr_patch(struct nvkm_acr *, s64);
     39void gm200_acr_wpr_check(struct nvkm_acr *, u64 *, u64 *);
     40void gm200_acr_wpr_build_lsb_tail(struct nvkm_acr_lsfw *,
     41				  struct lsb_header_tail *);
     42int gm200_acr_init(struct nvkm_acr *);
     43
     44int gm20b_acr_wpr_alloc(struct nvkm_acr *, u32 wpr_size);
     45
     46int gp102_acr_wpr_parse(struct nvkm_acr *);
     47u32 gp102_acr_wpr_layout(struct nvkm_acr *);
     48int gp102_acr_wpr_alloc(struct nvkm_acr *, u32 wpr_size);
     49int gp102_acr_wpr_build(struct nvkm_acr *, struct nvkm_acr_lsf *);
     50int gp102_acr_wpr_build_lsb(struct nvkm_acr *, struct nvkm_acr_lsfw *);
     51void gp102_acr_wpr_patch(struct nvkm_acr *, s64);
     52
     53struct nvkm_acr_hsfw {
     54	const struct nvkm_acr_hsf_func *func;
     55	const char *name;
     56	struct list_head head;
     57
     58	u32 imem_size;
     59	u32 imem_tag;
     60	u32 *imem;
     61
     62	u8 *image;
     63	u32 image_size;
     64	u32 non_sec_addr;
     65	u32 non_sec_size;
     66	u32 sec_addr;
     67	u32 sec_size;
     68	u32 data_addr;
     69	u32 data_size;
     70
     71	struct {
     72		struct {
     73			void *data;
     74			u32 size;
     75		} prod, dbg;
     76		u32 patch_loc;
     77	} sig;
     78};
     79
     80struct nvkm_acr_hsf_fwif {
     81	int version;
     82	int (*load)(struct nvkm_acr *, const char *bl, const char *fw,
     83		    const char *name, int version,
     84		    const struct nvkm_acr_hsf_fwif *);
     85	const struct nvkm_acr_hsf_func *func;
     86};
     87
     88int nvkm_acr_hsfw_load(struct nvkm_acr *, const char *, const char *,
     89		       const char *, int, const struct nvkm_acr_hsf_fwif *);
     90void nvkm_acr_hsfw_del_all(struct nvkm_acr *);
     91
     92struct nvkm_acr_hsf {
     93	const struct nvkm_acr_hsf_func *func;
     94	const char *name;
     95	struct list_head head;
     96
     97	u32 imem_size;
     98	u32 imem_tag;
     99	u32 *imem;
    100
    101	u32 non_sec_addr;
    102	u32 non_sec_size;
    103	u32 sec_addr;
    104	u32 sec_size;
    105	u32 data_addr;
    106	u32 data_size;
    107
    108	struct nvkm_memory *ucode;
    109	struct nvkm_vma *vma;
    110	struct nvkm_falcon *falcon;
    111};
    112
    113struct nvkm_acr_hsf_func {
    114	int (*load)(struct nvkm_acr *, struct nvkm_acr_hsfw *);
    115	int (*boot)(struct nvkm_acr *, struct nvkm_acr_hsf *);
    116	void (*bld)(struct nvkm_acr *, struct nvkm_acr_hsf *);
    117};
    118
    119int gm200_acr_hsfw_load(struct nvkm_acr *, struct nvkm_acr_hsfw *,
    120			struct nvkm_falcon *);
    121int gm200_acr_hsfw_boot(struct nvkm_acr *, struct nvkm_acr_hsf *,
    122			u32 clear_intr, u32 mbox0_ok);
    123
    124int gm200_acr_load_boot(struct nvkm_acr *, struct nvkm_acr_hsf *);
    125
    126extern const struct nvkm_acr_hsf_func gm200_acr_unload_0;
    127int gm200_acr_unload_load(struct nvkm_acr *, struct nvkm_acr_hsfw *);
    128int gm200_acr_unload_boot(struct nvkm_acr *, struct nvkm_acr_hsf *);
    129void gm200_acr_hsfw_bld(struct nvkm_acr *, struct nvkm_acr_hsf *);
    130
    131extern const struct nvkm_acr_hsf_func gm20b_acr_load_0;
    132
    133int gp102_acr_load_load(struct nvkm_acr *, struct nvkm_acr_hsfw *);
    134
    135extern const struct nvkm_acr_hsf_func gp108_acr_unload_0;
    136void gp108_acr_hsfw_bld(struct nvkm_acr *, struct nvkm_acr_hsf *);
    137
    138int nvkm_acr_new_(const struct nvkm_acr_fwif *, struct nvkm_device *, enum nvkm_subdev_type,
    139		  int inst, struct nvkm_acr **);
    140int nvkm_acr_hsf_boot(struct nvkm_acr *, const char *name);
    141
    142struct nvkm_acr_lsf {
    143	const struct nvkm_acr_lsf_func *func;
    144	struct nvkm_falcon *falcon;
    145	enum nvkm_acr_lsf_id id;
    146	struct list_head head;
    147};
    148
    149struct nvkm_acr_lsfw *nvkm_acr_lsfw_add(const struct nvkm_acr_lsf_func *,
    150					struct nvkm_acr *, struct nvkm_falcon *,
    151					enum nvkm_acr_lsf_id);
    152void nvkm_acr_lsfw_del(struct nvkm_acr_lsfw *);
    153void nvkm_acr_lsfw_del_all(struct nvkm_acr *);
    154#endif