> Subject: [PATCH 7/8] arm64: smmu: Handle arm_smmu_find_sme error
> properly
> 
> From: Jan Kiszka <[email protected]>
> 
> Bail out if they happen during cell init - apparently configuration errors. 
> Skip
> the entry if that happens during cell exit (unlikely).
> 
> Signed-off-by: Jan Kiszka <[email protected]>
> ---
>  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..4c4bb279 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);

Reviewed-by: Peng Fan <[email protected]>

> --
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/DB6PR0402MB2760D6D1E0DE74D85F1C9BF688340%40DB6PR0402MB2760.eurprd04.prod.outlook.com.

Reply via email to