History log of /kvm-unit-tests/lib/riscv/ (Results 1 – 25 of 71)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
f3f3386108-Jul-2025 Paolo Bonzini <pbonzini@redhat.com>

Merge tag 'kvm-x86-2025.06.26' of https://github.com/kvm-x86/kvm-unit-tests into HEAD

x86 fixes, cleanups, and new test coverage

- Ensure APIC is xAPIC mode for APIC MMIO tests.

- Expand the I/O

Merge tag 'kvm-x86-2025.06.26' of https://github.com/kvm-x86/kvm-unit-tests into HEAD

x86 fixes, cleanups, and new test coverage

- Ensure APIC is xAPIC mode for APIC MMIO tests.

- Expand the I/O APIC routing reconfiguration vs. EOI interception testcase
to validate multiple in-flight interrupts.

- Fix a variety of minor PMU/PEBS bugs and warts.

- Fix the nSVM MSR interception test to actually detect failures, and expand
its coverage to validate more scenarios.

- Add X86_PROPERTY_xxx macros (stolen from KVM selftests) and use them to
clean up related code.

- Add testcases for MSR_SPEC_CTRL, and an msr64 config to validate negative
testcases (i.e. when MSRs aren't supposed to exist).

- Disable PIT re-injection for all tests so that (x2)AVIC isn't inhibited due
to enabling in-kernel PIT emulation.

- Play nice with QEMU builds that disable VNC support.

show more ...


/kvm-unit-tests/README.md
/kvm-unit-tests/arm/efi/run
/kvm-unit-tests/arm/run
/kvm-unit-tests/arm/unittests.cfg
/kvm-unit-tests/configure
/kvm-unit-tests/docs/unittests.txt
asm/isa.h
/kvm-unit-tests/lib/s390x/asm/arch_def.h
/kvm-unit-tests/lib/s390x/fault.c
/kvm-unit-tests/lib/util.h
/kvm-unit-tests/lib/x86/amd_sev.c
/kvm-unit-tests/lib/x86/amd_sev.h
/kvm-unit-tests/lib/x86/apic.h
/kvm-unit-tests/lib/x86/asm/bitops.h
/kvm-unit-tests/lib/x86/desc.c
/kvm-unit-tests/lib/x86/desc.h
/kvm-unit-tests/lib/x86/msr.h
/kvm-unit-tests/lib/x86/pmu.c
/kvm-unit-tests/lib/x86/pmu.h
/kvm-unit-tests/lib/x86/processor.h
/kvm-unit-tests/lib/x86/setup.c
/kvm-unit-tests/lib/x86/smp.c
/kvm-unit-tests/powerpc/run
/kvm-unit-tests/powerpc/unittests.cfg
/kvm-unit-tests/riscv/efi/run
/kvm-unit-tests/riscv/isa-dbltrp.c
/kvm-unit-tests/riscv/run
/kvm-unit-tests/riscv/sbi-dbtr.c
/kvm-unit-tests/riscv/sbi-fwft.c
/kvm-unit-tests/riscv/unittests.cfg
/kvm-unit-tests/run_tests.sh
/kvm-unit-tests/s390x/run
/kvm-unit-tests/s390x/unittests.cfg
/kvm-unit-tests/scripts/arch-run.bash
/kvm-unit-tests/scripts/common.bash
/kvm-unit-tests/scripts/mkstandalone.sh
/kvm-unit-tests/scripts/runtime.bash
/kvm-unit-tests/scripts/vmm.bash
/kvm-unit-tests/x86/access.c
/kvm-unit-tests/x86/amd_sev.c
/kvm-unit-tests/x86/apic.c
/kvm-unit-tests/x86/cstart.S
/kvm-unit-tests/x86/cstart64.S
/kvm-unit-tests/x86/emulator.c
/kvm-unit-tests/x86/emulator64.c
/kvm-unit-tests/x86/ioapic.c
/kvm-unit-tests/x86/la57.c
/kvm-unit-tests/x86/lam.c
/kvm-unit-tests/x86/msr.c
/kvm-unit-tests/x86/pks.c
/kvm-unit-tests/x86/pmu.c
/kvm-unit-tests/x86/pmu_pebs.c
/kvm-unit-tests/x86/run
/kvm-unit-tests/x86/svm_npt.c
/kvm-unit-tests/x86/svm_tests.c
/kvm-unit-tests/x86/unittests.cfg
/kvm-unit-tests/x86/vmx_tests.c
/kvm-unit-tests/x86/xsave.c
f81e4fa401-Jul-2025 Jesse Taube <jesse@rivosinc.com>

riscv: sbi: Add SBI Debug Triggers Extension tests

Add tests for the DBTR SBI extension.

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-b

riscv: sbi: Add SBI Debug Triggers Extension tests

Add tests for the DBTR SBI extension.

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Charlie Jenkins <charlie@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

3494b83924-Jun-2025 Jesse Taube <jesse@rivosinc.com>

riscv: lib: Pass test status on sbi shutdown

The SBI SRST system reset function used to exit the test takes two
parameters. The first is used to request a shutdown and the second
describes the reaso

riscv: lib: Pass test status on sbi shutdown

The SBI SRST system reset function used to exit the test takes two
parameters. The first is used to request a shutdown and the second
describes the reason. A value of zero means "no reason" and a value
of one means "system failure". Other values are currently reserved.
Use the value of zero to indicate that the tests completed and all
passed and of one otherwise.

It may be possible for the SBI implemention to use this information
to alert testers of failing or aborting tests.

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
[Enhanced commit message and changed sbi_shutdown param to a bool.]
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

e844ca0c16-Jun-2025 Clément Léger <cleger@rivosinc.com>

riscv: Add ISA double trap extension testing

This test allows to test the double trap implementation of hardware as
well as the SBI FWFT and SSE support for double trap. The tests will try
to trigge

riscv: Add ISA double trap extension testing

This test allows to test the double trap implementation of hardware as
well as the SBI FWFT and SSE support for double trap. The tests will try
to trigger double trap using various sequences and will test to receive
the SSE double trap event if supported.

It is provided as a separate test from the SBI one for two reasons:
- It isn't specifically testing SBI "per se".
- It ends up by trying to crash into in M-mode.

Currently, the test uses a page fault to raise a trap programatically.
Some concern was raised by a github user on the original branch [1]
saying that the spec doesn't mandate any trap to be delegatable and that
we would need a way to detect which ones are delegatable. I think we can
safely assume that PAGE FAULT is delegatable and if a hardware that does
not have support comes up then it will probably be the vendor
responsibility to provide a way to do so.

Link: https://github.com/clementleger/kvm-unit-tests/issues/1 [1]
Signed-off-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

3b60ab9216-Jun-2025 Clément Léger <cleger@rivosinc.com>

lib/riscv: export FWFT functions

These functions will be needed by other tests as well, expose them.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <andrew.jones@linux

lib/riscv: export FWFT functions

These functions will be needed by other tests as well, expose them.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

66c61c9e13-Jun-2025 Jesse Taube <jesse@rivosinc.com>

riscv: Allow SBI_CONSOLE with no uart in device tree

When CONFIG_SBI_CONSOLE is enabled and there is no uart defined in the
device tree kvm-unit-tests fails to start.

Only abort when uart is not fo

riscv: Allow SBI_CONSOLE with no uart in device tree

When CONFIG_SBI_CONSOLE is enabled and there is no uart defined in the
device tree kvm-unit-tests fails to start.

Only abort when uart is not found in device tree if SBI_CONSOLE is false

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

863e0b9029-May-2025 Sean Christopherson <seanjc@google.com>

lib: Add and use static_assert() convenience wrappers

Add static_assert() to wrap _Static_assert() with stringification of the
tested expression as the assert message. In most cases, the failed
exp

lib: Add and use static_assert() convenience wrappers

Add static_assert() to wrap _Static_assert() with stringification of the
tested expression as the assert message. In most cases, the failed
expression is far more helpful than a human-generated message (usually
because the developer is forced to add _something_ for the message).

For API consistency, provide a double-underscore variant for specifying a
custom message.

Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Link: https://lore.kernel.org/r/20250529221929.3807680-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...

e726be6e05-Jun-2025 Jesse Taube <jesse@rivosinc.com>

riscv: Add RV_INSN_LEN to processor.h

When handling traps and faults it is often necessary to know the size
of the instruction at epc. Add RV_INSN_LEN to calculate the
instruction size.

Signed-off-

riscv: Add RV_INSN_LEN to processor.h

When handling traps and faults it is often necessary to know the size
of the instruction at epc. Add RV_INSN_LEN to calculate the
instruction size.

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

56a3019922-Mar-2025 Andrew Jones <andrew.jones@linux.dev>

riscv: Support using SBI DBCN for the console

We don't want to add support for lots of UARTs nor lots of support
for UARTs. Thankfully SBI may have the DBCN extension, allowing us
to use that instea

riscv: Support using SBI DBCN for the console

We don't want to add support for lots of UARTs nor lots of support
for UARTs. Thankfully SBI may have the DBCN extension, allowing us
to use that instead when our simple UART support is insufficient.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

fbeeb84710-Dec-2024 Samuel Holland <samuel.holland@sifive.com>

riscv: Support UARTs with different I/O widths

Integration of ns16550-compatible UARTs is often done with 16 or 32-bit wide
registers. Add support for these using the standard DT properties.

Signed

riscv: Support UARTs with different I/O widths

Integration of ns16550-compatible UARTs is often done with 16 or 32-bit wide
registers. Add support for these using the standard DT properties.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
[Changed default reg-shift to 0]
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

521cb2ad10-Dec-2024 Samuel Holland <samuel.holland@sifive.com>

riscv: Rate limit UART output to avoid FIFO overflows

This is necessary when running tests on bare metal.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Andrew Jones <andr

riscv: Rate limit UART output to avoid FIFO overflows

This is necessary when running tests on bare metal.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

a3fc877821-Mar-2025 Andrew Jones <andrew.jones@linux.dev>

lib/riscv: Also provide sbiret impl functions

We almost always return sbiret from sbi wrapper functions so
do that for sbi_get_imp_version() and sbi_get_imp_id(), but
asserting no error and returnin

lib/riscv: Also provide sbiret impl functions

We almost always return sbiret from sbi wrapper functions so
do that for sbi_get_imp_version() and sbi_get_imp_id(), but
asserting no error and returning the value is also useful,
so continue to provide those functions too, just with a slightly
different name.

Reviewed-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

98ea1f9617-Mar-2025 Clément Léger <cleger@rivosinc.com>

lib: riscv: Add SBI SSE support

Add support for registering and handling SSE events. This will be used
for sbi tests as well as upcoming double trap tests.

Signed-off-by: Clément Léger <cleger@rivo

lib: riscv: Add SBI SSE support

Add support for registering and handling SSE events. This will be used
for sbi tests as well as upcoming double trap tests.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

f16317a717-Mar-2025 Clément Léger <cleger@rivosinc.com>

riscv: lib: Add SBI SSE extension definitions

Add SBI SSE extension definitions in sbi.h

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed

riscv: lib: Add SBI SSE extension definitions

Add SBI SSE extension definitions in sbi.h

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

240729ee17-Mar-2025 Clément Léger <cleger@rivosinc.com>

lib: riscv: Add functions to get implementer ID and version

These functions will be used by SSE tests to check for a specific OpenSBI
version.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Sig

lib: riscv: Add functions to get implementer ID and version

These functions will be used by SSE tests to check for a specific OpenSBI
version.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

b9d58c2717-Mar-2025 Clément Léger <cleger@rivosinc.com>

lib: riscv: Add functions for version checking

Version checking was done using some custom hardcoded values, backport a
few SBI function and defines from Linux to do that cleanly.

Signed-off-by: Cl

lib: riscv: Add functions for version checking

Version checking was done using some custom hardcoded values, backport a
few SBI function and defines from Linux to do that cleanly.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

0cc3a35122-Feb-2025 Sean Christopherson <seanjc@google.com>

lib: Use __ASSEMBLER__ instead of __ASSEMBLY__

Convert all non-x86 #ifdefs from __ASSEMBLY__ to __ASSEMBLER__, and remove
all manual __ASSEMBLY__ #defines. __ASSEMBLY_ was inherited blindly from
th

lib: Use __ASSEMBLER__ instead of __ASSEMBLY__

Convert all non-x86 #ifdefs from __ASSEMBLY__ to __ASSEMBLER__, and remove
all manual __ASSEMBLY__ #defines. __ASSEMBLY_ was inherited blindly from
the Linux kernel, and must be manually defined, e.g. through build rules
or with the aforementioned explicit #defines in assembly code.

__ASSEMBLER__ on the other hand is automatically defined by the compiler
when preprocessing assembly, i.e. doesn't require manually #defines for
the code to function correctly.

Ignore x86, as x86 doesn't actually rely on __ASSEMBLY__ at the moment,
and is undergoing a parallel cleanup.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Message-ID: <20250222014526.2302653-1-seanjc@google.com>
[thuth: Fix three more occurances in libfdt.h and sbi-tests.h]
Signed-off-by: Thomas Huth <thuth@redhat.com>

show more ...

f130243228-Jan-2025 Clément Léger <cleger@rivosinc.com>

riscv: Add tests for SBI FWFT extension

Add tests for the FWFT SBI extension. Currently, only the reserved range
as well as the misaligned exception delegation are used.

Signed-off-by: Clément Lége

riscv: Add tests for SBI FWFT extension

Add tests for the FWFT SBI extension. Currently, only the reserved range
as well as the misaligned exception delegation are used.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...


/kvm-unit-tests/Makefile
/kvm-unit-tests/arm/pmu.c
asm/sbi.h
/kvm-unit-tests/lib/s390x/asm/arch_def.h
/kvm-unit-tests/lib/s390x/asm/cpacf.h
/kvm-unit-tests/lib/s390x/asm/facility.h
/kvm-unit-tests/lib/s390x/asm/sie-arch.h
/kvm-unit-tests/lib/s390x/sie-icpt.c
/kvm-unit-tests/lib/s390x/sie-icpt.h
/kvm-unit-tests/lib/s390x/sie.c
/kvm-unit-tests/lib/s390x/sie.h
/kvm-unit-tests/lib/s390x/snippet-exit.h
/kvm-unit-tests/lib/x86/apic-defs.h
/kvm-unit-tests/lib/x86/apic.h
/kvm-unit-tests/lib/x86/asm/page.h
/kvm-unit-tests/lib/x86/atomic.h
/kvm-unit-tests/lib/x86/desc.c
/kvm-unit-tests/lib/x86/desc.h
/kvm-unit-tests/lib/x86/msr.h
/kvm-unit-tests/lib/x86/pmu.c
/kvm-unit-tests/lib/x86/processor.h
/kvm-unit-tests/lib/x86/setup.c
/kvm-unit-tests/lib/x86/smp.c
/kvm-unit-tests/lib/x86/smp.h
/kvm-unit-tests/riscv/Makefile
/kvm-unit-tests/riscv/sbi-fwft.c
/kvm-unit-tests/riscv/sbi-tests.h
/kvm-unit-tests/riscv/sbi.c
/kvm-unit-tests/s390x/Makefile
/kvm-unit-tests/s390x/cpu-sie.S
/kvm-unit-tests/s390x/cpu.S
/kvm-unit-tests/s390x/diag258.c
/kvm-unit-tests/s390x/edat.c
/kvm-unit-tests/s390x/pv-diags.c
/kvm-unit-tests/s390x/pv-icptcode.c
/kvm-unit-tests/s390x/pv-ipl.c
/kvm-unit-tests/s390x/sie-dat.c
/kvm-unit-tests/s390x/snippets/Makefile
/kvm-unit-tests/s390x/snippets/c/sie-dat.c
/kvm-unit-tests/s390x/snippets/c/stfle.c
/kvm-unit-tests/s390x/snippets/lib/snippet-exit.h
/kvm-unit-tests/s390x/stfle-sie.c
/kvm-unit-tests/s390x/unittests.cfg
/kvm-unit-tests/x86/Makefile.common
/kvm-unit-tests/x86/Makefile.i386
/kvm-unit-tests/x86/Makefile.x86_64
/kvm-unit-tests/x86/asyncpf.c
/kvm-unit-tests/x86/cstart.S
/kvm-unit-tests/x86/cstart64.S
/kvm-unit-tests/x86/debug.c
/kvm-unit-tests/x86/efi/efistart64.S
/kvm-unit-tests/x86/la57.c
/kvm-unit-tests/x86/lam.c
/kvm-unit-tests/x86/pcid.c
/kvm-unit-tests/x86/pmu.c
/kvm-unit-tests/x86/pmu_lbr.c
/kvm-unit-tests/x86/pmu_pebs.c
/kvm-unit-tests/x86/trampolines.S
/kvm-unit-tests/x86/unittests.cfg
/kvm-unit-tests/x86/vmx_tests.c
f35fe0ee29-Jan-2025 Andrew Jones <andrew.jones@linux.dev>

riscv: efi: Bump number of memregions

There may be a bunch of EFI memory regions in the EFI memory map,
which we convert to k-u-t memregions. Bump the number we allow to
ensure we don't hit the asse

riscv: efi: Bump number of memregions

There may be a bunch of EFI memory regions in the EFI memory map,
which we convert to k-u-t memregions. Bump the number we allow to
ensure we don't hit the assert in memregions_add().

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

2ffe016f18-Oct-2024 Andrew Jones <andrew.jones@linux.dev>

riscv: sbi: Add SUSP tests

Introduce tests for SBI system suspend. The basic test makes
sure it works and other tests make sure it fails as expected
with invalid entry criteria.

To test on QEMU or

riscv: sbi: Add SUSP tests

Introduce tests for SBI system suspend. The basic test makes
sure it works and other tests make sure it fails as expected
with invalid entry criteria.

To test on QEMU or hardware the firmware needs to support system
suspend. For QEMU, OpenSBI can be told to enable its system
suspend test mode by creating a new DTB which has

opensbi-config {
compatible = "opensbi,config";
system-suspend-test;
};

added to the 'chosen' node. Then, run with '-dtb susp.dtb'.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

53cded0417-Oct-2024 Andrew Jones <andrew.jones@linux.dev>

riscv: Implement setjmp/longjmp

Being able to do setjmp and longjmp can be quite useful for tests.
Implement the functions for riscv.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

56ca809323-Oct-2024 Andrew Jones <andrew.jones@linux.dev>

riscv: Add sbi_send_ipi_broadcast

Coming SBI IPI tests will use this, but as it could be useful for
other tests too, add it to the library.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

1bdc4a6209-Sep-2024 Andrew Jones <andrew.jones@linux.dev>

riscv: sbi: Improve spec version test

SBI spec version states that bit 31 must be zero and, when xlen
is greater than 32, that bit 32 and higher must be zero. Check
these bits are zero in the expect

riscv: sbi: Improve spec version test

SBI spec version states that bit 31 must be zero and, when xlen
is greater than 32, that bit 32 and higher must be zero. Check
these bits are zero in the expected value to ensure we test
appropriately.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

50fab1a523-Oct-2024 Andrew Jones <andrew.jones@linux.dev>

riscv: Rework smp_boot_secondary

Use HSM status to determine when a secondary should be started.
Also save the stack pointer so a secondary may be stopped and
started again without leaking old stack

riscv: Rework smp_boot_secondary

Use HSM status to determine when a secondary should be started.
Also save the stack pointer so a secondary may be stopped and
started again without leaking old stacks.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

d4827ec023-Oct-2024 Andrew Jones <andrew.jones@linux.dev>

riscv: Filter unmanaged harts from present mask

We use SBI to manage harts and SBI may have a different idea of which
harts it should manage than our hardware description. Filter out all
harts which

riscv: Filter unmanaged harts from present mask

We use SBI to manage harts and SBI may have a different idea of which
harts it should manage than our hardware description. Filter out all
harts which fail an SBI HSM status call from the present mask to
ensure we don't try to use them.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>

show more ...

123