Re: [PATCH v2 2/2] soc: mediatek: add mtk-devapc driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HI, Neal:

Neal Liu <neal.liu@xxxxxxxxxxxx> 於 2020年7月9日 週四 下午5:13寫道:
>
> MediaTek bus fabric provides TrustZone security support and data
> protection to prevent slaves from being accessed by unexpected
> masters.
> The security violation is logged and sent to the processor for
> further analysis or countermeasures.
>
> Any occurrence of security violation would raise an interrupt, and
> it will be handled by mtk-devapc driver. The violation
> information is printed in order to find the murderer.
>
> Signed-off-by: Neal Liu <neal.liu@xxxxxxxxxxxx>
> ---

[snip]

> +
> +/*
> + * mtk_devapc_dump_vio_dbg - shift & dump the violation debug information.
> + */
> +static bool mtk_devapc_dump_vio_dbg(struct mtk_devapc_context *devapc_ctx,
> +                                   int slave_type, int *vio_idx)
> +{
> +       const struct mtk_device_info **device_info;
> +       u32 shift_bit;
> +       int i;
> +
> +       device_info = devapc_ctx->device_info;
> +
> +       for (i = 0; i < get_vio_slave_num(slave_type); i++) {
> +               *vio_idx = device_info[slave_type][i].vio_index;
> +
> +               if (check_vio_mask(devapc_ctx, slave_type, *vio_idx))
> +                       continue;

I guess if one vio_idx is masked, its status would never be true. If
my guess is right, I think you could skip check_vio_mask() and
directly check_vio_status().

> +
> +               if (!check_vio_status(devapc_ctx, slave_type, *vio_idx))
> +                       continue;
> +
> +               shift_bit = get_shift_group(devapc_ctx, slave_type, *vio_idx);
> +
> +               if (!sync_vio_dbg(devapc_ctx, slave_type, shift_bit))
> +                       continue;
> +
> +               devapc_extract_vio_dbg(devapc_ctx, slave_type);
> +
> +               return true;

I think multiple vio_idx would violate at the same time, why just process one?

Regards,
Chun-Kuang.

> +       }
> +
> +       return false;
> +}




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux