From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Magenheimer Subject: RE: New Hypercall Declaration Date: Thu, 7 Oct 2010 11:07:55 -0700 (PDT) Message-ID: References: <12871952FC0E29439F861FA745BCDD8503EB081A@CH1PRD0104MB024.prod.exchangelabs.com>> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1299426179==" Return-path: In-Reply-To: <12871952FC0E29439F861FA745BCDD8503EC410F@CH1PRD0104MB027.prod.exchangelabs.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Nimgaonkar, Satyajeet" , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1299426179== Content-Type: multipart/alternative; boundary="__1286474884111132336abhmt007" --__1286474884111132336abhmt007 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable The hypercall_table and hypercall_args_table are initialized sequences of q= uads and bytes. Even though you have put 56 in the comment, you are initia= lizing the table entry immediately following the 48th entry, which would be= hypercall 49. You need to fill the entries from 49 to 55 in both tables w= ith the appropriate values. (The assembler syntax for these tables is weir= d, e.g. endr and rept, and I am not an expert on it.) =20 From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]=20 Sent: Thursday, October 07, 2010 11:37 AM To: Dan Magenheimer; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] New Hypercall Declaration =20 Hi Dan, I followed your instruction from the below email, but still I am= getting -1 for hypercall invocation. These are the steps I followed. 1. Add my hypercall in xen.h ---- #define __HYPERVISOR_jeet1 = 56 2. Added it to entry.S - hypercall table ---- .quad do_mca /= * 48 */ .quad = do_jeet1 /* 56 */ - hypercall_args_table ---- .byte 1 /* do= _mca */ /* 48 */ = .byte 0 /* do_jeet1 */ /* 56 */ 3. Then declared my hypercall in asm-x86/hypercall.h ---- void do_jeet1(voi= d);=20 4. Then calling it in domctl.c in xen/common --- void do_jeet1(void){ =20 printk ("Successfull Hypercall made to __HYPERVISOR_jeet1"); =20 } 5. Declared a function in xc_domain.c in xen/tools to call this hypercall int hypercall_test(int handle){ =20 int rc; int arg=3D0;=20 //int cmd=3D1; // //int test; /* Hypercall definitions */ =20 DECLARE_HYPERCALL; hypercall.op =3D __HYPERVISOR_jeet1; rc =3D do_xen_hypercall(handle, &hypercall); hypercall.arg[0] =3D 0; hypercall.arg[1] =3D (unsigned long)&arg; //printf ("Hypercall Details: %d\n", rc); //xc_interface_close(handle); =20 return rc; } 6. Then wrote a userlevel program to call function hypercall_test and invok= e my hypercall. #include #include int main(){ =20 printf("Attempt to invoke the hypercall: __HYPERVISOR_jeet1\n"); int handle, rc; =20 /* Acquire Hypervisor Interface Handle.=20 This handle goes as the first argument for the function do_xen_= hypercall() */ =20 handle =3D xc_interface_open(); printf ("Acquired handle to Xen Hypervisor:%d\n",handle); =20 =20 rc =3D hypercall_test(handle); printf ("Hypercall Details: %d\n", rc); =20 xc_interface_close(handle); printf ("Hypervisor handle closed\n"); =20 =20 return 0; =20 } I compiled entire xen, installed it and booted into the atest compiled xen.= But still my userlevel program compiles error free but returns me a -1 err= or for hypercall invocation. Can you please tell me what is that I doing wr= ong. Thanks. Regards, Satyajeet Nimgaonkar _____ =20 From: Dan Magenheimer [dan.magenheimer@oracle.com] Sent: Thursday, September 30, 2010 4:47 PM To: Nimgaonkar, Satyajeet; xen-devel@lists.xensource.com Subject: RE: [Xen-devel] New Hypercall Declaration Do you understand that you must also change the hypervisor to recognize and= do something with your new hypercall? Your userland code may actually be = working and the hypercall may actually be resulting in an entry into the hy= pervisor, but unless the hypervisor is modified to recognize the new hyperc= all (#56) and do something with it, the hypervisor will generate a return v= alue of -1 (essentially saying "I don't recognize this hypercall number"). =20 If you have modified the hypervisor, please share that patch. If not, you = will need to modify at least the hypercall_table and the hypercall_args_ta= ble in entry.S (under x86, x86_64, and x86_64/compat, or all three, dependi= ng on the bit-ness of your hypervisor and guest) and create a do_my_hyperca= ll() routine somewhere. Then of course you will need to ensure that you ar= e properly building, installing, and booting your newly modified hypervisor= . =20 Printk's done inside the hypervisor can be viewed using "xm dmesg" or via a= properly configured serial port. =20 Use "xm info" and look at cc_compile_date to ensure you are booting your ne= wly modified hypervisor. =20 Hope that helps, Dan =20 From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]=20 Sent: Thursday, September 30, 2010 4:03 PM To: xen-devel@lists.xensource.com Subject: [Xen-devel] New Hypercall Declaration =20 Hello Xen Developers, I am currently working on declaring a new hypercall in Xen. For this i have declared my hypercall in xen.h - #define __HYPERVISOR_jeet1 56 Then I modified the xcom_privcmd.c to accomodate my hypercall - case __HYPERVISOR_jeet1: printk("Successfull Hypercall made to __HYPERVISOR_jeet1"); I defined the structure for the Hypercall in xc_domain.c int hypercall_test(int handle){ =20 int rc;=20 =20 /* Hypercall definitions */ =20 DECLARE_HYPERCALL; hypercall.op =3D __HYPERVISOR_jeet1; rc =3D do_xen_hypercall(handle, &hypercall); hypercall.arg[0] =3D 0; hypercall.arg[1] =3D 1; //printf ("Hypercall Details: %d\n", rc); //xc_interface_close(handle); =20 return rc;=20 } And then I am calling this Hypercall through an user level program- =20 #include #include int main(){ =20 printf("Attempt to invoke the hypercall: __HYPERVISOR_jeet1\n"); int handle, rc; =20 /* Acquire Hypervisor Interface Handle.=20 This handle goes as the first argument for the function do_xen_= hypercall() */ =20 handle =3D xc_interface_open(); printf ("Acquired handle to Xen Hypervisor:%d\n",handle); =20 =20 rc =3D hypercall_test(handle); printf ("Hypercall Details: %d\n", rc); =20 xc_interface_close(handle); =20 =20 return 0; =20 } The program compiles properly but gives me -1 error for rc. I have posted t= he same query and I got replies on it. But even after trying many things, I= am still stuck with this problem. Can anyone please tell me what I am doin= g wrong here. Also please tell me where should I view the output of printk in xen. Thanks in advance. Regards, Satyajeet Nimgaonkar --__1286474884111132336abhmt007 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable

The hypercall_table and hypercall_args_table are initializ= ed sequences of quads and bytes.  Even though you have put 56 in the co= mment, you are initializing the table entry immediately following the 48th<= /sup> entry, which would be hypercall 49.  You need to fill the entries fr= om 49 to 55 in both tables with the appropriate values.  (The assembler sy= ntax for these tables is weird, e.g. endr and rept, and I am not an expert on = it.)

 

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]
Sent: Thursday, October 07, 2010 11:37 AM
To: Dan Magenheimer; xen-devel@lists.xensource.com
Subject: RE: [Xen-devel] New Hypercall Declaration

 

Hi Dan,
           I followed your instruction from= the below email, but still I am getting -1 for hypercall invocation. These ar= e the steps I followed.

1. Add my hypercall in xen.h  ----  #define __HYPERVISOR_jeet1         &= nbsp;      56

2. Added it to entry.S - hypercall table ---- .quad do_mca           &= nbsp;    /* 48 */
                    &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            .quad do_jeet1                /* 56 = */
            &= nbsp;           &n= bsp;         - hypercall_args_table ---- .byte 1 /* do_mca           &= nbsp;   */  /* 48 */
            &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;            = ;            =     .byte 0 /* do_jeet1         =     */  /* 56 */

3. Then declared my hypercall in asm-x86/hypercall.h ---- void do_jeet1(v= oid);

4. Then calling it in domctl.c in xen/common --- void do_jeet1(void){
   
   printk ("Successfull Hypercall made to __HYPERVISOR_jeet1");
  
}

5. Declared a function in xc_domain.c in xen/tools to call this hypercall=

   int hypercall_test(int handle){
   
    int rc;
    int arg=3D0;
    //int cmd=3D1;
    //
    //int test;
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     =3D __HYPERVISOR_= jeet1;
    rc =3D do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] =3D 0;
    hypercall.arg[1] =3D (unsigned long)&arg;
    //printf ("Hypercall Details: %d\n", rc);     //xc_interface_close(handle);   
    return rc;
}

6. Then wrote a userlevel program to call function hypercall_test and inv= oke my hypercall.

    #include <xenctrl.h>
#include <stdio.h>



int main(){
        
     printf("Attempt to invoke the hypercall: __HYPERVISOR_jeet1\n");
     int handle, rc;
     
         /* Acquire Hypervisor Interface Handle.
            This h= andle goes as the first argument for the function do_xen_hypercall()
         */
        
     handle =3D xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc =3D hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc)= ;
     
     xc_interface_close(handle);
     printf ("Hypervisor handle closed\n");     
     
     return 0;
    
}


I compiled entire xen, installed it and booted into the atest compiled xe= n. But still my userlevel program compiles error free but returns me a -1 error = for hypercall invocation. Can you please tell me what is that I doing wrong.<= br> Thanks.

Regards,
Satyajeet Nimgaonkar


From:= Dan Magenheimer [dan.magenheimer@oracle.com]
Sent: Thursday, September 30, 2010 4:47 PM
To: Nimgaonkar, Satyajeet; xen-devel@lists.xensource.com
Subject: RE: [Xen-devel] New Hypercall Declaration

Do you understand that you must also change the hypervisor= to recognize and do something with your new hypercall?  Your userland c= ode may actually be working and the hypercall may actually be resulting in an= entry into the hypervisor, but unless the hypervisor is modified to recognize t= he new hypercall (#56) and do something with it, the hypervisor will generate a = return value of -1 (essentially saying “I don’t recognize this hyper= call number”).

 

If you have modified the hypervisor, please share that patch.  If not, you will need to modify at least  the hypercall= _table and the hypercall_args_table in entry.S (under x86, x86_64, and x86_64/co= mpat, or all three, depending on the bit-ness of your hypervisor and guest) and create a do_my_hypercall() routine somewhere.  Then of course you wi= ll need to ensure that you are properly building, installing, and booting yo= ur newly modified hypervisor.<= /span>

 

Printk’s done inside the hypervisor can be viewed us= ing “xm dmesg” or via a properly configured serial port.

 

Use “xm info” and look at cc_compile_date to e= nsure you are booting your newly modified hypervisor.

 

Hope that helps,

Dan

 

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.ed= u]
Sent: Thursday, September 30, 2010 4:03 PM
To: xen-devel@lists.xensource.com
Subject: [Xen-devel] New Hypercall Declaration

 =

Hello Xen Developers,

 
I am currently working on declaring a new hypercall in Xen.
For this i have declared my hypercall in xen.h -
#define __HYPERVISOR_jeet1         &= nbsp;      56

Then I modified the xcom_privcmd.c to accomodate my hypercall -
         case __HYPERVISOR_jeet1:=
            &= nbsp;    printk("Successfull Hypercall made to
__HYPERVISOR_jeet1");

I defined the structure for the Hypercall in xc_domain.c

int hypercall_test(int handle){
   
    int rc;
     
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     =3D __HYPERVISOR_= jeet1;
    rc =3D do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] =3D 0;
    hypercall.arg[1] =3D 1;
    //printf ("Hypercall Details: %d\n", rc);     //xc_interface_close(handle);   
    return rc;
}

And then I am calling this Hypercall through an user level program-
 
#include <xenctrl.h>
#include <stdio.h>



int main(){
        
     printf("Attempt to invoke the hypercall: __HYPERVISOR_jeet1\n");
     int handle, rc;
     
         /* Acquire Hypervisor Interface Handle.
            This h= andle goes as the first argument for the function do_xen_hypercall()
         */
        
     handle =3D xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc =3D hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc)= ;
     
     xc_interface_close(handle);    &n= bsp;
     
     return 0;
    
}


The program compiles properly but gives me -1 error for rc. I have posted= the same query and I got replies on it. But even after trying many things, I = am still stuck with this problem. Can anyone please tell me what I am doing = wrong here. Also please tell me where
should I view the output of printk in xen.

Thanks in advance.

Regards,
Satyajeet Nimgaonkar
=

--__1286474884111132336abhmt007-- --===============1299426179== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1299426179==--