diff options
author | Aurora zuma automerger <aurora-zuma-automerger@google.com> | 2023-07-20 11:59:02 +0000 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-03 14:58:59 -0700 |
commit | da392e26dc0810f886f92df4a6d1afd6ff35377d (patch) | |
tree | 12746cd8b2c798377dccc2ba9433db95bf99040a /gxp-dma-iommu.c | |
parent | eb3acbdb4097299fcb90b49c3e124af0fc3ff6c8 (diff) | |
download | zuma-android-gs-akita-5.15-android14-d2.tar.gz |
gxp: [Copybara Auto Merge] Merge branch 'zuma' into 'android14-gs-pixel-5.15-udc-qpr1'android-u-qpr2-beta-3_r0.8android-u-qpr2-beta-3.1_r0.8android-u-qpr2-beta-2_r0.8android-u-qpr2-beta-1_r0.7android-u-qpr1-beta-2_r0.8android-u-qpr1-beta-2.2_r0.7android-u-qpr1-beta-2.1_r0.8android-14.0.0_r0.81android-14.0.0_r0.80android-14.0.0_r0.77android-14.0.0_r0.67android-14.0.0_r0.57android-14.0.0_r0.45android-14.0.0_r0.38android-gs-shusky-5.15-u-qpr1-beta2android-gs-shusky-5.15-android14-qpr2-betaandroid-gs-shusky-5.15-android14-qpr2android-gs-shusky-5.15-android14-qpr1-betaandroid-gs-shusky-5.15-android14-qpr1android-gs-akita-5.15-android14-d2
gxp: deactivate context on domain detaching
Introduce gxp_soc_deactivate_context to disable context that not in use.
Note this function would be meaningless if SSMT is clamp-mode, under
which case we have no way to disable contexts since we don't know which
(physical) core will be scheduled to use by MCU.
Test: gxp_smoke_test * 4 passed. Can see faults if without calling
soc_activacte_context as expected.
Bug: 290708708
(cherry picked from commit 4696e2562571d007c839dd9e575281ab407ac9ac)
GitOrigin-RevId: e678afd3102c5ee61bc9c8b149a1683c51df37f0
Change-Id: I17453f940adb0656ee720bed155daa16ea1b41af
Diffstat (limited to 'gxp-dma-iommu.c')
-rw-r--r-- | gxp-dma-iommu.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/gxp-dma-iommu.c b/gxp-dma-iommu.c index 1d60888..5aa8b5d 100644 --- a/gxp-dma-iommu.c +++ b/gxp-dma-iommu.c @@ -68,17 +68,16 @@ static int dma_info_to_prot(enum dma_data_direction dir, bool coherent, } } -static int gxp_dma_ssmt_program(struct gxp_dev *gxp, - struct iommu_domain *domain, uint core_list) +static int gxp_dma_ssmt_activate(struct gxp_dev *gxp, + struct iommu_domain *domain, uint core_list) { struct gxp_dma_iommu_manager *mgr = container_of( gxp->dma_mgr, struct gxp_dma_iommu_manager, dma_mgr); - int pasid; uint core; + int pasid = iommu_aux_get_pasid(domain, gxp->dev); /* Program VID only when cores are managed by us. */ if (gxp_is_direct_mode(gxp) || gxp_core_boot(gxp)) { - pasid = iommu_aux_get_pasid(domain, gxp->dev); for (core = 0; core < GXP_NUM_CORES; core++) if (BIT(core) & core_list) { dev_dbg(gxp->dev, "Assign core%u to PASID %d\n", @@ -86,11 +85,30 @@ static int gxp_dma_ssmt_program(struct gxp_dev *gxp, gxp_ssmt_set_core_vid(&mgr->ssmt, core, pasid); } } else { - gxp_ssmt_set_bypass(&mgr->ssmt); + gxp_ssmt_activate_scid(&mgr->ssmt, pasid); } return 0; } +static void gxp_dma_ssmt_deactivate(struct gxp_dev *gxp, + struct iommu_domain *domain, uint core_list) +{ + struct gxp_dma_iommu_manager *mgr = container_of( + gxp->dma_mgr, struct gxp_dma_iommu_manager, dma_mgr); + uint core; + int pasid = iommu_aux_get_pasid(domain, gxp->dev); + + /* Program VID only when cores are managed by us. */ + if (gxp_is_direct_mode(gxp) || gxp_core_boot(gxp)) { + for (core = 0; core < GXP_NUM_CORES; core++) { + if (BIT(core) & core_list) + gxp_ssmt_set_core_vid(&mgr->ssmt, core, 0); + } + } else { + gxp_ssmt_deactivate_scid(&mgr->ssmt, pasid); + } +} + /* Fault handler */ static int sysmmu_fault_handler(struct iommu_fault *fault, void *token) @@ -284,14 +302,15 @@ int gxp_dma_domain_attach_device(struct gxp_dev *gxp, ret = iommu_aux_attach_device(gdomain->domain, gxp->dev); if (ret) goto out; - gxp_dma_ssmt_program(gxp, gdomain->domain, core_list); + gxp_dma_ssmt_activate(gxp, gdomain->domain, core_list); out: return ret; } -void gxp_dma_domain_detach_device(struct gxp_dev *gxp, - struct gcip_iommu_domain *gdomain) +void gxp_dma_domain_detach_device(struct gxp_dev *gxp, struct gcip_iommu_domain *gdomain, + uint core_list) { + gxp_dma_ssmt_deactivate(gxp, gdomain->domain, core_list); iommu_aux_detach_device(gdomain->domain, gxp->dev); } |