summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com>2021-09-19 22:18:21 -0700
committerSecurityBot <android-nexus-securitybot@system.gserviceaccount.com>2021-09-19 22:18:21 -0700
commit43ec0564e7ee9d0ccf24a451b7f696a8507582b8 (patch)
treea825813fb8b1c78160ebb2d816361bd7521dccc1
parentf3671dbacc743e84c5d35f1c3b35945b4c654a51 (diff)
parent5dfa29f9563875b8acc4b9d50b1137bee6babb0e (diff)
downloadedgetpu-43ec0564e7ee9d0ccf24a451b7f696a8507582b8.tar.gz
Merge android12-gs-pixel-5.10-sc-qpr1 into android12-gs-pixel-5.10-sc-qpr2
SBMerger: 379283923 Change-Id: I0c1598cd422a1f2f2bfcaebed37b8afad19cca2a Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
-rw-r--r--drivers/edgetpu/abrolhos-firmware.c6
-rw-r--r--drivers/edgetpu/edgetpu-device-group.c11
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/edgetpu/abrolhos-firmware.c b/drivers/edgetpu/abrolhos-firmware.c
index 5a8cd2e..063d010 100644
--- a/drivers/edgetpu/abrolhos-firmware.c
+++ b/drivers/edgetpu/abrolhos-firmware.c
@@ -108,10 +108,8 @@ static int abrolhos_firmware_prepare_run(struct edgetpu_firmware *et_fw,
tpu_state = gsa_send_tpu_cmd(abpdev->gsa_dev, GSA_TPU_GET_STATE);
if (tpu_state < GSA_TPU_STATE_INACTIVE) {
- etdev_warn(etdev, "GSA failed to retrieve current status: %d\n",
- tpu_state);
- etdev_warn(etdev, "Assuming device is inactive\n");
- tpu_state = GSA_TPU_STATE_INACTIVE;
+ etdev_err(etdev, "GSA failed to retrieve current status: %d\n", tpu_state);
+ return tpu_state;
}
etdev_dbg(etdev, "GSA Reports TPU state: %d\n", tpu_state);
diff --git a/drivers/edgetpu/edgetpu-device-group.c b/drivers/edgetpu/edgetpu-device-group.c
index 1b668f5..3b8ddf8 100644
--- a/drivers/edgetpu/edgetpu-device-group.c
+++ b/drivers/edgetpu/edgetpu-device-group.c
@@ -1433,6 +1433,7 @@ int edgetpu_device_group_map(struct edgetpu_device_group *group,
const u32 mmu_flags = map_to_mmu_flags(flags) | EDGETPU_MMU_HOST;
int i;
bool readonly;
+ tpu_addr_t tpu_addr;
if (!valid_dma_direction(flags & EDGETPU_MAP_DIR_MASK))
return -EINVAL;
@@ -1488,15 +1489,19 @@ int edgetpu_device_group_map(struct edgetpu_device_group *group,
goto error;
}
+ /*
+ * @map can be freed (by another thread) once it's added to the mappings, record the address
+ * before that.
+ */
+ tpu_addr = map->device_address;
ret = edgetpu_mapping_add(&group->host_mappings, map);
if (ret) {
- etdev_dbg(etdev, "duplicate mapping %u:0x%llx",
- group->workload_id, map->device_address);
+ etdev_dbg(etdev, "duplicate mapping %u:0x%llx", group->workload_id, tpu_addr);
goto error;
}
mutex_unlock(&group->lock);
- arg->device_address = map->device_address;
+ arg->device_address = tpu_addr;
kvfree(pages);
return 0;