Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp759827pxp; Fri, 11 Mar 2022 14:23:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVK+75hH9XyMTnFYQ5f+PEvUhRl5HrXsWA8u6ydM5BwwZ442d9NCSKFSzJetz/1LXJuuiy X-Received: by 2002:a17:903:244b:b0:151:d869:3b1f with SMTP id l11-20020a170903244b00b00151d8693b1fmr12753303pls.155.1647037393913; Fri, 11 Mar 2022 14:23:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647037393; cv=none; d=google.com; s=arc-20160816; b=g5pTLW5khDX5X58o89xFNVdIS1J+EUZIr2w1/YFNrsyLioy/4I9Gwgi4Fk29rF05a0 qpk70faynoS7T8ocaSdonKf1EDRe1UhdAjkFMQ/jxgTSVzyCtaCMU6x/M9Huivy0K+AX hDapYX/+heAPd6GwFe+vBO+UFnDszUKobFw14IkCnNNWleJEzN/3c32blEqNiOfergVe aDiLqF2gVei5temRilGTufPKoVso2K59WX84Du7qw6Xy81vZOMnLAuhPy2i0nYSD5oKf LPlrGZQNot5SL+kmWrHx8/XPC8hqRirqUBhA51zAT5nfWNhMTfRZgMg2L4vy4ayBFEJm AtlA== 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:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=K0H87htZ43Oywx7CtDoyzUl7rJXnMPIXTzsnNX6ofLE=; b=UO7pDqmnkuuAY69wuHCXM8ys9YVB5httPAFX7m/PRKm8EYt2i1UhSYSkSUiS+SBeh8 2eCJ6BW8xbUaH3DnLY646OOJsBR9J4gkXa2hfo4VBnHQd5wk67nlUZriKTOoknbEftre +0y7u60z6YnruhYS5uGVaSBM25rX04KVczNcvjXbgsiAwNsXQ73O1B+5ZA3Lqds+JYyK f2gTYVUz1w5jYERd2eVhz8kI2GJ45D2pRmmvSLtP56NiN+mHvjW65VBfKX3d28A+5b85 WUBcrolsDOfHUzEGuVr/6P031xMEcTh0bqrunjO85gKEcKfljmgbpNFBhyzRTpi+d64q 7EUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fW3+D0jY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 4-20020a631344000000b0037392323950si9165438pgt.868.2022.03.11.14.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:23:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fW3+D0jY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F1E82C0AB4; Fri, 11 Mar 2022 13:31:29 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346643AbiCKF5v (ORCPT + 99 others); Fri, 11 Mar 2022 00:57:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346581AbiCKFxs (ORCPT ); Fri, 11 Mar 2022 00:53:48 -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 CD182E54 for ; Thu, 10 Mar 2022 21:52:32 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id v4-20020a63f844000000b003745fd0919aso4211744pgj.20 for ; Thu, 10 Mar 2022 21:52:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=K0H87htZ43Oywx7CtDoyzUl7rJXnMPIXTzsnNX6ofLE=; b=fW3+D0jYolbKcoGiJvlm5no3+9/vaS3U33WgjDwICgUXByOVIw3eCmDpYTwxLzPrr+ eQSVG7qe2QYimVW7aP1Ry+UYOotV4xbmj+D1lrHZvM/T8zjTuEZECSA3ytzW6XnoBR+t YMqQKFBUoZnNwcBL7W3WLdUVnTplt5GnqvGcNyeH4MrHUB5Subltkah9/gvpuJTcNSg5 xNmFn8bCBvyvRlQ5odcoPCeGRGnmom4/6ARMm60LVqN46Z7DQjMAx0CpSzwa+myR4t55 aPqhlG+krnojLkTrQoSPdcJW4bbTlublpyyPBjZCYx10kdjvvyhoWxFuv9qFp7iL/Z+Z kQ1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=K0H87htZ43Oywx7CtDoyzUl7rJXnMPIXTzsnNX6ofLE=; b=wUJPgDnH1UZAcqH8y+e8ahAHyoR6yUeKXcqQ/G2EPLMtLwE3b88GywmAeSXjWzIs9m BvoJq0DgTEhYiJkY2TjvMSA/dFatS/xaY8PyvCf3miVO5SA9UoyFL1g3img1/Gp0J8KM effFaepWZjI5v+1cklcuO/gsGGvHDcvYi5d4xI98SQtCt59d7LyCN6oIFrPdK0TlGz0N 0bKKzbKIoWlkZxY3lWRmBAVQmc68mAlVdhlFAhFNtBoB80IUNKqv7YUAXGtkXRoUT2IQ sFbdrF5QNbhrFuir5HjIoBiQjawXV3MD2CbHFFRIOVM44x+GOOBG4Eq0LoMnWPcr87vz N18g== X-Gm-Message-State: AOAM5322q6Ycx9CsW1yRdtotDa42roOSV+jyzNxDMjeNgoZ290JpcFFi HlCcpQMCvUzXl50I4DQlOfJ70O03RklNaihLHx4PUAf9/feY8alHOLZAiGzUa1SWWnC0ojeqUCa dT0ByWHEx1IHAzz0U76+EU0Jp5NecHxnnLLE4Mm5LNckbDuekmpiJfXggEwOePSCTsgV1Sw== X-Received: from seanjc.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e5]) (user=seanjc job=sendgmr) by 2002:a62:7c58:0:b0:4f6:ebf1:e78d with SMTP id x85-20020a627c58000000b004f6ebf1e78dmr8893697pfc.18.1646977952022; Thu, 10 Mar 2022 21:52:32 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 11 Mar 2022 05:50:02 +0000 In-Reply-To: <20220311055056.57265-1-seanjc@google.com> Message-Id: <20220311055056.57265-52-seanjc@google.com> Mime-Version: 1.0 References: <20220311055056.57265-1-seanjc@google.com> X-Mailer: git-send-email 2.35.1.723.g4982287a31-goog Subject: [RFC PATCH 051/105] KVM: selftests: Convert vmx_close_while_nested_test away from VCPU_ID From: Sean Christopherson To: linux-kernel@vger.kernel.org Cc: Sean Christopherson Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Signed-off-by: Sean Christopherson --- .../kvm/x86_64/vmx_close_while_nested_test.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c b/tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c index edac8839e717..da0363076fba 100644 --- a/tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c +++ b/tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c @@ -18,15 +18,10 @@ #include "kselftest.h" -#define VCPU_ID 5 - enum { PORT_L0_EXIT = 0x2000, }; -/* The virtual machine object. */ -static struct kvm_vm *vm; - static void l2_guest_code(void) { /* Exit to L0 */ @@ -53,20 +48,22 @@ static void l1_guest_code(struct vmx_pages *vmx_pages) int main(int argc, char *argv[]) { vm_vaddr_t vmx_pages_gva; + struct kvm_vcpu *vcpu; + struct kvm_vm *vm; nested_vmx_check_supported(); - vm = vm_create_default(VCPU_ID, 0, (void *) l1_guest_code); + vm = vm_create_with_one_vcpu(&vcpu, l1_guest_code); /* Allocate VMX pages and shared descriptors (vmx_pages). */ vcpu_alloc_vmx(vm, &vmx_pages_gva); - vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_gva); + vcpu_args_set(vm, vcpu->id, 1, vmx_pages_gva); for (;;) { - volatile struct kvm_run *run = vcpu_state(vm, VCPU_ID); + volatile struct kvm_run *run = vcpu->run; struct ucall uc; - vcpu_run(vm, VCPU_ID); + vcpu_run(vm, vcpu->id); TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, "Got exit_reason other than KVM_EXIT_IO: %u (%s)\n", run->exit_reason, @@ -75,7 +72,7 @@ int main(int argc, char *argv[]) if (run->io.port == PORT_L0_EXIT) break; - switch (get_ucall(vm, VCPU_ID, &uc)) { + switch (get_ucall(vm, vcpu->id, &uc)) { case UCALL_ABORT: TEST_FAIL("%s", (const char *)uc.args[0]); /* NOT REACHED */ -- 2.35.1.723.g4982287a31-goog