All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-03-07 15:56 ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-07 15:56 UTC (permalink / raw)
  To: minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot, irui.wang, AngeloGioacchino Del Regno

The mdp_ipi_comm structure defines a command that is either
PROCESS (start processing) or DEINIT (destroy instance); we
are using this one to send PROCESS or DEINIT commands from Linux
to an MDP instance through a VPU write but, while the first wants
us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
data alignment.

Keeping in mind that these commands are executed immediately
after sending them (hence not chained with others before the
VPU/MDP "actually" start executing), it is fine to simply add
a padding of 4 bytes to this structure: this keeps the same
performance as before, as we're still stack-allocating it,
while avoiding hackery inside of mtk-vpu to ensure alignment
bringing a definitely bigger performance impact.

Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---

This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on Debian Sid.

This is an alternative solution to the mtk-vpu approach, found here:
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com

 drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
index 2cb8cecb3077..b810c96695c8 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
@@ -40,12 +40,14 @@ struct mdp_ipi_init {
  * @ipi_id        : IPI_MDP
  * @ap_inst       : AP mtk_mdp_vpu address
  * @vpu_inst_addr : VPU MDP instance address
+ * @padding       : Alignment padding
  */
 struct mdp_ipi_comm {
 	uint32_t msg_id;
 	uint32_t ipi_id;
 	uint64_t ap_inst;
 	uint32_t vpu_inst_addr;
+	uint32_t padding;
 };
 
 /**
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-03-07 15:56 ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-07 15:56 UTC (permalink / raw)
  To: minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot, irui.wang, AngeloGioacchino Del Regno

The mdp_ipi_comm structure defines a command that is either
PROCESS (start processing) or DEINIT (destroy instance); we
are using this one to send PROCESS or DEINIT commands from Linux
to an MDP instance through a VPU write but, while the first wants
us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
data alignment.

Keeping in mind that these commands are executed immediately
after sending them (hence not chained with others before the
VPU/MDP "actually" start executing), it is fine to simply add
a padding of 4 bytes to this structure: this keeps the same
performance as before, as we're still stack-allocating it,
while avoiding hackery inside of mtk-vpu to ensure alignment
bringing a definitely bigger performance impact.

Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---

This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on Debian Sid.

This is an alternative solution to the mtk-vpu approach, found here:
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com

 drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
index 2cb8cecb3077..b810c96695c8 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
@@ -40,12 +40,14 @@ struct mdp_ipi_init {
  * @ipi_id        : IPI_MDP
  * @ap_inst       : AP mtk_mdp_vpu address
  * @vpu_inst_addr : VPU MDP instance address
+ * @padding       : Alignment padding
  */
 struct mdp_ipi_comm {
 	uint32_t msg_id;
 	uint32_t ipi_id;
 	uint64_t ap_inst;
 	uint32_t vpu_inst_addr;
+	uint32_t padding;
 };
 
 /**
-- 
2.35.1


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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-03-07 15:56 ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-03-07 15:56 UTC (permalink / raw)
  To: minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot, irui.wang, AngeloGioacchino Del Regno

The mdp_ipi_comm structure defines a command that is either
PROCESS (start processing) or DEINIT (destroy instance); we
are using this one to send PROCESS or DEINIT commands from Linux
to an MDP instance through a VPU write but, while the first wants
us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
data alignment.

Keeping in mind that these commands are executed immediately
after sending them (hence not chained with others before the
VPU/MDP "actually" start executing), it is fine to simply add
a padding of 4 bytes to this structure: this keeps the same
performance as before, as we're still stack-allocating it,
while avoiding hackery inside of mtk-vpu to ensure alignment
bringing a definitely bigger performance impact.

Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---

This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on Debian Sid.

This is an alternative solution to the mtk-vpu approach, found here:
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com

 drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
index 2cb8cecb3077..b810c96695c8 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
@@ -40,12 +40,14 @@ struct mdp_ipi_init {
  * @ipi_id        : IPI_MDP
  * @ap_inst       : AP mtk_mdp_vpu address
  * @vpu_inst_addr : VPU MDP instance address
+ * @padding       : Alignment padding
  */
 struct mdp_ipi_comm {
 	uint32_t msg_id;
 	uint32_t ipi_id;
 	uint64_t ap_inst;
 	uint32_t vpu_inst_addr;
+	uint32_t padding;
 };
 
 /**
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
  2022-03-07 15:56 ` AngeloGioacchino Del Regno
  (?)
@ 2022-04-21 11:03   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-04-21 11:03 UTC (permalink / raw)
  To: minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot, irui.wang

Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> The mdp_ipi_comm structure defines a command that is either
> PROCESS (start processing) or DEINIT (destroy instance); we
> are using this one to send PROCESS or DEINIT commands from Linux
> to an MDP instance through a VPU write but, while the first wants
> us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> data alignment.
> 
> Keeping in mind that these commands are executed immediately
> after sending them (hence not chained with others before the
> VPU/MDP "actually" start executing), it is fine to simply add
> a padding of 4 bytes to this structure: this keeps the same
> performance as before, as we're still stack-allocating it,
> while avoiding hackery inside of mtk-vpu to ensure alignment
> bringing a definitely bigger performance impact.
> 
> Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Hello,
is there any issue with this patch?

Regards,
Angelo

> ---
> 
> This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on Debian Sid.
> 
> This is an alternative solution to the mtk-vpu approach, found here:
> https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> 
>   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> index 2cb8cecb3077..b810c96695c8 100644
> --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> @@ -40,12 +40,14 @@ struct mdp_ipi_init {
>    * @ipi_id        : IPI_MDP
>    * @ap_inst       : AP mtk_mdp_vpu address
>    * @vpu_inst_addr : VPU MDP instance address
> + * @padding       : Alignment padding
>    */
>   struct mdp_ipi_comm {
>   	uint32_t msg_id;
>   	uint32_t ipi_id;
>   	uint64_t ap_inst;
>   	uint32_t vpu_inst_addr;
> +	uint32_t padding;
>   };
>   
>   /**


-- 
AngeloGioacchino Del Regno
Software Engineer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-04-21 11:03   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-04-21 11:03 UTC (permalink / raw)
  To: minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot, irui.wang

Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> The mdp_ipi_comm structure defines a command that is either
> PROCESS (start processing) or DEINIT (destroy instance); we
> are using this one to send PROCESS or DEINIT commands from Linux
> to an MDP instance through a VPU write but, while the first wants
> us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> data alignment.
> 
> Keeping in mind that these commands are executed immediately
> after sending them (hence not chained with others before the
> VPU/MDP "actually" start executing), it is fine to simply add
> a padding of 4 bytes to this structure: this keeps the same
> performance as before, as we're still stack-allocating it,
> while avoiding hackery inside of mtk-vpu to ensure alignment
> bringing a definitely bigger performance impact.
> 
> Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Hello,
is there any issue with this patch?

Regards,
Angelo

> ---
> 
> This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on Debian Sid.
> 
> This is an alternative solution to the mtk-vpu approach, found here:
> https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> 
>   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> index 2cb8cecb3077..b810c96695c8 100644
> --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> @@ -40,12 +40,14 @@ struct mdp_ipi_init {
>    * @ipi_id        : IPI_MDP
>    * @ap_inst       : AP mtk_mdp_vpu address
>    * @vpu_inst_addr : VPU MDP instance address
> + * @padding       : Alignment padding
>    */
>   struct mdp_ipi_comm {
>   	uint32_t msg_id;
>   	uint32_t ipi_id;
>   	uint64_t ap_inst;
>   	uint32_t vpu_inst_addr;
> +	uint32_t padding;
>   };
>   
>   /**


-- 
AngeloGioacchino Del Regno
Software Engineer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-04-21 11:03   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 11+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-04-21 11:03 UTC (permalink / raw)
  To: minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot, irui.wang

Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> The mdp_ipi_comm structure defines a command that is either
> PROCESS (start processing) or DEINIT (destroy instance); we
> are using this one to send PROCESS or DEINIT commands from Linux
> to an MDP instance through a VPU write but, while the first wants
> us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> data alignment.
> 
> Keeping in mind that these commands are executed immediately
> after sending them (hence not chained with others before the
> VPU/MDP "actually" start executing), it is fine to simply add
> a padding of 4 bytes to this structure: this keeps the same
> performance as before, as we're still stack-allocating it,
> while avoiding hackery inside of mtk-vpu to ensure alignment
> bringing a definitely bigger performance impact.
> 
> Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Hello,
is there any issue with this patch?

Regards,
Angelo

> ---
> 
> This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on Debian Sid.
> 
> This is an alternative solution to the mtk-vpu approach, found here:
> https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> 
>   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> index 2cb8cecb3077..b810c96695c8 100644
> --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> @@ -40,12 +40,14 @@ struct mdp_ipi_init {
>    * @ipi_id        : IPI_MDP
>    * @ap_inst       : AP mtk_mdp_vpu address
>    * @vpu_inst_addr : VPU MDP instance address
> + * @padding       : Alignment padding
>    */
>   struct mdp_ipi_comm {
>   	uint32_t msg_id;
>   	uint32_t ipi_id;
>   	uint64_t ap_inst;
>   	uint32_t vpu_inst_addr;
> +	uint32_t padding;
>   };
>   
>   /**


-- 
AngeloGioacchino Del Regno
Software Engineer

Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
  2022-04-21 11:03   ` AngeloGioacchino Del Regno
@ 2022-04-22  2:51     ` houlong.wei
  -1 siblings, 0 replies; 11+ messages in thread
From: houlong.wei @ 2022-04-22  2:51 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, minghsiu.tsai
  Cc: andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil, linux-media,
	linux-arm-kernel, linux-mediatek, linux-kernel, kernel, acourbot,
	irui.wang, houlong.wei

On Thu, 2022-04-21 at 13:03 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> > The mdp_ipi_comm structure defines a command that is either
> > PROCESS (start processing) or DEINIT (destroy instance); we
> > are using this one to send PROCESS or DEINIT commands from Linux
> > to an MDP instance through a VPU write but, while the first wants
> > us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> > data alignment.
> > 
> > Keeping in mind that these commands are executed immediately
> > after sending them (hence not chained with others before the
> > VPU/MDP "actually" start executing), it is fine to simply add
> > a padding of 4 bytes to this structure: this keeps the same
> > performance as before, as we're still stack-allocating it,
> > while avoiding hackery inside of mtk-vpu to ensure alignment
> > bringing a definitely bigger performance impact.
> > 
> > Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> > Signed-off-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> 
> Hello,
> is there any issue with this patch?
> 
> Regards,
> Angelo
> 

The 'padding' is added at the end of the struct, there will be no
problem in the VPU firmware. Thanks for the patch.

Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>

> > ---
> > 
> > This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on
> > Debian Sid.
> > 
> > This is an alternative solution to the mtk-vpu approach, found
> > here:
> > 
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> > 
> >   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > index 2cb8cecb3077..b810c96695c8 100644
> > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > @@ -40,12 +40,14 @@ struct mdp_ipi_init {
> >    * @ipi_id        : IPI_MDP
> >    * @ap_inst       : AP mtk_mdp_vpu address
> >    * @vpu_inst_addr : VPU MDP instance address
> > + * @padding       : Alignment padding
> >    */
> >   struct mdp_ipi_comm {
> >   	uint32_t msg_id;
> >   	uint32_t ipi_id;
> >   	uint64_t ap_inst;
> >   	uint32_t vpu_inst_addr;
> > +	uint32_t padding;
> >   };
> >   
> >   /**
> 
> 
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-04-22  2:51     ` houlong.wei
  0 siblings, 0 replies; 11+ messages in thread
From: houlong.wei @ 2022-04-22  2:51 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, minghsiu.tsai
  Cc: andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil, linux-media,
	linux-arm-kernel, linux-mediatek, linux-kernel, kernel, acourbot,
	irui.wang, houlong.wei

On Thu, 2022-04-21 at 13:03 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> > The mdp_ipi_comm structure defines a command that is either
> > PROCESS (start processing) or DEINIT (destroy instance); we
> > are using this one to send PROCESS or DEINIT commands from Linux
> > to an MDP instance through a VPU write but, while the first wants
> > us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> > data alignment.
> > 
> > Keeping in mind that these commands are executed immediately
> > after sending them (hence not chained with others before the
> > VPU/MDP "actually" start executing), it is fine to simply add
> > a padding of 4 bytes to this structure: this keeps the same
> > performance as before, as we're still stack-allocating it,
> > while avoiding hackery inside of mtk-vpu to ensure alignment
> > bringing a definitely bigger performance impact.
> > 
> > Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> > Signed-off-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> 
> Hello,
> is there any issue with this patch?
> 
> Regards,
> Angelo
> 

The 'padding' is added at the end of the struct, there will be no
problem in the VPU firmware. Thanks for the patch.

Reviewed-by: Houlong Wei <houlong.wei@mediatek.com>

> > ---
> > 
> > This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on
> > Debian Sid.
> > 
> > This is an alternative solution to the mtk-vpu approach, found
> > here:
> > 
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> > 
> >   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > index 2cb8cecb3077..b810c96695c8 100644
> > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > @@ -40,12 +40,14 @@ struct mdp_ipi_init {
> >    * @ipi_id        : IPI_MDP
> >    * @ap_inst       : AP mtk_mdp_vpu address
> >    * @vpu_inst_addr : VPU MDP instance address
> > + * @padding       : Alignment padding
> >    */
> >   struct mdp_ipi_comm {
> >   	uint32_t msg_id;
> >   	uint32_t ipi_id;
> >   	uint64_t ap_inst;
> >   	uint32_t vpu_inst_addr;
> > +	uint32_t padding;
> >   };
> >   
> >   /**
> 
> 
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
  2022-04-21 11:03   ` AngeloGioacchino Del Regno
  (?)
@ 2022-04-22  2:52     ` Irui Wang
  -1 siblings, 0 replies; 11+ messages in thread
From: Irui Wang @ 2022-04-22  2:52 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot

Dear Angelo,

On Thu, 2022-04-21 at 13:03 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> > The mdp_ipi_comm structure defines a command that is either
> > PROCESS (start processing) or DEINIT (destroy instance); we
> > are using this one to send PROCESS or DEINIT commands from Linux
> > to an MDP instance through a VPU write but, while the first wants
> > us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> > data alignment.
> > 
> > Keeping in mind that these commands are executed immediately
> > after sending them (hence not chained with others before the
> > VPU/MDP "actually" start executing), it is fine to simply add
> > a padding of 4 bytes to this structure: this keeps the same
> > performance as before, as we're still stack-allocating it,
> > while avoiding hackery inside of mtk-vpu to ensure alignment
> > bringing a definitely bigger performance impact.
> > 
> > Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> > Signed-off-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> 
> Hello,
> is there any issue with this patch?
> 
> Regards,
> Angelo
> 
> > ---
> > 
> > This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on
> > Debian Sid.
> > 
> > This is an alternative solution to the mtk-vpu approach, found
> > here:
> > 
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> > 
> >   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > index 2cb8cecb3077..b810c96695c8 100644
> > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > @@ -40,12 +40,14 @@ struct mdp_ipi_init {
> >    * @ipi_id        : IPI_MDP
> >    * @ap_inst       : AP mtk_mdp_vpu address
> >    * @vpu_inst_addr : VPU MDP instance address
> > + * @padding       : Alignment padding
> >    */
> >   struct mdp_ipi_comm {
> >   	uint32_t msg_id;
> >   	uint32_t ipi_id;
> >   	uint64_t ap_inst;
> >   	uint32_t vpu_inst_addr;
> > +	uint32_t padding;
> >   };
> >   
> >   /**
The struct definition should be keep align between Kernel and
User(sizeof(kernel) == sizeof(md32)), for backward compatible, the new
"padding" variable can't be accessed by Kernel and md32, just for
alignment padding in kernel side.

Reviewed-by: Irui Wang <irui.wang@mediatek.com>
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-04-22  2:52     ` Irui Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Irui Wang @ 2022-04-22  2:52 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot

Dear Angelo,

On Thu, 2022-04-21 at 13:03 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> > The mdp_ipi_comm structure defines a command that is either
> > PROCESS (start processing) or DEINIT (destroy instance); we
> > are using this one to send PROCESS or DEINIT commands from Linux
> > to an MDP instance through a VPU write but, while the first wants
> > us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> > data alignment.
> > 
> > Keeping in mind that these commands are executed immediately
> > after sending them (hence not chained with others before the
> > VPU/MDP "actually" start executing), it is fine to simply add
> > a padding of 4 bytes to this structure: this keeps the same
> > performance as before, as we're still stack-allocating it,
> > while avoiding hackery inside of mtk-vpu to ensure alignment
> > bringing a definitely bigger performance impact.
> > 
> > Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> > Signed-off-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> 
> Hello,
> is there any issue with this patch?
> 
> Regards,
> Angelo
> 
> > ---
> > 
> > This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on
> > Debian Sid.
> > 
> > This is an alternative solution to the mtk-vpu approach, found
> > here:
> > 
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> > 
> >   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > index 2cb8cecb3077..b810c96695c8 100644
> > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > @@ -40,12 +40,14 @@ struct mdp_ipi_init {
> >    * @ipi_id        : IPI_MDP
> >    * @ap_inst       : AP mtk_mdp_vpu address
> >    * @vpu_inst_addr : VPU MDP instance address
> > + * @padding       : Alignment padding
> >    */
> >   struct mdp_ipi_comm {
> >   	uint32_t msg_id;
> >   	uint32_t ipi_id;
> >   	uint64_t ap_inst;
> >   	uint32_t vpu_inst_addr;
> > +	uint32_t padding;
> >   };
> >   
> >   /**
The struct definition should be keep align between Kernel and
User(sizeof(kernel) == sizeof(md32)), for backward compatible, the new
"padding" variable can't be accessed by Kernel and md32, just for
alignment padding in kernel side.

Reviewed-by: Irui Wang <irui.wang@mediatek.com>
> 
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment
@ 2022-04-22  2:52     ` Irui Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Irui Wang @ 2022-04-22  2:52 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, minghsiu.tsai
  Cc: houlong.wei, andrew-ct.chen, mchehab, matthias.bgg, hans.verkuil,
	linux-media, linux-arm-kernel, linux-mediatek, linux-kernel,
	kernel, acourbot

Dear Angelo,

On Thu, 2022-04-21 at 13:03 +0200, AngeloGioacchino Del Regno wrote:
> Il 07/03/22 16:56, AngeloGioacchino Del Regno ha scritto:
> > The mdp_ipi_comm structure defines a command that is either
> > PROCESS (start processing) or DEINIT (destroy instance); we
> > are using this one to send PROCESS or DEINIT commands from Linux
> > to an MDP instance through a VPU write but, while the first wants
> > us to stay 4-bytes aligned, the VPU instead requires an 8-bytes
> > data alignment.
> > 
> > Keeping in mind that these commands are executed immediately
> > after sending them (hence not chained with others before the
> > VPU/MDP "actually" start executing), it is fine to simply add
> > a padding of 4 bytes to this structure: this keeps the same
> > performance as before, as we're still stack-allocating it,
> > while avoiding hackery inside of mtk-vpu to ensure alignment
> > bringing a definitely bigger performance impact.
> > 
> > Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver")
> > Signed-off-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> 
> Hello,
> is there any issue with this patch?
> 
> Regards,
> Angelo
> 
> > ---
> > 
> > This patch has been tested on Acer Chromebook R 13 (MT8173 Elm) on
> > Debian Sid.
> > 
> > This is an alternative solution to the mtk-vpu approach, found
> > here:
> > 
https://lore.kernel.org/all/20210920170408.1561-1-dafna.hirschfeld@collabora.com
> > 
> >   drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > index 2cb8cecb3077..b810c96695c8 100644
> > --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h
> > @@ -40,12 +40,14 @@ struct mdp_ipi_init {
> >    * @ipi_id        : IPI_MDP
> >    * @ap_inst       : AP mtk_mdp_vpu address
> >    * @vpu_inst_addr : VPU MDP instance address
> > + * @padding       : Alignment padding
> >    */
> >   struct mdp_ipi_comm {
> >   	uint32_t msg_id;
> >   	uint32_t ipi_id;
> >   	uint64_t ap_inst;
> >   	uint32_t vpu_inst_addr;
> > +	uint32_t padding;
> >   };
> >   
> >   /**
The struct definition should be keep align between Kernel and
User(sizeof(kernel) == sizeof(md32)), for backward compatible, the new
"padding" variable can't be accessed by Kernel and md32, just for
alignment padding in kernel side.

Reviewed-by: Irui Wang <irui.wang@mediatek.com>
> 
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-04-22  2:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 15:56 [PATCH] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment AngeloGioacchino Del Regno
2022-03-07 15:56 ` AngeloGioacchino Del Regno
2022-03-07 15:56 ` AngeloGioacchino Del Regno
2022-04-21 11:03 ` AngeloGioacchino Del Regno
2022-04-21 11:03   ` AngeloGioacchino Del Regno
2022-04-21 11:03   ` AngeloGioacchino Del Regno
2022-04-22  2:51   ` houlong.wei
2022-04-22  2:51     ` houlong.wei
2022-04-22  2:52   ` Irui Wang
2022-04-22  2:52     ` Irui Wang
2022-04-22  2:52     ` Irui Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.