All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Joel Stanley <joel@jms.id.au>
Cc: Alistair Francis <alistair23@gmail.com>,
	pbonzini@redhat.com, marcandre.lureau@redhat.com,
	alistair.francis@wdc.com, farosas@suse.de, lvivier@redhat.com,
	liwei1518@gmail.com, daniel.barboza@oss.qualcomm.com,
	zhiwei_liu@linux.alibaba.com, chao.liu.zevorn@gmail.com,
	jserv@ccns.ncku.edu.tw, eleanor15x@gmail.com,
	marscheng@google.com, qemu-devel@nongnu.org,
	qemu-riscv@nongnu.org
Subject: Re: [PATCH v3 5/5] tests/qtest: Add qtest for Milk-V Duo board
Date: Tue, 7 Jul 2026 01:54:02 +0800	[thread overview]
Message-ID: <akvruoEI-PbAJ9es@google.com> (raw)
In-Reply-To: <CACPK8Xes3v8zoq4d35vLCHe8hs71nP87nAmkgvyr6WOMj9s4Ew@mail.gmail.com>

i Joel and Alistair,

On Wed, Jul 01, 2026 at 01:05:55PM +0930, Joel Stanley wrote:
> On Mon, 29 Jun 2026 at 11:21, Alistair Francis <alistair23@gmail.com> wrote:
> >
> > On Wed, Jun 17, 2026 at 5:04 AM Kuan-Wei Chiu <visitorckw@gmail.com> wrote:
> > >
> > > Add minimal qtest coverage for the Milk-V Duo machine to validate basic
> > > MMIO mapping and register access.
> > >
> > > Currently tested:
> > > - Verify DW8250 UART component version and type signatures.
> > > - Test read/write access to CV1800B clock bypass register.
> > >
> > > Tested with:
> > > $ meson test -C build -v qemu:qtest-riscv64/milkv-duo-test
> > > [...]
> > > Ok:                 1
> > > Fail:               0
> > >
> > > Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> > > ---
> > >  MAINTAINERS                  |  1 +
> > >  tests/qtest/meson.build      |  3 +-
> > >  tests/qtest/milkv-duo-test.c | 70 ++++++++++++++++++++++++++++++++++++
> > >  3 files changed, 73 insertions(+), 1 deletion(-)
> > >  create mode 100644 tests/qtest/milkv-duo-test.c
> > >
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index e197dcb5b2..472513537f 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -1807,6 +1807,7 @@ F: hw/riscv/milkv_duo.c
> > >  F: include/hw/char/dw8250.h
> > >  F: include/hw/misc/cv1800b_clk.h
> > >  F: include/hw/riscv/cv1800b.h
> > > +F: tests/qtest/milkv-duo-test.c
> > >
> > >  RX Machines
> > >  -----------
> > > diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> > > index 4897325d84..38acbdc0c8 100644
> > > --- a/tests/qtest/meson.build
> > > +++ b/tests/qtest/meson.build
> > > @@ -293,7 +293,8 @@ qtests_riscv64 = ['riscv-csr-test'] + \
> > >    (config_all_devices.has_key('CONFIG_IOMMU_TESTDEV') and
> > >     config_all_devices.has_key('CONFIG_RISCV_IOMMU') ?
> > >     ['iommu-riscv-test'] : []) + \
> > > -  (config_all_devices.has_key('CONFIG_K230') ? ['k230-wdt-test'] : [])
> > > +  (config_all_devices.has_key('CONFIG_K230') ? ['k230-wdt-test'] : []) + \
> > > +   ['milkv-duo-test']
> > >
> > >  qos_test_ss = ss.source_set()
> > >  qos_test_ss.add(
> > > diff --git a/tests/qtest/milkv-duo-test.c b/tests/qtest/milkv-duo-test.c
> > > new file mode 100644
> > > index 0000000000..06064b8733
> > > --- /dev/null
> > > +++ b/tests/qtest/milkv-duo-test.c
> > > @@ -0,0 +1,70 @@
> > > +/*
> > > + * QTest for Milk-V Duo Board
> > > + *
> > > + * Copyright (c) 2026 Kuan-Wei Chiu <visitorckw@gmail.com>
> > > + *
> > > + * SPDX-License-Identifier: GPL-2.0-or-later
> > > + */
> > > +
> > > +#include "qemu/osdep.h"
> > > +#include "libqtest.h"
> > > +
> > > +#define CV1800B_CLK_BASE            0x03002000
> > > +#define CV1800B_CLK_BYPASS          0x030
> > > +#define CV1800B_CLK_BYPASS_RESET    0xFFFFFFFF
> > > +#define TEST_PATTERN_5A             0x5A5A5A5A
> > > +#define TEST_PATTERN_A5             0xA5A5A5A5
> > > +
> > > +#define CV1800B_UART0_BASE          0x04140000
> > > +#define DW_UART_UCV                 0xF8
> > > +#define DW_UART_CTR                 0xFC
> > > +#define DW_UART_VERSION_3_23A       0x3332332A
> > > +#define DW_UART_TYPE_SIGNATURE      0x44570110
> > > +
> > > +static void test_milkv_duo_uart(void)
> > > +{
> > > +    QTestState *qts;
> > > +    uint32_t component_version;
> > > +    uint32_t component_type;
> > > +
> > > +    qts = qtest_init("-M milkv-duo");
> > > +
> > > +    component_version = qtest_readl(qts, CV1800B_UART0_BASE + DW_UART_UCV);
> > > +    g_assert_cmphex(component_version, ==, DW_UART_VERSION_3_23A);
> > > +
> > > +    component_type = qtest_readl(qts, CV1800B_UART0_BASE + DW_UART_CTR);
> > > +    g_assert_cmphex(component_type, ==, DW_UART_TYPE_SIGNATURE);
> > > +
> > > +    qtest_quit(qts);
> > > +}
> > > +
> > > +static void test_milkv_duo_clk(void)
> > > +{
> > > +    QTestState *qts;
> > > +    uint32_t clk_bypass_val;
> > > +
> > > +    qts = qtest_init("-M milkv-duo");
> > > +
> > > +    clk_bypass_val = qtest_readl(qts, CV1800B_CLK_BASE + CV1800B_CLK_BYPASS);
> > > +    g_assert_cmphex(clk_bypass_val, ==, CV1800B_CLK_BYPASS_RESET);
> > > +
> > > +    qtest_writel(qts, CV1800B_CLK_BASE + CV1800B_CLK_BYPASS, TEST_PATTERN_5A);
> > > +    clk_bypass_val = qtest_readl(qts, CV1800B_CLK_BASE + CV1800B_CLK_BYPASS);
> > > +    g_assert_cmphex(clk_bypass_val, ==, TEST_PATTERN_5A);
> > > +
> > > +    qtest_writel(qts, CV1800B_CLK_BASE + CV1800B_CLK_BYPASS, TEST_PATTERN_A5);
> > > +    clk_bypass_val = qtest_readl(qts, CV1800B_CLK_BASE + CV1800B_CLK_BYPASS);
> > > +    g_assert_cmphex(clk_bypass_val, ==, TEST_PATTERN_A5);
> > > +
> > > +    qtest_quit(qts);
> > > +}
> > > +
> > > +int main(int argc, char **argv)
> > > +{
> > > +    g_test_init(&argc, &argv, NULL);
> > > +
> > > +    qtest_add_func("/riscv/milkv-duo/uart", test_milkv_duo_uart);
> > > +    qtest_add_func("/riscv/milkv-duo/clk", test_milkv_duo_clk);
> >
> > Thanks for the tests. These are just checking some static values
> > though. Can you also add a boot test?
> 
> +1
> 
>  A functional test that exercises -bios -kernel -dtb, as well as the
> sd device would be great.

I'll try to add the boot test.

I assume this means the test will need a way to fetch the kernel image
and dtb from somewhere. Would it be acceptable to host these files on
my personal github, or is there a more appropriate place I should
upload them to?

Regards,
Kuan-Wei


  reply	other threads:[~2026-07-06 17:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 19:01 [PATCH v3 0/5] hw/riscv: Add support for Milk-V Duo board Kuan-Wei Chiu
2026-06-16 19:01 ` [PATCH v3 1/5] hw/char: Add dw8250 UART Kuan-Wei Chiu
2026-06-29  1:31   ` Alistair Francis
2026-07-01  4:04   ` Joel Stanley
2026-07-06 18:21     ` Kuan-Wei Chiu
2026-07-08  2:43   ` Portia Stephens
2026-06-16 19:01 ` [PATCH v3 2/5] hw/misc: Add Sophgo CV1800B clock controller Kuan-Wei Chiu
2026-06-17  6:46   ` Chao Liu
2026-06-22 21:30     ` Kuan-Wei Chiu
2026-06-16 19:01 ` [PATCH v3 3/5] hw/riscv: Add Sophgo CV1800B SoC support Kuan-Wei Chiu
2026-06-29  1:42   ` Alistair Francis
2026-06-29  1:44     ` Alistair Francis
2026-07-01  4:19   ` Joel Stanley
2026-06-16 19:01 ` [PATCH v3 4/5] hw/riscv: Add Milk-V Duo board support Kuan-Wei Chiu
2026-06-29  1:48   ` Alistair Francis
2026-07-01  3:33   ` Joel Stanley
2026-07-02 13:40   ` Chao Liu
2026-06-16 19:01 ` [PATCH v3 5/5] tests/qtest: Add qtest for Milk-V Duo board Kuan-Wei Chiu
2026-06-29  1:51   ` Alistair Francis
2026-07-01  3:35     ` Joel Stanley
2026-07-06 17:54       ` Kuan-Wei Chiu [this message]
2026-07-07  1:33         ` Alistair Francis
2026-06-17  6:37 ` [PATCH v3 0/5] hw/riscv: Add support " Chao Liu
2026-06-22 21:31   ` Kuan-Wei Chiu

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=akvruoEI-PbAJ9es@google.com \
    --to=visitorckw@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=chao.liu.zevorn@gmail.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=eleanor15x@gmail.com \
    --cc=farosas@suse.de \
    --cc=joel@jms.id.au \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=liwei1518@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marscheng@google.com \
    --cc=pbonzini@redhat.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.