Support for GP10B chipset
cover Support for GP10B chipset
GP10B is the chip used in Tegra X2 SoCs. This patchset adds support for its base engines after reworking secboot a bit to accomodate its calling convention better.
This patchset has been tested rendering simple off-screen buffers using Mesa and yielded the expected result.
Alexandre Courbot (15):
secboot: allow to boot multiple falcons
secboot: pass instance to LS firmware loaders
secboot: let LS post_run hooks return error
secboot: start LS firmware in post-run hook secboot/gm20b: specify MC base address as argument
secboot: add GP10B support
msgqueue: support for GP10B PMU firmware
fifo: add GP10B support
fb: add GP10B support
mc: add GP10B support
ibus: add GP10B support
gr: support for GP10B
platform: make VDD regulator optional
platform: support for probing GP10B
core: recognise GP10B chipset
drm/nouveau/include/nvkm/core/msgqueue.h | 7 +- drm/nouveau/include/nvkm/core/tegra.h | 4 + drm/nouveau/include/nvkm/engine/fifo.h | 1 + drm/nouveau/include/nvkm/engine/gr.h | 1 + drm/nouveau/include/nvkm/subdev/fb.h | 1 + drm/nouveau/include/nvkm/subdev/ibus.h | 1 + drm/nouveau/include/nvkm/subdev/mc.h | 1 + drm/nouveau/include/nvkm/subdev/secboot.h | 3 +- drm/nouveau/nouveau_platform.c | 12 +++ drm/nouveau/nvkm/engine/device/base.c | 24 +++++ drm/nouveau/nvkm/engine/device/tegra.c | 31 ++++-- drm/nouveau/nvkm/engine/fifo/Kbuild | 1 + drm/nouveau/nvkm/engine/fifo/gk104.h | 1 + drm/nouveau/nvkm/engine/fifo/gp100.c | 2 +- drm/nouveau/nvkm/engine/fifo/gp10b.c | 41 ++++++++ drm/nouveau/nvkm/engine/gr/Kbuild | 1 + drm/nouveau/nvkm/engine/gr/gf100.c | 16 +-- drm/nouveau/nvkm/engine/gr/gf100.h | 4 + drm/nouveau/nvkm/engine/gr/gp100.c | 13 ++- drm/nouveau/nvkm/engine/gr/gp102.c | 1 + drm/nouveau/nvkm/engine/gr/gp10b.c | 59 +++++++++++ drm/nouveau/nvkm/falcon/msgqueue.c | 35 +++++-- drm/nouveau/nvkm/falcon/msgqueue.h | 10 +- drm/nouveau/nvkm/falcon/msgqueue_0137c63d.c | 115 ++++++++++++++++++++- drm/nouveau/nvkm/falcon/msgqueue_0148cdec.c | 3 +- drm/nouveau/nvkm/subdev/fb/Kbuild | 1 + drm/nouveau/nvkm/subdev/fb/gp10b.c | 38 +++++++ drm/nouveau/nvkm/subdev/ibus/Kbuild | 1 + drm/nouveau/nvkm/subdev/ibus/gp10b.c | 59 +++++++++++ drm/nouveau/nvkm/subdev/mc/Kbuild | 1 + drm/nouveau/nvkm/subdev/mc/gp100.c | 17 ++- drm/nouveau/nvkm/subdev/mc/gp10b.c | 50 +++++++++ drm/nouveau/nvkm/subdev/mc/priv.h | 6 ++ drm/nouveau/nvkm/subdev/secboot/Kbuild | 1 + drm/nouveau/nvkm/subdev/secboot/acr.h | 3 +- drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 88 +++++----------- drm/nouveau/nvkm/subdev/secboot/acr_r352.h | 6 +- drm/nouveau/nvkm/subdev/secboot/acr_r367.c | 3 +- drm/nouveau/nvkm/subdev/secboot/acr_r367.h | 1 + drm/nouveau/nvkm/subdev/secboot/base.c | 6 +- drm/nouveau/nvkm/subdev/secboot/gm200.h | 3 + drm/nouveau/nvkm/subdev/secboot/gm20b.c | 17 +-- drm/nouveau/nvkm/subdev/secboot/gp10b.c | 93 +++++++++++++++++ drm/nouveau/nvkm/subdev/secboot/ls_ucode.h | 12 +-- drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c | 10 +- .../nvkm/subdev/secboot/ls_ucode_msgqueue.c | 90 +++++++++++++--- 46 files changed, 749 insertions(+), 145 deletions(-) create mode 100644 drm/nouveau/nvkm/engine/fifo/gp10b.c create mode 100644 drm/nouveau/nvkm/engine/gr/gp10b.c create mode 100644 drm/nouveau/nvkm/subdev/fb/gp10b.c create mode 100644 drm/nouveau/nvkm/subdev/ibus/gp10b.c create mode 100644 drm/nouveau/nvkm/subdev/mc/gp10b.c create mode 100644 drm/nouveau/nvkm/subdev/secboot/gp10b.c
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 20170329093123.24656-1-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
PATCH 1/15 secboot: allow to boot multiple falcons
Change the secboot and msgqueue interfaces to take a mask of falcons to reset instead of a single falcon. The GP10B firmware interface requires FECS and GPCCS to be booted in a single firmware command.
For firmwares that only support single falcon boot, it is trivial to loop over the mask and boot each falcons individually.
--- drm/nouveau/include/nvkm/core/msgqueue.h | 3 +-- drm/nouveau/include/nvkm/subdev/secboot.h | 2 +- drm/nouveau/nvkm/engine/gr/gf100.c | 16 +++++++++------- drm/nouveau/nvkm/falcon/msgqueue.c | 25 ++++++++++++++++++++++--- drm/nouveau/nvkm/falcon/msgqueue.h | 2 ++ drm/nouveau/nvkm/subdev/secboot/acr.h | 3 +-- drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 25 +++++++++++++++---------- drm/nouveau/nvkm/subdev/secboot/base.c | 6 +++--- 8 files changed, 54 insertions(+), 28 deletions(-)
drm/nouveau/include/nvkm/core/msgqueue.h +1 -2
@@ -41,7 +41,6 @@ int nvkm_msgqueue_reinit(struct nvkm_msgqueue *);void nvkm_msgqueue_write_cmdline (struct nvkm_msgqueue *,void *);/* interface to ACR unit running on falcon (NVIDIA signed firmware) */ -int nvkm_msgqueue_acr_boot_falcon (struct nvkm_msgqueue *, -enum nvkm_secboot_falcon ); +int nvkm_msgqueue_acr_boot_falcons (struct nvkm_msgqueue *,unsigned long );#endif
drm/nouveau/include/nvkm/subdev/secboot.h +1 -1
@@ -55,7 +55,7 @@ struct nvkm_secboot {#define nvkm_secboot (p) container_of((p), struct nvkm_secboot, subdev)bool nvkm_secboot_is_managed (struct nvkm_secboot *,enum nvkm_secboot_falcon ); -int nvkm_secboot_reset (struct nvkm_secboot *,enum nvkm_secboot_falcon ); +int nvkm_secboot_reset (struct nvkm_secboot *,unsigned long );int gm200_secboot_new (struct nvkm_device *,int ,struct nvkm_secboot **);int gm20b_secboot_new (struct nvkm_device *,int ,struct nvkm_secboot **);
drm/nouveau/nvkm/engine/gr/gf100.c +9 -7
@@ -1463,25 +1463,27 @@ gf100_gr_init_ctxctl_ext(struct gf100_gr *gr)struct nvkm_subdev *subdev = &gr->base.engine.subdev;struct nvkm_device *device = subdev->device;struct nvkm_secboot *sb = device->secboot; -int ret =0 ; +u32 secboot_mask =0 ;/* load fuc microcode */ nvkm_mc_unk260 (device,0 );/* securely-managed falcons must be reset using secure boot */ if (nvkm_secboot_is_managed (sb,NVKM_SECBOOT_FALCON_FECS )) - ret =nvkm_secboot_reset (sb,NVKM_SECBOOT_FALCON_FECS ); + secboot_mask |=BIT (NVKM_SECBOOT_FALCON_FECS );else gf100_gr_init_fw (gr->fecs, &gr->fuc409c, &gr->fuc409d); -if (ret) -return ret;if (nvkm_secboot_is_managed (sb,NVKM_SECBOOT_FALCON_GPCCS )) - ret =nvkm_secboot_reset (sb,NVKM_SECBOOT_FALCON_GPCCS ); + secboot_mask |=BIT (NVKM_SECBOOT_FALCON_GPCCS );else gf100_gr_init_fw (gr->gpccs, &gr->fuc41ac, &gr->fuc41ad); -if (ret) -return ret; + +if (secboot_mask !=0 ) { +int ret =nvkm_secboot_reset (sb, secboot_mask); +if (ret) +return ret; + }nvkm_mc_unk260 (device,1 );
drm/nouveau/nvkm/falcon/msgqueue.c +22 -3
@@ -463,12 +463,31 @@ nvkm_msgqueue_write_cmdline(struct nvkm_msgqueue *queue, void *buf) }int -nvkm_msgqueue_acr_boot_falcon (struct nvkm_msgqueue *queue,enum nvkm_secboot_falcon falcon) +nvkm_msgqueue_acr_boot_falcons (struct nvkm_msgqueue *queue, +unsigned long falcon_mask) { -if (!queue || !queue->func->acr_func || !queue->func->acr_func->boot_falcon) +unsigned long falcon; + +if (!queue || !queue->func->acr_func) +return -ENODEV ; + +/* Does the firmware support booting multiple falcons? */ +if (queue->func->acr_func->boot_multiple_falcons) +return queue->func->acr_func->boot_multiple_falcons (queue, + falcon_mask); + +/* Else boot all requested falcons individually */ +if (!queue->func->acr_func->boot_falcon)return -ENODEV ; -return queue->func->acr_func->boot_falcon (queue, falcon); +for_each_set_bit (falcon, &falcon_mask,NVKM_SECBOOT_FALCON_END ) { +int ret = queue->func->acr_func->boot_falcon (queue, falcon); + +if (ret) +return ret; + } + +return 0 ; }int
drm/nouveau/nvkm/falcon/msgqueue.h +2 -0
@@ -101,9 +101,11 @@ struct nvkm_msgqueue_init_func {* struct nvkm_msgqueue_acr_func - msgqueue functions related to ACR * * @boot_falcon: build and send the command to reset a given falcon +* @boot_multiple_falcons: build and send the command to reset several falcons */ struct nvkm_msgqueue_acr_func {int (*boot_falcon)(struct nvkm_msgqueue *,enum nvkm_secboot_falcon ); +int (*boot_multiple_falcons)(struct nvkm_msgqueue *,unsigned long ); };struct nvkm_msgqueue_func {
drm/nouveau/nvkm/subdev/secboot/acr.h +1 -2
@@ -39,8 +39,7 @@ struct nvkm_acr_func {int (*fini)(struct nvkm_acr *,struct nvkm_secboot *,bool );int (*load)(struct nvkm_acr *,struct nvkm_falcon *,struct nvkm_gpuobj *,u64 ); -int (*reset)(struct nvkm_acr *,struct nvkm_secboot *, -enum nvkm_secboot_falcon ); +int (*reset)(struct nvkm_acr *,struct nvkm_secboot *,unsigned long ); };/**
drm/nouveau/nvkm/subdev/secboot/acr_r352.c +15 -10
@@ -976,15 +976,16 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)*/ static int acr_r352_reset_nopmu (struct acr_r352 *acr,struct nvkm_secboot *sb, -enum nvkm_secboot_falcon falcon) +unsigned long falcon_mask) { +int falcon;int ret;/* * Perform secure boot each time we are called on FECS. Since only FECS * and GPCCS are managed and started together, this ought to be safe. */ -if (falcon !=NVKM_SECBOOT_FALCON_FECS ) +if (!(falcon_mask &BIT (NVKM_SECBOOT_FALCON_FECS ))) goto end; ret =acr_r352_shutdown (acr, sb);
@@ -996,7 +997,9 @@ acr_r352_reset_nopmu(struct acr_r352 *acr, struct nvkm_secboot *sb,return ret; end: - acr->falcon_state[falcon] =RESET ; +for_each_set_bit (falcon, &falcon_mask,NVKM_SECBOOT_FALCON_END ) { + acr->falcon_state[falcon] =RESET ; + }return 0 ; }
@@ -1009,11 +1012,11 @@ end:*/ static int acr_r352_reset (struct nvkm_acr *_acr,struct nvkm_secboot *sb, -enum nvkm_secboot_falcon falcon) +unsigned long falcon_mask) {struct acr_r352 *acr =acr_r352 (_acr);struct nvkm_msgqueue *queue; -const char *fname = nvkm_secboot_falcon_name[falcon]; +int falcon;bool wpr_already_set = sb->wpr_set;int ret;
@@ -1026,7 +1029,7 @@ acr_r352_reset(struct nvkm_acr *_acr, struct nvkm_secboot *sb,if (!nvkm_secboot_is_managed (sb, _acr->boot_falcon)) {/* Redo secure boot entirely if it was already done */ if (wpr_already_set) -return acr_r352_reset_nopmu (acr, sb, falcon); +return acr_r352_reset_nopmu (acr, sb, falcon_mask);/* Else return the result of the initial invokation */ else return ret;
@@ -1044,13 +1047,15 @@ acr_r352_reset(struct nvkm_acr *_acr, struct nvkm_secboot *sb, }/* Otherwise just ask the LS firmware to reset the falcon */ -nvkm_debug (&sb->subdev,"resetting %s falcon\n" , fname); - ret =nvkm_msgqueue_acr_boot_falcon (queue, falcon); +for_each_set_bit (falcon, &falcon_mask,NVKM_SECBOOT_FALCON_END ) +nvkm_debug (&sb->subdev,"resetting %s falcon\n" , + nvkm_secboot_falcon_name[falcon]); + ret =nvkm_msgqueue_acr_boot_falcons (queue, falcon_mask);if (ret) { -nvkm_error (&sb->subdev,"cannot boot %s falcon\n" , fname); +nvkm_error (&sb->subdev,"error during falcon reset: %d\n" , ret);return ret; } -nvkm_debug (&sb->subdev,"falcon %s reset\n" , fname); +nvkm_debug (&sb->subdev,"falcon reset done\n" );return 0 ; }
drm/nouveau/nvkm/subdev/secboot/base.c +3 -3
@@ -102,15 +102,15 @@ nvkm_secboot_falcon_name[] = {* nvkm_secboot_reset() - reset specified falcon */ int -nvkm_secboot_reset (struct nvkm_secboot *sb,enum nvkm_secboot_falcon falcon) +nvkm_secboot_reset (struct nvkm_secboot *sb,unsigned long falcon_mask) {/* Unmanaged falcon? */ -if (!(BIT (falcon) & sb->acr->managed_falcons)) { +if ((falcon_mask | sb->acr->managed_falcons) != sb->acr->managed_falcons) {nvkm_error (&sb->subdev,"cannot reset unmanaged falcon!\n" );return -EINVAL ; } -return sb->acr->func->reset (sb->acr, sb, falcon); +return sb->acr->func->reset (sb->acr, sb, falcon_mask); }/**
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 2/15 secboot: pass instance to LS firmware loaders
In reply to a message not in the archiveHaving access to the secboot instance loading a LS firmware can be useful to LS firmware handlers. At least more useful than just having an out-of-context subdev pointer.
GP10B's firmware will also need to know the WPR address, which can be obtained from the secboot instance.
--- drm/nouveau/include/nvkm/core/msgqueue.h | 4 +++- drm/nouveau/nvkm/falcon/msgqueue.c | 7 ++++--- drm/nouveau/nvkm/falcon/msgqueue.h | 6 ++++-- drm/nouveau/nvkm/falcon/msgqueue_0137c63d.c | 3 ++- drm/nouveau/nvkm/falcon/msgqueue_0148cdec.c | 3 ++- drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 11 +++++++---- drm/nouveau/nvkm/subdev/secboot/acr_r352.h | 4 +++- drm/nouveau/nvkm/subdev/secboot/acr_r367.c | 3 ++- drm/nouveau/nvkm/subdev/secboot/acr_r367.h | 1 + drm/nouveau/nvkm/subdev/secboot/ls_ucode.h | 8 ++++---- drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c | 10 ++++------ drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c | 18 ++++++++---------- 12 files changed, 44 insertions(+), 34 deletions(-)
drm/nouveau/include/nvkm/core/msgqueue.h +3 -1
@@ -24,6 +24,7 @@#define __NVKM_CORE_MSGQUEUE_H#include <core/os.h> +#include <subdev/secboot.h> struct nvkm_falcon ;struct nvkm_msgqueue ;
@@ -32,7 +33,8 @@ enum nvkm_secboot_falcon;/* Hopefully we will never have firmware arguments larger than that... */ #define NVKM_MSGQUEUE_CMDLINE_SIZE 0x100 -int nvkm_msgqueue_new (u32 ,struct nvkm_falcon *,struct nvkm_msgqueue **); +int nvkm_msgqueue_new (u32 ,struct nvkm_falcon *,const struct nvkm_secboot *, +struct nvkm_msgqueue **);void nvkm_msgqueue_del (struct nvkm_msgqueue **);void nvkm_msgqueue_recv (struct nvkm_msgqueue *);int nvkm_msgqueue_reinit (struct nvkm_msgqueue *);
drm/nouveau/nvkm/falcon/msgqueue.c +4 -3
@@ -491,17 +491,18 @@ nvkm_msgqueue_acr_boot_falcons(struct nvkm_msgqueue *queue, }int -nvkm_msgqueue_new (u32 version,struct nvkm_falcon *falcon,struct nvkm_msgqueue **queue) +nvkm_msgqueue_new (u32 version,struct nvkm_falcon *falcon, +const struct nvkm_secboot *sb,struct nvkm_msgqueue **queue) {const struct nvkm_subdev *subdev = falcon->owner;int ret = -EINVAL ;switch (version) {case 0x0137c63d : - ret =msgqueue_0137c63d_new (falcon, queue); + ret =msgqueue_0137c63d_new (falcon, sb, queue);break ;case 0x0148cdec : - ret =msgqueue_0148cdec_new (falcon, queue); + ret =msgqueue_0148cdec_new (falcon, sb, queue);break ;default : nvkm_error(subdev, "unhandled firmware version 0x%08x\n",
drm/nouveau/nvkm/falcon/msgqueue.h +4 -2
@@ -203,7 +203,9 @@ int nvkm_msgqueue_post(struct nvkm_msgqueue *, enum msgqueue_msg_priority,void nvkm_msgqueue_process_msgs (struct nvkm_msgqueue *,struct nvkm_msgqueue_queue *); -int msgqueue_0137c63d_new (struct nvkm_falcon *,struct nvkm_msgqueue **); -int msgqueue_0148cdec_new (struct nvkm_falcon *,struct nvkm_msgqueue **); +int msgqueue_0137c63d_new (struct nvkm_falcon *,const struct nvkm_secboot *, +struct nvkm_msgqueue **); +int msgqueue_0148cdec_new (struct nvkm_falcon *,const struct nvkm_secboot *, +struct nvkm_msgqueue **);#endif
drm/nouveau/nvkm/falcon/msgqueue_0137c63d.c +2 -1
@@ -307,7 +307,8 @@ msgqueue_0137c63d_func = { };int -msgqueue_0137c63d_new (struct nvkm_falcon *falcon,struct nvkm_msgqueue **queue) +msgqueue_0137c63d_new (struct nvkm_falcon *falcon,const struct nvkm_secboot *sb, +struct nvkm_msgqueue **queue) {struct msgqueue_0137c63d *ret;
drm/nouveau/nvkm/falcon/msgqueue_0148cdec.c +2 -1
@@ -247,7 +247,8 @@ msgqueue_0148cdec_func = { };int -msgqueue_0148cdec_new (struct nvkm_falcon *falcon,struct nvkm_msgqueue **queue) +msgqueue_0148cdec_new (struct nvkm_falcon *falcon,const struct nvkm_secboot *sb, +struct nvkm_msgqueue **queue) {struct msgqueue_0148cdec *ret;
drm/nouveau/nvkm/subdev/secboot/acr_r352.c +7 -4
@@ -241,6 +241,7 @@ struct ls_ucode_img_r352 {*/ struct ls_ucode_img *acr_r352_ls_ucode_img_load (const struct acr_r352 *acr, +const struct nvkm_secboot *sb,enum nvkm_secboot_falcon falcon_id) {const struct nvkm_subdev *subdev = acr->base.subdev;
@@ -253,7 +254,7 @@ acr_r352_ls_ucode_img_load(const struct acr_r352 *acr, img->base.falcon_id = falcon_id; - ret = acr->func->ls_func[falcon_id]->load (subdev, &img->base); + ret = acr->func->ls_func[falcon_id]->load (sb, &img->base);if (ret) {kfree (img->base.ucode_data);
@@ -462,12 +463,14 @@ acr_r352_ls_write_wpr(struct acr_r352 *acr, struct list_head *imgs,* will be copied into the WPR region by the HS firmware. */ static int -acr_r352_prepare_ls_blob (struct acr_r352 *acr,u64 wpr_addr,u32 wpr_size) +acr_r352_prepare_ls_blob (struct acr_r352 *acr,struct nvkm_secboot *sb) {const struct nvkm_subdev *subdev = acr->base.subdev;struct list_head imgs;struct ls_ucode_img *img, *t;unsigned long managed_falcons = acr->base.managed_falcons; +u64 wpr_addr = sb->wpr_addr; +u32 wpr_size = sb->wpr_size;int managed_count =0 ;u32 image_wpr_size, ls_blob_size;int falcon_id;
@@ -479,7 +482,7 @@ acr_r352_prepare_ls_blob(struct acr_r352 *acr, u64 wpr_addr, u32 wpr_size)for_each_set_bit (falcon_id, &managed_falcons,NVKM_SECBOOT_FALCON_END ) {struct ls_ucode_img *img; - img = acr->func->ls_ucode_img_load (acr, falcon_id); + img = acr->func->ls_ucode_img_load (acr, sb, falcon_id);if (IS_ERR (img)) {if (acr->base.optional_falcons &BIT (falcon_id)) { managed_falcons &= ~BIT (falcon_id);
@@ -704,7 +707,7 @@ acr_r352_load_blobs(struct acr_r352 *acr, struct nvkm_secboot *sb)return 0 ;/* Load and prepare the managed falcon's firmwares */ - ret =acr_r352_prepare_ls_blob (acr, sb->wpr_addr, sb->wpr_size); + ret =acr_r352_prepare_ls_blob (acr, sb);if (ret)return ret;
drm/nouveau/nvkm/subdev/secboot/acr_r352.h +3 -1
@@ -57,7 +57,7 @@ hsf_load_header_app_size(const struct hsf_load_header *hdr, u32 app)* @lhdr_flags: LS flags */ struct acr_r352_ls_func { -int (*load)(const struct nvkm_subdev *,struct ls_ucode_img *); +int (*load)(const struct nvkm_secboot *,struct ls_ucode_img *);void (*generate_bl_desc)(const struct nvkm_acr *,const struct ls_ucode_img *,u64 ,void *);u32 bl_desc_size;
@@ -82,6 +82,7 @@ struct acr_r352_func {bool shadow_blob;struct ls_ucode_img *(*ls_ucode_img_load)(const struct acr_r352 *, +const struct nvkm_secboot *,enum nvkm_secboot_falcon );int (*ls_fill_headers)(struct acr_r352 *,struct list_head *); int (*ls_write_wpr)(struct acr_r352 *, struct list_head *,
@@ -145,6 +146,7 @@ struct nvkm_acr *acr_r352_new_(const struct acr_r352_func *, enum nvkm_secboot_falcon, unsigned long);struct ls_ucode_img *acr_r352_ls_ucode_img_load (const struct acr_r352 *, +const struct nvkm_secboot *,enum nvkm_secboot_falcon );int acr_r352_ls_fill_headers (struct acr_r352 *,struct list_head *); int acr_r352_ls_write_wpr(struct acr_r352 *, struct list_head *,
drm/nouveau/nvkm/subdev/secboot/acr_r367.c +2 -1
@@ -107,6 +107,7 @@ struct ls_ucode_img_r367 {struct ls_ucode_img *acr_r367_ls_ucode_img_load (const struct acr_r352 *acr, +const struct nvkm_secboot *sb,enum nvkm_secboot_falcon falcon_id) {const struct nvkm_subdev *subdev = acr->base.subdev;
@@ -119,7 +120,7 @@ acr_r367_ls_ucode_img_load(const struct acr_r352 *acr, img->base.falcon_id = falcon_id; - ret = acr->func->ls_func[falcon_id]->load (subdev, &img->base); + ret = acr->func->ls_func[falcon_id]->load (sb, &img->base);if (ret) {kfree (img->base.ucode_data);kfree (img->base.sig);
drm/nouveau/nvkm/subdev/secboot/acr_r367.h +1 -0
@@ -28,6 +28,7 @@void acr_r367_fixup_hs_desc (struct acr_r352 *,struct nvkm_secboot *,void *);struct ls_ucode_img *acr_r367_ls_ucode_img_load (const struct acr_r352 *, +const struct nvkm_secboot *,enum nvkm_secboot_falcon );int acr_r367_ls_fill_headers (struct acr_r352 *,struct list_head *); int acr_r367_ls_write_wpr(struct acr_r352 *, struct list_head *,
drm/nouveau/nvkm/subdev/secboot/ls_ucode.h +4 -4
@@ -147,11 +147,11 @@ struct fw_bl_desc { u32 data_size; }; -int acr_ls_ucode_load_fecs (const struct nvkm_subdev *,struct ls_ucode_img *); -int acr_ls_ucode_load_gpccs (const struct nvkm_subdev *,struct ls_ucode_img *); -int acr_ls_ucode_load_pmu (const struct nvkm_subdev *,struct ls_ucode_img *); +int acr_ls_ucode_load_fecs (const struct nvkm_secboot *,struct ls_ucode_img *); +int acr_ls_ucode_load_gpccs (const struct nvkm_secboot *,struct ls_ucode_img *); +int acr_ls_ucode_load_pmu (const struct nvkm_secboot *,struct ls_ucode_img *);void acr_ls_pmu_post_run (const struct nvkm_acr *,const struct nvkm_secboot *); -int acr_ls_ucode_load_sec2 (const struct nvkm_subdev *,struct ls_ucode_img *); +int acr_ls_ucode_load_sec2 (const struct nvkm_secboot *,struct ls_ucode_img *);void acr_ls_sec2_post_run (const struct nvkm_acr *,const struct nvkm_secboot *);#endif
drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c +4 -6
@@ -144,15 +144,13 @@ error: }int -acr_ls_ucode_load_fecs (const struct nvkm_subdev *subdev, -struct ls_ucode_img *img) +acr_ls_ucode_load_fecs (const struct nvkm_secboot *sb,struct ls_ucode_img *img) { -return ls_ucode_img_load_gr (subdev, img,"fecs" ); +return ls_ucode_img_load_gr (&sb->subdev, img,"fecs" ); }int -acr_ls_ucode_load_gpccs (const struct nvkm_subdev *subdev, -struct ls_ucode_img *img) +acr_ls_ucode_load_gpccs (const struct nvkm_secboot *sb,struct ls_ucode_img *img) { -return ls_ucode_img_load_gr (subdev, img,"gpccs" ); +return ls_ucode_img_load_gr (&sb->subdev, img,"gpccs" ); }
drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c +8 -10
@@ -88,19 +88,18 @@ acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue, }int -acr_ls_ucode_load_pmu (const struct nvkm_subdev *subdev, -struct ls_ucode_img *img) +acr_ls_ucode_load_pmu (const struct nvkm_secboot *sb,struct ls_ucode_img *img) { -struct nvkm_pmu *pmu = subdev->device->pmu; +struct nvkm_pmu *pmu = sb->subdev.device->pmu;int ret; - ret =acr_ls_ucode_load_msgqueue (subdev,"pmu" , img); + ret =acr_ls_ucode_load_msgqueue (&sb->subdev,"pmu" , img);if (ret)return ret;/* Allocate the PMU queue corresponding to the FW version */ ret =nvkm_msgqueue_new (img->ucode_desc.app_version, pmu->falcon, - &pmu->queue); + sb, &pmu->queue);if (ret)return ret;
@@ -118,19 +117,18 @@ acr_ls_pmu_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb) }int -acr_ls_ucode_load_sec2 (const struct nvkm_subdev *subdev, -struct ls_ucode_img *img) +acr_ls_ucode_load_sec2 (const struct nvkm_secboot *sb,struct ls_ucode_img *img) { -struct nvkm_sec2 *sec = subdev->device->sec2; +struct nvkm_sec2 *sec = sb->subdev.device->sec2;int ret; - ret =acr_ls_ucode_load_msgqueue (subdev,"sec2" , img); + ret =acr_ls_ucode_load_msgqueue (&sb->subdev,"sec2" , img);if (ret)return ret;/* Allocate the PMU queue corresponding to the FW version */ ret =nvkm_msgqueue_new (img->ucode_desc.app_version, sec->falcon, - &sec->queue); + sb, &sec->queue);if (ret)return ret;
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 3/15 secboot: let LS post_run hooks return error
In reply to a message not in the archiveA LS post-run hook can meet an error meaning the failure of secure boot. Make sure this can be reported.
--- drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 6 ++++-- drm/nouveau/nvkm/subdev/secboot/acr_r352.h | 2 +- drm/nouveau/nvkm/subdev/secboot/ls_ucode.h | 4 ++-- .../nvkm/subdev/secboot/ls_ucode_msgqueue.c | 23 +++++++++++++++++----- 4 files changed, 25 insertions(+), 10 deletions(-)
drm/nouveau/nvkm/subdev/secboot/acr_r352.c +4 -2
@@ -920,8 +920,10 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)const struct acr_r352_ls_func *func = acr->func->ls_func[falcon_id]; -if (func->post_run) - func->post_run (&acr->base, sb); +if (func->post_run) { + ret = func->post_run (&acr->base, sb); +if (ret) +return ret; }/* Re-start ourselves if we are managed */
drm/nouveau/nvkm/subdev/secboot/acr_r352.h +1 -1
@@ -61,7 +61,7 @@ struct acr_r352_ls_func {void (*generate_bl_desc)(const struct nvkm_acr *,const struct ls_ucode_img *,u64 ,void *);u32 bl_desc_size; -void (*post_run)(const struct nvkm_acr *,const struct nvkm_secboot *); +int (*post_run)(const struct nvkm_acr *,const struct nvkm_secboot *);u32 lhdr_flags; };
drm/nouveau/nvkm/subdev/secboot/ls_ucode.h +2 -2
@@ -150,8 +150,8 @@ struct fw_bl_desc {int acr_ls_ucode_load_fecs (const struct nvkm_secboot *,struct ls_ucode_img *);int acr_ls_ucode_load_gpccs (const struct nvkm_secboot *,struct ls_ucode_img *);int acr_ls_ucode_load_pmu (const struct nvkm_secboot *,struct ls_ucode_img *); -void acr_ls_pmu_post_run (const struct nvkm_acr *,const struct nvkm_secboot *); +int acr_ls_pmu_post_run (const struct nvkm_acr *,const struct nvkm_secboot *);int acr_ls_ucode_load_sec2 (const struct nvkm_secboot *,struct ls_ucode_img *); -void acr_ls_sec2_post_run (const struct nvkm_acr *,const struct nvkm_secboot *); +int acr_ls_sec2_post_run (const struct nvkm_acr *,const struct nvkm_secboot *);#endif
drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c +18 -5
@@ -73,7 +73,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,return 0 ; } -static void +static int acr_ls_msgqueue_post_run (struct nvkm_msgqueue *queue,struct nvkm_falcon *falcon,u32 addr_args) {
@@ -85,6 +85,8 @@ acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,nvkm_falcon_load_dmem (falcon, buf, addr_args, cmdline_size,0 );/* rearm the queue so it will wait for the init message */ nvkm_msgqueue_reinit (queue); + +return 0 ; }int
@@ -106,14 +108,19 @@ acr_ls_ucode_load_pmu(const struct nvkm_secboot *sb, struct ls_ucode_img *img)return 0 ; } -void +int acr_ls_pmu_post_run (const struct nvkm_acr *acr,const struct nvkm_secboot *sb) {struct nvkm_device *device = sb->subdev.device;struct nvkm_pmu *pmu = device->pmu;u32 addr_args = pmu->falcon->data.limit -NVKM_MSGQUEUE_CMDLINE_SIZE ; +int ret; + + ret =acr_ls_msgqueue_post_run (pmu->queue, pmu->falcon, addr_args); +if (ret) +return ret; -acr_ls_msgqueue_post_run (pmu->queue, pmu->falcon, addr_args); +return 0 ; }int
@@ -135,13 +142,19 @@ acr_ls_ucode_load_sec2(const struct nvkm_secboot *sb, struct ls_ucode_img *img)return 0 ; } -void +int acr_ls_sec2_post_run (const struct nvkm_acr *acr,const struct nvkm_secboot *sb) {struct nvkm_device *device = sb->subdev.device;struct nvkm_sec2 *sec = device->sec2;/* on SEC arguments are always at the beginning of EMEM */ u32 addr_args =0x01000000 ; +int ret; + + ret =acr_ls_msgqueue_post_run (sec->queue, sec->falcon, addr_args); +if (ret) +return ret; -acr_ls_msgqueue_post_run (sec->queue, sec->falcon, addr_args); + +return 0 ; }
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 4/15 secboot: start LS firmware in post-run hook
In reply to a message not in the archiveThe LS firmware post-run hook is the right place to start said LS firmware. Moving it here also allows to remove special handling in the ACR code.
--- drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 46 -------------------- .../nvkm/subdev/secboot/ls_ucode_msgqueue.c | 49 +++++++++++++++++++++- 2 files changed, 47 insertions(+), 48 deletions(-)
drm/nouveau/nvkm/subdev/secboot/acr_r352.c +0 -46
@@ -26,8 +26,6 @@#include <core/gpuobj.h> #include <core/firmware.h> #include <engine/falcon.h> -#include <subdev/mc.h> -#include <subdev/timer.h> #include <subdev/pmu.h> #include <core/msgqueue.h> #include <engine/sec2.h>
@@ -885,7 +883,6 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb) {const struct nvkm_subdev *subdev = &sb->subdev;unsigned long managed_falcons = acr->base.managed_falcons; -u32 reg;int falcon_id;int ret;
@@ -924,52 +921,9 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb) ret = func->post_run (&acr->base, sb);if (ret)return ret; - } - -/* Re-start ourselves if we are managed */ -if (!nvkm_secboot_is_managed (sb, acr->base.boot_falcon)) -return 0 ; - -/* Enable interrupts */ -nvkm_falcon_wr32 (sb->boot_falcon,0x10 ,0xff ); -nvkm_mc_intr_mask (subdev->device, sb->boot_falcon->owner->index, true); - -/* Start LS firmware on boot falcon */ -nvkm_falcon_start (sb->boot_falcon); - -/* -* There is a bug where the LS firmware sometimes require to be started -* twice (this happens only on SEC). Detect and workaround that -* condition. -* -* Once started, the falcon will end up in STOPPED condition (bit 5) -* if successful, or in HALT condition (bit 4) if not. -*/ -nvkm_msec (subdev->device,1 , - if ((reg = nvkm_rd32(subdev->device, - sb->boot_falcon->addr +0x100 ) - &0x30 ) !=0 ) - break; - ); -if (reg &BIT (4 )) { -nvkm_debug (subdev,"applying workaround for start bug..." ); -nvkm_falcon_start (sb->boot_falcon); -nvkm_msec (subdev->device,1 , - if ((reg = nvkm_rd32(subdev->device, - sb->boot_falcon->addr +0x100 ) - &0x30 ) !=0 ) - break; - ); -if (reg &BIT (4 )) { -nvkm_error (subdev,"%s failed to start\n" , - nvkm_secboot_falcon_name[acr->base.boot_falcon]); -return -EINVAL ; } } -nvkm_debug (subdev,"%s started\n" , - nvkm_secboot_falcon_name[acr->base.boot_falcon]); -return 0 ; }
drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c +47 -2
87 lines not on this page · raw message
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 5/15 secboot/gm20b: specify MC base address as argument
In reply to a message not in the archiveAllow the MC base address to be specified as an argument for the WPR region reading function. GP10B uses a different address layout as GM20B, so this is necessary. Also export the function to be used by GP10B.
--- drm/nouveau/nvkm/subdev/secboot/gm200.h | 3 +++ drm/nouveau/nvkm/subdev/secboot/gm20b.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-)
drm/nouveau/nvkm/subdev/secboot/gm200.h +3 -0
@@ -41,4 +41,7 @@ void *gm200_secboot_dtor(struct nvkm_secboot *);int gm200_secboot_run_blob (struct nvkm_secboot *,struct nvkm_gpuobj *,struct nvkm_falcon *); +/* Tegra-only */ +int gm20b_secboot_tegra_read_wpr (struct gm200_secboot *,u32 ); +#endif
drm/nouveau/nvkm/subdev/secboot/gm20b.c +9 -8
@@ -23,28 +23,29 @@#include "acr.h" #include "gm200.h" +#define TEGRA210_MC_BASE 0x70019000 +#ifdef CONFIG_ARCH_TEGRA -#define TEGRA_MC_BASE 0x70019000#define MC_SECURITY_CARVEOUT2_CFG0 0xc58#define MC_SECURITY_CARVEOUT2_BOM_0 0xc5c#define MC_SECURITY_CARVEOUT2_BOM_HI_0 0xc60#define MC_SECURITY_CARVEOUT2_SIZE_128K 0xc64#define TEGRA_MC_SECURITY_CARVEOUT_CFG_LOCKED (1 << 1)/** -* sb_tegra_read_wpr() - read the WPR registers on Tegra +* gm20b_secboot_tegra_read_wpr() - read the WPR registers on Tegra * * On dGPU, we can manage the WPR region ourselves, but on Tegra the WPR region * is reserved from system memory by the bootloader and irreversibly locked. * This function reads the address and size of the pre-configured WPR region. */ -static int -gm20b_tegra_read_wpr (struct gm200_secboot *gsb) +int +gm20b_secboot_tegra_read_wpr (struct gm200_secboot *gsb,u32 mc_base) {struct nvkm_secboot *sb = &gsb->base;void __iomem *mc;u32 cfg; - mc =ioremap (TEGRA_MC_BASE ,0xd00 ); + mc =ioremap (mc_base,0xd00 );if (!mc) {nvkm_error (&sb->subdev,"Cannot map Tegra MC registers\n" );return PTR_ERR (mc);
@@ -70,8 +71,8 @@ gm20b_tegra_read_wpr(struct gm200_secboot *gsb) return 0; }#else -static int -gm20b_tegra_read_wpr (struct gm200_secboot *gsb) +int +gm20b_secboot_tegra_read_wpr (struct gm200_secboot *gsb,u32 mc_base) {nvkm_error (&gsb->base.subdev,"Tegra support not compiled in\n" );return -EINVAL ;
@@ -84,7 +85,7 @@ gm20b_secboot_oneinit(struct nvkm_secboot *sb)struct gm200_secboot *gsb =gm200_secboot (sb);int ret; - ret =gm20b_tegra_read_wpr (gsb); + ret =gm20b_secboot_tegra_read_wpr (gsb,TEGRA210_MC_BASE );if (ret)return ret;
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 6/15 secboot: add GP10B support
In reply to a message not in the archiveGP10B's secboot is largely similar to GM20B's. Only differences are MC base address and the fact that GPCCS is also securely managed.
--- drm/nouveau/include/nvkm/subdev/secboot.h | 1 + drm/nouveau/nvkm/subdev/secboot/Kbuild | 1 + drm/nouveau/nvkm/subdev/secboot/gp10b.c | 93 +++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drm/nouveau/nvkm/subdev/secboot/gp10b.c
drm/nouveau/include/nvkm/subdev/secboot.h +1 -0
@@ -60,5 +60,6 @@ int nvkm_secboot_reset(struct nvkm_secboot *, unsigned long);int gm200_secboot_new (struct nvkm_device *,int ,struct nvkm_secboot **);int gm20b_secboot_new (struct nvkm_device *,int ,struct nvkm_secboot **);int gp102_secboot_new (struct nvkm_device *,int ,struct nvkm_secboot **); +int gp10b_secboot_new (struct nvkm_device *,int ,struct nvkm_secboot **);#endif
drm/nouveau/nvkm/subdev/secboot/Kbuild +1 -0
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/secboot/acr_r375.o nvkm-y += nvkm/subdev/secboot/gm200.o nvkm-y += nvkm/subdev/secboot/gm20b.o nvkm-y += nvkm/subdev/secboot/gp102.o +nvkm-y += nvkm/subdev/secboot/gp10b.o
drm/nouveau/nvkm/subdev/secboot/gp10b.c new file +93 -0
93 lines not on this page · raw message
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 7/15 msgqueue: support for GP10B PMU firmware
In reply to a message not in the archiveThe GP10B firmware is very close to GM20B's. The only difference is that it supports booting multiple falcons. In order to avoid having too much functions and structures shared, implement its support in the same source file as GM20B firmware.
--- drm/nouveau/nvkm/falcon/msgqueue.c | 3 + drm/nouveau/nvkm/falcon/msgqueue.h | 2 + drm/nouveau/nvkm/falcon/msgqueue_0137c63d.c | 112 ++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+)
drm/nouveau/nvkm/falcon/msgqueue.c +3 -0
@@ -501,6 +501,9 @@ nvkm_msgqueue_new(u32 version, struct nvkm_falcon *falcon,case 0x0137c63d : ret =msgqueue_0137c63d_new (falcon, sb, queue);break ; +case 0x0137bca5 : + ret =msgqueue_0137bca5_new (falcon, sb, queue); +break ;case 0x0148cdec : ret =msgqueue_0148cdec_new (falcon, sb, queue);break ;
drm/nouveau/nvkm/falcon/msgqueue.h +2 -0
@@ -205,6 +205,8 @@ void nvkm_msgqueue_process_msgs(struct nvkm_msgqueue *,int msgqueue_0137c63d_new (struct nvkm_falcon *,const struct nvkm_secboot *,struct nvkm_msgqueue **); +int msgqueue_0137bca5_new (struct nvkm_falcon *,const struct nvkm_secboot *, +struct nvkm_msgqueue **);int msgqueue_0148cdec_new (struct nvkm_falcon *,const struct nvkm_secboot *,struct nvkm_msgqueue **);
drm/nouveau/nvkm/falcon/msgqueue_0137c63d.c +112 -0
138 lines not on this page · raw message
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 8/15 fifo: add GP10B support
In reply to a message not in the archiveGP10B's FIFO is similar to GP100's, but only allows 512 channels.
--- drm/nouveau/include/nvkm/engine/fifo.h | 1 + drm/nouveau/nvkm/engine/fifo/Kbuild | 1 + drm/nouveau/nvkm/engine/fifo/gk104.h | 1 + drm/nouveau/nvkm/engine/fifo/gp100.c | 2 +- drm/nouveau/nvkm/engine/fifo/gp10b.c | 41 ++++++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 drm/nouveau/nvkm/engine/fifo/gp10b.c
drm/nouveau/include/nvkm/engine/fifo.h +1 -0
@@ -68,4 +68,5 @@ int gm107_fifo_new(struct nvkm_device *, int, struct nvkm_fifo **);int gm200_fifo_new (struct nvkm_device *,int ,struct nvkm_fifo **);int gm20b_fifo_new (struct nvkm_device *,int ,struct nvkm_fifo **);int gp100_fifo_new (struct nvkm_device *,int ,struct nvkm_fifo **); +int gp10b_fifo_new (struct nvkm_device *,int ,struct nvkm_fifo **);#endif
drm/nouveau/nvkm/engine/fifo/Kbuild +1 -0
@@ -14,6 +14,7 @@ nvkm-y += nvkm/engine/fifo/gm107.o nvkm-y += nvkm/engine/fifo/gm200.o nvkm-y += nvkm/engine/fifo/gm20b.o nvkm-y += nvkm/engine/fifo/gp100.o +nvkm-y += nvkm/engine/fifo/gp10b.o nvkm-y += nvkm/engine/fifo/chan.o nvkm-y += nvkm/engine/fifo/channv50.o
drm/nouveau/nvkm/engine/fifo/gk104.h +1 -0
@@ -83,4 +83,5 @@ extern const struct nvkm_enum gk104_fifo_fault_hubclient[];extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];extern const struct nvkm_enum gm107_fifo_fault_engine[]; +extern const struct nvkm_enum gp100_fifo_fault_engine[];#endif
drm/nouveau/nvkm/engine/fifo/gp100.c +1 -1
@@ -24,7 +24,7 @@#include "gk104.h" #include "changk104.h" -static const struct nvkm_enum +const struct nvkm_enum gp100_fifo_fault_engine[] = { {0x01 ,"DISPLAY" }, {0x03 ,"IFB" ,NULL ,NVKM_ENGINE_IFB },
drm/nouveau/nvkm/engine/fifo/gp10b.c new file +41 -0
41 lines not on this page · raw message
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 9/15 fb: add GP10B support
In reply to a message not in the archiveGP10B's FB is largely compatible with the GP100 implementation, and only requires a few additional register inits.
--- drm/nouveau/include/nvkm/subdev/fb.h | 1 + drm/nouveau/nvkm/subdev/fb/Kbuild | 1 + drm/nouveau/nvkm/subdev/fb/gp10b.c | 38 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 drm/nouveau/nvkm/subdev/fb/gp10b.c
drm/nouveau/include/nvkm/subdev/fb.h +1 -0
@@ -97,6 +97,7 @@ int gm200_fb_new(struct nvkm_device *, int, struct nvkm_fb **);int gm20b_fb_new (struct nvkm_device *,int ,struct nvkm_fb **);int gp100_fb_new (struct nvkm_device *,int ,struct nvkm_fb **);int gp102_fb_new (struct nvkm_device *,int ,struct nvkm_fb **); +int gp10b_fb_new (struct nvkm_device *,int ,struct nvkm_fb **);#include <subdev/bios.h> #include <subdev/bios/ramcfg.h>
drm/nouveau/nvkm/subdev/fb/Kbuild +1 -0
@@ -28,6 +28,7 @@ nvkm-y += nvkm/subdev/fb/gm200.o nvkm-y += nvkm/subdev/fb/gm20b.o nvkm-y += nvkm/subdev/fb/gp100.o nvkm-y += nvkm/subdev/fb/gp102.o +nvkm-y += nvkm/subdev/fb/gp10b.o nvkm-y += nvkm/subdev/fb/ram.o nvkm-y += nvkm/subdev/fb/ramnv04.o
drm/nouveau/nvkm/subdev/fb/gp10b.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ +#include "gf100.h" + +static const struct nvkm_fb_func +gp10b_fb = { + .dtor = gf100_fb_dtor, + .oneinit = gf100_fb_oneinit, + .init = gm200_fb_init, + .init_page = gm200_fb_init_page, + .intr = gf100_fb_intr, + .memtype_valid = gf100_fb_memtype_valid, +}; + +int +gp10b_fb_new (struct nvkm_device *device,int index,struct nvkm_fb **pfb) +{ +return gf100_fb_new_ (&gp10b_fb, device, index, pfb); +}
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 10/15 mc: add GP10B support
In reply to a message not in the archiveGP10B's MC is compatible with GP100's, but engines need to be explicitly put out of ELPG during init.
--- drm/nouveau/include/nvkm/subdev/mc.h | 1 + drm/nouveau/nvkm/subdev/mc/Kbuild | 1 + drm/nouveau/nvkm/subdev/mc/gp100.c | 17 ++++++++---- drm/nouveau/nvkm/subdev/mc/gp10b.c | 50 ++++++++++++++++++++++++++++++++++++ drm/nouveau/nvkm/subdev/mc/priv.h | 6 +++++ 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 drm/nouveau/nvkm/subdev/mc/gp10b.c
drm/nouveau/include/nvkm/subdev/mc.h +1 -0
@@ -29,4 +29,5 @@ int gf100_mc_new(struct nvkm_device *, int, struct nvkm_mc **);int gk104_mc_new (struct nvkm_device *,int ,struct nvkm_mc **);int gk20a_mc_new (struct nvkm_device *,int ,struct nvkm_mc **);int gp100_mc_new (struct nvkm_device *,int ,struct nvkm_mc **); +int gp10b_mc_new (struct nvkm_device *,int ,struct nvkm_mc **);#endif
drm/nouveau/nvkm/subdev/mc/Kbuild +1 -0
@@ -11,3 +11,4 @@ nvkm-y += nvkm/subdev/mc/gf100.o nvkm-y += nvkm/subdev/mc/gk104.o nvkm-y += nvkm/subdev/mc/gk20a.o nvkm-y += nvkm/subdev/mc/gp100.o +nvkm-y += nvkm/subdev/mc/gp10b.o
drm/nouveau/nvkm/subdev/mc/gp100.c +12 -5
@@ -42,7 +42,7 @@ gp100_mc_intr_update(struct gp100_mc *mc) } } -static void +void gp100_mc_intr_unarm (struct nvkm_mc *base) {struct gp100_mc *mc =gp100_mc (base);
@@ -53,7 +53,7 @@ gp100_mc_intr_unarm(struct nvkm_mc *base)spin_unlock_irqrestore (&mc->lock, flags); } -static void +void gp100_mc_intr_rearm (struct nvkm_mc *base) {struct gp100_mc *mc =gp100_mc (base);
@@ -64,7 +64,7 @@ gp100_mc_intr_rearm(struct nvkm_mc *base)spin_unlock_irqrestore (&mc->lock, flags); } -static void +void gp100_mc_intr_mask (struct nvkm_mc *base,u32 mask,u32 intr) {struct gp100_mc *mc =gp100_mc (base);
@@ -87,13 +87,14 @@ gp100_mc = { };int -gp100_mc_new (struct nvkm_device *device,int index,struct nvkm_mc **pmc) +gp100_mc_new_ (const struct nvkm_mc_func *func,struct nvkm_device *device, +int index,struct nvkm_mc **pmc) {struct gp100_mc *mc;if (!(mc =kzalloc (sizeof (*mc),GFP_KERNEL )))return -ENOMEM ; -nvkm_mc_ctor (&gp100_mc, device, index, &mc->base); +nvkm_mc_ctor (func, device, index, &mc->base); *pmc = &mc->base;spin_lock_init (&mc->lock);
@@ -101,3 +102,9 @@ gp100_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) mc->mask =0x7fffffff ;return 0 ; } + +int +gp100_mc_new (struct nvkm_device *device,int index,struct nvkm_mc **pmc) +{ +return gp100_mc_new_ (&gp100_mc, device, index, pmc); +}
drm/nouveau/nvkm/subdev/mc/gp10b.c new file +50 -0
50 lines not on this page · raw message
drm/nouveau/nvkm/subdev/mc/priv.h +6 -0
@@ -41,12 +41,18 @@ extern const struct nvkm_mc_map nv17_mc_reset[];void nv44_mc_init (struct nvkm_mc *);void nv50_mc_init (struct nvkm_mc *); +void gk104_mc_init (struct nvkm_mc *);void gf100_mc_intr_unarm (struct nvkm_mc *);void gf100_mc_intr_rearm (struct nvkm_mc *);void gf100_mc_intr_mask (struct nvkm_mc *,u32 ,u32 );u32 gf100_mc_intr_stat (struct nvkm_mc *);void gf100_mc_unk260 (struct nvkm_mc *,u32 ); +void gp100_mc_intr_unarm (struct nvkm_mc *); +void gp100_mc_intr_rearm (struct nvkm_mc *); +void gp100_mc_intr_mask (struct nvkm_mc *,u32 ,u32 ); +int gp100_mc_new_ (const struct nvkm_mc_func *,struct nvkm_device *,int , +struct nvkm_mc **);extern const struct nvkm_mc_map gk104_mc_intr[];extern const struct nvkm_mc_map gk104_mc_reset[];
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 11/15 ibus: add GP10B support
In reply to a message not in the archiveGP10B requires a specific initialization sequence due to the absence of devinit.
--- drm/nouveau/include/nvkm/subdev/ibus.h | 1 + drm/nouveau/nvkm/subdev/ibus/Kbuild | 1 + drm/nouveau/nvkm/subdev/ibus/gp10b.c | 59 ++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 drm/nouveau/nvkm/subdev/ibus/gp10b.c
drm/nouveau/include/nvkm/subdev/ibus.h +1 -0
@@ -7,4 +7,5 @@ int gf117_ibus_new(struct nvkm_device *, int, struct nvkm_subdev **);int gk104_ibus_new (struct nvkm_device *,int ,struct nvkm_subdev **);int gk20a_ibus_new (struct nvkm_device *,int ,struct nvkm_subdev **);int gm200_ibus_new (struct nvkm_device *,int ,struct nvkm_subdev **); +int gp10b_ibus_new (struct nvkm_device *,int ,struct nvkm_subdev **);#endif
drm/nouveau/nvkm/subdev/ibus/Kbuild +1 -0
@@ -3,3 +3,4 @@ nvkm-y += nvkm/subdev/ibus/gf117.o nvkm-y += nvkm/subdev/ibus/gk104.o nvkm-y += nvkm/subdev/ibus/gk20a.o nvkm-y += nvkm/subdev/ibus/gm200.o +nvkm-y += nvkm/subdev/ibus/gp10b.o
drm/nouveau/nvkm/subdev/ibus/gp10b.c new file +59 -0
59 lines not on this page · raw message
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 12/15 gr: support for GP10B
In reply to a message not in the archiveGR is similar to GP100, with a few unavailable registers.
--- drm/nouveau/include/nvkm/engine/gr.h | 1 + drm/nouveau/nvkm/engine/gr/Kbuild | 1 + drm/nouveau/nvkm/engine/gr/gf100.h | 4 +++ drm/nouveau/nvkm/engine/gr/gp100.c | 13 ++++++-- drm/nouveau/nvkm/engine/gr/gp102.c | 1 + drm/nouveau/nvkm/engine/gr/gp10b.c | 59 ++++++++++++++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 drm/nouveau/nvkm/engine/gr/gp10b.c
drm/nouveau/include/nvkm/engine/gr.h +1 -0
@@ -44,4 +44,5 @@ int gm200_gr_new(struct nvkm_device *, int, struct nvkm_gr **);int gm20b_gr_new (struct nvkm_device *,int ,struct nvkm_gr **);int gp100_gr_new (struct nvkm_device *,int ,struct nvkm_gr **);int gp102_gr_new (struct nvkm_device *,int ,struct nvkm_gr **); +int gp10b_gr_new (struct nvkm_device *,int ,struct nvkm_gr **);#endif
drm/nouveau/nvkm/engine/gr/Kbuild +1 -0
@@ -33,6 +33,7 @@ nvkm-y += nvkm/engine/gr/gm200.o nvkm-y += nvkm/engine/gr/gm20b.o nvkm-y += nvkm/engine/gr/gp100.o nvkm-y += nvkm/engine/gr/gp102.o +nvkm-y += nvkm/engine/gr/gp10b.o nvkm-y += nvkm/engine/gr/ctxnv40.o nvkm-y += nvkm/engine/gr/ctxnv50.o
drm/nouveau/nvkm/engine/gr/gf100.h +4 -0
@@ -125,6 +125,7 @@ struct gf100_gr_func {void (*init_rop_active_fbps)(struct gf100_gr *);void (*init_ppc_exceptions)(struct gf100_gr *);void (*init_swdx_pes_mask)(struct gf100_gr *); +void (*init_num_active_ltcs)(struct gf100_gr *);void (*set_hww_esr_report_mask)(struct gf100_gr *);const struct gf100_gr_pack *mmio;struct {
@@ -301,4 +302,7 @@ extern const struct gf100_gr_init gm107_gr_init_cbm_0[];void gm107_gr_init_bios (struct gf100_gr *);void gm200_gr_init_gpc_mmu (struct gf100_gr *); + +void gp100_gr_init_num_active_ltcs (struct gf100_gr *gr); +#endif
drm/nouveau/nvkm/engine/gr/gp100.c +11 -2
@@ -40,6 +40,15 @@ gp100_gr_init_rop_active_fbps(struct gf100_gr *gr)nvkm_mask (device,0x408958 ,0x0000000f , fbp_count);/* crop */ } +void +gp100_gr_init_num_active_ltcs (struct gf100_gr *gr) +{ +struct nvkm_device *device = gr->base.engine.subdev.device; + +nvkm_wr32 (device,GPC_BCAST (0x08ac ),nvkm_rd32 (device,0x100800 )); +nvkm_wr32 (device,GPC_BCAST (0x033c ),nvkm_rd32 (device,0x100804 )); +} +int gp100_gr_init (struct gf100_gr *gr) {
@@ -81,8 +90,7 @@ gp100_gr_init(struct gf100_gr *gr) }nvkm_wr32 (device,GPC_BCAST (0x3fd4 ), magicgpc918); -nvkm_wr32 (device,GPC_BCAST (0x08ac ),nvkm_rd32 (device,0x100800 )); -nvkm_wr32 (device,GPC_BCAST (0x033c ),nvkm_rd32 (device,0x100804 )); + gr->func->init_num_active_ltcs (gr); gr->func->init_rop_active_fbps (gr);if (gr->func->init_swdx_pes_mask)
@@ -154,6 +162,7 @@ gp100_gr = { .init_gpc_mmu = gm200_gr_init_gpc_mmu, .init_rop_active_fbps = gp100_gr_init_rop_active_fbps, .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, + .init_num_active_ltcs = gp100_gr_init_num_active_ltcs, .rops = gm200_gr_rops, .ppc_nr = 2, .grctx = &gp100_grctx,
drm/nouveau/nvkm/engine/gr/gp102.c +1 -0
@@ -47,6 +47,7 @@ gp102_gr = { .init_rop_active_fbps = gp100_gr_init_rop_active_fbps, .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, .init_swdx_pes_mask = gp102_gr_init_swdx_pes_mask, + .init_num_active_ltcs = gp100_gr_init_num_active_ltcs, .rops = gm200_gr_rops, .ppc_nr = 3, .grctx = &gp102_grctx,
drm/nouveau/nvkm/engine/gr/gp10b.c new file +59 -0
59 lines not on this page · raw message
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 13/15 platform: make VDD regulator optional
In reply to a message not in the archiveGP10B's power is managed by generic PM domains, so it does not require a VDD regulator. Add this option into the chip function structure.
--- drm/nouveau/include/nvkm/core/tegra.h | 4 ++++ drm/nouveau/nouveau_platform.c | 2 ++ drm/nouveau/nvkm/engine/device/tegra.c | 31 ++++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 9 deletions(-)
drm/nouveau/include/nvkm/core/tegra.h +4 -0
@@ -42,6 +42,10 @@ struct nvkm_device_tegra_func {* Whether the chip requires a reference clock */ bool require_ref_clk; +/* +* Whether the chip requires the VDD regulator +*/ +bool require_vdd; }; int nvkm_device_tegra_new(const struct nvkm_device_tegra_func *,
drm/nouveau/nouveau_platform.c +2 -0
@@ -53,10 +53,12 @@ static int nouveau_platform_remove(struct platform_device *pdev)#if IS_ENABLED (CONFIG_OF )static const struct nvkm_device_tegra_func gk20a_platform_data = { .iommu_bit =34 , + .require_vdd = true, };static const struct nvkm_device_tegra_func gm20b_platform_data = { .iommu_bit =34 , + .require_vdd = true, .require_ref_clk = true, };
drm/nouveau/nvkm/engine/device/tegra.c +22 -9
@@ -28,9 +28,11 @@ nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) {int ret; - ret =regulator_enable (tdev->vdd); -if (ret) - goto err_power; +if (tdev->vdd) { + ret =regulator_enable (tdev->vdd); +if (ret) + goto err_power; + } ret =clk_prepare_enable (tdev->clk);if (ret)
@@ -67,7 +69,8 @@ err_clk_pwr: err_clk_ref:clk_disable_unprepare (tdev->clk); err_clk: -regulator_disable (tdev->vdd); +if (tdev->vdd) +regulator_disable (tdev->vdd); err_power:return ret; }
@@ -75,6 +78,8 @@ err_power:static int nvkm_device_tegra_power_down (struct nvkm_device_tegra *tdev) { +int ret; +reset_control_assert (tdev->rst);udelay (10 );
@@ -84,7 +89,13 @@ nvkm_device_tegra_power_down(struct nvkm_device_tegra *tdev)clk_disable_unprepare (tdev->clk);udelay (10 ); -return regulator_disable (tdev->vdd); +if (tdev->vdd) { + ret =regulator_disable (tdev->vdd); +if (ret) +return ret; + } + +return 0 ; } static void
@@ -264,10 +275,12 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, tdev->func = func; tdev->pdev = pdev; - tdev->vdd =devm_regulator_get (&pdev->dev,"vdd" ); -if (IS_ERR (tdev->vdd)) { - ret =PTR_ERR (tdev->vdd); - goto free; +if (func->require_vdd) { + tdev->vdd =devm_regulator_get (&pdev->dev,"vdd" ); +if (IS_ERR (tdev->vdd)) { + ret =PTR_ERR (tdev->vdd); + goto free; + } } tdev->rst =devm_reset_control_get (&pdev->dev,"gpu" );
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 14/15 platform: support for probing GP10B
In reply to a message not in the archive--- drm/nouveau/nouveau_platform.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drm/nouveau/nouveau_platform.c +10 -0
@@ -62,6 +62,12 @@ static const struct nvkm_device_tegra_func gm20b_platform_data = { .require_ref_clk = true, }; +static const struct nvkm_device_tegra_func gp10b_platform_data = { + .iommu_bit =36 , +/* power provided by generic PM domains */ + .require_vdd = false, +}; +static const struct of_device_id nouveau_platform_match[] = { { .compatible ="nvidia,gk20a" ,
@@ -71,6 +77,10 @@ static const struct of_device_id nouveau_platform_match[] = { .compatible = "nvidia,gm20b", .data = &gm20b_platform_data, }, + { + .compatible = "nvidia,gp10b", + .data = &gp10b_platform_data, + }, { } };
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 15/15 core: recognise GP10B chipset
In reply to a message not in the archive--- drm/nouveau/nvkm/engine/device/base.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drm/nouveau/nvkm/engine/device/base.c +24 -0
@@ -2286,6 +2286,29 @@ nv136_chipset = { .sw = gf100_sw_new, }; +static const struct nvkm_device_chip +nv13b_chipset = { + .name ="GP10B" , + .bar = gk20a_bar_new, + .bus = gf100_bus_new, + .fb = gp10b_fb_new, + .fuse = gm107_fuse_new, + .ibus = gp10b_ibus_new, + .imem = gk20a_instmem_new, + .ltc = gp100_ltc_new, + .mc = gp10b_mc_new, + .mmu = gf100_mmu_new, + .secboot = gp10b_secboot_new, + .pmu = gm20b_pmu_new, + .timer = gk20a_timer_new, + .top = gk104_top_new, + .ce[2 ] = gp102_ce_new, + .dma = gf119_dma_new, + .fifo = gp10b_fifo_new, + .gr = gp10b_gr_new, + .sw = gf100_sw_new, +}; +static int nvkm_device_event_ctor (struct nvkm_object *object,void *data,u32 size,struct nvkm_notify *notify)
@@ -2724,6 +2747,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,case 0x132 : device->chip = &nv132_chipset;break ;case 0x134 : device->chip = &nv134_chipset;break ;case 0x136 : device->chip = &nv136_chipset;break ; +case 0x13b : device->chip = &nv13b_chipset;break ;default :nvdev_error (device,"unknown chipset (%08x)\n" , boot0); goto done;
Signature · 6 lines
2.12.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau