From patchwork Fri Mar 11 17:57:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12778501 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54C10C433EF for ; Fri, 11 Mar 2022 17:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=omMqdFjSToX7TciELx7JZezFwSVuTS/d5icfrYbjEYA=; b=SSdFCbYdZJzPzP5tlrujl7aUOV E5RoEzh2Fqe3P00hxZupmebAAx2vVtu4W5XZa7BH+nGwO8XE8GaMyoLrWYr6towNhaSTulUfPF0we +MlwTOJFO+7pPUY33sxxctqke2bWOrXmi/2t/rjL2n3P8IqHzFS0HZUYtKlomgVeiJEFbgoejAe8P mZrlgf3fkHa6CmDcx7C17TWCGX7/VAprqfbkGMebmv33pQwFvQawy/G/u2zdLnVYWB3PYlXEBufWi zYiq9f/YkaxWPXRQ49wKm3Y8wg+hiarrolz9pPUOZckME7RdG4HpvW0qEQQE1X8YoTBXwOhWMOMVo 32BQKLQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSjWl-00HYUc-9s; Fri, 11 Mar 2022 17:58:11 +0000 Received: from mail-io1-xd4a.google.com ([2607:f8b0:4864:20::d4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSjWK-00HYHq-7Z for linux-arm-kernel@lists.infradead.org; Fri, 11 Mar 2022 17:57:45 +0000 Received: by mail-io1-xd4a.google.com with SMTP id w28-20020a05660205dc00b00645d3cdb0f7so6762005iox.10 for ; Fri, 11 Mar 2022 09:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=BxxrnSwrIA4lSZ5dK5jxyr2r2tLhZUFOrxcbnlilois=; b=fa5WoWeDUYBwu4AqAKpVBlulmdk6ITEQVYZONtJ2u9pcPIxaUyOx/pOBQgOFg52Yd/ wSfGcWikT539Mu8oowRqbz3fzCMwnwM2i5FeKo6/JzeMJsuGnlAwC+RArs0TelINjAXJ YiiylZhsdD+TKZvFRp2bvcQju/VH3KxGC+y7ml99Qp85+xH7mQOVUVbQSpIhRWsaekAN zUx51OPbUCnvBVDxI6VrdMmWwvrjuDqtvEB+rxlLXPR1SULdF0qUS6NAVJnqAB18H1g1 DwvvD2Doyg3jUEWe2BlVwIkjcpUQlP74u15eK66wr6aSPlw3R/xOQ6q7VbMENibsurOl iEYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=BxxrnSwrIA4lSZ5dK5jxyr2r2tLhZUFOrxcbnlilois=; b=c0HEsUtEwZFKsG0VeCVxwu5R3BGxkn9uTk7a9e2onbLOzLlG0ene/6kt0KbZJzCtWN wPaa43y+PtFbYcGriaZbUIgi/mP/XBdvJaRsG26QpQ9bZyZW1SC5hHcTZKD8UbyCC+af DHdKfASCvVnt3aq755qAfKt82Z+4o6aDUZtpk0iETXRVC+baIH6XzhfCn7w1k5tiNXXH 3PQv2raatRZWmtztRCT0rLXNNse4D4f0f0KJLWziveroi5nUa4rF/FjFkFStaYKNQVvo 1DX9SrelU63N6G/eV+im5tcvocCG5k8my5Gihnme02GfweCJXeIPeoiSaXR2rvowv2G/ g75g== X-Gm-Message-State: AOAM530BKtpng959LdJyanfNfaB3EvFUKeJxvEWnA5JBozESNtRrK8x5 /pbaq5n/RRiDkvlIAGgGWjsbHprHSVc= X-Google-Smtp-Source: ABdhPJwX1T89M6pC5yjyrmOZYn4413egwXefNOi34Uw2IPjEjKr6OBMM3S5JvF/Oiv1+jz9CqWb3dK8SDTQ= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a05:6638:2388:b0:314:1ec0:b012 with SMTP id q8-20020a056638238800b003141ec0b012mr9295720jat.224.1647021462801; Fri, 11 Mar 2022 09:57:42 -0800 (PST) Date: Fri, 11 Mar 2022 17:57:15 +0000 In-Reply-To: <20220311175717.616958-1-oupton@google.com> Message-Id: <20220311175717.616958-4-oupton@google.com> Mime-Version: 1.0 References: <20220311174001.605719-1-oupton@google.com> <20220311175717.616958-1-oupton@google.com> X-Mailer: git-send-email 2.35.1.723.g4982287a31-goog Subject: [RFC PATCH kvmtool 3/5] ARM: Stash vcpu_init in the vCPU structure From: Oliver Upton To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Peter Shier , Ricardo Koller , Reiji Watanabe , Will Deacon , Julien Thierry , Oliver Upton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220311_095744_330209_C68390D7 X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A subsequent change to kvmtool will require that a vCPU be reset more than once. Derive a valid target/feature set exactly once and stash that for later use. Signed-off-by: Oliver Upton --- arm/include/arm-common/kvm-cpu-arch.h | 18 +++++++++--------- arm/kvm-cpu.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arm/include/arm-common/kvm-cpu-arch.h b/arm/include/arm-common/kvm-cpu-arch.h index 923d2c4..4027afe 100644 --- a/arm/include/arm-common/kvm-cpu-arch.h +++ b/arm/include/arm-common/kvm-cpu-arch.h @@ -10,18 +10,18 @@ struct kvm; struct kvm_cpu { pthread_t thread; - unsigned long cpu_id; - unsigned long cpu_type; - const char *cpu_compatible; + unsigned long cpu_id; + struct kvm_vcpu_init init; + const char *cpu_compatible; - struct kvm *kvm; - int vcpu_fd; - struct kvm_run *kvm_run; + struct kvm *kvm; + int vcpu_fd; + struct kvm_run *kvm_run; struct kvm_cpu_task *task; - u8 is_running; - u8 paused; - u8 needs_nmi; + u8 is_running; + u8 paused; + u8 needs_nmi; struct kvm_coalesced_mmio_ring *ring; diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c index 6a2408c..1ea56bb 100644 --- a/arm/kvm-cpu.c +++ b/arm/kvm-cpu.c @@ -128,7 +128,7 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) /* Populate the vcpu structure. */ vcpu->kvm = kvm; vcpu->cpu_id = cpu_id; - vcpu->cpu_type = vcpu_init.target; + vcpu->init = vcpu_init; vcpu->cpu_compatible = target->compatible; vcpu->is_running = true;