linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
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>,
	linux-kernel <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: devapc: add devapc-mt6873 driver
Date: Mon, 29 Jun 2020 14:28:52 +0800	[thread overview]
Message-ID: <1593412132.9213.2.camel@mtkswgap22> (raw)
In-Reply-To: <CAAOTY_-hfQFL_CRHTC7RxOLSe0BYzWf_f-QUvjBp4JjaAcX1PA@mail.gmail.com>

Hi Chun-Kuang,


On Thu, 2020-06-25 at 14:19 +0800, Chun-Kuang Hu wrote:
> Hi, Neal:
> 
> Neal Liu <neal.liu@mediatek.com> 於 2020年6月19日 週五 下午6:01寫道:
> >
> > MT6873 bus frabric provides TrustZone security support and data
> > protection to prevent slaves from being accessed by unexpected
> > masters.
> > The security violations are 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 devapc-mt6873 driver. The violation
> > information is printed in order to find the murderer.
> >
> > Signed-off-by: Neal Liu <neal.liu@mediatek.com>
> > ---
> 
> [snip]
> 
> > +
> > +/*
> > + * sramrom_vio_handler - clean sramrom violation & print violation information
> > + *                      for debugging.
> > + */
> > +static void sramrom_vio_handler(struct mtk_devapc_context *devapc_ctx)
> > +{
> > +       const struct mtk_sramrom_sec_vio_desc *sramrom_vios;
> > +       struct mtk_devapc_vio_info *vio_info;
> > +       struct arm_smccc_res res;
> > +       size_t sramrom_vio_sta;
> > +       int sramrom_vio;
> > +       u32 rw;
> > +
> > +       sramrom_vios = devapc_ctx->soc->sramrom_sec_vios;
> > +       vio_info = devapc_ctx->soc->vio_info;
> > +
> > +       arm_smccc_smc(MTK_SIP_KERNEL_CLR_SRAMROM_VIO,
> > +                     0, 0, 0, 0, 0, 0, 0, &res);
> > +
> 
> This irq handler call arm_smccc_smc() to get into TrustZone, why not
> let the whole irq handler in TrustZone?
> 

I just replied to Matthias, let me try to explain it again.
There is no reason that it should be handed in TrustZone only. And it
has no security issue to handle it from Normal World.

But this functionality is not basic for devapc-mt6873 driver, I'll make
it as another patch.

> Regards,
> Chun-Kuang.
> 
> > +       sramrom_vio = res.a0;
> > +       sramrom_vio_sta = res.a1;
> > +       vio_info->vio_addr = res.a2;
> > +
> > +       if (sramrom_vio == SRAM_VIOLATION)
> > +               pr_info(PFX "SRAM violation is triggered\n");
> > +       else if (sramrom_vio == ROM_VIOLATION)
> > +               pr_info(PFX "ROM violation is triggered\n");
> > +       else
> > +               return;
> > +
> > +       vio_info->master_id = (sramrom_vio_sta & sramrom_vios->vio_id_mask)
> > +                       >> sramrom_vios->vio_id_shift;
> > +       vio_info->domain_id = (sramrom_vio_sta & sramrom_vios->vio_domain_mask)
> > +                       >> sramrom_vios->vio_domain_shift;
> > +       rw = (sramrom_vio_sta & sramrom_vios->vio_rw_mask) >>
> > +                       sramrom_vios->vio_rw_shift;
> > +
> > +       if (rw)
> > +               vio_info->write = 1;
> > +       else
> > +               vio_info->read = 1;
> > +
> > +       pr_info(PFX "%s: master_id:0x%x, domain_id:0x%x, rw:%s, vio_addr:0x%x\n",
> > +               __func__, vio_info->master_id, vio_info->domain_id,
> > +               rw ? "Write" : "Read", vio_info->vio_addr);
> > +}
> > +

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

      reply	other threads:[~2020-06-29  6:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19  9:41 Add MediaTek MT6873 devapc driver Neal Liu
2020-06-19  9:41 ` [PATCH v2 1/2] dt-bindings: devapc: add bindings for devapc-mt6873 Neal Liu
2020-06-29 21:56   ` Rob Herring
2020-06-30  9:30     ` Neal Liu
2020-06-19  9:42 ` [PATCH v2 2/2] soc: mediatek: devapc: add devapc-mt6873 driver Neal Liu
2020-06-19 16:25   ` Chun-Kuang Hu
2020-06-20  3:18     ` Neal Liu
     [not found]   ` <0c8a88a5-3caa-b121-87ee-3396d204fb1b@gmail.com>
2020-06-24  8:08     ` Neal Liu
2020-06-25  6:19   ` Chun-Kuang Hu
2020-06-29  6:28     ` Neal Liu [this message]

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=1593412132.9213.2.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).