Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12286561rwd; Fri, 23 Jun 2023 04:11:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5A0BoQyuxJFmkTVr1iuKth3fqNjJqxUyQwtya5ySL8xO3Cf4zdP+UsqZy+RWnS2fabvFgr X-Received: by 2002:a17:903:41ce:b0:1b6:6a14:3734 with SMTP id u14-20020a17090341ce00b001b66a143734mr21204236ple.29.1687518711507; Fri, 23 Jun 2023 04:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687518711; cv=none; d=google.com; s=arc-20160816; b=RvIt0CM9oznzKitmgX/qokIWEVAAZ0VxwTSIjicqrRsG4RLtnxxfMmuHDSI4WU4sos e6tzprCJNdTjMbXWRsFQU9W8b8zEsOG7WL+X9JNY7qC1KJ+ydQnmws8U2NJTVX5Oj6YR oJwUhCMwZuLzlxAx1pd6xhOz1BjRmhoxJ+MV4apaGIN6x9o4Si9kSDQvIEviRHYuOeyl qITD8klWiuud5mZe0eD4MIy4Z8X1cqfmyTD4ix0ufXKYUx2D2fAvr0l3Mi87Tqvm9/SH 6jzUJiusjqmBSxDj0okq0qhR8tEs8ZDGYL+p4OIzKfTWRfVrZMifdgjICKN6Hlyhl8Yd ugRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=1aDCAUHOx+DHRGbPag2F3pxcB6IqPj16hvokK+GojKk=; b=0dklb2tWVXxEx/pPwjQ1UJ/k7M6/sKg2fIWBfunttNvJ9+/zlXg6sYJLsafOp02uT7 MjIj3PSz7W5pnp7bBgdco8SyuH89ojK2YPKTyF5jggLGSlp04QIPtcBV9rKPNyHFhAqE 5HuAA1JGLdkW+fHn0mwUz5wTbS3/tVIKIq27My5kEv4h6J2/jUsy6AfdHquyv2LO1qZ/ H8GnyBaQg+4plXJmaratZWLAkefB8l9oGQQUhFjgpWjwb9EXie/QUorevuGM7cHgcTsM hWTO5EgdrMVBZB9I+K+G4Y82I4nBs9JUdOW3J5xFpmehN39+VNhxRoaQ8IFGAHhCSryw oNwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=FNDW5Uv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk16-20020a170903071000b001ae7da95d0esi7829716plb.479.2023.06.23.04.11.38; Fri, 23 Jun 2023 04:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=FNDW5Uv7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231570AbjFWKhT (ORCPT + 99 others); Fri, 23 Jun 2023 06:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjFWKg5 (ORCPT ); Fri, 23 Jun 2023 06:36:57 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEA342968; Fri, 23 Jun 2023 03:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687516589; x=1719052589; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d9hxFxP3+aBRBc+Ceyr9PCiVTSv/k2Q6TXUwS8frSIo=; b=FNDW5Uv7uS0EQ5tXmYgO3+KVGdkpqj9xD9tEu9jPiIQ4gq01pX9GoQZG 5lKfooi9MNp1JoHwcSQueutFhanLu6Yut6QZwsiezfTD5A+8wYcWjTYGj A1Aq0vXyUV3T3jwGXA4kSrTu2Y1U7A3p4082bUnjupFMZWYo/m1qhfqEK iZw7xoVzjyPsd3ZXRbcXMVyVqEEIv9/4/b86iJiQnBR4UZefWmlgquJDL MRaGAIdoKPc1yvWRc6EoDsUgAWSnNtzJb3dj+Qi7sDBtIi9V9/vI1UK2p IaDy0k8+48QJlNX4b6ygFz3tN4iya2Dt7XV96V/5CB8AgwiT0LN+GQ5ln g==; X-IronPort-AV: E=McAfee;i="6600,9927,10749"; a="447112630" X-IronPort-AV: E=Sophos;i="6.01,151,1684825200"; d="scan'208";a="447112630" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2023 03:36:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10749"; a="715276142" X-IronPort-AV: E=Sophos;i="6.01,151,1684825200"; d="scan'208";a="715276142" Received: from haibo-optiplex-7090.sh.intel.com ([10.239.159.132]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2023 03:36:20 -0700 From: Haibo Xu Cc: xiaobo55x@gmail.com, haibo1.xu@intel.com, ajones@ventanamicro.com, maz@kernel.org, oliver.upton@linux.dev, seanjc@google.com, Paolo Bonzini , Jonathan Corbet , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan , James Morse , Suzuki K Poulose , Zenghui Yu , David Matlack , Ben Gardon , Ricardo Koller , Vishal Annapurve , Vipin Sharma , Colton Lewis , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: [PATCH v4 08/12] KVM: arm64: selftests: Move reject_set check logic to a function Date: Fri, 23 Jun 2023 18:40:10 +0800 Message-Id: <341feff384c9f8a20ed4aac6e2dda0440d6b84f2.1687515463.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional changes. Just move the reject_set check logic to a function so we can check for specific errno for specific register. This is a preparation for support reject_set in riscv. Suggested-by: Andrew Jones Signed-off-by: Haibo Xu --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 8 ++++++++ tools/testing/selftests/kvm/get-reg-list.c | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c index aaf035c969ec..4e2e1fe833eb 100644 --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c @@ -27,6 +27,14 @@ bool filter_reg(__u64 reg) return false; } +bool reject_set_fail(__u64 reg) +{ + if (reg == KVM_REG_ARM64_SVE_VLS) + return (errno != EPERM); + + return false; +} + #define REG_MASK (KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_COPROC_MASK) #define CORE_REGS_XX_NR_WORDS 2 diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c index f6ad7991a812..b956ee410996 100644 --- a/tools/testing/selftests/kvm/get-reg-list.c +++ b/tools/testing/selftests/kvm/get-reg-list.c @@ -98,6 +98,11 @@ void __weak print_reg(const char *prefix, __u64 id) printf("\t0x%llx,\n", id); } +bool __weak reject_set_fail(__u64 reg) +{ + return false; +} + #ifdef __aarch64__ static void prepare_vcpu_init(struct vcpu_reg_list *c, struct kvm_vcpu_init *init) { @@ -216,7 +221,7 @@ static void run_test(struct vcpu_reg_list *c) if (s->rejects_set && find_reg(s->rejects_set, s->rejects_set_n, reg.id)) { reject_reg = true; ret = __vcpu_ioctl(vcpu, KVM_SET_ONE_REG, ®); - if (ret != -1 || errno != EPERM) { + if (ret != -1 || reject_set_fail(reg.id)) { printf("%s: Failed to reject (ret=%d, errno=%d) ", config_name(c), ret, errno); print_reg(config_name(c), reg.id); putchar('\n'); -- 2.34.1