diff options
-rw-r--r-- | drivers/edgetpu/edgetpu-device-group.c | 7 | ||||
-rw-r--r-- | drivers/edgetpu/edgetpu-google-iommu.c | 7 | ||||
-rw-r--r-- | drivers/edgetpu/rio-pm.c | 10 |
3 files changed, 17 insertions, 7 deletions
diff --git a/drivers/edgetpu/edgetpu-device-group.c b/drivers/edgetpu/edgetpu-device-group.c index 3e94dcd..2b97d87 100644 --- a/drivers/edgetpu/edgetpu-device-group.c +++ b/drivers/edgetpu/edgetpu-device-group.c @@ -33,6 +33,7 @@ #include "edgetpu-kci.h" #include "edgetpu-mapping.h" #include "edgetpu-mmu.h" +#include "edgetpu-soc.h" #include "edgetpu-sw-watchdog.h" #include "edgetpu-wakelock.h" #include "edgetpu.h" @@ -83,6 +84,7 @@ static int edgetpu_group_activate(struct edgetpu_device_group *group) return 0; mailbox_id = edgetpu_group_context_id_locked(group); + edgetpu_soc_activate_context(group->etdev, mailbox_id); ret = edgetpu_mailbox_activate(group->etdev, mailbox_id, group->mbox_attr.client_priv, group->vcid, !group->activated); if (ret) { @@ -116,6 +118,11 @@ static void edgetpu_group_deactivate(struct edgetpu_device_group *group) edgetpu_sw_wdt_dec_active_ref(group->etdev); mailbox_id = edgetpu_group_context_id_locked(group); edgetpu_mailbox_deactivate(group->etdev, mailbox_id); + /* + * Deactivate the context to prevent speculative accesses from being issued to a disabled + * context. + */ + edgetpu_soc_deactivate_context(group->etdev, mailbox_id); } /* diff --git a/drivers/edgetpu/edgetpu-google-iommu.c b/drivers/edgetpu/edgetpu-google-iommu.c index 4bf836f..a432783 100644 --- a/drivers/edgetpu/edgetpu-google-iommu.c +++ b/drivers/edgetpu/edgetpu-google-iommu.c @@ -19,7 +19,6 @@ #include "edgetpu-internal.h" #include "edgetpu-mapping.h" #include "edgetpu-mmu.h" -#include "edgetpu-soc.h" #if !defined(EDGETPU_NUM_PREALLOCATED_DOMAINS) #define EDGETPU_NUM_PREALLOCATED_DOMAINS 0 @@ -555,7 +554,6 @@ int edgetpu_mmu_attach_domain(struct edgetpu_dev *etdev, goto err_detach; } - edgetpu_soc_activate_context(etdev, pasid); etiommu->gdomains[pasid] = gdomain; etdomain->pasid = pasid; return 0; @@ -575,11 +573,6 @@ void edgetpu_mmu_detach_domain(struct edgetpu_dev *etdev, if (pasid <= 0 || pasid >= EDGETPU_NCONTEXTS) return; - /* - * Deactivate the context before domain detaching to prevent speculative accesses from being - * issued to a disabled context. - */ - edgetpu_soc_deactivate_context(etdev, pasid); etiommu->gdomains[pasid] = NULL; etdomain->pasid = IOMMU_PASID_INVALID; iommu_aux_detach_device(etdomain->gdomain->domain, etdev->dev); diff --git a/drivers/edgetpu/rio-pm.c b/drivers/edgetpu/rio-pm.c index c50949a..bba5e18 100644 --- a/drivers/edgetpu/rio-pm.c +++ b/drivers/edgetpu/rio-pm.c @@ -83,6 +83,7 @@ static void rio_patch_lpm(struct edgetpu_dev *etdev) EDGETPU_LPM_IMEM_OPS_SET(etdev, 200, 0x0bc95001); EDGETPU_LPM_IMEM_OPS_SET(etdev, 201, 0x14171018); EDGETPU_LPM_IMEM_OPS_SET(etdev, 202, 0x02001118); + /* psm_1_state_table_0_trans_1_next_state */ edgetpu_dev_write_32_sync(etdev, 0x1c2020, 0x00000000); /* psm_1_state_table_0_trans_1_seq_addr */ @@ -93,6 +94,15 @@ static void rio_patch_lpm(struct edgetpu_dev *etdev) edgetpu_dev_write_32_sync(etdev, 0x1c2034, 0x00000001); /* trigger_csr_events_en_5_hi */ edgetpu_dev_write_32_sync(etdev, 0x1c012c, 0x00000003); + + /* + * FRC clocking fix for b/287661979. + * + * Increases the delay between cluster clock enablement and logic + * retention/restore activation. + */ + EDGETPU_LPM_IMEM_OPS_SET(etdev, 3, 0x21261101); + EDGETPU_LPM_IMEM_OPS_SET(etdev, 4, 0x11111005); } static int rio_lpm_up(struct edgetpu_dev *etdev) |