diff options
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c index 9e64b7c8b0b2..814f9f2a17ef 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | |||
@@ -491,7 +491,7 @@ acr_r352_prepare_ls_blob(struct acr_r352 *acr, u64 wpr_addr, u32 wpr_size) | |||
491 | struct ls_ucode_img *img, *t; | 491 | struct ls_ucode_img *img, *t; |
492 | unsigned long managed_falcons = acr->base.managed_falcons; | 492 | unsigned long managed_falcons = acr->base.managed_falcons; |
493 | int managed_count = 0; | 493 | int managed_count = 0; |
494 | u32 image_wpr_size; | 494 | u32 image_wpr_size, ls_blob_size; |
495 | int falcon_id; | 495 | int falcon_id; |
496 | int ret; | 496 | int ret; |
497 | 497 | ||
@@ -542,8 +542,17 @@ acr_r352_prepare_ls_blob(struct acr_r352 *acr, u64 wpr_addr, u32 wpr_size) | |||
542 | image_wpr_size = acr->func->ls_fill_headers(acr, &imgs); | 542 | image_wpr_size = acr->func->ls_fill_headers(acr, &imgs); |
543 | image_wpr_size = ALIGN(image_wpr_size, WPR_ALIGNMENT); | 543 | image_wpr_size = ALIGN(image_wpr_size, WPR_ALIGNMENT); |
544 | 544 | ||
545 | ls_blob_size = image_wpr_size; | ||
546 | |||
547 | /* | ||
548 | * If we need a shadow area, allocate twice the size and use the | ||
549 | * upper half as WPR | ||
550 | */ | ||
551 | if (wpr_size == 0 && acr->func->shadow_blob) | ||
552 | ls_blob_size *= 2; | ||
553 | |||
545 | /* Allocate GPU object that will contain the WPR region */ | 554 | /* Allocate GPU object that will contain the WPR region */ |
546 | ret = nvkm_gpuobj_new(subdev->device, image_wpr_size, WPR_ALIGNMENT, | 555 | ret = nvkm_gpuobj_new(subdev->device, ls_blob_size, WPR_ALIGNMENT, |
547 | false, NULL, &acr->ls_blob); | 556 | false, NULL, &acr->ls_blob); |
548 | if (ret) | 557 | if (ret) |
549 | goto cleanup; | 558 | goto cleanup; |
@@ -554,6 +563,9 @@ acr_r352_prepare_ls_blob(struct acr_r352 *acr, u64 wpr_addr, u32 wpr_size) | |||
554 | /* If WPR address and size are not fixed, set them to fit the LS blob */ | 563 | /* If WPR address and size are not fixed, set them to fit the LS blob */ |
555 | if (wpr_size == 0) { | 564 | if (wpr_size == 0) { |
556 | wpr_addr = acr->ls_blob->addr; | 565 | wpr_addr = acr->ls_blob->addr; |
566 | if (acr->func->shadow_blob) | ||
567 | wpr_addr += acr->ls_blob->size / 2; | ||
568 | |||
557 | wpr_size = image_wpr_size; | 569 | wpr_size = image_wpr_size; |
558 | /* | 570 | /* |
559 | * But if the WPR region is set by the bootloader, it is illegal for | 571 | * But if the WPR region is set by the bootloader, it is illegal for |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h index 9ca23c1e3aa9..1b9f5c825c8a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h | |||
@@ -104,6 +104,7 @@ struct acr_r352_func { | |||
104 | u64); | 104 | u64); |
105 | void (*fixup_hs_desc)(struct acr_r352 *, struct nvkm_secboot *, void *); | 105 | void (*fixup_hs_desc)(struct acr_r352 *, struct nvkm_secboot *, void *); |
106 | u32 hs_bl_desc_size; | 106 | u32 hs_bl_desc_size; |
107 | bool shadow_blob; | ||
107 | 108 | ||
108 | struct ls_ucode_img *(*ls_ucode_img_load)(const struct acr_r352 *, | 109 | struct ls_ucode_img *(*ls_ucode_img_load)(const struct acr_r352 *, |
109 | enum nvkm_secboot_falcon); | 110 | enum nvkm_secboot_falcon); |