[PATCH v3 0/7] K230: add gsdma and decomp_gzip

Tao Ding posted 7 patches 1 month, 2 weeks ago
Failed in applying to current master (apply log)
Maintainers: Chao Liu <chao.liu@processmission.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
MAINTAINERS                         |   6 +
docs/system/riscv/k230.rst          |   2 +
hw/dma/Kconfig                      |   3 +
hw/dma/k230_gsdma.c                 | 551 ++++++++++++++++++++++++++++
hw/dma/meson.build                  |   1 +
hw/dma/trace-events                 |   6 +
hw/misc/Kconfig                     |   3 +
hw/misc/k230_decomp_gzip.c          | 511 ++++++++++++++++++++++++++
hw/misc/meson.build                 |   1 +
hw/misc/trace-events                |   4 +
hw/riscv/Kconfig                    |   2 +
hw/riscv/k230.c                     |  38 +-
include/hw/dma/k230_gsdma.h         | 130 +++++++
include/hw/misc/k230_decomp_gzip.h  |  92 +++++
include/hw/riscv/k230.h             |   5 +
tests/qtest/k230-decomp-gzip-test.c | 200 ++++++++++
tests/qtest/k230-gsdma-test.c       | 201 ++++++++++
tests/qtest/meson.build             |   2 +-
18 files changed, 1750 insertions(+), 8 deletions(-)
create mode 100644 hw/dma/k230_gsdma.c
create mode 100644 hw/misc/k230_decomp_gzip.c
create mode 100644 include/hw/dma/k230_gsdma.h
create mode 100644 include/hw/misc/k230_decomp_gzip.h
create mode 100644 tests/qtest/k230-decomp-gzip-test.c
create mode 100644 tests/qtest/k230-gsdma-test.c
[PATCH v3 0/7] K230: add gsdma and decomp_gzip
Posted by Tao Ding 1 month, 2 weeks ago
Hi all,

This patch series adds GSDMA and Decomp_gzip to the K230 board.
Enable k230 to use k230_unzip to decompress files during the u-boot phase.

This series includes the following features:

*patch1: add K230 gsdma which supports sdma, gdma is temporarily not supported
*patch2: add gsdma to K230 board
*patch3: add K230 gsdma qtest
*patch4: add K230 decomp_gzip which decompress data work with sdma
*patch5: add decomp_gzip to K230 board
*patch6: add K230 decomp_gzip qtest
*patch7: add a noc-stub region in K230 board

Patch-v2 is posted in:
https://lore.kernel.org/qemu-devel/20260727155702.36484-1-dingtao0430@163.com/

Changes in v3:
*patch1: 
  Removed temporarily unimplemented GDMA register read and write.
  Print with qemu_log_mask for access register errors.
*patch4:
  Print with qemu_log_mask for handle error ack signal.

Tao Ding (7):
  hw/dma: add K230 gsdma
  hw/riscv: k230: add gsdma in K230 board
  tests/qtest: add test for K230 gsdma
  hw/misc: add K230 decomp gzip
  hw/riscv: k230: add decomp gzip in K230 board
  tests/qtest: add test for K230 decomp gzip
  hw/riscv: k230: add a noc stub region in K230 board

 MAINTAINERS                         |   6 +
 docs/system/riscv/k230.rst          |   2 +
 hw/dma/Kconfig                      |   3 +
 hw/dma/k230_gsdma.c                 | 551 ++++++++++++++++++++++++++++
 hw/dma/meson.build                  |   1 +
 hw/dma/trace-events                 |   6 +
 hw/misc/Kconfig                     |   3 +
 hw/misc/k230_decomp_gzip.c          | 511 ++++++++++++++++++++++++++
 hw/misc/meson.build                 |   1 +
 hw/misc/trace-events                |   4 +
 hw/riscv/Kconfig                    |   2 +
 hw/riscv/k230.c                     |  38 +-
 include/hw/dma/k230_gsdma.h         | 130 +++++++
 include/hw/misc/k230_decomp_gzip.h  |  92 +++++
 include/hw/riscv/k230.h             |   5 +
 tests/qtest/k230-decomp-gzip-test.c | 200 ++++++++++
 tests/qtest/k230-gsdma-test.c       | 201 ++++++++++
 tests/qtest/meson.build             |   2 +-
 18 files changed, 1750 insertions(+), 8 deletions(-)
 create mode 100644 hw/dma/k230_gsdma.c
 create mode 100644 hw/misc/k230_decomp_gzip.c
 create mode 100644 include/hw/dma/k230_gsdma.h
 create mode 100644 include/hw/misc/k230_decomp_gzip.h
 create mode 100644 tests/qtest/k230-decomp-gzip-test.c
 create mode 100644 tests/qtest/k230-gsdma-test.c


base-commit: 300438ffbb8d9430cac2fcc15cba6f482b2c0587
-- 
2.43.0
Re: [PATCH v3 0/7] K230: add gsdma and decomp_gzip
Posted by Junze Cao 1 month, 2 weeks ago
On Sat, 08 Aug 2026 14:22:20 +0800, Tao Ding <dingtao0430@163.com> wrote:
> [...]
>  create mode 100644 tests/qtest/k230-decomp-gzip-test.c
>  create mode 100644 tests/qtest/k230-gsdma-test.c
> 
> base-commit: 300438ffbb8d9430cac2fcc15cba6f482b2c0587
> --
> 2.43.0

Thank you very much for your contribution.

I think there's nothing wrong with the code.

Reviewed-by: Junze Cao <caojunze424@gmail.com>

-- 
Junze Cao <caojunze424@gmail.com>
Re: [PATCH v3 0/7] K230: add gsdma and decomp_gzip
Posted by Alistair Francis 1 month ago
On Sat, 2026-08-08 at 14:22 +0800, Tao Ding wrote:
> Hi all,
> 
> This patch series adds GSDMA and Decomp_gzip to the K230 board.
> Enable k230 to use k230_unzip to decompress files during the u-boot
> phase.
> 
> This series includes the following features:
> 
> *patch1: add K230 gsdma which supports sdma, gdma is temporarily not
> supported
> *patch2: add gsdma to K230 board
> *patch3: add K230 gsdma qtest
> *patch4: add K230 decomp_gzip which decompress data work with sdma
> *patch5: add decomp_gzip to K230 board
> *patch6: add K230 decomp_gzip qtest
> *patch7: add a noc-stub region in K230 board
> 
> Patch-v2 is posted in:
> https://lore.kernel.org/qemu-devel/20260727155702.36484-1-dingtao0430@163.com/
> 
> Changes in v3:
> *patch1: 
>   Removed temporarily unimplemented GDMA register read and write.
>   Print with qemu_log_mask for access register errors.
> *patch4:
>   Print with qemu_log_mask for handle error ack signal.
> 
> Tao Ding (7):
>   hw/dma: add K230 gsdma
>   hw/riscv: k230: add gsdma in K230 board
>   tests/qtest: add test for K230 gsdma
>   hw/misc: add K230 decomp gzip
>   hw/riscv: k230: add decomp gzip in K230 board
>   tests/qtest: add test for K230 decomp gzip
>   hw/riscv: k230: add a noc stub region in K230 board

This is causing some coverity issues

Can you send patches to fix them up?

*** CID 1685517:         Integer handling issues 
(OVERFLOW_BEFORE_WIDEN)
/builds/qemu-project/qemu/hw/misc/k230_decomp_gzip.c: 62             in
k230_decomp_gzip_input_addr()
56                s->output.slot * K230_DECOMP_GZIP_BLOCK_SIZE +
57                s->output.current_offset;
58     }
59     
60     static hwaddr k230_decomp_gzip_input_addr(K230DecompGzipState
*s)
61     {
>>>     CID 1685517:         Integer handling issues 
(OVERFLOW_BEFORE_WIDEN)
>>>     Potentially overflowing expression "s->input.slot * 131072U"
with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit
arithmetic, and then used in a context that expects an expression of
type "hwaddr" (64 bits, unsigned).
62         return s->input.slot * K230_DECOMP_GZIP_BLOCK_SIZE +
63                K230_DECOMP_GZIP_SRAM_IN_BASE;
64     }
65     
66     static uint32_t
k230_decomp_gzip_current_input_size(K230DecompGzipState *s)
67     {



*** CID 1685516:         Integer handling issues 
(OVERFLOW_BEFORE_WIDEN)
/builds/qemu-project/qemu/tests/qtest/k230-decomp-gzip-test.c: 49     
in k230_sram_input_addr()
43         return K230_SRAM_BASE + off;
44     }
45     
46     static inline hwaddr k230_sram_input_addr(unsigned int slot)
47     {
48         return k230_sram_addr(K230_DECOMP_GZIP_SRAM_IN_BASE +
>>>     CID 1685516:         Integer handling issues 
(OVERFLOW_BEFORE_WIDEN)
>>>     Potentially overflowing expression "slot * 131072U" with type
"unsigned int" (32 bits, unsigned) is evaluated using 32-bit
arithmetic, and then used in a context that expects an expression of
type "hwaddr" (64 bits, unsigned).
49                               slot * K230_DECOMP_GZIP_BLOCK_SIZE);
50     }
51     
52     /*
53      * test_gzip_data was generated by compressing test_payload in
gzip format
54      * using Dynamic Huffman coding. The compression method byte in
the gzip


*** CID 1685515:         Integer handling issues 
(OVERFLOW_BEFORE_WIDEN)
/builds/qemu-project/qemu/hw/misc/k230_decomp_gzip.c: 56             in
k230_decomp_gzip_output_addr()
50                                    MEMTXATTRS_UNSPECIFIED, buf, len)
== MEMTX_OK;
51     }
52     
53     static hwaddr k230_decomp_gzip_output_addr(K230DecompGzipState
*s)
54     {
55         return K230_DECOMP_GZIP_SRAM_OUT_BASE +
>>>     CID 1685515:         Integer handling issues 
(OVERFLOW_BEFORE_WIDEN)
>>>     Potentially overflowing expression "s->output.slot * 131072U"
with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit
arithmetic, and then used in a context that expects an expression of
type "hwaddr" (64 bits, unsigned).
56                s->output.slot * K230_DECOMP_GZIP_BLOCK_SIZE +
57                s->output.current_offset;
58     }
59     
60     static hwaddr k230_decomp_gzip_input_addr(K230DecompGzipState
*s)
61     {

*** CID 1685514:           (INTEGER_OVERFLOW)
/builds/qemu-project/qemu/hw/dma/k230_gsdma.c: 332             in
k230_gsdma_read()
326                             "%s: not implement gdma at offset 0x%"
HWADDR_PRIx
327                             "\n", __func__, addr);
328             }
329             break;
330         }
331     
>>>     CID 1685514:           (INTEGER_OVERFLOW)
>>>     Expression "ch", where "(addr - 80UL) / 48UL" is known to be
equal to 1431655763, overflows the type of "ch", which is type
"unsigned int".
332         ch = (addr - K230_GSDMA_CH_BASE) / K230_GSDMA_CH_STRIDE;
333         ch_off = (addr - K230_GSDMA_CH_BASE) %
K230_GSDMA_CH_STRIDE;
334         if (ch < K230_GSDMA_NUM_SDMA_CHANNELS) {
335             switch (ch_off) {
336             case K230_GSDMA_CH_CTL:
337                 break;
/builds/qemu-project/qemu/hw/dma/k230_gsdma.c: 332             in
k230_gsdma_read()
326                             "%s: not implement gdma at offset 0x%"
HWADDR_PRIx
327                             "\n", __func__, addr);
328             }
329             break;
330         }
331     
>>>     CID 1685514:           (INTEGER_OVERFLOW)
>>>     Expression "addr - 80UL", where "addr" is known to be equal to
0, underflows the type of "addr - 80UL", which is type "unsigned long".
332         ch = (addr - K230_GSDMA_CH_BASE) / K230_GSDMA_CH_STRIDE;
333         ch_off = (addr - K230_GSDMA_CH_BASE) %
K230_GSDMA_CH_STRIDE;
334         if (ch < K230_GSDMA_NUM_SDMA_CHANNELS) {
335             switch (ch_off) {
336             case K230_GSDMA_CH_CTL:
337                 break;

*** CID 1685513:         Control flow issues  (UNREACHABLE)
/builds/qemu-project/qemu/disas/riscv.c: 2562             in
decode_inst_opcode()
2556                     case 3: return &op_fscsr;
2557                     default: return &op_csrrw;
2558                     }
2559                     break;
2560                 case 2:
2561                     return &op_csrrs;
>>>     CID 1685513:         Control flow issues  (UNREACHABLE)
>>>     This code cannot be reached: "if (operand_rs1(inst) == 0U...".
2562                     if (operand_rs1(inst) == 0) {
2563                         switch (operand_csr12(inst)) {
2564                         case 0x001: return &op_frflags;
2565                         case 0x002: return &op_frrm;
2566                         case 0x003: return &op_frcsr;
2567                         case 0xc00: return &op_rdcycle;


> 
>  MAINTAINERS                         |   6 +
>  docs/system/riscv/k230.rst          |   2 +
>  hw/dma/Kconfig                      |   3 +
>  hw/dma/k230_gsdma.c                 | 551
> ++++++++++++++++++++++++++++
>  hw/dma/meson.build                  |   1 +
>  hw/dma/trace-events                 |   6 +
>  hw/misc/Kconfig                     |   3 +
>  hw/misc/k230_decomp_gzip.c          | 511 ++++++++++++++++++++++++++
>  hw/misc/meson.build                 |   1 +
>  hw/misc/trace-events                |   4 +
>  hw/riscv/Kconfig                    |   2 +
>  hw/riscv/k230.c                     |  38 +-
>  include/hw/dma/k230_gsdma.h         | 130 +++++++
>  include/hw/misc/k230_decomp_gzip.h  |  92 +++++
>  include/hw/riscv/k230.h             |   5 +
>  tests/qtest/k230-decomp-gzip-test.c | 200 ++++++++++
>  tests/qtest/k230-gsdma-test.c       | 201 ++++++++++
>  tests/qtest/meson.build             |   2 +-
>  18 files changed, 1750 insertions(+), 8 deletions(-)
>  create mode 100644 hw/dma/k230_gsdma.c
>  create mode 100644 hw/misc/k230_decomp_gzip.c
>  create mode 100644 include/hw/dma/k230_gsdma.h
>  create mode 100644 include/hw/misc/k230_decomp_gzip.h
>  create mode 100644 tests/qtest/k230-decomp-gzip-test.c
>  create mode 100644 tests/qtest/k230-gsdma-test.c
> 
> 
> base-commit: 300438ffbb8d9430cac2fcc15cba6f482b2c0587
Re: [PATCH v3 0/7] K230: add gsdma and decomp_gzip
Posted by Alistair 1 month, 2 weeks ago
On Sat, 2026-08-08 at 14:22 +0800, Tao Ding wrote:
> Hi all,
> 
> This patch series adds GSDMA and Decomp_gzip to the K230 board.
> Enable k230 to use k230_unzip to decompress files during the u-boot
> phase.
> 
> This series includes the following features:
> 
> *patch1: add K230 gsdma which supports sdma, gdma is temporarily not
> supported
> *patch2: add gsdma to K230 board
> *patch3: add K230 gsdma qtest
> *patch4: add K230 decomp_gzip which decompress data work with sdma
> *patch5: add decomp_gzip to K230 board
> *patch6: add K230 decomp_gzip qtest
> *patch7: add a noc-stub region in K230 board
> 
> Patch-v2 is posted in:
> https://lore.kernel.org/qemu-devel/20260727155702.36484-1-dingtao0430@163.com/
> 
> Changes in v3:
> *patch1: 
>   Removed temporarily unimplemented GDMA register read and write.
>   Print with qemu_log_mask for access register errors.
> *patch4:
>   Print with qemu_log_mask for handle error ack signal.
> 
> Tao Ding (7):
>   hw/dma: add K230 gsdma
>   hw/riscv: k230: add gsdma in K230 board
>   tests/qtest: add test for K230 gsdma
>   hw/misc: add K230 decomp gzip
>   hw/riscv: k230: add decomp gzip in K230 board
>   tests/qtest: add test for K230 decomp gzip
>   hw/riscv: k230: add a noc stub region in K230 board

Thanks!

Applied to riscv-to-apply.next

Alistair

> 
>  MAINTAINERS                         |   6 +
>  docs/system/riscv/k230.rst          |   2 +
>  hw/dma/Kconfig                      |   3 +
>  hw/dma/k230_gsdma.c                 | 551
> ++++++++++++++++++++++++++++
>  hw/dma/meson.build                  |   1 +
>  hw/dma/trace-events                 |   6 +
>  hw/misc/Kconfig                     |   3 +
>  hw/misc/k230_decomp_gzip.c          | 511 ++++++++++++++++++++++++++
>  hw/misc/meson.build                 |   1 +
>  hw/misc/trace-events                |   4 +
>  hw/riscv/Kconfig                    |   2 +
>  hw/riscv/k230.c                     |  38 +-
>  include/hw/dma/k230_gsdma.h         | 130 +++++++
>  include/hw/misc/k230_decomp_gzip.h  |  92 +++++
>  include/hw/riscv/k230.h             |   5 +
>  tests/qtest/k230-decomp-gzip-test.c | 200 ++++++++++
>  tests/qtest/k230-gsdma-test.c       | 201 ++++++++++
>  tests/qtest/meson.build             |   2 +-
>  18 files changed, 1750 insertions(+), 8 deletions(-)
>  create mode 100644 hw/dma/k230_gsdma.c
>  create mode 100644 hw/misc/k230_decomp_gzip.c
>  create mode 100644 include/hw/dma/k230_gsdma.h
>  create mode 100644 include/hw/misc/k230_decomp_gzip.h
>  create mode 100644 tests/qtest/k230-decomp-gzip-test.c
>  create mode 100644 tests/qtest/k230-gsdma-test.c
> 
> 
> base-commit: 300438ffbb8d9430cac2fcc15cba6f482b2c0587