public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Heiko Stuebner <heiko@sntech.de>
Cc: palmer@dabbelt.com, paul.walmsley@sifive.com,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	wefu@redhat.com, guoren@kernel.org, atishp@atishpatra.org,
	anup@brainfault.org, mick@ics.forth.gr, samuel@sholland.org,
	cmuellner@linux.com, philipp.tomsich@vrull.eu
Subject: Re: [PATCH 0/2] riscv: implement Zicbom-based CMO instructions + the t-head variant
Date: Fri, 15 Apr 2022 13:26:04 +0200	[thread overview]
Message-ID: <YllWTN+15CoskNBt@Red> (raw)
In-Reply-To: <20220307224620.1933061-1-heiko@sntech.de>

Le Mon, Mar 07, 2022 at 11:46:18PM +0100, Heiko Stuebner a écrit :
> This series is based on the alternatives changes done in my svpbmt series
> and thus also depends on Atish's isa-extension parsing series.
> 
> It implements using the cache-management instructions from the  Zicbom-
> extension to handle cache flush, etc actions on platforms needing them.
> 
> SoCs using cpu cores from T-Head like the Allwinne D1 implement a
> different set of cache instructions. But while they are different,
> instructions they provide the same functionality, so a variant can
> easly hook into the existing alternatives mechanism on those.
> 
> 

Hello

I am testing https://github.com/smaeul/linux.git branch:origin/riscv/d1-wip which contain this serie.

I am hitting a buffer corruption problem with DMA.
The sun8i-ce crypto driver fail self tests due to "device overran destination buffer".
In fact the buffer is not overran by device but by dma_map_single() operation.

The following small code show the problem:

dma_addr_t dma;
u8 *buf;
#define BSIZE 2048
#define DMASIZE 16

buf = kmalloc(BSIZE, GFP_KERNEL | GFP_DMA);
for (i = 0; i < BSIZE; i++)
    buf[i] = 0xFE;
print_hex_dump(KERN_INFO, "DMATEST1:", DUMP_PREFIX_NONE, 16, 4, buf, 256, false);
dma = dma_map_single(ce->dev, buf, DMASIZE, DMA_FROM_DEVICE);
dma_unmap_single(ce->dev, dma, DMASIZE, DMA_FROM_DEVICE);
print_hex_dump(KERN_INFO, "DMATEST3:", DUMP_PREFIX_NONE, 16, 4, buf, 256, false);

Will lead to:
[    2.960040] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.965354] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.970709] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.976069] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.981440] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.986814] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.992188] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    2.997560] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.002934] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.008307] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.013680] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.019054] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.024427] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.029802] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.035175] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.040546] DMATEST1:fefefefe fefefefe fefefefe fefefefe
[    3.401647] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3
[    3.406982] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3
[    3.412350] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3
[    3.417720] DMATEST3:a9c3a9c3 a9c3a9c3 a9c3a9c3 a9c3a9c3
[    3.423094] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.428468] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.433841] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.439213] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.444588] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.449962] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.455334] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.460707] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.466081] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.471454] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.476828] DMATEST3:fefefefe fefefefe fefefefe fefefefe
[    3.482200] DMATEST3:fefefefe fefefefe fefefefe fefefefe

Even with no DMA action, the buffer is corrupted.

Regards

  parent reply	other threads:[~2022-04-15 11:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 22:46 [PATCH 0/2] riscv: implement Zicbom-based CMO instructions + the t-head variant Heiko Stuebner
2022-03-07 22:46 ` [PATCH 1/2] riscv: Implement Zicbom-based cache management operations Heiko Stuebner
2022-03-25 16:20   ` Anup Patel
2022-03-25 17:24     ` Philipp Tomsich
     [not found]     ` <CAAeLtUAi+61Hk7oBW979QEKYaume3vqdt_KkS_mXpRAs+CzHnA@mail.gmail.com>
2022-03-25 17:37       ` Anup Patel
2022-03-31 10:07   ` Christoph Hellwig
2022-03-07 22:46 ` [PATCH 2/2] riscv: implement cache-management errata for T-Head SoCs Heiko Stuebner
2022-03-31  2:30   ` Palmer Dabbelt
2022-03-31  8:22     ` Heiko Stübner
2022-03-31  8:29       ` Philipp Tomsich
2022-04-20  0:18       ` Palmer Dabbelt
2022-04-01  1:05   ` Samuel Holland
2022-04-15 11:26 ` Corentin Labbe [this message]
2022-04-16  2:19   ` [PATCH 0/2] riscv: implement Zicbom-based CMO instructions + the t-head variant Samuel Holland
2022-04-16  7:35     ` Corentin Labbe
2022-04-16 17:47       ` Samuel Holland
2022-04-16 19:32         ` Corentin Labbe
2022-04-17  2:17           ` Guo Ren
2022-04-17  8:45             ` Corentin Labbe
2022-04-17  8:49               ` Guo Ren
2022-04-17 17:35                 ` Corentin Labbe
2022-04-17 22:50                   ` Guo Ren
2022-04-19  7:44                     ` Corentin Labbe
2022-04-18 15:29                   ` Philipp Tomsich
2022-04-19  7:52                     ` Corentin Labbe

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=YllWTN+15CoskNBt@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=anup@brainfault.org \
    --cc=atishp@atishpatra.org \
    --cc=cmuellner@linux.com \
    --cc=guoren@kernel.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mick@ics.forth.gr \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=samuel@sholland.org \
    --cc=wefu@redhat.com \
    /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