From patchwork Tue Nov 15 21:38:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Annapurve X-Patchwork-Id: 1701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2955813wru; Tue, 15 Nov 2022 13:48:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Qwkfd7sxqrJL6jKqBuN5kWHd3woIzYqPKzoW/tDDDBbq87WodPHSxvuLiRHb/p2bL/bh1 X-Received: by 2002:aa7:c512:0:b0:45c:935b:ae15 with SMTP id o18-20020aa7c512000000b0045c935bae15mr16199216edq.357.1668548911683; Tue, 15 Nov 2022 13:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668548911; cv=none; d=google.com; s=arc-20160816; b=xwb4UUxyqOIbwN7X9dBsJyX64wtlJd+s+hC6+bDiZwEQww2AEYOXD4mcXHDq9fgLSJ Fa32lWdveGZX0jh7qzdXJG3Ujo4WfDTyGeCXOUlJUge0C4QMtczjA+aQzfrQdC9FIT+b uhPQBsPdi6u1NVjkpZWEhP1r5KKa/StvzYOwD1M31a+dJNKbRSmJQYrlCzkzwQPWrY+e EI0XgwZDS7lA/1MIGWhQa+c/H4D60gpGe+TYQMILbXbPOHLDG8WoLtVS74rEc6ST02oe VBjRckuqAmv+/E7FePj/zGDOFaNhZTgrCPq3CHKpgc3iyKg9Got7yqwk/7J+X3ibQ08l KGGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=svCMw+RaLDOYb1vqpYARG5pCSZevHShYbQvFoMbmBJQ=; b=vKhFs7Ze/GmLXXTAiUZlvBMmGZn1wGQggYLq2iWFIR8HVjHuIHngtBL+qhehd6acP8 Cu6QNp9JZxWKaHWR+x5vx+gptfDp9oHNzhtg5PxZZ8ZBMKPmKL20NQ4A3g7CJNGiXX8j dNEZAPj24iUXtodVr2dPzwYxBXrFxWR1XEoOPUUK4aLBhap5L2FXuHqfwJc7E3Kpn+xu 0kwUj+KKmIr/y2LzYVM3qQtaNouWoY9+g8EMC7gfvG1eITSa/TT4MSfMcXuKj43JB6GH lD4fO0W55iESKAdNeVlaqCKLOp7fgbsz+pyq1XvCyabK5iPPh+gNtHsrWvd3PglzYuN8 Rilg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=pwMbojns; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc33-20020a1709071c2100b0078d9db99f5esi14220018ejc.39.2022.11.15.13.48.07; Tue, 15 Nov 2022 13:48:31 -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=@google.com header.s=20210112 header.b=pwMbojns; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232330AbiKOVix (ORCPT + 99 others); Tue, 15 Nov 2022 16:38:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbiKOViu (ORCPT ); Tue, 15 Nov 2022 16:38:50 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09C13A1AA for ; Tue, 15 Nov 2022 13:38:50 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id g193-20020a636bca000000b00476a2298bd1so2577982pgc.12 for ; Tue, 15 Nov 2022 13:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=svCMw+RaLDOYb1vqpYARG5pCSZevHShYbQvFoMbmBJQ=; b=pwMbojnsCf9knVk3mY2LzdmP9u4GdT5s825DJV9W8WItQzHCXB3AZYTBakzggIR2zx fNvtuTxYjykqA+Pw8MHuptNCqrR6sq43OfbBXFaslxfpCcz8ndxe8JmqzrV5XFX+XFWZ OwGjjWsZcD1D1mQ4E6bA8GUpJS6jOFtYJLuA+NMzcL2DhUR8S+Ox9DRWhDmJLz1Ljqvl j6w3T6PkAnd/sHMQlaswetwTJpoWzMY8+RwG4CKFS40vMzbxkK+UguvSwdkfTHbEjWtc +BdbaZliRcFhWKsmaGoSULZdWrKF/v3TXb+kbAwlowS002KNmUVqjZMXP+JmVbncMQh7 iriA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=svCMw+RaLDOYb1vqpYARG5pCSZevHShYbQvFoMbmBJQ=; b=ZT12nkWwPohEyw5EEjKGX1G514EfAvgg1KameK9eQLvzUVIV15N9npP3/vDjvO+T2h LXUAkTdBQYLsfcyToX0GDIaVAZFPJCamR/pMHTi8m7Pt2R1IlOCWZYRG4ZYpN5MhyPFn BluY78SYfTbu1kFz16GLno70XZi7gC5526qARJWIgMyAmeB5MOo+v6q8Me/IFu8Zlvbe HNbB1Ql4sBwFngHRz+ybTgrxqRn028ZeTtD8L8WbNXQvo1vgaVqDHSllAWqsQyOXx5Aa ml/M9mXn3mEmxNtwv+fwQonO/DxCuYZdnuMbhOcZ99hdqWLRrxd4STRZOapIoENtmPWL X9cg== X-Gm-Message-State: ANoB5plTcqwRt78M+Y6awDaH/tnT3sdcZKmIsI0p79swnh2rzgqyRr6o e9aZoAXo7fD6DFZysjN819AkqrNh8YiU91ky X-Received: from vannapurve2.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:41f8]) (user=vannapurve job=sendgmr) by 2002:a17:902:cec2:b0:17f:8a20:d9b5 with SMTP id d2-20020a170902cec200b0017f8a20d9b5mr5918630plg.76.1668548329463; Tue, 15 Nov 2022 13:38:49 -0800 (PST) Date: Tue, 15 Nov 2022 21:38:42 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221115213845.3348210-1-vannapurve@google.com> Subject: [V4 PATCH 0/3] Minor improvements to the selftest setup logic From: Vishal Annapurve To: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: pbonzini@redhat.com, shuah@kernel.org, bgardon@google.com, seanjc@google.com, oupton@google.com, peterx@redhat.com, vkuznets@redhat.com, dmatlack@google.com, pgonda@google.com, andrew.jones@linux.dev, Vishal Annapurve X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749600343570357408?= X-GMAIL-MSGID: =?utf-8?q?1749600343570357408?= This series is posted in context of the discussion at: https://lore.kernel.org/lkml/Ywa9T+jKUpaHLu%2Fl@google.com/ Major changes: 1) Move common startup logic to a single function in kvm_util.c 2) Introduce following APIs: kvm_selftest_arch_init: to perform arch specific common startup. kvm_arch_vm_post_create: to perform arch specific common setup after VM creation. Changelog ========= v4: * Removed the patch to precompute cpu type, will be introduced as part of a separate series in future. v3: * Original series is split into two and this v3 version contains the improvements to selftest and VM setup. * Planning to upload the second series to execute hypercall instruction according to cpu type separately. * Addressed comments from David and Sean. link to v3: https://lore.kernel.org/lkml/20221013121319.994170-1-vannapurve@google.com/ v2: * Addressed comments from Andrew and David * Common function with constructor attribute used to setup initial state * Changes are split in more logical granules as per feedback link to v2: https://lore.kernel.org/all/20220915000448.1674802-1-vannapurve@google.com/ Vishal Annapurve (3): KVM: selftests: move common startup logic to kvm_util.c KVM: selftests: Add arch specific initialization KVM: selftests: Add arch specific post vm creation hook .../selftests/kvm/aarch64/arch_timer.c | 3 --- .../selftests/kvm/aarch64/hypercalls.c | 2 -- .../testing/selftests/kvm/aarch64/vgic_irq.c | 3 --- .../selftests/kvm/include/kvm_util_base.h | 9 ++++++++ .../selftests/kvm/lib/aarch64/processor.c | 18 ++++++++-------- tools/testing/selftests/kvm/lib/kvm_util.c | 21 ++++++++++++++++--- .../selftests/kvm/lib/x86_64/processor.c | 6 ++++++ .../testing/selftests/kvm/memslot_perf_test.c | 3 --- tools/testing/selftests/kvm/rseq_test.c | 3 --- tools/testing/selftests/kvm/s390x/memop.c | 2 -- tools/testing/selftests/kvm/s390x/resets.c | 2 -- .../selftests/kvm/s390x/sync_regs_test.c | 3 --- .../selftests/kvm/set_memory_region_test.c | 3 --- .../kvm/x86_64/cr4_cpuid_sync_test.c | 3 --- .../kvm/x86_64/emulator_error_test.c | 3 --- .../selftests/kvm/x86_64/hyperv_cpuid.c | 3 --- .../selftests/kvm/x86_64/platform_info_test.c | 3 --- .../kvm/x86_64/pmu_event_filter_test.c | 3 --- .../selftests/kvm/x86_64/set_sregs_test.c | 3 --- .../kvm/x86_64/svm_nested_soft_inject_test.c | 3 --- .../selftests/kvm/x86_64/sync_regs_test.c | 3 --- .../selftests/kvm/x86_64/userspace_io_test.c | 3 --- .../kvm/x86_64/userspace_msr_exit_test.c | 3 --- 23 files changed, 42 insertions(+), 66 deletions(-)