The halt interrupt must be cleared after ACR is run, otherwise the LS
PMU firmware will not be able to run.

Signed-off-by: Alexandre Courbot <acour...@nvidia.com>
---
 drm/nouveau/nvkm/subdev/secboot/acr_r352.c |  3 ++-
 drm/nouveau/nvkm/subdev/secboot/base.c     | 31 +++++++++++------------
 drm/nouveau/nvkm/subdev/secboot/priv.h     |  1 +-
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c 
b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
index ddecec4d2dbc..534a2a5ec25b 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
@@ -766,6 +766,8 @@ acr_r352_shutdown(struct acr_r352 *acr, struct nvkm_secboot 
*sb)
 static int
 acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
 {
+       struct nvkm_subdev *subdev = &sb->subdev;
+       struct nvkm_device *device = subdev->device;
        int ret;
 
        if (sb->wpr_set)
@@ -778,6 +780,7 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct 
nvkm_secboot *sb)
 
        nvkm_debug(&sb->subdev, "running HS load blob\n");
        ret = sb->func->run_blob(sb, acr->load_blob);
+       nvkm_secboot_falcon_clear_halt_interrupt(device, sb->base);
        if (ret)
                return ret;
        nvkm_debug(&sb->subdev, "HS load blob completed\n");
diff --git a/drm/nouveau/nvkm/subdev/secboot/base.c 
b/drm/nouveau/nvkm/subdev/secboot/base.c
index 3e48eb93197d..56c752c9ef42 100644
--- a/drm/nouveau/nvkm/subdev/secboot/base.c
+++ b/drm/nouveau/nvkm/subdev/secboot/base.c
@@ -93,21 +93,6 @@
  */
 
 static int
-falcon_clear_halt_interrupt(struct nvkm_device *device, u32 base)
-{
-       int ret;
-
-       /* clear halt interrupt */
-       nvkm_mask(device, base + 0x004, 0x10, 0x10);
-       /* wait until halt interrupt is cleared */
-       ret = nvkm_wait_msec(device, 10, base + 0x008, 0x10, 0x0);
-       if (ret < 0)
-               return ret;
-
-       return 0;
-}
-
-static int
 falcon_wait_idle(struct nvkm_device *device, u32 base)
 {
        int ret;
@@ -203,13 +188,27 @@ nvkm_secboot_falcon_run(struct nvkm_secboot *sb)
        ret = nvkm_rd32(device, sb->base + 0x040);
        if (ret) {
                nvkm_error(&sb->subdev, "ACR boot failed, ret 0x%08x", ret);
-               falcon_clear_halt_interrupt(device, sb->base);
                return -EINVAL;
        }
 
        return 0;
 }
 
+int
+nvkm_secboot_falcon_clear_halt_interrupt(struct nvkm_device *device, u32 base)
+{
+       int ret;
+
+       /* clear halt interrupt */
+       nvkm_mask(device, base + 0x004, 0x10, 0x10);
+       /* wait until halt interrupt is cleared */
+       ret = nvkm_wait_msec(device, 10, base + 0x008, 0x10, 0x0);
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
 /**
  * nvkm_secboot_reset() - reset specified falcon
  */
diff --git a/drm/nouveau/nvkm/subdev/secboot/priv.h 
b/drm/nouveau/nvkm/subdev/secboot/priv.h
index 75a3b995fdbb..bd397896bd54 100644
--- a/drm/nouveau/nvkm/subdev/secboot/priv.h
+++ b/drm/nouveau/nvkm/subdev/secboot/priv.h
@@ -37,6 +37,7 @@ int nvkm_secboot_ctor(const struct nvkm_secboot_func *, 
struct nvkm_acr *,
                      struct nvkm_device *, int, struct nvkm_secboot *);
 int nvkm_secboot_falcon_reset(struct nvkm_secboot *);
 int nvkm_secboot_falcon_run(struct nvkm_secboot *);
+int nvkm_secboot_falcon_clear_halt_interrupt(struct nvkm_device *, u32);
 
 
 struct flcn_u64 {
-- 
git-series 0.8.10
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to