All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neal Liu <neal.liu@mediatek.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Neal Liu <neal.liu@mediatek.com>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<devicetree@vger.kernel.org>,
	wsd_upstream <wsd_upstream@mediatek.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] soc: mediatek: add mtk-devapc driver
Date: Thu, 16 Jul 2020 11:42:30 +0800	[thread overview]
Message-ID: <1594870950.5018.3.camel@mtkswgap22> (raw)
In-Reply-To: <CAAOTY_-6d12FUf5XnYco0f0CfeWsb-XjsCESsLixLr_Q=jnc0Q@mail.gmail.com>

Hi Chun-Kuang,

On Thu, 2020-07-16 at 07:46 +0800, Chun-Kuang Hu wrote:
> HI, Neal:
> 
> Neal Liu <neal.liu@mediatek.com> 於 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@mediatek.com>
> > ---
> 
> [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().

No. Even if vio_idx is masked, vio_status will still raise when
violation is triggered.

> 
> > +
> > +               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?

We process each vio_idx for each interrupt.
If there are multiple vio_idx is raised, it will trigger another
interrupt to handle it.

> 
> Regards,
> Chun-Kuang.
> 
> > +       }
> > +
> > +       return false;
> > +}


WARNING: multiple messages have this Message-ID (diff)
From: Neal Liu <neal.liu@mediatek.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: devicetree@vger.kernel.org,
	wsd_upstream <wsd_upstream@mediatek.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Neal Liu <neal.liu@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] soc: mediatek: add mtk-devapc driver
Date: Thu, 16 Jul 2020 11:42:30 +0800	[thread overview]
Message-ID: <1594870950.5018.3.camel@mtkswgap22> (raw)
In-Reply-To: <CAAOTY_-6d12FUf5XnYco0f0CfeWsb-XjsCESsLixLr_Q=jnc0Q@mail.gmail.com>

Hi Chun-Kuang,

On Thu, 2020-07-16 at 07:46 +0800, Chun-Kuang Hu wrote:
> HI, Neal:
> 
> Neal Liu <neal.liu@mediatek.com> 於 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@mediatek.com>
> > ---
> 
> [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().

No. Even if vio_idx is masked, vio_status will still raise when
violation is triggered.

> 
> > +
> > +               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?

We process each vio_idx for each interrupt.
If there are multiple vio_idx is raised, it will trigger another
interrupt to handle it.

> 
> Regards,
> Chun-Kuang.
> 
> > +       }
> > +
> > +       return false;
> > +}

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Neal Liu <neal.liu@mediatek.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: devicetree@vger.kernel.org,
	wsd_upstream <wsd_upstream@mediatek.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Neal Liu <neal.liu@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] soc: mediatek: add mtk-devapc driver
Date: Thu, 16 Jul 2020 11:42:30 +0800	[thread overview]
Message-ID: <1594870950.5018.3.camel@mtkswgap22> (raw)
In-Reply-To: <CAAOTY_-6d12FUf5XnYco0f0CfeWsb-XjsCESsLixLr_Q=jnc0Q@mail.gmail.com>

Hi Chun-Kuang,

On Thu, 2020-07-16 at 07:46 +0800, Chun-Kuang Hu wrote:
> HI, Neal:
> 
> Neal Liu <neal.liu@mediatek.com> 於 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@mediatek.com>
> > ---
> 
> [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().

No. Even if vio_idx is masked, vio_status will still raise when
violation is triggered.

> 
> > +
> > +               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?

We process each vio_idx for each interrupt.
If there are multiple vio_idx is raised, it will trigger another
interrupt to handle it.

> 
> Regards,
> Chun-Kuang.
> 
> > +       }
> > +
> > +       return false;
> > +}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-07-16  3:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  9:12 [PATCH v2] Add MediaTek MT6779 devapc driver Neal Liu
2020-07-09  9:12 ` Neal Liu
2020-07-09  9:12 ` Neal Liu
2020-07-09  9:12 ` [PATCH v2 1/2] dt-bindings: devapc: add bindings for mtk-devapc Neal Liu
2020-07-09  9:12   ` Neal Liu
2020-07-09  9:12   ` Neal Liu
2020-07-10 10:41   ` Matthias Brugger
2020-07-10 10:41     ` Matthias Brugger
2020-07-10 10:41     ` Matthias Brugger
2020-07-14  3:17     ` Neal Liu
2020-07-14  3:17       ` Neal Liu
2020-07-14  3:17       ` Neal Liu
2020-07-09  9:12 ` [PATCH v2 2/2] soc: mediatek: add mtk-devapc driver Neal Liu
2020-07-09  9:12   ` Neal Liu
2020-07-09  9:12   ` Neal Liu
2020-07-09 13:01   ` Chun-Kuang Hu
2020-07-09 13:01     ` Chun-Kuang Hu
2020-07-09 13:01     ` Chun-Kuang Hu
2020-07-10  3:23     ` Neal Liu
2020-07-10  3:23       ` Neal Liu
2020-07-10  3:23       ` Neal Liu
2020-07-10 14:21       ` Chun-Kuang Hu
2020-07-10 14:21         ` Chun-Kuang Hu
2020-07-10 14:21         ` Chun-Kuang Hu
2020-07-13  8:27         ` Neal Liu
2020-07-13  8:27           ` Neal Liu
2020-07-13  8:27           ` Neal Liu
2020-07-13 14:20           ` Chun-Kuang Hu
2020-07-13 14:20             ` Chun-Kuang Hu
2020-07-13 14:20             ` Chun-Kuang Hu
2020-07-14  3:06             ` Neal Liu
2020-07-14  3:06               ` Neal Liu
2020-07-14  3:06               ` Neal Liu
2020-07-10 12:14   ` Matthias Brugger
2020-07-10 12:14     ` Matthias Brugger
2020-07-10 12:14     ` Matthias Brugger
2020-07-13  7:45     ` Neal Liu
2020-07-13  7:45       ` Neal Liu
2020-07-13  7:45       ` Neal Liu
2020-07-13 11:16       ` Matthias Brugger
2020-07-13 11:16         ` Matthias Brugger
2020-07-13 11:16         ` Matthias Brugger
2020-07-14  2:45         ` Neal Liu
2020-07-14  2:45           ` Neal Liu
2020-07-14  2:45           ` Neal Liu
2020-07-15 23:46   ` Chun-Kuang Hu
2020-07-15 23:46     ` Chun-Kuang Hu
2020-07-15 23:46     ` Chun-Kuang Hu
2020-07-16  3:42     ` Neal Liu [this message]
2020-07-16  3:42       ` Neal Liu
2020-07-16  3:42       ` Neal Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1594870950.5018.3.camel@mtkswgap22 \
    --to=neal.liu@mediatek.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=wsd_upstream@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.