devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
To: Neal Liu <neal.liu@mediatek.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	devicetree@vger.kernel.org,
	wsd_upstream <wsd_upstream@mediatek.com>,
	linux-kernel <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: devapc: add devapc-mt6873 driver
Date: Thu, 25 Jun 2020 14:19:02 +0800	[thread overview]
Message-ID: <CAAOTY_-hfQFL_CRHTC7RxOLSe0BYzWf_f-QUvjBp4JjaAcX1PA@mail.gmail.com> (raw)
In-Reply-To: <1592559720-8482-3-git-send-email-neal.liu@mediatek.com>

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?

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);
> +}
> +

      parent reply	other threads:[~2020-06-25  6:19 UTC|newest]

Thread overview: 12+ 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
2020-06-20 23:36       ` Chun-Kuang Hu
2020-06-23  4:02         ` Neal Liu
2020-06-22 10:05   ` Matthias Brugger
2020-06-24  8:08     ` Neal Liu
2020-06-25  6:19   ` Chun-Kuang Hu [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=CAAOTY_-hfQFL_CRHTC7RxOLSe0BYzWf_f-QUvjBp4JjaAcX1PA@mail.gmail.com \
    --to=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=neal.liu@mediatek.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).