Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5523875rwb; Tue, 22 Nov 2022 00:54:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf4eR/QeTdleo5XrgDXv/ZhZdKd1mw+ATaYmND95YTzfs5vKZNRhpIMbWkef7gg01YtFqP/u X-Received: by 2002:a17:902:ebcc:b0:17e:20ec:545a with SMTP id p12-20020a170902ebcc00b0017e20ec545amr7492136plg.112.1669107285406; Tue, 22 Nov 2022 00:54:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669107285; cv=none; d=google.com; s=arc-20160816; b=m5MPXB6gpBfSrQSrlByL6DRNiPg76kFYBf/Dj6uAWZ54tdArsNdMKOFH2vUh01xRSr aNX7DoSP1Pq55xMLR1pdbpawU9NUJRhuBVthHLG17M8zc8DGGn8O/65qhZokq3Jq2zlD /jAuBjgorLCROfglU30O2Rfghd71OSLacRRS2/UQLNm86no0OzkRYHzDl9iejdAoyD4a DmZTDL/Z7reJ2CimyJ2f2ZUZViTGCYpzKwwrGj9QbsZQimzKFyCf326K3j3opiss9KFi q85iqQ3FxGFqHu03lusvVg6k4/y74A7JLeHJc72kMb3YkYwt3Phbi+4aeUKkzMBHqet6 zeIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Rifkp7obcWWXPx9xWSCjpQuWQ7gvbRTBtiWo8m0gkU0=; b=IkeD4jo83GhLvOFG8DT7Iv3dUz1j5J5xTNiIRzeW5wJqcw7mqnrNj87MXqTTBsIubO TThXOY2zCvimw09jbmzi//Mjgc+xa4shULk0YnxXzTU4YgNT6CCNcsGQF04ia0mxfYJW atN4BpY3QkmsUSxkjYuteuPGHK54Df9/aVSm3M1pM5feGUxO5M8jcUcl81B/z++gXx38 xrH6UqmsG4/aLZiFuCBmB4welMZI4RafZH6BmGNzkB8CyCaZVu+uaX0Y6o8fP0xqC4un PAbZAwwARQ2ftEV2xp8HmBShID9VEpcI4qey7stcptmTCsUZXYoSD9wGAEEuUx4K2k93 KSnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jm21awnX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a17090341c500b00186b76f4655si9020427ple.358.2022.11.22.00.54.27; Tue, 22 Nov 2022 00:54:45 -0800 (PST) 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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jm21awnX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232620AbiKVHxw (ORCPT + 92 others); Tue, 22 Nov 2022 02:53:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbiKVHxo (ORCPT ); Tue, 22 Nov 2022 02:53:44 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C3A9BF4C for ; Mon, 21 Nov 2022 23:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669103564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rifkp7obcWWXPx9xWSCjpQuWQ7gvbRTBtiWo8m0gkU0=; b=Jm21awnX4dzz7gWFAblruH4ez1kou6VMVhaAro5k+difkiJ6yvImiIzQ365RUqoNlbXSI6 Xkv390ccHrG/+rBOepDXyp2nDI9st7B+KqS1t9WtfWXDeEzfTPW/AMxnHrlrt5JFGYKQ7m AMQBPGVNC+Lnoy1ZKBsLSh0axVSK16A= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-209-BkO7U55eNnmOrNkUfq3-_A-1; Tue, 22 Nov 2022 02:52:42 -0500 X-MC-Unique: BkO7U55eNnmOrNkUfq3-_A-1 Received: by mail-wm1-f70.google.com with SMTP id c126-20020a1c3584000000b003cfffcf7c1aso8361336wma.0 for ; Mon, 21 Nov 2022 23:52:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Rifkp7obcWWXPx9xWSCjpQuWQ7gvbRTBtiWo8m0gkU0=; b=bGsWUlrnHInkBY6QU0fwaW1Qcf7NLlK1tsMYwSRvwZMiRW3H6/AMSqpqS4dBm8wMH6 Io65EbpeZX5Jx5xHoRDTm0oAFr6JtzUuzjcml2a1CD/5G3hotlA3o+Ng6QYJz2SIzctn kShYRd7kZmxq8OuLEvnYnuidGJSM2csIDsvTwzUMirl7YT3alg0Cv4YIcWpExexTtbgF 5MSIorwBEuX0T1oi5wImxr9zdto/JAuVmDim+uQJSTAuDx0PU8IpLYXxDbmyanIZL5bP 30uI3lIMoR3QRA9Q9udbSt3E/RmyBN5w2jgRP7ZMYsLckUwa6sWMBbc1jeVKwq+HzJlw pYLw== X-Gm-Message-State: ANoB5pnBGn8KDAG90vvIhuaHAu3Z+RqP5CuCG3AUgVulhOFYXcBA5L19 QAJuMDqp/Jw4yT7B8PB3jem8PSw8tiPuyuMHE9IushSP21GS/28lZ39bgxogArhfW8riJ+ZkB7c InTcYI6FPXO1sk4pY0byctuFc X-Received: by 2002:adf:fb46:0:b0:22e:2d49:7d3d with SMTP id c6-20020adffb46000000b0022e2d497d3dmr2580788wrs.505.1669103561383; Mon, 21 Nov 2022 23:52:41 -0800 (PST) X-Received: by 2002:adf:fb46:0:b0:22e:2d49:7d3d with SMTP id c6-20020adffb46000000b0022e2d497d3dmr2580781wrs.505.1669103561123; Mon, 21 Nov 2022 23:52:41 -0800 (PST) Received: from [192.168.0.5] (ip-109-43-176-72.web.vodafone.de. [109.43.176.72]) by smtp.gmail.com with ESMTPSA id b14-20020a5d4d8e000000b0022cbf4cda62sm15603451wru.27.2022.11.21.23.52.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Nov 2022 23:52:40 -0800 (PST) Message-ID: Date: Tue, 22 Nov 2022 08:52:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v3 5/9] KVM: s390: selftest: memop: Move testlist into main Content-Language: en-US To: Janis Schoetterl-Glausch , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: David Hildenbrand , Jonathan Corbet , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, Paolo Bonzini , Shuah Khan , Sven Schnelle References: <20221117221758.66326-1-scgl@linux.ibm.com> <20221117221758.66326-6-scgl@linux.ibm.com> From: Thomas Huth In-Reply-To: <20221117221758.66326-6-scgl@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/11/2022 23.17, Janis Schoetterl-Glausch wrote: > This allows checking if the necessary requirements for a test case are > met via an arbitrary expression. In particular, it is easy to check if > certain bits are set in the memop extension capability. > > Signed-off-by: Janis Schoetterl-Glausch > --- > tools/testing/selftests/kvm/s390x/memop.c | 132 +++++++++++----------- > 1 file changed, 66 insertions(+), 66 deletions(-) > > diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c > index 286185a59238..10f34c629cac 100644 > --- a/tools/testing/selftests/kvm/s390x/memop.c > +++ b/tools/testing/selftests/kvm/s390x/memop.c > @@ -690,87 +690,87 @@ static void test_errors(void) > kvm_vm_free(t.kvm_vm); > } > > -struct testdef { > - const char *name; > - void (*test)(void); > - int extension; > -} testlist[] = { > - { > - .name = "simple copy", > - .test = test_copy, > - }, > - { > - .name = "generic error checks", > - .test = test_errors, > - }, > - { > - .name = "copy with storage keys", > - .test = test_copy_key, > - .extension = 1, > - }, > - { > - .name = "copy with key storage protection override", > - .test = test_copy_key_storage_prot_override, > - .extension = 1, > - }, > - { > - .name = "copy with key fetch protection", > - .test = test_copy_key_fetch_prot, > - .extension = 1, > - }, > - { > - .name = "copy with key fetch protection override", > - .test = test_copy_key_fetch_prot_override, > - .extension = 1, > - }, > - { > - .name = "error checks with key", > - .test = test_errors_key, > - .extension = 1, > - }, > - { > - .name = "termination", > - .test = test_termination, > - .extension = 1, > - }, > - { > - .name = "error checks with key storage protection override", > - .test = test_errors_key_storage_prot_override, > - .extension = 1, > - }, > - { > - .name = "error checks without key fetch prot override", > - .test = test_errors_key_fetch_prot_override_not_enabled, > - .extension = 1, > - }, > - { > - .name = "error checks with key fetch prot override", > - .test = test_errors_key_fetch_prot_override_enabled, > - .extension = 1, > - }, > -}; > > int main(int argc, char *argv[]) > { > int extension_cap, idx; > > + setbuf(stdout, NULL); /* Tell stdout not to buffer its content */ > TEST_REQUIRE(kvm_has_cap(KVM_CAP_S390_MEM_OP)); > + extension_cap = kvm_check_cap(KVM_CAP_S390_MEM_OP_EXTENSION); > > - setbuf(stdout, NULL); /* Tell stdout not to buffer its content */ > + struct testdef { > + const char *name; > + void (*test)(void); > + bool requirements_met; > + } testlist[] = { > + { > + .name = "simple copy", > + .test = test_copy, > + .requirements_met = true, > + }, > + { > + .name = "generic error checks", > + .test = test_errors, > + .requirements_met = true, > + }, > + { > + .name = "copy with storage keys", > + .test = test_copy_key, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "copy with key storage protection override", > + .test = test_copy_key_storage_prot_override, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "copy with key fetch protection", > + .test = test_copy_key_fetch_prot, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "copy with key fetch protection override", > + .test = test_copy_key_fetch_prot_override, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "error checks with key", > + .test = test_errors_key, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "termination", > + .test = test_termination, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "error checks with key storage protection override", > + .test = test_errors_key_storage_prot_override, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "error checks without key fetch prot override", > + .test = test_errors_key_fetch_prot_override_not_enabled, > + .requirements_met = extension_cap > 0, > + }, > + { > + .name = "error checks with key fetch prot override", > + .test = test_errors_key_fetch_prot_override_enabled, > + .requirements_met = extension_cap > 0, I wonder whether it would rather make sense to check for "extension_cap & 1" instead of "extension_cap > 0" ? Anyway: Reviewed-by: Thomas Huth