From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerone Young Subject: Re: [PATCH 1 of 2] Add kvm_load_registers after first vcpu creation Date: Thu, 10 Apr 2008 16:59:40 -0500 Message-ID: <1207864780.8805.4.camel@thinkpadL> References: <20080410213542.GA10283@dmt> Reply-To: jyoung5@us.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, kvm-ppc-devel@lists.sourceforge.net To: Marcelo Tosatti Return-path: In-Reply-To: <20080410213542.GA10283@dmt> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org On Thu, 2008-04-10 at 18:35 -0300, Marcelo Tosatti wrote: > On Thu, Apr 10, 2008 at 04:04:47PM -0500, Jerone Young wrote: > > 1 file changed, 5 insertions(+) > > qemu/qemu-kvm.c | 5 +++++ > > > > > > This patch adds a call to load_kvm_registers after creation of > > vcpu. This is required for ppc since we are required to set certain > > registers before boot. This should not have any effect on the curren > > x86 code (though I need to test this to make sure). > > > > What I would like though are some comments on the fix. Is this the > > right place for this? We had this in our platform setup code, but with > > recent code changes it will not work there anymore). > > > > Signed-off-by: Jerone Young > > > > diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c > > --- a/qemu/qemu-kvm.c > > +++ b/qemu/qemu-kvm.c > > @@ -353,6 +353,11 @@ static void *ap_main_loop(void *_env) > > sigdelset(&signals, SIG_IPI); > > sigprocmask(SIG_BLOCK, &signals, NULL); > > kvm_create_vcpu(kvm_context, env->cpu_index); > > + if (env->cpu_index == 0) { > > + /* load any registers set in env into > > + kvm for the first guest vcpu */ > > + kvm_load_registers(env); > > + } > > kvm_qemu_init_env(env); > > if (kvm_irqchip_in_kernel(kvm_context)) > > env->hflags &= ~HF_HALTED_MASK; > > Hi Jerone, > > You can hook into PPC's kvm_arch_qemu_init_env(). That would be a much better place. I also noticed that kvm_qemu_init_env() is called in ap_main_loop and the kvm_main_loop_cpu. ap_main_loop calls kvm_main_loop_cpu, so one them should be removed. I'll submit another patch for that. > ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone