The swidth and dwidth of pl080 are not equal.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 An interrupt is generated after the DMA transfer complete.
From: TaoDing <[email protected]>
PL080 cannot trigger interrupt correctly. Reproduce this problem in a simple way.
In the versatilpb board, the interrupt output of pl080 is connected to the 17th interrupt input of pl190. By reading the status register of pl190, determined whether there is an interrupt generated for the corresponding input.
The basic address of pl080 is 0x10130000, and the basic address of pl190 is 0x10140000. Read the value of the address through the qemu monitor.
Configuration
../configure --target-list=arm-softmmu --enable-debug
Reproducer
./qemu-system-arm -M versatilepb -m 128M -nographic -S \
-device loader,addr=0x00000000,data=0x11223344,data-len=4 \
-device loader,addr=0x00001000,data=0x00000000,data-len=4 \
-device loader,addr=0x10130030,data=0x00000001,data-len=4 \
-device loader,addr=0x10130100,data=0x00000000,data-len=4 \
-device loader,addr=0x10130104,data=0x00001000,data-len=4 \
-device loader,addr=0x10130108,data=0x00000000,data-len=4 \
-device loader,addr=0x1013010C,data=0x9e4bf001,data-len=4 \
-device loader,addr=0x10130110,data=0x0000c001,data-len=4Qemu monitor
(qemu) xp /1wx 0x10140008
10140008: 0x00000000The result correctly after fixed
(qemu) xp /1wx 0x10140008
10140008: 0x00020000--- hw/dma/pl080.c | 1 + 1 file changed, 1 insertion(+)
hw/dma/pl080.c +1 -0
@@ -309,6 +309,7 @@ static void pl080_write(void *opaque, hwaddr offset,case 4 :/* Configuration */ s->chan[i].conf = value;pl080_run (s); +pl080_update (s);break ; }return ;
Signature · 1 line
2.43.0
Re: [PATCH v1 1/3] An interrupt is generated after the DMA transfer complete.
Quoted 28 lines · On Wed, 11 Mar 2026 at 14:25, <[email protected]> wrote:
From: TaoDing <[email protected]>
PL080 cannot trigger interrupt correctly. Reproduce this problem in a simple way.
In the versatilpb board, the interrupt output of pl080 is connected to the 17th interrupt input of pl190. By reading the status register of pl190, determined whether there is an interrupt generated for the corresponding input.
The basic address of pl080 is
0x10130000, and the basic address of pl190 is0x10140000. Read the value of the address through the qemu monitor.Configuration
../configure --target-list=arm-softmmu --enable-debug Reproducer ./qemu-system-arm -M versatilepb -m 128M -nographic -S \ -device loader,addr=0x00000000,data=0x11223344,data-len=4 \ -device loader,addr=0x00001000,data=0x00000000,data-len=4 \ -device loader,addr=0x10130030,data=0x00000001,data-len=4 \ -device loader,addr=0x10130100,data=0x00000000,data-len=4 \ -device loader,addr=0x10130104,data=0x00001000,data-len=4 \ -device loader,addr=0x10130108,data=0x00000000,data-len=4 \ -device loader,addr=0x1013010C,data=0x9e4bf001,data-len=4 \ -device loader,addr=0x10130110,data=0x0000c001,data-len=4Qemu monitor
(qemu) xp /1wx 0x10140008 10140008: 0x00000000
Quoted 8 lines
The result correctly after fixed
(qemu) xp /1wx 0x10140008 10140008: 0x00020000--- hw/dma/pl080.c | 1 + 1 file changed, 1 insertion(+)
thanks
-- PMM
Re: [PATCH v1 1/3] An interrupt is generated after the DMA transfer complete.
In reply to [email protected]Quoted 42 lines · On Wed, 11 Mar 2026 at 14:25, <[email protected]> wrote:
From: TaoDing <[email protected]>
PL080 cannot trigger interrupt correctly. Reproduce this problem in a simple way.
In the versatilpb board, the interrupt output of pl080 is connected to the 17th interrupt input of pl190. By reading the status register of pl190, determined whether there is an interrupt generated for the corresponding input.
The basic address of pl080 is
0x10130000, and the basic address of pl190 is0x10140000. Read the value of the address through the qemu monitor.Configuration
../configure --target-list=arm-softmmu --enable-debug Reproducer ./qemu-system-arm -M versatilepb -m 128M -nographic -S \ -device loader,addr=0x00000000,data=0x11223344,data-len=4 \ -device loader,addr=0x00001000,data=0x00000000,data-len=4 \ -device loader,addr=0x10130030,data=0x00000001,data-len=4 \ -device loader,addr=0x10130100,data=0x00000000,data-len=4 \ -device loader,addr=0x10130104,data=0x00001000,data-len=4 \ -device loader,addr=0x10130108,data=0x00000000,data-len=4 \ -device loader,addr=0x1013010C,data=0x9e4bf001,data-len=4 \ -device loader,addr=0x10130110,data=0x0000c001,data-len=4Qemu monitor
(qemu) xp /1wx 0x10140008 10140008: 0x00000000The result correctly after fixed
(qemu) xp /1wx 0x10140008 10140008: 0x00020000--- hw/dma/pl080.c | 1 + 1 file changed, 1 insertion(+)hw/dma/pl080.c +0
-0
hw/dma/pl080.c static void pl080_write(void *opaque, hwaddr offset, · line 315
Quoted 7 lines
hw/dma/pl080.c +1
-0@@ -309,6 +309,7 @@ static void pl080_write(void *opaque, hwaddr offset,case 4 :/* Configuration */ s->chan[i].conf = value;pl080_run (s); +pl080_update (s);break ; }return ;
I just noticed that you used a slightly different fix here from your other version of this patch:
where you put the pl080_update() call into pl080_run(). I think I prefer this one.
For future patches, please if you're sending a different version can you make sure you mark it as "v2" etc, so reviewers can see that it's different, and note any interesting changes from previous versions in either the cover letter or below the '---' line in the relevant patch?
thanks
-- PMM
PATCH 2/3 The swidth and dwidth of pl080 are not equal.
In reply to a message not in the archiveFrom: TaoDing <[email protected]>
The amount of data transmitted each time is the maximum value between s and w, but it should be noted that the remaining transmission amount is less than the width.
Configure swidth to 1 byte, width to 4 bytes, and transfer size to 4.
Configuration
../configure --target-list=arm-softmmu --enable-debug
Reproducer
./qemu-system-arm -M versatilepb -m 128M -nographic -S \
-device loader,addr=0x00000000,data=0x44332211,data-len=4 \
-device loader,addr=0x00001000,data=0x00000000,data-len=4 \
-device loader,addr=0x10130030,data=0x00000001,data-len=4 \
-device loader,addr=0x10130100,data=0x00000000,data-len=4 \
-device loader,addr=0x10130104,data=0x00001000,data-len=4 \
-device loader,addr=0x10130108,data=0x00000000,data-len=4 \
-device loader,addr=0x1013010C,data=0x9e47f004,data-len=4 \
-device loader,addr=0x10130110,data=0x0000c001,data-len=4 Qemu monitor
(qemu) xp /1wx 0x00001000
00001000: 0x00002211The result correctly after fixed
(qemu) xp /1wx 0x00001000
00001000: 0x44332211--- hw/dma/pl080.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
hw/dma/pl080.c +16 -8
@@ -164,22 +164,30 @@ again:destination widths are different. */ swidth =1 << ((ch->ctrl >>18 ) &7 ); dwidth =1 << ((ch->ctrl >>21 ) &7 ); -for (n =0 ; n < dwidth; n+= swidth) { + xsize = (dwidth < swidth) ? swidth : dwidth; + xsize = (xsize < size * swidth) ? xsize : (size * swidth); +for (n =0 ; n < xsize; n+= swidth) {address_space_read (&s->downstream_as, ch->src,MEMTXATTRS_UNSPECIFIED , buff + n, swidth);if (ch->ctrl &PL080_CCTRL_SI ) ch->src += swidth; } - xsize = (dwidth < swidth) ? swidth : dwidth;/* ??? This may pad the value incorrectly for dwidth < 32. */ -for (n =0 ; n < xsize; n += dwidth) { -address_space_write (&s->downstream_as, ch->dest + n, -MEMTXATTRS_UNSPECIFIED , buff + n, dwidth); +if (xsize < dwidth){ +address_space_write (&s->downstream_as, ch->dest, +MEMTXATTRS_UNSPECIFIED , buff, xsize);if (ch->ctrl &PL080_CCTRL_DI ) - ch->dest += swidth; + ch->dest += xsize; } - - size--; +else { +for (n =0 ; n < xsize; n += dwidth) { +address_space_write (&s->downstream_as, ch->dest, +MEMTXATTRS_UNSPECIFIED , buff + n, dwidth); +if (ch->ctrl &PL080_CCTRL_DI ) + ch->dest += dwidth; + } + } + size -= xsize / swidth; ch->ctrl = (ch->ctrl &0xfffff000 ) | size;if (size ==0 ) {/* Transfer complete. */
Signature · 1 line
2.43.0
PATCH 3/3 The LLI of pl080 should be aligned with 4 bytes.
In reply to a message not in the archiveFrom: TaoDing <[email protected]>
When the bit0 of the LLI register is configured as master 1, it can cause incorrect data reading, and even lead to qemu crash.
Constructed 1 LLI item. The initial LLI register points to the address of the LLI item. But the bit 0 of the LLI register is 1, which mean read from Master1 port.
According to the description in the PL080 manual, the address for the next LLI should be word aligned.
Configuration
../configure --target-list=arm-softmmu --enable-debug
Reproducer
./qemu-system-arm -M versatilepb -m 128M -nographic -S \
-device loader,addr=0x00002000,data=0x00000004,data-len=4 \
-device loader,addr=0x00002004,data=0x00001004,data-len=4 \
-device loader,addr=0x00002008,data=0x00000000,data-len=4 \
-device loader,addr=0x0000200c,data=0x9e4bf001,data-len=4 \
-device loader,addr=0x00000000,data=0x44332211,data-len=4 \
-device loader,addr=0x00000004,data=0x88776655,data-len=4 \
-device loader,addr=0x00001000,data=0x00000000,data-len=4 \
-device loader,addr=0x00001004,data=0x00000000,data-len=4 \
-device loader,addr=0x10130030,data=0x00000001,data-len=4 \
-device loader,addr=0x10130100,data=0x00000000,data-len=4 \
-device loader,addr=0x10130104,data=0x00001000,data-len=4 \
-device loader,addr=0x10130108,data=0x00002001,data-len=4 \
-device loader,addr=0x1013010C,data=0x1e4bf001,data-len=4 \
-device loader,addr=0x10130110,data=0x0000c001,data-len=4 Qemu Crash.
The result correctly after fixed
(qemu) xp /1wx 0x00001000
00001000: 0x44332211
(qemu) xp /1wx 0x00001004
00001004: 0x88776655--- hw/dma/pl080.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
hw/dma/pl080.c +7 -5
@@ -102,6 +102,7 @@ static void pl080_run(PL080State *s)int size;uint8_t buff[4 ];uint32_t req; +uint32_t next_lli; s->tc_mask =0 ;for (c =0 ; c < s->nchannels; c++) {
@@ -191,21 +192,22 @@ again: ch->ctrl = (ch->ctrl &0xfffff000 ) | size;if (size ==0 ) {/* Transfer complete. */ -if (ch->lli) { + next_lli = (ch->lli & ~3 ); +if (next_lli) { ch->src =address_space_ldl_le (&s->downstream_as, - ch->lli, + next_lli,MEMTXATTRS_UNSPECIFIED ,NULL ); ch->dest =address_space_ldl_le (&s->downstream_as, - ch->lli +4 , + next_lli +4 ,MEMTXATTRS_UNSPECIFIED ,NULL ); ch->ctrl =address_space_ldl_le (&s->downstream_as, - ch->lli +12 , + next_lli +12 ,MEMTXATTRS_UNSPECIFIED ,NULL ); ch->lli =address_space_ldl_le (&s->downstream_as, - ch->lli +8 , + next_lli +8 ,MEMTXATTRS_UNSPECIFIED ,NULL ); }else {
Signature · 1 line
2.43.0