Message ID | 20200711064846.16007-2-yong.wu@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | MT8192 IOMMU support | expand |
On 11/07/2020 08:48, Yong Wu wrote: > Put all the macros about smi larb/port togethers, this is a preparing > patch for extending LARB_NR and adding new dom-id support. > > Signed-off-by: Yong Wu <yong.wu@mediatek.com> > --- > include/dt-bindings/memory/mt2712-larb-port.h | 2 +- > include/dt-bindings/memory/mt6779-larb-port.h | 2 +- > include/dt-bindings/memory/mt8173-larb-port.h | 2 +- > include/dt-bindings/memory/mt8183-larb-port.h | 2 +- > include/dt-bindings/memory/mtk-smi-larb-port.h | 15 +++++++++++++++ > 5 files changed, 19 insertions(+), 4 deletions(-) > create mode 100644 include/dt-bindings/memory/mtk-smi-larb-port.h > > diff --git a/include/dt-bindings/memory/mt2712-larb-port.h b/include/dt-bindings/memory/mt2712-larb-port.h > index 6f9aa7349cef..b6b2c6bf4459 100644 > --- a/include/dt-bindings/memory/mt2712-larb-port.h > +++ b/include/dt-bindings/memory/mt2712-larb-port.h > @@ -6,7 +6,7 @@ > #ifndef __DTS_IOMMU_PORT_MT2712_H > #define __DTS_IOMMU_PORT_MT2712_H > > -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > +#include <dt-bindings/memory/mtk-smi-larb-port.h> > > #define M4U_LARB0_ID 0 > #define M4U_LARB1_ID 1 > diff --git a/include/dt-bindings/memory/mt6779-larb-port.h b/include/dt-bindings/memory/mt6779-larb-port.h > index 2ad0899fbf2f..60f57f54393e 100644 > --- a/include/dt-bindings/memory/mt6779-larb-port.h > +++ b/include/dt-bindings/memory/mt6779-larb-port.h > @@ -7,7 +7,7 @@ > #ifndef _DTS_IOMMU_PORT_MT6779_H_ > #define _DTS_IOMMU_PORT_MT6779_H_ > > -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > +#include <dt-bindings/memory/mtk-smi-larb-port.h> > > #define M4U_LARB0_ID 0 > #define M4U_LARB1_ID 1 > diff --git a/include/dt-bindings/memory/mt8173-larb-port.h b/include/dt-bindings/memory/mt8173-larb-port.h > index 9f31ccfeca21..d8c99c946053 100644 > --- a/include/dt-bindings/memory/mt8173-larb-port.h > +++ b/include/dt-bindings/memory/mt8173-larb-port.h > @@ -6,7 +6,7 @@ > #ifndef __DTS_IOMMU_PORT_MT8173_H > #define __DTS_IOMMU_PORT_MT8173_H > > -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > +#include <dt-bindings/memory/mtk-smi-larb-port.h> > > #define M4U_LARB0_ID 0 > #define M4U_LARB1_ID 1 > diff --git a/include/dt-bindings/memory/mt8183-larb-port.h b/include/dt-bindings/memory/mt8183-larb-port.h > index 2c579f305162..275c095a6fd6 100644 > --- a/include/dt-bindings/memory/mt8183-larb-port.h > +++ b/include/dt-bindings/memory/mt8183-larb-port.h > @@ -6,7 +6,7 @@ > #ifndef __DTS_IOMMU_PORT_MT8183_H > #define __DTS_IOMMU_PORT_MT8183_H > > -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > +#include <dt-bindings/memory/mtk-smi-larb-port.h> > > #define M4U_LARB0_ID 0 > #define M4U_LARB1_ID 1 > diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h > new file mode 100644 > index 000000000000..2ec7fe5ce4e9 > --- /dev/null > +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Copyright (c) 2020 MediaTek Inc. > + * Author: Yong Wu <yong.wu@mediatek.com> > + */ > +#ifndef __DTS_MTK_IOMMU_PORT_H_ > +#define __DTS_MTK_IOMMU_PORT_H_ > + > +#define MTK_LARB_NR_MAX 16 include/soc/mediatek/smi.h has the very same define. Should smi.h include this file? Regards, Matthias > + > +#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > +#define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0xf) > +#define MTK_M4U_TO_PORT(id) ((id) & 0x1f) > + > +#endif >
On Mon, Jul 13, 2020 at 2:06 AM Matthias Brugger <matthias.bgg@gmail.com> wrote: > > > > On 11/07/2020 08:48, Yong Wu wrote: > > Put all the macros about smi larb/port togethers, this is a preparing > > patch for extending LARB_NR and adding new dom-id support. > > > > Signed-off-by: Yong Wu <yong.wu@mediatek.com> > > --- > > include/dt-bindings/memory/mt2712-larb-port.h | 2 +- > > include/dt-bindings/memory/mt6779-larb-port.h | 2 +- > > include/dt-bindings/memory/mt8173-larb-port.h | 2 +- > > include/dt-bindings/memory/mt8183-larb-port.h | 2 +- > > include/dt-bindings/memory/mtk-smi-larb-port.h | 15 +++++++++++++++ > > 5 files changed, 19 insertions(+), 4 deletions(-) > > create mode 100644 include/dt-bindings/memory/mtk-smi-larb-port.h > > > > ... > > diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h > > new file mode 100644 > > index 000000000000..2ec7fe5ce4e9 > > --- /dev/null > > +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h > > @@ -0,0 +1,15 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * Copyright (c) 2020 MediaTek Inc. > > + * Author: Yong Wu <yong.wu@mediatek.com> > > + */ > > +#ifndef __DTS_MTK_IOMMU_PORT_H_ > > +#define __DTS_MTK_IOMMU_PORT_H_ > > + > > +#define MTK_LARB_NR_MAX 16 > > include/soc/mediatek/smi.h has the very same define. > Should smi.h include this file? > > Regards, > Matthias > Looks like this is being addressed in patch 5 in this series ([05/21] iommu/mediatek: Use the common mtk-smi-larb-port.h) That said, should that patch be merged into this one? > > + > > +#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > > +#define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0xf) > > +#define MTK_M4U_TO_PORT(id) ((id) & 0x1f) > > + > > +#endif > >
On Sun, 2020-07-12 at 20:06 +0200, Matthias Brugger wrote: > > On 11/07/2020 08:48, Yong Wu wrote: > > Put all the macros about smi larb/port togethers, this is a preparing > > patch for extending LARB_NR and adding new dom-id support. > > > > Signed-off-by: Yong Wu <yong.wu@mediatek.com> [...] > > diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h > > new file mode 100644 > > index 000000000000..2ec7fe5ce4e9 > > --- /dev/null > > +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h > > @@ -0,0 +1,15 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * Copyright (c) 2020 MediaTek Inc. > > + * Author: Yong Wu <yong.wu@mediatek.com> > > + */ > > +#ifndef __DTS_MTK_IOMMU_PORT_H_ > > +#define __DTS_MTK_IOMMU_PORT_H_ > > + > > +#define MTK_LARB_NR_MAX 16 > > include/soc/mediatek/smi.h has the very same define. > Should smi.h include this file? If smi.h include this file, it also is ok. then these two files(mtk_iommu.h and mtk_smi.c) don't need include this. the MTK_LARB_NR_MAX only is used in mtk_iommu.h and mtk_smi.c directly, thus I use that two files include this file currently. locally I think it may be helpful for readable. is this ok? > > Regards, > Matthias > > > + > > +#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > > +#define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0xf) > > +#define MTK_M4U_TO_PORT(id) ((id) & 0x1f) > > + > > +#endif > > > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek
On Mon, 2020-07-13 at 13:43 +0800, Pi-Hsun Shih wrote: > On Mon, Jul 13, 2020 at 2:06 AM Matthias Brugger <matthias.bgg@gmail.com> wrote: > > > > > > > > On 11/07/2020 08:48, Yong Wu wrote: > > > Put all the macros about smi larb/port togethers, this is a preparing > > > patch for extending LARB_NR and adding new dom-id support. > > > > > > Signed-off-by: Yong Wu <yong.wu@mediatek.com> > > > --- > > > include/dt-bindings/memory/mt2712-larb-port.h | 2 +- > > > include/dt-bindings/memory/mt6779-larb-port.h | 2 +- > > > include/dt-bindings/memory/mt8173-larb-port.h | 2 +- > > > include/dt-bindings/memory/mt8183-larb-port.h | 2 +- > > > include/dt-bindings/memory/mtk-smi-larb-port.h | 15 +++++++++++++++ > > > 5 files changed, 19 insertions(+), 4 deletions(-) > > > create mode 100644 include/dt-bindings/memory/mtk-smi-larb-port.h > > > > > > ... > > > diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h > > > new file mode 100644 > > > index 000000000000..2ec7fe5ce4e9 > > > --- /dev/null > > > +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h > > > @@ -0,0 +1,15 @@ > > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > > +/* > > > + * Copyright (c) 2020 MediaTek Inc. > > > + * Author: Yong Wu <yong.wu@mediatek.com> > > > + */ > > > +#ifndef __DTS_MTK_IOMMU_PORT_H_ > > > +#define __DTS_MTK_IOMMU_PORT_H_ > > > + > > > +#define MTK_LARB_NR_MAX 16 > > > > include/soc/mediatek/smi.h has the very same define. > > Should smi.h include this file? > > > > Regards, > > Matthias > > > > Looks like this is being addressed in patch 5 in this series ([05/21] > iommu/mediatek: Use the common mtk-smi-larb-port.h) > That said, should that patch be merged into this one? At the beginning, I really did like this. But checkpatch will complain like that: WARNING:DT_SPLIT_BINDING_PATCH: DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst > > > > > > + > > > +#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) > > > +#define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0xf) > > > +#define MTK_M4U_TO_PORT(id) ((id) & 0x1f) > > > + > > > +#endif > > >
On Sat, 11 Jul 2020 14:48:26 +0800, Yong Wu wrote: > Put all the macros about smi larb/port togethers, this is a preparing > patch for extending LARB_NR and adding new dom-id support. > > Signed-off-by: Yong Wu <yong.wu@mediatek.com> > --- > include/dt-bindings/memory/mt2712-larb-port.h | 2 +- > include/dt-bindings/memory/mt6779-larb-port.h | 2 +- > include/dt-bindings/memory/mt8173-larb-port.h | 2 +- > include/dt-bindings/memory/mt8183-larb-port.h | 2 +- > include/dt-bindings/memory/mtk-smi-larb-port.h | 15 +++++++++++++++ > 5 files changed, 19 insertions(+), 4 deletions(-) > create mode 100644 include/dt-bindings/memory/mtk-smi-larb-port.h > Acked-by: Rob Herring <robh@kernel.org>
diff --git a/include/dt-bindings/memory/mt2712-larb-port.h b/include/dt-bindings/memory/mt2712-larb-port.h index 6f9aa7349cef..b6b2c6bf4459 100644 --- a/include/dt-bindings/memory/mt2712-larb-port.h +++ b/include/dt-bindings/memory/mt2712-larb-port.h @@ -6,7 +6,7 @@ #ifndef __DTS_IOMMU_PORT_MT2712_H #define __DTS_IOMMU_PORT_MT2712_H -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) +#include <dt-bindings/memory/mtk-smi-larb-port.h> #define M4U_LARB0_ID 0 #define M4U_LARB1_ID 1 diff --git a/include/dt-bindings/memory/mt6779-larb-port.h b/include/dt-bindings/memory/mt6779-larb-port.h index 2ad0899fbf2f..60f57f54393e 100644 --- a/include/dt-bindings/memory/mt6779-larb-port.h +++ b/include/dt-bindings/memory/mt6779-larb-port.h @@ -7,7 +7,7 @@ #ifndef _DTS_IOMMU_PORT_MT6779_H_ #define _DTS_IOMMU_PORT_MT6779_H_ -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) +#include <dt-bindings/memory/mtk-smi-larb-port.h> #define M4U_LARB0_ID 0 #define M4U_LARB1_ID 1 diff --git a/include/dt-bindings/memory/mt8173-larb-port.h b/include/dt-bindings/memory/mt8173-larb-port.h index 9f31ccfeca21..d8c99c946053 100644 --- a/include/dt-bindings/memory/mt8173-larb-port.h +++ b/include/dt-bindings/memory/mt8173-larb-port.h @@ -6,7 +6,7 @@ #ifndef __DTS_IOMMU_PORT_MT8173_H #define __DTS_IOMMU_PORT_MT8173_H -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) +#include <dt-bindings/memory/mtk-smi-larb-port.h> #define M4U_LARB0_ID 0 #define M4U_LARB1_ID 1 diff --git a/include/dt-bindings/memory/mt8183-larb-port.h b/include/dt-bindings/memory/mt8183-larb-port.h index 2c579f305162..275c095a6fd6 100644 --- a/include/dt-bindings/memory/mt8183-larb-port.h +++ b/include/dt-bindings/memory/mt8183-larb-port.h @@ -6,7 +6,7 @@ #ifndef __DTS_IOMMU_PORT_MT8183_H #define __DTS_IOMMU_PORT_MT8183_H -#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) +#include <dt-bindings/memory/mtk-smi-larb-port.h> #define M4U_LARB0_ID 0 #define M4U_LARB1_ID 1 diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h b/include/dt-bindings/memory/mtk-smi-larb-port.h new file mode 100644 index 000000000000..2ec7fe5ce4e9 --- /dev/null +++ b/include/dt-bindings/memory/mtk-smi-larb-port.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2020 MediaTek Inc. + * Author: Yong Wu <yong.wu@mediatek.com> + */ +#ifndef __DTS_MTK_IOMMU_PORT_H_ +#define __DTS_MTK_IOMMU_PORT_H_ + +#define MTK_LARB_NR_MAX 16 + +#define MTK_M4U_ID(larb, port) (((larb) << 5) | (port)) +#define MTK_M4U_TO_LARB(id) (((id) >> 5) & 0xf) +#define MTK_M4U_TO_PORT(id) ((id) & 0x1f) + +#endif
Put all the macros about smi larb/port togethers, this is a preparing patch for extending LARB_NR and adding new dom-id support. Signed-off-by: Yong Wu <yong.wu@mediatek.com> --- include/dt-bindings/memory/mt2712-larb-port.h | 2 +- include/dt-bindings/memory/mt6779-larb-port.h | 2 +- include/dt-bindings/memory/mt8173-larb-port.h | 2 +- include/dt-bindings/memory/mt8183-larb-port.h | 2 +- include/dt-bindings/memory/mtk-smi-larb-port.h | 15 +++++++++++++++ 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 include/dt-bindings/memory/mtk-smi-larb-port.h