lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAOTY_-ndxjR1UQ4NQvxN3tVgT8t-cZb27j0U9Y7Q9CufUDc8Q@mail.gmail.com>
Date:   Tue, 4 Aug 2020 23:55:57 +0800
From:   Chun-Kuang Hu <chunkuang.hu@...nel.org>
To:     Neal Liu <neal.liu@...iatek.com>
Cc:     Chun-Kuang Hu <chunkuang.hu@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        devicetree@...r.kernel.org,
        wsd_upstream <wsd_upstream@...iatek.com>,
        lkml <linux-kernel@...r.kernel.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v4 2/2] soc: mediatek: add mtk-devapc driver

Neal Liu <neal.liu@...iatek.com> 於 2020年8月4日 週二 上午10:08寫道:
>
> On Tue, 2020-08-04 at 00:04 +0800, Chun-Kuang Hu wrote:
> > Hi, Neal:
> >
> > Neal Liu <neal.liu@...iatek.com> 於 2020年8月3日 週一 下午12:01寫道:
> > >
> > > Hi Chun-Kuang,
> > >
> > > On Sat, 2020-08-01 at 08:12 +0800, Chun-Kuang Hu wrote:
> > > > Hi, Neal:
> > > >
> > > > This patch is for "mediatek,mt6779-devapc", so I think commit title
> > > > should show the SoC ID.
> > >
> > > Okay, I'll change title to 'soc:mediatek: add mt6779 devapc driver'.
> > >
> > > >
> > > > Neal Liu <neal.liu@...iatek.com> 於 2020年7月29日 週三 下午4:29寫道:
> > > > >
> > > > > 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@...iatek.com>
> > > > > ---
> > > >
> > > > [snip]
> > > >
> > > > > +
> > > > > +struct mtk_devapc_context {
> > > > > +       struct device *dev;
> > > > > +       u32 vio_idx_num;
> > > > > +       void __iomem *devapc_pd_base;
> > > > > +       struct mtk_devapc_vio_info *vio_info;
> > > > > +       const struct mtk_devapc_pd_offset *offset;
> > > > > +       const struct mtk_devapc_vio_dbgs *vio_dbgs;
> > > > > +};
> > > >
> > > > I think this structure should separate the constant part. The constant part is:
> > > >
> > > > struct mtk_devapc_data {
> > > >     const u32 vio_idx_num;
> > > >     const struct mtk_devapc_pd_offset *offset; /* I would like to
> > > > remove struct mtk_devapc_pd_offset and directly put its member into
> > > > this structure */
> > > >     const struct mtk_devapc_vio_dbgs *vio_dbgs; /* This may disappear */
> > > > };
> > > >
> > > > And the context is:
> > > >
> > > > struct mtk_devapc_context {
> > > >     struct device *dev;
> > > >     void __iomem *devapc_pd_base;
> > > >     const struct mtk_devapc_data *data;
> > > > };
> > > >
> > > > So when you define this, you would not waste memory to store non-constant data.
> > > >
> > > > static const struct mtk_devapc_data devapc_mt6779 = {
> > > >  .vio_idx_num = 510,
> > > >  .offset = &mt6779_pd_offset,
> > > >  .vio_dbgs = &mt6779_vio_dbgs,
> > > > };
> > > >
> > >
> > > Sorry, I still don't understand why this refactoring will not waste
> > > memory to store non-constant data. Could you explain more details?
> > > To my understanding, we still also have to allocate memory to store dev
> > > & devapc_pd_base.
> >
> > In some situation, it is. You make the non-constant data a global
> > variable. I think the context data should be dynamic allocated. If
> > this driver is not probed, the non-constant data occupy the memory.
> >
>
> I got your point! In this case, we can save these 2 data structure
> space, right?
>
> struct device *dev;
> void __iomem *devapc_pd_base;

Right.

>
> I'll refactoring this data structures on next patch. Thanks !
>
> > Regards,
> > Chun-Kuang.
> >
> > >
> > > > Regards,
> > > > Chun-Kuang.
> > > >
> > > > > +
> > > > > +#endif /* __MTK_DEVAPC_H__ */
> > > > > --
> > > > > 1.7.9.5
> > > > > _______________________________________________
> > > > > Linux-mediatek mailing list
> > > > > Linux-mediatek@...ts.infradead.org
> > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
> > >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ