From 261baf5aa92fe1fb8a0a30d7e971117ed5b36de9 Mon Sep 17 00:00:00 2001 From: Aurora pro automerger Date: Tue, 9 Aug 2022 03:58:01 +0000 Subject: [Copybara Auto Merge] gxp: release TPU file after VD stop Bug: 241085004 gxp: increase the ref to TPU FD on TPU buffer map Bug: 241085004 (repeat) gxp: Fail to start a VD if initial mapping fails Bug: 241090227 gxp: Only (un)map telem if enabled on vd start/stop Bug: 241090227 (repeat) gxp: Cancel last worker when power req queue is full Bug: 240533763 gxp: Disallow /d/gxp/firmware_run if VDs are running Bug: 240764261 gxp: Cleanup FW data on VD creation failure Bug: 240999290 gxp: Review feedback from 7/21 release Bug: 240315433 gxp: Map telemetry buffs before writing descriptor Bug: 239640408 gxp: Re-enable telemetry mapping changes GitOrigin-RevId: c8adc76aa961c881ae2c41d71ec045308939e233 Change-Id: I17eb0436551f00fcf8ba41b24713002b947ab08f --- gxp-debugfs.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gxp-debugfs.c') diff --git a/gxp-debugfs.c b/gxp-debugfs.c index a04a3f2..e1b199b 100644 --- a/gxp-debugfs.c +++ b/gxp-debugfs.c @@ -77,6 +77,7 @@ static int gxp_firmware_run_set(void *data, u64 val) struct gxp_dev *gxp = (struct gxp_dev *) data; struct gxp_client *client; int ret = 0; + uint core; ret = gxp_firmware_request_if_needed(gxp); if (ret) { @@ -93,6 +94,22 @@ static int gxp_firmware_run_set(void *data, u64 val) goto out; } + /* + * Since this debugfs node destroys, then creates new fw_data, + * and runs firmware on every DSP core, it cannot be run if + * any of the cores already has a VD running on it. + */ + down_write(&gxp->vd_semaphore); + for (core = 0; core < GXP_NUM_CORES; core++) { + if (gxp->core_to_vd[core]) { + dev_err(gxp->dev, + "Unable to run firmware with debugfs while other clients are running\n"); + ret = -EBUSY; + up_write(&gxp->vd_semaphore); + goto out; + } + } + /* * Cleanup any bad state or corruption the device might've * caused @@ -125,7 +142,6 @@ static int gxp_firmware_run_set(void *data, u64 val) AUR_MEM_UNDEFINED, AUR_MEM_UNDEFINED); - down_write(&gxp->vd_semaphore); ret = gxp_vd_start(gxp->debugfs_client->vd); up_write(&gxp->vd_semaphore); if (ret) { -- cgit v1.2.3