From: Jan Kiszka <jan.kis...@siemens.com>

Bail out if they happen during cell init - apparently configuration
errors. Skip the entry if that happens during cell exit (unlikely).

[Andrea Bastoni: Fix double negative in trace_error]
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---

Changes in v2:
 - folded Andrea's fix in

 hypervisor/arch/arm64/smmu.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/hypervisor/arch/arm64/smmu.c b/hypervisor/arch/arm64/smmu.c
index b89291e7..9d1e5556 100644
--- a/hypervisor/arch/arm64/smmu.c
+++ b/hypervisor/arch/arm64/smmu.c
@@ -863,10 +863,8 @@ static int arm_smmu_cell_init(struct cell *cell)
                for_each_smmu_sid(sid, cell->config, n) {
                        ret = arm_smmu_find_sme(*sid,
                                                smmu_device[i].arm_sid_mask, i);
-                       if (ret < 0) {
-                               printk("arm_smmu_find_sme error %d\n", ret);
-                               continue;
-                       }
+                       if (ret < 0)
+                               return trace_error(ret);
                        idx = ret;
 
                        s2cr[idx].type = type;
@@ -898,7 +896,7 @@ static void arm_smmu_cell_exit(struct cell *cell)
 {
        const __u32 *sid;
        unsigned int n;
-       int ret, idx, i;
+       int idx, i;
        int cbndx = cell->config->id;
        struct jailhouse_iommu *iommu;
 
@@ -919,11 +917,10 @@ static void arm_smmu_cell_exit(struct cell *cell)
                arm_smmu_tlb_sync_global(&smmu_device[i]);
 
                for_each_smmu_sid(sid, cell->config, n) {
-                       ret = arm_smmu_find_sme(*sid,
+                       idx = arm_smmu_find_sme(*sid,
                                                smmu_device[i].arm_sid_mask, i);
-                       if (ret < 0)
-                               printk("arm_smmu_find_sme error %d\n", ret);
-                       idx = ret;
+                       if (idx < 0)
+                               continue;
 
                        if (arm_smmu_free_sme(&smmu_device[i], idx))
                                arm_smmu_write_sme(&smmu_device[i], idx);
-- 
2.26.2

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/a6ba34f2-57e9-210e-e250-adbb6145b993%40siemens.com.

Reply via email to