Re: [PATCH v2 3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V

"Nutty.Liu" <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <SE3PR04MB89228527CBE8BC6CAE525B07F3DA2@SE3PR04MB8922.apcprd04.prod.outlook.com>
On 8/12/2026 7:03 AM, Jinyu Tang wrote:
> RISC-V now supports KVM_PRE_FAULT_MEMORY, so include the generic
> pre_fault_memory_test in the RISC-V KVM selftest build.
>
> The test uses PAGE_SIZE from the architecture processor header. Define
> the normal 4K RISC-V selftest page size so the generic test can build
> for RISC-V.
>
> Signed-off-by: Jinyu Tang <[email protected]>
Reviewed-by: Nutty Liu <[email protected]>

Thanks,
Nutty
> ---
> v1 -> v2:
> - Drop the per-test guest_modes_append_default() call from
>    pre_fault_memory_test.c.  RISC-V already initializes supported and
>    default guest modes from kvm_selftest_arch_init(), which is called by
>    the common kvm_selftest_init() constructor, as suggested by Sean.
>
>   tools/testing/selftests/kvm/Makefile.kvm              | 1 +
>   tools/testing/selftests/kvm/include/riscv/processor.h | 3 +++
>   2 files changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/Makefile.kvm b/tools/testing/selftests/kvm/Makefile.kvm
> index 6fc34e9bf8e1..ac64ac92fd4b 100644
> --- a/tools/testing/selftests/kvm/Makefile.kvm
> +++ b/tools/testing/selftests/kvm/Makefile.kvm
> @@ -225,6 +225,7 @@ TEST_GEN_PROGS_riscv += coalesced_io_test
>   TEST_GEN_PROGS_riscv += dirty_log_perf_test
>   TEST_GEN_PROGS_riscv += get-reg-list
>   TEST_GEN_PROGS_riscv += mmu_stress_test
> +TEST_GEN_PROGS_riscv += pre_fault_memory_test
>   TEST_GEN_PROGS_riscv += rseq_test
>   TEST_GEN_PROGS_riscv += steal_time
>   
> diff --git a/tools/testing/selftests/kvm/include/riscv/processor.h b/tools/testing/selftests/kvm/include/riscv/processor.h
> index abde3c71c891..70487c8ed155 100644
> --- a/tools/testing/selftests/kvm/include/riscv/processor.h
> +++ b/tools/testing/selftests/kvm/include/riscv/processor.h
> @@ -12,6 +12,9 @@
>   #include <asm/vdso/processor.h>
>   #include "kvm_util.h"
>   
> +#define PAGE_SHIFT		12
> +#define PAGE_SIZE		BIT_ULL(PAGE_SHIFT)
> +
>   #define INSN_OPCODE_MASK	0x007c
>   #define INSN_OPCODE_SHIFT	2
>   #define INSN_OPCODE_SYSTEM	28
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.