All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: its: only clean cache when sending ITS command
@ 2026-11-17  2:45 Daisuke Nishimura
  2026-11-17  3:17 ` Daisuke Nishimura
  0 siblings, 1 reply; 6+ messages in thread
From: Daisuke Nishimura @ 2026-11-17  2:45 UTC (permalink / raw)
  To: xen-devel
  Cc: Volodymyr Babchuk, Daisuke Nishimura, Stefano Stabellini,
	Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk

From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

There is no need to invalidate cache entry because we just wrote that
memory. So it is guaranteed that cache entry is valid.

But we need to clean (flush) cache line to be sure that ITS sees
command written into the memory.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Signed-off-by: Daisuke Nishimura <nishimura@valinux.co.jp>
---
(cherry picked from commit fe7142bca56b5c8c8109f581444f89ae09b7544f xen-troops)
---
 xen/arch/arm/gic-v3-its.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 325835b0ad..dc44666233 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -207,8 +207,7 @@ static int its_send_command(struct host_its *hw_its, const void *its_cmd)
 
     memcpy(hw_its->cmd_buf + writep, its_cmd, ITS_CMD_SIZE);
     if ( hw_its->flags & HOST_ITS_FLUSH_CMD_QUEUE )
-        clean_and_invalidate_dcache_va_range(hw_its->cmd_buf + writep,
-                                             ITS_CMD_SIZE);
+        clean_dcache_va_range(hw_its->cmd_buf + writep, ITS_CMD_SIZE);
     else
         dsb(ishst);
 
-- 
2.43.0



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

* Re: [PATCH] xen/arm: its: only clean cache when sending ITS command
  2026-11-17  2:45 [PATCH] " Daisuke Nishimura
@ 2026-11-17  3:17 ` Daisuke Nishimura
  0 siblings, 0 replies; 6+ messages in thread
From: Daisuke Nishimura @ 2026-11-17  3:17 UTC (permalink / raw)
  To: xen-devel
  Cc: Volodymyr Babchuk, Stefano Stabellini, Julien Grall,
	Bertrand Marquis, Michal Orzel

I'm sorry that the 'From:' lines are duplicate.
I will resend a correct patch later.

On Tue, 17 Nov 2026 11:45:18 +0900
Daisuke Nishimura <nishimura@valinux.co.jp> wrote:

> From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> 
> From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> 
> There is no need to invalidate cache entry because we just wrote that
> memory. So it is guaranteed that cache entry is valid.
> 
> But we need to clean (flush) cache line to be sure that ITS sees
> command written into the memory.
> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> Signed-off-by: Daisuke Nishimura <nishimura@valinux.co.jp>
> ---
> (cherry picked from commit fe7142bca56b5c8c8109f581444f89ae09b7544f
> xen-troops) ---
>  xen/arch/arm/gic-v3-its.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 325835b0ad..dc44666233 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -207,8 +207,7 @@ static int its_send_command(struct host_its
> *hw_its, const void *its_cmd) 
>      memcpy(hw_its->cmd_buf + writep, its_cmd, ITS_CMD_SIZE);
>      if ( hw_its->flags & HOST_ITS_FLUSH_CMD_QUEUE )
> -        clean_and_invalidate_dcache_va_range(hw_its->cmd_buf +
> writep,
> -                                             ITS_CMD_SIZE);
> +        clean_dcache_va_range(hw_its->cmd_buf + writep,
> ITS_CMD_SIZE); else
>          dsb(ishst);
>  



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

* [PATCH] xen/arm: its: only clean cache when sending ITS command
@ 2026-11-17  3:32 Daisuke Nishimura
  2026-11-17  7:45 ` Orzel, Michal
  2026-11-18  2:15 ` [PATCH v2] " Daisuke Nishimura
  0 siblings, 2 replies; 6+ messages in thread
From: Daisuke Nishimura @ 2026-11-17  3:32 UTC (permalink / raw)
  To: xen-devel
  Cc: Daisuke Nishimura, Volodymyr Babchuk, Stefano Stabellini,
	Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk

From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

There is no need to invalidate cache entry because we just wrote that
memory. So it is guaranteed that cache entry is valid.

But we need to clean (flush) cache line to be sure that ITS sees
command written into the memory.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Signed-off-by: Daisuke Nishimura <nishimura@valinux.co.jp>
---
(cherry picked from commit fe7142bca56b5c8c8109f581444f89ae09b7544f xen-troops)
---
 xen/arch/arm/gic-v3-its.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 325835b0ad..dc44666233 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -207,8 +207,7 @@ static int its_send_command(struct host_its *hw_its, const void *its_cmd)
 
     memcpy(hw_its->cmd_buf + writep, its_cmd, ITS_CMD_SIZE);
     if ( hw_its->flags & HOST_ITS_FLUSH_CMD_QUEUE )
-        clean_and_invalidate_dcache_va_range(hw_its->cmd_buf + writep,
-                                             ITS_CMD_SIZE);
+        clean_dcache_va_range(hw_its->cmd_buf + writep, ITS_CMD_SIZE);
     else
         dsb(ishst);
 
-- 
2.43.0



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

* Re: [PATCH] xen/arm: its: only clean cache when sending ITS command
  2026-11-17  3:32 [PATCH] xen/arm: its: only clean cache when sending ITS command Daisuke Nishimura
@ 2026-11-17  7:45 ` Orzel, Michal
  2026-11-18  0:11   ` Daisuke Nishimura
  2026-11-18  2:15 ` [PATCH v2] " Daisuke Nishimura
  1 sibling, 1 reply; 6+ messages in thread
From: Orzel, Michal @ 2026-11-17  7:45 UTC (permalink / raw)
  To: Daisuke Nishimura, xen-devel
  Cc: Volodymyr Babchuk, Stefano Stabellini, Julien Grall,
	Bertrand Marquis



On 17-Nov-26 04:32, Daisuke Nishimura wrote:
> From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> 
> There is no need to invalidate cache entry because we just wrote that
> memory. So it is guaranteed that cache entry is valid.
I don't think this is a good rationale. What makes invalidation not
needed here is that the CPU is the only writer and the ITS the only
reader of this buffer, so the cached data cannot be stale. Invalidation
would be needed if a device wrote a buffer that the CPU later reads.

> 
> But we need to clean (flush) cache line to be sure that ITS sees
flush means clean+invalidate, which is what you drop, so please drop "flush" word.

> command written into the memory.
> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> Signed-off-by: Daisuke Nishimura <nishimura@valinux.co.jp>
With that:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal



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

* Re: [PATCH] xen/arm: its: only clean cache when sending ITS command
  2026-11-17  7:45 ` Orzel, Michal
@ 2026-11-18  0:11   ` Daisuke Nishimura
  0 siblings, 0 replies; 6+ messages in thread
From: Daisuke Nishimura @ 2026-11-18  0:11 UTC (permalink / raw)
  To: Orzel, Michal
  Cc: xen-devel, Volodymyr Babchuk, Stefano Stabellini, Julien Grall,
	Bertrand Marquis, Daisuke Nishimura

Hi, Orzel.

Thank you for your review and comment.
I'll update the commit message based on your comment,
and resend the patch.

Daisuke Nishimura

On Tue, 17 Nov 2026 08:45:27 +0100
"Orzel, Michal" <michal.orzel@amd.com> wrote:

> 
> 
> On 17-Nov-26 04:32, Daisuke Nishimura wrote:
> > From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> > 
> > There is no need to invalidate cache entry because we just wrote
> > that memory. So it is guaranteed that cache entry is valid.
> I don't think this is a good rationale. What makes invalidation not
> needed here is that the CPU is the only writer and the ITS the only
> reader of this buffer, so the cached data cannot be stale.
> Invalidation would be needed if a device wrote a buffer that the CPU
> later reads.
> 
> > 
> > But we need to clean (flush) cache line to be sure that ITS sees
> flush means clean+invalidate, which is what you drop, so please drop
> "flush" word.
> 
> > command written into the memory.
> > 
> > Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> > Signed-off-by: Daisuke Nishimura <nishimura@valinux.co.jp>
> With that:
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
> 
> ~Michal
> 



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

* [PATCH v2] xen/arm: its: only clean cache when sending ITS command
  2026-11-17  3:32 [PATCH] xen/arm: its: only clean cache when sending ITS command Daisuke Nishimura
  2026-11-17  7:45 ` Orzel, Michal
@ 2026-11-18  2:15 ` Daisuke Nishimura
  1 sibling, 0 replies; 6+ messages in thread
From: Daisuke Nishimura @ 2026-11-18  2:15 UTC (permalink / raw)
  To: xen-devel
  Cc: Daisuke Nishimura, Volodymyr Babchuk, Michal Orzel,
	Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Volodymyr Babchuk

From: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

There is no need to invalidate the cache entry because the CPU is the only
writer and the ITS is the only reader of this buffer, so it is guaranteed
that the cached data cannot be stale.

However, we still need to clean the cache line to be sure that ITS sees
the command written into memory.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Signed-off-by: Daisuke Nishimura <nishimura@valinux.co.jp>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
(cherry picked from commit fe7142bca56b5c8c8109f581444f89ae09b7544f xen-troops)

v2: Update the commit message.
---
 xen/arch/arm/gic-v3-its.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 325835b0ad..dc44666233 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -207,8 +207,7 @@ static int its_send_command(struct host_its *hw_its, const void *its_cmd)
 
     memcpy(hw_its->cmd_buf + writep, its_cmd, ITS_CMD_SIZE);
     if ( hw_its->flags & HOST_ITS_FLUSH_CMD_QUEUE )
-        clean_and_invalidate_dcache_va_range(hw_its->cmd_buf + writep,
-                                             ITS_CMD_SIZE);
+        clean_dcache_va_range(hw_its->cmd_buf + writep, ITS_CMD_SIZE);
     else
         dsb(ishst);
 
-- 
2.43.0



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

end of thread, other threads:[~2026-11-18  2:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17  3:32 [PATCH] xen/arm: its: only clean cache when sending ITS command Daisuke Nishimura
2026-11-17  7:45 ` Orzel, Michal
2026-11-18  0:11   ` Daisuke Nishimura
2026-11-18  2:15 ` [PATCH v2] " Daisuke Nishimura
  -- strict thread matches above, loose matches on Subject: below --
2026-11-17  2:45 [PATCH] " Daisuke Nishimura
2026-11-17  3:17 ` Daisuke Nishimura

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.