From mboxrd@z Thu Jan 1 00:00:00 1970 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66EB1C433F5 for ; Tue, 8 Mar 2022 10:28:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A38E449EAA; Tue, 8 Mar 2022 05:27:59 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oGEzXAXIkKpU; Tue, 8 Mar 2022 05:27:57 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3683749ED0; Tue, 8 Mar 2022 05:27:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BDC4749EC2 for ; Tue, 8 Mar 2022 05:27:55 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jBO6H92CxQF8 for ; Tue, 8 Mar 2022 05:27:54 -0500 (EST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0C6AD49E34 for ; Tue, 8 Mar 2022 05:27:53 -0500 (EST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EFDC21FB; Tue, 8 Mar 2022 02:27:52 -0800 (PST) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CC43C3F66F; Tue, 8 Mar 2022 02:27:51 -0800 (PST) Date: Tue, 8 Mar 2022 10:28:17 +0000 From: Alexandru Elisei To: Sebastian Ene Subject: Re: [PATCH kvmtool v8 1/3] aarch64: Populate the vCPU struct before target->init() Message-ID: References: <20220307144243.2039409-1-sebastianene@google.com> <20220307144243.2039409-2-sebastianene@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220307144243.2039409-2-sebastianene@google.com> Cc: maz@kernel.org, will@kernel.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi, On Mon, Mar 07, 2022 at 02:42:42PM +0000, Sebastian Ene wrote: > Move the vCPU structure initialisation before the target->init() call to > keep a reference to the kvm structure during init(). > This is required by the pvtime peripheral to reserve a memory region > while the vCPU is beeing initialised. > > Signed-off-by: Sebastian Ene I think you're missing Marc's Reviewed-by tag. Thanks, Alex > --- > arm/kvm-cpu.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c > index 6a2408c..84ac1e9 100644 > --- a/arm/kvm-cpu.c > +++ b/arm/kvm-cpu.c > @@ -116,6 +116,13 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) > die("Unable to find matching target"); > } > > + /* Populate the vcpu structure. */ > + vcpu->kvm = kvm; > + vcpu->cpu_id = cpu_id; > + vcpu->cpu_type = vcpu_init.target; > + vcpu->cpu_compatible = target->compatible; > + vcpu->is_running = true; > + > if (err || target->init(vcpu)) > die("Unable to initialise vcpu"); > > @@ -125,13 +132,6 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) > vcpu->ring = (void *)vcpu->kvm_run + > (coalesced_offset * PAGE_SIZE); > > - /* Populate the vcpu structure. */ > - vcpu->kvm = kvm; > - vcpu->cpu_id = cpu_id; > - vcpu->cpu_type = vcpu_init.target; > - vcpu->cpu_compatible = target->compatible; > - vcpu->is_running = true; > - > if (kvm_cpu__configure_features(vcpu)) > die("Unable to configure requested vcpu features"); > > -- > 2.35.1.616.g0bdcbb4464-goog > > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm