From patchwork Fri Feb 2 04:10:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: maobibo X-Patchwork-Id: 195559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp198491dyc; Thu, 1 Feb 2024 20:12:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbYhGlplkdqTjv7w9EaVzoATwAcmPqK99SpjBZku5X0EtV3LrZUnwa1U0i/7zsB8aPuilU X-Received: by 2002:a17:906:b107:b0:a35:e5f4:fef7 with SMTP id u7-20020a170906b10700b00a35e5f4fef7mr677632ejy.68.1706847176872; Thu, 01 Feb 2024 20:12:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706847176; cv=pass; d=google.com; s=arc-20160816; b=ZMaiW2U/8MttHWJFw2r/JYVVVsiFkhaKS/gqFZhj5n3057xr9btVMrPICc9iVyEG+n taptP59oNbZZfWXVaamLGCpjRNQ5nGZ735H2dwAkjD05jiad1b1xKvySA84qrMjbeBJH 9UZ4uiNVv0Y+W1VbTMpfFcXtt0xpJ3g8S4DfERLH4MKf3EpNinxzQpZib7hzKdLJRTXd 0Xh/yHHOEu19fiZcaA8NV+svW+4DXdx8ZF6kpBvRjmDV50Ty1kzGluBnI4+Se2nur+f6 GoYAIk7Ez/4UjlpoW69mcJYeppXkCPbTaKamG2trQpTprnYlm2SG9lCOkVVJA34rCJDB 5C6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=HR8D4sJEMZ56Ni66pMBG4rdbI+wSTV+4Nk2pbAR/ToA=; fh=3qqUdzFNbYgpo2EoFuY/jTLh/ASNfxh1W36a0V0fMQg=; b=cP6OUTkzo7alsrpaehZ3sYHa4ZYwJm0jNKtH33wK9cB+rCxK+G3Q9swXh8vOZhvjNU +5ZuWxPk4WwkzYa8s6i4XxrGHhdMFIokqi4oMvuT79j/UbrdBQrMfZJmUP52xDuwLHo0 RkdjYS+tWTAL1MzvD/7yBQZCWsRMDXc62AjVjkeA5k/v0fbW9vM/1pyAtO/FC+hdizaM 1Uywr8r0j9itx79k8hTtD2+M7C+eSxjrDndYb26JcKbsm6vH5L38ZBKPQhRZP9PYEA+X 93tCbBvtT2V0DOLA1kAPkUqg/bR2UAhHS6e0G+nkOVs9i+w8kcyOnXzNzIfqPGEbKUHS IKvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-49181-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49181-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVvAYrM5pPHoCUzUahCP+Th0NxogufuP6TZDZDsHY7y+H76JiMTuHC6c9eSmdchAN9MLt4ol5QxmiYXsFFotm5s1xJtnQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cf13-20020a170906b2cd00b00a35c5491b2dsi445105ejb.846.2024.02.01.20.12.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 20:12:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49181-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=loongson.cn); spf=pass (google.com: domain of linux-kernel+bounces-49181-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49181-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7B3811F23624 for ; Fri, 2 Feb 2024 04:12:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48EE11774A; Fri, 2 Feb 2024 04:11:02 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3782F508; Fri, 2 Feb 2024 04:10:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706847060; cv=none; b=dwEekKwrjNBk1V660Io7xXt+RDl6SBFR3zZYOzflaTkd/gCp8N2IvyRf2n6vJWBOrHDSC/rhFg7tM4MaZ/CmDTuNV3+Q2ZNwE9SUtjZKBKiSBpO3Ad7XAj4U/LJ1t08Jlu++7jZ7ozBt2+bE9P/XAT+mxVsK7UzFWCx8ZplcxvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706847060; c=relaxed/simple; bh=LiOCyLFruOphupmn52/zjX6PXxgRWEIgzMpTYjIYNVc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mQgdXr+fWkNzO7smn1LO8rOY6Th8IQLwQNcur/y8/ylexjyQMBAw1/rXlnTC64JlO9fzc7kRkjRE89bOmBREstKFehtmJdL9MpaJNDUlpe+WYstUM4oDUE387jMrX+EFUGLKgj1BiNz8g74wttg2FjMlFXzIWs3dIBboE8tFQrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8DxaOhKa7xlcf4JAA--.9336S3; Fri, 02 Feb 2024 12:10:50 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxvhNGa7xlhd0sAA--.51008S6; Fri, 02 Feb 2024 12:10:49 +0800 (CST) From: Bibo Mao To: Paolo Bonzini , Sean Christopherson Cc: Tianrui Zhao , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v7 4/4] KVM: selftests: Add test cases for LoongArch Date: Fri, 2 Feb 2024 12:10:46 +0800 Message-Id: <20240202041046.3405779-5-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240202041046.3405779-1-maobibo@loongson.cn> References: <20240202041046.3405779-1-maobibo@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxvhNGa7xlhd0sAA--.51008S6 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZr4fAFy3XrWDWFyDtw1kWFX_yoW5AF1Upa 4xCryqvF48CFsrAr1fG34DXa1fGr97KrWIgFyfKw18ur93Jw1xJF1xKasrtFn5tw1rXwn0 v3WfKw17XaykAwbCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUk2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv 67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6x kF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUcCD7UUUUU X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789758985485319486 X-GMAIL-MSGID: 1789758985485319486 From: Tianrui Zhao 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 Signed-off-by: Bibo Mao --- tools/testing/selftests/kvm/Makefile | 16 ++++++++++++++++ .../selftests/kvm/set_memory_region_test.c | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 492e937fab00..0261c87b0bb3 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -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)) diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c index 075b80dbe237..fce54108fdc0 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__ || defined __loongarch__ supported_flags |= KVM_MEM_READONLY; #endif