mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM64: let 'end' point after the range in cache functions
Date: Tue, 16 Apr 2024 14:02:19 +0200	[thread overview]
Message-ID: <Zh5oy4CE9fF6OARr@pengutronix.de> (raw)
In-Reply-To: <20240412162836.284671-1-enrico.scholz@sigma-chemnitz.de>

Hi Enrico,

On Fri, Apr 12, 2024 at 06:28:35PM +0200, Enrico Scholz wrote:
> From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> 
> v8_flush_dcache_range() and v8_inv_dcache_range() are implemented
> under the assumption that their 'end' parameter points *after* the
> range.
> 
> Fix callers to use it in this way.
> 
> This fixes e.g. spurious corruptions in the last octet when sending
> 129 bytes over ethernet.

So 129 bytes are sent from barebox, right? Which network driver driver
is involved on the barebox side here? How did you force sending excatly
129 bytes?

I am asking because I want to look if there are other bugs invlolved
here.

Sascha

> 
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> ---
>  arch/arm/cpu/dma_64.c | 2 +-
>  arch/arm/cpu/mmu_64.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/dma_64.c b/arch/arm/cpu/dma_64.c
> index 74d7167860c2..b50572f5e601 100644
> --- a/arch/arm/cpu/dma_64.c
> +++ b/arch/arm/cpu/dma_64.c
> @@ -6,7 +6,7 @@ void arch_sync_dma_for_device(void *vaddr, size_t size,
>                                enum dma_data_direction dir)
>  {
>  	unsigned long start = (unsigned long)vaddr;
> -	unsigned long end = start + size - 1;
> +	unsigned long end = start + size;
>  
>  	if (dir == DMA_FROM_DEVICE)
>  		v8_inv_dcache_range(start, end);
> diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
> index 12cd644de0c7..b48e4732b86d 100644
> --- a/arch/arm/cpu/mmu_64.c
> +++ b/arch/arm/cpu/mmu_64.c
> @@ -282,7 +282,7 @@ void mmu_disable(void)
>  void dma_inv_range(void *ptr, size_t size)
>  {
>  	unsigned long start = (unsigned long)ptr;
> -	unsigned long end = start + size - 1;
> +	unsigned long end = start + size;
>  
>  	v8_inv_dcache_range(start, end);
>  }
> @@ -290,7 +290,7 @@ void dma_inv_range(void *ptr, size_t size)
>  void dma_flush_range(void *ptr, size_t size)
>  {
>  	unsigned long start = (unsigned long)ptr;
> -	unsigned long end = start + size - 1;
> +	unsigned long end = start + size;
>  
>  	v8_flush_dcache_range(start, end);
>  }
> -- 
> 2.44.0
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  parent reply	other threads:[~2024-04-16 12:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 16:28 Enrico Scholz
2024-04-16 11:55 ` Sascha Hauer
2024-04-16 12:02 ` Sascha Hauer [this message]
2024-04-16 12:10   ` Enrico Scholz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zh5oy4CE9fF6OARr@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=enrico.scholz@sigma-chemnitz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox