From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH 1/5] KVM paravirt_ops core infrastructure Date: Tue, 26 Jun 2007 06:56:10 -0500 Message-ID: <4680FEDA.7020404@codemonkey.ws> References: <4675F462.1010708@codemonkey.ws> <4675F4C3.6050700@codemonkey.ws> <64F9B87B6B770947A9F8391472E032160C73025E@ehost011-8.exch011.intermedia.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <64F9B87B6B770947A9F8391472E032160C73025E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Dor Laor Cc: kvm-devel , virtualization List-Id: virtualization@lists.linuxfoundation.org Dor Laor wrote: > ... > +static __init struct kvm_paravirt_state *paravirt_alloc_state(void) > +{ > + struct kvm_paravirt_state *state; > + > + state = (void *)get_zeroed_page(GFP_KERNEL); > + if (!state) > + goto err; > + > + state->vmca = (void *)get_zeroed_page(GFP_KERNEL); > + if (!state->vmca) > + goto err; > + > + /* FIXME: what do I need for this to be executable on 64 bit? */ > + state->hypercall = (void *)get_zeroed_page(GFP_KERNEL); > > Why do you alloc a page for the hypercall instead of using Ingo's code > below? This way it can work for 64 bit too. > The current patch queue uses data in the text segment but it makes sure that it has a proper page. Regards, Anthony Liguori > Ingo's code: > /* > * This is the vm-syscall address - to be patched by the host to > * VMCALL (Intel) or VMMCALL (AMD), depending on the CPU model: > */ > asm ( > " .globl hypercall_addr \n" > " .align 4 \n" > " hypercall_addr: \n" > " movl $-38, %eax \n" > " ret \n" > ); > extern unsigned char hypercall_addr[6]; > > > And use it this way: (I used vmalloc_to_page since its compiles as a > module) > hypercall_addr_page = vmalloc_to_page(hypercall_addr); > para_state->hypercall_gpa = page_to_pfn(hypercall_addr_page) << > PAGE_SHIFT | > offset_in_page(hypercall_addr); > > Regards, > Dor. > > > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/