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

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

 



Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx> 於 2020年6月15日 週一 下午10:14寫道:
>
> Hi, Neal:
>
> Neal Liu <neal.liu@xxxxxxxxxxxx> 於 2020年6月15日 週一 上午10:43寫道:
> >
> > Hi Chun-Kuang,
> >
> >
> > On Sun, 2020-06-14 at 11:26 +0800, Chun-Kuang Hu wrote:
> > > Hi, Neal:
> > >
> > > Neal Liu <neal.liu@xxxxxxxxxxxx> 於 2020年6月9日 週二 下午6:25寫道:
> > > >
> > > > 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@xxxxxxxxxxxx>
> > > > ---
> > >
> > > [snip]
> > >
> > > > +
> > > > +       /* 50 */
> > > > +       {-1, -1, 50, "OOB_way_en", true},
> > > > +       {-1, -1, 51, "OOB_way_en", true},
> > > > +       {-1, -1, 52, "OOB_way_en", true},
> > > > +       {-1, -1, 53, "OOB_way_en", true},
> > > > +       {-1, -1, 54, "OOB_way_en", true},
> > > > +       {-1, -1, 55, "OOB_way_en", true},
> > > > +       {-1, -1, 56, "Decode_error", true},
> > > > +       {-1, -1, 57, "Decode_error", true},
> > > > +       {-1, -1, 58, "DISP_PWM", false},
> > > > +       {-1, -1, 59, "IMP_IIC_WRAP", false},
> > > > +
> > > > +       /* 60 */
> > > > +       {-1, -1, 60, "DEVICE_APC_PERI_PAR__AO", false},
> > > > +       {-1, -1, 61, "DEVICE_APC_PERI_PAR_PDN", false},
> > >
> > > You does not process the item whose enable_vio_irq is false, so I
> > > think you should remove these items and remove enable_vio_irq because
> > > the rest item's enable_vio_irq would always be true.
> >
> > In some users, they can decide which slaves they want to enable or
> > disable violation irq in different product. We remain this property for
> > compatibility.
>
> I think in upstream version, you could still remove enable_vio_irq and
> process all items. For downstream case, users could remove items they
> does not interest in.
>
> >
> > >
> > > > +};
> > > > +
> > > > +static struct mtk_device_num mtk6873_devices_num[] = {
> > > > +       {SLAVE_TYPE_INFRA, VIO_SLAVE_NUM_INFRA},
> > > > +       {SLAVE_TYPE_PERI, VIO_SLAVE_NUM_PERI},
> > > > +       {SLAVE_TYPE_PERI2, VIO_SLAVE_NUM_PERI2},
> > > > +       {SLAVE_TYPE_PERI_PAR, VIO_SLAVE_NUM_PERI_PAR},
> > > > +};
> > > > +
> > > > +static struct PERIAXI_ID_INFO peri_mi_id_to_master[] = {
> > > > +       {"THERM2",       { 0, 0, 0 } },
> > > > +       {"SPM",          { 0, 1, 0 } },
> > > > +       {"CCU",          { 0, 0, 1 } },
> > > > +       {"THERM",        { 0, 1, 1 } },
> > > > +       {"SPM_DRAMC",    { 1, 1, 0 } },
> > >
> > > The bits { 1, 1, 0 } equal to a number 0x3, I thiink you should use a
> > > number instead of bits and everything would be more easy.
> >
> > We would like to keep it because the bit value contains more than 0/1,
> > it might be '2' in some cases. '2' means it can be 0 or 1. This totally
> > by hardware design & implementation.
>
> Upstream the patch that has dont-care-bits, otherwise, use a number for this.
> Even there is dont-care-bits, I have a better way to process it. Here
> is an example that has dont-care-bits:
>
> + {"Tinysys",         { 0, 1, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0 } },
>
> I could use a { value, mask } pair for this case,
>
> value = 0x0002; /* value for care bits */
> mask = 0x3c02; /* mask for care bits */

Sorry, this would be

mask = 0x3c0f; /* mask for care bits */

>
> So the compare statement would be
>
> if ((bus_id & mask) == value)
>
> So you could get rid of the second for-loop and reduce the processing
> time in irq handler.
>
> Regards,
> Chun-Kuang.




[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