All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Ding <dingtao0430@163.com>
To: qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, pbonzini@redhat.com, palmer@dabbelt.com,
	alistair.francis@wdc.com, liwei1518@gmail.com,
	daniel.barboza@oss.qualcomm.com, zhiwei_liu@linux.alibaba.com,
	chao.liu@processmission.com, farosas@suse.de, lvivier@redhat.com,
	pierrick.bouvier@oss.qualcomm.com, caojunze424@gmail.com,
	Tao Ding <dingtao0430@163.com>
Subject: [PATCH v2 5/7] hw/riscv: k230: add decomp gzip in K230 board
Date: Mon, 27 Jul 2026 23:57:00 +0800	[thread overview]
Message-ID: <20260727155702.36484-6-dingtao0430@163.com> (raw)
In-Reply-To: <20260727155702.36484-1-dingtao0430@163.com>

This commit replaces the unimplemented part of Decomp_gzip in K230.
Connect to the handshake interface of GSDMA.

Signed-off-by: Tao Ding <dingtao0430@163.com>
Reviewed-by: Junze Cao <caojunze424@gmail.com>
---
 hw/riscv/Kconfig        |  1 +
 hw/riscv/k230.c         | 23 +++++++++++++++++++----
 include/hw/riscv/k230.h |  2 ++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
index d28ac06043..d06ac26648 100644
--- a/hw/riscv/Kconfig
+++ b/hw/riscv/Kconfig
@@ -163,3 +163,4 @@ config K230
     select UNIMP
     select K230_WDT
     select K230_GSDMA
+    select K230_DECOMP_GZIP
diff --git a/hw/riscv/k230.c b/hw/riscv/k230.c
index c80bd65694..7fd1ec4c25 100644
--- a/hw/riscv/k230.c
+++ b/hw/riscv/k230.c
@@ -111,6 +111,8 @@ static void k230_soc_init(Object *obj)
     object_initialize_child(obj, "k230-wdt0", &s->wdt[0], TYPE_K230_WDT);
     object_initialize_child(obj, "k230-wdt1", &s->wdt[1], TYPE_K230_WDT);
     object_initialize_child(obj, "k230-gsdma", &s->gsdma, TYPE_K230_GSDMA);
+    object_initialize_child(obj, "k230-decomp-gzip", &s->decomp_gzip,
+                            TYPE_K230_DECOMP_GZIP);
 
     qdev_prop_set_uint32(DEVICE(cpu0), "hartid-base", 0);
     qdev_prop_set_string(DEVICE(cpu0), "cpu-type", TYPE_RISCV_CPU_THEAD_C908);
@@ -215,6 +217,23 @@ static void k230_soc_realize(DeviceState *dev, Error **errp)
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->gsdma), 0,
                        qdev_get_gpio_in(DEVICE(s->c908_plic), K230_GSDMA_IRQ));
 
+    /* Decomp gzip */
+    qdev_prop_set_uint64(DEVICE(&s->decomp_gzip), "sram-base",
+                         memmap[K230_DEV_SRAM].base);
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->decomp_gzip), errp)) {
+        return;
+    }
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->decomp_gzip), 0,
+                    memmap[K230_DEV_DECOMP_GZIP].base);
+    for (int i = 0; i < K230_DECOMP_GZIP_NUM_GPIOS_OUT; i++) {
+        qdev_connect_gpio_out(DEVICE(&s->decomp_gzip), i,
+                              qdev_get_gpio_in(DEVICE(&s->gsdma), i));
+    }
+    for (int i = 0; i < K230_DECOMP_GZIP_NUM_GPIOS_IN; i++) {
+        qdev_connect_gpio_out(DEVICE(&s->gsdma), i,
+                              qdev_get_gpio_in(DEVICE(&s->decomp_gzip), i));
+    }
+
     /* unimplemented devices */
     create_unimplemented_device("kpu.l2-cache",
                                 memmap[K230_DEV_KPU_L2_CACHE].base,
@@ -233,10 +252,6 @@ static void k230_soc_realize(DeviceState *dev, Error **errp)
     create_unimplemented_device("dma", memmap[K230_DEV_DMA].base,
                                 memmap[K230_DEV_DMA].size);
 
-    create_unimplemented_device("decomp-gzip",
-                                memmap[K230_DEV_DECOMP_GZIP].base,
-                                memmap[K230_DEV_DECOMP_GZIP].size);
-
     create_unimplemented_device("2d-engine.non-ai",
                                 memmap[K230_DEV_NON_AI_2D].base,
                                 memmap[K230_DEV_NON_AI_2D].size);
diff --git a/include/hw/riscv/k230.h b/include/hw/riscv/k230.h
index 156a386edc..a12d36965a 100644
--- a/include/hw/riscv/k230.h
+++ b/include/hw/riscv/k230.h
@@ -19,6 +19,7 @@
 #include "hw/riscv/riscv_hart.h"
 #include "hw/watchdog/k230_wdt.h"
 #include "hw/dma/k230_gsdma.h"
+#include "hw/misc/k230_decomp_gzip.h"
 
 #define C908_CPU_HARTID   (0)
 
@@ -35,6 +36,7 @@ typedef struct K230SoCState {
 
     K230WdtState wdt[2];
     K230GSDMAState gsdma;
+    K230DecompGzipState decomp_gzip;
     MemoryRegion sram;
     MemoryRegion bootrom;
 
-- 
2.43.0



  parent reply	other threads:[~2026-07-27 16:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 15:56 [PATCH v2 0/7] K230: add gsdma and decomp_gzip Tao Ding
2026-07-27 15:56 ` [PATCH v2 1/7] hw/dma: add K230 gsdma Tao Ding
2026-08-06 11:34   ` Daniel Henrique Barboza
2026-08-07  4:46   ` Chao Liu
2026-07-27 15:56 ` [PATCH v2 2/7] hw/riscv: k230: add gsdma in K230 board Tao Ding
2026-08-06 11:34   ` Daniel Henrique Barboza
2026-07-27 15:56 ` [PATCH v2 3/7] tests/qtest: add test for K230 gsdma Tao Ding
2026-08-06 11:36   ` Daniel Henrique Barboza
2026-07-27 15:56 ` [PATCH v2 4/7] hw/misc: add K230 decomp gzip Tao Ding
2026-08-06 11:47   ` Daniel Henrique Barboza
2026-07-27 15:57 ` Tao Ding [this message]
2026-08-06 11:48   ` [PATCH v2 5/7] hw/riscv: k230: add decomp gzip in K230 board Daniel Henrique Barboza
2026-07-27 15:57 ` [PATCH v2 6/7] tests/qtest: add test for K230 decomp gzip Tao Ding
2026-08-06 12:14   ` Daniel Henrique Barboza
2026-07-27 15:57 ` [PATCH v2 7/7] hw/riscv: k230: add a noc stub region in K230 board Tao Ding
2026-08-06 12:15   ` Daniel Henrique Barboza

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=20260727155702.36484-6-dingtao0430@163.com \
    --to=dingtao0430@163.com \
    --cc=alistair.francis@wdc.com \
    --cc=caojunze424@gmail.com \
    --cc=chao.liu@processmission.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=farosas@suse.de \
    --cc=liwei1518@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.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 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.