On Fri, Jan 30, 2026 at 11:46:42AM +0800, Tao Tang wrote:
> Hi Chao,
> 
> On 2026/1/29 17:39, Chao Liu wrote:
> > Introduce a libqos helper module for RISC-V IOMMU testing with
> > iommu-testdev. The helper provides routines to:
> > 
> > - Build device contexts (DC) and 3-level page tables for SV39/SV39x4
> > - Program command queue (CQ), fault queue (FQ), and DDTP registers
> >    following the RISC-V IOMMU specification
> > - Execute DMA translations and verify results
> > 
> > The current implementation supports SV39 for S-stage and SV39x4 for
> > G-stage translation. Support for SV48/SV48x4/SV57/SV57x4 can be added
> > in future patches.
> > 
> > Signed-off-by: Chao Liu <[email protected]>
> > ---
> >   MAINTAINERS                          |   1 +
> >   tests/qtest/libqos/meson.build       |   2 +-
> >   tests/qtest/libqos/qos-riscv-iommu.c | 405 +++++++++++++++++++++++++++
> >   tests/qtest/libqos/qos-riscv-iommu.h | 164 +++++++++++
> >   4 files changed, 571 insertions(+), 1 deletion(-)
> >   create mode 100644 tests/qtest/libqos/qos-riscv-iommu.c
> >   create mode 100644 tests/qtest/libqos/qos-riscv-iommu.h
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index dccdf47888..830f56376b 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -3584,6 +3584,7 @@ M: Tao Tang <[email protected]>
> >   S: Maintained
> >   F: tests/qtest/libqos/qos-iommu*
> >   F: tests/qtest/libqos/qos-smmuv3*
> > +F: tests/qtest/libqos/qos-riscv-iommu*
> >   Device Fuzzing
> >   M: Alexander Bulekov <[email protected]>
> > diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
> > index b4daec808f..4a69acad0d 100644
> > --- a/tests/qtest/libqos/meson.build
> > +++ b/tests/qtest/libqos/meson.build
> > @@ -71,7 +71,7 @@ if have_virtfs
> >   endif
> >   if config_all_devices.has_key('CONFIG_RISCV_IOMMU')
> > -  libqos_srcs += files('riscv-iommu.c')
> > +  libqos_srcs += files('riscv-iommu.c', 'qos-riscv-iommu.c')
> >   endif
> >   if config_all_devices.has_key('CONFIG_TPCI200')
> >     libqos_srcs += files('tpci200.c')
> > diff --git a/tests/qtest/libqos/qos-riscv-iommu.c 
> > b/tests/qtest/libqos/qos-riscv-iommu.c
> > new file mode 100644
> > index 0000000000..6c60889eeb
> > --- /dev/null
> > +++ b/tests/qtest/libqos/qos-riscv-iommu.c
> > @@ -0,0 +1,405 @@
> > +/*
> > + * QOS RISC-V IOMMU Module
> > + *
> > + * This module provides RISC-V IOMMU-specific helper functions for libqos 
> > tests,
> > + * encapsulating RISC-V IOMMU setup, and assertions.
> > + *
> > + * Copyright (c) 2026 Chao Liu <[email protected]>
> > + *
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + */
> > +
> > +#include "qemu/osdep.h"
> > +#include "qemu/bitops.h"
> 
> 
> This include is unnecessary: hw/misc/iommu-testdev.h (pulled in by
> qos-riscv-iommu.h) already includes hw/pci/pci.h, and hw/pci/pci.h itself
> includes bitops.h.
> 
> > +#include "hw/riscv/riscv-iommu-bits.h"
> > +#include "tests/qtest/libqos/pci.h"
> 
> Same. qos-iommu-testdev.h has included tests/qtest/libqos/pci.h.
> 
Thanks for the review. I'ill fix this in v3.

Thanks,
Chao
> 
> Besides
> 
> Reviewed-by: Tao Tang <[email protected]>
> 
> 
> Thanks,
> 
> Tao
> 
> 
> > +#include "qos-iommu-testdev.h"
> > +#include "qos-riscv-iommu.h"
> > +
> 

Reply via email to