arm_smmuv3_cell_init and arm_smmuv3_cell_exit calls iterate over all
iommu_units to process the ones with SMMUV3 type.

After the loop, it unconditionally issues commands with first element
of smmu. This causes Unhandled HYP exception  while enabling jailhouse.

Fix this by issuing the sync command only if the iommu is SMMUV3 type.

Signed-off-by: Nikhil Devshatwar <[email protected]>
---
 hypervisor/arch/arm64/smmu-v3.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/hypervisor/arch/arm64/smmu-v3.c b/hypervisor/arch/arm64/smmu-v3.c
index dd33bda2..3889d32b 100644
--- a/hypervisor/arch/arm64/smmu-v3.c
+++ b/hypervisor/arch/arm64/smmu-v3.c
@@ -1057,12 +1057,12 @@ static int arm_smmuv3_cell_init(struct cell *cell)
                        if (ret)
                                return ret;
                }
-       }
 
-       cmd.opcode      = CMDQ_OP_TLBI_S12_VMALL;
-       cmd.tlbi.vmid   = cell->config->id;
-       arm_smmu_cmdq_issue_cmd(smmu, &cmd);
-       arm_smmu_cmdq_issue_sync(smmu);
+               cmd.opcode      = CMDQ_OP_TLBI_S12_VMALL;
+               cmd.tlbi.vmid   = cell->config->id;
+               arm_smmu_cmdq_issue_cmd(&smmu[i], &cmd);
+               arm_smmu_cmdq_issue_sync(&smmu[i]);
+       }
 
        return 0;
 }
@@ -1084,12 +1084,12 @@ static void arm_smmuv3_cell_exit(struct cell *cell)
                for_each_stream_id(sid, cell->config, j) {
                        arm_smmu_uninit_ste(&smmu[i], sid, cell->config->id);
                }
-       }
 
-       cmd.opcode      = CMDQ_OP_TLBI_S12_VMALL;
-       cmd.tlbi.vmid   = cell->config->id;
-       arm_smmu_cmdq_issue_cmd(smmu, &cmd);
-       arm_smmu_cmdq_issue_sync(smmu);
+               cmd.opcode      = CMDQ_OP_TLBI_S12_VMALL;
+               cmd.tlbi.vmid   = cell->config->id;
+               arm_smmu_cmdq_issue_cmd(&smmu[i], &cmd);
+               arm_smmu_cmdq_issue_sync(&smmu[i]);
+       }
 }
 
 static int arm_smmuv3_init(void)
-- 
2.17.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20191230132406.19985-3-nikhil.nd%40ti.com.

Reply via email to