From nobody Mon Sep 29 21:25:13 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 274E7C00140 for ; Tue, 16 Aug 2022 00:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352731AbiHPAUk (ORCPT ); Mon, 15 Aug 2022 20:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357631AbiHPAN5 (ORCPT ); Mon, 15 Aug 2022 20:13:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 147C8178C34; Mon, 15 Aug 2022 13:30:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32BB3B80EB1; Mon, 15 Aug 2022 20:30:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81BBCC433D7; Mon, 15 Aug 2022 20:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595432; bh=94xa95o8KqgbjETlbVwuPqDvmR7RMIi6Gf8mC9KqAAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KzGHOxpndLkRBVAqtN52TBgNsZsftMuPviFP9kJjd6YBOufAsY3B9wCccNzL5vSb8 fZlhqqwnb4Fz4fodm7bXF+vflq0pr0074TJbgL/Zr3Mm01m1PhDcwzfCckULa+pHW5 lUVg4o0JPtGcIxzkvJSnXCdXbqnxM5i13J/X7Gz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.19 0730/1157] KVM: selftests: Convert s390x/diag318_test_handler away from VCPU_ID Date: Mon, 15 Aug 2022 20:01:26 +0200 Message-Id: <20220815180508.661549997@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 7cdcdfe50d8d68b7b9ba2e1b0345ff47fdda390f ] Convert diag318_test_handler to use vm_create_with_vcpus() and pass around a 'struct kvm_vcpu' object instead of passing around vCPU IDs. Note, this is a "functional" change in the sense that the test now creates a vCPU with vcpu_id=3D=3D0 instead of vcpu_id=3D=3D6. The non-zero VCPU_ID was 100% ar= bitrary and added little to no validation coverage. If testing non-zero vCPU IDs is desirable for generic tests, that can be done in the future by tweaking the VM creation helpers. Signed-off-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- .../selftests/kvm/lib/s390x/diag318_test_handler.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c b= /tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c index 86b9e611ad87..21c31fe10c1a 100644 --- a/tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c +++ b/tools/testing/selftests/kvm/lib/s390x/diag318_test_handler.c @@ -8,8 +8,6 @@ #include "test_util.h" #include "kvm_util.h" =20 -#define VCPU_ID 6 - #define ICPT_INSTRUCTION 0x04 #define IPA0_DIAG 0x8300 =20 @@ -27,14 +25,15 @@ static void guest_code(void) */ static uint64_t diag318_handler(void) { + struct kvm_vcpu *vcpu; struct kvm_vm *vm; struct kvm_run *run; uint64_t reg; uint64_t diag318_info; =20 - vm =3D vm_create_default(VCPU_ID, 0, guest_code); - vcpu_run(vm, VCPU_ID); - run =3D vcpu_state(vm, VCPU_ID); + vm =3D vm_create_with_one_vcpu(&vcpu, guest_code); + vcpu_run(vm, vcpu->id); + run =3D vcpu->run; =20 TEST_ASSERT(run->exit_reason =3D=3D KVM_EXIT_S390_SIEIC, "DIAGNOSE 0x0318 instruction was not intercepted"); --=20 2.35.1