[v6,4/4] KVM: selftests: Add test cases for LoongArch
Commit Message
From: Tianrui Zhao <zhaotianrui@loongson.cn>
Some common KVM testcases are supported on LoongArch now as following:
demand_paging_test
dirty_log_perf_test
dirty_log_test
guest_print_test
hardware_disable_test
kvm_binary_stats_test
kvm_create_max_vcpus
kvm_page_table_test
memslot_modification_stress_test
memslot_perf_test
set_memory_region_test
And other test cases are not supported by LoongArch such as rseq_test,
since it is not supported on LoongArch physical machine neither.
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
tools/testing/selftests/kvm/Makefile | 16 ++++++++++++++++
.../selftests/kvm/set_memory_region_test.c | 2 +-
2 files changed, 17 insertions(+), 1 deletion(-)
Comments
On Thu, Jan 25, 2024, Bibo Mao wrote:
> diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c
> index 075b80dbe237..7b09e59296be 100644
> --- a/tools/testing/selftests/kvm/set_memory_region_test.c
> +++ b/tools/testing/selftests/kvm/set_memory_region_test.c
> @@ -333,7 +333,7 @@ static void test_invalid_memory_region_flags(void)
> struct kvm_vm *vm;
> int r, i;
>
> -#if defined __aarch64__ || defined __x86_64__
> +#if defined __aarch64__ || defined __x86_64__ || __loongarch__
I assume that last one wants to be "defined __loongarch__"
> supported_flags |= KVM_MEM_READONLY;
> #endif
>
> --
> 2.39.3
>
On 2024/1/27 上午4:28, Sean Christopherson wrote:
> On Thu, Jan 25, 2024, Bibo Mao wrote:
>> diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c
>> index 075b80dbe237..7b09e59296be 100644
>> --- a/tools/testing/selftests/kvm/set_memory_region_test.c
>> +++ b/tools/testing/selftests/kvm/set_memory_region_test.c
>> @@ -333,7 +333,7 @@ static void test_invalid_memory_region_flags(void)
>> struct kvm_vm *vm;
>> int r, i;
>>
>> -#if defined __aarch64__ || defined __x86_64__
>> +#if defined __aarch64__ || defined __x86_64__ || __loongarch__
>
> I assume that last one wants to be "defined __loongarch__"
Good catch, it should be "defined __loongarch__". And I will refresh
the patch in the next version.
Regards
Bibo Mao
>
>> supported_flags |= KVM_MEM_READONLY;
>> #endif
>>
>> --
>> 2.39.3
>>
@@ -56,6 +56,10 @@ LIBKVM_s390x += lib/s390x/ucall.c
LIBKVM_riscv += lib/riscv/processor.c
LIBKVM_riscv += lib/riscv/ucall.c
+LIBKVM_loongarch += lib/loongarch/processor.c
+LIBKVM_loongarch += lib/loongarch/ucall.c
+LIBKVM_loongarch += lib/loongarch/exception.S
+
# Non-compiled test targets
TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh
@@ -196,6 +200,18 @@ TEST_GEN_PROGS_riscv += steal_time
SPLIT_TESTS += get-reg-list
+TEST_GEN_PROGS_loongarch += demand_paging_test
+TEST_GEN_PROGS_loongarch += dirty_log_perf_test
+TEST_GEN_PROGS_loongarch += dirty_log_test
+TEST_GEN_PROGS_loongarch += guest_print_test
+TEST_GEN_PROGS_loongarch += hardware_disable_test
+TEST_GEN_PROGS_loongarch += kvm_binary_stats_test
+TEST_GEN_PROGS_loongarch += kvm_create_max_vcpus
+TEST_GEN_PROGS_loongarch += kvm_page_table_test
+TEST_GEN_PROGS_loongarch += memslot_modification_stress_test
+TEST_GEN_PROGS_loongarch += memslot_perf_test
+TEST_GEN_PROGS_loongarch += set_memory_region_test
+
TEST_PROGS += $(TEST_PROGS_$(ARCH_DIR))
TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH_DIR))
TEST_GEN_PROGS_EXTENDED += $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR))
@@ -333,7 +333,7 @@ static void test_invalid_memory_region_flags(void)
struct kvm_vm *vm;
int r, i;
-#if defined __aarch64__ || defined __x86_64__
+#if defined __aarch64__ || defined __x86_64__ || __loongarch__
supported_flags |= KVM_MEM_READONLY;
#endif